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