@expcat/tigercat-react 2.0.0-preview.5 → 2.0.0-rc.1
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-AGTXDHQJ.mjs → chunk-HHIW7V7B.mjs} +14 -16
- package/dist/{chunk-HT7XNBI7.mjs → chunk-K6GJMKJR.mjs} +1 -1
- package/dist/{chunk-UKDPTEJI.mjs → chunk-N6JNLJIN.mjs} +58 -86
- package/dist/chunk-OVE2ZUJJ.mjs +98 -0
- package/dist/{chunk-YLUSOQKR.mjs → chunk-POP3TS4Q.mjs} +1 -1
- package/dist/{chunk-N3ESPSVN.mjs → chunk-QJE3MZBO.mjs} +28 -56
- package/dist/components/DataExport.d.mts +17 -0
- package/dist/components/DataExport.mjs +10 -0
- package/dist/components/DataTableWithToolbar.mjs +4 -3
- package/dist/components/List.mjs +2 -1
- package/dist/components/NotificationCenter.mjs +3 -2
- package/dist/components/Pagination.d.mts +6 -0
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Table.mjs +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +7 -7
- package/package.json +7 -2
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
formatPaginationTotal,
|
|
15
15
|
getPaginationContainerClasses,
|
|
16
16
|
getPaginationButtonBaseClasses,
|
|
17
|
-
getPaginationButtonActiveClasses,
|
|
18
17
|
getPaginationEllipsisClasses,
|
|
19
18
|
getQuickJumperInputClasses,
|
|
20
19
|
getPageSizeSelectorClasses,
|
|
@@ -31,7 +30,7 @@ import {
|
|
|
31
30
|
resolveTigerLocale,
|
|
32
31
|
mergeTigerLocale
|
|
33
32
|
} from "@expcat/tigercat-core";
|
|
34
|
-
import { jsx
|
|
33
|
+
import { jsx } from "react/jsx-runtime";
|
|
35
34
|
var Pagination = ({
|
|
36
35
|
current: controlledCurrent,
|
|
37
36
|
defaultCurrent = 1,
|
|
@@ -44,6 +43,7 @@ var Pagination = ({
|
|
|
44
43
|
showTotal = true,
|
|
45
44
|
totalText,
|
|
46
45
|
simple = false,
|
|
46
|
+
pageIndicatorText,
|
|
47
47
|
size = "medium",
|
|
48
48
|
align = "center",
|
|
49
49
|
disabled = false,
|
|
@@ -134,9 +134,6 @@ var Pagination = ({
|
|
|
134
134
|
setInternalCurrent(newPage);
|
|
135
135
|
}
|
|
136
136
|
onPageSizeChange?.(newPage, newPageSize);
|
|
137
|
-
if (newPage !== validatedCurrentPage) {
|
|
138
|
-
onChange?.(newPage, newPageSize);
|
|
139
|
-
}
|
|
140
137
|
},
|
|
141
138
|
[
|
|
142
139
|
disabled,
|
|
@@ -144,8 +141,7 @@ var Pagination = ({
|
|
|
144
141
|
validatedCurrentPage,
|
|
145
142
|
controlledPageSize,
|
|
146
143
|
controlledCurrent,
|
|
147
|
-
onPageSizeChange
|
|
148
|
-
onChange
|
|
144
|
+
onPageSizeChange
|
|
149
145
|
]
|
|
150
146
|
);
|
|
151
147
|
const handleQuickJumperSubmit = useCallback(() => {
|
|
@@ -210,12 +206,17 @@ var Pagination = ({
|
|
|
210
206
|
)
|
|
211
207
|
);
|
|
212
208
|
if (simple) {
|
|
209
|
+
const indicatorText = pageIndicatorText ? pageIndicatorText(validatedCurrentPage, totalPages) : `${validatedCurrentPage} / ${totalPages}`;
|
|
213
210
|
elements.push(
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
211
|
+
/* @__PURE__ */ jsx(
|
|
212
|
+
"span",
|
|
213
|
+
{
|
|
214
|
+
className: classNames("mx-2", getSizeTextClasses(size)),
|
|
215
|
+
"aria-label": indicatorText,
|
|
216
|
+
children: indicatorText
|
|
217
|
+
},
|
|
218
|
+
"current"
|
|
219
|
+
)
|
|
219
220
|
);
|
|
220
221
|
} else {
|
|
221
222
|
getPageNumbers(validatedCurrentPage, totalPages, showLessItems).forEach((pageNum, index) => {
|
|
@@ -238,10 +239,7 @@ var Pagination = ({
|
|
|
238
239
|
"button",
|
|
239
240
|
{
|
|
240
241
|
type: "button",
|
|
241
|
-
className:
|
|
242
|
-
getPaginationButtonBaseClasses(size),
|
|
243
|
-
isActive && getPaginationButtonActiveClasses()
|
|
244
|
-
),
|
|
242
|
+
className: getPaginationButtonBaseClasses(size, isActive),
|
|
245
243
|
disabled,
|
|
246
244
|
onClick: () => handlePageChange(pageNum),
|
|
247
245
|
"aria-label": formatPageAriaLabel(labels.pageAriaLabel, pageNum, localeCode),
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
Radio
|
|
6
6
|
} from "./chunk-IIWUQK2P.mjs";
|
|
7
|
+
import {
|
|
8
|
+
Pagination
|
|
9
|
+
} from "./chunk-HHIW7V7B.mjs";
|
|
7
10
|
import {
|
|
8
11
|
Empty
|
|
9
12
|
} from "./chunk-W7BC4I2Y.mjs";
|
|
@@ -940,100 +943,69 @@ function renderSummaryRow(ctx, view) {
|
|
|
940
943
|
|
|
941
944
|
// src/components/Table/render-pagination.tsx
|
|
942
945
|
import {
|
|
943
|
-
formatIntlNumber,
|
|
944
|
-
formatPaginationTotal,
|
|
945
946
|
formatPaginationPageIndicator,
|
|
947
|
+
formatPaginationTotal,
|
|
948
|
+
getBuiltInPaginationContainerClasses,
|
|
946
949
|
getPaginationLabels,
|
|
947
|
-
|
|
948
|
-
getSimplePaginationTotalClasses,
|
|
949
|
-
getSimplePaginationControlsClasses,
|
|
950
|
-
getSimplePaginationSelectClasses,
|
|
951
|
-
getSimplePaginationButtonClasses,
|
|
952
|
-
getSimplePaginationPageIndicatorClasses,
|
|
953
|
-
getSimplePaginationButtonsWrapperClasses
|
|
950
|
+
resolvePaginationDisplayMode
|
|
954
951
|
} from "@expcat/tigercat-core";
|
|
955
|
-
import { jsx as jsx5
|
|
952
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
956
953
|
function renderPagination(ctx, view) {
|
|
957
954
|
const { pagination } = view;
|
|
958
955
|
if (pagination === false || !ctx.paginationInfo) {
|
|
959
956
|
return null;
|
|
960
957
|
}
|
|
961
|
-
const { totalPages
|
|
958
|
+
const { totalPages } = ctx.paginationInfo;
|
|
962
959
|
const paginationConfig = pagination;
|
|
963
960
|
const total = paginationConfig.total !== void 0 && paginationConfig.total > 0 ? paginationConfig.total : ctx.processedData.length;
|
|
964
961
|
const locale = view.disableI18n ? void 0 : view.locale;
|
|
965
962
|
const labels = getPaginationLabels(locale);
|
|
966
963
|
const localeCode = locale?.locale;
|
|
967
|
-
const
|
|
968
|
-
const
|
|
969
|
-
const
|
|
970
|
-
const
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
);
|
|
976
|
-
const finalPrevAriaLabel = view.disableI18n ? finalPrevText : labels.prevPageAriaLabel;
|
|
977
|
-
const finalNextAriaLabel = view.disableI18n ? finalNextText : labels.nextPageAriaLabel;
|
|
978
|
-
const normalizedPageSizeOptions = paginationConfig.pageSizeOptions || [
|
|
964
|
+
const { simple, showQuickJumper } = resolvePaginationDisplayMode(totalPages, paginationConfig);
|
|
965
|
+
const totalText = paginationConfig.totalText ?? ((value, range) => formatPaginationTotal(labels.totalText, value, range, localeCode));
|
|
966
|
+
const pageIndicatorText = paginationConfig.pageIndicatorText ?? ((current, pages) => formatPaginationPageIndicator(labels.pageIndicatorText, current, pages, localeCode));
|
|
967
|
+
const overrides = view.disableI18n ? { ...labels } : {};
|
|
968
|
+
if (paginationConfig.prevText) overrides.prevPageAriaLabel = paginationConfig.prevText;
|
|
969
|
+
if (paginationConfig.nextText) overrides.nextPageAriaLabel = paginationConfig.nextText;
|
|
970
|
+
const labelsOverride = Object.keys(overrides).length > 0 ? overrides : void 0;
|
|
971
|
+
const pageSizeOptions = paginationConfig.pageSizeOptions ?? [
|
|
979
972
|
10,
|
|
980
973
|
20,
|
|
981
974
|
50,
|
|
982
975
|
100
|
|
983
976
|
];
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
/* @__PURE__ */ jsx5(
|
|
1013
|
-
"span",
|
|
1014
|
-
{
|
|
1015
|
-
className: getSimplePaginationPageIndicatorClasses(),
|
|
1016
|
-
"aria-label": finalPageIndicatorText,
|
|
1017
|
-
children: finalPageIndicatorText
|
|
1018
|
-
}
|
|
1019
|
-
),
|
|
1020
|
-
/* @__PURE__ */ jsx5(
|
|
1021
|
-
"button",
|
|
1022
|
-
{
|
|
1023
|
-
className: getSimplePaginationButtonClasses(!hasNext),
|
|
1024
|
-
disabled: !hasNext,
|
|
1025
|
-
"aria-label": finalNextAriaLabel,
|
|
1026
|
-
onClick: () => ctx.handlePageChange(ctx.currentPage + 1),
|
|
1027
|
-
children: finalNextText
|
|
1028
|
-
}
|
|
1029
|
-
)
|
|
1030
|
-
] })
|
|
1031
|
-
] })
|
|
1032
|
-
] });
|
|
977
|
+
const pageSizeText = paginationConfig.pageSizeText;
|
|
978
|
+
const normalizedPageSizeOptions = pageSizeText ? pageSizeOptions.map((option) => {
|
|
979
|
+
if (typeof option === "number") {
|
|
980
|
+
return { value: option, label: pageSizeText(option) };
|
|
981
|
+
}
|
|
982
|
+
return { value: option.value, label: option.label ?? pageSizeText(option.value) };
|
|
983
|
+
}) : pageSizeOptions;
|
|
984
|
+
return /* @__PURE__ */ jsx5("div", { className: getBuiltInPaginationContainerClasses(), children: /* @__PURE__ */ jsx5(
|
|
985
|
+
Pagination,
|
|
986
|
+
{
|
|
987
|
+
size: "small",
|
|
988
|
+
align: "right",
|
|
989
|
+
current: ctx.currentPage,
|
|
990
|
+
pageSize: ctx.currentPageSize,
|
|
991
|
+
total,
|
|
992
|
+
simple,
|
|
993
|
+
showQuickJumper,
|
|
994
|
+
showSizeChanger: paginationConfig.showSizeChanger !== false,
|
|
995
|
+
showTotal: paginationConfig.showTotal !== false,
|
|
996
|
+
totalText,
|
|
997
|
+
pageIndicatorText,
|
|
998
|
+
pageSizeOptions: normalizedPageSizeOptions,
|
|
999
|
+
locale,
|
|
1000
|
+
labels: labelsOverride,
|
|
1001
|
+
onChange: (page) => ctx.handlePageChange(page),
|
|
1002
|
+
onPageSizeChange: (_page, pageSize) => ctx.handlePageSizeChange(pageSize)
|
|
1003
|
+
}
|
|
1004
|
+
) });
|
|
1033
1005
|
}
|
|
1034
1006
|
|
|
1035
1007
|
// src/components/Table.tsx
|
|
1036
|
-
import { Fragment, jsx as jsx6, jsxs as
|
|
1008
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1037
1009
|
function Table({
|
|
1038
1010
|
columns,
|
|
1039
1011
|
columnLockable = false,
|
|
@@ -1269,7 +1241,7 @@ function Table({
|
|
|
1269
1241
|
controller.observe(wrapper, tableRef.current);
|
|
1270
1242
|
return () => controller.disconnect();
|
|
1271
1243
|
}, [ctx.displayColumns.length, ctx.paginatedData.length]);
|
|
1272
|
-
return /* @__PURE__ */
|
|
1244
|
+
return /* @__PURE__ */ jsxs4(
|
|
1273
1245
|
"div",
|
|
1274
1246
|
{
|
|
1275
1247
|
ref: wrapperRef,
|
|
@@ -1295,7 +1267,7 @@ function Table({
|
|
|
1295
1267
|
children: exportFormat === "excel" ? tableLabels.exportExcelText : tableLabels.exportCsvText
|
|
1296
1268
|
}
|
|
1297
1269
|
) }),
|
|
1298
|
-
/* @__PURE__ */
|
|
1270
|
+
/* @__PURE__ */ jsxs4(
|
|
1299
1271
|
"table",
|
|
1300
1272
|
{
|
|
1301
1273
|
ref: tableRef,
|
|
@@ -1358,7 +1330,7 @@ function Table({
|
|
|
1358
1330
|
]
|
|
1359
1331
|
}
|
|
1360
1332
|
),
|
|
1361
|
-
responsiveMode === "card" && /* @__PURE__ */
|
|
1333
|
+
responsiveMode === "card" && /* @__PURE__ */ jsxs4(
|
|
1362
1334
|
"div",
|
|
1363
1335
|
{
|
|
1364
1336
|
className: getTableResponsiveCardListClasses(cardBreakpoint),
|
|
@@ -1424,7 +1396,7 @@ function Table({
|
|
|
1424
1396
|
};
|
|
1425
1397
|
const customCard = renderCard?.(renderContext);
|
|
1426
1398
|
const resolvedCardClassName = typeof cardClassName === "function" ? cardClassName(record, index) : cardClassName;
|
|
1427
|
-
const controlsNode = internalRowSelection?.showCheckbox !== false && internalRowSelection || internalExpandable && isRowExpandable ? /* @__PURE__ */
|
|
1399
|
+
const controlsNode = internalRowSelection?.showCheckbox !== false && internalRowSelection || internalExpandable && isRowExpandable ? /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1428
1400
|
internalRowSelection && internalRowSelection.showCheckbox !== false && /* @__PURE__ */ jsx6("span", { onClick: (event) => event.stopPropagation(), children: internalRowSelection.type === "radio" ? /* @__PURE__ */ jsx6(
|
|
1429
1401
|
Radio,
|
|
1430
1402
|
{
|
|
@@ -1474,7 +1446,7 @@ function Table({
|
|
|
1474
1446
|
resolvedCardClassName
|
|
1475
1447
|
),
|
|
1476
1448
|
onClick: () => ctx.handleRowClick(record, index, key),
|
|
1477
|
-
children: customCard !== void 0 && customCard !== null ? customCard : /* @__PURE__ */
|
|
1449
|
+
children: customCard !== void 0 && customCard !== null ? customCard : /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1478
1450
|
(() => {
|
|
1479
1451
|
const { titleColumn, bodyColumns } = getCardColumns(ctx.displayColumns);
|
|
1480
1452
|
const renderCellContent = (column) => {
|
|
@@ -1482,8 +1454,8 @@ function Table({
|
|
|
1482
1454
|
return column.render ? column.render(record, index) : record[dataKey];
|
|
1483
1455
|
};
|
|
1484
1456
|
if (hasCustomCardLayout) {
|
|
1485
|
-
return /* @__PURE__ */
|
|
1486
|
-
titleColumn && /* @__PURE__ */
|
|
1457
|
+
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1458
|
+
titleColumn && /* @__PURE__ */ jsxs4(
|
|
1487
1459
|
"div",
|
|
1488
1460
|
{
|
|
1489
1461
|
className: classNames3(
|
|
@@ -1514,7 +1486,7 @@ function Table({
|
|
|
1514
1486
|
);
|
|
1515
1487
|
}
|
|
1516
1488
|
if (gridInfo.labelPosition === "top") {
|
|
1517
|
-
return /* @__PURE__ */
|
|
1489
|
+
return /* @__PURE__ */ jsxs4(
|
|
1518
1490
|
"div",
|
|
1519
1491
|
{
|
|
1520
1492
|
className: classNames3(
|
|
@@ -1547,7 +1519,7 @@ function Table({
|
|
|
1547
1519
|
column.key
|
|
1548
1520
|
);
|
|
1549
1521
|
}
|
|
1550
|
-
return /* @__PURE__ */
|
|
1522
|
+
return /* @__PURE__ */ jsxs4(
|
|
1551
1523
|
"div",
|
|
1552
1524
|
{
|
|
1553
1525
|
className: classNames3(
|
|
@@ -1583,8 +1555,8 @@ function Table({
|
|
|
1583
1555
|
}) })
|
|
1584
1556
|
] });
|
|
1585
1557
|
}
|
|
1586
|
-
return /* @__PURE__ */
|
|
1587
|
-
titleColumn && /* @__PURE__ */
|
|
1558
|
+
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1559
|
+
titleColumn && /* @__PURE__ */ jsxs4(
|
|
1588
1560
|
"div",
|
|
1589
1561
|
{
|
|
1590
1562
|
className: classNames3(
|
|
@@ -1598,7 +1570,7 @@ function Table({
|
|
|
1598
1570
|
}
|
|
1599
1571
|
),
|
|
1600
1572
|
(!titleColumn || cardSelectionPosition !== "title-inline") && controlsNode && /* @__PURE__ */ jsx6("div", { className: "mb-2 flex items-center gap-3", children: controlsNode }),
|
|
1601
|
-
bodyColumns.map((column) => /* @__PURE__ */
|
|
1573
|
+
bodyColumns.map((column) => /* @__PURE__ */ jsxs4("div", { className: tableResponsiveCardRowClasses, children: [
|
|
1602
1574
|
/* @__PURE__ */ jsx6("div", { className: tableResponsiveCardLabelClasses, children: column.title }),
|
|
1603
1575
|
/* @__PURE__ */ jsx6("div", { className: tableResponsiveCardValueClasses, children: renderCellContent(column) })
|
|
1604
1576
|
] }, column.key))
|
|
@@ -1613,7 +1585,7 @@ function Table({
|
|
|
1613
1585
|
]
|
|
1614
1586
|
}
|
|
1615
1587
|
),
|
|
1616
|
-
loading && /* @__PURE__ */
|
|
1588
|
+
loading && /* @__PURE__ */ jsxs4(
|
|
1617
1589
|
"div",
|
|
1618
1590
|
{
|
|
1619
1591
|
className: tableLoadingOverlayClasses,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Dropdown,
|
|
3
|
+
DropdownItem,
|
|
4
|
+
DropdownMenu
|
|
5
|
+
} from "./chunk-YI7NQWUV.mjs";
|
|
6
|
+
import {
|
|
7
|
+
useTigerConfig
|
|
8
|
+
} from "./chunk-YSIXURBW.mjs";
|
|
9
|
+
|
|
10
|
+
// src/components/DataExport.tsx
|
|
11
|
+
import { useCallback, useMemo, useState } from "react";
|
|
12
|
+
import {
|
|
13
|
+
classNames,
|
|
14
|
+
getDataExportLabels,
|
|
15
|
+
mergeTigerLocale,
|
|
16
|
+
tableExportButtonClasses
|
|
17
|
+
} from "@expcat/tigercat-core";
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
var dataExportModulePromise = null;
|
|
20
|
+
function loadDataExportModule() {
|
|
21
|
+
dataExportModulePromise ??= import("@expcat/tigercat-core/utils/data-export");
|
|
22
|
+
return dataExportModulePromise;
|
|
23
|
+
}
|
|
24
|
+
var DEFAULT_FORMATS = ["xlsx", "markdown"];
|
|
25
|
+
var DataExport = ({
|
|
26
|
+
columns,
|
|
27
|
+
dataSource,
|
|
28
|
+
formats = DEFAULT_FORMATS,
|
|
29
|
+
fileName = "export",
|
|
30
|
+
sheetName,
|
|
31
|
+
cellFormatter,
|
|
32
|
+
disabled = false,
|
|
33
|
+
locale,
|
|
34
|
+
labels,
|
|
35
|
+
className,
|
|
36
|
+
onExport,
|
|
37
|
+
onError
|
|
38
|
+
}) => {
|
|
39
|
+
const config = useTigerConfig();
|
|
40
|
+
const mergedLocale = useMemo(
|
|
41
|
+
() => mergeTigerLocale(config.locale, locale),
|
|
42
|
+
[config.locale, locale]
|
|
43
|
+
);
|
|
44
|
+
const resolvedLabels = useMemo(
|
|
45
|
+
() => getDataExportLabels(mergedLocale, labels),
|
|
46
|
+
[mergedLocale, labels]
|
|
47
|
+
);
|
|
48
|
+
const [exporting, setExporting] = useState(false);
|
|
49
|
+
const handleExport = useCallback(
|
|
50
|
+
async (format) => {
|
|
51
|
+
if (disabled || exporting) return;
|
|
52
|
+
setExporting(true);
|
|
53
|
+
try {
|
|
54
|
+
const mod = await loadDataExportModule();
|
|
55
|
+
const content = mod.exportData(columns, dataSource, format, { sheetName, cellFormatter });
|
|
56
|
+
mod.downloadDataExport(content, fileName, format);
|
|
57
|
+
onExport?.(format);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
onError?.(error);
|
|
60
|
+
} finally {
|
|
61
|
+
setExporting(false);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
[columns, dataSource, sheetName, cellFormatter, fileName, disabled, exporting, onExport, onError]
|
|
65
|
+
);
|
|
66
|
+
const formatLabel = (format) => format === "xlsx" ? resolvedLabels.xlsxText : resolvedLabels.markdownText;
|
|
67
|
+
if (formats.length === 0) return null;
|
|
68
|
+
if (formats.length === 1) {
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
"button",
|
|
71
|
+
{
|
|
72
|
+
type: "button",
|
|
73
|
+
className: classNames(tableExportButtonClasses, className),
|
|
74
|
+
"aria-label": resolvedLabels.triggerAriaLabel,
|
|
75
|
+
disabled: disabled || exporting,
|
|
76
|
+
onClick: () => void handleExport(formats[0]),
|
|
77
|
+
children: exporting ? resolvedLabels.exportingText : formatLabel(formats[0])
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
return /* @__PURE__ */ jsxs(Dropdown, { trigger: "click", disabled: disabled || exporting, className, children: [
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
"button",
|
|
84
|
+
{
|
|
85
|
+
type: "button",
|
|
86
|
+
className: tableExportButtonClasses,
|
|
87
|
+
"aria-label": resolvedLabels.triggerAriaLabel,
|
|
88
|
+
disabled: disabled || exporting,
|
|
89
|
+
children: exporting ? resolvedLabels.exportingText : resolvedLabels.triggerText
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsx(DropdownMenu, { children: formats.map((format) => /* @__PURE__ */ jsx(DropdownItem, { onClick: () => void handleExport(format), children: formatLabel(format) }, format)) })
|
|
93
|
+
] });
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
DataExport
|
|
98
|
+
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Pagination
|
|
3
|
+
} from "./chunk-HHIW7V7B.mjs";
|
|
1
4
|
import {
|
|
2
5
|
VirtualList
|
|
3
6
|
} from "./chunk-Y5X3G2LD.mjs";
|
|
@@ -30,13 +33,8 @@ import {
|
|
|
30
33
|
listGridContainerClasses,
|
|
31
34
|
getSpinnerSVG,
|
|
32
35
|
getLoadingOverlaySpinnerClasses,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
getSimplePaginationControlsClasses,
|
|
36
|
-
getSimplePaginationSelectClasses,
|
|
37
|
-
getSimplePaginationButtonClasses,
|
|
38
|
-
getSimplePaginationPageIndicatorClasses,
|
|
39
|
-
getSimplePaginationButtonsWrapperClasses,
|
|
36
|
+
getBuiltInPaginationContainerClasses,
|
|
37
|
+
resolvePaginationDisplayMode,
|
|
40
38
|
getPaginationLabels,
|
|
41
39
|
formatPaginationTotal,
|
|
42
40
|
formatPaginationPageIndicator
|
|
@@ -283,60 +281,34 @@ var List = ({
|
|
|
283
281
|
if (pagination === false || !paginationInfo) {
|
|
284
282
|
return null;
|
|
285
283
|
}
|
|
286
|
-
const { totalPages
|
|
284
|
+
const { totalPages } = paginationInfo;
|
|
287
285
|
const total = paginationTotal;
|
|
288
286
|
const paginationConfig = pagination;
|
|
289
287
|
const paginationLabels = getPaginationLabels(mergedLocale);
|
|
290
288
|
const localeCode = mergedLocale?.locale;
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
289
|
+
const { simple, showQuickJumper } = resolvePaginationDisplayMode(totalPages, paginationConfig);
|
|
290
|
+
const totalText = paginationConfig.totalText ?? ((value, range) => formatPaginationTotal(paginationLabels.totalText, value, range, localeCode));
|
|
291
|
+
const pageIndicatorText = (current, pages) => formatPaginationPageIndicator(paginationLabels.pageIndicatorText, current, pages, localeCode);
|
|
292
|
+
return /* @__PURE__ */ jsx("div", { className: getBuiltInPaginationContainerClasses(), children: /* @__PURE__ */ jsx(
|
|
293
|
+
Pagination,
|
|
294
|
+
{
|
|
295
|
+
size: "small",
|
|
296
|
+
align: "right",
|
|
297
|
+
current: currentPage,
|
|
298
|
+
pageSize: currentPageSize,
|
|
294
299
|
total,
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
" ",
|
|
308
|
-
paginationLabels.itemsPerPageText
|
|
309
|
-
] }, size2))
|
|
310
|
-
}
|
|
311
|
-
),
|
|
312
|
-
/* @__PURE__ */ jsxs("div", { className: getSimplePaginationButtonsWrapperClasses(), children: [
|
|
313
|
-
/* @__PURE__ */ jsx(
|
|
314
|
-
"button",
|
|
315
|
-
{
|
|
316
|
-
className: getSimplePaginationButtonClasses(!hasPrev),
|
|
317
|
-
disabled: !hasPrev,
|
|
318
|
-
onClick: () => handlePageChange(currentPage - 1),
|
|
319
|
-
children: paginationLabels.prevPageAriaLabel
|
|
320
|
-
}
|
|
321
|
-
),
|
|
322
|
-
/* @__PURE__ */ jsx("span", { className: getSimplePaginationPageIndicatorClasses(), children: formatPaginationPageIndicator(
|
|
323
|
-
paginationLabels.pageIndicatorText,
|
|
324
|
-
currentPage,
|
|
325
|
-
totalPages,
|
|
326
|
-
localeCode
|
|
327
|
-
) }),
|
|
328
|
-
/* @__PURE__ */ jsx(
|
|
329
|
-
"button",
|
|
330
|
-
{
|
|
331
|
-
className: getSimplePaginationButtonClasses(!hasNext),
|
|
332
|
-
disabled: !hasNext,
|
|
333
|
-
onClick: () => handlePageChange(currentPage + 1),
|
|
334
|
-
children: paginationLabels.nextPageAriaLabel
|
|
335
|
-
}
|
|
336
|
-
)
|
|
337
|
-
] })
|
|
338
|
-
] })
|
|
339
|
-
] });
|
|
300
|
+
simple,
|
|
301
|
+
showQuickJumper,
|
|
302
|
+
showSizeChanger: paginationConfig.showSizeChanger !== false,
|
|
303
|
+
showTotal: paginationConfig.showTotal !== false,
|
|
304
|
+
totalText,
|
|
305
|
+
pageIndicatorText,
|
|
306
|
+
pageSizeOptions: paginationConfig.pageSizeOptions || [10, 20, 50, 100],
|
|
307
|
+
locale: mergedLocale,
|
|
308
|
+
onChange: (page) => handlePageChange(page),
|
|
309
|
+
onPageSizeChange: (_page, pageSize) => handlePageSizeChange(pageSize)
|
|
310
|
+
}
|
|
311
|
+
) });
|
|
340
312
|
};
|
|
341
313
|
return /* @__PURE__ */ jsxs("div", { className: listWrapperClasses, children: [
|
|
342
314
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { DataExportProps as DataExportProps$1, TigerLocale, TigerLocaleDataExport, DataExportFormat } from '@expcat/tigercat-core';
|
|
3
|
+
|
|
4
|
+
interface DataExportProps<T = Record<string, unknown>> extends DataExportProps$1<T> {
|
|
5
|
+
/** Locale overrides merged on top of ConfigProvider locale */
|
|
6
|
+
locale?: Partial<TigerLocale>;
|
|
7
|
+
/** UI labels for custom text. Takes precedence over locale and ConfigProvider text. */
|
|
8
|
+
labels?: Partial<TigerLocaleDataExport>;
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Called after the download for the given format has been triggered */
|
|
11
|
+
onExport?: (format: DataExportFormat) => void;
|
|
12
|
+
/** Called when serialization or download fails */
|
|
13
|
+
onError?: (error: unknown) => void;
|
|
14
|
+
}
|
|
15
|
+
declare const DataExport: <T extends Record<string, unknown>>({ columns, dataSource, formats, fileName, sheetName, cellFormatter, disabled, locale, labels, className, onExport, onError }: DataExportProps<T>) => React__default.ReactElement | null;
|
|
16
|
+
|
|
17
|
+
export { DataExport, type DataExportProps };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DataTableWithToolbar,
|
|
3
3
|
DataTableWithToolbar_default
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-K6GJMKJR.mjs";
|
|
5
|
+
import "../chunk-N6JNLJIN.mjs";
|
|
6
6
|
import "../chunk-PAN256RW.mjs";
|
|
7
|
+
import "../chunk-QWUDJC6K.mjs";
|
|
7
8
|
import "../chunk-IIWUQK2P.mjs";
|
|
8
9
|
import "../chunk-AKNWUI7K.mjs";
|
|
9
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-HHIW7V7B.mjs";
|
|
10
11
|
import "../chunk-S7IB6YST.mjs";
|
|
11
12
|
import "../chunk-F6WV53BS.mjs";
|
|
12
13
|
import "../chunk-W7BC4I2Y.mjs";
|
package/dist/components/List.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NotificationCenter,
|
|
3
3
|
NotificationCenter_default
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-POP3TS4Q.mjs";
|
|
5
5
|
import "../chunk-Z3CRHC5F.mjs";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-QJE3MZBO.mjs";
|
|
7
|
+
import "../chunk-HHIW7V7B.mjs";
|
|
7
8
|
import "../chunk-Y5X3G2LD.mjs";
|
|
8
9
|
import "../chunk-5TE7KLE5.mjs";
|
|
9
10
|
import "../chunk-ZJWUBR2X.mjs";
|
|
@@ -3,7 +3,13 @@ import { PaginationProps as PaginationProps$1, TigerLocaleInput } from '@expcat/
|
|
|
3
3
|
|
|
4
4
|
interface PaginationProps extends Omit<PaginationProps$1, 'style'>, Omit<React__default.HTMLAttributes<HTMLElement>, 'onChange'> {
|
|
5
5
|
style?: React__default.CSSProperties;
|
|
6
|
+
/** Fired on page navigation (page button, prev/next, quick jumper). */
|
|
6
7
|
onChange?: (current: number, pageSize: number) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Fired when the page size changes. `current` is the resulting page after the
|
|
10
|
+
* new size is applied (clamped when the previous page fell out of range).
|
|
11
|
+
* A size change does not additionally fire `onChange`.
|
|
12
|
+
*/
|
|
7
13
|
onPageSizeChange?: (current: number, pageSize: number) => void;
|
|
8
14
|
/**
|
|
9
15
|
* Locale configuration for i18n support
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Table
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-N6JNLJIN.mjs";
|
|
4
4
|
import "../chunk-PAN256RW.mjs";
|
|
5
5
|
import "../chunk-IIWUQK2P.mjs";
|
|
6
6
|
import "../chunk-AKNWUI7K.mjs";
|
|
7
|
+
import "../chunk-HHIW7V7B.mjs";
|
|
7
8
|
import "../chunk-W7BC4I2Y.mjs";
|
|
8
9
|
import "../chunk-EPWAROC2.mjs";
|
|
9
10
|
import "../chunk-OL3RXYMG.mjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -39,6 +39,7 @@ export { DatePicker, DatePickerProps } from './components/DatePicker.mjs';
|
|
|
39
39
|
export { TimePicker, TimePickerProps } from './components/TimePicker.mjs';
|
|
40
40
|
export { Upload, UploadProps } from './components/Upload.mjs';
|
|
41
41
|
export { Table } from './components/Table.mjs';
|
|
42
|
+
export { DataExport, DataExportProps } from './components/DataExport.mjs';
|
|
42
43
|
export { Tag, TagProps } from './components/Tag.mjs';
|
|
43
44
|
export { Badge, BadgeProps } from './components/Badge.mjs';
|
|
44
45
|
export { Card, CardProps } from './components/Card.mjs';
|
|
@@ -149,6 +150,6 @@ import 'react';
|
|
|
149
150
|
* React components for Tigercat UI library
|
|
150
151
|
*/
|
|
151
152
|
|
|
152
|
-
declare const version = "2.0.0-
|
|
153
|
+
declare const version = "2.0.0-rc.1";
|
|
153
154
|
|
|
154
155
|
export { version };
|
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ export {
|
|
|
12
12
|
DEFAULT_CHART_COLORS,
|
|
13
13
|
DEFAULT_CHART_LABELS,
|
|
14
14
|
DEFAULT_CRON_EDITOR_LABELS,
|
|
15
|
+
DEFAULT_DATA_EXPORT_LABELS,
|
|
15
16
|
DEFAULT_FILE_MANAGER_LABELS,
|
|
16
17
|
DEFAULT_FORM_VALIDATION_LABELS,
|
|
17
18
|
DEFAULT_FORM_WIZARD_LABELS,
|
|
@@ -60,6 +61,7 @@ export {
|
|
|
60
61
|
MOTION_DURATION_TOKEN_VARS,
|
|
61
62
|
MOTION_EASING_TOKEN_FALLBACKS,
|
|
62
63
|
MOTION_EASING_TOKEN_VARS,
|
|
64
|
+
PAGINATION_FULL_MODE_PAGE_THRESHOLD,
|
|
63
65
|
PIE_BASE_SHADOW,
|
|
64
66
|
PIE_EMPHASIS_SHADOW,
|
|
65
67
|
POPOVER_TEXT_CLASSES,
|
|
@@ -95,6 +97,7 @@ export {
|
|
|
95
97
|
ZH_CN_CAROUSEL_LABELS,
|
|
96
98
|
ZH_CN_CHART_LABELS,
|
|
97
99
|
ZH_CN_CRON_EDITOR_LABELS,
|
|
100
|
+
ZH_CN_DATA_EXPORT_LABELS,
|
|
98
101
|
ZH_CN_FILE_MANAGER_LABELS,
|
|
99
102
|
ZH_CN_FORM_VALIDATION_LABELS,
|
|
100
103
|
ZH_CN_FORM_WIZARD_LABELS,
|
|
@@ -710,6 +713,7 @@ export {
|
|
|
710
713
|
getBreadcrumbItemClasses,
|
|
711
714
|
getBreadcrumbLinkClasses,
|
|
712
715
|
getBreadcrumbSeparatorClasses,
|
|
716
|
+
getBuiltInPaginationContainerClasses,
|
|
713
717
|
getButtonGroupClasses,
|
|
714
718
|
getButtonVariantClasses,
|
|
715
719
|
getCalendarContainerClasses,
|
|
@@ -789,6 +793,7 @@ export {
|
|
|
789
793
|
getCurrentActiveTourStep,
|
|
790
794
|
getCurrentTime,
|
|
791
795
|
getCyclicIndex,
|
|
796
|
+
getDataExportLabels,
|
|
792
797
|
getDatePickerCalendarCellState,
|
|
793
798
|
getDatePickerDayCellClasses,
|
|
794
799
|
getDatePickerIconButtonClasses,
|
|
@@ -1067,13 +1072,6 @@ export {
|
|
|
1067
1072
|
getSignatureCanvasDataUrl,
|
|
1068
1073
|
getSignatureCanvasWrapClasses,
|
|
1069
1074
|
getSignaturePoint,
|
|
1070
|
-
getSimplePaginationButtonClasses,
|
|
1071
|
-
getSimplePaginationButtonsWrapperClasses,
|
|
1072
|
-
getSimplePaginationContainerClasses,
|
|
1073
|
-
getSimplePaginationControlsClasses,
|
|
1074
|
-
getSimplePaginationPageIndicatorClasses,
|
|
1075
|
-
getSimplePaginationSelectClasses,
|
|
1076
|
-
getSimplePaginationTotalClasses,
|
|
1077
1075
|
getSizeTextClasses,
|
|
1078
1076
|
getSkeletonClasses,
|
|
1079
1077
|
getSkeletonDimensions,
|
|
@@ -1655,6 +1653,7 @@ export {
|
|
|
1655
1653
|
resolveMotionDuration,
|
|
1656
1654
|
resolveMotionEasing,
|
|
1657
1655
|
resolveMultiSeriesTooltipContent,
|
|
1656
|
+
resolvePaginationDisplayMode,
|
|
1658
1657
|
resolvePanGesture,
|
|
1659
1658
|
resolvePinchScale,
|
|
1660
1659
|
resolveResponsiveChartSize,
|
|
@@ -2067,6 +2066,7 @@ export { DatePicker } from './components/DatePicker.mjs';
|
|
|
2067
2066
|
export { TimePicker } from './components/TimePicker.mjs';
|
|
2068
2067
|
export { Upload } from './components/Upload.mjs';
|
|
2069
2068
|
export { Table } from './components/Table.mjs';
|
|
2069
|
+
export { DataExport } from './components/DataExport.mjs';
|
|
2070
2070
|
export { Tag } from './components/Tag.mjs';
|
|
2071
2071
|
export { Badge } from './components/Badge.mjs';
|
|
2072
2072
|
export { Card } from './components/Card.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expcat/tigercat-react",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
4
4
|
"description": "React components for Tigercat UI library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Yizhe Wang",
|
|
@@ -244,6 +244,11 @@
|
|
|
244
244
|
"import": "./dist/components/CropUpload.mjs",
|
|
245
245
|
"default": "./dist/components/CropUpload.mjs"
|
|
246
246
|
},
|
|
247
|
+
"./DataExport": {
|
|
248
|
+
"types": "./dist/components/DataExport.d.mts",
|
|
249
|
+
"import": "./dist/components/DataExport.mjs",
|
|
250
|
+
"default": "./dist/components/DataExport.mjs"
|
|
251
|
+
},
|
|
247
252
|
"./DataTableWithToolbar": {
|
|
248
253
|
"types": "./dist/components/DataTableWithToolbar.d.mts",
|
|
249
254
|
"import": "./dist/components/DataTableWithToolbar.mjs",
|
|
@@ -777,7 +782,7 @@
|
|
|
777
782
|
"access": "public"
|
|
778
783
|
},
|
|
779
784
|
"dependencies": {
|
|
780
|
-
"@expcat/tigercat-core": "2.0.0-
|
|
785
|
+
"@expcat/tigercat-core": "2.0.0-rc.1"
|
|
781
786
|
},
|
|
782
787
|
"devDependencies": {
|
|
783
788
|
"@types/node": "^22.20.0",
|