@ibiz-template/runtime 0.5.3 → 0.5.4

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 (34) hide show
  1. package/dist/index.esm.js +87 -44
  2. package/dist/index.system.min.js +1 -1
  3. package/out/application.d.ts.map +1 -1
  4. package/out/application.js +4 -1
  5. package/out/controller/control/form/edit-form/edit-form.controller.js +1 -1
  6. package/out/controller/control/search-bar/search-bar.controller.d.ts +8 -1
  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 +41 -9
  9. package/out/controller/control/search-bar/search-bar.service.d.ts +4 -4
  10. package/out/controller/control/search-bar/search-bar.service.d.ts.map +1 -1
  11. package/out/controller/control/search-bar/search-bar.service.js +38 -19
  12. package/out/engine/md-view.engine.d.ts.map +1 -1
  13. package/out/engine/md-view.engine.js +3 -1
  14. package/out/interface/controller/controller/control/i-search-bar.controller.d.ts +8 -0
  15. package/out/interface/controller/controller/control/i-search-bar.controller.d.ts.map +1 -1
  16. package/out/interface/controller/state/control/i-search-bar.state.d.ts +36 -1
  17. package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
  18. package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts +10 -0
  19. package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts.map +1 -1
  20. package/out/service/mqtt/mqtt.service.d.ts.map +1 -1
  21. package/out/service/mqtt/mqtt.service.js +1 -4
  22. package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts.map +1 -1
  23. package/out/service/utils/dynamic-code-list/dynamic-code-list.js +6 -2
  24. package/package.json +2 -2
  25. package/src/application.ts +6 -1
  26. package/src/controller/control/form/edit-form/edit-form.controller.ts +1 -1
  27. package/src/controller/control/search-bar/search-bar.controller.ts +40 -9
  28. package/src/controller/control/search-bar/search-bar.service.ts +42 -20
  29. package/src/engine/md-view.engine.ts +5 -1
  30. package/src/interface/controller/controller/control/i-search-bar.controller.ts +9 -0
  31. package/src/interface/controller/state/control/i-search-bar.state.ts +41 -1
  32. package/src/plugin/remote-plugin-item/remote-plugin-item.ts +8 -0
  33. package/src/service/mqtt/mqtt.service.ts +1 -4
  34. package/src/service/utils/dynamic-code-list/dynamic-code-list.ts +7 -2
