cedro 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +7 -4
  2. package/dist/cedro-logo.png +0 -0
  3. package/dist/fangio.jpg +0 -0
  4. package/package.json +4 -2
  5. package/src/core/application.builder.tsx +121 -0
  6. package/src/core/{application.core.ts → application.core.tsx} +175 -9
  7. package/src/core/themes.core.ts +160 -1
  8. package/src/core/uid.ts +3 -3
  9. package/src/index.ts +1 -1
  10. package/src/interfaces/application.interface.ts +10 -3
  11. package/src/interfaces/widget.interface.ts +6 -1
  12. package/src/types/select.item.type.ts +11 -0
  13. package/src/ui/Icon.ui.tsx +158 -0
  14. package/src/ui/IconButton.ui.tsx +233 -0
  15. package/src/ui/{textbox.ui.ts → Textbox.ui.tsx} +69 -8
  16. package/src/ui/accordion.ui.tsx +152 -0
  17. package/src/ui/button.ui.tsx +209 -0
  18. package/src/ui/buttonColor.ui.tsx +87 -0
  19. package/src/ui/buttonmenu.ui.tsx +134 -0
  20. package/src/ui/{buttonstack.ui.ts → buttonstack.ui.tsx} +67 -1
  21. package/src/ui/checkbox.ui.tsx +43 -0
  22. package/src/ui/container.ui.tsx +141 -0
  23. package/src/ui/datagrid.ui.tsx +518 -0
  24. package/src/ui/dialog.tsx +143 -56
  25. package/src/ui/{hpanel.ui.ts → hpanel.ui.tsx} +64 -1
  26. package/src/ui/iconButtonMenu.ui.tsx +176 -0
  27. package/src/ui/image.ui.tsx +123 -0
  28. package/src/ui/index.ts +9 -9
  29. package/src/ui/label.ui.tsx +184 -0
  30. package/src/ui/loading.ui.ts +10 -10
  31. package/src/ui/menu.ui.ts +2 -2
  32. package/src/ui/progressbar.ui.tsx +135 -0
  33. package/src/ui/radiobutton.ui.tsx +47 -0
  34. package/src/ui/scroll.ui.ts +13 -12
  35. package/src/ui/select.ui.tsx +143 -0
  36. package/src/ui/styles/button.css +114 -32
  37. package/src/ui/styles/buttoncolor.css +8 -8
  38. package/src/ui/styles/container.css +29 -0
  39. package/src/ui/styles/hpanel.css +1 -1
  40. package/src/ui/styles/icon.css +29 -0
  41. package/src/ui/styles/image.css +19 -19
  42. package/src/ui/styles/label.css +63 -0
  43. package/src/ui/styles/loading.css +12 -12
  44. package/src/ui/styles/main.css +5 -0
  45. package/src/ui/styles/progressbar.css +3 -2
  46. package/src/ui/styles/select.css +13 -0
  47. package/src/ui/styles/stackbutton.css +36 -0
  48. package/src/ui/styles/tabs.css +5 -7
  49. package/src/ui/styles/textarea.css +13 -13
  50. package/src/ui/styles/valuebar.css +1 -1
  51. package/src/ui/styles/vpanel.css +1 -1
  52. package/src/ui/switch.ui.tsx +42 -0
  53. package/src/ui/{tabs.ui.ts → tabs.ui.tsx} +114 -8
  54. package/src/ui/textarea.ui.tsx +48 -0
  55. package/src/ui/{toolbar.ui.ts → toolbar.ui.tsx} +44 -1
  56. package/src/ui/{valuebar.ui.ts → valuebar.ui.tsx} +35 -1
  57. package/src/ui/{vpanel.ui.ts → vpanel.ui.tsx} +44 -1
  58. package/src/ui/widget.builder.ts +243 -0
  59. package/src/ui/widget.collection.ts +57 -5
  60. package/src/ui/widget.ui.ts +176 -24
  61. package/src/ui/Icon.ui.ts +0 -64
  62. package/src/ui/IconButton.ui.ts +0 -114
  63. package/src/ui/accordion.ui.ts +0 -71
  64. package/src/ui/button.ui.ts +0 -105
  65. package/src/ui/buttonColor.ui.ts +0 -24
  66. package/src/ui/buttonmenu.ui.ts +0 -59
  67. package/src/ui/checkbox.ui.ts +0 -8
  68. package/src/ui/container.ui.ts +0 -38
  69. package/src/ui/datagrid.ui.ts +0 -231
  70. package/src/ui/iconButtonMenu.ui.ts +0 -59
  71. package/src/ui/image.ui.ts +0 -49
  72. package/src/ui/label.ui.ts +0 -82
  73. package/src/ui/progressbar.ui.ts +0 -74
  74. package/src/ui/radiobutton.ts +0 -8
  75. package/src/ui/select.ui.ts +0 -73
  76. package/src/ui/switch.ui.ts +0 -7
  77. package/src/ui/textarea.ui.ts +0 -20
  78. package/src/ui/widget.builder.ui.tsx +0 -676
  79. /package/src/ui/{toggle.ui.ts → toggle.ui.tsx} +0 -0
