diff --git a/CHANGELOG.md b/CHANGELOG.md index d79a876447cab32226f2dd4528b8ef0b148f262d..383c37ee1f3d156dec6914a9265d21aac383c901 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ ## [Unreleased] +### Added + +- 部件支持无数据绘制器 + ## [0.7.38-alpha.51] - 2025-01-16 ### Added diff --git a/src/control/calendar/calendar.tsx b/src/control/calendar/calendar.tsx index 6ac2d5d1c41bbfde9e5907a5caaaa42afa6e43dc..23f86a57a4d34c7f978783019a4c7b73cd11d205 100644 --- a/src/control/calendar/calendar.tsx +++ b/src/control/calendar/calendar.tsx @@ -1,5 +1,10 @@ /* eslint-disable no-nested-ternary */ -import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { + hasEmptyPanelRenderer, + IBizCustomRender, + useControlController, + useNamespace, +} from '@ibiz-template/vue3-util'; import { defineComponent, PropType, ref, VNode, watch } from 'vue'; import { ILayoutPanel, ISysCalendar, ISysCalendarItem } from '@ibiz/model-core'; import { @@ -483,13 +488,23 @@ export const CalendarControl = defineComponent({ const renderNoData = (): VNode | false => { // 未加载不显示无数据 const { isLoaded } = this.c.state; + const noDataSlots: IParams = {}; + if (hasEmptyPanelRenderer(this.c)) { + Object.assign(noDataSlots, { + customRender: () => ( + + ), + }); + } return ( isLoaded && ( + > + {noDataSlots} + ) ); }; diff --git a/src/control/chart/chart.tsx b/src/control/chart/chart.tsx index 768d155a86f312af27f7d4ce343477f052ad8653..fb8e91ab25cd32046a7eef0bd6ee310a3c9093b1 100644 --- a/src/control/chart/chart.tsx +++ b/src/control/chart/chart.tsx @@ -1,4 +1,9 @@ -import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { + hasEmptyPanelRenderer, + IBizCustomRender, + useControlController, + useNamespace, +} from '@ibiz-template/vue3-util'; import { defineComponent, nextTick, @@ -216,12 +221,22 @@ const ChartControl = defineComponent({ const renderNoData = () => { if (c.state.items.length === 0) { + const noDataSlots: IParams = {}; + if (hasEmptyPanelRenderer(c)) { + Object.assign(noDataSlots, { + customRender: () => ( + + ), + }); + } return ( + > + {noDataSlots} + ); } }; diff --git a/src/control/data-view/data-view.tsx b/src/control/data-view/data-view.tsx index 66783f353112894cd2b3db5380e1c87faca3fcb9..d4da7aec2eb3940f7e2ae3290ad2b6289ef901c1 100644 --- a/src/control/data-view/data-view.tsx +++ b/src/control/data-view/data-view.tsx @@ -1,5 +1,10 @@ /* eslint-disable no-nested-ternary */ -import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { + hasEmptyPanelRenderer, + IBizCustomRender, + useControlController, + useNamespace, +} from '@ibiz-template/vue3-util'; import { computed, defineComponent, PropType, ref, VNode, watch } from 'vue'; import { IDEDataView, @@ -452,13 +457,23 @@ export const DataViewControl = defineComponent({ if (!isLoaded) { return; } + const noDataSlots: IParams = {}; + if (hasEmptyPanelRenderer(c)) { + Object.assign(noDataSlots, { + customRender: () => ( + + ), + }); + } return ( + > + {noDataSlots} + ); }; diff --git a/src/control/gantt/gantt.tsx b/src/control/gantt/gantt.tsx index 08d8c940a412bf265b8aea2957181930ef392ada..88e7a754e5fa233d8f195863fa55c67c6f0238ae 100644 --- a/src/control/gantt/gantt.tsx +++ b/src/control/gantt/gantt.tsx @@ -6,6 +6,8 @@ import { useNamespace, useUIStore, IBizControlShell, + hasEmptyPanelRenderer, + IBizCustomRender, } from '@ibiz-template/vue3-util'; import { computed, @@ -515,12 +517,22 @@ export const GanttControl = defineComponent({ const renderNoData = (): VNode | false => { // 未加载不显示无数据 const { isLoaded } = c.state; + const noDataSlots: IParams = {}; + if (hasEmptyPanelRenderer(c)) { + Object.assign(noDataSlots, { + customRender: () => ( + + ), + }); + } return ( isLoaded && ( + > + {noDataSlots} + ) ); }; diff --git a/src/control/grid/grid/grid.tsx b/src/control/grid/grid/grid.tsx index 1bea1ef5efe51f861cbe427b37c9714e8674f3da..9ce44ff752a4ea8114f806290d94ed434203f6bf 100644 --- a/src/control/grid/grid/grid.tsx +++ b/src/control/grid/grid/grid.tsx @@ -3,6 +3,8 @@ import { useUIStore, useNamespace, useControlController, + hasEmptyPanelRenderer, + IBizCustomRender, } from '@ibiz-template/vue3-util'; import { defineComponent, @@ -220,12 +222,22 @@ export const GridControl = defineComponent({ > ); } + const noDataSlots: IParams = {}; + if (hasEmptyPanelRenderer(c)) { + Object.assign(noDataSlots, { + customRender: () => ( + + ), + }); + } return ( + > + {noDataSlots} + ); } // 给null 表格会绘制默认的无数据 diff --git a/src/control/kanban/kanban.tsx b/src/control/kanban/kanban.tsx index 11a2a1826e3c28a7e8e134b1104c7ad3b90d3d76..90e0db937ffb181e9002be46848afbc3217e8e49 100644 --- a/src/control/kanban/kanban.tsx +++ b/src/control/kanban/kanban.tsx @@ -1,5 +1,10 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { + hasEmptyPanelRenderer, + IBizCustomRender, + useControlController, + useNamespace, +} from '@ibiz-template/vue3-util'; import { computed, defineComponent, @@ -319,11 +324,21 @@ export const KanbanControl = defineComponent({ if (!c.state.isLoaded) { return; } + const noDataSlots: IParams = {}; + if (hasEmptyPanelRenderer(c)) { + Object.assign(noDataSlots, { + customRender: () => ( + + ), + }); + } return ( + > + {noDataSlots} + ); }; diff --git a/src/control/list/list.tsx b/src/control/list/list.tsx index fbaa4620a0140a2600164907441f8e829a56746e..939f776fdcbd9e45dfe727969cf210f4eaaeff62 100644 --- a/src/control/list/list.tsx +++ b/src/control/list/list.tsx @@ -1,5 +1,10 @@ /* eslint-disable no-nested-ternary */ -import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { + hasEmptyPanelRenderer, + IBizCustomRender, + useControlController, + useNamespace, +} from '@ibiz-template/vue3-util'; import { defineComponent, PropType, computed, VNode, ref, watch } from 'vue'; import { IDEList, ILayoutPanel, IUIActionGroupDetail } from '@ibiz/model-core'; import { isNil } from 'lodash-es'; @@ -388,6 +393,14 @@ export const ListControl = defineComponent({ if (!isLoaded) { return; } + const noDataSlots: IParams = { default: () => renderQuickToolBar() }; + if (hasEmptyPanelRenderer(c)) { + Object.assign(noDataSlots, { + customRender: () => ( + + ), + }); + } return ( isLoaded && ( - {renderQuickToolBar()} + {noDataSlots} ) ); diff --git a/src/control/tree-grid-ex/tree-grid-ex.tsx b/src/control/tree-grid-ex/tree-grid-ex.tsx index e27d74aafd42171099ec687df5087c96acdf07f5..190fdcbc9255499c4ddc773a62c89a80ef39164e 100644 --- a/src/control/tree-grid-ex/tree-grid-ex.tsx +++ b/src/control/tree-grid-ex/tree-grid-ex.tsx @@ -1,4 +1,9 @@ -import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { + hasEmptyPanelRenderer, + IBizCustomRender, + useControlController, + useNamespace, +} from '@ibiz-template/vue3-util'; import { computed, defineComponent, @@ -40,12 +45,22 @@ export const TreeGridExControl = defineComponent({ const renderNoData = (): VNode | false => { // 未加载不显示无数据 const { isLoaded } = c.state; + const noDataSlots: IParams = {}; + if (hasEmptyPanelRenderer(c)) { + Object.assign(noDataSlots, { + customRender: () => ( + + ), + }); + } return ( isLoaded && ( + > + {noDataSlots} + ) ); }; diff --git a/src/control/tree-grid/tree-grid.tsx b/src/control/tree-grid/tree-grid.tsx index 076fb3a57d0ac8c3df80cf1f3dec85281ed04694..717daeed93f2f94ce487d99f65fee0a4523cac89 100644 --- a/src/control/tree-grid/tree-grid.tsx +++ b/src/control/tree-grid/tree-grid.tsx @@ -1,4 +1,9 @@ -import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { + hasEmptyPanelRenderer, + IBizCustomRender, + useControlController, + useNamespace, +} from '@ibiz-template/vue3-util'; import { defineComponent, PropType, @@ -86,11 +91,21 @@ export const TreeGridControl = defineComponent({ > ); } + const noDataSlots: IParams = {}; + if (hasEmptyPanelRenderer(c)) { + Object.assign(noDataSlots, { + customRender: () => ( + + ), + }); + } return ( + > + {noDataSlots} + ); } return null;