@ibiz-template/runtime 0.5.7-alpha.0 → 0.5.7-alpha.2

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 (24) hide show
  1. package/dist/index.esm.js +43 -36
  2. package/dist/index.system.min.js +1 -1
  3. package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts +0 -8
  4. package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts.map +1 -1
  5. package/out/controller/control/form/form-detail/form-item/form-item.controller.js +1 -22
  6. package/out/controller/control/search-bar/search-bar.controller.d.ts +7 -0
  7. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  8. package/out/controller/control/search-bar/search-bar.controller.js +19 -3
  9. package/out/engine/md-view.engine.d.ts.map +1 -1
  10. package/out/engine/md-view.engine.js +10 -4
  11. package/out/interface/controller/controller/control/i-search-bar.controller.d.ts +7 -0
  12. package/out/interface/controller/controller/control/i-search-bar.controller.d.ts.map +1 -1
  13. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  14. package/out/service/service/entity/method/de-action.js +4 -4
  15. package/out/service/utils/de-cache/de-cache.d.ts +4 -2
  16. package/out/service/utils/de-cache/de-cache.d.ts.map +1 -1
  17. package/out/service/utils/de-cache/de-cache.js +9 -5
  18. package/package.json +4 -4
  19. package/src/controller/control/form/form-detail/form-item/form-item.controller.ts +1 -31
  20. package/src/controller/control/search-bar/search-bar.controller.ts +20 -3
  21. package/src/engine/md-view.engine.ts +11 -6
  22. package/src/interface/controller/controller/control/i-search-bar.controller.ts +8 -0
  23. package/src/service/service/entity/method/de-action.ts +12 -2
  24. package/src/service/utils/de-cache/de-cache.ts +19 -5
