orion-design 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/Throne/index.d.ts +10 -0
  2. package/dist/Throne/index.js +20 -0
  3. package/dist/Throne/index.js.map +1 -0
  4. package/dist/_commonjsHelpers-DaMA6jEr.js +9 -0
  5. package/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
  6. package/dist/components/Button/Button.vue.d.ts +15 -1
  7. package/dist/components/Button/ButtonGroup/ButtonGroup.d.ts +4 -0
  8. package/dist/components/Button/ButtonGroup/ButtonGroup.js +2 -0
  9. package/dist/components/Button/ButtonGroup/ButtonGroup.js.map +1 -0
  10. package/dist/components/Button/ButtonGroup/ButtonGroup.vue.d.ts +17 -0
  11. package/dist/components/Button/ButtonGroup/index.d.ts +1 -0
  12. package/dist/components/Button/ButtonGroup/index.js +2 -0
  13. package/dist/components/Button/ButtonGroup/index.js.map +1 -0
  14. package/dist/components/Button/index.d.ts +21 -4
  15. package/dist/components/Button/index.js +37 -19
  16. package/dist/components/Button/index.js.map +1 -1
  17. package/dist/components/Form/ButtonGroup/ButtonGroup.d.ts +5 -0
  18. package/dist/components/Form/ButtonGroup/ButtonGroup.js +2 -0
  19. package/dist/components/Form/ButtonGroup/ButtonGroup.js.map +1 -0
  20. package/dist/components/Form/ButtonGroup/ButtonGroup.vue.d.ts +17 -0
  21. package/dist/components/Form/ButtonGroup/index.d.ts +1 -0
  22. package/dist/components/Form/ButtonGroup/index.js +2 -0
  23. package/dist/components/Form/ButtonGroup/index.js.map +1 -0
  24. package/dist/components/Form/Checkbox/Checkbox.d.ts +9 -0
  25. package/dist/components/Form/Checkbox/Checkbox.js +2 -0
  26. package/dist/components/Form/Checkbox/Checkbox.js.map +1 -0
  27. package/dist/components/Form/Checkbox/Checkbox.vue.d.ts +3 -0
  28. package/dist/components/Form/Checkbox/index.d.ts +1 -0
  29. package/dist/components/Form/Checkbox/index.js +2 -0
  30. package/dist/components/Form/Checkbox/index.js.map +1 -0
  31. package/dist/components/Form/CheckboxGroup/CheckboxGroup.d.ts +14 -0
  32. package/dist/components/Form/CheckboxGroup/CheckboxGroup.js +2 -0
  33. package/dist/components/Form/CheckboxGroup/CheckboxGroup.js.map +1 -0
  34. package/dist/components/Form/CheckboxGroup/CheckboxGroup.vue.d.ts +3 -0
  35. package/dist/components/Form/CheckboxGroup/index.d.ts +1 -0
  36. package/dist/components/Form/CheckboxGroup/index.js +2 -0
  37. package/dist/components/Form/CheckboxGroup/index.js.map +1 -0
  38. package/dist/components/Form/DateInput/DateInput.d.ts +17 -0
  39. package/dist/components/Form/DateInput/DateInput.js +2 -0
  40. package/dist/components/Form/DateInput/DateInput.js.map +1 -0
  41. package/dist/components/Form/DateInput/DateInput.vue.d.ts +3 -0
  42. package/dist/components/Form/DateInput/index.d.ts +1 -0
  43. package/dist/components/Form/DateInput/index.js +2 -0
  44. package/dist/components/Form/DateInput/index.js.map +1 -0
  45. package/dist/components/Form/DiyItem/DiyItem.d.ts +9 -0
  46. package/dist/components/Form/DiyItem/DiyItem.js +2 -0
  47. package/dist/components/Form/DiyItem/DiyItem.js.map +1 -0
  48. package/dist/components/Form/DiyItem/DiyItem.vue.d.ts +17 -0
  49. package/dist/components/Form/DiyItem/index.d.ts +1 -0
  50. package/dist/components/Form/DiyItem/index.js +2 -0
  51. package/dist/components/Form/DiyItem/index.js.map +1 -0
  52. package/dist/components/Form/FileInput/FileInput.d.ts +10 -0
  53. package/dist/components/Form/FileInput/FileInput.js +2 -0
  54. package/dist/components/Form/FileInput/FileInput.js.map +1 -0
  55. package/dist/components/Form/FileInput/FileInput.vue.d.ts +451 -0
  56. package/dist/components/Form/FileInput/index.d.ts +1 -0
  57. package/dist/components/Form/FileInput/index.js +2 -0
  58. package/dist/components/Form/FileInput/index.js.map +1 -0
  59. package/dist/components/Form/Form.d.ts +1 -0
  60. package/dist/components/Form/Form.js.map +1 -1
  61. package/dist/components/Form/Form.vue.d.ts +10 -10
  62. package/dist/components/Form/MultiSelect/MultiSelect.d.ts +15 -0
  63. package/dist/components/Form/MultiSelect/MultiSelect.js +2 -0
  64. package/dist/components/Form/MultiSelect/MultiSelect.js.map +1 -0
  65. package/dist/components/Form/MultiSelect/MultiSelect.vue.d.ts +3 -0
  66. package/dist/components/Form/MultiSelect/index.d.ts +1 -0
  67. package/dist/components/Form/MultiSelect/index.js +2 -0
  68. package/dist/components/Form/MultiSelect/index.js.map +1 -0
  69. package/dist/components/Form/PasswordInput/PasswordInput.d.ts +0 -2
  70. package/dist/components/Form/RadioGroup/RadioGroup.d.ts +14 -0
  71. package/dist/components/Form/RadioGroup/RadioGroup.js +2 -0
  72. package/dist/components/Form/RadioGroup/RadioGroup.js.map +1 -0
  73. package/dist/components/Form/RadioGroup/RadioGroup.vue.d.ts +3 -0
  74. package/dist/components/Form/RadioGroup/index.d.ts +1 -0
  75. package/dist/components/Form/RadioGroup/index.js +2 -0
  76. package/dist/components/Form/RadioGroup/index.js.map +1 -0
  77. package/dist/components/Form/SingleSelect/SingleSelect.d.ts +17 -0
  78. package/dist/components/Form/SingleSelect/SingleSelect.js +2 -0
  79. package/dist/components/Form/SingleSelect/SingleSelect.js.map +1 -0
  80. package/dist/components/Form/SingleSelect/SingleSelect.vue.d.ts +3 -0
  81. package/dist/components/Form/SingleSelect/index.d.ts +1 -0
  82. package/dist/components/Form/SingleSelect/index.js +2 -0
  83. package/dist/components/Form/SingleSelect/index.js.map +1 -0
  84. package/dist/components/Form/StringInput/StringInput.d.ts +0 -2
  85. package/dist/components/Form/Switch/Switch.d.ts +9 -0
  86. package/dist/components/Form/Switch/Switch.js +2 -0
  87. package/dist/components/Form/Switch/Switch.js.map +1 -0
  88. package/dist/components/Form/Switch/Switch.vue.d.ts +3 -0
  89. package/dist/components/Form/Switch/index.d.ts +1 -0
  90. package/dist/components/Form/Switch/index.js +2 -0
  91. package/dist/components/Form/Switch/index.js.map +1 -0
  92. package/dist/components/Form/Textarea/Textarea.d.ts +0 -2
  93. package/dist/components/Form/hooks/useForm.d.ts +5 -3
  94. package/dist/components/Form/hooks/useForm.js +40 -17
  95. package/dist/components/Form/hooks/useForm.js.map +1 -1
  96. package/dist/components/Form/index.d.ts +37 -6
  97. package/dist/components/Form/index.js +612 -100
  98. package/dist/components/Form/index.js.map +1 -1
  99. package/dist/components/Form/utils/index.d.ts +8 -0
  100. package/dist/components/Form/utils/index.js +26 -0
  101. package/dist/components/Form/utils/index.js.map +1 -0
  102. package/dist/components/Modal/index.d.ts +1 -1
  103. package/dist/components/Pagetable/Pagetable.d.ts +29 -17
  104. package/dist/components/Pagetable/columns/PagetableCellButton.d.ts +24 -0
  105. package/dist/components/Pagetable/columns/PagetableColumnButtongroup.d.ts +78 -0
  106. package/dist/components/Pagetable/columns/{PagetableDatecolumn.d.ts → PagetableColumnDate.d.ts} +17 -4
  107. package/dist/components/Pagetable/columns/PagetableColumnDiy.d.ts +78 -0
  108. package/dist/components/Pagetable/columns/PagetableColumnIndex.d.ts +5 -0
  109. package/dist/components/Pagetable/columns/PagetableColumnMultiselect.d.ts +109 -0
  110. package/dist/components/Pagetable/columns/PagetableColumnNumber.d.ts +114 -0
  111. package/dist/components/Pagetable/columns/PagetableColumnSingleselect.d.ts +109 -0
  112. package/dist/components/Pagetable/columns/{PagetableStringcolumn.d.ts → PagetableColumnString.d.ts} +17 -4
  113. package/dist/components/Pagetable/columns/PagetableColumngroup.d.ts +35 -0
  114. package/dist/components/Pagetable/hooks/useColumns.d.ts +1 -0
  115. package/dist/components/Pagetable/hooks/useColumns.js +96 -0
  116. package/dist/components/Pagetable/hooks/useColumns.js.map +1 -0
  117. package/dist/components/Pagetable/index.d.ts +42 -17
  118. package/dist/components/Pagetable/index.js +496 -119
  119. package/dist/components/Pagetable/index.js.map +1 -1
  120. package/dist/components/Pagetable/utils/index.d.ts +15 -0
  121. package/dist/components/Pagetable/utils/index.js +169 -0
  122. package/dist/components/Pagetable/utils/index.js.map +1 -0
  123. package/dist/components/Space/index.d.ts +3 -3
  124. package/dist/components/_util/type.d.ts +4 -0
  125. package/dist/components/_util/type.js +8 -4
  126. package/dist/components/_util/type.js.map +1 -1
  127. package/dist/components/_util/vue/size.d.ts +1 -1
  128. package/dist/components/components.js +15 -14
  129. package/dist/components/components.js.map +1 -1
  130. package/dist/components/index.js +20 -19
  131. package/dist/components/index.js.map +1 -1
  132. package/dist/components/types.d.ts +11 -0
  133. package/dist/components/types.js +2 -0
  134. package/dist/components/types.js.map +1 -0
  135. package/dist/components-CutWiB7Q.js +68 -0
  136. package/dist/components-CutWiB7Q.js.map +1 -0
  137. package/dist/index-BbsXWo7C.js +44 -0
  138. package/dist/index-BbsXWo7C.js.map +1 -0
  139. package/dist/index.css +1 -1
  140. package/dist/index.d.ts +1 -0
  141. package/dist/index.js +22 -19
  142. package/dist/index.js.map +1 -1
  143. package/dist/utils/md5.js +77 -79
  144. package/dist/utils/md5.js.map +1 -1
  145. package/dist/version/version.d.ts +1 -1
  146. package/dist/version/version.js +1 -1
  147. package/dist/version/version.js.map +1 -1
  148. package/package.json +7 -3
  149. package/dist/components-BZukhWDk.js +0 -106
  150. package/dist/components-BZukhWDk.js.map +0 -1
  151. package/dist/utils/vue/install.d.ts +0 -6
  152. package/dist/utils/vue/install.js +0 -21
  153. package/dist/utils/vue/install.js.map +0 -1
  154. package/dist/utils/vue/typescript.d.ts +0 -5
  155. package/dist/utils/vue/typescript.js +0 -2
  156. package/dist/utils/vue/typescript.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,4 +1,3 @@
