mimir-ui-kit 1.38.44 → 1.39.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 (51) hide show
  1. package/dist/assets/stories.css +1 -0
  2. package/dist/assets/styles2.css +1 -0
  3. package/dist/combobox-Dv6-ANkb.js +508 -0
  4. package/dist/components/Dropdown/Dropdown.js +1 -1
  5. package/dist/components/MultiSelectSearch/MultiSelectSearch.js +1 -1
  6. package/dist/components/SelectSearch/SelectSearch.js +1 -1
  7. package/dist/components/Table/ColumnOrderSettings.d.ts +18 -0
  8. package/dist/components/Table/ColumnOrderSettings.js +177 -0
  9. package/dist/components/Table/Table.d.ts +3 -0
  10. package/dist/components/Table/Table.js +204 -0
  11. package/dist/components/Table/TableBody.d.ts +5 -0
  12. package/dist/components/Table/TableBody.js +109 -0
  13. package/dist/components/Table/TableCard.d.ts +5 -0
  14. package/dist/components/Table/TableCard.js +45 -0
  15. package/dist/components/Table/TableCardsView.d.ts +5 -0
  16. package/dist/components/Table/TableCardsView.js +84 -0
  17. package/dist/components/Table/TableFilters.d.ts +12 -0
  18. package/dist/components/Table/TableFilters.js +165 -0
  19. package/dist/components/Table/TableHeader.d.ts +3 -0
  20. package/dist/components/Table/TableHeader.js +70 -0
  21. package/dist/components/Table/TableRow.d.ts +5 -0
  22. package/dist/components/Table/TableRow.js +76 -0
  23. package/dist/components/Table/TableScrollButtons.d.ts +11 -0
  24. package/dist/components/Table/TableScrollButtons.js +35 -0
  25. package/dist/components/Table/constants.d.ts +128 -0
  26. package/dist/components/Table/constants.js +434 -0
  27. package/dist/components/Table/hooks/index.d.ts +4 -0
  28. package/dist/components/Table/hooks/index.js +10 -0
  29. package/dist/components/Table/hooks/useTableInstance.d.ts +3 -0
  30. package/dist/components/Table/hooks/useTableInstance.js +68 -0
  31. package/dist/components/Table/hooks/useTableScroll.d.ts +8 -0
  32. package/dist/components/Table/hooks/useTableScroll.js +54 -0
  33. package/dist/components/Table/hooks/useTableState.d.ts +13 -0
  34. package/dist/components/Table/hooks/useTableState.js +56 -0
  35. package/dist/components/Table/hooks/useTableVirtualization.d.ts +13 -0
  36. package/dist/components/Table/hooks/useTableVirtualization.js +97 -0
  37. package/dist/components/Table/index.d.ts +3 -0
  38. package/dist/components/Table/index.js +10 -0
  39. package/dist/components/Table/types.d.ts +150 -0
  40. package/dist/components/Table/utils.d.ts +4 -0
  41. package/dist/components/Table/utils.js +25 -0
  42. package/dist/components/index.d.ts +2 -0
  43. package/dist/components/index.js +72 -64
  44. package/dist/index-CVk4sixt.js +1862 -0
  45. package/dist/index-D5H8gPPn.js +546 -0
  46. package/dist/index.js +106 -98
  47. package/dist/{portal-D3A00sie.js → portal-C_u5auU1.js} +179 -183
  48. package/dist/stories.module-fud786VB.js +29 -0
  49. package/dist/styles.module--QBQYoA9.js +36 -0
  50. package/package.json +3 -1
  51. package/dist/combobox-BD-GHvMy.js +0 -980
