orion-design 0.1.6 → 0.1.8

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