Files
NapCatQQ/.pnpm-store/v3/files/a9/095776661f3abade60e9bbb9b6afedd10d66198c30d4e80172bdb2eb4910b65835eb54c59a3f011e8ae871bb4a11aa50f28f99dc2dbaf2e657f8ea2be7e775
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

30 lines
961 B
Plaintext

import Picker from './picker.js';
class ColorPicker extends Picker {
constructor(select, label) {
super(select);
this.label.innerHTML = label;
this.container.classList.add('ql-color-picker');
Array.from(this.container.querySelectorAll('.ql-picker-item')).slice(0, 7).forEach(item => {
item.classList.add('ql-primary');
});
}
buildItem(option) {
const item = super.buildItem(option);
item.style.backgroundColor = option.getAttribute('value') || '';
return item;
}
selectItem(item, trigger) {
super.selectItem(item, trigger);
const colorLabel = this.label.querySelector('.ql-color-label');
const value = item ? item.getAttribute('data-value') || '' : '';
if (colorLabel) {
if (colorLabel.tagName === 'line') {
colorLabel.style.stroke = value;
} else {
colorLabel.style.fill = value;
}
}
}
}
export default ColorPicker;
//# sourceMappingURL=color-picker.js.map