@lumal/core 0.0.1-beta → 0.0.3-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 +29 -0
- package/LICENSE +21 -21
- package/README.md +22 -13
- package/dist/auth.cjs +1 -1
- package/dist/auth.js +13 -29
- package/dist/components-DCp2KGvo.js +2254 -0
- package/dist/components-oqKxhgFp.cjs +2 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +3 -3
- package/dist/{composables-C9EuCUjj.js → composables-BxZG0_RZ.js} +53 -40
- package/dist/composables-Dsl-todB.cjs +1 -0
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +18 -17
- package/dist/context-Bdx-ZJbt.js +13 -0
- package/dist/context-CWQ1OO16.cjs +1 -0
- package/dist/core.css +1 -1
- package/dist/createLumalApp-BxQL77Qt.js +38 -0
- package/dist/createLumalApp-C5o7gAlu.cjs +1 -0
- package/dist/{dictionary-B7tsaVqB.js → dictionary-DnRiNaKi.js} +1 -1
- package/dist/{dictionary-ClEWtQCU.cjs → dictionary-Dt70z10M.cjs} +1 -1
- package/dist/dictionary.cjs +1 -1
- package/dist/dictionary.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +15 -58
- package/dist/{layout-C8H9wuQa.js → layout-B7yJhQXN.js} +473 -429
- package/dist/layout-BgyM9WJi.cjs +1 -0
- package/dist/layout.cjs +1 -1
- package/dist/layout.js +1 -1
- package/dist/minimal.cjs +1 -0
- package/dist/minimal.js +10 -0
- package/dist/{permission-CCkqvnWg.js → permission-CHw9eXd8.js} +24 -34
- package/dist/permission-CoqteYAi.cjs +1 -0
- package/dist/permission.cjs +1 -1
- package/dist/permission.js +4 -3
- package/dist/request.cjs +1 -1
- package/dist/request.js +103 -80
- package/dist/router.cjs +1 -1
- package/dist/router.js +24 -21
- package/dist/src/app/createLumalAdmin.d.ts +1 -1
- package/dist/src/app/createLumalAdmin.d.ts.map +1 -1
- package/dist/src/app/createLumalApp.d.ts +7 -0
- package/dist/src/app/createLumalApp.d.ts.map +1 -0
- package/dist/src/app/types.d.ts +5 -0
- package/dist/src/app/types.d.ts.map +1 -1
- package/dist/src/auth/createAuthSession.d.ts.map +1 -1
- package/dist/src/components/crud-table/LumalCrudTable.vue.d.ts.map +1 -1
- package/dist/src/components/crud-table/useCrudData.d.ts.map +1 -1
- package/dist/src/components/crud-table/useCrudDialog.d.ts +1 -1
- package/dist/src/components/crud-table/useCrudDialog.d.ts.map +1 -1
- package/dist/src/components/schema-form/LumalSchemaForm.vue.d.ts.map +1 -1
- package/dist/src/components/schema-table/LumalSchemaTable.vue.d.ts.map +1 -1
- package/dist/src/components/schema-table/cell.d.ts +1 -1
- package/dist/src/components/schema-table/cell.d.ts.map +1 -1
- package/dist/src/composables/usePagination.d.ts.map +1 -1
- package/dist/src/dictionary/index.d.ts +1 -1
- package/dist/src/dictionary/index.d.ts.map +1 -1
- package/dist/src/dictionary/normalize.d.ts +3 -1
- package/dist/src/dictionary/normalize.d.ts.map +1 -1
- package/dist/src/dictionary/store.d.ts.map +1 -1
- package/dist/src/layout/LumalGlobalSearch.vue.d.ts.map +1 -1
- package/dist/src/layout/LumalLayout.vue.d.ts +6 -2
- package/dist/src/layout/LumalLayout.vue.d.ts.map +1 -1
- package/dist/src/layout/LumalRouterView.vue.d.ts +2 -0
- package/dist/src/layout/LumalRouterView.vue.d.ts.map +1 -1
- package/dist/src/layout/LumalTabs.vue.d.ts.map +1 -1
- package/dist/src/minimal/index.d.ts +5 -0
- package/dist/src/minimal/index.d.ts.map +1 -0
- package/dist/src/request/client.d.ts.map +1 -1
- package/dist/src/request/types.d.ts +8 -2
- package/dist/src/request/types.d.ts.map +1 -1
- package/dist/src/router/index.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/storage.d.ts +2 -0
- package/dist/src/utils/storage.d.ts.map +1 -1
- package/dist/storage-CCBa7Qh8.cjs +1 -0
- package/dist/storage-CorgkMJU.js +41 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +32 -54
- package/package.json +9 -3
- package/theme-chalk/index.scss +2 -2
- package/dist/components-DJiHYQQB.cjs +0 -2
- package/dist/components-DYmKh-eF.js +0 -2206
- package/dist/composables-C4twj5Ov.cjs +0 -1
- package/dist/layout-ZnyG9X3N.cjs +0 -1
- package/dist/permission-6sXtjGMS.cjs +0 -1
|
@@ -1,2206 +0,0 @@
|
|
|
1
|
-
import { f as e, i as t } from "./composables-C9EuCUjj.js";
|
|
2
|
-
import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
3
|
-
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createSlots as l, createTextVNode as u, createVNode as d, defineComponent as f, guardReactiveProps as p, mergeModels as m, mergeProps as h, nextTick as g, normalizeClass as _, normalizeProps as ee, normalizeStyle as v, onBeforeUnmount as y, onMounted as te, openBlock as b, renderList as x, renderSlot as S, shallowRef as C, toDisplayString as w, unref as T, useModel as E, useSlots as D, useTemplateRef as O, vShow as k, watch as A, withCtx as j, withDirectives as ne, withKeys as re, withModifiers as ie } from "vue";
|
|
4
|
-
import { LumalIcon as ae, LumalIcon as M, LumalIconPicker as N, LumalIconPickerDialog as oe } from "@lumal/icons-vue";
|
|
5
|
-
import { ElButton as P, ElCheckbox as se, ElCheckboxGroup as F, ElCol as I, ElDatePicker as L, ElDialog as R, ElDrawer as z, ElForm as ce, ElFormItem as le, ElInput as ue, ElInputNumber as de, ElLoading as fe, ElMessageBox as pe, ElOption as me, ElPagination as he, ElPopover as ge, ElRadio as _e, ElRadioGroup as ve, ElRow as ye, ElSelect as be, ElSwitch as xe, ElTable as Se, ElTableColumn as Ce, ElTreeSelect as we, ElUpload as Te } from "element-plus";
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/components/pagination/LumalPagination.vue
|
|
8
|
-
var Ee = /*#__PURE__*/ n(/* @__PURE__ */ f({
|
|
9
|
-
__name: "LumalPagination",
|
|
10
|
-
props: /*@__PURE__*/ m({
|
|
11
|
-
total: {},
|
|
12
|
-
pageSizes: { default: () => [
|
|
13
|
-
10,
|
|
14
|
-
20,
|
|
15
|
-
50,
|
|
16
|
-
100
|
|
17
|
-
] },
|
|
18
|
-
disabled: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: !1
|
|
21
|
-
}
|
|
22
|
-
}, {
|
|
23
|
-
page: { default: 1 },
|
|
24
|
-
pageModifiers: {},
|
|
25
|
-
pageSize: { default: 10 },
|
|
26
|
-
pageSizeModifiers: {}
|
|
27
|
-
}),
|
|
28
|
-
emits: /*@__PURE__*/ m(["change"], ["update:page", "update:pageSize"]),
|
|
29
|
-
setup(e, { expose: t, emit: n }) {
|
|
30
|
-
let r = e, o = n, s = E(e, "page"), c = E(e, "pageSize"), l = O("paginationRef"), u = i(() => Math.max(1, Math.ceil(r.total / c.value)));
|
|
31
|
-
function d(e, t) {
|
|
32
|
-
o("change", {
|
|
33
|
-
page: e,
|
|
34
|
-
pageSize: t
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
function f(e) {
|
|
38
|
-
if (r.disabled) return;
|
|
39
|
-
let t = Math.min(Math.max(e, 1), u.value);
|
|
40
|
-
s.value = t, d(t, c.value);
|
|
41
|
-
}
|
|
42
|
-
function p(e) {
|
|
43
|
-
r.disabled || (c.value = e, s.value = 1, d(1, e));
|
|
44
|
-
}
|
|
45
|
-
return t({
|
|
46
|
-
getPaginationElement: () => l.value?.$el,
|
|
47
|
-
getPaginationInstance: () => l.value
|
|
48
|
-
}), (t, n) => (b(), a(T(he), {
|
|
49
|
-
ref_key: "paginationRef",
|
|
50
|
-
ref: l,
|
|
51
|
-
class: "lumal-pagination",
|
|
52
|
-
background: "",
|
|
53
|
-
layout: "total, sizes, prev, pager, next, jumper",
|
|
54
|
-
"current-page": s.value,
|
|
55
|
-
"page-size": c.value,
|
|
56
|
-
"page-sizes": e.pageSizes,
|
|
57
|
-
total: e.total,
|
|
58
|
-
disabled: e.disabled,
|
|
59
|
-
onCurrentChange: f,
|
|
60
|
-
onSizeChange: p
|
|
61
|
-
}, null, 8, [
|
|
62
|
-
"current-page",
|
|
63
|
-
"page-size",
|
|
64
|
-
"page-sizes",
|
|
65
|
-
"total",
|
|
66
|
-
"disabled"
|
|
67
|
-
]));
|
|
68
|
-
}
|
|
69
|
-
}), [["__scopeId", "data-v-e5a835aa"]]);
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/components/schema-form/normalize.ts
|
|
72
|
-
function De(e) {
|
|
73
|
-
return `lumal-schema-form-${e.replace(/[^\w-]/g, "-")}`;
|
|
74
|
-
}
|
|
75
|
-
function B(e, t) {
|
|
76
|
-
return typeof e == "function" ? !!e(t) : !!e;
|
|
77
|
-
}
|
|
78
|
-
function V(e, t, n) {
|
|
79
|
-
return typeof e == "function" ? e(t) : e ?? n;
|
|
80
|
-
}
|
|
81
|
-
function H(e, t) {
|
|
82
|
-
return !e.authority || t.canAccess?.(e.authority) !== !1;
|
|
83
|
-
}
|
|
84
|
-
function U(e = [], t = {}) {
|
|
85
|
-
let n = t.model ?? {};
|
|
86
|
-
return e.filter((e) => e.field.trim()).map((e) => {
|
|
87
|
-
let r = {
|
|
88
|
-
field: e.field,
|
|
89
|
-
getValues: () => n,
|
|
90
|
-
mode: t.mode ?? "create",
|
|
91
|
-
model: n,
|
|
92
|
-
setFieldValue: t.setFieldValue ?? (() => void 0),
|
|
93
|
-
value: n[e.field]
|
|
94
|
-
}, i = e.component ?? (e.dictionary || e.dictType ? "select" : "input"), a = B(e.hidden, r), o = B(e.disabled, r), s = e.readonlyAuthority ? t.canAccess?.(e.readonlyAuthority) === !1 : !1, c = r.mode === "view" || s || B(e.readonly, r), l = !a && i !== "hidden" && H(e, t), u = V(e.componentProps, r, {}), d = typeof e.options == "function" ? e.options(r) : T(e.options);
|
|
95
|
-
return {
|
|
96
|
-
...e,
|
|
97
|
-
id: De(e.field),
|
|
98
|
-
component: i,
|
|
99
|
-
componentProps: { ...u },
|
|
100
|
-
description: V(e.description, r, ""),
|
|
101
|
-
disabled: o,
|
|
102
|
-
help: V(e.help, r, ""),
|
|
103
|
-
options: d ?? [],
|
|
104
|
-
required: B(e.required, r),
|
|
105
|
-
readonly: c,
|
|
106
|
-
renderable: l,
|
|
107
|
-
rules: V(e.rules, r, [])
|
|
108
|
-
};
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
function Oe(e, t = {}) {
|
|
112
|
-
return e.reduce((e, t) => (!(t.field in e) && t.defaultValue !== void 0 && (e[t.field] = t.defaultValue), e), { ...t });
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/components/schema-form/LumalSchemaForm.vue?vue&type=script&setup=true&lang.ts
|
|
116
|
-
var ke = {
|
|
117
|
-
key: 0,
|
|
118
|
-
class: "lumal-schema-form__readonly-value"
|
|
119
|
-
}, W = {
|
|
120
|
-
key: 0,
|
|
121
|
-
class: "lumal-schema-form__description"
|
|
122
|
-
}, G = {
|
|
123
|
-
key: 1,
|
|
124
|
-
class: "lumal-schema-form__help"
|
|
125
|
-
}, K = /*#__PURE__*/ n(/* @__PURE__ */ f({
|
|
126
|
-
__name: "LumalSchemaForm",
|
|
127
|
-
props: /*@__PURE__*/ m({
|
|
128
|
-
canAccess: {},
|
|
129
|
-
actionLayout: { default: "rowEnd" },
|
|
130
|
-
actionPosition: { default: "right" },
|
|
131
|
-
columns: { default: 1 },
|
|
132
|
-
compact: {
|
|
133
|
-
type: Boolean,
|
|
134
|
-
default: !1
|
|
135
|
-
},
|
|
136
|
-
disabled: {
|
|
137
|
-
type: Boolean,
|
|
138
|
-
default: !1
|
|
139
|
-
},
|
|
140
|
-
gutter: { default: 16 },
|
|
141
|
-
labelPosition: { default: "right" },
|
|
142
|
-
labelWidth: { default: "auto" },
|
|
143
|
-
loading: {
|
|
144
|
-
type: Boolean,
|
|
145
|
-
default: !1
|
|
146
|
-
},
|
|
147
|
-
mode: { default: "create" },
|
|
148
|
-
resetText: { default: "重置" },
|
|
149
|
-
schemas: {},
|
|
150
|
-
scrollToFirstError: {
|
|
151
|
-
type: Boolean,
|
|
152
|
-
default: !0
|
|
153
|
-
},
|
|
154
|
-
showReset: {
|
|
155
|
-
type: Boolean,
|
|
156
|
-
default: !1
|
|
157
|
-
},
|
|
158
|
-
submitLoading: {
|
|
159
|
-
type: Boolean,
|
|
160
|
-
default: !1
|
|
161
|
-
},
|
|
162
|
-
submitOnEnter: {
|
|
163
|
-
type: Boolean,
|
|
164
|
-
default: !1
|
|
165
|
-
},
|
|
166
|
-
submitText: { default: "提交" },
|
|
167
|
-
showActions: {
|
|
168
|
-
type: Boolean,
|
|
169
|
-
default: !1
|
|
170
|
-
}
|
|
171
|
-
}, {
|
|
172
|
-
modelValue: { default: () => ({}) },
|
|
173
|
-
modelModifiers: {}
|
|
174
|
-
}),
|
|
175
|
-
emits: /*@__PURE__*/ m([
|
|
176
|
-
"reset",
|
|
177
|
-
"submit",
|
|
178
|
-
"valuesChange"
|
|
179
|
-
], ["update:modelValue"]),
|
|
180
|
-
setup(e, { expose: n, emit: c }) {
|
|
181
|
-
let f = e, p = c, m = E(e, "modelValue"), g = O("formRef"), ee = fe.directive, v = C({ ...m.value }), y = C(f.mode);
|
|
182
|
-
A(() => f.mode, (e) => {
|
|
183
|
-
y.value = e;
|
|
184
|
-
});
|
|
185
|
-
let te = i(() => U(f.schemas, {
|
|
186
|
-
canAccess: f.canAccess,
|
|
187
|
-
mode: y.value,
|
|
188
|
-
model: m.value,
|
|
189
|
-
setFieldValue: Y
|
|
190
|
-
})), D = i(() => te.value.filter((e) => e.renderable)), k = i(() => Oe(te.value, m.value)), { dictionaryMap: ae } = t(() => te.value.map((e) => e.dictionary ?? e.dictType));
|
|
191
|
-
function M(e) {
|
|
192
|
-
let t = k.value[e];
|
|
193
|
-
return typeof t == "number" || typeof t == "string" ? t : t == null ? "" : String(t);
|
|
194
|
-
}
|
|
195
|
-
function N(e) {
|
|
196
|
-
let t = k.value[e];
|
|
197
|
-
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 : "";
|
|
198
|
-
}
|
|
199
|
-
function oe(e) {
|
|
200
|
-
let t = N(e);
|
|
201
|
-
return Array.isArray(t) ? t[0] ?? "" : t;
|
|
202
|
-
}
|
|
203
|
-
function R(e) {
|
|
204
|
-
let t = k.value[e];
|
|
205
|
-
if (typeof t == "number") return t;
|
|
206
|
-
if (typeof t == "string" && t.trim()) return Number(t);
|
|
207
|
-
}
|
|
208
|
-
function z(e) {
|
|
209
|
-
return !!k.value[e];
|
|
210
|
-
}
|
|
211
|
-
function pe(e) {
|
|
212
|
-
let t = k.value[e];
|
|
213
|
-
return Array.isArray(t) ? t.filter((e) => typeof e == "number" || typeof e == "string") : [];
|
|
214
|
-
}
|
|
215
|
-
function he(e) {
|
|
216
|
-
let t = k.value[e];
|
|
217
|
-
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;
|
|
218
|
-
}
|
|
219
|
-
function ge(e) {
|
|
220
|
-
return e.component === "datetime" ? "datetime" : e.component === "daterange" ? "daterange" : "date";
|
|
221
|
-
}
|
|
222
|
-
function Se(e) {
|
|
223
|
-
let t = k.value[e];
|
|
224
|
-
if (typeof t == "boolean" || typeof t == "number" || typeof t == "string" || t && typeof t == "object") return t;
|
|
225
|
-
}
|
|
226
|
-
function Ce(e) {
|
|
227
|
-
return String(e.componentProps.type ?? "text");
|
|
228
|
-
}
|
|
229
|
-
function Ee(e) {
|
|
230
|
-
return e.component === "daterange" ? [`${e.id}-start`, `${e.id}-end`] : e.id;
|
|
231
|
-
}
|
|
232
|
-
function De(e) {
|
|
233
|
-
return e.component === "daterange" ? [`${e.field}-start`, `${e.field}-end`] : e.field;
|
|
234
|
-
}
|
|
235
|
-
function B(e) {
|
|
236
|
-
return f.disabled || e.disabled || e.readonly || y.value === "edit" && !!e.editDisabled || !!e.componentProps.disabled;
|
|
237
|
-
}
|
|
238
|
-
function V(e) {
|
|
239
|
-
return typeof e.span == "number" ? Math.min(24, Math.max(1, e.span)) : Math.floor(24 / Math.max(1, f.columns));
|
|
240
|
-
}
|
|
241
|
-
function H(e) {
|
|
242
|
-
let t = e.dictionary ?? e.dictType;
|
|
243
|
-
return t ? ae.value[t] ?? [] : e.options;
|
|
244
|
-
}
|
|
245
|
-
function K(e) {
|
|
246
|
-
return e.componentProps;
|
|
247
|
-
}
|
|
248
|
-
function q(e) {
|
|
249
|
-
let t = k.value[e.field];
|
|
250
|
-
if (e.formatter) return e.formatter(t, k.value);
|
|
251
|
-
let n = (Array.isArray(t) ? t : [t]).map((t) => H(e).find((e) => String(e.value) === String(t))?.label ?? t).filter((e) => e != null && e !== "");
|
|
252
|
-
return n.length > 0 ? n.map(String).join(", ") : "-";
|
|
253
|
-
}
|
|
254
|
-
function J(e, t) {
|
|
255
|
-
return {
|
|
256
|
-
field: e,
|
|
257
|
-
getValues: () => k.value,
|
|
258
|
-
mode: y.value,
|
|
259
|
-
model: k.value,
|
|
260
|
-
setFieldValue: Y,
|
|
261
|
-
value: t
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
function Y(e, t) {
|
|
265
|
-
let n = {
|
|
266
|
-
...k.value,
|
|
267
|
-
[e]: t
|
|
268
|
-
};
|
|
269
|
-
m.value = n, te.value.find((t) => t.field === e)?.onChange?.(t, J(e, t)), p("valuesChange", n, [e]);
|
|
270
|
-
}
|
|
271
|
-
function X(e, t) {
|
|
272
|
-
Y(e, t);
|
|
273
|
-
}
|
|
274
|
-
async function Z() {
|
|
275
|
-
y.value === "view" || f.submitLoading || await Fe() && p("submit", k.value);
|
|
276
|
-
}
|
|
277
|
-
function Q(e) {
|
|
278
|
-
!f.submitOnEnter || e.isComposing || e.target?.tagName === "TEXTAREA" || (e.preventDefault(), Z());
|
|
279
|
-
}
|
|
280
|
-
function $() {
|
|
281
|
-
Ie(), p("reset", k.value);
|
|
282
|
-
}
|
|
283
|
-
function Ae(e) {
|
|
284
|
-
return `field-${e.field}`;
|
|
285
|
-
}
|
|
286
|
-
function je(e) {
|
|
287
|
-
return `prefix-${e.field}`;
|
|
288
|
-
}
|
|
289
|
-
function Me(e) {
|
|
290
|
-
return `suffix-${e.field}`;
|
|
291
|
-
}
|
|
292
|
-
function Ne(e) {
|
|
293
|
-
m.value = {
|
|
294
|
-
...k.value,
|
|
295
|
-
...e
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
function Pe(e) {
|
|
299
|
-
y.value = e;
|
|
300
|
-
}
|
|
301
|
-
async function Fe() {
|
|
302
|
-
try {
|
|
303
|
-
return await g.value?.validate?.() !== !1;
|
|
304
|
-
} catch (e) {
|
|
305
|
-
if (f.scrollToFirstError && e && typeof e == "object") {
|
|
306
|
-
let t = Object.keys(e)[0];
|
|
307
|
-
t && g.value?.scrollToField?.(t);
|
|
308
|
-
}
|
|
309
|
-
return !1;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
function Ie() {
|
|
313
|
-
g.value?.resetFields?.(), m.value = Oe(te.value, v.value);
|
|
314
|
-
}
|
|
315
|
-
function Le(e) {
|
|
316
|
-
g.value?.clearValidate?.(e);
|
|
317
|
-
}
|
|
318
|
-
function Re(e) {
|
|
319
|
-
g.value?.scrollToField?.(e);
|
|
320
|
-
}
|
|
321
|
-
function ze(e) {
|
|
322
|
-
return (g.value?.$el)?.querySelector(`[data-field="${e}"] input, [data-field="${e}"] textarea, [data-field="${e}"] select, [data-field="${e}"] button`) ?? void 0;
|
|
323
|
-
}
|
|
324
|
-
return n({
|
|
325
|
-
clearValidate: Le,
|
|
326
|
-
getFieldComponent: ze,
|
|
327
|
-
getFormElement: () => g.value?.$el,
|
|
328
|
-
getFormInstance: () => g.value,
|
|
329
|
-
getValues: () => k.value,
|
|
330
|
-
resetFields: Ie,
|
|
331
|
-
scrollToField: Re,
|
|
332
|
-
setFieldValue: Y,
|
|
333
|
-
setMode: Pe,
|
|
334
|
-
setValues: Ne,
|
|
335
|
-
validate: Fe
|
|
336
|
-
}), (t, n) => ne((b(), a(T(ce), {
|
|
337
|
-
ref_key: "formRef",
|
|
338
|
-
ref: g,
|
|
339
|
-
class: _(["lumal-schema-form", { "is-compact": f.compact }]),
|
|
340
|
-
disabled: f.disabled,
|
|
341
|
-
"label-position": f.labelPosition,
|
|
342
|
-
"label-width": f.labelWidth,
|
|
343
|
-
model: k.value,
|
|
344
|
-
onKeydown: re(Q, ["enter"]),
|
|
345
|
-
onSubmit: ie(Z, ["prevent"])
|
|
346
|
-
}, {
|
|
347
|
-
default: j(() => [d(T(ye), {
|
|
348
|
-
class: "lumal-schema-form__row",
|
|
349
|
-
gutter: f.gutter,
|
|
350
|
-
"data-columns": f.columns
|
|
351
|
-
}, {
|
|
352
|
-
default: j(() => [(b(!0), s(r, null, x(D.value, (e) => (b(), a(T(I), {
|
|
353
|
-
key: e.field,
|
|
354
|
-
span: V(e),
|
|
355
|
-
class: _({ "is-full-span": V(e) === 24 })
|
|
356
|
-
}, {
|
|
357
|
-
default: j(() => [d(T(le), {
|
|
358
|
-
class: "lumal-schema-form__item",
|
|
359
|
-
label: e.label,
|
|
360
|
-
prop: e.field,
|
|
361
|
-
required: e.required,
|
|
362
|
-
rules: e.rules,
|
|
363
|
-
"data-field": e.field
|
|
364
|
-
}, {
|
|
365
|
-
default: j(() => [
|
|
366
|
-
S(t.$slots, je(e), {
|
|
367
|
-
model: k.value,
|
|
368
|
-
schema: e,
|
|
369
|
-
value: k.value[e.field]
|
|
370
|
-
}, void 0, !0),
|
|
371
|
-
S(t.$slots, Ae(e), {
|
|
372
|
-
model: k.value,
|
|
373
|
-
schema: e,
|
|
374
|
-
value: k.value[e.field]
|
|
375
|
-
}, () => [y.value === "view" ? (b(), s("span", ke, w(q(e)), 1)) : e.component === "textarea" ? (b(), a(T(ue), h({
|
|
376
|
-
key: 1,
|
|
377
|
-
ref_for: !0
|
|
378
|
-
}, K(e), {
|
|
379
|
-
id: e.id,
|
|
380
|
-
"model-value": M(e.field),
|
|
381
|
-
name: e.field,
|
|
382
|
-
placeholder: e.placeholder,
|
|
383
|
-
disabled: B(e),
|
|
384
|
-
required: e.required,
|
|
385
|
-
type: "textarea",
|
|
386
|
-
"onUpdate:modelValue": (t) => X(e.field, t)
|
|
387
|
-
}), null, 16, [
|
|
388
|
-
"id",
|
|
389
|
-
"model-value",
|
|
390
|
-
"name",
|
|
391
|
-
"placeholder",
|
|
392
|
-
"disabled",
|
|
393
|
-
"required",
|
|
394
|
-
"onUpdate:modelValue"
|
|
395
|
-
])) : e.component === "select" ? (b(), a(T(be), h({
|
|
396
|
-
key: 2,
|
|
397
|
-
ref_for: !0
|
|
398
|
-
}, K(e), {
|
|
399
|
-
id: e.id,
|
|
400
|
-
"model-value": N(e.field),
|
|
401
|
-
name: e.field,
|
|
402
|
-
placeholder: e.placeholder,
|
|
403
|
-
disabled: B(e),
|
|
404
|
-
required: e.required,
|
|
405
|
-
"onUpdate:modelValue": (t) => X(e.field, t)
|
|
406
|
-
}), {
|
|
407
|
-
default: j(() => [(b(!0), s(r, null, x(H(e), (e) => (b(), a(T(me), {
|
|
408
|
-
key: String(e.value),
|
|
409
|
-
label: e.label,
|
|
410
|
-
value: e.value,
|
|
411
|
-
disabled: e.disabled
|
|
412
|
-
}, null, 8, [
|
|
413
|
-
"label",
|
|
414
|
-
"value",
|
|
415
|
-
"disabled"
|
|
416
|
-
]))), 128))]),
|
|
417
|
-
_: 2
|
|
418
|
-
}, 1040, [
|
|
419
|
-
"id",
|
|
420
|
-
"model-value",
|
|
421
|
-
"name",
|
|
422
|
-
"placeholder",
|
|
423
|
-
"disabled",
|
|
424
|
-
"required",
|
|
425
|
-
"onUpdate:modelValue"
|
|
426
|
-
])) : e.component === "number" ? (b(), a(T(de), h({
|
|
427
|
-
key: 3,
|
|
428
|
-
ref_for: !0
|
|
429
|
-
}, K(e), {
|
|
430
|
-
id: e.id,
|
|
431
|
-
"model-value": R(e.field),
|
|
432
|
-
name: e.field,
|
|
433
|
-
placeholder: e.placeholder,
|
|
434
|
-
disabled: B(e),
|
|
435
|
-
"onUpdate:modelValue": (t) => X(e.field, t)
|
|
436
|
-
}), l({ _: 2 }, [e.prefix ? {
|
|
437
|
-
name: "prefix",
|
|
438
|
-
fn: j(() => [u(w(e.prefix), 1)]),
|
|
439
|
-
key: "0"
|
|
440
|
-
} : void 0, e.suffix ? {
|
|
441
|
-
name: "suffix",
|
|
442
|
-
fn: j(() => [u(w(e.suffix), 1)]),
|
|
443
|
-
key: "1"
|
|
444
|
-
} : void 0]), 1040, [
|
|
445
|
-
"id",
|
|
446
|
-
"model-value",
|
|
447
|
-
"name",
|
|
448
|
-
"placeholder",
|
|
449
|
-
"disabled",
|
|
450
|
-
"onUpdate:modelValue"
|
|
451
|
-
])) : e.component === "switch" ? (b(), a(T(xe), h({
|
|
452
|
-
key: 4,
|
|
453
|
-
ref_for: !0
|
|
454
|
-
}, K(e), {
|
|
455
|
-
"model-value": z(e.field),
|
|
456
|
-
name: e.field,
|
|
457
|
-
disabled: B(e),
|
|
458
|
-
"onUpdate:modelValue": (t) => X(e.field, t)
|
|
459
|
-
}), null, 16, [
|
|
460
|
-
"model-value",
|
|
461
|
-
"name",
|
|
462
|
-
"disabled",
|
|
463
|
-
"onUpdate:modelValue"
|
|
464
|
-
])) : e.component === "date" || e.component === "datetime" || e.component === "daterange" ? (b(), a(T(L), h({
|
|
465
|
-
key: 5,
|
|
466
|
-
ref_for: !0
|
|
467
|
-
}, K(e), {
|
|
468
|
-
id: Ee(e),
|
|
469
|
-
"model-value": he(e.field),
|
|
470
|
-
name: De(e),
|
|
471
|
-
placeholder: e.placeholder,
|
|
472
|
-
disabled: B(e),
|
|
473
|
-
type: ge(e),
|
|
474
|
-
"onUpdate:modelValue": (t) => X(e.field, t)
|
|
475
|
-
}), null, 16, [
|
|
476
|
-
"id",
|
|
477
|
-
"model-value",
|
|
478
|
-
"name",
|
|
479
|
-
"placeholder",
|
|
480
|
-
"disabled",
|
|
481
|
-
"type",
|
|
482
|
-
"onUpdate:modelValue"
|
|
483
|
-
])) : e.component === "radio" ? (b(), a(T(ve), h({
|
|
484
|
-
key: 6,
|
|
485
|
-
ref_for: !0
|
|
486
|
-
}, K(e), {
|
|
487
|
-
"model-value": oe(e.field),
|
|
488
|
-
name: e.field,
|
|
489
|
-
disabled: B(e),
|
|
490
|
-
"onUpdate:modelValue": (t) => X(e.field, t)
|
|
491
|
-
}), {
|
|
492
|
-
default: j(() => [(b(!0), s(r, null, x(H(e), (e) => (b(), a(T(_e), {
|
|
493
|
-
key: String(e.value),
|
|
494
|
-
value: e.value,
|
|
495
|
-
disabled: e.disabled
|
|
496
|
-
}, {
|
|
497
|
-
default: j(() => [u(w(e.label), 1)]),
|
|
498
|
-
_: 2
|
|
499
|
-
}, 1032, ["value", "disabled"]))), 128))]),
|
|
500
|
-
_: 2
|
|
501
|
-
}, 1040, [
|
|
502
|
-
"model-value",
|
|
503
|
-
"name",
|
|
504
|
-
"disabled",
|
|
505
|
-
"onUpdate:modelValue"
|
|
506
|
-
])) : e.component === "checkbox" ? (b(), a(T(F), h({
|
|
507
|
-
key: 7,
|
|
508
|
-
ref_for: !0
|
|
509
|
-
}, K(e), {
|
|
510
|
-
"model-value": pe(e.field),
|
|
511
|
-
name: e.field,
|
|
512
|
-
disabled: B(e),
|
|
513
|
-
"onUpdate:modelValue": (t) => X(e.field, t)
|
|
514
|
-
}), {
|
|
515
|
-
default: j(() => [(b(!0), s(r, null, x(H(e), (e) => (b(), a(T(se), {
|
|
516
|
-
key: String(e.value),
|
|
517
|
-
value: e.value,
|
|
518
|
-
disabled: e.disabled
|
|
519
|
-
}, {
|
|
520
|
-
default: j(() => [u(w(e.label), 1)]),
|
|
521
|
-
_: 2
|
|
522
|
-
}, 1032, ["value", "disabled"]))), 128))]),
|
|
523
|
-
_: 2
|
|
524
|
-
}, 1040, [
|
|
525
|
-
"model-value",
|
|
526
|
-
"name",
|
|
527
|
-
"disabled",
|
|
528
|
-
"onUpdate:modelValue"
|
|
529
|
-
])) : e.component === "tree-select" ? (b(), a(T(we), h({
|
|
530
|
-
key: 8,
|
|
531
|
-
ref_for: !0
|
|
532
|
-
}, K(e), {
|
|
533
|
-
id: e.id,
|
|
534
|
-
"model-value": Se(e.field),
|
|
535
|
-
name: e.field,
|
|
536
|
-
placeholder: e.placeholder,
|
|
537
|
-
disabled: B(e),
|
|
538
|
-
"onUpdate:modelValue": (t) => X(e.field, t)
|
|
539
|
-
}), null, 16, [
|
|
540
|
-
"id",
|
|
541
|
-
"model-value",
|
|
542
|
-
"name",
|
|
543
|
-
"placeholder",
|
|
544
|
-
"disabled",
|
|
545
|
-
"onUpdate:modelValue"
|
|
546
|
-
])) : e.component === "upload" ? (b(), a(T(Te), h({
|
|
547
|
-
key: 9,
|
|
548
|
-
ref_for: !0
|
|
549
|
-
}, K(e), { disabled: B(e) }), {
|
|
550
|
-
default: j(() => [d(T(P), { type: "primary" }, {
|
|
551
|
-
default: j(() => [...n[0] ||= [u(" 上传 ", -1)]]),
|
|
552
|
-
_: 1
|
|
553
|
-
})]),
|
|
554
|
-
_: 1
|
|
555
|
-
}, 16, ["disabled"])) : (b(), a(T(ue), h({
|
|
556
|
-
key: 10,
|
|
557
|
-
ref_for: !0
|
|
558
|
-
}, K(e), {
|
|
559
|
-
id: e.id,
|
|
560
|
-
"model-value": M(e.field),
|
|
561
|
-
name: e.field,
|
|
562
|
-
type: Ce(e),
|
|
563
|
-
placeholder: e.placeholder,
|
|
564
|
-
disabled: B(e),
|
|
565
|
-
required: e.required,
|
|
566
|
-
"onUpdate:modelValue": (t) => X(e.field, t)
|
|
567
|
-
}), l({ _: 2 }, [
|
|
568
|
-
e.prepend ? {
|
|
569
|
-
name: "prepend",
|
|
570
|
-
fn: j(() => [u(w(e.prepend), 1)]),
|
|
571
|
-
key: "0"
|
|
572
|
-
} : void 0,
|
|
573
|
-
e.append ? {
|
|
574
|
-
name: "append",
|
|
575
|
-
fn: j(() => [u(w(e.append), 1)]),
|
|
576
|
-
key: "1"
|
|
577
|
-
} : void 0,
|
|
578
|
-
e.prefix ? {
|
|
579
|
-
name: "prefix",
|
|
580
|
-
fn: j(() => [u(w(e.prefix), 1)]),
|
|
581
|
-
key: "2"
|
|
582
|
-
} : void 0,
|
|
583
|
-
e.suffix ? {
|
|
584
|
-
name: "suffix",
|
|
585
|
-
fn: j(() => [u(w(e.suffix), 1)]),
|
|
586
|
-
key: "3"
|
|
587
|
-
} : void 0
|
|
588
|
-
]), 1040, [
|
|
589
|
-
"id",
|
|
590
|
-
"model-value",
|
|
591
|
-
"name",
|
|
592
|
-
"type",
|
|
593
|
-
"placeholder",
|
|
594
|
-
"disabled",
|
|
595
|
-
"required",
|
|
596
|
-
"onUpdate:modelValue"
|
|
597
|
-
]))], !0),
|
|
598
|
-
S(t.$slots, Me(e), {
|
|
599
|
-
model: k.value,
|
|
600
|
-
schema: e,
|
|
601
|
-
value: k.value[e.field]
|
|
602
|
-
}, void 0, !0),
|
|
603
|
-
e.description ? (b(), s("p", W, w(e.description), 1)) : o("", !0),
|
|
604
|
-
e.help ? (b(), s("p", G, w(e.help), 1)) : o("", !0)
|
|
605
|
-
]),
|
|
606
|
-
_: 2
|
|
607
|
-
}, 1032, [
|
|
608
|
-
"label",
|
|
609
|
-
"prop",
|
|
610
|
-
"required",
|
|
611
|
-
"rules",
|
|
612
|
-
"data-field"
|
|
613
|
-
])]),
|
|
614
|
-
_: 2
|
|
615
|
-
}, 1032, ["span", "class"]))), 128))]),
|
|
616
|
-
_: 3
|
|
617
|
-
}, 8, ["gutter", "data-columns"]), e.showActions && y.value !== "view" ? (b(), s("div", {
|
|
618
|
-
key: 0,
|
|
619
|
-
class: _(["lumal-schema-form__actions", [`is-${e.actionLayout}`, `is-${e.actionPosition}`]])
|
|
620
|
-
}, [e.showReset ? (b(), a(T(P), {
|
|
621
|
-
key: 0,
|
|
622
|
-
"native-type": "button",
|
|
623
|
-
disabled: e.submitLoading,
|
|
624
|
-
onClick: $
|
|
625
|
-
}, {
|
|
626
|
-
default: j(() => [u(w(e.resetText), 1)]),
|
|
627
|
-
_: 1
|
|
628
|
-
}, 8, ["disabled"])) : o("", !0), d(T(P), {
|
|
629
|
-
type: "primary",
|
|
630
|
-
"native-type": "submit",
|
|
631
|
-
loading: e.submitLoading,
|
|
632
|
-
disabled: e.submitLoading
|
|
633
|
-
}, {
|
|
634
|
-
default: j(() => [u(w(e.submitText), 1)]),
|
|
635
|
-
_: 1
|
|
636
|
-
}, 8, ["loading", "disabled"])], 2)) : o("", !0)]),
|
|
637
|
-
_: 3
|
|
638
|
-
}, 8, [
|
|
639
|
-
"class",
|
|
640
|
-
"disabled",
|
|
641
|
-
"label-position",
|
|
642
|
-
"label-width",
|
|
643
|
-
"model"
|
|
644
|
-
])), [[T(ee), f.loading]]);
|
|
645
|
-
}
|
|
646
|
-
}), [["__scopeId", "data-v-5c24440d"]]);
|
|
647
|
-
//#endregion
|
|
648
|
-
//#region src/components/schema-table/cell.ts
|
|
649
|
-
function q(e) {
|
|
650
|
-
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");
|
|
651
|
-
}
|
|
652
|
-
function J(e, t) {
|
|
653
|
-
let n = (Array.isArray(t) ? t : [t]).map((t, n) => {
|
|
654
|
-
let r = e.find((e) => String(e.value) === String(t));
|
|
655
|
-
return {
|
|
656
|
-
...r?.color ? { color: r.color } : {},
|
|
657
|
-
key: `${String(t)}-${n}`,
|
|
658
|
-
label: r?.label ?? String(t)
|
|
659
|
-
};
|
|
660
|
-
});
|
|
661
|
-
return n.some((e) => e.color) ? n : [];
|
|
662
|
-
}
|
|
663
|
-
function Y(t, n, r, i = []) {
|
|
664
|
-
let a = t[n.field], o = n.formatter?.(a, t, r) ?? a;
|
|
665
|
-
return o == null || o === "" || Array.isArray(o) && o.length === 0 ? {
|
|
666
|
-
tags: [],
|
|
667
|
-
text: n.emptyText
|
|
668
|
-
} : n.formatter ? {
|
|
669
|
-
tags: [],
|
|
670
|
-
text: String(o)
|
|
671
|
-
} : i.length > 0 && q(o) ? {
|
|
672
|
-
tags: J(i, o),
|
|
673
|
-
text: e(i, o)
|
|
674
|
-
} : {
|
|
675
|
-
tags: [],
|
|
676
|
-
text: Array.isArray(o) ? o.map((e) => String(e)).join(", ") : String(o)
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
//#endregion
|
|
680
|
-
//#region src/components/schema-table/LumalSchemaTableCell.vue?vue&type=script&setup=true&lang.ts
|
|
681
|
-
var X = {
|
|
682
|
-
key: 0,
|
|
683
|
-
class: "lumal-schema-table__dictionary-tags"
|
|
684
|
-
}, Z = {
|
|
685
|
-
key: 0,
|
|
686
|
-
class: "lumal-schema-table__dictionary-dot",
|
|
687
|
-
"aria-hidden": "true"
|
|
688
|
-
}, Q = { key: 1 }, $ = /*#__PURE__*/ n(/* @__PURE__ */ f({
|
|
689
|
-
__name: "LumalSchemaTableCell",
|
|
690
|
-
props: { display: {} },
|
|
691
|
-
setup(e) {
|
|
692
|
-
function t(e) {
|
|
693
|
-
return e.color ? { "--lumal-dictionary-color": e.color } : void 0;
|
|
694
|
-
}
|
|
695
|
-
return (n, i) => e.display.tags.length ? (b(), s("div", X, [(b(!0), s(r, null, x(e.display.tags, (e) => (b(), s("span", {
|
|
696
|
-
key: e.key,
|
|
697
|
-
class: "lumal-schema-table__dictionary-tag",
|
|
698
|
-
style: v(t(e))
|
|
699
|
-
}, [e.color ? (b(), s("span", Z)) : o("", !0), c("span", null, w(e.label), 1)], 4))), 128))])) : (b(), s("span", Q, w(e.display.text), 1));
|
|
700
|
-
}
|
|
701
|
-
}), [["__scopeId", "data-v-ad0cf9f4"]]);
|
|
702
|
-
//#endregion
|
|
703
|
-
//#region src/components/schema-table/normalize.ts
|
|
704
|
-
function Ae(e, t) {
|
|
705
|
-
return typeof e == "function" ? !!e(t) : !!e;
|
|
706
|
-
}
|
|
707
|
-
function je(e, t) {
|
|
708
|
-
return !e.authority || t.canAccess?.(e.authority) !== !1;
|
|
709
|
-
}
|
|
710
|
-
function Me(e = [], t = {}) {
|
|
711
|
-
let n = { rows: t.rows ?? [] };
|
|
712
|
-
return e.map((e) => ({
|
|
713
|
-
...e,
|
|
714
|
-
field: e.field.trim()
|
|
715
|
-
})).filter((e) => e.field).map((e) => ({
|
|
716
|
-
...e,
|
|
717
|
-
align: e.align ?? "left",
|
|
718
|
-
componentProps: e.componentProps ?? {},
|
|
719
|
-
emptyText: e.emptyText ?? "-",
|
|
720
|
-
renderable: (typeof e.hidden == "function" || !Ae(e.hidden, n)) && je(e, t)
|
|
721
|
-
}));
|
|
722
|
-
}
|
|
723
|
-
//#endregion
|
|
724
|
-
//#region src/components/schema-table/LumalSchemaTable.vue?vue&type=script&setup=true&lang.ts
|
|
725
|
-
var Ne = {
|
|
726
|
-
key: 0,
|
|
727
|
-
class: "lumal-schema-table__toolbar"
|
|
728
|
-
}, Pe = {
|
|
729
|
-
key: 0,
|
|
730
|
-
class: "lumal-schema-table__toolbar-title"
|
|
731
|
-
}, Fe = {
|
|
732
|
-
key: 1,
|
|
733
|
-
class: "lumal-schema-table__toolbar-content"
|
|
734
|
-
}, Ie = {
|
|
735
|
-
key: 2,
|
|
736
|
-
class: "lumal-schema-table__toolbar-tools"
|
|
737
|
-
}, Le = {
|
|
738
|
-
key: 0,
|
|
739
|
-
class: "lumal-schema-table__column-settings"
|
|
740
|
-
}, Re = {
|
|
741
|
-
class: "lumal-schema-table__column-settings-trigger",
|
|
742
|
-
"aria-label": "列设置",
|
|
743
|
-
title: "列设置"
|
|
744
|
-
}, ze = { class: "lumal-schema-table__column-options" }, Be = [
|
|
745
|
-
"draggable",
|
|
746
|
-
"onDragstart",
|
|
747
|
-
"onDrop"
|
|
748
|
-
], Ve = {
|
|
749
|
-
key: 0,
|
|
750
|
-
class: "lumal-schema-table__column-order-actions"
|
|
751
|
-
}, He = [
|
|
752
|
-
"disabled",
|
|
753
|
-
"aria-label",
|
|
754
|
-
"onClick"
|
|
755
|
-
], Ue = [
|
|
756
|
-
"disabled",
|
|
757
|
-
"aria-label",
|
|
758
|
-
"onClick"
|
|
759
|
-
], We = {
|
|
760
|
-
key: 1,
|
|
761
|
-
class: "lumal-schema-table__error",
|
|
762
|
-
role: "alert"
|
|
763
|
-
}, Ge = {
|
|
764
|
-
key: 2,
|
|
765
|
-
class: "lumal-schema-table__scroll"
|
|
766
|
-
}, Ke = { class: "lumal-schema-table__actions lumal-schema-table__actions--desktop" }, qe = [
|
|
767
|
-
"aria-expanded",
|
|
768
|
-
"onClick",
|
|
769
|
-
"onKeydown"
|
|
770
|
-
], Je = {
|
|
771
|
-
key: 3,
|
|
772
|
-
class: "lumal-schema-table__pagination"
|
|
773
|
-
}, Ye = /*#__PURE__*/ n(/* @__PURE__ */ f({
|
|
774
|
-
__name: "LumalSchemaTable",
|
|
775
|
-
props: /*@__PURE__*/ m({
|
|
776
|
-
actionLabel: { default: "操作" },
|
|
777
|
-
actionWidth: { default: 160 },
|
|
778
|
-
autoResize: {
|
|
779
|
-
type: Boolean,
|
|
780
|
-
default: !0
|
|
781
|
-
},
|
|
782
|
-
canAccess: {},
|
|
783
|
-
cellClassName: {},
|
|
784
|
-
columnResizable: {
|
|
785
|
-
type: Boolean,
|
|
786
|
-
default: !0
|
|
787
|
-
},
|
|
788
|
-
columnSettings: {},
|
|
789
|
-
columns: {},
|
|
790
|
-
defaultExpandAll: { type: Boolean },
|
|
791
|
-
emptyText: { default: "暂无数据" },
|
|
792
|
-
error: {
|
|
793
|
-
type: [
|
|
794
|
-
Error,
|
|
795
|
-
String,
|
|
796
|
-
Boolean
|
|
797
|
-
],
|
|
798
|
-
default: !1
|
|
799
|
-
},
|
|
800
|
-
errorText: { default: "数据加载失败" },
|
|
801
|
-
headerCellClassName: {},
|
|
802
|
-
indexLabel: { default: "#" },
|
|
803
|
-
indexWidth: { default: 64 },
|
|
804
|
-
loading: {
|
|
805
|
-
type: Boolean,
|
|
806
|
-
default: !1
|
|
807
|
-
},
|
|
808
|
-
mobileActionLabel: { default: "更多" },
|
|
809
|
-
mobileActionWidth: { default: 72 },
|
|
810
|
-
pageSizes: { default: () => [
|
|
811
|
-
10,
|
|
812
|
-
20,
|
|
813
|
-
50,
|
|
814
|
-
100
|
|
815
|
-
] },
|
|
816
|
-
pagination: {
|
|
817
|
-
type: Boolean,
|
|
818
|
-
default: !1
|
|
819
|
-
},
|
|
820
|
-
rowClassName: {},
|
|
821
|
-
rowKey: {
|
|
822
|
-
type: [String, Function],
|
|
823
|
-
default: "id"
|
|
824
|
-
},
|
|
825
|
-
rows: { default: () => [] },
|
|
826
|
-
retryText: { default: "重新加载" },
|
|
827
|
-
scaleColumnWidth: {
|
|
828
|
-
type: Boolean,
|
|
829
|
-
default: !0
|
|
830
|
-
},
|
|
831
|
-
selection: {
|
|
832
|
-
type: Boolean,
|
|
833
|
-
default: !1
|
|
834
|
-
},
|
|
835
|
-
showColumnSettings: {
|
|
836
|
-
type: Boolean,
|
|
837
|
-
default: !1
|
|
838
|
-
},
|
|
839
|
-
showIndex: {
|
|
840
|
-
type: Boolean,
|
|
841
|
-
default: !1
|
|
842
|
-
},
|
|
843
|
-
tableProps: { default: () => ({}) },
|
|
844
|
-
total: { default: 0 },
|
|
845
|
-
treeProps: {}
|
|
846
|
-
}, {
|
|
847
|
-
page: { default: 1 },
|
|
848
|
-
pageModifiers: {},
|
|
849
|
-
pageSize: { default: 10 },
|
|
850
|
-
pageSizeModifiers: {}
|
|
851
|
-
}),
|
|
852
|
-
emits: /*@__PURE__*/ m([
|
|
853
|
-
"currentChange",
|
|
854
|
-
"expandChange",
|
|
855
|
-
"filterChange",
|
|
856
|
-
"pageChange",
|
|
857
|
-
"retry",
|
|
858
|
-
"rowClick",
|
|
859
|
-
"selectionChange",
|
|
860
|
-
"sortChange"
|
|
861
|
-
], ["update:page", "update:pageSize"]),
|
|
862
|
-
setup(e, { expose: n, emit: l }) {
|
|
863
|
-
let f = e, p = l, m = E(e, "page"), _ = E(e, "pageSize"), ee = fe.directive, v = O("containerRef"), D = O("tableRef"), k = C(/* @__PURE__ */ new Set()), M = C([]), N = C([]), oe = C([]), P = C(typeof window < "u" && window.innerWidth <= 768), F = C(null), I, L, R = "", z = i(() => Me(f.columns, {
|
|
864
|
-
canAccess: f.canAccess,
|
|
865
|
-
rows: f.rows
|
|
866
|
-
})), ce = i(() => {
|
|
867
|
-
let e = M.value;
|
|
868
|
-
if (e.length === 0) return z.value;
|
|
869
|
-
let t = new Map(e.map((e, t) => [e, t]));
|
|
870
|
-
return [...z.value].sort((e, n) => (t.get(String(e.field)) ?? 2 ** 53 - 1) - (t.get(String(n.field)) ?? 2 ** 53 - 1));
|
|
871
|
-
}), le = i(() => ce.value.filter((e) => e.renderable && !k.value.has(String(e.field)))), ue = i(() => ce.value.filter((e) => e.renderable && !e.fixed && e.configurable !== !1)), de = i(() => [...le.value].reverse().find((e) => !e.fixed)?.field), { dictionaryMap: pe } = t(() => z.value.map((e) => e.dictionary ?? e.dictType)), me = i(() => {
|
|
872
|
-
if (typeof f.rowKey != "function") return f.rowKey;
|
|
873
|
-
let e = f.rowKey;
|
|
874
|
-
return (t) => String(e(t, f.rows.indexOf(t)));
|
|
875
|
-
}), he = i(() => f.pagination && f.total > 0), _e = i(() => f.showColumnSettings || f.columnSettings?.enabled), ve = i(() => P.value ? f.mobileActionWidth : f.actionWidth), ye = i(() => f.error instanceof Error ? f.error.message || f.errorText : typeof f.error == "string" ? f.error : f.errorText), be = i(() => f.defaultExpandAll ?? !!f.tableProps.defaultExpandAll), xe = i(() => f.treeProps ?? f.tableProps.treeProps ?? {
|
|
876
|
-
children: "children",
|
|
877
|
-
hasChildren: "hasChildren"
|
|
878
|
-
});
|
|
879
|
-
function we(e) {
|
|
880
|
-
let t = new Set(k.value);
|
|
881
|
-
if (t.has(e)) t.delete(e);
|
|
882
|
-
else {
|
|
883
|
-
if (ue.value.filter((e) => !t.has(String(e.field))).length <= 1) return;
|
|
884
|
-
t.add(e);
|
|
885
|
-
}
|
|
886
|
-
k.value = t, H(), g(() => D.value?.doLayout?.());
|
|
887
|
-
}
|
|
888
|
-
function Te() {
|
|
889
|
-
k.value = /* @__PURE__ */ new Set(), M.value = z.value.map((e) => String(e.field)), H(), g(() => D.value?.doLayout?.());
|
|
890
|
-
}
|
|
891
|
-
function De(e, t) {
|
|
892
|
-
let n = ue.value.map((e) => String(e.field)), r = n.indexOf(e), i = r + t;
|
|
893
|
-
if (r < 0 || i < 0 || i >= n.length) return;
|
|
894
|
-
let a = n[i], o = ce.value.map((e) => String(e.field)), s = o.indexOf(e), c = o.indexOf(a);
|
|
895
|
-
o.splice(s, 1), o.splice(c, 0, e), M.value = o, H(), g(() => D.value?.doLayout?.());
|
|
896
|
-
}
|
|
897
|
-
function B(e) {
|
|
898
|
-
R = e;
|
|
899
|
-
}
|
|
900
|
-
function V(e) {
|
|
901
|
-
if (!R || R === e) {
|
|
902
|
-
R = "";
|
|
903
|
-
return;
|
|
904
|
-
}
|
|
905
|
-
let t = ce.value.map((e) => String(e.field)), n = t.indexOf(R), r = t.indexOf(e);
|
|
906
|
-
n >= 0 && r >= 0 && (t.splice(n, 1), t.splice(r, 0, R), M.value = t, H(), g(() => D.value?.doLayout?.())), R = "";
|
|
907
|
-
}
|
|
908
|
-
function H() {
|
|
909
|
-
let e = f.columnSettings?.storageKey;
|
|
910
|
-
if (!(!e || typeof localStorage > "u")) try {
|
|
911
|
-
localStorage.setItem(e, JSON.stringify({
|
|
912
|
-
hidden: [...k.value],
|
|
913
|
-
order: M.value
|
|
914
|
-
}));
|
|
915
|
-
} catch {}
|
|
916
|
-
}
|
|
917
|
-
function U() {
|
|
918
|
-
M.value = z.value.map((e) => String(e.field));
|
|
919
|
-
let e = f.columnSettings?.storageKey;
|
|
920
|
-
if (!(!e || typeof localStorage > "u")) try {
|
|
921
|
-
let t = JSON.parse(localStorage.getItem(e) ?? "{}"), n = new Set(z.value.map((e) => String(e.field)));
|
|
922
|
-
k.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))];
|
|
923
|
-
} catch {
|
|
924
|
-
Te();
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
function Oe(e) {
|
|
928
|
-
let t = e.dictionary ?? e.dictType;
|
|
929
|
-
return t ? pe.value[t] ?? [] : T(e.options) ?? [];
|
|
930
|
-
}
|
|
931
|
-
function ke(e, t, n) {
|
|
932
|
-
return typeof t.hidden == "function" && !!t.hidden({
|
|
933
|
-
rows: f.rows,
|
|
934
|
-
row: e,
|
|
935
|
-
index: n
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
function W(e, t, n) {
|
|
939
|
-
return Y(e, t, n, Oe(t));
|
|
940
|
-
}
|
|
941
|
-
function G(e) {
|
|
942
|
-
return (t, n, r, i) => ke(t, e, i) ? "" : W(t, e, i).text;
|
|
943
|
-
}
|
|
944
|
-
function K(e) {
|
|
945
|
-
if (!f.scaleColumnWidth) return;
|
|
946
|
-
let t = e.minWidth ?? e.componentProps.minWidth;
|
|
947
|
-
return e.field === de.value ? t ?? e.width ?? e.componentProps.width : t;
|
|
948
|
-
}
|
|
949
|
-
function q(e) {
|
|
950
|
-
if (!(!f.scaleColumnWidth || e.field === de.value)) return e.width;
|
|
951
|
-
}
|
|
952
|
-
function J(e, t) {
|
|
953
|
-
if (typeof f.rowKey == "function") return f.rowKey(e, t);
|
|
954
|
-
let n = f.rowKey ? e[f.rowKey] : void 0;
|
|
955
|
-
return typeof n == "string" || typeof n == "number" ? n : void 0;
|
|
956
|
-
}
|
|
957
|
-
function X(e, t) {
|
|
958
|
-
let n = J(e, t);
|
|
959
|
-
return n === void 0 ? `index:${t}` : `row:${typeof n}:${n}`;
|
|
960
|
-
}
|
|
961
|
-
function Z(e, t) {
|
|
962
|
-
return F.value === X(e, t);
|
|
963
|
-
}
|
|
964
|
-
function Q(e, t, n) {
|
|
965
|
-
let r = X(e, t);
|
|
966
|
-
n ? F.value = r : F.value === r && (F.value = null);
|
|
967
|
-
}
|
|
968
|
-
function Ae(e, t) {
|
|
969
|
-
let n = X(e, t);
|
|
970
|
-
F.value = F.value === n ? null : n;
|
|
971
|
-
}
|
|
972
|
-
function je() {
|
|
973
|
-
F.value = null;
|
|
974
|
-
}
|
|
975
|
-
function Ye(e) {
|
|
976
|
-
N.value = e, oe.value = e.map((e) => J(e, f.rows.indexOf(e))).filter((e) => e !== void 0), p("selectionChange", e, oe.value);
|
|
977
|
-
}
|
|
978
|
-
function Xe(e) {
|
|
979
|
-
p("pageChange", e);
|
|
980
|
-
}
|
|
981
|
-
function Ze(e, t, n) {
|
|
982
|
-
p("rowClick", e, t, n);
|
|
983
|
-
}
|
|
984
|
-
function Qe(e, t) {
|
|
985
|
-
p("currentChange", e, t);
|
|
986
|
-
}
|
|
987
|
-
function $e(e, t) {
|
|
988
|
-
p("expandChange", e, t);
|
|
989
|
-
}
|
|
990
|
-
function et() {
|
|
991
|
-
if (typeof window > "u") return;
|
|
992
|
-
let e = window.innerWidth <= 768;
|
|
993
|
-
e !== P.value && (P.value = e, e || je(), g(() => D.value?.doLayout?.()));
|
|
994
|
-
}
|
|
995
|
-
function tt(e) {
|
|
996
|
-
e.key === "Escape" && je();
|
|
997
|
-
}
|
|
998
|
-
function nt() {
|
|
999
|
-
!f.autoResize || typeof ResizeObserver > "u" || !v.value || (I = new ResizeObserver(() => {
|
|
1000
|
-
L && clearTimeout(L), L = setTimeout(() => {
|
|
1001
|
-
L = void 0, D.value?.doLayout?.();
|
|
1002
|
-
});
|
|
1003
|
-
}), I.observe(v.value));
|
|
1004
|
-
}
|
|
1005
|
-
function rt() {
|
|
1006
|
-
I?.disconnect(), I = void 0, L &&= (clearTimeout(L), void 0);
|
|
1007
|
-
}
|
|
1008
|
-
return A(() => f.autoResize, () => {
|
|
1009
|
-
rt(), nt();
|
|
1010
|
-
}), A(() => [f.columns, f.columnSettings?.storageKey], U, { deep: !0 }), A(F, (e) => {
|
|
1011
|
-
typeof document > "u" || (document.removeEventListener("keydown", tt), e !== null && document.addEventListener("keydown", tt));
|
|
1012
|
-
}), te(() => {
|
|
1013
|
-
U(), et(), nt(), window.addEventListener("resize", et);
|
|
1014
|
-
}), y(() => {
|
|
1015
|
-
rt(), window.removeEventListener("resize", et), document.removeEventListener("keydown", tt);
|
|
1016
|
-
}), n({
|
|
1017
|
-
clearSelection: () => D.value?.clearSelection?.(),
|
|
1018
|
-
doLayout: () => D.value?.doLayout?.(),
|
|
1019
|
-
getSelectedRowKeys: () => [...oe.value],
|
|
1020
|
-
getSelectedRows: () => [...N.value],
|
|
1021
|
-
getColumnOrder: () => [...M.value],
|
|
1022
|
-
getExportData: (e = f.rows) => ({
|
|
1023
|
-
columns: le.value.map((e) => ({
|
|
1024
|
-
field: String(e.field),
|
|
1025
|
-
label: e.label
|
|
1026
|
-
})),
|
|
1027
|
-
rows: e.map((e) => le.value.map((t) => W(e, t, f.rows.indexOf(e)).text))
|
|
1028
|
-
}),
|
|
1029
|
-
getVisibleColumns: () => [...le.value],
|
|
1030
|
-
resetColumnSettings: Te,
|
|
1031
|
-
getTableElement: () => D.value?.$el,
|
|
1032
|
-
getTableInstance: () => D.value,
|
|
1033
|
-
toggleRowSelection: (e, t) => D.value?.toggleRowSelection?.(e, t)
|
|
1034
|
-
}), (t, n) => (b(), s("div", {
|
|
1035
|
-
ref_key: "containerRef",
|
|
1036
|
-
ref: v,
|
|
1037
|
-
class: "lumal-schema-table"
|
|
1038
|
-
}, [
|
|
1039
|
-
t.$slots["toolbar-title"] || t.$slots.toolbar || t.$slots["toolbar-tools"] || _e.value ? (b(), s("div", Ne, [
|
|
1040
|
-
t.$slots["toolbar-title"] ? (b(), s("div", Pe, [S(t.$slots, "toolbar-title", {}, void 0, !0)])) : o("", !0),
|
|
1041
|
-
t.$slots.toolbar ? (b(), s("div", Fe, [S(t.$slots, "toolbar", {}, void 0, !0)])) : o("", !0),
|
|
1042
|
-
t.$slots["toolbar-tools"] || _e.value ? (b(), s("div", Ie, [S(t.$slots, "toolbar-tools", {}, void 0, !0), _e.value ? (b(), s("div", Le, [c("details", null, [c("summary", Re, [d(T(ae), { name: "lumal:grid" })]), c("div", ze, [c("div", { class: "lumal-schema-table__column-options-header" }, [n[6] ||= c("strong", null, "列设置", -1), c("button", {
|
|
1043
|
-
type: "button",
|
|
1044
|
-
onClick: Te
|
|
1045
|
-
}, " 恢复默认 ")]), (b(!0), s(r, null, x(ue.value, (t, r) => (b(), s("div", {
|
|
1046
|
-
key: String(t.field),
|
|
1047
|
-
class: "lumal-schema-table__column-option",
|
|
1048
|
-
draggable: e.columnSettings?.reorderable !== !1,
|
|
1049
|
-
onDragstart: (e) => B(String(t.field)),
|
|
1050
|
-
onDragover: n[0] ||= ie(() => {}, ["prevent"]),
|
|
1051
|
-
onDrop: (e) => V(String(t.field))
|
|
1052
|
-
}, [d(T(se), {
|
|
1053
|
-
"model-value": !k.value.has(String(t.field)),
|
|
1054
|
-
"onUpdate:modelValue": (e) => we(String(t.field))
|
|
1055
|
-
}, {
|
|
1056
|
-
default: j(() => [u(w(t.label), 1)]),
|
|
1057
|
-
_: 2
|
|
1058
|
-
}, 1032, ["model-value", "onUpdate:modelValue"]), e.columnSettings?.reorderable === !1 ? o("", !0) : (b(), s("span", Ve, [c("button", {
|
|
1059
|
-
type: "button",
|
|
1060
|
-
disabled: r === 0,
|
|
1061
|
-
"aria-label": `上移${t.label}`,
|
|
1062
|
-
onClick: (e) => De(String(t.field), -1)
|
|
1063
|
-
}, " ↑ ", 8, He), c("button", {
|
|
1064
|
-
type: "button",
|
|
1065
|
-
disabled: r === ue.value.length - 1,
|
|
1066
|
-
"aria-label": `下移${t.label}`,
|
|
1067
|
-
onClick: (e) => De(String(t.field), 1)
|
|
1068
|
-
}, " ↓ ", 8, Ue)]))], 40, Be))), 128))])])])) : o("", !0)])) : o("", !0)
|
|
1069
|
-
])) : o("", !0),
|
|
1070
|
-
e.error ? (b(), s("div", We, [c("span", null, w(ye.value), 1), c("button", {
|
|
1071
|
-
type: "button",
|
|
1072
|
-
onClick: n[1] ||= (e) => p("retry")
|
|
1073
|
-
}, w(e.retryText), 1)])) : (b(), s("div", Ge, [ne((b(), a(T(Se), h({
|
|
1074
|
-
ref_key: "tableRef",
|
|
1075
|
-
ref: D
|
|
1076
|
-
}, e.tableProps, {
|
|
1077
|
-
class: "lumal-schema-table__body",
|
|
1078
|
-
data: e.rows,
|
|
1079
|
-
"row-key": me.value,
|
|
1080
|
-
"empty-text": e.emptyText,
|
|
1081
|
-
"row-class-name": e.rowClassName,
|
|
1082
|
-
"cell-class-name": e.cellClassName,
|
|
1083
|
-
"header-cell-class-name": e.headerCellClassName,
|
|
1084
|
-
"default-expand-all": be.value,
|
|
1085
|
-
"tree-props": xe.value,
|
|
1086
|
-
"data-loading": e.loading,
|
|
1087
|
-
onSelectionChange: Ye,
|
|
1088
|
-
onSortChange: n[2] ||= (e) => p("sortChange", e),
|
|
1089
|
-
onFilterChange: n[3] ||= (e) => p("filterChange", e),
|
|
1090
|
-
onRowClick: Ze,
|
|
1091
|
-
onCurrentChange: Qe,
|
|
1092
|
-
onExpandChange: $e
|
|
1093
|
-
}), {
|
|
1094
|
-
default: j(() => [
|
|
1095
|
-
e.selection ? (b(), a(T(Ce), {
|
|
1096
|
-
key: 0,
|
|
1097
|
-
type: "selection",
|
|
1098
|
-
width: "48"
|
|
1099
|
-
})) : o("", !0),
|
|
1100
|
-
e.showIndex ? (b(), a(T(Ce), {
|
|
1101
|
-
key: 1,
|
|
1102
|
-
type: "index",
|
|
1103
|
-
label: e.indexLabel,
|
|
1104
|
-
width: e.indexWidth
|
|
1105
|
-
}, null, 8, ["label", "width"])) : o("", !0),
|
|
1106
|
-
(b(!0), s(r, null, x(le.value, (n) => (b(), a(T(Ce), h({ key: String(n.field) }, { ref_for: !0 }, n.componentProps, {
|
|
1107
|
-
prop: String(n.field),
|
|
1108
|
-
label: n.label,
|
|
1109
|
-
align: n.align,
|
|
1110
|
-
width: q(n),
|
|
1111
|
-
"min-width": K(n),
|
|
1112
|
-
fixed: n.fixed,
|
|
1113
|
-
resizable: e.columnResizable,
|
|
1114
|
-
"show-overflow-tooltip": n.showOverflowTooltip ?? !0,
|
|
1115
|
-
formatter: G(n),
|
|
1116
|
-
"data-field": String(n.field)
|
|
1117
|
-
}), {
|
|
1118
|
-
default: j(({ row: e, $index: r }) => [ke(e, n, r) ? o("", !0) : S(t.$slots, `table-${String(n.field)}`, {
|
|
1119
|
-
key: 0,
|
|
1120
|
-
row: e,
|
|
1121
|
-
index: r,
|
|
1122
|
-
column: n,
|
|
1123
|
-
value: e[n.field]
|
|
1124
|
-
}, () => [d($, { display: W(e, n, r) }, null, 8, ["display"])], !0)]),
|
|
1125
|
-
_: 2
|
|
1126
|
-
}, 1040, [
|
|
1127
|
-
"prop",
|
|
1128
|
-
"label",
|
|
1129
|
-
"align",
|
|
1130
|
-
"width",
|
|
1131
|
-
"min-width",
|
|
1132
|
-
"fixed",
|
|
1133
|
-
"resizable",
|
|
1134
|
-
"show-overflow-tooltip",
|
|
1135
|
-
"formatter",
|
|
1136
|
-
"data-field"
|
|
1137
|
-
]))), 128)),
|
|
1138
|
-
t.$slots.actions ? (b(), a(T(Ce), {
|
|
1139
|
-
key: 2,
|
|
1140
|
-
fixed: "right",
|
|
1141
|
-
label: e.actionLabel,
|
|
1142
|
-
width: ve.value,
|
|
1143
|
-
"data-field": "actions"
|
|
1144
|
-
}, {
|
|
1145
|
-
default: j(({ row: n, $index: r }) => [c("div", Ke, [S(t.$slots, "actions", {
|
|
1146
|
-
row: n,
|
|
1147
|
-
index: r
|
|
1148
|
-
}, void 0, !0)]), d(T(ge), {
|
|
1149
|
-
visible: Z(n, r),
|
|
1150
|
-
teleported: !0,
|
|
1151
|
-
trigger: "click",
|
|
1152
|
-
placement: "bottom-end",
|
|
1153
|
-
"popper-class": "lumal-schema-table__mobile-actions-popper",
|
|
1154
|
-
"onUpdate:visible": (e) => Q(n, r, e)
|
|
1155
|
-
}, {
|
|
1156
|
-
reference: j(() => [c("button", {
|
|
1157
|
-
type: "button",
|
|
1158
|
-
class: "lumal-schema-table__mobile-actions",
|
|
1159
|
-
"aria-haspopup": "menu",
|
|
1160
|
-
"aria-expanded": Z(n, r),
|
|
1161
|
-
onClick: ie((e) => Ae(n, r), ["stop"]),
|
|
1162
|
-
onKeydown: re(ie(je, ["stop", "prevent"]), ["esc"])
|
|
1163
|
-
}, w(e.mobileActionLabel), 41, qe)]),
|
|
1164
|
-
default: j(() => [c("div", {
|
|
1165
|
-
class: "lumal-schema-table__mobile-actions-menu",
|
|
1166
|
-
role: "menu",
|
|
1167
|
-
onClickCapture: je
|
|
1168
|
-
}, [S(t.$slots, "actions", {
|
|
1169
|
-
row: n,
|
|
1170
|
-
index: r
|
|
1171
|
-
}, void 0, !0)], 32)]),
|
|
1172
|
-
_: 2
|
|
1173
|
-
}, 1032, ["visible", "onUpdate:visible"])]),
|
|
1174
|
-
_: 3
|
|
1175
|
-
}, 8, ["label", "width"])) : o("", !0)
|
|
1176
|
-
]),
|
|
1177
|
-
_: 3
|
|
1178
|
-
}, 16, [
|
|
1179
|
-
"data",
|
|
1180
|
-
"row-key",
|
|
1181
|
-
"empty-text",
|
|
1182
|
-
"row-class-name",
|
|
1183
|
-
"cell-class-name",
|
|
1184
|
-
"header-cell-class-name",
|
|
1185
|
-
"default-expand-all",
|
|
1186
|
-
"tree-props",
|
|
1187
|
-
"data-loading"
|
|
1188
|
-
])), [[T(ee), e.loading]])])),
|
|
1189
|
-
he.value ? (b(), s("div", Je, [d(T(Ee), {
|
|
1190
|
-
page: m.value,
|
|
1191
|
-
"onUpdate:page": n[4] ||= (e) => m.value = e,
|
|
1192
|
-
"page-size": _.value,
|
|
1193
|
-
"onUpdate:pageSize": n[5] ||= (e) => _.value = e,
|
|
1194
|
-
total: e.total,
|
|
1195
|
-
"page-sizes": e.pageSizes,
|
|
1196
|
-
onChange: Xe
|
|
1197
|
-
}, null, 8, [
|
|
1198
|
-
"page",
|
|
1199
|
-
"page-size",
|
|
1200
|
-
"total",
|
|
1201
|
-
"page-sizes"
|
|
1202
|
-
])])) : o("", !0)
|
|
1203
|
-
], 512));
|
|
1204
|
-
}
|
|
1205
|
-
}), [["__scopeId", "data-v-0cb1dbee"]]), Xe = /* @__PURE__ */ f({
|
|
1206
|
-
__name: "LumalCrudEditor",
|
|
1207
|
-
props: /*@__PURE__*/ m({
|
|
1208
|
-
beforeClose: {},
|
|
1209
|
-
closeOnClickModal: {
|
|
1210
|
-
type: Boolean,
|
|
1211
|
-
default: !1
|
|
1212
|
-
},
|
|
1213
|
-
destroyOnClose: {
|
|
1214
|
-
type: Boolean,
|
|
1215
|
-
default: !0
|
|
1216
|
-
},
|
|
1217
|
-
title: {},
|
|
1218
|
-
type: { default: "dialog" },
|
|
1219
|
-
width: { default: "min(920px, calc(100vw - 32px))" }
|
|
1220
|
-
}, {
|
|
1221
|
-
modelValue: {
|
|
1222
|
-
type: Boolean,
|
|
1223
|
-
default: !1
|
|
1224
|
-
},
|
|
1225
|
-
modelModifiers: {}
|
|
1226
|
-
}),
|
|
1227
|
-
emits: ["update:modelValue"],
|
|
1228
|
-
setup(e) {
|
|
1229
|
-
let t = E(e, "modelValue");
|
|
1230
|
-
return (n, r) => e.type === "drawer" ? (b(), a(T(z), {
|
|
1231
|
-
key: 0,
|
|
1232
|
-
modelValue: t.value,
|
|
1233
|
-
"onUpdate:modelValue": r[0] ||= (e) => t.value = e,
|
|
1234
|
-
title: e.title,
|
|
1235
|
-
size: e.width,
|
|
1236
|
-
"close-on-click-modal": e.closeOnClickModal,
|
|
1237
|
-
"destroy-on-close": e.destroyOnClose,
|
|
1238
|
-
"before-close": e.beforeClose,
|
|
1239
|
-
class: "lumal-crud-table__drawer"
|
|
1240
|
-
}, {
|
|
1241
|
-
footer: j(() => [S(n.$slots, "footer")]),
|
|
1242
|
-
default: j(() => [S(n.$slots, "default")]),
|
|
1243
|
-
_: 3
|
|
1244
|
-
}, 8, [
|
|
1245
|
-
"modelValue",
|
|
1246
|
-
"title",
|
|
1247
|
-
"size",
|
|
1248
|
-
"close-on-click-modal",
|
|
1249
|
-
"destroy-on-close",
|
|
1250
|
-
"before-close"
|
|
1251
|
-
])) : (b(), a(T(R), {
|
|
1252
|
-
key: 1,
|
|
1253
|
-
modelValue: t.value,
|
|
1254
|
-
"onUpdate:modelValue": r[1] ||= (e) => t.value = e,
|
|
1255
|
-
title: e.title,
|
|
1256
|
-
width: e.width,
|
|
1257
|
-
"close-on-click-modal": e.closeOnClickModal,
|
|
1258
|
-
"destroy-on-close": e.destroyOnClose,
|
|
1259
|
-
"before-close": e.beforeClose,
|
|
1260
|
-
class: "lumal-crud-table__dialog"
|
|
1261
|
-
}, {
|
|
1262
|
-
footer: j(() => [S(n.$slots, "footer")]),
|
|
1263
|
-
default: j(() => [S(n.$slots, "default")]),
|
|
1264
|
-
_: 3
|
|
1265
|
-
}, 8, [
|
|
1266
|
-
"modelValue",
|
|
1267
|
-
"title",
|
|
1268
|
-
"width",
|
|
1269
|
-
"close-on-click-modal",
|
|
1270
|
-
"destroy-on-close",
|
|
1271
|
-
"before-close"
|
|
1272
|
-
]));
|
|
1273
|
-
}
|
|
1274
|
-
});
|
|
1275
|
-
//#endregion
|
|
1276
|
-
//#region src/components/crud-table/schema.ts
|
|
1277
|
-
function Ze(e = [], t = []) {
|
|
1278
|
-
return t.length > 0 ? [...t] : e.filter((e) => e.showInForm !== !1 && e.field !== "action").map((e) => ({
|
|
1279
|
-
append: e.append,
|
|
1280
|
-
component: e.component ?? (e.dictionary || e.dictType ? "select" : "input"),
|
|
1281
|
-
componentProps: e.formComponentProps,
|
|
1282
|
-
defaultValue: e.defaultValue,
|
|
1283
|
-
dictionary: e.dictionary,
|
|
1284
|
-
dictType: e.dictType,
|
|
1285
|
-
editDisabled: e.editDisabled,
|
|
1286
|
-
field: e.field,
|
|
1287
|
-
label: e.label,
|
|
1288
|
-
options: e.options,
|
|
1289
|
-
placeholder: e.placeholder,
|
|
1290
|
-
prefix: e.prefix,
|
|
1291
|
-
prepend: e.prepend,
|
|
1292
|
-
required: e.required,
|
|
1293
|
-
rules: e.rules,
|
|
1294
|
-
span: e.span,
|
|
1295
|
-
suffix: e.suffix
|
|
1296
|
-
}));
|
|
1297
|
-
}
|
|
1298
|
-
//#endregion
|
|
1299
|
-
//#region src/components/crud-table/useCrudData.ts
|
|
1300
|
-
function Qe(e) {
|
|
1301
|
-
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
1302
|
-
}
|
|
1303
|
-
function $e(e) {
|
|
1304
|
-
let t = C([]), n = C(0), r = C(!1), a = C(""), o = i(() => e.dataSource.value ? t.value : e.rows.value), s = i(() => e.dataSource.value ? n.value : e.total.value), c = i(() => e.loading.value || r.value);
|
|
1305
|
-
function l(t) {
|
|
1306
|
-
let n = e.dataSource.value;
|
|
1307
|
-
return n?.parseResponse ? n.parseResponse(t) : !Qe(t) || !Array.isArray(t.items) || typeof t.total != "number" ? {
|
|
1308
|
-
items: [],
|
|
1309
|
-
total: 0
|
|
1310
|
-
} : {
|
|
1311
|
-
items: t.items,
|
|
1312
|
-
total: t.total
|
|
1313
|
-
};
|
|
1314
|
-
}
|
|
1315
|
-
async function u() {
|
|
1316
|
-
let i = e.dataSource.value;
|
|
1317
|
-
if (i) {
|
|
1318
|
-
r.value = !0, a.value = "";
|
|
1319
|
-
try {
|
|
1320
|
-
let r = l(await i.fetch({
|
|
1321
|
-
page: e.page.value,
|
|
1322
|
-
pageSize: e.pageSize.value,
|
|
1323
|
-
query: { ...e.queryModel.value }
|
|
1324
|
-
}));
|
|
1325
|
-
t.value = r.items, n.value = r.total;
|
|
1326
|
-
} catch (e) {
|
|
1327
|
-
a.value = e instanceof Error ? e.message : String(e), t.value = [], n.value = 0;
|
|
1328
|
-
} finally {
|
|
1329
|
-
r.value = !1;
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
return {
|
|
1334
|
-
currentLoading: c,
|
|
1335
|
-
currentRows: o,
|
|
1336
|
-
currentTotal: s,
|
|
1337
|
-
error: a,
|
|
1338
|
-
load: u
|
|
1339
|
-
};
|
|
1340
|
-
}
|
|
1341
|
-
//#endregion
|
|
1342
|
-
//#region src/components/crud-table/useCrudDialog.ts
|
|
1343
|
-
function et(e) {
|
|
1344
|
-
try {
|
|
1345
|
-
return JSON.stringify(e);
|
|
1346
|
-
} catch {
|
|
1347
|
-
return String(e);
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
function tt(e) {
|
|
1351
|
-
let t = C(!1), n = C("create"), r = C({}), a = C({}), o = C(), s = C(!1), c = C(""), l = i(() => n.value !== "view" && et(r.value) !== et(a.value));
|
|
1352
|
-
function u(e, i) {
|
|
1353
|
-
let s = i ? { ...i } : {};
|
|
1354
|
-
n.value = e, o.value = i, r.value = s, a.value = { ...s }, c.value = "", t.value = !0;
|
|
1355
|
-
}
|
|
1356
|
-
async function d(r) {
|
|
1357
|
-
let i = e.dataSource.value;
|
|
1358
|
-
if (!i) return t.value = !1, !0;
|
|
1359
|
-
s.value = !0, c.value = "";
|
|
1360
|
-
try {
|
|
1361
|
-
return n.value === "edit" && o.value ? await i.update?.(o.value, r) : await i.create?.(r), a.value = { ...r }, t.value = !1, await e.afterSave(), !0;
|
|
1362
|
-
} catch (e) {
|
|
1363
|
-
return c.value = e instanceof Error ? e.message : String(e), !1;
|
|
1364
|
-
} finally {
|
|
1365
|
-
s.value = !1;
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
return {
|
|
1369
|
-
dirty: l,
|
|
1370
|
-
editingRow: o,
|
|
1371
|
-
error: c,
|
|
1372
|
-
mode: n,
|
|
1373
|
-
model: r,
|
|
1374
|
-
open: u,
|
|
1375
|
-
saving: s,
|
|
1376
|
-
submit: d,
|
|
1377
|
-
visible: t
|
|
1378
|
-
};
|
|
1379
|
-
}
|
|
1380
|
-
//#endregion
|
|
1381
|
-
//#region src/components/crud-table/useCrudQuery.ts
|
|
1382
|
-
function nt(e) {
|
|
1383
|
-
let t = C(e.defaultCollapsed.value), n = i(() => Oe(U(e.schemas.value))), r = i(() => {
|
|
1384
|
-
if (!e.collapsible.value || !t.value) return e.schemas.value;
|
|
1385
|
-
let n = 24 / e.columns.value, r = e.columns.value * e.collapsedRows.value, i = 0;
|
|
1386
|
-
return e.schemas.value.filter((e) => {
|
|
1387
|
-
let t = Math.max(1, Math.ceil((e.span ?? n) / n));
|
|
1388
|
-
return i + t > r ? !1 : (i += t, !0);
|
|
1389
|
-
});
|
|
1390
|
-
}), a = i(() => e.collapsible.value && r.value.length < e.schemas.value.length);
|
|
1391
|
-
function o() {
|
|
1392
|
-
let t = { ...n.value };
|
|
1393
|
-
return e.model.value = t, t;
|
|
1394
|
-
}
|
|
1395
|
-
function s() {
|
|
1396
|
-
t.value = !t.value;
|
|
1397
|
-
}
|
|
1398
|
-
return {
|
|
1399
|
-
canCollapse: a,
|
|
1400
|
-
collapsed: t,
|
|
1401
|
-
defaultModel: n,
|
|
1402
|
-
reset: o,
|
|
1403
|
-
toggle: s,
|
|
1404
|
-
visibleSchemas: r
|
|
1405
|
-
};
|
|
1406
|
-
}
|
|
1407
|
-
//#endregion
|
|
1408
|
-
//#region src/components/crud-table/useCrudSelection.ts
|
|
1409
|
-
function rt() {
|
|
1410
|
-
let e = C([]), t = C([]);
|
|
1411
|
-
function n() {
|
|
1412
|
-
e.value = [], t.value = [];
|
|
1413
|
-
}
|
|
1414
|
-
function r(n, r = []) {
|
|
1415
|
-
e.value = n, t.value = r;
|
|
1416
|
-
}
|
|
1417
|
-
return {
|
|
1418
|
-
clear: n,
|
|
1419
|
-
selectedRowKeys: t,
|
|
1420
|
-
selectedRows: e,
|
|
1421
|
-
update: r
|
|
1422
|
-
};
|
|
1423
|
-
}
|
|
1424
|
-
//#endregion
|
|
1425
|
-
//#region src/components/crud-table/LumalCrudTable.vue?vue&type=script&setup=true&lang.ts
|
|
1426
|
-
var it = { class: "lumal-crud-table__query-actions" }, at = {
|
|
1427
|
-
key: 1,
|
|
1428
|
-
class: "lumal-crud-table__error",
|
|
1429
|
-
role: "alert"
|
|
1430
|
-
}, ot = { class: "lumal-crud-table__table-panel" }, st = { class: "lumal-crud-table__body" }, ct = { class: "lumal-crud-table__toolbar-tools" }, lt = {
|
|
1431
|
-
key: 0,
|
|
1432
|
-
class: "lumal-crud-table__extra"
|
|
1433
|
-
}, ut = {
|
|
1434
|
-
key: 1,
|
|
1435
|
-
class: "lumal-crud-table__pagination"
|
|
1436
|
-
}, dt = {
|
|
1437
|
-
key: 0,
|
|
1438
|
-
class: "lumal-crud-table__dialog-error",
|
|
1439
|
-
role: "alert"
|
|
1440
|
-
}, ft = { class: "lumal-crud-table__dialog-footer" }, pt = /*#__PURE__*/ n(/* @__PURE__ */ f({
|
|
1441
|
-
__name: "LumalCrudTable",
|
|
1442
|
-
props: /*@__PURE__*/ m({
|
|
1443
|
-
title: {},
|
|
1444
|
-
querySchemas: { default: () => [] },
|
|
1445
|
-
formSchemas: { default: () => [] },
|
|
1446
|
-
columns: { default: () => [] },
|
|
1447
|
-
dataSource: {},
|
|
1448
|
-
rows: { default: () => [] },
|
|
1449
|
-
rowKey: {},
|
|
1450
|
-
total: { default: 0 },
|
|
1451
|
-
pageSizes: { default: () => [
|
|
1452
|
-
10,
|
|
1453
|
-
20,
|
|
1454
|
-
50,
|
|
1455
|
-
100
|
|
1456
|
-
] },
|
|
1457
|
-
pagination: {
|
|
1458
|
-
type: [Boolean, Object],
|
|
1459
|
-
default: !0
|
|
1460
|
-
},
|
|
1461
|
-
loading: {
|
|
1462
|
-
type: Boolean,
|
|
1463
|
-
default: !1
|
|
1464
|
-
},
|
|
1465
|
-
emptyText: { default: "暂无数据" },
|
|
1466
|
-
searchText: { default: "查询" },
|
|
1467
|
-
resetText: { default: "重置" },
|
|
1468
|
-
createText: { default: "新增" },
|
|
1469
|
-
batchDeleteText: { default: "批量删除" },
|
|
1470
|
-
selection: {
|
|
1471
|
-
type: Boolean,
|
|
1472
|
-
default: !1
|
|
1473
|
-
},
|
|
1474
|
-
query: {},
|
|
1475
|
-
table: {},
|
|
1476
|
-
toolbar: {},
|
|
1477
|
-
actions: {},
|
|
1478
|
-
editor: {}
|
|
1479
|
-
}, {
|
|
1480
|
-
queryModel: { default: () => ({}) },
|
|
1481
|
-
queryModelModifiers: {},
|
|
1482
|
-
page: { default: 1 },
|
|
1483
|
-
pageModifiers: {},
|
|
1484
|
-
pageSize: { default: 10 },
|
|
1485
|
-
pageSizeModifiers: {}
|
|
1486
|
-
}),
|
|
1487
|
-
emits: /*@__PURE__*/ m([
|
|
1488
|
-
"search",
|
|
1489
|
-
"reset",
|
|
1490
|
-
"pageChange",
|
|
1491
|
-
"export",
|
|
1492
|
-
"operationError"
|
|
1493
|
-
], [
|
|
1494
|
-
"update:queryModel",
|
|
1495
|
-
"update:page",
|
|
1496
|
-
"update:pageSize"
|
|
1497
|
-
]),
|
|
1498
|
-
setup(e, { expose: t, emit: n }) {
|
|
1499
|
-
let r = e, f = n, m = E(e, "queryModel"), h = E(e, "page"), v = E(e, "pageSize"), D = O("crudRef"), re = O("queryRef"), ie = O("queryFormRef"), M = O("dialogFormRef"), N = O("tableRef"), oe = i(() => r.query?.schemas ?? r.querySchemas), se = i(() => r.table?.columns ?? r.columns), F = i(() => se.value.filter((e) => e.showInTable !== !1)), I = i(() => Ze(se.value, r.formSchemas)), L = i(() => r.table?.rowKey ?? r.rowKey), R = i(() => r.table?.selection ?? r.selection), z = i(() => r.table?.emptyText ?? r.emptyText), ce = C(3), le = i(() => Math.max(1, r.query?.columns ?? ce.value)), ue = i(() => r.query?.collapsible ?? !1), de = i(() => r.query?.defaultCollapsed ?? !0), fe = i(() => Math.max(1, r.query?.collapsedRows ?? 1)), me = i(() => typeof r.pagination == "object" ? r.pagination.enabled !== !1 : r.pagination), he = i(() => typeof r.pagination == "object" ? r.pagination.pageSizes ?? r.pageSizes : r.pageSizes), ge = i(() => oe.value.length > 0), _e = i(() => I.value.length > 0), ve = i(() => _e.value && r.toolbar?.create !== !1), ye = i(() => R.value && r.toolbar?.batchDelete !== !1), be = i(() => !!r.dataSource && r.toolbar?.refresh !== !1), xe = i(() => !!r.toolbar?.export), Se = i(() => r.toolbar?.fullscreen !== !1), Ce = i(() => ge.value && r.toolbar?.queryToggle !== !1), we = i(() => ve.value || ye.value || xe.value), Te = i(() => Ce.value || be.value || Se.value), De = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(max-width: 768px)").matches, B = {
|
|
1500
|
-
desktop: r.query?.defaultVisible ?? !0,
|
|
1501
|
-
mobile: r.query?.mobileDefaultVisible ?? r.query?.defaultVisible ?? !0
|
|
1502
|
-
}, V = i(() => r.dataSource), H = C(!1), U = C(!1), Oe = C(De), ke = i(() => Oe.value ? "mobile" : "desktop"), W = C(B), G = C(B[De ? "mobile" : "desktop"]), q, J, Y, X = $e({
|
|
1503
|
-
dataSource: V,
|
|
1504
|
-
loading: i(() => r.loading),
|
|
1505
|
-
page: h,
|
|
1506
|
-
pageSize: v,
|
|
1507
|
-
queryModel: m,
|
|
1508
|
-
rows: i(() => r.rows),
|
|
1509
|
-
total: i(() => r.total)
|
|
1510
|
-
}), Z = nt({
|
|
1511
|
-
collapsedRows: fe,
|
|
1512
|
-
collapsible: ue,
|
|
1513
|
-
columns: le,
|
|
1514
|
-
defaultCollapsed: de,
|
|
1515
|
-
model: m,
|
|
1516
|
-
schemas: oe
|
|
1517
|
-
}), Q = rt(), $ = tt({
|
|
1518
|
-
dataSource: V,
|
|
1519
|
-
afterSave: X.load
|
|
1520
|
-
}), Ae = i(() => X.currentLoading.value || H.value), je = i(() => me.value && X.currentTotal.value > 0), Me = i(() => ({
|
|
1521
|
-
create: r.editor?.createTitle ?? r.toolbar?.createText ?? r.createText,
|
|
1522
|
-
edit: r.editor?.editTitle ?? "编辑",
|
|
1523
|
-
view: r.editor?.viewTitle ?? "查看"
|
|
1524
|
-
})[$.mode.value]);
|
|
1525
|
-
A(() => r.dataSource, () => void X.load(), { immediate: !0 }), A([h, v], () => void X.load());
|
|
1526
|
-
function Ne() {
|
|
1527
|
-
U.value = typeof document < "u" && document.fullscreenElement === D.value;
|
|
1528
|
-
}
|
|
1529
|
-
function Pe(e) {
|
|
1530
|
-
if (r.query?.columns !== void 0 || e <= 0) return;
|
|
1531
|
-
let t = e >= 1280 ? 4 : e >= 960 ? 3 : e >= 640 ? 2 : 1;
|
|
1532
|
-
ce.value !== t && (ce.value = t);
|
|
1533
|
-
}
|
|
1534
|
-
function Fe() {
|
|
1535
|
-
J?.disconnect(), J = void 0, re.value && (Pe(re.value.clientWidth), !(typeof ResizeObserver > "u") && (J = new ResizeObserver((e) => Pe(e[0]?.contentRect.width ?? 0)), J.observe(re.value)));
|
|
1536
|
-
}
|
|
1537
|
-
function Ie(e) {
|
|
1538
|
-
Oe.value !== e && (Oe.value = e, G.value = W.value[ke.value], g(() => {
|
|
1539
|
-
G.value ? Fe() : J?.disconnect(), N.value?.doLayout();
|
|
1540
|
-
}));
|
|
1541
|
-
}
|
|
1542
|
-
function Le(e) {
|
|
1543
|
-
Ie(e.matches);
|
|
1544
|
-
}
|
|
1545
|
-
te(() => {
|
|
1546
|
-
typeof document < "u" && document.addEventListener("fullscreenchange", Ne), typeof window < "u" && typeof window.matchMedia == "function" && (Y = window.matchMedia("(max-width: 768px)"), Ie(Y.matches), Y.addEventListener?.("change", Le)), Fe();
|
|
1547
|
-
}), y(() => {
|
|
1548
|
-
typeof document < "u" && document.removeEventListener("fullscreenchange", Ne), Y?.removeEventListener?.("change", Le), J?.disconnect(), q && clearTimeout(q);
|
|
1549
|
-
}), A(() => r.query?.columns, (e) => {
|
|
1550
|
-
e === void 0 && Pe(re.value?.clientWidth ?? 0);
|
|
1551
|
-
}), A([() => r.query?.defaultVisible, () => r.query?.mobileDefaultVisible], ([e, t]) => {
|
|
1552
|
-
W.value = {
|
|
1553
|
-
desktop: e ?? !0,
|
|
1554
|
-
mobile: t ?? e ?? !0
|
|
1555
|
-
}, G.value = W.value[ke.value];
|
|
1556
|
-
});
|
|
1557
|
-
function Re() {
|
|
1558
|
-
f("search", { ...m.value }), h.value === 1 ? X.load() : h.value = 1;
|
|
1559
|
-
}
|
|
1560
|
-
function ze() {
|
|
1561
|
-
let e = Z.reset();
|
|
1562
|
-
ie.value?.resetFields(), f("reset", e), h.value === 1 ? X.load() : h.value = 1;
|
|
1563
|
-
}
|
|
1564
|
-
function Be() {
|
|
1565
|
-
r.query?.submitOnChange && (q && clearTimeout(q), q = setTimeout(Re, Math.max(0, r.query.submitDebounce ?? 300)));
|
|
1566
|
-
}
|
|
1567
|
-
async function Ve() {
|
|
1568
|
-
let e = [...Q.selectedRows.value], t = e.length > 0 ? e : X.currentRows.value, n = {
|
|
1569
|
-
columns: F.value,
|
|
1570
|
-
query: { ...m.value },
|
|
1571
|
-
rows: t,
|
|
1572
|
-
selectedRows: e
|
|
1573
|
-
};
|
|
1574
|
-
f("export", {
|
|
1575
|
-
query: n.query,
|
|
1576
|
-
selectedRows: e
|
|
1577
|
-
});
|
|
1578
|
-
let i = typeof r.toolbar?.export == "object" ? r.toolbar.export : void 0;
|
|
1579
|
-
if (i?.handler) {
|
|
1580
|
-
await i.handler(n);
|
|
1581
|
-
return;
|
|
1582
|
-
}
|
|
1583
|
-
let a = N.value?.getExportData(t);
|
|
1584
|
-
if (!a || typeof document > "u" || typeof URL > "u" || typeof navigator < "u" && navigator.userAgent.toLowerCase().includes("jsdom")) return;
|
|
1585
|
-
let o = (e) => `"${e.replace(/"/g, "\"\"")}"`, s = [a.columns.map((e) => o(e.label)).join(","), ...a.rows.map((e) => e.map(o).join(","))].join("\n"), c = new Blob([`\uFEFF${s}`], { type: "text/csv;charset=utf-8" }), l = URL.createObjectURL(c), u = document.createElement("a");
|
|
1586
|
-
u.href = l, u.download = i?.filename ?? `lumal-export-${Date.now()}.csv`, u.click(), URL.revokeObjectURL(l);
|
|
1587
|
-
}
|
|
1588
|
-
async function He() {
|
|
1589
|
-
if (!(!D.value || typeof document > "u")) try {
|
|
1590
|
-
document.fullscreenElement === D.value ? await document.exitFullscreen?.() : await D.value.requestFullscreen?.();
|
|
1591
|
-
} catch (e) {
|
|
1592
|
-
f("operationError", e);
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
function Ue(e) {
|
|
1596
|
-
f("pageChange", e);
|
|
1597
|
-
}
|
|
1598
|
-
function We() {
|
|
1599
|
-
if (G.value = !G.value, W.value = {
|
|
1600
|
-
...W.value,
|
|
1601
|
-
[ke.value]: G.value
|
|
1602
|
-
}, G.value) {
|
|
1603
|
-
g(() => {
|
|
1604
|
-
Fe(), N.value?.doLayout();
|
|
1605
|
-
});
|
|
1606
|
-
return;
|
|
1607
|
-
}
|
|
1608
|
-
J?.disconnect(), g(() => N.value?.doLayout());
|
|
1609
|
-
}
|
|
1610
|
-
function Ge(e, t, n, r) {
|
|
1611
|
-
return typeof e == "function" ? e(n, r) : e ?? t;
|
|
1612
|
-
}
|
|
1613
|
-
function Ke() {
|
|
1614
|
-
$.open("create");
|
|
1615
|
-
}
|
|
1616
|
-
function qe(e) {
|
|
1617
|
-
$.open("edit", e);
|
|
1618
|
-
}
|
|
1619
|
-
function Je(e) {
|
|
1620
|
-
$.open("view", e);
|
|
1621
|
-
}
|
|
1622
|
-
async function Qe(e) {
|
|
1623
|
-
await M.value?.validate() !== !1 && !await $.submit(e) && $.error.value && f("operationError", Error($.error.value));
|
|
1624
|
-
}
|
|
1625
|
-
async function et(e) {
|
|
1626
|
-
let t = r.actions?.confirmRemove;
|
|
1627
|
-
if (t === !1) return !0;
|
|
1628
|
-
if (typeof t == "function") return t(e);
|
|
1629
|
-
let n = typeof t?.message == "function" ? t.message(e) : t?.message ?? `确定删除选中的 ${e.length} 条数据吗?`;
|
|
1630
|
-
try {
|
|
1631
|
-
return await pe.confirm(n, t?.title ?? "删除确认", {
|
|
1632
|
-
cancelButtonText: t?.cancelButtonText ?? "取消",
|
|
1633
|
-
confirmButtonText: t?.confirmButtonText ?? "删除",
|
|
1634
|
-
type: "warning"
|
|
1635
|
-
}), !0;
|
|
1636
|
-
} catch {
|
|
1637
|
-
return !1;
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
async function pt(e) {
|
|
1641
|
-
H.value = !0;
|
|
1642
|
-
try {
|
|
1643
|
-
return await e(), bt(), await X.load(), !0;
|
|
1644
|
-
} catch (e) {
|
|
1645
|
-
return f("operationError", e), !1;
|
|
1646
|
-
} finally {
|
|
1647
|
-
H.value = !1;
|
|
1648
|
-
}
|
|
1649
|
-
}
|
|
1650
|
-
async function mt(e) {
|
|
1651
|
-
let t = r.dataSource?.remove, n = !r.dataSource?.beforeRemove || await r.dataSource.beforeRemove([e]);
|
|
1652
|
-
!t || !n || !await et([e]) || await pt(() => t(e));
|
|
1653
|
-
}
|
|
1654
|
-
async function ht() {
|
|
1655
|
-
let e = [...Q.selectedRows.value], t = !r.dataSource?.beforeRemove || await r.dataSource.beforeRemove(e);
|
|
1656
|
-
e.length === 0 || !t || !await et(e) || await pt(() => r.dataSource?.removeMany ? r.dataSource.removeMany(e) : Promise.all(e.map((e) => r.dataSource?.remove?.(e))));
|
|
1657
|
-
}
|
|
1658
|
-
async function gt() {
|
|
1659
|
-
if ($.saving.value) return !1;
|
|
1660
|
-
if (!$.dirty.value) return !0;
|
|
1661
|
-
if (r.editor?.confirmClose) return r.editor.confirmClose({
|
|
1662
|
-
mode: $.mode.value,
|
|
1663
|
-
model: $.model.value,
|
|
1664
|
-
row: $.editingRow.value
|
|
1665
|
-
});
|
|
1666
|
-
try {
|
|
1667
|
-
return await pe.confirm("表单内容尚未保存,确定关闭吗?", "关闭确认", {
|
|
1668
|
-
cancelButtonText: "继续编辑",
|
|
1669
|
-
confirmButtonText: "关闭",
|
|
1670
|
-
type: "warning"
|
|
1671
|
-
}), !0;
|
|
1672
|
-
} catch {
|
|
1673
|
-
return !1;
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
function _t(e) {
|
|
1677
|
-
gt().then((t) => {
|
|
1678
|
-
t && e();
|
|
1679
|
-
});
|
|
1680
|
-
}
|
|
1681
|
-
function vt() {
|
|
1682
|
-
gt().then((e) => {
|
|
1683
|
-
e && ($.visible.value = !1);
|
|
1684
|
-
});
|
|
1685
|
-
}
|
|
1686
|
-
function yt() {
|
|
1687
|
-
Qe($.model.value);
|
|
1688
|
-
}
|
|
1689
|
-
function bt() {
|
|
1690
|
-
Q.clear(), N.value?.clearSelection();
|
|
1691
|
-
}
|
|
1692
|
-
return t({
|
|
1693
|
-
clearSelection: bt,
|
|
1694
|
-
getCrudElement: () => D.value,
|
|
1695
|
-
closeEditor: vt,
|
|
1696
|
-
getEditorForm: () => M.value,
|
|
1697
|
-
getQueryForm: () => ie.value,
|
|
1698
|
-
getSelectedRowKeys: () => [...Q.selectedRowKeys.value],
|
|
1699
|
-
getSelectedRows: () => [...Q.selectedRows.value],
|
|
1700
|
-
getTable: () => N.value,
|
|
1701
|
-
isLoading: () => Ae.value,
|
|
1702
|
-
openCreate: Ke,
|
|
1703
|
-
openEdit: qe,
|
|
1704
|
-
openView: Je,
|
|
1705
|
-
query: Re,
|
|
1706
|
-
reset: ze,
|
|
1707
|
-
reload: X.load,
|
|
1708
|
-
removeRow: mt,
|
|
1709
|
-
removeSelectedRows: ht,
|
|
1710
|
-
setFormData: (e) => M.value?.setValues(e),
|
|
1711
|
-
toggleFullscreen: He,
|
|
1712
|
-
toggleQuery: Z.toggle,
|
|
1713
|
-
toggleQueryPanel: We
|
|
1714
|
-
}), (t, n) => (b(), s("div", {
|
|
1715
|
-
ref_key: "crudRef",
|
|
1716
|
-
ref: D,
|
|
1717
|
-
class: "lumal-crud-table"
|
|
1718
|
-
}, [
|
|
1719
|
-
ge.value ? ne((b(), s("div", {
|
|
1720
|
-
key: 0,
|
|
1721
|
-
ref_key: "queryRef",
|
|
1722
|
-
ref: re,
|
|
1723
|
-
class: _(["lumal-crud-table__query", { "is-collapsed": T(Z).collapsed.value }])
|
|
1724
|
-
}, [d(T(K), {
|
|
1725
|
-
ref_key: "queryFormRef",
|
|
1726
|
-
ref: ie,
|
|
1727
|
-
modelValue: m.value,
|
|
1728
|
-
"onUpdate:modelValue": n[0] ||= (e) => m.value = e,
|
|
1729
|
-
schemas: T(Z).visibleSchemas.value,
|
|
1730
|
-
columns: le.value,
|
|
1731
|
-
"label-width": e.query?.labelWidth ?? 88,
|
|
1732
|
-
class: "lumal-crud-table__query-form",
|
|
1733
|
-
onValuesChange: Be
|
|
1734
|
-
}, l({ _: 2 }, [x(T(Z).visibleSchemas.value.filter((e) => t.$slots[`query-${String(e.field)}`]), (e) => ({
|
|
1735
|
-
name: `field-${String(e.field)}`,
|
|
1736
|
-
fn: j((n) => [S(t.$slots, `query-${String(e.field)}`, ee(p(n)), void 0, !0)])
|
|
1737
|
-
}))]), 1032, [
|
|
1738
|
-
"modelValue",
|
|
1739
|
-
"schemas",
|
|
1740
|
-
"columns",
|
|
1741
|
-
"label-width"
|
|
1742
|
-
]), c("div", it, [
|
|
1743
|
-
d(T(P), {
|
|
1744
|
-
type: "primary",
|
|
1745
|
-
"native-type": "button",
|
|
1746
|
-
"data-action": "search",
|
|
1747
|
-
onClick: Re
|
|
1748
|
-
}, {
|
|
1749
|
-
default: j(() => [u(w(e.query?.searchText ?? e.searchText), 1)]),
|
|
1750
|
-
_: 1
|
|
1751
|
-
}),
|
|
1752
|
-
d(T(P), {
|
|
1753
|
-
"native-type": "button",
|
|
1754
|
-
"data-action": "reset",
|
|
1755
|
-
onClick: ze
|
|
1756
|
-
}, {
|
|
1757
|
-
default: j(() => [u(w(e.query?.resetText ?? e.resetText), 1)]),
|
|
1758
|
-
_: 1
|
|
1759
|
-
}),
|
|
1760
|
-
T(Z).canCollapse.value ? (b(), a(T(P), {
|
|
1761
|
-
key: 0,
|
|
1762
|
-
"native-type": "button",
|
|
1763
|
-
"data-action": "toggle-query",
|
|
1764
|
-
"aria-expanded": String(!T(Z).collapsed.value),
|
|
1765
|
-
onClick: T(Z).toggle
|
|
1766
|
-
}, {
|
|
1767
|
-
default: j(() => [u(w(T(Z).collapsed.value ? "展开" : "收起"), 1)]),
|
|
1768
|
-
_: 1
|
|
1769
|
-
}, 8, ["aria-expanded", "onClick"])) : o("", !0)
|
|
1770
|
-
])], 2)), [[k, G.value]]) : o("", !0),
|
|
1771
|
-
T(X).error.value ? (b(), s("div", at, [c("span", null, w(T(X).error.value), 1), d(T(P), {
|
|
1772
|
-
"native-type": "button",
|
|
1773
|
-
"data-action": "retry",
|
|
1774
|
-
onClick: T(X).load
|
|
1775
|
-
}, {
|
|
1776
|
-
default: j(() => [...n[5] ||= [u(" 重试 ", -1)]]),
|
|
1777
|
-
_: 1
|
|
1778
|
-
}, 8, ["onClick"])])) : o("", !0),
|
|
1779
|
-
c("section", ot, [
|
|
1780
|
-
c("div", st, [d(T(Ye), {
|
|
1781
|
-
ref_key: "tableRef",
|
|
1782
|
-
ref: N,
|
|
1783
|
-
columns: F.value,
|
|
1784
|
-
rows: T(X).currentRows.value,
|
|
1785
|
-
"row-key": L.value,
|
|
1786
|
-
"empty-text": z.value,
|
|
1787
|
-
loading: Ae.value,
|
|
1788
|
-
selection: R.value,
|
|
1789
|
-
"show-column-settings": e.table?.showColumnSettings,
|
|
1790
|
-
"column-settings": e.table?.columnSettings,
|
|
1791
|
-
"auto-resize": e.table?.autoResize ?? !0,
|
|
1792
|
-
"action-width": e.table?.actionWidth,
|
|
1793
|
-
"mobile-action-width": e.table?.mobileActionWidth,
|
|
1794
|
-
"table-props": {
|
|
1795
|
-
height: "100%",
|
|
1796
|
-
border: !0
|
|
1797
|
-
},
|
|
1798
|
-
onSelectionChange: T(Q).update
|
|
1799
|
-
}, l({ _: 2 }, [
|
|
1800
|
-
t.$slots["table-title"] || e.title ? {
|
|
1801
|
-
name: "toolbar-title",
|
|
1802
|
-
fn: j(() => [S(t.$slots, "table-title", {}, () => [u(w(e.title), 1)], !0)]),
|
|
1803
|
-
key: "0"
|
|
1804
|
-
} : void 0,
|
|
1805
|
-
we.value || t.$slots.actions || t.$slots["toolbar-actions"] ? {
|
|
1806
|
-
name: "toolbar",
|
|
1807
|
-
fn: j(() => [c("div", { class: _(["lumal-crud-table__toolbar", `is-${e.toolbar?.actionsPosition ?? "right"}`]) }, [
|
|
1808
|
-
ve.value ? S(t.$slots, "create-action", {
|
|
1809
|
-
key: 0,
|
|
1810
|
-
openCreate: Ke
|
|
1811
|
-
}, () => [d(T(P), {
|
|
1812
|
-
type: "primary",
|
|
1813
|
-
"native-type": "button",
|
|
1814
|
-
"data-action": "create",
|
|
1815
|
-
onClick: Ke
|
|
1816
|
-
}, {
|
|
1817
|
-
default: j(() => [d(T(ae), { name: "lumal:plus" }), u(" " + w(e.toolbar?.createText ?? e.createText), 1)]),
|
|
1818
|
-
_: 1
|
|
1819
|
-
})], !0) : o("", !0),
|
|
1820
|
-
ye.value ? (b(), a(T(P), {
|
|
1821
|
-
key: 1,
|
|
1822
|
-
"native-type": "button",
|
|
1823
|
-
"data-action": "batch-remove",
|
|
1824
|
-
disabled: T(Q).selectedRows.value.length === 0 || H.value,
|
|
1825
|
-
onClick: ht
|
|
1826
|
-
}, {
|
|
1827
|
-
default: j(() => [u(w(e.toolbar?.batchDeleteText ?? e.batchDeleteText), 1)]),
|
|
1828
|
-
_: 1
|
|
1829
|
-
}, 8, ["disabled"])) : o("", !0),
|
|
1830
|
-
xe.value ? (b(), a(T(P), {
|
|
1831
|
-
key: 2,
|
|
1832
|
-
"native-type": "button",
|
|
1833
|
-
"data-action": "export",
|
|
1834
|
-
onClick: Ve
|
|
1835
|
-
}, {
|
|
1836
|
-
default: j(() => [u(w(e.toolbar?.exportText ?? "导出"), 1)]),
|
|
1837
|
-
_: 1
|
|
1838
|
-
})) : o("", !0),
|
|
1839
|
-
S(t.$slots, "toolbar-actions", {
|
|
1840
|
-
reload: T(X).load,
|
|
1841
|
-
openCreate: Ke,
|
|
1842
|
-
selectedRows: T(Q).selectedRows.value,
|
|
1843
|
-
selectedRowKeys: T(Q).selectedRowKeys.value,
|
|
1844
|
-
clearSelection: bt
|
|
1845
|
-
}, void 0, !0),
|
|
1846
|
-
S(t.$slots, "actions", {}, void 0, !0)
|
|
1847
|
-
], 2)]),
|
|
1848
|
-
key: "1"
|
|
1849
|
-
} : void 0,
|
|
1850
|
-
Te.value || t.$slots["toolbar-tools"] ? {
|
|
1851
|
-
name: "toolbar-tools",
|
|
1852
|
-
fn: j(() => [c("div", ct, [
|
|
1853
|
-
S(t.$slots, "toolbar-tools", {
|
|
1854
|
-
reload: T(X).load,
|
|
1855
|
-
toggleFullscreen: He
|
|
1856
|
-
}, void 0, !0),
|
|
1857
|
-
Ce.value ? (b(), a(T(P), {
|
|
1858
|
-
key: 0,
|
|
1859
|
-
circle: "",
|
|
1860
|
-
"native-type": "button",
|
|
1861
|
-
"data-action": "toggle-query-panel",
|
|
1862
|
-
class: _({ "is-active": G.value }),
|
|
1863
|
-
"aria-expanded": String(G.value),
|
|
1864
|
-
"aria-label": G.value ? "隐藏筛选条件" : "显示筛选条件",
|
|
1865
|
-
title: G.value ? "隐藏筛选条件" : "显示筛选条件",
|
|
1866
|
-
onClick: We
|
|
1867
|
-
}, {
|
|
1868
|
-
default: j(() => [d(T(ae), { name: "lumal:filter" })]),
|
|
1869
|
-
_: 1
|
|
1870
|
-
}, 8, [
|
|
1871
|
-
"class",
|
|
1872
|
-
"aria-expanded",
|
|
1873
|
-
"aria-label",
|
|
1874
|
-
"title"
|
|
1875
|
-
])) : o("", !0),
|
|
1876
|
-
be.value ? (b(), a(T(P), {
|
|
1877
|
-
key: 1,
|
|
1878
|
-
circle: "",
|
|
1879
|
-
"native-type": "button",
|
|
1880
|
-
"data-action": "refresh",
|
|
1881
|
-
"aria-label": e.toolbar?.refreshText ?? "刷新",
|
|
1882
|
-
title: e.toolbar?.refreshText ?? "刷新",
|
|
1883
|
-
onClick: T(X).load
|
|
1884
|
-
}, {
|
|
1885
|
-
default: j(() => [d(T(ae), { name: "lumal:refresh" })]),
|
|
1886
|
-
_: 1
|
|
1887
|
-
}, 8, [
|
|
1888
|
-
"aria-label",
|
|
1889
|
-
"title",
|
|
1890
|
-
"onClick"
|
|
1891
|
-
])) : o("", !0),
|
|
1892
|
-
Se.value ? (b(), a(T(P), {
|
|
1893
|
-
key: 2,
|
|
1894
|
-
circle: "",
|
|
1895
|
-
"native-type": "button",
|
|
1896
|
-
"data-action": "fullscreen",
|
|
1897
|
-
"aria-label": e.toolbar?.fullscreenText ?? (U.value ? "退出全屏" : "全屏"),
|
|
1898
|
-
title: e.toolbar?.fullscreenText ?? (U.value ? "退出全屏" : "全屏"),
|
|
1899
|
-
onClick: He
|
|
1900
|
-
}, {
|
|
1901
|
-
default: j(() => [d(T(ae), { name: U.value ? "lumal:fullscreen-exit" : "lumal:fullscreen" }, null, 8, ["name"])]),
|
|
1902
|
-
_: 1
|
|
1903
|
-
}, 8, ["aria-label", "title"])) : o("", !0)
|
|
1904
|
-
])]),
|
|
1905
|
-
key: "2"
|
|
1906
|
-
} : void 0,
|
|
1907
|
-
x(F.value.filter((e) => t.$slots[`table-${String(e.field)}`]), (e) => ({
|
|
1908
|
-
name: `table-${String(e.field)}`,
|
|
1909
|
-
fn: j((n) => [S(t.$slots, `table-${String(e.field)}`, ee(p(n)), void 0, !0)])
|
|
1910
|
-
})),
|
|
1911
|
-
_e.value || V.value?.remove || t.$slots["row-actions"] ? {
|
|
1912
|
-
name: "actions",
|
|
1913
|
-
fn: j(({ row: n, index: r }) => [S(t.$slots, "row-actions", {
|
|
1914
|
-
row: n,
|
|
1915
|
-
index: r,
|
|
1916
|
-
openView: Je,
|
|
1917
|
-
openEdit: qe,
|
|
1918
|
-
removeRow: mt
|
|
1919
|
-
}, () => [
|
|
1920
|
-
Ge(e.actions?.view, _e.value, n, r) ? (b(), a(T(P), {
|
|
1921
|
-
key: 0,
|
|
1922
|
-
"native-type": "button",
|
|
1923
|
-
"data-action": "view",
|
|
1924
|
-
onClick: (e) => Je(n)
|
|
1925
|
-
}, {
|
|
1926
|
-
default: j(() => [u(w(e.actions?.viewText ?? "查看"), 1)]),
|
|
1927
|
-
_: 1
|
|
1928
|
-
}, 8, ["onClick"])) : o("", !0),
|
|
1929
|
-
Ge(e.actions?.edit, _e.value, n, r) ? (b(), a(T(P), {
|
|
1930
|
-
key: 1,
|
|
1931
|
-
"native-type": "button",
|
|
1932
|
-
"data-action": "edit",
|
|
1933
|
-
onClick: (e) => qe(n)
|
|
1934
|
-
}, {
|
|
1935
|
-
default: j(() => [u(w(e.actions?.editText ?? "编辑"), 1)]),
|
|
1936
|
-
_: 1
|
|
1937
|
-
}, 8, ["onClick"])) : o("", !0),
|
|
1938
|
-
Ge(e.actions?.remove, !!V.value?.remove, n, r) ? (b(), a(T(P), {
|
|
1939
|
-
key: 2,
|
|
1940
|
-
type: "danger",
|
|
1941
|
-
"native-type": "button",
|
|
1942
|
-
"data-action": "remove",
|
|
1943
|
-
onClick: (e) => mt(n)
|
|
1944
|
-
}, {
|
|
1945
|
-
default: j(() => [u(w(e.actions?.removeText ?? "删除"), 1)]),
|
|
1946
|
-
_: 1
|
|
1947
|
-
}, 8, ["onClick"])) : o("", !0)
|
|
1948
|
-
], !0)]),
|
|
1949
|
-
key: "3"
|
|
1950
|
-
} : void 0
|
|
1951
|
-
]), 1032, [
|
|
1952
|
-
"columns",
|
|
1953
|
-
"rows",
|
|
1954
|
-
"row-key",
|
|
1955
|
-
"empty-text",
|
|
1956
|
-
"loading",
|
|
1957
|
-
"selection",
|
|
1958
|
-
"show-column-settings",
|
|
1959
|
-
"column-settings",
|
|
1960
|
-
"auto-resize",
|
|
1961
|
-
"action-width",
|
|
1962
|
-
"mobile-action-width",
|
|
1963
|
-
"onSelectionChange"
|
|
1964
|
-
])]),
|
|
1965
|
-
t.$slots.default ? (b(), s("div", lt, [S(t.$slots, "default", {}, void 0, !0)])) : o("", !0),
|
|
1966
|
-
je.value ? (b(), s("div", ut, [d(T(Ee), {
|
|
1967
|
-
page: h.value,
|
|
1968
|
-
"onUpdate:page": n[1] ||= (e) => h.value = e,
|
|
1969
|
-
"page-size": v.value,
|
|
1970
|
-
"onUpdate:pageSize": n[2] ||= (e) => v.value = e,
|
|
1971
|
-
total: T(X).currentTotal.value,
|
|
1972
|
-
"page-sizes": he.value,
|
|
1973
|
-
onChange: Ue
|
|
1974
|
-
}, null, 8, [
|
|
1975
|
-
"page",
|
|
1976
|
-
"page-size",
|
|
1977
|
-
"total",
|
|
1978
|
-
"page-sizes"
|
|
1979
|
-
])])) : o("", !0)
|
|
1980
|
-
]),
|
|
1981
|
-
d(Xe, {
|
|
1982
|
-
modelValue: T($).visible.value,
|
|
1983
|
-
"onUpdate:modelValue": n[4] ||= (e) => T($).visible.value = e,
|
|
1984
|
-
title: Me.value,
|
|
1985
|
-
type: e.editor?.type ?? "dialog",
|
|
1986
|
-
width: e.editor?.width ?? (e.editor?.type === "drawer" ? "min(720px, 92vw)" : "min(920px, calc(100vw - 32px))"),
|
|
1987
|
-
"close-on-click-modal": e.editor?.closeOnClickModal ?? !1,
|
|
1988
|
-
"destroy-on-close": e.editor?.destroyOnClose ?? !0,
|
|
1989
|
-
"before-close": _t
|
|
1990
|
-
}, {
|
|
1991
|
-
footer: j(() => [S(t.$slots, "footer", {
|
|
1992
|
-
mode: T($).mode.value,
|
|
1993
|
-
model: T($).model.value,
|
|
1994
|
-
close: vt,
|
|
1995
|
-
submit: yt
|
|
1996
|
-
}, () => [c("div", ft, [d(T(P), {
|
|
1997
|
-
"native-type": "button",
|
|
1998
|
-
onClick: vt
|
|
1999
|
-
}, {
|
|
2000
|
-
default: j(() => [u(w(T($).mode.value === "view" ? "关闭" : "取消"), 1)]),
|
|
2001
|
-
_: 1
|
|
2002
|
-
}), T($).mode.value === "view" ? o("", !0) : (b(), a(T(P), {
|
|
2003
|
-
key: 0,
|
|
2004
|
-
type: "primary",
|
|
2005
|
-
"native-type": "button",
|
|
2006
|
-
loading: T($).saving.value,
|
|
2007
|
-
onClick: yt
|
|
2008
|
-
}, {
|
|
2009
|
-
default: j(() => [u(w(e.editor?.submitText ?? "保存"), 1)]),
|
|
2010
|
-
_: 1
|
|
2011
|
-
}, 8, ["loading"]))])], !0)]),
|
|
2012
|
-
default: j(() => [T($).error.value ? (b(), s("div", dt, w(T($).error.value), 1)) : o("", !0), d(T(K), {
|
|
2013
|
-
ref_key: "dialogFormRef",
|
|
2014
|
-
ref: M,
|
|
2015
|
-
modelValue: T($).model.value,
|
|
2016
|
-
"onUpdate:modelValue": n[3] ||= (e) => T($).model.value = e,
|
|
2017
|
-
mode: T($).mode.value,
|
|
2018
|
-
schemas: I.value,
|
|
2019
|
-
columns: e.editor?.columns ?? 2,
|
|
2020
|
-
"label-width": e.editor?.labelWidth ?? 88,
|
|
2021
|
-
loading: e.editor?.loading,
|
|
2022
|
-
disabled: T($).saving.value || e.editor?.disabled,
|
|
2023
|
-
"submit-loading": T($).saving.value,
|
|
2024
|
-
"show-actions": !1,
|
|
2025
|
-
onSubmit: Qe
|
|
2026
|
-
}, l({ _: 2 }, [x(I.value.filter((e) => t.$slots[`form-${String(e.field)}`]), (e) => ({
|
|
2027
|
-
name: `field-${String(e.field)}`,
|
|
2028
|
-
fn: j((n) => [S(t.$slots, `form-${String(e.field)}`, ee(p(n)), void 0, !0)])
|
|
2029
|
-
}))]), 1032, [
|
|
2030
|
-
"modelValue",
|
|
2031
|
-
"mode",
|
|
2032
|
-
"schemas",
|
|
2033
|
-
"columns",
|
|
2034
|
-
"label-width",
|
|
2035
|
-
"loading",
|
|
2036
|
-
"disabled",
|
|
2037
|
-
"submit-loading"
|
|
2038
|
-
])]),
|
|
2039
|
-
_: 3
|
|
2040
|
-
}, 8, [
|
|
2041
|
-
"modelValue",
|
|
2042
|
-
"title",
|
|
2043
|
-
"type",
|
|
2044
|
-
"width",
|
|
2045
|
-
"close-on-click-modal",
|
|
2046
|
-
"destroy-on-close"
|
|
2047
|
-
])
|
|
2048
|
-
], 512));
|
|
2049
|
-
}
|
|
2050
|
-
}), [["__scopeId", "data-v-68c1d18f"]]), mt = { class: "lumal-info-table__value" }, ht = /*#__PURE__*/ n(/* @__PURE__ */ f({
|
|
2051
|
-
__name: "LumalInfoTable",
|
|
2052
|
-
props: {
|
|
2053
|
-
items: {},
|
|
2054
|
-
columns: { default: 1 },
|
|
2055
|
-
labelWidth: { default: "88px" },
|
|
2056
|
-
emptyText: { default: "-" },
|
|
2057
|
-
bordered: {
|
|
2058
|
-
type: Boolean,
|
|
2059
|
-
default: !0
|
|
2060
|
-
}
|
|
2061
|
-
},
|
|
2062
|
-
setup(e, { expose: t }) {
|
|
2063
|
-
let n = e, a = O("infoTableRef"), o = i(() => n.items.filter((e) => !e.hidden)), l = i(() => ({ "--lumal-info-table-columns": String(Math.max(1, n.columns)) })), u = i(() => ({ width: typeof n.labelWidth == "number" ? `${n.labelWidth}px` : n.labelWidth }));
|
|
2064
|
-
function d(e) {
|
|
2065
|
-
return e.value === void 0 || e.value === null || e.value === "" ? e.emptyText ?? n.emptyText : String(e.value);
|
|
2066
|
-
}
|
|
2067
|
-
function f(e) {
|
|
2068
|
-
return Math.max(1, Math.min(e.span ?? 1, n.columns));
|
|
2069
|
-
}
|
|
2070
|
-
return t({ getInfoTableElement: () => a.value }), (t, n) => (b(), s("dl", {
|
|
2071
|
-
ref_key: "infoTableRef",
|
|
2072
|
-
ref: a,
|
|
2073
|
-
class: _(["lumal-info-table", { "lumal-info-table--bordered": e.bordered }]),
|
|
2074
|
-
style: v(l.value)
|
|
2075
|
-
}, [(b(!0), s(r, null, x(o.value, (e) => (b(), s("div", {
|
|
2076
|
-
key: e.label,
|
|
2077
|
-
class: "lumal-info-table__item",
|
|
2078
|
-
style: v({ gridColumn: `span ${f(e)}` })
|
|
2079
|
-
}, [c("dt", {
|
|
2080
|
-
class: "lumal-info-table__label",
|
|
2081
|
-
style: v(u.value)
|
|
2082
|
-
}, w(e.label), 5), c("dd", mt, w(d(e)), 1)], 4))), 128))], 6));
|
|
2083
|
-
}
|
|
2084
|
-
}), [["__scopeId", "data-v-4066d619"]]), gt = {
|
|
2085
|
-
key: 0,
|
|
2086
|
-
class: "lumal-page__header"
|
|
2087
|
-
}, _t = { class: "lumal-page__heading" }, vt = {
|
|
2088
|
-
key: 0,
|
|
2089
|
-
class: "lumal-page__title"
|
|
2090
|
-
}, yt = {
|
|
2091
|
-
key: 0,
|
|
2092
|
-
class: "lumal-page__description"
|
|
2093
|
-
}, bt = {
|
|
2094
|
-
key: 0,
|
|
2095
|
-
class: "lumal-page__actions"
|
|
2096
|
-
}, xt = {
|
|
2097
|
-
key: 1,
|
|
2098
|
-
class: "lumal-page__loading"
|
|
2099
|
-
}, St = /*#__PURE__*/ n(/* @__PURE__ */ f({
|
|
2100
|
-
__name: "LumalPage",
|
|
2101
|
-
props: {
|
|
2102
|
-
title: {},
|
|
2103
|
-
description: {},
|
|
2104
|
-
contentClass: { default: "" },
|
|
2105
|
-
fill: {
|
|
2106
|
-
type: Boolean,
|
|
2107
|
-
default: !1
|
|
2108
|
-
},
|
|
2109
|
-
loading: {
|
|
2110
|
-
type: Boolean,
|
|
2111
|
-
default: !1
|
|
2112
|
-
},
|
|
2113
|
-
loadingText: { default: "加载中" },
|
|
2114
|
-
noPadding: {
|
|
2115
|
-
type: Boolean,
|
|
2116
|
-
default: !1
|
|
2117
|
-
}
|
|
2118
|
-
},
|
|
2119
|
-
setup(e, { expose: t }) {
|
|
2120
|
-
let n = e, r = O("pageRef"), a = D(), l = i(() => !!(n.title || n.description || a.title || a.actions));
|
|
2121
|
-
return t({ getPageElement: () => r.value }), (t, n) => (b(), s("section", {
|
|
2122
|
-
ref_key: "pageRef",
|
|
2123
|
-
ref: r,
|
|
2124
|
-
class: _(["lumal-page", {
|
|
2125
|
-
"is-fill": e.fill,
|
|
2126
|
-
"is-no-padding": e.noPadding
|
|
2127
|
-
}])
|
|
2128
|
-
}, [
|
|
2129
|
-
l.value ? (b(), s("header", gt, [c("div", _t, [S(t.$slots, "title", {}, () => [e.title ? (b(), s("h2", vt, w(e.title), 1)) : o("", !0)], !0), e.description ? (b(), s("p", yt, w(e.description), 1)) : o("", !0)]), t.$slots.actions ? (b(), s("div", bt, [S(t.$slots, "actions", {}, void 0, !0)])) : o("", !0)])) : o("", !0),
|
|
2130
|
-
c("div", { class: _(["lumal-page__body", e.contentClass]) }, [S(t.$slots, "default", {}, void 0, !0)], 2),
|
|
2131
|
-
e.loading ? (b(), s("div", xt, w(e.loadingText), 1)) : o("", !0)
|
|
2132
|
-
], 2));
|
|
2133
|
-
}
|
|
2134
|
-
}), [["__scopeId", "data-v-07931bf6"]]), Ct = {
|
|
2135
|
-
key: 0,
|
|
2136
|
-
class: "lumal-page-layout__query"
|
|
2137
|
-
}, wt = { class: "lumal-page-layout__query-body" }, Tt = { class: "lumal-page-layout__query-actions" }, Et = {
|
|
2138
|
-
key: 1,
|
|
2139
|
-
class: "lumal-page-layout__toolbar"
|
|
2140
|
-
}, Dt = { class: "lumal-page-layout__content" }, Ot = {
|
|
2141
|
-
key: 2,
|
|
2142
|
-
class: "lumal-page-layout__pagination"
|
|
2143
|
-
}, kt = /*#__PURE__*/ n(/* @__PURE__ */ f({
|
|
2144
|
-
__name: "LumalPageLayout",
|
|
2145
|
-
props: {
|
|
2146
|
-
contentScrollable: {
|
|
2147
|
-
type: Boolean,
|
|
2148
|
-
default: !0
|
|
2149
|
-
},
|
|
2150
|
-
fill: {
|
|
2151
|
-
type: Boolean,
|
|
2152
|
-
default: !1
|
|
2153
|
-
},
|
|
2154
|
-
searchText: { default: "查询" },
|
|
2155
|
-
resetText: { default: "重置" },
|
|
2156
|
-
queryCollapsed: {
|
|
2157
|
-
type: Boolean,
|
|
2158
|
-
default: !1
|
|
2159
|
-
},
|
|
2160
|
-
surface: {
|
|
2161
|
-
type: Boolean,
|
|
2162
|
-
default: !0
|
|
2163
|
-
}
|
|
2164
|
-
},
|
|
2165
|
-
emits: ["reset", "search"],
|
|
2166
|
-
setup(e, { expose: t, emit: n }) {
|
|
2167
|
-
let r = e, a = n, l = O("pageLayoutRef"), f = D(), p = i(() => !!(f.query || f.form)), m = i(() => !!f.toolbar), h = i(() => !!f.pagination);
|
|
2168
|
-
function g() {
|
|
2169
|
-
a("search");
|
|
2170
|
-
}
|
|
2171
|
-
function ee() {
|
|
2172
|
-
a("reset");
|
|
2173
|
-
}
|
|
2174
|
-
return t({ getPageLayoutElement: () => l.value }), (t, n) => (b(), s("section", {
|
|
2175
|
-
ref_key: "pageLayoutRef",
|
|
2176
|
-
ref: l,
|
|
2177
|
-
class: _(["lumal-page-layout", {
|
|
2178
|
-
"is-content-scrollable": e.contentScrollable,
|
|
2179
|
-
"is-fill": e.fill,
|
|
2180
|
-
"is-surface": e.surface
|
|
2181
|
-
}])
|
|
2182
|
-
}, [
|
|
2183
|
-
p.value ? (b(), s("div", Ct, [ne(c("div", wt, [S(t.$slots, "query", {}, () => [S(t.$slots, "form", {}, void 0, !0)], !0)], 512), [[k, !r.queryCollapsed]]), c("div", Tt, [d(T(P), {
|
|
2184
|
-
type: "primary",
|
|
2185
|
-
"native-type": "button",
|
|
2186
|
-
"data-action": "search",
|
|
2187
|
-
onClick: g
|
|
2188
|
-
}, {
|
|
2189
|
-
default: j(() => [u(w(r.searchText), 1)]),
|
|
2190
|
-
_: 1
|
|
2191
|
-
}), d(T(P), {
|
|
2192
|
-
"native-type": "button",
|
|
2193
|
-
"data-action": "reset",
|
|
2194
|
-
onClick: ee
|
|
2195
|
-
}, {
|
|
2196
|
-
default: j(() => [u(w(r.resetText), 1)]),
|
|
2197
|
-
_: 1
|
|
2198
|
-
})])])) : o("", !0),
|
|
2199
|
-
m.value ? (b(), s("div", Et, [S(t.$slots, "toolbar", {}, void 0, !0)])) : o("", !0),
|
|
2200
|
-
c("div", Dt, [S(t.$slots, "default", {}, void 0, !0)]),
|
|
2201
|
-
h.value ? (b(), s("div", Ot, [S(t.$slots, "pagination", {}, void 0, !0)])) : o("", !0)
|
|
2202
|
-
], 2));
|
|
2203
|
-
}
|
|
2204
|
-
}), [["__scopeId", "data-v-8e09ec3e"]]);
|
|
2205
|
-
//#endregion
|
|
2206
|
-
export { St as a, Ze as c, Ee as d, kt as i, Ye as l, N as n, ht as o, oe as r, pt as s, M as t, K as u };
|