yxuse 2.0.31 → 2.0.33

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.
Files changed (67) hide show
  1. package/lib/api.cjs.js +1 -1
  2. package/lib/api.es.js +9 -10
  3. package/lib/app.cjs.js +1 -1
  4. package/lib/app.es.js +1 -1
  5. package/lib/components.cjs.js +1 -1
  6. package/lib/components.es.js +10 -18
  7. package/lib/directives.cjs.js +1 -1
  8. package/lib/directives.es.js +2 -4
  9. package/lib/hooks.cjs.js +1 -1
  10. package/lib/hooks.es.js +2 -3
  11. package/lib/index.cjs.js +1 -1
  12. package/lib/index.cjs10.js +1 -1
  13. package/lib/index.cjs11.js +1 -0
  14. package/lib/index.cjs11.js.gz +0 -0
  15. package/lib/index.cjs12.js +1 -0
  16. package/lib/index.cjs13.js +1 -0
  17. package/lib/index.cjs2.js +1 -42
  18. package/lib/index.cjs3.js +1 -1
  19. package/lib/index.cjs4.js +1 -1
  20. package/lib/index.cjs5.js +22 -1
  21. package/lib/index.cjs5.js.gz +0 -0
  22. package/lib/index.cjs6.js +1 -1
  23. package/lib/index.cjs6.js.gz +0 -0
  24. package/lib/index.cjs7.js +1 -3
  25. package/lib/index.cjs8.js +1 -1
  26. package/lib/index.cjs9.js +1 -1
  27. package/lib/index.es.js +46 -21
  28. package/lib/index.es10.js +299 -9
  29. package/lib/index.es10.js.gz +0 -0
  30. package/lib/index.es11.js +2366 -0
  31. package/lib/index.es11.js.gz +0 -0
  32. package/lib/index.es12.js +197 -0
  33. package/lib/index.es13.js +22 -0
  34. package/lib/index.es2.js +14 -8229
  35. package/lib/index.es3.js +59 -131
  36. package/lib/index.es4.js +47 -41
  37. package/lib/index.es5.js +11038 -35
  38. package/lib/index.es5.js.gz +0 -0
  39. package/lib/index.es6.js +1077 -300
  40. package/lib/index.es6.js.gz +0 -0
  41. package/lib/index.es7.js +17 -3870
  42. package/lib/index.es8.js +4 -15
  43. package/lib/index.es9.js +9 -20
  44. package/lib/style.css +1 -1
  45. package/lib/style.css.gz +0 -0
  46. package/lib/theme.cjs.js +1 -1
  47. package/lib/theme.es.js +14 -18
  48. package/lib/translate.cjs.js +1 -1
  49. package/lib/translate.es.js +9 -14
  50. package/lib/utils.cjs.js +1 -1
  51. package/lib/utils.es.js +11 -12
  52. package/lib/yxIcon.cjs.js +1 -1
  53. package/lib/yxIcon.es.js +5 -5
  54. package/package.json +3 -2
  55. package/types/bc/index.d.ts +5 -0
  56. package/types/config/index.d.ts +3 -0
  57. package/types/index.d.ts +3 -2
  58. package/lib/index.cjs2.js.gz +0 -0
  59. package/lib/index.cjs7.js.gz +0 -0
  60. package/lib/index.es2.js.gz +0 -0
  61. package/lib/index.es7.js.gz +0 -0
  62. package/lib/style.cjs.js +0 -1
  63. package/lib/style.es.js +0 -1
  64. package/lib/vue.runtime.esm-bundler.cjs.js +0 -8
  65. package/lib/vue.runtime.esm-bundler.cjs.js.gz +0 -0
  66. package/lib/vue.runtime.esm-bundler.es.js +0 -4588
  67. package/lib/vue.runtime.esm-bundler.es.js.gz +0 -0
package/lib/index.es6.js CHANGED
@@ -1,315 +1,1092 @@
1
- import { q as R } from "./vue.runtime.esm-bundler.es.js";
2
- var X = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
3
- function tt(y) {
4
- return y && y.__esModule && Object.prototype.hasOwnProperty.call(y, "default") ? y.default : y;
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __async = (__this, __arguments, generator) => {
33
+ return new Promise((resolve, reject) => {
34
+ var fulfilled = (value) => {
35
+ try {
36
+ step(generator.next(value));
37
+ } catch (e) {
38
+ reject(e);
39
+ }
40
+ };
41
+ var rejected = (value) => {
42
+ try {
43
+ step(generator.throw(value));
44
+ } catch (e) {
45
+ reject(e);
46
+ }
47
+ };
48
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
+ step((generator = generator.apply(__this, __arguments)).next());
50
+ });
51
+ };
52
+ import { defineComponent, reactive, resolveComponent, openBlock, createBlock, createSlots, withCtx, renderSlot, createElementVNode, createVNode, createTextVNode, watch, resolveDynamicComponent, mergeProps, createElementBlock, Fragment, renderList, createCommentVNode, useSlots, useAttrs, ref, onMounted, nextTick, isVNode, withModifiers, computed, unref, normalizeStyle, toDisplayString, withKeys, toHandlers, pushScopeId, popScopeId } from "vue";
53
+ import { S as Sortable, _ as _export_sfc, T as Toolbar } from "./index.es5.js";
54
+ import "./index.es11.js";
55
+ import "element-plus";
56
+ import { u as uploadResourceApi } from "./index.es13.js";
57
+ const _hoisted_1$3 = { class: "dialog-footer flex justify-end" };
58
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
59
+ __name: "index",
60
+ setup(__props, { expose: __expose }) {
61
+ const dialogOptions = reactive({
62
+ width: "40%",
63
+ show: false,
64
+ title: "",
65
+ loading: false,
66
+ showFooter: true,
67
+ autoClose: true
68
+ });
69
+ const close = () => {
70
+ dialogOptions.show = false;
71
+ };
72
+ const dialogMap = {};
73
+ const submit = () => __async(this, null, function* () {
74
+ if (dialogMap["beforeSubmit"] && !(yield dialogMap["beforeSubmit"]())) return;
75
+ dialogOptions.loading = true;
76
+ try {
77
+ dialogMap["submit"] && (yield dialogMap["submit"]());
78
+ dialogOptions.loading = false;
79
+ if (dialogOptions.autoClose) close();
80
+ } catch (err) {
81
+ dialogOptions.loading = false;
82
+ }
83
+ });
84
+ const show = ({ width, title, submit: submit2, cancel, showFooter, autoClose, beforeOpen, beforeSubmit }) => {
85
+ if (width) dialogOptions.width = width;
86
+ if (title) dialogOptions.title = title;
87
+ if (showFooter !== void 0) dialogOptions.showFooter = showFooter;
88
+ if (autoClose !== void 0) dialogOptions.autoClose = autoClose;
89
+ if (submit2) dialogMap["submit"] = submit2;
90
+ if (cancel) dialogMap["cancel"] = cancel;
91
+ if (beforeSubmit) dialogMap["beforeSubmit"] = beforeSubmit;
92
+ if (beforeOpen) beforeOpen();
93
+ dialogOptions.show = true;
94
+ };
95
+ __expose({
96
+ show,
97
+ close
98
+ });
99
+ return (_ctx, _cache) => {
100
+ const _component_el_button = resolveComponent("el-button");
101
+ const _component_el_dialog = resolveComponent("el-dialog");
102
+ return openBlock(), createBlock(_component_el_dialog, {
103
+ "close-on-click-modal": false,
104
+ attrs: "",
105
+ width: dialogOptions.width,
106
+ modelValue: dialogOptions.show,
107
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dialogOptions.show = $event),
108
+ title: dialogOptions.title
109
+ }, createSlots({
110
+ default: withCtx(() => [
111
+ renderSlot(_ctx.$slots, "default")
112
+ ]),
113
+ _: 2
114
+ }, [
115
+ dialogOptions.showFooter ? {
116
+ name: "footer",
117
+ fn: withCtx(() => [
118
+ createElementVNode("span", _hoisted_1$3, [
119
+ createVNode(_component_el_button, {
120
+ plain: "",
121
+ onClick: close
122
+ }, {
123
+ default: withCtx(() => [
124
+ createTextVNode("取消")
125
+ ]),
126
+ _: 1
127
+ }),
128
+ createVNode(_component_el_button, {
129
+ loading: dialogOptions.loading,
130
+ onClick: submit
131
+ }, {
132
+ default: withCtx(() => [
133
+ createTextVNode("确认")
134
+ ]),
135
+ _: 1
136
+ }, 8, ["loading"])
137
+ ])
138
+ ]),
139
+ key: "0"
140
+ } : void 0
141
+ ]), 1032, ["width", "modelValue", "title"]);
142
+ };
143
+ }
144
+ });
145
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
146
+ __name: "index",
147
+ props: {
148
+ conf: {},
149
+ model: {}
150
+ },
151
+ emits: ["change"],
152
+ setup(__props, { emit: __emit }) {
153
+ const props = __props;
154
+ const emit = __emit;
155
+ watch(
156
+ () => {
157
+ var _a;
158
+ return props.model[(_a = props.conf) == null ? void 0 : _a.prop];
159
+ },
160
+ () => {
161
+ emit("change", props.model);
162
+ }
163
+ );
164
+ return (_ctx, _cache) => {
165
+ var _a, _b, _c;
166
+ return openBlock(), createBlock(resolveDynamicComponent(`el-${(_a = _ctx.conf) == null ? void 0 : _a.renderType}`), mergeProps({
167
+ modelValue: _ctx.model[(_b = _ctx.conf) == null ? void 0 : _b.prop],
168
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => {
169
+ var _a2;
170
+ return _ctx.model[(_a2 = _ctx.conf) == null ? void 0 : _a2.prop] = $event;
171
+ })
172
+ }, (_c = _ctx.conf) == null ? void 0 : _c.config), {
173
+ default: withCtx(() => {
174
+ var _a2, _b2, _c2;
175
+ return [
176
+ _ctx.conf.renderType === "select" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList((_c2 = (_b2 = (_a2 = _ctx.conf) == null ? void 0 : _a2.config) == null ? void 0 : _b2.options) != null ? _c2 : [], (op) => {
177
+ return openBlock(), createBlock(resolveDynamicComponent(`el-option`), {
178
+ key: op.value,
179
+ label: op.label,
180
+ value: op.value
181
+ }, null, 8, ["label", "value"]);
182
+ }), 128)) : createCommentVNode("", true)
183
+ ];
184
+ }),
185
+ _: 1
186
+ }, 16, ["modelValue"]);
187
+ };
188
+ }
189
+ });
190
+ function _isSlot$1(s) {
191
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
5
192
  }
