Skip to content

Commit

Permalink
refactor initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
skie committed Nov 4, 2024
1 parent cf5c5b9 commit 14cf496
Showing 1 changed file with 38 additions and 25 deletions.
63 changes: 38 additions & 25 deletions webroot/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,32 +895,45 @@ const SearchLookupInput = {
};

const createMyApp = (root, callback) => {
const app = Vue.createApp(SearchApp);
app.component('AddNewFilter', AddNewFilter);
app.component('SearchItem', SearchItem);
app.component('SearchCondition', SearchCondition);
app.component('SearchInput', SearchInput);
app.component('SearchInputDate', SearchInputDate);
app.component('SearchInputDateFixed', SearchInputDateFixed);
app.component('SearchInputDateRange', SearchInputDateRange);
app.component('SearchInputDateTime', SearchInputDateTime);
app.component('SearchInputDateTimeFixed', SearchInputDateTimeFixed);
app.component('SearchInputDateTimeRange', SearchInputDateTimeRange);
app.component('SearchInputNumericRange', SearchInputNumericRange);
app.component('SearchNone', SearchNone);
app.component('Select2', Select2);
app.component('SearchSelect', SearchSelect);
app.component('SearchSelectMultiple', SearchSelectMultiple);
app.component('SearchMultiple', SearchMultiple);
app.component('SearchMultipleItem', SearchMultipleItem);
app.component('SearchLookupInput', SearchLookupInput);
if (callback != undefined) {
callback(app, registerConditions);
if (window._search.app) {
window._search.app.unmount();
delete window._search.app;
}
window._search.rootElemId = root;
app.mount('#' + root);
window._search.app = app;

setTimeout(() => {
const app = Vue.createApp(SearchApp);
app.component('AddNewFilter', AddNewFilter);
app.component('SearchItem', SearchItem);
app.component('SearchCondition', SearchCondition);
app.component('SearchInput', SearchInput);
app.component('SearchInputDate', SearchInputDate);
app.component('SearchInputDateFixed', SearchInputDateFixed);
app.component('SearchInputDateRange', SearchInputDateRange);
app.component('SearchInputDateTime', SearchInputDateTime);
app.component('SearchInputDateTimeFixed', SearchInputDateTimeFixed);
app.component('SearchInputDateTimeRange', SearchInputDateTimeRange);
app.component('SearchInputNumericRange', SearchInputNumericRange);
app.component('SearchNone', SearchNone);
app.component('Select2', Select2);
app.component('SearchSelect', SearchSelect);
app.component('SearchSelectMultiple', SearchSelectMultiple);
app.component('SearchMultiple', SearchMultiple);
app.component('SearchMultipleItem', SearchMultipleItem);
app.component('SearchLookupInput', SearchLookupInput);

if (callback != undefined) {
callback(app, registerConditions);
}

window._search.rootElemId = root;
const mountElement = document.getElementById(root);
if (mountElement) {
app.mount('#' + root);
window._search.app = app;
} else {
console.warn(`Mount element #${root} not found`);
}
}, 0);
};
window._search.rootElemId = SearchApp.rootElemId;
window._search.createMyApp = createMyApp;

0 comments on commit 14cf496

Please sign in to comment.