@pisell/materials 6.2.38 → 6.2.39
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/index.js +1 -1
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +5 -5
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- 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/useTableProps.d.ts +10 -11
- 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/Input.Subdomain/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +8 -8
- package/es/components/filter/types.d.ts +1 -0
- package/es/components/pisellCardList/index.js +3 -1
- package/es/components/pisellCheckboxGroup/index.d.ts +1 -0
- package/es/components/pisellCheckboxGroup/index.js +15 -1
- package/es/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +2 -1
- package/es/components/productCard/cartSkuCard/components/swipeAction/index.js +74 -6
- 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/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/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/components/walletCard/Guide/index.js +12 -1
- package/es/utils/index.d.ts +1 -1
- 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/useTableProps.d.ts +10 -11
- 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/Input.Subdomain/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +8 -8
- package/lib/components/filter/types.d.ts +1 -0
- package/lib/components/pisellCardList/index.js +3 -1
- package/lib/components/pisellCheckboxGroup/index.d.ts +1 -0
- package/lib/components/pisellCheckboxGroup/index.js +16 -0
- package/lib/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +2 -1
- 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/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/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/components/walletCard/Guide/index.js +11 -1
- 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
|
@@ -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,
|
|
@@ -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;
|
|
@@ -9,6 +9,7 @@ interface UseTablePropsProps {
|
|
|
9
9
|
refreshData: () => void;
|
|
10
10
|
handleFilterChange: (changedFields: any, allFields: any) => void;
|
|
11
11
|
tableRef: any;
|
|
12
|
+
getInitialValues: () => Record<string, any>;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* 处理table的props
|
|
@@ -17,7 +18,8 @@ interface UseTablePropsProps {
|
|
|
17
18
|
* @returns
|
|
18
19
|
*/
|
|
19
20
|
declare const useTableProps: (props: UseTablePropsProps) => {
|
|
20
|
-
|
|
21
|
+
currentComponentId: any;
|
|
22
|
+
title: number | boolean | React.ReactFragment | JSX.Element | (() => React.ReactNode) | null | undefined;
|
|
21
23
|
pagination: {
|
|
22
24
|
total: number;
|
|
23
25
|
current: number;
|
|
@@ -26,11 +28,13 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
26
28
|
showSizeChanger: boolean;
|
|
27
29
|
};
|
|
28
30
|
columns: import("./useColumns").Column[];
|
|
29
|
-
subTitle:
|
|
31
|
+
subTitle: number | boolean | React.ReactFragment | JSX.Element | (() => React.ReactNode) | null | undefined;
|
|
30
32
|
buttons: any[] | null;
|
|
31
|
-
filter:
|
|
33
|
+
filter: any;
|
|
32
34
|
onRow: (record: any) => any;
|
|
33
35
|
actionButtons: any[] | null;
|
|
36
|
+
__id?: string | undefined;
|
|
37
|
+
currentSettingKey?: string | undefined;
|
|
34
38
|
titleButtons?: {
|
|
35
39
|
show: boolean;
|
|
36
40
|
maxCount: number;
|
|
@@ -42,18 +46,12 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
42
46
|
items: OperationItem[];
|
|
43
47
|
} | undefined;
|
|
44
48
|
operation?: {
|
|
45
|
-
/**
|
|
46
|
-
* 处理table的props
|
|
47
|
-
* 转换title
|
|
48
|
-
* @param props
|
|
49
|
-
* @returns
|
|
50
|
-
*/
|
|
51
49
|
show: boolean;
|
|
52
50
|
title: string;
|
|
53
51
|
width: number;
|
|
54
52
|
align: "center" | "left" | "right";
|
|
55
53
|
fixed: false | "left" | "right";
|
|
56
|
-
type: "
|
|
54
|
+
type: "button" | "link";
|
|
57
55
|
items: OperationItem[];
|
|
58
56
|
} | undefined;
|
|
59
57
|
operationContent?: {
|
|
@@ -71,7 +69,7 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
71
69
|
useCustomAction: boolean;
|
|
72
70
|
actionType: string;
|
|
73
71
|
openMode: "modal" | "drawer";
|
|
74
|
-
openContentSize: "small" | "
|
|
72
|
+
openContentSize: "small" | "middle" | "large";
|
|
75
73
|
openTitle: string;
|
|
76
74
|
key: string;
|
|
77
75
|
} | undefined;
|
|
@@ -94,5 +92,6 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
94
92
|
create?: Record<string, any> | undefined;
|
|
95
93
|
destroy?: Record<string, any> | undefined;
|
|
96
94
|
} | undefined;
|
|
95
|
+
localSettings?: import("../../../table/types").LocalSettingsType | undefined;
|
|
97
96
|
};
|
|
98
97
|
export default useTableProps;
|
|
@@ -54,7 +54,8 @@ var useTableProps = (props) => {
|
|
|
54
54
|
closeDrawer,
|
|
55
55
|
refreshData,
|
|
56
56
|
handleFilterChange,
|
|
57
|
-
tableRef
|
|
57
|
+
tableRef,
|
|
58
|
+
getInitialValues
|
|
58
59
|
} = props;
|
|
59
60
|
const {
|
|
60
61
|
title: propsTitle,
|
|
@@ -66,7 +67,9 @@ var useTableProps = (props) => {
|
|
|
66
67
|
search,
|
|
67
68
|
clickToDetail,
|
|
68
69
|
onRow: propsOnRow,
|
|
69
|
-
filterBy
|
|
70
|
+
filterBy,
|
|
71
|
+
currentSettingKey,
|
|
72
|
+
__id
|
|
70
73
|
} = originProps;
|
|
71
74
|
const {
|
|
72
75
|
items,
|
|
@@ -260,16 +263,19 @@ var useTableProps = (props) => {
|
|
|
260
263
|
if (!(propsFilter == null ? void 0 : propsFilter.show) && !(search == null ? void 0 : search.show)) {
|
|
261
264
|
return null;
|
|
262
265
|
}
|
|
263
|
-
|
|
266
|
+
const dom = /* @__PURE__ */ import_react.default.createElement(
|
|
264
267
|
import_filter.default,
|
|
265
268
|
{
|
|
266
269
|
...propsFilter,
|
|
267
270
|
componentId,
|
|
268
271
|
search,
|
|
269
272
|
handleValuesChange: handleFilterChange,
|
|
270
|
-
filterBy
|
|
273
|
+
filterBy,
|
|
274
|
+
getInitialValues
|
|
271
275
|
}
|
|
272
276
|
);
|
|
277
|
+
dom.__proto__.items = propsFilter == null ? void 0 : propsFilter.items;
|
|
278
|
+
return dom;
|
|
273
279
|
}, [propsFilter, search]);
|
|
274
280
|
const onRow = (0, import_ahooks.useMemoizedFn)((record) => {
|
|
275
281
|
if (!(clickToDetail == null ? void 0 : clickToDetail.show)) {
|
|
@@ -300,6 +306,7 @@ var useTableProps = (props) => {
|
|
|
300
306
|
});
|
|
301
307
|
return {
|
|
302
308
|
...originProps,
|
|
309
|
+
currentComponentId: componentId,
|
|
303
310
|
title,
|
|
304
311
|
pagination,
|
|
305
312
|
columns,
|
|
@@ -11,7 +11,7 @@ declare type Params = {
|
|
|
11
11
|
sortBy: string;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
declare const useTableQuery: (props: DataSourceTableProps) => {
|
|
14
|
+
declare const useTableQuery: (props: DataSourceTableProps, currentSettingHash: string) => {
|
|
15
15
|
queryPageConfig: {
|
|
16
16
|
page: number;
|
|
17
17
|
pageSize: number;
|
|
@@ -28,5 +28,6 @@ declare const useTableQuery: (props: DataSourceTableProps) => {
|
|
|
28
28
|
refreshData: () => void;
|
|
29
29
|
handleFilterChange: (changedFields: any, allFields: any) => void;
|
|
30
30
|
refreshCurrentPage: () => void;
|
|
31
|
+
getInitialValues: () => Record<string, any>;
|
|
31
32
|
};
|
|
32
33
|
export default useTableQuery;
|
|
@@ -24,25 +24,61 @@ __export(useTableQuery_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(useTableQuery_exports);
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
var import_ahooks = require("ahooks");
|
|
27
|
-
var
|
|
27
|
+
var import_utils = require("../../../table/Table/utils");
|
|
28
|
+
var useTableQuery = (props, currentSettingHash) => {
|
|
28
29
|
var _a, _b, _c, _d;
|
|
29
|
-
const { filterBy, sortBy, tabs } = props;
|
|
30
|
+
const { filterBy, sortBy, tabs, localSettings } = props;
|
|
31
|
+
const tableId = (0, import_react.useMemo)(() => {
|
|
32
|
+
if (props.__designMode === "design") {
|
|
33
|
+
return "designMode-mock-table-id";
|
|
34
|
+
}
|
|
35
|
+
return (props == null ? void 0 : props.currentComponentId) || props.__id;
|
|
36
|
+
}, [props.__id, props.__designMode, props == null ? void 0 : props.currentComponentId]);
|
|
37
|
+
const currentViewMode = (0, import_react.useMemo)(() => (0, import_utils.getCurrentViewModeFromLocalStorage)(tableId) || "grid", [tableId]);
|
|
30
38
|
const [queryPageConfig, setQueryPageConfig] = (0, import_react.useState)({
|
|
31
39
|
page: 1,
|
|
32
40
|
pageSize: 20,
|
|
33
41
|
filter: ((_b = (_a = tabs == null ? void 0 : tabs.items) == null ? void 0 : _a[0]) == null ? void 0 : _b.filterBy) || filterBy || {},
|
|
34
42
|
sort: ((_d = (_c = tabs == null ? void 0 : tabs.items) == null ? void 0 : _c[0]) == null ? void 0 : _d.sortBy) || sortBy
|
|
35
43
|
});
|
|
44
|
+
const getInitialValues = (0, import_ahooks.useMemoizedFn)(() => {
|
|
45
|
+
try {
|
|
46
|
+
if (!tableId) return {};
|
|
47
|
+
const setting = (0, import_utils.getTableSettingByCurrentViewMode)(tableId, currentViewMode);
|
|
48
|
+
console.log("setting22", setting);
|
|
49
|
+
return (setting == null ? void 0 : setting.filters) || {};
|
|
50
|
+
} catch (e) {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
(0, import_react.useEffect)(() => {
|
|
55
|
+
var _a2;
|
|
56
|
+
if (!tableId) return;
|
|
57
|
+
const enable = !!((localSettings == null ? void 0 : localSettings.enable) && ((_a2 = localSettings.scope) == null ? void 0 : _a2.includes("filters")));
|
|
58
|
+
if (!enable) return;
|
|
59
|
+
const setting = (0, import_utils.getTableSettingByCurrentViewMode)(tableId, currentViewMode);
|
|
60
|
+
const persisted = (setting == null ? void 0 : setting.filters) || {};
|
|
61
|
+
if (persisted && Object.keys(persisted).length > 0) {
|
|
62
|
+
setQueryPageConfig((prev) => ({
|
|
63
|
+
...prev,
|
|
64
|
+
filter: { ...prev.filter, ...persisted }
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
}, [tableId, currentViewMode, JSON.stringify(localSettings)]);
|
|
36
68
|
const handleValuesChange = (0, import_ahooks.useMemoizedFn)(
|
|
37
69
|
(params, allParams) => {
|
|
70
|
+
var _a2;
|
|
38
71
|
const { page, size } = params.pagination || {};
|
|
72
|
+
let nextFilterForSave = null;
|
|
39
73
|
setQueryPageConfig((prev) => {
|
|
40
|
-
var
|
|
74
|
+
var _a3, _b2, _c2;
|
|
41
75
|
let sort = prev.sort || sortBy;
|
|
42
76
|
let filter = prev.filter;
|
|
43
77
|
if ("tabs" in params) {
|
|
44
|
-
sort = ((
|
|
45
|
-
|
|
78
|
+
sort = ((_a3 = params.tabs) == null ? void 0 : _a3.sortBy) || sortBy || "";
|
|
79
|
+
const tabsFilter = ((_b2 = params.tabs) == null ? void 0 : _b2.filterBy) || {};
|
|
80
|
+
filter = { ...prev.filter, ...tabsFilter };
|
|
81
|
+
nextFilterForSave = filter;
|
|
46
82
|
}
|
|
47
83
|
if ("order_by" in params) {
|
|
48
84
|
sort = params.order_by || ((_c2 = allParams.tabs) == null ? void 0 : _c2.sortBy) || sortBy;
|
|
@@ -55,15 +91,49 @@ var useTableQuery = (props) => {
|
|
|
55
91
|
filter
|
|
56
92
|
};
|
|
57
93
|
});
|
|
94
|
+
const enable = !!((localSettings == null ? void 0 : localSettings.enable) && ((_a2 = localSettings.scope) == null ? void 0 : _a2.includes("filters")));
|
|
95
|
+
if (enable && tableId && nextFilterForSave) {
|
|
96
|
+
const excluded = new Set((localSettings == null ? void 0 : localSettings.excludedFilterFields) || []);
|
|
97
|
+
const filtered = {};
|
|
98
|
+
Object.keys(nextFilterForSave).forEach((k) => {
|
|
99
|
+
if (!excluded.has(k)) {
|
|
100
|
+
filtered[k] = nextFilterForSave[k];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
(0, import_utils.setTableSettingToLocalStorage)({
|
|
104
|
+
tableId,
|
|
105
|
+
tableSettingObj: { filters: filtered },
|
|
106
|
+
currentViewMode,
|
|
107
|
+
currentSettingHash
|
|
108
|
+
});
|
|
109
|
+
}
|
|
58
110
|
}
|
|
59
111
|
);
|
|
60
112
|
const handleFilterChange = (0, import_ahooks.useMemoizedFn)(
|
|
61
113
|
(changedFields, allFields) => {
|
|
114
|
+
var _a2;
|
|
115
|
+
const nextFilter = { ...allFields };
|
|
62
116
|
setQueryPageConfig((prev) => ({
|
|
63
117
|
...prev,
|
|
64
118
|
page: 1,
|
|
65
|
-
filter: { ...prev.filter, ...
|
|
119
|
+
filter: { ...prev.filter, ...nextFilter, ...filterBy || {} }
|
|
66
120
|
}));
|
|
121
|
+
const enable = !!((localSettings == null ? void 0 : localSettings.enable) && ((_a2 = localSettings.scope) == null ? void 0 : _a2.includes("filters")));
|
|
122
|
+
if (enable && tableId) {
|
|
123
|
+
const excluded = new Set((localSettings == null ? void 0 : localSettings.excludedFilterFields) || []);
|
|
124
|
+
const filtered = {};
|
|
125
|
+
Object.keys(nextFilter || {}).forEach((k) => {
|
|
126
|
+
if (!excluded.has(k)) {
|
|
127
|
+
filtered[k] = nextFilter[k];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
(0, import_utils.setTableSettingToLocalStorage)({
|
|
131
|
+
tableId,
|
|
132
|
+
tableSettingObj: { filters: filtered },
|
|
133
|
+
currentViewMode,
|
|
134
|
+
currentSettingHash
|
|
135
|
+
});
|
|
136
|
+
}
|
|
67
137
|
}
|
|
68
138
|
);
|
|
69
139
|
const refreshData = (0, import_ahooks.useMemoizedFn)(() => {
|
|
@@ -83,7 +153,8 @@ var useTableQuery = (props) => {
|
|
|
83
153
|
handleValuesChange,
|
|
84
154
|
refreshData,
|
|
85
155
|
handleFilterChange,
|
|
86
|
-
refreshCurrentPage
|
|
156
|
+
refreshCurrentPage,
|
|
157
|
+
getInitialValues
|
|
87
158
|
};
|
|
88
159
|
};
|
|
89
160
|
var useTableQuery_default = useTableQuery;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ColumnType } from 'antd/es/table';
|
|
3
|
+
import { LocalSettingsType } from '../../table/types';
|
|
3
4
|
import { DataSourceType } from '../provider/dataSource/DataSourceContext';
|
|
4
5
|
export declare type OperationItem = {
|
|
5
6
|
label?: string;
|
|
@@ -13,6 +14,9 @@ export declare type OperationItem = {
|
|
|
13
14
|
afterClose?: () => void;
|
|
14
15
|
};
|
|
15
16
|
export interface DataSourceTableProps {
|
|
17
|
+
__id?: string;
|
|
18
|
+
currentComponentId?: string;
|
|
19
|
+
currentSettingKey?: string;
|
|
16
20
|
title?: string | React.ReactNode | (() => React.ReactNode);
|
|
17
21
|
subTitle?: string | React.ReactNode | (() => React.ReactNode);
|
|
18
22
|
titleButtons?: {
|
|
@@ -76,4 +80,5 @@ export interface DataSourceTableProps {
|
|
|
76
80
|
create?: Record<string, any>;
|
|
77
81
|
destroy?: Record<string, any>;
|
|
78
82
|
};
|
|
83
|
+
localSettings?: LocalSettingsType;
|
|
79
84
|
}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
declare const Subdomain: React.FC<import("antd").InputProps & {
|
|
3
3
|
onChange: (value: string) => void;
|
|
4
4
|
onBlur?: ((e: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
5
|
-
rootDomain: "custom" | "
|
|
5
|
+
rootDomain: "custom" | "saas" | "xzero";
|
|
6
6
|
customDomain?: string | undefined;
|
|
7
7
|
value?: string | undefined;
|
|
8
8
|
tenantId: string;
|
|
@@ -15,4 +15,4 @@ export declare const getFileMetadataParams: (file: RcFile & {
|
|
|
15
15
|
metadata?: MediaMetadata;
|
|
16
16
|
}) => Record<string, any>;
|
|
17
17
|
export declare const isValueEqual: (value: any, fileListValue: any) => boolean;
|
|
18
|
-
export declare const getBaseTime: (size: number) =>
|
|
18
|
+
export declare const getBaseTime: (size: number) => 2000 | 1000 | 4000 | 8000;
|
|
@@ -19,7 +19,7 @@ declare const formFieldMap: {
|
|
|
19
19
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
20
20
|
onChange: (value: string) => void;
|
|
21
21
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
22
|
-
rootDomain: "custom" | "
|
|
22
|
+
rootDomain: "custom" | "saas" | "xzero";
|
|
23
23
|
customDomain?: string | undefined;
|
|
24
24
|
value?: string | undefined;
|
|
25
25
|
tenantId: string;
|
|
@@ -59,11 +59,13 @@ 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<import("
|
|
62
|
+
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<any> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | (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("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> |
|
|
66
|
+
}) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & 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("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & {
|
|
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> & {
|
|
67
69
|
JSON: import("react").FC<any>;
|
|
68
70
|
Password: import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
69
71
|
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>;
|
|
@@ -76,14 +78,14 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
76
78
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
77
79
|
onChange: (value: string) => void;
|
|
78
80
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
79
|
-
rootDomain: "custom" | "
|
|
81
|
+
rootDomain: "custom" | "saas" | "xzero";
|
|
80
82
|
customDomain?: string | undefined;
|
|
81
83
|
value?: string | undefined;
|
|
82
84
|
tenantId: string;
|
|
83
85
|
name?: string | undefined;
|
|
84
86
|
fieldKey?: string | undefined;
|
|
85
87
|
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
86
|
-
}) | (import("react").FC<{}> & {
|
|
88
|
+
}) | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
|
|
87
89
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
88
90
|
} & {
|
|
89
91
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
@@ -95,7 +97,5 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
95
97
|
extraParams?: Record<string, any> | undefined;
|
|
96
98
|
} & {
|
|
97
99
|
dataSource?: any;
|
|
98
|
-
}) => JSX.Element) | import("react").FC<
|
|
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>;
|
|
100
|
+
}) => JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | 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 };
|
|
@@ -62,7 +62,8 @@ var PisellCardList = (props) => {
|
|
|
62
62
|
showValidDate,
|
|
63
63
|
empty,
|
|
64
64
|
showEmpty,
|
|
65
|
-
showBalanceSymbol
|
|
65
|
+
showBalanceSymbol,
|
|
66
|
+
onChangeDebounce
|
|
66
67
|
} = props;
|
|
67
68
|
return data.length ? /* @__PURE__ */ import_react.default.createElement(
|
|
68
69
|
import_pisellCheckboxGroup.default,
|
|
@@ -76,6 +77,7 @@ var PisellCardList = (props) => {
|
|
|
76
77
|
onChange,
|
|
77
78
|
iconPosition: "hide",
|
|
78
79
|
fullWidth,
|
|
80
|
+
onChangeDebounce,
|
|
79
81
|
renderOption: (item, active, index) => {
|
|
80
82
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
81
83
|
import_pisellWalletPassCard.default,
|
|
@@ -23,6 +23,7 @@ export interface PisellCheckboxGroupProps extends React.HTMLAttributes<HTMLDivEl
|
|
|
23
23
|
iconPosition?: 'left' | 'right' | 'hide';
|
|
24
24
|
optionClassName?: string;
|
|
25
25
|
optionActiveClassName?: string;
|
|
26
|
+
onChangeDebounce?: boolean;
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
29
|
* @title: PisellCheckboxGroup
|
|
@@ -36,6 +36,7 @@ var import_react = __toESM(require("react"));
|
|
|
36
36
|
var import_usePisellConfig = __toESM(require("../pisell-config-provider/hooks/usePisellConfig"));
|
|
37
37
|
var import_classnames = __toESM(require("classnames"));
|
|
38
38
|
var import_antd = require("antd");
|
|
39
|
+
var import_ahooks = require("ahooks");
|
|
39
40
|
var import_utils = require("@pisell/utils");
|
|
40
41
|
var import_utils2 = require("@pisell/utils");
|
|
41
42
|
var import_index = require("./index.less");
|
|
@@ -62,6 +63,7 @@ var PisellCheckboxGroup = (props) => {
|
|
|
62
63
|
iconPosition = "left",
|
|
63
64
|
optionClassName,
|
|
64
65
|
optionActiveClassName,
|
|
66
|
+
onChangeDebounce,
|
|
65
67
|
...rest
|
|
66
68
|
} = props;
|
|
67
69
|
const [_value, set_value] = (0, import_react2.useState)([]);
|
|
@@ -112,6 +114,16 @@ var PisellCheckboxGroup = (props) => {
|
|
|
112
114
|
const _onChange = (val, item) => {
|
|
113
115
|
onChange == null ? void 0 : onChange(mode === "single" ? val[0] : val, item);
|
|
114
116
|
};
|
|
117
|
+
const { run } = (0, import_ahooks.useDebounceFn)(
|
|
118
|
+
(key, item) => {
|
|
119
|
+
handleSelectItem(key, item);
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
wait: 400,
|
|
123
|
+
leading: true,
|
|
124
|
+
trailing: false
|
|
125
|
+
}
|
|
126
|
+
);
|
|
115
127
|
const handleSelectItem = (key, item) => {
|
|
116
128
|
let newVal = [key];
|
|
117
129
|
if (mode === "multiple") {
|
|
@@ -146,6 +158,10 @@ var PisellCheckboxGroup = (props) => {
|
|
|
146
158
|
style: rowStyle,
|
|
147
159
|
onClick: (e) => {
|
|
148
160
|
if (option.disabled) return;
|
|
161
|
+
if (onChangeDebounce) {
|
|
162
|
+
run(option[rowKey], option);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
149
165
|
handleSelectItem(option[rowKey], option);
|
|
150
166
|
},
|
|
151
167
|
leftContent: iconPosition === "left" && /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import './index.less';
|
|
3
4
|
declare type NativeProps<S extends string = never> = {
|
|
4
5
|
className?: string;
|
|
5
6
|
style?: React.CSSProperties & Partial<Record<S, string>>;
|
|
6
7
|
};
|
|
7
8
|
declare type PropagationEvent = 'click';
|
|
8
|
-
import './index.less';
|
|
9
9
|
declare type SideType = 'left' | 'right';
|
|
10
10
|
export declare type SwipeActionRef = {
|
|
11
11
|
close: () => void;
|
|
@@ -17,6 +17,7 @@ export declare type Action = {
|
|
|
17
17
|
text: ReactNode;
|
|
18
18
|
color?: ActionColor | string;
|
|
19
19
|
onClick?: (e: React.MouseEvent) => void;
|
|
20
|
+
style?: React.CSSProperties;
|
|
20
21
|
};
|
|
21
22
|
export declare type SwipeActionProps = {
|
|
22
23
|
rightActions?: Action[];
|
|
@@ -110,17 +110,26 @@ var SwipeAction = (0, import_react.forwardRef)(
|
|
|
110
110
|
const rootRef = (0, import_react.useRef)(null);
|
|
111
111
|
const leftRef = (0, import_react.useRef)(null);
|
|
112
112
|
const rightRef = (0, import_react.useRef)(null);
|
|
113
|
+
const [containerHeight, setContainerHeight] = (0, import_react.useState)(0);
|
|
113
114
|
function getWidth(ref2) {
|
|
114
115
|
const element = ref2.current;
|
|
115
116
|
if (!element) return 0;
|
|
116
117
|
return element.offsetWidth;
|
|
117
118
|
}
|
|
119
|
+
function getHeight(ref2) {
|
|
120
|
+
const element = ref2.current;
|
|
121
|
+
if (!element) return 0;
|
|
122
|
+
return element.offsetHeight;
|
|
123
|
+
}
|
|
118
124
|
function getLeftWidth() {
|
|
119
125
|
return getWidth(leftRef);
|
|
120
126
|
}
|
|
121
127
|
function getRightWidth() {
|
|
122
128
|
return getWidth(rightRef);
|
|
123
129
|
}
|
|
130
|
+
function getRootHeight() {
|
|
131
|
+
return getHeight(rootRef);
|
|
132
|
+
}
|
|
124
133
|
const [{ x }, api] = (0, import_web.useSpring)(
|
|
125
134
|
() => ({
|
|
126
135
|
x: 0,
|
|
@@ -213,6 +222,20 @@ var SwipeAction = (0, import_react.forwardRef)(
|
|
|
213
222
|
},
|
|
214
223
|
close
|
|
215
224
|
}));
|
|
225
|
+
(0, import_react.useEffect)(() => {
|
|
226
|
+
const updateHeight = () => {
|
|
227
|
+
const height = getRootHeight();
|
|
228
|
+
setContainerHeight(height);
|
|
229
|
+
};
|
|
230
|
+
updateHeight();
|
|
231
|
+
const resizeObserver = new ResizeObserver(updateHeight);
|
|
232
|
+
if (rootRef.current) {
|
|
233
|
+
resizeObserver.observe(rootRef.current);
|
|
234
|
+
}
|
|
235
|
+
return () => {
|
|
236
|
+
resizeObserver.disconnect();
|
|
237
|
+
};
|
|
238
|
+
}, []);
|
|
216
239
|
(0, import_react.useEffect)(() => {
|
|
217
240
|
if (!props.closeOnTouchOutside) return;
|
|
218
241
|
function handle(e) {
|
|
@@ -238,14 +261,32 @@ var SwipeAction = (0, import_react.forwardRef)(
|
|
|
238
261
|
document.removeEventListener("mousedown", handle);
|
|
239
262
|
};
|
|
240
263
|
}, [props.closeOnTouchOutside, props.escapeDom]);
|
|
241
|
-
|
|
264
|
+
const getRightContainerClass = () => {
|
|
265
|
+
const baseClass = `${classPrefix}-actions ${classPrefix}-actions-right`;
|
|
266
|
+
if (containerHeight > 180) {
|
|
267
|
+
return `${baseClass} ${classPrefix}-height-large`;
|
|
268
|
+
} else if (containerHeight > 120) {
|
|
269
|
+
return `${baseClass} ${classPrefix}-height-medium`;
|
|
270
|
+
}
|
|
271
|
+
return `${baseClass} ${classPrefix}-height-small`;
|
|
272
|
+
};
|
|
273
|
+
const getRightActionButtonClass = () => {
|
|
274
|
+
if (containerHeight > 180) {
|
|
275
|
+
return `${classPrefix}-action-height-large`;
|
|
276
|
+
} else if (containerHeight > 120) {
|
|
277
|
+
return `${classPrefix}-action-height-medium`;
|
|
278
|
+
}
|
|
279
|
+
return `${classPrefix}-action-height-small`;
|
|
280
|
+
};
|
|
281
|
+
function renderAction(action, isRightAction = false) {
|
|
242
282
|
const color = action.color ?? "light";
|
|
243
283
|
const _style = action.style || {};
|
|
284
|
+
const buttonClass = isRightAction ? `${classPrefix}-action-button ${getRightActionButtonClass()}` : `${classPrefix}-action-button`;
|
|
244
285
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
245
286
|
Button,
|
|
246
287
|
{
|
|
247
288
|
key: action.key,
|
|
248
|
-
className:
|
|
289
|
+
className: buttonClass,
|
|
249
290
|
style: {
|
|
250
291
|
"--background-color": colorRecord[color] ?? color,
|
|
251
292
|
..._style
|
|
@@ -285,7 +326,7 @@ var SwipeAction = (0, import_react.forwardRef)(
|
|
|
285
326
|
className: `${classPrefix}-actions ${classPrefix}-actions-left`,
|
|
286
327
|
ref: leftRef
|
|
287
328
|
},
|
|
288
|
-
props.leftActions.map(renderAction)
|
|
329
|
+
props.leftActions.map((action) => renderAction(action, false))
|
|
289
330
|
)
|
|
290
331
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
291
332
|
"div",
|
|
@@ -312,14 +353,7 @@ var SwipeAction = (0, import_react.forwardRef)(
|
|
|
312
353
|
)
|
|
313
354
|
), withStopPropagation(
|
|
314
355
|
props.stopPropagation,
|
|
315
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
316
|
-
"div",
|
|
317
|
-
{
|
|
318
|
-
className: `${classPrefix}-actions ${classPrefix}-actions-right`,
|
|
319
|
-
ref: rightRef
|
|
320
|
-
},
|
|
321
|
-
props.rightActions.map(renderAction)
|
|
322
|
-
)
|
|
356
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: getRightContainerClass(), ref: rightRef }, props.rightActions.map((action) => renderAction(action, true)))
|
|
323
357
|
))
|
|
324
358
|
)
|
|
325
359
|
);
|
|
@@ -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
|
+
}
|