orion-design 0.1.30 → 0.1.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. package/README.md +5 -5
  2. package/dist/Throne/index.js +30 -14
  3. package/dist/Throne/index.js.map +1 -1
  4. package/dist/_commonjsHelpers-DWwsNxpa.js +9 -0
  5. package/dist/_commonjsHelpers-DWwsNxpa.js.map +1 -0
  6. package/dist/components/Button/index.js +40 -33
  7. package/dist/components/Button/index.js.map +1 -1
  8. package/dist/components/Flex/index.js +122 -89
  9. package/dist/components/Flex/index.js.map +1 -1
  10. package/dist/components/Form/Form.js +2 -2
  11. package/dist/components/Form/Form.js.map +1 -1
  12. package/dist/components/Form/LovInput/LovInput.js +2 -2
  13. package/dist/components/Form/LovInput/LovInput.js.map +1 -1
  14. package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
  15. package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
  16. package/dist/components/Form/LovInput/index.js +4 -4
  17. package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
  18. package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
  19. package/dist/components/Form/hooks/index.js +128 -66
  20. package/dist/components/Form/hooks/index.js.map +1 -1
  21. package/dist/components/Form/index.js +836 -656
  22. package/dist/components/Form/index.js.map +1 -1
  23. package/dist/components/Form/utils/index.js +30 -18
  24. package/dist/components/Form/utils/index.js.map +1 -1
  25. package/dist/components/LovTable/index.js +179 -105
  26. package/dist/components/LovTable/index.js.map +1 -1
  27. package/dist/components/Modal/index.js +111 -56
  28. package/dist/components/Modal/index.js.map +1 -1
  29. package/dist/components/Modal/types.js +4 -3
  30. package/dist/components/Modal/types.js.map +1 -1
  31. package/dist/components/Modal/useModal.js +5 -5
  32. package/dist/components/Modal/useModal.js.map +1 -1
  33. package/dist/components/Pagetable/hooks/useColumns.js +88 -80
  34. package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
  35. package/dist/components/Pagetable/index.js +687 -542
  36. package/dist/components/Pagetable/index.js.map +1 -1
  37. package/dist/components/Pagetable/utils/index.js +92 -54
  38. package/dist/components/Pagetable/utils/index.js.map +1 -1
  39. package/dist/components/Querytable/hooks/useColumns.js +82 -74
  40. package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
  41. package/dist/components/Querytable/index.js +579 -469
  42. package/dist/components/Querytable/index.js.map +1 -1
  43. package/dist/components/Querytable/utils/index.js +92 -54
  44. package/dist/components/Querytable/utils/index.js.map +1 -1
  45. package/dist/components/RichTextEditor/index.js +100 -74
  46. package/dist/components/RichTextEditor/index.js.map +1 -1
  47. package/dist/components/Tabs/constants.js +2 -2
  48. package/dist/components/Tabs/constants.js.map +1 -1
  49. package/dist/components/Tabs/index.js +603 -358
  50. package/dist/components/Tabs/index.js.map +1 -1
  51. package/dist/components/Tabs/tab-bar.js +6 -6
  52. package/dist/components/Tabs/tab-bar.js.map +1 -1
  53. package/dist/components/Tabs/tab-pane.js +3 -3
  54. package/dist/components/Tabs/tab-pane.js.map +1 -1
  55. package/dist/components/_constants/aria.js +2 -2
  56. package/dist/components/_constants/aria.js.map +1 -1
  57. package/dist/components/_constants/event.js +6 -4
  58. package/dist/components/_constants/event.js.map +1 -1
  59. package/dist/components/_constants/index.js +6 -6
  60. package/dist/components/_hooks/index.js +7 -7
  61. package/dist/components/_hooks/use-namespace/index.js +74 -39
  62. package/dist/components/_hooks/use-namespace/index.js.map +1 -1
  63. package/dist/components/_hooks/use-ordered-children/index.js +29 -19
  64. package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
  65. package/dist/components/_util/arrays.js +9 -5
  66. package/dist/components/_util/arrays.js.map +1 -1
  67. package/dist/components/_util/browser.js +6 -6
  68. package/dist/components/_util/browser.js.map +1 -1
  69. package/dist/components/_util/classNames.js +22 -17
  70. package/dist/components/_util/classNames.js.map +1 -1
  71. package/dist/components/_util/dom/aria.js +74 -39
  72. package/dist/components/_util/dom/aria.js.map +1 -1
  73. package/dist/components/_util/dom/element.js +9 -8
  74. package/dist/components/_util/dom/element.js.map +1 -1
  75. package/dist/components/_util/dom/event.js +14 -7
  76. package/dist/components/_util/dom/event.js.map +1 -1
  77. package/dist/components/_util/dom/index.js +36 -36
  78. package/dist/components/_util/dom/position.js +49 -25
  79. package/dist/components/_util/dom/position.js.map +1 -1
  80. package/dist/components/_util/dom/scroll.js +103 -61
  81. package/dist/components/_util/dom/scroll.js.map +1 -1
  82. package/dist/components/_util/dom/style.js +65 -50
  83. package/dist/components/_util/dom/style.js.map +1 -1
  84. package/dist/components/_util/easings.js +8 -4
  85. package/dist/components/_util/easings.js.map +1 -1
  86. package/dist/components/_util/error.js +12 -11
  87. package/dist/components/_util/error.js.map +1 -1
  88. package/dist/components/_util/functions.js +3 -3
  89. package/dist/components/_util/i18n.js +2 -2
  90. package/dist/components/_util/i18n.js.map +1 -1
  91. package/dist/components/_util/index.js +137 -137
  92. package/dist/components/_util/isValid.js +4 -2
  93. package/dist/components/_util/isValid.js.map +1 -1
  94. package/dist/components/_util/objects.js +18 -14
  95. package/dist/components/_util/objects.js.map +1 -1
  96. package/dist/components/_util/props-util/index.js +46 -20
  97. package/dist/components/_util/props-util/index.js.map +1 -1
  98. package/dist/components/_util/props-util/initDefaultProps.js +18 -10
  99. package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
  100. package/dist/components/_util/raf.js +5 -4
  101. package/dist/components/_util/raf.js.map +1 -1
  102. package/dist/components/_util/rand.js +4 -3
  103. package/dist/components/_util/rand.js.map +1 -1
  104. package/dist/components/_util/strings.js +9 -8
  105. package/dist/components/_util/strings.js.map +1 -1
  106. package/dist/components/_util/throttleByRaf.js +16 -10
  107. package/dist/components/_util/throttleByRaf.js.map +1 -1
  108. package/dist/components/_util/type.js +41 -38
  109. package/dist/components/_util/type.js.map +1 -1
  110. package/dist/components/_util/types.js +41 -22
  111. package/dist/components/_util/types.js.map +1 -1
  112. package/dist/components/_util/typescript.js +2 -2
  113. package/dist/components/_util/typescript.js.map +1 -1
  114. package/dist/components/_util/util.js +85 -43
  115. package/dist/components/_util/util.js.map +1 -1
  116. package/dist/components/_util/vue/global-node.js +27 -15
  117. package/dist/components/_util/vue/global-node.js.map +1 -1
  118. package/dist/components/_util/vue/icon.js +29 -25
  119. package/dist/components/_util/vue/icon.js.map +1 -1
  120. package/dist/components/_util/vue/index.js +41 -41
  121. package/dist/components/_util/vue/install.js +35 -18
  122. package/dist/components/_util/vue/install.js.map +1 -1
  123. package/dist/components/_util/vue/props/index.js +6 -6
  124. package/dist/components/_util/vue/props/runtime.js +46 -30
  125. package/dist/components/_util/vue/props/runtime.js.map +1 -1
  126. package/dist/components/_util/vue/refs.js +12 -6
  127. package/dist/components/_util/vue/refs.js.map +1 -1
  128. package/dist/components/_util/vue/size.js +5 -3
  129. package/dist/components/_util/vue/size.js.map +1 -1
  130. package/dist/components/_util/vue/validator.js +5 -4
  131. package/dist/components/_util/vue/validator.js.map +1 -1
  132. package/dist/components/_util/vue/vnode.js +100 -54
  133. package/dist/components/_util/vue/vnode.js.map +1 -1
  134. package/dist/components/_util/vue-types/index.js +231 -220
  135. package/dist/components/_util/vue-types/index.js.map +1 -1
  136. package/dist/components/components.js +20 -20
  137. package/dist/components/index.js +38 -35
  138. package/dist/components/index.js.map +1 -1
  139. package/dist/components-B3d9m_tn.js +27 -0
  140. package/dist/components-B3d9m_tn.js.map +1 -0
  141. package/dist/error/OrionError.js +8 -4
  142. package/dist/error/OrionError.js.map +1 -1
  143. package/dist/functions-BeMkokbY.js +63 -0
  144. package/dist/functions-BeMkokbY.js.map +1 -0
  145. package/dist/index-BOKLZnqH.js +54 -0
  146. package/dist/index-BOKLZnqH.js.map +1 -0
  147. package/dist/index-D1m0KTpK.js +69 -0
  148. package/dist/index-D1m0KTpK.js.map +1 -0
  149. package/dist/index-DR5ZP7mD.js +160 -0
  150. package/dist/index-DR5ZP7mD.js.map +1 -0
  151. package/dist/index-DkwIULcN.js +200 -0
  152. package/dist/index-DkwIULcN.js.map +1 -0
  153. package/dist/index.css +797 -1
  154. package/dist/index.js +36 -36
  155. package/dist/print/LodopFuncs.js +101 -43
  156. package/dist/print/LodopFuncs.js.map +1 -1
  157. package/dist/print/index.js +200 -108
  158. package/dist/print/index.js.map +1 -1
  159. package/dist/request/ErrorHandlerChain.js +17 -14
  160. package/dist/request/ErrorHandlerChain.js.map +1 -1
  161. package/dist/request/RequestFilterChain.js +16 -13
  162. package/dist/request/RequestFilterChain.js.map +1 -1
  163. package/dist/request/ResponseParserChain.js +17 -14
  164. package/dist/request/ResponseParserChain.js.map +1 -1
  165. package/dist/request/disivion/DateSerializer.js +47 -22
  166. package/dist/request/disivion/DateSerializer.js.map +1 -1
  167. package/dist/request/disivion/DivisionErrorHandler.js +40 -25
  168. package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
  169. package/dist/request/disivion/DivisionResponseParser.js +16 -10
  170. package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
  171. package/dist/request/disivion/index.js +305 -201
  172. package/dist/request/disivion/index.js.map +1 -1
  173. package/dist/request/error/BizExceptionResponseError.js +11 -5
  174. package/dist/request/error/BizExceptionResponseError.js.map +1 -1
  175. package/dist/request/error/ExceptionResponseError.js +11 -5
  176. package/dist/request/error/ExceptionResponseError.js.map +1 -1
  177. package/dist/request/error/ResponseError.js +9 -4
  178. package/dist/request/error/ResponseError.js.map +1 -1
  179. package/dist/request/error/SessionExceptionResponseError.js +11 -5
  180. package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
  181. package/dist/request/index.js +11 -11
  182. package/dist/utils/DateUtil.js +48 -33
  183. package/dist/utils/DateUtil.js.map +1 -1
  184. package/dist/utils/NumberUtil.js +6 -6
  185. package/dist/utils/NumberUtil.js.map +1 -1
  186. package/dist/utils/cloneDeep.js +2 -2
  187. package/dist/utils/delay.js +3 -3
  188. package/dist/utils/delay.js.map +1 -1
  189. package/dist/utils/functions.js +3 -3
  190. package/dist/utils/index.js +12 -12
  191. package/dist/utils/md5.js +191 -93
  192. package/dist/utils/md5.js.map +1 -1
  193. package/dist/utils/uuid.js +35 -25
  194. package/dist/utils/uuid.js.map +1 -1
  195. package/dist/version/index.js +2 -2
  196. package/dist/version/version.d.ts +1 -1
  197. package/dist/version/version.js +2 -2
  198. package/dist/version/version.js.map +1 -1
  199. package/package.json +1 -1
