@sheinx/hooks 3.8.0-beta.2 → 3.8.0-beta.21

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 (197) hide show
  1. package/cjs/common/use-position-style/check-border.d.ts +1 -0
  2. package/cjs/common/use-position-style/check-border.d.ts.map +1 -1
  3. package/cjs/common/use-position-style/check-border.js +2 -2
  4. package/cjs/common/use-position-style/index.d.ts.map +1 -1
  5. package/cjs/common/use-position-style/index.js +10 -4
  6. package/cjs/components/use-datepicker/use-date.d.ts.map +1 -1
  7. package/cjs/components/use-datepicker/use-date.js +12 -4
  8. package/cjs/components/use-datepicker/use-date.type.d.ts +2 -1
  9. package/cjs/components/use-datepicker/use-date.type.d.ts.map +1 -1
  10. package/cjs/components/use-datepicker/use-datepicker-format.d.ts +2 -1
  11. package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
  12. package/cjs/components/use-datepicker/use-datepicker-format.js +22 -5
  13. package/cjs/components/use-datepicker/use-datepicker-range.js +2 -2
  14. package/cjs/components/use-datepicker/use-time.d.ts.map +1 -1
  15. package/cjs/components/use-datepicker/use-time.js +4 -2
  16. package/cjs/components/use-datepicker/use-time.type.d.ts +3 -1
  17. package/cjs/components/use-datepicker/use-time.type.d.ts.map +1 -1
  18. package/cjs/components/use-datepicker/util.d.ts +7 -1
  19. package/cjs/components/use-datepicker/util.d.ts.map +1 -1
  20. package/cjs/components/use-datepicker/util.js +11 -1
  21. package/cjs/components/use-form/Provider.d.ts.map +1 -1
  22. package/cjs/components/use-form/Provider.js +7 -2
  23. package/cjs/components/use-form/form-schema-context.d.ts +6 -0
  24. package/cjs/components/use-form/form-schema-context.d.ts.map +1 -0
  25. package/cjs/components/use-form/form-schema-context.js +16 -0
  26. package/cjs/components/use-form/index.d.ts +2 -0
  27. package/cjs/components/use-form/index.d.ts.map +1 -1
  28. package/cjs/components/use-form/index.js +21 -1
  29. package/cjs/components/use-form/use-form-context.d.ts.map +1 -1
  30. package/cjs/components/use-form/use-form-context.js +11 -5
  31. package/cjs/components/use-form/use-form-context.type.d.ts +6 -0
  32. package/cjs/components/use-form/use-form-context.type.d.ts.map +1 -1
  33. package/cjs/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
  34. package/cjs/components/use-form/use-form-control/use-form-control.js +12 -3
  35. package/cjs/components/use-form/use-form-control/use-form-control.type.d.ts +8 -2
  36. package/cjs/components/use-form/use-form-control/use-form-control.type.d.ts.map +1 -1
  37. package/cjs/components/use-form/use-form-flow/use-form-datum.d.ts +8 -0
  38. package/cjs/components/use-form/use-form-flow/use-form-datum.d.ts.map +1 -1
  39. package/cjs/components/use-form/use-form-item/form-item-context.d.ts +1 -0
  40. package/cjs/components/use-form/use-form-item/form-item-context.d.ts.map +1 -1
  41. package/cjs/components/use-form/use-form-item/form-item-context.js +2 -1
  42. package/cjs/components/use-form/use-form-item/index.d.ts +1 -0
  43. package/cjs/components/use-form/use-form-item/index.d.ts.map +1 -1
  44. package/cjs/components/use-form/use-form-item/index.js +7 -0
  45. package/cjs/components/use-form/use-form-schema/form-schema-builder.d.ts +49 -0
  46. package/cjs/components/use-form/use-form-schema/form-schema-builder.d.ts.map +1 -0
  47. package/cjs/components/use-form/use-form-schema/form-schema-builder.js +311 -0
  48. package/cjs/components/use-form/use-form-schema/index.d.ts +3 -0
  49. package/cjs/components/use-form/use-form-schema/index.d.ts.map +1 -0
  50. package/cjs/components/use-form/use-form-schema/index.js +13 -0
  51. package/cjs/components/use-form/use-form.d.ts +4 -0
  52. package/cjs/components/use-form/use-form.d.ts.map +1 -1
  53. package/cjs/components/use-form/use-form.js +22 -11
  54. package/cjs/components/use-form/use-form.type.d.ts +46 -39
  55. package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
  56. package/cjs/components/use-input/use-input-format.d.ts.map +1 -1
  57. package/cjs/components/use-input/use-input-format.js +2 -1
  58. package/cjs/components/use-input/use-input.d.ts.map +1 -1
  59. package/cjs/components/use-input/use-input.js +4 -1
  60. package/cjs/components/use-pagination/use-pagination.d.ts.map +1 -1
  61. package/cjs/components/use-pagination/use-pagination.js +2 -1
  62. package/cjs/components/use-popup/use-popup.d.ts.map +1 -1
  63. package/cjs/components/use-popup/use-popup.js +7 -4
  64. package/cjs/components/use-table/use-table-virtual.d.ts +2 -1
  65. package/cjs/components/use-table/use-table-virtual.d.ts.map +1 -1
  66. package/cjs/components/use-table/use-table-virtual.js +3 -3
  67. package/cjs/components/use-table/use-table.type.d.ts +70 -92
  68. package/cjs/components/use-table/use-table.type.d.ts.map +1 -1
  69. package/cjs/components/use-transfer/index.d.ts +1 -0
  70. package/cjs/components/use-transfer/index.d.ts.map +1 -1
  71. package/cjs/components/use-transfer/index.js +15 -0
  72. package/cjs/components/use-transfer/transfer-context.d.ts +7 -0
  73. package/cjs/components/use-transfer/transfer-context.d.ts.map +1 -0
  74. package/cjs/components/use-transfer/transfer-context.js +12 -0
  75. package/cjs/components/use-tree/use-tree-node.d.ts +7 -1
  76. package/cjs/components/use-tree/use-tree-node.d.ts.map +1 -1
  77. package/cjs/components/use-tree/use-tree-node.js +19 -1
  78. package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
  79. package/cjs/components/use-tree/use-tree.js +14 -9
  80. package/cjs/components/use-tree/use-tree.type.d.ts +7 -1
  81. package/cjs/components/use-tree/use-tree.type.d.ts.map +1 -1
  82. package/cjs/utils/dom/document.d.ts +4 -0
  83. package/cjs/utils/dom/document.d.ts.map +1 -1
  84. package/cjs/utils/dom/document.js +19 -2
  85. package/cjs/utils/dom/element.d.ts +1 -0
  86. package/cjs/utils/dom/element.d.ts.map +1 -1
  87. package/cjs/utils/dom/element.js +5 -1
  88. package/cjs/utils/highlight.d.ts.map +1 -1
  89. package/cjs/utils/highlight.js +24 -11
  90. package/cjs/utils/number.d.ts +10 -0
  91. package/cjs/utils/number.d.ts.map +1 -1
  92. package/cjs/utils/number.js +99 -1
  93. package/cjs/utils/object.d.ts +6 -0
  94. package/cjs/utils/object.d.ts.map +1 -1
  95. package/cjs/utils/object.js +21 -1
  96. package/cjs/utils/shallow-equal.d.ts +1 -0
  97. package/cjs/utils/shallow-equal.d.ts.map +1 -1
  98. package/cjs/utils/shallow-equal.js +9 -0
  99. package/esm/common/use-position-style/check-border.d.ts +1 -0
  100. package/esm/common/use-position-style/check-border.d.ts.map +1 -1
  101. package/esm/common/use-position-style/check-border.js +2 -2
  102. package/esm/common/use-position-style/index.d.ts.map +1 -1
  103. package/esm/common/use-position-style/index.js +11 -5
  104. package/esm/components/use-datepicker/use-date.d.ts.map +1 -1
  105. package/esm/components/use-datepicker/use-date.js +12 -4
  106. package/esm/components/use-datepicker/use-date.type.d.ts +2 -1
  107. package/esm/components/use-datepicker/use-date.type.d.ts.map +1 -1
  108. package/esm/components/use-datepicker/use-datepicker-format.d.ts +2 -1
  109. package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
  110. package/esm/components/use-datepicker/use-datepicker-format.js +19 -5
  111. package/esm/components/use-datepicker/use-datepicker-range.js +2 -2
  112. package/esm/components/use-datepicker/use-time.d.ts.map +1 -1
  113. package/esm/components/use-datepicker/use-time.js +4 -2
  114. package/esm/components/use-datepicker/use-time.type.d.ts +3 -1
  115. package/esm/components/use-datepicker/use-time.type.d.ts.map +1 -1
  116. package/esm/components/use-datepicker/util.d.ts +7 -1
  117. package/esm/components/use-datepicker/util.d.ts.map +1 -1
  118. package/esm/components/use-datepicker/util.js +11 -1
  119. package/esm/components/use-form/Provider.d.ts.map +1 -1
  120. package/esm/components/use-form/Provider.js +7 -2
  121. package/esm/components/use-form/form-schema-context.d.ts +6 -0
  122. package/esm/components/use-form/form-schema-context.d.ts.map +1 -0
  123. package/esm/components/use-form/form-schema-context.js +8 -0
  124. package/esm/components/use-form/index.d.ts +2 -0
  125. package/esm/components/use-form/index.d.ts.map +1 -1
  126. package/esm/components/use-form/index.js +3 -1
  127. package/esm/components/use-form/use-form-context.d.ts.map +1 -1
  128. package/esm/components/use-form/use-form-context.js +11 -5
  129. package/esm/components/use-form/use-form-context.type.d.ts +6 -0
  130. package/esm/components/use-form/use-form-context.type.d.ts.map +1 -1
  131. package/esm/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
  132. package/esm/components/use-form/use-form-control/use-form-control.js +12 -3
  133. package/esm/components/use-form/use-form-control/use-form-control.type.d.ts +8 -2
  134. package/esm/components/use-form/use-form-control/use-form-control.type.d.ts.map +1 -1
  135. package/esm/components/use-form/use-form-flow/use-form-datum.d.ts +8 -0
  136. package/esm/components/use-form/use-form-flow/use-form-datum.d.ts.map +1 -1
  137. package/esm/components/use-form/use-form-item/form-item-context.d.ts +1 -0
  138. package/esm/components/use-form/use-form-item/form-item-context.d.ts.map +1 -1
  139. package/esm/components/use-form/use-form-item/form-item-context.js +2 -1
  140. package/esm/components/use-form/use-form-item/index.d.ts +1 -0
  141. package/esm/components/use-form/use-form-item/index.d.ts.map +1 -1
  142. package/esm/components/use-form/use-form-item/index.js +2 -1
  143. package/esm/components/use-form/use-form-schema/form-schema-builder.d.ts +49 -0
  144. package/esm/components/use-form/use-form-schema/form-schema-builder.d.ts.map +1 -0
  145. package/esm/components/use-form/use-form-schema/form-schema-builder.js +305 -0
  146. package/esm/components/use-form/use-form-schema/index.d.ts +3 -0
  147. package/esm/components/use-form/use-form-schema/index.d.ts.map +1 -0
  148. package/esm/components/use-form/use-form-schema/index.js +2 -0
  149. package/esm/components/use-form/use-form.d.ts +4 -0
  150. package/esm/components/use-form/use-form.d.ts.map +1 -1
  151. package/esm/components/use-form/use-form.js +22 -11
  152. package/esm/components/use-form/use-form.type.d.ts +46 -39
  153. package/esm/components/use-form/use-form.type.d.ts.map +1 -1
  154. package/esm/components/use-input/use-input-format.d.ts.map +1 -1
  155. package/esm/components/use-input/use-input-format.js +2 -1
  156. package/esm/components/use-input/use-input.d.ts.map +1 -1
  157. package/esm/components/use-input/use-input.js +4 -1
  158. package/esm/components/use-pagination/use-pagination.d.ts.map +1 -1
  159. package/esm/components/use-pagination/use-pagination.js +2 -1
  160. package/esm/components/use-popup/use-popup.d.ts.map +1 -1
  161. package/esm/components/use-popup/use-popup.js +7 -4
  162. package/esm/components/use-table/use-table-virtual.d.ts +2 -1
  163. package/esm/components/use-table/use-table-virtual.d.ts.map +1 -1
  164. package/esm/components/use-table/use-table-virtual.js +3 -3
  165. package/esm/components/use-table/use-table.type.d.ts +70 -92
  166. package/esm/components/use-table/use-table.type.d.ts.map +1 -1
  167. package/esm/components/use-transfer/index.d.ts +1 -0
  168. package/esm/components/use-transfer/index.d.ts.map +1 -1
  169. package/esm/components/use-transfer/index.js +1 -0
  170. package/esm/components/use-transfer/transfer-context.d.ts +7 -0
  171. package/esm/components/use-transfer/transfer-context.d.ts.map +1 -0
  172. package/esm/components/use-transfer/transfer-context.js +6 -0
  173. package/esm/components/use-tree/use-tree-node.d.ts +7 -1
  174. package/esm/components/use-tree/use-tree-node.d.ts.map +1 -1
  175. package/esm/components/use-tree/use-tree-node.js +19 -1
  176. package/esm/components/use-tree/use-tree.d.ts.map +1 -1
  177. package/esm/components/use-tree/use-tree.js +14 -9
  178. package/esm/components/use-tree/use-tree.type.d.ts +7 -1
  179. package/esm/components/use-tree/use-tree.type.d.ts.map +1 -1
  180. package/esm/utils/dom/document.d.ts +4 -0
  181. package/esm/utils/dom/document.d.ts.map +1 -1
  182. package/esm/utils/dom/document.js +18 -1
  183. package/esm/utils/dom/element.d.ts +1 -0
  184. package/esm/utils/dom/element.d.ts.map +1 -1
  185. package/esm/utils/dom/element.js +4 -0
  186. package/esm/utils/highlight.d.ts.map +1 -1
  187. package/esm/utils/highlight.js +24 -10
  188. package/esm/utils/number.d.ts +10 -0
  189. package/esm/utils/number.d.ts.map +1 -1
  190. package/esm/utils/number.js +98 -1
  191. package/esm/utils/object.d.ts +6 -0
  192. package/esm/utils/object.d.ts.map +1 -1
  193. package/esm/utils/object.js +20 -0
  194. package/esm/utils/shallow-equal.d.ts +1 -0
  195. package/esm/utils/shallow-equal.d.ts.map +1 -1
  196. package/esm/utils/shallow-equal.js +8 -0
  197. package/package.json +3 -3
