@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.
Files changed (127) hide show
  1. package/docs/nested-config-paradigm.md +80 -0
  2. package/es/bridge/config-hook.mjs +37 -0
  3. package/es/bridge/index.mjs +157 -62
  4. package/es/bridge/plugin.mjs +29 -0
  5. package/es/bridge/theme.mjs +65 -0
  6. package/es/components/app-layout/AppBody.vue.mjs +1 -1
  7. package/es/components/app-layout/AppBody.vue2.mjs +47 -49
  8. package/es/components/app-layout/AppBreadcrumb.vue.mjs +1 -1
  9. package/es/components/app-layout/AppBreadcrumb.vue2.mjs +35 -41
  10. package/es/components/app-layout/AppFooter.vue.mjs +2 -2
  11. package/es/components/app-layout/AppFooter.vue2.mjs +8 -8
  12. package/es/components/app-layout/AppHeader.vue.mjs +1 -1
  13. package/es/components/app-layout/AppHeader.vue2.mjs +60 -69
  14. package/es/components/app-layout/AppLayout.vue.mjs +2 -2
  15. package/es/components/app-layout/AppLayout.vue2.mjs +95 -93
  16. package/es/components/app-layout/AppSidebar.vue.mjs +2 -2
  17. package/es/components/app-layout/AppSidebar.vue2.mjs +79 -82
  18. package/es/components/app-layout/AppTheme.vue.mjs +7 -0
  19. package/es/components/app-layout/AppTheme.vue2.mjs +38 -0
  20. package/es/components/data-view/DataListView.vue.mjs +2 -2
  21. package/es/components/data-view/DataListView.vue2.mjs +36 -36
  22. package/es/components/display/ActionConfirm.vue2.mjs +16 -16
  23. package/es/components/display/HeightProvider.vue.mjs +10 -10
  24. package/es/components/display/TabsHeader.vue.mjs +4 -4
  25. package/es/components/display/TabsHeader.vue2.mjs +34 -34
  26. package/es/components/display/TabsMain.vue.mjs +40 -39
  27. package/es/components/display/TabsRefineFlow.vue.mjs +30 -28
  28. package/es/components/form/FormItem.vue.mjs +1 -1
  29. package/es/components/form/FormItem.vue2.mjs +75 -81
  30. package/es/components/form/FormItemNestForm.vue.mjs +7 -0
  31. package/es/components/form/FormItemNestForm.vue2.mjs +49 -0
  32. package/es/components/form/FormItemNestFormList.vue.mjs +7 -0
  33. package/es/components/form/FormItemNestFormList.vue2.mjs +137 -0
  34. package/es/components/form/FormMain.vue.mjs +5 -147
  35. package/es/components/form/FormMain.vue2.mjs +160 -2
  36. package/es/components/form/FormRadioGroup.vue.mjs +42 -49
  37. package/es/components/form/FormSearch.vue.mjs +2 -2
  38. package/es/components/form/FormSearch.vue2.mjs +122 -128
  39. package/es/components/form/FormSelect.vue.mjs +34 -40
  40. package/es/components/form/FormSubmitBtn.vue.mjs +23 -28
  41. package/es/components/form/FormSubmitPanel.vue.mjs +2 -2
  42. package/es/components/form/FormSubmitPanel.vue2.mjs +29 -28
  43. package/es/components/form/FormTree.vue.mjs +16 -21
  44. package/es/components/form/FormVerifyCode.vue.mjs +37 -43
  45. package/es/components/form/FormVerifyImage.vue.mjs +2 -2
  46. package/es/components/form/FormVerifyImage.vue2.mjs +36 -41
  47. package/es/components/form/nest-form-item-list.mjs +71 -0
  48. package/es/components/form/nest-form-item.mjs +42 -0
  49. package/es/components/form/nest-registry.mjs +7 -0
  50. package/es/components/form/use-nest-form-list.mjs +22 -0
  51. package/es/components/form/use-nest-form.mjs +34 -0
  52. package/es/components/form/use-nest-layout-scale.mjs +14 -0
  53. package/es/components/form/utils.mjs +77 -61
  54. package/es/components/list-page/ListPage.vue.mjs +2 -2
  55. package/es/components/list-page/ListPage.vue2.mjs +134 -139
  56. package/es/components/menu/MenuItemSub.vue.mjs +41 -48
  57. package/es/components/menu/MenuTree.vue.mjs +58 -65
  58. package/es/components/misc/AutoRefresh.vue.mjs +2 -2
  59. package/es/components/misc/AutoRefresh.vue2.mjs +44 -51
  60. package/es/components/misc/AutoRefreshGroup.vue.mjs +2 -2
  61. package/es/components/misc/AutoRefreshGroup.vue2.mjs +37 -43
  62. package/es/components/modal/ConfirmModal.vue.mjs +3 -4
  63. package/es/components/modal/ConfirmModal.vue2.mjs +83 -111
  64. package/es/components/modal/DetailModal.vue.mjs +38 -41
  65. package/es/components/panel/PanelEditSwitch.vue.mjs +1 -1
  66. package/es/components/panel/PanelEditSwitch.vue2.mjs +50 -55
  67. package/es/components/panel/PanelItemNestForm.vue.mjs +7 -0
  68. package/es/components/panel/PanelItemNestForm.vue2.mjs +69 -0
  69. package/es/components/panel/PanelItemNestPanel.vue.mjs +34 -0
  70. package/es/components/panel/PanelItemNestPanel.vue2.mjs +4 -0
  71. package/es/components/panel/PanelMain.vue.mjs +1 -1
  72. package/es/components/panel/PanelMain.vue2.mjs +72 -72
  73. package/es/components/panel/nest-panel-form.mjs +53 -0
  74. package/es/components/panel/nest-panel-item.mjs +25 -0
  75. package/es/components/table/TableMain.vue.mjs +2 -2
  76. package/es/components/table/TableMain.vue2.mjs +221 -229
  77. package/es/components/table/TableToolbar.vue.mjs +2 -2
  78. package/es/components/table/TableToolbar.vue2.mjs +115 -126
  79. package/es/hooks/use-admin-theme-apply.mjs +84 -0
  80. package/es/hooks/use-admin-viewport-apply.mjs +27 -0
  81. package/es/index.mjs +190 -153
  82. package/es/inject/key.mjs +15 -6
  83. package/es/store/app.mjs +75 -84
  84. package/es/style.css +1 -1
  85. package/es/utils/theme-scale.mjs +37 -0
  86. package/package.json +2 -4
  87. package/types/bridge/config-hook.d.ts +91 -0
  88. package/types/bridge/index.d.ts +108 -8
  89. package/types/bridge/plugin.d.ts +39 -0
  90. package/types/bridge/theme.d.ts +85 -0
  91. package/types/components/app-layout/AppTheme.vue.d.ts +2 -0
  92. package/types/components/app-layout/types.d.ts +1 -1
  93. package/types/components/form/FormItem.vue.d.ts +12 -12
  94. package/types/components/form/FormItemNestForm.vue.d.ts +36 -0
  95. package/types/components/form/FormItemNestFormList.vue.d.ts +63 -0
  96. package/types/components/form/FormMain.vue.d.ts +2 -2
  97. package/types/components/form/FormSearch.vue.d.ts +2 -2
  98. package/types/components/form/FormTree.vue.d.ts +50 -50
  99. package/types/components/form/index.d.ts +9 -1
  100. package/types/components/form/nest-form-item-list.d.ts +63 -0
  101. package/types/components/form/nest-form-item.d.ts +36 -0
  102. package/types/components/form/nest-registry.d.ts +22 -0
  103. package/types/components/form/types.d.ts +2 -0
  104. package/types/components/form/use-nest-form-list.d.ts +20 -0
  105. package/types/components/form/use-nest-form.d.ts +26 -0
  106. package/types/components/form/use-nest-layout-scale.d.ts +17 -0
  107. package/types/components/form/utils.d.ts +26 -1
  108. package/types/components/menu/MenuTree.vue.d.ts +10 -10
  109. package/types/components/modal/ModalShelf.vue.d.ts +1 -1
  110. package/types/components/panel/PanelItemNestForm.vue.d.ts +35 -0
  111. package/types/components/panel/PanelItemNestPanel.vue.d.ts +22 -0
  112. package/types/components/panel/index.d.ts +5 -1
  113. package/types/components/panel/nest-panel-form.d.ts +38 -0
  114. package/types/components/panel/nest-panel-item.d.ts +28 -0
  115. package/types/components/panel/types.d.ts +2 -0
  116. package/types/components/table/TableMain.vue.d.ts +3 -3
  117. package/types/hooks/activated.d.ts +2 -2
  118. package/types/hooks/feel-size.d.ts +1 -1
  119. package/types/hooks/index.d.ts +2 -0
  120. package/types/hooks/menus-dispatch.d.ts +5 -5
  121. package/types/hooks/use-admin-theme-apply.d.ts +17 -0
  122. package/types/hooks/use-admin-viewport-apply.d.ts +15 -0
  123. package/types/hooks/use-breakpoint.d.ts +1 -1
  124. package/types/inject/key.d.ts +46 -1
  125. package/types/store/app.d.ts +138 -59
  126. package/types/utils/index.d.ts +1 -0
  127. package/types/utils/theme-scale.d.ts +35 -0
