@kne/form-info 0.1.3 → 0.1.4

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
@@ -3857,7 +3857,7 @@ const FormModal = withLocale(p => {
3857
3857
 
3858
3858
  const _excluded$1 = ["className", "stepsClassName", "autoStep", "onComplete", "children"];
3859
3859
  const FormSteps = p => {
3860
- var _stepProps$items$curr, _stepProps$items$curr2, _stepCacheRef$current, _stepProps$items$curr3;
3860
+ var _stepProps$items$curr, _stepProps$items$curr2, _stepCacheRef$current, _stepItems$currentSte;
3861
3861
  const _Object$assign = Object.assign({}, {
3862
3862
  autoStep: true,
3863
3863
  defaultCurrent: 0,
@@ -3881,17 +3881,33 @@ const FormSteps = p => {
3881
3881
  const currentFormProps = Object.assign({}, (_stepProps$items$curr = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr.formProps, {
3882
3882
  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)
3883
3883
  });
3884
+ const stepItems = stepProps.items.map(item => {
3885
+ const currentItem = omit_1(item, ['formProps']);
3886
+ if (typeof currentItem.children === 'function') {
3887
+ return Object.assign({}, currentItem, {
3888
+ children: currentItem.children({
3889
+ isLastStep,
3890
+ currentStep,
3891
+ onStepChange,
3892
+ getStepCache: () => {
3893
+ return stepCacheRef.current;
3894
+ }
3895
+ })
3896
+ });
3897
+ }
3898
+ return currentItem;
3899
+ });
3884
3900
  const inner = /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
3885
3901
  className: className,
3886
3902
  vertical: stepProps.direction !== 'vertical' || stepProps.orientation !== 'vertical',
3887
3903
  gap: 24,
3888
3904
  children: [/*#__PURE__*/jsxRuntime.jsx(antd.Steps, _extends({}, omit_1(stepProps, ['current', 'defaultCurrent', 'onChange']), {
3889
3905
  className: classnames(stepsClassName, style['steps']),
3890
- items: stepProps.items.map(item => omit_1(item, ['formProps'])),
3906
+ items: stepItems,
3891
3907
  current: currentStep
3892
3908
  })), /*#__PURE__*/jsxRuntime.jsx("div", {
3893
3909
  className: style['steps-form-inner'],
3894
- children: (_stepProps$items$curr3 = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr3.children
3910
+ children: (_stepItems$currentSte = stepItems[currentStep]) == null ? void 0 : _stepItems$currentSte.children
3895
3911
  })]
3896
3912
  });
3897
3913
  return /*#__PURE__*/react.createElement(Form, _extends({}, Object.assign({}, currentFormProps, {
@@ -3906,6 +3922,9 @@ const FormSteps = p => {
3906
3922
  currentStep,
3907
3923
  onStepChange,
3908
3924
  stepCache: stepCacheRef.current,
3925
+ getStepCache: () => {
3926
+ return stepCacheRef.current;
3927
+ },
3909
3928
  isLastStep
3910
3929
  }, ...[].slice.call(_arguments, 1))).then(function (res) {
3911
3930
  stepCacheRef.current[currentStep].submitData = res;