@snack-uikit/table 0.37.28 → 0.37.29-preview-9d961963.0

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 (33) hide show
  1. package/README.md +27 -161
  2. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.d.ts +4 -0
  3. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.js +4 -0
  4. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.d.ts +4 -0
  5. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.js +4 -0
  6. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.d.ts +4 -0
  7. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.js +4 -0
  8. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/prepareColumnsSettings.d.ts +4 -0
  9. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/prepareColumnsSettings.js +4 -0
  10. package/dist/cjs/components/Table/utils/getPinnedGroups.d.ts +4 -0
  11. package/dist/cjs/components/Table/utils/getPinnedGroups.js +4 -0
  12. package/dist/cjs/components/Table/utils/getTableColumnsDefinitions.d.ts +4 -0
  13. package/dist/cjs/components/Table/utils/getTableColumnsDefinitions.js +4 -0
  14. package/dist/esm/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.d.ts +4 -0
  15. package/dist/esm/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.js +4 -0
  16. package/dist/esm/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.d.ts +4 -0
  17. package/dist/esm/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.js +4 -0
  18. package/dist/esm/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.d.ts +4 -0
  19. package/dist/esm/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.js +4 -0
  20. package/dist/esm/components/Table/hooks/useColumnSettings/utils/prepareColumnsSettings.d.ts +4 -0
  21. package/dist/esm/components/Table/hooks/useColumnSettings/utils/prepareColumnsSettings.js +4 -0
  22. package/dist/esm/components/Table/utils/getPinnedGroups.d.ts +4 -0
  23. package/dist/esm/components/Table/utils/getPinnedGroups.js +4 -0
  24. package/dist/esm/components/Table/utils/getTableColumnsDefinitions.d.ts +4 -0
  25. package/dist/esm/components/Table/utils/getTableColumnsDefinitions.js +4 -0
  26. package/package.json +2 -2
  27. package/src/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.ts +4 -0
  28. package/src/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.ts +4 -0
  29. package/src/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.ts +4 -1
  30. package/src/components/Table/hooks/useColumnSettings/utils/prepareColumnsSettings.ts +4 -0
  31. package/src/components/Table/utils/getPinnedGroups.ts +4 -0
  32. package/src/components/Table/utils/getTableColumnsDefinitions.ts +4 -0
  33. package/src/helperComponents/ColumnsSettings/ColumnsSettings.tsx +1 -0
package/README.md CHANGED
@@ -6,15 +6,19 @@
6
6
 
7
7
  [Changelog](./CHANGELOG.md)
8
8
 
9
- ## TODO:
10
-
11
- - multiple row selection with Shift key pressed
12
-
13
9
  ## Примечание
14
10
 
15
11
  > Для оптимальной работы таблицы используйте `useMemo` для `columnDefinitions`
16
12
  > или выносите их определение за компонент
17
13
 
