@mcurros2/microm 1.1.64-0 → 1.1.65-0

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
@@ -47904,15 +47904,19 @@ function $611d924da195f578$export$166f000a4c5cc84a(props) {
47904
47904
  const [stepValidating, setStepValidating] = (0, $b4te3$react.useState)(false);
47905
47905
  const [stepValid, setStepValid] = (0, $b4te3$react.useState)(Array(steps.length).fill(false));
47906
47906
  const activeStepItem = steps[activeStep];
47907
- const validateCurrentStepFields = ()=>{
47907
+ const validateCurrentStepFields = (0, $b4te3$react.useCallback)(()=>{
47908
47908
  const currentStep = steps[activeStep];
47909
47909
  if (currentStep.validateFields) {
47910
47910
  const validationResults = currentStep.validateFields.map((field)=>formAPI.form.validateField(field));
47911
47911
  return validationResults.every((result)=>result.hasError === false);
47912
47912
  }
47913
47913
  return true;
47914
- };
47915
- const nextStep = (event)=>$611d924da195f578$var$__awaiter(this, void 0, void 0, function*() {
47914
+ }, [
47915
+ activeStep,
47916
+ formAPI.form,
47917
+ steps
47918
+ ]);
47919
+ const nextStep = (0, $b4te3$react.useCallback)((event)=>$611d924da195f578$var$__awaiter(this, void 0, void 0, function*() {
47916
47920
  event.preventDefault();
47917
47921
  const currentStep = steps[activeStep];
47918
47922
  let isValid = validateCurrentStepFields();
@@ -47949,8 +47953,15 @@ function $611d924da195f578$export$166f000a4c5cc84a(props) {
47949
47953
  if (activeStep < steps.length - 1) setActiveStep((current)=>current + 1);
47950
47954
  else if (formMode === "view") setActiveStep(steps.length); // Completed step
47951
47955
  }
47952
- });
47953
- const prevStep = (event)=>$611d924da195f578$var$__awaiter(this, void 0, void 0, function*() {
47956
+ }), [
47957
+ activeStep,
47958
+ formMode,
47959
+ onNextStep,
47960
+ stepValid,
47961
+ steps,
47962
+ validateCurrentStepFields
47963
+ ]);
47964
+ const prevStep = (0, $b4te3$react.useCallback)((event)=>$611d924da195f578$var$__awaiter(this, void 0, void 0, function*() {
47954
47965
  event.preventDefault();
47955
47966
  let isValid = true;
47956
47967
  if (activeStep > 0) {
@@ -47966,42 +47977,21 @@ function $611d924da195f578$export$166f000a4c5cc84a(props) {
47966
47977
  }
47967
47978
  if (isValid) setActiveStep((current)=>current - 1);
47968
47979
  }
47969
- });
47970
- const handleStepClick = (stepIndex)=>$611d924da195f578$var$__awaiter(this, void 0, void 0, function*() {
47980
+ }), [
47981
+ activeStep,
47982
+ onPrevStep,
47983
+ steps
47984
+ ]);
47985
+ const handleStepClick = (0, $b4te3$react.useCallback)((stepIndex)=>$611d924da195f578$var$__awaiter(this, void 0, void 0, function*() {
47971
47986
  if (stepIndex < activeStep) setActiveStep(stepIndex);
47972
47987
  else if (allowStepClickForward) {
47973
47988
  const isValid = validateCurrentStepFields();
47974
47989
  if (isValid) setActiveStep(stepIndex);
47975
47990
  }
47976
- });
47977
- (0, $b4te3$react.useEffect)(()=>{
47978
- setStepValid((prev)=>{
47979
- const newStepValid = [
47980
- ...prev
47981
- ];
47982
- newStepValid[activeStep] = false;
47983
- return newStepValid;
47984
- });
47985
- }, [
47986
- activeStep
47987
- ]);
47988
- (0, $b4te3$react.useEffect)(()=>{
47989
- if (!status.error && !status.loading && status.data) {
47990
- const dbstat = status.data;
47991
- if (!(dbstat === null || dbstat === void 0 ? void 0 : dbstat.Failed)) setActiveStep(steps.length); // Completed step
47992
- }
47993
- }, [
47994
- status.data,
47995
- status.error,
47996
- status.loading,
47997
- steps.length
47998
- ]);
47999
- (0, $b4te3$react.useEffect)(()=>{
48000
- if (activeStep === steps.length && onCompleted) onCompleted();
48001
- }, [
47991
+ }), [
48002
47992
  activeStep,
48003
- onCompleted,
48004
- steps.length
47993
+ allowStepClickForward,
47994
+ validateCurrentStepFields
48005
47995
  ]);
48006
47996
  const buttons = (0, $b4te3$react.useMemo)(()=>!(hideNextAndBackWhenCompleted && activeStep === steps.length) && (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Group), {
48007
47997
  position: activeStep > 0 ? "apart" : "right",
@@ -48053,6 +48043,35 @@ function $611d924da195f578$export$166f000a4c5cc84a(props) {
48053
48043
  stepValidating,
48054
48044
  steps.length
48055
48045
  ]);
48046
+ (0, $b4te3$react.useEffect)(()=>{
48047
+ setStepValid((prev)=>{
48048
+ const newStepValid = [
48049
+ ...prev
48050
+ ];
48051
+ newStepValid[activeStep] = false;
48052
+ return newStepValid;
48053
+ });
48054
+ }, [
48055
+ activeStep
48056
+ ]);
48057
+ (0, $b4te3$react.useEffect)(()=>{
48058
+ if (!status.error && !status.loading && status.data) {
48059
+ const dbstat = status.data;
48060
+ if (!(dbstat === null || dbstat === void 0 ? void 0 : dbstat.Failed)) setActiveStep(steps.length); // Completed step
48061
+ }
48062
+ }, [
48063
+ status.data,
48064
+ status.error,
48065
+ status.loading,
48066
+ steps.length
48067
+ ]);
48068
+ (0, $b4te3$react.useEffect)(()=>{
48069
+ if (activeStep === steps.length && onCompleted) onCompleted();
48070
+ }, [
48071
+ activeStep,
48072
+ onCompleted,
48073
+ steps.length
48074
+ ]);
48056
48075
  return (0, $b4te3$reactjsxruntime.jsx)((0, $bHLhd.EntityForm), Object.assign({}, rest, {
48057
48076
  buttons: buttons,
48058
48077
  formAPI: formAPI,