@@ -1,11 +1,11 @@
1
- import { defineComponent as m, inject as R, toRefs as T, useModel as A, useSlots as N, ref as P, computed as f, h as $, provide as q, watch as x, openBlock as i, createBlock as l, resolveDynamicComponent as E, unref as r, mergeProps as I, withCtx as s, KeepAlive as U, createCommentVNode as j, createVNode as z, createSlots as D, renderList as F, renderSlot as G, normalizeProps as J, guardReactiveProps as O, mergeModels as Q } from "vue";
2
- import W from "./TabsRefineFlow.vue.mjs";
3
- import X from "./TabsNaturalFlow.vue.mjs";
4
- import Y from "./TabsHeader.vue.mjs";
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__ */ m({
6
+ const oe = /* @__PURE__ */ c({
7
7
  __name: "TabsMain",
8
- props: /* @__PURE__ */ Q({
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 o = u, p = R(h, 0) + 1, {
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: k,
32
- variant: V,
31
+ refineReduceHeight: V,
32
+ variant: k,
33
33
  tabs: d
34
- } = T(o), a = A(u, "modelValue"), _ = N(), c = P(void 0), C = f(
35
- () => v.value ? W : X
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: k.value
43
+ refineReduceHeight: V.value
44
44
  } : {}
45
- ), K = (e) => o.tabs.find((n) => n.key === e), M = (e) => {
46
- c.value = e;
47
- }, S = m({
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(e) {
53
+ setup(t) {
54
54
  return () => {
55
- const n = _[e.paneKey], t = K(e.paneKey);
56
- return n ? n({
57
- tab: t,
55
+ const e = C[t.paneKey], a = K(t.paneKey);
56
+ return e ? e({
57
+ tab: a,
58
58
  active: !0,
59
- viewportHeight: e.viewportHeight
60
- }) : t != null && t.component ? $(t.component) : null;
59
+ viewportHeight: t.viewportHeight
60
+ }) : a != null && a.component ? $(a.component) : null;
61
61
  };
62
62
  }
63
63
  });
64
- return q(h, p), x(
65
- [a, () => o.tabs],
64
+ return x(h, p), E(
65
+ [n, () => r.tabs],
66
66
  () => {
67
- !(!!a.value && o.tabs.some((n) => n.key === a.value)) && o.tabs.length && (a.value = o.tabs[0].key);
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
- ), (e, n) => (i(), l(E(r(C)), I(r(L), { onViewportHeightChange: M }), {
70
+ ), (t, e) => (o(), l(q(_.value), I(L.value, { onViewportHeightChange: M }), {
71
71
  header: s(() => [
72
- z(Y, {
73
- "active-key": a.value,
74
- "onUpdate:activeKey": n[0] || (n[0] = (t) => a.value = t),
75
- tabs: r(d),
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: r(V)
77
+ variant: i(k)
78
78
  }, D({ _: 2 }, [
79
- F(r(d), (t) => ({
80
- name: t.key,
79
+ F(i(d), (a) => ({
80
+ name: a.key,
81
81
  fn: s((B) => [
82
- G(e.$slots, `header-${t.key}`, J(O(B)))
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
- (i(), l(U, null, [
89
- a.value ? (i(), l(r(S), {
90
- key: a.value,
91
- "pane-key": a.value,
92
- "viewport-height": r(c)
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 w, ref as C, computed as n, provide as b, watch as y, openBlock as S, createBlock as V, unref as l, createSlots as $, withCtx as h, createElementVNode as x, normalizeStyle as _, renderSlot as d } from "vue";
2
- import k from "./HeightProvider.vue.mjs";
3
- import { useChannelViewportHeight as L } from "../../hooks/use-channel-viewport-height.mjs";
4
- const M = /* @__PURE__ */ w({
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(i, { emit: p }) {
16
- const e = i, c = p, o = e.channel ? Symbol.for(e.channel) : void 0, { viewportHeightFinal: s, parentLevel: a } = L(e), r = C(0), g = n(() => e.padding[0] + e.padding[2]), m = n(() => ({
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 = n(
19
+ })), v = i(
20
20
  () => Math.max(
21
- s.value - g.value - e.refineReduceHeight,
21
+ c.value - s.value - e.refineReduceHeight,
22
22
  0
23
23
  )
24
- ), u = n(
25
- () => a.value > 0 ? a.value : 1
26
- ), f = n(() => u.value + 1), H = (t) => {
27
- r.value = t, c("viewportHeightChange", t);
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 o && b(o, {
30
- viewportHeight: n(() => r.value),
31
- level: f.value
32
- }), y(
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, R) => (S(), V(k, {
37
- viewportHeight: l(v),
38
- minHeight: i.minHeight,
39
- onChildViewportHeightChange: H
40
- }, $({
41
- default: h(() => [
42
- x("div", {
43
- style: _(l(m))
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
- d(t.$slots, "default")
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: h(() => [
53
- d(t.$slots, "header")
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
- M as default
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-0dd66b41"]]);
4
+ const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-8b508d64"]]);
5
5
  export {
6
6
  _ as default
7
7
  };
@@ -1,14 +1,11 @@
1
- import { ElFormItem as q, ElText as G } from "element-plus/es";
2
- import "element-plus/es/components/base/style/css";
3
- import "element-plus/es/components/form-item/style/css";
4
- import "element-plus/es/components/text/style/css";
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
- }, pe = /* @__PURE__ */ J({
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(i, { emit: L }) {
20
- const t = i, l = L, P = Q(), B = n(() => {
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
- }), w = n(() => B.value.filter((e) => e.key !== t.config.key)), V = n(() => w.value.length > 0), x = n(() => t.data[t.config.key]), g = n(() => ({
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(g.value) : e.wrapProps || {};
31
- }), C = n(() => {
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(g.value) : e.props || {};
30
+ return typeof e.props == "function" ? e.props(s.value) : e.props || {};
34
31
  }), T = () => {
35
- l("submit", "enter");
32
+ c("submit", "enter");
36
33
  }, A = () => {
37
- l("submit", "blur");
34
+ c("submit", "blur");
38
35
  }, M = () => {
39
- l("submit", "change");
40
- }, E = (e, o) => {
41
- w.value.forEach((u) => {
42
- const { key: f, getValue: S } = u, j = S(e, t.data[f], o);
43
- t.data[f] = S(e, j);
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(() => ae(C.value, ["children"])), K = n(() => re({
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(() => V.value ? {
54
- onTriggerChangeLink: E
55
- } : {}), d = n(() => ({
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
- })), s = n(() => {
62
- const { children: e } = C.value;
58
+ })), l = n(() => {
59
+ const { children: e } = P.value;
63
60
  return e;
64
- }), I = n(() => {
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
- ...g.value,
68
- getInitValue: () => ie([e])[e.key]
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
- p(
75
- I,
71
+ f(
72
+ V,
76
73
  (e) => {
77
74
  var o;
78
- l("viewHideChange", {
75
+ c("viewHideChange", {
79
76
  config: t.config,
80
77
  status: e
81
- }), e && ((o = P.value) == null || o.clearValidate());
78
+ }), e && ((o = k.value) == null || o.clearValidate());
82
79
  },
83
80
  {
84
81
  immediate: !0
85
82
  }
86
83
  );
87
- let m;
88
- return p(
89
- V,
84
+ let u;
85
+ return f(
86
+ b,
90
87
  (e) => {
91
- e ? m = p(
88
+ e ? u = f(
92
89
  x,
93
90
  (o) => {
94
- E(o);
91
+ w(o);
95
92
  },
96
93
  {
97
94
  immediate: !0
98
95
  }
99
- ) : m == null || m();
96
+ ) : u == null || u();
100
97
  },
101
98
  {
102
99
  immediate: !0
103
100
  }
104
- ), (e, o) => {
105
- const u = G, f = q;
106
- return U((a(), c(f, v({
107
- ref_key: "formItem",
108
- ref: P,
109
- prop: i.config.key,
110
- label: i.config.label,
111
- class: r(R)
112
- }, r(D)), {
113
- default: y(() => [
114
- i.config.render === void 0 ? W(e.$slots, "default", F(v({ key: 0 }, r(d))), () => [
115
- k(h(r(d).modelValue), 1)
116
- ], !0) : (a(), c(b(i.config.render), F(v({ key: 1 }, r(d))), X({ _: 2 }, [
117
- r(s) !== void 0 ? {
118
- name: "default",
119
- fn: y(() => [
120
- typeof r(s) == "function" ? (a(), c(b(r(s)), { key: 0 })) : (a(), H(Y, { key: 1 }, [
121
- k(h(r(s)), 1)
122
- ], 64))
123
- ]),
124
- key: "0"
125
- } : void 0
126
- ]), 1040)),
127
- i.config.tip ? (a(), H("div", ce, [
128
- typeof i.config.tip == "function" ? (a(), c(b(i.config.tip), { key: 0 })) : (a(), c(u, {
129
- key: 1,
130
- type: "info"
131
- }, {
132
- default: y(() => [
133
- k(h(i.config.tip), 1)
134
- ]),
135
- _: 1
136
- }))
137
- ])) : Z("", !0)
138
- ]),
139
- _: 3
140
- }, 16, ["prop", "label", "class"])), [
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
- pe as default
141
+ fe as default
148
142
  };
@@ -0,0 +1,7 @@
1
+ import o from "./FormItemNestForm.vue2.mjs";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9c251e76"]]);
5
+ export {
6
+ p as default
7
+ };
@@ -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,7 @@
1
+ import o from "./FormItemNestFormList.vue2.mjs";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-f424fc36"]]);
5
+ export {
6
+ s as default
7
+ };
@@ -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
+ };