@sustaina/shared-ui 1.9.0 → 1.9.1

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.d.mts CHANGED
@@ -499,6 +499,7 @@ type UseGridSettingsStoreActions = {
499
499
  syncColumnsState: <TData = RowData$1>(table: Table$1<TData>, options?: {
500
500
  excludeColumns: KeyOrString<TData>[];
501
501
  labelMap?: Partial<Record<KeyOrString<TData>, string>>;
502
+ visibility?: Record<keyof TData, boolean>;
502
503
  }) => void;
503
504
  };
504
505
  type UseGridSettingsStoreState = {
package/dist/index.d.ts CHANGED
@@ -499,6 +499,7 @@ type UseGridSettingsStoreActions = {
499
499
  syncColumnsState: <TData = RowData$1>(table: Table$1<TData>, options?: {
500
500
  excludeColumns: KeyOrString<TData>[];
501
501
  labelMap?: Partial<Record<KeyOrString<TData>, string>>;
502
+ visibility?: Record<keyof TData, boolean>;
502
503
  }) => void;
503
504
  };
504
505
  type UseGridSettingsStoreState = {
package/dist/index.js CHANGED
@@ -8584,7 +8584,7 @@ var useGridSettingsStore = zustand.create(
8584
8584
  },
8585
8585
  syncColumnsState: (table, options) => {
8586
8586
  const { availableColumns, currentColumns } = get().extractColumns(table);
8587
- const { excludeColumns = [], labelMap = {} } = options || {};
8587
+ const { excludeColumns = [], labelMap = {}, visibility = {} } = options || {};
8588
8588
  const filteredExcludeColumnFn = (column) => !excludeColumns.includes(column.id);
8589
8589
  const mapLabel = (col) => ({
8590
8590
  id: col.id,
@@ -8592,7 +8592,14 @@ var useGridSettingsStore = zustand.create(
8592
8592
  });
8593
8593
  set({
8594
8594
  availableColumns: availableColumns.filter(filteredExcludeColumnFn).map(mapLabel),
8595
- currentColumns: currentColumns.filter(filteredExcludeColumnFn).map(mapLabel)
8595
+ currentColumns: currentColumns.filter(filteredExcludeColumnFn).filter((column) => {
8596
+ for (const [columnId, isVisible] of Object.entries(visibility)) {
8597
+ if (column.id === columnId && !isVisible) {
8598
+ return false;
8599
+ }
8600
+ }
8601
+ return true;
8602
+ }).map(mapLabel)
8596
8603
  });
8597
8604
  }
8598
8605
  })