@done-coding/admin-core 0.27.0 → 0.27.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 (134) hide show
  1. package/es/bridge/index.mjs +11 -3
  2. package/es/components/app-layout/AppBody.vue.mjs +1 -1
  3. package/es/components/app-layout/AppBody.vue2.mjs +14 -5
  4. package/es/components/app-layout/AppHeader.vue.mjs +1 -1
  5. package/es/components/app-layout/AppHeader.vue2.mjs +7 -5
  6. package/es/components/app-layout/AppLayout.vue.mjs +1 -1
  7. package/es/components/app-layout/AppLayout.vue2.mjs +2 -1
  8. package/es/components/app-layout/AppPage.vue.mjs +1 -1
  9. package/es/components/app-layout/AppPage.vue2.mjs +35 -32
  10. package/es/components/app-layout/app-page-geometry.mjs +16 -16
  11. package/es/components/app-layout/app-page-recommended.mjs +10 -0
  12. package/es/components/data-view/DataGridView.vue.mjs +1 -1
  13. package/es/components/data-view/DataGridView.vue2.mjs +29 -17
  14. package/es/components/data-view/DataListView.vue.mjs +1 -1
  15. package/es/components/data-view/DataListView.vue2.mjs +10 -0
  16. package/es/components/data-view/InfiniteListView.vue.mjs +1 -1
  17. package/es/components/data-view/InfiniteListView.vue2.mjs +9 -3
  18. package/es/components/data-view/use-active-scroll.mjs +15 -0
  19. package/es/components/display/DragFloat.vue.mjs +7 -0
  20. package/es/components/display/DragFloat.vue2.mjs +109 -0
  21. package/es/components/display/TabsHeader.vue.mjs +1 -1
  22. package/es/components/display/TabsHeader.vue2.mjs +9 -10
  23. package/es/components/display/TabsMain.vue.mjs +22 -7
  24. package/es/components/display/tabs-variant.mjs +14 -0
  25. package/es/components/form/FormDivider.vue.mjs +7 -0
  26. package/es/components/form/FormDivider.vue2.mjs +14 -0
  27. package/es/components/form/FormGroupTitle.vue.mjs +7 -0
  28. package/es/components/form/FormGroupTitle.vue2.mjs +59 -0
  29. package/es/components/form/FormItemNestForm.vue.mjs +1 -1
  30. package/es/components/form/FormItemNestFormList.vue.mjs +1 -1
  31. package/es/components/form/FormMain.vue.mjs +1 -1
  32. package/es/components/form/FormMain.vue2.mjs +69 -9
  33. package/es/components/form/FormSearch.vue.mjs +1 -1
  34. package/es/components/form/FormSearch.vue2.mjs +15 -3
  35. package/es/components/form/FormSubmitPanel.vue.mjs +1 -1
  36. package/es/components/form/FormSubmitPanel.vue2.mjs +14 -1
  37. package/es/components/form/ai-schema.mjs +139 -0
  38. package/es/components/form/group.mjs +81 -0
  39. package/es/components/form/use-ai-fill.mjs +71 -0
  40. package/es/components/form/utils.mjs +15 -4
  41. package/es/components/list-layout/ListLayout.vue.mjs +1 -1
  42. package/es/components/list-layout/ListLayout.vue2.mjs +103 -62
  43. package/es/components/modal/ImagePreviewTrigger.vue.mjs +5 -1
  44. package/es/components/modal/ModalConfirm.vue.mjs +1 -1
  45. package/es/components/modal/ModalConfirm.vue2.mjs +8 -5
  46. package/es/components/modal/VideoPreviewTrigger.vue.mjs +1 -1
  47. package/es/components/modal/VideoPreviewTrigger.vue2.mjs +2 -1
  48. package/es/components/page-layout/AppPageDetail.vue.mjs +1 -1
  49. package/es/components/page-layout/AppPageDetail.vue2.mjs +17 -13
  50. package/es/components/page-layout/AppPageListDetailLayout.vue.mjs +7 -4
  51. package/es/components/page-layout/AppPageListDetailSheet.vue.mjs +12 -4
  52. package/es/components/page-layout/AppPageListDetailSplit.vue.mjs +1 -1
  53. package/es/components/page-layout/AppPageListDetailSplit.vue2.mjs +10 -3
  54. package/es/components/table/TableMain.vue.mjs +1 -1
  55. package/es/components/table/TableMain.vue2.mjs +45 -25
  56. package/es/components/view-layout/ViewLayout.vue.mjs +1 -1
  57. package/es/components/view-layout/ViewLayout.vue2.mjs +46 -15
  58. package/es/config/slot-region.mjs +1 -0
  59. package/es/hooks/use-active-record.mjs +5 -1
  60. package/es/hooks/use-surface.mjs +27 -0
  61. package/es/hooks/use-theme-apply.mjs +52 -18
  62. package/es/index.mjs +81 -59
  63. package/es/inject/key.mjs +4 -0
  64. package/es/store/app.mjs +51 -17
  65. package/es/style.css +361 -184
  66. package/es/utils/dom.mjs +7 -1
  67. package/es/utils/gap-scale.mjs +25 -0
  68. package/es/utils/theme-scale.mjs +27 -0
  69. package/package.json +2 -2
  70. package/src/bridge/docs/README.md +30 -0
  71. package/src/components/app-layout/docs/README-AppBody.md +21 -0
  72. package/src/components/app-layout/docs/README-AppPage.md +20 -3
  73. package/src/components/data-view/docs/README-DataGridView.md +15 -0
  74. package/src/components/data-view/docs/README-DataListView.md +13 -0
  75. package/src/components/data-view/docs/README-InfiniteListView.md +15 -0
  76. package/src/components/display/README.md +1 -0
  77. package/src/components/display/docs/README-DragFloat.md +68 -0
  78. package/src/components/form/README.md +4 -2
  79. package/src/components/form/docs/README-FormItemNestForm.md +5 -3
  80. package/src/components/form/docs/README-FormItemNestFormList.md +7 -1
  81. package/src/components/form/docs/README-FormMain.md +102 -1
  82. package/src/components/form/docs/README-FormSearch.md +5 -0
  83. package/src/components/list-layout/docs/README-ListLayout.md +61 -1
  84. package/src/components/modal/docs/README-ImagePreviewTrigger.md +2 -0
  85. package/src/components/modal/docs/README-VideoPreviewTrigger.md +4 -1
  86. package/src/components/page-layout/docs/README-AppPageDetail.md +11 -1
  87. package/src/components/page-layout/docs/README-AppPageListDetailLayout.md +64 -6
  88. package/src/components/table/docs/README-TableMain.md +22 -0
  89. package/src/components/view-layout/docs/README-ViewLayout.md +27 -2
  90. package/src/hooks/docs/README.md +30 -1
  91. package/types/bridge/index.d.ts +69 -10
  92. package/types/components/app-layout/AppPage.vue.d.ts +15 -7
  93. package/types/components/app-layout/app-page-geometry.d.ts +19 -10
  94. package/types/components/app-layout/app-page-recommended.d.ts +12 -0
  95. package/types/components/app-layout/index.d.ts +1 -0
  96. package/types/components/data-view/types.d.ts +18 -0
  97. package/types/components/data-view/use-active-scroll.d.ts +30 -0
  98. package/types/components/display/BadgeMark.vue.d.ts +2 -2
  99. package/types/components/display/DragFloat.vue.d.ts +35 -0
  100. package/types/components/display/TabsHeader.vue.d.ts +7 -0
  101. package/types/components/display/index.d.ts +8 -1
  102. package/types/components/display/tabs-variant.d.ts +17 -0
  103. package/types/components/display/types.d.ts +6 -0
  104. package/types/components/form/FormDivider.vue.d.ts +2 -0
  105. package/types/components/form/FormGroupTitle.vue.d.ts +22 -0
  106. package/types/components/form/FormItemNestForm.vue.d.ts +2 -0
  107. package/types/components/form/ai-schema.d.ts +24 -0
  108. package/types/components/form/group.d.ts +36 -0
  109. package/types/components/form/index.d.ts +2 -0
  110. package/types/components/form/types.d.ts +94 -3
  111. package/types/components/form/use-ai-fill.d.ts +59 -0
  112. package/types/components/form/utils.d.ts +19 -0
  113. package/types/components/list-layout/ListLayout.vue.d.ts +3 -0
  114. package/types/components/list-layout/types.d.ts +28 -0
  115. package/types/components/modal/ModalConfirm.vue.d.ts +1 -1
  116. package/types/components/modal/VideoPreviewTrigger.vue.d.ts +1 -1
  117. package/types/components/page-layout/AppPageDetail.vue.d.ts +2 -2
  118. package/types/components/page-layout/AppPageListDetailLayout.vue.d.ts +3 -7
  119. package/types/components/page-layout/AppPageListDetailSheet.vue.d.ts +4 -8
  120. package/types/components/page-layout/AppPageListDetailSplit.vue.d.ts +4 -8
  121. package/types/components/page-layout/types.d.ts +42 -0
  122. package/types/components/panel/PanelItemNestForm.vue.d.ts +2 -0
  123. package/types/components/table/types.d.ts +9 -0
  124. package/types/components/view-layout/ViewLayout.vue.d.ts +18 -0
  125. package/types/components/view-layout/types.d.ts +15 -0
  126. package/types/config/slot-region.d.ts +10 -1
  127. package/types/hooks/use-surface.d.ts +34 -0
  128. package/types/inject/key.d.ts +10 -0
  129. package/types/injectInfo.json.d.ts +1 -1
  130. package/types/store/app.d.ts +3 -0
  131. package/types/utils/dom.d.ts +31 -0
  132. package/types/utils/gap-scale.d.ts +46 -0
  133. package/types/utils/index.d.ts +1 -0
  134. package/types/utils/theme-scale.d.ts +33 -0
