qidian-shared 1.0.23 → 1.0.25
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/dist/qidian-shared.cjs.js +43 -37
- package/dist/qidian-shared.cjs.js.map +1 -1
- package/dist/qidian-shared.es.js +43 -37
- package/dist/qidian-shared.es.js.map +1 -1
- package/dist/qidian-shared.umd.js +43 -37
- package/dist/qidian-shared.umd.js.map +1 -1
- package/dist/utils/common.d.ts +1 -1
- package/dist/utils/{data.d.ts → conversion.d.ts} +1 -0
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1331,6 +1331,44 @@ function toPrecision(num, precision = 0) {
|
|
|
1331
1331
|
const result = Math.round(Number(num) * 10 ** precision) / 10 ** precision;
|
|
1332
1332
|
return parseFloat(`${result}`);
|
|
1333
1333
|
}
|
|
1334
|
+
function toArr(target) {
|
|
1335
|
+
if (Array.isArray(target)) return target;
|
|
1336
|
+
if (isEmpty(target)) return [];
|
|
1337
|
+
return [target];
|
|
1338
|
+
}
|
|
1339
|
+
function buildTree(data, options = {}) {
|
|
1340
|
+
const { id = "id", parentId = "parentId", children = "children" } = options;
|
|
1341
|
+
const childrenListMap = {};
|
|
1342
|
+
const nodeIds = {};
|
|
1343
|
+
const tree = [];
|
|
1344
|
+
for (const d of data) {
|
|
1345
|
+
const pid = d[parentId];
|
|
1346
|
+
if (!childrenListMap[pid]) {
|
|
1347
|
+
childrenListMap[pid] = [];
|
|
1348
|
+
}
|
|
1349
|
+
nodeIds[d[id]] = d;
|
|
1350
|
+
childrenListMap[pid].push(d);
|
|
1351
|
+
}
|
|
1352
|
+
for (const d of data) {
|
|
1353
|
+
const pid = d[parentId];
|
|
1354
|
+
if (!nodeIds[pid]) {
|
|
1355
|
+
tree.push(d);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
for (const t of tree) {
|
|
1359
|
+
adaptToChildrenList(t);
|
|
1360
|
+
}
|
|
1361
|
+
function adaptToChildrenList(o) {
|
|
1362
|
+
const childNodes = childrenListMap[o[id]];
|
|
1363
|
+
if (childNodes) {
|
|
1364
|
+
o[children] = childNodes;
|
|
1365
|
+
for (const c of childNodes) {
|
|
1366
|
+
adaptToChildrenList(c);
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
return tree;
|
|
1371
|
+
}
|
|
1334
1372
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
1335
1373
|
function getDefaultExportFromCjs(x) {
|
|
1336
1374
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -7986,39 +8024,6 @@ function easyDownload(res, name) {
|
|
|
7986
8024
|
}, 1e3);
|
|
7987
8025
|
}
|
|
7988
8026
|
}
|
|
7989
|
-
function buildTree(data, options = {}) {
|
|
7990
|
-
const { id = "id", parentId = "parentId", children = "children" } = options;
|
|
7991
|
-
const childrenListMap = {};
|
|
7992
|
-
const nodeIds = {};
|
|
7993
|
-
const tree = [];
|
|
7994
|
-
for (const d of data) {
|
|
7995
|
-
const pid = d[parentId];
|
|
7996
|
-
if (!childrenListMap[pid]) {
|
|
7997
|
-
childrenListMap[pid] = [];
|
|
7998
|
-
}
|
|
7999
|
-
nodeIds[d[id]] = d;
|
|
8000
|
-
childrenListMap[pid].push(d);
|
|
8001
|
-
}
|
|
8002
|
-
for (const d of data) {
|
|
8003
|
-
const pid = d[parentId];
|
|
8004
|
-
if (!nodeIds[pid]) {
|
|
8005
|
-
tree.push(d);
|
|
8006
|
-
}
|
|
8007
|
-
}
|
|
8008
|
-
for (const t of tree) {
|
|
8009
|
-
adaptToChildrenList(t);
|
|
8010
|
-
}
|
|
8011
|
-
function adaptToChildrenList(o) {
|
|
8012
|
-
const childNodes = childrenListMap[o[id]];
|
|
8013
|
-
if (childNodes) {
|
|
8014
|
-
o[children] = childNodes;
|
|
8015
|
-
for (const c of childNodes) {
|
|
8016
|
-
adaptToChildrenList(c);
|
|
8017
|
-
}
|
|
8018
|
-
}
|
|
8019
|
-
}
|
|
8020
|
-
return tree;
|
|
8021
|
-
}
|
|
8022
8027
|
var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
8023
8028
|
function int2char(n) {
|
|
8024
8029
|
return BI_RM.charAt(n);
|
|
@@ -12079,7 +12084,7 @@ function useServiceLoadMore({
|
|
|
12079
12084
|
async (params) => {
|
|
12080
12085
|
const res = { list: [], page: 1, total: 0 };
|
|
12081
12086
|
const paginationV = vue.unref(pagination);
|
|
12082
|
-
const currentParams = paginationV ? {
|
|
12087
|
+
const currentParams = paginationV !== false ? {
|
|
12083
12088
|
pageNum: params?.page ?? 1,
|
|
12084
12089
|
pageSize: params?.size ?? paginationV?.pageSize ?? 30
|
|
12085
12090
|
} : void 0;
|
|
@@ -12292,13 +12297,13 @@ function useServicePagination({
|
|
|
12292
12297
|
refreshAsync();
|
|
12293
12298
|
}
|
|
12294
12299
|
vue.onActivated(() => {
|
|
12295
|
-
if (!manual) reRefresh();
|
|
12300
|
+
if (!manual && !isEmpty(vue.unref(pollingInterval))) reRefresh();
|
|
12296
12301
|
});
|
|
12297
12302
|
vue.onDeactivated(() => {
|
|
12298
|
-
if (isEmpty(vue.unref(pollingInterval))) cancel();
|
|
12303
|
+
if (!isEmpty(vue.unref(pollingInterval))) cancel();
|
|
12299
12304
|
});
|
|
12300
12305
|
vue.onBeforeUnmount(() => {
|
|
12301
|
-
if (isEmpty(vue.unref(pollingInterval))) cancel();
|
|
12306
|
+
if (!isEmpty(vue.unref(pollingInterval))) cancel();
|
|
12302
12307
|
});
|
|
12303
12308
|
return {
|
|
12304
12309
|
data,
|
|
@@ -12453,6 +12458,7 @@ exports.resizeDirective = resizeDirective;
|
|
|
12453
12458
|
exports.setUrlParam = setUrlParam;
|
|
12454
12459
|
exports.suspectedWrapperPromise = suspectedWrapperPromise;
|
|
12455
12460
|
exports.to = to;
|
|
12461
|
+
exports.toArr = toArr;
|
|
12456
12462
|
exports.toMoney = toMoney;
|
|
12457
12463
|
exports.toMoneyTrimmed = toMoneyTrimmed;
|
|
12458
12464
|
exports.toMoneyWithK = toMoneyWithK;
|