@fctc/widget-logic 2.3.0 → 2.3.2
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/dist/index.js +26 -8
- package/dist/index.mjs +27 -8
- package/dist/widget.d.mts +14 -2
- package/dist/widget.d.ts +14 -2
- package/dist/widget.js +26 -8
- package/dist/widget.mjs +27 -8
- package/package.json +96 -96
package/dist/index.js
CHANGED
|
@@ -6998,21 +6998,27 @@ var tableGroupController = (props) => {
|
|
|
6998
6998
|
const {
|
|
6999
6999
|
rows,
|
|
7000
7000
|
columns,
|
|
7001
|
+
indexRow,
|
|
7001
7002
|
row,
|
|
7002
7003
|
model,
|
|
7003
7004
|
viewData,
|
|
7005
|
+
renderField,
|
|
7004
7006
|
level,
|
|
7005
7007
|
specification,
|
|
7006
7008
|
domain,
|
|
7007
7009
|
context,
|
|
7008
7010
|
checkedAll,
|
|
7009
7011
|
isDisplayCheckbox,
|
|
7012
|
+
isAutoSelect,
|
|
7013
|
+
setIsAutoSelect,
|
|
7010
7014
|
selectedRowKeysRef
|
|
7011
7015
|
} = props;
|
|
7012
7016
|
const [pageGroup, setPageGroup] = (0, import_react23.useState)(0);
|
|
7013
7017
|
const { groupByDomain, selectedTags } = (0, import_store10.useAppSelector)(import_store10.selectSearch);
|
|
7014
7018
|
const { selectedRowKeys } = (0, import_store10.useAppSelector)(import_store10.selectList);
|
|
7015
7019
|
const appDispatch = (0, import_store10.useAppDispatch)();
|
|
7020
|
+
const { toDataJS } = (0, import_hooks15.useOdooDataTransform)();
|
|
7021
|
+
const initVal = toDataJS(row, viewData, model);
|
|
7016
7022
|
const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
|
|
7017
7023
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
|
|
7018
7024
|
fromStart: 1,
|
|
@@ -7047,14 +7053,15 @@ var tableGroupController = (props) => {
|
|
|
7047
7053
|
groupby: [groupByDomain?.contexts[level]?.group_by]
|
|
7048
7054
|
};
|
|
7049
7055
|
const queryKey = [
|
|
7050
|
-
`data-${model}
|
|
7056
|
+
`data-${model}--${level}-row${indexRow}`,
|
|
7051
7057
|
specification,
|
|
7052
7058
|
domain,
|
|
7053
7059
|
pageGroup
|
|
7054
7060
|
];
|
|
7055
7061
|
const {
|
|
7056
7062
|
data: dataResponse,
|
|
7057
|
-
isFetched:
|
|
7063
|
+
isFetched: isQueryFetched,
|
|
7064
|
+
isPlaceholderData,
|
|
7058
7065
|
isLoading,
|
|
7059
7066
|
isFetching
|
|
7060
7067
|
} = (0, import_hooks15.useGetListData)(listDataProps, queryKey, enabled);
|
|
@@ -7071,6 +7078,7 @@ var tableGroupController = (props) => {
|
|
|
7071
7078
|
typeTable: dataResponse?.groups ? "group" : "list"
|
|
7072
7079
|
}
|
|
7073
7080
|
});
|
|
7081
|
+
const leftPadding = level > 1 ? level * 8 + "px" : "0px";
|
|
7074
7082
|
(0, import_react23.useEffect)(() => {
|
|
7075
7083
|
if (isShowGroup && selectedTags?.length > 0) {
|
|
7076
7084
|
setIsShowGroup(false);
|
|
@@ -7082,7 +7090,7 @@ var tableGroupController = (props) => {
|
|
|
7082
7090
|
)?.[1] : row[group_by_field_name];
|
|
7083
7091
|
const nameGroupWithCount = `${typeof nameGroup === "string" ? nameGroup : typeof nameGroup === "boolean" && nameGroup ? i18n_default.t("yes") : i18n_default.t("no")} (${row[`${group_by_field_name?.split(":")?.[0]}_count`]})`;
|
|
7084
7092
|
const allIdsNull = selectedRowKeys?.every((item) => item === void 0);
|
|
7085
|
-
const
|
|
7093
|
+
const handleExpandChildGroup = () => {
|
|
7086
7094
|
if (isLoading || isFetching) return;
|
|
7087
7095
|
const toggleShowGroup = () => setIsShowGroup((prev) => !prev);
|
|
7088
7096
|
if (allIdsNull || typeTableGroup === "group") {
|
|
@@ -7095,7 +7103,7 @@ var tableGroupController = (props) => {
|
|
|
7095
7103
|
(id) => !ids.includes(id)
|
|
7096
7104
|
);
|
|
7097
7105
|
appDispatch((0, import_store10.setSelectedRowKeys)(filteredIds));
|
|
7098
|
-
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull &&
|
|
7106
|
+
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
7099
7107
|
const clonedKeys = [...selectedRowKeys];
|
|
7100
7108
|
appDispatch((0, import_store10.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
7101
7109
|
setTimeout(() => appDispatch((0, import_store10.setSelectedRowKeys)(clonedKeys)), 500);
|
|
@@ -7106,28 +7114,38 @@ var tableGroupController = (props) => {
|
|
|
7106
7114
|
toggleShowGroup();
|
|
7107
7115
|
};
|
|
7108
7116
|
(0, import_react23.useEffect)(() => {
|
|
7109
|
-
if (!
|
|
7117
|
+
if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
7110
7118
|
return;
|
|
7111
7119
|
}
|
|
7112
7120
|
const clonedKeys = [...selectedRowKeys];
|
|
7113
7121
|
(0, import_store10.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
7114
7122
|
setTimeout(() => (0, import_store10.setSelectedRowKeys)(clonedKeys), 500);
|
|
7115
|
-
}, [
|
|
7123
|
+
}, [isQueryFetched]);
|
|
7116
7124
|
return {
|
|
7117
|
-
|
|
7125
|
+
handleExpandChildGroup,
|
|
7118
7126
|
colEmptyGroup,
|
|
7127
|
+
leftPadding,
|
|
7119
7128
|
isShowGroup,
|
|
7120
|
-
|
|
7129
|
+
isQueryFetched,
|
|
7121
7130
|
nameGroupWithCount,
|
|
7131
|
+
columns,
|
|
7132
|
+
row,
|
|
7133
|
+
isPlaceholderData,
|
|
7122
7134
|
columnsGroup,
|
|
7135
|
+
indexRow,
|
|
7123
7136
|
rowsGroup,
|
|
7124
7137
|
model,
|
|
7138
|
+
viewData,
|
|
7139
|
+
renderField,
|
|
7125
7140
|
level,
|
|
7126
7141
|
specification,
|
|
7127
7142
|
context,
|
|
7128
7143
|
checkedAll,
|
|
7129
7144
|
isDisplayCheckbox,
|
|
7145
|
+
isAutoSelect,
|
|
7146
|
+
setIsAutoSelect,
|
|
7130
7147
|
selectedRowKeysRef,
|
|
7148
|
+
initVal,
|
|
7131
7149
|
dataResponse,
|
|
7132
7150
|
pageGroup,
|
|
7133
7151
|
setPageGroup
|
package/dist/index.mjs
CHANGED
|
@@ -7029,6 +7029,7 @@ var tableController = ({ data }) => {
|
|
|
7029
7029
|
// src/widget/advance/table/table-group/controller.ts
|
|
7030
7030
|
import { useEffect as useEffect14, useMemo as useMemo13, useState as useState15 } from "react";
|
|
7031
7031
|
import {
|
|
7032
|
+
useOdooDataTransform,
|
|
7032
7033
|
useGetListData as useGetListData2
|
|
7033
7034
|
} from "@fctc/interface-logic/hooks";
|
|
7034
7035
|
import {
|
|
@@ -7050,21 +7051,27 @@ var tableGroupController = (props) => {
|
|
|
7050
7051
|
const {
|
|
7051
7052
|
rows,
|
|
7052
7053
|
columns,
|
|
7054
|
+
indexRow,
|
|
7053
7055
|
row,
|
|
7054
7056
|
model,
|
|
7055
7057
|
viewData,
|
|
7058
|
+
renderField,
|
|
7056
7059
|
level,
|
|
7057
7060
|
specification,
|
|
7058
7061
|
domain,
|
|
7059
7062
|
context,
|
|
7060
7063
|
checkedAll,
|
|
7061
7064
|
isDisplayCheckbox,
|
|
7065
|
+
isAutoSelect,
|
|
7066
|
+
setIsAutoSelect,
|
|
7062
7067
|
selectedRowKeysRef
|
|
7063
7068
|
} = props;
|
|
7064
7069
|
const [pageGroup, setPageGroup] = useState15(0);
|
|
7065
7070
|
const { groupByDomain, selectedTags } = useAppSelector6(selectSearch5);
|
|
7066
7071
|
const { selectedRowKeys } = useAppSelector6(selectList4);
|
|
7067
7072
|
const appDispatch = useAppDispatch6();
|
|
7073
|
+
const { toDataJS } = useOdooDataTransform();
|
|
7074
|
+
const initVal = toDataJS(row, viewData, model);
|
|
7068
7075
|
const [isShowGroup, setIsShowGroup] = useState15(false);
|
|
7069
7076
|
const [colEmptyGroup, setColEmptyGroup] = useState15({
|
|
7070
7077
|
fromStart: 1,
|
|
@@ -7099,14 +7106,15 @@ var tableGroupController = (props) => {
|
|
|
7099
7106
|
groupby: [groupByDomain?.contexts[level]?.group_by]
|
|
7100
7107
|
};
|
|
7101
7108
|
const queryKey = [
|
|
7102
|
-
`data-${model}
|
|
7109
|
+
`data-${model}--${level}-row${indexRow}`,
|
|
7103
7110
|
specification,
|
|
7104
7111
|
domain,
|
|
7105
7112
|
pageGroup
|
|
7106
7113
|
];
|
|
7107
7114
|
const {
|
|
7108
7115
|
data: dataResponse,
|
|
7109
|
-
isFetched:
|
|
7116
|
+
isFetched: isQueryFetched,
|
|
7117
|
+
isPlaceholderData,
|
|
7110
7118
|
isLoading,
|
|
7111
7119
|
isFetching
|
|
7112
7120
|
} = useGetListData2(listDataProps, queryKey, enabled);
|
|
@@ -7123,6 +7131,7 @@ var tableGroupController = (props) => {
|
|
|
7123
7131
|
typeTable: dataResponse?.groups ? "group" : "list"
|
|
7124
7132
|
}
|
|
7125
7133
|
});
|
|
7134
|
+
const leftPadding = level > 1 ? level * 8 + "px" : "0px";
|
|
7126
7135
|
useEffect14(() => {
|
|
7127
7136
|
if (isShowGroup && selectedTags?.length > 0) {
|
|
7128
7137
|
setIsShowGroup(false);
|
|
@@ -7134,7 +7143,7 @@ var tableGroupController = (props) => {
|
|
|
7134
7143
|
)?.[1] : row[group_by_field_name];
|
|
7135
7144
|
const nameGroupWithCount = `${typeof nameGroup === "string" ? nameGroup : typeof nameGroup === "boolean" && nameGroup ? i18n_default.t("yes") : i18n_default.t("no")} (${row[`${group_by_field_name?.split(":")?.[0]}_count`]})`;
|
|
7136
7145
|
const allIdsNull = selectedRowKeys?.every((item) => item === void 0);
|
|
7137
|
-
const
|
|
7146
|
+
const handleExpandChildGroup = () => {
|
|
7138
7147
|
if (isLoading || isFetching) return;
|
|
7139
7148
|
const toggleShowGroup = () => setIsShowGroup((prev) => !prev);
|
|
7140
7149
|
if (allIdsNull || typeTableGroup === "group") {
|
|
@@ -7147,7 +7156,7 @@ var tableGroupController = (props) => {
|
|
|
7147
7156
|
(id) => !ids.includes(id)
|
|
7148
7157
|
);
|
|
7149
7158
|
appDispatch(setSelectedRowKeys2(filteredIds));
|
|
7150
|
-
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull &&
|
|
7159
|
+
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
7151
7160
|
const clonedKeys = [...selectedRowKeys];
|
|
7152
7161
|
appDispatch(setSelectedRowKeys2([...clonedKeys, -1]));
|
|
7153
7162
|
setTimeout(() => appDispatch(setSelectedRowKeys2(clonedKeys)), 500);
|
|
@@ -7158,28 +7167,38 @@ var tableGroupController = (props) => {
|
|
|
7158
7167
|
toggleShowGroup();
|
|
7159
7168
|
};
|
|
7160
7169
|
useEffect14(() => {
|
|
7161
|
-
if (!
|
|
7170
|
+
if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
7162
7171
|
return;
|
|
7163
7172
|
}
|
|
7164
7173
|
const clonedKeys = [...selectedRowKeys];
|
|
7165
7174
|
setSelectedRowKeys2([...clonedKeys, -1]);
|
|
7166
7175
|
setTimeout(() => setSelectedRowKeys2(clonedKeys), 500);
|
|
7167
|
-
}, [
|
|
7176
|
+
}, [isQueryFetched]);
|
|
7168
7177
|
return {
|
|
7169
|
-
|
|
7178
|
+
handleExpandChildGroup,
|
|
7170
7179
|
colEmptyGroup,
|
|
7180
|
+
leftPadding,
|
|
7171
7181
|
isShowGroup,
|
|
7172
|
-
|
|
7182
|
+
isQueryFetched,
|
|
7173
7183
|
nameGroupWithCount,
|
|
7184
|
+
columns,
|
|
7185
|
+
row,
|
|
7186
|
+
isPlaceholderData,
|
|
7174
7187
|
columnsGroup,
|
|
7188
|
+
indexRow,
|
|
7175
7189
|
rowsGroup,
|
|
7176
7190
|
model,
|
|
7191
|
+
viewData,
|
|
7192
|
+
renderField,
|
|
7177
7193
|
level,
|
|
7178
7194
|
specification,
|
|
7179
7195
|
context,
|
|
7180
7196
|
checkedAll,
|
|
7181
7197
|
isDisplayCheckbox,
|
|
7198
|
+
isAutoSelect,
|
|
7199
|
+
setIsAutoSelect,
|
|
7182
7200
|
selectedRowKeysRef,
|
|
7201
|
+
initVal,
|
|
7183
7202
|
dataResponse,
|
|
7184
7203
|
pageGroup,
|
|
7185
7204
|
setPageGroup
|
package/dist/widget.d.mts
CHANGED
|
@@ -238,23 +238,35 @@ declare const tableController: ({ data }: ITableProps) => {
|
|
|
238
238
|
};
|
|
239
239
|
|
|
240
240
|
declare const tableGroupController: (props: any) => {
|
|
241
|
-
|
|
241
|
+
handleExpandChildGroup: () => void;
|
|
242
242
|
colEmptyGroup: {
|
|
243
243
|
fromStart: number;
|
|
244
244
|
fromEnd: number;
|
|
245
245
|
};
|
|
246
|
+
leftPadding: string;
|
|
246
247
|
isShowGroup: boolean;
|
|
247
|
-
|
|
248
|
+
isQueryFetched: boolean;
|
|
248
249
|
nameGroupWithCount: string;
|
|
250
|
+
columns: any;
|
|
251
|
+
row: any;
|
|
252
|
+
isPlaceholderData: boolean;
|
|
249
253
|
columnsGroup: any;
|
|
254
|
+
indexRow: any;
|
|
250
255
|
rowsGroup: any[];
|
|
251
256
|
model: any;
|
|
257
|
+
viewData: any;
|
|
258
|
+
renderField: any;
|
|
252
259
|
level: any;
|
|
253
260
|
specification: any;
|
|
254
261
|
context: any;
|
|
255
262
|
checkedAll: any;
|
|
256
263
|
isDisplayCheckbox: any;
|
|
264
|
+
isAutoSelect: any;
|
|
265
|
+
setIsAutoSelect: any;
|
|
257
266
|
selectedRowKeysRef: any;
|
|
267
|
+
initVal: {
|
|
268
|
+
[x: string]: any;
|
|
269
|
+
};
|
|
258
270
|
dataResponse: any;
|
|
259
271
|
pageGroup: any;
|
|
260
272
|
setPageGroup: react.Dispatch<any>;
|
package/dist/widget.d.ts
CHANGED
|
@@ -238,23 +238,35 @@ declare const tableController: ({ data }: ITableProps) => {
|
|
|
238
238
|
};
|
|
239
239
|
|
|
240
240
|
declare const tableGroupController: (props: any) => {
|
|
241
|
-
|
|
241
|
+
handleExpandChildGroup: () => void;
|
|
242
242
|
colEmptyGroup: {
|
|
243
243
|
fromStart: number;
|
|
244
244
|
fromEnd: number;
|
|
245
245
|
};
|
|
246
|
+
leftPadding: string;
|
|
246
247
|
isShowGroup: boolean;
|
|
247
|
-
|
|
248
|
+
isQueryFetched: boolean;
|
|
248
249
|
nameGroupWithCount: string;
|
|
250
|
+
columns: any;
|
|
251
|
+
row: any;
|
|
252
|
+
isPlaceholderData: boolean;
|
|
249
253
|
columnsGroup: any;
|
|
254
|
+
indexRow: any;
|
|
250
255
|
rowsGroup: any[];
|
|
251
256
|
model: any;
|
|
257
|
+
viewData: any;
|
|
258
|
+
renderField: any;
|
|
252
259
|
level: any;
|
|
253
260
|
specification: any;
|
|
254
261
|
context: any;
|
|
255
262
|
checkedAll: any;
|
|
256
263
|
isDisplayCheckbox: any;
|
|
264
|
+
isAutoSelect: any;
|
|
265
|
+
setIsAutoSelect: any;
|
|
257
266
|
selectedRowKeysRef: any;
|
|
267
|
+
initVal: {
|
|
268
|
+
[x: string]: any;
|
|
269
|
+
};
|
|
258
270
|
dataResponse: any;
|
|
259
271
|
pageGroup: any;
|
|
260
272
|
setPageGroup: react.Dispatch<any>;
|
package/dist/widget.js
CHANGED
|
@@ -6723,21 +6723,27 @@ var tableGroupController = (props) => {
|
|
|
6723
6723
|
const {
|
|
6724
6724
|
rows,
|
|
6725
6725
|
columns,
|
|
6726
|
+
indexRow,
|
|
6726
6727
|
row,
|
|
6727
6728
|
model,
|
|
6728
6729
|
viewData,
|
|
6730
|
+
renderField,
|
|
6729
6731
|
level,
|
|
6730
6732
|
specification,
|
|
6731
6733
|
domain,
|
|
6732
6734
|
context,
|
|
6733
6735
|
checkedAll,
|
|
6734
6736
|
isDisplayCheckbox,
|
|
6737
|
+
isAutoSelect,
|
|
6738
|
+
setIsAutoSelect,
|
|
6735
6739
|
selectedRowKeysRef
|
|
6736
6740
|
} = props;
|
|
6737
6741
|
const [pageGroup, setPageGroup] = (0, import_react23.useState)(0);
|
|
6738
6742
|
const { groupByDomain, selectedTags } = (0, import_store10.useAppSelector)(import_store10.selectSearch);
|
|
6739
6743
|
const { selectedRowKeys } = (0, import_store10.useAppSelector)(import_store10.selectList);
|
|
6740
6744
|
const appDispatch = (0, import_store10.useAppDispatch)();
|
|
6745
|
+
const { toDataJS } = (0, import_hooks15.useOdooDataTransform)();
|
|
6746
|
+
const initVal = toDataJS(row, viewData, model);
|
|
6741
6747
|
const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
|
|
6742
6748
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
|
|
6743
6749
|
fromStart: 1,
|
|
@@ -6772,14 +6778,15 @@ var tableGroupController = (props) => {
|
|
|
6772
6778
|
groupby: [groupByDomain?.contexts[level]?.group_by]
|
|
6773
6779
|
};
|
|
6774
6780
|
const queryKey = [
|
|
6775
|
-
`data-${model}
|
|
6781
|
+
`data-${model}--${level}-row${indexRow}`,
|
|
6776
6782
|
specification,
|
|
6777
6783
|
domain,
|
|
6778
6784
|
pageGroup
|
|
6779
6785
|
];
|
|
6780
6786
|
const {
|
|
6781
6787
|
data: dataResponse,
|
|
6782
|
-
isFetched:
|
|
6788
|
+
isFetched: isQueryFetched,
|
|
6789
|
+
isPlaceholderData,
|
|
6783
6790
|
isLoading,
|
|
6784
6791
|
isFetching
|
|
6785
6792
|
} = (0, import_hooks15.useGetListData)(listDataProps, queryKey, enabled);
|
|
@@ -6796,6 +6803,7 @@ var tableGroupController = (props) => {
|
|
|
6796
6803
|
typeTable: dataResponse?.groups ? "group" : "list"
|
|
6797
6804
|
}
|
|
6798
6805
|
});
|
|
6806
|
+
const leftPadding = level > 1 ? level * 8 + "px" : "0px";
|
|
6799
6807
|
(0, import_react23.useEffect)(() => {
|
|
6800
6808
|
if (isShowGroup && selectedTags?.length > 0) {
|
|
6801
6809
|
setIsShowGroup(false);
|
|
@@ -6807,7 +6815,7 @@ var tableGroupController = (props) => {
|
|
|
6807
6815
|
)?.[1] : row[group_by_field_name];
|
|
6808
6816
|
const nameGroupWithCount = `${typeof nameGroup === "string" ? nameGroup : typeof nameGroup === "boolean" && nameGroup ? i18n_default.t("yes") : i18n_default.t("no")} (${row[`${group_by_field_name?.split(":")?.[0]}_count`]})`;
|
|
6809
6817
|
const allIdsNull = selectedRowKeys?.every((item) => item === void 0);
|
|
6810
|
-
const
|
|
6818
|
+
const handleExpandChildGroup = () => {
|
|
6811
6819
|
if (isLoading || isFetching) return;
|
|
6812
6820
|
const toggleShowGroup = () => setIsShowGroup((prev) => !prev);
|
|
6813
6821
|
if (allIdsNull || typeTableGroup === "group") {
|
|
@@ -6820,7 +6828,7 @@ var tableGroupController = (props) => {
|
|
|
6820
6828
|
(id) => !ids.includes(id)
|
|
6821
6829
|
);
|
|
6822
6830
|
appDispatch((0, import_store10.setSelectedRowKeys)(filteredIds));
|
|
6823
|
-
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull &&
|
|
6831
|
+
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
6824
6832
|
const clonedKeys = [...selectedRowKeys];
|
|
6825
6833
|
appDispatch((0, import_store10.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
6826
6834
|
setTimeout(() => appDispatch((0, import_store10.setSelectedRowKeys)(clonedKeys)), 500);
|
|
@@ -6831,28 +6839,38 @@ var tableGroupController = (props) => {
|
|
|
6831
6839
|
toggleShowGroup();
|
|
6832
6840
|
};
|
|
6833
6841
|
(0, import_react23.useEffect)(() => {
|
|
6834
|
-
if (!
|
|
6842
|
+
if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
6835
6843
|
return;
|
|
6836
6844
|
}
|
|
6837
6845
|
const clonedKeys = [...selectedRowKeys];
|
|
6838
6846
|
(0, import_store10.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
6839
6847
|
setTimeout(() => (0, import_store10.setSelectedRowKeys)(clonedKeys), 500);
|
|
6840
|
-
}, [
|
|
6848
|
+
}, [isQueryFetched]);
|
|
6841
6849
|
return {
|
|
6842
|
-
|
|
6850
|
+
handleExpandChildGroup,
|
|
6843
6851
|
colEmptyGroup,
|
|
6852
|
+
leftPadding,
|
|
6844
6853
|
isShowGroup,
|
|
6845
|
-
|
|
6854
|
+
isQueryFetched,
|
|
6846
6855
|
nameGroupWithCount,
|
|
6856
|
+
columns,
|
|
6857
|
+
row,
|
|
6858
|
+
isPlaceholderData,
|
|
6847
6859
|
columnsGroup,
|
|
6860
|
+
indexRow,
|
|
6848
6861
|
rowsGroup,
|
|
6849
6862
|
model,
|
|
6863
|
+
viewData,
|
|
6864
|
+
renderField,
|
|
6850
6865
|
level,
|
|
6851
6866
|
specification,
|
|
6852
6867
|
context,
|
|
6853
6868
|
checkedAll,
|
|
6854
6869
|
isDisplayCheckbox,
|
|
6870
|
+
isAutoSelect,
|
|
6871
|
+
setIsAutoSelect,
|
|
6855
6872
|
selectedRowKeysRef,
|
|
6873
|
+
initVal,
|
|
6856
6874
|
dataResponse,
|
|
6857
6875
|
pageGroup,
|
|
6858
6876
|
setPageGroup
|
package/dist/widget.mjs
CHANGED
|
@@ -6731,6 +6731,7 @@ var tableController = ({ data }) => {
|
|
|
6731
6731
|
// src/widget/advance/table/table-group/controller.ts
|
|
6732
6732
|
import { useEffect as useEffect14, useMemo as useMemo13, useState as useState15 } from "react";
|
|
6733
6733
|
import {
|
|
6734
|
+
useOdooDataTransform,
|
|
6734
6735
|
useGetListData as useGetListData2
|
|
6735
6736
|
} from "@fctc/interface-logic/hooks";
|
|
6736
6737
|
import {
|
|
@@ -6752,21 +6753,27 @@ var tableGroupController = (props) => {
|
|
|
6752
6753
|
const {
|
|
6753
6754
|
rows,
|
|
6754
6755
|
columns,
|
|
6756
|
+
indexRow,
|
|
6755
6757
|
row,
|
|
6756
6758
|
model,
|
|
6757
6759
|
viewData,
|
|
6760
|
+
renderField,
|
|
6758
6761
|
level,
|
|
6759
6762
|
specification,
|
|
6760
6763
|
domain,
|
|
6761
6764
|
context,
|
|
6762
6765
|
checkedAll,
|
|
6763
6766
|
isDisplayCheckbox,
|
|
6767
|
+
isAutoSelect,
|
|
6768
|
+
setIsAutoSelect,
|
|
6764
6769
|
selectedRowKeysRef
|
|
6765
6770
|
} = props;
|
|
6766
6771
|
const [pageGroup, setPageGroup] = useState15(0);
|
|
6767
6772
|
const { groupByDomain, selectedTags } = useAppSelector6(selectSearch5);
|
|
6768
6773
|
const { selectedRowKeys } = useAppSelector6(selectList4);
|
|
6769
6774
|
const appDispatch = useAppDispatch6();
|
|
6775
|
+
const { toDataJS } = useOdooDataTransform();
|
|
6776
|
+
const initVal = toDataJS(row, viewData, model);
|
|
6770
6777
|
const [isShowGroup, setIsShowGroup] = useState15(false);
|
|
6771
6778
|
const [colEmptyGroup, setColEmptyGroup] = useState15({
|
|
6772
6779
|
fromStart: 1,
|
|
@@ -6801,14 +6808,15 @@ var tableGroupController = (props) => {
|
|
|
6801
6808
|
groupby: [groupByDomain?.contexts[level]?.group_by]
|
|
6802
6809
|
};
|
|
6803
6810
|
const queryKey = [
|
|
6804
|
-
`data-${model}
|
|
6811
|
+
`data-${model}--${level}-row${indexRow}`,
|
|
6805
6812
|
specification,
|
|
6806
6813
|
domain,
|
|
6807
6814
|
pageGroup
|
|
6808
6815
|
];
|
|
6809
6816
|
const {
|
|
6810
6817
|
data: dataResponse,
|
|
6811
|
-
isFetched:
|
|
6818
|
+
isFetched: isQueryFetched,
|
|
6819
|
+
isPlaceholderData,
|
|
6812
6820
|
isLoading,
|
|
6813
6821
|
isFetching
|
|
6814
6822
|
} = useGetListData2(listDataProps, queryKey, enabled);
|
|
@@ -6825,6 +6833,7 @@ var tableGroupController = (props) => {
|
|
|
6825
6833
|
typeTable: dataResponse?.groups ? "group" : "list"
|
|
6826
6834
|
}
|
|
6827
6835
|
});
|
|
6836
|
+
const leftPadding = level > 1 ? level * 8 + "px" : "0px";
|
|
6828
6837
|
useEffect14(() => {
|
|
6829
6838
|
if (isShowGroup && selectedTags?.length > 0) {
|
|
6830
6839
|
setIsShowGroup(false);
|
|
@@ -6836,7 +6845,7 @@ var tableGroupController = (props) => {
|
|
|
6836
6845
|
)?.[1] : row[group_by_field_name];
|
|
6837
6846
|
const nameGroupWithCount = `${typeof nameGroup === "string" ? nameGroup : typeof nameGroup === "boolean" && nameGroup ? i18n_default.t("yes") : i18n_default.t("no")} (${row[`${group_by_field_name?.split(":")?.[0]}_count`]})`;
|
|
6838
6847
|
const allIdsNull = selectedRowKeys?.every((item) => item === void 0);
|
|
6839
|
-
const
|
|
6848
|
+
const handleExpandChildGroup = () => {
|
|
6840
6849
|
if (isLoading || isFetching) return;
|
|
6841
6850
|
const toggleShowGroup = () => setIsShowGroup((prev) => !prev);
|
|
6842
6851
|
if (allIdsNull || typeTableGroup === "group") {
|
|
@@ -6849,7 +6858,7 @@ var tableGroupController = (props) => {
|
|
|
6849
6858
|
(id) => !ids.includes(id)
|
|
6850
6859
|
);
|
|
6851
6860
|
appDispatch(setSelectedRowKeys2(filteredIds));
|
|
6852
|
-
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull &&
|
|
6861
|
+
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
6853
6862
|
const clonedKeys = [...selectedRowKeys];
|
|
6854
6863
|
appDispatch(setSelectedRowKeys2([...clonedKeys, -1]));
|
|
6855
6864
|
setTimeout(() => appDispatch(setSelectedRowKeys2(clonedKeys)), 500);
|
|
@@ -6860,28 +6869,38 @@ var tableGroupController = (props) => {
|
|
|
6860
6869
|
toggleShowGroup();
|
|
6861
6870
|
};
|
|
6862
6871
|
useEffect14(() => {
|
|
6863
|
-
if (!
|
|
6872
|
+
if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
6864
6873
|
return;
|
|
6865
6874
|
}
|
|
6866
6875
|
const clonedKeys = [...selectedRowKeys];
|
|
6867
6876
|
setSelectedRowKeys2([...clonedKeys, -1]);
|
|
6868
6877
|
setTimeout(() => setSelectedRowKeys2(clonedKeys), 500);
|
|
6869
|
-
}, [
|
|
6878
|
+
}, [isQueryFetched]);
|
|
6870
6879
|
return {
|
|
6871
|
-
|
|
6880
|
+
handleExpandChildGroup,
|
|
6872
6881
|
colEmptyGroup,
|
|
6882
|
+
leftPadding,
|
|
6873
6883
|
isShowGroup,
|
|
6874
|
-
|
|
6884
|
+
isQueryFetched,
|
|
6875
6885
|
nameGroupWithCount,
|
|
6886
|
+
columns,
|
|
6887
|
+
row,
|
|
6888
|
+
isPlaceholderData,
|
|
6876
6889
|
columnsGroup,
|
|
6890
|
+
indexRow,
|
|
6877
6891
|
rowsGroup,
|
|
6878
6892
|
model,
|
|
6893
|
+
viewData,
|
|
6894
|
+
renderField,
|
|
6879
6895
|
level,
|
|
6880
6896
|
specification,
|
|
6881
6897
|
context,
|
|
6882
6898
|
checkedAll,
|
|
6883
6899
|
isDisplayCheckbox,
|
|
6900
|
+
isAutoSelect,
|
|
6901
|
+
setIsAutoSelect,
|
|
6884
6902
|
selectedRowKeysRef,
|
|
6903
|
+
initVal,
|
|
6885
6904
|
dataResponse,
|
|
6886
6905
|
pageGroup,
|
|
6887
6906
|
setPageGroup
|
package/package.json
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@fctc/widget-logic",
|
|
3
|
-
"version": "2.3.
|
|
4
|
-
"types": "dist/index.d.ts",
|
|
5
|
-
"main": "dist/index.cjs",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.mjs",
|
|
11
|
-
"require": "./dist/index.cjs"
|
|
12
|
-
},
|
|
13
|
-
"./hooks": {
|
|
14
|
-
"types": "./dist/hooks.d.ts",
|
|
15
|
-
"import": "./dist/hooks.mjs",
|
|
16
|
-
"require": "./dist/hooks.cjs"
|
|
17
|
-
},
|
|
18
|
-
"./widget": {
|
|
19
|
-
"types": "./dist/widget.d.ts",
|
|
20
|
-
"import": "./dist/widget.mjs",
|
|
21
|
-
"require": "./dist/widget.cjs"
|
|
22
|
-
},
|
|
23
|
-
"./icons": {
|
|
24
|
-
"types": "./dist/icons.d.ts",
|
|
25
|
-
"import": "./dist/icons.mjs",
|
|
26
|
-
"require": "./dist/icons.cjs"
|
|
27
|
-
},
|
|
28
|
-
"./utils": {
|
|
29
|
-
"types": "./dist/utils.d.ts",
|
|
30
|
-
"import": "./dist/utils.mjs",
|
|
31
|
-
"require": "./dist/utils.cjs"
|
|
32
|
-
},
|
|
33
|
-
"./store": {
|
|
34
|
-
"types": "./dist/store.d.ts",
|
|
35
|
-
"import": "./dist/store.mjs",
|
|
36
|
-
"require": "./dist/store.cjs"
|
|
37
|
-
},
|
|
38
|
-
"./config": {
|
|
39
|
-
"types": "./dist/config.d.ts",
|
|
40
|
-
"import": "./dist/config.mjs",
|
|
41
|
-
"require": "./dist/config.cjs"
|
|
42
|
-
},
|
|
43
|
-
"./constants": {
|
|
44
|
-
"types": "./dist/constants.d.ts",
|
|
45
|
-
"import": "./dist/constants.mjs",
|
|
46
|
-
"require": "./dist/constants.cjs"
|
|
47
|
-
},
|
|
48
|
-
"./environment": {
|
|
49
|
-
"types": "./dist/environment.d.ts",
|
|
50
|
-
"import": "./dist/environment.mjs",
|
|
51
|
-
"require": "./dist/environment.cjs"
|
|
52
|
-
},
|
|
53
|
-
"./provider": {
|
|
54
|
-
"types": "./dist/provider.d.ts",
|
|
55
|
-
"import": "./dist/provider.mjs",
|
|
56
|
-
"require": "./dist/provider.cjs"
|
|
57
|
-
},
|
|
58
|
-
"./services": {
|
|
59
|
-
"types": "./dist/services.d.ts",
|
|
60
|
-
"import": "./dist/services.mjs",
|
|
61
|
-
"require": "./dist/services.cjs"
|
|
62
|
-
},
|
|
63
|
-
"./types": {
|
|
64
|
-
"types": "./dist/types.d.ts",
|
|
65
|
-
"import": "./dist/types.mjs",
|
|
66
|
-
"require": "./dist/types.cjs"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"files": [
|
|
70
|
-
"dist"
|
|
71
|
-
],
|
|
72
|
-
"scripts": {
|
|
73
|
-
"build": "tsup",
|
|
74
|
-
"test": "jest"
|
|
75
|
-
},
|
|
76
|
-
"dependencies": {
|
|
77
|
-
"@fctc/interface-logic": "^2.
|
|
78
|
-
"@headlessui/react": "^2.2.6",
|
|
79
|
-
"@tanstack/react-query": "^5.84.0",
|
|
80
|
-
"i18next": "^25.3.2",
|
|
81
|
-
"i18next-browser-languagedetector": "^8.2.0",
|
|
82
|
-
"react-i18next": "^15.6.1",
|
|
83
|
-
"react-tooltip": "^5.29.1"
|
|
84
|
-
},
|
|
85
|
-
"devDependencies": {
|
|
86
|
-
"@types/react": "^18.3.1",
|
|
87
|
-
"jest": "^29.7.0",
|
|
88
|
-
"react": "18.0.0",
|
|
89
|
-
"tsup": "^8.0.0",
|
|
90
|
-
"typescript": "^5.8.2"
|
|
91
|
-
},
|
|
92
|
-
"packageManager": "yarn@1.22.0",
|
|
93
|
-
"peerDependencies": {
|
|
94
|
-
"@fctc/interface-logic": "^1.6.9"
|
|
95
|
-
}
|
|
96
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@fctc/widget-logic",
|
|
3
|
+
"version": "2.3.2",
|
|
4
|
+
"types": "dist/index.d.ts",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
},
|
|
13
|
+
"./hooks": {
|
|
14
|
+
"types": "./dist/hooks.d.ts",
|
|
15
|
+
"import": "./dist/hooks.mjs",
|
|
16
|
+
"require": "./dist/hooks.cjs"
|
|
17
|
+
},
|
|
18
|
+
"./widget": {
|
|
19
|
+
"types": "./dist/widget.d.ts",
|
|
20
|
+
"import": "./dist/widget.mjs",
|
|
21
|
+
"require": "./dist/widget.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./icons": {
|
|
24
|
+
"types": "./dist/icons.d.ts",
|
|
25
|
+
"import": "./dist/icons.mjs",
|
|
26
|
+
"require": "./dist/icons.cjs"
|
|
27
|
+
},
|
|
28
|
+
"./utils": {
|
|
29
|
+
"types": "./dist/utils.d.ts",
|
|
30
|
+
"import": "./dist/utils.mjs",
|
|
31
|
+
"require": "./dist/utils.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./store": {
|
|
34
|
+
"types": "./dist/store.d.ts",
|
|
35
|
+
"import": "./dist/store.mjs",
|
|
36
|
+
"require": "./dist/store.cjs"
|
|
37
|
+
},
|
|
38
|
+
"./config": {
|
|
39
|
+
"types": "./dist/config.d.ts",
|
|
40
|
+
"import": "./dist/config.mjs",
|
|
41
|
+
"require": "./dist/config.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./constants": {
|
|
44
|
+
"types": "./dist/constants.d.ts",
|
|
45
|
+
"import": "./dist/constants.mjs",
|
|
46
|
+
"require": "./dist/constants.cjs"
|
|
47
|
+
},
|
|
48
|
+
"./environment": {
|
|
49
|
+
"types": "./dist/environment.d.ts",
|
|
50
|
+
"import": "./dist/environment.mjs",
|
|
51
|
+
"require": "./dist/environment.cjs"
|
|
52
|
+
},
|
|
53
|
+
"./provider": {
|
|
54
|
+
"types": "./dist/provider.d.ts",
|
|
55
|
+
"import": "./dist/provider.mjs",
|
|
56
|
+
"require": "./dist/provider.cjs"
|
|
57
|
+
},
|
|
58
|
+
"./services": {
|
|
59
|
+
"types": "./dist/services.d.ts",
|
|
60
|
+
"import": "./dist/services.mjs",
|
|
61
|
+
"require": "./dist/services.cjs"
|
|
62
|
+
},
|
|
63
|
+
"./types": {
|
|
64
|
+
"types": "./dist/types.d.ts",
|
|
65
|
+
"import": "./dist/types.mjs",
|
|
66
|
+
"require": "./dist/types.cjs"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"files": [
|
|
70
|
+
"dist"
|
|
71
|
+
],
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsup",
|
|
74
|
+
"test": "jest"
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@fctc/interface-logic": "^2.3.0",
|
|
78
|
+
"@headlessui/react": "^2.2.6",
|
|
79
|
+
"@tanstack/react-query": "^5.84.0",
|
|
80
|
+
"i18next": "^25.3.2",
|
|
81
|
+
"i18next-browser-languagedetector": "^8.2.0",
|
|
82
|
+
"react-i18next": "^15.6.1",
|
|
83
|
+
"react-tooltip": "^5.29.1"
|
|
84
|
+
},
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@types/react": "^18.3.1",
|
|
87
|
+
"jest": "^29.7.0",
|
|
88
|
+
"react": "18.0.0",
|
|
89
|
+
"tsup": "^8.0.0",
|
|
90
|
+
"typescript": "^5.8.2"
|
|
91
|
+
},
|
|
92
|
+
"packageManager": "yarn@1.22.0",
|
|
93
|
+
"peerDependencies": {
|
|
94
|
+
"@fctc/interface-logic": "^1.6.9"
|
|
95
|
+
}
|
|
96
|
+
}
|