@king-one/form-antdv 0.0.3 → 0.0.5

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 (188) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/index.mjs +4 -0
  3. package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/contexts.mjs +15 -0
  4. package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/destructor.mjs +72 -0
  5. package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/index.mjs +317 -0
  6. package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/matcher.mjs +83 -0
  7. package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/parser.mjs +232 -0
  8. package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/shared.mjs +62 -0
  9. package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/tokenizer.mjs +192 -0
  10. package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/tokens.mjs +140 -0
  11. package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/types.mjs +18 -0
  12. package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/index.mjs +47 -0
  13. package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/array.mjs +124 -0
  14. package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/checkers.mjs +43 -0
  15. package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/delay.mjs +10 -0
  16. package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/file.mjs +10 -0
  17. package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/img.mjs +20 -0
  18. package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/install.mjs +19 -0
  19. package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/number.mjs +18 -0
  20. package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/uid.mjs +11 -0
  21. package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/validate.mjs +6 -0
  22. package/dist/es/node_modules/.pnpm/async-validator@4.2.5/node_modules/async-validator/dist-web/index.mjs +648 -0
  23. package/dist/es/{src → packages/form-antdv/src}/components/ArrayCard/array-card.vue2.mjs +24 -23
  24. package/dist/es/packages/form-antdv/src/components/ArrayCard/index.mjs +13 -0
  25. package/dist/es/{src → packages/form-antdv/src}/components/ArrayTable/array-table.vue2.mjs +17 -16
  26. package/dist/es/packages/form-antdv/src/components/ArrayTable/index.mjs +13 -0
  27. package/dist/es/packages/form-antdv/src/components/DateRange/index.mjs +12 -0
  28. package/dist/es/packages/form-antdv/src/components/FormArea/index.mjs +11 -0
  29. package/dist/es/packages/form-antdv/src/components/Input/index.mjs +12 -0
  30. package/dist/es/packages/form-antdv/src/components/InputNumber/index.mjs +12 -0
  31. package/dist/es/packages/form-antdv/src/components/Select/index.mjs +15 -0
  32. package/dist/es/packages/form-antdv/src/internal.mjs +2 -0
  33. package/dist/es/packages/form-render/src/components/FormProvider.vue.mjs +4 -0
  34. package/dist/es/packages/form-render/src/components/FormProvider.vue2.mjs +39 -0
  35. package/dist/es/packages/form-render/src/components/SchemaField.mjs +31 -0
  36. package/dist/es/packages/form-render/src/components/propsType.mjs +34 -0
  37. package/dist/es/packages/form-render/src/components/widget/ArrayField.mjs +40 -0
  38. package/dist/es/packages/form-render/src/components/widget/ErrorField.mjs +14 -0
  39. package/dist/es/packages/form-render/src/components/widget/Field.mjs +43 -0
  40. package/dist/es/packages/form-render/src/components/widget/FormItem.mjs +48 -0
  41. package/dist/es/packages/form-render/src/components/widget/ObjectField.mjs +54 -0
  42. package/dist/es/packages/form-render/src/components/widget/RecursionField.mjs +31 -0
  43. package/dist/es/packages/form-render/src/components/widget/index.mjs +8 -0
  44. package/dist/es/packages/form-render/src/context/field.mjs +12 -0
  45. package/dist/es/packages/form-render/src/context/form.mjs +12 -0
  46. package/dist/es/packages/form-render/src/context/index.mjs +8 -0
  47. package/dist/es/packages/form-render/src/core/ArrayField.mjs +22 -0
  48. package/dist/es/packages/form-render/src/core/Base.mjs +162 -0
  49. package/dist/es/packages/form-render/src/core/Field.mjs +17 -0
  50. package/dist/es/packages/form-render/src/core/Form.mjs +96 -0
  51. package/dist/es/packages/form-render/src/core/Heart.mjs +25 -0
  52. package/dist/es/packages/form-render/src/core/ObjectField.mjs +13 -0
  53. package/dist/es/packages/form-render/src/core/index.mjs +7 -0
  54. package/dist/es/packages/form-render/src/effects/LifeCycle.mjs +25 -0
  55. package/dist/es/packages/form-render/src/effects/contants.mjs +10 -0
  56. package/dist/es/packages/form-render/src/effects/effect.enum.mjs +5 -0
  57. package/dist/es/packages/form-render/src/effects/effective.mjs +25 -0
  58. package/dist/es/packages/form-render/src/effects/index.mjs +15 -0
  59. package/dist/es/packages/form-render/src/effects/onEffects.mjs +21 -0
  60. package/dist/es/packages/form-render/src/hooks/index.mjs +7 -0
  61. package/dist/es/packages/form-render/src/hooks/use-namespace/index.mjs +49 -0
  62. package/dist/es/packages/form-render/src/index.mjs +21 -0
  63. package/dist/es/packages/form-render/src/internal.mjs +7 -0
  64. package/dist/es/packages/form-render/src/schema/index.mjs +5 -0
  65. package/dist/es/packages/form-render/src/schema/makeProxy.mjs +46 -0
  66. package/dist/es/packages/form-render/src/utils/connect.mjs +12 -0
  67. package/dist/es/packages/form-render/src/utils/index.mjs +7 -0
  68. package/dist/es/packages/form-render/src/utils/mapProps.mjs +26 -0
  69. package/dist/es/packages/form-render/src/utils/schema.mjs +26 -0
  70. package/dist/es/packages/form-render/src/utils/style.mjs +13 -0
  71. package/dist/es/packages/form-render/src/utils/transformComponent.mjs +20 -0
  72. package/dist/es/packages/form-render/theme-chalk/index.css +1 -0
  73. package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/index.js +1 -0
  74. package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/contexts.js +1 -0
  75. package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/destructor.js +1 -0
  76. package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/index.js +1 -0
  77. package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/matcher.js +1 -0
  78. package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/parser.js +1 -0
  79. package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/shared.js +1 -0
  80. package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/tokenizer.js +1 -0
  81. package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/tokens.js +1 -0
  82. package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/types.js +1 -0
  83. package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/index.js +1 -0
  84. package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/array.js +1 -0
  85. package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/checkers.js +1 -0
  86. package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/delay.js +1 -0
  87. package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/file.js +1 -0
  88. package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/img.js +1 -0
  89. package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/install.js +1 -0
  90. package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/number.js +1 -0
  91. package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/uid.js +1 -0
  92. package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/validate.js +1 -0
  93. package/dist/lib/node_modules/.pnpm/async-validator@4.2.5/node_modules/async-validator/dist-web/index.js +12 -0
  94. package/dist/lib/packages/form-antdv/src/components/ArrayCard/array-card.vue2.js +1 -0
  95. package/dist/lib/packages/form-antdv/src/components/ArrayCard/index.js +1 -0
  96. package/dist/lib/packages/form-antdv/src/components/ArrayTable/array-table.vue2.js +1 -0
  97. package/dist/lib/packages/form-antdv/src/components/ArrayTable/index.js +1 -0
  98. package/dist/lib/packages/form-antdv/src/components/DateRange/index.js +1 -0
  99. package/dist/lib/packages/form-antdv/src/components/FormArea/index.js +1 -0
  100. package/dist/lib/packages/form-antdv/src/components/Input/index.js +1 -0
  101. package/dist/lib/packages/form-antdv/src/components/InputNumber/index.js +1 -0
  102. package/dist/lib/packages/form-antdv/src/components/Select/index.js +1 -0
  103. package/dist/lib/packages/form-antdv/src/internal.js +1 -0
  104. package/dist/lib/packages/form-render/src/components/FormProvider.vue.js +1 -0
  105. package/dist/lib/packages/form-render/src/components/FormProvider.vue2.js +1 -0
  106. package/dist/lib/packages/form-render/src/components/SchemaField.js +1 -0
  107. package/dist/lib/packages/form-render/src/components/propsType.js +1 -0
  108. package/dist/lib/packages/form-render/src/components/widget/ArrayField.js +1 -0
  109. package/dist/lib/packages/form-render/src/components/widget/ErrorField.js +1 -0
  110. package/dist/lib/packages/form-render/src/components/widget/Field.js +1 -0
  111. package/dist/lib/packages/form-render/src/components/widget/FormItem.js +1 -0
  112. package/dist/lib/packages/form-render/src/components/widget/ObjectField.js +1 -0
  113. package/dist/lib/packages/form-render/src/components/widget/RecursionField.js +1 -0
  114. package/dist/lib/packages/form-render/src/components/widget/index.js +1 -0
  115. package/dist/lib/packages/form-render/src/context/field.js +1 -0
  116. package/dist/lib/packages/form-render/src/context/form.js +1 -0
  117. package/dist/lib/packages/form-render/src/context/index.js +1 -0
  118. package/dist/lib/packages/form-render/src/core/ArrayField.js +1 -0
  119. package/dist/lib/packages/form-render/src/core/Base.js +5 -0
  120. package/dist/lib/packages/form-render/src/core/Field.js +1 -0
  121. package/dist/lib/packages/form-render/src/core/Form.js +1 -0
  122. package/dist/lib/packages/form-render/src/core/Heart.js +1 -0
  123. package/dist/lib/packages/form-render/src/core/ObjectField.js +1 -0
  124. package/dist/lib/packages/form-render/src/core/index.js +1 -0
  125. package/dist/lib/packages/form-render/src/effects/LifeCycle.js +1 -0
  126. package/dist/lib/packages/form-render/src/effects/contants.js +1 -0
  127. package/dist/lib/packages/form-render/src/effects/effect.enum.js +1 -0
  128. package/dist/lib/packages/form-render/src/effects/effective.js +1 -0
  129. package/dist/lib/packages/form-render/src/effects/index.js +1 -0
  130. package/dist/lib/packages/form-render/src/effects/onEffects.js +1 -0
  131. package/dist/lib/packages/form-render/src/hooks/index.js +1 -0
  132. package/dist/lib/packages/form-render/src/hooks/use-namespace/index.js +1 -0
  133. package/dist/lib/packages/form-render/src/index.js +1 -0
  134. package/dist/lib/packages/form-render/src/internal.js +1 -0
  135. package/dist/lib/packages/form-render/src/schema/index.js +1 -0
  136. package/dist/lib/packages/form-render/src/schema/makeProxy.js +1 -0
  137. package/dist/lib/packages/form-render/src/utils/connect.js +1 -0
  138. package/dist/lib/packages/form-render/src/utils/index.js +1 -0
  139. package/dist/lib/packages/form-render/src/utils/mapProps.js +1 -0
  140. package/dist/lib/packages/form-render/src/utils/schema.js +1 -0
  141. package/dist/lib/packages/form-render/src/utils/style.js +1 -0
  142. package/dist/lib/packages/form-render/src/utils/transformComponent.js +1 -0
  143. package/dist/lib/packages/form-render/theme-chalk/index.css +1 -0
  144. package/dist/types/src/components/ArrayCard/index.d.ts +2 -2
  145. package/dist/types/src/components/ArrayTable/index.d.ts +2 -2
  146. package/dist/types/src/components/DateRange/index.d.ts +2 -2
  147. package/dist/types/src/components/FormArea/index.d.ts +2 -2
  148. package/dist/types/src/components/Input/index.d.ts +2 -2
  149. package/dist/types/src/components/InputNumber/index.d.ts +2 -2
  150. package/dist/types/src/components/Select/index.d.ts +2 -2
  151. package/dist/types/src/internal.d.ts +1 -1
  152. package/package.json +2 -2
  153. package/dist/es/src/components/ArrayCard/index.mjs +0 -11
  154. package/dist/es/src/components/ArrayTable/index.mjs +0 -11
  155. package/dist/es/src/components/DateRange/index.mjs +0 -10
  156. package/dist/es/src/components/FormArea/index.mjs +0 -9
  157. package/dist/es/src/components/Input/index.mjs +0 -10
  158. package/dist/es/src/components/InputNumber/index.mjs +0 -10
  159. package/dist/es/src/components/Select/index.mjs +0 -13
  160. package/dist/es/src/internal.mjs +0 -9
  161. package/dist/lib/src/components/ArrayCard/array-card.vue2.js +0 -1
  162. package/dist/lib/src/components/ArrayCard/index.js +0 -1
  163. package/dist/lib/src/components/ArrayTable/array-table.vue2.js +0 -1
  164. package/dist/lib/src/components/ArrayTable/index.js +0 -1
  165. package/dist/lib/src/components/DateRange/index.js +0 -1
  166. package/dist/lib/src/components/FormArea/index.js +0 -1
  167. package/dist/lib/src/components/Input/index.js +0 -1
  168. package/dist/lib/src/components/InputNumber/index.js +0 -1
  169. package/dist/lib/src/components/Select/index.js +0 -1
  170. package/dist/lib/src/internal.js +0 -1
  171. /package/dist/es/{index.mjs → packages/form-antdv/index.mjs} +0 -0
  172. /package/dist/es/{src → packages/form-antdv/src}/components/ArrayCard/array-card.vue.mjs +0 -0
  173. /package/dist/es/{src → packages/form-antdv/src}/components/ArrayTable/array-table.vue.mjs +0 -0
  174. /package/dist/es/{src → packages/form-antdv/src}/components/FormArea/form-area.vue.mjs +0 -0
  175. /package/dist/es/{src → packages/form-antdv/src}/components/FormArea/form-area.vue2.mjs +0 -0
  176. /package/dist/es/{src → packages/form-antdv/src}/hooks/index.mjs +0 -0
  177. /package/dist/es/{src → packages/form-antdv/src}/hooks/use-namespace/index.mjs +0 -0
  178. /package/dist/es/{src → packages/form-antdv/src}/index.mjs +0 -0
  179. /package/dist/es/{src → packages/form-antdv/src}/style/index.mjs +0 -0
  180. /package/dist/lib/{index.js → packages/form-antdv/index.js} +0 -0
  181. /package/dist/lib/{src → packages/form-antdv/src}/components/ArrayCard/array-card.vue.js +0 -0
  182. /package/dist/lib/{src → packages/form-antdv/src}/components/ArrayTable/array-table.vue.js +0 -0
  183. /package/dist/lib/{src → packages/form-antdv/src}/components/FormArea/form-area.vue.js +0 -0
  184. /package/dist/lib/{src → packages/form-antdv/src}/components/FormArea/form-area.vue2.js +0 -0
  185. /package/dist/lib/{src → packages/form-antdv/src}/hooks/index.js +0 -0
  186. /package/dist/lib/{src → packages/form-antdv/src}/hooks/use-namespace/index.js +0 -0
  187. /package/dist/lib/{src → packages/form-antdv/src}/index.js +0 -0
  188. /package/dist/lib/{src → packages/form-antdv/src}/style/index.js +0 -0
