indicator-ui 0.0.261 → 0.0.263

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
@@ -32661,7 +32661,6 @@ function InputFieldWrapper(_ref) {
32661
32661
  }
32662
32662
  return undefined;
32663
32663
  };
32664
- console.log(_defineProperty({}, _styles__WEBPACK_IMPORTED_MODULE_2__.InputFieldWrapperStyle.display, display === "small" || display === "large"));
32665
32664
  return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
32666
32665
  className: (0,clsx__WEBPACK_IMPORTED_MODULE_1__["default"])(_styles__WEBPACK_IMPORTED_MODULE_2__.InputFieldWrapperStyle.inputFieldWrapper, _defineProperty(_defineProperty({}, _styles__WEBPACK_IMPORTED_MODULE_2__.InputFieldWrapperStyle.isError, isError), _styles__WEBPACK_IMPORTED_MODULE_2__.InputFieldWrapperStyle.display, display === "small" || display === "large"), getClassName('main')),
32667
32666
  children: [getLabelContent(), children, getHintContent(), getHelperLinkContent()]
@@ -32679,10 +32678,10 @@ function InputFieldWrapper(_ref) {
32679
32678
  "use strict";
32680
32679
  __webpack_require__.r(__webpack_exports__);
32681
32680
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32682
- /* harmony export */ RadioField: () => (/* reexport safe */ _ui_RadioField__WEBPACK_IMPORTED_MODULE_1__["default"])
32681
+ /* harmony export */ RadioField: () => (/* reexport safe */ _ui__WEBPACK_IMPORTED_MODULE_1__.RadioField)
32683
32682
  /* harmony export */ });
32684
32683
  /* 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");
32684
+ /* harmony import */ var _ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ui */ "./src/ui/InputFields/RadioField/ui/index.ts");
32686
32685
 
32687
32686
 
32688
32687
 
@@ -32736,15 +32735,12 @@ __webpack_require__.r(__webpack_exports__);
32736
32735
  "use strict";
32737
32736
  __webpack_require__.r(__webpack_exports__);
32738
32737
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32739
- /* harmony export */ "default": () => (/* binding */ RadioField)
32738
+ /* harmony export */ RadioField: () => (/* binding */ RadioField)
32740
32739
  /* harmony export */ });
32741
32740
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
32742
32741
  /* 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__);
32742
+ /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/hooks */ "./src/hooks/index.ts");
32745
32743
  /* harmony import */ var _RadioFieldItem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./RadioFieldItem */ "./src/ui/InputFields/RadioField/ui/RadioFieldItem.tsx");
32746
- 'use client';
32747
-
32748
32744
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
32749
32745
  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
