ls-pro-common 3.0.11 → 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 +122 -21
- package/dist/common.js +1 -1
- package/dist/common.min.css +122 -21
- package/dist/common.min.js +1 -1
- package/lib/index.js +8 -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 -477
- 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 -468
- package/es/hooks/useDtl/index.d.ts +0 -48
- package/es/hooks/useDtl/index.js +0 -949
- 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 -301
- package/es/index.d.ts +0 -31
- package/es/index.js +0 -25
- 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 -252
- package/es/utils/index.js +0 -671
- 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 -486
- 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 -468
- package/lib/hooks/useDtl/index.d.ts +0 -48
- package/lib/hooks/useDtl/index.js +0 -957
- 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 -315
- package/lib/index.d.ts +0 -31
- 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 -252
- package/lib/utils/index.js +0 -767
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { InputProps } from 'antd';
|
|
3
|
-
import type { ProFormItemProps } from 'ls-pro-form';
|
|
4
|
-
import { TooltipPlacement } from 'antd/lib/tooltip';
|
|
5
|
-
export declare type InputTableProps = ProFormItemProps<InputProps> & {
|
|
6
|
-
/**@name 弹框选择表格列配置 */
|
|
7
|
-
columns: any[];
|
|
8
|
-
/**@name 调用后端API地址 */
|
|
9
|
-
url: string;
|
|
10
|
-
/**@name 弹框表格高度,默认400 */
|
|
11
|
-
tableHeight?: number;
|
|
12
|
-
/**@name 弹框表格宽度,默认650*/
|
|
13
|
-
tableWidth?: number;
|
|
14
|
-
/**@name 是否支持多选 */
|
|
15
|
-
multiple?: boolean;
|
|
16
|
-
/**@name 表单项name, 跟 form.item 的 name一致 */
|
|
17
|
-
name: string;
|
|
18
|
-
/**@name 返回的值字段,表格中valueField配置的字段时返回给name */
|
|
19
|
-
valueField: string;
|
|
20
|
-
/**@name 返回输入框显示的字段,textField字段值返回给textName */
|
|
21
|
-
textField?: string;
|
|
22
|
-
/**@name 用于接收textField返回的值 */
|
|
23
|
-
textName?: string;
|
|
24
|
-
/** @name 表格的其它配置 */
|
|
25
|
-
tableConfig?: any;
|
|
26
|
-
/**@name 表单label宽度,默认70 */
|
|
27
|
-
labelWidth?: number;
|
|
28
|
-
/**@name 是否2.0接口 */
|
|
29
|
-
isV2?: boolean;
|
|
30
|
-
/**@name 是否支持跨页选择 */
|
|
31
|
-
keepSelect?: boolean;
|
|
32
|
-
/**@name 回车事件查询关键字 */
|
|
33
|
-
searchField?: string;
|
|
34
|
-
/**@name 填充其它表单项目配置 */
|
|
35
|
-
fillMap?: Record<string, string>;
|
|
36
|
-
/**@name 输入后检查数据的触发方式,默认为entry回车触发 */
|
|
37
|
-
triggerCheck?: 'entry' | 'blur';
|
|
38
|
-
/**@name 每次展示面板时都加载数据,接合 tableConfig里的 manualRequest 一起使用 */
|
|
39
|
-
loadOnShow?: boolean;
|
|
40
|
-
placement?: TooltipPlacement;
|
|
41
|
-
arrowPointAtCenter?: boolean;
|
|
42
|
-
rowKey?: any;
|
|
43
|
-
/**@name 选择行事件 */
|
|
44
|
-
onSelectChange?: (item: any, formRef?: any) => void;
|
|
45
|
-
/**@name 加载之前事件,param为查询条件对象,可以通过此方法调整 */
|
|
46
|
-
beforeLoad?: (param: any) => void;
|
|
47
|
-
/**@name 加载之后事件,row为接口返回数据,可以通过此方法调整 */
|
|
48
|
-
afterLoad?: (rows: any[]) => void;
|
|
49
|
-
getPopupContainer?: (triggerNode: any) => HTMLElement;
|
|
50
|
-
};
|
|
51
|
-
declare const InputTable: React.ForwardRefExoticComponent<{
|
|
52
|
-
fieldProps?: (import("../../../form/lib/interface").FieldProps & InputProps) | undefined;
|
|
53
|
-
placeholder?: string | string[] | undefined;
|
|
54
|
-
secondary?: boolean | undefined;
|
|
55
|
-
allowClear?: boolean | undefined;
|
|
56
|
-
disabled?: boolean | undefined;
|
|
57
|
-
width?: number | "sm" | "md" | "xl" | "xs" | "lg" | undefined;
|
|
58
|
-
proFieldProps?: import("../../../utils/lib").ProFieldProps | undefined;
|
|
59
|
-
footerRender?: import("../../../form/lib").LightFilterFooterRender | undefined;
|
|
60
|
-
} & Omit<import("../../../form/lib/components/FormItem").ProFormItemProps, "valueType"> & import("../../../form/lib/interface").ExtendsProps & {
|
|
61
|
-
/**@name 弹框选择表格列配置 */
|
|
62
|
-
columns: any[];
|
|
63
|
-
/**@name 调用后端API地址 */
|
|
64
|
-
url: string;
|
|
65
|
-
/**@name 弹框表格高度,默认400 */
|
|
66
|
-
tableHeight?: number | undefined;
|
|
67
|
-
/**@name 弹框表格宽度,默认650*/
|
|
68
|
-
tableWidth?: number | undefined;
|
|
69
|
-
/**@name 是否支持多选 */
|
|
70
|
-
multiple?: boolean | undefined;
|
|
71
|
-
/**@name 表单项name, 跟 form.item 的 name一致 */
|
|
72
|
-
name: string;
|
|
73
|
-
/**@name 返回的值字段,表格中valueField配置的字段时返回给name */
|
|
74
|
-
valueField: string;
|
|
75
|
-
/**@name 返回输入框显示的字段,textField字段值返回给textName */
|
|
76
|
-
textField?: string | undefined;
|
|
77
|
-
/**@name 用于接收textField返回的值 */
|
|
78
|
-
textName?: string | undefined;
|
|
79
|
-
/** @name 表格的其它配置 */
|
|
80
|
-
tableConfig?: any;
|
|
81
|
-
/**@name 表单label宽度,默认70 */
|
|
82
|
-
labelWidth?: number | undefined;
|
|
83
|
-
/**@name 是否2.0接口 */
|
|
84
|
-
isV2?: boolean | undefined;
|
|
85
|
-
/**@name 是否支持跨页选择 */
|
|
86
|
-
keepSelect?: boolean | undefined;
|
|
87
|
-
/**@name 回车事件查询关键字 */
|
|
88
|
-
searchField?: string | undefined;
|
|
89
|
-
/**@name 填充其它表单项目配置 */
|
|
90
|
-
fillMap?: Record<string, string> | undefined;
|
|
91
|
-
/**@name 输入后检查数据的触发方式,默认为entry回车触发 */
|
|
92
|
-
triggerCheck?: "entry" | "blur" | undefined;
|
|
93
|
-
/**@name 每次展示面板时都加载数据,接合 tableConfig里的 manualRequest 一起使用 */
|
|
94
|
-
loadOnShow?: boolean | undefined;
|
|
95
|
-
placement?: TooltipPlacement | undefined;
|
|
96
|
-
arrowPointAtCenter?: boolean | undefined;
|
|
97
|
-
rowKey?: any;
|
|
98
|
-
/**@name 选择行事件 */
|
|
99
|
-
onSelectChange?: ((item: any, formRef?: any) => void) | undefined;
|
|
100
|
-
/**@name 加载之前事件,param为查询条件对象,可以通过此方法调整 */
|
|
101
|
-
beforeLoad?: ((param: any) => void) | undefined;
|
|
102
|
-
/**@name 加载之后事件,row为接口返回数据,可以通过此方法调整 */
|
|
103
|
-
afterLoad?: ((rows: any[]) => void) | undefined;
|
|
104
|
-
getPopupContainer?: ((triggerNode: any) => HTMLElement) | undefined;
|
|
105
|
-
} & React.RefAttributes<unknown>>;
|
|
106
|
-
export default InputTable;
|
|
@@ -1,486 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
-
require("antd/es/input/style");
|
|
11
|
-
var _input = _interopRequireDefault(require("antd/es/input"));
|
|
12
|
-
require("antd/es/popover/style");
|
|
13
|
-
var _popover = _interopRequireDefault(require("antd/es/popover"));
|
|
14
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
-
require("antd/es/button/style");
|
|
16
|
-
var _button = _interopRequireDefault(require("antd/es/button"));
|
|
17
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
18
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
20
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
21
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
22
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
-
var _lsProTable = _interopRequireDefault(require("ls-pro-table"));
|
|
24
|
-
var _lsProForm = require("ls-pro-form");
|
|
25
|
-
var _icons = require("@ant-design/icons");
|
|
26
|
-
var _http = require("../http");
|
|
27
|
-
var _utils = require("../utils");
|
|
28
|
-
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "rowKey"],
|
|
29
|
-
_excluded2 = ["current", "pageSize"];
|
|
30
|
-
var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
|
|
31
|
-
//@ts-ignore
|
|
32
|
-
var _useContext = (0, _react.useContext)(_lsProForm.ProFormContext),
|
|
33
|
-
formRef = _useContext.formRef;
|
|
34
|
-
var tableRef = (0, _react.useRef)();
|
|
35
|
-
var _useState = (0, _react.useState)(false),
|
|
36
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
|
-
visible = _useState2[0],
|
|
38
|
-
setVisible = _useState2[1];
|
|
39
|
-
var _useState3 = (0, _react.useState)([]),
|
|
40
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
41
|
-
selectedRows = _useState4[0],
|
|
42
|
-
setSelectedRows = _useState4[1];
|
|
43
|
-
var _useState5 = (0, _react.useState)(''),
|
|
44
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
45
|
-
text = _useState6[0],
|
|
46
|
-
setText = _useState6[1];
|
|
47
|
-
var inputRef = (0, _react.useRef)();
|
|
48
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
|
49
|
-
return inputRef.current;
|
|
50
|
-
});
|
|
51
|
-
var columns = prop.columns,
|
|
52
|
-
url = prop.url,
|
|
53
|
-
textName = prop.textName,
|
|
54
|
-
name = prop.name,
|
|
55
|
-
tableConfig = prop.tableConfig,
|
|
56
|
-
_prop$tableHeight = prop.tableHeight,
|
|
57
|
-
tableHeight = _prop$tableHeight === void 0 ? 400 : _prop$tableHeight,
|
|
58
|
-
_prop$tableWidth = prop.tableWidth,
|
|
59
|
-
tableWidth = _prop$tableWidth === void 0 ? 650 : _prop$tableWidth,
|
|
60
|
-
_prop$readonly = prop.readonly,
|
|
61
|
-
readonly = _prop$readonly === void 0 ? true : _prop$readonly,
|
|
62
|
-
multiple = prop.multiple,
|
|
63
|
-
valueField = prop.valueField,
|
|
64
|
-
_prop$labelWidth = prop.labelWidth,
|
|
65
|
-
labelWidth = _prop$labelWidth === void 0 ? 70 : _prop$labelWidth,
|
|
66
|
-
textField = prop.textField,
|
|
67
|
-
onSelectChange = prop.onSelectChange,
|
|
68
|
-
beforeLoad = prop.beforeLoad,
|
|
69
|
-
afterLoad = prop.afterLoad,
|
|
70
|
-
_prop$isV = prop.isV2,
|
|
71
|
-
isV2 = _prop$isV === void 0 ? false : _prop$isV,
|
|
72
|
-
_prop$allowClear = prop.allowClear,
|
|
73
|
-
allowClear = _prop$allowClear === void 0 ? true : _prop$allowClear,
|
|
74
|
-
_prop$keepSelect = prop.keepSelect,
|
|
75
|
-
keepSelect = _prop$keepSelect === void 0 ? false : _prop$keepSelect,
|
|
76
|
-
fieldProps = prop.fieldProps,
|
|
77
|
-
searchField = prop.searchField,
|
|
78
|
-
fillMap = prop.fillMap,
|
|
79
|
-
_prop$loadOnShow = prop.loadOnShow,
|
|
80
|
-
loadOnShow = _prop$loadOnShow === void 0 ? false : _prop$loadOnShow,
|
|
81
|
-
_prop$triggerCheck = prop.triggerCheck,
|
|
82
|
-
triggerCheck = _prop$triggerCheck === void 0 ? 'entry' : _prop$triggerCheck,
|
|
83
|
-
_prop$getPopupContain = prop.getPopupContainer,
|
|
84
|
-
getPopupContainer = _prop$getPopupContain === void 0 ? function (triggerNode) {
|
|
85
|
-
return triggerNode.parentNode.parentNode.parentNode.parentNode;
|
|
86
|
-
} : _prop$getPopupContain,
|
|
87
|
-
_prop$placement = prop.placement,
|
|
88
|
-
placement = _prop$placement === void 0 ? 'bottom' : _prop$placement,
|
|
89
|
-
_prop$arrowPointAtCen = prop.arrowPointAtCenter,
|
|
90
|
-
arrowPointAtCenter = _prop$arrowPointAtCen === void 0 ? true : _prop$arrowPointAtCen,
|
|
91
|
-
rowKey = prop.rowKey,
|
|
92
|
-
rest = (0, _objectWithoutProperties2.default)(prop, _excluded);
|
|
93
|
-
//显示输入框绑定的name,如果不设置textName,设置为$name__text
|
|
94
|
-
var textNameProp = (0, _react.useMemo)(function () {
|
|
95
|
-
return textName || name + '__text';
|
|
96
|
-
}, [textName, name]);
|
|
97
|
-
// 输入框回车时,调用查询参数字段
|
|
98
|
-
var searchKey = (0, _react.useMemo)(function () {
|
|
99
|
-
if (searchField) return searchField;
|
|
100
|
-
var col;
|
|
101
|
-
//先取显示字段
|
|
102
|
-
if (textField) {
|
|
103
|
-
col = columns.find(function (o) {
|
|
104
|
-
return o.dataIndex === textField || o.key === textField;
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
//取不到时取值字段
|
|
108
|
-
if (!col) {
|
|
109
|
-
col = columns.find(function (o) {
|
|
110
|
-
return o.dataIndex === valueField || o.key === valueField;
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
if (col) return col.searchField || col.dataIndex;
|
|
114
|
-
return textField || valueField;
|
|
115
|
-
}, [columns, searchField, valueField, textField]);
|
|
116
|
-
var loadData = /*#__PURE__*/function () {
|
|
117
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(param) {
|
|
118
|
-
var current, pageSize, rest, data, _tableRef$current, _tableRef$current$cle, result, rows;
|
|
119
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
120
|
-
while (1) switch (_context.prev = _context.next) {
|
|
121
|
-
case 0:
|
|
122
|
-
current = param.current, pageSize = param.pageSize, rest = (0, _objectWithoutProperties2.default)(param, _excluded2);
|
|
123
|
-
data = {};
|
|
124
|
-
if (isV2) {
|
|
125
|
-
data['page.pn'] = current;
|
|
126
|
-
data['page.size'] = pageSize;
|
|
127
|
-
} else {
|
|
128
|
-
data.page = current;
|
|
129
|
-
data.pageSize = pageSize;
|
|
130
|
-
}
|
|
131
|
-
;
|
|
132
|
-
if (Object.keys(rest).length && !isV2) {
|
|
133
|
-
data.where = rest;
|
|
134
|
-
}
|
|
135
|
-
if (!keepSelect) {
|
|
136
|
-
setSelectedRows([]);
|
|
137
|
-
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$cle = _tableRef$current.clearSelected) === null || _tableRef$current$cle === void 0 ? void 0 : _tableRef$current$cle.call(_tableRef$current);
|
|
138
|
-
}
|
|
139
|
-
if (beforeLoad) {
|
|
140
|
-
beforeLoad(data);
|
|
141
|
-
}
|
|
142
|
-
;
|
|
143
|
-
_context.next = 10;
|
|
144
|
-
return (0, _http.httpGet)(url, data);
|
|
145
|
-
case 10:
|
|
146
|
-
result = _context.sent;
|
|
147
|
-
rows = result.rows || [];
|
|
148
|
-
if (afterLoad) {
|
|
149
|
-
afterLoad(rows);
|
|
150
|
-
}
|
|
151
|
-
return _context.abrupt("return", {
|
|
152
|
-
data: rows,
|
|
153
|
-
total: Number(result.total || 0),
|
|
154
|
-
success: true
|
|
155
|
-
});
|
|
156
|
-
case 14:
|
|
157
|
-
case "end":
|
|
158
|
-
return _context.stop();
|
|
159
|
-
}
|
|
160
|
-
}, _callee);
|
|
161
|
-
}));
|
|
162
|
-
return function loadData(_x) {
|
|
163
|
-
return _ref.apply(this, arguments);
|
|
164
|
-
};
|
|
165
|
-
}();
|
|
166
|
-
// 初始化数据
|
|
167
|
-
(0, _react.useEffect)(function () {
|
|
168
|
-
setTimeout(function () {
|
|
169
|
-
var txt = '',
|
|
170
|
-
val = '';
|
|
171
|
-
if (rowKey) {
|
|
172
|
-
try {
|
|
173
|
-
var _formRef$current, _formRef$current$getF, _formRef$current$getF2;
|
|
174
|
-
var row = formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldsValue) === null || _formRef$current$getF === void 0 ? void 0 : (_formRef$current$getF2 = _formRef$current$getF.call(_formRef$current)) === null || _formRef$current$getF2 === void 0 ? void 0 : _formRef$current$getF2[rowKey];
|
|
175
|
-
txt = row === null || row === void 0 ? void 0 : row[textNameProp];
|
|
176
|
-
val = row === null || row === void 0 ? void 0 : row[name];
|
|
177
|
-
} catch (_unused) {}
|
|
178
|
-
} else {
|
|
179
|
-
var _formRef$current2, _formRef$current2$get, _formRef$current3, _formRef$current3$get;
|
|
180
|
-
txt = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$get = _formRef$current2.getFieldValue) === null || _formRef$current2$get === void 0 ? void 0 : _formRef$current2$get.call(_formRef$current2, textNameProp);
|
|
181
|
-
val = formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : (_formRef$current3$get = _formRef$current3.getFieldValue) === null || _formRef$current3$get === void 0 ? void 0 : _formRef$current3$get.call(_formRef$current3, name);
|
|
182
|
-
}
|
|
183
|
-
if (txt) {
|
|
184
|
-
setText(txt);
|
|
185
|
-
} else if (val) {
|
|
186
|
-
setText(val);
|
|
187
|
-
}
|
|
188
|
-
}, 0);
|
|
189
|
-
}, [rowKey]);
|
|
190
|
-
// 处理返回数据
|
|
191
|
-
var handleValue = function handleValue(row) {
|
|
192
|
-
var _formRef$current4, _formRef$current4$get;
|
|
193
|
-
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : (_formRef$current4$get = _formRef$current4.getFieldsValue) === null || _formRef$current4$get === void 0 ? void 0 : _formRef$current4$get.call(_formRef$current4)) || {};
|
|
194
|
-
if (rowKey) {
|
|
195
|
-
formValue = formValue[rowKey] || {};
|
|
196
|
-
}
|
|
197
|
-
if (!formValue) return;
|
|
198
|
-
var txt;
|
|
199
|
-
//支持多选
|
|
200
|
-
if (Array.isArray(row)) {
|
|
201
|
-
//返回值
|
|
202
|
-
formValue[name] = row.map(function (o) {
|
|
203
|
-
return o[valueField];
|
|
204
|
-
}).join(',');
|
|
205
|
-
//显示值
|
|
206
|
-
txt = row.map(function (o) {
|
|
207
|
-
return o[textField || valueField];
|
|
208
|
-
}).join(',');
|
|
209
|
-
//处理填充其它字段
|
|
210
|
-
if (fillMap) {
|
|
211
|
-
var _loop = function _loop(key) {
|
|
212
|
-
formValue[key] = row.map(function (o) {
|
|
213
|
-
return o[fillMap[key]];
|
|
214
|
-
}).join(',');
|
|
215
|
-
};
|
|
216
|
-
for (var key in fillMap) {
|
|
217
|
-
_loop(key);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
} else {
|
|
221
|
-
formValue[name] = row[valueField] || '';
|
|
222
|
-
txt = row[textField || valueField] || '';
|
|
223
|
-
if (fillMap) {
|
|
224
|
-
for (var _key in fillMap) {
|
|
225
|
-
formValue[_key] = row[fillMap[_key]] || '';
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
formValue[textNameProp] = txt;
|
|
230
|
-
setText(txt);
|
|
231
|
-
setVisible(false);
|
|
232
|
-
if (rowKey) {
|
|
233
|
-
var _formRef$current5, _formRef$current5$set;
|
|
234
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : (_formRef$current5$set = _formRef$current5.setFieldsValue) === null || _formRef$current5$set === void 0 ? void 0 : _formRef$current5$set.call(_formRef$current5, (0, _defineProperty2.default)({}, rowKey, formValue));
|
|
235
|
-
} else {
|
|
236
|
-
var _formRef$current6, _formRef$current6$set;
|
|
237
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : (_formRef$current6$set = _formRef$current6.setFieldsValue) === null || _formRef$current6$set === void 0 ? void 0 : _formRef$current6$set.call(_formRef$current6, (0, _objectSpread2.default)({}, formValue));
|
|
238
|
-
}
|
|
239
|
-
onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(row, formRef);
|
|
240
|
-
};
|
|
241
|
-
// 可输入时,回车或失去焦点调接口查询数据
|
|
242
|
-
var onQuery = function onQuery(e) {
|
|
243
|
-
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) || readonly) return;
|
|
244
|
-
var val = e.target.value;
|
|
245
|
-
if (val) {
|
|
246
|
-
var param = {
|
|
247
|
-
current: 1,
|
|
248
|
-
pageSize: 10
|
|
249
|
-
};
|
|
250
|
-
param[searchKey] = val;
|
|
251
|
-
loadData(param).then(function (result) {
|
|
252
|
-
var rows = result.data || [];
|
|
253
|
-
if (!rows.length) {
|
|
254
|
-
handleValue({});
|
|
255
|
-
(0, _utils.showWarn)("".concat(val, "\u67E5\u627E\u4E0D\u5230\u5BF9\u5E94\u7684\u8BB0\u5F55\uFF01"));
|
|
256
|
-
} else if (multiple) {
|
|
257
|
-
handleValue(rows);
|
|
258
|
-
} else {
|
|
259
|
-
handleValue(rows[0]);
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
e.stopPropagation();
|
|
263
|
-
e.preventDefault();
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
//直接输入不回车,value 和 text 为同一个值
|
|
267
|
-
var onInput = function onInput(e) {
|
|
268
|
-
var _formRef$current7, _formRef$current7$get;
|
|
269
|
-
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current7 = formRef.current) === null || _formRef$current7 === void 0 ? void 0 : (_formRef$current7$get = _formRef$current7.getFieldsValue) === null || _formRef$current7$get === void 0 ? void 0 : _formRef$current7$get.call(_formRef$current7)) || {};
|
|
270
|
-
if (rowKey) {
|
|
271
|
-
formValue = formValue[rowKey] || {};
|
|
272
|
-
}
|
|
273
|
-
var val = e.target.value;
|
|
274
|
-
formValue[name] = val;
|
|
275
|
-
formValue[textNameProp] = val;
|
|
276
|
-
setText(val);
|
|
277
|
-
if (rowKey) {
|
|
278
|
-
var _formRef$current8, _formRef$current8$set;
|
|
279
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current8 = formRef.current) === null || _formRef$current8 === void 0 ? void 0 : (_formRef$current8$set = _formRef$current8.setFieldsValue) === null || _formRef$current8$set === void 0 ? void 0 : _formRef$current8$set.call(_formRef$current8, (0, _defineProperty2.default)({}, rowKey, formValue));
|
|
280
|
-
} else {
|
|
281
|
-
var _formRef$current9, _formRef$current9$set;
|
|
282
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current9 = formRef.current) === null || _formRef$current9 === void 0 ? void 0 : (_formRef$current9$set = _formRef$current9.setFieldsValue) === null || _formRef$current9$set === void 0 ? void 0 : _formRef$current9$set.call(_formRef$current9, (0, _objectSpread2.default)({}, formValue));
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
// 当表单重置或点clear时,处理值
|
|
286
|
-
var clearValue = function clearValue(e) {
|
|
287
|
-
if (!e.target.value) {
|
|
288
|
-
var _formRef$current10, _formRef$current10$ge;
|
|
289
|
-
setText('');
|
|
290
|
-
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current10 = formRef.current) === null || _formRef$current10 === void 0 ? void 0 : (_formRef$current10$ge = _formRef$current10.getFieldsValue) === null || _formRef$current10$ge === void 0 ? void 0 : _formRef$current10$ge.call(_formRef$current10)) || {};
|
|
291
|
-
if (rowKey) {
|
|
292
|
-
formValue = formValue[rowKey] || {};
|
|
293
|
-
}
|
|
294
|
-
formValue[name] = '';
|
|
295
|
-
formValue[textNameProp] = '';
|
|
296
|
-
if (rowKey) {
|
|
297
|
-
var _formRef$current11, _formRef$current11$se;
|
|
298
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current11 = formRef.current) === null || _formRef$current11 === void 0 ? void 0 : (_formRef$current11$se = _formRef$current11.setFieldsValue) === null || _formRef$current11$se === void 0 ? void 0 : _formRef$current11$se.call(_formRef$current11, (0, _defineProperty2.default)({}, rowKey, formValue));
|
|
299
|
-
} else {
|
|
300
|
-
var _formRef$current12, _formRef$current12$se;
|
|
301
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current12 = formRef.current) === null || _formRef$current12 === void 0 ? void 0 : (_formRef$current12$se = _formRef$current12.setFieldsValue) === null || _formRef$current12$se === void 0 ? void 0 : _formRef$current12$se.call(_formRef$current12, (0, _objectSpread2.default)({}, formValue));
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
(0, _react.useEffect)(function () {
|
|
306
|
-
if (!text) {
|
|
307
|
-
var _tableRef$current2, _tableRef$current2$cl;
|
|
308
|
-
setSelectedRows([]);
|
|
309
|
-
(_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$cl = _tableRef$current2.clearSelected) === null || _tableRef$current2$cl === void 0 ? void 0 : _tableRef$current2$cl.call(_tableRef$current2);
|
|
310
|
-
}
|
|
311
|
-
}, [text]);
|
|
312
|
-
var tableDom = /*#__PURE__*/_react.default.createElement(_lsProTable.default, (0, _extends2.default)({
|
|
313
|
-
className: "ls-input-table",
|
|
314
|
-
columns: columns,
|
|
315
|
-
request: loadData,
|
|
316
|
-
manualRequest: false,
|
|
317
|
-
actionRef: tableRef,
|
|
318
|
-
search: {
|
|
319
|
-
labelWidth: labelWidth,
|
|
320
|
-
optionRender: function optionRender(p, s, _dom) {
|
|
321
|
-
return _dom.filter(function (item) {
|
|
322
|
-
return item.key === 'submit';
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
options: {
|
|
327
|
-
density: false,
|
|
328
|
-
reload: false,
|
|
329
|
-
setting: false
|
|
330
|
-
},
|
|
331
|
-
form: {
|
|
332
|
-
submitter: {
|
|
333
|
-
resetButtonProps: false
|
|
334
|
-
},
|
|
335
|
-
btnInline: true
|
|
336
|
-
},
|
|
337
|
-
height: 'full',
|
|
338
|
-
rowSelection: {
|
|
339
|
-
type: multiple ? 'checkbox' : 'radio',
|
|
340
|
-
onChange: function onChange(keys, rows) {
|
|
341
|
-
setSelectedRows(rows);
|
|
342
|
-
}
|
|
343
|
-
},
|
|
344
|
-
tableAlertRender: false,
|
|
345
|
-
onRow: function onRow(record) {
|
|
346
|
-
return {
|
|
347
|
-
onDoubleClick: function onDoubleClick() {
|
|
348
|
-
handleValue(record);
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
},
|
|
352
|
-
toolBarRender: function toolBarRender() {
|
|
353
|
-
return [/*#__PURE__*/_react.default.createElement(_button.default, {
|
|
354
|
-
onClick: function onClick() {
|
|
355
|
-
handleValue(selectedRows);
|
|
356
|
-
}
|
|
357
|
-
}, "\u786E\u8BA4")];
|
|
358
|
-
},
|
|
359
|
-
headerTitle: "\u53CC\u51FB\u9009\u4E2D\u5F53\u524D\u884C\u6570\u636E"
|
|
360
|
-
}, tableConfig, {
|
|
361
|
-
cardProps: {
|
|
362
|
-
bodyStyle: {
|
|
363
|
-
padding: 0
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}));
|
|
367
|
-
// 处理有值时,可清空
|
|
368
|
-
(0, _react.useEffect)(function () {
|
|
369
|
-
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
370
|
-
try {
|
|
371
|
-
var el = inputRef.current.input.parentNode;
|
|
372
|
-
if (!el) return;
|
|
373
|
-
if (text) {
|
|
374
|
-
el.classList.add('ant-input-has-value');
|
|
375
|
-
} else {
|
|
376
|
-
el.classList.remove('ant-input-has-value');
|
|
377
|
-
}
|
|
378
|
-
} catch (e) {}
|
|
379
|
-
}, [text, rest, fieldProps]);
|
|
380
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
381
|
-
style: {
|
|
382
|
-
display: 'none'
|
|
383
|
-
}
|
|
384
|
-
}, /*#__PURE__*/_react.default.createElement(_lsProForm.ProFormText, {
|
|
385
|
-
name: name
|
|
386
|
-
})), rest.label ? /*#__PURE__*/_react.default.createElement(_lsProForm.ProFormText, (0, _extends2.default)({
|
|
387
|
-
name: textNameProp
|
|
388
|
-
}, rest), /*#__PURE__*/_react.default.createElement(_input.default, (0, _extends2.default)({
|
|
389
|
-
suffix: /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
390
|
-
content: /*#__PURE__*/_react.default.createElement("div", {
|
|
391
|
-
style: {
|
|
392
|
-
width: tableWidth + 'px',
|
|
393
|
-
height: tableHeight + 'px',
|
|
394
|
-
maxHeight: '95vh',
|
|
395
|
-
overflow: 'auto'
|
|
396
|
-
}
|
|
397
|
-
}, loadOnShow ? visible ? tableDom : null : tableDom),
|
|
398
|
-
trigger: "click",
|
|
399
|
-
overlayInnerStyle: {
|
|
400
|
-
width: 'max-content'
|
|
401
|
-
},
|
|
402
|
-
overlayStyle: {
|
|
403
|
-
width: 'max-content'
|
|
404
|
-
},
|
|
405
|
-
visible: rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) ? false : visible,
|
|
406
|
-
onVisibleChange: setVisible,
|
|
407
|
-
getPopupContainer: getPopupContainer,
|
|
408
|
-
placement: placement,
|
|
409
|
-
arrowPointAtCenter: arrowPointAtCenter
|
|
410
|
-
}, /*#__PURE__*/_react.default.createElement(_icons.MoreOutlined, {
|
|
411
|
-
onClick: function onClick(e) {
|
|
412
|
-
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
413
|
-
setVisible(true);
|
|
414
|
-
}
|
|
415
|
-
})),
|
|
416
|
-
onClick: function onClick() {
|
|
417
|
-
if (!readonly) return;
|
|
418
|
-
setVisible(true);
|
|
419
|
-
},
|
|
420
|
-
onInput: onInput,
|
|
421
|
-
onChange: clearValue,
|
|
422
|
-
onPressEnter: function onPressEnter(e) {
|
|
423
|
-
if (triggerCheck === 'entry') {
|
|
424
|
-
onQuery(e);
|
|
425
|
-
}
|
|
426
|
-
},
|
|
427
|
-
onBlur: function onBlur(e) {
|
|
428
|
-
if (triggerCheck === 'blur') {
|
|
429
|
-
onQuery(e);
|
|
430
|
-
}
|
|
431
|
-
},
|
|
432
|
-
readOnly: readonly,
|
|
433
|
-
allowClear: allowClear,
|
|
434
|
-
ref: inputRef
|
|
435
|
-
}, fieldProps))) : /*#__PURE__*/_react.default.createElement(_input.default, (0, _extends2.default)({
|
|
436
|
-
suffix: /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
437
|
-
content: /*#__PURE__*/_react.default.createElement("div", {
|
|
438
|
-
style: {
|
|
439
|
-
width: tableWidth + 'px',
|
|
440
|
-
height: tableHeight + 'px',
|
|
441
|
-
maxHeight: '95vh',
|
|
442
|
-
overflow: 'auto'
|
|
443
|
-
}
|
|
444
|
-
}, loadOnShow ? visible ? tableDom : null : tableDom),
|
|
445
|
-
trigger: "click",
|
|
446
|
-
overlayInnerStyle: {
|
|
447
|
-
width: 'max-content'
|
|
448
|
-
},
|
|
449
|
-
overlayStyle: {
|
|
450
|
-
width: 'max-content'
|
|
451
|
-
},
|
|
452
|
-
visible: rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) ? false : visible,
|
|
453
|
-
onVisibleChange: setVisible,
|
|
454
|
-
getPopupContainer: getPopupContainer,
|
|
455
|
-
placement: placement,
|
|
456
|
-
arrowPointAtCenter: arrowPointAtCenter
|
|
457
|
-
}, /*#__PURE__*/_react.default.createElement(_icons.MoreOutlined, {
|
|
458
|
-
onClick: function onClick(e) {
|
|
459
|
-
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
460
|
-
setVisible(true);
|
|
461
|
-
}
|
|
462
|
-
})),
|
|
463
|
-
onClick: function onClick() {
|
|
464
|
-
if (!readonly) return;
|
|
465
|
-
setVisible(true);
|
|
466
|
-
},
|
|
467
|
-
onInput: onInput,
|
|
468
|
-
onPressEnter: function onPressEnter(e) {
|
|
469
|
-
if (triggerCheck === 'entry') {
|
|
470
|
-
onQuery(e);
|
|
471
|
-
}
|
|
472
|
-
},
|
|
473
|
-
onBlur: function onBlur(e) {
|
|
474
|
-
if (triggerCheck === 'blur') {
|
|
475
|
-
onQuery(e);
|
|
476
|
-
}
|
|
477
|
-
},
|
|
478
|
-
onChange: clearValue,
|
|
479
|
-
readOnly: readonly,
|
|
480
|
-
value: text,
|
|
481
|
-
allowClear: allowClear,
|
|
482
|
-
ref: inputRef
|
|
483
|
-
}, fieldProps)));
|
|
484
|
-
});
|
|
485
|
-
var _default = InputTable;
|
|
486
|
-
exports.default = _default;
|
|
@@ -1,28 +0,0 @@
|
|
|
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 = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
require("antd/es/spin/style");
|
|
10
|
-
var _spin = _interopRequireDefault(require("antd/es/spin"));
|
|
11
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
-
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
require("./common.less");
|
|
14
|
-
var _excluded = ["Text", "className"];
|
|
15
|
-
var _default = function _default(props) {
|
|
16
|
-
var _props$Text = props.Text,
|
|
17
|
-
Text = _props$Text === void 0 ? '加载中...' : _props$Text,
|
|
18
|
-
className = props.className,
|
|
19
|
-
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
20
|
-
var cls = "loading";
|
|
21
|
-
if (className) {
|
|
22
|
-
cls += " " + className;
|
|
23
|
-
}
|
|
24
|
-
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
|
25
|
-
className: cls
|
|
26
|
-
}, rest), " ", /*#__PURE__*/_react.default.createElement(_spin.default, null), Text);
|
|
27
|
-
};
|
|
28
|
-
exports.default = _default;
|
|
@@ -1,21 +0,0 @@
|
|
|
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 = void 0;
|
|
8
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _usePermission2 = _interopRequireDefault(require("../hooks/usePermission"));
|
|
11
|
-
var _excluded = ["children", "rightValue"];
|
|
12
|
-
var Permission = function Permission(_ref) {
|
|
13
|
-
var children = _ref.children,
|
|
14
|
-
rightValue = _ref.rightValue,
|
|
15
|
-
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
16
|
-
var _usePermission = (0, _usePermission2.default)(),
|
|
17
|
-
checkRight = _usePermission.checkRight;
|
|
18
|
-
return checkRight(rightValue) ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, rest, children) : null;
|
|
19
|
-
};
|
|
20
|
-
var _default = Permission;
|
|
21
|
-
exports.default = _default;
|