nntc-ui 0.0.94 → 0.0.95
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/{chunk-SQXO2GJK.js → chunk-MHQGQL5J.js} +35 -30
- package/icons/index.d.ts +3 -1
- package/icons/index.js +3 -1
- package/index.d.ts +2 -0
- package/index.js +91 -31
- package/package.json +1 -1
|
@@ -162,37 +162,41 @@ var MoreVerticalIcon = (props) => /* @__PURE__ */ jsx26(Icon, { ...props, childr
|
|
|
162
162
|
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
163
163
|
var SearchIcon = (props) => /* @__PURE__ */ jsx27(Icon, { ...props, children: /* @__PURE__ */ jsx27("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" }) });
|
|
164
164
|
|
|
165
|
-
// src/icons/
|
|
165
|
+
// src/icons/SelectUniqueIcon.tsx
|
|
166
166
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
167
|
-
var
|
|
167
|
+
var SelectUniqueIcon = (props) => /* @__PURE__ */ jsx28(Icon, { ...props, children: /* @__PURE__ */ jsx28("path", { d: "M3 5h18v2H3V5zm0 6h18v2H3v-2zm0 6h10v2H3v-2z" }) });
|
|
168
168
|
|
|
169
|
-
// src/icons/
|
|
169
|
+
// src/icons/SettingsIcon.tsx
|
|
170
170
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
171
|
-
var
|
|
171
|
+
var SettingsIcon = (props) => /* @__PURE__ */ jsx29(Icon, { ...props, children: /* @__PURE__ */ jsx29("path", { d: "M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z" }) });
|
|
172
172
|
|
|
173
|
-
// src/icons/
|
|
173
|
+
// src/icons/SortDownIcon.tsx
|
|
174
174
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
175
|
-
var
|
|
175
|
+
var SortDownIcon = (props) => /* @__PURE__ */ jsx30(Icon, { ...props, children: /* @__PURE__ */ jsx30("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M3 18V16H21V18H3ZM3 6H9V8H3V6ZM15 11H3V13H15V11Z" }) });
|
|
176
176
|
|
|
177
|
-
// src/icons/
|
|
177
|
+
// src/icons/SortUpIcon.tsx
|
|
178
178
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
179
|
-
var
|
|
179
|
+
var SortUpIcon = (props) => /* @__PURE__ */ jsx31(Icon, { ...props, children: /* @__PURE__ */ jsx31("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M3 6V8H21V6H3ZM3 18H9V16H3V18ZM15 13H3V11H15V13Z" }) });
|
|
180
180
|
|
|
181
|
-
// src/icons/
|
|
181
|
+
// src/icons/TableChartIcon.tsx
|
|
182
182
|
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
183
|
-
var
|
|
183
|
+
var TableChartIcon = (props) => /* @__PURE__ */ jsx32(Icon, { ...props, children: /* @__PURE__ */ jsx32("path", { d: "M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z" }) });
|
|
184
184
|
|
|
185
|
-
// src/icons/
|
|
185
|
+
// src/icons/UploadIcon.tsx
|
|
186
186
|
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
187
|
-
var
|
|
187
|
+
var UploadIcon = (props) => /* @__PURE__ */ jsx33(Icon, { ...props, children: /* @__PURE__ */ jsx33("path", { d: "M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z" }) });
|
|
188
188
|
|
|
189
|
-
// src/icons/
|
|
189
|
+
// src/icons/WellIcon.tsx
|
|
190
190
|
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
191
|
-
var
|
|
191
|
+
var WellIcon = (props) => /* @__PURE__ */ jsx34(Icon, { ...props, children: /* @__PURE__ */ jsx34("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z" }) });
|
|
192
192
|
|
|
193
|
-
// src/icons/
|
|
193
|
+
// src/icons/EditIcon.tsx
|
|
194
194
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
195
|
-
var
|
|
195
|
+
var EditIcon = (props) => /* @__PURE__ */ jsx35(Icon, { ...props, children: /* @__PURE__ */ jsx35("path", { d: "M18.3688 3.29L20.7088 5.63C21.0988 6.02 21.0988 6.65 20.7088 7.04L18.8788 8.87L15.1288 5.12L16.9588 3.29C17.1488 3.1 17.3988 3 17.6588 3C17.9188 3 18.1688 3.09 18.3688 3.29ZM2.99878 17.25V21H6.74878L17.8088 9.94L14.0588 6.19L2.99878 17.25ZM5.91878 19H4.99878V18.08L14.0588 9.02L14.9788 9.94L5.91878 19Z" }) });
|
|
196
|
+
|
|
197
|
+
// src/icons/FullScreenOnIcon.tsx
|
|
198
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
199
|
+
var FullScreenOnIcon = (props) => /* @__PURE__ */ jsx36(Icon, { ...props, children: /* @__PURE__ */ jsx36(
|
|
196
200
|
"path",
|
|
197
201
|
{
|
|
198
202
|
d: `M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2
|
|
@@ -201,16 +205,16 @@ var FullScreenOnIcon = (props) => /* @__PURE__ */ jsx35(Icon, { ...props, childr
|
|
|
201
205
|
) });
|
|
202
206
|
|
|
203
207
|
// src/icons/FullScreenOffIcon.tsx
|
|
204
|
-
import { jsx as
|
|
205
|
-
var FullScreenOffIcon = (props) => /* @__PURE__ */
|
|
208
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
209
|
+
var FullScreenOffIcon = (props) => /* @__PURE__ */ jsx37(Icon, { ...props, children: /* @__PURE__ */ jsx37("path", { d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" }) });
|
|
206
210
|
|
|
207
211
|
// src/icons/BookmarkIcon.tsx
|
|
208
|
-
import { jsx as
|
|
209
|
-
var BookmarkIcon = (props) => /* @__PURE__ */
|
|
212
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
213
|
+
var BookmarkIcon = (props) => /* @__PURE__ */ jsx38(Icon, { ...props, children: /* @__PURE__ */ jsx38("path", { d: "M17 3H7c-1.1 0-2 .9-2 2v16l7-3 7 3V5c0-1.1-.9-2-2-2zm0 15-5-2.18L7 18V5h10v13z" }) });
|
|
210
214
|
|
|
211
215
|
// src/icons/BookmarkAddIcon.tsx
|
|
212
|
-
import { jsx as
|
|
213
|
-
var BookmarkAddIcon = (props) => /* @__PURE__ */
|
|
216
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
217
|
+
var BookmarkAddIcon = (props) => /* @__PURE__ */ jsx39(Icon, { ...props, children: /* @__PURE__ */ jsx39(
|
|
214
218
|
"path",
|
|
215
219
|
{
|
|
216
220
|
d: `M17 11v6.97l-5-2.14-5 2.14V5h6V3H7c-1.1 0-2
|
|
@@ -219,8 +223,8 @@ var BookmarkAddIcon = (props) => /* @__PURE__ */ jsx38(Icon, { ...props, childre
|
|
|
219
223
|
) });
|
|
220
224
|
|
|
221
225
|
// src/icons/ExportTableIcon.tsx
|
|
222
|
-
import { jsx as
|
|
223
|
-
var ExportTableIcon = (props) => /* @__PURE__ */
|
|
226
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
227
|
+
var ExportTableIcon = (props) => /* @__PURE__ */ jsx40(Icon, { ...props, children: /* @__PURE__ */ jsx40(
|
|
224
228
|
"path",
|
|
225
229
|
{
|
|
226
230
|
fill: "currentColor",
|
|
@@ -236,12 +240,12 @@ var ExportTableIcon = (props) => /* @__PURE__ */ jsx39(Icon, { ...props, childre
|
|
|
236
240
|
) });
|
|
237
241
|
|
|
238
242
|
// src/icons/DownloadIcon.tsx
|
|
239
|
-
import { jsx as
|
|
240
|
-
var DownloadIcon = (props) => /* @__PURE__ */
|
|
243
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
244
|
+
var DownloadIcon = (props) => /* @__PURE__ */ jsx41(Icon, { ...props, children: /* @__PURE__ */ jsx41("path", { d: "M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z" }) });
|
|
241
245
|
|
|
242
246
|
// src/icons/VisibilityIcon.tsx
|
|
243
|
-
import { jsx as
|
|
244
|
-
var VisibilityIcon = (props) => /* @__PURE__ */
|
|
247
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
248
|
+
var VisibilityIcon = (props) => /* @__PURE__ */ jsx42(Icon, { ...props, children: /* @__PURE__ */ jsx42(
|
|
245
249
|
"path",
|
|
246
250
|
{
|
|
247
251
|
d: `M12 6.375C15.75 6.375 18.9525 8.7075 20.25 12C18.9525 15.2925 15.75 17.625 12 17.625C8.25
|
|
@@ -256,8 +260,8 @@ var VisibilityIcon = (props) => /* @__PURE__ */ jsx41(Icon, { ...props, children
|
|
|
256
260
|
) });
|
|
257
261
|
|
|
258
262
|
// src/icons/PointIcon.tsx
|
|
259
|
-
import { jsx as
|
|
260
|
-
var PointIcon = (props) => /* @__PURE__ */
|
|
263
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
264
|
+
var PointIcon = (props) => /* @__PURE__ */ jsx43(Icon, { ...props, children: /* @__PURE__ */ jsx43(
|
|
261
265
|
"path",
|
|
262
266
|
{
|
|
263
267
|
d: "M12 8C9.79086 8 8 9.79086 8 12C8 14.2091 9.79086 16 12 16C14.2091 16 16 14.2091 16 12C16 9.79086 14.2091 8 12 8V8Z"
|
|
@@ -292,6 +296,7 @@ export {
|
|
|
292
296
|
ListIcon,
|
|
293
297
|
MoreVerticalIcon,
|
|
294
298
|
SearchIcon,
|
|
299
|
+
SelectUniqueIcon,
|
|
295
300
|
SettingsIcon,
|
|
296
301
|
SortDownIcon,
|
|
297
302
|
SortUpIcon,
|
package/icons/index.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ declare const MoreVerticalIcon: React__default.FC<IconProps>;
|
|
|
58
58
|
|
|
59
59
|
declare const SearchIcon: React__default.FC<IconProps>;
|
|
60
60
|
|
|
61
|
+
declare const SelectUniqueIcon: React__default.FC<IconProps>;
|
|
62
|
+
|
|
61
63
|
declare const SettingsIcon: React__default.FC<IconProps>;
|
|
62
64
|
|
|
63
65
|
declare const SortDownIcon: React__default.FC<IconProps>;
|
|
@@ -88,4 +90,4 @@ declare const VisibilityIcon: React__default.FC<IconProps>;
|
|
|
88
90
|
|
|
89
91
|
declare const PointIcon: React__default.FC<IconProps>;
|
|
90
92
|
|
|
91
|
-
export { AddIcon, AlertIcon, ArrowDropDownIcon, ArrowDropUpIcon, AttachIcon, BarChartIcon, BookmarkAddIcon, BookmarkIcon, CheckboxDeselectedIcon, CheckboxIcon, CheckboxSeveralIcon, ChevronLeftIcon, ChevronRightIcon, CircleFilledIcon, CloseIcon, DateRangeIcon, DeleteIcon, DoneIcon, DownloadIcon, EditIcon, ExportTableIcon, FileUploadIcon, FilterClearIcon, FilterIcon, FullScreenOffIcon, FullScreenOnIcon, InfoIcon, KeyboardArrowDownIcon, ListIcon, MoreVerticalIcon, PointIcon, RadioDeselectedIcon, RadioSelectedIcon, SearchIcon, SettingsIcon, SortDownIcon, SortUpIcon, TableChartIcon, UploadIcon, VisibilityIcon, WellIcon };
|
|
93
|
+
export { AddIcon, AlertIcon, ArrowDropDownIcon, ArrowDropUpIcon, AttachIcon, BarChartIcon, BookmarkAddIcon, BookmarkIcon, CheckboxDeselectedIcon, CheckboxIcon, CheckboxSeveralIcon, ChevronLeftIcon, ChevronRightIcon, CircleFilledIcon, CloseIcon, DateRangeIcon, DeleteIcon, DoneIcon, DownloadIcon, EditIcon, ExportTableIcon, FileUploadIcon, FilterClearIcon, FilterIcon, FullScreenOffIcon, FullScreenOnIcon, InfoIcon, KeyboardArrowDownIcon, ListIcon, MoreVerticalIcon, PointIcon, RadioDeselectedIcon, RadioSelectedIcon, SearchIcon, SelectUniqueIcon, SettingsIcon, SortDownIcon, SortUpIcon, TableChartIcon, UploadIcon, VisibilityIcon, WellIcon };
|
package/icons/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
RadioDeselectedIcon,
|
|
34
34
|
RadioSelectedIcon,
|
|
35
35
|
SearchIcon,
|
|
36
|
+
SelectUniqueIcon,
|
|
36
37
|
SettingsIcon,
|
|
37
38
|
SortDownIcon,
|
|
38
39
|
SortUpIcon,
|
|
@@ -40,7 +41,7 @@ import {
|
|
|
40
41
|
UploadIcon,
|
|
41
42
|
VisibilityIcon,
|
|
42
43
|
WellIcon
|
|
43
|
-
} from "../chunk-
|
|
44
|
+
} from "../chunk-MHQGQL5J.js";
|
|
44
45
|
export {
|
|
45
46
|
AddIcon,
|
|
46
47
|
AlertIcon,
|
|
@@ -76,6 +77,7 @@ export {
|
|
|
76
77
|
RadioDeselectedIcon,
|
|
77
78
|
RadioSelectedIcon,
|
|
78
79
|
SearchIcon,
|
|
80
|
+
SelectUniqueIcon,
|
|
79
81
|
SettingsIcon,
|
|
80
82
|
SortDownIcon,
|
|
81
83
|
SortUpIcon,
|
package/index.d.ts
CHANGED
|
@@ -308,6 +308,7 @@ interface FilterBy {
|
|
|
308
308
|
columnName: string;
|
|
309
309
|
type: 'value' | 'numberRange' | 'dateRange';
|
|
310
310
|
values: (string | number)[];
|
|
311
|
+
uniqueFirstPerValue?: boolean;
|
|
311
312
|
}
|
|
312
313
|
|
|
313
314
|
type SortType = 'alphanumeric' | 'locale';
|
|
@@ -334,6 +335,7 @@ interface TableColumn {
|
|
|
334
335
|
filtrationByNumber?: boolean;
|
|
335
336
|
filtrationByDate?: boolean;
|
|
336
337
|
filtrationByValue?: boolean;
|
|
338
|
+
selectUnique?: boolean;
|
|
337
339
|
width?: number;
|
|
338
340
|
headerAlign?: ColumnAlign;
|
|
339
341
|
rowsAlign?: ColumnAlign;
|
package/index.js
CHANGED
|
@@ -16,10 +16,11 @@ import {
|
|
|
16
16
|
RadioDeselectedIcon,
|
|
17
17
|
RadioSelectedIcon,
|
|
18
18
|
SearchIcon,
|
|
19
|
+
SelectUniqueIcon,
|
|
19
20
|
SortDownIcon,
|
|
20
21
|
SortUpIcon,
|
|
21
22
|
__export
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-MHQGQL5J.js";
|
|
23
24
|
|
|
24
25
|
// src/components/common/Button/Button.tsx
|
|
25
26
|
import classnames from "classnames";
|
|
@@ -3705,6 +3706,7 @@ function HeaderDropdown(props) {
|
|
|
3705
3706
|
const {
|
|
3706
3707
|
headerMeta: {
|
|
3707
3708
|
sortable = false,
|
|
3709
|
+
selectUnique = false,
|
|
3708
3710
|
sortType,
|
|
3709
3711
|
sortAnotherName,
|
|
3710
3712
|
filtrationByNumber = false,
|
|
@@ -3833,7 +3835,12 @@ function HeaderDropdown(props) {
|
|
|
3833
3835
|
const selectedValues = Object.keys(selected6);
|
|
3834
3836
|
setFilterBy((prev) => {
|
|
3835
3837
|
if (selectedValues.length === 0) {
|
|
3836
|
-
return prev.
|
|
3838
|
+
return prev.map((p) => {
|
|
3839
|
+
if (p.columnName !== headerResultName || p.type !== "value") {
|
|
3840
|
+
return p;
|
|
3841
|
+
}
|
|
3842
|
+
return p.uniqueFirstPerValue ? { ...p, values: [] } : null;
|
|
3843
|
+
}).filter((p) => p !== null);
|
|
3837
3844
|
}
|
|
3838
3845
|
const newResult = [...prev];
|
|
3839
3846
|
const existIndex = newResult.findIndex((p) => p.columnName === headerResultName && p.type === "value");
|
|
@@ -3845,15 +3852,68 @@ function HeaderDropdown(props) {
|
|
|
3845
3852
|
return newResult;
|
|
3846
3853
|
});
|
|
3847
3854
|
};
|
|
3848
|
-
const
|
|
3855
|
+
const uniqueFirstPerValue = filterBy.some(
|
|
3856
|
+
(fb) => fb.columnName === headerResultName && fb.type === "value" && fb.uniqueFirstPerValue
|
|
3857
|
+
);
|
|
3858
|
+
const toggleUniqueFirstPerValue = () => {
|
|
3859
|
+
setFilterBy((prev) => {
|
|
3860
|
+
const existIndex = prev.findIndex((p) => p.columnName === headerResultName && p.type === "value");
|
|
3861
|
+
if (existIndex !== -1) {
|
|
3862
|
+
const current = prev[existIndex];
|
|
3863
|
+
const nextFlag = !current.uniqueFirstPerValue;
|
|
3864
|
+
if (!nextFlag && current.values.length === 0) {
|
|
3865
|
+
return prev.filter((_, i) => i !== existIndex);
|
|
3866
|
+
}
|
|
3867
|
+
return prev.map((p, i) => {
|
|
3868
|
+
if (i !== existIndex) {
|
|
3869
|
+
return p;
|
|
3870
|
+
}
|
|
3871
|
+
if (nextFlag) {
|
|
3872
|
+
return { ...p, uniqueFirstPerValue: true };
|
|
3873
|
+
}
|
|
3874
|
+
return { columnName: p.columnName, type: p.type, values: p.values };
|
|
3875
|
+
});
|
|
3876
|
+
}
|
|
3877
|
+
return [...prev, { columnName: headerResultName, type: "value", values: [], uniqueFirstPerValue: true }];
|
|
3878
|
+
});
|
|
3879
|
+
};
|
|
3880
|
+
const hasAnyFilter = Object.keys(filterSelectedItems).length > 0 || uniqueFirstPerValue;
|
|
3849
3881
|
const sortUp = sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "desc");
|
|
3850
3882
|
const sortDown = sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "asc");
|
|
3851
3883
|
const { t } = useTranslation();
|
|
3884
|
+
const headerActionMenuItems = [];
|
|
3885
|
+
if (selectUnique) {
|
|
3886
|
+
headerActionMenuItems.push({ type: "divider", name: t("\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0441\u0442\u044C \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0439") });
|
|
3887
|
+
headerActionMenuItems.push({
|
|
3888
|
+
type: "item",
|
|
3889
|
+
name: t("\u0422\u043E\u043B\u044C\u043A\u043E \u0443\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0435"),
|
|
3890
|
+
icon: /* @__PURE__ */ jsx35(SelectUniqueIcon, {}),
|
|
3891
|
+
selected: uniqueFirstPerValue,
|
|
3892
|
+
onClick: toggleUniqueFirstPerValue
|
|
3893
|
+
});
|
|
3894
|
+
}
|
|
3895
|
+
if (sortable) {
|
|
3896
|
+
headerActionMenuItems.push({ type: "divider", name: t("\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430") });
|
|
3897
|
+
headerActionMenuItems.push({
|
|
3898
|
+
type: "item",
|
|
3899
|
+
name: t("\u041F\u043E \u0432\u043E\u0437\u0440\u0430\u0441\u0442\u0430\u043D\u0438\u044E"),
|
|
3900
|
+
icon: /* @__PURE__ */ jsx35(SortDownIcon, {}),
|
|
3901
|
+
selected: sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "asc"),
|
|
3902
|
+
onClick: handleSortClick("asc")
|
|
3903
|
+
});
|
|
3904
|
+
headerActionMenuItems.push({
|
|
3905
|
+
type: "item",
|
|
3906
|
+
name: t("\u041F\u043E \u0443\u0431\u044B\u0432\u0430\u043D\u0438\u044E"),
|
|
3907
|
+
icon: /* @__PURE__ */ jsx35(SortUpIcon, {}),
|
|
3908
|
+
selected: sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "desc"),
|
|
3909
|
+
onClick: handleSortClick("desc")
|
|
3910
|
+
});
|
|
3911
|
+
}
|
|
3852
3912
|
return /* @__PURE__ */ jsxs20("div", { className: classnames22(root19), children: [
|
|
3853
3913
|
leftAdditionalContent?.(headerResultName),
|
|
3854
3914
|
children2?.(showUniqueValuesCount && /* @__PURE__ */ jsx35("div", { children: `(${uniqueRows.length})` })),
|
|
3855
3915
|
rightAdditionalContent?.(headerResultName),
|
|
3856
|
-
(sortable || filtrationByValue || filtrationByDate || filtrationByNumber) && /* @__PURE__ */ jsx35(
|
|
3916
|
+
(sortable || selectUnique || filtrationByValue || filtrationByDate || filtrationByNumber) && /* @__PURE__ */ jsx35(
|
|
3857
3917
|
Popover,
|
|
3858
3918
|
{
|
|
3859
3919
|
placement: "bottom-end",
|
|
@@ -3870,31 +3930,7 @@ function HeaderDropdown(props) {
|
|
|
3870
3930
|
actionWithSelected: actionWithSelectedObjects
|
|
3871
3931
|
}
|
|
3872
3932
|
) }),
|
|
3873
|
-
sortable && /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
|
|
3874
|
-
Menu,
|
|
3875
|
-
{
|
|
3876
|
-
items: [
|
|
3877
|
-
{
|
|
3878
|
-
type: "divider",
|
|
3879
|
-
name: t("\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430")
|
|
3880
|
-
},
|
|
3881
|
-
{
|
|
3882
|
-
type: "item",
|
|
3883
|
-
name: t("\u041F\u043E \u0432\u043E\u0437\u0440\u0430\u0441\u0442\u0430\u043D\u0438\u044E"),
|
|
3884
|
-
icon: /* @__PURE__ */ jsx35(SortDownIcon, {}),
|
|
3885
|
-
selected: sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "asc"),
|
|
3886
|
-
onClick: handleSortClick("asc")
|
|
3887
|
-
},
|
|
3888
|
-
{
|
|
3889
|
-
type: "item",
|
|
3890
|
-
name: t("\u041F\u043E \u0443\u0431\u044B\u0432\u0430\u043D\u0438\u044E"),
|
|
3891
|
-
icon: /* @__PURE__ */ jsx35(SortUpIcon, {}),
|
|
3892
|
-
selected: sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "desc"),
|
|
3893
|
-
onClick: handleSortClick("desc")
|
|
3894
|
-
}
|
|
3895
|
-
]
|
|
3896
|
-
}
|
|
3897
|
-
) })
|
|
3933
|
+
(sortable || selectUnique) && /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(Menu, { items: headerActionMenuItems }) })
|
|
3898
3934
|
] }),
|
|
3899
3935
|
children: /* @__PURE__ */ jsx35(Tooltip, { label: t("\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430 \u0438 \u0444\u0438\u043B\u044C\u0442\u0440\u0430\u0446\u0438\u044F"), placement: "bottom-end", root: containerRef, children: /* @__PURE__ */ jsx35(
|
|
3900
3936
|
Button,
|
|
@@ -3910,6 +3946,21 @@ function HeaderDropdown(props) {
|
|
|
3910
3946
|
] });
|
|
3911
3947
|
}
|
|
3912
3948
|
|
|
3949
|
+
// src/components/view/VirtualTable/utils/dedupeFirstByColumnValue.ts
|
|
3950
|
+
function dedupeFirstByColumnValue(rows, columnName) {
|
|
3951
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3952
|
+
const result = [];
|
|
3953
|
+
rows.forEach((row) => {
|
|
3954
|
+
const key = row[columnName] ? (row[columnName].value || "")?.toString() : "";
|
|
3955
|
+
if (seen.has(key)) {
|
|
3956
|
+
return;
|
|
3957
|
+
}
|
|
3958
|
+
seen.add(key);
|
|
3959
|
+
result.push(row);
|
|
3960
|
+
});
|
|
3961
|
+
return result;
|
|
3962
|
+
}
|
|
3963
|
+
|
|
3913
3964
|
// src/components/view/VirtualTable/utils/getColumns.ts
|
|
3914
3965
|
var createMeta = (column) => {
|
|
3915
3966
|
if (column) {
|
|
@@ -3921,6 +3972,7 @@ var createMeta = (column) => {
|
|
|
3921
3972
|
filtrationByNumber: column.filtrationByNumber,
|
|
3922
3973
|
filtrationByDate: column.filtrationByDate,
|
|
3923
3974
|
filtrationByValue: column.filtrationByValue,
|
|
3975
|
+
selectUnique: column.selectUnique,
|
|
3924
3976
|
width: column.width,
|
|
3925
3977
|
headerAlign: column.headerAlign,
|
|
3926
3978
|
rowsAlign: column.rowsAlign,
|
|
@@ -4068,6 +4120,9 @@ var VirtualTable = forwardRef10((props, ref) => {
|
|
|
4068
4120
|
const memoizedData = useMemo10(() => {
|
|
4069
4121
|
const newRows = [...rows];
|
|
4070
4122
|
const nextFilterBy = filterBy.filter((filterByItem) => {
|
|
4123
|
+
if (filterByItem.type === "value" && filterByItem.uniqueFirstPerValue && filterByItem.values.length === 0) {
|
|
4124
|
+
return true;
|
|
4125
|
+
}
|
|
4071
4126
|
const startDate = filterByItem.type === "dateRange" ? dayjs2(filterByItem.values[0]) : null;
|
|
4072
4127
|
const endDate = filterByItem.type === "dateRange" ? dayjs2(filterByItem.values[1]) : null;
|
|
4073
4128
|
return rows.some((row) => {
|
|
@@ -4078,7 +4133,12 @@ var VirtualTable = forwardRef10((props, ref) => {
|
|
|
4078
4133
|
const filtered = nextFilterBy.length ? recursiveFilter(newRows, nextFilterBy) : filterBy.some(
|
|
4079
4134
|
(fb) => fb.type === "numberRange" && fb.values.some((v) => v !== Infinity && v !== -Infinity) || fb.type === "dateRange" && fb.values.some((v) => !dayjs2(v).isSame(dayjs2(0)) && !dayjs2(v).isSame(dayjs2(Number.MAX_SAFE_INTEGER)))
|
|
4080
4135
|
) ? [] : newRows;
|
|
4081
|
-
|
|
4136
|
+
let sorted = sortBy.length ? recursiveSort(filtered, sortBy) : filtered;
|
|
4137
|
+
for (const fb of nextFilterBy) {
|
|
4138
|
+
if (fb.type === "value" && fb.uniqueFirstPerValue) {
|
|
4139
|
+
sorted = dedupeFirstByColumnValue(sorted, fb.columnName);
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4082
4142
|
const result = rowNumberColumnId ? sorted.map((row, index) => ({
|
|
4083
4143
|
...row,
|
|
4084
4144
|
[rowNumberColumnId]: {
|
|
@@ -4336,7 +4396,7 @@ var VirtualTable = forwardRef10((props, ref) => {
|
|
|
4336
4396
|
const headerResultName = headerMeta?.sortAnotherName ?? header2.column.columnDef.id ?? header2.id;
|
|
4337
4397
|
const columnFilterIndex = filterBy.findIndex((fb) => fb.columnName === headerResultName);
|
|
4338
4398
|
const rowsForChecklist = columnFilterIndex === -1 ? memoizedData : partialFiltered[columnFilterIndex];
|
|
4339
|
-
return /* @__PURE__ */ jsx36("div", { className: classnames23(thCell), children: header2.column.columnDef.id === header2.column.columnDef["accessorKey"] && header2.column.columnDef.id !== rowNumberColumnId && (headerMeta?.sortable || headerMeta?.filtrationByValue || headerMeta?.filtrationByDate || headerMeta?.filtrationByNumber || headerMeta && showUniqueValuesCount) ? /* @__PURE__ */ jsx36(
|
|
4399
|
+
return /* @__PURE__ */ jsx36("div", { className: classnames23(thCell), children: header2.column.columnDef.id === header2.column.columnDef["accessorKey"] && header2.column.columnDef.id !== rowNumberColumnId && (headerMeta?.sortable || headerMeta?.selectUnique || headerMeta?.filtrationByValue || headerMeta?.filtrationByDate || headerMeta?.filtrationByNumber || headerMeta && showUniqueValuesCount) ? /* @__PURE__ */ jsx36(
|
|
4340
4400
|
HeaderDropdown,
|
|
4341
4401
|
{
|
|
4342
4402
|
headerMeta,
|