package/dist/index.esm.js CHANGED
@@ -4958,13 +4958,14 @@ var DECache = class {
4958
4958
  *
4959
4959
  * @param {*} context
4960
4960
  * @param {IDataEntity} entity
4961
+ * @param {boolean} [ignoreDuplicate=true] 是否忽略主键重复(不忽略报错,忽略则覆盖)
4961
4962
  * @return {*} {boolean}
4962
4963
  * @memberof EntityCache
4963
4964
  */
4964
- add(context, entity) {
4965
+ add(context, entity, ignoreDuplicate = true) {
4965
4966
  if (this.isUnionKey) {
4966
4967
  this.calcUnionKey(entity);
4967
- if (this.checkData(context, entity.srfkey)) {
4968
+ if (ignoreDuplicate === false && this.checkData(context, entity.srfkey)) {
4968
4969
  throw new RuntimeError15(
4969
4970
  "\u65B0\u5EFA\u8054\u5408\u4E3B\u952E\u6570\u636E\u5931\u8D25\uFF0C\u5DF2\u6709\u4E3B\u952E\u4E3A".concat(entity.srfkey, "\u7684\u6570\u636E")
4970
4971
  );
@@ -5018,14 +5019,15 @@ var DECache = class {
5018
5019
  *
5019
5020
  * @param {IContext} context
5020
5021
  * @param {IDataEntity} entity
5022
+ * @param {boolean} [ignoreDuplicate=true] 是否忽略主键重复(不忽略报错,忽略则覆盖)
5021
5023
  * @return {*} {IDataEntity}
5022
5024
  * @memberof EntityCache
5023
5025
  */
5024
- update(context, entity) {
5026
+ update(context, entity, ignoreDuplicate = true) {
5025
5027
  const oldKey = entity.srfkey;
5026
5028
  if (this.isUnionKey) {
5027
5029
  this.calcUnionKey(entity);
5028
- if (oldKey !== entity.srfkey && this.checkData(context, entity.srfkey)) {
5030
+ if (ignoreDuplicate === false && oldKey !== entity.srfkey && this.checkData(context, entity.srfkey)) {
5029
5031
  throw new RuntimeError15(
5030
5032
  "\u66F4\u65B0\u8054\u5408\u4E3B\u952E\u6570\u636E\u5931\u8D25\uFF0C\u5DF2\u6709\u4E3B\u952E\u4E3A".concat(entity.srfkey, "\u7684\u6570\u636E")
5031
5033
  );
@@ -9171,13 +9173,18 @@ var DEActionMethod = class extends Method {
9171
9173
  if (isArray6(addData)) {
9172
9174
  resultData = await Promise.all(
9173
9175
  addData.map(
9174
- (item) => this.service.local.add(context, this.attach(context, item))
9176
+ (item) => this.service.local.add(
9177
+ context,
9178
+ this.attach(context, item),
9179
+ false
9180
+ )
9175
9181
  )
9176
9182
  );
9177
9183
  } else {
9178
9184
  resultData = await this.service.local.add(
9179
9185
  context,
9180
- this.attach(context, addData)
9186
+ this.attach(context, addData),
9187
+ false
9181
9188
  );
9182
9189
  }
9183
9190
  return new HttpResponse3(resultData);
@@ -9349,13 +9356,18 @@ var DEActionMethod = class extends Method {
9349
9356
  if (isArray6(updateData)) {
9350
9357
  resultData = await Promise.all(
9351
9358
  updateData.map(
9352
- (item) => this.service.local.update(context, this.attach(context, item))
9359
+ (item) => this.service.local.update(
9360
+ context,
9361
+ this.attach(context, item),
9362
+ false
9363
+ )
9353
9364
  )
9354
9365
  );
9355
9366
  } else {
9356
9367
  resultData = await this.service.local.update(
9357
9368
  context,
9358
- this.attach(context, updateData)
9369
+ this.attach(context, updateData),
9370
+ false
9359
9371
  );
9360
9372
  }
9361
9373
  if (resultData) {
@@ -21284,30 +21296,6 @@ var FormItemController = class extends FormDetailController {
21284
21296
  formDetailEventName: "onChange" /* CHANGE */
21285
21297
  });
21286
21298
  }
21287
- /**
21288
- * 设置默认值
21289
- *
21290
- * @author lxm
21291
- * @date 2022-09-15 22:09:52
21292
- * @param {boolean} isCreate 新建默认值还是更新默认值
21293
- */
21294
- setDefaultValue(isCreate, data = this.data) {
21295
- const { createDVT, createDV, updateDVT, updateDV } = this.model;
21296
- const valueType = isCreate ? createDVT : updateDVT;
21297
- const defaultValue = isCreate ? createDV : updateDV;
21298
- const defaultVal = getDefaultValue(
21299
- {
21300
- name: this.name,
21301
- valueType,
21302
- defaultValue,
21303
- valueFormat: this.model.valueFormat
21304
- },
21305
- { data, context: this.context, params: this.params }
21306
- );
21307
- if (defaultVal !== void 0) {
21308
- data[this.name] = defaultVal;
21309
- }
21310
- }
21311
21299
  /**
21312
21300
  * 聚焦事件
21313
21301
  * @author lxm
@@ -26344,7 +26332,7 @@ var SearchBarController = class extends ControlController {
26344
26332
  if (this.state.query) {
26345
26333
  params.query = this.state.query;
26346
26334
  }
26347
- if (((_a = this.state.selectedGroupItem) == null ? void 0 : _a.data) && typeof this.state.selectedGroupItem.data === "string") {
26335
+ if (((_a = this.state.selectedGroupItem) == null ? void 0 : _a.data) && typeof this.state.selectedGroupItem.data === "string" && !this.isBackendSearchGroup) {
26348
26336
  const navParams = ScriptFactory.execSingleLine(
26349
26337
  this.state.selectedGroupItem.data
26350
26338
  );
@@ -26561,11 +26549,26 @@ var SearchBarController = class extends ControlController {
26561
26549
  });
26562
26550
  if (defaultSelectedGroup) {
26563
26551
  this.hasDefaultSelect = true;
26564
- this.handleGroupClick(defaultSelectedGroup);
26565
26552
  }
26566
26553
  }
26567
26554
  }
26568
26555
  }
26556
+ /**
26557
+ * 点击默认选中
26558
+ * @return {*}
26559
+ * @author: zhujiamin
26560
+ * @Date: 2024-01-24 11:12:43
26561
+ */
26562
+ setDefaultSelect() {
26563
+ if (this.state.searchBarGroups && this.state.searchBarGroups.length > 0) {
26564
+ const defaultSelectedGroup = this.state.searchBarGroups.find((group) => {
26565
+ return group.defaultSelect;
26566
+ });
26567
+ if (defaultSelectedGroup) {
26568
+ this.handleGroupClick(defaultSelectedGroup);
26569
+ }
26570
+ }
26571
+ }
26569
26572
  /**
26570
26573
  * 处理保存
26571
26574
  * @return {*}
@@ -31982,8 +31985,12 @@ var MDViewEngine = class extends ViewEngineBase {
31982
31985
  this.reLoad();
31983
31986
  });
31984
31987
  }
31985
- if (!this.view.state.noLoadDefault && model.loadDefault && (!this.searchBar || !this.searchBar.hasDefaultSelect)) {
31986
- this.load();
31988
+ if (!this.view.state.noLoadDefault && model.loadDefault) {
31989
+ if (this.searchBar && this.searchBar.hasDefaultSelect && this.xdataControlName === "grid") {
31990
+ this.searchBar.setDefaultSelect();
31991
+ } else {
31992
+ this.load();
31993
+ }
31987
31994
  }
31988
31995
  }
31989
31996
  /**