@@ -0,0 +1,434 @@
1
+ import { jsxs as d, jsx as a } from "react/jsx-runtime";
2
+ var p = /* @__PURE__ */ ((e) => (e.WhiteHeader = "whiteHeader", e.GrayHeader = "grayHeader", e))(p || {}), b = /* @__PURE__ */ ((e) => (e.TABLE = "table", e.CARDS = "cards", e))(b || {}), m = /* @__PURE__ */ ((e) => (e.ASC = "asc", e.DESC = "desc", e.NONE = "none", e))(m || {});
3
+ const K = {
4
+ DEFAULT_HEIGHT: 500,
5
+ DEFAULT_WIDTH: "100%",
6
+ DEFAULT_ROW_HEIGHT: 60,
7
+ OVERSCAN: 10
8
+ };
9
+ var A = /* @__PURE__ */ ((e) => (e.GRAY = "gray", e.WHITE = "white", e))(A || {}), u = /* @__PURE__ */ ((e) => (e.LEFT = "ArrowLeft16px", e.RIGHT = "ArrowRight16px", e))(u || {}), D = /* @__PURE__ */ ((e) => (e.DATE_RANGE = "date_range", e.SELECT = "select", e))(D || {});
10
+ const l = [
11
+ {
12
+ id: "0",
13
+ name: "Констинтинопольский Константин Константинович",
14
+ passport: "5403 787622",
15
+ bankDetails: "АО «Газэнергобанк», Бик: 042908701, Р/с: 4010183450000000701",
16
+ registrationAddress: "г. Москва, ул. Тверская, д. 15",
17
+ actualAddress: "г. Москва, ул. Тверская, д. 15",
18
+ adNumber: "15664879731",
19
+ responsible: "Хотов Сергей Александрович (г. Москва)",
20
+ birthDate: "29/02/1975",
21
+ agentType: "Физ.лицо",
22
+ status: "Проходит аккредитацию",
23
+ phone: "+7 (890) 866-08-08",
24
+ snils: "888-888-888 88",
25
+ inn: "123456789088",
26
+ terminationDate: "01/12/2023",
27
+ offerDate: "24/11/2000"
28
+ },
29
+ {
30
+ id: "1",
31
+ name: "Иванов Иван Иванович",
32
+ passport: "4512 654321",
33
+ bankDetails: "ПАО «Сбербанк», Бик: 044525225, Р/с: 40817810099910004312",
34
+ registrationAddress: "г. Санкт-Петербург, ул. Невская, д. 7",
35
+ actualAddress: "г. Санкт-Петербург, ул. Невская, д. 7",
36
+ adNumber: "15664879732",
37
+ responsible: "Петров Алексей Сергеевич (г. Санкт-Петербург)",
38
+ birthDate: "15/05/1980",
39
+ agentType: "Физ.лицо",
40
+ status: "Активен",
41
+ phone: "+7 (911) 123-45-67",
42
+ snils: "123-456-789 10",
43
+ inn: "781234567890",
44
+ terminationDate: "15/08/2023",
45
+ offerDate: "10/06/2021"
46
+ },
47
+ {
48
+ id: "2",
49
+ name: "Петрова Анна Александровна",
50
+ passport: "4605 123456",
51
+ bankDetails: "АО «Альфа-Банк», Бик: 044525593, Р/с: 40817810602400000152",
52
+ registrationAddress: "г. Екатеринбург, ул. Ленина, д. 25, кв. 12",
53
+ actualAddress: "г. Москва, ул. Профсоюзная, д. 100, кв. 45",
54
+ adNumber: "15664879733",
55
+ responsible: "Сидоров Дмитрий Иванович (г. Москва)",
56
+ birthDate: "03/11/1985",
57
+ agentType: "Физ.лицо",
58
+ status: "Заблокирован",
59
+ phone: "+7 (922) 987-65-43",
60
+ snils: "321-654-987 01",
61
+ inn: "667123456789",
62
+ terminationDate: "15/06/2023",
63
+ offerDate: "20/03/2022"
64
+ },
65
+ {
66
+ id: "3",
67
+ name: "Викторов Андрей Викторович",
68
+ passport: "4501 876343",
69
+ bankDetails: "АО «Райффайзенбанк», Бик: 044525700, Р/с: 40817810800000123456",
70
+ registrationAddress: "г. Казань, ул. Пушкина, д. 5, кв. 10",
71
+ actualAddress: "г. Казань, ул. Пушкина, д. 5, кв. 10",
72
+ adNumber: "16664879735",
73
+ responsible: "Смирнова Ольга Николаевна (г. Казань)",
74
+ birthDate: "22/07/1978",
75
+ agentType: "Физ.лицо",
76
+ status: "Проходит аккредитацию",
77
+ phone: "+7 (842) 551-44-33",
78
+ snils: "111-122-323 44",
79
+ inn: "162234567895",
80
+ terminationDate: "15/07/2023",
81
+ offerDate: "17/08/2022"
82
+ },
83
+ {
84
+ id: "4",
85
+ name: "Сидоров Алексей Викторович",
86
+ passport: "4509 876543",
87
+ bankDetails: "АО «Райффайзенбанк», Бик: 044525700, Р/с: 40817810800000123456",
88
+ registrationAddress: "г. Казань, ул. Пушкина, д. 5, кв. 10",
89
+ actualAddress: "г. Казань, ул. Пушкина, д. 5, кв. 10",
90
+ adNumber: "15664879735",
91
+ responsible: "Смирнова Ольга Николаевна (г. Казань)",
92
+ birthDate: "22/07/1978",
93
+ agentType: "Физ.лицо",
94
+ status: "Проходит аккредитацию",
95
+ phone: "+7 (843) 555-44-33",
96
+ snils: "111-222-333 44",
97
+ inn: "161234567890",
98
+ terminationDate: "15/09/2023",
99
+ offerDate: "17/08/2022"
100
+ }
101
+ ], f = [
102
+ {
103
+ id: "0",
104
+ name: "Констинтинопольский Константин Константинович",
105
+ passport: "5403 787622",
106
+ bankDetails: "АО «Газэнергобанк», Бик: 042908701, Р/с: 4010183450000000701",
107
+ registrationAddress: "г. Москва, ул. Тверская, д. 15",
108
+ actualAddress: "г. Москва, ул. Тверская, д. 15",
109
+ adNumber: "15664879731"
110
+ },
111
+ {
112
+ id: "1",
113
+ name: "Иванов Иван Иванович",
114
+ passport: "4512 654321",
115
+ bankDetails: "ПАО «Сбербанк», Бик: 044525225, Р/с: 40817810099910004312",
116
+ registrationAddress: "г. Санкт-Петербург, ул. Невская, д. 7",
117
+ actualAddress: "г. Санкт-Петербург, ул. Невская, д. 7",
118
+ adNumber: "15664879732"
119
+ },
120
+ {
121
+ id: "2",
122
+ name: "Петрова Анна Александровна",
123
+ passport: "4605 123456",
124
+ bankDetails: "АО «Альфа-Банк», Бик: 044525593, Р/с: 40817810602400000152",
125
+ registrationAddress: "г. Екатеринбург, ул. Ленина, д. 25, кв. 12",
126
+ actualAddress: "г. Москва, ул. Профсоюзная, д. 100, кв. 45",
127
+ adNumber: "15664879733"
128
+ },
129
+ {
130
+ id: "3",
131
+ name: "Викторов Андрей Викторович",
132
+ passport: "4501 876343",
133
+ bankDetails: "АО «Райффайзенбанк», Бик: 044525700, Р/с: 40817810800000123456",
134
+ registrationAddress: "г. Казань, ул. Пушкина, д. 5, кв. 10",
135
+ actualAddress: "г. Казань, ул. Пушкина, д. 5, кв. 10",
136
+ adNumber: "16664879735"
137
+ },
138
+ {
139
+ id: "4",
140
+ name: "Сидоров Алексей Викторович",
141
+ passport: "4509 876543",
142
+ bankDetails: "АО «Райффайзенбанк», Бик: 044525700, Р/с: 40817810800000123456",
143
+ registrationAddress: "г. Казань, ул. Пушкина, д. 5, кв. 10",
144
+ actualAddress: "г. Казань, ул. Пушкина, д. 5, кв. 10",
145
+ adNumber: "15664879735"
146
+ }
147
+ ], y = (e) => [
148
+ {
149
+ id: "name",
150
+ header: "Агент",
151
+ accessorKey: "name",
152
+ size: e ? 260 : 300,
153
+ enableSorting: !0
154
+ },
155
+ {
156
+ id: "passport",
157
+ header: "Паспорт",
158
+ accessorKey: "passport",
159
+ size: e ? 120 : 168
160
+ },
161
+ {
162
+ id: "bankDetails",
163
+ header: "Банковские реквизиты",
164
+ accessorKey: "bankDetails",
165
+ size: e ? 184 : 253,
166
+ cell: ({ getValue: t }) => {
167
+ const n = t();
168
+ if (typeof n == "string") {
169
+ const s = n.match(/^(.+?),\s*Бик:/i), r = n.match(/Бик:\s*([^,]+)/i), i = n.match(/Р\/с:\s*(.+)$/i), c = s ? s[1] : "", o = r ? r[1] : "", h = i ? i[1] : "";
170
+ return /* @__PURE__ */ d("div", { children: [
171
+ /* @__PURE__ */ a("div", { children: c }),
172
+ /* @__PURE__ */ d("div", { children: [
173
+ /* @__PURE__ */ a("span", { children: "БИК: " }),
174
+ /* @__PURE__ */ a("span", { children: o })
175
+ ] }),
176
+ /* @__PURE__ */ d("div", { children: [
177
+ /* @__PURE__ */ a("span", { children: "Р/с: " }),
178
+ /* @__PURE__ */ a("span", { children: h })
179
+ ] })
180
+ ] });
181
+ }
182
+ return /* @__PURE__ */ a("div", { children: "Неверный формат данных" });
183
+ }
184
+ },
185
+ {
186
+ id: "registrationAddress",
187
+ header: "Адрес регистрации",
188
+ accessorKey: "registrationAddress",
189
+ size: e ? 260 : 300
190
+ },
191
+ {
192
+ id: "actualAddress",
193
+ header: "Фактический адрес",
194
+ accessorKey: "actualAddress",
195
+ size: e ? 260 : 300
196
+ },
197
+ {
198
+ id: "adNumber",
199
+ header: "№ АД",
200
+ accessorKey: "adNumber",
201
+ size: e ? 120 : 150
202
+ }
203
+ ], k = (e) => [
204
+ {
205
+ id: "name",
206
+ header: "Агент",
207
+ accessorKey: "name",
208
+ size: e ? 260 : 300,
209
+ enableSorting: !0
210
+ },
211
+ {
212
+ id: "passport",
213
+ header: "Паспорт",
214
+ accessorKey: "passport",
215
+ size: e ? 120 : 168
216
+ },
217
+ {
218
+ id: "bankDetails",
219
+ header: "Банковские реквизиты",
220
+ accessorKey: "bankDetails",
221
+ size: e ? 184 : 253,
222
+ cell: ({ getValue: t }) => {
223
+ const n = t();
224
+ if (typeof n == "string") {
225
+ const s = n.match(/^(.+?),\s*Бик:/i), r = n.match(/Бик:\s*([^,]+)/i), i = n.match(/Р\/с:\s*(.+)$/i), c = s ? s[1] : "", o = r ? r[1] : "", h = i ? i[1] : "";
226
+ return /* @__PURE__ */ d("div", { children: [
227
+ /* @__PURE__ */ a("div", { children: c }),
228
+ /* @__PURE__ */ d("div", { children: [
229
+ /* @__PURE__ */ a("span", { children: "БИК: " }),
230
+ /* @__PURE__ */ a("span", { children: o })
231
+ ] }),
232
+ /* @__PURE__ */ d("div", { children: [
233
+ /* @__PURE__ */ a("span", { children: "Р/с: " }),
234
+ /* @__PURE__ */ a("span", { children: h })
235
+ ] })
236
+ ] });
237
+ }
238
+ return /* @__PURE__ */ a("div", { children: "Неверный формат данных" });
239
+ }
240
+ },
241
+ {
242
+ id: "registrationAddress",
243
+ header: "Адрес регистрации",
244
+ accessorKey: "registrationAddress",
245
+ size: e ? 260 : 300
246
+ },
247
+ {
248
+ id: "actualAddress",
249
+ header: "Фактический адрес",
250
+ accessorKey: "actualAddress",
251
+ size: e ? 260 : 300
252
+ },
253
+ {
254
+ id: "adNumber",
255
+ header: "№ АД",
256
+ accessorKey: "adNumber",
257
+ size: e ? 120 : 150
258
+ },
259
+ {
260
+ id: "responsible",
261
+ header: "Ответственный",
262
+ accessorKey: "responsible",
263
+ size: e ? 260 : 300
264
+ },
265
+ {
266
+ id: "birthDate",
267
+ header: "Дата рождения",
268
+ accessorKey: "birthDate",
269
+ size: e ? 139 : 194
270
+ },
271
+ {
272
+ id: "agentType",
273
+ header: "Тип агента",
274
+ accessorKey: "agentType",
275
+ size: e ? 111 : 156
276
+ },
277
+ {
278
+ id: "status",
279
+ header: "Статус",
280
+ accessorKey: "status",
281
+ size: e ? 130 : 160
282
+ },
283
+ {
284
+ id: "phone",
285
+ header: "Телефон",
286
+ accessorKey: "phone",
287
+ size: e ? 160 : 200
288
+ },
289
+ {
290
+ id: "snils",
291
+ header: "СНИЛС",
292
+ accessorKey: "snils",
293
+ size: e ? 120 : 160
294
+ },
295
+ {
296
+ id: "inn",
297
+ header: "ИНН",
298
+ accessorKey: "inn",
299
+ size: e ? 120 : 160
300
+ },
301
+ {
302
+ id: "terminationDate",
303
+ header: "Дата расторжения",
304
+ accessorKey: "terminationDate",
305
+ size: e ? 158 : 219
306
+ },
307
+ {
308
+ id: "offerDate",
309
+ header: "Дата оферты",
310
+ accessorKey: "offerDate",
311
+ size: e ? 125 : 174
312
+ }
313
+ ], v = (e, t = !1) => Array(e).fill(null).map((n, s) => {
314
+ const r = l[s % l.length], i = t ? s % 4 + 3 : 1;
315
+ return {
316
+ ...r,
317
+ id: `agent-${s}`,
318
+ name: `${r.name}${t ? ` ${s}` : ` (${s + 1})`}`,
319
+ registrationAddress: t ? Array(i).fill(r.registrationAddress).join(", ") : r.registrationAddress,
320
+ responsible: t ? Array(i).fill(r.responsible).join(" и ") : r.responsible,
321
+ status: s % 3 === 0 ? "Активен" : s % 3 === 1 ? "Проходит аккредитацию" : "Заблокирован",
322
+ adNumber: `${15664879731 + s}`,
323
+ phone: `+7 (${900 + s % 99}) ${s * 11 % 899 + 100}-${s * 13 % 89 + 10}-${s * 17 % 89 + 10}`
324
+ };
325
+ }), z = [
326
+ {
327
+ id: "name",
328
+ header: "Агент",
329
+ accessorKey: "name"
330
+ },
331
+ {
332
+ id: "passport",
333
+ header: "Паспорт",
334
+ accessorKey: "passport"
335
+ },
336
+ {
337
+ id: "bankDetails",
338
+ header: "Банковские реквизиты",
339
+ accessorKey: "bankDetails",
340
+ cell: ({ getValue: e }) => {
341
+ const t = e();
342
+ if (typeof t == "string") {
343
+ const n = t.match(/^(.+?),\s*Бик:/i), s = t.match(/Бик:\s*([^,]+)/i), r = t.match(/Р\/с:\s*(.+)$/i), i = n ? n[1] : "", c = s ? s[1] : "", o = r ? r[1] : "";
344
+ return /* @__PURE__ */ d("div", { children: [
345
+ /* @__PURE__ */ a("div", { children: i }),
346
+ /* @__PURE__ */ d("div", { children: [
347
+ /* @__PURE__ */ a("span", { children: "БИК: " }),
348
+ /* @__PURE__ */ a("span", { children: c })
349
+ ] }),
350
+ /* @__PURE__ */ d("div", { children: [
351
+ /* @__PURE__ */ a("span", { children: "Р/с: " }),
352
+ /* @__PURE__ */ a("span", { children: o })
353
+ ] })
354
+ ] });
355
+ }
356
+ return /* @__PURE__ */ a("div", { children: "Неверный формат данных" });
357
+ }
358
+ },
359
+ {
360
+ id: "registrationAddress",
361
+ header: "Адрес регистрации",
362
+ accessorKey: "registrationAddress"
363
+ },
364
+ {
365
+ id: "actualAddress",
366
+ header: "Фактический адрес",
367
+ accessorKey: "actualAddress"
368
+ },
369
+ {
370
+ id: "adNumber",
371
+ header: "№ АД",
372
+ accessorKey: "adNumber"
373
+ },
374
+ {
375
+ id: "responsible",
376
+ header: "Ответственный",
377
+ accessorKey: "responsible"
378
+ },
379
+ {
380
+ id: "birthDate",
381
+ header: "Дата рождения",
382
+ accessorKey: "birthDate"
383
+ },
384
+ {
385
+ id: "agentType",
386
+ header: "Тип агента",
387
+ accessorKey: "agentType"
388
+ },
389
+ {
390
+ id: "status",
391
+ header: "Статус",
392
+ accessorKey: "status"
393
+ },
394
+ {
395
+ id: "phone",
396
+ header: "Телефон",
397
+ accessorKey: "phone"
398
+ },
399
+ {
400
+ id: "snils",
401
+ header: "СНИЛС",
402
+ accessorKey: "snils"
403
+ },
404
+ {
405
+ id: "inn",
406
+ header: "ИНН",
407
+ accessorKey: "inn"
408
+ },
409
+ {
410
+ id: "terminationDate",
411
+ header: "Дата расторжения",
412
+ accessorKey: "terminationDate"
413
+ },
414
+ {
415
+ id: "offerDate",
416
+ header: "Дата оферты",
417
+ accessorKey: "offerDate"
418
+ }
419
+ ];
420
+ export {
421
+ D as EFilterType,
422
+ m as ESortDirection,
423
+ b as ETableDisplayMode,
424
+ A as ETableScrollButtonVariant,
425
+ u as ETableScrollIconName,
426
+ p as ETableVariant,
427
+ K as TABLE_OPTIONS,
428
+ l as agentsData,
429
+ z as columns,
430
+ v as generateVirtualData,
431
+ k as getAdaptiveColumns,
432
+ y as getAdaptiveColumnsPartial,
433
+ f as partialAgentsData
434
+ };
@@ -0,0 +1,4 @@
1
+ export * from './useTableInstance';
2
+ export * from './useTableScroll';
3
+ export * from './useTableState';
4
+ export * from './useTableVirtualization';
@@ -0,0 +1,10 @@
1
+ import { useTableInstance as r } from "./useTableInstance.js";
2
+ import { useTableScroll as a } from "./useTableScroll.js";
3
+ import { useTableState as s } from "./useTableState.js";
4
+ import { useTableVirtualization as b } from "./useTableVirtualization.js";
5
+ export {
6
+ r as useTableInstance,
7
+ a as useTableScroll,
8
+ s as useTableState,
9
+ b as useTableVirtualization
10
+ };
@@ -0,0 +1,3 @@
1
+ import { TUseTableInstanceProps } from '../types';
2
+
3
+ export declare function useTableInstance<T extends Record<string, unknown>>({ data, columns, isSelectable, sorting, rowSelection, columnOrderToUse, effectiveGlobalFilter, handleSortingChange, handleRowSelectionChange, handleColumnOrderChange, handleGlobalFilterChange, enableGlobalFilter, serverSideSorting, variant, rowClassName, cellClassName, selectCellClassName, visibleColumns, columnsToSearch, selectedRowIds, onSelectedRowsChange }: TUseTableInstanceProps<T>): import('@tanstack/react-table').Table<T>;
@@ -0,0 +1,68 @@
1
+ import { u as A, g as H, a as T, b as j } from "../../../index-CVk4sixt.js";
2
+ import { useMemo as r } from "react";
3
+ import { createColumnFilter as k, globalFilterFn as q } from "../utils.js";
4
+ function J({
5
+ data: u,
6
+ columns: e,
7
+ isSelectable: g,
8
+ sorting: d,
9
+ rowSelection: c,
10
+ columnOrderToUse: s,
11
+ effectiveGlobalFilter: o,
12
+ handleSortingChange: w,
13
+ handleRowSelectionChange: R,
14
+ handleColumnOrderChange: S,
15
+ handleGlobalFilterChange: m,
16
+ enableGlobalFilter: b,
17
+ serverSideSorting: f,
18
+ variant: F,
19
+ rowClassName: M,
20
+ cellClassName: C,
21
+ selectCellClassName: p,
22
+ visibleColumns: n,
23
+ columnsToSearch: l,
24
+ selectedRowIds: h,
25
+ onSelectedRowsChange: z
26
+ }) {
27
+ const y = r(() => n ? e.filter(
28
+ (t) => n[t.id] !== !1
29
+ ) : e, [e, n]), a = r(() => l || e.map((t) => t.id), [l, e]), i = r(() => k(a), [a]), I = r(() => (t) => o ? i(t, o) : !0, [i, o]), O = h || c, x = z || R;
30
+ return A({
31
+ data: u,
32
+ columns: y,
33
+ getCoreRowModel: H(),
34
+ getSortedRowModel: T(),
35
+ getFilteredRowModel: j(),
36
+ state: {
37
+ sorting: d,
38
+ rowSelection: O,
39
+ columnOrder: s,
40
+ globalFilter: o
41
+ },
42
+ onSortingChange: w,
43
+ onRowSelectionChange: x,
44
+ onColumnOrderChange: S,
45
+ onGlobalFilterChange: m,
46
+ enableRowSelection: g,
47
+ enableMultiRowSelection: !0,
48
+ enableSorting: !0,
49
+ enableMultiSort: !1,
50
+ enableGlobalFilter: b,
51
+ filterFns: {
52
+ fuzzy: q()
53
+ },
54
+ globalFilterFn: I,
55
+ manualSorting: f,
56
+ meta: {
57
+ columnSizing: {
58
+ variant: F,
59
+ rowClassName: M,
60
+ cellClassName: C,
61
+ selectCellClassName: p
62
+ }
63
+ }
64
+ });
65
+ }
66
+ export {
67
+ J as useTableInstance
68
+ };
@@ -0,0 +1,8 @@
1
+ export declare function useTableScroll({ autoShowScrollButtons }: {
2
+ autoShowScrollButtons?: boolean;
3
+ }): {
4
+ scrollContainerRef: import('react').RefObject<HTMLDivElement>;
5
+ isOverflowing: boolean;
6
+ handleScrollLeft: () => void;
7
+ handleScrollRight: () => void;
8
+ };
@@ -0,0 +1,54 @@
1
+ import { useRef as l, useState as b, useCallback as s, useEffect as v } from "react";
2
+ const u = 0.75, O = 150;
3
+ function R({
4
+ autoShowScrollButtons: c = !1
5
+ }) {
6
+ const e = l(null), [i, n] = b(!1), t = l(null), f = s(() => {
7
+ if (e.current) {
8
+ const r = e.current.clientWidth * u;
9
+ e.current.scrollBy({
10
+ left: -r,
11
+ behavior: "smooth"
12
+ });
13
+ }
14
+ }, []), a = s(() => {
15
+ if (e.current) {
16
+ const r = e.current.clientWidth * u;
17
+ e.current.scrollBy({
18
+ left: r,
19
+ behavior: "smooth"
20
+ });
21
+ }
22
+ }, []);
23
+ return v(() => {
24
+ if (!c) {
25
+ n(!1);
26
+ return;
27
+ }
28
+ const r = () => {
29
+ if (e.current) {
30
+ const { scrollWidth: d, clientWidth: m } = e.current;
31
+ n(d > m);
32
+ }
33
+ }, h = () => {
34
+ t.current && clearTimeout(t.current), t.current = setTimeout(() => {
35
+ r();
36
+ }, O);
37
+ };
38
+ r();
39
+ const o = new ResizeObserver(() => {
40
+ h();
41
+ });
42
+ return e.current && o.observe(e.current), () => {
43
+ t.current && clearTimeout(t.current), o.disconnect();
44
+ };
45
+ }, [c]), {
46
+ scrollContainerRef: e,
47
+ isOverflowing: i,
48
+ handleScrollLeft: f,
49
+ handleScrollRight: a
50
+ };
51
+ }
52
+ export {
53
+ R as useTableScroll
54
+ };
@@ -0,0 +1,13 @@
1
+ import { RowSelectionState, SortingState, Updater } from '@tanstack/react-table';
2
+ import { TUseTableStateProps } from '../types';
3
+
4
+ export declare function useTableState<T extends Record<string, unknown>>({ initialSorting, initialRowSelection, onSort, onGlobalFilterChange, onColumnOrderChange, serverSideSorting, data, columnOrder }: TUseTableStateProps<T>): {
5
+ sorting: SortingState;
6
+ rowSelection: RowSelectionState;
7
+ internalGlobalFilter: string;
8
+ columnOrderToUse: string[];
9
+ handleSortingChange: (updaterOrValue: Updater<SortingState>) => void;
10
+ handleGlobalFilterChange: (value: string) => void;
11
+ handleRowSelectionChange: (updaterOrValue: Updater<RowSelectionState>) => void;
12
+ handleColumnOrderChange: (updaterOrValue: Updater<string[]>) => void;
13
+ };
@@ -0,0 +1,56 @@
1
+ import { useState as w, useMemo as I, useCallback as c } from "react";
2
+ import { ESortDirection as R } from "../constants.js";
3
+ function j({
4
+ initialSorting: h = [],
5
+ initialRowSelection: m = {},
6
+ onSort: s,
7
+ onGlobalFilterChange: i,
8
+ onColumnOrderChange: o,
9
+ serverSideSorting: b,
10
+ data: e,
11
+ columnOrder: y
12
+ }) {
13
+ const [f, D] = w(h), [S, E] = w(m), [T, g] = w(""), l = I(
14
+ () => y || e.map((t) => t.id),
15
+ [y, e]
16
+ ), k = c(
17
+ (t) => {
18
+ const n = typeof t == "function" ? t(f) : t;
19
+ if (D(n), s && b && n.length > 0) {
20
+ const { id: F, desc: G } = n[0];
21
+ s(F, G ? R.DESC : R.ASC);
22
+ }
23
+ },
24
+ [f, s, b]
25
+ ), p = c(
26
+ (t) => {
27
+ i ? i(t) : g(t);
28
+ },
29
+ [i]
30
+ ), x = c(
31
+ (t) => {
32
+ const n = typeof t == "function" ? t(S) : t;
33
+ E(n);
34
+ },
35
+ [e, S]
36
+ ), A = c(
37
+ (t) => {
38
+ const n = typeof t == "function" ? t(l) : t;
39
+ o == null || o(n);
40
+ },
41
+ [o, l]
42
+ );
43
+ return {
44
+ sorting: f,
45
+ rowSelection: S,
46
+ internalGlobalFilter: T,
47
+ columnOrderToUse: l,
48
+ handleSortingChange: k,
49
+ handleGlobalFilterChange: p,
50
+ handleRowSelectionChange: x,
51
+ handleColumnOrderChange: A
52
+ };
53
+ }
54
+ export {
55
+ j as useTableState
56
+ };
@@ -0,0 +1,13 @@
1
+ import { ColumnDef, Row, RowSelectionState } from '@tanstack/react-table';
2
+ import { RefObject } from 'react';
3
+
4
+ export declare function useTableVirtualization<T extends object>({ rows, virtualized, scrollRef, rowSelection, columns }: {
5
+ rows: Row<T>[];
6
+ virtualized?: boolean;
7
+ scrollRef: RefObject<HTMLDivElement>;
8
+ rowSelection?: RowSelectionState;
9
+ columns?: ColumnDef<T>[];
10
+ }): {
11
+ virtualizer: import('@tanstack/virtual-core').Virtualizer<HTMLElement, Element>;
12
+ rowRefs: import('react').MutableRefObject<Record<string, HTMLElement>>;
13
+ };