UNPKG

@wavemaker/m3-custom-widgets

Version:

A collection of custom widgets

35 lines (34 loc) 1.36 kB
/* * Use App.getDependency for Dependency Injection * eg: var DialogService = App.getDependency('DialogService'); */ /* perform any action on widgets/variables within this block */ Widget.onReady = function () { if (Widget.props.selected.toString().toLowerCase() === "true") { Widget.Widgets.chip.class += " selected"; } if (Widget.props.configuration.toString().toLowerCase().includes("avatar")) { Widget.Widgets.chip.class += " rounded"; } /* * variables can be accessed through 'Widget.Variables' property here * e.g. to get dataSet in a staticVariable named 'loggedInUser' use following script * Widget.Variables.loggedInUser.getData() * * widgets can be accessed through 'Widget.Widgets' property here * e.g. to get value of text widget named 'username' use following script * 'Widget.Widgets.username.datavalue' */ }; Widget.button1Click = function ($event, widget) { Widget.Widgets.chip.class += " clear"; }; Widget.chipClick = function ($event, widget) { var isSelected = Widget.Widgets.chip.class.split(" ").includes("selected"); if (!isSelected) { Widget.Widgets.chip.class += " selected"; } else { Widget.Widgets.chip.class = Widget.Widgets.chip.class.split(" ").filter(function (val) { return val !== "selected"; }).join(" "); } };