indicator-ui 0.0.261 → 0.0.262

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.
package/dist/index.js CHANGED
@@ -32679,10 +32679,10 @@ function InputFieldWrapper(_ref) {
32679
32679
  "use strict";
32680
32680
  __webpack_require__.r(__webpack_exports__);
32681
32681
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32682
- /* harmony export */ RadioField: () => (/* reexport safe */ _ui_RadioField__WEBPACK_IMPORTED_MODULE_1__["default"])
32682
+ /* harmony export */ RadioField: () => (/* reexport safe */ _ui__WEBPACK_IMPORTED_MODULE_1__.RadioField)
32683
32683
  /* harmony export */ });
32684
32684
  /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./src/ui/InputFields/RadioField/types/index.ts");
32685
- /* harmony import */ var _ui_RadioField__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ui/RadioField */ "./src/ui/InputFields/RadioField/ui/RadioField.tsx");
32685
+ /* harmony import */ var _ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ui */ "./src/ui/InputFields/RadioField/ui/index.ts");
32686
32686
 
32687
32687
 
32688
32688
 
@@ -32736,15 +32736,12 @@ __webpack_require__.r(__webpack_exports__);
32736
32736
  "use strict";
32737
32737
  __webpack_require__.r(__webpack_exports__);
32738
32738
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32739
- /* harmony export */ "default": () => (/* binding */ RadioField)
32739
+ /* harmony export */ RadioField: () => (/* binding */ RadioField)
32740
32740
  /* harmony export */ });
32741
32741
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
32742
32742
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
32743
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
32744
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
32743
+ /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/hooks */ "./src/hooks/index.ts");
32745
32744
  /* harmony import */ var _RadioFieldItem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./RadioFieldItem */ "./src/ui/InputFields/RadioField/ui/RadioFieldItem.tsx");