@@ -1,71 +1,84 @@
1
- import { difference as oe, isEmpty as re, isDate as te, isString as A, isNumber as ne, toNumber as de } from "lodash-es";
2
- import { defineComponent as y, useTemplateRef as Y, provide as L, reactive as j, toRef as R, openBlock as p, createBlock as h, unref as e, withCtx as d, createVNode as f, renderSlot as $, isRef as q, useAttrs as H, computed as F, createElementBlock as D, Fragment as E, renderList as I, createTextVNode as ue, toDisplayString as se, watch as ie, ref as P, onMounted as pe, normalizeStyle as me } from "vue";
3
- import { withInstall as be } from "../_util/vue/install.js";
4
- import { ElForm as fe, ElRow as he, ElCol as g, ElFormItem as w, ElInput as O, ElSelect as K, ElOption as J, ElRadioGroup as ce, ElRadio as ye, ElCheckboxGroup as ge, ElCheckbox as Q, ElSwitch as ve, dayjs as G, ElTimePicker as we, ElDatePicker as Ve, ElDropdown as Se, ElInputNumber as qe } from "element-plus";
5
- import { formContextKey as Be } from "./Form.js";
6
- import W from "../../error/OrionError.js";
7
- import { useFormItemSpan as v, useFormItemRules as V, useFormItemStringModel as z, useFormItemDisabled as X, useFormItemCode as U, useFormItemMultiModel as Z, useFormContext as T, useFormItemBooleanModel as x } from "./hooks/index.js";
8
- import { getSingleCodeContent as Me, getMultiCodeContent as Ce } from "./utils/index.js";
9
- import { S as Fe } from "../../index-BbsXWo7C.js";
10
- import { g as Oe } from "../../index-C6P_0wAy.js";
11
- import { lovContextKey as ze } from "./LovInput/LovInput.js";
12
- import { default as dl } from "./LovInput/hooks/useLov.js";
13
- const We = /* @__PURE__ */ y({
14
- name: "OForm",
15
- inheritAttrs: !1,
1
+ import { difference, isEmpty, isDate, isString, isNumber, toNumber } from "lodash-es";
2
+ import { defineComponent, useTemplateRef, provide, reactive, toRef, openBlock, createBlock, unref, withCtx, createVNode, renderSlot, isRef, useAttrs, computed, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, watch, ref, onMounted, normalizeStyle } from "vue";
3
+ import { withInstall } from "../_util/vue/install.js";
4
+ import { ElForm, ElRow, ElCol, ElFormItem, ElInput, ElSelect, ElOption, ElRadioGroup, ElRadio, ElCheckboxGroup, ElCheckbox, ElSwitch, dayjs, ElTimePicker, ElDatePicker, ElDropdown, ElInputNumber } from "element-plus";
5
+ import { formContextKey } from "./Form.js";
6
+ import OrionError from "../../error/OrionError.js";
7
+ import { useFormItemSpan, useFormItemRules, useFormItemStringModel, useFormItemDisabled, useFormItemCode, useFormItemMultiModel, useFormContext, useFormItemBooleanModel } from "./hooks/index.js";
8
+ import { getSingleCodeContent, getMultiCodeContent } from "./utils/index.js";
9
+ import { S as Space } from "../../index-BOKLZnqH.js";
10
+ import { g as search_default } from "../../index-DkwIULcN.js";
11
+ import { lovContextKey } from "./LovInput/LovInput.js";
12
+ import { default as default2 } from "./LovInput/hooks/useLov.js";
13
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
14
+ ...{ name: "OForm", inheritAttrs: false },
16
15
  __name: "Form",
17
16
  props: {
18
17
  rules: {},
19
18
  itemSpan: { default: 6 },
20
19
  itemLabelWidth: { default: "auto" },
21
- disabled: { type: Boolean, default: !1 },
20
+ disabled: { type: Boolean, default: false },
22
21
  modelValue: {}
23
22
  },
24
23
  emits: ["update:modelValue"],
25
- setup(t, { expose: i, emit: u }) {
26
- const o = u, l = (r, m) => {
27
- if (!Object.keys(t.modelValue).includes(r))
28
- throw new W(`modelValue中不存在[${r}]`);
29
- o("update:modelValue", { ...t.modelValue, [r]: m });
30
- }, a = (r) => {
31
- const m = Object.keys(t.modelValue), c = Object.keys(r), S = oe(c, m);
32
- if (!re(S))
33
- throw new W(`modelValue中不存在[${S.join(",")}]`);
34
- o("update:modelValue", { ...t.modelValue, ...r });
35
- }, n = Y("form");
36
- return i({
37
- validate: async () => await n.value.validate()
38
- }), L(
39
- Be,
40
- j({
41
- modelValue: R(() => t.modelValue),
42
- updateModelValue: l,
43
- updateModelValueMulti: a,
44
- rules: R(() => t.rules),
45
- itemSpan: R(() => t.itemSpan),
46
- disabled: R(() => t.disabled)
24
+ setup(__props, { expose: __expose, emit: __emit }) {
25
+ const emit = __emit;
26
+ const updateModelValue = (name, value) => {
27
+ if (!Object.keys(__props.modelValue).includes(name)) {
28
+ throw new OrionError(`modelValue中不存在[${name}]`);
29
+ }
30
+ emit("update:modelValue", { ...__props.modelValue, [name]: value });
31
+ };
32
+ const updateModelValueMulti = (data) => {
33
+ const modelKeys = Object.keys(__props.modelValue);
34
+ const dataKeys = Object.keys(data);
35
+ const diff = difference(dataKeys, modelKeys);
36
+ if (!isEmpty(diff)) {
37
+ throw new OrionError(`modelValue中不存在[${diff.join(",")}]`);
38
+ }
39
+ emit("update:modelValue", { ...__props.modelValue, ...data });
40
+ };
41
+ const formRef = useTemplateRef("form");
42
+ const validate = async () => {
43
+ return await formRef.value.validate();
44
+ };
45
+ __expose({
46
+ validate
47
+ });
48
+ provide(
49
+ formContextKey,
50
+ reactive({
51
+ modelValue: toRef(() => __props.modelValue),
52
+ updateModelValue,
53
+ updateModelValueMulti,
54
+ rules: toRef(() => __props.rules),
55
+ itemSpan: toRef(() => __props.itemSpan),
56
+ disabled: toRef(() => __props.disabled)
47
57
  })
48
- ), (r, m) => (p(), h(e(fe), {
49
- ref: "form",
50
- model: r.modelValue,
51
- rules: r.rules,
52
- "label-width": r.itemLabelWidth,
53
- disabled: r.disabled
54
- }, {
55
- default: d(() => [
56
- f(e(he), { gutter: 16 }, {
57
- default: d(() => [
58
- $(r.$slots, "default")
59
- ]),
60
- _: 3
61
- })
62
- ]),
63
- _: 3
64
- }, 8, ["model", "rules", "label-width", "disabled"]));
58
+ );
59
+ return (_ctx, _cache) => {
60
+ return openBlock(), createBlock(unref(ElForm), {
61
+ ref: "form",
62
+ model: _ctx.modelValue,
63
+ rules: _ctx.rules,
64
+ "label-width": _ctx.itemLabelWidth,
65
+ disabled: _ctx.disabled
66
+ }, {
67
+ default: withCtx(() => [
68
+ createVNode(unref(ElRow), { gutter: 16 }, {
69
+ default: withCtx(() => [
70
+ renderSlot(_ctx.$slots, "default")
71
+ ]),
72
+ _: 3
73
+ })
74
+ ]),
75
+ _: 3
76
+ }, 8, ["model", "rules", "label-width", "disabled"]);
77
+ };
65
78
  }
66
- }), ke = /* @__PURE__ */ y({
67
- name: "OFormString",
68
- inheritAttrs: !1,
79
+ });
80
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
81
+ ...{ name: "OFormString", inheritAttrs: false },
69
82
  __name: "StringInput",
70
83
  props: {
71
84
  name: {},
@@ -79,36 +92,40 @@ const We = /* @__PURE__ */ y({
79
92
  disabled: { type: Boolean },
80
93
  readonly: { type: Boolean }
81
94
  },
82
- setup(t) {
83
- const i = v(), u = V(), o = z();
84
- return (l, a) => (p(), h(e(g), { span: e(i) }, {
85
- default: d(() => [
86
- f(e(w), {
87
- prop: l.name,
88
- label: l.label,
89
- "label-width": l.labelWidth,
90
- required: l.required,
91
- rules: e(u)
92
- }, {
93
- default: d(() => [
94
- f(e(O), {
95
- modelValue: e(o),
96
- "onUpdate:modelValue": a[0] || (a[0] = (n) => q(o) ? o.value = n : null),
97
- maxlength: l.maxlength,
98
- placeholder: l.placeholder,
99
- disabled: l.disabled,
100
- readonly: l.readonly
101
- }, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly"])
102
- ]),
103
- _: 1
104
- }, 8, ["prop", "label", "label-width", "required", "rules"])
105
- ]),
106
- _: 1
107
- }, 8, ["span"]));
95
+ setup(__props) {
96
+ const normalizedSpan = useFormItemSpan();
97
+ const normalizedRules = useFormItemRules();
98
+ const elModel = useFormItemStringModel();
99
+ return (_ctx, _cache) => {
100
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
101
+ default: withCtx(() => [
102
+ createVNode(unref(ElFormItem), {
103
+ prop: _ctx.name,
104
+ label: _ctx.label,
105
+ "label-width": _ctx.labelWidth,
106
+ required: _ctx.required,
107
+ rules: unref(normalizedRules)
108
+ }, {
109
+ default: withCtx(() => [
110
+ createVNode(unref(ElInput), {
111
+ modelValue: unref(elModel),
112
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(elModel) ? elModel.value = $event : null),
113
+ maxlength: _ctx.maxlength,
114
+ placeholder: _ctx.placeholder,
115
+ disabled: _ctx.disabled,
116
+ readonly: _ctx.readonly
117
+ }, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly"])
118
+ ]),
119
+ _: 1
120
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
121
+ ]),
122
+ _: 1
123
+ }, 8, ["span"]);
124
+ };
108
125
  }
109
- }), Re = /* @__PURE__ */ y({
110
- name: "OFormPassword",
111
- inheritAttrs: !1,
126
+ });
127
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
128
+ ...{ name: "OFormPassword", inheritAttrs: false },
112
129
  __name: "PasswordInput",
113
130
  props: {
114
131
  name: {},
@@ -122,37 +139,41 @@ const We = /* @__PURE__ */ y({
122
139
  disabled: { type: Boolean },
123
140
  readonly: { type: Boolean }
124
141
  },
125
- setup(t) {
126
- const i = v(), u = V(), o = z();
127
- return (l, a) => (p(), h(e(g), { span: e(i) }, {
128
- default: d(() => [
129
- f(e(w), {
130
- prop: l.name,
131
- label: l.label,
132
- "label-width": l.labelWidth,
133
- required: l.required,
134
- rules: e(u)
135
- }, {
136
- default: d(() => [
137
- f(e(O), {
138
- modelValue: e(o),
139
- "onUpdate:modelValue": a[0] || (a[0] = (n) => q(o) ? o.value = n : null),
140
- maxlength: l.maxlength,
141
- placeholder: l.placeholder,
142
- disabled: l.disabled,
143
- readonly: l.readonly,
144
- type: "password"
145
- }, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly"])
146
- ]),
147
- _: 1
148
- }, 8, ["prop", "label", "label-width", "required", "rules"])
149
- ]),
150
- _: 1
151
- }, 8, ["span"]));
142
+ setup(__props) {
143
+ const normalizedSpan = useFormItemSpan();
144
+ const normalizedRules = useFormItemRules();
145
+ const elModel = useFormItemStringModel();
146
+ return (_ctx, _cache) => {
147
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
148
+ default: withCtx(() => [
149
+ createVNode(unref(ElFormItem), {
150
+ prop: _ctx.name,
151
+ label: _ctx.label,
152
+ "label-width": _ctx.labelWidth,
153
+ required: _ctx.required,
154
+ rules: unref(normalizedRules)
155
+ }, {
156
+ default: withCtx(() => [
157
+ createVNode(unref(ElInput), {
158
+ modelValue: unref(elModel),
159
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(elModel) ? elModel.value = $event : null),
160
+ maxlength: _ctx.maxlength,
161
+ placeholder: _ctx.placeholder,
162
+ disabled: _ctx.disabled,
163
+ readonly: _ctx.readonly,
164
+ type: "password"
165
+ }, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly"])
166
+ ]),
167
+ _: 1
168
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
169
+ ]),
170
+ _: 1
171
+ }, 8, ["span"]);
172
+ };
152
173
  }
153
- }), Ae = /* @__PURE__ */ y({
154
- name: "OFormTextarea",
155
- inheritAttrs: !1,
174
+ });
175
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
176
+ ...{ name: "OFormTextarea", inheritAttrs: false },
156
177
  __name: "Textarea",
157
178
  props: {
158
179
  name: {},
@@ -167,39 +188,43 @@ const We = /* @__PURE__ */ y({
167
188
  readonly: { type: Boolean },
168
189
  rows: {}
169
190
  },
170
- setup(t) {
171
- const i = v(), u = V(), o = z();
172
- return (l, a) => (p(), h(e(g), { span: e(i) }, {
173
- default: d(() => [
174
- f(e(w), {
175
- prop: l.name,
176
- label: l.label,
177
- "label-width": l.labelWidth,
178
- required: l.required,
179
- rules: e(u)
180
- }, {
181
- default: d(() => [
182
- f(e(O), {
183
- modelValue: e(o),
184
- "onUpdate:modelValue": a[0] || (a[0] = (n) => q(o) ? o.value = n : null),
185
- maxlength: l.maxlength,
186
- placeholder: l.placeholder,
187
- disabled: l.disabled,
188
- readonly: l.readonly,
189
- type: "textarea",
190
- rows: l.rows,
191
- resize: "none"
192
- }, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly", "rows"])
193
- ]),
194
- _: 1
195
- }, 8, ["prop", "label", "label-width", "required", "rules"])
196
- ]),
197
- _: 1
198
- }, 8, ["span"]));
191
+ setup(__props) {
192
+ const normalizedSpan = useFormItemSpan();
193
+ const normalizedRules = useFormItemRules();
194
+ const elModel = useFormItemStringModel();
195
+ return (_ctx, _cache) => {
196
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
197
+ default: withCtx(() => [
198
+ createVNode(unref(ElFormItem), {
199
+ prop: _ctx.name,
200
+ label: _ctx.label,
201
+ "label-width": _ctx.labelWidth,
202
+ required: _ctx.required,
203
+ rules: unref(normalizedRules)
204
+ }, {
205
+ default: withCtx(() => [
206
+ createVNode(unref(ElInput), {
207
+ modelValue: unref(elModel),
208
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(elModel) ? elModel.value = $event : null),
209
+ maxlength: _ctx.maxlength,
210
+ placeholder: _ctx.placeholder,
211
+ disabled: _ctx.disabled,
212
+ readonly: _ctx.readonly,
213
+ type: "textarea",
214
+ rows: _ctx.rows,
215
+ resize: "none"
216
+ }, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly", "rows"])
217
+ ]),
218
+ _: 1
219
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
220
+ ]),
221
+ _: 1
222
+ }, 8, ["span"]);
223
+ };
199
224
  }
200
- }), $e = /* @__PURE__ */ y({
201
- name: "OFormSingleselect",
202
- inheritAttrs: !1,
225
+ });
226
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
227
+ ...{ name: "OFormSingleselect", inheritAttrs: false },
203
228
  __name: "SingleSelect",
204
229
  props: {
205
230
  name: {},
@@ -214,52 +239,62 @@ const We = /* @__PURE__ */ y({
214
239
  clearable: { type: Boolean },
215
240
  filterable: { type: Boolean }
216
241
  },
217
- setup(t) {
218
- const i = H(), u = v(), o = V(), l = X(), a = U(), n = z(), s = F(() => Me(a.value, n.value));
219
- return (r, m) => (p(), h(e(g), { span: e(u) }, {
220
- default: d(() => [
221
- f(e(w), {
222
- prop: r.name,
223
- label: r.label,
224
- "label-width": r.labelWidth,
225
- required: r.required,
226
- rules: e(o)
227
- }, {
228
- default: d(() => [
229
- e(l) ? (p(), h(e(O), {
230
- key: 0,
231
- "model-value": s.value,
232
- placeholder: r.placeholder,
233
- disabled: !0,
234
- readonly: !0
235
- }, null, 8, ["model-value", "placeholder"])) : (p(), h(e(K), {
236
- key: 1,
237
- modelValue: e(n),
238
- "onUpdate:modelValue": m[0] || (m[0] = (c) => q(n) ? n.value = c : null),
239
- placeholder: r.placeholder,
240
- clearable: r.clearable,
241
- filterable: r.filterable,
242
- onChange: e(i).onChange
243
- }, {
244
- default: d(() => [
245
- (p(!0), D(E, null, I(e(a), (c) => (p(), h(e(J), {
246
- key: c.value,
247
- label: c.content,
248
- value: c.value
249
- }, null, 8, ["label", "value"]))), 128))
250
- ]),
251
- _: 1
252
- }, 8, ["modelValue", "placeholder", "clearable", "filterable", "onChange"]))
253
- ]),
254
- _: 1
255
- }, 8, ["prop", "label", "label-width", "required", "rules"])
256
- ]),
257
- _: 1
258
- }, 8, ["span"]));
242
+ setup(__props) {
243
+ const attrs = useAttrs();
244
+ const normalizedSpan = useFormItemSpan();
245
+ const normalizedRules = useFormItemRules();
246
+ const normalizedDisabled = useFormItemDisabled();
247
+ const normalizedCode = useFormItemCode();
248
+ const elModel = useFormItemStringModel();
249
+ const content = computed(() => getSingleCodeContent(normalizedCode.value, elModel.value));
250
+ return (_ctx, _cache) => {
251
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
252
+ default: withCtx(() => [
253
+ createVNode(unref(ElFormItem), {
254
+ prop: _ctx.name,
255
+ label: _ctx.label,
256
+ "label-width": _ctx.labelWidth,
257
+ required: _ctx.required,
258
+ rules: unref(normalizedRules)
259
+ }, {
260
+ default: withCtx(() => [
261
+ unref(normalizedDisabled) ? (openBlock(), createBlock(unref(ElInput), {
262
+ key: 0,
263
+ "model-value": content.value,
264
+ placeholder: _ctx.placeholder,
265
+ disabled: true,
266
+ readonly: true
267
+ }, null, 8, ["model-value", "placeholder"])) : (openBlock(), createBlock(unref(ElSelect), {
268
+ key: 1,
269
+ modelValue: unref(elModel),
270
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(elModel) ? elModel.value = $event : null),
271
+ placeholder: _ctx.placeholder,
272
+ clearable: _ctx.clearable,
273
+ filterable: _ctx.filterable,
274
+ onChange: unref(attrs).onChange
275
+ }, {
276
+ default: withCtx(() => [
277
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(normalizedCode), (codeItem) => {
278
+ return openBlock(), createBlock(unref(ElOption), {
279
+ key: codeItem.value,
280
+ label: codeItem.content,
281
+ value: codeItem.value
282
+ }, null, 8, ["label", "value"]);
283
+ }), 128))
284
+ ]),
285
+ _: 1
286
+ }, 8, ["modelValue", "placeholder", "clearable", "filterable", "onChange"]))
287
+ ]),
288
+ _: 1
289
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
290
+ ]),
291
+ _: 1
292
+ }, 8, ["span"]);
293
+ };
259
294
  }
260
- }), De = /* @__PURE__ */ y({
261
- name: "OFormMultiselect",
262
- inheritAttrs: !1,
295
+ });
296
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
297
+ ...{ name: "OFormMultiselect", inheritAttrs: false },
263
298
  __name: "MultiSelect",
264
299
  props: {
265
300
  name: {},
@@ -274,53 +309,64 @@ const We = /* @__PURE__ */ y({
274
309
  collapseTags: { type: Boolean },
275
310
  collapseTagsTooltip: { type: Boolean }
276
311
  },
277
- setup(t) {
278
- const i = H(), u = v(), o = V(), l = X(), a = U(), n = Z(), s = T(), r = F(() => Ce(a.value, s.modelValue[t.name]));
279
- return (m, c) => (p(), h(e(g), { span: e(u) }, {
280
- default: d(() => [
281
- f(e(w), {
282
- prop: m.name,
283
- label: m.label,
284
- "label-width": m.labelWidth,
285
- required: m.required,
286
- rules: e(o)
287
- }, {
288
- default: d(() => [
289
- e(l) ? (p(), h(e(O), {
290
- key: 0,
291
- "model-value": r.value,
292
- placeholder: m.placeholder,
293
- disabled: !0,
294
- readonly: !0
295
- }, null, 8, ["model-value", "placeholder"])) : (p(), h(e(K), {
296
- key: 1,
297
- modelValue: e(n),
298
- "onUpdate:modelValue": c[0] || (c[0] = (S) => q(n) ? n.value = S : null),
299
- placeholder: m.placeholder,
300
- multiple: "",
301
- "collapse-tags": m.collapseTags,
302
- "collapse-tags-tooltip": m.collapseTagsTooltip,
303
- onChange: e(i).onChange
304
- }, {
305
- default: d(() => [
306
- (p(!0), D(E, null, I(e(a), (S) => (p(), h(e(J), {
307
- key: S.value,
308
- label: S.content,
309
- value: S.value
310
- }, null, 8, ["label", "value"]))), 128))
311
- ]),
312
- _: 1
313
- }, 8, ["modelValue", "placeholder", "collapse-tags", "collapse-tags-tooltip", "onChange"]))
314
- ]),
315
- _: 1
316
- }, 8, ["prop", "label", "label-width", "required", "rules"])
317
- ]),
318
- _: 1
319
- }, 8, ["span"]));
312
+ setup(__props) {
313
+ const attrs = useAttrs();
314
+ const normalizedSpan = useFormItemSpan();
315
+ const normalizedRules = useFormItemRules();
316
+ const normalizedDisabled = useFormItemDisabled();
317
+ const normalizedCode = useFormItemCode();
318
+ const elModel = useFormItemMultiModel();
319
+ const formContext = useFormContext();
320
+ const content = computed(() => getMultiCodeContent(normalizedCode.value, formContext.modelValue[__props.name]));
321
+ return (_ctx, _cache) => {
322
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
323
+ default: withCtx(() => [
324
+ createVNode(unref(ElFormItem), {
325
+ prop: _ctx.name,
326
+ label: _ctx.label,
327
+ "label-width": _ctx.labelWidth,
328
+ required: _ctx.required,
329
+ rules: unref(normalizedRules)
330
+ }, {
331
+ default: withCtx(() => [
332
+ unref(normalizedDisabled) ? (openBlock(), createBlock(unref(ElInput), {
333
+ key: 0,
334
+ "model-value": content.value,
335
+ placeholder: _ctx.placeholder,
336
+ disabled: true,
337
+ readonly: true
338
+ }, null, 8, ["model-value", "placeholder"])) : (openBlock(), createBlock(unref(ElSelect), {
339
+ key: 1,
340
+ modelValue: unref(elModel),
341
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(elModel) ? elModel.value = $event : null),
342
+ placeholder: _ctx.placeholder,
343
+ multiple: "",
344
+ "collapse-tags": _ctx.collapseTags,
345
+ "collapse-tags-tooltip": _ctx.collapseTagsTooltip,
346
+ onChange: unref(attrs).onChange
347
+ }, {
348
+ default: withCtx(() => [
349
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(normalizedCode), (codeItem) => {
350
+ return openBlock(), createBlock(unref(ElOption), {
351
+ key: codeItem.value,
352
+ label: codeItem.content,
353
+ value: codeItem.value
354
+ }, null, 8, ["label", "value"]);
355
+ }), 128))
356
+ ]),
357
+ _: 1
358
+ }, 8, ["modelValue", "placeholder", "collapse-tags", "collapse-tags-tooltip", "onChange"]))
359
+ ]),
360
+ _: 1
361
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
362
+ ]),
363
+ _: 1
364
+ }, 8, ["span"]);
365
+ };
320
366
  }
321
- }), Ee = /* @__PURE__ */ y({
322
- name: "OFormRadiogroup",
323
- inheritAttrs: !1,
367
+ });
368
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
369
+ ...{ name: "OFormRadiogroup", inheritAttrs: false },
324
370
  __name: "RadioGroup",
325
371
  props: {
326
372
  name: {},
@@ -332,46 +378,53 @@ const We = /* @__PURE__ */ y({
332
378
  disabled: { type: Boolean },
333
379
  code: {}
334
380
  },
335
- setup(t) {
336
- const i = v(), u = V(), o = U(), l = z();
337
- return (a, n) => (p(), h(e(g), { span: e(i) }, {
338
- default: d(() => [
339
- f(e(w), {
340
- prop: a.name,
341
- label: a.label,
342
- "label-width": a.labelWidth,
343
- required: a.required,
344
- rules: e(u)
345
- }, {
346
- default: d(() => [
347
- f(e(ce), {
348
- modelValue: e(l),
349
- "onUpdate:modelValue": n[0] || (n[0] = (s) => q(l) ? l.value = s : null),
350
- disabled: a.disabled
351
- }, {
352
- default: d(() => [
353
- (p(!0), D(E, null, I(e(o), (s) => (p(), h(e(ye), {
354
- key: s.value,
355
- value: s.value
356
- }, {
357
- default: d(() => [
358
- ue(se(s.content), 1)
359
- ]),
360
- _: 2
361
- }, 1032, ["value"]))), 128))
362
- ]),
363
- _: 1
364
- }, 8, ["modelValue", "disabled"])
365
- ]),
366
- _: 1
367
- }, 8, ["prop", "label", "label-width", "required", "rules"])
368
- ]),
369
- _: 1
370
- }, 8, ["span"]));
381
+ setup(__props) {
382
+ const normalizedSpan = useFormItemSpan();
383
+ const normalizedRules = useFormItemRules();
384
+ const normalizedCode = useFormItemCode();
385
+ const elModel = useFormItemStringModel();
386
+ return (_ctx, _cache) => {
387
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
388
+ default: withCtx(() => [
389
+ createVNode(unref(ElFormItem), {
390
+ prop: _ctx.name,
391
+ label: _ctx.label,
392
+ "label-width": _ctx.labelWidth,
393
+ required: _ctx.required,
394
+ rules: unref(normalizedRules)
395
+ }, {
396
+ default: withCtx(() => [
397
+ createVNode(unref(ElRadioGroup), {
398
+ modelValue: unref(elModel),
399
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(elModel) ? elModel.value = $event : null),
400
+ disabled: _ctx.disabled
401
+ }, {
402
+ default: withCtx(() => [
403
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(normalizedCode), (codeItem) => {
404
+ return openBlock(), createBlock(unref(ElRadio), {
405
+ key: codeItem.value,
406
+ value: codeItem.value
407
+ }, {
408
+ default: withCtx(() => [
409
+ createTextVNode(toDisplayString(codeItem.content), 1)
410
+ ]),
411
+ _: 2
412
+ }, 1032, ["value"]);
413
+ }), 128))
414
+ ]),
415
+ _: 1
416
+ }, 8, ["modelValue", "disabled"])
417
+ ]),
418
+ _: 1
419
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
420
+ ]),
421
+ _: 1
422
+ }, 8, ["span"]);
423
+ };
371
424
  }
372
- }), Ie = /* @__PURE__ */ y({
373
- name: "OFormCheckboxgroup",
374
- inheritAttrs: !1,
425
+ });
426
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
427
+ ...{ name: "OFormCheckboxgroup", inheritAttrs: false },
375
428
  __name: "CheckboxGroup",
