awing-library 2.1.200-dev → 2.1.201-dev
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.
|
@@ -219,7 +219,7 @@ var BasicDataForm = function (props) {
|
|
|
219
219
|
} }, fieldDef.DateProps), fieldName));
|
|
220
220
|
break;
|
|
221
221
|
case 'date-range':
|
|
222
|
-
currentField = ((0, jsx_runtime_1.jsx)(DateRangePicker_1.default, __assign({ variant: "outlined", textFieldProps: {
|
|
222
|
+
currentField = ((0, jsx_runtime_1.jsx)(DateRangePicker_1.default, __assign({ required: fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.required, variant: "outlined", textFieldProps: {
|
|
223
223
|
fullWidth: true,
|
|
224
224
|
}, value: {
|
|
225
225
|
startDate: (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue[0]) || null,
|
|
@@ -144,7 +144,7 @@ var defaultProps = {
|
|
|
144
144
|
};
|
|
145
145
|
var DateRangePickerWrapper = function (props) {
|
|
146
146
|
var classes = useStyles();
|
|
147
|
-
var value = props.value, error = props.error, helperText = props.helperText, _a = props.autoFocus, autoFocus = _a === void 0 ? false : _a, _b = props.autoFocusEndDate, autoFocusEndDate = _b === void 0 ? false : _b, _c = props.initialStartDate, initialStartDate = _c === void 0 ? null : _c, _d = props.initialEndDate, initialEndDate = _d === void 0 ? null : _d, _e = props.callback, callback = _e === void 0 ? function () { } : _e, _f = props.label, label = _f === void 0 ? null : _f, _g = props.isShowCalendarInfo, isShowCalendarInfo = _g === void 0 ? false : _g, variant = props.variant, openDirection = props.openDirection, _h = props.isDayBlocked, isDayBlocked = _h === void 0 ? function (day) { return false; } : _h, _j = props.handleValid, handleValid = _j === void 0 ? function () { } : _j, _k = props.handleDateRangePopover, handleDateRangePopover = _k === void 0 ? function () { } : _k, disableHelperText = props.disableHelperText, _l = props.isFutureDate, isFutureDate = _l === void 0 ? false : _l;
|
|
147
|
+
var value = props.value, error = props.error, helperText = props.helperText, _a = props.autoFocus, autoFocus = _a === void 0 ? false : _a, _b = props.autoFocusEndDate, autoFocusEndDate = _b === void 0 ? false : _b, _c = props.initialStartDate, initialStartDate = _c === void 0 ? null : _c, _d = props.initialEndDate, initialEndDate = _d === void 0 ? null : _d, _e = props.callback, callback = _e === void 0 ? function () { } : _e, _f = props.label, label = _f === void 0 ? null : _f, _g = props.isShowCalendarInfo, isShowCalendarInfo = _g === void 0 ? false : _g, variant = props.variant, openDirection = props.openDirection, _h = props.isDayBlocked, isDayBlocked = _h === void 0 ? function (day) { return false; } : _h, _j = props.handleValid, handleValid = _j === void 0 ? function () { } : _j, _k = props.handleDateRangePopover, handleDateRangePopover = _k === void 0 ? function () { } : _k, disableHelperText = props.disableHelperText, _l = props.isFutureDate, isFutureDate = _l === void 0 ? false : _l, _m = props.required, required = _m === void 0 ? false : _m;
|
|
148
148
|
var initialFocusedInput = null;
|
|
149
149
|
if (autoFocus) {
|
|
150
150
|
initialFocusedInput = constants_1.START_DATE;
|
|
@@ -152,12 +152,12 @@ var DateRangePickerWrapper = function (props) {
|
|
|
152
152
|
else if (autoFocusEndDate) {
|
|
153
153
|
initialFocusedInput = constants_1.END_DATE;
|
|
154
154
|
}
|
|
155
|
-
var
|
|
156
|
-
var
|
|
157
|
-
var
|
|
158
|
-
var
|
|
159
|
-
var
|
|
160
|
-
var
|
|
155
|
+
var _o = (0, react_1.useState)(initialFocusedInput), focusedInput = _o[0], setFocusedInput = _o[1];
|
|
156
|
+
var _p = (0, react_1.useState)(initialStartDate), startDate = _p[0], setStartDate = _p[1];
|
|
157
|
+
var _q = (0, react_1.useState)(initialEndDate), endDate = _q[0], setEndDate = _q[1];
|
|
158
|
+
var _r = (0, react_1.useState)(true), isValid = _r[0], setIsValid = _r[1];
|
|
159
|
+
var _s = (0, react_1.useState)("".concat(moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate).format('DD/MM/YYYY'), " - ").concat(moment(value ? value === null || value === void 0 ? void 0 : value.endDate : endDate).format('DD/MM/YYYY'))), inputValue = _s[0], setInputValue = _s[1];
|
|
160
|
+
var _t = (0, react_i18next_1.useTranslation)(), i18n = _t.i18n, t = _t.t;
|
|
161
161
|
var momentLanguage = (0, react_1.useMemo)(function () { var _a, _b; return ((_b = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.language) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[0]) || 'en'; }, [i18n.language]);
|
|
162
162
|
(0, react_1.useEffect)(function () {
|
|
163
163
|
if (value !== undefined) {
|
|
@@ -331,7 +331,7 @@ var DateRangePickerWrapper = function (props) {
|
|
|
331
331
|
'handleValid',
|
|
332
332
|
'handleDateRangePopover',
|
|
333
333
|
]);
|
|
334
|
-
var
|
|
334
|
+
var _u = react_1.default.useState(null), anchorElPopover = _u[0], setAnchorElPopover = _u[1];
|
|
335
335
|
var openPopper = Boolean(anchorElPopover);
|
|
336
336
|
var id = openPopper ? 'datePicker-popper' : undefined;
|
|
337
337
|
var popperRef = react_1.default.useRef();
|
|
@@ -352,7 +352,7 @@ var DateRangePickerWrapper = function (props) {
|
|
|
352
352
|
};
|
|
353
353
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_input_mask_1.default, { mask: "99/99/9999 - 99/99/9999", maskplaceholder: "dd/mm/yyyy - dd/mm/yyyy", value: inputValue, onChange: handleChangeInput, disabled: props.disabled, children: function () {
|
|
354
354
|
var _a;
|
|
355
|
-
return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ "aria-describedby": id, variant: variant, label: label, error: !isValid || error, helperText: !disableHelperText
|
|
355
|
+
return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ required: required, "aria-describedby": id, variant: variant, label: label, error: !isValid || error, helperText: !disableHelperText
|
|
356
356
|
? error
|
|
357
357
|
? helperText || t('Common.InvalidData')
|
|
358
358
|
: !isValid
|