@uxf/data-grid 11.0.0-beta.2 → 11.0.0-beta.3

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.
@@ -34,8 +34,15 @@ const use_data_grid_control_1 = require("./use-data-grid-control");
34
34
  const use_data_grid_fetching_1 = require("./use-data-grid-fetching");
35
35
  function Default() {
36
36
  const [noBorder, setNoBorder] = (0, react_1.useState)(false);
37
- const { state, actions } = (0, use_data_grid_control_1.useDataGridControl)({ schema: schema_1.schema });
38
- const { isLoading, error, data, onReload } = (0, use_data_grid_fetching_1.useDataGridFetching)(loader_1.loader, schema_1.schema, "grid-name", state);
37
+ const { state, actions } = (0, use_data_grid_control_1.useDataGridControl)({
38
+ schema: schema_1.schema,
39
+ });
40
+ const { isLoading, error, data, onReload } = (0, use_data_grid_fetching_1.useDataGridFetching)({
41
+ loader: loader_1.loader,
42
+ schema: schema_1.schema,
43
+ gridName: "grid-name",
44
+ state,
45
+ });
39
46
  return (react_1.default.createElement(react_1.default.Fragment, null,
40
47
  react_1.default.createElement(toggle_1.Toggle, { label: "No border", value: noBorder, onChange: (value) => setNoBorder(!!value) }),
41
48
  react_1.default.createElement(data_grid_1.DataGrid, { onReload: onReload, state: state, actions: actions, data: data, isLoading: isLoading, error: error, schema: schema_1.schema, onCsvDownload: console.log, noBorder: noBorder, onRemove: console.log, getOpenUrl: () => "https://www.uxf.cz", getEditUrl: () => "https://www.uxf.cz" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/data-grid",
3
- "version": "11.0.0-beta.2",
3
+ "version": "11.0.0-beta.3",
4
4
  "description": "UXF DataGrid",
5
5
  "homepage": "https://gitlab.com/uxf-npm/data-grid#readme",
6
6
  "main": "index.js",
package/styles.css ADDED
@@ -0,0 +1,596 @@
1
+ @import url("react-data-grid/lib/styles.css");
2
+
3
+ @layer rdg.Root {
4
+ .uxf-data-grid__table {
5
+ --rdg-color-scheme: light;
6
+ --rdg-color: theme("colors.lightHigh");
7
+ --rdg-border-color: theme("colors.lightBorder");
8
+ --rdg-summary-border-color: theme("colors.lightBorder");
9
+ --rdg-background-color: theme("colors.white");
10
+ --rdg-header-background-color: theme("colors.gray.50");
11
+ --rdg-row-hover-background-color: theme("colors.gray.50");
12
+ --rdg-row-selected-background-color: theme("colors.gray.100/.75");
13
+ --rdg-row-selected-hover-background-color: theme("colors.gray.200/.75");
14
+ --rdg-selection-color: theme("colors.lightBorder");
15
+ --rdg-font-size: 14px;
16
+
17
+ :root .dark & {
18
+ --rdg-color-scheme: dark;
19
+ --rdg-color: theme("colors.darkHigh");
20
+ --rdg-border-color: theme("colors.darkBorder");
21
+ --rdg-summary-border-color: theme("colors.darkBorder");
22
+ --rdg-background-color: theme("colors.gray.950");
23
+ --rdg-header-background-color: theme("colors.gray.900");
24
+ --rdg-row-hover-background-color: theme("colors.gray.950");
25
+ --rdg-row-selected-background-color: theme("colors.gray.900/.75");
26
+ --rdg-row-selected-hover-background-color: theme("colors.gray.800/.75");
27
+ --rdg-selection-color: theme("colors.darkBorder");
28
+ --rdg-font-size: 14px;
29
+ }
30
+ }
31
+ }
32
+
33
+ .uxf-data-grid {
34
+ border: 1px solid var(--rdg-border-color);
35
+ border-radius: theme("borderRadius.DEFAULT");
36
+
37
+ &.no-border {
38
+ border-style: none;
39
+ }
40
+
41
+ &__action-cell {
42
+ background-color: var(--rdg-background-color);
43
+ border-inline-start: 1px solid var(--rdg-border-color);
44
+ position: sticky;
45
+ right: 0;
46
+ }
47
+
48
+ &__action-cell-wrapper {
49
+ @apply space-x-2;
50
+
51
+ align-items: center;
52
+ display: flex;
53
+ height: 100%;
54
+ justify-content: center;
55
+ text-align: center;
56
+ width: 100%;
57
+
58
+ .uxf-icon {
59
+ color: theme("colors.lightMedium");
60
+
61
+ :root .dark & {
62
+ color: theme("colors.darkMedium");
63
+ }
64
+ }
65
+ }
66
+
67
+ &__body-cell {
68
+ &--boolean {
69
+ align-items: center;
70
+ display: flex;
71
+ height: 100%;
72
+ width: 100%;
73
+ }
74
+ }
75
+
76
+ &__drawer {
77
+ @apply ease-in-out;
78
+
79
+ background-color: theme("colors.gray.900/.25");
80
+ inset: 0;
81
+ overflow: hidden;
82
+ position: fixed;
83
+ z-index: theme("zIndex.modal");
84
+
85
+ :root .dark & {
86
+ background-color: theme("colors.gray.900/.75");
87
+ }
88
+
89
+ &--open {
90
+ @apply transition-opacity duration-500;
91
+
92
+ opacity: 100;
93
+ transform: translateX(0);
94
+ }
95
+
96
+ &--closed {
97
+ @apply transition-all delay-500;
98
+
99
+ opacity: 0;
100
+ transform: translateX(100%);
101
+ }
102
+
103
+ &-body-wrapper {
104
+ @apply transition-all duration-500 ease-in-out;
105
+
106
+ background-color: theme("colors.white");
107
+ box-shadow: theme("boxShadow.xl");
108
+ height: 100%;
109
+ max-width: theme("maxWidth.sm");
110
+ position: absolute;
111
+ right: 0;
112
+ transform: translateX(100%);
113
+ width: theme("width.11/12");
114
+
115
+ &--open {
116
+ transform: translateX(0);
117
+ }
118
+ }
119
+
120
+ &-body {
121
+ display: flex;
122
+ flex-direction: column;
123
+ height: 100%;
124
+ max-width: theme("maxWidth.sm");
125
+ overflow-y: scroll;
126
+ padding-bottom: theme("spacing.10");
127
+ position: relative;
128
+ width: 100%;
129
+
130
+ :root .dark & {
131
+ background-color: theme("colors.gray.950");
132
+ color: theme("colors.gray.100");
133
+ }
134
+ }
135
+
136
+ &-close-button {
137
+ margin-left: auto;
138
+ margin-right: theme("spacing.4");
139
+ margin-top: theme("spacing.4") !important;
140
+ }
141
+
142
+ &-header {
143
+ font-weight: theme("fontWeight.bold");
144
+ padding: theme("spacing.8") theme("spacing.4") theme("spacing.4");
145
+ }
146
+
147
+ &-content {
148
+ padding: theme("spacing.4");
149
+ }
150
+
151
+ &-backdrop {
152
+ cursor: pointer;
153
+ height: 100%;
154
+ width: 100vw;
155
+ }
156
+ }
157
+
158
+ &__fallback {
159
+ align-items: center;
160
+ color: theme("colors.gray.600"); /* ?? */
161
+ display: flex;
162
+ grid-column: 1/-1;
163
+ justify-content: center;
164
+ text-align: center;
165
+ }
166
+
167
+ &__filter {
168
+ &--interval {
169
+ display: grid;
170
+ gap: theme("spacing.4");
171
+ grid-template-columns: 1fr min-content 1fr;
172
+
173
+ .uxf-data-grid__filter-gap {
174
+ align-items: center;
175
+ display: flex;
176
+ padding-top: theme("spacing.5");
177
+ }
178
+ }
179
+ }
180
+
181
+ &__filters {
182
+ @apply space-y-4;
183
+ }
184
+
185
+ &__filter-list {
186
+ @apply space-x-2;
187
+
188
+ padding: theme("spacing.2");
189
+ }
190
+
191
+ &__footer {
192
+ align-items: center;
193
+ display: flex;
194
+ flex-wrap: wrap;
195
+ gap: theme("spacing.4");
196
+ justify-content: flex-end;
197
+ padding: theme("spacing.2");
198
+
199
+ &.no-border {
200
+ padding-inline: 0;
201
+ }
202
+ }
203
+
204
+ &__linear-progress {
205
+ border-radius: 20px;
206
+ height: 3px;
207
+ left: 0;
208
+ overflow: hidden;
209
+ position: absolute;
210
+ right: 0;
211
+ z-index: 1;
212
+
213
+ &.is-loading::before {
214
+ animation: datagridlineanim 1s linear infinite;
215
+ background-color: theme("colors.dataGridSecondary");
216
+ border-radius: inherit;
217
+ content: "";
218
+ height: 3px;
219
+ left: -50%;
220
+ position: absolute;
221
+ width: 40%;
222
+ }
223
+ }
224
+
225
+ &__linear-progress-wrapper {
226
+ position: relative;
227
+ }
228
+
229
+ &__pagination-counts {
230
+ @apply text-sm;
231
+
232
+ color: theme("colors.lightLow");
233
+ }
234
+
235
+ &__plugin-fulltext {
236
+ color: theme("colors.gray.400");
237
+ margin: theme("spacing.2") 0;
238
+ width: 100%;
239
+
240
+ @screen sm {
241
+ width: auto;
242
+ }
243
+
244
+ .uxf-icon {
245
+ color: theme("colors.lightMedium");
246
+
247
+ :root .dark & {
248
+ color: theme("colors.darkMedium");
249
+ }
250
+ }
251
+ }
252
+
253
+ &__plugin-button {
254
+ flex-shrink: 0;
255
+ margin: theme("spacing.2") 0;
256
+
257
+ .uxf-icon {
258
+ color: theme("colors.lightMedium");
259
+
260
+ :root .dark & {
261
+ color: theme("colors.darkMedium");
262
+ }
263
+ }
264
+ }
265
+
266
+ &__rows-per-page {
267
+ @apply text-sm;
268
+
269
+ align-items: center;
270
+ color: theme("colors.lightLow");
271
+ display: flex;
272
+ flex-wrap: wrap;
273
+ gap: theme("spacing.2");
274
+
275
+ .uxf-select {
276
+ width: theme("width.28");
277
+ }
278
+ }
279
+
280
+ &__select-row-checkbox-wrapper {
281
+ align-items: center;
282
+ color: theme("colors.white");
283
+ display: flex;
284
+ height: 100%;
285
+ justify-content: center;
286
+ width: 100%;
287
+ }
288
+
289
+ &__selected-rows-toolbar-wrapper {
290
+ align-items: center;
291
+ bottom: theme("spacing.8");
292
+ display: flex;
293
+ justify-content: center;
294
+ left: 0;
295
+ position: fixed;
296
+ right: 0;
297
+ }
298
+
299
+ &__selected-rows-toolbar {
300
+ @apply text-sm drop-shadow-xl;
301
+
302
+ align-items: center;
303
+ background-color: theme("colors.dataGridPrimary");
304
+ border: 1px solid theme("colors.lightBorder");
305
+ border-radius: 999px;
306
+ color: theme("colors.white");
307
+ display: flex;
308
+ justify-content: center;
309
+ padding: theme("spacing.2") theme("spacing.6");
310
+
311
+ :root .dark & {
312
+ border-color: theme("colors.darkBorder");
313
+ }
314
+ }
315
+
316
+ &__selected-rows-toolbar-actions {
317
+ @apply space-x-2;
318
+
319
+ padding-left: theme("spacing.4");
320
+ }
321
+
322
+ &__table {
323
+ overflow-y: hidden;
324
+
325
+ &::-webkit-scrollbar {
326
+ height: 8px;
327
+ width: 8px;
328
+ }
329
+
330
+ &::-webkit-scrollbar-track {
331
+ background-color: transparent;
332
+ }
333
+
334
+ &::-webkit-scrollbar-thumb,
335
+ &::-webkit-scrollbar-thumb:hover {
336
+ background-color: theme("colors.lightLow");
337
+ border-radius: 999px;
338
+
339
+ :root .dark & {
340
+ background-color: theme("colors.darkLow");
341
+ }
342
+ }
343
+ }
344
+
345
+ &__toolbar {
346
+ align-items: center;
347
+ border-bottom: 1px solid theme("colors.lightBorder");
348
+ display: flex;
349
+ flex-wrap: wrap;
350
+ gap: theme("spacing.2");
351
+ justify-content: flex-end;
352
+ padding: theme("spacing.2");
353
+
354
+ &.no-border {
355
+ padding-right: 0;
356
+ }
357
+
358
+ :root .dark & {
359
+ border-bottom-color: theme("colors.darkBorder");
360
+ }
361
+
362
+ @screen md {
363
+ padding-block: 0;
364
+ padding-left: 0;
365
+ }
366
+ }
367
+
368
+ &__toolbar-tab {
369
+ @apply text-sm;
370
+
371
+ align-items: center;
372
+ border-bottom: 2px solid transparent;
373
+ color: theme("colors.lightMedium");
374
+ display: inline-flex;
375
+ font-weight: theme("fontWeight.medium");
376
+ padding: theme("spacing.4");
377
+ white-space: nowrap;
378
+
379
+ :root .dark & {
380
+ color: theme("colors.darkMedium");
381
+ }
382
+
383
+ &:hover {
384
+ color: theme("colors.lightHigh");
385
+
386
+ :root .dark & {
387
+ color: theme("colors.darkHigh");
388
+ }
389
+ }
390
+
391
+ &.is-active {
392
+ border-bottom-color: currentcolor;
393
+ color: theme("colors.dataGridPrimary");
394
+ }
395
+ }
396
+
397
+ &__toolbar-tabs {
398
+ align-self: stretch;
399
+ display: flex;
400
+ flex: 1;
401
+
402
+ &-nav {
403
+ &--desktop {
404
+ @apply space-x-4;
405
+
406
+ display: none;
407
+ margin-bottom: -1px;
408
+
409
+ @screen md {
410
+ display: flex;
411
+ }
412
+ }
413
+
414
+ &--mobile {
415
+ align-items: center;
416
+ display: flex;
417
+ width: max-content;
418
+ z-index: theme("zIndex.10");
419
+
420
+ @screen md {
421
+ display: none;
422
+ }
423
+
424
+ .uxf-data-grid__toolbar-tabs-button {
425
+ align-items: center;
426
+ display: flex;
427
+ margin: 0;
428
+
429
+ &-icon {
430
+ color: theme("colors.lightHigh");
431
+ margin-left: theme("spacing.1");
432
+
433
+ :root .dark & {
434
+ color: theme("colors.darkHigh");
435
+ }
436
+ }
437
+ }
438
+ }
439
+
440
+ &-text {
441
+ color: theme("colors.lightHigh");
442
+
443
+ :root .dark & {
444
+ color: theme("colors.darkHigh");
445
+ }
446
+ }
447
+ }
448
+
449
+ &-modal-content {
450
+ @apply divide-lightBorder dark:divide-darkBorder divide-y;
451
+
452
+ align-items: flex-start;
453
+ display: flex;
454
+ flex-direction: column;
455
+ padding-bottom: theme("spacing.4");
456
+ padding-top: theme("spacing.1");
457
+ text-align: left;
458
+ }
459
+
460
+ &-modal-button {
461
+ border-radius: 0;
462
+ justify-content: flex-start;
463
+ width: 100%;
464
+ }
465
+
466
+ &-modal-button-text {
467
+ color: theme("colors.lightHigh");
468
+
469
+ :root .dark & {
470
+ color: theme("colors.darkHigh");
471
+ }
472
+ }
473
+
474
+ &-modal-active-tab-icon {
475
+ color: theme("colors.lightMedium");
476
+ margin-right: theme("spacing.3");
477
+
478
+ :root .dark & {
479
+ color: theme("colors.darkMedium");
480
+ }
481
+ }
482
+ }
483
+
484
+ &__toolbar-control {
485
+ align-items: center;
486
+ display: flex;
487
+ flex-direction: row;
488
+ gap: theme("spacing.2");
489
+ justify-content: space-between;
490
+ order: 3;
491
+ width: 100%;
492
+
493
+ @screen xs {
494
+ order: 2;
495
+ width: auto;
496
+ }
497
+ }
498
+
499
+ &__toolbar-customs {
500
+ align-items: center;
501
+ display: flex;
502
+ flex-direction: row;
503
+ gap: theme("spacing.2");
504
+ order: 2;
505
+
506
+ @screen xs {
507
+ order: 2;
508
+ }
509
+
510
+ @screen md {
511
+ margin-block: theme("spacing.2");
512
+ }
513
+
514
+ &-mobile {
515
+ display: flex;
516
+
517
+ @screen md {
518
+ display: none;
519
+ }
520
+ }
521
+
522
+ &-desktop {
523
+ display: none;
524
+
525
+ @screen md {
526
+ display: flex;
527
+ gap: theme("spacing.2");
528
+ }
529
+ }
530
+ }
531
+ }
532
+
533
+ /* TODO: tohle je imo k ničemu, že Vejvis? */
534
+
535
+ /* .rdg-cell.action {
536
+ align-items: center;
537
+ border-right: 0;
538
+ box-shadow: -3px 0 15px rgba(221 221 221 / 50%);
539
+ display: flex;
540
+ justify-content: center;
541
+ position: sticky;
542
+ right: 0;
543
+ text-align: right;
544
+ } */
545
+
546
+ .rdg-header-row {
547
+ color: theme("colors.lightLow");
548
+ font-weight: theme("fontWeight.normal");
549
+
550
+ :root .dark & {
551
+ color: theme("colors.darkLow");
552
+ }
553
+
554
+ .rdg-cell {
555
+ background-color: var(--rdg-header-background-color);
556
+
557
+ :root .dark & {
558
+ color: theme("colors.darkMedium");
559
+ }
560
+
561
+ &:not(:first-child) {
562
+ border-inline-start: 1px solid var(--rdg-border-color);
563
+ }
564
+ }
565
+ }
566
+
567
+ .rdg-header-sort-name + span {
568
+ align-items: center;
569
+ display: flex;
570
+ }
571
+
572
+ .rdg-cell {
573
+ border-block-end-width: 1px;
574
+ border-color: var(--rdg-border-color);
575
+ border-inline-end: none;
576
+
577
+ &.rdg-cell-frozen {
578
+ box-shadow: none;
579
+ }
580
+ }
581
+
582
+ @keyframes datagridlineanim {
583
+ 0% {
584
+ left: -40%;
585
+ }
586
+
587
+ 50% {
588
+ left: 20%;
589
+ width: 80%;
590
+ }
591
+
592
+ 100% {
593
+ left: 100%;
594
+ width: 100%;
595
+ }
596
+ }
@@ -12,5 +12,11 @@ export interface DataGridFetchingResult<Row> {
12
12
  data: Response<Row> | null;
13
13
  onReload: () => void;
14
14
  }
15
- export declare function useDataGridFetching(loader: Loader, schema: Schema<any>, gridName: string, state: DataGridControl["state"]): DataGridFetchingResult<any>;
15
+ interface Config {
16
+ loader: Loader;
17
+ schema: Schema<any>;
18
+ gridName: string;
19
+ state: DataGridControl["state"];
20
+ }
21
+ export declare function useDataGridFetching(config: Config): DataGridFetchingResult<any>;
16
22
  export {};
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useDataGridFetching = void 0;
4
4
  const react_1 = require("react");
5
5
  const utils_1 = require("../utils");
6
- function useDataGridFetching(loader, schema, gridName, state) {
6
+ function useDataGridFetching(config) {
7
+ const { state, schema, loader, gridName } = config;
7
8
  const [isLoading, setIsLoading] = (0, react_1.useState)(false);
8
9
  const [error, setError] = (0, react_1.useState)(null);
9
10
  const [data, setData] = (0, react_1.useState)(null);