@gx-design-vue/pro-utils 0.0.3 → 0.0.5-rc.1
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/index.es.js +4 -30
- package/dist/index.js +3 -32
- package/dist/typings/index.d.ts +1 -1
- package/dist/utils/index.d.ts +4 -18
- package/dist/utils/validate.d.ts +0 -1
- package/package.json +1 -2
package/dist/index.es.js
CHANGED
|
@@ -2316,9 +2316,8 @@ function cloneDeep(value) {
|
|
|
2316
2316
|
* @param index 序列号,理论上唯一
|
|
2317
2317
|
*/
|
|
2318
2318
|
const genColumnKey = (key, index) => {
|
|
2319
|
-
if (key)
|
|
2319
|
+
if (key)
|
|
2320
2320
|
return Array.isArray(key) ? key.join('-') : key.toString();
|
|
2321
|
-
}
|
|
2322
2321
|
return `${index}`;
|
|
2323
2322
|
};
|
|
2324
2323
|
function handleShowIndex(columns, { align, showIndex }) {
|
|
@@ -2393,7 +2392,7 @@ function deepCopy(data) {
|
|
|
2393
2392
|
* @lastTime 2021/1/28
|
|
2394
2393
|
* @description 判断删除是否到当前页最后一条
|
|
2395
2394
|
*/
|
|
2396
|
-
function handleCurrentPage(pageConfig
|
|
2395
|
+
function handleCurrentPage(pageConfig, number) {
|
|
2397
2396
|
const { pageSize = 10, total = 0 } = pageConfig;
|
|
2398
2397
|
let { current = 1 } = pageConfig;
|
|
2399
2398
|
if (total - number <= pageSize * (current - 1)) {
|
|
@@ -2407,7 +2406,7 @@ function handleCurrentPage(pageConfig = {}, number) {
|
|
|
2407
2406
|
* @lastTime 2020/7/24
|
|
2408
2407
|
* @description 数组(树形)添加序号
|
|
2409
2408
|
*/
|
|
2410
|
-
function getSortIndex(data = [], pageConfig
|
|
2409
|
+
function getSortIndex(data = [], pageConfig, childrenKey = 'children') {
|
|
2411
2410
|
function getChildSortIndex(parentSort, data) {
|
|
2412
2411
|
return data.map((item, index) => {
|
|
2413
2412
|
const sortIndex = `${parentSort}-${index + 1}`;
|
|
@@ -2561,33 +2560,8 @@ function getRandomNumber() {
|
|
|
2561
2560
|
}
|
|
2562
2561
|
};
|
|
2563
2562
|
}
|
|
2564
|
-
/**
|
|
2565
|
-
* @Author gaoxiang
|
|
2566
|
-
* @DateTime 2020/11/13
|
|
2567
|
-
* @lastTime 2020/11/13
|
|
2568
|
-
* @description 截取视频时间戳
|
|
2569
|
-
*/
|
|
2570
|
-
function getVideoFileUrl(url = '') {
|
|
2571
|
-
const index = url.indexOf('?');
|
|
2572
|
-
return index > 0 ? `${url.substring(0, index)}` : url;
|
|
2573
|
-
}
|
|
2574
|
-
/**
|
|
2575
|
-
* @Author gaoxiang
|
|
2576
|
-
* @DateTime 2020/11/13
|
|
2577
|
-
* @lastTime 2020/11/13
|
|
2578
|
-
* @description 获取文件后缀名
|
|
2579
|
-
*/
|
|
2580
|
-
function getFileSuffix(url = '') {
|
|
2581
|
-
url = getVideoFileUrl(url);
|
|
2582
|
-
const index = url.lastIndexOf('.');
|
|
2583
|
-
return index > 0 ?
|
|
2584
|
-
`${url.substring(index).split('?')[0]}`.split('.')[1]
|
|
2585
|
-
:
|
|
2586
|
-
'';
|
|
2587
|
-
}
|
|
2588
2563
|
|
|
2589
2564
|
const toString = Object.prototype.toString;
|
|
2590
|
-
const noop = () => { };
|
|
2591
2565
|
function is(val, type) {
|
|
2592
2566
|
return toString.call(val) === `[object ${type}]`;
|
|
2593
2567
|
}
|
|
@@ -2631,4 +2605,4 @@ function isFunction(func) {
|
|
|
2631
2605
|
return (typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]');
|
|
2632
2606
|
}
|
|
2633
2607
|
|
|
2634
|
-
export { arrayRepeat, compareToMax, deepCopy, genColumnKey,
|
|
2608
|
+
export { arrayRepeat, compareToMax, deepCopy, genColumnKey, getRandomNumber, getSortIndex, handleCurrentPage, handleFormDefaultValue, handleShowIndex, hanndleField, is, isArray, isBoolean, isFunction, isNumber, isObject, isString, runFunction };
|
package/dist/index.js
CHANGED
|
@@ -2320,9 +2320,8 @@ function cloneDeep(value) {
|
|
|
2320
2320
|
* @param index 序列号,理论上唯一
|
|
2321
2321
|
*/
|
|
2322
2322
|
const genColumnKey = (key, index) => {
|
|
2323
|
-
if (key)
|
|
2323
|
+
if (key)
|
|
2324
2324
|
return Array.isArray(key) ? key.join('-') : key.toString();
|
|
2325
|
-
}
|
|
2326
2325
|
return `${index}`;
|
|
2327
2326
|
};
|
|
2328
2327
|
function handleShowIndex(columns, { align, showIndex }) {
|
|
@@ -2397,7 +2396,7 @@ function deepCopy(data) {
|
|
|
2397
2396
|
* @lastTime 2021/1/28
|
|
2398
2397
|
* @description 判断删除是否到当前页最后一条
|
|
2399
2398
|
*/
|
|
2400
|
-
function handleCurrentPage(pageConfig
|
|
2399
|
+
function handleCurrentPage(pageConfig, number) {
|
|
2401
2400
|
const { pageSize = 10, total = 0 } = pageConfig;
|
|
2402
2401
|
let { current = 1 } = pageConfig;
|
|
2403
2402
|
if (total - number <= pageSize * (current - 1)) {
|
|
@@ -2411,7 +2410,7 @@ function handleCurrentPage(pageConfig = {}, number) {
|
|
|
2411
2410
|
* @lastTime 2020/7/24
|
|
2412
2411
|
* @description 数组(树形)添加序号
|
|
2413
2412
|
*/
|
|
2414
|
-
function getSortIndex(data = [], pageConfig
|
|
2413
|
+
function getSortIndex(data = [], pageConfig, childrenKey = 'children') {
|
|
2415
2414
|
function getChildSortIndex(parentSort, data) {
|
|
2416
2415
|
return data.map((item, index) => {
|
|
2417
2416
|
const sortIndex = `${parentSort}-${index + 1}`;
|
|
@@ -2565,33 +2564,8 @@ function getRandomNumber() {
|
|
|
2565
2564
|
}
|
|
2566
2565
|
};
|
|
2567
2566
|
}
|
|
2568
|
-
/**
|
|
2569
|
-
* @Author gaoxiang
|
|
2570
|
-
* @DateTime 2020/11/13
|
|
2571
|
-
* @lastTime 2020/11/13
|
|
2572
|
-
* @description 截取视频时间戳
|
|
2573
|
-
*/
|
|
2574
|
-
function getVideoFileUrl(url = '') {
|
|
2575
|
-
const index = url.indexOf('?');
|
|
2576
|
-
return index > 0 ? `${url.substring(0, index)}` : url;
|
|
2577
|
-
}
|
|
2578
|
-
/**
|
|
2579
|
-
* @Author gaoxiang
|
|
2580
|
-
* @DateTime 2020/11/13
|
|
2581
|
-
* @lastTime 2020/11/13
|
|
2582
|
-
* @description 获取文件后缀名
|
|
2583
|
-
*/
|
|
2584
|
-
function getFileSuffix(url = '') {
|
|
2585
|
-
url = getVideoFileUrl(url);
|
|
2586
|
-
const index = url.lastIndexOf('.');
|
|
2587
|
-
return index > 0 ?
|
|
2588
|
-
`${url.substring(index).split('?')[0]}`.split('.')[1]
|
|
2589
|
-
:
|
|
2590
|
-
'';
|
|
2591
|
-
}
|
|
2592
2567
|
|
|
2593
2568
|
const toString = Object.prototype.toString;
|
|
2594
|
-
const noop = () => { };
|
|
2595
2569
|
function is(val, type) {
|
|
2596
2570
|
return toString.call(val) === `[object ${type}]`;
|
|
2597
2571
|
}
|
|
@@ -2639,10 +2613,8 @@ exports.arrayRepeat = arrayRepeat;
|
|
|
2639
2613
|
exports.compareToMax = compareToMax;
|
|
2640
2614
|
exports.deepCopy = deepCopy;
|
|
2641
2615
|
exports.genColumnKey = genColumnKey;
|
|
2642
|
-
exports.getFileSuffix = getFileSuffix;
|
|
2643
2616
|
exports.getRandomNumber = getRandomNumber;
|
|
2644
2617
|
exports.getSortIndex = getSortIndex;
|
|
2645
|
-
exports.getVideoFileUrl = getVideoFileUrl;
|
|
2646
2618
|
exports.handleCurrentPage = handleCurrentPage;
|
|
2647
2619
|
exports.handleFormDefaultValue = handleFormDefaultValue;
|
|
2648
2620
|
exports.handleShowIndex = handleShowIndex;
|
|
@@ -2654,5 +2626,4 @@ exports.isFunction = isFunction;
|
|
|
2654
2626
|
exports.isNumber = isNumber;
|
|
2655
2627
|
exports.isObject = isObject;
|
|
2656
2628
|
exports.isString = isString;
|
|
2657
|
-
exports.noop = noop;
|
|
2658
2629
|
exports.runFunction = runFunction;
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare type AlignType = 'left' | 'center' | 'right';
|
|
2
2
|
declare type ProFieldValueType = 'text' | 'date' | 'select' | 'treeSelect' | 'dateMonth' | 'dateRange' | 'time';
|
|
3
|
-
export declare type
|
|
3
|
+
export declare type BasicTablePageConfig<T = any> = {
|
|
4
4
|
current?: number | undefined;
|
|
5
5
|
pageSize?: number | undefined;
|
|
6
6
|
total?: number | undefined;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AlignType, ProColumn, ProSearchMap } from '../typings';
|
|
2
|
-
import {
|
|
2
|
+
import { BasicTablePageConfig } from '../typings';
|
|
3
3
|
/**
|
|
4
4
|
* 根据 key 和 dataIndex 生成唯一 id
|
|
5
5
|
*
|
|
@@ -33,14 +33,14 @@ export declare function deepCopy(data: object | any[]): any;
|
|
|
33
33
|
* @lastTime 2021/1/28
|
|
34
34
|
* @description 判断删除是否到当前页最后一条
|
|
35
35
|
*/
|
|
36
|
-
export declare function handleCurrentPage(pageConfig:
|
|
36
|
+
export declare function handleCurrentPage(pageConfig: BasicTablePageConfig, number: number): any;
|
|
37
37
|
/**
|
|
38
38
|
* @Author gaoxiang
|
|
39
39
|
* @DateTime 2020/7/24
|
|
40
40
|
* @lastTime 2020/7/24
|
|
41
41
|
* @description 数组(树形)添加序号
|
|
42
42
|
*/
|
|
43
|
-
export declare function getSortIndex(data
|
|
43
|
+
export declare function getSortIndex(data: any[] | undefined, pageConfig: BasicTablePageConfig, childrenKey?: string): any;
|
|
44
44
|
/**
|
|
45
45
|
* @Author gaoxiang
|
|
46
46
|
* @DateTime 2019/11/29
|
|
@@ -54,7 +54,7 @@ export declare function compareToMax(obj1: any, obj2: any, key: string): number;
|
|
|
54
54
|
* @lastTime 2019/12/11
|
|
55
55
|
* @description 数组去重
|
|
56
56
|
*/
|
|
57
|
-
export declare function arrayRepeat(data:
|
|
57
|
+
export declare function arrayRepeat<T = any>(data: T[]): any;
|
|
58
58
|
/**
|
|
59
59
|
* @Author gaoxiang
|
|
60
60
|
* @DateTime 2020/8/26
|
|
@@ -77,17 +77,3 @@ export declare function getRandomNumber(): {
|
|
|
77
77
|
uuidString(): string;
|
|
78
78
|
uuidCompact(): string;
|
|
79
79
|
};
|
|
80
|
-
/**
|
|
81
|
-
* @Author gaoxiang
|
|
82
|
-
* @DateTime 2020/11/13
|
|
83
|
-
* @lastTime 2020/11/13
|
|
84
|
-
* @description 截取视频时间戳
|
|
85
|
-
*/
|
|
86
|
-
export declare function getVideoFileUrl(url?: string): string;
|
|
87
|
-
/**
|
|
88
|
-
* @Author gaoxiang
|
|
89
|
-
* @DateTime 2020/11/13
|
|
90
|
-
* @lastTime 2020/11/13
|
|
91
|
-
* @description 获取文件后缀名
|
|
92
|
-
*/
|
|
93
|
-
export declare function getFileSuffix(url?: string): string;
|
package/dist/utils/validate.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gx-design-vue/pro-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5-rc.01",
|
|
4
4
|
"description": "@gx-design-vue/pro-utils",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"ie >= 11"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"ant-design-vue": "3.2.13",
|
|
24
23
|
"vue": "3.2.39",
|
|
25
24
|
"lodash-es": "^4.17.21",
|
|
26
25
|
"@rollup/plugin-commonjs": "^21.0.1",
|