awing-library 2.1.29-beta → 2.1.31-beta

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.
@@ -91,7 +91,9 @@ var RowAdvanceComponent = function (_a) {
91
91
  ? (0, helper_1.timestampToStringDDMMYYYY)(row === null || row === void 0 ? void 0 : row.toDate)
92
92
  : (0, helper_1.timestampToStringDDMMYYYY)(row === null || row === void 0 ? void 0 : row.date);
93
93
  var fromDateToDate = startDate === endDate ? startDate : startDate + ' - ' + endDate;
94
- var totalRate = !(row === null || row === void 0 ? void 0 : row.rate) ? '' : (0, helper_1.roundDecimalNumber)(row === null || row === void 0 ? void 0 : row.rate);
94
+ var totalRate = !(row === null || row === void 0 ? void 0 : row.rate)
95
+ ? ''
96
+ : Number((0, helper_1.roundDecimalNumber)(row === null || row === void 0 ? void 0 : row.rate)).toFixed(2);
95
97
  var totalView = (row === null || row === void 0 ? void 0 : row.quantity) !== undefined
96
98
  ? (0, helper_1.roundDecimalNumber)(row === null || row === void 0 ? void 0 : row.quantity)
97
99
  : (0, helper_1.roundDecimalNumber)(row === null || row === void 0 ? void 0 : row.totalQuantity);
@@ -140,7 +142,7 @@ var RowAdvanceComponent = function (_a) {
140
142
  (0, jsx_runtime_1.jsx)(material_1.TableCell, { className: classes.styledCampaignField, children: generateCampaignTotalCount(options === null || options === void 0 ? void 0 : options.campaigns, row, t('Schedule.CampaignDefault')) })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})) })) }, item.id));
141
143
  case Enum_1.HEAD_CELL_NAMES.DOMAIN:
142
144
  return ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: fieldNameShowOn ===
143
- Enum_1.HEAD_CELL_NAMES.DOMAIN ? ((0, jsx_runtime_1.jsx)(material_1.TableCell, { className: classes.styledDomainField, children: (_c = options === null || options === void 0 ? void 0 : options.domains[row === null || row === void 0 ? void 0 : row.domainId]) === null || _c === void 0 ? void 0 : _c.name })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: groupNames
145
+ Enum_1.HEAD_CELL_NAMES.DOMAIN ? ((0, jsx_runtime_1.jsx)(material_1.TableCell, { className: classes.styledDomainField, children: (_c = options === null || options === void 0 ? void 0 : options.domains[row === null || row === void 0 ? void 0 : row.groupKeyId]) === null || _c === void 0 ? void 0 : _c.name })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: groupNames
144
146
  .slice(0, priorityGroupLevel - 1)
145
147
  .indexOf(Enum_1.HEAD_CELL_NAMES.DOMAIN) === -1 ? ((0, jsx_runtime_1.jsx)(material_1.TableCell, { className: classes.styledDomainField, children: ((_d = options === null || options === void 0 ? void 0 : options.domains[row === null || row === void 0 ? void 0 : row.domainId]) === null || _d === void 0 ? void 0 : _d.name) || (row === null || row === void 0 ? void 0 : row.totalDomain) })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})) })) }, item.id));
146
148
  case Enum_1.HEAD_CELL_NAMES.DATE:
@@ -180,6 +180,8 @@ var RowAdvanceContainer = function (_a) {
180
180
  };
181
181
  var filterById = function (id, groupName, filters) {
182
182
  switch (groupName) {
183
+ case Enum_1.HEAD_CELL_NAMES.DOMAIN:
184
+ return __assign(__assign({}, filters), { domainId: id });
183
185
  case Enum_1.HEAD_CELL_NAMES.CAMPAIGN:
184
186
  return __assign(__assign({}, filters), { campaignId: id });
185
187
  case Enum_1.HEAD_CELL_NAMES.PLACE:
@@ -43,14 +43,14 @@ 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;
46
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
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 _j = react_2.default.useState(t('Common.InvalidData')), errorText = _j[0], setErrorText = _j[1];
50
+ var _k = react_2.default.useState(t('Common.InvalidData')), errorText = _k[0], setErrorText = _k[1];
51
51
  var checkValidationValue = function (fieldDefinition, val) {
52
52
  if (!fieldDefinition.required &&
53
- (val === undefined || val === null || val === '' || val === []))
53
+ (val === undefined || val === null || val === '' || (Array.isArray(val) && val.length === 0)))
54
54
  return true;
55
55
  if (fieldDefinition.onValidate)
56
56
  return fieldDefinition.onValidate(val, fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.length, fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.pattern);
@@ -63,6 +63,8 @@ function DataInput(props) {
63
63
  else
64
64
  return (0, validation_1.notNullValid)(val);
65
65
  }
66
+ case 'multiple-hierarchical':
67
+ return (0, validation_1.arrayIsNotEmptyValid)(val);
66
68
  case 'month':
67
69
  case 'date':
68
70
  return (0, validation_1.dateValid)(val);
@@ -108,10 +110,10 @@ function DataInput(props) {
108
110
  case 'autocomplete': {
109
111
  return ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, { multiple: fieldDefinition.multiple, options: fieldDefinition.options, getOptionLabel: function (option) { var _a, _b; return (_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.text) !== null && _b !== void 0 ? _b : ''; }, isOptionEqualToValue: function (option, value) {
110
112
  return (option === null || option === void 0 ? void 0 : option.value) === (value === null || value === void 0 ? void 0 : value.value);
111
- }, onChange: function (e, value) {
113
+ }, disableclearable: fieldDefinition.disableClearable, onChange: function (e, value) {
112
114
  var newValue = fieldDefinition.multiple
113
- ? value.map(function (x) { return x.value; })
114
- : value.value;
115
+ ? value.map(function (x) { return x === null || x === void 0 ? void 0 : x.value; })
116
+ : value === null || value === void 0 ? void 0 : value.value;
115
117
  onChange(newValue, checkValidationValue(fieldDefinition, newValue));
116
118
  }, value: fieldDefinition.multiple
117
119
  ? fieldDefinition.options.filter(function (x) {
@@ -155,7 +157,7 @@ function DataInput(props) {
155
157
  }, readOnly: fieldDefinition.readOnly }));
156
158
  }
157
159
  case 'date-range': {
158
- var _k = other, isDayBlocked = _k.isDayBlocked, isOutsideRange = _k.isOutsideRange;
160
+ var _l = other, isDayBlocked = _l.isDayBlocked, isOutsideRange = _l.isOutsideRange;
159
161
  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: {
160
162
  startDate: (value === null || value === void 0 ? void 0 : value[0]) || null,
161
163
  endDate: (value === null || value === void 0 ? void 0 : value[1]) || null,
@@ -208,6 +210,13 @@ function DataInput(props) {
208
210
  }), { children: (_a = item.label) !== null && _a !== void 0 ? _a : item.text }), "".concat(fieldName.toString(), "-opt-").concat(index)));
209
211
  })] })));
