@silver-formily/element-plus 2.0.1 → 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 (123) hide show
  1. package/README.en-US.md +32 -0
  2. package/README.md +32 -35
  3. package/esm/__builtins__/index.mjs +15 -16
  4. package/esm/__builtins__/shared/index.mjs +11 -12
  5. package/esm/__builtins__/shared/transform-component.d.ts +2 -6
  6. package/esm/__builtins__/shared/transform-component.mjs +16 -33
  7. package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
  8. package/esm/__builtins__/shared/utils.mjs +10 -10
  9. package/esm/__builtins__/shared/utils.mjs.map +1 -1
  10. package/esm/array-base/index.mjs +58 -58
  11. package/esm/array-base/index.mjs.map +1 -1
  12. package/esm/array-cards/index.mjs +44 -44
  13. package/esm/array-cards/index.mjs.map +1 -1
  14. package/esm/array-collapse/index.mjs +59 -58
  15. package/esm/array-collapse/index.mjs.map +1 -1
  16. package/esm/array-items/index.mjs +46 -43
  17. package/esm/array-items/index.mjs.map +1 -1
  18. package/esm/array-list-tabs/index.mjs +15 -14
  19. package/esm/array-list-tabs/index.mjs.map +1 -1
  20. package/esm/array-table/array-table.d.ts +28 -0
  21. package/esm/array-table/index.d.ts +28 -0
  22. package/esm/array-table/index.mjs +113 -111
  23. package/esm/array-table/index.mjs.map +1 -1
  24. package/esm/array-table/types.d.ts +1 -0
  25. package/esm/cascader/index.mjs +19 -20
  26. package/esm/cascader/index.mjs.map +1 -1
  27. package/esm/checkbox/checkbox-group.d.ts +1 -4
  28. package/esm/checkbox/index.d.ts +442 -379
  29. package/esm/checkbox/index.mjs.map +1 -1
  30. package/esm/editable/editable.d.ts +16 -12
  31. package/esm/editable/index.d.ts +8 -6
  32. package/esm/editable/index.mjs +110 -112
  33. package/esm/editable/index.mjs.map +1 -1
  34. package/esm/form-button-group/index.mjs +29 -28
  35. package/esm/form-button-group/index.mjs.map +1 -1
  36. package/esm/form-collapse/index.mjs +42 -43
  37. package/esm/form-collapse/index.mjs.map +1 -1
  38. package/esm/form-dialog/index.d.ts +1 -1
  39. package/esm/form-dialog/index.mjs +4 -4
  40. package/esm/form-dialog/index.mjs.map +1 -1
  41. package/esm/form-dialog/types.d.ts +6 -6
  42. package/esm/form-drawer/index.d.ts +1 -1
  43. package/esm/form-drawer/index.mjs +4 -4
  44. package/esm/form-drawer/index.mjs.map +1 -1
  45. package/esm/form-drawer/types.d.ts +6 -6
  46. package/esm/form-grid/index.d.ts +1 -183
  47. package/esm/form-grid/index.mjs +1 -1
  48. package/esm/form-grid/index.mjs.map +1 -1
  49. package/esm/form-item/form-item.d.ts +2 -1
  50. package/esm/form-item/index.d.ts +12 -6
  51. package/esm/form-item/index.mjs +163 -155
  52. package/esm/form-item/index.mjs.map +1 -1
  53. package/esm/form-item/types.d.ts +0 -1
  54. package/esm/form-layout/form-layout.d.ts +0 -1
  55. package/esm/form-layout/form-layout.mjs +53 -52
  56. package/esm/form-layout/form-layout.mjs.map +1 -1
  57. package/esm/form-layout/types.d.ts +0 -2
  58. package/esm/form-layout/utils.d.ts +3 -3
  59. package/esm/form-layout/utils.mjs +48 -43
  60. package/esm/form-layout/utils.mjs.map +1 -1
  61. package/esm/form-step/index.mjs +27 -25
  62. package/esm/form-step/index.mjs.map +1 -1
  63. package/esm/form-tab/index.d.ts +1 -26
  64. package/esm/form-tab/index.mjs +30 -30
  65. package/esm/form-tab/index.mjs.map +1 -1
  66. package/esm/index.d.ts +3 -0
  67. package/esm/index.mjs +44 -38
  68. package/esm/index.mjs.map +1 -1
  69. package/esm/input/index.mjs.map +1 -1
  70. package/esm/input-number/index.d.ts +258 -147
  71. package/esm/pagination/pagination.mjs +109 -110
  72. package/esm/pagination/pagination.mjs.map +1 -1
  73. package/esm/password/index.mjs.map +1 -1
  74. package/esm/preview-text/index.d.ts +5 -0
  75. package/esm/preview-text/index.mjs +165 -141
  76. package/esm/preview-text/index.mjs.map +1 -1
  77. package/esm/preview-text/rate.d.ts +5 -0
  78. package/esm/preview-text/utils.d.ts +5 -5
  79. package/esm/preview-text/utils.mjs.map +1 -1
  80. package/esm/radio/index.d.ts +344 -194
  81. package/esm/radio/index.mjs.map +1 -1
  82. package/esm/rate/index.d.ts +187 -0
  83. package/esm/rate/index.mjs +14 -0
  84. package/esm/rate/index.mjs.map +1 -0
  85. package/esm/reset/index.d.ts +1 -62
  86. package/esm/reset/index.mjs +1 -1
  87. package/esm/reset/index.mjs.map +1 -1
  88. package/esm/segmented/index.d.ts +26 -0
  89. package/esm/segmented/index.mjs +37 -0
  90. package/esm/segmented/index.mjs.map +1 -0
  91. package/esm/segmented/segmented.d.ts +25 -0
  92. package/esm/select/index.mjs +8 -8
  93. package/esm/select/index.mjs.map +1 -1
  94. package/esm/select-table/index.d.ts +28 -0
  95. package/esm/select-table/index.mjs +48 -47
  96. package/esm/select-table/index.mjs.map +1 -1
  97. package/esm/select-table/select-table.d.ts +56 -0
  98. package/esm/slider/index.d.ts +177 -0
  99. package/esm/slider/index.mjs +14 -0
  100. package/esm/slider/index.mjs.map +1 -0
  101. package/esm/submit/index.d.ts +1 -47
  102. package/esm/submit/index.mjs +1 -1
  103. package/esm/submit/index.mjs.map +1 -1
  104. package/esm/switch/index.d.ts +225 -189
  105. package/esm/time-select/index.d.ts +163 -103
  106. package/esm/transfer/index.d.ts +196 -115
  107. package/esm/transfer/index.mjs.map +1 -1
  108. package/esm/tree/index.mjs +26 -26
  109. package/esm/tree/index.mjs.map +1 -1
  110. package/esm/tree-select/index.mjs.map +1 -1
  111. package/esm/upload/index.d.ts +404 -399
  112. package/esm/upload/index.mjs.map +1 -1
  113. package/esm/upload/upload.d.ts +800 -790
  114. package/esm/vendor/icon.mjs.map +1 -1
  115. package/esm/vendor/lodash.mjs +12 -20
  116. package/esm/vendor/lodash.mjs.map +1 -1
  117. package/esm/vendor/runtime.mjs +29 -24
  118. package/esm/vendor/runtime.mjs.map +1 -1
  119. package/esm/vendor/shared.esm-bundler.mjs +2 -2
  120. package/esm/vendor/sizes.mjs.map +1 -1
  121. package/esm/vendor/types.mjs +5 -5
  122. package/esm/vendor/types.mjs.map +1 -1
  123. package/package.json +8 -9
