@94ai/nf-confirm 9.0.0 → 10.0.0

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/lib/index.d.ts CHANGED
@@ -1,70 +1,70 @@
1
- import { PluginObject } from 'vue-demi';
2
- import Main from './main';
3
- declare const _default: import("vue/types/v3-component-public-instance").ComponentPublicInstanceConstructor<import("vue/types/v3-component-public-instance").Vue3Instance<{
4
- visible: boolean;
5
- width: number;
6
- title: string;
7
- message: string;
8
- type: string;
9
- customClass: string;
10
- iconClass: string;
11
- cancelButtonText: undefined;
12
- confirmButtonText: undefined;
13
- loading: boolean;
14
- onCancel: null;
15
- onConfirm: null;
16
- callback: null;
17
- dangerouslyUseHTMLString: boolean;
18
- }, Readonly<import("vue-demi").ExtractPropTypes<{}>>, Readonly<import("vue-demi").ExtractPropTypes<{}>>, {}, {}, true, import("vue/types/v3-component-options").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any>> & Readonly<Readonly<import("vue-demi").ExtractPropTypes<{}>>> & import("vue-demi").ShallowUnwrapRef<any> & {
19
- visible: boolean;
20
- width: number;
21
- title: string;
22
- message: string;
23
- type: string;
24
- customClass: string;
25
- iconClass: string;
26
- cancelButtonText: undefined;
27
- confirmButtonText: undefined;
28
- loading: boolean;
29
- onCancel: null;
30
- onConfirm: null;
31
- callback: null;
32
- dangerouslyUseHTMLString: boolean;
33
- } & import("vue/types/v3-component-options").ExtractComputedReturns<import("vue-demi").ComponentComputedOptions & {
34
- localeText(): {
35
- cancelButtonText: any;
36
- confirmButtonText: any;
37
- };
38
- typeClass(): string;
39
- }> & {
40
- t(path: string, params?: Record<string, any> | undefined): string;
41
- } & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{}>>, any, any, any, import("vue-demi").ComponentComputedOptions, import("vue-demi").ComponentMethodOptions> & import("vue/types/v3-component-options").ComponentOptionsBase<Readonly<import("vue-demi").ExtractPropTypes<{}>>, any, {
42
- visible: boolean;
43
- width: number;
44
- title: string;
45
- message: string;
46
- type: string;
47
- customClass: string;
48
- iconClass: string;
49
- cancelButtonText: undefined;
50
- confirmButtonText: undefined;
51
- loading: boolean;
52
- onCancel: null;
53
- onConfirm: null;
54
- callback: null;
55
- dangerouslyUseHTMLString: boolean;
56
- }, {
57
- localeText(): {
58
- cancelButtonText: any;
59
- confirmButtonText: any;
60
- };
61
- typeClass(): string;
62
- }, {}, {
63
- methods: {
64
- t(path: string, params?: Record<string, any> | undefined): string;
65
- };
66
- }, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, {}> & {
67
- props: {};
68
- } & PluginObject<undefined>;
69
- export default _default;
70
- export { Main as Confirm };
1
+ import { PluginObject } from 'vue-demi';
2
+ import Main from './main';
3
+ declare const _default: import("vue/types/v3-component-public-instance").ComponentPublicInstanceConstructor<import("vue/types/v3-component-public-instance").Vue3Instance<{
4
+ visible: boolean;
5
+ width: number;
6
+ title: string;
7
+ message: string;
8
+ type: string;
9
+ customClass: string;
10
+ iconClass: string;
11
+ cancelButtonText: undefined;
12
+ confirmButtonText: undefined;
13
+ loading: boolean;
14
+ onCancel: null;
15
+ onConfirm: null;
16
+ callback: null;
17
+ dangerouslyUseHTMLString: boolean;
18
+ }, Readonly<import("vue-demi").ExtractPropTypes<{}>>, Readonly<import("vue-demi").ExtractPropTypes<{}>>, {}, {}, true, import("vue/types/v3-component-options").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any>> & Readonly<Readonly<import("vue-demi").ExtractPropTypes<{}>>> & import("vue-demi").ShallowUnwrapRef<any> & {
19
+ visible: boolean;
20
+ width: number;
21
+ title: string;
22
+ message: string;
23
+ type: string;
24
+ customClass: string;
25
+ iconClass: string;
26
+ cancelButtonText: undefined;
27
+ confirmButtonText: undefined;
28
+ loading: boolean;
29
+ onCancel: null;
30
+ onConfirm: null;
31
+ callback: null;
32
+ dangerouslyUseHTMLString: boolean;
33
+ } & import("vue/types/v3-component-options").ExtractComputedReturns<import("vue-demi").ComponentComputedOptions & {
34
+ localeText(): {
35
+ cancelButtonText: any;
36
+ confirmButtonText: any;
37
+ };
38
+ typeClass(): string;
39
+ }> & {
40
+ t(path: string, params?: Record<string, any> | undefined): string;
41
+ } & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{}>>, any, any, any, import("vue-demi").ComponentComputedOptions, import("vue-demi").ComponentMethodOptions> & import("vue/types/v3-component-options").ComponentOptionsBase<Readonly<import("vue-demi").ExtractPropTypes<{}>>, any, {
42
+ visible: boolean;
43
+ width: number;
44
+ title: string;
45
+ message: string;
46
+ type: string;
47
+ customClass: string;
48
+ iconClass: string;
49
+ cancelButtonText: undefined;
50
+ confirmButtonText: undefined;
51
+ loading: boolean;
52
+ onCancel: null;
53
+ onConfirm: null;
54
+ callback: null;
55
+ dangerouslyUseHTMLString: boolean;
56
+ }, {
57
+ localeText(): {
58
+ cancelButtonText: any;
59
+ confirmButtonText: any;
60
+ };
61
+ typeClass(): string;
62
+ }, {}, {
63
+ methods: {
64
+ t(path: string, params?: Record<string, any> | undefined): string;
65
+ };
66
+ }, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, {}> & {
67
+ props: {};
68
+ } & PluginObject<undefined>;
69
+ export default _default;
70
+ export { Main as Confirm };
package/lib/main.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const Confirm: (options: any) => Promise<unknown> | undefined;
2
- export default Confirm;
1
+ declare const Confirm: (options: any) => Promise<unknown> | undefined;
2
+ export default Confirm;
@@ -139,7 +139,6 @@ function merge(target) {
139
139
  return target;
140
140
  }