210
212
  }
213
+ case 'multiple-hierarchical': {
214
+ return ((0, jsx_runtime_1.jsx)(AWING_1.MultipleHierarchicalChoice, __assign({}, fieldDefinition, { variant: "standard", value: value, onChange: function (value) {
215
+ onChange(value, checkValidationValue(fieldDefinition, value));
216
+ }, error: error, helperText: !disableHelperText && error
217
+ ? (_h = fieldDefinition.helperText) !== null && _h !== void 0 ? _h : t('Common.InvalidData')
218
+ : '' })));
219
+ }
211
220
  case 'geo-fencing': {
212
221
  var configs = fieldDefinition.configs, label = fieldDefinition.label, initValue = fieldDefinition.initValue, value_1 = fieldDefinition.value, limit = fieldDefinition.limit, isOnlyMap = fieldDefinition.isOnlyMap;
213
222
  return ((0, jsx_runtime_1.jsx)("div", { style: { marginTop: '16px' }, children: (0, jsx_runtime_1.jsx)(GeoFencing_1.default, { configs: configs, label: label, initValue: initValue, value: value_1, limit: limit, isOnlyMap: isOnlyMap, onChange: function (newValue) {
@@ -218,7 +227,7 @@ function DataInput(props) {
218
227
  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) {
219
228
  return onChange(event.target.value, checkValidationValue(fieldDefinition, event.target.value));
220
229
  }, error: error, helperText: !disableHelperText && error
221
- ? (_h = fieldDefinition.helperText) !== null && _h !== void 0 ? _h : t('Common.InvalidData')
230
+ ? (_j = fieldDefinition.helperText) !== null && _j !== void 0 ? _j : t('Common.InvalidData')
222
231
  : '' })));
223
232
  }
224
233
  }
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { BaseTextFieldProps } from '@mui/material/TextField';
3
- import { DataObject, MenuOption } from '../../AWING';
3
+ import { DataObject, IMultipleHierarchicalChoiceProps, MenuOption } from '../../AWING';
4
4
  import { IMainObj, IListFunctions } from '../../AWING/LogicExpression/interface';
5
5
  import { GeoFencingValue, IConfig } from '../../ACM-AXN/GeoFencing/interface';
6
6
  import { Moment } from 'moment';
@@ -44,6 +44,7 @@ export type AutocompleteFieldDefinition<T extends DataObject> = BaseFieldDefinit
44
44
  type: 'autocomplete';
45
45
  options: Array<MenuOption>;
46
46
  loading?: boolean;
47
+ disableClearable?: boolean;
47
48
  };
48
49
  export interface CheckBoxFieldDefinition<T extends DataObject> extends BaseFieldDefinition<T> {
49
50
  type: 'checkbox';
@@ -122,5 +123,8 @@ export type SelectFieldDefinition<T extends DataObject> = BaseFieldDefinition<T>
122
123
  row?: Partial<T>;
123
124
  onDisabledSelectItem?: (value: any, row?: Partial<T>) => boolean;
124
125
  };
125
- export type FieldDefinition<T extends DataObject> = AsyncAutocompleteFieldDefinition<T> | AutocompleteFieldDefinition<T> | LogicExpressionDefinition<T> | CheckBoxFieldDefinition<T> | DateTimeFieldDefinition<T> | DateRangeFieldDefinition<T> | NumberFieldDefinition<T> | RadioFieldDefinition<T> | SelectFieldDefinition<T> | TextFieldDefinition<T> | GeoFencingDefinition<T>;
126
+ export type MultipleHierarchicalDefinition<T extends DataObject> = BaseFieldDefinition<T> & Omit<IMultipleHierarchicalChoiceProps, 'defaultValue' | 'onChange'> & {
127
+ type: 'multiple-hierarchical';
128
+ };
129
+ export type FieldDefinition<T extends DataObject> = AsyncAutocompleteFieldDefinition<T> | AutocompleteFieldDefinition<T> | LogicExpressionDefinition<T> | CheckBoxFieldDefinition<T> | DateTimeFieldDefinition<T> | DateRangeFieldDefinition<T> | NumberFieldDefinition<T> | RadioFieldDefinition<T> | SelectFieldDefinition<T> | TextFieldDefinition<T> | GeoFencingDefinition<T> | MultipleHierarchicalDefinition<T>;
126
130
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.29-beta",
3
+ "version": "2.1.31-beta",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",