@lumal/core 0.0.4-beta → 0.0.5-beta
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/CHANGELOG.md +11 -0
- package/dist/{components-B5Xd-iBK.js → components-Bk7eEpWu.js} +320 -314
- package/dist/components-CxUJo-ux.cjs +2 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/core.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/request.cjs +1 -1
- package/dist/request.js +8 -4
- package/dist/src/components/schema-form/LumalSchemaForm.vue.d.ts +1 -0
- package/dist/src/components/schema-form/LumalSchemaForm.vue.d.ts.map +1 -1
- package/dist/src/components/schema-form/normalize.d.ts.map +1 -1
- package/dist/src/components/schema-form/types.d.ts +3 -0
- package/dist/src/components/schema-form/types.d.ts.map +1 -1
- package/dist/src/request/client.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/components-CRxtQpsQ.cjs +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { f as e, i as t, p as n } from "./composables-BxZG0_RZ.js";
|
|
2
2
|
import { t as r } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
3
3
|
import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createSlots as u, createTextVNode as d, createVNode as f, defineComponent as p, guardReactiveProps as m, mergeModels as h, mergeProps as g, nextTick as _, normalizeClass as v, normalizeProps as y, normalizeStyle as b, onBeforeUnmount as x, onMounted as S, openBlock as C, reactive as w, renderList as T, renderSlot as E, shallowRef as D, toDisplayString as O, unref as k, useModel as ee, useSlots as A, useTemplateRef as j, vShow as M, watch as N, withCtx as P, withDirectives as te, withKeys as ne, withModifiers as F } from "vue";
|
|
4
|
-
import { LumalIcon as
|
|
5
|
-
import { ElButton as R, ElCheckbox as ae, ElCheckboxGroup as oe, ElCol as
|
|
4
|
+
import { LumalIcon as re, LumalIcon as I, LumalIconPicker as ie, LumalIconPickerDialog as L } from "@lumal/icons-vue";
|
|
5
|
+
import { ElButton as R, ElCheckbox as ae, ElCheckboxGroup as oe, ElCol as se, ElDatePicker as ce, ElDialog as z, ElDrawer as B, ElForm as le, ElFormItem as ue, ElInput as de, ElInputNumber as fe, ElLoading as pe, ElMessageBox as me, ElOption as he, ElPagination as ge, ElPopover as _e, ElRadio as ve, ElRadioGroup as ye, ElRow as be, ElSelect as xe, ElSwitch as Se, ElTable as Ce, ElTableColumn as we, ElTreeSelect as Te, ElUpload as Ee } from "element-plus";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/components/pagination/LumalPagination.vue
|
|
8
8
|
var De = /*#__PURE__*/ r(/* @__PURE__ */ p({
|
|
@@ -69,19 +69,19 @@ var De = /*#__PURE__*/ r(/* @__PURE__ */ p({
|
|
|
69
69
|
}), [["__scopeId", "data-v-d546f46b"]]);
|
|
70
70
|
//#endregion
|
|
71
71
|
//#region src/components/schema-form/normalize.ts
|
|
72
|
-
function
|
|
72
|
+
function V(e) {
|
|
73
73
|
return `lumal-schema-form-${e.replace(/[^\w-]/g, "-")}`;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function H(e, t) {
|
|
76
76
|
return typeof e == "function" ? !!e(t) : !!e;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function U(e, t, n) {
|
|
79
79
|
return typeof e == "function" ? e(t) : e ?? n;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Oe(e, t) {
|
|
82
82
|
return !e.authority || t.canAccess?.(e.authority) !== !1;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function W(e = [], t = {}) {
|
|
85
85
|
let n = t.model ?? {};
|
|
86
86
|
return e.filter((e) => e.field.trim()).map((e) => {
|
|
87
87
|
let r = {
|
|
@@ -91,38 +91,39 @@ function U(e = [], t = {}) {
|
|
|
91
91
|
model: n,
|
|
92
92
|
setFieldValue: t.setFieldValue ?? (() => void 0),
|
|
93
93
|
value: n[e.field]
|
|
94
|
-
}, i = e.component ?? (e.dictionary || e.dictType ? "select" : "input"), a =
|
|
94
|
+
}, i = e.component ?? (e.dictionary || e.dictType ? "select" : "input"), a = H(e.hidden, r), o = H(e.disabled, r), s = e.readonlyAuthority ? t.canAccess?.(e.readonlyAuthority) === !1 : !1, c = r.mode === "view" || s || H(e.readonly, r), l = !a && i !== "hidden" && Oe(e, t), u = U(e.componentProps, r, {}), d = typeof e.options == "function" ? e.options(r) : k(e.options);
|
|
95
95
|
return {
|
|
96
96
|
...e,
|
|
97
|
-
id:
|
|
97
|
+
id: V(e.field),
|
|
98
98
|
component: i,
|
|
99
99
|
componentProps: { ...u },
|
|
100
|
-
description:
|
|
100
|
+
description: U(e.description, r, ""),
|
|
101
101
|
disabled: o,
|
|
102
|
-
help:
|
|
102
|
+
help: U(e.help, r, ""),
|
|
103
103
|
options: d ?? [],
|
|
104
|
-
required:
|
|
104
|
+
required: H(e.required, r),
|
|
105
105
|
readonly: c,
|
|
106
106
|
renderable: l,
|
|
107
|
-
|
|
107
|
+
visible: e.visible === void 0 || H(e.visible, r),
|
|
108
|
+
rules: U(e.rules, r, [])
|
|
108
109
|
};
|
|
109
110
|
});
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
+
function G(e, t = {}) {
|
|
112
113
|
return e.reduce((e, t) => (!(t.field in e) && t.defaultValue !== void 0 && (e[t.field] = t.defaultValue), e), { ...t });
|
|
113
114
|
}
|
|
114
115
|
//#endregion
|
|
115
116
|
//#region src/components/schema-form/LumalSchemaForm.vue?vue&type=script&setup=true&lang.ts
|
|
116
|
-
var
|
|
117
|
+
var K = {
|
|
117
118
|
key: 0,
|
|
118
119
|
class: "lumal-schema-form__readonly-value"
|
|
119
|
-
},
|
|
120
|
+
}, ke = {
|
|
120
121
|
key: 0,
|
|
121
122
|
class: "lumal-schema-form__description"
|
|
122
|
-
},
|
|
123
|
+
}, q = {
|
|
123
124
|
key: 1,
|
|
124
125
|
class: "lumal-schema-form__help"
|
|
125
|
-
},
|
|
126
|
+
}, Ae = /*#__PURE__*/ r(/* @__PURE__ */ p({
|
|
126
127
|
__name: "LumalSchemaForm",
|
|
127
128
|
props: /*@__PURE__*/ h({
|
|
128
129
|
canAccess: {},
|
|
@@ -159,6 +160,10 @@ var G = {
|
|
|
159
160
|
type: Boolean,
|
|
160
161
|
default: !1
|
|
161
162
|
},
|
|
163
|
+
submitDisabled: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
default: !1
|
|
166
|
+
},
|
|
162
167
|
submitOnEnter: {
|
|
163
168
|
type: Boolean,
|
|
164
169
|
default: !1
|
|
@@ -182,34 +187,34 @@ var G = {
|
|
|
182
187
|
N(() => l.mode, (e) => {
|
|
183
188
|
y.value = e;
|
|
184
189
|
});
|
|
185
|
-
let b = D({ ...m.value }), x = w(W(
|
|
190
|
+
let b = D({ ...m.value }), x = w(G(W(l.schemas, {
|
|
186
191
|
canAccess: l.canAccess,
|
|
187
192
|
mode: y.value,
|
|
188
193
|
model: m.value,
|
|
189
|
-
setFieldValue:
|
|
194
|
+
setFieldValue: Me
|
|
190
195
|
}), m.value)), S = a(() => x), A = D([]);
|
|
191
|
-
function
|
|
192
|
-
A.value = l.schemas.map((e) => a(() =>
|
|
196
|
+
function re() {
|
|
197
|
+
A.value = l.schemas.map((e) => a(() => W([e], {
|
|
193
198
|
canAccess: l.canAccess,
|
|
194
199
|
mode: y.value,
|
|
195
200
|
model: x,
|
|
196
|
-
setFieldValue:
|
|
201
|
+
setFieldValue: Me
|
|
197
202
|
})[0]));
|
|
198
|
-
let e = W(
|
|
203
|
+
let e = G(W(l.schemas, {
|
|
199
204
|
canAccess: l.canAccess,
|
|
200
205
|
mode: y.value,
|
|
201
206
|
model: x,
|
|
202
|
-
setFieldValue:
|
|
207
|
+
setFieldValue: Me
|
|
203
208
|
}), x);
|
|
204
209
|
Object.keys(e).forEach((t) => {
|
|
205
210
|
Object.hasOwn(x, t) || (x[t] = e[t]);
|
|
206
211
|
});
|
|
207
212
|
}
|
|
208
|
-
N(() => l.schemas,
|
|
213
|
+
N(() => l.schemas, re, {
|
|
209
214
|
deep: !0,
|
|
210
215
|
immediate: !0
|
|
211
216
|
});
|
|
212
|
-
let I = a(() => A.value.map((e) => e.value).filter((e) => !!e)),
|
|
217
|
+
let I = a(() => A.value.map((e) => e.value).filter((e) => !!e)), ie = a(() => I.value.filter((e) => e.renderable));
|
|
213
218
|
function L(e) {
|
|
214
219
|
let t = x, n = e;
|
|
215
220
|
Object.keys(t).forEach((e) => {
|
|
@@ -217,117 +222,117 @@ var G = {
|
|
|
217
222
|
}), Object.assign(t, n);
|
|
218
223
|
}
|
|
219
224
|
N(() => m.value, L, { deep: !0 });
|
|
220
|
-
let { dictionaryMap:
|
|
225
|
+
let { dictionaryMap: z } = t(() => I.value.map((e) => e.dictionary ?? e.dictType));
|
|
221
226
|
function B(e) {
|
|
222
227
|
let t = S.value[e];
|
|
223
228
|
return typeof t == "number" || typeof t == "string" ? t : t == null ? "" : String(t);
|
|
224
229
|
}
|
|
225
|
-
function
|
|
230
|
+
function me(e) {
|
|
226
231
|
let t = S.value[e];
|
|
227
232
|
return Array.isArray(t) ? t.filter((e) => typeof e == "boolean" || typeof e == "number" || typeof e == "string") : typeof t == "boolean" || typeof t == "number" || typeof t == "string" ? t : "";
|
|
228
233
|
}
|
|
229
|
-
function
|
|
230
|
-
let t =
|
|
234
|
+
function ge(e) {
|
|
235
|
+
let t = me(e);
|
|
231
236
|
return Array.isArray(t) ? t[0] ?? "" : t;
|
|
232
237
|
}
|
|
233
|
-
function
|
|
238
|
+
function _e(e) {
|
|
234
239
|
let t = S.value[e];
|
|
235
240
|
if (typeof t == "number") return t;
|
|
236
241
|
if (typeof t == "string" && t.trim()) return Number(t);
|
|
237
242
|
}
|
|
238
|
-
function
|
|
243
|
+
function Ce(e) {
|
|
239
244
|
return !!S.value[e];
|
|
240
245
|
}
|
|
241
|
-
function
|
|
246
|
+
function we(e) {
|
|
242
247
|
let t = S.value[e];
|
|
243
248
|
return Array.isArray(t) ? t.filter((e) => typeof e == "number" || typeof e == "string") : [];
|
|
244
249
|
}
|
|
245
|
-
function
|
|
250
|
+
function De(e) {
|
|
246
251
|
let t = S.value[e];
|
|
247
252
|
if (t instanceof Date || typeof t == "number" || typeof t == "string" || Array.isArray(t) && t.every((e) => e instanceof Date || typeof e == "number" || typeof e == "string")) return t;
|
|
248
253
|
}
|
|
249
|
-
function
|
|
254
|
+
function V(e) {
|
|
250
255
|
return e.component === "datetime" ? "datetime" : e.component === "daterange" ? "daterange" : "date";
|
|
251
256
|
}
|
|
252
|
-
function
|
|
257
|
+
function H(e) {
|
|
253
258
|
let t = S.value[e];
|
|
254
259
|
if (typeof t == "boolean" || typeof t == "number" || typeof t == "string" || t && typeof t == "object") return t;
|
|
255
260
|
}
|
|
256
|
-
function
|
|
261
|
+
function U(e) {
|
|
257
262
|
return String(e.componentProps.type ?? "text");
|
|
258
263
|
}
|
|
259
|
-
function
|
|
264
|
+
function Oe(e) {
|
|
260
265
|
return e.component === "daterange" ? [`${e.id}-start`, `${e.id}-end`] : e.id;
|
|
261
266
|
}
|
|
262
|
-
function
|
|
267
|
+
function Ae(e) {
|
|
263
268
|
return e.component === "daterange" ? [`${e.field}-start`, `${e.field}-end`] : e.field;
|
|
264
269
|
}
|
|
265
|
-
function
|
|
270
|
+
function J(e) {
|
|
266
271
|
return l.disabled || e.disabled || e.readonly || y.value === "edit" && !!e.editDisabled || !!e.componentProps.disabled;
|
|
267
272
|
}
|
|
268
|
-
function
|
|
273
|
+
function Y(e) {
|
|
269
274
|
return typeof e.span == "number" ? Math.min(24, Math.max(1, e.span)) : Math.floor(24 / Math.max(1, l.columns));
|
|
270
275
|
}
|
|
271
|
-
function
|
|
276
|
+
function X(e) {
|
|
272
277
|
let t = e.dictionary ?? e.dictType;
|
|
273
|
-
return t ?
|
|
278
|
+
return t ? z.value[t] ?? [] : e.options;
|
|
274
279
|
}
|
|
275
|
-
function
|
|
280
|
+
function Z(e) {
|
|
276
281
|
return e.componentProps;
|
|
277
282
|
}
|
|
278
|
-
function
|
|
283
|
+
function Q(e) {
|
|
279
284
|
let t = S.value[e.field];
|
|
280
285
|
if (e.formatter) return e.formatter(t, S.value);
|
|
281
|
-
let n = (Array.isArray(t) ? t : [t]).map((t) =>
|
|
286
|
+
let n = (Array.isArray(t) ? t : [t]).map((t) => X(e).find((e) => String(e.value) === String(t))?.label ?? t).filter((e) => e != null && e !== "");
|
|
282
287
|
return n.length > 0 ? n.map(String).join(", ") : "-";
|
|
283
288
|
}
|
|
284
|
-
function
|
|
289
|
+
function je(e, t) {
|
|
285
290
|
return {
|
|
286
291
|
field: e,
|
|
287
292
|
getValues: () => S.value,
|
|
288
293
|
mode: y.value,
|
|
289
294
|
model: S.value,
|
|
290
|
-
setFieldValue:
|
|
295
|
+
setFieldValue: Me,
|
|
291
296
|
value: t
|
|
292
297
|
};
|
|
293
298
|
}
|
|
294
|
-
function
|
|
299
|
+
function Me(e, t) {
|
|
295
300
|
x[e] = t;
|
|
296
301
|
let n = { ...x };
|
|
297
|
-
m.value = n, I.value.find((t) => t.field === e)?.onChange?.(t,
|
|
302
|
+
m.value = n, I.value.find((t) => t.field === e)?.onChange?.(t, je(e, t)), p("valuesChange", n, [e]);
|
|
298
303
|
}
|
|
299
304
|
function $(e, t) {
|
|
300
|
-
|
|
305
|
+
Me(e, t);
|
|
301
306
|
}
|
|
302
|
-
async function
|
|
303
|
-
y.value === "view" || l.submitLoading || await
|
|
307
|
+
async function Ne() {
|
|
308
|
+
y.value === "view" || l.submitLoading || l.submitDisabled || await Ve() && p("submit", S.value);
|
|
304
309
|
}
|
|
305
|
-
function
|
|
306
|
-
!l.submitOnEnter || e.isComposing || e.target?.tagName === "TEXTAREA" || (e.preventDefault(),
|
|
310
|
+
function Pe(e) {
|
|
311
|
+
!l.submitOnEnter || e.isComposing || e.target?.tagName === "TEXTAREA" || (e.preventDefault(), Ne());
|
|
307
312
|
}
|
|
308
|
-
function
|
|
309
|
-
|
|
313
|
+
function Fe() {
|
|
314
|
+
He(), p("reset", S.value);
|
|
310
315
|
}
|
|
311
|
-
function
|
|
316
|
+
function Ie(e) {
|
|
312
317
|
return `field-${e.field}`;
|
|
313
318
|
}
|
|
314
|
-
function
|
|
319
|
+
function Le(e) {
|
|
315
320
|
return `prefix-${e.field}`;
|
|
316
321
|
}
|
|
317
|
-
function
|
|
322
|
+
function Re(e) {
|
|
318
323
|
return `suffix-${e.field}`;
|
|
319
324
|
}
|
|
320
|
-
function
|
|
325
|
+
function ze(e) {
|
|
321
326
|
let t = {
|
|
322
327
|
...x,
|
|
323
328
|
...e
|
|
324
329
|
};
|
|
325
330
|
L(t), m.value = t;
|
|
326
331
|
}
|
|
327
|
-
function
|
|
332
|
+
function Be(e) {
|
|
328
333
|
y.value = e;
|
|
329
334
|
}
|
|
330
|
-
async function
|
|
335
|
+
async function Ve() {
|
|
331
336
|
try {
|
|
332
337
|
return await h.value?.validate?.() !== !1;
|
|
333
338
|
} catch (e) {
|
|
@@ -338,52 +343,53 @@ var G = {
|
|
|
338
343
|
return !1;
|
|
339
344
|
}
|
|
340
345
|
}
|
|
341
|
-
function
|
|
346
|
+
function He() {
|
|
342
347
|
h.value?.resetFields?.();
|
|
343
|
-
let e =
|
|
348
|
+
let e = G(I.value, b.value);
|
|
344
349
|
L(e), m.value = e;
|
|
345
350
|
}
|
|
346
|
-
function
|
|
351
|
+
function Ue(e) {
|
|
347
352
|
h.value?.clearValidate?.(e);
|
|
348
353
|
}
|
|
349
|
-
function
|
|
354
|
+
function We(e) {
|
|
350
355
|
h.value?.scrollToField?.(e);
|
|
351
356
|
}
|
|
352
|
-
function
|
|
357
|
+
function Ge(e) {
|
|
353
358
|
return (h.value?.$el)?.querySelector(`[data-field="${e}"] input, [data-field="${e}"] textarea, [data-field="${e}"] select, [data-field="${e}"] button`) ?? void 0;
|
|
354
359
|
}
|
|
355
360
|
return n({
|
|
356
|
-
clearValidate:
|
|
357
|
-
getFieldComponent:
|
|
361
|
+
clearValidate: Ue,
|
|
362
|
+
getFieldComponent: Ge,
|
|
358
363
|
getFormElement: () => h.value?.$el,
|
|
359
364
|
getFormInstance: () => h.value,
|
|
360
365
|
getValues: () => S.value,
|
|
361
|
-
resetFields:
|
|
362
|
-
scrollToField:
|
|
363
|
-
setFieldValue:
|
|
364
|
-
setMode:
|
|
365
|
-
setValues:
|
|
366
|
-
validate:
|
|
366
|
+
resetFields: He,
|
|
367
|
+
scrollToField: We,
|
|
368
|
+
setFieldValue: Me,
|
|
369
|
+
setMode: Be,
|
|
370
|
+
setValues: ze,
|
|
371
|
+
validate: Ve
|
|
367
372
|
}), (t, n) => te((C(), o(k(le), {
|
|
368
373
|
ref_key: "formRef",
|
|
369
374
|
ref: h,
|
|
375
|
+
novalidate: "",
|
|
370
376
|
class: v(["lumal-schema-form", { "is-compact": l.compact }]),
|
|
371
377
|
disabled: l.disabled,
|
|
372
378
|
"label-position": l.labelPosition,
|
|
373
379
|
"label-width": l.labelWidth,
|
|
374
380
|
model: S.value,
|
|
375
|
-
onKeydown: ne(
|
|
376
|
-
onSubmit: F(
|
|
381
|
+
onKeydown: ne(Pe, ["enter"]),
|
|
382
|
+
onSubmit: F(Ne, ["prevent"])
|
|
377
383
|
}, {
|
|
378
384
|
default: P(() => [f(k(be), {
|
|
379
385
|
class: "lumal-schema-form__row",
|
|
380
386
|
gutter: l.gutter,
|
|
381
387
|
"data-columns": l.columns
|
|
382
388
|
}, {
|
|
383
|
-
default: P(() => [(C(!0), c(i, null, T(
|
|
389
|
+
default: P(() => [(C(!0), c(i, null, T(ie.value, (e) => te((C(), o(k(se), {
|
|
384
390
|
key: e.field,
|
|
385
|
-
span:
|
|
386
|
-
class: v({ "is-full-span":
|
|
391
|
+
span: Y(e),
|
|
392
|
+
class: v({ "is-full-span": Y(e) === 24 })
|
|
387
393
|
}, {
|
|
388
394
|
default: P(() => [f(k(ue), {
|
|
389
395
|
class: "lumal-schema-form__item",
|
|
@@ -394,24 +400,24 @@ var G = {
|
|
|
394
400
|
"data-field": e.field
|
|
395
401
|
}, {
|
|
396
402
|
default: P(() => [
|
|
397
|
-
E(t.$slots,
|
|
403
|
+
E(t.$slots, Le(e), {
|
|
398
404
|
model: S.value,
|
|
399
405
|
schema: e,
|
|
400
406
|
value: S.value[e.field]
|
|
401
407
|
}, void 0, !0),
|
|
402
|
-
E(t.$slots,
|
|
408
|
+
E(t.$slots, Ie(e), {
|
|
403
409
|
model: S.value,
|
|
404
410
|
schema: e,
|
|
405
411
|
value: S.value[e.field]
|
|
406
|
-
}, () => [y.value === "view" ? (C(), c("span",
|
|
412
|
+
}, () => [y.value === "view" ? (C(), c("span", K, O(Q(e)), 1)) : e.component === "textarea" ? (C(), o(k(de), g({
|
|
407
413
|
key: 1,
|
|
408
414
|
ref_for: !0
|
|
409
|
-
},
|
|
415
|
+
}, Z(e), {
|
|
410
416
|
id: e.id,
|
|
411
417
|
"model-value": B(e.field),
|
|
412
418
|
name: e.field,
|
|
413
419
|
placeholder: e.placeholder,
|
|
414
|
-
disabled:
|
|
420
|
+
disabled: J(e),
|
|
415
421
|
required: e.required,
|
|
416
422
|
type: "textarea",
|
|
417
423
|
"onUpdate:modelValue": (t) => $(e.field, t)
|
|
@@ -426,16 +432,16 @@ var G = {
|
|
|
426
432
|
])) : e.component === "select" ? (C(), o(k(xe), g({
|
|
427
433
|
key: 2,
|
|
428
434
|
ref_for: !0
|
|
429
|
-
},
|
|
435
|
+
}, Z(e), {
|
|
430
436
|
id: e.id,
|
|
431
|
-
"model-value":
|
|
437
|
+
"model-value": me(e.field),
|
|
432
438
|
name: e.field,
|
|
433
439
|
placeholder: e.placeholder,
|
|
434
|
-
disabled:
|
|
440
|
+
disabled: J(e),
|
|
435
441
|
required: e.required,
|
|
436
442
|
"onUpdate:modelValue": (t) => $(e.field, t)
|
|
437
443
|
}), {
|
|
438
|
-
default: P(() => [(C(!0), c(i, null, T(
|
|
444
|
+
default: P(() => [(C(!0), c(i, null, T(X(e), (e) => (C(), o(k(he), {
|
|
439
445
|
key: String(e.value),
|
|
440
446
|
label: e.label,
|
|
441
447
|
value: e.value,
|
|
@@ -457,12 +463,12 @@ var G = {
|
|
|
457
463
|
])) : e.component === "number" ? (C(), o(k(fe), g({
|
|
458
464
|
key: 3,
|
|
459
465
|
ref_for: !0
|
|
460
|
-
},
|
|
466
|
+
}, Z(e), {
|
|
461
467
|
id: e.id,
|
|
462
|
-
"model-value":
|
|
468
|
+
"model-value": _e(e.field),
|
|
463
469
|
name: e.field,
|
|
464
470
|
placeholder: e.placeholder,
|
|
465
|
-
disabled:
|
|
471
|
+
disabled: J(e),
|
|
466
472
|
"onUpdate:modelValue": (t) => $(e.field, t)
|
|
467
473
|
}), u({ _: 2 }, [e.prefix ? {
|
|
468
474
|
name: "prefix",
|
|
@@ -482,26 +488,26 @@ var G = {
|
|
|
482
488
|
])) : e.component === "switch" ? (C(), o(k(Se), g({
|
|
483
489
|
key: 4,
|
|
484
490
|
ref_for: !0
|
|
485
|
-
},
|
|
486
|
-
"model-value":
|
|
491
|
+
}, Z(e), {
|
|
492
|
+
"model-value": Ce(e.field),
|
|
487
493
|
name: e.field,
|
|
488
|
-
disabled:
|
|
494
|
+
disabled: J(e),
|
|
489
495
|
"onUpdate:modelValue": (t) => $(e.field, t)
|
|
490
496
|
}), null, 16, [
|
|
491
497
|
"model-value",
|
|
492
498
|
"name",
|
|
493
499
|
"disabled",
|
|
494
500
|
"onUpdate:modelValue"
|
|
495
|
-
])) : e.component === "date" || e.component === "datetime" || e.component === "daterange" ? (C(), o(k(
|
|
501
|
+
])) : e.component === "date" || e.component === "datetime" || e.component === "daterange" ? (C(), o(k(ce), g({
|
|
496
502
|
key: 5,
|
|
497
503
|
ref_for: !0
|
|
498
|
-
},
|
|
499
|
-
id:
|
|
500
|
-
"model-value":
|
|
501
|
-
name:
|
|
504
|
+
}, Z(e), {
|
|
505
|
+
id: Oe(e),
|
|
506
|
+
"model-value": De(e.field),
|
|
507
|
+
name: Ae(e),
|
|
502
508
|
placeholder: e.placeholder,
|
|
503
|
-
disabled:
|
|
504
|
-
type:
|
|
509
|
+
disabled: J(e),
|
|
510
|
+
type: V(e),
|
|
505
511
|
"onUpdate:modelValue": (t) => $(e.field, t)
|
|
506
512
|
}), null, 16, [
|
|
507
513
|
"id",
|
|
@@ -514,13 +520,13 @@ var G = {
|
|
|
514
520
|
])) : e.component === "radio" ? (C(), o(k(ye), g({
|
|
515
521
|
key: 6,
|
|
516
522
|
ref_for: !0
|
|
517
|
-
},
|
|
518
|
-
"model-value":
|
|
523
|
+
}, Z(e), {
|
|
524
|
+
"model-value": ge(e.field),
|
|
519
525
|
name: e.field,
|
|
520
|
-
disabled:
|
|
526
|
+
disabled: J(e),
|
|
521
527
|
"onUpdate:modelValue": (t) => $(e.field, t)
|
|
522
528
|
}), {
|
|
523
|
-
default: P(() => [(C(!0), c(i, null, T(
|
|
529
|
+
default: P(() => [(C(!0), c(i, null, T(X(e), (e) => (C(), o(k(ve), {
|
|
524
530
|
key: String(e.value),
|
|
525
531
|
value: e.value,
|
|
526
532
|
disabled: e.disabled
|
|
@@ -537,13 +543,13 @@ var G = {
|
|
|
537
543
|
])) : e.component === "checkbox" ? (C(), o(k(oe), g({
|
|
538
544
|
key: 7,
|
|
539
545
|
ref_for: !0
|
|
540
|
-
},
|
|
541
|
-
"model-value":
|
|
546
|
+
}, Z(e), {
|
|
547
|
+
"model-value": we(e.field),
|
|
542
548
|
name: e.field,
|
|
543
|
-
disabled:
|
|
549
|
+
disabled: J(e),
|
|
544
550
|
"onUpdate:modelValue": (t) => $(e.field, t)
|
|
545
551
|
}), {
|
|
546
|
-
default: P(() => [(C(!0), c(i, null, T(
|
|
552
|
+
default: P(() => [(C(!0), c(i, null, T(X(e), (e) => (C(), o(k(ae), {
|
|
547
553
|
key: String(e.value),
|
|
548
554
|
value: e.value,
|
|
549
555
|
disabled: e.disabled
|
|
@@ -560,12 +566,12 @@ var G = {
|
|
|
560
566
|
])) : e.component === "tree-select" ? (C(), o(k(Te), g({
|
|
561
567
|
key: 8,
|
|
562
568
|
ref_for: !0
|
|
563
|
-
},
|
|
569
|
+
}, Z(e), {
|
|
564
570
|
id: e.id,
|
|
565
|
-
"model-value":
|
|
571
|
+
"model-value": H(e.field),
|
|
566
572
|
name: e.field,
|
|
567
573
|
placeholder: e.placeholder,
|
|
568
|
-
disabled:
|
|
574
|
+
disabled: J(e),
|
|
569
575
|
"onUpdate:modelValue": (t) => $(e.field, t)
|
|
570
576
|
}), null, 16, [
|
|
571
577
|
"id",
|
|
@@ -577,7 +583,7 @@ var G = {
|
|
|
577
583
|
])) : e.component === "upload" ? (C(), o(k(Ee), g({
|
|
578
584
|
key: 9,
|
|
579
585
|
ref_for: !0
|
|
580
|
-
},
|
|
586
|
+
}, Z(e), { disabled: J(e) }), {
|
|
581
587
|
default: P(() => [f(k(R), { type: "primary" }, {
|
|
582
588
|
default: P(() => [...n[0] ||= [d(" 上传 ", -1)]]),
|
|
583
589
|
_: 1
|
|
@@ -586,13 +592,13 @@ var G = {
|
|
|
586
592
|
}, 16, ["disabled"])) : (C(), o(k(de), g({
|
|
587
593
|
key: 10,
|
|
588
594
|
ref_for: !0
|
|
589
|
-
},
|
|
595
|
+
}, Z(e), {
|
|
590
596
|
id: e.id,
|
|
591
597
|
"model-value": B(e.field),
|
|
592
598
|
name: e.field,
|
|
593
|
-
type:
|
|
599
|
+
type: U(e),
|
|
594
600
|
placeholder: e.placeholder,
|
|
595
|
-
disabled:
|
|
601
|
+
disabled: J(e),
|
|
596
602
|
required: e.required,
|
|
597
603
|
"onUpdate:modelValue": (t) => $(e.field, t)
|
|
598
604
|
}), u({ _: 2 }, [
|
|
@@ -626,13 +632,13 @@ var G = {
|
|
|
626
632
|
"required",
|
|
627
633
|
"onUpdate:modelValue"
|
|
628
634
|
]))], !0),
|
|
629
|
-
E(t.$slots,
|
|
635
|
+
E(t.$slots, Re(e), {
|
|
630
636
|
model: S.value,
|
|
631
637
|
schema: e,
|
|
632
638
|
value: S.value[e.field]
|
|
633
639
|
}, void 0, !0),
|
|
634
|
-
e.description ? (C(), c("p",
|
|
635
|
-
e.help ? (C(), c("p",
|
|
640
|
+
e.description ? (C(), c("p", ke, O(e.description), 1)) : s("", !0),
|
|
641
|
+
e.help ? (C(), c("p", q, O(e.help), 1)) : s("", !0)
|
|
636
642
|
]),
|
|
637
643
|
_: 2
|
|
638
644
|
}, 1032, [
|
|
@@ -643,7 +649,7 @@ var G = {
|
|
|
643
649
|
"data-field"
|
|
644
650
|
])]),
|
|
645
651
|
_: 2
|
|
646
|
-
}, 1032, ["span", "class"]))), 128))]),
|
|
652
|
+
}, 1032, ["span", "class"])), [[M, e.visible]])), 128))]),
|
|
647
653
|
_: 3
|
|
648
654
|
}, 8, ["gutter", "data-columns"]), e.showActions && y.value !== "view" ? (C(), c("div", {
|
|
649
655
|
key: 0,
|
|
@@ -652,7 +658,7 @@ var G = {
|
|
|
652
658
|
key: 0,
|
|
653
659
|
"native-type": "button",
|
|
654
660
|
disabled: e.submitLoading,
|
|
655
|
-
onClick:
|
|
661
|
+
onClick: Fe
|
|
656
662
|
}, {
|
|
657
663
|
default: P(() => [d(O(e.resetText), 1)]),
|
|
658
664
|
_: 1
|
|
@@ -660,7 +666,7 @@ var G = {
|
|
|
660
666
|
type: "primary",
|
|
661
667
|
"native-type": "submit",
|
|
662
668
|
loading: e.submitLoading,
|
|
663
|
-
disabled: e.submitLoading
|
|
669
|
+
disabled: e.submitLoading || e.submitDisabled
|
|
664
670
|
}, {
|
|
665
671
|
default: P(() => [d(O(e.submitText), 1)]),
|
|
666
672
|
_: 1
|
|
@@ -674,13 +680,13 @@ var G = {
|
|
|
674
680
|
"model"
|
|
675
681
|
])), [[k(_), l.loading]]);
|
|
676
682
|
}
|
|
677
|
-
}), [["__scopeId", "data-v-
|
|
683
|
+
}), [["__scopeId", "data-v-06645e2b"]]);
|
|
678
684
|
//#endregion
|
|
679
685
|
//#region src/components/schema-table/cell.ts
|
|
680
|
-
function
|
|
686
|
+
function J(e) {
|
|
681
687
|
return e == null || typeof e == "boolean" || typeof e == "number" || typeof e == "string" || Array.isArray(e) && e.every((e) => typeof e == "boolean" || typeof e == "number" || typeof e == "string");
|
|
682
688
|
}
|
|
683
|
-
function
|
|
689
|
+
function Y(t, n, r = e(t)) {
|
|
684
690
|
let i = (Array.isArray(n) ? n : [n]).map((e, t) => {
|
|
685
691
|
let n = r.get(String(e));
|
|
686
692
|
return {
|
|
@@ -691,7 +697,7 @@ function J(t, n, r = e(t)) {
|
|
|
691
697
|
});
|
|
692
698
|
return i.some((e) => e.color) ? i : [];
|
|
693
699
|
}
|
|
694
|
-
function
|
|
700
|
+
function X(e, t, r, i = [], a) {
|
|
695
701
|
let o = e[t.field], s = t.formatter?.(o, e, r) ?? o;
|
|
696
702
|
return s == null || s === "" || Array.isArray(s) && s.length === 0 ? {
|
|
697
703
|
tags: [],
|
|
@@ -699,8 +705,8 @@ function Y(e, t, r, i = [], a) {
|
|
|
699
705
|
} : t.formatter ? {
|
|
700
706
|
tags: [],
|
|
701
707
|
text: String(s)
|
|
702
|
-
} : i.length > 0 &&
|
|
703
|
-
tags:
|
|
708
|
+
} : i.length > 0 && J(s) ? {
|
|
709
|
+
tags: Y(i, s, a),
|
|
704
710
|
text: n(i, s, a)
|
|
705
711
|
} : {
|
|
706
712
|
tags: [],
|
|
@@ -709,30 +715,30 @@ function Y(e, t, r, i = [], a) {
|
|
|
709
715
|
}
|
|
710
716
|
//#endregion
|
|
711
717
|
//#region src/components/schema-table/LumalSchemaTableCell.vue?vue&type=script&setup=true&lang.ts
|
|
712
|
-
var
|
|
718
|
+
var Z = {
|
|
713
719
|
key: 0,
|
|
714
720
|
class: "lumal-schema-table__dictionary-tags"
|
|
715
|
-
},
|
|
721
|
+
}, Q = {
|
|
716
722
|
key: 0,
|
|
717
723
|
class: "lumal-schema-table__dictionary-dot",
|
|
718
724
|
"aria-hidden": "true"
|
|
719
|
-
},
|
|
725
|
+
}, je = { key: 1 }, Me = /*#__PURE__*/ r(/* @__PURE__ */ p({
|
|
720
726
|
__name: "LumalSchemaTableCell",
|
|
721
727
|
props: { display: {} },
|
|
722
728
|
setup(e) {
|
|
723
729
|
function t(e) {
|
|
724
730
|
return e.color ? { "--lumal-dictionary-color": e.color } : void 0;
|
|
725
731
|
}
|
|
726
|
-
return (n, r) => e.display.tags.length ? (C(), c("div",
|
|
732
|
+
return (n, r) => e.display.tags.length ? (C(), c("div", Z, [(C(!0), c(i, null, T(e.display.tags, (e) => (C(), c("span", {
|
|
727
733
|
key: e.key,
|
|
728
734
|
class: "lumal-schema-table__dictionary-tag",
|
|
729
735
|
style: b(t(e))
|
|
730
|
-
}, [e.color ? (C(), c("span",
|
|
736
|
+
}, [e.color ? (C(), c("span", Q)) : s("", !0), l("span", null, O(e.label), 1)], 4))), 128))])) : (C(), c("span", je, O(e.display.text), 1));
|
|
731
737
|
}
|
|
732
738
|
}), [["__scopeId", "data-v-1569bd9d"]]);
|
|
733
739
|
//#endregion
|
|
734
740
|
//#region src/components/schema-table/normalize.ts
|
|
735
|
-
function
|
|
741
|
+
function $(e, t) {
|
|
736
742
|
return typeof e == "function" ? !!e(t) : !!e;
|
|
737
743
|
}
|
|
738
744
|
function Ne(e, t) {
|
|
@@ -748,7 +754,7 @@ function Pe(e = [], t = {}) {
|
|
|
748
754
|
align: e.align ?? "left",
|
|
749
755
|
componentProps: e.componentProps ?? {},
|
|
750
756
|
emptyText: e.emptyText ?? "-",
|
|
751
|
-
renderable: (typeof e.hidden == "function" ||
|
|
757
|
+
renderable: (typeof e.hidden == "function" || !$(e.hidden, n)) && Ne(e, t)
|
|
752
758
|
}));
|
|
753
759
|
}
|
|
754
760
|
//#endregion
|
|
@@ -893,19 +899,19 @@ var Fe = {
|
|
|
893
899
|
"sortChange"
|
|
894
900
|
], ["update:page", "update:pageSize"]),
|
|
895
901
|
setup(n, { expose: r, emit: u }) {
|
|
896
|
-
let p = n, m = u, h = ee(n, "page"), v = ee(n, "pageSize"), y = pe.directive, b = j("containerRef"), w = j("tableRef"), A = D(/* @__PURE__ */ new Set()), M = D([]),
|
|
902
|
+
let p = n, m = u, h = ee(n, "page"), v = ee(n, "pageSize"), y = pe.directive, b = j("containerRef"), w = j("tableRef"), A = D(/* @__PURE__ */ new Set()), M = D([]), I = D([]), ie = D([]), L = D(typeof window < "u" && window.innerWidth <= 768), R = D(null), oe, se, ce = "", z = a(() => Pe(p.columns, { canAccess: p.canAccess })), B = a(() => {
|
|
897
903
|
let e = M.value;
|
|
898
|
-
if (e.length === 0) return
|
|
904
|
+
if (e.length === 0) return z.value;
|
|
899
905
|
let t = new Map(e.map((e, t) => [e, t]));
|
|
900
|
-
return [...
|
|
901
|
-
}), le = a(() =>
|
|
902
|
-
let n =
|
|
906
|
+
return [...z.value].sort((e, n) => (t.get(String(e.field)) ?? 2 ** 53 - 1) - (t.get(String(n.field)) ?? 2 ** 53 - 1));
|
|
907
|
+
}), le = a(() => B.value.filter((e) => e.renderable && !A.value.has(String(e.field)))), ue = a(() => B.value.filter((e) => e.renderable && !e.fixed && e.configurable !== !1)), de = a(() => [...le.value].reverse().find((e) => !e.fixed)?.field), { dictionaryMap: fe } = t(() => z.value.map((e) => e.dictionary ?? e.dictType)), me = a(() => new Map(z.value.map((t) => {
|
|
908
|
+
let n = K(t);
|
|
903
909
|
return [String(t.field), e(n)];
|
|
904
910
|
}))), he = a(() => new Map(p.rows.map((e, t) => [e, t]))), ge = a(() => {
|
|
905
911
|
if (typeof p.rowKey != "function") return p.rowKey;
|
|
906
912
|
let e = p.rowKey, t = he.value;
|
|
907
913
|
return (n) => String(e(n, t.get(n) ?? -1));
|
|
908
|
-
}), ve = a(() => p.pagination && p.total > 0), ye = a(() => p.showColumnSettings || p.columnSettings?.enabled), be = a(() =>
|
|
914
|
+
}), ve = a(() => p.pagination && p.total > 0), ye = a(() => p.showColumnSettings || p.columnSettings?.enabled), be = a(() => L.value ? p.mobileActionWidth : p.actionWidth), xe = a(() => p.error instanceof Error ? p.error.message || p.errorText : typeof p.error == "string" ? p.error : p.errorText), Se = a(() => p.defaultExpandAll ?? !!p.tableProps.defaultExpandAll), Te = a(() => p.treeProps ?? p.tableProps.treeProps ?? {
|
|
909
915
|
children: "children",
|
|
910
916
|
hasChildren: "hasChildren"
|
|
911
917
|
});
|
|
@@ -916,29 +922,29 @@ var Fe = {
|
|
|
916
922
|
if (ue.value.filter((e) => !t.has(String(e.field))).length <= 1) return;
|
|
917
923
|
t.add(e);
|
|
918
924
|
}
|
|
919
|
-
A.value = t,
|
|
925
|
+
A.value = t, W(), _(() => w.value?.doLayout?.());
|
|
920
926
|
}
|
|
921
|
-
function
|
|
922
|
-
A.value = /* @__PURE__ */ new Set(), M.value =
|
|
927
|
+
function V() {
|
|
928
|
+
A.value = /* @__PURE__ */ new Set(), M.value = z.value.map((e) => String(e.field)), W(), _(() => w.value?.doLayout?.());
|
|
923
929
|
}
|
|
924
|
-
function
|
|
930
|
+
function H(e, t) {
|
|
925
931
|
let n = ue.value.map((e) => String(e.field)), r = n.indexOf(e), i = r + t;
|
|
926
932
|
if (r < 0 || i < 0 || i >= n.length) return;
|
|
927
|
-
let a = n[i], o =
|
|
928
|
-
o.splice(s, 1), o.splice(c, 0, e), M.value = o,
|
|
933
|
+
let a = n[i], o = B.value.map((e) => String(e.field)), s = o.indexOf(e), c = o.indexOf(a);
|
|
934
|
+
o.splice(s, 1), o.splice(c, 0, e), M.value = o, W(), _(() => w.value?.doLayout?.());
|
|
929
935
|
}
|
|
930
|
-
function
|
|
931
|
-
|
|
936
|
+
function U(e) {
|
|
937
|
+
ce = e;
|
|
932
938
|
}
|
|
933
|
-
function
|
|
934
|
-
if (!
|
|
935
|
-
|
|
939
|
+
function Oe(e) {
|
|
940
|
+
if (!ce || ce === e) {
|
|
941
|
+
ce = "";
|
|
936
942
|
return;
|
|
937
943
|
}
|
|
938
|
-
let t =
|
|
939
|
-
n >= 0 && r >= 0 && (t.splice(n, 1), t.splice(r, 0,
|
|
944
|
+
let t = B.value.map((e) => String(e.field)), n = t.indexOf(ce), r = t.indexOf(e);
|
|
945
|
+
n >= 0 && r >= 0 && (t.splice(n, 1), t.splice(r, 0, ce), M.value = t, W(), _(() => w.value?.doLayout?.())), ce = "";
|
|
940
946
|
}
|
|
941
|
-
function
|
|
947
|
+
function W() {
|
|
942
948
|
let e = p.columnSettings?.storageKey;
|
|
943
949
|
if (!(!e || typeof localStorage > "u")) try {
|
|
944
950
|
localStorage.setItem(e, JSON.stringify({
|
|
@@ -947,70 +953,70 @@ var Fe = {
|
|
|
947
953
|
}));
|
|
948
954
|
} catch {}
|
|
949
955
|
}
|
|
950
|
-
function
|
|
951
|
-
M.value =
|
|
956
|
+
function G() {
|
|
957
|
+
M.value = z.value.map((e) => String(e.field));
|
|
952
958
|
let e = p.columnSettings?.storageKey;
|
|
953
959
|
if (!(!e || typeof localStorage > "u")) try {
|
|
954
|
-
let t = JSON.parse(localStorage.getItem(e) ?? "{}"), n = new Set(
|
|
960
|
+
let t = JSON.parse(localStorage.getItem(e) ?? "{}"), n = new Set(z.value.map((e) => String(e.field)));
|
|
955
961
|
A.value = new Set((t.hidden ?? []).filter((e) => n.has(e))), M.value = [...(t.order ?? []).filter((e) => n.has(e)), ...[...n].filter((e) => !(t.order ?? []).includes(e))];
|
|
956
962
|
} catch {
|
|
957
|
-
|
|
963
|
+
V();
|
|
958
964
|
}
|
|
959
965
|
}
|
|
960
|
-
function
|
|
966
|
+
function K(e) {
|
|
961
967
|
let t = e.dictionary ?? e.dictType;
|
|
962
968
|
return t ? fe.value[t] ?? [] : k(e.options) ?? [];
|
|
963
969
|
}
|
|
964
|
-
function
|
|
970
|
+
function ke(e, t, n) {
|
|
965
971
|
return typeof t.hidden == "function" && !!t.hidden({
|
|
966
972
|
rows: p.rows,
|
|
967
973
|
row: e,
|
|
968
974
|
index: n
|
|
969
975
|
});
|
|
970
976
|
}
|
|
971
|
-
function
|
|
972
|
-
return
|
|
977
|
+
function q(e, t, n) {
|
|
978
|
+
return X(e, t, n, K(t), me.value.get(String(t.field)));
|
|
973
979
|
}
|
|
974
|
-
function
|
|
975
|
-
return (t, n, r, i) =>
|
|
980
|
+
function Ae(e) {
|
|
981
|
+
return (t, n, r, i) => ke(t, e, i) ? "" : q(t, e, i).text;
|
|
976
982
|
}
|
|
977
|
-
let
|
|
978
|
-
function
|
|
979
|
-
return
|
|
983
|
+
let J = a(() => new Map(z.value.map((e) => [String(e.field), Ae(e)])));
|
|
984
|
+
function Y(e) {
|
|
985
|
+
return J.value.get(String(e.field));
|
|
980
986
|
}
|
|
981
|
-
function
|
|
987
|
+
function Z(e) {
|
|
982
988
|
if (!p.scaleColumnWidth) return;
|
|
983
989
|
let t = e.minWidth ?? e.componentProps.minWidth;
|
|
984
990
|
return e.field === de.value ? t ?? e.width ?? e.componentProps.width : t;
|
|
985
991
|
}
|
|
986
|
-
function
|
|
992
|
+
function Q(e) {
|
|
987
993
|
if (!(!p.scaleColumnWidth || e.field === de.value)) return e.width;
|
|
988
994
|
}
|
|
989
|
-
function
|
|
995
|
+
function je(e, t) {
|
|
990
996
|
if (typeof p.rowKey == "function") return p.rowKey(e, t);
|
|
991
997
|
let n = p.rowKey ? e[p.rowKey] : void 0;
|
|
992
998
|
return typeof n == "string" || typeof n == "number" ? n : void 0;
|
|
993
999
|
}
|
|
994
|
-
function
|
|
995
|
-
let n =
|
|
1000
|
+
function $(e, t) {
|
|
1001
|
+
let n = je(e, t);
|
|
996
1002
|
return n === void 0 ? `index:${t}` : `row:${typeof n}:${n}`;
|
|
997
1003
|
}
|
|
998
1004
|
function Ne(e, t) {
|
|
999
|
-
return R.value ===
|
|
1005
|
+
return R.value === $(e, t);
|
|
1000
1006
|
}
|
|
1001
1007
|
function Ze(e, t, n) {
|
|
1002
|
-
let r =
|
|
1008
|
+
let r = $(e, t);
|
|
1003
1009
|
n ? R.value = r : R.value === r && (R.value = null);
|
|
1004
1010
|
}
|
|
1005
1011
|
function Qe(e, t) {
|
|
1006
|
-
let n =
|
|
1012
|
+
let n = $(e, t);
|
|
1007
1013
|
R.value = R.value === n ? null : n;
|
|
1008
1014
|
}
|
|
1009
1015
|
function $e() {
|
|
1010
1016
|
R.value = null;
|
|
1011
1017
|
}
|
|
1012
1018
|
function et(e) {
|
|
1013
|
-
|
|
1019
|
+
I.value = e, ie.value = e.map((e) => je(e, he.value.get(e) ?? -1)).filter((e) => e !== void 0), m("selectionChange", e, ie.value);
|
|
1014
1020
|
}
|
|
1015
1021
|
function tt(e) {
|
|
1016
1022
|
m("pageChange", e);
|
|
@@ -1027,34 +1033,34 @@ var Fe = {
|
|
|
1027
1033
|
function at() {
|
|
1028
1034
|
if (typeof window > "u") return;
|
|
1029
1035
|
let e = window.innerWidth <= 768;
|
|
1030
|
-
e !==
|
|
1036
|
+
e !== L.value && (L.value = e, e || $e(), _(() => w.value?.doLayout?.()));
|
|
1031
1037
|
}
|
|
1032
1038
|
function ot(e) {
|
|
1033
1039
|
e.key === "Escape" && $e();
|
|
1034
1040
|
}
|
|
1035
1041
|
function st() {
|
|
1036
1042
|
!p.autoResize || typeof ResizeObserver > "u" || !b.value || (oe = new ResizeObserver(() => {
|
|
1037
|
-
|
|
1038
|
-
|
|
1043
|
+
se && clearTimeout(se), se = setTimeout(() => {
|
|
1044
|
+
se = void 0, w.value?.doLayout?.();
|
|
1039
1045
|
});
|
|
1040
1046
|
}), oe.observe(b.value));
|
|
1041
1047
|
}
|
|
1042
1048
|
function ct() {
|
|
1043
|
-
oe?.disconnect(), oe = void 0,
|
|
1049
|
+
oe?.disconnect(), oe = void 0, se &&= (clearTimeout(se), void 0);
|
|
1044
1050
|
}
|
|
1045
1051
|
return N(() => p.autoResize, () => {
|
|
1046
1052
|
ct(), st();
|
|
1047
|
-
}), N(() => [p.columns.map((e) => String(e.field)).join("\0"), p.columnSettings?.storageKey],
|
|
1053
|
+
}), N(() => [p.columns.map((e) => String(e.field)).join("\0"), p.columnSettings?.storageKey], G), N(R, (e) => {
|
|
1048
1054
|
typeof document > "u" || (document.removeEventListener("keydown", ot), e !== null && document.addEventListener("keydown", ot));
|
|
1049
1055
|
}), S(() => {
|
|
1050
|
-
|
|
1056
|
+
G(), at(), st(), window.addEventListener("resize", at);
|
|
1051
1057
|
}), x(() => {
|
|
1052
1058
|
ct(), window.removeEventListener("resize", at), document.removeEventListener("keydown", ot);
|
|
1053
1059
|
}), r({
|
|
1054
1060
|
clearSelection: () => w.value?.clearSelection?.(),
|
|
1055
1061
|
doLayout: () => w.value?.doLayout?.(),
|
|
1056
|
-
getSelectedRowKeys: () => [...
|
|
1057
|
-
getSelectedRows: () => [...
|
|
1062
|
+
getSelectedRowKeys: () => [...ie.value],
|
|
1063
|
+
getSelectedRows: () => [...I.value],
|
|
1058
1064
|
getColumnOrder: () => [...M.value],
|
|
1059
1065
|
getExportData: (e = p.rows) => {
|
|
1060
1066
|
let t = new Map(e.map((e, t) => [e, t]));
|
|
@@ -1063,11 +1069,11 @@ var Fe = {
|
|
|
1063
1069
|
field: String(e.field),
|
|
1064
1070
|
label: e.label
|
|
1065
1071
|
})),
|
|
1066
|
-
rows: e.map((e) => le.value.map((n) =>
|
|
1072
|
+
rows: e.map((e) => le.value.map((n) => q(e, n, t.get(e) ?? -1).text))
|
|
1067
1073
|
};
|
|
1068
1074
|
},
|
|
1069
1075
|
getVisibleColumns: () => [...le.value],
|
|
1070
|
-
resetColumnSettings:
|
|
1076
|
+
resetColumnSettings: V,
|
|
1071
1077
|
getTableElement: () => w.value?.$el,
|
|
1072
1078
|
getTableInstance: () => w.value,
|
|
1073
1079
|
toggleRowSelection: (e, t) => w.value?.toggleRowSelection?.(e, t)
|
|
@@ -1079,16 +1085,16 @@ var Fe = {
|
|
|
1079
1085
|
e.$slots["toolbar-title"] || e.$slots.toolbar || e.$slots["toolbar-tools"] || ye.value ? (C(), c("div", Fe, [
|
|
1080
1086
|
e.$slots["toolbar-title"] ? (C(), c("div", Ie, [E(e.$slots, "toolbar-title", {}, void 0, !0)])) : s("", !0),
|
|
1081
1087
|
e.$slots.toolbar ? (C(), c("div", Le, [E(e.$slots, "toolbar", {}, void 0, !0)])) : s("", !0),
|
|
1082
|
-
e.$slots["toolbar-tools"] || ye.value ? (C(), c("div", Re, [E(e.$slots, "toolbar-tools", {}, void 0, !0), ye.value ? (C(), c("div", ze, [l("details", null, [l("summary", Be, [f(k(
|
|
1088
|
+
e.$slots["toolbar-tools"] || ye.value ? (C(), c("div", Re, [E(e.$slots, "toolbar-tools", {}, void 0, !0), ye.value ? (C(), c("div", ze, [l("details", null, [l("summary", Be, [f(k(re), { name: "lumal:grid" })]), l("div", Ve, [l("div", { class: "lumal-schema-table__column-options-header" }, [t[6] ||= l("strong", null, "列设置", -1), l("button", {
|
|
1083
1089
|
type: "button",
|
|
1084
|
-
onClick:
|
|
1090
|
+
onClick: V
|
|
1085
1091
|
}, " 恢复默认 ")]), (C(!0), c(i, null, T(ue.value, (e, r) => (C(), c("div", {
|
|
1086
1092
|
key: String(e.field),
|
|
1087
1093
|
class: "lumal-schema-table__column-option",
|
|
1088
1094
|
draggable: n.columnSettings?.reorderable !== !1,
|
|
1089
|
-
onDragstart: (t) =>
|
|
1095
|
+
onDragstart: (t) => U(String(e.field)),
|
|
1090
1096
|
onDragover: t[0] ||= F(() => {}, ["prevent"]),
|
|
1091
|
-
onDrop: (t) =>
|
|
1097
|
+
onDrop: (t) => Oe(String(e.field))
|
|
1092
1098
|
}, [f(k(ae), {
|
|
1093
1099
|
"model-value": !A.value.has(String(e.field)),
|
|
1094
1100
|
"onUpdate:modelValue": (t) => Ee(String(e.field))
|
|
@@ -1100,14 +1106,14 @@ var Fe = {
|
|
|
1100
1106
|
disabled: r === 0,
|
|
1101
1107
|
"aria-label": `上移${e.label}`,
|
|
1102
1108
|
title: `上移${e.label}`,
|
|
1103
|
-
onClick: (t) =>
|
|
1104
|
-
}, [f(k(
|
|
1109
|
+
onClick: (t) => H(String(e.field), -1)
|
|
1110
|
+
}, [f(k(re), { name: "lumal:arrow-up" })], 8, We), l("button", {
|
|
1105
1111
|
type: "button",
|
|
1106
1112
|
disabled: r === ue.value.length - 1,
|
|
1107
1113
|
"aria-label": `下移${e.label}`,
|
|
1108
1114
|
title: `下移${e.label}`,
|
|
1109
|
-
onClick: (t) =>
|
|
1110
|
-
}, [f(k(
|
|
1115
|
+
onClick: (t) => H(String(e.field), 1)
|
|
1116
|
+
}, [f(k(re), { name: "lumal:arrow-down" })], 8, Ge)]))], 40, He))), 128))])])])) : s("", !0)])) : s("", !0)
|
|
1111
1117
|
])) : s("", !0),
|
|
1112
1118
|
n.error ? (C(), c("div", Ke, [l("span", null, O(xe.value), 1), l("button", {
|
|
1113
1119
|
type: "button",
|
|
@@ -1149,21 +1155,21 @@ var Fe = {
|
|
|
1149
1155
|
prop: String(t.field),
|
|
1150
1156
|
label: t.label,
|
|
1151
1157
|
align: t.align,
|
|
1152
|
-
width:
|
|
1153
|
-
"min-width":
|
|
1158
|
+
width: Q(t),
|
|
1159
|
+
"min-width": Z(t),
|
|
1154
1160
|
fixed: t.fixed,
|
|
1155
1161
|
resizable: n.columnResizable,
|
|
1156
1162
|
"show-overflow-tooltip": t.showOverflowTooltip ?? !0,
|
|
1157
|
-
formatter:
|
|
1163
|
+
formatter: Y(t),
|
|
1158
1164
|
"data-field": String(t.field)
|
|
1159
1165
|
}), {
|
|
1160
|
-
default: P(({ row: n, $index: r }) => [
|
|
1166
|
+
default: P(({ row: n, $index: r }) => [ke(n, t, r) ? s("", !0) : E(e.$slots, `table-${String(t.field)}`, {
|
|
1161
1167
|
key: 0,
|
|
1162
1168
|
row: n,
|
|
1163
1169
|
index: r,
|
|
1164
1170
|
column: t,
|
|
1165
1171
|
value: n[t.field]
|
|
1166
|
-
}, () => [f(
|
|
1172
|
+
}, () => [f(Me, { display: q(n, t, r) }, null, 8, ["display"])], !0)]),
|
|
1167
1173
|
_: 2
|
|
1168
1174
|
}, 1040, [
|
|
1169
1175
|
"prop",
|
|
@@ -1270,7 +1276,7 @@ var Fe = {
|
|
|
1270
1276
|
emits: ["update:modelValue"],
|
|
1271
1277
|
setup(e) {
|
|
1272
1278
|
let t = ee(e, "modelValue");
|
|
1273
|
-
return (n, r) => e.type === "drawer" ? (C(), o(k(
|
|
1279
|
+
return (n, r) => e.type === "drawer" ? (C(), o(k(B), {
|
|
1274
1280
|
key: 0,
|
|
1275
1281
|
modelValue: t.value,
|
|
1276
1282
|
"onUpdate:modelValue": r[0] ||= (e) => t.value = e,
|
|
@@ -1291,7 +1297,7 @@ var Fe = {
|
|
|
1291
1297
|
"close-on-click-modal",
|
|
1292
1298
|
"destroy-on-close",
|
|
1293
1299
|
"before-close"
|
|
1294
|
-
])) : (C(), o(k(
|
|
1300
|
+
])) : (C(), o(k(z), {
|
|
1295
1301
|
key: 1,
|
|
1296
1302
|
modelValue: t.value,
|
|
1297
1303
|
"onUpdate:modelValue": r[1] ||= (e) => t.value = e,
|
|
@@ -1433,7 +1439,7 @@ function it(e) {
|
|
|
1433
1439
|
//#endregion
|
|
1434
1440
|
//#region src/components/crud-table/useCrudQuery.ts
|
|
1435
1441
|
function at(e) {
|
|
1436
|
-
let t = D(e.defaultCollapsed.value), n = a(() => W(
|
|
1442
|
+
let t = D(e.defaultCollapsed.value), n = a(() => G(W(e.schemas.value))), r = a(() => {
|
|
1437
1443
|
if (!e.collapsible.value || !t.value) return e.schemas.value;
|
|
1438
1444
|
let n = 24 / e.columns.value, r = e.columns.value * e.collapsedRows.value, i = 0;
|
|
1439
1445
|
return e.schemas.value.filter((e) => {
|
|
@@ -1549,77 +1555,77 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1549
1555
|
"update:pageSize"
|
|
1550
1556
|
]),
|
|
1551
1557
|
setup(e, { expose: t, emit: n }) {
|
|
1552
|
-
let r = e, i = n, p = ee(e, "queryModel"), h = ee(e, "page"), g = ee(e, "pageSize"), b = j("crudRef"), w = j("queryRef"), A = j("queryFormRef"), ne = j("dialogFormRef"), F = j("tableRef"),
|
|
1558
|
+
let r = e, i = n, p = ee(e, "queryModel"), h = ee(e, "page"), g = ee(e, "pageSize"), b = j("crudRef"), w = j("queryRef"), A = j("queryFormRef"), ne = j("dialogFormRef"), F = j("tableRef"), I = a(() => r.query?.schemas ?? r.querySchemas), ie = a(() => r.table?.columns ?? r.columns), L = a(() => ie.value.filter((e) => e.showInTable !== !1)), ae = a(() => $e(ie.value, r.formSchemas)), oe = a(() => r.table?.rowKey ?? r.rowKey), se = a(() => r.table?.selection ?? r.selection), ce = a(() => r.table?.emptyText ?? r.emptyText), z = D(3), B = a(() => Math.max(1, r.query?.columns ?? z.value)), le = a(() => r.query?.collapsible ?? !1), ue = a(() => r.query?.defaultCollapsed ?? !0), de = a(() => Math.max(1, r.query?.collapsedRows ?? 1)), fe = a(() => typeof r.pagination == "object" ? r.pagination.enabled !== !1 : r.pagination), pe = a(() => typeof r.pagination == "object" ? r.pagination.pageSizes ?? r.pageSizes : r.pageSizes), he = a(() => I.value.length > 0), ge = a(() => ae.value.length > 0), _e = a(() => ge.value && r.toolbar?.create !== !1), ve = a(() => se.value && r.toolbar?.batchDelete !== !1), ye = a(() => !!r.dataSource && r.toolbar?.refresh !== !1), be = a(() => !!r.toolbar?.export), xe = a(() => r.toolbar?.fullscreen !== !1), Se = a(() => he.value && r.toolbar?.queryToggle !== !1), Ce = a(() => _e.value || ve.value || be.value), we = a(() => Se.value || ye.value || xe.value), Te = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(max-width: 768px)").matches, Ee = {
|
|
1553
1559
|
desktop: r.query?.defaultVisible ?? !0,
|
|
1554
1560
|
mobile: r.query?.mobileDefaultVisible ?? r.query?.defaultVisible ?? !0
|
|
1555
|
-
},
|
|
1556
|
-
dataSource:
|
|
1561
|
+
}, V = a(() => r.dataSource), H = D(!1), U = D(!1), Oe = D(Te), W = a(() => Oe.value ? "mobile" : "desktop"), G = D(Ee), K = D(Ee[Te ? "mobile" : "desktop"]), ke, q, J, Y = tt({
|
|
1562
|
+
dataSource: V,
|
|
1557
1563
|
loading: a(() => r.loading),
|
|
1558
1564
|
page: h,
|
|
1559
1565
|
pageSize: g,
|
|
1560
1566
|
queryModel: p,
|
|
1561
1567
|
rows: a(() => r.rows),
|
|
1562
1568
|
total: a(() => r.total)
|
|
1563
|
-
}),
|
|
1569
|
+
}), X = at({
|
|
1564
1570
|
collapsedRows: de,
|
|
1565
1571
|
collapsible: le,
|
|
1566
|
-
columns:
|
|
1572
|
+
columns: B,
|
|
1567
1573
|
defaultCollapsed: ue,
|
|
1568
1574
|
model: p,
|
|
1569
|
-
schemas:
|
|
1570
|
-
}),
|
|
1571
|
-
dataSource:
|
|
1572
|
-
afterSave:
|
|
1573
|
-
}),
|
|
1575
|
+
schemas: I
|
|
1576
|
+
}), Z = ot(), Q = it({
|
|
1577
|
+
dataSource: V,
|
|
1578
|
+
afterSave: Y.load
|
|
1579
|
+
}), je = a(() => Y.currentLoading.value || H.value), Me = a(() => fe.value && Y.currentTotal.value > 0), $ = a(() => ({
|
|
1574
1580
|
create: r.editor?.createTitle ?? r.toolbar?.createText ?? r.createText,
|
|
1575
1581
|
edit: r.editor?.editTitle ?? "编辑",
|
|
1576
1582
|
view: r.editor?.viewTitle ?? "查看"
|
|
1577
|
-
})[
|
|
1578
|
-
N(() => r.dataSource, () => void
|
|
1583
|
+
})[Q.mode.value]);
|
|
1584
|
+
N(() => r.dataSource, () => void Y.load(), { immediate: !0 }), N([h, g], () => void Y.load());
|
|
1579
1585
|
function Ne() {
|
|
1580
|
-
|
|
1586
|
+
U.value = typeof document < "u" && document.fullscreenElement === b.value;
|
|
1581
1587
|
}
|
|
1582
1588
|
function Pe(e) {
|
|
1583
1589
|
if (r.query?.columns !== void 0 || e <= 0) return;
|
|
1584
1590
|
let t = e >= 1280 ? 4 : e >= 960 ? 3 : e >= 640 ? 2 : 1;
|
|
1585
|
-
|
|
1591
|
+
z.value !== t && (z.value = t);
|
|
1586
1592
|
}
|
|
1587
1593
|
function Fe() {
|
|
1588
|
-
|
|
1594
|
+
q?.disconnect(), q = void 0, w.value && (Pe(w.value.clientWidth), !(typeof ResizeObserver > "u") && (q = new ResizeObserver((e) => Pe(e[0]?.contentRect.width ?? 0)), q.observe(w.value)));
|
|
1589
1595
|
}
|
|
1590
1596
|
function Ie(e) {
|
|
1591
|
-
|
|
1592
|
-
|
|
1597
|
+
Oe.value !== e && (Oe.value = e, K.value = G.value[W.value], _(() => {
|
|
1598
|
+
K.value ? Fe() : q?.disconnect(), F.value?.doLayout();
|
|
1593
1599
|
}));
|
|
1594
1600
|
}
|
|
1595
1601
|
function Le(e) {
|
|
1596
1602
|
Ie(e.matches);
|
|
1597
1603
|
}
|
|
1598
1604
|
S(() => {
|
|
1599
|
-
typeof document < "u" && document.addEventListener("fullscreenchange", Ne), typeof window < "u" && typeof window.matchMedia == "function" && (
|
|
1605
|
+
typeof document < "u" && document.addEventListener("fullscreenchange", Ne), typeof window < "u" && typeof window.matchMedia == "function" && (J = window.matchMedia("(max-width: 768px)"), Ie(J.matches), J.addEventListener?.("change", Le)), Fe();
|
|
1600
1606
|
}), x(() => {
|
|
1601
|
-
typeof document < "u" && document.removeEventListener("fullscreenchange", Ne),
|
|
1607
|
+
typeof document < "u" && document.removeEventListener("fullscreenchange", Ne), J?.removeEventListener?.("change", Le), q?.disconnect(), ke && clearTimeout(ke);
|
|
1602
1608
|
}), N(() => r.query?.columns, (e) => {
|
|
1603
1609
|
e === void 0 && Pe(w.value?.clientWidth ?? 0);
|
|
1604
1610
|
}), N([() => r.query?.defaultVisible, () => r.query?.mobileDefaultVisible], ([e, t]) => {
|
|
1605
|
-
|
|
1611
|
+
G.value = {
|
|
1606
1612
|
desktop: e ?? !0,
|
|
1607
1613
|
mobile: t ?? e ?? !0
|
|
1608
|
-
},
|
|
1614
|
+
}, K.value = G.value[W.value];
|
|
1609
1615
|
});
|
|
1610
1616
|
function Re() {
|
|
1611
|
-
i("search", { ...p.value }), h.value === 1 ?
|
|
1617
|
+
i("search", { ...p.value }), h.value === 1 ? Y.load() : h.value = 1;
|
|
1612
1618
|
}
|
|
1613
1619
|
function ze() {
|
|
1614
|
-
let e =
|
|
1615
|
-
A.value?.resetFields(), i("reset", e), h.value === 1 ?
|
|
1620
|
+
let e = X.reset();
|
|
1621
|
+
A.value?.resetFields(), i("reset", e), h.value === 1 ? Y.load() : h.value = 1;
|
|
1616
1622
|
}
|
|
1617
1623
|
function Be() {
|
|
1618
|
-
r.query?.submitOnChange && (
|
|
1624
|
+
r.query?.submitOnChange && (ke && clearTimeout(ke), ke = setTimeout(Re, Math.max(0, r.query.submitDebounce ?? 300)));
|
|
1619
1625
|
}
|
|
1620
1626
|
async function Ve() {
|
|
1621
|
-
let e = [...
|
|
1622
|
-
columns:
|
|
1627
|
+
let e = [...Z.selectedRows.value], t = e.length > 0 ? e : Y.currentRows.value, n = {
|
|
1628
|
+
columns: L.value,
|
|
1623
1629
|
query: { ...p.value },
|
|
1624
1630
|
rows: t,
|
|
1625
1631
|
selectedRows: e
|
|
@@ -1649,31 +1655,31 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1649
1655
|
i("pageChange", e);
|
|
1650
1656
|
}
|
|
1651
1657
|
function We() {
|
|
1652
|
-
if (
|
|
1653
|
-
...
|
|
1654
|
-
[
|
|
1655
|
-
},
|
|
1658
|
+
if (K.value = !K.value, G.value = {
|
|
1659
|
+
...G.value,
|
|
1660
|
+
[W.value]: K.value
|
|
1661
|
+
}, K.value) {
|
|
1656
1662
|
_(() => {
|
|
1657
1663
|
Fe(), F.value?.doLayout();
|
|
1658
1664
|
});
|
|
1659
1665
|
return;
|
|
1660
1666
|
}
|
|
1661
|
-
|
|
1667
|
+
q?.disconnect(), _(() => F.value?.doLayout());
|
|
1662
1668
|
}
|
|
1663
1669
|
function Ge(e, t, n, r) {
|
|
1664
1670
|
return typeof e == "function" ? e(n, r) : e ?? t;
|
|
1665
1671
|
}
|
|
1666
1672
|
function Ke() {
|
|
1667
|
-
|
|
1673
|
+
Q.open("create");
|
|
1668
1674
|
}
|
|
1669
1675
|
function qe(e) {
|
|
1670
|
-
|
|
1676
|
+
Q.open("edit", e);
|
|
1671
1677
|
}
|
|
1672
1678
|
function Je(e) {
|
|
1673
|
-
|
|
1679
|
+
Q.open("view", e);
|
|
1674
1680
|
}
|
|
1675
1681
|
async function Ye(e) {
|
|
1676
|
-
!await
|
|
1682
|
+
!await Q.submit(e, async () => await ne.value?.validate() !== !1) && Q.error.value && i("operationError", Error(Q.error.value));
|
|
1677
1683
|
}
|
|
1678
1684
|
async function Xe(e) {
|
|
1679
1685
|
let t = r.actions?.confirmRemove;
|
|
@@ -1691,13 +1697,13 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1691
1697
|
}
|
|
1692
1698
|
}
|
|
1693
1699
|
async function et(e) {
|
|
1694
|
-
|
|
1700
|
+
H.value = !0;
|
|
1695
1701
|
try {
|
|
1696
|
-
return await e(), bt(), await
|
|
1702
|
+
return await e(), bt(), await Y.load(), !0;
|
|
1697
1703
|
} catch (e) {
|
|
1698
1704
|
return i("operationError", e), !1;
|
|
1699
1705
|
} finally {
|
|
1700
|
-
|
|
1706
|
+
H.value = !1;
|
|
1701
1707
|
}
|
|
1702
1708
|
}
|
|
1703
1709
|
async function nt(e) {
|
|
@@ -1705,16 +1711,16 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1705
1711
|
!t || !n || !await Xe([e]) || await et(() => t(e));
|
|
1706
1712
|
}
|
|
1707
1713
|
async function rt() {
|
|
1708
|
-
let e = [...
|
|
1714
|
+
let e = [...Z.selectedRows.value], t = !r.dataSource?.beforeRemove || await r.dataSource.beforeRemove(e);
|
|
1709
1715
|
e.length === 0 || !t || !await Xe(e) || await et(() => r.dataSource?.removeMany ? r.dataSource.removeMany(e) : Promise.all(e.map((e) => r.dataSource?.remove?.(e))));
|
|
1710
1716
|
}
|
|
1711
1717
|
async function gt() {
|
|
1712
|
-
if (
|
|
1713
|
-
if (!
|
|
1718
|
+
if (Q.saving.value) return !1;
|
|
1719
|
+
if (!Q.dirty.value) return !0;
|
|
1714
1720
|
if (r.editor?.confirmClose) return r.editor.confirmClose({
|
|
1715
|
-
mode:
|
|
1716
|
-
model:
|
|
1717
|
-
row:
|
|
1721
|
+
mode: Q.mode.value,
|
|
1722
|
+
model: Q.model.value,
|
|
1723
|
+
row: Q.editingRow.value
|
|
1718
1724
|
});
|
|
1719
1725
|
try {
|
|
1720
1726
|
return await me.confirm("表单内容尚未保存,确定关闭吗?", "关闭确认", {
|
|
@@ -1733,14 +1739,14 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1733
1739
|
}
|
|
1734
1740
|
function vt() {
|
|
1735
1741
|
gt().then((e) => {
|
|
1736
|
-
e && (
|
|
1742
|
+
e && (Q.visible.value = !1);
|
|
1737
1743
|
});
|
|
1738
1744
|
}
|
|
1739
1745
|
function yt() {
|
|
1740
|
-
Ye(
|
|
1746
|
+
Ye(Q.model.value);
|
|
1741
1747
|
}
|
|
1742
1748
|
function bt() {
|
|
1743
|
-
|
|
1749
|
+
Z.clear(), F.value?.clearSelection();
|
|
1744
1750
|
}
|
|
1745
1751
|
return t({
|
|
1746
1752
|
clearSelection: bt,
|
|
@@ -1748,21 +1754,21 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1748
1754
|
closeEditor: vt,
|
|
1749
1755
|
getEditorForm: () => ne.value,
|
|
1750
1756
|
getQueryForm: () => A.value,
|
|
1751
|
-
getSelectedRowKeys: () => [...
|
|
1752
|
-
getSelectedRows: () => [...
|
|
1757
|
+
getSelectedRowKeys: () => [...Z.selectedRowKeys.value],
|
|
1758
|
+
getSelectedRows: () => [...Z.selectedRows.value],
|
|
1753
1759
|
getTable: () => F.value,
|
|
1754
|
-
isLoading: () =>
|
|
1760
|
+
isLoading: () => je.value,
|
|
1755
1761
|
openCreate: Ke,
|
|
1756
1762
|
openEdit: qe,
|
|
1757
1763
|
openView: Je,
|
|
1758
1764
|
query: Re,
|
|
1759
1765
|
reset: ze,
|
|
1760
|
-
reload:
|
|
1766
|
+
reload: Y.load,
|
|
1761
1767
|
removeRow: nt,
|
|
1762
1768
|
removeSelectedRows: rt,
|
|
1763
1769
|
setFormData: (e) => ne.value?.setValues(e),
|
|
1764
1770
|
toggleFullscreen: He,
|
|
1765
|
-
toggleQuery:
|
|
1771
|
+
toggleQuery: X.toggle,
|
|
1766
1772
|
toggleQueryPanel: We
|
|
1767
1773
|
}), (t, n) => (C(), c("div", {
|
|
1768
1774
|
ref_key: "crudRef",
|
|
@@ -1773,18 +1779,18 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1773
1779
|
key: 0,
|
|
1774
1780
|
ref_key: "queryRef",
|
|
1775
1781
|
ref: w,
|
|
1776
|
-
class: v(["lumal-crud-table__query", { "is-collapsed": k(
|
|
1777
|
-
}, [f(k(
|
|
1782
|
+
class: v(["lumal-crud-table__query", { "is-collapsed": k(X).collapsed.value }])
|
|
1783
|
+
}, [f(k(Ae), {
|
|
1778
1784
|
ref_key: "queryFormRef",
|
|
1779
1785
|
ref: A,
|
|
1780
1786
|
modelValue: p.value,
|
|
1781
1787
|
"onUpdate:modelValue": n[0] ||= (e) => p.value = e,
|
|
1782
|
-
schemas: k(
|
|
1783
|
-
columns:
|
|
1788
|
+
schemas: k(X).visibleSchemas.value,
|
|
1789
|
+
columns: B.value,
|
|
1784
1790
|
"label-width": e.query?.labelWidth ?? 88,
|
|
1785
1791
|
class: "lumal-crud-table__query-form",
|
|
1786
1792
|
onValuesChange: Be
|
|
1787
|
-
}, u({ _: 2 }, [T(k(
|
|
1793
|
+
}, u({ _: 2 }, [T(k(X).visibleSchemas.value.filter((e) => t.$slots[`query-${String(e.field)}`]), (e) => ({
|
|
1788
1794
|
name: `field-${String(e.field)}`,
|
|
1789
1795
|
fn: P((n) => [E(t.$slots, `query-${String(e.field)}`, y(m(n)), void 0, !0)])
|
|
1790
1796
|
}))]), 1032, [
|
|
@@ -1810,21 +1816,21 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1810
1816
|
default: P(() => [d(O(e.query?.resetText ?? e.resetText), 1)]),
|
|
1811
1817
|
_: 1
|
|
1812
1818
|
}),
|
|
1813
|
-
k(
|
|
1819
|
+
k(X).canCollapse.value ? (C(), o(k(R), {
|
|
1814
1820
|
key: 0,
|
|
1815
1821
|
"native-type": "button",
|
|
1816
1822
|
"data-action": "toggle-query",
|
|
1817
|
-
"aria-expanded": String(!k(
|
|
1818
|
-
onClick: k(
|
|
1823
|
+
"aria-expanded": String(!k(X).collapsed.value),
|
|
1824
|
+
onClick: k(X).toggle
|
|
1819
1825
|
}, {
|
|
1820
|
-
default: P(() => [d(O(k(
|
|
1826
|
+
default: P(() => [d(O(k(X).collapsed.value ? "展开" : "收起"), 1)]),
|
|
1821
1827
|
_: 1
|
|
1822
1828
|
}, 8, ["aria-expanded", "onClick"])) : s("", !0)
|
|
1823
|
-
])], 2)), [[M,
|
|
1824
|
-
k(
|
|
1829
|
+
])], 2)), [[M, K.value]]) : s("", !0),
|
|
1830
|
+
k(Y).error.value ? (C(), c("div", ct, [l("span", null, O(k(Y).error.value), 1), f(k(R), {
|
|
1825
1831
|
"native-type": "button",
|
|
1826
1832
|
"data-action": "retry",
|
|
1827
|
-
onClick: k(
|
|
1833
|
+
onClick: k(Y).load
|
|
1828
1834
|
}, {
|
|
1829
1835
|
default: P(() => [...n[5] ||= [d(" 重试 ", -1)]]),
|
|
1830
1836
|
_: 1
|
|
@@ -1833,12 +1839,12 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1833
1839
|
l("div", ut, [f(k(Ze), {
|
|
1834
1840
|
ref_key: "tableRef",
|
|
1835
1841
|
ref: F,
|
|
1836
|
-
columns:
|
|
1837
|
-
rows: k(
|
|
1842
|
+
columns: L.value,
|
|
1843
|
+
rows: k(Y).currentRows.value,
|
|
1838
1844
|
"row-key": oe.value,
|
|
1839
|
-
"empty-text":
|
|
1840
|
-
loading:
|
|
1841
|
-
selection:
|
|
1845
|
+
"empty-text": ce.value,
|
|
1846
|
+
loading: je.value,
|
|
1847
|
+
selection: se.value,
|
|
1842
1848
|
"show-column-settings": e.table?.showColumnSettings,
|
|
1843
1849
|
"column-settings": e.table?.columnSettings,
|
|
1844
1850
|
"auto-resize": e.table?.autoResize ?? !0,
|
|
@@ -1848,7 +1854,7 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1848
1854
|
height: "100%",
|
|
1849
1855
|
border: !0
|
|
1850
1856
|
},
|
|
1851
|
-
onSelectionChange: k(
|
|
1857
|
+
onSelectionChange: k(Z).update
|
|
1852
1858
|
}, u({ _: 2 }, [
|
|
1853
1859
|
t.$slots["table-title"] || e.title ? {
|
|
1854
1860
|
name: "toolbar-title",
|
|
@@ -1867,14 +1873,14 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1867
1873
|
"data-action": "create",
|
|
1868
1874
|
onClick: Ke
|
|
1869
1875
|
}, {
|
|
1870
|
-
default: P(() => [f(k(
|
|
1876
|
+
default: P(() => [f(k(re), { name: "lumal:plus" }), d(" " + O(e.toolbar?.createText ?? e.createText), 1)]),
|
|
1871
1877
|
_: 1
|
|
1872
1878
|
})], !0) : s("", !0),
|
|
1873
1879
|
ve.value ? (C(), o(k(R), {
|
|
1874
1880
|
key: 1,
|
|
1875
1881
|
"native-type": "button",
|
|
1876
1882
|
"data-action": "batch-remove",
|
|
1877
|
-
disabled: k(
|
|
1883
|
+
disabled: k(Z).selectedRows.value.length === 0 || H.value,
|
|
1878
1884
|
onClick: rt
|
|
1879
1885
|
}, {
|
|
1880
1886
|
default: P(() => [d(O(e.toolbar?.batchDeleteText ?? e.batchDeleteText), 1)]),
|
|
@@ -1890,10 +1896,10 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1890
1896
|
_: 1
|
|
1891
1897
|
})) : s("", !0),
|
|
1892
1898
|
E(t.$slots, "toolbar-actions", {
|
|
1893
|
-
reload: k(
|
|
1899
|
+
reload: k(Y).load,
|
|
1894
1900
|
openCreate: Ke,
|
|
1895
|
-
selectedRows: k(
|
|
1896
|
-
selectedRowKeys: k(
|
|
1901
|
+
selectedRows: k(Z).selectedRows.value,
|
|
1902
|
+
selectedRowKeys: k(Z).selectedRowKeys.value,
|
|
1897
1903
|
clearSelection: bt
|
|
1898
1904
|
}, void 0, !0),
|
|
1899
1905
|
E(t.$slots, "actions", {}, void 0, !0)
|
|
@@ -1904,7 +1910,7 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1904
1910
|
name: "toolbar-tools",
|
|
1905
1911
|
fn: P(() => [l("div", dt, [
|
|
1906
1912
|
E(t.$slots, "toolbar-tools", {
|
|
1907
|
-
reload: k(
|
|
1913
|
+
reload: k(Y).load,
|
|
1908
1914
|
toggleFullscreen: He
|
|
1909
1915
|
}, void 0, !0),
|
|
1910
1916
|
Se.value ? (C(), o(k(R), {
|
|
@@ -1912,13 +1918,13 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1912
1918
|
circle: "",
|
|
1913
1919
|
"native-type": "button",
|
|
1914
1920
|
"data-action": "toggle-query-panel",
|
|
1915
|
-
class: v({ "is-active":
|
|
1916
|
-
"aria-expanded": String(
|
|
1917
|
-
"aria-label":
|
|
1918
|
-
title:
|
|
1921
|
+
class: v({ "is-active": K.value }),
|
|
1922
|
+
"aria-expanded": String(K.value),
|
|
1923
|
+
"aria-label": K.value ? "隐藏筛选条件" : "显示筛选条件",
|
|
1924
|
+
title: K.value ? "隐藏筛选条件" : "显示筛选条件",
|
|
1919
1925
|
onClick: We
|
|
1920
1926
|
}, {
|
|
1921
|
-
default: P(() => [f(k(
|
|
1927
|
+
default: P(() => [f(k(re), { name: "lumal:filter" })]),
|
|
1922
1928
|
_: 1
|
|
1923
1929
|
}, 8, [
|
|
1924
1930
|
"class",
|
|
@@ -1933,9 +1939,9 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1933
1939
|
"data-action": "refresh",
|
|
1934
1940
|
"aria-label": e.toolbar?.refreshText ?? "刷新",
|
|
1935
1941
|
title: e.toolbar?.refreshText ?? "刷新",
|
|
1936
|
-
onClick: k(
|
|
1942
|
+
onClick: k(Y).load
|
|
1937
1943
|
}, {
|
|
1938
|
-
default: P(() => [f(k(
|
|
1944
|
+
default: P(() => [f(k(re), { name: "lumal:refresh" })]),
|
|
1939
1945
|
_: 1
|
|
1940
1946
|
}, 8, [
|
|
1941
1947
|
"aria-label",
|
|
@@ -1947,12 +1953,12 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1947
1953
|
circle: "",
|
|
1948
1954
|
"native-type": "button",
|
|
1949
1955
|
"data-action": "fullscreen",
|
|
1950
|
-
"aria-label": e.toolbar?.fullscreenText ?? (
|
|
1951
|
-
title: e.toolbar?.fullscreenText ?? (
|
|
1956
|
+
"aria-label": e.toolbar?.fullscreenText ?? (U.value ? "退出全屏" : "全屏"),
|
|
1957
|
+
title: e.toolbar?.fullscreenText ?? (U.value ? "退出全屏" : "全屏"),
|
|
1952
1958
|
onClick: He
|
|
1953
1959
|
}, {
|
|
1954
|
-
default: P(() => [f(k(
|
|
1955
|
-
name:
|
|
1960
|
+
default: P(() => [f(k(re), {
|
|
1961
|
+
name: U.value ? "lumal:fullscreen-exit" : "lumal:fullscreen",
|
|
1956
1962
|
morph: ""
|
|
1957
1963
|
}, null, 8, ["name"])]),
|
|
1958
1964
|
_: 1
|
|
@@ -1960,11 +1966,11 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1960
1966
|
])]),
|
|
1961
1967
|
key: "2"
|
|
1962
1968
|
} : void 0,
|
|
1963
|
-
T(
|
|
1969
|
+
T(L.value.filter((e) => t.$slots[`table-${String(e.field)}`]), (e) => ({
|
|
1964
1970
|
name: `table-${String(e.field)}`,
|
|
1965
1971
|
fn: P((n) => [E(t.$slots, `table-${String(e.field)}`, y(m(n)), void 0, !0)])
|
|
1966
1972
|
})),
|
|
1967
|
-
ge.value ||
|
|
1973
|
+
ge.value || V.value?.remove || t.$slots["row-actions"] ? {
|
|
1968
1974
|
name: "actions",
|
|
1969
1975
|
fn: P(({ row: n, index: r }) => [E(t.$slots, "row-actions", {
|
|
1970
1976
|
row: n,
|
|
@@ -1991,7 +1997,7 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
1991
1997
|
default: P(() => [d(O(e.actions?.editText ?? "编辑"), 1)]),
|
|
1992
1998
|
_: 1
|
|
1993
1999
|
}, 8, ["onClick"])) : s("", !0),
|
|
1994
|
-
Ge(e.actions?.remove, !!
|
|
2000
|
+
Ge(e.actions?.remove, !!V.value?.remove, n, r) ? (C(), o(k(R), {
|
|
1995
2001
|
key: 2,
|
|
1996
2002
|
type: "danger",
|
|
1997
2003
|
"native-type": "button",
|
|
@@ -2019,12 +2025,12 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
2019
2025
|
"onSelectionChange"
|
|
2020
2026
|
])]),
|
|
2021
2027
|
t.$slots.default ? (C(), c("div", ft, [E(t.$slots, "default", {}, void 0, !0)])) : s("", !0),
|
|
2022
|
-
|
|
2028
|
+
Me.value ? (C(), c("div", pt, [f(k(De), {
|
|
2023
2029
|
page: h.value,
|
|
2024
2030
|
"onUpdate:page": n[1] ||= (e) => h.value = e,
|
|
2025
2031
|
"page-size": g.value,
|
|
2026
2032
|
"onUpdate:pageSize": n[2] ||= (e) => g.value = e,
|
|
2027
|
-
total: k(
|
|
2033
|
+
total: k(Y).currentTotal.value,
|
|
2028
2034
|
"page-sizes": pe.value,
|
|
2029
2035
|
onChange: Ue
|
|
2030
2036
|
}, null, 8, [
|
|
@@ -2035,9 +2041,9 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
2035
2041
|
])])) : s("", !0)
|
|
2036
2042
|
]),
|
|
2037
2043
|
f(Qe, {
|
|
2038
|
-
modelValue: k(
|
|
2039
|
-
"onUpdate:modelValue": n[4] ||= (e) => k(
|
|
2040
|
-
title:
|
|
2044
|
+
modelValue: k(Q).visible.value,
|
|
2045
|
+
"onUpdate:modelValue": n[4] ||= (e) => k(Q).visible.value = e,
|
|
2046
|
+
title: $.value,
|
|
2041
2047
|
type: e.editor?.type ?? "dialog",
|
|
2042
2048
|
width: e.editor?.width ?? (e.editor?.type === "drawer" ? "min(720px, 92vw)" : "min(920px, calc(100vw - 32px))"),
|
|
2043
2049
|
"close-on-click-modal": e.editor?.closeOnClickModal ?? !1,
|
|
@@ -2045,38 +2051,38 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
2045
2051
|
"before-close": _t
|
|
2046
2052
|
}, {
|
|
2047
2053
|
footer: P(() => [E(t.$slots, "footer", {
|
|
2048
|
-
mode: k(
|
|
2049
|
-
model: k(
|
|
2054
|
+
mode: k(Q).mode.value,
|
|
2055
|
+
model: k(Q).model.value,
|
|
2050
2056
|
close: vt,
|
|
2051
2057
|
submit: yt
|
|
2052
2058
|
}, () => [l("div", ht, [f(k(R), {
|
|
2053
2059
|
"native-type": "button",
|
|
2054
2060
|
onClick: vt
|
|
2055
2061
|
}, {
|
|
2056
|
-
default: P(() => [d(O(k(
|
|
2062
|
+
default: P(() => [d(O(k(Q).mode.value === "view" ? "关闭" : "取消"), 1)]),
|
|
2057
2063
|
_: 1
|
|
2058
|
-
}), k(
|
|
2064
|
+
}), k(Q).mode.value === "view" ? s("", !0) : (C(), o(k(R), {
|
|
2059
2065
|
key: 0,
|
|
2060
2066
|
type: "primary",
|
|
2061
2067
|
"native-type": "button",
|
|
2062
|
-
loading: k(
|
|
2068
|
+
loading: k(Q).saving.value,
|
|
2063
2069
|
onClick: yt
|
|
2064
2070
|
}, {
|
|
2065
2071
|
default: P(() => [d(O(e.editor?.submitText ?? "保存"), 1)]),
|
|
2066
2072
|
_: 1
|
|
2067
2073
|
}, 8, ["loading"]))])], !0)]),
|
|
2068
|
-
default: P(() => [k(
|
|
2074
|
+
default: P(() => [k(Q).error.value ? (C(), c("div", mt, O(k(Q).error.value), 1)) : s("", !0), f(k(Ae), {
|
|
2069
2075
|
ref_key: "dialogFormRef",
|
|
2070
2076
|
ref: ne,
|
|
2071
|
-
modelValue: k(
|
|
2072
|
-
"onUpdate:modelValue": n[3] ||= (e) => k(
|
|
2073
|
-
mode: k(
|
|
2077
|
+
modelValue: k(Q).model.value,
|
|
2078
|
+
"onUpdate:modelValue": n[3] ||= (e) => k(Q).model.value = e,
|
|
2079
|
+
mode: k(Q).mode.value,
|
|
2074
2080
|
schemas: ae.value,
|
|
2075
2081
|
columns: e.editor?.columns ?? 2,
|
|
2076
2082
|
"label-width": e.editor?.labelWidth ?? 88,
|
|
2077
2083
|
loading: e.editor?.loading,
|
|
2078
|
-
disabled: k(
|
|
2079
|
-
"submit-loading": k(
|
|
2084
|
+
disabled: k(Q).saving.value || e.editor?.disabled,
|
|
2085
|
+
"submit-loading": k(Q).saving.value,
|
|
2080
2086
|
"show-actions": !1,
|
|
2081
2087
|
onSubmit: Ye
|
|
2082
2088
|
}, u({ _: 2 }, [T(ae.value.filter((e) => t.$slots[`form-${String(e.field)}`]), (e) => ({
|
|
@@ -2259,4 +2265,4 @@ var st = { class: "lumal-crud-table__query-actions" }, ct = {
|
|
|
2259
2265
|
}
|
|
2260
2266
|
}), [["__scopeId", "data-v-d4b9bb06"]]);
|
|
2261
2267
|
//#endregion
|
|
2262
|
-
export { Tt as a, $e as c, De as d, Mt as i, Ze as l,
|
|
2268
|
+
export { Tt as a, $e as c, De as d, Mt as i, Ze as l, ie as n, vt as o, L as r, gt as s, I as t, Ae as u };
|