@bigbinary/neeto-fields-frontend 1.1.2 → 1.1.3
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/README.md +19 -11
- package/dist/index.cjs.js +17 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -163,15 +163,19 @@ default, but you can customize its behavior by passing optional props.
|
|
|
163
163
|
shown in the dashboard table. This prop is expected when `showOwnersInMenu`
|
|
164
164
|
is set to `true`.
|
|
165
165
|
5. `allowedKinds`:Specifies the list of field kinds allowed to be created.
|
|
166
|
-
6. `paneProps`: Props to be passed to the Add/Edit pane. It accepts
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
166
|
+
6. `paneProps`: Props to be passed to the Add/Edit pane. It accepts the
|
|
167
|
+
following.
|
|
168
|
+
- `children`: The children components to be rendered inside the pane.
|
|
169
|
+
- `validations`: The validations for the formik input fields in the
|
|
170
|
+
`children`. `validations` must be provided as an object with the field name
|
|
171
|
+
as key and the corresponding yup validation schema as the value.
|
|
172
|
+
- `initialValues`: The initial values for the formik input fields in the
|
|
173
|
+
`children`. It is provided as an object with the field name as key and the
|
|
174
|
+
corresponding value.
|
|
175
|
+
- `hideRequiredSwitch`: A boolean value when set to `true` hides the toggle
|
|
176
|
+
switch for `isRequried`.
|
|
177
|
+
- `onMutationSuccess`: Callback function which is triggered on the success of
|
|
178
|
+
mutation functions (create, update & delete).
|
|
175
179
|
7. `showStateFilter`: Boolean value which specifies whether to show or hide
|
|
176
180
|
state filters.
|
|
177
181
|
8. `fieldStatesTaxonomy`: Specifies the names to be rendered for `active` and
|
|
@@ -546,7 +550,9 @@ This is a React Query hook for creating a field.
|
|
|
546
550
|
|
|
547
551
|
```jsx
|
|
548
552
|
const { mutate: create } = useCreateField();
|
|
549
|
-
const payload = {
|
|
553
|
+
const payload = {
|
|
554
|
+
field: { name, kind, resourceType, ownerId, displayOrder, data },
|
|
555
|
+
};
|
|
550
556
|
create(payload);
|
|
551
557
|
```
|
|
552
558
|
|
|
@@ -558,7 +564,9 @@ This is a React Query hook for updating a field.
|
|
|
558
564
|
|
|
559
565
|
```jsx
|
|
560
566
|
const { mutate: update } = useUpdateField();
|
|
561
|
-
const payload = {
|
|
567
|
+
const payload = {
|
|
568
|
+
field: { name, kind, resourceType, ownerId, displayOrder, data },
|
|
569
|
+
};
|
|
562
570
|
update({ fieldId, payload });
|
|
563
571
|
```
|
|
564
572
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -6904,7 +6904,8 @@ var Edit = function Edit(_ref) {
|
|
|
6904
6904
|
_useShowField$data = _useShowField.data,
|
|
6905
6905
|
_useShowField$data2 = _useShowField$data === void 0 ? {} : _useShowField$data,
|
|
6906
6906
|
_useShowField$data2$f = _useShowField$data2.field,
|
|
6907
|
-
field = _useShowField$data2$f === void 0 ? {} : _useShowField$data2$f
|
|
6907
|
+
field = _useShowField$data2$f === void 0 ? {} : _useShowField$data2$f,
|
|
6908
|
+
isLoading = _useShowField.isLoading;
|
|
6908
6909
|
var _useUpdateField = useUpdateField({
|
|
6909
6910
|
onSuccess: function onSuccess() {
|
|
6910
6911
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -6928,7 +6929,7 @@ var Edit = function Edit(_ref) {
|
|
|
6928
6929
|
};
|
|
6929
6930
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Header, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
6930
6931
|
style: "h2"
|
|
6931
|
-
}, t("titles.editField"))), /*#__PURE__*/React__default["default"].createElement(formik$1.Form, {
|
|
6932
|
+
}, t("titles.editField"))), isLoading ? /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null) : /*#__PURE__*/React__default["default"].createElement(formik$1.Form, {
|
|
6932
6933
|
formikProps: {
|
|
6933
6934
|
initialValues: _objectSpread$4(_objectSpread$4({}, initialValues), ramda.assoc("kind", FIELD_KINDS[field.kind], field)),
|
|
6934
6935
|
validationSchema: generateValidationSchema(additionalValidations),
|
|
@@ -11801,19 +11802,7 @@ var FieldsDashboard = function FieldsDashboard(_ref) {
|
|
|
11801
11802
|
onClick: function onClick() {
|
|
11802
11803
|
return setIsPaneOpen(true);
|
|
11803
11804
|
}
|
|
11804
|
-
}),
|
|
11805
|
-
additionalValidations: paneProps === null || paneProps === void 0 ? void 0 : paneProps.validations,
|
|
11806
|
-
allowedKinds: allowedKinds,
|
|
11807
|
-
hideRequiredSwitch: paneProps === null || paneProps === void 0 ? void 0 : paneProps.hideRequiredSwitch,
|
|
11808
|
-
initialValues: paneProps === null || paneProps === void 0 ? void 0 : paneProps.initialValues,
|
|
11809
|
-
isOpen: isPaneOpen,
|
|
11810
|
-
ownerId: showOwnersInMenu ? selectedMenu : "",
|
|
11811
|
-
resourceType: showOwnersInMenu ? resourceType : selectedMenu //Currently we support only one resource type when fields are classified based on owners
|
|
11812
|
-
,
|
|
11813
|
-
selectedField: selectedField,
|
|
11814
|
-
onClose: handleClosePane,
|
|
11815
|
-
onMutationSuccess: paneProps === null || paneProps === void 0 ? void 0 : paneProps.onMutationSuccess
|
|
11816
|
-
}, paneProps === null || paneProps === void 0 ? void 0 : paneProps.children)),
|
|
11805
|
+
})),
|
|
11817
11806
|
searchProps: searchProps,
|
|
11818
11807
|
title: pure.humanize(getDashBoardTitle({
|
|
11819
11808
|
isOwnerBased: showOwnersInMenu,
|
|
@@ -11833,7 +11822,19 @@ var FieldsDashboard = function FieldsDashboard(_ref) {
|
|
|
11833
11822
|
rowData: ramda.isEmpty(rowData) ? fields : rowData,
|
|
11834
11823
|
setIsPaneOpen: setIsPaneOpen,
|
|
11835
11824
|
totalCount: count
|
|
11836
|
-
})
|
|
11825
|
+
}), /*#__PURE__*/React__default["default"].createElement(FieldsPane, {
|
|
11826
|
+
additionalValidations: paneProps === null || paneProps === void 0 ? void 0 : paneProps.validations,
|
|
11827
|
+
allowedKinds: allowedKinds,
|
|
11828
|
+
hideRequiredSwitch: paneProps === null || paneProps === void 0 ? void 0 : paneProps.hideRequiredSwitch,
|
|
11829
|
+
initialValues: paneProps === null || paneProps === void 0 ? void 0 : paneProps.initialValues,
|
|
11830
|
+
isOpen: isPaneOpen,
|
|
11831
|
+
ownerId: showOwnersInMenu ? selectedMenu : "",
|
|
11832
|
+
resourceType: showOwnersInMenu ? resourceType : selectedMenu //Currently we support only one resource type when fields are classified based on owners
|
|
11833
|
+
,
|
|
11834
|
+
selectedField: selectedField,
|
|
11835
|
+
onClose: handleClosePane,
|
|
11836
|
+
onMutationSuccess: paneProps === null || paneProps === void 0 ? void 0 : paneProps.onMutationSuccess
|
|
11837
|
+
}, paneProps === null || paneProps === void 0 ? void 0 : paneProps.children)), /*#__PURE__*/React__default["default"].createElement(ReorderPane, {
|
|
11837
11838
|
isOpen: isReorderPaneOpen,
|
|
11838
11839
|
ownerId: showOwnersInMenu ? selectedMenu : "",
|
|
11839
11840
|
onClose: handleReorderPaneClose,
|