32746
- 'use client';
32747
-
32748
32745
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
32749
32746
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
32750
32747
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -32762,57 +32759,45 @@ function RadioField(_ref) {
32762
32759
  _ref$required = _ref.required,
32763
32760
  required = _ref$required === void 0 ? false : _ref$required,
32764
32761
  _ref$multiple = _ref.multiple,
32765
- multiple = _ref$multiple === void 0 ? true : _ref$multiple,
32762
+ multiple = _ref$multiple === void 0 ? false : _ref$multiple,
32766
32763
  _ref$disabled = _ref.disabled,
32767
32764
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
32768
32765
  _ref$width = _ref.width,
32769
32766
  width = _ref$width === void 0 ? 'hug' : _ref$width,
32770
32767
  _ref$type = _ref.type,
32771
32768
  type = _ref$type === void 0 ? 'checkbox' : _ref$type;
32772
- (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
32773
- if (required && options[0] && (value === undefined || Array.isArray(value) && value.length === 0)) {
32774
- onChange && onChange(options[0].value);
32775
- }
32776
- }, []);
32777
- var handleChange = function handleChange(option) {
32778
- var newValue;
32779
- if (value) {
32780
- if (Array.isArray(value)) {
32781
- newValue = _toConsumableArray(value);
32782
- } else {
32783
- newValue = [value];
32784
- }
32785
- } else {
32786
- newValue = [];
32769
+ (0,_hooks__WEBPACK_IMPORTED_MODULE_1__.useDeepCompareEffect)(function () {
32770
+ // Установка значения при required
32771
+ var firstOptions = options === null || options === void 0 ? void 0 : options[0];
32772
+ if (required && (value === undefined || Array.isArray(value) && !value.length) && firstOptions) {
32773
+ handleClick(firstOptions.value);
32787
32774
  }
32788
- if (!!newValue.find(function (item) {
32789
- return JSON.stringify(item) === JSON.stringify(option.value);
32775
+ }, [options, required, value]);
32776
+ var handleClick = function handleClick(data) {
32777
+ var saveValue = value || [];
32778
+ var prevValue = Array.isArray(saveValue) ? saveValue : [saveValue];
32779
+ var resValues;
32780
+ if (prevValue.find(function (item) {
32781
+ return data === item;
32790
32782
  })) {
32791
- newValue = newValue.filter(function (item) {
32792
- return JSON.stringify(item) !== JSON.stringify(option.value);
32783
+ resValues = prevValue.filter(function (item) {
32784
+ return data !== item;
32793
32785
  });
32794
32786
  } else {
32795
- newValue = [].concat(_toConsumableArray(newValue), [option.value]);
32787
+ resValues = [].concat(_toConsumableArray(prevValue), [data]);
32796
32788
  }
32797
- if (required && newValue.length === 0) {
32798
- if (value) {
32799
- if (Array.isArray(value)) {
32800
- newValue = _toConsumableArray(value);
32801
- } else {
32802
- newValue = [value];
32803
- }
32804
- } else {
32805
- if (options[0]) newValue = [options[0]];
32806
- }
32789
+ if (required && !resValues.length) {
32790
+ resValues = prevValue;
32807
32791
  }
32808
- if (!multiple) {
32809
- newValue = [newValue[newValue.length - 1]];
32792
+ if (multiple) {
32793
+ onChange === null || onChange === void 0 || onChange(resValues);
32794
+ } else {
32795
+ onChange === null || onChange === void 0 || onChange(resValues[resValues.length - 1]);
32810
32796
  }
32811
- onChange && onChange(newValue);
32812
32797
  };
32813
32798
  var isActive = function isActive(option) {
32814
32799
  if (Array.isArray(value)) {
32815
- return value.find(function (item) {
32800
+ return !!value.find(function (item) {
32816
32801
  return JSON.stringify(item) === JSON.stringify(option.value);
32817
32802
  });
32818
32803
  } else {
@@ -32825,7 +32810,7 @@ function RadioField(_ref) {
32825
32810
  option: item,
32826
32811
  type: type,
32827
32812
  onClick: function onClick() {
32828
- return handleChange(item);
32813
+ return handleClick(item.value);
32829
32814
  },
32830
32815
  active: isActive(item),
32831
32816
  disabled: disabled,
@@ -32885,6 +32870,22 @@ function RadioFieldItem(_ref) {
32885
32870
  });
32886
32871
  }
32887
32872
 
32873
+ /***/ }),
32874
+
32875
+ /***/ "./src/ui/InputFields/RadioField/ui/index.ts":
32876
+ /*!***************************************************!*\
32877
+ !*** ./src/ui/InputFields/RadioField/ui/index.ts ***!
32878
+ \***************************************************/
32879
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
32880
+
32881
+ "use strict";
32882
+ __webpack_require__.r(__webpack_exports__);
32883
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32884
+ /* harmony export */ RadioField: () => (/* reexport safe */ _RadioField__WEBPACK_IMPORTED_MODULE_0__.RadioField)
32885
+ /* harmony export */ });
32886
+ /* harmony import */ var _RadioField__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./RadioField */ "./src/ui/InputFields/RadioField/ui/RadioField.tsx");
32887
+
32888
+
32888
32889
  /***/ }),
32889
32890
 
32890
32891
  /***/ "./src/ui/InputFields/SelectField/config/index.ts":
@@ -33092,11 +33093,11 @@ __webpack_require__.r(__webpack_exports__);
33092
33093
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
33093
33094
  /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/hooks */ "./src/hooks/index.ts");
33094
33095
  /* harmony import */ var _ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/ui */ "./src/ui/index.ts");
33095
- /* harmony import */ var _FlexField__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../FlexField */ "./src/ui/InputFields/FlexField/index.ts");
33096
- /* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../lib */ "./src/ui/InputFields/SelectField/lib/index.ts");
33097
- /* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../styles */ "./src/ui/InputFields/SelectField/styles/index.ts");
33098
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../config */ "./src/ui/InputFields/SelectField/config/index.ts");
33099
- /* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/lib */ "./src/lib/index.ts");
33096
+ /* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/lib */ "./src/lib/index.ts");
33097
+ /* harmony import */ var _FlexField__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../FlexField */ "./src/ui/InputFields/FlexField/index.ts");
33098
+ /* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../lib */ "./src/ui/InputFields/SelectField/lib/index.ts");
33099
+ /* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../styles */ "./src/ui/InputFields/SelectField/styles/index.ts");
33100
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../config */ "./src/ui/InputFields/SelectField/config/index.ts");
33100
33101
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
33101
33102
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
33102
33103
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -33135,8 +33136,7 @@ function SelectField(_ref) {
33135
33136
  searching = _ref.searching,
33136
33137
  _ref$required = _ref.required,
33137
33138
  required = _ref$required === void 0 ? false : _ref$required,
33138
- _ref$multiple = _ref.multiple,
33139
- multiple = _ref$multiple === void 0 ? true : _ref$multiple,
33139
+ multiple = _ref.multiple,
33140
33140
  _ref$disabled = _ref.disabled,
33141
33141
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
33142
33142
  onBlur = _ref.onBlur,
@@ -33167,7 +33167,7 @@ function SelectField(_ref) {
33167
33167
  // Установка значения при required
33168
33168
  var firstOptions = optionsState === null || optionsState === void 0 ? void 0 : optionsState[0];
33169
33169
  if (required && (value === undefined || Array.isArray(value) && !value.length) && firstOptions) {
33170
- handleClick((0,_lib__WEBPACK_IMPORTED_MODULE_5__.getSelectFieldOptionsItemValue)(firstOptions));
33170
+ handleClick((0,_lib__WEBPACK_IMPORTED_MODULE_6__.getSelectFieldOptionsItemValue)(firstOptions));
33171
33171
  }
33172
33172
  return function () {
33173
33173
  // Отчистка таймаута для searching
@@ -33175,7 +33175,7 @@ function SelectField(_ref) {
33175
33175
  clearTimeout(searchingTimeoutRef.current);
33176
33176
  }
33177
33177
  };
33178
- }, [optionsState]);
33178
+ }, [optionsState, required, value]);
33179
33179
  (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
33180
33180
  fillOptionsCache(value);
33181
33181
  onScrollToBottom();
@@ -33202,7 +33202,6 @@ function SelectField(_ref) {
33202
33202
  }
33203
33203
  };