1
- import { CSSProperties } from 'vue';
2
1
  import { FormItemRule, Arrayable } from '../Form';
3
2
  export interface PasswordInputProps {
4
3
  name: string;
@@ -11,5 +10,4 @@ export interface PasswordInputProps {
11
10
  placeholder?: string;
12
11
  disabled?: boolean;
13
12
  readonly?: boolean;
14
- style?: CSSProperties;
15
13
  }
@@ -0,0 +1,14 @@
1
+ import { FormItemRule, Arrayable } from '../Form';
2
+ export interface RadioGroupProps {
3
+ name: string;
4
+ label?: string;
5
+ span?: number;
6
+ labelWidth?: string | number;
7
+ required?: boolean;
8
+ rules?: Arrayable<FormItemRule>;
9
+ disabled?: boolean;
10
+ code?: string | Array<{
11
+ value: string;
12
+ content: string;
13
+ }>;
14
+ }
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=RadioGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { RadioGroupProps } from './RadioGroup';
2
+ declare const _default: import('vue').DefineComponent<RadioGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<RadioGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
3
+ export default _default;
@@ -0,0 +1 @@
1
+ export * from './RadioGroup';
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { FormItemRule, Arrayable } from '../Form';
2
+ export interface SingleSelectProps {
3
+ name: string;
4
+ label?: string;
5
+ span?: number;
6
+ labelWidth?: string | number;
7
+ required?: boolean;
8
+ rules?: Arrayable<FormItemRule>;
9
+ placeholder?: string;
10
+ disabled?: boolean;
11
+ code?: string | Array<{
12
+ value: string;
13
+ content: string;
14
+ }>;
15
+ clearable?: boolean;
16
+ filterable?: boolean;
17
+ }
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=SingleSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SingleSelect.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { SingleSelectProps } from './SingleSelect';
2
+ declare const _default: import('vue').DefineComponent<SingleSelectProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SingleSelectProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
3
+ export default _default;
@@ -0,0 +1 @@
1
+ export * from './SingleSelect';
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,4 +1,3 @@
1
- import { CSSProperties } from 'vue';
2
1
  import { FormItemRule, Arrayable } from '../Form';
3
2
  export interface StringInputProps {
4
3
  name: string;
@@ -11,5 +10,4 @@ export interface StringInputProps {
11
10
  placeholder?: string;
12
11
  disabled?: boolean;
13
12
  readonly?: boolean;
14
- style?: CSSProperties;
15
13
  }
@@ -0,0 +1,9 @@
1
+ import { FormItemRule, Arrayable } from '../Form';
2
+ export interface SwitchProps {
3
+ name: string;
4
+ label?: string;
5
+ span?: number;
6
+ labelWidth?: string | number;
7
+ rules?: Arrayable<FormItemRule>;
8
+ disabled?: boolean;
9
+ }
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=Switch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Switch.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { SwitchProps } from './Switch';
2
+ declare const _default: import('vue').DefineComponent<SwitchProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SwitchProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
3
+ export default _default;
@@ -0,0 +1 @@
1
+ export * from './Switch';
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,4 +1,3 @@
1
- import { CSSProperties } from 'vue';
2
1
  import { FormItemRule, Arrayable } from '../Form';
3
2
  export interface TextareaProps {
4
3
  name: string;
@@ -11,6 +10,5 @@ export interface TextareaProps {
11
10
  placeholder?: string;
12
11
  disabled?: boolean;
13
12
  readonly?: boolean;
14
- style?: CSSProperties;
15
13
  rows?: number;
16
14
  }
@@ -1,4 +1,6 @@
1
1
  declare const useFormContext: () => import('..').FormContext | undefined;
2
- declare const useFormSpan: () => number;
3
- declare const useFormRules: () => import('element-plus').FormItemRule[];
4
- export { useFormContext, useFormSpan, useFormRules };
2
+ declare const useFormSpan: () => import('vue').ComputedRef<number>;
3
+ declare const useFormRules: () => import('vue').ComputedRef<import('element-plus').FormItemRule[]>;
4
+ declare const useFormDisabled: () => import('vue').ComputedRef<boolean>;
5
+ declare const useFormCode: () => import('vue').ComputedRef<CodeItem[]>;
6
+ export { useFormContext, useFormSpan, useFormRules, useFormDisabled, useFormCode };
@@ -1,21 +1,44 @@
1
- import { inject as a, getCurrentInstance as c } from "vue";
2
- import { formContextKey as f } from "../Form.js";
3
- import { castArray as m } from "lodash-es";
4
- const l = () => a(f), C = () => {
5
- const r = l(), { props: e } = c();
6
- return e.span ? e.span : r.itemSpan;
7
- }, b = () => {
8
- const r = l(), { props: e } = c(), { name: s, label: n, required: i } = e, t = [];
9
- let o = !0;
10
- return i && (e.rules && (t.push(...m(e.rules)), o = !t.some((u) => Object.keys(u).includes("required"))), r.rules && r.rules[s] && (o = !m(r.rules[s]).some((p) => Object.keys(p).includes("required")))), o && t.push({
11
- required: !0,
12
- message: `必填项[${n || s}]不能为空`,
13
- trigger: "blur"
14
- }), t;
1
+ import { inject as x, getCurrentInstance as s, computed as n } from "vue";
2
+ import { formContextKey as C } from "../Form.js";
3
+ import b from "../../../Throne/index.js";
4
+ import { castArray as d, isString as h, isArray as y } from "lodash-es";
5
+ import f from "../../../error/OrionError.js";
6
+ const c = () => x(C), R = () => {
7
+ const e = c(), { props: t } = s();
8
+ return n(() => t.span ? t.span : e.itemSpan);
9
+ }, S = () => {
10
+ const e = c(), { props: t, type: r } = s(), { name: i, label: m, required: a } = t;
11
+ let p = "change";
12
+ return r.extendOptions && r.extendOptions.trigger && (p = r.extendOptions.trigger), n(() => {
13
+ const o = [];
14
+ let u = !0;
15
+ return a && (t.rules && (o.push(...d(t.rules)), u = !o.some((l) => Object.keys(l).includes("required"))), e.rules && e.rules[i] && (u = !d(e.rules[i]).some((g) => Object.keys(g).includes("required")))), u && o.push({
16
+ required: !0,
17
+ message: `必填项[${m || i}]不能为空`,
18
+ trigger: p
19
+ }), o;
20
+ });
21
+ }, k = () => {
22
+ const e = c(), { props: t } = s(), { disabled: r } = t;
23
+ return n(() => e.disabled || r);
24
+ }, A = () => {
25
+ let e;
26
+ const { props: t } = s(), { code: r } = t;
27
+ if (r)
28
+ if (h(r))
29
+ e = b.getCode(r).value;
30
+ else if (y(r))
31
+ e = r;
32
+ else
33
+ throw new f("code类型错误");
34
+ else throw new f("code为空");
35
+ return n(() => e);
15
36
  };
16
37
  export {
17
- l as useFormContext,
18
- b as useFormRules,
19
- C as useFormSpan
38
+ A as useFormCode,
39
+ c as useFormContext,
40
+ k as useFormDisabled,
41
+ S as useFormRules,
42
+ R as useFormSpan
20
43
  };
21
44
  //# sourceMappingURL=useForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useForm.js","sources":["../../../../src/components/Form/hooks/useForm.ts"],"sourcesContent":["import { inject, getCurrentInstance } from 'vue'\r\nimport { formContextKey, FormItemRule } from '../Form'\r\nimport { castArray } from 'lodash-es'\r\n\r\nconst useFormContext = () => {\r\n return inject(formContextKey)\r\n}\r\n\r\nconst useFormSpan = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n\r\n let span = props.span ? (props.span as number) : formContext.itemSpan\r\n\r\n return span\r\n}\r\n\r\nconst useFormRules = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n const { name, label, required } = props\r\n\r\n const rules: FormItemRule[] = []\r\n let flag = true\r\n\r\n if (required) {\r\n if (props.rules) {\r\n rules.push(...castArray(props.rules))\r\n flag = !rules.some((rule) => Object.keys(rule).includes('required'))\r\n }\r\n if (formContext.rules && formContext.rules[name as string]) {\r\n const formRules = castArray(formContext.rules[name as string])\r\n flag = !formRules.some((rule) => Object.keys(rule).includes('required'))\r\n }\r\n }\r\n\r\n if (flag) {\r\n rules.push({\r\n required: true,\r\n message: `必填项[${label ? label : name}]不能为空`,\r\n trigger: 'blur'\r\n })\r\n }\r\n\r\n return rules\r\n}\r\n\r\nexport { useFormContext, useFormSpan, useFormRules }\r\n"],"names":["useFormContext","inject","formContextKey","useFormSpan","formContext","props","getCurrentInstance","useFormRules","name","label","required","rules","flag","castArray","rule"],"mappings":";;;AAIA,MAAMA,IAAiB,MACdC,EAAOC,CAAc,GAGxBC,IAAc,MAAM;AACxB,QAAMC,IAAcJ,KACd,EAAE,OAAAK,MAAUC;AAIX,SAFID,EAAM,OAAQA,EAAM,OAAkBD,EAAY;AAG/D,GAEMG,IAAe,MAAM;AACzB,QAAMH,IAAcJ,KACd,EAAE,OAAAK,MAAUC,KACZ,EAAE,MAAAE,GAAM,OAAAC,GAAO,UAAAC,EAAA,IAAaL,GAE5BM,IAAwB,CAAA;AAC9B,MAAIC,IAAO;AAEX,SAAIF,MACEL,EAAM,UACRM,EAAM,KAAK,GAAGE,EAAUR,EAAM,KAAK,CAAC,GAC7BO,IAAA,CAACD,EAAM,KAAK,CAACG,MAAS,OAAO,KAAKA,CAAI,EAAE,SAAS,UAAU,CAAC,IAEjEV,EAAY,SAASA,EAAY,MAAMI,CAAc,MAEhDI,IAAA,CADWC,EAAUT,EAAY,MAAMI,CAAc,CAAC,EAC3C,KAAK,CAACM,MAAS,OAAO,KAAKA,CAAI,EAAE,SAAS,UAAU,CAAC,KAIvEF,KACFD,EAAM,KAAK;AAAA,IACT,UAAU;AAAA,IACV,SAAS,OAAOF,KAAgBD,CAAI;AAAA,IACpC,SAAS;AAAA,EAAA,CACV,GAGIG;AACT;"}
1
+ {"version":3,"file":"useForm.js","sources":["../../../../src/components/Form/hooks/useForm.ts"],"sourcesContent":["import { inject, getCurrentInstance, computed } from 'vue'\r\nimport { formContextKey, FormItemRule } from '../Form'\r\nimport Throne, { CodeItem } from '../../../Throne'\r\nimport { castArray, isArray, isString } from 'lodash-es'\r\nimport OrionError from '../../../error/OrionError'\r\n\r\nconst useFormContext = () => {\r\n return inject(formContextKey)\r\n}\r\n\r\nconst useFormSpan = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n\r\n return computed(() => (props.span ? (props.span as number) : formContext.itemSpan))\r\n}\r\n\r\nconst useFormRules = () => {\r\n const formContext = useFormContext()!\r\n const { props, type } = getCurrentInstance()!\r\n const { name, label, required } = props\r\n let trigger = 'change'\r\n if (type['extendOptions'] && type['extendOptions']['trigger']) {\r\n trigger = type['extendOptions']['trigger']\r\n }\r\n\r\n return computed(() => {\r\n const rules: FormItemRule[] = []\r\n let flag = true\r\n\r\n if (required) {\r\n if (props.rules) {\r\n rules.push(...castArray(props.rules))\r\n flag = !rules.some((rule) => Object.keys(rule).includes('required'))\r\n }\r\n if (formContext.rules && formContext.rules[name as string]) {\r\n const formRules = castArray(formContext.rules[name as string])\r\n flag = !formRules.some((rule) => Object.keys(rule).includes('required'))\r\n }\r\n }\r\n\r\n if (flag) {\r\n rules.push({\r\n required: true,\r\n message: `必填项[${label ? label : name}]不能为空`,\r\n trigger: trigger\r\n })\r\n }\r\n\r\n return rules\r\n })\r\n}\r\n\r\nconst useFormDisabled = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n const { disabled } = props\r\n return computed(() => formContext.disabled || (disabled as boolean))\r\n}\r\n\r\nconst useFormCode = () => {\r\n let codeData: Array<CodeItem>\r\n const { props } = getCurrentInstance()!\r\n const { code } = props\r\n if (!code) {\r\n throw new OrionError('code为空')\r\n } else if (isString(code)) {\r\n codeData = Throne.getCode(code).value\r\n } else if (isArray<CodeItem>(code)) {\r\n codeData = code\r\n } else {\r\n throw new OrionError('code类型错误')\r\n }\r\n return computed(() => codeData)\r\n}\r\n\r\nexport { useFormContext, useFormSpan, useFormRules, useFormDisabled, useFormCode }\r\n"],"names":["useFormContext","inject","formContextKey","useFormSpan","formContext","props","getCurrentInstance","computed","useFormRules","type","name","label","required","trigger","rules","flag","castArray","rule","useFormDisabled","disabled","useFormCode","codeData","code","isString","Throne","isArray","OrionError"],"mappings":";;;;;AAMA,MAAMA,IAAiB,MACdC,EAAOC,CAAc,GAGxBC,IAAc,MAAM;AACxB,QAAMC,IAAcJ,KACd,EAAE,OAAAK,MAAUC;AAElB,SAAOC,EAAS,MAAOF,EAAM,OAAQA,EAAM,OAAkBD,EAAY,QAAS;AACpF,GAEMI,IAAe,MAAM;AACzB,QAAMJ,IAAcJ,KACd,EAAE,OAAAK,GAAO,MAAAI,EAAK,IAAIH,EAAmB,GACrC,EAAE,MAAAI,GAAM,OAAAC,GAAO,UAAAC,EAAA,IAAaP;AAClC,MAAIQ,IAAU;AACd,SAAIJ,EAAK,iBAAoBA,EAAK,cAAiB,YACvCI,IAAAJ,EAAK,cAAiB,UAG3BF,EAAS,MAAM;AACpB,UAAMO,IAAwB,CAAA;AAC9B,QAAIC,IAAO;AAEX,WAAIH,MACEP,EAAM,UACRS,EAAM,KAAK,GAAGE,EAAUX,EAAM,KAAK,CAAC,GAC7BU,IAAA,CAACD,EAAM,KAAK,CAACG,MAAS,OAAO,KAAKA,CAAI,EAAE,SAAS,UAAU,CAAC,IAEjEb,EAAY,SAASA,EAAY,MAAMM,CAAc,MAEhDK,IAAA,CADWC,EAAUZ,EAAY,MAAMM,CAAc,CAAC,EAC3C,KAAK,CAACO,MAAS,OAAO,KAAKA,CAAI,EAAE,SAAS,UAAU,CAAC,KAIvEF,KACFD,EAAM,KAAK;AAAA,MACT,UAAU;AAAA,MACV,SAAS,OAAOH,KAAgBD,CAAI;AAAA,MACpC,SAAAG;AAAA,IAAA,CACD,GAGIC;AAAA,EAAA,CACR;AACH,GAEMI,IAAkB,MAAM;AAC5B,QAAMd,IAAcJ,KACd,EAAE,OAAAK,MAAUC,KACZ,EAAE,UAAAa,EAAa,IAAAd;AACrB,SAAOE,EAAS,MAAMH,EAAY,YAAae,CAAoB;AACrE,GAEMC,IAAc,MAAM;AACpB,MAAAC;AACE,QAAA,EAAE,OAAAhB,MAAUC,KACZ,EAAE,MAAAgB,EAAS,IAAAjB;AACjB,MAAKiB;AAEL,QAAWC,EAASD,CAAI;AACX,MAAAD,IAAAG,EAAO,QAAQF,CAAI,EAAE;AAAA,aACvBG,EAAkBH,CAAI;AACpB,MAAAD,IAAAC;AAAA;AAEL,YAAA,IAAII,EAAW,UAAU;AAAA,MANzB,OAAA,IAAIA,EAAW,QAAQ;AAQxB,SAAAnB,EAAS,MAAMc,CAAQ;AAChC;"}
@@ -1,7 +1,17 @@
1
1
  import { default as StringInput } from './StringInput/StringInput.vue';
2
2
  import { default as PasswordInput } from './PasswordInput/PasswordInput.vue';
3
3
  import { default as Textarea } from './Textarea/Textarea.vue';
4
- declare const _default: import('../../utils/vue/typescript').SFCWithInstall<{
4
+ import { default as SingleSelect } from './SingleSelect/SingleSelect.vue';
5
+ import { default as MultiSelect } from './MultiSelect/MultiSelect.vue';
6
+ import { default as RadioGroup } from './RadioGroup/RadioGroup.vue';
7
+ import { default as CheckboxGroup } from './CheckboxGroup/CheckboxGroup.vue';
8
+ import { default as Checkbox } from './Checkbox/Checkbox.vue';
9
+ import { default as Switch } from './Switch/Switch.vue';
10
+ import { default as DateInput } from './DateInput/DateInput.vue';
11
+ import { default as FileInput } from './FileInput/FileInput.vue';
12
+ import { default as ButtonGroup } from './ButtonGroup/ButtonGroup.vue';
13
+ import { default as DiyItem } from './DiyItem/DiyItem.vue';
14
+ declare const _default: import('../_util').SFCWithInstall<{
5
15
  new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
6
16
  modelValue?: Record<string, any>;
7
17
  } & import('./Form').FormProps> & Readonly<{
@@ -32,19 +42,19 @@ declare const _default: import('../../utils/vue/typescript').SFCWithInstall<{
32
42
  readonly hideRequiredAsterisk: boolean;
33
43
  readonly scrollToError: boolean;
34
44
  }> & Omit<{
45
+ readonly inline: boolean;
35
46
  readonly disabled: boolean;
36
- readonly labelPosition: import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "left" | "right" | "top", unknown>;
47
+ readonly labelPosition: import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "top" | "left" | "right", unknown>;
37
48
  readonly requireAsteriskPosition: import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "left" | "right", unknown>;
38
49
  readonly labelWidth: import('element-plus/es/utils/index.mjs').EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
39
50
  readonly labelSuffix: string;
40
- readonly inline: boolean;
41
51
  readonly inlineMessage: boolean;
42
52
  readonly statusIcon: boolean;
43
53
  readonly showMessage: import('element-plus/es/utils/index.mjs').EpPropMergeType<BooleanConstructor, unknown, unknown>;
44
54
  readonly validateOnRuleChange: import('element-plus/es/utils/index.mjs').EpPropMergeType<BooleanConstructor, unknown, unknown>;
45
55
  readonly hideRequiredAsterisk: boolean;
46
56
  readonly scrollToError: boolean;
47
- readonly size?: import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", unknown> | undefined;
57
+ readonly size?: import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", unknown> | undefined;
48
58
  readonly rules?: Partial<Record<string, import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemRule>>> | undefined;
49
59
  readonly model?: Record<string, any> | undefined;
50
60
  readonly scrollIntoViewOptions?: import('element-plus/es/utils/index.mjs').EpPropMergeType<readonly [ObjectConstructor, BooleanConstructor], unknown, unknown> | undefined;
@@ -83,7 +93,7 @@ declare const _default: import('../../utils/vue/typescript').SFCWithInstall<{
83
93
  readonly disabled: BooleanConstructor;
84
94
  }>> & {
85
95
  onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
86
- }, "disabled" | "labelPosition" | "requireAsteriskPosition" | "labelWidth" | "labelSuffix" | "inline" | "inlineMessage" | "statusIcon" | "showMessage" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError">;
96
+ }, "inline" | "disabled" | "labelPosition" | "requireAsteriskPosition" | "labelWidth" | "labelSuffix" | "inlineMessage" | "statusIcon" | "showMessage" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError">;
87
97
  $attrs: {
88
98
  [x: string]: unknown;
89
99
  };
@@ -221,7 +231,7 @@ declare const _default: import('../../utils/vue/typescript').SFCWithInstall<{
221
231
  readonly disabled: BooleanConstructor;
222
232
  }>> & {
223
233
  onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
224
- }, "disabled" | "validate" | "labelPosition" | "requireAsteriskPosition" | "labelWidth" | "labelSuffix" | "inline" | "inlineMessage" | "statusIcon" | "showMessage" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "fields"> & import('vue').ShallowUnwrapRef<{
234
+ }, "inline" | "disabled" | "validate" | "labelPosition" | "requireAsteriskPosition" | "labelWidth" | "labelSuffix" | "inlineMessage" | "statusIcon" | "showMessage" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "fields"> & import('vue').ShallowUnwrapRef<{
225
235
  validate: (callback?: import('element-plus').FormValidateCallback | undefined) => import('element-plus').FormValidationResult;
226
236
  validateField: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp> | undefined, callback?: import('element-plus').FormValidateCallback | undefined) => import('element-plus').FormValidationResult;
227
237
  resetFields: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp> | undefined) => void;
@@ -266,8 +276,29 @@ declare const _default: import('../../utils/vue/typescript').SFCWithInstall<{
266
276
  StringInput: typeof StringInput;
267
277
  PasswordInput: typeof PasswordInput;
268
278
  Textarea: typeof Textarea;
279
+ SingleSelect: typeof SingleSelect;
280
+ MultiSelect: typeof MultiSelect;
281
+ RadioGroup: typeof RadioGroup;
282
+ CheckboxGroup: typeof CheckboxGroup;
283
+ Checkbox: typeof Checkbox;
284
+ Switch: typeof Switch;
285
+ DateInput: typeof DateInput;
286
+ FileInput: typeof FileInput;
287
+ ButtonGroup: typeof ButtonGroup;
288
+ DiyItem: typeof DiyItem;
269
289
  };
270
290
  export default _default;
271
291
  export * from './Form';
272
292
  export * from './StringInput';
273
293
  export * from './PasswordInput';
294
+ export * from './Textarea';
295
+ export * from './SingleSelect';
296
+ export * from './MultiSelect';
297
+ export * from './RadioGroup';
298
+ export * from './CheckboxGroup';
299
+ export * from './Checkbox';
300
+ export * from './Switch';
301
+ export * from './DateInput';
302
+ export * from './FileInput';
303
+ export * from './ButtonGroup';
304
+ export * from './DiyItem';