From 10fe0394a70fed42fb507b06912b3568638c3766 Mon Sep 17 00:00:00 2001 From: ShineKOT <1917095344@qq.com> Date: Thu, 17 Oct 2024 19:01:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=20=E9=83=A8=E4=BB=B6=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E5=8F=82=E6=95=B0provider=EF=BC=8C=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E6=8F=92=E4=BB=B6=E5=8F=AA=E9=87=8D=E5=86=99=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=9C=AA=E9=87=8D=E5=86=99UI=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++ src/common/index.ts | 2 ++ .../app-menu-icon-view/app-menu-icon-view.tsx | 5 ++-- .../app-menu-list-view/app-menu-list-view.tsx | 7 +++-- src/control/app-menu/app-menu.tsx | 7 +++-- src/control/calendar/calendar.tsx | 2 +- src/control/caption-bar/caption-bar.tsx | 7 +++-- src/control/chart/chart.tsx | 2 +- src/control/dashboard/dashboard.tsx | 5 ++-- src/control/data-view/data-view.tsx | 6 +++- src/control/form/search-form/search-form.tsx | 3 +- src/control/list/list/list.tsx | 29 ++++--------------- src/control/list/md-ctrl/md-ctrl.tsx | 25 +++++----------- .../pickup-view-panel/pickup-view-panel.tsx | 2 ++ src/control/search-bar/search-bar.tsx | 3 +- src/control/tab-exp-panel/tab-exp-panel.tsx | 6 +++- src/control/toolbar/toolbar.tsx | 7 ++++- src/control/tree/tree.tsx | 18 ++---------- 18 files changed, 60 insertions(+), 79 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9425a60d73..8a51d98177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ ## [Unreleased] +### Added +- 部件新增接收参数provider,用于插件只重写逻辑,未重写UI的情况 + ## [0.0.27] - 2024-10-16 ### Added diff --git a/src/common/index.ts b/src/common/index.ts index 34bae54c3f..f4c654ff39 100644 --- a/src/common/index.ts +++ b/src/common/index.ts @@ -5,6 +5,7 @@ import { IBizControlBase, IBizRouterView, IBizControlShell, + IBizBadge, } from '@ibiz-template/vue3-util'; import { App } from 'vue'; import { IBizActionToolbar } from './action-toolbar/action-toolbar'; @@ -44,6 +45,7 @@ export const IBizCommonComponents = { v.component(IBizFullscreenHeader.name, IBizFullscreenHeader); v.component(IBizButtonList.name, IBizButtonList); v.component(IBizEmojiSelect.name, IBizEmojiSelect); + v.component(IBizBadge.name, IBizBadge); }, }; diff --git a/src/control/app-menu-icon-view/app-menu-icon-view.tsx b/src/control/app-menu-icon-view/app-menu-icon-view.tsx index 33b9ae21e7..2e1688ebfd 100644 --- a/src/control/app-menu-icon-view/app-menu-icon-view.tsx +++ b/src/control/app-menu-icon-view/app-menu-icon-view.tsx @@ -1,8 +1,8 @@ -import { prepareControl, useControlController } from '@ibiz-template/vue3-util'; import { IAppMenu } from '@ibiz/model-core'; import { computed, defineComponent, PropType } from 'vue'; +import { AppMenuController, IControlProvider } from '@ibiz-template/runtime'; +import { prepareControl, useControlController } from '@ibiz-template/vue3-util'; import './app-menu-icon-view.scss'; -import { AppMenuController } from '@ibiz-template/runtime'; export const AppMenuIconViewControl = defineComponent({ name: 'IBizAppMenuIconViewControl', @@ -10,6 +10,7 @@ export const AppMenuIconViewControl = defineComponent({ modelData: { type: Object as PropType, required: true }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, + provider: { type: Object as PropType }, }, setup() { const c = useControlController((...args) => new AppMenuController(...args)); diff --git a/src/control/app-menu-list-view/app-menu-list-view.tsx b/src/control/app-menu-list-view/app-menu-list-view.tsx index 7c61d1a3c0..371e6f23d0 100644 --- a/src/control/app-menu-list-view/app-menu-list-view.tsx +++ b/src/control/app-menu-list-view/app-menu-list-view.tsx @@ -1,8 +1,8 @@ -import { prepareControl, useControlController } from '@ibiz-template/vue3-util'; -import { IAppMenu } from '@ibiz/model-core'; import { defineComponent, PropType } from 'vue'; +import { IAppMenu } from '@ibiz/model-core'; +import { AppMenuController, IControlProvider } from '@ibiz-template/runtime'; +import { prepareControl, useControlController } from '@ibiz-template/vue3-util'; import './app-menu-list-view.scss'; -import { AppMenuController } from '@ibiz-template/runtime'; export const AppMenuListViewControl = defineComponent({ name: 'IBizAppMenuListViewControl', @@ -10,6 +10,7 @@ export const AppMenuListViewControl = defineComponent({ modelData: { type: Object as PropType, required: true }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, + provider: { type: Object as PropType }, }, setup() { const c = useControlController((...args) => new AppMenuController(...args)); diff --git a/src/control/app-menu/app-menu.tsx b/src/control/app-menu/app-menu.tsx index e8d8758d1f..59d152b673 100644 --- a/src/control/app-menu/app-menu.tsx +++ b/src/control/app-menu/app-menu.tsx @@ -1,9 +1,9 @@ +import { useRoute } from 'vue-router'; +import { defineComponent, onMounted, PropType, ref } from 'vue'; import { prepareControl, useControlController } from '@ibiz-template/vue3-util'; import { IAppMenu, IAppMenuItem } from '@ibiz/model-core'; -import { defineComponent, onMounted, PropType, ref } from 'vue'; +import { AppMenuController, IControlProvider } from '@ibiz-template/runtime'; import './app-menu.scss'; -import { useRoute } from 'vue-router'; -import { AppMenuController } from '@ibiz-template/runtime'; export const AppMenuControl = defineComponent({ name: 'IBizAppMenuControl', @@ -11,6 +11,7 @@ export const AppMenuControl = defineComponent({ modelData: { type: Object as PropType, required: true }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, + provider: { type: Object as PropType }, }, setup() { const c = useControlController((...args) => new AppMenuController(...args)); diff --git a/src/control/calendar/calendar.tsx b/src/control/calendar/calendar.tsx index 553eed036a..4ac09c2f8d 100644 --- a/src/control/calendar/calendar.tsx +++ b/src/control/calendar/calendar.tsx @@ -1,7 +1,6 @@ import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; import { computed, defineComponent, PropType, Ref, ref, VNode } from 'vue'; import { ILayoutPanel, ISysCalendar } from '@ibiz/model-core'; -import './calendar.scss'; import { CalendarController, ICalendarItemData, @@ -11,6 +10,7 @@ import dayjs from 'dayjs'; import VueHashCalendar from 'vue3-hash-calendar'; import 'vue3-hash-calendar/es/index.css'; import { getCurSelectDayDate, getCurSelectMonthDate } from './date-util'; +import './calendar.scss'; export const CalendarControl = defineComponent({ name: 'IBizCalendarControl', diff --git a/src/control/caption-bar/caption-bar.tsx b/src/control/caption-bar/caption-bar.tsx index c23b073db8..1f9d61a41a 100644 --- a/src/control/caption-bar/caption-bar.tsx +++ b/src/control/caption-bar/caption-bar.tsx @@ -1,8 +1,8 @@ -import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; -import { defineComponent, onActivated, PropType } from 'vue'; import { ICaptionBar } from '@ibiz/model-core'; +import { defineComponent, onActivated, PropType } from 'vue'; +import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { CaptionBarController, IControlProvider } from '@ibiz-template/runtime'; import './caption-bar.scss'; -import { CaptionBarController } from '@ibiz-template/runtime'; export const CaptionBarControl = defineComponent({ name: 'IBizCaptionBarControl', @@ -13,6 +13,7 @@ export const CaptionBarControl = defineComponent({ }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, + provider: { type: Object as PropType }, }, setup() { const c = useControlController( diff --git a/src/control/chart/chart.tsx b/src/control/chart/chart.tsx index 8fcdf985f4..8b574131b9 100644 --- a/src/control/chart/chart.tsx +++ b/src/control/chart/chart.tsx @@ -8,8 +8,8 @@ import { } from 'vue'; import { IDEChart } from '@ibiz/model-core'; import { init } from 'echarts'; -import './chart.scss'; import { ChartController, IControlProvider } from '@ibiz-template/runtime'; +import './chart.scss'; const ChartControl = defineComponent({ name: 'IBizChartControl', diff --git a/src/control/dashboard/dashboard.tsx b/src/control/dashboard/dashboard.tsx index a992f7af7c..16c500d106 100644 --- a/src/control/dashboard/dashboard.tsx +++ b/src/control/dashboard/dashboard.tsx @@ -12,8 +12,8 @@ import { IDBContainerPortletPart, IDBPortletPart, } from '@ibiz/model-core'; +import { DashboardController, IControlProvider } from '@ibiz-template/runtime'; import './dashboard.scss'; -import { DashboardController } from '@ibiz-template/runtime'; /** * 根据类型绘制数据看板成员 @@ -62,8 +62,6 @@ function renderPortletByType( }, ); } - console.log(model, 'model'); - // 绘制门户部件 return h(providerComp, { ...commonProps, @@ -80,6 +78,7 @@ export const DashboardControl = defineComponent({ }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, + provider: { type: Object as PropType }, }, setup() { const c = useControlController( diff --git a/src/control/data-view/data-view.tsx b/src/control/data-view/data-view.tsx index e1156b1ef6..ec64ab637a 100644 --- a/src/control/data-view/data-view.tsx +++ b/src/control/data-view/data-view.tsx @@ -5,7 +5,10 @@ import { ILayoutPanel, IUIActionGroupDetail, } from '@ibiz/model-core'; -import { DataViewControlController } from '@ibiz-template/runtime'; +import { + DataViewControlController, + IControlProvider, +} from '@ibiz-template/runtime'; import { usePagination } from '../../util'; import './data-view.scss'; @@ -15,6 +18,7 @@ export const DataViewControl = defineComponent({ modelData: { type: Object as PropType, required: true }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, + provider: { type: Object as PropType }, singleSelect: { type: Boolean, default: true }, loadDefault: { type: Boolean, default: true }, }, diff --git a/src/control/form/search-form/search-form.tsx b/src/control/form/search-form/search-form.tsx index ae99beaa5c..ecfca325d9 100644 --- a/src/control/form/search-form/search-form.tsx +++ b/src/control/form/search-form/search-form.tsx @@ -1,4 +1,4 @@ -import { SearchFormController } from '@ibiz-template/runtime'; +import { IControlProvider, SearchFormController } from '@ibiz-template/runtime'; import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; import { IDESearchForm } from '@ibiz/model-core'; import { defineComponent, PropType, reactive } from 'vue'; @@ -11,6 +11,7 @@ export const SearchFormControl = defineComponent({ type: Object as PropType, required: true, }, + provider: { type: Object as PropType }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, }, diff --git a/src/control/list/list/list.tsx b/src/control/list/list/list.tsx index 2ba0d4edd4..b12f894829 100644 --- a/src/control/list/list/list.tsx +++ b/src/control/list/list/list.tsx @@ -1,9 +1,9 @@ -import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; -import { defineComponent, PropType, ref } from 'vue'; import { IDEList } from '@ibiz/model-core'; -import './list.scss'; -import { ListController } from '@ibiz-template/runtime'; +import { defineComponent, PropType, ref } from 'vue'; +import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { IControlProvider, ListController } from '@ibiz-template/runtime'; import { useListRender } from '../list-render-util'; +import './list.scss'; export const ListControl = defineComponent({ name: 'IBizListControl', @@ -11,31 +11,12 @@ export const ListControl = defineComponent({ modelData: { type: Object as PropType, required: true }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, - /** - * 部件行数据默认激活模式 - * - 0 不激活 - * - 1 单击激活 - * - 2 双击激活(默认值) - * - * @type {(number | 0 | 1 | 2)} - */ + provider: { type: Object as PropType }, mdctrlActiveMode: { type: Number, default: 1 }, - - /** - * 是否为单选 - * - true 单选 - * - false 多选 - * - * @type {(Boolean)} - */ singleSelect: { type: Boolean, default: true }, - // 默认行数 rowsCount: { type: Number, default: 2 }, - // 默认列数 columnsCount: { type: Number, default: 5 }, - loadDefault: { type: Boolean, default: true }, - mode: { type: String, default: 'LIST' }, }, setup(props) { diff --git a/src/control/list/md-ctrl/md-ctrl.tsx b/src/control/list/md-ctrl/md-ctrl.tsx index bae1aff37e..e060cc0e93 100644 --- a/src/control/list/md-ctrl/md-ctrl.tsx +++ b/src/control/list/md-ctrl/md-ctrl.tsx @@ -1,10 +1,14 @@ import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; import { computed, defineComponent, PropType } from 'vue'; import { IDEMobMDCtrl, IUIActionGroup } from '@ibiz/model-core'; -import { IMobMDCtrlRowState, MDCtrlController } from '@ibiz-template/runtime'; -import './md-ctrl.scss'; +import { + IControlProvider, + IMobMDCtrlRowState, + MDCtrlController, +} from '@ibiz-template/runtime'; import { useListRender } from '../list-render-util'; import { usePagination } from '../../../util'; +import './md-ctrl.scss'; export const MDCtrlControl = defineComponent({ name: 'IBizMDCtrlControl', @@ -12,23 +16,8 @@ export const MDCtrlControl = defineComponent({ modelData: { type: Object as PropType, required: true }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, - /** - * 部件行数据默认激活模式 - * - 0 不激活 - * - 1 单击激活 - * - 2 双击激活(默认值) - * - * @type {(number | 0 | 1 | 2)} - */ + provider: { type: Object as PropType }, mdctrlActiveMode: { type: Number, default: 1 }, - - /** - * 是否为单选 - * - true 单选 - * - false 多选 - * - * @type {(Boolean)} - */ singleSelect: { type: Boolean, default: true }, selectedData: { type: Object as PropType, required: false }, mode: { type: String, default: 'LIST' }, diff --git a/src/control/pickup-view-panel/pickup-view-panel.tsx b/src/control/pickup-view-panel/pickup-view-panel.tsx index fd436caf8c..957e73b6f7 100644 --- a/src/control/pickup-view-panel/pickup-view-panel.tsx +++ b/src/control/pickup-view-panel/pickup-view-panel.tsx @@ -3,6 +3,7 @@ import { defineComponent, h, PropType, resolveComponent } from 'vue'; import { IAppDEGridView, IDEPickupViewPanel } from '@ibiz/model-core'; import { EventBase, + IControlProvider, IPickupGridViewEvent, IPickupGridViewState, IViewController, @@ -17,6 +18,7 @@ export const PickupViewPanelControl = defineComponent({ context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, singleSelect: { type: Boolean, default: true }, + provider: { type: Object as PropType }, selectedData: { type: Object as PropType, required: false }, }, setup() { diff --git a/src/control/search-bar/search-bar.tsx b/src/control/search-bar/search-bar.tsx index df49698a86..b65abb5491 100644 --- a/src/control/search-bar/search-bar.tsx +++ b/src/control/search-bar/search-bar.tsx @@ -2,8 +2,8 @@ import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; import { computed, defineComponent, PropType } from 'vue'; import { ISearchBar } from '@ibiz/model-core'; import { debounce } from 'lodash-es'; +import { IControlProvider, SearchBarController } from '@ibiz-template/runtime'; import './search-bar.scss'; -import { SearchBarController } from '@ibiz-template/runtime'; export const SearchBarControl = defineComponent({ name: 'IBizSearchBarControl', @@ -12,6 +12,7 @@ export const SearchBarControl = defineComponent({ type: Object as PropType, required: true, }, + provider: { type: Object as PropType }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, }, diff --git a/src/control/tab-exp-panel/tab-exp-panel.tsx b/src/control/tab-exp-panel/tab-exp-panel.tsx index 0e065530ee..c87e405111 100644 --- a/src/control/tab-exp-panel/tab-exp-panel.tsx +++ b/src/control/tab-exp-panel/tab-exp-panel.tsx @@ -1,7 +1,10 @@ import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; import { defineComponent, PropType } from 'vue'; import { ITabExpPanel } from '@ibiz/model-core'; -import { TabExpPanelController } from '@ibiz-template/runtime'; +import { + IControlProvider, + TabExpPanelController, +} from '@ibiz-template/runtime'; export const TabExpPanelControl = defineComponent({ name: 'IBizTabExpPanelControl', @@ -9,6 +12,7 @@ export const TabExpPanelControl = defineComponent({ modelData: { type: Object as PropType, required: true }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, + provider: { type: Object as PropType }, defaultTabName: { type: String, required: false }, }, setup() { diff --git a/src/control/toolbar/toolbar.tsx b/src/control/toolbar/toolbar.tsx index 10f08f5543..b95247e080 100644 --- a/src/control/toolbar/toolbar.tsx +++ b/src/control/toolbar/toolbar.tsx @@ -6,7 +6,11 @@ import { IDEToolbar, IDEToolbarItem, } from '@ibiz/model-core'; -import { IExtraButton, ToolbarController } from '@ibiz-template/runtime'; +import { + IControlProvider, + IExtraButton, + ToolbarController, +} from '@ibiz-template/runtime'; import { IBizPopperToolbar } from './popper-toolbar/popper-toolbar'; import './toolbar.scss'; @@ -35,6 +39,7 @@ export const ToolbarControl = defineComponent({ type: Object as PropType, required: true, }, + provider: { type: Object as PropType }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, }, diff --git a/src/control/tree/tree.tsx b/src/control/tree/tree.tsx index da56c508a1..3f96c2e6b2 100644 --- a/src/control/tree/tree.tsx +++ b/src/control/tree/tree.tsx @@ -2,6 +2,7 @@ import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; import { computed, defineComponent, PropType, ref, VNode } from 'vue'; import { IDETree } from '@ibiz/model-core'; import { + IControlProvider, ITreeController, ITreeNodeData, TreeController, @@ -19,23 +20,8 @@ export const TreeControl = defineComponent({ modelData: { type: Object as PropType, required: true }, context: { type: Object as PropType, required: true }, params: { type: Object as PropType, default: () => ({}) }, - /** - * 部件行数据默认激活模式 - * - 0 不激活 - * - 1 单击激活 - * - 2 双击激活(默认值) - * - * @type {(number | 0 | 1 | 2)} - */ + provider: { type: Object as PropType }, mdctrlActiveMode: { type: Number, default: 2 }, - - /** - * 是否为单选 - * - true 单选 - * - false 多选 - * - * @type {(Boolean)} - */ singleSelect: { type: Boolean, default: true }, }, setup() { -- Gitee