awing-library 2.1.55 → 2.1.56
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.
|
@@ -62,7 +62,7 @@ function Container() {
|
|
|
62
62
|
setLoading(false);
|
|
63
63
|
});
|
|
64
64
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
|
-
}, [filter.startDate, filter.endDate]);
|
|
65
|
+
}, [service, filter.startDate, filter.endDate]);
|
|
66
66
|
(0, react_1.useEffect)(function () {
|
|
67
67
|
var dataFilter = fullSchedules.filter(function (item) { return item.campaignId === filter.campaignId; });
|
|
68
68
|
setSchedules(dataFilter.length > 0 ? dataFilter : fullSchedules);
|
|
@@ -114,7 +114,7 @@ function Filter(props) {
|
|
|
114
114
|
setCampaigns(options);
|
|
115
115
|
});
|
|
116
116
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
117
|
-
}, [filter.startDate, filter.endDate]);
|
|
117
|
+
}, [service, filter.startDate, filter.endDate]);
|
|
118
118
|
var handleChangeQueryInput = function (queryParams) {
|
|
119
119
|
onUpdateFilter(__assign(__assign({}, queryParams), { campaignId: filter.campaignId }));
|
|
120
120
|
};
|
|
@@ -43,14 +43,17 @@ var GeoFencing_1 = __importDefault(require("../../ACM-AXN/GeoFencing"));
|
|
|
43
43
|
var i18n_1 = __importDefault(require("../../i18n"));
|
|
44
44
|
var omit = require('lodash/omit');
|
|
45
45
|
function DataInput(props) {
|
|
46
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
46
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
47
47
|
var t = (0, react_i18next_1.useTranslation)(undefined, { i18n: i18n_1.default }).t;
|
|
48
48
|
var fieldDefinition = props.fieldDefinition, onChange = props.onChange, value = props.value, error = props.error, disableHelperText = props.disableHelperText;
|
|
49
49
|
var fieldName = fieldDefinition.fieldName, type = fieldDefinition.type, onValidate = fieldDefinition.onValidate, min = fieldDefinition.min, max = fieldDefinition.max, other = __rest(fieldDefinition, ["fieldName", "type", "onValidate", "min", "max"]);
|
|
50
|
-
var
|
|
50
|
+
var _l = react_2.default.useState(t('Common.InvalidData')), errorText = _l[0], setErrorText = _l[1];
|
|
51
51
|
var checkValidationValue = function (fieldDefinition, val) {
|
|
52
52
|
if (!fieldDefinition.required &&
|
|
53
|
-
(val === undefined ||
|
|
53
|
+
(val === undefined ||
|
|
54
|
+
val === null ||
|
|
55
|
+
val === '' ||
|
|
56
|
+
(Array.isArray(val) && val.length === 0)))
|
|
54
57
|
return true;
|
|
55
58
|
if (fieldDefinition.onValidate)
|
|
56
59
|
return fieldDefinition.onValidate(val, fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.length, fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.pattern);
|
|
@@ -134,7 +137,7 @@ function DataInput(props) {
|
|
|
134
137
|
: undefined }));
|
|
135
138
|
}
|
|
136
139
|
case 'checkbox': {
|
|
137
|
-
return ((0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { id: fieldName.toString(), name: fieldName.toString(), checked: value, onChange: function (event) {
|
|
140
|
+
return ((0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { disabled: (_b = fieldDefinition.disabled) !== null && _b !== void 0 ? _b : false, id: fieldName.toString(), name: fieldName.toString(), checked: value, onChange: function (event) {
|
|
138
141
|
return onChange(event.target.checked, checkValidationValue(fieldDefinition, event.target.checked));
|
|
139
142
|
}, color: "primary", readOnly: fieldDefinition.readOnly }), label: fieldDefinition.label }) }));
|
|
140
143
|
}
|
|
@@ -143,7 +146,7 @@ function DataInput(props) {
|
|
|
143
146
|
return onChange(date === null || date === void 0 ? void 0 : date.toDate(), checkValidationValue(fieldDefinition, date === null || date === void 0 ? void 0 : date.toDate()));
|
|
144
147
|
}, readOnly: fieldDefinition.readOnly, slotProps: {
|
|
145
148
|
textField: __assign(__assign({ required: fieldDefinition.required, fullWidth: true, variant: 'standard' }, other), { error: error, helperText: !disableHelperText && error
|
|
146
|
-
? (
|
|
149
|
+
? (_c = fieldDefinition.helperText) !== null && _c !== void 0 ? _c : t('Common.InvalidData')
|
|
147
150
|
: '' }),
|
|
148
151
|
} }));
|
|
149
152
|
}
|
|
@@ -152,12 +155,12 @@ function DataInput(props) {
|
|
|
152
155
|
return onChange(date === null || date === void 0 ? void 0 : date.toDate(), checkValidationValue(fieldDefinition, date === null || date === void 0 ? void 0 : date.toDate()));
|
|
153
156
|
}, slotProps: {
|
|
154
157
|
textField: __assign(__assign({ required: fieldDefinition.required, fullWidth: true, variant: 'standard' }, other), { error: error, helperText: !disableHelperText && error
|
|
155
|
-
? (
|
|
158
|
+
? (_d = fieldDefinition.helperText) !== null && _d !== void 0 ? _d : t('Common.InvalidData')
|
|
156
159
|
: '' }),
|
|
157
160
|
}, readOnly: fieldDefinition.readOnly }));
|
|
158
161
|
}
|
|
159
162
|
case 'date-range': {
|
|
160
|
-
var
|
|
163
|
+
var _m = other, isDayBlocked = _m.isDayBlocked, isOutsideRange = _m.isOutsideRange;
|
|
161
164
|
return ((0, jsx_runtime_1.jsx)(AWING_1.DateRangePicker, { noBorder: true, variant: "standard", textFieldProps: __assign({ fullWidth: true, style: { margin: '8px 0px' } }, omit(other, ['isDayBlocked', 'isOutsideRange'])), value: {
|
|
162
165
|
startDate: (value === null || value === void 0 ? void 0 : value[0]) || null,
|
|
163
166
|
endDate: (value === null || value === void 0 ? void 0 : value[1]) || null,
|
|
@@ -165,15 +168,15 @@ function DataInput(props) {
|
|
|
165
168
|
var newValue = [dateRange.startDate, dateRange.endDate];
|
|
166
169
|
onChange(newValue, checkValidationValue(fieldDefinition, newValue));
|
|
167
170
|
}, label: fieldDefinition.label, error: error, helperText: !disableHelperText && error
|
|
168
|
-
? (
|
|
171
|
+
? (_e = fieldDefinition.helperText) !== null && _e !== void 0 ? _e : t('Common.InvalidData')
|
|
169
172
|
: '', disableHelperText: disableHelperText, isDayBlocked: isDayBlocked, isOutsideRange: isOutsideRange }));
|
|
170
173
|
}
|
|
171
174
|
case 'number': {
|
|
172
175
|
return ((0, jsx_runtime_1.jsx)(AWING_1.NumberFormat, __assign({ id: fieldName.toString(), name: fieldName.toString(), fullWidth: true, variant: "standard" }, other, { value: value !== null && value !== void 0 ? value : '', onChange: function (event) {
|
|
173
176
|
var newValue = Number(event.target.value);
|
|
174
177
|
onChange(newValue, checkValidationValue(fieldDefinition, newValue));
|
|
175
|
-
}, error: error, helperText: !disableHelperText && error
|
|
176
|
-
? (
|
|
178
|
+
}, error: error, inputProps: { readOnly: fieldDefinition.readOnly }, helperText: !disableHelperText && error
|
|
179
|
+
? (_f = fieldDefinition.helperText) !== null && _f !== void 0 ? _f : t('Common.InvalidData')
|
|
177
180
|
: '' })));
|
|
178
181
|
}
|
|
179
182
|
case 'radio': {
|
|
@@ -188,7 +191,7 @@ function DataInput(props) {
|
|
|
188
191
|
case 'text':
|
|
189
192
|
case 'text-area': {
|
|
190
193
|
return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ id: fieldName.toString(), name: fieldName.toString(), type: 'text', fullWidth: true, variant: "standard", multiline: fieldDefinition.type === 'text-area', error: error, helperText: !disableHelperText && error
|
|
191
|
-
? (
|
|
194
|
+
? (_g = fieldDefinition.helperText) !== null && _g !== void 0 ? _g : errorText
|
|
192
195
|
: '' }, other, { value: value !== null && value !== void 0 ? value : '', onChange: function (event) {
|
|
193
196
|
return onChange(event.target.value, checkValidationValue(fieldDefinition, event.target.value));
|
|
194
197
|
} })));
|
|
@@ -200,7 +203,7 @@ function DataInput(props) {
|
|
|
200
203
|
: event.target.value;
|
|
201
204
|
onChange(event.target.value, checkValidationValue(fieldDefinition, newValue));
|
|
202
205
|
}, error: error, helperText: !disableHelperText && error
|
|
203
|
-
? (
|
|
206
|
+
? (_h = fieldDefinition.helperText) !== null && _h !== void 0 ? _h : t('Common.InvalidData')
|
|
204
207
|
: '' }, other, { children: [!fieldDefinition.required && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: "", children: (0, jsx_runtime_1.jsx)("em", { children: t('Common.None') }) })), fieldDefinition.options.map(function (item, index) {
|
|
205
208
|
var _a;
|
|
206
209
|
return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: item.value, disabled: item.disabled ||
|
|
@@ -214,7 +217,7 @@ function DataInput(props) {
|
|
|
214
217
|
return ((0, jsx_runtime_1.jsx)(AWING_1.MultipleHierarchicalChoice, __assign({}, fieldDefinition, { variant: "standard", value: value, onChange: function (value) {
|
|
215
218
|
onChange(value, checkValidationValue(fieldDefinition, value));
|
|
216
219
|
}, error: error, helperText: !disableHelperText && error
|
|
217
|
-
? (
|
|
220
|
+
? (_j = fieldDefinition.helperText) !== null && _j !== void 0 ? _j : t('Common.InvalidData')
|
|
218
221
|
: '' })));
|
|
219
222
|
}
|
|
220
223
|
case 'geo-fencing': {
|
|
@@ -227,7 +230,7 @@ function DataInput(props) {
|
|
|
227
230
|
return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ id: fieldName.toString(), name: fieldName.toString(), type: fieldDefinition.type, fullWidth: true, variant: "standard" }, other, { value: value !== null && value !== void 0 ? value : '', onChange: function (event) {
|
|
228
231
|
return onChange(event.target.value, checkValidationValue(fieldDefinition, event.target.value));
|
|
229
232
|
}, error: error, helperText: !disableHelperText && error
|
|
230
|
-
? (
|
|
233
|
+
? (_k = fieldDefinition.helperText) !== null && _k !== void 0 ? _k : t('Common.InvalidData')
|
|
231
234
|
: '' })));
|
|
232
235
|
}
|
|
233
236
|
}
|