@94ai/common-ui 8.3.23 → 10.0.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/lib/common-ui.cjs.js +5 -0
- package/lib/common-ui.esm-bundler.js +2 -0
- package/lib/common-ui.tool.cjs.cjs +22 -485
- package/lib/common-ui.tool.esm-bundler.mjs +3 -489
- package/lib/index.d.ts +1 -0
- package/package/index.ts +2 -0
- package/package.json +54 -55
package/lib/common-ui.cjs.js
CHANGED
|
@@ -47,6 +47,7 @@ const NfSoftphone = require("@94ai/nf-softphone");
|
|
|
47
47
|
const NfInput = require("@94ai/nf-input");
|
|
48
48
|
const NfMicrophone = require("@94ai/nf-microphone");
|
|
49
49
|
const NfTimezonePicker = require("@94ai/nf-timezone-picker");
|
|
50
|
+
const commonUtils = require("@94ai/common-utils");
|
|
50
51
|
const CommonUI = vueDemi.defineComponent({
|
|
51
52
|
name: "common-ui",
|
|
52
53
|
install(app) {
|
|
@@ -167,4 +168,8 @@ Object.defineProperty(exports, "softphoneManager", {
|
|
|
167
168
|
});
|
|
168
169
|
exports.NfMicrophone = NfMicrophone;
|
|
169
170
|
exports.NfTimezonePicker = NfTimezonePicker;
|
|
171
|
+
Object.defineProperty(exports, "locale", {
|
|
172
|
+
enumerable: true,
|
|
173
|
+
get: () => commonUtils.locale
|
|
174
|
+
});
|
|
170
175
|
exports.default = CommonUI;
|
|
@@ -90,6 +90,7 @@ import NfMicrophone from "@94ai/nf-microphone";
|
|
|
90
90
|
import { default as default45 } from "@94ai/nf-microphone";
|
|
91
91
|
import NfTimezonePicker from "@94ai/nf-timezone-picker";
|
|
92
92
|
import { default as default46 } from "@94ai/nf-timezone-picker";
|
|
93
|
+
import { locale } from "@94ai/common-utils";
|
|
93
94
|
const CommonUI = defineComponent({
|
|
94
95
|
name: "common-ui",
|
|
95
96
|
install(app) {
|
|
@@ -196,5 +197,6 @@ export {
|
|
|
196
197
|
Notification,
|
|
197
198
|
SoftphoneManager,
|
|
198
199
|
CommonUI as default,
|
|
200
|
+
locale,
|
|
199
201
|
softphoneManager
|
|
200
202
|
};
|
|
@@ -1,491 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"NfAlert",
|
|
15
|
-
"NfVirtualSelect",
|
|
16
|
-
"NfTag",
|
|
17
|
-
"NfAction",
|
|
18
|
-
"NfIndicatorPlane",
|
|
19
|
-
"NfQuarterPicker",
|
|
20
|
-
"NfDoubleQuarter",
|
|
21
|
-
"NfDoubleHalfYear",
|
|
22
|
-
"NfHalfYearPicker",
|
|
23
|
-
"NfDoubleWeek",
|
|
24
|
-
"NfDoubleYear",
|
|
25
|
-
"NfDatePicker",
|
|
26
|
-
"NfFormItem",
|
|
27
|
-
"NfForm",
|
|
28
|
-
"NfTable",
|
|
29
|
-
"NfSearchForm",
|
|
30
|
-
"NfDrawer",
|
|
31
|
-
"NfMessage",
|
|
32
|
-
"NfNotification",
|
|
33
|
-
"NfConfirm",
|
|
34
|
-
"NfTextOverflow",
|
|
35
|
-
"NfResizablePanels",
|
|
36
|
-
"NfAddress",
|
|
37
|
-
"NfAudio",
|
|
38
|
-
"NfButton",
|
|
39
|
-
"NfRules",
|
|
40
|
-
"NfConditions",
|
|
41
|
-
"NfKeywords",
|
|
42
|
-
"NfVariableSelect",
|
|
43
|
-
"NfMicrophone",
|
|
44
|
-
"NfSvgIcon",
|
|
45
|
-
"NfLazySelect",
|
|
46
|
-
"NfPopupLazySelect",
|
|
47
|
-
"NfAddressSelect",
|
|
48
|
-
"NfSoftphone"
|
|
49
|
-
];
|
|
50
|
-
const presudos = ["", "webkit", "moz"];
|
|
51
|
-
function resolveDebuger(name) {
|
|
52
|
-
fs.appendFile(path.resolve(__dirname, "./log.txt"), `${name}
|
|
53
|
-
`, () => {
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function kebabCase(key) {
|
|
57
|
-
const result = key.replace(/([A-Z])/g, " $1").trim();
|
|
58
|
-
return result.split(" ").join("-").toLowerCase();
|
|
59
|
-
}
|
|
60
|
-
function isAsyncFunc(func) {
|
|
61
|
-
return func[Symbol(Symbol.toStringTag)] === "AsyncFunction";
|
|
62
|
-
}
|
|
63
|
-
function closest(that, componentName) {
|
|
64
|
-
let vm = that;
|
|
65
|
-
let result;
|
|
66
|
-
while (vm && !result) {
|
|
67
|
-
const name = vm.$options.name;
|
|
68
|
-
if (name === componentName) {
|
|
69
|
-
result = vm;
|
|
70
|
-
}
|
|
71
|
-
vm = vm.$parent;
|
|
72
|
-
}
|
|
73
|
-
return result;
|
|
74
|
-
}
|
|
75
|
-
function getDirs() {
|
|
76
|
-
return ComponentConstantList.map((item) => "node_modules/@94ai/" + kebabCase(item) + "/lib");
|
|
77
|
-
}
|
|
78
|
-
function getTranspileDependencies() {
|
|
79
|
-
return ComponentConstantList.map((item) => "@94ai/" + kebabCase(item));
|
|
80
|
-
}
|
|
81
|
-
const getResolver = () => {
|
|
82
|
-
return {
|
|
83
|
-
type: "component",
|
|
84
|
-
resolve: (name) => {
|
|
85
|
-
resolveDebuger(name);
|
|
86
|
-
if (/^Nf[A-Za-z](?!.*[Mm][Dd]$).*$/.test(name)) {
|
|
87
|
-
const kebabCasePackageName = kebabCase(name);
|
|
88
|
-
return {
|
|
89
|
-
from: `@94ai/${kebabCasePackageName}/lib/${kebabCasePackageName}.esm-bundler.js`,
|
|
90
|
-
sideEffects: []
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
const getJsComponentSampleConfig = (config = {}) => {
|
|
97
|
-
return {
|
|
98
|
-
exclude: [/[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
|
|
99
|
-
include: [
|
|
100
|
-
/\.vue$/,
|
|
101
|
-
/\.vue\?vue/,
|
|
102
|
-
/\.vue\?v=/,
|
|
103
|
-
/\.js$/,
|
|
104
|
-
/\.js\?vue/,
|
|
105
|
-
/\.js\?v=/
|
|
106
|
-
],
|
|
107
|
-
deep: true,
|
|
108
|
-
transformer: "vue2",
|
|
109
|
-
resolvers: [],
|
|
110
|
-
...config
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
const getTsComponentSampleConfig = (config = {}) => {
|
|
114
|
-
return {
|
|
115
|
-
include: [
|
|
116
|
-
/\.vue$/,
|
|
117
|
-
/\.vue\?vue/,
|
|
118
|
-
/\.md$/,
|
|
119
|
-
/\.md\?vue/,
|
|
120
|
-
/\.jsx$/,
|
|
121
|
-
/\.jsx\?vue/,
|
|
122
|
-
/\.tsx$/,
|
|
123
|
-
/\.tsx\?vue/,
|
|
124
|
-
/\.js$/,
|
|
125
|
-
/\.js\?vue/
|
|
126
|
-
],
|
|
127
|
-
deep: true,
|
|
128
|
-
extensions: ["vue", "md", "jsx", "tsx", "mjs", "mts", "js"],
|
|
129
|
-
dirs: ["src/components", "src/views", "doc"],
|
|
130
|
-
resolvers: [],
|
|
131
|
-
...config
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
function generateUUID() {
|
|
135
|
-
let d = Date.now();
|
|
136
|
-
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
137
|
-
d += performance.now();
|
|
138
|
-
}
|
|
139
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
140
|
-
const r = (d + Math.random() * 16) % 16 | 0;
|
|
141
|
-
d = Math.floor(d / 16);
|
|
142
|
-
return (c === "x" ? r : r & 3 | 8).toString(16);
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
const getCharStringLength = (str) => {
|
|
146
|
-
let leng = 0;
|
|
147
|
-
for (let i = 0; i < str.length; i += 1) {
|
|
148
|
-
if (str.charCodeAt(i) > 127 || str.charCodeAt(i) == 94) {
|
|
149
|
-
leng += 2;
|
|
150
|
-
} else {
|
|
151
|
-
leng += 1;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return leng;
|
|
155
|
-
};
|
|
156
|
-
const deepClone = (source) => {
|
|
157
|
-
if (!source || typeof source !== "object") {
|
|
158
|
-
return source;
|
|
159
|
-
}
|
|
160
|
-
const targetObj = source.constructor === Array ? [] : {};
|
|
161
|
-
Object.keys(source).forEach((keys) => {
|
|
162
|
-
if (source[keys] && typeof source[keys] === "object") {
|
|
163
|
-
targetObj[keys] = source[keys].constructor === Array ? [] : {};
|
|
164
|
-
targetObj[keys] = deepClone(source[keys]);
|
|
165
|
-
} else {
|
|
166
|
-
targetObj[keys] = source[keys];
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
return targetObj;
|
|
170
|
-
};
|
|
171
|
-
function debounce(func, wait, immediate) {
|
|
172
|
-
let timeout, args, context, timestamp, result;
|
|
173
|
-
const later = function() {
|
|
174
|
-
const last = +/* @__PURE__ */ new Date() - timestamp;
|
|
175
|
-
if (last < wait && last > 0) {
|
|
176
|
-
timeout = setTimeout(later, wait - last);
|
|
177
|
-
} else {
|
|
178
|
-
timeout = null;
|
|
179
|
-
if (!immediate) {
|
|
180
|
-
result = func.apply(context, args);
|
|
181
|
-
if (!timeout)
|
|
182
|
-
context = args = null;
|
|
3
|
+
const tool = require("@94ai/common-utils/lib/tool");
|
|
4
|
+
function _interopNamespaceDefault(e) {
|
|
5
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
6
|
+
if (e) {
|
|
7
|
+
for (const k in e) {
|
|
8
|
+
if (k !== "default") {
|
|
9
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
10
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: () => e[k]
|
|
13
|
+
});
|
|
183
14
|
}
|
|
184
15
|
}
|
|
185
|
-
};
|
|
186
|
-
return function(...args2) {
|
|
187
|
-
context = this;
|
|
188
|
-
timestamp = +/* @__PURE__ */ new Date();
|
|
189
|
-
const callNow = immediate && !timeout;
|
|
190
|
-
if (!timeout)
|
|
191
|
-
timeout = setTimeout(later, wait);
|
|
192
|
-
if (callNow) {
|
|
193
|
-
result = func.apply(context, args2);
|
|
194
|
-
context = args2 = null;
|
|
195
|
-
}
|
|
196
|
-
return result;
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
function createUniqueString(randomLength = 36) {
|
|
200
|
-
return Number(Math.random().toString().substr(3, randomLength) + Date.now()).toString(36);
|
|
201
|
-
}
|
|
202
|
-
function getHalfYear(date = /* @__PURE__ */ new Date()) {
|
|
203
|
-
const currMonth = date.getMonth() + 1;
|
|
204
|
-
return Math.floor(currMonth % 6 == 0 ? currMonth / 6 : currMonth / 6 + 1);
|
|
205
|
-
}
|
|
206
|
-
function getQuarter(date = /* @__PURE__ */ new Date()) {
|
|
207
|
-
const currMonth = date.getMonth() + 1;
|
|
208
|
-
return Math.floor(currMonth % 3 == 0 ? currMonth / 3 : currMonth / 3 + 1);
|
|
209
|
-
}
|
|
210
|
-
function getNextYear(date = /* @__PURE__ */ new Date()) {
|
|
211
|
-
return new Date(date.setFullYear(date.getFullYear() + 1));
|
|
212
|
-
}
|
|
213
|
-
function endOf(now = /* @__PURE__ */ new Date(), unit) {
|
|
214
|
-
if (unit === "year") {
|
|
215
|
-
return new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
|
|
216
|
-
}
|
|
217
|
-
if (unit === "month") {
|
|
218
|
-
return new Date(new Date(now.getFullYear(), now.getMonth() + 1, 1).getTime() - 1);
|
|
219
|
-
}
|
|
220
|
-
if (unit === "week") {
|
|
221
|
-
return new Date(now.getFullYear(), now.getMonth(), now.getDate() + (6 - now.getDay()), 23, 59, 59, 999);
|
|
222
|
-
}
|
|
223
|
-
return new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
|
|
224
|
-
}
|
|
225
|
-
function startOf(date, unit) {
|
|
226
|
-
const newDate = new Date(date);
|
|
227
|
-
if (unit === "year") {
|
|
228
|
-
newDate.setMonth(0);
|
|
229
|
-
newDate.setDate(1);
|
|
230
|
-
newDate.setHours(0, 0, 0, 0);
|
|
231
|
-
} else if (unit === "month") {
|
|
232
|
-
newDate.setDate(1);
|
|
233
|
-
newDate.setHours(0, 0, 0, 0);
|
|
234
|
-
} else if (unit === "") {
|
|
235
|
-
newDate.setHours(0, 0, 0, 0);
|
|
236
|
-
} else if (unit === "hour") {
|
|
237
|
-
newDate.setMinutes(0, 0, 0);
|
|
238
|
-
} else if (unit === "minute") {
|
|
239
|
-
newDate.setSeconds(0, 0);
|
|
240
|
-
} else if (unit === "second") {
|
|
241
|
-
newDate.setMilliseconds(0);
|
|
242
|
-
}
|
|
243
|
-
return newDate;
|
|
244
|
-
}
|
|
245
|
-
function formatDate(date, format) {
|
|
246
|
-
const year = date.getFullYear();
|
|
247
|
-
const month = date.getMonth() + 1;
|
|
248
|
-
const day = date.getDate();
|
|
249
|
-
const hours = date.getHours();
|
|
250
|
-
const minutes = date.getMinutes();
|
|
251
|
-
const seconds = date.getSeconds();
|
|
252
|
-
format = format.replace("YYYY", year);
|
|
253
|
-
format = format.replace("MM", String(month).padStart(2, "0"));
|
|
254
|
-
format = format.replace("DD", String(day).padStart(2, "0"));
|
|
255
|
-
format = format.replace("HH", String(hours).padStart(2, "0"));
|
|
256
|
-
format = format.replace("mm", String(minutes).padStart(2, "0"));
|
|
257
|
-
format = format.replace("ss", String(seconds).padStart(2, "0"));
|
|
258
|
-
return format;
|
|
259
|
-
}
|
|
260
|
-
function HexToRgb(str) {
|
|
261
|
-
const r = /^#?[0-9A-Fa-f]{6}$/;
|
|
262
|
-
if (!r.test(str))
|
|
263
|
-
return;
|
|
264
|
-
str = str.replace("#", "");
|
|
265
|
-
const hxs = str.match(/../g);
|
|
266
|
-
for (let i = 0; i < 3; i++) {
|
|
267
|
-
hxs[i] = parseInt(hxs[i], 16);
|
|
268
|
-
}
|
|
269
|
-
return hxs;
|
|
270
|
-
}
|
|
271
|
-
function RgbToHex(a, b, c) {
|
|
272
|
-
const r = /^\d{1,3}$/;
|
|
273
|
-
if (!r.test(String(a)) || !r.test(String(b)) || !r.test(String(c)))
|
|
274
|
-
return;
|
|
275
|
-
const hexs = [a.toString(16), b.toString(16), c.toString(16)];
|
|
276
|
-
for (let i = 0; i < 3; i++)
|
|
277
|
-
if (hexs[i].length === 1)
|
|
278
|
-
hexs[i] = "0" + hexs[i];
|
|
279
|
-
return "#" + hexs.join("");
|
|
280
|
-
}
|
|
281
|
-
function getDarkColor(color, level) {
|
|
282
|
-
const r = /^#?[0-9A-Fa-f]{6}$/;
|
|
283
|
-
if (!r.test(color))
|
|
284
|
-
return color;
|
|
285
|
-
const rgbc = HexToRgb(color);
|
|
286
|
-
for (let i = 0; i < 3; i++) {
|
|
287
|
-
rgbc[i] = Math.floor(rgbc[i] * (1 - level));
|
|
288
|
-
}
|
|
289
|
-
return RgbToHex(rgbc[0], rgbc[1], rgbc[2]);
|
|
290
|
-
}
|
|
291
|
-
function getLightColor(color, level) {
|
|
292
|
-
const r = /^#?[0-9A-Fa-f]{6}$/;
|
|
293
|
-
if (!r.test(color))
|
|
294
|
-
return color;
|
|
295
|
-
const rgbc = HexToRgb(color);
|
|
296
|
-
for (let i = 0; i < 3; i++) {
|
|
297
|
-
rgbc[i] = Math.floor((255 - rgbc[i]) * level + rgbc[i]);
|
|
298
|
-
}
|
|
299
|
-
return RgbToHex(rgbc[0], rgbc[1], rgbc[2]);
|
|
300
|
-
}
|
|
301
|
-
const toLine = (value) => {
|
|
302
|
-
return value.replace(/(A-Z)g/, "-$1").toLocaleLowerCase();
|
|
303
|
-
};
|
|
304
|
-
function upperCamelCase(word) {
|
|
305
|
-
const cleanedString = word.replace(/\W/g, "");
|
|
306
|
-
const words = cleanedString.toLowerCase().split(/\B(?=[A-Z])/);
|
|
307
|
-
const upperCamelCase2 = words.map((word2) => word2.charAt(0).toUpperCase() + word2.slice(1)).join("");
|
|
308
|
-
return upperCamelCase2;
|
|
309
|
-
}
|
|
310
|
-
function isAutoFlexBasis(el) {
|
|
311
|
-
const flexBasis = _getComputedStyle(el, "flexBasis");
|
|
312
|
-
return flexBasis === "auto";
|
|
313
|
-
}
|
|
314
|
-
function _getComputedStyle(el, k) {
|
|
315
|
-
const computedStyle = getComputedStyle(el);
|
|
316
|
-
for (let i = 0; i <= presudos.length; i++) {
|
|
317
|
-
const key = presudos[i] ? `${presudos[i]}${upperCamelCase(k)}` : k;
|
|
318
|
-
if (computedStyle[key]) {
|
|
319
|
-
return computedStyle[key];
|
|
320
|
-
}
|
|
321
16
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
function getFlexDirection(el) {
|
|
325
|
-
const flexDirection = _getComputedStyle(el, "flexDirection");
|
|
326
|
-
const [direction, reverse] = flexDirection.split("-");
|
|
327
|
-
return {
|
|
328
|
-
vertical: direction === "column",
|
|
329
|
-
reverse: !!reverse
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
function getBlobURL(jsCode) {
|
|
333
|
-
const blob = new Blob([jsCode], { type: "text/javascript" });
|
|
334
|
-
const blobURL = URL.createObjectURL(blob);
|
|
335
|
-
return blobURL;
|
|
336
|
-
}
|
|
337
|
-
function toBase64(str) {
|
|
338
|
-
return btoa(unescape(encodeURIComponent(str)));
|
|
339
|
-
}
|
|
340
|
-
function generateID() {
|
|
341
|
-
return Math.random().toString(36).slice(2, 12) + Date.now();
|
|
342
|
-
}
|
|
343
|
-
const copyFile = (sourcePath, targetPath) => {
|
|
344
|
-
const isExist = (path2) => {
|
|
345
|
-
if (!fs.existsSync(path2)) {
|
|
346
|
-
fs.mkdirSync(path2);
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
isExist(targetPath);
|
|
350
|
-
const sourceFile = fs.readdirSync(sourcePath, { withFileTypes: true });
|
|
351
|
-
sourceFile.forEach((file) => {
|
|
352
|
-
const newSourcePath = path.resolve(sourcePath, file.name);
|
|
353
|
-
const newTargetPath = path.resolve(targetPath, file.name);
|
|
354
|
-
if (file.isDirectory()) {
|
|
355
|
-
isExist(newTargetPath);
|
|
356
|
-
copyFile(newSourcePath, newTargetPath);
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
fs.copyFileSync(newSourcePath, newTargetPath);
|
|
360
|
-
});
|
|
361
|
-
};
|
|
362
|
-
const add = (arg1, arg2) => {
|
|
363
|
-
let r1, r2, m;
|
|
364
|
-
try {
|
|
365
|
-
r1 = (arg1.toString().split(".")[1] || "").length;
|
|
366
|
-
} catch (e) {
|
|
367
|
-
r1 = 0;
|
|
368
|
-
}
|
|
369
|
-
try {
|
|
370
|
-
r2 = (arg2.toString().split(".")[1] || "").length;
|
|
371
|
-
} catch (e) {
|
|
372
|
-
r2 = 0;
|
|
373
|
-
}
|
|
374
|
-
m = Math.pow(10, Math.max(r1, r2));
|
|
375
|
-
return div(mul(arg1, m) + mul(arg2, m), m);
|
|
376
|
-
};
|
|
377
|
-
const mul = (arg1, arg2) => {
|
|
378
|
-
let m = 0;
|
|
379
|
-
const s1 = arg1.toString();
|
|
380
|
-
const s2 = arg2.toString();
|
|
381
|
-
m += (s1.split(".")[1] || "").length;
|
|
382
|
-
m += (s2.split(".")[1] || "").length;
|
|
383
|
-
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
|
|
384
|
-
};
|
|
385
|
-
const div = (arg1, arg2) => {
|
|
386
|
-
const t1 = (arg1.toString().split(".")[1] || "").length;
|
|
387
|
-
const t2 = (arg2.toString().split(".")[1] || "").length;
|
|
388
|
-
const r1 = Number(arg1.toString().replace(".", ""));
|
|
389
|
-
const r2 = Number(arg2.toString().replace(".", ""));
|
|
390
|
-
return r1 / r2 * Math.pow(10, t2 - t1);
|
|
391
|
-
};
|
|
392
|
-
function getLocalTime(i) {
|
|
393
|
-
let time = i;
|
|
394
|
-
if (typeof time === "string") {
|
|
395
|
-
const arr = time.split(":");
|
|
396
|
-
if (arr.length < 2) {
|
|
397
|
-
return /* @__PURE__ */ new Date();
|
|
398
|
-
}
|
|
399
|
-
time = add(Number(arr[0]), div(Math.floor(Number(arr[1])), 60));
|
|
400
|
-
}
|
|
401
|
-
if (typeof time !== "number") {
|
|
402
|
-
return /* @__PURE__ */ new Date();
|
|
403
|
-
}
|
|
404
|
-
const d = /* @__PURE__ */ new Date();
|
|
405
|
-
const len = d.getTime();
|
|
406
|
-
const offset = d.getTimezoneOffset() * 6e4;
|
|
407
|
-
const utcTime = len + offset;
|
|
408
|
-
return new Date(utcTime + 36e5 * time);
|
|
409
|
-
}
|
|
410
|
-
function toPascalCase(str) {
|
|
411
|
-
const camelCase = str.replace(/-([a-z])/g, function(_match, letter) {
|
|
412
|
-
return letter.toUpperCase();
|
|
413
|
-
});
|
|
414
|
-
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
17
|
+
n.default = e;
|
|
18
|
+
return Object.freeze(n);
|
|
415
19
|
}
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
debounce,
|
|
426
|
-
deepClone,
|
|
427
|
-
endOf,
|
|
428
|
-
formatDate,
|
|
429
|
-
generateID,
|
|
430
|
-
generateUUID,
|
|
431
|
-
getBlobURL,
|
|
432
|
-
getCharStringLength,
|
|
433
|
-
getDarkColor,
|
|
434
|
-
getDirs,
|
|
435
|
-
getFlexDirection,
|
|
436
|
-
getHalfYear,
|
|
437
|
-
getJsComponentSampleConfig,
|
|
438
|
-
getLightColor,
|
|
439
|
-
getLocalTime,
|
|
440
|
-
getNextYear,
|
|
441
|
-
getQuarter,
|
|
442
|
-
getResolver,
|
|
443
|
-
getTranspileDependencies,
|
|
444
|
-
getTsComponentSampleConfig,
|
|
445
|
-
isAsyncFunc,
|
|
446
|
-
isAutoFlexBasis,
|
|
447
|
-
kebabCase,
|
|
448
|
-
resolveDebuger,
|
|
449
|
-
startOf,
|
|
450
|
-
toBase64,
|
|
451
|
-
toLine,
|
|
452
|
-
toPascalCase,
|
|
453
|
-
upperCamelCase
|
|
454
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
455
|
-
exports.ComponentConstantList = ComponentConstantList;
|
|
456
|
-
exports.HexToRgb = HexToRgb;
|
|
457
|
-
exports.RgbToHex = RgbToHex;
|
|
458
|
-
exports._getComputedStyle = _getComputedStyle;
|
|
459
|
-
exports.closest = closest;
|
|
460
|
-
exports.copyFile = copyFile;
|
|
461
|
-
exports.createUniqueString = createUniqueString;
|
|
462
|
-
exports.debounce = debounce;
|
|
463
|
-
exports.deepClone = deepClone;
|
|
464
|
-
exports.default = tool;
|
|
465
|
-
exports.endOf = endOf;
|
|
466
|
-
exports.formatDate = formatDate;
|
|
467
|
-
exports.generateID = generateID;
|
|
468
|
-
exports.generateUUID = generateUUID;
|
|
469
|
-
exports.getBlobURL = getBlobURL;
|
|
470
|
-
exports.getCharStringLength = getCharStringLength;
|
|
471
|
-
exports.getDarkColor = getDarkColor;
|
|
472
|
-
exports.getDirs = getDirs;
|
|
473
|
-
exports.getFlexDirection = getFlexDirection;
|
|
474
|
-
exports.getHalfYear = getHalfYear;
|
|
475
|
-
exports.getJsComponentSampleConfig = getJsComponentSampleConfig;
|
|
476
|
-
exports.getLightColor = getLightColor;
|
|
477
|
-
exports.getLocalTime = getLocalTime;
|
|
478
|
-
exports.getNextYear = getNextYear;
|
|
479
|
-
exports.getQuarter = getQuarter;
|
|
480
|
-
exports.getResolver = getResolver;
|
|
481
|
-
exports.getTranspileDependencies = getTranspileDependencies;
|
|
482
|
-
exports.getTsComponentSampleConfig = getTsComponentSampleConfig;
|
|
483
|
-
exports.isAsyncFunc = isAsyncFunc;
|
|
484
|
-
exports.isAutoFlexBasis = isAutoFlexBasis;
|
|
485
|
-
exports.kebabCase = kebabCase;
|
|
486
|
-
exports.resolveDebuger = resolveDebuger;
|
|
487
|
-
exports.startOf = startOf;
|
|
488
|
-
exports.toBase64 = toBase64;
|
|
489
|
-
exports.toLine = toLine;
|
|
490
|
-
exports.toPascalCase = toPascalCase;
|
|
491
|
-
exports.upperCamelCase = upperCamelCase;
|
|
20
|
+
const tool__namespace = /* @__PURE__ */ _interopNamespaceDefault(tool);
|
|
21
|
+
exports.default = tool__namespace;
|
|
22
|
+
Object.keys(tool).forEach((k) => {
|
|
23
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
|
|
24
|
+
Object.defineProperty(exports, k, {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: () => tool[k]
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -1,491 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import "vue-demi";
|
|
4
|
-
const ComponentConstantList = [
|
|
5
|
-
"NfMenu",
|
|
6
|
-
"NfInfiniteMenu",
|
|
7
|
-
"NfDoubleTime",
|
|
8
|
-
"NfEmpty",
|
|
9
|
-
"NfImportTemplate",
|
|
10
|
-
"NfTransferSelect",
|
|
11
|
-
"NfRadioGroup",
|
|
12
|
-
"NfAlert",
|
|
13
|
-
"NfVirtualSelect",
|
|
14
|
-
"NfTag",
|
|
15
|
-
"NfAction",
|
|
16
|
-
"NfIndicatorPlane",
|
|
17
|
-
"NfQuarterPicker",
|
|
18
|
-
"NfDoubleQuarter",
|
|
19
|
-
"NfDoubleHalfYear",
|
|
20
|
-
"NfHalfYearPicker",
|
|
21
|
-
"NfDoubleWeek",
|
|
22
|
-
"NfDoubleYear",
|
|
23
|
-
"NfDatePicker",
|
|
24
|
-
"NfFormItem",
|
|
25
|
-
"NfForm",
|
|
26
|
-
"NfTable",
|
|
27
|
-
"NfSearchForm",
|
|
28
|
-
"NfDrawer",
|
|
29
|
-
"NfMessage",
|
|
30
|
-
"NfNotification",
|
|
31
|
-
"NfConfirm",
|
|
32
|
-
"NfTextOverflow",
|
|
33
|
-
"NfResizablePanels",
|
|
34
|
-
"NfAddress",
|
|
35
|
-
"NfAudio",
|
|
36
|
-
"NfButton",
|
|
37
|
-
"NfRules",
|
|
38
|
-
"NfConditions",
|
|
39
|
-
"NfKeywords",
|
|
40
|
-
"NfVariableSelect",
|
|
41
|
-
"NfMicrophone",
|
|
42
|
-
"NfSvgIcon",
|
|
43
|
-
"NfLazySelect",
|
|
44
|
-
"NfPopupLazySelect",
|
|
45
|
-
"NfAddressSelect",
|
|
46
|
-
"NfSoftphone"
|
|
47
|
-
];
|
|
48
|
-
const presudos = ["", "webkit", "moz"];
|
|
49
|
-
function resolveDebuger(name) {
|
|
50
|
-
fs.appendFile(path.resolve(__dirname, "./log.txt"), `${name}
|
|
51
|
-
`, () => {
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function kebabCase(key) {
|
|
55
|
-
const result = key.replace(/([A-Z])/g, " $1").trim();
|
|
56
|
-
return result.split(" ").join("-").toLowerCase();
|
|
57
|
-
}
|
|
58
|
-
function isAsyncFunc(func) {
|
|
59
|
-
return func[Symbol(Symbol.toStringTag)] === "AsyncFunction";
|
|
60
|
-
}
|
|
61
|
-
function closest(that, componentName) {
|
|
62
|
-
let vm = that;
|
|
63
|
-
let result;
|
|
64
|
-
while (vm && !result) {
|
|
65
|
-
const name = vm.$options.name;
|
|
66
|
-
if (name === componentName) {
|
|
67
|
-
result = vm;
|
|
68
|
-
}
|
|
69
|
-
vm = vm.$parent;
|
|
70
|
-
}
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
function getDirs() {
|
|
74
|
-
return ComponentConstantList.map((item) => "node_modules/@94ai/" + kebabCase(item) + "/lib");
|
|
75
|
-
}
|
|
76
|
-
function getTranspileDependencies() {
|
|
77
|
-
return ComponentConstantList.map((item) => "@94ai/" + kebabCase(item));
|
|
78
|
-
}
|
|
79
|
-
const getResolver = () => {
|
|
80
|
-
return {
|
|
81
|
-
type: "component",
|
|
82
|
-
resolve: (name) => {
|
|
83
|
-
resolveDebuger(name);
|
|
84
|
-
if (/^Nf[A-Za-z](?!.*[Mm][Dd]$).*$/.test(name)) {
|
|
85
|
-
const kebabCasePackageName = kebabCase(name);
|
|
86
|
-
return {
|
|
87
|
-
from: `@94ai/${kebabCasePackageName}/lib/${kebabCasePackageName}.esm-bundler.js`,
|
|
88
|
-
sideEffects: []
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
const getJsComponentSampleConfig = (config = {}) => {
|
|
95
|
-
return {
|
|
96
|
-
exclude: [/[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
|
|
97
|
-
include: [
|
|
98
|
-
/\.vue$/,
|
|
99
|
-
/\.vue\?vue/,
|
|
100
|
-
/\.vue\?v=/,
|
|
101
|
-
/\.js$/,
|
|
102
|
-
/\.js\?vue/,
|
|
103
|
-
/\.js\?v=/
|
|
104
|
-
],
|
|
105
|
-
deep: true,
|
|
106
|
-
transformer: "vue2",
|
|
107
|
-
resolvers: [],
|
|
108
|
-
...config
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
const getTsComponentSampleConfig = (config = {}) => {
|
|
112
|
-
return {
|
|
113
|
-
include: [
|
|
114
|
-
/\.vue$/,
|
|
115
|
-
/\.vue\?vue/,
|
|
116
|
-
/\.md$/,
|
|
117
|
-
/\.md\?vue/,
|
|
118
|
-
/\.jsx$/,
|
|
119
|
-
/\.jsx\?vue/,
|
|
120
|
-
/\.tsx$/,
|
|
121
|
-
/\.tsx\?vue/,
|
|
122
|
-
/\.js$/,
|
|
123
|
-
/\.js\?vue/
|
|
124
|
-
],
|
|
125
|
-
deep: true,
|
|
126
|
-
extensions: ["vue", "md", "jsx", "tsx", "mjs", "mts", "js"],
|
|
127
|
-
dirs: ["src/components", "src/views", "doc"],
|
|
128
|
-
resolvers: [],
|
|
129
|
-
...config
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
function generateUUID() {
|
|
133
|
-
let d = Date.now();
|
|
134
|
-
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
135
|
-
d += performance.now();
|
|
136
|
-
}
|
|
137
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
138
|
-
const r = (d + Math.random() * 16) % 16 | 0;
|
|
139
|
-
d = Math.floor(d / 16);
|
|
140
|
-
return (c === "x" ? r : r & 3 | 8).toString(16);
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
const getCharStringLength = (str) => {
|
|
144
|
-
let leng = 0;
|
|
145
|
-
for (let i = 0; i < str.length; i += 1) {
|
|
146
|
-
if (str.charCodeAt(i) > 127 || str.charCodeAt(i) == 94) {
|
|
147
|
-
leng += 2;
|
|
148
|
-
} else {
|
|
149
|
-
leng += 1;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return leng;
|
|
153
|
-
};
|
|
154
|
-
const deepClone = (source) => {
|
|
155
|
-
if (!source || typeof source !== "object") {
|
|
156
|
-
return source;
|
|
157
|
-
}
|
|
158
|
-
const targetObj = source.constructor === Array ? [] : {};
|
|
159
|
-
Object.keys(source).forEach((keys) => {
|
|
160
|
-
if (source[keys] && typeof source[keys] === "object") {
|
|
161
|
-
targetObj[keys] = source[keys].constructor === Array ? [] : {};
|
|
162
|
-
targetObj[keys] = deepClone(source[keys]);
|
|
163
|
-
} else {
|
|
164
|
-
targetObj[keys] = source[keys];
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
return targetObj;
|
|
168
|
-
};
|
|
169
|
-
function debounce(func, wait, immediate) {
|
|
170
|
-
let timeout, args, context, timestamp, result;
|
|
171
|
-
const later = function() {
|
|
172
|
-
const last = +/* @__PURE__ */ new Date() - timestamp;
|
|
173
|
-
if (last < wait && last > 0) {
|
|
174
|
-
timeout = setTimeout(later, wait - last);
|
|
175
|
-
} else {
|
|
176
|
-
timeout = null;
|
|
177
|
-
if (!immediate) {
|
|
178
|
-
result = func.apply(context, args);
|
|
179
|
-
if (!timeout)
|
|
180
|
-
context = args = null;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
return function(...args2) {
|
|
185
|
-
context = this;
|
|
186
|
-
timestamp = +/* @__PURE__ */ new Date();
|
|
187
|
-
const callNow = immediate && !timeout;
|
|
188
|
-
if (!timeout)
|
|
189
|
-
timeout = setTimeout(later, wait);
|
|
190
|
-
if (callNow) {
|
|
191
|
-
result = func.apply(context, args2);
|
|
192
|
-
context = args2 = null;
|
|
193
|
-
}
|
|
194
|
-
return result;
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
function createUniqueString(randomLength = 36) {
|
|
198
|
-
return Number(Math.random().toString().substr(3, randomLength) + Date.now()).toString(36);
|
|
199
|
-
}
|
|
200
|
-
function getHalfYear(date = /* @__PURE__ */ new Date()) {
|
|
201
|
-
const currMonth = date.getMonth() + 1;
|
|
202
|
-
return Math.floor(currMonth % 6 == 0 ? currMonth / 6 : currMonth / 6 + 1);
|
|
203
|
-
}
|
|
204
|
-
function getQuarter(date = /* @__PURE__ */ new Date()) {
|
|
205
|
-
const currMonth = date.getMonth() + 1;
|
|
206
|
-
return Math.floor(currMonth % 3 == 0 ? currMonth / 3 : currMonth / 3 + 1);
|
|
207
|
-
}
|
|
208
|
-
function getNextYear(date = /* @__PURE__ */ new Date()) {
|
|
209
|
-
return new Date(date.setFullYear(date.getFullYear() + 1));
|
|
210
|
-
}
|
|
211
|
-
function endOf(now = /* @__PURE__ */ new Date(), unit) {
|
|
212
|
-
if (unit === "year") {
|
|
213
|
-
return new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
|
|
214
|
-
}
|
|
215
|
-
if (unit === "month") {
|
|
216
|
-
return new Date(new Date(now.getFullYear(), now.getMonth() + 1, 1).getTime() - 1);
|
|
217
|
-
}
|
|
218
|
-
if (unit === "week") {
|
|
219
|
-
return new Date(now.getFullYear(), now.getMonth(), now.getDate() + (6 - now.getDay()), 23, 59, 59, 999);
|
|
220
|
-
}
|
|
221
|
-
return new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
|
|
222
|
-
}
|
|
223
|
-
function startOf(date, unit) {
|
|
224
|
-
const newDate = new Date(date);
|
|
225
|
-
if (unit === "year") {
|
|
226
|
-
newDate.setMonth(0);
|
|
227
|
-
newDate.setDate(1);
|
|
228
|
-
newDate.setHours(0, 0, 0, 0);
|
|
229
|
-
} else if (unit === "month") {
|
|
230
|
-
newDate.setDate(1);
|
|
231
|
-
newDate.setHours(0, 0, 0, 0);
|
|
232
|
-
} else if (unit === "") {
|
|
233
|
-
newDate.setHours(0, 0, 0, 0);
|
|
234
|
-
} else if (unit === "hour") {
|
|
235
|
-
newDate.setMinutes(0, 0, 0);
|
|
236
|
-
} else if (unit === "minute") {
|
|
237
|
-
newDate.setSeconds(0, 0);
|
|
238
|
-
} else if (unit === "second") {
|
|
239
|
-
newDate.setMilliseconds(0);
|
|
240
|
-
}
|
|
241
|
-
return newDate;
|
|
242
|
-
}
|
|
243
|
-
function formatDate(date, format) {
|
|
244
|
-
const year = date.getFullYear();
|
|
245
|
-
const month = date.getMonth() + 1;
|
|
246
|
-
const day = date.getDate();
|
|
247
|
-
const hours = date.getHours();
|
|
248
|
-
const minutes = date.getMinutes();
|
|
249
|
-
const seconds = date.getSeconds();
|
|
250
|
-
format = format.replace("YYYY", year);
|
|
251
|
-
format = format.replace("MM", String(month).padStart(2, "0"));
|
|
252
|
-
format = format.replace("DD", String(day).padStart(2, "0"));
|
|
253
|
-
format = format.replace("HH", String(hours).padStart(2, "0"));
|
|
254
|
-
format = format.replace("mm", String(minutes).padStart(2, "0"));
|
|
255
|
-
format = format.replace("ss", String(seconds).padStart(2, "0"));
|
|
256
|
-
return format;
|
|
257
|
-
}
|
|
258
|
-
function HexToRgb(str) {
|
|
259
|
-
const r = /^#?[0-9A-Fa-f]{6}$/;
|
|
260
|
-
if (!r.test(str))
|
|
261
|
-
return;
|
|
262
|
-
str = str.replace("#", "");
|
|
263
|
-
const hxs = str.match(/../g);
|
|
264
|
-
for (let i = 0; i < 3; i++) {
|
|
265
|
-
hxs[i] = parseInt(hxs[i], 16);
|
|
266
|
-
}
|
|
267
|
-
return hxs;
|
|
268
|
-
}
|
|
269
|
-
function RgbToHex(a, b, c) {
|
|
270
|
-
const r = /^\d{1,3}$/;
|
|
271
|
-
if (!r.test(String(a)) || !r.test(String(b)) || !r.test(String(c)))
|
|
272
|
-
return;
|
|
273
|
-
const hexs = [a.toString(16), b.toString(16), c.toString(16)];
|
|
274
|
-
for (let i = 0; i < 3; i++)
|
|
275
|
-
if (hexs[i].length === 1)
|
|
276
|
-
hexs[i] = "0" + hexs[i];
|
|
277
|
-
return "#" + hexs.join("");
|
|
278
|
-
}
|
|
279
|
-
function getDarkColor(color, level) {
|
|
280
|
-
const r = /^#?[0-9A-Fa-f]{6}$/;
|
|
281
|
-
if (!r.test(color))
|
|
282
|
-
return color;
|
|
283
|
-
const rgbc = HexToRgb(color);
|
|
284
|
-
for (let i = 0; i < 3; i++) {
|
|
285
|
-
rgbc[i] = Math.floor(rgbc[i] * (1 - level));
|
|
286
|
-
}
|
|
287
|
-
return RgbToHex(rgbc[0], rgbc[1], rgbc[2]);
|
|
288
|
-
}
|
|
289
|
-
function getLightColor(color, level) {
|
|
290
|
-
const r = /^#?[0-9A-Fa-f]{6}$/;
|
|
291
|
-
if (!r.test(color))
|
|
292
|
-
return color;
|
|
293
|
-
const rgbc = HexToRgb(color);
|
|
294
|
-
for (let i = 0; i < 3; i++) {
|
|
295
|
-
rgbc[i] = Math.floor((255 - rgbc[i]) * level + rgbc[i]);
|
|
296
|
-
}
|
|
297
|
-
return RgbToHex(rgbc[0], rgbc[1], rgbc[2]);
|
|
298
|
-
}
|
|
299
|
-
const toLine = (value) => {
|
|
300
|
-
return value.replace(/(A-Z)g/, "-$1").toLocaleLowerCase();
|
|
301
|
-
};
|
|
302
|
-
function upperCamelCase(word) {
|
|
303
|
-
const cleanedString = word.replace(/\W/g, "");
|
|
304
|
-
const words = cleanedString.toLowerCase().split(/\B(?=[A-Z])/);
|
|
305
|
-
const upperCamelCase2 = words.map((word2) => word2.charAt(0).toUpperCase() + word2.slice(1)).join("");
|
|
306
|
-
return upperCamelCase2;
|
|
307
|
-
}
|
|
308
|
-
function isAutoFlexBasis(el) {
|
|
309
|
-
const flexBasis = _getComputedStyle(el, "flexBasis");
|
|
310
|
-
return flexBasis === "auto";
|
|
311
|
-
}
|
|
312
|
-
function _getComputedStyle(el, k) {
|
|
313
|
-
const computedStyle = getComputedStyle(el);
|
|
314
|
-
for (let i = 0; i <= presudos.length; i++) {
|
|
315
|
-
const key = presudos[i] ? `${presudos[i]}${upperCamelCase(k)}` : k;
|
|
316
|
-
if (computedStyle[key]) {
|
|
317
|
-
return computedStyle[key];
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
return void 0;
|
|
321
|
-
}
|
|
322
|
-
function getFlexDirection(el) {
|
|
323
|
-
const flexDirection = _getComputedStyle(el, "flexDirection");
|
|
324
|
-
const [direction, reverse] = flexDirection.split("-");
|
|
325
|
-
return {
|
|
326
|
-
vertical: direction === "column",
|
|
327
|
-
reverse: !!reverse
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
function getBlobURL(jsCode) {
|
|
331
|
-
const blob = new Blob([jsCode], { type: "text/javascript" });
|
|
332
|
-
const blobURL = URL.createObjectURL(blob);
|
|
333
|
-
return blobURL;
|
|
334
|
-
}
|
|
335
|
-
function toBase64(str) {
|
|
336
|
-
return btoa(unescape(encodeURIComponent(str)));
|
|
337
|
-
}
|
|
338
|
-
function generateID() {
|
|
339
|
-
return Math.random().toString(36).slice(2, 12) + Date.now();
|
|
340
|
-
}
|
|
341
|
-
const copyFile = (sourcePath, targetPath) => {
|
|
342
|
-
const isExist = (path2) => {
|
|
343
|
-
if (!fs.existsSync(path2)) {
|
|
344
|
-
fs.mkdirSync(path2);
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
isExist(targetPath);
|
|
348
|
-
const sourceFile = fs.readdirSync(sourcePath, { withFileTypes: true });
|
|
349
|
-
sourceFile.forEach((file) => {
|
|
350
|
-
const newSourcePath = path.resolve(sourcePath, file.name);
|
|
351
|
-
const newTargetPath = path.resolve(targetPath, file.name);
|
|
352
|
-
if (file.isDirectory()) {
|
|
353
|
-
isExist(newTargetPath);
|
|
354
|
-
copyFile(newSourcePath, newTargetPath);
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
fs.copyFileSync(newSourcePath, newTargetPath);
|
|
358
|
-
});
|
|
359
|
-
};
|
|
360
|
-
const add = (arg1, arg2) => {
|
|
361
|
-
let r1, r2, m;
|
|
362
|
-
try {
|
|
363
|
-
r1 = (arg1.toString().split(".")[1] || "").length;
|
|
364
|
-
} catch (e) {
|
|
365
|
-
r1 = 0;
|
|
366
|
-
}
|
|
367
|
-
try {
|
|
368
|
-
r2 = (arg2.toString().split(".")[1] || "").length;
|
|
369
|
-
} catch (e) {
|
|
370
|
-
r2 = 0;
|
|
371
|
-
}
|
|
372
|
-
m = Math.pow(10, Math.max(r1, r2));
|
|
373
|
-
return div(mul(arg1, m) + mul(arg2, m), m);
|
|
374
|
-
};
|
|
375
|
-
const mul = (arg1, arg2) => {
|
|
376
|
-
let m = 0;
|
|
377
|
-
const s1 = arg1.toString();
|
|
378
|
-
const s2 = arg2.toString();
|
|
379
|
-
m += (s1.split(".")[1] || "").length;
|
|
380
|
-
m += (s2.split(".")[1] || "").length;
|
|
381
|
-
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
|
|
382
|
-
};
|
|
383
|
-
const div = (arg1, arg2) => {
|
|
384
|
-
const t1 = (arg1.toString().split(".")[1] || "").length;
|
|
385
|
-
const t2 = (arg2.toString().split(".")[1] || "").length;
|
|
386
|
-
const r1 = Number(arg1.toString().replace(".", ""));
|
|
387
|
-
const r2 = Number(arg2.toString().replace(".", ""));
|
|
388
|
-
return r1 / r2 * Math.pow(10, t2 - t1);
|
|
389
|
-
};
|
|
390
|
-
function getLocalTime(i) {
|
|
391
|
-
let time = i;
|
|
392
|
-
if (typeof time === "string") {
|
|
393
|
-
const arr = time.split(":");
|
|
394
|
-
if (arr.length < 2) {
|
|
395
|
-
return /* @__PURE__ */ new Date();
|
|
396
|
-
}
|
|
397
|
-
time = add(Number(arr[0]), div(Math.floor(Number(arr[1])), 60));
|
|
398
|
-
}
|
|
399
|
-
if (typeof time !== "number") {
|
|
400
|
-
return /* @__PURE__ */ new Date();
|
|
401
|
-
}
|
|
402
|
-
const d = /* @__PURE__ */ new Date();
|
|
403
|
-
const len = d.getTime();
|
|
404
|
-
const offset = d.getTimezoneOffset() * 6e4;
|
|
405
|
-
const utcTime = len + offset;
|
|
406
|
-
return new Date(utcTime + 36e5 * time);
|
|
407
|
-
}
|
|
408
|
-
function toPascalCase(str) {
|
|
409
|
-
const camelCase = str.replace(/-([a-z])/g, function(_match, letter) {
|
|
410
|
-
return letter.toUpperCase();
|
|
411
|
-
});
|
|
412
|
-
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
413
|
-
}
|
|
414
|
-
const tool = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
415
|
-
__proto__: null,
|
|
416
|
-
ComponentConstantList,
|
|
417
|
-
HexToRgb,
|
|
418
|
-
RgbToHex,
|
|
419
|
-
_getComputedStyle,
|
|
420
|
-
closest,
|
|
421
|
-
copyFile,
|
|
422
|
-
createUniqueString,
|
|
423
|
-
debounce,
|
|
424
|
-
deepClone,
|
|
425
|
-
endOf,
|
|
426
|
-
formatDate,
|
|
427
|
-
generateID,
|
|
428
|
-
generateUUID,
|
|
429
|
-
getBlobURL,
|
|
430
|
-
getCharStringLength,
|
|
431
|
-
getDarkColor,
|
|
432
|
-
getDirs,
|
|
433
|
-
getFlexDirection,
|
|
434
|
-
getHalfYear,
|
|
435
|
-
getJsComponentSampleConfig,
|
|
436
|
-
getLightColor,
|
|
437
|
-
getLocalTime,
|
|
438
|
-
getNextYear,
|
|
439
|
-
getQuarter,
|
|
440
|
-
getResolver,
|
|
441
|
-
getTranspileDependencies,
|
|
442
|
-
getTsComponentSampleConfig,
|
|
443
|
-
isAsyncFunc,
|
|
444
|
-
isAutoFlexBasis,
|
|
445
|
-
kebabCase,
|
|
446
|
-
resolveDebuger,
|
|
447
|
-
startOf,
|
|
448
|
-
toBase64,
|
|
449
|
-
toLine,
|
|
450
|
-
toPascalCase,
|
|
451
|
-
upperCamelCase
|
|
452
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
1
|
+
export * from "@94ai/common-utils/lib/tool";
|
|
2
|
+
import * as tool from "@94ai/common-utils/lib/tool";
|
|
453
3
|
export {
|
|
454
|
-
|
|
455
|
-
HexToRgb,
|
|
456
|
-
RgbToHex,
|
|
457
|
-
_getComputedStyle,
|
|
458
|
-
closest,
|
|
459
|
-
copyFile,
|
|
460
|
-
createUniqueString,
|
|
461
|
-
debounce,
|
|
462
|
-
deepClone,
|
|
463
|
-
tool as default,
|
|
464
|
-
endOf,
|
|
465
|
-
formatDate,
|
|
466
|
-
generateID,
|
|
467
|
-
generateUUID,
|
|
468
|
-
getBlobURL,
|
|
469
|
-
getCharStringLength,
|
|
470
|
-
getDarkColor,
|
|
471
|
-
getDirs,
|
|
472
|
-
getFlexDirection,
|
|
473
|
-
getHalfYear,
|
|
474
|
-
getJsComponentSampleConfig,
|
|
475
|
-
getLightColor,
|
|
476
|
-
getLocalTime,
|
|
477
|
-
getNextYear,
|
|
478
|
-
getQuarter,
|
|
479
|
-
getResolver,
|
|
480
|
-
getTranspileDependencies,
|
|
481
|
-
getTsComponentSampleConfig,
|
|
482
|
-
isAsyncFunc,
|
|
483
|
-
isAutoFlexBasis,
|
|
484
|
-
kebabCase,
|
|
485
|
-
resolveDebuger,
|
|
486
|
-
startOf,
|
|
487
|
-
toBase64,
|
|
488
|
-
toLine,
|
|
489
|
-
toPascalCase,
|
|
490
|
-
upperCamelCase
|
|
4
|
+
tool as default
|
|
491
5
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -49,3 +49,4 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
49
49
|
} & PluginObject<undefined>;
|
|
50
50
|
export default _default;
|
|
51
51
|
export { NfButtonDemo, NfToastDemo, NfMenu, NfInfiniteMenu, NfDoubleTime, NfEmpty, NfImportTemplate, NfRadioGroup, NfAlert, NfVirtualSelect, NfTag, NfAction, NfIndicatorPlane, NfQuarterPicker, NfDoubleQuarter, NfDoubleHalfYear, NfHalfYearPicker, NfDoubleWeek, NfDoubleYear, NfDatePicker, NfFormItem, NfForm, NfTable, NfSearchForm, NfDrawer, NfMessage, Message, NfNotification, Notification, NfConfirm, Confirm, NfTextOverflow, NfResizablePanels, NfAudio, NfButton, NfIconfontIcon, NfSvgIcon, NfKeywords, NfConditions, NfVariableSelect, NfRules, NfLazySelect, NfPopupLazySelect, NfTransferSelect, NfAddressSelect, NfSoftphone, NfMicrophone, softphoneManager, SoftphoneManager, NfTimezonePicker };
|
|
52
|
+
export { locale } from '@94ai/common-utils';
|
package/package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/common-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "94智能公共组件库",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"组件库"
|
|
@@ -13,58 +13,58 @@
|
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "http://94ai.
|
|
16
|
+
"url": "http://gitlab.94ai.pro/zoujiahe/common-ui.git"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@94ai/common-constants": "^
|
|
20
|
-
"@94ai/common-utils": "^
|
|
21
|
-
"@94ai/nf-action": "^
|
|
22
|
-
"@94ai/nf-address-select": "^
|
|
23
|
-
"@94ai/nf-alert": "^
|
|
24
|
-
"@94ai/nf-audio": "^
|
|
25
|
-
"@94ai/nf-button": "^
|
|
26
|
-
"@94ai/nf-button-demo": "^
|
|
27
|
-
"@94ai/nf-conditions": "^
|
|
28
|
-
"@94ai/nf-confirm": "^
|
|
29
|
-
"@94ai/nf-date-picker": "^
|
|
30
|
-
"@94ai/nf-double-half-year": "^
|
|
31
|
-
"@94ai/nf-double-quarter": "^
|
|
32
|
-
"@94ai/nf-double-time": "^
|
|
33
|
-
"@94ai/nf-double-week": "^
|
|
34
|
-
"@94ai/nf-double-year": "^
|
|
35
|
-
"@94ai/nf-drawer": "^
|
|
36
|
-
"@94ai/nf-empty": "^
|
|
37
|
-
"@94ai/nf-form": "^
|
|
38
|
-
"@94ai/nf-form-item": "^
|
|
39
|
-
"@94ai/nf-half-year-picker": "^
|
|
40
|
-
"@94ai/nf-iconfont-icon": "^
|
|
41
|
-
"@94ai/nf-import-template": "^
|
|
42
|
-
"@94ai/nf-indicator-plane": "^
|
|
43
|
-
"@94ai/nf-infinite-menu": "^
|
|
44
|
-
"@94ai/nf-input": "^
|
|
45
|
-
"@94ai/nf-keywords": "^
|
|
46
|
-
"@94ai/nf-lazy-select": "^
|
|
47
|
-
"@94ai/nf-menu": "^
|
|
48
|
-
"@94ai/nf-message": "^
|
|
49
|
-
"@94ai/nf-microphone": "^
|
|
50
|
-
"@94ai/nf-notification": "^
|
|
51
|
-
"@94ai/nf-popup-lazy-select": "^
|
|
52
|
-
"@94ai/nf-quarter-picker": "^
|
|
53
|
-
"@94ai/nf-radio-group": "^
|
|
54
|
-
"@94ai/nf-resizable-panels": "^
|
|
55
|
-
"@94ai/nf-rules": "^
|
|
56
|
-
"@94ai/nf-search-form": "^
|
|
57
|
-
"@94ai/nf-softphone": "^
|
|
58
|
-
"@94ai/nf-svg-icon": "^
|
|
59
|
-
"@94ai/nf-table": "^
|
|
60
|
-
"@94ai/nf-tag": "^
|
|
61
|
-
"@94ai/nf-text-overflow": "^
|
|
62
|
-
"@94ai/nf-theme-chalk": "^
|
|
63
|
-
"@94ai/nf-timezone-picker": "^
|
|
64
|
-
"@94ai/nf-toast-demo": "^
|
|
65
|
-
"@94ai/nf-transfer-select": "^
|
|
66
|
-
"@94ai/nf-variable-select": "^
|
|
67
|
-
"@94ai/nf-virtual-select": "^
|
|
19
|
+
"@94ai/common-constants": "^10.0.0",
|
|
20
|
+
"@94ai/common-utils": "^10.0.0",
|
|
21
|
+
"@94ai/nf-action": "^10.0.0",
|
|
22
|
+
"@94ai/nf-address-select": "^10.0.0",
|
|
23
|
+
"@94ai/nf-alert": "^10.0.0",
|
|
24
|
+
"@94ai/nf-audio": "^10.0.0",
|
|
25
|
+
"@94ai/nf-button": "^10.0.0",
|
|
26
|
+
"@94ai/nf-button-demo": "^10.0.0",
|
|
27
|
+
"@94ai/nf-conditions": "^10.0.0",
|
|
28
|
+
"@94ai/nf-confirm": "^10.0.0",
|
|
29
|
+
"@94ai/nf-date-picker": "^10.0.0",
|
|
30
|
+
"@94ai/nf-double-half-year": "^10.0.0",
|
|
31
|
+
"@94ai/nf-double-quarter": "^10.0.0",
|
|
32
|
+
"@94ai/nf-double-time": "^10.0.0",
|
|
33
|
+
"@94ai/nf-double-week": "^10.0.0",
|
|
34
|
+
"@94ai/nf-double-year": "^10.0.0",
|
|
35
|
+
"@94ai/nf-drawer": "^10.0.0",
|
|
36
|
+
"@94ai/nf-empty": "^10.0.0",
|
|
37
|
+
"@94ai/nf-form": "^10.0.0",
|
|
38
|
+
"@94ai/nf-form-item": "^10.0.0",
|
|
39
|
+
"@94ai/nf-half-year-picker": "^10.0.0",
|
|
40
|
+
"@94ai/nf-iconfont-icon": "^10.0.0",
|
|
41
|
+
"@94ai/nf-import-template": "^10.0.0",
|
|
42
|
+
"@94ai/nf-indicator-plane": "^10.0.0",
|
|
43
|
+
"@94ai/nf-infinite-menu": "^10.0.0",
|
|
44
|
+
"@94ai/nf-input": "^10.0.0",
|
|
45
|
+
"@94ai/nf-keywords": "^10.0.0",
|
|
46
|
+
"@94ai/nf-lazy-select": "^10.0.0",
|
|
47
|
+
"@94ai/nf-menu": "^10.0.0",
|
|
48
|
+
"@94ai/nf-message": "^10.0.0",
|
|
49
|
+
"@94ai/nf-microphone": "^10.0.0",
|
|
50
|
+
"@94ai/nf-notification": "^10.0.0",
|
|
51
|
+
"@94ai/nf-popup-lazy-select": "^10.0.0",
|
|
52
|
+
"@94ai/nf-quarter-picker": "^10.0.0",
|
|
53
|
+
"@94ai/nf-radio-group": "^10.0.0",
|
|
54
|
+
"@94ai/nf-resizable-panels": "^10.0.0",
|
|
55
|
+
"@94ai/nf-rules": "^10.0.0",
|
|
56
|
+
"@94ai/nf-search-form": "^10.0.0",
|
|
57
|
+
"@94ai/nf-softphone": "^10.0.0",
|
|
58
|
+
"@94ai/nf-svg-icon": "^10.0.0",
|
|
59
|
+
"@94ai/nf-table": "^10.0.0",
|
|
60
|
+
"@94ai/nf-tag": "^10.0.0",
|
|
61
|
+
"@94ai/nf-text-overflow": "^10.0.0",
|
|
62
|
+
"@94ai/nf-theme-chalk": "^10.0.0",
|
|
63
|
+
"@94ai/nf-timezone-picker": "^10.0.0",
|
|
64
|
+
"@94ai/nf-toast-demo": "^10.0.0",
|
|
65
|
+
"@94ai/nf-transfer-select": "^10.0.0",
|
|
66
|
+
"@94ai/nf-variable-select": "^10.0.0",
|
|
67
|
+
"@94ai/nf-virtual-select": "^10.0.0",
|
|
68
68
|
"lodash-es": "^4.17.21",
|
|
69
69
|
"vue-demi": "^0.14.5"
|
|
70
70
|
},
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"@vue/composition-api": "^1.0.0-rc.1",
|
|
78
|
-
"
|
|
79
|
-
"
|
|
78
|
+
"vue": "^2.0.0 || >=3.0.0",
|
|
79
|
+
"element-ui": ">=2.13.2"
|
|
80
80
|
},
|
|
81
81
|
"types": "lib/index.d.ts",
|
|
82
82
|
"main": "lib/common-ui.cjs.js",
|
|
@@ -97,6 +97,5 @@
|
|
|
97
97
|
"require": "./lib/common-ui.tool.cjs.cjs",
|
|
98
98
|
"import": "./lib/common-ui.tool.esm-bundler.mjs"
|
|
99
99
|
}
|
|
100
|
-
}
|
|
101
|
-
"gitHead": "74e871c7972dc4576480bee02b1dc61a3eafc6ba"
|
|
100
|
+
}
|
|
102
101
|
}
|