diff --git a/packages/runtime/CHANGELOG.md b/packages/runtime/CHANGELOG.md index b99838bd54ed93eebb472bdecde94cfdc1cd621a..dce93a1ecc7485158cf5af0ded8c00f2cda74f14 100644 --- a/packages/runtime/CHANGELOG.md +++ b/packages/runtime/CHANGELOG.md @@ -17,6 +17,10 @@ - 多数据部件onBeforeLoad事件添加请求参数 - 更新移动端多数据部件界面行为组权限计算 - 更新表单按钮组界面行为权限计算 +- 适配全局参数enableDataInfoBar(是否启用信息栏)逻辑,该参数为true时识别模型isShowDataInfoBar配置,为false则不显示信息栏 +- 适配全局参数editSaveMode(表格行编辑保存模式)自动保存模式,该参数为auto时将每隔3秒保存一次值变更后的行数据 +- 调整表单多数据部件静默执行删除逻辑,将删除确认弹框逻辑迁移到表单组件中实现,用于统一弹框样式 +- 调整表单项组件中处理编辑器额外参数逻辑,将其迁移到控制器中处理 ## [0.7.41-alpha.23] - 2025-09-04 diff --git a/packages/runtime/src/controller/common/editor/editor.controller.ts b/packages/runtime/src/controller/common/editor/editor.controller.ts index 3d801ed1a79be42c8685026ce259593338f73abf..669efe40c61c8a0ed93f1d6cecd38992121dca7f 100644 --- a/packages/runtime/src/controller/common/editor/editor.controller.ts +++ b/packages/runtime/src/controller/common/editor/editor.controller.ts @@ -303,6 +303,37 @@ export class EditorController (item: IEditorItem) => item.id !== this.model.id, ); } + + this.initExtraParams(); + } + + /** + * @description 初始化额外参数 + * @protected + * @memberof FormItemController + */ + protected initExtraParams(): void { + // 额外参数 + const extraParams = {}; + + // 是否隐藏无值的单位 + let emptyHiddenUnit = true; + if ((this.parent as IData)?.emptyHiddenUnit === false) { + emptyHiddenUnit = (this.parent as IData)?.emptyHiddenUnit; + } + // 编辑器参数优先级最高 + const { EMPTYHIDDENUNIT, emptyhiddenunit } = this.editorParams; + if (EMPTYHIDDENUNIT) { + emptyHiddenUnit = Object.is(EMPTYHIDDENUNIT, 'true'); + } + if (emptyhiddenunit) { + emptyHiddenUnit = Object.is(emptyhiddenunit, 'true'); + } + Object.assign(extraParams, { + emptyHiddenUnit, + }); + + this.extraParams = extraParams; } /** diff --git a/packages/runtime/src/controller/control/caption-bar/caption-bar.controller.ts b/packages/runtime/src/controller/control/caption-bar/caption-bar.controller.ts index 631691eac21e791f19f65980a3063c3dc5198cc2..d2254662646e3cdbfec5477ebc6b6a5c3fb1c5cc 100644 --- a/packages/runtime/src/controller/control/caption-bar/caption-bar.controller.ts +++ b/packages/runtime/src/controller/control/caption-bar/caption-bar.controller.ts @@ -34,6 +34,8 @@ export class CaptionBarController const { showDataInfoBar } = this.view.model as IData; if (ibiz.config.view.onlyShowDataInfo && dataInfo) { this.state.caption = dataInfo; + } else if (!ibiz.config.view.enableDataInfoBar) { + this.state.caption = `${this.view.model.caption}`; } else { this.state.caption = `${this.view.model.caption}${ showDataInfoBar && dataInfo ? `-${dataInfo}` : '' diff --git a/packages/runtime/src/controller/control/form/form-detail/form-item/form-item.controller.ts b/packages/runtime/src/controller/control/form/form-detail/form-item/form-item.controller.ts index 6fa821bfc840c61cf02d1c57fe9f00c63b0d6938..2ed9e04898beeec84de1c589bd72e59c6bcd8833 100644 --- a/packages/runtime/src/controller/control/form/form-detail/form-item/form-item.controller.ts +++ b/packages/runtime/src/controller/control/form/form-detail/form-item/form-item.controller.ts @@ -173,6 +173,19 @@ export class FormItemController return this.model.dataType; } + /** + * @description 隐藏无值的单位 + * @readonly + * @type {boolean} + * @memberof FormItemController + */ + get emptyHiddenUnit(): boolean { + if (this.form?.controlParams?.emptyhiddenunit) { + return Object.is(this.form?.controlParams?.emptyhiddenunit, 'true'); + } + return ibiz.config.form.emptyHiddenUnit; + } + /** * tips缓存标识 * diff --git a/packages/runtime/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-md.controller.ts b/packages/runtime/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-md.controller.ts index ded3ecfcb44cd323cc3c9dfde42be3b8aee098c9..d053ed7fe825114a3ae4b3a6dd22c6784736196d 100644 --- a/packages/runtime/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-md.controller.ts +++ b/packages/runtime/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-md.controller.ts @@ -128,7 +128,9 @@ export class FormMDCtrlMDController * @memberof FormMDCtrlMDController */ remove(): void { - this.mdController.remove(); + this.mdController.remove({ + silent: true, + }); } /** diff --git a/packages/runtime/src/controller/control/grid/grid/grid.controller.ts b/packages/runtime/src/controller/control/grid/grid/grid.controller.ts index 1019b47d071cf7e376c8f6c3c10bfa97ab057ebb..1d5f647cb8881981148c5063af6c65b8bf95d7f6 100644 --- a/packages/runtime/src/controller/control/grid/grid/grid.controller.ts +++ b/packages/runtime/src/controller/control/grid/grid/grid.controller.ts @@ -358,6 +358,14 @@ export class GridController< return !!this.model.enableRowEditOrder; } + /** + * @description 自动保存的定时器引用 + * @protected + * @type {unknown} + * @memberof GridController + */ + protected autoSaveTimer?: unknown; + protected initState(): void { super.initState(); this.state.rows = []; @@ -415,6 +423,34 @@ export class GridController< await this.initGroup(); // 初始化数据导出对象 await this.initExportData(); + + this.initAutoSaveTimer(); + } + + /** + * @description 初始化自动保存定时器 + * @protected + * @memberof GridController + */ + protected initAutoSaveTimer(): void { + if (this.editSaveMode !== 'auto') return; + this.destroyAutoSaveTimer(); + this.autoSaveTimer = setInterval(() => { + // 该方法只会保存修改过的行数据 + this.saveAll(); + }, 3000); + } + + /** + * @description 销毁自动保存定时器 + * @protected + * @memberof GridController + */ + protected destroyAutoSaveTimer(): void { + if (this.autoSaveTimer) { + clearInterval(this.autoSaveTimer as number); + this.autoSaveTimer = undefined; + } } /** @@ -2165,4 +2201,15 @@ export class GridController< ): IApiGridColumnMapping[K] { return this.columns[id] as unknown as IApiGridColumnMapping[K]; } + + /** + * @description 生命周期-销毁完成 + * @protected + * @returns {*} {Promise} + * @memberof GridController + */ + protected async onDestroyed(): Promise { + await super.onDestroyed(); + this.destroyAutoSaveTimer(); + } } diff --git a/packages/runtime/src/interface/api/common/global-config/i-api-global-codelist-config.ts b/packages/runtime/src/interface/api/common/global-config/i-api-global-codelist-config.ts index 0bf939e3b2b1b75f0fc84bf7b354c7dc1e22388b..3f7eb34c92aa65458d5cf805896835a29beb2538 100644 --- a/packages/runtime/src/interface/api/common/global-config/i-api-global-codelist-config.ts +++ b/packages/runtime/src/interface/api/common/global-config/i-api-global-codelist-config.ts @@ -7,7 +7,7 @@ export interface IApiGlobalCodeListConfig { /** * @description 默认代码表超时时间(单位:毫秒),为避免动态代码表重复加载,当代码表没有配置缓存超时时长时,使用该参数设置代码表超时时间。 * @type {number} - * @default 60 * 60 * 1000 + * @default 3600000 * @memberof IApiGlobalCodeListConfig */ timeout: number; diff --git a/packages/runtime/src/interface/api/common/global-config/i-api-global-common-config.ts b/packages/runtime/src/interface/api/common/global-config/i-api-global-common-config.ts index d0f0533a2ded8501c8646adbe8d44c56b33aa0aa..5f6d056b86d8581c80cf5018e190df87e4f3c18c 100644 --- a/packages/runtime/src/interface/api/common/global-config/i-api-global-common-config.ts +++ b/packages/runtime/src/interface/api/common/global-config/i-api-global-common-config.ts @@ -13,7 +13,7 @@ export interface IApiGlobalCommonConfig { emptyText: string; /** - * @description 无值显示模式,值为 'PLACEHOLDER' 时显示占位文本内容,值为 'DEFAULT' 或占位文本无值时显示`emptyText` + * @description 无值显示模式,值为 'PLACEHOLDER' 时显示占位文本内容,值为 'DEFAULT' 或占位文本无值时显示`emptyText`参数所设置的值 * @type {'DEFAULT' | 'PLACEHOLDER'} * @default 'DEFAULT' * @memberof IApiGlobalCommonConfig @@ -35,7 +35,7 @@ export interface IApiGlobalCommonConfig { drawerOption?: string; /** - * @description 快速搜索提示分隔符 + * @description 快速搜索框占位文本分隔符,用于分割实体属性中启用了支持快速搜索的属性名称 * @type {string} * @default '、' * @memberof IApiGlobalCommonConfig @@ -45,6 +45,7 @@ export interface IApiGlobalCommonConfig { /** * @description 是否启用传入下载凭证 * @type {boolean} + * @default false * @memberof IApiGlobalCommonConfig */ enableDownloadTicket: boolean; diff --git a/packages/runtime/src/interface/api/common/global-config/i-api-global-grid-config.ts b/packages/runtime/src/interface/api/common/global-config/i-api-global-grid-config.ts index 0113221c22cfd68da2d82b52fc308f0a7a13e11d..f43725ec76658b16e3ae458753583c37f89a9010 100644 --- a/packages/runtime/src/interface/api/common/global-config/i-api-global-grid-config.ts +++ b/packages/runtime/src/interface/api/common/global-config/i-api-global-grid-config.ts @@ -13,7 +13,7 @@ export interface IApiGlobalGridConfig { editShowMode: 'cell' | 'row' | 'all'; /** - * @description 表格行编辑保存模式,cell-blur 单元格失焦时保存整行数据;auto 自动保存,值变更之后一段时间保存整行数据;manual 手动保存,由界面行为调用表格整体保存或行保存 + * @description 表格行编辑保存模式,cell-blur 单元格失焦时保存整行数据;auto 自动保存,将每隔 3 秒保存一次值变更后的行数据;manual 手动保存,由界面行为调用表格整体保存或行保存 * @type {('cell-blur' | 'auto' | 'manual')} * @default cell-blur * @memberof IApiGlobalGridConfig @@ -37,9 +37,9 @@ export interface IApiGlobalGridConfig { overflowMode: 'wrap' | 'ellipsis'; /** - * @description 隐藏无值的单位 - * @default true + * @description 表格列格式化值时控制无值状态下单位的显示逻辑,当表格属性列配置了值格式化且绑定属性存在值时,此参数生效。若属性值格式化后无值,该参数为 true 则隐藏单位,为 false 则显示单位 * @type {boolean} + * @default true * @memberof IApiGlobalGridConfig */ emptyHiddenUnit: boolean; diff --git a/packages/runtime/src/interface/api/common/global-config/i-api-global-kanban-config.ts b/packages/runtime/src/interface/api/common/global-config/i-api-global-kanban-config.ts index 1408b77f2ce7d778e8bfd15143eee2bf34dea4fe..62f395aebe179507d123fa10a9943d7fbcec4b0d 100644 --- a/packages/runtime/src/interface/api/common/global-config/i-api-global-kanban-config.ts +++ b/packages/runtime/src/interface/api/common/global-config/i-api-global-kanban-config.ts @@ -7,12 +7,14 @@ export interface IApiGlobalKanbanConfig { /** * @description 启用全屏 * @type {boolean} + * @default true * @memberof IApiGlobalKanbanConfig */ enableFullScreen: boolean; /** * @description 启用分组隐藏 * @type {boolean} + * @default false * @memberof IApiGlobalKanbanConfig */ enableGroupHidden: boolean; diff --git a/packages/runtime/src/interface/api/common/global-config/i-api-global-view-config.ts b/packages/runtime/src/interface/api/common/global-config/i-api-global-view-config.ts index 0990bc8c49c5ee359645caf483d2d8a4d6bf34f3..3aa6574b33d20b8785282fa04ee1114a9b3b9b6a 100644 --- a/packages/runtime/src/interface/api/common/global-config/i-api-global-view-config.ts +++ b/packages/runtime/src/interface/api/common/global-config/i-api-global-view-config.ts @@ -21,7 +21,7 @@ export interface IApiGlobalViewConfig { expCacheMode: string; /** - * @description 首页是否不采用分页导航模式,该参数为true时首页不显示分页导航栏 + * @description 是否禁用分页导航栏,该参数为true时首页不显示分页导航栏 * @default false * @type {boolean} * @memberof IApiGlobalViewConfig @@ -37,7 +37,7 @@ export interface IApiGlobalViewConfig { mobShowPresetBack: boolean; /** - * @description 移动端是否视图头 + * @description 移动端是否显示视图头 * @default true * @type {boolean} * @memberof IApiGlobalViewConfig @@ -45,8 +45,8 @@ export interface IApiGlobalViewConfig { mobShowViewHeader: boolean; /** - * @description 用户操作超时周期,超过该时间刷新用户访问状态 - * @default 300s + * @description 用户操作超时周期(单位:毫秒),超出该时间将刷新用户访问状态,用于协同编辑场景 + * @default 300000 * @type {number} * @memberof IApiGlobalViewConfig */