@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.
- package/README.en-US.md +32 -0
- package/README.md +32 -35
- package/esm/__builtins__/index.mjs +15 -16
- package/esm/__builtins__/shared/index.mjs +11 -12
- package/esm/__builtins__/shared/transform-component.d.ts +2 -6
- package/esm/__builtins__/shared/transform-component.mjs +16 -33
- package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
- package/esm/__builtins__/shared/utils.mjs +10 -10
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +58 -58
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-cards/index.mjs +44 -44
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +59 -58
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-items/index.mjs +46 -43
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +15 -14
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-table/array-table.d.ts +28 -0
- package/esm/array-table/index.d.ts +28 -0
- package/esm/array-table/index.mjs +113 -111
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/types.d.ts +1 -0
- package/esm/cascader/index.mjs +19 -20
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/checkbox-group.d.ts +1 -4
- package/esm/checkbox/index.d.ts +442 -379
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/editable/editable.d.ts +16 -12
- package/esm/editable/index.d.ts +8 -6
- package/esm/editable/index.mjs +110 -112
- package/esm/editable/index.mjs.map +1 -1
- package/esm/form-button-group/index.mjs +29 -28
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +42 -43
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-dialog/index.d.ts +1 -1
- package/esm/form-dialog/index.mjs +4 -4
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-dialog/types.d.ts +6 -6
- package/esm/form-drawer/index.d.ts +1 -1
- package/esm/form-drawer/index.mjs +4 -4
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-drawer/types.d.ts +6 -6
- package/esm/form-grid/index.d.ts +1 -183
- package/esm/form-grid/index.mjs +1 -1
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/form-item.d.ts +2 -1
- package/esm/form-item/index.d.ts +12 -6
- package/esm/form-item/index.mjs +163 -155
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/types.d.ts +0 -1
- package/esm/form-layout/form-layout.d.ts +0 -1
- package/esm/form-layout/form-layout.mjs +53 -52
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-layout/types.d.ts +0 -2
- package/esm/form-layout/utils.d.ts +3 -3
- package/esm/form-layout/utils.mjs +48 -43
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +27 -25
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-tab/index.d.ts +1 -26
- package/esm/form-tab/index.mjs +30 -30
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/index.d.ts +3 -0
- package/esm/index.mjs +44 -38
- package/esm/index.mjs.map +1 -1
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.d.ts +258 -147
- package/esm/pagination/pagination.mjs +109 -110
- package/esm/pagination/pagination.mjs.map +1 -1
- package/esm/password/index.mjs.map +1 -1
- package/esm/preview-text/index.d.ts +5 -0
- package/esm/preview-text/index.mjs +165 -141
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/rate.d.ts +5 -0
- package/esm/preview-text/utils.d.ts +5 -5
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/radio/index.d.ts +344 -194
- package/esm/radio/index.mjs.map +1 -1
- package/esm/rate/index.d.ts +187 -0
- package/esm/rate/index.mjs +14 -0
- package/esm/rate/index.mjs.map +1 -0
- package/esm/reset/index.d.ts +1 -62
- package/esm/reset/index.mjs +1 -1
- package/esm/reset/index.mjs.map +1 -1
- package/esm/segmented/index.d.ts +26 -0
- package/esm/segmented/index.mjs +37 -0
- package/esm/segmented/index.mjs.map +1 -0
- package/esm/segmented/segmented.d.ts +25 -0
- package/esm/select/index.mjs +8 -8
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.d.ts +28 -0
- package/esm/select-table/index.mjs +48 -47
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/select-table/select-table.d.ts +56 -0
- package/esm/slider/index.d.ts +177 -0
- package/esm/slider/index.mjs +14 -0
- package/esm/slider/index.mjs.map +1 -0
- package/esm/submit/index.d.ts +1 -47
- package/esm/submit/index.mjs +1 -1
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.d.ts +225 -189
- package/esm/time-select/index.d.ts +163 -103
- package/esm/transfer/index.d.ts +196 -115
- package/esm/transfer/index.mjs.map +1 -1
- package/esm/tree/index.mjs +26 -26
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.d.ts +404 -399
- package/esm/upload/index.mjs.map +1 -1
- package/esm/upload/upload.d.ts +800 -790
- package/esm/vendor/icon.mjs.map +1 -1
- package/esm/vendor/lodash.mjs +12 -20
- package/esm/vendor/lodash.mjs.map +1 -1
- package/esm/vendor/runtime.mjs +29 -24
- package/esm/vendor/runtime.mjs.map +1 -1
- package/esm/vendor/shared.esm-bundler.mjs +2 -2
- package/esm/vendor/sizes.mjs.map +1 -1
- package/esm/vendor/types.mjs +5 -5
- package/esm/vendor/types.mjs.map +1 -1
- package/package.json +8 -9
package/README.en-US.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Silver Formily Element Plus
|
|
2
|
+
|
|
3
|
+
[](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
|
-
[](https://codecov.io/gh/hezhengxu2018/silver-formily-element-plus)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
[](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
|
|
4
|
-
import { getTransitionDuration as
|
|
5
|
-
import { lt as d, quickVersionCompare as
|
|
6
|
-
import { mapReadPretty as
|
|
7
|
-
import { composeExport as
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
18
|
-
|
|
17
|
+
g as mapReadPretty,
|
|
18
|
+
b as quickVersionCompare,
|
|
19
19
|
r as stylePrefix,
|
|
20
|
-
|
|
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
|
|
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
|
|
6
|
-
import { composeExport as g, hasSlotContent as
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
m as getTransitionDuration,
|
|
10
|
+
C as hasSlotContent,
|
|
11
|
+
D as isVnodeEmpty,
|
|
12
|
+
E as isVueOptions,
|
|
13
13
|
i as loadElConfigProvider,
|
|
14
|
-
|
|
14
|
+
u as loading,
|
|
15
15
|
l as lt,
|
|
16
|
-
|
|
16
|
+
b as mapReadPretty,
|
|
17
17
|
x as quickVersionCompare,
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
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
|
|
2
|
-
import { observer as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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(
|
|
26
|
-
const p =
|
|
9
|
+
setup(R, { attrs: n, slots: a, listeners: m }) {
|
|
10
|
+
const p = f();
|
|
27
11
|
return () => {
|
|
28
|
-
const e = p.value,
|
|
29
|
-
return
|
|
30
|
-
e && !
|
|
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
|
-
...
|
|
18
|
+
...n
|
|
35
19
|
},
|
|
36
|
-
on:
|
|
20
|
+
on: m
|
|
37
21
|
},
|
|
38
|
-
|
|
22
|
+
a
|
|
39
23
|
);
|
|
40
24
|
};
|
|
41
25
|
}
|
|
@@ -43,7 +27,6 @@ function E(t, o) {
|
|
|
43
27
|
);
|
|
44
28
|
}
|
|
45
29
|
export {
|
|
46
|
-
|
|
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 {
|
|
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,
|
|
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
|
|
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
|
|
14
|
+
function v(t) {
|
|
15
15
|
return t && (typeof t.template == "string" || typeof t.render == "function");
|
|
16
16
|
}
|
|
17
|
-
function
|
|
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 ===
|
|
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
|
|
24
|
+
function O(t) {
|
|
25
25
|
return t ? !u(t()) : !1;
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
E as composeExport,
|
|
29
|
+
O as hasSlotContent,
|
|
30
30
|
u as isVnodeEmpty,
|
|
31
|
-
|
|
32
|
-
|
|
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,
|
|
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;"}
|
package/esm/array-base/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as o, createBlock as m, createCommentVNode as f, unref as a, openBlock as i, normalizeClass as
|
|
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:
|
|
15
|
-
title:
|
|
14
|
+
defaultValue: {},
|
|
15
|
+
title: {}
|
|
16
16
|
},
|
|
17
|
-
setup(
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
|
|
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 (
|
|
23
|
+
return (s, A) => a(e).field.value.pattern === "editable" ? (i(), m(a(y), {
|
|
24
24
|
key: 0,
|
|
25
|
-
class:
|
|
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:
|
|
30
|
+
onClick: l
|
|
31
31
|
}, {
|
|
32
32
|
default: h(() => [
|
|
33
|
-
_(v(a(t).title ||
|
|
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(
|
|
42
|
-
const
|
|
41
|
+
setup(n) {
|
|
42
|
+
const r = k();
|
|
43
43
|
return (t, e) => (i(), C("span", {
|
|
44
|
-
class:
|
|
44
|
+
class: c(`${a(d)}-index`)
|
|
45
45
|
}, [
|
|
46
|
-
|
|
47
|
-
_(" #" + v(a(
|
|
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:
|
|
57
|
+
keyMap: {}
|
|
58
58
|
},
|
|
59
|
-
setup(
|
|
60
|
-
const
|
|
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:
|
|
64
|
+
props: r,
|
|
65
65
|
attrs: w(),
|
|
66
|
-
keyMap:
|
|
67
|
-
}), (
|
|
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:
|
|
74
|
-
record:
|
|
73
|
+
index: {},
|
|
74
|
+
record: {}
|
|
75
75
|
},
|
|
76
|
-
setup(
|
|
77
|
-
return M(H,
|
|
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:
|
|
83
|
+
title: {}
|
|
84
84
|
},
|
|
85
|
-
setup(
|
|
86
|
-
const
|
|
87
|
-
function
|
|
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 (
|
|
94
|
+
return (s, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
|
|
95
95
|
key: 0,
|
|
96
|
-
class:
|
|
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: $(
|
|
102
|
+
onClick: $(l, ["stop"])
|
|
103
103
|
}, {
|
|
104
104
|
default: h(() => [
|
|
105
|
-
|
|
106
|
-
_(v(
|
|
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:
|
|
116
|
+
title: {}
|
|
117
117
|
},
|
|
118
|
-
setup(
|
|
119
|
-
const
|
|
120
|
-
function
|
|
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 (
|
|
127
|
+
return (s, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
|
|
128
128
|
key: 0,
|
|
129
|
-
class:
|
|
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: $(
|
|
135
|
+
onClick: $(l, ["stop"])
|
|
136
136
|
}, {
|
|
137
137
|
default: h(() => [
|
|
138
|
-
|
|
139
|
-
_(v(
|
|
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:
|
|
149
|
+
title: {}
|
|
150
150
|
},
|
|
151
|
-
setup(
|
|
152
|
-
const
|
|
153
|
-
function
|
|
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 (
|
|
156
|
+
return (s, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
|
|
157
157
|
key: 0,
|
|
158
|
-
class:
|
|
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: $(
|
|
164
|
+
onClick: $(l, ["stop"])
|
|
165
165
|
}, {
|
|
166
166
|
default: h(() => [
|
|
167
|
-
|
|
168
|
-
_(v(
|
|
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(
|
|
178
|
-
const
|
|
179
|
-
return (t, e) => a(
|
|
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:
|
|
181
|
+
class: c(`${a(d)}-sort-handle`),
|
|
182
182
|
size: "small",
|
|
183
183
|
icon: a(U),
|
|
184
184
|
underline: a(b)(),
|