14
+ ## Description
15
+
16
+ - Пакет `@snack-uikit/table` предоставляет компоненты для отображения структурированных данных в виде таблиц с расширенным функционалом: сортировка, фильтрация, пагинация, выбор строк, поиск, экспорт данных и настройка колонок.
17
+ - Основной компонент `Table` поддерживает клиентскую и серверную обработку данных, работу с большими объёмами информации через бесконечную прокрутку, закрепление строк и колонок, раскрывающиеся строки (tree-структура), массовые действия и сохранение состояния в localStorage и query-параметрах.
18
+ - Компонент `ServerTable` является обёрткой над `Table` для работы с серверной пагинацией: автоматически управляет состоянием поиска с дебаунсом, преобразует параметры пагинации в формат offset/limit и передаёт их через колбэк `onChangePage`, а также устанавливает режимы `manualSorting`, `manualPagination` и `manualFiltering` для серверной обработки.
19
+ - Таблица поддерживает настройку внешнего вида колонок (размеры, выравнивание, закрепление), кастомный рендеринг ячеек, колонки со статусами и действиями для строк, а также различные состояния: загрузка, пустые данные, ошибки, фильтрация.
20
+ - Figma: [Table](https://www.figma.com/file/jtGxAPvFJOMir7V0eQFukN/Snack-UI-Kit-1.1.0?node-id=41%3A225842&mode=design).
21
+
18
22
  ## Example
19
23
 
20
24
  ```typescript jsx
@@ -31,7 +35,7 @@ type TableData = {
31
35
  }
32
36
 
33
37
  const columnDefinitions: ColumnDefinition<TableData>[] = [
34
- Table.getStatusColumnDef<Person>({
38
+ Table.getStatusColumnDef<TableData>({
35
39
  accessorKey: 'status',
36
40
  mapStatusToAppearance: {
37
41
  pending: Table.statusAppearances.Blue,
@@ -123,112 +127,21 @@ const columnDefinitions: ColumnDefinition<TableData>[] = [
123
127
  | expanding | `{ getSubRows: (element: TData) => TData[]; expandingColumnDefinition: TreeColumnDefinitionProps<TData>; state?: ExpandedState; onChange?(state: ExpandedState): void; }` | - | Параметр отвечает за общие настройки раскрывающихся строк <br> <strong>getSubRows</strong>: Метод отвечает за получение дочерних строк <br> <strong>expandingColumnDefinition</strong>: Описание колонок для дочерних строк <br> <strong>state</strong>: Состояние открытых строк <br> <strong>onExpandedChange</strong>: Колбэк на раскрытие строк <br> |
124
128
  | enableSelectPinned | `boolean` | - | Параметр отвечает за чекбокс выбора закрепленных строк |
125
129
  ## isColumnEnabledInitially
126
- ### Props
127
- | name | type | default value | description |
128
- |------|------|---------------|-------------|
129
- | accessorFn* | `AccessorFn<TData, unknown>` | - | |
130
- | accessorKey* | `string \| number \| symbol \| (string & {})` | - | |
131
- | getUniqueValues | `AccessorFn<TData, unknown[]>` | - | |
132
- | cell | `ColumnDefTemplate<CellContext<TData, unknown>>` | - | |
133
- | meta | `ColumnMeta<TData, unknown> & { skipOnExport?: boolean; }` | - | Пропуск в экспорте |
134
- | enableSorting | `boolean` | - | Enables/Disables sorting for this column. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
135
- | invertSorting | `boolean` | - | Inverts the order of the sorting for this column. This is useful for values that have an inverted best/worst scale where lower numbers are better, eg. a ranking (1st, 2nd, 3rd) or golf-like scoring @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#invertsorting) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
136
- | sortDescFirst | `boolean` | - | Set to `true` for sorting toggles on this column to start in the descending direction. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
137
- | sortingFn | `SortingFnOption<TData>` | - | The sorting function to use with this column. - A `string` referencing a built-in sorting function - A custom sorting function @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortingfn) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
138
- | sortUndefined | `false \| 1 \| -1` | - | - `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies) - `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list) - `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list) |
139
- | aggregatedCell | `ColumnDefTemplate<CellContext<TData, unknown>>` | - | The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used). @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregatedcell) @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) |
140
- | aggregationFn | `AggregationFnOption<TData>` | - | The resolved aggregation function for the column. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregationfn) @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) |
141
- | getGroupingValue | `(row: TData) => any` | - | Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from `accessorKey` / `accessorFn` will be used instead. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue) @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) |
142
- | enableResizing | `boolean` | - | Enables or disables column resizing for the column. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enableresizing) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
143
- | maxSize | `number` | - | The maximum allowed size for the column @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#maxsize) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
144
- | minSize | `number` | - | The minimum allowed size for the column @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#minsize) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
145
- | size | `number` | - | The desired size for the column Размер ячейки @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#size) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
146
- | header | `string \| (string & ReactElement<any, string \| JSXElementConstructor<any>>) \| (string & Iterable<ReactNode>) \| ... 9 more ... \| (((props: HeaderContext<...>) => any) & ((ctx: HeaderContext<...>) => ReactNode))` | - | Заголовок колонки |
147
- | id | `string` | - | |
148
- | headerAlign | enum ColumnAlign: `"left"`, `"right"` | - | Позиционирование заголовка колонки |
149
- | align | enum ColumnAlign: `"left"`, `"right"` | - | Позиционирование контента ячейки в теле таблицы |
150
- | noBodyCellPadding | `boolean` | - | Отключить паддинг у ячейки в теле таблицы |
151
- | noHeaderCellPadding | `boolean` | - | Отключить паддинг у ячейки в шапке таблицы |
152
- | noHeaderCellBorderOffset | `boolean` | - | Отключить смещение бордера слева у ячейки хедера |
153
- | cellClassName | `string` | - | CSS-класс для ячейки в теле таблицы |
154
- | headerClassName | `string` | - | CSS-класс для ячейки в теле таблицы |
155
- | pinned | enum ColumnPinPosition: `"left"`, `"right"` | - | Закрепление колонки слева/справа в таблице |
156
- | columns | `ColumnDef<TData, any>[]` | - | |
157
- | columnSettings | `{ label?: string; mode?: ColumnSettingsMode; }` | - | |
130
+ `isColumnEnabledInitially`
131
+
132
+ Проверка на то, должна ли колонка быть включена по умолчанию
158
133
  ## isColumnVisibilityConfigurable
