@vef-framework/shared 1.0.127 → 1.0.129
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 +1 -10
- package/cjs/constants.cjs +1 -38
- package/cjs/context.cjs +1 -35
- package/cjs/dom.cjs +1 -22
- package/cjs/error.cjs +1 -29
- package/cjs/event.cjs +1 -10
- package/cjs/expression.cjs +1 -26
- package/cjs/function.cjs +1 -15
- package/cjs/icons.cjs +1 -135
- package/cjs/id.cjs +1 -13
- package/cjs/index.cjs +1 -317
- package/cjs/json.cjs +1 -17
- package/cjs/message.cjs +1 -302
- package/cjs/module.cjs +2 -0
- package/cjs/path.cjs +1 -39
- package/cjs/pinyin.cjs +1 -32
- package/cjs/security.cjs +1 -26
- package/cjs/store.cjs +1 -103
- package/cjs/styles.cjs +1 -54
- package/cjs/temporal.cjs +1 -26
- package/cjs/theme-variables.cjs +1 -353
- package/cjs/types.cjs +0 -2
- package/cjs/utils.cjs +1 -322
- package/cjs/validation.cjs +1 -188
- package/cjs/yaml.cjs +1 -10
- package/cjs/zod.cjs +1 -26
- package/esm/color.js +1 -8
- package/esm/constants.js +1 -30
- package/esm/context.js +1 -33
- package/esm/dom.js +1 -20
- package/esm/error.js +1 -27
- package/esm/event.js +1 -8
- package/esm/expression.js +1 -22
- package/esm/function.js +1 -13
- package/esm/icons.js +1 -128
- package/esm/id.js +1 -11
- package/esm/index.js +1 -31
- package/esm/json.js +1 -15
- package/esm/message.js +1 -281
- package/esm/module.js +2 -0
- package/esm/path.js +1 -32
- package/esm/pinyin.js +1 -29
- package/esm/security.js +1 -23
- package/esm/store.js +1 -98
- package/esm/styles.js +1 -50
- package/esm/temporal.js +1 -22
- package/esm/theme-variables.js +1 -351
- package/esm/utils.js +1 -110
- package/esm/validation.js +1 -150
- package/esm/yaml.js +1 -8
- package/esm/zod.js +1 -21
- package/package.json +1 -1
- package/types/index.d.ts +1 -0
- package/types/module.d.ts +7 -0
package/cjs/utils.cjs
CHANGED
|
@@ -1,323 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var radashi = require('radashi');
|
|
5
|
-
var reactFastCompare = require('react-fast-compare');
|
|
6
|
-
var shallow = require('zustand/shallow');
|
|
7
|
-
|
|
8
|
-
"use strict";
|
|
9
|
-
function isAsyncFunction(fn) {
|
|
10
|
-
if (!radashi.isFunction(fn)) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
return fn.constructor.name === "AsyncFunction" || Object.prototype.toString.call(fn) === "[object AsyncFunction]" || fn.toString().startsWith("async ");
|
|
14
|
-
}
|
|
15
|
-
async function invokeMaybeAsyncFn(fn, {
|
|
16
|
-
beforeInvoke,
|
|
17
|
-
onSuccess,
|
|
18
|
-
onFinally
|
|
19
|
-
}, ...args) {
|
|
20
|
-
if (isAsyncFunction(fn)) {
|
|
21
|
-
try {
|
|
22
|
-
beforeInvoke?.();
|
|
23
|
-
const result = await fn(...args);
|
|
24
|
-
onSuccess?.(result);
|
|
25
|
-
return result;
|
|
26
|
-
} finally {
|
|
27
|
-
onFinally?.();
|
|
28
|
-
}
|
|
29
|
-
} else {
|
|
30
|
-
const returned = fn(...args);
|
|
31
|
-
if (returned instanceof Promise) {
|
|
32
|
-
try {
|
|
33
|
-
beforeInvoke?.();
|
|
34
|
-
const result = await returned;
|
|
35
|
-
onSuccess?.(result);
|
|
36
|
-
return result;
|
|
37
|
-
} finally {
|
|
38
|
-
onFinally?.();
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
return returned;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function difference(oldValues, newValues) {
|
|
46
|
-
return Object.keys(newValues).filter((key) => oldValues[key] !== newValues[key]).reduce(
|
|
47
|
-
(acc, key) => {
|
|
48
|
-
acc[key] = newValues[key];
|
|
49
|
-
return acc;
|
|
50
|
-
},
|
|
51
|
-
{}
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
function constantCase(value) {
|
|
55
|
-
return radashi.snake(value).toUpperCase();
|
|
56
|
-
}
|
|
57
|
-
function isInternalFunction(fn) {
|
|
58
|
-
if (isAsyncFunction(fn) && Reflect.has(fn, "name") && Reflect.has(fn, "key") && Reflect.get(fn, "name") === "apiFn") {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
function getStringLength(value) {
|
|
64
|
-
if (radashi.isNumber(value)) {
|
|
65
|
-
return `${value}px`;
|
|
66
|
-
}
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
function buildRouteParentMenusMappings(menus) {
|
|
70
|
-
return new Map(doBuildRouteParentMenusMappings(menus));
|
|
71
|
-
}
|
|
72
|
-
function doBuildRouteParentMenusMappings(menus, parents = []) {
|
|
73
|
-
return menus.flatMap((menu) => {
|
|
74
|
-
if (menu.type === "item") {
|
|
75
|
-
return [[menu.key, [menu, parents]]];
|
|
76
|
-
} else if (menu.type === "submenu" || menu.type === "group") {
|
|
77
|
-
const { children, ...parent } = menu;
|
|
78
|
-
return [
|
|
79
|
-
[
|
|
80
|
-
parent.key,
|
|
81
|
-
[
|
|
82
|
-
{
|
|
83
|
-
...parent,
|
|
84
|
-
children: []
|
|
85
|
-
},
|
|
86
|
-
parents
|
|
87
|
-
]
|
|
88
|
-
],
|
|
89
|
-
...doBuildRouteParentMenusMappings(children, [
|
|
90
|
-
...parents,
|
|
91
|
-
{
|
|
92
|
-
...parent,
|
|
93
|
-
children: children.filter((child) => child.type !== "divider").map((child) => {
|
|
94
|
-
if (child.type === "item") {
|
|
95
|
-
return {
|
|
96
|
-
...child
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
return {
|
|
100
|
-
...child,
|
|
101
|
-
children: []
|
|
102
|
-
};
|
|
103
|
-
})
|
|
104
|
-
}
|
|
105
|
-
])
|
|
106
|
-
];
|
|
107
|
-
}
|
|
108
|
-
return [];
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
Object.defineProperty(exports, "assign", {
|
|
113
|
-
enumerable: true,
|
|
114
|
-
get: function () { return radashi.assign; }
|
|
115
|
-
});
|
|
116
|
-
Object.defineProperty(exports, "camelCase", {
|
|
117
|
-
enumerable: true,
|
|
118
|
-
get: function () { return radashi.camel; }
|
|
119
|
-
});
|
|
120
|
-
Object.defineProperty(exports, "capitalize", {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () { return radashi.capitalize; }
|
|
123
|
-
});
|
|
124
|
-
Object.defineProperty(exports, "clone", {
|
|
125
|
-
enumerable: true,
|
|
126
|
-
get: function () { return radashi.clone; }
|
|
127
|
-
});
|
|
128
|
-
Object.defineProperty(exports, "cloneDeep", {
|
|
129
|
-
enumerable: true,
|
|
130
|
-
get: function () { return radashi.cloneDeep; }
|
|
131
|
-
});
|
|
132
|
-
Object.defineProperty(exports, "cluster", {
|
|
133
|
-
enumerable: true,
|
|
134
|
-
get: function () { return radashi.cluster; }
|
|
135
|
-
});
|
|
136
|
-
Object.defineProperty(exports, "dashCase", {
|
|
137
|
-
enumerable: true,
|
|
138
|
-
get: function () { return radashi.dash; }
|
|
139
|
-
});
|
|
140
|
-
Object.defineProperty(exports, "debounce", {
|
|
141
|
-
enumerable: true,
|
|
142
|
-
get: function () { return radashi.debounce; }
|
|
143
|
-
});
|
|
144
|
-
Object.defineProperty(exports, "get", {
|
|
145
|
-
enumerable: true,
|
|
146
|
-
get: function () { return radashi.get; }
|
|
147
|
-
});
|
|
148
|
-
Object.defineProperty(exports, "isArray", {
|
|
149
|
-
enumerable: true,
|
|
150
|
-
get: function () { return radashi.isArray; }
|
|
151
|
-
});
|
|
152
|
-
Object.defineProperty(exports, "isBoolean", {
|
|
153
|
-
enumerable: true,
|
|
154
|
-
get: function () { return radashi.isBoolean; }
|
|
155
|
-
});
|
|
156
|
-
Object.defineProperty(exports, "isDate", {
|
|
157
|
-
enumerable: true,
|
|
158
|
-
get: function () { return radashi.isDate; }
|
|
159
|
-
});
|
|
160
|
-
Object.defineProperty(exports, "isEmpty", {
|
|
161
|
-
enumerable: true,
|
|
162
|
-
get: function () { return radashi.isEmpty; }
|
|
163
|
-
});
|
|
164
|
-
Object.defineProperty(exports, "isError", {
|
|
165
|
-
enumerable: true,
|
|
166
|
-
get: function () { return radashi.isError; }
|
|
167
|
-
});
|
|
168
|
-
Object.defineProperty(exports, "isFloat", {
|
|
169
|
-
enumerable: true,
|
|
170
|
-
get: function () { return radashi.isFloat; }
|
|
171
|
-
});
|
|
172
|
-
Object.defineProperty(exports, "isFunction", {
|
|
173
|
-
enumerable: true,
|
|
174
|
-
get: function () { return radashi.isFunction; }
|
|
175
|
-
});
|
|
176
|
-
Object.defineProperty(exports, "isInt", {
|
|
177
|
-
enumerable: true,
|
|
178
|
-
get: function () { return radashi.isInt; }
|
|
179
|
-
});
|
|
180
|
-
Object.defineProperty(exports, "isIntString", {
|
|
181
|
-
enumerable: true,
|
|
182
|
-
get: function () { return radashi.isIntString; }
|
|
183
|
-
});
|
|
184
|
-
Object.defineProperty(exports, "isMap", {
|
|
185
|
-
enumerable: true,
|
|
186
|
-
get: function () { return radashi.isMap; }
|
|
187
|
-
});
|
|
188
|
-
Object.defineProperty(exports, "isNullish", {
|
|
189
|
-
enumerable: true,
|
|
190
|
-
get: function () { return radashi.isNullish; }
|
|
191
|
-
});
|
|
192
|
-
Object.defineProperty(exports, "isNumber", {
|
|
193
|
-
enumerable: true,
|
|
194
|
-
get: function () { return radashi.isNumber; }
|
|
195
|
-
});
|
|
196
|
-
Object.defineProperty(exports, "isObject", {
|
|
197
|
-
enumerable: true,
|
|
198
|
-
get: function () { return radashi.isObject; }
|
|
199
|
-
});
|
|
200
|
-
Object.defineProperty(exports, "isPlainObject", {
|
|
201
|
-
enumerable: true,
|
|
202
|
-
get: function () { return radashi.isPlainObject; }
|
|
203
|
-
});
|
|
204
|
-
Object.defineProperty(exports, "isPrimitive", {
|
|
205
|
-
enumerable: true,
|
|
206
|
-
get: function () { return radashi.isPrimitive; }
|
|
207
|
-
});
|
|
208
|
-
Object.defineProperty(exports, "isPromise", {
|
|
209
|
-
enumerable: true,
|
|
210
|
-
get: function () { return radashi.isPromise; }
|
|
211
|
-
});
|
|
212
|
-
Object.defineProperty(exports, "isRegExp", {
|
|
213
|
-
enumerable: true,
|
|
214
|
-
get: function () { return radashi.isRegExp; }
|
|
215
|
-
});
|
|
216
|
-
Object.defineProperty(exports, "isSet", {
|
|
217
|
-
enumerable: true,
|
|
218
|
-
get: function () { return radashi.isSet; }
|
|
219
|
-
});
|
|
220
|
-
Object.defineProperty(exports, "isString", {
|
|
221
|
-
enumerable: true,
|
|
222
|
-
get: function () { return radashi.isString; }
|
|
223
|
-
});
|
|
224
|
-
Object.defineProperty(exports, "isSymbol", {
|
|
225
|
-
enumerable: true,
|
|
226
|
-
get: function () { return radashi.isSymbol; }
|
|
227
|
-
});
|
|
228
|
-
Object.defineProperty(exports, "isUndefined", {
|
|
229
|
-
enumerable: true,
|
|
230
|
-
get: function () { return radashi.isUndefined; }
|
|
231
|
-
});
|
|
232
|
-
Object.defineProperty(exports, "isWeakMap", {
|
|
233
|
-
enumerable: true,
|
|
234
|
-
get: function () { return radashi.isWeakMap; }
|
|
235
|
-
});
|
|
236
|
-
Object.defineProperty(exports, "isWeakSet", {
|
|
237
|
-
enumerable: true,
|
|
238
|
-
get: function () { return radashi.isWeakSet; }
|
|
239
|
-
});
|
|
240
|
-
Object.defineProperty(exports, "max", {
|
|
241
|
-
enumerable: true,
|
|
242
|
-
get: function () { return radashi.max; }
|
|
243
|
-
});
|
|
244
|
-
Object.defineProperty(exports, "memoize", {
|
|
245
|
-
enumerable: true,
|
|
246
|
-
get: function () { return radashi.memo; }
|
|
247
|
-
});
|
|
248
|
-
Object.defineProperty(exports, "min", {
|
|
249
|
-
enumerable: true,
|
|
250
|
-
get: function () { return radashi.min; }
|
|
251
|
-
});
|
|
252
|
-
Object.defineProperty(exports, "noop", {
|
|
253
|
-
enumerable: true,
|
|
254
|
-
get: function () { return radashi.noop; }
|
|
255
|
-
});
|
|
256
|
-
Object.defineProperty(exports, "omit", {
|
|
257
|
-
enumerable: true,
|
|
258
|
-
get: function () { return radashi.omit; }
|
|
259
|
-
});
|
|
260
|
-
Object.defineProperty(exports, "once", {
|
|
261
|
-
enumerable: true,
|
|
262
|
-
get: function () { return radashi.once; }
|
|
263
|
-
});
|
|
264
|
-
Object.defineProperty(exports, "pascalCase", {
|
|
265
|
-
enumerable: true,
|
|
266
|
-
get: function () { return radashi.pascal; }
|
|
267
|
-
});
|
|
268
|
-
Object.defineProperty(exports, "pick", {
|
|
269
|
-
enumerable: true,
|
|
270
|
-
get: function () { return radashi.pick; }
|
|
271
|
-
});
|
|
272
|
-
Object.defineProperty(exports, "set", {
|
|
273
|
-
enumerable: true,
|
|
274
|
-
get: function () { return radashi.set; }
|
|
275
|
-
});
|
|
276
|
-
Object.defineProperty(exports, "similarity", {
|
|
277
|
-
enumerable: true,
|
|
278
|
-
get: function () { return radashi.similarity; }
|
|
279
|
-
});
|
|
280
|
-
Object.defineProperty(exports, "snakeCase", {
|
|
281
|
-
enumerable: true,
|
|
282
|
-
get: function () { return radashi.snake; }
|
|
283
|
-
});
|
|
284
|
-
Object.defineProperty(exports, "sum", {
|
|
285
|
-
enumerable: true,
|
|
286
|
-
get: function () { return radashi.sum; }
|
|
287
|
-
});
|
|
288
|
-
Object.defineProperty(exports, "template", {
|
|
289
|
-
enumerable: true,
|
|
290
|
-
get: function () { return radashi.template; }
|
|
291
|
-
});
|
|
292
|
-
Object.defineProperty(exports, "throttle", {
|
|
293
|
-
enumerable: true,
|
|
294
|
-
get: function () { return radashi.throttle; }
|
|
295
|
-
});
|
|
296
|
-
Object.defineProperty(exports, "toFloat", {
|
|
297
|
-
enumerable: true,
|
|
298
|
-
get: function () { return radashi.toFloat; }
|
|
299
|
-
});
|
|
300
|
-
Object.defineProperty(exports, "toInt", {
|
|
301
|
-
enumerable: true,
|
|
302
|
-
get: function () { return radashi.toInt; }
|
|
303
|
-
});
|
|
304
|
-
Object.defineProperty(exports, "trim", {
|
|
305
|
-
enumerable: true,
|
|
306
|
-
get: function () { return radashi.trim; }
|
|
307
|
-
});
|
|
308
|
-
Object.defineProperty(exports, "unique", {
|
|
309
|
-
enumerable: true,
|
|
310
|
-
get: function () { return radashi.unique; }
|
|
311
|
-
});
|
|
312
|
-
exports.isDeepEqual = reactFastCompare;
|
|
313
|
-
Object.defineProperty(exports, "isShallowEqual", {
|
|
314
|
-
enumerable: true,
|
|
315
|
-
get: function () { return shallow.shallow; }
|
|
316
|
-
});
|
|
317
|
-
exports.buildRouteParentMenusMappings = buildRouteParentMenusMappings;
|
|
318
|
-
exports.constantCase = constantCase;
|
|
319
|
-
exports.difference = difference;
|
|
320
|
-
exports.getStringLength = getStringLength;
|
|
321
|
-
exports.invokeMaybeAsyncFn = invokeMaybeAsyncFn;
|
|
322
|
-
exports.isAsyncFunction = isAsyncFunction;
|
|
323
|
-
exports.isInternalFunction = isInternalFunction;
|
|
2
|
+
"use strict";var e=require("radashi"),s=require("react-fast-compare"),b=require("zustand/shallow");function c(t){return e.isFunction(t)?t.constructor.name==="AsyncFunction"||Object.prototype.toString.call(t)==="[object AsyncFunction]"||t.toString().startsWith("async "):!1}async function l(t,{beforeInvoke:u,onSuccess:r,onFinally:i},...o){if(c(t))try{u?.();const n=await t(...o);return r?.(n),n}finally{i?.()}else{const n=t(...o);if(n instanceof Promise)try{u?.();const a=await n;return r?.(a),a}finally{i?.()}else return n}}function m(t,u){return Object.keys(u).filter(r=>t[r]!==u[r]).reduce((r,i)=>(r[i]=u[i],r),{})}function p(t){return e.snake(t).toUpperCase()}function y(t){return!!(c(t)&&Reflect.has(t,"name")&&Reflect.has(t,"key")&&Reflect.get(t,"name")==="apiFn")}function g(t){return e.isNumber(t)?`${t}px`:t}function d(t){return new Map(f(t))}function f(t,u=[]){return t.flatMap(r=>{if(r.type==="item")return[[r.key,[r,u]]];if(r.type==="submenu"||r.type==="group"){const{children:i,...o}=r;return[[o.key,[{...o,children:[]},u]],...f(i,[...u,{...o,children:i.filter(n=>n.type!=="divider").map(n=>n.type==="item"?{...n}:{...n,children:[]})}])]}return[]})}Object.defineProperty(exports,"assign",{enumerable:!0,get:function(){return e.assign}}),Object.defineProperty(exports,"camelCase",{enumerable:!0,get:function(){return e.camel}}),Object.defineProperty(exports,"capitalize",{enumerable:!0,get:function(){return e.capitalize}}),Object.defineProperty(exports,"clone",{enumerable:!0,get:function(){return e.clone}}),Object.defineProperty(exports,"cloneDeep",{enumerable:!0,get:function(){return e.cloneDeep}}),Object.defineProperty(exports,"cluster",{enumerable:!0,get:function(){return e.cluster}}),Object.defineProperty(exports,"dashCase",{enumerable:!0,get:function(){return e.dash}}),Object.defineProperty(exports,"debounce",{enumerable:!0,get:function(){return e.debounce}}),Object.defineProperty(exports,"get",{enumerable:!0,get:function(){return e.get}}),Object.defineProperty(exports,"isArray",{enumerable:!0,get:function(){return e.isArray}}),Object.defineProperty(exports,"isBoolean",{enumerable:!0,get:function(){return e.isBoolean}}),Object.defineProperty(exports,"isDate",{enumerable:!0,get:function(){return e.isDate}}),Object.defineProperty(exports,"isEmpty",{enumerable:!0,get:function(){return e.isEmpty}}),Object.defineProperty(exports,"isError",{enumerable:!0,get:function(){return e.isError}}),Object.defineProperty(exports,"isFloat",{enumerable:!0,get:function(){return e.isFloat}}),Object.defineProperty(exports,"isFunction",{enumerable:!0,get:function(){return e.isFunction}}),Object.defineProperty(exports,"isInt",{enumerable:!0,get:function(){return e.isInt}}),Object.defineProperty(exports,"isIntString",{enumerable:!0,get:function(){return e.isIntString}}),Object.defineProperty(exports,"isMap",{enumerable:!0,get:function(){return e.isMap}}),Object.defineProperty(exports,"isNullish",{enumerable:!0,get:function(){return e.isNullish}}),Object.defineProperty(exports,"isNumber",{enumerable:!0,get:function(){return e.isNumber}}),Object.defineProperty(exports,"isObject",{enumerable:!0,get:function(){return e.isObject}}),Object.defineProperty(exports,"isPlainObject",{enumerable:!0,get:function(){return e.isPlainObject}}),Object.defineProperty(exports,"isPrimitive",{enumerable:!0,get:function(){return e.isPrimitive}}),Object.defineProperty(exports,"isPromise",{enumerable:!0,get:function(){return e.isPromise}}),Object.defineProperty(exports,"isRegExp",{enumerable:!0,get:function(){return e.isRegExp}}),Object.defineProperty(exports,"isSet",{enumerable:!0,get:function(){return e.isSet}}),Object.defineProperty(exports,"isString",{enumerable:!0,get:function(){return e.isString}}),Object.defineProperty(exports,"isSymbol",{enumerable:!0,get:function(){return e.isSymbol}}),Object.defineProperty(exports,"isUndefined",{enumerable:!0,get:function(){return e.isUndefined}}),Object.defineProperty(exports,"isWeakMap",{enumerable:!0,get:function(){return e.isWeakMap}}),Object.defineProperty(exports,"isWeakSet",{enumerable:!0,get:function(){return e.isWeakSet}}),Object.defineProperty(exports,"max",{enumerable:!0,get:function(){return e.max}}),Object.defineProperty(exports,"memoize",{enumerable:!0,get:function(){return e.memo}}),Object.defineProperty(exports,"min",{enumerable:!0,get:function(){return e.min}}),Object.defineProperty(exports,"noop",{enumerable:!0,get:function(){return e.noop}}),Object.defineProperty(exports,"omit",{enumerable:!0,get:function(){return e.omit}}),Object.defineProperty(exports,"once",{enumerable:!0,get:function(){return e.once}}),Object.defineProperty(exports,"pascalCase",{enumerable:!0,get:function(){return e.pascal}}),Object.defineProperty(exports,"pick",{enumerable:!0,get:function(){return e.pick}}),Object.defineProperty(exports,"set",{enumerable:!0,get:function(){return e.set}}),Object.defineProperty(exports,"similarity",{enumerable:!0,get:function(){return e.similarity}}),Object.defineProperty(exports,"snakeCase",{enumerable:!0,get:function(){return e.snake}}),Object.defineProperty(exports,"sum",{enumerable:!0,get:function(){return e.sum}}),Object.defineProperty(exports,"template",{enumerable:!0,get:function(){return e.template}}),Object.defineProperty(exports,"throttle",{enumerable:!0,get:function(){return e.throttle}}),Object.defineProperty(exports,"toFloat",{enumerable:!0,get:function(){return e.toFloat}}),Object.defineProperty(exports,"toInt",{enumerable:!0,get:function(){return e.toInt}}),Object.defineProperty(exports,"trim",{enumerable:!0,get:function(){return e.trim}}),Object.defineProperty(exports,"unique",{enumerable:!0,get:function(){return e.unique}}),exports.isDeepEqual=s,Object.defineProperty(exports,"isShallowEqual",{enumerable:!0,get:function(){return b.shallow}}),exports.buildRouteParentMenusMappings=d,exports.constantCase=p,exports.difference=m,exports.getStringLength=g,exports.invokeMaybeAsyncFn=l,exports.isAsyncFunction=c,exports.isInternalFunction=y;
|
package/cjs/validation.cjs
CHANGED
|
@@ -1,189 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var validator = require('validator');
|
|
5
|
-
|
|
6
|
-
"use strict";
|
|
7
|
-
function isAlpha(value) {
|
|
8
|
-
return validator.isAlpha(value);
|
|
9
|
-
}
|
|
10
|
-
function isAlphanumeric(value) {
|
|
11
|
-
return validator.isAlphanumeric(value);
|
|
12
|
-
}
|
|
13
|
-
function isAscii(value) {
|
|
14
|
-
return validator.isAscii(value);
|
|
15
|
-
}
|
|
16
|
-
function isNumeric(value) {
|
|
17
|
-
return validator.isNumeric(value);
|
|
18
|
-
}
|
|
19
|
-
function isDecimal(value) {
|
|
20
|
-
return validator.isDecimal(value);
|
|
21
|
-
}
|
|
22
|
-
function isFloat(value, options) {
|
|
23
|
-
return validator.isFloat(value, options);
|
|
24
|
-
}
|
|
25
|
-
function isBoolean(value) {
|
|
26
|
-
return validator.isBoolean(value, {
|
|
27
|
-
loose: false
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function isDate(value) {
|
|
31
|
-
return validator.isDate(value, {
|
|
32
|
-
format: "YYYY-MM-DD",
|
|
33
|
-
strictMode: true
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function isEmpty(value) {
|
|
37
|
-
return validator.isEmpty(value);
|
|
38
|
-
}
|
|
39
|
-
function isBlank(value) {
|
|
40
|
-
return validator.isEmpty(value, {
|
|
41
|
-
ignore_whitespace: true
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function isIdentityCard(value) {
|
|
45
|
-
return validator.isIdentityCard(value, "zh-CN");
|
|
46
|
-
}
|
|
47
|
-
function isAfter(value, date) {
|
|
48
|
-
return validator.isAfter(value, date);
|
|
49
|
-
}
|
|
50
|
-
function isBefore(value, date) {
|
|
51
|
-
return validator.isBefore(value, date);
|
|
52
|
-
}
|
|
53
|
-
function isEmail(value) {
|
|
54
|
-
return validator.isEmail(value);
|
|
55
|
-
}
|
|
56
|
-
function isHexColor(value) {
|
|
57
|
-
return validator.isHexColor(value);
|
|
58
|
-
}
|
|
59
|
-
function isIn(value, values) {
|
|
60
|
-
return validator.isIn(value, values);
|
|
61
|
-
}
|
|
62
|
-
function isInt(value, options) {
|
|
63
|
-
return validator.isInt(value, options);
|
|
64
|
-
}
|
|
65
|
-
function isIp(value, version) {
|
|
66
|
-
return validator.isIP(value, version);
|
|
67
|
-
}
|
|
68
|
-
function isIpRange(value, version) {
|
|
69
|
-
return validator.isIPRange(value, version);
|
|
70
|
-
}
|
|
71
|
-
function isJson(value) {
|
|
72
|
-
return validator.isJSON(value);
|
|
73
|
-
}
|
|
74
|
-
function isJwt(value) {
|
|
75
|
-
return validator.isJWT(value);
|
|
76
|
-
}
|
|
77
|
-
function isLatLong(value) {
|
|
78
|
-
return validator.isLatLong(value);
|
|
79
|
-
}
|
|
80
|
-
function isLength(value, options) {
|
|
81
|
-
return validator.isLength(value, options);
|
|
82
|
-
}
|
|
83
|
-
function isMimeType(value) {
|
|
84
|
-
return validator.isMimeType(value);
|
|
85
|
-
}
|
|
86
|
-
function isMobilePhone(value) {
|
|
87
|
-
return validator.isMobilePhone(value, "zh-CN");
|
|
88
|
-
}
|
|
89
|
-
function isPort(value) {
|
|
90
|
-
return validator.isPort(value);
|
|
91
|
-
}
|
|
92
|
-
function isPostalCode(value) {
|
|
93
|
-
return validator.isPostalCode(value, "CN");
|
|
94
|
-
}
|
|
95
|
-
function isSemVer(value) {
|
|
96
|
-
return validator.isSemVer(value);
|
|
97
|
-
}
|
|
98
|
-
function isSlug(value) {
|
|
99
|
-
return validator.isSlug(value);
|
|
100
|
-
}
|
|
101
|
-
function isStrongPassword(value) {
|
|
102
|
-
return validator.isStrongPassword(value, {
|
|
103
|
-
minLength: 8,
|
|
104
|
-
minLowercase: 1,
|
|
105
|
-
minUppercase: 1,
|
|
106
|
-
minNumbers: 1,
|
|
107
|
-
minSymbols: 1
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
function isTime(value, options) {
|
|
111
|
-
return validator.isTime(value, options);
|
|
112
|
-
}
|
|
113
|
-
function isUrl(value) {
|
|
114
|
-
return validator.isURL(value, {
|
|
115
|
-
protocols: ["http", "https"],
|
|
116
|
-
require_tld: true,
|
|
117
|
-
require_protocol: true,
|
|
118
|
-
require_host: true,
|
|
119
|
-
require_port: false,
|
|
120
|
-
require_valid_protocol: true,
|
|
121
|
-
allow_underscores: true
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
function isUri(value) {
|
|
125
|
-
return validator.isURL(value, {
|
|
126
|
-
protocols: [],
|
|
127
|
-
require_tld: false,
|
|
128
|
-
require_protocol: false,
|
|
129
|
-
require_host: false,
|
|
130
|
-
require_port: false,
|
|
131
|
-
require_valid_protocol: false,
|
|
132
|
-
allow_underscores: true,
|
|
133
|
-
allow_fragments: false,
|
|
134
|
-
allow_query_components: false,
|
|
135
|
-
allow_protocol_relative_urls: false
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
function isUuid(value, version) {
|
|
139
|
-
return validator.isUUID(value, version);
|
|
140
|
-
}
|
|
141
|
-
function isDateTime(value) {
|
|
142
|
-
const [date, time] = value.split(" ", 2);
|
|
143
|
-
return isDate(date) && isTime(time);
|
|
144
|
-
}
|
|
145
|
-
function matches(value, pattern, modifiers) {
|
|
146
|
-
return validator.matches(value, pattern, modifiers);
|
|
147
|
-
}
|
|
148
|
-
const chineseNameRegExp = /^[\u4E00-\u9FA5]+\d*$/;
|
|
149
|
-
function isChineseName(value) {
|
|
150
|
-
return chineseNameRegExp.test(value);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
exports.isAfter = isAfter;
|
|
154
|
-
exports.isAlpha = isAlpha;
|
|
155
|
-
exports.isAlphanumeric = isAlphanumeric;
|
|
156
|
-
exports.isAscii = isAscii;
|
|
157
|
-
exports.isBefore = isBefore;
|
|
158
|
-
exports.isBlank = isBlank;
|
|
159
|
-
exports.isBoolean = isBoolean;
|
|
160
|
-
exports.isChineseName = isChineseName;
|
|
161
|
-
exports.isDate = isDate;
|
|
162
|
-
exports.isDateTime = isDateTime;
|
|
163
|
-
exports.isDecimal = isDecimal;
|
|
164
|
-
exports.isEmail = isEmail;
|
|
165
|
-
exports.isEmpty = isEmpty;
|
|
166
|
-
exports.isFloat = isFloat;
|
|
167
|
-
exports.isHexColor = isHexColor;
|
|
168
|
-
exports.isIdentityCard = isIdentityCard;
|
|
169
|
-
exports.isIn = isIn;
|
|
170
|
-
exports.isInt = isInt;
|
|
171
|
-
exports.isIp = isIp;
|
|
172
|
-
exports.isIpRange = isIpRange;
|
|
173
|
-
exports.isJson = isJson;
|
|
174
|
-
exports.isJwt = isJwt;
|
|
175
|
-
exports.isLatLong = isLatLong;
|
|
176
|
-
exports.isLength = isLength;
|
|
177
|
-
exports.isMimeType = isMimeType;
|
|
178
|
-
exports.isMobilePhone = isMobilePhone;
|
|
179
|
-
exports.isNumeric = isNumeric;
|
|
180
|
-
exports.isPort = isPort;
|
|
181
|
-
exports.isPostalCode = isPostalCode;
|
|
182
|
-
exports.isSemVer = isSemVer;
|
|
183
|
-
exports.isSlug = isSlug;
|
|
184
|
-
exports.isStrongPassword = isStrongPassword;
|
|
185
|
-
exports.isTime = isTime;
|
|
186
|
-
exports.isUri = isUri;
|
|
187
|
-
exports.isUrl = isUrl;
|
|
188
|
-
exports.isUuid = isUuid;
|
|
189
|
-
exports.matches = matches;
|
|
2
|
+
"use strict";var n=require("validator");function o(i){return n.isAlpha(i)}function u(i){return n.isAlphanumeric(i)}function c(i){return n.isAscii(i)}function l(i){return n.isNumeric(i)}function a(i){return n.isDecimal(i)}function f(i,r){return n.isFloat(i,r)}function m(i){return n.isBoolean(i,{loose:!1})}function s(i){return n.isDate(i,{format:"YYYY-MM-DD",strictMode:!0})}function p(i){return n.isEmpty(i)}function h(i){return n.isEmpty(i,{ignore_whitespace:!0})}function d(i){return n.isIdentityCard(i,"zh-CN")}function _(i,r){return n.isAfter(i,r)}function g(i,r){return n.isBefore(i,r)}function I(i){return n.isEmail(i)}function C(i){return n.isHexColor(i)}function P(i,r){return n.isIn(i,r)}function A(i,r){return n.isInt(i,r)}function L(i,r){return n.isIP(i,r)}function q(i,r){return n.isIPRange(i,r)}function w(i){return n.isJSON(i)}function y(i){return n.isJWT(i)}function D(i){return n.isLatLong(i)}function S(i,r){return n.isLength(i,r)}function U(i){return n.isMimeType(i)}function N(i){return n.isMobilePhone(i,"zh-CN")}function M(i){return n.isPort(i)}function T(i){return n.isPostalCode(i,"CN")}function B(i){return n.isSemVer(i)}function E(i){return n.isSlug(i)}function J(i){return n.isStrongPassword(i,{minLength:8,minLowercase:1,minUppercase:1,minNumbers:1,minSymbols:1})}function t(i,r){return n.isTime(i,r)}function b(i){return n.isURL(i,{protocols:["http","https"],require_tld:!0,require_protocol:!0,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!0})}function R(i){return n.isURL(i,{protocols:[],require_tld:!1,require_protocol:!1,require_host:!1,require_port:!1,require_valid_protocol:!1,allow_underscores:!0,allow_fragments:!1,allow_query_components:!1,allow_protocol_relative_urls:!1})}function v(i,r){return n.isUUID(i,r)}function F(i){const[r,e]=i.split(" ",2);return s(r)&&t(e)}function Y(i,r,e){return n.matches(i,r,e)}const x=/^[\u4E00-\u9FA5]+\d*$/;function H(i){return x.test(i)}exports.isAfter=_,exports.isAlpha=o,exports.isAlphanumeric=u,exports.isAscii=c,exports.isBefore=g,exports.isBlank=h,exports.isBoolean=m,exports.isChineseName=H,exports.isDate=s,exports.isDateTime=F,exports.isDecimal=a,exports.isEmail=I,exports.isEmpty=p,exports.isFloat=f,exports.isHexColor=C,exports.isIdentityCard=d,exports.isIn=P,exports.isInt=A,exports.isIp=L,exports.isIpRange=q,exports.isJson=w,exports.isJwt=y,exports.isLatLong=D,exports.isLength=S,exports.isMimeType=U,exports.isMobilePhone=N,exports.isNumeric=l,exports.isPort=M,exports.isPostalCode=T,exports.isSemVer=B,exports.isSlug=E,exports.isStrongPassword=J,exports.isTime=t,exports.isUri=R,exports.isUrl=b,exports.isUuid=v,exports.matches=Y;
|
package/cjs/yaml.cjs
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var jsYaml = require('js-yaml');
|
|
5
|
-
|
|
6
|
-
"use strict";
|
|
7
|
-
function loadYaml(content) {
|
|
8
|
-
return jsYaml.load(content);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
exports.loadYaml = loadYaml;
|
|
2
|
+
"use strict";var r=require("js-yaml");function l(a){return r.load(a)}exports.loadYaml=l;
|
package/cjs/zod.cjs
CHANGED
|
@@ -1,27 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var i18next = require('i18next');
|
|
5
|
-
var zod = require('zod');
|
|
6
|
-
var zodI18nMap = require('zod-i18n-map');
|
|
7
|
-
var translation = require('zod-i18n-map/locales/zh-CN/zod.json');
|
|
8
|
-
|
|
9
|
-
"use strict";
|
|
10
|
-
function initZod() {
|
|
11
|
-
i18next.init({
|
|
12
|
-
lng: "zh-CN",
|
|
13
|
-
fallbackLng: false,
|
|
14
|
-
resources: {
|
|
15
|
-
"zh-CN": {
|
|
16
|
-
zod: translation
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
zod.z.setErrorMap(zodI18nMap.zodI18nMap);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
Object.defineProperty(exports, "z", {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function () { return zod.z; }
|
|
26
|
-
});
|
|
27
|
-
exports.initZod = initZod;
|
|
2
|
+
"use strict";var e=require("i18next"),r=require("zod"),i=require("zod-i18n-map"),t=require("zod-i18n-map/locales/zh-CN/zod.json");function n(){e.init({lng:"zh-CN",fallbackLng:!1,resources:{"zh-CN":{zod:t}}}),r.z.setErrorMap(i.zodI18nMap)}Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return r.z}}),exports.initZod=n;
|
package/esm/color.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
"use strict";
|
|
5
|
-
function isValidColor(color) {
|
|
6
|
-
return colord(color).isValid();
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { isValidColor };
|
|
2
|
+
import{colord as r}from"colord";function i(o){return r(o).isValid()}export{i as isValidColor};
|
package/esm/constants.js
CHANGED
|
@@ -1,31 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
const defaultColorTypes = [
|
|
4
|
-
"blue",
|
|
5
|
-
"purple",
|
|
6
|
-
"cyan",
|
|
7
|
-
"green",
|
|
8
|
-
"magenta",
|
|
9
|
-
"pink",
|
|
10
|
-
"red",
|
|
11
|
-
"orange",
|
|
12
|
-
"yellow",
|
|
13
|
-
"volcano",
|
|
14
|
-
"geekblue",
|
|
15
|
-
"gold",
|
|
16
|
-
"lime"
|
|
17
|
-
];
|
|
18
|
-
const semanticColorTypes = [
|
|
19
|
-
"primary",
|
|
20
|
-
"info",
|
|
21
|
-
"success",
|
|
22
|
-
"warning",
|
|
23
|
-
"error"
|
|
24
|
-
];
|
|
25
|
-
const colorTypes = [...defaultColorTypes, ...semanticColorTypes];
|
|
26
|
-
const creationFormScene = "creation";
|
|
27
|
-
const updateFormScene = "update";
|
|
28
|
-
const auditFormScene = "audit";
|
|
29
|
-
const presetFormScenes = [creationFormScene, updateFormScene, auditFormScene];
|
|
30
|
-
|
|
31
|
-
export { auditFormScene, colorTypes, creationFormScene, defaultColorTypes, presetFormScenes, semanticColorTypes, updateFormScene };
|
|
2
|
+
const e=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","gold","lime"],r=["primary","info","success","warning","error"],c=[...e,...r],o="creation",n="update",a="audit",t=[o,n,a];export{a as auditFormScene,c as colorTypes,o as creationFormScene,e as defaultColorTypes,t as presetFormScenes,r as semanticColorTypes,n as updateFormScene};
|
package/esm/context.js
CHANGED
|
@@ -1,34 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
3
|
-
import { createContext, useContextSelector, useContext } from 'use-context-selector';
|
|
4
|
-
import './utils.js';
|
|
5
|
-
import { isNullish } from 'radashi';
|
|
6
|
-
import { shallow } from 'zustand/shallow';
|
|
7
|
-
|
|
8
|
-
"use strict";
|
|
9
|
-
function createSelectableContext(defaultValue) {
|
|
10
|
-
const context = createContext(defaultValue);
|
|
11
|
-
const ContextProvider = context.Provider;
|
|
12
|
-
const useContextSelector$1 = (selector) => {
|
|
13
|
-
const lastSelectedValueRef = useRef();
|
|
14
|
-
return useContextSelector(context, (value) => {
|
|
15
|
-
if (isNullish(value)) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const selectedValue = selector(value);
|
|
19
|
-
if (lastSelectedValueRef.current && shallow(selectedValue, lastSelectedValueRef.current)) {
|
|
20
|
-
return lastSelectedValueRef.current;
|
|
21
|
-
}
|
|
22
|
-
lastSelectedValueRef.current = selectedValue;
|
|
23
|
-
return selectedValue;
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
const useContext$1 = () => useContext(context);
|
|
27
|
-
return {
|
|
28
|
-
ContextProvider,
|
|
29
|
-
useContextSelector: useContextSelector$1,
|
|
30
|
-
useContext: useContext$1
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { createSelectableContext };
|
|
2
|
+
import{useRef as c}from"react";import{createContext as s,useContext as i,useContextSelector as m}from"use-context-selector";import"./utils.js";import{isNullish as l}from"radashi";import{shallow as x}from"zustand/shallow";function f(n){const e=s(n);return{ContextProvider:e.Provider,useContextSelector:u=>{const t=c();return m(e,o=>{if(l(o))return;const r=u(o);return t.current&&x(r,t.current)?t.current:(t.current=r,r)})},useContext:()=>i(e)}}export{f as createSelectableContext};
|
package/esm/dom.js
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
function getElementHeight(element, selector, includeMargin = false) {
|
|
4
|
-
if (selector) {
|
|
5
|
-
const subElement = element.querySelector(selector);
|
|
6
|
-
if (!subElement) {
|
|
7
|
-
return 0;
|
|
8
|
-
}
|
|
9
|
-
element = subElement;
|
|
10
|
-
}
|
|
11
|
-
const height = element.offsetHeight;
|
|
12
|
-
if (!includeMargin) {
|
|
13
|
-
return height;
|
|
14
|
-
}
|
|
15
|
-
const styleMap = element.computedStyleMap();
|
|
16
|
-
const marginTop = styleMap.get("margin-top").value;
|
|
17
|
-
const marginBottom = styleMap.get("margin-bottom").value;
|
|
18
|
-
return height + marginTop + marginBottom;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { getElementHeight };
|
|
2
|
+
function c(t,e,i=!1){if(e){const o=t.querySelector(e);if(!o)return 0;t=o}const r=t.offsetHeight;if(!i)return r;const n=t.computedStyleMap(),u=n.get("margin-top").value,g=n.get("margin-bottom").value;return r+u+g}export{c as getElementHeight};
|