orion-design 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/dist/Throne/index.d.ts +2 -10
  2. package/dist/Throne/index.js.map +1 -1
  3. package/dist/components/Button/Button.vue.d.ts +15 -1
  4. package/dist/components/Button/ButtonGroup/ButtonGroup.d.ts +4 -0
  5. package/dist/components/Button/ButtonGroup/ButtonGroup.js +2 -0
  6. package/dist/components/Button/ButtonGroup/ButtonGroup.js.map +1 -0
  7. package/dist/components/Button/ButtonGroup/ButtonGroup.vue.d.ts +17 -0
  8. package/dist/components/Button/ButtonGroup/index.d.ts +1 -0
  9. package/dist/components/Button/ButtonGroup/index.js +2 -0
  10. package/dist/components/Button/ButtonGroup/index.js.map +1 -0
  11. package/dist/components/Button/index.d.ts +20 -1
  12. package/dist/components/Button/index.js +36 -18
  13. package/dist/components/Button/index.js.map +1 -1
  14. package/dist/components/Form/Checkbox/Checkbox.d.ts +0 -1
  15. package/dist/components/Form/DiyItem/DiyItem.d.ts +9 -0
  16. package/dist/components/Form/DiyItem/DiyItem.js +2 -0
  17. package/dist/components/Form/DiyItem/DiyItem.js.map +1 -0
  18. package/dist/components/Form/DiyItem/DiyItem.vue.d.ts +17 -0
  19. package/dist/components/Form/DiyItem/index.d.ts +1 -0
  20. package/dist/components/Form/DiyItem/index.js +2 -0
  21. package/dist/components/Form/DiyItem/index.js.map +1 -0
  22. package/dist/components/Form/FileInput/FileInput.vue.d.ts +1 -1
  23. package/dist/components/Form/Form.d.ts +1 -0
  24. package/dist/components/Form/Form.js.map +1 -1
  25. package/dist/components/Form/Switch/Switch.d.ts +0 -1
  26. package/dist/components/Form/hooks/useForm.d.ts +0 -1
  27. package/dist/components/Form/hooks/useForm.js +28 -28
  28. package/dist/components/Form/hooks/useForm.js.map +1 -1
  29. package/dist/components/Form/index.d.ts +3 -0
  30. package/dist/components/Form/index.js +287 -241
  31. package/dist/components/Form/index.js.map +1 -1
  32. package/dist/components/types.d.ts +11 -0
  33. package/dist/components/types.js +2 -0
  34. package/dist/components/types.js.map +1 -0
  35. package/dist/index.css +1 -1
  36. package/dist/version/version.d.ts +1 -1
  37. package/dist/version/version.js +1 -1
  38. package/dist/version/version.js.map +1 -1
  39. package/package.json +6 -3
@@ -1,17 +1,9 @@
1
1
  import { Ref } from 'vue';
2
- export interface CodeItem {
3
- value: string;
4
- content: string;
5
- }
6
- export type CascadeSysCodeItem = {
7
- value: string;
8
- content: string;
9
- parent?: string;
10
- };
2
+ import { CodeData } from '../components/types';
11
3
  export interface ThroneType {
12
4
  hasAuth: (authId: string) => boolean | null;
13
5
  getIcon: (iconId: string) => () => unknown;
14
- getCode: (codeName: string) => Ref<Array<CodeItem>>;
6
+ getCode: (codeName: string) => Ref<CodeData>;
15
7
  impl: (throne: Partial<ThroneType>) => void;
16
8
  }
