deprecated and replace attributes: needed-->required, blur-->placeholder in preprocessor

remove client-side code for them and enable translation of placeholder
This commit is contained in:
ralf 2022-03-05 15:22:45 +02:00
parent d5dc3cff2b
commit 3b896e0919
2 changed files with 15 additions and 14 deletions

View File

@ -82,6 +82,20 @@ const Et2InputWidgetMixin = (superclass) =>
};
}
/**
* List of properties that get translated
* Done separately to not interfere with properties - if we re-define label property,
* labels go missing.
* @returns object
*/
static get translate()
{
return {
...super.translate,
placeholder: true,
}
}
/**
* Compatibility for deprecated name "needed"
*

View File

@ -1243,7 +1243,6 @@ export function loadWebComponent(_nodeName : string, _template_node, parent : Et
*/
function transformAttributes(widget, mgr : et2_arrayMgr, attributes)
{
const widget_class = window.customElements.get(widget.localName);
// Apply any set attributes - widget will do its own coercion
@ -1251,24 +1250,12 @@ function transformAttributes(widget, mgr : et2_arrayMgr, attributes)
{
let attrValue = attributes[attribute];
// If there is not attribute set, ignore it. Widget sets its own default.
// If there is no attribute set, ignore it. Widget sets its own default.
if(typeof attrValue === "undefined")
{
continue;
}
// "needed" is deprecated, use "required"
if(attribute == "needed")
{
attribute = "required";
}
// Skip these ones
// options is legacy / read-only
if(["options"].indexOf(attribute) > -1)
{
continue;
}
const property = widget_class.getPropertyOptions(attribute);
switch(typeof property === "object" ? property.type : property)