@airpower/web 1.2.1 → 1.2.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.
@@ -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/index.d.ts CHANGED
@@ -76,5 +76,6 @@ export * from './service/AbstractService';
76
76
  export * from './service/type';
77
77
  export * from './shared';
78
78
  export * from './type';
79
+ export * from './util/ClipboardUtil';
79
80
  export * from './validator/type';
80
81
  export * from './validator/WebValidator';
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
  }
@@ -18119,11 +18121,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18119
18121
  }
18120
18122
  const request = ref(new QueryRequestPage(EntityClass));
18121
18123
  function onExport() {
18122
- if (!props.service) {
18123
- FeedbackUtil.toastError("请先传入 service 参数");
18124
- return;
18125
- }
18126
- const service = Transformer.newInstance(props.service);
18124
+ const service = getService();
18127
18125
  const exportModel = new ExportModel();
18128
18126
  exportModel.param = request.value;
18129
18127
  exportModel.createExportTaskUrl = `${service.baseUrl}${WebConfig.exportUrl}`;
@@ -18295,14 +18293,22 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18295
18293
  hook.onEnable(row);
18296
18294
  }
18297
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
+ }
18298
18308
  async function onImport() {
18299
18309
  let url = props.importUrl;
18300
18310
  if (!url) {
18301
- if (!props.service) {
18302
- FeedbackUtil.toastError("请先传入 service 参数");
18303
- return;
18304
- }
18305
- const service = Transformer.newInstance(props.service);
18311
+ const service = getService();
18306
18312
  url = `${service.baseUrl}/${WebConfig.importUrl}`;
18307
18313
  url = getApiUrl(url);
18308
18314
  }
@@ -18342,11 +18348,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18342
18348
  window.open(WebConfig.apiUrl + getUrlWithAccessToken(url));
18343
18349
  return;
18344
18350
  }
18345
- if (!props.service) {
18346
- FeedbackUtil.toastError("请先传入 service 参数");
18347
- return;
18348
- }
18349
- const service = Transformer.newInstance(props.service);
18351
+ const service = getService();
18350
18352
  url = `${service.baseUrl}/${WebConfig.importTemplateUrl}`;
18351
18353
  url = getApiUrl(url);
18352
18354
  window.open(getUrlWithAccessToken(url));
@@ -20055,6 +20057,16 @@ class AbstractCurdService extends AbstractService {
20055
20057
  return entity;
20056
20058
  }
20057
20059
  }
20060
+ class ClipboardUtil {
20061
+ /**
20062
+ * ### 剪切板复制指定的内容
20063
+ * @param content 复制的内容
20064
+ */
20065
+ static async copy(content) {
20066
+ const { toClipboard } = useClipboard();
20067
+ return toClipboard(content);
20068
+ }
20069
+ }
20058
20070
  export {
20059
20071
  _sfc_main$v as AButton,
20060
20072
  ACall,
@@ -20086,6 +20098,7 @@ export {
20086
20098
  AbstractCurdService,
20087
20099
  AbstractService,
20088
20100
  Alias,
20101
+ ClipboardUtil,
20089
20102
  CryptoUtil,
20090
20103
  DateTimeFormatter,
20091
20104
  DateTimeType,
@@ -0,0 +1,12 @@
1
+ /**
2
+ * ### 剪贴板工具类
3
+ *
4
+ * @author Hamm.cn
5
+ */
6
+ export declare class ClipboardUtil {
7
+ /**
8
+ * ### 剪切板复制指定的内容
9
+ * @param content 复制的内容
10
+ */
11
+ static copy(content: string): Promise<unknown>;
12
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airpower/web",
3
3
  "type": "module",
4
- "version": "1.2.1",
4
+ "version": "1.2.3",
5
5
  "description": "AirPower-Web",
6
6
  "author": {
7
7
  "name": "Hamm",