@silver-formily/element-plus 2.0.1 → 2.1.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 (154) hide show
  1. package/LICENSE +21 -21
  2. package/README.en-US.md +32 -0
  3. package/README.md +32 -35
  4. package/esm/__builtins__/configs/index.mjs.map +1 -1
  5. package/esm/__builtins__/index.mjs +15 -16
  6. package/esm/__builtins__/shared/hooks.mjs.map +1 -1
  7. package/esm/__builtins__/shared/index.mjs +11 -12
  8. package/esm/__builtins__/shared/loading.mjs.map +1 -1
  9. package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -1
  10. package/esm/__builtins__/shared/transform-component.d.ts +2 -6
  11. package/esm/__builtins__/shared/transform-component.mjs +16 -33
  12. package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
  13. package/esm/__builtins__/shared/utils.mjs +10 -10
  14. package/esm/__builtins__/shared/utils.mjs.map +1 -1
  15. package/esm/array-base/index.mjs +76 -73
  16. package/esm/array-base/index.mjs.map +1 -1
  17. package/esm/array-base/symbols.mjs.map +1 -1
  18. package/esm/array-base/utils.mjs +33 -29
  19. package/esm/array-base/utils.mjs.map +1 -1
  20. package/esm/array-cards/index.mjs +56 -54
  21. package/esm/array-cards/index.mjs.map +1 -1
  22. package/esm/array-collapse/index.mjs +64 -62
  23. package/esm/array-collapse/index.mjs.map +1 -1
  24. package/esm/array-collapse/utils.mjs +8 -2
  25. package/esm/array-collapse/utils.mjs.map +1 -1
  26. package/esm/array-items/index.mjs +53 -47
  27. package/esm/array-items/index.mjs.map +1 -1
  28. package/esm/array-list-tabs/index.mjs +36 -34
  29. package/esm/array-list-tabs/index.mjs.map +1 -1
  30. package/esm/array-list-tabs/utils.mjs +11 -5
  31. package/esm/array-list-tabs/utils.mjs.map +1 -1
  32. package/esm/array-table/array-table.d.ts +28 -0
  33. package/esm/array-table/index.d.ts +28 -0
  34. package/esm/array-table/index.mjs +126 -123
  35. package/esm/array-table/index.mjs.map +1 -1
  36. package/esm/array-table/types.d.ts +1 -0
  37. package/esm/array-table/utils.mjs +18 -12
  38. package/esm/array-table/utils.mjs.map +1 -1
  39. package/esm/array-tabs/index.mjs +19 -17
  40. package/esm/array-tabs/index.mjs.map +1 -1
  41. package/esm/cascader/index.mjs +26 -24
  42. package/esm/cascader/index.mjs.map +1 -1
  43. package/esm/checkbox/checkbox-group.d.ts +1 -4
  44. package/esm/checkbox/index.d.ts +442 -379
  45. package/esm/checkbox/index.mjs +19 -16
  46. package/esm/checkbox/index.mjs.map +1 -1
  47. package/esm/date-picker/index.mjs +14 -12
  48. package/esm/date-picker/index.mjs.map +1 -1
  49. package/esm/editable/editable.d.ts +16 -12
  50. package/esm/editable/index.d.ts +8 -6
  51. package/esm/editable/index.mjs +113 -113
  52. package/esm/editable/index.mjs.map +1 -1
  53. package/esm/form/form.mjs +6 -6
  54. package/esm/form/form.mjs.map +1 -1
  55. package/esm/form-button-group/index.mjs +33 -29
  56. package/esm/form-button-group/index.mjs.map +1 -1
  57. package/esm/form-button-group/utils.mjs +8 -2
  58. package/esm/form-button-group/utils.mjs.map +1 -1
  59. package/esm/form-collapse/index.mjs +43 -42
  60. package/esm/form-collapse/index.mjs.map +1 -1
  61. package/esm/form-collapse/utils.mjs.map +1 -1
  62. package/esm/form-dialog/index.d.ts +1 -1
  63. package/esm/form-dialog/index.mjs +22 -22
  64. package/esm/form-dialog/index.mjs.map +1 -1
  65. package/esm/form-dialog/types.d.ts +6 -6
  66. package/esm/form-drawer/index.d.ts +1 -1
  67. package/esm/form-drawer/index.mjs +21 -21
  68. package/esm/form-drawer/index.mjs.map +1 -1
  69. package/esm/form-drawer/types.d.ts +6 -6
  70. package/esm/form-grid/hooks.mjs.map +1 -1
  71. package/esm/form-grid/index.d.ts +1 -183
  72. package/esm/form-grid/index.mjs +23 -20
  73. package/esm/form-grid/index.mjs.map +1 -1
  74. package/esm/form-item/form-item.d.ts +2 -1
  75. package/esm/form-item/index.d.ts +12 -6
  76. package/esm/form-item/index.mjs +157 -151
  77. package/esm/form-item/index.mjs.map +1 -1
  78. package/esm/form-item/types.d.ts +0 -1
  79. package/esm/form-item/utils.mjs.map +1 -1
  80. package/esm/form-layout/form-layout.d.ts +0 -1
  81. package/esm/form-layout/form-layout.mjs +56 -51
  82. package/esm/form-layout/form-layout.mjs.map +1 -1
  83. package/esm/form-layout/types.d.ts +0 -2
  84. package/esm/form-layout/utils.d.ts +3 -3
  85. package/esm/form-layout/utils.mjs +55 -45
  86. package/esm/form-layout/utils.mjs.map +1 -1
  87. package/esm/form-step/index.mjs +38 -34
  88. package/esm/form-step/index.mjs.map +1 -1
  89. package/esm/form-step/utils.mjs.map +1 -1
  90. package/esm/form-tab/hooks.mjs.map +1 -1
  91. package/esm/form-tab/index.d.ts +1 -26
  92. package/esm/form-tab/index.mjs +36 -35
  93. package/esm/form-tab/index.mjs.map +1 -1
  94. package/esm/form-tab/utils.mjs.map +1 -1
  95. package/esm/index.mjs +58 -58
  96. package/esm/input/index.mjs +23 -20
  97. package/esm/input/index.mjs.map +1 -1
  98. package/esm/input-number/index.d.ts +258 -147
  99. package/esm/input-number/index.mjs +9 -7
  100. package/esm/input-number/index.mjs.map +1 -1
  101. package/esm/pagination/components/jumper.mjs.map +1 -1
  102. package/esm/pagination/components/next.mjs.map +1 -1
  103. package/esm/pagination/components/pager.mjs.map +1 -1
  104. package/esm/pagination/components/prev.mjs.map +1 -1
  105. package/esm/pagination/components/total.mjs.map +1 -1
  106. package/esm/pagination/pagination.mjs +109 -110
  107. package/esm/pagination/pagination.mjs.map +1 -1
  108. package/esm/password/index.mjs.map +1 -1
  109. package/esm/preview-text/index.mjs +35 -32
  110. package/esm/preview-text/index.mjs.map +1 -1
  111. package/esm/preview-text/utils.mjs.map +1 -1
  112. package/esm/radio/index.d.ts +344 -194
  113. package/esm/radio/index.mjs +28 -25
  114. package/esm/radio/index.mjs.map +1 -1
  115. package/esm/reset/index.d.ts +1 -62
  116. package/esm/reset/index.mjs +1 -1
  117. package/esm/reset/index.mjs.map +1 -1
  118. package/esm/select/index.mjs +23 -20
  119. package/esm/select/index.mjs.map +1 -1
  120. package/esm/select-table/index.d.ts +28 -0
  121. package/esm/select-table/index.mjs +59 -55
  122. package/esm/select-table/index.mjs.map +1 -1
  123. package/esm/select-table/select-table.d.ts +56 -0
  124. package/esm/submit/index.d.ts +1 -47
  125. package/esm/submit/index.mjs +1 -1
  126. package/esm/submit/index.mjs.map +1 -1
  127. package/esm/switch/index.d.ts +225 -189
  128. package/esm/switch/index.mjs.map +1 -1
  129. package/esm/time-picker/index.mjs +8 -6
  130. package/esm/time-picker/index.mjs.map +1 -1
  131. package/esm/time-select/index.d.ts +163 -103
  132. package/esm/time-select/index.mjs +8 -6
  133. package/esm/time-select/index.mjs.map +1 -1
  134. package/esm/transfer/index.d.ts +196 -115
  135. package/esm/transfer/index.mjs.map +1 -1
  136. package/esm/tree/index.mjs +43 -40
  137. package/esm/tree/index.mjs.map +1 -1
  138. package/esm/tree/utils.mjs.map +1 -1
  139. package/esm/tree-select/index.mjs +20 -17
  140. package/esm/tree-select/index.mjs.map +1 -1
  141. package/esm/upload/index.d.ts +404 -399
  142. package/esm/upload/index.mjs +9 -7
  143. package/esm/upload/index.mjs.map +1 -1
  144. package/esm/upload/upload.d.ts +800 -790
  145. package/esm/vendor/icon.mjs.map +1 -1
  146. package/esm/vendor/lodash.mjs +12 -20
  147. package/esm/vendor/lodash.mjs.map +1 -1
  148. package/esm/vendor/runtime.mjs +29 -24
  149. package/esm/vendor/runtime.mjs.map +1 -1
  150. package/esm/vendor/shared.esm-bundler.mjs +2 -2
  151. package/esm/vendor/sizes.mjs.map +1 -1
  152. package/esm/vendor/types.mjs +5 -5
  153. package/esm/vendor/types.mjs.map +1 -1
  154. package/package.json +113 -114
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 hezhengxu2018
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 hezhengxu2018
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -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 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/__builtins__/configs/index.ts"],"sourcesContent":["export const stylePrefix = 'formily-element-plus'\r\n"],"names":["stylePrefix"],"mappings":"AAAO,MAAMA,IAAc;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/__builtins__/configs/index.ts"],"sourcesContent":["export const stylePrefix = 'formily-element-plus'\n"],"names":["stylePrefix"],"mappings":"AAAO,MAAMA,IAAc;"}
@@ -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 +1 @@
1
- {"version":3,"file":"hooks.mjs","sources":["../../../src/__builtins__/shared/hooks.ts"],"sourcesContent":["import type { Ref } from 'vue'\r\nimport { onUnmounted, watch } from 'vue'\r\n\r\nexport function useDebounceFn<T extends (...args: any[]) => any>(\r\n fn: T,\r\n delay: number | (() => number),\r\n): T {\r\n let timeoutId: ReturnType<typeof setTimeout> | null = null\r\n\r\n return ((...args: Parameters<T>) => {\r\n if (timeoutId !== null) {\r\n clearTimeout(timeoutId)\r\n }\r\n\r\n const delayMs = typeof delay === 'function' ? delay() : delay\r\n\r\n timeoutId = setTimeout(() => {\r\n fn(...args)\r\n timeoutId = null\r\n }, delayMs)\r\n }) as T\r\n}\r\n\r\nexport function useThrottleFn<T extends (...args: any[]) => any>(\r\n fn: T,\r\n delay: number,\r\n trailing = true,\r\n leading = true,\r\n): T {\r\n let timeoutId: ReturnType<typeof setTimeout> | null = null\r\n let lastCallTime = 0\r\n let lastArgs: Parameters<T> | null = null\r\n\r\n return ((...args: Parameters<T>) => {\r\n const now = Date.now()\r\n if (lastCallTime === 0 && leading) {\r\n lastCallTime = now\r\n fn(...args)\r\n return\r\n }\r\n if (lastCallTime === 0 && !leading) {\r\n lastCallTime = now\r\n }\r\n\r\n const remainingTime = delay - (now - lastCallTime)\r\n\r\n lastArgs = args\r\n\r\n if (timeoutId !== null) {\r\n clearTimeout(timeoutId)\r\n }\r\n\r\n if (remainingTime <= 0 && lastCallTime !== now) {\r\n lastCallTime = now\r\n fn(...args)\r\n lastArgs = null\r\n }\r\n else if (trailing) {\r\n timeoutId = setTimeout(() => {\r\n lastCallTime = Date.now()\r\n if (lastArgs !== null) {\r\n fn(...lastArgs)\r\n lastArgs = null\r\n }\r\n timeoutId = null\r\n }, remainingTime)\r\n }\r\n }) as T\r\n}\r\n\r\nexport function useResizeObserver(\r\n target: Ref<Element | null> | Element | null,\r\n callback: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void,\r\n options?: ResizeObserverOptions,\r\n): {\r\n isSupported: boolean\r\n stop: () => void\r\n} {\r\n let observer: ResizeObserver | null = null\r\n const isSupported = globalThis.window !== undefined && 'ResizeObserver' in globalThis\r\n\r\n const cleanup = () => {\r\n if (observer) {\r\n observer.disconnect()\r\n observer = null\r\n }\r\n }\r\n\r\n const stop = () => {\r\n cleanup()\r\n }\r\n\r\n const start = () => {\r\n cleanup()\r\n\r\n /* istanbul ignore if @preserve */\r\n if (!isSupported) {\r\n return\r\n }\r\n\r\n const element = (target && 'value' in target ? target.value : target) as Element\r\n\r\n if (!element) {\r\n return\r\n }\r\n\r\n observer = new ResizeObserver(callback)\r\n observer.observe(element, options)\r\n }\r\n\r\n if (target && 'value' in target) {\r\n watch(\r\n target,\r\n () => {\r\n start()\r\n },\r\n { immediate: true, flush: 'post' },\r\n )\r\n }\r\n else {\r\n start()\r\n }\r\n onUnmounted(() => {\r\n cleanup()\r\n })\r\n\r\n return {\r\n isSupported,\r\n stop,\r\n }\r\n}\r\n"],"names":["useDebounceFn","fn","delay","timeoutId","args","delayMs","useThrottleFn","trailing","leading","lastCallTime","lastArgs","now","remainingTime","useResizeObserver","target","callback","options","observer","isSupported","cleanup","stop","start","element","watch","onUnmounted"],"mappings":";AAGO,SAASA,EACdC,GACAC,GACG;AACH,MAAIC,IAAkD;AAEtD,UAAQ,IAAIC,MAAwB;AAClC,IAAID,MAAc,QAChB,aAAaA,CAAS;AAGxB,UAAME,IAAU,OAAOH,KAAU,aAAaA,MAAUA;AAExD,IAAAC,IAAY,WAAW,MAAM;AAC3B,MAAAF,EAAG,GAAGG,CAAI,GACVD,IAAY;AAAA,IACd,GAAGE,CAAO;AAAA,EACZ;AACF;AAEO,SAASC,EACdL,GACAC,GACAK,IAAW,IACXC,IAAU,IACP;AACH,MAAIL,IAAkD,MAClDM,IAAe,GACfC,IAAiC;AAErC,UAAQ,IAAIN,MAAwB;AAClC,UAAMO,IAAM,KAAK,IAAA;AACjB,QAAIF,MAAiB,KAAKD,GAAS;AACjC,MAAAC,IAAeE,GACfV,EAAG,GAAGG,CAAI;AACV;AAAA,IACF;AACA,IAAIK,MAAiB,KAAK,CAACD,MACzBC,IAAeE;AAGjB,UAAMC,IAAgBV,KAASS,IAAMF;AAErC,IAAAC,IAAWN,GAEPD,MAAc,QAChB,aAAaA,CAAS,GAGpBS,KAAiB,KAAKH,MAAiBE,KACzCF,IAAeE,GACfV,EAAG,GAAGG,CAAI,GACVM,IAAW,QAEJH,MACPJ,IAAY,WAAW,MAAM;AAC3B,MAAAM,IAAe,KAAK,IAAA,GAChBC,MAAa,SACfT,EAAG,GAAGS,CAAQ,GACdA,IAAW,OAEbP,IAAY;AAAA,IACd,GAAGS,CAAa;AAAA,EAEpB;AACF;AAEO,SAASC,EACdC,GACAC,GACAC,GAIA;AACA,MAAIC,IAAkC;AACtC,QAAMC,IAAc,WAAW,WAAW,UAAa,oBAAoB,YAErEC,IAAU,MAAM;AACpB,IAAIF,MACFA,EAAS,WAAA,GACTA,IAAW;AAAA,EAEf,GAEMG,IAAO,MAAM;AACjB,IAAAD,EAAA;AAAA,EACF,GAEME,IAAQ,MAAM;AAClB,IAAAF,EAAA;AAAA,IAAQ;AAGR,QAAI,CAACD;AACH;AAGF,UAAMI,IAAWR,KAAU,WAAWA,IAASA,EAAO,QAAQA;AAE9D,IAAKQ,MAILL,IAAW,IAAI,eAAeF,CAAQ,GACtCE,EAAS,QAAQK,GAASN,CAAO;AAAA,EACnC;AAEA,SAAIF,KAAU,WAAWA,IACvBS;AAAA,IACET;AAAA,IACA,MAAM;AACJ,MAAAO,EAAA;AAAA,IACF;AAAA,IACA,EAAE,WAAW,IAAM,OAAO,OAAA;AAAA,EAAO,IAInCA,EAAA,GAEFG,EAAY,MAAM;AAChB,IAAAL,EAAA;AAAA,EACF,CAAC,GAEM;AAAA,IACL,aAAAD;AAAA,IACA,MAAAE;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"hooks.mjs","sources":["../../../src/__builtins__/shared/hooks.ts"],"sourcesContent":["import type { Ref } from 'vue'\nimport { onUnmounted, watch } from 'vue'\n\nexport function useDebounceFn<T extends (...args: any[]) => any>(\n fn: T,\n delay: number | (() => number),\n): T {\n let timeoutId: ReturnType<typeof setTimeout> | null = null\n\n return ((...args: Parameters<T>) => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId)\n }\n\n const delayMs = typeof delay === 'function' ? delay() : delay\n\n timeoutId = setTimeout(() => {\n fn(...args)\n timeoutId = null\n }, delayMs)\n }) as T\n}\n\nexport function useThrottleFn<T extends (...args: any[]) => any>(\n fn: T,\n delay: number,\n trailing = true,\n leading = true,\n): T {\n let timeoutId: ReturnType<typeof setTimeout> | null = null\n let lastCallTime = 0\n let lastArgs: Parameters<T> | null = null\n\n return ((...args: Parameters<T>) => {\n const now = Date.now()\n if (lastCallTime === 0 && leading) {\n lastCallTime = now\n fn(...args)\n return\n }\n if (lastCallTime === 0 && !leading) {\n lastCallTime = now\n }\n\n const remainingTime = delay - (now - lastCallTime)\n\n lastArgs = args\n\n if (timeoutId !== null) {\n clearTimeout(timeoutId)\n }\n\n if (remainingTime <= 0 && lastCallTime !== now) {\n lastCallTime = now\n fn(...args)\n lastArgs = null\n }\n else if (trailing) {\n timeoutId = setTimeout(() => {\n lastCallTime = Date.now()\n if (lastArgs !== null) {\n fn(...lastArgs)\n lastArgs = null\n }\n timeoutId = null\n }, remainingTime)\n }\n }) as T\n}\n\nexport function useResizeObserver(\n target: Ref<Element | null> | Element | null,\n callback: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void,\n options?: ResizeObserverOptions,\n): {\n isSupported: boolean\n stop: () => void\n} {\n let observer: ResizeObserver | null = null\n const isSupported = globalThis.window !== undefined && 'ResizeObserver' in globalThis\n\n const cleanup = () => {\n if (observer) {\n observer.disconnect()\n observer = null\n }\n }\n\n const stop = () => {\n cleanup()\n }\n\n const start = () => {\n cleanup()\n\n /* istanbul ignore if @preserve */\n if (!isSupported) {\n return\n }\n\n const element = (target && 'value' in target ? target.value : target) as Element\n\n if (!element) {\n return\n }\n\n observer = new ResizeObserver(callback)\n observer.observe(element, options)\n }\n\n if (target && 'value' in target) {\n watch(\n target,\n () => {\n start()\n },\n { immediate: true, flush: 'post' },\n )\n }\n else {\n start()\n }\n onUnmounted(() => {\n cleanup()\n })\n\n return {\n isSupported,\n stop,\n }\n}\n"],"names":["useDebounceFn","fn","delay","timeoutId","args","delayMs","useThrottleFn","trailing","leading","lastCallTime","lastArgs","now","remainingTime","useResizeObserver","target","callback","options","observer","isSupported","cleanup","stop","start","element","watch","onUnmounted"],"mappings":";AAGO,SAASA,EACdC,GACAC,GACG;AACH,MAAIC,IAAkD;AAEtD,UAAQ,IAAIC,MAAwB;AAClC,IAAID,MAAc,QAChB,aAAaA,CAAS;AAGxB,UAAME,IAAU,OAAOH,KAAU,aAAaA,MAAUA;AAExD,IAAAC,IAAY,WAAW,MAAM;AAC3B,MAAAF,EAAG,GAAGG,CAAI,GACVD,IAAY;AAAA,IACd,GAAGE,CAAO;AAAA,EACZ;AACF;AAEO,SAASC,EACdL,GACAC,GACAK,IAAW,IACXC,IAAU,IACP;AACH,MAAIL,IAAkD,MAClDM,IAAe,GACfC,IAAiC;AAErC,UAAQ,IAAIN,MAAwB;AAClC,UAAMO,IAAM,KAAK,IAAA;AACjB,QAAIF,MAAiB,KAAKD,GAAS;AACjC,MAAAC,IAAeE,GACfV,EAAG,GAAGG,CAAI;AACV;AAAA,IACF;AACA,IAAIK,MAAiB,KAAK,CAACD,MACzBC,IAAeE;AAGjB,UAAMC,IAAgBV,KAASS,IAAMF;AAErC,IAAAC,IAAWN,GAEPD,MAAc,QAChB,aAAaA,CAAS,GAGpBS,KAAiB,KAAKH,MAAiBE,KACzCF,IAAeE,GACfV,EAAG,GAAGG,CAAI,GACVM,IAAW,QAEJH,MACPJ,IAAY,WAAW,MAAM;AAC3B,MAAAM,IAAe,KAAK,IAAA,GAChBC,MAAa,SACfT,EAAG,GAAGS,CAAQ,GACdA,IAAW,OAEbP,IAAY;AAAA,IACd,GAAGS,CAAa;AAAA,EAEpB;AACF;AAEO,SAASC,EACdC,GACAC,GACAC,GAIA;AACA,MAAIC,IAAkC;AACtC,QAAMC,IAAc,WAAW,WAAW,UAAa,oBAAoB,YAErEC,IAAU,MAAM;AACpB,IAAIF,MACFA,EAAS,WAAA,GACTA,IAAW;AAAA,EAEf,GAEMG,IAAO,MAAM;AACjB,IAAAD,EAAA;AAAA,EACF,GAEME,IAAQ,MAAM;AAClB,IAAAF,EAAA;AAAA,IAAQ;AAGR,QAAI,CAACD;AACH;AAGF,UAAMI,IAAWR,KAAU,WAAWA,IAASA,EAAO,QAAQA;AAE9D,IAAKQ,MAILL,IAAW,IAAI,eAAeF,CAAQ,GACtCE,EAAS,QAAQK,GAASN,CAAO;AAAA,EACnC;AAEA,SAAIF,KAAU,WAAWA,IACvBS;AAAA,IACET;AAAA,IACA,MAAM;AACJ,MAAAO,EAAA;AAAA,IACF;AAAA,IACA,EAAE,WAAW,IAAM,OAAO,OAAA;AAAA,EAAO,IAInCA,EAAA,GAEFG,EAAY,MAAM;AAChB,IAAAL,EAAA;AAAA,EACF,CAAC,GAEM;AAAA,IACL,aAAAD;AAAA,IACA,MAAAE;AAAA,EAAA;AAEJ;"}
@@ -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 +1 @@
1
- {"version":3,"file":"loading.mjs","sources":["../../../src/__builtins__/shared/loading.ts"],"sourcesContent":["import type { Form } from '@formily/core'\r\nimport { reaction } from '@formily/reactive'\r\nimport { ElLoading } from 'element-plus'\r\nimport { ref } from 'vue'\r\nimport { useDebounceFn } from './hooks'\r\n\r\nexport async function loading(loadingText = 'Loading...', processor: () => Promise<any>) {\r\n let loadingInstance\r\n const loading = setTimeout(() => {\r\n loadingInstance = ElLoading.service({\r\n text: loadingText,\r\n background: 'transparent',\r\n })\r\n }, 100)\r\n try {\r\n return await processor()\r\n }\r\n finally {\r\n loadingInstance?.close()\r\n clearTimeout(loading)\r\n }\r\n}\r\n\r\n/**\r\n * 获取当前element-plus的过渡时长并转换为毫秒\r\n * @param cssVarName CSS 变量名,默认为 '--el-transition-duration'\r\n * @param defaultValue 默认值(毫秒),默认为 200\r\n * @returns 过渡时长(毫秒)\r\n */\r\nexport function getTransitionDuration(cssVarName = '--el-transition-duration', defaultValue = 200): number {\r\n const cssVar = getComputedStyle(document.documentElement)\r\n .getPropertyValue(cssVarName)\r\n .trim()\r\n if (!cssVar) {\r\n return defaultValue\r\n }\r\n const durationMatch = cssVar.match(/^([\\d.]+)\\s*(s|ms)?$/)\r\n if (!durationMatch) {\r\n return defaultValue\r\n }\r\n\r\n const value = Number.parseFloat(durationMatch[1])\r\n const unit = durationMatch[2] || 'ms'\r\n\r\n switch (unit) {\r\n case 's': {\r\n return value * 1000\r\n }\r\n case 'ms': {\r\n return value\r\n }\r\n }\r\n}\r\n\r\nexport function useDebonceSubmitting(form: Form) {\r\n const internalSubmitting = ref(false)\r\n const transitionDuration = getTransitionDuration()\r\n\r\n const setSubmittingFalse = useDebounceFn(() => {\r\n internalSubmitting.value = false\r\n }, () => transitionDuration)\r\n\r\n reaction(() => form.submitting, (val) => {\r\n if (val === false) {\r\n setSubmittingFalse()\r\n }\r\n else {\r\n internalSubmitting.value = val\r\n }\r\n })\r\n\r\n return {\r\n internalSubmitting,\r\n }\r\n}\r\n"],"names":["loading","loadingText","processor","loadingInstance","ElLoading","getTransitionDuration","cssVarName","defaultValue","cssVar","durationMatch","value","useDebonceSubmitting","form","internalSubmitting","ref","transitionDuration","setSubmittingFalse","useDebounceFn","reaction","val"],"mappings":";;;;AAMA,eAAsBA,EAAQC,IAAc,cAAcC,GAA+B;AACvF,MAAIC;AACJ,QAAMH,IAAU,WAAW,MAAM;AAC/B,IAAAG,IAAkBC,EAAU,QAAQ;AAAA,MAClC,MAAMH;AAAA,MACN,YAAY;AAAA,IAAA,CACb;AAAA,EACH,GAAG,GAAG;AACN,MAAI;AACF,WAAO,MAAMC,EAAA;AAAA,EACf,UAAA;AAEE,IAAAC,GAAiB,MAAA,GACjB,aAAaH,CAAO;AAAA,EACtB;AACF;AAQO,SAASK,EAAsBC,IAAa,4BAA4BC,IAAe,KAAa;AACzG,QAAMC,IAAS,iBAAiB,SAAS,eAAe,EACrD,iBAAiBF,CAAU,EAC3B,KAAA;AACH,MAAI,CAACE;AACH,WAAOD;AAET,QAAME,IAAgBD,EAAO,MAAM,sBAAsB;AACzD,MAAI,CAACC;AACH,WAAOF;AAGT,QAAMG,IAAQ,OAAO,WAAWD,EAAc,CAAC,CAAC;AAGhD,UAFaA,EAAc,CAAC,KAAK,MAEzB;AAAA,IACN,KAAK;AACH,aAAOC,IAAQ;AAAA,IAEjB,KAAK;AACH,aAAOA;AAAA,EACT;AAEJ;AAEO,SAASC,EAAqBC,GAAY;AAC/C,QAAMC,IAAqBC,EAAI,EAAK,GAC9BC,IAAqBV,EAAA,GAErBW,IAAqBC,EAAc,MAAM;AAC7C,IAAAJ,EAAmB,QAAQ;AAAA,EAC7B,GAAG,MAAME,CAAkB;AAE3B,SAAAG,EAAS,MAAMN,EAAK,YAAY,CAACO,MAAQ;AACvC,IAAIA,MAAQ,KACVH,EAAA,IAGAH,EAAmB,QAAQM;AAAA,EAE/B,CAAC,GAEM;AAAA,IACL,oBAAAN;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"loading.mjs","sources":["../../../src/__builtins__/shared/loading.ts"],"sourcesContent":["import type { Form } from '@formily/core'\nimport { reaction } from '@formily/reactive'\nimport { ElLoading } from 'element-plus'\nimport { ref } from 'vue'\nimport { useDebounceFn } from './hooks'\n\nexport async function loading(loadingText = 'Loading...', processor: () => Promise<any>) {\n let loadingInstance\n const loading = setTimeout(() => {\n loadingInstance = ElLoading.service({\n text: loadingText,\n background: 'transparent',\n })\n }, 100)\n try {\n return await processor()\n }\n finally {\n loadingInstance?.close()\n clearTimeout(loading)\n }\n}\n\n/**\n * 获取当前element-plus的过渡时长并转换为毫秒\n * @param cssVarName CSS 变量名,默认为 '--el-transition-duration'\n * @param defaultValue 默认值(毫秒),默认为 200\n * @returns 过渡时长(毫秒)\n */\nexport function getTransitionDuration(cssVarName = '--el-transition-duration', defaultValue = 200): number {\n const cssVar = getComputedStyle(document.documentElement)\n .getPropertyValue(cssVarName)\n .trim()\n if (!cssVar) {\n return defaultValue\n }\n const durationMatch = cssVar.match(/^([\\d.]+)\\s*(s|ms)?$/)\n if (!durationMatch) {\n return defaultValue\n }\n\n const value = Number.parseFloat(durationMatch[1])\n const unit = durationMatch[2] || 'ms'\n\n switch (unit) {\n case 's': {\n return value * 1000\n }\n case 'ms': {\n return value\n }\n }\n}\n\nexport function useDebonceSubmitting(form: Form) {\n const internalSubmitting = ref(false)\n const transitionDuration = getTransitionDuration()\n\n const setSubmittingFalse = useDebounceFn(() => {\n internalSubmitting.value = false\n }, () => transitionDuration)\n\n reaction(() => form.submitting, (val) => {\n if (val === false) {\n setSubmittingFalse()\n }\n else {\n internalSubmitting.value = val\n }\n })\n\n return {\n internalSubmitting,\n }\n}\n"],"names":["loading","loadingText","processor","loadingInstance","ElLoading","getTransitionDuration","cssVarName","defaultValue","cssVar","durationMatch","value","useDebonceSubmitting","form","internalSubmitting","ref","transitionDuration","setSubmittingFalse","useDebounceFn","reaction","val"],"mappings":";;;;AAMA,eAAsBA,EAAQC,IAAc,cAAcC,GAA+B;AACvF,MAAIC;AACJ,QAAMH,IAAU,WAAW,MAAM;AAC/B,IAAAG,IAAkBC,EAAU,QAAQ;AAAA,MAClC,MAAMH;AAAA,MACN,YAAY;AAAA,IAAA,CACb;AAAA,EACH,GAAG,GAAG;AACN,MAAI;AACF,WAAO,MAAMC,EAAA;AAAA,EACf,UAAA;AAEE,IAAAC,GAAiB,MAAA,GACjB,aAAaH,CAAO;AAAA,EACtB;AACF;AAQO,SAASK,EAAsBC,IAAa,4BAA4BC,IAAe,KAAa;AACzG,QAAMC,IAAS,iBAAiB,SAAS,eAAe,EACrD,iBAAiBF,CAAU,EAC3B,KAAA;AACH,MAAI,CAACE;AACH,WAAOD;AAET,QAAME,IAAgBD,EAAO,MAAM,sBAAsB;AACzD,MAAI,CAACC;AACH,WAAOF;AAGT,QAAMG,IAAQ,OAAO,WAAWD,EAAc,CAAC,CAAC;AAGhD,UAFaA,EAAc,CAAC,KAAK,MAEzB;AAAA,IACN,KAAK;AACH,aAAOC,IAAQ;AAAA,IAEjB,KAAK;AACH,aAAOA;AAAA,EACT;AAEJ;AAEO,SAASC,EAAqBC,GAAY;AAC/C,QAAMC,IAAqBC,EAAI,EAAK,GAC9BC,IAAqBV,EAAA,GAErBW,IAAqBC,EAAc,MAAM;AAC7C,IAAAJ,EAAmB,QAAQ;AAAA,EAC7B,GAAG,MAAME,CAAkB;AAE3B,SAAAG,EAAS,MAAMN,EAAK,YAAY,CAACO,MAAQ;AACvC,IAAIA,MAAQ,KACVH,EAAA,IAGAH,EAAmB,QAAQM;AAAA,EAE/B,CAAC,GAEM;AAAA,IACL,oBAAAN;AAAA,EAAA;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"simple-version-compare.mjs","sources":["../../../src/__builtins__/shared/simple-version-compare.ts"],"sourcesContent":["function normalizeVersion(v: string) {\r\n return v.split('.').map((n) => {\r\n const num = Number.parseInt(n, 10)\r\n return Number.isNaN(num) ? '0'.padStart(10, '0') : num.toString().padStart(10, '0')\r\n }).join('.')\r\n}\r\n\r\nexport function quickVersionCompare(v1: string, v2: string): number {\r\n const nv1 = normalizeVersion(v1)\r\n const nv2 = normalizeVersion(v2)\r\n return nv1 > nv2 ? 1 : (nv1 < nv2 ? -1 : 0)\r\n}\r\n\r\nexport function lt(v1: string, v2: string): boolean {\r\n return quickVersionCompare(v1, v2) < 0\r\n}\r\n"],"names":["normalizeVersion","v","n","num","quickVersionCompare","v1","v2","nv1","nv2","lt"],"mappings":"AAAA,SAASA,EAAiBC,GAAW;AACnC,SAAOA,EAAE,MAAM,GAAG,EAAE,IAAI,CAACC,MAAM;AAC7B,UAAMC,IAAM,OAAO,SAASD,GAAG,EAAE;AACjC,WAAO,OAAO,MAAMC,CAAG,IAAI,IAAI,SAAS,IAAI,GAAG,IAAIA,EAAI,SAAA,EAAW,SAAS,IAAI,GAAG;AAAA,EACpF,CAAC,EAAE,KAAK,GAAG;AACb;AAEO,SAASC,EAAoBC,GAAYC,GAAoB;AAClE,QAAMC,IAAMP,EAAiBK,CAAE,GACzBG,IAAMR,EAAiBM,CAAE;AAC/B,SAAOC,IAAMC,IAAM,IAAKD,IAAMC,IAAM,KAAK;AAC3C;AAEO,SAASC,EAAGJ,GAAYC,GAAqB;AAClD,SAAOF,EAAoBC,GAAIC,CAAE,IAAI;AACvC;"}
1
+ {"version":3,"file":"simple-version-compare.mjs","sources":["../../../src/__builtins__/shared/simple-version-compare.ts"],"sourcesContent":["function normalizeVersion(v: string) {\n return v.split('.').map((n) => {\n const num = Number.parseInt(n, 10)\n return Number.isNaN(num) ? '0'.padStart(10, '0') : num.toString().padStart(10, '0')\n }).join('.')\n}\n\nexport function quickVersionCompare(v1: string, v2: string): number {\n const nv1 = normalizeVersion(v1)\n const nv2 = normalizeVersion(v2)\n return nv1 > nv2 ? 1 : (nv1 < nv2 ? -1 : 0)\n}\n\nexport function lt(v1: string, v2: string): boolean {\n return quickVersionCompare(v1, v2) < 0\n}\n"],"names":["normalizeVersion","v","n","num","quickVersionCompare","v1","v2","nv1","nv2","lt"],"mappings":"AAAA,SAASA,EAAiBC,GAAW;AACnC,SAAOA,EAAE,MAAM,GAAG,EAAE,IAAI,CAACC,MAAM;AAC7B,UAAMC,IAAM,OAAO,SAASD,GAAG,EAAE;AACjC,WAAO,OAAO,MAAMC,CAAG,IAAI,IAAI,SAAS,IAAI,GAAG,IAAIA,EAAI,SAAA,EAAW,SAAS,IAAI,GAAG;AAAA,EACpF,CAAC,EAAE,KAAK,GAAG;AACb;AAEO,SAASC,EAAoBC,GAAYC,GAAoB;AAClE,QAAMC,IAAMP,EAAiBK,CAAE,GACzBG,IAAMR,EAAiBM,CAAE;AAC/B,SAAOC,IAAMC,IAAM,IAAKD,IAAMC,IAAM,KAAK;AAC3C;AAEO,SAASC,EAAGJ,GAAYC,GAAqB;AAClD,SAAOF,EAAoBC,GAAIC,CAAE,IAAI;AACvC;"}
@@ -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'\nimport type { Component } from 'vue'\nimport { isVoidField } from '@formily/core'\nimport { observer } from '@silver-formily/reactive-vue'\nimport { useField } from '@silver-formily/vue'\nimport { defineComponent, h } from 'vue'\n\n// fork from https://github.com/alibaba/formily/blob/7c64c671252adf85471ac5aabfddbaf4fc537354/packages/vue/src/shared/connect.ts#L65\nexport function mapReadPretty(\n component: Component,\n readPrettyProps?: Record<string, any>,\n): IComponentMapper {\n const mapper = (target: Component) => {\n return observer(\n defineComponent({\n name: target.name ? `Read${target.name}` : `ReadComponent`,\n setup(props, { attrs, slots, listeners }: Record<string, any>) {\n const fieldRef = useField()\n return () => {\n const field = fieldRef.value\n const isEditableReadPretty = !!field?.data?.readPretty\n return h(\n field && !isVoidField(field) && (field.pattern === 'readPretty' || isEditableReadPretty)\n ? component\n : target,\n {\n attrs: {\n ...readPrettyProps,\n ...attrs,\n },\n on: listeners,\n },\n slots,\n )\n }\n },\n }),\n )\n }\n\n return mapper as unknown as IComponentMapper\n}\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'\nimport { isPlainObj } from '@formily/shared'\nimport { useAttrs } from 'element-plus'\nimport { omit } from 'lodash-es'\nimport { Comment, computed, Fragment, Text } from 'vue'\n\nexport function useCleanAttrs(removeAttrsList: string[] = []): {\n props: ComputedRef<Record<string, any>>\n} {\n const attrs = useAttrs()\n const props = computed(() => {\n const DEFAULT_REMOVE_ATTRS = ['value', 'onChange', 'attrs', 'on', 'readOnly']\n if (isPlainObj(attrs.value.attrs)) {\n return omit({ ...attrs.value, ...attrs.value.attrs }, DEFAULT_REMOVE_ATTRS.concat(removeAttrsList))\n }\n return omit(attrs.value, DEFAULT_REMOVE_ATTRS.concat(removeAttrsList))\n })\n return {\n props,\n }\n}\n\nexport function isVueOptions(options: any): options is Component {\n return (\n options\n && (typeof options.template === 'string'\n || typeof options.render === 'function')\n )\n}\n\nexport function composeExport<T0 extends object, T1 extends object>(\n s0: T0,\n s1: T1,\n): T0 & T1 {\n return Object.assign(s0, s1)\n}\n\n// Adapted from https://github.com/vuejs/vue-next/blob/ca17162e377e0a0bf3fae9d92d0fdcb32084a9fe/packages/runtime-core/src/helpers/renderSlot.ts#L77\n/* istanbul ignore next -- @preserve */\nexport function isVnodeEmpty(vnodes: Array<VNode>) {\n return vnodes.every((node: VNode) => {\n if (node.type === Comment) {\n return true\n }\n\n if (node.type === Text && typeof node.children === 'string' && !node.children.trim()) {\n return true\n }\n\n if (\n node.type === Fragment\n && isVnodeEmpty(node.children as Array<VNode>)\n ) {\n return true\n }\n\n return false\n })\n}\n\nexport function hasSlotContent(slot: Slot<any> | undefined) {\n if (!slot) {\n return false\n }\n return !isVnodeEmpty(slot())\n}\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;"}