@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
|
@@ -307,7 +307,24 @@ var setFormValuesToLocalStorage = ({
|
|
|
307
307
|
currentSettingHash
|
|
308
308
|
});
|
|
309
309
|
};
|
|
310
|
-
var getTableKey = (tableId) =>
|
|
310
|
+
var getTableKey = (tableId) => {
|
|
311
|
+
if (typeof window === "undefined" || typeof window.location === "undefined") {
|
|
312
|
+
return `${tableKeyPrefix}-${tableId}`;
|
|
313
|
+
}
|
|
314
|
+
const { pathname, search } = window.location;
|
|
315
|
+
let appendPath = pathname || "/";
|
|
316
|
+
let memoryKey = "";
|
|
317
|
+
try {
|
|
318
|
+
const params = new URLSearchParams(search || "");
|
|
319
|
+
const mk = params.get("memory_key");
|
|
320
|
+
if (mk && mk.trim() !== "") {
|
|
321
|
+
memoryKey = mk.trim();
|
|
322
|
+
}
|
|
323
|
+
} catch (e) {
|
|
324
|
+
}
|
|
325
|
+
const urlPart = memoryKey ? `${appendPath}#${memoryKey}` : appendPath;
|
|
326
|
+
return `${tableKeyPrefix}-${tableId}-${urlPart}`;
|
|
327
|
+
};
|
|
311
328
|
var mergeFilterSetting = ({
|
|
312
329
|
list,
|
|
313
330
|
quickFilterMaxLength,
|
|
@@ -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;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/components/table/hooks/useTableSetting.ts
|
|
@@ -25,6 +35,7 @@ module.exports = __toCommonJS(useTableSetting_exports);
|
|
|
25
35
|
var import_react = require("react");
|
|
26
36
|
var import_utils = require("../Table/utils");
|
|
27
37
|
var import_ahooks = require("ahooks");
|
|
38
|
+
var import_react2 = __toESM(require("react"));
|
|
28
39
|
var useTableSetting = (params) => {
|
|
29
40
|
const {
|
|
30
41
|
tableId,
|
|
@@ -37,7 +48,8 @@ var useTableSetting = (params) => {
|
|
|
37
48
|
columns: propsColumns,
|
|
38
49
|
gallery,
|
|
39
50
|
currentSettingHash,
|
|
40
|
-
exportImport
|
|
51
|
+
exportImport,
|
|
52
|
+
localSettings
|
|
41
53
|
} = params;
|
|
42
54
|
const columnsMap = (0, import_react.useMemo)(() => {
|
|
43
55
|
return new Map(propsColumns.map((item) => [item.key, item]));
|
|
@@ -67,7 +79,8 @@ var useTableSetting = (params) => {
|
|
|
67
79
|
};
|
|
68
80
|
}, [gallery, columns]);
|
|
69
81
|
const localStorageSettingKeyArr = (0, import_react.useMemo)(() => {
|
|
70
|
-
|
|
82
|
+
var _a;
|
|
83
|
+
const keys = (0, import_utils.getSettingKeyArrByMode)({
|
|
71
84
|
filter,
|
|
72
85
|
columnSetting,
|
|
73
86
|
dataSourceGroup,
|
|
@@ -75,6 +88,12 @@ var useTableSetting = (params) => {
|
|
|
75
88
|
mode: "localStorage",
|
|
76
89
|
currentViewMode
|
|
77
90
|
});
|
|
91
|
+
if ((localSettings == null ? void 0 : localSettings.enable) && ((_a = localSettings.scope) == null ? void 0 : _a.includes("filters"))) {
|
|
92
|
+
if (!keys.includes("filters")) {
|
|
93
|
+
keys.push("filters");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return keys;
|
|
78
97
|
}, [tableId, filter, columnSetting, dataSourceGroup, sort, currentViewMode]);
|
|
79
98
|
const defaultKeyArr = (0, import_react.useMemo)(() => {
|
|
80
99
|
return (0, import_utils.getSettingKeyArrByMode)({
|
|
@@ -129,6 +148,8 @@ var useTableSetting = (params) => {
|
|
|
129
148
|
compactMode: ((_c = mergedSetting == null ? void 0 : mergedSetting[item]) == null ? void 0 : _c.compactMode) || defaultGalleryCoverSetting.compactMode,
|
|
130
149
|
isShowLabel: ((_d = mergedSetting == null ? void 0 : mergedSetting[item]) == null ? void 0 : _d.isShowLabel) ?? defaultGalleryCoverSetting.isShowLabel
|
|
131
150
|
};
|
|
151
|
+
} else if (item === "filters") {
|
|
152
|
+
setting[item] = (mergedSetting == null ? void 0 : mergedSetting[item]) || {};
|
|
132
153
|
} else {
|
|
133
154
|
setting[item] = mergedSetting == null ? void 0 : mergedSetting[item];
|
|
134
155
|
}
|
|
@@ -187,20 +208,109 @@ var useTableSetting = (params) => {
|
|
|
187
208
|
sortButtonShow
|
|
188
209
|
]);
|
|
189
210
|
const setTableSetting = (0, import_ahooks.useMemoizedFn)((values) => {
|
|
211
|
+
var _a;
|
|
212
|
+
let valuesForSave = values;
|
|
213
|
+
if ((localSettings == null ? void 0 : localSettings.enable) && ((_a = localSettings.scope) == null ? void 0 : _a.includes("filters"))) {
|
|
214
|
+
const excluded = new Set((localSettings == null ? void 0 : localSettings.excludedFilterFields) || []);
|
|
215
|
+
const filterValue = {};
|
|
216
|
+
((filter == null ? void 0 : filter.list) || []).forEach((item) => {
|
|
217
|
+
const rawName = item == null ? void 0 : item.name;
|
|
218
|
+
if (!rawName) return;
|
|
219
|
+
const key = Array.isArray(rawName) ? rawName.join(",") : String(rawName);
|
|
220
|
+
if (excluded.has(key)) return;
|
|
221
|
+
if (values.hasOwnProperty(key)) {
|
|
222
|
+
filterValue[key] = values[key];
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
valuesForSave = {
|
|
226
|
+
...values,
|
|
227
|
+
filters: filterValue
|
|
228
|
+
};
|
|
229
|
+
}
|
|
190
230
|
(0, import_utils.setFormValuesToLocalStorage)({
|
|
191
231
|
tableId,
|
|
192
|
-
allValues:
|
|
232
|
+
allValues: valuesForSave,
|
|
193
233
|
keys: localStorageSettingKeyArr,
|
|
194
234
|
currentViewMode,
|
|
195
235
|
currentSettingHash
|
|
196
236
|
});
|
|
197
237
|
});
|
|
198
238
|
const tableSetting = (0, import_react.useMemo)(() => {
|
|
199
|
-
|
|
239
|
+
var _a;
|
|
240
|
+
const merged = {
|
|
200
241
|
...tableLocalSetting,
|
|
201
242
|
...defaultTableSetting
|
|
202
243
|
};
|
|
244
|
+
if ((localSettings == null ? void 0 : localSettings.enable) && ((_a = localSettings.scope) == null ? void 0 : _a.includes("filters"))) {
|
|
245
|
+
const persistedFilter = tableLocalSetting == null ? void 0 : tableLocalSetting.filters;
|
|
246
|
+
if (persistedFilter && typeof persistedFilter === "object") {
|
|
247
|
+
return {
|
|
248
|
+
...merged,
|
|
249
|
+
...persistedFilter
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return merged;
|
|
203
254
|
}, [tableLocalSetting, defaultTableSetting]);
|
|
255
|
+
(0, import_react.useMemo)(() => {
|
|
256
|
+
var _a;
|
|
257
|
+
try {
|
|
258
|
+
if (!tableId) return;
|
|
259
|
+
const current = (0, import_utils.getTableSettingByCurrentViewMode)(tableId, currentViewMode) || {};
|
|
260
|
+
const persistedFilters = (current == null ? void 0 : current.filters) || {};
|
|
261
|
+
let nextFilters = { ...persistedFilters };
|
|
262
|
+
let shouldUpdate = false;
|
|
263
|
+
const enableFiltersMemory = !!((localSettings == null ? void 0 : localSettings.enable) && ((_a = localSettings.scope) == null ? void 0 : _a.includes("filters")));
|
|
264
|
+
if (!enableFiltersMemory) {
|
|
265
|
+
if (Object.keys(persistedFilters || {}).length > 0) {
|
|
266
|
+
nextFilters = {};
|
|
267
|
+
shouldUpdate = true;
|
|
268
|
+
}
|
|
269
|
+
} else {
|
|
270
|
+
let names = /* @__PURE__ */ new Set();
|
|
271
|
+
if (import_react2.default.isValidElement(filter)) {
|
|
272
|
+
names = new Set(
|
|
273
|
+
((filter == null ? void 0 : filter.items) || []).filter((item) => !item.isHidden).map((item) => {
|
|
274
|
+
const rawName = item == null ? void 0 : item.value;
|
|
275
|
+
if (!rawName) return void 0;
|
|
276
|
+
return Array.isArray(rawName) ? rawName.join(",") : String(rawName);
|
|
277
|
+
})
|
|
278
|
+
);
|
|
279
|
+
} else {
|
|
280
|
+
names = new Set(
|
|
281
|
+
((filter == null ? void 0 : filter.list) || []).map((item) => {
|
|
282
|
+
const rawName = item == null ? void 0 : item.name;
|
|
283
|
+
if (!rawName) return void 0;
|
|
284
|
+
return Array.isArray(rawName) ? rawName.join(",") : String(rawName);
|
|
285
|
+
}).filter(Boolean)
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
const excluded = new Set((localSettings == null ? void 0 : localSettings.excludedFilterFields) || []);
|
|
289
|
+
const allowed = new Set(Array.from(names).filter((k) => !excluded.has(k)));
|
|
290
|
+
const filtered = {};
|
|
291
|
+
Object.keys(persistedFilters || {}).forEach((k) => {
|
|
292
|
+
if (allowed.has(k)) {
|
|
293
|
+
filtered[k] = persistedFilters[k];
|
|
294
|
+
} else {
|
|
295
|
+
shouldUpdate = true;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
if (Object.keys(filtered).length !== Object.keys(persistedFilters || {}).length) {
|
|
299
|
+
shouldUpdate = true;
|
|
300
|
+
}
|
|
301
|
+
nextFilters = filtered;
|
|
302
|
+
}
|
|
303
|
+
if (shouldUpdate) {
|
|
304
|
+
(0, import_utils.setTableSettingToLocalStorage)({
|
|
305
|
+
tableId,
|
|
306
|
+
tableSettingObj: { filters: nextFilters },
|
|
307
|
+
currentViewMode,
|
|
308
|
+
currentSettingHash
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
} catch (e) {
|
|
312
|
+
}
|
|
313
|
+
}, []);
|
|
204
314
|
return {
|
|
205
315
|
setTableSetting,
|
|
206
316
|
tableSetting
|
|
@@ -76,6 +76,7 @@ var GridView = (0, import_model.Provider)(
|
|
|
76
76
|
onValuesChange,
|
|
77
77
|
columnSetting,
|
|
78
78
|
dataSourceGroup: propsDataSourceGroup,
|
|
79
|
+
localSettings: _localSettings,
|
|
79
80
|
view = defaultView,
|
|
80
81
|
gallery,
|
|
81
82
|
currentSettingKey,
|
|
@@ -171,7 +172,8 @@ var GridView = (0, import_model.Provider)(
|
|
|
171
172
|
view,
|
|
172
173
|
currentViewMode,
|
|
173
174
|
gallery,
|
|
174
|
-
currentSettingHash
|
|
175
|
+
currentSettingHash,
|
|
176
|
+
localSettings: _localSettings
|
|
175
177
|
});
|
|
176
178
|
const getIsTriggerValuesChange = (0, import_useTriggerValuesChange.default)({
|
|
177
179
|
filter,
|
|
@@ -260,6 +262,15 @@ var GridView = (0, import_model.Provider)(
|
|
|
260
262
|
(0, import_react.useImperativeHandle)(ref, () => {
|
|
261
263
|
if (wrapRef.current) {
|
|
262
264
|
wrapRef.current.formInstance = form;
|
|
265
|
+
wrapRef.current.getCachedFilters = () => {
|
|
266
|
+
try {
|
|
267
|
+
if (!tableId) return {};
|
|
268
|
+
const setting = (0, import_utils.getTableSettingByCurrentViewMode)(tableId, currentViewMode);
|
|
269
|
+
return (setting == null ? void 0 : setting.filters) || {};
|
|
270
|
+
} catch (e) {
|
|
271
|
+
return {};
|
|
272
|
+
}
|
|
273
|
+
};
|
|
263
274
|
}
|
|
264
275
|
return wrapRef.current;
|
|
265
276
|
});
|
|
@@ -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/lib/utils/index.d.ts
CHANGED
|
@@ -3050,6 +3050,132 @@ const dataSourceTable = {
|
|
|
3050
3050
|
},
|
|
3051
3051
|
],
|
|
3052
3052
|
},
|
|
3053
|
+
|
|
3054
|
+
{
|
|
3055
|
+
type: 'group',
|
|
3056
|
+
title: {
|
|
3057
|
+
type: 'i18n',
|
|
3058
|
+
'en-US': 'Other',
|
|
3059
|
+
'zh-CN': '其他',
|
|
3060
|
+
},
|
|
3061
|
+
display: 'accordion',
|
|
3062
|
+
items: [
|
|
3063
|
+
{
|
|
3064
|
+
title: "本地记忆",
|
|
3065
|
+
display: "block",
|
|
3066
|
+
type: "group",
|
|
3067
|
+
items: [
|
|
3068
|
+
{
|
|
3069
|
+
name: "localSettings.enable",
|
|
3070
|
+
title: {
|
|
3071
|
+
label: {
|
|
3072
|
+
type: 'i18n',
|
|
3073
|
+
'en-US': 'Enable settings memory',
|
|
3074
|
+
'zh-CN': '启用设置记忆',
|
|
3075
|
+
'zh-HK': '啟用設置記憶',
|
|
3076
|
+
},
|
|
3077
|
+
tip: {
|
|
3078
|
+
type: 'i18n',
|
|
3079
|
+
'en-US': 'Automatically save and restore table settings',
|
|
3080
|
+
'zh-CN': '自动保存和恢复表格设置',
|
|
3081
|
+
'zh-HK': '自動保存和恢復表格設置',
|
|
3082
|
+
},
|
|
3083
|
+
},
|
|
3084
|
+
propType: "bool",
|
|
3085
|
+
setter: "BoolSetter",
|
|
3086
|
+
defaultValue: true,
|
|
3087
|
+
},
|
|
3088
|
+
{
|
|
3089
|
+
name: "localSettings.scope",
|
|
3090
|
+
title: {
|
|
3091
|
+
label: {
|
|
3092
|
+
type: 'i18n',
|
|
3093
|
+
'en-US': 'Memory scope',
|
|
3094
|
+
'zh-CN': '记忆范围',
|
|
3095
|
+
'zh-HK': '記憶範圍',
|
|
3096
|
+
},
|
|
3097
|
+
tip: {
|
|
3098
|
+
type: 'i18n',
|
|
3099
|
+
'en-US': 'Choose which settings to remember',
|
|
3100
|
+
'zh-CN': '选择要记忆的设置项',
|
|
3101
|
+
'zh-HK': '選擇要記憶的設置項',
|
|
3102
|
+
},
|
|
3103
|
+
},
|
|
3104
|
+
condition: {
|
|
3105
|
+
type: "JSFunction",
|
|
3106
|
+
value: 'target => !!target.getProps().getPropValue("localSettings.enable")',
|
|
3107
|
+
},
|
|
3108
|
+
setter: {
|
|
3109
|
+
componentName: "SelectSetter",
|
|
3110
|
+
props: {
|
|
3111
|
+
mode: "multiple",
|
|
3112
|
+
options: [
|
|
3113
|
+
{ title: '筛选', value: "filters" },
|
|
3114
|
+
{ title: '排序', value: "sorting" },
|
|
3115
|
+
{ title: '列配置', value: "columns" },
|
|
3116
|
+
],
|
|
3117
|
+
},
|
|
3118
|
+
},
|
|
3119
|
+
defaultValue: ["filters", "sorting", "columns"],
|
|
3120
|
+
},
|
|
3121
|
+
{
|
|
3122
|
+
name: "localSettings.excludedFilterFields",
|
|
3123
|
+
title: {
|
|
3124
|
+
label: {
|
|
3125
|
+
type: 'i18n',
|
|
3126
|
+
'en-US': 'Excluded filter fields',
|
|
3127
|
+
'zh-CN': '筛选排除字段',
|
|
3128
|
+
'zh-HK': '篩選排除字段',
|
|
3129
|
+
},
|
|
3130
|
+
tip: {
|
|
3131
|
+
type: 'i18n',
|
|
3132
|
+
'en-US': 'Filter fields that should not be remembered',
|
|
3133
|
+
'zh-CN': '不需要记忆的筛选字段',
|
|
3134
|
+
'zh-HK': '不需要記憶的篩選字段',
|
|
3135
|
+
},
|
|
3136
|
+
},
|
|
3137
|
+
condition: {
|
|
3138
|
+
type: "JSFunction",
|
|
3139
|
+
value: 'target => { const enable = !!target.getProps().getPropValue("localSettings.enable"); const scope = target.getProps().getPropValue("localSettings.scope") || []; return enable && Array.isArray(scope) && scope.includes("filters"); }',
|
|
3140
|
+
},
|
|
3141
|
+
setter: {
|
|
3142
|
+
componentName: "SelectSetter",
|
|
3143
|
+
props: (target: any) => {
|
|
3144
|
+
const filterList = (target.parent.parent.getPropValue("filter.items") || []) as any[];
|
|
3145
|
+
|
|
3146
|
+
|
|
3147
|
+
const searchDetail = target.parent.parent.getPropValue("search");
|
|
3148
|
+
|
|
3149
|
+
if (searchDetail && searchDetail.show) {
|
|
3150
|
+
filterList.unshift({
|
|
3151
|
+
label: "搜索",
|
|
3152
|
+
value: searchDetail.key || "_keywords",
|
|
3153
|
+
isHidden: false,
|
|
3154
|
+
});
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
return {
|
|
3158
|
+
mode: "multiple",
|
|
3159
|
+
options: filterList
|
|
3160
|
+
.map((item: any) => ({
|
|
3161
|
+
title:
|
|
3162
|
+
(item && (typeof item.label === 'string' ? item.label : item.label?.["zh-CN"] || item.label?.["zh-HK"] || item.label?.en)) ||
|
|
3163
|
+
item?.key ||
|
|
3164
|
+
item?.columnKey ||
|
|
3165
|
+
"",
|
|
3166
|
+
value: item?.value || "",
|
|
3167
|
+
isHidden: item?.isHidden,
|
|
3168
|
+
}))
|
|
3169
|
+
.filter((opt: any) => opt.value && !opt.isHidden),
|
|
3170
|
+
};
|
|
3171
|
+
},
|
|
3172
|
+
},
|
|
3173
|
+
},
|
|
3174
|
+
],
|
|
3175
|
+
},
|
|
3176
|
+
|
|
3177
|
+
],
|
|
3178
|
+
},
|
|
3053
3179
|
],
|
|
3054
3180
|
configure: {
|
|
3055
3181
|
props: [
|
|
@@ -4536,6 +4662,119 @@ const dataSourceTable = {
|
|
|
4536
4662
|
},
|
|
4537
4663
|
],
|
|
4538
4664
|
},
|
|
4665
|
+
{
|
|
4666
|
+
title: "本地记忆",
|
|
4667
|
+
display: "block",
|
|
4668
|
+
type: "group",
|
|
4669
|
+
items: [
|
|
4670
|
+
{
|
|
4671
|
+
name: "localSettings.enable",
|
|
4672
|
+
title: {
|
|
4673
|
+
label: {
|
|
4674
|
+
type: 'i18n',
|
|
4675
|
+
'en-US': 'Enable settings memory',
|
|
4676
|
+
'zh-CN': '启用设置记忆',
|
|
4677
|
+
'zh-HK': '啟用設置記憶',
|
|
4678
|
+
},
|
|
4679
|
+
tip: {
|
|
4680
|
+
type: 'i18n',
|
|
4681
|
+
'en-US': 'Automatically save and restore table settings',
|
|
4682
|
+
'zh-CN': '自动保存和恢复表格设置',
|
|
4683
|
+
'zh-HK': '自動保存和恢復表格設置',
|
|
4684
|
+
},
|
|
4685
|
+
},
|
|
4686
|
+
propType: "bool",
|
|
4687
|
+
setter: "BoolSetter",
|
|
4688
|
+
defaultValue: true,
|
|
4689
|
+
},
|
|
4690
|
+
{
|
|
4691
|
+
name: "localSettings.scope",
|
|
4692
|
+
title: {
|
|
4693
|
+
label: {
|
|
4694
|
+
type: 'i18n',
|
|
4695
|
+
'en-US': 'Memory scope',
|
|
4696
|
+
'zh-CN': '记忆范围',
|
|
4697
|
+
'zh-HK': '記憶範圍',
|
|
4698
|
+
},
|
|
4699
|
+
tip: {
|
|
4700
|
+
type: 'i18n',
|
|
4701
|
+
'en-US': 'Choose which settings to remember',
|
|
4702
|
+
'zh-CN': '选择要记忆的设置项',
|
|
4703
|
+
'zh-HK': '選擇要記憶的設置項',
|
|
4704
|
+
},
|
|
4705
|
+
},
|
|
4706
|
+
condition: {
|
|
4707
|
+
type: "JSFunction",
|
|
4708
|
+
value: 'target => !!target.getProps().getPropValue("localSettings.enable")',
|
|
4709
|
+
},
|
|
4710
|
+
setter: {
|
|
4711
|
+
componentName: "SelectSetter",
|
|
4712
|
+
props: {
|
|
4713
|
+
mode: "multiple",
|
|
4714
|
+
options: [
|
|
4715
|
+
{ title: '筛选', value: "filters" },
|
|
4716
|
+
{ title: '排序', value: "sorting" },
|
|
4717
|
+
{ title: '列配置', value: "columns" },
|
|
4718
|
+
],
|
|
4719
|
+
},
|
|
4720
|
+
},
|
|
4721
|
+
defaultValue: ["filters", "sorting", "columns"],
|
|
4722
|
+
},
|
|
4723
|
+
{
|
|
4724
|
+
name: "localSettings.excludedFilterFields",
|
|
4725
|
+
title: {
|
|
4726
|
+
label: {
|
|
4727
|
+
type: 'i18n',
|
|
4728
|
+
'en-US': 'Excluded filter fields',
|
|
4729
|
+
'zh-CN': '筛选排除字段',
|
|
4730
|
+
'zh-HK': '篩選排除字段',
|
|
4731
|
+
},
|
|
4732
|
+
tip: {
|
|
4733
|
+
type: 'i18n',
|
|
4734
|
+
'en-US': 'Filter fields that should not be remembered',
|
|
4735
|
+
'zh-CN': '不需要记忆的筛选字段',
|
|
4736
|
+
'zh-HK': '不需要記憶的篩選字段',
|
|
4737
|
+
},
|
|
4738
|
+
},
|
|
4739
|
+
condition: {
|
|
4740
|
+
type: "JSFunction",
|
|
4741
|
+
value: 'target => { const enable = !!target.getProps().getPropValue("localSettings.enable"); const scope = target.getProps().getPropValue("localSettings.scope") || []; return enable && Array.isArray(scope) && scope.includes("filters"); }',
|
|
4742
|
+
},
|
|
4743
|
+
setter: {
|
|
4744
|
+
componentName: "SelectSetter",
|
|
4745
|
+
props: (target: any) => {
|
|
4746
|
+
const filterList = (target.parent.parent.getPropValue("filter.items") || []) as any[];
|
|
4747
|
+
|
|
4748
|
+
|
|
4749
|
+
const searchDetail = target.parent.parent.getPropValue("search");
|
|
4750
|
+
|
|
4751
|
+
if (searchDetail && searchDetail.show) {
|
|
4752
|
+
filterList.unshift({
|
|
4753
|
+
label: "搜索",
|
|
4754
|
+
value: searchDetail.key || "_keywords",
|
|
4755
|
+
isHidden: false,
|
|
4756
|
+
});
|
|
4757
|
+
}
|
|
4758
|
+
|
|
4759
|
+
return {
|
|
4760
|
+
mode: "multiple",
|
|
4761
|
+
options: filterList
|
|
4762
|
+
.map((item: any) => ({
|
|
4763
|
+
title:
|
|
4764
|
+
(item && (typeof item.label === 'string' ? item.label : item.label?.["zh-CN"] || item.label?.["zh-HK"] || item.label?.en)) ||
|
|
4765
|
+
item?.key ||
|
|
4766
|
+
item?.columnKey ||
|
|
4767
|
+
"",
|
|
4768
|
+
value: item?.value || "",
|
|
4769
|
+
isHidden: item?.isHidden,
|
|
4770
|
+
}))
|
|
4771
|
+
.filter((opt: any) => opt.value && !opt.isHidden),
|
|
4772
|
+
};
|
|
4773
|
+
},
|
|
4774
|
+
},
|
|
4775
|
+
},
|
|
4776
|
+
],
|
|
4777
|
+
},
|
|
4539
4778
|
{
|
|
4540
4779
|
title: { label: '列配置', tip: '表格的列配置' },
|
|
4541
4780
|
display: 'block',
|
package/lowcode/table/meta.ts
CHANGED
|
@@ -1447,6 +1447,110 @@ export default {
|
|
|
1447
1447
|
},
|
|
1448
1448
|
],
|
|
1449
1449
|
},
|
|
1450
|
+
{
|
|
1451
|
+
title: "本地记忆",
|
|
1452
|
+
display: "block",
|
|
1453
|
+
type: "group",
|
|
1454
|
+
items: [
|
|
1455
|
+
{
|
|
1456
|
+
name: "localSettings.enable",
|
|
1457
|
+
title: {
|
|
1458
|
+
label: {
|
|
1459
|
+
type: 'i18n',
|
|
1460
|
+
'en-US': 'Enable settings memory',
|
|
1461
|
+
'zh-CN': '启用设置记忆',
|
|
1462
|
+
'zh-HK': '啟用設置記憶',
|
|
1463
|
+
},
|
|
1464
|
+
tip: {
|
|
1465
|
+
type: 'i18n',
|
|
1466
|
+
'en-US': 'Automatically save and restore table settings',
|
|
1467
|
+
'zh-CN': '自动保存和恢复表格设置',
|
|
1468
|
+
'zh-HK': '自動保存和恢復表格設置',
|
|
1469
|
+
},
|
|
1470
|
+
},
|
|
1471
|
+
propType: "bool",
|
|
1472
|
+
setter: "BoolSetter",
|
|
1473
|
+
defaultValue: true,
|
|
1474
|
+
},
|
|
1475
|
+
{
|
|
1476
|
+
name: "localSettings.scope",
|
|
1477
|
+
title: {
|
|
1478
|
+
label: {
|
|
1479
|
+
type: 'i18n',
|
|
1480
|
+
'en-US': 'Memory scope',
|
|
1481
|
+
'zh-CN': '记忆范围',
|
|
1482
|
+
'zh-HK': '記憶範圍',
|
|
1483
|
+
},
|
|
1484
|
+
tip: {
|
|
1485
|
+
type: 'i18n',
|
|
1486
|
+
'en-US': 'Choose which settings to remember',
|
|
1487
|
+
'zh-CN': '选择要记忆的设置项',
|
|
1488
|
+
'zh-HK': '選擇要記憶的設置項',
|
|
1489
|
+
},
|
|
1490
|
+
},
|
|
1491
|
+
condition: {
|
|
1492
|
+
type: "JSFunction",
|
|
1493
|
+
value: 'target => !!target.getProps().getPropValue("localSettings.enable")',
|
|
1494
|
+
},
|
|
1495
|
+
setter: {
|
|
1496
|
+
componentName: "SelectSetter",
|
|
1497
|
+
props: {
|
|
1498
|
+
mode: "multiple",
|
|
1499
|
+
options: [
|
|
1500
|
+
{ title: '筛选', value: "filters" },
|
|
1501
|
+
{ title: '排序', value: "sorting" },
|
|
1502
|
+
{ title: '列配置', value: "columns" },
|
|
1503
|
+
],
|
|
1504
|
+
},
|
|
1505
|
+
},
|
|
1506
|
+
defaultValue: ["filters", "sorting", "columns"],
|
|
1507
|
+
},
|
|
1508
|
+
{
|
|
1509
|
+
name: "localSettings.excludedFilterFields",
|
|
1510
|
+
title: {
|
|
1511
|
+
label: {
|
|
1512
|
+
type: 'i18n',
|
|
1513
|
+
'en-US': 'Excluded filter fields',
|
|
1514
|
+
'zh-CN': '筛选排除字段',
|
|
1515
|
+
'zh-HK': '篩選排除字段',
|
|
1516
|
+
},
|
|
1517
|
+
tip: {
|
|
1518
|
+
type: 'i18n',
|
|
1519
|
+
'en-US': 'Filter fields that should not be remembered',
|
|
1520
|
+
'zh-CN': '不需要记忆的筛选字段',
|
|
1521
|
+
'zh-HK': '不需要記憶的篩選字段',
|
|
1522
|
+
},
|
|
1523
|
+
},
|
|
1524
|
+
// condition: {
|
|
1525
|
+
// type: "JSFunction",
|
|
1526
|
+
// value: 'target => { const enable = !!target.getProps().getPropValue("settingsMemory.enable"); const scope = target.getProps().getPropValue("settingsMemory.scope") || []; return enable && Array.isArray(scope) && scope.includes("filters"); }',
|
|
1527
|
+
// },
|
|
1528
|
+
condition: {
|
|
1529
|
+
type: "JSFunction",
|
|
1530
|
+
value: 'target => !!target.getProps().getPropValue("localSettings.enable")',
|
|
1531
|
+
},
|
|
1532
|
+
setter: {
|
|
1533
|
+
componentName: "SelectSetter",
|
|
1534
|
+
props: (target: any) => {
|
|
1535
|
+
const filterList = (target.parent.parent.getPropValue("filter.list") || []) as any[];
|
|
1536
|
+
return {
|
|
1537
|
+
mode: "multiple",
|
|
1538
|
+
options: filterList
|
|
1539
|
+
.map((item: any) => ({
|
|
1540
|
+
title:
|
|
1541
|
+
(item && (item.label?.["zh-CN"] || item.label?.["zh-HK"] || item.label?.en)) ||
|
|
1542
|
+
item?.key ||
|
|
1543
|
+
item?.columnKey ||
|
|
1544
|
+
"",
|
|
1545
|
+
value: item?.key || item?.columnKey || "",
|
|
1546
|
+
}))
|
|
1547
|
+
.filter((opt: any) => opt.value),
|
|
1548
|
+
};
|
|
1549
|
+
},
|
|
1550
|
+
},
|
|
1551
|
+
},
|
|
1552
|
+
],
|
|
1553
|
+
},
|
|
1450
1554
|
{
|
|
1451
1555
|
title: { label: "列配置", tip: "表格的列配置" },
|
|
1452
1556
|
display: "block",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/materials",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.8",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"vod-js-sdk-v6": "^1.4.11",
|
|
76
76
|
"antd-mobile": "^5.38.1",
|
|
77
77
|
"@pisell/date-picker": "3.0.7",
|
|
78
|
-
"@pisell/
|
|
79
|
-
"@pisell/
|
|
78
|
+
"@pisell/utils": "3.0.2",
|
|
79
|
+
"@pisell/icon": "0.0.11"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"react": "^18.0.0",
|