@pisell/materials 1.0.402 → 1.0.404
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/build/lowcode/assets-daily.json +13 -13
- package/build/lowcode/assets-dev.json +4 -4
- package/build/lowcode/assets-prod.json +13 -13
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +16 -59
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +19 -62
- package/dist/umd/materials.min.css +1 -0
- package/dist/umd/materials.min.js +1 -0
- package/dist/umd/static/DotsSix.57d66266.svg +1 -0
- package/dist/umd/static/arrow-left.e542294f.svg +1 -0
- package/dist/umd/static/arrow-right.763f03e0.svg +1 -0
- package/dist/umd/static/filter-lines.04a54ae9.svg +1 -0
- package/dist/umd/static/help-circle.31c9be40.svg +1 -0
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +1 -0
- package/es/components/date-picker/index.js +2 -2
- package/es/components/drag-sort-tree/index.d.ts +1 -0
- package/es/components/drag-sort-tree/index.js +1 -2
- package/es/components/pisell-config-provider/index.js +0 -2
- package/es/components/pisellModal/components/functions/index.d.ts +5 -23
- package/es/components/pisellModal/components/functions/index.js +2 -7
- package/es/components/pisellModal/index.d.ts +5 -20
- package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.js +26 -30
- package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.js +1 -3
- package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.js +21 -25
- package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.js +31 -34
- package/es/components/table/Actions/component/ExportImport/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/index.js +25 -32
- package/es/components/table/BasicTable/index.js +2 -1
- package/es/components/table/Gallery/index.js +1 -2
- package/es/components/table/Table/fields/rangePicker/Edit/index.js +11 -13
- package/es/components/table/Table/index.d.ts +2 -2
- package/es/components/table/Table/index.js +42 -68
- package/es/components/table/Table/index.less +0 -3
- package/es/components/table/Table/utils.d.ts +3 -15
- package/es/components/table/Table/utils.js +2 -6
- package/es/components/table/View/index.d.ts +2 -2
- package/es/components/table/View/index.js +16 -20
- package/es/components/table/hooks/useTableSetting.js +7 -29
- package/es/components/table/hooks/useTransDataSource.d.ts +0 -1
- package/es/components/table/hooks/useTransDataSource.js +4 -6
- package/es/components/table/index.js +5 -8
- package/es/components/table/index.less +0 -4
- package/es/components/table/serve.d.ts +0 -1
- package/es/components/table/serve.js +7 -38
- package/es/components/table/types.d.ts +0 -2
- package/es/index.d.ts +1 -3
- package/es/index.js +1 -3
- package/es/locales/en-US.d.ts +0 -12
- package/es/locales/en-US.js +0 -13
- package/es/locales/zh-CN.d.ts +0 -12
- package/es/locales/zh-CN.js +0 -13
- package/es/locales/zh-TW.d.ts +0 -12
- package/es/locales/zh-TW.js +0 -13
- package/lib/components/date-picker/index.js +2 -2
- package/lib/components/drag-sort-tree/index.d.ts +1 -0
- package/lib/components/drag-sort-tree/index.js +1 -0
- package/lib/components/pisell-config-provider/index.js +0 -2
- package/lib/components/pisellModal/components/functions/index.d.ts +5 -23
- package/lib/components/pisellModal/components/functions/index.js +7 -13
- package/lib/components/pisellModal/index.d.ts +5 -20
- package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.js +2 -6
- package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.js +1 -2
- package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.js +2 -6
- package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.js +2 -4
- package/lib/components/table/Actions/component/ExportImport/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/index.js +8 -13
- package/lib/components/table/BasicTable/index.js +2 -1
- package/lib/components/table/Gallery/index.js +1 -2
- package/lib/components/table/Table/fields/rangePicker/Edit/index.js +9 -1
- package/lib/components/table/Table/index.d.ts +2 -2
- package/lib/components/table/Table/index.js +34 -61
- package/lib/components/table/Table/index.less +0 -3
- package/lib/components/table/Table/utils.d.ts +3 -15
- package/lib/components/table/Table/utils.js +1 -7
- package/lib/components/table/View/index.d.ts +2 -2
- package/lib/components/table/View/index.js +19 -23
- package/lib/components/table/hooks/useTableSetting.js +11 -26
- package/lib/components/table/hooks/useTransDataSource.d.ts +0 -1
- package/lib/components/table/hooks/useTransDataSource.js +4 -5
- package/lib/components/table/index.js +4 -5
- package/lib/components/table/index.less +0 -4
- package/lib/components/table/serve.d.ts +0 -1
- package/lib/components/table/serve.js +4 -24
- package/lib/components/table/types.d.ts +0 -2
- package/lib/index.d.ts +1 -3
- package/lib/index.js +0 -6
- package/lib/locales/en-US.d.ts +0 -12
- package/lib/locales/en-US.js +0 -13
- package/lib/locales/zh-CN.d.ts +0 -12
- package/lib/locales/zh-CN.js +0 -13
- package/lib/locales/zh-TW.d.ts +0 -12
- package/lib/locales/zh-TW.js +0 -13
- package/package.json +3 -3
- package/es/components/browserSelect/chevron-down.png +0 -0
- package/es/components/browserSelect/index.d.ts +0 -15
- package/es/components/browserSelect/index.js +0 -36
- package/es/components/browserSelect/index.less +0 -18
- package/es/components/date-picker/constants.d.ts +0 -39
- package/es/components/date-picker/constants.js +0 -76
- package/es/components/date-picker/datePickerCpt.d.ts +0 -8
- package/es/components/date-picker/datePickerCpt.js +0 -370
- package/es/components/date-picker/hooks/useMediaQuery.d.ts +0 -2
- package/es/components/date-picker/hooks/useMediaQuery.js +0 -28
- package/es/components/date-picker/index.less +0 -1880
- package/es/components/picker-view/index.d.ts +0 -2
- package/es/components/picker-view/index.js +0 -2
- package/es/components/pisellTags/index.d.ts +0 -13
- package/es/components/pisellTags/index.js +0 -83
- package/es/components/pisellTags/index.less +0 -17
- package/es/components/pisellTags/utils.d.ts +0 -1
- package/es/components/pisellTags/utils.js +0 -89
- package/lib/components/browserSelect/chevron-down.png +0 -0
- package/lib/components/browserSelect/index.d.ts +0 -15
- package/lib/components/browserSelect/index.js +0 -59
- package/lib/components/browserSelect/index.less +0 -18
- package/lib/components/date-picker/constants.d.ts +0 -39
- package/lib/components/date-picker/constants.js +0 -78
- package/lib/components/date-picker/datePickerCpt.d.ts +0 -8
- package/lib/components/date-picker/datePickerCpt.js +0 -403
- package/lib/components/date-picker/hooks/useMediaQuery.d.ts +0 -2
- package/lib/components/date-picker/hooks/useMediaQuery.js +0 -43
- package/lib/components/date-picker/index.less +0 -1880
- package/lib/components/picker-view/index.d.ts +0 -2
- package/lib/components/picker-view/index.js +0 -36
- package/lib/components/pisellTags/index.d.ts +0 -13
- package/lib/components/pisellTags/index.js +0 -113
- package/lib/components/pisellTags/index.less +0 -17
- package/lib/components/pisellTags/utils.d.ts +0 -1
- package/lib/components/pisellTags/utils.js +0 -86
|
@@ -8,10 +8,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
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; }
|
|
9
9
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import ImportExport from
|
|
12
|
-
import { useRequest } from
|
|
13
|
-
import { Dropdown, Modal, message } from
|
|
14
|
-
import React, { useMemo, useState } from
|
|
11
|
+
import ImportExport from "@pisell/icon/es/ImportExport";
|
|
12
|
+
import { useRequest } from "ahooks";
|
|
13
|
+
import { Dropdown, Modal, message } from "antd";
|
|
14
|
+
import React, { useMemo, useState } from "react";
|
|
15
15
|
import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
16
16
|
import { getText } from "../../../../../locales/index";
|
|
17
17
|
import { batchImport } from "../../../serve";
|
|
@@ -47,7 +47,7 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
47
47
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
48
48
|
type = _useState6[0],
|
|
49
49
|
setType = _useState6[1];
|
|
50
|
-
var _useState7 = useState(
|
|
50
|
+
var _useState7 = useState(""),
|
|
51
51
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
52
52
|
value = _useState8[0],
|
|
53
53
|
setValue = _useState8[1];
|
|
@@ -62,28 +62,22 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
62
62
|
var context = useEngineContext();
|
|
63
63
|
request.setRequest(context.appHelper.utils.request);
|
|
64
64
|
var _items = useMemo(function () {
|
|
65
|
-
var _Object$entries$map;
|
|
66
65
|
// 将对象转成数组
|
|
67
|
-
var result =
|
|
68
|
-
var _exportImport$hiddenK;
|
|
66
|
+
var result = Object.entries(exportImportOptions).map(function (_ref2) {
|
|
69
67
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
70
68
|
key = _ref3[0],
|
|
71
69
|
value = _ref3[1];
|
|
72
|
-
// 如果开启了隐藏字段则不显示该字段
|
|
73
|
-
if (Array.isArray(exportImport === null || exportImport === void 0 ? void 0 : exportImport.hiddenKeys) && exportImport !== null && exportImport !== void 0 && (_exportImport$hiddenK = exportImport.hiddenKeys) !== null && _exportImport$hiddenK !== void 0 && _exportImport$hiddenK.includes(key)) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
70
|
return {
|
|
77
71
|
key: key,
|
|
78
72
|
label: value
|
|
79
73
|
};
|
|
80
|
-
})
|
|
74
|
+
});
|
|
81
75
|
return result;
|
|
82
|
-
}, [
|
|
76
|
+
}, []);
|
|
83
77
|
var Content = useMemo(function () {
|
|
84
|
-
|
|
85
|
-
return Com[
|
|
86
|
-
}, [value
|
|
78
|
+
if (!value) return null;
|
|
79
|
+
return Com[value];
|
|
80
|
+
}, [value]);
|
|
87
81
|
var _footer = useMemo(function () {
|
|
88
82
|
var types = defaultOptions.footerHintTypes;
|
|
89
83
|
if (types.includes(value)) {
|
|
@@ -98,18 +92,18 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
98
92
|
if (!value) return null;
|
|
99
93
|
var types = defaultOptions.okShowButtonTypes;
|
|
100
94
|
var lang = getCurrentLocale();
|
|
101
|
-
var isEn = lang ===
|
|
95
|
+
var isEn = lang === "en-US" || lang === "en";
|
|
102
96
|
|
|
103
97
|
// 导出导入标题
|
|
104
98
|
if (types.includes(value) && exportImport !== null && exportImport !== void 0 && exportImport.title) {
|
|
105
|
-
return "".concat(exportImportOptions[value]).concat(isEn ?
|
|
99
|
+
return "".concat(exportImportOptions[value]).concat(isEn ? " " : "").concat(exportImport.title);
|
|
106
100
|
}
|
|
107
101
|
return exportImportOptions[value];
|
|
108
102
|
}, [value, exportImport === null || exportImport === void 0 ? void 0 : exportImport.title]);
|
|
109
103
|
var _okText = useMemo(function () {
|
|
110
104
|
var types = defaultOptions.okShowButtonTypes;
|
|
111
105
|
if (types.includes(value)) {
|
|
112
|
-
return value === defaultOptions.exportValue ? getText(
|
|
106
|
+
return value === defaultOptions.exportValue ? getText("table-action-export-import-button") : getText("table-action-export-import-button-import");
|
|
113
107
|
}
|
|
114
108
|
}, [value]);
|
|
115
109
|
var handleClick = function handleClick(e) {
|
|
@@ -119,7 +113,7 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
119
113
|
};
|
|
120
114
|
var onCancel = function onCancel() {
|
|
121
115
|
setOpen(false);
|
|
122
|
-
setValue(
|
|
116
|
+
setValue("");
|
|
123
117
|
setFile(null);
|
|
124
118
|
setErrorStatus(null);
|
|
125
119
|
setType(defaultOptions.exportType);
|
|
@@ -131,7 +125,7 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
131
125
|
setErrorStatus(null);
|
|
132
126
|
message.destroy();
|
|
133
127
|
message.success({
|
|
134
|
-
content: getText(
|
|
128
|
+
content: getText("table-action-export-import-import-success"),
|
|
135
129
|
key: value
|
|
136
130
|
});
|
|
137
131
|
onCancel();
|
|
@@ -143,11 +137,11 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
143
137
|
});
|
|
144
138
|
var onOk = /*#__PURE__*/function () {
|
|
145
139
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
146
|
-
var formId, formCode,
|
|
140
|
+
var formId, formCode, _params, result, formData;
|
|
147
141
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
148
142
|
while (1) switch (_context.prev = _context.next) {
|
|
149
143
|
case 0:
|
|
150
|
-
formId = exportImport.formId, formCode = exportImport.formCode
|
|
144
|
+
formId = exportImport.formId, formCode = exportImport.formCode; // 导出
|
|
151
145
|
if (!(value === defaultOptions.exportValue)) {
|
|
152
146
|
_context.next = 9;
|
|
153
147
|
break;
|
|
@@ -169,17 +163,16 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
169
163
|
case 9:
|
|
170
164
|
if (value === defaultOptions.importValue) {
|
|
171
165
|
formData = new FormData();
|
|
172
|
-
formData.append(
|
|
166
|
+
formData.append("file", file);
|
|
173
167
|
if (formId) {
|
|
174
|
-
formData.append(
|
|
168
|
+
formData.append("form_id", formId);
|
|
175
169
|
}
|
|
176
170
|
if (formCode) {
|
|
177
|
-
formData.append(
|
|
171
|
+
formData.append("code", formCode);
|
|
178
172
|
}
|
|
179
|
-
formData.append('url', apiUrl || '');
|
|
180
173
|
if (formData) {
|
|
181
174
|
message.loading({
|
|
182
|
-
content:
|
|
175
|
+
content: "Loading...",
|
|
183
176
|
key: value
|
|
184
177
|
});
|
|
185
178
|
_batchImport.run(formData);
|
|
@@ -206,7 +199,7 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
206
199
|
isActive: false
|
|
207
200
|
}, /*#__PURE__*/React.createElement(ImportExport, {
|
|
208
201
|
style: {
|
|
209
|
-
cursor:
|
|
202
|
+
cursor: "pointer",
|
|
210
203
|
fontSize: 20
|
|
211
204
|
}
|
|
212
205
|
}))), /*#__PURE__*/React.createElement(Modal, {
|
|
@@ -218,11 +211,11 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
218
211
|
className: "export-import-modal",
|
|
219
212
|
onCancel: onCancel,
|
|
220
213
|
bodyStyle: {
|
|
221
|
-
padding:
|
|
214
|
+
padding: "0px"
|
|
222
215
|
},
|
|
223
216
|
destroyOnClose: true,
|
|
224
217
|
onOk: onOk,
|
|
225
|
-
cancelText: getText(
|
|
218
|
+
cancelText: getText("table-action-export-import-cancel"),
|
|
226
219
|
okButtonProps: {
|
|
227
220
|
disabled: value === defaultOptions.importValue && (!file || !!errorStatus)
|
|
228
221
|
}
|
|
@@ -84,6 +84,7 @@ var BasicTable = function BasicTable(props) {
|
|
|
84
84
|
total: _total
|
|
85
85
|
};
|
|
86
86
|
}, [localPagination, dataSource, formPagination === null || formPagination === void 0 ? void 0 : formPagination.page, formPagination === null || formPagination === void 0 ? void 0 : formPagination.size, filter, sort, other.columns]);
|
|
87
|
+
console.log(pagination, 'wh8888');
|
|
87
88
|
|
|
88
89
|
// 总数
|
|
89
90
|
var total = useMemo(function () {
|
|
@@ -109,7 +110,7 @@ var BasicTable = function BasicTable(props) {
|
|
|
109
110
|
type: 'setCurrentDataSource',
|
|
110
111
|
payload: (_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list) || []
|
|
111
112
|
});
|
|
112
|
-
}, [
|
|
113
|
+
}, [_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list]);
|
|
113
114
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Table, _extends({
|
|
114
115
|
key: defaultExpandedRowKeys.join('-')
|
|
115
116
|
}, other, {
|
|
@@ -46,8 +46,7 @@ var Gallery = function Gallery(props) {
|
|
|
46
46
|
form: form,
|
|
47
47
|
localPagination: !!(pagination !== null && pagination !== void 0 && pagination.localPagination),
|
|
48
48
|
rowKey: rowKey,
|
|
49
|
-
filter: filter
|
|
50
|
-
currentView: 'gallery'
|
|
49
|
+
filter: filter
|
|
51
50
|
});
|
|
52
51
|
useEffect(function () {
|
|
53
52
|
onDataSourceChange === null || onDataSourceChange === void 0 ? void 0 : onDataSourceChange(dataSource);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
1
|
var _excluded = ["value", "onChange", "onPressEnter", "onBlur", "style", "bordered", "presets", "showTime", "format"];
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -6,9 +5,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
7
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
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
10
|
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; }
|
|
11
|
-
import { isArr, isString } from "@pisell/utils";
|
|
11
|
+
import { isArr, isBoolean, isString } from "@pisell/utils";
|
|
12
12
|
import dayjs from "dayjs";
|
|
13
13
|
import React, { forwardRef, useMemo } from "react";
|
|
14
14
|
import DatePicker from "../../../../../date-picker";
|
|
@@ -64,19 +64,17 @@ var Edit = function Edit(props, ref) {
|
|
|
64
64
|
label: getText("table-action-range-picker-presets-last-90-day"),
|
|
65
65
|
value: [dayjs().add(-90, "d").startOf("day"), dayjs().endOf("day")]
|
|
66
66
|
}];
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// }, [showTime]);
|
|
76
|
-
|
|
67
|
+
var _showTime = useMemo(function () {
|
|
68
|
+
if (isBoolean(showTime)) {
|
|
69
|
+
return showTime;
|
|
70
|
+
} else if (_typeof(showTime) === "object") {
|
|
71
|
+
return showTime;
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
}, [showTime]);
|
|
77
75
|
return /*#__PURE__*/React.createElement(RangePicker, _extends({}, others, {
|
|
78
76
|
format: format,
|
|
79
|
-
showTime:
|
|
77
|
+
showTime: _showTime,
|
|
80
78
|
presets: presets || rangePresets,
|
|
81
79
|
ref: ref,
|
|
82
80
|
value: dayjsVal,
|
|
@@ -11,10 +11,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
11
11
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
12
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
13
|
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; }
|
|
14
|
-
import React, { memo, useCallback, useEffect, useMemo, useRef } from
|
|
15
|
-
import { Form } from
|
|
14
|
+
import React, { memo, useCallback, useEffect, useMemo, useRef } from "react";
|
|
15
|
+
import { Form } from "antd";
|
|
16
16
|
// import { Access } from '@umijs/max';
|
|
17
|
-
import {
|
|
17
|
+
import { useMemoizedFn, useSize } from "ahooks";
|
|
18
18
|
import { Context } from "../model";
|
|
19
19
|
// import AddFieldModal from "./AddFieldModal";
|
|
20
20
|
import BasicTable from "../BasicTable";
|
|
@@ -25,23 +25,26 @@ import useTransDataSource from "../hooks/useTransDataSource";
|
|
|
25
25
|
import useTransColumns from "../hooks/useTransColumns";
|
|
26
26
|
import useGenTableComponents from "../hooks/useGenTableComponents";
|
|
27
27
|
import useGenScroll from "../hooks/useGenScroll";
|
|
28
|
-
import { useSharedState } from "../../../hooks";
|
|
28
|
+
import { useSharedState, useResponsive } from "../../../hooks";
|
|
29
29
|
import "./index.less";
|
|
30
30
|
var GridViewTable = function GridViewTable(_ref) {
|
|
31
|
-
var _tableProps$paginatio, _tableProps$paginatio2;
|
|
31
|
+
var _tableProps$paginatio, _tableProps$paginatio2, _tableProps$paginatio7, _tableProps$paginatio8, _tableProps$paginatio9, _tableProps$paginatio10;
|
|
32
32
|
var tableProps = _ref.tableProps,
|
|
33
33
|
filter = _ref.filter,
|
|
34
34
|
setTableSetting = _ref.setTableSetting,
|
|
35
35
|
onDataSourceChange = _ref.onDataSourceChange;
|
|
36
|
+
var responsive = useResponsive();
|
|
36
37
|
var _useSharedState = useSharedState(Context),
|
|
37
38
|
state = _useSharedState.state,
|
|
38
39
|
dispatch = _useSharedState.dispatch;
|
|
39
40
|
var form = Form.useFormInstance();
|
|
40
|
-
var column_setting = Form.useWatch(
|
|
41
|
+
var column_setting = Form.useWatch("column_setting", {
|
|
41
42
|
form: form,
|
|
42
43
|
preserve: true
|
|
43
44
|
}) || [];
|
|
44
45
|
var tableWrapRef = useRef(null);
|
|
46
|
+
var _ref2 = useSize(tableWrapRef) || {},
|
|
47
|
+
height = _ref2.height;
|
|
45
48
|
var defaultDataSource = state.dataSource,
|
|
46
49
|
originDataSource = state.originDataSource;
|
|
47
50
|
var handleSave = useMemoizedFn(function (row) {
|
|
@@ -52,18 +55,18 @@ var GridViewTable = function GridViewTable(_ref) {
|
|
|
52
55
|
var item = newData[index];
|
|
53
56
|
newData.splice(index, 1, _objectSpread(_objectSpread({}, item), row));
|
|
54
57
|
dispatch({
|
|
55
|
-
type:
|
|
58
|
+
type: "setDataSource",
|
|
56
59
|
payload: newData
|
|
57
60
|
});
|
|
58
61
|
});
|
|
59
62
|
var handleResize = function handleResize(index) {
|
|
60
|
-
return function (e,
|
|
61
|
-
var size =
|
|
63
|
+
return function (e, _ref3) {
|
|
64
|
+
var size = _ref3.size;
|
|
62
65
|
var nextColumns = _toConsumableArray(columns);
|
|
63
66
|
nextColumns[index] = _objectSpread(_objectSpread({}, nextColumns[index]), {}, {
|
|
64
67
|
width: size.width
|
|
65
68
|
});
|
|
66
|
-
form.setFieldValue(
|
|
69
|
+
form.setFieldValue("column_setting", nextColumns);
|
|
67
70
|
setTableSetting(form.getFieldsValue());
|
|
68
71
|
};
|
|
69
72
|
};
|
|
@@ -82,12 +85,11 @@ var GridViewTable = function GridViewTable(_ref) {
|
|
|
82
85
|
form: form,
|
|
83
86
|
localPagination: !!(tableProps !== null && tableProps !== void 0 && (_tableProps$paginatio2 = tableProps.pagination) !== null && _tableProps$paginatio2 !== void 0 && _tableProps$paginatio2.localPagination),
|
|
84
87
|
rowKey: tableProps.rowKey,
|
|
85
|
-
filter: filter
|
|
86
|
-
currentView: 'table'
|
|
88
|
+
filter: filter
|
|
87
89
|
});
|
|
88
90
|
useEffect(function () {
|
|
89
91
|
dispatch({
|
|
90
|
-
type:
|
|
92
|
+
type: "setOriginResultDataSource",
|
|
91
93
|
payload: dataSource || []
|
|
92
94
|
});
|
|
93
95
|
}, [dataSource]);
|
|
@@ -97,10 +99,24 @@ var GridViewTable = function GridViewTable(_ref) {
|
|
|
97
99
|
var components = useGenTableComponents({
|
|
98
100
|
form: form
|
|
99
101
|
});
|
|
102
|
+
var isShowPagination = useMemo(function () {
|
|
103
|
+
var _tableProps$paginatio3, _tableProps$paginatio4, _tableProps$paginatio5, _tableProps$paginatio6;
|
|
104
|
+
var total = (tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio3 = tableProps.pagination) === null || _tableProps$paginatio3 === void 0 ? void 0 : _tableProps$paginatio3.total) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0;
|
|
105
|
+
if (tableProps !== null && tableProps !== void 0 && (_tableProps$paginatio4 = tableProps.pagination) !== null && _tableProps$paginatio4 !== void 0 && _tableProps$paginatio4.localPagination) {
|
|
106
|
+
total = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0;
|
|
107
|
+
}
|
|
108
|
+
return total > ((tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio5 = tableProps.pagination) === null || _tableProps$paginatio5 === void 0 ? void 0 : (_tableProps$paginatio6 = _tableProps$paginatio5.pageSizeOptions) === null || _tableProps$paginatio6 === void 0 ? void 0 : _tableProps$paginatio6[0]) || 10);
|
|
109
|
+
}, [tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio7 = tableProps.pagination) === null || _tableProps$paginatio7 === void 0 ? void 0 : _tableProps$paginatio7.localPagination, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio8 = tableProps.pagination) === null || _tableProps$paginatio8 === void 0 ? void 0 : _tableProps$paginatio8.total, dataSource.length, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio9 = tableProps.pagination) === null || _tableProps$paginatio9 === void 0 ? void 0 : (_tableProps$paginatio10 = _tableProps$paginatio9.pageSizeOptions) === null || _tableProps$paginatio10 === void 0 ? void 0 : _tableProps$paginatio10[0]]);
|
|
110
|
+
var scroll = useGenScroll({
|
|
111
|
+
wrapHeight: height || 500,
|
|
112
|
+
scroll: tableProps.scroll,
|
|
113
|
+
columns: columns,
|
|
114
|
+
isShowPagination: isShowPagination
|
|
115
|
+
});
|
|
100
116
|
var showTotal = useCallback(function (total, range, pageSize) {
|
|
101
117
|
var start = range[0] - 1;
|
|
102
118
|
var _current = start / pageSize + 1;
|
|
103
|
-
return getText(
|
|
119
|
+
return getText("table-pagination-total")(_current, Math.ceil(total / pageSize));
|
|
104
120
|
}, []);
|
|
105
121
|
var _paginationConfig = useMemo(function () {
|
|
106
122
|
if (tableProps.pagination === false) {
|
|
@@ -109,64 +125,22 @@ var GridViewTable = function GridViewTable(_ref) {
|
|
|
109
125
|
return _objectSpread(_objectSpread(_objectSpread({}, paginationConfig), tableProps.pagination), {}, {
|
|
110
126
|
showTotal: showTotal
|
|
111
127
|
});
|
|
112
|
-
}, [tableProps.pagination]);
|
|
128
|
+
}, [responsive, tableProps.pagination]);
|
|
113
129
|
return /*#__PURE__*/React.createElement("div", {
|
|
114
|
-
className:
|
|
130
|
+
className: "materials-grid-table-wrap",
|
|
115
131
|
ref: tableWrapRef
|
|
116
|
-
}, /*#__PURE__*/React.createElement(
|
|
117
|
-
|
|
132
|
+
}, /*#__PURE__*/React.createElement(SortRow, {
|
|
133
|
+
rowKey: tableProps.rowKey,
|
|
134
|
+
onSortChange: tableProps.onSortChange
|
|
135
|
+
}, /*#__PURE__*/React.createElement(BasicTable, _extends({
|
|
136
|
+
key: scroll === null || scroll === void 0 ? void 0 : scroll.y,
|
|
118
137
|
dataSource: dataSource,
|
|
119
|
-
tableProps: tableProps,
|
|
120
138
|
columns: columns,
|
|
121
|
-
|
|
139
|
+
className: "grid-view-table",
|
|
122
140
|
components: components
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var tableProps = props.tableProps,
|
|
128
|
-
dataSource = props.dataSource,
|
|
129
|
-
paginationConfig = props.paginationConfig,
|
|
130
|
-
columns = props.columns,
|
|
131
|
-
components = props.components,
|
|
132
|
-
tableWrapRef = props.tableWrapRef;
|
|
133
|
-
var _ref3 = useSize(tableWrapRef) || {},
|
|
134
|
-
height = _ref3.height;
|
|
135
|
-
var debouncedHeight = useDebounce(height, {
|
|
136
|
-
wait: 500
|
|
137
|
-
});
|
|
138
|
-
var isShowPagination = useMemo(function () {
|
|
139
|
-
var _tableProps$paginatio3, _tableProps$paginatio4, _tableProps$paginatio5, _tableProps$paginatio6, _tableProps$paginatio7, _tableProps$paginatio8;
|
|
140
|
-
var total = (tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio3 = tableProps.pagination) === null || _tableProps$paginatio3 === void 0 ? void 0 : _tableProps$paginatio3.total) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0;
|
|
141
|
-
if (tableProps !== null && tableProps !== void 0 && (_tableProps$paginatio4 = tableProps.pagination) !== null && _tableProps$paginatio4 !== void 0 && _tableProps$paginatio4.localPagination) {
|
|
142
|
-
total = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0;
|
|
143
|
-
}
|
|
144
|
-
return total > ((tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio5 = tableProps.pagination) === null || _tableProps$paginatio5 === void 0 ? void 0 : _tableProps$paginatio5.pageSize) || (tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio6 = tableProps.pagination) === null || _tableProps$paginatio6 === void 0 ? void 0 : (_tableProps$paginatio7 = _tableProps$paginatio6.pageSizeOptions) === null || _tableProps$paginatio7 === void 0 ? void 0 : _tableProps$paginatio7[0]) || 10) || (tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio8 = tableProps.pagination) === null || _tableProps$paginatio8 === void 0 ? void 0 : _tableProps$paginatio8.showPagination) && total > 10;
|
|
145
|
-
}, [tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio9 = tableProps.pagination) === null || _tableProps$paginatio9 === void 0 ? void 0 : _tableProps$paginatio9.localPagination, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio10 = tableProps.pagination) === null || _tableProps$paginatio10 === void 0 ? void 0 : _tableProps$paginatio10.total, dataSource.length, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio11 = tableProps.pagination) === null || _tableProps$paginatio11 === void 0 ? void 0 : (_tableProps$paginatio12 = _tableProps$paginatio11.pageSizeOptions) === null || _tableProps$paginatio12 === void 0 ? void 0 : _tableProps$paginatio12[0]]);
|
|
146
|
-
var scroll = useGenScroll({
|
|
147
|
-
wrapHeight: debouncedHeight || 500,
|
|
148
|
-
scroll: tableProps.scroll,
|
|
149
|
-
columns: columns,
|
|
150
|
-
isShowPagination: isShowPagination
|
|
151
|
-
});
|
|
152
|
-
var debouncedScroll = useDebounce(scroll, {
|
|
153
|
-
wait: 500
|
|
154
|
-
});
|
|
155
|
-
var basicTable = useMemo(function () {
|
|
156
|
-
return /*#__PURE__*/React.createElement(BasicTable, _extends({
|
|
157
|
-
key: debouncedScroll,
|
|
158
|
-
dataSource: dataSource,
|
|
159
|
-
columns: columns,
|
|
160
|
-
className: 'grid-view-table',
|
|
161
|
-
components: components
|
|
162
|
-
}, tableProps, {
|
|
163
|
-
scroll: debouncedScroll,
|
|
164
|
-
pagination: paginationConfig
|
|
165
|
-
}));
|
|
166
|
-
}, [debouncedScroll, dataSource, columns, components, paginationConfig, tableProps]);
|
|
167
|
-
return /*#__PURE__*/React.createElement(SortRow, {
|
|
168
|
-
rowKey: tableProps.rowKey,
|
|
169
|
-
onSortChange: tableProps.onSortChange
|
|
170
|
-
}, basicTable);
|
|
141
|
+
}, tableProps, {
|
|
142
|
+
scroll: scroll,
|
|
143
|
+
pagination: _paginationConfig
|
|
144
|
+
}))));
|
|
171
145
|
};
|
|
172
146
|
export default /*#__PURE__*/memo(GridViewTable);
|
|
@@ -81,10 +81,7 @@ export declare const setTableSettingToLocalStorage: ({ tableId, tableSettingObj,
|
|
|
81
81
|
}>;
|
|
82
82
|
currentViewMode: ModeType;
|
|
83
83
|
currentSettingHash: string;
|
|
84
|
-
}) =>
|
|
85
|
-
key: string;
|
|
86
|
-
value: Record<string, any>;
|
|
87
|
-
} | undefined;
|
|
84
|
+
}) => void;
|
|
88
85
|
export declare const clearTableSettingToLocalStorage: (tableId?: string) => void;
|
|
89
86
|
/**
|
|
90
87
|
* 从本地存储中获取表格设置, 全部配置
|
|
@@ -115,16 +112,7 @@ export declare const setFormValuesToLocalStorage: ({ tableId, allValues, keys, c
|
|
|
115
112
|
keys?: string[] | undefined;
|
|
116
113
|
currentViewMode: ModeType;
|
|
117
114
|
currentSettingHash: string;
|
|
118
|
-
}) =>
|
|
119
|
-
key: string;
|
|
120
|
-
value: Record<string, any>;
|
|
121
|
-
} | undefined;
|
|
122
|
-
/**
|
|
123
|
-
* 获取表格键值
|
|
124
|
-
* @param tableId 表格ID
|
|
125
|
-
* @returns 返回格式化后的表格键值
|
|
126
|
-
*/
|
|
127
|
-
export declare const getTableKey: (tableId: string) => string;
|
|
115
|
+
}) => void;
|
|
128
116
|
/**
|
|
129
117
|
* 合并筛选设置
|
|
130
118
|
* @param list 列表数据
|
|
@@ -167,7 +155,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
|
|
|
167
155
|
sort?: SortType | undefined;
|
|
168
156
|
mode: "" | "localStorage" | "remote";
|
|
169
157
|
currentViewMode: ModeType;
|
|
170
|
-
}) => ("
|
|
158
|
+
}) => ("view_mode" | "column_setting" | "order_by" | "group_by" | "gallery_setting" | "filter_setting")[];
|
|
171
159
|
export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
|
|
172
160
|
export declare const stringify: (obj: Record<string, any>) => string;
|
|
173
161
|
export {};
|
|
@@ -271,10 +271,6 @@ export var setTableSettingToLocalStorage = function setTableSettingToLocalStorag
|
|
|
271
271
|
currentSettingHash: currentSettingHash
|
|
272
272
|
}, currentViewMode, _objectSpread(_objectSpread({}, newData[currentViewMode] || {}), itemSetting)));
|
|
273
273
|
localStorage.setItem(getTableKey(tableId), JSON.stringify(newData));
|
|
274
|
-
return {
|
|
275
|
-
key: getTableKey(tableId),
|
|
276
|
-
value: newData
|
|
277
|
-
};
|
|
278
274
|
};
|
|
279
275
|
export var clearTableSettingToLocalStorage = function clearTableSettingToLocalStorage(tableId) {
|
|
280
276
|
if (!tableId) return;
|
|
@@ -331,7 +327,7 @@ export var setFormValuesToLocalStorage = function setFormValuesToLocalStorage(_r
|
|
|
331
327
|
keys === null || keys === void 0 ? void 0 : keys.forEach(function (key) {
|
|
332
328
|
obj[key] = allValues === null || allValues === void 0 ? void 0 : allValues[key];
|
|
333
329
|
});
|
|
334
|
-
|
|
330
|
+
setTableSettingToLocalStorage({
|
|
335
331
|
tableId: tableId,
|
|
336
332
|
tableSettingObj: obj,
|
|
337
333
|
currentViewMode: currentViewMode,
|
|
@@ -344,7 +340,7 @@ export var setFormValuesToLocalStorage = function setFormValuesToLocalStorage(_r
|
|
|
344
340
|
* @param tableId 表格ID
|
|
345
341
|
* @returns 返回格式化后的表格键值
|
|
346
342
|
*/
|
|
347
|
-
|
|
343
|
+
var getTableKey = function getTableKey(tableId) {
|
|
348
344
|
return "".concat(tableKeyPrefix, "-").concat(tableId);
|
|
349
345
|
};
|
|
350
346
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { GridViewProps } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { GridViewProps } from "../types";
|
|
3
3
|
declare const View: (props: GridViewProps & {
|
|
4
4
|
setTableSetting: (values: Record<string, any>) => void;
|
|
5
5
|
}) => React.JSX.Element;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
var _excluded = ["dataSource", "columns", "dispatch", "style", "filter", "sort", "buttons", "actionButtons", "title", "summary", "onValuesChange", "columnSetting", "dataSourceGroup", "view", "gallery", "setTableSetting", "onDataSourceChange"];
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
|
-
import React
|
|
5
|
-
import { Form } from
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { Form } from "antd";
|
|
6
6
|
import GridViewTable from "../Table";
|
|
7
7
|
import Gallery from "../Gallery";
|
|
8
|
-
import { stringify } from "../Table/utils";
|
|
9
8
|
var View = function View(props) {
|
|
10
9
|
var dataSource = props.dataSource,
|
|
11
10
|
columns = props.columns,
|
|
@@ -26,25 +25,22 @@ var View = function View(props) {
|
|
|
26
25
|
onDataSourceChange = props.onDataSourceChange,
|
|
27
26
|
other = _objectWithoutProperties(props, _excluded);
|
|
28
27
|
var form = Form.useFormInstance();
|
|
29
|
-
var viewMode = Form.useWatch(
|
|
28
|
+
var viewMode = Form.useWatch("view_mode", {
|
|
30
29
|
form: form,
|
|
31
30
|
preserve: true
|
|
32
31
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}));
|
|
47
|
-
}, [viewMode, stringify(other), filter, onDataSourceChange, gallery]);
|
|
48
|
-
return memoContent;
|
|
32
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, viewMode === "grid" && /*#__PURE__*/React.createElement(GridViewTable, {
|
|
33
|
+
tableProps: other,
|
|
34
|
+
filter: filter,
|
|
35
|
+
setTableSetting: setTableSetting,
|
|
36
|
+
onDataSourceChange: onDataSourceChange
|
|
37
|
+
}), viewMode === "gallery" && /*#__PURE__*/React.createElement(Gallery, {
|
|
38
|
+
loading: other === null || other === void 0 ? void 0 : other.loading,
|
|
39
|
+
gallery: gallery,
|
|
40
|
+
pagination: other.pagination,
|
|
41
|
+
filter: filter,
|
|
42
|
+
rowKey: other.rowKey,
|
|
43
|
+
onDataSourceChange: onDataSourceChange
|
|
44
|
+
}));
|
|
49
45
|
};
|
|
50
46
|
export default View;
|
|
@@ -6,10 +6,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
6
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
import { useMemo } from "react";
|
|
8
8
|
import { getSettingKeyArrByMode, getTableSettingByCurrentViewMode, getTableSettingFromLocalStorage, mergeColumnSetting, mergeFilterSetting, setFormValuesToLocalStorage } from "../Table/utils";
|
|
9
|
-
import useEngineContext from "../../../hooks/useEngineContext";
|
|
10
|
-
import { useMemoizedFn } from "ahooks";
|
|
11
9
|
var useTableSetting = function useTableSetting(params) {
|
|
12
|
-
var _context$appHelper;
|
|
13
10
|
var tableId = params.tableId,
|
|
14
11
|
filter = params.filter,
|
|
15
12
|
columnSetting = params.columnSetting,
|
|
@@ -21,10 +18,6 @@ var useTableSetting = function useTableSetting(params) {
|
|
|
21
18
|
gallery = params.gallery,
|
|
22
19
|
currentSettingHash = params.currentSettingHash,
|
|
23
20
|
exportImport = params.exportImport;
|
|
24
|
-
var context = useEngineContext();
|
|
25
|
-
var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
|
26
|
-
isTerminal = _ref.isTerminal,
|
|
27
|
-
interaction = _ref.interaction;
|
|
28
21
|
var columnsMap = useMemo(function () {
|
|
29
22
|
return new Map(propsColumns.map(function (item) {
|
|
30
23
|
return [item.key, item];
|
|
@@ -45,10 +38,10 @@ var useTableSetting = function useTableSetting(params) {
|
|
|
45
38
|
}
|
|
46
39
|
return propsColumns;
|
|
47
40
|
}, [propsColumns, currentViewMode, gallery, columnsMap]);
|
|
48
|
-
var
|
|
49
|
-
list =
|
|
50
|
-
quickFilterMaxLength =
|
|
51
|
-
sortButtonShow =
|
|
41
|
+
var _ref = filter || {},
|
|
42
|
+
list = _ref.list,
|
|
43
|
+
quickFilterMaxLength = _ref.quickFilterMaxLength,
|
|
44
|
+
sortButtonShow = _ref.sortButtonShow;
|
|
52
45
|
var defaultGalleryCoverSetting = useMemo(function () {
|
|
53
46
|
var _gallery$cover, _columns$find;
|
|
54
47
|
return {
|
|
@@ -163,30 +156,15 @@ var useTableSetting = function useTableSetting(params) {
|
|
|
163
156
|
* 更新 tableSetting
|
|
164
157
|
* @param values
|
|
165
158
|
*/
|
|
166
|
-
var setTableSetting =
|
|
167
|
-
|
|
159
|
+
var setTableSetting = function setTableSetting(values) {
|
|
160
|
+
setFormValuesToLocalStorage({
|
|
168
161
|
tableId: tableId,
|
|
169
162
|
allValues: values,
|
|
170
163
|
keys: localStorageSettingKeyArr,
|
|
171
164
|
currentViewMode: currentViewMode,
|
|
172
165
|
currentSettingHash: currentSettingHash
|
|
173
166
|
});
|
|
174
|
-
|
|
175
|
-
if (isTerminal?.() && result) {
|
|
176
|
-
interaction?.utils?.postMessageToApp?.({
|
|
177
|
-
module: "global",
|
|
178
|
-
key: "local_storage",
|
|
179
|
-
data: {
|
|
180
|
-
type: "set",
|
|
181
|
-
value: {
|
|
182
|
-
[result.key]: result.value
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
})
|
|
186
|
-
}
|
|
187
|
-
*/
|
|
188
|
-
});
|
|
189
|
-
|
|
167
|
+
};
|
|
190
168
|
var tableSetting = useMemo(function () {
|
|
191
169
|
return _objectSpread(_objectSpread({}, tableLocalSetting), defaultTableSetting);
|
|
192
170
|
}, [tableLocalSetting, defaultTableSetting]);
|