@expcat/tigercat-react 1.2.23 → 1.2.31

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.
Files changed (51) hide show
  1. package/dist/{chunk-MMGZEG7G.mjs → chunk-56DP32W7.mjs} +93 -45
  2. package/dist/{chunk-36WZNVQ5.mjs → chunk-5XE5VBDS.mjs} +2 -3
  3. package/dist/{chunk-2DH6MGC6.js → chunk-7KPALCG3.js} +11 -7
  4. package/dist/{chunk-7YUD6VIC.js → chunk-APODZAVO.js} +47 -16
  5. package/dist/{chunk-LKKZLYCA.mjs → chunk-CPNDCACQ.mjs} +1 -1
  6. package/dist/{chunk-XHT2VIDR.js → chunk-FXVKJWUP.js} +19 -9
  7. package/dist/{chunk-RUZQN7X3.js → chunk-FZIF5LZW.js} +52 -25
  8. package/dist/{chunk-X37Q7VME.mjs → chunk-GYFR2O27.mjs} +11 -7
  9. package/dist/chunk-I5YYA7FB.mjs +244 -0
  10. package/dist/{chunk-3FEFHD3E.mjs → chunk-IUOTJ73N.mjs} +1 -0
  11. package/dist/{chunk-T7ACOL7K.mjs → chunk-IWLUYAZV.mjs} +62 -15
  12. package/dist/{chunk-5EZWYEGJ.js → chunk-IXHXSD2E.js} +65 -18
  13. package/dist/{chunk-EX63M5ID.js → chunk-JCINYGGM.js} +93 -45
  14. package/dist/{chunk-CSH2QOOH.js → chunk-K5B4XXAI.js} +2 -2
  15. package/dist/{chunk-UE52NMPO.js → chunk-KTV3ZDSQ.js} +1 -0
  16. package/dist/{chunk-XPA2YCQO.js → chunk-M7HBWFQO.js} +1 -2
  17. package/dist/{chunk-DTYDPMNR.js → chunk-P4INKEQ3.js} +76 -9
  18. package/dist/{chunk-5XS6PXBX.mjs → chunk-PKWHSCFK.mjs} +52 -25
  19. package/dist/{chunk-J5R4Q2QM.mjs → chunk-UQOMRXTD.mjs} +74 -7
  20. package/dist/chunk-UVWLYRAC.js +244 -0
  21. package/dist/{chunk-6CAKUMWV.mjs → chunk-VUODYCCC.mjs} +46 -15
  22. package/dist/{chunk-ZB55SAGI.mjs → chunk-WWDCH2XX.mjs} +19 -9
  23. package/dist/components/ActivityFeed.js +2 -2
  24. package/dist/components/ActivityFeed.mjs +1 -1
  25. package/dist/components/ChatWindow.js +3 -2
  26. package/dist/components/ChatWindow.mjs +2 -1
  27. package/dist/components/CommentThread.js +2 -2
  28. package/dist/components/CommentThread.mjs +1 -1
  29. package/dist/components/CropUpload.js +2 -2
  30. package/dist/components/CropUpload.mjs +1 -1
  31. package/dist/components/DataTableWithToolbar.js +4 -3
  32. package/dist/components/DataTableWithToolbar.mjs +3 -2
  33. package/dist/components/FormWizard.js +3 -3
  34. package/dist/components/FormWizard.mjs +2 -2
  35. package/dist/components/Kanban.js +3 -3
  36. package/dist/components/Kanban.mjs +2 -2
  37. package/dist/components/NotificationCenter.js +2 -2
  38. package/dist/components/NotificationCenter.mjs +1 -1
  39. package/dist/components/Steps.js +2 -2
  40. package/dist/components/Steps.mjs +1 -1
  41. package/dist/components/StepsItem.js +2 -2
  42. package/dist/components/StepsItem.mjs +1 -1
  43. package/dist/components/Table.js +3 -2
  44. package/dist/components/Table.mjs +2 -1
  45. package/dist/components/TaskBoard.js +2 -2
  46. package/dist/components/TaskBoard.mjs +1 -1
  47. package/dist/index.js +15 -15
  48. package/dist/index.mjs +14 -14
  49. package/package.json +2 -2
  50. package/dist/chunk-DXMSDLVJ.js +0 -168
  51. package/dist/chunk-GBJILZTY.mjs +0 -168
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  VirtualList
3
3
  } from "./chunk-7DUHHRAU.mjs";
4
+ import {
5
+ Empty
6
+ } from "./chunk-WIWTY74F.mjs";
4
7
  import {
5
8
  Input
6
9
  } from "./chunk-WNLUUD5N.mjs";
