@kne/form-info 0.1.3 → 0.1.5

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.
@@ -771,17 +771,17 @@ var Symbol = _root.Symbol;
771
771
  var _Symbol = Symbol;
772
772
 
773
773
  /** Used for built-in method references. */
774
- var objectProto$d = Object.prototype;
774
+ var objectProto$e = Object.prototype;
775
775
 
776
776
  /** Used to check objects for own properties. */
777
- var hasOwnProperty$a = objectProto$d.hasOwnProperty;
777
+ var hasOwnProperty$b = objectProto$e.hasOwnProperty;
778
778
 
779
779
  /**
780
780
  * Used to resolve the
781
781
  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
782
782
  * of values.
783
783
  */
784
- var nativeObjectToString$1 = objectProto$d.toString;
784
+ var nativeObjectToString$1 = objectProto$e.toString;
785
785
 
786
786
  /** Built-in value references. */
787
787
  var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
@@ -794,7 +794,7 @@ var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
794
794
  * @returns {string} Returns the raw `toStringTag`.
795
795
  */
796
796
  function getRawTag(value) {
797
- var isOwn = hasOwnProperty$a.call(value, symToStringTag$1),
797
+ var isOwn = hasOwnProperty$b.call(value, symToStringTag$1),
798
798
  tag = value[symToStringTag$1];
799
799
 
800
800
  try {
@@ -816,14 +816,14 @@ function getRawTag(value) {
816
816
  var _getRawTag = getRawTag;
817
817
 
818
818
  /** Used for built-in method references. */
819
- var objectProto$c = Object.prototype;
819
+ var objectProto$d = Object.prototype;
820
820
 
821
821
  /**
822
822
  * Used to resolve the
823
823
  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
824
824
  * of values.
825
825
  */
826
- var nativeObjectToString = objectProto$c.toString;
826
+ var nativeObjectToString = objectProto$d.toString;
827
827
 
828
828
  /**
829
829
  * Converts `value` to a string using `Object.prototype.toString`.
@@ -992,17 +992,17 @@ var reIsHostCtor = /^\[object .+?Constructor\]$/;
992
992
 
993
993
  /** Used for built-in method references. */
994
994
  var funcProto$1 = Function.prototype,
995
- objectProto$b = Object.prototype;
995
+ objectProto$c = Object.prototype;
996
996
 
997
997
  /** Used to resolve the decompiled source of functions. */
998
998
  var funcToString$1 = funcProto$1.toString;
999
999
 
1000
1000
  /** Used to check objects for own properties. */
1001
- var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
1001
+ var hasOwnProperty$a = objectProto$c.hasOwnProperty;
1002
1002
 
1003
1003
  /** Used to detect if a method is native. */
1004
1004
  var reIsNative = RegExp('^' +
1005
- funcToString$1.call(hasOwnProperty$9).replace(reRegExpChar, '\\$&')
1005
+ funcToString$1.call(hasOwnProperty$a).replace(reRegExpChar, '\\$&')
1006
1006
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
1007
1007
  );
1008
1008
 
@@ -1099,10 +1099,10 @@ var _hashDelete = hashDelete;
1099
1099
  var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
1100
1100
 
1101
1101
  /** Used for built-in method references. */
1102
- var objectProto$a = Object.prototype;
1102
+ var objectProto$b = Object.prototype;
1103
1103
 
1104
1104
  /** Used to check objects for own properties. */
1105
- var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
1105
+ var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
1106
1106
 
1107
1107
  /**
1108
1108
  * Gets the hash value for `key`.
@@ -1119,16 +1119,16 @@ function hashGet(key) {
1119
1119
  var result = data[key];
1120
1120
  return result === HASH_UNDEFINED$1 ? undefined : result;
1121
1121
  }
1122
- return hasOwnProperty$8.call(data, key) ? data[key] : undefined;
1122
+ return hasOwnProperty$9.call(data, key) ? data[key] : undefined;
1123
1123
  }
1124
1124
 
1125
1125
  var _hashGet = hashGet;
1126
1126
 
1127
1127
  /** Used for built-in method references. */
1128
- var objectProto$9 = Object.prototype;
1128
+ var objectProto$a = Object.prototype;
1129
1129
 
1130
1130
  /** Used to check objects for own properties. */
1131
- var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
1131
+ var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
1132
1132
 
1133
1133
  /**
1134
1134
  * Checks if a hash value for `key` exists.
@@ -1141,7 +1141,7 @@ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
1141
1141
  */
1142
1142
  function hashHas(key) {
1143
1143
  var data = this.__data__;
1144
- return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$7.call(data, key);
1144
+ return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$8.call(data, key);
1145
1145
  }
1146
1146
 
1147
1147
  var _hashHas = hashHas;
@@ -1451,10 +1451,10 @@ function baseAssignValue(object, key, value) {
1451
1451
  var _baseAssignValue = baseAssignValue;
1452
1452
 
1453
1453
  /** Used for built-in method references. */
1454
- var objectProto$8 = Object.prototype;
1454
+ var objectProto$9 = Object.prototype;
1455
1455
 
1456
1456
  /** Used to check objects for own properties. */
1457
- var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
1457
+ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
1458
1458
 
1459
1459
  /**
1460
1460
  * Assigns `value` to `key` of `object` if the existing value is not equivalent
@@ -1468,7 +1468,7 @@ var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
1468
1468
  */
1469
1469
  function assignValue(object, key, value) {
1470
1470
  var objValue = object[key];
1471
- if (!(hasOwnProperty$6.call(object, key) && eq_1(objValue, value)) ||
1471
+ if (!(hasOwnProperty$7.call(object, key) && eq_1(objValue, value)) ||
1472
1472
  (value === undefined && !(key in object))) {
1473
1473
  _baseAssignValue(object, key, value);
1474
1474
  }
@@ -1582,13 +1582,13 @@ function baseIsArguments(value) {
1582
1582
  var _baseIsArguments = baseIsArguments;
1583
1583
 
1584
1584
  /** Used for built-in method references. */
1585
- var objectProto$7 = Object.prototype;
1585
+ var objectProto$8 = Object.prototype;
1586
1586
 
1587
1587
  /** Used to check objects for own properties. */
1588
- var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
1588
+ var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
1589
1589
 
1590
1590
  /** Built-in value references. */
1591
- var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
1591
+ var propertyIsEnumerable$1 = objectProto$8.propertyIsEnumerable;
1592
1592
 
1593
1593
  /**
1594
1594
  * Checks if `value` is likely an `arguments` object.
@@ -1609,7 +1609,7 @@ var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
1609
1609
  * // => false
1610
1610
  */
1611
1611
  var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
1612
- return isObjectLike_1(value) && hasOwnProperty$5.call(value, 'callee') &&
1612
+ return isObjectLike_1(value) && hasOwnProperty$6.call(value, 'callee') &&
1613
1613
  !propertyIsEnumerable$1.call(value, 'callee');
1614
1614
  };
1615
1615
 
@@ -1889,10 +1889,10 @@ var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsType
1889
1889
  var isTypedArray_1 = isTypedArray;
1890
1890
 
1891
1891
  /** Used for built-in method references. */
1892
- var objectProto$6 = Object.prototype;
1892
+ var objectProto$7 = Object.prototype;
1893
1893
 
1894
1894
  /** Used to check objects for own properties. */
1895
- var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
1895
+ var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
1896
1896
 
1897
1897
  /**
1898
1898
  * Creates an array of the enumerable property names of the array-like `value`.
@@ -1912,7 +1912,7 @@ function arrayLikeKeys(value, inherited) {
1912
1912
  length = result.length;
1913
1913
 
1914
1914
  for (var key in value) {
1915
- if ((inherited || hasOwnProperty$4.call(value, key)) &&
1915
+ if ((inherited || hasOwnProperty$5.call(value, key)) &&
1916
1916
  !(skipIndexes && (
1917
1917
  // Safari 9 has enumerable `arguments.length` in strict mode.
1918
1918
  key == 'length' ||
@@ -1932,7 +1932,7 @@ function arrayLikeKeys(value, inherited) {
1932
1932
  var _arrayLikeKeys = arrayLikeKeys;
1933
1933
 
1934
1934
  /** Used for built-in method references. */
1935
- var objectProto$5 = Object.prototype;
1935
+ var objectProto$6 = Object.prototype;
1936
1936
 
1937
1937
  /**
1938
1938
  * Checks if `value` is likely a prototype object.
@@ -1943,7 +1943,7 @@ var objectProto$5 = Object.prototype;
1943
1943
  */
1944
1944
  function isPrototype(value) {
1945
1945
  var Ctor = value && value.constructor,
1946
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5;
1946
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$6;
1947
1947
 
1948
1948
  return value === proto;
1949
1949
  }
@@ -1972,10 +1972,10 @@ var nativeKeys = _overArg(Object.keys, Object);
1972
1972
  var _nativeKeys = nativeKeys;
1973
1973
 
1974
1974
  /** Used for built-in method references. */
1975
- var objectProto$4 = Object.prototype;
1975
+ var objectProto$5 = Object.prototype;
1976
1976
 
1977
1977
  /** Used to check objects for own properties. */
1978
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
1978
+ var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
1979
1979
 
1980
1980
  /**
1981
1981
  * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
@@ -1990,7 +1990,7 @@ function baseKeys(object) {
1990
1990
  }
1991
1991
  var result = [];
1992
1992
  for (var key in Object(object)) {
1993
- if (hasOwnProperty$3.call(object, key) && key != 'constructor') {
1993
+ if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
1994
1994
  result.push(key);
1995
1995
  }
1996
1996
  }
@@ -2101,10 +2101,10 @@ function nativeKeysIn(object) {
2101
2101
  var _nativeKeysIn = nativeKeysIn;
2102
2102
 
2103
2103
  /** Used for built-in method references. */
2104
- var objectProto$3 = Object.prototype;
2104
+ var objectProto$4 = Object.prototype;
2105
2105
 
2106
2106
  /** Used to check objects for own properties. */
2107
- var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
2107
+ var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
2108
2108
 
2109
2109
  /**
2110
2110
  * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
@@ -2121,7 +2121,7 @@ function baseKeysIn(object) {
2121
2121
  result = [];
2122
2122
 
2123
2123
  for (var key in object) {
2124
- if (!(key == 'constructor' && (isProto || !hasOwnProperty$2.call(object, key)))) {
2124
+ if (!(key == 'constructor' && (isProto || !hasOwnProperty$3.call(object, key)))) {
2125
2125
  result.push(key);
2126
2126
  }
2127
2127
  }
@@ -2282,10 +2282,10 @@ function stubArray() {
2282
2282
  var stubArray_1 = stubArray;
2283
2283
 
2284
2284
  /** Used for built-in method references. */
2285
- var objectProto$2 = Object.prototype;
2285
+ var objectProto$3 = Object.prototype;
2286
2286
 
2287
2287
  /** Built-in value references. */
2288
- var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
2288
+ var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
2289
2289
 
2290
2290
  /* Built-in method references for those with the same name as other `lodash` methods. */
2291
2291
  var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
@@ -2501,10 +2501,10 @@ if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
2501
2501
  var _getTag = getTag;
2502
2502
 
2503
2503
  /** Used for built-in method references. */
2504
- var objectProto$1 = Object.prototype;
2504
+ var objectProto$2 = Object.prototype;
2505
2505
 
2506
2506
  /** Used to check objects for own properties. */
2507
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
2507
+ var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
2508
2508
 
2509
2509
  /**
2510
2510
  * Initializes an array clone.
@@ -2518,7 +2518,7 @@ function initCloneArray(array) {
2518
2518
  result = new array.constructor(length);
2519
2519
 
2520
2520
  // Add properties assigned by `RegExp#exec`.
2521
- if (length && typeof array[0] == 'string' && hasOwnProperty$1.call(array, 'index')) {
2521
+ if (length && typeof array[0] == 'string' && hasOwnProperty$2.call(array, 'index')) {
2522
2522
  result.index = array.index;
2523
2523
  result.input = array.input;
2524
2524
  }
@@ -3315,6 +3315,12 @@ function parent(object, path) {
3315
3315
 
3316
3316
  var _parent = parent;
3317
3317
 
3318
+ /** Used for built-in method references. */
3319
+ var objectProto$1 = Object.prototype;
3320
+
3321
+ /** Used to check objects for own properties. */
3322
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
3323
+
3318
3324
  /**
3319
3325
  * The base implementation of `_.unset`.
3320
3326
  *
@@ -3325,8 +3331,47 @@ var _parent = parent;
3325
3331
  */
3326
3332
  function baseUnset(object, path) {
3327
3333
  path = _castPath(path, object);
3328
- object = _parent(object, path);
3329
- return object == null || delete object[_toKey(last_1(path))];
3334
+
3335
+ // Prevent prototype pollution, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
3336
+ var index = -1,
3337
+ length = path.length;
3338
+
3339
+ if (!length) {
3340
+ return true;
3341
+ }
3342
+
3343
+ var isRootPrimitive = object == null || (typeof object !== 'object' && typeof object !== 'function');
3344
+
3345
+ while (++index < length) {
3346
+ var key = path[index];
3347
+
3348
+ // skip non-string keys (e.g., Symbols, numbers)
3349
+ if (typeof key !== 'string') {
3350
+ continue;
3351
+ }
3352
+
3353
+ // Always block "__proto__" anywhere in the path if it's not expected
3354
+ if (key === '__proto__' && !hasOwnProperty$1.call(object, '__proto__')) {
3355
+ return false;
3356
+ }
3357
+
3358
+ // Block "constructor.prototype" chains
3359
+ if (key === 'constructor' &&
3360
+ (index + 1) < length &&
3361
+ typeof path[index + 1] === 'string' &&
3362
+ path[index + 1] === 'prototype') {
3363
+
3364
+ // Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
3365
+ if (isRootPrimitive && index === 0) {
3366
+ continue;
3367
+ }
3368
+
3369
+ return false;
3370
+ }
3371
+ }
3372
+
3373
+ var obj = _parent(object, path);
3374
+ return obj == null || delete obj[_toKey(last_1(path))];
3330
3375
  }
3331
3376
 
3332
3377
  var _baseUnset = baseUnset;
@@ -3838,7 +3883,7 @@ const FormModal = withLocale(p => {
3838
3883
 
3839
3884
  const _excluded$1 = ["className", "stepsClassName", "autoStep", "onComplete", "children"];
3840
3885
  const FormSteps = p => {
3841
- var _stepProps$items$curr, _stepProps$items$curr2, _stepCacheRef$current, _stepProps$items$curr3;
3886
+ var _stepProps$items$curr, _stepProps$items$curr2, _stepCacheRef$current, _stepItems$currentSte;
3842
3887
  const _Object$assign = Object.assign({}, {
3843
3888
  autoStep: true,
3844
3889
  defaultCurrent: 0,
@@ -3862,17 +3907,33 @@ const FormSteps = p => {
3862
3907
  const currentFormProps = Object.assign({}, (_stepProps$items$curr = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr.formProps, {
3863
3908
  data: Object.assign({}, (_stepProps$items$curr2 = stepProps.items[currentStep]) == null || (_stepProps$items$curr2 = _stepProps$items$curr2.formProps) == null ? void 0 : _stepProps$items$curr2.data, (_stepCacheRef$current = stepCacheRef.current[currentStep]) == null ? void 0 : _stepCacheRef$current.formData)
3864
3909
  });
3910
+ const stepItems = stepProps.items.map(item => {
3911
+ const currentItem = omit_1(item, ['formProps']);
3912
+ if (typeof currentItem.children === 'function') {
3913
+ return Object.assign({}, currentItem, {
3914
+ children: currentItem.children({
3915
+ isLastStep,
3916
+ currentStep,
3917
+ onStepChange,
3918
+ getStepCache: () => {
3919
+ return stepCacheRef.current;
3920
+ }
3921
+ })
3922
+ });
3923
+ }
3924
+ return currentItem;
3925
+ });
3865
3926
  const inner = /*#__PURE__*/jsxs(Flex, {
3866
3927
  className: className,
3867
3928
  vertical: stepProps.direction !== 'vertical' || stepProps.orientation !== 'vertical',
3868
3929
  gap: 24,
3869
3930
  children: [/*#__PURE__*/jsx(Steps, _extends({}, omit_1(stepProps, ['current', 'defaultCurrent', 'onChange']), {
3870
3931
  className: classnames(stepsClassName, style['steps']),
3871
- items: stepProps.items.map(item => omit_1(item, ['formProps'])),
3932
+ items: stepItems,
3872
3933
  current: currentStep
3873
3934
  })), /*#__PURE__*/jsx("div", {
3874
3935
  className: style['steps-form-inner'],
3875
- children: (_stepProps$items$curr3 = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr3.children
3936
+ children: (_stepItems$currentSte = stepItems[currentStep]) == null ? void 0 : _stepItems$currentSte.children
3876
3937
  })]
3877
3938
  });
3878
3939
  return /*#__PURE__*/createElement(Form, _extends({}, Object.assign({}, currentFormProps, {
@@ -3885,6 +3946,9 @@ const FormSteps = p => {
3885
3946
  currentStep,
3886
3947
  onStepChange,
3887
3948
  stepCache: stepCacheRef.current,
3949
+ getStepCache: () => {
3950
+ return stepCacheRef.current;
3951
+ },
3888
3952
  isLastStep
3889
3953
  }, ...args));
3890
3954
  stepCacheRef.current[currentStep].submitData = res;