@pisell/materials 6.4.7 → 6.4.8
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 +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +6 -6
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +8 -8
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/batch-editor/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +11 -4
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +7 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +9 -10
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +11 -4
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +2 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +92 -6
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +12 -11
- package/es/components/date-picker/index.d.ts +1 -0
- package/es/components/filter/types.d.ts +1 -0
- package/es/components/page/index.d.ts +1 -0
- package/es/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +1 -0
- package/es/components/productCard/cartSkuCard/components/swipeAction/index.js +73 -5
- package/es/components/productCard/cartSkuCard/components/swipeAction/index.less +39 -0
- package/es/components/productCard/cartSkuCard/index.js +2 -11
- package/es/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/es/components/table/Table/SelectField/index.d.ts +1 -0
- package/es/components/table/Table/fields/index.d.ts +1 -0
- package/es/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/fields/text/Show/index.d.ts +1 -0
- package/es/components/table/Table/fields/text/index.d.ts +1 -0
- package/es/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/components/table/Table/utils.js +22 -1
- package/es/components/table/hooks/useTableSetting.d.ts +3 -4
- package/es/components/table/hooks/useTableSetting.js +113 -5
- package/es/components/table/index.js +14 -3
- package/es/components/table/types.d.ts +17 -0
- package/es/utils/index.d.ts +1 -1
- package/lib/components/batch-editor/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +8 -2
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +7 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +9 -10
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +11 -4
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +2 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +78 -7
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +12 -11
- package/lib/components/date-picker/index.d.ts +1 -0
- package/lib/components/filter/types.d.ts +1 -0
- package/lib/components/page/index.d.ts +1 -0
- package/lib/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +1 -0
- package/lib/components/productCard/cartSkuCard/components/swipeAction/index.js +45 -11
- package/lib/components/productCard/cartSkuCard/components/swipeAction/index.less +39 -0
- package/lib/components/productCard/cartSkuCard/index.js +2 -13
- package/lib/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/lib/components/table/Table/SelectField/index.d.ts +1 -0
- package/lib/components/table/Table/fields/index.d.ts +1 -0
- package/lib/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/fields/text/Show/index.d.ts +1 -0
- package/lib/components/table/Table/fields/text/index.d.ts +1 -0
- package/lib/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/components/table/Table/utils.js +18 -1
- package/lib/components/table/hooks/useTableSetting.d.ts +3 -4
- package/lib/components/table/hooks/useTableSetting.js +114 -4
- package/lib/components/table/index.js +12 -1
- package/lib/components/table/types.d.ts +17 -0
- package/lib/utils/index.d.ts +1 -1
- package/lowcode/data-source-table/meta.ts +239 -0
- package/lowcode/table/meta.ts +104 -0
- package/package.json +3 -3
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.d.ts +0 -3
- package/es/components/dataSourceComponents/fields/Upload/type.d.ts +0 -37
- package/es/components/drag-sort-tree/TreeItem/index.d.ts +0 -18
- package/es/components/iconfont/index.d.ts +0 -8
- package/es/components/pisell-config-provider/context.d.ts +0 -22
- package/es/components/pisell-config-provider/index.d.ts +0 -13
- package/es/components/pisellAdjustPrice/status.d.ts +0 -32
- package/es/components/pisellAdjustPrice/type.d.ts +0 -22
- package/es/components/pisellToast/squareToast/index.d.ts +0 -15
- package/es/components/pisellToast/squareToast/methods.d.ts +0 -13
- package/es/components/pisellToast/squareToast/renderImperatively.d.ts +0 -29
- package/es/components/pisellToast/squareToast/toast.d.ts +0 -25
- package/es/components/productCard/cartSkuCard/components/MultiDay/index.d.ts +0 -3
- package/es/components/productCard/cartSkuCard/components/MultiDay/utils.d.ts +0 -14
- package/es/components/productCard/cartSkuCard/components/holders/index.d.ts +0 -3
- package/es/components/productCard/cartSkuCard/components/resources/index.d.ts +0 -3
- package/es/components/productCard/cartSkuCard/components/timeRange/index.d.ts +0 -6
- package/es/components/productCard/cartSkuCard/locales.d.ts +0 -96
- package/es/components/productCard/components/Action/index.d.ts +0 -3
- package/es/components/productCard/locales.d.ts +0 -84
- package/es/components/productCard/status.d.ts +0 -32
- package/es/components/productCard/types.d.ts +0 -84
- package/es/components/virtual-keyboard/Amount/themeConfig.d.ts +0 -32
- package/es/components/virtual-keyboard/Amount/types.d.ts +0 -44
- package/es/components/virtual-keyboard/Keyboard/index.d.ts +0 -21
- package/es/components/virtual-keyboard/Number/themeConfig.d.ts +0 -32
- package/es/components/virtual-keyboard/Number/types.d.ts +0 -26
- package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +0 -13
- package/es/components/walletCard/Guide/index.d.ts +0 -3
- package/es/components/walletCard/index.d.ts +0 -67
- package/es/locales/en-US.d.ts +0 -285
- package/es/locales/zh-CN.d.ts +0 -280
- package/es/locales/zh-TW.d.ts +0 -280
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.d.ts +0 -3
- package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +0 -37
- package/lib/components/drag-sort-tree/TreeItem/index.d.ts +0 -18
- package/lib/components/iconfont/index.d.ts +0 -8
- package/lib/components/pisell-config-provider/context.d.ts +0 -22
- package/lib/components/pisell-config-provider/index.d.ts +0 -13
- package/lib/components/pisellAdjustPrice/status.d.ts +0 -32
- package/lib/components/pisellAdjustPrice/type.d.ts +0 -22
- package/lib/components/pisellToast/squareToast/index.d.ts +0 -15
- package/lib/components/pisellToast/squareToast/methods.d.ts +0 -13
- package/lib/components/pisellToast/squareToast/renderImperatively.d.ts +0 -29
- package/lib/components/pisellToast/squareToast/toast.d.ts +0 -25
- package/lib/components/productCard/cartSkuCard/components/MultiDay/index.d.ts +0 -3
- package/lib/components/productCard/cartSkuCard/components/MultiDay/utils.d.ts +0 -14
- package/lib/components/productCard/cartSkuCard/components/holders/index.d.ts +0 -3
- package/lib/components/productCard/cartSkuCard/components/resources/index.d.ts +0 -3
- package/lib/components/productCard/cartSkuCard/components/timeRange/index.d.ts +0 -6
- package/lib/components/productCard/cartSkuCard/locales.d.ts +0 -96
- package/lib/components/productCard/components/Action/index.d.ts +0 -3
- package/lib/components/productCard/locales.d.ts +0 -84
- package/lib/components/productCard/status.d.ts +0 -32
- package/lib/components/productCard/types.d.ts +0 -84
- package/lib/components/virtual-keyboard/Amount/themeConfig.d.ts +0 -32
- package/lib/components/virtual-keyboard/Amount/types.d.ts +0 -44
- package/lib/components/virtual-keyboard/Keyboard/index.d.ts +0 -21
- package/lib/components/virtual-keyboard/Number/themeConfig.d.ts +0 -32
- package/lib/components/virtual-keyboard/Number/types.d.ts +0 -26
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +0 -13
- package/lib/components/walletCard/Guide/index.d.ts +0 -3
- package/lib/components/walletCard/index.d.ts +0 -67
- package/lib/locales/en-US.d.ts +0 -285
- package/lib/locales/zh-CN.d.ts +0 -280
- package/lib/locales/zh-TW.d.ts +0 -280
|
@@ -13,7 +13,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
13
13
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
14
|
import { animated, useSpring } from '@react-spring/web';
|
|
15
15
|
import { useDrag } from '@use-gesture/react/dist/use-gesture-react.cjs';
|
|
16
|
-
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
16
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
17
|
+
|
|
17
18
|
// 本地实现的工具函数和类型
|
|
18
19
|
|
|
19
20
|
// withNativeProps 工具函数
|
|
@@ -85,17 +86,35 @@ export var SwipeAction = /*#__PURE__*/forwardRef(function (p, ref) {
|
|
|
85
86
|
var rootRef = useRef(null);
|
|
86
87
|
var leftRef = useRef(null);
|
|
87
88
|
var rightRef = useRef(null);
|
|
89
|
+
|
|
90
|
+
// 添加容器高度状态
|
|
91
|
+
var _useState = useState(0),
|
|
92
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
93
|
+
containerHeight = _useState2[0],
|
|
94
|
+
setContainerHeight = _useState2[1];
|
|
88
95
|
function getWidth(ref) {
|
|
89
96
|
var element = ref.current;
|
|
90
97
|
if (!element) return 0;
|
|
91
98
|
return element.offsetWidth;
|
|
92
99
|
}
|
|
100
|
+
|
|
101
|
+
// 添加获取高度的函数
|
|
102
|
+
function getHeight(ref) {
|
|
103
|
+
var element = ref.current;
|
|
104
|
+
if (!element) return 0;
|
|
105
|
+
return element.offsetHeight;
|
|
106
|
+
}
|
|
93
107
|
function getLeftWidth() {
|
|
94
108
|
return getWidth(leftRef);
|
|
95
109
|
}
|
|
96
110
|
function getRightWidth() {
|
|
97
111
|
return getWidth(rightRef);
|
|
98
112
|
}
|
|
113
|
+
|
|
114
|
+
// 添加获取根容器高度的函数
|
|
115
|
+
function getRootHeight() {
|
|
116
|
+
return getHeight(rootRef);
|
|
117
|
+
}
|
|
99
118
|
var _useSpring = useSpring(function () {
|
|
100
119
|
return {
|
|
101
120
|
x: 0,
|
|
@@ -198,6 +217,26 @@ export var SwipeAction = /*#__PURE__*/forwardRef(function (p, ref) {
|
|
|
198
217
|
close: close
|
|
199
218
|
};
|
|
200
219
|
});
|
|
220
|
+
|
|
221
|
+
// 添加高度检测的 useEffect
|
|
222
|
+
useEffect(function () {
|
|
223
|
+
var updateHeight = function updateHeight() {
|
|
224
|
+
var height = getRootHeight();
|
|
225
|
+
setContainerHeight(height);
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// 组件挂载后检测高度
|
|
229
|
+
updateHeight();
|
|
230
|
+
|
|
231
|
+
// 监听窗口大小变化
|
|
232
|
+
var resizeObserver = new ResizeObserver(updateHeight);
|
|
233
|
+
if (rootRef.current) {
|
|
234
|
+
resizeObserver.observe(rootRef.current);
|
|
235
|
+
}
|
|
236
|
+
return function () {
|
|
237
|
+
resizeObserver.disconnect();
|
|
238
|
+
};
|
|
239
|
+
}, []);
|
|
201
240
|
useEffect(function () {
|
|
202
241
|
if (!props.closeOnTouchOutside) return;
|
|
203
242
|
function handle(e) {
|
|
@@ -224,13 +263,38 @@ export var SwipeAction = /*#__PURE__*/forwardRef(function (p, ref) {
|
|
|
224
263
|
document.removeEventListener('mousedown', handle);
|
|
225
264
|
};
|
|
226
265
|
}, [props.closeOnTouchOutside, props.escapeDom]);
|
|
266
|
+
|
|
267
|
+
// 根据容器高度获取右侧容器的 class 名称
|
|
268
|
+
var getRightContainerClass = function getRightContainerClass() {
|
|
269
|
+
var baseClass = "".concat(classPrefix, "-actions ").concat(classPrefix, "-actions-right");
|
|
270
|
+
if (containerHeight > 180) {
|
|
271
|
+
return "".concat(baseClass, " ").concat(classPrefix, "-height-large");
|
|
272
|
+
} else if (containerHeight > 120) {
|
|
273
|
+
return "".concat(baseClass, " ").concat(classPrefix, "-height-medium");
|
|
274
|
+
}
|
|
275
|
+
return "".concat(baseClass, " ").concat(classPrefix, "-height-small");
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// 根据容器高度获取右侧按钮的 class 名称
|
|
279
|
+
var getRightActionButtonClass = function getRightActionButtonClass() {
|
|
280
|
+
if (containerHeight > 180) {
|
|
281
|
+
return "".concat(classPrefix, "-action-height-large");
|
|
282
|
+
} else if (containerHeight > 120) {
|
|
283
|
+
return "".concat(classPrefix, "-action-height-medium");
|
|
284
|
+
}
|
|
285
|
+
return "".concat(classPrefix, "-action-height-small");
|
|
286
|
+
};
|
|
227
287
|
function renderAction(action) {
|
|
228
288
|
var _action$color, _colorRecord$color;
|
|
289
|
+
var isRightAction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
229
290
|
var color = (_action$color = action.color) !== null && _action$color !== void 0 ? _action$color : 'light';
|
|
230
291
|
var _style = action.style || {};
|
|
292
|
+
|
|
293
|
+
// 为右侧按钮添加基于高度的 class
|
|
294
|
+
var buttonClass = isRightAction ? "".concat(classPrefix, "-action-button ").concat(getRightActionButtonClass()) : "".concat(classPrefix, "-action-button");
|
|
231
295
|
return /*#__PURE__*/React.createElement(Button, {
|
|
232
296
|
key: action.key,
|
|
233
|
-
className:
|
|
297
|
+
className: buttonClass,
|
|
234
298
|
style: _objectSpread({
|
|
235
299
|
'--background-color': (_colorRecord$color = colorRecord[color]) !== null && _colorRecord$color !== void 0 ? _colorRecord$color : color
|
|
236
300
|
}, _style),
|
|
@@ -262,7 +326,9 @@ export var SwipeAction = /*#__PURE__*/forwardRef(function (p, ref) {
|
|
|
262
326
|
}, withStopPropagation(props.stopPropagation, /*#__PURE__*/React.createElement("div", {
|
|
263
327
|
className: "".concat(classPrefix, "-actions ").concat(classPrefix, "-actions-left"),
|
|
264
328
|
ref: leftRef
|
|
265
|
-
}, props.leftActions.map(
|
|
329
|
+
}, props.leftActions.map(function (action) {
|
|
330
|
+
return renderAction(action, false);
|
|
331
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
266
332
|
className: "".concat(classPrefix, "-content"),
|
|
267
333
|
onClickCapture: function onClickCapture(e) {
|
|
268
334
|
if (x.goal !== 0) {
|
|
@@ -278,9 +344,11 @@ export var SwipeAction = /*#__PURE__*/forwardRef(function (p, ref) {
|
|
|
278
344
|
})
|
|
279
345
|
}
|
|
280
346
|
}, props.children)), withStopPropagation(props.stopPropagation, /*#__PURE__*/React.createElement("div", {
|
|
281
|
-
className:
|
|
347
|
+
className: getRightContainerClass(),
|
|
282
348
|
ref: rightRef
|
|
283
|
-
}, props.rightActions.map(
|
|
349
|
+
}, props.rightActions.map(function (action) {
|
|
350
|
+
return renderAction(action, true);
|
|
351
|
+
}))))));
|
|
284
352
|
});
|
|
285
353
|
var colorRecord = {
|
|
286
354
|
light: '#ccc',
|
|
@@ -33,3 +33,42 @@
|
|
|
33
33
|
padding-right: 4px;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
.pisell-custom-swipe-action-action-button {
|
|
38
|
+
min-width: 80px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* 容器样式 */
|
|
42
|
+
.pisell-custom-swipe-action-height-large {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
background-color: rgba(67, 93, 147, 0.3);
|
|
46
|
+
justify-content: flex-start;
|
|
47
|
+
|
|
48
|
+
.pisell-number-selector-btn {
|
|
49
|
+
width: 40px !important;
|
|
50
|
+
height: 40px !important;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.pisell-custom-swipe-action-height-medium {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
background-color: rgba(67, 93, 147, 0.3);
|
|
58
|
+
|
|
59
|
+
.pisell-number-selector-btn {
|
|
60
|
+
width: 40px !important;
|
|
61
|
+
height: 40px !important;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* 按钮样式 */
|
|
66
|
+
.pisell-custom-swipe-action-action-height-large {
|
|
67
|
+
height: 60px;
|
|
68
|
+
width: 200px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.pisell-custom-swipe-action-action-height-medium {
|
|
72
|
+
flex: 1;
|
|
73
|
+
width: 200px;
|
|
74
|
+
}
|
|
@@ -175,7 +175,7 @@ var CartSkuCard = function CartSkuCard(props) {
|
|
|
175
175
|
}
|
|
176
176
|
return renderA2();
|
|
177
177
|
};
|
|
178
|
-
return /*#__PURE__*/React.createElement(
|
|
178
|
+
return /*#__PURE__*/React.createElement(SwipeAction, {
|
|
179
179
|
closeOnAction: false,
|
|
180
180
|
className: classNames("".concat(PREFIX, "-wrapper")),
|
|
181
181
|
rightActions: _rightActions,
|
|
@@ -187,15 +187,6 @@ var CartSkuCard = function CartSkuCard(props) {
|
|
|
187
187
|
e.stopPropagation();
|
|
188
188
|
onCard === null || onCard === void 0 || onCard(dataSource);
|
|
189
189
|
}
|
|
190
|
-
}, renderContent()))
|
|
191
|
-
className: classNames("".concat(PREFIX, "-wrapper"))
|
|
192
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
193
|
-
className: classNames(PREFIX, "".concat(PREFIX, "-").concat(type)),
|
|
194
|
-
onClick: function onClick(e) {
|
|
195
|
-
e.preventDefault();
|
|
196
|
-
e.stopPropagation();
|
|
197
|
-
onCard === null || onCard === void 0 || onCard(dataSource);
|
|
198
|
-
}
|
|
199
|
-
}, renderContent())));
|
|
190
|
+
}, renderContent()));
|
|
200
191
|
};
|
|
201
192
|
export default CartSkuCard;
|
|
@@ -155,7 +155,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
|
|
|
155
155
|
sort?: SortType | undefined;
|
|
156
156
|
mode: "" | "localStorage" | "remote";
|
|
157
157
|
currentViewMode: ModeType;
|
|
158
|
-
}) => ("
|
|
158
|
+
}) => ("filters" | "order_by" | "group_by" | "column_setting" | "gallery_setting" | "filter_setting" | "view_mode")[];
|
|
159
159
|
export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
|
|
160
160
|
export declare const stringify: (obj: Record<string, any>) => string;
|
|
161
161
|
export {};
|
|
@@ -347,7 +347,28 @@ export var setFormValuesToLocalStorage = function setFormValuesToLocalStorage(_r
|
|
|
347
347
|
* @returns 返回格式化后的表格键值
|
|
348
348
|
*/
|
|
349
349
|
var getTableKey = function getTableKey(tableId) {
|
|
350
|
-
|
|
350
|
+
// 兼容非浏览器环境(如SSR/测试)
|
|
351
|
+
if (typeof window === "undefined" || typeof window.location === "undefined") {
|
|
352
|
+
return "".concat(tableKeyPrefix, "-").concat(tableId);
|
|
353
|
+
}
|
|
354
|
+
var _window$location = window.location,
|
|
355
|
+
pathname = _window$location.pathname,
|
|
356
|
+
search = _window$location.search;
|
|
357
|
+
var appendPath = pathname || "/";
|
|
358
|
+
|
|
359
|
+
// 仅用于读取 memory_key,其余查询参数忽略
|
|
360
|
+
var memoryKey = "";
|
|
361
|
+
try {
|
|
362
|
+
var _params = new URLSearchParams(search || "");
|
|
363
|
+
var mk = _params.get("memory_key");
|
|
364
|
+
if (mk && mk.trim() !== "") {
|
|
365
|
+
memoryKey = mk.trim();
|
|
366
|
+
}
|
|
367
|
+
} catch (e) {
|
|
368
|
+
// 忽略解析异常,降级为仅使用 pathname
|
|
369
|
+
}
|
|
370
|
+
var urlPart = memoryKey ? "".concat(appendPath, "#").concat(memoryKey) : appendPath;
|
|
371
|
+
return "".concat(tableKeyPrefix, "-").concat(tableId, "-").concat(urlPart);
|
|
351
372
|
};
|
|
352
373
|
|
|
353
374
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FilterType } from "../../filter/types";
|
|
2
|
-
import { ColumnSettingType, DataSourceGroupType, GallerySettingType, GridViewType, ModeType, SortType, ExportImportModeType } from "../types";
|
|
2
|
+
import { ColumnSettingType, DataSourceGroupType, GallerySettingType, GridViewType, ModeType, SortType, ExportImportModeType, LocalSettingsType } from "../types";
|
|
3
3
|
declare type UseTableSettingProps = {
|
|
4
4
|
tableId?: string;
|
|
5
5
|
filter: FilterType;
|
|
@@ -12,11 +12,10 @@ declare type UseTableSettingProps = {
|
|
|
12
12
|
gallery?: GallerySettingType;
|
|
13
13
|
currentSettingHash: string;
|
|
14
14
|
exportImport?: ExportImportModeType;
|
|
15
|
+
localSettings?: LocalSettingsType;
|
|
15
16
|
};
|
|
16
17
|
declare const useTableSetting: (params: UseTableSettingProps) => {
|
|
17
18
|
setTableSetting: (values: Record<string, any>) => void;
|
|
18
|
-
tableSetting:
|
|
19
|
-
[x: string]: any;
|
|
20
|
-
};
|
|
19
|
+
tableSetting: any;
|
|
21
20
|
};
|
|
22
21
|
export default useTableSetting;
|
|
@@ -5,8 +5,9 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { useMemo } from "react";
|
|
8
|
-
import { getSettingKeyArrByMode, getTableSettingByCurrentViewMode, getTableSettingFromLocalStorage, mergeColumnSetting, mergeFilterSetting, setFormValuesToLocalStorage } from "../Table/utils";
|
|
8
|
+
import { getSettingKeyArrByMode, getTableSettingByCurrentViewMode, getTableSettingFromLocalStorage, mergeColumnSetting, mergeFilterSetting, setTableSettingToLocalStorage, setFormValuesToLocalStorage } from "../Table/utils";
|
|
9
9
|
import { useMemoizedFn } from "ahooks";
|
|
10
|
+
import React from "react";
|
|
10
11
|
var useTableSetting = function useTableSetting(params) {
|
|
11
12
|
var tableId = params.tableId,
|
|
12
13
|
filter = params.filter,
|
|
@@ -18,7 +19,8 @@ var useTableSetting = function useTableSetting(params) {
|
|
|
18
19
|
propsColumns = params.columns,
|
|
19
20
|
gallery = params.gallery,
|
|
20
21
|
currentSettingHash = params.currentSettingHash,
|
|
21
|
-
exportImport = params.exportImport
|
|
22
|
+
exportImport = params.exportImport,
|
|
23
|
+
localSettings = params.localSettings;
|
|
22
24
|
var columnsMap = useMemo(function () {
|
|
23
25
|
return new Map(propsColumns.map(function (item) {
|
|
24
26
|
return [item.key, item];
|
|
@@ -60,7 +62,8 @@ var useTableSetting = function useTableSetting(params) {
|
|
|
60
62
|
* 获取需要本地存储的 keyArr
|
|
61
63
|
*/
|
|
62
64
|
var localStorageSettingKeyArr = useMemo(function () {
|
|
63
|
-
|
|
65
|
+
var _localSettings$scope;
|
|
66
|
+
var keys = getSettingKeyArrByMode({
|
|
64
67
|
filter: filter,
|
|
65
68
|
columnSetting: columnSetting,
|
|
66
69
|
dataSourceGroup: dataSourceGroup,
|
|
@@ -68,6 +71,13 @@ var useTableSetting = function useTableSetting(params) {
|
|
|
68
71
|
mode: "localStorage",
|
|
69
72
|
currentViewMode: currentViewMode
|
|
70
73
|
});
|
|
74
|
+
// 本地记忆:filters 范围 -> 存储到 filter 字段
|
|
75
|
+
if (localSettings !== null && localSettings !== void 0 && localSettings.enable && (_localSettings$scope = localSettings.scope) !== null && _localSettings$scope !== void 0 && _localSettings$scope.includes("filters")) {
|
|
76
|
+
if (!keys.includes("filters")) {
|
|
77
|
+
keys.push("filters");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return keys;
|
|
71
81
|
}, [tableId, filter, columnSetting, dataSourceGroup, sort, currentViewMode]);
|
|
72
82
|
var defaultKeyArr = useMemo(function () {
|
|
73
83
|
return getSettingKeyArrByMode({
|
|
@@ -117,6 +127,8 @@ var useTableSetting = function useTableSetting(params) {
|
|
|
117
127
|
compactMode: (mergedSetting === null || mergedSetting === void 0 || (_mergedSetting$item3 = mergedSetting[item]) === null || _mergedSetting$item3 === void 0 ? void 0 : _mergedSetting$item3.compactMode) || defaultGalleryCoverSetting.compactMode,
|
|
118
128
|
isShowLabel: (_mergedSetting$item$i = mergedSetting === null || mergedSetting === void 0 || (_mergedSetting$item4 = mergedSetting[item]) === null || _mergedSetting$item4 === void 0 ? void 0 : _mergedSetting$item4.isShowLabel) !== null && _mergedSetting$item$i !== void 0 ? _mergedSetting$item$i : defaultGalleryCoverSetting.isShowLabel
|
|
119
129
|
});
|
|
130
|
+
} else if (item === "filters") {
|
|
131
|
+
setting[item] = (mergedSetting === null || mergedSetting === void 0 ? void 0 : mergedSetting[item]) || {};
|
|
120
132
|
} else {
|
|
121
133
|
setting[item] = mergedSetting === null || mergedSetting === void 0 ? void 0 : mergedSetting[item];
|
|
122
134
|
}
|
|
@@ -158,17 +170,113 @@ var useTableSetting = function useTableSetting(params) {
|
|
|
158
170
|
* @param values
|
|
159
171
|
*/
|
|
160
172
|
var setTableSetting = useMemoizedFn(function (values) {
|
|
173
|
+
var _localSettings$scope2;
|
|
174
|
+
// 计算需要存储的 filter 值(仅当开启本地记忆且包含 filters 时)
|
|
175
|
+
var valuesForSave = values;
|
|
176
|
+
if (localSettings !== null && localSettings !== void 0 && localSettings.enable && (_localSettings$scope2 = localSettings.scope) !== null && _localSettings$scope2 !== void 0 && _localSettings$scope2.includes("filters")) {
|
|
177
|
+
var excluded = new Set((localSettings === null || localSettings === void 0 ? void 0 : localSettings.excludedFilterFields) || []);
|
|
178
|
+
var filterValue = {};
|
|
179
|
+
((filter === null || filter === void 0 ? void 0 : filter.list) || []).forEach(function (item) {
|
|
180
|
+
var rawName = item === null || item === void 0 ? void 0 : item.name;
|
|
181
|
+
if (!rawName) return;
|
|
182
|
+
var key = Array.isArray(rawName) ? rawName.join(",") : String(rawName);
|
|
183
|
+
if (excluded.has(key)) return;
|
|
184
|
+
if (values.hasOwnProperty(key)) {
|
|
185
|
+
filterValue[key] = values[key];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
valuesForSave = _objectSpread(_objectSpread({}, values), {}, {
|
|
189
|
+
filters: filterValue
|
|
190
|
+
});
|
|
191
|
+
}
|
|
161
192
|
setFormValuesToLocalStorage({
|
|
162
193
|
tableId: tableId,
|
|
163
|
-
allValues:
|
|
194
|
+
allValues: valuesForSave,
|
|
164
195
|
keys: localStorageSettingKeyArr,
|
|
165
196
|
currentViewMode: currentViewMode,
|
|
166
197
|
currentSettingHash: currentSettingHash
|
|
167
198
|
});
|
|
168
199
|
});
|
|
169
200
|
var tableSetting = useMemo(function () {
|
|
170
|
-
|
|
201
|
+
var _localSettings$scope3;
|
|
202
|
+
var merged = _objectSpread(_objectSpread({}, tableLocalSetting), defaultTableSetting);
|
|
203
|
+
// 将本地记忆的 filter 扁平化注入初始表单值(不改变存储结构)
|
|
204
|
+
if (localSettings !== null && localSettings !== void 0 && localSettings.enable && (_localSettings$scope3 = localSettings.scope) !== null && _localSettings$scope3 !== void 0 && _localSettings$scope3.includes("filters")) {
|
|
205
|
+
var persistedFilter = tableLocalSetting === null || tableLocalSetting === void 0 ? void 0 : tableLocalSetting.filters;
|
|
206
|
+
if (persistedFilter && _typeof(persistedFilter) === "object") {
|
|
207
|
+
return _objectSpread(_objectSpread({}, merged), persistedFilter);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return merged;
|
|
171
211
|
}, [tableLocalSetting, defaultTableSetting]);
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* 当刷新后获得新的 localSettings(scope 或 excludedFilterFields 变化)时,
|
|
215
|
+
* 根据最新规则调整已存储的 filters
|
|
216
|
+
*/
|
|
217
|
+
// 对本地已存储 filters 做一次对齐(仅在必要时写回)
|
|
218
|
+
useMemo(function () {
|
|
219
|
+
try {
|
|
220
|
+
var _localSettings$scope4;
|
|
221
|
+
if (!tableId) return;
|
|
222
|
+
var current = getTableSettingByCurrentViewMode(tableId, currentViewMode) || {};
|
|
223
|
+
var persistedFilters = (current === null || current === void 0 ? void 0 : current.filters) || {};
|
|
224
|
+
var nextFilters = _objectSpread({}, persistedFilters);
|
|
225
|
+
var shouldUpdate = false;
|
|
226
|
+
var enableFiltersMemory = !!(localSettings !== null && localSettings !== void 0 && localSettings.enable && (_localSettings$scope4 = localSettings.scope) !== null && _localSettings$scope4 !== void 0 && _localSettings$scope4.includes("filters"));
|
|
227
|
+
if (!enableFiltersMemory) {
|
|
228
|
+
if (Object.keys(persistedFilters || {}).length > 0) {
|
|
229
|
+
nextFilters = {};
|
|
230
|
+
shouldUpdate = true;
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
var names = new Set();
|
|
234
|
+
if ( /*#__PURE__*/React.isValidElement(filter)) {
|
|
235
|
+
names = new Set(((filter === null || filter === void 0 ? void 0 : filter.items) || []).filter(function (item) {
|
|
236
|
+
return !item.isHidden;
|
|
237
|
+
}).map(function (item) {
|
|
238
|
+
var rawName = item === null || item === void 0 ? void 0 : item.value;
|
|
239
|
+
if (!rawName) return undefined;
|
|
240
|
+
return Array.isArray(rawName) ? rawName.join(",") : String(rawName);
|
|
241
|
+
}));
|
|
242
|
+
} else {
|
|
243
|
+
names = new Set(((filter === null || filter === void 0 ? void 0 : filter.list) || []).map(function (item) {
|
|
244
|
+
var rawName = item === null || item === void 0 ? void 0 : item.name;
|
|
245
|
+
if (!rawName) return undefined;
|
|
246
|
+
return Array.isArray(rawName) ? rawName.join(",") : String(rawName);
|
|
247
|
+
}).filter(Boolean));
|
|
248
|
+
}
|
|
249
|
+
var excluded = new Set((localSettings === null || localSettings === void 0 ? void 0 : localSettings.excludedFilterFields) || []);
|
|
250
|
+
var allowed = new Set(Array.from(names).filter(function (k) {
|
|
251
|
+
return !excluded.has(k);
|
|
252
|
+
}));
|
|
253
|
+
var filtered = {};
|
|
254
|
+
Object.keys(persistedFilters || {}).forEach(function (k) {
|
|
255
|
+
if (allowed.has(k)) {
|
|
256
|
+
filtered[k] = persistedFilters[k];
|
|
257
|
+
} else {
|
|
258
|
+
shouldUpdate = true;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
if (Object.keys(filtered).length !== Object.keys(persistedFilters || {}).length) {
|
|
262
|
+
shouldUpdate = true;
|
|
263
|
+
}
|
|
264
|
+
nextFilters = filtered;
|
|
265
|
+
}
|
|
266
|
+
if (shouldUpdate) {
|
|
267
|
+
setTableSettingToLocalStorage({
|
|
268
|
+
tableId: tableId,
|
|
269
|
+
tableSettingObj: {
|
|
270
|
+
filters: nextFilters
|
|
271
|
+
},
|
|
272
|
+
currentViewMode: currentViewMode,
|
|
273
|
+
currentSettingHash: currentSettingHash
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
} catch (e) {
|
|
277
|
+
// ignore
|
|
278
|
+
}
|
|
279
|
+
}, []);
|
|
172
280
|
return {
|
|
173
281
|
setTableSetting: setTableSetting,
|
|
174
282
|
tableSetting: tableSetting
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["dataSource", "columns", "dispatch", "style", "filter", "sort", "buttons", "actionButtons", "title", "showTitle", "subTitle", "showSubTitle", "summary", "onValuesChange", "columnSetting", "dataSourceGroup", "view", "gallery", "currentSettingKey", "exportImport", "currentComponentId", "tabs"];
|
|
2
|
+
var _excluded = ["dataSource", "columns", "dispatch", "style", "filter", "sort", "buttons", "actionButtons", "title", "showTitle", "subTitle", "showSubTitle", "summary", "onValuesChange", "columnSetting", "dataSourceGroup", "localSettings", "view", "gallery", "currentSettingKey", "exportImport", "currentComponentId", "tabs"];
|
|
3
3
|
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
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -24,7 +24,7 @@ import useEngineContext from "../../hooks/useEngineContext";
|
|
|
24
24
|
import Actions from "./Actions";
|
|
25
25
|
import Header from "./Header";
|
|
26
26
|
import Summary from "./Summary";
|
|
27
|
-
import { clearTableSettingToLocalStorage, getCurrentViewModeFromLocalStorage, getHash, getTableSettingFromLocalStorage, mergeColumnSetting, omit, stringify } from "./Table/utils";
|
|
27
|
+
import { clearTableSettingToLocalStorage, getCurrentViewModeFromLocalStorage, getTableSettingByCurrentViewMode, getHash, getTableSettingFromLocalStorage, mergeColumnSetting, omit, stringify } from "./Table/utils";
|
|
28
28
|
import View from "./View";
|
|
29
29
|
import useTableSetting from "./hooks/useTableSetting";
|
|
30
30
|
import useTransDataSourceGroupSetting from "./hooks/useTransDataSourceGroupSetting";
|
|
@@ -58,6 +58,7 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
58
58
|
_onValuesChange = props.onValuesChange,
|
|
59
59
|
columnSetting = props.columnSetting,
|
|
60
60
|
propsDataSourceGroup = props.dataSourceGroup,
|
|
61
|
+
_localSettings = props.localSettings,
|
|
61
62
|
_props$view = props.view,
|
|
62
63
|
view = _props$view === void 0 ? defaultView : _props$view,
|
|
63
64
|
gallery = props.gallery,
|
|
@@ -162,7 +163,8 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
162
163
|
view: view,
|
|
163
164
|
currentViewMode: currentViewMode,
|
|
164
165
|
gallery: gallery,
|
|
165
|
-
currentSettingHash: currentSettingHash
|
|
166
|
+
currentSettingHash: currentSettingHash,
|
|
167
|
+
localSettings: _localSettings
|
|
166
168
|
}),
|
|
167
169
|
setTableSetting = _useTableSetting.setTableSetting,
|
|
168
170
|
tableSetting = _useTableSetting.tableSetting;
|
|
@@ -246,6 +248,15 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
246
248
|
useImperativeHandle(ref, function () {
|
|
247
249
|
if (wrapRef.current) {
|
|
248
250
|
wrapRef.current.formInstance = form;
|
|
251
|
+
wrapRef.current.getCachedFilters = function () {
|
|
252
|
+
try {
|
|
253
|
+
if (!tableId) return {};
|
|
254
|
+
var setting = getTableSettingByCurrentViewMode(tableId, currentViewMode);
|
|
255
|
+
return (setting === null || setting === void 0 ? void 0 : setting.filters) || {};
|
|
256
|
+
} catch (e) {
|
|
257
|
+
return {};
|
|
258
|
+
}
|
|
259
|
+
};
|
|
249
260
|
}
|
|
250
261
|
// forwardRef 后需要返回元素才能选中
|
|
251
262
|
return wrapRef.current;
|
|
@@ -191,6 +191,21 @@ export declare type ExportImportType = {
|
|
|
191
191
|
apiUrl?: ApiProps;
|
|
192
192
|
otherParams?: any;
|
|
193
193
|
};
|
|
194
|
+
/**
|
|
195
|
+
* 设置记忆范围
|
|
196
|
+
*/
|
|
197
|
+
export declare type LocalSettingsScope = "filters" | "sorting" | "columns";
|
|
198
|
+
/**
|
|
199
|
+
* 本地记忆设置
|
|
200
|
+
*/
|
|
201
|
+
export declare type LocalSettingsType = {
|
|
202
|
+
/** 启用设置记忆 */
|
|
203
|
+
enable: boolean;
|
|
204
|
+
/** 记忆范围 */
|
|
205
|
+
scope: LocalSettingsScope[];
|
|
206
|
+
/** 不需要记忆的筛选字段(当 scope 包含 filters 时生效) */
|
|
207
|
+
excludedFilterFields?: string[];
|
|
208
|
+
};
|
|
194
209
|
export declare type GridViewProps = {
|
|
195
210
|
columns: any;
|
|
196
211
|
dataSource: any[];
|
|
@@ -247,5 +262,7 @@ export declare type GridViewProps = {
|
|
|
247
262
|
sortBy?: string;
|
|
248
263
|
}[];
|
|
249
264
|
};
|
|
265
|
+
/** 本地记忆设置 */
|
|
266
|
+
localSettings?: LocalSettingsType;
|
|
250
267
|
};
|
|
251
268
|
export {};
|
package/es/utils/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ var BaseTable = (props, ref) => {
|
|
|
56
56
|
columns: propsColumns,
|
|
57
57
|
dataSource,
|
|
58
58
|
operationContent,
|
|
59
|
+
currentSettingKey,
|
|
59
60
|
...others
|
|
60
61
|
} = props;
|
|
61
62
|
const tableRef = (0, import_react.useRef)(null);
|
|
@@ -70,6 +71,9 @@ var BaseTable = (props, ref) => {
|
|
|
70
71
|
}
|
|
71
72
|
return originData;
|
|
72
73
|
}, [originData, __designMode]);
|
|
74
|
+
const formatCurrentSettingKey = (0, import_react.useMemo)(() => {
|
|
75
|
+
return currentSettingKey || props.__id || "";
|
|
76
|
+
}, [currentSettingKey]);
|
|
73
77
|
const { dataSourceKey, dataSourceKeyRef } = (0, import_useDataSourceKey.default)();
|
|
74
78
|
const beforeClose = (0, import_react.useRef)();
|
|
75
79
|
const setBeforeClose = (0, import_react.useCallback)((fn) => {
|
|
@@ -84,7 +88,7 @@ var BaseTable = (props, ref) => {
|
|
|
84
88
|
Container,
|
|
85
89
|
drawerContent
|
|
86
90
|
} = (0, import_useDrawerState.default)(operationContent);
|
|
87
|
-
const { queryPageConfig, handleValuesChange, refreshData, handleFilterChange, refreshCurrentPage } = (0, import_useTableQuery.default)(props);
|
|
91
|
+
const { queryPageConfig, handleValuesChange, refreshData, handleFilterChange, refreshCurrentPage, getInitialValues } = (0, import_useTableQuery.default)(props, formatCurrentSettingKey);
|
|
88
92
|
const handleAllValuesChange = (changedValues, values) => {
|
|
89
93
|
var _a;
|
|
90
94
|
(_a = props == null ? void 0 : props.onValuesChange) == null ? void 0 : _a.call(props, changedValues, values);
|
|
@@ -130,7 +134,8 @@ var BaseTable = (props, ref) => {
|
|
|
130
134
|
closeDrawer,
|
|
131
135
|
refreshData,
|
|
132
136
|
handleFilterChange,
|
|
133
|
-
tableRef
|
|
137
|
+
tableRef,
|
|
138
|
+
getInitialValues
|
|
134
139
|
});
|
|
135
140
|
(0, import_react.useImperativeHandle)(ref, () => {
|
|
136
141
|
if (tableRef.current) {
|
|
@@ -147,6 +152,7 @@ var BaseTable = (props, ref) => {
|
|
|
147
152
|
ref: tableRef,
|
|
148
153
|
...others,
|
|
149
154
|
...transformProps,
|
|
155
|
+
currentSettingKey: formatCurrentSettingKey,
|
|
150
156
|
dataSource: (data == null ? void 0 : data.data) || [],
|
|
151
157
|
loading: list == null ? void 0 : list.loading,
|
|
152
158
|
onValuesChange: handleAllValuesChange
|
|
@@ -52,7 +52,8 @@ var Filter = (props) => {
|
|
|
52
52
|
handleValuesChange,
|
|
53
53
|
search,
|
|
54
54
|
filterBy,
|
|
55
|
-
show
|
|
55
|
+
show,
|
|
56
|
+
getInitialValues
|
|
56
57
|
} = props;
|
|
57
58
|
const [form] = import_antd.Form.useForm();
|
|
58
59
|
const { dataSource } = (0, import_useDataSource.default)();
|
|
@@ -155,6 +156,9 @@ var Filter = (props) => {
|
|
|
155
156
|
}
|
|
156
157
|
) : null;
|
|
157
158
|
}, [search]);
|
|
159
|
+
const initialValues = (0, import_react.useMemo)(() => {
|
|
160
|
+
return getInitialValues == null ? void 0 : getInitialValues();
|
|
161
|
+
}, [search, filterBy]);
|
|
158
162
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
159
163
|
import_antd.Form,
|
|
160
164
|
{
|
|
@@ -163,7 +167,8 @@ var Filter = (props) => {
|
|
|
163
167
|
size: "large",
|
|
164
168
|
layout: "inline",
|
|
165
169
|
className: "filter-form-wrapper",
|
|
166
|
-
onValuesChange
|
|
170
|
+
onValuesChange,
|
|
171
|
+
initialValues
|
|
167
172
|
},
|
|
168
173
|
searchDom,
|
|
169
174
|
filterDom,
|