@@ -0,0 +1,15 @@
1
+ import { watch, nextTick } from "vue";
2
+ import { domScrollIntoViewport } from "../../utils/dom.mjs";
3
+ const useActiveScroll = (options) => {
4
+ const selector = options.activeSelector ?? ".is-active";
5
+ watch(options.activeId, (id) => {
6
+ if (!options.enabled() || id === void 0) return;
7
+ nextTick(() => {
8
+ var _a;
9
+ domScrollIntoViewport((_a = options.container()) == null ? void 0 : _a.querySelector(selector));
10
+ });
11
+ });
12
+ };
13
+ export {
14
+ useActiveScroll
15
+ };
@@ -0,0 +1,7 @@
1
+ import _sfc_main from "./DragFloat.vue2.mjs";
2
+ /* empty css */
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const DragFloat = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0ab49ed7"]]);
5
+ export {
6
+ DragFloat as default
7
+ };
@@ -0,0 +1,109 @@
1
+ import { defineComponent, shallowRef, ref, computed, openBlock, createElementBlock, normalizeStyle, normalizeClass, renderSlot } from "vue";
2
+ const DRAG_THRESHOLD_PX = 3;
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ ...{ name: "DragFloat" },
5
+ __name: "DragFloat",
6
+ props: {
7
+ placement: { default: "top-right" },
8
+ offset: { default: 0 },
9
+ breathing: { type: Boolean, default: true }
10
+ },
11
+ setup(__props) {
12
+ const props = __props;
13
+ const rootRef = shallowRef();
14
+ const dragFloatPos = ref(null);
15
+ const pressing = ref(false);
16
+ const dragging = ref(false);
17
+ const pressStart = ref(null);
18
+ const rootStyle = computed(() => {
19
+ if (dragFloatPos.value) {
20
+ return {
21
+ left: `${dragFloatPos.value.left}px`,
22
+ top: `${dragFloatPos.value.top}px`
23
+ };
24
+ }
25
+ const o = `${props.offset}px`;
26
+ const [v, h] = props.placement.split("-");
27
+ return { [v]: o, [h]: o };
28
+ });
29
+ const resolveCurrentPos = () => {
30
+ if (dragFloatPos.value) return dragFloatPos.value;
31
+ const el = rootRef.value;
32
+ const parent = el == null ? void 0 : el.offsetParent;
33
+ if (!el || !parent) return { left: 0, top: 0 };
34
+ return { left: el.offsetLeft, top: el.offsetTop };
35
+ };
36
+ const clampToParent = (left, top) => {
37
+ const el = rootRef.value;
38
+ const parent = el == null ? void 0 : el.offsetParent;
39
+ if (!el || !parent) return { left, top };
40
+ const maxLeft = Math.max(0, parent.clientWidth - el.offsetWidth);
41
+ const maxTop = Math.max(0, parent.clientHeight - el.offsetHeight);
42
+ return {
43
+ left: Math.min(Math.max(0, left), maxLeft),
44
+ top: Math.min(Math.max(0, top), maxTop)
45
+ };
46
+ };
47
+ const onPointerDown = (e) => {
48
+ if (e.isPrimary === false) return;
49
+ const { left, top } = resolveCurrentPos();
50
+ pressStart.value = { x: e.clientX, y: e.clientY, left, top };
51
+ pressing.value = true;
52
+ dragging.value = false;
53
+ };
54
+ const onPointerMove = (e) => {
55
+ var _a;
56
+ const start = pressStart.value;
57
+ if (!pressing.value || !start) return;
58
+ const dx = e.clientX - start.x;
59
+ const dy = e.clientY - start.y;
60
+ if (!dragging.value) {
61
+ if (Math.hypot(dx, dy) < DRAG_THRESHOLD_PX) return;
62
+ dragging.value = true;
63
+ try {
64
+ (_a = rootRef.value) == null ? void 0 : _a.setPointerCapture(e.pointerId);
65
+ } catch {
66
+ }
67
+ }
68
+ dragFloatPos.value = clampToParent(start.left + dx, start.top + dy);
69
+ };
70
+ const onPointerUp = (e) => {
71
+ var _a, _b;
72
+ if (!pressing.value) return;
73
+ pressing.value = false;
74
+ pressStart.value = null;
75
+ try {
76
+ (_b = (_a = rootRef.value) == null ? void 0 : _a.releasePointerCapture) == null ? void 0 : _b.call(_a, e.pointerId);
77
+ } catch {
78
+ }
79
+ };
80
+ const onClickCapture = (e) => {
81
+ if (!dragging.value) return;
82
+ dragging.value = false;
83
+ e.stopImmediatePropagation();
84
+ e.stopPropagation();
85
+ e.preventDefault();
86
+ };
87
+ return (_ctx, _cache) => {
88
+ return openBlock(), createElementBlock("div", {
89
+ ref_key: "rootRef",
90
+ ref: rootRef,
91
+ class: normalizeClass(["dc-drag-float drag-float", {
92
+ "drag-float_dragging": dragging.value,
93
+ "drag-float_breathing": __props.breathing && !dragging.value
94
+ }]),
95
+ style: normalizeStyle(rootStyle.value),
96
+ onPointerdown: onPointerDown,
97
+ onPointermove: onPointerMove,
98
+ onPointerup: onPointerUp,
99
+ onPointercancel: onPointerUp,
100
+ onClickCapture
101
+ }, [
102
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
103
+ ], 38);
104
+ };
105
+ }
106
+ });
107
+ export {
108
+ _sfc_main as default
109
+ };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./TabsHeader.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const TabsHeader = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1f3b9f99"]]);
4
+ const TabsHeader = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-14448dd1"]]);
5
5
  export {
6
6
  TabsHeader as default
7
7
  };
