ls-pro-common 3.0.12 → 3.0.13
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/README.md +22 -22
- package/dist/common.css +121 -21
- package/dist/common.js +1 -1
- package/dist/common.min.css +121 -21
- package/dist/common.min.js +1 -1
- package/package.json +48 -48
- package/CHANGELOG.md +0 -746
- package/es/components/404.d.ts +0 -3
- package/es/components/404.jpg +0 -0
- package/es/components/404.js +0 -9
- package/es/components/AreaCascader.d.ts +0 -4
- package/es/components/AreaCascader.js +0 -76
- package/es/components/AreaCascaderPanel.d.ts +0 -5
- package/es/components/AreaCascaderPanel.js +0 -230
- package/es/components/DescritionCard.d.ts +0 -11
- package/es/components/DescritionCard.js +0 -79
- package/es/components/DtlLayout.d.ts +0 -44
- package/es/components/DtlLayout.js +0 -115
- package/es/components/GroupTip.d.ts +0 -10
- package/es/components/GroupTip.js +0 -31
- package/es/components/IconBack.d.ts +0 -3
- package/es/components/IconBack.js +0 -20
- package/es/components/IconBell.d.ts +0 -3
- package/es/components/IconBell.js +0 -22
- package/es/components/IconQuestion.d.ts +0 -3
- package/es/components/IconQuestion.js +0 -26
- package/es/components/IconSearch.d.ts +0 -3
- package/es/components/IconSearch.js +0 -22
- package/es/components/IconSelector.d.ts +0 -14
- package/es/components/IconSelector.js +0 -222
- package/es/components/IconText.d.ts +0 -3
- package/es/components/IconText.js +0 -30
- package/es/components/ImageSelector.d.ts +0 -31
- package/es/components/ImageSelector.js +0 -437
- package/es/components/InputMultiLine.d.ts +0 -46
- package/es/components/InputMultiLine.js +0 -139
- package/es/components/InputTable.d.ts +0 -106
- package/es/components/InputTable.js +0 -476
- package/es/components/Loading.d.ts +0 -8
- package/es/components/Loading.js +0 -20
- package/es/components/Permission.d.ts +0 -6
- package/es/components/Permission.js +0 -13
- package/es/components/antd-custom.less +0 -262
- package/es/components/common.less +0 -469
- package/es/hooks/useDtl/index.d.ts +0 -48
- package/es/hooks/useDtl/index.js +0 -949
- package/es/hooks/useGetState.d.ts +0 -1
- package/es/hooks/useGetState.js +0 -17
- package/es/hooks/usePermission/index.d.ts +0 -15
- package/es/hooks/usePermission/index.js +0 -58
- package/es/hooks/useSingle/index.d.ts +0 -55
- package/es/hooks/useSingle/index.js +0 -662
- package/es/http/index.d.ts +0 -53
- package/es/http/index.js +0 -305
- package/es/index.d.ts +0 -32
- package/es/index.js +0 -26
- package/es/service/BaseService.d.ts +0 -24
- package/es/service/BaseService.js +0 -214
- package/es/typing.d.ts +0 -53
- package/es/typing.js +0 -1
- package/es/utils/index.d.ts +0 -258
- package/es/utils/index.js +0 -679
- package/lib/components/404.d.ts +0 -3
- package/lib/components/404.jpg +0 -0
- package/lib/components/404.js +0 -17
- package/lib/components/AreaCascader.d.ts +0 -4
- package/lib/components/AreaCascader.js +0 -85
- package/lib/components/AreaCascaderPanel.d.ts +0 -5
- package/lib/components/AreaCascaderPanel.js +0 -239
- package/lib/components/DescritionCard.d.ts +0 -11
- package/lib/components/DescritionCard.js +0 -88
- package/lib/components/DtlLayout.d.ts +0 -44
- package/lib/components/DtlLayout.js +0 -124
- package/lib/components/GroupTip.d.ts +0 -10
- package/lib/components/GroupTip.js +0 -39
- package/lib/components/IconBack.d.ts +0 -3
- package/lib/components/IconBack.js +0 -28
- package/lib/components/IconBell.d.ts +0 -3
- package/lib/components/IconBell.js +0 -30
- package/lib/components/IconQuestion.d.ts +0 -3
- package/lib/components/IconQuestion.js +0 -34
- package/lib/components/IconSearch.d.ts +0 -3
- package/lib/components/IconSearch.js +0 -30
- package/lib/components/IconSelector.d.ts +0 -14
- package/lib/components/IconSelector.js +0 -230
- package/lib/components/IconText.d.ts +0 -3
- package/lib/components/IconText.js +0 -38
- package/lib/components/ImageSelector.d.ts +0 -31
- package/lib/components/ImageSelector.js +0 -445
- package/lib/components/InputMultiLine.d.ts +0 -46
- package/lib/components/InputMultiLine.js +0 -148
- package/lib/components/InputTable.d.ts +0 -106
- package/lib/components/InputTable.js +0 -485
- package/lib/components/Loading.d.ts +0 -8
- package/lib/components/Loading.js +0 -28
- package/lib/components/Permission.d.ts +0 -6
- package/lib/components/Permission.js +0 -21
- package/lib/components/antd-custom.less +0 -262
- package/lib/components/common.less +0 -469
- package/lib/hooks/useDtl/index.d.ts +0 -48
- package/lib/hooks/useDtl/index.js +0 -957
- package/lib/hooks/useGetState.d.ts +0 -1
- package/lib/hooks/useGetState.js +0 -24
- package/lib/hooks/usePermission/index.d.ts +0 -15
- package/lib/hooks/usePermission/index.js +0 -65
- package/lib/hooks/useSingle/index.d.ts +0 -55
- package/lib/hooks/useSingle/index.js +0 -670
- package/lib/http/index.d.ts +0 -53
- package/lib/http/index.js +0 -319
- package/lib/index.d.ts +0 -32
- package/lib/service/BaseService.d.ts +0 -24
- package/lib/service/BaseService.js +0 -222
- package/lib/typing.d.ts +0 -53
- package/lib/typing.js +0 -5
- package/lib/utils/index.d.ts +0 -258
- package/lib/utils/index.js +0 -776
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function (initVal: any): any[];
|
package/es/hooks/useGetState.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import { useState, useRef } from "react";
|
|
3
|
-
export default function (initVal) {
|
|
4
|
-
var _useState = useState(initVal),
|
|
5
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
6
|
-
state = _useState2[0],
|
|
7
|
-
setState = _useState2[1];
|
|
8
|
-
var ref = useRef(initVal);
|
|
9
|
-
var shangeState = function shangeState(newVal) {
|
|
10
|
-
ref.current = newVal;
|
|
11
|
-
setState(newVal);
|
|
12
|
-
};
|
|
13
|
-
var getState = function getState() {
|
|
14
|
-
return ref.current;
|
|
15
|
-
};
|
|
16
|
-
return [state, shangeState, getState];
|
|
17
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare function usePermission(): {
|
|
2
|
-
resourceId: any;
|
|
3
|
-
permissionVal: number;
|
|
4
|
-
resRightVal: number;
|
|
5
|
-
loginName: string | undefined;
|
|
6
|
-
checkRight: (val: number) => boolean;
|
|
7
|
-
canAdd: boolean;
|
|
8
|
-
canEdit: boolean;
|
|
9
|
-
canDelete: boolean;
|
|
10
|
-
canAudit: boolean;
|
|
11
|
-
canImport: boolean;
|
|
12
|
-
canExport: boolean;
|
|
13
|
-
canPrint: boolean;
|
|
14
|
-
};
|
|
15
|
-
export default usePermission;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { useMemo, useCallback } from 'react';
|
|
2
|
-
import { useLocation } from 'react-router-dom';
|
|
3
|
-
import { getUrlQuery, getResourceProps, getCache, getLoginName } from '../../utils';
|
|
4
|
-
function usePermission() {
|
|
5
|
-
var routeLocation = useLocation();
|
|
6
|
-
/** @name 资源ID */
|
|
7
|
-
var resourceId = useMemo(function () {
|
|
8
|
-
var _routeLocation$query;
|
|
9
|
-
//@ts-ignore
|
|
10
|
-
var resId = routeLocation === null || routeLocation === void 0 ? void 0 : (_routeLocation$query = routeLocation.query) === null || _routeLocation$query === void 0 ? void 0 : _routeLocation$query.resCode;
|
|
11
|
-
if (resId) return resId;
|
|
12
|
-
return getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId');
|
|
13
|
-
}, []);
|
|
14
|
-
var loginName = useMemo(function () {
|
|
15
|
-
return getLoginName();
|
|
16
|
-
}, []);
|
|
17
|
-
/** @name 用户权限 */
|
|
18
|
-
var permissionVal = useMemo(function () {
|
|
19
|
-
var _routeLocation$query2;
|
|
20
|
-
//@ts-ignore
|
|
21
|
-
var right = routeLocation === null || routeLocation === void 0 ? void 0 : (_routeLocation$query2 = routeLocation.query) === null || _routeLocation$query2 === void 0 ? void 0 : _routeLocation$query2.right;
|
|
22
|
-
if (right) return Number(right);
|
|
23
|
-
return Number(getUrlQuery('right') || getResourceProps('userPermissionVal') || getCache('right') || 0);
|
|
24
|
-
}, []);
|
|
25
|
-
/** @name 资源权限 */
|
|
26
|
-
var resRightVal = useMemo(function () {
|
|
27
|
-
var _routeLocation$query3;
|
|
28
|
-
//@ts-ignore
|
|
29
|
-
var right = routeLocation === null || routeLocation === void 0 ? void 0 : (_routeLocation$query3 = routeLocation.query) === null || _routeLocation$query3 === void 0 ? void 0 : _routeLocation$query3.resRight;
|
|
30
|
-
if (right) return Number(right);
|
|
31
|
-
return Number(getUrlQuery('resRight') || getResourceProps('permissionVal') || getCache('right') || 0);
|
|
32
|
-
}, []);
|
|
33
|
-
/**
|
|
34
|
-
* 检查是否有权限
|
|
35
|
-
* @param val 权限值
|
|
36
|
-
*/
|
|
37
|
-
var checkRight = useCallback(function (val) {
|
|
38
|
-
if (!val) return true;
|
|
39
|
-
if (location.href.includes("//localhost")) return true;
|
|
40
|
-
return (permissionVal & val) === val && (resRightVal & val) === val;
|
|
41
|
-
}, []);
|
|
42
|
-
return {
|
|
43
|
-
resourceId: resourceId,
|
|
44
|
-
permissionVal: permissionVal,
|
|
45
|
-
resRightVal: resRightVal,
|
|
46
|
-
loginName: loginName,
|
|
47
|
-
checkRight: checkRight,
|
|
48
|
-
canAdd: checkRight(2),
|
|
49
|
-
canEdit: checkRight(4),
|
|
50
|
-
canDelete: checkRight(8) || checkRight(32),
|
|
51
|
-
canAudit: checkRight(64),
|
|
52
|
-
canImport: checkRight(128),
|
|
53
|
-
canExport: checkRight(256),
|
|
54
|
-
canPrint: checkRight(512)
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
;
|
|
58
|
-
export default usePermission;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { ActionType } from 'ls-pro-table';
|
|
2
|
-
import type { exportParam } from 'ls-pro-table/lib/components/Export';
|
|
3
|
-
import type { ProFormInstance } from 'ls-pro-form';
|
|
4
|
-
import type { ApiResponse, TableToolbar } from '../../typing';
|
|
5
|
-
export declare type SingleParamType = {
|
|
6
|
-
service: any;
|
|
7
|
-
toolConfig?: TableToolbar;
|
|
8
|
-
initItem?: any;
|
|
9
|
-
statusField?: string;
|
|
10
|
-
auditStatus?: number;
|
|
11
|
-
beforeLoad?: (param: Record<string, any>) => Promise<boolean>;
|
|
12
|
-
beforeRemove?: (rows: any[]) => Promise<any>;
|
|
13
|
-
beforeAudit?: (rows: any[]) => Promise<any>;
|
|
14
|
-
beforeAdd?: (item: any) => Promise<any>;
|
|
15
|
-
beforeEdit?: (item: any) => Promise<any>;
|
|
16
|
-
beforeSave?: (item: any, isDtl?: boolean) => Promise<any>;
|
|
17
|
-
afterRemove?: (result: ApiResponse, rows?: any | any[]) => Promise<boolean>;
|
|
18
|
-
afterSave?: (result: ApiResponse, item?: any, isDtl?: boolean) => Promise<boolean>;
|
|
19
|
-
afterAudit?: (result: ApiResponse, item?: any | any[]) => Promise<boolean>;
|
|
20
|
-
btnStatus?: (btnKey: string) => boolean | undefined;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* 单表基本增删改查 hooks
|
|
24
|
-
* @param service 单表服务
|
|
25
|
-
* @param toolConfig 定义基础功能按钮
|
|
26
|
-
* @param initItem 对象初始值,新增时设置默认值
|
|
27
|
-
* @param onBeforeRemove 删除之前方法,开放给每个模块重写
|
|
28
|
-
* @returns
|
|
29
|
-
*/
|
|
30
|
-
declare function useSingle(inParam: SingleParamType): {
|
|
31
|
-
formRef: import("react").MutableRefObject<ProFormInstance<any> | undefined>;
|
|
32
|
-
editFormRef: import("react").MutableRefObject<ProFormInstance<any> | undefined>;
|
|
33
|
-
tableRef: import("react").MutableRefObject<ActionType | undefined>;
|
|
34
|
-
selectedRows: any;
|
|
35
|
-
showEdit: boolean;
|
|
36
|
-
editItem: any;
|
|
37
|
-
tableTools: (boolean | JSX.Element)[];
|
|
38
|
-
setSelectedRows: import("react").Dispatch<any>;
|
|
39
|
-
setShowEdit: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
40
|
-
setEditItem: import("react").Dispatch<any>;
|
|
41
|
-
onRemove: (row: any) => void;
|
|
42
|
-
onSave: (formData: any) => Promise<boolean>;
|
|
43
|
-
onLoad: (params: Record<string, any>, sort: Record<string, any>, filter: Record<string, any>, isHistory: any) => Promise<any>;
|
|
44
|
-
onAdd: (item: any) => Promise<void>;
|
|
45
|
-
onEdit: (item: any) => Promise<void>;
|
|
46
|
-
onExport: (url: string, param: exportParam) => Promise<boolean>;
|
|
47
|
-
onAudit: (row: any) => Promise<void>;
|
|
48
|
-
resourceId: any;
|
|
49
|
-
checkRight: (val: number) => boolean;
|
|
50
|
-
loginName: string | undefined;
|
|
51
|
-
isAudit: (row?: any) => boolean;
|
|
52
|
-
ifHistory: 0 | 1;
|
|
53
|
-
setIfHistory: import("react").Dispatch<import("react").SetStateAction<0 | 1>>;
|
|
54
|
-
};
|
|
55
|
-
export default useSingle;
|