@ibiz-template/core 0.7.38-alpha.57 → 0.7.39

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 千反田丷
3
+ Copyright (c) 2022-present, iBiz
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # @ibiz-template/core
2
+
3
+ 运行时核心库是项目运行时的核心依赖库,主要提供公共的、通用性的工具、常量和接口定义。
4
+
5
+ ## 📂 项目结构
6
+
7
+ ```javascript
8
+ |─ ─ core
9
+ |─ ─ scripts 工具脚本文件夹
10
+ |─ ─ src 项目工程文件夹
11
+ |─ ─ command 指令文件夹
12
+ |─ ─ command-register.ts 指令注册类
13
+ |─ ─ command.ts 指令控制器类
14
+ |─ ─ interface 指令接口声明
15
+ |─ ─ utils 指令工具方法
16
+ |─ ─ constant 运行时核心常量文件夹
17
+ |─ ─ core 核心全局静态变量类
18
+ |─ ─ emoji 表情符号常量
19
+ |─ ─ http-status-message HTTP 状态码对应的消息
20
+ |─ ─ login-mode 登录模式效验
21
+ |─ ─ menu-permission-mode 菜单权限校验模式定义
22
+ |─ ─ util 工具类常量
23
+ |─ ─ context 上下文处理类
24
+ |─ ─ environment 环境变量默认值
25
+ |─ ─ error 异常类型文件夹
26
+ |─ ─ http-error 网络请求错误
27
+ |─ ─ model-error 模型错误
28
+ |─ ─ notice-error 通知错误
29
+ |─ ─ runtime-error 运行时错误
30
+ |─ ─ runtime-model-error 运行时模型错误
31
+ |─ ─ interface 通用接口声明
32
+ |─ ─ locale 多语言文件夹
33
+ |─ ─ params 视图参数
34
+ |─ ─ utils 通用工具方法文件夹
35
+ |─ ─ bit-mask 权限工具
36
+ |─ ─ click-outside 点击外部区域检测工具
37
+ |─ ─ clone 克隆工具
38
+ |─ ─ color 颜色处理工具
39
+ |─ ─ cookie-util Cookie 操作工具
40
+ |─ ─ data-type 数据类型判断工具
41
+ |─ ─ download-file 文件下载工具
42
+ |─ ─ event 事件管理工具
43
+ |─ ─ history-list 历史记录管理工具
44
+ |─ ─ interceptor 拦截器工具
45
+ |─ ─ logger 日志记录工具
46
+ |─ ─ message-center 消息中心工具文件夹
47
+ |─ ─ base 消息基础模块定义
48
+ |─ ─ command 指令消息文件夹
49
+ |─ ─ add-in-changed 添加变更指令消息
50
+ |─ ─ async-action 异步操作指令消息
51
+ |─ ─ change 数据变更指令消息
52
+ |─ ─ command-base 指令消息基类
53
+ |─ ─ create 创建指令消息
54
+ |─ ─ internal-message 内部消息
55
+ |─ ─ mark-open-data 标记打开数据指令消息
56
+ |─ ─ remove 删除指令消息
57
+ |─ ─ update 更新指令消息
58
+ |─ ─ message-command.ts 指令消息类文件
59
+ |─ ─ console 日志消息
60
+ |─ ─ error 错误消息
61
+ |─ ─ interface 消息接口声明
62
+ |─ ─ message-center.ts 界面消息中心类
63
+ |─ ─ namespace 全局样式处理命名空间工具
64
+ |─ ─ net 全局请求工具
65
+ |─ ─ recursive 递归操作工具
66
+ |─ ─ string-util 字符串处理工具
67
+ |─ ─ style 远程样式处理工具
68
+ |─ ─ sync 同步操作工具文件夹
69
+ |─ ─ await-timeout.ts 异步超时工具
70
+ |─ ─ count-latch.ts 计数插销工具类
71
+ |─ ─ types 工具类型定义文件夹
72
+ |─ ─ upload 文件上传工具
73
+ |─ ─ url-helper URL 路径解析助手
74
+ |─ ─ util 通用工具集合
75
+ |─ ─ ibizsys.ts 全局对象类
76
+ |─ ─ install.ts 安装工具
77
+ |─ ─ types.ts 全局类型定义文件
78
+ |─ ─ test 测试文件夹
79
+ |─ ─ command 指令模块相关测试
80
+ |─ ─ setup.ts 测试环境初始化文件
81
+ |─ ─ utils 工具函数测试集合
82
+ |─ ─ bit-mask 权限工具测试
83
+ |─ ─ click-outside 点击外部区域检测测试
84
+ |─ ─ clone 克隆测试
85
+ |─ ─ color 颜色工具测试
86
+ |─ ─ download-file 文件下载测试
87
+ |─ ─ event 事件管理测试
88
+ |─ ─ history-list 历史记录测试
89
+ |─ ─ message-center 消息中心测试
90
+ |─ ─ namespace 命名空间管理测试
91
+ |─ ─ net 网络请求测试
92
+ |─ ─ recursive 递归操作测试
93
+ |─ ─ string-util 字符串工具测试
94
+ |─ ─ style 远程样式处理测试
95
+ |─ ─ sync 同步操作测试
96
+ |─ ─ types 类型定义测试
97
+ |─ ─ util 工具测试
98
+ ```
99
+
100
+ ## 📌 更改日志
101
+
102
+ 每个版本的详细更改记录在[发行说明](CHANGELOG.md)中。
103
+
104
+ ## 📜 许可证
105
+
106
+ [MIT](LICENSE)
package/dist/index.esm.js CHANGED
@@ -3847,7 +3847,12 @@ var Environment = {
3847
3847
  cookieDomain: "",
3848
3848
  appLoadingTheme: "DEFAULT",
3849
3849
  environmentTag: "development",
3850
- mobMenuShowMode: "DEFAULT"
3850
+ mobMenuShowMode: "DEFAULT",
3851
+ devtoolConfig: {
3852
+ studioBaseUrl: "https://open.ibizlab.cn/modeldesign/#/",
3853
+ v9Mode: false
3854
+ },
3855
+ enableAI: true
3851
3856
  };
