@expcat/tigercat-vue 1.2.37 → 1.2.39
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-WT3LV7OQ.mjs → chunk-3KIIMXJC.mjs} +1 -1
- package/dist/{chunk-PC2FNA4J.mjs → chunk-5BGVVVVD.mjs} +1 -1
- package/dist/{chunk-RRI3F52B.js → chunk-5BILS3SG.js} +268 -92
- package/dist/{chunk-W54LFA7A.mjs → chunk-5Z2OCSVJ.mjs} +268 -92
- package/dist/{chunk-U2PPTMQX.mjs → chunk-G7O3G2LI.mjs} +1 -1
- package/dist/{chunk-UJZPEXF5.mjs → chunk-JPZJZFC4.mjs} +17 -3
- package/dist/{chunk-3EVCDIZE.js → chunk-JT2ANXUR.js} +2 -2
- package/dist/{chunk-S3KTGULC.js → chunk-NNFDOVVA.js} +20 -6
- package/dist/{chunk-2HT6YGRY.js → chunk-O23S65U3.js} +60 -8
- package/dist/{chunk-ILTIUESE.mjs → chunk-OKBZKBFP.mjs} +60 -8
- package/dist/{chunk-6DYGPOYH.js → chunk-SSMSRTEQ.js} +2 -2
- package/dist/{chunk-HSMN5FWL.js → chunk-YCYS6LAQ.js} +2 -2
- package/dist/components/Alert.d.mts +1 -1
- package/dist/components/Alert.d.ts +1 -1
- package/dist/components/ChatWindow.js +3 -3
- package/dist/components/ChatWindow.mjs +2 -2
- package/dist/components/DataTableWithToolbar.d.mts +23 -3
- package/dist/components/DataTableWithToolbar.d.ts +23 -3
- package/dist/components/DataTableWithToolbar.js +8 -3
- package/dist/components/DataTableWithToolbar.mjs +7 -2
- package/dist/components/Empty.d.mts +1 -1
- package/dist/components/Empty.d.ts +1 -1
- package/dist/components/FormWizard.d.mts +1 -1
- package/dist/components/FormWizard.d.ts +1 -1
- package/dist/components/Menu.d.mts +1 -1
- package/dist/components/Menu.d.ts +1 -1
- package/dist/components/Pagination.d.mts +1 -1
- package/dist/components/Pagination.d.ts +1 -1
- package/dist/components/Popconfirm.d.mts +1 -1
- package/dist/components/Popconfirm.d.ts +1 -1
- package/dist/components/Popconfirm.js +3 -3
- package/dist/components/Popconfirm.mjs +2 -2
- package/dist/components/Popover.js +3 -3
- package/dist/components/Popover.mjs +2 -2
- package/dist/components/Steps.d.mts +1 -1
- package/dist/components/Steps.d.ts +1 -1
- package/dist/components/Table.d.mts +31 -3
- package/dist/components/Table.d.ts +31 -3
- package/dist/components/Table.js +8 -2
- package/dist/components/Table.mjs +7 -1
- package/dist/components/Tooltip.js +3 -3
- package/dist/components/Tooltip.mjs +2 -2
- package/dist/index.js +16 -16
- package/dist/index.mjs +16 -16
- package/package.json +2 -2
- package/dist/{chunk-S45NWVQS.mjs → chunk-6GPX4ONB.mjs} +3 -3
- package/dist/{chunk-VES3OJOP.js → chunk-YS6FW775.js} +2 -2
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Select
|
|
3
|
+
} from "./chunk-PYT5DTQQ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Radio
|
|
6
|
+
} from "./chunk-YZP4K6KI.mjs";
|
|
1
7
|
import {
|
|
2
8
|
useTigerConfig
|
|
3
9
|
} from "./chunk-VG6E4NX6.mjs";
|
|
10
|
+
import {
|
|
11
|
+
Empty
|
|
12
|
+
} from "./chunk-WFISP42H.mjs";
|
|
13
|
+
import {
|
|
14
|
+
Checkbox
|
|
15
|
+
} from "./chunk-2BNQGU7E.mjs";
|
|
4
16
|
|
|
5
17
|
// src/components/Table.ts
|
|
6
18
|
import {
|
|
@@ -15,8 +27,11 @@ import {
|
|
|
15
27
|
import {
|
|
16
28
|
classNames as classNames3,
|
|
17
29
|
createTableResizeObserverController,
|
|
30
|
+
formatTableSelectRowAriaLabel,
|
|
31
|
+
formatTableSortByText,
|
|
18
32
|
getCardColumns,
|
|
19
33
|
getImmediateTigerLocale,
|
|
34
|
+
getTableLabels,
|
|
20
35
|
getTableWrapperClasses,
|
|
21
36
|
getTableResponsiveCardListClasses,
|
|
22
37
|
getTableResponsiveTableClasses,
|
|
@@ -85,9 +100,15 @@ var tableProps = {
|
|
|
85
100
|
type: Boolean,
|
|
86
101
|
default: false
|
|
87
102
|
},
|
|
103
|
+
locale: {
|
|
104
|
+
type: [Object, Function]
|
|
105
|
+
},
|
|
106
|
+
labels: {
|
|
107
|
+
type: Object
|
|
108
|
+
},
|
|
88
109
|
emptyText: {
|
|
89
110
|
type: String,
|
|
90
|
-
default:
|
|
111
|
+
default: void 0
|
|
91
112
|
},
|
|
92
113
|
pagination: {
|
|
93
114
|
type: [Object, Boolean],
|
|
@@ -132,6 +153,12 @@ var tableProps = {
|
|
|
132
153
|
type: String,
|
|
133
154
|
default: "sm"
|
|
134
155
|
},
|
|
156
|
+
cardClassName: {
|
|
157
|
+
type: [String, Function]
|
|
158
|
+
},
|
|
159
|
+
renderCard: {
|
|
160
|
+
type: Function
|
|
161
|
+
},
|
|
135
162
|
// --- v0.6.0 props ---
|
|
136
163
|
virtual: { type: Boolean, default: false },
|
|
137
164
|
autoVirtual: { type: Boolean, default: true },
|
|
@@ -333,6 +360,20 @@ function useTableState(props, emit, measuredColumnWidths) {
|
|
|
333
360
|
const total = paginationConfig.value?.total !== void 0 && paginationConfig.value.total > 0 ? paginationConfig.value.total : processedData.value.length;
|
|
334
361
|
return calculatePagination(total, currentPage.value, currentPageSize.value);
|
|
335
362
|
});
|
|
363
|
+
function handleSetSort(nextSortState) {
|
|
364
|
+
if (!isSortControlled.value) {
|
|
365
|
+
uncontrolledSortState.value = nextSortState;
|
|
366
|
+
}
|
|
367
|
+
emit("sort-change", nextSortState);
|
|
368
|
+
emit("change", {
|
|
369
|
+
sort: nextSortState,
|
|
370
|
+
filters: filterState.value,
|
|
371
|
+
pagination: props.pagination !== false ? {
|
|
372
|
+
current: currentPage.value,
|
|
373
|
+
pageSize: currentPageSize.value
|
|
374
|
+
} : null
|
|
375
|
+
});
|
|
376
|
+
}
|
|
336
377
|
function handleSort(columnKey) {
|
|
337
378
|
const column = displayColumns.value.find((col) => col.key === columnKey);
|
|
338
379
|
if (!column || !column.sortable) {
|
|
@@ -346,21 +387,9 @@ function useTableState(props, emit, measuredColumnWidths) {
|
|
|
346
387
|
newDirection = null;
|
|
347
388
|
}
|
|
348
389
|
}
|
|
349
|
-
|
|
390
|
+
handleSetSort({
|
|
350
391
|
key: newDirection ? columnKey : null,
|
|
351
392
|
direction: newDirection
|
|
352
|
-
};
|
|
353
|
-
if (!isSortControlled.value) {
|
|
354
|
-
uncontrolledSortState.value = nextSortState;
|
|
355
|
-
}
|
|
356
|
-
emit("sort-change", nextSortState);
|
|
357
|
-
emit("change", {
|
|
358
|
-
sort: nextSortState,
|
|
359
|
-
filters: filterState.value,
|
|
360
|
-
pagination: props.pagination !== false ? {
|
|
361
|
-
current: currentPage.value,
|
|
362
|
-
pageSize: currentPageSize.value
|
|
363
|
-
} : null
|
|
364
393
|
});
|
|
365
394
|
}
|
|
366
395
|
function handleFilter(columnKey, value) {
|
|
@@ -556,6 +585,7 @@ function useTableState(props, emit, measuredColumnWidths) {
|
|
|
556
585
|
editingValue,
|
|
557
586
|
virtualScrollTop,
|
|
558
587
|
toggleColumnLock,
|
|
588
|
+
handleSetSort,
|
|
559
589
|
handleSort,
|
|
560
590
|
handleFilter,
|
|
561
591
|
handlePageChange,
|
|
@@ -1191,11 +1221,14 @@ var Table = defineComponent({
|
|
|
1191
1221
|
const measuredRowHeights = ref2([]);
|
|
1192
1222
|
const ctx = useTableState(props, emit, measuredColumnWidths);
|
|
1193
1223
|
const resolvedPaginationLocale = ref2();
|
|
1224
|
+
const resolvedTableLocale = ref2();
|
|
1194
1225
|
let paginationLocaleResolveId = 0;
|
|
1226
|
+
let tableLocaleResolveId = 0;
|
|
1195
1227
|
const paginationLocaleInput = computed2(
|
|
1196
1228
|
() => props.pagination !== false && typeof props.pagination === "object" ? props.pagination.locale : void 0
|
|
1197
1229
|
);
|
|
1198
1230
|
const isPaginationI18nDisabled = computed2(() => paginationLocaleInput.value === false);
|
|
1231
|
+
const tableLocaleInput = computed2(() => props.locale);
|
|
1199
1232
|
watch2(
|
|
1200
1233
|
paginationLocaleInput,
|
|
1201
1234
|
(locale) => {
|
|
@@ -1222,6 +1255,36 @@ var Table = defineComponent({
|
|
|
1222
1255
|
const paginationLocale = computed2(
|
|
1223
1256
|
() => isPaginationI18nDisabled.value ? void 0 : mergeTigerLocale(config.value.locale, resolvedPaginationLocale.value)
|
|
1224
1257
|
);
|
|
1258
|
+
watch2(
|
|
1259
|
+
tableLocaleInput,
|
|
1260
|
+
(locale) => {
|
|
1261
|
+
const resolveId = ++tableLocaleResolveId;
|
|
1262
|
+
if (!locale) {
|
|
1263
|
+
resolvedTableLocale.value = void 0;
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
const immediateLocale = getImmediateTigerLocale(locale);
|
|
1267
|
+
resolvedTableLocale.value = immediateLocale;
|
|
1268
|
+
if (!isLazyTigerLocale(locale)) return;
|
|
1269
|
+
resolveTigerLocale(locale).then((nextLocale) => {
|
|
1270
|
+
if (resolveId === tableLocaleResolveId) {
|
|
1271
|
+
resolvedTableLocale.value = nextLocale;
|
|
1272
|
+
}
|
|
1273
|
+
}).catch(() => {
|
|
1274
|
+
if (resolveId === tableLocaleResolveId) {
|
|
1275
|
+
resolvedTableLocale.value = immediateLocale;
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
},
|
|
1279
|
+
{ immediate: true }
|
|
1280
|
+
);
|
|
1281
|
+
const tableLocale = computed2(
|
|
1282
|
+
() => mergeTigerLocale(config.value.locale, resolvedTableLocale.value)
|
|
1283
|
+
);
|
|
1284
|
+
const tableLabels = computed2(() => {
|
|
1285
|
+
const overrides = props.emptyText === void 0 ? props.labels : { ...props.labels, emptyText: props.emptyText };
|
|
1286
|
+
return getTableLabels(tableLocale.value, overrides);
|
|
1287
|
+
});
|
|
1225
1288
|
const resizeController = createTableResizeObserverController({
|
|
1226
1289
|
onResize: (snapshot) => {
|
|
1227
1290
|
if (!areNumberRecordsEqual(measuredColumnWidths.value, snapshot.columnWidths)) {
|
|
@@ -1251,10 +1314,14 @@ var Table = defineComponent({
|
|
|
1251
1314
|
const wrapperStyle = resolvedProps.maxHeight ? {
|
|
1252
1315
|
maxHeight: typeof resolvedProps.maxHeight === "number" ? `${resolvedProps.maxHeight}px` : resolvedProps.maxHeight
|
|
1253
1316
|
} : void 0;
|
|
1317
|
+
const renderProps = {
|
|
1318
|
+
...resolvedProps,
|
|
1319
|
+
emptyText: tableLabels.value.emptyText
|
|
1320
|
+
};
|
|
1254
1321
|
const tableChildren = [
|
|
1255
|
-
renderTableHeader(ctx,
|
|
1256
|
-
renderTableBody(ctx,
|
|
1257
|
-
renderSummaryRow(ctx,
|
|
1322
|
+
renderTableHeader(ctx, renderProps, slots),
|
|
1323
|
+
renderTableBody(ctx, renderProps, slots),
|
|
1324
|
+
renderSummaryRow(ctx, renderProps)
|
|
1258
1325
|
];
|
|
1259
1326
|
const tableInner = h6(
|
|
1260
1327
|
"table",
|
|
@@ -1282,83 +1349,192 @@ var Table = defineComponent({
|
|
|
1282
1349
|
},
|
|
1283
1350
|
[tableInner]
|
|
1284
1351
|
) : tableInner;
|
|
1285
|
-
const cardContent =
|
|
1286
|
-
"
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
])
|
|
1352
|
+
const cardContent = (() => {
|
|
1353
|
+
if (resolvedProps.responsiveMode !== "card") return null;
|
|
1354
|
+
const cardChildren = [];
|
|
1355
|
+
const sortableColumns = ctx.displayColumns.value.filter((column) => column.sortable);
|
|
1356
|
+
if (resolvedProps.rowSelection && resolvedProps.rowSelection.type !== "radio" && resolvedProps.rowSelection.showCheckbox !== false && ctx.paginatedData.value.length > 0) {
|
|
1357
|
+
cardChildren.push(
|
|
1358
|
+
h6(
|
|
1359
|
+
"div",
|
|
1360
|
+
{
|
|
1361
|
+
class: "flex items-center justify-between rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] px-3 py-2"
|
|
1362
|
+
},
|
|
1363
|
+
[
|
|
1364
|
+
h6(
|
|
1365
|
+
Checkbox,
|
|
1366
|
+
{
|
|
1367
|
+
size: "sm",
|
|
1368
|
+
modelValue: ctx.allSelected.value,
|
|
1369
|
+
indeterminate: ctx.someSelected.value,
|
|
1370
|
+
onChange: (checked) => ctx.handleSelectAll(checked)
|
|
1371
|
+
},
|
|
1372
|
+
{ default: () => tableLabels.value.selectAllText }
|
|
1373
|
+
)
|
|
1374
|
+
]
|
|
1375
|
+
)
|
|
1310
1376
|
);
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1377
|
+
}
|
|
1378
|
+
if (sortableColumns.length > 0) {
|
|
1379
|
+
cardChildren.push(
|
|
1380
|
+
h6("div", {
|
|
1381
|
+
class: "rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] px-3 py-2"
|
|
1382
|
+
}, [
|
|
1383
|
+
h6(Select, {
|
|
1384
|
+
size: "sm",
|
|
1385
|
+
modelValue: ctx.sortState.value.key && ctx.sortState.value.direction ? `${ctx.sortState.value.key}:${ctx.sortState.value.direction}` : "",
|
|
1386
|
+
options: [
|
|
1387
|
+
{ label: tableLabels.value.clearSortText, value: "" },
|
|
1388
|
+
...sortableColumns.flatMap((column) => [
|
|
1389
|
+
{
|
|
1390
|
+
label: `${formatTableSortByText(tableLabels.value.sortByText, column.title)} \u2191`,
|
|
1391
|
+
value: `${column.key}:asc`
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
label: `${formatTableSortByText(tableLabels.value.sortByText, column.title)} \u2193`,
|
|
1395
|
+
value: `${column.key}:desc`
|
|
1396
|
+
}
|
|
1397
|
+
])
|
|
1398
|
+
],
|
|
1399
|
+
clearable: false,
|
|
1400
|
+
"onUpdate:modelValue": (value) => {
|
|
1401
|
+
const nextValue = String(value ?? "");
|
|
1402
|
+
if (!nextValue) {
|
|
1403
|
+
ctx.handleSetSort({ key: null, direction: null });
|
|
1404
|
+
return;
|
|
1405
|
+
}
|
|
1406
|
+
const separatorIndex = nextValue.lastIndexOf(":");
|
|
1407
|
+
const key = nextValue.slice(0, separatorIndex);
|
|
1408
|
+
const direction = nextValue.slice(separatorIndex + 1);
|
|
1409
|
+
ctx.handleSetSort({ key, direction });
|
|
1410
|
+
}
|
|
1321
1411
|
})
|
|
1322
|
-
)
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1412
|
+
])
|
|
1413
|
+
);
|
|
1414
|
+
}
|
|
1415
|
+
if (ctx.paginatedData.value.length === 0) {
|
|
1416
|
+
cardChildren.push(
|
|
1417
|
+
h6("div", { class: tableResponsiveCardClasses }, [
|
|
1418
|
+
h6(Empty, { showImage: false, description: tableLabels.value.emptyText })
|
|
1419
|
+
])
|
|
1420
|
+
);
|
|
1421
|
+
} else {
|
|
1422
|
+
cardChildren.push(
|
|
1423
|
+
...ctx.paginatedData.value.map((record, index) => {
|
|
1424
|
+
const key = ctx.paginatedRowKeys.value[index];
|
|
1425
|
+
const isExpanded = ctx.expandedRowKeySet.value.has(key);
|
|
1426
|
+
const isSelected = ctx.selectedRowKeySet.value.has(key);
|
|
1427
|
+
const isRowExpandable = resolvedProps.expandable ? resolvedProps.expandable.rowExpandable ? resolvedProps.expandable.rowExpandable(record) : true : false;
|
|
1428
|
+
const { titleColumn, bodyColumns } = getCardColumns(ctx.displayColumns.value);
|
|
1429
|
+
const renderCardCellContent = (column) => {
|
|
1430
|
+
const dataKey = column.dataKey || column.key;
|
|
1431
|
+
return slots[`cell-${column.key}`]?.({ record, index }) ?? (column.render ? column.render(record, index) : record[dataKey]);
|
|
1432
|
+
};
|
|
1433
|
+
const titleNode = titleColumn ? h6("div", { class: tableResponsiveCardTitleClasses }, [
|
|
1434
|
+
renderCardCellContent(titleColumn)
|
|
1435
|
+
]) : null;
|
|
1436
|
+
const rows = bodyColumns.map(
|
|
1437
|
+
(column) => h6("div", { key: column.key, class: tableResponsiveCardRowClasses }, [
|
|
1438
|
+
h6("div", { class: tableResponsiveCardLabelClasses }, column.title),
|
|
1439
|
+
h6("div", { class: tableResponsiveCardValueClasses }, [
|
|
1440
|
+
renderCardCellContent(column)
|
|
1441
|
+
])
|
|
1442
|
+
])
|
|
1443
|
+
);
|
|
1444
|
+
const controls = [];
|
|
1445
|
+
if (resolvedProps.rowSelection && resolvedProps.rowSelection.showCheckbox !== false) {
|
|
1446
|
+
const checkboxProps = resolvedProps.rowSelection.getCheckboxProps?.(record) || {};
|
|
1447
|
+
controls.push(
|
|
1448
|
+
h6(
|
|
1449
|
+
"span",
|
|
1450
|
+
{ onClick: (event) => event.stopPropagation() },
|
|
1451
|
+
[
|
|
1452
|
+
resolvedProps.rowSelection.type === "radio" ? h6(Radio, {
|
|
1453
|
+
value: key,
|
|
1454
|
+
checked: isSelected,
|
|
1455
|
+
disabled: checkboxProps.disabled,
|
|
1456
|
+
"aria-label": formatTableSelectRowAriaLabel(
|
|
1457
|
+
tableLabels.value.selectRowAriaLabel,
|
|
1458
|
+
index + 1,
|
|
1459
|
+
tableLocale.value?.locale
|
|
1460
|
+
),
|
|
1461
|
+
onChange: () => ctx.handleSelectRow(key, true)
|
|
1462
|
+
}) : h6(Checkbox, {
|
|
1463
|
+
size: "sm",
|
|
1464
|
+
modelValue: isSelected,
|
|
1465
|
+
disabled: checkboxProps.disabled,
|
|
1466
|
+
"aria-label": formatTableSelectRowAriaLabel(
|
|
1467
|
+
tableLabels.value.selectRowAriaLabel,
|
|
1468
|
+
index + 1,
|
|
1469
|
+
tableLocale.value?.locale
|
|
1470
|
+
),
|
|
1471
|
+
onChange: (checked) => ctx.handleSelectRow(key, checked)
|
|
1472
|
+
})
|
|
1473
|
+
]
|
|
1474
|
+
)
|
|
1475
|
+
);
|
|
1476
|
+
}
|
|
1477
|
+
if (resolvedProps.expandable && isRowExpandable) {
|
|
1478
|
+
controls.push(
|
|
1479
|
+
h6(
|
|
1480
|
+
"button",
|
|
1481
|
+
{
|
|
1482
|
+
type: "button",
|
|
1483
|
+
class: "text-sm text-[var(--tiger-primary,#2563eb)]",
|
|
1484
|
+
"aria-expanded": isExpanded,
|
|
1485
|
+
onClick: (event) => {
|
|
1486
|
+
event.stopPropagation();
|
|
1487
|
+
ctx.handleToggleExpand(key, record);
|
|
1488
|
+
}
|
|
1489
|
+
},
|
|
1490
|
+
isExpanded ? tableLabels.value.collapseText : tableLabels.value.expandText
|
|
1491
|
+
)
|
|
1492
|
+
);
|
|
1493
|
+
}
|
|
1494
|
+
const expandedContent = resolvedProps.expandable && isExpanded && isRowExpandable ? slots["expanded-row"]?.({ record, index }) ?? resolvedProps.expandable.expandedRowRender?.(record, index) : null;
|
|
1495
|
+
const cardContext = {
|
|
1496
|
+
record,
|
|
1497
|
+
index,
|
|
1498
|
+
columns: ctx.displayColumns.value,
|
|
1499
|
+
selected: isSelected,
|
|
1500
|
+
expanded: isExpanded,
|
|
1501
|
+
toggleExpand: () => ctx.handleToggleExpand(key, record),
|
|
1502
|
+
selectRow: (checked) => ctx.handleSelectRow(key, checked)
|
|
1503
|
+
};
|
|
1504
|
+
const customCard = slots.card?.(cardContext) ?? resolvedProps.renderCard?.(cardContext);
|
|
1505
|
+
const resolvedCardClassName = typeof resolvedProps.cardClassName === "function" ? resolvedProps.cardClassName(record, index) : resolvedProps.cardClassName;
|
|
1506
|
+
return h6(
|
|
1507
|
+
"div",
|
|
1328
1508
|
{
|
|
1329
|
-
|
|
1330
|
-
class:
|
|
1331
|
-
|
|
1332
|
-
onClick: (event) => {
|
|
1333
|
-
event.stopPropagation();
|
|
1334
|
-
ctx.handleToggleExpand(key, record);
|
|
1335
|
-
}
|
|
1509
|
+
key,
|
|
1510
|
+
class: classNames3(tableResponsiveCardClasses, resolvedCardClassName),
|
|
1511
|
+
onClick: () => ctx.handleRowClick(record, index, key)
|
|
1336
1512
|
},
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
titleNode,
|
|
1352
|
-
...rows,
|
|
1353
|
-
expandedContent ? h6(
|
|
1354
|
-
"div",
|
|
1355
|
-
{ class: "mt-3 border-t border-[var(--tiger-border,#e5e7eb)] pt-3" },
|
|
1356
|
-
[expandedContent]
|
|
1357
|
-
) : null
|
|
1358
|
-
]
|
|
1513
|
+
customCard !== void 0 && customCard !== null ? [customCard] : [
|
|
1514
|
+
controls.length ? h6("div", { class: "mb-2 flex items-center gap-3" }, controls) : null,
|
|
1515
|
+
titleNode,
|
|
1516
|
+
...rows,
|
|
1517
|
+
expandedContent ? h6(
|
|
1518
|
+
"div",
|
|
1519
|
+
{
|
|
1520
|
+
class: "mt-3 border-t border-[var(--tiger-border,#e5e7eb)] pt-3"
|
|
1521
|
+
},
|
|
1522
|
+
[expandedContent]
|
|
1523
|
+
) : null
|
|
1524
|
+
]
|
|
1525
|
+
);
|
|
1526
|
+
})
|
|
1359
1527
|
);
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1528
|
+
}
|
|
1529
|
+
return h6(
|
|
1530
|
+
"div",
|
|
1531
|
+
{
|
|
1532
|
+
class: getTableResponsiveCardListClasses(resolvedProps.cardBreakpoint),
|
|
1533
|
+
"data-tiger-table-mobile": "card"
|
|
1534
|
+
},
|
|
1535
|
+
cardChildren
|
|
1536
|
+
);
|
|
1537
|
+
})();
|
|
1362
1538
|
return h6(
|
|
1363
1539
|
"div",
|
|
1364
1540
|
{
|
|
@@ -1393,11 +1569,11 @@ var Table = defineComponent({
|
|
|
1393
1569
|
class: tableLoadingOverlayClasses,
|
|
1394
1570
|
role: "status",
|
|
1395
1571
|
"aria-live": "polite",
|
|
1396
|
-
"aria-label":
|
|
1572
|
+
"aria-label": tableLabels.value.loadingText
|
|
1397
1573
|
},
|
|
1398
|
-
[LoadingSpinner(), h6("span", { class: "sr-only" },
|
|
1574
|
+
[LoadingSpinner(), h6("span", { class: "sr-only" }, tableLabels.value.loadingText)]
|
|
1399
1575
|
),
|
|
1400
|
-
renderPagination(ctx,
|
|
1576
|
+
renderPagination(ctx, renderProps, {
|
|
1401
1577
|
locale: paginationLocale.value,
|
|
1402
1578
|
disableI18n: isPaginationI18nDisabled.value
|
|
1403
1579
|
})
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
import { computed, ref, watch, onBeforeUnmount } from "vue";
|
|
9
9
|
import {
|
|
10
10
|
getTransformOrigin,
|
|
11
|
-
buildTriggerHandlerMap
|
|
11
|
+
buildTriggerHandlerMap,
|
|
12
|
+
restoreFocus
|
|
12
13
|
} from "@expcat/tigercat-core";
|
|
13
14
|
function useFloatingPopup(options) {
|
|
14
15
|
const { props, emit, multiTrigger = true } = options;
|
|
@@ -32,6 +33,19 @@ function useFloatingPopup(options) {
|
|
|
32
33
|
const containerRef = ref(null);
|
|
33
34
|
const triggerRef = ref(null);
|
|
34
35
|
const floatingRef = ref(null);
|
|
36
|
+
const restoreTriggerFocus = () => {
|
|
37
|
+
const trigger = triggerRef.value;
|
|
38
|
+
const target = trigger?.querySelector(
|
|
39
|
+
'button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])'
|
|
40
|
+
) ?? trigger;
|
|
41
|
+
window.setTimeout(() => {
|
|
42
|
+
restoreFocus(target, { preventScroll: true });
|
|
43
|
+
}, 0);
|
|
44
|
+
};
|
|
45
|
+
const closeAndRestoreFocus = () => {
|
|
46
|
+
setVisible(false);
|
|
47
|
+
restoreTriggerFocus();
|
|
48
|
+
};
|
|
35
49
|
const {
|
|
36
50
|
x,
|
|
37
51
|
y,
|
|
@@ -59,14 +73,14 @@ function useFloatingPopup(options) {
|
|
|
59
73
|
outsideClickCleanup = useVueClickOutside({
|
|
60
74
|
enabled: currentVisible,
|
|
61
75
|
refs: [containerRef, floatingRef],
|
|
62
|
-
onOutsideClick:
|
|
76
|
+
onOutsideClick: closeAndRestoreFocus,
|
|
63
77
|
defer: true
|
|
64
78
|
});
|
|
65
79
|
}
|
|
66
80
|
if (visible && trigger !== "manual") {
|
|
67
81
|
escapeKeyCleanup = useVueEscapeKey({
|
|
68
82
|
enabled: currentVisible,
|
|
69
|
-
onEscape:
|
|
83
|
+
onEscape: closeAndRestoreFocus
|
|
70
84
|
});
|
|
71
85
|
}
|
|
72
86
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkNNFDOVVAjs = require('./chunk-NNFDOVVA.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkEQW6IUHGjs = require('./chunk-EQW6IUHG.js');
|
|
@@ -48,7 +48,7 @@ var Tooltip = _vue.defineComponent.call(void 0, {
|
|
|
48
48
|
floatingRef,
|
|
49
49
|
floatingStyles,
|
|
50
50
|
triggerHandlers
|
|
51
|
-
} =
|
|
51
|
+
} = _chunkNNFDOVVAjs.useFloatingPopup.call(void 0, { props, emit });
|
|
52
52
|
const tooltipId = createTooltipId();
|
|
53
53
|
const containerClasses = _vue.computed.call(void 0,
|
|
54
54
|
() => _tigercatcore.classNames.call(void 0, _tigercatcore.getTooltipContainerClasses.call(void 0, ), props.className, _tigercatcore.coerceClassValue.call(void 0, attrsRecord.class))
|
|
@@ -9,6 +9,7 @@ var _vue = require('vue');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
var _tigercatcore = require('@expcat/tigercat-core');
|
|
13
14
|
function useFloatingPopup(options) {
|
|
14
15
|
const { props, emit, multiTrigger = true } = options;
|
|
@@ -32,6 +33,19 @@ function useFloatingPopup(options) {
|
|
|
32
33
|
const containerRef = _vue.ref.call(void 0, null);
|
|
33
34
|
const triggerRef = _vue.ref.call(void 0, null);
|
|
34
35
|
const floatingRef = _vue.ref.call(void 0, null);
|
|
36
|
+
const restoreTriggerFocus = () => {
|
|
37
|
+
const trigger = triggerRef.value;
|
|
38
|
+
const target = _nullishCoalesce(_optionalChain([trigger, 'optionalAccess', _ => _.querySelector, 'call', _2 => _2(
|
|
39
|
+
'button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])'
|
|
40
|
+
)]), () => ( trigger));
|
|
41
|
+
window.setTimeout(() => {
|
|
42
|
+
_tigercatcore.restoreFocus.call(void 0, target, { preventScroll: true });
|
|
43
|
+
}, 0);
|
|
44
|
+
};
|
|
45
|
+
const closeAndRestoreFocus = () => {
|
|
46
|
+
setVisible(false);
|
|
47
|
+
restoreTriggerFocus();
|
|
48
|
+
};
|
|
35
49
|
const {
|
|
36
50
|
x,
|
|
37
51
|
y,
|
|
@@ -51,30 +65,30 @@ function useFloatingPopup(options) {
|
|
|
51
65
|
_vue.watch.call(void 0,
|
|
52
66
|
[currentVisible, effectiveTrigger],
|
|
53
67
|
([visible, trigger]) => {
|
|
54
|
-
_optionalChain([outsideClickCleanup, 'optionalCall',
|
|
55
|
-
_optionalChain([escapeKeyCleanup, 'optionalCall',
|
|
68
|
+
_optionalChain([outsideClickCleanup, 'optionalCall', _3 => _3()]);
|
|
69
|
+
_optionalChain([escapeKeyCleanup, 'optionalCall', _4 => _4()]);
|
|
56
70
|
outsideClickCleanup = void 0;
|
|
57
71
|
escapeKeyCleanup = void 0;
|
|
58
72
|
if (visible && trigger === "click") {
|
|
59
73
|
outsideClickCleanup = _chunkEQW6IUHGjs.useVueClickOutside.call(void 0, {
|
|
60
74
|
enabled: currentVisible,
|
|
61
75
|
refs: [containerRef, floatingRef],
|
|
62
|
-
onOutsideClick:
|
|
76
|
+
onOutsideClick: closeAndRestoreFocus,
|
|
63
77
|
defer: true
|
|
64
78
|
});
|
|
65
79
|
}
|
|
66
80
|
if (visible && trigger !== "manual") {
|
|
67
81
|
escapeKeyCleanup = _chunkEQW6IUHGjs.useVueEscapeKey.call(void 0, {
|
|
68
82
|
enabled: currentVisible,
|
|
69
|
-
onEscape:
|
|
83
|
+
onEscape: closeAndRestoreFocus
|
|
70
84
|
});
|
|
71
85
|
}
|
|
72
86
|
},
|
|
73
87
|
{ immediate: true }
|
|
74
88
|
);
|
|
75
89
|
_vue.onBeforeUnmount.call(void 0, () => {
|
|
76
|
-
_optionalChain([outsideClickCleanup, 'optionalCall',
|
|
77
|
-
_optionalChain([escapeKeyCleanup, 'optionalCall',
|
|
90
|
+
_optionalChain([outsideClickCleanup, 'optionalCall', _5 => _5()]);
|
|
91
|
+
_optionalChain([escapeKeyCleanup, 'optionalCall', _6 => _6()]);
|
|
78
92
|
});
|
|
79
93
|
const floatingStyles = _vue.computed.call(void 0, () => ({
|
|
80
94
|
position: "absolute",
|