@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
@@ -0,0 +1,126 @@
1
+ import { createBlock, createCommentVNode, createSlots, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderList, renderSlot, unref, useSlots, withCtx } from "vue";
2
+ import form_Item_base from "./form.Item.base.js";
3
+ import { useRegisterFormHideItem } from "../hooks/register/register.FormHideItem.js";
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ name: "FormHideItem",
6
+ inheritAttrs: false,
7
+ __name: "form.hide.item",
8
+ props: {
9
+ noStyle: {
10
+ type: Boolean
11
+ },
12
+ input: {},
13
+ dependencies: {},
14
+ noticeOnlyRuleDataField: {},
15
+ isNoticeParentField: {
16
+ type: Boolean
17
+ },
18
+ noticeWatchField: {},
19
+ preserve: {
20
+ type: Boolean
21
+ },
22
+ useRules: {},
23
+ useAttrs: {},
24
+ inputAttrs: {},
25
+ valuePropName: {},
26
+ getValuePath: {},
27
+ getValueFromEvent: {},
28
+ formatValue: {},
29
+ onAfterUpdate: {},
30
+ trigger: {},
31
+ name: {},
32
+ rules: {},
33
+ sort: {},
34
+ isJoinParentField: {
35
+ type: Boolean
36
+ },
37
+ errorLayout: {},
38
+ required: {
39
+ type: Boolean
40
+ },
41
+ labelMode: {},
42
+ onlyRuleStyle: {
43
+ type: Boolean
44
+ },
45
+ label: {
46
+ type: [
47
+ Object,
48
+ String,
49
+ Number,
50
+ Boolean,
51
+ null,
52
+ Array
53
+ ]
54
+ },
55
+ helpText: {
56
+ type: [
57
+ Object,
58
+ String,
59
+ Number,
60
+ Boolean,
61
+ null,
62
+ Array
63
+ ]
64
+ },
65
+ extra: {
66
+ type: [
67
+ Object,
68
+ String,
69
+ Number,
70
+ Boolean,
71
+ null,
72
+ Array
73
+ ]
74
+ },
75
+ showColon: {
76
+ type: Boolean
77
+ },
78
+ colSpan: {},
79
+ rowSpan: {},
80
+ htmlFor: {},
81
+ validateResult: {},
82
+ style: {
83
+ type: [
84
+ Boolean,
85
+ null,
86
+ String,
87
+ Object,
88
+ Array
89
+ ]
90
+ },
91
+ class: {},
92
+ labelStyle: {
93
+ type: [
94
+ Boolean,
95
+ null,
96
+ String,
97
+ Object,
98
+ Array
99
+ ]
100
+ },
101
+ labelClass: {}
102
+ },
103
+ setup (__props) {
104
+ const props = __props;
105
+ const slots = useSlots();
106
+ const { isHide } = useRegisterFormHideItem({
107
+ name: props.name,
108
+ sort: props.sort,
109
+ isJoinParentField: props.isJoinParentField
110
+ });
111
+ return (_ctx, _cache)=>unref(isHide) ? createCommentVNode("", true) : (openBlock(), createBlock(form_Item_base, normalizeProps(mergeProps({
112
+ key: 0
113
+ }, props)), createSlots({
114
+ _: 2
115
+ }, [
116
+ renderList(slots, (item, name)=>({
117
+ name,
118
+ fn: withCtx((slotProps)=>[
119
+ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
120
+ ])
121
+ }))
122
+ ]), 1040));
123
+ }
124
+ });
125
+ const form_hide_item = _sfc_main;
126
+ export { form_hide_item as default };
@@ -1,15 +1,13 @@
1
- import { FormItemProps } from '../interface/index';
2
- declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<FormItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FormItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, Readonly<{
1
+ import type { FormItemProps } from "../interface/index";
2
+ type __VLS_Slots = {
3
3
  label: (params: any) => any;
4
4
  helpText: (params: any) => any;
5
5
  extra: (params: any) => any;
6
- }> & {
7
- label: (params: any) => any;
8
- helpText: (params: any) => any;
9
- extra: (params: any) => any;
10
- }>;
6
+ };
7
+ declare const __VLS_component: import("vue").DefineComponent<FormItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
11
9
  export default _default;
