@silver-formily/element-plus 2.1.0 → 2.2.0

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 (121) hide show
  1. package/LICENSE +21 -21
  2. package/esm/__builtins__/configs/index.mjs.map +1 -1
  3. package/esm/__builtins__/shared/hooks.mjs.map +1 -1
  4. package/esm/__builtins__/shared/loading.mjs.map +1 -1
  5. package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -1
  6. package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
  7. package/esm/__builtins__/shared/utils.mjs.map +1 -1
  8. package/esm/array-base/index.mjs +18 -21
  9. package/esm/array-base/index.mjs.map +1 -1
  10. package/esm/array-base/symbols.mjs.map +1 -1
  11. package/esm/array-base/utils.mjs +29 -33
  12. package/esm/array-base/utils.mjs.map +1 -1
  13. package/esm/array-cards/index.mjs +29 -31
  14. package/esm/array-cards/index.mjs.map +1 -1
  15. package/esm/array-collapse/index.mjs +35 -36
  16. package/esm/array-collapse/index.mjs.map +1 -1
  17. package/esm/array-collapse/utils.mjs +2 -8
  18. package/esm/array-collapse/utils.mjs.map +1 -1
  19. package/esm/array-items/index.mjs +30 -33
  20. package/esm/array-items/index.mjs.map +1 -1
  21. package/esm/array-list-tabs/index.mjs +27 -28
  22. package/esm/array-list-tabs/index.mjs.map +1 -1
  23. package/esm/array-list-tabs/utils.mjs +5 -11
  24. package/esm/array-list-tabs/utils.mjs.map +1 -1
  25. package/esm/array-table/index.mjs +52 -53
  26. package/esm/array-table/index.mjs.map +1 -1
  27. package/esm/array-table/utils.mjs +12 -18
  28. package/esm/array-table/utils.mjs.map +1 -1
  29. package/esm/array-tabs/index.mjs +17 -19
  30. package/esm/array-tabs/index.mjs.map +1 -1
  31. package/esm/cascader/index.mjs +17 -20
  32. package/esm/cascader/index.mjs.map +1 -1
  33. package/esm/checkbox/index.mjs +16 -19
  34. package/esm/checkbox/index.mjs.map +1 -1
  35. package/esm/date-picker/index.mjs +12 -14
  36. package/esm/date-picker/index.mjs.map +1 -1
  37. package/esm/editable/index.mjs +48 -50
  38. package/esm/editable/index.mjs.map +1 -1
  39. package/esm/form/form.mjs +6 -6
  40. package/esm/form/form.mjs.map +1 -1
  41. package/esm/form-button-group/index.mjs +23 -26
  42. package/esm/form-button-group/index.mjs.map +1 -1
  43. package/esm/form-button-group/utils.mjs +2 -8
  44. package/esm/form-button-group/utils.mjs.map +1 -1
  45. package/esm/form-collapse/index.mjs +18 -20
  46. package/esm/form-collapse/index.mjs.map +1 -1
  47. package/esm/form-collapse/utils.mjs.map +1 -1
  48. package/esm/form-dialog/index.mjs +18 -18
  49. package/esm/form-dialog/index.mjs.map +1 -1
  50. package/esm/form-drawer/index.mjs +17 -17
  51. package/esm/form-drawer/index.mjs.map +1 -1
  52. package/esm/form-grid/hooks.mjs.map +1 -1
  53. package/esm/form-grid/index.mjs +20 -23
  54. package/esm/form-grid/index.mjs.map +1 -1
  55. package/esm/form-item/index.mjs +59 -57
  56. package/esm/form-item/index.mjs.map +1 -1
  57. package/esm/form-item/utils.mjs.map +1 -1
  58. package/esm/form-layout/form-layout.mjs +12 -16
  59. package/esm/form-layout/form-layout.mjs.map +1 -1
  60. package/esm/form-layout/utils.mjs +18 -23
  61. package/esm/form-layout/utils.mjs.map +1 -1
  62. package/esm/form-step/index.mjs +24 -26
  63. package/esm/form-step/index.mjs.map +1 -1
  64. package/esm/form-step/utils.mjs.map +1 -1
  65. package/esm/form-tab/hooks.mjs.map +1 -1
  66. package/esm/form-tab/index.mjs +19 -20
  67. package/esm/form-tab/index.mjs.map +1 -1
  68. package/esm/form-tab/utils.mjs.map +1 -1
  69. package/esm/index.d.ts +3 -0
  70. package/esm/index.mjs +46 -40
  71. package/esm/index.mjs.map +1 -1
  72. package/esm/input/index.mjs +20 -23
  73. package/esm/input/index.mjs.map +1 -1
  74. package/esm/input-number/index.mjs +7 -9
  75. package/esm/input-number/index.mjs.map +1 -1
  76. package/esm/pagination/components/jumper.mjs.map +1 -1
  77. package/esm/pagination/components/next.mjs.map +1 -1
  78. package/esm/pagination/components/pager.mjs.map +1 -1
  79. package/esm/pagination/components/prev.mjs.map +1 -1
  80. package/esm/pagination/components/total.mjs.map +1 -1
  81. package/esm/pagination/pagination.mjs.map +1 -1
  82. package/esm/password/index.mjs.map +1 -1
  83. package/esm/preview-text/index.d.ts +5 -0
  84. package/esm/preview-text/index.mjs +149 -128
  85. package/esm/preview-text/index.mjs.map +1 -1
  86. package/esm/preview-text/rate.d.ts +5 -0
  87. package/esm/preview-text/utils.d.ts +5 -5
  88. package/esm/preview-text/utils.mjs.map +1 -1
  89. package/esm/radio/index.mjs +25 -28
  90. package/esm/radio/index.mjs.map +1 -1
  91. package/esm/rate/index.d.ts +187 -0
  92. package/esm/rate/index.mjs +14 -0
  93. package/esm/rate/index.mjs.map +1 -0
  94. package/esm/reset/index.mjs.map +1 -1
  95. package/esm/segmented/index.d.ts +26 -0
  96. package/esm/segmented/index.mjs +37 -0
  97. package/esm/segmented/index.mjs.map +1 -0
  98. package/esm/segmented/segmented.d.ts +25 -0
  99. package/esm/select/index.mjs +16 -19
  100. package/esm/select/index.mjs.map +1 -1
  101. package/esm/select-table/index.mjs +12 -15
  102. package/esm/select-table/index.mjs.map +1 -1
  103. package/esm/slider/index.d.ts +177 -0
  104. package/esm/slider/index.mjs +14 -0
  105. package/esm/slider/index.mjs.map +1 -0
  106. package/esm/submit/index.mjs.map +1 -1
  107. package/esm/switch/index.mjs.map +1 -1
  108. package/esm/time-picker/index.mjs +6 -8
  109. package/esm/time-picker/index.mjs.map +1 -1
  110. package/esm/time-select/index.mjs +6 -8
  111. package/esm/time-select/index.mjs.map +1 -1
  112. package/esm/transfer/index.mjs.map +1 -1
  113. package/esm/tree/index.mjs +28 -31
  114. package/esm/tree/index.mjs.map +1 -1
  115. package/esm/tree/utils.mjs.map +1 -1
  116. package/esm/tree-select/index.mjs +17 -20
  117. package/esm/tree-select/index.mjs.map +1 -1
  118. package/esm/upload/index.mjs +7 -9
  119. package/esm/upload/index.mjs.map +1 -1
  120. package/esm/vendor/sizes.mjs.map +1 -1
  121. package/package.json +113 -113
@@ -1,15 +1,11 @@
1
1
  import { defineComponent as A, ref as l, computed as d, provide as e, watch as x, reactive as B, toRef as t, createBlock as P, openBlock as g, resolveDynamicComponent as I, mergeProps as b, unref as F, withModifiers as R, withCtx as _, renderSlot as q } from "vue";
2
2
  import { isValid as z, isEmpty as D } from "@formily/shared";
3
3
  import { useId as T, formContextKey as M } from "element-plus";