159
- ### Props
160
- | name | type | default value | description |
161
- |------|------|---------------|-------------|
162
- | accessorFn* | `AccessorFn<TData, unknown>` | - | |
163
- | accessorKey* | `string \| number \| symbol \| (string & {})` | - | |
164
- | getUniqueValues | `AccessorFn<TData, unknown[]>` | - | |
165
- | cell | `ColumnDefTemplate<CellContext<TData, unknown>>` | - | |
166
- | meta | `ColumnMeta<TData, unknown> & { skipOnExport?: boolean; }` | - | Пропуск в экспорте |
167
- | enableSorting | `boolean` | - | Enables/Disables sorting for this column. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
168
- | invertSorting | `boolean` | - | Inverts the order of the sorting for this column. This is useful for values that have an inverted best/worst scale where lower numbers are better, eg. a ranking (1st, 2nd, 3rd) or golf-like scoring @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#invertsorting) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
169
- | sortDescFirst | `boolean` | - | Set to `true` for sorting toggles on this column to start in the descending direction. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
170
- | sortingFn | `SortingFnOption<TData>` | - | The sorting function to use with this column. - A `string` referencing a built-in sorting function - A custom sorting function @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortingfn) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
171
- | sortUndefined | `false \| 1 \| -1` | - | - `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies) - `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list) - `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list) |
172
- | aggregatedCell | `ColumnDefTemplate<CellContext<TData, unknown>>` | - | The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used). @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregatedcell) @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) |
173
- | aggregationFn | `AggregationFnOption<TData>` | - | The resolved aggregation function for the column. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregationfn) @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) |
174
- | getGroupingValue | `(row: TData) => any` | - | Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from `accessorKey` / `accessorFn` will be used instead. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue) @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) |
175
- | enableResizing | `boolean` | - | Enables or disables column resizing for the column. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enableresizing) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
176
- | maxSize | `number` | - | The maximum allowed size for the column @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#maxsize) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
177
- | minSize | `number` | - | The minimum allowed size for the column @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#minsize) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
178
- | size | `number` | - | The desired size for the column Размер ячейки @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#size) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
179
- | header | `string \| (string & ReactElement<any, string \| JSXElementConstructor<any>>) \| (string & Iterable<ReactNode>) \| ... 9 more ... \| (((props: HeaderContext<...>) => any) & ((ctx: HeaderContext<...>) => ReactNode))` | - | Заголовок колонки |
180
- | id | `string` | - | |
181
- | headerAlign | enum ColumnAlign: `"left"`, `"right"` | - | Позиционирование заголовка колонки |
182
- | align | enum ColumnAlign: `"left"`, `"right"` | - | Позиционирование контента ячейки в теле таблицы |
183
- | noBodyCellPadding | `boolean` | - | Отключить паддинг у ячейки в теле таблицы |
184
- | noHeaderCellPadding | `boolean` | - | Отключить паддинг у ячейки в шапке таблицы |
185
- | noHeaderCellBorderOffset | `boolean` | - | Отключить смещение бордера слева у ячейки хедера |
186
- | cellClassName | `string` | - | CSS-класс для ячейки в теле таблицы |
187
- | headerClassName | `string` | - | CSS-класс для ячейки в теле таблицы |
188
- | pinned | enum ColumnPinPosition: `"left"`, `"right"` | - | Закрепление колонки слева/справа в таблице |
189
- | columns | `ColumnDef<TData, any>[]` | - | |
190
- | columnSettings | `{ label?: string; mode?: ColumnSettingsMode; }` | - | |
134
+ `isColumnVisibilityConfigurable`
135
+
136
+ Проверка на то, должна ли колонка отображаться в настройках колонок
191
137
  ## isFilterableColumn
192
- ### Props
193
- | name | type | default value | description |
194
- |------|------|---------------|-------------|
195
- | accessorFn* | `AccessorFn<TData, unknown>` | - | |
196
- | accessorKey* | `string \| number \| symbol \| (string & {})` | - | |
197
- | getUniqueValues | `AccessorFn<TData, unknown[]>` | - | |
198
- | cell | `ColumnDefTemplate<CellContext<TData, unknown>>` | - | |
199
- | meta | `ColumnMeta<TData, unknown> & { skipOnExport?: boolean; }` | - | Пропуск в экспорте |
200
- | enableSorting | `boolean` | - | Enables/Disables sorting for this column. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
201
- | invertSorting | `boolean` | - | Inverts the order of the sorting for this column. This is useful for values that have an inverted best/worst scale where lower numbers are better, eg. a ranking (1st, 2nd, 3rd) or golf-like scoring @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#invertsorting) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
202
- | sortDescFirst | `boolean` | - | Set to `true` for sorting toggles on this column to start in the descending direction. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
203
- | sortingFn | `SortingFnOption<TData>` | - | The sorting function to use with this column. - A `string` referencing a built-in sorting function - A custom sorting function @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortingfn) @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) |
204
- | sortUndefined | `false \| 1 \| -1` | - | - `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies) - `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list) - `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list) |
205
- | aggregatedCell | `ColumnDefTemplate<CellContext<TData, unknown>>` | - | The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used). @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregatedcell) @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) |
206
- | aggregationFn | `AggregationFnOption<TData>` | - | The resolved aggregation function for the column. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregationfn) @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) |
207
- | getGroupingValue | `(row: TData) => any` | - | Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from `accessorKey` / `accessorFn` will be used instead. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue) @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) |
208
- | enableResizing | `boolean` | - | Enables or disables column resizing for the column. @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enableresizing) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
209
- | maxSize | `number` | - | The maximum allowed size for the column @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#maxsize) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
210
- | minSize | `number` | - | The minimum allowed size for the column @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#minsize) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
211
- | size | `number` | - | The desired size for the column Размер ячейки @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#size) @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) |
212
- | header | `string \| (string & ReactElement<any, string \| JSXElementConstructor<any>>) \| (string & Iterable<ReactNode>) \| ... 9 more ... \| (((props: HeaderContext<...>) => any) & ((ctx: HeaderContext<...>) => ReactNode))` | - | Заголовок колонки |
213
- | id | `string` | - | |
214
- | headerAlign | enum ColumnAlign: `"left"`, `"right"` | - | Позиционирование заголовка колонки |
215
- | align | enum ColumnAlign: `"left"`, `"right"` | - | Позиционирование контента ячейки в теле таблицы |
216
- | noBodyCellPadding | `boolean` | - | Отключить паддинг у ячейки в теле таблицы |
217
- | noHeaderCellPadding | `boolean` | - | Отключить паддинг у ячейки в шапке таблицы |
218
- | noHeaderCellBorderOffset | `boolean` | - | Отключить смещение бордера слева у ячейки хедера |
219
- | cellClassName | `string` | - | CSS-класс для ячейки в теле таблицы |
220
- | headerClassName | `string` | - | CSS-класс для ячейки в теле таблицы |
221
- | pinned | enum ColumnPinPosition: `"left"`, `"right"` | - | Закрепление колонки слева/справа в таблице |
222
- | columns | `ColumnDef<TData, any>[]` | - | |
223
- | columnSettings | `{ label?: string; mode?: ColumnSettingsMode; }` | - | |
138
+ `isFilterableColumn`
139
+
140
+ Проверка на то, должна ли колонка отображаться в таблице
224
141
  ## prepareColumnsSettings
225
- ### Props
226
- | name | type | default value | description |
227
- |------|------|---------------|-------------|
228
- | t* | `GetLocaleText<Dictionary, "Table">` | - | |
229
- | areAllColumnsEnabled* | `boolean` | - | |
230
- | columnOrder* | `string[]` | - | |
231
- | pinnedGroups* | `PinnedGroupsState<TData>` | - | |
142
+ `prepareColumnsSettings`
143
+
144
+ Отвечает за создание списка колонок в настройках с учётом порядка и всех групп
232
145
  ## usePageReset
233
146
  ### Props
234
147
  | name | type | default value | description |
