orion-design 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/README.md +5 -5
  2. package/dist/components/Form/FileInput/FileInput.vue.d.ts +1 -1
  3. package/dist/components/Form/Form.d.ts +3 -1
  4. package/dist/components/Form/Form.js.map +1 -1
  5. package/dist/components/Form/Form.vue.d.ts +6 -10
  6. package/dist/components/Form/hooks/useForm.d.ts +5 -1
  7. package/dist/components/Form/hooks/useForm.js +68 -30
  8. package/dist/components/Form/hooks/useForm.js.map +1 -1
  9. package/dist/components/Form/index.d.ts +11 -19
  10. package/dist/components/Form/index.js +285 -295
  11. package/dist/components/Form/index.js.map +1 -1
  12. package/dist/components/_util/arrays.js.map +1 -1
  13. package/dist/components/_util/browser.js.map +1 -1
  14. package/dist/components/_util/dom/aria.js.map +1 -1
  15. package/dist/components/_util/dom/element.js.map +1 -1
  16. package/dist/components/_util/dom/event.js.map +1 -1
  17. package/dist/components/_util/dom/position.js.map +1 -1
  18. package/dist/components/_util/dom/scroll.js.map +1 -1
  19. package/dist/components/_util/dom/style.js.map +1 -1
  20. package/dist/components/_util/easings.js.map +1 -1
  21. package/dist/components/_util/error.js.map +1 -1
  22. package/dist/components/_util/i18n.js.map +1 -1
  23. package/dist/components/_util/objects.js.map +1 -1
  24. package/dist/components/_util/raf.js.map +1 -1
  25. package/dist/components/_util/rand.js.map +1 -1
  26. package/dist/components/_util/strings.js.map +1 -1
  27. package/dist/components/_util/throttleByRaf.js.map +1 -1
  28. package/dist/components/_util/types.js.map +1 -1
  29. package/dist/components/_util/typescript.js.map +1 -1
  30. package/dist/components/_util/vue/global-node.js.map +1 -1
  31. package/dist/components/_util/vue/icon.js.map +1 -1
  32. package/dist/components/_util/vue/install.js.map +1 -1
  33. package/dist/components/_util/vue/props/runtime.js.map +1 -1
  34. package/dist/components/_util/vue/refs.js.map +1 -1
  35. package/dist/components/_util/vue/size.js.map +1 -1
  36. package/dist/components/_util/vue/validator.js.map +1 -1
  37. package/dist/components/_util/vue/vnode.js.map +1 -1
  38. package/dist/components/index.d.ts +1 -0
  39. package/dist/components/index.js.map +1 -1
  40. package/dist/version/version.d.ts +1 -1
  41. package/dist/version/version.js +1 -1
  42. package/dist/version/version.js.map +1 -1
  43. package/package.json +1 -1
@@ -1,59 +1,57 @@
1
- import { isString as G, isDate as P } from "lodash-es";
2
- import { defineComponent as y, mergeModels as j, useModel as I, useTemplateRef as $, provide as H, reactive as L, toRef as v, openBlock as m, createBlock as f, unref as e, withCtx as d, createVNode as h, renderSlot as M, computed as O, createElementBlock as C, Fragment as z, renderList as F, createTextVNode as N, toDisplayString as A, ref as K, onMounted as J, normalizeStyle as Q } from "vue";
3
- import { withInstall as X } from "../_util/vue/install.js";
4
- import { ElForm as Z, ElRow as x, ElCol as c, ElFormItem as w, ElInput as B, ElSelect as E, ElOption as U, ElRadioGroup as _, ElRadio as ee, ElCheckboxGroup as le, ElCheckbox as T, ElSwitch as ae, dayjs as R, ElTimePicker as oe, ElDatePicker as re } from "element-plus";
1
+ import { isString as H, isDate as j } from "lodash-es";
2
+ import { defineComponent as h, useTemplateRef as $, provide as L, reactive as N, toRef as B, openBlock as s, createBlock as p, unref as e, withCtx as u, createVNode as b, renderSlot as C, isRef as w, computed as S, createElementBlock as F, Fragment as z, renderList as M, createTextVNode as A, toDisplayString as K, watch as J, ref as Q, onMounted as X, normalizeStyle as Z } from "vue";
3
+ import { withInstall as x } from "../_util/vue/install.js";
4
+ import { ElForm as _, ElRow as ee, ElCol as c, ElFormItem as g, ElInput as q, ElSelect as E, ElOption as U, ElRadioGroup as le, ElRadio as ae, ElCheckboxGroup as oe, ElCheckbox as T, ElSwitch as re, dayjs as R, ElTimePicker as ne, ElDatePicker as de } from "element-plus";
5
5
  import { formContextKey as te } from "./Form.js";
6
- import { useFormSpan as g, useFormRules as V, useFormContext as S, useFormDisabled as Y, useFormCode as W } from "./hooks/useForm.js";
7
- import { getSingleCodeContent as ne, getMultiCodeContent as de } from "./utils/index.js";
6
+ import { useFormSpan as v, useFormRules as V, useFormDirectModel as O, useFormDisabled as Y, useFormCode as W, useFormMultiModel as G, useFormContext as P, useFormBooleanModel as I } from "./hooks/useForm.js";
7
+ import { getSingleCodeContent as ue, getMultiCodeContent as ie } from "./utils/index.js";
8
8
  import D from "../../error/OrionError.js";