17
9
  declare const Throne: ThroneType;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/Throne/index.ts"],"sourcesContent":["import OrionError from '../error/OrionError'\r\nimport type { Ref } from 'vue'\r\n\r\nexport interface CodeItem {\r\n value: string\r\n content: string\r\n}\r\n\r\nexport type CascadeSysCodeItem = {\r\n value: string\r\n content: string\r\n parent?: string\r\n}\r\n\r\nexport interface ThroneType {\r\n hasAuth: (authId: string) => boolean | null\r\n getIcon: (iconId: string) => () => unknown\r\n getCode: (codeName: string) => Ref<Array<CodeItem>>\r\n impl: (throne: Partial<ThroneType>) => void\r\n}\r\n\r\nlet hasAuth: ThroneType['hasAuth'] = () => {\r\n throw new OrionError(`Throne.hasAuth not configured!`)\r\n}\r\n\r\nlet getIcon: ThroneType['getIcon'] = (iconId) => {\r\n throw new OrionError(`Throne.getIcon not configured!`)\r\n}\r\n\r\nlet getCode: ThroneType['getCode'] = (codeName) => {\r\n throw new OrionError(`Throne.getCode not configured!`)\r\n}\r\n\r\nconst Throne: ThroneType = {\r\n hasAuth: (authId) => {\r\n return hasAuth(authId)\r\n },\r\n getIcon: (iconId) => {\r\n return getIcon(iconId)\r\n },\r\n getCode: (codeName) => {\r\n return getCode(codeName)\r\n },\r\n impl: (throne) => {\r\n if (throne.hasAuth) {\r\n hasAuth = throne.hasAuth\r\n }\r\n\r\n if (throne.getIcon) {\r\n getIcon = throne.getIcon\r\n }\r\n\r\n if (throne.getCode) {\r\n getCode = throne.getCode\r\n }\r\n },\r\n}\r\n\r\nexport default Throne\r\n"],"names":["hasAuth","OrionError","getIcon","iconId","getCode","codeName","Throne","authId","throne"],"mappings":";AAqBA,IAAIA,IAAiC,MAAM;AACnC,QAAA,IAAIC,EAAW,gCAAgC;AACvD,GAEIC,IAAiC,CAACC,MAAW;AACzC,QAAA,IAAIF,EAAW,gCAAgC;AACvD,GAEIG,IAAiC,CAACC,MAAa;AAC3C,QAAA,IAAIJ,EAAW,gCAAgC;AACvD;AAEA,MAAMK,IAAqB;AAAA,EACzB,SAAS,CAACC,MACDP,EAAQO,CAAM;AAAA,EAEvB,SAAS,CAACJ,MACDD,EAAQC,CAAM;AAAA,EAEvB,SAAS,CAACE,MACDD,EAAQC,CAAQ;AAAA,EAEzB,MAAM,CAACG,MAAW;AAChB,IAAIA,EAAO,YACTR,IAAUQ,EAAO,UAGfA,EAAO,YACTN,IAAUM,EAAO,UAGfA,EAAO,YACTJ,IAAUI,EAAO;AAAA,EAErB;AACF;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/Throne/index.ts"],"sourcesContent":["import OrionError from '../error/OrionError'\r\nimport type { Ref } from 'vue'\r\n\r\nimport type { CodeData } from '../components/types'\r\n\r\nexport interface ThroneType {\r\n hasAuth: (authId: string) => boolean | null\r\n getIcon: (iconId: string) => () => unknown\r\n getCode: (codeName: string) => Ref<CodeData>\r\n impl: (throne: Partial<ThroneType>) => void\r\n}\r\n\r\nlet hasAuth: ThroneType['hasAuth'] = () => {\r\n throw new OrionError(`Throne.hasAuth not configured!`)\r\n}\r\n\r\nlet getIcon: ThroneType['getIcon'] = (iconId) => {\r\n throw new OrionError(`Throne.getIcon not configured!`)\r\n}\r\n\r\nlet getCode: ThroneType['getCode'] = (codeName) => {\r\n throw new OrionError(`Throne.getCode not configured!`)\r\n}\r\n\r\nconst Throne: ThroneType = {\r\n hasAuth: (authId) => {\r\n return hasAuth(authId)\r\n },\r\n getIcon: (iconId) => {\r\n return getIcon(iconId)\r\n },\r\n getCode: (codeName) => {\r\n return getCode(codeName)\r\n },\r\n impl: (throne) => {\r\n if (throne.hasAuth) {\r\n hasAuth = throne.hasAuth\r\n }\r\n\r\n if (throne.getIcon) {\r\n getIcon = throne.getIcon\r\n }\r\n\r\n if (throne.getCode) {\r\n getCode = throne.getCode\r\n }\r\n },\r\n}\r\n\r\nexport default Throne\r\n"],"names":["hasAuth","OrionError","getIcon","iconId","getCode","codeName","Throne","authId","throne"],"mappings":";AAYA,IAAIA,IAAiC,MAAM;AACnC,QAAA,IAAIC,EAAW,gCAAgC;AACvD,GAEIC,IAAiC,CAACC,MAAW;AACzC,QAAA,IAAIF,EAAW,gCAAgC;AACvD,GAEIG,IAAiC,CAACC,MAAa;AAC3C,QAAA,IAAIJ,EAAW,gCAAgC;AACvD;AAEA,MAAMK,IAAqB;AAAA,EACzB,SAAS,CAACC,MACDP,EAAQO,CAAM;AAAA,EAEvB,SAAS,CAACJ,MACDD,EAAQC,CAAM;AAAA,EAEvB,SAAS,CAACE,MACDD,EAAQC,CAAQ;AAAA,EAEzB,MAAM,CAACG,MAAW;AAChB,IAAIA,EAAO,YACTR,IAAUQ,EAAO,UAGfA,EAAO,YACTN,IAAUM,EAAO,UAGfA,EAAO,YACTJ,IAAUI,EAAO;AAAA,EAErB;AACF;"}
