@opentinyvue/vue-exception 2.21.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/LICENSE +22 -0
- package/index.d.ts +13 -0
- package/lib/index.js +60 -0
- package/lib/mobile-first.js +169 -0
- package/lib/mobile.js +112 -0
- package/package.json +22 -0
- package/src/index.d.ts +2 -0
- package/src/mobile-first.vue.d.ts +2 -0
- package/src/mobile.vue.d.ts +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 - present TinyVue Authors.
|
|
4
|
+
Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 - present TinyVue Authors.
|
|
3
|
+
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license.
|
|
6
|
+
*
|
|
7
|
+
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
|
|
8
|
+
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
|
|
9
|
+
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
import Exception from './src/index';
|
|
13
|
+
export default Exception;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
function _extends() {
|
|
2
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
3
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
4
|
+
var t = arguments[e];
|
|
5
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
6
|
+
}
|
|
7
|
+
return n;
|
|
8
|
+
}, _extends.apply(null, arguments);
|
|
9
|
+
}
|
|
10
|
+
import { defineComponent, $prefix, $props, $setup } from "@opentinyvue/vue-common";
|
|
11
|
+
import MobileTemplate from "./mobile.js";
|
|
12
|
+
import MobileFirstTemplate from "./mobile-first.js";
|
|
13
|
+
import "@opentinyvue/vue-theme-mobile/exception/index.css";
|
|
14
|
+
var template = function template2(mode) {
|
|
15
|
+
var _process$env;
|
|
16
|
+
var tinyMode = typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
|
|
17
|
+
if ("mobile" === (tinyMode || mode)) {
|
|
18
|
+
return MobileTemplate;
|
|
19
|
+
}
|
|
20
|
+
if ("mobile-first" === (tinyMode || mode)) {
|
|
21
|
+
return MobileFirstTemplate;
|
|
22
|
+
}
|
|
23
|
+
return MobileTemplate;
|
|
24
|
+
};
|
|
25
|
+
var Exception = defineComponent({
|
|
26
|
+
name: $prefix + "Exception",
|
|
27
|
+
props: _extends({}, $props, {
|
|
28
|
+
type: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "nodata"
|
|
31
|
+
},
|
|
32
|
+
message: String,
|
|
33
|
+
subMessage: String,
|
|
34
|
+
exceptionClass: String,
|
|
35
|
+
imageUrl: String,
|
|
36
|
+
pageEmpty: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
componentPage: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
}
|
|
44
|
+
}),
|
|
45
|
+
setup: function setup(props, context) {
|
|
46
|
+
return $setup({
|
|
47
|
+
props,
|
|
48
|
+
context,
|
|
49
|
+
template
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
var version = "2.21.0";
|
|
54
|
+
Exception.install = function(Vue) {
|
|
55
|
+
Vue.component(Exception.name, Exception);
|
|
56
|
+
};
|
|
57
|
+
Exception.version = version;
|
|
58
|
+
export {
|
|
59
|
+
Exception as default
|
|
60
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/exception/vue';
|
|
2
|
+
import { defineComponent, setup, $props } from '@opentinyvue/vue-common';
|
|
3
|
+
import Button from '@opentinyvue/vue-button';
|
|
4
|
+
import { iconNoData, iconNoNews, iconNoPerm, iconNoResult, iconWeaknet, iconPageNoperm, iconPageNothing, iconPageServererror, iconPageWeaknet } from '@opentinyvue/vue-icon';
|
|
5
|
+
|
|
6
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
7
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
8
|
+
if (render) {
|
|
9
|
+
options.render = render;
|
|
10
|
+
options.staticRenderFns = staticRenderFns;
|
|
11
|
+
options._compiled = true;
|
|
12
|
+
}
|
|
13
|
+
var hook;
|
|
14
|
+
if (injectStyles) {
|
|
15
|
+
hook = injectStyles;
|
|
16
|
+
}
|
|
17
|
+
if (hook) {
|
|
18
|
+
if (options.functional) {
|
|
19
|
+
options._injectStyles = hook;
|
|
20
|
+
var originalRender = options.render;
|
|
21
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
22
|
+
hook.call(context);
|
|
23
|
+
return originalRender(h, context);
|
|
24
|
+
};
|
|
25
|
+
} else {
|
|
26
|
+
var existing = options.beforeCreate;
|
|
27
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
exports: scriptExports,
|
|
32
|
+
options
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function _extends() {
|
|
37
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
38
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
39
|
+
var t = arguments[e];
|
|
40
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
41
|
+
}
|
|
42
|
+
return n;
|
|
43
|
+
}, _extends.apply(null, arguments);
|
|
44
|
+
}
|
|
45
|
+
var $constants = {
|
|
46
|
+
INTERNALCONFIG: {
|
|
47
|
+
NODATA: "ui.exception.nodatamf",
|
|
48
|
+
NOPERM: "ui.exception.nopermmf",
|
|
49
|
+
WEAKNET: "ui.exception.weaknetmf",
|
|
50
|
+
NORESULT: "ui.exception.noresult",
|
|
51
|
+
NONEWS: "ui.exception.nonews",
|
|
52
|
+
PAGENOPERM: "ui.exception.pagenoperm",
|
|
53
|
+
PAGEWEAKNET: "ui.exception.pageweaknet",
|
|
54
|
+
PAGENOTHING: "ui.exception.pagenothing",
|
|
55
|
+
PAGESERVERERROR: "ui.exception.pageservererror"
|
|
56
|
+
},
|
|
57
|
+
ICONCONFIG: {
|
|
58
|
+
NODATA: "icon-no-data",
|
|
59
|
+
NOPERM: "icon-no-perm",
|
|
60
|
+
NONEWS: "icon-no-news",
|
|
61
|
+
WEAKNET: "icon-weaknet",
|
|
62
|
+
NORESULT: "icon-no-result",
|
|
63
|
+
PAGENOPERM: "icon-page-noperm",
|
|
64
|
+
PAGENOTHING: "icon-page-nothing",
|
|
65
|
+
PAGESERVERERROR: "icon-page-servererror",
|
|
66
|
+
PAGEWEAKNET: "icon-page-weaknet"
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var __vue2_script = defineComponent({
|
|
70
|
+
components: {
|
|
71
|
+
TinyButton: Button,
|
|
72
|
+
IconNoData: iconNoData(),
|
|
73
|
+
IconNoNews: iconNoNews(),
|
|
74
|
+
IconNoPerm: iconNoPerm(),
|
|
75
|
+
IconNoResult: iconNoResult(),
|
|
76
|
+
IconWeaknet: iconWeaknet(),
|
|
77
|
+
IconPageNoperm: iconPageNoperm(),
|
|
78
|
+
IconPageNothing: iconPageNothing(),
|
|
79
|
+
IconPageServererror: iconPageServererror(),
|
|
80
|
+
IconPageWeaknet: iconPageWeaknet()
|
|
81
|
+
},
|
|
82
|
+
emits: ["click"],
|
|
83
|
+
props: _extends({}, $props, {
|
|
84
|
+
_constants: {
|
|
85
|
+
type: Object,
|
|
86
|
+
default: function _default() {
|
|
87
|
+
return $constants;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
type: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: "nodata"
|
|
93
|
+
},
|
|
94
|
+
subMessage: String,
|
|
95
|
+
exceptionClass: String,
|
|
96
|
+
pageEmpty: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: false
|
|
99
|
+
},
|
|
100
|
+
componentPage: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
default: false
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
setup: function setup$1(props, context) {
|
|
106
|
+
return setup({
|
|
107
|
+
props,
|
|
108
|
+
context,
|
|
109
|
+
renderless,
|
|
110
|
+
api
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
var render = function render2() {
|
|
115
|
+
var _vm = this;
|
|
116
|
+
var _h = _vm.$createElement;
|
|
117
|
+
var _c = _vm._self._c || _h;
|
|
118
|
+
return _c("div", {
|
|
119
|
+
class: _vm.m("flex t-0 justify-center items-center w-full h-full bg-transparent sm:bg-color-bg-1 text-center", _vm.exceptionClass),
|
|
120
|
+
attrs: {
|
|
121
|
+
"data-tag": "tiny-exception"
|
|
122
|
+
}
|
|
123
|
+
}, [_c("div", {
|
|
124
|
+
attrs: {
|
|
125
|
+
"data-tag": "tiny-exception-body"
|
|
126
|
+
}
|
|
127
|
+
}, [_c("div", {
|
|
128
|
+
staticClass: "bg-cover",
|
|
129
|
+
attrs: {
|
|
130
|
+
"data-tag": "tiny-exception-image"
|
|
131
|
+
}
|
|
132
|
+
}, [_vm.state.urlType ? _c(_vm._constants.ICONCONFIG[_vm.type.toUpperCase()], {
|
|
133
|
+
tag: "component",
|
|
134
|
+
attrs: {
|
|
135
|
+
"custom-class": _vm.componentPage ? "w-24 h-24" : "w-52 h-40"
|
|
136
|
+
}
|
|
137
|
+
}) : _vm._e()], 1), _vm._t("content", function() {
|
|
138
|
+
return [_c("div", {
|
|
139
|
+
attrs: {
|
|
140
|
+
"data-tag": "tiny-exception-description"
|
|
141
|
+
}
|
|
142
|
+
}, [_c("div", {
|
|
143
|
+
class: ["text-color-text-primary mt-1 text-center text-sm", _vm.componentPage ? "sm:text-xs" : "sm:text-sm"],
|
|
144
|
+
attrs: {
|
|
145
|
+
"data-tag": "tiny-exception-componentpage"
|
|
146
|
+
}
|
|
147
|
+
}, [_vm._v(" " + _vm._s(_vm.t(_vm._constants.INTERNALCONFIG[_vm.type.toUpperCase()])) + " ")]), _vm.subMessage ? _c("div", {
|
|
148
|
+
staticClass: "leading-5.5 sm:leading-3 sm:text-xs mt-1 sm:mt-2 text-color-icon-placeholder",
|
|
149
|
+
attrs: {
|
|
150
|
+
"data-tag": "tiny-exception-submessage"
|
|
151
|
+
}
|
|
152
|
+
}, [_vm._v(" " + _vm._s(_vm.subMessage) + " ")]) : _vm._e(), _c("div", {
|
|
153
|
+
staticClass: "sm:mt-4 mt-6 inline-block"
|
|
154
|
+
}, [_vm._t("default")], 2)])];
|
|
155
|
+
})], 2)]);
|
|
156
|
+
};
|
|
157
|
+
var staticRenderFns = [];
|
|
158
|
+
var __cssModules = {};
|
|
159
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
160
|
+
function __vue2_injectStyles(context) {
|
|
161
|
+
for (var o in __cssModules) {
|
|
162
|
+
this[o] = __cssModules[o];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
var mobileFirst = /* @__PURE__ */ function() {
|
|
166
|
+
return __component__.exports;
|
|
167
|
+
}();
|
|
168
|
+
|
|
169
|
+
export { mobileFirst as default };
|
package/lib/mobile.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/exception/vue';
|
|
2
|
+
import { defineComponent, $prefix, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
import Button from '@opentinyvue/vue-button';
|
|
4
|
+
|
|
5
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
6
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
7
|
+
if (render) {
|
|
8
|
+
options.render = render;
|
|
9
|
+
options.staticRenderFns = staticRenderFns;
|
|
10
|
+
options._compiled = true;
|
|
11
|
+
}
|
|
12
|
+
var hook;
|
|
13
|
+
if (injectStyles) {
|
|
14
|
+
hook = injectStyles;
|
|
15
|
+
}
|
|
16
|
+
if (hook) {
|
|
17
|
+
if (options.functional) {
|
|
18
|
+
options._injectStyles = hook;
|
|
19
|
+
var originalRender = options.render;
|
|
20
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
21
|
+
hook.call(context);
|
|
22
|
+
return originalRender(h, context);
|
|
23
|
+
};
|
|
24
|
+
} else {
|
|
25
|
+
var existing = options.beforeCreate;
|
|
26
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
exports: scriptExports,
|
|
31
|
+
options
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var __vue2_script = defineComponent({
|
|
36
|
+
name: $prefix + "Exception",
|
|
37
|
+
components: {
|
|
38
|
+
TinyButton: Button
|
|
39
|
+
},
|
|
40
|
+
props: {
|
|
41
|
+
type: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "nodata"
|
|
44
|
+
},
|
|
45
|
+
message: String,
|
|
46
|
+
subMessage: String,
|
|
47
|
+
exceptionClass: String,
|
|
48
|
+
buttonText: String,
|
|
49
|
+
imageUrl: String
|
|
50
|
+
},
|
|
51
|
+
setup: function setup$1(props, context) {
|
|
52
|
+
return setup({
|
|
53
|
+
props,
|
|
54
|
+
context,
|
|
55
|
+
renderless,
|
|
56
|
+
api
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var render = function render2() {
|
|
61
|
+
var _vm = this;
|
|
62
|
+
var _h = _vm.$createElement;
|
|
63
|
+
var _c = _vm._self._c || _h;
|
|
64
|
+
return _c("div", {
|
|
65
|
+
staticClass: "tiny-mobile-exception",
|
|
66
|
+
class: _vm.exceptionClass
|
|
67
|
+
}, [_c("div", {
|
|
68
|
+
staticClass: "tiny-mobile-exception__content"
|
|
69
|
+
}, [_vm.imageUrl ? _c("img", {
|
|
70
|
+
staticClass: "tiny-mobile-exception__image",
|
|
71
|
+
attrs: {
|
|
72
|
+
"src": _vm.imageUrl
|
|
73
|
+
}
|
|
74
|
+
}) : _c("div", {
|
|
75
|
+
staticClass: "tiny-mobile-exception__content-view",
|
|
76
|
+
class: ["tiny-mobile-exception__content-" + _vm.type]
|
|
77
|
+
}), _vm._t("content", function() {
|
|
78
|
+
return [_c("div", {
|
|
79
|
+
staticClass: "tiny-mobile-exception__content-message"
|
|
80
|
+
}, [_c("div", {
|
|
81
|
+
staticClass: "main-message"
|
|
82
|
+
}, [_vm._v(" " + _vm._s(_vm.state.message) + " ")]), _vm.subMessage ? _c("div", {
|
|
83
|
+
staticClass: "sub-message"
|
|
84
|
+
}, [_vm._v(" " + _vm._s(_vm.subMessage) + " ")]) : _vm._e(), _vm.type === "nodata" ? _vm._t("default", function() {
|
|
85
|
+
return [_c("tiny-button", {
|
|
86
|
+
attrs: {
|
|
87
|
+
"type": "primary",
|
|
88
|
+
"size": "medium",
|
|
89
|
+
"round": ""
|
|
90
|
+
},
|
|
91
|
+
on: {
|
|
92
|
+
"click": _vm.create
|
|
93
|
+
}
|
|
94
|
+
}, [_vm._v(" " + _vm._s(_vm.buttonText ? _vm.buttonText : _vm.t("ui.exception.create")) + " ")])];
|
|
95
|
+
}) : _vm._e()], 2)];
|
|
96
|
+
})], 2), _c("div", {
|
|
97
|
+
staticClass: "tiny-mobile-exception__footer"
|
|
98
|
+
}, [_vm._t("footer")], 2)]);
|
|
99
|
+
};
|
|
100
|
+
var staticRenderFns = [];
|
|
101
|
+
var __cssModules = {};
|
|
102
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
103
|
+
function __vue2_injectStyles(context) {
|
|
104
|
+
for (var o in __cssModules) {
|
|
105
|
+
this[o] = __cssModules[o];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
var mobile = /* @__PURE__ */ function() {
|
|
109
|
+
return __component__.exports;
|
|
110
|
+
}();
|
|
111
|
+
|
|
112
|
+
export { mobile as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentinyvue/vue-exception",
|
|
3
|
+
"version": "2.21.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"module": "./lib/index.js",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"type": "module",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@opentinyvue/vue-renderless": "~3.21.0",
|
|
11
|
+
"@opentinyvue/vue-common": "~2.21.0",
|
|
12
|
+
"@opentinyvue/vue-button": "~2.21.0",
|
|
13
|
+
"@opentinyvue/vue-theme-mobile": "~3.21.0",
|
|
14
|
+
"@opentinyvue/vue-icon": "~2.21.0"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"types": "index.d.ts",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "pnpm -w build:ui $npm_package_name",
|
|
20
|
+
"//postversion": "pnpm build"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/index.d.ts
ADDED