@@ -64,7 +67,7 @@ var ChatWindow = ({
64
67
  const inputValue = value !== void 0 ? value : innerValue;
65
68
  const wrapperClasses = useMemo(
66
69
  () => classNames(
67
- "tiger-chat-window flex flex-col w-full rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)]",
70
+ "tiger-chat-window flex flex-col w-full rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] shadow-sm overflow-hidden transition-all duration-300",
68
71
  className
69
72
  ),
70
73
  [className]
@@ -144,8 +147,8 @@ var ChatWindow = ({
144
147
  "div",
145
148
  {
146
149
  className: classNames(
147
- "rounded-[var(--tiger-radius-md,0.5rem)] px-3 py-2 text-sm break-words",
148
- isSelf ? "bg-[var(--tiger-primary,#2563eb)] text-white rounded-tr-none" : "bg-[var(--tiger-surface-muted,#f3f4f6)] text-[var(--tiger-text,#111827)] rounded-tl-none"
150
+ "rounded-[var(--tiger-radius-lg,0.75rem)] px-4 py-2.5 text-sm break-words shadow-sm transition-all",
151
+ isSelf ? "bg-[var(--tiger-primary,#2563eb)] text-white rounded-tr-[var(--tiger-radius-sm,0.375rem)]" : "bg-[var(--tiger-surface,#ffffff)] border border-[var(--tiger-border,#e5e7eb)] text-[var(--tiger-text,#111827)] rounded-tl-[var(--tiger-radius-sm,0.375rem)]"
149
152
  ),
150
153
  "data-tiger-chat-bubble": true,
151
154
  children: renderMessage?.(message, index) ?? message.content
@@ -177,6 +180,7 @@ var ChatWindow = ({
177
180
  "div",
178
181
  {
179
182
  ref: messageListRef,
183
+ className: "flex-1 overflow-auto bg-[var(--tiger-surface-muted,#f9fafb)]",
180
184
  role: "log",
181
185
  "aria-live": "polite",
182
186
  "aria-relevant": "additions text",
@@ -195,16 +199,16 @@ var ChatWindow = ({
195
199
  "div",
196
200
  {
197
201
  ref: messageListRef,
198
- className: "flex-1 overflow-auto p-4 space-y-3",
202
+ className: "flex-1 overflow-auto p-5 space-y-4 bg-[var(--tiger-surface-muted,#f9fafb)]",
199
203
  role: "log",
200
204
  "aria-live": "polite",
201
205
  "aria-relevant": "additions text",
202
206
  "aria-label": messageListAriaLabel ?? "\u6D88\u606F\u5217\u8868",
203
- children: messages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center text-[var(--tiger-text-muted,#6b7280)]", children: emptyText }) : messages.map(renderMessageItem)
207
+ children: messages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center py-8", children: /* @__PURE__ */ jsx(Empty, { description: emptyText }) }) : messages.map(renderMessageItem)
204
208
  }
205
209
  ),
206
- statusText && /* @__PURE__ */ jsx("div", { className: "px-4 py-1.5 border-t border-[var(--tiger-border,#e5e7eb)] text-xs italic text-[var(--tiger-text-muted,#6b7280)]", children: statusText }),
207
- /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-3 px-4 py-3 border-t border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] rounded-b-lg", children: [
210
+ statusText && /* @__PURE__ */ jsx("div", { className: "px-5 py-2 border-t border-[var(--tiger-border,#e5e7eb)] text-xs italic text-[var(--tiger-text-muted,#6b7280)] bg-[var(--tiger-surface-muted,#f9fafb)]", children: statusText }),
211
+ /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-3 px-5 py-4 border-t border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] rounded-b-lg", children: [
208
212
  /* @__PURE__ */ jsx("div", { className: "flex-1", children: inputType === "input" ? /* @__PURE__ */ jsx(
209
213
  Input,
210
214
  {
@@ -0,0 +1,244 @@
1
+ import {
2
+ Timeline
3
+ } from "./chunk-JVTAKNRO.mjs";
4
+ import {
5
+ Loading
6
+ } from "./chunk-FNJDBFKM.mjs";
7
+ import {
8
+ Link
9
+ } from "./chunk-XZVQ3PJS.mjs";
10
+ import {
11
+ Tag
12
+ } from "./chunk-TGKNEMD4.mjs";
13
+ import {
14
+ Text
15
+ } from "./chunk-HLS4CHWX.mjs";
16
+ import {
17
+ Card
18
+ } from "./chunk-P6E3DILH.mjs";
19
+ import {
20
+ Avatar
21
+ } from "./chunk-4ZZ7YRTB.mjs";
22
+
23
+ // src/components/ActivityFeed.tsx
24
+ import { useMemo } from "react";
25
+ import {
26
+ classNames,
27
+ buildActivityGroups,
28
+ formatActivityTime,
29
+ toActivityTimelineItems,
30
+ activityItemClasses,
31
+ activityItemLayoutClasses,
32
+ activityItemBodyClasses,
33
+ activityItemHeaderClasses,
34
+ activityItemTitleGroupClasses,
35
+ activityItemDescriptionClasses,
36
+ activityItemActionsClasses
37
+ } from "@expcat/tigercat-core";
38
+ import { jsx, jsxs } from "react/jsx-runtime";
39
+ var renderAction = (item, action, index) => {
40
+ const key = action.key ?? `${item.id}-action-${index}`;
41
+ return /* @__PURE__ */ jsx(
42
+ Link,
43
+ {
44
+ size: "sm",
45
+ variant: "primary",
46
+ underline: false,
47
+ href: action.href,
48
+ target: action.target,
49
+ disabled: action.disabled,
50
+ className: "inline-flex items-center px-2.5 py-1 rounded-lg hover:bg-blue-50/50 dark:hover:bg-blue-950/20 text-xs font-semibold transition-all duration-200",
51
+ onClick: () => action.onClick?.(item, action),
52
+ children: action.label
53
+ },
54
+ key
55
+ );
56
+ };
57
+ var ActivityFeed = ({
58
+ items = [],
59
+ groups,
60
+ groupBy,
61
+ groupOrder,
62
+ loading = false,
63
+ loadingText = "\u52A0\u8F7D\u4E2D...",
64
+ emptyText = "\u6682\u65E0\u52A8\u6001",
65
+ showAvatar = true,
66
+ showTime = true,
67
+ showGroupTitle = true,
68
+ renderItem,
69
+ renderGroupHeader,
70
+ className,
71
+ ...props
72
+ }) => {
73
+ const resolvedGroups = useMemo(
74
+ () => buildActivityGroups(items, groups, groupBy, groupOrder),
75
+ [items, groups, groupBy, groupOrder]
76
+ );
77
+ const wrapperClasses = classNames(
78
+ "tiger-activity-feed",
79
+ "flex",
80
+ "flex-col",
81
+ "gap-6",
82
+ "w-full",
83
+ className
84
+ );
85
+ const renderDefaultItem = (item, index, group) => {
86
+ if (renderItem) return renderItem(item, index, group);
87
+ const titleText = item.title ?? (typeof item.content === "string" || typeof item.content === "number" ? String(item.content) : "");
88
+ const descriptionText = item.description;
89
+ const timeText = showTime ? formatActivityTime(item.time) : "";
90
+ const actionNodes = item.actions?.map(
91
+ (action, actionIndex) => renderAction(item, action, actionIndex)
92
+ );
93
+ return /* @__PURE__ */ jsx("div", { className: classNames(activityItemClasses, "p-4 rounded-2xl border border-gray-100/70 dark:border-gray-800/40 bg-white/40 dark:bg-gray-900/15 backdrop-blur-sm shadow-sm transition-all duration-300 hover:shadow-md hover:shadow-gray-100/30 dark:hover:shadow-none hover:bg-white dark:hover:bg-gray-900/30 hover:-translate-y-0.5 w-full"), children: /* @__PURE__ */ jsxs("div", { className: activityItemLayoutClasses, children: [
94
+ showAvatar && item.user ? /* @__PURE__ */ jsx(
95
+ Avatar,
96
+ {
97
+ size: "sm",
98
+ src: item.user.avatar,
99
+ text: item.user.name,
100
+ className: "shrink-0 ring-2 ring-white dark:ring-gray-900 shadow-sm transition-transform hover:scale-105 duration-200"
101
+ }
102
+ ) : null,
103
+ /* @__PURE__ */ jsxs("div", { className: activityItemBodyClasses, children: [
104
+ /* @__PURE__ */ jsxs("div", { className: activityItemHeaderClasses, children: [
105
+ /* @__PURE__ */ jsxs("div", { className: activityItemTitleGroupClasses, children: [
106
+ titleText ? /* @__PURE__ */ jsx(Text, { tag: "div", size: "sm", weight: "semibold", className: "text-gray-900 dark:text-gray-100 hover:text-blue-600 dark:hover:text-blue-400 transition-colors cursor-pointer truncate", children: titleText }) : null,
107
+ item.status ? /* @__PURE__ */ jsx(
108
+ Tag,
109
+ {
110
+ variant: item.status.variant ?? "default",
111
+ size: "sm",
112
+ className: "shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold tracking-wide uppercase border border-current bg-opacity-10 shadow-sm",
113
+ children: item.status.label
114
+ }
115
+ ) : null
116
+ ] }),
117
+ timeText ? /* @__PURE__ */ jsx(Text, { tag: "div", size: "xs", color: "muted", className: "shrink-0 whitespace-nowrap font-medium text-gray-400 dark:text-gray-500", children: timeText }) : null
118
+ ] }),
119
+ descriptionText ? /* @__PURE__ */ jsx(
120
+ Text,
121
+ {
122
+ tag: "div",
123
+ size: "sm",
124
+ color: "muted",
125
+ className: classNames(activityItemDescriptionClasses, "text-gray-600 dark:text-gray-300 leading-relaxed pl-0.5 mt-1"),
126
+ children: descriptionText
127
+ }
128
+ ) : null,
129
+ actionNodes?.length ? /* @__PURE__ */ jsx("div", { className: classNames(activityItemActionsClasses, "mt-2.5"), children: actionNodes }) : null
130
+ ] })
131
+ ] }) });
132
+ };
133
+ if (loading) {
134
+ return /* @__PURE__ */ jsx(
135
+ "div",
136
+ {
137
+ className: wrapperClasses,
138
+ role: "feed",
139
+ "aria-label": "\u52A8\u6001",
140
+ "aria-busy": true,
141
+ ...props,
142
+ "data-tiger-activity-feed": true,
143
+ children: /* @__PURE__ */ jsx(
144
+ Card,
145
+ {
146
+ variant: "bordered",
147
+ size: "sm",
148
+ className: "tiger-activity-feed-loading bg-white/40 dark:bg-gray-900/20 border-gray-100 dark:border-gray-800/80 backdrop-blur-sm rounded-2xl shadow-sm overflow-hidden",
149
+ children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsx(Loading, { text: loadingText, className: "text-blue-500 dark:text-blue-400 font-medium" }) })
150
+ }
151
+ )
152
+ }
153
+ );
154
+ }
155
+ if (resolvedGroups.length === 0) {
156
+ return /* @__PURE__ */ jsx(
157
+ "div",
158
+ {
159
+ className: wrapperClasses,
160
+ role: "feed",
161
+ "aria-label": "\u52A8\u6001",
162
+ ...props,
163
+ "data-tiger-activity-feed": true,
164
+ children: /* @__PURE__ */ jsx(
165
+ Card,
166
+ {
167
+ variant: "bordered",
168
+ size: "sm",
169
+ className: "tiger-activity-feed-empty bg-white/40 dark:bg-gray-900/20 border-gray-100 dark:border-gray-800/80 backdrop-blur-sm rounded-2xl shadow-sm overflow-hidden",
170
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-12 px-4", children: [
171
+ /* @__PURE__ */ jsx("svg", { className: "w-12 h-12 text-gray-300 dark:text-gray-600 mb-3 animate-pulse", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 7.5h1.5m-1.5 3h1.5m-7.5 3h10.5m-10.5 3h10.5m-13.5-9h16.5M3 5.25h18M3 18.75h18" }) }),
172
+ /* @__PURE__ */ jsx(Text, { tag: "div", size: "sm", color: "muted", className: "font-medium", children: emptyText })
173
+ ] })
174
+ }
175
+ )
176
+ }
177
+ );
178
+ }
179
+ return /* @__PURE__ */ jsx(
180
+ "div",
181
+ {
182
+ className: wrapperClasses,
183
+ role: "feed",
184
+ "aria-label": "\u52A8\u6001",
185
+ ...props,
186
+ "data-tiger-activity-feed": true,
187
+ children: resolvedGroups.map((group, groupIndex) => {
188
+ const headerNode = renderGroupHeader?.(group);
189
+ const groupTitle = group.title;
190
+ const timelineItems = toActivityTimelineItems(group.items);
191
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
192
+ showGroupTitle && groupTitle ? headerNode ?? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
193
+ /* @__PURE__ */ jsx("span", { className: "w-1.5 h-3.5 bg-blue-500 rounded-full dark:bg-blue-400 shadow-sm shadow-blue-500/20" }),
194
+ /* @__PURE__ */ jsx(Text, { tag: "span", size: "sm", weight: "bold", className: "text-gray-900 dark:text-gray-100 uppercase tracking-wider", children: groupTitle })
195
+ ] }) : null,
196
+ /* @__PURE__ */ jsx(
197
+ Timeline,
198
+ {
199
+ items: timelineItems,
200
+ style: {
201
+ "--tiger-border": "rgba(156, 163, 175, 0.18)"
202
+ },
203
+ renderDot: (timelineItem) => {
204
+ const activity = timelineItem.activity;
205
+ const statusVariant = activity?.status?.variant ?? "default";
206
+ const baseDotClass = "w-3 h-3 rounded-full border-2 border-white dark:border-gray-950 shadow-sm";
207
+ let colorClass = "bg-gray-300 dark:bg-gray-700";
208
+ let pulseClass = "";
209
+ if (statusVariant === "success") {
210
+ colorClass = "bg-emerald-500";
211
+ pulseClass = "bg-emerald-500/30";
212
+ } else if (statusVariant === "warning") {
213
+ colorClass = "bg-amber-500";
214
+ pulseClass = "bg-amber-500/30";
215
+ } else if (statusVariant === "error" || statusVariant === "danger") {
216
+ colorClass = "bg-rose-500";
217
+ pulseClass = "bg-rose-500/30";
218
+ } else if (statusVariant === "primary" || statusVariant === "info") {
219
+ colorClass = "bg-blue-500";
220
+ pulseClass = "bg-blue-500/30";
221
+ }
222
+ return /* @__PURE__ */ jsxs("div", { className: "relative flex items-center justify-center w-4 h-4", children: [
223
+ pulseClass ? /* @__PURE__ */ jsx("span", { className: `absolute inline-flex h-full w-full rounded-full animate-ping opacity-75 ${pulseClass}` }) : null,
224
+ /* @__PURE__ */ jsx("span", { className: `${baseDotClass} ${colorClass} relative z-10` })
225
+ ] });
226
+ },
227
+ renderItem: (timelineItem, index) => {
228
+ const activity = timelineItem.activity;
229
+ if (!activity) return null;
230
+ return renderDefaultItem(activity, index, group);
231
+ }
232
+ }
233
+ )
234
+ ] }, group.key ?? groupIndex);
235
+ })
236
+ }
237
+ );
238
+ };
239
+ var ActivityFeed_default = ActivityFeed;
240
+
241
+ export {
242
+ ActivityFeed,
243
+ ActivityFeed_default
244
+ };
@@ -145,6 +145,7 @@ var CropUpload = ({
145
145
  open: modalVisible,
146
146
  size: "lg",
147
147
  title: modalTitle,
148
+ className: "tiger-crop-upload-modal",
148
149
  closable: true,
149
150
  maskClosable: false,
150
151
  onClose: handleCancel,
@@ -1,3 +1,7 @@
1
+ import {
2
+ useTigerConfig
3
+ } from "./chunk-QAIBQHIO.mjs";
4
+
1
5
  // src/components/Table.tsx
2
6
  import { useEffect as useEffect2, useMemo as useMemo2, useRef, useState as useState2 } from "react";
3
7
  import {
@@ -12,7 +16,11 @@ import {
12
16
  tableResponsiveCardListClasses,
13
17
  tableResponsiveCardRowClasses,
14
18
  tableResponsiveCardValueClasses,
15
- tableLoadingOverlayClasses
19
+ tableLoadingOverlayClasses,
20
+ getImmediateTigerLocale,
21
+ isLazyTigerLocale,
22
+ mergeTigerLocale,
23
+ resolveTigerLocale
16
24
  } from "@expcat/tigercat-core";
17
25
  import { tableExportButtonClasses } from "@expcat/tigercat-core";
18
26
 
@@ -822,6 +830,10 @@ function renderSummaryRow(ctx, view) {
822
830
 
823
831
  // src/components/Table/render-pagination.tsx
824
832
  import {
833
+ formatIntlNumber,
834
+ formatPageAriaLabel,
835
+ formatPaginationTotal,
836
+ getPaginationLabels,
825
837
  getSimplePaginationContainerClasses,
826
838
  getSimplePaginationTotalClasses,
827
839
  getSimplePaginationControlsClasses,
@@ -839,8 +851,21 @@ function renderPagination(ctx, view) {
839
851
  const { totalPages, startIndex, endIndex, hasNext, hasPrev } = ctx.paginationInfo;
840
852
  const paginationConfig = pagination;
841
853
  const total = paginationConfig.total !== void 0 && paginationConfig.total > 0 ? paginationConfig.total : ctx.processedData.length;
854
+ const locale = view.disableI18n ? void 0 : view.locale;
855
+ const labels = locale ? getPaginationLabels(locale) : void 0;
856
+ const localeCode = locale?.locale;
857
+ const isZh = !!localeCode?.startsWith("zh") || locale?.formWizard?.prevText === "\u4E0A\u4E00\u6B65" || locale?.upload?.clickToUploadText === "\u70B9\u51FB\u4E0A\u4F20";
858
+ const defaultTotalText = (t, range) => isZh ? `\u5171 ${t} \u6761` : `Showing ${range[0]} to ${range[1]} of ${t} results`;
859
+ const defaultPrevText = isZh ? "\u4E0A\u4E00\u9875" : "Previous";
860
+ const defaultNextText = isZh ? "\u4E0B\u4E00\u9875" : "Next";
861
+ const defaultPageIndicatorText = (current, total2) => isZh ? `\u7B2C ${current} \u9875 / \u5171 ${total2} \u9875` : `Page ${current} of ${total2}`;
862
+ const defaultPageSizeText = (size) => isZh ? `${size} \u6761/\u9875` : `${size} / page`;
863
+ const finalTotalText = paginationConfig.totalText ? paginationConfig.totalText(total, [startIndex, endIndex]) : labels ? formatPaginationTotal(labels.totalText, total, [startIndex, endIndex], localeCode) : defaultTotalText(total, [startIndex, endIndex]);
864
+ const finalPrevText = paginationConfig.prevText || labels?.prevPageAriaLabel || defaultPrevText;
865
+ const finalNextText = paginationConfig.nextText || labels?.nextPageAriaLabel || defaultNextText;
866
+ const finalPageIndicatorText = paginationConfig.pageIndicatorText ? paginationConfig.pageIndicatorText(ctx.currentPage, totalPages) : labels ? `${formatPageAriaLabel(labels.pageAriaLabel, ctx.currentPage, localeCode)} / ${formatIntlNumber(totalPages, localeCode)} ${labels.pageText}` : defaultPageIndicatorText(ctx.currentPage, totalPages);
842
867
  return /* @__PURE__ */ jsxs4("div", { className: getSimplePaginationContainerClasses(), children: [
843
- paginationConfig.showTotal !== false && /* @__PURE__ */ jsx5("div", { className: getSimplePaginationTotalClasses(), children: paginationConfig.totalText ? paginationConfig.totalText(total, [startIndex, endIndex]) : `Showing ${startIndex} to ${endIndex} of ${total} results` }),
868
+ paginationConfig.showTotal !== false && /* @__PURE__ */ jsx5("div", { className: getSimplePaginationTotalClasses(), children: finalTotalText }),
844
869
  /* @__PURE__ */ jsxs4("div", { className: getSimplePaginationControlsClasses(), children: [
845
870
  paginationConfig.showSizeChanger !== false && /* @__PURE__ */ jsx5(
846
871
  "select",
@@ -848,10 +873,7 @@ function renderPagination(ctx, view) {
848
873
  className: getSimplePaginationSelectClasses(),
849
874
  value: ctx.currentPageSize,
850
875
  onChange: (e) => ctx.handlePageSizeChange(Number(e.target.value)),
851
- children: (paginationConfig.pageSizeOptions || [10, 20, 50, 100]).map((size) => /* @__PURE__ */ jsxs4("option", { value: size, children: [
852
- size,
853
- " / page"
854
- ] }, size))
876
+ children: (paginationConfig.pageSizeOptions || [10, 20, 50, 100]).map((size) => /* @__PURE__ */ jsx5("option", { value: size, children: paginationConfig.pageSizeText ? paginationConfig.pageSizeText(size) : labels ? `${formatIntlNumber(size, localeCode)} ${labels.itemsPerPageText}` : defaultPageSizeText(size) }, size))
855
877
  }
856
878
  ),
857
879
  /* @__PURE__ */ jsxs4("div", { className: getSimplePaginationButtonsWrapperClasses(), children: [
@@ -861,22 +883,17 @@ function renderPagination(ctx, view) {
861
883
  className: getSimplePaginationButtonClasses(!hasPrev),
862
884
  disabled: !hasPrev,
863
885
  onClick: () => ctx.handlePageChange(ctx.currentPage - 1),
864
- children: "Previous"
886
+ children: finalPrevText
865
887
  }
866
888
  ),
867
- /* @__PURE__ */ jsxs4("span", { className: getSimplePaginationPageIndicatorClasses(), children: [
868
- "Page ",
869
- ctx.currentPage,
870
- " of ",
871
- totalPages
872
- ] }),
889
+ /* @__PURE__ */ jsx5("span", { className: getSimplePaginationPageIndicatorClasses(), children: finalPageIndicatorText }),
873
890
  /* @__PURE__ */ jsx5(
874
891
  "button",
875
892
  {
876
893
  className: getSimplePaginationButtonClasses(!hasNext),
877
894
  disabled: !hasNext,
878
895
  onClick: () => ctx.handlePageChange(ctx.currentPage + 1),
879
- children: "Next"
896
+ children: finalNextText
880
897
  }
881
898
  )
882
899
  ] })
@@ -948,6 +965,7 @@ function Table({
948
965
  className,
949
966
  ...props
950
967
  }) {
968
+ const config = useTigerConfig();
951
969
  const wrapperRef = useRef(null);
952
970
  const tableRef = useRef(null);
953
971
  const [measuredColumnWidths, setMeasuredColumnWidths] = useState2({});
@@ -955,6 +973,31 @@ function Table({
955
973
  const internalRowSelection = rowSelection;
956
974
  const internalExpandable = expandable;
957
975
  const internalRowClassName = rowClassName;
976
+ const paginationLocaleInput = pagination !== false && typeof pagination === "object" ? pagination.locale : void 0;
977
+ const isPaginationI18nDisabled = paginationLocaleInput === false;
978
+ const immediatePaginationLocale = useMemo2(
979
+ () => paginationLocaleInput && !isPaginationI18nDisabled ? getImmediateTigerLocale(paginationLocaleInput) : void 0,
980
+ [isPaginationI18nDisabled, paginationLocaleInput]
981
+ );
982
+ const [resolvedPaginationLocale, setResolvedPaginationLocale] = useState2(immediatePaginationLocale);
983
+ useEffect2(() => {
984
+ let active = true;
985
+ setResolvedPaginationLocale(immediatePaginationLocale);
986
+ if (paginationLocaleInput && !isPaginationI18nDisabled && isLazyTigerLocale(paginationLocaleInput)) {
987
+ resolveTigerLocale(paginationLocaleInput).then((nextLocale) => {
988
+ if (active) setResolvedPaginationLocale(nextLocale);
989
+ }).catch(() => {
990
+ if (active) setResolvedPaginationLocale(immediatePaginationLocale);
991
+ });
992
+ }
993
+ return () => {
994
+ active = false;
995
+ };
996
+ }, [isPaginationI18nDisabled, paginationLocaleInput, immediatePaginationLocale]);
997
+ const paginationLocale = useMemo2(
998
+ () => isPaginationI18nDisabled ? void 0 : mergeTigerLocale(config.locale, resolvedPaginationLocale),
999
+ [config.locale, isPaginationI18nDisabled, resolvedPaginationLocale]
1000
+ );
958
1001
  const ctx = useTableState({
959
1002
  columns,
960
1003
  dataSource,
@@ -1152,7 +1195,11 @@ function Table({
1152
1195
  ]
1153
1196
  }
1154
1197
  ),
1155
- renderPagination(ctx, { pagination })
1198
+ renderPagination(ctx, {
1199
+ pagination,
1200
+ locale: paginationLocale,
1201
+ disableI18n: isPaginationI18nDisabled
1202
+ })
1156
1203
  ]
1157
1204
  }
1158
1205
  );
@@ -1,4 +1,8 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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; }// src/components/Table.tsx
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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
+
3
+ var _chunkTDODFBBOjs = require('./chunk-TDODFBBO.js');
4
+
5
+ // src/components/Table.tsx
2
6
  var _react = require('react'); var _react2 = _interopRequireDefault(_react);
3
7
 
4
8
 
@@ -13,6 +17,10 @@ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
13
17
 
14
18
 
15
19
 
20
+
21
+
22
+
23
+
16
24
  var _tigercatcore = require('@expcat/tigercat-core');
17
25
 
18
26
 
@@ -831,6 +839,10 @@ function renderSummaryRow(ctx, view) {
831
839
 
832
840
 
833
841
 
842
+
843
+
844
+
845
+
834
846
  function renderPagination(ctx, view) {
835
847
  const { pagination } = view;
836
848
  if (pagination === false || !ctx.paginationInfo) {
@@ -839,8 +851,21 @@ function renderPagination(ctx, view) {
839
851
  const { totalPages, startIndex, endIndex, hasNext, hasPrev } = ctx.paginationInfo;
840
852
  const paginationConfig = pagination;
841
853
  const total = paginationConfig.total !== void 0 && paginationConfig.total > 0 ? paginationConfig.total : ctx.processedData.length;
854
+ const locale = view.disableI18n ? void 0 : view.locale;
855
+ const labels = locale ? _tigercatcore.getPaginationLabels.call(void 0, locale) : void 0;
856
+ const localeCode = _optionalChain([locale, 'optionalAccess', _66 => _66.locale]);
857
+ const isZh = !!_optionalChain([localeCode, 'optionalAccess', _67 => _67.startsWith, 'call', _68 => _68("zh")]) || _optionalChain([locale, 'optionalAccess', _69 => _69.formWizard, 'optionalAccess', _70 => _70.prevText]) === "\u4E0A\u4E00\u6B65" || _optionalChain([locale, 'optionalAccess', _71 => _71.upload, 'optionalAccess', _72 => _72.clickToUploadText]) === "\u70B9\u51FB\u4E0A\u4F20";
858
+ const defaultTotalText = (t, range) => isZh ? `\u5171 ${t} \u6761` : `Showing ${range[0]} to ${range[1]} of ${t} results`;
859
+ const defaultPrevText = isZh ? "\u4E0A\u4E00\u9875" : "Previous";
860
+ const defaultNextText = isZh ? "\u4E0B\u4E00\u9875" : "Next";
861
+ const defaultPageIndicatorText = (current, total2) => isZh ? `\u7B2C ${current} \u9875 / \u5171 ${total2} \u9875` : `Page ${current} of ${total2}`;
862
+ const defaultPageSizeText = (size) => isZh ? `${size} \u6761/\u9875` : `${size} / page`;
863
+ const finalTotalText = paginationConfig.totalText ? paginationConfig.totalText(total, [startIndex, endIndex]) : labels ? _tigercatcore.formatPaginationTotal.call(void 0, labels.totalText, total, [startIndex, endIndex], localeCode) : defaultTotalText(total, [startIndex, endIndex]);
864
+ const finalPrevText = paginationConfig.prevText || _optionalChain([labels, 'optionalAccess', _73 => _73.prevPageAriaLabel]) || defaultPrevText;
865
+ const finalNextText = paginationConfig.nextText || _optionalChain([labels, 'optionalAccess', _74 => _74.nextPageAriaLabel]) || defaultNextText;
866
+ const finalPageIndicatorText = paginationConfig.pageIndicatorText ? paginationConfig.pageIndicatorText(ctx.currentPage, totalPages) : labels ? `${_tigercatcore.formatPageAriaLabel.call(void 0, labels.pageAriaLabel, ctx.currentPage, localeCode)} / ${_tigercatcore.formatIntlNumber.call(void 0, totalPages, localeCode)} ${labels.pageText}` : defaultPageIndicatorText(ctx.currentPage, totalPages);
842
867
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.getSimplePaginationContainerClasses.call(void 0, ), children: [
843
- paginationConfig.showTotal !== false && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.getSimplePaginationTotalClasses.call(void 0, ), children: paginationConfig.totalText ? paginationConfig.totalText(total, [startIndex, endIndex]) : `Showing ${startIndex} to ${endIndex} of ${total} results` }),
868
+ paginationConfig.showTotal !== false && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.getSimplePaginationTotalClasses.call(void 0, ), children: finalTotalText }),
844
869
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.getSimplePaginationControlsClasses.call(void 0, ), children: [
845
870
  paginationConfig.showSizeChanger !== false && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
846
871
  "select",
@@ -848,10 +873,7 @@ function renderPagination(ctx, view) {
848
873
  className: _tigercatcore.getSimplePaginationSelectClasses.call(void 0, ),
849
874
  value: ctx.currentPageSize,
850
875
  onChange: (e) => ctx.handlePageSizeChange(Number(e.target.value)),
851
- children: (paginationConfig.pageSizeOptions || [10, 20, 50, 100]).map((size) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "option", { value: size, children: [
852
- size,
853
- " / page"
854
- ] }, size))
876
+ children: (paginationConfig.pageSizeOptions || [10, 20, 50, 100]).map((size) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: size, children: paginationConfig.pageSizeText ? paginationConfig.pageSizeText(size) : labels ? `${_tigercatcore.formatIntlNumber.call(void 0, size, localeCode)} ${labels.itemsPerPageText}` : defaultPageSizeText(size) }, size))
855
877
  }
856
878
  ),
857
879
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.getSimplePaginationButtonsWrapperClasses.call(void 0, ), children: [
@@ -861,22 +883,17 @@ function renderPagination(ctx, view) {
861
883
  className: _tigercatcore.getSimplePaginationButtonClasses.call(void 0, !hasPrev),
862
884
  disabled: !hasPrev,
863
885
  onClick: () => ctx.handlePageChange(ctx.currentPage - 1),
864
- children: "Previous"
886
+ children: finalPrevText
865
887
  }
866
888
  ),
867
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: _tigercatcore.getSimplePaginationPageIndicatorClasses.call(void 0, ), children: [
868
- "Page ",
869
- ctx.currentPage,
870
- " of ",
871
- totalPages
872
- ] }),
889
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _tigercatcore.getSimplePaginationPageIndicatorClasses.call(void 0, ), children: finalPageIndicatorText }),
873
890
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
874
891
  "button",
875
892
  {
876
893
  className: _tigercatcore.getSimplePaginationButtonClasses.call(void 0, !hasNext),
877
894
  disabled: !hasNext,
878
895
  onClick: () => ctx.handlePageChange(ctx.currentPage + 1),
879
- children: "Next"
896
+ children: finalNextText
880
897
  }
881
898
  )
882
899
  ] })
@@ -948,6 +965,7 @@ function Table({
948
965
  className,
949
966
  ...props
950
967
  }) {
968
+ const config = _chunkTDODFBBOjs.useTigerConfig.call(void 0, );
951
969
  const wrapperRef = _react.useRef.call(void 0, null);
952
970
  const tableRef = _react.useRef.call(void 0, null);
953
971
  const [measuredColumnWidths, setMeasuredColumnWidths] = _react.useState.call(void 0, {});
@@ -955,6 +973,31 @@ function Table({
955
973
  const internalRowSelection = rowSelection;
956
974
  const internalExpandable = expandable;
957
975
  const internalRowClassName = rowClassName;
976
+ const paginationLocaleInput = pagination !== false && typeof pagination === "object" ? pagination.locale : void 0;
977
+ const isPaginationI18nDisabled = paginationLocaleInput === false;
978
+ const immediatePaginationLocale = _react.useMemo.call(void 0,
979
+ () => paginationLocaleInput && !isPaginationI18nDisabled ? _tigercatcore.getImmediateTigerLocale.call(void 0, paginationLocaleInput) : void 0,
980
+ [isPaginationI18nDisabled, paginationLocaleInput]
981
+ );
982
+ const [resolvedPaginationLocale, setResolvedPaginationLocale] = _react.useState.call(void 0, immediatePaginationLocale);
983
+ _react.useEffect.call(void 0, () => {
984
+ let active = true;
985
+ setResolvedPaginationLocale(immediatePaginationLocale);
986
+ if (paginationLocaleInput && !isPaginationI18nDisabled && _tigercatcore.isLazyTigerLocale.call(void 0, paginationLocaleInput)) {
987
+ _tigercatcore.resolveTigerLocale.call(void 0, paginationLocaleInput).then((nextLocale) => {
988
+ if (active) setResolvedPaginationLocale(nextLocale);
989
+ }).catch(() => {
990
+ if (active) setResolvedPaginationLocale(immediatePaginationLocale);
991
+ });
992
+ }
993
+ return () => {
994
+ active = false;
995
+ };
996
+ }, [isPaginationI18nDisabled, paginationLocaleInput, immediatePaginationLocale]);
997
+ const paginationLocale = _react.useMemo.call(void 0,
998
+ () => isPaginationI18nDisabled ? void 0 : _tigercatcore.mergeTigerLocale.call(void 0, config.locale, resolvedPaginationLocale),
999
+ [config.locale, isPaginationI18nDisabled, resolvedPaginationLocale]
1000
+ );
958
1001
  const ctx = useTableState({
959
1002
  columns,
960
1003
  dataSource,
@@ -1091,7 +1134,7 @@ function Table({
1091
1134
  const key = ctx.pageRowKeys[index];
1092
1135
  const isExpanded = ctx.expandedRowKeySet.has(key);
1093
1136
  const isRowExpandable = internalExpandable ? internalExpandable.rowExpandable ? internalExpandable.rowExpandable(record) : true : false;
1094
- const expandedContent = internalExpandable && isExpanded && isRowExpandable ? _optionalChain([internalExpandable, 'access', _66 => _66.expandedRowRender, 'optionalCall', _67 => _67(record, index)]) : null;
1137
+ const expandedContent = internalExpandable && isExpanded && isRowExpandable ? _optionalChain([internalExpandable, 'access', _75 => _75.expandedRowRender, 'optionalCall', _76 => _76(record, index)]) : null;
1095
1138
  const expandedNode = expandedContent;
1096
1139
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1097
1140
  "div",
@@ -1099,13 +1142,13 @@ function Table({
1099
1142
  className: _tigercatcore.tableResponsiveCardClasses,
1100
1143
  onClick: () => ctx.handleRowClick(record, index, key),
1101
1144
  children: [
1102
- _optionalChain([internalRowSelection, 'optionalAccess', _68 => _68.showCheckbox]) !== false && internalRowSelection || internalExpandable && isRowExpandable ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-2 flex items-center gap-3", children: [
1145
+ _optionalChain([internalRowSelection, 'optionalAccess', _77 => _77.showCheckbox]) !== false && internalRowSelection || internalExpandable && isRowExpandable ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-2 flex items-center gap-3", children: [
1103
1146
  internalRowSelection && internalRowSelection.showCheckbox !== false && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1104
1147
  "input",
1105
1148
  {
1106
1149
  type: internalRowSelection.type === "radio" ? "radio" : "checkbox",
1107
1150
  checked: ctx.selectedRowKeySet.has(key),
1108
- disabled: _optionalChain([internalRowSelection, 'access', _69 => _69.getCheckboxProps, 'optionalCall', _70 => _70(record), 'optionalAccess', _71 => _71.disabled]),
1151
+ disabled: _optionalChain([internalRowSelection, 'access', _78 => _78.getCheckboxProps, 'optionalCall', _79 => _79(record), 'optionalAccess', _80 => _80.disabled]),
1109
1152
  onClick: (event) => event.stopPropagation(),
1110
1153
  onChange: (event) => ctx.handleSelectRow(key, event.target.checked)
1111
1154
  }
@@ -1152,7 +1195,11 @@ function Table({
1152
1195
  ]
1153
1196
  }
1154
1197
  ),
1155
- renderPagination(ctx, { pagination })
1198
+ renderPagination(ctx, {
1199
+ pagination,
1200
+ locale: paginationLocale,
1201
+ disableI18n: isPaginationI18nDisabled
1202
+ })
1156
1203
  ]
1157
1204
  }
1158
1205
  );