admin_lsac 2.0.10 → 2.0.11
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.
|
@@ -91,7 +91,7 @@ export function AdminPage({ pages, selectedPage, basePath, apiURL = '', }) {
|
|
|
91
91
|
rowActionsMenu.remove();
|
|
92
92
|
}
|
|
93
93
|
}, children: rowAction.name }, index)));
|
|
94
|
-
} }) }), _jsxs(Modal, { size: '6xl', isOpen: isOpen, onClose: onClose, children: [_jsx(ModalOverlay, {}), _jsxs(ModalContent, { children: [_jsx(ModalHeader, { children: selectedAction.name }), _jsx(ModalCloseButton, {}), _jsxs(ModalBody, { children: [selectedAction.fields
|
|
94
|
+
} }) }), _jsxs(Modal, { size: '6xl', isOpen: isOpen, onClose: onClose, children: [_jsx(ModalOverlay, {}), _jsxs(ModalContent, { children: [_jsx(ModalHeader, { children: selectedAction.name }), _jsx(ModalCloseButton, {}), _jsxs(ModalBody, { children: [selectedAction.fields ? (_jsx(GenericForm, { action: selectedAction, onClose: onClose, rowId: rowId, rowObject: rowObject })) : (_jsx(Button, { colorScheme: "blue", mr: 3, onClick: () => {
|
|
95
95
|
selectedAction.onSubmit(rowId);
|
|
96
96
|
onClose();
|
|
97
97
|
}, children: "Confirm Action" })), _jsx(Button, { colorScheme: "red", mr: 3, onClick: onClose, children: "Close" })] })] })] })] }));
|
|
@@ -80,16 +80,10 @@ function getCustomInitialValues(fields) {
|
|
|
80
80
|
return obj;
|
|
81
81
|
}
|
|
82
82
|
fields.forEach((field) => {
|
|
83
|
-
if (field.type === '
|
|
84
|
-
obj[field.name] = [];
|
|
85
|
-
else if (field.type === 'object')
|
|
83
|
+
if (field.type === 'object')
|
|
86
84
|
obj[field.name] = getCustomInitialValues(field.fields);
|
|
87
|
-
else if (field.type === 'string')
|
|
88
|
-
obj[field.name] = '';
|
|
89
|
-
else if (field.type === 'number')
|
|
90
|
-
obj[field.name] = 0;
|
|
91
85
|
else
|
|
92
|
-
obj[field.name] =
|
|
86
|
+
obj[field.name] = undefined;
|
|
93
87
|
});
|
|
94
88
|
return obj;
|
|
95
89
|
}
|
|
@@ -128,8 +122,6 @@ export function GenericForm({ action, onClose, rowId, rowObject }) {
|
|
|
128
122
|
const newInitialValues = await getInitialValues(action, rowId);
|
|
129
123
|
setInitialValues(newInitialValues);
|
|
130
124
|
};
|
|
131
|
-
if (!action.fields)
|
|
132
|
-
return _jsx(_Fragment, {});
|
|
133
125
|
return (_jsx(_Fragment, { children: _jsx(Formik, { enableReinitialize: true, initialValues: initialValues, validationSchema: Yup.object(validationSchema), onReset: handleFormReset, onSubmit: async (values) => {
|
|
134
126
|
try {
|
|
135
127
|
if (rowObject !== undefined)
|