@silver-formily/element-plus 0.0.1-beta.0 → 1.0.1
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/esm/__builtins__/configs/index.d.ts +1 -0
- package/esm/__builtins__/configs/index.mjs +5 -0
- package/esm/__builtins__/configs/index.mjs.map +1 -0
- package/esm/__builtins__/index.d.ts +2 -0
- package/esm/__builtins__/index.mjs +27 -0
- package/esm/__builtins__/index.mjs.map +1 -0
- package/esm/__builtins__/shared/hooks.d.ts +7 -0
- package/esm/__builtins__/shared/hooks.mjs +59 -0
- package/esm/__builtins__/shared/hooks.mjs.map +1 -0
- package/esm/__builtins__/shared/index.d.ts +7 -0
- package/esm/__builtins__/shared/index.mjs +25 -0
- package/esm/__builtins__/shared/index.mjs.map +1 -0
- package/esm/__builtins__/shared/load-config-provider.d.ts +2 -0
- package/esm/__builtins__/shared/load-config-provider.mjs +12 -0
- package/esm/__builtins__/shared/load-config-provider.mjs.map +1 -0
- package/esm/__builtins__/shared/loading.d.ts +12 -0
- package/esm/__builtins__/shared/loading.mjs +49 -0
- package/esm/__builtins__/shared/loading.mjs.map +1 -0
- package/esm/__builtins__/shared/simple-version-compare.d.ts +2 -0
- package/esm/__builtins__/shared/simple-version-compare.mjs +18 -0
- package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -0
- package/esm/__builtins__/shared/transform-component.d.ts +8 -0
- package/esm/__builtins__/shared/transform-component.mjs +49 -0
- package/esm/__builtins__/shared/transform-component.mjs.map +1 -0
- package/esm/__builtins__/shared/types.d.ts +2 -0
- package/esm/__builtins__/shared/types.mjs +2 -0
- package/esm/__builtins__/shared/types.mjs.map +1 -0
- package/esm/__builtins__/shared/utils.d.ts +8 -0
- package/esm/__builtins__/shared/utils.mjs +34 -0
- package/esm/__builtins__/shared/utils.mjs.map +1 -0
- package/esm/array-base/array-base-addition.d.ts +5 -0
- package/esm/array-base/array-base-index.d.ts +19 -0
- package/esm/array-base/array-base-inner.d.ts +18 -0
- package/esm/array-base/array-base-item.d.ts +18 -0
- package/esm/array-base/array-base-move-down.d.ts +18 -0
- package/esm/array-base/array-base-move-up.d.ts +18 -0
- package/esm/array-base/array-base-remove.d.ts +18 -0
- package/esm/array-base/array-base-sort-handle.d.ts +2 -0
- package/esm/array-base/index.d.ts +114 -0
- package/esm/array-base/index.mjs +209 -0
- package/esm/array-base/index.mjs.map +1 -0
- package/esm/array-base/symbols.d.ts +4 -0
- package/esm/array-base/symbols.mjs +6 -0
- package/esm/array-base/symbols.mjs.map +1 -0
- package/esm/array-base/types.d.ts +28 -0
- package/esm/array-base/types.mjs +2 -0
- package/esm/array-base/types.mjs.map +1 -0
- package/esm/array-base/utils.d.ts +18 -0
- package/esm/array-base/utils.mjs +79 -0
- package/esm/array-base/utils.mjs.map +1 -0
- package/esm/array-cards/array-cards.d.ts +13 -0
- package/esm/array-cards/index.d.ts +122 -0
- package/esm/array-cards/index.mjs +119 -0
- package/esm/array-cards/index.mjs.map +1 -0
- package/esm/array-collapse/array-collapse-item.d.ts +18 -0
- package/esm/array-collapse/array-collapse.d.ts +16 -0
- package/esm/array-collapse/index.d.ts +134 -0
- package/esm/array-collapse/index.mjs +177 -0
- package/esm/array-collapse/index.mjs.map +1 -0
- package/esm/array-collapse/utils.d.ts +1 -0
- package/esm/array-collapse/utils.mjs +12 -0
- package/esm/array-collapse/utils.mjs.map +1 -0
- package/esm/array-items/array-items-item.d.ts +30 -0
- package/esm/array-items/array-items.d.ts +2 -0
- package/esm/array-items/index.d.ts +130 -0
- package/esm/array-items/index.mjs +105 -0
- package/esm/array-items/index.mjs.map +1 -0
- package/esm/array-list-tabs/array-list-tabs.d.ts +31 -0
- package/esm/array-list-tabs/index.d.ts +83 -0
- package/esm/array-list-tabs/index.mjs +183 -0
- package/esm/array-list-tabs/index.mjs.map +1 -0
- package/esm/array-list-tabs/utils.d.ts +3 -0
- package/esm/array-list-tabs/utils.mjs +16 -0
- package/esm/array-list-tabs/utils.mjs.map +1 -0
- package/esm/array-table/array-table.d.ts +1477 -0
- package/esm/array-table/index.d.ts +1573 -0
- package/esm/array-table/index.mjs +225 -0
- package/esm/array-table/index.mjs.map +1 -0
- package/esm/array-table/types.d.ts +6 -0
- package/esm/array-table/types.mjs +2 -0
- package/esm/array-table/types.mjs.map +1 -0
- package/esm/array-table/utils.d.ts +5 -0
- package/esm/array-table/utils.mjs +25 -0
- package/esm/array-table/utils.mjs.map +1 -0
- package/esm/array-tabs/array-tabs.d.ts +2 -0
- package/esm/array-tabs/index.d.ts +2 -0
- package/esm/array-tabs/index.mjs +87 -0
- package/esm/array-tabs/index.mjs.map +1 -0
- package/esm/cascader/cascader.d.ts +30 -0
- package/esm/cascader/index.d.ts +41 -0
- package/esm/cascader/index.mjs +54 -0
- package/esm/cascader/index.mjs.map +1 -0
- package/esm/checkbox/checkbox-group.d.ts +58 -0
- package/esm/checkbox/index.d.ts +779 -0
- package/esm/checkbox/index.mjs +83 -0
- package/esm/checkbox/index.mjs.map +1 -0
- package/esm/date-picker/index.d.ts +2 -0
- package/esm/date-picker/index.mjs +57 -0
- package/esm/date-picker/index.mjs.map +1 -0
- package/esm/editable/editable-popover.d.ts +25 -0
- package/esm/editable/editable.d.ts +187 -0
- package/esm/editable/index.d.ts +147 -0
- package/esm/editable/index.mjs +225 -0
- package/esm/editable/index.mjs.map +1 -0
- package/esm/form/form.d.ts +46 -0
- package/esm/form/form.mjs +71 -0
- package/esm/form/form.mjs.map +1 -0
- package/esm/form/index.d.ts +1 -0
- package/esm/form/index.mjs +6 -0
- package/esm/form/index.mjs.map +1 -0
- package/esm/form-button-group/form-button-group-sticky.d.ts +17 -0
- package/esm/form-button-group/form-button-group.d.ts +48 -0
- package/esm/form-button-group/index.d.ts +87 -0
- package/esm/form-button-group/index.mjs +87 -0
- package/esm/form-button-group/index.mjs.map +1 -0
- package/esm/form-button-group/utils.d.ts +1 -0
- package/esm/form-button-group/utils.mjs +12 -0
- package/esm/form-button-group/utils.mjs.map +1 -0
- package/esm/form-collapse/form-collapse.d.ts +18 -0
- package/esm/form-collapse/index.d.ts +45 -0
- package/esm/form-collapse/index.mjs +87 -0
- package/esm/form-collapse/index.mjs.map +1 -0
- package/esm/form-collapse/utils.d.ts +31 -0
- package/esm/form-collapse/utils.mjs +50 -0
- package/esm/form-collapse/utils.mjs.map +1 -0
- package/esm/form-dialog/dialog-content.d.ts +60 -0
- package/esm/form-dialog/index.d.ts +4 -0
- package/esm/form-dialog/index.mjs +208 -0
- package/esm/form-dialog/index.mjs.map +1 -0
- package/esm/form-dialog/types.d.ts +32 -0
- package/esm/form-dialog/types.mjs +2 -0
- package/esm/form-dialog/types.mjs.map +1 -0
- package/esm/form-drawer/drawer-content.d.ts +60 -0
- package/esm/form-drawer/index.d.ts +4 -0
- package/esm/form-drawer/index.mjs +202 -0
- package/esm/form-drawer/index.mjs.map +1 -0
- package/esm/form-drawer/types.d.ts +32 -0
- package/esm/form-drawer/types.mjs +2 -0
- package/esm/form-drawer/types.mjs.map +1 -0
- package/esm/form-grid/form-grid-column.d.ts +29 -0
- package/esm/form-grid/form-grid.d.ts +101 -0
- package/esm/form-grid/hooks.d.ts +5 -0
- package/esm/form-grid/hooks.mjs +14 -0
- package/esm/form-grid/hooks.mjs.map +1 -0
- package/esm/form-grid/index.d.ts +184 -0
- package/esm/form-grid/index.mjs +107 -0
- package/esm/form-grid/index.mjs.map +1 -0
- package/esm/form-item/form-item.d.ts +18 -0
- package/esm/form-item/index.d.ts +70 -0
- package/esm/form-item/index.mjs +331 -0
- package/esm/form-item/index.mjs.map +1 -0
- package/esm/form-item/types.d.ts +25 -0
- package/esm/form-item/types.mjs +2 -0
- package/esm/form-item/types.mjs.map +1 -0
- package/esm/form-item/utils.d.ts +3 -0
- package/esm/form-item/utils.mjs +17 -0
- package/esm/form-item/utils.mjs.map +1 -0
- package/esm/form-layout/form-layout.d.ts +32 -0
- package/esm/form-layout/form-layout.mjs +83 -0
- package/esm/form-layout/form-layout.mjs.map +1 -0
- package/esm/form-layout/index.d.ts +1 -0
- package/esm/form-layout/index.mjs +6 -0
- package/esm/form-layout/index.mjs.map +1 -0
- package/esm/form-layout/types.d.ts +43 -0
- package/esm/form-layout/types.mjs +2 -0
- package/esm/form-layout/types.mjs.map +1 -0
- package/esm/form-layout/utils.d.ts +57 -0
- package/esm/form-layout/utils.mjs +109 -0
- package/esm/form-layout/utils.mjs.map +1 -0
- package/esm/form-step/form-step-pane.d.ts +2 -0
- package/esm/form-step/form-step.d.ts +5 -0
- package/esm/form-step/index.d.ts +24 -0
- package/esm/form-step/index.mjs +92 -0
- package/esm/form-step/index.mjs.map +1 -0
- package/esm/form-step/types.d.ts +21 -0
- package/esm/form-step/types.mjs +2 -0
- package/esm/form-step/types.mjs.map +1 -0
- package/esm/form-step/utils.d.ts +11 -0
- package/esm/form-step/utils.mjs +64 -0
- package/esm/form-step/utils.mjs.map +1 -0
- package/esm/form-tab/form-tab.d.ts +7 -0
- package/esm/form-tab/hooks.d.ts +7 -0
- package/esm/form-tab/hooks.mjs +24 -0
- package/esm/form-tab/hooks.mjs.map +1 -0
- package/esm/form-tab/index.d.ts +28 -0
- package/esm/form-tab/index.mjs +77 -0
- package/esm/form-tab/index.mjs.map +1 -0
- package/esm/form-tab/types.d.ts +12 -0
- package/esm/form-tab/types.mjs +2 -0
- package/esm/form-tab/types.mjs.map +1 -0
- package/esm/form-tab/utils.d.ts +4 -0
- package/esm/form-tab/utils.mjs +14 -0
- package/esm/form-tab/utils.mjs.map +1 -0
- package/esm/index.d.ts +37 -0
- package/esm/index.mjs +81 -0
- package/esm/index.mjs.map +1 -0
- package/esm/input/index.d.ts +84 -0
- package/esm/input/index.mjs +77 -0
- package/esm/input/index.mjs.map +1 -0
- package/esm/input/input.d.ts +32 -0
- package/esm/input-number/index.d.ts +4 -0
- package/esm/input-number/index.mjs +30 -0
- package/esm/input-number/index.mjs.map +1 -0
- package/esm/pagination/components/jumper.d.ts +16 -0
- package/esm/pagination/components/jumper.mjs +12 -0
- package/esm/pagination/components/jumper.mjs.map +1 -0
- package/esm/pagination/components/next.d.ts +42 -0
- package/esm/pagination/components/next.mjs +23 -0
- package/esm/pagination/components/next.mjs.map +1 -0
- package/esm/pagination/components/pager.d.ts +42 -0
- package/esm/pagination/components/pager.mjs +23 -0
- package/esm/pagination/components/pager.mjs.map +1 -0
- package/esm/pagination/components/prev.d.ts +39 -0
- package/esm/pagination/components/prev.mjs +22 -0
- package/esm/pagination/components/prev.mjs.map +1 -0
- package/esm/pagination/components/sizes.d.ts +56 -0
- package/esm/pagination/components/sizes.mjs +7 -0
- package/esm/pagination/components/sizes.mjs.map +1 -0
- package/esm/pagination/components/total.d.ts +8 -0
- package/esm/pagination/components/total.mjs +11 -0
- package/esm/pagination/components/total.mjs.map +1 -0
- package/esm/pagination/pagination.d.ts +128 -0
- package/esm/pagination/pagination.mjs +629 -0
- package/esm/pagination/pagination.mjs.map +1 -0
- package/esm/password/index.d.ts +86 -0
- package/esm/password/index.mjs +14 -0
- package/esm/password/index.mjs.map +1 -0
- package/esm/preview-text/cascader.d.ts +5 -0
- package/esm/preview-text/date-picker.d.ts +5 -0
- package/esm/preview-text/index.d.ts +102 -0
- package/esm/preview-text/index.mjs +314 -0
- package/esm/preview-text/index.mjs.map +1 -0
- package/esm/preview-text/input.d.ts +28 -0
- package/esm/preview-text/preview.d.ts +18 -0
- package/esm/preview-text/select.d.ts +5 -0
- package/esm/preview-text/time-picker.d.ts +5 -0
- package/esm/preview-text/tree.d.ts +22 -0
- package/esm/preview-text/utils.d.ts +14 -0
- package/esm/preview-text/utils.mjs +16 -0
- package/esm/preview-text/utils.mjs.map +1 -0
- package/esm/radio/index.d.ts +370 -0
- package/esm/radio/index.mjs +80 -0
- package/esm/radio/index.mjs.map +1 -0
- package/esm/radio/radio-group.d.ts +44 -0
- package/esm/reset/index.d.ts +63 -0
- package/esm/reset/index.mjs +44 -0
- package/esm/reset/index.mjs.map +1 -0
- package/esm/reset/reset.d.ts +45 -0
- package/esm/select/index.d.ts +142 -0
- package/esm/select/index.mjs +132 -0
- package/esm/select/index.mjs.map +1 -0
- package/esm/select/select.d.ts +50 -0
- package/esm/select-table/index.d.ts +1530 -0
- package/esm/select-table/index.mjs +205 -0
- package/esm/select-table/index.mjs.map +1 -0
- package/esm/select-table/select-table.d.ts +2974 -0
- package/esm/select-table/types.d.ts +17 -0
- package/esm/select-table/types.mjs +2 -0
- package/esm/select-table/types.mjs.map +1 -0
- package/esm/space/index.d.ts +1 -0
- package/esm/space/index.mjs +6 -0
- package/esm/space/index.mjs.map +1 -0
- package/esm/styles/array-base/index.css +1 -0
- package/esm/styles/array-cards/index.css +1 -0
- package/esm/styles/array-collapse/index.css +1 -0
- package/esm/styles/array-items/index.css +1 -0
- package/esm/styles/array-list-tabs/index.css +1 -0
- package/esm/styles/array-table/index.css +1 -0
- package/esm/styles/array-tabs/index.css +1 -0
- package/esm/styles/editable/index.css +1 -0
- package/esm/styles/form-button-group/index.css +1 -0
- package/esm/styles/form-collapse/index.css +1 -0
- package/esm/styles/form-grid/index.css +1 -0
- package/esm/styles/form-item/index.css +1 -0
- package/esm/styles/form-tab/index.css +1 -0
- package/esm/styles/preview-text/index.css +1 -0
- package/esm/styles/radio/index.css +1 -0
- package/esm/styles/select-table/index.css +1 -0
- package/esm/submit/index.d.ts +48 -0
- package/esm/submit/index.mjs +40 -0
- package/esm/submit/index.mjs.map +1 -0
- package/esm/submit/submit.d.ts +36 -0
- package/esm/switch/index.d.ts +4 -0
- package/esm/switch/index.mjs +19 -0
- package/esm/switch/index.mjs.map +1 -0
- package/esm/time-picker/index.d.ts +4 -0
- package/esm/time-picker/index.mjs +21 -0
- package/esm/time-picker/index.mjs.map +1 -0
- package/esm/time-select/index.d.ts +2 -0
- package/esm/time-select/index.mjs +21 -0
- package/esm/time-select/index.mjs.map +1 -0
- package/esm/transfer/index.d.ts +186 -0
- package/esm/transfer/index.mjs +11 -0
- package/esm/transfer/index.mjs.map +1 -0
- package/esm/tree/index.d.ts +42 -0
- package/esm/tree/index.mjs +104 -0
- package/esm/tree/index.mjs.map +1 -0
- package/esm/tree/tree.d.ts +20 -0
- package/esm/tree/types.d.ts +13 -0
- package/esm/tree/types.mjs +2 -0
- package/esm/tree/types.mjs.map +1 -0
- package/esm/tree/utils.d.ts +45 -0
- package/esm/tree/utils.mjs +161 -0
- package/esm/tree/utils.mjs.map +1 -0
- package/esm/tree-select/index.d.ts +32 -0
- package/esm/tree-select/index.mjs +47 -0
- package/esm/tree-select/index.mjs.map +1 -0
- package/esm/tree-select/tree-select.d.ts +17 -0
- package/esm/upload/index.d.ts +707 -0
- package/esm/upload/index.mjs +175 -0
- package/esm/upload/index.mjs.map +1 -0
- package/esm/upload/upload.d.ts +1249 -0
- package/esm/vendor/icon.mjs +11 -0
- package/esm/vendor/icon.mjs.map +1 -0
- package/esm/vendor/lodash.mjs +1400 -0
- package/esm/vendor/lodash.mjs.map +1 -0
- package/esm/vendor/runtime.mjs +35 -0
- package/esm/vendor/runtime.mjs.map +1 -0
- package/esm/vendor/shared.esm-bundler.mjs +14 -0
- package/esm/vendor/shared.esm-bundler.mjs.map +1 -0
- package/esm/vendor/sizes.mjs +27 -0
- package/esm/vendor/sizes.mjs.map +1 -0
- package/esm/vendor/types.mjs +19 -0
- package/esm/vendor/types.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { defineComponent as X, computed as z, ref as y, watch as Y, createElementBlock as m, openBlock as n, normalizeClass as F, unref as a, createBlock as u, withCtx as f, createVNode as Z, createCommentVNode as A, withDirectives as ee, mergeProps as b, Fragment as k, renderList as _, resolveDynamicComponent as re, createElementVNode as ae, createTextVNode as te, toDisplayString as ne, nextTick as oe } from "vue";
|
|
2
|
+
import { ElTable as le, ElTableColumn as se, vLoading as ie } from "element-plus";
|
|
3
|
+
import { reaction as ue, autorun as pe, observable as S } from "@formily/reactive";
|
|
4
|
+
import "@formily/core";
|
|
5
|
+
import "@formily/reactive-vue";
|
|
6
|
+
import { useField as de, useFieldSchema as ce, RecursionField as R } from "@formily/vue";
|
|
7
|
+
import { useCleanAttrs as me, composeExport as fe } from "../__builtins__/shared/utils.mjs";
|
|
8
|
+
import { ArrayBase as o } from "../array-base/index.mjs";
|
|
9
|
+
import { isEqual as ve, isArr as w } from "@formily/shared";
|
|
10
|
+
import { VueDraggable as ye } from "vue-draggable-plus";
|
|
11
|
+
import { stylePrefix as ge } from "../__builtins__/configs/index.mjs";
|
|
12
|
+
import { isAdditionComponent as be } from "../array-base/utils.mjs";
|
|
13
|
+
import ke from "../pagination/pagination.mjs";
|
|
14
|
+
import { isColumnComponent as B, prefixCls as D, isTableComponent as xe, hasRequiredProperty as he } from "./utils.mjs";
|
|
15
|
+
import { o as Pe } from "../vendor/lodash.mjs";
|
|
16
|
+
import '../styles/array-table/index.css';const Ce = { key: 1 }, Te = /* @__PURE__ */ X({
|
|
17
|
+
name: "FArrayTable",
|
|
18
|
+
inheritAttrs: !1,
|
|
19
|
+
__name: "array-table",
|
|
20
|
+
props: {
|
|
21
|
+
value: { default: () => [] },
|
|
22
|
+
pagination: { type: Boolean, default: !0 },
|
|
23
|
+
paginationProps: null
|
|
24
|
+
},
|
|
25
|
+
setup(N) {
|
|
26
|
+
const d = N, { props: U } = me(), V = z(() => Pe(d.paginationProps, ["pageSize", "currentPage"])), x = de(), l = x.value, h = ce(), { getKey: P, keyMap: $ } = o.useKey(h.value), E = y();
|
|
27
|
+
function I(e) {
|
|
28
|
+
return xe(e) ? H(e) : e.properties ? Object.values(e.properties).flatMap((t) => I(t)) : [];
|
|
29
|
+
}
|
|
30
|
+
function H(e) {
|
|
31
|
+
const t = e["x-component-props"]?.prop || e.name;
|
|
32
|
+
/* istanbul ignore if -- @preserve */
|
|
33
|
+
if (!t)
|
|
34
|
+
return [];
|
|
35
|
+
const r = x.value.query(x.value.address.concat(t)).take();
|
|
36
|
+
return [{
|
|
37
|
+
name: t,
|
|
38
|
+
display: r?.display || e["x-display"],
|
|
39
|
+
required: he(e),
|
|
40
|
+
field: r,
|
|
41
|
+
fieldProps: r?.props || e.toFieldProps(),
|
|
42
|
+
schema: e,
|
|
43
|
+
columnProps: r?.component?.[1] || e["x-component-props"] || {}
|
|
44
|
+
}];
|
|
45
|
+
}
|
|
46
|
+
const C = y(0);
|
|
47
|
+
ue(() => {
|
|
48
|
+
const e = l.path.entire;
|
|
49
|
+
return l.query(`${e}.*`).map((t) => ({
|
|
50
|
+
name: t.component[0],
|
|
51
|
+
visible: t.visible
|
|
52
|
+
})).filter((t) => t.name.includes("Column"));
|
|
53
|
+
}, async () => {
|
|
54
|
+
C.value++;
|
|
55
|
+
}, { equals: ve });
|
|
56
|
+
const v = y([]), c = y(d.paginationProps?.pageSize ?? 10), p = y(d.paginationProps?.currentPage ?? 1);
|
|
57
|
+
function M() {
|
|
58
|
+
/* istanbul ignore if -- @preserve */
|
|
59
|
+
if (!w(l.value)) {
|
|
60
|
+
v.value = [];
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (d.pagination === !1) {
|
|
64
|
+
v.value = [...l.value];
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
v.value = l.value.slice((p.value - 1) * c.value, p.value * c.value);
|
|
68
|
+
}
|
|
69
|
+
Y([c, p], M), pe(M);
|
|
70
|
+
const T = S.computed(() => {
|
|
71
|
+
const e = h.value.items;
|
|
72
|
+
return (w(e) ? e : [e]).reduce((r, i) => {
|
|
73
|
+
const s = I(i);
|
|
74
|
+
return r.concat(s);
|
|
75
|
+
}, []).filter((r) => r.display !== "none");
|
|
76
|
+
}), K = S.computed(() => T.value.map((e, t) => ({ source: e, index: t })).filter(({ source: e }) => e.display === "visible" && B(e.schema)).map(({ source: e, index: t }) => {
|
|
77
|
+
const { name: r, columnProps: i, required: s, field: g } = e, { title: W, asterisk: G, ...J } = i, Q = {
|
|
78
|
+
label: W,
|
|
79
|
+
...J,
|
|
80
|
+
prop: r
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
key: t,
|
|
84
|
+
props: Q,
|
|
85
|
+
field: g,
|
|
86
|
+
asterisk: G ?? s
|
|
87
|
+
};
|
|
88
|
+
})), L = S.computed(() => T.value.filter((e) => e.display !== "none" && B(e.schema))), q = z(() => (p.value - 1) * c.value);
|
|
89
|
+
async function O() {
|
|
90
|
+
if (d.pagination === !1) {
|
|
91
|
+
await oe();
|
|
92
|
+
const e = E.value?.$el.querySelector(".el-scrollbar__wrap");
|
|
93
|
+
e?.scrollTo({
|
|
94
|
+
top: e.scrollHeight,
|
|
95
|
+
behavior: "smooth"
|
|
96
|
+
});
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (!w(l.value)) {
|
|
100
|
+
p.value = 1;
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
p.value = Math.ceil(l.value.length / c.value);
|
|
104
|
+
}
|
|
105
|
+
async function j(e) {
|
|
106
|
+
const { oldIndex: t, newIndex: r } = e;
|
|
107
|
+
await l.move(t, r), C.value++;
|
|
108
|
+
}
|
|
109
|
+
return (e, t) => (n(), m("div", {
|
|
110
|
+
class: F(a(D))
|
|
111
|
+
}, [
|
|
112
|
+
(n(), u(a(o), {
|
|
113
|
+
key: C.value,
|
|
114
|
+
"key-map": a($),
|
|
115
|
+
add: O
|
|
116
|
+
}, {
|
|
117
|
+
default: f(() => [
|
|
118
|
+
Z(a(ye), {
|
|
119
|
+
"model-value": v.value,
|
|
120
|
+
target: "tbody",
|
|
121
|
+
handle: `.${a(ge)}-array-base-sort-handle`,
|
|
122
|
+
animation: 150,
|
|
123
|
+
onEnd: j
|
|
124
|
+
}, {
|
|
125
|
+
default: f(() => [
|
|
126
|
+
ee((n(), u(a(le), b({
|
|
127
|
+
ref_key: "elTableRef",
|
|
128
|
+
ref: E,
|
|
129
|
+
"row-key": a(P),
|
|
130
|
+
data: v.value
|
|
131
|
+
}, a(U)), {
|
|
132
|
+
default: f(() => [
|
|
133
|
+
(n(!0), m(k, null, _(a(K).value, (r, i) => (n(), u(a(se), b({
|
|
134
|
+
key: r.key,
|
|
135
|
+
ref_for: !0
|
|
136
|
+
}, r.props), {
|
|
137
|
+
default: f(({ row: s, $index: g }) => [
|
|
138
|
+
(n(), u(a(o).Item, {
|
|
139
|
+
key: a(P)(s),
|
|
140
|
+
index: g + q.value,
|
|
141
|
+
record: s
|
|
142
|
+
}, {
|
|
143
|
+
default: f(() => [
|
|
144
|
+
(n(), u(a(R), {
|
|
145
|
+
key: `${a(P)(s)}`,
|
|
146
|
+
schema: a(T).value[i].schema,
|
|
147
|
+
name: g + q.value,
|
|
148
|
+
"only-render-properties": ""
|
|
149
|
+
}, null, 8, ["schema", "name"]))
|
|
150
|
+
]),
|
|
151
|
+
_: 2
|
|
152
|
+
}, 1032, ["index", "record"]))
|
|
153
|
+
]),
|
|
154
|
+
header: f(({ column: s }) => [
|
|
155
|
+
r.field.content?.header ? (n(), u(re(r.field.content.header), b({
|
|
156
|
+
key: 0,
|
|
157
|
+
ref_for: !0
|
|
158
|
+
}, { ...s, field: a(l) }), null, 16)) : r.asterisk ? (n(), m("span", Ce, [
|
|
159
|
+
ae("span", {
|
|
160
|
+
class: F(`${a(D)}-asterisk`)
|
|
161
|
+
}, "*", 2),
|
|
162
|
+
te(" " + ne(s.label), 1)
|
|
163
|
+
])) : A("", !0)
|
|
164
|
+
]),
|
|
165
|
+
_: 2
|
|
166
|
+
}, 1040))), 128))
|
|
167
|
+
]),
|
|
168
|
+
_: 1
|
|
169
|
+
}, 16, ["row-key", "data"])), [
|
|
170
|
+
[a(ie), a(l).loading]
|
|
171
|
+
])
|
|
172
|
+
]),
|
|
173
|
+
_: 1
|
|
174
|
+
}, 8, ["model-value", "handle"]),
|
|
175
|
+
(n(!0), m(k, null, _(a(L).value, (r, i) => (n(), u(a(R), {
|
|
176
|
+
key: i,
|
|
177
|
+
name: r.name,
|
|
178
|
+
schema: r.schema,
|
|
179
|
+
"only-render-self": !0
|
|
180
|
+
}, null, 8, ["name", "schema"]))), 128)),
|
|
181
|
+
d.pagination ? (n(), u(a(ke), b({
|
|
182
|
+
key: 0,
|
|
183
|
+
"current-page": p.value,
|
|
184
|
+
"onUpdate:currentPage": t[0] || (t[0] = (r) => p.value = r),
|
|
185
|
+
"page-size": c.value,
|
|
186
|
+
"onUpdate:pageSize": t[1] || (t[1] = (r) => c.value = r),
|
|
187
|
+
class: `${a(D)}-pagination`,
|
|
188
|
+
background: "",
|
|
189
|
+
layout: "total, sizes, prev, pager, next",
|
|
190
|
+
total: d.value.length
|
|
191
|
+
}, V.value), null, 16, ["current-page", "page-size", "class", "total"])) : A("", !0),
|
|
192
|
+
(n(!0), m(k, null, _(a(h).properties, (r, i) => (n(), m(k, { key: i }, [
|
|
193
|
+
a(be)(r) ? (n(), u(a(R), {
|
|
194
|
+
key: 0,
|
|
195
|
+
schema: r,
|
|
196
|
+
name: "addition"
|
|
197
|
+
}, null, 8, ["schema"])) : A("", !0)
|
|
198
|
+
], 64))), 128))
|
|
199
|
+
]),
|
|
200
|
+
_: 1
|
|
201
|
+
}, 8, ["key-map"]))
|
|
202
|
+
], 2));
|
|
203
|
+
}
|
|
204
|
+
}), Ae = {
|
|
205
|
+
name: "FArrayTableColumn",
|
|
206
|
+
render() {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
}, $e = fe(Te, {
|
|
210
|
+
Column: Ae,
|
|
211
|
+
Index: o.Index,
|
|
212
|
+
SortHandle: o.SortHandle,
|
|
213
|
+
Addition: o.Addition,
|
|
214
|
+
Remove: o.Remove,
|
|
215
|
+
MoveDown: o.MoveDown,
|
|
216
|
+
MoveUp: o.MoveUp,
|
|
217
|
+
useArray: o.useArray,
|
|
218
|
+
useIndex: o.useIndex,
|
|
219
|
+
useRecord: o.useRecord
|
|
220
|
+
});
|
|
221
|
+
export {
|
|
222
|
+
$e as ArrayTable,
|
|
223
|
+
$e as default
|
|
224
|
+
};
|
|
225
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/array-table/array-table.vue","../../src/array-table/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ArrayField } from '@formily/core'\nimport type { Schema } from '@formily/vue'\nimport type { TableInstance } from 'element-plus'\nimport type { IArrayTableProps } from './types'\nimport { autorun, observable, reaction } from '@formily/reactive'\nimport { isArr, isEqual } from '@formily/shared'\nimport { RecursionField, useField, useFieldSchema } from '@formily/vue'\nimport { ElTable, ElTableColumn, vLoading } from 'element-plus'\nimport { omit } from 'lodash-es'\nimport { computed, nextTick, ref, watch } from 'vue'\nimport { VueDraggable } from 'vue-draggable-plus'\nimport { stylePrefix, useCleanAttrs } from '../__builtins__'\nimport { ArrayBase } from '../array-base'\nimport { isAdditionComponent } from '../array-base/utils'\nimport ElPagination from '../pagination/pagination'\nimport { hasRequiredProperty, isColumnComponent, isTableComponent, prefixCls } from './utils'\n\ndefineOptions({\n name: 'FArrayTable',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n value: { default: () => [] },\n pagination: { type: Boolean, default: true },\n paginationProps: null\n})\nconst { props: elTableProps } = useCleanAttrs()\nconst paginationProps = computed(() => omit(props.paginationProps, ['pageSize', 'currentPage']))\nconst fieldRef = useField<ArrayField>()\nconst field = fieldRef.value\nconst schemaRef = useFieldSchema()\nconst { getKey, keyMap } = ArrayBase.useKey(schemaRef.value)\n\nconst elTableRef = ref<TableInstance>()\n\nfunction extractTableSources(schema: Schema): any[] {\n if (isTableComponent(schema)) {\n return createTableSource(schema)\n }\n return schema.properties\n ? Object.values(schema.properties).flatMap(element => extractTableSources(element))\n : []\n}\n\nfunction createTableSource(schema: Schema): any[] {\n const propName = schema['x-component-props']?.prop || schema.name\n /* istanbul ignore if -- @preserve */\n if (!propName)\n return []\n\n const field = fieldRef.value.query(fieldRef.value.address.concat(propName)).take()\n\n return [{\n name: propName,\n display: field?.display || schema['x-display'],\n required: hasRequiredProperty(schema),\n field,\n fieldProps: field?.props || schema.toFieldProps(),\n schema,\n columnProps: (field?.component as any[])?.[1] || schema['x-component-props'] || {},\n }]\n}\n\nconst triggerUpdateKey = ref(0)\nreaction(() => {\n const path = field.path.entire\n return field.query(`${path}.*`).map((item) => {\n return {\n name: item.component[0],\n visible: item.visible,\n }\n }).filter(item => item.name.includes('Column'))\n}, async () => {\n triggerUpdateKey.value++\n}, { equals: isEqual })\n\nconst dataSource = ref([])\nconst pageSize = ref(props.paginationProps?.pageSize ?? 10)\nconst currentPage = ref(props.paginationProps?.currentPage ?? 1)\n\nfunction updateDataSource() {\n /* istanbul ignore if -- @preserve */\n if (!isArr(field.value)) {\n dataSource.value = []\n return\n }\n if (props.pagination === false) {\n dataSource.value = [...field.value]\n return\n }\n dataSource.value = field.value.slice((currentPage.value - 1) * pageSize.value, (currentPage.value) * pageSize.value)\n}\nwatch([pageSize, currentPage], updateDataSource)\nautorun(updateDataSource)\n\nconst sources = observable.computed(() => {\n const schema = schemaRef.value.items\n const items = isArr(schema) ? schema : [schema]\n return items.reduce((columns, schema) => {\n const item = extractTableSources(schema)\n return columns.concat(item)\n }, []).filter(item => item.display !== 'none')\n})\n\nconst columns = observable.computed(() => {\n return sources.value\n .map((source, index) => ({ source, index }))\n .filter(({ source }) => source.display === 'visible' && isColumnComponent(source.schema))\n .map(({ source, index: key }) => {\n const { name, columnProps, required, field } = source\n const { title, asterisk, ...restProps } = columnProps\n const props = {\n label: title,\n ...restProps,\n prop: name,\n }\n return {\n key,\n props,\n field,\n asterisk: asterisk ?? required,\n }\n })\n})\n\nconst stateManagerColumns = observable.computed(() => {\n return sources.value.filter((column) => {\n return column.display !== 'none' && isColumnComponent(column.schema)\n })\n})\n\nconst baseIndex = computed(() => {\n return (currentPage.value - 1) * pageSize.value\n})\n\nasync function onAddItemClick() {\n if (props.pagination === false) {\n await nextTick()\n const scrollWarpDOM = elTableRef.value?.$el.querySelector('.el-scrollbar__wrap')\n scrollWarpDOM?.scrollTo({\n top: scrollWarpDOM.scrollHeight,\n behavior: 'smooth',\n })\n return\n }\n if (!isArr(field.value)) {\n currentPage.value = 1\n return\n }\n currentPage.value = Math.ceil(field.value.length / pageSize.value)\n}\n\nasync function handleDragEnd(evt: { oldIndex: number, newIndex: number }) {\n const { oldIndex, newIndex } = evt\n await field.move(oldIndex, newIndex)\n triggerUpdateKey.value++\n}\n</script>\n\n<template>\n <div :class=\"prefixCls\">\n <ArrayBase :key=\"triggerUpdateKey\" :key-map=\"keyMap\" :add=\"onAddItemClick\">\n <VueDraggable\n :model-value=\"dataSource\" target=\"tbody\" :handle=\"`.${stylePrefix}-array-base-sort-handle`\"\n :animation=\"150\" @end=\"handleDragEnd\"\n >\n <ElTable ref=\"elTableRef\" v-loading=\"field.loading\" :row-key=\"getKey\" :data=\"dataSource\" v-bind=\"elTableProps\">\n <template v-for=\"(column, colIndex) of columns.value\" :key=\"column.key\">\n <ElTableColumn v-bind=\"column.props\">\n <template #default=\"{ row, $index }\">\n <ArrayBase.Item :key=\"getKey(row)\" :index=\"$index + baseIndex\" :record=\"row\">\n <RecursionField\n :key=\"`${getKey(row)}`\" :schema=\"sources.value[colIndex].schema\"\n :name=\"$index + baseIndex\" only-render-properties\n />\n </ArrayBase.Item>\n </template>\n <template #header=\"{ column: col }\">\n <template v-if=\"column.field.content?.header\">\n <component :is=\"column.field.content.header\" v-bind=\"{ ...col, field }\" />\n </template>\n <span v-else-if=\"column.asterisk\">\n <span :class=\"`${prefixCls}-asterisk`\">*</span>\n {{ col.label }}\n </span>\n </template>\n </ElTableColumn>\n </template>\n </ElTable>\n </VueDraggable>\n\n <!-- 状态管理器 -->\n <template v-for=\"(column, key) of stateManagerColumns.value\" :key=\"key\">\n <RecursionField :name=\"column.name\" :schema=\"column.schema\" :only-render-self=\"true\" />\n </template>\n <ElPagination\n v-if=\"props.pagination\" v-model:current-page=\"currentPage\" v-model:page-size=\"pageSize\"\n :class=\"`${prefixCls}-pagination`\" background layout=\"total, sizes, prev, pager, next\"\n :total=\"props.value.length\" v-bind=\"paginationProps\"\n />\n <template v-for=\"(itemSchema, key) of schemaRef.properties\" :key=\"key\">\n <RecursionField v-if=\"isAdditionComponent(itemSchema)\" :schema=\"itemSchema\" name=\"addition\" />\n </template>\n </ArrayBase>\n </div>\n</template>\n","import type { Component } from 'vue'\nimport { composeExport } from '../__builtins__/shared'\nimport { ArrayBase } from '../array-base'\nimport ArrayTableInner from './array-table.vue'\nimport './style.scss'\n\nconst ArrayTableColumn: Component = {\n name: 'FArrayTableColumn',\n render() {\n return null\n },\n}\n\nexport const ArrayTable = composeExport(ArrayTableInner, {\n Column: ArrayTableColumn,\n Index: ArrayBase.Index,\n SortHandle: ArrayBase.SortHandle,\n Addition: ArrayBase.Addition,\n Remove: ArrayBase.Remove,\n MoveDown: ArrayBase.MoveDown,\n MoveUp: ArrayBase.MoveUp,\n useArray: ArrayBase.useArray,\n useIndex: ArrayBase.useIndex,\n useRecord: ArrayBase.useRecord,\n})\n\nexport default ArrayTable\n"],"names":["props","__props","elTableProps","useCleanAttrs","paginationProps","computed","omit","fieldRef","useField","field","schemaRef","useFieldSchema","getKey","keyMap","ArrayBase","elTableRef","ref","extractTableSources","schema","isTableComponent","createTableSource","element","propName","hasRequiredProperty","triggerUpdateKey","reaction","path","item","isEqual","dataSource","pageSize","currentPage","updateDataSource","isArr","watch","autorun","sources","observable","columns","source","index","isColumnComponent","key","name","columnProps","required","title","asterisk","restProps","stateManagerColumns","column","baseIndex","onAddItemClick","nextTick","scrollWarpDOM","handleDragEnd","evt","oldIndex","newIndex","_createElementBlock","_unref","prefixCls","_createBlock","_createVNode","VueDraggable","stylePrefix","_withDirectives","_openBlock","_mergeProps","_Fragment","colIndex","_withCtx","row","$index","RecursionField","col","_resolveDynamicComponent","_hoisted_1","_createElementVNode","_toDisplayString","vLoading","$event","itemSchema","isAdditionComponent","ArrayTableColumn","ArrayTable","composeExport","ArrayTableInner"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,UAAMA,IAAQC,GAKR,EAAE,OAAOC,EAAA,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A8FF,EAAAc,CAAA,GAAA;AAAA;cAAtC,QAAQQ;AAAA,cAAY,MAAK;AAAA,YAAA;;;;;;;ICrMnFE,KAA8B;AAAA,EAClC,MAAM;AAAA,EACN,SAAS;AACP,WAAO;AAAA,EACT;AACF,GAEaC,KAAaC,GAAcC,IAAiB;AAAA,EACvD,QAAQH;AAAA,EACR,OAAOtE,EAAU;AAAA,EACjB,YAAYA,EAAU;AAAA,EACtB,UAAUA,EAAU;AAAA,EACpB,QAAQA,EAAU;AAAA,EAClB,UAAUA,EAAU;AAAA,EACpB,QAAQA,EAAU;AAAA,EAClB,UAAUA,EAAU;AAAA,EACpB,UAAUA,EAAU;AAAA,EACpB,WAAWA,EAAU;AACvB,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Schema } from '@formily/json-schema';
|
|
2
|
+
export declare const prefixCls = "formily-element-plus-array-table";
|
|
3
|
+
export declare function isColumnComponent(schema: Schema): boolean;
|
|
4
|
+
export declare function isTableComponent(schema: Schema): boolean;
|
|
5
|
+
export declare function hasRequiredProperty(schema: Schema): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { stylePrefix as n } from "../__builtins__/configs/index.mjs";
|
|
2
|
+
import "vue";
|
|
3
|
+
import "element-plus";
|
|
4
|
+
import "@formily/reactive";
|
|
5
|
+
import "@formily/core";
|
|
6
|
+
import "@formily/reactive-vue";
|
|
7
|
+
import "@formily/vue";
|
|
8
|
+
import { isOperationComponent as e, isAdditionComponent as i } from "../array-base/utils.mjs";
|
|
9
|
+
const x = `${n}-array-table`;
|
|
10
|
+
function p(o) {
|
|
11
|
+
return o["x-component"]?.indexOf("Column") > -1;
|
|
12
|
+
}
|
|
13
|
+
function c(o) {
|
|
14
|
+
return p(o) || e(o) || i(o);
|
|
15
|
+
}
|
|
16
|
+
function y(o) {
|
|
17
|
+
return o.reduceProperties((r, t) => r || !!t.required, !1);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
y as hasRequiredProperty,
|
|
21
|
+
p as isColumnComponent,
|
|
22
|
+
c as isTableComponent,
|
|
23
|
+
x as prefixCls
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/array-table/utils.ts"],"sourcesContent":["import type { Schema } from '@formily/json-schema'\nimport { stylePrefix } from '../__builtins__'\nimport { isAdditionComponent, isOperationComponent } from '../array-base/utils'\n\nexport const prefixCls = `${stylePrefix}-array-table`\n\nexport function isColumnComponent(schema: Schema) {\n return schema['x-component']?.indexOf('Column') > -1\n}\n\nexport function isTableComponent(schema: Schema): boolean {\n return isColumnComponent(schema) || isOperationComponent(schema) || isAdditionComponent(schema)\n}\n\nexport function hasRequiredProperty(schema: Schema): boolean {\n return schema.reduceProperties((hasRequired, property) =>\n hasRequired || !!property.required, false)\n}\n"],"names":["prefixCls","stylePrefix","isColumnComponent","schema","isTableComponent","isOperationComponent","isAdditionComponent","hasRequiredProperty","hasRequired","property"],"mappings":";;;;;;;;AAIO,MAAMA,IAAY,GAAGC,CAAW;AAEhC,SAASC,EAAkBC,GAAgB;AAChD,SAAOA,EAAO,aAAa,GAAG,QAAQ,QAAQ,IAAI;AACpD;AAEO,SAASC,EAAiBD,GAAyB;AACxD,SAAOD,EAAkBC,CAAM,KAAKE,EAAqBF,CAAM,KAAKG,EAAoBH,CAAM;AAChG;AAEO,SAASI,EAAoBJ,GAAyB;AAC3D,SAAOA,EAAO,iBAAiB,CAACK,GAAaC,MAC3CD,KAAe,CAAC,CAACC,EAAS,UAAU,EAAK;AAC7C;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const ArrayTabs: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default ArrayTabs;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { defineComponent as C, ref as d, onUnmounted as E, createBlock as f, openBlock as l, unref as e, mergeProps as F, withCtx as u, createElementBlock as i, Fragment as _, renderList as A, createVNode as b, normalizeClass as B, createTextVNode as N, toDisplayString as v } from "vue";
|
|
2
|
+
import { reaction as P } from "@formily/reactive";
|
|
3
|
+
import { isEqual as R, isFn as h } from "@formily/shared";
|
|
4
|
+
import { useField as S, useFieldSchema as q, RecursionField as L } from "@formily/vue";
|
|
5
|
+
import { ElTabs as U, ElTabPane as V, ElBadge as w } from "element-plus";
|
|
6
|
+
import { stylePrefix as z } from "../__builtins__/configs/index.mjs";
|
|
7
|
+
import "@formily/core";
|
|
8
|
+
import "@formily/reactive-vue";
|
|
9
|
+
import { useCleanAttrs as D } from "../__builtins__/shared/utils.mjs";
|
|
10
|
+
import { getArrayItemSchema as I } from "../array-base/utils.mjs";
|
|
11
|
+
import '../styles/array-tabs/index.css';const K = { key: 0 }, j = { key: 1 }, G = /* @__PURE__ */ C({
|
|
12
|
+
name: "FArrayTabs",
|
|
13
|
+
inheritAttrs: !1,
|
|
14
|
+
__name: "array-tabs",
|
|
15
|
+
setup(H) {
|
|
16
|
+
const y = S(), $ = q(), c = `${z}-array-tabs`, n = d("tab-0"), t = y.value;
|
|
17
|
+
/* istanbul ignore else -- @preserve */
|
|
18
|
+
t.value.length === 0 && t.value.push(null);
|
|
19
|
+
const g = $.value;
|
|
20
|
+
function p(r) {
|
|
21
|
+
return `${t.title || "Untitled"} ${r + 1}`;
|
|
22
|
+
}
|
|
23
|
+
const m = d([]), T = P(() => t.value.map((r, s) => t.form.queryFeedbacks({
|
|
24
|
+
type: "error",
|
|
25
|
+
address: `${t.address.concat(s)}.**`
|
|
26
|
+
}).length), (r) => {
|
|
27
|
+
m.value = r;
|
|
28
|
+
}, {
|
|
29
|
+
equals: R
|
|
30
|
+
});
|
|
31
|
+
E(() => {
|
|
32
|
+
T();
|
|
33
|
+
});
|
|
34
|
+
const { props: k } = D(["value"]);
|
|
35
|
+
return (r, s) => (l(), f(e(U), F(e(k), {
|
|
36
|
+
"model-value": n.value,
|
|
37
|
+
class: c,
|
|
38
|
+
type: "card",
|
|
39
|
+
addable: !0,
|
|
40
|
+
onTabRemove: s[0] || (s[0] = (o) => {
|
|
41
|
+
const a = o.toString().match(/tab-(\d+)/)?.[1];
|
|
42
|
+
e(t).remove(Number(a)), n.value === o && (n.value = `tab-${Number(a) - 1}`), e(h)(r.$attrs["tab-remove"]) && r.$attrs["tab-remove"](o);
|
|
43
|
+
}),
|
|
44
|
+
onTabAdd: s[1] || (s[1] = () => {
|
|
45
|
+
const o = e(t).value.length;
|
|
46
|
+
e(t).value.push(null), n.value = `tab-${o}`, e(h)(r.$attrs["tab-add"]) && r.$attrs["tab-add"]();
|
|
47
|
+
}),
|
|
48
|
+
onChange: () => {
|
|
49
|
+
}
|
|
50
|
+
}), {
|
|
51
|
+
default: u(() => [
|
|
52
|
+
(l(!0), i(_, null, A(e(t).value, (o, a) => (l(), f(e(V), {
|
|
53
|
+
key: `tab-${a}`,
|
|
54
|
+
closable: a !== 0,
|
|
55
|
+
name: `tab-${a}`
|
|
56
|
+
}, {
|
|
57
|
+
default: u(() => [
|
|
58
|
+
b(e(L), {
|
|
59
|
+
schema: e(I)(e(g), a),
|
|
60
|
+
name: a
|
|
61
|
+
}, null, 8, ["schema", "name"])
|
|
62
|
+
]),
|
|
63
|
+
label: u(() => [
|
|
64
|
+
m.value[a] > 0 ? (l(), i("span", K, [
|
|
65
|
+
b(e(w), {
|
|
66
|
+
class: B([`${c}-errors-badge`]),
|
|
67
|
+
value: m.value[a]
|
|
68
|
+
}, {
|
|
69
|
+
default: u(() => [
|
|
70
|
+
N(v(p(a)), 1)
|
|
71
|
+
]),
|
|
72
|
+
_: 2
|
|
73
|
+
}, 1032, ["class", "value"])
|
|
74
|
+
])) : (l(), i("span", j, v(p(a)), 1))
|
|
75
|
+
]),
|
|
76
|
+
_: 2
|
|
77
|
+
}, 1032, ["closable", "name"]))), 128))
|
|
78
|
+
]),
|
|
79
|
+
_: 1
|
|
80
|
+
}, 16, ["model-value"]));
|
|
81
|
+
}
|
|
82
|
+
}), ae = G;
|
|
83
|
+
export {
|
|
84
|
+
ae as ArrayTabs,
|
|
85
|
+
ae as default
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/array-tabs/array-tabs.vue","../../src/array-tabs/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ArrayField } from '@formily/core'\nimport type { TabPaneName } from 'element-plus'\nimport { reaction } from '@formily/reactive'\nimport { isEqual, isFn } from '@formily/shared'\nimport { RecursionField, useField, useFieldSchema } from '@formily/vue'\nimport { ElBadge, ElTabPane, ElTabs } from 'element-plus'\nimport { onUnmounted, ref } from 'vue'\nimport { useCleanAttrs } from '../__builtins__'\nimport { stylePrefix } from '../__builtins__/configs'\nimport { getArrayItemSchema } from '../array-base/utils'\n\ndefineOptions({\n name: 'FArrayTabs',\n inheritAttrs: false,\n})\n\nconst fieldRef = useField<ArrayField>()\nconst schemaRef = useFieldSchema()\n\nconst prefixCls = `${stylePrefix}-array-tabs`\nconst activeKey = ref<TabPaneName>('tab-0')\n\nconst field = fieldRef.value\n/* istanbul ignore else -- @preserve */\nif (field.value.length === 0) {\n field.value.push(null)\n}\nconst schema = schemaRef.value\nfunction getTabTitle(index: number) {\n return `${field.title || 'Untitled'} ${index + 1}`\n}\n\nconst errorCountList = ref([])\nconst dispose = reaction(() => {\n return field.value.map((item, index) => {\n const panelErrors = field.form.queryFeedbacks({\n type: 'error',\n address: `${field.address.concat(index)}.**`,\n })\n return panelErrors.length\n })\n}, (newVal) => {\n errorCountList.value = newVal\n}, {\n equals: isEqual,\n})\nonUnmounted(() => {\n dispose()\n})\nconst { props: elTabProps } = useCleanAttrs(['value'])\n</script>\n\n<template>\n <ElTabs\n v-bind=\"elTabProps\"\n :model-value=\"activeKey\"\n :class=\"prefixCls\"\n type=\"card\"\n :addable=\"true\"\n @tab-remove=\"(target) => {\n const index = target.toString().match(/tab-(\\d+)/)?.[1]\n field.remove(Number(index))\n if (activeKey === target) {\n activeKey = `tab-${Number(index) - 1}`\n }\n\n if (isFn($attrs['tab-remove'])) {\n $attrs['tab-remove'](target)\n }\n }\"\n @tab-add=\"() => {\n const id = field.value.length\n field.value.push(null)\n activeKey = `tab-${id}`\n if (isFn($attrs['tab-add'])) {\n $attrs['tab-add']()\n }\n }\"\n @change=\"() => {}\"\n >\n <ElTabPane\n v-for=\"(item, index) of field.value\"\n :key=\"`tab-${index}`\"\n :closable=\"index !== 0\"\n :name=\"`tab-${index}`\"\n >\n <template #default>\n <RecursionField\n :schema=\"getArrayItemSchema(schema, index)\"\n :name=\"index\"\n />\n </template>\n <template #label>\n <span v-if=\"errorCountList[index] > 0\">\n <ElBadge\n :class=\"[`${prefixCls}-errors-badge`]\"\n :value=\"errorCountList[index]\"\n >\n {{ getTabTitle(index) }}\n </ElBadge>\n </span>\n <span v-else>\n {{ getTabTitle(index) }}\n </span>\n </template>\n </ElTabPane>\n </ElTabs>\n</template>\n","import FArrayTabs from './array-tabs.vue'\nimport './style.scss'\n\nexport const ArrayTabs = FArrayTabs\n\nexport default ArrayTabs\n"],"names":["fieldRef","useField","schemaRef","useFieldSchema","prefixCls","stylePrefix","activeKey","ref","field","schema","getTabTitle","index","errorCountList","dispose","reaction","item","newVal","isEqual","onUnmounted","elTabProps","useCleanAttrs","_createBlock","_unref","ElTabs","_mergeProps","target","isFn","$attrs","_cache","id","_openBlock","_createElementBlock","_Fragment","ElTabPane","_createVNode","RecursionField","getArrayItemSchema","_hoisted_1","ElBadge","_createTextVNode","_toDisplayString","_hoisted_2","ArrayTabs","FArrayTabs"],"mappings":";;;;;;;;;;;;;;;AAiBA,UAAMA,IAAWC,EAAA,GACXC,IAAYC,EAAA,GAEZC,IAAY,GAAGC,CAAW,eAC1BC,IAAYC,EAAiB,OAAO,GAEpCC,IAAQR,EAAS;AAAA,IAAA;AAEvB,IAAIQ,EAAM,MAAM,WAAW,KACzBA,EAAM,MAAM,KAAK,IAAI;AAEvB,UAAMC,IAASP,EAAU;AACzB,aAASQ,EAAYC,GAAe;AAClC,aAAO,GAAGH,EAAM,SAAS,UAAU,IAAIG,IAAQ,CAAC;AAAA,IAClD;AAEA,UAAMC,IAAiBL,EAAI,EAAE,GACvBM,IAAUC,EAAS,MAChBN,EAAM,MAAM,IAAI,CAACO,GAAMJ,MACRH,EAAM,KAAK,eAAe;AAAA,MAC5C,MAAM;AAAA,MACN,SAAS,GAAGA,EAAM,QAAQ,OAAOG,CAAK,CAAC;AAAA,IAAA,CACxC,EACkB,MACpB,GACA,CAACK,MAAW;AACb,MAAAJ,EAAe,QAAQI;AAAA,IACzB,GAAG;AAAA,MACD,QAAQC;AAAA,IAAA,CACT;AACD,IAAAC,EAAY,MAAM;AAChB,MAAAL,EAAA;AAAA,IACF,CAAC;AACD,UAAM,EAAE,OAAOM,EAAA,IAAeC,EAAc,CAAC,OAAO,CAAC;2BAInDC,EAqDSC,EAAAC,CAAA,GArDTC,EAqDSF,EAAAH,CAAA,GApDW;AAAA,MACjB,eAAab,EAAA;AAAA,MACb,OAAOF;AAAA,MACR,MAAK;AAAA,MACJ,SAAS;AAAA,MACT,8BAAaqB,MAAM;AAAmB,cAAAd,IAAQc,EAAO,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9B,EAAYC,CAAK,CAAA,GAAA,CAAA;AAAA,gBAAA;;;wBAGxBoB,EAEO,QAAAU,GAAAD,EADF9B,EAAYC,CAAK,CAAA,GAAA,CAAA;AAAA,UAAA;;;;;;;ICpGjB+B,KAAYC;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CascaderOption } from 'element-plus';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
value?: any;
|
|
4
|
+
options?: CascaderOption[];
|
|
5
|
+
};
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
slots: {
|
|
9
|
+
default?(_: {
|
|
10
|
+
node: any;
|
|
11
|
+
data: any;
|
|
12
|
+
}): any;
|
|
13
|
+
empty?(_: {}): any;
|
|
14
|
+
};
|
|
15
|
+
refs: {};
|
|
16
|
+
rootEl: any;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
19
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
20
|
+
change: (value: any) => any;
|
|
21
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
22
|
+
onChange?: (value: any) => any;
|
|
23
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
24
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const Cascader: {
|
|
2
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
3
|
+
value?: any;
|
|
4
|
+
options?: import('element-plus').CascaderOption[];
|
|
5
|
+
}> & Readonly<{
|
|
6
|
+
onChange?: (value: any) => any;
|
|
7
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
8
|
+
change: (value: any) => any;
|
|
9
|
+
}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
10
|
+
P: {};
|
|
11
|
+
B: {};
|
|
12
|
+
D: {};
|
|
13
|
+
C: {};
|
|
14
|
+
M: {};
|
|
15
|
+
Defaults: {};
|
|
16
|
+
}, Readonly<{
|
|
17
|
+
value?: any;
|
|
18
|
+
options?: import('element-plus').CascaderOption[];
|
|
19
|
+
}> & Readonly<{
|
|
20
|
+
onChange?: (value: any) => any;
|
|
21
|
+
}>, {}, {}, {}, {}, {}>;
|
|
22
|
+
__isFragment?: never;
|
|
23
|
+
__isTeleport?: never;
|
|
24
|
+
__isSuspense?: never;
|
|
25
|
+
} & import('vue').ComponentOptionsBase<Readonly<{
|
|
26
|
+
value?: any;
|
|
27
|
+
options?: import('element-plus').CascaderOption[];
|
|
28
|
+
}> & Readonly<{
|
|
29
|
+
onChange?: (value: any) => any;
|
|
30
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
31
|
+
change: (value: any) => any;
|
|
32
|
+
}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
33
|
+
$slots: {
|
|
34
|
+
default?(_: {
|
|
35
|
+
node: any;
|
|
36
|
+
data: any;
|
|
37
|
+
}): any;
|
|
38
|
+
empty?(_: {}): any;
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
export default Cascader;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { observer as u } from "@formily/reactive-vue";
|
|
2
|
+
import { connect as c, mapProps as f } from "@formily/vue";
|
|
3
|
+
import { defineComponent as v, createBlock as C, openBlock as y, unref as a, mergeProps as P, createSlots as k, withCtx as s, renderSlot as m } from "vue";
|
|
4
|
+
import { ElCascader as $ } from "element-plus";
|
|
5
|
+
import "@formily/reactive";
|
|
6
|
+
import { mapReadPretty as g } from "../__builtins__/shared/transform-component.mjs";
|
|
7
|
+
import { PreviewText as h } from "../preview-text/index.mjs";
|
|
8
|
+
import "@formily/core";
|
|
9
|
+
import { useCleanAttrs as S } from "../__builtins__/shared/utils.mjs";
|
|
10
|
+
const b = /* @__PURE__ */ v({
|
|
11
|
+
name: "FCascader",
|
|
12
|
+
inheritAttrs: !1,
|
|
13
|
+
__name: "cascader",
|
|
14
|
+
props: {
|
|
15
|
+
value: null,
|
|
16
|
+
options: null
|
|
17
|
+
},
|
|
18
|
+
emits: ["change"],
|
|
19
|
+
setup(n, { emit: p }) {
|
|
20
|
+
const t = n, l = p, { props: i } = S();
|
|
21
|
+
return (e, r) => (y(), C(a($), P(a(i), {
|
|
22
|
+
options: t.options,
|
|
23
|
+
"model-value": t.value,
|
|
24
|
+
"onUpdate:modelValue": r[0] || (r[0] = (o) => l("change", o))
|
|
25
|
+
}), k({ _: 2 }, [
|
|
26
|
+
e.$slots.default ? {
|
|
27
|
+
name: "default",
|
|
28
|
+
fn: s(({ node: o, data: d }) => [
|
|
29
|
+
m(e.$slots, "default", {
|
|
30
|
+
node: o,
|
|
31
|
+
data: d
|
|
32
|
+
})
|
|
33
|
+
]),
|
|
34
|
+
key: "0"
|
|
35
|
+
} : void 0,
|
|
36
|
+
e.$slots.empty ? {
|
|
37
|
+
name: "empty",
|
|
38
|
+
fn: s(() => [
|
|
39
|
+
m(e.$slots, "empty")
|
|
40
|
+
]),
|
|
41
|
+
key: "1"
|
|
42
|
+
} : void 0
|
|
43
|
+
]), 1040, ["options", "model-value"]));
|
|
44
|
+
}
|
|
45
|
+
}), _ = c(
|
|
46
|
+
u(b),
|
|
47
|
+
f({ dataSource: "options", value: "modelValue", disabled: !0 }),
|
|
48
|
+
g(h.Cascader)
|
|
49
|
+
);
|
|
50
|
+
export {
|
|
51
|
+
_ as Cascader,
|
|
52
|
+
_ as default
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/cascader/cascader.vue","../../src/cascader/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { CascaderOption } from 'element-plus'\nimport { ElCascader } from 'element-plus'\nimport { useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FCascader',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n value: null,\n options: null\n})\n\nconst emit = defineEmits([\"change\"])\n\nconst { props: cascaderProps } = useCleanAttrs()\n</script>\n\n<template>\n <ElCascader\n v-bind=\"cascaderProps\"\n :options=\"props.options\"\n :model-value=\"props.value\"\n @update:model-value=\"value => emit('change', value)\"\n >\n <template v-if=\"$slots.default\" #default=\"{ node, data }\">\n <slot :node=\"node\" :data=\"data\" />\n </template>\n <template v-if=\"$slots.empty\" #empty>\n <slot name=\"empty\" />\n </template>\n </ElCascader>\n</template>\n","import { observer } from '@formily/reactive-vue'\nimport { connect, mapProps } from '@formily/vue'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FCascader from './cascader.vue'\n\nexport const Cascader = connect(\n observer(FCascader),\n mapProps({ dataSource: 'options', value: 'modelValue', disabled: true }),\n mapReadPretty(PreviewText.Cascader),\n)\n\nexport default Cascader\n"],"names":["props","__props","emit","__emit","cascaderProps","useCleanAttrs","_createBlock","_unref","ElCascader","_mergeProps","_cache","value","$slots","node","data","_renderSlot","_ctx","Cascader","connect","observer","FCascader","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,UAAMA,IAAQC,GAKRC,IAAOC,GAEP,EAAE,OAAOC,EAAA,IAAkBC,EAAA;2BAI/BC,EAYaC,EAAAC,CAAA,GAZbC,EAYaF,EAAAH,CAAA,GAXU;AAAA,MACpB,SAASJ,EAAM;AAAA,MACf,eAAaA,EAAM;AAAA,MACnB,uBAAkBU,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAE,CAAAC,MAAST,YAAeS,CAAK;AAAA,IAAA;MAElCC,EAAAA,OAAO;cAAU;AAAA,cAC/B,CAAkC,EADQ,MAAAC,GAAM,MAAAC,QAAI;AAAA,UACpDC,EAAkCC,EAAA,QAAA,WAAA;AAAA,YAA3B,MAAAH;AAAA,YAAa,MAAAC;AAAA,UAAA;;;;MAENF,EAAAA,OAAO;cAAQ;AAAA,cAC7B,MAAqB;AAAA,UAArBG,EAAqBC,EAAA,QAAA,OAAA;AAAA,QAAA;;;;;ICzBdC,IAAWC;AAAA,EACtBC,EAASC,CAAS;AAAA,EAClBC,EAAS,EAAE,YAAY,WAAW,OAAO,cAAc,UAAU,IAAM;AAAA,EACvEC,EAAcC,EAAY,QAAQ;AACpC;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CheckboxProps } from 'element-plus';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
declare function __VLS_template(): {
|
|
4
|
+
attrs: Partial<{}>;
|
|
5
|
+
slots: {
|
|
6
|
+
option?(_: {
|
|
7
|
+
option: CheckboxProps | {
|
|
8
|
+
label: never;
|
|
9
|
+
value: never;
|
|
10
|
+
};
|
|
11
|
+
}): any;
|
|
12
|
+
};
|
|
13
|
+
refs: {};
|
|
14
|
+
rootEl: any;
|
|
15
|
+
};
|
|
16
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
17
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
18
|
+
value: {
|
|
19
|
+
type: PropType<Array<any>>;
|
|
20
|
+
default: () => any[];
|
|
21
|
+
};
|
|
22
|
+
options: {
|
|
23
|
+
type: PropType<Array<CheckboxProps>>;
|
|
24
|
+
default: () => any[];
|
|
25
|
+
};
|
|
26
|
+
optionType: {
|
|
27
|
+
type: PropType<"default" | "button">;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
30
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
31
|
+
change: (...args: any[]) => void;
|
|
32
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
33
|
+
value: {
|
|
34
|
+
type: PropType<Array<any>>;
|
|
35
|
+
default: () => any[];
|
|
36
|
+
};
|
|
37
|
+
options: {
|
|
38
|
+
type: PropType<Array<CheckboxProps>>;
|
|
39
|
+
default: () => any[];
|
|
40
|
+
};
|
|
41
|
+
optionType: {
|
|
42
|
+
type: PropType<"default" | "button">;
|
|
43
|
+
default: string;
|
|
44
|
+
};
|
|
45
|
+
}>> & Readonly<{
|
|
46
|
+
onChange?: (...args: any[]) => any;
|
|
47
|
+
}>, {
|
|
48
|
+
value: any[];
|
|
49
|
+
options: CheckboxProps[];
|
|
50
|
+
optionType: "button" | "default";
|
|
51
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
52
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
53
|
+
export default _default;
|
|
54
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
55
|
+
new (): {
|
|
56
|
+
$slots: S;
|
|
57
|
+
};
|
|
58
|
+
};
|