widgets.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. 'use strict';
  2. define(function () {
  3. /*
  4. * Cell widgets
  5. */
  6. class Widgets {
  7. constructor() {
  8. console.log("widget constructor")
  9. }
  10. get divider(){
  11. return {
  12. $cell: true,
  13. $type: "hr",
  14. class: "mdc-list-divider",
  15. }
  16. }
  17. headerH3(headertype, label, cssclass) {
  18. return {
  19. $cell: true,
  20. $type: headertype,
  21. class: cssclass,
  22. $text: label
  23. }
  24. }
  25. switch(obj) {
  26. return {
  27. $cell: true,
  28. $type: "div",
  29. class: "mdc-switch",
  30. $components: [
  31. {
  32. $type: "input",
  33. type: "checkbox",
  34. class: "mdc-switch__native-control",
  35. id: obj.id,
  36. $init: obj.init,
  37. //id: "basic-switch",
  38. onchange: obj.onchange
  39. },
  40. {
  41. $type: "div",
  42. class: "mdc-switch__background",
  43. $components: [
  44. {
  45. $type: "div",
  46. class: "mdc-switch__knob"
  47. }
  48. ]
  49. }
  50. ]
  51. }
  52. }
  53. }
  54. return new Widgets;
  55. })