@@ -1,2 +1,16 @@
1
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
1
+ declare function __VLS_template(): {
2
+ slots: {
3
+ default?(_: {}): any;
4
+ };
5
+ refs: {};
6
+ attrs: Partial<{}>;
7
+ };
8
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
9
+ declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
10
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
2
11
  export default _default;
12
+ type __VLS_WithTemplateSlots<T, S> = T & {
13
+ new (): {
14
+ $slots: S;
15
+ };
16
+ };
@@ -0,0 +1,4 @@
1
+ export interface ButtonGroupProps {
2
+ gutter?: boolean | string;
3
+ align?: 'left' | 'center' | 'right';
4
+ }
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=ButtonGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonGroup.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { ButtonGroupProps } from './ButtonGroup';
2
+ declare function __VLS_template(): {
3
+ slots: {
4
+ default?(_: {}): any;
5
+ };
6
+ refs: {};
7
+ attrs: Partial<{}>;
8
+ };
9
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
+ declare const __VLS_component: import('vue').DefineComponent<ButtonGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ButtonGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
12
+ export default _default;
13
+ type __VLS_WithTemplateSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1 @@
1
+ export * from './ButtonGroup';
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,21 @@
1
- declare const _default: import('../_util').SFCWithInstall<import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>> & {};
1
+ import { default as ButtonGroup } from './ButtonGroup/ButtonGroup.vue';
2
+ declare const _default: import('../_util').SFCWithInstall<{
3
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<{}> & Readonly<{}>, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
4
+ P: {};
5
+ B: {};
6
+ D: {};
7
+ C: {};
8
+ M: {};
9
+ Defaults: {};
10
+ }, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, {}>;
11
+ __isFragment?: never;
12
+ __isTeleport?: never;
13
+ __isSuspense?: never;
14
+ } & import('vue').ComponentOptionsBase<Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
15
+ $slots: {
16
+ default?(_: {}): any;
17
+ };
18
+ })> & {
19
+ ButtonGroup: typeof ButtonGroup;
20
+ };
2
21
  export default _default;
@@ -1,27 +1,45 @@
1
1
  import "lodash-es";