6
- var q = { exports: {} };
7
- (function(y, st) {
8
- (function(A, Y) {
9
- y.exports = Y();
10
- })(X, function() {
11
- var A = 1e3, Y = 6e4, z = 36e5, I = "millisecond", w = "second", b = "minute", _ = "hour", M = "day", x = "week", m = "month", E = "quarter", v = "year", O = "date", J = "Invalid Date", B = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, G = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, Q = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(s) {
12
- var n = ["th", "st", "nd", "rd"], t = s % 100;
13
- return "[" + s + (n[(t - 20) % 10] || n[t] || n[0]) + "]";
14
- } }, F = function(s, n, t) {
15
- var r = String(s);
16
- return !r || r.length >= n ? s : "" + Array(n + 1 - r.length).join(t) + s;
17
- }, K = { s: F, z: function(s) {
18
- var n = -s.utcOffset(), t = Math.abs(n), r = Math.floor(t / 60), e = t % 60;
19
- return (n <= 0 ? "+" : "-") + F(r, 2, "0") + ":" + F(e, 2, "0");
20
- }, m: function s(n, t) {
21
- if (n.date() < t.date())
22
- return -s(t, n);
23
- var r = 12 * (t.year() - n.year()) + (t.month() - n.month()), e = n.clone().add(r, m), i = t - e < 0, u = n.clone().add(r + (i ? -1 : 1), m);
24
- return +(-(r + (t - e) / (i ? e - u : u - e)) || 0);
25
- }, a: function(s) {
26
- return s < 0 ? Math.ceil(s) || 0 : Math.floor(s);
27
- }, p: function(s) {
28
- return { M: m, y: v, w: x, d: M, D: O, h: _, m: b, s: w, ms: I, Q: E }[s] || String(s || "").toLowerCase().replace(/s$/, "");
29
- }, u: function(s) {
30
- return s === void 0;
31
- } }, k = "en", p = {};
32
- p[k] = Q;
33
- var Z = "$isDayjsObject", N = function(s) {
34
- return s instanceof L || !(!s || !s[Z]);
35
- }, C = function s(n, t, r) {
36
- var e;
37
- if (!n)
38
- return k;
39
- if (typeof n == "string") {
40
- var i = n.toLowerCase();
41
- p[i] && (e = i), t && (p[i] = t, e = i);
42
- var u = n.split("-");
43
- if (!e && u.length > 1)
44
- return s(u[0]);
45
- } else {
46
- var o = n.name;
47
- p[o] = n, e = o;
193
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
194
+ name: "YxTable"
195
+ }), {
196
+ __name: "index",
197
+ props: {
198
+ tableData: {},
199
+ rowKey: {},
200
+ columns: {},
201
+ pageInfo: {},
202
+ sort: {
203
+ type: Boolean
204
+ },
205
+ sortHandle: {},
206
+ load: {
207
+ type: Function
208
+ }
209
+ },
210
+ emits: ["operate-handle", "sort-end", "update-page", "size-change"],
211
+ setup(__props, {
212
+ expose: __expose,
213
+ emit: __emit
214
+ }) {
215
+ const props = __props;
216
+ const slots = useSlots();
217
+ const attrs = useAttrs();
218
+ const tableRef = ref();
219
+ const emit = __emit;
220
+ onMounted(() => {
221
+ nextTick(() => {
222
+ startSort();
223
+ });
224
+ });
225
+ const startSort = () => {
226
+ if (!props.sort) return;
227
+ const sortDom = document.querySelector(".el-table__body tbody");
228
+ Sortable.create(sortDom, {
229
+ animation: 200,
230
+ // group: "el-table__row table-row",
231
+ sort: true,
232
+ handle: props.sortHandle ? `.${props.sortHandle}` : null,
233
+ onEnd: ({
234
+ oldIndex,
235
+ newIndex
236
+ }) => {
237
+ emit("sort-end", oldIndex, newIndex);
238
+ }
239
+ });
240
+ };
241
+ const render2 = (props2) => {
242
+ let _slot;
243
+ const {
244
+ columns,
245
+ rowKey,
246
+ tableData,
247
+ pageInfo
248
+ } = props2;
249
+ const columnSlots = (cell, scope) => {
250
+ var _a;
251
+ return cell.slotName && ((_a = slots[cell.slotName]) == null ? void 0 : _a.call(slots, scope));
252
+ };
253
+ const renderColumn = (columns2) => {
254
+ return columns2.filter((cell) => !cell.show || cell.show(cell)).map((cell) => {
255
+ const _a = cell, {
256
+ children
257
+ } = _a, cellConf = __objRest(_a, [
258
+ "children"
259
+ ]);
260
+ return createVNode(resolveComponent("el-table-column"), cellConf, {
261
+ default: (scope) => {
262
+ if ((cell == null ? void 0 : cell.renderType) === "operate") return renderOperate(cell, scope);
263
+ if ((cell == null ? void 0 : cell.renderType) && (cell == null ? void 0 : cell.renderType) !== "operate") {
264
+ const conf = {
265
+ renderType: cell.renderType,
266
+ prop: cell.prop,
267
+ config: cell.config
268
+ };
269
+ return createVNode(_sfc_main$7, {
270
+ "conf": conf,
271
+ "model": scope.row,
272
+ "onChange": cell == null ? void 0 : cell.change
273
+ }, null);
274
+ }
275
+ if (cell == null ? void 0 : cell.render) return cell == null ? void 0 : cell.render(scope.row);
276
+ if (children && (children == null ? void 0 : children.length) > 0) return renderColumn(children);
277
+ return (cell == null ? void 0 : cell.slotName) && columnSlots(cell, scope);
278
+ }
279
+ });
280
+ });
281
+ };
282
+ const renderOperate = (cell, scope) => {
283
+ var _a;
284
+ return createVNode("div", {
285
+ "class": "flex justify-center items-center cursor-pointer"
286
+ }, [(_a = cell.operate) == null ? void 0 : _a.filter((op) => !op.show || op.show(scope.row)).map((op) => {
287
+ if (op == null ? void 0 : op.render) return op.render(scope.row);
288
+ return createVNode("span", {
289
+ "onClick": withModifiers(() => {
290
+ (op == null ? void 0 : op.onClick) && (op == null ? void 0 : op.onClick(scope.row));
291
+ emit("operate-handle", op.key, scope.row);
292
+ }, ["stop"]),
293
+ "class": "table-handle whitespace-nowrap"
294
+ }, [createTextVNode(" "), op.label, createTextVNode(" ")]);
295
+ })]);
296
+ };
297
+ const pagination = () => {
298
+ if (!pageInfo) return null;
299
+ const handleSizeChange = (e) => {
300
+ emit("update-page", "pageSize", e);
301
+ };
302
+ const handleCurrentChange = (e) => {
303
+ emit("update-page", "pageIndex", e);
304
+ };
305
+ return createVNode("div", {
306
+ "class": "pagination-wrap"
307
+ }, [createVNode(resolveComponent("el-pagination"), {
308
+ "currentPage": pageInfo.pageIndex,
309
+ "onUpdate:currentPage": ($event) => pageInfo.pageIndex = $event,
310
+ "pageSize": pageInfo.pageSize,
311
+ "onUpdate:pageSize": ($event) => pageInfo.pageSize = $event,
312
+ "small": false,
313
+ "disabled": false,
314
+ "page-sizes": [10, 20, 50, 100],
315
+ "layout": "total,sizes,prev, pager, next",
316
+ "background": false,
317
+ "total": pageInfo.total,
318
+ "onSizeChange": handleSizeChange,
319
+ "onCurrentChange": handleCurrentChange
320
+ }, null)]);
321
+ };
322
+ return createVNode(Fragment, null, [createVNode(resolveComponent("el-table"), mergeProps({
323
+ "ref": tableRef
324
+ }, attrs, {
325
+ "row-key": rowKey,
326
+ "data": tableData
327
+ }), _isSlot$1(_slot = renderColumn(columns)) ? _slot : {
328
+ default: () => [_slot]
329
+ }), pagination()]);
330
+ };
331
+ __expose({
332
+ tableRef
333
+ });
334
+ return (_ctx, _cache) => {
335
+ return openBlock(), createBlock(resolveDynamicComponent(render2(props)));
336
+ };
337
+ }
338
+ }));
339
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
340
+ __name: "index",
341
+ props: {
342
+ searchColumns: {},
343
+ searchParams: {},
344
+ showSearchBtn: {
345
+ type: Boolean,
346
+ default: true
347
+ },
348
+ showAddBtn: {
349
+ type: Boolean,
350
+ default: true
351
+ },
352
+ style: {},
353
+ labelStyle: {},
354
+ className: {},
355
+ classLabelName: {}
356
+ },
357
+ emits: ["search", "add"],
358
+ setup(__props, {
359
+ emit: __emit
360
+ }) {
361
+ const slots = useSlots();
362
+ const props = __props;
363
+ const emit = __emit;
364
+ const render2 = (props2) => {
365
+ const {
366
+ searchColumns,
367
+ searchParams,
368
+ showSearchBtn,
369
+ showAddBtn,
370
+ style,
371
+ labelStyle,
372
+ className,
373
+ classLabelName
374
+ } = props2;
375
+ const renderColumn = (searchColumns2) => {
376
+ return searchColumns2.filter((cell) => !cell.show || cell.show()).map((cell) => {
377
+ var _a, _b;
378
+ const conf = {
379
+ renderType: cell.renderType,
380
+ prop: cell.key,
381
+ config: cell.config
382
+ };
383
+ return createVNode("div", {
384
+ "class": `flex items-center search-item ${className != null ? className : ""} ${(_a = cell.className) != null ? _a : ""}`,
385
+ "style": __spreadValues(__spreadValues({}, style), cell.style)
386
+ }, [createVNode("span", {
387
+ "class": `whitespace-nowrap label ${classLabelName != null ? classLabelName : ""} ${(_b = cell.classLabelName) != null ? _b : ""}`,
388
+ "style": __spreadValues(__spreadValues({}, labelStyle), cell.labelStyle)
389
+ }, [createTextVNode(" "), cell.label, createTextVNode(" ")]), createVNode(_sfc_main$7, {
390
+ "class": cell.componentClassName,
391
+ "style": cell.componentStyle,
392
+ "conf": conf,
393
+ "model": searchParams,
394
+ "onChange": cell == null ? void 0 : cell.change
395
+ }, null)]);
396
+ });
397
+ };
398
+ return createVNode(Fragment, null, [createVNode("div", {
399
+ "class": "table-search flex gap-10"
400
+ }, [renderColumn(searchColumns), showSearchBtn && createVNode(resolveComponent("el-button"), {
401
+ "onClick": () => emit("search"),
402
+ "class": "search-item"
403
+ }, {
404
+ default: () => [createTextVNode("搜索"), " "]
405
+ }), showAddBtn && createVNode(resolveComponent("el-button"), {
406
+ "class": "search-item",
407
+ "onClick": () => emit("add")
408
+ }, {
409
+ default: () => [createTextVNode("添加")]
410
+ }), slots.default && slots.default()])]);
411
+ };
412
+ return (_ctx, _cache) => {
413
+ return openBlock(), createBlock(resolveDynamicComponent(render2(props)));
414
+ };
415
+ }
416
+ });
417
+ const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c70da20e"]]);
418
+ const ruleMap = {
419
+ required: rule_required,
420
+ isNumber: rule_isNumber,
421
+ isInt: rule_isInt,
422
+ maxNumber: rule_maxNumber,
423
+ minNumber: rule_minNumber,
424
+ reg: rule_reg
425
+ };
426
+ function formatRule(label, ruleName, value) {
427
+ return ruleMap[ruleName](label, value);
428
+ }
429
+ function rule_required(label) {
430
+ return { required: true, message: `请输入${label}`, trigger: ["blur", "change"] };
431
+ }
432
+ function rule_isNumber(label) {
433
+ return {
434
+ validator: (rule, value, callback) => {
435
+ if (Number.isNaN(+value)) {
436
+ callback(new Error(`${label}必须是数字类型`));
437
+ return;
438
+ }
439
+ callback();
440
+ },
441
+ trigger: "blur"
442
+ };
443
+ }
444
+ function rule_isInt(label) {
445
+ return {
446
+ validator: (rule, value, callback) => {
447
+ if (value % 1 !== 0) {
448
+ callback(new Error(`${label}必须是整数类型`));
449
+ return;
450
+ }
451
+ callback();
452
+ },
453
+ trigger: "blur"
454
+ };
455
+ }
456
+ function rule_maxNumber(label, maxNumber) {
457
+ return {
458
+ validator: (rule, value, callback) => {
459
+ if (+value > +maxNumber) {
460
+ callback(new Error(`${label}的值必须小于${maxNumber}`));
461
+ return;
462
+ }
463
+ callback();
464
+ },
465
+ trigger: "blur"
466
+ };
467
+ }
468
+ function rule_minNumber(label, minNumber) {
469
+ return {
470
+ validator: (rule, value, callback) => {
471
+ if (+value < +minNumber) {
472
+ callback(new Error(`${label}的值必须大于${minNumber}`));
473
+ return;
48
474
  }
49
- return !r && e && (k = e), e || !r && k;
50
- }, f = function(s, n) {
51
- if (N(s))
52
- return s.clone();
53
- var t = typeof n == "object" ? n : {};
54
- return t.date = s, t.args = arguments, new L(t);
55
- }, a = K;
56
- a.l = C, a.i = N, a.w = function(s, n) {
57
- return f(s, { locale: n.$L, utc: n.$u, x: n.$x, $offset: n.$offset });
475
+ callback();
476
+ },
477
+ trigger: "blur"
478
+ };
479
+ }
480
+ function rule_reg(label, reg) {
481
+ return {
482
+ validator: (rule, value, callback) => {
483
+ if (!reg.test(value)) {
484
+ callback(new Error(`校验不通过`));
485
+ return;
486
+ }
487
+ callback();
488
+ },
489
+ trigger: "blur"
490
+ };
491
+ }
492
+ const _hoisted_1$2 = {
493
+ xmlns: "http://www.w3.org/2000/svg",
494
+ width: "16",
495
+ height: "16",
496
+ class: "icon",
497
+ viewBox: "0 0 1024 1024"
498
+ };
499
+ const _hoisted_2$2 = /* @__PURE__ */ createElementVNode("path", {
500
+ fill: "#707070",
501
+ d: "M511.666 64.673c-246.535 0-446.39 199.856-446.39 446.39 0 246.536 199.855 446.393 446.39 446.393s446.392-199.857 446.392-446.392S758.203 64.673 511.666 64.673m0 836.878c-215.66 0-390.487-174.827-390.487-390.488 0-215.66 174.827-390.487 390.487-390.487s390.488 174.827 390.488 390.487c0 215.661-174.828 390.488-390.488 390.488m-86.894-485.188s14.002-86.168 100.17-76.474c86.168 9.694 66.78 74.32 58.163 87.245-8.616 21.542-88.323 73.243-101.247 104.479-12.925 31.236-11.848 89.4-11.848 89.4h77.551s-4.308-61.395 38.776-87.246c43.084-25.85 116.326-101.247 84.014-173.413-51.701-82.937-102.324-91.554-168.028-89.4-65.703 2.155-134.638 34.468-157.257 134.639 53.855 7.538 79.706 10.77 79.706 10.77m44.16 233.73h80.783v88.311h-80.782v-88.31z"
502
+ }, null, -1);
503
+ const _hoisted_3$1 = [
504
+ _hoisted_2$2
505
+ ];
506
+ function render(_ctx, _cache) {
507
+ return openBlock(), createElementBlock("svg", _hoisted_1$2, _hoisted_3$1);
508
+ }
509
+ const HelpIcon = { render };
510
+ const _hoisted_1$1 = {
511
+ key: 0,
512
+ style: { "margin-left": "4px" }
513
+ };
514
+ const _hoisted_2$1 = ["slot"];
515
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
516
+ __name: "form",
517
+ props: {
518
+ formConfig: {},
519
+ status: {},
520
+ formData: {}
521
+ },
522
+ setup(__props, { expose: __expose }) {
523
+ const hasNoComp = ["date-picker"];
524
+ const props = __props;
525
+ const formRef = ref();
526
+ const form2 = ref(getForm());
527
+ const rules = getRules();
528
+ const formValue = computed(() => {
529
+ const compList = props.formConfig.compList;
530
+ const showFormValue = {};
531
+ compList.forEach((item) => {
532
+ if (typeof item.hidden === "function" ? !item.hidden(form2.value, props.status) : !item.hidden) {
533
+ item.name && (showFormValue[item.name] = form2.value[item.name]);
534
+ }
535
+ });
536
+ return showFormValue;
537
+ });
538
+ function getForm() {
539
+ return props.status === "ADD" ? initForm() : props.formData;
540
+ }
541
+ function getRules() {
542
+ return initRules();
543
+ }
544
+ function resetForm() {
545
+ form2.value = initForm();
546
+ }
547
+ function initForm() {
548
+ const list = props.formConfig.compList;
549
+ const form22 = {};
550
+ list.forEach((item) => {
551
+ item.name && (form22[item.name] = item.defaultValue);
552
+ });
553
+ return form22;
554
+ }
555
+ function initRules() {
556
+ const list = props.formConfig.compList;
557
+ const rules2 = {};
558
+ list.forEach((item) => {
559
+ var _a, _b, _c;
560
+ const hasRules = ((_a = item.rule) == null ? void 0 : _a.constructor) === Object && Object.keys(item.rule).length > 0;
561
+ const hasCustomRules = Array.isArray(item.customRules) && item.customRules.length > 0;
562
+ if (hasRules || hasCustomRules) {
563
+ !rules2[item.name] && (rules2[item.name] = []);
564
+ }
565
+ if (hasRules) {
566
+ for (const ruleName in item.rule) {
567
+ if (item.rule[ruleName] === false) break;
568
+ const label = typeof item.label === "function" ? handleFn(item.label) : item.label;
569
+ (_b = rules2[item.name]) == null ? void 0 : _b.push(formatRule(label, ruleName, item.rule[ruleName]));
570
+ }
571
+ }
572
+ if (hasCustomRules) {
573
+ (_c = item.customRules) == null ? void 0 : _c.forEach((cRule) => {
574
+ var _a2;
575
+ (_a2 = rules2[item.name]) == null ? void 0 : _a2.push(cRule);
576
+ });
577
+ }
578
+ });
579
+ return rules2;
580
+ }
581
+ function validateForm() {
582
+ return new Promise((resolve, reject) => {
583
+ formRef.value.validate((valid) => {
584
+ valid ? resolve("") : reject();
585
+ });
586
+ });
587
+ }
588
+ function formShow(compList) {
589
+ return compList.filter((i) => !handleFn(i.hidden));
590
+ }
591
+ function handleFn(fields) {
592
+ return typeof fields === "function" ? fields(form2.value, props.status) : fields;
593
+ }
594
+ watch(
595
+ () => form2,
596
+ () => {
597
+ initForm();
598
+ },
599
+ {
600
+ deep: true
601
+ }
602
+ );
603
+ __expose({
604
+ form: form2,
605
+ formValue,
606
+ resetForm,
607
+ validateForm
608
+ });
609
+ return (_ctx, _cache) => {
610
+ const _component_el_popover = resolveComponent("el-popover");
611
+ const _component_el_form_item = resolveComponent("el-form-item");
612
+ const _component_el_form = resolveComponent("el-form");
613
+ return openBlock(), createBlock(_component_el_form, mergeProps({
614
+ ref_key: "formRef",
615
+ ref: formRef,
616
+ model: form2.value
617
+ }, _ctx.formConfig.formProps, { rules: unref(rules) }), {
618
+ default: withCtx(() => [
619
+ createElementVNode("div", {
620
+ class: "form-wrap",
621
+ style: normalizeStyle(_ctx.formConfig.wrapStyle)
622
+ }, [
623
+ (openBlock(true), createElementBlock(Fragment, null, renderList(formShow(_ctx.formConfig.compList), (item) => {
624
+ return openBlock(), createElementBlock("div", {
625
+ class: "form-item",
626
+ key: item.name,
627
+ style: normalizeStyle(__spreadValues(__spreadValues({}, _ctx.formConfig.itemStyle), item.style))
628
+ }, [
629
+ createVNode(_component_el_form_item, mergeProps(__spreadValues(__spreadValues({}, _ctx.formConfig.formItemProps), item.formItemProps), {
630
+ prop: item.name,
631
+ style: _ctx.formConfig.formItemStyle,
632
+ class: _ctx.formConfig.layout
633
+ }), {
634
+ label: withCtx(() => [
635
+ createElementVNode("span", {
636
+ style: normalizeStyle(item.labelStyle)
637
+ }, toDisplayString(handleFn(item.label)), 5),
638
+ item.hint ? (openBlock(), createBlock(_component_el_popover, {
639
+ key: 0,
640
+ placement: "top-start",
641
+ trigger: "hover",
642
+ content: item.hint
643
+ }, {
644
+ reference: withCtx(() => [
645
+ item.hint ? (openBlock(), createElementBlock("span", _hoisted_1$1, [
646
+ createVNode(unref(HelpIcon), { color: "#ccc" })
647
+ ])) : createCommentVNode("", true)
648
+ ]),
649
+ _: 2
650
+ }, 1032, ["content"])) : createCommentVNode("", true)
651
+ ]),
652
+ default: withCtx(() => [
653
+ item.slotName ? renderSlot(_ctx.$slots, item.slotName, {
654
+ key: 0,
655
+ form: form2.value
656
+ }, void 0, true) : hasNoComp.includes(item.ctype || "") ? (openBlock(), createBlock(resolveDynamicComponent(`el-${item.ctype}`), mergeProps({ key: 1 }, item.config, {
657
+ modelValue: form2.value[item.name],
658
+ "onUpdate:modelValue": ($event) => form2.value[item.name] = $event
659
+ }), null, 16, ["modelValue", "onUpdate:modelValue"])) : (openBlock(), createBlock(resolveDynamicComponent(`el-${item.ctype}`), mergeProps({ key: 2 }, item.config, {
660
+ disabled: handleFn(item.disabled),
661
+ modelValue: form2.value[item.name],
662
+ "onUpdate:modelValue": ($event) => form2.value[item.name] = $event,
663
+ onKeyup: withKeys(($event) => handleFn(item == null ? void 0 : item.enter), ["enter"])
664
+ }, toHandlers(item.event)), {
665
+ default: withCtx(() => [
666
+ item.ctype === "select" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(item.selectOptions, (option) => {
667
+ return openBlock(), createBlock(resolveDynamicComponent("el-option"), {
668
+ key: option.value,
669
+ label: option.label,
670
+ value: option.value
671
+ }, null, 8, ["label", "value"]);
672
+ }), 128)) : createCommentVNode("", true),
673
+ item.ctype === "radio-group" ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(item.radioList, (radio) => {
674
+ return openBlock(), createBlock(resolveDynamicComponent("el-radio"), {
675
+ key: radio.value,
676
+ label: radio.value
677
+ }, {
678
+ default: withCtx(() => [
679
+ createTextVNode(toDisplayString(radio.label), 1)
680
+ ]),
681
+ _: 2
682
+ }, 1032, ["label"]);
683
+ }), 128)) : createCommentVNode("", true),
684
+ item.ctype === "checkbox-group" ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(item.checkboxList, (box) => {
685
+ return openBlock(), createBlock(resolveDynamicComponent("el-checkbox"), {
686
+ key: box,
687
+ label: box
688
+ }, null, 8, ["label"]);
689
+ }), 128)) : createCommentVNode("", true),
690
+ item.ctype === "input" ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList((item.slots || []).filter((i) => i.type === "text"), (st) => {
691
+ return openBlock(), createElementBlock("div", {
692
+ slot: st.name,
693
+ key: st.name
694
+ }, toDisplayString(st.inner), 9, _hoisted_2$1);
695
+ }), 128)) : createCommentVNode("", true)
696
+ ]),
697
+ _: 2
698
+ }, 1040, ["disabled", "modelValue", "onUpdate:modelValue", "onKeyup"]))
699
+ ]),
700
+ _: 2
701
+ }, 1040, ["prop", "style", "class"])
702
+ ], 4);
703
+ }), 128))
704
+ ], 4)
705
+ ]),
706
+ _: 3
707
+ }, 16, ["model", "rules"]);
708
+ };
709
+ }
710
+ });
711
+ const form = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-a47302d3"]]);
712
+ let versionKey, curVersion, updateApp;
713
+ const updateSysVersion = () => {
714
+ localStorage.setItem(versionKey, curVersion);
715
+ window.location.reload(true);
716
+ };
717
+ const delayUpdateSysVersion = () => {
718
+ updateApp.unmount();
719
+ document.body.removeChild(document.querySelector("#update"));
720
+ localStorage.setItem(versionKey, curVersion);
721
+ };
722
+ const _withScopeId = (n) => (pushScopeId("data-v-ebf4f18f"), n = n(), popScopeId(), n);
723
+ const _hoisted_1 = { class: "update-wrap flex items-center justify-center" };
724
+ const _hoisted_2 = { class: "relative update-content" };
725
+ const _hoisted_3 = { class: "flex items-center justify-center" };
726
+ const _hoisted_4 = { class: "flex flex-col gap-5 mt-10" };
727
+ const _hoisted_5 = { class: "update-title" };
728
+ const _hoisted_6 = { class: "update-item px-20" };
729
+ const _hoisted_7 = { class: "text-end" };
730
+ const _hoisted_8 = { class: "flex justify-end items-center mt-10" };
731
+ const _hoisted_9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "tips mt-10" }, "提示: 选择立即更新后,会立即刷新页面更新系统,当前页面缓存数据会消失选择暂不更新后,请稍后自行刷新页面更新系统。", -1));
732
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
733
+ __name: "index",
734
+ props: {
735
+ title: {},
736
+ description: {},
737
+ content: {},
738
+ time: {}
739
+ },
740
+ setup(__props) {
741
+ const props = __props;
742
+ console.log(props);
743
+ return (_ctx, _cache) => {
744
+ const _component_el_button = resolveComponent("el-button");
745
+ return openBlock(), createElementBlock("div", _hoisted_1, [
746
+ createElementVNode("div", _hoisted_2, [
747
+ createElementVNode("div", _hoisted_3, toDisplayString(props == null ? void 0 : props.title), 1),
748
+ createElementVNode("div", _hoisted_4, [
749
+ createElementVNode("div", _hoisted_5, toDisplayString(props == null ? void 0 : props.description), 1),
750
+ (openBlock(true), createElementBlock(Fragment, null, renderList(props == null ? void 0 : props.content, (item, key) => {
751
+ return openBlock(), createElementBlock("div", _hoisted_6, [
752
+ createElementVNode("span", null, toDisplayString(key) + ":", 1),
753
+ createTextVNode(),
754
+ createElementVNode("span", null, toDisplayString(item), 1)
755
+ ]);
756
+ }), 256)),
757
+ createElementVNode("div", _hoisted_7, toDisplayString(props.time) + " 软件专业部", 1),
758
+ createElementVNode("div", _hoisted_8, [
759
+ createVNode(_component_el_button, {
760
+ plain: "",
761
+ onClick: unref(delayUpdateSysVersion)
762
+ }, {
763
+ default: withCtx(() => [
764
+ createTextVNode("暂不更新")
765
+ ]),
766
+ _: 1
767
+ }, 8, ["onClick"]),
768
+ createVNode(_component_el_button, { onClick: unref(updateSysVersion) }, {
769
+ default: withCtx(() => [
770
+ createTextVNode("立即更新")
771
+ ]),
772
+ _: 1
773
+ }, 8, ["onClick"])
774
+ ]),
775
+ _hoisted_9
776
+ ])
777
+ ])
778
+ ]);
779
+ };
780
+ }
781
+ });
782
+ const Update = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-ebf4f18f"]]);
783
+ const _sfc_main$2 = {
784
+ props: {
785
+ color: {
786
+ type: String,
787
+ default: "inherit"
788
+ },
789
+ size: {
790
+ type: String,
791
+ default: "16"
792
+ }
793
+ }
794
+ };
795
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
796
+ return openBlock(), createElementBlock("i", {
797
+ class: "yx-icon",
798
+ style: normalizeStyle([{ "--color": $props.color, "font-size": $props.size + "px" }])
799
+ }, [
800
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
801
+ ], 4);
802
+ }
803
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render], ["__scopeId", "data-v-75aef834"]]);
804
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
805
+ __name: "index",
806
+ props: {
807
+ uploadTips: {},
808
+ render: {
809
+ type: Function
810
+ }
811
+ },
812
+ emits: ["update:fileObsUrl"],
813
+ setup(__props, {
814
+ emit: __emit
815
+ }) {
816
+ const attrs = useAttrs();
817
+ const fileList = ref([]);
818
+ const props = __props;
819
+ const fileObsUrl = ref("");
820
+ const emit = __emit;
821
+ const uploadFile = (_0) => __async(this, [_0], function* ({
822
+ file
823
+ }) {
824
+ const fromData = new FormData();
825
+ fromData.append("file", file);
826
+ const {
827
+ data
828
+ } = yield uploadResourceApi(fromData);
829
+ fileObsUrl.value = data.fileUrl;
830
+ emit("update:fileObsUrl", fileObsUrl.value);
831
+ });
832
+ const render2 = (props2) => {
833
+ return createVNode(resolveComponent("el-upload"), mergeProps({
834
+ "class": "w-full h-full",
835
+ "http-request": uploadFile,
836
+ "file-list": fileList.value
837
+ }, attrs), {
838
+ trigger: () => {
839
+ return props2 == null ? void 0 : props2.render(fileObsUrl.value);
840
+ },
841
+ tip: () => {
842
+ return createVNode("div", {
843
+ "class": "el-upload__tip"
844
+ }, [props2 == null ? void 0 : props2.uploadTips]);
845
+ }
846
+ });
847
+ };
848
+ return (_ctx, _cache) => {
849
+ return openBlock(), createBlock(resolveDynamicComponent(render2(props)), {
850
+ "model-value": fileObsUrl.value
851
+ }, null, 8, ["model-value"]);
58
852
  };
59
- var L = function() {
60
- function s(t) {
61
- this.$L = C(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[Z] = !0;
853
+ }
854
+ });
855
+ function _isSlot(s) {
856
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
857
+ }
858
+ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
859
+ name: "YxForm"
860
+ }), {
861
+ __name: "index",
862
+ props: {
863
+ formParams: {},
864
+ formList: {},
865
+ formLayout: {
866
+ default: "horizontal"
867
+ },
868
+ formStyle: {
869
+ default: {
870
+ row: 3,
871
+ gap: "15px",
872
+ labelWidth: "100px",
873
+ "align-items": "start"
62
874
  }
63
- var n = s.prototype;
64
- return n.parse = function(t) {
65
- this.$d = function(r) {
66
- var e = r.date, i = r.utc;
67
- if (e === null)
68
- return /* @__PURE__ */ new Date(NaN);
69
- if (a.u(e))
70
- return /* @__PURE__ */ new Date();
71
- if (e instanceof Date)
72
- return new Date(e);
73
- if (typeof e == "string" && !/Z$/i.test(e)) {
74
- var u = e.match(B);
75
- if (u) {
76
- var o = u[2] - 1 || 0, c = (u[7] || "0").substring(0, 3);
77
- return i ? new Date(Date.UTC(u[1], o, u[3] || 1, u[4] || 0, u[5] || 0, u[6] || 0, c)) : new Date(u[1], o, u[3] || 1, u[4] || 0, u[5] || 0, u[6] || 0, c);
875
+ },
876
+ rules: {}
877
+ },
878
+ setup(__props, {
879
+ expose: __expose
880
+ }) {
881
+ let formData = ref({});
882
+ const formRules = ref({});
883
+ const initForm = () => {
884
+ const {
885
+ formList,
886
+ formParams
887
+ } = props;
888
+ if (!formParams || Object.keys(formParams).length === 0) {
889
+ formList.forEach((item) => formData.value[item.prop] = "");
890
+ } else {
891
+ formData.value = formParams;
892
+ }
893
+ console.log("initForm", formData);
894
+ };
895
+ const slots = useSlots();
896
+ const attrs = useAttrs();
897
+ const props = __props;
898
+ const getRules = () => {
899
+ let rules = {};
900
+ const {
901
+ formList
902
+ } = props;
903
+ formList.forEach((form2) => {
904
+ if (form2.children && form2.children.length > 0) {
905
+ form2.children.forEach((item) => {
906
+ if (item.required) {
907
+ const defaultRule = {
908
+ required: true,
909
+ message: `${item.label}不能为空`,
910
+ trigger: "blur"
911
+ };
912
+ rules[item.prop] = [defaultRule];
913
+ if (item.rules) {
914
+ rules[item.prop] = [...rules[item.prop], ...item.rules];
915
+ }
78
916
  }
917
+ });
918
+ }
919
+ if (form2.required) {
920
+ const defaultRule = {
921
+ required: true,
922
+ message: `${form2.label}不能为空`,
923
+ trigger: "blur"
924
+ };
925
+ rules[form2.prop] = [defaultRule];
926
+ if (form2.rules) {
927
+ rules[form2.prop] = [...rules[form2.prop], ...form2.rules];
79
928
  }
80
- return new Date(e);
81
- }(t), this.init();
82
- }, n.init = function() {
83
- var t = this.$d;
84
- this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
85
- }, n.$utils = function() {
86
- return a;
87
- }, n.isValid = function() {
88
- return this.$d.toString() !== J;
89
- }, n.isSame = function(t, r) {
90
- var e = f(t);
91
- return this.startOf(r) <= e && e <= this.endOf(r);
92
- }, n.isAfter = function(t, r) {
93
- return f(t) < this.startOf(r);
94
- }, n.isBefore = function(t, r) {
95
- return this.endOf(r) < f(t);
96
- }, n.$g = function(t, r, e) {
97
- return a.u(t) ? this[r] : this.set(e, t);
98
- }, n.unix = function() {
99
- return Math.floor(this.valueOf() / 1e3);
100
- }, n.valueOf = function() {
101
- return this.$d.getTime();
102
- }, n.startOf = function(t, r) {
103
- var e = this, i = !!a.u(r) || r, u = a.p(t), o = function(S, l) {
104
- var g = a.w(e.$u ? Date.UTC(e.$y, l, S) : new Date(e.$y, l, S), e);
105
- return i ? g : g.endOf(M);
106
- }, c = function(S, l) {
107
- return a.w(e.toDate()[S].apply(e.toDate("s"), (i ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(l)), e);
108
- }, h = this.$W, d = this.$M, $ = this.$D, T = "set" + (this.$u ? "UTC" : "");
109
- switch (u) {
110
- case v:
111
- return i ? o(1, 0) : o(31, 11);
112
- case m:
113
- return i ? o(1, d) : o(0, d + 1);
114
- case x:
115
- var D = this.$locale().weekStart || 0, H = (h < D ? h + 7 : h) - D;
116
- return o(i ? $ - H : $ + (6 - H), d);
117
- case M:
118
- case O:
119
- return c(T + "Hours", 0);
120
- case _:
121
- return c(T + "Minutes", 1);
122
- case b:
123
- return c(T + "Seconds", 2);
124
- case w:
125
- return c(T + "Milliseconds", 3);
126
- default:
127
- return this.clone();
128
929
  }
129
- }, n.endOf = function(t) {
130
- return this.startOf(t, !1);
131
- }, n.$set = function(t, r) {
132
- var e, i = a.p(t), u = "set" + (this.$u ? "UTC" : ""), o = (e = {}, e[M] = u + "Date", e[O] = u + "Date", e[m] = u + "Month", e[v] = u + "FullYear", e[_] = u + "Hours", e[b] = u + "Minutes", e[w] = u + "Seconds", e[I] = u + "Milliseconds", e)[i], c = i === M ? this.$D + (r - this.$W) : r;
133
- if (i === m || i === v) {
134
- var h = this.clone().set(O, 1);
135
- h.$d[o](c), h.init(), this.$d = h.set(O, Math.min(this.$D, h.daysInMonth())).$d;
136
- } else
137
- o && this.$d[o](c);
138
- return this.init(), this;
139
- }, n.set = function(t, r) {
140
- return this.clone().$set(t, r);
141
- }, n.get = function(t) {
142
- return this[a.p(t)]();
143
- }, n.add = function(t, r) {
144
- var e, i = this;
145
- t = Number(t);
146
- var u = a.p(r), o = function(d) {
147
- var $ = f(i);
148
- return a.w($.date($.date() + Math.round(d * t)), i);
149
- };
150
- if (u === m)
151
- return this.set(m, this.$M + t);
152
- if (u === v)
153
- return this.set(v, this.$y + t);
154
- if (u === M)
155
- return o(1);
156
- if (u === x)
157
- return o(7);
158
- var c = (e = {}, e[b] = Y, e[_] = z, e[w] = A, e)[u] || 1, h = this.$d.getTime() + t * c;
159
- return a.w(h, this);
160
- }, n.subtract = function(t, r) {
161
- return this.add(-1 * t, r);
162
- }, n.format = function(t) {
163
- var r = this, e = this.$locale();
164
- if (!this.isValid())
165
- return e.invalidDate || J;
166
- var i = t || "YYYY-MM-DDTHH:mm:ssZ", u = a.z(this), o = this.$H, c = this.$m, h = this.$M, d = e.weekdays, $ = e.months, T = e.meridiem, D = function(l, g, j, W) {
167
- return l && (l[g] || l(r, i)) || j[g].slice(0, W);
168
- }, H = function(l) {
169
- return a.s(o % 12 || 12, l, "0");
170
- }, S = T || function(l, g, j) {
171
- var W = l < 12 ? "AM" : "PM";
172
- return j ? W.toLowerCase() : W;
930
+ });
931
+ formRules.value = rules;
932
+ };
933
+ const formRef = ref();
934
+ const getFormStyle = () => {
935
+ const {
936
+ formStyle
937
+ } = props;
938
+ const _a = formStyle, {
939
+ row,
940
+ gap
941
+ } = _a, style = __objRest(_a, [
942
+ "row",
943
+ "gap"
944
+ ]);
945
+ return __spreadValues({
946
+ "grid-template-columns": `repeat(${row}, 1fr)`,
947
+ "grid-gap": gap
948
+ }, style);
949
+ };
950
+ const getGroupStyle = (groupStyle) => {
951
+ if (!groupStyle) return {};
952
+ const _a = groupStyle, {
953
+ row,
954
+ gap
955
+ } = _a, style = __objRest(_a, [
956
+ "row",
957
+ "gap"
958
+ ]);
959
+ return __spreadValues({
960
+ "grid-template-columns": `repeat(${row}, 1fr)`,
961
+ "grid-gap": gap
962
+ }, style);
963
+ };
964
+ initForm();
965
+ getRules();
966
+ const render2 = (props2) => {
967
+ let _slot;
968
+ const {
969
+ formList,
970
+ formStyle,
971
+ formLayout
972
+ } = props2;
973
+ const dynamicComponent = ({
974
+ renderType,
975
+ event,
976
+ prop,
977
+ label,
978
+ config
979
+ }) => {
980
+ const Component = resolveComponent("el-" + renderType);
981
+ const renderChildComponent = () => {
982
+ if (renderType === "select") return config.options.map((item) => createVNode(resolveComponent("el-option"), {
983
+ "label": item.label,
984
+ "value": item.value
985
+ }, null));
173
986
  };
174
- return i.replace(G, function(l, g) {
175
- return g || function(j) {
176
- switch (j) {
177
- case "YY":
178
- return String(r.$y).slice(-2);
179
- case "YYYY":
180
- return a.s(r.$y, 4, "0");
181
- case "M":
182
- return h + 1;
183
- case "MM":
184
- return a.s(h + 1, 2, "0");
185
- case "MMM":
186
- return D(e.monthsShort, h, $, 3);
187
- case "MMMM":
188
- return D($, h);
189
- case "D":
190
- return r.$D;
191
- case "DD":
192
- return a.s(r.$D, 2, "0");
193
- case "d":
194
- return String(r.$W);
195
- case "dd":
196
- return D(e.weekdaysMin, r.$W, d, 2);
197
- case "ddd":
198
- return D(e.weekdaysShort, r.$W, d, 3);
199
- case "dddd":
200
- return d[r.$W];
201
- case "H":
202
- return String(o);
203
- case "HH":
204
- return a.s(o, 2, "0");
205
- case "h":
206
- return H(1);
207
- case "hh":
208
- return H(2);
209
- case "a":
210
- return S(o, c, !0);
211
- case "A":
212
- return S(o, c, !1);
213
- case "m":
214
- return String(c);
215
- case "mm":
216
- return a.s(c, 2, "0");
217
- case "s":
218
- return String(r.$s);
219
- case "ss":
220
- return a.s(r.$s, 2, "0");
221
- case "SSS":
222
- return a.s(r.$ms, 3, "0");
223
- case "Z":
224
- return u;
225
- }
226
- return null;
227
- }(l) || u.replace(":", "");
987
+ const _a = config || {}, {
988
+ options
989
+ } = _a, conf = __objRest(_a, [
990
+ "options"
991
+ ]);
992
+ return createVNode(Component, mergeProps(event, conf, {
993
+ "modelValue": formData.value[prop],
994
+ "onUpdate:modelValue": ($event) => formData.value[prop] = $event,
995
+ "placeholder": `请输入${label}`
996
+ }), _isSlot(renderChildComponent) ? renderChildComponent : {
997
+ default: () => [renderChildComponent]
228
998
  });
229
- }, n.utcOffset = function() {
230
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
231
- }, n.diff = function(t, r, e) {
232
- var i, u = this, o = a.p(r), c = f(t), h = (c.utcOffset() - this.utcOffset()) * Y, d = this - c, $ = function() {
233
- return a.m(u, c);
999
+ };
1000
+ const formItemSlots = (form2, scope) => {
1001
+ var _a;
1002
+ return form2.slotName && ((_a = slots[form2.slotName]) == null ? void 0 : _a.call(slots, scope));
1003
+ };
1004
+ const renderFormItem = (formList2) => {
1005
+ const renderForm = (form2) => {
1006
+ var _b;
1007
+ const _a = form2, {
1008
+ render: render3,
1009
+ config,
1010
+ renderType
1011
+ } = _a, formProps = __objRest(_a, [
1012
+ "render",
1013
+ "config",
1014
+ "renderType"
1015
+ ]);
1016
+ return createVNode(resolveComponent("el-form-item"), mergeProps({
1017
+ "class": `${formLayout === "vertical" ? "flex flex-col " : ""} ${(_b = form2.className) != null ? _b : ""}`
1018
+ }, formProps, {
1019
+ "prop": form2.prop,
1020
+ "labelWidth": formStyle.labelWidth
1021
+ }), {
1022
+ default: (scope) => {
1023
+ if (form2 == null ? void 0 : form2.render) return form2 == null ? void 0 : form2.render(formData.value);
1024
+ if (form2.renderType) return dynamicComponent(form2);
1025
+ return (form2 == null ? void 0 : form2.slotName) && formItemSlots(form2, scope);
1026
+ },
1027
+ label: () => createVNode("span", {
1028
+ "class": form2.className,
1029
+ "style": __spreadValues({}, form2.style)
1030
+ }, [form2.label])
1031
+ });
234
1032
  };
235
- switch (o) {
236
- case v:
237
- i = $() / 12;
238
- break;
239
- case m:
240
- i = $();
241
- break;
242
- case E:
243
- i = $() / 3;
244
- break;
245
- case x:
246
- i = (d - h) / 6048e5;
247
- break;
248
- case M:
249
- i = (d - h) / 864e5;
250
- break;
251
- case _:
252
- i = d / z;
253
- break;
254
- case b:
255
- i = d / Y;
256
- break;
257
- case w:
258
- i = d / A;
259
- break;
260
- default:
261
- i = d;
262
- }
263
- return e ? i : a.a(i);
264
- }, n.daysInMonth = function() {
265
- return this.endOf(m).$D;
266
- }, n.$locale = function() {
267
- return p[this.$L];
268
- }, n.locale = function(t, r) {
269
- if (!t)
270
- return this.$L;
271
- var e = this.clone(), i = C(t, r, !0);
272
- return i && (e.$L = i), e;
273
- }, n.clone = function() {
274
- return a.w(this.$d, this);
275
- }, n.toDate = function() {
276
- return new Date(this.valueOf());
277
- }, n.toJSON = function() {
278
- return this.isValid() ? this.toISOString() : null;
279
- }, n.toISOString = function() {
280
- return this.$d.toISOString();
281
- }, n.toString = function() {
282
- return this.$d.toUTCString();
283
- }, s;
284
- }(), P = L.prototype;
285
- return f.prototype = P, [["$ms", I], ["$s", w], ["$m", b], ["$H", _], ["$W", M], ["$M", m], ["$y", v], ["$D", O]].forEach(function(s) {
286
- P[s[1]] = function(n) {
287
- return this.$g(n, s[0], s[1]);
1033
+ return formList2.filter((form2) => !form2.show || form2.show(formData.value)).map((form2) => {
1034
+ if (form2.children && form2.children.length > 0) {
1035
+ return createVNode("div", {
1036
+ "class": "flex flex-col"
1037
+ }, [createVNode("span", null, [form2.groupName]), createVNode("div", {
1038
+ "class": "grid",
1039
+ "style": __spreadValues({}, getGroupStyle(form2 == null ? void 0 : form2.groupStyle))
1040
+ }, [form2.children.filter((form3) => !form3.show || form3.show(formData.value)).map((form3) => renderForm(form3))])]);
1041
+ } else {
1042
+ return renderForm(form2);
1043
+ }
1044
+ });
288
1045
  };
289
- }), f.extend = function(s, n) {
290
- return s.$i || (s(n, L, f), s.$i = !0), f;
291
- }, f.locale = C, f.isDayjs = N, f.unix = function(s) {
292
- return f(1e3 * s);
293
- }, f.en = p[k], f.Ls = p, f.p = {}, f;
294
- });
295
- })(q);
296
- var et = q.exports;
297
- const nt = /* @__PURE__ */ tt(et), V = R("");
298
- let U;
299
- const rt = () => {
300
- const y = () => {
301
- U = setTimeout(() => {
302
- V.value = nt().format("YYYY-MM-DD HH:mm:ss"), U && clearTimeout(U), y();
303
- }, 1e3);
304
- };
305
- return y(), { time: V };
306
- }, ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1046
+ return createVNode(Fragment, null, [createVNode(resolveComponent("el-form"), mergeProps({
1047
+ "scroll-to-error": true,
1048
+ "model": formData.value,
1049
+ "rules": formRules.value,
1050
+ "class": "grid",
1051
+ "ref": formRef
1052
+ }, attrs, {
1053
+ "style": __spreadValues({}, getFormStyle())
1054
+ }), _isSlot(_slot = renderFormItem(formList)) ? _slot : {
1055
+ default: () => [_slot]
1056
+ })]);
1057
+ };
1058
+ const formValidate = () => __async(this, null, function* () {
1059
+ return yield formRef.value.validate((valid) => valid ? true : false);
1060
+ });
1061
+ __expose({
1062
+ formData,
1063
+ formValidate
1064
+ });
1065
+ return (_ctx, _cache) => {
1066
+ return openBlock(), createBlock(resolveDynamicComponent(render2(props)));
1067
+ };
1068
+ }
1069
+ }));
1070
+ const components2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
307
1071
  __proto__: null,
308
- useTime: rt
1072
+ Toolbar,
1073
+ Update,
1074
+ YxDialog: _sfc_main$8,
1075
+ YxForm: form,
1076
+ YxFormV2: _sfc_main,
1077
+ YxIcon: index,
1078
+ YxSearchForm: index$1,
1079
+ YxTable: _sfc_main$6,
1080
+ YxUpload: _sfc_main$1
309
1081
  }, Symbol.toStringTag, { value: "Module" }));
310
1082
  export {
311
- X as c,
312
- tt as g,
313
- rt as u,
314
- ut as y
1083
+ Update as U,
1084
+ _sfc_main$8 as _,
1085
+ _sfc_main$6 as a,
1086
+ index as b,
1087
+ components2 as c,
1088
+ _sfc_main$1 as d,
1089
+ _sfc_main as e,
1090
+ form as f,
1091
+ index$1 as i
315
1092
  };