@bigbinary/neeto-rules-frontend 2.5.15-beta → 2.5.15-beta-2
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/NeetoRulesForm.js +80 -81
- package/dist/NeetoRulesForm.js.map +1 -1
- package/dist/cjs/NeetoRulesForm.js +80 -81
- package/dist/cjs/NeetoRulesForm.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +2 -0
|
@@ -5808,8 +5808,9 @@ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
5808
5808
|
var Form = function Form(_ref) {
|
|
5809
5809
|
var _ref$data = _ref.data,
|
|
5810
5810
|
data = _ref$data === void 0 ? {} : _ref$data,
|
|
5811
|
-
|
|
5812
|
-
|
|
5811
|
+
title = _ref.title,
|
|
5812
|
+
_ref$breadcrumbs = _ref.breadcrumbs,
|
|
5813
|
+
breadcrumbs = _ref$breadcrumbs === void 0 ? {} : _ref$breadcrumbs,
|
|
5813
5814
|
_children = _ref.children,
|
|
5814
5815
|
className = _ref.className,
|
|
5815
5816
|
_ref$handleSubmit = _ref.handleSubmit,
|
|
@@ -5818,88 +5819,86 @@ var Form = function Form(_ref) {
|
|
|
5818
5819
|
handleCancel = _ref$handleCancel === void 0 ? neetoCist.noop : _ref$handleCancel,
|
|
5819
5820
|
_ref$showStatusSwitch = _ref.showStatusSwitch,
|
|
5820
5821
|
showStatusSwitch = _ref$showStatusSwitch === void 0 ? true : _ref$showStatusSwitch;
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
resetPanelState: store["resetPanelState"]
|
|
5828
|
-
};
|
|
5829
|
-
}, shallow.shallow),
|
|
5830
|
-
resetPanelState = _useUtilityStore.resetPanelState;
|
|
5831
|
-
var submitForm = function submitForm(values, formikBag) {
|
|
5832
|
-
var payload = buildPayload(data, values);
|
|
5833
|
-
handleSubmit(payload, formikBag);
|
|
5834
|
-
};
|
|
5835
|
-
var initialValues = react.useMemo(function () {
|
|
5836
|
-
return formatData(data);
|
|
5837
|
-
}, [data]);
|
|
5838
|
-
var _useCustomDataStore = useCustomDataStore.useCustomDataStore(function (store) {
|
|
5839
|
-
return {
|
|
5840
|
-
customData: store["customData"]
|
|
5841
|
-
};
|
|
5842
|
-
}, shallow.shallow),
|
|
5843
|
-
customData = _useCustomDataStore.customData;
|
|
5844
|
-
react.useEffect(function () {
|
|
5845
|
-
return function () {
|
|
5846
|
-
return resetPanelState();
|
|
5822
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
5823
|
+
t = _useTranslation.t;
|
|
5824
|
+
var formRef = react.useRef(null);
|
|
5825
|
+
var _useUtilityStore = useUtilityStore.useUtilityStore(function (store) {
|
|
5826
|
+
return {
|
|
5827
|
+
resetPanelState: store["resetPanelState"]
|
|
5847
5828
|
};
|
|
5848
|
-
},
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5829
|
+
}, shallow.shallow),
|
|
5830
|
+
resetPanelState = _useUtilityStore.resetPanelState;
|
|
5831
|
+
var submitForm = function submitForm(values, formikBag) {
|
|
5832
|
+
var payload = buildPayload(data, values);
|
|
5833
|
+
handleSubmit(payload, formikBag);
|
|
5834
|
+
};
|
|
5835
|
+
var initialValues = react.useMemo(function () {
|
|
5836
|
+
return formatData(data);
|
|
5837
|
+
}, [data]);
|
|
5838
|
+
var _useCustomDataStore = useCustomDataStore.useCustomDataStore(function (store) {
|
|
5839
|
+
return {
|
|
5840
|
+
customData: store["customData"]
|
|
5841
|
+
};
|
|
5842
|
+
}, shallow.shallow),
|
|
5843
|
+
customData = _useCustomDataStore.customData;
|
|
5844
|
+
react.useEffect(function () {
|
|
5845
|
+
return function () {
|
|
5846
|
+
return resetPanelState();
|
|
5847
|
+
};
|
|
5848
|
+
}, []);
|
|
5849
|
+
return /*#__PURE__*/jsxRuntime.jsx(formik.Formik, {
|
|
5850
|
+
enableReinitialize: true,
|
|
5851
|
+
initialValues: _objectSpread$1(_objectSpread$1({}, DEFAULT_INITIAL_VALUE), initialValues),
|
|
5852
|
+
validationSchema: getValidationSchema(data, customData),
|
|
5853
|
+
onSubmit: submitForm,
|
|
5854
|
+
children: function children(_ref2) {
|
|
5855
|
+
var dirty = _ref2.dirty,
|
|
5856
|
+
values = _ref2.values,
|
|
5857
|
+
fromikBag = _objectWithoutProperties(_ref2, _excluded);
|
|
5858
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5859
|
+
className: "flex neeto-rules-main-content h-full",
|
|
5860
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(TouchErrors, {}), /*#__PURE__*/jsxRuntime.jsxs(Container, {
|
|
5861
|
+
className: "neeto-rules-main-content__container max-h-full",
|
|
5862
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(NeetoHeader, {
|
|
5863
|
+
breadcrumbs: breadcrumbs,
|
|
5864
|
+
title: title || t("neetoRules.common.title")
|
|
5865
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(formik.Form, {
|
|
5866
|
+
ref: formRef,
|
|
5867
|
+
className: classNames(["w-full neeto-rules-main-content__form mx-auto max-w-3xl", className]),
|
|
5868
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5869
|
+
className: "space-y-6",
|
|
5870
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(InputField, {
|
|
5871
|
+
required: true,
|
|
5872
|
+
data: initialValues,
|
|
5873
|
+
label: t("neetoRules.common.name"),
|
|
5874
|
+
name: "name"
|
|
5875
|
+
}), /*#__PURE__*/jsxRuntime.jsx(TextareaField, {
|
|
5876
|
+
data: initialValues,
|
|
5877
|
+
label: t("neetoRules.common.description"),
|
|
5878
|
+
name: "description"
|
|
5879
|
+
}), showStatusSwitch && /*#__PURE__*/jsxRuntime.jsx(Status, {}), typeof _children === "function" ? _children === null || _children === void 0 ? void 0 : _children(_objectSpread$1({
|
|
5880
|
+
values: values,
|
|
5881
|
+
formattedValues: buildPayload(data, values),
|
|
5882
|
+
dirty: dirty
|
|
5883
|
+
}, fromikBag)) : _children, /*#__PURE__*/jsxRuntime.jsx(ScrollToErrorField, {
|
|
5884
|
+
formRef: formRef
|
|
5896
5885
|
})]
|
|
5886
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5887
|
+
className: "neeto-ui-bg-white sticky bottom-0 py-6",
|
|
5888
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ActionBlock, {
|
|
5889
|
+
cancelButtonProps: {
|
|
5890
|
+
onClick: handleCancel
|
|
5891
|
+
},
|
|
5892
|
+
submitButtonProps: {
|
|
5893
|
+
"data-cy": "form-submit-button"
|
|
5894
|
+
}
|
|
5895
|
+
})
|
|
5897
5896
|
})]
|
|
5898
|
-
})
|
|
5899
|
-
})
|
|
5900
|
-
}
|
|
5901
|
-
}
|
|
5902
|
-
}
|
|
5897
|
+
})]
|
|
5898
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Panel, {})]
|
|
5899
|
+
});
|
|
5900
|
+
}
|
|
5901
|
+
});
|
|
5903
5902
|
};
|
|
5904
5903
|
|
|
5905
5904
|
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; }
|