@expcat/tigercat-vue 0.4.2 → 0.4.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.
- package/dist/{chunk-DEFEAEYE.mjs → chunk-BS52UCMT.mjs} +107 -94
- package/dist/{chunk-TCJBN2DA.mjs → chunk-CWDBL5YC.mjs} +1 -1
- package/dist/{chunk-LGRUMMOG.js → chunk-HBZHIEDV.js} +2 -2
- package/dist/{chunk-WV3Y45YK.js → chunk-NUFSJMVC.js} +106 -93
- package/dist/components/CommentThread.d.mts +2 -2
- package/dist/components/CommentThread.d.ts +2 -2
- package/dist/components/DataTableWithToolbar.js +4 -4
- package/dist/components/DataTableWithToolbar.mjs +2 -2
- package/dist/components/Table.d.mts +2 -2
- package/dist/components/Table.d.ts +2 -2
- package/dist/components/Table.js +3 -3
- package/dist/components/Table.mjs +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, computed, ref, watch, h } from 'vue';
|
|
2
|
-
import { getSpinnerSVG, getFixedColumnOffsets, filterData, sortData, paginateData, getRowKey, calculatePagination, getTableWrapperClasses, classNames, tableBaseClasses, tableLoadingOverlayClasses, getSimplePaginationContainerClasses, getSimplePaginationTotalClasses, getSimplePaginationControlsClasses, getSimplePaginationSelectClasses, getSimplePaginationButtonsWrapperClasses, getSimplePaginationButtonClasses, getSimplePaginationPageIndicatorClasses,
|
|
2
|
+
import { getSpinnerSVG, getFixedColumnOffsets, filterData, sortData, paginateData, getRowKey, calculatePagination, getTableWrapperClasses, classNames, tableBaseClasses, tableLoadingOverlayClasses, getSimplePaginationContainerClasses, getSimplePaginationTotalClasses, getSimplePaginationControlsClasses, getSimplePaginationSelectClasses, getSimplePaginationButtonsWrapperClasses, getSimplePaginationButtonClasses, getSimplePaginationPageIndicatorClasses, getExpandIconCellClasses, getCheckboxCellClasses, getTableHeaderCellClasses, getTableHeaderClasses, tableEmptyStateClasses, getTableCellClasses, getTableRowClasses, getExpandedRowClasses, getExpandedRowContentClasses, getLoadingOverlaySpinnerClasses, normalizeSvgAttrs, icon24ViewBox, lockClosedIcon24PathD, lockOpenIcon24PathD, icon16ViewBox, getSortIconClasses, sortAscIcon16PathD, sortDescIcon16PathD, sortBothIcon16PathD, getExpandIconClasses, expandChevronIcon16PathD } from '@expcat/tigercat-core';
|
|
3
3
|
|
|
4
4
|
// src/components/Table.ts
|
|
5
5
|
var spinnerSvg = getSpinnerSVG("spinner");
|
|
@@ -31,6 +31,20 @@ var LockIcon = (locked) => {
|
|
|
31
31
|
[h("path", { d: locked ? lockClosedIcon24PathD : lockOpenIcon24PathD })]
|
|
32
32
|
);
|
|
33
33
|
};
|
|
34
|
+
var ExpandIcon = (expanded) => {
|
|
35
|
+
return h(
|
|
36
|
+
"svg",
|
|
37
|
+
{
|
|
38
|
+
class: getExpandIconClasses(expanded),
|
|
39
|
+
width: "16",
|
|
40
|
+
height: "16",
|
|
41
|
+
viewBox: icon16ViewBox,
|
|
42
|
+
fill: "currentColor",
|
|
43
|
+
"aria-hidden": "true"
|
|
44
|
+
},
|
|
45
|
+
[h("path", { d: expandChevronIcon16PathD })]
|
|
46
|
+
);
|
|
47
|
+
};
|
|
34
48
|
var LoadingSpinner = () => {
|
|
35
49
|
return h(
|
|
36
50
|
"svg",
|
|
@@ -205,7 +219,7 @@ var Table = defineComponent({
|
|
|
205
219
|
"sort-change",
|
|
206
220
|
"filter-change",
|
|
207
221
|
"page-change",
|
|
208
|
-
"
|
|
222
|
+
"expand-change"
|
|
209
223
|
],
|
|
210
224
|
setup(props, { emit, slots }) {
|
|
211
225
|
const paginationConfig = computed(() => {
|
|
@@ -245,7 +259,6 @@ var Table = defineComponent({
|
|
|
245
259
|
const expandedRowKeys = computed(() => {
|
|
246
260
|
return props.expandable?.expandedRowKeys ?? uncontrolledExpandedRowKeys.value;
|
|
247
261
|
});
|
|
248
|
-
const expandedRowKeySet = computed(() => new Set(expandedRowKeys.value));
|
|
249
262
|
watch(
|
|
250
263
|
() => props.sort,
|
|
251
264
|
(next) => {
|
|
@@ -286,6 +299,14 @@ var Table = defineComponent({
|
|
|
286
299
|
}
|
|
287
300
|
}
|
|
288
301
|
);
|
|
302
|
+
watch(
|
|
303
|
+
() => props.expandable?.expandedRowKeys,
|
|
304
|
+
(next) => {
|
|
305
|
+
if (next !== void 0) {
|
|
306
|
+
uncontrolledExpandedRowKeys.value = next;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
);
|
|
289
310
|
const fixedOverrides = ref({});
|
|
290
311
|
const displayColumns = computed(() => {
|
|
291
312
|
return props.columns.map((column) => {
|
|
@@ -334,6 +355,15 @@ var Table = defineComponent({
|
|
|
334
355
|
const selectedRowKeySet = computed(() => {
|
|
335
356
|
return new Set(selectedRowKeys.value);
|
|
336
357
|
});
|
|
358
|
+
const expandedRowKeySet = computed(() => {
|
|
359
|
+
return new Set(expandedRowKeys.value);
|
|
360
|
+
});
|
|
361
|
+
const totalColumnCount = computed(() => {
|
|
362
|
+
let count = displayColumns.value.length;
|
|
363
|
+
if (props.rowSelection) count += 1;
|
|
364
|
+
if (props.expandable) count += 1;
|
|
365
|
+
return count;
|
|
366
|
+
});
|
|
337
367
|
const paginationInfo = computed(() => {
|
|
338
368
|
if (props.pagination === false) {
|
|
339
369
|
return null;
|
|
@@ -417,6 +447,21 @@ var Table = defineComponent({
|
|
|
417
447
|
}
|
|
418
448
|
function handleRowClick(record, index) {
|
|
419
449
|
emit("row-click", record, index);
|
|
450
|
+
if (props.expandable?.expandRowByClick) {
|
|
451
|
+
const key = getRowKey(record, props.rowKey, index);
|
|
452
|
+
const isExpandable = props.expandable?.rowExpandable ? props.expandable.rowExpandable(record) : true;
|
|
453
|
+
if (isExpandable) {
|
|
454
|
+
handleToggleExpand(key, record);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
function handleToggleExpand(key, record) {
|
|
459
|
+
const isExpanded = expandedRowKeySet.value.has(key);
|
|
460
|
+
const newKeys = isExpanded ? expandedRowKeys.value.filter((k) => k !== key) : [...expandedRowKeys.value, key];
|
|
461
|
+
if (!isExpandControlled.value) {
|
|
462
|
+
uncontrolledExpandedRowKeys.value = newKeys;
|
|
463
|
+
}
|
|
464
|
+
emit("expand-change", newKeys, record, !isExpanded);
|
|
420
465
|
}
|
|
421
466
|
function handleSelectRow(key, checked) {
|
|
422
467
|
let newKeys;
|
|
@@ -457,24 +502,16 @@ var Table = defineComponent({
|
|
|
457
502
|
const someSelected = computed(() => {
|
|
458
503
|
return selectedRowKeys.value.length > 0 && !allSelected.value;
|
|
459
504
|
});
|
|
460
|
-
function handleToggleExpand(key) {
|
|
461
|
-
const isExp = expandedRowKeySet.value.has(key);
|
|
462
|
-
const next = isExp ? expandedRowKeys.value.filter((k) => k !== key) : [...expandedRowKeys.value, key];
|
|
463
|
-
if (!isExpandControlled.value) {
|
|
464
|
-
uncontrolledExpandedRowKeys.value = next;
|
|
465
|
-
}
|
|
466
|
-
emit("expanded-rows-change", next);
|
|
467
|
-
}
|
|
468
|
-
const totalColumnCount = computed(() => {
|
|
469
|
-
let count = displayColumns.value.length;
|
|
470
|
-
if (props.rowSelection && props.rowSelection.showCheckbox !== false) count++;
|
|
471
|
-
if (props.expandable) count++;
|
|
472
|
-
return count;
|
|
473
|
-
});
|
|
474
505
|
function renderTableHeader() {
|
|
475
506
|
const headerCells = [];
|
|
476
|
-
|
|
477
|
-
|
|
507
|
+
const expandAtStart = props.expandable && props.expandable.expandIconPosition !== "end";
|
|
508
|
+
const expandAtEnd = props.expandable && props.expandable.expandIconPosition === "end";
|
|
509
|
+
const expandHeaderTh = props.expandable ? h("th", {
|
|
510
|
+
class: getExpandIconCellClasses(props.size),
|
|
511
|
+
"aria-label": "Expand"
|
|
512
|
+
}) : null;
|
|
513
|
+
if (expandAtStart && expandHeaderTh) {
|
|
514
|
+
headerCells.push(expandHeaderTh);
|
|
478
515
|
}
|
|
479
516
|
if (props.rowSelection && props.rowSelection.showCheckbox !== false && props.rowSelection.type !== "radio") {
|
|
480
517
|
headerCells.push(
|
|
@@ -595,8 +632,8 @@ var Table = defineComponent({
|
|
|
595
632
|
)
|
|
596
633
|
);
|
|
597
634
|
});
|
|
598
|
-
if (
|
|
599
|
-
headerCells.push(
|
|
635
|
+
if (expandAtEnd && expandHeaderTh) {
|
|
636
|
+
headerCells.push(expandHeaderTh);
|
|
600
637
|
}
|
|
601
638
|
return h("thead", { class: getTableHeaderClasses(props.stickyHeader) }, [
|
|
602
639
|
h("tr", headerCells)
|
|
@@ -633,40 +670,34 @@ var Table = defineComponent({
|
|
|
633
670
|
const key = paginatedRowKeys.value[index];
|
|
634
671
|
const isSelected = selectedRowKeySet.value.has(key);
|
|
635
672
|
const isExpanded = expandedRowKeySet.value.has(key);
|
|
636
|
-
const
|
|
673
|
+
const isRowExpandable = props.expandable ? props.expandable.rowExpandable ? props.expandable.rowExpandable(record) : true : false;
|
|
637
674
|
const rowClass = typeof props.rowClassName === "function" ? props.rowClassName(record, index) : props.rowClassName;
|
|
638
675
|
const cells = [];
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
[h("path", { d: "M6 3l6 5-6 5V3z" })]
|
|
665
|
-
)
|
|
666
|
-
]
|
|
667
|
-
) : null
|
|
668
|
-
])
|
|
669
|
-
);
|
|
676
|
+
const expandAtStart = props.expandable && props.expandable.expandIconPosition !== "end";
|
|
677
|
+
const expandToggleCell = props.expandable ? h(
|
|
678
|
+
"td",
|
|
679
|
+
{
|
|
680
|
+
class: getExpandIconCellClasses(props.size)
|
|
681
|
+
},
|
|
682
|
+
isRowExpandable ? [
|
|
683
|
+
h(
|
|
684
|
+
"button",
|
|
685
|
+
{
|
|
686
|
+
type: "button",
|
|
687
|
+
class: "inline-flex items-center justify-center",
|
|
688
|
+
"aria-label": isExpanded ? "Collapse row" : "Expand row",
|
|
689
|
+
"aria-expanded": isExpanded,
|
|
690
|
+
onClick: (e) => {
|
|
691
|
+
e.stopPropagation();
|
|
692
|
+
handleToggleExpand(key, record);
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
[ExpandIcon(isExpanded)]
|
|
696
|
+
)
|
|
697
|
+
] : []
|
|
698
|
+
) : null;
|
|
699
|
+
if (expandAtStart && expandToggleCell) {
|
|
700
|
+
cells.push(expandToggleCell);
|
|
670
701
|
}
|
|
671
702
|
if (props.rowSelection && props.rowSelection.showCheckbox !== false) {
|
|
672
703
|
const checkboxProps = props.rowSelection?.getCheckboxProps?.(record) || {};
|
|
@@ -729,39 +760,10 @@ var Table = defineComponent({
|
|
|
729
760
|
)
|
|
730
761
|
);
|
|
731
762
|
});
|
|
732
|
-
if (
|
|
733
|
-
cells.push(
|
|
734
|
-
h("td", { class: getExpandCellClasses(props.size) }, [
|
|
735
|
-
isExpandable ? h(
|
|
736
|
-
"button",
|
|
737
|
-
{
|
|
738
|
-
class: classNames(
|
|
739
|
-
expandIconButtonClasses,
|
|
740
|
-
getExpandIconRotationClasses(isExpanded)
|
|
741
|
-
),
|
|
742
|
-
"aria-label": isExpanded ? "Collapse row" : "Expand row",
|
|
743
|
-
onClick: (e) => {
|
|
744
|
-
e.stopPropagation();
|
|
745
|
-
handleToggleExpand(key);
|
|
746
|
-
}
|
|
747
|
-
},
|
|
748
|
-
[
|
|
749
|
-
h(
|
|
750
|
-
"svg",
|
|
751
|
-
normalizeSvgAttrs({
|
|
752
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
753
|
-
viewBox: icon16ViewBox,
|
|
754
|
-
fill: "currentColor",
|
|
755
|
-
class: "w-4 h-4"
|
|
756
|
-
}),
|
|
757
|
-
[h("path", { d: "M6 3l6 5-6 5V3z" })]
|
|
758
|
-
)
|
|
759
|
-
]
|
|
760
|
-
) : null
|
|
761
|
-
])
|
|
762
|
-
);
|
|
763
|
+
if (!expandAtStart && expandToggleCell) {
|
|
764
|
+
cells.push(expandToggleCell);
|
|
763
765
|
}
|
|
764
|
-
const
|
|
766
|
+
const rowNode = h(
|
|
765
767
|
"tr",
|
|
766
768
|
{
|
|
767
769
|
key,
|
|
@@ -773,17 +775,28 @@ var Table = defineComponent({
|
|
|
773
775
|
},
|
|
774
776
|
cells
|
|
775
777
|
);
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
778
|
+
if (props.expandable && isExpanded && isRowExpandable) {
|
|
779
|
+
const expandedContent = slots["expanded-row"]?.({ record, index }) || (props.expandable.expandedRowRender ? props.expandable.expandedRowRender(record, index) : null);
|
|
780
|
+
const expandedRow = h(
|
|
781
|
+
"tr",
|
|
782
|
+
{
|
|
783
|
+
key: `${key}-expanded`,
|
|
784
|
+
class: getExpandedRowClasses()
|
|
785
|
+
},
|
|
786
|
+
[
|
|
787
|
+
h(
|
|
788
|
+
"td",
|
|
789
|
+
{
|
|
790
|
+
colspan: totalColumnCount.value,
|
|
791
|
+
class: getExpandedRowContentClasses(props.size)
|
|
792
|
+
},
|
|
793
|
+
[expandedContent]
|
|
794
|
+
)
|
|
795
|
+
]
|
|
784
796
|
);
|
|
797
|
+
return [rowNode, expandedRow];
|
|
785
798
|
}
|
|
786
|
-
return
|
|
799
|
+
return rowNode;
|
|
787
800
|
});
|
|
788
801
|
return h("tbody", rows);
|
|
789
802
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNUFSJMVC_js = require('./chunk-NUFSJMVC.js');
|
|
4
4
|
var chunkHNQZ5JRB_js = require('./chunk-HNQZ5JRB.js');
|
|
5
5
|
var chunkAGAJJYP2_js = require('./chunk-AGAJJYP2.js');
|
|
6
6
|
var chunkWC4B72TZ_js = require('./chunk-WC4B72TZ.js');
|
|
@@ -338,7 +338,7 @@ var DataTableWithToolbar = vue.defineComponent({
|
|
|
338
338
|
},
|
|
339
339
|
[
|
|
340
340
|
renderToolbar(),
|
|
341
|
-
vue.h(
|
|
341
|
+
vue.h(chunkNUFSJMVC_js.Table, tableProps),
|
|
342
342
|
showPagination ? vue.h(chunkAGAJJYP2_js.Pagination, {
|
|
343
343
|
...props.pagination,
|
|
344
344
|
onChange: (current, pageSize) => emit("page-change", current, pageSize),
|
|
@@ -33,6 +33,20 @@ var LockIcon = (locked) => {
|
|
|
33
33
|
[vue.h("path", { d: locked ? tigercatCore.lockClosedIcon24PathD : tigercatCore.lockOpenIcon24PathD })]
|
|
34
34
|
);
|
|
35
35
|
};
|
|
36
|
+
var ExpandIcon = (expanded) => {
|
|
37
|
+
return vue.h(
|
|
38
|
+
"svg",
|
|
39
|
+
{
|
|
40
|
+
class: tigercatCore.getExpandIconClasses(expanded),
|
|
41
|
+
width: "16",
|
|
42
|
+
height: "16",
|
|
43
|
+
viewBox: tigercatCore.icon16ViewBox,
|
|
44
|
+
fill: "currentColor",
|
|
45
|
+
"aria-hidden": "true"
|
|
46
|
+
},
|
|
47
|
+
[vue.h("path", { d: tigercatCore.expandChevronIcon16PathD })]
|
|
48
|
+
);
|
|
49
|
+
};
|
|
36
50
|
var LoadingSpinner = () => {
|
|
37
51
|
return vue.h(
|
|
38
52
|
"svg",
|
|
@@ -207,7 +221,7 @@ var Table = vue.defineComponent({
|
|
|
207
221
|
"sort-change",
|
|
208
222
|
"filter-change",
|
|
209
223
|
"page-change",
|
|
210
|
-
"
|
|
224
|
+
"expand-change"
|
|
211
225
|
],
|
|
212
226
|
setup(props, { emit, slots }) {
|
|
213
227
|
const paginationConfig = vue.computed(() => {
|
|
@@ -247,7 +261,6 @@ var Table = vue.defineComponent({
|
|
|
247
261
|
const expandedRowKeys = vue.computed(() => {
|
|
248
262
|
return props.expandable?.expandedRowKeys ?? uncontrolledExpandedRowKeys.value;
|
|
249
263
|
});
|
|
250
|
-
const expandedRowKeySet = vue.computed(() => new Set(expandedRowKeys.value));
|
|
251
264
|
vue.watch(
|
|
252
265
|
() => props.sort,
|
|
253
266
|
(next) => {
|
|
@@ -288,6 +301,14 @@ var Table = vue.defineComponent({
|
|
|
288
301
|
}
|
|
289
302
|
}
|
|
290
303
|
);
|
|
304
|
+
vue.watch(
|
|
305
|
+
() => props.expandable?.expandedRowKeys,
|
|
306
|
+
(next) => {
|
|
307
|
+
if (next !== void 0) {
|
|
308
|
+
uncontrolledExpandedRowKeys.value = next;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
);
|
|
291
312
|
const fixedOverrides = vue.ref({});
|
|
292
313
|
const displayColumns = vue.computed(() => {
|
|
293
314
|
return props.columns.map((column) => {
|
|
@@ -336,6 +357,15 @@ var Table = vue.defineComponent({
|
|
|
336
357
|
const selectedRowKeySet = vue.computed(() => {
|
|
337
358
|
return new Set(selectedRowKeys.value);
|
|
338
359
|
});
|
|
360
|
+
const expandedRowKeySet = vue.computed(() => {
|
|
361
|
+
return new Set(expandedRowKeys.value);
|
|
362
|
+
});
|
|
363
|
+
const totalColumnCount = vue.computed(() => {
|
|
364
|
+
let count = displayColumns.value.length;
|
|
365
|
+
if (props.rowSelection) count += 1;
|
|
366
|
+
if (props.expandable) count += 1;
|
|
367
|
+
return count;
|
|
368
|
+
});
|
|
339
369
|
const paginationInfo = vue.computed(() => {
|
|
340
370
|
if (props.pagination === false) {
|
|
341
371
|
return null;
|
|
@@ -419,6 +449,21 @@ var Table = vue.defineComponent({
|
|
|
419
449
|
}
|
|
420
450
|
function handleRowClick(record, index) {
|
|
421
451
|
emit("row-click", record, index);
|
|
452
|
+
if (props.expandable?.expandRowByClick) {
|
|
453
|
+
const key = tigercatCore.getRowKey(record, props.rowKey, index);
|
|
454
|
+
const isExpandable = props.expandable?.rowExpandable ? props.expandable.rowExpandable(record) : true;
|
|
455
|
+
if (isExpandable) {
|
|
456
|
+
handleToggleExpand(key, record);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
function handleToggleExpand(key, record) {
|
|
461
|
+
const isExpanded = expandedRowKeySet.value.has(key);
|
|
462
|
+
const newKeys = isExpanded ? expandedRowKeys.value.filter((k) => k !== key) : [...expandedRowKeys.value, key];
|
|
463
|
+
if (!isExpandControlled.value) {
|
|
464
|
+
uncontrolledExpandedRowKeys.value = newKeys;
|
|
465
|
+
}
|
|
466
|
+
emit("expand-change", newKeys, record, !isExpanded);
|
|
422
467
|
}
|
|
423
468
|
function handleSelectRow(key, checked) {
|
|
424
469
|
let newKeys;
|
|
@@ -459,24 +504,16 @@ var Table = vue.defineComponent({
|
|
|
459
504
|
const someSelected = vue.computed(() => {
|
|
460
505
|
return selectedRowKeys.value.length > 0 && !allSelected.value;
|
|
461
506
|
});
|
|
462
|
-
function handleToggleExpand(key) {
|
|
463
|
-
const isExp = expandedRowKeySet.value.has(key);
|
|
464
|
-
const next = isExp ? expandedRowKeys.value.filter((k) => k !== key) : [...expandedRowKeys.value, key];
|
|
465
|
-
if (!isExpandControlled.value) {
|
|
466
|
-
uncontrolledExpandedRowKeys.value = next;
|
|
467
|
-
}
|
|
468
|
-
emit("expanded-rows-change", next);
|
|
469
|
-
}
|
|
470
|
-
const totalColumnCount = vue.computed(() => {
|
|
471
|
-
let count = displayColumns.value.length;
|
|
472
|
-
if (props.rowSelection && props.rowSelection.showCheckbox !== false) count++;
|
|
473
|
-
if (props.expandable) count++;
|
|
474
|
-
return count;
|
|
475
|
-
});
|
|
476
507
|
function renderTableHeader() {
|
|
477
508
|
const headerCells = [];
|
|
478
|
-
|
|
479
|
-
|
|
509
|
+
const expandAtStart = props.expandable && props.expandable.expandIconPosition !== "end";
|
|
510
|
+
const expandAtEnd = props.expandable && props.expandable.expandIconPosition === "end";
|
|
511
|
+
const expandHeaderTh = props.expandable ? vue.h("th", {
|
|
512
|
+
class: tigercatCore.getExpandIconCellClasses(props.size),
|
|
513
|
+
"aria-label": "Expand"
|
|
514
|
+
}) : null;
|
|
515
|
+
if (expandAtStart && expandHeaderTh) {
|
|
516
|
+
headerCells.push(expandHeaderTh);
|
|
480
517
|
}
|
|
481
518
|
if (props.rowSelection && props.rowSelection.showCheckbox !== false && props.rowSelection.type !== "radio") {
|
|
482
519
|
headerCells.push(
|
|
@@ -597,8 +634,8 @@ var Table = vue.defineComponent({
|
|
|
597
634
|
)
|
|
598
635
|
);
|
|
599
636
|
});
|
|
600
|
-
if (
|
|
601
|
-
headerCells.push(
|
|
637
|
+
if (expandAtEnd && expandHeaderTh) {
|
|
638
|
+
headerCells.push(expandHeaderTh);
|
|
602
639
|
}
|
|
603
640
|
return vue.h("thead", { class: tigercatCore.getTableHeaderClasses(props.stickyHeader) }, [
|
|
604
641
|
vue.h("tr", headerCells)
|
|
@@ -635,40 +672,34 @@ var Table = vue.defineComponent({
|
|
|
635
672
|
const key = paginatedRowKeys.value[index];
|
|
636
673
|
const isSelected = selectedRowKeySet.value.has(key);
|
|
637
674
|
const isExpanded = expandedRowKeySet.value.has(key);
|
|
638
|
-
const
|
|
675
|
+
const isRowExpandable = props.expandable ? props.expandable.rowExpandable ? props.expandable.rowExpandable(record) : true : false;
|
|
639
676
|
const rowClass = typeof props.rowClassName === "function" ? props.rowClassName(record, index) : props.rowClassName;
|
|
640
677
|
const cells = [];
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
[vue.h("path", { d: "M6 3l6 5-6 5V3z" })]
|
|
667
|
-
)
|
|
668
|
-
]
|
|
669
|
-
) : null
|
|
670
|
-
])
|
|
671
|
-
);
|
|
678
|
+
const expandAtStart = props.expandable && props.expandable.expandIconPosition !== "end";
|
|
679
|
+
const expandToggleCell = props.expandable ? vue.h(
|
|
680
|
+
"td",
|
|
681
|
+
{
|
|
682
|
+
class: tigercatCore.getExpandIconCellClasses(props.size)
|
|
683
|
+
},
|
|
684
|
+
isRowExpandable ? [
|
|
685
|
+
vue.h(
|
|
686
|
+
"button",
|
|
687
|
+
{
|
|
688
|
+
type: "button",
|
|
689
|
+
class: "inline-flex items-center justify-center",
|
|
690
|
+
"aria-label": isExpanded ? "Collapse row" : "Expand row",
|
|
691
|
+
"aria-expanded": isExpanded,
|
|
692
|
+
onClick: (e) => {
|
|
693
|
+
e.stopPropagation();
|
|
694
|
+
handleToggleExpand(key, record);
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
[ExpandIcon(isExpanded)]
|
|
698
|
+
)
|
|
699
|
+
] : []
|
|
700
|
+
) : null;
|
|
701
|
+
if (expandAtStart && expandToggleCell) {
|
|
702
|
+
cells.push(expandToggleCell);
|
|
672
703
|
}
|
|
673
704
|
if (props.rowSelection && props.rowSelection.showCheckbox !== false) {
|
|
674
705
|
const checkboxProps = props.rowSelection?.getCheckboxProps?.(record) || {};
|
|
@@ -731,39 +762,10 @@ var Table = vue.defineComponent({
|
|
|
731
762
|
)
|
|
732
763
|
);
|
|
733
764
|
});
|
|
734
|
-
if (
|
|
735
|
-
cells.push(
|
|
736
|
-
vue.h("td", { class: tigercatCore.getExpandCellClasses(props.size) }, [
|
|
737
|
-
isExpandable ? vue.h(
|
|
738
|
-
"button",
|
|
739
|
-
{
|
|
740
|
-
class: tigercatCore.classNames(
|
|
741
|
-
tigercatCore.expandIconButtonClasses,
|
|
742
|
-
tigercatCore.getExpandIconRotationClasses(isExpanded)
|
|
743
|
-
),
|
|
744
|
-
"aria-label": isExpanded ? "Collapse row" : "Expand row",
|
|
745
|
-
onClick: (e) => {
|
|
746
|
-
e.stopPropagation();
|
|
747
|
-
handleToggleExpand(key);
|
|
748
|
-
}
|
|
749
|
-
},
|
|
750
|
-
[
|
|
751
|
-
vue.h(
|
|
752
|
-
"svg",
|
|
753
|
-
tigercatCore.normalizeSvgAttrs({
|
|
754
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
755
|
-
viewBox: tigercatCore.icon16ViewBox,
|
|
756
|
-
fill: "currentColor",
|
|
757
|
-
class: "w-4 h-4"
|
|
758
|
-
}),
|
|
759
|
-
[vue.h("path", { d: "M6 3l6 5-6 5V3z" })]
|
|
760
|
-
)
|
|
761
|
-
]
|
|
762
|
-
) : null
|
|
763
|
-
])
|
|
764
|
-
);
|
|
765
|
+
if (!expandAtStart && expandToggleCell) {
|
|
766
|
+
cells.push(expandToggleCell);
|
|
765
767
|
}
|
|
766
|
-
const
|
|
768
|
+
const rowNode = vue.h(
|
|
767
769
|
"tr",
|
|
768
770
|
{
|
|
769
771
|
key,
|
|
@@ -775,17 +777,28 @@ var Table = vue.defineComponent({
|
|
|
775
777
|
},
|
|
776
778
|
cells
|
|
777
779
|
);
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
780
|
+
if (props.expandable && isExpanded && isRowExpandable) {
|
|
781
|
+
const expandedContent = slots["expanded-row"]?.({ record, index }) || (props.expandable.expandedRowRender ? props.expandable.expandedRowRender(record, index) : null);
|
|
782
|
+
const expandedRow = vue.h(
|
|
783
|
+
"tr",
|
|
784
|
+
{
|
|
785
|
+
key: `${key}-expanded`,
|
|
786
|
+
class: tigercatCore.getExpandedRowClasses()
|
|
787
|
+
},
|
|
788
|
+
[
|
|
789
|
+
vue.h(
|
|
790
|
+
"td",
|
|
791
|
+
{
|
|
792
|
+
colspan: totalColumnCount.value,
|
|
793
|
+
class: tigercatCore.getExpandedRowContentClasses(props.size)
|
|
794
|
+
},
|
|
795
|
+
[expandedContent]
|
|
796
|
+
)
|
|
797
|
+
]
|
|
786
798
|
);
|
|
799
|
+
return [rowNode, expandedRow];
|
|
787
800
|
}
|
|
788
|
-
return
|
|
801
|
+
return rowNode;
|
|
789
802
|
});
|
|
790
803
|
return vue.h("tbody", rows);
|
|
791
804
|
}
|
|
@@ -97,7 +97,7 @@ declare const CommentThread: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
97
97
|
};
|
|
98
98
|
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
99
99
|
[key: string]: any;
|
|
100
|
-
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("
|
|
100
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("expand-change" | "like" | "reply" | "more" | "action" | "load-more")[], "expand-change" | "like" | "reply" | "more" | "action" | "load-more", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
101
101
|
nodes: {
|
|
102
102
|
type: PropType<CommentNode[]>;
|
|
103
103
|
default: undefined;
|
|
@@ -187,11 +187,11 @@ declare const CommentThread: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
187
187
|
default: undefined;
|
|
188
188
|
};
|
|
189
189
|
}>> & Readonly<{
|
|
190
|
+
"onExpand-change"?: ((...args: any[]) => any) | undefined;
|
|
190
191
|
onLike?: ((...args: any[]) => any) | undefined;
|
|
191
192
|
onReply?: ((...args: any[]) => any) | undefined;
|
|
192
193
|
onMore?: ((...args: any[]) => any) | undefined;
|
|
193
194
|
onAction?: ((...args: any[]) => any) | undefined;
|
|
194
|
-
"onExpand-change"?: ((...args: any[]) => any) | undefined;
|
|
195
195
|
"onLoad-more"?: ((...args: any[]) => any) | undefined;
|
|
196
196
|
}>, {
|
|
197
197
|
style: Record<string, string | number>;
|
|
@@ -97,7 +97,7 @@ declare const CommentThread: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
97
97
|
};
|
|
98
98
|
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
99
99
|
[key: string]: any;
|
|
100
|
-
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("
|
|
100
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("expand-change" | "like" | "reply" | "more" | "action" | "load-more")[], "expand-change" | "like" | "reply" | "more" | "action" | "load-more", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
101
101
|
nodes: {
|
|
102
102
|
type: PropType<CommentNode[]>;
|
|
103
103
|
default: undefined;
|
|
@@ -187,11 +187,11 @@ declare const CommentThread: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
187
187
|
default: undefined;
|
|
188
188
|
};
|
|
189
189
|
}>> & Readonly<{
|
|
190
|
+
"onExpand-change"?: ((...args: any[]) => any) | undefined;
|
|
190
191
|
onLike?: ((...args: any[]) => any) | undefined;
|
|
191
192
|
onReply?: ((...args: any[]) => any) | undefined;
|
|
192
193
|
onMore?: ((...args: any[]) => any) | undefined;
|
|
193
194
|
onAction?: ((...args: any[]) => any) | undefined;
|
|
194
|
-
"onExpand-change"?: ((...args: any[]) => any) | undefined;
|
|
195
195
|
"onLoad-more"?: ((...args: any[]) => any) | undefined;
|
|
196
196
|
}>, {
|
|
197
197
|
style: Record<string, string | number>;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
5
|
+
var chunkHBZHIEDV_js = require('../chunk-HBZHIEDV.js');
|
|
6
|
+
require('../chunk-NUFSJMVC.js');
|
|
7
7
|
require('../chunk-HNQZ5JRB.js');
|
|
8
8
|
require('../chunk-AGAJJYP2.js');
|
|
9
9
|
require('../chunk-WC4B72TZ.js');
|
|
@@ -14,9 +14,9 @@ require('../chunk-PNKVD2UK.js');
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, "DataTableWithToolbar", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkHBZHIEDV_js.DataTableWithToolbar; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "default", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkHBZHIEDV_js.DataTableWithToolbar_default; }
|
|
22
22
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { DataTableWithToolbar, DataTableWithToolbar_default as default } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { DataTableWithToolbar, DataTableWithToolbar_default as default } from '../chunk-CWDBL5YC.mjs';
|
|
2
|
+
import '../chunk-BS52UCMT.mjs';
|
|
3
3
|
import '../chunk-GALASVSG.mjs';
|
|
4
4
|
import '../chunk-NHCCPMLC.mjs';
|
|
5
5
|
import '../chunk-VURU7TLN.mjs';
|
|
@@ -178,7 +178,7 @@ declare const Table: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
178
178
|
};
|
|
179
179
|
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
180
180
|
[key: string]: any;
|
|
181
|
-
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("change" | "row-click" | "selection-change" | "sort-change" | "filter-change" | "page-change" | "
|
|
181
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("change" | "row-click" | "selection-change" | "sort-change" | "filter-change" | "page-change" | "expand-change")[], "change" | "row-click" | "selection-change" | "sort-change" | "filter-change" | "page-change" | "expand-change", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
182
182
|
/**
|
|
183
183
|
* Table columns configuration
|
|
184
184
|
*/
|
|
@@ -337,7 +337,7 @@ declare const Table: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
337
337
|
"onSort-change"?: ((...args: any[]) => any) | undefined;
|
|
338
338
|
"onFilter-change"?: ((...args: any[]) => any) | undefined;
|
|
339
339
|
"onPage-change"?: ((...args: any[]) => any) | undefined;
|
|
340
|
-
"
|
|
340
|
+
"onExpand-change"?: ((...args: any[]) => any) | undefined;
|
|
341
341
|
}>, {
|
|
342
342
|
pagination: false | PaginationConfig;
|
|
343
343
|
size: TableSize;
|
|
@@ -178,7 +178,7 @@ declare const Table: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
178
178
|
};
|
|
179
179
|
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
180
180
|
[key: string]: any;
|
|
181
|
-
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("change" | "row-click" | "selection-change" | "sort-change" | "filter-change" | "page-change" | "
|
|
181
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("change" | "row-click" | "selection-change" | "sort-change" | "filter-change" | "page-change" | "expand-change")[], "change" | "row-click" | "selection-change" | "sort-change" | "filter-change" | "page-change" | "expand-change", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
182
182
|
/**
|
|
183
183
|
* Table columns configuration
|
|
184
184
|
*/
|
|
@@ -337,7 +337,7 @@ declare const Table: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
337
337
|
"onSort-change"?: ((...args: any[]) => any) | undefined;
|
|
338
338
|
"onFilter-change"?: ((...args: any[]) => any) | undefined;
|
|
339
339
|
"onPage-change"?: ((...args: any[]) => any) | undefined;
|
|
340
|
-
"
|
|
340
|
+
"onExpand-change"?: ((...args: any[]) => any) | undefined;
|
|
341
341
|
}>, {
|
|
342
342
|
pagination: false | PaginationConfig;
|
|
343
343
|
size: TableSize;
|
package/dist/components/Table.js
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var chunkNUFSJMVC_js = require('../chunk-NUFSJMVC.js');
|
|
6
6
|
require('../chunk-PNKVD2UK.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "Table", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkNUFSJMVC_js.Table; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "default", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkNUFSJMVC_js.Table_default; }
|
|
17
17
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Table, Table_default as default } from '../chunk-
|
|
1
|
+
export { Table, Table_default as default } from '../chunk-BS52UCMT.mjs';
|
|
2
2
|
import '../chunk-53M2BTB5.mjs';
|
package/dist/index.js
CHANGED
|
@@ -46,8 +46,8 @@ var chunkRY2I56HB_js = require('./chunk-RY2I56HB.js');
|
|
|
46
46
|
var chunkGNKXBRXH_js = require('./chunk-GNKXBRXH.js');
|
|
47
47
|
var chunkW36SYMVH_js = require('./chunk-W36SYMVH.js');
|
|
48
48
|
var chunkK2U3FEL7_js = require('./chunk-K2U3FEL7.js');
|
|
49
|
-
var
|
|
50
|
-
var
|
|
49
|
+
var chunkHBZHIEDV_js = require('./chunk-HBZHIEDV.js');
|
|
50
|
+
var chunkNUFSJMVC_js = require('./chunk-NUFSJMVC.js');
|
|
51
51
|
var chunkHNQZ5JRB_js = require('./chunk-HNQZ5JRB.js');
|
|
52
52
|
var chunkAGAJJYP2_js = require('./chunk-AGAJJYP2.js');
|
|
53
53
|
var chunkZZ5LMO3X_js = require('./chunk-ZZ5LMO3X.js');
|
|
@@ -297,11 +297,11 @@ Object.defineProperty(exports, "ImageCropper", {
|
|
|
297
297
|
});
|
|
298
298
|
Object.defineProperty(exports, "DataTableWithToolbar", {
|
|
299
299
|
enumerable: true,
|
|
300
|
-
get: function () { return
|
|
300
|
+
get: function () { return chunkHBZHIEDV_js.DataTableWithToolbar; }
|
|
301
301
|
});
|
|
302
302
|
Object.defineProperty(exports, "Table", {
|
|
303
303
|
enumerable: true,
|
|
304
|
-
get: function () { return
|
|
304
|
+
get: function () { return chunkNUFSJMVC_js.Table; }
|
|
305
305
|
});
|
|
306
306
|
Object.defineProperty(exports, "Select", {
|
|
307
307
|
enumerable: true,
|
package/dist/index.mjs
CHANGED
|
@@ -45,8 +45,8 @@ export { Icon } from './chunk-WQXZ3234.mjs';
|
|
|
45
45
|
export { CropUpload } from './chunk-HTMTOXUO.mjs';
|
|
46
46
|
export { Modal } from './chunk-P47EXOAW.mjs';
|
|
47
47
|
export { ImageCropper } from './chunk-T77L326M.mjs';
|
|
48
|
-
export { DataTableWithToolbar } from './chunk-
|
|
49
|
-
export { Table } from './chunk-
|
|
48
|
+
export { DataTableWithToolbar } from './chunk-CWDBL5YC.mjs';
|
|
49
|
+
export { Table } from './chunk-BS52UCMT.mjs';
|
|
50
50
|
export { Select } from './chunk-GALASVSG.mjs';
|
|
51
51
|
export { Pagination } from './chunk-NHCCPMLC.mjs';
|
|
52
52
|
export { DatePicker } from './chunk-327O6FN7.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expcat/tigercat-vue",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Vue 3 components for Tigercat UI library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Yizhe Wang",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@expcat/tigercat-core": "0.4.
|
|
46
|
+
"@expcat/tigercat-core": "0.4.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^25.0.3",
|