@rockshin/tao-ui 0.0.45 → 0.0.46
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/README.md +3 -1
- package/component-manifest.json +32 -3
- package/dist/components/alert/alert.js +20 -17
- package/dist/components/avatar/avatar.js +2 -1
- package/dist/components/breadcrumb/breadcrumb.js +81 -77
- package/dist/components/calendar/calendar.d.ts +0 -1
- package/dist/components/calendar/calendar.js +41 -30
- package/dist/components/color-picker/color-picker.js +273 -269
- package/dist/components/date-picker/calendar/calendar-grid.js +10 -4
- package/dist/components/date-picker/calendar/use-calendar.d.ts +2 -2
- package/dist/components/date-picker/calendar/use-calendar.js +2 -3
- package/dist/components/date-picker/date-localization.d.ts +3 -0
- package/dist/components/date-picker/date-localization.js +76 -0
- package/dist/components/date-picker/date-picker.js +35 -27
- package/dist/components/date-picker/range-picker.js +28 -20
- package/dist/components/dropdown/dropdown.js +21 -20
- package/dist/components/float-button/float-button.js +3 -2
- package/dist/components/form/form.js +88 -103
- package/dist/components/image/image.js +202 -137
- package/dist/components/list/list-pagination.js +148 -147
- package/dist/components/modal/confirm-dialog.js +4 -2
- package/dist/components/modal/modal.js +385 -383
- package/dist/components/pagination/pagination.js +115 -110
- package/dist/components/popconfirm/popconfirm.js +109 -107
- package/dist/components/qr-code/qr-code.js +22 -21
- package/dist/components/scroll-area/scroll-area.js +41 -38
- package/dist/components/select/mobile-select.d.ts +1 -1
- package/dist/components/select/mobile-select.js +2 -1
- package/dist/components/sonner/sonner.js +10 -10
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/splitter/splitter.js +24 -21
- package/dist/components/statistic/statistic.d.ts +2 -0
- package/dist/components/statistic/statistic.js +203 -187
- package/dist/components/table/table-filter.js +61 -52
- package/dist/components/table/table-icons.js +3 -1
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +5 -4
- package/dist/components/tag/tag.js +22 -19
- package/dist/components/time-picker/time-picker.d.ts +0 -1
- package/dist/components/time-picker/time-picker.js +139 -96
- package/dist/components/transfer/transfer-list.js +224 -488
- package/dist/components/transfer/transfer-parts.js +2 -2
- package/dist/components/transfer/transfer-types.d.ts +1 -0
- package/dist/components/transfer/transfer.js +13 -16
- package/dist/components/upload/upload.js +30 -26
- package/dist/docs/component-docs.d.ts +13 -2
- package/dist/docs/components/headless-input-number.doc.d.ts +5 -0
- package/dist/docs/components/headless-input-number.doc.js +7 -0
- package/dist/docs/components/input-number.doc.d.ts +5 -0
- package/dist/docs/components/input-number.doc.js +7 -0
- package/dist/docs/components/statistic.doc.d.ts +5 -0
- package/dist/docs/components/statistic.doc.js +7 -0
- package/dist/docs/components/tao-provider.doc.d.ts +8 -2
- package/dist/docs/components/tao-provider.doc.js +10 -2
- package/dist/docs/components/tooltip.doc.d.ts +2 -2
- package/dist/entries/provider.d.ts +1 -0
- package/dist/entries/provider.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/locales/ar-EG.d.ts +3 -0
- package/dist/locales/ar-EG.js +199 -0
- package/dist/locales/create-locale.d.ts +41 -0
- package/dist/locales/create-locale.js +88 -0
- package/dist/locales/de-DE.d.ts +3 -0
- package/dist/locales/de-DE.js +195 -0
- package/dist/locales/en-US.d.ts +2 -0
- package/dist/locales/en-US.js +194 -0
- package/dist/locales/es-ES.d.ts +3 -0
- package/dist/locales/es-ES.js +195 -0
- package/dist/locales/fr-FR.d.ts +3 -0
- package/dist/locales/fr-FR.js +195 -0
- package/dist/locales/hi-IN.d.ts +3 -0
- package/dist/locales/hi-IN.js +194 -0
- package/dist/locales/id-ID.d.ts +3 -0
- package/dist/locales/id-ID.js +194 -0
- package/dist/locales/index.d.ts +18 -0
- package/dist/locales/index.js +17 -0
- package/dist/locales/it-IT.d.ts +3 -0
- package/dist/locales/it-IT.js +195 -0
- package/dist/locales/ja-JP.d.ts +3 -0
- package/dist/locales/ja-JP.js +194 -0
- package/dist/locales/ko-KR.d.ts +3 -0
- package/dist/locales/ko-KR.js +194 -0
- package/dist/locales/pt-BR.d.ts +3 -0
- package/dist/locales/pt-BR.js +195 -0
- package/dist/locales/ru-RU.d.ts +3 -0
- package/dist/locales/ru-RU.js +197 -0
- package/dist/locales/th-TH.d.ts +3 -0
- package/dist/locales/th-TH.js +194 -0
- package/dist/locales/tr-TR.d.ts +3 -0
- package/dist/locales/tr-TR.js +194 -0
- package/dist/locales/types.d.ts +176 -0
- package/dist/locales/types.js +0 -0
- package/dist/locales/vi-VN.d.ts +3 -0
- package/dist/locales/vi-VN.js +194 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +194 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.js +194 -0
- package/dist/number-input/format.d.ts +4 -3
- package/dist/number-input/format.js +9 -7
- package/dist/number-input/locale.d.ts +19 -0
- package/dist/number-input/locale.js +44 -0
- package/dist/number-input/number-input.js +1 -0
- package/dist/number-input/use-number-input.d.ts +2 -0
- package/dist/number-input/use-number-input.js +180 -176
- package/dist/provider/locale.d.ts +3 -65
- package/dist/provider/locale.js +2 -146
- package/dist/provider/merge-locale.d.ts +8 -0
- package/dist/provider/merge-locale.js +53 -0
- package/dist/provider/tao-provider.d.ts +6 -2
- package/dist/provider/tao-provider.js +2 -4
- package/llms.txt +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -65,7 +65,9 @@ import { TaoProvider, zhCN } from '@rockshin/tao-ui/provider';
|
|
|
65
65
|
</TaoProvider>
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
TaoProvider supplies component text, accessible names, form validation messages and date/number regional settings. Built-in packs cover English, Simplified/Traditional Chinese, Japanese, Korean, French, German, Spanish, Italian, Brazilian Portuguese, Russian, Arabic (Egypt), Hindi, Turkish, Indonesian, Thai and Vietnamese. Packs are exported from the root and `/provider`, or independently as `import frFR from '@rockshin/tao-ui/locale/fr-FR'`.
|
|
69
|
+
|
|
70
|
+
Override individual keys with `locale={{ ...zhCN, done: '确认' }}` or `locale={{ messages: { loading: '处理中' } }}`. Nested providers inherit omitted text, including in portals. Date values and default ISO formats remain compatible; explicit `format="L"` requests a regional date format. Named months and week starts follow the locale without changing Day.js global locale. InputNumber and Statistic inherit regional digits/grouping; explicit `locale` or separator props take precedence, and numeric input still emits exact ASCII decimal strings. See the [internationalization contract](./INTERNATIONALIZATION.md) for all packs, precedence and verification boundaries.
|
|
69
71
|
|
|
70
72
|
### Right-to-left layouts
|
|
71
73
|
|
package/component-manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"packageName": "@rockshin/tao-ui",
|
|
4
|
-
"generatedAt": "2026-11-
|
|
4
|
+
"generatedAt": "2026-11-06T01:19:33.184Z",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
7
7
|
"name": "affix",
|
|
@@ -1249,6 +1249,13 @@
|
|
|
1249
1249
|
"related": [
|
|
1250
1250
|
"InputNumber"
|
|
1251
1251
|
],
|
|
1252
|
+
"props": [
|
|
1253
|
+
{
|
|
1254
|
+
"name": "locale",
|
|
1255
|
+
"type": "string",
|
|
1256
|
+
"description": "BCP 47 numeric locale, also accepted by useNumberInput. Inherits TaoProvider numberLocale; explicit separators win. Canonical values and callbacks remain exact ASCII strings."
|
|
1257
|
+
}
|
|
1258
|
+
],
|
|
1252
1259
|
"usage": {
|
|
1253
1260
|
"description": "Use the headless API when tao-ui styling is not appropriate but number formatting behavior should stay consistent.",
|
|
1254
1261
|
"bestPractices": [
|
|
@@ -1365,6 +1372,13 @@
|
|
|
1365
1372
|
"HeadlessInputNumber",
|
|
1366
1373
|
"Input"
|
|
1367
1374
|
],
|
|
1375
|
+
"props": [
|
|
1376
|
+
{
|
|
1377
|
+
"name": "locale",
|
|
1378
|
+
"type": "string",
|
|
1379
|
+
"description": "BCP 47 numeric locale. Inherits TaoProvider numberLocale; explicit decimalSeparator/thousandsSeparator override regional symbols. Callbacks keep exact canonical ASCII strings."
|
|
1380
|
+
}
|
|
1381
|
+
],
|
|
1368
1382
|
"usage": {
|
|
1369
1383
|
"description": "Use InputNumber for numeric values that need min, max, step, precision, or formatted display.",
|
|
1370
1384
|
"bestPractices": [
|
|
@@ -2473,6 +2487,13 @@
|
|
|
2473
2487
|
"tests": [
|
|
2474
2488
|
"tests/statistic/statistic.test.tsx"
|
|
2475
2489
|
],
|
|
2490
|
+
"props": [
|
|
2491
|
+
{
|
|
2492
|
+
"name": "locale",
|
|
2493
|
+
"type": "string",
|
|
2494
|
+
"description": "BCP 47 numeric locale. Inherits TaoProvider numberLocale. Explicit separators and formatter take precedence; string precision and truncation semantics are preserved."
|
|
2495
|
+
}
|
|
2496
|
+
],
|
|
2476
2497
|
"semanticParts": [
|
|
2477
2498
|
"root",
|
|
2478
2499
|
"header",
|
|
@@ -2710,7 +2731,7 @@
|
|
|
2710
2731
|
"name": "tao-provider",
|
|
2711
2732
|
"displayName": "TaoProvider",
|
|
2712
2733
|
"category": "Config",
|
|
2713
|
-
"description": "Provides global component defaults, portal scoping, and theme seed token overrides.",
|
|
2734
|
+
"description": "Provides global component defaults, 17 locales with date and number regional settings, portal scoping, and theme seed token overrides.",
|
|
2714
2735
|
"exports": [
|
|
2715
2736
|
"TaoProvider"
|
|
2716
2737
|
],
|
|
@@ -2724,7 +2745,9 @@
|
|
|
2724
2745
|
"theme",
|
|
2725
2746
|
"tokens",
|
|
2726
2747
|
"size",
|
|
2727
|
-
"disabled"
|
|
2748
|
+
"disabled",
|
|
2749
|
+
"locale",
|
|
2750
|
+
"internationalization"
|
|
2728
2751
|
],
|
|
2729
2752
|
"related": [
|
|
2730
2753
|
"Button",
|
|
@@ -2742,6 +2765,12 @@
|
|
|
2742
2765
|
]
|
|
2743
2766
|
},
|
|
2744
2767
|
"props": [
|
|
2768
|
+
{
|
|
2769
|
+
"name": "locale",
|
|
2770
|
+
"type": "Partial<TaoLocale>",
|
|
2771
|
+
"defaultValue": "enUS",
|
|
2772
|
+
"description": "Component text, accessible names, form validation and regional date/number settings. Missing keys inherit from the parent; explicit component overrides win. Direction is independent."
|
|
2773
|
+
},
|
|
2745
2774
|
{
|
|
2746
2775
|
"name": "direction",
|
|
2747
2776
|
"type": "'ltr' | 'rtl'",
|
|
@@ -3,6 +3,7 @@ import { c } from "react-compiler-runtime";
|
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { cx } from "../../utils/semantic.js";
|
|
5
5
|
import { StatusIcon } from "../status-icon/status-icon.js";
|
|
6
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
6
7
|
import "./alert.css";
|
|
7
8
|
function CloseIcon() {
|
|
8
9
|
const $ = c(1);
|
|
@@ -28,11 +29,12 @@ function CloseIcon() {
|
|
|
28
29
|
return t0;
|
|
29
30
|
}
|
|
30
31
|
function Alert(t0) {
|
|
31
|
-
const $ = c(
|
|
32
|
+
const $ = c(45);
|
|
32
33
|
const { type: t1, title, description, showIcon: t2, icon, closable: t3, onClose, action, className, style, classNames, styles } = t0;
|
|
33
34
|
const type = void 0 === t1 ? "info" : t1;
|
|
34
35
|
const showIcon = void 0 === t2 ? false : t2;
|
|
35
36
|
const closable = void 0 === t3 ? false : t3;
|
|
37
|
+
const { locale } = useTaoConfig();
|
|
36
38
|
const [visible, setVisible] = useState(true);
|
|
37
39
|
let t4;
|
|
38
40
|
if ($[0] !== onClose) {
|
|
@@ -138,11 +140,11 @@ function Alert(t0) {
|
|
|
138
140
|
$[29] = t14;
|
|
139
141
|
} else t14 = $[29];
|
|
140
142
|
let t15;
|
|
141
|
-
if ($[30] !== classNames?.close || $[31] !== closable || $[32] !== handleClose || $[33] !== styles?.close) {
|
|
143
|
+
if ($[30] !== classNames?.close || $[31] !== closable || $[32] !== handleClose || $[33] !== locale || $[34] !== styles?.close) {
|
|
142
144
|
t15 = closable && /*#__PURE__*/ jsx("button", {
|
|
143
145
|
type: "button",
|
|
144
146
|
"data-tao-alert-close": "",
|
|
145
|
-
"aria-label":
|
|
147
|
+
"aria-label": locale.close,
|
|
146
148
|
onClick: handleClose,
|
|
147
149
|
className: cx(classNames?.close),
|
|
148
150
|
style: styles?.close,
|
|
@@ -151,11 +153,12 @@ function Alert(t0) {
|
|
|
151
153
|
$[30] = classNames?.close;
|
|
152
154
|
$[31] = closable;
|
|
153
155
|
$[32] = handleClose;
|
|
154
|
-
$[33] =
|
|
155
|
-
$[34] =
|
|
156
|
-
|
|
156
|
+
$[33] = locale;
|
|
157
|
+
$[34] = styles?.close;
|
|
158
|
+
$[35] = t15;
|
|
159
|
+
} else t15 = $[35];
|
|
157
160
|
let t16;
|
|
158
|
-
if ($[
|
|
161
|
+
if ($[36] !== t10 || $[37] !== t13 || $[38] !== t14 || $[39] !== t15 || $[40] !== t5 || $[41] !== t7 || $[42] !== t9 || $[43] !== type) {
|
|
159
162
|
t16 = /*#__PURE__*/ jsxs("div", {
|
|
160
163
|
role: "alert",
|
|
161
164
|
"data-tao-alert": "",
|
|
@@ -170,16 +173,16 @@ function Alert(t0) {
|
|
|
170
173
|
t15
|
|
171
174
|
]
|
|
172
175
|
});
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
} else t16 = $[
|
|
176
|
+
$[36] = t10;
|
|
177
|
+
$[37] = t13;
|
|
178
|
+
$[38] = t14;
|
|
179
|
+
$[39] = t15;
|
|
180
|
+
$[40] = t5;
|
|
181
|
+
$[41] = t7;
|
|
182
|
+
$[42] = t9;
|
|
183
|
+
$[43] = type;
|
|
184
|
+
$[44] = t16;
|
|
185
|
+
} else t16 = $[44];
|
|
183
186
|
return t16;
|
|
184
187
|
}
|
|
185
188
|
export { Alert };
|
|
@@ -98,6 +98,7 @@ function flattenChildren(children) {
|
|
|
98
98
|
}
|
|
99
99
|
const AvatarGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
100
100
|
const parent = useContext(GroupContext);
|
|
101
|
+
const { locale } = useTaoConfig();
|
|
101
102
|
const { prefixCls, rootClassName, size = parent.size, shape = parent.shape, max, maxCount, maxStyle, maxPopoverPlacement, maxPopoverTrigger, className, style, classNames, styles, children, ...rest } = props;
|
|
102
103
|
const node = useRef(null);
|
|
103
104
|
useImperativeHandle(ref, ()=>({
|
|
@@ -136,7 +137,7 @@ const AvatarGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
136
137
|
children: /*#__PURE__*/ jsx("button", {
|
|
137
138
|
type: "button",
|
|
138
139
|
"data-tao-avatar-overflow": "",
|
|
139
|
-
"aria-label":
|
|
140
|
+
"aria-label": locale.messages.moreUsers(hidden.length),
|
|
140
141
|
className: classNames?.overflow,
|
|
141
142
|
style: styles?.overflow,
|
|
142
143
|
children: /*#__PURE__*/ jsxs(AvatarRoot, {
|
|
@@ -61,9 +61,9 @@ function EllipsisIcon() {
|
|
|
61
61
|
}
|
|
62
62
|
const ELLIPSIS = Symbol('ellipsis');
|
|
63
63
|
function Breadcrumb(t0) {
|
|
64
|
-
const $ = c(
|
|
64
|
+
const $ = c(58);
|
|
65
65
|
const { items, separator, maxItems, itemRender, className, style, classNames, styles } = t0;
|
|
66
|
-
const { size, disabled: ctxDisabled } = useTaoConfig();
|
|
66
|
+
const { size, disabled: ctxDisabled, locale } = useTaoConfig();
|
|
67
67
|
const collapsed = null != maxItems && maxItems >= 1 && items.length > maxItems;
|
|
68
68
|
let t1;
|
|
69
69
|
if ($[0] !== collapsed || $[1] !== items || $[2] !== maxItems) {
|
|
@@ -140,38 +140,39 @@ function Breadcrumb(t0) {
|
|
|
140
140
|
$[13] = t3;
|
|
141
141
|
} else t3 = $[13];
|
|
142
142
|
const renderContent = t3;
|
|
143
|
-
const t4 =
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
const t4 = locale.messages.breadcrumb;
|
|
144
|
+
const t5 = classNames?.root;
|
|
145
|
+
let t6;
|
|
146
|
+
if ($[14] !== className || $[15] !== t5) {
|
|
147
|
+
t6 = cx(t5, className);
|
|
147
148
|
$[14] = className;
|
|
148
|
-
$[15] =
|
|
149
|
-
$[16] =
|
|
150
|
-
} else
|
|
151
|
-
const
|
|
152
|
-
let
|
|
153
|
-
if ($[17] !== style || $[18] !==
|
|
154
|
-
|
|
155
|
-
...
|
|
149
|
+
$[15] = t5;
|
|
150
|
+
$[16] = t6;
|
|
151
|
+
} else t6 = $[16];
|
|
152
|
+
const t7 = styles?.root;
|
|
153
|
+
let t8;
|
|
154
|
+
if ($[17] !== style || $[18] !== t7) {
|
|
155
|
+
t8 = {
|
|
156
|
+
...t7,
|
|
156
157
|
...style
|
|
157
158
|
};
|
|
158
159
|
$[17] = style;
|
|
159
|
-
$[18] =
|
|
160
|
-
$[19] =
|
|
161
|
-
} else
|
|
162
|
-
const
|
|
163
|
-
let
|
|
164
|
-
if ($[20] !==
|
|
165
|
-
|
|
166
|
-
$[20] =
|
|
167
|
-
$[21] =
|
|
168
|
-
} else
|
|
169
|
-
const
|
|
170
|
-
let
|
|
171
|
-
if ($[22] !== classNames?.ellipsis || $[23] !== classNames?.item || $[24] !== classNames?.separator || $[25] !== display || $[26] !== items || $[27] !==
|
|
172
|
-
let
|
|
173
|
-
if ($[
|
|
174
|
-
|
|
160
|
+
$[18] = t7;
|
|
161
|
+
$[19] = t8;
|
|
162
|
+
} else t8 = $[19];
|
|
163
|
+
const t9 = classNames?.list;
|
|
164
|
+
let t10;
|
|
165
|
+
if ($[20] !== t9) {
|
|
166
|
+
t10 = cx(t9);
|
|
167
|
+
$[20] = t9;
|
|
168
|
+
$[21] = t10;
|
|
169
|
+
} else t10 = $[21];
|
|
170
|
+
const t11 = styles?.list;
|
|
171
|
+
let t12;
|
|
172
|
+
if ($[22] !== classNames?.ellipsis || $[23] !== classNames?.item || $[24] !== classNames?.separator || $[25] !== display || $[26] !== items || $[27] !== locale.messages.showMore || $[28] !== maxItems || $[29] !== renderContent || $[30] !== sep || $[31] !== styles?.ellipsis || $[32] !== styles?.item || $[33] !== styles?.separator) {
|
|
173
|
+
let t13;
|
|
174
|
+
if ($[35] !== classNames?.ellipsis || $[36] !== classNames?.item || $[37] !== classNames?.separator || $[38] !== display.length || $[39] !== items || $[40] !== locale.messages.showMore || $[41] !== maxItems || $[42] !== renderContent || $[43] !== sep || $[44] !== styles?.ellipsis || $[45] !== styles?.item || $[46] !== styles?.separator) {
|
|
175
|
+
t13 = (entry, i)=>{
|
|
175
176
|
const isLast_0 = i === display.length - 1;
|
|
176
177
|
const isEllipsis = entry === ELLIPSIS;
|
|
177
178
|
const key = isEllipsis ? `ellipsis-${i}` : entry.key ?? i;
|
|
@@ -192,7 +193,7 @@ function Breadcrumb(t0) {
|
|
|
192
193
|
children: /*#__PURE__*/ jsx("button", {
|
|
193
194
|
type: "button",
|
|
194
195
|
"data-tao-breadcrumb-ellipsis": "",
|
|
195
|
-
"aria-label":
|
|
196
|
+
"aria-label": locale.messages.showMore,
|
|
196
197
|
className: cx(classNames?.ellipsis),
|
|
197
198
|
style: styles?.ellipsis,
|
|
198
199
|
children: /*#__PURE__*/ jsx(EllipsisIcon, {})
|
|
@@ -210,62 +211,65 @@ function Breadcrumb(t0) {
|
|
|
210
211
|
]
|
|
211
212
|
}, key);
|
|
212
213
|
};
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
|
|
226
|
-
|
|
214
|
+
$[35] = classNames?.ellipsis;
|
|
215
|
+
$[36] = classNames?.item;
|
|
216
|
+
$[37] = classNames?.separator;
|
|
217
|
+
$[38] = display.length;
|
|
218
|
+
$[39] = items;
|
|
219
|
+
$[40] = locale.messages.showMore;
|
|
220
|
+
$[41] = maxItems;
|
|
221
|
+
$[42] = renderContent;
|
|
222
|
+
$[43] = sep;
|
|
223
|
+
$[44] = styles?.ellipsis;
|
|
224
|
+
$[45] = styles?.item;
|
|
225
|
+
$[46] = styles?.separator;
|
|
226
|
+
$[47] = t13;
|
|
227
|
+
} else t13 = $[47];
|
|
228
|
+
t12 = display.map(t13);
|
|
227
229
|
$[22] = classNames?.ellipsis;
|
|
228
230
|
$[23] = classNames?.item;
|
|
229
231
|
$[24] = classNames?.separator;
|
|
230
232
|
$[25] = display;
|
|
231
233
|
$[26] = items;
|
|
232
|
-
$[27] =
|
|
233
|
-
$[28] =
|
|
234
|
-
$[29] =
|
|
235
|
-
$[30] =
|
|
236
|
-
$[31] = styles?.
|
|
237
|
-
$[32] = styles?.
|
|
238
|
-
$[33] =
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
234
|
+
$[27] = locale.messages.showMore;
|
|
235
|
+
$[28] = maxItems;
|
|
236
|
+
$[29] = renderContent;
|
|
237
|
+
$[30] = sep;
|
|
238
|
+
$[31] = styles?.ellipsis;
|
|
239
|
+
$[32] = styles?.item;
|
|
240
|
+
$[33] = styles?.separator;
|
|
241
|
+
$[34] = t12;
|
|
242
|
+
} else t12 = $[34];
|
|
243
|
+
let t13;
|
|
244
|
+
if ($[48] !== t10 || $[49] !== t11 || $[50] !== t12) {
|
|
245
|
+
t13 = /*#__PURE__*/ jsx("ol", {
|
|
243
246
|
"data-tao-breadcrumb-list": "",
|
|
244
|
-
className:
|
|
245
|
-
style:
|
|
246
|
-
children:
|
|
247
|
+
className: t10,
|
|
248
|
+
style: t11,
|
|
249
|
+
children: t12
|
|
247
250
|
});
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
} else
|
|
253
|
-
let
|
|
254
|
-
if ($[
|
|
255
|
-
|
|
251
|
+
$[48] = t10;
|
|
252
|
+
$[49] = t11;
|
|
253
|
+
$[50] = t12;
|
|
254
|
+
$[51] = t13;
|
|
255
|
+
} else t13 = $[51];
|
|
256
|
+
let t14;
|
|
257
|
+
if ($[52] !== locale.messages.breadcrumb || $[53] !== size || $[54] !== t13 || $[55] !== t6 || $[56] !== t8) {
|
|
258
|
+
t14 = /*#__PURE__*/ jsx("nav", {
|
|
256
259
|
"data-tao-breadcrumb": "",
|
|
257
260
|
"data-tao-size": size,
|
|
258
|
-
"aria-label":
|
|
259
|
-
className:
|
|
260
|
-
style:
|
|
261
|
-
children:
|
|
261
|
+
"aria-label": t4,
|
|
262
|
+
className: t6,
|
|
263
|
+
style: t8,
|
|
264
|
+
children: t13
|
|
262
265
|
});
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[52] = t5;
|
|
266
|
-
$[53] = t7;
|
|
266
|
+
$[52] = locale.messages.breadcrumb;
|
|
267
|
+
$[53] = size;
|
|
267
268
|
$[54] = t13;
|
|
268
|
-
|
|
269
|
-
|
|
269
|
+
$[55] = t6;
|
|
270
|
+
$[56] = t8;
|
|
271
|
+
$[57] = t14;
|
|
272
|
+
} else t14 = $[57];
|
|
273
|
+
return t14;
|
|
270
274
|
}
|
|
271
275
|
export { Breadcrumb };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { CellRenderInfo, Locale } from '@rc-component/picker/interface';
|
|
2
2
|
import { type Dayjs } from 'dayjs';
|
|
3
|
-
import 'dayjs/locale/zh-cn';
|
|
4
3
|
import { type CSSProperties, type ReactNode } from 'react';
|
|
5
4
|
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
|
|
6
5
|
import './calendar.css';
|
|
@@ -2,9 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { PickerPanel } from "@rc-component/picker";
|
|
3
3
|
import dayjs from "@rc-component/picker/generate/dayjs";
|
|
4
4
|
import en_US from "@rc-component/picker/locale/en_US";
|
|
5
|
-
import zh_CN from "@rc-component/picker/locale/zh_CN";
|
|
6
5
|
import dayjs_0 from "dayjs";
|
|
7
|
-
import "dayjs/locale/zh-cn";
|
|
8
6
|
import { forwardRef, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
9
7
|
import { useTaoConfig, useTaoDirection } from "../../provider/tao-provider.js";
|
|
10
8
|
import { Segmented } from "../segmented/segmented.js";
|
|
@@ -35,20 +33,33 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
35
33
|
const styles = 'function' == typeof props.styles ? props.styles({
|
|
36
34
|
props
|
|
37
35
|
}) : props.styles;
|
|
38
|
-
const chinese = 'zh_CN' === config.locale.locale;
|
|
39
36
|
const locale = {
|
|
40
|
-
...
|
|
37
|
+
...config.locale.pickerLocale ?? en_US,
|
|
41
38
|
...props.locale?.lang
|
|
42
39
|
};
|
|
40
|
+
const weekStartsOn = props.locale?.lang.locale ? dayjs.locale.getWeekFirstDay(locale.locale) : config.locale.weekStartsOn ?? dayjs.locale.getWeekFirstDay(locale.locale);
|
|
41
|
+
const generateConfig = useMemo(()=>({
|
|
42
|
+
...dayjs,
|
|
43
|
+
locale: {
|
|
44
|
+
...dayjs.locale,
|
|
45
|
+
getWeekFirstDay: ()=>weekStartsOn,
|
|
46
|
+
getWeekFirstDate: (_locale, date)=>date.subtract((date.day() - weekStartsOn + 7) % 7, 'day')
|
|
47
|
+
}
|
|
48
|
+
}), [
|
|
49
|
+
weekStartsOn
|
|
50
|
+
]);
|
|
51
|
+
const calendarYear = props.locale?.lang.year ?? config.locale.messages.calendarYear;
|
|
52
|
+
const calendarMonth = props.locale?.lang.month ?? config.locale.messages.calendarMonth;
|
|
53
|
+
const { calendarView } = config.locale.messages;
|
|
43
54
|
const months = locale.shortMonths ?? dayjs.locale.getShortMonths?.(locale.locale) ?? [];
|
|
44
|
-
const disabled = (
|
|
45
|
-
const select = (
|
|
46
|
-
if (void 0 === props.value) setValue(
|
|
47
|
-
if (!
|
|
48
|
-
if (!
|
|
49
|
-
props.onChange?.(
|
|
55
|
+
const disabled = (date_0)=>!!(validRange && (date_0.isBefore(validRange[0], 'day') || date_0.isAfter(validRange[1], 'day'))) || !!props.disabledDate?.(date_0);
|
|
56
|
+
const select = (date_1, source)=>{
|
|
57
|
+
if (void 0 === props.value) setValue(date_1);
|
|
58
|
+
if (!date_1.isSame(value, 'day')) {
|
|
59
|
+
if (!date_1.isSame(value, 'month' === mode ? 'month' : 'year')) props.onPanelChange?.(date_1, mode);
|
|
60
|
+
props.onChange?.(date_1);
|
|
50
61
|
}
|
|
51
|
-
props.onSelect?.(
|
|
62
|
+
props.onSelect?.(date_1, {
|
|
52
63
|
source
|
|
53
64
|
});
|
|
54
65
|
};
|
|
@@ -56,23 +67,23 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
56
67
|
if (void 0 === props.mode) setMode(next);
|
|
57
68
|
props.onPanelChange?.(value, next);
|
|
58
69
|
};
|
|
59
|
-
const clamp = (
|
|
70
|
+
const clamp = (date_2)=>validRange ? date_2.isBefore(validRange[0], 'day') ? validRange[0] : date_2.isAfter(validRange[1], 'day') ? validRange[1] : date_2 : date_2;
|
|
60
71
|
const firstYear = validRange?.[0].year() ?? value.year() - 10;
|
|
61
72
|
const lastYear = validRange?.[1].year() ?? value.year() + 10;
|
|
62
73
|
const minMonth = validRange && value.year() === validRange[0].year() ? validRange[0].month() : 0;
|
|
63
74
|
const maxMonth = validRange && value.year() === validRange[1].year() ? validRange[1].month() : 11;
|
|
64
|
-
const renderCell = (
|
|
65
|
-
if (props.fullCellRender) return props.fullCellRender(
|
|
75
|
+
const renderCell = (date_3, info)=>{
|
|
76
|
+
if (props.fullCellRender) return props.fullCellRender(date_3, info);
|
|
66
77
|
const legacyFull = 'month' === info.type ? props.monthFullCellRender : props.dateFullCellRender;
|
|
67
|
-
if (legacyFull) return legacyFull(
|
|
68
|
-
const extra = props.cellRender ? props.cellRender(
|
|
78
|
+
if (legacyFull) return legacyFull(date_3);
|
|
79
|
+
const extra = props.cellRender ? props.cellRender(date_3, info) : 'month' === info.type ? props.monthCellRender?.(date_3) : props.dateCellRender?.(date_3);
|
|
69
80
|
return /*#__PURE__*/ jsxs("div", {
|
|
70
81
|
"data-tao-calendar-item": "",
|
|
71
|
-
"data-today":
|
|
82
|
+
"data-today": date_3.isSame(dayjs_0(), 'month' === info.type ? 'month' : 'day') || void 0,
|
|
72
83
|
children: [
|
|
73
84
|
/*#__PURE__*/ jsx("span", {
|
|
74
85
|
"data-tao-calendar-value": "",
|
|
75
|
-
children: 'month' === info.type ? months[
|
|
86
|
+
children: 'month' === info.type ? months[date_3.month()] : String(date_3.date()).padStart(2, '0')
|
|
76
87
|
}),
|
|
77
88
|
/*#__PURE__*/ jsx("div", {
|
|
78
89
|
"data-tao-calendar-events": "",
|
|
@@ -97,7 +108,7 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
97
108
|
props.headerRender ? props.headerRender({
|
|
98
109
|
value,
|
|
99
110
|
type: mode,
|
|
100
|
-
onChange: (
|
|
111
|
+
onChange: (date_4)=>select(date_4, 'customize'),
|
|
101
112
|
onTypeChange: changeMode
|
|
102
113
|
}) : /*#__PURE__*/ jsxs("div", {
|
|
103
114
|
"data-tao-calendar-toolbar": "",
|
|
@@ -105,8 +116,8 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
105
116
|
style: styles?.header,
|
|
106
117
|
children: [
|
|
107
118
|
/*#__PURE__*/ jsx(Select, {
|
|
108
|
-
"aria-label":
|
|
109
|
-
mobileTitle:
|
|
119
|
+
"aria-label": calendarYear,
|
|
120
|
+
mobileTitle: calendarYear,
|
|
110
121
|
size: "medium",
|
|
111
122
|
style: {
|
|
112
123
|
width: 'auto',
|
|
@@ -118,12 +129,12 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
118
129
|
length: lastYear - firstYear + 1
|
|
119
130
|
}, (_, index)=>({
|
|
120
131
|
value: String(firstYear + index),
|
|
121
|
-
label:
|
|
132
|
+
label: dayjs.locale.format(locale.locale, value.year(firstYear + index), locale.yearFormat ?? 'YYYY')
|
|
122
133
|
}))
|
|
123
134
|
}),
|
|
124
135
|
'month' === mode && /*#__PURE__*/ jsx(Select, {
|
|
125
|
-
"aria-label":
|
|
126
|
-
mobileTitle:
|
|
136
|
+
"aria-label": calendarMonth,
|
|
137
|
+
mobileTitle: calendarMonth,
|
|
127
138
|
size: "medium",
|
|
128
139
|
style: {
|
|
129
140
|
width: 'auto',
|
|
@@ -137,18 +148,18 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
137
148
|
})).slice(minMonth, maxMonth + 1)
|
|
138
149
|
}),
|
|
139
150
|
/*#__PURE__*/ jsx(Segmented, {
|
|
140
|
-
"aria-label":
|
|
151
|
+
"aria-label": calendarView,
|
|
141
152
|
size: "medium",
|
|
142
153
|
value: mode,
|
|
143
154
|
onChange: changeMode,
|
|
144
155
|
options: [
|
|
145
156
|
{
|
|
146
157
|
value: 'month',
|
|
147
|
-
label:
|
|
158
|
+
label: calendarMonth
|
|
148
159
|
},
|
|
149
160
|
{
|
|
150
161
|
value: 'year',
|
|
151
|
-
label:
|
|
162
|
+
label: calendarYear
|
|
152
163
|
}
|
|
153
164
|
]
|
|
154
165
|
})
|
|
@@ -157,7 +168,7 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
157
168
|
/*#__PURE__*/ jsx(PickerPanel, {
|
|
158
169
|
direction: direction,
|
|
159
170
|
prefixCls: props.prefixCls ?? 'tao-calendar-panel',
|
|
160
|
-
generateConfig:
|
|
171
|
+
generateConfig: generateConfig,
|
|
161
172
|
locale: locale,
|
|
162
173
|
value: value,
|
|
163
174
|
mode: 'year' === mode ? 'month' : 'date',
|
|
@@ -165,8 +176,8 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
165
176
|
hideHeader: true,
|
|
166
177
|
showWeek: props.showWeek,
|
|
167
178
|
disabledDate: disabled,
|
|
168
|
-
onSelect: (
|
|
169
|
-
cellRender: (
|
|
179
|
+
onSelect: (date_5)=>select(date_5, 'year' === mode ? 'month' : 'date'),
|
|
180
|
+
cellRender: (date_6, info_0)=>renderCell(date_6, info_0),
|
|
170
181
|
classNames: {
|
|
171
182
|
body: names?.body,
|
|
172
183
|
content: names?.content,
|