orion-design 0.1.7 → 0.1.9

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 (43) hide show
  1. package/README.md +5 -5
  2. package/dist/components/Form/FileInput/FileInput.vue.d.ts +1 -1
  3. package/dist/components/Form/Form.d.ts +3 -1
  4. package/dist/components/Form/Form.js.map +1 -1
  5. package/dist/components/Form/Form.vue.d.ts +6 -10
  6. package/dist/components/Form/hooks/useForm.d.ts +5 -1
  7. package/dist/components/Form/hooks/useForm.js +68 -30
  8. package/dist/components/Form/hooks/useForm.js.map +1 -1
  9. package/dist/components/Form/index.d.ts +11 -19
  10. package/dist/components/Form/index.js +285 -295
  11. package/dist/components/Form/index.js.map +1 -1
  12. package/dist/components/_util/arrays.js.map +1 -1
  13. package/dist/components/_util/browser.js.map +1 -1
  14. package/dist/components/_util/dom/aria.js.map +1 -1
  15. package/dist/components/_util/dom/element.js.map +1 -1
  16. package/dist/components/_util/dom/event.js.map +1 -1
  17. package/dist/components/_util/dom/position.js.map +1 -1
  18. package/dist/components/_util/dom/scroll.js.map +1 -1
  19. package/dist/components/_util/dom/style.js.map +1 -1
  20. package/dist/components/_util/easings.js.map +1 -1
  21. package/dist/components/_util/error.js.map +1 -1
  22. package/dist/components/_util/i18n.js.map +1 -1
  23. package/dist/components/_util/objects.js.map +1 -1
  24. package/dist/components/_util/raf.js.map +1 -1
  25. package/dist/components/_util/rand.js.map +1 -1
  26. package/dist/components/_util/strings.js.map +1 -1
  27. package/dist/components/_util/throttleByRaf.js.map +1 -1
  28. package/dist/components/_util/types.js.map +1 -1
  29. package/dist/components/_util/typescript.js.map +1 -1
  30. package/dist/components/_util/vue/global-node.js.map +1 -1
  31. package/dist/components/_util/vue/icon.js.map +1 -1
  32. package/dist/components/_util/vue/install.js.map +1 -1
  33. package/dist/components/_util/vue/props/runtime.js.map +1 -1
  34. package/dist/components/_util/vue/refs.js.map +1 -1
  35. package/dist/components/_util/vue/size.js.map +1 -1
  36. package/dist/components/_util/vue/validator.js.map +1 -1
  37. package/dist/components/_util/vue/vnode.js.map +1 -1
  38. package/dist/components/index.d.ts +1 -0
  39. package/dist/components/index.js.map +1 -1
  40. package/dist/version/version.d.ts +1 -1
  41. package/dist/version/version.js +1 -1
  42. package/dist/version/version.js.map +1 -1
  43. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
- # Vue 3 + TypeScript + Vite
2
-
3
- This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
-
5
- Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
1
+ # Vue 3 + TypeScript + Vite
2
+
3
+ This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
+
5
+ Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
@@ -1,6 +1,6 @@
1
1
  import { FileInputProps } from './FileInput';
2
2
  declare const _default: import('vue').DefineComponent<FileInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FileInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
