@silver-formily/element-plus 2.0.0 → 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.
- package/README.en-US.md +32 -0
- package/README.md +18 -21
- package/esm/__builtins__/index.mjs +15 -16
- package/esm/__builtins__/shared/index.mjs +11 -12
- package/esm/__builtins__/shared/transform-component.d.ts +2 -7
- 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 +11 -11
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +62 -62
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/utils.mjs +2 -2
- package/esm/array-cards/array-cards.d.ts +1 -1
- package/esm/array-cards/index.d.ts +3 -3
- package/esm/array-cards/index.mjs +49 -49
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/array-collapse.d.ts +2 -2
- package/esm/array-collapse/index.d.ts +3 -3
- package/esm/array-collapse/index.mjs +85 -84
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-collapse/utils.mjs +2 -2
- package/esm/array-items/index.mjs +43 -40
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/array-list-tabs.d.ts +3 -3
- package/esm/array-list-tabs/index.d.ts +6 -6
- package/esm/array-list-tabs/index.mjs +93 -89
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs +2 -2
- package/esm/array-table/array-table.d.ts +29 -1
- package/esm/array-table/index.d.ts +31 -3
- package/esm/array-table/index.mjs +126 -125
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/types.d.ts +2 -1
- package/esm/array-table/utils.mjs +2 -2
- package/esm/array-tabs/index.mjs +17 -17
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/cascader/cascader.d.ts +1 -6
- package/esm/cascader/index.d.ts +3 -16
- package/esm/cascader/index.mjs +29 -33
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/checkbox-group.d.ts +3 -19
- package/esm/checkbox/index.d.ts +445 -407
- package/esm/checkbox/index.mjs +27 -36
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/date-picker/index.d.ts +442 -1
- package/esm/date-picker/index.mjs +12 -19
- package/esm/date-picker/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 +108 -110
- package/esm/editable/index.mjs.map +1 -1
- package/esm/form/form.mjs +1 -1
- package/esm/form/form.mjs.map +1 -1
- package/esm/form-button-group/index.mjs +31 -30
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-button-group/utils.mjs +2 -2
- package/esm/form-collapse/index.mjs +40 -40
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-dialog/index.d.ts +1 -1
- package/esm/form-dialog/index.mjs +5 -5
- 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 +5 -5
- 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 +2 -2
- 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 +156 -152
- 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 +55 -53
- 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 +47 -42
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +26 -24
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-tab/form-tab.d.ts +2 -2
- package/esm/form-tab/hooks.mjs +1 -1
- package/esm/form-tab/hooks.mjs.map +1 -1
- package/esm/form-tab/index.d.ts +1 -26
- package/esm/form-tab/index.mjs +31 -31
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/form-tab/types.d.ts +1 -1
- package/esm/input/index.d.ts +6 -38
- package/esm/input/index.mjs +38 -47
- package/esm/input/index.mjs.map +1 -1
- package/esm/input/input.d.ts +1 -8
- package/esm/input-number/index.d.ts +326 -1
- package/esm/input-number/index.mjs +10 -17
- package/esm/input-number/index.mjs.map +1 -1
- package/esm/pagination/pagination.mjs +110 -111
- package/esm/pagination/pagination.mjs.map +1 -1
- package/esm/password/index.d.ts +6 -38
- package/esm/password/index.mjs +1 -1
- package/esm/password/index.mjs.map +1 -1
- package/esm/preview-text/cascader.d.ts +1 -1
- package/esm/preview-text/date-picker.d.ts +1 -1
- package/esm/preview-text/index.d.ts +13 -13
- package/esm/preview-text/index.mjs +121 -121
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/input.d.ts +1 -1
- package/esm/preview-text/select.d.ts +1 -1
- package/esm/preview-text/time-picker.d.ts +1 -1
- package/esm/preview-text/tree.d.ts +1 -1
- package/esm/radio/index.d.ts +347 -219
- package/esm/radio/index.mjs +37 -44
- package/esm/radio/index.mjs.map +1 -1
- package/esm/radio/radio-group.d.ts +2 -13
- package/esm/reset/index.d.ts +1 -62
- package/esm/reset/index.mjs +2 -2
- package/esm/reset/index.mjs.map +1 -1
- package/esm/select/index.d.ts +3 -16
- package/esm/select/index.mjs +65 -70
- package/esm/select/index.mjs.map +1 -1
- package/esm/select/select.d.ts +1 -6
- package/esm/select-table/index.d.ts +33 -5
- package/esm/select-table/index.mjs +90 -89
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/select-table/select-table.d.ts +58 -2
- package/esm/select-table/types.d.ts +1 -1
- package/esm/submit/index.d.ts +1 -47
- package/esm/submit/index.mjs +2 -2
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.d.ts +296 -1
- package/esm/switch/index.mjs +5 -11
- package/esm/switch/index.mjs.map +1 -1
- package/esm/time-picker/index.d.ts +442 -1
- package/esm/time-picker/index.mjs +9 -14
- package/esm/time-picker/index.mjs.map +1 -1
- package/esm/time-select/index.d.ts +184 -1
- package/esm/time-select/index.mjs +8 -13
- package/esm/time-select/index.mjs.map +1 -1
- package/esm/transfer/index.d.ts +196 -115
- package/esm/transfer/index.mjs +5 -5
- package/esm/transfer/index.mjs.map +1 -1
- package/esm/tree/index.d.ts +5 -5
- package/esm/tree/index.mjs +34 -34
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree/tree.d.ts +2 -2
- package/esm/tree/types.d.ts +1 -1
- package/esm/tree-select/index.d.ts +3 -19
- package/esm/tree-select/index.mjs +23 -30
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/tree-select/tree-select.d.ts +1 -8
- package/esm/upload/index.d.ts +409 -404
- package/esm/upload/index.mjs +9 -9
- package/esm/upload/index.mjs.map +1 -1
- package/esm/upload/upload.d.ts +802 -792
- 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 -11
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
|
@@ -2,34 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://codecov.io/gh/hezhengxu2018/silver-formily-element-plus)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
简体中文 | [English](README.en-US.md)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
基于 Element Plus 的 Formily 组件库封装,提供一致的组件风格、灵活的配置能力以及更丰富的表单场景。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 文档
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
https://element-plus.silver-formily.org/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## 特性
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
- 💡 统一的组件风格
|
|
16
|
+
- 🔌 灵活的依赖策略(Formily 与 Element Plus 作为 peerDependencies)
|
|
17
|
+
- 🔑 完整的表单组件与扩展场景组件
|
|
18
|
+
- ♿️ 更好的无障碍支持与 FormItem 体验
|
|
19
|
+
- ✅ 新组件具备完善测试保障
|
|
20
|
+
- 📝 基于 Vue 模板语法,易读且性能友好
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
## 安装
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
~~~bash
|
|
25
|
+
pnpm add @silver-formily/element-plus
|
|
26
|
+
~~~
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
本包依赖 Formily、Element Plus、Vue、@silver-formily/vue 等 peerDependencies。请查看文档或 package.json 获取兼容版本与配置说明。
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
## 开源协议
|
|
24
31
|
|
|
25
|
-
|
|
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.
|
|
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,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IComponentMapper } from '@silver-formily/vue';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
|
-
|
|
4
|
-
export declare function transformComponent<T extends Record<string, any>>(tag: any, transformRules?: ListenersTransformRules): Component<T> | any;
|
|
5
|
-
export declare function mapReadPretty<T extends VueComponent, C extends VueComponent>(component: C, readPrettyProps?: Record<string, any>): (target: T) => import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
8
|
-
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'\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,34 +1,34 @@
|
|
|
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(() => {
|
|
9
|
-
const e = ["
|
|
9
|
+
const e = ["value", "onChange", "attrs", "on", "readOnly"];
|
|
10
10
|
return o(r.value.attrs) ? n({ ...r.value, ...r.value.attrs }, e.concat(t)) : n(r.value, e.concat(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'\nimport { isPlainObj } from '@formily/shared'\nimport { useAttrs } from 'element-plus'\nimport { omit } from 'lodash-es'\nimport { computed, Fragment } 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 = ['
|
|
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;"}
|
package/esm/array-base/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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 { ElLink as y } from "element-plus";
|
|
3
3
|
import "@formily/reactive";
|
|
4
4
|
import "@formily/core";
|
|
5
|
-
import "@formily/reactive-vue";
|
|
6
|
-
import { useField as B, useFieldSchema as D } from "@formily/vue";
|
|
5
|
+
import "@silver-formily/reactive-vue";
|
|
6
|
+
import { useField as B, useFieldSchema as D } from "@silver-formily/vue";
|
|
7
7
|
import { composeExport as I } from "../__builtins__/shared/utils.mjs";
|
|
8
8
|
import { Plus as R, ArrowDown as S, ArrowUp as U, Delete as V, Rank as z } from "@element-plus/icons-vue";
|
|
9
9
|
import { useArray as p, compatibleUnderlineProp as b, prefixCls as d, getDefaultValue as g, useIndex as k, useRecord as E, useKey as F } from "./utils.mjs";
|
|
@@ -14,26 +14,26 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
|
|
|
14
14
|
__name: "array-base-addition",
|
|
15
15
|
props: {
|
|
16
16
|
method: { default: "push" },
|
|
17
|
-
defaultValue:
|
|
18
|
-
title:
|
|
17
|
+
defaultValue: {},
|
|
18
|
+
title: {}
|
|
19
19
|
},
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
|
|
20
|
+
setup(n) {
|
|
21
|
+
const r = n, t = B(), e = p();
|
|
22
|
+
function l() {
|
|
23
|
+
const s = g(r.defaultValue, e?.schema.value);
|
|
24
|
+
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));
|
|
25
25
|
}
|
|
26
|
-
return (
|
|
26
|
+
return (s, A) => a(e).field.value.pattern === "editable" ? (i(), m(a(y), {
|
|
27
27
|
key: 0,
|
|
28
|
-
class:
|
|
28
|
+
class: c(`${a(d)}-addition`),
|
|
29
29
|
icon: a(R),
|
|
30
30
|
underline: a(b)(),
|
|
31
31
|
role: "button",
|
|
32
32
|
"aria-label": "添加条目",
|
|
33
|
-
onClick:
|
|
33
|
+
onClick: l
|
|
34
34
|
}, {
|
|
35
35
|
default: h(() => [
|
|
36
|
-
_(v(a(t).title ||
|
|
36
|
+
_(v(a(t).title || r.title), 1)
|
|
37
37
|
]),
|
|
38
38
|
_: 1
|
|
39
39
|
}, 8, ["class", "icon", "underline"])) : f("", !0);
|
|
@@ -41,13 +41,13 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
|
|
|
41
41
|
}), K = /* @__PURE__ */ o({
|
|
42
42
|
name: "ArrayBaseIndex",
|
|
43
43
|
__name: "array-base-index",
|
|
44
|
-
setup(
|
|
45
|
-
const
|
|
44
|
+
setup(n) {
|
|
45
|
+
const r = k();
|
|
46
46
|
return (t, e) => (i(), C("span", {
|
|
47
|
-
class:
|
|
47
|
+
class: c(`${a(d)}-index`)
|
|
48
48
|
}, [
|
|
49
|
-
|
|
50
|
-
_(" #" + v(a(
|
|
49
|
+
u(t.$slots, "default", { index: a(r) }, () => [
|
|
50
|
+
_(" #" + v(a(r) + 1) + ". ", 1)
|
|
51
51
|
])
|
|
52
52
|
], 2));
|
|
53
53
|
}
|
|
@@ -57,56 +57,56 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
|
|
|
57
57
|
__name: "array-base-inner",
|
|
58
58
|
props: {
|
|
59
59
|
disabled: { type: Boolean },
|
|
60
|
-
keyMap:
|
|
60
|
+
keyMap: {}
|
|
61
61
|
},
|
|
62
|
-
setup(
|
|
63
|
-
const
|
|
62
|
+
setup(n) {
|
|
63
|
+
const r = n, t = B(), e = D();
|
|
64
64
|
return M(H, {
|
|
65
65
|
field: t,
|
|
66
66
|
schema: e,
|
|
67
|
-
props:
|
|
67
|
+
props: r,
|
|
68
68
|
attrs: w(),
|
|
69
|
-
keyMap:
|
|
70
|
-
}), (
|
|
69
|
+
keyMap: r.keyMap
|
|
70
|
+
}), (l, s) => u(l.$slots, "default");
|
|
71
71
|
}
|
|
72
72
|
}), T = /* @__PURE__ */ o({
|
|
73
73
|
name: "ArrayBaseItem",
|
|
74
74
|
__name: "array-base-item",
|
|
75
75
|
props: {
|
|
76
|
-
index:
|
|
77
|
-
record:
|
|
76
|
+
index: {},
|
|
77
|
+
record: {}
|
|
78
78
|
},
|
|
79
|
-
setup(
|
|
80
|
-
return M(N,
|
|
79
|
+
setup(n) {
|
|
80
|
+
return M(N, n), (t, e) => u(t.$slots, "default");
|
|
81
81
|
}
|
|
82
82
|
}), j = /* @__PURE__ */ o({
|
|
83
83
|
name: "ArrayBaseMoveDown",
|
|
84
84
|
__name: "array-base-move-down",
|
|
85
85
|
props: {
|
|
86
|
-
title:
|
|
86
|
+
title: {}
|
|
87
87
|
},
|
|
88
|
-
setup(
|
|
89
|
-
const
|
|
90
|
-
function
|
|
88
|
+
setup(n) {
|
|
89
|
+
const r = n, t = k(), e = p();
|
|
90
|
+
function l() {
|
|
91
91
|
x(e?.keyMap) && e.keyMap.splice(
|
|
92
92
|
t.value + 1,
|
|
93
93
|
0,
|
|
94
94
|
e.keyMap.splice(t.value, 1)[0]
|
|
95
95
|
), e?.field.value.moveDown(t.value), e?.attrs?.moveDown?.(t.value);
|
|
96
96
|
}
|
|
97
|
-
return (
|
|
97
|
+
return (s, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
|
|
98
98
|
key: 0,
|
|
99
|
-
class:
|
|
99
|
+
class: c(`${a(d)}-move-down`),
|
|
100
100
|
size: "small",
|
|
101
101
|
icon: a(S),
|
|
102
102
|
underline: a(b)(),
|
|
103
103
|
role: "button",
|
|
104
104
|
"aria-label": "下移条目",
|
|
105
|
-
onClick: $(
|
|
105
|
+
onClick: $(l, ["stop"])
|
|
106
106
|
}, {
|
|
107
107
|
default: h(() => [
|
|
108
|
-
|
|
109
|
-
_(v(
|
|
108
|
+
u(s.$slots, "default", {}, () => [
|
|
109
|
+
_(v(r.title), 1)
|
|
110
110
|
])
|
|
111
111
|
]),
|
|
112
112
|
_: 3
|
|
@@ -116,30 +116,30 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
|
|
|
116
116
|
name: "ArrayBaseMoveUp",
|
|
117
117
|
__name: "array-base-move-up",
|
|
118
118
|
props: {
|
|
119
|
-
title:
|
|
119
|
+
title: {}
|
|
120
120
|
},
|
|
121
|
-
setup(
|
|
122
|
-
const
|
|
123
|
-
function
|
|
121
|
+
setup(n) {
|
|
122
|
+
const r = n, t = k(), e = p();
|
|
123
|
+
function l() {
|
|
124
124
|
x(e?.keyMap) && e.keyMap.splice(
|
|
125
125
|
t.value - 1,
|
|
126
126
|
0,
|
|
127
127
|
e.keyMap.splice(t.value, 1)[0]
|
|
128
128
|
), e?.field.value.moveUp(t.value), e?.attrs?.moveUp?.(t.value);
|
|
129
129
|
}
|
|
130
|
-
return (
|
|
130
|
+
return (s, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
|
|
131
131
|
key: 0,
|
|
132
|
-
class:
|
|
132
|
+
class: c(`${a(d)}-move-up`),
|
|
133
133
|
size: "small",
|
|
134
134
|
icon: a(U),
|
|
135
135
|
underline: a(b)(),
|
|
136
136
|
role: "button",
|
|
137
137
|
"aria-label": "上移条目",
|
|
138
|
-
onClick: $(
|
|
138
|
+
onClick: $(l, ["stop"])
|
|
139
139
|
}, {
|
|
140
140
|
default: h(() => [
|
|
141
|
-
|
|
142
|
-
_(v(
|
|
141
|
+
u(s.$slots, "default", {}, () => [
|
|
142
|
+
_(v(r.title), 1)
|
|
143
143
|
])
|
|
144
144
|
]),
|
|
145
145
|
_: 3
|
|
@@ -149,26 +149,26 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
|
|
|
149
149
|
name: "ArrayBaseRemove",
|
|
150
150
|
__name: "array-base-remove",
|
|
151
151
|
props: {
|
|
152
|
-
title:
|
|
152
|
+
title: {}
|
|
153
153
|
},
|
|
154
|
-
setup(
|
|
155
|
-
const
|
|
156
|
-
function
|
|
154
|
+
setup(n) {
|
|
155
|
+
const r = n, t = k(), e = p();
|
|
156
|
+
function l() {
|
|
157
157
|
x(e?.keyMap) && e?.keyMap?.splice(t.value, 1), e?.field.value.remove(t.value), e?.attrs?.remove?.(t.value);
|
|
158
158
|
}
|
|
159
|
-
return (
|
|
159
|
+
return (s, A) => a(e)?.field.value.pattern === "editable" ? (i(), m(a(y), {
|
|
160
160
|
key: 0,
|
|
161
|
-
class:
|
|
161
|
+
class: c(`${a(d)}-remove`),
|
|
162
162
|
size: "small",
|
|
163
163
|
icon: a(V),
|
|
164
164
|
underline: a(b)(),
|
|
165
165
|
role: "button",
|
|
166
166
|
"aria-label": "移除条目",
|
|
167
|
-
onClick: $(
|
|
167
|
+
onClick: $(l, ["stop"])
|
|
168
168
|
}, {
|
|
169
169
|
default: h(() => [
|
|
170
|
-
|
|
171
|
-
_(v(
|
|
170
|
+
u(s.$slots, "default", {}, () => [
|
|
171
|
+
_(v(r.title), 1)
|
|
172
172
|
])
|
|
173
173
|
]),
|
|
174
174
|
_: 3
|
|
@@ -177,11 +177,11 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
|
|
|
177
177
|
}), J = /* @__PURE__ */ o({
|
|
178
178
|
name: "ArrayBaseSortHandle",
|
|
179
179
|
__name: "array-base-sort-handle",
|
|
180
|
-
setup(
|
|
181
|
-
const
|
|
182
|
-
return (t, e) => a(
|
|
180
|
+
setup(n) {
|
|
181
|
+
const r = p();
|
|
182
|
+
return (t, e) => a(r).field.value?.pattern === "editable" ? (i(), m(a(y), {
|
|
183
183
|
key: 0,
|
|
184
|
-
class:
|
|
184
|
+
class: c(`${a(d)}-sort-handle`),
|
|
185
185
|
size: "small",
|
|
186
186
|
icon: a(z),
|
|
187
187
|
underline: a(b)(),
|
|
@@ -190,7 +190,7 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
|
|
|
190
190
|
"aria-dropeffect": "move"
|
|
191
191
|
}, null, 8, ["class", "icon", "underline"])) : f("", !0);
|
|
192
192
|
}
|
|
193
|
-
}),
|
|
193
|
+
}), se = I(L, {
|
|
194
194
|
Index: K,
|
|
195
195
|
Item: T,
|
|
196
196
|
SortHandle: J,
|
|
@@ -204,6 +204,6 @@ import '../styles/array-base/index.css';const P = /* @__PURE__ */ o({
|
|
|
204
204
|
useRecord: E
|
|
205
205
|
});
|
|
206
206
|
export {
|
|
207
|
-
|
|
207
|
+
se as ArrayBase
|
|
208
208
|
};
|
|
209
209
|
//# sourceMappingURL=index.mjs.map
|