awing-library 2.1.200-dev → 2.1.202-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.
|
@@ -161,7 +161,7 @@ var BasicDataForm = function (props) {
|
|
|
161
161
|
width: '100%',
|
|
162
162
|
}, children: actions }))] })), (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, spacing: 2, children: fields.map(function (fieldDef, index) {
|
|
163
163
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
164
|
-
var fieldName = fieldDef.fieldName, _t = fieldDef.type, type = _t === void 0 ? 'text' : _t, checkValid = fieldDef.checkValid, options = fieldDef.options, loading = fieldDef.loading, customeFieldChange = fieldDef.customeFieldChange, AsynchronousAutocompleteProps = fieldDef.AsynchronousAutocompleteProps, SearchProps = fieldDef.SearchProps, defaultValue = fieldDef.defaultValue, value = fieldDef.value, other = __rest(fieldDef, ["fieldName", "type", "checkValid", "options", "loading", "customeFieldChange", "AsynchronousAutocompleteProps", "SearchProps", "defaultValue", "value"]);
|
|
164
|
+
var fieldName = fieldDef.fieldName, _t = fieldDef.type, type = _t === void 0 ? 'text' : _t, checkValid = fieldDef.checkValid, options = fieldDef.options, loading = fieldDef.loading, customeFieldChange = fieldDef.customeFieldChange, AsynchronousAutocompleteProps = fieldDef.AsynchronousAutocompleteProps, AutocompleteBasicProps = fieldDef.AutocompleteBasicProps, SearchProps = fieldDef.SearchProps, defaultValue = fieldDef.defaultValue, value = fieldDef.value, other = __rest(fieldDef, ["fieldName", "type", "checkValid", "options", "loading", "customeFieldChange", "AsynchronousAutocompleteProps", "AutocompleteBasicProps", "SearchProps", "defaultValue", "value"]);
|
|
165
165
|
var fieldValue = value !== null && value !== void 0 ? value : currentObj[fieldName];
|
|
166
166
|
var showError = currentValid[fieldName] !== undefined &&
|
|
167
167
|
!currentValid[fieldName];
|
|
@@ -191,7 +191,7 @@ var BasicDataForm = function (props) {
|
|
|
191
191
|
.endAdornment] })) }), error: showError, helperText: showError
|
|
192
192
|
? (_a = fieldDef.helperText) !== null && _a !== void 0 ? _a : t('Common.InvalidData')
|
|
193
193
|
: '' })));
|
|
194
|
-
} }, index));
|
|
194
|
+
}, disableClearable: AutocompleteBasicProps === null || AutocompleteBasicProps === void 0 ? void 0 : AutocompleteBasicProps.disableClearable }, index));
|
|
195
195
|
break;
|
|
196
196
|
case 'checkbox':
|
|
197
197
|
currentField = ((0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, required: fieldDef.required, children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { id: fieldName, name: fieldName, checked: fieldValue, onChange: function (event) {
|
|
@@ -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,
|
|
@@ -37,6 +37,9 @@ export interface BasicFieldDefinition extends BaseTextFieldProps {
|
|
|
37
37
|
*/
|
|
38
38
|
customeFieldChange?(fieldValue: any): DataObject;
|
|
39
39
|
AsynchronousAutocompleteProps?: AsynchronousAutocompleteProps;
|
|
40
|
+
AutocompleteBasicProps?: {
|
|
41
|
+
disableClearable?: boolean;
|
|
42
|
+
};
|
|
40
43
|
SearchProps?: {
|
|
41
44
|
searchResult?: any;
|
|
42
45
|
error: boolean;
|
|
@@ -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) {
|
|
@@ -330,8 +330,9 @@ var DateRangePickerWrapper = function (props) {
|
|
|
330
330
|
'isDayBlocked',
|
|
331
331
|
'handleValid',
|
|
332
332
|
'handleDateRangePopover',
|
|
333
|
+
'required',
|
|
333
334
|
]);
|
|
334
|
-
var
|
|
335
|
+
var _u = react_1.default.useState(null), anchorElPopover = _u[0], setAnchorElPopover = _u[1];
|
|
335
336
|
var openPopper = Boolean(anchorElPopover);
|
|
336
337
|
var id = openPopper ? 'datePicker-popper' : undefined;
|
|
337
338
|
var popperRef = react_1.default.useRef();
|
|
@@ -352,7 +353,7 @@ var DateRangePickerWrapper = function (props) {
|
|
|
352
353
|
};
|
|
353
354
|
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
355
|
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
|
|
356
|
+
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
357
|
? error
|
|
357
358
|
? helperText || t('Common.InvalidData')
|
|
358
359
|
: !isValid
|