@aplus-frontend/ui 0.1.38 → 0.1.40
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/index.mjs +136 -134
- package/es/src/ap-descriptions/formatter/index.mjs +24 -24
- package/es/src/ap-form/index.d.ts +3 -1
- package/es/src/ap-form/index.mjs +8 -4
- package/es/src/ap-form/interface.d.ts +30 -1
- package/es/src/ap-form/modal-form/drawer.vue.d.ts +830 -0
- package/es/src/ap-form/modal-form/drawer.vue.mjs +288 -0
- package/es/src/ap-form/modal-form/drawer.vue2.mjs +4 -0
- package/es/src/ap-form/modal-form/index.vue.mjs +56 -47
- package/es/src/ap-form/style/drawer-form.css +10 -0
- package/es/src/ap-table/ap-table.vue.mjs +96 -95
- package/es/src/ap-table/components/setting/modal/index.vue2.mjs +1 -1
- package/es/src/ap-table/hooks/use-table-column-state.d.ts +2 -2
- package/es/src/ap-table/hooks/use-table-column-state.mjs +37 -37
- package/es/src/ap-table/hooks/use-table-paging.d.ts +1 -1
- package/es/src/ap-table/hooks/use-table-paging.mjs +74 -74
- package/es/src/ap-table/style/ap-table.css +6 -0
- package/es/src/business/ap-card/ApCard.vue2.mjs +18 -20
- package/es/src/index.mjs +107 -105
- package/es/src/theme/ap-form/drawer-form.css +10 -0
- package/es/src/theme/ap-table/ap-table.css +6 -0
- package/es/src/theme/css-var/index.mjs +10 -0
- package/lib/index.js +1 -1
- package/lib/src/ap-descriptions/formatter/index.js +1 -1
- package/lib/src/ap-form/index.d.ts +3 -1
- package/lib/src/ap-form/index.js +1 -1
- package/lib/src/ap-form/interface.d.ts +30 -1
- package/lib/src/ap-form/modal-form/drawer.vue.d.ts +830 -0
- package/lib/src/ap-form/modal-form/drawer.vue.js +1 -0
- package/lib/src/ap-form/modal-form/drawer.vue2.js +1 -0
- package/lib/src/ap-form/modal-form/index.vue.js +1 -1
- package/lib/src/ap-form/style/drawer-form.css +10 -0
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/components/setting/modal/index.vue2.js +1 -1
- package/lib/src/ap-table/hooks/use-table-column-state.d.ts +2 -2
- package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
- package/lib/src/ap-table/hooks/use-table-paging.d.ts +1 -1
- package/lib/src/ap-table/hooks/use-table-paging.js +1 -1
- package/lib/src/ap-table/style/ap-table.css +6 -0
- package/lib/src/business/ap-card/ApCard.vue2.js +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/theme/ap-form/drawer-form.css +10 -0
- package/lib/src/theme/ap-table/ap-table.css +6 -0
- package/lib/src/theme/css-var/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as Ce, useSlots as Te, ref as P, computed as s, unref as
|
|
1
|
+
import { defineComponent as Ce, useSlots as Te, ref as P, computed as s, unref as t, createVNode as f, Fragment as U, watchEffect as Fe, watch as G, openBlock as m, createElementBlock as T, normalizeClass as c, normalizeStyle as M, mergeProps as h, createSlots as J, withCtx as w, renderList as Q, createBlock as X, resolveDynamicComponent as xe, renderSlot as S, createCommentVNode as Y, createElementVNode as I, h as Be, normalizeProps as ke, guardReactiveProps as ze } from "vue";
|
|
2
2
|
import { Typography as Pe, Divider as Ie, Button as Ne, Table as Le } from "ant-design-vue";
|
|
3
3
|
import { useToken as Ee } from "ant-design-vue/es/theme/internal";
|
|
4
4
|
import { ApForm as Ke } from "../ap-form/index.mjs";
|
|
@@ -7,7 +7,7 @@ import "../config-provider/index.mjs";
|
|
|
7
7
|
import { useTablePaging as Oe } from "./hooks/use-table-paging.mjs";
|
|
8
8
|
import { omit as _, isUndefined as g, isBoolean as Ve } from "lodash-unified";
|
|
9
9
|
import "./style/ap-table.css";
|
|
10
|
-
import { apColumnToColumn as
|
|
10
|
+
import { apColumnToColumn as De, getTableTitle as je, getTableRenderType as Ae, getTableRenderProps as We, getTableCellRenderNode as $e, getColumnOrder as ee, updateFormProps as He, getFieldProps as qe, getPlaceholder as Ue, getSearchFormItemRenderNode as Ge, objectToString as Me } from "./utils.mjs";
|
|
11
11
|
import Je from "./hooks/use-table-content-height.mjs";
|
|
12
12
|
import { getRawDisplayValue as Qe } from "../editable-table/utils.mjs";
|
|
13
13
|
import Xe from "./hooks/use-table-row-selection.mjs";
|
|
@@ -148,7 +148,7 @@ const Fa = /* @__PURE__ */ Ce({
|
|
|
148
148
|
}) {
|
|
149
149
|
const a = ae;
|
|
150
150
|
let N = 0;
|
|
151
|
-
const
|
|
151
|
+
const b = Te(), [, te] = Ee(), {
|
|
152
152
|
t: re
|
|
153
153
|
} = ea(), {
|
|
154
154
|
e: F,
|
|
@@ -157,52 +157,52 @@ const Fa = /* @__PURE__ */ Ce({
|
|
|
157
157
|
} = aa("ap-table"), E = oa("valueTypeMap"), {
|
|
158
158
|
height: le,
|
|
159
159
|
contentRef: ne
|
|
160
|
-
} = Je(),
|
|
160
|
+
} = Je(), x = P(a.size), u = P([]), K = P([]);
|
|
161
161
|
_e({
|
|
162
162
|
columns: s(() => u.value),
|
|
163
163
|
columnsBackup: s(() => K.value),
|
|
164
|
-
size: s(() =>
|
|
164
|
+
size: s(() => x.value),
|
|
165
165
|
updateColumns(e) {
|
|
166
166
|
u.value = e;
|
|
167
167
|
},
|
|
168
168
|
updateSize(e) {
|
|
169
|
-
|
|
169
|
+
x.value = e;
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
const se = () => {
|
|
173
|
-
var
|
|
174
|
-
let e = ((
|
|
173
|
+
var r;
|
|
174
|
+
let e = ((r = a.columns) == null ? void 0 : r.filter((l) => !l.hideInTable)) || [];
|
|
175
175
|
function o(l, d) {
|
|
176
176
|
return l.map((n) => ({
|
|
177
177
|
resizable: Ye(n.resizable) ? n.resizable : a.columnResizable,
|
|
178
|
-
..._(
|
|
178
|
+
..._(De(n), ["ellipsis"]),
|
|
179
179
|
fixed: d ? d.fixed : n.fixed,
|
|
180
|
-
title:
|
|
180
|
+
title: je(n, L("table-header", "title"), b.headerCell, t(te).colorPrimary),
|
|
181
181
|
customRender({
|
|
182
|
-
value:
|
|
182
|
+
value: p,
|
|
183
183
|
...y
|
|
184
184
|
}) {
|
|
185
185
|
var H, q;
|
|
186
|
-
const
|
|
186
|
+
const W = Ae(n), be = We({
|
|
187
187
|
...n,
|
|
188
|
-
valueType:
|
|
188
|
+
valueType: W
|
|
189
189
|
}, {
|
|
190
|
-
value:
|
|
190
|
+
value: p,
|
|
191
191
|
...y
|
|
192
|
-
}), Re =
|
|
193
|
-
value:
|
|
192
|
+
}), Re = $e(W, be, y.record, t(E)), $ = ((H = n.renderText) == null ? void 0 : H.call(n, {
|
|
193
|
+
value: p,
|
|
194
194
|
...y
|
|
195
|
-
})) ||
|
|
196
|
-
value:
|
|
195
|
+
})) || p, ve = n.renderText ? f(U, null, [(q = n.renderText) == null ? void 0 : q.call(n, {
|
|
196
|
+
value: p,
|
|
197
197
|
...y
|
|
198
198
|
})]) : Re;
|
|
199
|
-
let z = ye(n,
|
|
199
|
+
let z = ye(n, $, ve);
|
|
200
200
|
return n.customRender && (z = n.customRender({
|
|
201
|
-
value:
|
|
201
|
+
value: p,
|
|
202
202
|
...y,
|
|
203
203
|
column: n,
|
|
204
204
|
originalNode: z,
|
|
205
|
-
originalText:
|
|
205
|
+
originalText: $
|
|
206
206
|
})), z;
|
|
207
207
|
},
|
|
208
208
|
children: o(n.children || [], d || n)
|
|
@@ -215,11 +215,11 @@ const Fa = /* @__PURE__ */ Ce({
|
|
|
215
215
|
u.value = e, K.value = e;
|
|
216
216
|
});
|
|
217
217
|
const O = s(() => {
|
|
218
|
-
var e, o,
|
|
219
|
-
return N++, ((
|
|
218
|
+
var e, o, r;
|
|
219
|
+
return N++, ((r = (o = (e = a.columns) == null ? void 0 : e.filter((l) => !l.hideInSearch && l.dataIndex && (l.valueType || l.customRenderFormItem) && !Z.includes(l.valueType))) == null ? void 0 : o.sort((l, d) => {
|
|
220
220
|
let n = ee(l.order);
|
|
221
221
|
return ee(d.order) - n;
|
|
222
|
-
})) == null ? void 0 :
|
|
222
|
+
})) == null ? void 0 : r.map((l) => {
|
|
223
223
|
const d = He(l, qe(l.fieldProps, {})), n = {
|
|
224
224
|
...l,
|
|
225
225
|
fieldProps: {
|
|
@@ -232,11 +232,11 @@ const Fa = /* @__PURE__ */ Ce({
|
|
|
232
232
|
},
|
|
233
233
|
renderNode: void 0
|
|
234
234
|
};
|
|
235
|
-
return n.renderNode = Ge(n,
|
|
235
|
+
return n.renderNode = Ge(n, t(E)), n;
|
|
236
236
|
})) || [];
|
|
237
|
-
}), de = s(() =>
|
|
237
|
+
}), de = s(() => t(u).filter((e) => e.sorter === !0).map((e) => e.dataIndex).filter(Boolean)), ue = s(() => t(u).filter((e) => e.filters && !e.onFilter).map((e) => e.dataIndex).filter(Boolean)), ie = s(() => g(a.dataSource) ? C.value.records : a.dataSource), {
|
|
238
238
|
rowSelection: R,
|
|
239
|
-
selectedRows:
|
|
239
|
+
selectedRows: B,
|
|
240
240
|
...v
|
|
241
241
|
} = Xe({
|
|
242
242
|
...a.rowSelection === !0 ? {} : a.rowSelection,
|
|
@@ -245,20 +245,20 @@ const Fa = /* @__PURE__ */ Ce({
|
|
|
245
245
|
}), {
|
|
246
246
|
formRef: k,
|
|
247
247
|
submit: V,
|
|
248
|
-
reset:
|
|
249
|
-
tableProps:
|
|
248
|
+
reset: D,
|
|
249
|
+
tableProps: j,
|
|
250
250
|
refresh: ce,
|
|
251
251
|
data: C,
|
|
252
252
|
setDataSource: pe
|
|
253
253
|
} = Oe({
|
|
254
254
|
async request(e) {
|
|
255
|
-
var
|
|
255
|
+
var r, l;
|
|
256
256
|
if (!R.value.preserveSelectedRowKeys && g(a.dataSource) && v.clearAll(), !g(a.dataSource))
|
|
257
257
|
return {
|
|
258
258
|
data: a.dataSource || [],
|
|
259
259
|
total: a.dataSource.length || 0
|
|
260
260
|
};
|
|
261
|
-
const o = await ((
|
|
261
|
+
const o = await ((r = a.request) == null ? void 0 : r.call(a, e));
|
|
262
262
|
return (l = a.onLoad) == null || l.call(a, (o == null ? void 0 : o.data) || []), {
|
|
263
263
|
data: (o == null ? void 0 : o.data) || [],
|
|
264
264
|
total: (o == null ? void 0 : o.total) || 0
|
|
@@ -275,11 +275,11 @@ const Fa = /* @__PURE__ */ Ce({
|
|
|
275
275
|
showLessItems: a.pagination ? a.pagination.showLessItems : void 0,
|
|
276
276
|
showTotal: a.pagination ? a.pagination.showTotal : void 0
|
|
277
277
|
}), fe = s(() => {
|
|
278
|
-
var o,
|
|
278
|
+
var o, r;
|
|
279
279
|
if (a.adaptive && (C.value.total > 0 || ((o = a.dataSource) == null ? void 0 : o.length)))
|
|
280
280
|
return {
|
|
281
|
-
y:
|
|
282
|
-
x: ((
|
|
281
|
+
y: t(le),
|
|
282
|
+
x: ((r = a.scroll) == null ? void 0 : r.x) || "100%"
|
|
283
283
|
};
|
|
284
284
|
if (a.scroll)
|
|
285
285
|
return a.scroll;
|
|
@@ -289,27 +289,27 @@ const Fa = /* @__PURE__ */ Ce({
|
|
|
289
289
|
return a.tableLayout;
|
|
290
290
|
if ((e = a.columns) != null && e.some((o) => o.ellipsis))
|
|
291
291
|
return "fixed";
|
|
292
|
-
}),
|
|
293
|
-
var
|
|
294
|
-
const e =
|
|
292
|
+
}), A = s(() => {
|
|
293
|
+
var r;
|
|
294
|
+
const e = t(j), o = t(R);
|
|
295
295
|
return {
|
|
296
296
|
...a,
|
|
297
297
|
...e,
|
|
298
|
-
rowSelection: a.rowSelection === !0 || ((
|
|
298
|
+
rowSelection: a.rowSelection === !0 || ((r = a.rowSelection) == null ? void 0 : r.mode) === "internal" ? {
|
|
299
299
|
...o,
|
|
300
300
|
// tips 如果是前端分页,则默认会走缓存
|
|
301
301
|
preserveSelectedRowKeys: g(a.dataSource) ? o.preserveSelectedRowKeys : !0
|
|
302
302
|
} : a.rowSelection,
|
|
303
303
|
loading: g(a.loading) ? e.loading : a.loading,
|
|
304
304
|
pagination: a.pagination === !1 ? !1 : e.pagination,
|
|
305
|
-
scroll:
|
|
305
|
+
scroll: t(fe)
|
|
306
306
|
};
|
|
307
307
|
}), ge = s(() => [i(), a.card ? null : i("wrapper"), a.adaptive ? i("adaptive") : null].filter(Boolean));
|
|
308
|
-
function ye(e, o,
|
|
308
|
+
function ye(e, o, r) {
|
|
309
309
|
if (Z.includes(e.valueType))
|
|
310
|
-
return
|
|
310
|
+
return r;
|
|
311
311
|
const l = Me(o);
|
|
312
|
-
return e.copyable || e.ellipsis ?
|
|
312
|
+
return e.copyable || e.ellipsis ? f(Pe.Paragraph, {
|
|
313
313
|
copyable: e.copyable ? {
|
|
314
314
|
text: l,
|
|
315
315
|
tooltip: !1
|
|
@@ -320,112 +320,113 @@ const Fa = /* @__PURE__ */ Ce({
|
|
|
320
320
|
...e.ellipsis,
|
|
321
321
|
tooltip: l
|
|
322
322
|
} : !1,
|
|
323
|
-
content: e.ellipsis ? Qe(e, o) :
|
|
324
|
-
}, null) :
|
|
323
|
+
content: e.ellipsis ? Qe(e, o) : r
|
|
324
|
+
}, null) : r;
|
|
325
325
|
}
|
|
326
|
-
G(() =>
|
|
326
|
+
G(() => t(C).loading, (e) => {
|
|
327
327
|
var o;
|
|
328
328
|
(o = a.onLoadingChange) == null || o.call(a, e);
|
|
329
329
|
}), G(() => a.dataSource, (e) => {
|
|
330
|
-
|
|
330
|
+
pe(e);
|
|
331
331
|
}, {
|
|
332
332
|
immediate: !0
|
|
333
333
|
});
|
|
334
334
|
function he(e) {
|
|
335
|
-
var o,
|
|
336
|
-
(l = (
|
|
335
|
+
var o, r, l;
|
|
336
|
+
(l = (r = (o = k.value) == null ? void 0 : o.apForm) == null ? void 0 : r.setFieldsValue) == null || l.call(r, e);
|
|
337
337
|
}
|
|
338
338
|
function we() {
|
|
339
|
-
var e, o,
|
|
340
|
-
return (
|
|
339
|
+
var e, o, r;
|
|
340
|
+
return (r = (o = (e = k.value) == null ? void 0 : e.apForm) == null ? void 0 : o.getFieldsValue) == null ? void 0 : r.call(o, !0);
|
|
341
341
|
}
|
|
342
|
-
function
|
|
343
|
-
return
|
|
342
|
+
function Se() {
|
|
343
|
+
return t(u);
|
|
344
344
|
}
|
|
345
345
|
return oe({
|
|
346
346
|
submit: () => V(),
|
|
347
|
-
reset: () =>
|
|
347
|
+
reset: () => D(),
|
|
348
348
|
refresh: () => ce(),
|
|
349
349
|
setSearchFormValues: he,
|
|
350
350
|
getSearchFormValues: we,
|
|
351
|
-
getShownColumns:
|
|
352
|
-
dataSource: s(() =>
|
|
351
|
+
getShownColumns: Se,
|
|
352
|
+
dataSource: s(() => t(C).records),
|
|
353
353
|
rowSelection: {
|
|
354
|
-
selectedRows: s(() =>
|
|
354
|
+
selectedRows: s(() => t(B)),
|
|
355
355
|
...v
|
|
356
356
|
}
|
|
357
|
-
}), (e, o) => (
|
|
358
|
-
class:
|
|
359
|
-
}, [
|
|
357
|
+
}), (e, o) => (m(), T("div", {
|
|
358
|
+
class: c(ge.value)
|
|
359
|
+
}, [t(g)(e.dataSource) && e.searchForm !== !1 && O.value.length > 0 ? (m(), T("div", {
|
|
360
360
|
key: 0,
|
|
361
|
-
class:
|
|
361
|
+
class: c(e.card ? t(F)("search-wrapper") : null),
|
|
362
362
|
style: M(e.searchFormWrapperStyle)
|
|
363
|
-
}, [
|
|
363
|
+
}, [f(t(Ke).SearchForm, h(e.searchForm || {}, {
|
|
364
364
|
ref_key: "formRef",
|
|
365
365
|
ref: k,
|
|
366
366
|
"custom-reset": "",
|
|
367
|
-
onSubmit:
|
|
368
|
-
onReset:
|
|
369
|
-
"submit-loading":
|
|
367
|
+
onSubmit: t(V),
|
|
368
|
+
onReset: t(D),
|
|
369
|
+
"submit-loading": t(j).loading
|
|
370
370
|
}), J({
|
|
371
|
-
default: w(() => [(
|
|
372
|
-
key:
|
|
371
|
+
default: w(() => [(m(!0), T(U, null, Q(O.value, (r) => (m(), X(xe(r.renderNode), h({
|
|
372
|
+
key: r.dataIndex,
|
|
373
373
|
ref_for: !0
|
|
374
|
-
},
|
|
375
|
-
span:
|
|
374
|
+
}, r.fieldProps || {}, {
|
|
375
|
+
span: r.span
|
|
376
376
|
}), null, 16, ["span"]))), 128))]),
|
|
377
377
|
_: 2
|
|
378
|
-
}, [
|
|
378
|
+
}, [b.searchFormExtra ? {
|
|
379
379
|
name: "extra",
|
|
380
|
-
fn: w(() => [
|
|
380
|
+
fn: w(() => [S(e.$slots, "searchFormExtra")]),
|
|
381
381
|
key: "0"
|
|
382
382
|
} : void 0]), 1040, ["onSubmit", "onReset", "submit-loading"])], 6)) : Y("", !0), I("div", {
|
|
383
383
|
ref_key: "contentRef",
|
|
384
384
|
ref: ne,
|
|
385
|
-
class:
|
|
385
|
+
class: c([t(F)("table-wrapper"), e.card ? t(F)("table-wrapper-card") : null]),
|
|
386
386
|
style: M(e.tableWrapperStyle)
|
|
387
387
|
}, [I("div", {
|
|
388
|
-
class:
|
|
389
|
-
}, [e.settings ? (
|
|
388
|
+
class: c(t(i)("header-wrapper"))
|
|
389
|
+
}, [e.settings ? (m(), T("div", {
|
|
390
390
|
key: 0,
|
|
391
|
-
class:
|
|
391
|
+
class: c(t(i)("header"))
|
|
392
392
|
}, [I("div", {
|
|
393
|
-
class:
|
|
394
|
-
}, [
|
|
395
|
-
selectedRows:
|
|
396
|
-
selectedRowKeys:
|
|
393
|
+
class: c(t(L)("header", "title"))
|
|
394
|
+
}, [S(e.$slots, "title", h({
|
|
395
|
+
selectedRows: t(B),
|
|
396
|
+
selectedRowKeys: t(R).selectedRowKeys,
|
|
397
397
|
shownColumns: u.value
|
|
398
|
-
}, v))], 2),
|
|
398
|
+
}, v))], 2), b.title ? (m(), X(t(Ie), {
|
|
399
399
|
key: 0,
|
|
400
400
|
type: "vertical"
|
|
401
|
-
})) : Y("", !0),
|
|
401
|
+
})) : Y("", !0), f(ta, {
|
|
402
402
|
config: e.settings === !0 ? {} : e.settings
|
|
403
403
|
}, {
|
|
404
|
-
trigger: w(() => [
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
trigger: w(() => [f(t(Ne), {
|
|
405
|
+
class: c(t(i)("setting-trigger-button")),
|
|
406
|
+
icon: Be(t(Ze))
|
|
407
|
+
}, null, 8, ["class", "icon"])]),
|
|
407
408
|
_: 1
|
|
408
|
-
}, 8, ["config"])], 2)) :
|
|
409
|
+
}, 8, ["config"])], 2)) : S(e.$slots, "title", h({
|
|
409
410
|
key: 1,
|
|
410
|
-
selectedRows:
|
|
411
|
-
selectedRowKeys:
|
|
411
|
+
selectedRows: t(B),
|
|
412
|
+
selectedRowKeys: t(R).selectedRowKeys,
|
|
412
413
|
shownColumns: u.value
|
|
413
|
-
}, v))], 2),
|
|
414
|
-
class:
|
|
415
|
-
},
|
|
416
|
-
size:
|
|
414
|
+
}, v))], 2), f(t(Le), h({
|
|
415
|
+
class: t(i)("table")
|
|
416
|
+
}, A.value, {
|
|
417
|
+
size: x.value,
|
|
417
418
|
"table-layout": me.value,
|
|
418
419
|
columns: u.value,
|
|
419
|
-
onResizeColumn: o[0] || (o[0] = (
|
|
420
|
+
onResizeColumn: o[0] || (o[0] = (r, l) => l.width = r)
|
|
420
421
|
}), J({
|
|
421
|
-
summary: w(() => [
|
|
422
|
+
summary: w(() => [S(e.$slots, "summary", {
|
|
422
423
|
columns: u.value,
|
|
423
|
-
records:
|
|
424
|
+
records: A.value.dataSource
|
|
424
425
|
})]),
|
|
425
426
|
_: 2
|
|
426
|
-
}, [Q(
|
|
427
|
+
}, [Q(t(_)(b, ["title", "searchFormExtra", "headerCell", "summary"]), (r, l) => ({
|
|
427
428
|
name: l,
|
|
428
|
-
fn: w((d) => [
|
|
429
|
+
fn: w((d) => [S(e.$slots, l, ke(ze(d || {})))])
|
|
429
430
|
}))]), 1040, ["class", "size", "table-layout", "columns"])], 6)], 2));
|
|
430
431
|
}
|
|
431
432
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApColumnState, ApTableSettingType } from '../interface';
|
|
2
|
-
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { Ref, ComputedRef, ShallowRef } from 'vue';
|
|
3
3
|
export declare const useTableColumnState: (columnSetting: ApTableSettingType, initialColumnState: ApColumnState[]) => {
|
|
4
4
|
columnState: Ref<{
|
|
5
5
|
key: string | number;
|
|
@@ -16,7 +16,7 @@ export declare const useTableColumnState: (columnSetting: ApTableSettingType, in
|
|
|
16
16
|
setColumnState: (nextColumnState: ApColumnState[]) => void;
|
|
17
17
|
isAllSelected: ComputedRef<boolean>;
|
|
18
18
|
toggleSelectAll: () => void;
|
|
19
|
-
columnStateBackup: ApColumnState[]
|
|
19
|
+
columnStateBackup: ShallowRef<ApColumnState[]>;
|
|
20
20
|
setColumnStateBackup: (nextBackup: ApColumnState[]) => void;
|
|
21
21
|
cacheColumnStateIfNeeded: (nextColumnState: ApColumnState[]) => void;
|
|
22
22
|
};
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { ref as _, unref as i, computed as j, watchEffect as z } from "vue";
|
|
1
|
+
import { ref as R, shallowRef as _, unref as i, computed as j, watchEffect as z } from "vue";
|
|
2
2
|
import { isDef as D } from "../../utils/index.mjs";
|
|
3
|
-
import G, { customCloneColumnStates as
|
|
4
|
-
import { useInjectApTable as
|
|
5
|
-
import { isObject as
|
|
6
|
-
function
|
|
3
|
+
import G, { customCloneColumnStates as A, getColumnStateString as W } from "../components/setting/utils.mjs";
|
|
4
|
+
import { useInjectApTable as X } from "../context.mjs";
|
|
5
|
+
import { isObject as k, mergeWith as E, isBoolean as q, omit as H, isNumber as N } from "lodash-unified";
|
|
6
|
+
function u(r, n) {
|
|
7
7
|
r.forEach((t) => {
|
|
8
8
|
var c;
|
|
9
|
-
|
|
9
|
+
n(t), (c = t.children) != null && c.length && u(t.children, n);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
if (!
|
|
12
|
+
function L(r, n) {
|
|
13
|
+
if (!n)
|
|
14
14
|
return {};
|
|
15
|
-
const t = r.getItem(
|
|
15
|
+
const t = r.getItem(n);
|
|
16
16
|
return t ? JSON.parse(t) : {};
|
|
17
17
|
}
|
|
18
|
-
function I(r,
|
|
19
|
-
if (
|
|
20
|
-
return E({}, r,
|
|
18
|
+
function I(r, n) {
|
|
19
|
+
if (k(r) && k(n))
|
|
20
|
+
return E({}, r, n, I);
|
|
21
21
|
}
|
|
22
|
-
const B = Number.MAX_SAFE_INTEGER,
|
|
23
|
-
const t = _(
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const B = Number.MAX_SAFE_INTEGER, $ = (r, n) => {
|
|
23
|
+
const t = R(n), c = _(
|
|
24
|
+
A(n)
|
|
25
|
+
), { columnsBackup: h, updateColumns: f } = X(), T = r.persistenceType || "localStorage", S = window[T];
|
|
26
26
|
function F() {
|
|
27
|
-
const e =
|
|
27
|
+
const e = L(
|
|
28
28
|
S,
|
|
29
29
|
r.persistenceKey
|
|
30
|
-
),
|
|
30
|
+
), o = E(
|
|
31
31
|
{},
|
|
32
32
|
r.defaultValue || {},
|
|
33
33
|
e,
|
|
34
34
|
I
|
|
35
35
|
), l = i(h);
|
|
36
|
-
function
|
|
36
|
+
function v(M, d, b) {
|
|
37
37
|
return M.map((s) => {
|
|
38
|
-
var
|
|
38
|
+
var x;
|
|
39
39
|
const a = (d == null ? void 0 : d[s.key]) || {}, m = {
|
|
40
40
|
key: s.key,
|
|
41
41
|
label: s.title,
|
|
42
42
|
show: !0,
|
|
43
|
-
fixed:
|
|
43
|
+
fixed: b ? b.fixed : q(s.fixed) ? s.fixed ? "left" : void 0 : s.fixed,
|
|
44
44
|
disabled: !1,
|
|
45
|
-
...
|
|
45
|
+
...H(a, "children")
|
|
46
46
|
};
|
|
47
|
-
return m.children = (
|
|
47
|
+
return m.children = (x = s.children) != null && x.length ? v(
|
|
48
48
|
s.children,
|
|
49
49
|
a.children,
|
|
50
50
|
m
|
|
@@ -53,49 +53,49 @@ const B = Number.MAX_SAFE_INTEGER, Z = (r, o) => {
|
|
|
53
53
|
(s, a) => (N(s.order) ? s.order : B) - (N(a.order) ? a.order : B)
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return v(l || [], o);
|
|
57
57
|
}
|
|
58
58
|
const g = j(() => i(t).every((e) => e.show));
|
|
59
59
|
function p() {
|
|
60
60
|
const e = i(t);
|
|
61
|
-
|
|
62
|
-
!
|
|
61
|
+
u(e, (o) => {
|
|
62
|
+
!o.disabled && (o.show = !0);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
function C() {
|
|
66
66
|
const e = i(t);
|
|
67
|
-
|
|
68
|
-
!
|
|
67
|
+
u(e, (o) => {
|
|
68
|
+
!o.disabled && (o.show = !1);
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
function O() {
|
|
72
72
|
i(g) ? C() : p();
|
|
73
73
|
}
|
|
74
|
-
function K(e,
|
|
75
|
-
|
|
76
|
-
l.key === e && (l.show = D(
|
|
74
|
+
function K(e, o) {
|
|
75
|
+
u(i(t), (l) => {
|
|
76
|
+
l.key === e && (l.show = D(o) ? o : !l.show);
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
function w(e) {
|
|
80
80
|
t.value = e;
|
|
81
81
|
}
|
|
82
82
|
function J(e) {
|
|
83
|
-
c = e;
|
|
83
|
+
c.value = e;
|
|
84
84
|
}
|
|
85
85
|
function y(e) {
|
|
86
86
|
if (r.persistenceKey) {
|
|
87
|
-
const
|
|
88
|
-
S.setItem(r.persistenceKey, JSON.stringify(
|
|
87
|
+
const o = W(e);
|
|
88
|
+
S.setItem(r.persistenceKey, JSON.stringify(o));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
return z(() => {
|
|
92
92
|
const e = F();
|
|
93
|
-
w(e),
|
|
93
|
+
w(e), f == null || f(
|
|
94
94
|
G(
|
|
95
95
|
i(h),
|
|
96
96
|
i(e)
|
|
97
97
|
)
|
|
98
|
-
), c =
|
|
98
|
+
), c.value = A(e), y(e);
|
|
99
99
|
}), {
|
|
100
100
|
columnState: t,
|
|
101
101
|
selectAll: p,
|
|
@@ -110,5 +110,5 @@ const B = Number.MAX_SAFE_INTEGER, Z = (r, o) => {
|
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
112
|
export {
|
|
113
|
-
|
|
113
|
+
$ as useTableColumnState
|
|
114
114
|
};
|