@94ai/nf-confirm 3.1.31

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/.eslintrc.cjs ADDED
@@ -0,0 +1,49 @@
1
+ module.exports = {
2
+ "root": true,
3
+ "env": {
4
+ "node": true
5
+ },
6
+ "extends": [
7
+ "plugin:vue/essential"
8
+ ],
9
+ "parser": "vue-eslint-parser",
10
+ "parserOptions": {
11
+ "parser": "@typescript-eslint/parser",
12
+ "ecmaVersion": 2020,
13
+ "sourceType": "module"
14
+ },
15
+ "rules": {
16
+ "@typescript-eslint/ban-ts-ignore": "off",
17
+ "@typescript-eslint/explicit-function-return-type": "off",
18
+ "@typescript-eslint/no-explicit-any": "off",
19
+ "@typescript-eslint/no-var-requires": "off",
20
+ "@typescript-eslint/no-empty-function": "off",
21
+ "vue/custom-event-name-casing": "off",
22
+ "no-use-before-define": "off",
23
+ "@typescript-eslint/no-use-before-define": "off",
24
+ "@typescript-eslint/ban-ts-comment": "off",
25
+ "@typescript-eslint/ban-types": "off",
26
+ "@typescript-eslint/no-non-null-assertion": "off",
27
+ "@typescript-eslint/explicit-module-boundary-types": "off",
28
+ "@typescript-eslint/no-unused-vars": "off",
29
+ "vue/multi-word-component-names": [
30
+ "error",
31
+ {
32
+ "ignores": [
33
+ "index"
34
+ ]
35
+ }
36
+ ],
37
+ "no-console": "warn",
38
+ "no-debugger": "warn",
39
+ "prettier/prettier": [
40
+ "error",
41
+ {
42
+ "tabWidth": 2,
43
+ "singleQuote": true,
44
+ "semi": false,
45
+ "endOfLine": "auto"
46
+ }
47
+ ]
48
+ }
49
+ }
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # `@94ai/nf-confirm`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const nfConfirm = require('@94ai/nf-confirm');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
@@ -0,0 +1,8 @@
1
+ export {}
2
+
3
+ declare module 'vue' {
4
+ export interface GlobalComponents {
5
+ NfConfirm: typeof import('@94ai/nf-confirm/lib/nf-confirm.vue')['default']
6
+
7
+ }
8
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ import { PluginObject } from 'vue-demi';
2
+ declare const _default: import("vue/types/v3-component-public-instance").ComponentPublicInstanceConstructor<import("vue/types/v3-component-public-instance").Vue3Instance<{
3
+ visible: boolean;
4
+ width: number;
5
+ title: string;
6
+ message: string;
7
+ type: string;
8
+ customClass: string;
9
+ iconClass: string;
10
+ cancelButtonText: string;
11
+ confirmButtonText: string;
12
+ loading: boolean;
13
+ onCancel: null;
14
+ onConfirm: null;
15
+ }, 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> & {
16
+ visible: boolean;
17
+ width: number;
18
+ title: string;
19
+ message: string;
20
+ type: string;
21
+ customClass: string;
22
+ iconClass: string;
23
+ cancelButtonText: string;
24
+ confirmButtonText: string;
25
+ loading: boolean;
26
+ onCancel: null;
27
+ onConfirm: null;
28
+ } & import("vue/types/v3-component-options").ExtractComputedReturns<{
29
+ typeClass(): string;
30
+ }> & 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, {
31
+ visible: boolean;
32
+ width: number;
33
+ title: string;
34
+ message: string;
35
+ type: string;
36
+ customClass: string;
37
+ iconClass: string;
38
+ cancelButtonText: string;
39
+ confirmButtonText: string;
40
+ loading: boolean;
41
+ onCancel: null;
42
+ onConfirm: null;
43
+ }, {
44
+ typeClass(): string;
45
+ }, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, {}> & {
46
+ props: {};
47
+ } & PluginObject<undefined>;
48
+ export default _default;
package/lib/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const Confirm: (options: any) => any;
2
+ export default Confirm;
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const vueDemi = require("vue-demi");
4
+ function normalizeComponent(scriptExports, render2, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
5
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
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 = {
61
+ success: "success",
62
+ info: "info",
63
+ warning: "warning",
64
+ error: "error"
65
+ };
66
+ var _sfc_main = vueDemi.defineComponent({
67
+ name: "nf-confirm",
68
+ data: function data() {
69
+ return {
70
+ visible: false,
71
+ width: 400,
72
+ title: "",
73
+ message: "",
74
+ type: "",
75
+ customClass: "",
76
+ iconClass: "",
77
+ cancelButtonText: "取消",
78
+ confirmButtonText: "确定",
79
+ loading: false,
80
+ onCancel: null,
81
+ onConfirm: null
82
+ };
83
+ },
84
+ computed: {
85
+ typeClass: function typeClass() {
86
+ return this.type && typeMap[this.type] ? "el-icon-".concat(typeMap[this.type]) : "";
87
+ }
88
+ },
89
+ methods: {
90
+ close: function close() {
91
+ var _this = this;
92
+ this.loading = false;
93
+ this.visible = false;
94
+ this.$nextTick(function() {
95
+ _this.$destroy(true);
96
+ _this.$el.parentNode.removeChild(_this.$el);
97
+ });
98
+ },
99
+ handleCancel: function handleCancel() {
100
+ if (typeof this.onCancel === "function") {
101
+ this.onCancel(this.close);
102
+ } else {
103
+ this.close();
104
+ }
105
+ },
106
+ handleConfirm: function handleConfirm() {
107
+ if (typeof this.onConfirm === "function") {
108
+ this.loading = true;
109
+ this.onConfirm(this.close);
110
+ }
111
+ }
112
+ }
113
+ });
114
+ var _sfc_render = function render() {
115
+ var _vm = this, _c = _vm._self._c;
116
+ _vm._self._setupProxy;
117
+ return _c("div", {
118
+ "class": ["nf-confirm", _vm.customClass]
119
+ }, [_c("el-dialog", {
120
+ attrs: {
121
+ "visible": _vm.visible,
122
+ "showClose": false,
123
+ "width": "".concat(_vm.width, "px"),
124
+ "close-on-click-modal": false
125
+ },
126
+ on: {
127
+ "update:visible": function updateVisible($event) {
128
+ _vm.visible = $event;
129
+ }
130
+ }
131
+ }, [_c("div", {
132
+ staticClass: "nf-confirm__wrapper"
133
+ }, [_vm.type || _vm.iconClass ? _c("i", {
134
+ staticClass: "nf-confirm__icon",
135
+ "class": [_vm.typeClass, _vm.iconClass]
136
+ }) : _vm._e(), _c("div", {
137
+ staticClass: "nf-confirm__inner"
138
+ }, [_c("h2", {
139
+ staticClass: "nf-confirm__title"
140
+ }, [_vm._v(_vm._s(_vm.title))]), _c("p", {
141
+ staticClass: "nf-confirm__content"
142
+ }, [_vm._v(_vm._s(_vm.message))]), _c("div", {
143
+ staticClass: "nf-confirm__btns"
144
+ }, [_c("el-button", {
145
+ attrs: {
146
+ "size": "small"
147
+ },
148
+ on: {
149
+ "click": _vm.handleCancel
150
+ }
151
+ }, [_vm._v(_vm._s(_vm.cancelButtonText))]), _c("el-button", {
152
+ attrs: {
153
+ "size": "small",
154
+ "type": "primary",
155
+ "loading": _vm.loading
156
+ },
157
+ on: {
158
+ "click": _vm.handleConfirm
159
+ }
160
+ }, [_vm._v(_vm._s(_vm.confirmButtonText))])], 1)])])])], 1);
161
+ };
162
+ var _sfc_staticRenderFns = [];
163
+ var __component__ = /* @__PURE__ */ normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
164
+ const NfConfirm = __component__.exports;
165
+ function merge(target) {
166
+ for (let i = 1, j = arguments.length; i < j; i++) {
167
+ let source = arguments[i] || {};
168
+ for (let prop in source) {
169
+ if (source.hasOwnProperty(prop)) {
170
+ let value = source[prop];
171
+ if (value !== void 0) {
172
+ target[prop] = value;
173
+ }
174
+ }
175
+ }
176
+ }
177
+ return target;
178
+ }
179
+ var ConfirmConstructor = vueDemi.Vue2.extend(NfConfirm);
180
+ var Confirm = function Confirm2(options) {
181
+ if (vueDemi.Vue2.prototype.$isServer)
182
+ return;
183
+ options = merge({}, options);
184
+ var instance = new ConfirmConstructor({
185
+ data: options
186
+ });
187
+ instance.$mount();
188
+ document.body.appendChild(instance.$el);
189
+ instance.visible = true;
190
+ return instance;
191
+ };
192
+ NfConfirm.install = function(app) {
193
+ app.component("nf-confirm", NfConfirm);
194
+ app.prototype.$openConfirm = Confirm;
195
+ };
196
+ exports.default = NfConfirm;
@@ -0,0 +1,196 @@
1
+ import { defineComponent, Vue2 } from "vue-demi";
2
+ function normalizeComponent(scriptExports, render2, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
3
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
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 = {
59
+ success: "success",
60
+ info: "info",
61
+ warning: "warning",
62
+ error: "error"
63
+ };
64
+ var _sfc_main = defineComponent({
65
+ name: "nf-confirm",
66
+ data: function data() {
67
+ return {
68
+ visible: false,
69
+ width: 400,
70
+ title: "",
71
+ message: "",
72
+ type: "",
73
+ customClass: "",
74
+ iconClass: "",
75
+ cancelButtonText: "取消",
76
+ confirmButtonText: "确定",
77
+ loading: false,
78
+ onCancel: null,
79
+ onConfirm: null
80
+ };
81
+ },
82
+ computed: {
83
+ typeClass: function typeClass() {
84
+ return this.type && typeMap[this.type] ? "el-icon-".concat(typeMap[this.type]) : "";
85
+ }
86
+ },
87
+ methods: {
88
+ close: function close() {
89
+ var _this = this;
90
+ this.loading = false;
91
+ this.visible = false;
92
+ this.$nextTick(function() {
93
+ _this.$destroy(true);
94
+ _this.$el.parentNode.removeChild(_this.$el);
95
+ });
96
+ },
97
+ handleCancel: function handleCancel() {
98
+ if (typeof this.onCancel === "function") {
99
+ this.onCancel(this.close);
100
+ } else {
101
+ this.close();
102
+ }
103
+ },
104
+ handleConfirm: function handleConfirm() {
105
+ if (typeof this.onConfirm === "function") {
106
+ this.loading = true;
107
+ this.onConfirm(this.close);
108
+ }
109
+ }
110
+ }
111
+ });
112
+ var _sfc_render = function render() {
113
+ var _vm = this, _c = _vm._self._c;
114
+ _vm._self._setupProxy;
115
+ return _c("div", {
116
+ "class": ["nf-confirm", _vm.customClass]
117
+ }, [_c("el-dialog", {
118
+ attrs: {
119
+ "visible": _vm.visible,
120
+ "showClose": false,
121
+ "width": "".concat(_vm.width, "px"),
122
+ "close-on-click-modal": false
123
+ },
124
+ on: {
125
+ "update:visible": function updateVisible($event) {
126
+ _vm.visible = $event;
127
+ }
128
+ }
129
+ }, [_c("div", {
130
+ staticClass: "nf-confirm__wrapper"
131
+ }, [_vm.type || _vm.iconClass ? _c("i", {
132
+ staticClass: "nf-confirm__icon",
133
+ "class": [_vm.typeClass, _vm.iconClass]
134
+ }) : _vm._e(), _c("div", {
135
+ staticClass: "nf-confirm__inner"
136
+ }, [_c("h2", {
137
+ staticClass: "nf-confirm__title"
138
+ }, [_vm._v(_vm._s(_vm.title))]), _c("p", {
139
+ staticClass: "nf-confirm__content"
140
+ }, [_vm._v(_vm._s(_vm.message))]), _c("div", {
141
+ staticClass: "nf-confirm__btns"
142
+ }, [_c("el-button", {
143
+ attrs: {
144
+ "size": "small"
145
+ },
146
+ on: {
147
+ "click": _vm.handleCancel
148
+ }
149
+ }, [_vm._v(_vm._s(_vm.cancelButtonText))]), _c("el-button", {
150
+ attrs: {
151
+ "size": "small",
152
+ "type": "primary",
153
+ "loading": _vm.loading
154
+ },
155
+ on: {
156
+ "click": _vm.handleConfirm
157
+ }
158
+ }, [_vm._v(_vm._s(_vm.confirmButtonText))])], 1)])])])], 1);
159
+ };
160
+ var _sfc_staticRenderFns = [];
161
+ var __component__ = /* @__PURE__ */ normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
162
+ const NfConfirm = __component__.exports;
163
+ function merge(target) {
164
+ for (let i = 1, j = arguments.length; i < j; i++) {
165
+ let source = arguments[i] || {};
166
+ for (let prop in source) {
167
+ if (source.hasOwnProperty(prop)) {
168
+ let value = source[prop];
169
+ if (value !== void 0) {
170
+ target[prop] = value;
171
+ }
172
+ }
173
+ }
174
+ }
175
+ return target;
176
+ }
177
+ var ConfirmConstructor = Vue2.extend(NfConfirm);
178
+ var Confirm = function Confirm2(options) {
179
+ if (Vue2.prototype.$isServer)
180
+ return;
181
+ options = merge({}, options);
182
+ var instance = new ConfirmConstructor({
183
+ data: options
184
+ });
185
+ instance.$mount();
186
+ document.body.appendChild(instance.$el);
187
+ instance.visible = true;
188
+ return instance;
189
+ };
190
+ NfConfirm.install = function(app) {
191
+ app.component("nf-confirm", NfConfirm);
192
+ app.prototype.$openConfirm = Confirm;
193
+ };
194
+ export {
195
+ NfConfirm as default
196
+ };
@@ -0,0 +1,17 @@
1
+ declare const _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: string;
10
+ confirmButtonText: string;
11
+ loading: boolean;
12
+ onCancel: null;
13
+ onConfirm: null;
14
+ }, {
15
+ typeClass(): string;
16
+ }, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue-demi").ExtractPropTypes<{}>>, {}>;
17
+ export default _default;
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+ import '@94ai/nf-theme-chalk/lib/css/nf-confirm.css'
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+ import '@94ai/nf-theme-chalk/lib/nf-confirm.scss'
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@94ai/nf-confirm",
3
+ "version": "3.1.31",
4
+ "description": "> TODO: description",
5
+ "keywords": [],
6
+ "author": "zhongzhenjie <1476686104@qq.com>",
7
+ "homepage": "https://oss.xccjh.top/common-ui/#/ai-index",
8
+ "license": "ISC",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
+ },
16
+ "dependencies": {
17
+ "@94ai/nf-theme-chalk": "^3.1.31",
18
+ "vue-demi": "^0.14.5"
19
+ },
20
+ "peerDependenciesMeta": {
21
+ "@vue/composition-api": {
22
+ "optional": true
23
+ }
24
+ },
25
+ "peerDependencies": {
26
+ "@vue/composition-api": "^1.0.0-rc.1",
27
+ "element-ui": ">=2.13.2",
28
+ "vue": "^2.0.0 || >=3.0.0"
29
+ },
30
+ "types": "lib/index.d.ts",
31
+ "main": "lib/nf-confirm.cjs.js",
32
+ "module": "lib/nf-confirm.esm-bundler.js",
33
+ "gitHead": "02e1666730c7a3450ce803ef411297377b288321"
34
+ }
@@ -0,0 +1,8 @@
1
+ export default {
2
+ plugins: {
3
+ // 这个工具可以实现自动添加CSS3前缀
4
+ autoprefixer: {
5
+ overrideBrowserslist: ['last 5 version', '>1%', 'ie >=8']
6
+ },
7
+ },
8
+ }