package/dist/index.esm.js CHANGED
@@ -4711,9 +4711,11 @@ var DynamicCodeListCache = class {
4711
4711
  if (!tempParams.size) {
4712
4712
  tempParams.size = 1e4;
4713
4713
  }
4714
- if (this.isPredefined) {
4714
+ if (this.isPredefined && this.codeList.codeName) {
4715
+ const index = this.codeList.codeName.indexOf("__");
4716
+ const tag = index !== -1 ? this.codeList.codeName.substring(index + 2) : this.codeList.codeName;
4715
4717
  const res2 = await app.net.get(
4716
- "/dictionaries/codelist/".concat(this.codeList.codeName),
4718
+ "/dictionaries/codelist/".concat(tag),
4717
4719
  tempParams
4718
4720
  );
4719
4721
  return Object.freeze(res2.data.items);
@@ -10278,7 +10280,7 @@ var GanttCodeListNodeData = class extends TreeCodeListNodeData {
10278
10280
  };
10279
10281
 
10280
10282
  // src/service/mqtt/mqtt.service.ts
10281
- import { QXEvent as QXEvent3, createUUID as createUUID7, isNilOrEmpty as isNilOrEmpty6 } from "qx-util";
10283
+ import { QXEvent as QXEvent3, createUUID as createUUID7 } from "qx-util";
10282
10284
  var MqttService = class {
10283
10285
  /**
10284
10286
  * Creates an instance of MqttService.
@@ -10319,9 +10321,6 @@ var MqttService = class {
10319
10321
  keepalive: 60,
10320
10322
  clean: true
10321
10323
  };
10322
- if (isNilOrEmpty6(mqttTopic) || isNilOrEmpty6(token)) {
10323
- throw new Error("mqttTopic or token is empty");
10324
- }
10325
10324
  this.options.username = mqttTopic;
10326
10325
  this.options.password = token;
10327
10326
  }
@@ -10879,7 +10878,7 @@ var Application = class {
10879
10878
  async init() {
10880
10879
  await this.authority.init();
10881
10880
  await this.loadAppModelStyle();
10882
- if (ibiz.env.enableMqtt && ibiz.appData && ibiz.auth.isAnonymous !== true) {
10881
+ if (ibiz.env.enableMqtt && ibiz.appData && ibiz.appData.mqtttopic && ibiz.auth.isAnonymous !== true) {
10883
10882
  this.mqtt = new MqttService(
10884
10883
  ibiz.appData.mqtttopic,
10885
10884
  getToken(),
@@ -11772,7 +11771,7 @@ function getOriginData(data) {
11772
11771
 
11773
11772
  // src/controller/utils/value-rule/value-rule.ts
11774
11773
  import { RuntimeError as RuntimeError27 } from "@ibiz-template/core";
11775
- import { isNilOrEmpty as isNilOrEmpty7, isNumber } from "qx-util";
11774
+ import { isNilOrEmpty as isNilOrEmpty6, isNumber } from "qx-util";
11776
11775
  import { isNil as isNil15 } from "ramda";
11777
11776
  function generateRules(itemVRs, name, valueItemName) {
11778
11777
  const rules = [];
@@ -11812,7 +11811,7 @@ function generateRules(itemVRs, name, valueItemName) {
11812
11811
  const valueName = valueItemName || name;
11813
11812
  rules.push({
11814
11813
  validator: (rule, value, callback, source) => {
11815
- if (isNilOrEmpty7(source[valueName])) {
11814
+ if (isNilOrEmpty6(source[valueName])) {
11816
11815
  return true;
11817
11816
  }
11818
11817
  const { isPast, infoMessage } = verifyDeRules(
@@ -20854,7 +20853,7 @@ var FormGroupPanelController = class extends FormDetailController {
20854
20853
 
20855
20854
  // src/controller/control/form/form-detail/form-item/form-item.controller.ts
20856
20855
  import Schema from "async-validator";
20857
- import { isNilOrEmpty as isNilOrEmpty8 } from "qx-util";
20856
+ import { isNilOrEmpty as isNilOrEmpty7 } from "qx-util";
20858
20857
 
20859
20858
  // src/controller/control/form/form-detail/form-item/form-item.state.ts
20860
20859
  var FormItemState = class extends FormDetailState {
@@ -21110,7 +21109,7 @@ var FormItemController = class extends FormDetailController {
21110
21109
  this.state.error = null;
21111
21110
  return true;
21112
21111
  }
21113
- if (this.state.required && isNilOrEmpty8(this.data[this.name])) {
21112
+ if (this.state.required && isNilOrEmpty7(this.data[this.name])) {
21114
21113
  this.state.error = "\u8BF7\u586B\u5199".concat(this.model.caption || "");
21115
21114
  return false;
21116
21115
  }
@@ -22351,7 +22350,7 @@ var EditFormController = class extends FormController {
22351
22350
  });
22352
22351
  }
22353
22352
  ibiz.mc.command.send(
22354
- res.data,
22353
+ res.data.$origin,
22355
22354
  isCreate ? "OBJECTCREATED" : "OBJECTUPDATED"
22356
22355
  );
22357
22356
  return this.data;
@@ -24439,7 +24438,7 @@ var GridUAColumnController = class extends GridColumnController {
24439
24438
  // src/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.ts
24440
24439
  import { RuntimeError as RuntimeError54 } from "@ibiz-template/core";
24441
24440
  import Schema2 from "async-validator";
24442
- import { isNilOrEmpty as isNilOrEmpty9 } from "qx-util";
24441
+ import { isNilOrEmpty as isNilOrEmpty8 } from "qx-util";
24443
24442
  var GridFieldEditColumnController = class extends GridFieldColumnController {
24444
24443
  constructor() {
24445
24444
  super(...arguments);
@@ -24678,7 +24677,7 @@ var GridFieldEditColumnController = class extends GridFieldColumnController {
24678
24677
  */
24679
24678
  async validate(row) {
24680
24679
  const editName = this.fieldName;
24681
- if (ibiz.config.grid.editShowMode !== "cell" && row.editColStates[editName].required && isNilOrEmpty9(row.data[editName])) {
24680
+ if (ibiz.config.grid.editShowMode !== "cell" && row.editColStates[editName].required && isNilOrEmpty8(row.data[editName])) {
24682
24681
  row.errors[editName] = "\u8BF7\u586B\u5199".concat(this.model.caption || "");
24683
24682
  return false;
24684
24683
  }
@@ -25681,8 +25680,16 @@ var SearchBarService = class {
25681
25680
  *
25682
25681
  */
25683
25682
  async fetch() {
25684
- const res = await this.app.net.post("".concat(this.themeUrl, "/fetch_default"), {
25685
- app_view_tag: this.viewTag,
25683
+ const searchconds = [
25684
+ {
25685
+ condop: "EQ",
25686
+ condtype: "DEFIELD",
25687
+ fieldname: "app_view_tag",
25688
+ value: this.viewTag
25689
+ }
25690
+ ];
25691
+ const res = await this.app.net.post("".concat(this.themeUrl, "/fetch_cur_user_all"), {
25692
+ searchconds,
25686
25693
  sort: "create_time,asc"
25687
25694
  });
25688
25695
  if (res.ok) {
@@ -25695,9 +25702,7 @@ var SearchBarService = class {
25695
25702
  *
25696
25703
  */
25697
25704
  async get(id) {
25698
- const res = await this.app.net.get("".concat(this.themeUrl, "/").concat(id), {
25699
- app_view_tag: this.viewTag
25700
- });
25705
+ const res = await this.app.net.get("".concat(this.themeUrl, "/").concat(id));
25701
25706
  if (res.ok) {
25702
25707
  [res.data] = this.convertBackDataToFront([res.data]);
25703
25708
  }
@@ -25708,32 +25713,34 @@ var SearchBarService = class {
25708
25713
  *
25709
25714
  */
25710
25715
  async remove(id) {
25711
- const res = await this.app.net.delete("".concat(this.themeUrl, "/").concat(id), {
25712
- app_view_tag: this.viewTag
25713
- });
25716
+ const res = await this.app.net.delete("".concat(this.themeUrl, "/").concat(id));
25714
25717
  return res;
25715
25718
  }
25716
25719
  /**
25717
- * 新建数据
25720
+ * 新建数据(只有一个标题)
25718
25721
  *
25719
25722
  */
25720
25723
  async create(caption) {
25721
25724
  const res = await this.app.net.post("".concat(this.themeUrl), {
25722
- name: caption,
25725
+ name: "".concat(this.viewTag, "___").concat(caption),
25726
+ caption,
25727
+ app_tag: this.model.appId,
25723
25728
  app_view_tag: this.viewTag
25724
25729
  });
25725
25730
  return res;
25726
25731
  }
25727
25732
  /**
25728
- * 新建数据(带参数,给平台配置建立的分组用)
25733
+ * 新建数据(带参数,给平台配置建立的分组用,分组项名称就是id)
25729
25734
  *
25730
25735
  */
25731
- async createWithParams(id, data) {
25736
+ async createWithParams(group, data) {
25732
25737
  const res = await this.app.net.post("".concat(this.themeUrl), {
25733
- id,
25734
- theme_model: JSON.stringify(data),
25738
+ name: group.name,
25739
+ caption: group.caption,
25740
+ app_tag: this.model.appId,
25735
25741
  app_view_tag: this.viewTag,
25736
- show: data.show
25742
+ theme_model: JSON.stringify(data),
25743
+ valid_flag: group.show ? 1 : 0
25737
25744
  });
25738
25745
  return res;
25739
25746
  }
@@ -25784,8 +25791,14 @@ var SearchBarService = class {
25784
25791
  convertBackDataToFront(data) {
25785
25792
  return data.map((item) => {
25786
25793
  const tempItem = { ...item };
25794
+ if (item.id) {
25795
+ tempItem.id = item.id;
25796
+ }
25787
25797
  if (item.name) {
25788
- tempItem.caption = item.name;
25798
+ tempItem.name = item.name;
25799
+ }
25800
+ if (item.caption) {
25801
+ tempItem.caption = item.caption;
25789
25802
  }
25790
25803
  if (item.theme_model) {
25791
25804
  tempItem.searchGroupData = JSON.parse(item.theme_model);
@@ -25809,12 +25822,17 @@ var SearchBarService = class {
25809
25822
  convertFrontDataToBack(data) {
25810
25823
  return data.map((item) => {
25811
25824
  const tempItem = {
25812
- appId: item.appId,
25813
- app_view_tag: this.viewTag,
25814
- id: item.id
25825
+ app_tag: this.model.appId,
25826
+ app_view_tag: this.viewTag
25815
25827
  };
25828
+ if (item.id) {
25829
+ tempItem.id = item.id;
25830
+ }
25831
+ if (item.name) {
25832
+ tempItem.name = item.name;
25833
+ }
25816
25834
  if (item.caption) {
25817
- tempItem.name = item.caption;
25835
+ tempItem.caption = item.caption;
25818
25836
  }
25819
25837
  if (item.searchGroupData && Object.keys(item.searchGroupData).length > 0) {
25820
25838
  tempItem.theme_model = JSON.stringify(item.searchGroupData);
@@ -26010,6 +26028,13 @@ var SearchBarController = class extends ControlController {
26010
26028
  * @Date: 2023-12-21 10:17:43
26011
26029
  */
26012
26030
  this.isBackendSearchGroup = this.model.searchBarStyle === "SEARCHBAR2";
26031
+ /**
26032
+ * 是否有默认选中
26033
+ * @return {*}
26034
+ * @author: zhujiamin
26035
+ * @Date: 2023-12-21 10:17:43
26036
+ */
26037
+ this.hasDefaultSelect = false;
26013
26038
  /**
26014
26039
  * 是否启用根据实体的JSON Schema生成过滤项
26015
26040
  * @author lxm
@@ -26065,11 +26090,14 @@ var SearchBarController = class extends ControlController {
26065
26090
  this.calcQuickSearchPlaceholder();
26066
26091
  }
26067
26092
  if (this.isBackendSearchGroup && this.view.model.codeName) {
26068
- this.service = new SearchBarService(this.model, this.view.model.codeName);
26093
+ this.service = new SearchBarService(
26094
+ this.model,
26095
+ this.view.model.codeName.toLowerCase()
26096
+ );
26069
26097
  await this.service.init(this.context);
26070
26098
  }
26071
26099
  await this.initSearchBarFilters();
26072
- await this.initSearBarGroups();
26100
+ await this.initSearBarGroups(true);
26073
26101
  }
26074
26102
  /**
26075
26103
  * 根据实体jsonschema初始化
@@ -26310,18 +26338,21 @@ var SearchBarController = class extends ControlController {
26310
26338
  * @author: zhujiamin
26311
26339
  * @Date: 2023-12-19 14:43:46
26312
26340
  */
26313
- async initSearBarGroups() {
26341
+ async initSearBarGroups(firstInit = false) {
26314
26342
  this.state.searchBarGroups = [];
26315
26343
  if (this.isBackendSearchGroup) {
26316
26344
  if (this.model.searchBarGroups && this.model.searchBarGroups.length > 0) {
26317
26345
  this.state.searchBarGroups = this.model.searchBarGroups.map(
26318
26346
  (item, index) => {
26319
26347
  const tempGroup = {
26320
- ...item,
26348
+ name: item.id,
26349
+ caption: item.caption,
26321
26350
  saved: false,
26322
26351
  show: true,
26323
26352
  searchGroupData: {},
26324
- order: (index + 1) * 100
26353
+ order: (index + 1) * 100,
26354
+ defaultSelect: false,
26355
+ noEdit: true
26325
26356
  };
26326
26357
  if (item.data) {
26327
26358
  try {
@@ -26344,6 +26375,9 @@ var SearchBarController = class extends ControlController {
26344
26375
  ibiz.log.error("".concat(item.data, "\u975E\u6807\u51C6JSON\u683C\u5F0F:"), error);
26345
26376
  }
26346
26377
  }
26378
+ if (item.defaultGroup) {
26379
+ tempGroup.defaultSelect = true;
26380
+ }
26347
26381
  return tempGroup;
26348
26382
  }
26349
26383
  );
@@ -26352,7 +26386,7 @@ var SearchBarController = class extends ControlController {
26352
26386
  if (res.ok) {
26353
26387
  res.data.forEach((group) => {
26354
26388
  const existGroup = this.state.searchBarGroups.find(
26355
- (item) => item.id === group.id
26389
+ (item) => item.name === group.name
26356
26390
  );
26357
26391
  if (existGroup) {
26358
26392
  mergeInLeft3(existGroup, group);
@@ -26363,7 +26397,6 @@ var SearchBarController = class extends ControlController {
26363
26397
  0
26364
26398
  );
26365
26399
  this.state.searchBarGroups.push({
26366
- appId: this.context.srfappid,
26367
26400
  saved: true,
26368
26401
  show: true,
26369
26402
  searchGroupData: {},
@@ -26378,6 +26411,15 @@ var SearchBarController = class extends ControlController {
26378
26411
  this.state.searchBarGroups.forEach((item, index) => {
26379
26412
  item.order = (index + 1) * 100;
26380
26413
  });
26414
+ if (firstInit && this.state.searchBarGroups && this.state.searchBarGroups.length > 0) {
26415
+ const defaultSelectedGroup = this.state.searchBarGroups.find((group) => {
26416
+ return group.defaultSelect;
26417
+ });
26418
+ if (defaultSelectedGroup) {
26419
+ this.hasDefaultSelect = true;
26420
+ this.handleGroupClick(defaultSelectedGroup);
26421
+ }
26422
+ }
26381
26423
  }
26382
26424
  }
26383
26425
  /**
@@ -26403,14 +26445,15 @@ var SearchBarController = class extends ControlController {
26403
26445
  ibiz.message.success("\u4FDD\u5B58\u6210\u529F");
26404
26446
  } else {
26405
26447
  const res = await this.service.createWithParams(
26406
- this.state.selectedSearchGroupItem.id,
26448
+ this.state.selectedSearchGroupItem,
26407
26449
  saveParams
26408
26450
  );
26409
26451
  if (res.ok) {
26410
26452
  const savedGroup = this.state.searchBarGroups.find(
26411
- (group) => group.id === res.data.id
26453
+ (group) => group.name === res.data.name
26412
26454
  );
26413
26455
  if (savedGroup) {
26456
+ mergeInLeft3(savedGroup, res.data);
26414
26457
  savedGroup.saved = true;
26415
26458
  }
26416
26459
  ibiz.message.success("\u4FDD\u5B58\u6210\u529F");
@@ -31782,7 +31825,7 @@ var MDViewEngine = class extends ViewEngineBase {
31782
31825
  this.reLoad();
31783
31826
  });
31784
31827
  }
31785
- if (!this.view.state.noLoadDefault && model.loadDefault) {
31828
+ if (!this.view.state.noLoadDefault && model.loadDefault && !this.searchBar.hasDefaultSelect) {
31786
31829
  this.load();
31787
31830
  }
31788
31831
  }