@pisell/materials 1.0.1008 → 1.0.1009
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 +6 -6
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +22 -22
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +22 -22
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
- package/es/components/dataSourceComponents/fields/index.d.ts +6 -6
- package/es/components/pisellDataSourceContainer/components/ColumnsSetting/index.d.ts +7 -1
- package/es/components/pisellDataSourceContainer/components/ColumnsSetting/index.js +30 -3
- package/es/components/pisellDataSourceContainer/components/ColumnsSetting/utils.d.ts +22 -0
- package/es/components/pisellDataSourceContainer/components/ColumnsSetting/utils.js +117 -0
- package/es/components/pisellDataSourceContainer/components/Pagination/index.js +15 -11
- package/es/components/pisellDataSourceContainer/components/Table/index.d.ts +1 -0
- package/es/components/pisellDataSourceContainer/components/Table/index.js +5 -3
- package/es/components/pisellDataSourceContainer/components/Table/useColumns.d.ts +1 -0
- package/es/components/pisellDataSourceContainer/components/Table/useColumns.js +37 -15
- package/es/components/pisellDataSourceContainer/hooks/useDataSourceKey.d.ts +2 -2
- package/es/components/productCard/cartSkuCard/components/packages/utils.d.ts +1 -1
- package/es/components/productCard/components/Packages/utils.d.ts +1 -1
- package/es/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/es/components/table/Table/fields/index.d.ts +2 -2
- package/es/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- 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/utils/index.d.ts +1 -1
- package/es/utils/platform.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
- package/lib/components/dataSourceComponents/fields/index.d.ts +6 -6
- package/lib/components/pisellDataSourceContainer/components/ColumnsSetting/index.d.ts +7 -1
- package/lib/components/pisellDataSourceContainer/components/ColumnsSetting/index.js +18 -2
- package/lib/components/pisellDataSourceContainer/components/ColumnsSetting/utils.d.ts +22 -0
- package/lib/components/pisellDataSourceContainer/components/ColumnsSetting/utils.js +121 -0
- package/lib/components/pisellDataSourceContainer/components/Pagination/index.js +15 -7
- package/lib/components/pisellDataSourceContainer/components/Table/index.d.ts +1 -0
- package/lib/components/pisellDataSourceContainer/components/Table/index.js +3 -1
- package/lib/components/pisellDataSourceContainer/components/Table/useColumns.d.ts +1 -0
- package/lib/components/pisellDataSourceContainer/components/Table/useColumns.js +25 -14
- package/lib/components/pisellDataSourceContainer/hooks/useDataSourceKey.d.ts +2 -2
- package/lib/components/productCard/cartSkuCard/components/packages/utils.d.ts +1 -1
- package/lib/components/productCard/components/Packages/utils.d.ts +1 -1
- package/lib/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/lib/components/table/Table/fields/index.d.ts +2 -2
- package/lib/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- 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/utils/index.d.ts +1 -1
- package/lib/utils/platform.d.ts +1 -1
- package/package.json +2 -2
|
@@ -59,13 +59,11 @@ declare const formFieldMap: {
|
|
|
59
59
|
FormItemTranslation: import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
60
60
|
FormItemIconSelect: import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
61
61
|
};
|
|
62
|
-
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<any> | import("react").FC<import("./
|
|
62
|
+
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<any> | import("react").FC<import("./DatePicker").DataSourceDatePickerProps> | (import("react").FC<{}> & {
|
|
63
63
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
64
64
|
} & {
|
|
65
65
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
66
|
-
}) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./
|
|
67
|
-
onChange: (value: string) => void;
|
|
68
|
-
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Mobile/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<import("./Input/type").InputProps> & {
|
|
66
|
+
}) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<import("./Input/type").InputProps> & {
|
|
69
67
|
JSON: import("react").FC<any>;
|
|
70
68
|
Password: import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
71
69
|
TextArea: import("react").FC<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
@@ -85,7 +83,7 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
85
83
|
name?: string | undefined;
|
|
86
84
|
fieldKey?: string | undefined;
|
|
87
85
|
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
88
|
-
}) |
|
|
86
|
+
}) | (import("react").FC<{}> & {
|
|
89
87
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
90
88
|
} & {
|
|
91
89
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
@@ -97,5 +95,7 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
97
95
|
extraParams?: Record<string, any> | undefined;
|
|
98
96
|
} & {
|
|
99
97
|
dataSource?: any;
|
|
100
|
-
}) => JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./
|
|
98
|
+
}) => JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Mobile/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & {
|
|
99
|
+
onChange: (value: string) => void;
|
|
100
|
+
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
101
101
|
export { getFieldComponent, formFieldMap };
|
|
@@ -6,6 +6,7 @@ export declare const COLUMNS_SHARED_STATE_KEYS: {
|
|
|
6
6
|
};
|
|
7
7
|
export interface ColumnsSettingProps {
|
|
8
8
|
scopeId?: string;
|
|
9
|
+
__id?: string;
|
|
9
10
|
}
|
|
10
11
|
export interface ColumnSettingItem {
|
|
11
12
|
key: string;
|
|
@@ -16,7 +17,12 @@ export interface ColumnSettingItem {
|
|
|
16
17
|
sortIndex?: number;
|
|
17
18
|
fixed?: 'left' | 'right' | boolean;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* 暴露给父组件的 ref 方法
|
|
22
|
+
*/
|
|
23
|
+
export interface ColumnsSettingRef {
|
|
24
|
+
}
|
|
25
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<ColumnsSettingProps & DataSourceContainerContextType & React.RefAttributes<ColumnsSettingRef> & {
|
|
20
26
|
refId?: string | undefined;
|
|
21
27
|
}, "ref"> & React.RefAttributes<any>>;
|
|
22
28
|
export default _default;
|
|
@@ -36,14 +36,16 @@ module.exports = __toCommonJS(ColumnsSetting_exports);
|
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_withContainer = __toESM(require("../../utils/withContainer"));
|
|
38
38
|
var import_ColumnsSetting = __toESM(require("../../../table/Actions/component/ColumnsSetting"));
|
|
39
|
+
var import_utils = require("./utils");
|
|
39
40
|
var COLUMNS_SHARED_STATE_KEYS = {
|
|
40
41
|
columnsValue: (instanceId) => `${instanceId}:columns:value`,
|
|
41
42
|
columnsChange: (instanceId) => `${instanceId}:columns:change`
|
|
42
43
|
};
|
|
43
44
|
var WithColumnsSetting = (0, import_react.forwardRef)(
|
|
44
|
-
(props) => {
|
|
45
|
-
const { refManager, scopeId = "table" } = props;
|
|
45
|
+
(props, ref) => {
|
|
46
|
+
const { refManager, scopeId = "table", __id } = props;
|
|
46
47
|
const [value, setValue] = (0, import_react.useState)([]);
|
|
48
|
+
(0, import_react.useImperativeHandle)(ref, () => ({}), []);
|
|
47
49
|
(0, import_react.useEffect)(() => {
|
|
48
50
|
const unsubscribe = refManager.subscribeSharedState(
|
|
49
51
|
COLUMNS_SHARED_STATE_KEYS.columnsValue(scopeId),
|
|
@@ -58,6 +60,20 @@ var WithColumnsSetting = (0, import_react.forwardRef)(
|
|
|
58
60
|
COLUMNS_SHARED_STATE_KEYS.columnsChange(scopeId),
|
|
59
61
|
typedValue
|
|
60
62
|
);
|
|
63
|
+
if (__id) {
|
|
64
|
+
(0, import_utils.saveColumnSettingToLocal)({
|
|
65
|
+
componentId: __id,
|
|
66
|
+
columnSetting: typedValue.map((col, index) => ({
|
|
67
|
+
key: col.key,
|
|
68
|
+
dataIndex: col.dataIndex,
|
|
69
|
+
title: col.title,
|
|
70
|
+
titleString: col.titleString,
|
|
71
|
+
isShow: col.isShow,
|
|
72
|
+
sortIndex: col.sortIndex ?? index,
|
|
73
|
+
fixed: col.fixed
|
|
74
|
+
}))
|
|
75
|
+
});
|
|
76
|
+
}
|
|
61
77
|
};
|
|
62
78
|
return /* @__PURE__ */ import_react.default.createElement(import_ColumnsSetting.default, { value, onChange });
|
|
63
79
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const saveColumnSettingToLocal: ({ componentId, columnSetting, }: {
|
|
3
|
+
componentId: string;
|
|
4
|
+
columnSetting: Array<{
|
|
5
|
+
key: string;
|
|
6
|
+
dataIndex: string;
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
titleString?: string;
|
|
9
|
+
isShow: boolean;
|
|
10
|
+
sortIndex?: number;
|
|
11
|
+
fixed?: 'left' | 'right' | boolean;
|
|
12
|
+
}>;
|
|
13
|
+
}) => void;
|
|
14
|
+
export declare const getColumnSettingFromLocal: (componentId?: string) => any;
|
|
15
|
+
export declare const mergeColumnSettingSimple: ({ columns, componentId, }: {
|
|
16
|
+
columns: Record<string, any>[];
|
|
17
|
+
componentId?: string | undefined;
|
|
18
|
+
}) => {
|
|
19
|
+
isShow: any;
|
|
20
|
+
sortIndex: any;
|
|
21
|
+
}[];
|
|
22
|
+
export declare const clearColumnSettingFromLocal: (componentId?: string) => void;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/pisellDataSourceContainer/components/ColumnsSetting/utils.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
clearColumnSettingFromLocal: () => clearColumnSettingFromLocal,
|
|
23
|
+
getColumnSettingFromLocal: () => getColumnSettingFromLocal,
|
|
24
|
+
mergeColumnSettingSimple: () => mergeColumnSettingSimple,
|
|
25
|
+
saveColumnSettingToLocal: () => saveColumnSettingToLocal
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(utils_exports);
|
|
28
|
+
var import_utils = require("@pisell/utils");
|
|
29
|
+
var getTableKey = (componentId) => {
|
|
30
|
+
if (typeof window === "undefined" || typeof window.location === "undefined") {
|
|
31
|
+
return `table-setting-${componentId}`;
|
|
32
|
+
}
|
|
33
|
+
const { pathname, search } = window.location;
|
|
34
|
+
let appendPath = pathname || "/";
|
|
35
|
+
let memoryKey = "";
|
|
36
|
+
try {
|
|
37
|
+
const params = new URLSearchParams(search || "");
|
|
38
|
+
const mk = params.get("memory_key");
|
|
39
|
+
if (mk && mk.trim() !== "") {
|
|
40
|
+
memoryKey = mk.trim();
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {
|
|
43
|
+
}
|
|
44
|
+
const urlPart = memoryKey ? `${appendPath}#${memoryKey}` : appendPath;
|
|
45
|
+
return `table-setting-${componentId}-${urlPart}`;
|
|
46
|
+
};
|
|
47
|
+
var saveColumnSettingToLocal = ({
|
|
48
|
+
componentId,
|
|
49
|
+
columnSetting
|
|
50
|
+
}) => {
|
|
51
|
+
if (!componentId) return;
|
|
52
|
+
const storageKey = getTableKey(componentId);
|
|
53
|
+
const data = {
|
|
54
|
+
column_setting: columnSetting,
|
|
55
|
+
updatedAt: Date.now()
|
|
56
|
+
};
|
|
57
|
+
localStorage.setItem(storageKey, JSON.stringify(data));
|
|
58
|
+
};
|
|
59
|
+
var getColumnSettingFromLocal = (componentId) => {
|
|
60
|
+
if (!componentId) return null;
|
|
61
|
+
const storageKey = getTableKey(componentId);
|
|
62
|
+
const originData = localStorage.getItem(storageKey);
|
|
63
|
+
if (originData && (0, import_utils.isJson)(originData)) {
|
|
64
|
+
const data = JSON.parse(originData);
|
|
65
|
+
return data.column_setting;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
};
|
|
69
|
+
var mergeColumnSettingSimple = ({
|
|
70
|
+
columns,
|
|
71
|
+
componentId
|
|
72
|
+
}) => {
|
|
73
|
+
if (!componentId) {
|
|
74
|
+
return columns.map((item, index) => ({
|
|
75
|
+
...item,
|
|
76
|
+
isShow: item.isShow ?? true,
|
|
77
|
+
sortIndex: index
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
const cachedColumns = getColumnSettingFromLocal(componentId);
|
|
81
|
+
if (!cachedColumns || !Array.isArray(cachedColumns)) {
|
|
82
|
+
return columns.map((item, index) => ({
|
|
83
|
+
...item,
|
|
84
|
+
isShow: item.isShow ?? true,
|
|
85
|
+
sortIndex: index
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
const cachedMap = new Map(
|
|
89
|
+
cachedColumns.map((item) => [item.dataIndex, item])
|
|
90
|
+
);
|
|
91
|
+
const mergedColumns = columns.map((item, index) => {
|
|
92
|
+
const cached = cachedMap.get(item.dataIndex);
|
|
93
|
+
if (cached) {
|
|
94
|
+
return {
|
|
95
|
+
...item,
|
|
96
|
+
isShow: cached.isShow ?? true,
|
|
97
|
+
sortIndex: cached.sortIndex ?? index
|
|
98
|
+
// 注意:fixed 等特殊字段不从缓存中覆盖,保持 props 传入的值
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
...item,
|
|
103
|
+
isShow: item.isShow ?? true,
|
|
104
|
+
sortIndex: index
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
mergedColumns.sort((a, b) => (a.sortIndex ?? 0) - (b.sortIndex ?? 0));
|
|
108
|
+
return mergedColumns;
|
|
109
|
+
};
|
|
110
|
+
var clearColumnSettingFromLocal = (componentId) => {
|
|
111
|
+
if (!componentId) return;
|
|
112
|
+
const storageKey = getTableKey(componentId);
|
|
113
|
+
localStorage.removeItem(storageKey);
|
|
114
|
+
};
|
|
115
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
+
0 && (module.exports = {
|
|
117
|
+
clearColumnSettingFromLocal,
|
|
118
|
+
getColumnSettingFromLocal,
|
|
119
|
+
mergeColumnSettingSimple,
|
|
120
|
+
saveColumnSettingToLocal
|
|
121
|
+
});
|
|
@@ -44,6 +44,20 @@ var WithPagination = (0, import_react.forwardRef)(
|
|
|
44
44
|
...otherProps
|
|
45
45
|
} = props;
|
|
46
46
|
const { pagination, data } = listAction;
|
|
47
|
+
const paginationProps = (0, import_react.useMemo)(() => {
|
|
48
|
+
return {
|
|
49
|
+
showTotal: (total) => {
|
|
50
|
+
return (0, import_locales.getText)("table-pagination-total")(
|
|
51
|
+
(pagination == null ? void 0 : pagination.pageNumber) || 1,
|
|
52
|
+
Math.ceil(total / ((pagination == null ? void 0 : pagination.pageSize) || 10))
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
total: (data == null ? void 0 : data.count) || 0,
|
|
56
|
+
current: (pagination == null ? void 0 : pagination.pageNumber) || 1,
|
|
57
|
+
pageSize: (pagination == null ? void 0 : pagination.pageSize) || 10,
|
|
58
|
+
onChange: listAction.onPageChange
|
|
59
|
+
};
|
|
60
|
+
}, [pagination == null ? void 0 : pagination.pageNumber, pagination == null ? void 0 : pagination.pageSize, data == null ? void 0 : data.count, listAction.onPageChange]);
|
|
47
61
|
if (!pagination) {
|
|
48
62
|
console.error("分页功能未启用");
|
|
49
63
|
return null;
|
|
@@ -51,14 +65,8 @@ var WithPagination = (0, import_react.forwardRef)(
|
|
|
51
65
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
52
66
|
import_Pagination.default,
|
|
53
67
|
{
|
|
54
|
-
showTotal: (total) => {
|
|
55
|
-
return (0, import_locales.getText)("table-pagination-total")((pagination == null ? void 0 : pagination.pageNumber) || 1, total);
|
|
56
|
-
},
|
|
57
68
|
...otherProps,
|
|
58
|
-
|
|
59
|
-
current: (pagination == null ? void 0 : pagination.pageNumber) || 1,
|
|
60
|
-
pageSize: (pagination == null ? void 0 : pagination.pageSize) || 10,
|
|
61
|
-
onChange: listAction.onPageChange
|
|
69
|
+
...paginationProps
|
|
62
70
|
}
|
|
63
71
|
);
|
|
64
72
|
}
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { DataSourceContainerContextType } from '../../type';
|
|
3
3
|
declare const _default: React.ForwardRefExoticComponent<Omit<Partial<import("antd").TableProps<any>> & DataSourceContainerContextType & {
|
|
4
4
|
scopeId?: string | undefined;
|
|
5
|
+
__id?: string | undefined;
|
|
5
6
|
} & React.RefAttributes<unknown> & {
|
|
6
7
|
refId?: string | undefined;
|
|
7
8
|
}, "ref"> & React.RefAttributes<any>>;
|
|
@@ -43,13 +43,15 @@ var WithTable = (0, import_react.forwardRef)(
|
|
|
43
43
|
refManager,
|
|
44
44
|
columns,
|
|
45
45
|
scopeId = "table",
|
|
46
|
+
__id,
|
|
46
47
|
...otherProps
|
|
47
48
|
} = props;
|
|
48
49
|
const { data, loading } = listAction;
|
|
49
50
|
const { visibleColumns } = (0, import_useColumns.default)({
|
|
50
51
|
columns: columns || [],
|
|
51
52
|
scopeId,
|
|
52
|
-
refManager
|
|
53
|
+
refManager,
|
|
54
|
+
__id
|
|
53
55
|
});
|
|
54
56
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
55
57
|
import_antd.Table,
|
|
@@ -24,18 +24,31 @@ __export(useColumns_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(useColumns_exports);
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
var import_ColumnsSetting = require("../ColumnsSetting");
|
|
27
|
+
var import_utils = require("../ColumnsSetting/utils");
|
|
27
28
|
var useColumns = (params) => {
|
|
28
|
-
const { columns, scopeId, refManager } = params;
|
|
29
|
+
const { columns, scopeId, refManager, __id } = params;
|
|
29
30
|
const [columnSettings, setColumnSettings] = (0, import_react.useState)([]);
|
|
30
31
|
(0, import_react.useEffect)(() => {
|
|
31
32
|
if (!(columns == null ? void 0 : columns.length)) return;
|
|
32
|
-
const
|
|
33
|
-
|
|
33
|
+
const mergedColumns = (0, import_utils.mergeColumnSettingSimple)({
|
|
34
|
+
columns: columns.map((col, index) => ({
|
|
35
|
+
key: col.key || col.dataIndex,
|
|
36
|
+
dataIndex: col.dataIndex,
|
|
37
|
+
title: col.title,
|
|
38
|
+
titleString: typeof col.title === "string" ? col.title : col.dataIndex,
|
|
39
|
+
isShow: typeof col.isShow === "boolean" ? col.isShow : true,
|
|
40
|
+
sortIndex: index,
|
|
41
|
+
fixed: col.fixed
|
|
42
|
+
})),
|
|
43
|
+
componentId: __id
|
|
44
|
+
});
|
|
45
|
+
const settings = mergedColumns.map((col) => ({
|
|
46
|
+
key: col.key,
|
|
34
47
|
dataIndex: col.dataIndex,
|
|
35
48
|
title: col.title,
|
|
36
|
-
titleString:
|
|
37
|
-
isShow:
|
|
38
|
-
sortIndex:
|
|
49
|
+
titleString: col.titleString,
|
|
50
|
+
isShow: col.isShow,
|
|
51
|
+
sortIndex: col.sortIndex,
|
|
39
52
|
fixed: col.fixed
|
|
40
53
|
}));
|
|
41
54
|
refManager.setSharedState(
|
|
@@ -43,7 +56,7 @@ var useColumns = (params) => {
|
|
|
43
56
|
settings
|
|
44
57
|
);
|
|
45
58
|
setColumnSettings(settings);
|
|
46
|
-
}, [columns, refManager, scopeId]);
|
|
59
|
+
}, [columns, refManager, scopeId, __id]);
|
|
47
60
|
(0, import_react.useEffect)(() => {
|
|
48
61
|
const unsubscribe = refManager.subscribeSharedState(
|
|
49
62
|
import_ColumnsSetting.COLUMNS_SHARED_STATE_KEYS.columnsChange(scopeId),
|
|
@@ -51,14 +64,12 @@ var useColumns = (params) => {
|
|
|
51
64
|
);
|
|
52
65
|
return unsubscribe;
|
|
53
66
|
}, [refManager, scopeId]);
|
|
54
|
-
|
|
55
|
-
if (!(columns == null ? void 0 : columns.length)) return [];
|
|
56
|
-
if (!(columnSettings == null ? void 0 : columnSettings.length)) return columns;
|
|
67
|
+
return (0, import_react.useMemo)(() => {
|
|
68
|
+
if (!(columns == null ? void 0 : columns.length)) return { visibleColumns: [] };
|
|
69
|
+
if (!(columnSettings == null ? void 0 : columnSettings.length)) return { visibleColumns: columns };
|
|
57
70
|
const columnMap = new Map(columns.map((col) => [col.dataIndex, col]));
|
|
58
|
-
|
|
71
|
+
const visibleColumns = columnSettings.filter((setting) => setting.isShow).map((setting) => columnMap.get(setting.dataIndex)).filter(Boolean);
|
|
72
|
+
return { visibleColumns };
|
|
59
73
|
}, [columns, columnSettings]);
|
|
60
|
-
return {
|
|
61
|
-
visibleColumns
|
|
62
|
-
};
|
|
63
74
|
};
|
|
64
75
|
var useColumns_default = useColumns;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const useDataSourceKey: () => {
|
|
2
|
-
dataSourceKey: string |
|
|
3
|
-
dataSourceKeyRef: import("react").MutableRefObject<string |
|
|
2
|
+
dataSourceKey: string | undefined;
|
|
3
|
+
dataSourceKeyRef: import("react").MutableRefObject<string | undefined>;
|
|
4
4
|
};
|
|
5
5
|
export default useDataSourceKey;
|
|
@@ -17,4 +17,4 @@ export declare const minusSign: (item: any, type?: string) => "" | "-";
|
|
|
17
17
|
* @Author: WangHan
|
|
18
18
|
* @Date: 2024-11-22 10:58
|
|
19
19
|
*/
|
|
20
|
-
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) =>
|
|
20
|
+
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) => string | number;
|
|
@@ -17,4 +17,4 @@ export declare const minusSign: (item: any, type?: string) => "" | "-";
|
|
|
17
17
|
* @Author: WangHan
|
|
18
18
|
* @Date: 2024-11-22 10:58
|
|
19
19
|
*/
|
|
20
|
-
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) =>
|
|
20
|
+
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) => string | number;
|
|
@@ -197,12 +197,12 @@ export declare const fieldList: ({
|
|
|
197
197
|
field_icon: string;
|
|
198
198
|
field_name: string;
|
|
199
199
|
field_type: string;
|
|
200
|
-
default_value:
|
|
200
|
+
default_value: boolean;
|
|
201
201
|
} | {
|
|
202
202
|
field_icon: string;
|
|
203
203
|
field_name: string;
|
|
204
204
|
field_type: string;
|
|
205
|
-
default_value:
|
|
205
|
+
default_value: string;
|
|
206
206
|
} | {
|
|
207
207
|
field_icon: string;
|
|
208
208
|
field_name: string;
|
|
@@ -161,7 +161,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
|
|
|
161
161
|
sort?: SortType | undefined;
|
|
162
162
|
mode: "" | "localStorage" | "remote";
|
|
163
163
|
currentViewMode: ModeType;
|
|
164
|
-
}) => ("filters" | "
|
|
164
|
+
}) => ("filters" | "order_by" | "group_by" | "column_setting" | "gallery_setting" | "filter_setting" | "view_mode")[];
|
|
165
165
|
export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
|
|
166
166
|
export declare const stringify: (obj: Record<string, any>) => string;
|
|
167
167
|
export {};
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/platform.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isMobile: () =>
|
|
1
|
+
export declare const isMobile: () => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/materials",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1009",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"swiper": "^8.4.7",
|
|
89
89
|
"antd-mobile": "^5.38.1",
|
|
90
90
|
"vod-js-sdk-v6": "^1.4.11",
|
|
91
|
-
"@pisell/date-picker": "1.0.
|
|
91
|
+
"@pisell/date-picker": "1.0.129",
|
|
92
92
|
"@pisell/icon": "0.0.10",
|
|
93
93
|
"@pisell/utils": "1.0.56"
|
|
94
94
|
},
|