3852
3857
 
3853
3858
  // src/error/http-error/http-error.ts
@@ -4309,6 +4314,11 @@ var Interceptor = class {
4309
4314
  * @param {AxiosInstance} instance
4310
4315
  */
4311
4316
  use(instance) {
4317
+ this.instance = instance;
4318
+ this.onBeforeRequest = this.onBeforeRequest.bind(this);
4319
+ this.onRequestError = this.onRequestError.bind(this);
4320
+ this.onResponseSuccess = this.onResponseSuccess.bind(this);
4321
+ this.onResponseError = this.onResponseError.bind(this);
4312
4322
  this.requestTag = instance.interceptors.request.use(
4313
4323
  this.onBeforeRequest,
4314
4324
  this.onRequestError
@@ -4360,6 +4370,52 @@ var CoreInterceptor = class extends Interceptor {
4360
4370
  headers.set("srfsystemid", systemId);
4361
4371
  return config;
4362
4372
  }
4373
+ /**
4374
+ * 响应失败之后处理
4375
+ *
4376
+ * @author tony001
4377
+ * @date 2025-03-24 14:03:23
4378
+ * @protected
4379
+ * @param {Error} error
4380
+ * @return {*} {Promise<never>}
4381
+ */
4382
+ async onResponseError(error) {
4383
+ const { config, response } = error;
4384
+ if (this.instance && (response == null ? void 0 : response.status) === 401 && config && !config._retry && config.url && // 排除获取系统信息、应用数据、刷新 token 预定义接口
4385
+ (config.url.indexOf("/uaa/getbydcsystem/") === -1 || config.url.indexOf("/appdata") !== -1 || config.url.indexOf("/uaa/refresh_token/") !== -1)) {
4386
+ try {
4387
+ config._retry = true;
4388
+ await ibiz.auth.refreshToken();
4389
+ const res = await ibiz.net.get("/appdata");
4390
+ if (res && res.ok) {
4391
+ ibiz.appData = res.data;
4392
+ }
4393
+ const { headers } = config;
4394
+ const token = getToken();
4395
+ if (token) {
4396
+ headers.set(
4397
+ "".concat(ibiz.env.tokenHeader, "Authorization"),
4398
+ "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(token)
4399
+ );
4400
+ }
4401
+ let systemId = ibiz.env.dcSystem;
4402
+ const { orgData } = ibiz;
4403
+ if (orgData) {
4404
+ if (orgData.systemid) {
4405
+ systemId = orgData.systemid;
4406
+ }
4407
+ if (orgData.orgid) {
4408
+ headers.set("srforgid", orgData.orgid);
4409
+ }
4410
+ }
4411
+ headers.set("srfsystemid", systemId);
4412
+ return this.instance(config);
4413
+ } catch (err) {
4414
+ return Promise.reject(error);
4415
+ }
4416
+ }
4417
+ return Promise.reject(error);
4418
+ }
4363
4419
  };
4364
4420
 
4365
4421
  // src/utils/message-center/base/message-base.ts
@@ -5433,18 +5489,18 @@ var StringUtil = class {
5433
5489
  * @description 填充字符串中的数据 用法:传入需要替换的字符串和对象 返回值是string类型
5434
5490
  * @example
5435
5491
  * ```
5436
- * StringUtil.fill('姓名:${context.name},年龄:${data.age}', { name: '张三', age: 10 }, { name: '李四', age: 25 }); // => '姓名:张三,年龄:25'
5437
- * StringUtil.fill('', { name: '张三', age: 10 }, { name: '李四', age: 25 }); // => ''
5492
+ * StringUtil.fill('姓名:${context.name},年龄:${data.age}', { name: '张三', age: 10 }, {name: '王二', age: 19}, { name: '李四', age: 25 }); // => '姓名:张三,年龄:25'
5493
+ * StringUtil.fill('', { name: '张三', age: 10 }, {name: '王二', age: 19}, { name: '李四', age: 25 }); // => ''
5438
5494
  * ```
5439
- * @author chitanda
5440
- * @date 2021-04-23 20:04:17
5441
5495
  * @static
5442
- * @param {string} str
5443
- * @param {*} [context]
5444
- * @param {*} [data]
5496
+ * @param {string} str 需填充字符串
5497
+ * @param {IContext} [context] 上下文
5498
+ * @param {IParams} [params] 参数
5499
+ * @param {IData} [data] 数据
5445
5500
  * @return {*} {string}
5501
+ * @memberof StringUtil
5446
5502
  */
5447
- static fill(str, context, data) {
5503
+ static fill(str, context, params, data) {
5448
5504
  if (notNilEmpty2(str)) {
5449
5505
  if (notNilEmpty2(context)) {
5450
5506
  const strArr = str.match(this.contextReg);
@@ -5453,6 +5509,15 @@ var StringUtil = class {
5453
5509
  str = str.replace("${context.".concat(key, "}"), context[key] || "");
5454
5510
  });
5455
5511
  }
5512
+ if (notNilEmpty2(params)) {
5513
+ const strArr = str.match(this.paramsReg);
5514
+ strArr == null ? void 0 : strArr.forEach((_key) => {
5515
+ const key = _key.slice(8, _key.length - 1);
5516
+ if (params[key]) {
5517
+ str = str.replace("${params.".concat(key, "}"), params[key]);
5518
+ }
5519
+ });
5520
+ }
5456
5521
  if (notNilEmpty2(data)) {
5457
5522
  const strArr = str.match(this.dataReg);
5458
5523
  strArr == null ? void 0 : strArr.forEach((_key) => {
@@ -5480,6 +5545,13 @@ StringUtil.contextReg = /\$\{context.[a-zA-Z_$][a-zA-Z0-9_$]{1,}\}/g;
5480
5545
  * @static
5481
5546
  */
5482
5547
  StringUtil.dataReg = /\$\{data.[a-zA-Z_$][a-zA-Z0-9_$]{1,}\}/g;
5548
+ /**
5549
+ * 参数替换正则
5550
+ *
5551
+ * @static
5552
+ * @memberof StringUtil
5553
+ */
5554
+ StringUtil.paramsReg = /\$\{params.[a-zA-Z_$][a-zA-Z0-9_$]{1,}\}/g;
5483
5555
 
5484
5556
  // src/utils/url-helper/url-helper.ts
5485
5557
  var UrlHelper = class {