@akinon/ui-date-picker 0.5.0 → 1.0.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/dist/cjs/index.d.ts +20 -3
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +365 -2
- package/dist/cjs/types.d.ts +516 -0
- package/dist/esm/index.d.ts +20 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +366 -3
- package/dist/esm/types.d.ts +516 -0
- package/package.json +8 -4
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import type { DatePickerProps as AntDatePickerProps } from 'antd';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { IDatePickerGroupProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* DatePicker component for Akinon UI.
|
|
5
|
+
*
|
|
6
|
+
* The DatePicker component provides a flexible and feature-rich solution for selecting dates, ranges, and times.
|
|
7
|
+
* It supports various configurations, including custom formats, localized options, and enhanced accessibility features.
|
|
8
|
+
* The component integrates seamlessly with the Akinon design system, offering a consistent user experience.
|
|
9
|
+
*
|
|
10
|
+
* Key Features:
|
|
11
|
+
* - Multiple picker types, including date, week, month, quarter, and year.
|
|
12
|
+
* - Customizable placeholder, size, and variant options for styling.
|
|
13
|
+
* - Flexible date and time range selection with validation support.
|
|
14
|
+
* - Event callbacks for value changes, focus, blur, and panel interactions.
|
|
15
|
+
* - Localization support for tailored user experiences.
|
|
16
|
+
*
|
|
17
|
+
* The DatePicker component is designed to cater to both basic and advanced use cases, making it ideal for
|
|
18
|
+
* enterprise-level applications.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DatePicker: ({ pickerType, suffixIconColor, suffixIcon, suffixIconSize, showTitle, inputTitle, ...restDatePickerProps }: IDatePickerGroupProps) => React.JSX.Element;
|
|
21
|
+
export type { IDatePickerGroupProps };
|
|
5
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,UAAU,+GAQpB,qBAAqB,sBAidvB,CAAC;AAEF,YAAY,EAAE,qBAAqB,EAAE,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -12,10 +12,373 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.DatePicker = void 0;
|
|
15
|
+
const icons_1 = require("@akinon/icons");
|
|
16
|
+
const ui_theme_1 = require("@akinon/ui-theme");
|
|
17
|
+
const cssinjs_1 = require("@ant-design/cssinjs");
|
|
15
18
|
const antd_1 = require("antd");
|
|
16
19
|
const React = require("react");
|
|
20
|
+
const react_input_mask_1 = require("react-input-mask");
|
|
21
|
+
/**
|
|
22
|
+
* DatePicker component for Akinon UI.
|
|
23
|
+
*
|
|
24
|
+
* The DatePicker component provides a flexible and feature-rich solution for selecting dates, ranges, and times.
|
|
25
|
+
* It supports various configurations, including custom formats, localized options, and enhanced accessibility features.
|
|
26
|
+
* The component integrates seamlessly with the Akinon design system, offering a consistent user experience.
|
|
27
|
+
*
|
|
28
|
+
* Key Features:
|
|
29
|
+
* - Multiple picker types, including date, week, month, quarter, and year.
|
|
30
|
+
* - Customizable placeholder, size, and variant options for styling.
|
|
31
|
+
* - Flexible date and time range selection with validation support.
|
|
32
|
+
* - Event callbacks for value changes, focus, blur, and panel interactions.
|
|
33
|
+
* - Localization support for tailored user experiences.
|
|
34
|
+
*
|
|
35
|
+
* The DatePicker component is designed to cater to both basic and advanced use cases, making it ideal for
|
|
36
|
+
* enterprise-level applications.
|
|
37
|
+
*/
|
|
17
38
|
const DatePicker = (_a) => {
|
|
18
|
-
var restDatePickerProps = __rest(_a, []);
|
|
19
|
-
|
|
39
|
+
var { pickerType = 'date', suffixIconColor = '#788195', suffixIcon = 'chevron_down', suffixIconSize = '10px', showTitle = false, inputTitle = '' } = _a, restDatePickerProps = __rest(_a, ["pickerType", "suffixIconColor", "suffixIcon", "suffixIconSize", "showTitle", "inputTitle"]);
|
|
40
|
+
const { getPrefixCls, theme } = React.useContext(antd_1.ConfigProvider.ConfigContext);
|
|
41
|
+
const { token, hashId } = (0, ui_theme_1.useToken)();
|
|
42
|
+
const datePickerToken = token.DatePicker;
|
|
43
|
+
const prefixWithoutHash = `${getPrefixCls()}-picker`;
|
|
44
|
+
const prefixClsWithoutHash = `.${prefixWithoutHash}`;
|
|
45
|
+
const themeClassName = `${prefixWithoutHash}-${restDatePickerProps.theme}`;
|
|
46
|
+
const [startDate, setStartDate] = React.useState('');
|
|
47
|
+
const [startTime, setStartTime] = React.useState('');
|
|
48
|
+
const [endDate, setEndDate] = React.useState('');
|
|
49
|
+
const [endTime, setEndTime] = React.useState('');
|
|
50
|
+
const useStyle = (0, cssinjs_1.useStyleRegister)({
|
|
51
|
+
token: token,
|
|
52
|
+
path: ['DatePicker'],
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
+
theme: theme
|
|
55
|
+
}, () => {
|
|
56
|
+
const prefixCls = `:where(.${hashId})`;
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
+
const customTokens = theme.customTokens || {};
|
|
59
|
+
return {
|
|
60
|
+
[prefixCls]: {
|
|
61
|
+
[`&${prefixClsWithoutHash}`]: {
|
|
62
|
+
background: customTokens.others.colorTransparent,
|
|
63
|
+
border: customTokens.border.borderNone,
|
|
64
|
+
boxShadow: customTokens.layout.displayNone,
|
|
65
|
+
padding: customTokens.sizing.valueZero,
|
|
66
|
+
[`&:not(${prefixClsWithoutHash}-light)`]: {
|
|
67
|
+
background: datePickerToken.general.bgDarkBlue,
|
|
68
|
+
[`input`]: {
|
|
69
|
+
border: datePickerToken.general.wideBorder
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
[`&${prefixClsWithoutHash}-light`]: {
|
|
73
|
+
background: token.colorWhite,
|
|
74
|
+
border: datePickerToken.general.lightThemeBorder,
|
|
75
|
+
[`input`]: {
|
|
76
|
+
border: datePickerToken.general.lightThemeBorder
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
[`${prefixClsWithoutHash}-input span`]: {
|
|
80
|
+
position: customTokens.layout.positionAbsolute,
|
|
81
|
+
right: datePickerToken.pickerPanel.range.iconPosition,
|
|
82
|
+
top: customTokens.sizing.valueHalf,
|
|
83
|
+
transform: datePickerToken.pickerPanel.range.iconTransform,
|
|
84
|
+
pointerEvents: customTokens.layout.displayNone
|
|
85
|
+
},
|
|
86
|
+
[`${prefixClsWithoutHash}-input`]: {
|
|
87
|
+
color: datePickerToken.general.fontColor
|
|
88
|
+
},
|
|
89
|
+
[`input`]: {
|
|
90
|
+
fontWeight: datePickerToken.general.fontWeight,
|
|
91
|
+
padding: datePickerToken.general.inputPadding,
|
|
92
|
+
borderRadius: datePickerToken.pickerPanel.range.inputRadius,
|
|
93
|
+
width: `${restDatePickerProps.inputWidth} !important`,
|
|
94
|
+
outline: customTokens.layout.displayNone
|
|
95
|
+
},
|
|
96
|
+
[`&${prefixClsWithoutHash}-range`]: {
|
|
97
|
+
[`${prefixClsWithoutHash}-range-separator`]: {
|
|
98
|
+
content: customTokens.others.emptyContent,
|
|
99
|
+
width: datePickerToken.pickerPanel.separator.width,
|
|
100
|
+
height: datePickerToken.pickerPanel.separator.height,
|
|
101
|
+
background: datePickerToken.pickerPanel.separator.backgroundColor,
|
|
102
|
+
padding: customTokens.sizing.valueZero,
|
|
103
|
+
['svg']: {
|
|
104
|
+
display: customTokens.layout.displayNone
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
[`${prefixClsWithoutHash}-suffix`]: {
|
|
108
|
+
display: customTokens.layout.displayNone
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
[`${prefixClsWithoutHash}-active-bar`]: {
|
|
113
|
+
display: customTokens.layout.displayNone
|
|
114
|
+
},
|
|
115
|
+
[`&${prefixClsWithoutHash}-dropdown`]: {
|
|
116
|
+
['&::before']: {
|
|
117
|
+
content: customTokens.others.emptyContent,
|
|
118
|
+
position: customTokens.layout.positionAbsolute,
|
|
119
|
+
top: datePickerToken.pickerTriangle.beforeTop,
|
|
120
|
+
left: customTokens.layout.valueHalf,
|
|
121
|
+
transform: datePickerToken.pickerTriangle.transform,
|
|
122
|
+
borderLeft: datePickerToken.pickerTriangle.beforeBorderX,
|
|
123
|
+
borderRight: datePickerToken.pickerTriangle.beforeBorderX,
|
|
124
|
+
borderBottom: datePickerToken.pickerTriangle.beforeBorderBottom,
|
|
125
|
+
zIndex: datePickerToken.pickerTriangle.beforeZIndex
|
|
126
|
+
},
|
|
127
|
+
['&::after']: {
|
|
128
|
+
content: customTokens.others.emptyContent,
|
|
129
|
+
position: customTokens.layout.positionAbsolute,
|
|
130
|
+
top: datePickerToken.pickerTriangle.afterTop,
|
|
131
|
+
left: customTokens.layout.valueHalf,
|
|
132
|
+
transform: datePickerToken.pickerTriangle.transform,
|
|
133
|
+
borderLeft: datePickerToken.pickerTriangle.afterBorderX,
|
|
134
|
+
borderRight: datePickerToken.pickerTriangle.afterBorderX,
|
|
135
|
+
borderBottom: datePickerToken.pickerTriangle.afterBorderBottom,
|
|
136
|
+
zIndex: datePickerToken.pickerTriangle.afterZIndex
|
|
137
|
+
},
|
|
138
|
+
[`${prefixClsWithoutHash}-date-panel-container`]: {
|
|
139
|
+
background: datePickerToken.general.bgDarkBlue,
|
|
140
|
+
border: datePickerToken.general.wideBorder,
|
|
141
|
+
boxShadow: datePickerToken.pickerPanel.shadow,
|
|
142
|
+
[`${prefixClsWithoutHash}-date-panel`]: {
|
|
143
|
+
width: 'fit-content'
|
|
144
|
+
},
|
|
145
|
+
[`${prefixClsWithoutHash}-header`]: {
|
|
146
|
+
border: customTokens.border.borderNone,
|
|
147
|
+
alignItems: datePickerToken.general.itemCenter,
|
|
148
|
+
marginBottom: datePickerToken.pickerPanel.header.marginY,
|
|
149
|
+
marginTop: datePickerToken.pickerPanel.header.marginY,
|
|
150
|
+
padding: datePickerToken.pickerPanel.header.padding,
|
|
151
|
+
[`&-view`]: {
|
|
152
|
+
fontSize: datePickerToken.pickerPanel.header.textSize,
|
|
153
|
+
fontWeight: datePickerToken.general.fontWeight,
|
|
154
|
+
lineHeight: customTokens.others.lineHeightShort,
|
|
155
|
+
letterSpacing: '-0.1px !important',
|
|
156
|
+
color: datePickerToken.pickerPanel.header.textColor
|
|
157
|
+
},
|
|
158
|
+
['button']: {
|
|
159
|
+
lineHeight: customTokens.others.lineHeightShort
|
|
160
|
+
},
|
|
161
|
+
['&-prev-btn, &-next-btn']: {
|
|
162
|
+
minWidth: datePickerToken.pickerPanel.header.arrawWidth,
|
|
163
|
+
width: datePickerToken.pickerPanel.header.arrawWidth
|
|
164
|
+
},
|
|
165
|
+
['&-prev-btn']: {
|
|
166
|
+
paddingLeft: datePickerToken.pickerPanel.header.arrowPaddingLeft
|
|
167
|
+
},
|
|
168
|
+
['&-next-btn']: {
|
|
169
|
+
paddingRight: datePickerToken.pickerPanel.header.arrowPaddingRight
|
|
170
|
+
},
|
|
171
|
+
['&-super-prev-btn, &-super-next-btn']: {
|
|
172
|
+
minWidth: datePickerToken.pickerPanel.header.arrawWidth,
|
|
173
|
+
width: datePickerToken.pickerPanel.header.arrawWidth
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
[`${prefixClsWithoutHash}-body`]: {
|
|
177
|
+
padding: datePickerToken.pickerPanel.body.padding
|
|
178
|
+
},
|
|
179
|
+
[`${prefixClsWithoutHash}-content`]: {
|
|
180
|
+
width: 'max-content',
|
|
181
|
+
['thead']: {
|
|
182
|
+
borderBottom: datePickerToken.pickerPanel.content.tableHeaderBorder
|
|
183
|
+
},
|
|
184
|
+
['th']: {
|
|
185
|
+
fontSize: datePickerToken.pickerPanel.content.tableHeaderFontSize,
|
|
186
|
+
fontWeight: datePickerToken.general.fontWeight,
|
|
187
|
+
lineHeight: customTokens.others.lineHeightShort,
|
|
188
|
+
minWidth: datePickerToken.pickerPanel.content.tableHeaderWidth,
|
|
189
|
+
color: datePickerToken.pickerPanel.content.tableHeaderFontColor,
|
|
190
|
+
textTransform: customTokens.typography.textTransformUppercase,
|
|
191
|
+
height: customTokens.sizing.sizeMaxContent,
|
|
192
|
+
paddingBottom: datePickerToken.pickerPanel.content.tableHeaderPaddingBottom
|
|
193
|
+
},
|
|
194
|
+
['tr']: {
|
|
195
|
+
display: customTokens.layout.displayBlock,
|
|
196
|
+
marginTop: datePickerToken.pickerPanel.row.marginY
|
|
197
|
+
},
|
|
198
|
+
[`:not(${prefixClsWithoutHash}-cell-in-view)${prefixClsWithoutHash}-cell`]: {
|
|
199
|
+
visibility: customTokens.others.valueHidden,
|
|
200
|
+
padding: customTokens.sizing.valueZero,
|
|
201
|
+
minWidth: datePickerToken.pickerPanel.row.previousCellWidth,
|
|
202
|
+
lineHeight: customTokens.sizing.valueZero,
|
|
203
|
+
height: customTokens.sizing.valueZero,
|
|
204
|
+
[`${prefixClsWithoutHash}-cell-inner`]: {
|
|
205
|
+
lineHeight: customTokens.sizing.valueZero,
|
|
206
|
+
height: customTokens.sizing.valueZero
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
[`${prefixClsWithoutHash}-cell-in-view`]: {
|
|
210
|
+
padding: customTokens.sizing.valueZero,
|
|
211
|
+
minWidth: datePickerToken.pickerPanel.content.tableHeaderWidth,
|
|
212
|
+
marginBottom: datePickerToken.pickerPanel.row.marginY
|
|
213
|
+
},
|
|
214
|
+
[`${prefixClsWithoutHash}-cell-today`]: {
|
|
215
|
+
[`${prefixClsWithoutHash}-cell-inner`]: {
|
|
216
|
+
background: datePickerToken.pickerPanel.row.cellBg,
|
|
217
|
+
border: datePickerToken.pickerPanel.row.cellBorder,
|
|
218
|
+
borderRadius: datePickerToken.pickerPanel.row.cellBorderRadius
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
[`${prefixClsWithoutHash}-cell-inner`]: {
|
|
222
|
+
fontSize: datePickerToken.general.fontSize,
|
|
223
|
+
fontWeight: datePickerToken.pickerPanel.row.cellFontWeight,
|
|
224
|
+
lineHeight: datePickerToken.pickerPanel.row.cellLineHeight,
|
|
225
|
+
color: datePickerToken.pickerPanel.row.cellTextColor,
|
|
226
|
+
height: customTokens.sizing.valueFull,
|
|
227
|
+
width: customTokens.sizing.valueFull,
|
|
228
|
+
[`&::before`]: {
|
|
229
|
+
display: customTokens.layout.displayNone
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
[`${prefixClsWithoutHash}-footer`]: {
|
|
234
|
+
borderTop: datePickerToken.pickerPanel.footer.datePickerBorderTop,
|
|
235
|
+
margin: datePickerToken.pickerPanel.footer.margin,
|
|
236
|
+
padding: datePickerToken.pickerPanel.footer.datePickerPadding,
|
|
237
|
+
['li']: {
|
|
238
|
+
lineHeight: datePickerToken.pickerPanel.footer.lineHeight,
|
|
239
|
+
['a']: {
|
|
240
|
+
fontSize: datePickerToken.pickerPanel.footer.fontSize,
|
|
241
|
+
fontWeight: datePickerToken.general.fontWeight,
|
|
242
|
+
color: token.colorWhite,
|
|
243
|
+
padding: datePickerToken.pickerPanel.footer.padding,
|
|
244
|
+
border: datePickerToken.pickerPanel.footer.border,
|
|
245
|
+
borderRadius: datePickerToken.pickerPanel.footer.borderRadius
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
[`&${prefixClsWithoutHash}-dropdown-range`]: {
|
|
252
|
+
padding: customTokens.sizing.valueZero,
|
|
253
|
+
[`${prefixClsWithoutHash}-date-panel-container`]: {
|
|
254
|
+
[`${prefixClsWithoutHash}-panel-layout`]: {
|
|
255
|
+
width: 'min-content'
|
|
256
|
+
},
|
|
257
|
+
[`${prefixClsWithoutHash}-header`]: {
|
|
258
|
+
['&-super-prev-btn, &-super-next-btn']: {
|
|
259
|
+
display: customTokens.layout.displayNone
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
[`${prefixClsWithoutHash}-body`]: {
|
|
263
|
+
padding: '0 25px 0 20px !important'
|
|
264
|
+
},
|
|
265
|
+
[`${prefixClsWithoutHash}-content`]: {
|
|
266
|
+
[`${prefixClsWithoutHash}-cell-in-view,
|
|
267
|
+
${prefixClsWithoutHash}-cell-in-range`]: {
|
|
268
|
+
padding: customTokens.sizing.valueZero,
|
|
269
|
+
minWidth: datePickerToken.pickerPanel.content.tableHeaderWidth,
|
|
270
|
+
marginBottom: datePickerToken.pickerPanel.row.marginY
|
|
271
|
+
},
|
|
272
|
+
[`${prefixClsWithoutHash}-cell-in-range`]: {
|
|
273
|
+
['&:before']: {
|
|
274
|
+
background: customTokens.others.colorTransparent
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
[`${prefixClsWithoutHash}-cell-today,
|
|
278
|
+
${prefixClsWithoutHash}-cell-range-start,
|
|
279
|
+
${prefixClsWithoutHash}-cell-range-end`]: {
|
|
280
|
+
[`${prefixClsWithoutHash}-cell-inner`]: {
|
|
281
|
+
background: datePickerToken.pickerPanel.row.cellBg,
|
|
282
|
+
border: datePickerToken.pickerPanel.row.cellBorder,
|
|
283
|
+
borderRadius: datePickerToken.pickerPanel.row.cellBorderRadius
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
[`${prefixClsWithoutHash}-footer`]: {
|
|
288
|
+
borderTop: customTokens.border.borderNone,
|
|
289
|
+
padding: customTokens.sizing.valueZero
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
[`&${prefixClsWithoutHash}-input-title`]: {
|
|
294
|
+
display: customTokens.layout.displayBlock,
|
|
295
|
+
fontWeight: datePickerToken.general.fontWeight,
|
|
296
|
+
marginBottom: datePickerToken.general.inputMarginBottom,
|
|
297
|
+
[`&:not(${prefixClsWithoutHash}-light)`]: {
|
|
298
|
+
color: token.colorWhite
|
|
299
|
+
},
|
|
300
|
+
[`&${prefixClsWithoutHash}-light`]: {
|
|
301
|
+
color: datePickerToken.title.lightColor
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
['.range-footer']: {
|
|
306
|
+
display: customTokens.layout.displayFlex,
|
|
307
|
+
flexDirection: datePickerToken.pickerPanel.footer.rangeDirection,
|
|
308
|
+
alignItems: datePickerToken.general.itemCenter,
|
|
309
|
+
columnGap: datePickerToken.pickerPanel.footer.rangeColGap,
|
|
310
|
+
['.range-footer-start, .range-footer-end']: {
|
|
311
|
+
display: customTokens.layout.displayFlex,
|
|
312
|
+
flexDirection: datePickerToken.pickerPanel.footer.rangeDirection,
|
|
313
|
+
alignItems: datePickerToken.general.itemCenter,
|
|
314
|
+
borderTop: datePickerToken.pickerPanel.footer.rangeBorder,
|
|
315
|
+
padding: datePickerToken.pickerPanel.footer.rangePadding,
|
|
316
|
+
columnGap: datePickerToken.pickerPanel.footer.rangeCol
|
|
317
|
+
},
|
|
318
|
+
['input']: {
|
|
319
|
+
border: datePickerToken.general.wideBorder,
|
|
320
|
+
backgroundColor: datePickerToken.general.bgDarkBlue,
|
|
321
|
+
textAlign: datePickerToken.general.itemCenter,
|
|
322
|
+
width: customTokens.sizing.valueFull,
|
|
323
|
+
padding: datePickerToken.pickerPanel.footer.rangeInputPadding,
|
|
324
|
+
borderRadius: datePickerToken.pickerPanel.footer.rangeInputRadius,
|
|
325
|
+
fontWeight: datePickerToken.general.fontWeight,
|
|
326
|
+
color: token.colorWhite,
|
|
327
|
+
outline: customTokens.layout.displayNone,
|
|
328
|
+
['&::placeholder']: {
|
|
329
|
+
color: datePickerToken.general.fontColor
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
});
|
|
335
|
+
const customPopupStyle = restDatePickerProps.placement === 'center'
|
|
336
|
+
? { left: '50%', transform: 'translateX(-50%)' }
|
|
337
|
+
: {};
|
|
338
|
+
const handleDateChange = (dates) => {
|
|
339
|
+
const updateDateTime = (date, setDate, setTime) => {
|
|
340
|
+
if (date) {
|
|
341
|
+
setDate(date.format('MM/DD/YYYY'));
|
|
342
|
+
setTime(date.format('HH:mm:ss'));
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
setDate('');
|
|
346
|
+
setTime('');
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
if (dates) {
|
|
350
|
+
updateDateTime(dates[0], setStartDate, setStartTime);
|
|
351
|
+
updateDateTime(dates[1], setEndDate, setEndTime);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
const renderFooter = (panelType) => {
|
|
355
|
+
const renderInputMask = (mask, value, onChange, placeholder) => (React.createElement(react_input_mask_1.default, { mask: mask, value: value, onChange: onChange, placeholder: placeholder }));
|
|
356
|
+
const isStartPanel = panelType === 'start';
|
|
357
|
+
const containerClass = isStartPanel
|
|
358
|
+
? 'range-footer-start'
|
|
359
|
+
: 'range-footer-end';
|
|
360
|
+
return (React.createElement("div", { className: containerClass },
|
|
361
|
+
renderInputMask('99/99/9999', isStartPanel ? startDate : endDate, isStartPanel
|
|
362
|
+
? e => setStartDate(e.target.value)
|
|
363
|
+
: e => setEndDate(e.target.value), isStartPanel ? '00/00/0000' : 'End Date'),
|
|
364
|
+
renderInputMask('99:99:99', isStartPanel ? startTime : endTime, isStartPanel
|
|
365
|
+
? e => setStartTime(e.target.value)
|
|
366
|
+
: e => setEndTime(e.target.value), isStartPanel ? '00:00:00' : 'End Time')));
|
|
367
|
+
};
|
|
368
|
+
const RangePickerCustomInput = React.forwardRef((props, ref) => {
|
|
369
|
+
const _a = props, { value, onChange, placeholder } = _a, restProps = __rest(_a, ["value", "onChange", "placeholder"]);
|
|
370
|
+
return (React.createElement(React.Fragment, null,
|
|
371
|
+
React.createElement("input", Object.assign({}, restProps, { ref: ref, value: value, onChange: onChange, placeholder: placeholder })),
|
|
372
|
+
React.createElement("span", null,
|
|
373
|
+
React.createElement(icons_1.Icon, { icon: suffixIcon, size: suffixIconSize, style: { color: suffixIconColor } }))));
|
|
374
|
+
});
|
|
375
|
+
RangePickerCustomInput.displayName = 'RangePickerCustomInput';
|
|
376
|
+
return useStyle(pickerType === 'range' ? (React.createElement(antd_1.DatePicker.RangePicker, Object.assign({}, restDatePickerProps, { popupStyle: customPopupStyle, onChange: handleDateChange, renderExtraFooter: () => (React.createElement("div", { className: "range-footer" },
|
|
377
|
+
renderFooter('start'),
|
|
378
|
+
renderFooter('end'))), components: {
|
|
379
|
+
input: RangePickerCustomInput
|
|
380
|
+
}, variant: "borderless" }))) : (React.createElement("div", null,
|
|
381
|
+
showTitle && (React.createElement(antd_1.Typography.Text, { className: `${prefixWithoutHash}-input-title ${themeClassName}` }, inputTitle)),
|
|
382
|
+
React.createElement(antd_1.DatePicker, Object.assign({ className: themeClassName, suffixIcon: React.createElement(icons_1.Icon, { icon: suffixIcon, size: suffixIconSize, style: { color: suffixIconColor } }) }, restDatePickerProps)))));
|
|
20
383
|
};
|
|
21
384
|
exports.DatePicker = DatePicker;
|