32746
  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 +32758,45 @@ function RadioField(_ref) {
32762
32758
  _ref$required = _ref.required,
32763
32759
  required = _ref$required === void 0 ? false : _ref$required,
32764
32760
  _ref$multiple = _ref.multiple,
32765
- multiple = _ref$multiple === void 0 ? true : _ref$multiple,
32761
+ multiple = _ref$multiple === void 0 ? false : _ref$multiple,
32766
32762
  _ref$disabled = _ref.disabled,
32767
32763
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
32768
32764
  _ref$width = _ref.width,
32769
32765
  width = _ref$width === void 0 ? 'hug' : _ref$width,
32770
32766
  _ref$type = _ref.type,
32771
32767
  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 = [];
32768
+ (0,_hooks__WEBPACK_IMPORTED_MODULE_1__.useDeepCompareEffect)(function () {
32769
+ // Установка значения при required
32770
+ var firstOptions = options === null || options === void 0 ? void 0 : options[0];
32771
+ if (required && (value === undefined || Array.isArray(value) && !value.length) && firstOptions) {
32772
+ handleClick(firstOptions.value);
32787
32773
  }
32788
- if (!!newValue.find(function (item) {
32789
- return JSON.stringify(item) === JSON.stringify(option.value);
32774
+ }, [options, required, value]);
32775
+ var handleClick = function handleClick(data) {
32776
+ var saveValue = value || [];
32777
+ var prevValue = Array.isArray(saveValue) ? saveValue : [saveValue];
32778
+ var resValues;
32779
+ if (prevValue.find(function (item) {
32780
+ return data === item;
32790
32781
  })) {
32791
- newValue = newValue.filter(function (item) {
32792
- return JSON.stringify(item) !== JSON.stringify(option.value);
32782
+ resValues = prevValue.filter(function (item) {
32783
+ return data !== item;
32793
32784
  });
32794
32785
  } else {
32795
- newValue = [].concat(_toConsumableArray(newValue), [option.value]);
32786
+ resValues = [].concat(_toConsumableArray(prevValue), [data]);
32796
32787
  }
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
- }
32788
+ if (required && !resValues.length) {
32789
+ resValues = prevValue;
32807
32790
  }
32808
- if (!multiple) {
32809
- newValue = [newValue[newValue.length - 1]];
32791
+ if (multiple) {
32792
+ onChange === null || onChange === void 0 || onChange(resValues);
32793
+ } else {
32794
+ onChange === null || onChange === void 0 || onChange(resValues[resValues.length - 1]);
32810
32795
  }
32811
- onChange && onChange(newValue);
32812
32796
  };
32813
32797
  var isActive = function isActive(option) {
32814
32798
  if (Array.isArray(value)) {
32815
- return value.find(function (item) {
32799
+ return !!value.find(function (item) {
32816
32800
  return JSON.stringify(item) === JSON.stringify(option.value);
32817
32801
  });
32818
32802
  } else {
@@ -32825,7 +32809,7 @@ function RadioField(_ref) {
32825
32809
  option: item,
32826
32810
  type: type,
32827
32811
  onClick: function onClick() {
32828
- return handleChange(item);
32812
+ return handleClick(item.value);
32829
32813
  },
32830
32814
  active: isActive(item),
32831
32815
  disabled: disabled,
@@ -32885,6 +32869,22 @@ function RadioFieldItem(_ref) {
32885
32869
  });
32886
32870
  }
32887
32871
 
32872
+ /***/ }),
32873
+
32874
+ /***/ "./src/ui/InputFields/RadioField/ui/index.ts":
32875
+ /*!***************************************************!*\
32876
+ !*** ./src/ui/InputFields/RadioField/ui/index.ts ***!
32877
+ \***************************************************/
32878
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
32879
+
32880
+ "use strict";
32881
+ __webpack_require__.r(__webpack_exports__);
32882
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32883
+ /* harmony export */ RadioField: () => (/* reexport safe */ _RadioField__WEBPACK_IMPORTED_MODULE_0__.RadioField)
32884
+ /* harmony export */ });
32885
+ /* harmony import */ var _RadioField__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./RadioField */ "./src/ui/InputFields/RadioField/ui/RadioField.tsx");
32886
+
32887
+
32888
32888
  /***/ }),
32889
32889
 
32890
32890
  /***/ "./src/ui/InputFields/SelectField/config/index.ts":
@@ -33092,11 +33092,11 @@ __webpack_require__.r(__webpack_exports__);
33092
33092
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
33093
33093
  /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/hooks */ "./src/hooks/index.ts");
33094
33094
  /* 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");
33095
+ /* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/lib */ "./src/lib/index.ts");
33096
+ /* harmony import */ var _FlexField__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../FlexField */ "./src/ui/InputFields/FlexField/index.ts");
33097
+ /* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../lib */ "./src/ui/InputFields/SelectField/lib/index.ts");
33098
+ /* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../styles */ "./src/ui/InputFields/SelectField/styles/index.ts");
33099
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../config */ "./src/ui/InputFields/SelectField/config/index.ts");
33100
33100
  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
33101
  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
33102
  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 +33135,7 @@ function SelectField(_ref) {
33135
33135
  searching = _ref.searching,
33136
33136
  _ref$required = _ref.required,
33137
33137
  required = _ref$required === void 0 ? false : _ref$required,
33138
- _ref$multiple = _ref.multiple,
33139
- multiple = _ref$multiple === void 0 ? true : _ref$multiple,
33138
+ multiple = _ref.multiple,
33140
33139
  _ref$disabled = _ref.disabled,
33141
33140
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
33142
33141
  onBlur = _ref.onBlur,
@@ -33167,7 +33166,7 @@ function SelectField(_ref) {
33167
33166
  // Установка значения при required
33168
33167
  var firstOptions = optionsState === null || optionsState === void 0 ? void 0 : optionsState[0];
33169
33168
  if (required && (value === undefined || Array.isArray(value) && !value.length) && firstOptions) {
33170
- handleClick((0,_lib__WEBPACK_IMPORTED_MODULE_5__.getSelectFieldOptionsItemValue)(firstOptions));
33169
+ handleClick((0,_lib__WEBPACK_IMPORTED_MODULE_6__.getSelectFieldOptionsItemValue)(firstOptions));
33171
33170
  }
33172
33171
  return function () {
33173
33172
  // Отчистка таймаута для searching
@@ -33175,7 +33174,7 @@ function SelectField(_ref) {
33175
33174
  clearTimeout(searchingTimeoutRef.current);
33176
33175
  }
33177
33176
  };
33178
- }, [optionsState]);
33177
+ }, [optionsState, required, value]);
33179
33178
  (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
33180
33179
  fillOptionsCache(value);
33181
33180
  onScrollToBottom();
@@ -33202,7 +33201,6 @@ function SelectField(_ref) {
33202
33201
  }
33203
33202
  };
