intelicoreact 1.5.23 → 1.5.24

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.
@@ -33,7 +33,9 @@ const RangeInputs = _ref => {
33
33
  testId,
34
34
  withZero = false,
35
35
  fromPlaceholder = "",
36
- toPlaceholder = ""
36
+ toPlaceholder = "",
37
+ disabled,
38
+ isDisabled
37
39
  } = _ref;
38
40
  const [error, setError] = (0, _react.useState)({
39
41
  from: "",
@@ -41,6 +43,7 @@ const RangeInputs = _ref => {
41
43
  });
42
44
  const inputFromRef = (0, _react.useRef)(null);
43
45
  const inputToRef = (0, _react.useRef)(null);
46
+ const isFieldDisabled = disabled || isDisabled;
44
47
  const isValidRange = (from, to) => {
45
48
  var _from$toString, _to$toString;
46
49
  const correctFrom = parseFloat(from === null || from === void 0 || (_from$toString = from.toString()) === null || _from$toString === void 0 ? void 0 : _from$toString.replace(/[^\d]/g, ""));
@@ -129,7 +132,8 @@ const RangeInputs = _ref => {
129
132
  }
130
133
  }
131
134
  },
132
- placeholder: fromPlaceholder
135
+ placeholder: fromPlaceholder,
136
+ disabled: isFieldDisabled
133
137
  })), /*#__PURE__*/_react.default.createElement("div", {
134
138
  className: "".concat(RC, "__input-to")
135
139
  }, /*#__PURE__*/_react.default.createElement("span", {
@@ -144,7 +148,8 @@ const RangeInputs = _ref => {
144
148
  onKeyUp: (code, e) => {
145
149
  if (code === 13) inputToRef.current.blur();
146
150
  },
147
- placeholder: toPlaceholder
151
+ placeholder: toPlaceholder,
152
+ disabled: isFieldDisabled
148
153
  }))));
149
154
  };
150
155
  var _default = exports.default = RangeInputs;
@@ -5,8 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _utils = require("lib/dist/Functions/utils");
8
9
  var _ApiUtils = _interopRequireDefault(require("./ApiUtils"));
9
- var _utils = require("./_utils");
10
+ var _utils2 = require("./_utils");
10
11
  //? Префикс createRequest_ добавляется к крейтерам с целью разгрузить пространство имен
11
12
  const PREFIX_OF_CLASS_UTILS = "createRequest_";
