nntc-ui 0.0.94 → 0.0.96

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.
@@ -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/SettingsIcon.tsx
165
+ // src/icons/SelectUniqueIcon.tsx
166
166
  import { jsx as jsx28 } from "react/jsx-runtime";
167
- var SettingsIcon = (props) => /* @__PURE__ */ jsx28(Icon, { ...props, children: /* @__PURE__ */ jsx28("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" }) });
167
+ var SelectUniqueIcon = (props) => /* @__PURE__ */ jsx28(Icon, { ...props, children: /* @__PURE__ */ jsx28("path", { d: "M3 5h18v2H3V5zm0 6h18v2H3v-2zm0 6h10v2H3v-2z" }) });
168
168
 
169
- // src/icons/SortDownIcon.tsx
169
+ // src/icons/SettingsIcon.tsx
170
170
  import { jsx as jsx29 } from "react/jsx-runtime";
171
- var SortDownIcon = (props) => /* @__PURE__ */ jsx29(Icon, { ...props, children: /* @__PURE__ */ jsx29("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M3 18V16H21V18H3ZM3 6H9V8H3V6ZM15 11H3V13H15V11Z" }) });
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/SortUpIcon.tsx
173
+ // src/icons/SortDownIcon.tsx
174
174
  import { jsx as jsx30 } from "react/jsx-runtime";
175
- var SortUpIcon = (props) => /* @__PURE__ */ jsx30(Icon, { ...props, children: /* @__PURE__ */ jsx30("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M3 6V8H21V6H3ZM3 18H9V16H3V18ZM15 13H3V11H15V13Z" }) });
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/TableChartIcon.tsx
177
+ // src/icons/SortUpIcon.tsx
178
178
  import { jsx as jsx31 } from "react/jsx-runtime";
179
- var TableChartIcon = (props) => /* @__PURE__ */ jsx31(Icon, { ...props, children: /* @__PURE__ */ jsx31("path", { d: "M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z" }) });
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/UploadIcon.tsx
181
+ // src/icons/TableChartIcon.tsx
182
182
  import { jsx as jsx32 } from "react/jsx-runtime";
183
- var UploadIcon = (props) => /* @__PURE__ */ jsx32(Icon, { ...props, children: /* @__PURE__ */ jsx32("path", { d: "M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z" }) });
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/WellIcon.tsx
185
+ // src/icons/UploadIcon.tsx
186
186
  import { jsx as jsx33 } from "react/jsx-runtime";
187
- var WellIcon = (props) => /* @__PURE__ */ jsx33(Icon, { ...props, children: /* @__PURE__ */ jsx33("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" }) });
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/EditIcon.tsx
189
+ // src/icons/WellIcon.tsx
190
190
  import { jsx as jsx34 } from "react/jsx-runtime";
191
- var EditIcon = (props) => /* @__PURE__ */ jsx34(Icon, { ...props, children: /* @__PURE__ */ jsx34("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" }) });
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/FullScreenOnIcon.tsx
193
+ // src/icons/EditIcon.tsx
194
194
  import { jsx as jsx35 } from "react/jsx-runtime";
