@airpower/web 1.2.0 → 1.2.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.
@@ -68,8 +68,9 @@ export declare class FeedbackUtil {
68
68
  * @param message 消息
69
69
  * @param title 标题
70
70
  * @param type 类型
71
+ * @param dangerHtml 危险HTML
71
72
  */
72
- static showAlert(message: string, title?: string, type?: FeedbackType): Promise<void>;
73
+ static showAlert(message: string, title?: string, type?: FeedbackType, dangerHtml?: boolean): Promise<void>;
73
74
  /**
74
75
  * ### 显示弹窗成功
75
76
  * @param message 消息
package/dist/main.js CHANGED
@@ -2323,8 +2323,9 @@ class FeedbackUtil {
2323
2323
  * @param message 消息
2324
2324
  * @param title 标题
2325
2325
  * @param type 类型
2326
+ * @param dangerHtml 危险HTML
2326
2327
  */
2327
- static async showAlert(message, title = WebI18n.get().Alert, type = void 0) {
2328
+ static async showAlert(message, title = WebI18n.get().Alert, type = void 0, dangerHtml = false) {
2328
2329
  await ElMessageBox.alert(
2329
2330
  message,
2330
2331
  title,
@@ -2334,7 +2335,8 @@ class FeedbackUtil {
2334
2335
  closeOnClickModal: false,
2335
2336
  closeOnPressEscape: true,
2336
2337
  draggable: true,
2337
- overflow: false
2338
+ overflow: false,
2339
+ dangerouslyUseHTMLString: dangerHtml
2338
2340
  }
2339
2341
  );
2340
2342
  }
@@ -9000,18 +9002,21 @@ function requireCryptoJs() {
9000
9002
  }
9001
9003
  var cryptoJsExports = requireCryptoJs();
9002
9004
  const CryptoJS = /* @__PURE__ */ getDefaultExportFromCjs(cryptoJsExports);
9003
- var __defProp$4 = Object.defineProperty;
9004
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9005
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
9006
9005
  class Enum {
9006
+ /**
9007
+ * ### 枚举的值
9008
+ */
9009
+ key;
9010
+ /**
9011
+ * ### 枚举的描述
9012
+ */
9013
+ label;
9007
9014
  /**
9008
9015
  * ### 实例化创建一个枚举项目
9009
9016
  * @param key 枚举值
9010
9017
  * @param label 枚举描述
9011
9018
  */
9012
9019
  constructor(key, label) {
9013
- __publicField(this, "key");
9014
- __publicField(this, "label");
9015
9020
  this.key = key;
9016
9021
  if (label) {
9017
9022
  this.label = label;
@@ -9031,7 +9036,7 @@ class Enum {
9031
9036
  */
9032
9037
  static getLabel(key, defaultLabel = "-") {
9033
9038
  const item = this.get(key);
9034
- return (item == null ? void 0 : item.label) || defaultLabel;
9039
+ return item?.label || defaultLabel;
9035
9040
  }
9036
9041
  /**
9037
9042
  * ### 将枚举转为数组
@@ -18116,11 +18121,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18116
18121
  }
18117
18122
  const request = ref(new QueryRequestPage(EntityClass));
18118
18123
  function onExport() {
18119
- if (!props.service) {
18120
- FeedbackUtil.toastError("请先传入 service 参数");
18121
- return;
18122
- }
18123
- const service = Transformer.newInstance(props.service);
18124
+ const service = getService();
18124
18125
  const exportModel = new ExportModel();
18125
18126
  exportModel.param = request.value;
18126
18127
  exportModel.createExportTaskUrl = `${service.baseUrl}${WebConfig.exportUrl}`;
@@ -18292,14 +18293,22 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18292
18293
  hook.onEnable(row);
18293
18294
  }
18294
18295
  }
18296
+ function getService() {
18297
+ let service;
18298
+ if (props.service) {
18299
+ service = Transformer.newInstance(props.service);
18300
+ } else if (props.useHook) {
18301
+ service = props.useHook.service;
18302
+ } else {
18303
+ FeedbackUtil.toastError("请先传入 service 参数");
18304
+ throw new Error("请先传入 service 参数");
18305
+ }
18306
+ return service;
18307
+ }
18295
18308
  async function onImport() {
18296
18309
  let url = props.importUrl;
18297
18310
  if (!url) {
18298
- if (!props.service) {
18299
- FeedbackUtil.toastError("请先传入 service 参数");
18300
- return;
18301
- }
18302
- const service = Transformer.newInstance(props.service);
18311
+ const service = getService();
18303
18312
  url = `${service.baseUrl}/${WebConfig.importUrl}`;
18304
18313
  url = getApiUrl(url);
18305
18314
  }
@@ -18339,11 +18348,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18339
18348
  window.open(WebConfig.apiUrl + getUrlWithAccessToken(url));
18340
18349
  return;
18341
18350
  }
18342
- if (!props.service) {
18343
- FeedbackUtil.toastError("请先传入 service 参数");
18344
- return;
18345
- }
18346
- const service = Transformer.newInstance(props.service);
18351
+ const service = getService();
18347
18352
  url = `${service.baseUrl}/${WebConfig.importTemplateUrl}`;
18348
18353
  url = getApiUrl(url);
18349
18354
  window.open(getUrlWithAccessToken(url));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airpower/web",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.2.2",
5
5
  "description": "AirPower-Web",
6
6
  "author": {
7
7
  "name": "Hamm",
@@ -39,10 +39,10 @@
39
39
  },
40
40
  "peerDependencies": {},
41
41
  "dependencies": {
42
- "@airpower/enum": "^1.2.0",
42
+ "@airpower/enum": "^1.2.1",
43
43
  "@airpower/i18n": "^1.2.0",
44
44
  "@airpower/transformer": "^1.2.0",
45
- "@airpower/util": "^1.2.0",
45
+ "@airpower/util": "^1.2.1",
46
46
  "@element-plus/icons-vue": "^2.3.1",
47
47
  "axios": "^1.10.0",
48
48
  "element-plus": "^2.10.3",