@@ -239,66 +152,19 @@ const columnDefinitions: ColumnDefinition<TableData>[] = [
239
152
  | maximumAvailablePage* | `number` | - | |
240
153
  | manualPagination* | `boolean` | - | |
241
154
  ## getPinnedGroups
242
- ### Props
243
- | name | type | default value | description |
244
- |------|------|---------------|-------------|
245
- | __@unscopables@2312* | `{ [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; ... 29 more ...; readonly [Symbol.unscopables]?: boolean; }` | - | Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement. |
246
- | __@iterator@1606* | `() => ArrayIterator<ColumnDefinition<TData>>` | - | Iterator |
247
- | with* | `(index: number, value: ColumnDefinition<TData>) => ColumnDefinition<TData>[]` | - | Copies an array, then overwrites the value at the provided index with the given value. If the index is negative, then it replaces from the end of the array. @param index The index of the value to overwrite. If the index is negative, then it replaces from the end of the array. @param value The value to write into the copied array. @returns The copied array with the updated value. |
248
- | toSpliced* | `{ (start: number, deleteCount: number, ...items: ColumnDefinition<TData>[]): ColumnDefinition<TData>[]; (start: number, deleteCount?: number): ColumnDefinition<...>[]; }` | - | Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array. Copies an array and removes elements while returning the remaining elements. @param start The zero-based location in the array from which to start removing elements. @param deleteCount The number of elements to remove. @param items Elements to insert into the copied array in place of the deleted elements. @returns The copied array. @param start The zero-based location in the array from which to start removing elements. @param deleteCount The number of elements to remove. @returns A copy of the original array with the remaining elements. |
249
- | toSorted* | `(compareFn?: (a: ColumnDefinition<TData>, b: ColumnDefinition<TData>) => number) => ColumnDefinition<TData>[]` | - | Returns a copy of an array with its elements sorted. @param compareFn Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order. ```ts [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22] ``` |
250
- | toReversed* | `() => ColumnDefinition<TData>[]` | - | Returns a copy of an array with its elements reversed. |
251
- | findLastIndex* | `(predicate: (value: ColumnDefinition<TData>, index: number, array: ColumnDefinition<TData>[]) => unknown, thisArg?: any) => number` | - | Returns the index of the last element in the array where predicate is true, and -1 otherwise. @param predicate findLastIndex calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. @param thisArg If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. |
252
- | findLast* | `{ <S extends ColumnDefinition<TData>>(predicate: (value: ColumnDefinition<TData>, index: number, array: ColumnDefinition<TData>[]) => value is S, thisArg?: any): S; (predicate: (value: ColumnDefinition<...>, index: number, array: ColumnDefinition<...>[]) => unknown, thisArg?: any): ColumnDefinition<...>; }` | - | Returns the value of the last element in the array where predicate is true, and undefined otherwise. @param predicate findLast calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLast immediately returns that element value. Otherwise, findLast returns undefined. @param thisArg If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. |
253
- | at* | `(index: number) => ColumnDefinition<TData>` | - | Returns the item located at the specified index. @param index The zero-based index of the desired code unit. A negative index will count back from the last item. |
254
- | flat* | `<A, D extends number = 1>(this: A, depth?: D) => FlatArray<A, D>[]` | - | Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth. @param depth The maximum recursion depth |
255
- | flatMap* | `<U, This = undefined>(callback: (this: This, value: ColumnDefinition<TData>, index: number, array: ColumnDefinition<TData>[]) => U \| readonly U[], thisArg?: This) => U[]` | - | Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1. @param callback A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array. @param thisArg An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value. |
256
- | includes* | `(searchElement: ColumnDefinition<TData>, fromIndex?: number) => boolean` | - | Determines whether an array includes a certain element, returning true or false as appropriate. @param searchElement The element to search for. @param fromIndex The position in this array at which to begin searching for searchElement. |
257
- | values* | `() => ArrayIterator<ColumnDefinition<TData>>` | - | Returns an iterable of values in the array |
258
- | keys* | `() => ArrayIterator<number>` | - | Returns an iterable of keys in the array |
259
- | entries* | `() => ArrayIterator<[number, ColumnDefinition<TData>]>` | - | Returns an iterable of key, value pairs for every entry in the array |
260
- | copyWithin* | `(target: number, start: number, end?: number) => ColumnDefinition<TData>[]` | - | Returns the this object after copying a section of the array identified by start and end to the same array starting at position target @param target If target is negative, it is treated as length+target where length is the length of the array. @param start If start is negative, it is treated as length+start. If end is negative, it is treated as length+end. @param end If not specified, length of the this object is used as its default value. |
261
- | fill* | `(value: ColumnDefinition<TData>, start?: number, end?: number) => ColumnDefinition<TData>[]` | - | Changes all array elements from `start` to `end` index to a static `value` and returns the modified array @param value value to fill array section with @param start index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array. @param end index to stop filling the array at. If end is negative, it is treated as length+end. |
262
- | findIndex* | `(predicate: (value: ColumnDefinition<TData>, index: number, obj: ColumnDefinition<TData>[]) => unknown, thisArg?: any) => number` | - | Returns the index of the first element in the array where predicate is true, and -1 otherwise. @param predicate find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1. @param thisArg If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. |
263
- | find* | `{ <S extends ColumnDefinition<TData>>(predicate: (value: ColumnDefinition<TData>, index: number, obj: ColumnDefinition<TData>[]) => value is S, thisArg?: any): S; (predicate: (value: ColumnDefinition<...>, index: number, obj: ColumnDefinition<...>[]) => unknown, thisArg?: any): ColumnDefinition<...>; }` | - | Returns the value of the first element in the array where predicate is true, and undefined otherwise. @param predicate find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined. @param thisArg If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. |
264
- | reduceRight* | `{ (callbackfn: (previousValue: ColumnDefinition<TData>, currentValue: ColumnDefinition<TData>, currentIndex: number, array: ColumnDefinition<TData>[]) => ColumnDefinition<...>): ColumnDefinition<...>; (callbackfn: (previousValue: ColumnDefinition<...>, currentValue: ColumnDefinition<...>, currentIndex: number, array...` | - | Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. |
265
- | reduce* | `{ (callbackfn: (previousValue: ColumnDefinition<TData>, currentValue: ColumnDefinition<TData>, currentIndex: number, array: ColumnDefinition<TData>[]) => ColumnDefinition<...>): ColumnDefinition<...>; (callbackfn: (previousValue: ColumnDefinition<...>, currentValue: ColumnDefinition<...>, currentIndex: number, array...` | - | Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. |
266
- | filter* | `{ <S extends ColumnDefinition<TData>>(predicate: (value: ColumnDefinition<TData>, index: number, array: ColumnDefinition<TData>[]) => value is S, thisArg?: any): S[]; (predicate: (value: ColumnDefinition<...>, index: number, array: ColumnDefinition<...>[]) => unknown, thisArg?: any): ColumnDefinition<...>[]; }` | - | Returns the elements of an array that meet the condition specified in a callback function. @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. |
267
- | map* | `<U>(callbackfn: (value: ColumnDefinition<TData>, index: number, array: ColumnDefinition<TData>[]) => U, thisArg?: any) => U[]` | - | Calls a defined callback function on each element of an array, and returns an array that contains the results. @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. |
268
- | forEach* | `(callbackfn: (value: ColumnDefinition<TData>, index: number, array: ColumnDefinition<TData>[]) => void, thisArg?: any) => void` | - | Performs the specified action for each element in an array. @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. |
269
- | some* | `(predicate: (value: ColumnDefinition<TData>, index: number, array: ColumnDefinition<TData>[]) => unknown, thisArg?: any) => boolean` | - | Determines whether the specified callback function returns true for any element of an array. @param predicate A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array. @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. |
270
- | every* | `{ <S extends ColumnDefinition<TData>>(predicate: (value: ColumnDefinition<TData>, index: number, array: ColumnDefinition<TData>[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: ColumnDefinition<...>, index: number, array: ColumnDefinition<...>[]) => unknown, thisArg?: any): boolean; }` | - | Determines whether all the members of an array satisfy the specified test. @param predicate A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array. @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. @param predicate A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array. @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. |
271
- | lastIndexOf* | `(searchElement: ColumnDefinition<TData>, fromIndex?: number) => number` | - | Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. @param searchElement The value to locate in the array. @param fromIndex The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. |
272
- | indexOf* | `(searchElement: ColumnDefinition<TData>, fromIndex?: number) => number` | - | Returns the index of the first occurrence of a value in an array, or -1 if it is not present. @param searchElement The value to locate in the array. @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. |
273
- | unshift* | `(...items: ColumnDefinition<TData>[]) => number` | - | Inserts new elements at the start of an array, and returns the new length of the array. @param items Elements to insert at the start of the array. |
274
- | splice* | `{ (start: number, deleteCount?: number): ColumnDefinition<TData>[]; (start: number, deleteCount: number, ...items: ColumnDefinition<TData>[]): ColumnDefinition<...>[]; }` | - | Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. @param start The zero-based location in the array from which to start removing elements. @param deleteCount The number of elements to remove. Omitting this argument will remove all elements from the start paramater location to end of the array. If value of this argument is either a negative number, zero, undefined, or a type that cannot be converted to an integer, the function will evaluate the argument as zero and not remove any elements. @returns An array containing the elements that were deleted. @param start The zero-based location in the array from which to start removing elements. @param deleteCount The number of elements to remove. If value of this argument is either a negative number, zero, undefined, or a type that cannot be converted to an integer, the function will evaluate the argument as zero and not remove any elements. @param items Elements to insert into the array in place of the deleted elements. @returns An array containing the elements that were deleted. |
275
- | sort* | `(compareFn?: (a: ColumnDefinition<TData>, b: ColumnDefinition<TData>) => number) => ColumnDefinition<TData>[]` | - | Sorts an array in place. This method mutates the array and returns a reference to the same array. @param compareFn Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order. ```ts [11,2,22,1].sort((a, b) => a - b) ``` |
276
- | slice* | `(start?: number, end?: number) => ColumnDefinition<TData>[]` | - | Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array. @param start The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0. @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array. |
277
- | shift* | `() => ColumnDefinition<TData>` | - | Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified. |
278
- | reverse* | `() => ColumnDefinition<TData>[]` | - | Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array. |
279
- | join* | `(separator?: string) => string` | - | Adds all the elements of an array into a string, separated by the specified separator string. @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. |
280
- | concat* | `{ (...items: ConcatArray<ColumnDefinition<TData>>[]): ColumnDefinition<TData>[]; (...items: (ColumnDefinition<TData> \| ConcatArray<...>)[]): ColumnDefinition<...>[]; }` | - | Combines two or more arrays. This method returns a new array without modifying any existing arrays. @param items Additional arrays and/or items to add to the end of the array. @param items Additional arrays and/or items to add to the end of the array. |
281
- | push* | `(...items: ColumnDefinition<TData>[]) => number` | - | Appends new elements to the end of an array, and returns the new length of the array. @param items New elements to add to the array. |
282
- | pop* | `() => ColumnDefinition<TData>` | - | Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified. |
283
- | length* | `number` | - | Gets or sets the length of the array. This is a number one higher than the highest index in the array. |
284
- | toString | `() => string` | function toString() { [native code] } | Returns a string representation of an array. |
285
- | toLocaleString | `{ (): string; (locales: string \| string[], options?: NumberFormatOptions & DateTimeFormatOptions): string; }` | function toLocaleString() { [native code] } | Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. |
155
+ `getPinnedGroups`
156
+
157
+ Отвечает за распределение columnDefinitions по возможным pinned группам. Возвращает PinnedGroupsState
286
158
  ## getTableColumnsDefinitions
287
- ### Props
288
- | name | type | default value | description |
289
- |------|------|---------------|-------------|
290
- | expanding* | `{ getSubRows: (element: TData) => TData[]; expandingColumnDefinition: TreeColumnDefinitionProps<TData>; state?: ExpandedState; onChange?(state: ExpandedState): void; }` | - | |
291
- | enableSelectPinned* | `boolean` | - | |
292
- | enableSelection* | `boolean` | - | |
293
- | columnDefinitions* | `ColumnDefinition<TData>[]` | - | |
294
- | rowSelectionAppearance | enum RowAppearance: `"disabled"`, `"hide-toggler"` | RowAppearance.Disabled | |
159
+ `getTableColumnsDefinitions`
160
+
161
+ Получение фактического списка columnDefinitions с учётом всевозможных настроек
295
162
  ## formatTableStateToRequestPayload
296
163
  Вспомогательная функция для преобразования состояния таблицы к формату RequestPayloadParams
297
164
  ### Props
298
165
  | name | type | default value | description |
299
166
  |------|------|---------------|-------------|
300
167
  | filter | `FiltersState` | - | |
301
- | ordering | `FieldSort[]` | - | |
302
168
  | search | `string` | - | |
303
169
  | pagination | `PaginationState \| PaginationParams` | - | |
304
170
  | sorting | `SortingState` | - | |
@@ -1,2 +1,6 @@
1
1
  import { ColumnDefinition } from '../../../../../types';
2
+ /**
3
+ * Проверка на то, должна ли колонка быть включена по умолчанию
4
+ * @function isColumnEnabledInitially
5
+ */
2
6
  export declare function isColumnEnabledInitially<TData extends object>(colDef: ColumnDefinition<TData>): boolean;
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isColumnEnabledInitially = isColumnEnabledInitially;
7
+ /**
8
+ * Проверка на то, должна ли колонка быть включена по умолчанию
9
+ * @function isColumnEnabledInitially
10
+ */
7
11
  function isColumnEnabledInitially(colDef) {
8
12
  var _a;
9
13
  if ('columnSettings' in colDef && colDef.columnSettings !== undefined) {
@@ -1,2 +1,6 @@
1
1
  import { ColumnDefinition } from '../../../../../types';
2
+ /**
3
+ * Проверка на то, должна ли колонка отображаться в настройках колонок
4
+ * @function isColumnVisibilityConfigurable
5
+ */
2
6
  export declare function isColumnVisibilityConfigurable<TData extends object>(colDef: ColumnDefinition<TData>): boolean;
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isColumnVisibilityConfigurable = isColumnVisibilityConfigurable;
7
+ /**
8
+ * Проверка на то, должна ли колонка отображаться в настройках колонок
9
+ * @function isColumnVisibilityConfigurable
10
+ */
7
11
  function isColumnVisibilityConfigurable(colDef) {
8
12
  if ('columnSettings' in colDef && colDef.columnSettings !== undefined) {
9
13
  const {
@@ -1,2 +1,6 @@
1
1
  import { ColumnDefinition, FilterableColumnDefinition } from '../../../../../types';
2
+ /**
3
+ * Проверка на то, должна ли колонка отображаться в таблице
4
+ * @function isFilterableColumn
5
+ */
2
6
  export declare function isFilterableColumn<TData extends object>(colDef: ColumnDefinition<TData>): colDef is FilterableColumnDefinition<TData>;
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isFilterableColumn = isFilterableColumn;
7
+ /**
8
+ * Проверка на то, должна ли колонка отображаться в таблице
9
+ * @function isFilterableColumn
10
+ */
7
11
  function isFilterableColumn(colDef) {
8
12
  var _a;
9
13
  return ('id' in colDef || 'accessorKey' in colDef) && 'columnSettings' in colDef && ((_a = colDef.columnSettings) === null || _a === void 0 ? void 0 : _a.mode) !== 'hidden';
@@ -7,5 +7,9 @@ type PrepareColumnsSettingsProps<TData extends object> = {
7
7
  areAllColumnsEnabled: boolean;
8
8
  t: ReturnType<typeof useLocale<'Table'>>['t'];
9
9
  };
10
+ /**
11
+ * Отвечает за создание списка колонок в настройках с учётом порядка и всех групп
12
+ * @function prepareColumnsSettings
13
+ */
10
14
  export declare function prepareColumnsSettings<TData extends object>({ pinnedGroups, columnOrder, areAllColumnsEnabled, t, }: PrepareColumnsSettingsProps<TData>): [GroupSelectItemProps];
11
15
  export {};
@@ -20,6 +20,10 @@ function createColumnsSettingsOption(columnDefinition) {
20
20
  function createGroupOptions(group, columnOrder) {
21
21
  return group.filter(isFilterableColumn_1.isFilterableColumn).sort((0, utils_1.sortColumnDefinitions)(columnOrder)).map(createColumnsSettingsOption);
22
22
  }
23
+ /**
24
+ * Отвечает за создание списка колонок в настройках с учётом порядка и всех групп
25
+ * @function prepareColumnsSettings
26
+ */
23
27
  function prepareColumnsSettings(_ref) {
24
28
  let {
25
29
  pinnedGroups,
@@ -4,4 +4,8 @@ export type PinnedGroupsState<TData extends object> = {
4
4
  right: ColumnDefinition<TData>[];
5
5
  unpinned: ColumnDefinition<TData>[];
6
6
  };
7
+ /**
8
+ * Отвечает за распределение columnDefinitions по возможным pinned группам. Возвращает PinnedGroupsState
9
+ * @function getPinnedGroups
10
+ */
7
11
  export declare function getPinnedGroups<TData extends object>(columnDefinitions: ColumnDefinition<TData>[]): PinnedGroupsState<TData>;
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getPinnedGroups = getPinnedGroups;
7
+ /**
8
+ * Отвечает за распределение columnDefinitions по возможным pinned группам. Возвращает PinnedGroupsState
9
+ * @function getPinnedGroups
10
+ */
7
11
  function getPinnedGroups(columnDefinitions) {
8
12
  return columnDefinitions.reduce((accPinnedState, colDef) => {
9
13
  switch (colDef.pinned) {
@@ -7,5 +7,9 @@ type GetTableColumnsDefinitionsProps<TData extends object> = {
7
7
  expanding: TableProps<TData>['expanding'];
8
8
  rowSelectionAppearance?: RowAppearance;
9
9
  };
10
+ /**
11
+ * Получение фактического списка columnDefinitions с учётом всевозможных настроек
12
+ * @function getTableColumnsDefinitions
13
+ */
10
14
  export declare function getTableColumnsDefinitions<TData extends object>({ columnDefinitions, enableSelection, enableSelectPinned, expanding, rowSelectionAppearance, }: GetTableColumnsDefinitionsProps<TData>): ColumnDefinition<TData>[];
11
15
  export {};
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getTableColumnsDefinitions = getTableColumnsDefinitions;
7
7
  const helperComponents_1 = require("../../../helperComponents");
8
8
  const types_1 = require("../../types");
9
+ /**
10
+ * Получение фактического списка columnDefinitions с учётом всевозможных настроек
11
+ * @function getTableColumnsDefinitions
12
+ */
9
13
  function getTableColumnsDefinitions(_ref) {
10
14
  let {
11
15
  columnDefinitions,
@@ -1,2 +1,6 @@
1
1
  import { ColumnDefinition } from '../../../../../types';
2
+ /**
3
+ * Проверка на то, должна ли колонка быть включена по умолчанию
4
+ * @function isColumnEnabledInitially
5
+ */
2
6
  export declare function isColumnEnabledInitially<TData extends object>(colDef: ColumnDefinition<TData>): boolean;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Проверка на то, должна ли колонка быть включена по умолчанию
3
+ * @function isColumnEnabledInitially
4
+ */
1
5
  export function isColumnEnabledInitially(colDef) {
2
6
  var _a;
3
7
  if ('columnSettings' in colDef && colDef.columnSettings !== undefined) {
@@ -1,2 +1,6 @@
1
1
  import { ColumnDefinition } from '../../../../../types';
2
+ /**
3
+ * Проверка на то, должна ли колонка отображаться в настройках колонок
4
+ * @function isColumnVisibilityConfigurable
5
+ */
2
6
  export declare function isColumnVisibilityConfigurable<TData extends object>(colDef: ColumnDefinition<TData>): boolean;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Проверка на то, должна ли колонка отображаться в настройках колонок
3
+ * @function isColumnVisibilityConfigurable
4
+ */
1
5
  export function isColumnVisibilityConfigurable(colDef) {
2
6
  if ('columnSettings' in colDef && colDef.columnSettings !== undefined) {
3
7
  const { mode } = colDef.columnSettings;
@@ -1,2 +1,6 @@
1
1
  import { ColumnDefinition, FilterableColumnDefinition } from '../../../../../types';
2
+ /**
3
+ * Проверка на то, должна ли колонка отображаться в таблице
4
+ * @function isFilterableColumn
5
+ */
2
6
  export declare function isFilterableColumn<TData extends object>(colDef: ColumnDefinition<TData>): colDef is FilterableColumnDefinition<TData>;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Проверка на то, должна ли колонка отображаться в таблице
3
+ * @function isFilterableColumn
4
+ */
1
5
  export function isFilterableColumn(colDef) {
2
6
  var _a;
3
7
  return (('id' in colDef || 'accessorKey' in colDef) &&
@@ -7,5 +7,9 @@ type PrepareColumnsSettingsProps<TData extends object> = {
7
7
  areAllColumnsEnabled: boolean;
8
8
  t: ReturnType<typeof useLocale<'Table'>>['t'];
9
9
  };
10
+ /**
11
+ * Отвечает за создание списка колонок в настройках с учётом порядка и всех групп
12
+ * @function prepareColumnsSettings
13
+ */
10
14
  export declare function prepareColumnsSettings<TData extends object>({ pinnedGroups, columnOrder, areAllColumnsEnabled, t, }: PrepareColumnsSettingsProps<TData>): [GroupSelectItemProps];
11
15
  export {};
@@ -14,6 +14,10 @@ function createColumnsSettingsOption(columnDefinition) {
14
14
  function createGroupOptions(group, columnOrder) {
15
15
  return group.filter(isFilterableColumn).sort(sortColumnDefinitions(columnOrder)).map(createColumnsSettingsOption);
16
16
  }
17
+ /**
18
+ * Отвечает за создание списка колонок в настройках с учётом порядка и всех групп
19
+ * @function prepareColumnsSettings
20
+ */
17
21
  export function prepareColumnsSettings({ pinnedGroups, columnOrder, areAllColumnsEnabled, t, }) {
18
22
  return [
19
23
  {
@@ -4,4 +4,8 @@ export type PinnedGroupsState<TData extends object> = {
4
4
  right: ColumnDefinition<TData>[];
5
5
  unpinned: ColumnDefinition<TData>[];
6
6
  };
7
+ /**
8
+ * Отвечает за распределение columnDefinitions по возможным pinned группам. Возвращает PinnedGroupsState
9
+ * @function getPinnedGroups
10
+ */
7
11
  export declare function getPinnedGroups<TData extends object>(columnDefinitions: ColumnDefinition<TData>[]): PinnedGroupsState<TData>;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Отвечает за распределение columnDefinitions по возможным pinned группам. Возвращает PinnedGroupsState
3
+ * @function getPinnedGroups
4
+ */
1
5
  export function getPinnedGroups(columnDefinitions) {
2
6
  return columnDefinitions.reduce((accPinnedState, colDef) => {
3
7
  switch (colDef.pinned) {
@@ -7,5 +7,9 @@ type GetTableColumnsDefinitionsProps<TData extends object> = {
7
7
  expanding: TableProps<TData>['expanding'];
8
8
  rowSelectionAppearance?: RowAppearance;
9
9
  };
10
+ /**
11
+ * Получение фактического списка columnDefinitions с учётом всевозможных настроек
12
+ * @function getTableColumnsDefinitions
13
+ */
10
14
  export declare function getTableColumnsDefinitions<TData extends object>({ columnDefinitions, enableSelection, enableSelectPinned, expanding, rowSelectionAppearance, }: GetTableColumnsDefinitionsProps<TData>): ColumnDefinition<TData>[];
11
15
  export {};
@@ -1,5 +1,9 @@
1
1
  import { getSelectionCellColumnDef, getTreeColumnDef } from '../../../helperComponents';
2
2
  import { RowAppearance } from '../../types';
3
+ /**
4
+ * Получение фактического списка columnDefinitions с учётом всевозможных настроек
5
+ * @function getTableColumnsDefinitions
6
+ */
3
7
  export function getTableColumnsDefinitions({ columnDefinitions, enableSelection, enableSelectPinned, expanding, rowSelectionAppearance = RowAppearance.Disabled, }) {
4
8
  let cols = columnDefinitions;
5
9
  if (enableSelection && !expanding) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Table",
7
- "version": "0.37.28",
7
+ "version": "0.37.29-preview-9d961963.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -65,5 +65,5 @@
65
65
  "peerDependencies": {
66
66
  "@snack-uikit/locale": "*"
67
67
  },
68
- "gitHead": "77eb300ff87d91df0f3c12a15f89755eec155599"
68
+ "gitHead": "d4e277eb1dd29fd832c47807cb4fd46aeb2def2a"
69
69
  }
@@ -1,5 +1,9 @@
1
1
  import { ColumnDefinition } from '../../../../../types';
2
2
 
3
+ /**
4
+ * Проверка на то, должна ли колонка быть включена по умолчанию
5
+ * @function isColumnEnabledInitially
6
+ */
3
7
  export function isColumnEnabledInitially<TData extends object>(colDef: ColumnDefinition<TData>) {
4
8
  if ('columnSettings' in colDef && colDef.columnSettings !== undefined) {
5
9
  return colDef.columnSettings?.mode !== 'defaultFalse';
@@ -1,5 +1,9 @@
1
1
  import { ColumnDefinition } from '../../../../../types';
2
2
 
3
+ /**
4
+ * Проверка на то, должна ли колонка отображаться в настройках колонок
5
+ * @function isColumnVisibilityConfigurable
6
+ */
3
7
  export function isColumnVisibilityConfigurable<TData extends object>(colDef: ColumnDefinition<TData>): boolean {
4
8
  if ('columnSettings' in colDef && colDef.columnSettings !== undefined) {
5
9
  const { mode } = colDef.columnSettings;
@@ -1,5 +1,8 @@
1
1
  import { ColumnDefinition, FilterableColumnDefinition } from '../../../../../types';
2
-
2
+ /**
3
+ * Проверка на то, должна ли колонка отображаться в таблице
4
+ * @function isFilterableColumn
5
+ */
3
6
  export function isFilterableColumn<TData extends object>(
4
7
  colDef: ColumnDefinition<TData>,
5
8
  ): colDef is FilterableColumnDefinition<TData> {
@@ -30,6 +30,10 @@ type PrepareColumnsSettingsProps<TData extends object> = {
30
30
  t: ReturnType<typeof useLocale<'Table'>>['t'];
31
31
  };
32
32
 
33
+ /**
34
+ * Отвечает за создание списка колонок в настройках с учётом порядка и всех групп
35
+ * @function prepareColumnsSettings
36
+ */
33
37
  export function prepareColumnsSettings<TData extends object>({
34
38
  pinnedGroups,
35
39
  columnOrder,
@@ -6,6 +6,10 @@ export type PinnedGroupsState<TData extends object> = {
6
6
  unpinned: ColumnDefinition<TData>[];
7
7
  };
8
8
 
9
+ /**
10
+ * Отвечает за распределение columnDefinitions по возможным pinned группам. Возвращает PinnedGroupsState
11
+ * @function getPinnedGroups
12
+ */
9
13
  export function getPinnedGroups<TData extends object>(columnDefinitions: ColumnDefinition<TData>[]) {
10
14
  return columnDefinitions.reduce(
11
15
  (accPinnedState: PinnedGroupsState<TData>, colDef: ColumnDefinition<TData>) => {
@@ -10,6 +10,10 @@ type GetTableColumnsDefinitionsProps<TData extends object> = {
10
10
  rowSelectionAppearance?: RowAppearance;
11
11
  };
12
12
 
13
+ /**
14
+ * Получение фактического списка columnDefinitions с учётом всевозможных настроек
15
+ * @function getTableColumnsDefinitions
16
+ */
13
17
  export function getTableColumnsDefinitions<TData extends object>({
14
18
  columnDefinitions,
15
19
  enableSelection,
@@ -3,6 +3,7 @@ import { FunctionSettingsSVG } from '@snack-uikit/icons';
3
3
  import { Droplist, GroupSelectItemProps } from '@snack-uikit/list';
4
4
 
5
5
  import styles from './styles.module.scss';
6
+
6
7
  export type ColumnsSettingsProps = {
7
8
  enabledColumns: string[];
8
9
  setEnabledColumns(enabledColumns: string[]): void;