indicator-ui 0.0.119 → 0.0.121

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
@@ -6587,6 +6587,85 @@ function traverseTreeByStack(arr, process, options) {
6587
6587
  }
6588
6588
 
6589
6589
 
6590
+ /***/ }),
6591
+
6592
+ /***/ "./src/lib/dict/clearDeepValue.ts":
6593
+ /*!****************************************!*\
6594
+ !*** ./src/lib/dict/clearDeepValue.ts ***!
6595
+ \****************************************/
6596
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6597
+
6598
+ "use strict";
6599
+ __webpack_require__.r(__webpack_exports__);
6600
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6601
+ /* harmony export */ "default": () => (/* binding */ clearDeepValue)
6602
+ /* harmony export */ });
6603
+ /* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/lib */ "./src/lib/index.ts");
6604
+
6605
+ function clearDeepValue(dict, keyWays) {
6606
+ const resDict = {};
6607
+ const dictKeys = Object.keys(dict);
6608
+ for (const key of dictKeys) {
6609
+ let isExist = false;
6610
+ for (const keyWay of keyWays) {
6611
+ if ((0,_lib__WEBPACK_IMPORTED_MODULE_0__.compKeyWays)(keyWay, [key]) >= 1) {
6612
+ isExist = true;
6613
+ break;
6614
+ }
6615
+ }
6616
+ if (isExist) {
6617
+ resDict[key] = dict[key];
6618
+ }
6619
+ }
6620
+ return resDict;
6621
+ }
6622
+
6623
+
6624
+ /***/ }),
6625
+
6626
+ /***/ "./src/lib/dict/compKeyWays.ts":
6627
+ /*!*************************************!*\
6628
+ !*** ./src/lib/dict/compKeyWays.ts ***!
6629
+ \*************************************/
6630
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6631
+
6632
+ "use strict";
6633
+ __webpack_require__.r(__webpack_exports__);
6634
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6635
+ /* harmony export */ compKeyWays: () => (/* binding */ compKeyWays)
6636
+ /* harmony export */ });
6637
+ /**
6638
+ * 2 - полностью совпадают
6639
+ * 1 - совпадает начало
6640
+ * 0 - не совпадают
6641
+ * */
6642
+ function compKeyWays(a, b) {
6643
+ const length = Math.min(a.length, b.length);
6644
+ let counter = 0;
6645
+ for (let i = 0; i < length; i++) {
6646
+ const aItem = a[i];
6647
+ const bItem = b[i];
6648
+ const aKey = typeof aItem === 'string' ? aItem : aItem.name;
6649
+ const bKey = typeof bItem === 'string' ? bItem : bItem.name;
6650
+ if (aKey === bKey) {
6651
+ counter++;
6652
+ }
6653
+ else {
6654
+ break;
6655
+ }
6656
+ }
6657
+ if (a.length === b.length && counter === length) {
6658
+ return 2;
6659
+ }
6660
+ else if (counter > 0) {
6661
+ return 1;
6662
+ }
6663
+ else {
6664
+ return 0;
6665
+ }
6666
+ }
6667
+
6668
+
6590
6669
  /***/ }),
6591
6670
 
6592
6671
  /***/ "./src/lib/dict/getDeepValue.ts":
@@ -6637,6 +6716,7 @@ function getDeepValue(dict, keyWay) {
6637
6716
  "use strict";
6638
6717
  __webpack_require__.r(__webpack_exports__);
6639
6718
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6719
+ /* harmony export */ compKeyWays: () => (/* reexport safe */ _compKeyWays__WEBPACK_IMPORTED_MODULE_3__.compKeyWays),
6640
6720
  /* harmony export */ getDeepValue: () => (/* reexport safe */ _getDeepValue__WEBPACK_IMPORTED_MODULE_2__["default"]),
6641
6721
  /* harmony export */ isDict: () => (/* reexport safe */ _isDict__WEBPACK_IMPORTED_MODULE_0__["default"]),
6642
6722
  /* harmony export */ setDeepValue: () => (/* reexport safe */ _setDeepValue__WEBPACK_IMPORTED_MODULE_1__["default"])
@@ -6644,6 +6724,8 @@ __webpack_require__.r(__webpack_exports__);
6644
6724
  /* harmony import */ var _isDict__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isDict */ "./src/lib/dict/isDict.ts");
6645
6725
  /* harmony import */ var _setDeepValue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setDeepValue */ "./src/lib/dict/setDeepValue.ts");
6646
6726
  /* harmony import */ var _getDeepValue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getDeepValue */ "./src/lib/dict/getDeepValue.ts");
6727
+ /* harmony import */ var _compKeyWays__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./compKeyWays */ "./src/lib/dict/compKeyWays.ts");
6728
+
6647
6729
 
6648
6730
 
6649
6731
 
@@ -6722,6 +6804,7 @@ function setDeepValue(dict, value, options) {
6722
6804
  "use strict";
6723
6805
  __webpack_require__.r(__webpack_exports__);
6724
6806
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6807
+ /* harmony export */ compKeyWays: () => (/* reexport safe */ _dict__WEBPACK_IMPORTED_MODULE_0__.compKeyWays),
6725
6808
  /* harmony export */ getDeepValue: () => (/* reexport safe */ _dict__WEBPACK_IMPORTED_MODULE_0__.getDeepValue),
6726
6809
  /* harmony export */ getUniqueArray: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.getUniqueArray),
