awing-library 2.1.216-dev → 2.1.218-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.
@@ -61,6 +61,7 @@ function getColorByVariant(variant) {
61
61
  return '#d10717';
62
62
  case '1':
63
63
  case 'click':
64
+ case 'authenticationsuccess':
64
65
  return '#004b95';
65
66
  case '2':
66
67
  case 'engagement':
@@ -72,6 +73,7 @@ function getColorByVariant(variant) {
72
73
  return '#8bc1f7';
73
74
  case '4':
74
75
  case 'ctr':
76
+ case 'ar':
75
77
  return '#518be9';
76
78
  case '5':
77
79
  case 'other':
@@ -10,6 +10,29 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
13
36
  var __rest = (this && this.__rest) || function (s, e) {
14
37
  var t = {};
15
38
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -28,7 +51,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
28
51
  var react_1 = require("react");
29
52
  var jsx_runtime_1 = require("react/jsx-runtime");
30
53
  // @ts-nocheck
31
- var react_2 = __importDefault(require("react"));
54
+ var react_2 = __importStar(require("react"));
32
55
  var moment_1 = __importDefault(require("moment"));
33
56
  var react_i18next_1 = require("react-i18next");
34
57
  var material_1 = require("@mui/material");
@@ -48,6 +71,7 @@ function DataInput(props) {
48
71
  var fieldDefinition = props.fieldDefinition, onChange = props.onChange, value = props.value, error = props.error, disableHelperText = props.disableHelperText;
49
72
  var fieldName = fieldDefinition.fieldName, type = fieldDefinition.type, onValidate = fieldDefinition.onValidate, min = fieldDefinition.min, max = fieldDefinition.max, pattern = fieldDefinition.pattern, other = __rest(fieldDefinition, ["fieldName", "type", "onValidate", "min", "max", "pattern"]);
50
73
  var _o = react_2.default.useState(t('Common.InvalidData')), errorText = _o[0], setErrorText = _o[1];
74
+ var _p = react_2.default.useState(type === 'number' ? value : ''), numberValue = _p[0], setNumberValue = _p[1];
51
75
  var checkValidationValue = function (fieldDefinition, val) {
52
76
  if (!fieldDefinition.required &&
53
77
  (val === undefined ||
@@ -97,6 +121,20 @@ function DataInput(props) {
97
121
  return (0, validation_1.notNullValid)(val);
98
122
  }
99
123
  };
124
+ (0, react_2.useEffect)(function () {
125
+ if (type === 'number' && Number(value) !== Number(numberValue))
126
+ setNumberValue(Number(value));
127
+ // eslint-disable-next-line react-hooks/exhaustive-deps
128
+ }, [type, value]);
129
+ var handleParamValueChange = function () {
130
+ var newValue = Number(numberValue);
131
+ onChange(newValue, checkValidationValue(fieldDefinition, newValue));
132
+ };
133
+ (0, react_2.useEffect)(function () {
134
+ if (type === 'number' && Number(value) !== Number(numberValue))
135
+ handleParamValueChange();
136
+ // eslint-disable-next-line react-hooks/exhaustive-deps
137
+ }, [numberValue, type]);
100
138
  switch (type) {
101
139
  case 'logic-expression': {
102
140
  return ((0, jsx_runtime_1.jsx)(LogicExpression_1.default, __assign({ cf: function (newValue, valid) {
@@ -163,7 +201,7 @@ function DataInput(props) {
163
201
  }, readOnly: fieldDefinition.readOnly }));
164
202
  }
165
203
  case 'date-range': {
166
- var _p = other, isDayBlocked = _p.isDayBlocked, isOutsideRange = _p.isOutsideRange;
204
+ var _q = other, isDayBlocked = _q.isDayBlocked, isOutsideRange = _q.isOutsideRange;
167
205
  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: {
168
206
  startDate: (value === null || value === void 0 ? void 0 : value[0]) || null,
169
207
  endDate: (value === null || value === void 0 ? void 0 : value[1]) || null,
@@ -175,9 +213,9 @@ function DataInput(props) {
175
213
  : '', disableHelperText: disableHelperText, isDayBlocked: isDayBlocked, isOutsideRange: isOutsideRange }));
176
214
  }
177
215
  case 'number': {
178
- 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) {
179
- var newValue = Number(event.target.value);
180
- onChange(newValue, checkValidationValue(fieldDefinition, newValue));
216
+ return ((0, jsx_runtime_1.jsx)(AWING_1.NumberFormat, __assign({ id: fieldName.toString(), name: fieldName.toString(), fullWidth: true, variant: "standard" }, other, { value: numberValue !== null && numberValue !== void 0 ? numberValue : '', onChange: function (event) {
217
+ var newValue = event.target.value;
218
+ setNumberValue(newValue);
181
219
  }, error: error, helperText: !disableHelperText && error
182
220
  ? (_h = fieldDefinition.helperText) !== null && _h !== void 0 ? _h : t('Common.InvalidData')
183
221
  : '' })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.216-dev",
3
+ "version": "2.1.218-dev",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",