@@ -1,4 +1,5 @@
1
- import { defineComponent, toRefs, useModel, ref, computed, watch, openBlock, createElementBlock, normalizeClass, Fragment, renderList, unref, createVNode, withCtx, renderSlot, createTextVNode, toDisplayString, normalizeStyle, createCommentVNode, mergeModels, nextTick } from "vue";
1
+ import { defineComponent, useCssVars, unref, toRefs, useModel, ref, computed, watch, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createVNode, withCtx, renderSlot, createTextVNode, toDisplayString, normalizeStyle, createCommentVNode, mergeModels, nextTick } from "vue";
2
+ import { resolveTabsHeaderVariant, TABS_ACTIVE_BG_DEFAULT } from "./tabs-variant.mjs";
2
3
  import BadgeMark from "./BadgeMark.vue.mjs";
3
4
  import { useActivated } from "../../hooks/activated.mjs";
4
5
  const _hoisted_1 = ["onClick"];
@@ -7,15 +8,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
7
8
  props: /* @__PURE__ */ mergeModels({
8
9
  tabs: {},
9
10
  level: { default: 1 },
10
- variant: {}
11
+ variant: {},
12
+ activeBg: { default: TABS_ACTIVE_BG_DEFAULT }
11
13
  }, {
12
14
  "activeKey": {},
13
15
  "activeKeyModifiers": {}
14
16
  }),
