@shaonq/vue 1.1.9 → 1.1.11

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 (3) hide show
  1. package/lib/index.d.ts +323 -64
  2. package/lib/index.js +1802 -1427
  3. package/package.json +1 -1
package/lib/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { App } from 'vue';
2
+ import { Button } from '@arco-design/web-vue';
3
+ import { Component } from 'vue';
2
4
  import { ComponentOptionsMixin } from 'vue';
3
5
  import { DefineComponent } from 'vue';
4
6
  import { ExtractPropTypes } from 'vue';
7
+ import { Modal } from '@arco-design/web-vue';
5
8
  import { PropType } from 'vue';
6
9
  import { PublicProps } from 'vue';
7
10
  import { Ref } from 'vue';
@@ -18,10 +21,22 @@ import { VxeToolbarInstance } from 'vxe-table';
18
21
 
19
22
  declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
20
23
 
24
+ declare type __VLS_NonUndefinedable_2<T> = T extends undefined ? never : T;
25
+
26
+ declare type __VLS_NonUndefinedable_3<T> = T extends undefined ? never : T;
27
+
21
28
  declare type __VLS_Prettify<T> = {
22
29
  [K in keyof T]: T[K];
23
30
  } & {};
24
31
 
32
+ declare type __VLS_Prettify_2<T> = {
33
+ [K in keyof T]: T[K];
34
+ } & {};
35
+
36
+ declare type __VLS_Prettify_3<T> = {
37
+ [K in keyof T]: T[K];
38
+ } & {};
39
+
25
40
  declare type __VLS_TypePropsToRuntimeProps<T> = {
26
41
  [K in keyof T]-?: {} extends Pick<T, K> ? {
27
42
  type: PropType<__VLS_NonUndefinedable<T[K]>>;
@@ -31,12 +46,42 @@ declare type __VLS_TypePropsToRuntimeProps<T> = {
31
46
  };
32
47
  };
33
48
 
49
+ declare type __VLS_TypePropsToRuntimeProps_2<T> = {
50
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
51
+ type: PropType<__VLS_NonUndefinedable_2<T[K]>>;
52
+ } : {
53
+ type: PropType<T[K]>;
54
+ required: true;
55
+ };
56
+ };
57
+
58
+ declare type __VLS_TypePropsToRuntimeProps_3<T> = {
59
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
60
+ type: PropType<__VLS_NonUndefinedable_3<T[K]>>;
61
+ } : {
62
+ type: PropType<T[K]>;
63
+ required: true;
64
+ };
65
+ };
66
+
34
67
  declare type __VLS_WithDefaults<P, D> = {
35
68
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
36
69
  default: D[K];
37
70
  }> : P[K];
38
71
  };
39
72
 
