@ibiz-template/runtime 0.5.0-beta.1 → 0.5.0-beta.3

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
@@ -6772,6 +6772,21 @@ var AuthorityService = class {
6772
6772
  import { CoreConst } from "@ibiz-template/core";
6773
6773
  import { clearCookie, getCookie, setCookie } from "qx-util";
6774
6774
  var V7AuthService = class {
6775
+ constructor() {
6776
+ this.isAnonymous = false;
6777
+ }
6778
+ async anonymousLogin() {
6779
+ const { anonymousUser, anonymousPwd } = ibiz.env;
6780
+ if (!anonymousUser || !anonymousPwd) {
6781
+ ibiz.log.error("\u672A\u627E\u5230\u533F\u540D\u767B\u5F55\u914D\u7F6E\u7528\u6237\u540D\u6216\u5BC6\u7801");
6782
+ return false;
6783
+ }
6784
+ const result = await this.login(anonymousUser, anonymousPwd);
6785
+ if (result) {
6786
+ this.isAnonymous = true;
6787
+ }
6788
+ return result;
6789
+ }
6775
6790
  async login(loginName, password, remember) {
6776
6791
  try {
6777
6792
  const res = await ibiz.net.post("/v7/login", {
@@ -6958,7 +6973,7 @@ var MethodDto = class _MethodDto {
6958
6973
  * @param {IData} data
6959
6974
  * @return {*} {Promise<IData>}
6960
6975
  */
6961
- async get(context, data) {
6976
+ async get(context, data, ignore = false) {
6962
6977
  const params = {};
6963
6978
  const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
6964
6979
  for (let i = 0; i < this.fields.length; i++) {
@@ -6976,7 +6991,7 @@ var MethodDto = class _MethodDto {
6976
6991
  params[key] = data[key].length === 0 ? null : this.convertArrayToListMap(data[key]);
6977
6992
  }
6978
6993
  } else {
6979
- if (data[key] !== void 0) {
6994
+ if (data[key] !== void 0 && ignore === false) {
6980
6995
  break;
6981
6996
  }
6982
6997
  if (!field.refAppDataEntityId) {
@@ -6999,7 +7014,7 @@ var MethodDto = class _MethodDto {
6999
7014
  if (items) {
7000
7015
  const arr = [];
7001
7016
  for (let j = 0; j < items.length; j++) {
7002
- arr.push(await dto.get(context, items[j]));
7017
+ arr.push(await dto.get(context, items[j], true));
7003
7018
  }
7004
7019
  params[key] = arr;
7005
7020
  }
@@ -16811,7 +16826,7 @@ var LoginOutUIActionProvider = class extends UIActionProviderBase {
16811
16826
  desc: "\u60A8\u786E\u5B9A\u8981\u9000\u51FA\u767B\u5F55\u5417\uFF1F\u9000\u51FA\u540E\u60A8\u5C06\u65E0\u6CD5\u7EE7\u7EED\u8BBF\u95EE\u5DF2\u767B\u5F55\u72B6\u6001\u7684\u529F\u80FD\u548C\u4FE1\u606F\uFF0C\u8BF7\u786E\u4FDD\u60A8\u5DF2\u4FDD\u5B58\u6240\u6709\u672A\u5B8C\u6210\u7684\u64CD\u4F5C\u3002"
16812
16827
  });
16813
16828
  if (confirm) {
16814
- const bol = await ibiz.auth.logout();
16829
+ const bol = await ibiz.hub.controller.logout();
16815
16830
  if (bol) {
16816
16831
  window.location.reload();
16817
16832
  }
@@ -21647,7 +21662,8 @@ var EditFormController = class extends FormController {
21647
21662
  * @param {IData} data
21648
21663
  */
21649
21664
  setSimpleData(data) {
21650
- const cloneData = { ...data };
21665
+ const UIData = this.service.toUIData(data);
21666
+ const cloneData = UIData.clone();
21651
21667
  this.formItems.forEach((item) => {
21652
21668
  if (!Object.prototype.hasOwnProperty.call(cloneData, item.name)) {
21653
21669
  cloneData[item.name] = null;
@@ -28908,8 +28924,16 @@ var HubController = class {
28908
28924
  login(loginName, password) {
28909
28925
  return ibiz.auth.login(loginName, password);
28910
28926
  }
28911
- logout() {
28912
- return ibiz.auth.logout();
28927
+ async logout() {
28928
+ const bol = await ibiz.auth.logout();
28929
+ if (bol) {
28930
+ const l = window.location;
28931
+ if (l.search.indexOf("isAnonymous=true") !== -1) {
28932
+ const href = "".concat(l.origin).concat(l.pathname).concat(l.hash);
28933
+ window.history.replaceState({}, "", href);
28934
+ }
28935
+ }
28936
+ return bol;
28913
28937
  }
28914
28938
  };
28915
28939