@ibiz-template/runtime 0.7.41-alpha.5 → 0.7.41-alpha.6

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 (26) hide show
  1. package/dist/index.esm.js +198 -65
  2. package/dist/index.system.min.js +1 -1
  3. package/out/controller/control/chart/generator/base-series-generator.d.ts +12 -5
  4. package/out/controller/control/chart/generator/base-series-generator.d.ts.map +1 -1
  5. package/out/controller/control/chart/generator/base-series-generator.js +55 -24
  6. package/out/controller/control/form/form-detail/form-druipart/form-druipart.controller.d.ts +18 -6
  7. package/out/controller/control/form/form-detail/form-druipart/form-druipart.controller.d.ts.map +1 -1
  8. package/out/controller/control/form/form-detail/form-druipart/form-druipart.controller.js +57 -25
  9. package/out/controller/utils/util/util.d.ts +15 -0
  10. package/out/controller/utils/util/util.d.ts.map +1 -1
  11. package/out/controller/utils/util/util.js +57 -5
  12. package/out/engine/md-view.engine.d.ts +1 -1
  13. package/out/engine/md-view.engine.d.ts.map +1 -1
  14. package/out/engine/md-view.engine.js +13 -1
  15. package/out/interface/api/controller/control/i-api-chart.controller.d.ts +1 -0
  16. package/out/interface/api/controller/control/i-api-chart.controller.d.ts.map +1 -1
  17. package/out/interface/api/util/i-api-file-util.d.ts +65 -4
  18. package/out/interface/api/util/i-api-file-util.d.ts.map +1 -1
  19. package/out/interface/controller/event/argument/data-change.event.d.ts +4 -5
  20. package/out/interface/controller/event/argument/data-change.event.d.ts.map +1 -1
  21. package/out/service/vo/code-list-data-item/code-list-data-item.d.ts.map +1 -1
  22. package/out/service/vo/code-list-data-item/code-list-data-item.js +8 -1
  23. package/out/utils/file-util/file-util.d.ts +20 -3
  24. package/out/utils/file-util/file-util.d.ts.map +1 -1
  25. package/out/utils/file-util/file-util.js +43 -12
  26. package/package.json +2 -2
