@ibiz-template/runtime 0.5.7-alpha.4 → 0.5.7-alpha.5

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 (27) hide show
  1. package/dist/index.esm.js +112 -104
  2. package/dist/index.system.min.js +1 -1
  3. package/out/controller/control/search-bar/entity-schema.d.ts +1 -2
  4. package/out/controller/control/search-bar/entity-schema.d.ts.map +1 -1
  5. package/out/controller/control/search-bar/entity-schema.js +2 -2
  6. package/out/controller/control/search-bar/index.d.ts +2 -0
  7. package/out/controller/control/search-bar/index.d.ts.map +1 -1
  8. package/out/controller/control/search-bar/index.js +2 -0
  9. package/out/controller/control/search-bar/search-bar-filter.controller.d.ts +5 -6
  10. package/out/controller/control/search-bar/search-bar-filter.controller.d.ts.map +1 -1
  11. package/out/controller/control/search-bar/search-bar-filter.controller.js +6 -9
  12. package/out/controller/control/search-bar/search-bar.controller.d.ts +1 -24
  13. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  14. package/out/controller/control/search-bar/search-bar.controller.js +11 -88
  15. package/out/controller/control/search-bar/use-searchcond.d.ts +33 -0
  16. package/out/controller/control/search-bar/use-searchcond.d.ts.map +1 -0
  17. package/out/controller/control/search-bar/use-searchcond.js +91 -0
  18. package/out/service/service/auth/v7-auth.service.d.ts +8 -0
  19. package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
  20. package/out/service/service/auth/v7-auth.service.js +15 -0
  21. package/package.json +5 -6
  22. package/src/controller/control/search-bar/entity-schema.ts +4 -4
  23. package/src/controller/control/search-bar/index.ts +2 -0
  24. package/src/controller/control/search-bar/search-bar-filter.controller.ts +15 -10
  25. package/src/controller/control/search-bar/search-bar.controller.ts +24 -98
  26. package/src/controller/control/search-bar/use-searchcond.ts +100 -0
  27. package/src/service/service/auth/v7-auth.service.ts +16 -1
package/dist/index.esm.js CHANGED
@@ -9336,6 +9336,7 @@ var V7AuthService = class {
9336
9336
  true
9337
9337
  );
9338
9338
  }
9339
+ await this.loadAppData();
9339
9340
  ibiz.hub.getAllApps().forEach((app) => {
9340
9341
  app.initMqtt();
9341
9342
  });
@@ -9352,6 +9353,19 @@ var V7AuthService = class {
9352
9353
  isAnonymous
9353
9354
  } : void 0;
9354
9355
  }
9356
+ /**
9357
+ * 加载应用数据
9358
+ *
9359
+ * @author chitanda
9360
+ * @date 2022-07-20 20:07:50
9361
+ * @return {*} {Promise<void>}
9362
+ */
9363
+ async loadAppData() {
9364
+ const res = await ibiz.net.get("/appdata");
9365
+ if (res.ok) {
9366
+ ibiz.appData = res.data;
9367
+ }
9368
+ }
9355
9369
  };
9356
9370
 
9357
9371
  // src/service/service/async-action/async-action.service.ts
@@ -27557,12 +27571,8 @@ var PickupViewPanelController = class extends ControlController {
27557
27571
  };
27558
27572
 
27559
27573
  // src/controller/control/search-bar/search-bar.controller.ts
27560
- import {
27561
- RuntimeError as RuntimeError58,
27562
- mergeInLeft as mergeInLeft3,
27563
- recursiveIterate as recursiveIterate9
27564
- } from "@ibiz-template/core";
27565
- import { clone as clone27, isNil as isNil25 } from "ramda";
27574
+ import { mergeInLeft as mergeInLeft3 } from "@ibiz-template/core";
27575
+ import { clone as clone27 } from "ramda";
27566
27576
 
27567
27577
  // src/controller/control/search-bar/search-bar-filter.controller.ts
27568
27578
  import { RuntimeModelError as RuntimeModelError63 } from "@ibiz-template/core";
@@ -27571,9 +27581,9 @@ var ExcludeOPs = [
27571
27581
  "ISNOTNULL" /* IS_NOT_NULL */
27572
27582
  ];
