design-zystem 1.0.444 → 1.0.445
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/ui/index.js +18 -8
- package/dist/ui/index.mjs +18 -8
- package/package.json +1 -1
package/dist/ui/index.js
CHANGED
|
@@ -3943,7 +3943,7 @@ var TableSelectAllResultsBar = ({
|
|
|
3943
3943
|
}) => {
|
|
3944
3944
|
if (selection.isAllResultsSelected)
|
|
3945
3945
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "border-b border-grey-200 bg-blue-50 px-3 py-2 text-center text-xs font-semibold text-blue-900", children: [
|
|
3946
|
-
`Les ${selection.totalCount} r\xE9sultats sont s\xE9lectionn\xE9s.`,
|
|
3946
|
+
selection.selectedCount === selection.totalCount ? `Les ${selection.totalCount} r\xE9sultats sont s\xE9lectionn\xE9s.` : `${selection.selectedCount} r\xE9sultats sur ${selection.totalCount} sont s\xE9lectionn\xE9s.`,
|
|
3947
3947
|
" ",
|
|
3948
3948
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3949
3949
|
"button",
|
|
@@ -5183,29 +5183,38 @@ var useRowSelection = ({
|
|
|
5183
5183
|
}) => {
|
|
5184
5184
|
const [selectedIds, setSelectedIds] = (0, import_react32.useState)(/* @__PURE__ */ new Set());
|
|
5185
5185
|
const [isAllResultsSelected, setIsAllResultsSelected] = (0, import_react32.useState)(false);
|
|
5186
|
+
const [excludedIds, setExcludedIds] = (0, import_react32.useState)(/* @__PURE__ */ new Set());
|
|
5186
5187
|
const anchorId = (0, import_react32.useRef)(null);
|
|
5188
|
+
const isRowSelected = (id) => isAllResultsSelected ? !excludedIds.has(id) : selectedIds.has(id);
|
|
5187
5189
|
const resolvedTotal = totalCount != null ? totalCount : rowIds.length;
|
|
5188
|
-
const selectedOnPage = rowIds.filter(
|
|
5190
|
+
const selectedOnPage = rowIds.filter(isRowSelected).length;
|
|
5189
5191
|
const isPageFullySelected = rowIds.length > 0 && selectedOnPage === rowIds.length;
|
|
5190
5192
|
const canSelectAllResults = isPageFullySelected && !isAllResultsSelected && resolvedTotal > rowIds.length;
|
|
5191
|
-
const headerState =
|
|
5193
|
+
const headerState = isPageFullySelected ? true : selectedOnPage > 0 ? "indeterminate" : false;
|
|
5192
5194
|
const clear = (0, import_react32.useCallback)(() => {
|
|
5193
5195
|
setSelectedIds(/* @__PURE__ */ new Set());
|
|
5194
5196
|
setIsAllResultsSelected(false);
|
|
5197
|
+
setExcludedIds(/* @__PURE__ */ new Set());
|
|
5195
5198
|
anchorId.current = null;
|
|
5196
5199
|
}, []);
|
|
5197
|
-
const isRowSelected = (id) => isAllResultsSelected || selectedIds.has(id);
|
|
5198
5200
|
const getGroupState = (groupIds) => {
|
|
5199
5201
|
const selectedInGroup = groupIds.filter(isRowSelected).length;
|
|
5200
5202
|
if (selectedInGroup === 0) return false;
|
|
5201
5203
|
return selectedInGroup === groupIds.length ? true : "indeterminate";
|
|
5202
5204
|
};
|
|
5203
5205
|
const applyToRows = (idsToApply, willSelect) => {
|
|
5204
|
-
|
|
5206
|
+
if (isAllResultsSelected) {
|
|
5207
|
+
const nextExcluded = new Set(excludedIds);
|
|
5208
|
+
idsToApply.forEach(
|
|
5209
|
+
(rowId) => willSelect ? nextExcluded.delete(rowId) : nextExcluded.add(rowId)
|
|
5210
|
+
);
|
|
5211
|
+
setExcludedIds(nextExcluded);
|
|
5212
|
+
return;
|
|
5213
|
+
}
|
|
5214
|
+
const next = new Set(selectedIds);
|
|
5205
5215
|
idsToApply.forEach(
|
|
5206
5216
|
(rowId) => willSelect ? next.add(rowId) : next.delete(rowId)
|
|
5207
5217
|
);
|
|
5208
|
-
setIsAllResultsSelected(false);
|
|
5209
5218
|
setSelectedIds(next);
|
|
5210
5219
|
};
|
|
5211
5220
|
const toggleGroup = (groupIds) => applyToRows(groupIds, getGroupState(groupIds) !== true);
|
|
@@ -5221,7 +5230,7 @@ var useRowSelection = ({
|
|
|
5221
5230
|
applyToRows(idsToApply, willSelect);
|
|
5222
5231
|
};
|
|
5223
5232
|
const toggleAllOnPage = () => {
|
|
5224
|
-
if (isAllResultsSelected) {
|
|
5233
|
+
if (isAllResultsSelected && headerState === true) {
|
|
5225
5234
|
clear();
|
|
5226
5235
|
return;
|
|
5227
5236
|
}
|
|
@@ -5229,11 +5238,12 @@ var useRowSelection = ({
|
|
|
5229
5238
|
};
|
|
5230
5239
|
const selectAllResults = () => {
|
|
5231
5240
|
setSelectedIds(new Set(rowIds));
|
|
5241
|
+
setExcludedIds(/* @__PURE__ */ new Set());
|
|
5232
5242
|
setIsAllResultsSelected(true);
|
|
5233
5243
|
};
|
|
5234
5244
|
return {
|
|
5235
5245
|
selectedIds,
|
|
5236
|
-
selectedCount: isAllResultsSelected ? resolvedTotal : selectedIds.size,
|
|
5246
|
+
selectedCount: isAllResultsSelected ? resolvedTotal - excludedIds.size : selectedIds.size,
|
|
5237
5247
|
isRowSelected,
|
|
5238
5248
|
headerState,
|
|
5239
5249
|
isAllResultsSelected,
|
package/dist/ui/index.mjs
CHANGED
|
@@ -3737,7 +3737,7 @@ var TableSelectAllResultsBar = ({
|
|
|
3737
3737
|
}) => {
|
|
3738
3738
|
if (selection.isAllResultsSelected)
|
|
3739
3739
|
return /* @__PURE__ */ jsxs22("div", { className: "border-b border-grey-200 bg-blue-50 px-3 py-2 text-center text-xs font-semibold text-blue-900", children: [
|
|
3740
|
-
`Les ${selection.totalCount} r\xE9sultats sont s\xE9lectionn\xE9s.`,
|
|
3740
|
+
selection.selectedCount === selection.totalCount ? `Les ${selection.totalCount} r\xE9sultats sont s\xE9lectionn\xE9s.` : `${selection.selectedCount} r\xE9sultats sur ${selection.totalCount} sont s\xE9lectionn\xE9s.`,
|
|
3741
3741
|
" ",
|
|
3742
3742
|
/* @__PURE__ */ jsx41(
|
|
3743
3743
|
"button",
|
|
@@ -4984,29 +4984,38 @@ var useRowSelection = ({
|
|
|
4984
4984
|
}) => {
|
|
4985
4985
|
const [selectedIds, setSelectedIds] = useState8(/* @__PURE__ */ new Set());
|
|
4986
4986
|
const [isAllResultsSelected, setIsAllResultsSelected] = useState8(false);
|
|
4987
|
+
const [excludedIds, setExcludedIds] = useState8(/* @__PURE__ */ new Set());
|
|
4987
4988
|
const anchorId = useRef8(null);
|
|
4989
|
+
const isRowSelected = (id) => isAllResultsSelected ? !excludedIds.has(id) : selectedIds.has(id);
|
|
4988
4990
|
const resolvedTotal = totalCount != null ? totalCount : rowIds.length;
|
|
4989
|
-
const selectedOnPage = rowIds.filter(
|
|
4991
|
+
const selectedOnPage = rowIds.filter(isRowSelected).length;
|
|
4990
4992
|
const isPageFullySelected = rowIds.length > 0 && selectedOnPage === rowIds.length;
|
|
4991
4993
|
const canSelectAllResults = isPageFullySelected && !isAllResultsSelected && resolvedTotal > rowIds.length;
|
|
4992
|
-
const headerState =
|
|
4994
|
+
const headerState = isPageFullySelected ? true : selectedOnPage > 0 ? "indeterminate" : false;
|
|
4993
4995
|
const clear = useCallback2(() => {
|
|
4994
4996
|
setSelectedIds(/* @__PURE__ */ new Set());
|
|
4995
4997
|
setIsAllResultsSelected(false);
|
|
4998
|
+
setExcludedIds(/* @__PURE__ */ new Set());
|
|
4996
4999
|
anchorId.current = null;
|
|
4997
5000
|
}, []);
|
|
4998
|
-
const isRowSelected = (id) => isAllResultsSelected || selectedIds.has(id);
|
|
4999
5001
|
const getGroupState = (groupIds) => {
|
|
5000
5002
|
const selectedInGroup = groupIds.filter(isRowSelected).length;
|
|
5001
5003
|
if (selectedInGroup === 0) return false;
|
|
5002
5004
|
return selectedInGroup === groupIds.length ? true : "indeterminate";
|
|
5003
5005
|
};
|
|
5004
5006
|
const applyToRows = (idsToApply, willSelect) => {
|
|
5005
|
-
|
|
5007
|
+
if (isAllResultsSelected) {
|
|
5008
|
+
const nextExcluded = new Set(excludedIds);
|
|
5009
|
+
idsToApply.forEach(
|
|
5010
|
+
(rowId) => willSelect ? nextExcluded.delete(rowId) : nextExcluded.add(rowId)
|
|
5011
|
+
);
|
|
5012
|
+
setExcludedIds(nextExcluded);
|
|
5013
|
+
return;
|
|
5014
|
+
}
|
|
5015
|
+
const next = new Set(selectedIds);
|
|
5006
5016
|
idsToApply.forEach(
|
|
5007
5017
|
(rowId) => willSelect ? next.add(rowId) : next.delete(rowId)
|
|
5008
5018
|
);
|
|
5009
|
-
setIsAllResultsSelected(false);
|
|
5010
5019
|
setSelectedIds(next);
|
|
5011
5020
|
};
|
|
5012
5021
|
const toggleGroup = (groupIds) => applyToRows(groupIds, getGroupState(groupIds) !== true);
|
|
@@ -5022,7 +5031,7 @@ var useRowSelection = ({
|
|
|
5022
5031
|
applyToRows(idsToApply, willSelect);
|
|
5023
5032
|
};
|
|
5024
5033
|
const toggleAllOnPage = () => {
|
|
5025
|
-
if (isAllResultsSelected) {
|
|
5034
|
+
if (isAllResultsSelected && headerState === true) {
|
|
5026
5035
|
clear();
|
|
5027
5036
|
return;
|
|
5028
5037
|
}
|
|
@@ -5030,11 +5039,12 @@ var useRowSelection = ({
|
|
|
5030
5039
|
};
|
|
5031
5040
|
const selectAllResults = () => {
|
|
5032
5041
|
setSelectedIds(new Set(rowIds));
|
|
5042
|
+
setExcludedIds(/* @__PURE__ */ new Set());
|
|
5033
5043
|
setIsAllResultsSelected(true);
|
|
5034
5044
|
};
|
|
5035
5045
|
return {
|
|
5036
5046
|
selectedIds,
|
|
5037
|
-
selectedCount: isAllResultsSelected ? resolvedTotal : selectedIds.size,
|
|
5047
|
+
selectedCount: isAllResultsSelected ? resolvedTotal - excludedIds.size : selectedIds.size,
|
|
5038
5048
|
isRowSelected,
|
|
5039
5049
|
headerState,
|
|
5040
5050
|
isAllResultsSelected,
|