15
17
  emits: ["update:activeKey"],
16
18
  setup(__props) {
19
+ useCssVars((_ctx) => ({
20
+ "v72da80bd": unref(activeBg)
21
+ }));
17
22
  const props = __props;
18
- const { tabs, level, variant } = toRefs(props);
23
+ const { tabs, level, variant, activeBg } = toRefs(props);
19
24
  const activeKey = useModel(__props, "activeKey");
20
25
  const tabElMap = /* @__PURE__ */ new Map();
21
26
  const bump = ref(0);
@@ -23,14 +28,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23
28
  () => Math.min(Math.max(Math.floor(level.value), 1), 4)
24
29
  );
25
30
  const levelClass = computed(() => `tabs-main-bar--l${levelClamp.value}`);
26
- const variantDefaultByLevel = {
27
- 1: "card",
28
- 2: "indicator",
29
- 3: "indicator-compact",
30
- 4: "plain"
31
- };
32
31
  const variantResolved = computed(
33
- () => variant.value ?? variantDefaultByLevel[levelClamp.value]
32
+ () => resolveTabsHeaderVariant(variant.value, level.value)
34
33
  );
35
34
  const variantClass = computed(
36
35
  () => `tabs-main-bar--variant-${variantResolved.value}`
@@ -1,8 +1,9 @@
1
- import { defineComponent, inject, toRefs, useModel, useSlots, ref, computed, h, provide, watch, unref, openBlock, createBlock, mergeProps, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, resolveDynamicComponent, KeepAlive, createCommentVNode, createVNode, createElementVNode, mergeModels } from "vue";
1
+ import { defineComponent, inject, computed, toRefs, useModel, useSlots, ref, h, provide, watch, unref, openBlock, createBlock, mergeProps, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, resolveDynamicComponent, KeepAlive, createCommentVNode, createVNode, createElementVNode, normalizeStyle, mergeModels } from "vue";
2
2
  import { useRoute, useRouter } from "vue-router";
3
3
  import _sfc_main$1 from "./TabsRefineFlow.vue.mjs";
4
4
  import _sfc_main$2 from "./TabsNaturalFlow.vue.mjs";
5
5
  import TabsHeader from "./TabsHeader.vue.mjs";
6
+ import { resolveTabsHeaderVariant, TABS_ACTIVE_BG_DEFAULT } from "./tabs-variant.mjs";
6
7
  import TabsTile from "./TabsTile.vue.mjs";
7
8
  import { watchTabToQuery, getTabQuery } from "./use-tabs-query-sync.mjs";
8
9
  import { useContextDefaults } from "../../hooks/use-context-defaults.mjs";
@@ -21,6 +22,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
21
22
  refine: { type: Boolean, default: void 0 },
22
23
  refineReduceHeight: { default: 0 },
23
24
  variant: {},
25
+ activeBg: {},
24
26
  queryKey: {},
25
27
  tile: { type: Boolean },
26
28
  navPosition: {},
@@ -42,6 +44,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
42
44
  });
43
45
  const parentVisualLevel = inject(TABS_MAIN_VISUAL_LEVEL, 0);
44
46
  const selfVisualLevel = parentVisualLevel + 1;
47
+ const isCardVariant = computed(
48
+ () => resolveTabsHeaderVariant(props.variant, selfVisualLevel) === "card"
49
+ );
50
+ const headerContentGap = computed(() => isCardVariant.value ? "0px" : "8px");
51
+ const rootStyle = computed(
52
+ () => isCardVariant.value ? { background: activeBg.value ?? TABS_ACTIVE_BG_DEFAULT } : void 0
53
+ );
45
54
  const {
46
55
  viewportHeight,
47
56
  minHeight,
@@ -50,6 +59,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
50
59
  padding,
51
60
  refineReduceHeight,
52
61
  variant,
62
+ activeBg,
53
63
  tabs,
54
64
  tile,
55
65
  navPosition,
@@ -134,6 +144,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
134
144
  modelValue: model.value,
135
145
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
136
146
  class: "dc-tabs-main",
147
+ style: rootStyle.value,
137
148
  tabs: unref(tabs),
138
149
  refine: unref(ctxRefine),
139
150
  "viewport-height": unref(viewportHeight),
@@ -159,9 +170,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
159
170
  ])
