@whitesev/pops 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +901 -494
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +901 -494
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +901 -494
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +901 -494
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +901 -494
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +901 -494
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/Pops.d.ts +69 -29
- package/dist/types/src/components/panel/handlerComponents.d.ts +202 -55
- package/dist/types/src/components/panel/index.d.ts +1 -1
- package/dist/types/src/components/panel/types/components-select.d.ts +42 -5
- package/package.json +3 -3
- package/src/components/panel/defaultConfig.ts +278 -228
- package/src/components/panel/handlerComponents.ts +551 -197
- package/src/components/panel/index.css +67 -12
- package/src/components/panel/types/components-select.ts +42 -5
- package/src/components/rightClickMenu/index.css +1 -1
- package/src/css/common.css +4 -4
|
@@ -459,7 +459,7 @@ export const PanelHandlerComponents = () => {
|
|
|
459
459
|
* 获取中间容器的元素<li>
|
|
460
460
|
* @param viewConfig
|
|
461
461
|
*/
|
|
462
|
-
|
|
462
|
+
createSectionContainerItem_slider(viewConfig: PopsPanelSliderConfig) {
|
|
463
463
|
const $li = popsDOMUtils.createElement("li");
|
|
464
464
|
Reflect.set($li, this.$data.nodeStoreConfigKey, viewConfig);
|
|
465
465
|
this.setElementClassName($li, viewConfig.className);
|
|
@@ -1486,12 +1486,212 @@ export const PanelHandlerComponents = () => {
|
|
|
1486
1486
|
</div>
|
|
1487
1487
|
`
|
|
1488
1488
|
);
|
|
1489
|
+
const $itemLeftContainer = $li.querySelector<HTMLElement>(".pops-panel-item-left-text")!;
|
|
1490
|
+
const $container = $li.querySelector<HTMLElement>(".pops-panel-select")!;
|
|
1491
|
+
const $select = $li.querySelector<HTMLSelectElement>(".pops-panel-select select")!;
|
|
1492
|
+
const width = (typeof viewConfig.width === "number" ? `${viewConfig.width}px` : viewConfig.width) ?? "200px";
|
|
1493
|
+
popsDOMUtils.css($container, "width", width);
|
|
1494
|
+
const mode = viewConfig.mode ?? "native";
|
|
1489
1495
|
let handler;
|
|
1490
|
-
if (
|
|
1496
|
+
if (mode === "native") {
|
|
1497
|
+
const PopsPanelSelectNative = {
|
|
1498
|
+
[Symbol.toStringTag]: "PopsPanelSelectNative",
|
|
1499
|
+
$el: {
|
|
1500
|
+
itemLeftTextContainer: $itemLeftContainer,
|
|
1501
|
+
$container: $container,
|
|
1502
|
+
$select: $select,
|
|
1503
|
+
},
|
|
1504
|
+
$eleKey: {
|
|
1505
|
+
disable: "__disable__",
|
|
1506
|
+
value: "__value__",
|
|
1507
|
+
viewConfig: "data-view-config",
|
|
1508
|
+
},
|
|
1509
|
+
$data: {
|
|
1510
|
+
data: [] as PopsPanelSelectDataOption<any>[],
|
|
1511
|
+
defaultValue: viewConfig.getValue(),
|
|
1512
|
+
},
|
|
1513
|
+
init() {
|
|
1514
|
+
this.$el.$container.setAttribute("data-mode", mode);
|
|
1515
|
+
this.$data.data = typeof viewConfig.data === "function" ? viewConfig.data() : viewConfig.data;
|
|
1516
|
+
popsDOMUtils.addClassName(this.$el.$container, PopsCommonCSSClassName.userSelectNone);
|
|
1517
|
+
this.initOption();
|
|
1518
|
+
this.onValueChange();
|
|
1519
|
+
this.onClick();
|
|
1520
|
+
const disabled = typeof viewConfig.disabled === "function" ? viewConfig.disabled() : viewConfig.disabled;
|
|
1521
|
+
if (disabled) {
|
|
1522
|
+
this.disable();
|
|
1523
|
+
}
|
|
1524
|
+
},
|
|
1525
|
+
/**
|
|
1526
|
+
* 给option元素设置属性
|
|
1527
|
+
* @param $ele
|
|
1528
|
+
* @param key
|
|
1529
|
+
* @param value
|
|
1530
|
+
*/
|
|
1531
|
+
setNodeValue($ele: HTMLElement, key: string, value: any) {
|
|
1532
|
+
Reflect.set($ele, key, value);
|
|
1533
|
+
},
|
|
1534
|
+
/**
|
|
1535
|
+
* 获取option元素上设置的属性
|
|
1536
|
+
* @param $ele
|
|
1537
|
+
* @param value
|
|
1538
|
+
* @param key
|
|
1539
|
+
*/
|
|
1540
|
+
getNodeValue($ele: HTMLElement, key: string) {
|
|
1541
|
+
return Reflect.get($ele, key);
|
|
1542
|
+
},
|
|
1543
|
+
/**
|
|
1544
|
+
* 禁用选项
|
|
1545
|
+
*/
|
|
1546
|
+
disable() {
|
|
1547
|
+
this.$el.$select.setAttribute("disabled", "true");
|
|
1548
|
+
popsDOMUtils.addClassName(this.$el.$container, "pops-panel-select-disable");
|
|
1549
|
+
popsDOMUtils.addClassName(this.$el.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
|
|
1550
|
+
},
|
|
1551
|
+
/**
|
|
1552
|
+
* 取消禁用
|
|
1553
|
+
*/
|
|
1554
|
+
notDisable() {
|
|
1555
|
+
this.$el.$select.removeAttribute("disabled");
|
|
1556
|
+
popsDOMUtils.removeClassName(this.$el.$container, "pops-panel-select-disable");
|
|
1557
|
+
popsDOMUtils.removeClassName(this.$el.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
|
|
1558
|
+
},
|
|
1559
|
+
/**
|
|
1560
|
+
* 判断是否禁用
|
|
1561
|
+
*/
|
|
1562
|
+
isDisabled() {
|
|
1563
|
+
return (
|
|
1564
|
+
this.$el.$select.hasAttribute("disabled") ||
|
|
1565
|
+
popsDOMUtils.containsClassName(this.$el.$container, "pops-panel-select-disable")
|
|
1566
|
+
);
|
|
1567
|
+
},
|
|
1568
|
+
/**
|
|
1569
|
+
* 初始化选项
|
|
1570
|
+
*/
|
|
1571
|
+
initOption() {
|
|
1572
|
+
this.$data.data.forEach((dataItem) => {
|
|
1573
|
+
// 初始化默认选中
|
|
1574
|
+
const optionElement = popsDOMUtils.createElement("option");
|
|
1575
|
+
this.setNodeValue(optionElement, this.$eleKey.value, dataItem.value);
|
|
1576
|
+
this.setNodeValue(optionElement, this.$eleKey.disable, dataItem.disable);
|
|
1577
|
+
this.setNodeValue(optionElement, this.$eleKey.viewConfig, dataItem.views);
|
|
1578
|
+
if (dataItem.value === this.$data.defaultValue) {
|
|
1579
|
+
this.setOptionSelected(optionElement);
|
|
1580
|
+
}
|
|
1581
|
+
if (typeof dataItem.text === "function") {
|
|
1582
|
+
optionElement.innerText = dataItem.text(dataItem.value, dataItem);
|
|
1583
|
+
} else {
|
|
1584
|
+
optionElement.innerText = dataItem.text;
|
|
1585
|
+
}
|
|
1586
|
+
this.$el.$select.appendChild(optionElement);
|
|
1587
|
+
});
|
|
1588
|
+
},
|
|
1589
|
+
/**
|
|
1590
|
+
* 设置选项选中
|
|
1591
|
+
* @param $option
|
|
1592
|
+
*/
|
|
1593
|
+
setOptionSelected($option: HTMLOptionElement) {
|
|
1594
|
+
$option.setAttribute("selected", "true");
|
|
1595
|
+
},
|
|
1596
|
+
/**
|
|
1597
|
+
* 检测所有option并设置禁用状态
|
|
1598
|
+
*/
|
|
1599
|
+
setSelectOptionsDisableStatus() {
|
|
1600
|
+
if (this.$el.$select.options && this.$el.$select.options.length) {
|
|
1601
|
+
Array.from(this.$el.$select.options).forEach((optionItem) => {
|
|
1602
|
+
this.setOptionDisableStatus(optionItem);
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
},
|
|
1606
|
+
/**
|
|
1607
|
+
* 设置禁用状态
|
|
1608
|
+
* @param $option
|
|
1609
|
+
*/
|
|
1610
|
+
setOptionDisableStatus($option: HTMLOptionElement) {
|
|
1611
|
+
let disable = false;
|
|
1612
|
+
const optionDisableAttr = this.getNodeValue($option, this.$eleKey.disable);
|
|
1613
|
+
if (optionDisableAttr === "function") {
|
|
1614
|
+
const value = this.getNodeValue($option, this.$eleKey.value);
|
|
1615
|
+
disable = Boolean(optionDisableAttr(value));
|
|
1616
|
+
}
|
|
1617
|
+
if (disable) {
|
|
1618
|
+
$option.setAttribute("disabled", "true");
|
|
1619
|
+
} else {
|
|
1620
|
+
$option.removeAttribute("disabled");
|
|
1621
|
+
}
|
|
1622
|
+
},
|
|
1623
|
+
/**
|
|
1624
|
+
* 获取option上的信息
|
|
1625
|
+
* @param $option
|
|
1626
|
+
*/
|
|
1627
|
+
getSelectOptionInfo($option: HTMLOptionElement) {
|
|
1628
|
+
const optionValue = this.getNodeValue($option, this.$eleKey.value);
|
|
1629
|
+
const optionText = $option.innerText || $option.textContent!;
|
|
1630
|
+
const views = this.getNodeValue($option, this.$eleKey.viewConfig) as NonNullable<
|
|
1631
|
+
PopsPanelSelectDataOption<any>["views"]
|
|
1632
|
+
>;
|
|
1633
|
+
return {
|
|
1634
|
+
value: optionValue,
|
|
1635
|
+
text: optionText,
|
|
1636
|
+
views: views,
|
|
1637
|
+
$option: $option,
|
|
1638
|
+
};
|
|
1639
|
+
},
|
|
1640
|
+
/**
|
|
1641
|
+
* 监听选择内容改变
|
|
1642
|
+
*/
|
|
1643
|
+
onValueChange() {
|
|
1644
|
+
popsDOMUtils.on<PointerEvent | TouchEvent>(this.$el.$select, "change", () => {
|
|
1645
|
+
const $isSelectedElement = this.$el.$select[this.$el.$select.selectedIndex] as HTMLOptionElement;
|
|
1646
|
+
const selectInfo = this.getSelectOptionInfo($isSelectedElement);
|
|
1647
|
+
this.setSelectOptionsDisableStatus();
|
|
1648
|
+
if (typeof viewConfig.callback === "function") {
|
|
1649
|
+
viewConfig.callback(selectInfo);
|
|
1650
|
+
}
|
|
1651
|
+
const views = typeof selectInfo.views === "function" ? selectInfo.views() : selectInfo.views;
|
|
1652
|
+
if (Array.isArray(views)) {
|
|
1653
|
+
// 如果成功创建,加入到中间容器中
|
|
1654
|
+
const childUListClassName = "pops-panel-select-child-forms";
|
|
1655
|
+
// 移除旧的元素
|
|
1656
|
+
while ($li.nextElementSibling) {
|
|
1657
|
+
if ($li.nextElementSibling.classList.contains(childUListClassName)) {
|
|
1658
|
+
$li.nextElementSibling.remove();
|
|
1659
|
+
} else {
|
|
1660
|
+
break;
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
const $childUList = popsDOMUtils.createElement("ul");
|
|
1664
|
+
$childUList.className = childUListClassName;
|
|
1665
|
+
popsDOMUtils.after($li, $childUList);
|
|
1666
|
+
that.uListContainerAddItem(viewConfig, {
|
|
1667
|
+
ulElement: $childUList,
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
});
|
|
1671
|
+
},
|
|
1672
|
+
/**
|
|
1673
|
+
* 监听点击事件
|
|
1674
|
+
*/
|
|
1675
|
+
onClick() {
|
|
1676
|
+
popsDOMUtils.on(this.$el.$select, "click", void 0, (event) => {
|
|
1677
|
+
this.setSelectOptionsDisableStatus();
|
|
1678
|
+
if (typeof viewConfig.clickCallBack === "function") {
|
|
1679
|
+
const $isSelectedElement = this.$el.$select[this.$el.$select.selectedIndex] as HTMLOptionElement;
|
|
1680
|
+
const selectInfo = this.getSelectOptionInfo($isSelectedElement);
|
|
1681
|
+
viewConfig.clickCallBack(event, selectInfo);
|
|
1682
|
+
}
|
|
1683
|
+
});
|
|
1684
|
+
},
|
|
1685
|
+
};
|
|
1686
|
+
|
|
1687
|
+
PopsPanelSelectNative.init();
|
|
1688
|
+
Reflect.set($li, "data-select", PopsPanelSelectNative);
|
|
1689
|
+
handler = PopsPanelSelectNative;
|
|
1690
|
+
} else if (mode === "dialog") {
|
|
1491
1691
|
const PopsPanelSelect = {
|
|
1492
1692
|
[Symbol.toStringTag]: "PopsPanelSelect",
|
|
1493
1693
|
$el: {
|
|
1494
|
-
|
|
1694
|
+
$itemLeftContainer: $itemLeftContainer,
|
|
1495
1695
|
/** 选择框容器 */
|
|
1496
1696
|
$container: void 0 as any as HTMLElement,
|
|
1497
1697
|
/** 选择框包裹的容器 */
|
|
@@ -1548,7 +1748,8 @@ export const PanelHandlerComponents = () => {
|
|
|
1548
1748
|
initDefault() {
|
|
1549
1749
|
this.$data.data = typeof viewConfig.data === "function" ? viewConfig.data() : viewConfig.data;
|
|
1550
1750
|
this.$data.data.forEach((dataItem) => {
|
|
1551
|
-
|
|
1751
|
+
const flag = this.$data.defaultValue.includes(dataItem.value);
|
|
1752
|
+
if (flag) {
|
|
1552
1753
|
// 初始化选中的配置
|
|
1553
1754
|
this.resetCurrentSelectedInfo();
|
|
1554
1755
|
this.updateSelectedInfo(dataItem);
|
|
@@ -1557,7 +1758,8 @@ export const PanelHandlerComponents = () => {
|
|
|
1557
1758
|
},
|
|
1558
1759
|
/** 初始化$ele变量 */
|
|
1559
1760
|
initEl() {
|
|
1560
|
-
this.$el.$container = $
|
|
1761
|
+
this.$el.$container = $container;
|
|
1762
|
+
this.$el.$container.setAttribute("data-mode", mode);
|
|
1561
1763
|
PopsSafeUtils.setSafeHTML(
|
|
1562
1764
|
this.$el.$container,
|
|
1563
1765
|
/*html*/ `
|
|
@@ -1663,23 +1865,23 @@ export const PanelHandlerComponents = () => {
|
|
|
1663
1865
|
* 禁用选项容器
|
|
1664
1866
|
*/
|
|
1665
1867
|
disable() {
|
|
1666
|
-
popsDOMUtils.addClassName(this.$el.$container, "pops-panel-select-
|
|
1667
|
-
popsDOMUtils.addClassName(this.$el
|
|
1868
|
+
popsDOMUtils.addClassName(this.$el.$container, "pops-panel-select-disable");
|
|
1869
|
+
popsDOMUtils.addClassName(this.$el.$itemLeftContainer, PopsCommonCSSClassName.textIsDisabled);
|
|
1668
1870
|
},
|
|
1669
1871
|
/**
|
|
1670
1872
|
* 取消禁用选项容器
|
|
1671
1873
|
*/
|
|
1672
1874
|
cancleDisable() {
|
|
1673
|
-
popsDOMUtils.removeClassName(this.$el.$container, "pops-panel-select-
|
|
1674
|
-
popsDOMUtils.removeClassName(this.$el
|
|
1875
|
+
popsDOMUtils.removeClassName(this.$el.$container, "pops-panel-select-disable");
|
|
1876
|
+
popsDOMUtils.removeClassName(this.$el.$itemLeftContainer, PopsCommonCSSClassName.textIsDisabled);
|
|
1675
1877
|
},
|
|
1676
1878
|
/**
|
|
1677
1879
|
* 判断当前是否已禁用选项容器
|
|
1678
1880
|
*/
|
|
1679
1881
|
isDisabled() {
|
|
1680
1882
|
return (
|
|
1681
|
-
popsDOMUtils.containsClassName(this.$el.$container, "pops-panel-select-
|
|
1682
|
-
popsDOMUtils.containsClassName(this.$el
|
|
1883
|
+
popsDOMUtils.containsClassName(this.$el.$container, "pops-panel-select-disable") ||
|
|
1884
|
+
popsDOMUtils.containsClassName(this.$el.$itemLeftContainer, PopsCommonCSSClassName.textIsDisabled)
|
|
1683
1885
|
);
|
|
1684
1886
|
},
|
|
1685
1887
|
/**
|
|
@@ -1915,6 +2117,13 @@ export const PanelHandlerComponents = () => {
|
|
|
1915
2117
|
isItemSelected($el: HTMLElement): boolean {
|
|
1916
2118
|
return $el.classList.contains("select-item-is-selected");
|
|
1917
2119
|
},
|
|
2120
|
+
/**
|
|
2121
|
+
* 获取项上存储的信息
|
|
2122
|
+
* @param $el 选项元素
|
|
2123
|
+
*/
|
|
2124
|
+
getItemDataOption($el: HTMLElement): PopsPanelSelectDataOption<any> {
|
|
2125
|
+
return Reflect.get($el, "data-info");
|
|
2126
|
+
},
|
|
1918
2127
|
/**
|
|
1919
2128
|
* 添加选中信息
|
|
1920
2129
|
* @param data 选择项的数据
|
|
@@ -1925,13 +2134,6 @@ export const PanelHandlerComponents = () => {
|
|
|
1925
2134
|
this.updateSelectedInfo(data);
|
|
1926
2135
|
this.onValueChangeCallback(data);
|
|
1927
2136
|
},
|
|
1928
|
-
/**
|
|
1929
|
-
* 获取项上存储的信息
|
|
1930
|
-
* @param $el 选项元素
|
|
1931
|
-
*/
|
|
1932
|
-
getItemDataOption($el: HTMLElement): PopsPanelSelectDataOption<any> {
|
|
1933
|
-
return Reflect.get($el, "data-info");
|
|
1934
|
-
},
|
|
1935
2137
|
/**
|
|
1936
2138
|
* 移除选中信息
|
|
1937
2139
|
* @param data 选择项的数据
|
|
@@ -2090,219 +2292,371 @@ export const PanelHandlerComponents = () => {
|
|
|
2090
2292
|
}
|
|
2091
2293
|
});
|
|
2092
2294
|
},
|
|
2093
|
-
/** 显示输入框 */
|
|
2094
|
-
showInputWrapper() {
|
|
2095
|
-
popsDOMUtils.cssShow(this.$el.$selectedInputWrapper);
|
|
2096
|
-
},
|
|
2097
|
-
/** 隐藏输入框 */
|
|
2098
|
-
hideInputWrapper() {
|
|
2099
|
-
popsDOMUtils.cssHide(this.$el.$selectedInputWrapper, true);
|
|
2100
|
-
},
|
|
2101
|
-
/** 显示palceholder */
|
|
2102
|
-
showPlaceHolderWrapper() {
|
|
2103
|
-
popsDOMUtils.cssShow(this.$el.$selectedPlaceHolderWrapper);
|
|
2104
|
-
},
|
|
2105
|
-
/** 隐藏palceholder */
|
|
2106
|
-
hidePlaceHolderWrapper() {
|
|
2107
|
-
popsDOMUtils.cssHide(this.$el.$selectedPlaceHolderWrapper, true);
|
|
2108
|
-
},
|
|
2109
|
-
};
|
|
2110
|
-
PopsPanelSelect.init();
|
|
2111
|
-
Reflect.set($li, "data-select", PopsPanelSelect);
|
|
2112
|
-
handler = PopsPanelSelect;
|
|
2113
|
-
} else {
|
|
2114
|
-
const
|
|
2115
|
-
[Symbol.toStringTag]: "
|
|
2116
|
-
$el: {
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
data: [] as PopsPanelSelectDataOption<any>[],
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2295
|
+
/** 显示输入框 */
|
|
2296
|
+
showInputWrapper() {
|
|
2297
|
+
popsDOMUtils.cssShow(this.$el.$selectedInputWrapper);
|
|
2298
|
+
},
|
|
2299
|
+
/** 隐藏输入框 */
|
|
2300
|
+
hideInputWrapper() {
|
|
2301
|
+
popsDOMUtils.cssHide(this.$el.$selectedInputWrapper, true);
|
|
2302
|
+
},
|
|
2303
|
+
/** 显示palceholder */
|
|
2304
|
+
showPlaceHolderWrapper() {
|
|
2305
|
+
popsDOMUtils.cssShow(this.$el.$selectedPlaceHolderWrapper);
|
|
2306
|
+
},
|
|
2307
|
+
/** 隐藏palceholder */
|
|
2308
|
+
hidePlaceHolderWrapper() {
|
|
2309
|
+
popsDOMUtils.cssHide(this.$el.$selectedPlaceHolderWrapper, true);
|
|
2310
|
+
},
|
|
2311
|
+
};
|
|
2312
|
+
PopsPanelSelect.init();
|
|
2313
|
+
Reflect.set($li, "data-select", PopsPanelSelect);
|
|
2314
|
+
handler = PopsPanelSelect;
|
|
2315
|
+
} else if (mode === "horizontal") {
|
|
2316
|
+
const PopsPanelSelectHorizontal = {
|
|
2317
|
+
[Symbol.toStringTag]: "PopsPanelSelectHorizontal",
|
|
2318
|
+
$el: {
|
|
2319
|
+
$itemLeftContainer: $itemLeftContainer,
|
|
2320
|
+
/** 选择框容器 */
|
|
2321
|
+
$container: $container,
|
|
2322
|
+
/** 选择框包裹的容器 */
|
|
2323
|
+
$wrapper: void 0 as any as HTMLElement,
|
|
2324
|
+
},
|
|
2325
|
+
$data: {
|
|
2326
|
+
/**
|
|
2327
|
+
* 数据
|
|
2328
|
+
*/
|
|
2329
|
+
data: [] as PopsPanelSelectDataOption<any>[],
|
|
2330
|
+
/**
|
|
2331
|
+
* 默认值
|
|
2332
|
+
*/
|
|
2333
|
+
defaultValue: viewConfig.getValue(),
|
|
2334
|
+
/**
|
|
2335
|
+
* 选择的信息
|
|
2336
|
+
*/
|
|
2337
|
+
selectedData: void 0 as PopsPanelSelectDataOption<any> | undefined,
|
|
2338
|
+
/**
|
|
2339
|
+
* 箭头旋转的属性
|
|
2340
|
+
*/
|
|
2341
|
+
rotateKey: "data-show-option",
|
|
2342
|
+
},
|
|
2343
|
+
/** 初始化 */
|
|
2344
|
+
init() {
|
|
2345
|
+
this.initDefault();
|
|
2346
|
+
this.initEl();
|
|
2347
|
+
|
|
2348
|
+
const disabled = typeof viewConfig.disabled === "function" ? viewConfig.disabled() : viewConfig.disabled;
|
|
2349
|
+
if (disabled) {
|
|
2350
|
+
this.disable();
|
|
2351
|
+
}
|
|
2352
|
+
},
|
|
2353
|
+
/** 初始化默认值 */
|
|
2354
|
+
initDefault() {
|
|
2355
|
+
this.$data.data = typeof viewConfig.data === "function" ? viewConfig.data() : viewConfig.data;
|
|
2356
|
+
if (!this.$data.data.length) {
|
|
2357
|
+
throw new Error("PopsPanelSelect: data is empty");
|
|
2358
|
+
}
|
|
2359
|
+
},
|
|
2360
|
+
/** 初始化$ele变量 */
|
|
2361
|
+
initEl() {
|
|
2362
|
+
this.$el.$container.setAttribute("data-mode", mode);
|
|
2363
|
+
PopsSafeUtils.setSafeHTML(
|
|
2364
|
+
this.$el.$container,
|
|
2365
|
+
/*html*/ `
|
|
2366
|
+
<div class="el-select__wrapper">
|
|
2367
|
+
</div>`
|
|
2368
|
+
);
|
|
2369
|
+
this.$el.$wrapper = $li.querySelector<HTMLElement>(".el-select__wrapper")!;
|
|
2370
|
+
|
|
2371
|
+
this.$data.data.forEach((dataItem) => {
|
|
2372
|
+
const $item = this.createSelectItemElement(dataItem);
|
|
2373
|
+
this.onSelectItemClick(dataItem, $item);
|
|
2374
|
+
if (this.$data.defaultValue === dataItem.value) {
|
|
2375
|
+
this.addSelectedItemInfo(dataItem);
|
|
2376
|
+
}
|
|
2377
|
+
this.$el.$wrapper.appendChild($item);
|
|
2378
|
+
});
|
|
2379
|
+
this.updateAllSelectItemStatus();
|
|
2380
|
+
},
|
|
2381
|
+
/**
|
|
2382
|
+
* 禁用选项容器
|
|
2383
|
+
*/
|
|
2384
|
+
disable() {
|
|
2385
|
+
popsDOMUtils.addClassName(this.$el.$container, "pops-panel-select-disable");
|
|
2386
|
+
popsDOMUtils.addClassName(this.$el.$itemLeftContainer, PopsCommonCSSClassName.textIsDisabled);
|
|
2387
|
+
},
|
|
2388
|
+
/**
|
|
2389
|
+
* 取消禁用选项容器
|
|
2390
|
+
*/
|
|
2391
|
+
cancleDisable() {
|
|
2392
|
+
popsDOMUtils.removeClassName(this.$el.$container, "pops-panel-select-disable");
|
|
2393
|
+
popsDOMUtils.removeClassName(this.$el.$itemLeftContainer, PopsCommonCSSClassName.textIsDisabled);
|
|
2394
|
+
},
|
|
2395
|
+
/**
|
|
2396
|
+
* 判断当前是否已禁用选项容器
|
|
2397
|
+
*/
|
|
2398
|
+
isDisabled() {
|
|
2399
|
+
return (
|
|
2400
|
+
popsDOMUtils.containsClassName(this.$el.$container, "pops-panel-select-disable") ||
|
|
2401
|
+
popsDOMUtils.containsClassName(this.$el.$itemLeftContainer, PopsCommonCSSClassName.textIsDisabled)
|
|
2402
|
+
);
|
|
2403
|
+
},
|
|
2404
|
+
/**
|
|
2405
|
+
* 创建选择项
|
|
2406
|
+
* @param data 数据
|
|
2407
|
+
*/
|
|
2408
|
+
createSelectItemElement(data: PopsPanelSelectDataOption<any>) {
|
|
2409
|
+
const $select = popsDOMUtils.createElement("div", {
|
|
2410
|
+
className: "select-item",
|
|
2411
|
+
innerHTML: /*html*/ `
|
|
2412
|
+
<span class="select-item-text"></span>
|
|
2413
|
+
`,
|
|
2414
|
+
});
|
|
2415
|
+
this.setSelectItemText(data, $select);
|
|
2416
|
+
Reflect.set($select, "data-info", data);
|
|
2417
|
+
return $select;
|
|
2418
|
+
},
|
|
2419
|
+
/**
|
|
2420
|
+
* 设置选择项的文字
|
|
2421
|
+
* @param data 选择项的数据
|
|
2422
|
+
* @param $select 选择项元素
|
|
2423
|
+
*/
|
|
2424
|
+
setSelectItemText(data: PopsPanelSelectDataOption<any>, $select: HTMLElement) {
|
|
2425
|
+
const text = typeof data.text === "function" ? data.text(data.value, this.$data.selectedData) : data.text;
|
|
2426
|
+
const $selectSpan = $select.querySelector<HTMLElement>(".select-item-text");
|
|
2427
|
+
if (!$selectSpan) return;
|
|
2428
|
+
if (data.isHTML) {
|
|
2429
|
+
PopsSafeUtils.setSafeHTML($selectSpan, text);
|
|
2430
|
+
} else {
|
|
2431
|
+
$selectSpan.innerText = text;
|
|
2432
|
+
}
|
|
2433
|
+
},
|
|
2434
|
+
/**
|
|
2435
|
+
* 设置选择项点击事件
|
|
2436
|
+
*/
|
|
2437
|
+
onSelectItemClick(data: PopsPanelSelectDataOption<any> | undefined, $el: HTMLElement) {
|
|
2438
|
+
popsDOMUtils.on<PointerEvent | MouseEvent>($el, "click", (event) => {
|
|
2439
|
+
popsDOMUtils.preventEvent(event);
|
|
2440
|
+
if (this.isDisabled()) {
|
|
2441
|
+
return;
|
|
2442
|
+
}
|
|
2443
|
+
if (this.isSelectItemDisabled($el)) {
|
|
2444
|
+
// 被禁用了
|
|
2445
|
+
return;
|
|
2446
|
+
}
|
|
2447
|
+
if (typeof viewConfig.clickCallBack === "function") {
|
|
2448
|
+
const clickResult = viewConfig.clickCallBack(event, this.$data.selectedData!);
|
|
2449
|
+
if (typeof clickResult === "boolean" && !clickResult) {
|
|
2450
|
+
return;
|
|
2451
|
+
}
|
|
2452
|
+
} // 修改选中状态
|
|
2453
|
+
if (this.isItemSelected($el)) {
|
|
2454
|
+
// 移除选中
|
|
2455
|
+
this.removeItemSelected($el);
|
|
2456
|
+
this.removeSelectedItemInfo();
|
|
2457
|
+
} else {
|
|
2458
|
+
// 添加选中
|
|
2459
|
+
this.setItemSelected($el);
|
|
2460
|
+
this.addSelectedItemInfo(data!);
|
|
2461
|
+
}
|
|
2462
|
+
});
|
|
2463
|
+
},
|
|
2464
|
+
/**
|
|
2465
|
+
* 选中的值改变的回调
|
|
2466
|
+
* @param data 当前的选中信息
|
|
2467
|
+
*/
|
|
2468
|
+
onValueChangeCallback(data?: PopsPanelSelectDataOption<any>, isUpdateSelectItem: boolean = true) {
|
|
2469
|
+
// 动态更新禁用状态、选中状态
|
|
2470
|
+
isUpdateSelectItem && this.updateAllSelectItemStatus();
|
|
2471
|
+
// 触发回调
|
|
2472
|
+
if (typeof viewConfig.callback === "function") {
|
|
2473
|
+
viewConfig.callback(data || this.$data.selectedData!);
|
|
2474
|
+
}
|
|
2475
|
+
},
|
|
2476
|
+
/**
|
|
2477
|
+
* 更新选项弹窗内的所有选项元素的状态
|
|
2478
|
+
*
|
|
2479
|
+
* + 更新禁用状态
|
|
2480
|
+
* + 更新选中状态
|
|
2481
|
+
*/
|
|
2482
|
+
updateAllSelectItemStatus() {
|
|
2483
|
+
const allSelectItems = this.getAllSelectItems(false);
|
|
2484
|
+
allSelectItems.forEach(($selectInfo) => {
|
|
2485
|
+
const { data, $select } = $selectInfo;
|
|
2486
|
+
// 更新文字
|
|
2487
|
+
this.setSelectItemText(data, $selectInfo.$select);
|
|
2488
|
+
if (typeof data.disable === "function" && data.disable(data.value, this.$data.selectedData)) {
|
|
2489
|
+
// 移除选中状态
|
|
2490
|
+
this.removeItemSelected($select);
|
|
2491
|
+
// 禁用
|
|
2492
|
+
this.setSelectItemDisabled($select);
|
|
2493
|
+
} else {
|
|
2494
|
+
// 移除禁用状态
|
|
2495
|
+
this.removeSelectItemDisabled($select);
|
|
2496
|
+
}
|
|
2497
|
+
// 根据当前已选择的信息,判断并更新选中状态
|
|
2498
|
+
if (this.$data.selectedData != null && this.$data.selectedData.value === data.value) {
|
|
2499
|
+
// 就是这个项
|
|
2500
|
+
// 设置选中
|
|
2501
|
+
this.setItemSelected($select);
|
|
2502
|
+
} else {
|
|
2503
|
+
// 不是这个项
|
|
2504
|
+
// 移除选中状态
|
|
2505
|
+
this.removeItemSelected($select);
|
|
2506
|
+
}
|
|
2507
|
+
});
|
|
2508
|
+
},
|
|
2509
|
+
/**
|
|
2510
|
+
* 重置所有已选中的项以下状态
|
|
2511
|
+
*
|
|
2512
|
+
* + 更新选项显示的文字
|
|
2513
|
+
* + 移除禁用状态
|
|
2514
|
+
* + 移除选中状态
|
|
2515
|
+
*/
|
|
2516
|
+
resetAllSelectedItemStatus() {
|
|
2517
|
+
const allSelectedItems = this.getAllSelectItems(true);
|
|
2518
|
+
if (allSelectedItems.length) {
|
|
2519
|
+
// 移除选中信息
|
|
2520
|
+
this.resetCurrentSelectedInfo();
|
|
2139
2521
|
}
|
|
2522
|
+
allSelectedItems.forEach(($selectInfo) => {
|
|
2523
|
+
const { data, $select } = $selectInfo;
|
|
2524
|
+
// 更新文字
|
|
2525
|
+
this.setSelectItemText(data, $selectInfo.$select);
|
|
2526
|
+
// 移除选中状态
|
|
2527
|
+
this.removeItemSelected($select);
|
|
2528
|
+
// 取消禁用
|
|
2529
|
+
this.removeSelectItemDisabled($select);
|
|
2530
|
+
});
|
|
2140
2531
|
},
|
|
2141
2532
|
/**
|
|
2142
|
-
*
|
|
2143
|
-
* @param
|
|
2144
|
-
* @param
|
|
2145
|
-
* @param value
|
|
2533
|
+
* 添加选中信息
|
|
2534
|
+
* @param data 选择项的数据
|
|
2535
|
+
* @param [triggerValueChangeCallBack=true] 主动触发值改变回调
|
|
2146
2536
|
*/
|
|
2147
|
-
|
|
2148
|
-
|
|
2537
|
+
addSelectedItemInfo(data: PopsPanelSelectDataOption<any>) {
|
|
2538
|
+
this.resetCurrentSelectedInfo();
|
|
2539
|
+
this.updateSelectedInfo(data);
|
|
2540
|
+
this.onValueChangeCallback(data);
|
|
2149
2541
|
},
|
|
2150
2542
|
/**
|
|
2151
|
-
*
|
|
2152
|
-
* @param
|
|
2153
|
-
* @param value
|
|
2154
|
-
* @param key
|
|
2543
|
+
* 移除选中信息
|
|
2544
|
+
* @param data 选择项的数据
|
|
2155
2545
|
*/
|
|
2156
|
-
|
|
2157
|
-
|
|
2546
|
+
removeSelectedItemInfo() {
|
|
2547
|
+
// 删除
|
|
2548
|
+
this.updateSelectedInfo();
|
|
2549
|
+
this.onValueChangeCallback();
|
|
2158
2550
|
},
|
|
2159
2551
|
/**
|
|
2160
|
-
*
|
|
2552
|
+
* 更新选中信息
|
|
2553
|
+
* @param data 数据
|
|
2161
2554
|
*/
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2555
|
+
updateSelectedInfo(data?: PopsPanelSelectDataOption<any>) {
|
|
2556
|
+
// 先删除再赋值
|
|
2557
|
+
this.$data.selectedData = void 0;
|
|
2558
|
+
if (data) {
|
|
2559
|
+
if (data.addCustomInput && data.value.toString() === "") {
|
|
2560
|
+
// 自定义输入框,但是内容是空字符串
|
|
2561
|
+
// 不更新选中信息
|
|
2562
|
+
return;
|
|
2563
|
+
}
|
|
2564
|
+
this.$data.selectedData = data;
|
|
2565
|
+
}
|
|
2166
2566
|
},
|
|
2167
2567
|
/**
|
|
2168
|
-
*
|
|
2568
|
+
* 从保存的已选中的信息列表中移除目标信息
|
|
2169
2569
|
*/
|
|
2170
|
-
|
|
2171
|
-
this
|
|
2172
|
-
popsDOMUtils.removeClassName(this.$el.panelSelect, "pops-panel-select-disable");
|
|
2173
|
-
popsDOMUtils.removeClassName(this.$el.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
|
|
2570
|
+
resetCurrentSelectedInfo() {
|
|
2571
|
+
this.updateSelectedInfo();
|
|
2174
2572
|
},
|
|
2175
2573
|
/**
|
|
2176
|
-
*
|
|
2574
|
+
* 设置选择项禁用
|
|
2575
|
+
* @param $select 选择项元素
|
|
2177
2576
|
*/
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
popsDOMUtils.containsClassName(this.$el.panelSelect, "pops-panel-select-disable")
|
|
2182
|
-
);
|
|
2577
|
+
setSelectItemDisabled($select: HTMLElement) {
|
|
2578
|
+
$select.setAttribute("aria-disabled", "true");
|
|
2579
|
+
$select.setAttribute("disabled", "true");
|
|
2183
2580
|
},
|
|
2184
2581
|
/**
|
|
2185
|
-
*
|
|
2582
|
+
* 移除选择项的禁用状态
|
|
2583
|
+
* @param $select 选择项元素
|
|
2186
2584
|
*/
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
const optionElement = popsDOMUtils.createElement("option");
|
|
2191
|
-
this.setNodeValue(optionElement, this.$eleKey.value, dataItem.value);
|
|
2192
|
-
this.setNodeValue(optionElement, this.$eleKey.disable, dataItem.disable);
|
|
2193
|
-
this.setNodeValue(optionElement, this.$eleKey.viewConfig, dataItem.views);
|
|
2194
|
-
if (dataItem.value === this.$data.defaultValue) {
|
|
2195
|
-
this.setOptionSelected(optionElement);
|
|
2196
|
-
}
|
|
2197
|
-
if (typeof dataItem.text === "function") {
|
|
2198
|
-
optionElement.innerText = dataItem.text(dataItem.value, dataItem);
|
|
2199
|
-
} else {
|
|
2200
|
-
optionElement.innerText = dataItem.text;
|
|
2201
|
-
}
|
|
2202
|
-
this.$el.select.appendChild(optionElement);
|
|
2203
|
-
});
|
|
2585
|
+
removeSelectItemDisabled($select: HTMLElement) {
|
|
2586
|
+
$select.removeAttribute("aria-disabled");
|
|
2587
|
+
$select.removeAttribute("disabled");
|
|
2204
2588
|
},
|
|
2205
2589
|
/**
|
|
2206
|
-
*
|
|
2207
|
-
* @param $
|
|
2590
|
+
* 判断选择项是否禁用
|
|
2591
|
+
* @param $select 选择项元素
|
|
2208
2592
|
*/
|
|
2209
|
-
|
|
2210
|
-
$
|
|
2593
|
+
isSelectItemDisabled($select: HTMLElement) {
|
|
2594
|
+
return $select.hasAttribute("disabled") || $select.ariaDisabled;
|
|
2211
2595
|
},
|
|
2212
2596
|
/**
|
|
2213
|
-
*
|
|
2597
|
+
* 设置选择项选中
|
|
2598
|
+
* @param $select 选择项元素(.select-item)
|
|
2214
2599
|
*/
|
|
2215
|
-
|
|
2216
|
-
if (this
|
|
2217
|
-
|
|
2218
|
-
this.setOptionDisableStatus(optionItem);
|
|
2219
|
-
});
|
|
2220
|
-
}
|
|
2600
|
+
setItemSelected($select: HTMLElement) {
|
|
2601
|
+
if (this.isItemSelected($select)) return;
|
|
2602
|
+
$select.classList.add("select__selected-item");
|
|
2221
2603
|
},
|
|
2222
2604
|
/**
|
|
2223
|
-
*
|
|
2224
|
-
* @param $
|
|
2605
|
+
* 移除选择项选中
|
|
2606
|
+
* @param $select 选择项元素(.select-item)
|
|
2225
2607
|
*/
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
const optionDisableAttr = this.getNodeValue($option, this.$eleKey.disable);
|
|
2229
|
-
if (optionDisableAttr === "function") {
|
|
2230
|
-
const value = this.getNodeValue($option, this.$eleKey.value);
|
|
2231
|
-
disable = Boolean(optionDisableAttr(value));
|
|
2232
|
-
}
|
|
2233
|
-
if (disable) {
|
|
2234
|
-
$option.setAttribute("disabled", "true");
|
|
2235
|
-
} else {
|
|
2236
|
-
$option.removeAttribute("disabled");
|
|
2237
|
-
}
|
|
2608
|
+
removeItemSelected($select: HTMLElement) {
|
|
2609
|
+
$select.classList.remove("select__selected-item");
|
|
2238
2610
|
},
|
|
2239
2611
|
/**
|
|
2240
|
-
*
|
|
2241
|
-
* @param $
|
|
2612
|
+
* 判断选择项是否选中
|
|
2613
|
+
* @param $select 选择项元素(.select-item)
|
|
2242
2614
|
*/
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
const optionText = $option.innerText || $option.textContent!;
|
|
2246
|
-
const views = this.getNodeValue($option, this.$eleKey.viewConfig) as NonNullable<
|
|
2247
|
-
PopsPanelSelectDataOption<any>["views"]
|
|
2248
|
-
>;
|
|
2249
|
-
return {
|
|
2250
|
-
value: optionValue,
|
|
2251
|
-
text: optionText,
|
|
2252
|
-
views: views,
|
|
2253
|
-
$option: $option,
|
|
2254
|
-
};
|
|
2615
|
+
isItemSelected($select: HTMLElement) {
|
|
2616
|
+
return $select.classList.contains("select__selected-item");
|
|
2255
2617
|
},
|
|
2256
2618
|
/**
|
|
2257
|
-
*
|
|
2619
|
+
* 获取所有选项的信息
|
|
2620
|
+
* @param [onlySelected=true] 是否仅获取选中的项的信息
|
|
2621
|
+
* + true (默认)仅获取选中项的信息
|
|
2622
|
+
* + false 获取所有选择项的信息
|
|
2258
2623
|
*/
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
$li.nextElementSibling.remove();
|
|
2275
|
-
} else {
|
|
2276
|
-
break;
|
|
2624
|
+
getAllSelectItems(onlySelected: boolean = true) {
|
|
2625
|
+
return Array.from(this.$el.$wrapper?.querySelectorAll<HTMLElement>(".select-item") ?? [])
|
|
2626
|
+
.map(($select) => {
|
|
2627
|
+
const data = this.getItemDataOption($select);
|
|
2628
|
+
const result = {
|
|
2629
|
+
/** 选项信息数据 */
|
|
2630
|
+
data: data,
|
|
2631
|
+
/** 选项元素 */
|
|
2632
|
+
$select: $select,
|
|
2633
|
+
};
|
|
2634
|
+
if (onlySelected) {
|
|
2635
|
+
// 仅选中
|
|
2636
|
+
const isSelected = this.isItemSelected($select);
|
|
2637
|
+
if (isSelected) {
|
|
2638
|
+
return result;
|
|
2277
2639
|
}
|
|
2640
|
+
return;
|
|
2641
|
+
} else {
|
|
2642
|
+
return result;
|
|
2278
2643
|
}
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
ulElement: $childUList,
|
|
2284
|
-
});
|
|
2285
|
-
}
|
|
2286
|
-
});
|
|
2644
|
+
})
|
|
2645
|
+
.filter((item) => {
|
|
2646
|
+
return item != null;
|
|
2647
|
+
});
|
|
2287
2648
|
},
|
|
2288
2649
|
/**
|
|
2289
|
-
*
|
|
2650
|
+
* 获取项上存储的信息
|
|
2651
|
+
* @param $el 选项元素
|
|
2290
2652
|
*/
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
this.setSelectOptionsDisableStatus();
|
|
2294
|
-
if (typeof viewConfig.clickCallBack === "function") {
|
|
2295
|
-
const $isSelectedElement = this.$el.select[this.$el.select.selectedIndex] as HTMLOptionElement;
|
|
2296
|
-
const selectInfo = this.getSelectOptionInfo($isSelectedElement);
|
|
2297
|
-
viewConfig.clickCallBack(event, selectInfo);
|
|
2298
|
-
}
|
|
2299
|
-
});
|
|
2653
|
+
getItemDataOption($el: HTMLElement): PopsPanelSelectDataOption<any> {
|
|
2654
|
+
return Reflect.get($el, "data-info");
|
|
2300
2655
|
},
|
|
2301
2656
|
};
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
handler = PopsPanelSelectNative;
|
|
2657
|
+
PopsPanelSelectHorizontal.init();
|
|
2658
|
+
Reflect.set($li, "data-select", PopsPanelSelectHorizontal);
|
|
2659
|
+
handler = PopsPanelSelectHorizontal;
|
|
2306
2660
|
}
|
|
2307
2661
|
return {
|
|
2308
2662
|
$el: $li,
|
|
@@ -2357,7 +2711,7 @@ export const PanelHandlerComponents = () => {
|
|
|
2357
2711
|
[Symbol.toStringTag]: "PopsPanelSelectMultiple",
|
|
2358
2712
|
$el: {
|
|
2359
2713
|
/** 左侧文本容器 */
|
|
2360
|
-
|
|
2714
|
+
$itemLeftContainer: $li.querySelector<HTMLElement>(".pops-panel-item-left-text"),
|
|
2361
2715
|
/** 选择框容器 */
|
|
2362
2716
|
$container: void 0 as any as HTMLElement,
|
|
2363
2717
|
/** 选择框包裹的容器 */
|
|
@@ -2943,21 +3297,21 @@ export const PanelHandlerComponents = () => {
|
|
|
2943
3297
|
* 禁用标签
|
|
2944
3298
|
*/
|
|
2945
3299
|
disable() {
|
|
2946
|
-
popsDOMUtils.addClassName(this.$el
|
|
2947
|
-
popsDOMUtils.addClassName(this.$el.$container, "pops-panel-select-
|
|
3300
|
+
popsDOMUtils.addClassName(this.$el.$itemLeftContainer, PopsCommonCSSClassName.textIsDisabled);
|
|
3301
|
+
popsDOMUtils.addClassName(this.$el.$container, "pops-panel-select-disable");
|
|
2948
3302
|
},
|
|
2949
3303
|
/**
|
|
2950
3304
|
* 判断是否被禁用
|
|
2951
3305
|
*/
|
|
2952
3306
|
isDisabled() {
|
|
2953
|
-
return popsDOMUtils.containsClassName(this.$el.$container, "pops-panel-select-
|
|
3307
|
+
return popsDOMUtils.containsClassName(this.$el.$container, "pops-panel-select-disable");
|
|
2954
3308
|
},
|
|
2955
3309
|
/**
|
|
2956
3310
|
* 取消禁用标签
|
|
2957
3311
|
*/
|
|
2958
3312
|
cancleDisable() {
|
|
2959
|
-
popsDOMUtils.removeClassName(this.$el
|
|
2960
|
-
popsDOMUtils.removeClassName(this.$el.$container, "pops-panel-select-
|
|
3313
|
+
popsDOMUtils.removeClassName(this.$el.$itemLeftContainer, PopsCommonCSSClassName.textIsDisabled);
|
|
3314
|
+
popsDOMUtils.removeClassName(this.$el.$container, "pops-panel-select-disable");
|
|
2961
3315
|
},
|
|
2962
3316
|
};
|
|
2963
3317
|
|
|
@@ -3442,7 +3796,7 @@ export const PanelHandlerComponents = () => {
|
|
|
3442
3796
|
if (componentType === "switch") {
|
|
3443
3797
|
return this.createSectionContainerItem_switch(viewConfig);
|
|
3444
3798
|
} else if (componentType === "slider") {
|
|
3445
|
-
return this.
|
|
3799
|
+
return this.createSectionContainerItem_slider(viewConfig);
|
|
3446
3800
|
} else if (componentType === "input") {
|
|
3447
3801
|
return this.createSectionContainerItem_input(viewConfig);
|
|
3448
3802
|
} else if (componentType === "textarea") {
|