@vef-framework/shared 1.0.122 → 1.0.123
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/cjs/color.cjs +11 -0
- package/cjs/constants.cjs +39 -0
- package/cjs/context.cjs +36 -0
- package/cjs/dom.cjs +23 -0
- package/cjs/error.cjs +30 -0
- package/cjs/event.cjs +11 -0
- package/cjs/expression.cjs +27 -0
- package/cjs/function.cjs +16 -0
- package/cjs/icons.cjs +136 -0
- package/cjs/id.cjs +14 -0
- package/cjs/index.cjs +317 -0
- package/cjs/json.cjs +18 -0
- package/cjs/lib.cjs +232 -0
- package/cjs/message.cjs +303 -0
- package/cjs/path.cjs +40 -0
- package/cjs/pinyin.cjs +33 -0
- package/cjs/security.cjs +27 -0
- package/cjs/store.cjs +105 -0
- package/cjs/styles.cjs +55 -0
- package/cjs/temporal.cjs +27 -0
- package/cjs/theme-variables.cjs +354 -0
- package/cjs/types.cjs +4 -0
- package/cjs/utils.cjs +117 -0
- package/cjs/validation.cjs +189 -0
- package/cjs/yaml.cjs +11 -0
- package/esm/color.js +9 -0
- package/esm/constants.js +31 -0
- package/esm/context.js +34 -0
- package/esm/dom.js +21 -0
- package/esm/error.js +28 -0
- package/esm/event.js +9 -0
- package/esm/expression.js +23 -0
- package/esm/function.js +14 -0
- package/esm/icons.js +129 -0
- package/esm/id.js +12 -0
- package/esm/index.js +32 -0
- package/esm/json.js +16 -0
- package/esm/lib.js +21 -0
- package/esm/message.js +282 -0
- package/esm/path.js +33 -0
- package/esm/pinyin.js +30 -0
- package/esm/security.js +24 -0
- package/esm/store.js +100 -0
- package/esm/styles.js +51 -0
- package/esm/temporal.js +23 -0
- package/esm/theme-variables.js +352 -0
- package/esm/types.js +2 -0
- package/esm/utils.js +109 -0
- package/esm/validation.js +151 -0
- package/esm/yaml.js +9 -0
- package/package.json +11 -10
- package/es/color.js +0 -1
- package/es/constants.js +0 -1
- package/es/context.js +0 -1
- package/es/dom.js +0 -1
- package/es/error.js +0 -1
- package/es/event.js +0 -1
- package/es/expression.js +0 -1
- package/es/function.js +0 -1
- package/es/icons.js +0 -1
- package/es/id.js +0 -1
- package/es/index.js +0 -1
- package/es/json.js +0 -1
- package/es/lib.js +0 -1
- package/es/message.js +0 -1
- package/es/path.js +0 -1
- package/es/pinyin.js +0 -1
- package/es/security.js +0 -1
- package/es/store.js +0 -1
- package/es/styles.js +0 -1
- package/es/temporal.js +0 -1
- package/es/theme-variables.js +0 -1
- package/es/utils.js +0 -1
- package/es/validation.js +0 -1
- package/es/yaml.js +0 -1
- package/lib/color.cjs +0 -1
- package/lib/constants.cjs +0 -1
- package/lib/context.cjs +0 -1
- package/lib/dom.cjs +0 -1
- package/lib/error.cjs +0 -1
- package/lib/event.cjs +0 -1
- package/lib/expression.cjs +0 -1
- package/lib/function.cjs +0 -1
- package/lib/icons.cjs +0 -1
- package/lib/id.cjs +0 -1
- package/lib/index.cjs +0 -1
- package/lib/json.cjs +0 -1
- package/lib/lib.cjs +0 -1
- package/lib/message.cjs +0 -1
- package/lib/path.cjs +0 -1
- package/lib/pinyin.cjs +0 -1
- package/lib/security.cjs +0 -1
- package/lib/store.cjs +0 -1
- package/lib/styles.cjs +0 -1
- package/lib/temporal.cjs +0 -1
- package/lib/theme-variables.cjs +0 -1
- package/lib/types.cjs +0 -1
- package/lib/utils.cjs +0 -1
- package/lib/validation.cjs +0 -1
- package/lib/yaml.cjs +0 -1
package/cjs/lib.cjs
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var i18next = require('i18next');
|
|
5
|
+
var radashi = require('radashi');
|
|
6
|
+
var zod = require('zod');
|
|
7
|
+
var zodI18nMap = require('zod-i18n-map');
|
|
8
|
+
var translation = require('zod-i18n-map/locales/zh-CN/zod.json');
|
|
9
|
+
var reactFastCompare = require('react-fast-compare');
|
|
10
|
+
var shallow = require('zustand/shallow');
|
|
11
|
+
|
|
12
|
+
"use strict";
|
|
13
|
+
i18next.init({
|
|
14
|
+
lng: "zh-CN",
|
|
15
|
+
fallbackLng: false,
|
|
16
|
+
resources: {
|
|
17
|
+
"zh-CN": {
|
|
18
|
+
zod: translation
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
zod.z.setErrorMap(zodI18nMap.zodI18nMap);
|
|
23
|
+
|
|
24
|
+
Object.defineProperty(exports, "assign", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return radashi.assign; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "camelCase", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return radashi.camel; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "capitalize", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return radashi.capitalize; }
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "clone", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return radashi.clone; }
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "cloneDeep", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return radashi.cloneDeep; }
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "cluster", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return radashi.cluster; }
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "dashCase", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return radashi.dash; }
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "debounce", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () { return radashi.debounce; }
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "get", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () { return radashi.get; }
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "isArray", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return radashi.isArray; }
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, "isBoolean", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () { return radashi.isBoolean; }
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "isDate", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () { return radashi.isDate; }
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "isEmpty", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () { return radashi.isEmpty; }
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "isError", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () { return radashi.isError; }
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "isFloat", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () { return radashi.isFloat; }
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "isFunction", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () { return radashi.isFunction; }
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, "isInt", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () { return radashi.isInt; }
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "isIntString", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () { return radashi.isIntString; }
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "isMap", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () { return radashi.isMap; }
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(exports, "isNullish", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () { return radashi.isNullish; }
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(exports, "isNumber", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function () { return radashi.isNumber; }
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "isObject", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () { return radashi.isObject; }
|
|
111
|
+
});
|
|
112
|
+
Object.defineProperty(exports, "isPlainObject", {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
get: function () { return radashi.isPlainObject; }
|
|
115
|
+
});
|
|
116
|
+
Object.defineProperty(exports, "isPrimitive", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () { return radashi.isPrimitive; }
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "isPromise", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () { return radashi.isPromise; }
|
|
123
|
+
});
|
|
124
|
+
Object.defineProperty(exports, "isRegExp", {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
get: function () { return radashi.isRegExp; }
|
|
127
|
+
});
|
|
128
|
+
Object.defineProperty(exports, "isSet", {
|
|
129
|
+
enumerable: true,
|
|
130
|
+
get: function () { return radashi.isSet; }
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "isString", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () { return radashi.isString; }
|
|
135
|
+
});
|
|
136
|
+
Object.defineProperty(exports, "isSymbol", {
|
|
137
|
+
enumerable: true,
|
|
138
|
+
get: function () { return radashi.isSymbol; }
|
|
139
|
+
});
|
|
140
|
+
Object.defineProperty(exports, "isUndefined", {
|
|
141
|
+
enumerable: true,
|
|
142
|
+
get: function () { return radashi.isUndefined; }
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "isWeakMap", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function () { return radashi.isWeakMap; }
|
|
147
|
+
});
|
|
148
|
+
Object.defineProperty(exports, "isWeakSet", {
|
|
149
|
+
enumerable: true,
|
|
150
|
+
get: function () { return radashi.isWeakSet; }
|
|
151
|
+
});
|
|
152
|
+
Object.defineProperty(exports, "max", {
|
|
153
|
+
enumerable: true,
|
|
154
|
+
get: function () { return radashi.max; }
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "memoize", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () { return radashi.memo; }
|
|
159
|
+
});
|
|
160
|
+
Object.defineProperty(exports, "min", {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
get: function () { return radashi.min; }
|
|
163
|
+
});
|
|
164
|
+
Object.defineProperty(exports, "noop", {
|
|
165
|
+
enumerable: true,
|
|
166
|
+
get: function () { return radashi.noop; }
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "omit", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function () { return radashi.omit; }
|
|
171
|
+
});
|
|
172
|
+
Object.defineProperty(exports, "once", {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
get: function () { return radashi.once; }
|
|
175
|
+
});
|
|
176
|
+
Object.defineProperty(exports, "pascalCase", {
|
|
177
|
+
enumerable: true,
|
|
178
|
+
get: function () { return radashi.pascal; }
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(exports, "pick", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function () { return radashi.pick; }
|
|
183
|
+
});
|
|
184
|
+
Object.defineProperty(exports, "set", {
|
|
185
|
+
enumerable: true,
|
|
186
|
+
get: function () { return radashi.set; }
|
|
187
|
+
});
|
|
188
|
+
Object.defineProperty(exports, "similarity", {
|
|
189
|
+
enumerable: true,
|
|
190
|
+
get: function () { return radashi.similarity; }
|
|
191
|
+
});
|
|
192
|
+
Object.defineProperty(exports, "snakeCase", {
|
|
193
|
+
enumerable: true,
|
|
194
|
+
get: function () { return radashi.snake; }
|
|
195
|
+
});
|
|
196
|
+
Object.defineProperty(exports, "sum", {
|
|
197
|
+
enumerable: true,
|
|
198
|
+
get: function () { return radashi.sum; }
|
|
199
|
+
});
|
|
200
|
+
Object.defineProperty(exports, "template", {
|
|
201
|
+
enumerable: true,
|
|
202
|
+
get: function () { return radashi.template; }
|
|
203
|
+
});
|
|
204
|
+
Object.defineProperty(exports, "throttle", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: function () { return radashi.throttle; }
|
|
207
|
+
});
|
|
208
|
+
Object.defineProperty(exports, "toFloat", {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
get: function () { return radashi.toFloat; }
|
|
211
|
+
});
|
|
212
|
+
Object.defineProperty(exports, "toInt", {
|
|
213
|
+
enumerable: true,
|
|
214
|
+
get: function () { return radashi.toInt; }
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(exports, "trim", {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
get: function () { return radashi.trim; }
|
|
219
|
+
});
|
|
220
|
+
Object.defineProperty(exports, "unique", {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
get: function () { return radashi.unique; }
|
|
223
|
+
});
|
|
224
|
+
Object.defineProperty(exports, "z", {
|
|
225
|
+
enumerable: true,
|
|
226
|
+
get: function () { return zod.z; }
|
|
227
|
+
});
|
|
228
|
+
exports.isDeepEqual = reactFastCompare;
|
|
229
|
+
Object.defineProperty(exports, "isShallowEqual", {
|
|
230
|
+
enumerable: true,
|
|
231
|
+
get: function () { return shallow.shallow; }
|
|
232
|
+
});
|
package/cjs/message.cjs
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var Icon = require('@ant-design/icons');
|
|
5
|
+
var antd = require('antd');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var icons = require('./icons.cjs');
|
|
8
|
+
require('./lib.cjs');
|
|
9
|
+
var radashi = require('radashi');
|
|
10
|
+
|
|
11
|
+
"use strict";
|
|
12
|
+
const {
|
|
13
|
+
confirm,
|
|
14
|
+
info,
|
|
15
|
+
success,
|
|
16
|
+
warning,
|
|
17
|
+
error
|
|
18
|
+
} = antd.Modal;
|
|
19
|
+
const checkIcon = react.createElement(Icon, {
|
|
20
|
+
component: icons.IconCheck
|
|
21
|
+
});
|
|
22
|
+
const successIcon = react.createElement(Icon, {
|
|
23
|
+
component: icons.IconTickCircle
|
|
24
|
+
});
|
|
25
|
+
const infoIcon = react.createElement(Icon, {
|
|
26
|
+
component: icons.IconInfoCircle
|
|
27
|
+
});
|
|
28
|
+
const warningIcon = react.createElement(Icon, {
|
|
29
|
+
component: icons.IconAlertTriangle
|
|
30
|
+
});
|
|
31
|
+
const errorIcon = react.createElement(Icon, {
|
|
32
|
+
component: icons.IconAlertCircle
|
|
33
|
+
});
|
|
34
|
+
const notificationSuccessIcon = react.createElement(Icon, {
|
|
35
|
+
className: "vef-notification-notice-icon vef-notification-notice-icon-success",
|
|
36
|
+
component: icons.IconTickCircle
|
|
37
|
+
});
|
|
38
|
+
const notificationInfoIcon = react.createElement(Icon, {
|
|
39
|
+
className: "vef-notification-notice-icon vef-notification-notice-icon-info",
|
|
40
|
+
component: icons.IconInfoCircle
|
|
41
|
+
});
|
|
42
|
+
const notificationWarningIcon = react.createElement(Icon, {
|
|
43
|
+
className: "vef-notification-notice-icon vef-notification-notice-icon-warning",
|
|
44
|
+
component: icons.IconAlertTriangle
|
|
45
|
+
});
|
|
46
|
+
const notificationErrorIcon = react.createElement(Icon, {
|
|
47
|
+
className: "vef-notification-notice-icon vef-notification-notice-icon-error",
|
|
48
|
+
component: icons.IconAlertCircle
|
|
49
|
+
});
|
|
50
|
+
function showSuccessMessage(content) {
|
|
51
|
+
antd.message.open({
|
|
52
|
+
type: "success",
|
|
53
|
+
content,
|
|
54
|
+
duration: 2,
|
|
55
|
+
icon: successIcon
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function showInfoMessage(content) {
|
|
59
|
+
antd.message.open({
|
|
60
|
+
type: "info",
|
|
61
|
+
content,
|
|
62
|
+
duration: 3,
|
|
63
|
+
icon: infoIcon
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function showWarningMessage(content) {
|
|
67
|
+
antd.message.open({
|
|
68
|
+
type: "warning",
|
|
69
|
+
content,
|
|
70
|
+
duration: 3,
|
|
71
|
+
icon: warningIcon
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function showErrorMessage(content) {
|
|
75
|
+
antd.message.open({
|
|
76
|
+
type: "error",
|
|
77
|
+
content,
|
|
78
|
+
duration: 4,
|
|
79
|
+
icon: errorIcon
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function showLoadingMessage(content) {
|
|
83
|
+
const close = antd.message.open({
|
|
84
|
+
type: "loading",
|
|
85
|
+
content,
|
|
86
|
+
duration: 0
|
|
87
|
+
});
|
|
88
|
+
return () => close();
|
|
89
|
+
}
|
|
90
|
+
const defaultMessageTitle = "提示";
|
|
91
|
+
function showSuccessNotification(titleOrContent, content, buttons) {
|
|
92
|
+
const argsLength = arguments.length;
|
|
93
|
+
if (argsLength < 1) {
|
|
94
|
+
throw new Error("showSuccessNotification requires at least one argument");
|
|
95
|
+
}
|
|
96
|
+
const titleToUse = argsLength > 1 ? titleOrContent : defaultMessageTitle;
|
|
97
|
+
const contentToUse = argsLength > 1 ? content : titleOrContent;
|
|
98
|
+
const buttonsToUse = argsLength === 3 ? buttons : void 0;
|
|
99
|
+
antd.notification.open({
|
|
100
|
+
type: "success",
|
|
101
|
+
message: titleToUse,
|
|
102
|
+
description: contentToUse,
|
|
103
|
+
duration: 4,
|
|
104
|
+
closable: true,
|
|
105
|
+
btn: buttonsToUse,
|
|
106
|
+
icon: notificationSuccessIcon
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function showInfoNotification(titleOrContent, content, buttons) {
|
|
110
|
+
const argsLength = arguments.length;
|
|
111
|
+
if (argsLength < 1) {
|
|
112
|
+
throw new Error("showInfoNotification requires at least one argument");
|
|
113
|
+
}
|
|
114
|
+
const titleToUse = argsLength > 1 ? titleOrContent : defaultMessageTitle;
|
|
115
|
+
const contentToUse = argsLength > 1 ? content : titleOrContent;
|
|
116
|
+
const buttonsToUse = argsLength === 3 ? buttons : void 0;
|
|
117
|
+
antd.notification.open({
|
|
118
|
+
type: "info",
|
|
119
|
+
message: titleToUse,
|
|
120
|
+
description: contentToUse,
|
|
121
|
+
duration: 5,
|
|
122
|
+
closable: true,
|
|
123
|
+
btn: buttonsToUse,
|
|
124
|
+
icon: notificationInfoIcon
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function showWarningNotification(titleOrContent, content, buttons) {
|
|
128
|
+
const argsLength = arguments.length;
|
|
129
|
+
if (argsLength < 1) {
|
|
130
|
+
throw new Error("showWarningNotification requires at least one argument");
|
|
131
|
+
}
|
|
132
|
+
const titleToUse = argsLength > 1 ? titleOrContent : defaultMessageTitle;
|
|
133
|
+
const contentToUse = argsLength > 1 ? content : titleOrContent;
|
|
134
|
+
const buttonsToUse = argsLength === 3 ? buttons : void 0;
|
|
135
|
+
antd.notification.open({
|
|
136
|
+
type: "warning",
|
|
137
|
+
message: titleToUse,
|
|
138
|
+
description: contentToUse,
|
|
139
|
+
duration: 6,
|
|
140
|
+
closable: true,
|
|
141
|
+
btn: buttonsToUse,
|
|
142
|
+
icon: notificationWarningIcon
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function showErrorNotification(titleOrContent, content, buttons) {
|
|
146
|
+
const argsLength = arguments.length;
|
|
147
|
+
if (argsLength < 1) {
|
|
148
|
+
throw new Error("showErrorNotification requires at least one argument");
|
|
149
|
+
}
|
|
150
|
+
const titleToUse = argsLength > 1 ? titleOrContent : defaultMessageTitle;
|
|
151
|
+
const contentToUse = argsLength > 1 ? content : titleOrContent;
|
|
152
|
+
const buttonsToUse = argsLength === 3 ? buttons : void 0;
|
|
153
|
+
antd.notification.open({
|
|
154
|
+
type: "error",
|
|
155
|
+
message: titleToUse,
|
|
156
|
+
description: contentToUse,
|
|
157
|
+
duration: 10,
|
|
158
|
+
closable: true,
|
|
159
|
+
btn: buttonsToUse,
|
|
160
|
+
icon: notificationErrorIcon
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
const cancelButtonProps = {
|
|
164
|
+
color: "default",
|
|
165
|
+
variant: "text"
|
|
166
|
+
};
|
|
167
|
+
const okButtonProps = {
|
|
168
|
+
icon: checkIcon
|
|
169
|
+
};
|
|
170
|
+
function showConfirmation(title, content, onOk, options) {
|
|
171
|
+
const argsLength = arguments.length;
|
|
172
|
+
if (argsLength < 2) {
|
|
173
|
+
throw new Error("showConfirmation requires at least two arguments");
|
|
174
|
+
}
|
|
175
|
+
const titleToUse = argsLength > 2 ? title : "提示";
|
|
176
|
+
const contentToUse = argsLength === 2 ? title : content;
|
|
177
|
+
const onOkToUse = argsLength === 2 ? content : onOk;
|
|
178
|
+
const {
|
|
179
|
+
okText,
|
|
180
|
+
cancelText,
|
|
181
|
+
onCancel,
|
|
182
|
+
onAfterOpen,
|
|
183
|
+
onAfterClose
|
|
184
|
+
} = options ?? {};
|
|
185
|
+
const { destroy } = confirm({
|
|
186
|
+
title: titleToUse,
|
|
187
|
+
content: contentToUse,
|
|
188
|
+
cancelButtonProps,
|
|
189
|
+
okButtonProps,
|
|
190
|
+
centered: true,
|
|
191
|
+
onOk: onOkToUse,
|
|
192
|
+
okText,
|
|
193
|
+
cancelText,
|
|
194
|
+
onCancel,
|
|
195
|
+
afterOpenChange: radashi.isFunction(onAfterOpen) || radashi.isFunction(onAfterClose) ? (open) => {
|
|
196
|
+
if (open) {
|
|
197
|
+
onAfterOpen?.();
|
|
198
|
+
} else {
|
|
199
|
+
onAfterClose?.();
|
|
200
|
+
}
|
|
201
|
+
} : void 0
|
|
202
|
+
});
|
|
203
|
+
return destroy;
|
|
204
|
+
}
|
|
205
|
+
const alertFnMap = {
|
|
206
|
+
success,
|
|
207
|
+
info,
|
|
208
|
+
warning,
|
|
209
|
+
error
|
|
210
|
+
};
|
|
211
|
+
const alertIconMap = {
|
|
212
|
+
success: successIcon,
|
|
213
|
+
info: infoIcon,
|
|
214
|
+
warning: warningIcon,
|
|
215
|
+
error: errorIcon
|
|
216
|
+
};
|
|
217
|
+
const defaultOkText = "👍🏻 好的,知道了";
|
|
218
|
+
function showAlert(type, content, title = defaultMessageTitle, onOk, options) {
|
|
219
|
+
const {
|
|
220
|
+
okText = defaultOkText,
|
|
221
|
+
onCancel,
|
|
222
|
+
onAfterOpen,
|
|
223
|
+
onAfterClose
|
|
224
|
+
} = options ?? {};
|
|
225
|
+
const { destroy } = alertFnMap[type]({
|
|
226
|
+
title,
|
|
227
|
+
content,
|
|
228
|
+
icon: alertIconMap[type],
|
|
229
|
+
centered: true,
|
|
230
|
+
onOk,
|
|
231
|
+
okText,
|
|
232
|
+
onCancel,
|
|
233
|
+
afterOpenChange: radashi.isFunction(onAfterOpen) || radashi.isFunction(onAfterClose) ? (open) => {
|
|
234
|
+
if (open) {
|
|
235
|
+
onAfterOpen?.();
|
|
236
|
+
} else {
|
|
237
|
+
onAfterClose?.();
|
|
238
|
+
}
|
|
239
|
+
} : void 0
|
|
240
|
+
});
|
|
241
|
+
return destroy;
|
|
242
|
+
}
|
|
243
|
+
function showSuccessAlert(title, content, onOk, options) {
|
|
244
|
+
const argsLength = arguments.length;
|
|
245
|
+
if (argsLength < 1) {
|
|
246
|
+
throw new Error("showSuccessAlert requires at least one argument");
|
|
247
|
+
}
|
|
248
|
+
const titleToUse = argsLength === 1 || radashi.isFunction(content) ? void 0 : title;
|
|
249
|
+
const contentToUse = argsLength === 1 || radashi.isFunction(content) ? title : content;
|
|
250
|
+
const onOkToUse = argsLength === 2 || radashi.isFunction(content) ? content : onOk;
|
|
251
|
+
return showAlert("success", contentToUse, titleToUse, onOkToUse, options);
|
|
252
|
+
}
|
|
253
|
+
function showInfoAlert(title, content, onOk, options) {
|
|
254
|
+
const argsLength = arguments.length;
|
|
255
|
+
if (argsLength < 1) {
|
|
256
|
+
throw new Error("showInfoAlert requires at least one argument");
|
|
257
|
+
}
|
|
258
|
+
const titleToUse = argsLength === 1 || radashi.isFunction(content) ? void 0 : title;
|
|
259
|
+
const contentToUse = argsLength === 1 || radashi.isFunction(content) ? title : content;
|
|
260
|
+
const onOkToUse = argsLength === 2 || radashi.isFunction(content) ? content : onOk;
|
|
261
|
+
return showAlert("info", contentToUse, titleToUse, onOkToUse, options);
|
|
262
|
+
}
|
|
263
|
+
function showWarningAlert(title, content, onOk, options) {
|
|
264
|
+
const argsLength = arguments.length;
|
|
265
|
+
if (argsLength < 1) {
|
|
266
|
+
throw new Error("showWarningAlert requires at least one argument");
|
|
267
|
+
}
|
|
268
|
+
const titleToUse = argsLength === 1 || radashi.isFunction(content) ? void 0 : title;
|
|
269
|
+
const contentToUse = argsLength === 1 || radashi.isFunction(content) ? title : content;
|
|
270
|
+
const onOkToUse = argsLength === 2 || radashi.isFunction(content) ? content : onOk;
|
|
271
|
+
return showAlert("warning", contentToUse, titleToUse, onOkToUse, options);
|
|
272
|
+
}
|
|
273
|
+
function showErrorAlert(title, content, onOk, options) {
|
|
274
|
+
const argsLength = arguments.length;
|
|
275
|
+
if (argsLength < 1) {
|
|
276
|
+
throw new Error("showErrorAlert requires at least one argument");
|
|
277
|
+
}
|
|
278
|
+
const titleToUse = argsLength === 1 || radashi.isFunction(content) ? void 0 : title;
|
|
279
|
+
const contentToUse = argsLength === 1 || radashi.isFunction(content) ? title : content;
|
|
280
|
+
const onOkToUse = argsLength === 2 || radashi.isFunction(content) ? content : onOk;
|
|
281
|
+
return showAlert("error", contentToUse, titleToUse, onOkToUse, options);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
exports.checkIcon = checkIcon;
|
|
285
|
+
exports.defaultMessageTitle = defaultMessageTitle;
|
|
286
|
+
exports.errorIcon = errorIcon;
|
|
287
|
+
exports.infoIcon = infoIcon;
|
|
288
|
+
exports.showConfirmation = showConfirmation;
|
|
289
|
+
exports.showErrorAlert = showErrorAlert;
|
|
290
|
+
exports.showErrorMessage = showErrorMessage;
|
|
291
|
+
exports.showErrorNotification = showErrorNotification;
|
|
292
|
+
exports.showInfoAlert = showInfoAlert;
|
|
293
|
+
exports.showInfoMessage = showInfoMessage;
|
|
294
|
+
exports.showInfoNotification = showInfoNotification;
|
|
295
|
+
exports.showLoadingMessage = showLoadingMessage;
|
|
296
|
+
exports.showSuccessAlert = showSuccessAlert;
|
|
297
|
+
exports.showSuccessMessage = showSuccessMessage;
|
|
298
|
+
exports.showSuccessNotification = showSuccessNotification;
|
|
299
|
+
exports.showWarningAlert = showWarningAlert;
|
|
300
|
+
exports.showWarningMessage = showWarningMessage;
|
|
301
|
+
exports.showWarningNotification = showWarningNotification;
|
|
302
|
+
exports.successIcon = successIcon;
|
|
303
|
+
exports.warningIcon = warningIcon;
|
package/cjs/path.cjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var path = require('path-browserify');
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
const {
|
|
8
|
+
basename,
|
|
9
|
+
dirname,
|
|
10
|
+
extname,
|
|
11
|
+
isAbsolute,
|
|
12
|
+
join,
|
|
13
|
+
normalize
|
|
14
|
+
} = path;
|
|
15
|
+
function extractBaseName(path2, keepExt = true) {
|
|
16
|
+
const ext = keepExt ? void 0 : extname(path2);
|
|
17
|
+
return basename(path2, ext);
|
|
18
|
+
}
|
|
19
|
+
function extractExtName(path2) {
|
|
20
|
+
return extname(path2);
|
|
21
|
+
}
|
|
22
|
+
function extractDirName(path2) {
|
|
23
|
+
return dirname(path2);
|
|
24
|
+
}
|
|
25
|
+
function joinPaths(...paths) {
|
|
26
|
+
return join(...paths);
|
|
27
|
+
}
|
|
28
|
+
function isAbsolutePath(path2) {
|
|
29
|
+
return isAbsolute(path2);
|
|
30
|
+
}
|
|
31
|
+
function normalizePath(path2) {
|
|
32
|
+
return normalize(path2);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
exports.extractBaseName = extractBaseName;
|
|
36
|
+
exports.extractDirName = extractDirName;
|
|
37
|
+
exports.extractExtName = extractExtName;
|
|
38
|
+
exports.isAbsolutePath = isAbsolutePath;
|
|
39
|
+
exports.joinPaths = joinPaths;
|
|
40
|
+
exports.normalizePath = normalizePath;
|
package/cjs/pinyin.cjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var pinyinPro = require('pinyin-pro');
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
function parsePinyin(text) {
|
|
8
|
+
return pinyinPro.pinyin(
|
|
9
|
+
text,
|
|
10
|
+
{
|
|
11
|
+
pattern: "pinyin",
|
|
12
|
+
toneType: "none",
|
|
13
|
+
type: "array",
|
|
14
|
+
mode: "normal",
|
|
15
|
+
nonZh: "consecutive"
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
function parsePinyinFirstLetter(text) {
|
|
20
|
+
return pinyinPro.pinyin(
|
|
21
|
+
text,
|
|
22
|
+
{
|
|
23
|
+
pattern: "first",
|
|
24
|
+
toneType: "none",
|
|
25
|
+
type: "array",
|
|
26
|
+
mode: "normal",
|
|
27
|
+
nonZh: "consecutive"
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.parsePinyin = parsePinyin;
|
|
33
|
+
exports.parsePinyinFirstLetter = parsePinyinFirstLetter;
|
package/cjs/security.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var JSEncrypt = require('jsencrypt');
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
function encryptRsa(value, publicKey) {
|
|
8
|
+
const rsa = new JSEncrypt();
|
|
9
|
+
rsa.setPublicKey(publicKey);
|
|
10
|
+
const encrypted = rsa.encrypt(value);
|
|
11
|
+
if (!encrypted) {
|
|
12
|
+
throw new Error(`Failed to encrypt value [${value}] using RSA`);
|
|
13
|
+
}
|
|
14
|
+
return encrypted;
|
|
15
|
+
}
|
|
16
|
+
function decryptRsa(value, privateKey) {
|
|
17
|
+
const rsa = new JSEncrypt();
|
|
18
|
+
rsa.setPrivateKey(privateKey);
|
|
19
|
+
const decrypted = rsa.decrypt(value);
|
|
20
|
+
if (!decrypted) {
|
|
21
|
+
throw new Error(`Failed to decrypt value [${value}] using RSA`);
|
|
22
|
+
}
|
|
23
|
+
return decrypted;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.decryptRsa = decryptRsa;
|
|
27
|
+
exports.encryptRsa = encryptRsa;
|