@done-coding/admin-core 0.28.1-alpha.0 → 0.29.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 (86) hide show
  1. package/es/bridge/layout.mjs +31 -2
  2. package/es/components/app-layout/AppAside.vue.mjs +1 -1
  3. package/es/components/app-layout/AppCollapseToggle.vue.mjs +1 -1
  4. package/es/components/app-layout/AppFooter.vue.mjs +1 -1
  5. package/es/components/app-layout/AppHeader.vue.mjs +1 -1
  6. package/es/components/app-layout/AppHeader.vue2.mjs +1 -1
  7. package/es/components/app-layout/AppSidebar.vue.mjs +1 -1
  8. package/es/components/app-layout/AppSidebar.vue2.mjs +60 -34
  9. package/es/components/data-view/DataGridView.vue.mjs +1 -1
  10. package/es/components/data-view/DataGridView.vue2.mjs +30 -6
  11. package/es/components/data-view/DataListView.vue.mjs +1 -1
  12. package/es/components/data-view/DataListView.vue2.mjs +38 -14
  13. package/es/components/data-view/DataListViewItem.vue.mjs +1 -1
  14. package/es/components/data-view/DataListViewItem.vue2.mjs +23 -4
  15. package/es/components/data-view/InfiniteListView.vue.mjs +1 -1
  16. package/es/components/data-view/InfiniteListView.vue2.mjs +9 -3
  17. package/es/components/data-view/use-grid-layout.mjs +46 -0
  18. package/es/components/data-view/use-masonry.mjs +65 -0
  19. package/es/components/display/BadgeMark.vue.mjs +1 -1
  20. package/es/components/display/BadgeMark.vue2.mjs +11 -3
  21. package/es/components/display/HeightProvider.vue.mjs +17 -3
  22. package/es/components/display/use-badge.mjs +22 -13
  23. package/es/components/form/use-upload-state.mjs +33 -11
  24. package/es/components/page-layout/AppPageDetail.vue.mjs +1 -1
  25. package/es/components/page-layout/AppPageDetail.vue2.mjs +12 -2
  26. package/es/components/page-layout/AppPageListDetailLayout.vue.mjs +11 -4
  27. package/es/components/page-layout/AppPageListDetailSheet.vue.mjs +8 -1
  28. package/es/components/page-layout/AppPageListDetailSplit.vue.mjs +1 -1
  29. package/es/components/page-layout/AppPageListDetailSplit.vue2.mjs +8 -1
  30. package/es/components/table/TableMain.vue.mjs +1 -1
  31. package/es/components/table/TableMain.vue2.mjs +8 -5
  32. package/es/components/view-layout/ViewLayout.vue.mjs +1 -1
  33. package/es/components/view-layout/ViewLayout.vue2.mjs +68 -20
  34. package/es/hooks/use-surface.mjs +4 -1
  35. package/es/hooks/use-theme-apply.mjs +78 -0
  36. package/es/index.mjs +118 -120
  37. package/es/store/app.mjs +25 -0
  38. package/es/style.css +120 -95
  39. package/package.json +2 -2
  40. package/src/bridge/docs/README.md +31 -0
  41. package/src/components/app-layout/docs/README-AppAside.md +11 -0
  42. package/src/components/app-layout/docs/README-AppFooter.md +11 -1
  43. package/src/components/app-layout/docs/README-AppHeader.md +16 -0
  44. package/src/components/app-layout/docs/README-AppSidebar.md +18 -0
  45. package/src/components/data-view/README.md +2 -1
  46. package/src/components/data-view/docs/README-DataGridView.md +21 -1
  47. package/src/components/data-view/docs/README-DataListView.md +65 -3
  48. package/src/components/data-view/docs/README-InfiniteListView.md +17 -0
  49. package/src/components/display/README.md +1 -1
  50. package/src/components/display/docs/README-BadgeMark.md +52 -10
  51. package/src/components/display/docs/README-HeightProvider.md +14 -8
  52. package/src/components/form/docs/README-FormUpload.md +79 -0
  53. package/src/components/form/docs/README-FormUploadImage.md +19 -0
  54. package/src/components/form/docs/README-FormUploadVideo.md +19 -0
  55. package/src/components/page-layout/README.md +15 -0
  56. package/src/components/page-layout/docs/README-AppPageDetail.md +3 -0
  57. package/src/components/page-layout/docs/README-AppPageListDetailLayout.md +33 -0
  58. package/src/components/table/docs/README-TableMain.md +17 -0
  59. package/src/components/view-layout/README.md +2 -2
  60. package/src/components/view-layout/docs/README-ViewLayout.md +97 -6
  61. package/types/bridge/badge.d.ts +3 -1
  62. package/types/bridge/layout.d.ts +42 -5
  63. package/types/components/app-layout/AppSidebar.vue.d.ts +286 -2
  64. package/types/components/app-layout/types.d.ts +1 -1
  65. package/types/components/data-view/DataListViewItem.vue.d.ts +12 -7
  66. package/types/components/data-view/types.d.ts +76 -0
  67. package/types/components/data-view/use-grid-layout.d.ts +42 -0
  68. package/types/components/data-view/use-masonry.d.ts +44 -0
  69. package/types/components/display/BadgeMark.vue.d.ts +5 -5
  70. package/types/components/display/HeightProvider.vue.d.ts +1 -0
  71. package/types/components/display/use-badge.d.ts +6 -0
  72. package/types/components/page-layout/AppPageDetail.vue.d.ts +18 -0
  73. package/types/components/page-layout/AppPageListDetailLayout.vue.d.ts +20 -0
  74. package/types/components/page-layout/AppPageListDetailSheet.vue.d.ts +4 -0
  75. package/types/components/page-layout/AppPageListDetailSplit.vue.d.ts +4 -0
  76. package/types/components/table/types.d.ts +8 -0
  77. package/types/components/view-layout/ViewLayout.vue.d.ts +30 -0
  78. package/types/components/view-layout/types.d.ts +12 -0
  79. package/types/hooks/use-surface.d.ts +11 -0
  80. package/types/index.d.ts +0 -1
  81. package/types/injectInfo.json.d.ts +1 -1
  82. package/es/components/icon/IconHammer.vue.mjs +0 -26
  83. package/es/components/icon/IconHammer.vue2.mjs +0 -4
  84. package/src/components/icon/README.md +0 -38
  85. package/types/components/icon/IconHammer.vue.d.ts +0 -2
  86. package/types/components/icon/index.d.ts +0 -7
