@expcat/tigercat-react 2.0.0-preview.5 → 2.0.0-preview.6
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-2DCKVGQ3.mjs} +12 -6
- package/dist/{chunk-N3ESPSVN.mjs → chunk-2HNUN6OM.mjs} +31 -55
- package/dist/chunk-OVE2ZUJJ.mjs +98 -0
- package/dist/{chunk-HT7XNBI7.mjs → chunk-RM2LACNK.mjs} +1 -1
- package/dist/{chunk-UKDPTEJI.mjs → chunk-U3TW75H3.mjs} +61 -85
- package/dist/{chunk-YLUSOQKR.mjs → chunk-VDI4T62S.mjs} +1 -1
- 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.mjs +1 -1
- package/dist/components/Table.mjs +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +7 -0
- package/package.json +7 -2
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
resolveTigerLocale,
|
|
32
32
|
mergeTigerLocale
|
|
33
33
|
} from "@expcat/tigercat-core";
|
|
34
|
-
import { jsx
|
|
34
|
+
import { jsx } from "react/jsx-runtime";
|
|
35
35
|
var Pagination = ({
|
|
36
36
|
current: controlledCurrent,
|
|
37
37
|
defaultCurrent = 1,
|
|
@@ -44,6 +44,7 @@ var Pagination = ({
|
|
|
44
44
|
showTotal = true,
|
|
45
45
|
totalText,
|
|
46
46
|
simple = false,
|
|
47
|
+
pageIndicatorText,
|
|
47
48
|
size = "medium",
|
|
48
49
|
align = "center",
|
|
49
50
|
disabled = false,
|
|
@@ -210,12 +211,17 @@ var Pagination = ({
|
|
|
210
211
|
)
|
|
211
212
|
);
|
|
212
213
|
if (simple) {
|
|
214
|
+
const indicatorText = pageIndicatorText ? pageIndicatorText(validatedCurrentPage, totalPages) : `${validatedCurrentPage} / ${totalPages}`;
|
|
213
215
|
elements.push(
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
/* @__PURE__ */ jsx(
|
|
217
|
+
"span",
|
|
218
|
+
{
|
|
219
|
+
className: classNames("mx-2", getSizeTextClasses(size)),
|
|
220
|
+
"aria-label": indicatorText,
|
|
221
|
+
children: indicatorText
|
|
222
|
+
},
|
|
223
|
+
"current"
|
|
224
|
+
)
|
|
219
225
|
);
|
|
220
226
|
} else {
|
|
221
227
|
getPageNumbers(validatedCurrentPage, totalPages, showLessItems).forEach((pageNum, index) => {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Pagination
|
|
3
|
+
} from "./chunk-2DCKVGQ3.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,38 @@ 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
|
-
size2,
|
|
307
|
-
" ",
|
|
308
|
-
paginationLabels.itemsPerPageText
|
|
309
|
-
] }, size2))
|
|
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, pageSize) => {
|
|
309
|
+
if (pageSize === currentPageSize) {
|
|
310
|
+
handlePageChange(page);
|
|
310
311
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
-
] });
|
|
312
|
+
},
|
|
313
|
+
onPageSizeChange: (_page, pageSize) => handlePageSizeChange(pageSize)
|
|
314
|
+
}
|
|
315
|
+
) });
|
|
340
316
|
};
|
|
341
317
|
return /* @__PURE__ */ jsxs("div", { className: listWrapperClasses, children: [
|
|
342
318
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
@@ -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
|
+
};
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
Radio
|
|
6
6
|
} from "./chunk-IIWUQK2P.mjs";
|
|
7
|
+
import {
|
|
8
|
+
Pagination
|
|
9
|
+
} from "./chunk-2DCKVGQ3.mjs";
|
|
7
10
|
import {
|
|
8
11
|
Empty
|
|
9
12
|
} from "./chunk-W7BC4I2Y.mjs";
|
|
@@ -940,100 +943,73 @@ 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
|
-
|
|
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, pageSize) => {
|
|
1002
|
+
if (pageSize === ctx.currentPageSize) {
|
|
1003
|
+
ctx.handlePageChange(page);
|
|
999
1004
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
{
|
|
1005
|
-
className: getSimplePaginationButtonClasses(!hasPrev),
|
|
1006
|
-
disabled: !hasPrev,
|
|
1007
|
-
"aria-label": finalPrevAriaLabel,
|
|
1008
|
-
onClick: () => ctx.handlePageChange(ctx.currentPage - 1),
|
|
1009
|
-
children: finalPrevText
|
|
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
|
-
] });
|
|
1005
|
+
},
|
|
1006
|
+
onPageSizeChange: (_page, pageSize) => ctx.handlePageSizeChange(pageSize)
|
|
1007
|
+
}
|
|
1008
|
+
) });
|
|
1033
1009
|
}
|
|
1034
1010
|
|
|
1035
1011
|
// src/components/Table.tsx
|
|
1036
|
-
import { Fragment, jsx as jsx6, jsxs as
|
|
1012
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1037
1013
|
function Table({
|
|
1038
1014
|
columns,
|
|
1039
1015
|
columnLockable = false,
|
|
@@ -1269,7 +1245,7 @@ function Table({
|
|
|
1269
1245
|
controller.observe(wrapper, tableRef.current);
|
|
1270
1246
|
return () => controller.disconnect();
|
|
1271
1247
|
}, [ctx.displayColumns.length, ctx.paginatedData.length]);
|
|
1272
|
-
return /* @__PURE__ */
|
|
1248
|
+
return /* @__PURE__ */ jsxs4(
|
|
1273
1249
|
"div",
|
|
1274
1250
|
{
|
|
1275
1251
|
ref: wrapperRef,
|
|
@@ -1295,7 +1271,7 @@ function Table({
|
|
|
1295
1271
|
children: exportFormat === "excel" ? tableLabels.exportExcelText : tableLabels.exportCsvText
|
|
1296
1272
|
}
|
|
1297
1273
|
) }),
|
|
1298
|
-
/* @__PURE__ */
|
|
1274
|
+
/* @__PURE__ */ jsxs4(
|
|
1299
1275
|
"table",
|
|
1300
1276
|
{
|
|
1301
1277
|
ref: tableRef,
|
|
@@ -1358,7 +1334,7 @@ function Table({
|
|
|
1358
1334
|
]
|
|
1359
1335
|
}
|
|
1360
1336
|
),
|
|
1361
|
-
responsiveMode === "card" && /* @__PURE__ */
|
|
1337
|
+
responsiveMode === "card" && /* @__PURE__ */ jsxs4(
|
|
1362
1338
|
"div",
|
|
1363
1339
|
{
|
|
1364
1340
|
className: getTableResponsiveCardListClasses(cardBreakpoint),
|
|
@@ -1424,7 +1400,7 @@ function Table({
|
|
|
1424
1400
|
};
|
|
1425
1401
|
const customCard = renderCard?.(renderContext);
|
|
1426
1402
|
const resolvedCardClassName = typeof cardClassName === "function" ? cardClassName(record, index) : cardClassName;
|
|
1427
|
-
const controlsNode = internalRowSelection?.showCheckbox !== false && internalRowSelection || internalExpandable && isRowExpandable ? /* @__PURE__ */
|
|
1403
|
+
const controlsNode = internalRowSelection?.showCheckbox !== false && internalRowSelection || internalExpandable && isRowExpandable ? /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1428
1404
|
internalRowSelection && internalRowSelection.showCheckbox !== false && /* @__PURE__ */ jsx6("span", { onClick: (event) => event.stopPropagation(), children: internalRowSelection.type === "radio" ? /* @__PURE__ */ jsx6(
|
|
1429
1405
|
Radio,
|
|
1430
1406
|
{
|
|
@@ -1474,7 +1450,7 @@ function Table({
|
|
|
1474
1450
|
resolvedCardClassName
|
|
1475
1451
|
),
|
|
1476
1452
|
onClick: () => ctx.handleRowClick(record, index, key),
|
|
1477
|
-
children: customCard !== void 0 && customCard !== null ? customCard : /* @__PURE__ */
|
|
1453
|
+
children: customCard !== void 0 && customCard !== null ? customCard : /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1478
1454
|
(() => {
|
|
1479
1455
|
const { titleColumn, bodyColumns } = getCardColumns(ctx.displayColumns);
|
|
1480
1456
|
const renderCellContent = (column) => {
|
|
@@ -1482,8 +1458,8 @@ function Table({
|
|
|
1482
1458
|
return column.render ? column.render(record, index) : record[dataKey];
|
|
1483
1459
|
};
|
|
1484
1460
|
if (hasCustomCardLayout) {
|
|
1485
|
-
return /* @__PURE__ */
|
|
1486
|
-
titleColumn && /* @__PURE__ */
|
|
1461
|
+
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1462
|
+
titleColumn && /* @__PURE__ */ jsxs4(
|
|
1487
1463
|
"div",
|
|
1488
1464
|
{
|
|
1489
1465
|
className: classNames3(
|
|
@@ -1514,7 +1490,7 @@ function Table({
|
|
|
1514
1490
|
);
|
|
1515
1491
|
}
|
|
1516
1492
|
if (gridInfo.labelPosition === "top") {
|
|
1517
|
-
return /* @__PURE__ */
|
|
1493
|
+
return /* @__PURE__ */ jsxs4(
|
|
1518
1494
|
"div",
|
|
1519
1495
|
{
|
|
1520
1496
|
className: classNames3(
|
|
@@ -1547,7 +1523,7 @@ function Table({
|
|
|
1547
1523
|
column.key
|
|
1548
1524
|
);
|
|
1549
1525
|
}
|
|
1550
|
-
return /* @__PURE__ */
|
|
1526
|
+
return /* @__PURE__ */ jsxs4(
|
|
1551
1527
|
"div",
|
|
1552
1528
|
{
|
|
1553
1529
|
className: classNames3(
|
|
@@ -1583,8 +1559,8 @@ function Table({
|
|
|
1583
1559
|
}) })
|
|
1584
1560
|
] });
|
|
1585
1561
|
}
|
|
1586
|
-
return /* @__PURE__ */
|
|
1587
|
-
titleColumn && /* @__PURE__ */
|
|
1562
|
+
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1563
|
+
titleColumn && /* @__PURE__ */ jsxs4(
|
|
1588
1564
|
"div",
|
|
1589
1565
|
{
|
|
1590
1566
|
className: classNames3(
|
|
@@ -1598,7 +1574,7 @@ function Table({
|
|
|
1598
1574
|
}
|
|
1599
1575
|
),
|
|
1600
1576
|
(!titleColumn || cardSelectionPosition !== "title-inline") && controlsNode && /* @__PURE__ */ jsx6("div", { className: "mb-2 flex items-center gap-3", children: controlsNode }),
|
|
1601
|
-
bodyColumns.map((column) => /* @__PURE__ */
|
|
1577
|
+
bodyColumns.map((column) => /* @__PURE__ */ jsxs4("div", { className: tableResponsiveCardRowClasses, children: [
|
|
1602
1578
|
/* @__PURE__ */ jsx6("div", { className: tableResponsiveCardLabelClasses, children: column.title }),
|
|
1603
1579
|
/* @__PURE__ */ jsx6("div", { className: tableResponsiveCardValueClasses, children: renderCellContent(column) })
|
|
1604
1580
|
] }, column.key))
|
|
@@ -1613,7 +1589,7 @@ function Table({
|
|
|
1613
1589
|
]
|
|
1614
1590
|
}
|
|
1615
1591
|
),
|
|
1616
|
-
loading && /* @__PURE__ */
|
|
1592
|
+
loading && /* @__PURE__ */ jsxs4(
|
|
1617
1593
|
"div",
|
|
1618
1594
|
{
|
|
1619
1595
|
className: tableLoadingOverlayClasses,
|
|
@@ -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-RM2LACNK.mjs";
|
|
5
|
+
import "../chunk-U3TW75H3.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-2DCKVGQ3.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-VDI4T62S.mjs";
|
|
5
5
|
import "../chunk-Z3CRHC5F.mjs";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-2HNUN6OM.mjs";
|
|
7
|
+
import "../chunk-2DCKVGQ3.mjs";
|
|
7
8
|
import "../chunk-Y5X3G2LD.mjs";
|
|
8
9
|
import "../chunk-5TE7KLE5.mjs";
|
|
9
10
|
import "../chunk-ZJWUBR2X.mjs";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Table
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-U3TW75H3.mjs";
|
|
4
4
|
import "../chunk-PAN256RW.mjs";
|
|
5
5
|
import "../chunk-IIWUQK2P.mjs";
|
|
6
6
|
import "../chunk-AKNWUI7K.mjs";
|
|
7
|
+
import "../chunk-2DCKVGQ3.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-preview.
|
|
153
|
+
declare const version = "2.0.0-preview.6";
|
|
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,
|
|
@@ -1655,6 +1660,7 @@ export {
|
|
|
1655
1660
|
resolveMotionDuration,
|
|
1656
1661
|
resolveMotionEasing,
|
|
1657
1662
|
resolveMultiSeriesTooltipContent,
|
|
1663
|
+
resolvePaginationDisplayMode,
|
|
1658
1664
|
resolvePanGesture,
|
|
1659
1665
|
resolvePinchScale,
|
|
1660
1666
|
resolveResponsiveChartSize,
|
|
@@ -2067,6 +2073,7 @@ export { DatePicker } from './components/DatePicker.mjs';
|
|
|
2067
2073
|
export { TimePicker } from './components/TimePicker.mjs';
|
|
2068
2074
|
export { Upload } from './components/Upload.mjs';
|
|
2069
2075
|
export { Table } from './components/Table.mjs';
|
|
2076
|
+
export { DataExport } from './components/DataExport.mjs';
|
|
2070
2077
|
export { Tag } from './components/Tag.mjs';
|
|
2071
2078
|
export { Badge } from './components/Badge.mjs';
|
|
2072
2079
|
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-preview.
|
|
3
|
+
"version": "2.0.0-preview.6",
|
|
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-preview.
|
|
785
|
+
"@expcat/tigercat-core": "2.0.0-preview.6"
|
|
781
786
|
},
|
|
782
787
|
"devDependencies": {
|
|
783
788
|
"@types/node": "^22.20.0",
|