package/dist/index.esm.js CHANGED
@@ -25535,7 +25535,7 @@ var CodeListDataItem = class {
25535
25535
  try {
25536
25536
  this.data = ScriptFactory.execSingleLine(
25537
25537
  dataAppDEFieldId,
25538
- this.$origin
25538
+ this.$origin instanceof AppDataEntity ? clone5(this.$origin._data) : clone5(this.$origin)
25539
25539
  );
25540
25540
  } catch (error) {
25541
25541
  ibiz.log.error(ibiz.i18n.t("runtime.service.dynamicCodeTable"));
@@ -25579,6 +25579,10 @@ var CodeListDataItem = class {
25579
25579
  enumerable: true,
25580
25580
  configurable: true
25581
25581
  });
25582
+ this.children = void 0;
25583
+ this.cls = void 0;
25584
+ this.tooltip = void 0;
25585
+ this.userData = void 0;
25582
25586
  Object.keys(
25583
25587
  data instanceof AppDataEntity ? clone5(data._data) : clone5(data)
25584
25588
  ).forEach((key) => {
@@ -34588,20 +34592,18 @@ function formatDate(val, format) {
34588
34592
  if (!val || isNaN(date.getTime()))
34589
34593
  return value;
34590
34594
  const year = dayjs(date).year();
34591
- const month = dayjs(date).month() + 1;
34592
34595
  switch (format) {
34593
34596
  case "year":
34594
34597
  value = "".concat(year);
34595
34598
  break;
34596
34599
  case "quarter":
34597
- value = "".concat(year, " ").concat(Math.ceil(month / 3)).concat(ibiz.i18n.t("runtime.controller.utils.util.quarter"));
34600
+ value = "".concat(year, " ").concat(dayjs(date).quarter()).concat(ibiz.i18n.t("runtime.controller.utils.util.quarter"));
34598
34601
  break;
34599
34602
  case "month":
34600
- value = "".concat(year, " ").concat(month).concat(ibiz.i18n.t("runtime.controller.utils.util.month"));
34603
+ value = "".concat(year, " ").concat(dayjs(date).month() + 1).concat(ibiz.i18n.t("runtime.controller.utils.util.month"));
34601
34604
  break;
34602
34605
  case "week":
34603
- const week = dayjs(date).week();
34604
- value = "".concat(year, " ").concat(week).concat(ibiz.i18n.t("runtime.controller.utils.util.week"));
34606
+ value = "".concat(year, " ").concat(dayjs(date).week()).concat(ibiz.i18n.t("runtime.controller.utils.util.week"));
34605
34607
  break;
34606
34608
  case "day":
34607
34609
  value = dayjs(date).format("YYYY-MM-DD");
@@ -34611,6 +34613,41 @@ function formatDate(val, format) {
34611
34613
  }
34612
34614
  return value;
34613
34615
  }
34616
+ function getWeeksInYear(year) {
34617
+ const lastDayOfYear = dayjs("".concat(year, "-12-31"));
34618
+ const week = lastDayOfYear.isoWeek();
34619
+ return week === 1 ? 52 : week;
34620
+ }
34621
+ function generateYearWeekRange(minYearWeek, maxYearWeek, paddingWeeks = 0) {
34622
+ const [minYear, minWeek] = minYearWeek.split("-").map(Number);
34623
+ const [maxYear, maxWeek] = maxYearWeek.split("-").map(Number);
34624
+ let startYear = minYear;
34625
+ let startWeek = minWeek - paddingWeeks;
34626
+ while (startWeek < 1) {
34627
+ startYear--;
34628
+ startWeek += getWeeksInYear(startYear);
34629
+ }
34630
+ let endYear = maxYear;
34631
+ let endWeek = maxWeek + paddingWeeks;
34632
+ const maxWeeksInEndYear = getWeeksInYear(endYear);
34633
+ if (endWeek > maxWeeksInEndYear) {
34634
+ endWeek -= maxWeeksInEndYear;
34635
+ endYear++;
34636
+ }
34637
+ const yearWeeks = [];
34638
+ let currentYear = startYear;
34639
+ let currentWeek = startWeek;
34640
+ while (currentYear < endYear || currentYear === endYear && currentWeek <= endWeek) {
34641
+ yearWeeks.push("".concat(currentYear, "-").concat(currentWeek));
34642
+ currentWeek++;
34643
+ const weeksInCurrentYear = getWeeksInYear(currentYear);
34644
+ if (currentWeek > weeksInCurrentYear) {
34645
+ currentYear++;
34646
+ currentWeek = 1;
34647
+ }
34648
+ }
34649
+ return yearWeeks;
34650
+ }
34614
34651
 
34615
34652
  // src/controller/utils/value-rule/value-rule.ts
34616
34653
  import { RuntimeError as RuntimeError25 } from "@ibiz-template/core";
@@ -43183,9 +43220,11 @@ var BaseSeriesGenerator = class {
43183
43220
  * @return {*} {(SeriesOption[] | SeriesOption)}
43184
43221
  */
43185
43222
  calcByData(data) {
43223
+ const { userParam, echartsType } = this.model;
43186
43224
  const tempData = this.dataPreprocess(data);
43187
43225
  const groupData = this.calcGroupData(tempData);
43188
- this.addTimeData(groupData);
43226
+ const noCompletionDate = (userParam == null ? void 0 : userParam.completiondate) === "false" || echartsType && ["pie", "gauge", "radar", "funnel"].includes(echartsType);
43227
+ noCompletionDate ? this.calcTimeData(groupData) : this.addTimeData(groupData);
43189
43228
  return this.calcGroupSeries(groupData);
43190
43229
  }
43191
43230
  /**
@@ -43286,17 +43325,16 @@ var BaseSeriesGenerator = class {
43286
43325
  });
43287
43326
  }
43288
43327
  /**
43289
- * 根据分组模式补全分组数据并排序
43290
- * @param {IData} data
43291
- * @return {*}
43292
- * @author: zhujiamin
43293
- * @Date: 2023-08-16 13:57:53
43328
+ * @description 根据分组模式补全时间数据
43329
+ * - 将最小日期和最大日期之间的数据补全,确保横坐标时间的连续性
43330
+ * @param {GroupData} data
43331
+ * @returns {*} {void}
43332
+ * @memberof BaseSeriesGenerator
43294
43333
  */
43295
43334
  addTimeData(data) {
43296
43335
  const { groupMode } = this.model;
43297
- if (!groupMode || groupMode === "CODELIST") {
43336
+ if (!groupMode || groupMode === "CODELIST")
43298
43337
  return;
43299
- }
43300
43338
  const dates = [];
43301
43339
  Object.keys(data).forEach((key) => {
43302
43340
  data[key].forEach((_val, date) => {
@@ -43369,7 +43407,7 @@ var BaseSeriesGenerator = class {
43369
43407
  }
43370
43408
  }
43371
43409
  } else if (groupMode === "YEARWEEK") {
43372
- const yearWeeks = [];
43410
+ let yearWeeks = [];
43373
43411
  Object.keys(data).forEach((key) => {
43374
43412
  data[key].forEach((_val, yearWeek) => {
43375
43413
  yearWeeks.push(yearWeek);
@@ -43383,22 +43421,41 @@ var BaseSeriesGenerator = class {
43383
43421
  (max2, current) => current > max2 ? current : max2,
43384
43422
  yearWeeks[0]
43385
43423
  );
43386
- const [minYear] = minYearWeek.split("-");
43387
- const [maxYear] = maxYearWeek.split("-");
43388
- for (let year = parseInt(minYear, 10); year <= parseInt(maxYear, 10); year++) {
43389
- const numWeeks = dayjs5("".concat(year, "-12-31")).isoWeek();
43390
- for (let week = 1; week <= numWeeks; week++) {
43391
- const yearWeek = "".concat(year, "-").concat(week);
43392
- Object.keys(data).forEach((key) => {
43393
- if (!data[key].get(yearWeek)) {
43394
- data[key].set(yearWeek, { value: 0 });
43395
- }
43396
- });
43397
- }
43398
- }
43424
+ yearWeeks = generateYearWeekRange(minYearWeek, maxYearWeek, 3);
43425
+ yearWeeks.forEach((yearWeek) => {
43426
+ Object.keys(data).forEach((key) => {
43427
+ if (!data[key].get(yearWeek)) {
43428
+ data[key].set(yearWeek, { value: 0 });
43429
+ }
43430
+ });
43431
+ });
43399
43432
  }
43400
43433
  this.sortTimeData(data);
43401
43434
  }
43435
+ /**
43436
+ * @description 根据分组模式计算时间数据
43437
+ * - 只计算有值的日期,展示关键信息数据,多用于横轴日期显示跨度大的情况
43438
+ * @param {GroupData} data
43439
+ * @memberof BaseSeriesGenerator
43440
+ */
43441
+ calcTimeData(data) {
43442
+ const { groupMode } = this.model;
43443
+ if (!groupMode || groupMode === "CODELIST")
43444
+ return;
43445
+ const dates = [];
43446
+ Object.keys(data).forEach((key) => {
43447
+ data[key].forEach((_val, date) => {
43448
+ dates.push(date);
43449
+ });
43450
+ });
43451
+ dates.forEach((date) => {
43452
+ Object.keys(data).forEach((key) => {
43453
+ if (!data[key].get(date))
43454
+ data[key].set(date, { value: 0 });
43455
+ });
43456
+ });
43457
+ this.sortTimeData(data);
43458
+ }
43402
43459
  };
43403
43460
 
43404
43461
  // src/controller/control/chart/generator/line-series-generator.ts
@@ -51830,6 +51887,12 @@ var FormDRUIPartController = class extends FormDetailController {
51830
51887
  embedView.appDataEntityId
51831
51888
  );
51832
51889
  }
51890
+ this.form.evt.on("onBeforeSave", async () => {
51891
+ if (this.isNeedSyncEmbed && this.embedView && this.embedDataService) {
51892
+ await this.saveEmbedViewData();
51893
+ await this.SyncEmbedDataToForm();
51894
+ }
51895
+ });
51833
51896
  }
51834
51897
  /**
51835
51898
  * @description 表单数据变更通知(由表单控制器调用)
@@ -51861,21 +51924,6 @@ var FormDRUIPartController = class extends FormDetailController {
51861
51924
  this.calcViewParams();
51862
51925
  }
51863
51926
  }
51864
- /**
51865
- * @description 同步当前表单数据至子界面数据服务
51866
- * @returns {*} {Promise<void>}
51867
- * @memberof FormDRUIPartController
51868
- */
51869
- async SyncDataToEmbedService() {
51870
- if (this.isNeedSyncEmbed && this.embedDataService) {
51871
- const tempContext = this.context.clone();
51872
- tempContext.srfappid = this.model.appId;
51873
- const originData = this.form.state.data.$origin;
51874
- const res = await this.embedDataService.getTemp(tempContext);
51875
- const syncAction = res.data ? "updateTemp" : "createTemp";
51876
- await this.embedDataService[syncAction](tempContext, originData);
51877
- }
51878
- }
51879
51927
  /**
51880
51928
  * @description 计算视图上下文和视图参数, 调用该方法一定会刷新视图。
51881
51929
  * @returns {*} {void}
@@ -51883,7 +51931,10 @@ var FormDRUIPartController = class extends FormDetailController {
51883
51931
  */
51884
51932
  calcViewParams() {
51885
51933
  let newContext = this.form.context.clone();
51886
- newContext.srfignorechange = this.isNeedSyncEmbed;
51934
+ if (this.isNeedSyncEmbed) {
51935
+ newContext.srfignorechange = true;
51936
+ newContext.srfsilent = true;
51937
+ }
51887
51938
  const navContexts = this.model.navigateContexts;
51888
51939
  if (notNilEmpty10(navContexts)) {
51889
51940
  newContext = Object.assign(
@@ -51942,14 +51993,7 @@ var FormDRUIPartController = class extends FormDetailController {
51942
51993
  this.model.deformItemUpdateId
51943
51994
  );
51944
51995
  }
51945
- if (this.isNeedSyncEmbed && this.embedDataService) {
51946
- const tempContext = this.context.clone();
51947
- tempContext.srfappid = this.model.appId;
51948
- const res = await this.embedDataService.getTemp(tempContext);
51949
- const childData = res.data || {};
51950
- const exData = this.form.state.data.srfexdata || {};
51951
- this.form.state.data.srfexdata = Object.assign(exData, childData);
51952
- }
51996
+ await this.SyncEmbedDataToForm();
51953
51997
  });
51954
51998
  }
51955
51999
  /**
@@ -51990,6 +52034,47 @@ var FormDRUIPartController = class extends FormDetailController {
51990
52034
  }
51991
52035
  return true;
51992
52036
  }
52037
+ /**
52038
+ * @description 同步当前表单数据至子界面数据服务
52039
+ * @returns {*} {Promise<void>}
52040
+ * @memberof FormDRUIPartController
52041
+ */
52042
+ async SyncDataToEmbedService() {
52043
+ if (this.isNeedSyncEmbed && this.embedDataService) {
52044
+ const tempContext = this.context.clone();
52045
+ tempContext.srfappid = this.model.appId;
52046
+ const originData = this.form.state.data.$origin;
52047
+ const res = await this.embedDataService.getTemp(tempContext);
52048
+ const syncAction = res.data ? "updateTemp" : "createTemp";
52049
+ await this.embedDataService[syncAction](tempContext, originData);
52050
+ }
52051
+ }
52052
+ /**
52053
+ * @description 同步子界面数据至表单
52054
+ * @returns {*} {Promise<void>}
52055
+ * @memberof FormDRUIPartController
52056
+ */
52057
+ async SyncEmbedDataToForm() {
52058
+ if (this.isNeedSyncEmbed && this.embedDataService) {
52059
+ const tempContext = this.context.clone();
52060
+ tempContext.srfappid = this.model.appId;
52061
+ const res = await this.embedDataService.getTemp(tempContext);
52062
+ const childData = res.data || {};
52063
+ const exData = this.form.state.data.srfexdata || {};
52064
+ this.form.state.data.srfexdata = Object.assign(exData, childData);
52065
+ }
52066
+ }
52067
+ /**
52068
+ * @description 保存嵌入视图数据
52069
+ * @returns {*} {Promise<void>}
52070
+ * @memberof FormDRUIPartController
52071
+ */
52072
+ async saveEmbedViewData() {
52073
+ var _a3;
52074
+ if (this.isNeedSyncEmbed && this.embedView) {
52075
+ await ((_a3 = this.embedView) == null ? void 0 : _a3.call("Save" /* SAVE */));
52076
+ }
52077
+ }
51993
52078
  };
51994
52079
 
51995
52080
  // src/controller/control/form/form-detail/form-group-panel/form-group-panel.controller.ts
@@ -68241,6 +68326,43 @@ import {
68241
68326
  } from "@ibiz-template/core";
68242
68327
  import qs4 from "qs";
68243
68328
  var FileUtil = class {
68329
+ constructor() {
68330
+ /**
68331
+ * @description 自定义文件上传请求头数据
68332
+ * @protected
68333
+ * @type {Record<string, string>}
68334
+ * @memberof FileUtil
68335
+ */
68336
+ this.customUploadHeaders = {};
68337
+ }
68338
+ /**
68339
+ * @description 设置文件上传请求头数据
68340
+ * @param {Record<string, string>} args
68341
+ * @memberof FileUtil
68342
+ */
68343
+ setUploadHeaders(args) {
68344
+ Object.assign(this.customUploadHeaders, args);
68345
+ }
68346
+ /**
68347
+ * @description 获取文件上传请求头数据
68348
+ * @returns {*} {Record<string, string>}
68349
+ * @memberof IApiFileUtil
68350
+ */
68351
+ getUploadHeaders() {
68352
+ const uploadHeaders = {};
68353
+ const token = getAppCookie2(CoreConst3.TOKEN);
68354
+ if (token) {
68355
+ Object.assign(uploadHeaders, {
68356
+ ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(token)
68357
+ });
68358
+ }
68359
+ if (this.customUploadHeaders && Object.keys(this.customUploadHeaders).length > 0) {
68360
+ Object.assign(uploadHeaders, {
68361
+ ...this.customUploadHeaders
68362
+ });
68363
+ }
68364
+ return uploadHeaders;
68365
+ }
68244
68366
  /**
68245
68367
  * @description 计算OSSCat参数
68246
68368
  * @protected
@@ -68259,9 +68381,7 @@ var FileUtil = class {
68259
68381
  return uploadUrl;
68260
68382
  }
68261
68383
  /**
68262
- * @description 计算文件的上传路径和下载路径
68263
- * 下载路径文件id用%fileId%占位,替换即可
68264
- * 配置编辑器参数uploadParams和exportParams时,会像导航参数一样动态添加对应的参数到url上
68384
+ * @description 计算文件的上传路径和下载路径,下载路径文件id用%fileId%占位,替换即可;配置编辑器参数uploadParams和exportParams时,会像导航参数一样动态添加对应的参数到url上
68265
68385
  * @param {IContext} context
68266
68386
  * @param {IParams} params
68267
68387
  * @param {IData} [data={}]
@@ -68379,17 +68499,16 @@ var FileUtil = class {
68379
68499
  * @memberof FileUtil
68380
68500
  */
68381
68501
  async chooseFileAndUpload(context, params, data, option = {}) {
68382
- const { accept, multiple, showUploadManager } = option;
68383
- const urls = ibiz.util.file.calcFileUpDownUrl(context, params, data);
68502
+ const { accept, multiple, showUploadManager, extraParams } = option;
68503
+ const urls = ibiz.util.file.calcFileUpDownUrl(
68504
+ context,
68505
+ params,
68506
+ data,
68507
+ extraParams
68508
+ );
68384
68509
  const files = await ibiz.util.file.chooseFile(accept, multiple);
68385
68510
  let promises = [];
68386
- const headers = {};
68387
- const token = getAppCookie2(CoreConst3.TOKEN);
68388
- if (token) {
68389
- Object.assign(headers, {
68390
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(token)
68391
- });
68392
- }
68511
+ const headers = this.getUploadHeaders();
68393
68512
  if (showUploadManager) {
68394
68513
  promises = await ibiz.notification.uploadManager({
68395
68514
  uploadUrl: urls.uploadUrl,
@@ -76520,13 +76639,19 @@ var MDViewEngine = class extends ViewEngineBase {
76520
76639
  ibiz.i18n.t("runtime.engine.logicOpendata")
76521
76640
  );
76522
76641
  } else {
76642
+ if (result.ok && result.data && result.data.length > 0) {
76643
+ this.view.evt.emit("onDataChange", {
76644
+ data: result.data,
76645
+ actionType: "EDIT"
76646
+ });
76647
+ }
76523
76648
  return {
76524
76649
  cancel: result ? !result.ok : true
76525
76650
  };
76526
76651
  }
76527
76652
  }
76528
76653
  /**
76529
- * 打开编辑数据视图
76654
+ * 打开新建数据视图
76530
76655
  *
76531
76656
  * @author lxm
76532
76657
  * @date 2022-09-01 18:09:19
@@ -76563,6 +76688,12 @@ var MDViewEngine = class extends ViewEngineBase {
76563
76688
  ibiz.i18n.t("runtime.engine.logicNewdata")
76564
76689
  );
76565
76690
  } else {
76691
+ if (result.ok && result.data && result.data.length > 0) {
76692
+ this.view.evt.emit("onDataChange", {
76693
+ data: result.data,
76694
+ actionType: "NEW"
76695
+ });
76696
+ }
76566
76697
  return {
76567
76698
  cancel: result ? !result.ok : true
76568
76699
  };
@@ -80143,6 +80274,7 @@ export {
80143
80274
  generateCacheKy,
80144
80275
  generateEditorRules,
80145
80276
  generateRules,
80277
+ generateYearWeekRange,
80146
80278
  getAcItemProvider,
80147
80279
  getAllItems,
80148
80280
  getAllPanelField,
@@ -80194,6 +80326,7 @@ export {
80194
80326
  getViewProvider,
80195
80327
  getWFContext,
80196
80328
  getWFSubmitViewId,
80329
+ getWeeksInYear,
80197
80330
  handleAllSettled,
80198
80331
  hasDeCodeName,
80199
80332
  hasSubRoute,