@@ -20,7 +20,13 @@ declare function isSameWeek(date1: Date, date2: Date, options: DateOptions): boo
20
20
  declare function isSameQuarter(date1: Date, date2: Date, options: DateOptions): boolean;
21
21
  declare function isSameYear(date1: Date, date2: Date, options: DateOptions): boolean;
22
22
  declare function isValid(date: DateTimeType): boolean;
23
- declare function isValidString(date: string, fmt: string): boolean;
23
+ /**
24
+ * @param date 日期字符串
25
+ * @param fmt 日期格式
26
+ * @param isLoose 是否为宽松模式
27
+ * @returns 是否为有效日期
28
+ */
29
+ declare function isValidString(date: string, fmt: string, isLoose?: boolean): boolean;
24
30
  declare function parse(d: string, fmt?: string, options?: DateOptions): Date;
25
31
  declare function toDate(day: DateTimeType, options?: DateOptions): Date;
26
32
  declare function getDaysOfMonth(dirtyDate: DateTimeType, options: DateOptions): Date[];
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAC9D,MAAM,MAAM,IAAI,GACZ,MAAM,GACN,OAAO,GACP,SAAS,GACT,MAAM,GACN,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,MAAM,CAAC;AACX,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;AAKjD,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAqBD,eAAO,MAAM,aAAa,SAAU,MAAM,uBAmBzC,CAAC;AAOF,iBAAS,iBAAiB,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,GAAE,WAAgB,EAAE,IAAI,UAAQ,QAa3E;AAED,iBAAS,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WA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I,EAAE,UAAU,EAAE,IAAI,KAAK,MAAM,CAAC,EACxD,OAAO,EAAE,WAAW,UAKrB;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,UAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBD,wBAsCE"}
@@ -155,8 +155,18 @@ function isValid(date) {
155
155
  if (!(date instanceof Date)) return false;
156
156
  return dayjs(date).isValid();
157
157
  }
