@ibiz-template/runtime 0.5.1 → 0.5.3-beta.0

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 (39) hide show
  1. package/dist/index.esm.js +198 -152
  2. package/dist/index.system.min.js +1 -1
  3. package/out/app-hub.d.ts +11 -0
  4. package/out/app-hub.d.ts.map +1 -1
  5. package/out/app-hub.js +17 -0
  6. package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
  7. package/out/controller/control/form/edit-form/edit-form.controller.js +0 -1
  8. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.d.ts +0 -9
  9. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.d.ts.map +1 -1
  10. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.js +0 -20
  11. package/out/controller/control/tree-grid-ex/tree-grid-ex-row.state.d.ts.map +1 -1
  12. package/out/controller/control/tree-grid-ex/tree-grid-ex-row.state.js +0 -4
  13. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +11 -0
  14. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
  15. package/out/interface/provider/model-loader.provider.d.ts +11 -0
  16. package/out/interface/provider/model-loader.provider.d.ts.map +1 -1
  17. package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts +2 -2
  18. package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts.map +1 -1
  19. package/out/logic-scheduler/executor/app-ui-logic-executor.js +26 -32
  20. package/out/service/dto/method.dto.d.ts.map +1 -1
  21. package/out/service/dto/method.dto.js +6 -4
  22. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  23. package/out/service/service/entity/method/de-action.js +9 -7
  24. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
  25. package/out/service/vo/tree-node-data/tree-data-set-node-data.js +33 -8
  26. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
  27. package/out/utils/open-redirect-view/open-redirect-view.js +70 -35
  28. package/package.json +3 -3
  29. package/src/app-hub.ts +26 -0
  30. package/src/controller/control/form/edit-form/edit-form.controller.ts +0 -2
  31. package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.ts +2 -35
  32. package/src/controller/control/tree-grid-ex/tree-grid-ex-row.state.ts +0 -4
  33. package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +16 -0
  34. package/src/interface/provider/model-loader.provider.ts +16 -0
  35. package/src/logic-scheduler/executor/app-ui-logic-executor.ts +42 -32
  36. package/src/service/dto/method.dto.ts +6 -4
  37. package/src/service/service/entity/method/de-action.ts +9 -7
  38. package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +32 -7
  39. package/src/utils/open-redirect-view/open-redirect-view.ts +76 -43
package/dist/index.esm.js CHANGED
@@ -1239,46 +1239,73 @@ async function getDERedirectToView(appView, context, params = {}, opts = {}) {
1239
1239
  }
1240
1240
  const entity = await ibiz.hub.getAppDataEntity(entityId, appView.appId);
1241
1241
  const rdTag = await calcDERdTag(entity, appView, params, curData);