3
- fileRef: ({
3
+ inputRef: ({
4
4
  $: import('vue').ComponentInternalInstance;
5
5
  $data: {};
6
6
  $props: Partial<{
@@ -9,12 +9,14 @@ export interface FormProps {
9
9
  itemSpan?: number;
10
10
  itemLabelWidth?: string | number;
11
11
  disabled?: boolean;
12
+ modelValue: Record<string, any>;
12
13
  }
13
14
  export interface FormExpose {
14
15
  validate: () => Promise<boolean>;
15
16
  }
16
17
  export interface FormContext {
17
- model: Record<string, any>;
18
+ modelValue: Record<string, any>;
19
+ updateModelValue: (name: string, value: any) => void;
18
20
  rules?: FormRules;
19
21
  itemSpan: number;
20
22
  disabled?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","sources":["../../../src/components/Form/Form.ts"],"sourcesContent":["import type { InjectionKey } from 'vue'\r\nimport type { FormRules as ElFormRules, FormItemRule as ElFormItemRule } from 'element-plus'\r\nimport type { Arrayable as ElArrayable } from 'element-plus/es/utils/typescript'\r\n\r\nexport type FormRules = ElFormRules\r\nexport type FormItemRule = ElFormItemRule\r\nexport type Arrayable<T> = ElArrayable<T>\r\n\r\nexport interface FormProps {\r\n rules?: FormRules\r\n itemSpan?: number\r\n itemLabelWidth?: string | number\r\n disabled?: boolean\r\n}\r\n\r\nexport interface FormExpose {\r\n validate: () => Promise<boolean>\r\n}\r\n\r\nexport interface FormContext {\r\n model: Record<string, any>\r\n rules?: FormRules\r\n itemSpan: number\r\n disabled?: boolean\r\n}\r\n\r\nexport const formContextKey: InjectionKey<FormContext> = Symbol('formContextKey')\r\n"],"names":["formContextKey"],"mappings":"AA0Ba,MAAAA,IAA4C,OAAO,gBAAgB;"}
1
+ {"version":3,"file":"Form.js","sources":["../../../src/components/Form/Form.ts"],"sourcesContent":["import type { InjectionKey } from 'vue'\r\nimport type { FormRules as ElFormRules, FormItemRule as ElFormItemRule } from 'element-plus'\r\nimport type { Arrayable as ElArrayable } from 'element-plus/es/utils/typescript'\r\n\r\nexport type FormRules = ElFormRules\r\nexport type FormItemRule = ElFormItemRule\r\nexport type Arrayable<T> = ElArrayable<T>\r\n\r\nexport interface FormProps {\r\n rules?: FormRules\r\n itemSpan?: number\r\n itemLabelWidth?: string | number\r\n disabled?: boolean\r\n modelValue: Record<string, any>\r\n}\r\n\r\nexport interface FormExpose {\r\n validate: () => Promise<boolean>\r\n}\r\n\r\nexport interface FormContext {\r\n modelValue: Record<string, any>\r\n updateModelValue: (name: string, value: any) => void\r\n rules?: FormRules\r\n itemSpan: number\r\n disabled?: boolean\r\n}\r\n\r\nexport const formContextKey: InjectionKey<FormContext> = Symbol('formContextKey')\r\n"],"names":["formContextKey"],"mappings":"AA4Ba,MAAAA,IAA4C,OAAO,gBAAgB;"}
@@ -1,14 +1,10 @@
1
1
  import { FormProps } from './Form';
2
- declare let __VLS_typeProps: FormProps;
3
- type __VLS_PublicProps = {
4
- modelValue?: Record<string, any>;
5
- } & typeof __VLS_typeProps;
6
2
  declare function __VLS_template(): {
7
3
  slots: {
8
4
  default?(_: {}): any;
9
5
  };
10
6
  refs: {
11
- formRef: ({
7
+ form: ({
12
8
  $: import('vue').ComponentInternalInstance;
13
9
  $data: {};
14
10
  $props: Partial<{
@@ -230,14 +226,14 @@ declare function __VLS_template(): {
230
226
  attrs: Partial<{}>;
231
227
  };
232
228
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
233
- declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {
229
+ declare const __VLS_component: import('vue').DefineComponent<FormProps, {
234
230
  validate: () => Promise<boolean>;
235
231
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
236
- "update:modelValue": (modelValue: Record<string, any>) => any;
237
- }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
238
- "onUpdate:modelValue"?: ((modelValue: Record<string, any>) => any) | undefined;
232
+ "update:modelValue": (...args: any[]) => void;
233
+ }, string, import('vue').PublicProps, Readonly<FormProps> & Readonly<{
234
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
239
235
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
240
- formRef: ({
236
+ form: ({
241
237
  $: import('vue').ComponentInternalInstance;
242
238
  $data: {};
243
239
  $props: Partial<{
@@ -1,6 +1,10 @@
1
+ import { CodeItem } from '../../types';
1
2
  declare const useFormContext: () => import('..').FormContext | undefined;
2
3
  declare const useFormSpan: () => import('vue').ComputedRef<number>;
3
4
  declare const useFormRules: () => import('vue').ComputedRef<import('element-plus').FormItemRule[]>;
4
5
  declare const useFormDisabled: () => import('vue').ComputedRef<boolean>;
5
6
  declare const useFormCode: () => import('vue').ComputedRef<CodeItem[]>;
6
- export { useFormContext, useFormSpan, useFormRules, useFormDisabled, useFormCode };
7
+ declare const useFormDirectModel: () => import('vue').WritableComputedRef<string, string>;
8
+ declare const useFormMultiModel: () => import('vue').WritableComputedRef<string[] | undefined, string[] | undefined>;
9
+ declare const useFormBooleanModel: () => import('vue').WritableComputedRef<boolean, boolean>;
10
+ export { useFormContext, useFormSpan, useFormRules, useFormDisabled, useFormCode, useFormDirectModel, useFormMultiModel, useFormBooleanModel };
@@ -1,44 +1,82 @@
1
1
  import { inject as x, getCurrentInstance as s, computed as n } from "vue";
2
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";
3
+ import M from "../../../Throne/index.js";
4
+ import { castArray as p, isString as V, isArray as F } from "lodash-es";
5
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({
6
+ const u = () => x(C), j = () => {
7
+ const e = u(), { props: r } = s();
8
+ return n(() => r.span ? r.span : e.itemSpan);
9
+ }, q = () => {
10
+ const e = u(), { props: r, type: t } = s(), { name: o, label: l, required: c } = r;
11
+ let d = "change";
12
+ return t.extendOptions && t.extendOptions.trigger && (d = t.extendOptions.trigger), n(() => {
13
+ const i = [];
14
+ let a = !0;
15
+ return c && (r.rules && (i.push(...p(r.rules)), a = !i.some((m) => Object.keys(m).includes("required"))), e.rules && e.rules[o] && (a = !p(e.rules[o]).some((g) => Object.keys(g).includes("required")))), a && i.push({
16
16
  required: !0,
17
- message: `必填项[${m || i}]不能为空`,
18
- trigger: p
19
- }), o;
17
+ message: `必填项[${l || o}]不能为空`,
18
+ trigger: d
19
+ }), i;
20
20
  });
21
- }, k = () => {
22
- const e = c(), { props: t } = s(), { disabled: r } = t;
23
- return n(() => e.disabled || r);
24
- }, A = () => {
21
+ }, D = () => {
22
+ const e = u(), { props: r } = s(), { disabled: t } = r;
23
+ return n(() => e.disabled || t);
24
+ }, R = () => {
25
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;
26
+ const { props: r } = s(), { code: t } = r;
27
+ if (t)
28
+ if (V(t))
29
+ e = M.getCode(t).value;
30
+ else if (F(t))
31
+ e = t;
32
32
  else
33
33
  throw new f("code类型错误");
34
34
  else throw new f("code为空");
35
35
  return n(() => e);
36
+ }, S = () => {
37
+ const e = u(), { props: r } = s(), { name: t } = r;
38
+ return n({
39
+ get: () => {
40
+ const o = e.modelValue[t];
41
+ return o || "";
42
+ },
43
+ set: (o) => {
44
+ o ? e.updateModelValue(t, o) : e.updateModelValue(t, "");
45
+ }
46
+ });
47
+ }, k = () => {
48
+ const e = u(), { props: r } = s(), { name: t } = r;
49
+ return n({
50
+ get: () => {
51
+ const o = e.modelValue[t];
52
+ if (o)
53
+ return o.split(",");
54
+ },
55
+ set: (o) => {
56
+ o ? e.updateModelValue(t, o.join(",")) : e.updateModelValue(t, "");
57
+ }
58
+ });
59
+ }, w = () => {
60
+ const e = u(), { props: r } = s(), { name: t } = r;
61
+ return n({
62
+ get: () => {
63
+ const o = e.modelValue[t];
64
+ return o ? o == "1" : !1;
65
+ },
66
+ set: (o) => {
67
+ const l = e.modelValue[t], c = o ? "1" : "0";
68
+ (l || o) && e.updateModelValue(t, c);
69
+ }
70
+ });
36
71
  };
37
72
  export {
38
- A as useFormCode,
39
- c as useFormContext,
40
- k as useFormDisabled,
41
- S as useFormRules,
42
- R as useFormSpan
73
+ w as useFormBooleanModel,
74
+ R as useFormCode,
75
+ u as useFormContext,
76
+ S as useFormDirectModel,
77
+ D as useFormDisabled,
78
+ k as useFormMultiModel,
79
+ q as useFormRules,
80
+ j as useFormSpan
43
81
  };
44
82
  //# sourceMappingURL=useForm.js.map
@@ -1 +1 @@
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
+ {"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 from '../../../Throne'\r\nimport { CodeItem } from '../../types'\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\nconst useFormDirectModel = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n const { name } = props\r\n\r\n return computed<string>({\r\n get: () => {\r\n const value = formContext.modelValue[name as string]\r\n if (!value) {\r\n return ''\r\n }\r\n return value as string\r\n },\r\n set: (newValue) => {\r\n if (!newValue) {\r\n formContext.updateModelValue(name as string, '')\r\n } else {\r\n formContext.updateModelValue(name as string, newValue)\r\n }\r\n },\r\n })\r\n}\r\n\r\nconst useFormMultiModel = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n const { name } = props\r\n\r\n return computed<string[] | undefined>({\r\n get: () => {\r\n const value = formContext.modelValue[name as string]\r\n if (!value) {\r\n return undefined\r\n }\r\n return (value as string).split(',')\r\n },\r\n set: (newValue) => {\r\n if (!newValue) {\r\n formContext.updateModelValue(name as string, '')\r\n } else {\r\n formContext.updateModelValue(name as string, newValue.join(','))\r\n }\r\n },\r\n })\r\n}\r\n\r\nconst useFormBooleanModel = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n const { name } = props\r\n\r\n return computed<boolean>({\r\n get: () => {\r\n const value = formContext.modelValue[name as string]\r\n if (!value) {\r\n return false\r\n }\r\n return (value as string) == '1'\r\n },\r\n set: (_newValue) => {\r\n const oldValue = formContext.modelValue[name as string]\r\n const newValue = _newValue ? '1' : '0'\r\n if (oldValue) {\r\n formContext.updateModelValue(name as string, newValue)\r\n } else {\r\n if (_newValue) {\r\n formContext.updateModelValue(name as string, newValue)\r\n }\r\n }\r\n },\r\n })\r\n}\r\n\r\nexport { useFormContext, useFormSpan, useFormRules, useFormDisabled, useFormCode, useFormDirectModel, useFormMultiModel, useFormBooleanModel }\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","useFormDirectModel","value","newValue","useFormMultiModel","useFormBooleanModel","_newValue","oldValue"],"mappings":";;;;;AAOA,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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put } from './FileInput/FileInput.vue';
12
12
  import { default as ButtonGroup } from './ButtonGroup/ButtonGroup.vue';
13
13
  import { default as DiyItem } from './DiyItem/DiyItem.vue';
14
14
  declare const _default: import('../_util').SFCWithInstall<{
15
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
16
- modelValue?: Record<string, any>;
17
- } & import('./Form').FormProps> & Readonly<{
18
- "onUpdate:modelValue"?: ((modelValue: Record<string, any>) => any) | undefined;
15
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./Form').FormProps> & Readonly<{
16
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
19
17
  }>, {
20
18
  validate: () => Promise<boolean>;
21
19
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
22
- "update:modelValue": (modelValue: Record<string, any>) => any;
23
- }, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<{
24
- modelValue?: Record<string, any>;
25
- } & import('./Form').FormProps> & Readonly<{
26
- "onUpdate:modelValue"?: ((modelValue: Record<string, any>) => any) | undefined;
20
+ "update:modelValue": (...args: any[]) => void;
21
+ }, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<import('./Form').FormProps> & Readonly<{
22
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
27
23
  }>, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
28
- formRef: ({
24
+ form: ({
29
25
  $: import('vue').ComponentInternalInstance;
30
26
  $data: {};
31
27
  $props: Partial<{
@@ -250,24 +246,20 @@ declare const _default: import('../_util').SFCWithInstall<{
250
246
  C: {};
251
247
  M: {};
252
248
  Defaults: {};
253
- }, Readonly<{
254
- modelValue?: Record<string, any>;
255
- } & import('./Form').FormProps> & Readonly<{
256
- "onUpdate:modelValue"?: ((modelValue: Record<string, any>) => any) | undefined;
249
+ }, Readonly<import('./Form').FormProps> & Readonly<{
250
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
257
251
  }>, {
258
252
  validate: () => Promise<boolean>;
259
253
  }, {}, {}, {}, {}>;
260
254
  __isFragment?: never;
261
255
  __isTeleport?: never;
262
256
  __isSuspense?: never;
263
- } & import('vue').ComponentOptionsBase<Readonly<{
264
- modelValue?: Record<string, any>;
265
- } & import('./Form').FormProps> & Readonly<{
266
- "onUpdate:modelValue"?: ((modelValue: Record<string, any>) => any) | undefined;
257
+ } & import('vue').ComponentOptionsBase<Readonly<import('./Form').FormProps> & Readonly<{
258
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
267
259
  }>, {
268
260
  validate: () => Promise<boolean>;
269
261
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
270
- "update:modelValue": (modelValue: Record<string, any>) => any;
262
+ "update:modelValue": (...args: any[]) => void;
271
263
  }, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
272
264
  $slots: {
273
265
  default?(_: {}): any;