@ibiz-template/runtime 0.7.26-alpha.0 → 0.7.26-alpha.1

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.
package/dist/index.esm.js CHANGED
@@ -15461,8 +15461,9 @@ var Application = class {
15461
15461
  * @date 2022-12-22 15:12:26
15462
15462
  * @param {IApplication} model
15463
15463
  */
15464
- constructor(model) {
15464
+ constructor(model, subAppRef) {
15465
15465
  this.model = model;
15466
+ this.subAppRef = subAppRef;
15466
15467
  /**
15467
15468
  * 应用实体名称到应用实体代码名称的映射
15468
15469
  *
@@ -15496,7 +15497,7 @@ var Application = class {
15496
15497
  */
15497
15498
  this.appBIReportMap = /* @__PURE__ */ new Map();
15498
15499
  this.net = new Net({
15499
- baseURL: "".concat(ibiz.env.baseUrl, "/").concat(this.appId)
15500
+ baseURL: "".concat(ibiz.env.baseUrl, "/").concat(subAppRef && subAppRef.serviceId ? subAppRef.serviceId : this.appId)
15500
15501
  });
15501
15502
  this.configCache = new ConfigService(
15502
15503
  this.appId,
@@ -20343,6 +20344,20 @@ var BaseSeriesGenerator = class {
20343
20344
  constructor(model, chartGenerator) {
20344
20345
  this.model = model;
20345
20346
  this.chartGenerator = chartGenerator;
20347
+ /**
20348
+ * 分类属性(小写)
20349
+ * @author lxm
20350
+ * @date 2023-06-09 02:44:57
20351
+ * @type {string}
20352
+ */
20353
+ this.catalogField = "";
20354
+ /**
20355
+ * 分类属性(小写)数组,用于构建多维度分层
20356
+ *
20357
+ * @type {string[]}
20358
+ * @memberof BaseSeriesGenerator
20359
+ */
20360
+ this.catalogFields = [];
20346
20361
  /**
20347
20362
  * 根据分组处理出来的图表数据数组
20348
20363
  * @author lxm
@@ -20364,6 +20379,7 @@ var BaseSeriesGenerator = class {
20364
20379
  * @type {boolean}
20365
20380
  */
20366
20381
  this.autoCompleteCategory = true;
20382
+ var _a;
20367
20383
  this.model = model;
20368
20384
  this.chartGenerator = chartGenerator;
20369
20385
  const { chartSeriesEncode, caption, id, userParam } = model;
@@ -20379,6 +20395,18 @@ var BaseSeriesGenerator = class {
20379
20395
  ibiz.i18n.t("runtime.controller.control.chart.missingValue")
20380
20396
  );
20381
20397
  }
20398
+ if (chartGenerator.model.controlParam && ((_a = chartGenerator.model.controlParam.ctrlParams) == null ? void 0 : _a.CATALOGFIELDS)) {
20399
+ try {
20400
+ const tempCatalogFields = JSON.parse(
20401
+ chartGenerator.model.controlParam.ctrlParams.CATALOGFIELDS
20402
+ );
20403
+ if (Array.isArray(tempCatalogFields)) {
20404
+ this.catalogFields = tempCatalogFields;
20405
+ }
20406
+ } catch (e) {
20407
+ throw new Error(ibiz.i18n.t("runtime.control.chart.errorJson"));
20408
+ }
20409
+ }
20382
20410
  this.catalogField = chartGenerator.getFieldKey(model.catalogField);
20383
20411
  this.valueField = chartGenerator.getFieldKey(model.valueField);
20384
20412
  this.groupField = model.seriesField ? chartGenerator.getFieldKey(model.seriesField) : void 0;
@@ -20463,6 +20491,42 @@ var BaseSeriesGenerator = class {
20463
20491
  groupData[group].get(catalog).chartData = tempChartData;
20464
20492
  (_a = this.chartDataArr) == null ? void 0 : _a.push(tempChartData);
20465
20493
  }
20494
+ /**
20495
+ * 处理多分类分组
20496
+ *
20497
+ * @param {IData[]} prevItems
20498
+ * @param {IData[]} nextItems
20499
+ * @return {*}
20500
+ * @memberof BaseSeriesGenerator
20501
+ */
20502
+ handleMultiCatalogGroup(prevItems, nextItems) {
20503
+ let tempItems = [];
20504
+ if (prevItems.length === 0) {
20505
+ tempItems = nextItems.map((item) => {
20506
+ return {
20507
+ text: item.text,
20508
+ value: item.value
20509
+ };
20510
+ });
20511
+ } else {
20512
+ for (let prev = 0; prev < prevItems.length; prev++) {
20513
+ if (nextItems.length > 0) {
20514
+ for (let next = 0; next < nextItems.length; next++) {
20515
+ tempItems.push({
20516
+ text: "".concat(prevItems[prev].text, "_").concat(nextItems[next].text),
20517
+ value: nextItems[next].value
20518
+ });
20519
+ }
20520
+ } else {
20521
+ tempItems.push({
20522
+ text: prevItems[prev].text,
20523
+ value: prevItems[prev].value
20524
+ });
20525
+ }
20526
+ }
20527
+ }
20528
+ return tempItems;
20529
+ }
20466
20530
  /**
20467
20531
  * 计算分组数据
20468
20532
  * @author lxm
@@ -20489,7 +20553,35 @@ var BaseSeriesGenerator = class {
20489
20553
  }
20490
20554
  if (!groupData[group]) {
20491
20555
  groupData[group] = /* @__PURE__ */ new Map();
20492
- if (catalogCodeListId && this.autoCompleteCategory) {
20556
+ if (this.catalogFields.length > 0) {
20557
+ let tempCodes = [];
20558
+ const tempCodeLists = [];
20559
+ this.catalogFields.forEach((catalog2) => {
20560
+ const { codelistId } = catalog2;
20561
+ if (codelistId && this.autoCompleteCategory) {
20562
+ const codeListItems = this.chartGenerator.codeListMap.get(codelistId);
20563
+ tempCodeLists.push(clone21(codeListItems));
20564
+ }
20565
+ });
20566
+ for (let i = 0; i < tempCodeLists.length; i++) {
20567
+ tempCodes = this.handleMultiCatalogGroup(
20568
+ tempCodes,
20569
+ tempCodeLists[i]
20570
+ );
20571
+ }
20572
+ tempCodes.forEach((x) => {
20573
+ groupData[group].set(x.text, { value: 0 });
20574
+ this.prepareChartData(
20575
+ groupData,
20576
+ {
20577
+ [this.valueField]: 0,
20578
+ [this.catalogField]: x.value
20579
+ },
20580
+ x.text,
20581
+ group
20582
+ );
20583
+ });
20584
+ } else if (catalogCodeListId && this.autoCompleteCategory) {
20493
20585
  const codeListItems = this.chartGenerator.codeListMap.get(catalogCodeListId);
20494
20586
  codeListItems.forEach((x) => {
20495
20587
  groupData[group].set(x.text, { value: 0 });
@@ -20505,11 +20597,31 @@ var BaseSeriesGenerator = class {
20505
20597
  });
20506
20598
  }
20507
20599
  }
20508
- const catalog = this.translateVal(
20509
- catalogCodeListId,
20510
- item[this.catalogField],
20511
- true
20512
- );
20600
+ let catalog = "";
20601
+ if (this.catalogFields.length > 0) {
20602
+ const tempCatalog = [];
20603
+ this.catalogFields.forEach((_catalog) => {
20604
+ const mergeCatalog = this.translateVal(
20605
+ _catalog.codelistId,
20606
+ item[_catalog.codename],
20607
+ true
20608
+ );
20609
+ if (!mergeCatalog) {
20610
+ return;
20611
+ }
20612
+ tempCatalog.push(mergeCatalog);
20613
+ });
20614
+ if (tempCatalog.length !== this.catalogFields.length) {
20615
+ return;
20616
+ }
20617
+ catalog = tempCatalog.join("_");
20618
+ } else {
20619
+ catalog = this.translateVal(
20620
+ catalogCodeListId,
20621
+ item[this.catalogField],
20622
+ true
20623
+ );
20624
+ }
20513
20625
  if (!catalog) {
20514
20626
  return;
20515
20627
  }
@@ -20525,7 +20637,10 @@ var BaseSeriesGenerator = class {
20525
20637
  } else {
20526
20638
  this.prepareChartData(
20527
20639
  groupData,
20528
- { ...item, [this.valueField]: groupData[group].get(catalog).value },
20640
+ {
20641
+ ...item,
20642
+ [this.valueField]: groupData[group].get(catalog).value
20643
+ },
20529
20644
  catalog,
20530
20645
  group
20531
20646
  );
@@ -21255,6 +21370,140 @@ var ChartOptionsGenerator2 = class {
21255
21370
  });
21256
21371
  return AxisOption;
21257
21372
  }
21373
+ /**
21374
+ * 初始化多分类的X轴配置
21375
+ *
21376
+ * @return {*} {Promise<void>}
21377
+ * @memberof ChartOptionsGenerator
21378
+ */
21379
+ async initMultiCatalogxAxis(context, params) {
21380
+ var _a, _b, _c, _d, _e;
21381
+ const { controlParam } = this.model;
21382
+ if (controlParam && ((_a = controlParam.ctrlParams) == null ? void 0 : _a.CATALOGFIELDS)) {
21383
+ try {
21384
+ const tempCatalogFields = JSON.parse(
21385
+ controlParam.ctrlParams.CATALOGFIELDS
21386
+ );
21387
+ const tempaxis = [];
21388
+ let titleshow = true;
21389
+ let labelshoww = true;
21390
+ let gridIndex = 0;
21391
+ if (Array.isArray(tempCatalogFields)) {
21392
+ const app = ibiz.hub.getApp(context.srfappid);
21393
+ if (this.chartUserParam && this.chartUserParam.xAxis) {
21394
+ if (Array.isArray(this.chartUserParam.xAxis)) {
21395
+ const tempconfig = this.chartUserParam.xAxis[this.chartUserParam.xAxis.length - 1];
21396
+ titleshow = tempconfig.name === void 0 ? true : !!tempconfig.name;
21397
+ labelshoww = ((_b = tempconfig.axisLabel) == null ? void 0 : _b.show) === void 0 ? true : (_c = tempconfig.axisLabel) == null ? void 0 : _c.show;
21398
+ } else {
21399
+ titleshow = this.chartUserParam.xAxis.name === void 0 ? true : !!this.chartUserParam.xAxis.name;
21400
+ labelshoww = ((_d = this.chartUserParam.xAxis.axisLabel) == null ? void 0 : _d.show) === void 0 ? true : (_e = this.chartUserParam.xAxis.axisLabel) == null ? void 0 : _e.show;
21401
+ }
21402
+ }
21403
+ if (this.chartUserParam && this.chartUserParam.grid && Array.isArray(this.chartUserParam.grid)) {
21404
+ gridIndex = this.chartUserParam.grid.length - 1;
21405
+ }
21406
+ await Promise.all(
21407
+ tempCatalogFields.slice(0, -1).map(async (catalog, index) => {
21408
+ if (catalog.mode === "codelist" && catalog.codelistId) {
21409
+ const codeListItems = await app.codeList.get(
21410
+ catalog.codelistId,
21411
+ context,
21412
+ params
21413
+ );
21414
+ if (codeListItems) {
21415
+ const tempxAxisData = [];
21416
+ const xAxisData = codeListItems.map((code) => {
21417
+ return {
21418
+ value: code.text,
21419
+ textStyle: {
21420
+ lineHeight: 45 * (tempCatalogFields.length - 1 - index)
21421
+ }
21422
+ };
21423
+ });
21424
+ if (index === 0) {
21425
+ tempaxis.push({
21426
+ show: labelshoww,
21427
+ gridIndex,
21428
+ type: "category",
21429
+ data: xAxisData,
21430
+ position: "bottom"
21431
+ });
21432
+ } else {
21433
+ let length = 1;
21434
+ for (let i = 0; i < tempaxis.length; i++) {
21435
+ length *= tempaxis[i].data.length;
21436
+ }
21437
+ for (let i = 0; i < length; i++) {
21438
+ tempxAxisData.push(...xAxisData);
21439
+ }
21440
+ tempaxis.push({
21441
+ show: labelshoww,
21442
+ gridIndex,
21443
+ type: "category",
21444
+ data: tempxAxisData,
21445
+ position: "bottom"
21446
+ });
21447
+ }
21448
+ }
21449
+ }
21450
+ })
21451
+ );
21452
+ const mergeName = tempCatalogFields.map((catalog) => {
21453
+ return catalog.name;
21454
+ }).join("/");
21455
+ tempaxis.push({
21456
+ type: "category",
21457
+ gridIndex,
21458
+ show: titleshow,
21459
+ data: [
21460
+ {
21461
+ value: mergeName,
21462
+ textStyle: {
21463
+ lineHeight: labelshoww ? 45 * tempCatalogFields.length : 45
21464
+ }
21465
+ }
21466
+ ],
21467
+ position: "bottom"
21468
+ });
21469
+ if (this.chartUserParam) {
21470
+ if (this.chartUserParam.xAxis && Array.isArray(this.chartUserParam.xAxis)) {
21471
+ this.chartUserParam.xAxis = [
21472
+ ...this.chartUserParam.xAxis,
21473
+ ...tempaxis
21474
+ ];
21475
+ } else if (this.chartUserParam.xAxis) {
21476
+ this.chartUserParam.xAxis = [
21477
+ this.chartUserParam.xAxis,
21478
+ ...tempaxis
21479
+ ];
21480
+ }
21481
+ if (!this.chartUserParam.grid) {
21482
+ this.chartUserParam.grid = {};
21483
+ }
21484
+ let { length } = tempCatalogFields;
21485
+ if (!labelshoww) {
21486
+ length = 1;
21487
+ }
21488
+ if (!titleshow) {
21489
+ length -= 1;
21490
+ }
21491
+ if (length === 0) {
21492
+ Object.assign(this.chartUserParam.grid, {
21493
+ bottom: 45
21494
+ });
21495
+ } else {
21496
+ Object.assign(this.chartUserParam.grid, {
21497
+ bottom: (length > 2 ? length - 1 : length) * 45
21498
+ });
21499
+ }
21500
+ }
21501
+ }
21502
+ } catch (e) {
21503
+ throw new Error(ibiz.i18n.t("runtime.control.chart.errorJson"));
21504
+ }
21505
+ }
21506
+ }
21258
21507
  /**
21259
21508
  * 初始化
21260
21509
  * @author lxm
@@ -21265,6 +21514,7 @@ var ChartOptionsGenerator2 = class {
21265
21514
  */
21266
21515
  async init(context, params) {
21267
21516
  await this.loadCodeList(context, params);
21517
+ await this.initMultiCatalogxAxis(context, params);
21268
21518
  this.entity = await ibiz.hub.getAppDataEntity(
21269
21519
  this.model.appDataEntityId,
21270
21520
  this.model.appId
@@ -21293,7 +21543,7 @@ var ChartOptionsGenerator2 = class {
21293
21543
  * @return {*} {Promise<void>}
21294
21544
  */
21295
21545
  async loadCodeList(context, params) {
21296
- var _a;
21546
+ var _a, _b, _c;
21297
21547
  this.codeListMap.clear();
21298
21548
  if (!((_a = this.model.dechartSerieses) == null ? void 0 : _a.length)) {
21299
21549
  return;
@@ -21306,11 +21556,29 @@ var ChartOptionsGenerator2 = class {
21306
21556
  const codeListItems = await app.codeList.get(key, context, params);
21307
21557
  this.codeListMap.set(key, codeListItems);
21308
21558
  };
21559
+ if ((_c = (_b = this.model.controlParam) == null ? void 0 : _b.ctrlParams) == null ? void 0 : _c.CATALOGFIELDS) {
21560
+ try {
21561
+ const tempCatalogFields = JSON.parse(
21562
+ this.model.controlParam.ctrlParams.CATALOGFIELDS
21563
+ );
21564
+ if (Array.isArray(tempCatalogFields)) {
21565
+ await Promise.all(
21566
+ tempCatalogFields.map(async (catalog) => {
21567
+ if (catalog.mode === "codelist") {
21568
+ await loadCodeList(catalog.codelistId);
21569
+ }
21570
+ })
21571
+ );
21572
+ }
21573
+ } catch (e) {
21574
+ throw new Error(ibiz.i18n.t("runtime.control.chart.errorJson"));
21575
+ }
21576
+ }
21309
21577
  await Promise.all(
21310
21578
  this.model.dechartSerieses.map(async (series) => {
21311
21579
  const { seriesCodeListId, catalogCodeListId } = series;
21312
- await loadCodeList(seriesCodeListId);
21313
21580
  await loadCodeList(catalogCodeListId);
21581
+ await loadCodeList(seriesCodeListId);
21314
21582
  })
21315
21583
  );
21316
21584
  }
@@ -37541,41 +37809,6 @@ var KanbanController = class extends DataViewControlController {
37541
37809
  }
37542
37810
  return super.handleDataGroup();
37543
37811
  }
37544
- /**
37545
- * 处理自动分组
37546
- *
37547
- * @memberof KanbanController
37548
- */
37549
- handleAutoGroup() {
37550
- const { groupAppDEFieldId } = this.model;
37551
- if (groupAppDEFieldId) {
37552
- const { items } = this.state;
37553
- const groupMap = /* @__PURE__ */ new Map();
37554
- items.forEach((item) => {
37555
- const groupVal = item[groupAppDEFieldId];
37556
- if (isNil33(groupVal)) {
37557
- return;
37558
- }
37559
- if (!groupMap.has(groupVal)) {
37560
- groupMap.set(groupVal, []);
37561
- }
37562
- groupMap.get(groupVal).push(item);
37563
- });
37564
- const groups = [];
37565
- groupMap.forEach((value, key) => {
37566
- const codeListItem = this.groupCodeListItems.find(
37567
- (item) => item.value === key
37568
- );
37569
- groups.push({
37570
- caption: codeListItem.text,
37571
- color: codeListItem.color,
37572
- key: codeListItem.value,
37573
- children: [...value]
37574
- });
37575
- });
37576
- this.state.groups = groups;
37577
- }
37578
- }
37579
37812
  /**
37580
37813
  * 处理代码表分组
37581
37814
  *
@@ -37658,7 +37891,7 @@ var KanbanController = class extends DataViewControlController {
37658
37891
  );
37659
37892
  }
37660
37893
  this.state.updating = true;
37661
- const computeMoveData = (_fromIndex, _toIndex, _draggedItem, targetArray) => {
37894
+ const computeMoveData = (_fromIndex, _toIndex, _draggedItem, targetArray, isCrossGroup) => {
37662
37895
  let moveData = {};
37663
37896
  const targetItem = targetArray[_toIndex];
37664
37897
  if (!targetItem) {
@@ -37687,7 +37920,7 @@ var KanbanController = class extends DataViewControlController {
37687
37920
  } else {
37688
37921
  moveData = {
37689
37922
  srftargetkey: targetItem.srfkey,
37690
- srfmovetype: _fromIndex > _toIndex ? "MOVEBEFORE" : "MOVEAFTER"
37923
+ srfmovetype: _toIndex < targetArray.length - 1 ? "MOVEBEFORE" : isCrossGroup ? "MOVEBEFORE" : "MOVEAFTER"
37691
37924
  };
37692
37925
  }
37693
37926
  return moveData;
@@ -37722,7 +37955,13 @@ var KanbanController = class extends DataViewControlController {
37722
37955
  );
37723
37956
  }
37724
37957
  }
37725
- const params = computeMoveData(fromIndex, toIndex, draggedItem, originArr);
37958
+ const params = computeMoveData(
37959
+ fromIndex,
37960
+ toIndex,
37961
+ draggedItem,
37962
+ originArr,
37963
+ info.from !== info.to
37964
+ );
37726
37965
  try {
37727
37966
  const { ok, result } = await this.moveOrderItem(draggedItem, params);
37728
37967
  if (ok) {
@@ -41728,7 +41967,8 @@ var AppHub = class {
41728
41967
  throw new RuntimeError68(ibiz.i18n.t("runtime.utils.firstregister"));
41729
41968
  }
41730
41969
  const appModel = await this.modelLoaderProvider.getApp(id);
41731
- const app = new Application(appModel);
41970
+ const subAppRef = await this.modelLoaderProvider.getSubAppRef(id);
41971
+ const app = new Application(appModel, subAppRef);
41732
41972
  this.appMap.set(id, app);
41733
41973
  await this.modelLoaderProvider.initApp(id);
41734
41974
  await app.init();
@@ -44165,7 +44405,10 @@ var en = {
44165
44405
  noSupportSequence: "Charts do not support sequence types at this time {seriesType}",
44166
44406
  noFindSequence: "Cannot find generator for {seriesIndex} sequence!",
44167
44407
  noInitialised: "The chart object is not properly initialised",
44168
- noCalculated: "Options have not been calculated."
44408
+ noCalculated: "Options have not been calculated.",
44409
+ classificationNotArray: "The configured classification attribute value is not an array",
44410
+ classificationNotString: "The configured classification attribute value is not an string",
44411
+ errorJson: "JSON parsing error"
44169
44412
  },
44170
44413
  dataView: {
44171
44414
  noBehaviourGroup: "No interface behaviour group is configured for the action",
@@ -44747,7 +44990,10 @@ var zhCn = {
44747
44990
  noSupportSequence: "\u56FE\u8868\u6682\u672A\u652F\u6301\u5E8F\u5217\u7C7B\u578B{seriesType}",
44748
44991
  noFindSequence: "\u627E\u4E0D\u5230{seriesIndex}\u5E8F\u5217\u7684generator\uFF01",
44749
44992
  noInitialised: "chart\u5BF9\u8C61\u6CA1\u6709\u6B63\u786E\u521D\u59CB\u5316",
44750
- noCalculated: "options\u8FD8\u6CA1\u8BA1\u7B97"
44993
+ noCalculated: "options\u8FD8\u6CA1\u8BA1\u7B97",
44994
+ classificationNotArray: "\u914D\u7F6E\u7684\u5206\u7C7B\u5C5E\u6027\u503C\u4E0D\u662F\u4E00\u4E2A\u6570\u7EC4",
44995
+ classificationNotString: "\u914D\u7F6E\u7684\u5206\u7C7B\u5C5E\u6027\u503C\u4E0D\u662F\u4E00\u4E2A\u5B57\u7B26\u4E32",
44996
+ errorJson: "JSON\u89E3\u6790\u9519\u8BEF"
44751
44997
  },
44752
44998
  dataView: {
44753
44999
  noBehaviourGroup: "\u64CD\u4F5C\u9879\u6CA1\u6709\u914D\u7F6E\u754C\u9762\u884C\u4E3A\u7EC4",