33204
33204
  var handleClick = function handleClick(data) {
33205
- fillOptionsCache(data);
33206
33205
  var saveValue = value || [];
33207
33206
  var prevValue = Array.isArray(saveValue) ? saveValue : [saveValue];
33208
33207
  var resValues;
@@ -33218,6 +33217,7 @@ function SelectField(_ref) {
33218
33217
  if (required && !resValues.length) {
33219
33218
  resValues = prevValue;
33220
33219
  }
33220
+ fillOptionsCache(resValues);
33221
33221
  if (multiple) {
33222
33222
  onChange === null || onChange === void 0 || onChange(resValues);
33223
33223
  } else {
@@ -33258,7 +33258,7 @@ function SelectField(_ref) {
33258
33258
  setTimeout(function () {
33259
33259
  requestPromiseRef.current = undefined;
33260
33260
  }, 0);
33261
- return (0,_lib__WEBPACK_IMPORTED_MODULE_8__.uniqueByKey)(updatedOptions, 'value');
33261
+ return (0,_lib__WEBPACK_IMPORTED_MODULE_4__.uniqueByKey)(updatedOptions, 'value');
33262
33262
  });
33263
33263
  _context.next = 16;
33264
33264
  break;
@@ -33306,9 +33306,14 @@ function SelectField(_ref) {
33306
33306
  };
33307
33307
  var getOptionsItems = function getOptionsItems() {
33308
33308
  return optionsState.map(function (item) {
33309
- return _typeof(item) === 'object' && 'value' in item ? _objectSpread({
33310
- text: item.label
33311
- }, item) : {
33309
+ var value = (0,_lib__WEBPACK_IMPORTED_MODULE_6__.getSelectFieldOptionsItemValue)(item);
33310
+ if (_typeof(item) === 'object' && 'value' in item) {
33311
+ return _objectSpread(_objectSpread({}, item), {}, {
33312
+ text: item.label,
33313
+ value: value
33314
+ });
33315
+ }
33316
+ return {
33312
33317
  text: String(item),
33313
33318
  value: item
33314
33319
  };
@@ -33322,15 +33327,15 @@ function SelectField(_ref) {
33322
33327
  }
33323
33328
  searchingTimeoutRef.current = setTimeout(function () {
33324
33329
  searching(searchString, optionsState).then(function (newOptions) {
33325
- return newOptions !== undefined && setOptionsState((0,_lib__WEBPACK_IMPORTED_MODULE_8__.uniqueByKey)(newOptions, 'value'));
33330
+ return newOptions !== undefined && setOptionsState((0,_lib__WEBPACK_IMPORTED_MODULE_4__.uniqueByKey)(newOptions, 'value'));
33326
33331
  });
33327
- }, _config__WEBPACK_IMPORTED_MODULE_7__.SEARCHING_DELAY_TIME);
33332
+ }, _config__WEBPACK_IMPORTED_MODULE_8__.SEARCHING_DELAY_TIME);
33328
33333
  }
33329
33334
  };
33330
33335
  var getViewField = function getViewField() {
33331
33336
  if (searching !== undefined) {
33332
- return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_FlexField__WEBPACK_IMPORTED_MODULE_4__.FlexField, {
33333
- value: isFocus ? searchingString : (0,_lib__WEBPACK_IMPORTED_MODULE_5__.getStringValue)(value, [].concat(_toConsumableArray(optionsState), _toConsumableArray(optionsCacheRef.current))),
33337
+ return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_FlexField__WEBPACK_IMPORTED_MODULE_5__.FlexField, {
33338
+ value: isFocus ? searchingString : (0,_lib__WEBPACK_IMPORTED_MODULE_6__.getStringValue)(value, [].concat(_toConsumableArray(optionsState), _toConsumableArray(optionsCacheRef.current))),
33334
33339
  onChange: search,
33335
33340
  disabled: disabled,
33336
33341
  onFocus: function onFocus() {
@@ -33353,8 +33358,8 @@ function SelectField(_ref) {
33353
33358
  ref: inputRef
33354
33359
  });
33355
33360
  }
33356
- return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_FlexField__WEBPACK_IMPORTED_MODULE_4__.FlexField, {
33357
- value: (0,_lib__WEBPACK_IMPORTED_MODULE_5__.getStringValue)(value, [].concat(_toConsumableArray(optionsState), _toConsumableArray(optionsCacheRef.current))),
33361
+ return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_FlexField__WEBPACK_IMPORTED_MODULE_5__.FlexField, {
33362
+ value: (0,_lib__WEBPACK_IMPORTED_MODULE_6__.getStringValue)(value, [].concat(_toConsumableArray(optionsState), _toConsumableArray(optionsCacheRef.current))),
33358
33363
  isError: isError,
33359
33364
  disabled: disabled,
33360
33365
  placeholder: placeholder,
@@ -33371,9 +33376,9 @@ function SelectField(_ref) {
33371
33376
  });
33372
33377
  };
33373
33378
  return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
33374
- className: _styles__WEBPACK_IMPORTED_MODULE_6__.SelectFieldStyle.selectField,
33379
+ className: _styles__WEBPACK_IMPORTED_MODULE_7__.SelectFieldStyle.selectField,
33375
33380
  children: [getViewField(), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
33376
- className: _styles__WEBPACK_IMPORTED_MODULE_6__.SelectFieldStyle.modalWindowWrapper,
33381
+ className: _styles__WEBPACK_IMPORTED_MODULE_7__.SelectFieldStyle.modalWindowWrapper,
33377
33382
  children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ui__WEBPACK_IMPORTED_MODULE_3__.ModalWindowWrapper, {
33378
33383
  isShow: isShowModalWindow,
33379
33384
  setIsShow: function setIsShow(newValue) {
@@ -33383,7 +33388,7 @@ function SelectField(_ref) {
33383
33388
  setIsShowModalWindow(newValue);
33384
33389
  },
33385
33390
  additionElements: [inputRef.current],
33386
- className: _styles__WEBPACK_IMPORTED_MODULE_6__.SelectFieldStyle.modalWindow,
33391
+ className: _styles__WEBPACK_IMPORTED_MODULE_7__.SelectFieldStyle.modalWindow,
33387
33392
  children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ui__WEBPACK_IMPORTED_MODULE_3__.Dropdown, {
33388
33393
  items: getOptionsItems(),
33389
33394
  onScrollBottom: onScrollToBottom,