cedro 0.1.9 → 0.1.11
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.
- package/README.md +7 -4
- package/dist/assets/_virtual/_commonjsHelpers.js +1 -0
- package/dist/assets/_virtual/index.js +1 -0
- package/dist/assets/_virtual/modulepreload-polyfill.js +1 -0
- package/dist/assets/_virtual/named-references.js +1 -0
- package/dist/assets/_virtual/numeric-unicode-map.js +1 -0
- package/dist/assets/_virtual/surrogate-pairs.js +1 -0
- package/dist/assets/core/application.builder.js +1 -0
- package/dist/assets/core/application.core.js +1 -0
- package/dist/assets/core/jsxsupport.js +1 -0
- package/dist/assets/core/screeen.core.js +1 -0
- package/dist/assets/core/seo.js +1 -0
- package/dist/assets/core/themes.core.js +1 -0
- package/dist/assets/core/uid.js +1 -0
- package/dist/assets/index.js +1 -0
- package/dist/assets/material-icons-outlined.woff +0 -0
- package/dist/assets/material-icons-outlined.woff2 +0 -0
- package/dist/assets/material-icons-round.woff +0 -0
- package/dist/assets/material-icons-round.woff2 +0 -0
- package/dist/assets/material-icons-sharp.woff +0 -0
- package/dist/assets/material-icons-sharp.woff2 +0 -0
- package/dist/assets/material-icons-two-tone.woff +0 -0
- package/dist/assets/material-icons-two-tone.woff2 +0 -0
- package/dist/assets/material-icons.woff +0 -0
- package/dist/assets/material-icons.woff2 +0 -0
- package/dist/assets/node_modules/@fontsource/roboto/100.css +1 -0
- package/dist/assets/node_modules/@fontsource/roboto/300.css +1 -0
- package/dist/assets/node_modules/@fontsource/roboto/400.css +1 -0
- package/dist/assets/node_modules/@fontsource/roboto/500.css +1 -0
- package/dist/assets/node_modules/@fontsource/roboto/700.css +1 -0
- package/dist/assets/node_modules/@fontsource/roboto/900.css +1 -0
- package/dist/assets/node_modules/html-entities/lib/index.js +1 -0
- package/dist/assets/node_modules/html-entities/lib/named-references.js +2 -0
- package/dist/assets/node_modules/html-entities/lib/numeric-unicode-map.js +1 -0
- package/dist/assets/node_modules/html-entities/lib/surrogate-pairs.js +1 -0
- package/dist/assets/node_modules/material-icons/iconfont/material-icons.css +1 -0
- package/dist/assets/node_modules/navigo/lib/es/Q.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/constants.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/index.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/lifecycles.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/callHandler.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForAfterHook.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForAlreadyHook.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForBeforeHook.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForDeprecationMethods.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForForceOp.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForLeaveHook.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForNotFoundHandler.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/errorOut.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/flushCurrent.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/matchPathToRegisteredRoutes.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/processMatches.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/setLocationPath.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/updateBrowserURL.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/updateState.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/middlewares/waitingList.js +1 -0
- package/dist/assets/node_modules/navigo/lib/es/utils.js +1 -0
- package/dist/assets/roboto-cyrillic-100-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-100-normal.woff2 +0 -0
- package/dist/assets/roboto-cyrillic-300-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-300-normal.woff2 +0 -0
- package/dist/assets/roboto-cyrillic-400-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-400-normal.woff2 +0 -0
- package/dist/assets/roboto-cyrillic-500-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-500-normal.woff2 +0 -0
- package/dist/assets/roboto-cyrillic-700-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-700-normal.woff2 +0 -0
- package/dist/assets/roboto-cyrillic-900-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-900-normal.woff2 +0 -0
- package/dist/assets/roboto-cyrillic-ext-100-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-ext-100-normal.woff2 +0 -0
- package/dist/assets/roboto-cyrillic-ext-300-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-ext-300-normal.woff2 +0 -0
- package/dist/assets/roboto-cyrillic-ext-400-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/assets/roboto-cyrillic-ext-500-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-ext-500-normal.woff2 +0 -0
- package/dist/assets/roboto-cyrillic-ext-700-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/assets/roboto-cyrillic-ext-900-normal.woff +0 -0
- package/dist/assets/roboto-cyrillic-ext-900-normal.woff2 +0 -0
- package/dist/assets/roboto-greek-100-normal.woff +0 -0
- package/dist/assets/roboto-greek-100-normal.woff2 +0 -0
- package/dist/assets/roboto-greek-300-normal.woff +0 -0
- package/dist/assets/roboto-greek-300-normal.woff2 +0 -0
- package/dist/assets/roboto-greek-400-normal.woff +0 -0
- package/dist/assets/roboto-greek-400-normal.woff2 +0 -0
- package/dist/assets/roboto-greek-500-normal.woff +0 -0
- package/dist/assets/roboto-greek-500-normal.woff2 +0 -0
- package/dist/assets/roboto-greek-700-normal.woff +0 -0
- package/dist/assets/roboto-greek-700-normal.woff2 +0 -0
- package/dist/assets/roboto-greek-900-normal.woff +0 -0
- package/dist/assets/roboto-greek-900-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-100-normal.woff +0 -0
- package/dist/assets/roboto-latin-100-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-300-normal.woff +0 -0
- package/dist/assets/roboto-latin-300-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-400-normal.woff +0 -0
- package/dist/assets/roboto-latin-400-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-500-normal.woff +0 -0
- package/dist/assets/roboto-latin-500-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-700-normal.woff +0 -0
- package/dist/assets/roboto-latin-700-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-900-normal.woff +0 -0
- package/dist/assets/roboto-latin-900-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-ext-100-normal.woff +0 -0
- package/dist/assets/roboto-latin-ext-100-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-ext-300-normal.woff +0 -0
- package/dist/assets/roboto-latin-ext-300-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-ext-400-normal.woff +0 -0
- package/dist/assets/roboto-latin-ext-400-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-ext-500-normal.woff +0 -0
- package/dist/assets/roboto-latin-ext-500-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-ext-700-normal.woff +0 -0
- package/dist/assets/roboto-latin-ext-700-normal.woff2 +0 -0
- package/dist/assets/roboto-latin-ext-900-normal.woff +0 -0
- package/dist/assets/roboto-latin-ext-900-normal.woff2 +0 -0
- package/dist/assets/roboto-vietnamese-100-normal.woff +0 -0
- package/dist/assets/roboto-vietnamese-100-normal.woff2 +0 -0
- package/dist/assets/roboto-vietnamese-300-normal.woff +0 -0
- package/dist/assets/roboto-vietnamese-300-normal.woff2 +0 -0
- package/dist/assets/roboto-vietnamese-400-normal.woff +0 -0
- package/dist/assets/roboto-vietnamese-400-normal.woff2 +0 -0
- package/dist/assets/roboto-vietnamese-500-normal.woff +0 -0
- package/dist/assets/roboto-vietnamese-500-normal.woff2 +0 -0
- package/dist/assets/roboto-vietnamese-700-normal.woff +0 -0
- package/dist/assets/roboto-vietnamese-700-normal.woff2 +0 -0
- package/dist/assets/roboto-vietnamese-900-normal.woff +0 -0
- package/dist/assets/roboto-vietnamese-900-normal.woff2 +0 -0
- package/dist/assets/types/select.item.type.js +1 -0
- package/dist/assets/ui/Icon.ui.js +1 -0
- package/dist/assets/ui/IconButton.ui.js +1 -0
- package/dist/assets/ui/Textbox.ui.js +1 -0
- package/dist/assets/ui/accordion.ui.js +1 -0
- package/dist/assets/ui/button.ui.js +1 -0
- package/dist/assets/ui/buttonColor.ui.js +1 -0
- package/dist/assets/ui/buttonmenu.ui.js +1 -0
- package/dist/assets/ui/buttonstack.ui.js +1 -0
- package/dist/assets/ui/checkbox.ui.js +1 -0
- package/dist/assets/ui/container.ui.js +1 -0
- package/dist/assets/ui/datagrid.ui.js +1 -0
- package/dist/assets/ui/dialog.js +1 -0
- package/dist/assets/ui/draggable.ui.js +1 -0
- package/dist/assets/ui/hpanel.ui.js +1 -0
- package/dist/assets/ui/iconButtonMenu.ui.js +1 -0
- package/dist/assets/ui/image.ui.js +1 -0
- package/dist/assets/ui/label.ui.js +1 -0
- package/dist/assets/ui/loading.ui.js +1 -0
- package/dist/assets/ui/menu.ui.js +1 -0
- package/dist/assets/ui/progressbar.ui.js +1 -0
- package/dist/assets/ui/radiobutton.ui.js +1 -0
- package/dist/assets/ui/scroll.ui.js +1 -0
- package/dist/assets/ui/select.ui.js +1 -0
- package/dist/assets/ui/styles/accordion.css +1 -0
- package/dist/assets/ui/styles/button.css +1 -0
- package/dist/assets/ui/styles/buttoncolor.css +1 -0
- package/dist/assets/ui/styles/container.css +1 -0
- package/dist/assets/ui/styles/datagrid.css +1 -0
- package/dist/assets/ui/styles/dialog.css +1 -0
- package/dist/assets/ui/styles/draggable.css +1 -0
- package/dist/assets/ui/styles/hpanel.css +1 -0
- package/dist/assets/ui/styles/icon.css +1 -0
- package/dist/assets/ui/styles/image.css +1 -0
- package/dist/assets/ui/styles/label.css +1 -0
- package/dist/assets/ui/styles/loading.css +1 -0
- package/dist/assets/ui/styles/main.css +1 -0
- package/dist/assets/ui/styles/menu.css +1 -0
- package/dist/assets/ui/styles/progressbar.css +1 -0
- package/dist/assets/ui/styles/scroll.css +1 -0
- package/dist/assets/ui/styles/select.css +1 -0
- package/dist/assets/ui/styles/stackbutton.css +1 -0
- package/dist/assets/ui/styles/tabs.css +1 -0
- package/dist/assets/ui/styles/textarea.css +1 -0
- package/dist/assets/ui/styles/textbox.css +1 -0
- package/dist/assets/ui/styles/toolbar.css +1 -0
- package/dist/assets/ui/styles/valuebar.css +1 -0
- package/dist/assets/ui/styles/vpanel.css +1 -0
- package/dist/assets/ui/styles/vstackbutton.css +1 -0
- package/dist/assets/ui/switch.ui.js +1 -0
- package/dist/assets/ui/tabs.ui.js +1 -0
- package/dist/assets/ui/textarea.ui.js +1 -0
- package/dist/assets/ui/toggle.ui.js +1 -0
- package/dist/assets/ui/toolbar.ui.js +1 -0
- package/dist/assets/ui/valuebar.ui.js +1 -0
- package/dist/assets/ui/vpanel.ui.js +1 -0
- package/dist/assets/ui/widget.builder.js +1 -0
- package/dist/assets/ui/widget.collection.js +1 -0
- package/dist/assets/ui/widget.ui.js +1 -0
- package/dist/cedro-logo.png +0 -0
- package/dist/cedro-logo.svg +97 -0
- package/dist/fangio.jpg +0 -0
- package/dist/material-icons-list.json/357/200/272Zone.Identifier +3 -0
- package/package.json +4 -2
- package/src/core/application.builder.tsx +122 -60
- package/src/core/application.core.tsx +110 -11
- package/src/core/themes.core.ts +160 -1
- package/src/core/uid.ts +3 -3
- package/src/interfaces/application.interface.ts +3 -2
- package/src/interfaces/widget.interface.ts +3 -0
- package/src/types/select.item.type.ts +11 -0
- package/src/ui/Icon.ui.tsx +158 -0
- package/src/ui/IconButton.ui.tsx +51 -9
- package/src/ui/{textbox.ui.tsx → Textbox.ui.tsx} +23 -15
- package/src/ui/accordion.ui.tsx +152 -0
- package/src/ui/button.ui.tsx +55 -14
- package/src/ui/buttonColor.ui.tsx +87 -0
- package/src/ui/buttonmenu.ui.tsx +133 -0
- package/src/ui/{buttonstack.ui.ts → buttonstack.ui.tsx} +67 -1
- package/src/ui/checkbox.ui.tsx +9 -13
- package/src/ui/container.ui.tsx +140 -76
- package/src/ui/datagrid.ui.tsx +514 -0
- package/src/ui/dialog.tsx +143 -56
- package/src/ui/hpanel.ui.tsx +37 -11
- package/src/ui/iconButtonMenu.ui.tsx +175 -0
- package/src/ui/image.ui.tsx +123 -112
- package/src/ui/index.ts +8 -8
- package/src/ui/label.ui.tsx +61 -3
- package/src/ui/loading.ui.ts +10 -10
- package/src/ui/menu.ui.ts +2 -2
- package/src/ui/progressbar.ui.tsx +9 -8
- package/src/ui/{radiobutton.tsx → radiobutton.ui.tsx} +9 -13
- package/src/ui/scroll.ui.ts +13 -12
- package/src/ui/select.ui.tsx +143 -0
- package/src/ui/styles/button.css +114 -32
- package/src/ui/styles/buttoncolor.css +8 -8
- package/src/ui/styles/container.css +29 -0
- package/src/ui/styles/icon.css +29 -0
- package/src/ui/styles/image.css +19 -19
- package/src/ui/styles/label.css +63 -0
- package/src/ui/styles/loading.css +12 -12
- package/src/ui/styles/main.css +5 -0
- package/src/ui/styles/progressbar.css +2 -1
- package/src/ui/styles/select.css +13 -0
- package/src/ui/styles/stackbutton.css +36 -0
- package/src/ui/styles/tabs.css +5 -7
- package/src/ui/styles/textarea.css +13 -13
- package/src/ui/switch.ui.tsx +9 -13
- package/src/ui/tabs.ui.tsx +43 -22
- package/src/ui/textarea.ui.tsx +48 -0
- package/src/ui/toolbar.ui.tsx +17 -12
- package/src/ui/valuebar.ui.tsx +11 -13
- package/src/ui/vpanel.ui.tsx +19 -13
- package/src/ui/widget.builder.ts +243 -159
- package/src/ui/widget.collection.ts +24 -2
- package/src/ui/widget.ui.ts +79 -19
- package/src/ui/Icon.ui.ts +0 -64
- package/src/ui/accordion.ui.ts +0 -71
- package/src/ui/buttonColor.ui.ts +0 -24
- package/src/ui/buttonmenu.ui.ts +0 -59
- package/src/ui/datagrid.ui.ts +0 -231
- package/src/ui/iconButtonMenu.ui.ts +0 -59
- package/src/ui/select.ui.ts +0 -73
- package/src/ui/textarea.ui.ts +0 -20
- /package/src/ui/{toggle.ui.ts → toggle.ui.tsx} +0 -0
package/src/ui/dialog.tsx
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { UID } from "../core/uid";
|
|
1
2
|
import { WUICallback } from "../interfaces/widget.interface";
|
|
2
3
|
import { Button } from "./button.ui";
|
|
4
|
+
import { Spacer } from "./container.ui";
|
|
3
5
|
import { Label } from "./label.ui";
|
|
4
6
|
import "./styles/dialog.css";
|
|
7
|
+
import { createWidget, normalizeWidget, WidgetProps } from "./widget.builder";
|
|
5
8
|
import { Widget, WidgetAlignTypes, WidgetTypes } from "./widget.ui";
|
|
6
9
|
|
|
7
10
|
const TITLE_BAR_HEIGHT = 40;
|
|
@@ -34,6 +37,9 @@ export class Dialog extends Widget {
|
|
|
34
37
|
draging: boolean;
|
|
35
38
|
resizing: boolean;
|
|
36
39
|
|
|
40
|
+
startX: number;
|
|
41
|
+
startY: number;
|
|
42
|
+
|
|
37
43
|
constructor(
|
|
38
44
|
id: string,
|
|
39
45
|
parent: Widget | null = null,
|
|
@@ -42,6 +48,9 @@ export class Dialog extends Widget {
|
|
|
42
48
|
) {
|
|
43
49
|
super(id, "div", parent);
|
|
44
50
|
|
|
51
|
+
this.startX = -1;
|
|
52
|
+
this.startY = -1;
|
|
53
|
+
|
|
45
54
|
this.buttonContainer = null;
|
|
46
55
|
this.handlerResizable = null;
|
|
47
56
|
|
|
@@ -71,23 +80,11 @@ export class Dialog extends Widget {
|
|
|
71
80
|
this.setType(WidgetTypes.CUSTOM);
|
|
72
81
|
this.setAlign(WidgetAlignTypes.VERTICAL);
|
|
73
82
|
|
|
74
|
-
this.titleContainer = new Widget(
|
|
75
|
-
|
|
76
|
-
"div",
|
|
77
|
-
this
|
|
78
|
-
);
|
|
79
|
-
this.contentCntainer = new Widget(
|
|
80
|
-
this.id + ".contentCntainer",
|
|
81
|
-
"div",
|
|
82
|
-
this
|
|
83
|
-
);
|
|
83
|
+
this.titleContainer = new Widget(this.id + ".titleContainer", "div", null);
|
|
84
|
+
this.contentCntainer = new Widget(this.id + ".contentCntainer", "div", null);
|
|
84
85
|
|
|
85
86
|
if (hasButtons) {
|
|
86
|
-
this.buttonContainer = new Widget(
|
|
87
|
-
this.id + ".buttonContainer",
|
|
88
|
-
"div",
|
|
89
|
-
this
|
|
90
|
-
);
|
|
87
|
+
this.buttonContainer = new Widget(this.id + ".buttonContainer", "div", null);
|
|
91
88
|
|
|
92
89
|
this.buttonContainer.setType(WidgetTypes.FILL);
|
|
93
90
|
this.buttonContainer.setAlign(WidgetAlignTypes.HORIZONTAL);
|
|
@@ -96,11 +93,7 @@ export class Dialog extends Widget {
|
|
|
96
93
|
}
|
|
97
94
|
|
|
98
95
|
if (resizable) {
|
|
99
|
-
this.handlerResizable = new Widget(
|
|
100
|
-
this.id + ".handlerResizable",
|
|
101
|
-
"div",
|
|
102
|
-
this
|
|
103
|
-
);
|
|
96
|
+
this.handlerResizable = new Widget(this.id + ".handlerResizable", "div", this);
|
|
104
97
|
this.handlerResizable.setType(WidgetTypes.CUSTOM);
|
|
105
98
|
this.handlerResizable.getBody().innerHTML = " ";
|
|
106
99
|
this.handlerResizable.addClass("WUIDialogResizeHandler");
|
|
@@ -117,55 +110,37 @@ export class Dialog extends Widget {
|
|
|
117
110
|
|
|
118
111
|
this.titleContainer.setFixedSize(TITLE_BAR_HEIGHT);
|
|
119
112
|
|
|
120
|
-
this.titleBar = new Label(
|
|
121
|
-
this.id + ".titleBar",
|
|
122
|
-
"span",
|
|
123
|
-
this.titleContainer
|
|
124
|
-
);
|
|
113
|
+
this.titleBar = new Label(this.id + ".titleBar", "span", null);
|
|
125
114
|
this.titleBar.setType(WidgetTypes.FILL);
|
|
126
115
|
this.titleBar.setText("Title");
|
|
127
116
|
this.titleBar.addClass("WUITitlebar");
|
|
128
117
|
|
|
129
|
-
this.close = new Button(this.id + ".close",
|
|
118
|
+
this.close = new Button(this.id + ".close", null);
|
|
130
119
|
this.close.setType(WidgetTypes.FILL);
|
|
131
120
|
this.close.setColor("primary");
|
|
132
121
|
this.close.setVariant("text");
|
|
133
122
|
this.close.setText("X");
|
|
134
123
|
this.close.setFixedSize(40);
|
|
135
124
|
|
|
136
|
-
this.btnSpacerLeft = new Widget(
|
|
137
|
-
this.id + ".btnSpacerLeft",
|
|
138
|
-
"div",
|
|
139
|
-
this.buttonContainer
|
|
140
|
-
);
|
|
141
|
-
this.btnSpacerLeft.setType(WidgetTypes.FILL);
|
|
142
|
-
this.btnSpacerLeft.setAlign(WidgetAlignTypes.HORIZONTAL);
|
|
143
|
-
|
|
144
125
|
if (this.buttonContainer) {
|
|
145
|
-
this.cancell = new Button(
|
|
146
|
-
this.id + ".cancell",
|
|
147
|
-
this.buttonContainer
|
|
148
|
-
);
|
|
126
|
+
this.cancell = new Button(this.id + ".cancell", null);
|
|
149
127
|
this.cancell.setType(WidgetTypes.FILL);
|
|
150
128
|
this.cancell.setColor("error");
|
|
151
129
|
this.cancell.setText("Cancel");
|
|
152
130
|
this.cancell.setVariant("contained");
|
|
153
131
|
this.cancell.setFixedSize(100);
|
|
154
132
|
|
|
155
|
-
this.ok = new Button(this.id + ".ok",
|
|
133
|
+
this.ok = new Button(this.id + ".ok", null);
|
|
156
134
|
this.ok.setType(WidgetTypes.FILL);
|
|
157
135
|
this.ok.setText("OK");
|
|
158
136
|
this.ok.setVariant("contained");
|
|
159
137
|
this.ok.setColor("success");
|
|
160
138
|
this.ok.setFixedSize(100);
|
|
161
139
|
|
|
162
|
-
this.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
);
|
|
167
|
-
this.btnSpacerRight.setType(WidgetTypes.FILL);
|
|
168
|
-
this.btnSpacerRight.setAlign(WidgetAlignTypes.HORIZONTAL);
|
|
140
|
+
this.buttonContainer.addChild(Spacer());
|
|
141
|
+
this.buttonContainer.addChild(this.cancell);
|
|
142
|
+
this.buttonContainer.addChild(this.ok);
|
|
143
|
+
this.buttonContainer.addChild(Spacer());
|
|
169
144
|
|
|
170
145
|
this.ok.subscribe({
|
|
171
146
|
event: "click",
|
|
@@ -256,12 +231,8 @@ export class Dialog extends Widget {
|
|
|
256
231
|
if (!this.handlerResizable) return;
|
|
257
232
|
const mouseX = (e as MouseEvent).clientX;
|
|
258
233
|
const mouseY = (e as MouseEvent).clientY;
|
|
259
|
-
this.dragDistX = Math.abs(
|
|
260
|
-
|
|
261
|
-
);
|
|
262
|
-
this.dragDistY = Math.abs(
|
|
263
|
-
this.handlerResizable.getPosition().y - mouseY
|
|
264
|
-
);
|
|
234
|
+
this.dragDistX = Math.abs(this.handlerResizable.getPosition().x - mouseX);
|
|
235
|
+
this.dragDistY = Math.abs(this.handlerResizable.getPosition().y - mouseY);
|
|
265
236
|
|
|
266
237
|
this.resizing = true;
|
|
267
238
|
this.background.setVisible(true);
|
|
@@ -272,6 +243,13 @@ export class Dialog extends Widget {
|
|
|
272
243
|
});
|
|
273
244
|
}
|
|
274
245
|
|
|
246
|
+
this.titleContainer.addChild(this.titleBar);
|
|
247
|
+
this.titleContainer.addChild(this.close);
|
|
248
|
+
|
|
249
|
+
this.addChild(this.titleContainer);
|
|
250
|
+
this.addChild(this.contentCntainer);
|
|
251
|
+
if (hasButtons) this.addChild(this.buttonContainer);
|
|
252
|
+
|
|
275
253
|
this.init();
|
|
276
254
|
}
|
|
277
255
|
|
|
@@ -322,7 +300,13 @@ export class Dialog extends Widget {
|
|
|
322
300
|
this.deleteClass("WUIDialogHide");
|
|
323
301
|
this.addClass("WUIDialogDisplayed");
|
|
324
302
|
this.render();
|
|
325
|
-
|
|
303
|
+
|
|
304
|
+
if (this.startX > 0 && this.startY > 0) {
|
|
305
|
+
this.setX(this.startX);
|
|
306
|
+
this.setY(this.startY);
|
|
307
|
+
} else {
|
|
308
|
+
this.center();
|
|
309
|
+
}
|
|
326
310
|
|
|
327
311
|
this.background.setVisible(true);
|
|
328
312
|
this.background.raisteTop();
|
|
@@ -345,7 +329,7 @@ export class Dialog extends Widget {
|
|
|
345
329
|
this.raiseBottom();
|
|
346
330
|
}
|
|
347
331
|
|
|
348
|
-
init() {
|
|
332
|
+
public init() {
|
|
349
333
|
super.init();
|
|
350
334
|
}
|
|
351
335
|
|
|
@@ -354,7 +338,7 @@ export class Dialog extends Widget {
|
|
|
354
338
|
*
|
|
355
339
|
* @param {number} height - The height of the title bar.
|
|
356
340
|
*/
|
|
357
|
-
setTitlebarHeight(height: number) {
|
|
341
|
+
public setTitlebarHeight(height: number) {
|
|
358
342
|
this.titleBarHeight = height;
|
|
359
343
|
}
|
|
360
344
|
|
|
@@ -363,7 +347,7 @@ export class Dialog extends Widget {
|
|
|
363
347
|
*
|
|
364
348
|
* @param {number} height - The height of the button bar.
|
|
365
349
|
*/
|
|
366
|
-
setButtonbarHeight(height: number) {
|
|
350
|
+
public setButtonbarHeight(height: number) {
|
|
367
351
|
this.buttonBarHeight = height;
|
|
368
352
|
}
|
|
369
353
|
|
|
@@ -395,4 +379,107 @@ export class Dialog extends Widget {
|
|
|
395
379
|
if (!this.cancell) return;
|
|
396
380
|
this.cancell.subscribe({ event: "click", then: cb.then });
|
|
397
381
|
}
|
|
382
|
+
|
|
383
|
+
public setStartX(x: number): void {
|
|
384
|
+
this.startX = x;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
public setStartY(y: number): void {
|
|
388
|
+
this.startY = y;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export type WDialogProps = Omit<WidgetProps, "orientation" | "hidden"> & {
|
|
393
|
+
hasButtons?: boolean;
|
|
394
|
+
resizable?: boolean;
|
|
395
|
+
visible?: boolean;
|
|
396
|
+
titleBarHeight?: number;
|
|
397
|
+
buttonBarHeight?: number;
|
|
398
|
+
positionX?: number;
|
|
399
|
+
positionY?: number;
|
|
400
|
+
width?: number;
|
|
401
|
+
height?: number;
|
|
402
|
+
children: any;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export const WDialog = (props: WDialogProps) => {
|
|
406
|
+
if (!props.id) {
|
|
407
|
+
props.id = "Dialog." + UID();
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
return normalizeWidget(
|
|
411
|
+
<div
|
|
412
|
+
id={props.id}
|
|
413
|
+
w-dialog
|
|
414
|
+
w-position-x={props.positionX}
|
|
415
|
+
w-position-y={props.positionY}
|
|
416
|
+
w-dialog-width={props.width}
|
|
417
|
+
w-dialog-height={props.height}
|
|
418
|
+
w-has-buttons={props.hasButtons}
|
|
419
|
+
w-resizable={props.resizable}
|
|
420
|
+
w-visible={props.visible}
|
|
421
|
+
w-titlebar-height={props.titleBarHeight}
|
|
422
|
+
w-buttonbar-height={props.buttonBarHeight}
|
|
423
|
+
>
|
|
424
|
+
{props.children}
|
|
425
|
+
</div>,
|
|
426
|
+
props
|
|
427
|
+
);
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
export function createDialog(id: string, content: any, _parent: Widget | null = null): Dialog {
|
|
431
|
+
const dataHasButtons = content.getAttribute("w-has-buttons") ? true : false;
|
|
432
|
+
const dataResizable = content.getAttribute("w-resizable") ? true : false;
|
|
433
|
+
const dataVisible = content.getAttribute("w-visible") ? true : false;
|
|
434
|
+
const dataTitlebarHeight = content.getAttribute("w-titlebar-height")
|
|
435
|
+
? parseInt(content.getAttribute("w-titlebar-height"))
|
|
436
|
+
: null;
|
|
437
|
+
const dataButtonbarHeight = content.getAttribute("w-buttonbar-height")
|
|
438
|
+
? parseInt(content.getAttribute("w-buttonbar-height"))
|
|
439
|
+
: null;
|
|
440
|
+
|
|
441
|
+
const dataPositionX = content.getAttribute("w-position-x")
|
|
442
|
+
? parseInt(content.getAttribute("w-position-x"))
|
|
443
|
+
: null;
|
|
444
|
+
|
|
445
|
+
const dataPositionY = content.getAttribute("w-position-y")
|
|
446
|
+
? parseInt(content.getAttribute("w-position-y"))
|
|
447
|
+
: null;
|
|
448
|
+
|
|
449
|
+
const dataWidth = content.getAttribute("w-dialog-width")
|
|
450
|
+
? parseInt(content.getAttribute("w-dialog-width"))
|
|
451
|
+
: null;
|
|
452
|
+
|
|
453
|
+
const dataHeight = content.getAttribute("w-dialog-height")
|
|
454
|
+
? parseInt(content.getAttribute("w-dialog-height"))
|
|
455
|
+
: null;
|
|
456
|
+
|
|
457
|
+
let newDialog = new Dialog(id, null, dataHasButtons, dataResizable);
|
|
458
|
+
|
|
459
|
+
if (dataTitlebarHeight !== null) newDialog.setTitlebarHeight(dataTitlebarHeight);
|
|
460
|
+
if (dataButtonbarHeight !== null) newDialog.setButtonbarHeight(dataButtonbarHeight);
|
|
461
|
+
if (dataPositionX !== null) newDialog.setStartX(dataPositionX);
|
|
462
|
+
if (dataPositionY !== null) newDialog.setStartY(dataPositionY);
|
|
463
|
+
if (dataHeight !== null) newDialog.setY(dataHeight);
|
|
464
|
+
if (dataWidth !== null) newDialog.setW(dataWidth);
|
|
465
|
+
|
|
466
|
+
if (content.childNodes.length > 1) {
|
|
467
|
+
throw new Error("Dialog must have only one child");
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
const childWidget = content.firstChild;
|
|
471
|
+
|
|
472
|
+
if (childWidget !== null) {
|
|
473
|
+
const widget = createWidget(childWidget);
|
|
474
|
+
if (widget) {
|
|
475
|
+
newDialog.getContentCntainer().setPadding(0);
|
|
476
|
+
newDialog.getContentCntainer().attachWidget(widget);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
if (dataVisible) newDialog.show();
|
|
481
|
+
|
|
482
|
+
newDialog.background.setVisible(false);
|
|
483
|
+
|
|
484
|
+
return newDialog;
|
|
398
485
|
}
|
package/src/ui/hpanel.ui.tsx
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { UID } from "../core/uid";
|
|
1
2
|
import { Draggable } from "./draggable.ui";
|
|
2
3
|
import "./styles/hpanel.css";
|
|
3
|
-
import { WidgetProps, createWidget } from "./widget.builder";
|
|
4
|
-
import {
|
|
4
|
+
import { WidgetProps, createWidget, normalizeWidget } from "./widget.builder";
|
|
5
|
+
import {
|
|
6
|
+
connectWidgetCallback,
|
|
7
|
+
getOnlyEventProps,
|
|
8
|
+
Widget,
|
|
9
|
+
WidgetAlignTypes,
|
|
10
|
+
WidgetTypes,
|
|
11
|
+
} from "./widget.ui";
|
|
5
12
|
|
|
6
13
|
const HPANEL_HANDLER_SIZE = 4;
|
|
7
14
|
|
|
@@ -101,6 +108,16 @@ export class HPanel extends Widget {
|
|
|
101
108
|
this.render();
|
|
102
109
|
}
|
|
103
110
|
|
|
111
|
+
public setLeftWidth(width: number): void {
|
|
112
|
+
this.leftWidth = width;
|
|
113
|
+
this.rightWidth = null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
public setRightWidth(width: number): void {
|
|
117
|
+
this.leftWidth = null;
|
|
118
|
+
this.rightWidth = width;
|
|
119
|
+
}
|
|
120
|
+
|
|
104
121
|
public render(): void {
|
|
105
122
|
super.render();
|
|
106
123
|
this.handler.setW(HPANEL_HANDLER_SIZE);
|
|
@@ -125,6 +142,14 @@ export class HPanel extends Widget {
|
|
|
125
142
|
|
|
126
143
|
this.handler.setY(this.getY(true));
|
|
127
144
|
}
|
|
145
|
+
|
|
146
|
+
public free(): void {
|
|
147
|
+
this.handler.free();
|
|
148
|
+
this.leftContent?.free();
|
|
149
|
+
this.rightContent?.free();
|
|
150
|
+
//this.draggable.free();
|
|
151
|
+
super.free();
|
|
152
|
+
}
|
|
128
153
|
}
|
|
129
154
|
|
|
130
155
|
export type WHPanelProps = WidgetProps & {
|
|
@@ -132,16 +157,17 @@ export type WHPanelProps = WidgetProps & {
|
|
|
132
157
|
};
|
|
133
158
|
|
|
134
159
|
export const WHPanel = (props: WHPanelProps) => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
>
|
|
160
|
+
if (!props.id) {
|
|
161
|
+
props.id = "Icon." + UID();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
connectWidgetCallback(props.id, getOnlyEventProps(props));
|
|
165
|
+
|
|
166
|
+
return normalizeWidget(
|
|
167
|
+
<div id={props.id} w-hpanel>
|
|
143
168
|
{props.children}
|
|
144
|
-
</div
|
|
169
|
+
</div>,
|
|
170
|
+
props
|
|
145
171
|
);
|
|
146
172
|
};
|
|
147
173
|
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { IconButton, wIconButtonProps } from "./IconButton.ui";
|
|
2
|
+
import { Menu } from "./menu.ui";
|
|
3
|
+
import { SelectItem } from "../types/select.item.type";
|
|
4
|
+
import { normalizeWidget, WidgetProps } from "./widget.builder";
|
|
5
|
+
import { connectWidgetCallback, getOnlyEventProps, Widget } from "./widget.ui";
|
|
6
|
+
import { UID } from "../core/uid";
|
|
7
|
+
import { connectCustomWidget } from "./widget.collection";
|
|
8
|
+
import { IWidget } from "../interfaces/widget.interface";
|
|
9
|
+
|
|
10
|
+
export class IconButtonMenu extends IconButton {
|
|
11
|
+
menu: Menu;
|
|
12
|
+
items: Array<SelectItem>;
|
|
13
|
+
selectedItem: SelectItem | null;
|
|
14
|
+
|
|
15
|
+
whenOptionClicked: (args: any) => {} | void;
|
|
16
|
+
|
|
17
|
+
public constructor(id: string, icon: string) {
|
|
18
|
+
super(id, icon);
|
|
19
|
+
|
|
20
|
+
this.whenOptionClicked = () => {};
|
|
21
|
+
|
|
22
|
+
this.menu = new Menu(this.id + ".menu", this.id, null);
|
|
23
|
+
|
|
24
|
+
this.items = new Array<SelectItem>();
|
|
25
|
+
this.selectedItem = null;
|
|
26
|
+
|
|
27
|
+
this.subscribe({
|
|
28
|
+
event: "click",
|
|
29
|
+
then: () => {
|
|
30
|
+
this.menu.clearOptions();
|
|
31
|
+
this.items.forEach((item) => {
|
|
32
|
+
this.menu.addOption(item.id, item.icon, item.label);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
this.menu.wakeUp();
|
|
36
|
+
|
|
37
|
+
if (this.getW() > this.menu.getW()) {
|
|
38
|
+
this.menu.setW(this.getBody().clientWidth);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
this.menu.subscribe({
|
|
44
|
+
event: "option-clicked",
|
|
45
|
+
then: (_e, clickedOption) => {
|
|
46
|
+
const option = clickedOption as IconButton;
|
|
47
|
+
const fintOption = this.items.find((item) => item.id === option.id);
|
|
48
|
+
|
|
49
|
+
if (fintOption) {
|
|
50
|
+
this.selectedItem = fintOption;
|
|
51
|
+
this.whenOptionClicked({ id: fintOption.id });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// const selectedText = this.selectedItem?.label;
|
|
55
|
+
// if (selectedText) {
|
|
56
|
+
// this.setText(selectedText);
|
|
57
|
+
// } else {
|
|
58
|
+
// this.setText("");
|
|
59
|
+
// }
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public setOnOptionClicked(cb: ({}) => {} | void) {
|
|
65
|
+
this.whenOptionClicked = cb;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public addItem(id: string, label: string, icon: string): void {
|
|
69
|
+
this.items.push(new SelectItem(id, label, icon));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type WIconButtonMenuProps = WidgetProps &
|
|
74
|
+
wIconButtonProps & {
|
|
75
|
+
icon?: string | null;
|
|
76
|
+
onOptionClicked?: (args: any) => {} | void;
|
|
77
|
+
children: any;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export type WIconButtonMenuItemProps = {
|
|
81
|
+
id: string;
|
|
82
|
+
label?: string | null;
|
|
83
|
+
icon?: string | null;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const WIconButtonMenu = (props: WIconButtonMenuProps) => {
|
|
87
|
+
if (!props.id) {
|
|
88
|
+
props.id = "IconButtonMenu." + UID();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
connectWidgetCallback(props.id, getOnlyEventProps(props));
|
|
92
|
+
|
|
93
|
+
connectCustomWidget("widget-custom-added-" + props.id, {
|
|
94
|
+
event: "widget-load",
|
|
95
|
+
then: (_e: Event, _w: IWidget | null) => {
|
|
96
|
+
if (!props.id) return;
|
|
97
|
+
const widget = w.get(props.id) as IconButtonMenu;
|
|
98
|
+
|
|
99
|
+
if (props.onOptionClicked) {
|
|
100
|
+
widget.setOnOptionClicked(props.onOptionClicked);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return normalizeWidget(
|
|
106
|
+
<div
|
|
107
|
+
id={props.id}
|
|
108
|
+
w-icon-button-menu
|
|
109
|
+
w-text={props.text}
|
|
110
|
+
w-icon={props.icon}
|
|
111
|
+
w-variant={props.variant}
|
|
112
|
+
w-color={props.color}
|
|
113
|
+
w-width={props.width}
|
|
114
|
+
w-height={props.height}
|
|
115
|
+
>
|
|
116
|
+
{props.children}
|
|
117
|
+
</div>,
|
|
118
|
+
props
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const WIconButtonMenuItem = (props: WIconButtonMenuItemProps) => {
|
|
123
|
+
return (
|
|
124
|
+
<div w-icon-button-menu-item id={props.id} w-label={props.label} w-icon={props.icon}></div>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export function createIconButtonMenu(
|
|
129
|
+
id: string,
|
|
130
|
+
content: any,
|
|
131
|
+
_parent: Widget | null = null
|
|
132
|
+
): IconButtonMenu {
|
|
133
|
+
const btnIcon = content.getAttribute("w-icon");
|
|
134
|
+
const btnText = content.getAttribute("w-text");
|
|
135
|
+
const btnColor = content.getAttribute("w-color");
|
|
136
|
+
const btnVariant = content.getAttribute("w-variant");
|
|
137
|
+
const dataWidth = content.getAttribute("w-width");
|
|
138
|
+
const dataHeight = content.getAttribute("w-height");
|
|
139
|
+
|
|
140
|
+
let newIconButtonMenu = new IconButtonMenu(id, btnIcon || "home");
|
|
141
|
+
|
|
142
|
+
if (btnText) {
|
|
143
|
+
newIconButtonMenu.setText(btnText);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (btnColor) {
|
|
147
|
+
newIconButtonMenu.setColor(btnColor);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (btnVariant) {
|
|
151
|
+
newIconButtonMenu.setVariant(btnVariant);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (dataWidth) {
|
|
155
|
+
newIconButtonMenu.setInitialW(dataWidth);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (dataHeight) {
|
|
159
|
+
newIconButtonMenu.setInitialH(dataHeight);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
content.childNodes.forEach((menuItem: HTMLElement, index: number) => {
|
|
163
|
+
if (menuItem.getAttribute("w-icon-button-menu-item") !== null) {
|
|
164
|
+
const itemId = menuItem.getAttribute("id");
|
|
165
|
+
const itemLabel = menuItem.getAttribute("w-label");
|
|
166
|
+
const itemIcon = menuItem.getAttribute("w-icon");
|
|
167
|
+
|
|
168
|
+
if (itemId !== null) {
|
|
169
|
+
newIconButtonMenu.addItem(itemId, itemLabel || "Unnamed" + index, itemIcon || "");
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
return newIconButtonMenu;
|
|
175
|
+
}
|