4
- import { stylePrefix as S } from "../__builtins__/configs/index.mjs";
5
- import { useThrottleFn as W } from "../__builtins__/shared/hooks.mjs";
6
- import "@formily/reactive";
7
- import "@formily/core";
8
- import "@silver-formily/reactive-vue";
9
- import "@silver-formily/vue";
10
- import { useCleanAttrs as $ } from "../__builtins__/shared/utils.mjs";
11
- import { formLayoutIdContext as H, useFormDeepLayout as V, useResponsiveFormLayout as E, filterValidFormLayoutProps as r, formLayoutDeepContext as K, formLayoutShallowContext as j } from "./utils.mjs";
12
- const to = /* @__PURE__ */ A({
4
+ import { formLayoutIdContext as S, useFormDeepLayout as W, useResponsiveFormLayout as $, filterValidFormLayoutProps as r, formLayoutDeepContext as H, formLayoutShallowContext as V } from "./utils.mjs";
5
+ import { useThrottleFn as E } from "../__builtins__/shared/hooks.mjs";
6
+ import { useCleanAttrs as K } from "../__builtins__/shared/utils.mjs";
7
+ import { stylePrefix as j } from "../__builtins__/configs/index.mjs";
8
+ const Y = /* @__PURE__ */ A({
13
9
  name: "FFormLayout",
14
10
  inheritAttrs: !1,
15
11
  __name: "form-layout",
@@ -35,19 +31,19 @@ const to = /* @__PURE__ */ A({
35
31
  requireAsteriskPosition: {}
36
32
  },
37
33
  setup(c) {
38
- const o = c, y = `${S}-form`, { props: s } = $(), n = l(), u = o.tag === "form", v = T(), p = d(() => s.value.id ?? `formily-${v.value}`), L = d(() => u ? p.value : s.value.id);
39
- u && e(H, p);
40
- const h = V(), { props: a } = E(o, n), C = l({
34
+ const o = c, y = `${j}-form`, { props: s } = K(), n = l(), u = o.tag === "form", v = T(), p = d(() => s.value.id ?? `formily-${v.value}`), L = d(() => u ? p.value : s.value.id);
35
+ u && e(S, p);
36
+ const h = W(), { props: a } = $(o, n), C = l({
41
37
  ...h.value,
42
38
  ...o.shallow ? {
43
39
  size: o.size,
44
40
  ...z(o.colon) && { colon: o.colon }
45
41
  } : r(o)
46
42
  });
47
- e(K, C);
43
+ e(H, C);
48
44
  const f = l(o.shallow ? r(o) : {});
49
- e(j, f);
50
- const k = W(() => {
45
+ e(V, f);
46
+ const k = E(() => {
51
47
  if (!D(a.value)) {
52
48
  const i = r(a.value);
53
49
  f.value = r({ ...o, ...i });
@@ -80,6 +76,6 @@ const to = /* @__PURE__ */ A({
80
76
  }
81
77
  });
82
78
  export {
83
- to as _
79
+ Y as _
84
80
  };
85
81
  //# sourceMappingURL=form-layout.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-layout.mjs","sources":["../../src/form-layout/form-layout.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { FormContext } from 'element-plus'\nimport type { IFormLayoutProps } from './types'\nimport { isEmpty, isValid } from '@formily/shared'\nimport { formContextKey, useId } from 'element-plus'\nimport { computed, provide, reactive, ref, toRef, watch } from 'vue'\nimport { stylePrefix, useCleanAttrs, useThrottleFn } from '../__builtins__'\nimport { filterValidFormLayoutProps, formLayoutDeepContext, formLayoutIdContext, formLayoutShallowContext, useFormDeepLayout, useResponsiveFormLayout } from './utils'\n\ndefineOptions({\n name: 'FFormLayout',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IFormLayoutProps>(), {\n tag: 'form',\n colon: undefined,\n labelWrap: undefined,\n fullness: undefined,\n size: 'default',\n layout: 'horizontal',\n shallow: true,\n statusIcon: true,\n asterisk: undefined,\n})\nconst formPrefixCls = `${stylePrefix}-form`\nconst { props: attrs } = useCleanAttrs()\nconst rootHTMLRef = ref<HTMLElement>()\nconst isFormTag = props.tag === 'form'\nconst formLayoutBaseId = useId()\nconst formLayoutId = computed(() => attrs.value.id ?? `formily-${formLayoutBaseId.value}`)\nconst formLayoutDomId = computed(() => (isFormTag ? formLayoutId.value : attrs.value.id))\nif (isFormTag) {\n provide(formLayoutIdContext, formLayoutId)\n}\n\nconst formLayoutDeepConfig = useFormDeepLayout()\nconst { props: responsiveProps } = useResponsiveFormLayout(props, rootHTMLRef)\n\nconst deepLayout = ref({\n ...formLayoutDeepConfig.value,\n ...(props.shallow\n ? {\n size: props.size,\n ...(isValid(props.colon) && { colon: props.colon }),\n }\n : filterValidFormLayoutProps(props)),\n})\nprovide(formLayoutDeepContext, deepLayout)\n\nconst shallowLayout = ref(props.shallow ? filterValidFormLayoutProps(props) : {})\nprovide(formLayoutShallowContext, shallowLayout)\n\nconst updateLayout = useThrottleFn(() => {\n if (!isEmpty(responsiveProps.value)) {\n const _responsiveProps = filterValidFormLayoutProps(responsiveProps.value)\n shallowLayout.value = filterValidFormLayoutProps({ ...props, ..._responsiveProps })\n }\n}, 200, true)\n\nwatch(() => [props, responsiveProps], updateLayout, {\n deep: true,\n immediate: true,\n})\n\nconst formContext = reactive({\n size: toRef(props, 'size'),\n statusIcon: toRef(props, 'statusIcon'),\n hideRequiredAsterisk: toRef(props, 'hideRequiredAsterisk'),\n requireAsteriskPosition: toRef(props, 'requireAsteriskPosition'),\n})\nprovide(formContextKey, formContext as FormContext)\n</script>\n\n<template>\n <component\n :is=\"props.tag\"\n :id=\"formLayoutDomId\"\n ref=\"rootHTMLRef\"\n :class=\"formPrefixCls\"\n v-bind=\"attrs\"\n @submit.prevent.stop\n >\n <slot />\n </component>\n</template>\n"],"names":["props","__props","formPrefixCls","stylePrefix","attrs","useCleanAttrs","rootHTMLRef","ref","isFormTag","formLayoutBaseId","useId","formLayoutId","computed","formLayoutDomId","provide","formLayoutIdContext","formLayoutDeepConfig","useFormDeepLayout","responsiveProps","useResponsiveFormLayout","deepLayout","isValid","filterValidFormLayoutProps","formLayoutDeepContext","shallowLayout","formLayoutShallowContext","updateLayout","useThrottleFn","isEmpty","_responsiveProps","watch","formContext","reactive","toRef","formContextKey","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_renderSlot","_ctx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,UAAMA,IAAQC,GAWRC,IAAgB,GAAGC,CAAW,SAC9B,EAAE,OAAOC,EAAA,IAAUC,EAAA,GACnBC,IAAcC,EAAA,GACdC,IAAYR,EAAM,QAAQ,QAC1BS,IAAmBC,EAAA,GACnBC,IAAeC,EAAS,MAAMR,EAAM,MAAM,MAAM,WAAWK,EAAiB,KAAK,EAAE,GACnFI,IAAkBD,EAAS,MAAOJ,IAAYG,EAAa,QAAQP,EAAM,MAAM,EAAG;AACxF,IAAII,KACFM,EAAQC,GAAqBJ,CAAY;AAG3C,UAAMK,IAAuBC,EAAA,GACvB,EAAE,OAAOC,EAAA,IAAoBC,EAAwBnB,GAAOM,CAAW,GAEvEc,IAAab,EAAI;AAAA,MACrB,GAAGS,EAAqB;AAAA,MACxB,GAAIhB,EAAM,UACN;AAAA,QACE,MAAMA,EAAM;AAAA,QACZ,GAAIqB,EAAQrB,EAAM,KAAK,KAAK,EAAE,OAAOA,EAAM,MAAA;AAAA,MAAM,IAEnDsB,EAA2BtB,CAAK;AAAA,IAAA,CACrC;AACD,IAAAc,EAAQS,GAAuBH,CAAU;AAEzC,UAAMI,IAAgBjB,EAAIP,EAAM,UAAUsB,EAA2BtB,CAAK,IAAI,EAAE;AAChF,IAAAc,EAAQW,GAA0BD,CAAa;AAE/C,UAAME,IAAeC,EAAc,MAAM;AACvC,UAAI,CAACC,EAAQV,EAAgB,KAAK,GAAG;AACnC,cAAMW,IAAmBP,EAA2BJ,EAAgB,KAAK;AACzE,QAAAM,EAAc,QAAQF,EAA2B,EAAE,GAAGtB,GAAO,GAAG6B,GAAkB;AAAA,MACpF;AAAA,IACF,GAAG,KAAK,EAAI;AAEZ,IAAAC,EAAM,MAAM,CAAC9B,GAAOkB,CAAe,GAAGQ,GAAc;AAAA,MAClD,MAAM;AAAA,MACN,WAAW;AAAA,IAAA,CACZ;AAED,UAAMK,IAAcC,EAAS;AAAA,MAC3B,MAAMC,EAAMjC,GAAO,MAAM;AAAA,MACzB,YAAYiC,EAAMjC,GAAO,YAAY;AAAA,MACrC,sBAAsBiC,EAAMjC,GAAO,sBAAsB;AAAA,MACzD,yBAAyBiC,EAAMjC,GAAO,yBAAyB;AAAA,IAAA,CAChE;AACD,WAAAc,EAAQoB,GAAgBH,CAA0B,cAIhDI,KAAAC,EASYC,EARLrC,EAAM,GAAG,GADhBsC,EASY;AAAA,MAPT,IAAIzB,EAAA;AAAA,eACD;AAAA,MAAJ,KAAIP;AAAA,MACH,OAAOJ;AAAA,IAAA,GACAqC,EAAAnC,CAAA,GAAK;AAAA,MACZ,4BAAD,MAAA;AAAA,MAAA,GAAoB,CAAA,WAAA,MAAA,CAAA;AAAA,IAAA;iBAEpB,MAAQ;AAAA,QAARoC,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;;"}
1
+ {"version":3,"file":"form-layout.mjs","sources":["../../src/form-layout/form-layout.vue"],"sourcesContent":["<script lang=\"ts\" setup>\r\nimport type { FormContext } from 'element-plus'\r\nimport type { IFormLayoutProps } from './types'\r\nimport { isEmpty, isValid } from '@formily/shared'\r\nimport { formContextKey, useId } from 'element-plus'\r\nimport { computed, provide, reactive, ref, toRef, watch } from 'vue'\r\nimport { stylePrefix, useCleanAttrs, useThrottleFn } from '../__builtins__'\r\nimport { filterValidFormLayoutProps, formLayoutDeepContext, formLayoutIdContext, formLayoutShallowContext, useFormDeepLayout, useResponsiveFormLayout } from './utils'\r\n\r\ndefineOptions({\r\n name: 'FFormLayout',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<IFormLayoutProps>(), {\r\n tag: 'form',\r\n colon: undefined,\r\n labelWrap: undefined,\r\n fullness: undefined,\r\n size: 'default',\r\n layout: 'horizontal',\r\n shallow: true,\r\n statusIcon: true,\r\n asterisk: undefined,\r\n})\r\nconst formPrefixCls = `${stylePrefix}-form`\r\nconst { props: attrs } = useCleanAttrs()\r\nconst rootHTMLRef = ref<HTMLElement>()\r\nconst isFormTag = props.tag === 'form'\r\nconst formLayoutBaseId = useId()\r\nconst formLayoutId = computed(() => attrs.value.id ?? `formily-${formLayoutBaseId.value}`)\r\nconst formLayoutDomId = computed(() => (isFormTag ? formLayoutId.value : attrs.value.id))\r\nif (isFormTag) {\r\n provide(formLayoutIdContext, formLayoutId)\r\n}\r\n\r\nconst formLayoutDeepConfig = useFormDeepLayout()\r\nconst { props: responsiveProps } = useResponsiveFormLayout(props, rootHTMLRef)\r\n\r\nconst deepLayout = ref({\r\n ...formLayoutDeepConfig.value,\r\n ...(props.shallow\r\n ? {\r\n size: props.size,\r\n ...(isValid(props.colon) && { colon: props.colon }),\r\n }\r\n : filterValidFormLayoutProps(props)),\r\n})\r\nprovide(formLayoutDeepContext, deepLayout)\r\n\r\nconst shallowLayout = ref(props.shallow ? filterValidFormLayoutProps(props) : {})\r\nprovide(formLayoutShallowContext, shallowLayout)\r\n\r\nconst updateLayout = useThrottleFn(() => {\r\n if (!isEmpty(responsiveProps.value)) {\r\n const _responsiveProps = filterValidFormLayoutProps(responsiveProps.value)\r\n shallowLayout.value = filterValidFormLayoutProps({ ...props, ..._responsiveProps })\r\n }\r\n}, 200, true)\r\n\r\nwatch(() => [props, responsiveProps], updateLayout, {\r\n deep: true,\r\n immediate: true,\r\n})\r\n\r\nconst formContext = reactive({\r\n size: toRef(props, 'size'),\r\n statusIcon: toRef(props, 'statusIcon'),\r\n hideRequiredAsterisk: toRef(props, 'hideRequiredAsterisk'),\r\n requireAsteriskPosition: toRef(props, 'requireAsteriskPosition'),\r\n})\r\nprovide(formContextKey, formContext as FormContext)\r\n</script>\r\n\r\n<template>\r\n <component\r\n :is=\"props.tag\"\r\n :id=\"formLayoutDomId\"\r\n ref=\"rootHTMLRef\"\r\n :class=\"formPrefixCls\"\r\n v-bind=\"attrs\"\r\n @submit.prevent.stop\r\n >\r\n <slot />\r\n </component>\r\n</template>\r\n"],"names":["props","__props","formPrefixCls","stylePrefix","attrs","useCleanAttrs","rootHTMLRef","ref","isFormTag","formLayoutBaseId","useId","formLayoutId","computed","formLayoutDomId","provide","formLayoutIdContext","formLayoutDeepConfig","useFormDeepLayout","responsiveProps","useResponsiveFormLayout","deepLayout","isValid","filterValidFormLayoutProps","formLayoutDeepContext","shallowLayout","formLayoutShallowContext","updateLayout","useThrottleFn","isEmpty","_responsiveProps","watch","formContext","reactive","toRef","formContextKey","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_renderSlot","_ctx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,UAAMA,IAAQC,GAWRC,IAAgB,GAAGC,CAAW,SAC9B,EAAE,OAAOC,EAAA,IAAUC,EAAA,GACnBC,IAAcC,EAAA,GACdC,IAAYR,EAAM,QAAQ,QAC1BS,IAAmBC,EAAA,GACnBC,IAAeC,EAAS,MAAMR,EAAM,MAAM,MAAM,WAAWK,EAAiB,KAAK,EAAE,GACnFI,IAAkBD,EAAS,MAAOJ,IAAYG,EAAa,QAAQP,EAAM,MAAM,EAAG;AACxF,IAAII,KACFM,EAAQC,GAAqBJ,CAAY;AAG3C,UAAMK,IAAuBC,EAAA,GACvB,EAAE,OAAOC,EAAA,IAAoBC,EAAwBnB,GAAOM,CAAW,GAEvEc,IAAab,EAAI;AAAA,MACrB,GAAGS,EAAqB;AAAA,MACxB,GAAIhB,EAAM,UACN;AAAA,QACE,MAAMA,EAAM;AAAA,QACZ,GAAIqB,EAAQrB,EAAM,KAAK,KAAK,EAAE,OAAOA,EAAM,MAAA;AAAA,MAAM,IAEnDsB,EAA2BtB,CAAK;AAAA,IAAA,CACrC;AACD,IAAAc,EAAQS,GAAuBH,CAAU;AAEzC,UAAMI,IAAgBjB,EAAIP,EAAM,UAAUsB,EAA2BtB,CAAK,IAAI,EAAE;AAChF,IAAAc,EAAQW,GAA0BD,CAAa;AAE/C,UAAME,IAAeC,EAAc,MAAM;AACvC,UAAI,CAACC,EAAQV,EAAgB,KAAK,GAAG;AACnC,cAAMW,IAAmBP,EAA2BJ,EAAgB,KAAK;AACzE,QAAAM,EAAc,QAAQF,EAA2B,EAAE,GAAGtB,GAAO,GAAG6B,GAAkB;AAAA,MACpF;AAAA,IACF,GAAG,KAAK,EAAI;AAEZ,IAAAC,EAAM,MAAM,CAAC9B,GAAOkB,CAAe,GAAGQ,GAAc;AAAA,MAClD,MAAM;AAAA,MACN,WAAW;AAAA,IAAA,CACZ;AAED,UAAMK,IAAcC,EAAS;AAAA,MAC3B,MAAMC,EAAMjC,GAAO,MAAM;AAAA,MACzB,YAAYiC,EAAMjC,GAAO,YAAY;AAAA,MACrC,sBAAsBiC,EAAMjC,GAAO,sBAAsB;AAAA,MACzD,yBAAyBiC,EAAMjC,GAAO,yBAAyB;AAAA,IAAA,CAChE;AACD,WAAAc,EAAQoB,GAAgBH,CAA0B,cAIhDI,KAAAC,EASYC,EARLrC,EAAM,GAAG,GADhBsC,EASY;AAAA,MAPT,IAAIzB,EAAA;AAAA,eACD;AAAA,MAAJ,KAAIP;AAAA,MACH,OAAOJ;AAAA,IAAA,GACAqC,EAAAnC,CAAA,GAAK;AAAA,MACZ,4BAAD,MAAA;AAAA,MAAA,GAAoB,CAAA,WAAA,MAAA,CAAA;AAAA,IAAA;iBAEpB,MAAQ;AAAA,QAARoC,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;;"}
@@ -1,11 +1,6 @@
1
1
  import { isArr as d, isValid as u } from "@formily/shared";
2
2
  import { inject as l, ref as i, computed as s } from "vue";
3
3
  import { useResizeObserver as h } from "../__builtins__/shared/hooks.mjs";
4
- import "element-plus";
5
- import "@formily/reactive";
6
- import "@formily/core";
7
- import "@silver-formily/reactive-vue";
8
- import "@silver-formily/vue";
9
4
  function A(t, o) {
10
5
  for (const [r, e] of t.entries())
11
6
  if (o <= e)
@@ -24,7 +19,7 @@ function a(t, o) {
24
19
  function x(t, o) {
25
20
  const { clientWidth: r } = t, {
26
21
  breakpoints: e,
27
- layout: c,
22
+ layout: p,
28
23
  labelAlign: f,
29
24
  wrapperAlign: m,
30
25
  labelCol: y,
@@ -35,7 +30,7 @@ function x(t, o) {
35
30
  r
36
31
  );
37
32
  return {
38
- layout: a(c, n),
33
+ layout: a(p, n),
39
34
  labelAlign: a(f, n),
40
35
  wrapperAlign: a(m, n),
41
36
  labelCol: a(y, n),
@@ -43,7 +38,7 @@ function x(t, o) {
43
38
  ...L
44
39
  };
45
40
  }
46
- function _(t, o) {
41
+ function P(t, o) {
47
42
  const { breakpoints: r } = t;
48
43
  if (!d(r))
49
44
  return {
@@ -56,23 +51,23 @@ function _(t, o) {
56
51
  props: e
57
52
  };
58
53
  }
59
- const p = Symbol(
54
+ const c = Symbol(
60
55
  "formLayoutDeepContext"
61
56
  ), w = Symbol("formLayoutShallowContext"), k = Symbol("formLayoutIdContext");
62
- function j() {
63
- return l(p, i({}));
57
+ function S() {
58
+ return l(c, i({}));
64
59
  }
65
- function D() {
66
- const t = l(w, i({})), o = l(p, i({}));
60
+ function O() {
61
+ const t = l(w, i({})), o = l(c, i({}));
67
62
  return s(() => ({
68
63
  ...o.value,
69
64
  ...t.value
70
65
  }));
71
66
  }
72
- function M() {
67
+ function R() {
73
68
  return l(k, s(() => ""));
74
69
  }
75
- const q = [
70
+ const W = [
76
71
  "colon",
77
72
  "labelAlign",
78
73
  "wrapperAlign",
@@ -91,24 +86,24 @@ const q = [
91
86
  "statusIcon",
92
87
  "requireAsteriskPosition"
93
88
  ];
94
- function z(t) {
89
+ function _(t) {
95
90
  return Object.fromEntries(
96
91
  Object.entries(t).filter(([o, r]) => u(r))
97
92
  );
98
93
  }
99
94
  export {
100
- q as FORM_LAYOUT_PROPS_KEYS,
95
+ W as FORM_LAYOUT_PROPS_KEYS,
101
96
  A as calcBreakpointIndex,
102
97
  C as calcFactor,
103
98
  x as calculateProps,
104
99
  a as factor,
105
- z as filterValidFormLayoutProps,
106
- p as formLayoutDeepContext,
100
+ _ as filterValidFormLayoutProps,
101
+ c as formLayoutDeepContext,
107
102
  k as formLayoutIdContext,
108
103
  w as formLayoutShallowContext,
109
- j as useFormDeepLayout,
110
- D as useFormLayout,
111
- M as useFormLayoutId,
112
- _ as useResponsiveFormLayout
104
+ S as useFormDeepLayout,
105
+ O as useFormLayout,
106
+ R as useFormLayoutId,
107
+ P as useResponsiveFormLayout
113
108
  };
114
109
  //# sourceMappingURL=utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../src/form-layout/utils.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref } from 'vue'\nimport type { IFormLayoutProps } from './types'\nimport { isArr, isValid } from '@formily/shared'\nimport { computed, inject, ref } from 'vue'\nimport { useResizeObserver } from '../__builtins__'\n\nexport function calcBreakpointIndex(breakpoints: number[], width: number): number {\n for (const [i, breakpoint] of breakpoints.entries()) {\n if (width <= breakpoint) {\n return i\n }\n }\n return -1\n}\n\nexport function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T {\n if (!Array.isArray(value) || value.length === 0) {\n return value as T\n }\n const safeIndex = Math.max(-1, Math.min(breakpointIndex, value.length - 1))\n return value.at(safeIndex)\n}\n\nexport function factor<T>(value: T | T[], breakpointIndex: number): T {\n return isValid(value) ? calcFactor<T>(value, breakpointIndex) : value as T\n}\n\nexport function calculateProps(target: Element, props: IFormLayoutProps): IFormLayoutProps {\n const { clientWidth } = target\n const {\n breakpoints,\n layout,\n labelAlign,\n wrapperAlign,\n labelCol,\n wrapperCol,\n ...otherProps\n } = props\n const breakpointIndex = calcBreakpointIndex(\n breakpoints as number[],\n clientWidth,\n )\n\n return {\n layout: factor(layout, breakpointIndex),\n labelAlign: factor(labelAlign, breakpointIndex),\n wrapperAlign: factor(wrapperAlign, breakpointIndex),\n labelCol: factor(labelCol, breakpointIndex),\n wrapperCol: factor(wrapperCol, breakpointIndex),\n ...otherProps,\n }\n}\n\nexport function useResponsiveFormLayout(props: IFormLayoutProps, root: Ref<HTMLElement | null>) {\n const { breakpoints } = props\n if (!isArr(breakpoints)) {\n return {\n props: ref(props),\n }\n }\n\n const layoutProps = ref<IFormLayoutProps>({})\n\n useResizeObserver(root, () => {\n layoutProps.value = calculateProps(root.value, props)\n })\n\n return {\n props: layoutProps,\n }\n}\n\nexport const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>> = Symbol(\n 'formLayoutDeepContext',\n)\n\nexport const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>\n = Symbol('formLayoutShallowContext')\n\nexport const formLayoutIdContext: InjectionKey<ComputedRef<string>>\n = Symbol('formLayoutIdContext')\n\nexport function useFormDeepLayout(): Ref<IFormLayoutProps> {\n return inject(formLayoutDeepContext, ref({}))\n}\n\nexport function useFormLayout(): Ref<IFormLayoutProps> {\n const shallowLayout = inject(formLayoutShallowContext, ref({}))\n const deepLayout = inject(formLayoutDeepContext, ref({}))\n\n const formLayout = computed(() => {\n return {\n ...deepLayout.value,\n ...shallowLayout.value,\n }\n })\n\n return formLayout\n}\n\nexport function useFormLayoutId(): ComputedRef<string> {\n return inject(formLayoutIdContext, computed(() => ''))\n}\n\nexport const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps> = [\n 'colon',\n 'labelAlign',\n 'wrapperAlign',\n 'labelWrap',\n 'labelWidth',\n 'wrapperWidth',\n 'labelCol',\n 'wrapperCol',\n 'fullness',\n 'size',\n 'layout',\n 'feedbackLayout',\n 'tooltipLayout',\n 'breakpoints',\n 'hideRequiredAsterisk',\n 'statusIcon',\n 'requireAsteriskPosition',\n] as const\n\nexport function filterValidFormLayoutProps(props: IFormLayoutProps): IFormLayoutProps {\n return Object.fromEntries(\n Object.entries(props)\n .filter(([_, value]) => isValid(value)),\n )\n}\n"],"names":["calcBreakpointIndex","breakpoints","width","i","breakpoint","calcFactor","value","breakpointIndex","safeIndex","factor","isValid","calculateProps","target","props","clientWidth","layout","labelAlign","wrapperAlign","labelCol","wrapperCol","otherProps","useResponsiveFormLayout","root","isArr","ref","layoutProps","useResizeObserver","formLayoutDeepContext","formLayoutShallowContext","formLayoutIdContext","useFormDeepLayout","inject","useFormLayout","shallowLayout","deepLayout","computed","useFormLayoutId","FORM_LAYOUT_PROPS_KEYS","filterValidFormLayoutProps","_"],"mappings":";;;;;;;;AAMO,SAASA,EAAoBC,GAAuBC,GAAuB;AAChF,aAAW,CAACC,GAAGC,CAAU,KAAKH,EAAY;AACxC,QAAIC,KAASE;AACX,aAAOD;AAGX,SAAO;AACT;AAEO,SAASE,EAAcC,GAAyBC,GAA4B;AACjF,MAAI,CAAC,MAAM,QAAQD,CAAK,KAAKA,EAAM,WAAW;AAC5C,WAAOA;AAET,QAAME,IAAY,KAAK,IAAI,IAAI,KAAK,IAAID,GAAiBD,EAAM,SAAS,CAAC,CAAC;AAC1E,SAAOA,EAAM,GAAGE,CAAS;AAC3B;AAEO,SAASC,EAAUH,GAAgBC,GAA4B;AACpE,SAAOG,EAAQJ,CAAK,IAAID,EAAcC,GAAOC,CAAe,IAAID;AAClE;AAEO,SAASK,EAAeC,GAAiBC,GAA2C;AACzF,QAAM,EAAE,aAAAC,MAAgBF,GAClB;AAAA,IACJ,aAAAX;AAAA,IACA,QAAAc;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDP,GACEN,IAAkBP;AAAA,IACtBC;AAAA,IACAa;AAAA,EAAA;AAGF,SAAO;AAAA,IACL,QAAQL,EAAOM,GAAQR,CAAe;AAAA,IACtC,YAAYE,EAAOO,GAAYT,CAAe;AAAA,IAC9C,cAAcE,EAAOQ,GAAcV,CAAe;AAAA,IAClD,UAAUE,EAAOS,GAAUX,CAAe;AAAA,IAC1C,YAAYE,EAAOU,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AAK,CAAC;AAAA,EAAA;AAE5C;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../src/form-layout/utils.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref } from 'vue'\r\nimport type { IFormLayoutProps } from './types'\r\nimport { isArr, isValid } from '@formily/shared'\r\nimport { computed, inject, ref } from 'vue'\r\nimport { useResizeObserver } from '../__builtins__'\r\n\r\nexport function calcBreakpointIndex(breakpoints: number[], width: number): number {\r\n for (const [i, breakpoint] of breakpoints.entries()) {\r\n if (width <= breakpoint) {\r\n return i\r\n }\r\n }\r\n return -1\r\n}\r\n\r\nexport function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T {\r\n if (!Array.isArray(value) || value.length === 0) {\r\n return value as T\r\n }\r\n const safeIndex = Math.max(-1, Math.min(breakpointIndex, value.length - 1))\r\n return value.at(safeIndex)\r\n}\r\n\r\nexport function factor<T>(value: T | T[], breakpointIndex: number): T {\r\n return isValid(value) ? calcFactor<T>(value, breakpointIndex) : value as T\r\n}\r\n\r\nexport function calculateProps(target: Element, props: IFormLayoutProps): IFormLayoutProps {\r\n const { clientWidth } = target\r\n const {\r\n breakpoints,\r\n layout,\r\n labelAlign,\r\n wrapperAlign,\r\n labelCol,\r\n wrapperCol,\r\n ...otherProps\r\n } = props\r\n const breakpointIndex = calcBreakpointIndex(\r\n breakpoints as number[],\r\n clientWidth,\r\n )\r\n\r\n return {\r\n layout: factor(layout, breakpointIndex),\r\n labelAlign: factor(labelAlign, breakpointIndex),\r\n wrapperAlign: factor(wrapperAlign, breakpointIndex),\r\n labelCol: factor(labelCol, breakpointIndex),\r\n wrapperCol: factor(wrapperCol, breakpointIndex),\r\n ...otherProps,\r\n }\r\n}\r\n\r\nexport function useResponsiveFormLayout(props: IFormLayoutProps, root: Ref<HTMLElement | null>) {\r\n const { breakpoints } = props\r\n if (!isArr(breakpoints)) {\r\n return {\r\n props: ref(props),\r\n }\r\n }\r\n\r\n const layoutProps = ref<IFormLayoutProps>({})\r\n\r\n useResizeObserver(root, () => {\r\n layoutProps.value = calculateProps(root.value, props)\r\n })\r\n\r\n return {\r\n props: layoutProps,\r\n }\r\n}\r\n\r\nexport const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>> = Symbol(\r\n 'formLayoutDeepContext',\r\n)\r\n\r\nexport const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>\r\n = Symbol('formLayoutShallowContext')\r\n\r\nexport const formLayoutIdContext: InjectionKey<ComputedRef<string>>\r\n = Symbol('formLayoutIdContext')\r\n\r\nexport function useFormDeepLayout(): Ref<IFormLayoutProps> {\r\n return inject(formLayoutDeepContext, ref({}))\r\n}\r\n\r\nexport function useFormLayout(): Ref<IFormLayoutProps> {\r\n const shallowLayout = inject(formLayoutShallowContext, ref({}))\r\n const deepLayout = inject(formLayoutDeepContext, ref({}))\r\n\r\n const formLayout = computed(() => {\r\n return {\r\n ...deepLayout.value,\r\n ...shallowLayout.value,\r\n }\r\n })\r\n\r\n return formLayout\r\n}\r\n\r\nexport function useFormLayoutId(): ComputedRef<string> {\r\n return inject(formLayoutIdContext, computed(() => ''))\r\n}\r\n\r\nexport const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps> = [\r\n 'colon',\r\n 'labelAlign',\r\n 'wrapperAlign',\r\n 'labelWrap',\r\n 'labelWidth',\r\n 'wrapperWidth',\r\n 'labelCol',\r\n 'wrapperCol',\r\n 'fullness',\r\n 'size',\r\n 'layout',\r\n 'feedbackLayout',\r\n 'tooltipLayout',\r\n 'breakpoints',\r\n 'hideRequiredAsterisk',\r\n 'statusIcon',\r\n 'requireAsteriskPosition',\r\n] as const\r\n\r\nexport function filterValidFormLayoutProps(props: IFormLayoutProps): IFormLayoutProps {\r\n return Object.fromEntries(\r\n Object.entries(props)\r\n .filter(([_, value]) => isValid(value)),\r\n )\r\n}\r\n"],"names":["calcBreakpointIndex","breakpoints","width","i","breakpoint","calcFactor","value","breakpointIndex","safeIndex","factor","isValid","calculateProps","target","props","clientWidth","layout","labelAlign","wrapperAlign","labelCol","wrapperCol","otherProps","useResponsiveFormLayout","root","isArr","ref","layoutProps","useResizeObserver","formLayoutDeepContext","formLayoutShallowContext","formLayoutIdContext","useFormDeepLayout","inject","useFormLayout","shallowLayout","deepLayout","computed","useFormLayoutId","FORM_LAYOUT_PROPS_KEYS","filterValidFormLayoutProps","_"],"mappings":";;;AAMO,SAASA,EAAoBC,GAAuBC,GAAuB;AAChF,aAAW,CAACC,GAAGC,CAAU,KAAKH,EAAY;AACxC,QAAIC,KAASE;AACX,aAAOD;AAGX,SAAO;AACT;AAEO,SAASE,EAAcC,GAAyBC,GAA4B;AACjF,MAAI,CAAC,MAAM,QAAQD,CAAK,KAAKA,EAAM,WAAW;AAC5C,WAAOA;AAET,QAAME,IAAY,KAAK,IAAI,IAAI,KAAK,IAAID,GAAiBD,EAAM,SAAS,CAAC,CAAC;AAC1E,SAAOA,EAAM,GAAGE,CAAS;AAC3B;AAEO,SAASC,EAAUH,GAAgBC,GAA4B;AACpE,SAAOG,EAAQJ,CAAK,IAAID,EAAcC,GAAOC,CAAe,IAAID;AAClE;AAEO,SAASK,EAAeC,GAAiBC,GAA2C;AACzF,QAAM,EAAE,aAAAC,MAAgBF,GAClB;AAAA,IACJ,aAAAX;AAAA,IACA,QAAAc;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDP,GACEN,IAAkBP;AAAA,IACtBC;AAAA,IACAa;AAAA,EAAA;AAGF,SAAO;AAAA,IACL,QAAQL,EAAOM,GAAQR,CAAe;AAAA,IACtC,YAAYE,EAAOO,GAAYT,CAAe;AAAA,IAC9C,cAAcE,EAAOQ,GAAcV,CAAe;AAAA,IAClD,UAAUE,EAAOS,GAAUX,CAAe;AAAA,IAC1C,YAAYE,EAAOU,GAAYZ,CAAe;AAAA,IAC9C,GAAGa;AAAA,EAAA;AAEP;AAE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import { defineComponent as $, renderSlot as g, computed as P, createElementBlock as o, openBlock as r, normalizeClass as B, createVNode as E, unref as t, mergeProps as h, withCtx as u, Fragment as c, renderList as x, createBlock as a, createSlots as N, resolveDynamicComponent as _, createTextVNode as v, toDisplayString as y, createCommentVNode as O } from "vue";
2
- import { ElSteps as V, ElStep as b } from "element-plus";
3
- import "@formily/reactive";
4
- import "@formily/core";
5
- import { useObserver as A } from "@silver-formily/reactive-vue";
6
- import { useField as D, useFieldSchema as R, RecursionField as j } from "@silver-formily/vue";
7
- import { composeExport as w } from "../__builtins__/shared/utils.mjs";
1
+ import { defineComponent as $, renderSlot as g, computed as P, createElementBlock as o, openBlock as r, normalizeClass as B, createVNode as E, unref as t, mergeProps as h, withCtx as u, Fragment as c, renderList as x, createBlock as m, createSlots as N, resolveDynamicComponent as _, createTextVNode as v, toDisplayString as y, createCommentVNode as O } from "vue";
8
2
  import { isObj as k } from "@formily/shared";
3
+ import { useObserver as V } from "@silver-formily/reactive-vue";
4
+ import { useField as b, useFieldSchema as A, RecursionField as D } from "@silver-formily/vue";
5
+ import { ElSteps as R, ElStep as j } from "element-plus";
6
+ import { createFormStep as C, parseSteps as w } from "./utils.mjs";
9
7
  import { stylePrefix as z } from "../__builtins__/configs/index.mjs";
10
- import { createFormStep as C, parseSteps as L } from "./utils.mjs";
8
+ import { composeExport as L } from "../__builtins__/shared/utils.mjs";
11
9
  const T = $({
12
10
  name: "FFormStepPane",
13
11
  inheritAttrs: !1
14
12
  }), q = (n, i) => {
15
- const m = n.__vccOpts || n;
16
- for (const [p, s] of i)
17
- m[p] = s;
18
- return m;
13
+ const a = n.__vccOpts || n;
14
+ for (const [s, p] of i)
15
+ a[s] = p;
16
+ return a;
19
17
  };
20
- function G(n, i, m, p, s, f) {
18
+ function G(n, i, a, s, p, f) {
21
19
  return g(n.$slots, "default");
22
20
  }
23
21
  const H = /* @__PURE__ */ q(T, [["render", G]]), I = /* @__PURE__ */ $({
@@ -30,23 +28,23 @@ const H = /* @__PURE__ */ q(T, [["render", G]]), I = /* @__PURE__ */ $({
30
28
  },
31
29
  setup(n) {
32
30
  const i = n;
33
- A();
34
- const m = D().value, p = `${z}-form-step`, s = R(), f = L(s.value);
35
- i.formStep.connect?.(f, m);
31
+ V();
32
+ const a = b().value, s = `${z}-form-step`, p = A(), f = w(p.value);
33
+ i.formStep.connect?.(f, a);
36
34
  const F = P(() => i.active ?? i.formStep?.current ?? 0);
37
35
  return (S, J) => (r(), o("div", {
38
- class: B(p)
36
+ class: B(s)
39
37
  }, [
40
- E(t(V), h(S.$attrs, {
38
+ E(t(R), h(S.$attrs, {
41
39
  active: F.value,
42
40
  style: [{ marginBottom: "10px" }]
43
41
  }), {
44
42
  default: u(() => [
45
- (r(!0), o(c, null, x(t(f), ({ props: l, slots: e }, d) => (r(), a(t(b), h({ key: d }, { ref_for: !0 }, l), N({ _: 2 }, [
43
+ (r(!0), o(c, null, x(t(f), ({ props: l, slots: e }, d) => (r(), m(t(j), h({ key: d }, { ref_for: !0 }, l), N({ _: 2 }, [
46
44
  e?.title ? {
47
45
  name: "title",
48
46
  fn: u(() => [
49
- t(k)(e.title) ? (r(), a(_(e.title), { key: 0 })) : (r(), o(c, { key: 1 }, [
47
+ t(k)(e.title) ? (r(), m(_(e.title), { key: 0 })) : (r(), o(c, { key: 1 }, [
50
48
  v(y(e.title), 1)
51
49
  ], 64))
52
50
  ]),
@@ -55,7 +53,7 @@ const H = /* @__PURE__ */ q(T, [["render", G]]), I = /* @__PURE__ */ $({
55
53
  e?.icon ? {
56
54
  name: "icon",
57
55
  fn: u(() => [
58
- t(k)(e.icon) ? (r(), a(_(e.icon), { key: 0 })) : (r(), o(c, { key: 1 }, [
56
+ t(k)(e.icon) ? (r(), m(_(e.icon), { key: 0 })) : (r(), o(c, { key: 1 }, [
59
57
  v(y(e.icon), 1)
60
58
  ], 64))
61
59
  ]),
@@ -64,7 +62,7 @@ const H = /* @__PURE__ */ q(T, [["render", G]]), I = /* @__PURE__ */ $({
64
62
  e?.description ? {
65
63
  name: "description",
66
64
  fn: u(() => [
67
- t(k)(e.description) ? (r(), a(_(e.description), { key: 0 })) : (r(), o(c, { key: 1 }, [
65
+ t(k)(e.description) ? (r(), m(_(e.description), { key: 0 })) : (r(), o(c, { key: 1 }, [
68
66
  v(y(e.description), 1)
69
67
  ], 64))
70
68
  ]),
@@ -75,7 +73,7 @@ const H = /* @__PURE__ */ q(T, [["render", G]]), I = /* @__PURE__ */ $({
75
73
  _: 1
76
74
  }, 16, ["active"]),
77
75
  (r(!0), o(c, null, x(t(f), ({ name: l, schema: e }, d) => (r(), o(c, { key: l }, [
78
- d === F.value ? (r(), a(t(j), {
76
+ d === F.value ? (r(), m(t(D), {
79
77
  key: 0,
80
78
  name: l,
81
79
  schema: e
@@ -83,12 +81,12 @@ const H = /* @__PURE__ */ q(T, [["render", G]]), I = /* @__PURE__ */ $({
83
81
  ], 64))), 128))
84
82
  ]));
85
83
  }
86
- }), te = w(I, {
84
+ }), ee = L(I, {
87
85
  StepPane: H,
88
86
  createFormStep: C
89
87
  });
90
88
  export {
91
- te as FormStep,
92
- te as default
89
+ ee as FormStep,
90
+ ee as default
93
91
  };
94
92
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/form-step/form-step-pane.vue","../../src/form-step/form-step.vue","../../src/form-step/index.ts"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent } from 'vue'\n\nexport default defineComponent({\n name: 'FFormStepPane',\n inheritAttrs: false,\n})\n</script>\n\n<template>\n <slot />\n</template>\n","<script setup lang=\"ts\">\nimport type { VoidField } from '@formily/core'\nimport type { IFormStepProps } from './types'\nimport { isObj } from '@formily/shared'\nimport { useObserver } from '@silver-formily/reactive-vue'\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\nimport { ElStep, ElSteps } from 'element-plus'\nimport { computed } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { createFormStep, parseSteps } from './utils'\n\ndefineOptions({\n name: 'FFormStep',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IFormStepProps>(), {\n formStep: () => createFormStep(),\n})\n\nuseObserver()\n\nconst field = useField<VoidField>().value\nconst prefixCls = `${stylePrefix}-form-step`\nconst fieldSchemaRef = useFieldSchema()\n\nconst steps = parseSteps(fieldSchemaRef.value)\n\nprops.formStep.connect?.(steps, field)\n\nconst current = computed(() => props.active ?? props.formStep?.current ?? 0)\n</script>\n\n<template>\n <div :class=\"prefixCls\">\n <ElSteps\n v-bind=\"$attrs\"\n :active=\"current\"\n :style=\"[{ marginBottom: '10px' }]\"\n >\n <ElStep\n v-for=\"({ props: stepProps, slots: stepSlots }, key) of steps\"\n :key=\"key\"\n v-bind=\"stepProps\"\n >\n <template v-if=\"stepSlots?.title\" #title>\n <template v-if=\"isObj(stepSlots.title)\">\n <component :is=\"stepSlots.title\" />\n </template>\n <template v-else>\n {{ stepSlots.title }}\n </template>\n </template>\n <template v-if=\"stepSlots?.icon\" #icon>\n <template v-if=\"isObj(stepSlots.icon)\">\n <component :is=\"stepSlots.icon\" />\n </template>\n <template v-else>\n {{ stepSlots.icon }}\n </template>\n </template>\n <template v-if=\"stepSlots?.description\" #description>\n <template v-if=\"isObj(stepSlots.description)\">\n <component :is=\"stepSlots.description\" />\n </template>\n <template v-else>\n {{ stepSlots.description }}\n </template>\n </template>\n </ElStep>\n </ElSteps>\n\n <template v-for=\"({ name, schema }, key) of steps\" :key=\"name\">\n <RecursionField\n v-if=\"key === current\"\n :name=\"name\"\n :schema=\"schema\"\n />\n </template>\n </div>\n</template>\n","import { composeExport } from '../__builtins__'\nimport FFormStepPane from './form-step-pane.vue'\nimport FFormStep from './form-step.vue'\nimport { createFormStep } from './utils'\n\nexport const FormStep = composeExport(FFormStep, {\n StepPane: FFormStepPane,\n createFormStep,\n})\n\nexport default FormStep\n"],"names":["_sfc_main$1","defineComponent","_renderSlot","_ctx","props","__props","useObserver","field","useField","prefixCls","stylePrefix","fieldSchemaRef","useFieldSchema","steps","parseSteps","current","computed","_createElementBlock","_createVNode","_unref","ElSteps","_mergeProps","_openBlock","_Fragment","stepProps","stepSlots","key","_createBlock","_createSlots","isObj","_resolveDynamicComponent","_createTextVNode","_toDisplayString","name","schema","RecursionField","FormStep","composeExport","FFormStep","FFormStepPane","createFormStep"],"mappings":";;;;;;;;;;AAGA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;;;;;SAICC,EAAQC,EAAA,QAAA,SAAA;;;;;;;;;;;ACMV,UAAMC,IAAQC;AAId,IAAAC,EAAA;AAEA,UAAMC,IAAQC,IAAsB,OAC9BC,IAAY,GAAGC,CAAW,cAC1BC,IAAiBC,EAAA,GAEjBC,IAAQC,EAAWH,EAAe,KAAK;AAE7C,IAAAP,EAAM,SAAS,UAAUS,GAAON,CAAK;AAErC,UAAMQ,IAAUC,EAAS,MAAMZ,EAAM,UAAUA,EAAM,UAAU,WAAW,CAAC;2BAIzEa,EA6CM,OAAA;AAAA,MA7CA,SAAOR,CAAS;AAAA,IAAA;MACpBS,EAmCUC,EAAAC,CAAA,GAnCVC,EAmCUlB,EAAA,QAlCM;AAAA,QACb,QAAQY,EAAA;AAAA,QACR,OAAO,CAAA,EAAA,cAAA,QAAA;AAAA,MAAA;mBAGN,MAA8D;AAAA,WADhEO,EAAA,EAAA,GAAAL,EA6BSM,WA5BiDJ,EAAAN,CAAA,GAAK,CAAA,EAAA,OAA5CW,GAAS,OAASC,EAAA,GAAaC,OADlDJ,EAAA,GAAAK,EA6BSR,MA7BTE,EA6BS,EA3BN,KAAAK,EAAA,oBACOF,CAAS,GAAAI,EAAA,EAAA,GAAA,KAAA;AAAA,YAEDH,GAAW;oBAAQ;AAAA,oBACjC,MAEW;AAAA,gBAFKN,EAAAU,CAAA,EAAMJ,EAAU,KAAK,UACnCE,EAAmCG,EAAnBL,EAAU,KAAK,GAAA,EAAA,KAAA,EAAA,CAAA,WAEjCR,EAEWM,GAAA,EAAA,KAAA,KAAA;AAAA,kBADNQ,EAAAC,EAAAP,EAAU,KAAK,GAAA,CAAA;AAAA,gBAAA;;;;YAGNA,GAAW;oBAAO;AAAA,oBAChC,MAEW;AAAA,gBAFKN,EAAAU,CAAA,EAAMJ,EAAU,IAAI,UAClCE,EAAkCG,EAAlBL,EAAU,IAAI,GAAA,EAAA,KAAA,EAAA,CAAA,WAEhCR,EAEWM,GAAA,EAAA,KAAA,KAAA;AAAA,kBADNQ,EAAAC,EAAAP,EAAU,IAAI,GAAA,CAAA;AAAA,gBAAA;;;;YAGLA,GAAW;oBAAc;AAAA,oBACvC,MAEW;AAAA,gBAFKN,EAAAU,CAAA,EAAMJ,EAAU,WAAW,UACzCE,EAAyCG,EAAzBL,EAAU,WAAW,GAAA,EAAA,KAAA,EAAA,CAAA,WAEvCR,EAEWM,GAAA,EAAA,KAAA,KAAA;AAAA,kBADNQ,EAAAC,EAAAP,EAAU,WAAW,GAAA,CAAA;AAAA,gBAAA;;;;;;;;OAMhCH,EAAA,EAAA,GAAAL,EAMWM,WANiCJ,EAAAN,CAAA,GAAK,CAAA,EAA7B,MAAAoB,GAAM,QAAAC,EAAA,GAAUR,wBAAqBO,KAAI;AAAA,QAEnDP,MAAQX,EAAA,cADhBY,EAIER,EAAAgB,CAAA,GAAA;AAAA;UAFC,MAAAF;AAAA,UACA,QAAAC;AAAA,QAAA;;;;ICvEIE,KAAWC,EAAcC,GAAW;AAAA,EAC/C,UAAUC;AAAA,EACV,gBAAAC;AACF,CAAC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/form-step/form-step-pane.vue","../../src/form-step/form-step-pane.vue","../../src/form-step/form-step.vue","../../src/form-step/index.ts"],"sourcesContent":["<script lang=\"ts\">\r\nimport { defineComponent } from 'vue'\r\n\r\nexport default defineComponent({\r\n name: 'FFormStepPane',\r\n inheritAttrs: false,\r\n})\r\n</script>\r\n\r\n<template>\r\n <slot />\r\n</template>\r\n","<script lang=\"ts\">\r\nimport { defineComponent } from 'vue'\r\n\r\nexport default defineComponent({\r\n name: 'FFormStepPane',\r\n inheritAttrs: false,\r\n})\r\n</script>\r\n\r\n<template>\r\n <slot />\r\n</template>\r\n","<script setup lang=\"ts\">\r\nimport type { VoidField } from '@formily/core'\r\nimport type { IFormStepProps } from './types'\r\nimport { isObj } from '@formily/shared'\r\nimport { useObserver } from '@silver-formily/reactive-vue'\r\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\r\nimport { ElStep, ElSteps } from 'element-plus'\r\nimport { computed } from 'vue'\r\nimport { stylePrefix } from '../__builtins__'\r\nimport { createFormStep, parseSteps } from './utils'\r\n\r\ndefineOptions({\r\n name: 'FFormStep',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<IFormStepProps>(), {\r\n formStep: () => createFormStep(),\r\n})\r\n\r\nuseObserver()\r\n\r\nconst field = useField<VoidField>().value\r\nconst prefixCls = `${stylePrefix}-form-step`\r\nconst fieldSchemaRef = useFieldSchema()\r\n\r\nconst steps = parseSteps(fieldSchemaRef.value)\r\n\r\nprops.formStep.connect?.(steps, field)\r\n\r\nconst current = computed(() => props.active ?? props.formStep?.current ?? 0)\r\n</script>\r\n\r\n<template>\r\n <div :class=\"prefixCls\">\r\n <ElSteps\r\n v-bind=\"$attrs\"\r\n :active=\"current\"\r\n :style=\"[{ marginBottom: '10px' }]\"\r\n >\r\n <ElStep\r\n v-for=\"({ props: stepProps, slots: stepSlots }, key) of steps\"\r\n :key=\"key\"\r\n v-bind=\"stepProps\"\r\n >\r\n <template v-if=\"stepSlots?.title\" #title>\r\n <template v-if=\"isObj(stepSlots.title)\">\r\n <component :is=\"stepSlots.title\" />\r\n </template>\r\n <template v-else>\r\n {{ stepSlots.title }}\r\n </template>\r\n </template>\r\n <template v-if=\"stepSlots?.icon\" #icon>\r\n <template v-if=\"isObj(stepSlots.icon)\">\r\n <component :is=\"stepSlots.icon\" />\r\n </template>\r\n <template v-else>\r\n {{ stepSlots.icon }}\r\n </template>\r\n </template>\r\n <template v-if=\"stepSlots?.description\" #description>\r\n <template v-if=\"isObj(stepSlots.description)\">\r\n <component :is=\"stepSlots.description\" />\r\n </template>\r\n <template v-else>\r\n {{ stepSlots.description }}\r\n </template>\r\n </template>\r\n </ElStep>\r\n </ElSteps>\r\n\r\n <template v-for=\"({ name, schema }, key) of steps\" :key=\"name\">\r\n <RecursionField\r\n v-if=\"key === current\"\r\n :name=\"name\"\r\n :schema=\"schema\"\r\n />\r\n </template>\r\n </div>\r\n</template>\r\n","import { composeExport } from '../__builtins__'\r\nimport FFormStepPane from './form-step-pane.vue'\r\nimport FFormStep from './form-step.vue'\r\nimport { createFormStep } from './utils'\r\n\r\nexport const FormStep = composeExport(FFormStep, {\r\n StepPane: FFormStepPane,\r\n createFormStep,\r\n})\r\n\r\nexport default FormStep\r\n"],"names":["_sfc_main$1","defineComponent","_renderSlot","_ctx","props","__props","useObserver","field","useField","prefixCls","stylePrefix","fieldSchemaRef","useFieldSchema","steps","parseSteps","current","computed","_createElementBlock","_createVNode","_unref","ElSteps","_mergeProps","_openBlock","_Fragment","stepProps","stepSlots","key","_createBlock","_createSlots","isObj","_resolveDynamicComponent","_createTextVNode","_toDisplayString","name","schema","RecursionField","FormStep","composeExport","FFormStep","FFormStepPane","createFormStep"],"mappings":";;;;;;;;AAGA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;;;;;SCICC,EAAQC,EAAA,QAAA,SAAA;;;;;;;;;;;ACMV,UAAMC,IAAQC;AAId,IAAAC,EAAA;AAEA,UAAMC,IAAQC,IAAsB,OAC9BC,IAAY,GAAGC,CAAW,cAC1BC,IAAiBC,EAAA,GAEjBC,IAAQC,EAAWH,EAAe,KAAK;AAE7C,IAAAP,EAAM,SAAS,UAAUS,GAAON,CAAK;AAErC,UAAMQ,IAAUC,EAAS,MAAMZ,EAAM,UAAUA,EAAM,UAAU,WAAW,CAAC;2BAI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;;;;;OAMhCH,EAAA,EAAA,GAAAL,EAMWM,WANiCJ,EAAAN,CAAA,GAAK,CAAA,EAA7B,MAAAoB,GAAM,QAAAC,EAAA,GAAUR,wBAAqBO,KAAI;AAAA,QAEnDP,MAAQX,EAAA,cADhBY,EAIER,EAAAgB,CAAA,GAAA;AAAA;UAFC,MAAAF;AAAA,UACA,QAAAC;AAAA,QAAA;;;;ICvEIE,KAAWC,EAAcC,GAAW;AAAA,EAC/C,UAAUC;AAAA,EACV,gBAAAC;AACF,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../src/form-step/utils.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\nimport type { Slots } from 'vue'\nimport type { FormStepEnv, IFormStep } from './types'\nimport { action, model, observable } from '@formily/reactive'\n\nexport interface SchemaStep {\n name: SchemaKey\n props: any\n schema: Schema\n slots: Slots\n}\n\nexport function createFormStep(defaultCurrent = 0): IFormStep {\n const env: FormStepEnv = observable({\n form: null,\n field: null,\n steps: [],\n })\n\n const setDisplay = action.bound((target: number) => {\n const currentStep = env.steps[target]\n for (const { name } of env.steps) {\n env.form.query(`${env.field.address}.${name}`).take((field) => {\n if (name === currentStep.name) {\n field.setDisplay('visible')\n }\n else {\n field.setDisplay('hidden')\n }\n })\n }\n })\n\n const formStep: IFormStep = model({\n connect(steps, field) {\n env.steps = steps\n env.form = field?.form\n env.field = field\n },\n current: defaultCurrent,\n setCurrent(key: number) {\n formStep.current = key\n },\n get allowNext() {\n return formStep.current < env.steps.length - 1\n },\n get allowBack() {\n return formStep.current > 0\n },\n async next() {\n try {\n await env.form.validate()\n // eslint-disable-next-line ts/no-use-before-define\n next()\n }\n catch {}\n },\n async back() {\n // eslint-disable-next-line ts/no-use-before-define\n back()\n },\n async submit(onSubmit) {\n return env.form?.submit?.(onSubmit)\n },\n })\n\n const next = action.bound(() => {\n /* istanbul ignore else -- @preserve */\n if (formStep.allowNext) {\n setDisplay(formStep.current + 1)\n formStep.setCurrent(formStep.current + 1)\n }\n })\n\n const back = action.bound(() => {\n /* istanbul ignore else -- @preserve */\n if (formStep.allowBack) {\n setDisplay(formStep.current - 1)\n formStep.setCurrent(formStep.current - 1)\n }\n })\n return formStep\n}\n\nexport function parseSteps(schema: Schema) {\n const steps: SchemaStep[] = []\n schema.mapProperties((schema, name) => {\n /* istanbul ignore else -- @preserve */\n if (schema['x-component']?.indexOf('StepPane') > -1) {\n steps.push({\n name,\n props: schema['x-component-props'],\n schema,\n slots: schema['x-content'],\n })\n }\n })\n return steps\n}\n"],"names":["createFormStep","defaultCurrent","env","observable","setDisplay","action","target","currentStep","name","field","formStep","model","steps","key","next","back","onSubmit","parseSteps","schema"],"mappings":";AAYO,SAASA,EAAeC,IAAiB,GAAc;AAC5D,QAAMC,IAAmBC,EAAW;AAAA,IAClC,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,CAAA;AAAA,EAAC,CACT,GAEKC,IAAaC,EAAO,MAAM,CAACC,MAAmB;AAClD,UAAMC,IAAcL,EAAI,MAAMI,CAAM;AACpC,eAAW,EAAE,MAAAE,OAAUN,EAAI;AACzB,MAAAA,EAAI,KAAK,MAAM,GAAGA,EAAI,MAAM,OAAO,IAAIM,CAAI,EAAE,EAAE,KAAK,CAACC,MAAU;AAC7D,QAAID,MAASD,EAAY,OACvBE,EAAM,WAAW,SAAS,IAG1BA,EAAM,WAAW,QAAQ;AAAA,MAE7B,CAAC;AAAA,EAEL,CAAC,GAEKC,IAAsBC,EAAM;AAAA,IAChC,QAAQC,GAAOH,GAAO;AACpB,MAAAP,EAAI,QAAQU,GACZV,EAAI,OAAOO,GAAO,MAClBP,EAAI,QAAQO;AAAA,IACd;AAAA,IACA,SAASR;AAAA,IACT,WAAWY,GAAa;AACtB,MAAAH,EAAS,UAAUG;AAAA,IACrB;AAAA,IACA,IAAI,YAAY;AACd,aAAOH,EAAS,UAAUR,EAAI,MAAM,SAAS;AAAA,IAC/C;AAAA,IACA,IAAI,YAAY;AACd,aAAOQ,EAAS,UAAU;AAAA,IAC5B;AAAA,IACA,MAAM,OAAO;AACX,UAAI;AACF,cAAMR,EAAI,KAAK,SAAA,GAEfY,EAAA;AAAA,MACF,QACM;AAAA,MAAC;AAAA,IACT;AAAA,IACA,MAAM,OAAO;AAEX,MAAAC,EAAA;AAAA,IACF;AAAA,IACA,MAAM,OAAOC,GAAU;AACrB,aAAOd,EAAI,MAAM,SAASc,CAAQ;AAAA,IACpC;AAAA,EAAA,CACD,GAEKF,IAAOT,EAAO,MAAM,MAAM;AAAA,IAAA;AAE9B,IAAIK,EAAS,cACXN,EAAWM,EAAS,UAAU,CAAC,GAC/BA,EAAS,WAAWA,EAAS,UAAU,CAAC;AAAA,EAE5C,CAAC,GAEKK,IAAOV,EAAO,MAAM,MAAM;AAAA,IAAA;AAE9B,IAAIK,EAAS,cACXN,EAAWM,EAAS,UAAU,CAAC,GAC/BA,EAAS,WAAWA,EAAS,UAAU,CAAC;AAAA,EAE5C,CAAC;AACD,SAAOA;AACT;AAEO,SAASO,EAAWC,GAAgB;AACzC,QAAMN,IAAsB,CAAA;AAC5B,SAAAM,EAAO,cAAc,CAACA,GAAQV,MAAS;AAAA,IAAA;AAErC,IAAIU,EAAO,aAAa,GAAG,QAAQ,UAAU,IAAI,MAC/CN,EAAM,KAAK;AAAA,MACT,MAAAJ;AAAA,MACA,OAAOU,EAAO,mBAAmB;AAAA,MACjC,QAAAA;AAAAA,MACA,OAAOA,EAAO,WAAW;AAAA,IAAA,CAC1B;AAAA,EAEL,CAAC,GACMN;AACT;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../src/form-step/utils.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\r\nimport type { Slots } from 'vue'\r\nimport type { FormStepEnv, IFormStep } from './types'\r\nimport { action, model, observable } from '@formily/reactive'\r\n\r\nexport interface SchemaStep {\r\n name: SchemaKey\r\n props: any\r\n schema: Schema\r\n slots: Slots\r\n}\r\n\r\nexport function createFormStep(defaultCurrent = 0): IFormStep {\r\n const env: FormStepEnv = observable({\r\n form: null,\r\n field: null,\r\n steps: [],\r\n })\r\n\r\n const setDisplay = action.bound((target: number) => {\r\n const currentStep = env.steps[target]\r\n for (const { name } of env.steps) {\r\n env.form.query(`${env.field.address}.${name}`).take((field) => {\r\n if (name === currentStep.name) {\r\n field.setDisplay('visible')\r\n }\r\n else {\r\n field.setDisplay('hidden')\r\n }\r\n })\r\n }\r\n })\r\n\r\n const formStep: IFormStep = model({\r\n connect(steps, field) {\r\n env.steps = steps\r\n env.form = field?.form\r\n env.field = field\r\n },\r\n current: defaultCurrent,\r\n setCurrent(key: number) {\r\n formStep.current = key\r\n },\r\n get allowNext() {\r\n return formStep.current < env.steps.length - 1\r\n },\r\n get allowBack() {\r\n return formStep.current > 0\r\n },\r\n async next() {\r\n try {\r\n await env.form.validate()\r\n // eslint-disable-next-line ts/no-use-before-define\r\n next()\r\n }\r\n catch {}\r\n },\r\n async back() {\r\n // eslint-disable-next-line ts/no-use-before-define\r\n back()\r\n },\r\n async submit(onSubmit) {\r\n return env.form?.submit?.(onSubmit)\r\n },\r\n })\r\n\r\n const next = action.bound(() => {\r\n /* istanbul ignore else -- @preserve */\r\n if (formStep.allowNext) {\r\n setDisplay(formStep.current + 1)\r\n formStep.setCurrent(formStep.current + 1)\r\n }\r\n })\r\n\r\n const back = action.bound(() => {\r\n /* istanbul ignore else -- @preserve */\r\n if (formStep.allowBack) {\r\n setDisplay(formStep.current - 1)\r\n formStep.setCurrent(formStep.current - 1)\r\n }\r\n })\r\n return formStep\r\n}\r\n\r\nexport function parseSteps(schema: Schema) {\r\n const steps: SchemaStep[] = []\r\n schema.mapProperties((schema, name) => {\r\n /* istanbul ignore else -- @preserve */\r\n if (schema['x-component']?.indexOf('StepPane') > -1) {\r\n steps.push({\r\n name,\r\n props: schema['x-component-props'],\r\n schema,\r\n slots: schema['x-content'],\r\n })\r\n }\r\n })\r\n return steps\r\n}\r\n"],"names":["createFormStep","defaultCurrent","env","observable","setDisplay","action","target","currentStep","name","field","formStep","model","steps","key","next","back","onSubmit","parseSteps","schema"],"mappings":";AAYO,SAASA,EAAeC,IAAiB,GAAc;AAC5D,QAAMC,IAAmBC,EAAW;AAAA,IAClC,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,CAAA;AAAA,EAAC,CACT,GAEKC,IAAaC,EAAO,MAAM,CAACC,MAAmB;AAClD,UAAMC,IAAcL,EAAI,MAAMI,CAAM;AACpC,eAAW,EAAE,MAAAE,OAAUN,EAAI;AACzB,MAAAA,EAAI,KAAK,MAAM,GAAGA,EAAI,MAAM,OAAO,IAAIM,CAAI,EAAE,EAAE,KAAK,CAACC,MAAU;AAC7D,QAAID,MAASD,EAAY,OACvBE,EAAM,WAAW,SAAS,IAG1BA,EAAM,WAAW,QAAQ;AAAA,MAE7B,CAAC;AAAA,EAEL,CAAC,GAEKC,IAAsBC,EAAM;AAAA,IAChC,QAAQC,GAAOH,GAAO;AACpB,MAAAP,EAAI,QAAQU,GACZV,EAAI,OAAOO,GAAO,MAClBP,EAAI,QAAQO;AAAA,IACd;AAAA,IACA,SAASR;AAAA,IACT,WAAWY,GAAa;AACtB,MAAAH,EAAS,UAAUG;AAAA,IACrB;AAAA,IACA,IAAI,YAAY;AACd,aAAOH,EAAS,UAAUR,EAAI,MAAM,SAAS;AAAA,IAC/C;AAAA,IACA,IAAI,YAAY;AACd,aAAOQ,EAAS,UAAU;AAAA,IAC5B;AAAA,IACA,MAAM,OAAO;AACX,UAAI;AACF,cAAMR,EAAI,KAAK,SAAA,GAEfY,EAAA;AAAA,MACF,QACM;AAAA,MAAC;AAAA,IACT;AAAA,IACA,MAAM,OAAO;AAEX,MAAAC,EAAA;AAAA,IACF;AAAA,IACA,MAAM,OAAOC,GAAU;AACrB,aAAOd,EAAI,MAAM,SAASc,CAAQ;AAAA,IACpC;AAAA,EAAA,CACD,GAEKF,IAAOT,EAAO,MAAM,MAAM;AAAA,IAAA;AAE9B,IAAIK,EAAS,cACXN,EAAWM,EAAS,UAAU,CAAC,GAC/BA,EAAS,WAAWA,EAAS,UAAU,CAAC;AAAA,EAE5C,CAAC,GAEKK,IAAOV,EAAO,MAAM,MAAM;AAAA,IAAA;AAE9B,IAAIK,EAAS,cACXN,EAAWM,EAAS,UAAU,CAAC,GAC/BA,EAAS,WAAWA,EAAS,UAAU,CAAC;AAAA,EAE5C,CAAC;AACD,SAAOA;AACT;AAEO,SAASO,EAAWC,GAAgB;AACzC,QAAMN,IAAsB,CAAA;AAC5B,SAAAM,EAAO,cAAc,CAACA,GAAQV,MAAS;AAAA,IAAA;AAErC,IAAIU,EAAO,aAAa,GAAG,QAAQ,UAAU,IAAI,MAC/CN,EAAM,KAAK;AAAA,MACT,MAAAJ;AAAA,MACA,OAAOU,EAAO,mBAAmB;AAAA,MACjC,QAAAA;AAAAA,MACA,OAAOA,EAAO,WAAW;AAAA,IAAA,CAC1B;AAAA,EAEL,CAAC,GACMN;AACT;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.mjs","sources":["../../src/form-tab/hooks.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\nimport { observable, reaction } from '@formily/reactive'\nimport { useField, useFieldSchema } from '@silver-formily/vue'\n\nexport type Tabs = { name: SchemaKey, props: any, schema: Schema }[]\n\nexport function useTabs() {\n const tabsField = useField()\n const schema = useFieldSchema()\n const tabs: Tabs = observable([])\n reaction(() => {\n const tabDisplayStatus = schema.value?.mapProperties((schema, name) => {\n const field = tabsField.value\n .query(tabsField.value.address.concat(name))\n .take()\n return field?.display\n })\n return tabDisplayStatus\n }, () => {\n tabs.length = 0\n schema.value?.mapProperties((schema, name) => {\n const field = tabsField.value\n .query(tabsField.value.address.concat(name))\n .take()\n if (field?.display === 'none' || field?.display === 'hidden')\n return\n\n if (schema['x-component']?.indexOf('TabPane') > -1) {\n tabs.push({\n name,\n props: {\n name: schema?.['x-component-props']?.name || name,\n ...schema?.['x-component-props'],\n },\n schema,\n })\n }\n })\n }, {\n fireImmediately: true,\n })\n\n return tabs\n}\n"],"names":["useTabs","tabsField","useField","schema","useFieldSchema","tabs","observable","reaction","name","field"],"mappings":";;AAMO,SAASA,IAAU;AACxB,QAAMC,IAAYC,EAAA,GACZC,IAASC,EAAA,GACTC,IAAaC,EAAW,EAAE;AAChC,SAAAC,EAAS,MACkBJ,EAAO,OAAO,cAAc,CAACA,GAAQK,MAC9CP,EAAU,MACrB,MAAMA,EAAU,MAAM,QAAQ,OAAOO,CAAI,CAAC,EAC1C,KAAA,GACW,OACf,GAEA,MAAM;AACP,IAAAH,EAAK,SAAS,GACdF,EAAO,OAAO,cAAc,CAACA,GAAQK,MAAS;AAC5C,YAAMC,IAAQR,EAAU,MACrB,MAAMA,EAAU,MAAM,QAAQ,OAAOO,CAAI,CAAC,EAC1C,KAAA;AACH,MAAIC,GAAO,YAAY,UAAUA,GAAO,YAAY,YAGhDN,EAAO,aAAa,GAAG,QAAQ,SAAS,IAAI,MAC9CE,EAAK,KAAK;AAAA,QACR,MAAAG;AAAA,QACA,OAAO;AAAA,UACL,MAAML,IAAS,mBAAmB,GAAG,QAAQK;AAAA,UAC7C,GAAGL,IAAS,mBAAmB;AAAA,QAAA;AAAA,QAEjC,QAAAA;AAAAA,MAAA,CACD;AAAA,IAEL,CAAC;AAAA,EACH,GAAG;AAAA,IACD,iBAAiB;AAAA,EAAA,CAClB,GAEME;AACT;"}
1
+ {"version":3,"file":"hooks.mjs","sources":["../../src/form-tab/hooks.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\r\nimport { observable, reaction } from '@formily/reactive'\r\nimport { useField, useFieldSchema } from '@silver-formily/vue'\r\n\r\nexport type Tabs = { name: SchemaKey, props: any, schema: Schema }[]\r\n\r\nexport function useTabs() {\r\n const tabsField = useField()\r\n const schema = useFieldSchema()\r\n const tabs: Tabs = observable([])\r\n reaction(() => {\r\n const tabDisplayStatus = schema.value?.mapProperties((schema, name) => {\r\n const field = tabsField.value\r\n .query(tabsField.value.address.concat(name))\r\n .take()\r\n return field?.display\r\n })\r\n return tabDisplayStatus\r\n }, () => {\r\n tabs.length = 0\r\n schema.value?.mapProperties((schema, name) => {\r\n const field = tabsField.value\r\n .query(tabsField.value.address.concat(name))\r\n .take()\r\n if (field?.display === 'none' || field?.display === 'hidden')\r\n return\r\n\r\n if (schema['x-component']?.indexOf('TabPane') > -1) {\r\n tabs.push({\r\n name,\r\n props: {\r\n name: schema?.['x-component-props']?.name || name,\r\n ...schema?.['x-component-props'],\r\n },\r\n schema,\r\n })\r\n }\r\n })\r\n }, {\r\n fireImmediately: true,\r\n })\r\n\r\n return tabs\r\n}\r\n"],"names":["useTabs","tabsField","useField","schema","useFieldSchema","tabs","observable","reaction","name","field"],"mappings":";;AAMO,SAASA,IAAU;AACxB,QAAMC,IAAYC,EAAA,GACZC,IAASC,EAAA,GACTC,IAAaC,EAAW,EAAE;AAChC,SAAAC,EAAS,MACkBJ,EAAO,OAAO,cAAc,CAACA,GAAQK,MAC9CP,EAAU,MACrB,MAAMA,EAAU,MAAM,QAAQ,OAAOO,CAAI,CAAC,EAC1C,KAAA,GACW,OACf,GAEA,MAAM;AACP,IAAAH,EAAK,SAAS,GACdF,EAAO,OAAO,cAAc,CAACA,GAAQK,MAAS;AAC5C,YAAMC,IAAQR,EAAU,MACrB,MAAMA,EAAU,MAAM,QAAQ,OAAOO,CAAI,CAAC,EAC1C,KAAA;AACH,MAAIC,GAAO,YAAY,UAAUA,GAAO,YAAY,YAGhDN,EAAO,aAAa,GAAG,QAAQ,SAAS,IAAI,MAC9CE,EAAK,KAAK;AAAA,QACR,MAAAG;AAAA,QACA,OAAO;AAAA,UACL,MAAML,IAAS,mBAAmB,GAAG,QAAQK;AAAA,UAC7C,GAAGL,IAAS,mBAAmB;AAAA,QAAA;AAAA,QAEjC,QAAAA;AAAAA,MAAA,CACD;AAAA,IAEL,CAAC;AAAA,EACH,GAAG;AAAA,IACD,iBAAiB;AAAA,EAAA,CAClB,GAEME;AACT;"}
@@ -1,13 +1,12 @@
1
1
  import { formilyComputed as V, observer as E } from "@silver-formily/reactive-vue";
2
- import { defineComponent as k, computed as B, ref as K, watch as w, createBlock as s, openBlock as o, unref as r, withCtx as m, createElementBlock as d, Fragment as b, renderList as $, mergeProps as L, normalizeClass as N, createTextVNode as v, toDisplayString as T, createVNode as R } from "vue";
3
- import { ElTabs as q, ElTabPane as z, ElBadge as A } from "element-plus";
4
- import { reaction as D } from "@formily/reactive";
5
- import "@formily/core";
6
- import { useField as I, RecursionField as P } from "@silver-formily/vue";
7
- import { composeExport as S } from "../__builtins__/shared/utils.mjs";
8
- import { stylePrefix as j } from "../__builtins__/configs/index.mjs";
9
- import { useTabs as G } from "./hooks.mjs";
2
+ import { defineComponent as k, computed as B, ref as K, watch as w, createBlock as s, openBlock as o, unref as r, withCtx as m, createElementBlock as p, Fragment as b, renderList as $, mergeProps as L, normalizeClass as N, createTextVNode as v, toDisplayString as T, createVNode as R } from "vue";
3
+ import { reaction as q } from "@formily/reactive";
4
+ import { useField as z, RecursionField as A } from "@silver-formily/vue";
5
+ import { ElTabs as D, ElTabPane as I, ElBadge as P } from "element-plus";
6
+ import { useTabs as S } from "./hooks.mjs";
10
7
  import { createFormTab as y } from "./utils.mjs";
8
+ import { stylePrefix as j } from "../__builtins__/configs/index.mjs";
9
+ import { composeExport as G } from "../__builtins__/shared/utils.mjs";
11
10
  import '../styles/form-tab/index.css';const H = /* @__PURE__ */ k({
12
11
  name: "FFormTab",
13
12
  __name: "form-tab",
@@ -17,8 +16,8 @@ import '../styles/form-tab/index.css';const H = /* @__PURE__ */ k({
17
16
  },
18
17
  emits: ["update:modelValue"],
19
18
  setup(_, { emit: h }) {
20
- const u = _, F = h, i = I(), g = `${j}-form-tab`, l = B(() => u.formTab ?? y()), t = G(), a = K(u?.modelValue ?? l.value.activeKey ?? t?.[0]?.name);
21
- D(() => t.length, () => {
19
+ const u = _, F = h, i = z(), g = `${j}-form-tab`, l = B(() => u.formTab ?? y()), t = S(), a = K(u?.modelValue ?? l.value.activeKey ?? t?.[0]?.name);
20
+ q(() => t.length, () => {
22
21
  !t.some((e) => e.name === a.value) && (a.value = t?.[0]?.name);
23
22
  }, {
24
23
  fireImmediately: !0
@@ -33,30 +32,30 @@ import '../styles/form-tab/index.css';const H = /* @__PURE__ */ k({
33
32
  /* istanbul ignore if -- @preserve */
34
33
  typeof e == "string" && (F("update:modelValue", e), l.value.setActiveKey?.(e));
35
34
  }
36
- return (e, M) => (o(), s(r(q), {
35
+ return (e, M) => (o(), s(r(D), {
37
36
  "model-value": a.value,
38
37
  style: { width: "100%" },
39
38
  onTabChange: x
40
39
  }, {
41
40
  default: m(() => [
42
- (o(!0), d(b, null, $(r(t), ({ props: n, schema: C, name: f }, p) => (o(), s(r(z), L({ key: f }, { ref_for: !0 }, n), {
41
+ (o(!0), p(b, null, $(r(t), ({ props: n, schema: C, name: f }, d) => (o(), s(r(I), L({ key: f }, { ref_for: !0 }, n), {
43
42
  default: m(() => [
44
- R(r(P), {
43
+ R(r(A), {
45
44
  schema: C,
46
45
  name: f
47
46
  }, null, 8, ["schema", "name"])
48
47
  ]),
49
48
  label: m(() => [
50
- r(c)[p] !== 0 ? (o(), s(r(A), {
49
+ r(c)[d] !== 0 ? (o(), s(r(P), {
51
50
  key: 0,
52
51
  class: N(g),
53
- value: r(c)[p]
52
+ value: r(c)[d]
54
53
  }, {
55
54
  default: m(() => [
56
55
  v(T(n.label), 1)
57
56
  ]),
58
57
  _: 2
59
- }, 1032, ["value"])) : (o(), d(b, { key: 1 }, [
58
+ }, 1032, ["value"])) : (o(), p(b, { key: 1 }, [
60
59
  v(T(n.label), 1)
61
60
  ], 64))
62
61
  ]),
@@ -66,12 +65,12 @@ import '../styles/form-tab/index.css';const H = /* @__PURE__ */ k({
66
65
  _: 1
67
66
  }, 8, ["model-value"]));
68
67
  }
69
- }), J = E(H), oe = S(J, {
68
+ }), J = E(H), te = G(J, {
70
69
  createFormTab: y
71
70
  });
72
71
  export {
73
- oe as FormTab,
74
- oe as composeFormTab,
75
- oe as default
72
+ te as FormTab,
73
+ te as composeFormTab,
74
+ te as default
76
75
  };
77
76
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/form-tab/form-tab.vue","../../src/form-tab/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { IFormTabProps } from './types.ts'\nimport { reaction } from '@formily/reactive'\nimport { formilyComputed } from '@silver-formily/reactive-vue'\nimport { RecursionField, useField } from '@silver-formily/vue'\nimport { ElBadge, ElTabPane, ElTabs } from 'element-plus'\nimport { computed, ref, watch } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { useTabs } from './hooks'\nimport { createFormTab } from './utils'\n\ndefineOptions({\n name: 'FFormTab',\n})\n\nconst props = defineProps<IFormTabProps>()\nconst emit = defineEmits(['update:modelValue'])\n\nconst field = useField()\nconst prefixCls = `${stylePrefix}-form-tab`\nconst formTabRef = computed(() => props.formTab ?? createFormTab())\nconst tabs = useTabs()\nconst _activeKey = ref(props?.modelValue ?? formTabRef.value.activeKey ?? tabs?.[0]?.name)\n\nreaction(() => {\n return tabs.length\n}, () => {\n !tabs.some(tab => tab.name === _activeKey.value) && (_activeKey.value = tabs?.[0]?.name)\n}, {\n fireImmediately: true,\n})\nwatch(() => formTabRef.value.activeKey, (val) => {\n _activeKey.value = val\n})\n\nconst errorList = formilyComputed(() => {\n return tabs.map((tab) => {\n return field.value.form.queryFeedbacks({\n type: 'error',\n address: `${field.value.address}.${tab.name}.*`,\n }).length\n })\n})\n\nfunction handleTabChange(key: string) {\n /* istanbul ignore if -- @preserve */\n if (typeof key !== 'string')\n return\n emit('update:modelValue', key)\n formTabRef.value.setActiveKey?.(key)\n}\n</script>\n\n<template>\n <ElTabs\n :model-value=\"_activeKey\"\n style=\"width: 100%;\"\n @tab-change=\"handleTabChange\"\n >\n <ElTabPane\n v-for=\"({ props: tabProps, schema, name }, key) in tabs\"\n :key=\"name\"\n v-bind=\"tabProps\"\n >\n <template #default>\n <RecursionField :schema=\"schema\" :name=\"name\" />\n </template>\n <template #label>\n <ElBadge\n v-if=\"errorList[key] !== 0\"\n :class=\"prefixCls\"\n :value=\"errorList[key]\"\n >\n {{ tabProps.label }}\n </ElBadge>\n <template v-else>\n {{ tabProps.label }}\n </template>\n </template>\n </ElTabPane>\n </ElTabs>\n</template>\n","import { observer } from '@silver-formily/reactive-vue'\nimport { composeExport } from '../__builtins__'\nimport FFormTab from './form-tab.vue'\nimport { createFormTab } from './utils'\nimport './style.scss'\n\nconst FormTab = observer(FFormTab)\n\nexport const composeFormTab = composeExport(FormTab, {\n createFormTab,\n})\n\nexport { composeFormTab as FormTab }\nexport default composeFormTab\n"],"names":["props","__props","emit","__emit","field","useField","prefixCls","stylePrefix","formTabRef","computed","createFormTab","tabs","useTabs","_activeKey","ref","reaction","tab","watch","val","errorList","formilyComputed","handleTabChange","key","_createBlock","_unref","ElTabs","_createElementBlock","_Fragment","_renderList","tabProps","schema","name","_openBlock","_mergeProps","_createVNode","RecursionField","ElBadge","_createTextVNode","_toDisplayString","FormTab","observer","FFormTab","composeFormTab","composeExport"],"mappings":";;;;;;;;;;;;;;;;;;;AAeA,UAAMA,IAAQC,GACRC,IAAOC,GAEPC,IAAQC,EAAA,GACRC,IAAY,GAAGC,CAAW,aAC1BC,IAAaC,EAAS,MAAMT,EAAM,WAAWU,GAAe,GAC5DC,IAAOC,EAAA,GACPC,IAAaC,EAAId,GAAO,cAAcQ,EAAW,MAAM,aAAaG,IAAO,CAAC,GAAG,IAAI;AAEzF,IAAAI,EAAS,MACAJ,EAAK,QACX,MAAM;AACP,OAACA,EAAK,KAAK,CAAAK,MAAOA,EAAI,SAASH,EAAW,KAAK,MAAMA,EAAW,QAAQF,IAAO,CAAC,GAAG;AAAA,IACrF,GAAG;AAAA,MACD,iBAAiB;AAAA,IAAA,CAClB,GACDM,EAAM,MAAMT,EAAW,MAAM,WAAW,CAACU,MAAQ;AA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C,EAASC,CAAQ,GAEpBC,KAAiBC,EAAcJ,GAAS;AAAA,EACnD,eAAA7B;AACF,CAAC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/form-tab/form-tab.vue","../../src/form-tab/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { IFormTabProps } from './types.ts'\r\nimport { reaction } from '@formily/reactive'\r\nimport { formilyComputed } from '@silver-formily/reactive-vue'\r\nimport { RecursionField, useField } from '@silver-formily/vue'\r\nimport { ElBadge, ElTabPane, ElTabs } from 'element-plus'\r\nimport { computed, ref, watch } from 'vue'\r\nimport { stylePrefix } from '../__builtins__'\r\nimport { useTabs } from './hooks'\r\nimport { createFormTab } from './utils'\r\n\r\ndefineOptions({\r\n name: 'FFormTab',\r\n})\r\n\r\nconst props = defineProps<IFormTabProps>()\r\nconst emit = defineEmits(['update:modelValue'])\r\n\r\nconst field = useField()\r\nconst prefixCls = `${stylePrefix}-form-tab`\r\nconst formTabRef = computed(() => props.formTab ?? createFormTab())\r\nconst tabs = useTabs()\r\nconst _activeKey = ref(props?.modelValue ?? formTabRef.value.activeKey ?? tabs?.[0]?.name)\r\n\r\nreaction(() => {\r\n return tabs.length\r\n}, () => {\r\n !tabs.some(tab => tab.name === _activeKey.value) && (_activeKey.value = tabs?.[0]?.name)\r\n}, {\r\n fireImmediately: true,\r\n})\r\nwatch(() => formTabRef.value.activeKey, (val) => {\r\n _activeKey.value = val\r\n})\r\n\r\nconst errorList = formilyComputed(() => {\r\n return tabs.map((tab) => {\r\n return field.value.form.queryFeedbacks({\r\n type: 'error',\r\n address: `${field.value.address}.${tab.name}.*`,\r\n }).length\r\n })\r\n})\r\n\r\nfunction handleTabChange(key: string) {\r\n /* istanbul ignore if -- @preserve */\r\n if (typeof key !== 'string')\r\n return\r\n emit('update:modelValue', key)\r\n formTabRef.value.setActiveKey?.(key)\r\n}\r\n</script>\r\n\r\n<template>\r\n <ElTabs\r\n :model-value=\"_activeKey\"\r\n style=\"width: 100%;\"\r\n @tab-change=\"handleTabChange\"\r\n >\r\n <ElTabPane\r\n v-for=\"({ props: tabProps, schema, name }, key) in tabs\"\r\n :key=\"name\"\r\n v-bind=\"tabProps\"\r\n >\r\n <template #default>\r\n <RecursionField :schema=\"schema\" :name=\"name\" />\r\n </template>\r\n <template #label>\r\n <ElBadge\r\n v-if=\"errorList[key] !== 0\"\r\n :class=\"prefixCls\"\r\n :value=\"errorList[key]\"\r\n >\r\n {{ tabProps.label }}\r\n </ElBadge>\r\n <template v-else>\r\n {{ tabProps.label }}\r\n </template>\r\n </template>\r\n </ElTabPane>\r\n </ElTabs>\r\n</template>\r\n","import { observer } from '@silver-formily/reactive-vue'\r\nimport { composeExport } from '../__builtins__'\r\nimport FFormTab from './form-tab.vue'\r\nimport { createFormTab } from './utils'\r\nimport './style.scss'\r\n\r\nconst FormTab = observer(FFormTab)\r\n\r\nexport const composeFormTab = composeExport(FormTab, {\r\n createFormTab,\r\n})\r\n\r\nexport { composeFormTab as FormTab }\r\nexport default composeFormTab\r\n"],"names":["props","__props","emit","__emit","field","useField","prefixCls","stylePrefix","formTabRef","computed","createFormTab","tabs","useTabs","_activeKey","ref","reaction","tab","watch","val","errorList","formilyComputed","handleTabChange","key","_createBlock","_unref","ElTabs","_createElementBlock","_Fragment","_renderList","tabProps","schema","name","_openBlock","_mergeProps","_createVNode","RecursionField","ElBadge","_createTextVNode","_toDisplayString","FormTab","observer","FFormTab","composeFormTab","composeExport"],"mappings":";;;;;;;;;;;;;;;;;;AAeA,UAAMA,IAAQC,GACRC,IAAOC,GAEPC,IAAQC,EAAA,GACRC,IAAY,GAAGC,CAAW,aAC1BC,IAAaC,EAAS,MAAMT,EAAM,WAAWU,GAAe,GAC5DC,IAAOC,EAAA,GACPC,IAAaC,EAAId,GAAO,cAAcQ,EAAW,MAAM,aAAaG,IAAO,CAAC,GAAG,IAAI;AAEzF,IAAAI,EAAS,MACAJ,EAAK,QACX,MAAM;AACP,OAACA,EAAK,KAAK,CAAAK,MAA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AAC,EAAAT,EAAS,KAAK,GAAA,CAAA;AAAA,cAAA;;yCAEnBH,EAEWC,GAAA,EAAA,KAAA,KAAA;AAAA,cADNU,EAAAC,EAAAT,EAAS,KAAK,GAAA,CAAA;AAAA,YAAA;;;;;;;;ICtErBU,IAAUC,EAASC,CAAQ,GAEpBC,KAAiBC,EAAcJ,GAAS;AAAA,EACnD,eAAA7B;AACF,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../src/form-tab/utils.ts"],"sourcesContent":["import { model } from '@formily/reactive'\n\nexport function createFormTab(defaultActiveKey?: string) {\n const formTab = model({\n activeKey: defaultActiveKey,\n setActiveKey(key: string) {\n formTab.activeKey = key\n },\n })\n return formTab\n}\n"],"names":["createFormTab","defaultActiveKey","formTab","model","key"],"mappings":";AAEO,SAASA,EAAcC,GAA2B;AACvD,QAAMC,IAAUC,EAAM;AAAA,IACpB,WAAWF;AAAA,IACX,aAAaG,GAAa;AACxB,MAAAF,EAAQ,YAAYE;AAAA,IACtB;AAAA,EAAA,CACD;AACD,SAAOF;AACT;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../src/form-tab/utils.ts"],"sourcesContent":["import { model } from '@formily/reactive'\r\n\r\nexport function createFormTab(defaultActiveKey?: string) {\r\n const formTab = model({\r\n activeKey: defaultActiveKey,\r\n setActiveKey(key: string) {\r\n formTab.activeKey = key\r\n },\r\n })\r\n return formTab\r\n}\r\n"],"names":["createFormTab","defaultActiveKey","formTab","model","key"],"mappings":";AAEO,SAASA,EAAcC,GAA2B;AACvD,QAAMC,IAAUC,EAAM;AAAA,IACpB,WAAWF;AAAA,IACX,aAAaG,GAAa;AACxB,MAAAF,EAAQ,YAAYE;AAAA,IACtB;AAAA,EAAA,CACD;AACD,SAAOF;AACT;"}
package/esm/index.d.ts CHANGED
@@ -23,9 +23,12 @@ export * from './input-number';
23
23
  export * from './password';
24
24
  export * from './preview-text';
25
25
  export * from './radio';
26
+ export * from './rate';
26
27
  export * from './reset';
28
+ export * from './segmented';
27
29
  export * from './select';
28
30
  export * from './select-table';
31
+ export * from './slider';
29
32
  export * from './space';
30
33
  export * from './submit';
31
34
  export * from './switch';