2
- import { defineComponent as u, onMounted as c, openBlock as s, createBlock as p, unref as _, withCtx as a, createTextVNode as l } from "vue";
3
- import { withInstall as m } from "../_util/vue/install.js";
4
- import { ElButton as d } from "element-plus";
5
- const f = /* @__PURE__ */ u({
2
+ import { defineComponent as r, openBlock as n, createBlock as p, unref as u, withCtx as l, renderSlot as a, computed as m, createElementBlock as s, normalizeStyle as i, createVNode as c } from "vue";
3
+ import { withInstall as f } from "../_util/vue/install.js";
4
+ import { ElButton as _ } from "element-plus";
5
+ import { S as d } from "../../index-BbsXWo7C.js";
6
+ const g = /* @__PURE__ */ r({
6
7
  name: "OButton",
7
8
  __name: "Button",
8
9
  setup(o) {
9
- return c(() => {
10
- console.log("Button onMounted1");
11
- }), (n, t) => (s(), p(_(d), null, {
12
- default: a(() => t[0] || (t[0] = [
13
- l("XX")
14
- ])),
15
- _: 1
10
+ return (t, e) => (n(), p(u(_), null, {
11
+ default: l(() => [
12
+ a(t.$slots, "default")
13
+ ]),
14
+ _: 3
16
15
  }));
17
16
  }
18
- }), i = (o, n) => {
19
- const t = o.__vccOpts || o;
20
- for (const [e, r] of n)
21
- t[e] = r;
22
- return t;
23
- }, B = /* @__PURE__ */ i(f, [["__scopeId", "data-v-e59d2724"]]), w = m(B);
17
+ }), B = /* @__PURE__ */ r({
18
+ name: "OButtongroup",
19
+ __name: "ButtonGroup",
20
+ props: {
21
+ gutter: { type: [Boolean, String] },
22
+ align: { default: "right" }
23
+ },
24
+ setup(o) {
25
+ const t = m(() => ({
26
+ textAlign: o.align
27
+ }));
28
+ return (e, h) => (n(), s("div", {
29
+ style: i(t.value)
30
+ }, [
31
+ c(u(d), { gutter: e.gutter }, {
32
+ default: l(() => [
33
+ a(e.$slots, "default")
34
+ ]),
35
+ _: 3
36
+ }, 8, ["gutter"])
37
+ ], 4));
38
+ }
39
+ }), v = f(g, {
40
+ ButtonGroup: B
41
+ });
24
42
  export {
25
- w as default
43
+ v as default
26
44
  };
27
45
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Button/Button.vue","../../../src/components/Button/index.ts"],"sourcesContent":["<template>\r\n <el-button>XX</el-button>\r\n</template>\r\n<script setup lang=\"ts\">\r\nimport { onMounted } from 'vue'\r\n\r\nimport { ElButton } from 'element-plus'\r\n\r\ndefineOptions({ name: 'OButton' })\r\n\r\nonMounted(() => {\r\n console.log('Button onMounted1')\r\n})\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.app {\r\n p {\r\n font-size: 32px;\r\n color: aqua;\r\n }\r\n button {\r\n color: red;\r\n }\r\n}\r\n</style>\r\n","import { withInstall } from '../_util'\r\n\r\nimport Button from './Button.vue'\r\n\r\nexport default withInstall<typeof Button, {}>(Button)\r\n"],"names":["onMounted","index","withInstall","Button"],"mappings":";;;;;;;;AAUA,WAAAA,EAAU,MAAM;AACd,cAAQ,IAAI,mBAAmB;AAAA,IAAA,CAChC;;;;;;;;;;;;iECRcC,IAAAC,EAA+BC,CAAM;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Button/ButtonGroup/ButtonGroup.vue","../../../src/components/Button/index.ts"],"sourcesContent":["<template>\r\n <div :style=\"style\">\r\n <space :gutter=\"gutter\"> <slot></slot> </space>\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed, CSSProperties } from 'vue'\r\nimport type { ButtonGroupProps } from './ButtonGroup'\r\nimport Space from '../../Space'\r\n\r\ndefineOptions({ name: 'OButtongroup' })\r\n\r\nconst { gutter, align = 'right' } = defineProps<ButtonGroupProps>()\r\nconst style = computed<CSSProperties>(() => {\r\n return {\r\n textAlign: align\r\n }\r\n})\r\n</script>\r\n","import { withInstall } from '../_util'\r\n\r\nimport Button from './Button.vue'\r\nimport ButtonGroup from './ButtonGroup/ButtonGroup.vue'\r\n\r\nexport default withInstall<typeof Button, { ButtonGroup: typeof ButtonGroup }>(Button, {\r\n ButtonGroup\r\n})\r\n"],"names":["style","computed","__props","index","withInstall","Button","ButtonGroup"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcM,UAAAA,IAAQC,EAAwB,OAC7B;AAAA,MACL,WAAWC;MAEd;;;;;;;;;;;;ICbcC,IAAAC,EAAgEC,GAAQ;AAAA,EAAA,aACrFC;AACF,CAAC;"}
@@ -4,7 +4,6 @@ export interface CheckboxProps {
4
4
  label?: string;
5
5
  span?: number;
6
6
  labelWidth?: string | number;
7
- required?: boolean;
8
7
  rules?: Arrayable<FormItemRule>;
9
8
  disabled?: boolean;
10
9
  }
@@ -0,0 +1,9 @@
1
+ import { FormItemRule, Arrayable } from '../Form';
2
+ export interface DiyItemProps {
3
+ name: string;
4
+ label?: string;
5
+ span?: number;
6
+ labelWidth?: string | number;
7
+ required?: boolean;
8
+ rules?: Arrayable<FormItemRule>;
9
+ }
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=DiyItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiyItem.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { DiyItemProps } from './DiyItem';
2
+ declare function __VLS_template(): {
3
+ slots: {
4
+ default?(_: {}): any;
5
+ };
6
+ refs: {};
7
+ attrs: Partial<{}>;
8
+ };
9
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
+ declare const __VLS_component: import('vue').DefineComponent<DiyItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<DiyItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
12
+ export default _default;
13
+ type __VLS_WithTemplateSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1 @@
1
+ export * from './DiyItem';
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -164,7 +164,7 @@ declare const _default: import('vue').DefineComponent<FileInputProps, {}, {}, {}
164
164
  $root: import('vue').ComponentPublicInstance | null;
165
165
  $parent: import('vue').ComponentPublicInstance | null;
166
166
  $host: Element | null;
167
- $emit: ((event: "input", value: string) => void) & ((event: "clear") => void) & ((event: "focus", evt: FocusEvent) => void) & ((event: "update:modelValue", value: string) => void) & ((event: "blur", evt: FocusEvent) => void) & ((event: "change", value: string) => void) & ((event: "compositionend", evt: CompositionEvent) => void) & ((event: "compositionstart", evt: CompositionEvent) => void) & ((event: "compositionupdate", evt: CompositionEvent) => void) & ((event: "keydown", evt: Event | KeyboardEvent) => void) & ((event: "mouseenter", evt: MouseEvent) => void) & ((event: "mouseleave", evt: MouseEvent) => void);
167
+ $emit: ((event: "input", value: string) => void) & ((event: "clear") => void) & ((event: "focus", evt: FocusEvent) => void) & ((event: "update:modelValue", value: string) => void) & ((event: "change", value: string) => void) & ((event: "blur", evt: FocusEvent) => void) & ((event: "compositionend", evt: CompositionEvent) => void) & ((event: "compositionstart", evt: CompositionEvent) => void) & ((event: "compositionupdate", evt: CompositionEvent) => void) & ((event: "keydown", evt: Event | KeyboardEvent) => void) & ((event: "mouseenter", evt: MouseEvent) => void) & ((event: "mouseleave", evt: MouseEvent) => void);
168
168
  $el: any;
169
169
  $options: import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
170
170
  readonly ariaLabel: StringConstructor;
@@ -17,5 +17,6 @@ export interface FormContext {
17
17
  model: Record<string, any>;
18
18
  rules?: FormRules;
19
19
  itemSpan: number;
20
+ disabled?: boolean;
20
21
  }
21
22
  export declare const formContextKey: InjectionKey<FormContext>;
@@ -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}\r\n\r\nexport const formContextKey: InjectionKey<FormContext> = Symbol('formContextKey')\r\n"],"names":["formContextKey"],"mappings":"AAyBa,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}\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;"}
@@ -4,7 +4,6 @@ export interface SwitchProps {
4
4
  label?: string;
5
5
  span?: number;
6
6
  labelWidth?: string | number;
7
- required?: boolean;
8
7
  rules?: Arrayable<FormItemRule>;
9
8
  disabled?: boolean;
10
9
  }