376
429
  props: {
377
430
  name: {},
@@ -383,42 +436,49 @@ const We = /* @__PURE__ */ y({
383
436
  disabled: { type: Boolean },
384
437
  code: {}
385
438
  },
386
- setup(t) {
387
- const i = v(), u = V(), o = U(), l = Z();
388
- return (a, n) => (p(), h(e(g), { span: e(i) }, {
389
- default: d(() => [
390
- f(e(w), {
391
- prop: a.name,
392
- label: a.label,
393
- "label-width": a.labelWidth,
394
- required: a.required,
395
- rules: e(u)
396
- }, {
397
- default: d(() => [
398
- f(e(ge), {
399
- modelValue: e(l),
400
- "onUpdate:modelValue": n[0] || (n[0] = (s) => q(l) ? l.value = s : null),
401
- disabled: a.disabled
402
- }, {
403
- default: d(() => [
404
- (p(!0), D(E, null, I(e(o), (s) => (p(), h(e(Q), {
405
- key: s.value,
406
- label: s.content,
407
- value: s.value
408
- }, null, 8, ["label", "value"]))), 128))
409
- ]),
410
- _: 1
411
- }, 8, ["modelValue", "disabled"])
412
- ]),
413
- _: 1
414
- }, 8, ["prop", "label", "label-width", "required", "rules"])
415
- ]),
416
- _: 1
417
- }, 8, ["span"]));
439
+ setup(__props) {
440
+ const normalizedSpan = useFormItemSpan();
441
+ const normalizedRules = useFormItemRules();
442
+ const normalizedCode = useFormItemCode();
443
+ const elModel = useFormItemMultiModel();
444
+ return (_ctx, _cache) => {
445
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
446
+ default: withCtx(() => [
447
+ createVNode(unref(ElFormItem), {
448
+ prop: _ctx.name,
449
+ label: _ctx.label,
450
+ "label-width": _ctx.labelWidth,
451
+ required: _ctx.required,
452
+ rules: unref(normalizedRules)
453
+ }, {
454
+ default: withCtx(() => [
455
+ createVNode(unref(ElCheckboxGroup), {
456
+ modelValue: unref(elModel),
457
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(elModel) ? elModel.value = $event : null),
458
+ disabled: _ctx.disabled
459
+ }, {
460
+ default: withCtx(() => [
461
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(normalizedCode), (codeItem) => {
462
+ return openBlock(), createBlock(unref(ElCheckbox), {
463
+ key: codeItem.value,
464
+ label: codeItem.content,
465
+ value: codeItem.value
466
+ }, null, 8, ["label", "value"]);
467
+ }), 128))
468
+ ]),
469
+ _: 1
470
+ }, 8, ["modelValue", "disabled"])
471
+ ]),
472
+ _: 1
473
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
474
+ ]),
475
+ _: 1
476
+ }, 8, ["span"]);
477
+ };
418
478
  }
