@carefrees/form-utils-vue 0.0.10 → 0.0.12

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 (161) hide show
  1. package/README.md +56 -2
  2. package/assets/index.css +23 -12
  3. package/esm/component.js +3 -0
  4. package/esm/form/form.js +156 -0
  5. package/esm/form/form.vue.d.ts +10 -7
  6. package/esm/form/index.d.ts +12 -12
  7. package/esm/form/index.js +4 -0
  8. package/esm/formItem/form.Item.base.js +162 -0
  9. package/esm/formItem/form.Item.base.vue.d.ts +6 -8
  10. package/esm/formItem/form.hide.item.js +126 -0
  11. package/esm/formItem/form.hide.item.vue.d.ts +6 -8
  12. package/esm/formItem/formItem.js +155 -0
  13. package/esm/formItem/formItem.vue.d.ts +6 -9
  14. package/esm/formItem/index.d.ts +24 -37
  15. package/esm/formItem/index.js +8 -0
  16. package/esm/hooks/attr/attr.FormItem.d.ts +5 -5
  17. package/esm/hooks/attr/attr.FormItem.js +97 -0
  18. package/esm/hooks/index.js +13 -0
  19. package/esm/hooks/register/register.FormHideItem.d.ts +2 -2
  20. package/esm/hooks/register/register.FormHideItem.js +42 -0
  21. package/esm/hooks/register/register.FormItem.d.ts +9 -6
  22. package/esm/hooks/register/register.FormItem.js +67 -0
  23. package/esm/hooks/register/register.FormList.d.ts +3 -3
  24. package/esm/hooks/register/register.FormList.js +42 -0
  25. package/esm/hooks/register/register.form.d.ts +1 -1
  26. package/esm/hooks/register/register.form.js +10 -0
  27. package/esm/hooks/useAttrs.d.ts +1 -0
  28. package/esm/hooks/useAttrs.js +26 -0
  29. package/esm/hooks/useEffect.js +12 -0
  30. package/esm/hooks/useForm.d.ts +1 -1
  31. package/esm/hooks/useForm.js +17 -0
  32. package/esm/hooks/useFormItem.js +17 -0
  33. package/esm/hooks/useFormItemParentName.js +47 -0
  34. package/esm/hooks/useFormList.js +17 -0
  35. package/esm/hooks/useHtmlFor.d.ts +1 -1
  36. package/esm/hooks/useHtmlFor.js +7 -0
  37. package/esm/hooks/useMultipleForm.d.ts +1 -1
  38. package/esm/hooks/useMultipleForm.js +18 -0
  39. package/esm/index.d.ts +1 -1
  40. package/esm/index.js +13 -0
  41. package/esm/instance/ruleIntsnace.d.ts +1 -1
  42. package/esm/instance/ruleIntsnace.js +65 -0
  43. package/esm/interface/index.d.ts +2 -0
  44. package/esm/interface/index.js +0 -0
  45. package/esm/interface/layout.formItem.js +0 -0
  46. package/esm/interface/layout.js +0 -0
  47. package/esm/layout/index.d.ts +24 -33
  48. package/esm/layout/index.js +8 -0
  49. package/esm/layout/layout.form.rows.js +21 -0
  50. package/esm/layout/layout.form.rows.vue.d.ts +8 -5
  51. package/esm/layout/layout.formItem.js +195 -0
  52. package/esm/layout/layout.formItem.vue.d.ts +6 -9
  53. package/esm/layout/layout.js +160 -0
  54. package/esm/layout/layout.vue.d.ts +6 -8
  55. package/esm/utils/index.js +1 -0
  56. package/esm/utils/withInstall.d.ts +2 -2
  57. package/esm/utils/withInstall.js +15 -0
  58. package/package.json +6 -8
  59. package/src/form/form.vue +8 -1
  60. package/src/interface/index.ts +2 -0
  61. package/esm/component.mjs +0 -12
  62. package/esm/form/form.vue.mjs +0 -110
  63. package/esm/form/form.vue2.mjs +0 -4
  64. package/esm/form/index.mjs +0 -6
  65. package/esm/formItem/form.Item.base.vue.mjs +0 -114
  66. package/esm/formItem/form.Item.base.vue2.mjs +0 -4
  67. package/esm/formItem/form.hide.item.vue.mjs +0 -78
  68. package/esm/formItem/form.hide.item.vue2.mjs +0 -4
  69. package/esm/formItem/formItem.vue.mjs +0 -102
  70. package/esm/formItem/formItem.vue2.mjs +0 -4
  71. package/esm/formItem/index.mjs +0 -12
  72. package/esm/hooks/attr/attr.FormItem.mjs +0 -120
  73. package/esm/hooks/register/register.FormHideItem.mjs +0 -38
  74. package/esm/hooks/register/register.FormItem.mjs +0 -55
  75. package/esm/hooks/register/register.FormList.mjs +0 -43
  76. package/esm/hooks/register/register.form.mjs +0 -12
  77. package/esm/hooks/useAttrs.mjs +0 -43
  78. package/esm/hooks/useEffect.mjs +0 -14
  79. package/esm/hooks/useForm.mjs +0 -26
  80. package/esm/hooks/useFormItem.mjs +0 -26
  81. package/esm/hooks/useFormItemParentName.mjs +0 -37
  82. package/esm/hooks/useFormList.mjs +0 -26
  83. package/esm/hooks/useHtmlFor.mjs +0 -11
  84. package/esm/hooks/useMultipleForm.mjs +0 -27
  85. package/esm/index.mjs +0 -59
  86. package/esm/instance/ruleIntsnace.mjs +0 -73
  87. package/esm/layout/index.mjs +0 -12
  88. package/esm/layout/layout.form.rows.vue.mjs +0 -31
  89. package/esm/layout/layout.form.rows.vue2.mjs +0 -4
  90. package/esm/layout/layout.formItem.vue.mjs +0 -216
  91. package/esm/layout/layout.formItem.vue2.mjs +0 -4
  92. package/esm/layout/layout.vue.mjs +0 -166
  93. package/esm/layout/layout.vue2.mjs +0 -4
  94. package/esm/utils/withInstall.mjs +0 -22
  95. package/lib/component.d.ts +0 -3
  96. package/lib/component.js +0 -12
  97. package/lib/form/form.vue.d.ts +0 -19
  98. package/lib/form/form.vue.js +0 -110
  99. package/lib/form/form.vue2.js +0 -4
  100. package/lib/form/index.d.ts +0 -37
  101. package/lib/form/index.js +0 -6
  102. package/lib/formItem/form.Item.base.vue.d.ts +0 -16
  103. package/lib/formItem/form.Item.base.vue.js +0 -114
  104. package/lib/formItem/form.Item.base.vue2.js +0 -4
  105. package/lib/formItem/form.hide.item.vue.d.ts +0 -16
  106. package/lib/formItem/form.hide.item.vue.js +0 -78
  107. package/lib/formItem/form.hide.item.vue2.js +0 -4
  108. package/lib/formItem/formItem.vue.d.ts +0 -18
  109. package/lib/formItem/formItem.vue.js +0 -102
  110. package/lib/formItem/formItem.vue2.js +0 -4
  111. package/lib/formItem/index.d.ts +0 -71
  112. package/lib/formItem/index.js +0 -12
  113. package/lib/hooks/attr/attr.FormItem.d.ts +0 -97
  114. package/lib/hooks/attr/attr.FormItem.js +0 -120
  115. package/lib/hooks/index.d.ts +0 -13
  116. package/lib/hooks/register/register.FormHideItem.d.ts +0 -9
  117. package/lib/hooks/register/register.FormHideItem.js +0 -38
  118. package/lib/hooks/register/register.FormItem.d.ts +0 -23
  119. package/lib/hooks/register/register.FormItem.js +0 -55
  120. package/lib/hooks/register/register.FormList.d.ts +0 -9
  121. package/lib/hooks/register/register.FormList.js +0 -43
  122. package/lib/hooks/register/register.form.d.ts +0 -3
  123. package/lib/hooks/register/register.form.js +0 -12
  124. package/lib/hooks/useAttrs.d.ts +0 -24
  125. package/lib/hooks/useAttrs.js +0 -43
  126. package/lib/hooks/useEffect.d.ts +0 -2
  127. package/lib/hooks/useEffect.js +0 -14
  128. package/lib/hooks/useForm.d.ts +0 -8
  129. package/lib/hooks/useForm.js +0 -26
  130. package/lib/hooks/useFormItem.d.ts +0 -7
  131. package/lib/hooks/useFormItem.js +0 -26
  132. package/lib/hooks/useFormItemParentName.d.ts +0 -18
  133. package/lib/hooks/useFormItemParentName.js +0 -37
  134. package/lib/hooks/useFormList.d.ts +0 -7
  135. package/lib/hooks/useFormList.js +0 -26
  136. package/lib/hooks/useHtmlFor.d.ts +0 -2
  137. package/lib/hooks/useHtmlFor.js +0 -11
  138. package/lib/hooks/useMultipleForm.d.ts +0 -7
  139. package/lib/hooks/useMultipleForm.js +0 -27
  140. package/lib/index.d.ts +0 -11
  141. package/lib/index.js +0 -59
  142. package/lib/instance/ruleIntsnace.d.ts +0 -49
  143. package/lib/instance/ruleIntsnace.js +0 -73
  144. package/lib/interface/index.d.ts +0 -36
  145. package/lib/interface/layout.d.ts +0 -28
  146. package/lib/interface/layout.formItem.d.ts +0 -39
  147. package/lib/layout/index.d.ts +0 -65
  148. package/lib/layout/index.js +0 -12
  149. package/lib/layout/layout.form.rows.vue.d.ts +0 -10
  150. package/lib/layout/layout.form.rows.vue.js +0 -31
  151. package/lib/layout/layout.form.rows.vue2.js +0 -4
  152. package/lib/layout/layout.formItem.vue.d.ts +0 -18
  153. package/lib/layout/layout.formItem.vue.js +0 -216
  154. package/lib/layout/layout.formItem.vue2.js +0 -4
  155. package/lib/layout/layout.vue.d.ts +0 -16
  156. package/lib/layout/layout.vue.js +0 -166
  157. package/lib/layout/layout.vue2.js +0 -4
  158. package/lib/utils/index.d.ts +0 -1
  159. package/lib/utils/withInstall.d.ts +0 -3
  160. package/lib/utils/withInstall.js +0 -22
  161. package/src/vite-env.d.ts +0 -1
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const vue = require("vue");
4
- const layout_formItem_vue_vue_type_script_setup_true_lang = require("../layout/layout.formItem.vue.js");
5
- const form_Item_base_vue_vue_type_script_setup_true_lang = require("./form.Item.base.vue.js");
6
- const __default__ = vue.defineComponent({
7
- name: "FormItem",
8
- inheritAttrs: false
9
- // 可选,防止属性自动应用到根元素
10
- });
11
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
12
- ...__default__,
13
- props: {
14
- noStyle: { type: Boolean },
15
- input: {},
16
- dependencies: {},
17
- noticeOnlyRuleDataField: {},
18
- isNoticeParentField: { type: Boolean },
19
- noticeWatchField: {},
20
- preserve: { type: Boolean },
21
- useRules: {},
22
- useAttrs: {},
23
- inputAttrs: {},
24
- valuePropName: {},
25
- getValuePath: {},
26
- getValueFromEvent: {},
27
- formatValue: {},
28
- onAfterUpdate: {},
29
- trigger: {},
30
- name: {},
31
- rules: {},
32
- sort: {},
33
- isJoinParentField: { type: Boolean },
34
- errorLayout: {},
35
- required: { type: Boolean },
36
- labelMode: {},
37
- onlyRuleStyle: { type: Boolean },
38
- label: { type: [Object, String, Number, Boolean, null, Array] },
39
- helpText: { type: [Object, String, Number, Boolean, null, Array] },
40
- extra: { type: [Object, String, Number, Boolean, null, Array] },
41
- showColon: { type: Boolean },
42
- colSpan: {},
43
- rowSpan: {},
44
- htmlFor: {},
45
- validateResult: {},
46
- style: { type: [Boolean, null, String, Object, Array] },
47
- class: {},
48
- labelStyle: { type: [Boolean, null, String, Object, Array] },
49
- labelClass: {}
50
- },
51
- setup(__props) {
52
- const props = __props;
53
- const slots = vue.useSlots();
54
- return (_ctx, _cache) => {
55
- return props.name ? (vue.openBlock(), vue.createBlock(
56
- form_Item_base_vue_vue_type_script_setup_true_lang.default,
57
- vue.normalizeProps(vue.mergeProps({ key: 0 }, props)),
58
- vue.createSlots({
59
- _: 2
60
- /* DYNAMIC */
61
- }, [
62
- vue.renderList(slots, (_, name) => {
63
- return {
64
- name,
65
- fn: vue.withCtx((slotProps) => [
66
- vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
67
- ])
68
- };
69
- })
70
- ]),
71
- 1040
72
- /* FULL_PROPS, DYNAMIC_SLOTS */
73
- )) : (vue.openBlock(), vue.createBlock(layout_formItem_vue_vue_type_script_setup_true_lang.default, {
74
- key: 1,
75
- label: props.label,
76
- errorLayout: props.errorLayout,
77
- labelMode: props.labelMode,
78
- onlyRuleStyle: props.onlyRuleStyle,
79
- showColon: props.showColon,
80
- colSpan: props.colSpan,
81
- rowSpan: props.rowSpan,
82
- style: vue.normalizeStyle(props.style),
83
- class: vue.normalizeClass(props.class),
84
- labelStyle: props.labelStyle,
85
- labelClass: props.labelClass
86
- }, vue.createSlots({
87
- _: 2
88
- /* DYNAMIC */
89
- }, [
90
- vue.renderList(slots, (_, name) => {
91
- return {
92
- name,
93
- fn: vue.withCtx((slotProps) => [
94
- vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
95
- ])
96
- };
97
- })
98
- ]), 1032, ["label", "errorLayout", "labelMode", "onlyRuleStyle", "showColon", "colSpan", "rowSpan", "style", "class", "labelStyle", "labelClass"]));
99
- };
100
- }
101
- });
102
- exports.default = _sfc_main;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const formItem_vue_vue_type_script_setup_true_lang = require("./formItem.vue.js");
4
- exports.default = formItem_vue_vue_type_script_setup_true_lang.default;
@@ -1,71 +0,0 @@
1
- export declare const FormItemBase: import('../utils').SFCWithInstall<{
2
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('..').FormItemProps> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
3
- P: {};
4
- B: {};
5
- D: {};
6
- C: {};
7
- M: {};
8
- Defaults: {};
9
- }, Readonly<import('..').FormItemProps> & Readonly<{}>, {}, {}, {}, {}, {}>;
10
- __isFragment?: undefined;
11
- __isTeleport?: undefined;
12
- __isSuspense?: undefined;
13
- } & import('vue').ComponentOptionsBase<Readonly<import('..').FormItemProps> & 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 () => {
14
- $slots: Readonly<{
15
- label: (params: any) => any;
16
- helpText: (params: any) => any;
17
- extra: (params: any) => any;
18
- }> & {
19
- label: (params: any) => any;
20
- helpText: (params: any) => any;
21
- extra: (params: any) => any;
22
- };
23
- })> & Record<string, any>;
24
- export declare const FormItem: import('../utils').SFCWithInstall<{
25
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<Partial<import('..').FormItemProps>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
26
- P: {};
27
- B: {};
28
- D: {};
29
- C: {};
30
- M: {};
31
- Defaults: {};
32
- }, Readonly<Partial<import('..').FormItemProps>> & Readonly<{}>, {}, {}, {}, {}, {}>;
33
- __isFragment?: undefined;
34
- __isTeleport?: undefined;
35
- __isSuspense?: undefined;
36
- } & import('vue').ComponentOptionsBase<Readonly<Partial<import('..').FormItemProps>> & 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 () => {
37
- $slots: Readonly<{
38
- default: (params: any) => any;
39
- label: (params: any) => any;
40
- helpText: (params: any) => any;
41
- extra: (params: any) => any;
42
- }> & {
43
- default: (params: any) => any;
44
- label: (params: any) => any;
45
- helpText: (params: any) => any;
46
- extra: (params: any) => any;
47
- };
48
- })> & Record<string, any>;
49
- export declare const FormHideItem: import('../utils').SFCWithInstall<{
50
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('..').FormItemProps> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
51
- P: {};
52
- B: {};
53
- D: {};
54
- C: {};
55
- M: {};
56
- Defaults: {};
57
- }, Readonly<import('..').FormItemProps> & Readonly<{}>, {}, {}, {}, {}, {}>;
58
- __isFragment?: undefined;
59
- __isTeleport?: undefined;
60
- __isSuspense?: undefined;
61
- } & import('vue').ComponentOptionsBase<Readonly<import('..').FormItemProps> & 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 () => {
62
- $slots: Readonly<{
63
- label: (params: any) => any;
64
- helpText: (params: any) => any;
65
- extra: (params: any) => any;
66
- }> & {
67
- label: (params: any) => any;
68
- helpText: (params: any) => any;
69
- extra: (params: any) => any;
70
- };
71
- })> & Record<string, any>;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const form_Item_base_vue_vue_type_script_setup_true_lang = require("./form.Item.base.vue.js");
4
- const formItem_vue_vue_type_script_setup_true_lang = require("./formItem.vue.js");
5
- const form_hide_item_vue_vue_type_script_setup_true_lang = require("./form.hide.item.vue.js");
6
- const withInstall = require("../utils/withInstall.js");
7
- const FormItemBase = withInstall.withInstall(form_Item_base_vue_vue_type_script_setup_true_lang.default);
8
- const FormItem = withInstall.withInstall(formItem_vue_vue_type_script_setup_true_lang.default);
9
- const FormHideItem = withInstall.withInstall(form_hide_item_vue_vue_type_script_setup_true_lang.default);
10
- exports.FormHideItem = FormHideItem;
11
- exports.FormItem = FormItem;
12
- exports.FormItemBase = FormItemBase;
@@ -1,97 +0,0 @@
1
- import { FormInstanceBase, FormItemInstanceBase } from '@carefrees/form-utils';
2
- import { RegisterFormItemOptions } from './../register/register.FormItem';
3
- import { Ref } from 'vue';
4
- import { RuleInstanceBase2 } from '../../instance/ruleIntsnace';
5
- export interface FormItemAttrOptions extends RegisterFormItemOptions {
6
- /**依赖更新项*/
7
- dependencies?: string[];
8
- /**通知 只用于校验规则提示 字段 */
9
- noticeOnlyRuleDataField?: string[];
10
- /**通知父级字段监听方法更新*/
11
- isNoticeParentField?: boolean;
12
- /**通知watch监听方法更新*/
13
- noticeWatchField?: string[];
14
- /**是否保护值(不进行表单项组件卸载重置初始值)*/
15
- preserve?: boolean;
16
- /**重写规则*/
17
- useRules?: (ruleInstance: Ref<RuleInstanceBase2>, form: FormInstanceBase, formItemInstance: FormItemInstanceBase) => void;
18
- /**输入框属性重写*/
19
- useAttrs?: (attrs: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase) => any;
20
- /**输入框属性*/
21
- inputAttrs?: Object;
22
- /**传递组件字段*/
23
- valuePropName?: string;
24
- /**取值字段(默认和valuePropName值相同)*/
25
- getValuePath?: string;
26
- /**自定义获取值*/
27
- getValueFromEvent?: (event: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase) => any;
28
- /**值格式化*/
29
- formatValue?: (value: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase, event: any) => any;
30
- /**触发数据更新之后触发(用于数据联动之类的)*/
31
- onAfterUpdate?: (value: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase, event: any) => void;
32
- /**事件名称*/
33
- trigger?: string;
34
- }
35
- /**表单项参数*/
36
- export declare const useFormItemAttr: (options: FormItemAttrOptions) => {
37
- valuePropName: string;
38
- htmlFor: import('vue').ComputedRef<string>;
39
- onChange: (event: any) => void;
40
- formItemInstance: FormItemInstanceBase;
41
- form: FormInstanceBase<any>;
42
- ruleInstance: Ref<RuleInstanceBase2, RuleInstanceBase2>;
43
- newAttrs: import('vue').ComputedRef<{
44
- name: string;
45
- id: string;
46
- constructor: Function;
47
- toString(): string;
48
- toLocaleString(): string;
49
- valueOf(): Object;
50
- hasOwnProperty(v: PropertyKey): boolean;
51
- isPrototypeOf(v: Object): boolean;
52
- propertyIsEnumerable(v: PropertyKey): boolean;
53
- }>;
54
- attrsLastData: Ref<{
55
- name: string;
56
- id: string;
57
- constructor: Function;
58
- toString: () => string;
59
- toLocaleString: () => string;
60
- valueOf: () => Object;
61
- hasOwnProperty: (v: PropertyKey) => boolean;
62
- isPrototypeOf: (v: Object) => boolean;
63
- propertyIsEnumerable: (v: PropertyKey) => boolean;
64
- }, {
65
- name: string;
66
- id: string;
67
- constructor: Function;
68
- toString(): string;
69
- toLocaleString(): string;
70
- valueOf(): Object;
71
- hasOwnProperty(v: PropertyKey): boolean;
72
- isPrototypeOf(v: Object): boolean;
73
- propertyIsEnumerable(v: PropertyKey): boolean;
74
- } | {
75
- name: string;
76
- id: string;
77
- constructor: Function;
78
- toString: () => string;
79
- toLocaleString: () => string;
80
- valueOf: () => Object;
81
- hasOwnProperty: (v: PropertyKey) => boolean;
82
- isPrototypeOf: (v: Object) => boolean;
83
- propertyIsEnumerable: (v: PropertyKey) => boolean;
84
- }>;
85
- validateResult: Ref<{
86
- tip: string | (string | undefined)[];
87
- isInvalid: boolean;
88
- }, {
89
- tip: string | (string | undefined)[];
90
- isInvalid: boolean;
91
- } | {
92
- tip: string | (string | undefined)[];
93
- isInvalid: boolean;
94
- }>;
95
- newSort: import('vue').ComputedRef<string>;
96
- newName: import('vue').ComputedRef<string>;
97
- };
@@ -1,120 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const formUtils = require("@carefrees/form-utils");
4
- const useHtmlFor = require("../useHtmlFor.js");
5
- const register_FormItem = require("../register/register.FormItem.js");
6
- const vue = require("vue");
7
- const useFormItemAttr = (options) => {
8
- const {
9
- trigger = "onChange",
10
- dependencies,
11
- noticeOnlyRuleDataField,
12
- isNoticeParentField,
13
- noticeWatchField,
14
- preserve,
15
- valuePropName = "value",
16
- getValuePath = valuePropName,
17
- getValueFromEvent,
18
- formatValue,
19
- onAfterUpdate,
20
- useAttrs,
21
- useRules,
22
- inputAttrs,
23
- ...rest
24
- } = options;
25
- const {
26
- formItemInstance,
27
- form,
28
- ruleInstance,
29
- newName,
30
- newSort,
31
- deepRefData
32
- } = register_FormItem.useRegisterFormItem({
33
- ...rest
34
- });
35
- formItemInstance.dependencies = dependencies;
36
- formItemInstance.noticeOnlyRuleDataField = noticeOnlyRuleDataField;
37
- formItemInstance.isNoticeParentField = isNoticeParentField;
38
- formItemInstance.onAfterUpdate = onAfterUpdate;
39
- formItemInstance.noticeWatchField = noticeWatchField;
40
- formItemInstance.preserve = preserve;
41
- const oldValue = vue.ref(formUtils.get(form.formData, vue.toValue(newName)));
42
- vue.watch(() => [formUtils.get(form.formData, vue.toValue(newName)), vue.toValue(newName)], () => {
43
- oldValue.value = form.getFieldValue(vue.toValue(newName));
44
- }, {
45
- immediate: true
46
- });
47
- const onValueChange = (event) => {
48
- var _a;
49
- try {
50
- let value = event;
51
- if (typeof getValueFromEvent === "function") {
52
- value = getValueFromEvent(event, form, formItemInstance);
53
- } else if (event && event.target && typeof event.target === "object" && getValuePath in event.target) {
54
- value = formUtils.get(event.target, getValuePath);
55
- }
56
- if (typeof formatValue === "function") {
57
- value = formatValue(value, form, formItemInstance, event);
58
- }
59
- if (oldValue.value !== value) {
60
- form.updatedFieldValue(vue.toValue(newName), value, "validate");
61
- (_a = formItemInstance.onAfterUpdate) == null ? void 0 : _a.call(formItemInstance, value, form, formItemInstance, event);
62
- if (Array.isArray(formItemInstance.noticeWatchField) && formItemInstance.noticeWatchField.length) {
63
- form.noticeWatch(formItemInstance.noticeWatchField);
64
- }
65
- if (Array.isArray(formItemInstance.noticeOnlyRuleDataField) && formItemInstance.noticeOnlyRuleDataField.length) {
66
- form.onlyValidate(formItemInstance.noticeOnlyRuleDataField);
67
- }
68
- if (formItemInstance.isNoticeParentField && formItemInstance.parentDataField) {
69
- form.notice(formItemInstance.parentDataField);
70
- }
71
- }
72
- } catch (error) {
73
- console.log(error);
74
- }
75
- };
76
- formItemInstance.onChange = onValueChange;
77
- const htmlFor = useHtmlFor.useHtmlFor(newName);
78
- vue.watch(() => htmlFor, () => {
79
- formItemInstance.htmlFor = htmlFor.value;
80
- }, {
81
- immediate: true
82
- });
83
- const newAttrs = vue.computed(() => {
84
- const _attr = inputAttrs || {};
85
- return {
86
- ..._attr,
87
- [trigger]: onValueChange,
88
- name: vue.toValue(newName),
89
- id: vue.toValue(htmlFor),
90
- [valuePropName]: vue.toValue(oldValue)
91
- };
92
- });
93
- const attrsLastData = vue.ref(vue.toValue(newAttrs));
94
- vue.watch(() => [vue.toValue(newAttrs), vue.toValue(deepRefData), vue.toValue(oldValue)], () => {
95
- attrsLastData.value = (useAttrs == null ? void 0 : useAttrs(vue.toValue(newAttrs), form, formItemInstance)) || vue.toValue(newAttrs);
96
- }, {
97
- immediate: true
98
- });
99
- const validateResult = vue.ref(vue.toValue(ruleInstance).getValidateResult());
100
- vue.watch(() => [vue.toValue(deepRefData), vue.toValue(oldValue)], () => {
101
- useRules == null ? void 0 : useRules(ruleInstance, form, formItemInstance);
102
- });
103
- vue.watch(() => [vue.toValue(ruleInstance).messages, vue.toValue(ruleInstance).rules, vue.toValue(oldValue)], () => {
104
- validateResult.value = vue.toValue(ruleInstance).getValidateResult();
105
- });
106
- return {
107
- valuePropName,
108
- htmlFor,
109
- onChange: onValueChange,
110
- formItemInstance,
111
- form,
112
- ruleInstance,
113
- newAttrs,
114
- attrsLastData,
115
- validateResult,
116
- newSort,
117
- newName
118
- };
119
- };
120
- exports.useFormItemAttr = useFormItemAttr;
@@ -1,13 +0,0 @@
1
- export * from './useAttrs';
2
- export * from './useForm';
3
- export * from './useFormItem';
4
- export * from './useFormList';
5
- export * from './useHtmlFor';
6
- export * from './useMultipleForm';
7
- export * from './useFormItemParentName';
8
- export * from './useEffect';
9
- export * from './register/register.FormHideItem';
10
- export * from './register/register.FormItem';
11
- export * from './register/register.FormList';
12
- export * from './register/register.form';
13
- export * from './attr/attr.FormItem';
@@ -1,9 +0,0 @@
1
- import { RegisterFormItemOptions } from './register.FormItem';
2
- interface RegisterFormHideItemOptions extends Omit<RegisterFormItemOptions, 'rules'> {
3
- }
4
- /**注册表单隐藏表单项到表单实例中*/
5
- export declare const useRegisterFormHideItem: (options: RegisterFormHideItemOptions) => {
6
- form: import('@carefrees/form-utils').FormInstanceBase<any>;
7
- isHide: import('vue').Ref<any, any>;
8
- };
9
- export {};
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const vue = require("vue");
4
- const formUtils = require("@carefrees/form-utils");
5
- const useFormItemParentName = require("../useFormItemParentName.js");
6
- const useForm = require("../useForm.js");
7
- const useEffect = require("../useEffect.js");
8
- const useRegisterFormHideItem = (options) => {
9
- const { name, sort, isJoinParentField = true } = options;
10
- const form = useForm.useFormInject();
11
- const { newName, newSort } = useFormItemParentName.useFormItemParentNameInject({ name, sort, isJoinParentField });
12
- const hideItemInstance = vue.ref(new formUtils.FormHideItemInstanceBase().ctor(newName.value));
13
- const isHide = vue.ref(form.getFieldHideValue(newName.value));
14
- vue.watch(
15
- () => [vue.toValue(isHide)],
16
- () => {
17
- hideItemInstance.value.preHideValue = isHide.value;
18
- },
19
- { immediate: true }
20
- );
21
- const setValue = () => {
22
- isHide.value = form.getFieldHideValue(newName.value);
23
- };
24
- hideItemInstance.value.updatedItem = setValue;
25
- vue.watch(
26
- () => [form, vue.toValue(newSort)],
27
- () => {
28
- hideItemInstance.value.instance = form;
29
- hideItemInstance.value.sort = vue.toValue(newSort);
30
- },
31
- { immediate: true }
32
- );
33
- useEffect.useEffect(() => {
34
- return form.registerFormHideItem(vue.toValue(hideItemInstance));
35
- });
36
- return { form, isHide };
37
- };
38
- exports.useRegisterFormHideItem = useRegisterFormHideItem;
@@ -1,23 +0,0 @@
1
- import { Ref } from 'vue';
2
- import { RuleItem } from 'async-validator';
3
- import { RuleInstanceBase2 } from '../../instance/ruleIntsnace';
4
- export interface RegisterFormItemOptions {
5
- /**字段*/
6
- name: string;
7
- /**规则*/
8
- rules?: RuleItem[];
9
- /**排序值*/
10
- sort?: string;
11
- /**是否拼接父级字段*/
12
- isJoinParentField?: boolean;
13
- }
14
- /**注册表单项到表单实例中*/
15
- export declare const useRegisterFormItem: (options: RegisterFormItemOptions) => {
16
- ruleInstance: Ref<RuleInstanceBase2, RuleInstanceBase2>;
17
- formItemInstance: import('@carefrees/form-utils').FormItemInstanceBase;
18
- form: import('@carefrees/form-utils').FormInstanceBase<any>;
19
- newName: import('vue').ComputedRef<string>;
20
- newSort: import('vue').ComputedRef<string>;
21
- parentItem: import('vue').ComputedRef<import('../..').PartialComputedRefs<Omit<import('../useFormItemParentName').FormItemParentNamOptions, "isJoinParentField">>>;
22
- deepRefData: Ref<any, any>;
23
- };
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const vue = require("vue");
4
- const useForm = require("../useForm.js");
5
- const useFormItem = require("../useFormItem.js");
6
- const useFormItemParentName = require("../useFormItemParentName.js");
7
- const useEffect = require("../useEffect.js");
8
- const ruleIntsnace = require("../../instance/ruleIntsnace.js");
9
- const useRegisterFormItem = (options) => {
10
- const { name, rules, sort, isJoinParentField = true } = options;
11
- const form = useForm.useFormInject();
12
- const deepRefData = vue.ref({});
13
- const { newName, newSort, parentItem } = useFormItemParentName.useFormItemParentNameInject({ name, sort, isJoinParentField });
14
- const ruleInstance = vue.ref(new ruleIntsnace.RuleInstanceBase2());
15
- const formItemInstance = useFormItem.useFormItem();
16
- vue.watch(
17
- () => [form],
18
- () => {
19
- ruleInstance.value.instance = form;
20
- formItemInstance.instance = form;
21
- },
22
- { immediate: true }
23
- );
24
- vue.watch(
25
- () => [vue.toValue(newName)],
26
- () => {
27
- ruleInstance.value.ctor(vue.toValue(newName), rules || []);
28
- formItemInstance.ctor(vue.toValue(newName), vue.toValue(ruleInstance));
29
- },
30
- { immediate: true }
31
- );
32
- vue.watch(
33
- () => [vue.toValue(newSort)],
34
- () => {
35
- ruleInstance.value.sort = vue.toValue(newSort);
36
- formItemInstance.sort = vue.toValue(newSort);
37
- },
38
- { immediate: true }
39
- );
40
- vue.watch(
41
- () => [vue.toValue(parentItem)],
42
- () => {
43
- formItemInstance.parentDataField = vue.toValue(vue.toValue(parentItem).name);
44
- },
45
- { immediate: true }
46
- );
47
- const updated = () => {
48
- deepRefData.value = { __temp: (/* @__PURE__ */ new Date()).valueOf() };
49
- };
50
- formItemInstance.updated = updated;
51
- ruleInstance.value.updated = updated;
52
- useEffect.useEffect(() => form.registerFormItem(formItemInstance));
53
- return { ruleInstance, formItemInstance, form, newName, newSort, parentItem, deepRefData };
54
- };
55
- exports.useRegisterFormItem = useRegisterFormItem;
@@ -1,9 +0,0 @@
1
- import { RegisterFormItemOptions } from './register.FormItem';
2
- export interface RegisterFormListOptions extends RegisterFormItemOptions {
3
- }
4
- /**注册表单List到表单实例中*/
5
- export declare const useRegisterFormList: (options: RegisterFormListOptions) => {
6
- ruleInstance: import('vue').Ref<import('../../instance/ruleIntsnace').RuleInstanceBase2, import('../../instance/ruleIntsnace').RuleInstanceBase2>;
7
- formItemInstance: import('@carefrees/form-utils').FormItemInstanceBase;
8
- formListInstance: import('@carefrees/form-utils').FormListInstanceBase;
9
- };
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const vue = require("vue");
4
- const register_FormItem = require("./register.FormItem.js");
5
- const useFormList = require("../useFormList.js");
6
- const useEffect = require("../useEffect.js");
7
- const useRegisterFormList = (options) => {
8
- const { ruleInstance, formItemInstance, form, newName, parentItem } = register_FormItem.useRegisterFormItem(options);
9
- const formListInstance = useFormList.useFormList();
10
- vue.watch(
11
- () => [vue.toValue(newName)],
12
- () => {
13
- formListInstance.ctor(vue.toValue(newName));
14
- },
15
- { immediate: true }
16
- );
17
- vue.watch(
18
- () => [form, formItemInstance, vue.toValue(ruleInstance)],
19
- () => {
20
- formListInstance.instance = form;
21
- formListInstance.formItemInstance = formItemInstance;
22
- formListInstance.rule = vue.toValue(ruleInstance);
23
- },
24
- { immediate: true }
25
- );
26
- vue.watch(
27
- () => [options.sort, vue.toValue(parentItem)],
28
- () => {
29
- formListInstance.sort = vue.toValue(parentItem.value.sort);
30
- formListInstance.parentDataField = vue.toValue(parentItem.value.name);
31
- },
32
- { immediate: true }
33
- );
34
- useEffect.useEffect(() => {
35
- return form.registerFormList(newName.value, formListInstance);
36
- });
37
- return {
38
- ruleInstance,
39
- formItemInstance,
40
- formListInstance
41
- };
42
- };
43
- exports.useRegisterFormList = useRegisterFormList;
@@ -1,3 +0,0 @@
1
- import { FormInstanceBase } from '@carefrees/form-utils';
2
- /**注册表单实例到多表单收集实例中*/
3
- export declare const useRegisterForm: (form: FormInstanceBase, name?: string) => import('@carefrees/form-utils').MultipleInstanceBase;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const useMultipleForm = require("../useMultipleForm.js");
4
- const useEffect = require("../useEffect.js");
5
- const useRegisterForm = (form, name) => {
6
- const multipleForm = useMultipleForm.useMultipleFormInject();
7
- useEffect.useEffect(() => {
8
- if (name) return multipleForm.ctor(name, form);
9
- });
10
- return multipleForm;
11
- };
12
- exports.useRegisterForm = useRegisterForm;
@@ -1,24 +0,0 @@
1
- import { StyleValue, ComputedRef } from 'vue';
2
- import { ComputedRefBase } from '../interface';
3
- export type AttrsOptions = {
4
- /**列数据*/
5
- colCount?: ComputedRefBase<number | undefined>;
6
- /**规则校验失败错误提示位置*/
7
- errorLayout?: ComputedRefBase<'left-bottom' | 'right-bottom' | 'top-right' | 'top-left' | undefined>;
8
- /**label显示模式*/
9
- labelMode?: ComputedRefBase<'left' | 'top' | 'hide' | undefined>;
10
- /**是否显示label后的冒号*/
11
- showColon?: ComputedRefBase<boolean | undefined>;
12
- /**表单项 className*/
13
- formItemClass?: ComputedRefBase<string | undefined>;
14
- /**表单项 style*/
15
- formItemStyle?: ComputedRefBase<StyleValue | undefined>;
16
- /**表单项 label className*/
17
- formItemLabelClass?: ComputedRefBase<string | undefined>;
18
- /**表单项 label style*/
19
- formItemLabelStyle?: ComputedRefBase<StyleValue | undefined>;
20
- };
21
- /**公共属性 Context */
22
- export declare function useAttrsProvide(options: AttrsOptions): void;
23
- /**子项中获取公共属性*/
24
- export declare function useAttrsInject(): ComputedRef<AttrsOptions>;