160
171
  };
161
172
  })
162
- ]), 1040, ["modelValue", "tabs", "refine", "viewport-height", "min-height", "parent-channel", "nav-position", "nav-mode", "nav-offset"])) : (openBlock(), createBlock(resolveDynamicComponent(wrapperComponent.value), mergeProps({
173
+ ]), 1040, ["modelValue", "style", "tabs", "refine", "viewport-height", "min-height", "parent-channel", "nav-position", "nav-mode", "nav-offset"])) : (openBlock(), createBlock(resolveDynamicComponent(wrapperComponent.value), mergeProps({
163
174
  key: 1,
164
- class: "dc-tabs-main"
175
+ class: "dc-tabs-main",
176
+ style: rootStyle.value
165
177
  }, wrapperProps.value, { onViewportHeightChange }), {
166
178
  header: withCtx(() => [
167
179
  createVNode(TabsHeader, {
@@ -169,7 +181,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
169
181
  "onUpdate:activeKey": _cache[1] || (_cache[1] = ($event) => model.value = $event),
170
182
  tabs: unref(tabs),
171
183
  level: selfVisualLevel,
172
- variant: unref(variant)
184
+ variant: unref(variant),
185
+ "active-bg": unref(activeBg)
173
186
  }, createSlots({ _: 2 }, [
174
187
  renderList(unref(tabs), (tab) => {
175
188
  return {
@@ -179,8 +192,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
179
192
  ])
180
193
  };
181
194
  })
182
- ]), 1032, ["active-key", "tabs", "variant"]),
183
- _cache[2] || (_cache[2] = createElementVNode("div", { style: { "height": "8px" } }, null, -1))
195
+ ]), 1032, ["active-key", "tabs", "variant", "active-bg"]),
196
+ createElementVNode("div", {
197
+ style: normalizeStyle({ height: headerContentGap.value })
198
+ }, null, 4)
184
199
  ]),
185
200
  default: withCtx(() => [
186
201
  (openBlock(), createBlock(KeepAlive, null, [
@@ -192,7 +207,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
192
207
  ], 1024))
193
208
  ]),
194
209
  _: 3
195
- }, 16));
210
+ }, 16, ["style"]));
196
211
  };
197
212
  }
198
213
  });