12
13
  class ApiRequestCreators extends _ApiUtils.default {
@@ -15,19 +16,20 @@ class ApiRequestCreators extends _ApiUtils.default {
15
16
  const {
16
17
  requestsCreators
17
18
  } = settings || {};
18
- if ((0, _utils.getIsOnlyAnObject)(requestsCreators)) _utils.addCustomMethods.call(this, requestsCreators, PREFIX_OF_CLASS_UTILS);
19
+ if ((0, _utils2.getIsOnlyAnObject)(requestsCreators)) _utils2.addCustomMethods.call(this, requestsCreators, PREFIX_OF_CLASS_UTILS);
19
20
  }
20
21
 
21
22
  //? При типе toJson пользовательский callback на вход получит тело ответа реализованное методом Response.json()
22
23
  //? независимо от насторойки isGetBody
23
24
  async createRequest_toJson(props, variant) {
25
+ const safelyProps = (0, _utils.omitKeys)(props, ['getBodyAs']);
24
26
  return this.splitProperties({
25
- ...props,
27
+ ...safelyProps,
26
28
  isGetBody: false,
27
29
  callback: async res => {
28
- var _props$callback, _props$callback2;
30
+ var _safelyProps$callback, _safelyProps$callback2;
29
31
  const output = await this.getResponseBody(res, 'json');
30
- return await ((_props$callback = (_props$callback2 = props.callback) === null || _props$callback2 === void 0 ? void 0 : _props$callback2.call(props, output)) !== null && _props$callback !== void 0 ? _props$callback : output);
32
+ return await ((_safelyProps$callback = (_safelyProps$callback2 = safelyProps.callback) === null || _safelyProps$callback2 === void 0 ? void 0 : _safelyProps$callback2.call(safelyProps, output)) !== null && _safelyProps$callback !== void 0 ? _safelyProps$callback : output);
31
33
  }
32
34
  }, variant);
33
35
  }
@@ -36,16 +38,17 @@ class ApiRequestCreators extends _ApiUtils.default {
36
38
  //? где response - объект Response, result - тело ответа реализованное методом Response.json()
37
39
  //? независимо от насторойки isGetBody
38
40
  async createRequest_toJsonAdvanced(props, variant) {
41
+ const safelyProps = (0, _utils.omitKeys)(props, ['getBodyAs']);
39
42
  return this.splitProperties({
40
- ...props,
43
+ ...safelyProps,
41
44
  isGetBody: false,
42
45
  callback: async res => {
43
- var _props$callback3, _props$callback4;
46
+ var _safelyProps$callback3, _safelyProps$callback4;
44
47
  const output = {
45
48
  response: res,
46
- result: await this.getResponseBody(await (0, _utils.getResponseClone)(res))
49
+ result: await this.getResponseBody(await (0, _utils2.getResponseClone)(res), 'json')
47
50
  };
48
- return await ((_props$callback3 = (_props$callback4 = props.callback) === null || _props$callback4 === void 0 ? void 0 : _props$callback4.call(props, output)) !== null && _props$callback3 !== void 0 ? _props$callback3 : output);
51
+ return await ((_safelyProps$callback3 = (_safelyProps$callback4 = safelyProps.callback) === null || _safelyProps$callback4 === void 0 ? void 0 : _safelyProps$callback4.call(safelyProps, output)) !== null && _safelyProps$callback3 !== void 0 ? _safelyProps$callback3 : output);
49
52
  }
50
53
  }, variant);
51
54
  }
@@ -53,13 +56,14 @@ class ApiRequestCreators extends _ApiUtils.default {
53
56
  //? При типе blob пользовательский callback на вход получит тело ответа реализованное методом Response.blob(),
54
57
  //? независимо от насторойки isGetBody
55
58
  async createRequest_blob(props, variant) {
59
+ const safelyProps = (0, _utils.omitKeys)(props, ['getBodyAs']);
56
60
  return this.splitProperties({
57
- ...props,
61
+ ...safelyProps,
58
62
  isGetBody: false,
59
63
  callback: async res => {
60
- var _props$callback5, _props$callback6;
61
- const output = await this.getResponseBody(await (0, _utils.getResponseClone)(res), 'blob');
62
- return await ((_props$callback5 = (_props$callback6 = props.callback) === null || _props$callback6 === void 0 ? void 0 : _props$callback6.call(props, output)) !== null && _props$callback5 !== void 0 ? _props$callback5 : output);
64
+ var _safelyProps$callback5, _safelyProps$callback6;
65
+ const output = await this.getResponseBody(await (0, _utils2.getResponseClone)(res), 'blob');
66
+ return await ((_safelyProps$callback5 = (_safelyProps$callback6 = safelyProps.callback) === null || _safelyProps$callback6 === void 0 ? void 0 : _safelyProps$callback6.call(safelyProps, output)) !== null && _safelyProps$callback5 !== void 0 ? _safelyProps$callback5 : output);
63
67
  }
64
68
  }, variant);
65
69
  }
@@ -82,8 +86,8 @@ class ApiRequestCreators extends _ApiUtils.default {
82
86
  return headers;
83
87
  })()
84
88
  })).then(res => {
85
- var _props$callback7, _props$callback8;
86
- return (_props$callback7 = (_props$callback8 = props.callback) === null || _props$callback8 === void 0 ? void 0 : _props$callback8.call(props, res)) !== null && _props$callback7 !== void 0 ? _props$callback7 : res;
89
+ var _props$callback, _props$callback2;
90
+ return (_props$callback = (_props$callback2 = props.callback) === null || _props$callback2 === void 0 ? void 0 : _props$callback2.call(props, res)) !== null && _props$callback !== void 0 ? _props$callback : res;
87
91
  })
