@teamix/pro 1.1.37 → 1.2.0
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 +14 -10
- package/dist/pro.css +1 -1
- package/dist/pro.js +2486 -3754
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.d.ts +5 -5
- package/es/actions/dialog-form.js +1 -5
- package/es/actions/dialog.d.ts +12 -0
- package/es/actions/dialog.js +104 -27
- package/es/actions/index.d.ts +54 -47
- package/es/actions/index.js +28 -22
- package/es/actions/index.scss +48 -2
- package/es/actions/request.d.ts +1 -1
- package/es/actions/request.js +2 -2
- package/es/card/index.d.ts +17 -5
- package/es/card/index.js +16 -11
- package/es/form/Components/ProField/index.d.ts +1 -161
- package/es/form/Components/ProField/index.js +34 -40
- package/es/form/Filter/index.js +2 -2
- package/es/form/ProForm/index.d.ts +2 -2
- package/es/form/ProForm/index.js +1 -6
- package/es/form/ProForm/index.scss +19 -1
- package/es/form/ProForm/useFieldRequest.d.ts +5 -0
- package/es/form/ProForm/useFieldRequest.js +26 -0
- package/es/form/SchemaForm/adapterDecorator.js +2 -2
- package/es/form/SchemaForm/index.d.ts +2 -2
- package/es/form/SchemaForm/index.js +12 -21
- package/es/form/SchemaForm/initializeArrayCards.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayItems.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayTable.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeFormButton.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormStep.d.ts +3 -3
- package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.js +2 -2
- package/es/form/SchemaForm/initializeRules.js +44 -16
- package/es/form/SchemaForm/reactions.d.ts +5 -5
- package/es/form/SchemaForm/reactions.js +20 -18
- package/es/form/fieldTypeMap.d.ts +4 -0
- package/es/form/fieldTypeMap.js +41 -0
- package/es/form/index.d.ts +92 -4
- package/es/form/index.js +18 -5
- package/es/form/schemaNameMap.js +3 -0
- package/es/form/typing.d.ts +49 -26
- package/es/form/utils.d.ts +3 -1
- package/es/form/utils.js +38 -1
- package/es/form/warning.d.ts +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/InfoGroup/index.js +73 -15
- package/es/info/components/InfoGroup/index.scss +45 -3
- package/es/info/components/InfoValueItem/index.js +9 -4
- package/es/info/components/InfoValueItem/index.scss +5 -1
- package/es/info/components/ProInfoItem/index.js +3 -3
- package/es/info/components/ProInfoItem/index.scss +1 -0
- package/es/info/components/baseInfo/index.d.ts +2 -3
- package/es/info/components/baseInfo/index.js +29 -10
- package/es/info/components/headerInfo/index.d.ts +2 -3
- package/es/info/components/tableInfo/index.d.ts +2 -3
- package/es/info/components/tableInfo/index.js +2 -2
- package/es/info/index.js +75 -51
- package/es/info/typing.d.ts +54 -36
- package/es/info/utils/index.d.ts +2 -2
- package/es/info/utils/utils.d.ts +1 -1
- package/es/nocode/pages/renderer.js +2 -2
- package/es/page-header/index.d.ts +34 -21
- package/es/page-header/index.js +39 -30
- package/es/page-header/index.scss +2 -1
- package/es/table/components/EmptyContent/index.d.ts +2 -0
- package/es/table/components/EmptyContent/index.js +11 -0
- package/es/table/components/Filter/index.d.ts +2 -2
- package/es/table/components/Filter/index.js +23 -10
- package/es/table/components/Filter/index.scss +1 -1
- package/es/table/components/Layout/index.js +2 -2
- package/es/table/components/QuickAction/index.d.ts +2 -2
- package/es/table/components/QuickAction/index.js +3 -3
- package/es/table/components/ToolBar/Fullscreen.js +1 -0
- package/es/table/index.js +76 -14
- package/es/table/index.scss +4 -0
- package/es/table/typing.d.ts +29 -14
- package/es/table/utils/columnRender.d.ts +3 -3
- package/es/table/utils/columnRender.js +2 -2
- package/es/table/utils/genProColumnToColumn.d.ts +2 -2
- package/es/table/utils/genProColumnToColumn.js +1 -1
- package/es/table/utils/index.js +33 -11
- package/es/templates/List/index.d.ts +2 -2
- package/es/utils/message.d.ts +3 -0
- package/es/utils/message.js +19 -0
- package/lib/actions/dialog-form.d.ts +5 -5
- package/lib/actions/dialog-form.js +1 -5
- package/lib/actions/dialog.d.ts +12 -0
- package/lib/actions/dialog.js +108 -26
- package/lib/actions/index.d.ts +54 -47
- package/lib/actions/index.js +37 -30
- package/lib/actions/index.scss +48 -2
- package/lib/actions/request.d.ts +1 -1
- package/lib/actions/request.js +2 -2
- package/lib/card/index.d.ts +17 -5
- package/lib/card/index.js +18 -12
- package/lib/form/Components/ProField/index.d.ts +1 -161
- package/lib/form/Components/ProField/index.js +32 -38
- package/lib/form/Filter/index.js +2 -2
- package/lib/form/ProForm/index.d.ts +2 -2
- package/lib/form/ProForm/index.js +1 -7
- package/lib/form/ProForm/index.scss +19 -1
- package/lib/form/ProForm/useFieldRequest.d.ts +5 -0
- package/lib/form/ProForm/useFieldRequest.js +37 -0
- package/lib/form/SchemaForm/adapterDecorator.js +4 -2
- package/lib/form/SchemaForm/index.d.ts +2 -2
- package/lib/form/SchemaForm/index.js +11 -22
- package/lib/form/SchemaForm/initializeArrayCards.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayItems.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayTable.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeFormButton.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormStep.d.ts +3 -3
- package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.js +1 -1
- package/lib/form/SchemaForm/initializeRules.js +41 -13
- package/lib/form/SchemaForm/reactions.d.ts +5 -5
- package/lib/form/SchemaForm/reactions.js +22 -20
- package/lib/form/fieldTypeMap.d.ts +4 -0
- package/lib/form/fieldTypeMap.js +48 -0
- package/lib/form/index.d.ts +92 -4
- package/lib/form/index.js +17 -31
- package/lib/form/schemaNameMap.js +3 -0
- package/lib/form/typing.d.ts +49 -26
- package/lib/form/utils.d.ts +3 -1
- package/lib/form/utils.js +43 -1
- package/lib/form/warning.d.ts +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/InfoGroup/index.js +76 -14
- package/lib/info/components/InfoGroup/index.scss +45 -3
- package/lib/info/components/InfoValueItem/index.js +8 -3
- package/lib/info/components/InfoValueItem/index.scss +5 -1
- package/lib/info/components/ProInfoItem/index.js +2 -2
- package/lib/info/components/ProInfoItem/index.scss +1 -0
- package/lib/info/components/baseInfo/index.d.ts +2 -3
- package/lib/info/components/baseInfo/index.js +29 -10
- package/lib/info/components/headerInfo/index.d.ts +2 -3
- package/lib/info/components/tableInfo/index.d.ts +2 -3
- package/lib/info/components/tableInfo/index.js +1 -1
- package/lib/info/index.js +73 -49
- package/lib/info/typing.d.ts +54 -36
- package/lib/info/utils/index.d.ts +2 -2
- package/lib/info/utils/utils.d.ts +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/page-header/index.d.ts +34 -21
- package/lib/page-header/index.js +37 -28
- package/lib/page-header/index.scss +2 -1
- package/lib/table/components/EmptyContent/index.d.ts +2 -0
- package/lib/table/components/EmptyContent/index.js +25 -0
- package/lib/table/components/Filter/index.d.ts +2 -2
- package/lib/table/components/Filter/index.js +23 -10
- package/lib/table/components/Filter/index.scss +1 -1
- package/lib/table/components/Layout/index.js +1 -1
- package/lib/table/components/QuickAction/index.d.ts +2 -2
- package/lib/table/components/QuickAction/index.js +1 -1
- package/lib/table/components/ToolBar/Fullscreen.js +1 -0
- package/lib/table/index.js +77 -14
- package/lib/table/index.scss +4 -0
- package/lib/table/typing.d.ts +29 -14
- package/lib/table/utils/columnRender.d.ts +3 -3
- package/lib/table/utils/columnRender.js +1 -1
- package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
- package/lib/table/utils/genProColumnToColumn.js +2 -2
- package/lib/table/utils/index.js +33 -11
- package/lib/templates/List/index.d.ts +2 -2
- package/lib/utils/message.d.ts +3 -0
- package/lib/utils/message.js +32 -0
- package/package.json +4 -4
- package/es/form/Components/Search/index.d.ts +0 -11
- package/es/form/Components/Search/index.js +0 -89
- package/es/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
- package/es/form/SchemaForm/initializeArrayIcon.js +0 -62
- package/es/form/SchemaForm/initializeProField.d.ts +0 -5
- package/es/form/SchemaForm/initializeProField.js +0 -70
- package/es/info/utils/useInfoRequest.d.ts +0 -14
- package/es/info/utils/useInfoRequest.js +0 -76
- package/lib/form/Components/Search/index.d.ts +0 -11
- package/lib/form/Components/Search/index.js +0 -103
- package/lib/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
- package/lib/form/SchemaForm/initializeArrayIcon.js +0 -73
- package/lib/form/SchemaForm/initializeProField.d.ts +0 -5
- package/lib/form/SchemaForm/initializeProField.js +0 -77
- package/lib/info/utils/useInfoRequest.d.ts +0 -14
- package/lib/info/utils/useInfoRequest.js +0 -85
@@ -1,62 +0,0 @@
|
|
1
|
-
var _excluded = ["component", "props"],
|
2
|
-
_excluded2 = ["icon"],
|
3
|
-
_excluded3 = ["text", "type"];
|
4
|
-
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
6
|
-
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
8
|
-
|
9
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
10
|
-
|
11
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
12
|
-
|
13
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
14
|
-
|
15
|
-
import React from 'react';
|
16
|
-
import TeamixIcon from '@teamix/icon';
|
17
|
-
|
18
|
-
var initialize = function initialize(item) {
|
19
|
-
var component = item.component,
|
20
|
-
_item$props = item.props,
|
21
|
-
props = _item$props === void 0 ? {} : _item$props,
|
22
|
-
other = _objectWithoutProperties(item, _excluded);
|
23
|
-
|
24
|
-
var icon = props.icon,
|
25
|
-
otherProps = _objectWithoutProperties(props, _excluded2);
|
26
|
-
|
27
|
-
var iconType = '';
|
28
|
-
|
29
|
-
if (icon) {
|
30
|
-
iconType = icon;
|
31
|
-
} else if (component) {
|
32
|
-
if (/Addition/.test(component)) {
|
33
|
-
iconType = 'add-line';
|
34
|
-
} else if (/Remove/.test(component)) {
|
35
|
-
iconType = 'delete-line';
|
36
|
-
} else if (/MoveUp/.test(component)) {
|
37
|
-
iconType = 'up-line';
|
38
|
-
} else if (/MoveDown/.test(component)) {
|
39
|
-
iconType = 'down-line';
|
40
|
-
} else if (/SortHandle/.test(component)) {
|
41
|
-
iconType = 'menu-line';
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
return _objectSpread(_objectSpread({}, other), {}, {
|
46
|
-
component: component,
|
47
|
-
props: _objectSpread({
|
48
|
-
icon: function icon(_ref) {
|
49
|
-
var text = _ref.text,
|
50
|
-
type = _ref.type,
|
51
|
-
props = _objectWithoutProperties(_ref, _excluded3);
|
52
|
-
|
53
|
-
return /*#__PURE__*/React.createElement(TeamixIcon, _objectSpread(_objectSpread({}, props), {}, {
|
54
|
-
type: iconType,
|
55
|
-
size: "small"
|
56
|
-
}));
|
57
|
-
}
|
58
|
-
}, otherProps)
|
59
|
-
});
|
60
|
-
};
|
61
|
-
|
62
|
-
export default initialize;
|
@@ -1,70 +0,0 @@
|
|
1
|
-
var _excluded = ["component", "props"];
|
2
|
-
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
4
|
-
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
6
|
-
|
7
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
8
|
-
|
9
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
10
|
-
|
11
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
12
|
-
|
13
|
-
var proFieldTypeMap = {
|
14
|
-
Input: 'text',
|
15
|
-
Password: 'password',
|
16
|
-
TextArea: 'textArea',
|
17
|
-
NumberPicker: 'number',
|
18
|
-
Percent: 'percent',
|
19
|
-
Money: 'money',
|
20
|
-
Select: 'select',
|
21
|
-
MultipleSelect: 'multipleSelect',
|
22
|
-
TreeSelect: 'treeSelect',
|
23
|
-
Cascader: 'cascader',
|
24
|
-
MultipleCascader: 'multipleCascader',
|
25
|
-
ArbitraryCascader: 'arbitraryCascader',
|
26
|
-
Radio: 'radio',
|
27
|
-
Checkbox: 'checkbox',
|
28
|
-
Switch: 'switch',
|
29
|
-
DatePicker: 'date',
|
30
|
-
TimePicker: 'time',
|
31
|
-
DateTimePicker: 'dateTime',
|
32
|
-
WeekPicker: 'dateWeek',
|
33
|
-
MonthPicker: 'dateMonth',
|
34
|
-
YearPicker: 'dateYear',
|
35
|
-
QuarterPicker: 'dateQuarter',
|
36
|
-
DateRangePicker: 'dateRange',
|
37
|
-
TimeRangePicker: 'timeRange',
|
38
|
-
DateTimeRangePicker: 'dateTimeRange',
|
39
|
-
WeekRangePicker: 'dateWeekRange',
|
40
|
-
MonthRangePicker: 'dateMonthRange',
|
41
|
-
YearRangePicker: 'dateYearRange',
|
42
|
-
QuarterRangePicker: 'dateQuarterRange',
|
43
|
-
Transfer: 'transfer',
|
44
|
-
ColorPicker: 'color',
|
45
|
-
ColorRadio: 'colorRadio',
|
46
|
-
IconPicker: 'icon',
|
47
|
-
JsonInput: 'json',
|
48
|
-
TagPicker: 'tagPicker',
|
49
|
-
MultipleTagPicker: 'multipleTagPicker',
|
50
|
-
Range: 'range',
|
51
|
-
Search: 'search' // Upload: 'upload',
|
52
|
-
|
53
|
-
};
|
54
|
-
|
55
|
-
var initialize = function initialize(item) {
|
56
|
-
var component = item.component,
|
57
|
-
_item$props = item.props,
|
58
|
-
props = _item$props === void 0 ? {} : _item$props,
|
59
|
-
otherProps = _objectWithoutProperties(item, _excluded);
|
60
|
-
|
61
|
-
return _objectSpread({
|
62
|
-
component: 'ProField',
|
63
|
-
props: _objectSpread({
|
64
|
-
type: proFieldTypeMap[component]
|
65
|
-
}, props)
|
66
|
-
}, otherProps);
|
67
|
-
};
|
68
|
-
|
69
|
-
export { proFieldTypeMap };
|
70
|
-
export default initialize;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { ProInfoBaseProps } from '../typing';
|
2
|
-
interface IUseInfoRequest {
|
3
|
-
url?: ProInfoBaseProps['url'];
|
4
|
-
method?: ProInfoBaseProps['method'];
|
5
|
-
params?: ProInfoBaseProps['params'];
|
6
|
-
formatResult?: ProInfoBaseProps['formatResult'];
|
7
|
-
}
|
8
|
-
export declare type IUseInfoRequestResult = {
|
9
|
-
loading: boolean;
|
10
|
-
result: any;
|
11
|
-
refresh?: () => void;
|
12
|
-
};
|
13
|
-
declare const useInfoRequest: (props: IUseInfoRequest) => IUseInfoRequestResult;
|
14
|
-
export default useInfoRequest;
|
@@ -1,76 +0,0 @@
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
-
|
3
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
|
-
|
5
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
6
|
-
|
7
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
8
|
-
|
9
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
10
|
-
|
11
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
12
|
-
|
13
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
14
|
-
|
15
|
-
import { getTargetValue, request } from '@teamix/utils';
|
16
|
-
import { useEffect, useState } from 'react';
|
17
|
-
|
18
|
-
var useInfoRequest = function useInfoRequest(props) {
|
19
|
-
var url = props.url,
|
20
|
-
_props$method = props.method,
|
21
|
-
method = _props$method === void 0 ? 'get' : _props$method,
|
22
|
-
params = props.params,
|
23
|
-
formatResult = props.formatResult;
|
24
|
-
var requestDataKey = method.toLowerCase() === 'get' ? 'params' : 'data';
|
25
|
-
|
26
|
-
var _useState = useState(true),
|
27
|
-
_useState2 = _slicedToArray(_useState, 2),
|
28
|
-
loading = _useState2[0],
|
29
|
-
setLoading = _useState2[1];
|
30
|
-
|
31
|
-
var _useState3 = useState({}),
|
32
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
33
|
-
dataSource = _useState4[0],
|
34
|
-
setDataSource = _useState4[1];
|
35
|
-
|
36
|
-
useEffect(function () {
|
37
|
-
getData();
|
38
|
-
}, []); // 获取数据
|
39
|
-
|
40
|
-
var getData = function getData() {
|
41
|
-
setLoading(true);
|
42
|
-
|
43
|
-
if (url) {
|
44
|
-
request(_defineProperty({
|
45
|
-
url: url,
|
46
|
-
method: method
|
47
|
-
}, requestDataKey, params)).then(function (resp) {
|
48
|
-
if (typeof formatResult === 'function') {
|
49
|
-
setDataSource(formatResult === null || formatResult === void 0 ? void 0 : formatResult(resp));
|
50
|
-
} else if (formatResult) {
|
51
|
-
setDataSource(getTargetValue("{{".concat(formatResult.data, "}}"), resp));
|
52
|
-
} else {
|
53
|
-
setDataSource(resp);
|
54
|
-
}
|
55
|
-
}).catch(function () {// TODO 待处理
|
56
|
-
}).finally(function () {
|
57
|
-
setLoading(false);
|
58
|
-
});
|
59
|
-
} else {
|
60
|
-
setLoading(false);
|
61
|
-
}
|
62
|
-
}; // 刷新数据
|
63
|
-
|
64
|
-
|
65
|
-
var refresh = function refresh() {
|
66
|
-
getData();
|
67
|
-
};
|
68
|
-
|
69
|
-
return {
|
70
|
-
loading: loading,
|
71
|
-
result: dataSource,
|
72
|
-
refresh: refresh
|
73
|
-
};
|
74
|
-
};
|
75
|
-
|
76
|
-
export default useInfoRequest;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
interface ISearchPanelProps {
|
3
|
-
title?: React.ReactNode;
|
4
|
-
className?: string;
|
5
|
-
}
|
6
|
-
declare type ISearchPanel = React.FC<ISearchPanelProps>;
|
7
|
-
declare type ISearch = React.FC<any> & {
|
8
|
-
SearchPanel?: ISearchPanel;
|
9
|
-
};
|
10
|
-
declare const Search: ISearch;
|
11
|
-
export default Search;
|
@@ -1,103 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
11
|
-
|
12
|
-
var _react2 = require("@formily/react");
|
13
|
-
|
14
|
-
var _components = require("@alicloudfe/components");
|
15
|
-
|
16
|
-
var _utils = require("@teamix/utils");
|
17
|
-
|
18
|
-
var _excluded = ["children"];
|
19
|
-
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
-
|
22
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
23
|
-
|
24
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
25
|
-
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
27
|
-
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
29
|
-
|
30
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
31
|
-
|
32
|
-
var usePanels = function usePanels() {
|
33
|
-
var searchField = (0, _react2.useField)();
|
34
|
-
var schema = (0, _react2.useFieldSchema)();
|
35
|
-
var panels = [];
|
36
|
-
schema.mapProperties(function (schema, name) {
|
37
|
-
var _schema$xComponent;
|
38
|
-
|
39
|
-
var field = searchField.query(searchField.address.concat(name)).take();
|
40
|
-
if ((field === null || field === void 0 ? void 0 : field.display) === 'none' || (field === null || field === void 0 ? void 0 : field.display) === 'hidden') return;
|
41
|
-
|
42
|
-
if (((_schema$xComponent = schema['x-component']) === null || _schema$xComponent === void 0 ? void 0 : _schema$xComponent.indexOf('SearchPanel')) > -1) {
|
43
|
-
var _schema$xComponentP, _schema$xComponentP2;
|
44
|
-
|
45
|
-
panels.push({
|
46
|
-
name: name,
|
47
|
-
props: _objectSpread(_objectSpread({}, schema === null || schema === void 0 ? void 0 : schema['x-component-props']), {}, {
|
48
|
-
title: (schema === null || schema === void 0 ? void 0 : (_schema$xComponentP = schema['x-component-props']) === null || _schema$xComponentP === void 0 ? void 0 : _schema$xComponentP.title) || (schema === null || schema === void 0 ? void 0 : schema.title),
|
49
|
-
key: (schema === null || schema === void 0 ? void 0 : (_schema$xComponentP2 = schema['x-component-props']) === null || _schema$xComponentP2 === void 0 ? void 0 : _schema$xComponentP2.key) || name
|
50
|
-
}),
|
51
|
-
schema: schema
|
52
|
-
});
|
53
|
-
}
|
54
|
-
});
|
55
|
-
return panels;
|
56
|
-
};
|
57
|
-
|
58
|
-
var Search = (0, _react2.observer)(function (_ref) {
|
59
|
-
var children = _ref.children,
|
60
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
61
|
-
|
62
|
-
var prefixCls = (0, _utils.usePrefixCls)('formily-group');
|
63
|
-
var panels = usePanels().map(function (_ref2, index) {
|
64
|
-
var props = _ref2.props,
|
65
|
-
schema = _ref2.schema,
|
66
|
-
name = _ref2.name;
|
67
|
-
return /*#__PURE__*/_react.default.createElement(_react2.RecursionField, {
|
68
|
-
key: index,
|
69
|
-
schema: schema,
|
70
|
-
name: name
|
71
|
-
});
|
72
|
-
});
|
73
|
-
var first = null;
|
74
|
-
var middle = null;
|
75
|
-
var last = null;
|
76
|
-
|
77
|
-
if (panels.length > 1) {
|
78
|
-
first = panels[0];
|
79
|
-
middle = panels.slice(1, panels.length);
|
80
|
-
|
81
|
-
if (panels.length > 2) {
|
82
|
-
middle = panels.slice(1, panels.length - 1);
|
83
|
-
last = panels[panels.length - 1];
|
84
|
-
}
|
85
|
-
} else {
|
86
|
-
middle = panels;
|
87
|
-
}
|
88
|
-
|
89
|
-
return /*#__PURE__*/_react.default.createElement(_components.Input.Group, _objectSpread(_objectSpread({}, props), {}, {
|
90
|
-
className: (0, _classnames.default)(prefixCls, props.className),
|
91
|
-
addonBefore: first,
|
92
|
-
addonAfter: last
|
93
|
-
}), middle);
|
94
|
-
});
|
95
|
-
|
96
|
-
var SearchPanel = function SearchPanel(_ref3) {
|
97
|
-
var children = _ref3.children;
|
98
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
99
|
-
};
|
100
|
-
|
101
|
-
Search.SearchPanel = SearchPanel;
|
102
|
-
var _default = Search;
|
103
|
-
exports.default = _default;
|
@@ -1,73 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _icon = _interopRequireDefault(require("@teamix/icon"));
|
11
|
-
|
12
|
-
var _excluded = ["component", "props"],
|
13
|
-
_excluded2 = ["icon"],
|
14
|
-
_excluded3 = ["text", "type"];
|
15
|
-
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
19
|
-
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
21
|
-
|
22
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
23
|
-
|
24
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
25
|
-
|
26
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
27
|
-
|
28
|
-
var initialize = function initialize(item) {
|
29
|
-
var component = item.component,
|
30
|
-
_item$props = item.props,
|
31
|
-
props = _item$props === void 0 ? {} : _item$props,
|
32
|
-
other = _objectWithoutProperties(item, _excluded);
|
33
|
-
|
34
|
-
var icon = props.icon,
|
35
|
-
otherProps = _objectWithoutProperties(props, _excluded2);
|
36
|
-
|
37
|
-
var iconType = '';
|
38
|
-
|
39
|
-
if (icon) {
|
40
|
-
iconType = icon;
|
41
|
-
} else if (component) {
|
42
|
-
if (/Addition/.test(component)) {
|
43
|
-
iconType = 'add-line';
|
44
|
-
} else if (/Remove/.test(component)) {
|
45
|
-
iconType = 'delete-line';
|
46
|
-
} else if (/MoveUp/.test(component)) {
|
47
|
-
iconType = 'up-line';
|
48
|
-
} else if (/MoveDown/.test(component)) {
|
49
|
-
iconType = 'down-line';
|
50
|
-
} else if (/SortHandle/.test(component)) {
|
51
|
-
iconType = 'menu-line';
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
return _objectSpread(_objectSpread({}, other), {}, {
|
56
|
-
component: component,
|
57
|
-
props: _objectSpread({
|
58
|
-
icon: function icon(_ref) {
|
59
|
-
var text = _ref.text,
|
60
|
-
type = _ref.type,
|
61
|
-
props = _objectWithoutProperties(_ref, _excluded3);
|
62
|
-
|
63
|
-
return /*#__PURE__*/_react.default.createElement(_icon.default, _objectSpread(_objectSpread({}, props), {}, {
|
64
|
-
type: iconType,
|
65
|
-
size: "small"
|
66
|
-
}));
|
67
|
-
}
|
68
|
-
}, otherProps)
|
69
|
-
});
|
70
|
-
};
|
71
|
-
|
72
|
-
var _default = initialize;
|
73
|
-
exports.default = _default;
|
@@ -1,77 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.proFieldTypeMap = exports.default = void 0;
|
7
|
-
var _excluded = ["component", "props"];
|
8
|
-
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
10
|
-
|
11
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
12
|
-
|
13
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
14
|
-
|
15
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
16
|
-
|
17
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
18
|
-
|
19
|
-
var proFieldTypeMap = {
|
20
|
-
Input: 'text',
|
21
|
-
Password: 'password',
|
22
|
-
TextArea: 'textArea',
|
23
|
-
NumberPicker: 'number',
|
24
|
-
Percent: 'percent',
|
25
|
-
Money: 'money',
|
26
|
-
Select: 'select',
|
27
|
-
MultipleSelect: 'multipleSelect',
|
28
|
-
TreeSelect: 'treeSelect',
|
29
|
-
Cascader: 'cascader',
|
30
|
-
MultipleCascader: 'multipleCascader',
|
31
|
-
ArbitraryCascader: 'arbitraryCascader',
|
32
|
-
Radio: 'radio',
|
33
|
-
Checkbox: 'checkbox',
|
34
|
-
Switch: 'switch',
|
35
|
-
DatePicker: 'date',
|
36
|
-
TimePicker: 'time',
|
37
|
-
DateTimePicker: 'dateTime',
|
38
|
-
WeekPicker: 'dateWeek',
|
39
|
-
MonthPicker: 'dateMonth',
|
40
|
-
YearPicker: 'dateYear',
|
41
|
-
QuarterPicker: 'dateQuarter',
|
42
|
-
DateRangePicker: 'dateRange',
|
43
|
-
TimeRangePicker: 'timeRange',
|
44
|
-
DateTimeRangePicker: 'dateTimeRange',
|
45
|
-
WeekRangePicker: 'dateWeekRange',
|
46
|
-
MonthRangePicker: 'dateMonthRange',
|
47
|
-
YearRangePicker: 'dateYearRange',
|
48
|
-
QuarterRangePicker: 'dateQuarterRange',
|
49
|
-
Transfer: 'transfer',
|
50
|
-
ColorPicker: 'color',
|
51
|
-
ColorRadio: 'colorRadio',
|
52
|
-
IconPicker: 'icon',
|
53
|
-
JsonInput: 'json',
|
54
|
-
TagPicker: 'tagPicker',
|
55
|
-
MultipleTagPicker: 'multipleTagPicker',
|
56
|
-
Range: 'range',
|
57
|
-
Search: 'search' // Upload: 'upload',
|
58
|
-
|
59
|
-
};
|
60
|
-
exports.proFieldTypeMap = proFieldTypeMap;
|
61
|
-
|
62
|
-
var initialize = function initialize(item) {
|
63
|
-
var component = item.component,
|
64
|
-
_item$props = item.props,
|
65
|
-
props = _item$props === void 0 ? {} : _item$props,
|
66
|
-
otherProps = _objectWithoutProperties(item, _excluded);
|
67
|
-
|
68
|
-
return _objectSpread({
|
69
|
-
component: 'ProField',
|
70
|
-
props: _objectSpread({
|
71
|
-
type: proFieldTypeMap[component]
|
72
|
-
}, props)
|
73
|
-
}, otherProps);
|
74
|
-
};
|
75
|
-
|
76
|
-
var _default = initialize;
|
77
|
-
exports.default = _default;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { ProInfoBaseProps } from '../typing';
|
2
|
-
interface IUseInfoRequest {
|
3
|
-
url?: ProInfoBaseProps['url'];
|
4
|
-
method?: ProInfoBaseProps['method'];
|
5
|
-
params?: ProInfoBaseProps['params'];
|
6
|
-
formatResult?: ProInfoBaseProps['formatResult'];
|
7
|
-
}
|
8
|
-
export declare type IUseInfoRequestResult = {
|
9
|
-
loading: boolean;
|
10
|
-
result: any;
|
11
|
-
refresh?: () => void;
|
12
|
-
};
|
13
|
-
declare const useInfoRequest: (props: IUseInfoRequest) => IUseInfoRequestResult;
|
14
|
-
export default useInfoRequest;
|
@@ -1,85 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _utils = require("@teamix/utils");
|
9
|
-
|
10
|
-
var _react = require("react");
|
11
|
-
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
13
|
-
|
14
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
15
|
-
|
16
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
17
|
-
|
18
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
19
|
-
|
20
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
21
|
-
|
22
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
23
|
-
|
24
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
25
|
-
|
26
|
-
var useInfoRequest = function useInfoRequest(props) {
|
27
|
-
var url = props.url,
|
28
|
-
_props$method = props.method,
|
29
|
-
method = _props$method === void 0 ? 'get' : _props$method,
|
30
|
-
params = props.params,
|
31
|
-
formatResult = props.formatResult;
|
32
|
-
var requestDataKey = method.toLowerCase() === 'get' ? 'params' : 'data';
|
33
|
-
|
34
|
-
var _useState = (0, _react.useState)(true),
|
35
|
-
_useState2 = _slicedToArray(_useState, 2),
|
36
|
-
loading = _useState2[0],
|
37
|
-
setLoading = _useState2[1];
|
38
|
-
|
39
|
-
var _useState3 = (0, _react.useState)({}),
|
40
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
41
|
-
dataSource = _useState4[0],
|
42
|
-
setDataSource = _useState4[1];
|
43
|
-
|
44
|
-
(0, _react.useEffect)(function () {
|
45
|
-
getData();
|
46
|
-
}, []); // 获取数据
|
47
|
-
|
48
|
-
var getData = function getData() {
|
49
|
-
setLoading(true);
|
50
|
-
|
51
|
-
if (url) {
|
52
|
-
(0, _utils.request)(_defineProperty({
|
53
|
-
url: url,
|
54
|
-
method: method
|
55
|
-
}, requestDataKey, params)).then(function (resp) {
|
56
|
-
if (typeof formatResult === 'function') {
|
57
|
-
setDataSource(formatResult === null || formatResult === void 0 ? void 0 : formatResult(resp));
|
58
|
-
} else if (formatResult) {
|
59
|
-
setDataSource((0, _utils.getTargetValue)("{{".concat(formatResult.data, "}}"), resp));
|
60
|
-
} else {
|
61
|
-
setDataSource(resp);
|
62
|
-
}
|
63
|
-
}).catch(function () {// TODO 待处理
|
64
|
-
}).finally(function () {
|
65
|
-
setLoading(false);
|
66
|
-
});
|
67
|
-
} else {
|
68
|
-
setLoading(false);
|
69
|
-
}
|
70
|
-
}; // 刷新数据
|
71
|
-
|
72
|
-
|
73
|
-
var refresh = function refresh() {
|
74
|
-
getData();
|
75
|
-
};
|
76
|
-
|
77
|
-
return {
|
78
|
-
loading: loading,
|
79
|
-
result: dataSource,
|
80
|
-
refresh: refresh
|
81
|
-
};
|
82
|
-
};
|
83
|
-
|
84
|
-
var _default = useInfoRequest;
|
85
|
-
exports.default = _default;
|