@hbdlzy/ui-core 0.1.8 → 0.1.9
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/components.manifest.json +1 -1
- package/dist/components/BaseTable/BaseTable.types.d.ts +6 -1
- package/dist/components/OutlinedCascader/OutlinedCascader.vue.d.ts +1 -1
- package/dist/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +3 -3
- package/dist/components/OutlinedSelect/OutlinedSelect.vue.d.ts +4 -4
- package/dist/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +6 -6
- package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +4 -4
- package/dist/index.cjs +5 -5
- package/dist/index.js +303 -131
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/BaseTable/BaseTable.types.d.ts +6 -1
- package/src/components/BaseTable/BaseTable.types.ts +15 -1
- package/src/components/BaseTable/BaseTable.vue +324 -98
- package/src/components/BaseTable/README.md +76 -2
- package/src/components/OutlinedCascader/OutlinedCascader.vue.d.ts +2 -2
- package/src/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +3 -3
- package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +1 -1
- package/src/components/OutlinedInput/OutlinedInput.vue.d.ts +1 -1
- package/src/components/OutlinedSelect/OutlinedSelect.vue.d.ts +5 -5
- package/src/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +7 -7
- package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +5 -5
- package/src/index.d.ts +48 -12
package/dist/index.js
CHANGED
|
@@ -603,52 +603,36 @@ const _hoisted_17 = {
|
|
|
603
603
|
key: 0,
|
|
604
604
|
class: "base-table__header-select"
|
|
605
605
|
};
|
|
606
|
-
const _hoisted_18 =
|
|
607
|
-
const _hoisted_19 = {
|
|
608
|
-
key: 0,
|
|
609
|
-
class: "base-table__header-select-tags"
|
|
610
|
-
};
|
|
611
|
-
const _hoisted_20 = {
|
|
612
|
-
key: 0,
|
|
613
|
-
class: "base-table__header-select-tag base-table__header-select-tag--count"
|
|
614
|
-
};
|
|
615
|
-
const _hoisted_21 = {
|
|
616
|
-
key: 0,
|
|
617
|
-
class: "base-table__header-select-options"
|
|
618
|
-
};
|
|
619
|
-
const _hoisted_22 = ["onClick"];
|
|
620
|
-
const _hoisted_23 = ["disabled", "onClick"];
|
|
621
|
-
const _hoisted_24 = { class: "base-table__header-select-option-label" };
|
|
622
|
-
const _hoisted_25 = {
|
|
606
|
+
const _hoisted_18 = {
|
|
623
607
|
key: 1,
|
|
624
608
|
class: "base-table__header-cascader"
|
|
625
609
|
};
|
|
626
|
-
const
|
|
627
|
-
const
|
|
610
|
+
const _hoisted_19 = ["onClick"];
|
|
611
|
+
const _hoisted_20 = {
|
|
628
612
|
key: 0,
|
|
629
613
|
class: "base-table__header-cascader-panel"
|
|
630
614
|
};
|
|
631
|
-
const
|
|
632
|
-
const
|
|
633
|
-
const
|
|
615
|
+
const _hoisted_21 = ["disabled", "onClick"];
|
|
616
|
+
const _hoisted_22 = { class: "base-table__header-cascader-label" };
|
|
617
|
+
const _hoisted_23 = {
|
|
634
618
|
key: 0,
|
|
635
619
|
class: "base-table__header-cascader-arrow",
|
|
636
620
|
"aria-hidden": "true"
|
|
637
621
|
};
|
|
638
|
-
const
|
|
639
|
-
const
|
|
640
|
-
const
|
|
622
|
+
const _hoisted_24 = ["value", "placeholder", "onInput", "onKeyup"];
|
|
623
|
+
const _hoisted_25 = { class: "base-table__header-search-footer" };
|
|
624
|
+
const _hoisted_26 = {
|
|
641
625
|
key: 0,
|
|
642
626
|
class: "base-table__actions"
|
|
643
627
|
};
|
|
644
|
-
const
|
|
628
|
+
const _hoisted_27 = {
|
|
645
629
|
key: 2,
|
|
646
630
|
class: "base-table__tags"
|
|
647
631
|
};
|
|
648
|
-
const
|
|
649
|
-
const
|
|
650
|
-
const
|
|
651
|
-
const
|
|
632
|
+
const _hoisted_28 = { key: 1 };
|
|
633
|
+
const _hoisted_29 = ["innerHTML"];
|
|
634
|
+
const _hoisted_30 = ["onClick"];
|
|
635
|
+
const _hoisted_31 = {
|
|
652
636
|
key: 6,
|
|
653
637
|
class: "base-table__text"
|
|
654
638
|
};
|
|
@@ -713,6 +697,8 @@ const _sfc_main$9 = defineComponent({
|
|
|
713
697
|
const headerSearchCascaderActivePaths = reactive({});
|
|
714
698
|
const headerSearchTriggerRects = reactive({});
|
|
715
699
|
const headerSearchTriggerRefs = ref({});
|
|
700
|
+
const headerSearchPanelRefs = ref({});
|
|
701
|
+
const headerSearchPositionTick = ref(0);
|
|
716
702
|
const baseTableIconPrefix = `base-table-icon-${++baseTableIconSeed}`;
|
|
717
703
|
let headerSearchPositionFrame = 0;
|
|
718
704
|
const sortState = reactive({
|
|
@@ -772,6 +758,7 @@ const _sfc_main$9 = defineComponent({
|
|
|
772
758
|
{ deep: true }
|
|
773
759
|
);
|
|
774
760
|
onMounted(() => {
|
|
761
|
+
document.addEventListener("click", handleDocumentClick, true);
|
|
775
762
|
window.addEventListener("scroll", scheduleHeaderSearchPositionUpdate, true);
|
|
776
763
|
window.addEventListener("resize", scheduleHeaderSearchPositionUpdate);
|
|
777
764
|
if (props.request && props.autoLoad) {
|
|
@@ -783,6 +770,7 @@ const _sfc_main$9 = defineComponent({
|
|
|
783
770
|
}
|
|
784
771
|
});
|
|
785
772
|
onBeforeUnmount(() => {
|
|
773
|
+
document.removeEventListener("click", handleDocumentClick, true);
|
|
786
774
|
window.removeEventListener("scroll", scheduleHeaderSearchPositionUpdate, true);
|
|
787
775
|
window.removeEventListener("resize", scheduleHeaderSearchPositionUpdate);
|
|
788
776
|
if (headerSearchPositionFrame) {
|
|
@@ -871,6 +859,9 @@ const _sfc_main$9 = defineComponent({
|
|
|
871
859
|
selectionRows.value = value;
|
|
872
860
|
emit("selection-change", value);
|
|
873
861
|
}
|
|
862
|
+
function resolveRowSelectable(row, index) {
|
|
863
|
+
return props.rowSelectable ? props.rowSelectable(row, index) : true;
|
|
864
|
+
}
|
|
874
865
|
function handleSortChange(payload) {
|
|
875
866
|
const column = props.columns.find((item) => String(item.prop || "") === String(payload.prop || ""));
|
|
876
867
|
sortState.prop = payload.prop;
|
|
@@ -968,6 +959,19 @@ const _sfc_main$9 = defineComponent({
|
|
|
968
959
|
setHeaderSearchTriggerRef(instance, column);
|
|
969
960
|
};
|
|
970
961
|
}
|
|
962
|
+
function setHeaderSearchPanelRef(instance, column) {
|
|
963
|
+
const stateKey = getHeaderSearchStateKey(column);
|
|
964
|
+
if (!(instance instanceof HTMLElement)) {
|
|
965
|
+
delete headerSearchPanelRefs.value[stateKey];
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
headerSearchPanelRefs.value[stateKey] = instance;
|
|
969
|
+
}
|
|
970
|
+
function bindHeaderSearchPanel(column) {
|
|
971
|
+
return (instance) => {
|
|
972
|
+
setHeaderSearchPanelRef(instance, column);
|
|
973
|
+
};
|
|
974
|
+
}
|
|
971
975
|
function isHeaderSearchVisible(column) {
|
|
972
976
|
return Boolean(headerSearchVisible[getHeaderSearchStateKey(column)]);
|
|
973
977
|
}
|
|
@@ -978,6 +982,7 @@ const _sfc_main$9 = defineComponent({
|
|
|
978
982
|
closeAllHeaderSearch();
|
|
979
983
|
updateHeaderSearchTriggerRect(column);
|
|
980
984
|
syncHeaderSearchCascaderActivePath(column);
|
|
985
|
+
scheduleHeaderSearchPositionUpdate();
|
|
981
986
|
}
|
|
982
987
|
headerSearchVisible[stateKey] = nextVisible;
|
|
983
988
|
headerSearchSelectOpen[stateKey] = false;
|
|
@@ -988,6 +993,15 @@ const _sfc_main$9 = defineComponent({
|
|
|
988
993
|
headerSearchSelectOpen[key] = false;
|
|
989
994
|
});
|
|
990
995
|
}
|
|
996
|
+
function handleDocumentClick(event) {
|
|
997
|
+
const target = event.target;
|
|
998
|
+
if (target instanceof Element) {
|
|
999
|
+
if (target.closest(`[data-base-table-id="${baseTableIconPrefix}"].base-table__header-search-panel`) || target.closest(`[data-base-table-id="${baseTableIconPrefix}"].base-table__header-icon`)) {
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
closeAllHeaderSearch();
|
|
1004
|
+
}
|
|
991
1005
|
function updateHeaderSearchTriggerRect(column) {
|
|
992
1006
|
var _a2;
|
|
993
1007
|
const stateKey = getHeaderSearchStateKey(column);
|
|
@@ -1009,28 +1023,67 @@ const _sfc_main$9 = defineComponent({
|
|
|
1009
1023
|
}
|
|
1010
1024
|
headerSearchPositionFrame = window.requestAnimationFrame(() => {
|
|
1011
1025
|
headerSearchPositionFrame = 0;
|
|
1026
|
+
headerSearchPositionTick.value += 1;
|
|
1012
1027
|
updateVisibleHeaderSearchPosition();
|
|
1013
1028
|
});
|
|
1014
1029
|
}
|
|
1015
1030
|
function getHeaderSearchPanelStyle(column) {
|
|
1031
|
+
headerSearchPositionTick.value;
|
|
1016
1032
|
const stateKey = getHeaderSearchStateKey(column);
|
|
1017
1033
|
const triggerRect = headerSearchTriggerRects[stateKey];
|
|
1018
|
-
const
|
|
1034
|
+
const panelWidth = getHeaderSearchPanelWidth(column);
|
|
1035
|
+
const style = {
|
|
1036
|
+
width: panelWidth.width,
|
|
1037
|
+
minWidth: panelWidth.minWidth,
|
|
1038
|
+
maxWidth: panelWidth.maxWidth
|
|
1039
|
+
};
|
|
1019
1040
|
if (!triggerRect) {
|
|
1020
|
-
return
|
|
1021
|
-
width
|
|
1022
|
-
};
|
|
1041
|
+
return style;
|
|
1023
1042
|
}
|
|
1024
|
-
const
|
|
1025
|
-
const
|
|
1026
|
-
const left = Math.min(maxLeft, Math.max(8, triggerRect.right - panelWidth));
|
|
1043
|
+
const maxLeft = Math.max(8, window.innerWidth - panelWidth.positionWidth - 8);
|
|
1044
|
+
const left = Math.min(maxLeft, Math.max(8, triggerRect.right - panelWidth.positionWidth));
|
|
1027
1045
|
const top = triggerRect.bottom + 8;
|
|
1028
1046
|
return {
|
|
1029
|
-
|
|
1047
|
+
...style,
|
|
1030
1048
|
left: `${left}px`,
|
|
1031
1049
|
top: `${top}px`
|
|
1032
1050
|
};
|
|
1033
1051
|
}
|
|
1052
|
+
function getHeaderSearchPanelWidth(column) {
|
|
1053
|
+
const rawWidth = getHeaderSearchWidth(column);
|
|
1054
|
+
const viewportMaxWidth = Math.max(220, window.innerWidth - 16);
|
|
1055
|
+
const renderedWidth = getRenderedHeaderSearchPanelWidth(column);
|
|
1056
|
+
if (rawWidth === "auto") {
|
|
1057
|
+
const positionWidth2 = Math.min(renderedWidth || getHeaderSearchAutoWidth(column), viewportMaxWidth);
|
|
1058
|
+
return {
|
|
1059
|
+
width: "max-content",
|
|
1060
|
+
minWidth: "280px",
|
|
1061
|
+
maxWidth: `${viewportMaxWidth}px`,
|
|
1062
|
+
positionWidth: positionWidth2
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
const width = toCssValue(rawWidth) || "280px";
|
|
1066
|
+
const positionWidth = Math.min(Number.parseFloat(String(rawWidth)) || 280, viewportMaxWidth);
|
|
1067
|
+
return {
|
|
1068
|
+
width,
|
|
1069
|
+
minWidth: width,
|
|
1070
|
+
maxWidth: `${viewportMaxWidth}px`,
|
|
1071
|
+
positionWidth
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
function getRenderedHeaderSearchPanelWidth(column) {
|
|
1075
|
+
const stateKey = getHeaderSearchStateKey(column);
|
|
1076
|
+
const panelElement = headerSearchPanelRefs.value[stateKey];
|
|
1077
|
+
return panelElement ? panelElement.getBoundingClientRect().width : 0;
|
|
1078
|
+
}
|
|
1079
|
+
function getHeaderSearchAutoWidth(column) {
|
|
1080
|
+
var _a2;
|
|
1081
|
+
if (isHeaderSearchRange(column)) {
|
|
1082
|
+
const type = (_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.type;
|
|
1083
|
+
return type === "daterange" || type === "timerange" ? 420 : 560;
|
|
1084
|
+
}
|
|
1085
|
+
return 280;
|
|
1086
|
+
}
|
|
1034
1087
|
function getHeaderSearchValue(column) {
|
|
1035
1088
|
const stateKey = getHeaderSearchStateKey(column);
|
|
1036
1089
|
const value = headerSearchValues[stateKey];
|
|
@@ -1061,6 +1114,24 @@ const _sfc_main$9 = defineComponent({
|
|
|
1061
1114
|
var _a2;
|
|
1062
1115
|
return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.type) === "cascader";
|
|
1063
1116
|
}
|
|
1117
|
+
function isHeaderSearchDatePicker(column) {
|
|
1118
|
+
var _a2;
|
|
1119
|
+
const type = (_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.type;
|
|
1120
|
+
return type === "date" || type === "daterange" || type === "datetime" || type === "datetimerange";
|
|
1121
|
+
}
|
|
1122
|
+
function isHeaderSearchTimePicker(column) {
|
|
1123
|
+
var _a2;
|
|
1124
|
+
const type = (_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.type;
|
|
1125
|
+
return type === "time" || type === "timerange";
|
|
1126
|
+
}
|
|
1127
|
+
function isHeaderSearchPicker(column) {
|
|
1128
|
+
return isHeaderSearchDatePicker(column) || isHeaderSearchTimePicker(column);
|
|
1129
|
+
}
|
|
1130
|
+
function isHeaderSearchRange(column) {
|
|
1131
|
+
var _a2;
|
|
1132
|
+
const type = (_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.type;
|
|
1133
|
+
return type === "daterange" || type === "datetimerange" || type === "timerange";
|
|
1134
|
+
}
|
|
1064
1135
|
function isHeaderSearchChoice(column) {
|
|
1065
1136
|
return isHeaderSearchSelect(column) || isHeaderSearchCascader(column);
|
|
1066
1137
|
}
|
|
@@ -1068,6 +1139,14 @@ const _sfc_main$9 = defineComponent({
|
|
|
1068
1139
|
var _a2;
|
|
1069
1140
|
return isHeaderSearchSelect(column) && ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.multiple) === true;
|
|
1070
1141
|
}
|
|
1142
|
+
function isHeaderSearchClearable(column) {
|
|
1143
|
+
var _a2;
|
|
1144
|
+
return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.clearable) !== false;
|
|
1145
|
+
}
|
|
1146
|
+
function isHeaderSearchFilterable(column) {
|
|
1147
|
+
var _a2;
|
|
1148
|
+
return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.filterable) === true;
|
|
1149
|
+
}
|
|
1071
1150
|
function getHeaderSearchIconName(column) {
|
|
1072
1151
|
const iconName = isHeaderSearchChoice(column) ? "select" : "search";
|
|
1073
1152
|
return hasHeaderSearchValue(column) ? `${iconName}-y` : iconName;
|
|
@@ -1099,9 +1178,53 @@ const _sfc_main$9 = defineComponent({
|
|
|
1099
1178
|
var _a2;
|
|
1100
1179
|
return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.placeholder) || (isHeaderSearchChoice(column) ? "\u8BF7\u9009\u62E9" : "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9");
|
|
1101
1180
|
}
|
|
1181
|
+
function getHeaderSearchStartPlaceholder(column) {
|
|
1182
|
+
var _a2;
|
|
1183
|
+
return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.startPlaceholder) || "\u5F00\u59CB\u65F6\u95F4";
|
|
1184
|
+
}
|
|
1185
|
+
function getHeaderSearchEndPlaceholder(column) {
|
|
1186
|
+
var _a2;
|
|
1187
|
+
return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.endPlaceholder) || "\u7ED3\u675F\u65F6\u95F4";
|
|
1188
|
+
}
|
|
1189
|
+
function getHeaderSearchRangeSeparator(column) {
|
|
1190
|
+
var _a2;
|
|
1191
|
+
return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.rangeSeparator) || "\u81F3";
|
|
1192
|
+
}
|
|
1193
|
+
function getHeaderSearchPickerType(column) {
|
|
1194
|
+
var _a2;
|
|
1195
|
+
const type = (_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.type;
|
|
1196
|
+
if (type === "datetime" || type === "datetimerange") {
|
|
1197
|
+
return type;
|
|
1198
|
+
}
|
|
1199
|
+
return type === "daterange" ? "daterange" : "date";
|
|
1200
|
+
}
|
|
1201
|
+
function getHeaderSearchDateFormat(column) {
|
|
1202
|
+
var _a2, _b2;
|
|
1203
|
+
const config = getHeaderSearchConfig(column);
|
|
1204
|
+
if (config == null ? void 0 : config.format) {
|
|
1205
|
+
return config.format;
|
|
1206
|
+
}
|
|
1207
|
+
return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.type) === "datetime" || ((_b2 = getHeaderSearchConfig(column)) == null ? void 0 : _b2.type) === "datetimerange" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
1208
|
+
}
|
|
1209
|
+
function getHeaderSearchDateValueFormat(column) {
|
|
1210
|
+
var _a2;
|
|
1211
|
+
return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.valueFormat) || getHeaderSearchDateFormat(column);
|
|
1212
|
+
}
|
|
1213
|
+
function getHeaderSearchTimeFormat(column) {
|
|
1214
|
+
var _a2;
|
|
1215
|
+
return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.format) || "HH:mm:ss";
|
|
1216
|
+
}
|
|
1217
|
+
function getHeaderSearchTimeValueFormat(column) {
|
|
1218
|
+
var _a2;
|
|
1219
|
+
return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.valueFormat) || getHeaderSearchTimeFormat(column);
|
|
1220
|
+
}
|
|
1102
1221
|
function getHeaderSearchWidth(column) {
|
|
1103
1222
|
var _a2;
|
|
1104
|
-
|
|
1223
|
+
const configuredWidth = (_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.width;
|
|
1224
|
+
if (configuredWidth !== void 0 && configuredWidth !== null && configuredWidth !== "") {
|
|
1225
|
+
return configuredWidth;
|
|
1226
|
+
}
|
|
1227
|
+
return isHeaderSearchRange(column) ? "auto" : 280;
|
|
1105
1228
|
}
|
|
1106
1229
|
function getHeaderSearchSearchText(column) {
|
|
1107
1230
|
var _a2;
|
|
@@ -1140,45 +1263,27 @@ const _sfc_main$9 = defineComponent({
|
|
|
1140
1263
|
function hasHeaderSearchOptionChildren(option, column) {
|
|
1141
1264
|
return getHeaderSearchOptionChildren(option, column).length > 0;
|
|
1142
1265
|
}
|
|
1143
|
-
function
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1266
|
+
function getHeaderSearchSelectModelValue(column) {
|
|
1267
|
+
var _a2;
|
|
1268
|
+
const value = getHeaderSearchValue(column);
|
|
1269
|
+
if (isHeaderSearchMultiple(column)) {
|
|
1270
|
+
return Array.isArray(value) ? value : [];
|
|
1147
1271
|
}
|
|
1148
|
-
return
|
|
1149
|
-
}
|
|
1150
|
-
function getHeaderSearchSelectedLabels(column) {
|
|
1151
|
-
const selectedValues = toComparableValues(getHeaderSearchValue(column));
|
|
1152
|
-
return selectedValues.map((selectedValue) => {
|
|
1153
|
-
const matchedOption = getHeaderSearchOptions(column).find((option) => {
|
|
1154
|
-
return String(getHeaderSearchOptionValue(option, column)) === selectedValue;
|
|
1155
|
-
});
|
|
1156
|
-
return matchedOption ? getHeaderSearchOptionLabel(matchedOption, column) : selectedValue;
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
|
-
function isHeaderSearchOptionSelected(option, column) {
|
|
1160
|
-
const optionValue = String(getHeaderSearchOptionValue(option, column));
|
|
1161
|
-
return toComparableValues(getHeaderSearchValue(column)).includes(optionValue);
|
|
1272
|
+
return Array.isArray(value) ? (_a2 = value[0]) != null ? _a2 : "" : value;
|
|
1162
1273
|
}
|
|
1163
1274
|
function handleHeaderSearchSelectEmpty(column) {
|
|
1164
1275
|
updateHeaderSearchValue(column, getHeaderSearchEmptyValue(column));
|
|
1165
1276
|
headerSearchSelectOpen[getHeaderSearchStateKey(column)] = false;
|
|
1166
1277
|
}
|
|
1167
|
-
function
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
if (matchedIndex >= 0) {
|
|
1177
|
-
currentValues.splice(matchedIndex, 1);
|
|
1178
|
-
} else {
|
|
1179
|
-
currentValues.push(optionValue);
|
|
1180
|
-
}
|
|
1181
|
-
updateHeaderSearchValue(column, currentValues);
|
|
1278
|
+
function handleHeaderSearchSelectModelValue(column, value) {
|
|
1279
|
+
updateHeaderSearchValue(column, value);
|
|
1280
|
+
}
|
|
1281
|
+
function getHeaderSearchPickerValue(column) {
|
|
1282
|
+
const value = getHeaderSearchValue(column);
|
|
1283
|
+
return Array.isArray(value) ? [...value] : value;
|
|
1284
|
+
}
|
|
1285
|
+
function handleHeaderSearchPickerValue(column, value) {
|
|
1286
|
+
updateHeaderSearchValue(column, value);
|
|
1182
1287
|
}
|
|
1183
1288
|
function getHeaderSearchCascaderValue(column) {
|
|
1184
1289
|
return normalizeHeaderSearchPathValue(getHeaderSearchValue(column));
|
|
@@ -1328,17 +1433,29 @@ const _sfc_main$9 = defineComponent({
|
|
|
1328
1433
|
if (isHeaderSearchCascader(column)) {
|
|
1329
1434
|
return matchesHeaderSearchCascaderValue(value, searchValue);
|
|
1330
1435
|
}
|
|
1436
|
+
if (isHeaderSearchPicker(column)) {
|
|
1437
|
+
return matchesHeaderSearchPickerValue(value, searchValue, column);
|
|
1438
|
+
}
|
|
1331
1439
|
return toSearchableText(value).includes(toHeaderSearchKeyword(searchValue));
|
|
1332
1440
|
});
|
|
1333
1441
|
});
|
|
1334
1442
|
}
|
|
1335
1443
|
function getHeaderSearchEmptyValue(column) {
|
|
1336
|
-
return isHeaderSearchMultiple(column) || isHeaderSearchCascader(column) ? [] : "";
|
|
1444
|
+
return isHeaderSearchMultiple(column) || isHeaderSearchCascader(column) || isHeaderSearchRange(column) ? [] : "";
|
|
1337
1445
|
}
|
|
1338
1446
|
function normalizeHeaderSearchValue(column, value) {
|
|
1339
1447
|
if (isHeaderSearchCascader(column)) {
|
|
1340
1448
|
return normalizeHeaderSearchPathValue(value);
|
|
1341
1449
|
}
|
|
1450
|
+
if (isHeaderSearchPicker(column)) {
|
|
1451
|
+
if (isHeaderSearchRange(column)) {
|
|
1452
|
+
return normalizeHeaderSearchPathValue(value);
|
|
1453
|
+
}
|
|
1454
|
+
if (value === void 0 || value === null) {
|
|
1455
|
+
return "";
|
|
1456
|
+
}
|
|
1457
|
+
return normalizeHeaderSearchPrimitiveValue(value);
|
|
1458
|
+
}
|
|
1342
1459
|
if (!isHeaderSearchSelect(column)) {
|
|
1343
1460
|
if (value === void 0 || value === null) {
|
|
1344
1461
|
return "";
|
|
@@ -1408,6 +1525,38 @@ const _sfc_main$9 = defineComponent({
|
|
|
1408
1525
|
}
|
|
1409
1526
|
return selectedPath.every((item, index) => String(rowPath[index]) === String(item));
|
|
1410
1527
|
}
|
|
1528
|
+
function matchesHeaderSearchPickerValue(rowValue, searchValue, column) {
|
|
1529
|
+
if (isHeaderSearchRange(column)) {
|
|
1530
|
+
const selectedRange = normalizeHeaderSearchPathValue(searchValue);
|
|
1531
|
+
if (!selectedRange.length) {
|
|
1532
|
+
return true;
|
|
1533
|
+
}
|
|
1534
|
+
const rowTime = toComparableTime(rowValue);
|
|
1535
|
+
const startTime = toComparableTime(selectedRange[0]);
|
|
1536
|
+
const endTime = toComparableTime(selectedRange[1]);
|
|
1537
|
+
if (rowTime === null) {
|
|
1538
|
+
return false;
|
|
1539
|
+
}
|
|
1540
|
+
return (startTime === null || rowTime >= startTime) && (endTime === null || rowTime <= endTime);
|
|
1541
|
+
}
|
|
1542
|
+
return String(rowValue || "") === String(searchValue || "");
|
|
1543
|
+
}
|
|
1544
|
+
function toComparableTime(value) {
|
|
1545
|
+
if (value === void 0 || value === null || value === "") {
|
|
1546
|
+
return null;
|
|
1547
|
+
}
|
|
1548
|
+
if (value instanceof Date) {
|
|
1549
|
+
return value.getTime();
|
|
1550
|
+
}
|
|
1551
|
+
const normalizedValue = String(value).trim();
|
|
1552
|
+
const parsedValue = Date.parse(normalizedValue);
|
|
1553
|
+
if (!Number.isNaN(parsedValue)) {
|
|
1554
|
+
return parsedValue;
|
|
1555
|
+
}
|
|
1556
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
1557
|
+
const parsedTime = Date.parse(`${today} ${normalizedValue}`);
|
|
1558
|
+
return Number.isNaN(parsedTime) ? null : parsedTime;
|
|
1559
|
+
}
|
|
1411
1560
|
function toComparableValues(value) {
|
|
1412
1561
|
const values = Array.isArray(value) ? value : [value];
|
|
1413
1562
|
return values.filter((item) => isHeaderSearchValueFilled(item)).map((item) => String(item));
|
|
@@ -1704,6 +1853,10 @@ const _sfc_main$9 = defineComponent({
|
|
|
1704
1853
|
const _component_el_config_provider = resolveComponent("el-config-provider");
|
|
1705
1854
|
const _component_el_empty = resolveComponent("el-empty");
|
|
1706
1855
|
const _component_el_table_column = resolveComponent("el-table-column");
|
|
1856
|
+
const _component_el_option = resolveComponent("el-option");
|
|
1857
|
+
const _component_el_select = resolveComponent("el-select");
|
|
1858
|
+
const _component_el_date_picker = resolveComponent("el-date-picker");
|
|
1859
|
+
const _component_el_time_picker = resolveComponent("el-time-picker");
|
|
1707
1860
|
const _component_el_button = resolveComponent("el-button");
|
|
1708
1861
|
const _component_el_image = resolveComponent("el-image");
|
|
1709
1862
|
const _component_el_tag = resolveComponent("el-tag");
|
|
@@ -1837,6 +1990,8 @@ const _sfc_main$9 = defineComponent({
|
|
|
1837
1990
|
stripe: __props.stripe,
|
|
1838
1991
|
"default-sort": normalizedDefaultSort.value,
|
|
1839
1992
|
"highlight-current-row": "",
|
|
1993
|
+
onSelect: handleSelectionChange,
|
|
1994
|
+
onSelectAll: handleSelectionChange,
|
|
1840
1995
|
onSelectionChange: handleSelectionChange,
|
|
1841
1996
|
onSortChange: handleSortChange
|
|
1842
1997
|
}, {
|
|
@@ -1848,9 +2003,10 @@ const _sfc_main$9 = defineComponent({
|
|
|
1848
2003
|
key: 0,
|
|
1849
2004
|
type: "selection",
|
|
1850
2005
|
width: __props.selectionWidth,
|
|
2006
|
+
fixed: "left",
|
|
1851
2007
|
align: "center",
|
|
1852
|
-
selectable:
|
|
1853
|
-
}, null, 8, ["width"
|
|
2008
|
+
selectable: resolveRowSelectable
|
|
2009
|
+
}, null, 8, ["width"])) : createCommentVNode("", true),
|
|
1854
2010
|
__props.hasIndex ? (openBlock(), createBlock(_component_el_table_column, {
|
|
1855
2011
|
key: 1,
|
|
1856
2012
|
type: "index",
|
|
@@ -1883,7 +2039,7 @@ const _sfc_main$9 = defineComponent({
|
|
|
1883
2039
|
columnIndex: scope.$index,
|
|
1884
2040
|
value: getCellValue2(scope.row, column)
|
|
1885
2041
|
}, void 0, true) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1886
|
-
isActionColumn(column) ? (openBlock(), createElementBlock("div",
|
|
2042
|
+
isActionColumn(column) ? (openBlock(), createElementBlock("div", _hoisted_26, [
|
|
1887
2043
|
(openBlock(true), createElementBlock(Fragment, null, renderList(getVisibleActions(column, scope.row), (action) => {
|
|
1888
2044
|
return openBlock(), createBlock(_component_el_button, {
|
|
1889
2045
|
key: `${action.type}-${action.label}`,
|
|
@@ -1905,7 +2061,7 @@ const _sfc_main$9 = defineComponent({
|
|
|
1905
2061
|
src: toImageSrc(getCellValue2(scope.row, column)),
|
|
1906
2062
|
"preview-src-list": getPreviewSrcList(scope.row, column),
|
|
1907
2063
|
fit: column.imageFit || "cover"
|
|
1908
|
-
}, null, 8, ["style", "src", "preview-src-list", "fit"])) : column.kind === "tag" ? (openBlock(), createElementBlock("div",
|
|
2064
|
+
}, null, 8, ["style", "src", "preview-src-list", "fit"])) : column.kind === "tag" ? (openBlock(), createElementBlock("div", _hoisted_27, [
|
|
1909
2065
|
getMatchedOptions(scope.row, column).length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(getMatchedOptions(scope.row, column), (option) => {
|
|
1910
2066
|
return openBlock(), createBlock(_component_el_tag, {
|
|
1911
2067
|
key: String(option.value),
|
|
@@ -1918,11 +2074,11 @@ const _sfc_main$9 = defineComponent({
|
|
|
1918
2074
|
]),
|
|
1919
2075
|
_: 2
|
|
1920
2076
|
}, 1032, ["type", "style"]);
|
|
1921
|
-
}), 128)) : (openBlock(), createElementBlock("span",
|
|
2077
|
+
}), 128)) : (openBlock(), createElementBlock("span", _hoisted_28, toDisplayString(resolveEmptyText(column)), 1))
|
|
1922
2078
|
])) : column.kind === "html" ? (openBlock(), createElementBlock("div", {
|
|
1923
2079
|
key: 3,
|
|
1924
2080
|
innerHTML: getHtmlContent(scope.row, column)
|
|
1925
|
-
}, null, 8,
|
|
2081
|
+
}, null, 8, _hoisted_29)) : column.kind === "input" ? (openBlock(), createBlock(_component_el_input, {
|
|
1926
2082
|
key: 4,
|
|
1927
2083
|
"model-value": toDisplayValue(getCellValue2(scope.row, column), ""),
|
|
1928
2084
|
type: column.inputType || "text",
|
|
@@ -1932,7 +2088,7 @@ const _sfc_main$9 = defineComponent({
|
|
|
1932
2088
|
class: "base-table__link",
|
|
1933
2089
|
type: "button",
|
|
1934
2090
|
onClick: ($event) => handleCellClick(scope.row, column)
|
|
1935
|
-
}, toDisplayString(formatCellDisplay(scope.row, column)), 9,
|
|
2091
|
+
}, toDisplayString(formatCellDisplay(scope.row, column)), 9, _hoisted_30)) : (openBlock(), createElementBlock("div", _hoisted_31, toDisplayString(formatCellDisplay(scope.row, column)), 1))
|
|
1936
2092
|
], 64))
|
|
1937
2093
|
]),
|
|
1938
2094
|
_: 2
|
|
@@ -1974,6 +2130,7 @@ const _sfc_main$9 = defineComponent({
|
|
|
1974
2130
|
ref_for: true,
|
|
1975
2131
|
ref: bindHeaderSearchTrigger(column),
|
|
1976
2132
|
class: normalizeClass(["base-table__header-icon", { "is-active": hasHeaderSearchValue(column) }]),
|
|
2133
|
+
"data-base-table-id": baseTableIconPrefix,
|
|
1977
2134
|
type: "button",
|
|
1978
2135
|
onClick: withModifiers(($event) => toggleHeaderSearch(column), ["stop"])
|
|
1979
2136
|
}, [
|
|
@@ -1985,8 +2142,11 @@ const _sfc_main$9 = defineComponent({
|
|
|
1985
2142
|
], 10, _hoisted_16),
|
|
1986
2143
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
1987
2144
|
isHeaderSearchVisible(column) ? (openBlock(), createElementBlock("div", {
|
|
2145
|
+
ref_for: true,
|
|
2146
|
+
ref: bindHeaderSearchPanel(column),
|
|
1988
2147
|
key: getHeaderSearchStateKey(column),
|
|
1989
2148
|
class: "base-table__header-search-panel",
|
|
2149
|
+
"data-base-table-id": baseTableIconPrefix,
|
|
1990
2150
|
style: normalizeStyle(getHeaderSearchPanelStyle(column)),
|
|
1991
2151
|
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
1992
2152
|
}, ["stop"])),
|
|
@@ -1994,48 +2154,32 @@ const _sfc_main$9 = defineComponent({
|
|
|
1994
2154
|
}, ["stop"]))
|
|
1995
2155
|
}, [
|
|
1996
2156
|
isHeaderSearchSelect(column) ? (openBlock(), createElementBlock("div", _hoisted_17, [
|
|
1997
|
-
|
|
1998
|
-
class: "base-table__header-select
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
type: "button",
|
|
2024
|
-
onClick: ($event) => handleHeaderSearchSelectEmpty(column)
|
|
2025
|
-
}, toDisplayString(getHeaderSearchPlaceholder(column)), 11, _hoisted_22)) : createCommentVNode("", true),
|
|
2026
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(getHeaderSearchOptions(column), (option) => {
|
|
2027
|
-
return openBlock(), createElementBlock("button", {
|
|
2028
|
-
key: String(getHeaderSearchOptionValue(option, column)),
|
|
2029
|
-
class: normalizeClass(["base-table__header-select-option", { "is-selected": isHeaderSearchOptionSelected(option, column) }]),
|
|
2030
|
-
type: "button",
|
|
2031
|
-
disabled: isHeaderSearchOptionDisabled(option, column),
|
|
2032
|
-
onClick: ($event) => handleHeaderSearchSelectValue(column, getHeaderSearchOptionValue(option, column))
|
|
2033
|
-
}, [
|
|
2034
|
-
createElementVNode("span", _hoisted_24, toDisplayString(getHeaderSearchOptionLabel(option, column)), 1)
|
|
2035
|
-
], 10, _hoisted_23);
|
|
2036
|
-
}), 128))
|
|
2037
|
-
])) : createCommentVNode("", true)
|
|
2038
|
-
])) : isHeaderSearchCascader(column) ? (openBlock(), createElementBlock("div", _hoisted_25, [
|
|
2157
|
+
createVNode(_component_el_select, {
|
|
2158
|
+
class: "base-table__header-el-select",
|
|
2159
|
+
"model-value": getHeaderSearchSelectModelValue(column),
|
|
2160
|
+
placeholder: getHeaderSearchPlaceholder(column),
|
|
2161
|
+
multiple: isHeaderSearchMultiple(column),
|
|
2162
|
+
filterable: isHeaderSearchFilterable(column),
|
|
2163
|
+
clearable: isHeaderSearchClearable(column),
|
|
2164
|
+
"collapse-tags": isHeaderSearchMultiple(column),
|
|
2165
|
+
"collapse-tags-tooltip": isHeaderSearchMultiple(column),
|
|
2166
|
+
teleported: false,
|
|
2167
|
+
"onUpdate:modelValue": ($event) => handleHeaderSearchSelectModelValue(column, $event),
|
|
2168
|
+
onClear: ($event) => handleHeaderSearchSelectEmpty(column)
|
|
2169
|
+
}, {
|
|
2170
|
+
default: withCtx(() => [
|
|
2171
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(getHeaderSearchOptions(column), (option) => {
|
|
2172
|
+
return openBlock(), createBlock(_component_el_option, {
|
|
2173
|
+
key: String(getHeaderSearchOptionValue(option, column)),
|
|
2174
|
+
label: getHeaderSearchOptionLabel(option, column),
|
|
2175
|
+
value: getHeaderSearchOptionValue(option, column),
|
|
2176
|
+
disabled: isHeaderSearchOptionDisabled(option, column)
|
|
2177
|
+
}, null, 8, ["label", "value", "disabled"]);
|
|
2178
|
+
}), 128))
|
|
2179
|
+
]),
|
|
2180
|
+
_: 2
|
|
2181
|
+
}, 1032, ["model-value", "placeholder", "multiple", "filterable", "clearable", "collapse-tags", "collapse-tags-tooltip", "onUpdate:modelValue", "onClear"])
|
|
2182
|
+
])) : isHeaderSearchCascader(column) ? (openBlock(), createElementBlock("div", _hoisted_18, [
|
|
2039
2183
|
createElementVNode("button", {
|
|
2040
2184
|
class: "base-table__header-select-trigger",
|
|
2041
2185
|
type: "button",
|
|
@@ -2048,8 +2192,8 @@ const _sfc_main$9 = defineComponent({
|
|
|
2048
2192
|
class: normalizeClass(["base-table__header-select-arrow", { "is-open": isHeaderSearchSelectOpen(column) }]),
|
|
2049
2193
|
"aria-hidden": "true"
|
|
2050
2194
|
}, null, 2)
|
|
2051
|
-
], 8,
|
|
2052
|
-
isHeaderSearchSelectOpen(column) ? (openBlock(), createElementBlock("div",
|
|
2195
|
+
], 8, _hoisted_19),
|
|
2196
|
+
isHeaderSearchSelectOpen(column) ? (openBlock(), createElementBlock("div", _hoisted_20, [
|
|
2053
2197
|
(openBlock(true), createElementBlock(Fragment, null, renderList(getHeaderSearchCascaderColumns(column), (levelOptions, levelIndex) => {
|
|
2054
2198
|
return openBlock(), createElementBlock("div", {
|
|
2055
2199
|
key: levelIndex,
|
|
@@ -2066,23 +2210,51 @@ const _sfc_main$9 = defineComponent({
|
|
|
2066
2210
|
disabled: isHeaderSearchOptionDisabled(option, column),
|
|
2067
2211
|
onClick: ($event) => handleHeaderSearchCascaderOption(column, option, levelIndex)
|
|
2068
2212
|
}, [
|
|
2069
|
-
createElementVNode("span",
|
|
2070
|
-
hasHeaderSearchOptionChildren(option, column) ? (openBlock(), createElementBlock("span",
|
|
2071
|
-
], 10,
|
|
2213
|
+
createElementVNode("span", _hoisted_22, toDisplayString(getHeaderSearchOptionLabel(option, column)), 1),
|
|
2214
|
+
hasHeaderSearchOptionChildren(option, column) ? (openBlock(), createElementBlock("span", _hoisted_23)) : createCommentVNode("", true)
|
|
2215
|
+
], 10, _hoisted_21);
|
|
2072
2216
|
}), 128))
|
|
2073
2217
|
]);
|
|
2074
2218
|
}), 128))
|
|
2075
2219
|
])) : createCommentVNode("", true)
|
|
2076
|
-
])) : (openBlock(),
|
|
2220
|
+
])) : isHeaderSearchDatePicker(column) ? (openBlock(), createBlock(_component_el_date_picker, {
|
|
2077
2221
|
key: 2,
|
|
2222
|
+
class: "base-table__header-picker",
|
|
2223
|
+
"model-value": getHeaderSearchPickerValue(column),
|
|
2224
|
+
type: getHeaderSearchPickerType(column),
|
|
2225
|
+
placeholder: getHeaderSearchPlaceholder(column),
|
|
2226
|
+
"start-placeholder": getHeaderSearchStartPlaceholder(column),
|
|
2227
|
+
"end-placeholder": getHeaderSearchEndPlaceholder(column),
|
|
2228
|
+
"range-separator": getHeaderSearchRangeSeparator(column),
|
|
2229
|
+
format: getHeaderSearchDateFormat(column),
|
|
2230
|
+
"value-format": getHeaderSearchDateValueFormat(column),
|
|
2231
|
+
clearable: isHeaderSearchClearable(column),
|
|
2232
|
+
teleported: false,
|
|
2233
|
+
"onUpdate:modelValue": ($event) => handleHeaderSearchPickerValue(column, $event)
|
|
2234
|
+
}, null, 8, ["model-value", "type", "placeholder", "start-placeholder", "end-placeholder", "range-separator", "format", "value-format", "clearable", "onUpdate:modelValue"])) : isHeaderSearchTimePicker(column) ? (openBlock(), createBlock(_component_el_time_picker, {
|
|
2235
|
+
key: 3,
|
|
2236
|
+
class: "base-table__header-picker",
|
|
2237
|
+
"model-value": getHeaderSearchPickerValue(column),
|
|
2238
|
+
"is-range": isHeaderSearchRange(column),
|
|
2239
|
+
placeholder: getHeaderSearchPlaceholder(column),
|
|
2240
|
+
"start-placeholder": getHeaderSearchStartPlaceholder(column),
|
|
2241
|
+
"end-placeholder": getHeaderSearchEndPlaceholder(column),
|
|
2242
|
+
"range-separator": getHeaderSearchRangeSeparator(column),
|
|
2243
|
+
format: getHeaderSearchTimeFormat(column),
|
|
2244
|
+
"value-format": getHeaderSearchTimeValueFormat(column),
|
|
2245
|
+
clearable: isHeaderSearchClearable(column),
|
|
2246
|
+
teleported: false,
|
|
2247
|
+
"onUpdate:modelValue": ($event) => handleHeaderSearchPickerValue(column, $event)
|
|
2248
|
+
}, null, 8, ["model-value", "is-range", "placeholder", "start-placeholder", "end-placeholder", "range-separator", "format", "value-format", "clearable", "onUpdate:modelValue"])) : (openBlock(), createElementBlock("input", {
|
|
2249
|
+
key: 4,
|
|
2078
2250
|
class: "base-table__header-search-input",
|
|
2079
2251
|
type: "text",
|
|
2080
2252
|
value: getHeaderSearchInputValue(column),
|
|
2081
2253
|
placeholder: getHeaderSearchPlaceholder(column),
|
|
2082
2254
|
onInput: ($event) => handleHeaderSearchInput(column, $event),
|
|
2083
2255
|
onKeyup: withKeys(($event) => handleHeaderSearch(column), ["enter"])
|
|
2084
|
-
}, null, 40,
|
|
2085
|
-
createElementVNode("div",
|
|
2256
|
+
}, null, 40, _hoisted_24)),
|
|
2257
|
+
createElementVNode("div", _hoisted_25, [
|
|
2086
2258
|
createVNode(_component_el_button, {
|
|
2087
2259
|
link: "",
|
|
2088
2260
|
type: "primary",
|
|
@@ -2121,7 +2293,7 @@ const _sfc_main$9 = defineComponent({
|
|
|
2121
2293
|
};
|
|
2122
2294
|
}
|
|
2123
2295
|
});
|
|
2124
|
-
var BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-
|
|
2296
|
+
var BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-13040b10"]]);
|
|
2125
2297
|
var BaseEChart_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
2126
2298
|
const _sfc_main$8 = defineComponent({
|
|
2127
2299
|
__name: "BaseEChart",
|