antd-mobile 5.37.0 → 5.38.0
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/2x/README.md +2 -2
- package/2x/bundle/antd-mobile.cjs.development.js +3012 -1806
- package/2x/bundle/antd-mobile.cjs.js +7 -7
- package/2x/bundle/antd-mobile.es.development.js +3014 -1808
- package/2x/bundle/antd-mobile.es.js +7937 -7154
- package/2x/bundle/antd-mobile.umd.development.js +3012 -1806
- package/2x/bundle/antd-mobile.umd.js +7 -7
- package/2x/bundle/css-vars-patch.css +42 -0
- package/2x/bundle/style.css +186 -49
- package/2x/cjs/components/calendar-picker/calendar-picker.js +12 -6
- package/2x/cjs/components/calendar-picker-view/calendar-picker-view.d.ts +4 -1
- package/2x/cjs/components/calendar-picker-view/calendar-picker-view.js +69 -26
- package/2x/cjs/components/calendar-picker-view/useSyncScroll.d.ts +2 -0
- package/2x/cjs/components/calendar-picker-view/useSyncScroll.js +39 -0
- package/2x/cjs/components/card/card.css +1 -0
- package/2x/cjs/components/card/card.d.ts +2 -1
- package/2x/cjs/components/card/card.js +7 -3
- package/2x/cjs/components/card/card.patch.css +8 -0
- package/2x/cjs/components/date-picker/date-picker-quarter-utils.d.ts +7 -0
- package/2x/cjs/components/date-picker/date-picker-quarter-utils.js +77 -0
- package/2x/cjs/components/date-picker/date-picker-utils.d.ts +3 -2
- package/2x/cjs/components/date-picker/date-picker-utils.js +7 -0
- package/2x/cjs/components/image-uploader/image-uploader.js +2 -2
- package/2x/cjs/components/input/input.d.ts +2 -2
- package/2x/cjs/components/input/input.js +1 -0
- package/2x/cjs/components/nav-bar/nav-bar.js +6 -6
- package/2x/cjs/components/notice-bar/notice-bar.css +30 -4
- package/2x/cjs/components/notice-bar/notice-bar.d.ts +5 -1
- package/2x/cjs/components/notice-bar/notice-bar.js +7 -3
- package/2x/cjs/components/search-bar/search-bar.d.ts +2 -2
- package/2x/cjs/components/search-bar/search-bar.js +1 -0
- package/2x/cjs/components/segmented/index.d.ts +4 -0
- package/2x/cjs/components/segmented/index.js +10 -0
- package/2x/cjs/components/segmented/segmented.css +113 -0
- package/2x/cjs/components/segmented/segmented.d.ts +21 -0
- package/2x/cjs/components/segmented/segmented.js +57 -0
- package/2x/cjs/components/segmented/segmented.patch.css +41 -0
- package/2x/cjs/components/tab-bar/tab-bar.d.ts +1 -0
- package/2x/cjs/components/tab-bar/tab-bar.js +2 -0
- package/2x/cjs/components/tabs/tabs.js +1 -1
- package/2x/cjs/components/toast/methods.js +9 -3
- package/2x/cjs/global/css-vars-patch.css +42 -0
- package/2x/cjs/index.d.ts +2 -0
- package/2x/cjs/index.js +7 -0
- package/2x/cjs/locales/cnr-ME.d.ts +139 -0
- package/2x/cjs/locales/cnr-ME.js +149 -0
- package/2x/cjs/locales/hr-HR.d.ts +139 -0
- package/2x/cjs/locales/hr-HR.js +149 -0
- package/2x/cjs/locales/kk-KZ.js +6 -6
- package/2x/cjs/locales/sr-RS.d.ts +139 -0
- package/2x/cjs/locales/sr-RS.js +149 -0
- package/2x/cjs/utils/render-imperatively.d.ts +1 -0
- package/2x/cjs/utils/render-imperatively.js +6 -3
- package/2x/es/components/calendar-picker/calendar-picker.js +11 -5
- package/2x/es/components/calendar-picker-view/calendar-picker-view.d.ts +4 -1
- package/2x/es/components/calendar-picker-view/calendar-picker-view.js +67 -25
- package/2x/es/components/calendar-picker-view/useSyncScroll.d.ts +2 -0
- package/2x/es/components/calendar-picker-view/useSyncScroll.js +33 -0
- package/2x/es/components/card/card.css +1 -0
- package/2x/es/components/card/card.d.ts +2 -1
- package/2x/es/components/card/card.js +7 -3
- package/2x/es/components/card/card.patch.css +8 -0
- package/2x/es/components/date-picker/date-picker-quarter-utils.d.ts +7 -0
- package/2x/es/components/date-picker/date-picker-quarter-utils.js +68 -0
- package/2x/es/components/date-picker/date-picker-utils.d.ts +3 -2
- package/2x/es/components/date-picker/date-picker-utils.js +7 -0
- package/2x/es/components/image-uploader/image-uploader.js +2 -2
- package/2x/es/components/input/input.d.ts +2 -2
- package/2x/es/components/input/input.js +1 -0
- package/2x/es/components/nav-bar/nav-bar.js +7 -7
- package/2x/es/components/notice-bar/notice-bar.css +30 -4
- package/2x/es/components/notice-bar/notice-bar.d.ts +5 -1
- package/2x/es/components/notice-bar/notice-bar.js +7 -3
- package/2x/es/components/search-bar/search-bar.d.ts +2 -2
- package/2x/es/components/search-bar/search-bar.js +1 -0
- package/2x/es/components/segmented/index.d.ts +4 -0
- package/2x/es/components/segmented/index.js +3 -0
- package/2x/es/components/segmented/segmented.css +113 -0
- package/2x/es/components/segmented/segmented.d.ts +21 -0
- package/2x/es/components/segmented/segmented.js +48 -0
- package/2x/es/components/segmented/segmented.patch.css +41 -0
- package/2x/es/components/tab-bar/tab-bar.d.ts +1 -0
- package/2x/es/components/tab-bar/tab-bar.js +2 -0
- package/2x/es/components/tabs/tabs.js +1 -1
- package/2x/es/components/toast/methods.js +9 -3
- package/2x/es/global/css-vars-patch.css +42 -0
- package/2x/es/index.d.ts +2 -0
- package/2x/es/index.js +1 -0
- package/2x/es/locales/cnr-ME.d.ts +139 -0
- package/2x/es/locales/cnr-ME.js +142 -0
- package/2x/es/locales/hr-HR.d.ts +139 -0
- package/2x/es/locales/hr-HR.js +142 -0
- package/2x/es/locales/kk-KZ.js +6 -6
- package/2x/es/locales/sr-RS.d.ts +139 -0
- package/2x/es/locales/sr-RS.js +142 -0
- package/2x/es/utils/render-imperatively.d.ts +1 -0
- package/2x/es/utils/render-imperatively.js +6 -3
- package/2x/package.json +3 -2
- package/README.md +2 -2
- package/bundle/antd-mobile.cjs.development.js +3012 -1806
- package/bundle/antd-mobile.cjs.js +7 -7
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +3014 -1808
- package/bundle/antd-mobile.es.js +7937 -7154
- package/bundle/antd-mobile.umd.development.js +3012 -1806
- package/bundle/antd-mobile.umd.js +7 -7
- package/bundle/css-vars-patch.css +32 -0
- package/bundle/style.css +1 -1
- package/cjs/components/calendar-picker/calendar-picker.js +12 -6
- package/cjs/components/calendar-picker-view/calendar-picker-view.d.ts +4 -1
- package/cjs/components/calendar-picker-view/calendar-picker-view.js +69 -26
- package/cjs/components/calendar-picker-view/useSyncScroll.d.ts +2 -0
- package/cjs/components/calendar-picker-view/useSyncScroll.js +39 -0
- package/cjs/components/card/card.css +1 -0
- package/cjs/components/card/card.d.ts +2 -1
- package/cjs/components/card/card.js +7 -3
- package/cjs/components/card/card.patch.css +6 -0
- package/cjs/components/date-picker/date-picker-quarter-utils.d.ts +7 -0
- package/cjs/components/date-picker/date-picker-quarter-utils.js +77 -0
- package/cjs/components/date-picker/date-picker-utils.d.ts +3 -2
- package/cjs/components/date-picker/date-picker-utils.js +7 -0
- package/cjs/components/image-uploader/image-uploader.js +2 -2
- package/cjs/components/input/input.d.ts +2 -2
- package/cjs/components/input/input.js +1 -0
- package/cjs/components/nav-bar/nav-bar.js +6 -6
- package/cjs/components/notice-bar/notice-bar.css +25 -4
- package/cjs/components/notice-bar/notice-bar.d.ts +5 -1
- package/cjs/components/notice-bar/notice-bar.js +7 -3
- package/cjs/components/search-bar/search-bar.d.ts +2 -2
- package/cjs/components/search-bar/search-bar.js +1 -0
- package/cjs/components/segmented/index.d.ts +4 -0
- package/cjs/components/segmented/index.js +10 -0
- package/cjs/components/segmented/segmented.css +97 -0
- package/cjs/components/segmented/segmented.d.ts +21 -0
- package/cjs/components/segmented/segmented.js +57 -0
- package/cjs/components/segmented/segmented.patch.css +32 -0
- package/cjs/components/tab-bar/tab-bar.d.ts +1 -0
- package/cjs/components/tab-bar/tab-bar.js +2 -0
- package/cjs/components/tabs/tabs.js +1 -1
- package/cjs/components/toast/methods.js +9 -3
- package/cjs/global/css-vars-patch.css +32 -0
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +7 -0
- package/cjs/locales/cnr-ME.d.ts +139 -0
- package/cjs/locales/cnr-ME.js +149 -0
- package/cjs/locales/hr-HR.d.ts +139 -0
- package/cjs/locales/hr-HR.js +149 -0
- package/cjs/locales/kk-KZ.js +6 -6
- package/cjs/locales/sr-RS.d.ts +139 -0
- package/cjs/locales/sr-RS.js +149 -0
- package/cjs/utils/render-imperatively.d.ts +1 -0
- package/cjs/utils/render-imperatively.js +6 -3
- package/es/components/calendar-picker/calendar-picker.js +11 -5
- package/es/components/calendar-picker-view/calendar-picker-view.d.ts +4 -1
- package/es/components/calendar-picker-view/calendar-picker-view.js +67 -25
- package/es/components/calendar-picker-view/useSyncScroll.d.ts +2 -0
- package/es/components/calendar-picker-view/useSyncScroll.js +33 -0
- package/es/components/card/card.css +1 -0
- package/es/components/card/card.d.ts +2 -1
- package/es/components/card/card.js +7 -3
- package/es/components/card/card.patch.css +6 -0
- package/es/components/date-picker/date-picker-quarter-utils.d.ts +7 -0
- package/es/components/date-picker/date-picker-quarter-utils.js +68 -0
- package/es/components/date-picker/date-picker-utils.d.ts +3 -2
- package/es/components/date-picker/date-picker-utils.js +7 -0
- package/es/components/image-uploader/image-uploader.js +2 -2
- package/es/components/input/input.d.ts +2 -2
- package/es/components/input/input.js +1 -0
- package/es/components/nav-bar/nav-bar.js +7 -7
- package/es/components/notice-bar/notice-bar.css +25 -4
- package/es/components/notice-bar/notice-bar.d.ts +5 -1
- package/es/components/notice-bar/notice-bar.js +7 -3
- package/es/components/search-bar/search-bar.d.ts +2 -2
- package/es/components/search-bar/search-bar.js +1 -0
- package/es/components/segmented/index.d.ts +4 -0
- package/es/components/segmented/index.js +3 -0
- package/es/components/segmented/segmented.css +97 -0
- package/es/components/segmented/segmented.d.ts +21 -0
- package/es/components/segmented/segmented.js +48 -0
- package/es/components/segmented/segmented.patch.css +32 -0
- package/es/components/tab-bar/tab-bar.d.ts +1 -0
- package/es/components/tab-bar/tab-bar.js +2 -0
- package/es/components/tabs/tabs.js +1 -1
- package/es/components/toast/methods.js +9 -3
- package/es/global/css-vars-patch.css +32 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +1 -0
- package/es/locales/cnr-ME.d.ts +139 -0
- package/es/locales/cnr-ME.js +142 -0
- package/es/locales/hr-HR.d.ts +139 -0
- package/es/locales/hr-HR.js +142 -0
- package/es/locales/kk-KZ.js +6 -6
- package/es/locales/sr-RS.d.ts +139 -0
- package/es/locales/sr-RS.js +142 -0
- package/es/utils/render-imperatively.d.ts +1 -0
- package/es/utils/render-imperatively.js +6 -3
- package/package.json +3 -2
- package/umd/antd-mobile.js +1 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _mergeLocale = require("../utils/merge-locale");
|
|
8
|
+
var _base = require("./base");
|
|
9
|
+
const typeTemplate = '${label} није ваљан ${type}';
|
|
10
|
+
const srRS = (0, _mergeLocale.mergeLocale)(_base.base, {
|
|
11
|
+
locale: 'sr',
|
|
12
|
+
common: {
|
|
13
|
+
confirm: 'Потврди',
|
|
14
|
+
cancel: 'Откажи',
|
|
15
|
+
loading: 'Учитавање',
|
|
16
|
+
close: 'Затвори'
|
|
17
|
+
},
|
|
18
|
+
Calendar: {
|
|
19
|
+
title: 'Избор датума',
|
|
20
|
+
confirm: 'Потврди',
|
|
21
|
+
start: 'почетак',
|
|
22
|
+
end: 'крај',
|
|
23
|
+
today: 'данас',
|
|
24
|
+
markItems: ['Пон', 'Уто', 'Сре', 'Чет', 'Пет', 'Суб', 'Нед'],
|
|
25
|
+
yearAndMonth: '${year}/${month}'
|
|
26
|
+
},
|
|
27
|
+
Cascader: {
|
|
28
|
+
placeholder: 'Изаберите'
|
|
29
|
+
},
|
|
30
|
+
Dialog: {
|
|
31
|
+
ok: 'У реду'
|
|
32
|
+
},
|
|
33
|
+
DatePicker: {
|
|
34
|
+
tillNow: 'До сада'
|
|
35
|
+
},
|
|
36
|
+
ErrorBlock: {
|
|
37
|
+
default: {
|
|
38
|
+
title: 'Оопс, нешто је пошло по злу',
|
|
39
|
+
description: 'Молимо сачекајте минут и покушајте поново'
|
|
40
|
+
},
|
|
41
|
+
busy: {
|
|
42
|
+
title: 'Оопс, није учитано',
|
|
43
|
+
description: 'Покушајте да освежите страницу'
|
|
44
|
+
},
|
|
45
|
+
disconnected: {
|
|
46
|
+
title: 'Мрежа је заузета',
|
|
47
|
+
description: 'Покушајте да освежите страницу'
|
|
48
|
+
},
|
|
49
|
+
empty: {
|
|
50
|
+
title: 'Хмм, нисмо то нашли...',
|
|
51
|
+
description: 'Желите ли да покушате нову претрагу?'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
Form: {
|
|
55
|
+
required: 'Обавезно',
|
|
56
|
+
optional: 'Опционо',
|
|
57
|
+
defaultValidateMessages: {
|
|
58
|
+
default: 'Грешка у валидацији за поље ${label}',
|
|
59
|
+
required: 'Молимо унесите ${label}',
|
|
60
|
+
enum: '${label} мора бити један од [${enum}]',
|
|
61
|
+
whitespace: '${label} не може бити празан карактер',
|
|
62
|
+
date: {
|
|
63
|
+
format: '${label} формат датума није ваљан',
|
|
64
|
+
parse: '${label} не може бити конвертован у датум',
|
|
65
|
+
invalid: '${label} је неважећи датум'
|
|
66
|
+
},
|
|
67
|
+
types: {
|
|
68
|
+
string: typeTemplate,
|
|
69
|
+
method: typeTemplate,
|
|
70
|
+
array: typeTemplate,
|
|
71
|
+
object: typeTemplate,
|
|
72
|
+
number: typeTemplate,
|
|
73
|
+
date: typeTemplate,
|
|
74
|
+
boolean: typeTemplate,
|
|
75
|
+
integer: typeTemplate,
|
|
76
|
+
float: typeTemplate,
|
|
77
|
+
regexp: typeTemplate,
|
|
78
|
+
email: typeTemplate,
|
|
79
|
+
url: typeTemplate,
|
|
80
|
+
hex: typeTemplate
|
|
81
|
+
},
|
|
82
|
+
string: {
|
|
83
|
+
len: '${label} мора бити ${len} карактера',
|
|
84
|
+
min: '${label} мора имати најмање ${min} карактера',
|
|
85
|
+
max: '${label} може имати највише ${max} карактера',
|
|
86
|
+
range: '${label} мора бити између ${min}-${max} карактера'
|
|
87
|
+
},
|
|
88
|
+
number: {
|
|
89
|
+
len: '${label} мора бити једнак ${len}',
|
|
90
|
+
min: '${label} мора бити минимум ${min}',
|
|
91
|
+
max: '${label} мора бити максимум ${max}',
|
|
92
|
+
range: '${label} мора бити између ${min}-${max}'
|
|
93
|
+
},
|
|
94
|
+
array: {
|
|
95
|
+
len: 'Мора бити ${len} ${label}',
|
|
96
|
+
min: 'Најмање ${min} ${label}',
|
|
97
|
+
max: 'Највише ${max} ${label}',
|
|
98
|
+
range: 'Количина ${label} мора бити између ${min}-${max}'
|
|
99
|
+
},
|
|
100
|
+
pattern: {
|
|
101
|
+
mismatch: '${label} не одговара шаблону ${pattern}'
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
ImageUploader: {
|
|
106
|
+
uploading: 'Отпремање...',
|
|
107
|
+
upload: 'Отпреми'
|
|
108
|
+
},
|
|
109
|
+
InfiniteScroll: {
|
|
110
|
+
noMore: 'Нема више',
|
|
111
|
+
failedToLoad: 'Учитавање није успело',
|
|
112
|
+
retry: 'Покушај поново'
|
|
113
|
+
},
|
|
114
|
+
Input: {
|
|
115
|
+
clear: 'очисти'
|
|
116
|
+
},
|
|
117
|
+
Mask: {
|
|
118
|
+
name: 'Маска'
|
|
119
|
+
},
|
|
120
|
+
Modal: {
|
|
121
|
+
ok: 'У реду'
|
|
122
|
+
},
|
|
123
|
+
PasscodeInput: {
|
|
124
|
+
name: 'Унос шифре'
|
|
125
|
+
},
|
|
126
|
+
PullToRefresh: {
|
|
127
|
+
pulling: 'Повуците надоле за освежавање',
|
|
128
|
+
canRelease: 'Ослободите да одмах освежите',
|
|
129
|
+
complete: 'Освежавање успешно'
|
|
130
|
+
},
|
|
131
|
+
SearchBar: {
|
|
132
|
+
name: 'Трака за претрагу'
|
|
133
|
+
},
|
|
134
|
+
Slider: {
|
|
135
|
+
name: 'Слајдер'
|
|
136
|
+
},
|
|
137
|
+
Stepper: {
|
|
138
|
+
decrease: 'смањи',
|
|
139
|
+
increase: 'повећај'
|
|
140
|
+
},
|
|
141
|
+
Switch: {
|
|
142
|
+
name: 'Прекидач'
|
|
143
|
+
},
|
|
144
|
+
Selector: {
|
|
145
|
+
name: 'Селектор'
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
var _default = srRS;
|
|
149
|
+
exports.default = _default;
|
|
@@ -8,6 +8,7 @@ declare type TargetElement = ReactElement<ImperativeProps>;
|
|
|
8
8
|
export declare type ImperativeHandler = {
|
|
9
9
|
close: () => void;
|
|
10
10
|
replace: (element: TargetElement) => void;
|
|
11
|
+
isRendered?: () => boolean;
|
|
11
12
|
};
|
|
12
13
|
export declare function renderImperatively(element: TargetElement): ImperativeHandler;
|
|
13
14
|
export {};
|
|
@@ -55,17 +55,20 @@ function renderImperatively(element) {
|
|
|
55
55
|
}));
|
|
56
56
|
return {
|
|
57
57
|
close: () => (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
58
|
-
var _a;
|
|
58
|
+
var _a, _b, _c;
|
|
59
59
|
if (!wrapperRef.current) {
|
|
60
60
|
// it means the wrapper is not mounted yet, call `unmount` directly
|
|
61
61
|
unmount();
|
|
62
|
+
// call `afterClose` to make sure the callback is called
|
|
63
|
+
(_b = (_a = element.props).afterClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
62
64
|
} else {
|
|
63
|
-
(
|
|
65
|
+
(_c = wrapperRef.current) === null || _c === void 0 ? void 0 : _c.close();
|
|
64
66
|
}
|
|
65
67
|
}),
|
|
66
68
|
replace: element => {
|
|
67
69
|
var _a;
|
|
68
70
|
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.replace(element);
|
|
69
|
-
}
|
|
71
|
+
},
|
|
72
|
+
isRendered: () => !!wrapperRef.current
|
|
70
73
|
};
|
|
71
74
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
+
import classNames from 'classnames';
|
|
2
3
|
import React, { forwardRef, useRef } from 'react';
|
|
3
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
4
|
-
import
|
|
5
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
5
6
|
import Button from '../button';
|
|
7
|
+
import CalendarPickerView from '../calendar-picker-view';
|
|
8
|
+
import { Context } from '../calendar-picker-view/calendar-picker-view';
|
|
9
|
+
import { useConfig } from '../config-provider';
|
|
6
10
|
import Divider from '../divider';
|
|
7
11
|
import Popup from '../popup';
|
|
8
|
-
import { mergeProps } from '../../utils/with-default-props';
|
|
9
|
-
import { useConfig } from '../config-provider';
|
|
10
|
-
import CalendarPickerView from '../calendar-picker-view';
|
|
11
12
|
const classPrefix = 'adm-calendar-picker';
|
|
12
13
|
const defaultProps = {
|
|
13
14
|
weekStartsOn: 'Sunday',
|
|
@@ -36,6 +37,9 @@ export const CalendarPicker = forwardRef((p, ref) => {
|
|
|
36
37
|
getContainer
|
|
37
38
|
} = props,
|
|
38
39
|
calendarViewProps = __rest(props, ["visible", "confirmText", "popupClassName", "popupStyle", "popupBodyStyle", "forceRender", "closeOnMaskClick", "onClose", "onConfirm", "onMaskClick", "getContainer"]);
|
|
40
|
+
const viewContext = React.useMemo(() => ({
|
|
41
|
+
visible: !!visible
|
|
42
|
+
}), [visible]);
|
|
39
43
|
const footer = React.createElement("div", {
|
|
40
44
|
className: `${classPrefix}-footer`
|
|
41
45
|
}, React.createElement(Divider, null), React.createElement("div", {
|
|
@@ -75,7 +79,9 @@ export const CalendarPicker = forwardRef((p, ref) => {
|
|
|
75
79
|
}
|
|
76
80
|
},
|
|
77
81
|
getContainer: getContainer
|
|
82
|
+
}, React.createElement(Context.Provider, {
|
|
83
|
+
value: viewContext
|
|
78
84
|
}, React.createElement(CalendarPickerView, Object.assign({
|
|
79
85
|
ref: calendarRef
|
|
80
|
-
}, calendarViewProps)), footer)));
|
|
86
|
+
}, calendarViewProps))), footer)));
|
|
81
87
|
});
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
import { DateRange, Page } from './convert';
|
|
4
|
+
export declare const Context: React.Context<{
|
|
5
|
+
visible: boolean;
|
|
6
|
+
}>;
|
|
4
7
|
export declare type CalendarPickerViewRef = {
|
|
5
8
|
jumpTo: (page: Page | ((page: Page) => Page)) => void;
|
|
6
9
|
jumpToToday: () => void;
|
|
7
10
|
getDateRange: () => DateRange;
|
|
8
11
|
};
|
|
9
12
|
export declare type CalendarPickerViewProps = {
|
|
10
|
-
title?: React.ReactNode;
|
|
13
|
+
title?: React.ReactNode | false;
|
|
11
14
|
confirmText?: string;
|
|
12
15
|
weekStartsOn?: 'Monday' | 'Sunday';
|
|
13
16
|
renderTop?: (date: Date) => React.ReactNode;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import React, { forwardRef, useState, useImperativeHandle, useMemo } from 'react';
|
|
2
|
-
import { withNativeProps } from '../../utils/native-props';
|
|
3
|
-
import dayjs from 'dayjs';
|
|
4
1
|
import classNames from 'classnames';
|
|
5
|
-
import
|
|
6
|
-
import { useConfig } from '../config-provider';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
7
3
|
import isoWeek from 'dayjs/plugin/isoWeek';
|
|
8
4
|
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
5
|
+
import React, { forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
9
7
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
10
|
-
import {
|
|
8
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
9
|
+
import { useConfig } from '../config-provider';
|
|
10
|
+
import { convertPageToDayjs, convertValueToRange } from './convert';
|
|
11
|
+
import useSyncScroll from './useSyncScroll';
|
|
11
12
|
dayjs.extend(isoWeek);
|
|
12
13
|
dayjs.extend(isSameOrBefore);
|
|
13
14
|
const classPrefix = 'adm-calendar-picker-view';
|
|
15
|
+
export const Context = React.createContext({
|
|
16
|
+
visible: false
|
|
17
|
+
});
|
|
14
18
|
const defaultProps = {
|
|
15
19
|
weekStartsOn: 'Sunday',
|
|
16
20
|
defaultValue: null,
|
|
@@ -20,6 +24,7 @@ const defaultProps = {
|
|
|
20
24
|
};
|
|
21
25
|
export const CalendarPickerView = forwardRef((p, ref) => {
|
|
22
26
|
var _a;
|
|
27
|
+
const bodyRef = useRef(null);
|
|
23
28
|
const today = dayjs();
|
|
24
29
|
const props = mergeProps(defaultProps, p);
|
|
25
30
|
const {
|
|
@@ -44,6 +49,34 @@ export const CalendarPickerView = forwardRef((p, ref) => {
|
|
|
44
49
|
});
|
|
45
50
|
const [intermediate, setIntermediate] = useState(false);
|
|
46
51
|
const [current, setCurrent] = useState(() => dayjs(dateRange ? dateRange[0] : today).date(1));
|
|
52
|
+
const onDateChange = v => {
|
|
53
|
+
if (v) {
|
|
54
|
+
setCurrent(dayjs(v[0]).date(1));
|
|
55
|
+
}
|
|
56
|
+
setDateRange(v);
|
|
57
|
+
};
|
|
58
|
+
const showHeader = props.title !== false;
|
|
59
|
+
// =============================== Scroll ===============================
|
|
60
|
+
const context = useContext(Context);
|
|
61
|
+
const scrollTo = useSyncScroll(current, context.visible, bodyRef);
|
|
62
|
+
// ============================== Boundary ==============================
|
|
63
|
+
// 记录默认的 min 和 max,并在外部的值超出边界时自动扩充
|
|
64
|
+
const [defaultMin, setDefaultMin] = useState(current);
|
|
65
|
+
const [defaultMax, setDefaultMax] = useState(() => current.add(6, 'month'));
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (dateRange) {
|
|
68
|
+
const [startDate, endDate] = dateRange;
|
|
69
|
+
if (!props.min && startDate && dayjs(startDate).isBefore(defaultMin)) {
|
|
70
|
+
setDefaultMin(dayjs(startDate).date(1));
|
|
71
|
+
}
|
|
72
|
+
if (!props.max && endDate && dayjs(endDate).isAfter(defaultMax)) {
|
|
73
|
+
setDefaultMax(dayjs(endDate).endOf('month'));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, [dateRange]);
|
|
77
|
+
const maxDay = useMemo(() => props.max ? dayjs(props.max) : defaultMax, [props.max, defaultMax]);
|
|
78
|
+
const minDay = useMemo(() => props.min ? dayjs(props.min) : defaultMin, [props.min, defaultMin]);
|
|
79
|
+
// ================================ Refs ================================
|
|
47
80
|
useImperativeHandle(ref, () => ({
|
|
48
81
|
jumpTo: pageOrPageGenerator => {
|
|
49
82
|
let page;
|
|
@@ -55,20 +88,23 @@ export const CalendarPickerView = forwardRef((p, ref) => {
|
|
|
55
88
|
} else {
|
|
56
89
|
page = pageOrPageGenerator;
|
|
57
90
|
}
|
|
58
|
-
|
|
91
|
+
const next = convertPageToDayjs(page);
|
|
92
|
+
setCurrent(next);
|
|
93
|
+
scrollTo(next);
|
|
59
94
|
},
|
|
60
95
|
jumpToToday: () => {
|
|
61
|
-
|
|
96
|
+
const next = dayjs().date(1);
|
|
97
|
+
setCurrent(next);
|
|
98
|
+
scrollTo(next);
|
|
62
99
|
},
|
|
63
100
|
getDateRange: () => dateRange
|
|
64
101
|
}));
|
|
102
|
+
// =============================== Render ===============================
|
|
65
103
|
const header = React.createElement("div", {
|
|
66
104
|
className: `${classPrefix}-header`
|
|
67
105
|
}, React.createElement("div", {
|
|
68
106
|
className: `${classPrefix}-title`
|
|
69
107
|
}, (_a = props.title) !== null && _a !== void 0 ? _a : locale.Calendar.title));
|
|
70
|
-
const maxDay = useMemo(() => props.max ? dayjs(props.max) : current.add(6, 'month'), [props.max, current]);
|
|
71
|
-
const minDay = useMemo(() => props.min ? dayjs(props.min) : current, [props.min, current]);
|
|
72
108
|
function renderBody() {
|
|
73
109
|
var _a;
|
|
74
110
|
const cells = [];
|
|
@@ -76,13 +112,21 @@ export const CalendarPickerView = forwardRef((p, ref) => {
|
|
|
76
112
|
// 遍历月份
|
|
77
113
|
while (monthIterator.isSameOrBefore(maxDay, 'month')) {
|
|
78
114
|
const year = monthIterator.year();
|
|
79
|
-
const month = monthIterator.month();
|
|
115
|
+
const month = monthIterator.month() + 1;
|
|
80
116
|
const renderMap = {
|
|
81
117
|
year,
|
|
82
|
-
month
|
|
118
|
+
month
|
|
83
119
|
};
|
|
120
|
+
const yearMonth = `${year}-${month}`;
|
|
121
|
+
// 获取需要预先填充的空格,如果是 7 天则不需要填充
|
|
122
|
+
const presetEmptyCellCount = props.weekStartsOn === 'Monday' ? monthIterator.date(1).isoWeekday() - 1 : monthIterator.date(1).isoWeekday();
|
|
123
|
+
const presetEmptyCells = presetEmptyCellCount == 7 ? null : Array(presetEmptyCellCount).fill(null).map((_, index) => React.createElement("div", {
|
|
124
|
+
key: index,
|
|
125
|
+
className: `${classPrefix}-cell`
|
|
126
|
+
}));
|
|
84
127
|
cells.push(React.createElement("div", {
|
|
85
|
-
key:
|
|
128
|
+
key: yearMonth,
|
|
129
|
+
"data-year-month": yearMonth
|
|
86
130
|
}, React.createElement("div", {
|
|
87
131
|
className: `${classPrefix}-title`
|
|
88
132
|
}, (_a = locale.Calendar.yearAndMonth) === null || _a === void 0 ? void 0 : _a.replace(/\${(.*?)}/g, (_, variable) => {
|
|
@@ -90,10 +134,7 @@ export const CalendarPickerView = forwardRef((p, ref) => {
|
|
|
90
134
|
return (_a = renderMap[variable]) === null || _a === void 0 ? void 0 : _a.toString();
|
|
91
135
|
})), React.createElement("div", {
|
|
92
136
|
className: `${classPrefix}-cells`
|
|
93
|
-
}, Array(
|
|
94
|
-
key: index,
|
|
95
|
-
className: `${classPrefix}-cell`
|
|
96
|
-
})), Array(monthIterator.daysInMonth()).fill(null).map((_, index) => {
|
|
137
|
+
}, presetEmptyCells, Array(monthIterator.daysInMonth()).fill(null).map((_, index) => {
|
|
97
138
|
var _a;
|
|
98
139
|
const d = monthIterator.date(index + 1);
|
|
99
140
|
let isSelect = false;
|
|
@@ -153,27 +194,27 @@ export const CalendarPickerView = forwardRef((p, ref) => {
|
|
|
153
194
|
}
|
|
154
195
|
if (props.selectionMode === 'single') {
|
|
155
196
|
if (props.allowClear && shouldClear()) {
|
|
156
|
-
|
|
197
|
+
onDateChange(null);
|
|
157
198
|
return;
|
|
158
199
|
}
|
|
159
|
-
|
|
200
|
+
onDateChange([date, date]);
|
|
160
201
|
} else if (props.selectionMode === 'range') {
|
|
161
202
|
if (!dateRange) {
|
|
162
|
-
|
|
203
|
+
onDateChange([date, date]);
|
|
163
204
|
setIntermediate(true);
|
|
164
205
|
return;
|
|
165
206
|
}
|
|
166
207
|
if (shouldClear()) {
|
|
167
|
-
|
|
208
|
+
onDateChange(null);
|
|
168
209
|
setIntermediate(false);
|
|
169
210
|
return;
|
|
170
211
|
}
|
|
171
212
|
if (intermediate) {
|
|
172
213
|
const another = dateRange[0];
|
|
173
|
-
|
|
214
|
+
onDateChange(another > date ? [date, another] : [another, date]);
|
|
174
215
|
setIntermediate(false);
|
|
175
216
|
} else {
|
|
176
|
-
|
|
217
|
+
onDateChange([date, date]);
|
|
177
218
|
setIntermediate(true);
|
|
178
219
|
}
|
|
179
220
|
}
|
|
@@ -191,7 +232,8 @@ export const CalendarPickerView = forwardRef((p, ref) => {
|
|
|
191
232
|
return cells;
|
|
192
233
|
}
|
|
193
234
|
const body = React.createElement("div", {
|
|
194
|
-
className: `${classPrefix}-body
|
|
235
|
+
className: `${classPrefix}-body`,
|
|
236
|
+
ref: bodyRef
|
|
195
237
|
}, renderBody());
|
|
196
238
|
const mark = React.createElement("div", {
|
|
197
239
|
className: `${classPrefix}-mark`
|
|
@@ -201,5 +243,5 @@ export const CalendarPickerView = forwardRef((p, ref) => {
|
|
|
201
243
|
}, item)));
|
|
202
244
|
return withNativeProps(props, React.createElement("div", {
|
|
203
245
|
className: classPrefix
|
|
204
|
-
}, header, mark, body));
|
|
246
|
+
}, showHeader && header, mark, body));
|
|
205
247
|
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useEvent } from 'rc-util';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
export default function useSyncScroll(current, visible, bodyRef) {
|
|
4
|
+
const rafRef = useRef();
|
|
5
|
+
const clean = () => {
|
|
6
|
+
if (rafRef.current) {
|
|
7
|
+
cancelAnimationFrame(rafRef.current);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const scrollTo = useEvent(date => {
|
|
11
|
+
clean();
|
|
12
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
13
|
+
if (bodyRef.current) {
|
|
14
|
+
const yearMonth = date.format('YYYY-M');
|
|
15
|
+
const target = bodyRef.current.querySelector(`[data-year-month="${yearMonth}"]`);
|
|
16
|
+
if (target) {
|
|
17
|
+
// Scroll to the top of view
|
|
18
|
+
target.scrollIntoView({
|
|
19
|
+
block: 'start',
|
|
20
|
+
inline: 'nearest'
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (visible && current) {
|
|
28
|
+
scrollTo(current);
|
|
29
|
+
return clean;
|
|
30
|
+
}
|
|
31
|
+
}, [current, visible]);
|
|
32
|
+
return scrollTo;
|
|
33
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { CSSProperties, FC, ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import type { FC, ReactNode, CSSProperties } from 'react';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
export declare type CardProps = {
|
|
5
5
|
title?: ReactNode;
|
|
6
|
+
icon?: ReactNode;
|
|
6
7
|
extra?: ReactNode;
|
|
7
8
|
headerStyle?: CSSProperties;
|
|
8
9
|
headerClassName?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import classNames from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { withNativeProps } from '../../utils/native-props';
|
|
4
4
|
const classPrefix = `adm-card`;
|
|
5
5
|
export const Card = props => {
|
|
@@ -11,9 +11,13 @@ export const Card = props => {
|
|
|
11
11
|
className: classNames(`${classPrefix}-header`, props.headerClassName),
|
|
12
12
|
style: props.headerStyle,
|
|
13
13
|
onClick: props.onHeaderClick
|
|
14
|
-
}, React.createElement("div", {
|
|
14
|
+
}, props.icon && React.createElement("div", {
|
|
15
|
+
className: `${classPrefix}-header-icon`
|
|
16
|
+
}, props.icon), React.createElement("div", {
|
|
15
17
|
className: `${classPrefix}-header-title`
|
|
16
|
-
}, props.title), props.extra
|
|
18
|
+
}, props.title), props.extra && React.createElement("div", {
|
|
19
|
+
className: `${classPrefix}-header-extra`
|
|
20
|
+
}, props.extra));
|
|
17
21
|
};
|
|
18
22
|
const renderBody = () => {
|
|
19
23
|
if (!props.children) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { PickerColumn } from '../picker';
|
|
3
|
+
import type { DatePickerFilter } from './date-picker-utils';
|
|
4
|
+
export declare type QuarterPrecision = 'year' | 'quarter';
|
|
5
|
+
export declare function generateDatePickerColumns(selected: string[], min: Date, max: Date, precision: QuarterPrecision, renderLabel: (type: QuarterPrecision, data: number) => ReactNode, filter: DatePickerFilter | undefined): PickerColumn[];
|
|
6
|
+
export declare function convertDateToStringArray(date: Date | undefined | null): string[];
|
|
7
|
+
export declare function convertStringArrayToDate<T extends string | number | null | undefined>(value: T[]): Date;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import quarterOfYear from 'dayjs/plugin/quarterOfYear';
|
|
3
|
+
dayjs.extend(quarterOfYear);
|
|
4
|
+
const precisionRankRecord = {
|
|
5
|
+
year: 0,
|
|
6
|
+
quarter: 1
|
|
7
|
+
};
|
|
8
|
+
export function generateDatePickerColumns(selected, min, max, precision, renderLabel, filter) {
|
|
9
|
+
const ret = [];
|
|
10
|
+
const minYear = min.getFullYear();
|
|
11
|
+
const maxYear = max.getFullYear();
|
|
12
|
+
const rank = precisionRankRecord[precision];
|
|
13
|
+
const selectedYear = parseInt(selected[0]);
|
|
14
|
+
const isInMinYear = selectedYear === minYear;
|
|
15
|
+
const isInMaxYear = selectedYear === maxYear;
|
|
16
|
+
const minDay = dayjs(min);
|
|
17
|
+
const maxDay = dayjs(max);
|
|
18
|
+
const minQuarter = minDay.quarter();
|
|
19
|
+
const maxQuarter = maxDay.quarter();
|
|
20
|
+
const generateColumn = (from, to, precision) => {
|
|
21
|
+
let column = [];
|
|
22
|
+
for (let i = from; i <= to; i++) {
|
|
23
|
+
column.push(i);
|
|
24
|
+
}
|
|
25
|
+
const prefix = selected.slice(0, precisionRankRecord[precision]);
|
|
26
|
+
const currentFilter = filter === null || filter === void 0 ? void 0 : filter[precision];
|
|
27
|
+
if (currentFilter && typeof currentFilter === 'function') {
|
|
28
|
+
column = column.filter(i => currentFilter(i, {
|
|
29
|
+
get date() {
|
|
30
|
+
const stringArray = [...prefix, i.toString()];
|
|
31
|
+
return convertStringArrayToDate(stringArray);
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
return column;
|
|
36
|
+
};
|
|
37
|
+
if (rank >= precisionRankRecord.year) {
|
|
38
|
+
const lower = minYear;
|
|
39
|
+
const upper = maxYear;
|
|
40
|
+
const years = generateColumn(lower, upper, 'year');
|
|
41
|
+
ret.push(years.map(v => ({
|
|
42
|
+
label: renderLabel('year', v),
|
|
43
|
+
value: v.toString()
|
|
44
|
+
})));
|
|
45
|
+
}
|
|
46
|
+
if (rank >= precisionRankRecord.quarter) {
|
|
47
|
+
const lower = isInMinYear ? minQuarter : 1;
|
|
48
|
+
const upper = isInMaxYear ? maxQuarter : 4;
|
|
49
|
+
const quarters = generateColumn(lower, upper, 'quarter');
|
|
50
|
+
ret.push(quarters.map(v => ({
|
|
51
|
+
label: renderLabel('quarter', v),
|
|
52
|
+
value: v.toString()
|
|
53
|
+
})));
|
|
54
|
+
}
|
|
55
|
+
return ret;
|
|
56
|
+
}
|
|
57
|
+
export function convertDateToStringArray(date) {
|
|
58
|
+
if (!date) return [];
|
|
59
|
+
const day = dayjs(date);
|
|
60
|
+
return [day.year().toString(), day.quarter().toString()];
|
|
61
|
+
}
|
|
62
|
+
export function convertStringArrayToDate(value) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
const yearString = (_a = value[0]) !== null && _a !== void 0 ? _a : '1900';
|
|
65
|
+
const quarterString = (_b = value[1]) !== null && _b !== void 0 ? _b : '1';
|
|
66
|
+
const day = dayjs().year(parseInt(yearString)).quarter(parseInt(quarterString)).hour(0).minute(0).second(0);
|
|
67
|
+
return day.toDate();
|
|
68
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { RenderLabel } from '../date-picker-view/date-picker-view';
|
|
1
2
|
import type { DatePrecision } from './date-picker-date-utils';
|
|
3
|
+
import type { QuarterPrecision } from './date-picker-quarter-utils';
|
|
2
4
|
import type { WeekPrecision } from './date-picker-week-utils';
|
|
3
|
-
|
|
4
|
-
export declare type Precision = DatePrecision | WeekPrecision;
|
|
5
|
+
export declare type Precision = DatePrecision | WeekPrecision | QuarterPrecision;
|
|
5
6
|
export declare type DatePickerFilter = Partial<Record<Precision, (val: number, extend: {
|
|
6
7
|
date: Date;
|
|
7
8
|
}) => boolean>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as dateUtils from './date-picker-date-utils';
|
|
2
|
+
import * as quarterUtils from './date-picker-quarter-utils';
|
|
2
3
|
import * as weekUtils from './date-picker-week-utils';
|
|
3
4
|
import { TILL_NOW } from './util';
|
|
4
5
|
const precisionLengthRecord = {
|
|
@@ -12,6 +13,8 @@ const precisionLengthRecord = {
|
|
|
12
13
|
export const convertDateToStringArray = (date, precision) => {
|
|
13
14
|
if (precision.includes('week')) {
|
|
14
15
|
return weekUtils.convertDateToStringArray(date);
|
|
16
|
+
} else if (precision.includes('quarter')) {
|
|
17
|
+
return quarterUtils.convertDateToStringArray(date);
|
|
15
18
|
} else {
|
|
16
19
|
const datePrecision = precision;
|
|
17
20
|
const stringArray = dateUtils.convertDateToStringArray(date);
|
|
@@ -27,6 +30,8 @@ export const convertStringArrayToDate = (value, precision) => {
|
|
|
27
30
|
}
|
|
28
31
|
if (precision.includes('week')) {
|
|
29
32
|
return weekUtils.convertStringArrayToDate(value);
|
|
33
|
+
} else if (precision.includes('quarter')) {
|
|
34
|
+
return quarterUtils.convertStringArrayToDate(value);
|
|
30
35
|
} else {
|
|
31
36
|
return dateUtils.convertStringArrayToDate(value);
|
|
32
37
|
}
|
|
@@ -34,6 +39,8 @@ export const convertStringArrayToDate = (value, precision) => {
|
|
|
34
39
|
export const generateDatePickerColumns = (selected, min, max, precision, renderLabel, filter, tillNow) => {
|
|
35
40
|
if (precision.startsWith('week')) {
|
|
36
41
|
return weekUtils.generateDatePickerColumns(selected, min, max, precision, renderLabel, filter);
|
|
42
|
+
} else if (precision.startsWith('quarter')) {
|
|
43
|
+
return quarterUtils.generateDatePickerColumns(selected, min, max, precision, renderLabel, filter);
|
|
37
44
|
} else {
|
|
38
45
|
return dateUtils.generateDatePickerColumns(selected, min, max, precision, renderLabel, filter, tillNow);
|
|
39
46
|
}
|
|
@@ -218,14 +218,14 @@ export const ImageUploader = forwardRef((p, ref) => {
|
|
|
218
218
|
}, React.createElement("span", {
|
|
219
219
|
className: `${classPrefix}-upload-button-icon`
|
|
220
220
|
}, React.createElement(AddOutline, null))), !props.disableUpload && React.createElement("input", {
|
|
221
|
+
"aria-label": locale.ImageUploader.upload,
|
|
221
222
|
ref: inputRef,
|
|
222
223
|
capture: props.capture,
|
|
223
224
|
accept: props.accept,
|
|
224
225
|
multiple: props.multiple,
|
|
225
226
|
type: 'file',
|
|
226
227
|
className: `${classPrefix}-input`,
|
|
227
|
-
onChange: onChange
|
|
228
|
-
"aria-hidden": true
|
|
228
|
+
onChange: onChange
|
|
229
229
|
})));
|
|
230
230
|
useImperativeHandle(ref, () => ({
|
|
231
231
|
get nativeElement() {
|