419
- }), Ue = /* @__PURE__ */ y({
420
- name: "OFormCheckbox",
421
- inheritAttrs: !1,
479
+ });
480
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
481
+ ...{ name: "OFormCheckbox", inheritAttrs: false },
422
482
  __name: "Checkbox",
423
483
  props: {
424
484
  name: {},
@@ -428,32 +488,35 @@ const We = /* @__PURE__ */ y({
428
488
  rules: {},
429
489
  disabled: { type: Boolean }
430
490
  },
431
- setup(t) {
432
- const i = v(), u = x();
433
- return (o, l) => (p(), h(e(g), { span: e(i) }, {
434
- default: d(() => [
435
- f(e(w), {
436
- prop: o.name,
437
- label: o.label,
438
- "label-width": o.labelWidth,
439
- rules: o.rules
440
- }, {
441
- default: d(() => [
442
- f(e(Q), {
443
- modelValue: e(u),
444
- "onUpdate:modelValue": l[0] || (l[0] = (a) => q(u) ? u.value = a : null),
445
- disabled: o.disabled
446
- }, null, 8, ["modelValue", "disabled"])
447
- ]),
448
- _: 1
449
- }, 8, ["prop", "label", "label-width", "rules"])
450
- ]),
451
- _: 1
452
- }, 8, ["span"]));
491
+ setup(__props) {
492
+ const normalizedSpan = useFormItemSpan();
493
+ const elModel = useFormItemBooleanModel();
494
+ return (_ctx, _cache) => {
495
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
496
+ default: withCtx(() => [
497
+ createVNode(unref(ElFormItem), {
498
+ prop: _ctx.name,
499
+ label: _ctx.label,
500
+ "label-width": _ctx.labelWidth,
501
+ rules: _ctx.rules
502
+ }, {
503
+ default: withCtx(() => [
504
+ createVNode(unref(ElCheckbox), {
505
+ modelValue: unref(elModel),
506
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(elModel) ? elModel.value = $event : null),
507
+ disabled: _ctx.disabled
508
+ }, null, 8, ["modelValue", "disabled"])
509
+ ]),
510
+ _: 1
511
+ }, 8, ["prop", "label", "label-width", "rules"])
512
+ ]),
513
+ _: 1
514
+ }, 8, ["span"]);
515
+ };
453
516
  }
