@94ai/nf-confirm 3.1.36 → 3.1.38
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/nf-confirm.cjs.js +21 -77
- package/lib/nf-confirm.esm-bundler.js +20 -76
- package/package/index.ts +10 -0
- package/package/main.ts +18 -0
- package/package/nf-confirm.vue +79 -0
- package/package/style/css.ts +1 -0
- package/package/style/index.ts +1 -0
- package/package.json +3 -3
package/lib/nf-confirm.cjs.js
CHANGED
|
@@ -1,71 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const vueDemi = require("vue-demi");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (render2) {
|
|
7
|
-
options.render = render2;
|
|
8
|
-
options.staticRenderFns = staticRenderFns;
|
|
9
|
-
options._compiled = true;
|
|
10
|
-
}
|
|
11
|
-
if (functionalTemplate) {
|
|
12
|
-
options.functional = true;
|
|
13
|
-
}
|
|
14
|
-
if (scopeId) {
|
|
15
|
-
options._scopeId = "data-v-" + scopeId;
|
|
16
|
-
}
|
|
17
|
-
var hook;
|
|
18
|
-
if (moduleIdentifier) {
|
|
19
|
-
hook = function(context) {
|
|
20
|
-
context = context || // cached call
|
|
21
|
-
this.$vnode && this.$vnode.ssrContext || // stateful
|
|
22
|
-
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
|
|
23
|
-
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
|
|
24
|
-
context = __VUE_SSR_CONTEXT__;
|
|
25
|
-
}
|
|
26
|
-
if (injectStyles) {
|
|
27
|
-
injectStyles.call(this, context);
|
|
28
|
-
}
|
|
29
|
-
if (context && context._registeredComponents) {
|
|
30
|
-
context._registeredComponents.add(moduleIdentifier);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
options._ssrRegister = hook;
|
|
34
|
-
} else if (injectStyles) {
|
|
35
|
-
hook = shadowMode ? function() {
|
|
36
|
-
injectStyles.call(
|
|
37
|
-
this,
|
|
38
|
-
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
39
|
-
);
|
|
40
|
-
} : injectStyles;
|
|
41
|
-
}
|
|
42
|
-
if (hook) {
|
|
43
|
-
if (options.functional) {
|
|
44
|
-
options._injectStyles = hook;
|
|
45
|
-
var originalRender = options.render;
|
|
46
|
-
options.render = function renderWithStyleInjection(h, context) {
|
|
47
|
-
hook.call(context);
|
|
48
|
-
return originalRender(h, context);
|
|
49
|
-
};
|
|
50
|
-
} else {
|
|
51
|
-
var existing = options.beforeCreate;
|
|
52
|
-
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
exports: scriptExports,
|
|
57
|
-
options
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
var typeMap = {
|
|
4
|
+
const vue2RuntimeHelpers = require("@94ai/vue2-runtime-helpers");
|
|
5
|
+
const typeMap = {
|
|
61
6
|
success: "success",
|
|
62
7
|
info: "info",
|
|
63
8
|
warning: "warning",
|
|
64
9
|
error: "error"
|
|
65
10
|
};
|
|
66
|
-
|
|
11
|
+
const _sfc_main = vueDemi.defineComponent({
|
|
67
12
|
name: "nf-confirm",
|
|
68
|
-
data
|
|
13
|
+
data() {
|
|
69
14
|
return {
|
|
70
15
|
visible: false,
|
|
71
16
|
width: 400,
|
|
@@ -82,28 +27,27 @@ var _sfc_main = vueDemi.defineComponent({
|
|
|
82
27
|
};
|
|
83
28
|
},
|
|
84
29
|
computed: {
|
|
85
|
-
typeClass
|
|
86
|
-
return this.type && typeMap[this.type] ?
|
|
30
|
+
typeClass() {
|
|
31
|
+
return this.type && typeMap[this.type] ? `el-icon-${typeMap[this.type]}` : "";
|
|
87
32
|
}
|
|
88
33
|
},
|
|
89
34
|
methods: {
|
|
90
|
-
close
|
|
91
|
-
var _this = this;
|
|
35
|
+
close() {
|
|
92
36
|
this.loading = false;
|
|
93
37
|
this.visible = false;
|
|
94
|
-
this.$nextTick(
|
|
95
|
-
|
|
96
|
-
|
|
38
|
+
this.$nextTick(() => {
|
|
39
|
+
this.$destroy(true);
|
|
40
|
+
this.$el.parentNode.removeChild(this.$el);
|
|
97
41
|
});
|
|
98
42
|
},
|
|
99
|
-
handleCancel
|
|
43
|
+
handleCancel() {
|
|
100
44
|
if (typeof this.onCancel === "function") {
|
|
101
45
|
this.onCancel(this.close);
|
|
102
46
|
} else {
|
|
103
47
|
this.close();
|
|
104
48
|
}
|
|
105
49
|
},
|
|
106
|
-
handleConfirm
|
|
50
|
+
handleConfirm() {
|
|
107
51
|
if (typeof this.onConfirm === "function") {
|
|
108
52
|
this.loading = true;
|
|
109
53
|
this.onConfirm(this.close);
|
|
@@ -115,16 +59,16 @@ var _sfc_render = function render() {
|
|
|
115
59
|
var _vm = this, _c = _vm._self._c;
|
|
116
60
|
_vm._self._setupProxy;
|
|
117
61
|
return _c("div", {
|
|
118
|
-
|
|
62
|
+
class: ["nf-confirm", _vm.customClass]
|
|
119
63
|
}, [_c("el-dialog", {
|
|
120
64
|
attrs: {
|
|
121
65
|
"visible": _vm.visible,
|
|
122
66
|
"showClose": false,
|
|
123
|
-
"width":
|
|
67
|
+
"width": `${_vm.width}px`,
|
|
124
68
|
"close-on-click-modal": false
|
|
125
69
|
},
|
|
126
70
|
on: {
|
|
127
|
-
"update:visible": function
|
|
71
|
+
"update:visible": function($event) {
|
|
128
72
|
_vm.visible = $event;
|
|
129
73
|
}
|
|
130
74
|
}
|
|
@@ -132,7 +76,7 @@ var _sfc_render = function render() {
|
|
|
132
76
|
staticClass: "nf-confirm__wrapper"
|
|
133
77
|
}, [_vm.type || _vm.iconClass ? _c("i", {
|
|
134
78
|
staticClass: "nf-confirm__icon",
|
|
135
|
-
|
|
79
|
+
class: [_vm.typeClass, _vm.iconClass]
|
|
136
80
|
}) : _vm._e(), _c("div", {
|
|
137
81
|
staticClass: "nf-confirm__inner"
|
|
138
82
|
}, [_c("h2", {
|
|
@@ -156,7 +100,7 @@ var _sfc_render = function render() {
|
|
|
156
100
|
}, [_vm._v(_vm._s(_vm.confirmButtonText))])], 1)])])])], 1);
|
|
157
101
|
};
|
|
158
102
|
var _sfc_staticRenderFns = [];
|
|
159
|
-
var __component__ = /* @__PURE__ */ normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|
|
103
|
+
var __component__ = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|
|
160
104
|
const NfConfirm = __component__.exports;
|
|
161
105
|
function merge(target) {
|
|
162
106
|
for (let i = 1, j = arguments.length; i < j; i++) {
|
|
@@ -172,12 +116,12 @@ function merge(target) {
|
|
|
172
116
|
}
|
|
173
117
|
return target;
|
|
174
118
|
}
|
|
175
|
-
|
|
176
|
-
|
|
119
|
+
const ConfirmConstructor = vueDemi.Vue2.extend(NfConfirm);
|
|
120
|
+
const Confirm = function(options) {
|
|
177
121
|
if (vueDemi.Vue2.prototype.$isServer)
|
|
178
122
|
return;
|
|
179
123
|
options = merge({}, options);
|
|
180
|
-
|
|
124
|
+
const instance = new ConfirmConstructor({
|
|
181
125
|
data: options
|
|
182
126
|
});
|
|
183
127
|
instance.$mount();
|
|
@@ -185,7 +129,7 @@ var Confirm = function Confirm2(options) {
|
|
|
185
129
|
instance.visible = true;
|
|
186
130
|
return instance;
|
|
187
131
|
};
|
|
188
|
-
NfConfirm.install =
|
|
132
|
+
NfConfirm.install = (app) => {
|
|
189
133
|
app.component("nf-confirm", NfConfirm);
|
|
190
134
|
app.prototype.$openConfirm = Confirm;
|
|
191
135
|
};
|
|
@@ -1,69 +1,14 @@
|
|
|
1
1
|
import { defineComponent, Vue2 } from "vue-demi";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (render2) {
|
|
5
|
-
options.render = render2;
|
|
6
|
-
options.staticRenderFns = staticRenderFns;
|
|
7
|
-
options._compiled = true;
|
|
8
|
-
}
|
|
9
|
-
if (functionalTemplate) {
|
|
10
|
-
options.functional = true;
|
|
11
|
-
}
|
|
12
|
-
if (scopeId) {
|
|
13
|
-
options._scopeId = "data-v-" + scopeId;
|
|
14
|
-
}
|
|
15
|
-
var hook;
|
|
16
|
-
if (moduleIdentifier) {
|
|
17
|
-
hook = function(context) {
|
|
18
|
-
context = context || // cached call
|
|
19
|
-
this.$vnode && this.$vnode.ssrContext || // stateful
|
|
20
|
-
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
|
|
21
|
-
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
|
|
22
|
-
context = __VUE_SSR_CONTEXT__;
|
|
23
|
-
}
|
|
24
|
-
if (injectStyles) {
|
|
25
|
-
injectStyles.call(this, context);
|
|
26
|
-
}
|
|
27
|
-
if (context && context._registeredComponents) {
|
|
28
|
-
context._registeredComponents.add(moduleIdentifier);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
options._ssrRegister = hook;
|
|
32
|
-
} else if (injectStyles) {
|
|
33
|
-
hook = shadowMode ? function() {
|
|
34
|
-
injectStyles.call(
|
|
35
|
-
this,
|
|
36
|
-
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
37
|
-
);
|
|
38
|
-
} : injectStyles;
|
|
39
|
-
}
|
|
40
|
-
if (hook) {
|
|
41
|
-
if (options.functional) {
|
|
42
|
-
options._injectStyles = hook;
|
|
43
|
-
var originalRender = options.render;
|
|
44
|
-
options.render = function renderWithStyleInjection(h, context) {
|
|
45
|
-
hook.call(context);
|
|
46
|
-
return originalRender(h, context);
|
|
47
|
-
};
|
|
48
|
-
} else {
|
|
49
|
-
var existing = options.beforeCreate;
|
|
50
|
-
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
exports: scriptExports,
|
|
55
|
-
options
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
var typeMap = {
|
|
2
|
+
import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
|
|
3
|
+
const typeMap = {
|
|
59
4
|
success: "success",
|
|
60
5
|
info: "info",
|
|
61
6
|
warning: "warning",
|
|
62
7
|
error: "error"
|
|
63
8
|
};
|
|
64
|
-
|
|
9
|
+
const _sfc_main = defineComponent({
|
|
65
10
|
name: "nf-confirm",
|
|
66
|
-
data
|
|
11
|
+
data() {
|
|
67
12
|
return {
|
|
68
13
|
visible: false,
|
|
69
14
|
width: 400,
|
|
@@ -80,28 +25,27 @@ var _sfc_main = defineComponent({
|
|
|
80
25
|
};
|
|
81
26
|
},
|
|
82
27
|
computed: {
|
|
83
|
-
typeClass
|
|
84
|
-
return this.type && typeMap[this.type] ?
|
|
28
|
+
typeClass() {
|
|
29
|
+
return this.type && typeMap[this.type] ? `el-icon-${typeMap[this.type]}` : "";
|
|
85
30
|
}
|
|
86
31
|
},
|
|
87
32
|
methods: {
|
|
88
|
-
close
|
|
89
|
-
var _this = this;
|
|
33
|
+
close() {
|
|
90
34
|
this.loading = false;
|
|
91
35
|
this.visible = false;
|
|
92
|
-
this.$nextTick(
|
|
93
|
-
|
|
94
|
-
|
|
36
|
+
this.$nextTick(() => {
|
|
37
|
+
this.$destroy(true);
|
|
38
|
+
this.$el.parentNode.removeChild(this.$el);
|
|
95
39
|
});
|
|
96
40
|
},
|
|
97
|
-
handleCancel
|
|
41
|
+
handleCancel() {
|
|
98
42
|
if (typeof this.onCancel === "function") {
|
|
99
43
|
this.onCancel(this.close);
|
|
100
44
|
} else {
|
|
101
45
|
this.close();
|
|
102
46
|
}
|
|
103
47
|
},
|
|
104
|
-
handleConfirm
|
|
48
|
+
handleConfirm() {
|
|
105
49
|
if (typeof this.onConfirm === "function") {
|
|
106
50
|
this.loading = true;
|
|
107
51
|
this.onConfirm(this.close);
|
|
@@ -113,16 +57,16 @@ var _sfc_render = function render() {
|
|
|
113
57
|
var _vm = this, _c = _vm._self._c;
|
|
114
58
|
_vm._self._setupProxy;
|
|
115
59
|
return _c("div", {
|
|
116
|
-
|
|
60
|
+
class: ["nf-confirm", _vm.customClass]
|
|
117
61
|
}, [_c("el-dialog", {
|
|
118
62
|
attrs: {
|
|
119
63
|
"visible": _vm.visible,
|
|
120
64
|
"showClose": false,
|
|
121
|
-
"width":
|
|
65
|
+
"width": `${_vm.width}px`,
|
|
122
66
|
"close-on-click-modal": false
|
|
123
67
|
},
|
|
124
68
|
on: {
|
|
125
|
-
"update:visible": function
|
|
69
|
+
"update:visible": function($event) {
|
|
126
70
|
_vm.visible = $event;
|
|
127
71
|
}
|
|
128
72
|
}
|
|
@@ -130,7 +74,7 @@ var _sfc_render = function render() {
|
|
|
130
74
|
staticClass: "nf-confirm__wrapper"
|
|
131
75
|
}, [_vm.type || _vm.iconClass ? _c("i", {
|
|
132
76
|
staticClass: "nf-confirm__icon",
|
|
133
|
-
|
|
77
|
+
class: [_vm.typeClass, _vm.iconClass]
|
|
134
78
|
}) : _vm._e(), _c("div", {
|
|
135
79
|
staticClass: "nf-confirm__inner"
|
|
136
80
|
}, [_c("h2", {
|
|
@@ -170,12 +114,12 @@ function merge(target) {
|
|
|
170
114
|
}
|
|
171
115
|
return target;
|
|
172
116
|
}
|
|
173
|
-
|
|
174
|
-
|
|
117
|
+
const ConfirmConstructor = Vue2.extend(NfConfirm);
|
|
118
|
+
const Confirm = function(options) {
|
|
175
119
|
if (Vue2.prototype.$isServer)
|
|
176
120
|
return;
|
|
177
121
|
options = merge({}, options);
|
|
178
|
-
|
|
122
|
+
const instance = new ConfirmConstructor({
|
|
179
123
|
data: options
|
|
180
124
|
});
|
|
181
125
|
instance.$mount();
|
|
@@ -183,7 +127,7 @@ var Confirm = function Confirm2(options) {
|
|
|
183
127
|
instance.visible = true;
|
|
184
128
|
return instance;
|
|
185
129
|
};
|
|
186
|
-
NfConfirm.install =
|
|
130
|
+
NfConfirm.install = (app) => {
|
|
187
131
|
app.component("nf-confirm", NfConfirm);
|
|
188
132
|
app.prototype.$openConfirm = Confirm;
|
|
189
133
|
};
|
package/package/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import NfConfirm from './nf-confirm.vue'
|
|
2
|
+
import { Vue2, PluginObject } from 'vue-demi'
|
|
3
|
+
import Main from './main'
|
|
4
|
+
|
|
5
|
+
NfConfirm.install = (app: typeof Vue2) => {
|
|
6
|
+
app!.component('nf-confirm', NfConfirm)
|
|
7
|
+
app!.prototype.$openConfirm = Main
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default NfConfirm as typeof NfConfirm & PluginObject<undefined>
|
package/package/main.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Vue2 } from 'vue-demi';
|
|
2
|
+
import Main from './nf-confirm.vue';
|
|
3
|
+
import merge from 'element-ui/src/utils/merge';
|
|
4
|
+
const ConfirmConstructor = Vue2!.extend(Main);
|
|
5
|
+
|
|
6
|
+
const Confirm = function(options) {
|
|
7
|
+
if (Vue2!.prototype.$isServer) return;
|
|
8
|
+
options = merge({}, options);
|
|
9
|
+
const instance = new ConfirmConstructor({
|
|
10
|
+
data: options
|
|
11
|
+
});
|
|
12
|
+
instance.$mount();
|
|
13
|
+
document.body.appendChild(instance.$el);
|
|
14
|
+
instance.visible = true;
|
|
15
|
+
return instance;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default Confirm
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['nf-confirm', customClass]">
|
|
3
|
+
<el-dialog :visible.sync="visible" :showClose="false" :width="`${width}px`" :close-on-click-modal="false">
|
|
4
|
+
<div class="nf-confirm__wrapper">
|
|
5
|
+
<i class="nf-confirm__icon" :class="[ typeClass, iconClass ]" v-if="type || iconClass"></i>
|
|
6
|
+
<div class="nf-confirm__inner">
|
|
7
|
+
<h2 class="nf-confirm__title">{{ title }}</h2>
|
|
8
|
+
<p class="nf-confirm__content">{{ message }}</p>
|
|
9
|
+
<div class="nf-confirm__btns">
|
|
10
|
+
<nf-button @click="handleCancel">{{ cancelButtonText }}</nf-button>
|
|
11
|
+
<nf-button type="primary" :loading="loading" @click="handleConfirm">{{ confirmButtonText }}</nf-button>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</el-dialog>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import { defineComponent } from 'vue-demi'
|
|
21
|
+
|
|
22
|
+
const typeMap = {
|
|
23
|
+
success: 'success',
|
|
24
|
+
info: 'info',
|
|
25
|
+
warning: 'warning',
|
|
26
|
+
error: 'error'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default defineComponent({
|
|
30
|
+
name: "nf-confirm",
|
|
31
|
+
data() {
|
|
32
|
+
return {
|
|
33
|
+
visible: false,
|
|
34
|
+
width: 400,
|
|
35
|
+
title: '',
|
|
36
|
+
message: '',
|
|
37
|
+
type: '',
|
|
38
|
+
customClass: '',
|
|
39
|
+
iconClass: '',
|
|
40
|
+
cancelButtonText: '取消',
|
|
41
|
+
confirmButtonText: '确定',
|
|
42
|
+
loading: false,
|
|
43
|
+
onCancel: null,
|
|
44
|
+
onConfirm: null,
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
computed: {
|
|
48
|
+
typeClass() {
|
|
49
|
+
return this.type && typeMap[this.type] ? `el-icon-${ typeMap[this.type] }` : '';
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
methods: {
|
|
53
|
+
close() {
|
|
54
|
+
this.loading = false
|
|
55
|
+
this.visible = false
|
|
56
|
+
this.$nextTick(()=>{
|
|
57
|
+
this.$destroy(true);
|
|
58
|
+
this.$el.parentNode.removeChild(this.$el);
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
handleCancel() {
|
|
63
|
+
if (typeof this.onCancel === 'function') {
|
|
64
|
+
this.onCancel(this.close);
|
|
65
|
+
} else {
|
|
66
|
+
this.close()
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
handleConfirm() {
|
|
71
|
+
if (typeof this.onConfirm === 'function') {
|
|
72
|
+
this.loading = true
|
|
73
|
+
this.onConfirm(this.close);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
})
|
|
79
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@94ai/nf-theme-chalk/lib/css/nf-confirm.css'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@94ai/nf-theme-chalk/lib/nf-confirm.scss'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-confirm",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.38",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zhongzhenjie <1476686104@qq.com>",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/nf-theme-chalk": "^
|
|
17
|
+
"@94ai/nf-theme-chalk": "^1.0.0",
|
|
18
18
|
"vue-demi": "^0.14.5"
|
|
19
19
|
},
|
|
20
20
|
"peerDependenciesMeta": {
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"types": "lib/index.d.ts",
|
|
31
31
|
"main": "lib/nf-confirm.cjs.js",
|
|
32
32
|
"module": "lib/nf-confirm.esm-bundler.js",
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "2b60696b405feafbbaeed385e5bcf666ceefbf2c"
|
|
34
34
|
}
|