@pisell/materials 1.0.225 → 1.0.227
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 +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/table/index.js +18 -21
- package/lib/components/table/index.js +19 -15
- package/package.json +3 -3
|
@@ -36,7 +36,7 @@ var defaultView = {
|
|
|
36
36
|
modeList: []
|
|
37
37
|
};
|
|
38
38
|
var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
39
|
-
var _context$appHelper, _other$pagination2, _other$pagination5, _other$pagination6, _other$
|
|
39
|
+
var _context$appHelper, _other$pagination2, _other$pagination5, _other$pagination6, _other$pagination8;
|
|
40
40
|
var dataSource = props.dataSource,
|
|
41
41
|
columns = props.columns,
|
|
42
42
|
dispatch = props.dispatch,
|
|
@@ -66,6 +66,8 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
66
66
|
});
|
|
67
67
|
var context = useEngineContext();
|
|
68
68
|
var wrapRef = useRef(null);
|
|
69
|
+
var tableSettingRef = useRef({});
|
|
70
|
+
var filterDefaultRef = useRef({});
|
|
69
71
|
var initialValuesRef = useRef({});
|
|
70
72
|
var utils = context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils;
|
|
71
73
|
var tableId = useMemo(function () {
|
|
@@ -169,7 +171,7 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
169
171
|
document.body.id = "body";
|
|
170
172
|
}, 200);
|
|
171
173
|
}, [filter]);
|
|
172
|
-
var
|
|
174
|
+
var filterDefaultValues = useMemo(function () {
|
|
173
175
|
var _other$pagination3, _other$pagination4;
|
|
174
176
|
var defaultValues = ((filter === null || filter === void 0 ? void 0 : filter.list) || []).reduce(function (p, c) {
|
|
175
177
|
var _c$other;
|
|
@@ -180,12 +182,11 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
180
182
|
size: ((_other$pagination4 = other.pagination) === null || _other$pagination4 === void 0 ? void 0 : _other$pagination4.pageSize) || 10
|
|
181
183
|
}
|
|
182
184
|
});
|
|
183
|
-
// if (other?.pagination?.localPagination) {
|
|
184
|
-
defaultValues = _objectSpread(_objectSpread({}, defaultValues), tableSetting);
|
|
185
|
-
// }
|
|
186
185
|
return defaultValues;
|
|
187
|
-
}, [filter === null || filter === void 0 ? void 0 : filter.list, (_other$pagination5 = other.pagination) === null || _other$pagination5 === void 0 ? void 0 : _other$pagination5.
|
|
188
|
-
|
|
186
|
+
}, [JSON.stringify(filter === null || filter === void 0 ? void 0 : filter.list), (_other$pagination5 = other.pagination) === null || _other$pagination5 === void 0 ? void 0 : _other$pagination5.current, (_other$pagination6 = other.pagination) === null || _other$pagination6 === void 0 ? void 0 : _other$pagination6.pageSize]);
|
|
187
|
+
filterDefaultRef.current = filterDefaultValues;
|
|
188
|
+
tableSettingRef.current = tableSetting;
|
|
189
|
+
initialValuesRef.current = _objectSpread(_objectSpread({}, filterDefaultValues), tableSetting);
|
|
189
190
|
useImperativeHandle(ref, function () {
|
|
190
191
|
if (wrapRef.current) {
|
|
191
192
|
wrapRef.current.formInstance = form;
|
|
@@ -194,22 +195,18 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
194
195
|
return wrapRef.current;
|
|
195
196
|
});
|
|
196
197
|
useEffect(function () {
|
|
197
|
-
// 当前视图变更时重置form
|
|
198
|
+
// 当前视图变更时重置form tableSetting 及 筛选项默认值全部重置
|
|
198
199
|
form.resetFields();
|
|
199
200
|
form.setFieldsValue(initialValuesRef.current);
|
|
200
201
|
}, [currentViewMode]);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
// form.resetFields();
|
|
206
|
-
// form.setFieldsValue(initialValuesRef.current);
|
|
207
|
-
// }
|
|
208
|
-
// }, [JSON.stringify(columns), props.__designMode]);
|
|
209
|
-
|
|
202
|
+
useEffect(function () {
|
|
203
|
+
// 虚拟表columns由接口获取 columns变更时只重新设置tableSetting
|
|
204
|
+
form.setFieldsValue(tableSettingRef.current);
|
|
205
|
+
}, [JSON.stringify(columns)]);
|
|
210
206
|
useEffect(function () {
|
|
211
207
|
form.setFieldsValue(initialValuesRef.current);
|
|
212
|
-
|
|
208
|
+
// ArraySetter在面板state变更时指针改变
|
|
209
|
+
}, [JSON.stringify(propsFilter)]);
|
|
213
210
|
return /*#__PURE__*/React.createElement(Form, {
|
|
214
211
|
form: form,
|
|
215
212
|
layout: "vertical",
|
|
@@ -223,9 +220,9 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
223
220
|
page: 1
|
|
224
221
|
});
|
|
225
222
|
} else {
|
|
226
|
-
var _other$
|
|
223
|
+
var _other$pagination7;
|
|
227
224
|
// 如果使用本地分页 不执行onValuesChange
|
|
228
|
-
if (other !== null && other !== void 0 && (_other$
|
|
225
|
+
if (other !== null && other !== void 0 && (_other$pagination7 = other.pagination) !== null && _other$pagination7 !== void 0 && _other$pagination7.localPagination) {
|
|
229
226
|
return;
|
|
230
227
|
}
|
|
231
228
|
}
|
|
@@ -259,7 +256,7 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
259
256
|
filter: filter,
|
|
260
257
|
sort: sort,
|
|
261
258
|
tableId: tableId,
|
|
262
|
-
localPagination: other === null || other === void 0 ? void 0 : (_other$
|
|
259
|
+
localPagination: other === null || other === void 0 ? void 0 : (_other$pagination8 = other.pagination) === null || _other$pagination8 === void 0 ? void 0 : _other$pagination8.localPagination,
|
|
263
260
|
gallery: gallery
|
|
264
261
|
}), /*#__PURE__*/React.createElement(Summary, {
|
|
265
262
|
summary: summary
|
|
@@ -55,7 +55,7 @@ var defaultView = {
|
|
|
55
55
|
};
|
|
56
56
|
var GridView = (0, import_model.Provider)(
|
|
57
57
|
(0, import_react.forwardRef)((props, ref) => {
|
|
58
|
-
var _a, _b, _c, _d, _e
|
|
58
|
+
var _a, _b, _c, _d, _e;
|
|
59
59
|
const {
|
|
60
60
|
dataSource,
|
|
61
61
|
columns,
|
|
@@ -81,6 +81,8 @@ var GridView = (0, import_model.Provider)(
|
|
|
81
81
|
const viewMode = import_antd.Form.useWatch("view_mode", { form, preserve: true });
|
|
82
82
|
const context = (0, import_useEngineContext.default)();
|
|
83
83
|
const wrapRef = (0, import_react.useRef)(null);
|
|
84
|
+
const tableSettingRef = (0, import_react.useRef)({});
|
|
85
|
+
const filterDefaultRef = (0, import_react.useRef)({});
|
|
84
86
|
const initialValuesRef = (0, import_react.useRef)({});
|
|
85
87
|
const utils = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils;
|
|
86
88
|
const tableId = (0, import_react.useMemo)(() => {
|
|
@@ -176,9 +178,9 @@ var GridView = (0, import_model.Provider)(
|
|
|
176
178
|
document.body.id = "body";
|
|
177
179
|
}, 200);
|
|
178
180
|
}, [filter]);
|
|
179
|
-
const
|
|
181
|
+
const filterDefaultValues = (0, import_react.useMemo)(() => {
|
|
180
182
|
var _a2, _b2;
|
|
181
|
-
|
|
183
|
+
const defaultValues = ((filter == null ? void 0 : filter.list) || []).reduce(
|
|
182
184
|
(p, c) => {
|
|
183
185
|
var _a3;
|
|
184
186
|
return {
|
|
@@ -193,19 +195,18 @@ var GridView = (0, import_model.Provider)(
|
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
197
|
);
|
|
196
|
-
defaultValues = {
|
|
197
|
-
...defaultValues,
|
|
198
|
-
...tableSetting
|
|
199
|
-
};
|
|
200
198
|
return defaultValues;
|
|
201
199
|
}, [
|
|
202
|
-
filter == null ? void 0 : filter.list,
|
|
203
|
-
(_c = other.pagination) == null ? void 0 : _c.
|
|
204
|
-
|
|
205
|
-
(_d = other.pagination) == null ? void 0 : _d.current,
|
|
206
|
-
(_e = other.pagination) == null ? void 0 : _e.pageSize
|
|
200
|
+
JSON.stringify(filter == null ? void 0 : filter.list),
|
|
201
|
+
(_c = other.pagination) == null ? void 0 : _c.current,
|
|
202
|
+
(_d = other.pagination) == null ? void 0 : _d.pageSize
|
|
207
203
|
]);
|
|
208
|
-
|
|
204
|
+
filterDefaultRef.current = filterDefaultValues;
|
|
205
|
+
tableSettingRef.current = tableSetting;
|
|
206
|
+
initialValuesRef.current = {
|
|
207
|
+
...filterDefaultValues,
|
|
208
|
+
...tableSetting
|
|
209
|
+
};
|
|
209
210
|
(0, import_react.useImperativeHandle)(ref, () => {
|
|
210
211
|
if (wrapRef.current) {
|
|
211
212
|
wrapRef.current.formInstance = form;
|
|
@@ -216,9 +217,12 @@ var GridView = (0, import_model.Provider)(
|
|
|
216
217
|
form.resetFields();
|
|
217
218
|
form.setFieldsValue(initialValuesRef.current);
|
|
218
219
|
}, [currentViewMode]);
|
|
220
|
+
(0, import_react.useEffect)(() => {
|
|
221
|
+
form.setFieldsValue(tableSettingRef.current);
|
|
222
|
+
}, [JSON.stringify(columns)]);
|
|
219
223
|
(0, import_react.useEffect)(() => {
|
|
220
224
|
form.setFieldsValue(initialValuesRef.current);
|
|
221
|
-
}, [propsFilter]);
|
|
225
|
+
}, [JSON.stringify(propsFilter)]);
|
|
222
226
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
223
227
|
import_antd.Form,
|
|
224
228
|
{
|
|
@@ -266,7 +270,7 @@ var GridView = (0, import_model.Provider)(
|
|
|
266
270
|
filter,
|
|
267
271
|
sort,
|
|
268
272
|
tableId,
|
|
269
|
-
localPagination: (
|
|
273
|
+
localPagination: (_e = other == null ? void 0 : other.pagination) == null ? void 0 : _e.localPagination,
|
|
270
274
|
gallery
|
|
271
275
|
}
|
|
272
276
|
), /* @__PURE__ */ import_react.default.createElement(import_Summary.default, { summary }), /* @__PURE__ */ import_react.default.createElement(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/materials",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.227",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"react-window": "^1.8.10",
|
|
62
62
|
"react-virtualized-auto-sizer": "^1.0.20",
|
|
63
63
|
"@pisell/utils": "1.0.23",
|
|
64
|
-
"@pisell/
|
|
65
|
-
"@pisell/
|
|
64
|
+
"@pisell/date-picker": "1.0.68",
|
|
65
|
+
"@pisell/icon": "0.0.8"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"react": "^18.0.0",
|