@aplus-frontend/ui 7.19.3 → 7.19.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/es/src/ap-field/select/index.vue.mjs +184 -154
- package/es/src/ap-table/hooks/use-table-template-storage.mjs +44 -44
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ap-field/select/index.vue.js +1 -1
- package/lib/src/ap-table/hooks/use-table-template-storage.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Select as
|
|
3
|
-
import { debounce as
|
|
1
|
+
import { defineComponent as Oe, useSlots as Se, ref as N, shallowRef as Fe, computed as s, onMounted as Ve, watch as ke, unref as o, createVNode as v, createElementBlock as T, createBlock as O, openBlock as y, toDisplayString as A, mergeProps as xe, h as Be, createSlots as Ne, withCtx as g, createElementVNode as I, normalizeClass as b, createCommentVNode as R, resolveDynamicComponent as z, withModifiers as Ae, renderList as Ie, renderSlot as _e, normalizeProps as De, guardReactiveProps as Me } from "vue";
|
|
2
|
+
import { Select as Le, Flex as E, Checkbox as U, Spin as Pe } from "@aplus-frontend/antdv";
|
|
3
|
+
import { debounce as qe, isFunction as K, isNil as $, isArray as j, omit as H, isNumber as Te } from "lodash-unified";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
5
5
|
import "../../utils/index.mjs";
|
|
6
|
-
import { useDevWarning as
|
|
6
|
+
import { useDevWarning as Re } from "../../utils/warning.mjs";
|
|
7
7
|
import "../../hooks/index.mjs";
|
|
8
|
-
import { useDefaultPlaceholder as
|
|
9
|
-
import
|
|
10
|
-
import { useSelectOptions as
|
|
11
|
-
import { isDef as
|
|
12
|
-
import { useNamespace as
|
|
13
|
-
import { useLocale as
|
|
14
|
-
import { useControllableValue as
|
|
15
|
-
const
|
|
8
|
+
import { useDefaultPlaceholder as ze } from "../hooks/use-default-placeholder.mjs";
|
|
9
|
+
import Ee from "../style/index.mjs";
|
|
10
|
+
import { useSelectOptions as Ue } from "./use-select-options.mjs";
|
|
11
|
+
import { isDef as _ } from "../../utils/is.mjs";
|
|
12
|
+
import { useNamespace as W } from "../../config-provider/hooks/use-namespace.mjs";
|
|
13
|
+
import { useLocale as Ke } from "../../config-provider/hooks/use-locale.mjs";
|
|
14
|
+
import { useControllableValue as $e } from "../../hooks/useControllableValue.mjs";
|
|
15
|
+
const je = {
|
|
16
16
|
key: 0
|
|
17
|
-
},
|
|
17
|
+
}, He = ["onClick"], st = /* @__PURE__ */ Oe({
|
|
18
18
|
name: "ApFieldSelect",
|
|
19
19
|
__name: "index",
|
|
20
20
|
props: {
|
|
@@ -181,207 +181,237 @@ const qe = {
|
|
|
181
181
|
}
|
|
182
182
|
},
|
|
183
183
|
emits: ["update:value"],
|
|
184
|
-
setup(
|
|
185
|
-
expose:
|
|
186
|
-
emit:
|
|
184
|
+
setup(G, {
|
|
185
|
+
expose: J,
|
|
186
|
+
emit: Q
|
|
187
187
|
}) {
|
|
188
|
-
let
|
|
189
|
-
const
|
|
190
|
-
deprecated:
|
|
191
|
-
} =
|
|
192
|
-
|
|
188
|
+
let i = 0;
|
|
189
|
+
const S = Se(), t = G, {
|
|
190
|
+
deprecated: X
|
|
191
|
+
} = Re("ApFieldSelect");
|
|
192
|
+
X(!_(t.refetchOnFocus), "refetchOnFocus", "fetchOnFocus");
|
|
193
193
|
const {
|
|
194
|
-
b:
|
|
195
|
-
} =
|
|
196
|
-
b:
|
|
197
|
-
} =
|
|
198
|
-
t:
|
|
199
|
-
} =
|
|
200
|
-
if (!
|
|
194
|
+
b: F
|
|
195
|
+
} = W("field-select"), {
|
|
196
|
+
b: f
|
|
197
|
+
} = W("field-select-popup-option"), Y = Ee("field"), D = N(!1), M = N(!1), {
|
|
198
|
+
t: L
|
|
199
|
+
} = Ke(), Z = qe((e) => {
|
|
200
|
+
if (!K(t.request))
|
|
201
201
|
return;
|
|
202
|
-
|
|
203
|
-
const n =
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
i += 1;
|
|
203
|
+
const n = i;
|
|
204
|
+
w([]), r.value = !0, t.request(e).then((l) => {
|
|
205
|
+
i === n && (w(l), r.value = !1);
|
|
206
206
|
});
|
|
207
|
-
},
|
|
208
|
-
const
|
|
209
|
-
return typeof n?.[
|
|
207
|
+
}, t.searchDelay), ee = (e, n) => {
|
|
208
|
+
const l = t.fieldNames?.label || "label";
|
|
209
|
+
return typeof n?.[l] == "string" && n[l].toLowerCase().indexOf(e.toLowerCase()) > -1;
|
|
210
210
|
}, {
|
|
211
|
-
options:
|
|
212
|
-
updateOptions:
|
|
213
|
-
} =
|
|
214
|
-
if (
|
|
215
|
-
return
|
|
211
|
+
options: c,
|
|
212
|
+
updateOptions: w
|
|
213
|
+
} = Ue(t), V = Fe(), r = N(t?.loading || !1), te = Q, ne = s(() => t.fetchOnFocus ?? t.refetchOnFocus), le = s(() => {
|
|
214
|
+
if (t.multiple)
|
|
215
|
+
return t.tokenSeparators ? "tags" : "multiple";
|
|
216
216
|
});
|
|
217
|
-
async function
|
|
218
|
-
if (!
|
|
217
|
+
async function d(e = !0) {
|
|
218
|
+
if (!K(t.request))
|
|
219
219
|
return;
|
|
220
|
-
|
|
221
|
-
const n =
|
|
220
|
+
r.value = !0, i += 1;
|
|
221
|
+
const n = i;
|
|
222
222
|
try {
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
if (n !==
|
|
223
|
+
e && w([]);
|
|
224
|
+
const l = await t.request(void 0, t.params);
|
|
225
|
+
if (n !== i)
|
|
226
226
|
return;
|
|
227
|
-
|
|
227
|
+
w(l);
|
|
228
228
|
} finally {
|
|
229
|
-
|
|
229
|
+
r.value = !1;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
!
|
|
232
|
+
function oe(e) {
|
|
233
|
+
!D.value && i === 0 && t.lazy === "first-focus" ? d() : ne.value && !r.value && d(!0), t.onFocus?.(e), D.value = !0;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
if (!
|
|
237
|
-
|
|
235
|
+
function ae(e) {
|
|
236
|
+
if (!e) {
|
|
237
|
+
t.onDropdownVisibleChange?.(e);
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
|
-
!
|
|
240
|
+
!M.value && i === 0 && t.lazy === "first-open" ? d() : t.fetchOnOpen && !r.value && d(!0), t.onDropdownVisibleChange?.(e), M.value = !0;
|
|
241
241
|
}
|
|
242
|
-
|
|
243
|
-
if (!
|
|
244
|
-
|
|
242
|
+
Ve(() => {
|
|
243
|
+
if (!t.lazy) {
|
|
244
|
+
d();
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
247
|
-
}),
|
|
248
|
-
|
|
247
|
+
}), ke(() => t.params, () => {
|
|
248
|
+
d();
|
|
249
249
|
}, {
|
|
250
250
|
deep: !0
|
|
251
251
|
});
|
|
252
252
|
const {
|
|
253
|
-
value:
|
|
254
|
-
updateValue:
|
|
255
|
-
} =
|
|
256
|
-
const
|
|
257
|
-
if (
|
|
258
|
-
return
|
|
259
|
-
const n =
|
|
260
|
-
return
|
|
261
|
-
}),
|
|
262
|
-
const
|
|
263
|
-
let
|
|
264
|
-
return
|
|
253
|
+
value: p,
|
|
254
|
+
updateValue: k
|
|
255
|
+
} = $e(t, te), ue = ze("Select", t), se = s(() => {
|
|
256
|
+
const e = o(p);
|
|
257
|
+
if ($(e))
|
|
258
|
+
return t.emptyText;
|
|
259
|
+
const n = t.fieldNames?.label || "label", l = t.fieldNames?.value || "value";
|
|
260
|
+
return j(e) ? e.map((a) => o(c).find((h) => h[l] === a)?.[n]).filter(Boolean).join("、") || t.emptyText : o(c).find((a) => a[l] === e)?.[n] || t.emptyText;
|
|
261
|
+
}), re = s(() => {
|
|
262
|
+
const e = !!t?.showSearch, n = t.searchMode;
|
|
263
|
+
let l = {};
|
|
264
|
+
return e && (l = n === "request" ? {
|
|
265
265
|
defaultActiveFirstOption: !1,
|
|
266
|
-
onSearch:
|
|
267
|
-
notFoundContent:
|
|
266
|
+
onSearch: Z,
|
|
267
|
+
notFoundContent: r.value ? void 0 : null,
|
|
268
268
|
filterOption: !1,
|
|
269
269
|
suffixIcon: null
|
|
270
270
|
} : {
|
|
271
|
-
filterOption:
|
|
271
|
+
filterOption: $(t?.filterOption) ? ee : t?.filterOption
|
|
272
272
|
}), {
|
|
273
|
-
...
|
|
274
|
-
placeholder:
|
|
275
|
-
...
|
|
273
|
+
...H(t, ["mode", "value", "onUpdate:value", "onSearch", "request", "searchMode", "onFocus", "onBeforeSelect", "onDropdownVisibleChange"]),
|
|
274
|
+
placeholder: o(ue),
|
|
275
|
+
...l
|
|
276
276
|
};
|
|
277
|
-
}),
|
|
278
|
-
function
|
|
279
|
-
|
|
277
|
+
}), ie = s(() => c.value.map((e) => e[t.fieldNames?.value || "value"])), x = s(() => c.value.filter((e) => !e.disabled).map((e) => e[t.fieldNames?.value || "value"])), P = s(() => !t.multiple || _(t.maxCount) ? !1 : Te(t.addAll) ? ie.value.length >= t.addAll : !!t.addAll), ce = s(() => t.multiple && t.allowOnlySelect && (!_(t.maxCount) || t.maxCount >= 1));
|
|
278
|
+
function de() {
|
|
279
|
+
V.value?.focus();
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
|
|
281
|
+
function fe() {
|
|
282
|
+
V.value?.blur();
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
const
|
|
286
|
-
return
|
|
284
|
+
function m(e, n) {
|
|
285
|
+
const l = t.fieldNames?.[n] ?? n;
|
|
286
|
+
return l === "groupLabel" ? e[l] ?? e.label : e[l];
|
|
287
287
|
}
|
|
288
|
-
function
|
|
289
|
-
const n =
|
|
290
|
-
|
|
288
|
+
function pe(e) {
|
|
289
|
+
const n = q(e);
|
|
290
|
+
k(t.multiple ? [n] : n), t.onChange?.([n], [e]);
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
return
|
|
294
|
-
class:
|
|
295
|
-
}, [
|
|
296
|
-
class:
|
|
297
|
-
}, [
|
|
292
|
+
function me(e) {
|
|
293
|
+
return S.option ? v("div", {
|
|
294
|
+
class: f("custom")
|
|
295
|
+
}, [S.option(e)]) : v("span", {
|
|
296
|
+
class: f("label")
|
|
297
|
+
}, [m(e, e.options?.length ? "groupLabel" : "label")]);
|
|
298
298
|
}
|
|
299
|
-
const
|
|
300
|
-
const
|
|
301
|
-
return n.length > 0 && n.every((
|
|
302
|
-
}),
|
|
303
|
-
const
|
|
304
|
-
return
|
|
299
|
+
const he = s(() => {
|
|
300
|
+
const e = o(p) || [], n = x.value;
|
|
301
|
+
return n.length > 0 && n.every((l) => C(e, l));
|
|
302
|
+
}), ve = s(() => {
|
|
303
|
+
const e = o(p) || [], n = x.value, l = n.filter((u) => C(e, u)).length;
|
|
304
|
+
return l > 0 && l < n.length;
|
|
305
305
|
});
|
|
306
|
-
function
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
306
|
+
function B(e, n) {
|
|
307
|
+
return (e.value ?? e) === n;
|
|
308
|
+
}
|
|
309
|
+
const ye = (e) => {
|
|
310
|
+
const n = o(p), l = m(e, "value");
|
|
311
|
+
return j(n) ? !!n.find((u) => B(u, l)) : !1;
|
|
312
|
+
};
|
|
313
|
+
function C(e, n) {
|
|
314
|
+
return e.find((l) => B(l, n)) != null;
|
|
315
|
+
}
|
|
316
|
+
function ge(e, n) {
|
|
317
|
+
return e.findIndex((l) => B(l, n));
|
|
318
|
+
}
|
|
319
|
+
function q(e, n) {
|
|
320
|
+
const l = m(e, "label"), u = n ?? m(e, "value");
|
|
321
|
+
return t.labelInValue ? {
|
|
322
|
+
label: typeof l == "function" ? l() : l,
|
|
323
|
+
originLabel: l,
|
|
324
|
+
value: u,
|
|
325
|
+
key: e?.key ?? u
|
|
326
|
+
} : u;
|
|
327
|
+
}
|
|
328
|
+
function be() {
|
|
329
|
+
const e = [...o(p) || []], n = x.value;
|
|
330
|
+
n.length > 0 && n.every((a) => C(e, a)) ? n.forEach((a) => {
|
|
331
|
+
const h = ge(e, a);
|
|
332
|
+
~h && e.splice(h, 1);
|
|
333
|
+
}) : n.forEach((a) => {
|
|
334
|
+
if (C(e, a))
|
|
335
|
+
return;
|
|
336
|
+
const h = c.value.find((we) => m(we, "value") === a), Ce = q(h, a);
|
|
337
|
+
e.push(Ce);
|
|
338
|
+
});
|
|
339
|
+
const u = c.value.filter((a) => C(e, m(a, "value")));
|
|
340
|
+
k([...e]), t.onChange?.([...e], u);
|
|
311
341
|
}
|
|
312
|
-
return
|
|
313
|
-
focus:
|
|
314
|
-
blur:
|
|
315
|
-
request:
|
|
316
|
-
}), (
|
|
342
|
+
return J({
|
|
343
|
+
focus: de,
|
|
344
|
+
blur: fe,
|
|
345
|
+
request: d
|
|
346
|
+
}), (e, n) => e.mode === "read" ? (y(), T("span", je, A(se.value), 1)) : (y(), O(o(Le), xe({
|
|
317
347
|
key: 1,
|
|
318
348
|
ref_key: "selectRef",
|
|
319
|
-
ref:
|
|
349
|
+
ref: V,
|
|
320
350
|
"allow-clear": ""
|
|
321
|
-
},
|
|
322
|
-
mode:
|
|
323
|
-
value:
|
|
324
|
-
options:
|
|
325
|
-
loading:
|
|
326
|
-
"menu-item-selected-icon":
|
|
327
|
-
"popup-class-name": `${
|
|
328
|
-
"onUpdate:value":
|
|
329
|
-
onFocus:
|
|
330
|
-
onDropdownVisibleChange:
|
|
331
|
-
}),
|
|
332
|
-
option:
|
|
333
|
-
class:
|
|
334
|
-
}, [
|
|
351
|
+
}, re.value, {
|
|
352
|
+
mode: le.value,
|
|
353
|
+
value: o(p),
|
|
354
|
+
options: o(c),
|
|
355
|
+
loading: r.value,
|
|
356
|
+
"menu-item-selected-icon": Be("span"),
|
|
357
|
+
"popup-class-name": `${o(F)("popup")} ${o(Y)}`,
|
|
358
|
+
"onUpdate:value": o(k),
|
|
359
|
+
onFocus: oe,
|
|
360
|
+
onDropdownVisibleChange: ae
|
|
361
|
+
}), Ne({
|
|
362
|
+
option: g((l) => [I("div", {
|
|
363
|
+
class: b(o(f)("outter"))
|
|
364
|
+
}, [v(o(E), {
|
|
335
365
|
justify: "space-between",
|
|
336
366
|
align: "center",
|
|
337
|
-
class:
|
|
367
|
+
class: b(o(f)("wrapper")),
|
|
338
368
|
gap: 8
|
|
339
369
|
}, {
|
|
340
|
-
default:
|
|
370
|
+
default: g(() => [v(o(E), {
|
|
341
371
|
gap: 8,
|
|
342
372
|
align: "center",
|
|
343
|
-
class:
|
|
373
|
+
class: b(o(f)("content-wrapper"))
|
|
344
374
|
}, {
|
|
345
|
-
default:
|
|
375
|
+
default: g(() => [P.value ? (y(), O(o(U), {
|
|
346
376
|
key: 0,
|
|
347
|
-
checked: l
|
|
348
|
-
}, null, 8, ["checked"])) :
|
|
377
|
+
checked: ye(l)
|
|
378
|
+
}, null, 8, ["checked"])) : R("", !0), (y(), O(z(me(l))))]),
|
|
349
379
|
_: 2
|
|
350
|
-
}, 1032, ["class"]),
|
|
380
|
+
}, 1032, ["class"]), ce.value && !l?.disabled ? (y(), T("span", {
|
|
351
381
|
key: 0,
|
|
352
|
-
class:
|
|
353
|
-
onClick:
|
|
354
|
-
},
|
|
382
|
+
class: b(o(f)("action")),
|
|
383
|
+
onClick: Ae(() => pe(l), ["stop"])
|
|
384
|
+
}, A(o(L)("ap.field.chooseOnly")), 11, He)) : R("", !0)]),
|
|
355
385
|
_: 2
|
|
356
386
|
}, 1032, ["class"])], 2)]),
|
|
357
387
|
_: 2
|
|
358
|
-
}, [
|
|
359
|
-
name:
|
|
360
|
-
fn:
|
|
361
|
-
})),
|
|
388
|
+
}, [Ie(o(H)(S, ["option"]), (l, u) => ({
|
|
389
|
+
name: u,
|
|
390
|
+
fn: g((a) => [_e(e.$slots, u, De(Me(a || {})))])
|
|
391
|
+
})), r.value ? {
|
|
362
392
|
name: "notFoundContent",
|
|
363
|
-
fn:
|
|
393
|
+
fn: g(() => [v(o(Pe), {
|
|
364
394
|
size: "small"
|
|
365
395
|
})]),
|
|
366
396
|
key: "0"
|
|
367
|
-
} : void 0,
|
|
397
|
+
} : void 0, P.value ? {
|
|
368
398
|
name: "dropdownRender",
|
|
369
|
-
fn:
|
|
370
|
-
menuNode:
|
|
371
|
-
}) => [
|
|
399
|
+
fn: g(({
|
|
400
|
+
menuNode: l
|
|
401
|
+
}) => [I("div", {
|
|
372
402
|
tabindex: -1,
|
|
373
|
-
class:
|
|
374
|
-
onClick:
|
|
375
|
-
}, [
|
|
376
|
-
checked:
|
|
377
|
-
indeterminate:
|
|
378
|
-
}, null, 8, ["checked", "indeterminate"]),
|
|
379
|
-
class:
|
|
380
|
-
},
|
|
403
|
+
class: b(o(F)("popup-all-option")),
|
|
404
|
+
onClick: be
|
|
405
|
+
}, [v(o(U), {
|
|
406
|
+
checked: he.value,
|
|
407
|
+
indeterminate: ve.value
|
|
408
|
+
}, null, 8, ["checked", "indeterminate"]), I("span", {
|
|
409
|
+
class: b(o(F)("popup-all-option-label"))
|
|
410
|
+
}, A(o(L)("ap.field.selectAll")), 3)], 2), (y(), O(z(l)))]),
|
|
381
411
|
key: "1"
|
|
382
412
|
} : void 0]), 1040, ["mode", "value", "options", "loading", "menu-item-selected-icon", "popup-class-name", "onUpdate:value"]));
|
|
383
413
|
}
|
|
384
414
|
});
|
|
385
415
|
export {
|
|
386
|
-
|
|
416
|
+
st as default
|
|
387
417
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useToken as
|
|
2
|
-
import { isBoolean as
|
|
3
|
-
import { ref as k, watch as
|
|
1
|
+
import { useToken as P } from "@aplus-frontend/antdv/es/theme/internal";
|
|
2
|
+
import { isBoolean as R, isNumber as b, isObject as y, mergeWith as E, omit as U, isString as W } from "lodash-unified";
|
|
3
|
+
import { ref as k, watch as s, unref as v } from "vue";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
5
5
|
import { randomStr as N } from "../../utils/index.mjs";
|
|
6
|
-
import { getColumnStateString as
|
|
7
|
-
import { useInjectApTable as
|
|
8
|
-
import { getTableTitle as
|
|
9
|
-
import { useLocale as
|
|
10
|
-
import { useNamespace as
|
|
11
|
-
function
|
|
12
|
-
return a ? a.fixed : e ? e.fixed : o && "fixed" in o ? o.fixed :
|
|
6
|
+
import { getColumnStateString as X } from "../components/setting/utils.mjs";
|
|
7
|
+
import { useInjectApTable as q } from "../context.mjs";
|
|
8
|
+
import { getTableTitle as D } from "../utils.mjs";
|
|
9
|
+
import { useLocale as H } from "../../config-provider/hooks/use-locale.mjs";
|
|
10
|
+
import { useNamespace as Q } from "../../config-provider/hooks/use-namespace.mjs";
|
|
11
|
+
function V(r, e, o, a) {
|
|
12
|
+
return a ? a.fixed : e ? e.fixed : o && "fixed" in o ? o.fixed : R(r.fixed) ? r.fixed ? "left" : void 0 : r.fixed;
|
|
13
13
|
}
|
|
14
14
|
const A = Number.MAX_SAFE_INTEGER, I = N();
|
|
15
|
-
function
|
|
15
|
+
function Y(r, e) {
|
|
16
16
|
const o = b(r.order) ? r.order : A;
|
|
17
17
|
let a = b(e.order) ? e.order : A;
|
|
18
18
|
return r.fixed === "right" && e.fixed !== "right" && (a = o - 1), e.fixed === "left" && r.fixed !== "left" && (a = o - 1), o - a;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function Z(r, e) {
|
|
21
21
|
e && r.removeItem(e);
|
|
22
22
|
}
|
|
23
23
|
function z(r, e) {
|
|
@@ -27,16 +27,16 @@ function z(r, e) {
|
|
|
27
27
|
if (!o)
|
|
28
28
|
return [];
|
|
29
29
|
const a = JSON.parse(o);
|
|
30
|
-
return Array.isArray(a) ? a : (
|
|
30
|
+
return Array.isArray(a) ? a : (Z(r, e), []);
|
|
31
31
|
}
|
|
32
32
|
function _(r, e) {
|
|
33
33
|
if (y(r) && y(e))
|
|
34
34
|
return E({}, r, e, _);
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
const { columnsBackup: a, size:
|
|
36
|
+
const fe = (r, e, o) => {
|
|
37
|
+
const { columnsBackup: a, size: m } = q(), { t: L } = H(), { be: O } = Q("ap-table"), [$, B] = P(), c = k(), n = k([]);
|
|
38
38
|
let g;
|
|
39
|
-
g =
|
|
39
|
+
g = s(
|
|
40
40
|
() => a?.value,
|
|
41
41
|
(t, i) => {
|
|
42
42
|
t?.length && !i?.length && (n.value = T(
|
|
@@ -46,35 +46,35 @@ const ue = (r, e, o) => {
|
|
|
46
46
|
{
|
|
47
47
|
immediate: !0
|
|
48
48
|
}
|
|
49
|
-
),
|
|
50
|
-
[a,
|
|
49
|
+
), s(
|
|
50
|
+
[a, m],
|
|
51
51
|
([t, i]) => {
|
|
52
|
-
t && (
|
|
52
|
+
t && (c.value = {
|
|
53
53
|
label: "basic_template",
|
|
54
|
-
columnState:
|
|
54
|
+
columnState: d(t),
|
|
55
55
|
key: I,
|
|
56
56
|
size: i
|
|
57
57
|
});
|
|
58
58
|
},
|
|
59
59
|
{ immediate: !0, deep: !0 }
|
|
60
|
-
),
|
|
60
|
+
), s(
|
|
61
61
|
() => e.value,
|
|
62
62
|
(t) => {
|
|
63
63
|
const i = T(
|
|
64
64
|
z(localStorage, t)
|
|
65
65
|
);
|
|
66
|
-
n.value = i,
|
|
66
|
+
n.value = i, c.value = {
|
|
67
67
|
label: "basic_template",
|
|
68
|
-
columnState:
|
|
68
|
+
columnState: d(a?.value || []),
|
|
69
69
|
key: I,
|
|
70
|
-
size:
|
|
70
|
+
size: m?.value
|
|
71
71
|
}, o(i ?? []);
|
|
72
72
|
}
|
|
73
73
|
);
|
|
74
74
|
function T(t) {
|
|
75
75
|
return t.length ? t.map((i) => ({
|
|
76
76
|
...i,
|
|
77
|
-
columnState:
|
|
77
|
+
columnState: d(
|
|
78
78
|
a.value,
|
|
79
79
|
i.columnState,
|
|
80
80
|
!1
|
|
@@ -83,52 +83,52 @@ const ue = (r, e, o) => {
|
|
|
83
83
|
{
|
|
84
84
|
label: L("ap.apTable.setting.defaultTemplate"),
|
|
85
85
|
key: r.getActiveKey?.("DEFAULT_TEMPLATE") ?? N(),
|
|
86
|
-
size:
|
|
87
|
-
columnState:
|
|
86
|
+
size: m?.value,
|
|
87
|
+
columnState: d(a?.value || [])
|
|
88
88
|
}
|
|
89
89
|
];
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
91
|
+
function d(t, i = {}, l = !0) {
|
|
92
|
+
const p = E(
|
|
93
93
|
{},
|
|
94
94
|
l ? r.defaultValue || {} : {},
|
|
95
95
|
i,
|
|
96
96
|
_
|
|
97
97
|
);
|
|
98
98
|
function h(M, j, C) {
|
|
99
|
-
return M.map((u) => {
|
|
100
|
-
const S = j?.[u.key] || {},
|
|
99
|
+
return M.map((u, G) => {
|
|
100
|
+
const S = j?.[u.key] || {}, f = {
|
|
101
101
|
key: u.key,
|
|
102
|
-
label:
|
|
102
|
+
label: W(u.title) ? D(
|
|
103
103
|
u,
|
|
104
104
|
O("table-header", "title"),
|
|
105
105
|
void 0,
|
|
106
106
|
B.value.colorTextTertiary
|
|
107
107
|
) : u.title,
|
|
108
108
|
show: !0,
|
|
109
|
-
fixed:
|
|
109
|
+
fixed: V(
|
|
110
110
|
u,
|
|
111
111
|
i[u.key],
|
|
112
112
|
l ? r.defaultValue?.[u.key] : void 0,
|
|
113
113
|
C
|
|
114
114
|
),
|
|
115
115
|
disabled: !1,
|
|
116
|
-
...
|
|
116
|
+
...U(S, ["children", "fixed"])
|
|
117
117
|
};
|
|
118
|
-
return
|
|
118
|
+
return f.children = u.children?.length ? h(
|
|
119
119
|
u.children,
|
|
120
120
|
S.children,
|
|
121
|
-
|
|
122
|
-
) : void 0,
|
|
123
|
-
}).sort(
|
|
121
|
+
f
|
|
122
|
+
) : void 0, f.order = f.order ?? G, f;
|
|
123
|
+
}).sort(Y);
|
|
124
124
|
}
|
|
125
|
-
return h(t || [],
|
|
125
|
+
return h(t || [], p);
|
|
126
126
|
}
|
|
127
127
|
function x(t) {
|
|
128
128
|
if (v(e)) {
|
|
129
129
|
const i = t.map((l) => ({
|
|
130
130
|
...l,
|
|
131
|
-
columnState:
|
|
131
|
+
columnState: X(l.columnState)
|
|
132
132
|
}));
|
|
133
133
|
localStorage.setItem(v(e), JSON.stringify(i));
|
|
134
134
|
}
|
|
@@ -144,21 +144,21 @@ const ue = (r, e, o) => {
|
|
|
144
144
|
}
|
|
145
145
|
function J(t, i) {
|
|
146
146
|
const l = n.value.findIndex(
|
|
147
|
-
(
|
|
147
|
+
(p) => p.key === t
|
|
148
148
|
);
|
|
149
149
|
return n.value[l] = {
|
|
150
150
|
...n.value[l],
|
|
151
151
|
...i
|
|
152
152
|
}, n.value[l];
|
|
153
153
|
}
|
|
154
|
-
return
|
|
154
|
+
return s(
|
|
155
155
|
() => n.value,
|
|
156
156
|
(t) => {
|
|
157
157
|
t.length && x(t);
|
|
158
158
|
},
|
|
159
159
|
{ deep: !0, immediate: !0 }
|
|
160
160
|
), {
|
|
161
|
-
basicTemplate:
|
|
161
|
+
basicTemplate: c,
|
|
162
162
|
customizeTemplateList: n,
|
|
163
163
|
syncTemplateListToStorage: x,
|
|
164
164
|
addTemplate: F,
|
|
@@ -167,5 +167,5 @@ const ue = (r, e, o) => {
|
|
|
167
167
|
};
|
|
168
168
|
};
|
|
169
169
|
export {
|
|
170
|
-
|
|
170
|
+
fe as useTableTemplateStorage
|
|
171
171
|
};
|
package/es/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.19.
|
|
1
|
+
declare const _default: "7.19.4";
|
|
2
2
|
export default _default;
|
package/es/src/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),v=require("@aplus-frontend/antdv"),r=require("lodash-unified");require("../../config-provider/index.js");require("../../utils/index.js");const ue=require("../../utils/warning.js");require("../../hooks/index.js");const re=require("../hooks/use-default-placeholder.js"),se=require("../style/index.js"),ce=require("./use-select-options.js"),x=require("../../utils/is.js"),A=require("../../config-provider/hooks/use-namespace.js"),ie=require("../../config-provider/hooks/use-locale.js"),de=require("../../hooks/useControllableValue.js"),fe={key:0},pe=["onClick"],me=e.defineComponent({name:"ApFieldSelect",__name:"index",props:{mode:{default:"edit"},class:{},style:{},emptyText:{default:"--"},customReadMode:{},defaultValue:{},notFoundContent:{},suffixIcon:{},itemIcon:{},size:{},bordered:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:void 0},variant:{},maxCount:{},transitionName:{},choiceTransitionName:{},popupClassName:{},dropdownClassName:{},placement:{},status:{},children:{},listHeight:{},onMouseenter:{},onMouseleave:{},tabindex:{},onClick:{},onFocus:{},onBlur:{},onChange:{},onKeydown:{},onKeyup:{},onMousedown:{},onSelect:{},open:{type:Boolean,default:void 0},animation:{},direction:{},disabled:{type:Boolean,default:void 0},prefixCls:{},id:{},autofocus:{type:Boolean,default:void 0},getPopupContainer:{},virtual:{type:Boolean,default:void 0},dropdownMatchSelectWidth:{},placeholder:{},loading:{type:Boolean,default:void 0},prefix:{},clearIcon:{},allowClear:{type:Boolean,default:!0},fieldNames:{},inputValue:{},searchValue:{},autoClearSearchValue:{type:Boolean,default:void 0},onDeselect:{},onActive:{},filterOption:{},filterSort:{},optionFilterProp:{},optionLabelProp:{},options:{},defaultActiveFirstOption:{type:Boolean,default:void 0},listItemHeight:{},onClickOption:{},menuItemSelectedIcon:{},labelInValue:{type:Boolean,default:void 0},showSearch:{type:Boolean,default:void 0},tagRender:{},optionLabelRender:{},onClear:{},defaultOpen:{type:Boolean,default:void 0},onDropdownVisibleChange:{},maxTagTextLength:{},maxTagCount:{},maxTagPlaceholder:{},tokenSeparators:{},removeIcon:{},dropdownStyle:{},dropdownRender:{},dropdownAlign:{},showAction:{},onPopupScroll:{},onInputKeyDown:{},request:{},multiple:{type:Boolean,default:void 0},value:{},"onUpdate:value":{},searchMode:{default:"filter"},refetchOnFocus:{type:Boolean,default:!1},fetchOnFocus:{type:Boolean,default:void 0},fetchOnOpen:{type:Boolean},lazy:{type:[Boolean,String],default:!1},addAll:{type:[Boolean,Number],default:5},params:{},searchDelay:{default:300},allowOnlySelect:{type:Boolean,default:!0}},emits:["update:value"],setup(D,{expose:I,emit:_}){let c=0;const C=e.useSlots(),t=D,{deprecated:M}=ue.useDevWarning("ApFieldSelect");M(!x.isDef(t.refetchOnFocus),"refetchOnFocus","fetchOnFocus");const{b}=A.useNamespace("field-select"),{b:f}=A.useNamespace("field-select-popup-option"),z=se.default("field"),B=e.ref(!1),N=e.ref(!1),{t:O}=ie.useLocale(),P=r.debounce(n=>{if(!r.isFunction(t.request))return;c+=1;const l=c;g([]),s.value=!0,t.request(n).then(o=>{c===l&&(g(o),s.value=!1)})},t.searchDelay),L=(n,l)=>{const o=t.fieldNames?.label||"label";return typeof l?.[o]=="string"&&l[o].toLowerCase().indexOf(n.toLowerCase())>-1},{options:i,updateOptions:g}=ce.useSelectOptions(t),w=e.shallowRef(),s=e.ref(t?.loading||!1),T=_,R=e.computed(()=>t.fetchOnFocus??t.refetchOnFocus),E=e.computed(()=>{if(t.multiple)return t.tokenSeparators?"tags":"multiple"});async function d(n=!0){if(!r.isFunction(t.request))return;s.value=!0,c+=1;const l=c;try{n&&g([]);const o=await t.request(void 0,t.params);if(l!==c)return;g(o)}finally{s.value=!1}}function U(n){!B.value&&c===0&&t.lazy==="first-focus"?d():R.value&&!s.value&&d(!0),t.onFocus?.(n),B.value=!0}function j(n){if(!n){t.onDropdownVisibleChange?.(n);return}!N.value&&c===0&&t.lazy==="first-open"?d():t.fetchOnOpen&&!s.value&&d(!0),t.onDropdownVisibleChange?.(n),N.value=!0}e.onMounted(()=>{if(!t.lazy){d();return}}),e.watch(()=>t.params,()=>{d()},{deep:!0});const{value:p,updateValue:k}=de.useControllableValue(t,T),K=re.useDefaultPlaceholder("Select",t),$=e.computed(()=>{const n=e.unref(p);if(r.isNil(n))return t.emptyText;const l=t.fieldNames?.label||"label",o=t.fieldNames?.value||"value";return r.isArray(n)?n.map(a=>e.unref(i).find(h=>h[o]===a)?.[l]).filter(Boolean).join("、")||t.emptyText:e.unref(i).find(a=>a[o]===n)?.[l]||t.emptyText}),H=e.computed(()=>{const n=!!t?.showSearch,l=t.searchMode;let o={};return n&&(o=l==="request"?{defaultActiveFirstOption:!1,onSearch:P,notFoundContent:s.value?void 0:null,filterOption:!1,suffixIcon:null}:{filterOption:r.isNil(t?.filterOption)?L:t?.filterOption}),{...r.omit(t,["mode","value","onUpdate:value","onSearch","request","searchMode","onFocus","onBeforeSelect","onDropdownVisibleChange"]),placeholder:e.unref(K),...o}}),W=e.computed(()=>i.value.map(n=>n[t.fieldNames?.value||"value"])),V=e.computed(()=>i.value.filter(n=>!n.disabled).map(n=>n[t.fieldNames?.value||"value"])),F=e.computed(()=>!t.multiple||x.isDef(t.maxCount)?!1:r.isNumber(t.addAll)?W.value.length>=t.addAll:!!t.addAll),G=e.computed(()=>t.multiple&&t.allowOnlySelect&&(!x.isDef(t.maxCount)||t.maxCount>=1));function J(){w.value?.focus()}function Q(){w.value?.blur()}function m(n,l){const o=t.fieldNames?.[l]??l;return o==="groupLabel"?n[o]??n.label:n[o]}function X(n){const l=q(n);k(t.multiple?[l]:l),t.onChange?.([l],[n])}function Y(n){return C.option?e.createVNode("div",{class:f("custom")},[C.option(n)]):e.createVNode("span",{class:f("label")},[m(n,n.options?.length?"groupLabel":"label")])}const Z=e.computed(()=>{const n=e.unref(p)||[],l=V.value;return l.length>0&&l.every(o=>y(n,o))}),ee=e.computed(()=>{const n=e.unref(p)||[],l=V.value,o=l.filter(u=>y(n,u)).length;return o>0&&o<l.length});function S(n,l){return(n.value??n)===l}const ne=n=>{const l=e.unref(p),o=m(n,"value");return r.isArray(l)?!!l.find(u=>S(u,o)):!1};function y(n,l){return n.find(o=>S(o,l))!=null}function te(n,l){return n.findIndex(o=>S(o,l))}function q(n,l){const o=m(n,"label"),u=l??m(n,"value");return t.labelInValue?{label:typeof o=="function"?o():o,originLabel:o,value:u,key:n?.key??u}:u}function le(){const n=[...e.unref(p)||[]],l=V.value;l.length>0&&l.every(a=>y(n,a))?l.forEach(a=>{const h=te(n,a);~h&&n.splice(h,1)}):l.forEach(a=>{if(y(n,a))return;const h=i.value.find(ae=>m(ae,"value")===a),oe=q(h,a);n.push(oe)});const u=i.value.filter(a=>y(n,m(a,"value")));k([...n]),t.onChange?.([...n],u)}return I({focus:J,blur:Q,request:d}),(n,l)=>n.mode==="read"?(e.openBlock(),e.createElementBlock("span",fe,e.toDisplayString($.value),1)):(e.openBlock(),e.createBlock(e.unref(v.Select),e.mergeProps({key:1,ref_key:"selectRef",ref:w,"allow-clear":""},H.value,{mode:E.value,value:e.unref(p),options:e.unref(i),loading:s.value,"menu-item-selected-icon":e.h("span"),"popup-class-name":`${e.unref(b)("popup")} ${e.unref(z)}`,"onUpdate:value":e.unref(k),onFocus:U,onDropdownVisibleChange:j}),e.createSlots({option:e.withCtx(o=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(f)("outter"))},[e.createVNode(e.unref(v.Flex),{justify:"space-between",align:"center",class:e.normalizeClass(e.unref(f)("wrapper")),gap:8},{default:e.withCtx(()=>[e.createVNode(e.unref(v.Flex),{gap:8,align:"center",class:e.normalizeClass(e.unref(f)("content-wrapper"))},{default:e.withCtx(()=>[F.value?(e.openBlock(),e.createBlock(e.unref(v.Checkbox),{key:0,checked:ne(o)},null,8,["checked"])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(Y(o))))]),_:2},1032,["class"]),G.value&&!o?.disabled?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(f)("action")),onClick:e.withModifiers(()=>X(o),["stop"])},e.toDisplayString(e.unref(O)("ap.field.chooseOnly")),11,pe)):e.createCommentVNode("",!0)]),_:2},1032,["class"])],2)]),_:2},[e.renderList(e.unref(r.omit)(C,["option"]),(o,u)=>({name:u,fn:e.withCtx(a=>[e.renderSlot(n.$slots,u,e.normalizeProps(e.guardReactiveProps(a||{})))])})),s.value?{name:"notFoundContent",fn:e.withCtx(()=>[e.createVNode(e.unref(v.Spin),{size:"small"})]),key:"0"}:void 0,F.value?{name:"dropdownRender",fn:e.withCtx(({menuNode:o})=>[e.createElementVNode("div",{tabindex:-1,class:e.normalizeClass(e.unref(b)("popup-all-option")),onClick:le},[e.createVNode(e.unref(v.Checkbox),{checked:Z.value,indeterminate:ee.value},null,8,["checked","indeterminate"]),e.createElementVNode("span",{class:e.normalizeClass(e.unref(b)("popup-all-option-label"))},e.toDisplayString(e.unref(O)("ap.field.selectAll")),3)],2),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o)))]),key:"1"}:void 0]),1040,["mode","value","options","loading","menu-item-selected-icon","popup-class-name","onUpdate:value"]))}});exports.default=me;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("@aplus-frontend/antdv/es/theme/internal"),c=require("lodash-unified"),s=require("vue");require("../../config-provider/index.js");const q=require("../../utils/index.js"),M=require("../components/setting/utils.js"),J=require("../context.js"),P=require("../utils.js"),U=require("../../config-provider/hooks/use-locale.js"),W=require("../../config-provider/hooks/use-namespace.js");function C(r,e,n,a){return a?a.fixed:e?e.fixed:n&&"fixed"in n?n.fixed:c.isBoolean(r.fixed)?r.fixed?"left":void 0:r.fixed}const b=Number.MAX_SAFE_INTEGER,y=q.randomStr();function G(r,e){const n=c.isNumber(r.order)?r.order:b;let a=c.isNumber(e.order)?e.order:b;return r.fixed==="right"&&e.fixed!=="right"&&(a=n-1),e.fixed==="left"&&r.fixed!=="left"&&(a=n-1),n-a}function R(r,e){e&&r.removeItem(e)}function k(r,e){if(!e)return[];const n=r.getItem(e);if(!n)return[];const a=JSON.parse(n);return Array.isArray(a)?a:(R(r,e),[])}function A(r,e){if(c.isObject(r)&&c.isObject(e))return c.mergeWith({},r,e,A)}const X=(r,e,n)=>{const{columnsBackup:a,size:m}=J.useInjectApTable(),{t:N}=U.useLocale(),{be:I}=W.useNamespace("ap-table"),[$,z]=F.useToken(),v=s.ref(),u=s.ref([]);let T;T=s.watch(()=>a?.value,(t,i)=>{t?.length&&!i?.length&&(u.value=p(k(localStorage,s.unref(e))),T?.())},{immediate:!0}),s.watch([a,m],([t,i])=>{t&&(v.value={label:"basic_template",columnState:f(t),key:y,size:i})},{immediate:!0,deep:!0}),s.watch(()=>e.value,t=>{const i=p(k(localStorage,t));u.value=i,v.value={label:"basic_template",columnState:f(a?.value||[]),key:y,size:m?.value},n(i??[])});function p(t){return t.length?t.map(i=>({...i,columnState:f(a.value,i.columnState,!1)})):[{label:N("ap.apTable.setting.defaultTemplate"),key:r.getActiveKey?.("DEFAULT_TEMPLATE")??q.randomStr(),size:m?.value,columnState:f(a?.value||[])}]}function f(t,i={},l=!0){const g=c.mergeWith({},l?r.defaultValue||{}:{},i,A);function S(w,L,j){return w.map((o,B)=>{const x=L?.[o.key]||{},d={key:o.key,label:c.isString(o.title)?P.getTableTitle(o,I("table-header","title"),void 0,z.value.colorTextTertiary):o.title,show:!0,fixed:C(o,i[o.key],l?r.defaultValue?.[o.key]:void 0,j),disabled:!1,...c.omit(x,["children","fixed"])};return d.children=o.children?.length?S(o.children,x.children,d):void 0,d.order=d.order??B,d}).sort(G)}return S(t||[],g)}function h(t){if(s.unref(e)){const i=t.map(l=>({...l,columnState:M.getColumnStateString(l.columnState)}));localStorage.setItem(s.unref(e),JSON.stringify(i))}}function E(t){u.value.push(t)}function O(t){const i=u.value.findIndex(l=>l.key===t);u.value.splice(i,1)}function _(t,i){const l=u.value.findIndex(g=>g.key===t);return u.value[l]={...u.value[l],...i},u.value[l]}return s.watch(()=>u.value,t=>{t.length&&h(t)},{deep:!0,immediate:!0}),{basicTemplate:v,customizeTemplateList:u,syncTemplateListToStorage:h,addTemplate:E,deleteTemplate:O,updateTemplate:_}};exports.useTableTemplateStorage=X;
|
package/lib/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.19.
|
|
1
|
+
declare const _default: "7.19.4";
|
|
2
2
|
export default _default;
|
package/lib/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.19.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.19.4";exports.default=e;
|