feat(js): enforce global lifecycle hard-cuts and helpdesk list adapter
This commit is contained in:
@@ -7,6 +7,45 @@ const noop = () => {};
|
||||
|
||||
const defaultErrorMessage = (moduleId) => `${moduleId} grid init failed`;
|
||||
|
||||
export function initListSection(options = {}) {
|
||||
const {
|
||||
moduleId = 'list-section',
|
||||
initOptions = null,
|
||||
initErrorMessage = '',
|
||||
} = options;
|
||||
|
||||
const safeModuleId = String(moduleId || '').trim() || 'list-section';
|
||||
if (!initOptions || typeof initOptions !== 'object') {
|
||||
warnOnce('UI_CONFIG_INVALID', 'initListSection requires initOptions', {
|
||||
module: safeModuleId,
|
||||
component: 'grid',
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
const failInit = (error = null) => {
|
||||
const message = initErrorMessage || defaultErrorMessage(safeModuleId);
|
||||
warnOnce('UI_INIT_FAIL', message, {
|
||||
module: safeModuleId,
|
||||
component: 'grid',
|
||||
error,
|
||||
});
|
||||
};
|
||||
|
||||
try {
|
||||
const result = initStandardListPage(initOptions);
|
||||
const gridConfig = result?.gridConfig || null;
|
||||
if (!gridConfig || !gridConfig.grid) {
|
||||
failInit();
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
} catch (error) {
|
||||
failInit(error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function createListPageModule(options = {}) {
|
||||
const {
|
||||
configId,
|
||||
|
||||
Reference in New Issue
Block a user