@dazhicheng/ui 1.6.80 → 1.6.81
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/api/supplier.js +1 -3
- package/dist/components/tt-panel-select/src/index.vue.d.ts +1 -0
- package/dist/components/tt-panel-select/src/index.vue.js +328 -329
- package/dist/components/tt-panel-select/src/types.d.ts +7 -0
- package/dist/hooks/missingOptionsCache.d.ts +27 -1
- package/dist/hooks/missingOptionsCache.js +99 -62
- package/dist/hooks/useFormSchemasLink.js +6 -4
- package/dist/hooks/usePanelSelectSchemas.js +10 -2
- package/package.json +1 -1
package/dist/api/supplier.js
CHANGED
|
@@ -24,9 +24,7 @@ async function t(e, s) {
|
|
|
24
24
|
}
|
|
25
25
|
async function f(e) {
|
|
26
26
|
const s = [
|
|
27
|
-
...new Set(
|
|
28
|
-
(Array.isArray(e) ? e : []).map((r) => String(r ?? "").trim()).filter(Boolean)
|
|
29
|
-
)
|
|
27
|
+
...new Set((Array.isArray(e) ? e : []).map((r) => String(r ?? "").trim()).filter(Boolean))
|
|
30
28
|
];
|
|
31
29
|
if (!s.length) return [];
|
|
32
30
|
const l = await t(s).catch(() => null);
|
|
@@ -42,6 +42,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
42
42
|
middlePlaceholder: string;
|
|
43
43
|
showNav: boolean;
|
|
44
44
|
resolveMissingOptions: (codes: Array<string | number>) => Promise<PanelSelectOption[]>;
|
|
45
|
+
missingEchoKey: string;
|
|
45
46
|
showAllField: PanelSelectValue;
|
|
46
47
|
showPinyinMode: boolean;
|
|
47
48
|
showOriginMode: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as fl, mergeModels as ne, computed as i, useModel as hl, watch as b, ref as g, useTemplateRef as L, unref as s, onMounted as ml, createElementBlock as R, openBlock as w, normalizeClass as x, createVNode as re, mergeProps as vl, withCtx as ie, withDirectives as gl, normalizeStyle as wl, createBlock as se, createCommentVNode as B, createElementVNode as ue, toDisplayString as yl, nextTick as _ } from "vue";
|
|
2
2
|
import "../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.34_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
|
|
3
3
|
import { useDesign as Al } from "../../../packages/hooks/src/useDesign.js";
|
|
4
4
|
import "axios";
|
|
5
|
-
import { ElSelect as Cl, vLoading as
|
|
5
|
+
import { ElSelect as Cl, vLoading as kl } from "element-plus";
|
|
6
6
|
import { isString as bl } from "../../../packages/utils/src/is.js";
|
|
7
7
|
import "dayjs";
|
|
8
8
|
import "numeral";
|
|
@@ -17,20 +17,20 @@ import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-
|
|
|
17
17
|
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
18
18
|
import "lodash-es";
|
|
19
19
|
import "vue-router";
|
|
20
|
-
import {
|
|
21
|
-
import { useResizeObserver as
|
|
22
|
-
import { useSelectCollapseOptions as
|
|
23
|
-
import { splitPanelSelectText as
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import { usePanelSelectData as
|
|
28
|
-
import { usePanelSelectSelection as
|
|
20
|
+
import { missingOptionsEchoVersion as xl, getPanelMissingEchoOptions as Sl, expandJoinedOptionValues as Ol, diffPanelMissingCodes as Ml, ensurePanelResolveMissingOptions as Vl, PANEL_MISSING_ECHO_DEFAULT_SCOPE as ce } from "../../../hooks/missingOptionsCache.js";
|
|
21
|
+
import { useDebounceFn as El, useResizeObserver as Fl } from "@vueuse/core";
|
|
22
|
+
import { useSelectCollapseOptions as Pl } from "../../tt-form/src/hooks/useSelectCollapse.js";
|
|
23
|
+
import { splitPanelSelectText as T, ALL as $l, DEFAULT_PANEL_SELECT_SEPARATORS as Nl } from "./common.js";
|
|
24
|
+
import Ll from "./components/PanelLeft.vue.js";
|
|
25
|
+
import Rl from "./components/PanelMiddle.vue.js";
|
|
26
|
+
import Bl from "./components/PanelRight.vue.js";
|
|
27
|
+
import { usePanelSelectData as _l } from "./hooks/usePanelData.js";
|
|
28
|
+
import { usePanelSelectSelection as Tl } from "./hooks/usePanelSelection.js";
|
|
29
29
|
/* empty css */
|
|
30
|
-
const
|
|
30
|
+
const m = 4, ht = /* @__PURE__ */ fl({
|
|
31
31
|
name: "TtPanelSelect",
|
|
32
32
|
__name: "index",
|
|
33
|
-
props: /* @__PURE__ */
|
|
33
|
+
props: /* @__PURE__ */ ne({
|
|
34
34
|
allowCreate: { type: Boolean, default: !1 },
|
|
35
35
|
disabled: { type: Boolean, default: !1 },
|
|
36
36
|
showNav: { type: Boolean, default: !0 },
|
|
@@ -41,6 +41,7 @@ const g = 4, ct = /* @__PURE__ */ hl({
|
|
|
41
41
|
resultField: { default: "" },
|
|
42
42
|
options: { default: () => [] },
|
|
43
43
|
resolveMissingOptions: { type: Function, default: void 0 },
|
|
44
|
+
missingEchoKey: { default: ce },
|
|
44
45
|
treeConfig: { default: () => ({
|
|
45
46
|
transform: !1,
|
|
46
47
|
labelField: "label",
|
|
@@ -53,11 +54,11 @@ const g = 4, ct = /* @__PURE__ */ hl({
|
|
|
53
54
|
immediate: { type: Boolean, default: !0 },
|
|
54
55
|
beforeFetch: { type: Function, default: void 0 },
|
|
55
56
|
afterFetch: { type: Function, default: void 0 },
|
|
56
|
-
separator: { default: () => [...
|
|
57
|
+
separator: { default: () => [...Nl] },
|
|
57
58
|
pasteSearch: { type: Boolean, default: !0 },
|
|
58
59
|
alwaysLoad: { type: Boolean, default: !1 },
|
|
59
60
|
showAll: { type: Boolean, default: !0 },
|
|
60
|
-
showAllField: { default:
|
|
61
|
+
showAllField: { default: $l },
|
|
61
62
|
showPinyinMode: { type: Boolean, default: !1 },
|
|
62
63
|
showOriginMode: { type: Boolean, default: !0 },
|
|
63
64
|
leftPlaceholder: { default: "支持模糊搜索" },
|
|
@@ -67,479 +68,477 @@ const g = 4, ct = /* @__PURE__ */ hl({
|
|
|
67
68
|
modelValue: {},
|
|
68
69
|
modelModifiers: {}
|
|
69
70
|
}),
|
|
70
|
-
emits: /* @__PURE__ */
|
|
71
|
-
setup(
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const l = /* @__PURE__ */ new Set(), t = (o) => {
|
|
71
|
+
emits: /* @__PURE__ */ ne(["visible-change", "change", "focus"], ["update:modelValue"]),
|
|
72
|
+
setup(c, { expose: de, emit: pe }) {
|
|
73
|
+
const fe = kl, he = Cl, t = c, S = pe, { prefixCls: d } = Al("panel-select");
|
|
74
|
+
function me(e = []) {
|
|
75
|
+
const l = /* @__PURE__ */ new Set(), a = (o) => {
|
|
76
76
|
o.forEach((n) => {
|
|
77
|
-
var
|
|
78
|
-
if ((
|
|
79
|
-
|
|
77
|
+
var u;
|
|
78
|
+
if ((u = n.children) != null && u.length) {
|
|
79
|
+
a(n.children);
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
n.value !== void 0 && n.value !== null && n.value !== "" && l.add(n.value);
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
|
-
return
|
|
85
|
+
return a(e), l;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function ve(e) {
|
|
88
88
|
return Array.isArray(e) ? e : e == null || e === "" ? [] : [e];
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
function G() {
|
|
91
|
+
return t.missingEchoKey || ce;
|
|
92
|
+
}
|
|
93
|
+
const ge = i(() => {
|
|
94
|
+
xl.value;
|
|
95
|
+
const e = t.options || [], l = Sl(G());
|
|
96
|
+
if (!l.length) return e;
|
|
97
|
+
const a = me(e), o = l.filter(
|
|
98
|
+
(n) => n.value !== void 0 && n.value !== null && !a.has(n.value)
|
|
95
99
|
);
|
|
96
|
-
return
|
|
97
|
-
}),
|
|
98
|
-
get(e, l,
|
|
99
|
-
return l === "options" ?
|
|
100
|
+
return o.length ? [...e, ...o] : e;
|
|
101
|
+
}), we = new Proxy(t, {
|
|
102
|
+
get(e, l, a) {
|
|
103
|
+
return l === "options" ? ge.value : Reflect.get(e, l, a);
|
|
100
104
|
}
|
|
101
105
|
}), {
|
|
102
|
-
loading:
|
|
103
|
-
fetchApi:
|
|
104
|
-
treeOptions:
|
|
105
|
-
navTreeOptions:
|
|
106
|
-
navNodes:
|
|
107
|
-
leafNodes:
|
|
108
|
-
isFirstLoaded:
|
|
109
|
-
filterNodes:
|
|
110
|
-
buildOptionGroups:
|
|
111
|
-
} =
|
|
112
|
-
let
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
115
|
-
return
|
|
116
|
-
const e =
|
|
117
|
-
return
|
|
118
|
-
}),
|
|
106
|
+
loading: D,
|
|
107
|
+
fetchApi: v,
|
|
108
|
+
treeOptions: ye,
|
|
109
|
+
navTreeOptions: K,
|
|
110
|
+
navNodes: Ae,
|
|
111
|
+
leafNodes: f,
|
|
112
|
+
isFirstLoaded: W,
|
|
113
|
+
filterNodes: Ce,
|
|
114
|
+
buildOptionGroups: U
|
|
115
|
+
} = _l(we), r = hl(c, "modelValue");
|
|
116
|
+
let I;
|
|
117
|
+
const z = i(() => t.disabled), ke = i(() => {
|
|
118
|
+
if (!t.multiple)
|
|
119
|
+
return t.allowCreate ? `${t.placeholder ? t.placeholder : "请选择"}(可创建)` : t.placeholder;
|
|
120
|
+
const e = t.showMultiple ? "支持多选和全选" : "支持多选", l = typeof t.placeholder == "string" && t.placeholder.trim() ? t.placeholder.trim().replace(/[,,]\s*$/, "") : "请选择", a = l.includes("支持多选和全选") || l.includes("支持多选") ? l : `${l},${e}`;
|
|
121
|
+
return t.allowCreate ? `${a}(可创建)` : a;
|
|
122
|
+
}), be = i(() => {
|
|
119
123
|
const e = /* @__PURE__ */ new Map();
|
|
120
|
-
return
|
|
121
|
-
}),
|
|
124
|
+
return f.value.forEach((l) => e.set(l.value, l.label)), e;
|
|
125
|
+
}), j = i(() => {
|
|
122
126
|
const e = /* @__PURE__ */ new Map();
|
|
123
|
-
return
|
|
124
|
-
var
|
|
125
|
-
(l.deleted === !0 || ((
|
|
127
|
+
return f.value.forEach((l) => {
|
|
128
|
+
var a;
|
|
129
|
+
(l.deleted === !0 || ((a = l.raw) == null ? void 0 : a.deleted) === !0) && e.set(l.value, !0);
|
|
126
130
|
}), e;
|
|
127
131
|
});
|
|
128
|
-
function
|
|
129
|
-
return e ===
|
|
130
|
-
label:
|
|
132
|
+
function O(e) {
|
|
133
|
+
return e === t.showAllField ? { label: "全部", value: t.showAllField } : {
|
|
134
|
+
label: be.value.get(e) ?? String(e),
|
|
131
135
|
value: e,
|
|
132
|
-
deleted:
|
|
136
|
+
deleted: j.value.get(e) === !0
|
|
133
137
|
};
|
|
134
138
|
}
|
|
135
|
-
function
|
|
136
|
-
return e == null ? !1 :
|
|
139
|
+
function xe(e) {
|
|
140
|
+
return e == null ? !1 : j.value.get(e) === !0;
|
|
137
141
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
);
|
|
158
|
-
let se = !1;
|
|
159
|
-
s.forEach((c) => {
|
|
160
|
-
(c == null ? void 0 : c.value) === void 0 || (c == null ? void 0 : c.value) === null || A.has(c.value) || (m.push(c), A.add(c.value), se = !0);
|
|
161
|
-
}), se && (y.value = m);
|
|
142
|
+
const Se = El(async () => {
|
|
143
|
+
const e = t.resolveMissingOptions;
|
|
144
|
+
if (!e) return;
|
|
145
|
+
const l = Ol(
|
|
146
|
+
ve(r.value).filter((n) => n !== t.showAllField)
|
|
147
|
+
);
|
|
148
|
+
if (!l.length) return;
|
|
149
|
+
const a = G();
|
|
150
|
+
Ml(a, l, t.options || []).length && await Vl(
|
|
151
|
+
a,
|
|
152
|
+
l,
|
|
153
|
+
t.options || [],
|
|
154
|
+
(n) => e(n)
|
|
155
|
+
);
|
|
156
|
+
}, 64);
|
|
157
|
+
b(
|
|
158
|
+
[r, () => t.options, () => t.showAllField, () => t.missingEchoKey],
|
|
159
|
+
() => {
|
|
160
|
+
t.resolveMissingOptions && Se();
|
|
162
161
|
},
|
|
163
162
|
{ immediate: !0, deep: !0 }
|
|
164
163
|
);
|
|
165
|
-
function
|
|
164
|
+
function H(e) {
|
|
166
165
|
if (e != null)
|
|
167
166
|
return typeof e == "object" && "value" in e ? e.value : e;
|
|
168
167
|
}
|
|
169
|
-
const
|
|
168
|
+
const J = i({
|
|
170
169
|
get() {
|
|
171
|
-
return Array.isArray(r.value) ?
|
|
170
|
+
return Array.isArray(r.value) ? t.multiple ? r.value : r.value.slice(-1) : r.value === void 0 ? [] : [r.value];
|
|
172
171
|
},
|
|
173
172
|
set(e) {
|
|
174
|
-
r.value =
|
|
173
|
+
r.value = t.multiple ? [...e] : e.at(-1);
|
|
175
174
|
}
|
|
176
|
-
}),
|
|
177
|
-
if (!
|
|
178
|
-
const e = new Set(
|
|
179
|
-
return new Set(
|
|
180
|
-
!bl(
|
|
175
|
+
}), M = i(() => {
|
|
176
|
+
if (!t.allowCreate) return [];
|
|
177
|
+
const e = new Set(f.value.map((a) => a.value)), l = [];
|
|
178
|
+
return new Set(J.value).forEach((a) => {
|
|
179
|
+
!bl(a) || a === t.showAllField || e.has(a) || l.push({ label: a, value: a, level: 0, path: [], raw: { label: a, value: a } });
|
|
181
180
|
}), l;
|
|
182
|
-
}),
|
|
183
|
-
|
|
181
|
+
}), V = i(() => [...f.value, ...M.value]);
|
|
182
|
+
b([() => t.multiple, () => r.value], ([e, l]) => {
|
|
184
183
|
if (e) {
|
|
185
184
|
Array.isArray(l) || (r.value = l === void 0 ? [] : [l]);
|
|
186
185
|
return;
|
|
187
186
|
}
|
|
188
187
|
Array.isArray(l) && (r.value = l.at(-1));
|
|
189
188
|
});
|
|
190
|
-
const
|
|
191
|
-
function
|
|
192
|
-
const e =
|
|
193
|
-
e && (
|
|
189
|
+
const E = g(), y = g(""), p = g(""), F = g(), P = L("middleRef"), A = L("selectWrapRef"), q = L("selectRef"), $ = g(0);
|
|
190
|
+
function Q() {
|
|
191
|
+
const e = A.value;
|
|
192
|
+
e && ($.value = e.offsetWidth);
|
|
194
193
|
}
|
|
195
|
-
|
|
196
|
-
const
|
|
194
|
+
Fl(A, () => Q());
|
|
195
|
+
const Oe = i(() => ({
|
|
197
196
|
componentProps: {
|
|
198
|
-
multiple:
|
|
197
|
+
multiple: t.multiple,
|
|
199
198
|
component: {
|
|
200
199
|
name: "TtPanelSelect"
|
|
201
200
|
}
|
|
202
201
|
},
|
|
203
202
|
component: "TtPanelSelect",
|
|
204
|
-
selectWrapRef:
|
|
205
|
-
selectRef:
|
|
206
|
-
})), { selectComponentProps: Me } =
|
|
207
|
-
const e =
|
|
208
|
-
if (!e) return
|
|
209
|
-
const l = (
|
|
203
|
+
selectWrapRef: A,
|
|
204
|
+
selectRef: q
|
|
205
|
+
})), { selectComponentProps: Me } = Pl(Oe), X = i(() => {
|
|
206
|
+
const e = y.value.trim().toLowerCase();
|
|
207
|
+
if (!e) return K.value;
|
|
208
|
+
const l = (a) => {
|
|
210
209
|
const o = [];
|
|
211
|
-
return
|
|
212
|
-
var
|
|
213
|
-
const
|
|
214
|
-
(String(n.label).toLowerCase().includes(e) ||
|
|
210
|
+
return a.forEach((n) => {
|
|
211
|
+
var oe;
|
|
212
|
+
const u = (oe = n.children) != null && oe.length ? l(n.children) : void 0;
|
|
213
|
+
(String(n.label).toLowerCase().includes(e) || u && u.length) && o.push({ ...n, children: u != null && u.length ? u : void 0 });
|
|
215
214
|
}), o;
|
|
216
215
|
};
|
|
217
|
-
return l(
|
|
218
|
-
}),
|
|
219
|
-
const e = [], l = (
|
|
220
|
-
|
|
216
|
+
return l(K.value);
|
|
217
|
+
}), Ve = i(() => {
|
|
218
|
+
const e = [], l = (a) => {
|
|
219
|
+
a.forEach((o) => {
|
|
221
220
|
var n;
|
|
222
221
|
e.push(o.value), (n = o.children) != null && n.length && l(o.children);
|
|
223
222
|
});
|
|
224
223
|
};
|
|
225
|
-
return l(
|
|
226
|
-
}),
|
|
227
|
-
() => Fe(
|
|
224
|
+
return l(X.value), e;
|
|
225
|
+
}), C = i(
|
|
226
|
+
() => Fe(p.value).map((e) => ({
|
|
228
227
|
label: e,
|
|
229
228
|
value: e,
|
|
230
229
|
level: 0,
|
|
231
230
|
path: [],
|
|
232
231
|
raw: { label: e, value: e }
|
|
233
232
|
}))
|
|
234
|
-
),
|
|
235
|
-
const e =
|
|
233
|
+
), Ee = i(() => [...V.value, ...C.value]), k = i(() => {
|
|
234
|
+
const e = U(f.value, p.value), l = Ce([...M.value, ...C.value], p.value);
|
|
236
235
|
if (!l.length) return e;
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
}), o.push(...
|
|
236
|
+
const a = new Map(l.map((u) => [u.value, u])), o = [];
|
|
237
|
+
T(p.value, t.separator).forEach((u) => {
|
|
238
|
+
const N = a.get(u);
|
|
239
|
+
N && (o.push(N), a.delete(u));
|
|
240
|
+
}), o.push(...a.values());
|
|
242
241
|
let n = "__created__";
|
|
243
|
-
for (; e.some((
|
|
242
|
+
for (; e.some((u) => u.value === n); ) n += "_";
|
|
244
243
|
return [{ value: n, label: "自定义", options: o }, ...e];
|
|
245
244
|
});
|
|
246
245
|
function Fe(e) {
|
|
247
|
-
if (!
|
|
248
|
-
const l =
|
|
249
|
-
if (!l.length ||
|
|
250
|
-
const
|
|
251
|
-
return [...new Set(l)].filter((o) => o !== `${
|
|
246
|
+
if (!t.allowCreate || t.disabled || D.value || t.api && !W.value) return [];
|
|
247
|
+
const l = T(e, t.separator);
|
|
248
|
+
if (!l.length || U(f.value, e).length) return [];
|
|
249
|
+
const a = new Set(V.value.map((o) => `${o.value}`));
|
|
250
|
+
return [...new Set(l)].filter((o) => o !== `${t.showAllField}` && !a.has(o));
|
|
252
251
|
}
|
|
253
|
-
function
|
|
254
|
-
if (!
|
|
252
|
+
function Pe() {
|
|
253
|
+
if (!C.value.length) return;
|
|
255
254
|
const e = new Set(
|
|
256
|
-
[...
|
|
257
|
-
), l = [...new Set(
|
|
258
|
-
(
|
|
255
|
+
[...M.value, ...C.value].map((a) => a.value)
|
|
256
|
+
), l = [...new Set(T(p.value, t.separator))].filter(
|
|
257
|
+
(a) => e.has(a)
|
|
259
258
|
);
|
|
260
|
-
|
|
259
|
+
ae(l, !0);
|
|
261
260
|
}
|
|
262
|
-
const
|
|
261
|
+
const $e = i(() => {
|
|
263
262
|
const e = "minmax(var(--tt-panel-select-middle-width, 450px), 1fr)";
|
|
264
|
-
return
|
|
265
|
-
}),
|
|
263
|
+
return t.showNav && !t.multiple ? `200px ${e}` : !t.showNav && t.multiple ? `${e} 180px` : !t.showNav && !t.multiple ? e : `200px ${e} 180px`;
|
|
264
|
+
}), Ne = i(() => {
|
|
266
265
|
const e = "var(--tt-panel-select-middle-width, 450px)";
|
|
267
|
-
return
|
|
268
|
-
}),
|
|
266
|
+
return t.showNav && !t.multiple ? `max(calc(200px + ${e}), 800px)` : !t.showNav && t.multiple ? `max(calc(${e} + 180px), 800px)` : !t.showNav && !t.multiple ? `max(${e}, 800px)` : `max(calc(200px + ${e} + 180px), 800px)`;
|
|
267
|
+
}), Le = i(() => {
|
|
269
268
|
const e = [];
|
|
270
|
-
return
|
|
271
|
-
!(
|
|
272
|
-
const o = Math.ceil(l.options.length /
|
|
273
|
-
for (let n = 0; n < l.options.length; n +=
|
|
274
|
-
const
|
|
269
|
+
return k.value.forEach((l) => {
|
|
270
|
+
!(t.showOriginMode && l.value === "__origin__") && e.push({ key: `group-${String(l.value)}`, type: "group", group: l });
|
|
271
|
+
const o = Math.ceil(l.options.length / m);
|
|
272
|
+
for (let n = 0; n < l.options.length; n += m) {
|
|
273
|
+
const u = n / m;
|
|
275
274
|
e.push({
|
|
276
|
-
key: `options-${String(l.value)}-${n /
|
|
275
|
+
key: `options-${String(l.value)}-${n / m}`,
|
|
277
276
|
type: "options",
|
|
278
277
|
group: l,
|
|
279
|
-
options: l.options.slice(n, n +
|
|
280
|
-
isLast:
|
|
278
|
+
options: l.options.slice(n, n + m),
|
|
279
|
+
isLast: u === o - 1
|
|
281
280
|
});
|
|
282
281
|
}
|
|
283
282
|
}), e;
|
|
284
283
|
}), {
|
|
285
|
-
selectedOptions:
|
|
286
|
-
selectedValueSet:
|
|
287
|
-
isAllChecked:
|
|
284
|
+
selectedOptions: Re,
|
|
285
|
+
selectedValueSet: Y,
|
|
286
|
+
isAllChecked: Be,
|
|
288
287
|
isIndeterminate: _e,
|
|
289
|
-
getGroupCheckCount:
|
|
290
|
-
handleGroupCheck:
|
|
291
|
-
handleAllOptionCheck:
|
|
288
|
+
getGroupCheckCount: Te,
|
|
289
|
+
handleGroupCheck: Ge,
|
|
290
|
+
handleAllOptionCheck: De,
|
|
292
291
|
handleOptionCheck: Ke,
|
|
293
|
-
handleOptionsCheck:
|
|
294
|
-
handleCheckAll:
|
|
295
|
-
clearSelected:
|
|
296
|
-
removeSelected:
|
|
292
|
+
handleOptionsCheck: We,
|
|
293
|
+
handleCheckAll: Ue,
|
|
294
|
+
clearSelected: Ie,
|
|
295
|
+
removeSelected: ze,
|
|
297
296
|
withLockedSelectedValues: je
|
|
298
|
-
} =
|
|
299
|
-
multiple: i(() =>
|
|
297
|
+
} = Tl({
|
|
298
|
+
multiple: i(() => t.multiple),
|
|
300
299
|
modelValue: r,
|
|
301
|
-
selectedValues:
|
|
302
|
-
leafNodes:
|
|
303
|
-
allValue: i(() =>
|
|
304
|
-
}),
|
|
300
|
+
selectedValues: J,
|
|
301
|
+
leafNodes: Ee,
|
|
302
|
+
allValue: i(() => t.showAllField)
|
|
303
|
+
}), Z = i({
|
|
305
304
|
get() {
|
|
306
|
-
if (
|
|
307
|
-
return (Array.isArray(r.value) ? r.value : r.value === void 0 ? [] : [r.value]).map((l) =>
|
|
305
|
+
if (t.multiple)
|
|
306
|
+
return (Array.isArray(r.value) ? r.value : r.value === void 0 ? [] : [r.value]).map((l) => O(l));
|
|
308
307
|
if (Array.isArray(r.value)) {
|
|
309
308
|
const e = r.value.at(-1);
|
|
310
|
-
return e === void 0 ? void 0 :
|
|
309
|
+
return e === void 0 ? void 0 : O(e);
|
|
311
310
|
}
|
|
312
|
-
return r.value === void 0 ? void 0 :
|
|
311
|
+
return r.value === void 0 ? void 0 : O(r.value);
|
|
313
312
|
},
|
|
314
313
|
set(e) {
|
|
315
|
-
const l =
|
|
316
|
-
if (
|
|
317
|
-
const o = (Array.isArray(e) ? e : []).map((n) =>
|
|
314
|
+
const l = s(r);
|
|
315
|
+
if (I = Array.isArray(l) ? [...l] : l, t.multiple) {
|
|
316
|
+
const o = (Array.isArray(e) ? e : []).map((n) => H(n)).filter((n) => n !== void 0);
|
|
318
317
|
r.value = je(o);
|
|
319
318
|
return;
|
|
320
319
|
}
|
|
321
|
-
r.value =
|
|
320
|
+
r.value = H(e);
|
|
322
321
|
}
|
|
323
|
-
}),
|
|
322
|
+
}), ee = i(
|
|
324
323
|
() => {
|
|
325
324
|
const e = {}, l = {};
|
|
326
|
-
return
|
|
327
|
-
const { enabledCount: o, checkedCount: n } =
|
|
328
|
-
e[
|
|
325
|
+
return k.value.forEach((a) => {
|
|
326
|
+
const { enabledCount: o, checkedCount: n } = Te(a), u = String(a.value);
|
|
327
|
+
e[u] = o > 0 && n === o, l[u] = o > 0 && n > 0 && n < o;
|
|
329
328
|
}), { checkedMap: e, indeterminateMap: l };
|
|
330
329
|
}
|
|
331
|
-
),
|
|
332
|
-
function
|
|
333
|
-
const l =
|
|
330
|
+
), He = i(() => ee.value.checkedMap), Je = i(() => ee.value.indeterminateMap), qe = i(() => Y.value.has(t.showAllField)), le = i(() => [...t.showAll ? [{ label: "全部", value: t.showAllField }] : [], ...V.value.map((l) => ({ ...l }))]);
|
|
331
|
+
function Qe(e) {
|
|
332
|
+
const l = s(le);
|
|
334
333
|
if (Array.isArray(e)) {
|
|
335
|
-
const
|
|
336
|
-
return l.filter((o) => o.value !== void 0 &&
|
|
334
|
+
const a = new Set(e);
|
|
335
|
+
return l.filter((o) => o.value !== void 0 && a.has(o.value));
|
|
337
336
|
}
|
|
338
337
|
if (e !== void 0)
|
|
339
|
-
return l.find((
|
|
338
|
+
return l.find((a) => a.value === e);
|
|
339
|
+
}
|
|
340
|
+
function Xe(e) {
|
|
341
|
+
var a;
|
|
342
|
+
if (t.showPinyinMode || k.value.some((o) => o.value === e.value)) return e.value;
|
|
343
|
+
const l = f.value.find((o) => o.path.some((n) => n.value === e.value));
|
|
344
|
+
return (a = l == null ? void 0 : l.path.at(-2)) == null ? void 0 : a.value;
|
|
340
345
|
}
|
|
341
346
|
function Ye(e) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
347
|
+
E.value = e.value;
|
|
348
|
+
const l = Xe(e);
|
|
349
|
+
F.value = void 0, _(() => {
|
|
350
|
+
var a;
|
|
351
|
+
F.value = l, l !== void 0 && ((a = P.value) == null || a.scrollToGroup(l));
|
|
352
|
+
});
|
|
346
353
|
}
|
|
347
354
|
function Ze(e) {
|
|
348
|
-
|
|
349
|
-
const l = Ye(e);
|
|
350
|
-
P.value = void 0, D(() => {
|
|
351
|
-
var t;
|
|
352
|
-
P.value = l, l !== void 0 && ((t = R.value) == null || t.scrollToGroup(l));
|
|
353
|
-
});
|
|
355
|
+
y.value = e;
|
|
354
356
|
}
|
|
355
357
|
function el(e) {
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
function ll(e) {
|
|
359
|
-
f.value = e;
|
|
358
|
+
p.value = e;
|
|
360
359
|
}
|
|
361
|
-
function
|
|
362
|
-
const
|
|
363
|
-
|
|
360
|
+
function ll(e, l) {
|
|
361
|
+
const a = k.value.find((o) => o.value === e);
|
|
362
|
+
a && Ge(a, l);
|
|
364
363
|
}
|
|
365
|
-
async function
|
|
364
|
+
async function tl(e) {
|
|
366
365
|
var l;
|
|
367
|
-
|
|
366
|
+
S("visible-change", e), e && (p.value = "", y.value = "", await _(), (l = P.value) == null || l.inputFocus(), Q(), t.alwaysLoad ? await v() : !t.immediate && !s(W) && await v());
|
|
368
367
|
}
|
|
369
|
-
function
|
|
370
|
-
|
|
368
|
+
function al() {
|
|
369
|
+
te(I);
|
|
371
370
|
}
|
|
372
|
-
function
|
|
373
|
-
|
|
371
|
+
function ol(e) {
|
|
372
|
+
S("change", e, [...s(le)], Qe(e));
|
|
374
373
|
}
|
|
375
|
-
function
|
|
376
|
-
return Array.isArray(e) && Array.isArray(l) ? e.length === l.length && e.every((
|
|
374
|
+
function nl(e, l) {
|
|
375
|
+
return Array.isArray(e) && Array.isArray(l) ? e.length === l.length && e.every((a, o) => a === l[o]) : e === l;
|
|
377
376
|
}
|
|
378
|
-
function
|
|
379
|
-
|
|
380
|
-
const l =
|
|
381
|
-
|
|
377
|
+
function te(e) {
|
|
378
|
+
_(() => {
|
|
379
|
+
const l = s(r);
|
|
380
|
+
nl(l, e) || ol(l);
|
|
382
381
|
});
|
|
383
382
|
}
|
|
384
|
-
function
|
|
385
|
-
const l =
|
|
386
|
-
e(),
|
|
383
|
+
function h(e) {
|
|
384
|
+
const l = s(r), a = Array.isArray(l) ? [...l] : l;
|
|
385
|
+
e(), te(a);
|
|
387
386
|
}
|
|
388
|
-
function
|
|
389
|
-
|
|
390
|
-
|
|
387
|
+
function rl(e) {
|
|
388
|
+
h(() => {
|
|
389
|
+
De(e);
|
|
391
390
|
});
|
|
392
391
|
}
|
|
393
|
-
function
|
|
394
|
-
|
|
395
|
-
|
|
392
|
+
function il(e) {
|
|
393
|
+
h(() => {
|
|
394
|
+
Ue(e);
|
|
396
395
|
});
|
|
397
396
|
}
|
|
398
|
-
function
|
|
399
|
-
|
|
400
|
-
|
|
397
|
+
function sl(e, l) {
|
|
398
|
+
h(() => {
|
|
399
|
+
ll(e, l);
|
|
401
400
|
});
|
|
402
401
|
}
|
|
403
|
-
function
|
|
404
|
-
|
|
402
|
+
function ul(e, l) {
|
|
403
|
+
h(() => {
|
|
405
404
|
Ke(e, l);
|
|
406
405
|
});
|
|
407
406
|
}
|
|
408
|
-
function
|
|
409
|
-
|
|
410
|
-
|
|
407
|
+
function ae(e, l) {
|
|
408
|
+
h(() => {
|
|
409
|
+
We(e, l);
|
|
411
410
|
});
|
|
412
411
|
}
|
|
413
|
-
function
|
|
414
|
-
|
|
415
|
-
|
|
412
|
+
function cl(e) {
|
|
413
|
+
h(() => {
|
|
414
|
+
ze(e);
|
|
416
415
|
});
|
|
417
416
|
}
|
|
418
|
-
function
|
|
419
|
-
|
|
420
|
-
|
|
417
|
+
function dl() {
|
|
418
|
+
h(() => {
|
|
419
|
+
Ie();
|
|
421
420
|
});
|
|
422
421
|
}
|
|
423
|
-
function
|
|
424
|
-
|
|
422
|
+
function pl(e) {
|
|
423
|
+
S("focus", e);
|
|
425
424
|
}
|
|
426
|
-
return
|
|
427
|
-
() =>
|
|
425
|
+
return b(
|
|
426
|
+
() => t.params,
|
|
428
427
|
() => {
|
|
429
|
-
|
|
428
|
+
v();
|
|
430
429
|
},
|
|
431
430
|
{ deep: !0 }
|
|
432
|
-
),
|
|
433
|
-
|
|
431
|
+
), b(
|
|
432
|
+
Ae,
|
|
434
433
|
(e) => {
|
|
435
434
|
var l;
|
|
436
|
-
|
|
435
|
+
E.value !== void 0 || !e.length || (E.value = (l = e[0]) == null ? void 0 : l.value);
|
|
437
436
|
},
|
|
438
437
|
{ immediate: !0 }
|
|
439
438
|
), ml(() => {
|
|
440
|
-
|
|
441
|
-
}),
|
|
439
|
+
t.immediate && v();
|
|
440
|
+
}), de({
|
|
442
441
|
/** 重新加载数据源*/
|
|
443
|
-
reload:
|
|
442
|
+
reload: v,
|
|
444
443
|
/** 获取当前归一化后的树形选项数据 */
|
|
445
|
-
getOptions: () =>
|
|
444
|
+
getOptions: () => s(ye),
|
|
446
445
|
/** 获取当前v-model值 */
|
|
447
|
-
getValue: () =>
|
|
448
|
-
}), (e, l) => (
|
|
446
|
+
getValue: () => s(r)
|
|
447
|
+
}), (e, l) => (w(), R("div", {
|
|
449
448
|
ref_key: "selectWrapRef",
|
|
450
|
-
ref:
|
|
451
|
-
class:
|
|
449
|
+
ref: A,
|
|
450
|
+
class: x(s(d))
|
|
452
451
|
}, [
|
|
453
|
-
|
|
452
|
+
re(s(he), vl({
|
|
454
453
|
ref_key: "selectRef",
|
|
455
|
-
ref:
|
|
456
|
-
modelValue:
|
|
457
|
-
"onUpdate:modelValue": l[0] || (l[0] = (
|
|
458
|
-
},
|
|
459
|
-
multiple:
|
|
454
|
+
ref: q,
|
|
455
|
+
modelValue: Z.value,
|
|
456
|
+
"onUpdate:modelValue": l[0] || (l[0] = (a) => Z.value = a)
|
|
457
|
+
}, s(Me), {
|
|
458
|
+
multiple: c.multiple,
|
|
460
459
|
filterable: !1,
|
|
461
|
-
placeholder:
|
|
460
|
+
placeholder: ke.value,
|
|
462
461
|
persistent: !1,
|
|
463
462
|
"fallback-placements": ["bottom-start", "bottom-end", "bottom", "top-start", "top-end", "top", "right", "left"],
|
|
464
|
-
disabled:
|
|
465
|
-
"popper-class": `${
|
|
466
|
-
onVisibleChange:
|
|
467
|
-
onChange:
|
|
468
|
-
onFocus:
|
|
463
|
+
disabled: c.disabled,
|
|
464
|
+
"popper-class": `${s(d)}__popper vxe-table--ignore-clear`,
|
|
465
|
+
onVisibleChange: tl,
|
|
466
|
+
onChange: al,
|
|
467
|
+
onFocus: pl
|
|
469
468
|
}), {
|
|
470
|
-
label:
|
|
471
|
-
|
|
472
|
-
class:
|
|
469
|
+
label: ie(({ label: a, value: o }) => [
|
|
470
|
+
ue("span", {
|
|
471
|
+
class: x(`${s(d)}__trigger-label`)
|
|
473
472
|
}, [
|
|
474
|
-
|
|
475
|
-
|
|
473
|
+
ue("span", null, yl(a), 1),
|
|
474
|
+
xe(o) ? (w(), R("span", {
|
|
476
475
|
key: 0,
|
|
477
|
-
class:
|
|
478
|
-
}, "删", 2)) :
|
|
476
|
+
class: x(`${s(d)}__deleted-mark`)
|
|
477
|
+
}, "删", 2)) : B("", !0)
|
|
479
478
|
], 2)
|
|
480
479
|
]),
|
|
481
|
-
empty:
|
|
482
|
-
gl((
|
|
480
|
+
empty: ie(() => [
|
|
481
|
+
gl((w(), R("div", {
|
|
483
482
|
"element-loading-text": "加载中",
|
|
484
|
-
class:
|
|
485
|
-
style:
|
|
486
|
-
"--columns":
|
|
487
|
-
"--panel-min-width":
|
|
488
|
-
"--panel-width":
|
|
483
|
+
class: x(`${s(d)}__panel`),
|
|
484
|
+
style: wl({
|
|
485
|
+
"--columns": $e.value,
|
|
486
|
+
"--panel-min-width": Ne.value,
|
|
487
|
+
"--panel-width": $.value ? `${$.value}px` : "100%"
|
|
489
488
|
})
|
|
490
489
|
}, [
|
|
491
|
-
|
|
490
|
+
t.showNav ? (w(), se(Ll, {
|
|
492
491
|
key: 0,
|
|
493
|
-
"prefix-cls":
|
|
494
|
-
keyword:
|
|
495
|
-
"tree-data":
|
|
496
|
-
"expanded-keys":
|
|
497
|
-
"left-placeholder":
|
|
498
|
-
"onUpdate:keyword":
|
|
499
|
-
onSelect:
|
|
500
|
-
}, null, 8, ["prefix-cls", "keyword", "tree-data", "expanded-keys", "left-placeholder"])) :
|
|
501
|
-
|
|
492
|
+
"prefix-cls": s(d),
|
|
493
|
+
keyword: y.value,
|
|
494
|
+
"tree-data": X.value,
|
|
495
|
+
"expanded-keys": Ve.value,
|
|
496
|
+
"left-placeholder": c.leftPlaceholder,
|
|
497
|
+
"onUpdate:keyword": Ze,
|
|
498
|
+
onSelect: Ye
|
|
499
|
+
}, null, 8, ["prefix-cls", "keyword", "tree-data", "expanded-keys", "left-placeholder"])) : B("", !0),
|
|
500
|
+
re(Rl, {
|
|
502
501
|
ref_key: "middleRef",
|
|
503
|
-
ref:
|
|
504
|
-
"allow-create":
|
|
505
|
-
"prefix-cls":
|
|
506
|
-
multiple:
|
|
507
|
-
keyword:
|
|
508
|
-
rows:
|
|
509
|
-
disabled:
|
|
510
|
-
"show-all":
|
|
511
|
-
"option-per-row":
|
|
502
|
+
ref: P,
|
|
503
|
+
"allow-create": t.allowCreate,
|
|
504
|
+
"prefix-cls": s(d),
|
|
505
|
+
multiple: c.multiple,
|
|
506
|
+
keyword: p.value,
|
|
507
|
+
rows: Le.value,
|
|
508
|
+
disabled: z.value,
|
|
509
|
+
"show-all": t.showAll,
|
|
510
|
+
"option-per-row": m,
|
|
512
511
|
"row-height": 40,
|
|
513
|
-
"selected-value-set":
|
|
514
|
-
"is-all-checked":
|
|
515
|
-
"is-indeterminate":
|
|
516
|
-
"all-checked":
|
|
517
|
-
"scroll-to-group-value":
|
|
518
|
-
"group-checked-map":
|
|
519
|
-
"group-indeterminate-map":
|
|
520
|
-
"paste-search":
|
|
521
|
-
separator:
|
|
522
|
-
"middle-placeholder":
|
|
523
|
-
"show-multiple":
|
|
524
|
-
"onUpdate:keyword":
|
|
525
|
-
onAllCheck:
|
|
526
|
-
onCheckAll:
|
|
527
|
-
onGroupCheck:
|
|
528
|
-
onOptionCheck:
|
|
529
|
-
onOptionsCheck:
|
|
530
|
-
onSelectCreatedOptions:
|
|
512
|
+
"selected-value-set": s(Y),
|
|
513
|
+
"is-all-checked": s(Be),
|
|
514
|
+
"is-indeterminate": s(_e),
|
|
515
|
+
"all-checked": qe.value,
|
|
516
|
+
"scroll-to-group-value": F.value,
|
|
517
|
+
"group-checked-map": He.value,
|
|
518
|
+
"group-indeterminate-map": Je.value,
|
|
519
|
+
"paste-search": c.pasteSearch,
|
|
520
|
+
separator: c.separator,
|
|
521
|
+
"middle-placeholder": c.middlePlaceholder,
|
|
522
|
+
"show-multiple": c.showMultiple,
|
|
523
|
+
"onUpdate:keyword": el,
|
|
524
|
+
onAllCheck: rl,
|
|
525
|
+
onCheckAll: il,
|
|
526
|
+
onGroupCheck: sl,
|
|
527
|
+
onOptionCheck: ul,
|
|
528
|
+
onOptionsCheck: ae,
|
|
529
|
+
onSelectCreatedOptions: Pe
|
|
531
530
|
}, null, 8, ["allow-create", "prefix-cls", "multiple", "keyword", "rows", "disabled", "show-all", "selected-value-set", "is-all-checked", "is-indeterminate", "all-checked", "scroll-to-group-value", "group-checked-map", "group-indeterminate-map", "paste-search", "separator", "middle-placeholder", "show-multiple"]),
|
|
532
|
-
|
|
531
|
+
t.multiple ? (w(), se(Bl, {
|
|
533
532
|
key: 1,
|
|
534
|
-
"prefix-cls":
|
|
535
|
-
multiple:
|
|
536
|
-
disabled:
|
|
537
|
-
"selected-options":
|
|
538
|
-
onClearAll:
|
|
539
|
-
onRemove:
|
|
540
|
-
}, null, 8, ["prefix-cls", "multiple", "disabled", "selected-options"])) :
|
|
533
|
+
"prefix-cls": s(d),
|
|
534
|
+
multiple: c.multiple,
|
|
535
|
+
disabled: z.value,
|
|
536
|
+
"selected-options": s(Re),
|
|
537
|
+
onClearAll: dl,
|
|
538
|
+
onRemove: cl
|
|
539
|
+
}, null, 8, ["prefix-cls", "multiple", "disabled", "selected-options"])) : B("", !0)
|
|
541
540
|
], 6)), [
|
|
542
|
-
[
|
|
541
|
+
[s(fe), s(D)]
|
|
543
542
|
])
|
|
544
543
|
]),
|
|
545
544
|
_: 1
|
|
@@ -548,5 +547,5 @@ const g = 4, ct = /* @__PURE__ */ hl({
|
|
|
548
547
|
}
|
|
549
548
|
});
|
|
550
549
|
export {
|
|
551
|
-
|
|
550
|
+
ht as default
|
|
552
551
|
};
|
|
@@ -84,8 +84,15 @@ export interface PanelContainerProps {
|
|
|
84
84
|
/**
|
|
85
85
|
* 主 options 缺码时按 value 补拉(选中态回显)。
|
|
86
86
|
* 由 usePanelSelectSchemas 在 CODE 声明了 fetchMissingOptions 时注入;组件内 watch modelValue 调用。
|
|
87
|
+
* 结果写入全局 panel echo(按 missingEchoKey 隔离),跨实例 / 重挂复用,同缺码在途去重。
|
|
87
88
|
*/
|
|
88
89
|
resolveMissingOptions?: (codes: Array<string | number>) => Promise<PanelSelectOption[]>;
|
|
90
|
+
/**
|
|
91
|
+
* 自定义 resolveMissingOptions 的全局 echo 作用域。
|
|
92
|
+
* 同作用域内按 value 共享缺码回显;不同业务含义请传不同 key。
|
|
93
|
+
* @default '__tt_panel_select__'
|
|
94
|
+
*/
|
|
95
|
+
missingEchoKey?: string;
|
|
89
96
|
/** 树转换与字段映射配置 */
|
|
90
97
|
treeConfig?: PanelSelectTreeConfig;
|
|
91
98
|
/** 是否在组件初始化时立即请求 */
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { BasicDataCode, BasicDataOption } from './basicDataCodes';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* PanelSelect 缺码 echo 节点:差集只扫 value/children。
|
|
4
|
+
* label 可缺省,兼容 `PanelSelectOption`(label?: string)。
|
|
5
|
+
*/
|
|
6
|
+
export type PanelMissingEchoOption = {
|
|
7
|
+
label?: string;
|
|
8
|
+
value?: string | number | null;
|
|
9
|
+
children?: PanelMissingEchoOption[];
|
|
10
|
+
deleted?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
/** PanelSelect 缺码 echo 默认作用域(业务可传 missingEchoKey 隔离) */
|
|
15
|
+
export declare const PANEL_MISSING_ECHO_DEFAULT_SCOPE = "__tt_panel_select__";
|
|
16
|
+
/** 供 dataSource / PanelSelect mergedOptions 订阅;写入 echo 后自增 */
|
|
3
17
|
export declare const missingOptionsEchoVersion: import('vue').Ref<number, number>;
|
|
4
18
|
/**
|
|
5
19
|
* 展开 values:数组项若为拼接串则拆开,去空、去重(保序)。
|
|
@@ -23,5 +37,17 @@ export declare function withMissingOptionDisabled(options: BasicDataOption[] | u
|
|
|
23
37
|
* @returns 本次相关的 echo options(含缓存命中)
|
|
24
38
|
*/
|
|
25
39
|
export declare function ensureMissingOptions(routePath: string, code: BasicDataCode, values: Array<string | number>, mainOptions?: BasicDataOption[]): Promise<BasicDataOption[]>;
|
|
40
|
+
/** 读取 PanelSelect 作用域下已缓存的缺码 options(扁平) */
|
|
41
|
+
export declare function getPanelMissingEchoOptions(scopeKey?: string): PanelMissingEchoOption[];
|
|
42
|
+
/**
|
|
43
|
+
* 自定义 resolveMissingOptions 的差集补拉:全局 echo + 同缺码在途去重。
|
|
44
|
+
* 供 TtPanelSelect watch 调用;不依赖 CODE_REGISTRY。
|
|
45
|
+
* @returns 本次相关的 echo options(含缓存命中)
|
|
46
|
+
*/
|
|
47
|
+
export declare function ensurePanelResolveMissingOptions(scopeKey: string, values: Array<string | number>, mainOptions: PanelMissingEchoOption[] | undefined, fetchMissing: (codes: Array<string | number>) => Promise<PanelMissingEchoOption[]>): Promise<PanelMissingEchoOption[]>;
|
|
48
|
+
/** 仅根据主 options + 全局 panel echo 计算仍缺的码(不做请求) */
|
|
49
|
+
export declare function diffPanelMissingCodes(scopeKey: string, values: Array<string | number>, mainOptions?: PanelMissingEchoOption[]): Array<string | number>;
|
|
26
50
|
/** 清空某路由下全部 echo(可选,供调试 / 路由卸载) */
|
|
27
51
|
export declare function clearMissingOptionsEcho(routePath?: string): void;
|
|
52
|
+
/** 清空 PanelSelect 自定义 resolve 的全局 echo(可选,供调试) */
|
|
53
|
+
export declare function clearPanelMissingEcho(scopeKey?: string): void;
|
|
@@ -1,96 +1,133 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { CODE_REGISTRY as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
return `${r}::${
|
|
1
|
+
import { ref as P } from "vue";
|
|
2
|
+
import { CODE_REGISTRY as k } from "./basicDataCodes.js";
|
|
3
|
+
const A = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), K = "__tt_panel_select__", _ = P(0);
|
|
4
|
+
function E(r, e) {
|
|
5
|
+
return `${r}::${e}`;
|
|
6
6
|
}
|
|
7
7
|
function f(r) {
|
|
8
8
|
return String(r);
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
return (Array.isArray(r) ? r : []).forEach((
|
|
14
|
-
if (!(
|
|
15
|
-
if (typeof
|
|
16
|
-
const s = f(
|
|
10
|
+
const C = /[,,|/]/;
|
|
11
|
+
function R(r = []) {
|
|
12
|
+
const e = [], n = /* @__PURE__ */ new Set();
|
|
13
|
+
return (Array.isArray(r) ? r : []).forEach((o) => {
|
|
14
|
+
if (!(o == null || o === "")) {
|
|
15
|
+
if (typeof o == "number") {
|
|
16
|
+
const s = f(o);
|
|
17
17
|
if (n.has(s)) return;
|
|
18
|
-
n.add(s),
|
|
18
|
+
n.add(s), e.push(o);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
String(
|
|
22
|
-
n.has(s) || (n.add(s),
|
|
21
|
+
String(o).split(C).map((s) => s.trim()).filter(Boolean).forEach((s) => {
|
|
22
|
+
n.has(s) || (n.add(s), e.push(s));
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
}),
|
|
25
|
+
}), e;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
|
|
27
|
+
function O(r = []) {
|
|
28
|
+
const e = /* @__PURE__ */ new Set(), n = (o = []) => {
|
|
29
|
+
o.forEach((s) => {
|
|
30
30
|
var u;
|
|
31
31
|
if ((u = s.children) != null && u.length) {
|
|
32
32
|
n(s.children);
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
s.value !== void 0 && s.value !== null && s.value !== "" &&
|
|
35
|
+
s.value !== void 0 && s.value !== null && s.value !== "" && e.add(f(s.value));
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
|
-
return n(Array.isArray(r) ? r : []),
|
|
38
|
+
return n(Array.isArray(r) ? r : []), e;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
const n =
|
|
42
|
-
let
|
|
43
|
-
return
|
|
40
|
+
function $(r, e) {
|
|
41
|
+
const n = E(r, e);
|
|
42
|
+
let o = A.get(n);
|
|
43
|
+
return o || (o = /* @__PURE__ */ new Map(), A.set(n, o)), o;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
const n =
|
|
45
|
+
function B(r, e) {
|
|
46
|
+
const n = A.get(E(r, e));
|
|
47
47
|
return n ? Array.from(n.values()) : [];
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const
|
|
51
|
-
if (!s.length) return
|
|
52
|
-
const u =
|
|
53
|
-
return
|
|
49
|
+
function x(r, e, n = []) {
|
|
50
|
+
const o = Array.isArray(n) ? n : [], s = B(r, e);
|
|
51
|
+
if (!s.length) return o;
|
|
52
|
+
const u = O(o), a = s.filter((t) => t.value !== void 0 && !u.has(f(t.value)));
|
|
53
|
+
return a.length ? [...o, ...a] : o;
|
|
54
54
|
}
|
|
55
|
-
function V(r = [],
|
|
55
|
+
function V(r = [], e) {
|
|
56
56
|
return !Array.isArray(r) || !r.length ? Array.isArray(r) ? r : [] : r.map((n) => {
|
|
57
|
-
var
|
|
58
|
-
return (
|
|
57
|
+
var o;
|
|
58
|
+
return (o = n == null ? void 0 : n.children) != null && o.length ? { ...n, children: V(n.children, e) } : (n == null ? void 0 : n.deleted) === !0 ? { ...n, disabled: e } : n;
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
const
|
|
63
|
-
return
|
|
64
|
-
const
|
|
65
|
-
u.has(
|
|
61
|
+
function M(r, e, n) {
|
|
62
|
+
const o = O(e), s = [], u = /* @__PURE__ */ new Set();
|
|
63
|
+
return R(r).forEach((a) => {
|
|
64
|
+
const t = f(a);
|
|
65
|
+
u.has(t) || o.has(t) || n.has(t) || (u.add(t), s.push(a));
|
|
66
66
|
}), s;
|
|
67
67
|
}
|
|
68
|
-
async function
|
|
69
|
-
const s =
|
|
68
|
+
async function L(r, e, n, o = []) {
|
|
69
|
+
const s = k[e], u = s == null ? void 0 : s.fetchMissingOptions, a = $(r, e);
|
|
70
70
|
if (!u)
|
|
71
|
-
return Array.from(
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
74
|
-
return Array.from(
|
|
75
|
-
const i = `${
|
|
76
|
-
let
|
|
77
|
-
return
|
|
78
|
-
const
|
|
79
|
-
let
|
|
80
|
-
return
|
|
71
|
+
return Array.from(a.values());
|
|
72
|
+
const t = M(n, o, a);
|
|
73
|
+
if (!t.length)
|
|
74
|
+
return Array.from(a.values());
|
|
75
|
+
const i = `${E(r, e)}::${t.map(f).sort().join(",")}`;
|
|
76
|
+
let h = p.get(i);
|
|
77
|
+
return h || (h = u(t).then((y) => {
|
|
78
|
+
const c = Array.isArray(y) ? y : [];
|
|
79
|
+
let g = !1;
|
|
80
|
+
return c.forEach((l) => {
|
|
81
|
+
if ((l == null ? void 0 : l.value) === void 0 || (l == null ? void 0 : l.value) === null || (l == null ? void 0 : l.value) === "") return;
|
|
82
|
+
const w = f(l.value);
|
|
83
|
+
a.has(w) || (a.set(w, l), g = !0);
|
|
84
|
+
}), g && (_.value += 1), Array.from(a.values());
|
|
85
|
+
}).finally(() => {
|
|
86
|
+
p.get(i) === h && p.delete(i);
|
|
87
|
+
}), p.set(i, h)), h;
|
|
88
|
+
}
|
|
89
|
+
function S(r) {
|
|
90
|
+
const e = r || K;
|
|
91
|
+
let n = v.get(e);
|
|
92
|
+
return n || (n = /* @__PURE__ */ new Map(), v.set(e, n)), n;
|
|
93
|
+
}
|
|
94
|
+
function N(r) {
|
|
95
|
+
const e = v.get(r);
|
|
96
|
+
return e ? Array.from(e.values()) : [];
|
|
97
|
+
}
|
|
98
|
+
async function T(r, e, n = [], o) {
|
|
99
|
+
const s = S(r);
|
|
100
|
+
if (!o)
|
|
101
|
+
return Array.from(s.values());
|
|
102
|
+
const u = M(e, n, s);
|
|
103
|
+
if (!u.length)
|
|
104
|
+
return Array.from(s.values());
|
|
105
|
+
const a = `${r}::${u.map(f).sort().join(",")}`;
|
|
106
|
+
let t = d.get(a);
|
|
107
|
+
return t || (t = Promise.resolve().then(() => o(u)).then((i) => {
|
|
108
|
+
const h = Array.isArray(i) ? i : [];
|
|
109
|
+
let y = !1;
|
|
110
|
+
return h.forEach((c) => {
|
|
81
111
|
if ((c == null ? void 0 : c.value) === void 0 || (c == null ? void 0 : c.value) === null || (c == null ? void 0 : c.value) === "") return;
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
}),
|
|
112
|
+
const g = f(c.value);
|
|
113
|
+
s.has(g) || (s.set(g, c), y = !0);
|
|
114
|
+
}), y && (_.value += 1), Array.from(s.values());
|
|
85
115
|
}).finally(() => {
|
|
86
|
-
|
|
87
|
-
}),
|
|
116
|
+
d.get(a) === t && d.delete(a);
|
|
117
|
+
}), d.set(a, t)), t;
|
|
118
|
+
}
|
|
119
|
+
function j(r, e, n = []) {
|
|
120
|
+
return M(e, n, S(r));
|
|
88
121
|
}
|
|
89
122
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
123
|
+
K as PANEL_MISSING_ECHO_DEFAULT_SCOPE,
|
|
124
|
+
j as diffPanelMissingCodes,
|
|
125
|
+
L as ensureMissingOptions,
|
|
126
|
+
T as ensurePanelResolveMissingOptions,
|
|
127
|
+
R as expandJoinedOptionValues,
|
|
128
|
+
B as getEchoOptions,
|
|
129
|
+
x as getMergedOptions,
|
|
130
|
+
N as getPanelMissingEchoOptions,
|
|
131
|
+
_ as missingOptionsEchoVersion,
|
|
95
132
|
V as withMissingOptionDisabled
|
|
96
133
|
};
|
|
@@ -74,9 +74,7 @@ function oe(r = {}, l = te, c) {
|
|
|
74
74
|
showAll: re
|
|
75
75
|
});
|
|
76
76
|
if (R && !c) {
|
|
77
|
-
const e = String(
|
|
78
|
-
((H = (Z = r.fieldConfigs) == null ? void 0 : Z.purchasePlaceId) == null ? void 0 : H.fieldName) || ee.purchasePlaceId
|
|
79
|
-
);
|
|
77
|
+
const e = String(((H = (Z = r.fieldConfigs) == null ? void 0 : Z.purchasePlaceId) == null ? void 0 : H.fieldName) || ee.purchasePlaceId);
|
|
80
78
|
be(P, G.PURCHASE_PLACE, e);
|
|
81
79
|
}
|
|
82
80
|
const D = R && !c ? Ie(() => {
|
|
@@ -209,7 +207,11 @@ function oe(r = {}, l = te, c) {
|
|
|
209
207
|
};
|
|
210
208
|
}
|
|
211
209
|
function q(e, t, n, o, i) {
|
|
212
|
-
const s = b(e), u = Ee(s.componentProps, t, n, o), f = E(e), {
|
|
210
|
+
const s = b(e), u = Ee(s.componentProps, t, n, o), f = E(e), {
|
|
211
|
+
onChange: a,
|
|
212
|
+
resolveMissingOptions: S,
|
|
213
|
+
...m
|
|
214
|
+
} = u, d = K(s.customOptions) ? s.customOptions(t, o) : o, I = w(e) === "TtPanelSelect", F = I && e === "shopId" ? ie(d) : I && e === "purchasePlaceId" ? se(d) : d, v = I ? X(F) : d, ae = I && e === "purchasePlaceId";
|
|
213
215
|
return I ? {
|
|
214
216
|
multiple: f,
|
|
215
217
|
showAll: s.showAll ?? (e === "shopId" && g === "action" ? V(h(t, p("platformId"))).length > 0 : !0),
|
|
@@ -104,7 +104,11 @@ function He(t, n = {}) {
|
|
|
104
104
|
const A = D(r, e.code);
|
|
105
105
|
let O = w ? se(o[w], A) : A;
|
|
106
106
|
re(e.customOptions) && (O = e.customOptions(o, O) || []);
|
|
107
|
-
const b = q(O), U = ee(e.componentProps, o, u, O), {
|
|
107
|
+
const b = q(O), U = ee(e.componentProps, o, u, O), {
|
|
108
|
+
onChange: Q,
|
|
109
|
+
resolveMissingOptions: E,
|
|
110
|
+
...I
|
|
111
|
+
} = U;
|
|
108
112
|
return {
|
|
109
113
|
multiple: K,
|
|
110
114
|
showAll: ce,
|
|
@@ -183,7 +187,11 @@ function He(t, n = {}) {
|
|
|
183
187
|
rules: o.rules,
|
|
184
188
|
dependencies: I,
|
|
185
189
|
componentProps: (d, x) => {
|
|
186
|
-
const y = D(r, e.code), M = oe(d[h], y, _), ae = q(M), de = ee(o.componentProps, d, x, M), {
|
|
190
|
+
const y = D(r, e.code), M = oe(d[h], y, _), ae = q(M), de = ee(o.componentProps, d, x, M), {
|
|
191
|
+
onChange: Fe,
|
|
192
|
+
resolveMissingOptions: be,
|
|
193
|
+
...me
|
|
194
|
+
} = de;
|
|
187
195
|
return {
|
|
188
196
|
multiple: b,
|
|
189
197
|
showAll: U,
|