454
- }), Te = /* @__PURE__ */ y({
455
- name: "OFormSwitch",
456
- inheritAttrs: !1,
517
+ });
518
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
519
+ ...{ name: "OFormSwitch", inheritAttrs: false },
457
520
  __name: "Switch",
458
521
  props: {
459
522
  name: {},
@@ -463,32 +526,35 @@ const We = /* @__PURE__ */ y({
463
526
  rules: {},
464
527
  disabled: { type: Boolean }
465
528
  },
466
- setup(t) {
467
- const i = v(), u = x();
468
- return (o, l) => (p(), h(e(g), { span: e(i) }, {
469
- default: d(() => [
470
- f(e(w), {
471
- prop: o.name,
472
- label: o.label,
473
- "label-width": o.labelWidth,
474
- rules: o.rules
475
- }, {
476
- default: d(() => [
477
- f(e(ve), {
478
- modelValue: e(u),
479
- "onUpdate:modelValue": l[0] || (l[0] = (a) => q(u) ? u.value = a : null),
480
- disabled: o.disabled
481
- }, null, 8, ["modelValue", "disabled"])
482
- ]),
483
- _: 1
484
- }, 8, ["prop", "label", "label-width", "rules"])
485
- ]),
486
- _: 1
487
- }, 8, ["span"]));
529
+ setup(__props) {
530
+ const normalizedSpan = useFormItemSpan();
531
+ const elModel = useFormItemBooleanModel();
532
+ return (_ctx, _cache) => {
533
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
534
+ default: withCtx(() => [
535
+ createVNode(unref(ElFormItem), {
536
+ prop: _ctx.name,
537
+ label: _ctx.label,
538
+ "label-width": _ctx.labelWidth,
539
+ rules: _ctx.rules
540
+ }, {
541
+ default: withCtx(() => [
542
+ createVNode(unref(ElSwitch), {
543
+ modelValue: unref(elModel),
544
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(elModel) ? elModel.value = $event : null),
545
+ disabled: _ctx.disabled
546
+ }, null, 8, ["modelValue", "disabled"])
547
+ ]),
548
+ _: 1
549
+ }, 8, ["prop", "label", "label-width", "rules"])
550
+ ]),
551
+ _: 1
552
+ }, 8, ["span"]);
553
+ };
488
554
  }
489
- }), Ne = /* @__PURE__ */ y({
490
- name: "OFormDate",
491
- inheritAttrs: !1,
555
+ });
556
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
557
+ ...{ name: "OFormDate", inheritAttrs: false },
492
558
  __name: "DateInput",