@@ -0,0 +1,14 @@
1
+ const TABS_VARIANT_DEFAULT_BY_LEVEL = {
2
+ 1: "card",
3
+ 2: "indicator",
4
+ 3: "indicator-compact",
5
+ 4: "plain"
6
+ };
7
+ const tabsClampLevel = (level) => Math.min(Math.max(Math.floor(level), 1), 4);
8
+ const resolveTabsHeaderVariant = (variant, level) => variant ?? TABS_VARIANT_DEFAULT_BY_LEVEL[tabsClampLevel(level)];
9
+ const TABS_ACTIVE_BG_DEFAULT = "var(--el-bg-color-page)";
10
+ export {
11
+ TABS_ACTIVE_BG_DEFAULT,
12
+ resolveTabsHeaderVariant,
13
+ tabsClampLevel
14
+ };
@@ -0,0 +1,7 @@
1
+ import _sfc_main from "./FormDivider.vue2.mjs";
2
+ /* empty css */
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const FormDivider = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-66a37c1d"]]);
5
+ export {
6
+ FormDivider as default
7
+ };
@@ -0,0 +1,14 @@
1
+ import { defineComponent, openBlock, createBlock, unref } from "vue";
2
+ import { ElDivider } from "element-plus";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ ...{ name: "FormDivider", inheritAttrs: false },
5
+ __name: "FormDivider",
6
+ setup(__props) {
7
+ return (_ctx, _cache) => {
8
+ return openBlock(), createBlock(unref(ElDivider), { class: "dc-form-divider form-divider" });
9
+ };
10
+ }
11
+ });
12
+ export {
13
+ _sfc_main as default
14
+ };
@@ -0,0 +1,7 @@
1
+ import _sfc_main from "./FormGroupTitle.vue2.mjs";
2
+ /* empty css */
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const FormGroupTitle = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c6148d68"]]);
5
+ export {
6
+ FormGroupTitle as default
7
+ };
@@ -0,0 +1,59 @@
1
+ import { defineComponent, inject, watch, nextTick, openBlock, createElementBlock, normalizeClass, createBlock, unref, withCtx, createVNode, createCommentVNode, createElementVNode, toDisplayString } from "vue";
2
+ import { ElIcon } from "element-plus";
3
+ import { CaretRight } from "@element-plus/icons-vue";
4
+ import { FORM_VALIDATE_ERROR_KEYS } from "../../inject/key.mjs";
5
+ import { domScrollIntoViewport } from "../../utils/dom.mjs";
6
+ const _hoisted_1 = { class: "form-group-title-text" };
7
+ const _sfc_main = /* @__PURE__ */ defineComponent({
8
+ ...{ name: "FormGroupTitle", inheritAttrs: false },
9
+ __name: "FormGroupTitle",
10
+ props: {
11
+ title: {},
12
+ collapsible: { type: Boolean, default: true },
13
+ collapsed: { type: Boolean, default: false },
14
+ memberKeys: { default: () => [] },
15
+ onToggle: { type: Function, default: void 0 },
16
+ onExpand: { type: Function, default: void 0 }
17
+ },
18
+ setup(__props) {
19
+ const props = __props;
20
+ const errorKeys = inject(FORM_VALIDATE_ERROR_KEYS, void 0);
21
+ watch(
22
+ () => errorKeys == null ? void 0 : errorKeys.value,
23
+ (keys) => {
24
+ var _a;
25
+ if (!props.collapsible || !(keys == null ? void 0 : keys.length)) return;
26
+ const hit = keys.find((k) => props.memberKeys.includes(k));
27
+ if (!hit) return;
28
+ if (props.collapsed) (_a = props.onExpand) == null ? void 0 : _a.call(props);
29
+ nextTick(() => {
30
+ domScrollIntoViewport(document.querySelector(".el-form-item.is-error"));
31
+ });
32
+ }
33
+ );
34
+ const onTitleClick = () => {
35
+ var _a;
36
+ if (props.collapsible) (_a = props.onToggle) == null ? void 0 : _a.call(props);
37
+ };
38
+ return (_ctx, _cache) => {
39
+ return openBlock(), createElementBlock("div", {
40
+ class: normalizeClass(["dc-form-group-title form-group-title", { "form-group-title_collapsible": __props.collapsible }]),
41
+ onClick: onTitleClick
42
+ }, [
43
+ __props.collapsible ? (openBlock(), createBlock(unref(ElIcon), {
44
+ key: 0,
45
+ class: normalizeClass(["form-group-title-arrow", { "form-group-title-arrow_collapsed": __props.collapsed }])
46
+ }, {
47
+ default: withCtx(() => [
48
+ createVNode(unref(CaretRight))
49
+ ]),
50
+ _: 1
51
+ }, 8, ["class"])) : createCommentVNode("", true),
52
+ createElementVNode("span", _hoisted_1, toDisplayString(__props.title), 1)
53
+ ], 2);
54
+ };
55
+ }
56
+ });
57
+ export {
58
+ _sfc_main as default
59
+ };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./FormItemNestForm.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const FormItemNestForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a413a382"]]);
4
+ const FormItemNestForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-46959572"]]);
5
5
  export {
6
6
  FormItemNestForm as default
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./FormItemNestFormList.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const FormItemNestFormList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-68118cbf"]]);
4
+ const FormItemNestFormList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f9ac937e"]]);
5
5
  export {
6
6
  FormItemNestFormList as default
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./FormMain.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const FormMain = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-fca51c0e"]]);
4
+ const FormMain = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6ea6d3c8"]]);
5
5
  export {
6
6
  FormMain as default
7
7
  };
@@ -1,10 +1,13 @@
1
- import { defineComponent, shallowRef, provide, computed, ref, watch, openBlock, createBlock, unref, withCtx, createVNode, createElementBlock, Fragment, renderList, withDirectives, mergeProps, renderSlot, vShow } from "vue";
1
+ import { defineComponent, shallowRef, provide, ref, readonly, computed, watch, openBlock, createBlock, unref, withModifiers, withCtx, createVNode, createElementBlock, Fragment, renderList, withDirectives, mergeProps, renderSlot, vShow, resolveDynamicComponent, normalizeProps, guardReactiveProps, createCommentVNode } from "vue";
2
2
  import { useFormLayoutByContainer } from "./use-layout-by-container.mjs";
3
3
  import { ElForm, ElRow, ElCol } from "element-plus";
4
4
  import FormItem from "./FormItem.vue.mjs";
5
- import { FORM_ITEM_CHANGE_LOADING, stringifyFormData, parseFormData, generateFormData, resolveFormLayout } from "./utils.mjs";
5
+ import { useFormAiFill } from "./use-ai-fill.mjs";
6
+ import DragFloat from "../display/DragFloat.vue.mjs";
7
+ import { FORM_ITEM_CHANGE_LOADING, patchFormData, stringifyFormData, parseFormData, generateFormData, resolveFormLayout } from "./utils.mjs";
8
+ import { getFormAiSchema } from "./ai-schema.mjs";
6
9
  import { createNestFormExposeMap } from "./nest-registry.mjs";
7
- import { FORM_NEST_REGISTRY_KEY, NEST_LAYOUT_SCALE_KEY } from "../../inject/key.mjs";
10
+ import { FORM_NEST_REGISTRY_KEY, FORM_VALIDATE_ERROR_KEYS, NEST_LAYOUT_SCALE_KEY } from "../../inject/key.mjs";
8
11
  const _sfc_main = /* @__PURE__ */ defineComponent({
9
12
  ...{
10
13
  name: "FormMain",
@@ -17,7 +20,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17
20
  layout: {},
18
21
  rowGutter: { default: 8 },
19
22
  layoutScale: { default: 1 },
20
- layoutByContainer: { type: Boolean, default: false }
23
+ layoutByContainer: { type: Boolean, default: false },
24
+ aiFill: { type: Boolean, default: void 0 },
25
+ aiFillTrigger: {},
26
+ description: {}
21
27
  },
22
28
  emits: ["loadingChange", "visibleChange", "submit"],
23
29
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -30,6 +36,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
30
36
  });
31
37
  const nestExposeMap = createNestFormExposeMap();
32
38
  provide(FORM_NEST_REGISTRY_KEY, nestExposeMap);
39
+ const validateErrorKeys = ref([]);
40
+ provide(FORM_VALIDATE_ERROR_KEYS, readonly(validateErrorKeys));
33
41
  const layoutScale = computed(() => props.layoutScale ?? 1);
34
42
  provide(NEST_LAYOUT_SCALE_KEY, layoutScale);
35
43
  const loadingList = ref([]);
@@ -42,6 +50,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
42
50
  (key) => itemViewHideStatus.value[key]
43
51
  );
44
52
  });