@@ -0,0 +1,12 @@
1
+ import { provide as o, inject as n } from "vue";
2
+ const e = Symbol("Field");
3
+ function r(t) {
4
+ return o(e, t);
5
+ }
6
+ function d() {
7
+ return n(e);
8
+ }
9
+ export {
10
+ d as useInjectFieldContext,
11
+ r as useProvideFieldContext
12
+ };
@@ -0,0 +1,12 @@
1
+ import { provide as t, inject as e } from "vue";
2
+ const o = Symbol("FormProvider");
3
+ function m(r) {
4
+ return t(o, r);
5
+ }
6
+ function i() {
7
+ return e(o, {});
8
+ }
9
+ export {
10
+ i as useInjectFormContext,
11
+ m as useProvideFromContext
12
+ };
@@ -0,0 +1,8 @@
1
+ import { useInjectFieldContext as t, useProvideFieldContext as r } from "./field.mjs";
2
+ import { useInjectFormContext as x, useProvideFromContext as d } from "./form.mjs";
3
+ export {
4
+ t as useInjectFieldContext,
5
+ x as useInjectFormContext,
6
+ r as useProvideFieldContext,
7
+ d as useProvideFromContext
8
+ };
@@ -0,0 +1,22 @@
1
+ import "../effects/index.mjs";
2
+ import { Base as i } from "./Base.mjs";
3
+ import { FieldLifeCycleTypes as a } from "../effects/effect.enum.mjs";
4
+ class c extends i {
5
+ constructor(t, e, s) {
6
+ super(t, e, s);
7
+ }
8
+ makeState() {
9
+ const e = { ...this.schema["x-component-props"] || {}, value: this.value, disabled: !1, title: this.schema.title || "默认标题" };
10
+ Object.assign(this.state, e);
11
+ }
12
+ change(t) {
13
+ this.form.notify(a.ON_FIELD_CHANGE, this), this.setValue(t || []);
14
+ }
15
+ initialize() {
16
+ var t;
17
+ this.setValue(((t = this.schema["x-component-props"]) == null ? void 0 : t.defaultValue) || []);
18
+ }
19
+ }
20
+ export {
21
+ c as ArrayField
22
+ };
@@ -0,0 +1,162 @@
1
+ var g = Object.defineProperty;
2
+ var v = (h, t, e) => t in h ? g(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
3
+ var c = (h, t, e) => v(h, typeof t != "symbol" ? t + "" : t, e);
4
+ import "../../../../node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/index.mjs";
5
+ import { reactive as f, watchEffect as R } from "vue";
6
+ import "../../../../node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/index.mjs";
7
+ import S from "../../../../node_modules/.pnpm/async-validator@4.2.5/node_modules/async-validator/dist-web/index.mjs";
8
+ import V from "../components/widget/ErrorField.mjs";
9
+ import "../effects/index.mjs";
10
+ import { Path as d } from "../../../../node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/index.mjs";
11
+ import { FieldLifeCycleTypes as x } from "../effects/effect.enum.mjs";
12
+ import { isStr as $ } from "../../../../node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/checkers.mjs";
13
+ class I {
14
+ constructor(t, e, a) {
15
+ c(this, "form");
16
+ c(this, "path");
17
+ c(this, "schema");
18
+ c(this, "state", f({}));
19
+ c(this, "dispose", null);
20
+ c(this, "validateReactive", f({
21
+ status: "success",
22
+ message: "",
23
+ rules: []
24
+ }));
25
+ this.form = t, this.path = e, this.schema = a, this.initialize(), this.makeState(), this.createDispose(), this.trackDispose(), this.initRules();
26
+ }
27
+ makeState() {
28
+ const e = { ...this.schema["x-component-props"] || {}, disabled: !1 };
29
+ Object.assign(this.state, e);
30
+ }
31
+ createDispose() {
32
+ if (this.schema["x-reactions"]) {
33
+ const { dependencies: t = [], fulfill: e } = this.schema["x-reactions"];
34
+ if (t.length) {
35
+ const { state: a = {} } = e || {}, i = t.map((o) => {
36
+ const { source: s } = o;
37
+ return s.startsWith(".") ? this.path.parent().concat(s) : d.parse(s);
38
+ }), n = () => R(() => {
39
+ const o = {
40
+ $deps: {}
41
+ };
42
+ t.forEach((s) => {
43
+ const { property: l, source: r, name: u } = s, m = (r.startsWith(".") ? this.path.parent().concat(r) : d.parse(r)).toString();
44
+ o.$deps[u] = this.form.fields[m] ? this.form.fields[m].getState(l) : "";
45
+ });
46
+ for (const s in a)
47
+ if (Reflect.has(this.state, s) || s === "value") {
48
+ const l = /^\s*\{\{([\s\S]*)\}\}\s*$/, r = a[s].match(l);
49
+ if (!r)
50
+ continue;
51
+ const u = (r == null ? void 0 : r[1]) || "", p = new Function("$root", `with($root) { return (${u}); }`)(
52
+ o
53
+ );
54
+ this.setValue(p);
55
+ }
56
+ });
57
+ this.dispose = {
58
+ autorun: n,
59
+ path: i,
60
+ isActive: !1,
61
+ stop: null
62
+ };
63
+ }
64
+ }
65
+ }
66
+ trackDispose() {
67
+ if (this.dispose) {
68
+ const { autorun: t, path: e, isActive: a } = this.dispose;
69
+ e.every((n) => this.form.fields[n.toString()]) && !a && (this.dispose.isActive = !0, this.dispose.stop = t());
70
+ }
71
+ }
72
+ initialize() {
73
+ const e = this.schema["x-component-props"].defaultValue || (typeof this.value == "string" ? "" : 0);
74
+ this.setValue(e);
75
+ }
76
+ change(t) {
77
+ this.form.notify(x.ON_FIELD_CHANGE, this), this.setValue(t), this.validate("change");
78
+ }
79
+ validate(t) {
80
+ return new Promise((e) => {
81
+ const a = this.getTriggeredRules(t);
82
+ if (a.length === 0)
83
+ e(null);
84
+ else {
85
+ const i = this.path.toString();
86
+ new S({
87
+ [i]: a
88
+ }).validate({ [i]: this.value }, (o) => {
89
+ o ? (this.validateReactive.status = "error", this.validateReactive.message = o[0].message || "", console.warn(JSON.stringify(o[0])), e(o)) : (this.validateReactive.status = "success", e(o));
90
+ });
91
+ }
92
+ });
93
+ }
94
+ setValidateRule(t) {
95
+ this.validateReactive.rules.push(t);
96
+ }
97
+ initRules() {
98
+ const t = this.schema["x-validator"] || [];
99
+ this.schema.required && t.push({
100
+ required: !0,
101
+ message: `${this.schema.title}不能为空`
102
+ }), this.validateReactive.rules = t;
103
+ }
104
+ getTriggeredRules(t) {
105
+ const e = this.validateReactive.rules || [];
106
+ return e.length ? (t ? e.filter((i) => !i.trigger || i.trigger === t) : e).map((i) => this.transformValidator(i)).map(({ trigger: i, ...n }) => n) : [];
107
+ }
108
+ transformValidator(t) {
109
+ const { validator: e, ...a } = t;
110
+ if (e) {
111
+ const i = this.path.parent(), n = this.form.getValuesIn(i);
112
+ return {
113
+ validator: $(e) ? () => {
114
+ const o = /^\s*\{\{([\s\S]*)\}\}\s*$/, s = e.match(o);
115
+ if (!s)
116
+ return !0;
117
+ const l = (s == null ? void 0 : s[1]) || "", r = {
118
+ $parent: n,
119
+ $value: this.value
120
+ }, u = `
121
+ with (scope) {
122
+ ${l}
123
+ }
124
+ `;
125
+ return new Function("scope", u)(r);
126
+ } : e,
127
+ ...a
128
+ };
129
+ } else
130
+ return t;
131
+ }
132
+ setState(t) {
133
+ t(this.state);
134
+ }
135
+ setValue(t) {
136
+ this.form.setValuesIn(this.path, t);
137
+ }
138
+ getState(t) {
139
+ return t === "value" ? this.value : this.state[t];
140
+ }
141
+ get value() {
142
+ return this.form.getValuesIn(this.path);
143
+ }
144
+ get component() {
145
+ const t = this.schema["x-component"];
146
+ return t && this.form.components[t] || V;
147
+ }
148
+ get decorator() {
149
+ const t = this.schema["x-decorator"] || "FormItem";
150
+ return this.form.components[t] || null;
151
+ }
152
+ /**
153
+ * 销毁字段实例,清理资源
154
+ */
155
+ destroy() {
156
+ var t;
157
+ (t = this.dispose) != null && t.stop && this.dispose.stop(), this.dispose = null;
158
+ }
159
+ }
160
+ export {
161
+ I as Base
162
+ };
@@ -0,0 +1,17 @@
1
+ import { Base as t } from "./Base.mjs";
2
+ class a extends t {
3
+ constructor(r, e, s) {
4
+ super(r, e, s);
5
+ }
6
+ // change(value: any) {
7
+ // this.form.notify(FieldLifeCycleTypes.ON_FIELD_CHANGE, this)
8
+ // this.setValue(value)
9
+ // this.validate('change')
10
+ // }
11
+ blur() {
12
+ this.validate("blur");
13
+ }
14
+ }
15
+ export {
16
+ a as Field
17
+ };
@@ -0,0 +1,96 @@
1
+ var h = Object.defineProperty;
2
+ var f = (n, t, e) => t in n ? h(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var i = (n, t, e) => f(n, typeof t != "symbol" ? t + "" : t, e);
4
+ import "../../../../node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/index.mjs";
5
+ import { reactive as d, toRaw as m } from "vue";
6
+ import u from "../components/widget/FormItem.mjs";
7
+ import "../effects/index.mjs";
8
+ import { Field as o } from "./Field.mjs";
9
+ import { ArrayField as v } from "./ArrayField.mjs";
10
+ import { Heart as F } from "./Heart.mjs";
11
+ import { ObjectField as y } from "./ObjectField.mjs";
12
+ import { FormLifeCycleTypes as c } from "../effects/effect.enum.mjs";
13
+ import { Path as r } from "../../../../node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/index.mjs";
14
+ import { runEffects as b } from "../effects/effective.mjs";
15
+ class E {
16
+ constructor(t) {
17
+ i(this, "values", d({}));
18
+ i(this, "disabled", !1);
19
+ i(this, "initialized", !1);
20
+ // 表单是否初始化完成
21
+ i(this, "fields", {});
22
+ i(this, "props", null);
23
+ i(this, "components", { FormItem: u });
24
+ i(this, "loading", !1);
25
+ i(this, "heart");
26
+ i(this, "schema", {
27
+ labelPosition: "right"
28
+ });
29
+ i(this, "setValues", (t) => {
30
+ Object.assign(this.values, t), this.validate();
31
+ });
32
+ this.init(t), this.heart = new F({
33
+ lifecycles: this.lifecycles,
34
+ context: this
35
+ }), this.notify(c.ON_FORM_INIT);
36
+ }
37
+ getValues() {
38
+ return this.values;
39
+ }
40
+ init(t) {
41
+ t != null && t.components && (this.components = { ...this.components, ...t.components }), t != null && t.schema && (this.schema = { ...this.schema, ...t.schema }), this.props = t || {}, this.disabled = (t == null ? void 0 : t.disabled) ?? !1;
42
+ }
43
+ createField(t, e, s) {
44
+ const a = r.parse(s).concat(e), l = new o(this, a, t);
45
+ return this.fields[a.toString()] = l, this.addDispose(), l;
46
+ }
47
+ addDispose() {
48
+ for (const t of Object.values(this.fields))
49
+ t.trackDispose();
50
+ }
51
+ createArrayField(t, e, s) {
52
+ const a = r.parse(s).concat(e), l = new v(this, a, t);
53
+ return this.fields[a.toString()] = l, l;
54
+ }
55
+ createObjectField(t, e, s) {
56
+ const a = r.parse(s).concat(e), l = new y(this, a, t);
57
+ return this.fields[a.toString()] = l, l;
58
+ }
59
+ getValuesIn(t) {
60
+ return r.getIn(this.values, t);
61
+ }
62
+ setValuesIn(t, e) {
63
+ return r.setIn(this.values, t, e);
64
+ }
65
+ setFieldState(t, e) {
66
+ const s = this.fields[r.parse(t).toString()];
67
+ if (s) {
68
+ const a = s.state;
69
+ e(a);
70
+ return;
71
+ }
72
+ e(!1), console.warn(`$Path ${t} is not exist`);
73
+ }
74
+ async validate() {
75
+ const e = (await Promise.all(Object.values(this.fields).filter((s) => s instanceof o).map((s) => s.validate()))).every((s) => s === null);
76
+ return this.notify(c.ON_FORM_VALIDATE), e ? m(this.values) : !1;
77
+ }
78
+ /**
79
+ * 销毁表单实例,清理所有字段和资源
80
+ */
81
+ destroy() {
82
+ var t;
83
+ for (const e of Object.values(this.fields))
84
+ (t = e.destroy) == null || t.call(e);
85
+ this.fields = {}, Object.keys(this.values).forEach((e) => delete this.values[e]), this.initialized = !1, this.props = null;
86
+ }
87
+ notify(t, ...e) {
88
+ this.heart.publish(t, ...e);
89
+ }
90
+ get lifecycles() {
91
+ return b(this, this.props.effects);
92
+ }
93
+ }
94
+ export {
95
+ E as Form
96
+ };
@@ -0,0 +1,25 @@
1
+ var o = Object.defineProperty;
2
+ var s = (e, t, i) => t in e ? o(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
+ var r = (e, t, i) => s(e, typeof t != "symbol" ? t + "" : t, i);
4
+ import "../../../../node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/index.mjs";
5
+ import "../effects/index.mjs";
6
+ import { LifeCycle as l } from "../effects/LifeCycle.mjs";
7
+ import { isStr as f } from "../../../../node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/checkers.mjs";
8
+ class m {
9
+ constructor({ lifecycles: t, context: i }) {
10
+ r(this, "context");
11
+ r(this, "lifecycles");
12
+ this.lifecycles = this.buildLifeCycles(t || []), this.context = i;
13
+ }
14
+ buildLifeCycles(t) {
15
+ return t.reduce((i, c) => c instanceof l ? i.concat(c) : i, []);
16
+ }
17
+ publish(t, ...i) {
18
+ f(t) && this.lifecycles.forEach((c) => {
19
+ c.notify(t, this.context, ...i);
20
+ });
21
+ }
22
+ }
23
+ export {
24
+ m as Heart
25
+ };
@@ -0,0 +1,13 @@
1
+ import { Base as i } from "./Base.mjs";
2
+ class r extends i {
3
+ constructor(e, t, s) {
4
+ super(e, t, s);
5
+ }
6
+ initialize() {
7
+ var e;
8
+ this.setValue(((e = this.schema["x-component-props"]) == null ? void 0 : e.defaultValue) || {});
9
+ }
10
+ }
11
+ export {
12
+ r as ObjectField
13
+ };
@@ -0,0 +1,7 @@
1
+ import { Form as o } from "./Form.mjs";
2
+ function t(r) {
3
+ return new o(r);
4
+ }
5
+ export {
6
+ t as createForm
7
+ };
@@ -0,0 +1,25 @@
1
+ var c = Object.defineProperty;
2
+ var f = (e, i, t) => i in e ? c(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
3
+ var r = (e, i, t) => f(e, typeof i != "symbol" ? i + "" : i, t);
4
+ import "../../../../node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/index.mjs";
5
+ import { isStr as o, isFn as h } from "../../../../node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/checkers.mjs";
6
+ class d {
7
+ constructor(...i) {
8
+ r(this, "listener");
9
+ r(this, "notify", (i, t, ...n) => {
10
+ o(i) && this.listener.call(t, { type: i, payload: t }, ...n);
11
+ });
12
+ this.listener = this.buildListener(i);
13
+ }
14
+ buildListener(i) {
15
+ return (t, ...n) => {
16
+ for (let l = 0; l < i.length; l++) {
17
+ const s = i[l];
18
+ o(s) && h(i[l + 1]) && s === t.type && i[l + 1].call(this, t.payload, ...n);
19
+ }
20
+ };
21
+ }
22
+ }
23
+ export {
24
+ d as LifeCycle
25
+ };
@@ -0,0 +1,10 @@
1
+ const e = {
2
+ lifecycles: [],
3
+ context: [],
4
+ effectStart: !1,
5
+ effectEnd: !1,
6
+ initializing: !1
7
+ };
8
+ export {
9
+ e as GlobalState
10
+ };
@@ -0,0 +1,5 @@
1
+ var n = /* @__PURE__ */ ((I) => (I.ON_FORM_INIT = "onFormInit", I.ON_FORM_VALIDATE = "onFormValidate", I))(n || {}), _ = /* @__PURE__ */ ((I) => (I.ON_FIELD_CHANGE = "onFieldChange", I.ON_FIELD_INIT = "onFieldInit", I.ON_FIELD_VALIDATE = "onFieldValidate", I))(_ || {});
2
+ export {
3
+ _ as FieldLifeCycleTypes,
4
+ n as FormLifeCycleTypes
5
+ };
@@ -0,0 +1,25 @@
1
+ import "../../../../node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/index.mjs";
2
+ import { LifeCycle as i } from "./LifeCycle.mjs";
3
+ import { GlobalState as e } from "./contants.mjs";
4
+ import { isFn as r } from "../../../../node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/checkers.mjs";
5
+ function m(o, t) {
6
+ return (...f) => {
7
+ if (e.effectStart)
8
+ e.lifecycles.push(
9
+ new i(o, (c, ...n) => {
10
+ r(t) && t(...n, c)(...f);
11
+ })
12
+ );
13
+ else
14
+ throw new Error("Effect hooks cannot be used in asynchronous function body");
15
+ };
16
+ }
17
+ function E(o, ...t) {
18
+ return e.lifecycles = [], e.context = [], e.effectStart = !0, e.effectEnd = !1, t.forEach((f) => {
19
+ r(f) && f(o);
20
+ }), e.context = [], e.effectStart = !1, e.effectEnd = !0, e.lifecycles;
21
+ }
22
+ export {
23
+ m as createEffectHook,
24
+ E as runEffects
25
+ };
@@ -0,0 +1,15 @@
1
+ import { FieldLifeCycleTypes as r, FormLifeCycleTypes as f } from "./effect.enum.mjs";
2
+ import { LifeCycle as i } from "./LifeCycle.mjs";
3
+ import { createEffectHook as l, runEffects as m } from "./effective.mjs";
4
+ import { CereateFieldEffect as p, onFieldChange as F, onFormInit as a, onFormValiDate as y } from "./onEffects.mjs";
5
+ export {
6
+ p as CereateFieldEffect,
7
+ r as FieldLifeCycleTypes,
8
+ f as FormLifeCycleTypes,
9
+ i as LifeCycle,
10
+ l as createEffectHook,
11
+ F as onFieldChange,
12
+ a as onFormInit,
13
+ y as onFormValiDate,
14
+ m as runEffects
15
+ };
@@ -0,0 +1,21 @@
1
+ import "../../../../node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/index.mjs";
2
+ import { createEffectHook as r } from "./effective.mjs";
3
+ import { FormLifeCycleTypes as n, FieldLifeCycleTypes as m } from "./effect.enum.mjs";
4
+ import { Path as a } from "../../../../node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/index.mjs";
5
+ function f(t) {
6
+ return r(t, (...e) => (o) => {
7
+ o(...e);
8
+ });
9
+ }
10
+ function F(t) {
11
+ return r(t, (e, o) => (i, c) => {
12
+ a.parse(i).match(e.path) && c(e, o);
13
+ });
14
+ }
15
+ const _ = f(n.ON_FORM_INIT), l = f(n.ON_FORM_VALIDATE), I = F(m.ON_FIELD_CHANGE);
16
+ export {
17
+ F as CereateFieldEffect,
18
+ I as onFieldChange,
19
+ _ as onFormInit,
20
+ l as onFormValiDate
21
+ };
@@ -0,0 +1,7 @@
1
+ import { defaultNamespace as s, namespaceContextKey as m, useGetDerivedNamespace as p, useNamespace as t } from "./use-namespace/index.mjs";
2
+ export {
3
+ s as defaultNamespace,
4
+ m as namespaceContextKey,
5
+ p as useGetDerivedNamespace,
6
+ t as useNamespace
7
+ };
@@ -0,0 +1,49 @@
1
+ import { getCurrentInstance as p, inject as N, ref as v, computed as V, unref as y } from "vue";
2
+ const m = "k-render", l = "is-";
3
+ function c(t, r, n, o, $) {
4
+ let u = `${t}-${r}`;
5
+ return n && (u += `-${n}`), o && (u += `__${o}`), $ && (u += `--${$}`), u;
6
+ }
7
+ const i = Symbol("namespaceContextKey");
8
+ function B(t) {
9
+ const r = t || (p() ? N(i, v(m)) : v(m));
10
+ return V(() => y(r) || m);
11
+ }
12
+ function P(t, r) {
13
+ const n = B(r);
14
+ return {
15
+ namespace: n,
16
+ b: (s = "") => c(n.value, t, s, "", ""),
17
+ e: (s) => s ? c(n.value, t, "", s, "") : "",
18
+ m: (s) => s ? c(n.value, t, "", "", s) : "",
19
+ be: (s, e) => s && e ? c(n.value, t, s, e, "") : "",
20
+ em: (s, e) => s && e ? c(n.value, t, "", s, e) : "",
21
+ bm: (s, e) => s && e ? c(n.value, t, s, "", e) : "",
22
+ bem: (s, e, a) => s && e && a ? c(n.value, t, s, e, a) : "",
23
+ is: (s, ...e) => {
24
+ const a = e.length >= 1 ? e[0] : !0;
25
+ return s && a ? `${l}${s}` : "";
26
+ },
27
+ // css
28
+ cssVar: (s) => {
29
+ const e = {};
30
+ for (const a in s)
31
+ s[a] && (e[`--${n.value}-${a}`] = s[a]);
32
+ return e;
33
+ },
34
+ cssVarName: (s) => `--${n.value}-${s}`,
35
+ cssVarBlock: (s) => {
36
+ const e = {};
37
+ for (const a in s)
38
+ s[a] && (e[`--${n.value}-${t}-${a}`] = s[a]);
39
+ return e;
40
+ },
41
+ cssVarBlockName: (s) => `--${n.value}-${t}-${s}`
42
+ };
43
+ }
44
+ export {
45
+ m as defaultNamespace,
46
+ i as namespaceContextKey,
47
+ B as useGetDerivedNamespace,
48
+ P as useNamespace
49
+ };
@@ -0,0 +1,21 @@
1
+ import { createForm as t } from "./core/index.mjs";
2
+ import "./components/FormProvider.vue.mjs";
3
+ import { default as n } from "./components/SchemaField.mjs";
4
+ import { transformComponent as a } from "./utils/transformComponent.mjs";
5
+ import { mapProps as x } from "./utils/mapProps.mjs";
6
+ import { connect as l } from "./utils/connect.mjs";
7
+ import { useInjectFieldContext as c } from "./context/field.mjs";
8
+ import { default as s } from "./components/widget/RecursionField.mjs";
9
+ import { onFieldChange as C, onFormInit as h, onFormValiDate as I } from "./effects/onEffects.mjs";
10
+ export {
11
+ s as RecursionField,
12
+ n as SchemaField,
13
+ l as connect,
14
+ t as createForm,
15
+ x as mapProps,
16
+ C as onFieldChange,
17
+ h as onFormInit,
18
+ I as onFormValiDate,
19
+ a as transformComponent,
20
+ c as useInjectFieldContext
21
+ };
@@ -0,0 +1,7 @@
1
+ import { Form as i } from "./core/Form.mjs";
2
+ import "./utils/index.mjs";
3
+ import "./hooks/index.mjs";
4
+ import "./schema/index.mjs";
5
+ export {
6
+ i as Form
7
+ };
@@ -0,0 +1,5 @@
1
+ import { autorun as a, makeProxy as e } from "./makeProxy.mjs";
2
+ export {
3
+ a as autorun,
4
+ e as makeProxy
5
+ };
@@ -0,0 +1,46 @@
1
+ let a = null;
2
+ const l = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap();
3
+ function d(e, t) {
4
+ if (!a)
5
+ return;
6
+ let n = l.get(e);
7
+ n || (n = /* @__PURE__ */ new Map(), l.set(e, n));
8
+ let o = n.get(t);
9
+ o || (o = /* @__PURE__ */ new Set(), n.set(t, o)), o.add(a);
10
+ }
11
+ function M(e, t) {
12
+ const n = l.get(e);
13
+ if (!n)
14
+ return;
15
+ const o = n.get(t);
16
+ o && o.forEach((u) => u());
17
+ }
18
+ function w(e) {
19
+ if (typeof e != "object" || e === null)
20
+ return e;
21
+ const t = e, n = i.get(t);
22
+ if (n)
23
+ return n;
24
+ const o = {
25
+ get(r, s, f) {
26
+ d(r, s);
27
+ const c = Reflect.get(r, s, f);
28
+ return typeof c == "object" && c !== null ? w(c) : c;
29
+ },
30
+ set(r, s, f, c) {
31
+ const p = Reflect.set(r, s, f, c);
32
+ return M(r, s), p;
33
+ }
34
+ }, u = new Proxy(t, o);
35
+ return i.set(t, u), u;
36
+ }
37
+ function x(e) {
38
+ const t = () => {
39
+ a = t, e(), a = null;
40
+ };
41
+ t();
42
+ }
43
+ export {
44
+ x as autorun,
45
+ w as makeProxy
46
+ };
@@ -0,0 +1,12 @@
1
+ import { defineComponent as p, h as c } from "vue";
2
+ function f(e, ...t) {
3
+ const r = t.reduce((o, n) => n(o), e);
4
+ return p({
5
+ setup(o, { attrs: n, slots: u }) {
6
+ return () => c(r, n, u);
7
+ }
8
+ });
9
+ }
10
+ export {
11
+ f as connect
12
+ };
@@ -0,0 +1,7 @@
1
+ import { formatSchema as o, getSchemaProperties as t } from "./schema.mjs";
2
+ import { addUnit as a } from "./style.mjs";
3
+ export {
4
+ a as addUnit,
5
+ o as formatSchema,
6
+ t as getSchemaProperties
7
+ };