yxuse 3.0.38 → 3.0.40

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