aloha-vue 2.45.0 → 2.45.2

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.
@@ -1,1151 +1,1163 @@
1
- import {
2
- computed,
3
- h,
4
- provide,
5
- watch,
6
- } from "vue";
7
-
8
- import AGet from "../AGet/AGet";
9
- import ALoading from "../ALoading/ALoading";
10
- import APagination from "../APagination/APagination";
11
- import ATableGroupedHeader from "./ATableGroupedHeader/ATableGroupedHeader";
12
- import ATableHeader from "./ATableHeader/ATableHeader";
13
- import ATablePreviewRight from "./ATablePreviewRight/ATablePreviewRight";
14
- import ATableTopPanel from "./ATableTopPanel/ATableTopPanel";
15
- import ATableTr from "./ATableTr/ATableTr";
16
- import ATranslation from "../ATranslation/ATranslation";
17
- import {
18
- getRowIdOrIndex,
19
- } from "./utils/utils";
20
-
21
- import ColumnActionAPI from "./compositionAPI/ColumnActionAPI";
22
- import ColumnsAPI from "./compositionAPI/ColumnsAPI";
23
- import ColumnsGroupedAPI from "./compositionAPI/ColumnsGroupedAPI";
24
- import ColumnsOrderingAPI from "./compositionAPI/ColumnsOrderingAPI";
25
- import CountAPI from "./compositionAPI/CountAPI";
26
- import FocusTableAPI from "./compositionAPI/FocusTableAPI";
27
- import InitAPI from "./compositionAPI/InitAPI";
28
- import LimitOffsetAPI from "./compositionAPI/LimitOffsetAPI";
29
- import MobileColumnsAPI from "./compositionAPI/MobileColumnsAPI";
30
- import MultipleActionAPI from "./compositionAPI/MultipleActionAPI";
31
- import PreviewAPI from "./compositionAPI/PreviewAPI";
32
- import RowsAPI from "./compositionAPI/RowsAPI";
33
- import ScrollControlAPI from "./compositionAPI/ScrollControlAPI";
34
- import SimpleTableAPI from "./compositionAPI/SimpleTableAPI";
35
- import SortAPI from "./compositionAPI/SortAPI";
36
- import SortChangeAPI from "./compositionAPI/SortChangeAPI";
37
- import StickyAPI from "./compositionAPI/StickyAPI";
38
- import TableAttributesAPI from "./compositionAPI/TableAttributesAPI";
39
- import TableColumnsVisibleFunctionAPI from "./compositionAPI/TableColumnsVisibleFunctionAPI";
40
- import TextsAPI from "./compositionAPI/TextsAPI";
41
- import VariablesAPI from "./compositionAPI/VariablesAPI";
42
- import ViewsAPI from "./compositionAPI/ViewsAPI";
43
- import WidthAPI from "./compositionAPI/WidthAPI";
44
-
45
- import {
46
- tablePluginOptions,
47
- } from "../plugins/ATablePlugin";
48
- import {
49
- isInteger,
50
- uniqueId,
51
- } from "lodash-es";
52
-
53
- export default {
54
- name: "ATable",
55
- props: {
56
- additionalSortingColumns: {
57
- type: Array,
58
- required: false,
59
- default: () => [],
60
- },
61
- clearSelectedRowsOnDataChange: {
62
- type: Boolean,
63
- required: false,
64
- default: true,
65
- },
66
- columnActionsOnePlusDropdownOptions: {
67
- type: Object,
68
- required: false,
69
- default: () => ({
70
- actionsClasses: ["a_btn a_btn_primary a_text_truncate"],
71
- btnGroupClass: "a_btn_group a_btn_group_table",
72
- hasDividerBeforeDropdown: false,
73
- indexFirstDropdownAction: 1,
74
- indexFirstDropdownActionMobile: 1,
75
- minDropdownActions: 1,
76
- }),
77
- },
78
- columnActionsView: {
79
- type: String,
80
- required: false,
81
- default: "dropdown",
82
- validator: value => ["onePlusDropdown", "onePlusDropdownEmptyPlace", "dropdown"].indexOf(value) !== -1,
83
- },
84
- columnActionsWidth: {
85
- type: Number,
86
- required: false,
87
- default: undefined,
88
- },
89
- columnActionsWidthDefaults: {
90
- type: Object,
91
- required: false,
92
- default: () => ({
93
- default: 170,
94
- min: 50,
95
- onePlusDropdown: 320,
96
- onePlusDropdownMin: 200,
97
- btnGroupMaxWidth: 180,
98
- }),
99
- },
100
- columnActionsWidthMin: {
101
- type: Number,
102
- required: false,
103
- default: undefined,
104
- },
105
- columns: {
106
- type: Array,
107
- required: true,
108
- },
109
- columnsDefaultValue: {
110
- type: [String, Number],
111
- required: false,
112
- default: "",
113
- },
114
- columnWidthDefault: {
115
- type: Number,
116
- required: false,
117
- default: 250,
118
- },
119
- countAllRows: {
120
- type: Number,
121
- required: false,
122
- default: undefined,
123
- },
124
- countVisibleMobileColumns: {
125
- type: Number,
126
- required: false,
127
- default: 4,
128
- validator: value => value > 0,
129
- },
130
- borderType: {
131
- type: String,
132
- required: false,
133
- default: () => tablePluginOptions.value.propsDefault.borderType,
134
- validator: value => ["bordered", "innerBordered"].indexOf(value) !== -1,
135
- },
136
- data: {
137
- type: [Array, Object, Promise],
138
- required: false,
139
- },
140
- disabledActions: {
141
- type: Boolean,
142
- required: false,
143
- },
144
- disabledMultipleActions: {
145
- type: Boolean,
146
- required: false,
147
- },
148
- disabledOptions: {
149
- type: Boolean,
150
- required: false,
151
- },
152
- disabledPreview: {
153
- type: Boolean,
154
- required: false,
155
- },
156
- disabledPreviewRowCallback: {
157
- type: Function,
158
- required: false,
159
- },
160
- disabledRowActions: {
161
- type: Boolean,
162
- required: false,
163
- },
164
- disabledSort: {
165
- type: Boolean,
166
- required: false,
167
- },
168
- disabledViews: {
169
- type: Boolean,
170
- required: false,
171
- },
172
- extra: {
173
- type: Object,
174
- required: false,
175
- default: undefined,
176
- },
177
- hasMobile: {
178
- type: Boolean,
179
- required: false,
180
- default: true,
181
- },
182
- hasScrollClass: {
183
- type: Boolean,
184
- required: false,
185
- default: true,
186
- },
187
- id: {
188
- type: String,
189
- required: false,
190
- default: () => uniqueId("a_table"),
191
- },
192
- isActionColumnVisible: {
193
- type: Boolean,
194
- required: false,
195
- default: false,
196
- },
197
- isActionIconVisible: {
198
- type: Boolean,
199
- required: false,
200
- default: true,
201
- },
202
- isColumnsDnd: {
203
- type: Boolean,
204
- required: false,
205
- default: false,
206
- },
207
- isLabelVisible: {
208
- type: Boolean,
209
- required: false,
210
- default: true,
211
- },
212
- isLoadingMultipleActions: {
213
- type: Boolean,
214
- required: false,
215
- },
216
- isLoadingOptions: {
217
- type: Boolean,
218
- required: false,
219
- },
220
- isLoadingTable: {
221
- type: Boolean,
222
- required: false,
223
- },
224
- isQuickSearch: {
225
- type: Boolean,
226
- required: false,
227
- },
228
- isSimpleTable: {
229
- type: Boolean,
230
- required: false,
231
- default: false,
232
- },
233
- isSortingMultiColumn: {
234
- type: Boolean,
235
- required: false,
236
- default: false,
237
- },
238
- isSortingOutside: {
239
- type: Boolean,
240
- required: false,
241
- },
242
- isTree: {
243
- type: Boolean,
244
- required: false,
245
- },
246
- isTreeCollapsible: {
247
- type: Boolean,
248
- required: false,
249
- default: true,
250
- },
251
- isTreeOpened: {
252
- type: Boolean,
253
- required: false,
254
- },
255
- keyCountAllRowsInData: {
256
- type: String,
257
- required: false,
258
- default: "count",
259
- },
260
- keyId: {
261
- type: String,
262
- required: false,
263
- default: undefined,
264
- },
265
- keyChildren: {
266
- type: String,
267
- required: false,
268
- default: "children",
269
- },
270
- label: {
271
- type: [String, Number],
272
- required: false,
273
- default: "",
274
- },
275
- labelClass: {
276
- type: [String, Object],
277
- required: false,
278
- default: undefined,
279
- },
280
- labelTag: {
281
- type: String,
282
- required: false,
283
- default: "h2",
284
- },
285
- modelColumnsOrdering: {
286
- type: Array,
287
- required: false,
288
- default: () => [],
289
- },
290
- modelColumnsVisible: {
291
- type: Object,
292
- required: false,
293
- default: () => ({}),
294
- },
295
- modelIsTableWithoutScrollStart: {
296
- type: Boolean,
297
- required: false,
298
- default: false,
299
- },
300
- modelQuickSearch: {
301
- type: String,
302
- required: false,
303
- default: "",
304
- },
305
- modelSort: {
306
- type: [String, Array],
307
- required: false,
308
- default: () => [],
309
- },
310
- modelView: {
311
- type: [String, Number],
312
- required: false,
313
- default: undefined,
314
- },
315
- multipleActions: {
316
- type: Array,
317
- required: false,
318
- default: () => [],
319
- },
320
- offsetStart: {
321
- type: Number,
322
- required: false,
323
- default: 0,
324
- },
325
- pagination: {
326
- type: Object,
327
- required: false,
328
- default: () => ({
329
- use: false,
330
- maxPages: 5,
331
- limitsPerPage: [],
332
- limitStart: 10,
333
- disabled: false,
334
- isOutside: false,
335
- outside: false,
336
- position: "bottom",
337
- modes: {
338
- /*
339
- * perPage: inline / select
340
- * pagination: normal / short / loadMore
341
- */
342
- desktop: {
343
- pagination: {
344
- mode: "normal",
345
- position: 0,
346
- },
347
- perPage: {
348
- mode: "inline",
349
- position: 1,
350
- },
351
- },
352
- mobile: {
353
- pagination: {
354
- mode: "loadMore",
355
- },
356
- },
357
- },
358
- }),
359
- },
360
- preview: {
361
- type: String,
362
- required: false,
363
- default: undefined,
364
- validator: value => ["right", "down"].indexOf(value) !== -1,
365
- },
366
- previewBoxWidth: {
367
- type: Number,
368
- required: false,
369
- default: 300,
370
- },
371
- previewStyles: {
372
- type: [String, Object],
373
- required: false,
374
- default: undefined,
375
- },
376
- rowActions: {
377
- type: Array,
378
- required: false,
379
- default: () => [],
380
- },
381
- rowActionsClass: {
382
- type: [String, Object],
383
- required: false,
384
- default: undefined,
385
- },
386
- rowActionsSticky: {
387
- type: Boolean,
388
- required: false,
389
- default: true,
390
- },
391
- rowClass: {
392
- type: [String, Object, Function],
393
- required: false,
394
- default: undefined,
395
- },
396
- rowsCountRenderPerTick: {
397
- type: Number,
398
- required: false,
399
- default: 25,
400
- validator: value => isInteger(value) && value >= 0,
401
- },
402
- rowsFooter: {
403
- type: Array,
404
- required: false,
405
- default: () => [],
406
- },
407
- showCount: {
408
- type: Boolean,
409
- required: false,
410
- default: true,
411
- },
412
- showFirstSortingSequenceNumber: {
413
- type: Boolean,
414
- required: false,
415
- default: false,
416
- },
417
- sortingMultiColumnKey: {
418
- type: String,
419
- required: false,
420
- default: "shift",
421
- validator: value => ["shift", "ctrl", "alt"].indexOf(value) !== -1,
422
- },
423
- sortingSequenceNumberClass: {
424
- type: [String, Object],
425
- required: false,
426
- default: "a_badge",
427
- },
428
- tableActions: {
429
- type: Array,
430
- required: false,
431
- default: () => [],
432
- },
433
- tableActionsIndexFirstDropdownAction: {
434
- type: Number,
435
- required: false,
436
- default: -1,
437
- },
438
- tableActionsIndexFirstDropdownActionMobile: {
439
- type: Number,
440
- required: false,
441
- default: 0,
442
- },
443
- texts: {
444
- type: Object,
445
- required: false,
446
- default: () => ({
447
- empty: "_A_TABLE_EMPTY_TEXT_",
448
- }),
449
- },
450
- useAdditionalSorting: {
451
- type: Boolean,
452
- required: false,
453
- default: true,
454
- },
455
- useViewSlot: {
456
- type: Boolean,
457
- required: false,
458
- },
459
- useRem: {
460
- type: Boolean,
461
- required: false,
462
- default: true,
463
- },
464
- valuesForColumnDefault: {
465
- type: Array,
466
- required: false,
467
- default: () => [null, undefined, ""],
468
- },
469
- views: {
470
- type: Array,
471
- required: false,
472
- default: () => [],
473
- },
474
- },
475
- emits: [
476
- "changeColumnsOrdering",
477
- "changeColumnsVisible",
478
- "changeLimit",
479
- "changeOffset",
480
- "changeSorting",
481
- "mouseupResizePreviewRight",
482
- "initTable",
483
- "togglePreview",
484
- "toggleMultipleActions",
485
- "update:modelColumnsOrder",
486
- "update:modelColumnsVisible",
487
- "update:modelQuickSearch",
488
- "updateModelIsTableWithoutScroll",
489
- "updateView",
490
- ],
491
- provide() {
492
- return {
493
- changeModelColumnsVisible: this.changeModelColumnsVisible,
494
- columnActionsOnePlusDropdownOptions: computed(() => this.columnActionsOnePlusDropdownOptions),
495
- columns: computed(() => this.columns),
496
- columnsDefaultValue: computed(() => this.columnsDefaultValue),
497
- isLoadingOptions: computed(() => this.isLoadingOptions),
498
- isLoadingTable: computed(() => this.isLoadingTable),
499
- keyId: computed(() => this.keyId),
500
- rowActions: computed(() => this.rowActions),
501
- tableId: computed(() => this.id),
502
- valuesForColumnDefault: computed(() => this.valuesForColumnDefault),
503
- useRem: computed(() => this.useRem),
504
- };
505
- },
506
- setup(props, context) {
507
- const {
508
- columnActionsWidthDefaultsRemLocal,
509
- columnActionsWidthMinRemLocal,
510
- columnActionsWidthRemLocal,
511
- columnWidthDefaultRemLocal,
512
- previewBoxWidthRemLocal,
513
- } = WidthAPI(props);
514
-
515
- const {
516
- initModelIsTableWithoutScroll,
517
- isActionColumnVisibleLocal,
518
- isActionIconVisibleLocal,
519
- isColumnsDndLocal,
520
- isMobile,
521
- modelIsTableWithoutScroll,
522
- modelIsTableWithoutScrollComputed,
523
- } = SimpleTableAPI(props);
524
-
525
- const {
526
- countAllRowsLocal,
527
- } = CountAPI(props);
528
-
529
- const {
530
- columnsScrollInvisible,
531
- indexFirstScrollInvisibleColumn,
532
- isMultipleActionsActive,
533
- modelColumnsVisibleLocal,
534
- tableGrandparentRef,
535
- tableRef,
536
- } = VariablesAPI(props);
537
-
538
- const {
539
- scrollToTable,
540
- setFocusToTable,
541
- } = FocusTableAPI({
542
- tableRef,
543
- });
544
-
545
- const {
546
- hasViews,
547
- initViewCurrent,
548
- isViewTableVisible,
549
- updateViewCurrent,
550
- viewCurrent,
551
- } = ViewsAPI(props, context, {
552
- closePreviewAll,
553
- });
554
-
555
- const {
556
- dataSorted,
557
- initModelSort,
558
- modelSortLocal,
559
- useAdditionalSortingLocal,
560
- } = SortAPI(props, {
561
- viewCurrent,
562
- });
563
-
564
- const {
565
- columnsOrderedFromSimpleTable,
566
- renderedGroupedColumns,
567
- } = ColumnsGroupedAPI(props, {
568
- modelSort: modelSortLocal,
569
- });
570
-
571
- const {
572
- columnIdsGroupByLocked,
573
- columnsFilteredForRender,
574
- columnsFilteredForRenderIndexesMapping,
575
- columnsOrdered,
576
- countNotHiddenColumns,
577
- } = ColumnsAPI(props, {
578
- columnsScrollInvisible,
579
- indexFirstScrollInvisibleColumn,
580
- modelColumnsVisibleLocal,
581
- modelIsTableWithoutScrollComputed,
582
- columnsOrderedFromSimpleTable,
583
- });
584
-
585
- const {
586
- changeLimit,
587
- changeOffset,
588
- initLocalVars,
589
- limit,
590
- offset,
591
- usePaginationBottom,
592
- usePaginationLocal,
593
- usePaginationTop,
594
- } = LimitOffsetAPI(props, context, {
595
- closePreviewAll,
596
- scrollToTable,
597
- setFocusToTable,
598
- viewCurrent,
599
- });
600
-
601
- const {
602
- addRow,
603
- deleteRow,
604
- hasRows,
605
- rowsLocal,
606
- rowsLocalAll,
607
- rowsLocalLength,
608
- stopRenderRows,
609
- updateRow,
610
- } = RowsAPI(props, {
611
- dataSorted,
612
- limit,
613
- offset,
614
- setEmptySelectedRowsIndexes,
615
- usePaginationLocal,
616
- });
617
-
618
- const {
619
- columnActionsBtnGroupMaxWidthStyle,
620
- columnActionsWidthLocal,
621
- columnActionsWidthMinLocal,
622
- isColumnActionWide,
623
- } = ColumnActionAPI(props, {
624
- columnActionsWidthDefaultsRemLocal,
625
- columnActionsWidthMinRemLocal,
626
- columnActionsWidthRemLocal,
627
- isMobile,
628
- rowsLocal,
629
- });
630
-
631
- const {
632
- aTableRef,
633
- changeModelIsTableWithoutScroll,
634
- checkVisibleColumns,
635
- columnsVisibleAdditionalSpaceForOneGrow,
636
- onWatchMobileScrollControl,
637
- } = ScrollControlAPI(props, context, {
638
- columnActionsWidthLocal,
639
- columnActionsWidthMinLocal,
640
- columnsOrdered,
641
- columnsScrollInvisible,
642
- columnWidthDefaultRemLocal,
643
- indexFirstScrollInvisibleColumn,
644
- isMobile,
645
- isMultipleActionsActive,
646
- modelColumnsVisibleLocal,
647
- modelIsTableWithoutScroll,
648
- modelIsTableWithoutScrollComputed,
649
- });
650
-
651
- const {
652
- changeColumnsOrdering,
653
- checkColumnsOrdering,
654
- } = ColumnsOrderingAPI(props, context, {
655
- checkVisibleColumns,
656
- columnIdsGroupByLocked,
657
- columnsFilteredForRenderIndexesMapping,
658
- });
659
-
660
- const {
661
- isRowActionsStickyLocal,
662
- } = StickyAPI(props, {
663
- isMobile,
664
- modelIsTableWithoutScrollComputed,
665
- });
666
-
667
- const {
668
- areAllRowsSelected,
669
- areAllVisibleRowsSelected,
670
- areSomeRowsSelected,
671
- closeMultipleActionsActive,
672
- currentMultipleActions,
673
- hasMultipleActions,
674
- selectedRows,
675
- selectedRowsIndexes,
676
- setEmptySelectedRowsIndexes: _setEmptySelectedRowsIndexes,
677
- setSelectedRowsIndexes,
678
- toggleBtnAllRows,
679
- toggleMultipleActionsActive,
680
- } = MultipleActionAPI(props, context, {
681
- checkVisibleColumns,
682
- isMultipleActionsActive,
683
- rowsLocalAll,
684
- rowsLocalLength,
685
- });
686
-
687
- const {
688
- changeModelColumnsVisible,
689
- } = TableColumnsVisibleFunctionAPI(props, context, {
690
- modelColumnsVisibleLocal,
691
- checkVisibleColumns,
692
- });
693
-
694
- const {
695
- closePreview,
696
- closePreviewAll: _closePreviewAll,
697
- hasPreview,
698
- isPreviewRightOpen,
699
- onTogglePreview,
700
- mousedownResizePreviewRight,
701
- mousemoveResizePreviewRight,
702
- mouseupResizePreviewRight,
703
- previewDownRowIds,
704
- previewRightRowIndex,
705
- previewRightRowIndexLast,
706
- togglePreviewResize,
707
- } = PreviewAPI(props, context, {
708
- aTableRef,
709
- isMobile,
710
- previewBoxWidthRemLocal,
711
- rowsLocalAll,
712
- tableGrandparentRef,
713
- });
714
-
715
- const {
716
- tableChildRole,
717
- tableLabelId,
718
- tableRoleAttributes,
719
- } = TableAttributesAPI(props, {
720
- countNotHiddenColumns,
721
- isMobile,
722
- });
723
-
724
- const {
725
- allVisibleMobileColumns,
726
- } = MobileColumnsAPI({
727
- columnsOrdered,
728
- isMobile,
729
- modelColumnsVisibleLocal,
730
- });
731
-
732
- const {
733
- changeModelSort,
734
- } = SortChangeAPI(props, context, {
735
- modelSortLocal,
736
- closePreviewAll,
737
- });
738
-
739
- const {
740
- initTable,
741
- } = InitAPI(props, context, {
742
- checkColumnsOrdering,
743
- checkVisibleColumns,
744
- modelColumnsVisibleLocal,
745
- });
746
-
747
- const {
748
- emptyText,
749
- } = TextsAPI(props);
750
-
751
- function closePreviewAll() {
752
- _closePreviewAll();
753
- }
754
-
755
- function setEmptySelectedRowsIndexes() {
756
- _setEmptySelectedRowsIndexes();
757
- }
758
-
759
- watch(isMobile, newValue => {
760
- onWatchMobileScrollControl(newValue);
761
- closePreviewAll();
762
- });
763
-
764
- watch(isColumnActionWide, (newValue, oldValue) => {
765
- if (newValue !== oldValue) {
766
- checkVisibleColumns();
767
- }
768
- });
769
-
770
- provide("changeModelIsTableWithoutScroll", changeModelIsTableWithoutScroll);
771
- provide("changeModelSort", changeModelSort);
772
- provide("columnsOrdered", columnsOrdered);
773
- provide("columnsFilteredForRender", columnsFilteredForRender);
774
- provide("columnsScrollInvisible", columnsScrollInvisible);
775
- provide("columnWidthDefault", columnWidthDefaultRemLocal);
776
- provide("columnsVisibleAdditionalSpaceForOneGrow", columnsVisibleAdditionalSpaceForOneGrow);
777
- provide("columnActionsWidthLocal", columnActionsWidthLocal);
778
- provide("columnActionsWidthMinLocal", columnActionsWidthMinLocal);
779
- provide("currentMultipleActions", currentMultipleActions);
780
- provide("hasPreview", hasPreview);
781
- provide("indexFirstScrollInvisibleColumn", indexFirstScrollInvisibleColumn);
782
- provide("isActionColumnVisible", isActionColumnVisibleLocal);
783
- provide("isActionIconVisible", isActionIconVisibleLocal);
784
- provide("isColumnsDnd", isColumnsDndLocal);
785
- provide("isMobile", isMobile);
786
- provide("isMultipleActionsActive", isMultipleActionsActive);
787
- provide("modelIsTableWithoutScroll", modelIsTableWithoutScrollComputed);
788
- provide("onTogglePreview", onTogglePreview);
789
- provide("previewRightRowIndex", previewRightRowIndex);
790
- provide("previewRightRowIndexLast", previewRightRowIndexLast);
791
-
792
- provide("rowsLocalAll", rowsLocalAll);
793
- provide("modelColumnsVisibleLocal", modelColumnsVisibleLocal);
794
- provide("changeColumnsOrdering", changeColumnsOrdering);
795
-
796
- initLocalVars();
797
- initModelIsTableWithoutScroll();
798
- initViewCurrent();
799
- initTable();
800
- initModelSort();
801
-
802
- return {
803
- addRow,
804
- allVisibleMobileColumns,
805
- areAllRowsSelected,
806
- areAllVisibleRowsSelected,
807
- areSomeRowsSelected,
808
- aTableRef,
809
- changeLimit,
810
- changeModelColumnsVisible,
811
- changeOffset,
812
- checkVisibleColumns,
813
- closeMultipleActionsActive,
814
- closePreview,
815
- closePreviewAll,
816
- columnActionsBtnGroupMaxWidthStyle,
817
- columnsFilteredForRender,
818
- columnsOrdered,
819
- countAllRowsLocal,
820
- deleteRow,
821
- emptyText,
822
- hasMultipleActions,
823
- hasRows,
824
- hasViews,
825
- isMobile,
826
- isMultipleActionsActive,
827
- isPreviewRightOpen,
828
- isRowActionsStickyLocal,
829
- isViewTableVisible,
830
- limit,
831
- modelColumnsVisibleLocal,
832
- modelIsTableWithoutScrollComputed,
833
- modelSortLocal,
834
- mousedownResizePreviewRight,
835
- mousemoveResizePreviewRight,
836
- mouseupResizePreviewRight,
837
- offset,
838
- onTogglePreview,
839
- previewDownRowIds,
840
- previewRightRowIndex,
841
- renderedGroupedColumns,
842
- rowsLocal,
843
- rowsLocalAll,
844
- rowsLocalLength,
845
- selectedRows,
846
- selectedRowsIndexes,
847
- setEmptySelectedRowsIndexes,
848
- setSelectedRowsIndexes,
849
- stopRenderRows,
850
- tableChildRole,
851
- tableGrandparentRef,
852
- tableLabelId,
853
- tableRef,
854
- tableRoleAttributes,
855
- toggleBtnAllRows,
856
- toggleMultipleActionsActive,
857
- togglePreviewResize,
858
- updateRow,
859
- updateViewCurrent,
860
- useAdditionalSortingLocal,
861
- usePaginationBottom,
862
- usePaginationLocal,
863
- usePaginationTop,
864
- viewCurrent,
865
- };
866
- },
867
- data() {
868
- return {
869
- resolved: undefined,
870
- error: undefined,
871
- };
872
- },
873
- computed: {
874
- hasRowsFooter() {
875
- return this.rowsFooter.length > 0;
876
- },
877
- },
878
- methods: {
879
- updateModelQuickSearch(model) {
880
- this.$emit("update:modelQuickSearch", model);
881
- },
882
- },
883
- render() {
884
- return h("div", {
885
- ref: "tableGrandparentRef",
886
- class: ["a_table__grandparent", {
887
- a_table_mobile: this.isMobile,
888
- a_table__grandparent_without_scroll: !this.hasScrollClass,
889
- }],
890
- }, [
891
- this.$slots.tablePrepend &&
892
- this.$slots.tablePrepend({
893
- id: this.id,
894
- }),
895
- h("div", {
896
- ref: "aTableRef",
897
- class: ["a_table__parent", {
898
- a_table__parent_scrollable: this.hasScrollClass && !this.modelIsTableWithoutScrollComputed,
899
- }],
900
- }, [
901
- h(ATableTopPanel, {
902
- additionalSortingColumns: this.additionalSortingColumns,
903
- areAllRowsSelected: this.areAllRowsSelected,
904
- areSomeRowsSelected: this.areSomeRowsSelected,
905
- closeMultipleActionsActive: this.closeMultipleActionsActive,
906
- countAllRows: this.countAllRowsLocal,
907
- disabledActions: this.disabledActions,
908
- disabledMultipleActions: this.disabledMultipleActions,
909
- disabledSort: this.disabledSort,
910
- disabledViews: this.disabledViews,
911
- extra: this.extra,
912
- hasViews: this.hasViews,
913
- isLabelVisible: this.isLabelVisible,
914
- isLoadingMultipleActions: this.isLoadingMultipleActions,
915
- isQuickSearch: this.isQuickSearch,
916
- isSortingMultiColumn: this.isSortingMultiColumn,
917
- label: this.label,
918
- labelClass: this.labelClass,
919
- labelTag: this.labelTag,
920
- modelQuickSearch: this.modelQuickSearch,
921
- modelSort: this.modelSortLocal,
922
- modelView: this.modelView,
923
- multipleActions: this.multipleActions,
924
- selectedRows: this.selectedRows,
925
- showCount: this.showCount,
926
- tableActions: this.tableActions,
927
- tableActionsIndexFirstDropdownAction: this.tableActionsIndexFirstDropdownAction,
928
- tableActionsIndexFirstDropdownActionMobile: this.tableActionsIndexFirstDropdownActionMobile,
929
- useAdditionalSorting: this.useAdditionalSortingLocal,
930
- useViewSlot: this.useViewSlot,
931
- viewCurrent: this.viewCurrent,
932
- views: this.views,
933
- onUpdateViewCurrent: this.updateViewCurrent,
934
- onUpdateModelQuickSearch: this.updateModelQuickSearch,
935
- onToggleMultipleActionsActive: this.toggleMultipleActionsActive,
936
- onToggleBtnAllRows: this.toggleBtnAllRows,
937
- }, this.$slots),
938
- this.$slots.topPanelAppend ?
939
- this.$slots.topPanelAppend() :
940
- "",
941
- (this.usePaginationLocal && this.usePaginationTop && this.hasRows) ?
942
- h(APagination, {
943
- class: "a_table__pagination_top",
944
- disabled: this.pagination.disabled,
945
- limit: this.limit,
946
- limitsPerPage: this.pagination.limitsPerPage,
947
- maxPages: this.pagination.maxPages,
948
- offset: this.offset,
949
- rowsLength: this.rowsLocalLength,
950
- totalCount: this.countAllRowsLocal,
951
- "onUpdate:limit": this.changeLimit,
952
- "onUpdate:offset": this.changeOffset,
953
- }) :
954
- "",
955
- this.isViewTableVisible && h("div", {
956
- ref: "tableRef",
957
- "aria-labelledby": this.isLabelVisible ?
958
- this.tableLabelId :
959
- undefined,
960
- class: [
961
- "a_table",
962
- {
963
- a_table_simple: this.isSimpleTable,
964
- a_table_bordered: this.borderType === "bordered",
965
- a_table_inner_bordered: this.borderType === "innerBordered",
966
- },
967
- ],
968
- ...this.tableRoleAttributes,
969
- }, [
970
- this.isSimpleTable ?
971
- h(ATableGroupedHeader, {
972
- areAllRowsSelected: this.areAllRowsSelected,
973
- areAllVisibleRowsSelected: this.areAllVisibleRowsSelected,
974
- areSomeRowsSelected: this.areSomeRowsSelected,
975
- disabledOptions: this.disabledOptions,
976
- disabledSort: this.disabledSort,
977
- hasMultipleActions: this.hasMultipleActions,
978
- isRowActionsStickyLocal: this.isRowActionsStickyLocal,
979
- isSortingMultiColumn: this.isSortingMultiColumn,
980
- modelSort: this.modelSortLocal,
981
- rowsLocalLength: this.rowsLocalLength,
982
- showFirstSortingSequenceNumber: this.showFirstSortingSequenceNumber,
983
- sortingSequenceNumberClass: this.sortingSequenceNumberClass,
984
- onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
985
- columnsForRender: this.renderedGroupedColumns,
986
- }) :
987
- h(ATableHeader, {
988
- areAllRowsSelected: this.areAllRowsSelected,
989
- areAllVisibleRowsSelected: this.areAllVisibleRowsSelected,
990
- areSomeRowsSelected: this.areSomeRowsSelected,
991
- disabledOptions: this.disabledOptions,
992
- disabledSort: this.disabledSort,
993
- hasMultipleActions: this.hasMultipleActions,
994
- isRowActionsStickyLocal: this.isRowActionsStickyLocal,
995
- isSortingMultiColumn: this.isSortingMultiColumn,
996
- modelSort: this.modelSortLocal,
997
- rowsLocalLength: this.rowsLocalLength,
998
- showFirstSortingSequenceNumber: this.showFirstSortingSequenceNumber,
999
- sortingSequenceNumberClass: this.sortingSequenceNumberClass,
1000
- onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
1001
- }),
1002
- h("div", {
1003
- class: "a_table__loading",
1004
- }, [
1005
- h(ALoading, {
1006
- isLoading: this.isLoadingTable,
1007
- }, () => [
1008
- h("div", {
1009
- class: "a_table__body",
1010
- role: this.tableChildRole,
1011
- }, {
1012
- default: () => this.rowsLocal.map((row, rowIndex) => {
1013
- const ROW_ID = getRowIdOrIndex({ row, rowIndex, keyId: this.keyId });
1014
-
1015
- return h(ATableTr, {
1016
- key: ROW_ID,
1017
- allVisibleMobileColumns: this.allVisibleMobileColumns,
1018
- areAllRowsSelected: this.areAllRowsSelected,
1019
- columnActionsBtnGroupMaxWidthStyle: this.columnActionsBtnGroupMaxWidthStyle,
1020
- columnActionsView: this.columnActionsView,
1021
- countVisibleMobileColumns: this.countVisibleMobileColumns,
1022
- disabledPreview: this.disabledPreview,
1023
- disabledPreviewRowCallback: this.disabledPreviewRowCallback,
1024
- disabledRowActions: this.disabledRowActions,
1025
- isFooter: false,
1026
- isPreviewDownOpen: this.previewDownRowIds[ROW_ID],
1027
- isRowActionsStickyLocal: this.isRowActionsStickyLocal,
1028
- isTree: this.isTree,
1029
- isTreeCollapsible: this.isTreeCollapsible,
1030
- isTreeOpened: this.isTreeOpened,
1031
- keyChildren: this.keyChildren,
1032
- keyId: this.keyId,
1033
- level: 1,
1034
- row,
1035
- rowActionsClass: this.rowActionsClass,
1036
- rowClass: this.rowClass,
1037
- rowIndex,
1038
- rowsLength: this.rowsLocal.length,
1039
- selectedRowsIndexes: this.selectedRowsIndexes,
1040
- onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
1041
- }, {
1042
- get: vm => [
1043
- h(AGet, {
1044
- data: vm.row,
1045
- keyLabel: vm.column.keyLabel,
1046
- filter: vm.column.filter,
1047
- filterParameters: vm.column.filterParameters,
1048
- defaultValue: vm.column.defaultValue,
1049
- tag: vm.column.filterTag || "div",
1050
- }),
1051
- ],
1052
- ...this.$slots,
1053
- });
1054
- }),
1055
- }),
1056
- (this.isViewTableVisible && !this.hasRows) && h(ATranslation, {
1057
- class: "a_table__empty_text",
1058
- text: this.emptyText,
1059
- }),
1060
- this.hasRowsFooter && h("div", {
1061
- class: "a_table__footer",
1062
- role: this.tableChildRole,
1063
- }, this.rowsFooter.map((row, rowIndex) => {
1064
- const ROW_ID = getRowIdOrIndex({ row, rowIndex, keyId: this.keyId });
1065
-
1066
- return h(ATableTr, {
1067
- key: ROW_ID,
1068
- allVisibleMobileColumns: this.allVisibleMobileColumns,
1069
- areAllRowsSelected: this.areAllRowsSelected,
1070
- columnActionsBtnGroupMaxWidthStyle: this.columnActionsBtnGroupMaxWidthStyle,
1071
- columnActionsView: this.columnActionsView,
1072
- countVisibleMobileColumns: this.countVisibleMobileColumns,
1073
- disabledPreview: this.disabledPreview,
1074
- disabledPreviewRowCallback: this.disabledPreviewRowCallback,
1075
- disabledRowActions: this.disabledRowActions,
1076
- isFooter: true,
1077
- isRowActionsStickyLocal: this.isRowActionsStickyLocal,
1078
- isTree: this.isTree,
1079
- isTreeCollapsible: this.isTreeCollapsible,
1080
- isTreeOpened: this.isTreeOpened,
1081
- keyChildren: this.keyChildren,
1082
- keyId: this.keyId,
1083
- level: 1,
1084
- row,
1085
- rowActionsClass: this.rowActionsClass,
1086
- rowClass: this.rowClass,
1087
- rowIndex,
1088
- rowsLength: this.rowsFooter.length,
1089
- selectedRowsIndexes: this.selectedRowsIndexes,
1090
- onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
1091
- }, {
1092
- get: vm => [
1093
- h(AGet, {
1094
- data: vm.row,
1095
- keyLabel: vm.column.footerPath,
1096
- filter: vm.column.footerFilter,
1097
- filterParameters: vm.column.footerFilterParameters,
1098
- defaultValue: vm.column.footerDefaultValue,
1099
- }),
1100
- ],
1101
- ...this.$slots,
1102
- });
1103
- })),
1104
- ]),
1105
- ]),
1106
-
1107
- ]),
1108
- (!this.isViewTableVisible && this.viewCurrent && this.$slots[this.viewCurrent.type]) &&
1109
- this.$slots[this.viewCurrent.type]({
1110
- isLoading: this.isLoadingTable,
1111
- rows: this.rowsLocalAll,
1112
- }),
1113
- (this.usePaginationLocal && this.usePaginationBottom && this.hasRows) ?
1114
- h(APagination, {
1115
- class: "a_table__pagination_bottom",
1116
- disabled: this.pagination.disabled,
1117
- limit: this.limit,
1118
- limitsPerPage: this.pagination.limitsPerPage,
1119
- maxPages: this.pagination.maxPages,
1120
- offset: this.offset,
1121
- rowsLength: this.rowsLocalLength,
1122
- totalCount: this.countAllRowsLocal,
1123
- "onUpdate:limit": this.changeLimit,
1124
- "onUpdate:offset": this.changeOffset,
1125
- }) :
1126
- "",
1127
- this.isPreviewRightOpen ?
1128
- h(ATablePreviewRight, {
1129
- countAllRows: this.countAllRowsLocal,
1130
- isMobile: this.isMobile,
1131
- isLoadingTable: this.isLoadingTable,
1132
- limitPagination: this.limit,
1133
- offsetPagination: this.offset,
1134
- previewStyles: this.previewStyles,
1135
- rowIndex: this.previewRightRowIndex,
1136
- rows: this.rowsLocalAll,
1137
- disabledPreviewRowCallback: this.disabledPreviewRowCallback,
1138
- usePagination: !!this.usePaginationLocal,
1139
- onClosePreview: this.closePreview,
1140
- onMousedownResizePreviewRight: this.mousedownResizePreviewRight,
1141
- onMousemoveResizePreviewRight: this.mousemoveResizePreviewRight,
1142
- onMouseupResizePreviewRight: this.mouseupResizePreviewRight,
1143
- onTogglePreview: this.onTogglePreview,
1144
- onTogglePreviewResize: this.togglePreviewResize,
1145
- "onUpdate:offset": this.changeOffset,
1146
- }, this.$slots) :
1147
- "",
1148
- ]),
1149
- ]);
1150
- },
1151
- };
1
+ import {
2
+ computed,
3
+ h,
4
+ provide,
5
+ watch,
6
+ } from "vue";
7
+
8
+ import AGet from "../AGet/AGet";
9
+ import ALoading from "../ALoading/ALoading";
10
+ import APagination from "../APagination/APagination";
11
+ import ATableGroupedHeader from "./ATableGroupedHeader/ATableGroupedHeader";
12
+ import ATableHeader from "./ATableHeader/ATableHeader";
13
+ import ATablePreviewRight from "./ATablePreviewRight/ATablePreviewRight";
14
+ import ATableTopPanel from "./ATableTopPanel/ATableTopPanel";
15
+ import ATableTr from "./ATableTr/ATableTr";
16
+ import ATranslation from "../ATranslation/ATranslation";
17
+ import {
18
+ getRowIdOrIndex,
19
+ } from "./utils/utils";
20
+
21
+ import ColumnActionAPI from "./compositionAPI/ColumnActionAPI";
22
+ import ColumnsAPI from "./compositionAPI/ColumnsAPI";
23
+ import ColumnsGroupedAPI from "./compositionAPI/ColumnsGroupedAPI";
24
+ import ColumnsOrderingAPI from "./compositionAPI/ColumnsOrderingAPI";
25
+ import CountAPI from "./compositionAPI/CountAPI";
26
+ import FocusTableAPI from "./compositionAPI/FocusTableAPI";
27
+ import InitAPI from "./compositionAPI/InitAPI";
28
+ import LimitOffsetAPI from "./compositionAPI/LimitOffsetAPI";
29
+ import MobileColumnsAPI from "./compositionAPI/MobileColumnsAPI";
30
+ import MultipleActionAPI from "./compositionAPI/MultipleActionAPI";
31
+ import PreviewAPI from "./compositionAPI/PreviewAPI";
32
+ import RowsAPI from "./compositionAPI/RowsAPI";
33
+ import ScrollControlAPI from "./compositionAPI/ScrollControlAPI";
34
+ import SimpleTableAPI from "./compositionAPI/SimpleTableAPI";
35
+ import SortAPI from "./compositionAPI/SortAPI";
36
+ import SortChangeAPI from "./compositionAPI/SortChangeAPI";
37
+ import StickyAPI from "./compositionAPI/StickyAPI";
38
+ import TableAttributesAPI from "./compositionAPI/TableAttributesAPI";
39
+ import TableColumnsVisibleFunctionAPI from "./compositionAPI/TableColumnsVisibleFunctionAPI";
40
+ import TextsAPI from "./compositionAPI/TextsAPI";
41
+ import VariablesAPI from "./compositionAPI/VariablesAPI";
42
+ import ViewsAPI from "./compositionAPI/ViewsAPI";
43
+ import WidthAPI from "./compositionAPI/WidthAPI";
44
+ import {
45
+ PaginationModesAPI,
46
+ } from "./compositionAPI/PaginationModesAPI";
47
+
48
+ import {
49
+ tablePluginOptions,
50
+ } from "../plugins/ATablePlugin";
51
+ import {
52
+ isInteger,
53
+ uniqueId,
54
+ } from "lodash-es";
55
+
56
+ export default {
57
+ name: "ATable",
58
+ props: {
59
+ additionalSortingColumns: {
60
+ type: Array,
61
+ required: false,
62
+ default: () => [],
63
+ },
64
+ clearSelectedRowsOnDataChange: {
65
+ type: Boolean,
66
+ required: false,
67
+ default: true,
68
+ },
69
+ columnActionsOnePlusDropdownOptions: {
70
+ type: Object,
71
+ required: false,
72
+ default: () => ({
73
+ actionsClasses: ["a_btn a_btn_primary a_text_truncate"],
74
+ btnGroupClass: "a_btn_group a_btn_group_table",
75
+ hasDividerBeforeDropdown: false,
76
+ indexFirstDropdownAction: 1,
77
+ indexFirstDropdownActionMobile: 1,
78
+ minDropdownActions: 1,
79
+ }),
80
+ },
81
+ columnActionsView: {
82
+ type: String,
83
+ required: false,
84
+ default: "dropdown",
85
+ validator: value => ["onePlusDropdown", "onePlusDropdownEmptyPlace", "dropdown"].indexOf(value) !== -1,
86
+ },
87
+ columnActionsWidth: {
88
+ type: Number,
89
+ required: false,
90
+ default: undefined,
91
+ },
92
+ columnActionsWidthDefaults: {
93
+ type: Object,
94
+ required: false,
95
+ default: () => ({
96
+ default: 170,
97
+ min: 50,
98
+ onePlusDropdown: 320,
99
+ onePlusDropdownMin: 200,
100
+ btnGroupMaxWidth: 180,
101
+ }),
102
+ },
103
+ columnActionsWidthMin: {
104
+ type: Number,
105
+ required: false,
106
+ default: undefined,
107
+ },
108
+ columns: {
109
+ type: Array,
110
+ required: true,
111
+ },
112
+ columnsDefaultValue: {
113
+ type: [String, Number],
114
+ required: false,
115
+ default: "",
116
+ },
117
+ columnWidthDefault: {
118
+ type: Number,
119
+ required: false,
120
+ default: 250,
121
+ },
122
+ countAllRows: {
123
+ type: Number,
124
+ required: false,
125
+ default: undefined,
126
+ },
127
+ countVisibleMobileColumns: {
128
+ type: Number,
129
+ required: false,
130
+ default: 4,
131
+ validator: value => value > 0,
132
+ },
133
+ borderType: {
134
+ type: String,
135
+ required: false,
136
+ default: () => tablePluginOptions.value.propsDefault.borderType,
137
+ validator: value => ["bordered", "innerBordered"].indexOf(value) !== -1,
138
+ },
139
+ data: {
140
+ type: [Array, Object, Promise],
141
+ required: false,
142
+ },
143
+ disabledActions: {
144
+ type: Boolean,
145
+ required: false,
146
+ },
147
+ disabledMultipleActions: {
148
+ type: Boolean,
149
+ required: false,
150
+ },
151
+ disabledOptions: {
152
+ type: Boolean,
153
+ required: false,
154
+ },
155
+ disabledPreview: {
156
+ type: Boolean,
157
+ required: false,
158
+ },
159
+ disabledPreviewRowCallback: {
160
+ type: Function,
161
+ required: false,
162
+ },
163
+ disabledRowActions: {
164
+ type: Boolean,
165
+ required: false,
166
+ },
167
+ disabledSort: {
168
+ type: Boolean,
169
+ required: false,
170
+ },
171
+ disabledViews: {
172
+ type: Boolean,
173
+ required: false,
174
+ },
175
+ extra: {
176
+ type: Object,
177
+ required: false,
178
+ default: undefined,
179
+ },
180
+ hasMobile: {
181
+ type: Boolean,
182
+ required: false,
183
+ default: true,
184
+ },
185
+ hasScrollClass: {
186
+ type: Boolean,
187
+ required: false,
188
+ default: true,
189
+ },
190
+ id: {
191
+ type: String,
192
+ required: false,
193
+ default: () => uniqueId("a_table"),
194
+ },
195
+ isActionColumnVisible: {
196
+ type: Boolean,
197
+ required: false,
198
+ default: false,
199
+ },
200
+ isActionIconVisible: {
201
+ type: Boolean,
202
+ required: false,
203
+ default: true,
204
+ },
205
+ isColumnsDnd: {
206
+ type: Boolean,
207
+ required: false,
208
+ default: false,
209
+ },
210
+ isLabelVisible: {
211
+ type: Boolean,
212
+ required: false,
213
+ default: true,
214
+ },
215
+ isLoadingMultipleActions: {
216
+ type: Boolean,
217
+ required: false,
218
+ },
219
+ isLoadingOptions: {
220
+ type: Boolean,
221
+ required: false,
222
+ },
223
+ isLoadingTable: {
224
+ type: Boolean,
225
+ required: false,
226
+ },
227
+ isQuickSearch: {
228
+ type: Boolean,
229
+ required: false,
230
+ },
231
+ isSimpleTable: {
232
+ type: Boolean,
233
+ required: false,
234
+ default: false,
235
+ },
236
+ isSortingMultiColumn: {
237
+ type: Boolean,
238
+ required: false,
239
+ default: false,
240
+ },
241
+ isSortingOutside: {
242
+ type: Boolean,
243
+ required: false,
244
+ },
245
+ isTree: {
246
+ type: Boolean,
247
+ required: false,
248
+ },
249
+ isTreeCollapsible: {
250
+ type: Boolean,
251
+ required: false,
252
+ default: true,
253
+ },
254
+ isTreeOpened: {
255
+ type: Boolean,
256
+ required: false,
257
+ },
258
+ keyCountAllRowsInData: {
259
+ type: String,
260
+ required: false,
261
+ default: "count",
262
+ },
263
+ keyId: {
264
+ type: String,
265
+ required: false,
266
+ default: undefined,
267
+ },
268
+ keyChildren: {
269
+ type: String,
270
+ required: false,
271
+ default: "children",
272
+ },
273
+ label: {
274
+ type: [String, Number],
275
+ required: false,
276
+ default: "",
277
+ },
278
+ labelClass: {
279
+ type: [String, Object],
280
+ required: false,
281
+ default: undefined,
282
+ },
283
+ labelTag: {
284
+ type: String,
285
+ required: false,
286
+ default: "h2",
287
+ },
288
+ modelColumnsOrdering: {
289
+ type: Array,
290
+ required: false,
291
+ default: () => [],
292
+ },
293
+ modelColumnsVisible: {
294
+ type: Object,
295
+ required: false,
296
+ default: () => ({}),
297
+ },
298
+ modelIsTableWithoutScrollStart: {
299
+ type: Boolean,
300
+ required: false,
301
+ default: false,
302
+ },
303
+ modelQuickSearch: {
304
+ type: String,
305
+ required: false,
306
+ default: "",
307
+ },
308
+ modelSort: {
309
+ type: [String, Array],
310
+ required: false,
311
+ default: () => [],
312
+ },
313
+ modelView: {
314
+ type: [String, Number],
315
+ required: false,
316
+ default: undefined,
317
+ },
318
+ multipleActions: {
319
+ type: Array,
320
+ required: false,
321
+ default: () => [],
322
+ },
323
+ offsetStart: {
324
+ type: Number,
325
+ required: false,
326
+ default: 0,
327
+ },
328
+ pagination: {
329
+ type: Object,
330
+ required: false,
331
+ default: () => ({
332
+ use: false,
333
+ maxPages: 5,
334
+ limitsPerPage: [],
335
+ limitStart: 10,
336
+ disabled: false,
337
+ isOutside: false,
338
+ outside: false,
339
+ position: "bottom",
340
+ modes: {
341
+ /*
342
+ * perPage: inline / select
343
+ * pagination: normal / short / loadMore
344
+ */
345
+ desktop: {
346
+ pagination: {
347
+ mode: "normal",
348
+ position: 0,
349
+ },
350
+ perPage: {
351
+ mode: "inline",
352
+ position: 1,
353
+ },
354
+ },
355
+ mobile: {
356
+ pagination: {
357
+ mode: "loadMore",
358
+ },
359
+ },
360
+ },
361
+ }),
362
+ },
363
+ preview: {
364
+ type: String,
365
+ required: false,
366
+ default: undefined,
367
+ validator: value => ["right", "down"].indexOf(value) !== -1,
368
+ },
369
+ previewBoxWidth: {
370
+ type: Number,
371
+ required: false,
372
+ default: 300,
373
+ },
374
+ previewStyles: {
375
+ type: [String, Object],
376
+ required: false,
377
+ default: undefined,
378
+ },
379
+ rowActions: {
380
+ type: Array,
381
+ required: false,
382
+ default: () => [],
383
+ },
384
+ rowActionsClass: {
385
+ type: [String, Object],
386
+ required: false,
387
+ default: undefined,
388
+ },
389
+ rowActionsSticky: {
390
+ type: Boolean,
391
+ required: false,
392
+ default: true,
393
+ },
394
+ rowClass: {
395
+ type: [String, Object, Function],
396
+ required: false,
397
+ default: undefined,
398
+ },
399
+ rowsCountRenderPerTick: {
400
+ type: Number,
401
+ required: false,
402
+ default: 25,
403
+ validator: value => isInteger(value) && value >= 0,
404
+ },
405
+ rowsFooter: {
406
+ type: Array,
407
+ required: false,
408
+ default: () => [],
409
+ },
410
+ showCount: {
411
+ type: Boolean,
412
+ required: false,
413
+ default: true,
414
+ },
415
+ showFirstSortingSequenceNumber: {
416
+ type: Boolean,
417
+ required: false,
418
+ default: false,
419
+ },
420
+ sortingMultiColumnKey: {
421
+ type: String,
422
+ required: false,
423
+ default: "shift",
424
+ validator: value => ["shift", "ctrl", "alt"].indexOf(value) !== -1,
425
+ },
426
+ sortingSequenceNumberClass: {
427
+ type: [String, Object],
428
+ required: false,
429
+ default: "a_badge",
430
+ },
431
+ tableActions: {
432
+ type: Array,
433
+ required: false,
434
+ default: () => [],
435
+ },
436
+ tableActionsIndexFirstDropdownAction: {
437
+ type: Number,
438
+ required: false,
439
+ default: -1,
440
+ },
441
+ tableActionsIndexFirstDropdownActionMobile: {
442
+ type: Number,
443
+ required: false,
444
+ default: 0,
445
+ },
446
+ texts: {
447
+ type: Object,
448
+ required: false,
449
+ default: () => ({
450
+ empty: "_A_TABLE_EMPTY_TEXT_",
451
+ }),
452
+ },
453
+ useAdditionalSorting: {
454
+ type: Boolean,
455
+ required: false,
456
+ default: true,
457
+ },
458
+ useViewSlot: {
459
+ type: Boolean,
460
+ required: false,
461
+ },
462
+ useRem: {
463
+ type: Boolean,
464
+ required: false,
465
+ default: true,
466
+ },
467
+ valuesForColumnDefault: {
468
+ type: Array,
469
+ required: false,
470
+ default: () => [null, undefined, ""],
471
+ },
472
+ views: {
473
+ type: Array,
474
+ required: false,
475
+ default: () => [],
476
+ },
477
+ },
478
+ emits: [
479
+ "changeColumnsOrdering",
480
+ "changeColumnsVisible",
481
+ "changeLimit",
482
+ "changeOffset",
483
+ "changeSorting",
484
+ "mouseupResizePreviewRight",
485
+ "initTable",
486
+ "togglePreview",
487
+ "toggleMultipleActions",
488
+ "update:modelColumnsOrder",
489
+ "update:modelColumnsVisible",
490
+ "update:modelQuickSearch",
491
+ "updateModelIsTableWithoutScroll",
492
+ "updateView",
493
+ ],
494
+ provide() {
495
+ return {
496
+ changeModelColumnsVisible: this.changeModelColumnsVisible,
497
+ columnActionsOnePlusDropdownOptions: computed(() => this.columnActionsOnePlusDropdownOptions),
498
+ columns: computed(() => this.columns),
499
+ columnsDefaultValue: computed(() => this.columnsDefaultValue),
500
+ isLoadingOptions: computed(() => this.isLoadingOptions),
501
+ isLoadingTable: computed(() => this.isLoadingTable),
502
+ keyId: computed(() => this.keyId),
503
+ rowActions: computed(() => this.rowActions),
504
+ tableId: computed(() => this.id),
505
+ valuesForColumnDefault: computed(() => this.valuesForColumnDefault),
506
+ useRem: computed(() => this.useRem),
507
+ };
508
+ },
509
+ setup(props, context) {
510
+ const {
511
+ columnActionsWidthDefaultsRemLocal,
512
+ columnActionsWidthMinRemLocal,
513
+ columnActionsWidthRemLocal,
514
+ columnWidthDefaultRemLocal,
515
+ previewBoxWidthRemLocal,
516
+ } = WidthAPI(props);
517
+
518
+ const {
519
+ initModelIsTableWithoutScroll,
520
+ isActionColumnVisibleLocal,
521
+ isActionIconVisibleLocal,
522
+ isColumnsDndLocal,
523
+ isMobile,
524
+ modelIsTableWithoutScroll,
525
+ modelIsTableWithoutScrollComputed,
526
+ } = SimpleTableAPI(props);
527
+
528
+ const {
529
+ countAllRowsLocal,
530
+ } = CountAPI(props);
531
+
532
+ const {
533
+ columnsScrollInvisible,
534
+ indexFirstScrollInvisibleColumn,
535
+ isMultipleActionsActive,
536
+ modelColumnsVisibleLocal,
537
+ tableGrandparentRef,
538
+ tableRef,
539
+ } = VariablesAPI(props);
540
+
541
+ const {
542
+ scrollToTable,
543
+ setFocusToTable,
544
+ } = FocusTableAPI({
545
+ tableRef,
546
+ });
547
+
548
+ const {
549
+ hasViews,
550
+ initViewCurrent,
551
+ isViewTableVisible,
552
+ updateViewCurrent,
553
+ viewCurrent,
554
+ } = ViewsAPI(props, context, {
555
+ closePreviewAll,
556
+ });
557
+
558
+ const {
559
+ dataSorted,
560
+ initModelSort,
561
+ modelSortLocal,
562
+ useAdditionalSortingLocal,
563
+ } = SortAPI(props, {
564
+ viewCurrent,
565
+ });
566
+
567
+ const {
568
+ columnsOrderedFromSimpleTable,
569
+ renderedGroupedColumns,
570
+ } = ColumnsGroupedAPI(props, {
571
+ modelSort: modelSortLocal,
572
+ });
573
+
574
+ const {
575
+ columnIdsGroupByLocked,
576
+ columnsFilteredForRender,
577
+ columnsFilteredForRenderIndexesMapping,
578
+ columnsOrdered,
579
+ countNotHiddenColumns,
580
+ } = ColumnsAPI(props, {
581
+ columnsScrollInvisible,
582
+ indexFirstScrollInvisibleColumn,
583
+ modelColumnsVisibleLocal,
584
+ modelIsTableWithoutScrollComputed,
585
+ columnsOrderedFromSimpleTable,
586
+ });
587
+
588
+ const {
589
+ changeLimit,
590
+ changeOffset,
591
+ initLocalVars,
592
+ limit,
593
+ offset,
594
+ usePaginationBottom,
595
+ usePaginationLocal,
596
+ usePaginationTop,
597
+ } = LimitOffsetAPI(props, context, {
598
+ closePreviewAll,
599
+ scrollToTable,
600
+ setFocusToTable,
601
+ viewCurrent,
602
+ });
603
+
604
+ const {
605
+ addRow,
606
+ deleteRow,
607
+ hasRows,
608
+ rowsLocal,
609
+ rowsLocalAll,
610
+ rowsLocalLength,
611
+ stopRenderRows,
612
+ updateRow,
613
+ } = RowsAPI(props, {
614
+ dataSorted,
615
+ limit,
616
+ offset,
617
+ setEmptySelectedRowsIndexes,
618
+ usePaginationLocal,
619
+ });
620
+
621
+ const {
622
+ columnActionsBtnGroupMaxWidthStyle,
623
+ columnActionsWidthLocal,
624
+ columnActionsWidthMinLocal,
625
+ isColumnActionWide,
626
+ } = ColumnActionAPI(props, {
627
+ columnActionsWidthDefaultsRemLocal,
628
+ columnActionsWidthMinRemLocal,
629
+ columnActionsWidthRemLocal,
630
+ isMobile,
631
+ rowsLocal,
632
+ });
633
+
634
+ const {
635
+ aTableRef,
636
+ changeModelIsTableWithoutScroll,
637
+ checkVisibleColumns,
638
+ columnsVisibleAdditionalSpaceForOneGrow,
639
+ onWatchMobileScrollControl,
640
+ } = ScrollControlAPI(props, context, {
641
+ columnActionsWidthLocal,
642
+ columnActionsWidthMinLocal,
643
+ columnsOrdered,
644
+ columnsScrollInvisible,
645
+ columnWidthDefaultRemLocal,
646
+ indexFirstScrollInvisibleColumn,
647
+ isMobile,
648
+ isMultipleActionsActive,
649
+ modelColumnsVisibleLocal,
650
+ modelIsTableWithoutScroll,
651
+ modelIsTableWithoutScrollComputed,
652
+ });
653
+
654
+ const {
655
+ changeColumnsOrdering,
656
+ checkColumnsOrdering,
657
+ } = ColumnsOrderingAPI(props, context, {
658
+ checkVisibleColumns,
659
+ columnIdsGroupByLocked,
660
+ columnsFilteredForRenderIndexesMapping,
661
+ });
662
+
663
+ const {
664
+ isRowActionsStickyLocal,
665
+ } = StickyAPI(props, {
666
+ isMobile,
667
+ modelIsTableWithoutScrollComputed,
668
+ });
669
+
670
+ const {
671
+ areAllRowsSelected,
672
+ areAllVisibleRowsSelected,
673
+ areSomeRowsSelected,
674
+ closeMultipleActionsActive,
675
+ currentMultipleActions,
676
+ hasMultipleActions,
677
+ selectedRows,
678
+ selectedRowsIndexes,
679
+ setEmptySelectedRowsIndexes: _setEmptySelectedRowsIndexes,
680
+ setSelectedRowsIndexes,
681
+ toggleBtnAllRows,
682
+ toggleMultipleActionsActive,
683
+ } = MultipleActionAPI(props, context, {
684
+ checkVisibleColumns,
685
+ isMultipleActionsActive,
686
+ rowsLocalAll,
687
+ rowsLocalLength,
688
+ });
689
+
690
+ const {
691
+ changeModelColumnsVisible,
692
+ } = TableColumnsVisibleFunctionAPI(props, context, {
693
+ modelColumnsVisibleLocal,
694
+ checkVisibleColumns,
695
+ });
696
+
697
+ const {
698
+ closePreview,
699
+ closePreviewAll: _closePreviewAll,
700
+ hasPreview,
701
+ isPreviewRightOpen,
702
+ onTogglePreview,
703
+ mousedownResizePreviewRight,
704
+ mousemoveResizePreviewRight,
705
+ mouseupResizePreviewRight,
706
+ previewDownRowIds,
707
+ previewRightRowIndex,
708
+ previewRightRowIndexLast,
709
+ togglePreviewResize,
710
+ } = PreviewAPI(props, context, {
711
+ aTableRef,
712
+ isMobile,
713
+ previewBoxWidthRemLocal,
714
+ rowsLocalAll,
715
+ tableGrandparentRef,
716
+ });
717
+
718
+ const {
719
+ tableChildRole,
720
+ tableLabelId,
721
+ tableRoleAttributes,
722
+ } = TableAttributesAPI(props, {
723
+ countNotHiddenColumns,
724
+ isMobile,
725
+ });
726
+
727
+ const {
728
+ allVisibleMobileColumns,
729
+ } = MobileColumnsAPI({
730
+ columnsOrdered,
731
+ isMobile,
732
+ modelColumnsVisibleLocal,
733
+ });
734
+
735
+ const {
736
+ changeModelSort,
737
+ } = SortChangeAPI(props, context, {
738
+ modelSortLocal,
739
+ closePreviewAll,
740
+ });
741
+
742
+ const {
743
+ paginationModes,
744
+ } = PaginationModesAPI(props, {
745
+ isMobile,
746
+ });
747
+
748
+ const {
749
+ initTable,
750
+ } = InitAPI(props, context, {
751
+ checkColumnsOrdering,
752
+ checkVisibleColumns,
753
+ modelColumnsVisibleLocal,
754
+ });
755
+
756
+ const {
757
+ emptyText,
758
+ } = TextsAPI(props);
759
+
760
+ function closePreviewAll() {
761
+ _closePreviewAll();
762
+ }
763
+
764
+ function setEmptySelectedRowsIndexes() {
765
+ _setEmptySelectedRowsIndexes();
766
+ }
767
+
768
+ watch(isMobile, newValue => {
769
+ onWatchMobileScrollControl(newValue);
770
+ closePreviewAll();
771
+ });
772
+
773
+ watch(isColumnActionWide, (newValue, oldValue) => {
774
+ if (newValue !== oldValue) {
775
+ checkVisibleColumns();
776
+ }
777
+ });
778
+
779
+ provide("changeModelIsTableWithoutScroll", changeModelIsTableWithoutScroll);
780
+ provide("changeModelSort", changeModelSort);
781
+ provide("columnsOrdered", columnsOrdered);
782
+ provide("columnsFilteredForRender", columnsFilteredForRender);
783
+ provide("columnsScrollInvisible", columnsScrollInvisible);
784
+ provide("columnWidthDefault", columnWidthDefaultRemLocal);
785
+ provide("columnsVisibleAdditionalSpaceForOneGrow", columnsVisibleAdditionalSpaceForOneGrow);
786
+ provide("columnActionsWidthLocal", columnActionsWidthLocal);
787
+ provide("columnActionsWidthMinLocal", columnActionsWidthMinLocal);
788
+ provide("currentMultipleActions", currentMultipleActions);
789
+ provide("hasPreview", hasPreview);
790
+ provide("indexFirstScrollInvisibleColumn", indexFirstScrollInvisibleColumn);
791
+ provide("isActionColumnVisible", isActionColumnVisibleLocal);
792
+ provide("isActionIconVisible", isActionIconVisibleLocal);
793
+ provide("isColumnsDnd", isColumnsDndLocal);
794
+ provide("isMobile", isMobile);
795
+ provide("isMultipleActionsActive", isMultipleActionsActive);
796
+ provide("modelIsTableWithoutScroll", modelIsTableWithoutScrollComputed);
797
+ provide("onTogglePreview", onTogglePreview);
798
+ provide("previewRightRowIndex", previewRightRowIndex);
799
+ provide("previewRightRowIndexLast", previewRightRowIndexLast);
800
+
801
+ provide("rowsLocalAll", rowsLocalAll);
802
+ provide("modelColumnsVisibleLocal", modelColumnsVisibleLocal);
803
+ provide("changeColumnsOrdering", changeColumnsOrdering);
804
+
805
+ initLocalVars();
806
+ initModelIsTableWithoutScroll();
807
+ initViewCurrent();
808
+ initTable();
809
+ initModelSort();
810
+
811
+ return {
812
+ addRow,
813
+ allVisibleMobileColumns,
814
+ areAllRowsSelected,
815
+ areAllVisibleRowsSelected,
816
+ areSomeRowsSelected,
817
+ aTableRef,
818
+ changeLimit,
819
+ changeModelColumnsVisible,
820
+ changeOffset,
821
+ checkVisibleColumns,
822
+ closeMultipleActionsActive,
823
+ closePreview,
824
+ closePreviewAll,
825
+ columnActionsBtnGroupMaxWidthStyle,
826
+ columnsFilteredForRender,
827
+ columnsOrdered,
828
+ countAllRowsLocal,
829
+ deleteRow,
830
+ emptyText,
831
+ hasMultipleActions,
832
+ hasRows,
833
+ hasViews,
834
+ isMobile,
835
+ isMultipleActionsActive,
836
+ isPreviewRightOpen,
837
+ isRowActionsStickyLocal,
838
+ isViewTableVisible,
839
+ limit,
840
+ modelColumnsVisibleLocal,
841
+ modelIsTableWithoutScrollComputed,
842
+ modelSortLocal,
843
+ mousedownResizePreviewRight,
844
+ mousemoveResizePreviewRight,
845
+ mouseupResizePreviewRight,
846
+ offset,
847
+ onTogglePreview,
848
+ paginationModes,
849
+ previewDownRowIds,
850
+ previewRightRowIndex,
851
+ renderedGroupedColumns,
852
+ rowsLocal,
853
+ rowsLocalAll,
854
+ rowsLocalLength,
855
+ selectedRows,
856
+ selectedRowsIndexes,
857
+ setEmptySelectedRowsIndexes,
858
+ setSelectedRowsIndexes,
859
+ stopRenderRows,
860
+ tableChildRole,
861
+ tableGrandparentRef,
862
+ tableLabelId,
863
+ tableRef,
864
+ tableRoleAttributes,
865
+ toggleBtnAllRows,
866
+ toggleMultipleActionsActive,
867
+ togglePreviewResize,
868
+ updateRow,
869
+ updateViewCurrent,
870
+ useAdditionalSortingLocal,
871
+ usePaginationBottom,
872
+ usePaginationLocal,
873
+ usePaginationTop,
874
+ viewCurrent,
875
+ };
876
+ },
877
+ data() {
878
+ return {
879
+ resolved: undefined,
880
+ error: undefined,
881
+ };
882
+ },
883
+ computed: {
884
+ hasRowsFooter() {
885
+ return this.rowsFooter.length > 0;
886
+ },
887
+ },
888
+ methods: {
889
+ updateModelQuickSearch(model) {
890
+ this.$emit("update:modelQuickSearch", model);
891
+ },
892
+ },
893
+ render() {
894
+ return h("div", {
895
+ ref: "tableGrandparentRef",
896
+ class: ["a_table__grandparent", {
897
+ a_table_mobile: this.isMobile,
898
+ a_table__grandparent_without_scroll: !this.hasScrollClass,
899
+ }],
900
+ }, [
901
+ this.$slots.tablePrepend &&
902
+ this.$slots.tablePrepend({
903
+ id: this.id,
904
+ }),
905
+ h("div", {
906
+ ref: "aTableRef",
907
+ class: ["a_table__parent", {
908
+ a_table__parent_scrollable: this.hasScrollClass && !this.modelIsTableWithoutScrollComputed,
909
+ }],
910
+ }, [
911
+ h(ATableTopPanel, {
912
+ additionalSortingColumns: this.additionalSortingColumns,
913
+ areAllRowsSelected: this.areAllRowsSelected,
914
+ areSomeRowsSelected: this.areSomeRowsSelected,
915
+ closeMultipleActionsActive: this.closeMultipleActionsActive,
916
+ countAllRows: this.countAllRowsLocal,
917
+ disabledActions: this.disabledActions,
918
+ disabledMultipleActions: this.disabledMultipleActions,
919
+ disabledSort: this.disabledSort,
920
+ disabledViews: this.disabledViews,
921
+ extra: this.extra,
922
+ hasViews: this.hasViews,
923
+ isLabelVisible: this.isLabelVisible,
924
+ isLoadingMultipleActions: this.isLoadingMultipleActions,
925
+ isQuickSearch: this.isQuickSearch,
926
+ isSortingMultiColumn: this.isSortingMultiColumn,
927
+ label: this.label,
928
+ labelClass: this.labelClass,
929
+ labelTag: this.labelTag,
930
+ modelQuickSearch: this.modelQuickSearch,
931
+ modelSort: this.modelSortLocal,
932
+ modelView: this.modelView,
933
+ multipleActions: this.multipleActions,
934
+ selectedRows: this.selectedRows,
935
+ showCount: this.showCount,
936
+ tableActions: this.tableActions,
937
+ tableActionsIndexFirstDropdownAction: this.tableActionsIndexFirstDropdownAction,
938
+ tableActionsIndexFirstDropdownActionMobile: this.tableActionsIndexFirstDropdownActionMobile,
939
+ useAdditionalSorting: this.useAdditionalSortingLocal,
940
+ useViewSlot: this.useViewSlot,
941
+ viewCurrent: this.viewCurrent,
942
+ views: this.views,
943
+ onUpdateViewCurrent: this.updateViewCurrent,
944
+ onUpdateModelQuickSearch: this.updateModelQuickSearch,
945
+ onToggleMultipleActionsActive: this.toggleMultipleActionsActive,
946
+ onToggleBtnAllRows: this.toggleBtnAllRows,
947
+ }, this.$slots),
948
+ this.$slots.topPanelAppend ?
949
+ this.$slots.topPanelAppend() :
950
+ "",
951
+ (this.usePaginationLocal && this.usePaginationTop && this.hasRows) ?
952
+ h(APagination, {
953
+ class: "a_table__pagination_top",
954
+ disabled: this.pagination.disabled,
955
+ limit: this.limit,
956
+ limitsPerPage: this.pagination.limitsPerPage,
957
+ modes: this.paginationModes,
958
+ maxPages: this.pagination.maxPages,
959
+ offset: this.offset,
960
+ rowsLength: this.rowsLocalLength,
961
+ totalCount: this.countAllRowsLocal,
962
+ "onUpdate:limit": this.changeLimit,
963
+ "onUpdate:offset": this.changeOffset,
964
+ }) :
965
+ "",
966
+ this.isViewTableVisible && h("div", {
967
+ ref: "tableRef",
968
+ "aria-labelledby": this.isLabelVisible ?
969
+ this.tableLabelId :
970
+ undefined,
971
+ class: [
972
+ "a_table",
973
+ {
974
+ a_table_simple: this.isSimpleTable,
975
+ a_table_bordered: this.borderType === "bordered",
976
+ a_table_inner_bordered: this.borderType === "innerBordered",
977
+ },
978
+ ],
979
+ ...this.tableRoleAttributes,
980
+ }, [
981
+ this.isSimpleTable ?
982
+ h(ATableGroupedHeader, {
983
+ areAllRowsSelected: this.areAllRowsSelected,
984
+ areAllVisibleRowsSelected: this.areAllVisibleRowsSelected,
985
+ areSomeRowsSelected: this.areSomeRowsSelected,
986
+ disabledOptions: this.disabledOptions,
987
+ disabledSort: this.disabledSort,
988
+ hasMultipleActions: this.hasMultipleActions,
989
+ isRowActionsStickyLocal: this.isRowActionsStickyLocal,
990
+ isSortingMultiColumn: this.isSortingMultiColumn,
991
+ modelSort: this.modelSortLocal,
992
+ rowsLocalLength: this.rowsLocalLength,
993
+ showFirstSortingSequenceNumber: this.showFirstSortingSequenceNumber,
994
+ sortingSequenceNumberClass: this.sortingSequenceNumberClass,
995
+ onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
996
+ columnsForRender: this.renderedGroupedColumns,
997
+ }) :
998
+ h(ATableHeader, {
999
+ areAllRowsSelected: this.areAllRowsSelected,
1000
+ areAllVisibleRowsSelected: this.areAllVisibleRowsSelected,
1001
+ areSomeRowsSelected: this.areSomeRowsSelected,
1002
+ disabledOptions: this.disabledOptions,
1003
+ disabledSort: this.disabledSort,
1004
+ hasMultipleActions: this.hasMultipleActions,
1005
+ isRowActionsStickyLocal: this.isRowActionsStickyLocal,
1006
+ isSortingMultiColumn: this.isSortingMultiColumn,
1007
+ modelSort: this.modelSortLocal,
1008
+ rowsLocalLength: this.rowsLocalLength,
1009
+ showFirstSortingSequenceNumber: this.showFirstSortingSequenceNumber,
1010
+ sortingSequenceNumberClass: this.sortingSequenceNumberClass,
1011
+ onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
1012
+ }),
1013
+ h("div", {
1014
+ class: "a_table__loading",
1015
+ }, [
1016
+ h(ALoading, {
1017
+ isLoading: this.isLoadingTable,
1018
+ }, () => [
1019
+ h("div", {
1020
+ class: "a_table__body",
1021
+ role: this.tableChildRole,
1022
+ }, {
1023
+ default: () => this.rowsLocal.map((row, rowIndex) => {
1024
+ const ROW_ID = getRowIdOrIndex({ row, rowIndex, keyId: this.keyId });
1025
+
1026
+ return h(ATableTr, {
1027
+ key: ROW_ID,
1028
+ allVisibleMobileColumns: this.allVisibleMobileColumns,
1029
+ areAllRowsSelected: this.areAllRowsSelected,
1030
+ columnActionsBtnGroupMaxWidthStyle: this.columnActionsBtnGroupMaxWidthStyle,
1031
+ columnActionsView: this.columnActionsView,
1032
+ countVisibleMobileColumns: this.countVisibleMobileColumns,
1033
+ disabledPreview: this.disabledPreview,
1034
+ disabledPreviewRowCallback: this.disabledPreviewRowCallback,
1035
+ disabledRowActions: this.disabledRowActions,
1036
+ isFooter: false,
1037
+ isPreviewDownOpen: this.previewDownRowIds[ROW_ID],
1038
+ isRowActionsStickyLocal: this.isRowActionsStickyLocal,
1039
+ isTree: this.isTree,
1040
+ isTreeCollapsible: this.isTreeCollapsible,
1041
+ isTreeOpened: this.isTreeOpened,
1042
+ keyChildren: this.keyChildren,
1043
+ keyId: this.keyId,
1044
+ level: 1,
1045
+ row,
1046
+ rowActionsClass: this.rowActionsClass,
1047
+ rowClass: this.rowClass,
1048
+ rowIndex,
1049
+ rowsLength: this.rowsLocal.length,
1050
+ selectedRowsIndexes: this.selectedRowsIndexes,
1051
+ onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
1052
+ }, {
1053
+ get: vm => [
1054
+ h(AGet, {
1055
+ data: vm.row,
1056
+ keyLabel: vm.column.keyLabel,
1057
+ filter: vm.column.filter,
1058
+ filterParameters: vm.column.filterParameters,
1059
+ defaultValue: vm.column.defaultValue,
1060
+ tag: vm.column.filterTag || "div",
1061
+ }),
1062
+ ],
1063
+ ...this.$slots,
1064
+ });
1065
+ }),
1066
+ }),
1067
+ (this.isViewTableVisible && !this.hasRows) && h(ATranslation, {
1068
+ class: "a_table__empty_text",
1069
+ text: this.emptyText,
1070
+ }),
1071
+ this.hasRowsFooter && h("div", {
1072
+ class: "a_table__footer",
1073
+ role: this.tableChildRole,
1074
+ }, this.rowsFooter.map((row, rowIndex) => {
1075
+ const ROW_ID = getRowIdOrIndex({ row, rowIndex, keyId: this.keyId });
1076
+
1077
+ return h(ATableTr, {
1078
+ key: ROW_ID,
1079
+ allVisibleMobileColumns: this.allVisibleMobileColumns,
1080
+ areAllRowsSelected: this.areAllRowsSelected,
1081
+ columnActionsBtnGroupMaxWidthStyle: this.columnActionsBtnGroupMaxWidthStyle,
1082
+ columnActionsView: this.columnActionsView,
1083
+ countVisibleMobileColumns: this.countVisibleMobileColumns,
1084
+ disabledPreview: this.disabledPreview,
1085
+ disabledPreviewRowCallback: this.disabledPreviewRowCallback,
1086
+ disabledRowActions: this.disabledRowActions,
1087
+ isFooter: true,
1088
+ isRowActionsStickyLocal: this.isRowActionsStickyLocal,
1089
+ isTree: this.isTree,
1090
+ isTreeCollapsible: this.isTreeCollapsible,
1091
+ isTreeOpened: this.isTreeOpened,
1092
+ keyChildren: this.keyChildren,
1093
+ keyId: this.keyId,
1094
+ level: 1,
1095
+ row,
1096
+ rowActionsClass: this.rowActionsClass,
1097
+ rowClass: this.rowClass,
1098
+ rowIndex,
1099
+ rowsLength: this.rowsFooter.length,
1100
+ selectedRowsIndexes: this.selectedRowsIndexes,
1101
+ onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
1102
+ }, {
1103
+ get: vm => [
1104
+ h(AGet, {
1105
+ data: vm.row,
1106
+ keyLabel: vm.column.footerPath,
1107
+ filter: vm.column.footerFilter,
1108
+ filterParameters: vm.column.footerFilterParameters,
1109
+ defaultValue: vm.column.footerDefaultValue,
1110
+ }),
1111
+ ],
1112
+ ...this.$slots,
1113
+ });
1114
+ })),
1115
+ ]),
1116
+ ]),
1117
+
1118
+ ]),
1119
+ (!this.isViewTableVisible && this.viewCurrent && this.$slots[this.viewCurrent.type]) &&
1120
+ this.$slots[this.viewCurrent.type]({
1121
+ isLoading: this.isLoadingTable,
1122
+ rows: this.rowsLocalAll,
1123
+ }),
1124
+ (this.usePaginationLocal && this.usePaginationBottom && this.hasRows) ?
1125
+ h(APagination, {
1126
+ class: "a_table__pagination_bottom",
1127
+ disabled: this.pagination.disabled,
1128
+ limit: this.limit,
1129
+ limitsPerPage: this.pagination.limitsPerPage,
1130
+ maxPages: this.pagination.maxPages,
1131
+ modes: this.paginationModes,
1132
+ offset: this.offset,
1133
+ rowsLength: this.rowsLocalLength,
1134
+ totalCount: this.countAllRowsLocal,
1135
+ "onUpdate:limit": this.changeLimit,
1136
+ "onUpdate:offset": this.changeOffset,
1137
+ }) :
1138
+ "",
1139
+ this.isPreviewRightOpen ?
1140
+ h(ATablePreviewRight, {
1141
+ countAllRows: this.countAllRowsLocal,
1142
+ isMobile: this.isMobile,
1143
+ isLoadingTable: this.isLoadingTable,
1144
+ limitPagination: this.limit,
1145
+ offsetPagination: this.offset,
1146
+ previewStyles: this.previewStyles,
1147
+ rowIndex: this.previewRightRowIndex,
1148
+ rows: this.rowsLocalAll,
1149
+ disabledPreviewRowCallback: this.disabledPreviewRowCallback,
1150
+ usePagination: !!this.usePaginationLocal,
1151
+ onClosePreview: this.closePreview,
1152
+ onMousedownResizePreviewRight: this.mousedownResizePreviewRight,
1153
+ onMousemoveResizePreviewRight: this.mousemoveResizePreviewRight,
1154
+ onMouseupResizePreviewRight: this.mouseupResizePreviewRight,
1155
+ onTogglePreview: this.onTogglePreview,
1156
+ onTogglePreviewResize: this.togglePreviewResize,
1157
+ "onUpdate:offset": this.changeOffset,
1158
+ }, this.$slots) :
1159
+ "",
1160
+ ]),
1161
+ ]);
1162
+ },
1163
+ };