27573
27583
  var SearchBarFilterController = class {
27574
- constructor(model, searchBar) {
27584
+ constructor(model, appDataEntity, context, params) {
27575
27585
  this.model = model;
27576
- this.searchBar = searchBar;
27586
+ this.appDataEntity = appDataEntity;
27577
27587
  /**
27578
27588
  * 不需要编辑器
27579
27589
  * @author lxm
@@ -27582,21 +27592,17 @@ var SearchBarFilterController = class {
27582
27592
  */
27583
27593
  this.noEditor = false;
27584
27594
  var _a;
27595
+ this.context = context;
27596
+ this.params = params;
27585
27597
  let field;
27586
27598
  if (model.appDEFieldId) {
27587
- field = findFieldById(searchBar.appDataEntity, model.appDEFieldId);
27599
+ field = findFieldById(appDataEntity, model.appDEFieldId);
27588
27600
  }
27589
27601
  this.fieldName = field ? field.codeName.toLowerCase() : model.id;
27590
27602
  this.label = model.caption || (field == null ? void 0 : field.logicName) || model.id;
27591
27603
  this.valueOP = (_a = model.defsearchMode) == null ? void 0 : _a.valueOP;
27592
27604
  this.noEditor = this.valueOP ? ExcludeOPs.includes(this.valueOP) : !this.model.editor;
27593
27605
  }
27594
- get context() {
27595
- return this.searchBar.context;
27596
- }
27597
- get params() {
27598
- return this.searchBar.params;
27599
- }
27600
27606
  /**
27601
27607
  * 初始化
27602
27608
  * @author lxm
@@ -27893,7 +27899,7 @@ function getEditor(field, op) {
27893
27899
  const editorModel = EditorsMap["".concat(field.type, "_").concat(op)];
27894
27900
  return editorModel;
27895
27901
  }
27896
- async function calcFilterModelBySchema(json, c) {
27902
+ async function calcFilterModelBySchema(json, appDataEntityId, modelAppId) {
27897
27903
  var _a;
27898
27904
  if (!json.properties) {
27899
27905
  return [];
@@ -27929,8 +27935,8 @@ async function calcFilterModelBySchema(json, c) {
27929
27935
  });
27930
27936
  const codeNameToId = {};
27931
27937
  const dataEntity = await ibiz.hub.getAppDataEntity(
27932
- c.model.appDataEntityId,
27933
- c.model.appId
27938
+ appDataEntityId,
27939
+ modelAppId
27934
27940
  );
27935
27941
  (_a = dataEntity.appDEFields) == null ? void 0 : _a.forEach((field) => {
27936
27942
  codeNameToId[field.codeName.toLowerCase()] = field.id;
@@ -27960,6 +27966,72 @@ async function calcFilterModelBySchema(json, c) {
27960
27966
  return addSearchBarFilters;
27961
27967
  }
27962
27968
 
27969
+ // src/controller/control/search-bar/use-searchcond.ts
27970
+ import { RuntimeError as RuntimeError58, recursiveIterate as recursiveIterate9 } from "@ibiz-template/core";
27971
+ import { isNil as isNil25 } from "ramda";
27972
+ function getOriginFilterNodes() {
27973
+ return [
27974
+ {
27975
+ leaf: false,
27976
+ logicType: "AND",
27977
+ children: [{ leaf: true, field: null, valueOP: null, value: null }]
27978
+ }
27979
+ ];
27980
+ }
27981
+ function formatFilters(node) {
27982
+ if (!node.leaf) {
27983
+ return {
27984
+ condtype: "GROUP",
27985
+ condop: node.logicType,
27986
+ bnotmode: false,
27987
+ searchconds: node.children.map((item) => formatFilters(item))
27988
+ };
27989
+ }
27990
+ return {
27991
+ condtype: "DEFIELD",
27992
+ fieldname: node.field,
27993
+ condop: node.valueOP,
27994
+ value: node.value
27995
+ };
27996
+ }
27997
+ function parseFilters(data) {
27998
+ if (data.condtype === "GROUP") {
27999
+ return {
28000
+ leaf: false,
28001
+ logicType: data.condop === "AND" ? "AND" : "OR",
28002
+ children: (data.searchconds || []).map(
28003
+ (item) => parseFilters(item)
28004
+ )
28005
+ };
28006
+ }
28007
+ if (data.condtype === "DEFIELD") {
28008
+ return {
28009
+ leaf: true,
28010
+ field: data.fieldname || null,
28011
+ valueOP: data.condop || null,
28012
+ value: data.value || null
28013
+ };
28014
+ }
28015
+ throw new RuntimeError58("\u65E0\u6548\u7684condtype:".concat(data.condtype));
28016
+ }
28017
+ function calcSearchConds(filterNodes) {
28018
+ let hasFilter = false;
28019
+ let hasError = false;
28020
+ recursiveIterate9(filterNodes[0], (node) => {
28021
+ if (node.leaf) {
28022
+ if (node.field && node.valueOP && !isNil25(node.value)) {
28023
+ hasFilter = true;
28024
+ } else {
28025
+ hasError = true;
28026
+ }
28027
+ }
28028
+ });
28029
+ if (hasFilter && !hasError) {
28030
+ const filter = [formatFilters(filterNodes[0])];
28031
+ return filter;
28032
+ }
28033
+ }
28034
+
27963
28035
  // src/controller/control/search-bar/search-bar.controller.ts
27964
28036
  var SearchBarController = class extends ControlController {
27965
28037
  constructor() {
@@ -28004,7 +28076,7 @@ var SearchBarController = class extends ControlController {
28004
28076
  * @author lxm
28005
28077
  * @date 2024-01-05 10:10:37
28006
28078
  */
28007
- this.addSchemaFilters = false;
28079
+ this.addSchemaFilters = true;
28008
28080
  }
28009
28081
  /**
28010
28082
  * 启用自定义过滤项
@@ -28081,7 +28153,11 @@ var SearchBarController = class extends ControlController {
28081
28153
  if (!json) {
28082
28154
  return;
28083
28155
  }
28084
- const addSearchBarFilters = await calcFilterModelBySchema(json, this);
28156
+ const addSearchBarFilters = await calcFilterModelBySchema(
28157
+ json,
28158
+ this.model.appDataEntityId,
28159
+ this.model.appId
28160
+ );
28085
28161
  const mergeFilters = [];
28086
28162
  (_a = this.model.searchBarFilters) == null ? void 0 : _a.forEach((filter) => {
28087
28163
  const findindex = addSearchBarFilters.findIndex(
@@ -28183,7 +28259,7 @@ var SearchBarController = class extends ControlController {
28183
28259
  * @date 2023-10-16 03:52:44
28184
28260
  */
28185
28261
  resetFilter() {
28186
- this.state.filterNodes = this.getOriginFilterNodes();
28262
+ this.state.filterNodes = getOriginFilterNodes();
28187
28263
  this.evt.emit("onSearch", void 0);
28188
28264
  }
28189
28265
  /**
@@ -28197,7 +28273,12 @@ var SearchBarController = class extends ControlController {
28197
28273
  var _a;
28198
28274
  if ((_a = this.searchBarFilters) == null ? void 0 : _a.length) {
28199
28275
  this.searchBarFilters.forEach((item) => {
28200
- const filterController = new SearchBarFilterController(item, this);
28276
+ const filterController = new SearchBarFilterController(
28277
+ item,
28278
+ this.appDataEntity,
28279
+ this.context,
28280
+ this.params
28281
+ );
28201
28282
  this.filterControllers.push(filterController);
28202
28283
  });
28203
28284
  await Promise.all(
@@ -28215,86 +28296,8 @@ var SearchBarController = class extends ControlController {
28215
28296
  if (!this.enableFilter) {
28216
28297
  return;
28217
28298
  }
28218
- let hasFilter = false;
28219
- let hasError = false;
28220
- recursiveIterate9(this.state.filterNodes[0], (node) => {
28221
- if (node.leaf) {
28222
- if (node.field && node.valueOP && !isNil25(node.value)) {
28223
- hasFilter = true;
28224
- } else {
28225
- hasError = true;
28226
- }
28227
- }
28228
- });
28229
- if (hasFilter && !hasError) {
28230
- const filter = [this.formatFilters(this.state.filterNodes[0])];
28231
- return filter;
28232
- }
28233
- }
28234
- /**
28235
- * 格式化过滤项 (后续如果修改这里的逻辑记得把下方的反推函数parseFilters也跟着修改!)
28236
- * @author lxm
28237
- * @date 2023-10-16 03:45:41
28238
- * @param {IFilterNode} node
28239
- * @return {*} {IData}
28240
- */
28241
- formatFilters(node) {
28242
- if (!node.leaf) {
28243
- return {
28244
- condtype: "GROUP",
28245
- condop: node.logicType,
28246
- bnotmode: false,
28247
- searchconds: node.children.map((item) => this.formatFilters(item))
28248
- };
28249
- }
28250
- return {
28251
- condtype: "DEFIELD",
28252
- fieldname: node.field,
28253
- condop: node.valueOP,
28254
- value: node.value
28255
- };
28256
- }
28257
- /**
28258
- * 根据格式化后的过滤项反推出过滤项树节点数据集合
28259
- * @param {IData} data
28260
- * @return {*}
28261
- * @author: zhujiamin
28262
- * @Date: 2023-12-28 09:47:45
28263
- */
28264
- parseFilters(data) {
28265
- if (data.condtype === "GROUP") {
28266
- return {
28267
- leaf: false,
28268
- logicType: data.condop === "AND" ? "AND" : "OR",
28269
- children: (data.searchconds || []).map(
28270
- (item) => this.parseFilters(item)
28271
- )
28272
- };
28273
- }
28274
- if (data.condtype === "DEFIELD") {
28275
- return {
28276
- leaf: true,
28277
- field: data.fieldname || null,
28278
- valueOP: data.condop || null,
28279
- value: data.value || null
28280
- };
28281
- }
28282
- throw new RuntimeError58("\u65E0\u6548\u7684condtype:".concat(data.condtype));
28283
- }
28284
- /**
28285
- * 获取初始过滤项树节点数据集合
28286
- * @return {*}
28287
- * @author: zhujiamin
28288
- * @Date: 2023-12-21 17:29:47
28289
- */
28290
- getOriginFilterNodes() {
28291
- return [
28292
- {
28293
- leaf: false,
28294
- logicType: "AND",
28295
- children: [{ leaf: true, field: null, valueOP: null, value: null }]
28296
- }
28297
- ];
28299
+ const searchconds = calcSearchConds(this.state.filterNodes);
28300
+ return searchconds;
28298
28301
  }
28299
28302
  /**
28300
28303
  * 初始化搜索栏分组项(获取后台分组清单并合并模型)
@@ -28457,11 +28460,11 @@ var SearchBarController = class extends ControlController {
28457
28460
  }
28458
28461
  if (groupItem.searchGroupData && groupItem.searchGroupData.searchconds && groupItem.searchGroupData.searchconds.length > 0) {
28459
28462
  const filterNodes = groupItem.searchGroupData.searchconds.map(
28460
- (item) => this.parseFilters(item)
28463
+ (item) => parseFilters(item)
28461
28464
  );
28462
28465
  this.state.filterNodes = filterNodes;
28463
28466
  } else {
28464
- this.state.filterNodes = this.getOriginFilterNodes();
28467
+ this.state.filterNodes = getOriginFilterNodes();
28465
28468
  }
28466
28469
  if (this.grid && groupItem && groupItem.searchGroupData) {
28467
28470
  this.grid.setGroupParams(groupItem.searchGroupData);
@@ -35796,11 +35799,13 @@ export {
35796
35799
  calcDeCodeNameById,
35797
35800
  calcDynaClass,
35798
35801
  calcDynaSysParams,
35802
+ calcFilterModelBySchema,
35799
35803
  calcGridLayoutPos,
35800
35804
  calcLayoutHeightWidth,
35801
35805
  calcMainStateOPPrivsStrs,
35802
35806
  calcNavParams,
35803
35807
  calcResPath,
35808
+ calcSearchConds,
35804
35809
  compare,
35805
35810
  compareNumber,
35806
35811
  contains,
@@ -35821,6 +35826,7 @@ export {
35821
35826
  findEditItem,
35822
35827
  findFieldById,
35823
35828
  findModelChild,
35829
+ formatFilters,
35824
35830
  formatMultiData,
35825
35831
  generateEditorRules,
35826
35832
  generateRules,
@@ -35845,6 +35851,7 @@ export {
35845
35851
  getInternalMessageProvider,
35846
35852
  getMatchResPath,
35847
35853
  getOriginData,
35854
+ getOriginFilterNodes,
35848
35855
  getPFPlugin,
35849
35856
  getPanelItemProvider,
35850
35857
  getPlatformProvider,
@@ -35873,6 +35880,7 @@ export {
35873
35880
  isValueChange,
35874
35881
  matchMainState,
35875
35882
  openRedirectView,
35883
+ parseFilters,
35876
35884
  parseUserParams,
35877
35885
  presetAppCounterProvider,
35878
35886
  presetDEMethodProvider,