@done-coding/admin-core 0.8.3-alpha.0 → 0.9.1-alpha.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/docs/nested-config-paradigm.md +80 -0
- package/es/bridge/config-hook.mjs +37 -0
- package/es/bridge/index.mjs +157 -62
- package/es/bridge/plugin.mjs +29 -0
- package/es/bridge/theme.mjs +65 -0
- package/es/components/app-layout/AppBody.vue.mjs +1 -1
- package/es/components/app-layout/AppBody.vue2.mjs +47 -49
- package/es/components/app-layout/AppBreadcrumb.vue.mjs +1 -1
- package/es/components/app-layout/AppBreadcrumb.vue2.mjs +35 -41
- package/es/components/app-layout/AppFooter.vue.mjs +2 -2
- package/es/components/app-layout/AppFooter.vue2.mjs +8 -8
- package/es/components/app-layout/AppHeader.vue.mjs +1 -1
- package/es/components/app-layout/AppHeader.vue2.mjs +60 -69
- package/es/components/app-layout/AppLayout.vue.mjs +2 -2
- package/es/components/app-layout/AppLayout.vue2.mjs +95 -93
- package/es/components/app-layout/AppSidebar.vue.mjs +2 -2
- package/es/components/app-layout/AppSidebar.vue2.mjs +79 -82
- package/es/components/app-layout/AppTheme.vue.mjs +7 -0
- package/es/components/app-layout/AppTheme.vue2.mjs +38 -0
- package/es/components/data-view/DataListView.vue.mjs +2 -2
- package/es/components/data-view/DataListView.vue2.mjs +36 -36
- package/es/components/display/ActionConfirm.vue2.mjs +16 -16
- package/es/components/display/HeightProvider.vue.mjs +10 -10
- package/es/components/display/TabsHeader.vue.mjs +4 -4
- package/es/components/display/TabsHeader.vue2.mjs +34 -34
- package/es/components/display/TabsMain.vue.mjs +40 -39
- package/es/components/display/TabsRefineFlow.vue.mjs +30 -28
- package/es/components/form/FormItem.vue.mjs +1 -1
- package/es/components/form/FormItem.vue2.mjs +75 -81
- package/es/components/form/FormItemNestForm.vue.mjs +7 -0
- package/es/components/form/FormItemNestForm.vue2.mjs +49 -0
- package/es/components/form/FormItemNestFormList.vue.mjs +7 -0
- package/es/components/form/FormItemNestFormList.vue2.mjs +137 -0
- package/es/components/form/FormMain.vue.mjs +5 -147
- package/es/components/form/FormMain.vue2.mjs +160 -2
- package/es/components/form/FormRadioGroup.vue.mjs +42 -49
- package/es/components/form/FormSearch.vue.mjs +2 -2
- package/es/components/form/FormSearch.vue2.mjs +122 -128
- package/es/components/form/FormSelect.vue.mjs +34 -40
- package/es/components/form/FormSubmitBtn.vue.mjs +23 -28
- package/es/components/form/FormSubmitPanel.vue.mjs +2 -2
- package/es/components/form/FormSubmitPanel.vue2.mjs +29 -28
- package/es/components/form/FormTree.vue.mjs +16 -21
- package/es/components/form/FormVerifyCode.vue.mjs +37 -43
- package/es/components/form/FormVerifyImage.vue.mjs +2 -2
- package/es/components/form/FormVerifyImage.vue2.mjs +36 -41
- package/es/components/form/nest-form-item-list.mjs +71 -0
- package/es/components/form/nest-form-item.mjs +42 -0
- package/es/components/form/nest-registry.mjs +7 -0
- package/es/components/form/use-nest-form-list.mjs +22 -0
- package/es/components/form/use-nest-form.mjs +34 -0
- package/es/components/form/use-nest-layout-scale.mjs +14 -0
- package/es/components/form/utils.mjs +77 -61
- package/es/components/list-page/ListPage.vue.mjs +2 -2
- package/es/components/list-page/ListPage.vue2.mjs +134 -139
- package/es/components/menu/MenuItemSub.vue.mjs +41 -48
- package/es/components/menu/MenuTree.vue.mjs +58 -65
- package/es/components/misc/AutoRefresh.vue.mjs +2 -2
- package/es/components/misc/AutoRefresh.vue2.mjs +44 -51
- package/es/components/misc/AutoRefreshGroup.vue.mjs +2 -2
- package/es/components/misc/AutoRefreshGroup.vue2.mjs +37 -43
- package/es/components/modal/ConfirmModal.vue.mjs +3 -4
- package/es/components/modal/ConfirmModal.vue2.mjs +83 -111
- package/es/components/modal/DetailModal.vue.mjs +38 -41
- package/es/components/panel/PanelEditSwitch.vue.mjs +1 -1
- package/es/components/panel/PanelEditSwitch.vue2.mjs +50 -55
- package/es/components/panel/PanelItemNestForm.vue.mjs +7 -0
- package/es/components/panel/PanelItemNestForm.vue2.mjs +69 -0
- package/es/components/panel/PanelItemNestPanel.vue.mjs +34 -0
- package/es/components/panel/PanelItemNestPanel.vue2.mjs +4 -0
- package/es/components/panel/PanelMain.vue.mjs +1 -1
- package/es/components/panel/PanelMain.vue2.mjs +72 -72
- package/es/components/panel/nest-panel-form.mjs +53 -0
- package/es/components/panel/nest-panel-item.mjs +25 -0
- package/es/components/table/TableMain.vue.mjs +2 -2
- package/es/components/table/TableMain.vue2.mjs +221 -229
- package/es/components/table/TableToolbar.vue.mjs +2 -2
- package/es/components/table/TableToolbar.vue2.mjs +115 -126
- package/es/hooks/use-admin-theme-apply.mjs +84 -0
- package/es/hooks/use-admin-viewport-apply.mjs +27 -0
- package/es/index.mjs +190 -153
- package/es/inject/key.mjs +15 -6
- package/es/store/app.mjs +75 -84
- package/es/style.css +1 -1
- package/es/utils/theme-scale.mjs +37 -0
- package/package.json +2 -4
- package/types/bridge/config-hook.d.ts +91 -0
- package/types/bridge/index.d.ts +108 -8
- package/types/bridge/plugin.d.ts +39 -0
- package/types/bridge/theme.d.ts +85 -0
- package/types/components/app-layout/AppTheme.vue.d.ts +2 -0
- package/types/components/app-layout/types.d.ts +1 -1
- package/types/components/form/FormItem.vue.d.ts +12 -12
- package/types/components/form/FormItemNestForm.vue.d.ts +36 -0
- package/types/components/form/FormItemNestFormList.vue.d.ts +63 -0
- package/types/components/form/FormMain.vue.d.ts +2 -2
- package/types/components/form/FormSearch.vue.d.ts +2 -2
- package/types/components/form/FormTree.vue.d.ts +50 -50
- package/types/components/form/index.d.ts +9 -1
- package/types/components/form/nest-form-item-list.d.ts +63 -0
- package/types/components/form/nest-form-item.d.ts +36 -0
- package/types/components/form/nest-registry.d.ts +22 -0
- package/types/components/form/types.d.ts +2 -0
- package/types/components/form/use-nest-form-list.d.ts +20 -0
- package/types/components/form/use-nest-form.d.ts +26 -0
- package/types/components/form/use-nest-layout-scale.d.ts +17 -0
- package/types/components/form/utils.d.ts +26 -1
- package/types/components/menu/MenuTree.vue.d.ts +10 -10
- package/types/components/modal/ModalShelf.vue.d.ts +1 -1
- package/types/components/panel/PanelItemNestForm.vue.d.ts +35 -0
- package/types/components/panel/PanelItemNestPanel.vue.d.ts +22 -0
- package/types/components/panel/index.d.ts +5 -1
- package/types/components/panel/nest-panel-form.d.ts +38 -0
- package/types/components/panel/nest-panel-item.d.ts +28 -0
- package/types/components/panel/types.d.ts +2 -0
- package/types/components/table/TableMain.vue.d.ts +3 -3
- package/types/hooks/activated.d.ts +2 -2
- package/types/hooks/feel-size.d.ts +1 -1
- package/types/hooks/index.d.ts +2 -0
- package/types/hooks/menus-dispatch.d.ts +5 -5
- package/types/hooks/use-admin-theme-apply.d.ts +17 -0
- package/types/hooks/use-admin-viewport-apply.d.ts +15 -0
- package/types/hooks/use-breakpoint.d.ts +1 -1
- package/types/inject/key.d.ts +46 -1
- package/types/store/app.d.ts +138 -59
- package/types/utils/index.d.ts +1 -0
- package/types/utils/theme-scale.d.ts +35 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { defineComponent as c, inject as N, toRefs as R, useModel as T, useSlots as A, ref as P, computed as f, h as $, provide as x, watch as E, openBlock as o, createBlock as l, resolveDynamicComponent as q, mergeProps as I, withCtx as s, KeepAlive as U, unref as i, createCommentVNode as j, createVNode as z, createSlots as D, renderList as F, renderSlot as G, normalizeProps as J, guardReactiveProps as O, createElementVNode as Q, mergeModels as W } from "vue";
|
|
2
|
+
import X from "./TabsRefineFlow.vue.mjs";
|
|
3
|
+
import Y from "./TabsNaturalFlow.vue.mjs";
|
|
4
|
+
import Z from "./TabsHeader.vue.mjs";
|
|
5
5
|
import { TABS_MAIN_VISUAL_LEVEL as h } from "../../inject/key.mjs";
|
|
6
|
-
const oe = /* @__PURE__ */
|
|
6
|
+
const oe = /* @__PURE__ */ c({
|
|
7
7
|
__name: "TabsMain",
|
|
8
|
-
props: /* @__PURE__ */
|
|
8
|
+
props: /* @__PURE__ */ W({
|
|
9
9
|
tabs: {},
|
|
10
10
|
viewportHeight: {},
|
|
11
11
|
minHeight: { default: 100 },
|
|
@@ -21,18 +21,18 @@ const oe = /* @__PURE__ */ m({
|
|
|
21
21
|
}),
|
|
22
22
|
emits: ["update:modelValue"],
|
|
23
23
|
setup(u) {
|
|
24
|
-
const
|
|
24
|
+
const r = u, p = N(h, 0) + 1, {
|
|
25
25
|
viewportHeight: g,
|
|
26
26
|
minHeight: y,
|
|
27
27
|
channel: H,
|
|
28
28
|
parentChannel: w,
|
|
29
29
|
padding: b,
|
|
30
30
|
refine: v,
|
|
31
|
-
refineReduceHeight:
|
|
32
|
-
variant:
|
|
31
|
+
refineReduceHeight: V,
|
|
32
|
+
variant: k,
|
|
33
33
|
tabs: d
|
|
34
|
-
} =
|
|
35
|
-
() => v.value ?
|
|
34
|
+
} = R(r), n = T(u, "modelValue"), C = A(), m = P(void 0), _ = f(
|
|
35
|
+
() => v.value ? X : Y
|
|
36
36
|
), L = f(
|
|
37
37
|
() => v.value ? {
|
|
38
38
|
viewportHeight: g.value,
|
|
@@ -40,56 +40,57 @@ const oe = /* @__PURE__ */ m({
|
|
|
40
40
|
channel: H.value,
|
|
41
41
|
parentChannel: w.value,
|
|
42
42
|
padding: b.value,
|
|
43
|
-
refineReduceHeight:
|
|
43
|
+
refineReduceHeight: V.value
|
|
44
44
|
} : {}
|
|
45
|
-
), K = (
|
|
46
|
-
|
|
47
|
-
}, S =
|
|
45
|
+
), K = (t) => r.tabs.find((e) => e.key === t), M = (t) => {
|
|
46
|
+
m.value = t;
|
|
47
|
+
}, S = c({
|
|
48
48
|
name: "TabsMainPane",
|
|
49
49
|
props: {
|
|
50
50
|
paneKey: { type: String, required: !0 },
|
|
51
51
|
viewportHeight: { type: Number, required: !1 }
|
|
52
52
|
},
|
|
53
|
-
setup(
|
|
53
|
+
setup(t) {
|
|
54
54
|
return () => {
|
|
55
|
-
const
|
|
56
|
-
return
|
|
57
|
-
tab:
|
|
55
|
+
const e = C[t.paneKey], a = K(t.paneKey);
|
|
56
|
+
return e ? e({
|
|
57
|
+
tab: a,
|
|
58
58
|
active: !0,
|
|
59
|
-
viewportHeight:
|
|
60
|
-
}) :
|
|
59
|
+
viewportHeight: t.viewportHeight
|
|
60
|
+
}) : a != null && a.component ? $(a.component) : null;
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
return
|
|
65
|
-
[
|
|
64
|
+
return x(h, p), E(
|
|
65
|
+
[n, () => r.tabs],
|
|
66
66
|
() => {
|
|
67
|
-
!(!!
|
|
67
|
+
!(!!n.value && r.tabs.some((e) => e.key === n.value)) && r.tabs.length && (n.value = r.tabs[0].key);
|
|
68
68
|
},
|
|
69
69
|
{ immediate: !0 }
|
|
70
|
-
), (
|
|
70
|
+
), (t, e) => (o(), l(q(_.value), I(L.value, { onViewportHeightChange: M }), {
|
|
71
71
|
header: s(() => [
|
|
72
|
-
z(
|
|
73
|
-
"active-key":
|
|
74
|
-
"onUpdate:activeKey":
|
|
75
|
-
tabs:
|
|
72
|
+
z(Z, {
|
|
73
|
+
"active-key": n.value,
|
|
74
|
+
"onUpdate:activeKey": e[0] || (e[0] = (a) => n.value = a),
|
|
75
|
+
tabs: i(d),
|
|
76
76
|
level: p,
|
|
77
|
-
variant:
|
|
77
|
+
variant: i(k)
|
|
78
78
|
}, D({ _: 2 }, [
|
|
79
|
-
F(
|
|
80
|
-
name:
|
|
79
|
+
F(i(d), (a) => ({
|
|
80
|
+
name: a.key,
|
|
81
81
|
fn: s((B) => [
|
|
82
|
-
G(
|
|
82
|
+
G(t.$slots, `header-${a.key}`, J(O(B)))
|
|
83
83
|
])
|
|
84
84
|
}))
|
|
85
|
-
]), 1032, ["active-key", "tabs", "variant"])
|
|
85
|
+
]), 1032, ["active-key", "tabs", "variant"]),
|
|
86
|
+
e[1] || (e[1] = Q("div", { style: { height: "8px" } }, null, -1))
|
|
86
87
|
]),
|
|
87
88
|
default: s(() => [
|
|
88
|
-
(
|
|
89
|
-
|
|
90
|
-
key:
|
|
91
|
-
"pane-key":
|
|
92
|
-
"viewport-height":
|
|
89
|
+
(o(), l(U, null, [
|
|
90
|
+
n.value ? (o(), l(i(S), {
|
|
91
|
+
key: n.value,
|
|
92
|
+
"pane-key": n.value,
|
|
93
|
+
"viewport-height": m.value
|
|
93
94
|
}, null, 8, ["pane-key", "viewport-height"])) : j("", !0)
|
|
94
95
|
], 1024))
|
|
95
96
|
]),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useChannelViewportHeight as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as H, ref as w, computed as i, provide as C, watch as b, openBlock as y, createBlock as S, createSlots as V, withCtx as r, createElementVNode as $, normalizeStyle as x, renderSlot as h } from "vue";
|
|
2
|
+
import _ from "./HeightProvider.vue.mjs";
|
|
3
|
+
import { useChannelViewportHeight as k } from "../../hooks/use-channel-viewport-height.mjs";
|
|
4
|
+
const F = /* @__PURE__ */ H({
|
|
5
5
|
__name: "TabsRefineFlow",
|
|
6
6
|
props: {
|
|
7
7
|
viewportHeight: {},
|
|
@@ -12,45 +12,47 @@ const M = /* @__PURE__ */ w({
|
|
|
12
12
|
refineReduceHeight: { default: 0 }
|
|
13
13
|
},
|
|
14
14
|
emits: ["viewportHeightChange"],
|
|
15
|
-
setup(
|
|
16
|
-
const e =
|
|
15
|
+
setup(n, { emit: d }) {
|
|
16
|
+
const e = n, p = d, a = e.channel ? Symbol.for(e.channel) : void 0, { viewportHeightFinal: c, parentLevel: o } = k(e), l = w(0), s = i(() => e.padding[0] + e.padding[2]), g = i(() => ({
|
|
17
17
|
padding: e.padding.map((t) => `${t}px`).join(" "),
|
|
18
18
|
boxSizing: "border-box"
|
|
19
|
-
})), v =
|
|
19
|
+
})), v = i(
|
|
20
20
|
() => Math.max(
|
|
21
|
-
|
|
21
|
+
c.value - s.value - e.refineReduceHeight,
|
|
22
22
|
0
|
|
23
23
|
)
|
|
24
|
-
),
|
|
25
|
-
() =>
|
|
26
|
-
),
|
|
27
|
-
|
|
24
|
+
), m = i(
|
|
25
|
+
() => o.value > 0 ? o.value : 1
|
|
26
|
+
), u = i(() => m.value + 1), f = (t) => {
|
|
27
|
+
l.value = t, p("viewportHeightChange", t);
|
|
28
28
|
};
|
|
29
|
-
return
|
|
30
|
-
viewportHeight:
|
|
31
|
-
level
|
|
32
|
-
|
|
29
|
+
return a && C(a, {
|
|
30
|
+
viewportHeight: i(() => l.value),
|
|
31
|
+
// level 有意取 setup 期一次性快照(channel 不响应式),非误丢响应性,定向 disable。
|
|
32
|
+
// eslint-disable-next-line vue/no-ref-object-destructure
|
|
33
|
+
level: u.value
|
|
34
|
+
}), b(
|
|
33
35
|
// eslint-disable-next-line vue/no-setup-props-destructure
|
|
34
36
|
() => e.channel,
|
|
35
37
|
() => console.error("[TabsMain] channel 不支持响应式变更,当前值已忽略。")
|
|
36
|
-
), (t,
|
|
37
|
-
viewportHeight:
|
|
38
|
-
minHeight:
|
|
39
|
-
onChildViewportHeightChange:
|
|
40
|
-
},
|
|
41
|
-
default:
|
|
42
|
-
|
|
43
|
-
style:
|
|
38
|
+
), (t, L) => (y(), S(_, {
|
|
39
|
+
viewportHeight: v.value,
|
|
40
|
+
minHeight: n.minHeight,
|
|
41
|
+
onChildViewportHeightChange: f
|
|
42
|
+
}, V({
|
|
43
|
+
default: r(() => [
|
|
44
|
+
$("div", {
|
|
45
|
+
style: x(g.value)
|
|
44
46
|
}, [
|
|
45
|
-
|
|
47
|
+
h(t.$slots, "default")
|
|
46
48
|
], 4)
|
|
47
49
|
]),
|
|
48
50
|
_: 2
|
|
49
51
|
}, [
|
|
50
52
|
t.$slots.header ? {
|
|
51
53
|
name: "header",
|
|
52
|
-
fn:
|
|
53
|
-
|
|
54
|
+
fn: r(() => [
|
|
55
|
+
h(t.$slots, "header")
|
|
54
56
|
]),
|
|
55
57
|
key: "0"
|
|
56
58
|
} : void 0
|
|
@@ -58,5 +60,5 @@ const M = /* @__PURE__ */ w({
|
|
|
58
60
|
}
|
|
59
61
|
});
|
|
60
62
|
export {
|
|
61
|
-
|
|
63
|
+
F as default
|
|
62
64
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./FormItem.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-8b508d64"]]);
|
|
5
5
|
export {
|
|
6
6
|
_ as default
|
|
7
7
|
};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "element-plus
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import { defineComponent as J, shallowRef as Q, computed as n, watch as p, withDirectives as U, openBlock as a, createBlock as c, mergeProps as v, unref as r, withCtx as y, renderSlot as W, normalizeProps as F, createTextVNode as k, toDisplayString as h, resolveDynamicComponent as b, createSlots as X, createElementBlock as H, Fragment as Y, createCommentVNode as Z, vShow as _ } from "vue";
|
|
6
|
-
import { getPlaceholder as ee, getChangeSubmit as te, getBlurSubmit as ne, getEnterSubmit as oe, getVModelSugar as re, generateFormData as ie } from "./utils.mjs";
|
|
7
|
-
import ae from "lodash/omit";
|
|
1
|
+
import { defineComponent as q, shallowRef as G, computed as n, watch as f, withDirectives as J, openBlock as a, createBlock as i, unref as I, mergeProps as g, withCtx as d, renderSlot as Q, normalizeProps as L, createTextVNode as p, toDisplayString as v, resolveDynamicComponent as y, createSlots as U, createElementBlock as B, Fragment as W, createCommentVNode as X, vShow as Y } from "vue";
|
|
2
|
+
import { ElFormItem as Z, ElText as _ } from "element-plus";
|
|
3
|
+
import { getPlaceholder as ee, getChangeSubmit as te, getBlurSubmit as ne, getEnterSubmit as oe, getVModelSugar as re, generateFormData as ae } from "./utils.mjs";
|
|
4
|
+
import ie from "lodash/omit";
|
|
8
5
|
const ce = {
|
|
9
6
|
key: 2,
|
|
10
7
|
class: "form-item-tip"
|
|
11
|
-
},
|
|
8
|
+
}, fe = /* @__PURE__ */ q({
|
|
12
9
|
name: "FormItem",
|
|
13
10
|
__name: "FormItem",
|
|
14
11
|
props: {
|
|
@@ -16,133 +13,130 @@ const ce = {
|
|
|
16
13
|
data: {}
|
|
17
14
|
},
|
|
18
15
|
emits: ["viewHideChange", "submit"],
|
|
19
|
-
setup(
|
|
20
|
-
const t =
|
|
16
|
+
setup(r, { emit: E }) {
|
|
17
|
+
const t = r, c = E, k = G(), F = n(() => {
|
|
21
18
|
const {
|
|
22
19
|
config: { beLink: e }
|
|
23
20
|
} = t;
|
|
24
21
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
25
|
-
}),
|
|
22
|
+
}), h = n(() => F.value.filter((e) => e.key !== t.config.key)), b = n(() => h.value.length > 0), x = n(() => t.data[t.config.key]), s = n(() => ({
|
|
26
23
|
data: t.data,
|
|
27
24
|
config: t.config
|
|
28
25
|
})), D = n(() => {
|
|
29
26
|
const { config: e } = t;
|
|
30
|
-
return typeof e.wrapProps == "function" ? e.wrapProps(
|
|
31
|
-
}),
|
|
27
|
+
return typeof e.wrapProps == "function" ? e.wrapProps(s.value) : e.wrapProps || {};
|
|
28
|
+
}), P = n(() => {
|
|
32
29
|
const { config: e } = t;
|
|
33
|
-
return typeof e.props == "function" ? e.props(
|
|
30
|
+
return typeof e.props == "function" ? e.props(s.value) : e.props || {};
|
|
34
31
|
}), T = () => {
|
|
35
|
-
|
|
32
|
+
c("submit", "enter");
|
|
36
33
|
}, A = () => {
|
|
37
|
-
|
|
34
|
+
c("submit", "blur");
|
|
38
35
|
}, M = () => {
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
const { key:
|
|
43
|
-
t.data[
|
|
36
|
+
c("submit", "change");
|
|
37
|
+
}, w = (e, o) => {
|
|
38
|
+
h.value.forEach((C) => {
|
|
39
|
+
const { key: S, getValue: H } = C, j = H(e, t.data[S], o);
|
|
40
|
+
t.data[S] = H(e, j);
|
|
44
41
|
});
|
|
45
42
|
}, N = n(() => ee(t.config) || {}), $ = n(() => ({
|
|
46
43
|
...oe(t.config, T) || {},
|
|
47
44
|
...ne(t.config, A) || {},
|
|
48
45
|
...te(t.config, M) || {}
|
|
49
|
-
})), z = n(() =>
|
|
46
|
+
})), z = n(() => ie(P.value, ["children"])), K = n(() => re({
|
|
50
47
|
modelValueKey: "modelValue",
|
|
51
48
|
data: t.data,
|
|
52
49
|
config: t.config
|
|
53
|
-
})), O = n(() =>
|
|
54
|
-
onTriggerChangeLink:
|
|
55
|
-
} : {}),
|
|
50
|
+
})), O = n(() => b.value ? {
|
|
51
|
+
onTriggerChangeLink: w
|
|
52
|
+
} : {}), m = n(() => ({
|
|
56
53
|
...N.value,
|
|
57
54
|
...$.value,
|
|
58
55
|
...z.value,
|
|
59
56
|
...K.value,
|
|
60
57
|
...O.value
|
|
61
|
-
})),
|
|
62
|
-
const { children: e } =
|
|
58
|
+
})), l = n(() => {
|
|
59
|
+
const { children: e } = P.value;
|
|
63
60
|
return e;
|
|
64
|
-
}),
|
|
61
|
+
}), V = n(() => {
|
|
65
62
|
const { config: e } = t, { hide: o } = e;
|
|
66
63
|
return typeof o == "boolean" ? o : (o == null ? void 0 : o({
|
|
67
|
-
...
|
|
68
|
-
getInitValue: () =>
|
|
64
|
+
...s.value,
|
|
65
|
+
getInitValue: () => ae([e])[e.key]
|
|
69
66
|
})) ?? !1;
|
|
70
67
|
}), R = n(() => [
|
|
71
68
|
`form-item-${t.config.key}`,
|
|
72
69
|
{ "form-item-label-hide": !!t.config.labelHide }
|
|
73
70
|
]);
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
f(
|
|
72
|
+
V,
|
|
76
73
|
(e) => {
|
|
77
74
|
var o;
|
|
78
|
-
|
|
75
|
+
c("viewHideChange", {
|
|
79
76
|
config: t.config,
|
|
80
77
|
status: e
|
|
81
|
-
}), e && ((o =
|
|
78
|
+
}), e && ((o = k.value) == null || o.clearValidate());
|
|
82
79
|
},
|
|
83
80
|
{
|
|
84
81
|
immediate: !0
|
|
85
82
|
}
|
|
86
83
|
);
|
|
87
|
-
let
|
|
88
|
-
return
|
|
89
|
-
|
|
84
|
+
let u;
|
|
85
|
+
return f(
|
|
86
|
+
b,
|
|
90
87
|
(e) => {
|
|
91
|
-
e ?
|
|
88
|
+
e ? u = f(
|
|
92
89
|
x,
|
|
93
90
|
(o) => {
|
|
94
|
-
|
|
91
|
+
w(o);
|
|
95
92
|
},
|
|
96
93
|
{
|
|
97
94
|
immediate: !0
|
|
98
95
|
}
|
|
99
|
-
) :
|
|
96
|
+
) : u == null || u();
|
|
100
97
|
},
|
|
101
98
|
{
|
|
102
99
|
immediate: !0
|
|
103
100
|
}
|
|
104
|
-
), (e, o) => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
[_, !r(I)]
|
|
142
|
-
]);
|
|
143
|
-
};
|
|
101
|
+
), (e, o) => J((a(), i(I(Z), g({
|
|
102
|
+
ref_key: "formItem",
|
|
103
|
+
ref: k,
|
|
104
|
+
prop: r.config.key,
|
|
105
|
+
label: r.config.label,
|
|
106
|
+
class: R.value
|
|
107
|
+
}, D.value), {
|
|
108
|
+
default: d(() => [
|
|
109
|
+
r.config.render === void 0 ? Q(e.$slots, "default", L(g({ key: 0 }, m.value)), () => [
|
|
110
|
+
p(v(m.value.modelValue), 1)
|
|
111
|
+
], !0) : (a(), i(y(r.config.render), L(g({ key: 1 }, m.value)), U({ _: 2 }, [
|
|
112
|
+
l.value !== void 0 ? {
|
|
113
|
+
name: "default",
|
|
114
|
+
fn: d(() => [
|
|
115
|
+
typeof l.value == "function" ? (a(), i(y(l.value), { key: 0 })) : (a(), B(W, { key: 1 }, [
|
|
116
|
+
p(v(l.value), 1)
|
|
117
|
+
], 64))
|
|
118
|
+
]),
|
|
119
|
+
key: "0"
|
|
120
|
+
} : void 0
|
|
121
|
+
]), 1040)),
|
|
122
|
+
r.config.tip ? (a(), B("div", ce, [
|
|
123
|
+
typeof r.config.tip == "function" ? (a(), i(y(r.config.tip), { key: 0 })) : (a(), i(I(_), {
|
|
124
|
+
key: 1,
|
|
125
|
+
type: "info"
|
|
126
|
+
}, {
|
|
127
|
+
default: d(() => [
|
|
128
|
+
p(v(r.config.tip), 1)
|
|
129
|
+
]),
|
|
130
|
+
_: 1
|
|
131
|
+
}))
|
|
132
|
+
])) : X("", !0)
|
|
133
|
+
]),
|
|
134
|
+
_: 3
|
|
135
|
+
}, 16, ["prop", "label", "class"])), [
|
|
136
|
+
[Y, !V.value]
|
|
137
|
+
]);
|
|
144
138
|
}
|
|
145
139
|
});
|
|
146
140
|
export {
|
|
147
|
-
|
|
141
|
+
fe as default
|
|
148
142
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defineComponent as s, useModel as m, ref as n, computed as u, openBlock as d, createElementBlock as c, normalizeStyle as i, createVNode as f, unref as p, mergeModels as y } from "vue";
|
|
2
|
+
import h from "./FormMain.vue.mjs";
|
|
3
|
+
import { useNestForm as w } from "./use-nest-form.mjs";
|
|
4
|
+
import { useNestLayoutScale as S } from "./use-nest-layout-scale.mjs";
|
|
5
|
+
const G = /* @__PURE__ */ s({
|
|
6
|
+
name: "FormItemNestForm",
|
|
7
|
+
inheritAttrs: !1,
|
|
8
|
+
__name: "FormItemNestForm",
|
|
9
|
+
props: /* @__PURE__ */ y({
|
|
10
|
+
nestKey: {},
|
|
11
|
+
list: {},
|
|
12
|
+
layout: {},
|
|
13
|
+
rowGutter: {},
|
|
14
|
+
shadowColor: {},
|
|
15
|
+
parentSpan: {},
|
|
16
|
+
rebase: { type: Boolean, default: !0 }
|
|
17
|
+
}, {
|
|
18
|
+
modelValue: { default: () => ({}) },
|
|
19
|
+
modelModifiers: {}
|
|
20
|
+
}),
|
|
21
|
+
emits: ["update:modelValue"],
|
|
22
|
+
setup(e) {
|
|
23
|
+
const t = e, a = S({
|
|
24
|
+
parentSpan: () => t.parentSpan,
|
|
25
|
+
rebase: () => t.rebase
|
|
26
|
+
}), r = m(e, "modelValue"), o = n();
|
|
27
|
+
w({ childRef: o, key: () => t.nestKey });
|
|
28
|
+
const l = u(
|
|
29
|
+
() => t.shadowColor ? { boxShadow: `0 2px 8px ${t.shadowColor}` } : {}
|
|
30
|
+
);
|
|
31
|
+
return (F, x) => (d(), c("div", {
|
|
32
|
+
class: "form-item-nest-form",
|
|
33
|
+
style: i(l.value)
|
|
34
|
+
}, [
|
|
35
|
+
f(h, {
|
|
36
|
+
ref_key: "childRef",
|
|
37
|
+
ref: o,
|
|
38
|
+
list: e.list,
|
|
39
|
+
data: r.value,
|
|
40
|
+
layout: e.layout,
|
|
41
|
+
"layout-scale": p(a),
|
|
42
|
+
rowGutter: e.rowGutter
|
|
43
|
+
}, null, 8, ["list", "data", "layout", "layout-scale", "rowGutter"])
|
|
44
|
+
], 4));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export {
|
|
48
|
+
G as default
|
|
49
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { defineComponent as z, computed as m, useModel as A, openBlock as l, createElementBlock as f, normalizeStyle as g, createBlock as y, resolveDynamicComponent as C, createCommentVNode as D, Fragment as $, renderList as j, createElementVNode as E, createVNode as k, unref as v, withCtx as S, createTextVNode as b, toDisplayString as s, mergeModels as G } from "vue";
|
|
2
|
+
import W from "./FormMain.vue.mjs";
|
|
3
|
+
import { useNestFormList as H } from "./use-nest-form-list.mjs";
|
|
4
|
+
import { useNestLayoutScale as O } from "./use-nest-layout-scale.mjs";
|
|
5
|
+
import { generateFormData as q } from "./utils.mjs";
|
|
6
|
+
import F from "../display/ActionBtn.vue.mjs";
|
|
7
|
+
import { getId as J } from "../../utils/id.mjs";
|
|
8
|
+
const ee = /* @__PURE__ */ z({
|
|
9
|
+
name: "FormItemNestFormList",
|
|
10
|
+
inheritAttrs: !1,
|
|
11
|
+
__name: "FormItemNestFormList",
|
|
12
|
+
props: /* @__PURE__ */ G({
|
|
13
|
+
nestKey: {},
|
|
14
|
+
list: {},
|
|
15
|
+
rowKey: {},
|
|
16
|
+
itemFactory: {},
|
|
17
|
+
min: { default: 0 },
|
|
18
|
+
max: { default: 1 / 0 },
|
|
19
|
+
layout: {},
|
|
20
|
+
rowGutter: {},
|
|
21
|
+
addText: { default: "新增" },
|
|
22
|
+
removeText: { default: "删除" },
|
|
23
|
+
headerRender: {},
|
|
24
|
+
footerRender: {},
|
|
25
|
+
shadowColor: {},
|
|
26
|
+
parentSpan: {},
|
|
27
|
+
rebase: { type: Boolean, default: !0 },
|
|
28
|
+
removeConfirm: { type: [Boolean, Object], default: !0 }
|
|
29
|
+
}, {
|
|
30
|
+
modelValue: { default: () => [] },
|
|
31
|
+
modelModifiers: {}
|
|
32
|
+
}),
|
|
33
|
+
emits: ["update:modelValue"],
|
|
34
|
+
setup(o) {
|
|
35
|
+
const t = o, I = m(() => {
|
|
36
|
+
const e = t.removeConfirm;
|
|
37
|
+
if (e !== !1)
|
|
38
|
+
return e && typeof e == "object" ? e : { title: "确认删除该项?", type: "danger" };
|
|
39
|
+
}), R = O({
|
|
40
|
+
parentSpan: () => t.parentSpan,
|
|
41
|
+
rebase: () => t.rebase
|
|
42
|
+
}), i = A(o, "modelValue"), n = m(() => i.value), d = m(() => n.value.length < t.max), p = m(
|
|
43
|
+
() => t.shadowColor ? { boxShadow: `0 2px 8px ${t.shadowColor}` } : {}
|
|
44
|
+
), M = m(
|
|
45
|
+
() => t.shadowColor ? { boxShadow: `0 1px 4px ${t.shadowColor}` } : {}
|
|
46
|
+
), N = () => {
|
|
47
|
+
var e;
|
|
48
|
+
return ((e = t.itemFactory) == null ? void 0 : e.call(t)) ?? q(t.list);
|
|
49
|
+
}, u = /* @__PURE__ */ new WeakMap(), h = (e) => {
|
|
50
|
+
const r = t.rowKey;
|
|
51
|
+
if (r) {
|
|
52
|
+
const a = e == null ? void 0 : e[r];
|
|
53
|
+
if (a != null) return a;
|
|
54
|
+
}
|
|
55
|
+
return u.has(e) || u.set(e, J("formItemNextFormListItem")), u.get(e);
|
|
56
|
+
}, c = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), V = (e) => {
|
|
57
|
+
let r = x.get(e);
|
|
58
|
+
return r || (r = (a) => {
|
|
59
|
+
a ? c.set(e, a) : c.delete(e);
|
|
60
|
+
}, x.set(e, r)), r;
|
|
61
|
+
};
|
|
62
|
+
H({
|
|
63
|
+
rowInstances: () => [...c.values()],
|
|
64
|
+
key: () => t.nestKey
|
|
65
|
+
});
|
|
66
|
+
const w = () => {
|
|
67
|
+
d.value && i.value.push(N());
|
|
68
|
+
}, L = (e) => {
|
|
69
|
+
n.value.length <= t.min || i.value.splice(e, 1);
|
|
70
|
+
}, B = () => {
|
|
71
|
+
var e;
|
|
72
|
+
return (e = t.headerRender) == null ? void 0 : e.call(t, { count: n.value.length, max: t.max });
|
|
73
|
+
}, T = () => {
|
|
74
|
+
var e;
|
|
75
|
+
return (e = t.footerRender) == null ? void 0 : e.call(t, {
|
|
76
|
+
count: n.value.length,
|
|
77
|
+
max: t.max,
|
|
78
|
+
canAdd: d.value,
|
|
79
|
+
add: w
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
return (e, r) => (l(), f("div", {
|
|
83
|
+
class: "form-item-nest-form-list",
|
|
84
|
+
style: g(p.value)
|
|
85
|
+
}, [
|
|
86
|
+
o.headerRender ? (l(), y(C(B), { key: 0 })) : D("", !0),
|
|
87
|
+
(l(!0), f($, null, j(n.value, (a, K) => (l(), f("div", {
|
|
88
|
+
key: h(a),
|
|
89
|
+
class: "form-item-nest-form-list-row"
|
|
90
|
+
}, [
|
|
91
|
+
E("div", {
|
|
92
|
+
class: "form-item-nest-form-list-row-body",
|
|
93
|
+
style: g(M.value)
|
|
94
|
+
}, [
|
|
95
|
+
k(W, {
|
|
96
|
+
ref_for: !0,
|
|
97
|
+
ref: V(h(a)),
|
|
98
|
+
list: o.list,
|
|
99
|
+
data: a,
|
|
100
|
+
layout: o.layout,
|
|
101
|
+
"layout-scale": v(R),
|
|
102
|
+
"row-gutter": o.rowGutter
|
|
103
|
+
}, null, 8, ["list", "data", "layout", "layout-scale", "row-gutter"])
|
|
104
|
+
], 4),
|
|
105
|
+
k(v(F), {
|
|
106
|
+
class: "form-item-nest-form-list-row-remove",
|
|
107
|
+
size: "small",
|
|
108
|
+
text: "",
|
|
109
|
+
type: "danger",
|
|
110
|
+
"confirm-config": I.value,
|
|
111
|
+
disabled: n.value.length <= o.min,
|
|
112
|
+
onClick: () => L(K)
|
|
113
|
+
}, {
|
|
114
|
+
default: S(() => [
|
|
115
|
+
b(s(o.removeText), 1)
|
|
116
|
+
]),
|
|
117
|
+
_: 1
|
|
118
|
+
}, 8, ["confirm-config", "disabled", "onClick"])
|
|
119
|
+
]))), 128)),
|
|
120
|
+
o.footerRender ? (l(), y(C(T), { key: 1 })) : (l(), y(v(F), {
|
|
121
|
+
key: 2,
|
|
122
|
+
size: "small",
|
|
123
|
+
type: "primary",
|
|
124
|
+
disabled: !d.value,
|
|
125
|
+
onClick: w
|
|
126
|
+
}, {
|
|
127
|
+
default: S(() => [
|
|
128
|
+
b(s(o.addText) + "(" + s(n.value.length) + s(o.max === 1 / 0 ? "" : "/" + o.max) + ")", 1)
|
|
129
|
+
]),
|
|
130
|
+
_: 1
|
|
131
|
+
}, 8, ["disabled"]))
|
|
132
|
+
], 4));
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
export {
|
|
136
|
+
ee as default
|
|
137
|
+
};
|