6727
6810
  /* harmony export */ handleScrollEnd: () => (/* reexport safe */ _reactComponents__WEBPACK_IMPORTED_MODULE_2__.handleScrollEnd),
@@ -8691,6 +8774,8 @@ const inputFieldComponent = (schema, key, additionProps) => {
8691
8774
  // Поиск инициализированных полей
8692
8775
  const initFields = additionProps.getPrivateRefStoreValue(_ui__WEBPACK_IMPORTED_MODULE_3__.INIT_FIELDS_NAME) || [];
8693
8776
  if (!initFields.find(item => JSON.stringify(item) === JSON.stringify(keyWay))) {
8777
+ const curKeyWayStore = additionProps.getPrivateRefStoreValue(_ui__WEBPACK_IMPORTED_MODULE_3__.KEY_WAY_STORE_NAME) ?? [];
8778
+ additionProps.addPrivateRefStoreValue([...curKeyWayStore, keyWay], _ui__WEBPACK_IMPORTED_MODULE_3__.KEY_WAY_STORE_NAME);
8694
8779
  additionProps.addPrivateRefStoreValue([...initFields, keyWay], _ui__WEBPACK_IMPORTED_MODULE_3__.INIT_FIELDS_NAME);
8695
8780
  onChange(value !== undefined ? value : schema.props.defaultValue);
8696
8781
  }
@@ -8798,13 +8883,15 @@ __webpack_require__.r(__webpack_exports__);
8798
8883
  /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/hooks */ "./src/hooks/index.ts");
8799
8884
  /* harmony import */ var _lib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib */ "./src/ui/FormBuilder/lib/index.ts");
8800
8885
  /* harmony import */ var _consts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../consts */ "./src/ui/FormBuilder/consts/index.ts");
8886
+ /* harmony import */ var _lib_dict_clearDeepValue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/lib/dict/clearDeepValue */ "./src/lib/dict/clearDeepValue.ts");
8801
8887
  'use client';
8802
8888
 
8803
8889
 
8804
8890
 
8805
8891
 
8806
8892
 
8807
- function FormBuilder({ schema, formDataDefault, onChange, onChangeIsError, inputFieldClassName, additionIsErrorFields, onChangeValidateIsError, formDataDefaultListener, inputFieldAdditionProps, sensitiveErrorSearch = true, }) {
8893
+
8894
+ function FormBuilder({ schema, formDataDefault, onChange, onChangeIsError, inputFieldClassName, additionIsErrorFields, onChangeValidateIsError, formDataDefaultListener, inputFieldAdditionProps, sensitiveErrorSearch = true, clearForm = false, }) {
8808
8895
  //==================================================================================================================
8809
8896
  // Пока спорная фича, скорее всего лишняя
8810
8897
  const [formBuilderStateStore, setFormBuilderStateStore] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)({});
@@ -8853,14 +8940,19 @@ function FormBuilder({ schema, formDataDefault, onChange, onChangeIsError, input
8853
8940
  });
8854
8941
  const validateFunctions = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)([]);
8855
8942
  validateFunctions.current = [];
8856
- removePrivateRefStoreValue(_consts__WEBPACK_IMPORTED_MODULE_4__.KEY_WAY_STORE_NAME);
8943
+ // removePrivateRefStoreValue(KEY_WAY_STORE_NAME)
8857
8944
  (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
8858
8945
  if (formDataDefaultListener !== undefined) {
8859
8946
  setFormData({ ...formDataDefaultListener });
8860
8947
  }
8861
- }, [formDataDefaultListener]);
8948
+ }, [JSON.stringify(formDataDefaultListener)]);
8862
8949
  (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
8863
- onChange && onChange(formData);
8950
+ let resForm = formData;
8951
+ if (clearForm) {
8952
+ const keys = getPrivateRefStoreValue(_consts__WEBPACK_IMPORTED_MODULE_4__.KEY_WAY_STORE_NAME);
8953
+ resForm = (0,_lib_dict_clearDeepValue__WEBPACK_IMPORTED_MODULE_5__["default"])(resForm, keys);
8954
+ }
8955
+ onChange && onChange(resForm);
8864
8956
  }, [formData]);
8865
8957
  (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
8866
8958
  onChangeIsError && onChangeIsError(isError);
@@ -26457,6 +26549,7 @@ __webpack_require__.r(__webpack_exports__);
26457
26549
  /* harmony export */ ToggleBase: () => (/* reexport safe */ _ui__WEBPACK_IMPORTED_MODULE_1__.ToggleBase),
26458
26550
  /* harmony export */ arrayFieldComponent: () => (/* reexport safe */ _ui__WEBPACK_IMPORTED_MODULE_1__.arrayFieldComponent),
26459
26551
  /* harmony export */ blockWrapperComponent: () => (/* reexport safe */ _ui__WEBPACK_IMPORTED_MODULE_1__.blockWrapperComponent),
26552
+ /* harmony export */ compKeyWays: () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_4__.compKeyWays),
26460
26553
  /* harmony export */ formBuilder: () => (/* reexport safe */ _ui__WEBPACK_IMPORTED_MODULE_1__.formBuilder),
26461
26554
  /* harmony export */ formWrapperComponent: () => (/* reexport safe */ _ui__WEBPACK_IMPORTED_MODULE_1__.formWrapperComponent),
26462
26555
  /* harmony export */ getDeepValue: () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_4__.getDeepValue),