cosey 0.6.20 → 0.6.22

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.
@@ -71,8 +71,7 @@ var stdin_default = defineComponent((props, {
71
71
  style: {
72
72
  display: "flex",
73
73
  flexWrap: "wrap",
74
- columnGap: "30px",
75
- rowGap: "12px"
74
+ columnGap: "30px"
76
75
  }
77
76
  }), () => convertedOptions.value.map((item, index) => renderCheckbox(item, index)));
78
77
  return componentProps.value.indeterminate ? h(stdin_default$1, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.6.20",
3
+ "version": "0.6.22",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -2,12 +2,13 @@ import { type ElMessageBoxOptions } from 'element-plus';
2
2
  import { type VNode } from 'vue';
3
3
  export declare function warningConfirm(message: string | VNode | (() => VNode), options?: ElMessageBoxOptions): CustomPromise<unknown>;
4
4
  declare class CustomPromise<T> extends Promise<T> {
5
- onfulfilled: ((value: any) => any | PromiseLike<any>) | undefined | null;
6
- onrejected: ((reason?: any) => any | PromiseLike<any>) | undefined | null;
7
- onfinally: (() => void) | undefined | null;
5
+ _onFulfilled: ((value: any) => any | PromiseLike<any>) | undefined | null;
6
+ _onRejected: ((reason?: any) => any | PromiseLike<any>) | undefined | null;
7
+ _resolve: null | ((value: any | PromiseLike<any>) => void);
8
+ _reject: null | ((reason?: any) => void);
8
9
  constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void);
9
- then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
10
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
11
- finally(onfinally?: (() => void) | undefined | null): Promise<T>;
10
+ then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
11
+ catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
12
+ finally(onFinally?: (() => void) | undefined | null): Promise<T>;
12
13
  }
13
14
  export {};
@@ -22,41 +22,52 @@ function warningConfirm(message, options) {
22
22
  if (action === "confirm") {
23
23
  instance.confirmButtonLoading = true;
24
24
  try {
25
- await promise.onfulfilled?.(void 0);
25
+ const res = await promise._onFulfilled?.(void 0);
26
+ promise._resolve?.(res);
26
27
  done();
27
28
  } catch (err) {
28
- promise.onrejected?.(err);
29
+ promise._onRejected?.(err);
30
+ promise._reject?.(err);
29
31
  } finally {
30
32
  instance.confirmButtonLoading = false;
31
33
  }
32
34
  } else {
33
35
  done();
34
- promise.onrejected?.(void 0);
36
+ promise._onRejected?.(void 0);
37
+ promise._reject?.();
35
38
  }
36
- promise.onfinally?.();
37
39
  }
38
40
  });
39
41
  return promise;
40
42
  }
41
43
  class CustomPromise extends Promise {
42
- onfulfilled;
43
- onrejected;
44
- onfinally;
44
+ _onFulfilled;
45
+ _onRejected;
46
+ _resolve = null;
47
+ _reject = null;
45
48
  constructor(executor) {
46
49
  super(executor);
47
50
  }
48
- then(onfulfilled, onrejected) {
49
- this.onfulfilled = onfulfilled;
50
- this.onrejected = onrejected;
51
- return super.then(onfulfilled, onrejected);
51
+ then(onFulfilled, onRejected) {
52
+ this._onFulfilled = onFulfilled;
53
+ this._onRejected = onRejected;
54
+ return new Promise((resolve, reject) => {
55
+ this._resolve = resolve;
56
+ this._reject = reject;
57
+ });
52
58
  }
53
- catch(onrejected) {
54
- this.onrejected = onrejected;
55
- return super.catch(onrejected);
59
+ catch(onRejected) {
60
+ return this.then(null, onRejected);
56
61
  }
57
- finally(onfinally) {
58
- this.onfinally = onfinally;
59
- return super.finally(onfinally);
62
+ finally(onFinally) {
63
+ return this.then(
64
+ () => {
65
+ onFinally?.();
66
+ },
67
+ () => {
68
+ onFinally?.();
69
+ }
70
+ );
60
71
  }
61
72
  }
62
73