1242
- const rdTagItems = rdTag.split(":");
1243
- const wfRdTag = rdTagItems.length === 2 ? rdTag : rdTagItems.slice(0, 2).join(":");
1244
- const deRdTag = "".concat(entity.name.toUpperCase(), ":").concat(rdTag);
1245
- const allRefViews = [];
1246
- if (appView.redirectAppViewRefs) {
1247
- allRefViews.push(...appView.redirectAppViewRefs);
1248
- }
1249
- if (appView.appViewRefs) {
1250
- allRefViews.push(...appView.appViewRefs);
1251
- }
1252
- const refView = allRefViews.find((view) => {
1253
- const matchKey = view.name || view.id;
1254
- return matchKey === deRdTag || matchKey === rdTag || matchKey === wfRdTag;
1255
- });
1256
- if (refView) {
1257
- const viewId = refView.refAppViewId;
1258
- if (viewId) {
1259
- return {
1260
- type: "view",
1261
- viewId,
1262
- context,
1263
- params,
1264
- opts: { ...opts, data: [curData] }
1265
- };
1242
+ let viewId = "";
1243
+ if (rdTag.startsWith("view://")) {
1244
+ const url = new URL(rdTag);
1245
+ if (url.searchParams.size > 0) {
1246
+ url.searchParams.forEach((value, _key) => {
1247
+ params[_key] = value;
1248
+ });
1249
+ }
1250
+ const rdTagItems = url.pathname.replace("//", "").split("/");
1251
+ const [appOrViewTag, viewTag] = rdTagItems;
1252
+ if (viewTag) {
1253
+ viewId = viewTag;
1254
+ } else {
1255
+ viewId = appOrViewTag;
1266
1256
  }
1267
- throw new RuntimeModelError3(refView, "\u672A\u914D\u7F6E\u5B9E\u9645\u5F15\u7528\u89C6\u56FE");
1268
1257
  } else {
1269
- ibiz.log.error(
1270
- "\u91CD\u5B9A\u5411\u89C6\u56FE\u5F15\u7528\u6709\uFF1A",
1271
- allRefViews == null ? void 0 : allRefViews.map(({ refAppViewId, name, realTitle }) => ({
1272
- viewId: refAppViewId,
1273
- tag: name,
1274
- title: realTitle
1275
- }))
1276
- );
1277
- throw new RuntimeModelError3(
1278
- appView,
1279
- "\u672A\u627E\u5230\u91CD\u5B9A\u5411\u6807\u8BC6[".concat(rdTag, "]\u6216[").concat(deRdTag, "]\u6216\u5DE5\u4F5C\u6D41[").concat(wfRdTag, "]\u5BF9\u5E94\u89C6\u56FE")
1280
- );
1258
+ const rdTagItems = rdTag.split(":");
1259
+ const wfRdTag = rdTagItems.length === 2 ? rdTag : rdTagItems.slice(0, 2).join(":");
1260
+ const deRdTag = "".concat(entity.name.toUpperCase(), ":").concat(rdTag);
1261
+ const allRefViews = [];
1262
+ if (appView.redirectAppViewRefs) {
1263
+ allRefViews.push(...appView.redirectAppViewRefs);
1264
+ }
1265
+ if (appView.appViewRefs) {
1266
+ allRefViews.push(...appView.appViewRefs);
1267
+ }
1268
+ const refView = allRefViews.find((view) => {
1269
+ const matchKey = view.name || view.id;
1270
+ return matchKey === deRdTag || matchKey === rdTag || matchKey === wfRdTag;
1271
+ });
1272
+ if (refView) {
1273
+ viewId = refView.refAppViewId;
1274
+ if (viewId) {
1275
+ return {
1276
+ type: "view",
1277
+ viewId,
1278
+ context,
1279
+ params,
1280
+ opts: { ...opts, data: [curData] }
1281
+ };
1282
+ }
1283
+ throw new RuntimeModelError3(refView, "\u672A\u914D\u7F6E\u5B9E\u9645\u5F15\u7528\u89C6\u56FE");
1284
+ } else {
1285
+ ibiz.log.error(
1286
+ "\u91CD\u5B9A\u5411\u89C6\u56FE\u5F15\u7528\u6709\uFF1A",
1287
+ allRefViews == null ? void 0 : allRefViews.map(({ refAppViewId, name, realTitle }) => ({
1288
+ viewId: refAppViewId,
1289
+ tag: name,
1290
+ title: realTitle
1291
+ }))
1292
+ );
1293
+ throw new RuntimeModelError3(
1294
+ appView,
1295
+ "\u672A\u627E\u5230\u91CD\u5B9A\u5411\u6807\u8BC6[".concat(rdTag, "]\u6216[").concat(deRdTag, "]\u6216\u5DE5\u4F5C\u6D41[").concat(wfRdTag, "]\u5BF9\u5E94\u89C6\u56FE")
1296
+ );
1297
+ }
1281
1298
  }
1299
+ if (viewId) {
1300
+ return {
1301
+ type: "view",
1302
+ viewId,
1303
+ context,
1304
+ params,
1305
+ opts: { ...opts, data: [curData] }
1306
+ };
1307
+ }
1308
+ throw new RuntimeModelError3(appView, "\u6807\u8BC6[".concat(rdTag, "]\u672A\u5339\u914D\u5230\u5B9E\u9645\u5F15\u7528\u89C6\u56FE"));
1282
1309
  }
1283
1310
  async function openDERedirectView(appView, context, params = {}, opts = {}) {
1284
1311
  let toView;
@@ -1315,6 +1342,9 @@ async function calcDERdTag(entity, rdView, params, data) {
1315
1342
  const { codeName } = findFieldById(entity, typeFieldId);
1316
1343
  const value = data[codeName.toLowerCase()];
1317
1344
  if (notNilEmpty3(value)) {
1345
+ if (value.startsWith("view://")) {
1346
+ return value;
1347
+ }
1318
1348
  return "".concat(value.toUpperCase());
1319
1349
  }
1320
1350
  ibiz.log.warn(
@@ -7215,9 +7245,11 @@ var MethodDto = class _MethodDto {
7215
7245
  const items = datum[key];
7216
7246
  if (items) {
7217
7247
  const pKey = datum[this.entity.keyAppDEFieldId];
7218
- items.forEach((item) => {
7219
- item[field.refPickupAppDEFieldId] = pKey;
7220
- });
7248
+ if (field.refPickupAppDEFieldId) {
7249
+ items.forEach((item) => {
7250
+ item[field.refPickupAppDEFieldId] = pKey;
7251
+ });
7252
+ }
7221
7253
  await dto.sets(context, items);
7222
7254
  } else {
7223
7255
  await dto.sets(context, []);
@@ -8969,12 +9001,14 @@ var DEActionMethod = class extends Method {
8969
9001
  const configs = uiDomain.getDERConfig(this.entity.id);
8970
9002
  if (configs.length > 0) {
8971
9003
  configs.forEach((config) => {
8972
- const { majorDECodeName, pickupDEFName } = config;
8973
- const majorLowerCodeName = majorDECodeName.toLowerCase();
8974
- const pickupLowerDEFName = pickupDEFName.toLowerCase();
8975
- const majorkey = context[majorLowerCodeName];
8976
- if (majorkey && majorkey !== data.srfkey) {
8977
- data[pickupLowerDEFName] = majorkey;
9004
+ if (config.pickupDEFName) {
9005
+ const { majorDECodeName, pickupDEFName } = config;
9006
+ const majorLowerCodeName = majorDECodeName.toLowerCase();
9007
+ const pickupLowerDEFName = pickupDEFName.toLowerCase();
9008
+ const majorkey = context[majorLowerCodeName];
9009
+ if (majorkey && majorkey !== data.srfkey) {
9010
+ data[pickupLowerDEFName] = majorkey;
9011
+ }
8978
9012
  }
8979
9013
  });
8980
9014
  }
@@ -9215,9 +9249,10 @@ var TreeCodeListNodeData = class extends TreeNodeData {
9215
9249
 
9216
9250
  // src/service/vo/tree-node-data/tree-data-set-node-data.ts
9217
9251
  import { updateKeyDefine } from "@ibiz-template/core";
9252
+ import { isNil as isNil12 } from "ramda";
9218
9253
  var TreeDataSetNodeData = class extends TreeNodeData {
9219
9254
  constructor(model, parentNodeData, opts) {
9220
- var _a;
9255
+ var _a, _b;
9221
9256
  super(model, parentNodeData, opts);
9222
9257
  const { data } = opts;
9223
9258
  this._deData = data;
@@ -9245,21 +9280,32 @@ var TreeDataSetNodeData = class extends TreeNodeData {
9245
9280
  const dataItemKeyMap = /* @__PURE__ */ new Map();
9246
9281
  dataItemKeyMap.set("srfkey", "srfkey");
9247
9282
  dataItemKeyMap.set("srfmajortext", "srfmajortext");
9248
- const dataItemDefaults = {};
9249
9283
  (_a = model.detreeNodeDataItems) == null ? void 0 : _a.forEach((dataItem) => {
9250
9284
  const uiKey = dataItem.id.toLowerCase();
9251
9285
  const deFieldKey = dataItem.appDEFieldId.toLowerCase();
9252
9286
  dataItemKeyMap.set(uiKey, deFieldKey);
9253
- if (dataItem.defaultValue) {
9254
- dataItemDefaults[uiKey] = dataItem.defaultValue;
9287
+ if (dataItem.defaultValue && isNil12(data[deFieldKey])) {
9288
+ data[deFieldKey] = dataItem.defaultValue;
9289
+ }
9290
+ });
9291
+ const nodeColumnKeyMap = /* @__PURE__ */ new Map();
9292
+ (_b = model.detreeNodeColumns) == null ? void 0 : _b.forEach((column) => {
9293
+ const columnKey = column.detreeColumnId;
9294
+ const dataItemKey = column.dataItemName;
9295
+ if (!columnKey || !dataItemKey) {
9296
+ ibiz.log.error("\u6A21\u578B\u5F02\u5E38\u7F3A\u5C11detreeColumnId\u6216\u8005dataItemName", column);
9297
+ } else {
9298
+ nodeColumnKeyMap.set(columnKey, dataItemKeyMap.get(dataItemKey));
9255
9299
  }
9256
9300
  });
9257
9301
  return new Proxy(this, {
9258
9302
  set(target, p, value) {
9259
- if (Object.prototype.hasOwnProperty.call(target._deData, p)) {
9260
- target._deData[p] = value;
9303
+ if (nodeColumnKeyMap.has(p)) {
9304
+ target._deData[nodeColumnKeyMap.get(p)] = value;
9261
9305
  } else if (dataItemKeyMap.has(p)) {
9262
9306
  target._deData[dataItemKeyMap.get(p)] = value;
9307
+ } else if (Object.prototype.hasOwnProperty.call(target._deData, p)) {
9308
+ target._deData[p] = value;
9263
9309
  } else {
9264
9310
  target[p] = value;
9265
9311
  }
@@ -9269,8 +9315,11 @@ var TreeDataSetNodeData = class extends TreeNodeData {
9269
9315
  if (target[p] !== void 0) {
9270
9316
  return target[p];
9271
9317
  }
9318
+ if (nodeColumnKeyMap.has(p)) {
9319
+ return target._deData[nodeColumnKeyMap.get(p)];
9320
+ }
9272
9321
  if (dataItemKeyMap.has(p)) {
9273
- return target._deData[dataItemKeyMap.get(p)] || dataItemDefaults[p];
9322
+ return target._deData[dataItemKeyMap.get(p)];
9274
9323
  }
9275
9324
  if (target._deData[p] !== void 0) {
9276
9325
  return target._deData[p];
@@ -9376,7 +9425,7 @@ var TreeStaticNodeData = class extends TreeNodeData {
9376
9425
 
9377
9426
  // src/service/vo/ui-map-field.ts
9378
9427
  import { DataTypes as DataTypes2 } from "@ibiz-template/core";
9379
- import { isNil as isNil12 } from "ramda";
9428
+ import { isNil as isNil13 } from "ramda";
9380
9429
  var UIMapField = class {
9381
9430
  constructor(uiKey, dataKey, opts = {}) {
9382
9431
  /**
@@ -9397,10 +9446,10 @@ var UIMapField = class {
9397
9446
  this.isRequestNeed = true;
9398
9447
  this.uiKey = uiKey;
9399
9448
  this.dataKey = dataKey;
9400
- if (!isNil12(opts.isOriginField)) {
9449
+ if (!isNil13(opts.isOriginField)) {
9401
9450
  this.isOriginField = opts.isOriginField;
9402
9451
  }
9403
- if (!isNil12(opts.dataType)) {
9452
+ if (!isNil13(opts.dataType)) {
9404
9453
  this.dataType = opts.dataType;
9405
9454
  }
9406
9455
  }
@@ -9415,7 +9464,7 @@ var UIMapField = class {
9415
9464
  return value;
9416
9465
  }
9417
9466
  if (DataTypes2.isNumber(this.dataType)) {
9418
- const numVal = !isNil12(value) && value !== "" ? Number(value) : value;
9467
+ const numVal = !isNil13(value) && value !== "" ? Number(value) : value;
9419
9468
  if (Number.isNaN(numVal)) {
9420
9469
  ibiz.log.debug("".concat(value, "\u4E0D\u80FD\u8F6C\u6362\u6210\u6570\u5B57"));
9421
9470
  return value;
@@ -10619,7 +10668,7 @@ var PanelNotifyState = /* @__PURE__ */ ((PanelNotifyState2) => {
10619
10668
  // src/controller/common/view/view.controller.ts
10620
10669
  import { notNilEmpty as notNilEmpty6 } from "qx-util";
10621
10670
  import { IBizContext as IBizContext2, RuntimeError as RuntimeError32 } from "@ibiz-template/core";
10622
- import { isEmpty as isEmpty8, isNil as isNil18, isNotNil as isNotNil2 } from "ramda";
10671
+ import { isEmpty as isEmpty8, isNil as isNil19, isNotNil as isNotNil2 } from "ramda";
10623
10672
 
10624
10673
  // src/controller/utils/loading/loading.state.ts
10625
10674
  import { NOOP } from "@ibiz-template/core";
@@ -11251,9 +11300,9 @@ function hasSubRoute(routeDepth) {
11251
11300
  }
11252
11301
 
11253
11302
  // src/controller/utils/util/util.ts
11254
- import { isNil as isNil13 } from "ramda";
11303
+ import { isNil as isNil14 } from "ramda";
11255
11304
  function isValueChange(value, value2) {
11256
- if ((isNil13(value) || value === "") && (isNil13(value2) || value2 === "")) {
11305
+ if ((isNil14(value) || value === "") && (isNil14(value2) || value2 === "")) {
11257
11306
  return false;
11258
11307
  }
11259
11308
  return value !== value2;
@@ -11269,7 +11318,7 @@ function getOriginData(data) {
11269
11318
  // src/controller/utils/value-rule/value-rule.ts
11270
11319
  import { RuntimeError as RuntimeError27 } from "@ibiz-template/core";
11271
11320
  import { isNilOrEmpty as isNilOrEmpty7, isNumber } from "qx-util";
11272
- import { isNil as isNil14 } from "ramda";
11321
+ import { isNil as isNil15 } from "ramda";
11273
11322
  function generateRules(itemVRs, name, valueItemName) {
11274
11323
  const rules = [];
11275
11324
  itemVRs.forEach((item) => {
@@ -11334,7 +11383,7 @@ function generateEditorRules(editor) {
11334
11383
  if (maxLength) {
11335
11384
  rules.push({
11336
11385
  validator: (rule, value, callback) => {
11337
- if (!isNil14(value) && value.length > maxLength) {
11386
+ if (!isNil15(value) && value.length > maxLength) {
11338
11387
  callback(
11339
11388
  new Error(
11340
11389
  "\u5185\u5BB9\u957F\u5EA6\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E".concat(maxLength, ",\u5F53\u524D\u957F\u5EA6\u4E3A").concat(value.length)
@@ -11349,7 +11398,7 @@ function generateEditorRules(editor) {
11349
11398
  if (minLength) {
11350
11399
  rules.push({
11351
11400
  validator: (rule, value, callback) => {
11352
- if (!isNil14(value) && value.length < minLength) {
11401
+ if (!isNil15(value) && value.length < minLength) {
11353
11402
  callback(
11354
11403
  new Error(
11355
11404
  "\u5185\u5BB9\u957F\u5EA6\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E".concat(minLength, ",\u5F53\u524D\u957F\u5EA6\u4E3A").concat(value.length)
@@ -11361,10 +11410,10 @@ function generateEditorRules(editor) {
11361
11410
  }
11362
11411
  });
11363
11412
  }
11364
- if (!isNil14(maxValue)) {
11413
+ if (!isNil15(maxValue)) {
11365
11414
  rules.push({
11366
11415
  validator: (rule, value, callback) => {
11367
- if (!isNil14(value) && isNumber(value) && value > maxValue) {
11416
+ if (!isNil15(value) && isNumber(value) && value > maxValue) {
11368
11417
  callback(new Error("\u503C\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E".concat(maxValue)));
11369
11418
  } else {
11370
11419
  return true;
@@ -11372,10 +11421,10 @@ function generateEditorRules(editor) {
11372
11421
  }
11373
11422
  });
11374
11423
  }
11375
- if (!isNil14(minValue)) {
11424
+ if (!isNil15(minValue)) {
11376
11425
  rules.push({
11377
11426
  validator: (rule, value, callback) => {
11378
- if (!isNil14(value) && isNumber(value) && value < minValue) {
11427
+ if (!isNil15(value) && isNumber(value) && value < minValue) {
11379
11428
  callback(new Error("\u503C\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E".concat(minValue)));
11380
11429
  } else {
11381
11430
  return true;
@@ -11388,7 +11437,7 @@ function generateEditorRules(editor) {
11388
11437
 
11389
11438
  // src/controller/utils/value-ex/value-ex.ts
11390
11439
  import { RuntimeError as RuntimeError28 } from "@ibiz-template/core";
11391
- import { isNil as isNil15, mergeLeft } from "ramda";
11440
+ import { isNil as isNil16, mergeLeft } from "ramda";
11392
11441
  var ValueExUtil = class {
11393
11442
  /**
11394
11443
  * 合并默认值
@@ -11413,7 +11462,7 @@ var ValueExUtil = class {
11413
11462
  * @return {*} {string}
11414
11463
  */
11415
11464
  static toText(options, value) {
11416
- if (isNil15(value) || value === "") {
11465
+ if (isNil16(value) || value === "") {
11417
11466
  return "";
11418
11467
  }
11419
11468
  const { valueType, objectNameField, textSeparator } = this.mergeDefault(options);
@@ -11438,12 +11487,12 @@ var ValueExUtil = class {
11438
11487
  import { RuntimeError as RuntimeError29, ModelError as ModelError17 } from "@ibiz-template/core";
11439
11488
  import dayjs from "dayjs";
11440
11489
  import { createUUID as createUUID8 } from "qx-util";
11441
- import { isNil as isNil16, isNotNil } from "ramda";
11490
+ import { isNil as isNil17, isNotNil } from "ramda";
11442
11491
  function getDefaultValue(opts, origins) {
11443
11492
  var _a;
11444
11493
  const { name, valueType, defaultValue, valueFormat } = opts;
11445
11494
  const { data, context, params } = origins;
11446
- if (isNil16(valueType) && isNil16(defaultValue)) {
11495
+ if (isNil17(valueType) && isNil17(defaultValue)) {
11447
11496
  return;
11448
11497
  }
11449
11498
  if (valueType === "RESET") {
@@ -11794,7 +11843,7 @@ var BaseController = class {
11794
11843
 
11795
11844
  // src/controller/utils/view-msg/view-msg-controller.ts
11796
11845
  import { RuntimeError as RuntimeError31, RuntimeModelError as RuntimeModelError22 } from "@ibiz-template/core";
11797
- import { isNil as isNil17, mergeRight as mergeRight2 } from "ramda";
11846
+ import { isNil as isNil18, mergeRight as mergeRight2 } from "ramda";
11798
11847
  var ViewMsgController = class _ViewMsgController {
11799
11848
  constructor(msgGroupId) {
11800
11849
  this.msgGroupId = msgGroupId;
@@ -11979,19 +12028,19 @@ var ViewMsgController = class _ViewMsgController {
11979
12028
  const removeModeField = this.getDeFieldName(entity, removeFlagAppDEFieldId);
11980
12029
  const deViewMessages = dataSet.map((item) => {
11981
12030
  const message = {};
11982
- if (positionField && !isNil17(item[positionField])) {
12031
+ if (positionField && !isNil18(item[positionField])) {
11983
12032
  message.position = item[positionField];
11984
12033
  }
11985
- if (titleField && !isNil17(item[titleField])) {
12034
+ if (titleField && !isNil18(item[titleField])) {
11986
12035
  message.title = item[titleField];
11987
12036
  }
11988
- if (messageField && !isNil17(item[messageField])) {
12037
+ if (messageField && !isNil18(item[messageField])) {
11989
12038
  message.message = item[messageField];
11990
12039
  }
11991
- if (typeField && !isNil17(item[typeField])) {
12040
+ if (typeField && !isNil18(item[typeField])) {
11992
12041
  message.messageType = item[typeField];
11993
12042
  }
11994
- if (removeModeField && !isNil17(item[removeModeField])) {
12043
+ if (removeModeField && !isNil18(item[removeModeField])) {
11995
12044
  message.removeMode = item[removeModeField];
11996
12045
  }
11997
12046
  return mergeRight2(basicMsg, message);
@@ -12228,7 +12277,7 @@ var ViewController = class extends BaseController {
12228
12277
  */
12229
12278
  handleContextParams() {
12230
12279
  this.context.srfappid = this.model.appId;
12231
- if (isNil18(this.context.srfsessionid) || isEmpty8(this.context.srfsessionid)) {
12280
+ if (isNil19(this.context.srfsessionid) || isEmpty8(this.context.srfsessionid)) {
12232
12281
  const domain = ibiz.uiDomainManager.create(this.id);
12233
12282
  this.context.srfsessionid = domain.id;
12234
12283
  }
@@ -12565,7 +12614,7 @@ var CodeListEditorController = class extends EditorController {
12565
12614
 
12566
12615
  // src/controller/common/control/control.controller.ts
12567
12616
  import { IBizContext as IBizContext3, IBizParams, NoticeError as NoticeError2 } from "@ibiz-template/core";
12568
- import { clone as clone15, isNil as isNil19 } from "ramda";
12617
+ import { clone as clone15, isNil as isNil20 } from "ramda";
12569
12618
  import { notNilEmpty as notNilEmpty7 } from "qx-util";
12570
12619
  var ControlController = class extends BaseController {
12571
12620
  /**
@@ -12853,7 +12902,7 @@ var ControlController = class extends BaseController {
12853
12902
  let message;
12854
12903
  let duration;
12855
12904
  if (msgItem && msgItem.content) {
12856
- duration = isNil19(msgItem.timeout) ? void 0 : msgItem.timeout / 1e3;
12905
+ duration = isNil20(msgItem.timeout) ? void 0 : msgItem.timeout / 1e3;
12857
12906
  const scriptParams = { ...this.getEventArgs() };
12858
12907
  if (opts == null ? void 0 : opts.data) {
12859
12908
  scriptParams.data = opts.data;
@@ -13879,7 +13928,7 @@ import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
13879
13928
  import quarterOfYear from "dayjs/plugin/quarterOfYear";
13880
13929
  import weekOfYear from "dayjs/plugin/weekOfYear";
13881
13930
  import isoWeek from "dayjs/plugin/isoWeek";
13882
- import { clone as clone16, isNil as isNil20, mergeDeepRight } from "ramda";
13931
+ import { clone as clone16, isNil as isNil21, mergeDeepRight } from "ramda";
13883
13932
  dayjs3.extend(minMax);
13884
13933
  dayjs3.extend(isSameOrBefore);
13885
13934
  dayjs3.extend(quarterOfYear);
@@ -13975,10 +14024,10 @@ var BaseSeriesGenerator = class {
13975
14024
  * @return {*} {(string | undefined)}
13976
14025
  */
13977
14026
  translateVal(codeListKey, val, isExclude = false) {
13978
- if (isNil20(val)) {
14027
+ if (isNil21(val)) {
13979
14028
  return void 0;
13980
14029
  }
13981
- if (isNil20(codeListKey)) {
14030
+ if (isNil21(codeListKey)) {
13982
14031
  return val;
13983
14032
  }
13984
14033
  const codeListItems = this.chartGenerator.codeListMap.get(codeListKey);
@@ -14027,7 +14076,7 @@ var BaseSeriesGenerator = class {
14027
14076
  seriesCodeListId,
14028
14077
  item[this.groupField]
14029
14078
  );
14030
- if (isNil20(groupVal)) {
14079
+ if (isNil21(groupVal)) {
14031
14080
  return;
14032
14081
  }
14033
14082
  group = groupVal;
@@ -17766,7 +17815,7 @@ var RawItemPortletController = class extends PortletPartController {
17766
17815
 
17767
17816
  // src/controller/control/data-view/data-view.controller.ts
17768
17817
  import { RuntimeModelError as RuntimeModelError50 } from "@ibiz-template/core";
17769
- import { isNil as isNil21 } from "ramda";
17818
+ import { isNil as isNil22 } from "ramda";
17770
17819
 
17771
17820
  // src/controller/control/data-view/data-view.service.ts
17772
17821
  var DataViewControlService = class extends MDControlService {
@@ -18054,7 +18103,7 @@ var DataViewControlController = class extends MDControlController {
18054
18103
  const groupMap = /* @__PURE__ */ new Map();
18055
18104
  items.forEach((item) => {
18056
18105
  const groupVal = item[groupAppDEFieldId];
18057
- if (isNil21(groupVal)) {
18106
+ if (isNil22(groupVal)) {
18058
18107
  return;
18059
18108
  }
18060
18109
  if (!groupMap.has(groupVal)) {
@@ -21863,7 +21912,6 @@ var EditFormController = class extends FormController {
21863
21912
  )
21864
21913
  );
21865
21914
  }
21866
- await awaitTimeout(2e3);
21867
21915
  } finally {
21868
21916
  if (showBusyIndicator) {
21869
21917
  this.endLoading();
@@ -23461,7 +23509,7 @@ var GridController = class extends MDControlController {
23461
23509
  import { DataTypes as DataTypes3, ModelError as ModelError29, plus as plus2 } from "@ibiz-template/core";
23462
23510
  import dayjs4 from "dayjs";
23463
23511
  import { debounce as debounce3 } from "lodash-es";
23464
- import { clone as clone23, isNil as isNil22 } from "ramda";
23512
+ import { clone as clone23, isNil as isNil23 } from "ramda";
23465
23513
  var GridFieldColumnController = class extends GridColumnController {
23466
23514
  constructor() {
23467
23515
  super(...arguments);
@@ -23664,11 +23712,11 @@ var GridFieldColumnController = class extends GridColumnController {
23664
23712
  */
23665
23713
  calcFieldAgg(items) {
23666
23714
  const { aggField, aggMode, aggValueFormat, unitName } = this.model;
23667
- if (isNil22(aggMode) || aggMode === "NONE") {
23715
+ if (isNil23(aggMode) || aggMode === "NONE") {
23668
23716
  return;
23669
23717
  }
23670
23718
  const fieldName = aggField || this.model.id;
23671
- items = items.filter((item) => !isNil22(item[fieldName]));
23719
+ items = items.filter((item) => !isNil23(item[fieldName]));
23672
23720
  let aggValue;
23673
23721
  if (this.grid.model.aggMode === "PAGE") {
23674
23722
  switch (aggMode) {
@@ -24990,7 +25038,7 @@ import {
24990
25038
  mergeInLeft as mergeInLeft3,
24991
25039
  recursiveIterate as recursiveIterate9
24992
25040
  } from "@ibiz-template/core";
24993
- import { clone as clone24, isNil as isNil23 } from "ramda";
25041
+ import { clone as clone24, isNil as isNil24 } from "ramda";
24994
25042
 
24995
25043
  // src/controller/control/search-bar/search-bar-filter.controller.ts
24996
25044
  import { RuntimeModelError as RuntimeModelError60 } from "@ibiz-template/core";
@@ -25618,7 +25666,7 @@ var SearchBarController = class extends ControlController {
25618
25666
  let hasError = false;
25619
25667
  recursiveIterate9(this.state.filterNodes[0], (node) => {
25620
25668
  if (node.leaf) {
25621
- if (node.field && node.valueOP && !isNil23(node.value)) {
25669
+ if (node.field && node.valueOP && !isNil24(node.value)) {
25622
25670
  hasFilter = true;
25623
25671
  } else {
25624
25672
  hasError = true;
@@ -27395,7 +27443,7 @@ var WizardPanelController = class extends ControlController {
27395
27443
 
27396
27444
  // src/controller/control/md-ctrl/md-ctrl.controller.ts
27397
27445
  import { RuntimeModelError as RuntimeModelError62 } from "@ibiz-template/core";
27398
- import { isNil as isNil24 } from "ramda";
27446
+ import { isNil as isNil25 } from "ramda";
27399
27447
 
27400
27448
  // src/controller/control/md-ctrl/md-ctrl.service.ts
27401
27449
  var MDCtrlService = class extends MDControlService {
@@ -27622,7 +27670,7 @@ var MDCtrlController = class extends MDControlController {
27622
27670
  const groupMap = /* @__PURE__ */ new Map();
27623
27671
  items.forEach((item) => {
27624
27672
  const groupVal = item[groupAppDEFieldId];
27625
- if (isNil24(groupVal)) {
27673
+ if (isNil25(groupVal)) {
27626
27674
  return;
27627
27675
  }
27628
27676
  if (!groupMap.has(groupVal)) {
@@ -27699,7 +27747,7 @@ var MDCtrlController = class extends MDControlController {
27699
27747
 
27700
27748
  // src/controller/control/kanban/kanban.controller.ts
27701
27749
  import { RuntimeError as RuntimeError59, RuntimeModelError as RuntimeModelError63 } from "@ibiz-template/core";
27702
- import { isNil as isNil25 } from "ramda";
27750
+ import { isNil as isNil26 } from "ramda";
27703
27751
 
27704
27752
  // src/controller/control/kanban/kanban.service.ts
27705
27753
  var KanbanService = class extends DataViewControlService {
@@ -27784,7 +27832,7 @@ var KanbanController = class extends DataViewControlController {
27784
27832
  const isAsc = minorSortDir === "ASC";
27785
27833
  items.forEach((item) => {
27786
27834
  const sortValue = item[sortField];
27787
- if (isNil25(sortValue)) {
27835
+ if (isNil26(sortValue)) {
27788
27836
  item[sortField] = 0;
27789
27837
  } else {
27790
27838
  const toNum = Number(sortValue);
@@ -27891,7 +27939,7 @@ var KanbanController = class extends DataViewControlController {
27891
27939
  const groupMap = /* @__PURE__ */ new Map();
27892
27940
  items.forEach((item) => {
27893
27941
  const groupVal = item[groupAppDEFieldId];
27894
- if (isNil25(groupVal)) {
27942
+ if (isNil26(groupVal)) {
27895
27943
  return;
27896
27944
  }
27897
27945
  if (!groupMap.has(groupVal)) {
@@ -28235,9 +28283,6 @@ var TreeGridExRowState = class {
28235
28283
  */
28236
28284
  this.uaColStates = {};
28237
28285
  this.data = data;
28238
- Object.values(treeGrid.fieldColumns).forEach((column) => {
28239
- column.initColumnStates(this);
28240
- });
28241
28286
  Object.values(treeGrid.uaColumns).forEach((column) => {
28242
28287
  column.initActionStates(this);
28243
28288
  });
@@ -28532,30 +28577,6 @@ var TreeGridExColumnController = class {
28532
28577
 
28533
28578
  // src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.ts
28534
28579
  var TreeGridExFieldColumnController = class extends TreeGridExColumnController {
28535
- /**
28536
- * 给rowController初始化属性列的状态
28537
- *
28538
- * @author zpc
28539
- * @date 2024-01-07 21:09:43
28540
- * @param {ITreeGridExRowState} row
28541
- */
28542
- initColumnStates(row) {
28543
- const { data } = row;
28544
- if (!this.model.id || !data._deData) {
28545
- return;
28546
- }
28547
- const { detreeNodeDataItems } = this.treeGrid.getNodeModel(
28548
- data._nodeId
28549
- );
28550
- const targetTreeNodeDataItem = detreeNodeDataItems == null ? void 0 : detreeNodeDataItems.find(
28551
- (treeNodeDataItem) => {
28552
- return treeNodeDataItem.detreeColumnId === this.model.id;
28553
- }
28554
- );
28555
- if (targetTreeNodeDataItem && targetTreeNodeDataItem.appDEFieldId) {
28556
- data[this.model.id.toLowerCase()] = data._deData[targetTreeNodeDataItem.appDEFieldId.toLowerCase()];
28557
- }
28558
- }
28559
28580
  };
28560
28581
 
28561
28582
  // src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.ts
@@ -29966,6 +29987,27 @@ var AppHub = class {
29966
29987
  }
29967
29988
  throw new RuntimeError61("\u89C6\u56FE[".concat(id, "]\u4E0D\u5B58\u5728"));
29968
29989
  }
29990
+ /**
29991
+ * 根据视图模型路径,加参数重新计算视图模型
29992
+ *
29993
+ * @author chitanda
29994
+ * @date 2024-01-08 11:01:54
29995
+ * @param {string} appId
29996
+ * @param {string} modelPath
29997
+ * @param {IParams} params
29998
+ * @return {*} {Promise<IAppView>}
29999
+ */
30000
+ async loadAppView(appId2, modelPath, params) {
30001
+ if (this.modelLoaderProvider) {
30002
+ const model = await this.modelLoaderProvider.loadAppView(
30003
+ appId2,
30004
+ modelPath,
30005
+ params
30006
+ );
30007
+ return model;
30008
+ }
30009
+ throw new RuntimeError61("\u89C6\u56FE[".concat(modelPath, "]\u4E0D\u5B58\u5728"));
30010
+ }
29969
30011
  /**
29970
30012
  * 根据应用实体代码名称查找应用视图
29971
30013
  *
@@ -31544,7 +31586,13 @@ var AppUILogicExecutor = class extends LogicExecutor {
31544
31586
  rest
31545
31587
  );
31546
31588
  if (enableBatchAdd && result.data) {
31547
- await this.doBatchAdd(appUILogic, result.data, context, newViewRef);
31589
+ await this.doBatchAdd(
31590
+ appUILogic,
31591
+ result.data,
31592
+ context,
31593
+ newViewRef,
31594
+ parameters.view
31595
+ );
31548
31596
  }
31549
31597
  return result;
31550
31598
  }
@@ -31605,7 +31653,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
31605
31653
  * @param {IAppUILogicRefViewBase} newViewRef
31606
31654
  * @return {*} {Promise<void>}
31607
31655
  */
31608
- async doBatchAdd(appUILogic, selections, context, newViewRef) {
31656
+ async doBatchAdd(appUILogic, selections, context, newViewRef, view) {
31609
31657
  var _a;
31610
31658
  if (selections == null ? void 0 : selections.length) {
31611
31659
  const selfDe = await ibiz.hub.getAppDataEntity(
@@ -31617,45 +31665,43 @@ var AppUILogicExecutor = class extends LogicExecutor {
31617
31665
  if (!minorDERs) {
31618
31666
  throw new RuntimeModelError69(selfDe, "\u5B9E\u4F53\u6CA1\u6709\u4ECE\u5173\u7CFB\u96C6\u5408\uFF01");
31619
31667
  }
31620
- let pickParentFieldName;
31668
+ let pickParentFieldName = "";
31621
31669
  minorDERs == null ? void 0 : minorDERs.forEach((item) => {
31622
31670
  const majorDeName = calcDeCodeNameById(item.majorAppDataEntityId);
31623
31671
  if (pickParentDeName === majorDeName) {
31624
31672
  pickParentFieldName = item.parentAppDEFieldId;
31625
31673
  }
31626
31674
  });
31627
- const openViewKeyParam = (_a = newViewRef.navigateParams) == null ? void 0 : _a.find((navParam) => {
31628
- return navParam.key === "keymapping";
31629
- });
31630
- let addData = [];
31631
- if (openViewKeyParam) {
31632
- const keyValuePairs = openViewKeyParam.value.split(";");
31633
- const keyMapping = {};
31675
+ if (pickParentFieldName === void 0) {
31676
+ throw new RuntimeError67(
31677
+ "\u6CA1\u6709\u627E\u5230".concat(pickParentDeName, "\u5728\u5F53\u524D\u5B9E\u4F53\u7684\u5916\u952E\u5C5E\u6027")
31678
+ );
31679
+ }
31680
+ const keyMapping = {
31681
+ srfkey: pickParentFieldName
31682
+ };
31683
+ const propertyMap = (_a = view.model.appViewParams) == null ? void 0 : _a.find(
31684
+ (item) => item.key.toLowerCase() === "PROPERTYMAP".toLowerCase()
31685
+ );
31686
+ if (propertyMap) {
31687
+ const keyValuePairs = propertyMap.value.split(",");
31634
31688
  for (const pair of keyValuePairs) {
31635
31689
  const [sourceKey, targetKey] = pair.split(":");
31636
31690
  if (sourceKey && targetKey) {
31637
31691
  keyMapping[sourceKey] = targetKey;
31638
31692
  }
31639
31693
  }
31640
- addData = selections.map((item) => {
31641
- const tempData = {
31642
- [pickParentFieldName]: item.srfkey
31643
- };
31644
- for (const key in keyMapping) {
31645
- if (Object.prototype.hasOwnProperty.call(keyMapping, key)) {
31646
- const targetKey = keyMapping[key];
31647
- if (Object.prototype.hasOwnProperty.call(item, key)) {
31648
- tempData[targetKey] = item[key];
31649
- }
31650
- }
31651
- }
31652
- return tempData;
31653
- });
31654
- } else {
31655
- addData = selections.map((item) => ({
31656
- [pickParentFieldName]: item.srfkey
31657
- }));
31658
31694
  }
31695
+ ibiz.log.debug("\u6279\u91CF\u65B0\u5EFA\u8F6C\u6362\u6620\u5C04\u5C5E\u6027", keyMapping);
31696
+ const addData = selections.map((item) => {
31697
+ const tempData = {};
31698
+ Object.keys(keyMapping).forEach((key) => {
31699
+ const targetKey = keyMapping[key];
31700
+ tempData[targetKey] = item[key];
31701
+ });
31702
+ return tempData;
31703
+ });
31704
+ ibiz.log.debug("\u6279\u91CF\u65B0\u5EFA\u521B\u5EFA\u6570\u636E", addData);
31659
31705
  const service = ibiz.hub.getApp(context.srfappid).deService;
31660
31706
  await service.exec(selfDe.id, "Create", context, addData);
31661
31707
  }