493
559
  props: {
494
560
  name: {},
@@ -501,79 +567,123 @@ const We = /* @__PURE__ */ y({
501
567
  placeholder: {},
502
568
  disabled: { type: Boolean },
503
569
  readonly: { type: Boolean },
504
- editable: { type: Boolean, default: !0 },
505
- clearable: { type: Boolean, default: !0 },
570
+ editable: { type: Boolean, default: true },
571
+ clearable: { type: Boolean, default: true },
506
572
  format: { default: "YYYY-MM-DD" },
507
573
  sourceFormat: {}
508
574
  },
509
- setup(t) {
510
- const i = v(), u = V(), o = F(() => t.format.startsWith("H") || t.format.startsWith("h") || t.format.startsWith("m") || t.format.startsWith("s")), l = F(() => t.sourceFormat ? t.sourceFormat : o.value ? "HH:mm:ss" : "YYYY-MM-DD"), a = F(() => {
511
- let r = "date";
512
- return (t.format.indexOf("y") > -1 || t.format.indexOf("Y") > -1) && (r = "year"), t.format.indexOf("M") > -1 && (r = "month"), (t.format.indexOf("d") > -1 || t.format.indexOf("D") > -1) && (r = "date"), (t.format.indexOf("H") > -1 || t.format.indexOf("h") > -1 || t.format.indexOf("k") > -1 || t.format.indexOf("m") > -1 || t.format.indexOf("s") > -1 || t.format.indexOf("S") > -1) && (r = "datetime"), r;
513
- }), n = T(), s = F({
575
+ setup(__props) {
576
+ const normalizedSpan = useFormItemSpan();
577
+ const normalizedRules = useFormItemRules();
578
+ const isTimePicker = computed(() => __props.format.startsWith("H") || __props.format.startsWith("h") || __props.format.startsWith("m") || __props.format.startsWith("s"));
579
+ const normalizedSourceFormat = computed(() => {
580
+ if (__props.sourceFormat) {
581
+ return __props.sourceFormat;
582
+ }
583
+ if (isTimePicker.value) {
584
+ return "HH:mm:ss";
585
+ } else {
586
+ return "YYYY-MM-DD";
587
+ }
588
+ });
589
+ const dateType = computed(() => {
590
+ let picker = "date";
591
+ if (__props.format.indexOf("y") > -1 || __props.format.indexOf("Y") > -1) {
592
+ picker = "year";
593
+ }
594
+ if (__props.format.indexOf("M") > -1) {
595
+ picker = "month";
596
+ }
597
+ if (__props.format.indexOf("d") > -1 || __props.format.indexOf("D") > -1) {
598
+ picker = "date";
599
+ }
600
+ if (__props.format.indexOf("H") > -1 || __props.format.indexOf("h") > -1 || __props.format.indexOf("k") > -1 || __props.format.indexOf("m") > -1 || __props.format.indexOf("s") > -1 || __props.format.indexOf("S") > -1) {
601
+ picker = "datetime";
602
+ }
603
+ return picker;
604
+ });
605
+ const formContext = useFormContext();
606
+ const elModel = computed({
514
607
  get: () => {
515
- const r = n.modelValue[t.name];
516
- if (r) {
517
- if (te(r))
518
- return r;
519
- if (A(r)) {
520
- const m = G(r, l.value, !0);
521
- if (!m.isValid())
522
- throw new W(`日期输入框的值无效,不符合${l.value}格式`);
523
- return m.toDate();
524
- } else
525
- throw new W("日期输入框的值只能为字符串或日期类型");
608
+ const value = formContext.modelValue[__props.name];
609
+ if (!value) {
610
+ return void 0;
611
+ }
612
+ if (isDate(value)) {
613
+ return value;
614
+ } else if (isString(value)) {
615
+ const dayjsObj = dayjs(value, normalizedSourceFormat.value, true);
616
+ if (!dayjsObj.isValid()) {
617
+ throw new OrionError(`日期输入框的值无效,不符合${normalizedSourceFormat.value}格式`);
618
+ }
619
+ return dayjsObj.toDate();
620
+ } else {
621
+ throw new OrionError("日期输入框的值只能为字符串或日期类型");
526
622
  }
527
623
  },
528
- set: (r) => {
529
- t.sourceFormat ? r ? n.updateModelValue(t.name, G(r).format(l.value)) : n.updateModelValue(t.name, "") : r ? n.updateModelValue(t.name, r) : n.updateModelValue(t.name, void 0);
624
+ set: (newValue) => {
625
+ if (__props.sourceFormat) {
626
+ if (!newValue) {
627
+ formContext.updateModelValue(__props.name, "");
628
+ } else {
629
+ formContext.updateModelValue(__props.name, dayjs(newValue).format(normalizedSourceFormat.value));
630
+ }
631
+ } else {
632
+ if (!newValue) {
633
+ formContext.updateModelValue(__props.name, void 0);
634
+ } else {
635
+ formContext.updateModelValue(__props.name, newValue);
636
+ }
637
+ }
530
638
  }
531
639
  });
532
- return (r, m) => (p(), h(e(g), { span: e(i) }, {
533
- default: d(() => [
534
- f(e(w), {
535
- prop: r.name,
536
- label: r.label,
537
- "label-width": r.labelWidth,
538
- required: r.required,
539
- rules: e(u)
540
- }, {
541
- default: d(() => [
542
- o.value ? (p(), h(e(we), {
543
- key: 0,
544
- modelValue: s.value,
545
- "onUpdate:modelValue": m[0] || (m[0] = (c) => s.value = c),
546
- placeholder: r.placeholder,
547
- disabled: r.disabled,
548
- readonly: r.readonly,
549
- editable: r.editable,
550
- clearable: r.clearable,
551
- format: l.value,
552
- "arrow-control": "",
553
- style: { width: "100%" }
554
- }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "editable", "clearable", "format"])) : (p(), h(e(Ve), {
555
- key: 1,
556
- modelValue: s.value,
557
- "onUpdate:modelValue": m[1] || (m[1] = (c) => s.value = c),
558
- placeholder: r.placeholder,
559
- disabled: r.disabled,
560
- readonly: r.readonly,
561
- editable: r.editable,
562
- clearable: r.clearable,
563
- type: a.value,
564
- format: l.value,
565
- style: { width: "100%" }
566
- }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "editable", "clearable", "type", "format"]))
567
- ]),
568
- _: 1
569
- }, 8, ["prop", "label", "label-width", "required", "rules"])
570
- ]),
571
- _: 1
572
- }, 8, ["span"]));
640
+ return (_ctx, _cache) => {
641
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
642
+ default: withCtx(() => [
643
+ createVNode(unref(ElFormItem), {
644
+ prop: _ctx.name,
645
+ label: _ctx.label,
646
+ "label-width": _ctx.labelWidth,
647
+ required: _ctx.required,
648
+ rules: unref(normalizedRules)
649
+ }, {
650
+ default: withCtx(() => [
651
+ isTimePicker.value ? (openBlock(), createBlock(unref(ElTimePicker), {
652
+ key: 0,
653
+ modelValue: elModel.value,
654
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => elModel.value = $event),
655
+ placeholder: _ctx.placeholder,
656
+ disabled: _ctx.disabled,
657
+ readonly: _ctx.readonly,
658
+ editable: _ctx.editable,
659
+ clearable: _ctx.clearable,
660
+ format: normalizedSourceFormat.value,
661
+ "arrow-control": "",
662
+ style: { "width": "100%" }
663
+ }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "editable", "clearable", "format"])) : (openBlock(), createBlock(unref(ElDatePicker), {
664
+ key: 1,
665
+ modelValue: elModel.value,
666
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => elModel.value = $event),
667
+ placeholder: _ctx.placeholder,
668
+ disabled: _ctx.disabled,
669
+ readonly: _ctx.readonly,
670
+ editable: _ctx.editable,
671
+ clearable: _ctx.clearable,
672
+ type: dateType.value,
673
+ format: normalizedSourceFormat.value,
674
+ style: { "width": "100%" }
675
+ }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "editable", "clearable", "type", "format"]))
676
+ ]),
677
+ _: 1
678
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
679
+ ]),
680
+ _: 1
681
+ }, 8, ["span"]);
682
+ };
573
683
  }
574
- }), Pe = /* @__PURE__ */ y({
575
- name: "OFormFile",
576
- inheritAttrs: !1,
684
+ });
685
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
686
+ ...{ name: "OFormFile", inheritAttrs: false },
577
687
  __name: "FileInput",
