@carefrees/form-utils-vue 0.0.11 → 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,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const layout_vue_vue_type_script_setup_true_lang = require("./layout.vue.js");
4
- const layout_formItem_vue_vue_type_script_setup_true_lang = require("./layout.formItem.vue.js");
5
- const layout_form_rows_vue_vue_type_script_setup_true_lang = require("./layout.form.rows.vue.js");
6
- const withInstall = require("../utils/withInstall.js");
7
- const Layout = withInstall.withInstall(layout_vue_vue_type_script_setup_true_lang.default);
8
- const LayoutFormItem = withInstall.withInstall(layout_formItem_vue_vue_type_script_setup_true_lang.default);
9
- const FormLayoutRows = withInstall.withInstall(layout_form_rows_vue_vue_type_script_setup_true_lang.default);
10
- exports.FormLayoutRows = FormLayoutRows;
11
- exports.Layout = Layout;
12
- exports.LayoutFormItem = LayoutFormItem;
@@ -1,10 +0,0 @@
1
- import { HTMLAttributes } from 'vue';
2
- declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<HTMLAttributes, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<HTMLAttributes> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
3
- default?(_: {}): any;
4
- }>;
5
- export default _default;
6
- type __VLS_WithTemplateSlots<T, S> = T & {
7
- new (): {
8
- $slots: S;
9
- };
10
- };
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const vue = require("vue");
4
- const clx = require("classnames");
5
- const __default__ = vue.defineComponent({
6
- name: "FormLayoutRows",
7
- inheritAttrs: false
8
- // 可选,防止属性自动应用到根元素
9
- });
10
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
11
- ...__default__,
12
- setup(__props) {
13
- const preCls = "carefrees-form-layout";
14
- const props = __props;
15
- const cls = vue.computed(() => clx(preCls, props.class, {
16
- "all-colspan": true
17
- }));
18
- return (_ctx, _cache) => {
19
- return vue.openBlock(), vue.createElementBlock(
20
- "div",
21
- vue.mergeProps(props, { class: cls.value }),
22
- [
23
- vue.renderSlot(_ctx.$slots, "default")
24
- ],
25
- 16
26
- /* FULL_PROPS */
27
- );
28
- };
29
- }
30
- });
31
- exports.default = _sfc_main;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const layout_form_rows_vue_vue_type_script_setup_true_lang = require("./layout.form.rows.vue.js");
4
- exports.default = layout_form_rows_vue_vue_type_script_setup_true_lang.default;
@@ -1,18 +0,0 @@
1
- import { LayoutFormItemProps } from '../interface/layout.formItem';
2
- declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<LayoutFormItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<LayoutFormItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, Readonly<{
3
- default: any;
4
- label: any;
5
- helpText: any;
6
- extra: any;
7
- }> & {
8
- default: any;
9
- label: any;
10
- helpText: any;
11
- extra: any;
12
- }>;
13
- export default _default;
14
- type __VLS_WithTemplateSlots<T, S> = T & {
15
- new (): {
16
- $slots: S;
17
- };
18
- };
@@ -1,216 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const vue = require("vue");
4
- const clx = require("classnames");
5
- const useAttrs = require("../hooks/useAttrs.js");
6
- const _hoisted_1 = ["for"];
7
- const __default__ = vue.defineComponent({
8
- name: "LayoutFormItem",
9
- inheritAttrs: false
10
- // 可选,防止属性自动应用到根元素
11
- });
12
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
13
- ...__default__,
14
- props: {
15
- errorLayout: {},
16
- required: { type: Boolean },
17
- labelMode: {},
18
- onlyRuleStyle: { type: Boolean },
19
- label: { type: [Object, String, Number, Boolean, null, Array] },
20
- helpText: { type: [Object, String, Number, Boolean, null, Array] },
21
- extra: { type: [Object, String, Number, Boolean, null, Array] },
22
- showColon: { type: Boolean },
23
- colSpan: {},
24
- rowSpan: {},
25
- htmlFor: {},
26
- validateResult: {},
27
- style: { type: [Boolean, null, String, Object, Array] },
28
- class: {},
29
- labelStyle: { type: [Boolean, null, String, Object, Array] },
30
- labelClass: {}
31
- },
32
- setup(__props) {
33
- const preCls = "carefrees-form-item";
34
- const attrs = useAttrs.useAttrsInject();
35
- const props = __props;
36
- const solts = vue.useSlots();
37
- const labelMode = vue.computed(() => props.labelMode ?? vue.toValue(attrs.value.labelMode) ?? "top");
38
- const showColon = vue.computed(() => props.showColon ?? vue.toValue(attrs.value.showColon));
39
- const errorLayout = vue.computed(() => props.errorLayout ?? vue.toValue(attrs.value.errorLayout) ?? "left-bottom");
40
- const tips = vue.computed(() => {
41
- var _a;
42
- const v = (_a = vue.toValue(props.validateResult)) == null ? void 0 : _a.tip;
43
- if (Array.isArray(v)) {
44
- return v.join(",");
45
- }
46
- return v;
47
- });
48
- const cls = vue.computed(() => {
49
- var _a;
50
- return clx(preCls, props.class, vue.toValue(attrs.value.formItemClass), { "dx-invalid": !!((_a = vue.toValue(props.validateResult)) == null ? void 0 : _a.isInvalid) });
51
- });
52
- const containerCls = vue.computed(() => clx(`${preCls}-container`, { [`${labelMode.value}`]: !!labelMode.value }));
53
- const labelCls = vue.computed(() => clx(`${preCls}-label`, { required: !!props.required, "show-colon": showColon && (labelMode.value === "left" || labelMode.value === "between") }));
54
- const labelWarpCls = vue.computed(() => clx(`${preCls}-label-warp`, vue.toValue(props.labelClass), vue.toValue(attrs.value.formItemLabelClass)));
55
- const inputCls = vue.computed(() => clx(`${preCls}-body-input`));
56
- const errorCls = vue.computed(() => clx(`${preCls}-body-error`, { [errorLayout.value]: !!errorLayout.value }));
57
- const _isLabel = vue.computed(() => (props.label || solts.label) && labelMode.value !== "hide");
58
- const style = vue.computed(() => {
59
- const css = {};
60
- if (props.onlyRuleStyle) {
61
- css.padding = "0px";
62
- }
63
- if (props.colSpan) {
64
- const colCount = vue.toValue(attrs.value.colCount) || 4;
65
- const end = colCount > props.colSpan ? props.colSpan : colCount;
66
- css.gridColumnEnd = `span ${end}`;
67
- }
68
- if (props.rowSpan) {
69
- css.gridRowEnd = `span ${props.rowSpan}`;
70
- }
71
- return [vue.toValue(attrs.value.formItemStyle), props.style, css];
72
- });
73
- const labelStyle = vue.computed(() => {
74
- return [vue.toValue(attrs.value.formItemLabelStyle), props.labelStyle];
75
- });
76
- const isHelpText = vue.computed(() => {
77
- return !!props.helpText || solts.helpText;
78
- });
79
- const isExtra = vue.computed(() => {
80
- return !!props.extra || solts.extra;
81
- });
82
- return (_ctx, _cache) => {
83
- return vue.openBlock(), vue.createElementBlock(
84
- "div",
85
- {
86
- class: vue.normalizeClass(cls.value),
87
- style: vue.normalizeStyle(style.value)
88
- },
89
- [
90
- vue.createElementVNode(
91
- "div",
92
- {
93
- class: vue.normalizeClass(containerCls.value)
94
- },
95
- [
96
- _isLabel.value ? (vue.openBlock(), vue.createElementBlock(
97
- "div",
98
- {
99
- key: 0,
100
- class: vue.normalizeClass(labelWarpCls.value)
101
- },
102
- [
103
- vue.createElementVNode("label", {
104
- style: vue.normalizeStyle(labelStyle.value),
105
- class: vue.normalizeClass(labelCls.value),
106
- for: vue.toValue(props.htmlFor)
107
- }, [
108
- props.label ? (vue.openBlock(), vue.createElementBlock(
109
- vue.Fragment,
110
- { key: 0 },
111
- [
112
- vue.createTextVNode(
113
- vue.toDisplayString(props.label),
114
- 1
115
- /* TEXT */
116
- )
117
- ],
118
- 64
119
- /* STABLE_FRAGMENT */
120
- )) : vue.renderSlot(_ctx.$slots, "label", { key: 1 })
121
- ], 14, _hoisted_1)
122
- ],
123
- 2
124
- /* CLASS */
125
- )) : vue.createCommentVNode("v-if", true),
126
- vue.createElementVNode(
127
- "div",
128
- {
129
- class: vue.normalizeClass(preCls + "-body")
130
- },
131
- [
132
- vue.createElementVNode(
133
- "div",
134
- {
135
- class: vue.normalizeClass(inputCls.value)
136
- },
137
- [
138
- vue.renderSlot(_ctx.$slots, "default")
139
- ],
140
- 2
141
- /* CLASS */
142
- ),
143
- isHelpText.value ? (vue.openBlock(), vue.createElementBlock(
144
- "div",
145
- {
146
- key: 0,
147
- class: vue.normalizeClass(preCls + "-body-help")
148
- },
149
- [
150
- props.helpText ? (vue.openBlock(), vue.createElementBlock(
151
- vue.Fragment,
152
- { key: 0 },
153
- [
154
- vue.createTextVNode(
155
- vue.toDisplayString(props.helpText),
156
- 1
157
- /* TEXT */
158
- )
159
- ],
160
- 64
161
- /* STABLE_FRAGMENT */
162
- )) : vue.renderSlot(_ctx.$slots, "helpText", { key: 1 })
163
- ],
164
- 2
165
- /* CLASS */
166
- )) : vue.createCommentVNode("v-if", true),
167
- !!tips.value ? (vue.openBlock(), vue.createElementBlock(
168
- "div",
169
- {
170
- key: 1,
171
- class: vue.normalizeClass(errorCls.value)
172
- },
173
- vue.toDisplayString(tips.value),
174
- 3
175
- /* TEXT, CLASS */
176
- )) : vue.createCommentVNode("v-if", true)
177
- ],
178
- 2
179
- /* CLASS */
180
- )
181
- ],
182
- 2
183
- /* CLASS */
184
- ),
185
- isExtra.value ? (vue.openBlock(), vue.createElementBlock(
186
- "div",
187
- {
188
- key: 0,
189
- class: vue.normalizeClass(preCls + "-extra")
190
- },
191
- [
192
- props.extra ? (vue.openBlock(), vue.createElementBlock(
193
- vue.Fragment,
194
- { key: 0 },
195
- [
196
- vue.createTextVNode(
197
- vue.toDisplayString(props.extra),
198
- 1
199
- /* TEXT */
200
- )
201
- ],
202
- 64
203
- /* STABLE_FRAGMENT */
204
- )) : vue.renderSlot(_ctx.$slots, "extra", { key: 1 })
205
- ],
206
- 2
207
- /* CLASS */
208
- )) : vue.createCommentVNode("v-if", true)
209
- ],
210
- 6
211
- /* CLASS, STYLE */
212
- );
213
- };
214
- }
215
- });
216
- exports.default = _sfc_main;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const layout_formItem_vue_vue_type_script_setup_true_lang = require("./layout.formItem.vue.js");
4
- exports.default = layout_formItem_vue_vue_type_script_setup_true_lang.default;
@@ -1,16 +0,0 @@
1
- import { FormLayoutProps } from '../interface/layout';
2
- declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<FormLayoutProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FormLayoutProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, Readonly<{
3
- default: any;
4
- title: any;
5
- extra: any;
6
- }> & {
7
- default: any;
8
- title: any;
9
- extra: any;
10
- }>;
11
- export default _default;
12
- type __VLS_WithTemplateSlots<T, S> = T & {
13
- new (): {
14
- $slots: S;
15
- };
16
- };
@@ -1,166 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const vue = require("vue");
4
- const clx = require("classnames");
5
- const useAttrs = require("../hooks/useAttrs.js");
6
- const __default__ = vue.defineComponent({
7
- name: "Layout",
8
- inheritAttrs: false
9
- // 可选,防止属性自动应用到根元素
10
- });
11
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
12
- ...__default__,
13
- props: {
14
- title: { type: [Object, String, Number, Boolean, null, Array] },
15
- extra: { type: [Object, String, Number, Boolean, null, Array] },
16
- isAllColSpan: { type: Boolean },
17
- class: {},
18
- headerClass: {},
19
- bodyClass: {},
20
- style: { type: [Boolean, null, String, Object, Array] },
21
- headerStyle: { type: [Boolean, null, String, Object, Array] },
22
- bodyStyle: { type: [Boolean, null, String, Object, Array] },
23
- bordered: { type: Boolean },
24
- colCount: {},
25
- gap: {},
26
- errorLayout: {},
27
- labelMode: {},
28
- showColon: {},
29
- formItemClass: {},
30
- formItemStyle: {},
31
- formItemLabelClass: {},
32
- formItemLabelStyle: {}
33
- },
34
- setup(__props) {
35
- const preCls = "carefrees-form-layout";
36
- const attrs = useAttrs.useAttrsInject();
37
- const props = __props;
38
- const solts = vue.useSlots();
39
- const colCount = vue.computed(() => vue.toValue(props.colCount) ?? vue.toValue(attrs.value.colCount));
40
- const errorLayout = vue.computed(() => vue.toValue(props.errorLayout) ?? vue.toValue(attrs.value.errorLayout));
41
- const labelMode = vue.computed(() => vue.toValue(props.labelMode) ?? vue.toValue(attrs.value.labelMode));
42
- const showColon = vue.computed(() => vue.toValue(props.showColon) ?? vue.toValue(attrs.value.showColon));
43
- const formItemClass = vue.computed(() => vue.toValue(props.formItemClass) ?? vue.toValue(attrs.value.formItemClass));
44
- const formItemStyle = vue.computed(() => vue.toValue(props.formItemStyle) ?? vue.toValue(attrs.value.formItemStyle));
45
- const formItemLabelClass = vue.computed(() => vue.toValue(props.formItemLabelClass) ?? vue.toValue(attrs.value.formItemLabelClass));
46
- const formItemLabelStyle = vue.computed(() => vue.toValue(props.formItemLabelStyle) ?? vue.toValue(attrs.value.formItemLabelStyle));
47
- useAttrs.useAttrsProvide({
48
- colCount,
49
- errorLayout,
50
- labelMode,
51
- showColon,
52
- formItemClass,
53
- formItemStyle,
54
- formItemLabelClass,
55
- formItemLabelStyle
56
- });
57
- const cls = vue.computed(() => clx(preCls, props.class, { "all-colspan": props.isAllColSpan, bordered: props.bordered }));
58
- const bodyCls = vue.computed(() => clx(`${preCls}-body`, props.bodyClass));
59
- const headerCls = vue.computed(() => clx(`${preCls}-header`, props.headerClass));
60
- const headerTitleCls = vue.computed(() => clx(`${preCls}-header-title`));
61
- const headerExtraCls = vue.computed(() => clx(`${preCls}-header-extra`));
62
- const bodyStyle = vue.computed(() => {
63
- const css = {};
64
- if (typeof props.gap === "string") {
65
- css.gap = props.gap;
66
- }
67
- if (typeof props.gap === "number") {
68
- css.gap = `${props.gap}px`;
69
- }
70
- if (colCount.value) {
71
- css.gridTemplateColumns = `repeat(${colCount.value}, auto)`;
72
- }
73
- return [css, props.bodyStyle];
74
- });
75
- const isTitle = vue.computed(() => {
76
- return !!props.title || solts.title;
77
- });
78
- const isExtra = vue.computed(() => {
79
- return !!props.extra || solts.extra;
80
- });
81
- return (_ctx, _cache) => {
82
- return vue.openBlock(), vue.createElementBlock(
83
- "div",
84
- {
85
- style: vue.normalizeStyle(props.style),
86
- class: vue.normalizeClass(cls.value)
87
- },
88
- [
89
- isExtra.value || isTitle.value ? (vue.openBlock(), vue.createElementBlock(
90
- "div",
91
- {
92
- key: 0,
93
- style: vue.normalizeStyle(_ctx.headerStyle),
94
- class: vue.normalizeClass(headerCls.value)
95
- },
96
- [
97
- vue.createElementVNode(
98
- "div",
99
- {
100
- class: vue.normalizeClass(headerTitleCls.value)
101
- },
102
- [
103
- props.title ? (vue.openBlock(), vue.createElementBlock(
104
- vue.Fragment,
105
- { key: 0 },
106
- [
107
- vue.createTextVNode(
108
- vue.toDisplayString(props.title),
109
- 1
110
- /* TEXT */
111
- )
112
- ],
113
- 64
114
- /* STABLE_FRAGMENT */
115
- )) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
116
- ],
117
- 2
118
- /* CLASS */
119
- ),
120
- vue.createElementVNode(
121
- "div",
122
- {
123
- class: vue.normalizeClass(headerExtraCls.value)
124
- },
125
- [
126
- props.extra ? (vue.openBlock(), vue.createElementBlock(
127
- vue.Fragment,
128
- { key: 0 },
129
- [
130
- vue.createTextVNode(
131
- vue.toDisplayString(props.extra),
132
- 1
133
- /* TEXT */
134
- )
135
- ],
136
- 64
137
- /* STABLE_FRAGMENT */
138
- )) : vue.renderSlot(_ctx.$slots, "extra", { key: 1 })
139
- ],
140
- 2
141
- /* CLASS */
142
- )
143
- ],
144
- 6
145
- /* CLASS, STYLE */
146
- )) : vue.createCommentVNode("v-if", true),
147
- vue.createElementVNode(
148
- "div",
149
- {
150
- style: vue.normalizeStyle(bodyStyle.value),
151
- class: vue.normalizeClass(bodyCls.value)
152
- },
153
- [
154
- vue.renderSlot(_ctx.$slots, "default")
155
- ],
156
- 6
157
- /* CLASS, STYLE */
158
- )
159
- ],
160
- 6
161
- /* CLASS, STYLE */
162
- );
163
- };
164
- }
165
- });
166
- exports.default = _sfc_main;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const layout_vue_vue_type_script_setup_true_lang = require("./layout.vue.js");
4
- exports.default = layout_vue_vue_type_script_setup_true_lang.default;
@@ -1 +0,0 @@
1
- export * from './withInstall';
@@ -1,3 +0,0 @@
1
- import { Plugin } from 'vue';
2
- export type SFCWithInstall<T> = T & Plugin;
3
- export declare const withInstall: <T, E extends Record<string, any> = Record<string, any>, K extends Record<string, any> = Record<string, any>>(main: T, extra?: E | undefined, childComponents?: K | undefined) => SFCWithInstall<T> & E & K;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const withInstall = (main, extra, childComponents) => {
4
- main.install = (app) => {
5
- for (const comp of [main, ...Object.values(childComponents ?? {})]) {
6
- const name = comp.name || comp.__name;
7
- app.component(name, comp);
8
- }
9
- };
10
- if (childComponents) {
11
- for (const [key, comp] of Object.entries(childComponents)) {
12
- main[key] = comp;
13
- }
14
- }
15
- if (extra) {
16
- for (const [key, comp] of Object.entries(extra)) {
17
- main[key] = comp;
18
- }
19
- }
20
- return main;
21
- };
22
- exports.withInstall = withInstall;
package/src/vite-env.d.ts DELETED
@@ -1 +0,0 @@
1
- /// <reference types="vite/client" />