12
- type __VLS_WithTemplateSlots<T, S> = T & {
10
+ type __VLS_WithSlots<T, S> = T & {
13
11
  new (): {
14
12
  $slots: S;
15
13
  };
@@ -0,0 +1,155 @@
1
+ import { createBlock, createSlots, defineComponent, guardReactiveProps, mergeProps, normalizeClass, normalizeProps, normalizeStyle, openBlock, renderList, renderSlot, useSlots, withCtx } from "vue";
2
+ import layout_formItem from "../layout/layout.formItem.js";
3
+ import form_Item_base from "./form.Item.base.js";
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ name: "FormItem",
6
+ inheritAttrs: false,
7
+ __name: "formItem",
8
+ props: {
9
+ noStyle: {
10
+ type: Boolean
11
+ },
12
+ input: {},
13
+ dependencies: {},
14
+ noticeOnlyRuleDataField: {},
15
+ isNoticeParentField: {
16
+ type: Boolean
17
+ },
18
+ noticeWatchField: {},
19
+ preserve: {
20
+ type: Boolean
21
+ },
22
+ useRules: {},
23
+ useAttrs: {},
24
+ inputAttrs: {},
25
+ valuePropName: {},
26
+ getValuePath: {},
27
+ getValueFromEvent: {},
28
+ formatValue: {},
29
+ onAfterUpdate: {},
30
+ trigger: {},
31
+ name: {},
32
+ rules: {},
33
+ sort: {},
34
+ isJoinParentField: {
35
+ type: Boolean
36
+ },
37
+ errorLayout: {},
38
+ required: {
39
+ type: Boolean
40
+ },
41
+ labelMode: {},
42
+ onlyRuleStyle: {
43
+ type: Boolean
44
+ },
45
+ label: {
46
+ type: [
47
+ Object,
48
+ String,
49
+ Number,
50
+ Boolean,
51
+ null,
52
+ Array
53
+ ]
54
+ },
55
+ helpText: {
56
+ type: [
57
+ Object,
58
+ String,
59
+ Number,
60
+ Boolean,
61
+ null,
62
+ Array
63
+ ]
64
+ },
65
+ extra: {
66
+ type: [
67
+ Object,
68
+ String,
69
+ Number,
70
+ Boolean,
71
+ null,
72
+ Array
73
+ ]
74
+ },
75
+ showColon: {
76
+ type: Boolean
77
+ },
78
+ colSpan: {},
79
+ rowSpan: {},
80
+ htmlFor: {},
81
+ validateResult: {},
82
+ style: {
83
+ type: [
84
+ Boolean,
85
+ null,
86
+ String,
87
+ Object,
88
+ Array
89
+ ]
90
+ },
91
+ class: {},
92
+ labelStyle: {
93
+ type: [
94
+ Boolean,
95
+ null,
96
+ String,
97
+ Object,
98
+ Array
99
+ ]
100
+ },
101
+ labelClass: {}
102
+ },
103
+ setup (__props) {
104
+ const props = __props;
105
+ const slots = useSlots();
106
+ return (_ctx, _cache)=>props.name ? (openBlock(), createBlock(form_Item_base, normalizeProps(mergeProps({
107
+ key: 0
108
+ }, props)), createSlots({
109
+ _: 2
110
+ }, [
111
+ renderList(slots, (_, name)=>({
112
+ name,
113
+ fn: withCtx((slotProps)=>[
114
+ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
115
+ ])
116
+ }))
117
+ ]), 1040)) : (openBlock(), createBlock(layout_formItem, {
118
+ key: 1,
119
+ label: props.label,
120
+ errorLayout: props.errorLayout,
121
+ labelMode: props.labelMode,
122
+ onlyRuleStyle: props.onlyRuleStyle,
123
+ showColon: props.showColon,
124
+ colSpan: props.colSpan,
125
+ rowSpan: props.rowSpan,
126
+ style: normalizeStyle(props.style),
127
+ class: normalizeClass(props.class),
128
+ labelStyle: props.labelStyle,
129
+ labelClass: props.labelClass
130
+ }, createSlots({
131
+ _: 2
132
+ }, [
133
+ renderList(slots, (_, name)=>({
134
+ name,
135
+ fn: withCtx((slotProps)=>[
136
+ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
137
+ ])
138
+ }))
139
+ ]), 1032, [
140
+ "label",
141
+ "errorLayout",
142
+ "labelMode",
143
+ "onlyRuleStyle",
144
+ "showColon",
145
+ "colSpan",
146
+ "rowSpan",
147
+ "style",
148
+ "class",
149
+ "labelStyle",
150
+ "labelClass"
151
+ ]));
152
+ }
153
+ });
154
+ const formItem = _sfc_main;
155
+ export { formItem as default };
@@ -1,17 +1,14 @@
1
- import { FormItemProps } from '../interface/index';
2
- declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Partial<FormItemProps>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Partial<FormItemProps>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, Readonly<{
1
+ import type { FormItemProps } from "../interface/index";
2
+ type __VLS_Slots = {
3
3
  default: (params: any) => any;
4
4
  label: (params: any) => any;
5
5
  helpText: (params: any) => any;
6
6
  extra: (params: any) => any;
7
- }> & {
8
- default: (params: any) => any;
9
- label: (params: any) => any;
10
- helpText: (params: any) => any;
11
- extra: (params: any) => any;
12
- }>;
7
+ };
8
+ declare const __VLS_component: import("vue").DefineComponent<Partial<FormItemProps>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Partial<FormItemProps>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
13
10
  export default _default;
