nntc-ui 0.0.43 → 0.0.44

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.
Files changed (2) hide show
  1. package/index.js +13 -2
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -2918,7 +2918,8 @@ function HeaderDropdown(props) {
2918
2918
  containerRef,
2919
2919
  showUniqueValuesCount,
2920
2920
  additionalContent,
2921
- children: children2
2921
+ children: children2,
2922
+ rows
2922
2923
  } = props;
2923
2924
  const headerResultName = sortAnotherName ?? headerName;
2924
2925
  const filterItems3 = useMemo5(() => {
@@ -2936,6 +2937,10 @@ function HeaderDropdown(props) {
2936
2937
  ];
2937
2938
  return uniqueChecklistItems;
2938
2939
  }, [items2, headerResultName]);
2940
+ const uniqueRows = useMemo5(
2941
+ () => Array.from(new Set(rows.map((i) => i?.[headerResultName].payload?.id ?? i?.[headerResultName].value))),
2942
+ [rows, headerResultName]
2943
+ );
2939
2944
  const filterSelectedItems = useMemo5(() => {
2940
2945
  const result = {};
2941
2946
  filterBy.find((fb) => fb.columnName === headerResultName)?.values.forEach((v) => {
@@ -3023,7 +3028,7 @@ function HeaderDropdown(props) {
3023
3028
  const { t } = useTranslation();
3024
3029
  return /* @__PURE__ */ jsxs19("div", { className: classnames21(root18), children: [
3025
3030
  additionalContent?.(headerResultName),
3026
- children2?.(showUniqueValuesCount && /* @__PURE__ */ jsx33("div", { children: `(${filterItems3.length})` })),
3031
+ children2?.(showUniqueValuesCount && /* @__PURE__ */ jsx33("div", { children: `(${uniqueRows.length})` })),
3027
3032
  (sortable || filtrationByValue || filtrationByDate || filtrationByNumber) && /* @__PURE__ */ jsx33(
3028
3033
  Popover,
3029
3034
  {
@@ -3258,6 +3263,11 @@ function VirtualTable(props) {
3258
3263
  (fb) => fb.type === "numberRange" && fb.values.some((v) => v !== Infinity && v !== -Infinity) || fb.type === "dateRange" && fb.values.some((v) => !dayjs4(v).isSame(dayjs4(0)) && !dayjs4(v).isSame(dayjs4(Number.MAX_SAFE_INTEGER)))
3259
3264
  ) ? [] : newRows;
3260
3265
  const sorted = sortBy.length ? recursiveSort(filtered, sortBy) : filtered;
3266
+ window.dispatchEvent(
3267
+ new CustomEvent("filteringRows", {
3268
+ detail: sorted
3269
+ })
3270
+ );
3261
3271
  return sorted;
3262
3272
  }, [rows, sortBy, filterBy]);
3263
3273
  const columnsEstimateSize = useMemo6(
@@ -3424,6 +3434,7 @@ function VirtualTable(props) {
3424
3434
  filterBy,
3425
3435
  setFilterBy,
3426
3436
  items: rows,
3437
+ rows: memoizedData,
3427
3438
  headerName: header2.column.columnDef.id ?? header2.id,
3428
3439
  containerRef: useTableContainerAsRootForPopup ? tableContainerRef : void 0,
3429
3440
  showUniqueValuesCount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nntc-ui",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "author": "NNTC",
5
5
  "description": "React UI-kit for NNTC",
6
6
  "type": "module",
@@ -117,4 +117,4 @@
117
117
  "vite-plugin-svgr": "^4.5.0",
118
118
  "vite-tsconfig-paths": "^5.1.4"
119
119
  }
120
- }
120
+ }