53
+ const hideWithRulesWarned = /* @__PURE__ */ new Set();
54
+ watch(
55
+ hideKeyList,
56
+ (keys) => {
57
+ keys.forEach((key) => {
58
+ if (hideWithRulesWarned.has(key)) return;
59
+ const item = props.list.find((i) => i.key === key);
60
+ if (!(item == null ? void 0 : item.rules)) return;
61
+ hideWithRulesWarned.add(key);
62
+ console.error(
63
+ `[dc-form] 表单项「${item.label || key}」(key: ${key})已被 hide 隐藏,但仍配置了 rules —— 这两者矛盾:hide 的语义是「该字段当前不适用」⇒ 不渲染且**跳校验**,validate() 会把它的校验错误直接删掉,rules 永远不会生效。若本意是「暂时收起但仍需校验」,请改用分组折叠(swiftFormItemGroup,折叠 = 纯视觉收起、照常校验);若确实不需要校验,请把 rules 一并去掉。`
64
+ );
65
+ });
66
+ },
67
+ { immediate: true }
68
+ );
45
69
  const visibleFormList = computed(() => {
46
70
  return props.list.filter((item) => !hideKeyList.value.includes(item.key));
47
71
  });
@@ -61,6 +85,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
61
85
  var _a;
62
86
  (_a = elForm.value) == null ? void 0 : _a.validate((valid, error) => {
63
87
  if (valid) {
88
+ validateErrorKeys.value = [];
64
89
  resolve();
65
90
  } else {
66
91
  const errorClone = { ...error || {} };
@@ -73,8 +98,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
73
98
  }
74
99
  });
75
100
  if (Object.keys(errorClone).length === 0) {
101
+ validateErrorKeys.value = [];
76
102
  resolve();
77
103
  } else {
104
+ validateErrorKeys.value = Object.keys(errorClone);
78
105
  reject(error);
79
106
  }
80
107
  }
@@ -99,9 +126,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
99
126
  clearValidate,
100
127
  generate: () => generateFormData(props.list),
101
128
  parse: (stringifyData) => parseFormData(stringifyData, props.list),
102
- stringify: () => stringifyFormData(props.data, props.list)
129
+ stringify: () => stringifyFormData(props.data, props.list),
130
+ // AI 填充数据层(投影 / patch 纯函数在 ai-schema.ts / utils.ts,此处仅委托)
131
+ // trsf36:表单目标描述随 schema 顶层 description 一并导出(缺省不输出)
132
+ getAiSchema: () => getFormAiSchema(props.list, props.data, {
133
+ description: props.description
134
+ }),
135
+ setValues: (partial) => patchFormData(props.data, props.list, partial)
103
136
  };
104
137
  __expose(expose);
138
+ const {
139
+ aiFillVisible,
140
+ aiFillTriggerComponent,
141
+ aiFillTriggerProps,
142
+ aiFillItemClass
143
+ } = useFormAiFill({
144
+ getEnabled: () => props.aiFill,
145
+ getTrigger: () => props.aiFillTrigger,
146
+ getDescription: () => props.description,
147
+ getList: () => props.list,
148
+ getData: () => props.data,
149
+ getSchema: expose.getAiSchema,
150
+ applyValues: expose.setValues
151
+ });
105
152
  const list = computed(() => props.list);
106
153
  const defaultRules = computed(() => {
107
154
  return list.value.reduce((prev, cur) => {
@@ -193,14 +240,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
193
240
  ref: elForm,
194
241
  class: "dc-form-main",
195
242
  model: __props.data,
196
- rules: rules.value
243
+ rules: rules.value,
244
+ onSubmit: _cache[1] || (_cache[1] = withModifiers(() => {
245
+ }, ["prevent"]))
197
246
  }, {
198
247
  default: withCtx(() => [
199
248
  createVNode(unref(ElRow), { gutter: __props.rowGutter }, {
200
249
  default: withCtx(() => [
201
250
  (openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (config) => {
202
251
  return withDirectives((openBlock(), createBlock(unref(ElCol), mergeProps({
203
- key: config.key
252
+ key: config.key,
253
+ class: unref(aiFillItemClass)(config.key)
204
254
  }, { ref_for: true }, mergeLayout(config.layout)), {
205
255
  default: withCtx(() => [
206
256
  createVNode(FormItem, {
@@ -216,14 +266,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
216
266
  }, 1032, ["data", "config"])
217
267
  ]),
218
268
  _: 2
219
- }, 1040)), [
269
+ }, 1040, ["class"])), [
220
270
  [vShow, !(itemViewHideStatus.value[config.key] ?? false)]
221
271
  ]);
222
272
  }), 128)),
223
273
  renderSlot(_ctx.$slots, "default", { mergeLayout }, void 0, true)
224
274
  ]),
225
275
  _: 3
226
- }, 8, ["gutter"])
276
+ }, 8, ["gutter"]),
277
+ unref(aiFillVisible) ? (openBlock(), createBlock(unref(DragFloat), {
278
+ key: 0,
279
+ class: "form-ai-fill-anchor",
280
+ offset: -4
281
+ }, {
282
+ default: withCtx(() => [
283
+ (openBlock(), createBlock(resolveDynamicComponent(unref(aiFillTriggerComponent)), normalizeProps(guardReactiveProps(unref(aiFillTriggerProps))), null, 16))
284
+ ]),
285
+ _: 1
286
+ })) : createCommentVNode("", true)
227
287
  ]),