195
- var FullScreenOnIcon = (props) => /* @__PURE__ */ jsx35(Icon, { ...props, children: /* @__PURE__ */ jsx35(
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 jsx36 } from "react/jsx-runtime";
205
- var FullScreenOffIcon = (props) => /* @__PURE__ */ jsx36(Icon, { ...props, children: /* @__PURE__ */ jsx36("path", { d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" }) });
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 jsx37 } from "react/jsx-runtime";
209
- var BookmarkIcon = (props) => /* @__PURE__ */ jsx37(Icon, { ...props, children: /* @__PURE__ */ jsx37("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" }) });
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 jsx38 } from "react/jsx-runtime";
213
- var BookmarkAddIcon = (props) => /* @__PURE__ */ jsx38(Icon, { ...props, children: /* @__PURE__ */ jsx38(
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 jsx39 } from "react/jsx-runtime";
223
- var ExportTableIcon = (props) => /* @__PURE__ */ jsx39(Icon, { ...props, children: /* @__PURE__ */ jsx39(
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 jsx40 } from "react/jsx-runtime";
240
- var DownloadIcon = (props) => /* @__PURE__ */ jsx40(Icon, { ...props, children: /* @__PURE__ */ jsx40("path", { d: "M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z" }) });
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 jsx41 } from "react/jsx-runtime";
244
- var VisibilityIcon = (props) => /* @__PURE__ */ jsx41(Icon, { ...props, children: /* @__PURE__ */ jsx41(
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 jsx42 } from "react/jsx-runtime";
260
- var PointIcon = (props) => /* @__PURE__ */ jsx42(Icon, { ...props, children: /* @__PURE__ */ jsx42(
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-SQXO2GJK.js";
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-SQXO2GJK.js";
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,
@@ -3723,7 +3725,8 @@ function HeaderDropdown(props) {
3723
3725
  leftAdditionalContent,
3724
3726
  rightAdditionalContent,
3725
3727
  children: children2,
3726
- rows
3728
+ rows,
3729
+ rowsForUniqueCount
3727
3730
  } = props;
3728
3731
  const headerResultName = sortAnotherName ?? headerName;
3729
3732
  const filterItems2 = useMemo9(() => {
@@ -3750,14 +3753,26 @@ function HeaderDropdown(props) {
3750
3753
  ];
3751
3754
  return uniqueChecklistItems;
3752
3755
  }, [rows, headerResultName, valueFormat, toFixed]);
3753
- const uniqueRows = useMemo9(
3754
- () => Array.from(
3755
- new Set(
3756
- rows.filter((row) => !!row?.[headerResultName]).map((row) => row[headerResultName].payload?.id ?? row[headerResultName].value)
3757
- )
3758
- ),
3759
- [rows, headerResultName]
3760
- );
3756
+ const uniqueValuesCount = useMemo9(() => {
3757
+ const sourceRows = rowsForUniqueCount ?? rows;
3758
+ const unique = /* @__PURE__ */ new Set();
3759
+ sourceRows.forEach((sr) => {
3760
+ const cell2 = sr?.[headerResultName];
3761
+ unique.add(cell2 ? (cell2.value ?? "")?.toString() : "");
3762
+ });
3763
+ const valueFilter = filterBy.find((fb) => fb.columnName === headerResultName && fb.type === "value");
3764
+ const selected6 = (valueFilter?.values ?? []).map((v) => (v ?? "")?.toString());
3765
+ if (selected6.length > 0) {
3766
+ const selectedSet = new Set(selected6);
3767
+ let count = 0;
3768
+ unique.forEach((u) => {
3769
+ if (selectedSet.has(u))
3770
+ count += 1;
3771
+ });
3772
+ return count;
3773
+ }
3774
+ return unique.size;
3775
+ }, [rowsForUniqueCount, rows, headerResultName, filterBy]);
3761
3776
  const filterSelectedItems = useMemo9(() => {
3762
3777
  const result = {};
3763
3778
  filterBy.find((fb) => fb.columnName === headerResultName)?.values.forEach((v) => {
@@ -3833,7 +3848,12 @@ function HeaderDropdown(props) {
3833
3848
  const selectedValues = Object.keys(selected6);
3834
3849
  setFilterBy((prev) => {
3835
3850
  if (selectedValues.length === 0) {
3836
- return prev.filter((p) => !(p.columnName === headerResultName && p.type === "value"));
3851
+ return prev.map((p) => {
3852
+ if (p.columnName !== headerResultName || p.type !== "value") {
3853
+ return p;
3854
+ }
3855
+ return p.uniqueFirstPerValue ? { ...p, values: [] } : null;
3856
+ }).filter((p) => p !== null);
3837
3857
  }
3838
3858
  const newResult = [...prev];
3839
3859
  const existIndex = newResult.findIndex((p) => p.columnName === headerResultName && p.type === "value");
@@ -3845,15 +3865,68 @@ function HeaderDropdown(props) {
3845
3865
  return newResult;
3846
3866
  });
3847
3867
  };
3848
- const hasAnyFilter = Object.keys(filterSelectedItems).length;
3868
+ const uniqueFirstPerValue = filterBy.some(
3869
+ (fb) => fb.columnName === headerResultName && fb.type === "value" && fb.uniqueFirstPerValue
3870
+ );
3871
+ const toggleUniqueFirstPerValue = () => {
3872
+ setFilterBy((prev) => {
3873
+ const existIndex = prev.findIndex((p) => p.columnName === headerResultName && p.type === "value");
3874
+ if (existIndex !== -1) {
3875
+ const current = prev[existIndex];
3876
+ const nextFlag = !current.uniqueFirstPerValue;
3877
+ if (!nextFlag && current.values.length === 0) {
3878
+ return prev.filter((_, i) => i !== existIndex);
3879
+ }
3880
+ return prev.map((p, i) => {
3881
+ if (i !== existIndex) {
3882
+ return p;
3883
+ }
3884
+ if (nextFlag) {
3885
+ return { ...p, uniqueFirstPerValue: true };
3886
+ }
3887
+ return { columnName: p.columnName, type: p.type, values: p.values };
3888
+ });
3889
+ }
3890
+ return [...prev, { columnName: headerResultName, type: "value", values: [], uniqueFirstPerValue: true }];
3891
+ });
3892
+ };
3893
+ const hasAnyFilter = Object.keys(filterSelectedItems).length > 0 || uniqueFirstPerValue;
3849
3894
  const sortUp = sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "desc");
3850
3895
  const sortDown = sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "asc");
3851
3896
  const { t } = useTranslation();
3897
+ const headerActionMenuItems = [];
3898
+ if (selectUnique) {
3899
+ 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") });
3900
+ headerActionMenuItems.push({
3901
+ type: "item",
3902
+ name: t("\u0422\u043E\u043B\u044C\u043A\u043E \u0443\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0435"),
3903
+ icon: /* @__PURE__ */ jsx35(SelectUniqueIcon, {}),
3904
+ selected: uniqueFirstPerValue,
3905
+ onClick: toggleUniqueFirstPerValue
3906
+ });
3907
+ }
3908
+ if (sortable) {
3909
+ headerActionMenuItems.push({ type: "divider", name: t("\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430") });
3910
+ headerActionMenuItems.push({
3911
+ type: "item",
3912
+ name: t("\u041F\u043E \u0432\u043E\u0437\u0440\u0430\u0441\u0442\u0430\u043D\u0438\u044E"),
3913
+ icon: /* @__PURE__ */ jsx35(SortDownIcon, {}),
3914
+ selected: sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "asc"),
3915
+ onClick: handleSortClick("asc")
3916
+ });
3917
+ headerActionMenuItems.push({
3918
+ type: "item",
3919
+ name: t("\u041F\u043E \u0443\u0431\u044B\u0432\u0430\u043D\u0438\u044E"),
3920
+ icon: /* @__PURE__ */ jsx35(SortUpIcon, {}),
3921
+ selected: sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "desc"),
3922
+ onClick: handleSortClick("desc")
3923
+ });
3924
+ }
3852
3925
  return /* @__PURE__ */ jsxs20("div", { className: classnames22(root19), children: [
3853
3926
  leftAdditionalContent?.(headerResultName),
3854
- children2?.(showUniqueValuesCount && /* @__PURE__ */ jsx35("div", { children: `(${uniqueRows.length})` })),
3927
+ children2?.(showUniqueValuesCount && /* @__PURE__ */ jsx35("div", { children: `(${uniqueValuesCount})` })),
3855
3928
  rightAdditionalContent?.(headerResultName),
3856
- (sortable || filtrationByValue || filtrationByDate || filtrationByNumber) && /* @__PURE__ */ jsx35(
3929
+ (sortable || selectUnique || filtrationByValue || filtrationByDate || filtrationByNumber) && /* @__PURE__ */ jsx35(
3857
3930
  Popover,
3858
3931
  {
3859
3932
  placement: "bottom-end",
@@ -3870,31 +3943,7 @@ function HeaderDropdown(props) {
3870
3943
  actionWithSelected: actionWithSelectedObjects
3871
3944
  }
3872
3945
  ) }),
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
- ) })
3946
+ (sortable || selectUnique) && /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(Menu, { items: headerActionMenuItems }) })
3898
3947
  ] }),
3899
3948
  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
3949
  Button,
@@ -3910,6 +3959,21 @@ function HeaderDropdown(props) {
3910
3959
  ] });
3911
3960
  }
3912
3961
 
3962
+ // src/components/view/VirtualTable/utils/dedupeFirstByColumnValue.ts
3963
+ function dedupeFirstByColumnValue(rows, columnName) {
3964
+ const seen = /* @__PURE__ */ new Set();
3965
+ const result = [];
3966
+ rows.forEach((row) => {
3967
+ const key = row[columnName] ? (row[columnName].value || "")?.toString() : "";
3968
+ if (seen.has(key)) {
3969
+ return;
3970
+ }
3971
+ seen.add(key);
3972
+ result.push(row);
3973
+ });
3974
+ return result;
3975
+ }
3976
+
3913
3977
  // src/components/view/VirtualTable/utils/getColumns.ts
3914
3978
  var createMeta = (column) => {
3915
3979
  if (column) {
@@ -3921,6 +3985,7 @@ var createMeta = (column) => {
3921
3985
  filtrationByNumber: column.filtrationByNumber,
3922
3986
  filtrationByDate: column.filtrationByDate,
3923
3987
  filtrationByValue: column.filtrationByValue,
3988
+ selectUnique: column.selectUnique,
3924
3989
  width: column.width,
3925
3990
  headerAlign: column.headerAlign,
3926
3991
  rowsAlign: column.rowsAlign,
@@ -4068,6 +4133,9 @@ var VirtualTable = forwardRef10((props, ref) => {
4068
4133
  const memoizedData = useMemo10(() => {
4069
4134
  const newRows = [...rows];
4070
4135
  const nextFilterBy = filterBy.filter((filterByItem) => {
4136
+ if (filterByItem.type === "value" && filterByItem.uniqueFirstPerValue && filterByItem.values.length === 0) {
4137
+ return true;
4138
+ }
4071
4139
  const startDate = filterByItem.type === "dateRange" ? dayjs2(filterByItem.values[0]) : null;
4072
4140
  const endDate = filterByItem.type === "dateRange" ? dayjs2(filterByItem.values[1]) : null;
4073
4141
  return rows.some((row) => {
@@ -4078,7 +4146,12 @@ var VirtualTable = forwardRef10((props, ref) => {
4078
4146
  const filtered = nextFilterBy.length ? recursiveFilter(newRows, nextFilterBy) : filterBy.some(
4079
4147
  (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
4148
  ) ? [] : newRows;
4081
- const sorted = sortBy.length ? recursiveSort(filtered, sortBy) : filtered;
4149
+ let sorted = sortBy.length ? recursiveSort(filtered, sortBy) : filtered;
4150
+ for (const fb of nextFilterBy) {
4151
+ if (fb.type === "value" && fb.uniqueFirstPerValue) {
4152
+ sorted = dedupeFirstByColumnValue(sorted, fb.columnName);
4153
+ }
4154
+ }
4082
4155
  const result = rowNumberColumnId ? sorted.map((row, index) => ({
4083
4156
  ...row,
4084
4157
  [rowNumberColumnId]: {
@@ -4336,7 +4409,7 @@ var VirtualTable = forwardRef10((props, ref) => {
4336
4409
  const headerResultName = headerMeta?.sortAnotherName ?? header2.column.columnDef.id ?? header2.id;
4337
4410
  const columnFilterIndex = filterBy.findIndex((fb) => fb.columnName === headerResultName);
4338
4411
  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(
4412
+ 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
4413
  HeaderDropdown,
4341
4414
  {
4342
4415
  headerMeta,
@@ -4345,6 +4418,7 @@ var VirtualTable = forwardRef10((props, ref) => {
4345
4418
  filterBy,
4346
4419
  setFilterBy,
4347
4420
  rows: rowsForChecklist,
4421
+ rowsForUniqueCount: memoizedData,
4348
4422
  headerName: header2.column.columnDef.id ?? header2.id,
4349
4423
  containerRef: useTableContainerAsRootForPopup ? tableContainerRef : void 0,
4350
4424
  showUniqueValuesCount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nntc-ui",
3
- "version": "0.0.94",
3
+ "version": "0.0.96",
4
4
  "author": "NNTC",
5
5
  "description": "React UI-kit for NNTC",
6
6
  "type": "module",