@@ -1,4 +1,3 @@
1
- import { CodeItem } from '../../../Throne';
2
1
  declare const useFormContext: () => import('..').FormContext | undefined;
3
2
  declare const useFormSpan: () => import('vue').ComputedRef<number>;
4
3
  declare const useFormRules: () => import('vue').ComputedRef<import('element-plus').FormItemRule[]>;
@@ -1,44 +1,44 @@
1
- import { inject as p, getCurrentInstance as s, computed as n } from "vue";
1
+ import { inject as x, getCurrentInstance as s, computed as n } from "vue";
2
2
  import { formContextKey as C } from "../Form.js";
3
3
  import b from "../../../Throne/index.js";
4
- import { castArray as i, isString as g, isArray as x } from "lodash-es";
5
- import { formContextKey as y } from "element-plus";
6
- import l from "../../../error/OrionError.js";
7
- const f = () => p(C), O = () => {
8
- const e = f(), { props: o } = s();
9
- return n(() => o.span ? o.span : e.itemSpan);
10
- }, R = () => {
11
- const e = f(), { props: o } = s(), { name: r, label: m, required: a } = o;
12
- return n(() => {
13
- const t = [];
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
14
  let u = !0;
15
- return a && (o.rules && (t.push(...i(o.rules)), u = !t.some((c) => Object.keys(c).includes("required"))), e.rules && e.rules[r] && (u = !i(e.rules[r]).some((d) => Object.keys(d).includes("required")))), u && t.push({
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
16
  required: !0,
17
- message: `必填项[${m || r}]不能为空`,
18
- trigger: "blur"
19
- }), t;
17
+ message: `必填项[${m || i}]不能为空`,
18
+ trigger: p
19
+ }), o;
20
20
  });