14
- type __VLS_WithTemplateSlots<T, S> = T & {
11
+ type __VLS_WithSlots<T, S> = T & {
15
12
  new (): {
16
13
  $slots: S;
17
14
  };
@@ -1,69 +1,56 @@
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, {
1
+ export declare const FormItemBase: import("../utils").SFCWithInstall<{
2
+ new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("../index.js").FormItemProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
3
3
  P: {};
4
4
  B: {};
5
5
  D: {};
6
6
  C: {};
7
7
  M: {};
8
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
- }> & {
9
+ }, Readonly<import("../index.js").FormItemProps> & Readonly<{}>, {}, {}, {}, {}, {}>;
10
+ __isFragment?: never;
11
+ __isTeleport?: never;
12
+ __isSuspense?: never;
13
+ } & import("vue").ComponentOptionsBase<Readonly<import("../index.js").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: {
19
15
  label: (params: any) => any;
20
16
  helpText: (params: any) => any;
21
17
  extra: (params: any) => any;
22
18
  };
23
19
  })> & 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, {
20
+ export declare const FormItem: import("../utils").SFCWithInstall<{
21
+ new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<Partial<import("../index.js").FormItemProps>> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
26
22
  P: {};
27
23
  B: {};
28
24
  D: {};
29
25
  C: {};
30
26
  M: {};
31
27
  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
- }> & {
28
+ }, Readonly<Partial<import("../index.js").FormItemProps>> & Readonly<{}>, {}, {}, {}, {}, {}>;
29
+ __isFragment?: never;
30
+ __isTeleport?: never;
31
+ __isSuspense?: never;
32
+ } & import("vue").ComponentOptionsBase<Readonly<Partial<import("../index.js").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 () => {
33
+ $slots: {
43
34
  default: (params: any) => any;
44
35
  label: (params: any) => any;
45
36
  helpText: (params: any) => any;
46
37
  extra: (params: any) => any;
47
38
  };
48
39
  })> & 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, {
40
+ export declare const FormHideItem: import("../utils").SFCWithInstall<{
41
+ new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("../index.js").FormItemProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
51
42
  P: {};
52
43
  B: {};
53
44
  D: {};
54
45
  C: {};
55
46
  M: {};
56
47
  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
- }> & {
48
+ }, Readonly<import("../index.js").FormItemProps> & Readonly<{}>, {}, {}, {}, {}, {}>;
49
+ __isFragment?: never;
50
+ __isTeleport?: never;
51
+ __isSuspense?: never;
52
+ } & import("vue").ComponentOptionsBase<Readonly<import("../index.js").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 () => {
53
+ $slots: {
67
54
  label: (params: any) => any;
68
55
  helpText: (params: any) => any;
69
56
  extra: (params: any) => any;
@@ -0,0 +1,8 @@
1
+ import form_Item_base from "./form.Item.base.js";
2
+ import formItem from "./formItem.js";
3
+ import form_hide_item from "./form.hide.item.js";
4
+ import { withInstall } from "../utils/index.js";
5
+ const FormItemBase = withInstall(form_Item_base);
6
+ const FormItem = withInstall(formItem);
7
+ const FormHideItem = withInstall(form_hide_item);
8
+ export { FormHideItem, FormItem, FormItemBase };
@@ -1,7 +1,7 @@
1
1
  import { FormInstanceBase, FormItemInstanceBase } from '@carefrees/form-utils';
2
2
  import { RegisterFormItemOptions } from './../register/register.FormItem';
3
3
  import { Ref } from 'vue';
4
- import { RuleInstanceBase2 } from '../../instance/ruleIntsnace';
4
+ import type { RuleInstanceBase2 } from '../../instance/ruleIntsnace';
5
5
  export interface FormItemAttrOptions extends RegisterFormItemOptions {
6
6
  /**依赖更新项*/
7
7
  dependencies?: string[];
@@ -35,12 +35,12 @@ export interface FormItemAttrOptions extends RegisterFormItemOptions {
35
35
  /**表单项参数*/
36
36
  export declare const useFormItemAttr: (options: FormItemAttrOptions) => {
37
37
  valuePropName: string;
38
- htmlFor: import('vue').ComputedRef<string>;
38
+ htmlFor: import("vue").ComputedRef<string>;
39
39
  onChange: (event: any) => void;
40
40
  formItemInstance: FormItemInstanceBase;
41
41
  form: FormInstanceBase<any>;
42
42
  ruleInstance: Ref<RuleInstanceBase2, RuleInstanceBase2>;
43
- newAttrs: import('vue').ComputedRef<{
43
+ newAttrs: import("vue").ComputedRef<{
44
44
  name: string;
45
45
  id: string;
46
46
  constructor: Function;
@@ -92,6 +92,6 @@ export declare const useFormItemAttr: (options: FormItemAttrOptions) => {
92
92
  tip: string | (string | undefined)[];
93
93
  isInvalid: boolean;
94
94
  }>;
95
- newSort: import('vue').ComputedRef<string>;
96
- newName: import('vue').ComputedRef<string>;
95
+ newSort: import("vue").ComputedRef<string>;
96
+ newName: import("vue").ComputedRef<string>;
97
97
  };
@@ -0,0 +1,97 @@
1
+ import { get } from "@carefrees/form-utils";
2
+ import { useHtmlFor } from "../useHtmlFor.js";
3
+ import { useRegisterFormItem } from "../register/register.FormItem.js";
4
+ import { computed, ref, toValue, watch } from "vue";
5
+ const useFormItemAttr = (options)=>{
6
+ const { trigger = 'onChange', dependencies, noticeOnlyRuleDataField, isNoticeParentField, noticeWatchField, preserve, valuePropName = 'value', getValuePath = valuePropName, getValueFromEvent, formatValue, onAfterUpdate, useAttrs, useRules, inputAttrs, ...rest } = options;
7
+ const { formItemInstance, form, ruleInstance, newName, newSort, deepRefData } = useRegisterFormItem({
8
+ ...rest
9
+ });
10
+ formItemInstance.dependencies = dependencies;
11
+ formItemInstance.noticeOnlyRuleDataField = noticeOnlyRuleDataField;
12
+ formItemInstance.isNoticeParentField = isNoticeParentField;
13
+ formItemInstance.onAfterUpdate = onAfterUpdate;
14
+ formItemInstance.noticeWatchField = noticeWatchField;
15
+ formItemInstance.preserve = preserve;
16
+ const oldValue = ref(get(form.formData, toValue(newName)));
17
+ watch(()=>[
18
+ get(form.formData, toValue(newName)),
19
+ toValue(newName)
20
+ ], ()=>{
21
+ oldValue.value = form.getFieldValue(toValue(newName));
22
+ }, {
23
+ immediate: true
24
+ });
25
+ const onValueChange = (event)=>{
26
+ try {
27
+ let value = event;
28
+ if ('function' == typeof getValueFromEvent) value = getValueFromEvent(event, form, formItemInstance);
29
+ else if (event && event.target && 'object' == typeof event.target && getValuePath in event.target) value = get(event.target, getValuePath);
30
+ if ('function' == typeof formatValue) value = formatValue(value, form, formItemInstance, event);
31
+ if (oldValue.value !== value) {
32
+ form.updatedFieldValue(toValue(newName), value, 'validate');
33
+ formItemInstance.onAfterUpdate?.(value, form, formItemInstance, event);
34
+ if (Array.isArray(formItemInstance.noticeWatchField) && formItemInstance.noticeWatchField.length) form.noticeWatch(formItemInstance.noticeWatchField);
35
+ if (Array.isArray(formItemInstance.noticeOnlyRuleDataField) && formItemInstance.noticeOnlyRuleDataField.length) form.onlyValidate(formItemInstance.noticeOnlyRuleDataField);
36
+ if (formItemInstance.isNoticeParentField && formItemInstance.parentDataField) form.notice(formItemInstance.parentDataField);
37
+ }
38
+ } catch (error) {
39
+ console.log(error);
40
+ }
41
+ };
42
+ formItemInstance.onChange = onValueChange;
43
+ const htmlFor = useHtmlFor(newName);
44
+ watch(()=>htmlFor, ()=>{
45
+ formItemInstance.htmlFor = htmlFor.value;
46
+ }, {
47
+ immediate: true
48
+ });
49
+ const newAttrs = computed(()=>{
50
+ const _attr = inputAttrs || {};
51
+ return {
52
+ ..._attr,
53
+ [trigger]: onValueChange,
54
+ name: toValue(newName),
55
+ id: toValue(htmlFor),
56
+ [valuePropName]: toValue(oldValue)
57
+ };
58
+ });
59
+ const attrsLastData = ref(toValue(newAttrs));
60
+ watch(()=>[
61
+ toValue(newAttrs),
62
+ toValue(deepRefData),
63
+ toValue(oldValue)
64
+ ], ()=>{
65
+ attrsLastData.value = useAttrs?.(toValue(newAttrs), form, formItemInstance) || toValue(newAttrs);
66
+ }, {
67
+ immediate: true
68
+ });
69
+ const validateResult = ref(toValue(ruleInstance).getValidateResult());
70
+ watch(()=>[
71
+ toValue(deepRefData),
72
+ toValue(oldValue)
73
+ ], ()=>{
74
+ useRules?.(ruleInstance, form, formItemInstance);
75
+ });
76
+ watch(()=>[
77
+ toValue(ruleInstance).messages,
78
+ toValue(ruleInstance).rules,
79
+ toValue(oldValue)
80
+ ], ()=>{
81
+ validateResult.value = toValue(ruleInstance).getValidateResult();
82
+ });
83
+ return {
84
+ valuePropName,
85
+ htmlFor,
86
+ onChange: onValueChange,
87
+ formItemInstance,
88
+ form,
89
+ ruleInstance,
90
+ newAttrs,
91
+ attrsLastData,
92
+ validateResult,
93
+ newSort,
94
+ newName
95
+ };
96
+ };
97
+ export { useFormItemAttr };
@@ -0,0 +1,13 @@
1
+ export * from "./useAttrs.js";
2
+ export * from "./useForm.js";
3
+ export * from "./useFormItem.js";
4
+ export * from "./useFormList.js";
5
+ export * from "./useHtmlFor.js";
6
+ export * from "./useMultipleForm.js";
7
+ export * from "./useFormItemParentName.js";
8
+ export * from "./useEffect.js";
9
+ export * from "./register/register.FormHideItem.js";
10
+ export * from "./register/register.FormItem.js";
11
+ export * from "./register/register.FormList.js";
12
+ export * from "./register/register.form.js";
13
+ export * from "./attr/attr.FormItem.js";
@@ -3,7 +3,7 @@ interface RegisterFormHideItemOptions extends Omit<RegisterFormItemOptions, 'rul
3
3
  }
4
4
  /**注册表单隐藏表单项到表单实例中*/
5
5
  export declare const useRegisterFormHideItem: (options: RegisterFormHideItemOptions) => {
6
- form: import('@carefrees/form-utils').FormInstanceBase<any>;
7
- isHide: import('vue').Ref<any, any>;
6
+ form: import("@carefrees/form-utils").FormInstanceBase<any>;
7
+ isHide: import("vue").Ref<any, any>;
8
8
  };
9
9
  export {};
@@ -0,0 +1,42 @@
1
+ import { ref, toValue, watch } from "vue";
2
+ import { FormHideItemInstanceBase } from "@carefrees/form-utils";
3
+ import { useFormItemParentNameInject } from "../useFormItemParentName.js";
4
+ import { useFormInject } from "../useForm.js";
5
+ import { useEffect } from "../useEffect.js";
6
+ const useRegisterFormHideItem = (options)=>{
7
+ const { name, sort, isJoinParentField = true } = options;
8
+ const form = useFormInject();
9
+ const { newName, newSort } = useFormItemParentNameInject({
10
+ name,
11
+ sort,
12
+ isJoinParentField
13
+ });
14
+ const hideItemInstance = ref(new FormHideItemInstanceBase().ctor(newName.value));
15
+ const isHide = ref(form.getFieldHideValue(newName.value));
16
+ watch(()=>[
17
+ toValue(isHide)
18
+ ], ()=>{
19
+ hideItemInstance.value.preHideValue = isHide.value;
20
+ }, {
21
+ immediate: true
22
+ });
23
+ const setValue = ()=>{
24
+ isHide.value = form.getFieldHideValue(newName.value);
25
+ };
26
+ hideItemInstance.value.updatedItem = setValue;
27
+ watch(()=>[
28
+ form,
29
+ toValue(newSort)
30
+ ], ()=>{
31
+ hideItemInstance.value.instance = form;
32
+ hideItemInstance.value.sort = toValue(newSort);
33
+ }, {
34
+ immediate: true
35
+ });
36
+ useEffect(()=>form.registerFormHideItem(toValue(hideItemInstance)));
37
+ return {
38
+ form,
39
+ isHide
40
+ };
41
+ };
42
+ export { useRegisterFormHideItem };