141
141
  const ConfirmConstructor = vueDemi.Vue2.extend(NfConfirm);
142
- let currentMsg = null;
143
142
  const Confirm = function(options) {
144
143
  var _a;
145
144
  if ((_a = vueDemi.Vue2.prototype) == null ? void 0 : _a.$isServer)
@@ -148,21 +147,18 @@ const Confirm = function(options) {
148
147
  const instance = new ConfirmConstructor({
149
148
  data: options
150
149
  });
151
- instance.callback = defaultCallBack;
152
150
  instance.$mount();
153
151
  document.body.appendChild(instance.$el);
154
152
  instance.visible = true;
155
153
  return new Promise((resolve, reject) => {
156
- currentMsg = { resolve, reject };
154
+ instance.callback = (action, done) => {
155
+ if (action === "confirm")
156
+ resolve(done);
157
+ else
158
+ reject();
159
+ };
157
160
  });
158
161
  };
159
- const defaultCallBack = (action, done) => {
160
- if (action === "confirm") {
161
- currentMsg.resolve(done);
162
- } else {
163
- currentMsg.reject();
164
- }
165
- };
166
162
  NfConfirm.install = (app) => {
167
163
  app.component("nf-confirm", NfConfirm);
168
164
  app.prototype.$openConfirm = Confirm;
@@ -137,7 +137,6 @@ function merge(target) {
137
137
  return target;
138
138
  }
139
139
  const ConfirmConstructor = Vue2.extend(NfConfirm);
140
- let currentMsg = null;
141
140
  const Confirm = function(options) {
142
141
  var _a;
143
142
  if ((_a = Vue2.prototype) == null ? void 0 : _a.$isServer)
@@ -146,21 +145,18 @@ const Confirm = function(options) {
146
145
  const instance = new ConfirmConstructor({
147
146
  data: options
148
147
  });
149
- instance.callback = defaultCallBack;
150
148
  instance.$mount();
151
149
  document.body.appendChild(instance.$el);
152
150
  instance.visible = true;
153
151
  return new Promise((resolve, reject) => {
154
- currentMsg = { resolve, reject };
152
+ instance.callback = (action, done) => {
153
+ if (action === "confirm")
154
+ resolve(done);
155
+ else
156
+ reject();
157
+ };
155
158
  });
156
159
  };
157
- const defaultCallBack = (action, done) => {
158
- if (action === "confirm") {
159
- currentMsg.resolve(done);
160
- } else {
161
- currentMsg.reject();
162
- }
163
- };
164
160
  NfConfirm.install = (app) => {
165
161
  app.component("nf-confirm", NfConfirm);
166
162
  app.prototype.$openConfirm = Confirm;
@@ -1,27 +1,27 @@
1
- declare var _default: import("vue-demi").DefineComponent<{}, any, {
2
- visible: boolean;
3
- width: number;
4
- title: string;
5
- message: string;
6
- type: string;
7
- customClass: string;
8
- iconClass: string;
9
- cancelButtonText: undefined;
10
- confirmButtonText: undefined;
11
- loading: boolean;
12
- onCancel: null;
13
- onConfirm: null;
14
- callback: null;
15
- dangerouslyUseHTMLString: boolean;
16
- }, {
17
- localeText(): {
18
- cancelButtonText: any;
19
- confirmButtonText: any;
20
- };
21
- typeClass(): string;
22
- }, {}, {
23
- methods: {
24
- t(path: string, params?: Record<string, any> | undefined): string;
25
- };
26
- }, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue-demi").ExtractPropTypes<{}>>, {}>;
27
- export default _default;
1
+ declare var _default: import("vue-demi").DefineComponent<{}, any, {
2
+ visible: boolean;
3
+ width: number;
4
+ title: string;
5
+ message: string;
6
+ type: string;
7
+ customClass: string;
8
+ iconClass: string;
9
+ cancelButtonText: undefined;
10
+ confirmButtonText: undefined;
11
+ loading: boolean;
12
+ onCancel: null;
13
+ onConfirm: null;
14
+ callback: null;
15
+ dangerouslyUseHTMLString: boolean;
16
+ }, {
17
+ localeText(): {
18
+ cancelButtonText: any;
19
+ confirmButtonText: any;
20
+ };
21
+ typeClass(): string;
22
+ }, {}, {
23
+ methods: {
24
+ t(path: string, params?: Record<string, any> | undefined): string;
25
+ };
26
+ }, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue-demi").ExtractPropTypes<{}>>, {}>;
27
+ export default _default;
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
package/package/main.ts CHANGED
@@ -2,7 +2,6 @@ import { Vue2 } from 'vue-demi';
2
2
  import Main from './nf-confirm.vue';
3
3
  import merge from 'element-ui/src/utils/merge';
4
4
  const ConfirmConstructor = Vue2!.extend(Main);
5
- let currentMsg: { resolve: Function, reject: Function } | null = null
6
5
 
7
6
  const Confirm = function(options) {
8
7
  if (Vue2!.prototype?.$isServer) return;
@@ -10,21 +9,16 @@ const Confirm = function(options) {
10
9
  const instance = new ConfirmConstructor({
11
10
  data: options
12
11
  });
13
- instance.callback = defaultCallBack
14
12
  instance.$mount()
15
13
  document.body.appendChild(instance.$el);
16
14
  instance.visible = true;
17
15
  return new Promise((resolve, reject) => {
18
- currentMsg = { resolve, reject }
16
+ // Each dialog owns its promise; another open dialog must not replace it.
17
+ instance.callback = (action: 'cancel' | 'confirm', done: Function) => {
18
+ if (action === 'confirm') resolve(done)
19
+ else reject()
20
+ }
19
21
  })
20
22
  };
21
23
 
22
- const defaultCallBack = (action: 'cancel' | 'confirm', done: Function) => {
23
- if (action === 'confirm') {
24
- currentMsg!.resolve(done)
25
- } else {
26
- currentMsg!.reject()
27
- }
28
- }
29
-
30
24
  export default Confirm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-confirm",
3
- "version": "9.0.0",
3
+ "version": "10.0.0",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zhongzhenjie <1476686104@qq.com>",
@@ -14,9 +14,10 @@
14
14
  "url": "http://gitlab.94ai.pro/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/common-utils": "^9.0.0",
18
- "@94ai/nf-theme-chalk": "^9.0.0",
19
- "vue-demi": "^0.14.5"
17
+ "@94ai/common-utils": "^10.0.0",
18
+ "@94ai/nf-theme-chalk": "^10.0.0",
19
+ "vue-demi": "^0.14.5",
20
+ "@94ai/vue2-runtime-helpers": "1.0.1"
20
21
  },
21
22
  "peerDependenciesMeta": {
22
23
  "@vue/composition-api": {
@@ -25,11 +26,10 @@
25
26
  },
26
27
  "peerDependencies": {
27
28
  "@vue/composition-api": "^1.0.0-rc.1",
28
- "element-ui": ">=2.13.2",
29
- "vue": "^2.0.0 || >=3.0.0"
29
+ "vue": "^2.0.0 || >=3.0.0",
30
+ "element-ui": ">=2.13.2"
30
31
  },
31
32
  "types": "lib/index.d.ts",
32
33
  "main": "lib/nf-confirm.cjs.js",
33
- "module": "lib/nf-confirm.esm-bundler.js",
34
- "gitHead": "afe3016f0e42dfb7fedf6cbbe400ec08bf4b8662"
34
+ "module": "lib/nf-confirm.esm-bundler.js"
35
35
  }