@onesy/ui-react 1.0.196 → 1.0.197
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/DatePicker/DatePicker.js +40 -40
- package/DateTimePicker/DateTimePicker.js +28 -28
- package/TimePicker/TimePicker.js +44 -44
- package/esm/DatePicker/DatePicker.js +40 -40
- package/esm/DateTimePicker/DateTimePicker.js +28 -28
- package/esm/TimePicker/TimePicker.js +44 -44
- package/esm/index.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
package/DatePicker/DatePicker.js
CHANGED
|
@@ -143,19 +143,19 @@ const DatePicker = props__ => {
|
|
|
143
143
|
ref,
|
|
144
144
|
tonal,
|
|
145
145
|
color = 'primary',
|
|
146
|
-
version:
|
|
146
|
+
version: versionProps = 'auto',
|
|
147
147
|
size = 'regular',
|
|
148
148
|
value: valueProps,
|
|
149
149
|
valueDefault,
|
|
150
150
|
onChange,
|
|
151
|
-
calendar:
|
|
151
|
+
calendar: calendarProps,
|
|
152
152
|
calendarDefault,
|
|
153
153
|
onChangeCalendar,
|
|
154
154
|
range,
|
|
155
155
|
now,
|
|
156
|
-
static:
|
|
156
|
+
static: staticProps,
|
|
157
157
|
openMobile = 'select',
|
|
158
|
-
placeholder:
|
|
158
|
+
placeholder: placeholderProps,
|
|
159
159
|
calendars = props.range ? 2 : 1,
|
|
160
160
|
min,
|
|
161
161
|
max,
|
|
@@ -163,31 +163,31 @@ const DatePicker = props__ => {
|
|
|
163
163
|
name,
|
|
164
164
|
nameFrom,
|
|
165
165
|
nameTo,
|
|
166
|
-
label:
|
|
167
|
-
labelFrom:
|
|
168
|
-
labelTo:
|
|
166
|
+
label: labelProps,
|
|
167
|
+
labelFrom: labelFromProps = l('Date from'),
|
|
168
|
+
labelTo: labelToProps = l('Date to'),
|
|
169
169
|
modeModalSubHeadingText = l('Select date'),
|
|
170
170
|
modeModalSubHeadingTextRange = `${l('Date from')}${SEPARATOR}${l('Date to')}`,
|
|
171
171
|
selectModeHeadingText = l('Select date'),
|
|
172
172
|
inputModeHeadingText = l('Enter date'),
|
|
173
|
-
useHelperText:
|
|
173
|
+
useHelperText: useHelperTextProps,
|
|
174
174
|
weekStartDay = 'Monday',
|
|
175
|
-
switch:
|
|
175
|
+
switch: switchProps,
|
|
176
176
|
fullScreen,
|
|
177
177
|
today,
|
|
178
178
|
clear = true,
|
|
179
|
-
heading:
|
|
180
|
-
actions:
|
|
179
|
+
heading: headingProps = true,
|
|
180
|
+
actions: actionsProps = true,
|
|
181
181
|
fullWidth,
|
|
182
182
|
readOnly,
|
|
183
183
|
disabled,
|
|
184
|
-
valid:
|
|
185
|
-
onClick:
|
|
186
|
-
onClose:
|
|
187
|
-
onToday:
|
|
188
|
-
onClear:
|
|
189
|
-
onCancel:
|
|
190
|
-
onOk:
|
|
184
|
+
valid: validProps,
|
|
185
|
+
onClick: onClickProps,
|
|
186
|
+
onClose: onCloseProps,
|
|
187
|
+
onToday: onTodayProps,
|
|
188
|
+
onClear: onClearProps,
|
|
189
|
+
onCancel: onCancelProps,
|
|
190
|
+
onOk: onOkProps,
|
|
191
191
|
Icon: Icon_ = _IconMaterialCalendarTodayW100Filled.default,
|
|
192
192
|
IconEnter = _IconMaterialEditW.default,
|
|
193
193
|
IconClose = _IconMaterialCloseW.default,
|
|
@@ -213,21 +213,21 @@ const DatePicker = props__ => {
|
|
|
213
213
|
};
|
|
214
214
|
const keys = _react.default.useMemo(() => {
|
|
215
215
|
const result = [];
|
|
216
|
-
const items = [
|
|
216
|
+
const items = [switchProps, useHelperTextProps];
|
|
217
217
|
items.forEach(item => {
|
|
218
218
|
if ((0, _utils.is)('object', item)) Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key_0 => result.push(key_0));
|
|
219
219
|
});
|
|
220
220
|
return (0, _utils.unique)(result);
|
|
221
|
-
}, [
|
|
221
|
+
}, [switchProps, useHelperTextProps]);
|
|
222
222
|
const breakpoints = {};
|
|
223
223
|
keys.forEach(key_1 => {
|
|
224
224
|
breakpoints[key_1] = (0, _useMediaQuery.default)(theme.breakpoints.media[key_1], {
|
|
225
225
|
element: refs.root.current
|
|
226
226
|
});
|
|
227
227
|
});
|
|
228
|
-
const label = name !== undefined ? name :
|
|
229
|
-
const switch_ = (0, _utils2.valueBreakpoints)(
|
|
230
|
-
const useHelperText = (0, _utils2.valueBreakpoints)(
|
|
228
|
+
const label = name !== undefined ? name : labelProps;
|
|
229
|
+
const switch_ = (0, _utils2.valueBreakpoints)(switchProps, true, breakpoints, theme);
|
|
230
|
+
const useHelperText = (0, _utils2.valueBreakpoints)(useHelperTextProps, undefined, breakpoints, theme);
|
|
231
231
|
const touch = (0, _useMediaQuery.default)('(pointer: coarse)', {
|
|
232
232
|
element: refs.root.current
|
|
233
233
|
});
|
|
@@ -240,7 +240,7 @@ const DatePicker = props__ => {
|
|
|
240
240
|
const valueResult = (valueDefault !== undefined ? valueDefault : valueProps) || now && (range ? [new _date.OnesyDate(), new _date.OnesyDate()] : [new _date.OnesyDate()]);
|
|
241
241
|
return onResolveValue(valueResult);
|
|
242
242
|
});
|
|
243
|
-
const [calendar, setCalendar] = _react.default.useState((calendarDefault !== undefined ? calendarDefault :
|
|
243
|
+
const [calendar, setCalendar] = _react.default.useState((calendarDefault !== undefined ? calendarDefault : calendarProps) || new _date.OnesyDate());
|
|
244
244
|
const [open, setOpen] = _react.default.useState(false);
|
|
245
245
|
const [mode, setMode] = _react.default.useState((touch ? openMobile : 'select') || 'select');
|
|
246
246
|
const [error, setError] = _react.default.useState(false);
|
|
@@ -261,7 +261,7 @@ const DatePicker = props__ => {
|
|
|
261
261
|
};
|
|
262
262
|
const [input, setInput] = _react.default.useState(valueToInput());
|
|
263
263
|
const [inputModal, setInputModal] = _react.default.useState(valueToInput());
|
|
264
|
-
let version =
|
|
264
|
+
let version = versionProps;
|
|
265
265
|
if (version === 'auto') {
|
|
266
266
|
if (touch) version = 'mobile';else version = 'desktop';
|
|
267
267
|
}
|
|
@@ -299,8 +299,8 @@ const DatePicker = props__ => {
|
|
|
299
299
|
|
|
300
300
|
// Calendar
|
|
301
301
|
_react.default.useEffect(() => {
|
|
302
|
-
if (
|
|
303
|
-
}, [
|
|
302
|
+
if (calendarProps !== undefined && calendarProps !== calendar) setCalendar(calendarProps);
|
|
303
|
+
}, [calendarProps]);
|
|
304
304
|
const onUpdate = (valueNew_3, triggerOnChange = true) => {
|
|
305
305
|
// Inner update
|
|
306
306
|
if (!props.hasOwnProperty('value') || !triggerOnChange) setValue(valueNew_3);
|
|
@@ -319,7 +319,7 @@ const DatePicker = props__ => {
|
|
|
319
319
|
const onCalendarChange = valueNew__0 => {
|
|
320
320
|
const valueNew_5 = onResolveValue(valueNew__0);
|
|
321
321
|
if (valueNew_5 !== value) {
|
|
322
|
-
(!
|
|
322
|
+
(!actionsProps ? onUpdate : setValue)(valueNew_5);
|
|
323
323
|
|
|
324
324
|
// Update input modal
|
|
325
325
|
setInputModal(valueToInput(valueNew_5));
|
|
@@ -342,7 +342,7 @@ const DatePicker = props__ => {
|
|
|
342
342
|
};
|
|
343
343
|
const onClose = event => {
|
|
344
344
|
setOpen(false);
|
|
345
|
-
if ((0, _utils.is)('function',
|
|
345
|
+
if ((0, _utils.is)('function', onCloseProps)) onCloseProps(event);
|
|
346
346
|
};
|
|
347
347
|
const onReset = () => {
|
|
348
348
|
var _valueNew_;
|
|
@@ -390,7 +390,7 @@ const DatePicker = props__ => {
|
|
|
390
390
|
// Update input modal
|
|
391
391
|
setInputModal(valueToInput(valueNew_9));
|
|
392
392
|
onClose(event_0);
|
|
393
|
-
if ((0, _utils.is)('function',
|
|
393
|
+
if ((0, _utils.is)('function', onTodayProps)) onTodayProps(event_0);
|
|
394
394
|
};
|
|
395
395
|
const onClear = event_1 => {
|
|
396
396
|
const dateNow_1 = new _date.OnesyDate();
|
|
@@ -408,7 +408,7 @@ const DatePicker = props__ => {
|
|
|
408
408
|
// Update input modal
|
|
409
409
|
setInputModal(valueToInput(valueNew_10));
|
|
410
410
|
onClose(event_1);
|
|
411
|
-
if ((0, _utils.is)('function',
|
|
411
|
+
if ((0, _utils.is)('function', onClearProps)) onClearProps(event_1);
|
|
412
412
|
};
|
|
413
413
|
const onOk = event_2 => {
|
|
414
414
|
// Error
|
|
@@ -423,15 +423,15 @@ const DatePicker = props__ => {
|
|
|
423
423
|
// Update input modal
|
|
424
424
|
setInputModal(valueToInput(value));
|
|
425
425
|
onClose(event_2);
|
|
426
|
-
if ((0, _utils.is)('function',
|
|
426
|
+
if ((0, _utils.is)('function', onOkProps)) onOkProps(event_2);
|
|
427
427
|
};
|
|
428
428
|
const onCancel = event_3 => {
|
|
429
429
|
onReset();
|
|
430
430
|
onClose(event_3);
|
|
431
|
-
if ((0, _utils.is)('function',
|
|
431
|
+
if ((0, _utils.is)('function', onCancelProps)) onCancelProps(event_3);
|
|
432
432
|
};
|
|
433
433
|
const valid = (...args) => {
|
|
434
|
-
if ((0, _utils.is)('function',
|
|
434
|
+
if ((0, _utils.is)('function', validProps)) return validProps(...args);
|
|
435
435
|
const onesyDate = args[0];
|
|
436
436
|
if (min || max || validate) {
|
|
437
437
|
let response = true;
|
|
@@ -513,7 +513,7 @@ const DatePicker = props__ => {
|
|
|
513
513
|
mask.push(' ', SEPARATOR_SYMBOL, ' ', ...mask);
|
|
514
514
|
placeholder += `${SEPARATOR}${placeholder}`;
|
|
515
515
|
}
|
|
516
|
-
placeholder =
|
|
516
|
+
placeholder = placeholderProps || placeholder;
|
|
517
517
|
const buttonProps = _objectSpread({
|
|
518
518
|
color: 'inherit',
|
|
519
519
|
version: 'text',
|
|
@@ -602,7 +602,7 @@ const DatePicker = props__ => {
|
|
|
602
602
|
gap: 0,
|
|
603
603
|
direction: "column",
|
|
604
604
|
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('DatePicker', theme) && ['onesy-DatePicker-header'], classes.header, fullScreen && classes.header_fullScreen]),
|
|
605
|
-
children: [
|
|
605
|
+
children: [actionsProps && fullScreen && /*#__PURE__*/(0, _jsxRuntime.jsxs)(Line, {
|
|
606
606
|
gap: 0,
|
|
607
607
|
direction: "row",
|
|
608
608
|
align: "center",
|
|
@@ -624,7 +624,7 @@ const DatePicker = props__ => {
|
|
|
624
624
|
}, buttonProps), {}, {
|
|
625
625
|
children: l('Save')
|
|
626
626
|
}))]
|
|
627
|
-
}),
|
|
627
|
+
}), headingProps && /*#__PURE__*/(0, _jsxRuntime.jsx)(Type, {
|
|
628
628
|
version: "l2",
|
|
629
629
|
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('DatePicker', theme) && ['onesy-DatePicker-subheading'], classes.subheading, fullScreen && classes.subheading_fullScreen]),
|
|
630
630
|
children: !range ? modeModalSubHeadingText : modeModalSubHeadingTextRange
|
|
@@ -735,7 +735,7 @@ const DatePicker = props__ => {
|
|
|
735
735
|
}), fullScreen && /*#__PURE__*/(0, _jsxRuntime.jsx)(Divider, {
|
|
736
736
|
tonal: false,
|
|
737
737
|
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('DatePicker', theme) && ['onesy-DatePicker-divider'], classes.divider])
|
|
738
|
-
}),
|
|
738
|
+
}), actionsProps && /*#__PURE__*/_react.default.cloneElement(actions, {
|
|
739
739
|
style: {
|
|
740
740
|
paddingTop: theme.methods.space.value(1, 'px')
|
|
741
741
|
}
|
|
@@ -756,11 +756,11 @@ const DatePicker = props__ => {
|
|
|
756
756
|
min: min,
|
|
757
757
|
max: max,
|
|
758
758
|
validate: validate,
|
|
759
|
-
belowCalendars:
|
|
759
|
+
belowCalendars: actionsProps ? actions : undefined
|
|
760
760
|
}, CalendarProps), CalendarPropsDesktop), {}, {
|
|
761
761
|
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('DatePicker', theme) && ['onesy-DatePicker-calendar', 'onesy-DatePicker-version-desktop'], CalendarProps === null || CalendarProps === void 0 ? void 0 : CalendarProps.className, CalendarPropsDesktop === null || CalendarPropsDesktop === void 0 ? void 0 : CalendarPropsDesktop.className, classes.calendar, classes.calendar_desktop])
|
|
762
762
|
}));
|
|
763
|
-
if (
|
|
763
|
+
if (staticProps) {
|
|
764
764
|
if (version === 'mobile') return mobile;
|
|
765
765
|
if (version === 'desktop') return desktop;
|
|
766
766
|
}
|
|
@@ -77,14 +77,14 @@ const DateTimePicker = props__ => {
|
|
|
77
77
|
ref,
|
|
78
78
|
tonal,
|
|
79
79
|
color = 'primary',
|
|
80
|
-
version:
|
|
81
|
-
value:
|
|
80
|
+
version: versionProps = 'auto',
|
|
81
|
+
value: valueProps,
|
|
82
82
|
valueDefault,
|
|
83
83
|
onChange,
|
|
84
84
|
label,
|
|
85
85
|
range,
|
|
86
86
|
now,
|
|
87
|
-
static:
|
|
87
|
+
static: staticProps,
|
|
88
88
|
min,
|
|
89
89
|
max,
|
|
90
90
|
validate,
|
|
@@ -93,7 +93,7 @@ const DateTimePicker = props__ => {
|
|
|
93
93
|
headingTextTimeRange,
|
|
94
94
|
headingTextDate,
|
|
95
95
|
headingTextDateRange,
|
|
96
|
-
useHelperText:
|
|
96
|
+
useHelperText: useHelperTextProps,
|
|
97
97
|
format = '12',
|
|
98
98
|
hour = true,
|
|
99
99
|
minute = true,
|
|
@@ -101,16 +101,16 @@ const DateTimePicker = props__ => {
|
|
|
101
101
|
today,
|
|
102
102
|
clear = true,
|
|
103
103
|
size,
|
|
104
|
-
placeholder:
|
|
104
|
+
placeholder: placeholderProps,
|
|
105
105
|
fullWidth,
|
|
106
106
|
readOnly,
|
|
107
107
|
disabled,
|
|
108
|
-
valid:
|
|
109
|
-
onClose:
|
|
110
|
-
onToday:
|
|
111
|
-
onClear:
|
|
112
|
-
onCancel:
|
|
113
|
-
onOk:
|
|
108
|
+
valid: validProps,
|
|
109
|
+
onClose: onCloseProps,
|
|
110
|
+
onToday: onTodayProps,
|
|
111
|
+
onClear: onClearProps,
|
|
112
|
+
onCancel: onCancelProps,
|
|
113
|
+
onOk: onOkProps,
|
|
114
114
|
Icon: Icon_ = _IconMaterialDateRangeW100Filled.default,
|
|
115
115
|
IconDate = _IconMaterialCalendarTodayW100Filled.default,
|
|
116
116
|
IconTime = _IconMaterialScheduleW.default,
|
|
@@ -124,7 +124,7 @@ const DateTimePicker = props__ => {
|
|
|
124
124
|
ModeDesktopProps,
|
|
125
125
|
ModeMobileProps,
|
|
126
126
|
ButtonProps,
|
|
127
|
-
PickerProps:
|
|
127
|
+
PickerProps: PickerPropsProps,
|
|
128
128
|
MiddleProps,
|
|
129
129
|
MainProps,
|
|
130
130
|
IconProps,
|
|
@@ -140,19 +140,19 @@ const DateTimePicker = props__ => {
|
|
|
140
140
|
};
|
|
141
141
|
const keys = _react.default.useMemo(() => {
|
|
142
142
|
const result = [];
|
|
143
|
-
const items = [
|
|
143
|
+
const items = [useHelperTextProps];
|
|
144
144
|
items.forEach(item => {
|
|
145
145
|
if ((0, _utils.is)('object', item)) Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key_0 => result.push(key_0));
|
|
146
146
|
});
|
|
147
147
|
return (0, _utils.unique)(result);
|
|
148
|
-
}, [
|
|
148
|
+
}, [useHelperTextProps]);
|
|
149
149
|
const breakpoints = {};
|
|
150
150
|
keys.forEach(key_1 => {
|
|
151
151
|
breakpoints[key_1] = (0, _useMediaQuery.default)(theme.breakpoints.media[key_1], {
|
|
152
152
|
element: refs.root.current
|
|
153
153
|
});
|
|
154
154
|
});
|
|
155
|
-
const useHelperText = (0, _utils2.valueBreakpoints)(
|
|
155
|
+
const useHelperText = (0, _utils2.valueBreakpoints)(useHelperTextProps, undefined, breakpoints, theme);
|
|
156
156
|
const touch = (0, _useMediaQuery.default)('(pointer: coarse)', {
|
|
157
157
|
element: refs.root.current
|
|
158
158
|
});
|
|
@@ -162,7 +162,7 @@ const DateTimePicker = props__ => {
|
|
|
162
162
|
return sorted;
|
|
163
163
|
};
|
|
164
164
|
const [value, setValue] = _react.default.useState(() => {
|
|
165
|
-
const valueResult = (valueDefault !== undefined ? valueDefault :
|
|
165
|
+
const valueResult = (valueDefault !== undefined ? valueDefault : valueProps) || now && (range ? [new _date.OnesyDate(), new _date.OnesyDate()] : [new _date.OnesyDate()]);
|
|
166
166
|
return onResolveValue(valueResult);
|
|
167
167
|
});
|
|
168
168
|
const [calendar, setCalendar] = _react.default.useState(value[0]);
|
|
@@ -194,7 +194,7 @@ const DateTimePicker = props__ => {
|
|
|
194
194
|
return result_0;
|
|
195
195
|
};
|
|
196
196
|
const [input, setInput] = _react.default.useState(valueToInput());
|
|
197
|
-
let version =
|
|
197
|
+
let version = versionProps;
|
|
198
198
|
if (version === 'auto') {
|
|
199
199
|
if (touch) version = 'mobile';else version = 'desktop';
|
|
200
200
|
}
|
|
@@ -218,8 +218,8 @@ const DateTimePicker = props__ => {
|
|
|
218
218
|
|
|
219
219
|
// Value
|
|
220
220
|
_react.default.useEffect(() => {
|
|
221
|
-
if (
|
|
222
|
-
}, [
|
|
221
|
+
if (valueProps !== undefined && valueProps !== value) onUpdateValue(valueProps);
|
|
222
|
+
}, [valueProps]);
|
|
223
223
|
const onUpdate = (valueNew_3, triggerOnChange = true) => {
|
|
224
224
|
// Inner update
|
|
225
225
|
if (!props.hasOwnProperty('value') || !triggerOnChange) setValue(valueNew_3);
|
|
@@ -327,7 +327,7 @@ const DateTimePicker = props__ => {
|
|
|
327
327
|
// Update input
|
|
328
328
|
setInput(valueToInput(valueNew_10));
|
|
329
329
|
onClose(event);
|
|
330
|
-
if ((0, _utils.is)('function',
|
|
330
|
+
if ((0, _utils.is)('function', onTodayProps)) onTodayProps(event);
|
|
331
331
|
};
|
|
332
332
|
const onClear = event_0 => {
|
|
333
333
|
const valueNew_11 = [];
|
|
@@ -338,7 +338,7 @@ const DateTimePicker = props__ => {
|
|
|
338
338
|
// Update input
|
|
339
339
|
setInput(valueToInput(valueNew_11));
|
|
340
340
|
onClose(event_0);
|
|
341
|
-
if ((0, _utils.is)('function',
|
|
341
|
+
if ((0, _utils.is)('function', onClearProps)) onClearProps(event_0);
|
|
342
342
|
};
|
|
343
343
|
const onOk = event_1 => {
|
|
344
344
|
// Error
|
|
@@ -350,22 +350,22 @@ const DateTimePicker = props__ => {
|
|
|
350
350
|
// Update input
|
|
351
351
|
setInput(valueToInput(value));
|
|
352
352
|
onClose(event_1);
|
|
353
|
-
if ((0, _utils.is)('function',
|
|
353
|
+
if ((0, _utils.is)('function', onOkProps)) onOkProps(event_1);
|
|
354
354
|
};
|
|
355
355
|
const onCancel = event_2 => {
|
|
356
356
|
onReset();
|
|
357
357
|
onClose(event_2);
|
|
358
|
-
if ((0, _utils.is)('function',
|
|
358
|
+
if ((0, _utils.is)('function', onCancelProps)) onCancelProps(event_2);
|
|
359
359
|
};
|
|
360
360
|
const onOpen = () => {
|
|
361
361
|
setOpen(previous_0 => !previous_0);
|
|
362
362
|
};
|
|
363
363
|
const onClose = event_3 => {
|
|
364
364
|
setOpen(false);
|
|
365
|
-
if ((0, _utils.is)('function',
|
|
365
|
+
if ((0, _utils.is)('function', onCloseProps)) onCloseProps(event_3);
|
|
366
366
|
};
|
|
367
367
|
const valid = (...args) => {
|
|
368
|
-
if ((0, _utils.is)('function',
|
|
368
|
+
if ((0, _utils.is)('function', validProps)) return validProps(...args);
|
|
369
369
|
const onesyDate_0 = args[0];
|
|
370
370
|
if (min || max || validate) {
|
|
371
371
|
let response = true;
|
|
@@ -505,7 +505,7 @@ const DateTimePicker = props__ => {
|
|
|
505
505
|
}
|
|
506
506
|
placeholder += `${_DatePicker2.SEPARATOR}${placeholder}`;
|
|
507
507
|
}
|
|
508
|
-
placeholder =
|
|
508
|
+
placeholder = placeholderProps || placeholder;
|
|
509
509
|
const buttonProps = _objectSpread({
|
|
510
510
|
tonal,
|
|
511
511
|
color,
|
|
@@ -580,7 +580,7 @@ const DateTimePicker = props__ => {
|
|
|
580
580
|
heading: false,
|
|
581
581
|
readOnly,
|
|
582
582
|
disabled
|
|
583
|
-
},
|
|
583
|
+
}, PickerPropsProps), tab === 'date' && DatePickerProps), tab === 'time' && TimePickerProps);
|
|
584
584
|
const element = /*#__PURE__*/(0, _jsxRuntime.jsxs)(Surface, {
|
|
585
585
|
gap: 0,
|
|
586
586
|
direction: "column",
|
|
@@ -623,7 +623,7 @@ const DateTimePicker = props__ => {
|
|
|
623
623
|
if (version === 'mobile') {
|
|
624
624
|
if (!(readOnly || disabled)) moreProps.onClick = onOpen;
|
|
625
625
|
}
|
|
626
|
-
if (
|
|
626
|
+
if (staticProps) return element;
|
|
627
627
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Line, _objectSpread(_objectSpread({
|
|
628
628
|
gap: 0,
|
|
629
629
|
direction: "column",
|
package/TimePicker/TimePicker.js
CHANGED
|
@@ -238,11 +238,11 @@ const TimePicker = props__ => {
|
|
|
238
238
|
ref,
|
|
239
239
|
tonal,
|
|
240
240
|
color = 'primary',
|
|
241
|
-
version:
|
|
242
|
-
value:
|
|
241
|
+
version: versionProps = 'auto',
|
|
242
|
+
value: valueProps,
|
|
243
243
|
valueDefault,
|
|
244
244
|
onChange,
|
|
245
|
-
selecting:
|
|
245
|
+
selecting: selectingProps,
|
|
246
246
|
selectingDefault,
|
|
247
247
|
onChangeSelecting,
|
|
248
248
|
size = 'regular',
|
|
@@ -252,37 +252,37 @@ const TimePicker = props__ => {
|
|
|
252
252
|
min,
|
|
253
253
|
max,
|
|
254
254
|
validate,
|
|
255
|
-
autoNext:
|
|
256
|
-
autoCloseOnLast:
|
|
255
|
+
autoNext: autoNextProps,
|
|
256
|
+
autoCloseOnLast: autoCloseOnLastProps,
|
|
257
257
|
openMobile = 'select',
|
|
258
258
|
openDesktop = 'select',
|
|
259
259
|
selectModalSubHeadingText = l('Select time'),
|
|
260
260
|
selectModalSubHeadingTextRange = `${l('Select from')}${_DatePicker.SEPARATOR}${l('to time')}`,
|
|
261
261
|
inputModalSubHeadingText = l('Enter time'),
|
|
262
262
|
inputModalSubHeadingTextRange = `${l('Enter from')}${_DatePicker.SEPARATOR}${l('to time')}`,
|
|
263
|
-
orientation:
|
|
263
|
+
orientation: orientationProps,
|
|
264
264
|
format = '12',
|
|
265
265
|
hour = true,
|
|
266
266
|
minute = true,
|
|
267
267
|
second = false,
|
|
268
|
-
switch:
|
|
269
|
-
static:
|
|
268
|
+
switch: switchProps,
|
|
269
|
+
static: staticProps,
|
|
270
270
|
today,
|
|
271
271
|
clear = true,
|
|
272
|
-
placeholder:
|
|
273
|
-
heading:
|
|
274
|
-
actions:
|
|
272
|
+
placeholder: placeholderProps,
|
|
273
|
+
heading: headingProps = true,
|
|
274
|
+
actions: actionsProps = true,
|
|
275
275
|
fullWidth,
|
|
276
276
|
readOnly,
|
|
277
277
|
disabled,
|
|
278
|
-
valid:
|
|
279
|
-
onClick:
|
|
280
|
-
onClose:
|
|
281
|
-
onCancel:
|
|
282
|
-
onNow:
|
|
283
|
-
onToday:
|
|
284
|
-
onClear:
|
|
285
|
-
onOk:
|
|
278
|
+
valid: validProps,
|
|
279
|
+
onClick: onClickProps,
|
|
280
|
+
onClose: onCloseProps,
|
|
281
|
+
onCancel: onCancelProps,
|
|
282
|
+
onNow: onNowProps,
|
|
283
|
+
onToday: onTodayProps,
|
|
284
|
+
onClear: onClearProps,
|
|
285
|
+
onOk: onOkProps,
|
|
286
286
|
renderValue,
|
|
287
287
|
Icon: Icon_ = _IconMaterialScheduleW.default,
|
|
288
288
|
IconEnter = _IconMaterialKeyboardAltW.default,
|
|
@@ -316,22 +316,22 @@ const TimePicker = props__ => {
|
|
|
316
316
|
};
|
|
317
317
|
const keys = _react.default.useMemo(() => {
|
|
318
318
|
const result = [];
|
|
319
|
-
const items = [
|
|
319
|
+
const items = [switchProps, orientationProps, autoNextProps, autoCloseOnLastProps];
|
|
320
320
|
items.forEach(item => {
|
|
321
321
|
if ((0, _utils.is)('object', item)) Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key_0 => result.push(key_0));
|
|
322
322
|
});
|
|
323
323
|
return (0, _utils.unique)(result);
|
|
324
|
-
}, [
|
|
324
|
+
}, [switchProps, orientationProps, autoNextProps, autoCloseOnLastProps]);
|
|
325
325
|
const breakpoints = {};
|
|
326
326
|
keys.forEach(key_1 => {
|
|
327
327
|
breakpoints[key_1] = (0, _useMediaQuery.default)(theme.breakpoints.media[key_1], {
|
|
328
328
|
element: refs.root.current
|
|
329
329
|
});
|
|
330
330
|
});
|
|
331
|
-
const switch_ = (0, _utils2.valueBreakpoints)(
|
|
332
|
-
const orientation = (0, _utils2.valueBreakpoints)(
|
|
333
|
-
const autoNext = (0, _utils2.valueBreakpoints)(
|
|
334
|
-
const autoCloseOnLast = (0, _utils2.valueBreakpoints)(
|
|
331
|
+
const switch_ = (0, _utils2.valueBreakpoints)(switchProps, true, breakpoints, theme);
|
|
332
|
+
const orientation = (0, _utils2.valueBreakpoints)(orientationProps, 'vertical', breakpoints, theme);
|
|
333
|
+
const autoNext = (0, _utils2.valueBreakpoints)(autoNextProps, undefined, breakpoints, theme);
|
|
334
|
+
const autoCloseOnLast = (0, _utils2.valueBreakpoints)(autoCloseOnLastProps, undefined, breakpoints, theme);
|
|
335
335
|
const touch = (0, _useMediaQuery.default)('(pointer: coarse)', {
|
|
336
336
|
element: refs.root.current
|
|
337
337
|
});
|
|
@@ -341,11 +341,11 @@ const TimePicker = props__ => {
|
|
|
341
341
|
return sorted;
|
|
342
342
|
};
|
|
343
343
|
const [value, setValue] = _react.default.useState(() => {
|
|
344
|
-
const valueResult = (valueDefault !== undefined ? valueDefault :
|
|
344
|
+
const valueResult = (valueDefault !== undefined ? valueDefault : valueProps) || now && (range ? [new _date.OnesyDate(), new _date.OnesyDate()] : [new _date.OnesyDate()]);
|
|
345
345
|
return onResolveValue(valueResult);
|
|
346
346
|
});
|
|
347
347
|
const [selecting, setSelecting] = _react.default.useState(() => {
|
|
348
|
-
const valueResult_0 = (selectingDefault !== undefined ? selectingDefault :
|
|
348
|
+
const valueResult_0 = (selectingDefault !== undefined ? selectingDefault : selectingProps) || ['hour', 'hour'];
|
|
349
349
|
return ((0, _utils.is)('array', valueResult_0) ? valueResult_0 : [valueResult_0]).filter(Boolean);
|
|
350
350
|
});
|
|
351
351
|
const [open, setOpen] = _react.default.useState(false);
|
|
@@ -375,7 +375,7 @@ const TimePicker = props__ => {
|
|
|
375
375
|
return result_0;
|
|
376
376
|
};
|
|
377
377
|
const [input, setInput] = _react.default.useState(valueToInput());
|
|
378
|
-
let version =
|
|
378
|
+
let version = versionProps;
|
|
379
379
|
if (version === 'auto') {
|
|
380
380
|
if (touch) version = 'mobile';else version = 'desktop';
|
|
381
381
|
}
|
|
@@ -404,8 +404,8 @@ const TimePicker = props__ => {
|
|
|
404
404
|
|
|
405
405
|
// Value
|
|
406
406
|
_react.default.useEffect(() => {
|
|
407
|
-
if (
|
|
408
|
-
}, [
|
|
407
|
+
if (valueProps !== undefined && valueProps !== value) onUpdateValue(valueProps);
|
|
408
|
+
}, [valueProps]);
|
|
409
409
|
const onUpdate = (valueNew__0, triggerOnChange = true) => {
|
|
410
410
|
const valueNew_3 = resolve(valueNew__0);
|
|
411
411
|
|
|
@@ -422,7 +422,7 @@ const TimePicker = props__ => {
|
|
|
422
422
|
if ((0, _utils.is)('function', onChangeSelecting)) onChangeSelecting(valueNew_4);
|
|
423
423
|
};
|
|
424
424
|
const valid = (...args) => {
|
|
425
|
-
if ((0, _utils.is)('function',
|
|
425
|
+
if ((0, _utils.is)('function', validProps)) return validProps(...args);
|
|
426
426
|
const onesyDate = args[0];
|
|
427
427
|
if (min || max || validate) {
|
|
428
428
|
let response = true;
|
|
@@ -463,7 +463,7 @@ const TimePicker = props__ => {
|
|
|
463
463
|
if ((0, _utils.is)('string', valueTime_0) && valueTime_0.startsWith('0')) valueTime_0 = valueTime_0.slice(1);
|
|
464
464
|
valueTime_0 = +valueTime_0;
|
|
465
465
|
value[index_1] = (0, _date.set)(valueTime_0, unit || selecting[index_1], value[index_1]);
|
|
466
|
-
(!
|
|
466
|
+
(!actionsProps ? onUpdate : setValue)(resolve(value));
|
|
467
467
|
};
|
|
468
468
|
const resolve = (valueNew_7 = refs.value.current, dayTimeNew = refs.dayTime.current) => {
|
|
469
469
|
const values_0 = onResolveValue(valueNew_7).map((item_4, index_2) => {
|
|
@@ -485,7 +485,7 @@ const TimePicker = props__ => {
|
|
|
485
485
|
dayTimeNew_0[index_3] = valueNew_8;
|
|
486
486
|
refs.dayTime.current = dayTimeNew_0;
|
|
487
487
|
setDayTime(dayTimeNew_0);
|
|
488
|
-
(!
|
|
488
|
+
(!actionsProps ? onUpdate : setValue)(resolve(refs.value.current));
|
|
489
489
|
};
|
|
490
490
|
const inputToValue = (valueNew__3 = input) => {
|
|
491
491
|
let valueNew_9 = valueNew__3;
|
|
@@ -519,7 +519,7 @@ const TimePicker = props__ => {
|
|
|
519
519
|
const valueNew_11 = [...value];
|
|
520
520
|
if (valueNew__5 !== value[index_4]) {
|
|
521
521
|
valueNew_11[index_4] = valueNew__5;
|
|
522
|
-
(!
|
|
522
|
+
(!actionsProps ? onUpdate : setValue)(resolve(valueNew_11));
|
|
523
523
|
|
|
524
524
|
// Error
|
|
525
525
|
errorCheck(valueNew_11);
|
|
@@ -550,7 +550,7 @@ const TimePicker = props__ => {
|
|
|
550
550
|
};
|
|
551
551
|
const onClose = event => {
|
|
552
552
|
setOpen(false);
|
|
553
|
-
if ((0, _utils.is)('function',
|
|
553
|
+
if ((0, _utils.is)('function', onCloseProps)) onCloseProps(event);
|
|
554
554
|
};
|
|
555
555
|
const onReset = () => {
|
|
556
556
|
const valueNew_14 = inputToValue();
|
|
@@ -574,7 +574,7 @@ const TimePicker = props__ => {
|
|
|
574
574
|
// Update dayTime
|
|
575
575
|
setDayTime(valueNew_15.map(item_8 => (0, _date.format)(item_8, 'a')));
|
|
576
576
|
onClose(event_0);
|
|
577
|
-
if ((0, _utils.is)('function',
|
|
577
|
+
if ((0, _utils.is)('function', onTodayProps)) onTodayProps(event_0);
|
|
578
578
|
};
|
|
579
579
|
const onClear = event_1 => {
|
|
580
580
|
const valueNew_16 = [];
|
|
@@ -588,7 +588,7 @@ const TimePicker = props__ => {
|
|
|
588
588
|
// Update dayTime
|
|
589
589
|
setDayTime(valueNew_16.map(item_9 => (0, _date.format)(item_9, 'a')));
|
|
590
590
|
onClose(event_1);
|
|
591
|
-
if ((0, _utils.is)('function',
|
|
591
|
+
if ((0, _utils.is)('function', onClearProps)) onClearProps(event_1);
|
|
592
592
|
};
|
|
593
593
|
const onOk = event_2 => {
|
|
594
594
|
// Error
|
|
@@ -603,12 +603,12 @@ const TimePicker = props__ => {
|
|
|
603
603
|
// Update dayTime
|
|
604
604
|
setDayTime(refs.value.current.map(item_10 => (0, _date.format)(item_10, 'a')));
|
|
605
605
|
onClose(event_2);
|
|
606
|
-
if ((0, _utils.is)('function',
|
|
606
|
+
if ((0, _utils.is)('function', onOkProps)) onOkProps(event_2);
|
|
607
607
|
};
|
|
608
608
|
const onCancel = event_3 => {
|
|
609
609
|
onReset();
|
|
610
610
|
onClose(event_3);
|
|
611
|
-
if ((0, _utils.is)('function',
|
|
611
|
+
if ((0, _utils.is)('function', onCancelProps)) onCancelProps(event_3);
|
|
612
612
|
};
|
|
613
613
|
const mask = [];
|
|
614
614
|
let placeholder = '';
|
|
@@ -661,7 +661,7 @@ const TimePicker = props__ => {
|
|
|
661
661
|
mask.push(' ', _DatePicker.SEPARATOR_SYMBOL, ' ', ...mask);
|
|
662
662
|
placeholder += `${_DatePicker.SEPARATOR}${placeholder}`;
|
|
663
663
|
}
|
|
664
|
-
placeholder =
|
|
664
|
+
placeholder = placeholderProps || placeholder;
|
|
665
665
|
const buttonProps = _objectSpread({
|
|
666
666
|
color: 'inherit',
|
|
667
667
|
version: 'text',
|
|
@@ -915,7 +915,7 @@ const TimePicker = props__ => {
|
|
|
915
915
|
Component: Line
|
|
916
916
|
}, MainProps), {}, {
|
|
917
917
|
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TimePicker', theme) && ['onesy-TimePicker-main'], MainProps === null || MainProps === void 0 ? void 0 : MainProps.className, classes.main, classes[`main_size_${size}`]]),
|
|
918
|
-
children: [
|
|
918
|
+
children: [headingProps && /*#__PURE__*/(0, _jsxRuntime.jsx)(Type, {
|
|
919
919
|
version: size === 'large' ? 'l1' : size === 'regular' ? 'l2' : 'l3',
|
|
920
920
|
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TimePicker', theme) && ['onesy-TimePicker-heading'], classes.heading, classes[`heading_size_${size}`]]),
|
|
921
921
|
children: heading
|
|
@@ -926,7 +926,7 @@ const TimePicker = props__ => {
|
|
|
926
926
|
valueDefault: tab,
|
|
927
927
|
onChange: setTab
|
|
928
928
|
}, TabsProps), {}, {
|
|
929
|
-
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TimePicker', theme) && ['onesy-TimePicker-tabs'], TabsProps === null || TabsProps === void 0 ? void 0 : TabsProps.className, classes.tabs,
|
|
929
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TimePicker', theme) && ['onesy-TimePicker-tabs'], TabsProps === null || TabsProps === void 0 ? void 0 : TabsProps.className, classes.tabs, headingProps && classes.tabs_padding]),
|
|
930
930
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Tab, _objectSpread({
|
|
931
931
|
value: 0,
|
|
932
932
|
name: l('From')
|
|
@@ -938,12 +938,12 @@ const TimePicker = props__ => {
|
|
|
938
938
|
gap: 0,
|
|
939
939
|
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TimePicker', theme) && ['onesy-TimePicker-middle'], MiddleProps === null || MiddleProps === void 0 ? void 0 : MiddleProps.className, classes.middle, classes[`middle_size_${size}`]]),
|
|
940
940
|
children: elementValues[tab]
|
|
941
|
-
}),
|
|
941
|
+
}), actionsProps && actions]
|
|
942
942
|
}));
|
|
943
943
|
if (version === 'mobile') {
|
|
944
944
|
if (!(readOnly || disabled)) moreProps.onClick = onOpen;
|
|
945
945
|
}
|
|
946
|
-
if (
|
|
946
|
+
if (staticProps) return element;
|
|
947
947
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Line, _objectSpread(_objectSpread({
|
|
948
948
|
gap: 0,
|
|
949
949
|
direction: "column",
|
|
@@ -135,19 +135,19 @@ const DatePicker = props__ => {
|
|
|
135
135
|
ref,
|
|
136
136
|
tonal,
|
|
137
137
|
color = 'primary',
|
|
138
|
-
version:
|
|
138
|
+
version: versionProps = 'auto',
|
|
139
139
|
size = 'regular',
|
|
140
140
|
value: valueProps,
|
|
141
141
|
valueDefault,
|
|
142
142
|
onChange,
|
|
143
|
-
calendar:
|
|
143
|
+
calendar: calendarProps,
|
|
144
144
|
calendarDefault,
|
|
145
145
|
onChangeCalendar,
|
|
146
146
|
range,
|
|
147
147
|
now,
|
|
148
|
-
static:
|
|
148
|
+
static: staticProps,
|
|
149
149
|
openMobile = 'select',
|
|
150
|
-
placeholder:
|
|
150
|
+
placeholder: placeholderProps,
|
|
151
151
|
calendars = props.range ? 2 : 1,
|
|
152
152
|
min,
|
|
153
153
|
max,
|
|
@@ -155,31 +155,31 @@ const DatePicker = props__ => {
|
|
|
155
155
|
name,
|
|
156
156
|
nameFrom,
|
|
157
157
|
nameTo,
|
|
158
|
-
label:
|
|
159
|
-
labelFrom:
|
|
160
|
-
labelTo:
|
|
158
|
+
label: labelProps,
|
|
159
|
+
labelFrom: labelFromProps = l('Date from'),
|
|
160
|
+
labelTo: labelToProps = l('Date to'),
|
|
161
161
|
modeModalSubHeadingText = l('Select date'),
|
|
162
162
|
modeModalSubHeadingTextRange = `${l('Date from')}${SEPARATOR}${l('Date to')}`,
|
|
163
163
|
selectModeHeadingText = l('Select date'),
|
|
164
164
|
inputModeHeadingText = l('Enter date'),
|
|
165
|
-
useHelperText:
|
|
165
|
+
useHelperText: useHelperTextProps,
|
|
166
166
|
weekStartDay = 'Monday',
|
|
167
|
-
switch:
|
|
167
|
+
switch: switchProps,
|
|
168
168
|
fullScreen,
|
|
169
169
|
today,
|
|
170
170
|
clear = true,
|
|
171
|
-
heading:
|
|
172
|
-
actions:
|
|
171
|
+
heading: headingProps = true,
|
|
172
|
+
actions: actionsProps = true,
|
|
173
173
|
fullWidth,
|
|
174
174
|
readOnly,
|
|
175
175
|
disabled,
|
|
176
|
-
valid:
|
|
177
|
-
onClick:
|
|
178
|
-
onClose:
|
|
179
|
-
onToday:
|
|
180
|
-
onClear:
|
|
181
|
-
onCancel:
|
|
182
|
-
onOk:
|
|
176
|
+
valid: validProps,
|
|
177
|
+
onClick: onClickProps,
|
|
178
|
+
onClose: onCloseProps,
|
|
179
|
+
onToday: onTodayProps,
|
|
180
|
+
onClear: onClearProps,
|
|
181
|
+
onCancel: onCancelProps,
|
|
182
|
+
onOk: onOkProps,
|
|
183
183
|
Icon: Icon_ = IconMaterialCalendarToday,
|
|
184
184
|
IconEnter = IconMaterialEdit,
|
|
185
185
|
IconClose = IconMaterialClose,
|
|
@@ -205,21 +205,21 @@ const DatePicker = props__ => {
|
|
|
205
205
|
};
|
|
206
206
|
const keys = React.useMemo(() => {
|
|
207
207
|
const result = [];
|
|
208
|
-
const items = [
|
|
208
|
+
const items = [switchProps, useHelperTextProps];
|
|
209
209
|
items.forEach(item => {
|
|
210
210
|
if (is('object', item)) Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key_0 => result.push(key_0));
|
|
211
211
|
});
|
|
212
212
|
return unique(result);
|
|
213
|
-
}, [
|
|
213
|
+
}, [switchProps, useHelperTextProps]);
|
|
214
214
|
const breakpoints = {};
|
|
215
215
|
keys.forEach(key_1 => {
|
|
216
216
|
breakpoints[key_1] = useMediaQuery(theme.breakpoints.media[key_1], {
|
|
217
217
|
element: refs.root.current
|
|
218
218
|
});
|
|
219
219
|
});
|
|
220
|
-
const label = name !== undefined ? name :
|
|
221
|
-
const switch_ = valueBreakpoints(
|
|
222
|
-
const useHelperText = valueBreakpoints(
|
|
220
|
+
const label = name !== undefined ? name : labelProps;
|
|
221
|
+
const switch_ = valueBreakpoints(switchProps, true, breakpoints, theme);
|
|
222
|
+
const useHelperText = valueBreakpoints(useHelperTextProps, undefined, breakpoints, theme);
|
|
223
223
|
const touch = useMediaQuery('(pointer: coarse)', {
|
|
224
224
|
element: refs.root.current
|
|
225
225
|
});
|
|
@@ -232,7 +232,7 @@ const DatePicker = props__ => {
|
|
|
232
232
|
const valueResult = (valueDefault !== undefined ? valueDefault : valueProps) || now && (range ? [new OnesyDate(), new OnesyDate()] : [new OnesyDate()]);
|
|
233
233
|
return onResolveValue(valueResult);
|
|
234
234
|
});
|
|
235
|
-
const [calendar, setCalendar] = React.useState((calendarDefault !== undefined ? calendarDefault :
|
|
235
|
+
const [calendar, setCalendar] = React.useState((calendarDefault !== undefined ? calendarDefault : calendarProps) || new OnesyDate());
|
|
236
236
|
const [open, setOpen] = React.useState(false);
|
|
237
237
|
const [mode, setMode] = React.useState((touch ? openMobile : 'select') || 'select');
|
|
238
238
|
const [error, setError] = React.useState(false);
|
|
@@ -253,7 +253,7 @@ const DatePicker = props__ => {
|
|
|
253
253
|
};
|
|
254
254
|
const [input, setInput] = React.useState(valueToInput());
|
|
255
255
|
const [inputModal, setInputModal] = React.useState(valueToInput());
|
|
256
|
-
let version =
|
|
256
|
+
let version = versionProps;
|
|
257
257
|
if (version === 'auto') {
|
|
258
258
|
if (touch) version = 'mobile';else version = 'desktop';
|
|
259
259
|
}
|
|
@@ -291,8 +291,8 @@ const DatePicker = props__ => {
|
|
|
291
291
|
|
|
292
292
|
// Calendar
|
|
293
293
|
React.useEffect(() => {
|
|
294
|
-
if (
|
|
295
|
-
}, [
|
|
294
|
+
if (calendarProps !== undefined && calendarProps !== calendar) setCalendar(calendarProps);
|
|
295
|
+
}, [calendarProps]);
|
|
296
296
|
const onUpdate = (valueNew_3, triggerOnChange = true) => {
|
|
297
297
|
// Inner update
|
|
298
298
|
if (!props.hasOwnProperty('value') || !triggerOnChange) setValue(valueNew_3);
|
|
@@ -311,7 +311,7 @@ const DatePicker = props__ => {
|
|
|
311
311
|
const onCalendarChange = valueNew__0 => {
|
|
312
312
|
const valueNew_5 = onResolveValue(valueNew__0);
|
|
313
313
|
if (valueNew_5 !== value) {
|
|
314
|
-
(!
|
|
314
|
+
(!actionsProps ? onUpdate : setValue)(valueNew_5);
|
|
315
315
|
|
|
316
316
|
// Update input modal
|
|
317
317
|
setInputModal(valueToInput(valueNew_5));
|
|
@@ -334,7 +334,7 @@ const DatePicker = props__ => {
|
|
|
334
334
|
};
|
|
335
335
|
const onClose = event => {
|
|
336
336
|
setOpen(false);
|
|
337
|
-
if (is('function',
|
|
337
|
+
if (is('function', onCloseProps)) onCloseProps(event);
|
|
338
338
|
};
|
|
339
339
|
const onReset = () => {
|
|
340
340
|
let valueNew_8 = inputToValue();
|
|
@@ -381,7 +381,7 @@ const DatePicker = props__ => {
|
|
|
381
381
|
// Update input modal
|
|
382
382
|
setInputModal(valueToInput(valueNew_9));
|
|
383
383
|
onClose(event_0);
|
|
384
|
-
if (is('function',
|
|
384
|
+
if (is('function', onTodayProps)) onTodayProps(event_0);
|
|
385
385
|
};
|
|
386
386
|
const onClear = event_1 => {
|
|
387
387
|
const dateNow_1 = new OnesyDate();
|
|
@@ -399,7 +399,7 @@ const DatePicker = props__ => {
|
|
|
399
399
|
// Update input modal
|
|
400
400
|
setInputModal(valueToInput(valueNew_10));
|
|
401
401
|
onClose(event_1);
|
|
402
|
-
if (is('function',
|
|
402
|
+
if (is('function', onClearProps)) onClearProps(event_1);
|
|
403
403
|
};
|
|
404
404
|
const onOk = event_2 => {
|
|
405
405
|
// Error
|
|
@@ -414,15 +414,15 @@ const DatePicker = props__ => {
|
|
|
414
414
|
// Update input modal
|
|
415
415
|
setInputModal(valueToInput(value));
|
|
416
416
|
onClose(event_2);
|
|
417
|
-
if (is('function',
|
|
417
|
+
if (is('function', onOkProps)) onOkProps(event_2);
|
|
418
418
|
};
|
|
419
419
|
const onCancel = event_3 => {
|
|
420
420
|
onReset();
|
|
421
421
|
onClose(event_3);
|
|
422
|
-
if (is('function',
|
|
422
|
+
if (is('function', onCancelProps)) onCancelProps(event_3);
|
|
423
423
|
};
|
|
424
424
|
const valid = (...args) => {
|
|
425
|
-
if (is('function',
|
|
425
|
+
if (is('function', validProps)) return validProps(...args);
|
|
426
426
|
const onesyDate = args[0];
|
|
427
427
|
if (min || max || validate) {
|
|
428
428
|
let response = true;
|
|
@@ -504,7 +504,7 @@ const DatePicker = props__ => {
|
|
|
504
504
|
mask.push(' ', SEPARATOR_SYMBOL, ' ', ...mask);
|
|
505
505
|
placeholder += `${SEPARATOR}${placeholder}`;
|
|
506
506
|
}
|
|
507
|
-
placeholder =
|
|
507
|
+
placeholder = placeholderProps || placeholder;
|
|
508
508
|
const buttonProps = _objectSpread({
|
|
509
509
|
color: 'inherit',
|
|
510
510
|
version: 'text',
|
|
@@ -593,7 +593,7 @@ const DatePicker = props__ => {
|
|
|
593
593
|
gap: 0,
|
|
594
594
|
direction: "column",
|
|
595
595
|
className: classNames([staticClassName('DatePicker', theme) && ['onesy-DatePicker-header'], classes.header, fullScreen && classes.header_fullScreen]),
|
|
596
|
-
children: [
|
|
596
|
+
children: [actionsProps && fullScreen && /*#__PURE__*/_jsxs(Line, {
|
|
597
597
|
gap: 0,
|
|
598
598
|
direction: "row",
|
|
599
599
|
align: "center",
|
|
@@ -615,7 +615,7 @@ const DatePicker = props__ => {
|
|
|
615
615
|
}, buttonProps), {}, {
|
|
616
616
|
children: l('Save')
|
|
617
617
|
}))]
|
|
618
|
-
}),
|
|
618
|
+
}), headingProps && /*#__PURE__*/_jsx(Type, {
|
|
619
619
|
version: "l2",
|
|
620
620
|
className: classNames([staticClassName('DatePicker', theme) && ['onesy-DatePicker-subheading'], classes.subheading, fullScreen && classes.subheading_fullScreen]),
|
|
621
621
|
children: !range ? modeModalSubHeadingText : modeModalSubHeadingTextRange
|
|
@@ -726,7 +726,7 @@ const DatePicker = props__ => {
|
|
|
726
726
|
}), fullScreen && /*#__PURE__*/_jsx(Divider, {
|
|
727
727
|
tonal: false,
|
|
728
728
|
className: classNames([staticClassName('DatePicker', theme) && ['onesy-DatePicker-divider'], classes.divider])
|
|
729
|
-
}),
|
|
729
|
+
}), actionsProps && /*#__PURE__*/React.cloneElement(actions, {
|
|
730
730
|
style: {
|
|
731
731
|
paddingTop: theme.methods.space.value(1, 'px')
|
|
732
732
|
}
|
|
@@ -747,11 +747,11 @@ const DatePicker = props__ => {
|
|
|
747
747
|
min: min,
|
|
748
748
|
max: max,
|
|
749
749
|
validate: validate,
|
|
750
|
-
belowCalendars:
|
|
750
|
+
belowCalendars: actionsProps ? actions : undefined
|
|
751
751
|
}, CalendarProps), CalendarPropsDesktop), {}, {
|
|
752
752
|
className: classNames([staticClassName('DatePicker', theme) && ['onesy-DatePicker-calendar', 'onesy-DatePicker-version-desktop'], CalendarProps?.className, CalendarPropsDesktop?.className, classes.calendar, classes.calendar_desktop])
|
|
753
753
|
}));
|
|
754
|
-
if (
|
|
754
|
+
if (staticProps) {
|
|
755
755
|
if (version === 'mobile') return mobile;
|
|
756
756
|
if (version === 'desktop') return desktop;
|
|
757
757
|
}
|
|
@@ -69,14 +69,14 @@ const DateTimePicker = props__ => {
|
|
|
69
69
|
ref,
|
|
70
70
|
tonal,
|
|
71
71
|
color = 'primary',
|
|
72
|
-
version:
|
|
73
|
-
value:
|
|
72
|
+
version: versionProps = 'auto',
|
|
73
|
+
value: valueProps,
|
|
74
74
|
valueDefault,
|
|
75
75
|
onChange,
|
|
76
76
|
label,
|
|
77
77
|
range,
|
|
78
78
|
now,
|
|
79
|
-
static:
|
|
79
|
+
static: staticProps,
|
|
80
80
|
min,
|
|
81
81
|
max,
|
|
82
82
|
validate,
|
|
@@ -85,7 +85,7 @@ const DateTimePicker = props__ => {
|
|
|
85
85
|
headingTextTimeRange,
|
|
86
86
|
headingTextDate,
|
|
87
87
|
headingTextDateRange,
|
|
88
|
-
useHelperText:
|
|
88
|
+
useHelperText: useHelperTextProps,
|
|
89
89
|
format = '12',
|
|
90
90
|
hour = true,
|
|
91
91
|
minute = true,
|
|
@@ -93,16 +93,16 @@ const DateTimePicker = props__ => {
|
|
|
93
93
|
today,
|
|
94
94
|
clear = true,
|
|
95
95
|
size,
|
|
96
|
-
placeholder:
|
|
96
|
+
placeholder: placeholderProps,
|
|
97
97
|
fullWidth,
|
|
98
98
|
readOnly,
|
|
99
99
|
disabled,
|
|
100
|
-
valid:
|
|
101
|
-
onClose:
|
|
102
|
-
onToday:
|
|
103
|
-
onClear:
|
|
104
|
-
onCancel:
|
|
105
|
-
onOk:
|
|
100
|
+
valid: validProps,
|
|
101
|
+
onClose: onCloseProps,
|
|
102
|
+
onToday: onTodayProps,
|
|
103
|
+
onClear: onClearProps,
|
|
104
|
+
onCancel: onCancelProps,
|
|
105
|
+
onOk: onOkProps,
|
|
106
106
|
Icon: Icon_ = IconMaterialDateRange,
|
|
107
107
|
IconDate = IconMaterialCalendarToday,
|
|
108
108
|
IconTime = IconMaterialSchedule,
|
|
@@ -116,7 +116,7 @@ const DateTimePicker = props__ => {
|
|
|
116
116
|
ModeDesktopProps,
|
|
117
117
|
ModeMobileProps,
|
|
118
118
|
ButtonProps,
|
|
119
|
-
PickerProps:
|
|
119
|
+
PickerProps: PickerPropsProps,
|
|
120
120
|
MiddleProps,
|
|
121
121
|
MainProps,
|
|
122
122
|
IconProps,
|
|
@@ -132,19 +132,19 @@ const DateTimePicker = props__ => {
|
|
|
132
132
|
};
|
|
133
133
|
const keys = React.useMemo(() => {
|
|
134
134
|
const result = [];
|
|
135
|
-
const items = [
|
|
135
|
+
const items = [useHelperTextProps];
|
|
136
136
|
items.forEach(item => {
|
|
137
137
|
if (is('object', item)) Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key_0 => result.push(key_0));
|
|
138
138
|
});
|
|
139
139
|
return unique(result);
|
|
140
|
-
}, [
|
|
140
|
+
}, [useHelperTextProps]);
|
|
141
141
|
const breakpoints = {};
|
|
142
142
|
keys.forEach(key_1 => {
|
|
143
143
|
breakpoints[key_1] = useMediaQuery(theme.breakpoints.media[key_1], {
|
|
144
144
|
element: refs.root.current
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
|
-
const useHelperText = valueBreakpoints(
|
|
147
|
+
const useHelperText = valueBreakpoints(useHelperTextProps, undefined, breakpoints, theme);
|
|
148
148
|
const touch = useMediaQuery('(pointer: coarse)', {
|
|
149
149
|
element: refs.root.current
|
|
150
150
|
});
|
|
@@ -154,7 +154,7 @@ const DateTimePicker = props__ => {
|
|
|
154
154
|
return sorted;
|
|
155
155
|
};
|
|
156
156
|
const [value, setValue] = React.useState(() => {
|
|
157
|
-
const valueResult = (valueDefault !== undefined ? valueDefault :
|
|
157
|
+
const valueResult = (valueDefault !== undefined ? valueDefault : valueProps) || now && (range ? [new OnesyDate(), new OnesyDate()] : [new OnesyDate()]);
|
|
158
158
|
return onResolveValue(valueResult);
|
|
159
159
|
});
|
|
160
160
|
const [calendar, setCalendar] = React.useState(value[0]);
|
|
@@ -186,7 +186,7 @@ const DateTimePicker = props__ => {
|
|
|
186
186
|
return result_0;
|
|
187
187
|
};
|
|
188
188
|
const [input, setInput] = React.useState(valueToInput());
|
|
189
|
-
let version =
|
|
189
|
+
let version = versionProps;
|
|
190
190
|
if (version === 'auto') {
|
|
191
191
|
if (touch) version = 'mobile';else version = 'desktop';
|
|
192
192
|
}
|
|
@@ -210,8 +210,8 @@ const DateTimePicker = props__ => {
|
|
|
210
210
|
|
|
211
211
|
// Value
|
|
212
212
|
React.useEffect(() => {
|
|
213
|
-
if (
|
|
214
|
-
}, [
|
|
213
|
+
if (valueProps !== undefined && valueProps !== value) onUpdateValue(valueProps);
|
|
214
|
+
}, [valueProps]);
|
|
215
215
|
const onUpdate = (valueNew_3, triggerOnChange = true) => {
|
|
216
216
|
// Inner update
|
|
217
217
|
if (!props.hasOwnProperty('value') || !triggerOnChange) setValue(valueNew_3);
|
|
@@ -318,7 +318,7 @@ const DateTimePicker = props__ => {
|
|
|
318
318
|
// Update input
|
|
319
319
|
setInput(valueToInput(valueNew_10));
|
|
320
320
|
onClose(event);
|
|
321
|
-
if (is('function',
|
|
321
|
+
if (is('function', onTodayProps)) onTodayProps(event);
|
|
322
322
|
};
|
|
323
323
|
const onClear = event_0 => {
|
|
324
324
|
const valueNew_11 = [];
|
|
@@ -329,7 +329,7 @@ const DateTimePicker = props__ => {
|
|
|
329
329
|
// Update input
|
|
330
330
|
setInput(valueToInput(valueNew_11));
|
|
331
331
|
onClose(event_0);
|
|
332
|
-
if (is('function',
|
|
332
|
+
if (is('function', onClearProps)) onClearProps(event_0);
|
|
333
333
|
};
|
|
334
334
|
const onOk = event_1 => {
|
|
335
335
|
// Error
|
|
@@ -341,22 +341,22 @@ const DateTimePicker = props__ => {
|
|
|
341
341
|
// Update input
|
|
342
342
|
setInput(valueToInput(value));
|
|
343
343
|
onClose(event_1);
|
|
344
|
-
if (is('function',
|
|
344
|
+
if (is('function', onOkProps)) onOkProps(event_1);
|
|
345
345
|
};
|
|
346
346
|
const onCancel = event_2 => {
|
|
347
347
|
onReset();
|
|
348
348
|
onClose(event_2);
|
|
349
|
-
if (is('function',
|
|
349
|
+
if (is('function', onCancelProps)) onCancelProps(event_2);
|
|
350
350
|
};
|
|
351
351
|
const onOpen = () => {
|
|
352
352
|
setOpen(previous_0 => !previous_0);
|
|
353
353
|
};
|
|
354
354
|
const onClose = event_3 => {
|
|
355
355
|
setOpen(false);
|
|
356
|
-
if (is('function',
|
|
356
|
+
if (is('function', onCloseProps)) onCloseProps(event_3);
|
|
357
357
|
};
|
|
358
358
|
const valid = (...args) => {
|
|
359
|
-
if (is('function',
|
|
359
|
+
if (is('function', validProps)) return validProps(...args);
|
|
360
360
|
const onesyDate_0 = args[0];
|
|
361
361
|
if (min || max || validate) {
|
|
362
362
|
let response = true;
|
|
@@ -496,7 +496,7 @@ const DateTimePicker = props__ => {
|
|
|
496
496
|
}
|
|
497
497
|
placeholder += `${SEPARATOR}${placeholder}`;
|
|
498
498
|
}
|
|
499
|
-
placeholder =
|
|
499
|
+
placeholder = placeholderProps || placeholder;
|
|
500
500
|
const buttonProps = _objectSpread({
|
|
501
501
|
tonal,
|
|
502
502
|
color,
|
|
@@ -571,7 +571,7 @@ const DateTimePicker = props__ => {
|
|
|
571
571
|
heading: false,
|
|
572
572
|
readOnly,
|
|
573
573
|
disabled
|
|
574
|
-
},
|
|
574
|
+
}, PickerPropsProps), tab === 'date' && DatePickerProps), tab === 'time' && TimePickerProps);
|
|
575
575
|
const element = /*#__PURE__*/_jsxs(Surface, {
|
|
576
576
|
gap: 0,
|
|
577
577
|
direction: "column",
|
|
@@ -614,7 +614,7 @@ const DateTimePicker = props__ => {
|
|
|
614
614
|
if (version === 'mobile') {
|
|
615
615
|
if (!(readOnly || disabled)) moreProps.onClick = onOpen;
|
|
616
616
|
}
|
|
617
|
-
if (
|
|
617
|
+
if (staticProps) return element;
|
|
618
618
|
return /*#__PURE__*/_jsxs(Line, _objectSpread(_objectSpread({
|
|
619
619
|
gap: 0,
|
|
620
620
|
direction: "column",
|
|
@@ -230,11 +230,11 @@ const TimePicker = props__ => {
|
|
|
230
230
|
ref,
|
|
231
231
|
tonal,
|
|
232
232
|
color = 'primary',
|
|
233
|
-
version:
|
|
234
|
-
value:
|
|
233
|
+
version: versionProps = 'auto',
|
|
234
|
+
value: valueProps,
|
|
235
235
|
valueDefault,
|
|
236
236
|
onChange,
|
|
237
|
-
selecting:
|
|
237
|
+
selecting: selectingProps,
|
|
238
238
|
selectingDefault,
|
|
239
239
|
onChangeSelecting,
|
|
240
240
|
size = 'regular',
|
|
@@ -244,37 +244,37 @@ const TimePicker = props__ => {
|
|
|
244
244
|
min,
|
|
245
245
|
max,
|
|
246
246
|
validate,
|
|
247
|
-
autoNext:
|
|
248
|
-
autoCloseOnLast:
|
|
247
|
+
autoNext: autoNextProps,
|
|
248
|
+
autoCloseOnLast: autoCloseOnLastProps,
|
|
249
249
|
openMobile = 'select',
|
|
250
250
|
openDesktop = 'select',
|
|
251
251
|
selectModalSubHeadingText = l('Select time'),
|
|
252
252
|
selectModalSubHeadingTextRange = `${l('Select from')}${SEPARATOR}${l('to time')}`,
|
|
253
253
|
inputModalSubHeadingText = l('Enter time'),
|
|
254
254
|
inputModalSubHeadingTextRange = `${l('Enter from')}${SEPARATOR}${l('to time')}`,
|
|
255
|
-
orientation:
|
|
255
|
+
orientation: orientationProps,
|
|
256
256
|
format = '12',
|
|
257
257
|
hour = true,
|
|
258
258
|
minute = true,
|
|
259
259
|
second = false,
|
|
260
|
-
switch:
|
|
261
|
-
static:
|
|
260
|
+
switch: switchProps,
|
|
261
|
+
static: staticProps,
|
|
262
262
|
today,
|
|
263
263
|
clear = true,
|
|
264
|
-
placeholder:
|
|
265
|
-
heading:
|
|
266
|
-
actions:
|
|
264
|
+
placeholder: placeholderProps,
|
|
265
|
+
heading: headingProps = true,
|
|
266
|
+
actions: actionsProps = true,
|
|
267
267
|
fullWidth,
|
|
268
268
|
readOnly,
|
|
269
269
|
disabled,
|
|
270
|
-
valid:
|
|
271
|
-
onClick:
|
|
272
|
-
onClose:
|
|
273
|
-
onCancel:
|
|
274
|
-
onNow:
|
|
275
|
-
onToday:
|
|
276
|
-
onClear:
|
|
277
|
-
onOk:
|
|
270
|
+
valid: validProps,
|
|
271
|
+
onClick: onClickProps,
|
|
272
|
+
onClose: onCloseProps,
|
|
273
|
+
onCancel: onCancelProps,
|
|
274
|
+
onNow: onNowProps,
|
|
275
|
+
onToday: onTodayProps,
|
|
276
|
+
onClear: onClearProps,
|
|
277
|
+
onOk: onOkProps,
|
|
278
278
|
renderValue,
|
|
279
279
|
Icon: Icon_ = IconMaterialSchedule,
|
|
280
280
|
IconEnter = IconMaterialKeyboardAlt,
|
|
@@ -308,22 +308,22 @@ const TimePicker = props__ => {
|
|
|
308
308
|
};
|
|
309
309
|
const keys = React.useMemo(() => {
|
|
310
310
|
const result = [];
|
|
311
|
-
const items = [
|
|
311
|
+
const items = [switchProps, orientationProps, autoNextProps, autoCloseOnLastProps];
|
|
312
312
|
items.forEach(item => {
|
|
313
313
|
if (is('object', item)) Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key_0 => result.push(key_0));
|
|
314
314
|
});
|
|
315
315
|
return unique(result);
|
|
316
|
-
}, [
|
|
316
|
+
}, [switchProps, orientationProps, autoNextProps, autoCloseOnLastProps]);
|
|
317
317
|
const breakpoints = {};
|
|
318
318
|
keys.forEach(key_1 => {
|
|
319
319
|
breakpoints[key_1] = useMediaQuery(theme.breakpoints.media[key_1], {
|
|
320
320
|
element: refs.root.current
|
|
321
321
|
});
|
|
322
322
|
});
|
|
323
|
-
const switch_ = valueBreakpoints(
|
|
324
|
-
const orientation = valueBreakpoints(
|
|
325
|
-
const autoNext = valueBreakpoints(
|
|
326
|
-
const autoCloseOnLast = valueBreakpoints(
|
|
323
|
+
const switch_ = valueBreakpoints(switchProps, true, breakpoints, theme);
|
|
324
|
+
const orientation = valueBreakpoints(orientationProps, 'vertical', breakpoints, theme);
|
|
325
|
+
const autoNext = valueBreakpoints(autoNextProps, undefined, breakpoints, theme);
|
|
326
|
+
const autoCloseOnLast = valueBreakpoints(autoCloseOnLastProps, undefined, breakpoints, theme);
|
|
327
327
|
const touch = useMediaQuery('(pointer: coarse)', {
|
|
328
328
|
element: refs.root.current
|
|
329
329
|
});
|
|
@@ -333,11 +333,11 @@ const TimePicker = props__ => {
|
|
|
333
333
|
return sorted;
|
|
334
334
|
};
|
|
335
335
|
const [value, setValue] = React.useState(() => {
|
|
336
|
-
const valueResult = (valueDefault !== undefined ? valueDefault :
|
|
336
|
+
const valueResult = (valueDefault !== undefined ? valueDefault : valueProps) || now && (range ? [new OnesyDate(), new OnesyDate()] : [new OnesyDate()]);
|
|
337
337
|
return onResolveValue(valueResult);
|
|
338
338
|
});
|
|
339
339
|
const [selecting, setSelecting] = React.useState(() => {
|
|
340
|
-
const valueResult_0 = (selectingDefault !== undefined ? selectingDefault :
|
|
340
|
+
const valueResult_0 = (selectingDefault !== undefined ? selectingDefault : selectingProps) || ['hour', 'hour'];
|
|
341
341
|
return (is('array', valueResult_0) ? valueResult_0 : [valueResult_0]).filter(Boolean);
|
|
342
342
|
});
|
|
343
343
|
const [open, setOpen] = React.useState(false);
|
|
@@ -367,7 +367,7 @@ const TimePicker = props__ => {
|
|
|
367
367
|
return result_0;
|
|
368
368
|
};
|
|
369
369
|
const [input, setInput] = React.useState(valueToInput());
|
|
370
|
-
let version =
|
|
370
|
+
let version = versionProps;
|
|
371
371
|
if (version === 'auto') {
|
|
372
372
|
if (touch) version = 'mobile';else version = 'desktop';
|
|
373
373
|
}
|
|
@@ -396,8 +396,8 @@ const TimePicker = props__ => {
|
|
|
396
396
|
|
|
397
397
|
// Value
|
|
398
398
|
React.useEffect(() => {
|
|
399
|
-
if (
|
|
400
|
-
}, [
|
|
399
|
+
if (valueProps !== undefined && valueProps !== value) onUpdateValue(valueProps);
|
|
400
|
+
}, [valueProps]);
|
|
401
401
|
const onUpdate = (valueNew__0, triggerOnChange = true) => {
|
|
402
402
|
const valueNew_3 = resolve(valueNew__0);
|
|
403
403
|
|
|
@@ -414,7 +414,7 @@ const TimePicker = props__ => {
|
|
|
414
414
|
if (is('function', onChangeSelecting)) onChangeSelecting(valueNew_4);
|
|
415
415
|
};
|
|
416
416
|
const valid = (...args) => {
|
|
417
|
-
if (is('function',
|
|
417
|
+
if (is('function', validProps)) return validProps(...args);
|
|
418
418
|
const onesyDate = args[0];
|
|
419
419
|
if (min || max || validate) {
|
|
420
420
|
let response = true;
|
|
@@ -455,7 +455,7 @@ const TimePicker = props__ => {
|
|
|
455
455
|
if (is('string', valueTime_0) && valueTime_0.startsWith('0')) valueTime_0 = valueTime_0.slice(1);
|
|
456
456
|
valueTime_0 = +valueTime_0;
|
|
457
457
|
value[index_1] = set(valueTime_0, unit || selecting[index_1], value[index_1]);
|
|
458
|
-
(!
|
|
458
|
+
(!actionsProps ? onUpdate : setValue)(resolve(value));
|
|
459
459
|
};
|
|
460
460
|
const resolve = (valueNew_7 = refs.value.current, dayTimeNew = refs.dayTime.current) => {
|
|
461
461
|
const values_0 = onResolveValue(valueNew_7).map((item_4, index_2) => {
|
|
@@ -477,7 +477,7 @@ const TimePicker = props__ => {
|
|
|
477
477
|
dayTimeNew_0[index_3] = valueNew_8;
|
|
478
478
|
refs.dayTime.current = dayTimeNew_0;
|
|
479
479
|
setDayTime(dayTimeNew_0);
|
|
480
|
-
(!
|
|
480
|
+
(!actionsProps ? onUpdate : setValue)(resolve(refs.value.current));
|
|
481
481
|
};
|
|
482
482
|
const inputToValue = (valueNew__3 = input) => {
|
|
483
483
|
let valueNew_9 = valueNew__3;
|
|
@@ -511,7 +511,7 @@ const TimePicker = props__ => {
|
|
|
511
511
|
const valueNew_11 = [...value];
|
|
512
512
|
if (valueNew__5 !== value[index_4]) {
|
|
513
513
|
valueNew_11[index_4] = valueNew__5;
|
|
514
|
-
(!
|
|
514
|
+
(!actionsProps ? onUpdate : setValue)(resolve(valueNew_11));
|
|
515
515
|
|
|
516
516
|
// Error
|
|
517
517
|
errorCheck(valueNew_11);
|
|
@@ -542,7 +542,7 @@ const TimePicker = props__ => {
|
|
|
542
542
|
};
|
|
543
543
|
const onClose = event => {
|
|
544
544
|
setOpen(false);
|
|
545
|
-
if (is('function',
|
|
545
|
+
if (is('function', onCloseProps)) onCloseProps(event);
|
|
546
546
|
};
|
|
547
547
|
const onReset = () => {
|
|
548
548
|
const valueNew_14 = inputToValue();
|
|
@@ -566,7 +566,7 @@ const TimePicker = props__ => {
|
|
|
566
566
|
// Update dayTime
|
|
567
567
|
setDayTime(valueNew_15.map(item_8 => formatDate(item_8, 'a')));
|
|
568
568
|
onClose(event_0);
|
|
569
|
-
if (is('function',
|
|
569
|
+
if (is('function', onTodayProps)) onTodayProps(event_0);
|
|
570
570
|
};
|
|
571
571
|
const onClear = event_1 => {
|
|
572
572
|
const valueNew_16 = [];
|
|
@@ -580,7 +580,7 @@ const TimePicker = props__ => {
|
|
|
580
580
|
// Update dayTime
|
|
581
581
|
setDayTime(valueNew_16.map(item_9 => formatDate(item_9, 'a')));
|
|
582
582
|
onClose(event_1);
|
|
583
|
-
if (is('function',
|
|
583
|
+
if (is('function', onClearProps)) onClearProps(event_1);
|
|
584
584
|
};
|
|
585
585
|
const onOk = event_2 => {
|
|
586
586
|
// Error
|
|
@@ -595,12 +595,12 @@ const TimePicker = props__ => {
|
|
|
595
595
|
// Update dayTime
|
|
596
596
|
setDayTime(refs.value.current.map(item_10 => formatDate(item_10, 'a')));
|
|
597
597
|
onClose(event_2);
|
|
598
|
-
if (is('function',
|
|
598
|
+
if (is('function', onOkProps)) onOkProps(event_2);
|
|
599
599
|
};
|
|
600
600
|
const onCancel = event_3 => {
|
|
601
601
|
onReset();
|
|
602
602
|
onClose(event_3);
|
|
603
|
-
if (is('function',
|
|
603
|
+
if (is('function', onCancelProps)) onCancelProps(event_3);
|
|
604
604
|
};
|
|
605
605
|
const mask = [];
|
|
606
606
|
let placeholder = '';
|
|
@@ -653,7 +653,7 @@ const TimePicker = props__ => {
|
|
|
653
653
|
mask.push(' ', SEPARATOR_SYMBOL, ' ', ...mask);
|
|
654
654
|
placeholder += `${SEPARATOR}${placeholder}`;
|
|
655
655
|
}
|
|
656
|
-
placeholder =
|
|
656
|
+
placeholder = placeholderProps || placeholder;
|
|
657
657
|
const buttonProps = _objectSpread({
|
|
658
658
|
color: 'inherit',
|
|
659
659
|
version: 'text',
|
|
@@ -907,7 +907,7 @@ const TimePicker = props__ => {
|
|
|
907
907
|
Component: Line
|
|
908
908
|
}, MainProps), {}, {
|
|
909
909
|
className: classNames([staticClassName('TimePicker', theme) && ['onesy-TimePicker-main'], MainProps?.className, classes.main, classes[`main_size_${size}`]]),
|
|
910
|
-
children: [
|
|
910
|
+
children: [headingProps && /*#__PURE__*/_jsx(Type, {
|
|
911
911
|
version: size === 'large' ? 'l1' : size === 'regular' ? 'l2' : 'l3',
|
|
912
912
|
className: classNames([staticClassName('TimePicker', theme) && ['onesy-TimePicker-heading'], classes.heading, classes[`heading_size_${size}`]]),
|
|
913
913
|
children: heading
|
|
@@ -918,7 +918,7 @@ const TimePicker = props__ => {
|
|
|
918
918
|
valueDefault: tab,
|
|
919
919
|
onChange: setTab
|
|
920
920
|
}, TabsProps), {}, {
|
|
921
|
-
className: classNames([staticClassName('TimePicker', theme) && ['onesy-TimePicker-tabs'], TabsProps?.className, classes.tabs,
|
|
921
|
+
className: classNames([staticClassName('TimePicker', theme) && ['onesy-TimePicker-tabs'], TabsProps?.className, classes.tabs, headingProps && classes.tabs_padding]),
|
|
922
922
|
children: [/*#__PURE__*/_jsx(Tab, _objectSpread({
|
|
923
923
|
value: 0,
|
|
924
924
|
name: l('From')
|
|
@@ -930,12 +930,12 @@ const TimePicker = props__ => {
|
|
|
930
930
|
gap: 0,
|
|
931
931
|
className: classNames([staticClassName('TimePicker', theme) && ['onesy-TimePicker-middle'], MiddleProps?.className, classes.middle, classes[`middle_size_${size}`]]),
|
|
932
932
|
children: elementValues[tab]
|
|
933
|
-
}),
|
|
933
|
+
}), actionsProps && actions]
|
|
934
934
|
}));
|
|
935
935
|
if (version === 'mobile') {
|
|
936
936
|
if (!(readOnly || disabled)) moreProps.onClick = onOpen;
|
|
937
937
|
}
|
|
938
|
-
if (
|
|
938
|
+
if (staticProps) return element;
|
|
939
939
|
return /*#__PURE__*/_jsxs(Line, _objectSpread(_objectSpread({
|
|
940
940
|
gap: 0,
|
|
941
941
|
direction: "column",
|
package/esm/index.js
CHANGED
package/index.js
CHANGED