@@ -1,5 +1,12 @@
1
- import { ref, readonly } from "vue";
1
+ import { ref, readonly, nextTick } from "vue";
2
2
  const DEFAULT_LAYOUT_STORAGE_KEY = "dc-core-layout";
3
+ const MENU_OPEN_RETRY_AT = [0, 60, 160, 320, 500, 700, 900];
4
+ const scheduleOpenRetry = (run) => {
5
+ nextTick(run);
6
+ MENU_OPEN_RETRY_AT.forEach((delay) => {
7
+ setTimeout(run, delay);
8
+ });
9
+ };
3
10
  function createBridgeLayoutHook(init) {
4
11
  const storageKey = init.storageKey ?? DEFAULT_LAYOUT_STORAGE_KEY;
5
12
  const sidebarCollapsed = ref(init.defaultSidebarCollapsed ?? false);
@@ -48,6 +55,26 @@ function createBridgeLayoutHook(init) {
48
55
  const toggleAside = () => {
49
56
  setAsideCollapse(!asideCollapsed.value);
50
57
  };
58
+ let menuController = null;
59
+ const registerMenuController = (controller) => {
60
+ menuController = controller;
61
+ };
62
+ const openMenuTo = (path) => {
63
+ if (!menuController) return false;
64
+ const ancestors = menuController.resolveAncestors(path);
65
+ if (!ancestors) return false;
66
+ if (menuController.isGroupMode()) return true;
67
+ const openAll = () => {
68
+ ancestors.forEach((ancestorPath) => menuController == null ? void 0 : menuController.open(ancestorPath));
69
+ };
70
+ if (sidebarCollapsed.value) {
71
+ setSidebarCollapse(false);
72
+ scheduleOpenRetry(openAll);
73
+ return true;
74
+ }
75
+ openAll();
76
+ return true;
77
+ };
51
78
  return {
52
79
  layout: {
53
80
  sidebarCollapsed: readonly(sidebarCollapsed),
@@ -55,7 +82,9 @@ function createBridgeLayoutHook(init) {
55
82
  setSidebarCollapse,
56
83
  toggleSidebar,
57
84
  setAsideCollapse,
58
- toggleAside
85
+ toggleAside,
86
+ openMenuTo,
87
+ registerMenuController
59
88
  }
60
89
  };
61
90
  }
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./AppAside.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const AppAside = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7e17d342"]]);
4
+ const AppAside = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d6ef7f3d"]]);
5
5
  export {
6
6
  AppAside as default
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./AppCollapseToggle.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const AppCollapseToggle = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-10c7e006"]]);
4
+ const AppCollapseToggle = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7c080128"]]);
5
5
  export {
6
6
  AppCollapseToggle as default
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./AppFooter.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const AppFooter = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8960664d"]]);
4
+ const AppFooter = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-de6fd086"]]);
5
5
  export {
6
6
  AppFooter as default
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./AppHeader.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const AppHeader = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-fe33f01b"]]);
4
+ const AppHeader = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6fa13544"]]);
5
5
  export {
6
6
  AppHeader as default
7
7
  };
@@ -18,7 +18,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
18
18
  },
19
19
  setup(__props) {
20
20
  useCssVars((_ctx) => ({
21
- "v5a41bfe6": themeColors.value.primaryColor
21
+ "v1c549aee": themeColors.value.primaryColor
22
22
  }));
23
23
  const props = __props;
24
24
  const appStore = inject(APP_LAYOUT_APP_STORE_KEY);
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./AppSidebar.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const AppSidebar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6808ecdb"]]);
4
+ const AppSidebar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e8e50875"]]);
5
5
  export {
6
6
  AppSidebar as default
7
7
  };
@@ -1,9 +1,11 @@
1
- import { defineComponent, useCssVars, inject, computed, ref, openBlock, createElementBlock, normalizeStyle, createVNode, unref, withCtx, renderSlot, createElementVNode } from "vue";
1
+ import { defineComponent, useCssVars, inject, computed, ref, shallowRef, openBlock, createElementBlock, normalizeStyle, createElementVNode, createVNode, unref, withCtx, renderSlot } from "vue";
2
2
  import _sfc_main$2 from "../menu/MenuTree.vue.mjs";
3
3
  import _sfc_main$1 from "../display/WatchSize.vue.mjs";
4
4
  import AppCollapseToggle from "./AppCollapseToggle.vue.mjs";
5
5
  import { APP_LAYOUT_APP_STORE_KEY, APP_LAYOUT_BRIDGE_KEY } from "../../inject/key.mjs";
6
- const _hoisted_1 = { class: "app-sidebar-shim" };
6
+ import { useActivated } from "../../hooks/activated.mjs";
7
+ const _hoisted_1 = { class: "app-sidebar-clip" };
8
+ const _hoisted_2 = { class: "app-sidebar-shim" };
7
9
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
10
  __name: "AppSidebar",
9
11
  props: {
@@ -14,9 +16,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14
16
  },
15
17
  setup(__props) {
16
18
  useCssVars((_ctx) => ({
17
- "a540a4d0": sidebarZIndex.value,
18
- "v4433cc00": shimTop.value,
19
- "v7d77fda0": shimBottom.value
19
+ "v2dcbfdd5": sidebarZIndex.value,
20
+ "v78ee9bfd": shimTop.value,
21
+ "v3ef242fa": shimBottom.value
20
22
  }));
21
23
  const props = __props;
22
24
  const appStore = inject(APP_LAYOUT_APP_STORE_KEY);
@@ -41,42 +43,66 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
41
43
  const menuGroupMode = computed(
42
44
  () => bridge.APP_LAYOUT_SIDEBAR_CONFIG.menuGroupMode ?? false
43
45
  );
46
+ const menuTreeRef = shallowRef();
47
+ useActivated((info) => {
48
+ if (!info.isActivated) {
49
+ bridge.layout.registerMenuController(null);
50
+ return;
51
+ }
52
+ bridge.layout.registerMenuController({
53
+ open: (index) => {
54
+ var _a;
55
+ return (_a = menuTreeRef.value) == null ? void 0 : _a.open(index);
56
+ },
57
+ // 目标不在扁平菜单里 → undefined(与「在菜单里但本就是一级项」的空数组区分开)
58
+ resolveAncestors: (path) => {
59
+ const hit = props.menuFlatList.find((item) => item.path === path);
60
+ if (!hit) return void 0;
61
+ return [...hit.parentPathList ?? []];
62
+ },
63
+ isGroupMode: () => menuGroupMode.value
64
+ });
65
+ });
44
66
  return (_ctx, _cache) => {
45
67
  return openBlock(), createElementBlock("div", {
46
68
  class: "app-sidebar",
47
69
  style: normalizeStyle(sidebarStyle.value)
48
70
  }, [
49
- createVNode(unref(_sfc_main$1), {
50
- class: "app-sidebar-top",
51
- onHeightChange: _cache[0] || (_cache[0] = ($event) => topSlotHeight.value = $event)
52
- }, {
53
- default: withCtx(() => [
54
- renderSlot(_ctx.$slots, "top", {}, void 0, true)
55
- ]),
56
- _: 3
57
- }),
58
71
  createElementVNode("div", _hoisted_1, [
59
- createVNode(unref(_sfc_main$2), {
60
- collapse: collapse.value,
61
- menus: __props.menus,
62
- style: { "height": "100%" },
63
- "background-color": themeColors.value.bodyColor,
64
- "text-color": themeColors.value.baseColor,
65
- "active-text-color": themeColors.value.primaryColor,
66
- menuFlatList: __props.menuFlatList,
67
- groupMode: menuGroupMode.value,
68
- routerMode: ""
69
- }, null, 8, ["collapse", "menus", "background-color", "text-color", "active-text-color", "menuFlatList", "groupMode"])
70
- ]),
71
- createVNode(unref(_sfc_main$1), {
72
- class: "app-sidebar-bottom",
73
- onHeightChange: _cache[1] || (_cache[1] = ($event) => bottomSlotHeight.value = $event)
74
- }, {
75
- default: withCtx(() => [
76
- renderSlot(_ctx.$slots, "bottom", {}, void 0, true)
72
+ createVNode(unref(_sfc_main$1), {
73
+ class: "app-sidebar-top",
74
+ onHeightChange: _cache[0] || (_cache[0] = ($event) => topSlotHeight.value = $event)
75
+ }, {
76
+ default: withCtx(() => [
77
+ renderSlot(_ctx.$slots, "top", {}, void 0, true)
78
+ ]),
79
+ _: 3
80
+ }),
81
+ createElementVNode("div", _hoisted_2, [
82
+ createVNode(unref(_sfc_main$2), {
83
+ ref_key: "menuTreeRef",
84
+ ref: menuTreeRef,
85
+ collapse: collapse.value,
86
+ menus: __props.menus,
87
+ style: { "height": "100%" },
88
+ "background-color": themeColors.value.bodyColor,
89
+ "text-color": themeColors.value.baseColor,
90
+ "active-text-color": themeColors.value.primaryColor,
91
+ menuFlatList: __props.menuFlatList,
92
+ groupMode: menuGroupMode.value,
93
+ routerMode: ""
94
+ }, null, 8, ["collapse", "menus", "background-color", "text-color", "active-text-color", "menuFlatList", "groupMode"])
77
95
  ]),
78
- _: 3
79
- }),
96
+ createVNode(unref(_sfc_main$1), {
97
+ class: "app-sidebar-bottom",
98
+ onHeightChange: _cache[1] || (_cache[1] = ($event) => bottomSlotHeight.value = $event)
99
+ }, {
100
+ default: withCtx(() => [
101
+ renderSlot(_ctx.$slots, "bottom", {}, void 0, true)
102
+ ]),
103
+ _: 3
104
+ })
105
+ ]),
80
106
  createVNode(AppCollapseToggle, {
81
107
  side: "sidebar",
82
108
  show: __props.show && !menuGroupMode.value,
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./DataGridView.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const DataGridView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-90c0ccf6"]]);
4
+ const DataGridView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-136078cd"]]);
5
5
  export {
6
6
  DataGridView as default
7
7
  };
@@ -3,6 +3,7 @@ import { ElButton } from "element-plus";
3
3
  import TableToolbar from "../table/TableToolbar.vue.mjs";
4
4
  import _sfc_main$2 from "../table/TableEmpty.vue.mjs";
5
5
  import TableSkeleton from "../table/TableSkeleton.vue.mjs";
6
+ import { useDataViewGridLayout } from "./use-grid-layout.mjs";
6
7
  import { useSurface } from "../../hooks/use-surface.mjs";
7
8
  import _sfc_main$1 from "../display/WatchSize.vue.mjs";
8
9
  import _cloneDeep from "lodash/cloneDeep";
@@ -33,7 +34,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
33
34
  query: {},
34
35
  pageSizeInit: { default: 20 },
35
36
  gridColumns: { default: 4 },
37
+ gap: {},
38
+ card: { type: Boolean, default: true },
36
39
  surface: { type: Boolean, default: void 0 },
40
+ itemCard: { type: Boolean, default: void 0 },
37
41
  maxHeight: { default: "100vh" },
38
42
  refine: { type: Boolean, default: true },
39
43
  refineReduceHeight: { default: 0 },
@@ -61,7 +65,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
61
65
  emits: /* @__PURE__ */ mergeModels(["pageChange", "pageSizeChange", "dataChange", "selectionChange", "loadingChange", "pageInfoChange"], ["update:isAutoRefresh", "update:refreshInterval", "update:activeId", "update:activeData"]),
62
66
  setup(__props, { expose: __expose, emit: __emit }) {
63
67
  useCssVars((_ctx) => ({
64
- "c829655a": unref(surfacePadCss)
68
+ "e2a8f6ae": unref(surfacePadCss)
65
69
  }));
66
70
  const props = __props;
67
71
  const emits = __emit;
@@ -95,6 +99,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
95
99
  ].forEach((k) => {
96
100
  if (p[k] !== void 0) picked[k] = p[k];
97
101
  });
102
+ picked.itemCard = itemCardFinal.value;
98
103
  return picked;
99
104
  });
100
105
  const errorText = computed(
@@ -204,6 +209,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
204
209
  });
205
210
  };
206
211
  const { activeBreakpoint } = useBreakpoint();
212
+ const { gridGap, gridTemplateColumns, cardPad } = useDataViewGridLayout({
213
+ gridColumns: () => props.gridColumns,
214
+ gap: () => props.gap
215
+ });
216
+ const gridContainerStyle = computed(() => ({
217
+ gridTemplateColumns: gridTemplateColumns.value,
218
+ gap: `${gridGap.value}px`,
219
+ // 纵向行间距:每行 grid 只有一行卡片,row-gap 无处作用 →
220
+ // 用 padding-bottom 提供行与行间距(measureElement 按 borderBox 测量含 padding,行高正确)
221
+ paddingBottom: `${gridGap.value}px`
222
+ }));
223
+ const cellStyle = computed(
224
+ () => props.card ? { padding: `${cardPad.value}px` } : void 0
225
+ );
207
226
  const gridColumnsFinal = computed(
208
227
  () => resolveGridColumnsByBreakpoint(props.gridColumns, activeBreakpoint.value)
209
228
  );
@@ -309,7 +328,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
309
328
  toolbarHeight.value = h;
310
329
  };
311
330
  const { viewportHeightFinal } = useChannelViewportHeight(props);
312
- const { surfaceActive, surfacePad, surfacePadCss } = useSurface(() => props);
331
+ const itemCardFinal = computed(() => props.itemCard ?? props.card);
332
+ const { surfaceActive, surfaceBgActive, surfacePad, surfacePadCss } = useSurface(() => ({ ...props, itemCard: itemCardFinal.value }));
313
333
  const toolbarHeightAdjust = computed(
314
334
  () => props.showToolbar ? toolbarHeight.value : 0
315
335
  );
@@ -372,7 +392,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
372
392
  });
373
393
  return (_ctx, _cache) => {
374
394
  return openBlock(), createElementBlock("div", {
375
- class: normalizeClass(["dc-data-grid-view data-grid-view", { "data-grid-view_surface": unref(surfaceActive) }])
395
+ class: normalizeClass(["dc-data-grid-view data-grid-view", {
396
+ "data-grid-view_surface": unref(surfaceActive),
397
+ "data-grid-view_surface-bg": unref(surfaceBgActive)
398
+ }])
376
399
  }, [
377
400
  __props.showToolbar ? (openBlock(), createBlock(unref(_sfc_main$1), {
378
401
  key: 0,
@@ -419,12 +442,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
419
442
  item: withCtx(({ item, index }) => [
420
443
  createElementVNode("div", {
421
444
  class: "data-grid-view__grid",
422
- style: normalizeStyle({ gridTemplateColumns: `repeat(${gridColumnsFinal.value}, 1fr)` })
445
+ style: normalizeStyle(gridContainerStyle.value)
423
446
  }, [
424
447
  (openBlock(true), createElementBlock(Fragment, null, renderList(item, (row, colIndex) => {
425
448
  return openBlock(), createElementBlock("div", {
426
449
  key: keyOf(row),
427
- class: normalizeClass(["data-grid-view__cell", { "is-active": unref(isActive)(row) }]),
450
+ class: normalizeClass(["data-grid-view__cell", { "is-active": unref(isActive)(row), "is-card": __props.card }]),
451
+ style: normalizeStyle(cellStyle.value),
428
452
  onClick: ($event) => unref(setActive)(row)
429
453
  }, [
430
454
  renderSlot(_ctx.$slots, "custom-view-item", mergeProps({ ref_for: true }, assertItemScope(row, index * gridColumnsFinal.value + colIndex)), () => [
@@ -447,7 +471,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
447
471
  }), 128))
448
472
  ])
449
473
  ], true)
450
- ], 10, _hoisted_1);
474
+ ], 14, _hoisted_1);
451
475
  }), 128))
452
476
  ], 4)
453
477
  ]),
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./DataListView.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const DataListView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0d316a42"]]);
4
+ const DataListView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f900ae4e"]]);
5
5
  export {
6
6
  DataListView as default
7
7
  };
@@ -1,13 +1,16 @@
1
- import { defineComponent, computed, useModel, ref, watch, openBlock, createElementBlock, normalizeStyle, Fragment, renderList, createBlock, unref, withCtx, renderSlot, createVNode, mergeModels } from "vue";
1
+ import { defineComponent, useModel, ref, computed, watch, openBlock, createElementBlock, normalizeStyle, Fragment, renderList, createBlock, unref, withCtx, renderSlot, createVNode, mergeModels } from "vue";
2
2
  import { ElEmpty } from "element-plus";
3
3
  import DataListViewItem from "./DataListViewItem.vue.mjs";
4
4
  import { createDataListViewInstance } from "./utils.mjs";
5
5
  import { useDataViewFieldMap } from "./use-data-view-field-map.mjs";
6
6
  import { useActiveRecord, activeRecordValueOf } from "../../hooks/use-active-record.mjs";
7
7
  import { useActiveScroll } from "./use-active-scroll.mjs";
8
+ import { useDataViewGridLayout } from "./use-grid-layout.mjs";
9
+ import { useDataViewMasonry } from "./use-masonry.mjs";
8
10
  const _hoisted_1 = {
9
11
  key: 1,
10
- class: "data-list-view-empty"
12
+ class: "data-list-view-empty",
13
+ "data-masonry-skip": ""
11
14
  };
12
15
  const _sfc_main = /* @__PURE__ */ defineComponent({
13
16
  __name: "DataListView",
@@ -18,6 +21,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
18
21
  columns: {},
19
22
  maxHeight: {},
20
23
  minHeight: {},
24
+ gridColumns: {},
25
+ gap: {},
26
+ card: { type: Boolean, default: true },
27
+ masonry: { type: Boolean, default: false },
21
28
  selectable: { type: Boolean, default: false },
22
29
  getRenderCtxParams: {}
23
30
  }, {
@@ -34,17 +41,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
34
41
  const rk = props.rowKey;
35
42
  return typeof rk === "function" ? rk(row) : String(row[rk]);
36
43
  };
37
- const containerStyle = computed(() => {
38
- const style = {};
39
- if (props.maxHeight) {
40
- style.maxHeight = `${props.maxHeight}px`;
41
- style.overflowY = "auto";
42
- }
43
- if (props.minHeight) {
44
- style.minHeight = `${props.minHeight}px`;
45
- }
46
- return Object.keys(style).length ? style : void 0;
47
- });
48
44
  const activeId = useModel(__props, "activeId");
49
45
  const activeData = useModel(__props, "activeData");
50
46
  const listRoot = ref();
@@ -56,6 +52,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
56
52
  activeData,
57
53
  name: "DataListView"
58
54
  });
55
+ const { gridGap, gridStyle, cardPad } = useDataViewGridLayout({
56
+ gridColumns: () => props.gridColumns,
57
+ gap: () => props.gap
58
+ });
59
+ const { masonrySpans, masonryContainerStyle } = useDataViewMasonry({
60
+ enabled: () => props.masonry,
61
+ container: () => listRoot.value,
62
+ gap: () => gridGap.value,
63
+ data: () => props.data
64
+ });
65
+ const containerStyle = computed(() => {
66
+ const style = {
67
+ ...gridStyle.value,
68
+ ...masonryContainerStyle.value
69
+ };
70
+ if (props.maxHeight) {
71
+ style.maxHeight = `${props.maxHeight}px`;
72
+ style.overflowY = "auto";
73
+ }
74
+ if (props.minHeight) {
75
+ style.minHeight = `${props.minHeight}px`;
76
+ }
77
+ return Object.keys(style).length ? style : void 0;
78
+ });
59
79
  useActiveScroll({
60
80
  enabled: () => props.activeScroll,
61
81
  activeId,
@@ -116,6 +136,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
116
136
  key: keyOf(row),
117
137
  selected: isSelected(row),
118
138
  active: unref(isActive)(row),
139
+ card: __props.card,
140
+ cardPad: unref(cardPad),
141
+ masonry: __props.masonry,
142
+ spanRows: unref(masonrySpans)[index],
119
143
  onClick: ($event) => unref(setActive)(row)
120
144
  }, {
121
145
  default: withCtx(() => [
@@ -130,7 +154,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
130
154
  }, void 0, true)
131
155
  ]),
132
156
  _: 2
133
- }, 1032, ["selected", "active", "onClick"]);
157
+ }, 1032, ["selected", "active", "card", "cardPad", "masonry", "spanRows", "onClick"]);
134
158
  }), 128)) : (openBlock(), createElementBlock("div", _hoisted_1, [
135
159
  renderSlot(_ctx.$slots, "empty", {}, () => [
136
160
  createVNode(unref(ElEmpty))
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./DataListViewItem.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const DataListViewItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c2a6c6be"]]);
4
+ const DataListViewItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4b05138c"]]);
5
5
  export {
6
6
  DataListViewItem as default
7
7
  };
@@ -1,17 +1,36 @@
1
- import { defineComponent, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
1
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, normalizeClass, renderSlot } from "vue";
2
2
  const _sfc_main = /* @__PURE__ */ defineComponent({
3
3
  __name: "DataListViewItem",
4
4
  props: {
5
5
  selected: { type: Boolean },
6
- active: { type: Boolean }
6
+ active: { type: Boolean },
7
+ card: { type: Boolean },
8
+ cardPad: {},
9
+ masonry: { type: Boolean },
10
+ spanRows: {}
7
11
  },
8
12
  setup(__props) {
13
+ const props = __props;
14
+ const itemStyle = computed(() => {
15
+ const style = {};
16
+ if (props.spanRows !== void 0) style.gridRowEnd = `span ${props.spanRows}`;
17
+ if (props.card && props.cardPad !== void 0) {
18
+ style.padding = `${props.cardPad}px`;
19
+ }
20
+ return Object.keys(style).length ? style : void 0;
21
+ });
9
22
  return (_ctx, _cache) => {
10
23
  return openBlock(), createElementBlock("div", {
11
- class: normalizeClass(["data-list-view-item", { "is-selected": __props.selected, "is-active": __props.active }])
24
+ class: normalizeClass(["data-list-view-item", {
25
+ "is-selected": __props.selected,
26
+ "is-active": __props.active,
27
+ "is-card": __props.card,
28
+ "is-masonry": __props.spanRows !== void 0 || __props.masonry
29
+ }]),
30
+ style: normalizeStyle(itemStyle.value)
12
31
  }, [
13
32
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
14
- ], 2);
33
+ ], 6);
15
34
  };
16
35
  }
17
36
  });
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./InfiniteListView.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const InfiniteListView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6539caa4"]]);
4
+ const InfiniteListView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a62d17f9"]]);
5
5
  export {
6
6
  InfiniteListView as default
7
7
  };
@@ -31,19 +31,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
31
31
  estimateSize: { default: 200 },
32
32
  overscan: { default: 5 },
33
33
  surface: { type: Boolean, default: void 0 },
34
+ itemCard: { type: Boolean },
34
35
  maxHeight: { default: void 0 },
35
36
  pullRefresh: { type: Boolean, default: false }
36
37
  },
37
38
  emits: ["loadMore", "retry", "refresh"],
38
39
  setup(__props, { expose: __expose, emit: __emit }) {
39
40
  useCssVars((_ctx) => ({
40
- "v0d4fd951": unref(surfacePadCss)
41
+ "v9e087332": unref(surfacePadCss)
41
42
  }));
42
43
  const props = __props;
43
44
  const emits = __emit;
44
45
  const scrollContainer = ref();
45
46
  const sentinel = ref();
46
- const { surfaceActive, surfacePadCss } = useSurface(() => props);
47
+ const { surfaceActive, surfaceBgActive, surfacePadCss } = useSurface(
48
+ () => props
49
+ );
47
50
  const containerStyle = computed(
48
51
  () => props.maxHeight ? {
49
52
  maxHeight: typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight,
@@ -131,7 +134,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
131
134
  return openBlock(), createElementBlock("div", {
132
135
  ref_key: "scrollContainer",
133
136
  ref: scrollContainer,
134
- class: normalizeClass(["dc-infinite-list-view infinite-list-view", { "infinite-list-view_surface": unref(surfaceActive) }]),
137
+ class: normalizeClass(["dc-infinite-list-view infinite-list-view", {
138
+ "infinite-list-view_surface": unref(surfaceActive),
139
+ "infinite-list-view_surface-bg": unref(surfaceBgActive)
140
+ }]),
135
141
  style: normalizeStyle(containerStyle.value),
136
142
  onTouchstartPassive: _cache[0] || (_cache[0] = //@ts-ignore
137
143
  (...args) => unref(onTouchStart) && unref(onTouchStart)(...args)),
@@ -0,0 +1,46 @@
1
+ import { inject, computed } from "vue";
2
+ import { resolveGridColumnsByBreakpoint } from "./utils.mjs";
3
+ import { APP_LAYOUT_BRIDGE_KEY } from "../../inject/key.mjs";
4
+ import { useBreakpoint } from "../../hooks/use-breakpoint.mjs";
5
+ import { gapScaleValue } from "../../utils/gap-scale.mjs";
6
+ const DEFAULT_GAP_BASE = 8;
7
+ const useDataViewGridLayout = (options) => {
8
+ const layoutBridge = inject(APP_LAYOUT_BRIDGE_KEY, void 0);
9
+ const { activeBreakpoint } = useBreakpoint();
10
+ const gridGap = computed(
11
+ () => options.gap() ?? gapScaleValue(
12
+ (layoutBridge == null ? void 0 : layoutBridge.APP_LAYOUT_GAP_CONFIG.size) ?? DEFAULT_GAP_BASE,
13
+ "module",
14
+ layoutBridge == null ? void 0 : layoutBridge.themeDensity.value
15
+ )
16
+ );
17
+ const cardPad = computed(
18
+ () => gapScaleValue(
19
+ (layoutBridge == null ? void 0 : layoutBridge.APP_LAYOUT_GAP_CONFIG.size) ?? DEFAULT_GAP_BASE,
20
+ "breath",
21
+ layoutBridge == null ? void 0 : layoutBridge.themeDensity.value
22
+ )
23
+ );
24
+ const gridTemplateColumns = computed(() => {
25
+ const cfg = options.gridColumns();
26
+ if (cfg === void 0) return void 0;
27
+ if (typeof cfg === "object" && "min" in cfg) {
28
+ return `repeat(auto-fill, minmax(${cfg.min}px, 1fr))`;
29
+ }
30
+ return `repeat(${resolveGridColumnsByBreakpoint(
31
+ cfg,
32
+ activeBreakpoint.value
33
+ )}, 1fr)`;
34
+ });
35
+ const gridStyle = computed(
36
+ () => gridTemplateColumns.value ? {
37
+ display: "grid",
38
+ gridTemplateColumns: gridTemplateColumns.value,
39
+ gap: `${gridGap.value}px`
40
+ } : void 0
41
+ );
42
+ return { gridGap, gridTemplateColumns, gridStyle, cardPad };
43
+ };
44
+ export {
45
+ useDataViewGridLayout
46
+ };