@@ -0,0 +1,32 @@
1
+ # Silver Formily Element Plus
2
+
3
+ [![codecov](https://codecov.io/gh/hezhengxu2018/silver-formily-element-plus/graph/badge.svg?token=LZF15NPLJU)](https://codecov.io/gh/hezhengxu2018/silver-formily-element-plus)
4
+
5
+ English | [简体中文](README.md)
6
+
7
+ Formily bindings for Element Plus, focused on consistent UI behavior, flexible configuration, and richer form scenarios.
8
+
9
+ ## Documentation
10
+
11
+ https://element-plus.silver-formily.org/
12
+
13
+ ## Features
14
+
15
+ - 💡 Unified component style
16
+ - 🔌 Flexible dependencies (Formily + Element Plus as peerDependencies)
17
+ - 🔑 Complete form components plus scenario components
18
+ - ♿️ Better accessibility with enhanced FormItem
19
+ - ✅ Comprehensive testing for new components
20
+ - 📝 Vue template syntax based for readability and performance
21
+
22
+ ## Installation
23
+
24
+ ~~~bash
25
+ pnpm add @silver-formily/element-plus
26
+ ~~~
27
+
28
+ This package relies on peer dependencies such as Formily, Element Plus, Vue, and @silver-formily/vue. Refer to the documentation or package.json for compatible versions and setup details.
29
+
30
+ ## License
31
+
32
+ MIT
package/README.md CHANGED
@@ -1,35 +1,32 @@
1
- # Silver Formily Element Plus
2
-
3
- [![codecov](https://codecov.io/gh/hezhengxu2018/silver-formily-element-plus/graph/badge.svg?token=LZF15NPLJU)](https://codecov.io/gh/hezhengxu2018/silver-formily-element-plus)
4
-
5
- Another @formily/element-plus component library.
6
-
7
- ## Features
8
-
9
- ### 💡 Unified Component Style
10
-
11
- The component style leans more towards Element Plus, while the component configuration options lean towards Formily. For conflicting configuration items between the two, we take a balanced approach to ensure flexibility and style consistency.
12
-
13
- ### 🔌 Flexible Dependencies
14
-
15
- Both Formily and Element Plus versions are treated as peerDependencies, allowing you to choose the Element Plus version that best suits your project needs.
16
-
17
- ### 🔑 Complete Form Components
18
-
19
- Complements Element Plus form components while adding additional scenario components to meet various business needs.
20
-
21
- ### ♿️ Better Accessibility
22
-
23
- Enhanced component accessibility. Special focus on FormItem component reconstruction to provide more friendly component access support and visual feedback.
24
-
25
- ### Comprehensive Testing
26
-
27
- All new components come with comprehensive component testing, ensuring component quality and confidence in refactoring.
28
-
29
- ### 📝 Vue Template Syntax Based
30
-
31
- New components are developed using Vue template syntax whenever possible, providing better readability and runtime optimization, making the code more maintainable and performant.
32
-
33
- ## Contributor Guide
34
-
35
- Please review [`AGENTS.md`](AGENTS.md) for repository structure, workflows, and PR expectations before submitting changes.
1
+ # Silver Formily Element Plus
2
+
3
+ [![codecov](https://codecov.io/gh/hezhengxu2018/silver-formily-element-plus/graph/badge.svg?token=LZF15NPLJU)](https://codecov.io/gh/hezhengxu2018/silver-formily-element-plus)
4
+
5
+ 简体中文 | [English](README.en-US.md)
6
+
7
+ 基于 Element Plus 的 Formily 组件库封装,提供一致的组件风格、灵活的配置能力以及更丰富的表单场景。
8
+
9
+ ## 文档
10
+
11
+ https://element-plus.silver-formily.org/
12
+
13
+ ## 特性
14
+
15
+ - 💡 统一的组件风格
16
+ - 🔌 灵活的依赖策略(Formily 与 Element Plus 作为 peerDependencies)
17
+ - 🔑 完整的表单组件与扩展场景组件
18
+ - ♿️ 更好的无障碍支持与 FormItem 体验
19
+ - 新组件具备完善测试保障
20
+ - 📝 基于 Vue 模板语法,易读且性能友好
21
+
22
+ ## 安装
23
+
24
+ ~~~bash
25
+ pnpm add @silver-formily/element-plus
26
+ ~~~
27
+
28
+ 本包依赖 Formily、Element Plus、Vue、@silver-formily/vue 等 peerDependencies。请查看文档或 package.json 获取兼容版本与配置说明。
29
+
30
+ ## 开源协议
31
+
32
+ MIT
@@ -1,24 +1,23 @@
1
1
  import { stylePrefix as r } from "./configs/index.mjs";
2
2
  import { useDebounceFn as n, useResizeObserver as s, useThrottleFn as i } from "./shared/hooks.mjs";
3
- import { loadElConfigProvider as p } from "./shared/load-config-provider.mjs";
4
- import { getTransitionDuration as f, loading as u, useDebonceSubmitting as x } from "./shared/loading.mjs";
5
- import { lt as d, quickVersionCompare as C } from "./shared/simple-version-compare.mjs";
6
- import { mapReadPretty as c, transformComponent as g } from "./shared/transform-component.mjs";
7
- import { composeExport as D, hasSlotContent as E, isVnodeEmpty as P, isVueOptions as V, useCleanAttrs as h } from "./shared/utils.mjs";
3
+ import { loadElConfigProvider as m } from "./shared/load-config-provider.mjs";
4
+ import { getTransitionDuration as a, loading as f, useDebonceSubmitting as x } from "./shared/loading.mjs";
5
+ import { lt as d, quickVersionCompare as b } from "./shared/simple-version-compare.mjs";
6
+ import { mapReadPretty as g } from "./shared/transform-component.mjs";
7
+ import { composeExport as y, hasSlotContent as D, isVnodeEmpty as E, isVueOptions as P, useCleanAttrs as V } from "./shared/utils.mjs";
8
8
  export {
9
- D as composeExport,
10
- f as getTransitionDuration,
11
- E as hasSlotContent,
12
- P as isVnodeEmpty,
13
- V as isVueOptions,
14
- p as loadElConfigProvider,
15
- u as loading,
9
+ y as composeExport,
10
+ a as getTransitionDuration,
11
+ D as hasSlotContent,
12
+ E as isVnodeEmpty,
13
+ P as isVueOptions,
14
+ m as loadElConfigProvider,
15
+ f as loading,
16
16
  d as lt,
17
- c as mapReadPretty,
18
- C as quickVersionCompare,
17
+ g as mapReadPretty,
18
+ b as quickVersionCompare,
19
19
  r as stylePrefix,
20
- g as transformComponent,
21
- h as useCleanAttrs,
20
+ V as useCleanAttrs,
22
21
  x as useDebonceSubmitting,
23
22
  n as useDebounceFn,
24
23
  s as useResizeObserver,
@@ -1,23 +1,22 @@
1
1
  import { useDebounceFn as r, useResizeObserver as t, useThrottleFn as n } from "./hooks.mjs";
2
2
  import { loadElConfigProvider as i } from "./load-config-provider.mjs";
3
- import { getTransitionDuration as p, loading as a, useDebonceSubmitting as u } from "./loading.mjs";
3
+ import { getTransitionDuration as m, loading as u, useDebonceSubmitting as a } from "./loading.mjs";
4
4
  import { lt as l, quickVersionCompare as x } from "./simple-version-compare.mjs";
5
- import { mapReadPretty as C, transformComponent as b } from "./transform-component.mjs";
6
- import { composeExport as g, hasSlotContent as D, isVnodeEmpty as E, isVueOptions as V, useCleanAttrs as h } from "./utils.mjs";
5
+ import { mapReadPretty as b } from "./transform-component.mjs";
6
+ import { composeExport as g, hasSlotContent as C, isVnodeEmpty as D, isVueOptions as E, useCleanAttrs as V } from "./utils.mjs";
7
7
  export {
8
8
  g as composeExport,
9
- p as getTransitionDuration,
10
- D as hasSlotContent,
11
- E as isVnodeEmpty,
12
- V as isVueOptions,
9
+ m as getTransitionDuration,
10
+ C as hasSlotContent,
11
+ D as isVnodeEmpty,
12
+ E as isVueOptions,
13
13
  i as loadElConfigProvider,
14
- a as loading,
14
+ u as loading,
15
15
  l as lt,
16
- C as mapReadPretty,
16
+ b as mapReadPretty,
17
17
  x as quickVersionCompare,
18
- b as transformComponent,
19
- h as useCleanAttrs,
20
- u as useDebonceSubmitting,
18
+ V as useCleanAttrs,
19
+ a as useDebonceSubmitting,
21
20
  r as useDebounceFn,
22
21
  t as useResizeObserver,
23
22
  n as useThrottleFn
@@ -1,7 +1,3 @@
1
+ import { IComponentMapper } from '@silver-formily/vue';
1
2
  import { Component } from 'vue';
2
- type ListenersTransformRules = Record<string, string>;
3
- export declare function transformComponent<T extends Record<string, any>>(tag: any, transformRules?: ListenersTransformRules): Component<T> | any;
4
- export declare function mapReadPretty<T extends Component, C extends Component>(component: C, readPrettyProps?: Record<string, any>): (target: T) => import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
5
- [key: string]: any;
6
- }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
7
- export {};
3
+ export declare function mapReadPretty(component: Component, readPrettyProps?: Record<string, any>): IComponentMapper;
@@ -1,41 +1,25 @@
1
- import { isVoidField as f } from "@formily/core";
2
- import { observer as l } from "@formily/reactive-vue";
3
- import { each as c } from "@formily/shared";
4
- import { useField as C } from "@silver-formily/vue";
5
- import { defineComponent as i, h as s } from "vue";
6
- import { useCleanAttrs as $ } from "./utils.mjs";
7
- function h(t, o) {
8
- const r = t.name.split("El")[1];
9
- return i({
10
- name: `F${r}`,
11
- setup(d, { attrs: a, slots: m }) {
12
- return () => {
13
- const { props: n } = $();
14
- return o && c(o, (p, e) => {
15
- n.value[`on${p[0].toUpperCase()}${p.slice(1)}`] = a[`on${e[0].toUpperCase()}${e.slice(1)}`];
16
- }), s(t, n.value, m);
17
- };
18
- }
19
- });
20
- }
21
- function E(t, o) {
22
- return (r) => l(
23
- i({
1
+ import { isVoidField as i } from "@formily/core";
2
+ import { observer as s } from "@silver-formily/reactive-vue";
3
+ import { useField as f } from "@silver-formily/vue";
4
+ import { defineComponent as u, h as l } from "vue";
5
+ function C(t, o) {
6
+ return (r) => s(
7
+ u({
24
8
  name: r.name ? `Read${r.name}` : "ReadComponent",
25
- setup(d, { attrs: a, slots: m, listeners: n }) {
26
- const p = C();
9
+ setup(R, { attrs: n, slots: a, listeners: m }) {
10
+ const p = f();
27
11
  return () => {
28
- const e = p.value, u = !!e?.data?.readPretty;
29
- return s(
30
- e && !f(e) && (e.pattern === "readPretty" || u) ? t : r,
12
+ const e = p.value, d = !!e?.data?.readPretty;
13
+ return l(
14
+ e && !i(e) && (e.pattern === "readPretty" || d) ? t : r,
31
15
  {
32
16
  attrs: {
33
17
  ...o,
34
- ...a
18
+ ...n
35
19
  },
36
- on: n
20
+ on: m
37
21
  },
38
- m
22
+ a
39
23
  );
40
24
  };
41
25
  }
@@ -43,7 +27,6 @@ function E(t, o) {
43
27
  );
44
28
  }
45
29
  export {
46
- E as mapReadPretty,
47
- h as transformComponent
30
+ C as mapReadPretty
48
31
  };
49
32
  //# sourceMappingURL=transform-component.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform-component.mjs","sources":["../../../src/__builtins__/shared/transform-component.ts"],"sourcesContent":["import type { Component } from 'vue'\r\nimport { isVoidField } from '@formily/core'\r\nimport { observer } from '@formily/reactive-vue'\r\nimport { each } from '@formily/shared'\r\nimport { useField } from '@silver-formily/vue'\r\nimport { defineComponent, h } from 'vue'\r\nimport { useCleanAttrs } from './utils'\r\n\r\ntype ListenersTransformRules = Record<string, string>\r\n\r\nexport function transformComponent<T extends Record<string, any>>(tag: any, transformRules?: ListenersTransformRules): Component<T> | any {\r\n const componentName = tag.name.split('El')[1]\r\n return defineComponent({\r\n name: `F${componentName}`,\r\n setup(props, { attrs, slots }) {\r\n return () => {\r\n const { props: data } = useCleanAttrs()\r\n if (transformRules) {\r\n each(transformRules, (event, extract) => {\r\n data.value[`on${event[0].toUpperCase()}${event.slice(1)}`]\r\n = attrs[`on${extract[0].toUpperCase()}${extract.slice(1)}`]\r\n })\r\n }\r\n return h(tag, data.value, slots)\r\n }\r\n },\r\n })\r\n}\r\n\r\n// fork from https://github.com/alibaba/formily/blob/7c64c671252adf85471ac5aabfddbaf4fc537354/packages/vue/src/shared/connect.ts#L65\r\nexport function mapReadPretty<T extends Component, C extends Component>(\r\n component: C,\r\n readPrettyProps?: Record<string, any>,\r\n) {\r\n return (target: T) => {\r\n return observer(\r\n defineComponent({\r\n name: target.name ? `Read${target.name}` : `ReadComponent`,\r\n setup(props, { attrs, slots, listeners }: Record<string, any>) {\r\n const fieldRef = useField()\r\n return () => {\r\n const field = fieldRef.value\r\n const isEditableReadPretty = !!field?.data?.readPretty\r\n return h(\r\n field && !isVoidField(field) && (field.pattern === 'readPretty' || isEditableReadPretty)\r\n ? component\r\n : target,\r\n {\r\n attrs: {\r\n ...readPrettyProps,\r\n ...attrs,\r\n },\r\n on: listeners,\r\n },\r\n slots,\r\n )\r\n }\r\n },\r\n }),\r\n )\r\n }\r\n}\r\n"],"names":["transformComponent","tag","transformRules","componentName","defineComponent","props","attrs","slots","data","useCleanAttrs","each","event","extract","h","mapReadPretty","component","readPrettyProps","target","observer","listeners","fieldRef","useField","field","isEditableReadPretty","isVoidField"],"mappings":";;;;;;AAUO,SAASA,EAAkDC,GAAUC,GAA8D;AACxI,QAAMC,IAAgBF,EAAI,KAAK,MAAM,IAAI,EAAE,CAAC;AAC5C,SAAOG,EAAgB;AAAA,IACrB,MAAM,IAAID,CAAa;AAAA,IACvB,MAAME,GAAO,EAAE,OAAAC,GAAO,OAAAC,KAAS;AAC7B,aAAO,MAAM;AACX,cAAM,EAAE,OAAOC,EAAA,IAASC,EAAA;AACxB,eAAIP,KACFQ,EAAKR,GAAgB,CAACS,GAAOC,MAAY;AACvC,UAAAJ,EAAK,MAAM,KAAKG,EAAM,CAAC,EAAE,YAAA,CAAa,GAAGA,EAAM,MAAM,CAAC,CAAC,EAAE,IACrDL,EAAM,KAAKM,EAAQ,CAAC,EAAE,aAAa,GAAGA,EAAQ,MAAM,CAAC,CAAC,EAAE;AAAA,QAC9D,CAAC,GAEIC,EAAEZ,GAAKO,EAAK,OAAOD,CAAK;AAAA,MACjC;AAAA,IACF;AAAA,EAAA,CACD;AACH;AAGO,SAASO,EACdC,GACAC,GACA;AACA,SAAO,CAACC,MACCC;AAAA,IACLd,EAAgB;AAAA,MACd,MAAMa,EAAO,OAAO,OAAOA,EAAO,IAAI,KAAK;AAAA,MAC3C,MAAMZ,GAAO,EAAE,OAAAC,GAAO,OAAAC,GAAO,WAAAY,KAAkC;AAC7D,cAAMC,IAAWC,EAAA;AACjB,eAAO,MAAM;AACX,gBAAMC,IAAQF,EAAS,OACjBG,IAAuB,CAAC,CAACD,GAAO,MAAM;AAC5C,iBAAOT;AAAA,YACLS,KAAS,CAACE,EAAYF,CAAK,MAAMA,EAAM,YAAY,gBAAgBC,KAC/DR,IACAE;AAAA,YACJ;AAAA,cACE,OAAO;AAAA,gBACL,GAAGD;AAAA,gBACH,GAAGV;AAAA,cAAA;AAAA,cAEL,IAAIa;AAAA,YAAA;AAAA,YAENZ;AAAA,UAAA;AAAA,QAEJ;AAAA,MACF;AAAA,IAAA,CACD;AAAA,EAAA;AAGP;"}
1
+ {"version":3,"file":"transform-component.mjs","sources":["../../../src/__builtins__/shared/transform-component.ts"],"sourcesContent":["import type { IComponentMapper } from '@silver-formily/vue'\r\nimport type { Component } from 'vue'\r\nimport { isVoidField } from '@formily/core'\r\nimport { observer } from '@silver-formily/reactive-vue'\r\nimport { useField } from '@silver-formily/vue'\r\nimport { defineComponent, h } from 'vue'\r\n\r\n// fork from https://github.com/alibaba/formily/blob/7c64c671252adf85471ac5aabfddbaf4fc537354/packages/vue/src/shared/connect.ts#L65\r\nexport function mapReadPretty(\r\n component: Component,\r\n readPrettyProps?: Record<string, any>,\r\n): IComponentMapper {\r\n const mapper = (target: Component) => {\r\n return observer(\r\n defineComponent({\r\n name: target.name ? `Read${target.name}` : `ReadComponent`,\r\n setup(props, { attrs, slots, listeners }: Record<string, any>) {\r\n const fieldRef = useField()\r\n return () => {\r\n const field = fieldRef.value\r\n const isEditableReadPretty = !!field?.data?.readPretty\r\n return h(\r\n field && !isVoidField(field) && (field.pattern === 'readPretty' || isEditableReadPretty)\r\n ? component\r\n : target,\r\n {\r\n attrs: {\r\n ...readPrettyProps,\r\n ...attrs,\r\n },\r\n on: listeners,\r\n },\r\n slots,\r\n )\r\n }\r\n },\r\n }),\r\n )\r\n }\r\n\r\n return mapper as unknown as IComponentMapper\r\n}\r\n"],"names":["mapReadPretty","component","readPrettyProps","target","observer","defineComponent","props","attrs","slots","listeners","fieldRef","useField","field","isEditableReadPretty","h","isVoidField"],"mappings":";;;;AAQO,SAASA,EACdC,GACAC,GACkB;AA6BlB,SA5Be,CAACC,MACPC;AAAA,IACLC,EAAgB;AAAA,MACd,MAAMF,EAAO,OAAO,OAAOA,EAAO,IAAI,KAAK;AAAA,MAC3C,MAAMG,GAAO,EAAE,OAAAC,GAAO,OAAAC,GAAO,WAAAC,KAAkC;AAC7D,cAAMC,IAAWC,EAAA;AACjB,eAAO,MAAM;AACX,gBAAMC,IAAQF,EAAS,OACjBG,IAAuB,CAAC,CAACD,GAAO,MAAM;AAC5C,iBAAOE;AAAA,YACLF,KAAS,CAACG,EAAYH,CAAK,MAAMA,EAAM,YAAY,gBAAgBC,KAC/DZ,IACAE;AAAA,YACJ;AAAA,cACE,OAAO;AAAA,gBACL,GAAGD;AAAA,gBACH,GAAGK;AAAA,cAAA;AAAA,cAEL,IAAIE;AAAA,YAAA;AAAA,YAEND;AAAA,UAAA;AAAA,QAEJ;AAAA,MACF;AAAA,IAAA,CACD;AAAA,EAAA;AAKP;"}
@@ -1,8 +1,8 @@
1
1
  import { isPlainObj as o } from "@formily/shared";
2
2
  import { useAttrs as i } from "element-plus";
3
- import { computed as a, Fragment as s } from "vue";
3
+ import { computed as a, Comment as s, Text as f, Fragment as c } from "vue";
4
4
  import { o as n } from "../../vendor/lodash.mjs";
5
- function y(t = []) {
5
+ function h(t = []) {
6
6
  const r = i();
7
7
  return {
8
8
  props: a(() => {
@@ -11,24 +11,24 @@ function y(t = []) {
11
11
  })
12
12
  };
13
13
  }
14
- function g(t) {
14
+ function v(t) {
15
15
  return t && (typeof t.template == "string" || typeof t.render == "function");
16
16
  }
17
- function h(t, r) {
17
+ function E(t, r) {
18
18
  return Object.assign(t, r);
19
19
  }
20
20
  /* istanbul ignore next -- @preserve */
21
21
  function u(t) {
22
- return t.every((r) => !!(r.type === Comment || r.type === Text && typeof r.children == "string" && !r.children.trim() || r.type === s && u(r.children)));
22
+ return t.every((r) => !!(r.type === s || r.type === f && typeof r.children == "string" && !r.children.trim() || r.type === c && u(r.children)));
23
23
  }
24
- function v(t) {
24
+ function O(t) {
25
25
  return t ? !u(t()) : !1;
26
26
  }
27
27
  export {
28
- h as composeExport,
29
- v as hasSlotContent,
28
+ E as composeExport,
29
+ O as hasSlotContent,
30
30
  u as isVnodeEmpty,
31
- g as isVueOptions,
32
- y as useCleanAttrs
31
+ v as isVueOptions,
32
+ h as useCleanAttrs
33
33
  };
34
34
  //# sourceMappingURL=utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../../src/__builtins__/shared/utils.ts"],"sourcesContent":["import type { Component, ComputedRef, Slot, VNode } from 'vue'\r\nimport { isPlainObj } from '@formily/shared'\r\nimport { useAttrs } from 'element-plus'\r\nimport { omit } from 'lodash-es'\r\nimport { computed, Fragment } from 'vue'\r\n\r\nexport function useCleanAttrs(removeAttrsList: string[] = []): {\r\n props: ComputedRef<Record<string, any>>\r\n} {\r\n const attrs = useAttrs()\r\n const props = computed(() => {\r\n const DEFAULT_REMOVE_ATTRS = ['value', 'onChange', 'attrs', 'on', 'readOnly']\r\n if (isPlainObj(attrs.value.attrs)) {\r\n return omit({ ...attrs.value, ...attrs.value.attrs }, DEFAULT_REMOVE_ATTRS.concat(removeAttrsList))\r\n }\r\n return omit(attrs.value, DEFAULT_REMOVE_ATTRS.concat(removeAttrsList))\r\n })\r\n return {\r\n props,\r\n }\r\n}\r\n\r\nexport function isVueOptions(options: any): options is Component {\r\n return (\r\n options\r\n && (typeof options.template === 'string'\r\n || typeof options.render === 'function')\r\n )\r\n}\r\n\r\nexport function composeExport<T0 extends object, T1 extends object>(\r\n s0: T0,\r\n s1: T1,\r\n): T0 & T1 {\r\n return Object.assign(s0, s1)\r\n}\r\n\r\n// Adapted from https://github.com/vuejs/vue-next/blob/ca17162e377e0a0bf3fae9d92d0fdcb32084a9fe/packages/runtime-core/src/helpers/renderSlot.ts#L77\r\n/* istanbul ignore next -- @preserve */\r\nexport function isVnodeEmpty(vnodes: Array<VNode>) {\r\n return vnodes.every((node: VNode) => {\r\n if (node.type === Comment) {\r\n return true\r\n }\r\n\r\n if (node.type === Text && typeof node.children === 'string' && !node.children.trim()) {\r\n return true\r\n }\r\n\r\n if (\r\n node.type === Fragment\r\n && isVnodeEmpty(node.children as Array<VNode>)\r\n ) {\r\n return true\r\n }\r\n\r\n return false\r\n })\r\n}\r\n\r\nexport function hasSlotContent(slot: Slot<any> | undefined) {\r\n if (!slot) {\r\n return false\r\n }\r\n return !isVnodeEmpty(slot())\r\n}\r\n"],"names":["useCleanAttrs","removeAttrsList","attrs","useAttrs","computed","DEFAULT_REMOVE_ATTRS","isPlainObj","omit","isVueOptions","options","composeExport","s0","s1","isVnodeEmpty","vnodes","node","Fragment","hasSlotContent","slot"],"mappings":";;;;AAMO,SAASA,EAAcC,IAA4B,IAExD;AACA,QAAMC,IAAQC,EAAA;AAQd,SAAO;AAAA,IACL,OARYC,EAAS,MAAM;AAC3B,YAAMC,IAAuB,CAAC,SAAS,YAAY,SAAS,MAAM,UAAU;AAC5E,aAAIC,EAAWJ,EAAM,MAAM,KAAK,IACvBK,EAAK,EAAE,GAAGL,EAAM,OAAO,GAAGA,EAAM,MAAM,MAAA,GAASG,EAAqB,OAAOJ,CAAe,CAAC,IAE7FM,EAAKL,EAAM,OAAOG,EAAqB,OAAOJ,CAAe,CAAC;AAAA,IACvE,CAAC;AAAA,EAEC;AAEJ;AAEO,SAASO,EAAaC,GAAoC;AAC/D,SACEA,MACI,OAAOA,EAAQ,YAAa,YAC3B,OAAOA,EAAQ,UAAW;AAEnC;AAEO,SAASC,EACdC,GACAC,GACS;AACT,SAAO,OAAO,OAAOD,GAAIC,CAAE;AAC7B;AAGA;AACO,SAASC,EAAaC,GAAsB;AACjD,SAAOA,EAAO,MAAM,CAACC,MACf,GAAAA,EAAK,SAAS,WAIdA,EAAK,SAAS,QAAQ,OAAOA,EAAK,YAAa,YAAY,CAACA,EAAK,SAAS,KAAA,KAK5EA,EAAK,SAASC,KACXH,EAAaE,EAAK,QAAwB,EAMhD;AACH;AAEO,SAASE,EAAeC,GAA6B;AAC1D,SAAKA,IAGE,CAACL,EAAaK,GAAM,IAFlB;AAGX;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../../src/__builtins__/shared/utils.ts"],"sourcesContent":["import type { Component, ComputedRef, Slot, VNode } from 'vue'\r\nimport { isPlainObj } from '@formily/shared'\r\nimport { useAttrs } from 'element-plus'\r\nimport { omit } from 'lodash-es'\r\nimport { Comment, computed, Fragment, Text } from 'vue'\r\n\r\nexport function useCleanAttrs(removeAttrsList: string[] = []): {\r\n props: ComputedRef<Record<string, any>>\r\n} {\r\n const attrs = useAttrs()\r\n const props = computed(() => {\r\n const DEFAULT_REMOVE_ATTRS = ['value', 'onChange', 'attrs', 'on', 'readOnly']\r\n if (isPlainObj(attrs.value.attrs)) {\r\n return omit({ ...attrs.value, ...attrs.value.attrs }, DEFAULT_REMOVE_ATTRS.concat(removeAttrsList))\r\n }\r\n return omit(attrs.value, DEFAULT_REMOVE_ATTRS.concat(removeAttrsList))\r\n })\r\n return {\r\n props,\r\n }\r\n}\r\n\r\nexport function isVueOptions(options: any): options is Component {\r\n return (\r\n options\r\n && (typeof options.template === 'string'\r\n || typeof options.render === 'function')\r\n )\r\n}\r\n\r\nexport function composeExport<T0 extends object, T1 extends object>(\r\n s0: T0,\r\n s1: T1,\r\n): T0 & T1 {\r\n return Object.assign(s0, s1)\r\n}\r\n\r\n// Adapted from https://github.com/vuejs/vue-next/blob/ca17162e377e0a0bf3fae9d92d0fdcb32084a9fe/packages/runtime-core/src/helpers/renderSlot.ts#L77\r\n/* istanbul ignore next -- @preserve */\r\nexport function isVnodeEmpty(vnodes: Array<VNode>) {\r\n return vnodes.every((node: VNode) => {\r\n if (node.type === Comment) {\r\n return true\r\n }\r\n\r\n if (node.type === Text && typeof node.children === 'string' && !node.children.trim()) {\r\n return true\r\n }\r\n\r\n if (\r\n node.type === Fragment\r\n && isVnodeEmpty(node.children as Array<VNode>)\r\n ) {\r\n return true\r\n }\r\n\r\n return false\r\n })\r\n}\r\n\r\nexport function hasSlotContent(slot: Slot<any> | undefined) {\r\n if (!slot) {\r\n return false\r\n }\r\n return !isVnodeEmpty(slot())\r\n}\r\n"],"names":["useCleanAttrs","removeAttrsList","attrs","useAttrs","computed","DEFAULT_REMOVE_ATTRS","isPlainObj","omit","isVueOptions","options","composeExport","s0","s1","isVnodeEmpty","vnodes","node","Comment","Text","Fragment","hasSlotContent","slot"],"mappings":";;;;AAMO,SAASA,EAAcC,IAA4B,IAExD;AACA,QAAMC,IAAQC,EAAA;AAQd,SAAO;AAAA,IACL,OARYC,EAAS,MAAM;AAC3B,YAAMC,IAAuB,CAAC,SAAS,YAAY,SAAS,MAAM,UAAU;AAC5E,aAAIC,EAAWJ,EAAM,MAAM,KAAK,IACvBK,EAAK,EAAE,GAAGL,EAAM,OAAO,GAAGA,EAAM,MAAM,MAAA,GAASG,EAAqB,OAAOJ,CAAe,CAAC,IAE7FM,EAAKL,EAAM,OAAOG,EAAqB,OAAOJ,CAAe,CAAC;AAAA,IACvE,CAAC;AAAA,EAEC;AAEJ;AAEO,SAASO,EAAaC,GAAoC;AAC/D,SACEA,MACI,OAAOA,EAAQ,YAAa,YAC3B,OAAOA,EAAQ,UAAW;AAEnC;AAEO,SAASC,EACdC,GACAC,GACS;AACT,SAAO,OAAO,OAAOD,GAAIC,CAAE;AAC7B;AAGA;AACO,SAASC,EAAaC,GAAsB;AACjD,SAAOA,EAAO,MAAM,CAACC,MACf,GAAAA,EAAK,SAASC,KAIdD,EAAK,SAASE,KAAQ,OAAOF,EAAK,YAAa,YAAY,CAACA,EAAK,SAAS,KAAA,KAK5EA,EAAK,SAASG,KACXL,EAAaE,EAAK,QAAwB,EAMhD;AACH;AAEO,SAASI,EAAeC,GAA6B;AAC1D,SAAKA,IAGE,CAACP,EAAaO,GAAM,IAFlB;AAGX;"}
@@ -1,4 +1,4 @@
1
- import { defineComponent as o, createBlock as m, createCommentVNode as f, unref as a, openBlock as i, normalizeClass as u, withCtx as h, createTextVNode as _, toDisplayString as v, createElementBlock as C, renderSlot as c, provide as M, useAttrs as w, withModifiers as $ } from "vue";
1
+ import { defineComponent as o, createBlock as m, createCommentVNode as f, unref as a, openBlock as i, normalizeClass as c, withCtx as h, createTextVNode as _, toDisplayString as v, createElementBlock as C, renderSlot as u, provide as M, useAttrs as w, withModifiers as $ } from "vue";
2
2
  import { Plus as D, ArrowDown as I, ArrowUp as R, Delete as S, Rank as U } from "@element-plus/icons-vue";
3
3
  import { useField as B, useFieldSchema as V } from "@silver-formily/vue";
4
4
  import { ElLink as y } from "element-plus";
@@ -11,26 +11,26 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
11
11
  __name: "array-base-addition",
12
12
  props: {
13
13
  method: { default: "push" },
14
- defaultValue: null,
15
- title: null
14
+ defaultValue: {},
15
+ title: {}
16
16
  },
17
- setup(l) {
18
- const n = l, t = B(), e = p();
19
- function s() {
20
- const r = z(n.defaultValue, e?.schema.value);
21
- n.method === "unshift" ? (e?.field?.value.unshift(r), e.attrs?.add?.(0)) : (e?.field?.value.push(r), e.attrs?.add?.(e?.field?.value?.value?.length - 1));
17
+ setup(n) {
18
+ const r = n, t = B(), e = p();
19
+ function l() {
20
+ const s = z(r.defaultValue, e?.schema.value);
21
+ r.method === "unshift" ? (e?.field?.value.unshift(s), e.attrs?.add?.(0)) : (e?.field?.value.push(s), e.attrs?.add?.(e?.field?.value?.value?.length - 1));
22
22
  }
23
- return (r, A) => a(e).field.value.pattern === "editable" ? (i(), m(a(y), {
23
+ return (s, A) => a(e).field.value.pattern === "editable" ? (i(), m(a(y), {
24
24
  key: 0,
25
- class: u(`${a(d)}-addition`),
25
+ class: c(`${a(d)}-addition`),
26
26
  icon: a(D),
27
27
  underline: a(b)(),
28
28
  role: "button",
29
29
  "aria-label": "添加条目",
30
- onClick: s
30
+ onClick: l
31
31
  }, {
32
32
  default: h(() => [
33
- _(v(a(t).title || n.title), 1)
33
+ _(v(a(t).title || r.title), 1)
34
34
  ]),
35
35
  _: 1
36
36
  }, 8, ["class", "icon", "underline"])) : f("", !0);
@@ -38,13 +38,13 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
38
38
  }), K = /* @__PURE__ */ o({
39
39
  name: "ArrayBaseIndex",
40
40
  __name: "array-base-index",
41
- setup(l) {
42
- const n = k();
41
+ setup(n) {
42
+ const r = k();
43
43
  return (t, e) => (i(), C("span", {
44
- class: u(`${a(d)}-index`)
44
+ class: c(`${a(d)}-index`)
45
45
  }, [
46
- c(t.$slots, "default", { index: a(n) }, () => [
47
- _(" #" + v(a(n) + 1) + ". ", 1)
46
+ u(t.$slots, "default", { index: a(r) }, () => [
47
+ _(" #" + v(a(r) + 1) + ". ", 1)
48
48
  ])
49
49
  ], 2));
50
50
  }
@@ -54,56 +54,56 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
54
54
  __name: "array-base-inner",
55
55
  props: {
56
56
  disabled: { type: Boolean },
57
- keyMap: null
57
+ keyMap: {}
58
58
  },
59
- setup(l) {
60
- const n = l, t = B(), e = V();
59
+ setup(n) {
60
+ const r = n, t = B(), e = V();
61
61
  return M(F, {
62
62
  field: t,
63
63
  schema: e,
64
- props: n,
64
+ props: r,
65
65
  attrs: w(),
66
- keyMap: n.keyMap
67
- }), (s, r) => c(s.$slots, "default");
66
+ keyMap: r.keyMap
67
+ }), (l, s) => u(l.$slots, "default");
68
68
  }
69
69
  }), T = /* @__PURE__ */ o({
70
70
  name: "ArrayBaseItem",
71
71
  __name: "array-base-item",
72
72
  props: {
73
- index: null,
74
- record: null
73
+ index: {},
74
+ record: {}
75
75
  },
76
- setup(l) {
77
- return M(H, l), (t, e) => c(t.$slots, "default");
76
+ setup(n) {
77
+ return M(H, n), (t, e) => u(t.$slots, "default");
78
78
  }
79
79
  }), j = /* @__PURE__ */ o({
80
80
  name: "ArrayBaseMoveDown",
81
81
  __name: "array-base-move-down",
82
82
  props: {
83
- title: null
83
+ title: {}
84
84
  },
85
- setup(l) {
86
- const n = l, t = k(), e = p();
87
- function s() {
85
+ setup(n) {
86
+ const r = n, t = k(), e = p();
87
+ function l() {
88
88
  x(e?.keyMap) && e.keyMap.splice(
89
89
  t.value + 1,
90
90
  0,
91
91
  e.keyMap.splice(t.value, 1)[0]
92
92
  ), e?.field.value.moveDown(t.value), e?.attrs?.moveDown?.(t.value);
93
93
  }
94
- return (r, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
94
+ return (s, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
95
95
  key: 0,
96
- class: u(`${a(d)}-move-down`),
96
+ class: c(`${a(d)}-move-down`),
97
97
  size: "small",
98
98
  icon: a(I),
99
99
  underline: a(b)(),
100
100
  role: "button",
101
101
  "aria-label": "下移条目",
102
- onClick: $(s, ["stop"])
102
+ onClick: $(l, ["stop"])
103
103
  }, {
104
104
  default: h(() => [
105
- c(r.$slots, "default", {}, () => [
106
- _(v(n.title), 1)
105
+ u(s.$slots, "default", {}, () => [
106
+ _(v(r.title), 1)
107
107
  ])
108
108
  ]),
109
109
  _: 3
@@ -113,30 +113,30 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
113
113
  name: "ArrayBaseMoveUp",
114
114
  __name: "array-base-move-up",
115
115
  props: {
116
- title: null
116
+ title: {}
117
117
  },
118
- setup(l) {
119
- const n = l, t = k(), e = p();
120
- function s() {
118
+ setup(n) {
119
+ const r = n, t = k(), e = p();
120
+ function l() {
121
121
  x(e?.keyMap) && e.keyMap.splice(
122
122
  t.value - 1,
123
123
  0,
124
124
  e.keyMap.splice(t.value, 1)[0]
125
125
  ), e?.field.value.moveUp(t.value), e?.attrs?.moveUp?.(t.value);
126
126
  }
127
- return (r, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
127
+ return (s, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
128
128
  key: 0,
129
- class: u(`${a(d)}-move-up`),
129
+ class: c(`${a(d)}-move-up`),
130
130
  size: "small",
131
131
  icon: a(R),
132
132
  underline: a(b)(),
133
133
  role: "button",
134
134
  "aria-label": "上移条目",
135
- onClick: $(s, ["stop"])
135
+ onClick: $(l, ["stop"])
136
136
  }, {
137
137
  default: h(() => [
138
- c(r.$slots, "default", {}, () => [
139
- _(v(n.title), 1)
138
+ u(s.$slots, "default", {}, () => [
139
+ _(v(r.title), 1)
140
140
  ])
141
141
  ]),
142
142
  _: 3
@@ -146,26 +146,26 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
146
146
  name: "ArrayBaseRemove",
147
147
  __name: "array-base-remove",
148
148
  props: {
149
- title: null
149
+ title: {}
150
150
  },
151
- setup(l) {
152
- const n = l, t = k(), e = p();
153
- function s() {
151
+ setup(n) {
152
+ const r = n, t = k(), e = p();
153
+ function l() {
154
154
  x(e?.keyMap) && e?.keyMap?.splice(t.value, 1), e?.field.value.remove(t.value), e?.attrs?.remove?.(t.value);
155
155
  }
156
- return (r, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
156
+ return (s, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
157
157
  key: 0,
158
- class: u(`${a(d)}-remove`),
158
+ class: c(`${a(d)}-remove`),
159
159
  size: "small",
160
160
  icon: a(S),
161
161
  underline: a(b)(),
162
162
  role: "button",
163
163
  "aria-label": "移除条目",
164
- onClick: $(s, ["stop"])
164
+ onClick: $(l, ["stop"])
165
165
  }, {
166
166
  default: h(() => [
167
- c(r.$slots, "default", {}, () => [
168
- _(v(n.title), 1)
167
+ u(s.$slots, "default", {}, () => [
168
+ _(v(r.title), 1)
169
169
  ])
170
170
  ]),
171
171
  _: 3
@@ -174,11 +174,11 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
174
174
  }), J = /* @__PURE__ */ o({
175
175
  name: "ArrayBaseSortHandle",
176
176
  __name: "array-base-sort-handle",
177
- setup(l) {
178
- const n = p();
179
- return (t, e) => a(n).field.value?.pattern === "editable" ? (i(), m(a(y), {
177
+ setup(n) {
178
+ const r = p();
179
+ return (t, e) => a(r).field.value?.pattern === "editable" ? (i(), m(a(y), {
180
180
  key: 0,
181
- class: u(`${a(d)}-sort-handle`),
181
+ class: c(`${a(d)}-sort-handle`),
182
182
  size: "small",
183
183
  icon: a(U),
184
184
  underline: a(b)(),