158
- function isValidString(date, fmt) {
158
+
159
+ /**
160
+ * @param date 日期字符串
161
+ * @param fmt 日期格式
162
+ * @param isLoose 是否为宽松模式
163
+ * @returns 是否为有效日期
164
+ */
165
+ function isValidString(date, fmt, isLoose) {
159
166
  if (!date) return false;
167
+ if (isLoose) {
168
+ return dayjs(date).isValid();
169
+ }
160
170
  return dayjs(date, fmt, true).isValid();
161
171
  }
162
172
  function parse(d, fmt, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["Provider.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,eAAO,MAAM,QAAQ,UAAW,aAAa,4CAW5C,CAAC"}
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["Provider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,eAAO,MAAM,QAAQ,UAAW,aAAa,4CAa5C,CAAC"}
@@ -2,6 +2,7 @@ import { FormBindContext } from "./form-bind-context";
2
2
  import { FormFuncContext } from "./form-func-context";
3
3
  import { FormConfigContext } from "./form-config-context";
4
4
  import FieldSetContext from "./use-form-fieldset/fieldset-context";
5
+ import { FormSchemaContext } from "./form-schema-context";
5
6
  import * as React from 'react';
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  var topPath = {
@@ -12,7 +13,8 @@ export var Provider = function Provider(props) {
12
13
  var children = props.children,
13
14
  formConfig = props.formConfig,
14
15
  formValue = props.formValue,
15
- formFunc = props.formFunc;
16
+ formFunc = props.formFunc,
17
+ formSchema = props.formSchema;
16
18
  return /*#__PURE__*/_jsx(FormFuncContext.Provider, {
17
19
  value: formFunc,
18
20
  children: /*#__PURE__*/_jsx(FormBindContext.Provider, {
@@ -21,7 +23,10 @@ export var Provider = function Provider(props) {
21
23
  value: topPath,
22
24
  children: /*#__PURE__*/_jsx(FormConfigContext.Provider, {
23
25
  value: formConfig,
24
- children: children
26
+ children: /*#__PURE__*/_jsx(FormSchemaContext.Provider, {
27
+ value: formSchema,
28
+ children: children
29
+ })
25
30
  })
26
31
  })
27
32
  })
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { SchemaBuilder } from './use-form-schema/form-schema-builder';
3
+ export type FormSchemaContextValueType = SchemaBuilder;
4
+ export declare const FormSchemaContext: React.Context<SchemaBuilder | null>;
5
+ export declare const useFormSchema: () => SchemaBuilder | null;
6
+ //# sourceMappingURL=form-schema-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-schema-context.d.ts","sourceRoot":"","sources":["form-schema-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE,MAAM,MAAM,0BAA0B,GAAG,aAAa,CAAA;AAEtD,eAAO,MAAM,iBAAiB,qCAA+D,CAAC;AAC9F,eAAO,MAAM,aAAa,4BAA4C,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use client";
2
+
3
+ import * as React from 'react';
4
+ export var FormSchemaContext = /*#__PURE__*/React.createContext(null);
5
+ export var useFormSchema = function useFormSchema() {
6
+ return React.useContext(FormSchemaContext);
7
+ };
8
+ FormSchemaContext.displayName = 'FormSchemaContext';
@@ -3,8 +3,10 @@ export * from './use-form-item';
3
3
  export * from './use-form-fieldset';
4
4
  export * from './use-form-flow';
5
5
  export * from './use-form-context';
6
+ export * from './use-form-schema';
6
7
  export { default, default as useForm } from './use-form';
7
8
  export { useFormConfig } from './form-config-context';
8
9
  export { useFormFunc } from './form-func-context';
10
+ export { useFormSchema } from './form-schema-context';
9
11
  export type { BaseFormProps, FormCommonConfig, FormLabelConfig } from './use-form.type';
10
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -4,6 +4,8 @@ export * from "./use-form-item";
4
4
  export * from "./use-form-fieldset";
5
5
  export * from "./use-form-flow";
6
6
  export * from "./use-form-context";
7
+ export * from "./use-form-schema";
7
8
  export { default, default as useForm } from "./use-form";
8
9
  export { useFormConfig } from "./form-config-context";
9
- export { useFormFunc } from "./form-func-context";
10
+ export { useFormFunc } from "./form-func-context";
11
+ export { useFormSchema } from "./form-schema-context";
@@ -1 +1 @@
1
- {"version":3,"file":"use-form-context.d.ts","sourceRoot":"","sources":["use-form-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,eAAO,MAAM,WAAW,oBAA+B,CAAC;AAExD,wBAAgB,UAAU,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAQ7E;AAED,wBAAgB,eAAe,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAG/C"}
1
+ {"version":3,"file":"use-form-context.d.ts","sourceRoot":"","sources":["use-form-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,eAAO,MAAM,WAAW,oBAA+B,CAAC;AAExD,wBAAgB,UAAU,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAG7E;AAED,wBAAgB,eAAe,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAG/C"}
@@ -1,11 +1,17 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1
7
  import React from 'react';
2
8
  export var FormContext = /*#__PURE__*/React.createContext({});
3
9
  export function useFormRef() {
4
- var ref = React.useRef({});
5
- var setFormRef = function setFormRef(formRef) {
6
- ref.current = formRef;
7
- };
8
- return [ref.current, setFormRef];
10
+ var _React$useState = React.useState({}),
11
+ _React$useState2 = _slicedToArray(_React$useState, 2),
12
+ formRef = _React$useState2[0],
13
+ setFormRef = _React$useState2[1];
14
+ return [formRef, setFormRef];
9
15
  }
10
16
  export function useFormInstance() {
11
17
  var formCtx = React.useContext(FormContext);
@@ -1,3 +1,4 @@
1
+ import { SchemaProperty } from './use-form-schema/form-schema-builder';
1
2
  export interface FormRef<Value = any> {
2
3
  /**
3
4
  * @en return form value
@@ -51,5 +52,10 @@ export interface FormRef<Value = any> {
51
52
  * @cn 滚动到指定字段
52
53
  */
53
54
  scrollToField: (name: string, scrollIntoViewOptions?: ScrollIntoViewOptions) => void;
55
+ /**
56
+ * @en get form schema
57
+ * @cn 获取表单的 schema
58
+ */
59
+ getFormSchema: () => SchemaProperty | undefined;
54
60
  }
55
61
  //# sourceMappingURL=use-form-context.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-form-context.type.d.ts","sourceRoot":"","sources":["use-form-context.type.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,OAAO,CAAC,KAAK,GAAG,GAAG;IAClC;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,GAAG,KAAK,CAAC;IACzC;;;OAGG;IACH,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;IACzD;;;OAGG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5D;;;OAGG;IACH,uBAAuB,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACtE;;;OAGG;IACH,uBAAuB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACrE;;;OAGG;IACH,aAAa,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;;OAGG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;OAGG;IACH,GAAG,EAAE,CAAC,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;K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E,CAAC,IAAI,EAAE,MAAM,EAAE,qBAAqB,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAErF;;;OAGG;IACH,aAAa,EAAE,MAAM,cAAc,GAAG,SAAS,CAAC;CACjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAC;AA4BnF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;kBAiJpC,CAAC,YAAY,GAAG,EAAE;;;;;EA4DrD"}
1
+ {"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAC;AA4BnF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;kBA0JpC,CAAC,YAAY,GAAG,EAAE;;;;;EA4DrD"}
@@ -48,7 +48,8 @@ export default function useFormControl(props) {
48
48
  defaultValue = props.defaultValue,
49
49
  rules = props.rules,
50
50
  onError = props.onError,
51
- getValidateProps = props.getValidateProps;
51
+ getValidateProps = props.getValidateProps,
52
+ clearToUndefined = props.clearToUndefined;
52
53
  var _useFieldSetConsumer = useFieldSetConsumer({
53
54
  name: props.name,
54
55
  bind: props.bind
@@ -106,7 +107,11 @@ export default function useFormControl(props) {
106
107
  var nextValue = [];
107
108
  name.forEach(function (n, index) {
108
109
  if (_value[index] === undefined && dv[index] !== undefined) {
109
- nextValue[index] = dv[index];
110
+ if (clearToUndefined) {
111
+ nextValue[index] = undefined;
112
+ } else {
113
+ nextValue[index] = dv[index];
114
+ }
110
115
  } else {
111
116
  nextValue[index] = _value[index];
112
117
  }
@@ -120,7 +125,11 @@ export default function useFormControl(props) {
120
125
  }
121
126
  if (!shallowEqual(_value2, latestInfo.valueState)) {
122
127
  if (_value2 === undefined && defaultValue !== undefined) {
123
- setValueState(defaultValue);
128
+ if (clearToUndefined) {
129
+ setValueState(undefined);
130
+ } else {
131
+ setValueState(defaultValue);
132
+ }
124
133
  } else {
125
134
  setValueState(_value2);
126
135
  }
@@ -24,14 +24,20 @@ export interface BaseFormControlProps<T> {
24
24
  */
25
25
  onError: ((error: Error | undefined) => void) | undefined;
26
26
  /**
27
- * @en When the value changes, it will link to verify the fields in the bind, which needs to be used with Form
28
- * @cn 当值改变是会联动校验 bind 中的字段, 需要配合 Form 使用
27
+ * @en Array of field names that should be re-validated when current field's value changes. Enables field linkage validation for dependent fields. Commonly used in scenarios like password confirmation, related dropdown selections, or interdependent form calculations
28
+ * @cn 当前字段值改变时需要重新校验的字段名称数组。启用字段间的联动校验功能。常用于密码确认、关联下拉选择或相互依赖的表单计算等场景
29
29
  */
30
30
  bind: string[] | undefined;
31
31
  /**
32
32
  * @private 内部属性 for validate
33
33
  */
34
34
  getValidateProps: (() => ObjectType) | undefined;
35
+ /**
36
+ * @en If set to true, the form will not automatically delete the data after the component is uninstalled
37
+ * @cn 设置为 true 组件后,有defaultValue时,允许undefined作为最终值
38
+ * @version 3.8.0
39
+ */
40
+ clearToUndefined?: boolean;
35
41
  }
36
42
  export interface FormControlContext {
37
43
  mounted: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"use-form-control.type.d.ts","sourceRoot":"","sources":["use-form-control.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB;;;OAGG;IACH,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,C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,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC3B;;OAEG;IACH,gBAAgB,EAAE,CAAC,MAAM,UAAU,CAAC,GAAG,SAAS,CAAC;IAEjD;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;CAClB"}
@@ -1,7 +1,15 @@
1
1
  export interface FormDatum {
2
+ /**
3
+ * @en Set form field values. Accepts either an object to set multiple fields at once, or a field name with value to set a single field. Field names support nested paths like "user.name" or "items[0].price". Changes trigger form validation and re-render of affected Flow components
4
+ * @cn 设置表单字段值。可以接收对象以批量设置多个字段,或接收字段名和值以设置单个字段。字段名支持嵌套路径如 "user.name" 或 "items[0].price"。更改会触发表单校验和相关 Flow 组件的重新渲染
5
+ */
2
6
  set: (vals: {
3
7
  [name: string]: any;
4
8
  } | string, value?: any) => void;
9
+ /**
10
+ * @en Get form field value by name. When no name is provided, returns the entire form data object. Supports nested paths like "user.name" or "items[0].price" to access deeply nested values
11
+ * @cn 根据名称获取表单字段值。未提供名称时返回整个表单数据对象。支持嵌套路径如 "user.name" 或 "items[0].price" 来访问深层嵌套的值
12
+ */
5
13
  get: (name?: string) => any;
6
14
  }
7
15
  declare const useFormDatum: () => FormDatum | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"use-form-datum.d.ts","sourceRoot":"","sources":["use-form-datum.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,CAAC,IAAI,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACnE,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,CAAC;CAC7B;AAED,QAAA,MAAM,YAAY,6BAgBjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"use-form-datum.d.ts","sourceRoot":"","sources":["use-form-datum.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,GAAG,EAAE,CAAC,IAAI,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACnE;;;OAGG;IACH,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,CAAC;CAC7B;AAED,QAAA,MAAM,YAAY,6BAgBjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  export interface FormItemContextValueType {
3
+ label?: any;
3
4
  updateError: (name: string, error?: Error) => void;
4
5
  }
5
6
  export declare const FormItemContext: React.Context<FormItemContextValueType>;
@@ -1 +1 @@
1
- {"version":3,"file":"form-item-context.d.ts","sourceRoot":"","sources":["form-item-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,eAAe,yCAE1B,CAAC"}
1
+ {"version":3,"file":"form-item-context.d.ts","sourceRoot":"","sources":["form-item-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,eAAe,yCAE1B,CAAC"}
@@ -3,4 +3,5 @@
3
3
  import * as React from 'react';
4
4
  export var FormItemContext = /*#__PURE__*/React.createContext({
5
5
  updateError: function updateError() {}
6
- });
6
+ });
7
+ FormItemContext.displayName = 'FormItemContext';
@@ -1,2 +1,3 @@
1
1
  export { default, default as useFormItem } from './use-form-item';
2
+ export { FormItemContext } from './form-item-context';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  "use client";
2
- export { default, default as useFormItem } from "./use-form-item";
2
+ export { default, default as useFormItem } from "./use-form-item";
3
+ export { FormItemContext } from "./form-item-context";
@@ -0,0 +1,49 @@
1
+ interface SchemaMeta {
2
+ type?: string;
3
+ required?: boolean;
4
+ title?: string;
5
+ format?: string;
6
+ items?: any;
7
+ enum?: any[] | {
8
+ anyOf: any[];
9
+ };
10
+ description?: string;
11
+ [key: string]: any;
12
+ }
13
+ export interface SchemaProperty {
14
+ type?: string;
15
+ properties?: Record<string, SchemaProperty>;
16
+ items?: SchemaProperty;
17
+ required?: string[];
18
+ title?: string;
19
+ description?: string;
20
+ format?: string;
21
+ enum?: any;
22
+ [key: string]: any;
23
+ }
24
+ export declare class SchemaBuilder {
25
+ private schema;
26
+ constructor(formName: string);
27
+ updateSchema({ path, meta }: {
28
+ path: string;
29
+ meta: SchemaMeta;
30
+ }): void;
31
+ /**
32
+ * 根据组件信息构建 schema meta
33
+ */
34
+ buildSchemaFromComponent(params: {
35
+ componentElement: any;
36
+ rules?: any[];
37
+ label?: string;
38
+ finalFieldId?: string;
39
+ separator?: string;
40
+ }): SchemaMeta;
41
+ parsePath(path?: string): string[] | null;
42
+ mergeSchema(currentSchema: SchemaProperty, pathSegments: string[], meta: SchemaMeta): void;
43
+ handleArraySegment(currentSchema: SchemaProperty, remainingSegments: string[], meta: SchemaMeta): void;
44
+ handleObjectProperty(currentSchema: SchemaProperty, propertyName: string, remainingSegments: string[], meta: SchemaMeta): void;
45
+ handleRequired(parentSchema: SchemaProperty, propertyName: string, isRequired: boolean): void;
46
+ getFormSchema(): SchemaProperty;
47
+ }
48
+ export {};
49
+ //# sourceMappingURL=form-schema-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-schema-builder.d.ts","sourceRoot":"","sources":["form-schema-builder.ts"],"names":[],"mappings":"AAAA,UAAU,UAAU;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG;QAAE,KAAK,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,aAAa;IACx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