From 50473982e83ff210f7bbb93084e0e3165717e71d Mon Sep 17 00:00:00 2001 From: zhangkang <57750083+zhangkang1314@users.noreply.github.com> Date: Wed, 9 Aug 2023 10:32:36 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E8=A7=A3=E6=9E=90=E5=B7=A5=E5=85=B7=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/utils/util/util.ts | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/packages/core/src/utils/util/util.ts b/packages/core/src/utils/util/util.ts index c865dce1b87..fba84e4a56c 100644 --- a/packages/core/src/utils/util/util.ts +++ b/packages/core/src/utils/util/util.ts @@ -276,3 +276,44 @@ export function toNumberOrNil(value: unknown): number | undefined { } return num; } + +/** + * 日期格式化 + * + * @author zk + * @date 2023-08-08 08:08:47 + * @param {Date} date + * @param {string} [fmt='YYYY-MM-DD HH:mm:ss'] + * @return {*} {string} + * @memberof CalendarController + */ +export function dateFormat( + date: Date, + fmt: string = 'YYYY-MM-DD HH:mm:ss', +): string { + let ret: RegExpExecArray | null; + const opt: IData = { + 'Y+': date.getFullYear().toString(), // 年 + 'M+': (date.getMonth() + 1).toString(), // 月 + 'd+': date.getDate().toString(), // 日 + 'D+': date.getDate().toString(), // 日 + 'H+': date.getHours().toString(), // 时 + 'h+': date.getHours().toString(), // 时 + 'm+': date.getMinutes().toString(), // 分 + 's+': date.getSeconds().toString(), // 秒 + 'S+': date.getSeconds().toString(), + // 有其他格式化字符需求可以继续添加,必须转化成字符串 + }; + for (const k in opt) { + if (Object.prototype.hasOwnProperty.call(opt, k)) { + ret = new RegExp(`(${k})`).exec(fmt); + if (ret) { + fmt = fmt.replace( + ret[1], + ret[1].length === 1 ? opt[k] : opt[k].padStart(ret[1].length, '0'), + ); + } + } + } + return fmt; +} -- Gitee From 3d80c7c53cc4c34fc01dda7b4c3da67b0e6dbded Mon Sep 17 00:00:00 2001 From: zhangkang <57750083+zhangkang1314@users.noreply.github.com> Date: Wed, 9 Aug 2023 10:35:28 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E8=A7=86=E5=9B=BE=20=E5=8F=8A=20=E6=97=A5=E5=8E=86?= =?UTF-8?q?=E9=83=A8=E4=BB=B6=E6=8E=A5=E5=8F=A3=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../control/i-calendar.controller.ts | 25 +++ .../event/control/i-calendar.event.ts | 11 ++ .../event/view/i-calendar-view.event.ts | 12 ++ .../state/control/i-calendar.state.ts | 172 ++++++++++++++++++ .../state/view/i-calendar-view.state.ts | 10 + 5 files changed, 230 insertions(+) create mode 100644 packages/runtime/src/interface/controller/controller/control/i-calendar.controller.ts create mode 100644 packages/runtime/src/interface/controller/event/control/i-calendar.event.ts create mode 100644 packages/runtime/src/interface/controller/event/view/i-calendar-view.event.ts create mode 100644 packages/runtime/src/interface/controller/state/control/i-calendar.state.ts create mode 100644 packages/runtime/src/interface/controller/state/view/i-calendar-view.state.ts diff --git a/packages/runtime/src/interface/controller/controller/control/i-calendar.controller.ts b/packages/runtime/src/interface/controller/controller/control/i-calendar.controller.ts new file mode 100644 index 00000000000..7d4b8d7960e --- /dev/null +++ b/packages/runtime/src/interface/controller/controller/control/i-calendar.controller.ts @@ -0,0 +1,25 @@ +import { IDECalendar } from '@ibiz/model-core'; +import { ICalendarEvent } from '../../event'; +import { ICalendarState } from '../../state'; +import { IMDControlController } from './i-md-control.controller'; + +/** + * 日历部件控制器 + * @author lxm + * @date 2023-05-04 01:47:16 + * @export + * @interface ICalendarController + * @extends {IMDControlController} + */ +export interface ICalendarController + extends IMDControlController { + /** + * 设置选中日期 + * + * @author zk + * @date 2023-08-08 11:08:24 + * @param {Date} date + * @memberof ICalendarController + */ + setSelectDate(date: Date): void; +} diff --git a/packages/runtime/src/interface/controller/event/control/i-calendar.event.ts b/packages/runtime/src/interface/controller/event/control/i-calendar.event.ts new file mode 100644 index 00000000000..19b0cac09d0 --- /dev/null +++ b/packages/runtime/src/interface/controller/event/control/i-calendar.event.ts @@ -0,0 +1,11 @@ +import { IMDControlEvent } from './i-md-control.event'; + +/** + * 日历部件事件 + * + * @author zk + * @date 2022-08-30 16:08:43 + * @export + * @interface IMDControlEvent + */ +export type ICalendarEvent = IMDControlEvent; diff --git a/packages/runtime/src/interface/controller/event/view/i-calendar-view.event.ts b/packages/runtime/src/interface/controller/event/view/i-calendar-view.event.ts new file mode 100644 index 00000000000..d6e5b5acb83 --- /dev/null +++ b/packages/runtime/src/interface/controller/event/view/i-calendar-view.event.ts @@ -0,0 +1,12 @@ +import { IMDViewEvent } from './i-md-view.event'; + +/** + * 日历视图事件 + * + * @author lxm + * @date 2022-09-13 10:09:00 + * @export + * @interface ICalendarViewEvent + * @extends {IMDViewEvent} + */ +export type ICalendarViewEvent = IMDViewEvent; diff --git a/packages/runtime/src/interface/controller/state/control/i-calendar.state.ts b/packages/runtime/src/interface/controller/state/control/i-calendar.state.ts new file mode 100644 index 00000000000..a9a07e70e87 --- /dev/null +++ b/packages/runtime/src/interface/controller/state/control/i-calendar.state.ts @@ -0,0 +1,172 @@ +import { IMDControlState } from './i-md-control.state'; + +/** + * 日历部件状态 + * @author zk + * @date 2023-05-22 02:18:43 + * @export + * @interface ICalendarState + * @extends {IMDControlState} + */ + +export interface ICalendarState extends IMDControlState { + /** + * 多数据部件数据集合 + * @author lxm + * @date 2022-08-17 19:08:11 + * @type {IData[]} + */ + items: ICalendarItemData[]; + + /** + * 选中的日期 + * + * @author zk + * @date 2023-08-08 07:08:39 + * @type {Date} + * @memberof ICalendarState + */ + selectedDate: Date; +} + +/** + * 日历项数据 + * + * @author zk + * @date 2023-08-08 01:08:52 + * @export + * @interface ICalendarItemData + */ +export interface ICalendarItemData { + /** + * 背景色 + * + * @author zk + * @date 2023-08-08 01:08:17 + * @type {string} + * @memberof ICalendarItemData + */ + bkColor: string; + + /** + * 开始时间 + * + * @date 2023-08-08 01:08:46 + * @type {string} + * @memberof ICalendarItemData + */ + beginTime: string; + + /** + * 颜色 + * + * @date 2023-08-08 01:08:46 + * @type {string} + * @memberof ICalendarItemData + */ + color: string; + + /** + * 内容 + * + * @date 2023-08-08 01:08:46 + * @type {string} + * @memberof ICalendarItemData + */ + content: string; + /** + * 结束时间 + * + * @date 2023-08-08 01:08:46 + * @type {string} + * @memberof ICalendarItemData + */ + endTime: string; + + /** + * 图标 + * + * @date 2023-08-08 01:08:46 + * @type {string} + * @memberof ICalendarItemData + */ + icon: string; + /** + * id标识 + * + * @date 2023-08-08 01:08:46 + * @type {string} + * @memberof ICalendarItemData + */ + id: string; + /** + * 级别 + * + * @date 2023-08-08 01:08:46 + * @type {string} + * @memberof ICalendarItemData + */ + level: string; + /** + * 标记2 + * + * @date 2023-08-08 01:08:46 + * @type {string} + * @memberof ICalendarItemData + */ + tag2: string; + /** + * 标记1 + * + * @date 2023-08-08 01:08:46 + * @type {string} + * @memberof ICalendarItemData + */ + tag: string; + /** + * 文本 + * + * @date 2023-08-08 01:08:46 + * @type {string} + * @memberof ICalendarItemData + */ + text: string; + /** + * 提示 + * + * @date 2023-08-08 01:08:46 + * @type {string} + * @memberof ICalendarItemData + */ + tips: string; + + /** + * 实体数据 + * + * @author zk + * @date 2023-08-08 01:08:12 + * @type {IData} + * @memberof ICalendarItemData + */ + deData: IData; + + /** + * 日历项名称 + * + * @author zk + * @date 2023-08-08 01:08:12 + * @type {IData} + * @memberof ICalendarItemData + */ + itemType: string; + + /** + * 导航标识 + * + * @author zk + * @date 2023-08-08 04:08:25 + * @type {string} + * @memberof ICalendarItemData + */ + navId: string; +} diff --git a/packages/runtime/src/interface/controller/state/view/i-calendar-view.state.ts b/packages/runtime/src/interface/controller/state/view/i-calendar-view.state.ts new file mode 100644 index 00000000000..2a840e9fc42 --- /dev/null +++ b/packages/runtime/src/interface/controller/state/view/i-calendar-view.state.ts @@ -0,0 +1,10 @@ +import { IMDViewState } from './i-md-view.state'; + +/** + * 日历视图UI状态 + * + * @export + * @class ICalendarViewState + * @extends {IMDViewState} + */ +export interface ICalendarViewState extends IMDViewState {} -- Gitee From 69f0ec1a7aa7fa1ad44dcbaf5604fd01eafac6e2 Mon Sep 17 00:00:00 2001 From: zhangkang <57750083+zhangkang1314@users.noreply.github.com> Date: Wed, 9 Aug 2023 10:36:28 +0800 Subject: [PATCH 3/5] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E5=AF=BC=E8=88=AA=E8=A7=86=E5=9B=BE=20=E5=8F=8A=20?= =?UTF-8?q?=E6=97=A5=E5=8E=86=E5=AF=BC=E8=88=AA=E6=A0=8F=E9=83=A8=E4=BB=B6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../control/i-calendar-exp-bar.controller.ts | 19 +++++++++++++++++++ .../event/control/i-calendar-exp-bar.event.ts | 10 ++++++++++ .../event/view/i-calendar-exp-view.event.ts | 11 +++++++++++ .../state/control/i-calendar-exp-bar.state.ts | 10 ++++++++++ .../state/view/i-calendar-exp-view.state.ts | 10 ++++++++++ 5 files changed, 60 insertions(+) create mode 100644 packages/runtime/src/interface/controller/controller/control/i-calendar-exp-bar.controller.ts create mode 100644 packages/runtime/src/interface/controller/event/control/i-calendar-exp-bar.event.ts create mode 100644 packages/runtime/src/interface/controller/event/view/i-calendar-exp-view.event.ts create mode 100644 packages/runtime/src/interface/controller/state/control/i-calendar-exp-bar.state.ts create mode 100644 packages/runtime/src/interface/controller/state/view/i-calendar-exp-view.state.ts diff --git a/packages/runtime/src/interface/controller/controller/control/i-calendar-exp-bar.controller.ts b/packages/runtime/src/interface/controller/controller/control/i-calendar-exp-bar.controller.ts new file mode 100644 index 00000000000..0d69415c815 --- /dev/null +++ b/packages/runtime/src/interface/controller/controller/control/i-calendar-exp-bar.controller.ts @@ -0,0 +1,19 @@ +import { ITreeExpBar } from '@ibiz/model-core'; +import { ITreeExpBarEvent } from '../../event'; +import { ITreeExpBarState } from '../../state'; +import { IExpBarControlController } from './i-exp-bar-control.controller'; + +/** + * 日历部件控制器 + * @author lxm + * @date 2023-05-04 01:47:16 + * @export + * @interface ICalendarController + * @extends {IMDControlController} + */ +export interface ICalendarExpBarController + extends IExpBarControlController< + ITreeExpBar, + ITreeExpBarState, + ITreeExpBarEvent + > {} diff --git a/packages/runtime/src/interface/controller/event/control/i-calendar-exp-bar.event.ts b/packages/runtime/src/interface/controller/event/control/i-calendar-exp-bar.event.ts new file mode 100644 index 00000000000..3a31270e068 --- /dev/null +++ b/packages/runtime/src/interface/controller/event/control/i-calendar-exp-bar.event.ts @@ -0,0 +1,10 @@ +import { IExpBarControlEvent } from './i-exp-bar-control.event'; + +/** + * 日历导航栏事件 + * + * @export + * @interface ICalendarExpBarEvent + * @extends {IExpBarControlEvent} + */ +export interface ICalendarExpBarEvent extends IExpBarControlEvent {} diff --git a/packages/runtime/src/interface/controller/event/view/i-calendar-exp-view.event.ts b/packages/runtime/src/interface/controller/event/view/i-calendar-exp-view.event.ts new file mode 100644 index 00000000000..2a3e6097a8b --- /dev/null +++ b/packages/runtime/src/interface/controller/event/view/i-calendar-exp-view.event.ts @@ -0,0 +1,11 @@ +import { IExpViewEvent } from './i-exp-view.event'; + +/** + * 日历导航视图事件 + * + * @author zk + * @export + * @interface ICalendarViewEvent + * @extends {IMDViewEvent} + */ +export type ICalendarExpViewEvent = IExpViewEvent; diff --git a/packages/runtime/src/interface/controller/state/control/i-calendar-exp-bar.state.ts b/packages/runtime/src/interface/controller/state/control/i-calendar-exp-bar.state.ts new file mode 100644 index 00000000000..7902481e484 --- /dev/null +++ b/packages/runtime/src/interface/controller/state/control/i-calendar-exp-bar.state.ts @@ -0,0 +1,10 @@ +import { IExpBarControlState } from './i-exp-bar-control.state'; + +/** + * 日历导航栏部件状态 + * @author zk + * @export + * @interface ICalendarExpBarState + * @extends {IExpBarControlState} + */ +export interface ICalendarExpBarState extends IExpBarControlState {} diff --git a/packages/runtime/src/interface/controller/state/view/i-calendar-exp-view.state.ts b/packages/runtime/src/interface/controller/state/view/i-calendar-exp-view.state.ts new file mode 100644 index 00000000000..b357e24650c --- /dev/null +++ b/packages/runtime/src/interface/controller/state/view/i-calendar-exp-view.state.ts @@ -0,0 +1,10 @@ +import { IExpViewState } from './i-exp-view.state'; + +/** + * 日历导航视图UI状态 + * + * @export + * @class ICalendarExpViewState + * @extends {IExpViewState} + */ +export interface ICalendarExpViewState extends IExpViewState {} -- Gitee From c9994d22840b0dd04a9f63f2aee4e153e3d3b2b6 Mon Sep 17 00:00:00 2001 From: zhangkang <57750083+zhangkang1314@users.noreply.github.com> Date: Wed, 9 Aug 2023 10:39:55 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feat:=20=E6=8E=A5=E5=8F=A3=E7=B1=BB?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/interface/controller/controller/control/index.ts | 2 ++ .../runtime/src/interface/controller/event/control/index.ts | 2 ++ packages/runtime/src/interface/controller/event/view/index.ts | 2 ++ .../runtime/src/interface/controller/state/control/index.ts | 2 ++ packages/runtime/src/interface/controller/state/view/index.ts | 2 ++ 5 files changed, 10 insertions(+) diff --git a/packages/runtime/src/interface/controller/controller/control/index.ts b/packages/runtime/src/interface/controller/controller/control/index.ts index 0768acd2b9a..c3c460f9947 100644 --- a/packages/runtime/src/interface/controller/controller/control/index.ts +++ b/packages/runtime/src/interface/controller/controller/control/index.ts @@ -27,3 +27,5 @@ export * from './i-drbar.controller'; export * from './i-drtab.controller'; export * from './i-dashboard.controller'; export * from './portlet/index'; +export * from './i-calendar.controller'; +export * from './i-calendar-exp-bar.controller'; diff --git a/packages/runtime/src/interface/controller/event/control/index.ts b/packages/runtime/src/interface/controller/event/control/index.ts index af9f50f8598..92c9b89c044 100644 --- a/packages/runtime/src/interface/controller/event/control/index.ts +++ b/packages/runtime/src/interface/controller/event/control/index.ts @@ -24,3 +24,5 @@ export * from './i-search-bar.event'; export * from './i-chart.event'; export * from './i-drbar.event'; export * from './i-drtab.event'; +export * from './i-calendar.event'; +export * from './i-calendar-exp-bar.event'; diff --git a/packages/runtime/src/interface/controller/event/view/index.ts b/packages/runtime/src/interface/controller/event/view/index.ts index 191ba3c8674..f9798ce273f 100644 --- a/packages/runtime/src/interface/controller/event/view/index.ts +++ b/packages/runtime/src/interface/controller/event/view/index.ts @@ -33,3 +33,5 @@ export * from './i-wf-step-trace-view.event'; export * from './i-portal-view.event'; export * from './i-app-portal-view.event'; export * from './i-de-portal-view.event'; +export * from './i-calendar-view.event'; +export * from './i-calendar-exp-view.event'; diff --git a/packages/runtime/src/interface/controller/state/control/index.ts b/packages/runtime/src/interface/controller/state/control/index.ts index adb01ed8de1..c9dbcb1ba35 100644 --- a/packages/runtime/src/interface/controller/state/control/index.ts +++ b/packages/runtime/src/interface/controller/state/control/index.ts @@ -29,3 +29,5 @@ export * from './i-chart.state'; export * from './i-drbar.state'; export * from './i-drtab.state'; export * from './i-dashboard.state'; +export * from './i-calendar.state'; +export * from './i-calendar-exp-bar.state'; diff --git a/packages/runtime/src/interface/controller/state/view/index.ts b/packages/runtime/src/interface/controller/state/view/index.ts index 121f20dfc47..594f3fd1266 100644 --- a/packages/runtime/src/interface/controller/state/view/index.ts +++ b/packages/runtime/src/interface/controller/state/view/index.ts @@ -33,3 +33,5 @@ export * from './i-portal-view.state'; export * from './i-app-portal-view.state'; export * from './i-de-portal-view.state'; export * from './i-panel-view.state'; +export * from './i-calendar-view.state'; +export * from './i-calendar-exp-view.state'; -- Gitee From 636b29d69eda0e4eeefa416b13cf4520ba2e90e8 Mon Sep 17 00:00:00 2001 From: zhangkang <57750083+zhangkang1314@users.noreply.github.com> Date: Wed, 9 Aug 2023 10:40:41 +0800 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E9=A1=B9=E6=95=B0=E6=8D=AE=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../calendar-item-data/calendar-item-data.ts | 94 +++++++++++++++++++ .../service/vo/calendar-item-data/index.ts | 1 + packages/runtime/src/service/vo/index.ts | 1 + 3 files changed, 96 insertions(+) create mode 100644 packages/runtime/src/service/vo/calendar-item-data/calendar-item-data.ts create mode 100644 packages/runtime/src/service/vo/calendar-item-data/index.ts diff --git a/packages/runtime/src/service/vo/calendar-item-data/calendar-item-data.ts b/packages/runtime/src/service/vo/calendar-item-data/calendar-item-data.ts new file mode 100644 index 00000000000..ae12b7e42d1 --- /dev/null +++ b/packages/runtime/src/service/vo/calendar-item-data/calendar-item-data.ts @@ -0,0 +1,94 @@ +import { ISysCalendarItem } from '@ibiz/model-core'; +import { ICalendarItemData } from '../../../interface'; + +/** + * 日历项数据 + * + * @export + * @class CalendarItemData + * @implements {ICalendarItemData} + */ +export class CalendarItemData implements ICalendarItemData { + constructor( + private model: ISysCalendarItem, + private data: IData, + ) {} + + get deData(): IData { + return this.data; + } + + get navId(): string { + return `${this.itemType}@${this.id}`; + } + + get itemType(): string { + return this.model.itemType!; + } + + get bkColor(): string { + const fieldName = this.model.bkcolorAppDEFieldId; + return fieldName && this.data[fieldName] + ? this.data[fieldName] + : this.model.bkcolor; + } + + get beginTime(): string { + const fieldName = this.model.beginTimeAppDEFieldId; + return fieldName ? this.data[fieldName] : undefined; + } + + get color(): string { + const fieldName = this.model.colorAppDEFieldId; + return fieldName && this.data[fieldName] + ? this.data[fieldName] + : this.model.color; + } + + get content(): string { + const fieldName = this.model.contentAppDEFieldId; + return fieldName ? this.data[fieldName] : undefined; + } + + get endTime(): string { + const fieldName = this.model.endTimeAppDEFieldId; + return fieldName ? this.data[fieldName] : undefined; + } + + get icon(): string { + const fieldName = this.model.iconAppDEFieldId; + return fieldName ? this.data[fieldName] : undefined; + } + + get id(): string { + const fieldName = this.model.idAppDEFieldId; + return fieldName && this.data[fieldName] + ? this.data[fieldName] + : this.data.srfkey; + } + + get level(): string { + const fieldName = this.model.levelAppDEFieldId; + return fieldName ? this.data[fieldName] : undefined; + } + + get tag2(): string { + const fieldName = this.model.tag2AppDEFieldId; + return fieldName ? this.data[fieldName] : undefined; + } + + get tag(): string { + const fieldName = this.model.tagAppDEFieldId; + return fieldName ? this.data[fieldName] : undefined; + } + + get text(): string { + const fieldName = this.model.textAppDEFieldId; + return fieldName ? this.data[fieldName] : undefined; + } + + get tips(): string { + const fieldName = this.model.tipsAppDEFieldId; + return fieldName ? this.data[fieldName] : undefined; + } +} diff --git a/packages/runtime/src/service/vo/calendar-item-data/index.ts b/packages/runtime/src/service/vo/calendar-item-data/index.ts new file mode 100644 index 00000000000..958ef64f5db --- /dev/null +++ b/packages/runtime/src/service/vo/calendar-item-data/index.ts @@ -0,0 +1 @@ +export * from './calendar-item-data'; diff --git a/packages/runtime/src/service/vo/index.ts b/packages/runtime/src/service/vo/index.ts index 2976e375eaf..1c654528ecc 100644 --- a/packages/runtime/src/service/vo/index.ts +++ b/packages/runtime/src/service/vo/index.ts @@ -1,3 +1,4 @@ export * from './control.vo'; export * from './tree-node-data'; export * from './ui-map-field'; +export * from './calendar-item-data'; -- Gitee