578
688
  props: {
579
689
  name: {},
@@ -584,76 +694,90 @@ const We = /* @__PURE__ */ y({
584
694
  rules: {},
585
695
  disabled: { type: Boolean }
586
696
  },
587
- setup(t) {
588
- const i = v(), u = V(), o = z();
589
- ie(o, () => {
590
- o.value || (l.value = "");
697
+ setup(__props) {
698
+ const normalizedSpan = useFormItemSpan();
699
+ const normalizedRules = useFormItemRules();
700
+ const elModel = useFormItemStringModel();
701
+ watch(elModel, () => {
702
+ if (!elModel.value) {
703
+ file.value = "";
704
+ }
591
705
  });
592
- const l = P(""), a = Y("inputRef");
593
- return pe(() => {
594
- a.value.input.onchange = (n) => {
595
- var s;
596
- o.value = (s = n == null ? void 0 : n.target) == null ? void 0 : s.files[0];
597
- }, l.value = "";
598
- }), (n, s) => (p(), h(e(g), { span: e(i) }, {
599
- default: d(() => [
600
- f(e(w), {
601
- prop: n.name,
602
- label: n.label,
603
- "label-width": n.labelWidth,
604
- required: n.required,
605
- rules: e(u)
606
- }, {
607
- default: d(() => [
608
- f(e(O), {
609
- ref: "inputRef",
610
- modelValue: l.value,
611
- "onUpdate:modelValue": s[0] || (s[0] = (r) => l.value = r),
612
- disabled: n.disabled,
613
- type: "file",
614
- "validate-event": !1
615
- }, null, 8, ["modelValue", "disabled"])
616
- ]),
617
- _: 1
618
- }, 8, ["prop", "label", "label-width", "required", "rules"])
619
- ]),
620
- _: 1
621
- }, 8, ["span"]));
706
+ const file = ref("");
707
+ const fileRef = useTemplateRef("inputRef");
708
+ onMounted(() => {
709
+ fileRef.value.input.onchange = (event) => {
710
+ var _a;
711
+ elModel.value = (_a = event == null ? void 0 : event.target) == null ? void 0 : _a.files[0];
712
+ };
713
+ file.value = "";
714
+ });
715
+ return (_ctx, _cache) => {
716
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
717
+ default: withCtx(() => [
718
+ createVNode(unref(ElFormItem), {
719
+ prop: _ctx.name,
720
+ label: _ctx.label,
721
+ "label-width": _ctx.labelWidth,
722
+ required: _ctx.required,
723
+ rules: unref(normalizedRules)
724
+ }, {
725
+ default: withCtx(() => [
726
+ createVNode(unref(ElInput), {
727
+ ref: "inputRef",
728
+ modelValue: file.value,
729
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => file.value = $event),
730
+ disabled: _ctx.disabled,
731
+ type: "file",
732
+ "validate-event": false
733
+ }, null, 8, ["modelValue", "disabled"])
734
+ ]),
735
+ _: 1
736
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
737
+ ]),
738
+ _: 1
739
+ }, 8, ["span"]);
740
+ };
622
741
  }
623
- }), Ye = /* @__PURE__ */ y({
624
- name: "OFormButtongroup",
625
- inheritAttrs: !1,
742
+ });
743
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
744
+ ...{ name: "OFormButtongroup", inheritAttrs: false },
626
745
  __name: "ButtonGroup",
627
746
  props: {
628
747
  span: {},
629
748
  gutter: { type: [Boolean, String] },
630
749
  align: { default: "right" }
631
750
  },
632
- setup(t) {
633
- const i = F(() => ({
634
- textAlign: t.align
635
- })), u = v();
636
- return (o, l) => (p(), h(e(g), {
637
- span: e(u),
638
- style: me(i.value)
639
- }, {
640
- default: d(() => [
641
- f(e(Fe), {
642
- gutter: o.gutter,
643
- style: { "margin-bottom": "18px" }
644
- }, {
645
- default: d(() => [
646
- $(o.$slots, "default")
647
- ]),
648
- _: 3
649
- }, 8, ["gutter"])
650
- ]),
651
- _: 3
652
- }, 8, ["span", "style"]));
751
+ setup(__props) {
752
+ const style = computed(() => {
753
+ return {
754
+ textAlign: __props.align
755
+ };
756
+ });
757
+ const normalizedSpan = useFormItemSpan();
758
+ return (_ctx, _cache) => {
759
+ return openBlock(), createBlock(unref(ElCol), {
760
+ span: unref(normalizedSpan),
761
+ style: normalizeStyle(style.value)
762
+ }, {
763
+ default: withCtx(() => [
764
+ createVNode(unref(Space), {
765
+ gutter: _ctx.gutter,
766
+ style: { "margin-bottom": "18px" }
767
+ }, {
768
+ default: withCtx(() => [
769
+ renderSlot(_ctx.$slots, "default")
770
+ ]),
771
+ _: 3
772
+ }, 8, ["gutter"])
773
+ ]),
774
+ _: 3
775
+ }, 8, ["span", "style"]);
776
+ };
653
777
  }
654
- }), Ge = /* @__PURE__ */ y({
655
- name: "OFormDiy",
656
- inheritAttrs: !1,
778
+ });
779
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
780
+ ...{ name: "OFormDiy", inheritAttrs: false },
657
781
  __name: "DiyItem",
658
782
  props: {
659
783
  name: {},
@@ -663,29 +787,32 @@ const We = /* @__PURE__ */ y({
663
787
  required: { type: Boolean },
664
788
  rules: {}
665
789
  },
666
- setup(t) {
667
- const i = v(), u = V();
668
- return (o, l) => (p(), h(e(g), { span: e(i) }, {
669
- default: d(() => [
670
- f(e(w), {
671
- prop: o.name,
672
- label: o.label,
673
- "label-width": o.labelWidth,
674
- required: o.required,
675
- rules: e(u)
676
- }, {
677
- default: d(() => [
678
- $(o.$slots, "default")
679
- ]),
680
- _: 3
681
- }, 8, ["prop", "label", "label-width", "required", "rules"])
682
- ]),
683
- _: 3
684
- }, 8, ["span"]));
790
+ setup(__props) {
791
+ const normalizedSpan = useFormItemSpan();
792
+ const normalizedRules = useFormItemRules();
793
+ return (_ctx, _cache) => {
794
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
795
+ default: withCtx(() => [
796
+ createVNode(unref(ElFormItem), {
797
+ prop: _ctx.name,
798
+ label: _ctx.label,
799
+ "label-width": _ctx.labelWidth,
800
+ required: _ctx.required,
801
+ rules: unref(normalizedRules)
802
+ }, {
803
+ default: withCtx(() => [
804
+ renderSlot(_ctx.$slots, "default")
805
+ ]),
806
+ _: 3
807
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
808
+ ]),
809
+ _: 3
810
+ }, 8, ["span"]);
811
+ };
685
812
  }
686
- }), Le = /* @__PURE__ */ y({
687
- name: "OFormLov",
688
- inheritAttrs: !1,
813
+ });
814
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
815
+ ...{ name: "OFormLov", inheritAttrs: false },
689
816
  __name: "LovInput",
690
817
  props: {
691
818
  name: {},
@@ -700,93 +827,133 @@ const We = /* @__PURE__ */ y({
700
827
  readonly: { type: Boolean },
701
828
  fillMapping: { type: [String, Function] }
702
829
  },
703
- setup(t) {
704
- const i = v(), u = V(), o = z(), l = T(), a = P(!1), n = (b) => {
705
- a.value = b;
706
- }, s = P(!1), r = () => {
707
- var b;
708
- s.value || (s.value = !0), a.value || (b = N.value) == null || b.handleOpen();
830
+ setup(__props) {
831
+ const normalizedSpan = useFormItemSpan();
832
+ const normalizedRules = useFormItemRules();
833
+ const elModel = useFormItemStringModel();
834
+ const formContext = useFormContext();
835
+ const visible = ref(false);
836
+ const onVisibleChange = (val) => {
837
+ visible.value = val;
838
+ };
839
+ const changed = ref(false);
840
+ const onInput = () => {
841
+ var _a;
842
+ if (!changed.value) {
843
+ changed.value = true;
844
+ }
845
+ if (!visible.value) {
846
+ (_a = dropdownRef.value) == null ? void 0 : _a.handleOpen();
847
+ }
848
+ };
849
+ let keydownHandler;
850
+ const registerKeydownHandler = (handler) => {
851
+ keydownHandler = handler;
709
852
  };
710
- let m;
711
- const c = (b) => {
712
- m = b;
713
- }, S = (b) => {
714
- var C;
715
- ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Enter", "Space"].indexOf(b.code) > -1 && (a.value && m && m(b.code), b.stopPropagation()), ["ArrowUp", "ArrowDown"].indexOf(b.code) > -1 && !a.value && ((C = N.value) == null || C.handleOpen());
716
- }, _ = () => {
717
- if (s.value && A(t.fillMapping)) {
718
- const b = {}, B = t.fillMapping.split(",");
719
- for (let M = 0; M < B.length; M++) {
720
- const C = B[M].split(":")[0].trim();
721
- b[C] = void 0;
853
+ const onKeydown = (e) => {
854
+ var _a;
855
+ const fallthroughCodes = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Enter", "Space"];
856
+ if (fallthroughCodes.indexOf(e.code) > -1) {
857
+ if (visible.value) {
858
+ keydownHandler && keydownHandler(e.code);
722
859
  }
723
- l.updateModelValueMulti(b);
860
+ e.stopPropagation();
724
861
  }
725
- }, N = Y("dropdown");
726
- return L(
727
- ze,
728
- j({
729
- lovValue: o,
730
- backfill: (b) => {
731
- var B;
732
- if ((B = N.value) == null || B.handleClose(), A(t.fillMapping)) {
733
- const M = {}, C = t.fillMapping.split(",");
734
- for (let k = 0; k < C.length; k++) {
735
- const ee = C[k].split(":")[0].trim(), le = C[k].split(":")[1].trim(), ae = b[le];
736
- M[ee] = ae;
737
- }
738
- l.updateModelValueMulti(M);
739
- } else
740
- t.fillMapping && t.fillMapping(b);
741
- s.value && (s.value = !1);
742
- },
743
- registerKeydownHandler: c
862
+ const triggerCodes = ["ArrowUp", "ArrowDown"];
863
+ if (triggerCodes.indexOf(e.code) > -1 && !visible.value) {
864
+ (_a = dropdownRef.value) == null ? void 0 : _a.handleOpen();
865
+ }
866
+ };
867
+ const onChange = () => {
868
+ if (!changed.value) {
869
+ return;
870
+ }
871
+ if (isString(__props.fillMapping)) {
872
+ const data = {};
873
+ const pairs = __props.fillMapping.split(",");
874
+ for (let i = 0; i < pairs.length; i++) {
875
+ const dstName = pairs[i].split(":")[0].trim();
876
+ data[dstName] = void 0;
877
+ }
878
+ formContext.updateModelValueMulti(data);
879
+ }
880
+ };
881
+ const dropdownRef = useTemplateRef("dropdown");
882
+ const backfill = (params) => {
883
+ var _a;
884
+ (_a = dropdownRef.value) == null ? void 0 : _a.handleClose();
885
+ if (isString(__props.fillMapping)) {
886
+ const data = {};
887
+ const pairs = __props.fillMapping.split(",");
888
+ for (let i = 0; i < pairs.length; i++) {
889
+ const dstName = pairs[i].split(":")[0].trim();
890
+ const srcName = pairs[i].split(":")[1].trim();
891
+ const srcValue = params[srcName];
892
+ data[dstName] = srcValue;
893
+ }
894
+ formContext.updateModelValueMulti(data);
895
+ } else {
896
+ __props.fillMapping && __props.fillMapping(params);
897
+ }
898
+ if (changed.value) {
899
+ changed.value = false;
900
+ }
901
+ };
902
+ provide(
903
+ lovContextKey,
904
+ reactive({
905
+ lovValue: elModel,
906
+ backfill,
907
+ registerKeydownHandler
744
908
  })
745
- ), (b, B) => (p(), h(e(g), { span: e(i) }, {
746
- default: d(() => [
747
- f(e(w), {
748
- prop: b.name,
749
- label: b.label,
750
- "label-width": b.labelWidth,
751
- required: b.required,
752
- rules: e(u)
753
- }, {
754
- default: d(() => [
755
- f(e(Se), {
756
- ref: "dropdown",
757
- trigger: "click",
758
- onVisibleChange: n,
759
- style: { width: "100%" }
760
- }, {
761
- dropdown: d(() => [
762
- $(b.$slots, "default")
763
- ]),
764
- default: d(() => [
765
- f(e(O), {
766
- modelValue: e(o),
767
- "onUpdate:modelValue": B[0] || (B[0] = (M) => q(o) ? o.value = M : null),
768
- maxlength: b.maxlength,
769
- placeholder: b.placeholder,
770
- disabled: b.disabled,
771
- readonly: b.readonly,
772
- onInput: r,
773
- onKeydown: S,
774
- onChange: _,
775
- "suffix-icon": e(Oe)
776
- }, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly", "suffix-icon"])
777
- ]),
778
- _: 3
779
- }, 512)
780
- ]),
781
- _: 3
782
- }, 8, ["prop", "label", "label-width", "required", "rules"])
783
- ]),
784
- _: 3
785
- }, 8, ["span"]));
909
+ );
910
+ return (_ctx, _cache) => {
911
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
912
+ default: withCtx(() => [
913
+ createVNode(unref(ElFormItem), {
914
+ prop: _ctx.name,
915
+ label: _ctx.label,
916
+ "label-width": _ctx.labelWidth,
917
+ required: _ctx.required,
918
+ rules: unref(normalizedRules)
919
+ }, {
920
+ default: withCtx(() => [
921
+ createVNode(unref(ElDropdown), {
922
+ ref: "dropdown",
923
+ trigger: "click",
924
+ onVisibleChange,
925
+ style: { "width": "100%" }
926
+ }, {
927
+ dropdown: withCtx(() => [
928
+ renderSlot(_ctx.$slots, "default")
929
+ ]),
930
+ default: withCtx(() => [
931
+ createVNode(unref(ElInput), {
932
+ modelValue: unref(elModel),
933
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(elModel) ? elModel.value = $event : null),
934
+ maxlength: _ctx.maxlength,
935
+ placeholder: _ctx.placeholder,
936
+ disabled: _ctx.disabled,
937
+ readonly: _ctx.readonly,
938
+ onInput,
939
+ onKeydown,
940
+ onChange,
941
+ "suffix-icon": unref(search_default)
942
+ }, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly", "suffix-icon"])
943
+ ]),
944
+ _: 3
945
+ }, 512)
946
+ ]),
947
+ _: 3
948
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
949
+ ]),
950
+ _: 3
951
+ }, 8, ["span"]);
952
+ };
786
953
  }
787
- }), je = /* @__PURE__ */ y({
788
- name: "OFormNumber",
789
- inheritAttrs: !1,
954
+ });
955
+ const _sfc_main = /* @__PURE__ */ defineComponent({
956
+ ...{ name: "OFormNumber", inheritAttrs: false },
790
957
  __name: "NumberInput",
791
958
  props: {
792
959
  name: {},
@@ -803,78 +970,91 @@ const We = /* @__PURE__ */ y({
803
970
  step: {},
804
971
  stepStrictly: { type: Boolean },
805
972
  precision: {},
806
- controls: { type: Boolean, default: !0 },
973
+ controls: { type: Boolean, default: true },
807
974
  controlsPosition: {}
808
975
  },
809
- setup(t) {
810
- const i = v(), u = V(), o = T(), l = F({
976
+ setup(__props) {
977
+ const normalizedSpan = useFormItemSpan();
978
+ const normalizedRules = useFormItemRules();
979
+ const formContext = useFormContext();
980
+ const elModel = computed({
811
981
  get: () => {
812
- const a = o.modelValue[t.name];
813
- if (a) {
814
- if (ne(a))
815
- return a;
816
- if (A(a))
817
- return de(a);
818
- throw new W("数字输入框的值只能为字符串或数字类型");
982
+ const value = formContext.modelValue[__props.name];
983
+ if (!value) {
984
+ return void 0;
985
+ }
986
+ if (isNumber(value)) {
987
+ return value;
988
+ } else if (isString(value)) {
989
+ return toNumber(value);
990
+ } else {
991
+ throw new OrionError("数字输入框的值只能为字符串或数字类型");
819
992
  }
820
993
  },
821
- set: (a) => {
822
- a ? o.updateModelValue(t.name, a) : o.updateModelValue(t.name, void 0);
994
+ set: (newValue) => {
995
+ if (!newValue) {
996
+ formContext.updateModelValue(__props.name, void 0);
997
+ } else {
998
+ formContext.updateModelValue(__props.name, newValue);
999
+ }
823
1000
  }
824
1001
  });
825
- return (a, n) => (p(), h(e(g), { span: e(i) }, {
826
- default: d(() => [
827
- f(e(w), {
828
- prop: a.name,
829
- label: a.label,
830
- "label-width": a.labelWidth,
831
- required: a.required,
832
- rules: e(u)
833
- }, {
834
- default: d(() => [
835
- f(e(qe), {
836
- modelValue: l.value,
837
- "onUpdate:modelValue": n[0] || (n[0] = (s) => l.value = s),
838
- placeholder: a.placeholder,
839
- disabled: a.disabled,
840
- readonly: a.readonly,
841
- min: a.min,
842
- max: a.max,
843
- step: a.step,
844
- "step-strictly": a.stepStrictly,
845
- precision: a.precision,
846
- controls: a.controls,
847
- "controls-position": a.controlsPosition,
848
- style: { width: "100%" }
849
- }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "min", "max", "step", "step-strictly", "precision", "controls", "controls-position"])
850
- ]),
851
- _: 1
852
- }, 8, ["prop", "label", "label-width", "required", "rules"])
853
- ]),
854
- _: 1
855
- }, 8, ["span"]));
1002
+ return (_ctx, _cache) => {
1003
+ return openBlock(), createBlock(unref(ElCol), { span: unref(normalizedSpan) }, {
1004
+ default: withCtx(() => [
1005
+ createVNode(unref(ElFormItem), {
1006
+ prop: _ctx.name,
1007
+ label: _ctx.label,
1008
+ "label-width": _ctx.labelWidth,
1009
+ required: _ctx.required,
1010
+ rules: unref(normalizedRules)
1011
+ }, {
1012
+ default: withCtx(() => [
1013
+ createVNode(unref(ElInputNumber), {
1014
+ modelValue: elModel.value,
1015
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => elModel.value = $event),
1016
+ placeholder: _ctx.placeholder,
1017
+ disabled: _ctx.disabled,
1018
+ readonly: _ctx.readonly,
1019
+ min: _ctx.min,
1020
+ max: _ctx.max,
1021
+ step: _ctx.step,
1022
+ "step-strictly": _ctx.stepStrictly,
1023
+ precision: _ctx.precision,
1024
+ controls: _ctx.controls,
1025
+ "controls-position": _ctx.controlsPosition,
1026
+ style: { "width": "100%" }
1027
+ }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "min", "max", "step", "step-strictly", "precision", "controls", "controls-position"])
1028
+ ]),
1029
+ _: 1
1030
+ }, 8, ["prop", "label", "label-width", "required", "rules"])
1031
+ ]),
1032
+ _: 1
1033
+ }, 8, ["span"]);
1034
+ };
856
1035
  }
857
- }), rl = be(We, {
858
- StringInput: ke,
859
- PasswordInput: Re,
860
- Textarea: Ae,
861
- SingleSelect: $e,
862
- MultiSelect: De,
863
- RadioGroup: Ee,
864
- CheckboxGroup: Ie,
865
- Checkbox: Ue,
866
- Switch: Te,
867
- DateInput: Ne,
868
- FileInput: Pe,
869
- ButtonGroup: Ye,
870
- DiyItem: Ge,
871
- LovInput: Le,
872
- NumberInput: je
1036
+ });
1037
+ const index = withInstall(_sfc_main$f, {
1038
+ StringInput: _sfc_main$e,
1039
+ PasswordInput: _sfc_main$d,
1040
+ Textarea: _sfc_main$c,
1041
+ SingleSelect: _sfc_main$b,
1042
+ MultiSelect: _sfc_main$a,
1043
+ RadioGroup: _sfc_main$9,
1044
+ CheckboxGroup: _sfc_main$8,
1045
+ Checkbox: _sfc_main$7,
1046
+ Switch: _sfc_main$6,
1047
+ DateInput: _sfc_main$5,
1048
+ FileInput: _sfc_main$4,
1049
+ ButtonGroup: _sfc_main$3,
1050
+ DiyItem: _sfc_main$2,
1051
+ LovInput: _sfc_main$1,
1052
+ NumberInput: _sfc_main
873
1053
  });
874
1054
  export {
875
- rl as default,
876
- Be as formContextKey,
877
- ze as lovContextKey,
878
- dl as useLov
1055
+ index as default,
1056
+ formContextKey,
1057
+ lovContextKey,
1058
+ default2 as useLov
879
1059
  };
880
1060
  //# sourceMappingURL=index.js.map