@@ -1,114 +0,0 @@
1
- import "./styles/button.css";
2
- import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
3
- import { Button } from "./button.ui";
4
- import { Icon } from "./Icon.ui";
5
- import { Label } from "./label.ui";
6
-
7
- export class IconButton extends Button {
8
- icon: Icon;
9
- label: Label;
10
-
11
- showIcon: boolean;
12
- showText: boolean;
13
-
14
- constructor(id: string, icon: string = "dark_mode", parent: Widget | null = null) {
15
- super(id, parent);
16
-
17
- this.setAlign(WidgetAlignTypes.HORIZONTAL);
18
- this.icon = new Icon(id + ".icon", icon, undefined, this);
19
- this.label = new Label(id + ".label", undefined, this);
20
-
21
- this.showIcon = true;
22
- this.showText = true;
23
-
24
- this.init();
25
- }
26
-
27
- public displayIcon(): void {
28
- this.showIcon = true;
29
- this.icon.setVisible(true);
30
- this.render();
31
- }
32
-
33
- public hideIcon(): void {
34
- this.showIcon = false;
35
- this.icon.setVisible(false);
36
- this.render();
37
- }
38
-
39
- public displayText(): void {
40
- this.showText = true;
41
- this.label.setVisible(true);
42
- this.render();
43
- }
44
-
45
- public hideText(): void {
46
- this.showText = false;
47
- this.label.setVisible(false);
48
- this.render();
49
- }
50
-
51
- public init(): void {
52
- super.init();
53
- }
54
-
55
- public onlyIcon(): boolean {
56
- if (this.label.getText().length > 0) return false;
57
- return true;
58
- }
59
-
60
- public render(): void {
61
- super.render();
62
-
63
- const iconWidth = 24;
64
- const padding = 5;
65
-
66
- if (this.onlyIcon()) {
67
- this.icon.getBody().style.position = "absolute";
68
-
69
- const startX = this.getBody().clientWidth / 2 - iconWidth / 2;
70
- const startY = this.getH() / 2 - this.icon.getH() / 2;
71
-
72
- this.icon.setX(startX);
73
- this.icon.setY(startY);
74
- } else {
75
- this.label.getBody().style.position = "absolute";
76
- this.icon.getBody().style.position = "absolute";
77
-
78
- const labelHeight = this.label.getBody().clientHeight;
79
-
80
- const startX = padding; //this.getBody().clientWidth / 2 - (iconWidth + labelWidth) / 2;
81
- const startLabelX = startX + iconWidth + padding;
82
- let startY = this.getH() / 2 - iconWidth / 2;
83
- let startLabelY = this.getH() / 2 - labelHeight / 2;
84
-
85
- if (this.getType() !== WidgetTypes.FILL) {
86
- startY = this.getH() / 2 - this.icon.getH() / 2;
87
- this.label.getBody().style.lineHeight = this.getH() + "px";
88
- startLabelY = this.getH() / 2 - this.label.getH() / 2;
89
- }
90
-
91
- if (startX < 0 || startY < 0) {
92
- setTimeout(() => {
93
- this.render();
94
- }, 500);
95
- return;
96
- }
97
-
98
- this.icon.setX(startX);
99
- this.label.setX(startLabelX + padding);
100
-
101
- this.icon.setY(startY);
102
- this.label.setY(startLabelY);
103
- }
104
- }
105
-
106
- public setText(text: string): void {
107
- //super.setText(text);
108
- this.label.setText(text);
109
- }
110
-
111
- public setIcon(icon: string): void {
112
- this.icon.setIcon(icon);
113
- }
114
- }
@@ -1,71 +0,0 @@
1
- import "./styles/accordion.css";
2
- import { IconButton } from "./IconButton.ui";
3
- import { Label } from "./label.ui";
4
- import { Widget, WidgetTypes } from "./widget.ui";
5
-
6
- const ACCORDION_HEADER_HEIGHT = 40;
7
-
8
- type AccordionItem = {
9
- header: Widget;
10
- content: Widget;
11
- };
12
-
13
- export class Accordion extends Widget {
14
- items: Map<string, AccordionItem>;
15
- selectedItemId: string | null;
16
- constructor(id: string, parent: Widget | null = null) {
17
- super(id, "div", parent);
18
-
19
- this.items = new Map<string, AccordionItem>();
20
-
21
- this.selectedItemId = null;
22
-
23
- this.addClass("WUIAccordion");
24
- }
25
-
26
- public selectItem(id: string): void {
27
- const selected = this.items.get(id);
28
-
29
- if (this.selectedItemId !== null) {
30
- //deseleccionamos
31
- const previous = this.items.get(this.selectedItemId);
32
-
33
- if (previous) {
34
- previous.content.setFixedSize(0);
35
- }
36
- }
37
-
38
- if (selected) {
39
- this.selectedItemId = id;
40
- selected.content.setFixedSize(null);
41
- }
42
-
43
- this.render();
44
- }
45
-
46
- public addItem(title: string, icon: string, content: Widget): void {
47
- const header =
48
- icon !== ""
49
- ? new IconButton(content.id + ".header", icon, null)
50
- : new Label(content.id + ".header", "span", null);
51
-
52
- header.setType(WidgetTypes.FILL);
53
- header.setFixedSize(ACCORDION_HEADER_HEIGHT);
54
- header.setText(title);
55
-
56
- header.subscribe({
57
- event: "click",
58
- then: (_e, _w) => {
59
- this.selectItem(content.id);
60
- },
61
- });
62
-
63
- content.setType(WidgetTypes.FILL);
64
- content.setFixedSize(0);
65
-
66
- this.items.set(content.id, { header, content });
67
-
68
- this.addChild(header);
69
- this.addChild(content);
70
- }
71
- }
@@ -1,105 +0,0 @@
1
- import "./styles/button.css";
2
- import "./styles/stackbutton.css";
3
- import "./styles/vstackbutton.css";
4
- import { Colors } from "./colors.ui";
5
- import { Widget } from "./widget.ui";
6
-
7
- export type ButonVariants =
8
- | "contained"
9
- | "outlined"
10
- | "text"
11
- | "stack-start"
12
- | "stack-middle"
13
- | "stack-end"
14
- | "stack-start-active"
15
- | "stack-middle-active"
16
- | "stack-end-active"
17
- | "stack-vertical-start"
18
- | "stack-vertical-middle"
19
- | "stack-vertical-end"
20
- | "stack-vertical-start-active"
21
- | "stack-vertical-middle-active"
22
- | "stack-vertical-end-active";
23
- export type ButonSizes = "small" | "medium" | "large";
24
-
25
- export class Button extends Widget {
26
- variant: ButonVariants;
27
- color: Colors;
28
- fullWidth: boolean;
29
- size: ButonSizes;
30
- href: string;
31
- text: string;
32
-
33
- constructor(id: string, parent: Widget | null = null) {
34
- super(id, "button", parent);
35
-
36
- this.fullWidth = false;
37
- //this.setType(WidgetTypes.CUSTOM);
38
- this.variant = "text";
39
- this.color = "primary"; //primary";
40
- this.size = "medium";
41
- this.href = "#";
42
- this.text = "";
43
-
44
- this.configureStyles();
45
-
46
- this.init();
47
- }
48
-
49
- private configureStyles(): void {
50
- this.deleteAllClasses();
51
- this.addClass(`WUIButton-${this.variant}`);
52
- this.addClass(`WUIButton-${this.variant}-color-${this.color}`);
53
- }
54
-
55
- public init(): void {
56
- super.init();
57
- }
58
-
59
- setText(text: string): void {
60
- this.text = text;
61
- this.body.innerHTML = text;
62
- }
63
-
64
- setVariant(variant: ButonVariants = "contained"): void {
65
- this.variant = variant;
66
- this.configureStyles();
67
- }
68
-
69
- setColor(color: Colors = "primary"): void {
70
- this.color = color;
71
- this.configureStyles();
72
- }
73
-
74
- setFullWidth(fullWidth: boolean = false): void {
75
- this.fullWidth = fullWidth;
76
- }
77
-
78
- setSize(size: ButonSizes = "medium"): void {
79
- this.size = size;
80
- }
81
-
82
- setHref(href: string): void {
83
- this.href = href;
84
- }
85
-
86
- getVariant(): ButonVariants {
87
- return this.variant;
88
- }
89
-
90
- getColor(): Colors {
91
- return this.color;
92
- }
93
-
94
- getSize(): ButonSizes {
95
- return this.size;
96
- }
97
-
98
- getHref(): string {
99
- return this.href;
100
- }
101
-
102
- getText(): string {
103
- return this.text;
104
- }
105
- }
@@ -1,24 +0,0 @@
1
- import "./styles/buttoncolor.css";
2
- import { Button } from "./button.ui";
3
- import { Widget } from "./widget.ui";
4
-
5
- export class ButtonColor extends Button {
6
- inputColor: Widget;
7
- constructor(id: string, parent: Widget | null = null) {
8
- super(id, parent);
9
-
10
- this.inputColor = new Widget(id + ".inputColor", "input", this);
11
- this.inputColor.getBody().setAttribute("type", "color");
12
- this.inputColor.addClass("WUIButtonColorInput");
13
- }
14
-
15
- public setValue(value: string): void {
16
- this.inputColor.getBody().setAttribute("value", value);
17
- }
18
-
19
- public getValue(): string {
20
- const value = this.inputColor.getBody().getAttribute("value");
21
-
22
- return value ? value : "";
23
- }
24
- }
@@ -1,59 +0,0 @@
1
- import { Button } from "./button.ui";
2
- import { Menu } from "./menu.ui";
3
- import { SelectItem } from "./select.ui";
4
-
5
- export class ButtonMenu extends Button {
6
- menu: Menu;
7
- items: Array<SelectItem>;
8
- selectedItem: SelectItem | null;
9
-
10
- public constructor(id: string) {
11
- super(id);
12
-
13
- this.menu = new Menu(this.id + ".menu", this.id, null);
14
-
15
- this.items = new Array<SelectItem>();
16
- this.selectedItem = null;
17
-
18
- this.subscribe({
19
- event: "click",
20
- then: () => {
21
- this.menu.clearOptions();
22
- this.items.forEach((item) => {
23
- this.menu.addOption(item.id, item.icon, item.label);
24
- });
25
-
26
- this.menu.wakeUp();
27
-
28
- if (this.getW() > this.menu.getW()) {
29
- this.menu.setW(this.getBody().clientWidth);
30
- console.log("cambiando ancho...");
31
- }
32
- },
33
- });
34
-
35
- /*this.menu.subscribe({
36
- event: "option-clicked",
37
- then: (_e, clickedOption) => {
38
- const option = clickedOption as IconButton;
39
-
40
- const fintOption = this.items.find((item) => item.id === option.id);
41
-
42
- if (fintOption) {
43
- this.selectedItem = fintOption;
44
- }
45
-
46
- const selectedText = this.selectedItem?.label;
47
- if (selectedText) {
48
- this.setText(selectedText);
49
- } else {
50
- this.setText("");
51
- }
52
- },
53
- });*/
54
- }
55
-
56
- public addItem(id: string, label: string, icon: string): void {
57
- this.items.push(new SelectItem(id, label, icon));
58
- }
59
- }
@@ -1,8 +0,0 @@
1
- import { ToggleButton } from "./toggle.ui";
2
- import { Widget } from "./widget.ui";
3
-
4
- export class Checkbox extends ToggleButton {
5
- constructor(id: string, text: string = "", parent: Widget | null = null) {
6
- super(id, text, "check_box_outline_blank", "check_box_outlined", parent);
7
- }
8
- }
@@ -1,38 +0,0 @@
1
- import { OrientationTypes } from "src/types/orientation.type";
2
- import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
3
- import { UID } from "../core/uid";
4
-
5
- export type ContainerParams = {
6
- orientation?: OrientationTypes;
7
- parent?: Widget | null;
8
- size?: number | null;
9
- padding?: number | null;
10
- };
11
-
12
- export class Container extends Widget {
13
- constructor(params: ContainerParams) {
14
- const { orientation = "horizontal", parent = null, size = null, padding = null } = params;
15
-
16
- super(UID(), "div", parent);
17
-
18
- if (orientation === "horizontal") {
19
- this.setAlign(WidgetAlignTypes.HORIZONTAL);
20
- } else {
21
- this.setAlign(WidgetAlignTypes.VERTICAL);
22
- }
23
-
24
- if (size !== null) {
25
- this.setFixedSize(size);
26
- }
27
-
28
- if (padding !== null) {
29
- this.setPadding(padding);
30
- }
31
-
32
- this.setType(WidgetTypes.FILL);
33
- }
34
- }
35
-
36
- export function Spacer(): Container {
37
- return new Container({});
38
- }
@@ -1,231 +0,0 @@
1
- import "./styles/datagrid.css";
2
- import { Label } from "./label.ui";
3
- import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
4
- import { Scroll } from "./scroll.ui";
5
-
6
- const DATA_GRID_HEADER_HEIGHT = 30;
7
- const DATA_GRID_FOOTER_HEIGHT = 40;
8
- const DATA_GRID_ROW_HEIGHT = 20;
9
- const DATA_GRID_MIN_COLUMN_WIDTH = 24;
10
-
11
- type DataGridColumn = {
12
- header: string;
13
- width: number | null;
14
- handler: (args: any) => void;
15
- };
16
-
17
- export class DataGrid extends Widget {
18
- headerContainer: Widget;
19
- dataContainer: Widget;
20
- footerContainer: Widget;
21
- data: Array<any>;
22
- verticalScrollbar: Scroll;
23
- horizontalScrollbar: Scroll;
24
-
25
- rowHeight: number;
26
-
27
- columns: Array<DataGridColumn>;
28
-
29
- constructor(id: string, parent: Widget | null = null) {
30
- super(id, "div", parent);
31
-
32
- this.rowHeight = DATA_GRID_ROW_HEIGHT;
33
-
34
- this.headerContainer = new Widget(id + ".header", "div");
35
- this.headerContainer.setType(WidgetTypes.FILL);
36
- this.headerContainer.setFixedSize(DATA_GRID_HEADER_HEIGHT);
37
- this.headerContainer.addClass("WUIDataGrid-Header");
38
-
39
- this.dataContainer = new Widget(id + ".data", "div");
40
- this.dataContainer.setType(WidgetTypes.FILL);
41
-
42
- this.footerContainer = new Widget(id + ".footer", "div");
43
- this.footerContainer.setType(WidgetTypes.FILL);
44
- this.footerContainer.setFixedSize(DATA_GRID_FOOTER_HEIGHT);
45
-
46
- this.setType(WidgetTypes.FILL);
47
- this.setAlign(WidgetAlignTypes.VERTICAL);
48
-
49
- this.addChild(this.headerContainer);
50
- this.addChild(this.dataContainer);
51
- this.addChild(this.footerContainer);
52
-
53
- this.verticalScrollbar = new Scroll(id + ".VerticalScrollbar", this.dataContainer);
54
- this.horizontalScrollbar = new Scroll(
55
- id + ".HorizontalScrollbar",
56
- this.dataContainer,
57
- "horizontal"
58
- );
59
-
60
- this.columns = new Array<DataGridColumn>();
61
-
62
- this.data = new Array<any>();
63
-
64
- this.addClass("WUIDataGrid");
65
- }
66
-
67
- public hideFooter(): void {
68
- this.footerContainer.setFixedSize(0);
69
- }
70
-
71
- public showFooter(): void {
72
- this.footerContainer.setFixedSize(DATA_GRID_FOOTER_HEIGHT);
73
- }
74
-
75
- private getFreeWidth(): number {
76
- let freeW = 0;
77
- for (let i = 0; i < this.columns.length; i++) {
78
- let width = this.columns[i].width;
79
- if (width) {
80
- freeW += width;
81
- }
82
- }
83
-
84
- freeW = this.dataContainer.getW() - freeW;
85
-
86
- if (freeW < DATA_GRID_MIN_COLUMN_WIDTH) {
87
- freeW = DATA_GRID_MIN_COLUMN_WIDTH;
88
- }
89
- return freeW;
90
- }
91
-
92
- private getAllColumnsWidth(): number {
93
- let returnValue = 0;
94
- for (let i = 0; i < this.columns.length; i++) {
95
- let width = this.columns[i].width;
96
- if (width) {
97
- returnValue += width;
98
- }
99
- }
100
- return returnValue;
101
- }
102
-
103
- public init(): void {
104
- super.init();
105
-
106
- this.createHeaders();
107
- }
108
-
109
- private createHeaders(): void {
110
- if (!this.columns) {
111
- return;
112
- }
113
-
114
- for (let i = 0; i < this.columns.length; i++) {
115
- const btn = new Label(this.id + "header." + i, "span");
116
- btn.addClass("WUIDataGrid-HeaderLabel");
117
- this.headerContainer.addChild(btn);
118
- }
119
-
120
- this.buildRows();
121
- this.renderHeaders();
122
- }
123
-
124
- private renderHeaders(): void {
125
- if (!this.columns) {
126
- return;
127
- }
128
-
129
- let startX = 0;
130
- for (let i = 0; i < this.columns.length; i++) {
131
- const column = this.columns[i];
132
- const btn = window.w.get(this.id + "header." + i) as Label;
133
- const width = column.width ? column.width : this.getFreeWidth();
134
- btn.setType(WidgetTypes.CUSTOM);
135
- btn.setX(startX);
136
- btn.setY(0);
137
- btn.setW(width);
138
- btn.setH(DATA_GRID_HEADER_HEIGHT);
139
- btn.getBody().style.lineHeight = DATA_GRID_HEADER_HEIGHT + "px";
140
- btn.setText(column.header);
141
- this.headerContainer.addChild(btn);
142
- startX += width;
143
- }
144
- }
145
-
146
- private buildRows(): void {
147
- let rowY = 0;
148
-
149
- for (let i = 0; i < this.data.length; i++) {
150
- const row = new Widget(this.id + ".row." + i, "div");
151
-
152
- row.setType(WidgetTypes.CUSTOM);
153
- row.getBody().style.position = "absolute";
154
- row.getBody().style.overflow = "hidden";
155
- row.addClass("WUIDataGrid-Row");
156
-
157
- this.dataContainer.addChild(row);
158
-
159
- for (let j = 0; j < this.columns.length; j++) {
160
- const column = this.columns[j];
161
- const fieldId = this.id + ".row." + i + ".column." + j;
162
- column.handler({
163
- data: this.data[i],
164
- index: i,
165
- fieldId: fieldId,
166
- row: row,
167
- });
168
- const columnWidget = window.w.get(fieldId) as Widget;
169
- columnWidget.getBody().style.position = "absolute";
170
- }
171
- rowY += this.rowHeight;
172
- }
173
- }
174
-
175
- private renderRows(): void {
176
- let rowY = 0;
177
-
178
- for (let i = 0; i < this.data.length; i++) {
179
- const row = window.w.get(this.id + ".row." + i) as Widget;
180
-
181
- row.setX(0);
182
- row.setY(rowY);
183
- row.setW(this.getAllColumnsWidth());
184
- row.setH(this.rowHeight);
185
-
186
- let widgetX = 0;
187
- for (let j = 0; j < this.columns.length; j++) {
188
- const column = this.columns[j];
189
- const fieldId = this.id + ".row." + i + ".column." + j;
190
- const columnWidget = window.w.get(fieldId) as Widget;
191
- columnWidget.setY(0);
192
- columnWidget.setX(widgetX);
193
- columnWidget.setH(this.rowHeight);
194
- if (column.width) {
195
- columnWidget.setW(column.width);
196
- } else {
197
- columnWidget.setW(this.getFreeWidth());
198
- }
199
- widgetX += column.width ? column.width : columnWidget.getW();
200
- }
201
- rowY += this.rowHeight;
202
- }
203
- }
204
-
205
- public render(): void {
206
- super.render();
207
- this.renderHeaders();
208
- this.renderRows();
209
- this.verticalScrollbar.render();
210
- this.horizontalScrollbar.render();
211
- }
212
-
213
- public setRowHeight(rowHeight: number): void {
214
- this.rowHeight = rowHeight;
215
- }
216
-
217
- public addColumn(header: string, width: number | null, handler: (args: any) => void) {
218
- this.columns.push({ header, width, handler });
219
- }
220
-
221
- public getHeader(index: number): Label {
222
- return window.w.get(this.id + "header." + index) as Label;
223
- }
224
-
225
- public setData(data: Array<any>): void {
226
- this.data = data;
227
-
228
- this.buildRows();
229
- this.renderRows();
230
- }
231
- }