9
- import { S as ue } from "../../index-BbsXWo7C.js";
10
- const ie = /* @__PURE__ */ y({
9
+ import { S as se } from "../../index-BbsXWo7C.js";
10
+ const me = /* @__PURE__ */ h({
11
11
  name: "OForm",
12
12
  __name: "Form",
13
- props: /* @__PURE__ */ j({
13
+ props: {
14
14
  rules: {},
15
15
  itemSpan: { default: 6 },
16
16
  itemLabelWidth: { default: "auto" },
17
- disabled: { type: Boolean, default: !1 }
18
- }, {
19
- modelValue: {},
20
- modelModifiers: {}
21
- }),
17
+ disabled: { type: Boolean, default: !1 },
18
+ modelValue: {}
19
+ },
22
20
  emits: ["update:modelValue"],
23
- setup(o, { expose: p }) {
24
- const i = I(o, "modelValue"), t = $("formRef");
25
- return p({
26
- validate: async () => await t.value.validate()
27
- }), H(
21
+ setup(o, { expose: m, emit: i }) {
22
+ const a = i, l = (d, f) => {
23
+ a("update:modelValue", { ...o.modelValue, [d]: f });
24
+ }, n = $("form");
25
+ return m({
26
+ validate: async () => await n.value.validate()
27
+ }), L(
28
28
  te,
29
- L({
30
- model: i.value,
31
- rules: v(() => o.rules),
32
- itemSpan: v(() => o.itemSpan),
33
- disabled: v(() => o.disabled)
29
+ N({
30
+ modelValue: B(() => o.modelValue),
31
+ updateModelValue: l,
32
+ rules: B(() => o.rules),
33
+ itemSpan: B(() => o.itemSpan),
34
+ disabled: B(() => o.disabled)
34
35
  })
35
- ), (l, u) => (m(), f(e(Z), {
36
- ref_key: "formRef",
37
- ref: t,
38
- modelValue: i.value,
39
- "onUpdate:modelValue": u[0] || (u[0] = (a) => i.value = a),
40
- model: i.value,
41
- rules: l.rules,
42
- "label-width": l.itemLabelWidth,
43
- disabled: l.disabled
36
+ ), (d, f) => (s(), p(e(_), {
37
+ ref: "form",
38
+ model: d.modelValue,
39
+ rules: d.rules,
40
+ "label-width": d.itemLabelWidth,
41
+ disabled: d.disabled
44
42
  }, {
45
- default: d(() => [
46
- h(e(x), { gutter: 16 }, {
47
- default: d(() => [
48
- M(l.$slots, "default")
43
+ default: u(() => [
44
+ b(e(ee), { gutter: 16 }, {
45
+ default: u(() => [
46
+ C(d.$slots, "default")
49
47
  ]),
50
48
  _: 3
51
49
  })
52
50
  ]),
53
51
  _: 3
54
- }, 8, ["modelValue", "model", "rules", "label-width", "disabled"]));
52
+ }, 8, ["model", "rules", "label-width", "disabled"]));
55
53
  }
56
- }), se = /* @__PURE__ */ y({
54
+ }), pe = /* @__PURE__ */ h({
57
55
  name: "OFormString",
58
56
  extendOptions: { trigger: "blur" },
59
57
  __name: "StringInput",
@@ -70,20 +68,20 @@ const ie = /* @__PURE__ */ y({
70
68
  readonly: { type: Boolean }
71
69
  },
72
70
  setup(o) {
73
- const p = g(), i = V(), t = S(), r = v(t.model, o.name);
74
- return (l, u) => (m(), f(e(c), { span: e(p) }, {
75
- default: d(() => [
76
- h(e(w), {
71
+ const m = v(), i = V(), a = O();
72
+ return (l, n) => (s(), p(e(c), { span: e(m) }, {
73
+ default: u(() => [
74
+ b(e(g), {
77
75
  prop: l.name,
78
76
  label: l.label,
79
77
  "label-width": l.labelWidth,
80
78
  required: l.required,
81
79
  rules: e(i)
82
80
  }, {
83
- default: d(() => [
84
- h(e(B), {
85
- modelValue: r.value,
86
- "onUpdate:modelValue": u[0] || (u[0] = (a) => r.value = a),
81
+ default: u(() => [
82
+ b(e(q), {
83
+ modelValue: e(a),
84
+ "onUpdate:modelValue": n[0] || (n[0] = (t) => w(a) ? a.value = t : null),
87
85
  maxlength: l.maxlength,
88
86
  placeholder: l.placeholder,
89
87
  disabled: l.disabled,
@@ -96,7 +94,7 @@ const ie = /* @__PURE__ */ y({
96
94
  _: 1
97
95
  }, 8, ["span"]));
98
96
  }
99
- }), me = /* @__PURE__ */ y({
97
+ }), be = /* @__PURE__ */ h({
100
98
  name: "OFormPassword",
101
99
  extendOptions: { trigger: "blur" },
102
100
  __name: "PasswordInput",
@@ -113,20 +111,20 @@ const ie = /* @__PURE__ */ y({
113
111
  readonly: { type: Boolean }
114
112
  },
115
113
  setup(o) {
116
- const p = g(), i = V(), t = S(), r = v(t.model, o.name);
117
- return (l, u) => (m(), f(e(c), { span: e(p) }, {
118
- default: d(() => [
119
- h(e(w), {
114
+ const m = v(), i = V(), a = O();
115
+ return (l, n) => (s(), p(e(c), { span: e(m) }, {
116
+ default: u(() => [
117
+ b(e(g), {
120
118
  prop: l.name,
121
119
  label: l.label,
122
120
  "label-width": l.labelWidth,
123
121
  required: l.required,
124
122
  rules: e(i)
125
123
  }, {
126
- default: d(() => [
127
- h(e(B), {
128
- modelValue: r.value,
129
- "onUpdate:modelValue": u[0] || (u[0] = (a) => r.value = a),
124
+ default: u(() => [
125
+ b(e(q), {
126
+ modelValue: e(a),
127
+ "onUpdate:modelValue": n[0] || (n[0] = (t) => w(a) ? a.value = t : null),
130
128
  maxlength: l.maxlength,
131
129
  placeholder: l.placeholder,
132
130
  disabled: l.disabled,
@@ -140,7 +138,7 @@ const ie = /* @__PURE__ */ y({
140
138
  _: 1
141
139
  }, 8, ["span"]));
142
140
  }
143
- }), pe = /* @__PURE__ */ y({
141
+ }), fe = /* @__PURE__ */ h({
144
142
  name: "OFormTextarea",
145
143
  extendOptions: { trigger: "blur" },
146
144
  __name: "Textarea",
@@ -158,20 +156,20 @@ const ie = /* @__PURE__ */ y({
158
156
  rows: {}
159
157
  },
160
158
  setup(o) {
161
- const p = g(), i = V(), t = S(), r = v(t.model, o.name);
162
- return (l, u) => (m(), f(e(c), { span: e(p) }, {
163
- default: d(() => [
164
- h(e(w), {
159
+ const m = v(), i = V(), a = O();
160
+ return (l, n) => (s(), p(e(c), { span: e(m) }, {
161
+ default: u(() => [
162
+ b(e(g), {
165
163
  prop: l.name,
166
164
  label: l.label,
167
165
  "label-width": l.labelWidth,
168
166
  required: l.required,
169
167
  rules: e(i)
170
168
  }, {
171
- default: d(() => [
172
- h(e(B), {
173
- modelValue: r.value,
174
- "onUpdate:modelValue": u[0] || (u[0] = (a) => r.value = a),
169
+ default: u(() => [
170
+ b(e(q), {
171
+ modelValue: e(a),
172
+ "onUpdate:modelValue": n[0] || (n[0] = (t) => w(a) ? a.value = t : null),
175
173
  maxlength: l.maxlength,
176
174
  placeholder: l.placeholder,
177
175
  disabled: l.disabled,
@@ -187,7 +185,7 @@ const ie = /* @__PURE__ */ y({
187
185
  _: 1
188
186
  }, 8, ["span"]));
189
187
  }
190
- }), be = /* @__PURE__ */ y({
188
+ }), he = /* @__PURE__ */ h({
191
189
  name: "OFormSingleselect",
192
190
  extendOptions: {},
193
191
  __name: "SingleSelect",
@@ -205,36 +203,36 @@ const ie = /* @__PURE__ */ y({
205
203
  filterable: { type: Boolean }
206
204
  },
207
205
  setup(o) {
208
- const p = g(), i = V(), t = Y(), r = W(), l = O(() => ne(r.value, a.value)), u = S(), a = v(u.model, o.name);
209
- return (s, b) => (m(), f(e(c), { span: e(p) }, {
210
- default: d(() => [
211
- h(e(w), {
212
- prop: s.name,
213
- label: s.label,
214
- "label-width": s.labelWidth,
215
- required: s.required,
206
+ const m = v(), i = V(), a = Y(), l = W(), n = O(), t = S(() => ue(l.value, n.value));
207
+ return (d, f) => (s(), p(e(c), { span: e(m) }, {
208
+ default: u(() => [
209
+ b(e(g), {
210
+ prop: d.name,
211
+ label: d.label,
212
+ "label-width": d.labelWidth,
213
+ required: d.required,
216
214
  rules: e(i)
217
215
  }, {
218
- default: d(() => [
219
- e(t) ? (m(), f(e(B), {
216
+ default: u(() => [
217
+ e(a) ? (s(), p(e(q), {
220
218
  key: 0,
221
- "model-value": l.value,
222
- placeholder: s.placeholder,
219
+ "model-value": t.value,
220
+ placeholder: d.placeholder,
223
221
  disabled: !0,
224
222
  readonly: !0
225
- }, null, 8, ["model-value", "placeholder"])) : (m(), f(e(E), {
223
+ }, null, 8, ["model-value", "placeholder"])) : (s(), p(e(E), {
226
224
  key: 1,
227
- modelValue: a.value,
228
- "onUpdate:modelValue": b[0] || (b[0] = (n) => a.value = n),
229
- placeholder: s.placeholder,
230
- clearable: s.clearable,
231
- filterable: s.filterable
225
+ modelValue: e(n),
226
+ "onUpdate:modelValue": f[0] || (f[0] = (r) => w(n) ? n.value = r : null),
227
+ placeholder: d.placeholder,
228
+ clearable: d.clearable,
229
+ filterable: d.filterable
232
230
  }, {
233
- default: d(() => [
234
- (m(!0), C(z, null, F(e(r), (n) => (m(), f(e(U), {
235
- key: n.value,
236
- label: n.content,
237
- value: n.value
231
+ default: u(() => [
232
+ (s(!0), F(z, null, M(e(l), (r) => (s(), p(e(U), {
233
+ key: r.value,
234
+ label: r.content,
235
+ value: r.value
238
236
  }, null, 8, ["label", "value"]))), 128))
239
237
  ]),
240
238
  _: 1
@@ -246,7 +244,7 @@ const ie = /* @__PURE__ */ y({
246
244
  _: 1
247
245
  }, 8, ["span"]));
248
246
  }
249
- }), fe = /* @__PURE__ */ y({
247
+ }), ye = /* @__PURE__ */ h({
250
248
  name: "OFormMultiselect",
251
249
  extendOptions: {},
252
250
  __name: "MultiSelect",
@@ -262,40 +260,37 @@ const ie = /* @__PURE__ */ y({
262
260
  code: {}
263
261
  },
264
262
  setup(o) {
265
- const p = g(), i = V(), t = Y(), r = W(), l = O(() => de(r.value, a.value)), u = S(), a = v(u.model, o.name), s = O({
266
- get: () => a.value ? a.value.split(",") : [],
267
- set: (b) => {
268
- b ? a.value = b.join(",") : a.value = "";
269
- }
270
- });
271
- return (b, n) => (m(), f(e(c), { span: e(p) }, {
272
- default: d(() => [
273
- h(e(w), {
274
- prop: b.name,
275
- label: b.label,
276
- "label-width": b.labelWidth,
277
- required: b.required,
263
+ const m = v(), i = V(), a = Y(), l = W(), n = G(), t = P(), d = S(
264
+ () => ie(l.value, t.modelValue[o.name])
265
+ );
266
+ return (f, r) => (s(), p(e(c), { span: e(m) }, {
267
+ default: u(() => [
268
+ b(e(g), {
269
+ prop: f.name,
270
+ label: f.label,
271
+ "label-width": f.labelWidth,
272
+ required: f.required,
278
273
  rules: e(i)
279
274
  }, {
280
- default: d(() => [
281
- e(t) ? (m(), f(e(B), {
275
+ default: u(() => [
276
+ e(a) ? (s(), p(e(q), {
282
277
  key: 0,
283
- "model-value": l.value,
284
- placeholder: b.placeholder,
278
+ "model-value": d.value,
279
+ placeholder: f.placeholder,
285
280
  disabled: !0,
286
281
  readonly: !0
287
- }, null, 8, ["model-value", "placeholder"])) : (m(), f(e(E), {
282
+ }, null, 8, ["model-value", "placeholder"])) : (s(), p(e(E), {
288
283
  key: 1,
289
- modelValue: s.value,
290
- "onUpdate:modelValue": n[0] || (n[0] = (q) => s.value = q),
291
- placeholder: b.placeholder,
284
+ modelValue: e(n),
285
+ "onUpdate:modelValue": r[0] || (r[0] = (y) => w(n) ? n.value = y : null),
286
+ placeholder: f.placeholder,
292
287
  multiple: ""
293
288
  }, {
294
- default: d(() => [
295
- (m(!0), C(z, null, F(e(r), (q) => (m(), f(e(U), {
296
- key: q.value,
297
- label: q.content,
298
- value: q.value
289
+ default: u(() => [
290
+ (s(!0), F(z, null, M(e(l), (y) => (s(), p(e(U), {
291
+ key: y.value,
292
+ label: y.content,
293
+ value: y.value
299
294
  }, null, 8, ["label", "value"]))), 128))
300
295
  ]),
301
296
  _: 1
@@ -307,7 +302,7 @@ const ie = /* @__PURE__ */ y({
307
302
  _: 1
308
303
  }, 8, ["span"]));
309
304
  }
310
- }), he = /* @__PURE__ */ y({
305
+ }), ce = /* @__PURE__ */ h({
311
306
  name: "OFormRadiogroup",
312
307
  extendOptions: {},
313
308
  __name: "RadioGroup",
@@ -322,29 +317,29 @@ const ie = /* @__PURE__ */ y({
322
317
  code: {}
323
318
  },
324
319
  setup(o) {
325
- const p = g(), i = V(), t = W(), r = S(), l = v(r.model, o.name);
326
- return (u, a) => (m(), f(e(c), { span: e(p) }, {
327
- default: d(() => [
328
- h(e(w), {
329
- prop: u.name,
330
- label: u.label,
331
- "label-width": u.labelWidth,
332
- required: u.required,
320
+ const m = v(), i = V(), a = W(), l = O();
321
+ return (n, t) => (s(), p(e(c), { span: e(m) }, {
322
+ default: u(() => [
323
+ b(e(g), {
324
+ prop: n.name,
325
+ label: n.label,
326
+ "label-width": n.labelWidth,
327
+ required: n.required,
333
328
  rules: e(i)
334
329
  }, {
335
- default: d(() => [
336
- h(e(_), {
337
- modelValue: l.value,
338
- "onUpdate:modelValue": a[0] || (a[0] = (s) => l.value = s),
339
- disabled: u.disabled
330
+ default: u(() => [
331
+ b(e(le), {
332
+ modelValue: e(l),
333
+ "onUpdate:modelValue": t[0] || (t[0] = (d) => w(l) ? l.value = d : null),
334
+ disabled: n.disabled
340
335
  }, {
341
- default: d(() => [
342
- (m(!0), C(z, null, F(e(t), (s) => (m(), f(e(ee), {
343
- key: s.value,
344
- value: s.value
336
+ default: u(() => [
337
+ (s(!0), F(z, null, M(e(a), (d) => (s(), p(e(ae), {
338
+ key: d.value,
339
+ value: d.value
345
340
  }, {
346
- default: d(() => [
347
- N(A(s.content), 1)
341
+ default: u(() => [
342
+ A(K(d.content), 1)
348
343
  ]),
349
344
  _: 2
350
345
  }, 1032, ["value"]))), 128))
@@ -358,7 +353,7 @@ const ie = /* @__PURE__ */ y({
358
353
  _: 1
359
354
  }, 8, ["span"]));
360
355
  }
361
- }), ve = /* @__PURE__ */ y({
356
+ }), ve = /* @__PURE__ */ h({
362
357
  name: "OFormCheckboxgroup",
363
358
  extendOptions: {},
364
359
  __name: "CheckboxGroup",
@@ -373,32 +368,27 @@ const ie = /* @__PURE__ */ y({
373
368
  code: {}
374
369
  },
375
370
  setup(o) {
376
- const p = g(), i = V(), t = W(), r = S(), l = v(r.model, o.name), u = O({
377
- get: () => l.value ? l.value.split(",") : [],
378
- set: (a) => {
379
- a ? l.value = a.join(",") : l.value = "";
380
- }
381
- });
382
- return (a, s) => (m(), f(e(c), { span: e(p) }, {
383
- default: d(() => [
384
- h(e(w), {
385
- prop: a.name,
386
- label: a.label,
387
- "label-width": a.labelWidth,
388
- required: a.required,
371
+ const m = v(), i = V(), a = W(), l = G();
372
+ return (n, t) => (s(), p(e(c), { span: e(m) }, {
373
+ default: u(() => [
374
+ b(e(g), {
375
+ prop: n.name,
376
+ label: n.label,
377
+ "label-width": n.labelWidth,
378
+ required: n.required,
389
379
  rules: e(i)
390
380
  }, {
391
- default: d(() => [
392
- h(e(le), {
393
- modelValue: u.value,
394
- "onUpdate:modelValue": s[0] || (s[0] = (b) => u.value = b),
395
- disabled: a.disabled
381
+ default: u(() => [
382
+ b(e(oe), {
383
+ modelValue: e(l),
384
+ "onUpdate:modelValue": t[0] || (t[0] = (d) => w(l) ? l.value = d : null),
385
+ disabled: n.disabled
396
386
  }, {
397
- default: d(() => [
398
- (m(!0), C(z, null, F(e(t), (b) => (m(), f(e(T), {
399
- key: b.value,
400
- label: b.content,
401
- value: b.value
387
+ default: u(() => [
388
+ (s(!0), F(z, null, M(e(a), (d) => (s(), p(e(T), {
389
+ key: d.value,
390
+ label: d.content,
391
+ value: d.value
402
392
  }, null, 8, ["label", "value"]))), 128))
403
393
  ]),
404
394
  _: 1
@@ -410,7 +400,7 @@ const ie = /* @__PURE__ */ y({
410
400
  _: 1
411
401
  }, 8, ["span"]));
412
402
  }
413
- }), ye = /* @__PURE__ */ y({
403
+ }), ge = /* @__PURE__ */ h({
414
404
  name: "OFormCheckbox",
415
405
  extendOptions: {},
416
406
  __name: "Checkbox",
@@ -423,22 +413,20 @@ const ie = /* @__PURE__ */ y({
423
413
  disabled: { type: Boolean }
424
414
  },
425
415
  setup(o) {
426
- const p = g(), i = S(), t = v(i.model, o.name);
427
- return (r, l) => (m(), f(e(c), { span: e(p) }, {
428
- default: d(() => [
429
- h(e(w), {
430
- prop: r.name,
431
- label: r.label,
432
- "label-width": r.labelWidth,
433
- rules: r.rules
416
+ const m = v(), i = I();
417
+ return (a, l) => (s(), p(e(c), { span: e(m) }, {
418
+ default: u(() => [
419
+ b(e(g), {
420
+ prop: a.name,
421
+ label: a.label,
422
+ "label-width": a.labelWidth,
423
+ rules: a.rules
434
424
  }, {
435
- default: d(() => [
436
- h(e(T), {
437
- modelValue: t.value,
438
- "onUpdate:modelValue": l[0] || (l[0] = (u) => t.value = u),
439
- disabled: r.disabled,
440
- "true-value": "1",
441
- "false-value": "0"
425
+ default: u(() => [
426
+ b(e(T), {
427
+ modelValue: e(i),
428
+ "onUpdate:modelValue": l[0] || (l[0] = (n) => w(i) ? i.value = n : null),
429
+ disabled: a.disabled
442
430
  }, null, 8, ["modelValue", "disabled"])
443
431
  ]),
444
432
  _: 1
@@ -447,7 +435,7 @@ const ie = /* @__PURE__ */ y({
447
435
  _: 1
448
436
  }, 8, ["span"]));
449
437
  }
450
- }), ce = /* @__PURE__ */ y({
438
+ }), Ve = /* @__PURE__ */ h({
451
439
  name: "OFormSwitch",
452
440
  extendOptions: {},
453
441
  __name: "Switch",
@@ -460,22 +448,20 @@ const ie = /* @__PURE__ */ y({
460
448
  disabled: { type: Boolean }
461
449
  },
462
450
  setup(o) {
463
- const p = g(), i = S(), t = v(i.model, o.name);
464
- return (r, l) => (m(), f(e(c), { span: e(p) }, {
465
- default: d(() => [
466
- h(e(w), {
467
- prop: r.name,
468
- label: r.label,
469
- "label-width": r.labelWidth,
470
- rules: r.rules
451
+ const m = v(), i = I();
452
+ return (a, l) => (s(), p(e(c), { span: e(m) }, {
453
+ default: u(() => [
454
+ b(e(g), {
455
+ prop: a.name,
456
+ label: a.label,
457
+ "label-width": a.labelWidth,
458
+ rules: a.rules
471
459
  }, {
472
- default: d(() => [
473
- h(e(ae), {
474
- modelValue: t.value,
475
- "onUpdate:modelValue": l[0] || (l[0] = (u) => t.value = u),
476
- disabled: r.disabled,
477
- "active-value": "1",
478
- "inactive-value": "0"
460
+ default: u(() => [
461
+ b(e(re), {
462
+ modelValue: e(i),
463
+ "onUpdate:modelValue": l[0] || (l[0] = (n) => w(i) ? i.value = n : null),
464
+ disabled: a.disabled
479
465
  }, null, 8, ["modelValue", "disabled"])
480
466
  ]),
481
467
  _: 1
@@ -484,7 +470,7 @@ const ie = /* @__PURE__ */ y({
484
470
  _: 1
485
471
  }, 8, ["span"]));
486
472
  }
487
- }), ge = /* @__PURE__ */ y({
473
+ }), we = /* @__PURE__ */ h({
488
474
  name: "OFormDate",
489
475
  extendOptions: { trigger: "blur" },
490
476
  __name: "DateInput",
@@ -505,67 +491,69 @@ const ie = /* @__PURE__ */ y({
505
491
  sourceFormat: {}
506
492
  },
507
493
  setup(o) {
508
- const p = g(), i = V(), t = O(
494
+ const m = v(), i = V(), a = S(
509
495
  () => o.format.startsWith("H") || o.format.startsWith("h") || o.format.startsWith("m") || o.format.startsWith("s")
510
- ), r = O(() => o.sourceFormat ? o.sourceFormat : t.value ? "HH:mm:ss" : "YYYY-MM-DD"), l = O(() => {
511
- let n = "date";
512
- return (o.format.indexOf("y") > -1 || o.format.indexOf("Y") > -1) && (n = "year"), o.format.indexOf("M") > -1 && (n = "month"), (o.format.indexOf("d") > -1 || o.format.indexOf("D") > -1) && (n = "date"), (o.format.indexOf("H") > -1 || o.format.indexOf("h") > -1 || o.format.indexOf("k") > -1 || o.format.indexOf("m") > -1 || o.format.indexOf("s") > -1 || o.format.indexOf("S") > -1) && (n = "datetime"), n;
513
- }), u = S(), a = v(u.model, o.name), s = O(() => {
514
- if (G(a.value))
496
+ ), l = S(() => o.sourceFormat ? o.sourceFormat : a.value ? "HH:mm:ss" : "YYYY-MM-DD"), n = S(() => {
497
+ let r = "date";
498
+ return (o.format.indexOf("y") > -1 || o.format.indexOf("Y") > -1) && (r = "year"), o.format.indexOf("M") > -1 && (r = "month"), (o.format.indexOf("d") > -1 || o.format.indexOf("D") > -1) && (r = "date"), (o.format.indexOf("H") > -1 || o.format.indexOf("h") > -1 || o.format.indexOf("k") > -1 || o.format.indexOf("m") > -1 || o.format.indexOf("s") > -1 || o.format.indexOf("S") > -1) && (r = "datetime"), r;
499
+ }), t = P(), d = S(() => {
500
+ const r = t.modelValue[o.name];
501
+ if (H(r))
515
502
  return "string";
516
- if (P(a.value))
503
+ if (j(r))
517
504
  return "date";
518
505
  throw new D("日期输入框的值只能为字符串或日期类型");
519
- }), b = O({
506
+ }), f = S({
520
507
  get: () => {
521
- if (a.value) {
522
- if (s.value == "date")
523
- return a.value;
508
+ const r = t.modelValue[o.name];
509
+ if (r) {
510
+ if (d.value == "date")
511
+ return r;
524
512
  {
525
- const n = R(a.value, r.value, !0);
526
- if (!n.isValid())
527
- throw new D(`日期输入框的值无效,不符合${r.value}格式`);
528
- return n.toDate();
513
+ const y = R(r, l.value, !0);
514
+ if (!y.isValid())
515
+ throw new D(`日期输入框的值无效,不符合${l.value}格式`);
516
+ return y.toDate();
529
517
  }
530
518
  }
531
519
  },
532
- set: (n) => {
533
- s.value == "date" ? n ? a.value = n : a.value = void 0 : n ? a.value = R(n).format(r.value) : a.value = "";
520
+ set: (r) => {
521
+ d.value == "date" ? r ? t.updateModelValue(o.name, r) : t.updateModelValue(o.name, void 0) : r ? t.updateModelValue(o.name, R(r).format(l.value)) : t.updateModelValue(o.name, "");
534
522
  }
535
523
  });
536
- return (n, q) => (m(), f(e(c), { span: e(p) }, {
537
- default: d(() => [
538
- h(e(w), {
539
- prop: n.name,
540
- label: n.label,
541
- "label-width": n.labelWidth,
542
- required: n.required,
524
+ return (r, y) => (s(), p(e(c), { span: e(m) }, {
525
+ default: u(() => [
526
+ b(e(g), {
527
+ prop: r.name,
528
+ label: r.label,
529
+ "label-width": r.labelWidth,
530
+ required: r.required,
543
531
  rules: e(i)
544
532
  }, {
545
- default: d(() => [
546
- t.value ? (m(), f(e(oe), {
533
+ default: u(() => [
534
+ a.value ? (s(), p(e(ne), {
547
535
  key: 0,
548
- modelValue: b.value,
549
- "onUpdate:modelValue": q[0] || (q[0] = (k) => b.value = k),
550
- placeholder: n.placeholder,
551
- disabled: n.disabled,
552
- readonly: n.readonly,
553
- editable: n.editable,
554
- clearable: n.clearable,
555
- format: r.value,
536
+ modelValue: f.value,
537
+ "onUpdate:modelValue": y[0] || (y[0] = (k) => f.value = k),
538
+ placeholder: r.placeholder,
539
+ disabled: r.disabled,
540
+ readonly: r.readonly,
541
+ editable: r.editable,
542
+ clearable: r.clearable,
543
+ format: l.value,
556
544
  "arrow-control": "",
557
545
  style: { width: "100%" }
558
- }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "editable", "clearable", "format"])) : (m(), f(e(re), {
546
+ }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "editable", "clearable", "format"])) : (s(), p(e(de), {
559
547
  key: 1,
560
- modelValue: b.value,
561
- "onUpdate:modelValue": q[1] || (q[1] = (k) => b.value = k),
562
- placeholder: n.placeholder,
563
- disabled: n.disabled,
564
- readonly: n.readonly,
565
- editable: n.editable,
566
- clearable: n.clearable,
567
- type: l.value,
568
- format: r.value,
548
+ modelValue: f.value,
549
+ "onUpdate:modelValue": y[1] || (y[1] = (k) => f.value = k),
550
+ placeholder: r.placeholder,
551
+ disabled: r.disabled,
552
+ readonly: r.readonly,
553
+ editable: r.editable,
554
+ clearable: r.clearable,
555
+ type: n.value,
556
+ format: l.value,
569
557
  style: { width: "100%" }
570
558
  }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "editable", "clearable", "type", "format"]))
571
559
  ]),
@@ -575,7 +563,7 @@ const ie = /* @__PURE__ */ y({
575
563
  _: 1
576
564
  }, 8, ["span"]));
577
565
  }
578
- }), we = /* @__PURE__ */ y({
566
+ }), Se = /* @__PURE__ */ h({
579
567
  name: "OFormFile",
580
568
  extendOptions: {},
581
569
  __name: "FileInput",
@@ -589,31 +577,33 @@ const ie = /* @__PURE__ */ y({
589
577
  disabled: { type: Boolean }
590
578
  },
591
579
  setup(o) {
592
- const p = g(), i = V(), t = K(""), r = $("fileRef");
593
- J(() => {
594
- r.value.input.onchange = (a) => {
595
- var s;
596
- u.value = (s = a == null ? void 0 : a.target) == null ? void 0 : s.files[0];
597
- };
580
+ const m = v(), i = V(), a = O();
581
+ J(a, () => {
582
+ a.value || (l.value = "");
598
583
  });
599
- const l = S(), u = v(l.model, o.name);
600
- return (a, s) => (m(), f(e(c), { span: e(p) }, {
601
- default: d(() => [
602
- h(e(w), {
603
- prop: a.name,
604
- label: a.label,
605
- "label-width": a.labelWidth,
606
- required: a.required,
584
+ const l = Q(""), n = $("inputRef");
585
+ return X(() => {
586
+ n.value.input.onchange = (t) => {
587
+ var d;
588
+ a.value = (d = t == null ? void 0 : t.target) == null ? void 0 : d.files[0];
589
+ }, l.value = "";
590
+ }), (t, d) => (s(), p(e(c), { span: e(m) }, {
591
+ default: u(() => [
592
+ b(e(g), {
593
+ prop: t.name,
594
+ label: t.label,
595
+ "label-width": t.labelWidth,
596
+ required: t.required,
607
597
  rules: e(i)
608
598
  }, {
609
- default: d(() => [
610
- h(e(B), {
611
- ref_key: "fileRef",
612
- ref: r,
613
- modelValue: t.value,
614
- "onUpdate:modelValue": s[0] || (s[0] = (b) => t.value = b),
615
- disabled: a.disabled,
616
- type: "file"
599
+ default: u(() => [
600
+ b(e(q), {
601
+ ref: "inputRef",
602
+ modelValue: l.value,
603
+ "onUpdate:modelValue": d[0] || (d[0] = (f) => l.value = f),
604
+ disabled: t.disabled,
605
+ type: "file",
606
+ "validate-event": !1
617
607
  }, null, 8, ["modelValue", "disabled"])
618
608
  ]),
619
609
  _: 1
@@ -622,7 +612,7 @@ const ie = /* @__PURE__ */ y({
622
612
  _: 1
623
613
  }, 8, ["span"]));
624
614
  }
625
- }), Se = /* @__PURE__ */ y({
615
+ }), qe = /* @__PURE__ */ h({
626
616
  name: "OFormButtongroup",
627
617
  __name: "ButtonGroup",
628
618
  props: {
@@ -631,20 +621,20 @@ const ie = /* @__PURE__ */ y({
631
621
  align: { default: "right" }
632
622
  },
633
623
  setup(o) {
634
- const p = O(() => ({
624
+ const m = S(() => ({
635
625
  textAlign: o.align
636
- })), i = g();
637
- return (t, r) => (m(), f(e(c), {
626
+ })), i = v();
627
+ return (a, l) => (s(), p(e(c), {
638
628
  span: e(i),
639
- style: Q(p.value)
629
+ style: Z(m.value)
640
630
  }, {
641
- default: d(() => [
642
- h(e(ue), {
643
- gutter: t.gutter,
631
+ default: u(() => [
632
+ b(e(se), {
633
+ gutter: a.gutter,
644
634
  style: { "margin-bottom": "18px" }
645
635
  }, {
646
- default: d(() => [
647
- M(t.$slots, "default")
636
+ default: u(() => [
637
+ C(a.$slots, "default")
648
638
  ]),
649
639
  _: 3
650
640
  }, 8, ["gutter"])
@@ -652,7 +642,7 @@ const ie = /* @__PURE__ */ y({
652
642
  _: 3
653
643
  }, 8, ["span", "style"]));
654
644
  }
655
- }), qe = /* @__PURE__ */ y({
645
+ }), Oe = /* @__PURE__ */ h({
656
646
  name: "OFormDiy",
657
647
  extendOptions: {},
658
648
  __name: "DiyItem",
@@ -665,18 +655,18 @@ const ie = /* @__PURE__ */ y({
665
655
  rules: {}
666
656
  },
667
657
  setup(o) {
668
- const p = g(), i = V();
669
- return (t, r) => (m(), f(e(c), { span: e(p) }, {
670
- default: d(() => [
671
- h(e(w), {
672
- prop: t.name,
673
- label: t.label,
674
- "label-width": t.labelWidth,
675
- required: t.required,
658
+ const m = v(), i = V();
659
+ return (a, l) => (s(), p(e(c), { span: e(m) }, {
660
+ default: u(() => [
661
+ b(e(g), {
662
+ prop: a.name,
663
+ label: a.label,
664
+ "label-width": a.labelWidth,
665
+ required: a.required,
676
666
  rules: e(i)
677
667
  }, {
678
- default: d(() => [
679
- M(t.$slots, "default")
668
+ default: u(() => [
669
+ C(a.$slots, "default")
680
670
  ]),
681
671
  _: 3
682
672
  }, 8, ["prop", "label", "label-width", "required", "rules"])
@@ -684,23 +674,23 @@ const ie = /* @__PURE__ */ y({
684
674
  _: 3
685
675
  }, 8, ["span"]));
686
676
  }
687
- }), Re = X(ie, {
688
- StringInput: se,
689
- PasswordInput: me,
690
- Textarea: pe,
691
- SingleSelect: be,
692
- MultiSelect: fe,
693
- RadioGroup: he,
677
+ }), $e = x(me, {
678
+ StringInput: pe,
679
+ PasswordInput: be,
680
+ Textarea: fe,
681
+ SingleSelect: he,
682
+ MultiSelect: ye,
683
+ RadioGroup: ce,
694
684
  CheckboxGroup: ve,
695
- Checkbox: ye,
696
- Switch: ce,
697
- DateInput: ge,
698
- FileInput: we,
699
- ButtonGroup: Se,
700
- DiyItem: qe
685
+ Checkbox: ge,
686
+ Switch: Ve,
687
+ DateInput: we,
688
+ FileInput: Se,
689
+ ButtonGroup: qe,
690
+ DiyItem: Oe
701
691
  });
702
692
  export {
703
- Re as default,
693
+ $e as default,
704
694
  te as formContextKey
705
695
  };
706
696
  //# sourceMappingURL=index.js.map