33204
33203
  var handleClick = function handleClick(data) {
33205
- fillOptionsCache(data);
33206
33204
  var saveValue = value || [];
33207
33205
  var prevValue = Array.isArray(saveValue) ? saveValue : [saveValue];
33208
33206
  var resValues;
@@ -33218,6 +33216,7 @@ function SelectField(_ref) {
33218
33216
  if (required && !resValues.length) {
33219
33217
  resValues = prevValue;
33220
33218
  }
33219
+ fillOptionsCache(resValues);
33221
33220
  if (multiple) {
33222
33221
  onChange === null || onChange === void 0 || onChange(resValues);
33223
33222
  } else {
@@ -33258,7 +33257,7 @@ function SelectField(_ref) {
33258
33257
  setTimeout(function () {
33259
33258
  requestPromiseRef.current = undefined;
33260
33259
  }, 0);
33261
- return (0,_lib__WEBPACK_IMPORTED_MODULE_8__.uniqueByKey)(updatedOptions, 'value');
33260
+ return (0,_lib__WEBPACK_IMPORTED_MODULE_4__.uniqueByKey)(updatedOptions, 'value');
33262
33261
  });
33263
33262
  _context.next = 16;
33264
33263
  break;
@@ -33306,9 +33305,14 @@ function SelectField(_ref) {
33306
33305
  };
33307
33306
  var getOptionsItems = function getOptionsItems() {
33308
33307
  return optionsState.map(function (item) {
33309
- return _typeof(item) === 'object' && 'value' in item ? _objectSpread({
33310
- text: item.label
33311
- }, item) : {
33308
+ var value = (0,_lib__WEBPACK_IMPORTED_MODULE_6__.getSelectFieldOptionsItemValue)(item);
33309
+ if (_typeof(item) === 'object' && 'value' in item) {
33310
+ return _objectSpread(_objectSpread({}, item), {}, {
33311
+ text: item.label,
33312
+ value: value
33313
+ });
33314
+ }
33315
+ return {
33312
33316
  text: String(item),
33313
33317
  value: item
33314
33318
  };
@@ -33322,15 +33326,15 @@ function SelectField(_ref) {
33322
33326
  }
33323
33327
  searchingTimeoutRef.current = setTimeout(function () {
33324
33328
  searching(searchString, optionsState).then(function (newOptions) {
33325
- return newOptions !== undefined && setOptionsState((0,_lib__WEBPACK_IMPORTED_MODULE_8__.uniqueByKey)(newOptions, 'value'));
33329
+ return newOptions !== undefined && setOptionsState((0,_lib__WEBPACK_IMPORTED_MODULE_4__.uniqueByKey)(newOptions, 'value'));
33326
33330
  });
33327
- }, _config__WEBPACK_IMPORTED_MODULE_7__.SEARCHING_DELAY_TIME);
33331
+ }, _config__WEBPACK_IMPORTED_MODULE_8__.SEARCHING_DELAY_TIME);
33328
33332
  }
33329
33333
  };
33330
33334
  var getViewField = function getViewField() {
33331
33335
  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))),
33336
+ return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_FlexField__WEBPACK_IMPORTED_MODULE_5__.FlexField, {
33337
+ value: isFocus ? searchingString : (0,_lib__WEBPACK_IMPORTED_MODULE_6__.getStringValue)(value, [].concat(_toConsumableArray(optionsState), _toConsumableArray(optionsCacheRef.current))),
33334
33338
  onChange: search,
33335
33339
  disabled: disabled,
33336
33340
  onFocus: function onFocus() {
@@ -33353,8 +33357,8 @@ function SelectField(_ref) {
33353
33357
  ref: inputRef
33354
33358
  });
33355
33359
  }
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))),
33360
+ return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_FlexField__WEBPACK_IMPORTED_MODULE_5__.FlexField, {
33361
+ value: (0,_lib__WEBPACK_IMPORTED_MODULE_6__.getStringValue)(value, [].concat(_toConsumableArray(optionsState), _toConsumableArray(optionsCacheRef.current))),
33358
33362
  isError: isError,
33359
33363
  disabled: disabled,
33360
33364
  placeholder: placeholder,
@@ -33371,9 +33375,9 @@ function SelectField(_ref) {
33371
33375
  });
33372
33376
  };
33373
33377
  return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
33374
- className: _styles__WEBPACK_IMPORTED_MODULE_6__.SelectFieldStyle.selectField,
33378
+ className: _styles__WEBPACK_IMPORTED_MODULE_7__.SelectFieldStyle.selectField,
33375
33379
  children: [getViewField(), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
33376
- className: _styles__WEBPACK_IMPORTED_MODULE_6__.SelectFieldStyle.modalWindowWrapper,
33380
+ className: _styles__WEBPACK_IMPORTED_MODULE_7__.SelectFieldStyle.modalWindowWrapper,
33377
33381
  children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ui__WEBPACK_IMPORTED_MODULE_3__.ModalWindowWrapper, {
33378
33382
  isShow: isShowModalWindow,
33379
33383
  setIsShow: function setIsShow(newValue) {
@@ -33383,7 +33387,7 @@ function SelectField(_ref) {
33383
33387
  setIsShowModalWindow(newValue);
33384
33388
  },
33385
33389
  additionElements: [inputRef.current],
33386
- className: _styles__WEBPACK_IMPORTED_MODULE_6__.SelectFieldStyle.modalWindow,
33390
+ className: _styles__WEBPACK_IMPORTED_MODULE_7__.SelectFieldStyle.modalWindow,
33387
33391
  children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ui__WEBPACK_IMPORTED_MODULE_3__.Dropdown, {
33388
33392
  items: getOptionsItems(),
33389
33393
  onScrollBottom: onScrollToBottom,