poc form SDK (extends to form)

This commit is contained in:
Benjamin Dalsass
2023-08-24 14:29:31 +02:00
parent 245c1d0be5
commit 20ae64706a
3325 changed files with 1500 additions and 547966 deletions

56
js/DI/widget.js Normal file
View File

@@ -0,0 +1,56 @@
/**
* Widgets handling.
*
* @returns {{handleElement: handleElement}}
* @constructor
*/
const Widget = function(){
/**
* initWidgets.
*
* @param oElement
*/
function initWidgets(oElement){
// get all widgets
const aWidgetFields = oElement.querySelectorAll('[data-widget]');
// iterate throw widgets...
aWidgetFields.forEach(function (widgetField) {
// initialize widget
const sWidgetName = widgetField.dataset.widget;
const oWidget = eval(`$(widgetField).${sWidgetName}()`);
console.log('Init widget: ' + sWidgetName);
console.log(oWidget);
});
}
/**
* handleElement.
*
* @param element
*/
function handleElement(element){
initWidgets(element);
}
return {
handleElement,
}
};