88
92
  }, variant);
89
93
  }
@@ -199,7 +199,13 @@ const formatAsPercentage = (value, settings) => {
199
199
  isCommonPercentageSymbol = true,
200
200
  decimalPlaces = 2,
201
201
  beforeValueSymbol = "",
202
- afterValueSymbol = ""
202
+ afterValueSymbol = "",
203
+ isGlueSameRangesTogether = false,
204
+ // ? Тут удобный ф-л, поэтому иной раз удобно обработать обычный диапазан (НЕ проценты).
205
+ // ? Добавил возможность выпиливать значек процентов.
206
+ // todo(VL) - вообще правильно заренеймить (formatAsDiapason), а добавление процентов сделать как опцию,
207
+ // todo(VL) - но как обычно нет времени, нужно будет перечекать по всем проектам где тянется со старым неймингом
208
+ isUseAsSimpleDiapason = false
203
209
  } = (0, _utils.getIsOnlyAnObject)(settings) ? settings : {};
204
210
  let safelyInputValue;
205
211
  const checkValue = value => getSafelyValue(value) || "0";
@@ -227,10 +233,16 @@ const formatAsPercentage = (value, settings) => {
227
233
  to: checkValue(valuesArr[1])
228
234
  };
229
235
  } else {
230
- return "".concat(beforeValueSymbol).concat(transform(safelyInputValue)).concat(afterValueSymbol, "%");
236
+ // Вариант когда велью передано строкой (НЕ объектом) и оно не содержит сепаратора " - "
237
+ // - одиночные велью
238
+ // - некорректный диапазон
239
+ return "".concat(beforeValueSymbol).concat(transform(safelyInputValue)).concat(afterValueSymbol).concat(isUseAsSimpleDiapason ? '' : '%');
231
240
  }
232
241
  }
233
- if (isCommonPercentageSymbol) return "".concat(beforeValueSymbol).concat(transform(safelyInputValue.from), " - ").concat(transform(safelyInputValue.to)).concat(afterValueSymbol, "%");else return "".concat(beforeValueSymbol).concat(transform(safelyInputValue.from), "% - ").concat(transform(safelyInputValue.to), "%").concat(afterValueSymbol);
242
+ if (safelyInputValue.from === safelyInputValue.to && !!isGlueSameRangesTogether) {
243
+ return "".concat(beforeValueSymbol).concat(transform(safelyInputValue.from)).concat(afterValueSymbol).concat(isUseAsSimpleDiapason ? '' : '%');
244
+ }
245
+ if (isCommonPercentageSymbol) return "".concat(beforeValueSymbol).concat(transform(safelyInputValue.from), " - ").concat(transform(safelyInputValue.to)).concat(afterValueSymbol).concat(isUseAsSimpleDiapason ? '' : '%');else return "".concat(beforeValueSymbol).concat(transform(safelyInputValue.from)).concat(isUseAsSimpleDiapason ? '' : '%', " - ").concat(transform(safelyInputValue.to)).concat(isUseAsSimpleDiapason ? '' : '%').concat(afterValueSymbol);
234
246
  };
235
247
 
236
248
  // eslint-disable-next-line no-control-regex
@@ -56,6 +56,7 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
56
56
  getActualForm
57
57
  }) : {};
58
58
  const getMainOfAdditional = (onChange, additionalOfOnChange) => ({
59
+ formId,
59
60
  actions: anotherActions,
60
61
  isInit: true,
61
62
  ...((0, _utils.getIsOnlyAnObject)(additionalOfOnChange) ? additionalOfOnChange : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.5.23",
3
+ "version": "1.5.24",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [