@carefrees/form-utils-vue 0.0.11 → 0.0.13

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 (176) hide show
  1. package/README.md +104 -2
  2. package/assets/index.css +23 -12
  3. package/esm/component.js +3 -0
  4. package/esm/form/form.js +161 -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 +157 -0
  9. package/esm/formItem/form.Item.base.vue.d.ts +7 -8
  10. package/esm/formItem/form.hide.item.js +122 -0
  11. package/esm/formItem/form.hide.item.vue.d.ts +7 -8
  12. package/esm/formItem/formItem.js +151 -0
  13. package/esm/formItem/formItem.vue.d.ts +6 -9
  14. package/esm/formItem/index.d.ts +26 -37
  15. package/esm/formItem/index.js +8 -0
  16. package/esm/index.d.ts +2 -2
  17. package/esm/index.js +13 -0
  18. package/esm/interface/index.d.ts +6 -11
  19. package/esm/interface/index.js +0 -0
  20. package/esm/interface/layout.d.ts +1 -1
  21. package/esm/interface/layout.formItem.d.ts +1 -1
  22. package/esm/interface/layout.formItem.js +0 -0
  23. package/esm/interface/layout.js +0 -0
  24. package/esm/layout/index.d.ts +24 -33
  25. package/esm/layout/index.js +8 -0
  26. package/esm/layout/layout.form.rows.js +21 -0
  27. package/esm/layout/layout.form.rows.vue.d.ts +8 -5
  28. package/esm/layout/layout.formItem.js +195 -0
  29. package/esm/layout/layout.formItem.vue.d.ts +6 -9
  30. package/esm/layout/layout.js +160 -0
  31. package/esm/layout/layout.vue.d.ts +6 -8
  32. package/esm/utils/index.js +1 -0
  33. package/esm/utils/withInstall.d.ts +2 -2
  34. package/esm/utils/withInstall.js +15 -0
  35. package/package.json +7 -8
  36. package/src/form/form.vue +21 -7
  37. package/src/formItem/form.Item.base.vue +5 -5
  38. package/src/formItem/form.hide.item.vue +3 -1
  39. package/src/formItem/formItem.vue +2 -1
  40. package/src/index.ts +1 -1
  41. package/src/interface/index.ts +6 -13
  42. package/src/interface/layout.formItem.ts +1 -2
  43. package/src/interface/layout.ts +2 -1
  44. package/src/layout/layout.formItem.vue +2 -1
  45. package/src/layout/layout.vue +2 -1
  46. package/esm/component.mjs +0 -12
  47. package/esm/form/form.vue.mjs +0 -110
  48. package/esm/form/form.vue2.mjs +0 -4
  49. package/esm/form/index.mjs +0 -6
  50. package/esm/formItem/form.Item.base.vue.mjs +0 -114
  51. package/esm/formItem/form.Item.base.vue2.mjs +0 -4
  52. package/esm/formItem/form.hide.item.vue.mjs +0 -78
  53. package/esm/formItem/form.hide.item.vue2.mjs +0 -4
  54. package/esm/formItem/formItem.vue.mjs +0 -102
  55. package/esm/formItem/formItem.vue2.mjs +0 -4
  56. package/esm/formItem/index.mjs +0 -12
  57. package/esm/hooks/attr/attr.FormItem.d.ts +0 -97
  58. package/esm/hooks/attr/attr.FormItem.mjs +0 -120
  59. package/esm/hooks/index.d.ts +0 -13
  60. package/esm/hooks/register/register.FormHideItem.d.ts +0 -9
  61. package/esm/hooks/register/register.FormHideItem.mjs +0 -38
  62. package/esm/hooks/register/register.FormItem.d.ts +0 -23
  63. package/esm/hooks/register/register.FormItem.mjs +0 -55
  64. package/esm/hooks/register/register.FormList.d.ts +0 -9
  65. package/esm/hooks/register/register.FormList.mjs +0 -43
  66. package/esm/hooks/register/register.form.d.ts +0 -3
  67. package/esm/hooks/register/register.form.mjs +0 -12
  68. package/esm/hooks/useAttrs.d.ts +0 -24
  69. package/esm/hooks/useAttrs.mjs +0 -43
  70. package/esm/hooks/useEffect.d.ts +0 -2
  71. package/esm/hooks/useEffect.mjs +0 -14
  72. package/esm/hooks/useForm.d.ts +0 -8
  73. package/esm/hooks/useForm.mjs +0 -26
  74. package/esm/hooks/useFormItem.d.ts +0 -7
  75. package/esm/hooks/useFormItem.mjs +0 -26
  76. package/esm/hooks/useFormItemParentName.d.ts +0 -18
  77. package/esm/hooks/useFormItemParentName.mjs +0 -37
  78. package/esm/hooks/useFormList.d.ts +0 -7
  79. package/esm/hooks/useFormList.mjs +0 -26
  80. package/esm/hooks/useHtmlFor.d.ts +0 -2
  81. package/esm/hooks/useHtmlFor.mjs +0 -11
  82. package/esm/hooks/useMultipleForm.d.ts +0 -7
  83. package/esm/hooks/useMultipleForm.mjs +0 -27
  84. package/esm/index.mjs +0 -59
  85. package/esm/instance/ruleIntsnace.d.ts +0 -49
  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/hooks/attr/attr.FormItem.tsx +0 -174
  162. package/src/hooks/index.ts +0 -13
  163. package/src/hooks/register/register.FormHideItem.ts +0 -45
  164. package/src/hooks/register/register.FormItem.ts +0 -80
  165. package/src/hooks/register/register.FormList.ts +0 -49
  166. package/src/hooks/register/register.form.ts +0 -12
  167. package/src/hooks/useAttrs.ts +0 -64
  168. package/src/hooks/useEffect.ts +0 -13
  169. package/src/hooks/useForm.ts +0 -28
  170. package/src/hooks/useFormItem.ts +0 -28
  171. package/src/hooks/useFormItemParentName.ts +0 -49
  172. package/src/hooks/useFormList.ts +0 -28
  173. package/src/hooks/useHtmlFor.ts +0 -9
  174. package/src/hooks/useMultipleForm.ts +0 -29
  175. package/src/instance/ruleIntsnace.ts +0 -105
  176. package/src/vite-env.d.ts +0 -1
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const formUtils = require("@carefrees/form-utils");
4
- const vue = require("vue");
5
- const formListProvideSymbol = Symbol("carefrees-form-list");
6
- function useFormListProvide(formList) {
7
- vue.provide(formListProvideSymbol, formList);
8
- }
9
- function useFormListInject() {
10
- const formList = vue.inject(formListProvideSymbol, new formUtils.FormListInstanceBase());
11
- return formList;
12
- }
13
- function useFormList(formList) {
14
- const refForm = vue.ref();
15
- if (!refForm.value) {
16
- if (formList) {
17
- refForm.value = formList;
18
- } else {
19
- refForm.value = new formUtils.FormListInstanceBase();
20
- }
21
- }
22
- return refForm.value;
23
- }
24
- exports.useFormList = useFormList;
25
- exports.useFormListInject = useFormListInject;
26
- exports.useFormListProvide = useFormListProvide;
@@ -1,2 +0,0 @@
1
- import { Ref } from 'vue';
2
- export declare const useHtmlFor: (suffix: Ref<string>) => import('vue').ComputedRef<string>;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const vue = require("vue");
4
- let localId = 0;
5
- const useHtmlFor = (suffix) => {
6
- const count = vue.ref(localId++);
7
- return vue.computed(() => {
8
- return `carefree-vue-form-item_${count.value.toString(32)}_${suffix.value}`;
9
- });
10
- };
11
- exports.useHtmlFor = useHtmlFor;
@@ -1,7 +0,0 @@
1
- import { MultipleInstanceBase } from '@carefrees/form-utils';
2
- /**多表单收集 Context */
3
- export declare function useMultipleFormProvide(multipleForm?: MultipleInstanceBase): void;
4
- /**子项中获取 多表单收集 实例*/
5
- export declare function useMultipleFormInject(): MultipleInstanceBase;
6
- /**初始化 多表单收集 实例*/
7
- export declare function useMultipleForm(multipleForm?: MultipleInstanceBase): MultipleInstanceBase;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const formUtils = require("@carefrees/form-utils");
4
- const vue = require("vue");
5
- const multipleFormProvideSymbol = Symbol("carefrees-multiple-form");
6
- function useMultipleFormProvide(multipleForm) {
7
- const newMultipleForm = useMultipleForm(multipleForm);
8
- vue.provide(multipleFormProvideSymbol, newMultipleForm);
9
- }
10
- function useMultipleFormInject() {
11
- const multipleForm = vue.inject(multipleFormProvideSymbol, new formUtils.MultipleInstanceBase());
12
- return multipleForm;
13
- }
14
- function useMultipleForm(multipleForm) {
15
- const refForm = vue.ref();
16
- if (!refForm.value) {
17
- if (multipleForm) {
18
- refForm.value = multipleForm;
19
- } else {
20
- refForm.value = new formUtils.MultipleInstanceBase();
21
- }
22
- }
23
- return refForm.value;
24
- }
25
- exports.useMultipleForm = useMultipleForm;
26
- exports.useMultipleFormInject = useMultipleFormInject;
27
- exports.useMultipleFormProvide = useMultipleFormProvide;
package/lib/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { App } from 'vue';
2
- export * from './hooks';
3
- export * from './component';
4
- export * from './utils';
5
- export * from './interface';
6
- export * from './interface/layout';
7
- export * from './interface/layout.formItem';
8
- declare const _default: {
9
- install: (app: App) => void;
10
- };
11
- export default _default;
package/lib/index.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const component = require("./component.js");
4
- const useAttrs = require("./hooks/useAttrs.js");
5
- const useForm = require("./hooks/useForm.js");
6
- const useFormItem = require("./hooks/useFormItem.js");
7
- const useFormList = require("./hooks/useFormList.js");
8
- const useHtmlFor = require("./hooks/useHtmlFor.js");
9
- const useMultipleForm = require("./hooks/useMultipleForm.js");
10
- const useFormItemParentName = require("./hooks/useFormItemParentName.js");
11
- const useEffect = require("./hooks/useEffect.js");
12
- const register_FormHideItem = require("./hooks/register/register.FormHideItem.js");
13
- const register_FormItem = require("./hooks/register/register.FormItem.js");
14
- const register_FormList = require("./hooks/register/register.FormList.js");
15
- const register_form = require("./hooks/register/register.form.js");
16
- const attr_FormItem = require("./hooks/attr/attr.FormItem.js");
17
- const withInstall = require("./utils/withInstall.js");
18
- const index$1 = require("./form/index.js");
19
- const index$2 = require("./formItem/index.js");
20
- const index$3 = require("./layout/index.js");
21
- const index = {
22
- install: (app) => {
23
- for (const c in component) {
24
- app.use(component[c]);
25
- }
26
- }
27
- };
28
- exports.useAttrsInject = useAttrs.useAttrsInject;
29
- exports.useAttrsProvide = useAttrs.useAttrsProvide;
30
- exports.useForm = useForm.useForm;
31
- exports.useFormInject = useForm.useFormInject;
32
- exports.useFormProvide = useForm.useFormProvide;
33
- exports.useFormItem = useFormItem.useFormItem;
34
- exports.useFormItemInject = useFormItem.useFormItemInject;
35
- exports.useFormItemProvide = useFormItem.useFormItemProvide;
36
- exports.useFormList = useFormList.useFormList;
37
- exports.useFormListInject = useFormList.useFormListInject;
38
- exports.useFormListProvide = useFormList.useFormListProvide;
39
- exports.useHtmlFor = useHtmlFor.useHtmlFor;
40
- exports.useMultipleForm = useMultipleForm.useMultipleForm;
41
- exports.useMultipleFormInject = useMultipleForm.useMultipleFormInject;
42
- exports.useMultipleFormProvide = useMultipleForm.useMultipleFormProvide;
43
- exports.useFormItemParentNameInject = useFormItemParentName.useFormItemParentNameInject;
44
- exports.useFormItemParentNameProvide = useFormItemParentName.useFormItemParentNameProvide;
45
- exports.useEffect = useEffect.useEffect;
46
- exports.useRegisterFormHideItem = register_FormHideItem.useRegisterFormHideItem;
47
- exports.useRegisterFormItem = register_FormItem.useRegisterFormItem;
48
- exports.useRegisterFormList = register_FormList.useRegisterFormList;
49
- exports.useRegisterForm = register_form.useRegisterForm;
50
- exports.useFormItemAttr = attr_FormItem.useFormItemAttr;
51
- exports.withInstall = withInstall.withInstall;
52
- exports.Form = index$1.Form;
53
- exports.FormHideItem = index$2.FormHideItem;
54
- exports.FormItem = index$2.FormItem;
55
- exports.FormItemBase = index$2.FormItemBase;
56
- exports.FormLayoutRows = index$3.FormLayoutRows;
57
- exports.Layout = index$3.Layout;
58
- exports.LayoutFormItem = index$3.LayoutFormItem;
59
- exports.default = index;
@@ -1,49 +0,0 @@
1
- import { RuleItem } from 'async-validator';
2
- import { MessageType, FormInstanceBase } from '@carefrees/form-utils';
3
- import { Ref } from 'vue';
4
- export declare class RuleInstanceBase2 {
5
- /**
6
- * 顺序
7
- * @example
8
- * "0"
9
- * "0-0"
10
- * "0-0-0"
11
- */
12
- sort?: string;
13
- /**表单实例*/
14
- instance?: FormInstanceBase;
15
- /**
16
- * 字段 ,分割方式与lodash的get和set方法值更新或设置路径一致
17
- * @example
18
- * 默认:"name"
19
- * 嵌套字段:"name.a.doc"
20
- * 嵌套字段:"name[1].a.doc"
21
- * 嵌套字段:"name.a[2].doc"
22
- */
23
- name: string;
24
- /**规则*/
25
- rules: Ref<RuleItem[]>;
26
- /**错误提示内容*/
27
- messages: Ref<MessageType[]>;
28
- /**更新当前组件方法*/
29
- updated?: Function;
30
- /**判断是否必填*/
31
- isRequired: () => boolean;
32
- /**初始化*/
33
- ctor: (name: string, rules: RuleItem[]) => this;
34
- /**判断是否需要验证*/
35
- isValidate: () => boolean;
36
- /**更新提示信息*/
37
- updatedMessages: (messages?: MessageType[]) => void;
38
- /**更新规则*/
39
- updatedRules: (rules: RuleItem[]) => void;
40
- /**验证规则
41
- * @param {boolean} isOnly 仅判断是否校验通过
42
- */
43
- validate: (isOnly?: boolean) => Promise<unknown>;
44
- /**获取校验结果*/
45
- getValidateResult: () => {
46
- tip: string | (string | undefined)[];
47
- isInvalid: boolean;
48
- };
49
- }
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const AsyncValidator = require("async-validator");
4
- const vue = require("vue");
5
- class RuleInstanceBase2 {
6
- constructor() {
7
- this.name = "";
8
- this.rules = vue.ref([]);
9
- this.messages = vue.ref([]);
10
- this.isRequired = () => {
11
- var _a, _b;
12
- if ((_b = (_a = this.instance) == null ? void 0 : _a.getFieldHideRulesValue) == null ? void 0 : _b.call(_a, this.name)) {
13
- return false;
14
- }
15
- const findItem = (vue.toValue(this.rules) || []).find((item) => item == null ? void 0 : item.required);
16
- return !!findItem;
17
- };
18
- this.ctor = (name, rules) => {
19
- this.name = name;
20
- this.rules.value = rules || [];
21
- return this;
22
- };
23
- this.isValidate = () => {
24
- var _a, _b;
25
- if ((_b = (_a = this.instance) == null ? void 0 : _a.getFieldHideRulesValue) == null ? void 0 : _b.call(_a, this.name)) {
26
- return false;
27
- }
28
- const _rules = vue.toValue(this.rules);
29
- return !!(Array.isArray(_rules) && _rules.length);
30
- };
31
- this.updatedMessages = (messages) => {
32
- var _a;
33
- this.messages.value = messages || [];
34
- (_a = this.updated) == null ? void 0 : _a.call(this, {});
35
- };
36
- this.updatedRules = (rules) => {
37
- var _a;
38
- this.rules.value = rules;
39
- (_a = this.updatedMessages) == null ? void 0 : _a.call(this, []);
40
- };
41
- this.validate = (isOnly = false) => {
42
- return new Promise((resolve, reject) => {
43
- var _a, _b, _c, _d;
44
- const value = (_b = (_a = this.instance) == null ? void 0 : _a.getFieldValue) == null ? void 0 : _b.call(_a, this.name);
45
- if ((_d = (_c = this.instance) == null ? void 0 : _c.getFieldHideRulesValue) == null ? void 0 : _d.call(_c, this.name)) {
46
- this.updatedMessages([]);
47
- resolve({ [this.name]: value });
48
- }
49
- new AsyncValidator({ [this.name]: vue.toValue(this.rules) || [] }).validate({ [this.name]: value }).then((values) => {
50
- if (!isOnly) this.updatedMessages([]);
51
- resolve(values);
52
- }).catch(({ errors }) => {
53
- if (Array.isArray(errors)) {
54
- if (!isOnly) this.updatedMessages(errors);
55
- reject(errors);
56
- } else {
57
- reject();
58
- }
59
- });
60
- });
61
- };
62
- this.getValidateResult = () => {
63
- const _messages = vue.toValue(this.messages);
64
- const tip = Array.isArray(_messages) ? _messages.map((it) => it.message) : "";
65
- const isInvalid = Array.isArray(tip) ? !!tip.length : !!tip;
66
- return {
67
- tip,
68
- isInvalid
69
- };
70
- };
71
- }
72
- }
73
- exports.RuleInstanceBase2 = RuleInstanceBase2;
@@ -1,36 +0,0 @@
1
- import { ComputedRef, Ref, Component, StyleValue, UnwrapNestedRefs } from 'vue';
2
- import { FormItemAttrOptions } from '../hooks/attr/attr.FormItem';
3
- import { LayoutFormItemProps } from './layout.formItem';
4
- import { FormLayoutProps } from './layout';
5
- import { FormInstanceBase, ValidateErrorEntity } from '@carefrees/form-utils';
6
- export type ComputedRefBase<T> = ComputedRef<T> | Ref<T>;
7
- export type PartialComputedRefs<T> = {
8
- [K in keyof T]: ComputedRefBase<T[K]>;
9
- };
10
- export interface FormItemProps extends FormItemAttrOptions, LayoutFormItemProps {
11
- /**不进行样式渲染*/
12
- noStyle?: boolean;
13
- /**输入框组件*/
14
- input?: Component | string;
15
- }
16
- export interface FormProps<T = any> extends FormLayoutProps {
17
- form?: FormInstanceBase;
18
- style?: StyleValue;
19
- class?: string;
20
- layoutClass?: string;
21
- layoutStyle?: StyleValue;
22
- /**表单数据*/
23
- formData?: any;
24
- /**值更新触发*/
25
- onValuesChange?: (changedValues: Partial<T>, values: UnwrapNestedRefs<T>) => void;
26
- /**提交保存 验证成功*/
27
- onFinish?: (values: T) => void;
28
- /**提交保存 验证失败*/
29
- onFinishFailed?: (errorInfo: ValidateErrorEntity<T>) => void;
30
- /**隐藏表单项初始值*/
31
- hideData?: Record<string, boolean>;
32
- /**表单名称*/
33
- name?: string;
34
- /**隐藏规则校验*/
35
- hideRuleData?: Record<string, boolean>;
36
- }
@@ -1,28 +0,0 @@
1
- import { AttrsOptions } from '../hooks/useAttrs';
2
- import { VNodeChild, StyleValue } from 'vue';
3
- export interface FormLayoutProps extends Omit<AttrsOptions, 'colCount'> {
4
- /**标题*/
5
- title?: VNodeChild;
6
- /**额外内容*/
7
- extra?: VNodeChild;
8
- /**是否占据整行*/
9
- isAllColSpan?: boolean;
10
- class?: string;
11
- /**头部ClassName*/
12
- headerClass?: string;
13
- /**内容Class*/
14
- bodyClass?: string;
15
- style?: StyleValue;
16
- /**头部样式*/
17
- headerStyle?: StyleValue;
18
- /**内容样式*/
19
- bodyStyle?: StyleValue;
20
- /**是否添加边框*/
21
- bordered?: boolean;
22
- /**列数据*/
23
- colCount?: number;
24
- /**
25
- * @description gap 属性是用来设置网格行与列之间的间隙,该属性是row-gap and column-gap的简写形式。
26
- */
27
- gap?: string | number;
28
- }
@@ -1,39 +0,0 @@
1
- import { VNodeChild, StyleValue } from 'vue';
2
- import { ComputedRefBase } from '.';
3
- export interface LayoutFormItemProps {
4
- /**规则校验失败错误提示位置*/
5
- errorLayout?: 'left-bottom' | 'right-bottom' | 'top-right' | 'top-left';
6
- /**必填样式*/
7
- required?: boolean;
8
- /**label显示模式*/
9
- labelMode?: 'left' | 'top' | 'between' | 'hide';
10
- /**只进行规则样式*/
11
- onlyRuleStyle?: boolean;
12
- label?: VNodeChild;
13
- /**底部提示内容*/
14
- helpText?: VNodeChild;
15
- /**额外内容*/
16
- extra?: VNodeChild;
17
- /**是否显示label后的冒号*/
18
- showColon?: boolean;
19
- /**
20
- * 表单项占据列数
21
- * @default 1
22
- */
23
- colSpan?: number;
24
- /**
25
- * 表单项占据行数
26
- * @default 1
27
- */
28
- rowSpan?: number;
29
- htmlFor?: ComputedRefBase<string>;
30
- /**规则验证结果*/
31
- validateResult?: ComputedRefBase<{
32
- tip: string | (string | undefined)[];
33
- isInvalid: boolean;
34
- }>;
35
- style?: StyleValue;
36
- class?: string;
37
- labelStyle?: StyleValue;
38
- labelClass?: string;
39
- }
@@ -1,65 +0,0 @@
1
- export declare const Layout: import('../utils').SFCWithInstall<{
2
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('..').FormLayoutProps> & 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('..').FormLayoutProps> & Readonly<{}>, {}, {}, {}, {}, {}>;
10
- __isFragment?: undefined;
11
- __isTeleport?: undefined;
12
- __isSuspense?: undefined;
13
- } & import('vue').ComponentOptionsBase<Readonly<import('..').FormLayoutProps> & 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
- default: any;
16
- title: any;
17
- extra: any;
18
- }> & {
19
- default: any;
20
- title: any;
21
- extra: any;
22
- };
23
- })> & Record<string, any>;
24
- export declare const LayoutFormItem: import('../utils').SFCWithInstall<{
25
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('..').LayoutFormItemProps> & 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<import('..').LayoutFormItemProps> & Readonly<{}>, {}, {}, {}, {}, {}>;
33
- __isFragment?: undefined;
34
- __isTeleport?: undefined;
35
- __isSuspense?: undefined;
36
- } & import('vue').ComponentOptionsBase<Readonly<import('..').LayoutFormItemProps> & 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: any;
39
- label: any;
40
- helpText: any;
41
- extra: any;
42
- }> & {
43
- default: any;
44
- label: any;
45
- helpText: any;
46
- extra: any;
47
- };
48
- })> & Record<string, any>;
49
- export declare const FormLayoutRows: import('../utils').SFCWithInstall<{
50
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').HTMLAttributes> & 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('vue').HTMLAttributes> & Readonly<{}>, {}, {}, {}, {}, {}>;
58
- __isFragment?: undefined;
59
- __isTeleport?: undefined;
60
- __isSuspense?: undefined;
61
- } & import('vue').ComponentOptionsBase<Readonly<import('vue').HTMLAttributes> & 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: {
63
- default?(_: {}): any;
64
- };
65
- })> & Record<string, any>;
@@ -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
- };