@aplus-frontend/ui 7.19.2 → 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/business/ap-tag/ap-tag-group.vue.mjs +83 -60
- package/es/src/business/ap-tag/interface.d.ts +4 -0
- package/es/src/business/ap-view/ap-view.vue2.mjs +88 -87
- package/es/src/business/ap-view/hooks/use-send-to-url.d.ts +2 -1
- package/es/src/business/ap-view/hooks/use-send-to-url.mjs +25 -24
- 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/business/ap-tag/ap-tag-group.vue.js +1 -1
- package/lib/src/business/ap-tag/interface.d.ts +4 -0
- package/lib/src/business/ap-view/ap-view.vue2.js +1 -1
- package/lib/src/business/ap-view/hooks/use-send-to-url.d.ts +2 -1
- package/lib/src/business/ap-view/hooks/use-send-to-url.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
|
};
|