228
288
  _: 3
229
289
  }, 8, ["model", "rules"]);
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./FormSearch.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const FormSearch = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b96e10f6"]]);
4
+ const FormSearch = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c1fe91f1"]]);
5
5
  export {
6
6
  FormSearch as default
7
7
  };
@@ -1,5 +1,6 @@
1
- import { defineComponent, useAttrs, ref, computed, shallowRef, openBlock, createBlock, normalizeClass, withCtx, withDirectives, createVNode, mergeProps, unref, createSlots, normalizeProps, guardReactiveProps, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, renderList, renderSlot, vShow } from "vue";
1
+ import { defineComponent, computed, useAttrs, ref, shallowRef, openBlock, createBlock, normalizeClass, withCtx, withDirectives, createVNode, mergeProps, unref, createSlots, normalizeProps, guardReactiveProps, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, renderList, renderSlot, vShow } from "vue";
2
2
  import { resolveFormLayout, stringifyFormData } from "./utils.mjs";
3
+ import { resolveFormAiFormDescription } from "./ai-schema.mjs";
3
4
  import { resolveSearchLayout, resolveSearchLabelPosition, resolveSearchItemOccupancy, computeSearchGeometry, getCurrentSpan, packSearchFormList } from "./form-search-utils.mjs";
4
5
  import { ElCol, ElButton, ElIcon } from "element-plus";
5
6
  import { ArrowDown, ArrowUp } from "@element-plus/icons-vue";
@@ -8,6 +9,7 @@ import _sfc_main$1 from "../display/WatchSize.vue.mjs";
8
9
  import { useBreakpoint } from "../../hooks/use-breakpoint.mjs";
9
10
  import { useCustomBreakpoint } from "../../hooks/use-custom-breakpoint.mjs";
10
11
  const _hoisted_1 = { class: "btn-box" };
12
+ const FORM_SEARCH_AI_ROLE_DESC = "这是一个列表筛选/搜索条件表单:把用户意图映射为筛选条件字段,未提及的条件留空";
11
13
  const _sfc_main = /* @__PURE__ */ defineComponent({
12
14
  ...{
13
15
  name: "FormSearch",
@@ -31,12 +33,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
31
33
  }) },
32
34
  rowGutter: { default: 14 },
33
35
  layoutScale: {},
34
- layoutByContainer: { type: Boolean, default: false }
36
+ layoutByContainer: { type: Boolean, default: false },
37
+ aiFill: { type: Boolean, default: void 0 },
38
+ aiFillTrigger: {},
39
+ description: {}
35
40
  },
36
41
  emits: ["search", "heightChange", "visibleChange"],
37
42
  setup(__props, { expose: __expose, emit: __emit }) {
38
43
  const props = __props;
39
44
  const emits = __emit;
45
+ const formSearchAiDescription = computed(() => {
46
+ const biz = resolveFormAiFormDescription(props.description);
47
+ return biz ? `${FORM_SEARCH_AI_ROLE_DESC}。业务语境:${biz}` : FORM_SEARCH_AI_ROLE_DESC;
48
+ });
40
49
  const attrs = useAttrs();
41
50
  const showForm = ref(false);
42
51
  const { activeBreakpoint: windowBreakpoint } = useBreakpoint();
@@ -160,6 +169,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
160
169
  "layout-by-container": __props.layoutByContainer,
161
170
  labelPosition: effectiveLabelPosition.value,
162
171
  labelWidth: __props.labelWidth,
172
+ "ai-fill": __props.aiFill,
173
+ "ai-fill-trigger": __props.aiFillTrigger,
174
+ description: formSearchAiDescription.value,
163
175
  onSubmit,
164
176
  onVisibleChange
165
177
  }), createSlots({
@@ -217,7 +229,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
217
229
  ])
218
230
  };
219
231
  })
220
- ]), 1040, ["list", "data", "row-gutter", "layout", "layout-by-container", "labelPosition", "labelWidth"]), [
232
+ ]), 1040, ["list", "data", "row-gutter", "layout", "layout-by-container", "labelPosition", "labelWidth", "ai-fill", "ai-fill-trigger", "description"]), [
221
233
  [vShow, showForm.value]
222
234
  ])
223
235
  ]),
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./FormSubmitPanel.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const FormSubmitPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1505775a"]]);
4
+ const FormSubmitPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b89f8f9f"]]);
5
5
  export {
6
6
  FormSubmitPanel as default
7
7
  };