fangguo-component 1.1.2 → 1.1.4
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/ArgHover.css +20 -1
- package/dist/ArgHover.vue_vue_type_style_index_0_lang-CSymSDRl.js +56 -0
- package/dist/ButtonGroup-DqViorHX.js +134 -0
- package/dist/ButtonGroup.css +35 -1
- package/dist/CitySelect.vue_vue_type_script_setup_true_lang-DZp6834K.js +224 -0
- package/dist/ContentTitle-By0Zk1u7.js +30 -0
- package/dist/ContentTitle.css +6 -1
- package/dist/CustomInputV2-BqhBSO53.js +157 -0
- package/dist/CustomInputV2.css +5 -1
- package/dist/CustomMultipleInput-DRMTUtkE.js +125 -0
- package/dist/CustomMultipleInput.css +8 -1
- package/dist/DragResizable.css +126 -1
- package/dist/DragResizable.vue_vue_type_style_index_0_lang-BePpQHve.js +331 -0
- package/dist/DragSort-5WetnkmW.js +98 -0
- package/dist/DragSort.css +5 -1
- package/dist/ErrorImage-Ao9kEEUg.js +36 -0
- package/dist/ErrorImage.css +4 -1
- package/dist/FgCascader.css +37 -1
- package/dist/FgCascader.vue_vue_type_style_index_0_lang-CM8FxFLJ.js +2424 -0
- package/dist/HSelect-BFkWiCFi.js +671 -0
- package/dist/HSelect.css +80 -1
- package/dist/HSelectAll.vue_vue_type_script_setup_true_lang-BZX7ch2I.js +50 -0
- package/dist/HSelectSJ-DZmtdyjF.js +671 -0
- package/dist/HSelectSJ.css +88 -1
- package/dist/IdentifyAddress.vue_vue_type_script_setup_true_lang-BCIOF-Oy.js +5202 -0
- package/dist/ImageLoupe.vue_vue_type_script_setup_true_lang-BaXHYlDu.js +92 -0
- package/dist/LazyComponent.vue_vue_type_script_setup_true_lang-D5KGqlj4.js +107 -0
- package/dist/LazyPopover.vue_vue_type_script_setup_true_lang-B2vtU4f4.js +34 -0
- package/dist/LoadingBtn-DWm2cY9k.js +87 -0
- package/dist/LoadingBtn.css +12 -1
- package/dist/MInput-s_P63myh.js +114 -0
- package/dist/MInput.css +21 -1
- package/dist/MyTable-CHvxPYgk.js +94 -0
- package/dist/MyTable.css +33 -1
- package/dist/NoRender.vue_vue_type_script_setup_true_lang-B0G6jxPg.js +31 -0
- package/dist/SelectAddress-CCepDxu8.js +254 -0
- package/dist/SelectAddress.css +18 -1
- package/dist/SelectAll.vue_vue_type_script_setup_true_lang-CyzY8ams.js +101 -0
- package/dist/SelectAll2.vue_vue_type_script_setup_true_lang-CrsaohxU.js +103 -0
- package/dist/SelectCustomAll.css +8 -1
- package/dist/SelectCustomAll.vue_vue_type_style_index_0_lang-BEZwlGXa.js +111 -0
- package/dist/SelectTimePicker.vue_vue_type_script_setup_true_lang-Dk4TpTBN.js +48 -0
- package/dist/SelectTree-DHbWogEU.js +1276 -0
- package/dist/SelectTree.css +74 -1
- package/dist/SvgIcon-DIg0upEk.js +33 -0
- package/dist/TextCopy-th0FAxwl.js +44 -0
- package/dist/TextCopy.css +7 -1
- package/dist/TextEllipsisTooltip.vue_vue_type_script_setup_true_lang-DVE1CxPm.js +174 -0
- package/dist/VirtualTable-Cm_L7q9W.js +703 -0
- package/dist/VirtualTable.css +185 -1
- package/dist/_commonjsHelpers-DnzVkjQg.js +38 -0
- package/dist/_plugin-vue_export-helper-1tPrXgE0.js +10 -0
- package/dist/common-B1nSpTGn.js +9669 -0
- package/dist/components/VirtualTable/index.js +2 -2
- package/dist/components/argHover/index.js +2 -2
- package/dist/components/buttonGroup/index.js +2 -2
- package/dist/components/cascader/index.js +2 -2
- package/dist/components/citySelect/index.js +2 -2
- package/dist/components/contentTitle/index.js +2 -2
- package/dist/components/customInputV2/index.js +2 -2
- package/dist/components/customMultipleInput/index.js +2 -2
- package/dist/components/dragResizable/index.js +2 -2
- package/dist/components/dragSort/index.js +2 -2
- package/dist/components/errorImage/index.js +2 -2
- package/dist/components/hSelect/index.js +2 -2
- package/dist/components/hSelectAll/index.js +2 -2
- package/dist/components/hSelectSJ/index.js +2 -2
- package/dist/components/identifyAddress/index.js +2 -2
- package/dist/components/imageLoupe/index.js +2 -2
- package/dist/components/index.js +62 -62
- package/dist/components/lazyComponent/index.js +2 -2
- package/dist/components/lazyPopover/index.js +2 -2
- package/dist/components/loadingBtn/index.js +2 -2
- package/dist/components/mInput/index.js +2 -2
- package/dist/components/myTable/index.js +2 -2
- package/dist/components/noRender/index.js +2 -2
- package/dist/components/selectAddress/index.js +2 -2
- package/dist/components/selectAll/index.js +2 -2
- package/dist/components/selectAll2/index.js +2 -2
- package/dist/components/selectCustomAll/index.js +2 -2
- package/dist/components/selectTimePicker/index.js +2 -2
- package/dist/components/selectTree/index.js +2 -2
- package/dist/components/svgIcon/index.js +2 -2
- package/dist/components/textCopy/index.js +2 -2
- package/dist/components/textEllipsisTooltip/index.js +2 -2
- package/dist/dateShortcuts-DjFC_Txu.js +27 -0
- package/dist/directive/index.js +2 -2
- package/dist/directive/loading/index.js +2 -2
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/usePagination/index.js +2 -2
- package/dist/index-BPnixsfc.js +103 -0
- package/dist/index-C9zyi90j.js +165 -0
- package/dist/index-CSMWzzp0.js +8 -0
- package/dist/index-DfQiknXJ.js +8 -0
- package/dist/index-DzdLpetc.js +29184 -0
- package/dist/index-uQXqC9BF.js +68 -0
- package/dist/index.css +1 -1
- package/dist/index.js +204 -194
- package/dist/loading-CGrVcnNl.js +47 -0
- package/dist/loading.css +110 -1
- package/dist/tools/ImageParserUtils/index.js +17239 -9074
- package/dist/tools/common/index.js +86 -86
- package/dist/tools/index.js +95 -95
- package/dist/usePagination-C63IRXjZ.js +29 -0
- package/dist/vue-virtual-scroller.esm-ZgBoGAjX.js +1507 -0
- package/package.json +1 -1
- package/dist/ArgHover.vue_vue_type_style_index_0_lang-CMhRP09M.js +0 -54
- package/dist/ButtonGroup-C0yZEkxK.js +0 -103
- package/dist/CitySelect.vue_vue_type_script_setup_true_lang-8EbHD3Nt.js +0 -159
- package/dist/ContentTitle-mqrusLjx.js +0 -24
- package/dist/CustomInputV2-uARhbFc8.js +0 -135
- package/dist/CustomMultipleInput-DDaqoHVU.js +0 -109
- package/dist/DragResizable.vue_vue_type_style_index_0_lang-CHv0gJmo.js +0 -179
- package/dist/DragSort-CfDeFAIG.js +0 -66
- package/dist/ErrorImage-CTP_5sal.js +0 -32
- package/dist/FgCascader.vue_vue_type_style_index_0_lang-BUZDDcVn.js +0 -1656
- package/dist/HSelect-Drf6YBwO.js +0 -468
- package/dist/HSelectAll.vue_vue_type_script_setup_true_lang-Blq9xpfa.js +0 -36
- package/dist/HSelectSJ-D3GrXmvj.js +0 -462
- package/dist/IdentifyAddress.vue_vue_type_script_setup_true_lang-BJheMI1q.js +0 -4743
- package/dist/ImageLoupe.vue_vue_type_script_setup_true_lang-BlX4VbRi.js +0 -79
- package/dist/LazyComponent.vue_vue_type_script_setup_true_lang-vNk68D8E.js +0 -82
- package/dist/LazyPopover.vue_vue_type_script_setup_true_lang-DcOrcH0T.js +0 -33
- package/dist/LoadingBtn-BhbhNboo.js +0 -66
- package/dist/MInput-CpoW17Wh.js +0 -101
- package/dist/MyTable-DmwyEVJb.js +0 -68
- package/dist/NoRender.vue_vue_type_script_setup_true_lang-Do36nSsV.js +0 -30
- package/dist/SelectAddress-B4oK5erq.js +0 -173
- package/dist/SelectAll.vue_vue_type_script_setup_true_lang-BC3q2U8f.js +0 -79
- package/dist/SelectAll2.vue_vue_type_script_setup_true_lang-CaET5eli.js +0 -74
- package/dist/SelectCustomAll.vue_vue_type_style_index_0_lang-_wCRO217.js +0 -83
- package/dist/SelectTimePicker.vue_vue_type_script_setup_true_lang-Bj0KMOKv.js +0 -45
- package/dist/SelectTree-Dm5259kY.js +0 -911
- package/dist/SvgIcon-C2ah8E0Z.js +0 -30
- package/dist/TextCopy-hOj-Wj2H.js +0 -41
- package/dist/TextEllipsisTooltip.vue_vue_type_script_setup_true_lang-aZbEQmbM.js +0 -112
- package/dist/VirtualTable-BWugJiQ5.js +0 -349
- package/dist/_commonjsHelpers-ByYUsBRP.js +0 -33
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
- package/dist/common-BIEgCXbl.js +0 -7030
- package/dist/dateShortcuts-DDPtAhDI.js +0 -26
- package/dist/index-BRcBDlVs.js +0 -68
- package/dist/index-CeWudY6u.js +0 -8
- package/dist/index-DIX8TpoT.js +0 -118
- package/dist/index-DpPsTMp0.js +0 -8
- package/dist/index-epuVZjZV.js +0 -103
- package/dist/index-uf7oyYDF.js +0 -16847
- package/dist/loading-DJVNc0eN.js +0 -36
- package/dist/usePagination-CwShBEjA.js +0 -20
- package/dist/vue-virtual-scroller.esm-CH-jx4ri.js +0 -1051
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
import './HSelectSJ.css';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __async = (__this, __arguments, generator) => {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
var fulfilled = (value) => {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var rejected = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.throw(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
import { ElPopover, ElIcon, ElTag } from "element-plus/es";
|
|
41
|
+
import { defineComponent, useModel, ref, watch, computed, nextTick, onUnmounted, onMounted, openBlock, createBlock, withCtx, createVNode, unref, createElementBlock, createCommentVNode, toDisplayString, withModifiers, renderSlot, createElementVNode, normalizeClass, normalizeStyle, Fragment, renderList, createTextVNode, withDirectives, vModelText, mergeModels } from "vue";
|
|
42
|
+
import { q as debounce } from "./common-B1nSpTGn.js";
|
|
43
|
+
import { Check, ArrowDown, CircleClose } from "@element-plus/icons-vue";
|
|
44
|
+
import { _ as _sfc_main$1 } from "./LazyPopover.vue_vue_type_script_setup_true_lang-B2vtU4f4.js";
|
|
45
|
+
import { s as script$1, a as script } from "./vue-virtual-scroller.esm-ZgBoGAjX.js";
|
|
46
|
+
import { isEqual } from "lodash-unified";
|
|
47
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
|
|
48
|
+
const _hoisted_1 = {
|
|
49
|
+
key: 0,
|
|
50
|
+
class: "select-more-normal-value"
|
|
51
|
+
};
|
|
52
|
+
const _hoisted_2 = { class: "max-w-[64px] overflow-hidden text-ellipsis" };
|
|
53
|
+
const _hoisted_3 = { class: "max-h-[280px] overflow-y-auto" };
|
|
54
|
+
const _hoisted_4 = {
|
|
55
|
+
key: 1,
|
|
56
|
+
class: "select-more-normal-placeholder cursor-default"
|
|
57
|
+
};
|
|
58
|
+
const _hoisted_5 = ["placeholder"];
|
|
59
|
+
const _hoisted_6 = {
|
|
60
|
+
key: 2,
|
|
61
|
+
class: "select-more-normal-placeholder cursor-default"
|
|
62
|
+
};
|
|
63
|
+
const _hoisted_7 = {
|
|
64
|
+
key: 0,
|
|
65
|
+
class: "text-center leading-[30px] text-[#999] text-[12px]"
|
|
66
|
+
};
|
|
67
|
+
const _hoisted_8 = {
|
|
68
|
+
key: 0,
|
|
69
|
+
class: "text-[12px] text-center leading-[30px] text-[#999] h-[200px] flex items-center justify-center"
|
|
70
|
+
};
|
|
71
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
72
|
+
__name: "HSelectSJ",
|
|
73
|
+
props: /* @__PURE__ */ mergeModels({
|
|
74
|
+
size: { default: "normal" },
|
|
75
|
+
disabled: { type: Boolean, default: false },
|
|
76
|
+
api: {},
|
|
77
|
+
placeholder: { default: "请选择" },
|
|
78
|
+
multiple: { type: Boolean, default: false },
|
|
79
|
+
optionsKey: {},
|
|
80
|
+
props: {},
|
|
81
|
+
width: { default: 200 },
|
|
82
|
+
popwidth: { default: 200 },
|
|
83
|
+
sparamsKey: { default: {} },
|
|
84
|
+
otherParams: { default: {} },
|
|
85
|
+
stylecss: { default: "" },
|
|
86
|
+
formate: {},
|
|
87
|
+
filterable: { type: Boolean, default: true },
|
|
88
|
+
useInput: { type: Boolean, default: false },
|
|
89
|
+
lazy: { type: Boolean, default: false },
|
|
90
|
+
unuseremote: { type: Boolean, default: false },
|
|
91
|
+
options: { default: () => [] },
|
|
92
|
+
defText: {},
|
|
93
|
+
changeOrgData: {}
|
|
94
|
+
}, {
|
|
95
|
+
"modelValue": {},
|
|
96
|
+
"modelModifiers": {}
|
|
97
|
+
}),
|
|
98
|
+
emits: /* @__PURE__ */ mergeModels(["change", "clear"], ["update:modelValue"]),
|
|
99
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
100
|
+
const modelValue = useModel(__props, "modelValue");
|
|
101
|
+
const emit = __emit;
|
|
102
|
+
const key = /* @__PURE__ */ Symbol("HSelect");
|
|
103
|
+
const defParamsKey = {
|
|
104
|
+
pageNo: "pageNo",
|
|
105
|
+
pageSize: "pageSize",
|
|
106
|
+
total: "total",
|
|
107
|
+
text: "text"
|
|
108
|
+
};
|
|
109
|
+
const prop = __props;
|
|
110
|
+
const paramsKey = ref(__spreadValues(__spreadValues({}, defParamsKey), prop.sparamsKey));
|
|
111
|
+
const isFocused = ref(false);
|
|
112
|
+
const filterText = ref("");
|
|
113
|
+
const input = ref();
|
|
114
|
+
const checkNode = ref([]);
|
|
115
|
+
const data = ref([]);
|
|
116
|
+
const pageParams = ref({
|
|
117
|
+
[paramsKey.value.pageNo]: 1,
|
|
118
|
+
[paramsKey.value.pageSize]: 20
|
|
119
|
+
});
|
|
120
|
+
const dataTotal = ref(0);
|
|
121
|
+
const DynamicScrollerRef = ref();
|
|
122
|
+
const filterHandle = debounce(() => {
|
|
123
|
+
if (!prop.filterable) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
loadeMore(true, filterText.value);
|
|
127
|
+
});
|
|
128
|
+
watch(() => prop.otherParams, (n, o) => {
|
|
129
|
+
if (isEqual(n, o)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
loadeMore(true, filterText.value);
|
|
133
|
+
});
|
|
134
|
+
let curOptions = null;
|
|
135
|
+
const loadStatus = ref("loaded");
|
|
136
|
+
const loadeMore = (reload = false, filter = "") => __async(null, null, function* () {
|
|
137
|
+
if (prop.unuseremote) {
|
|
138
|
+
data.value = prop.options.filter(
|
|
139
|
+
(item) => {
|
|
140
|
+
var _a;
|
|
141
|
+
return (item[labelKey.value] || "").toLocaleLowerCase().includes(filterText.value.toLocaleLowerCase()) || ((_a = item.searchKey || "") == null ? void 0 : _a.toLocaleLowerCase().includes(filterText.value.toLocaleLowerCase()));
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (reload) {
|
|
147
|
+
pageParams.value[paramsKey.value.pageNo] = 1;
|
|
148
|
+
loadStatus.value = "loaded";
|
|
149
|
+
}
|
|
150
|
+
if (filter) {
|
|
151
|
+
filterText.value = filter;
|
|
152
|
+
}
|
|
153
|
+
if (loadStatus.value !== "loaded") {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
loadStatus.value = "loading";
|
|
157
|
+
const arg = prop.filterable ? __spreadValues(__spreadProps(__spreadValues({}, pageParams.value), { [paramsKey.value.text]: filterText.value }), prop.otherParams) : __spreadValues(__spreadValues({}, pageParams.value), prop.otherParams);
|
|
158
|
+
curOptions = JSON.stringify(arg);
|
|
159
|
+
try {
|
|
160
|
+
let res = yield prop.api(arg);
|
|
161
|
+
if (curOptions !== JSON.stringify(arg)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (prop.changeOrgData) {
|
|
165
|
+
res = prop.changeOrgData(res);
|
|
166
|
+
}
|
|
167
|
+
data.value = reload ? res.data.list : data.value.concat(res.data.list);
|
|
168
|
+
dataTotal.value = res.data[paramsKey.value.total];
|
|
169
|
+
pageParams.value[paramsKey.value.pageNo]++;
|
|
170
|
+
if (dataTotal.value <= data.value.length) {
|
|
171
|
+
loadStatus.value = "isloadall";
|
|
172
|
+
} else {
|
|
173
|
+
loadStatus.value = "loaded";
|
|
174
|
+
}
|
|
175
|
+
if (filter) {
|
|
176
|
+
const item = data.value.find((item2) => item2[labelKey.value] === filterText.value);
|
|
177
|
+
if (!item) {
|
|
178
|
+
loadeMore(reload);
|
|
179
|
+
}
|
|
180
|
+
return item;
|
|
181
|
+
}
|
|
182
|
+
} catch (error) {
|
|
183
|
+
loadStatus.value = "isloadall";
|
|
184
|
+
data.value = [];
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
const scrollHandle = (scrollEvent) => {
|
|
188
|
+
if (prop.unuseremote) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
try {
|
|
192
|
+
let main = null;
|
|
193
|
+
const children = scrollEvent.target.children;
|
|
194
|
+
for (let i = 0; i < children.length; i++) {
|
|
195
|
+
if (children[i].className === "vue-recycle-scroller__item-wrapper") {
|
|
196
|
+
main = children[i];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (!main) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (main.offsetHeight - scrollEvent.target.scrollTop < 300 && loadStatus.value === "loaded") {
|
|
203
|
+
loadeMore();
|
|
204
|
+
}
|
|
205
|
+
} catch (e) {
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
const valueText = computed(() => {
|
|
209
|
+
return !modelValue.value || prop.multiple ? "" : checkNode.value && !Array.isArray(checkNode.value) ? prop.formate ? prop.formate(checkNode.value) : checkNode.value[labelKey.value] : prop.defText || modelValue.value || prop.placeholder;
|
|
210
|
+
});
|
|
211
|
+
watch(() => isFocused.value, () => __async(null, null, function* () {
|
|
212
|
+
var _a, _b;
|
|
213
|
+
if (isFocused.value) {
|
|
214
|
+
if (valueText.value !== prop.placeholder) {
|
|
215
|
+
filterText.value = valueText.value;
|
|
216
|
+
}
|
|
217
|
+
yield nextTick();
|
|
218
|
+
(_a = input.value) == null ? void 0 : _a.focus();
|
|
219
|
+
loadeMore(true);
|
|
220
|
+
} else {
|
|
221
|
+
yield nextTick();
|
|
222
|
+
if (prop.useInput && filterText.value) {
|
|
223
|
+
if (!prop.multiple) {
|
|
224
|
+
if (modelValue.value === filterText.value) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
modelValue.value = filterText.value;
|
|
228
|
+
const _checkNode = data.value.find((item) => item[valueKey.value] === filterText.value);
|
|
229
|
+
if (_checkNode) {
|
|
230
|
+
checkNode.value = _checkNode;
|
|
231
|
+
} else {
|
|
232
|
+
checkNode.value = null;
|
|
233
|
+
}
|
|
234
|
+
yield nextTick();
|
|
235
|
+
emit("change", modelValue.value, checkNode.value);
|
|
236
|
+
} else {
|
|
237
|
+
if (!modelValue.value.includes(filterText.value)) {
|
|
238
|
+
modelValue.value.push(filterText.value);
|
|
239
|
+
emit("change", modelValue.value, checkNode.value);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
(_b = input.value) == null ? void 0 : _b.blur();
|
|
244
|
+
filterText.value = "";
|
|
245
|
+
!prop.lazy && loadeMore(true);
|
|
246
|
+
}
|
|
247
|
+
}));
|
|
248
|
+
watch(modelValue, (newdata, olddata) => {
|
|
249
|
+
try {
|
|
250
|
+
const _newdata = typeof newdata === "string" ? String(newdata) : JSON.stringify(newdata);
|
|
251
|
+
const _olddata = typeof olddata === "string" ? String(olddata) : JSON.stringify(olddata);
|
|
252
|
+
if (_newdata === _olddata) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
initData();
|
|
256
|
+
} catch (err) {
|
|
257
|
+
console.log(err);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
watch(() => prop.options, () => {
|
|
261
|
+
if (!prop.unuseremote) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
data.value = prop.options;
|
|
265
|
+
initData();
|
|
266
|
+
});
|
|
267
|
+
const initData = () => {
|
|
268
|
+
if (prop.unuseremote) {
|
|
269
|
+
if (prop.multiple) {
|
|
270
|
+
if (modelValue.value && modelValue.value.length) {
|
|
271
|
+
const _checkNode = [];
|
|
272
|
+
try {
|
|
273
|
+
modelValue.value.forEach((element) => {
|
|
274
|
+
const item = data.value.find((item2) => item2[valueKey.value] === element);
|
|
275
|
+
if (item) {
|
|
276
|
+
_checkNode.push(item);
|
|
277
|
+
} else {
|
|
278
|
+
console.warn(`HSelect未找到初始化值${element}`);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
} catch (error) {
|
|
282
|
+
console.log(error);
|
|
283
|
+
}
|
|
284
|
+
checkNode.value = _checkNode;
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
checkNode.value = [];
|
|
288
|
+
} else {
|
|
289
|
+
filterText.value = "";
|
|
290
|
+
if (modelValue.value) {
|
|
291
|
+
try {
|
|
292
|
+
const item = data.value.find((item2) => item2[valueKey.value] === modelValue.value);
|
|
293
|
+
if (item) {
|
|
294
|
+
checkNode.value = item;
|
|
295
|
+
} else {
|
|
296
|
+
console.warn(`HSelect未找到初始化值${modelValue.value}`);
|
|
297
|
+
}
|
|
298
|
+
} catch (error) {
|
|
299
|
+
console.warn(error);
|
|
300
|
+
}
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
checkNode.value = null;
|
|
304
|
+
}
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (prop.multiple) {
|
|
308
|
+
if (modelValue.value && modelValue.value.length) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
checkNode.value = [];
|
|
312
|
+
filterText.value = "";
|
|
313
|
+
} else {
|
|
314
|
+
filterText.value = modelValue.value;
|
|
315
|
+
if (modelValue.value && !prop.defText) {
|
|
316
|
+
findData();
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
checkNode.value = null;
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
const findData = () => __async(null, null, function* () {
|
|
323
|
+
try {
|
|
324
|
+
const item = data.value.find((item2) => item2[valueKey.value] === modelValue.value);
|
|
325
|
+
if (item) {
|
|
326
|
+
checkNode.value = item;
|
|
327
|
+
} else if (loadStatus.value === "loaded") {
|
|
328
|
+
yield loadeMore();
|
|
329
|
+
findData();
|
|
330
|
+
} else {
|
|
331
|
+
checkNode.value = void 0;
|
|
332
|
+
}
|
|
333
|
+
} catch (error) {
|
|
334
|
+
checkNode.value = void 0;
|
|
335
|
+
console.error(error);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
const labelList = computed(() => {
|
|
339
|
+
try {
|
|
340
|
+
if (typeof checkNode.value === "object") {
|
|
341
|
+
return checkNode.value.length ? checkNode.value.map((item) => prop.formate ? prop.formate(item) : item[labelKey.value]) : modelValue.value;
|
|
342
|
+
}
|
|
343
|
+
return checkNode.value ? prop.formate ? prop.formate(checkNode.value) : checkNode.value[labelKey.value] : modelValue.value || prop.placeholder;
|
|
344
|
+
} catch (error) {
|
|
345
|
+
return prop.multiple ? [] : "";
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
const isCheck = (item) => {
|
|
349
|
+
var _a;
|
|
350
|
+
try {
|
|
351
|
+
if (prop.multiple) {
|
|
352
|
+
return (_a = modelValue.value) == null ? void 0 : _a.includes(item[valueKey.value]);
|
|
353
|
+
}
|
|
354
|
+
return modelValue.value === item[valueKey.value];
|
|
355
|
+
} catch (error) {
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
const closeHandle = (index, val) => {
|
|
360
|
+
modelValue.value.splice(index, 1);
|
|
361
|
+
if (prop.useInput) {
|
|
362
|
+
try {
|
|
363
|
+
const iIndex = checkNode.value.findIndex((node) => node[valueKey.value] === val);
|
|
364
|
+
iIndex !== -1 && checkNode.value.splice(iIndex, 1);
|
|
365
|
+
} catch (error) {
|
|
366
|
+
console.log(error);
|
|
367
|
+
}
|
|
368
|
+
} else {
|
|
369
|
+
checkNode.value.splice(index, 1);
|
|
370
|
+
}
|
|
371
|
+
emit("change", modelValue.value, checkNode.value);
|
|
372
|
+
};
|
|
373
|
+
const valueKey = computed(() => {
|
|
374
|
+
if (prop.props && prop.props.value) {
|
|
375
|
+
return prop.props.value;
|
|
376
|
+
}
|
|
377
|
+
return "id";
|
|
378
|
+
});
|
|
379
|
+
const labelKey = computed(() => {
|
|
380
|
+
if (prop.props && prop.props.label) {
|
|
381
|
+
return prop.props.label;
|
|
382
|
+
}
|
|
383
|
+
return "label";
|
|
384
|
+
});
|
|
385
|
+
const clearCheaked = () => __async(null, null, function* () {
|
|
386
|
+
var _a, _b;
|
|
387
|
+
if (!prop.multiple) {
|
|
388
|
+
modelValue.value = "";
|
|
389
|
+
checkNode.value = null;
|
|
390
|
+
filterText.value = "";
|
|
391
|
+
loadeMore(true);
|
|
392
|
+
if (isFocused.value) {
|
|
393
|
+
(_a = input.value) == null ? void 0 : _a.focus();
|
|
394
|
+
}
|
|
395
|
+
yield nextTick();
|
|
396
|
+
emit("clear");
|
|
397
|
+
emit("change", modelValue.value);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
modelValue.value = [];
|
|
401
|
+
checkNode.value = [];
|
|
402
|
+
filterText.value = "";
|
|
403
|
+
loadeMore(true);
|
|
404
|
+
yield nextTick();
|
|
405
|
+
emit("clear");
|
|
406
|
+
emit("change", modelValue.value);
|
|
407
|
+
(_b = input.value) == null ? void 0 : _b.focus();
|
|
408
|
+
});
|
|
409
|
+
const clickHandle = (item) => __async(null, null, function* () {
|
|
410
|
+
var _a;
|
|
411
|
+
if (!prop.multiple) {
|
|
412
|
+
modelValue.value = item[valueKey.value];
|
|
413
|
+
yield nextTick();
|
|
414
|
+
checkNode.value = item;
|
|
415
|
+
yield nextTick();
|
|
416
|
+
isFocused.value = false;
|
|
417
|
+
emit("change", modelValue.value, checkNode.value);
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const index = modelValue.value.findIndex((e) => e === item[valueKey.value]);
|
|
421
|
+
if (index === -1) {
|
|
422
|
+
modelValue.value.push(item[valueKey.value]);
|
|
423
|
+
checkNode.value.push(item);
|
|
424
|
+
emit("change", modelValue.value, checkNode.value);
|
|
425
|
+
} else {
|
|
426
|
+
modelValue.value.splice(index, 1);
|
|
427
|
+
checkNode.value.splice(index, 1);
|
|
428
|
+
emit("change", modelValue.value, checkNode.value);
|
|
429
|
+
}
|
|
430
|
+
(_a = input.value) == null ? void 0 : _a.focus();
|
|
431
|
+
});
|
|
432
|
+
const checkAllNodes = () => {
|
|
433
|
+
var _a;
|
|
434
|
+
checkNode.value = data.value;
|
|
435
|
+
modelValue.value = checkNode.value.map((item) => item[valueKey.value]);
|
|
436
|
+
emit("change", modelValue.value, checkNode.value);
|
|
437
|
+
(_a = input.value) == null ? void 0 : _a.focus();
|
|
438
|
+
};
|
|
439
|
+
__expose({
|
|
440
|
+
modelValue,
|
|
441
|
+
checkAllNodes,
|
|
442
|
+
clearCheaked,
|
|
443
|
+
filterHandle,
|
|
444
|
+
loadeMore,
|
|
445
|
+
checkNode,
|
|
446
|
+
data
|
|
447
|
+
});
|
|
448
|
+
onUnmounted(() => {
|
|
449
|
+
delete window.clickOutSideList[key];
|
|
450
|
+
const objectSymbols = Object.getOwnPropertySymbols(window.clickOutSideList);
|
|
451
|
+
if (!objectSymbols.length) {
|
|
452
|
+
delete window.clickOutSideList;
|
|
453
|
+
window.removeEventListener("click", window.clickOutSideHandle);
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
onMounted(() => __async(null, null, function* () {
|
|
457
|
+
!prop.lazy && (yield loadeMore(true));
|
|
458
|
+
if (prop.unuseremote) {
|
|
459
|
+
data.value = prop.options;
|
|
460
|
+
}
|
|
461
|
+
!prop.lazy && initData();
|
|
462
|
+
if (!window.clickOutSideList) {
|
|
463
|
+
window.clickOutSideList = {
|
|
464
|
+
[key]: isFocused
|
|
465
|
+
};
|
|
466
|
+
window.clickOutSideHandle = function() {
|
|
467
|
+
const objectSymbols = Object.getOwnPropertySymbols(window.clickOutSideList);
|
|
468
|
+
objectSymbols.forEach((i) => {
|
|
469
|
+
window.clickOutSideList[i].value = false;
|
|
470
|
+
});
|
|
471
|
+
};
|
|
472
|
+
window.addEventListener("click", window.clickOutSideHandle);
|
|
473
|
+
} else {
|
|
474
|
+
window.clickOutSideList[key] = isFocused;
|
|
475
|
+
}
|
|
476
|
+
}));
|
|
477
|
+
return (_ctx, _cache) => {
|
|
478
|
+
const _component_el_tag = ElTag;
|
|
479
|
+
const _component_el_icon = ElIcon;
|
|
480
|
+
const _component_el_popover = ElPopover;
|
|
481
|
+
return openBlock(), createBlock(_component_el_popover, {
|
|
482
|
+
visible: isFocused.value,
|
|
483
|
+
placement: "bottom-start",
|
|
484
|
+
width: `${__props.popwidth || __props.width}px`
|
|
485
|
+
}, {
|
|
486
|
+
reference: withCtx(() => {
|
|
487
|
+
var _a, _b;
|
|
488
|
+
return [
|
|
489
|
+
createElementVNode("div", {
|
|
490
|
+
class: normalizeClass(["select-more", `${__props.stylecss} ${_ctx.$attrs.class}`]),
|
|
491
|
+
style: normalizeStyle({ width: typeof __props.width === "number" ? __props.width + "px" : __props.width }),
|
|
492
|
+
onClick: _cache[6] || (_cache[6] = withModifiers(($event) => isFocused.value = !isFocused.value, ["stop"]))
|
|
493
|
+
}, [
|
|
494
|
+
__props.disabled ? (openBlock(), createElementBlock("div", {
|
|
495
|
+
key: 0,
|
|
496
|
+
class: "disabled-wrap",
|
|
497
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
498
|
+
}, ["stop"]))
|
|
499
|
+
})) : createCommentVNode("", true),
|
|
500
|
+
createElementVNode("div", {
|
|
501
|
+
class: normalizeClass(["select-more-wrapper", { "is-focused": isFocused.value, "!text-[12px] !min-h-[24px] !h-[24px]": __props.size === "small" }])
|
|
502
|
+
}, [
|
|
503
|
+
__props.multiple && ((_a = labelList.value) == null ? void 0 : _a.length) ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
504
|
+
createVNode(_component_el_tag, {
|
|
505
|
+
class: "mr-[5px]",
|
|
506
|
+
type: "info",
|
|
507
|
+
closable: "",
|
|
508
|
+
onClose: _cache[1] || (_cache[1] = ($event) => closeHandle(0, labelList.value[0]))
|
|
509
|
+
}, {
|
|
510
|
+
default: withCtx(() => [
|
|
511
|
+
createElementVNode("div", _hoisted_2, toDisplayString(labelList.value[0]), 1)
|
|
512
|
+
]),
|
|
513
|
+
_: 1
|
|
514
|
+
}),
|
|
515
|
+
labelList.value.length > 1 ? (openBlock(), createBlock(_sfc_main$1, {
|
|
516
|
+
key: 0,
|
|
517
|
+
width: `${__props.popwidth}px`
|
|
518
|
+
}, {
|
|
519
|
+
reference: withCtx(() => [
|
|
520
|
+
createVNode(_component_el_tag, { type: "info" }, {
|
|
521
|
+
default: withCtx(() => [
|
|
522
|
+
createTextVNode("+ " + toDisplayString(labelList.value.length - 1), 1)
|
|
523
|
+
]),
|
|
524
|
+
_: 1
|
|
525
|
+
})
|
|
526
|
+
]),
|
|
527
|
+
default: withCtx(() => [
|
|
528
|
+
createElementVNode("div", _hoisted_3, [
|
|
529
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(labelList.value, (tag, index) => {
|
|
530
|
+
return openBlock(), createElementBlock(Fragment, {
|
|
531
|
+
key: tag[valueKey.value]
|
|
532
|
+
}, [
|
|
533
|
+
index !== 0 ? (openBlock(), createBlock(_component_el_tag, {
|
|
534
|
+
key: 0,
|
|
535
|
+
class: "mr-[5px] mt-[5px]",
|
|
536
|
+
closable: "",
|
|
537
|
+
onClose: ($event) => closeHandle(index, tag)
|
|
538
|
+
}, {
|
|
539
|
+
default: withCtx(() => [
|
|
540
|
+
createTextVNode(toDisplayString(tag), 1)
|
|
541
|
+
]),
|
|
542
|
+
_: 2
|
|
543
|
+
}, 1032, ["onClose"])) : createCommentVNode("", true)
|
|
544
|
+
], 64);
|
|
545
|
+
}), 128))
|
|
546
|
+
])
|
|
547
|
+
]),
|
|
548
|
+
_: 1
|
|
549
|
+
}, 8, ["width"])) : createCommentVNode("", true)
|
|
550
|
+
])) : createCommentVNode("", true),
|
|
551
|
+
__props.filterable ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
552
|
+
isFocused.value ? withDirectives((openBlock(), createElementBlock("input", {
|
|
553
|
+
key: 0,
|
|
554
|
+
ref_key: "input",
|
|
555
|
+
ref: input,
|
|
556
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => filterText.value = $event),
|
|
557
|
+
class: "w-full h-[90%]",
|
|
558
|
+
type: "text",
|
|
559
|
+
placeholder: __props.placeholder,
|
|
560
|
+
onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
|
|
561
|
+
}, ["stop"])),
|
|
562
|
+
onClick: _cache[4] || (_cache[4] = withModifiers(() => {
|
|
563
|
+
}, ["stop"])),
|
|
564
|
+
onInput: _cache[5] || (_cache[5] = //@ts-ignore
|
|
565
|
+
(...args) => unref(filterHandle) && unref(filterHandle)(...args))
|
|
566
|
+
}, null, 40, _hoisted_5)), [
|
|
567
|
+
[vModelText, filterText.value]
|
|
568
|
+
]) : (openBlock(), createElementBlock("div", {
|
|
569
|
+
key: 1,
|
|
570
|
+
class: normalizeClass(["text-nowrap", { "text-[#999]": !valueText.value || valueText.value === __props.placeholder }])
|
|
571
|
+
}, toDisplayString(valueText.value || __props.placeholder), 3))
|
|
572
|
+
])) : createCommentVNode("", true),
|
|
573
|
+
!__props.filterable && !__props.multiple ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
574
|
+
createElementVNode("div", {
|
|
575
|
+
class: normalizeClass(["text-nowrap", { "text-[#999]": !valueText.value || valueText.value === __props.placeholder }])
|
|
576
|
+
}, toDisplayString(valueText.value || __props.placeholder), 3)
|
|
577
|
+
])) : createCommentVNode("", true),
|
|
578
|
+
createElementVNode("div", {
|
|
579
|
+
class: normalizeClass(["select-more-arrow", { "is-focused": isFocused.value }])
|
|
580
|
+
}, [
|
|
581
|
+
createVNode(_component_el_icon, null, {
|
|
582
|
+
default: withCtx(() => [
|
|
583
|
+
createVNode(unref(ArrowDown))
|
|
584
|
+
]),
|
|
585
|
+
_: 1
|
|
586
|
+
})
|
|
587
|
+
], 2),
|
|
588
|
+
__props.multiple && ((_b = modelValue.value) == null ? void 0 : _b.length) || !__props.multiple && modelValue.value ? (openBlock(), createElementBlock("div", {
|
|
589
|
+
key: 3,
|
|
590
|
+
class: "select-more-clear",
|
|
591
|
+
onClick: withModifiers(clearCheaked, ["stop"])
|
|
592
|
+
}, [
|
|
593
|
+
createVNode(_component_el_icon, null, {
|
|
594
|
+
default: withCtx(() => [
|
|
595
|
+
createVNode(unref(CircleClose))
|
|
596
|
+
]),
|
|
597
|
+
_: 1
|
|
598
|
+
})
|
|
599
|
+
])) : createCommentVNode("", true)
|
|
600
|
+
], 2)
|
|
601
|
+
], 6)
|
|
602
|
+
];
|
|
603
|
+
}),
|
|
604
|
+
default: withCtx(() => [
|
|
605
|
+
createVNode(unref(script$1), {
|
|
606
|
+
ref_key: "DynamicScrollerRef",
|
|
607
|
+
ref: DynamicScrollerRef,
|
|
608
|
+
class: "content-list",
|
|
609
|
+
style: { height: "200px" },
|
|
610
|
+
keyField: __props.optionsKey || valueKey.value,
|
|
611
|
+
"min-item-size": 40,
|
|
612
|
+
items: data.value,
|
|
613
|
+
onScroll: scrollHandle
|
|
614
|
+
}, {
|
|
615
|
+
before: withCtx(() => [
|
|
616
|
+
renderSlot(_ctx.$slots, "header", {
|
|
617
|
+
options: data.value,
|
|
618
|
+
value: modelValue.value,
|
|
619
|
+
nodes: checkNode.value
|
|
620
|
+
}, void 0, true)
|
|
621
|
+
]),
|
|
622
|
+
default: withCtx(({ item, index, active }) => [
|
|
623
|
+
createVNode(unref(script), {
|
|
624
|
+
item,
|
|
625
|
+
active,
|
|
626
|
+
"data-index": index,
|
|
627
|
+
onClick: withModifiers(($event) => clickHandle(item), ["stop"])
|
|
628
|
+
}, {
|
|
629
|
+
default: withCtx(() => [
|
|
630
|
+
renderSlot(_ctx.$slots, "default", {
|
|
631
|
+
item: __spreadProps(__spreadValues({}, item), { active: isCheck(item) })
|
|
632
|
+
}, () => [
|
|
633
|
+
createElementVNode("div", {
|
|
634
|
+
class: normalizeClass(["item", { active: isCheck(item) }])
|
|
635
|
+
}, [
|
|
636
|
+
createElementVNode("div", null, toDisplayString(__props.formate ? __props.formate(item) : item[labelKey.value]), 1),
|
|
637
|
+
isCheck(item) ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
|
|
638
|
+
default: withCtx(() => [
|
|
639
|
+
createVNode(unref(Check))
|
|
640
|
+
]),
|
|
641
|
+
_: 1
|
|
642
|
+
})) : createCommentVNode("", true)
|
|
643
|
+
], 2)
|
|
644
|
+
], true)
|
|
645
|
+
]),
|
|
646
|
+
_: 2
|
|
647
|
+
}, 1032, ["item", "active", "data-index", "onClick"])
|
|
648
|
+
]),
|
|
649
|
+
after: withCtx(() => [
|
|
650
|
+
loadStatus.value !== "isloadall" && !prop.unuseremote ? (openBlock(), createElementBlock("div", _hoisted_7, toDisplayString(loadStatus.value === "loading" ? "加载中" : "等待加载"), 1)) : createCommentVNode("", true)
|
|
651
|
+
]),
|
|
652
|
+
empty: withCtx(() => [
|
|
653
|
+
(loadStatus.value === "isloadall" || __props.unuseremote) && !data.value.length ? (openBlock(), createElementBlock("div", _hoisted_8, "暂无可用数据")) : createCommentVNode("", true)
|
|
654
|
+
]),
|
|
655
|
+
_: 3
|
|
656
|
+
}, 8, ["keyField", "items"]),
|
|
657
|
+
renderSlot(_ctx.$slots, "footer", {
|
|
658
|
+
options: data.value,
|
|
659
|
+
value: modelValue.value,
|
|
660
|
+
nodes: checkNode.value
|
|
661
|
+
}, void 0, true)
|
|
662
|
+
]),
|
|
663
|
+
_: 3
|
|
664
|
+
}, 8, ["visible", "width"]);
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
const HSelectSJ = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-dd0d6f50"]]);
|
|
669
|
+
export {
|
|
670
|
+
HSelectSJ as H
|
|
671
|
+
};
|