21
- }, S = () => {
22
- const e = p(y), { props: o } = s(), { disabled: r } = o;
23
- return n(() => e.disabled || r);
24
21
  }, k = () => {
22
+ const e = c(), { props: t } = s(), { disabled: r } = t;
23
+ return n(() => e.disabled || r);
24
+ }, A = () => {
25
25
  let e;
26
- const { props: o } = s(), { code: r } = o;
26
+ const { props: t } = s(), { code: r } = t;
27
27
  if (r)
28
- if (g(r))
28
+ if (h(r))
29
29
  e = b.getCode(r).value;
30
- else if (x(r))
30
+ else if (y(r))
31
31
  e = r;
32
32
  else
33
- throw new l("code类型错误");
34
- else throw new l("code为空");
33
+ throw new f("code类型错误");
34
+ else throw new f("code为空");
35
35
  return n(() => e);
36
36
  };
37
37
  export {
38
- k as useFormCode,
39
- f as useFormContext,
40
- S as useFormDisabled,
41
- R as useFormRules,
42
- O as useFormSpan
38
+ A as useFormCode,
39
+ c as useFormContext,
40
+ k as useFormDisabled,
41
+ S as useFormRules,
42
+ R as useFormSpan
43
43
  };
44
44
  //# 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 { formContextKey as elFormContextKey } from 'element-plus'\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 } = getCurrentInstance()!\r\n const { name, label, required } = props\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: 'blur'\r\n })\r\n }\r\n\r\n return rules\r\n })\r\n}\r\n\r\nconst useFormDisabled = () => {\r\n const elForm = inject(elFormContextKey)!\r\n const { props } = getCurrentInstance()!\r\n const { disabled } = props\r\n return computed(() => elForm.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","name","label","required","rules","flag","castArray","rule","useFormDisabled","elForm","elFormContextKey","disabled","useFormCode","codeData","code","isString","Throne","isArray","OrionError"],"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,MAAUC,KACZ,EAAE,MAAAG,GAAM,OAAAC,GAAO,UAAAC,EAAA,IAAaN;AAElC,SAAOE,EAAS,MAAM;AACpB,UAAMK,IAAwB,CAAA;AAC9B,QAAIC,IAAO;AAEX,WAAIF,MACEN,EAAM,UACRO,EAAM,KAAK,GAAGE,EAAUT,EAAM,KAAK,CAAC,GAC7BQ,IAAA,CAACD,EAAM,KAAK,CAACG,MAAS,OAAO,KAAKA,CAAI,EAAE,SAAS,UAAU,CAAC,IAEjEX,EAAY,SAASA,EAAY,MAAMK,CAAc,MAEhDI,IAAA,CADWC,EAAUV,EAAY,MAAMK,CAAc,CAAC,EAC3C,KAAK,CAACM,MAAS,OAAO,KAAKA,CAAI,EAAE,SAAS,UAAU,CAAC,KAIvEF,KACFD,EAAM,KAAK;AAAA,MACT,UAAU;AAAA,MACV,SAAS,OAAOF,KAAgBD,CAAI;AAAA,MACpC,SAAS;AAAA,IAAA,CACV,GAGIG;AAAA,EAAA,CACR;AACH,GAEMI,IAAkB,MAAM;AACtB,QAAAC,IAAShB,EAAOiB,CAAgB,GAChC,EAAE,OAAAb,MAAUC,KACZ,EAAE,UAAAa,EAAa,IAAAd;AACrB,SAAOE,EAAS,MAAMU,EAAO,YAAaE,CAAoB;AAChE,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, { 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;"}
@@ -10,6 +10,7 @@ import { default as Switch } from './Switch/Switch.vue';
10
10
  import { default as DateInput } from './DateInput/DateInput.vue';
11
11
  import { default as FileInput } from './FileInput/FileInput.vue';
12
12
  import { default as ButtonGroup } from './ButtonGroup/ButtonGroup.vue';
13
+ import { default as DiyItem } from './DiyItem/DiyItem.vue';
13
14
  declare const _default: import('../_util').SFCWithInstall<{
14
15
  new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
15
16
  modelValue?: Record<string, any>;
@@ -284,6 +285,7 @@ declare const _default: import('../_util').SFCWithInstall<{
284
285
  DateInput: typeof DateInput;
285
286
  FileInput: typeof FileInput;
286
287
  ButtonGroup: typeof ButtonGroup;
288
+ DiyItem: typeof DiyItem;
287
289
  };
288
290
  export default _default;
289
291
  export * from './Form';
@@ -299,3 +301,4 @@ export * from './Switch';
299
301
  export * from './DateInput';
300
302
  export * from './FileInput';
301
303
  export * from './ButtonGroup';
304
+ export * from './DiyItem';