73
+ declare type __VLS_WithDefaults_2<P, D> = {
74
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify_2<P[K] & {
75
+ default: D[K];
76
+ }> : P[K];
77
+ };
78
+
79
+ declare type __VLS_WithDefaults_3<P, D> = {
80
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify_3<P[K] & {
81
+ default: D[K];
82
+ }> : P[K];
83
+ };
84
+
40
85
  declare type __VLS_WithTemplateSlots<T, S> = T & {
41
86
  new (): {
42
87
  $slots: S;
@@ -55,18 +100,34 @@ declare type __VLS_WithTemplateSlots_3<T, S> = T & {
55
100
  };
56
101
  };
57
102
 
103
+ declare type __VLS_WithTemplateSlots_4<T, S> = T & {
104
+ new (): {
105
+ $slots: S;
106
+ };
107
+ };
108
+
109
+ declare type __VLS_WithTemplateSlots_5<T, S> = T & {
110
+ new (): {
111
+ $slots: S;
112
+ };
113
+ };
114
+
115
+ declare type __VLS_WithTemplateSlots_6<T, S> = T & {
116
+ new (): {
117
+ $slots: S;
118
+ };
119
+ };
120
+
121
+ declare type ButtonInstance = InstanceType<typeof Button>;
122
+
58
123
  declare interface CssType extends Partial<CSSStyleDeclaration>, RecordAny_2 {
59
124
  }
60
125
 
61
- export declare const deepClone: <T = RecordAny | RecordAny[]>(origin: T) => T;
62
-
63
126
  declare const _default: {
64
127
  install(Vue: App): void;
65
128
  };
66
129
  export default _default;
67
130
 
68
- export declare const download: (url: string, fileName?: string) => boolean;
69
-
70
131
  /**
71
132
  * @param name 下载名称
72
133
  * @param element HTMLElement
@@ -75,7 +136,7 @@ export declare const download: (url: string, fileName?: string) => boolean;
75
136
  * @param {string} option.className 例 class = 'one-page-pdf' ,大量打印必填
76
137
  * @param {string} option.success successCallback worker:any => void
77
138
  */
78
- export declare function downLoadPdf(name: string, element: HTMLElement, option?: {
139
+ declare function downLoadPdf(name: string, element: HTMLElement, option?: {
79
140
  /** `pdf page margin`: `[top, left, bottom, right]` */
80
141
  margin?: number[];
81
142
  /** 启用 `worker` */
@@ -94,49 +155,82 @@ export declare function downLoadPdf(name: string, element: HTMLElement, option?:
94
155
  jsPDF?: any;
95
156
  } & RecordAny): Promise<void>;
96
157
 
97
- export declare function findObject<T extends RecordAny>(obj: T, keys?: string | string[]): T;
158
+ declare function findObject<T extends RecordAny>(obj: T, keys?: string | string[]): T;
98
159
 
99
- /** 行数据格式化 千分位|日期 */
100
- export declare const formatTable: {
101
- /** 千分位|保留小数 */
102
- tf: (val: any, digits?: any) => any;
103
- /** 快捷格式化日期 */
104
- t: (val: any) => string;
105
- /** 完整格式化日期 yyyy-MM-dd HH:mm:ss */
106
- time: (val: any, f?: string) => string;
107
- /** percent 格式化百分比 */
108
- p: (val: any, digits?: any, percent?: string) => string;
160
+ /** 描述表单项的属性。 */
161
+ declare type FormItemType = {
162
+ /**
163
+ * 可以使使用的 Arco 组件类型 也可以使用自定义组件
164
+ * @example 'a-input', 'a-select' 等。
165
+ */
166
+ type?: string | Component;
167
+ /** 表单项的文本名称或标题 */
168
+ name: string;
169
+ /** 用于双向数据绑定的模型属性 */
170
+ model: string;
171
+ /** 控制表单项是否显示。 */
172
+ show?: boolean;
173
+ /** 表单项的默认值 */
174
+ defaultValue?: any;
175
+ /** 触发验证的时机 */
176
+ validateTrigger?: 'change' | 'input' | 'focus' | 'blur';
177
+ /** 组件属性对象 */
178
+ componentAttr?: Record<string, any>;
179
+ /** 自定义类名,可以是字符串或函数 */
180
+ customClass?: string | ((itemConfig: FormItemType, models: Record<string, any>) => string);
181
+ /** 开启多选 转义[a,b]=>'a,b' ,默认组件支持请开启 componentAttr:{multiple:true} */
182
+ dotNotation?: boolean;
183
+ /** 数据字典键名 */
184
+ datadict?: string;
185
+ /** 配置项 */
186
+ options?: {
187
+ /** 必填 */
188
+ required?: boolean;
189
+ /** 栅格 24 */
190
+ span?: number;
191
+ /** 禁用 */
192
+ disabled?: boolean;
193
+ /** 占位符 */
194
+ placeholder?: string;
195
+ /** 帮助文案 */
196
+ help?: string;
197
+ /** 提示信息 */
198
+ tooltip?: string;
199
+ };
200
+ /** 验证规则 */
201
+ rules?: Record<string, any>[];
202
+ /** 事件处理器 */
203
+ events?: {
204
+ /** 组件挂载后执行 */
205
+ onMounted?: (util: FormUtilType & FormItemType['events']) => any | Promise<any>;
206
+ /** 值改变时触发 */
207
+ onChange?: (val: any, util: FormUtilType & FormItemType['events']) => void | Promise<void>;
208
+ /** watch 更新时触发 */
209
+ onUpdate?: (val: any, oldVal: any, util: FormUtilType & FormItemType['events']) => void | Promise<void>;
210
+ };
211
+ /** 扩展字符 */
212
+ note?: string;
109
213
  };
110
214
 
111
- /** 生成二维码 base64 */
112
- export declare function generateQRcodeBase64(options: RecordAny): string;
113
-
114
- /**
115
- * get path object
116
- * @example
117
- * ```
118
- * getData({a:{b:1}},'a.b')
119
- * // 1
120
- * ```
121
- */
122
- export declare function getData(object: RecordAny, path: string, defaultValue?: any): any;
123
-
124
- export declare const getUniqueId: () => string;
125
-
126
- /** isArray */
127
- export declare function isArray(obj: any): obj is any[];
128
-
129
- /** 是否是空数组 */
130
- export declare function isEmptyArray(obj: any): boolean;
131
-
132
- /** 是否是空对象 */
133
- export declare function isEmptyObject(obj: any): boolean;
215
+ declare type FormSubmitEvent = {
216
+ data: Record<string, any>;
217
+ utils: {
218
+ setVisible: (a: boolean) => void;
219
+ setLoading: (a: boolean) => void;
220
+ };
221
+ };
134
222
 
135
- /** isNumber */
136
- export declare function isNumber(obj: any): obj is number;
223
+ declare type FormUtilType = {
224
+ getModelOption: (model: string) => any;
225
+ getModel: (model: string) => any;
226
+ getShow: (model: string) => boolean;
227
+ setModelOption: (model: string, val: any) => void;
228
+ setModel: (c: string | Record<string, any>, v?: any) => void;
229
+ setShow: (model: string, val: boolean) => void;
230
+ };
137
231
 
138
- /** isObject */
139
- export declare function isObject(value: unknown): value is Record<string, any>;
232
+ /** 生成二维码 base64 */
233
+ declare function generateQRcodeBase64(options: RecordAny): string;
140
234
 
141
235
  export declare const locale: {
142
236
  enUS: {
@@ -524,12 +618,16 @@ export declare const locale: {
524
618
  };
525
619
 
526
620
  /** 日志 */
527
- export declare function log(...args: any[]): void;
621
+ declare function log(...args: any[]): void;
622
+
623
+ declare function mergeConfig(defaults: RecordAny, overrides: RecordAny, isRoot?: boolean): RecordAny;
528
624
 
529
- export declare function mergeConfig(defaults: RecordAny, overrides: RecordAny, isRoot?: boolean): RecordAny;
625
+ declare type ModalInstance = InstanceType<typeof Modal>;
530
626
 
531
627
  /** omit object */
532
- export declare function omitObject<T extends RecordAny>(obj: T, keys?: string | string[]): T;
628
+ declare function omitObject<T extends RecordAny>(obj: T, keys?: string | string[]): T;
629
+
630
+ declare function onSubmit(): Promise<[boolean, any]>;
533
631
 
534
632
  export declare const OrcDesign: DefineComponent<{
535
633
  readonly: BooleanConstructor;
@@ -576,7 +674,151 @@ export declare const OrcDesignPrint: DefineComponent<{}, {
576
674
  getHtml(): any;
577
675
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{}>>, {}, {}>;
578
676
 
579
- export declare const OrcProvider: __VLS_WithTemplateSlots_3< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {}>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {}>>>, {}, {}>, {
677
+ export declare const OrcForm: __VLS_WithTemplateSlots_3< DefineComponent<{
678
+ /** @example ``` [{ type: 'a-input', model: 'billNumber', name: '类型编码', options: { disabled: true, placeholder: '' }] ``` */
679
+ config: {
680
+ type: PropType<FormItemType[]>;
681
+ default(): never[];
682
+ };
683
+ labelWidth: {
684
+ type: StringConstructor;
685
+ default: string;
686
+ };
687
+ labelAlign: {
688
+ type: PropType<"left" | "right">;
689
+ default: string;
690
+ };
691
+ loading: BooleanConstructor;
692
+ disabled: BooleanConstructor;
693
+ hideSubmit: BooleanConstructor;
694
+ modelValue: {
695
+ type: ObjectConstructor;
696
+ default(): {};
697
+ };
698
+ /** 栅格间距 */
699
+ gutter: {
700
+ type: NumberConstructor;
701
+ default: number;
702
+ };
703
+ /** 栅格 24 */
704
+ span: {
705
+ type: NumberConstructor;
706
+ default: number;
707
+ };
708
+ formProps: {
709
+ type: ObjectConstructor;
710
+ default(): {};
711
+ };
712
+ /** 栅格grid 优先级低于行 span */
713
+ grid: {
714
+ type: ObjectConstructor;
715
+ default(): {};
716
+ };
717
+ }, {
718
+ onSubmit: typeof onSubmit;
719
+ onReset: (defValue?: Partial<{
720
+ [x: string]: any;
721
+ }> | undefined) => void;
722
+ resetFields(): void;
723
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
724
+ error: (...args: any[]) => void;
725
+ "update:modelValue": (...args: any[]) => void;
726
+ submit: (...args: any[]) => void;
727
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
728
+ /** @example ``` [{ type: 'a-input', model: 'billNumber', name: '类型编码', options: { disabled: true, placeholder: '' }] ``` */
729
+ config: {
730
+ type: PropType<FormItemType[]>;
731
+ default(): never[];
732
+ };
733
+ labelWidth: {
734
+ type: StringConstructor;
735
+ default: string;
736
+ };
737
+ labelAlign: {
738
+ type: PropType<"left" | "right">;
739
+ default: string;
740
+ };
741
+ loading: BooleanConstructor;
742
+ disabled: BooleanConstructor;
743
+ hideSubmit: BooleanConstructor;
744
+ modelValue: {
745
+ type: ObjectConstructor;
746
+ default(): {};
747
+ };
748
+ /** 栅格间距 */
749
+ gutter: {
750
+ type: NumberConstructor;
751
+ default: number;
752
+ };
753
+ /** 栅格 24 */
754
+ span: {
755
+ type: NumberConstructor;
756
+ default: number;
757
+ };
758
+ formProps: {
759
+ type: ObjectConstructor;
760
+ default(): {};
761
+ };
762
+ /** 栅格grid 优先级低于行 span */
763
+ grid: {
764
+ type: ObjectConstructor;
765
+ default(): {};
766
+ };
767
+ }>> & {
768
+ onSubmit?: ((...args: any[]) => any) | undefined;
769
+ onError?: ((...args: any[]) => any) | undefined;
770
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
771
+ }, {
772
+ grid: Record<string, any>;
773
+ loading: boolean;
774
+ disabled: boolean;
775
+ modelValue: Record<string, any>;
776
+ span: number;
777
+ formProps: Record<string, any>;
778
+ config: FormItemType[];
779
+ labelWidth: string;
780
+ labelAlign: "left" | "right";
781
+ hideSubmit: boolean;
782
+ gutter: number;
783
+ }, {}>, {
784
+ row?(_: {}): any;
785
+ default?(_: {
786
+ onSubmit: typeof onSubmit;
787
+ }): any;
788
+ }>;
789
+
790
+ export declare const OrcFormButton: __VLS_WithTemplateSlots_4< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
791
+ title: string;
792
+ modelValue: undefined;
793
+ }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
794
+ submit: (data: FormSubmitEvent) => void;
795
+ error: (data: any) => void;
796
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
797
+ title: string;
798
+ modelValue: undefined;
799
+ }>>> & {
800
+ onSubmit?: ((data: FormSubmitEvent) => any) | undefined;
801
+ onError?: ((data: any) => any) | undefined;
802
+ }, {
803
+ title: string;
804
+ modelValue: RecordAny;
805
+ }, {}>, {
806
+ default?(_: {}): any;
807
+ }>;
808
+
809
+ export declare const OrcHiddenView: __VLS_WithTemplateSlots_5< DefineComponent<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<{
810
+ isShow?: boolean | undefined;
811
+ isDirection?: boolean | undefined;
812
+ formProps?: Record<string, any> | undefined;
813
+ }>, {}>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<{
814
+ isShow?: boolean | undefined;
815
+ isDirection?: boolean | undefined;
816
+ formProps?: Record<string, any> | undefined;
817
+ }>, {}>>>, {}, {}>, {
818
+ default?(_: {}): any;
819
+ }>;
820
+
821
+ export declare const OrcProvider: __VLS_WithTemplateSlots_6< DefineComponent<__VLS_WithDefaults_3<__VLS_TypePropsToRuntimeProps_3<Props_2>, {}>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults_3<__VLS_TypePropsToRuntimeProps_3<Props_2>, {}>>>, {}, {}>, {
580
822
  default?(_: {}): any;
581
823
  }>;
582
824
 
@@ -885,6 +1127,18 @@ export declare interface OrcTableOption extends RecordAny_2 {
885
1127
  }
886
1128
 
887
1129
  declare interface Props {
1130
+ disabled?: boolean;
1131
+ title?: string;
1132
+ span?: number;
1133
+ gutter?: number;
1134
+ config: FormItemType[];
1135
+ modelValue?: RecordAny;
1136
+ labelWidth?: string;
1137
+ buttonAttrs?: ButtonInstance['$props'];
1138
+ modalAttrs?: ModalInstance['$props'];
1139
+ }
1140
+
1141
+ declare interface Props_2 {
888
1142
  useErrData?: <T = Record<string, any>>(config: Record<string, any>) => Promise<[boolean, T]>;
889
1143
  }
890
1144
 
@@ -892,17 +1146,6 @@ export declare type RecordAny = Record<string, any>;
892
1146
 
893
1147
  declare type RecordAny_2 = Record<string, any>;
894
1148
 
895
- /**
896
- * set path object
897
- * @example
898
- * ```
899
- * var b = {a:{b:1}}
900
- * setData(b,'a.b',2)
901
- * // {a:{b:2}}
902
- * ```
903
- */
904
- export declare function setData(object: RecordAny, path: string, defaultValue?: any): RecordAny;
905
-
906
1149
  declare function setLoading(val?: boolean): void;
907
1150
 
908
1151
  /** column type */
@@ -982,12 +1225,6 @@ declare interface TableGridTwoType extends RecordAny_2 {
982
1225
 
983
1226
  declare type TableInstance = InstanceType<typeof VxeTable>;
984
1227
 
985
- /** array */
986
- export declare function toArray<T>(target: T | T[]): T[];
987
-
988
- /** 读取数据类型 */
989
- export declare function typeName(o: unknown): string;
990
-
991
1228
  declare interface TypeSearchItem extends RecordAny {
992
1229
  /** input 类型 */
993
1230
  type?: string;
@@ -1544,4 +1781,26 @@ export declare const useOrcTable: (option: OrcTableOption) => {
1544
1781
  selectedKeys: Ref<string[], string[]>;
1545
1782
  };
1546
1783
 
1784
+ declare function useState<T extends RecordAny>(initValue: T, formsRef?: Ref<{
1785
+ resetFields?: () => void;
1786
+ }>): readonly [Ref<T, T>, (defValue?: Partial<T>) => void];
1787
+
1788
+ export declare const utils: {
1789
+ formatTable: {
1790
+ tf: (val: any, digits?: any) => any;
1791
+ t: (val: any) => string;
1792
+ time: (val: any, f?: string) => string;
1793
+ p: (val: any, digits?: any, percent?: string) => string;
1794
+ };
1795
+ mergeConfig: typeof mergeConfig;
1796
+ generateQRcodeBase64: typeof generateQRcodeBase64;
1797
+ downLoadPdf: typeof downLoadPdf;
1798
+ useState: typeof useState;
1799
+ findObject: typeof findObject;
1800
+ omitObject: typeof omitObject;
1801
+ deepClone: <T = RecordAny | RecordAny[]>(origin: T) => T;
1802
+ download: (url: string, fileName?: string) => boolean;
1803
+ log: typeof log;
1804
+ };
1805
+
1547
1806
  export { }