@appcorp/fusion-storybook 0.2.0 → 0.2.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.
|
@@ -77,7 +77,8 @@ export const AdmissionForm = () => {
|
|
|
77
77
|
},
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
|
+
}, [id, dispatch]);
|
|
81
82
|
return (_jsxs("div", { className: "grid grid-cols-1 gap-2 space-y-2", children: [_jsx("h4", { className: "m-0 p-0", children: t("formSectionStudentInformation") }), _jsxs("div", { className: "grid grid-cols-5 gap-4", children: [_jsx(EnhancedInput, { error: errors.firstName, id: "firstName", info: t("formFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("firstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: firstName || "" }), _jsx(EnhancedInput, { error: errors.lastName, id: "lastName", info: t("formLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("lastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: lastName || "" }), _jsx(EnhancedInput, { error: errors.studentIdNumber, id: "studentIdNumber", info: t("formStudentIdNumberInfo"), label: t("formStudentIdNumberLabel"), onChange: (e) => handleChange("studentIdNumber", e.target.value), placeholder: t("formStudentIdNumberPlaceholder"), required: true, type: "text", value: studentIdNumber || "" }), _jsx(EnhancedCombobox, { emptyText: t("formNoGenderOptionsEmpty"), error: errors.gender, id: "gender", info: t("formGenderInfo"), label: t("formGenderLabel"), required: true, onValueChange: (value) => handleChange("gender", value), options: [
|
|
82
83
|
{ label: t("formOptionMale"), value: GENDER.MALE },
|
|
83
84
|
{ label: t("formOptionFemale"), value: GENDER.FEMALE },
|
|
@@ -52,7 +52,7 @@ const createComponentInstances = () => ({
|
|
|
52
52
|
moreActions: _jsx(AdmissionMoreActions, {}),
|
|
53
53
|
view: _jsx(AdmissionView, {}),
|
|
54
54
|
});
|
|
55
|
-
const createAdmissionConfig = ({ cancelLabel, dispatch, drawerTitle, labelActions, labelClass, labelEnabled, labelFirstName, labelId, labelLastName, labelRegistrationCode, labelStatus, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
|
|
55
|
+
const createAdmissionConfig = ({ cancelLabel, dispatch, drawer, drawerTitle, labelActions, labelClass, labelEnabled, labelFirstName, labelId, labelLastName, labelRegistrationCode, labelStatus, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
|
|
56
56
|
const components = createComponentInstances();
|
|
57
57
|
return {
|
|
58
58
|
moduleName: "admission",
|
|
@@ -76,7 +76,7 @@ const createAdmissionConfig = ({ cancelLabel, dispatch, drawerTitle, labelAction
|
|
|
76
76
|
tableDescription,
|
|
77
77
|
tableTitle,
|
|
78
78
|
viewContent: components.view,
|
|
79
|
-
size: "small",
|
|
79
|
+
size: drawer === ADMISSION_DRAWER.FORM_DRAWER ? "full" : "small",
|
|
80
80
|
onClearFilters: () => {
|
|
81
81
|
dispatch({ type: ADMISSION_ACTION_TYPES.RESET_FORM });
|
|
82
82
|
},
|
|
@@ -88,12 +88,10 @@ const createAdmissionConfig = ({ cancelLabel, dispatch, drawerTitle, labelAction
|
|
|
88
88
|
const GenericAdmissionPage = createGenericModulePage();
|
|
89
89
|
const AdmissionPageInner = (props) => {
|
|
90
90
|
const context = useAdmissionModule();
|
|
91
|
-
// Memoize config creation -
|
|
92
|
-
// The drawer state changing (from clicking buttons) would recreate this config,
|
|
93
|
-
// causing unnecessary re-renders and state updates. Since config should be stable
|
|
94
|
-
// across drawer state changes, we exclude it from dependencies.
|
|
91
|
+
// Memoize config creation - destructure props to avoid object reference changes
|
|
95
92
|
const admissionConfig = useMemo(() => createAdmissionConfig({
|
|
96
93
|
dispatch: context.dispatch,
|
|
94
|
+
drawer: context.state.drawer,
|
|
97
95
|
cancelLabel: props.cancelLabel,
|
|
98
96
|
drawerTitle: props.drawerTitle,
|
|
99
97
|
labelActions: props.labelActions,
|
|
@@ -110,6 +108,7 @@ const AdmissionPageInner = (props) => {
|
|
|
110
108
|
tableTitle: props.tableTitle,
|
|
111
109
|
}), [
|
|
112
110
|
context.dispatch,
|
|
111
|
+
context.state.drawer,
|
|
113
112
|
props.cancelLabel,
|
|
114
113
|
props.drawerTitle,
|
|
115
114
|
props.labelActions,
|
|
@@ -125,11 +124,6 @@ const AdmissionPageInner = (props) => {
|
|
|
125
124
|
props.tableDescription,
|
|
126
125
|
props.tableTitle,
|
|
127
126
|
]);
|
|
128
|
-
// Dynamically apply drawer size to config for proper drawer sizing
|
|
129
|
-
// This allows size to change without recreating the entire config
|
|
130
|
-
const admissionConfigWithSize = useMemo(() => (Object.assign(Object.assign({}, admissionConfig), { size: context.state.drawer === ADMISSION_DRAWER.FORM_DRAWER
|
|
131
|
-
? "full"
|
|
132
|
-
: "small" })), [admissionConfig, context.state.drawer]);
|
|
133
127
|
const hasPermission = resolveRbacPermissions({
|
|
134
128
|
userRole: props.userRole,
|
|
135
129
|
moduleName: "Admission",
|
|
@@ -137,7 +131,7 @@ const AdmissionPageInner = (props) => {
|
|
|
137
131
|
if (!hasPermission) {
|
|
138
132
|
return _jsx(RbacNoAccess, { moduleName: "Admission" });
|
|
139
133
|
}
|
|
140
|
-
return (_jsx("div", { className: "p-4", children: _jsx(GenericAdmissionPage, { overrideConfig:
|
|
134
|
+
return (_jsx("div", { className: "p-4", children: _jsx(GenericAdmissionPage, { overrideConfig: admissionConfig, context: context, tableBodyCols: tableBodyCols }) }));
|
|
141
135
|
};
|
|
142
136
|
// ============================================================================
|
|
143
137
|
// PAGE EXPORTS
|