cedro 0.1.12 → 0.1.13
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/lib/assets/_virtual/_commonjsHelpers.js +1 -0
- package/lib/assets/_virtual/index.js +1 -0
- package/lib/assets/_virtual/modulepreload-polyfill.js +1 -0
- package/lib/assets/_virtual/named-references.js +1 -0
- package/lib/assets/_virtual/numeric-unicode-map.js +1 -0
- package/lib/assets/_virtual/surrogate-pairs.js +1 -0
- package/lib/assets/core/application.builder.js +1 -0
- package/lib/assets/core/application.core.js +1 -0
- package/lib/assets/core/jsxsupport.js +1 -0
- package/lib/assets/core/screeen.core.js +1 -0
- package/lib/assets/core/seo.js +1 -0
- package/lib/assets/core/themes.core.js +1 -0
- package/lib/assets/core/uid.js +1 -0
- package/lib/assets/index.js +5 -0
- package/lib/assets/material-icons-outlined.woff +0 -0
- package/lib/assets/material-icons-outlined.woff2 +0 -0
- package/lib/assets/material-icons-round.woff +0 -0
- package/lib/assets/material-icons-round.woff2 +0 -0
- package/lib/assets/material-icons-sharp.woff +0 -0
- package/lib/assets/material-icons-sharp.woff2 +0 -0
- package/lib/assets/material-icons-two-tone.woff +0 -0
- package/lib/assets/material-icons-two-tone.woff2 +0 -0
- package/lib/assets/material-icons.woff +0 -0
- package/lib/assets/material-icons.woff2 +0 -0
- package/lib/assets/node_modules/@fontsource/roboto/100.css +1 -0
- package/lib/assets/node_modules/@fontsource/roboto/300.css +1 -0
- package/lib/assets/node_modules/@fontsource/roboto/400.css +1 -0
- package/lib/assets/node_modules/@fontsource/roboto/500.css +1 -0
- package/lib/assets/node_modules/@fontsource/roboto/700.css +1 -0
- package/lib/assets/node_modules/@fontsource/roboto/900.css +1 -0
- package/lib/assets/node_modules/html-entities/lib/index.js +1 -0
- package/lib/assets/node_modules/html-entities/lib/named-references.js +2 -0
- package/lib/assets/node_modules/html-entities/lib/numeric-unicode-map.js +1 -0
- package/lib/assets/node_modules/html-entities/lib/surrogate-pairs.js +1 -0
- package/lib/assets/node_modules/material-icons/iconfont/material-icons.css +1 -0
- package/lib/assets/node_modules/navigo/lib/es/Q.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/constants.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/index.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/lifecycles.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/callHandler.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/checkForAfterHook.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/checkForAlreadyHook.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/checkForBeforeHook.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/checkForDeprecationMethods.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/checkForForceOp.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/checkForLeaveHook.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/checkForNotFoundHandler.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/errorOut.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/flushCurrent.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/matchPathToRegisteredRoutes.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/processMatches.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/setLocationPath.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/updateBrowserURL.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/updateState.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/middlewares/waitingList.js +1 -0
- package/lib/assets/node_modules/navigo/lib/es/utils.js +1 -0
- package/lib/assets/roboto-cyrillic-100-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-100-normal.woff2 +0 -0
- package/lib/assets/roboto-cyrillic-300-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-300-normal.woff2 +0 -0
- package/lib/assets/roboto-cyrillic-400-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-400-normal.woff2 +0 -0
- package/lib/assets/roboto-cyrillic-500-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-500-normal.woff2 +0 -0
- package/lib/assets/roboto-cyrillic-700-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-700-normal.woff2 +0 -0
- package/lib/assets/roboto-cyrillic-900-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-900-normal.woff2 +0 -0
- package/lib/assets/roboto-cyrillic-ext-100-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-ext-100-normal.woff2 +0 -0
- package/lib/assets/roboto-cyrillic-ext-300-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-ext-300-normal.woff2 +0 -0
- package/lib/assets/roboto-cyrillic-ext-400-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-ext-400-normal.woff2 +0 -0
- package/lib/assets/roboto-cyrillic-ext-500-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-ext-500-normal.woff2 +0 -0
- package/lib/assets/roboto-cyrillic-ext-700-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-ext-700-normal.woff2 +0 -0
- package/lib/assets/roboto-cyrillic-ext-900-normal.woff +0 -0
- package/lib/assets/roboto-cyrillic-ext-900-normal.woff2 +0 -0
- package/lib/assets/roboto-greek-100-normal.woff +0 -0
- package/lib/assets/roboto-greek-100-normal.woff2 +0 -0
- package/lib/assets/roboto-greek-300-normal.woff +0 -0
- package/lib/assets/roboto-greek-300-normal.woff2 +0 -0
- package/lib/assets/roboto-greek-400-normal.woff +0 -0
- package/lib/assets/roboto-greek-400-normal.woff2 +0 -0
- package/lib/assets/roboto-greek-500-normal.woff +0 -0
- package/lib/assets/roboto-greek-500-normal.woff2 +0 -0
- package/lib/assets/roboto-greek-700-normal.woff +0 -0
- package/lib/assets/roboto-greek-700-normal.woff2 +0 -0
- package/lib/assets/roboto-greek-900-normal.woff +0 -0
- package/lib/assets/roboto-greek-900-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-100-normal.woff +0 -0
- package/lib/assets/roboto-latin-100-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-300-normal.woff +0 -0
- package/lib/assets/roboto-latin-300-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-400-normal.woff +0 -0
- package/lib/assets/roboto-latin-400-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-500-normal.woff +0 -0
- package/lib/assets/roboto-latin-500-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-700-normal.woff +0 -0
- package/lib/assets/roboto-latin-700-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-900-normal.woff +0 -0
- package/lib/assets/roboto-latin-900-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-ext-100-normal.woff +0 -0
- package/lib/assets/roboto-latin-ext-100-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-ext-300-normal.woff +0 -0
- package/lib/assets/roboto-latin-ext-300-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-ext-400-normal.woff +0 -0
- package/lib/assets/roboto-latin-ext-400-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-ext-500-normal.woff +0 -0
- package/lib/assets/roboto-latin-ext-500-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-ext-700-normal.woff +0 -0
- package/lib/assets/roboto-latin-ext-700-normal.woff2 +0 -0
- package/lib/assets/roboto-latin-ext-900-normal.woff +0 -0
- package/lib/assets/roboto-latin-ext-900-normal.woff2 +0 -0
- package/lib/assets/roboto-vietnamese-100-normal.woff +0 -0
- package/lib/assets/roboto-vietnamese-100-normal.woff2 +0 -0
- package/lib/assets/roboto-vietnamese-300-normal.woff +0 -0
- package/lib/assets/roboto-vietnamese-300-normal.woff2 +0 -0
- package/lib/assets/roboto-vietnamese-400-normal.woff +0 -0
- package/lib/assets/roboto-vietnamese-400-normal.woff2 +0 -0
- package/lib/assets/roboto-vietnamese-500-normal.woff +0 -0
- package/lib/assets/roboto-vietnamese-500-normal.woff2 +0 -0
- package/lib/assets/roboto-vietnamese-700-normal.woff +0 -0
- package/lib/assets/roboto-vietnamese-700-normal.woff2 +0 -0
- package/lib/assets/roboto-vietnamese-900-normal.woff +0 -0
- package/lib/assets/roboto-vietnamese-900-normal.woff2 +0 -0
- package/lib/assets/types/select.item.type.js +1 -0
- package/lib/assets/ui/Icon.ui.js +1 -0
- package/lib/assets/ui/IconButton.ui.js +1 -0
- package/lib/assets/ui/Textbox.ui.js +1 -0
- package/lib/assets/ui/accordion.ui.js +1 -0
- package/lib/assets/ui/button.ui.js +1 -0
- package/lib/assets/ui/buttonColor.ui.js +1 -0
- package/lib/assets/ui/buttonmenu.ui.js +1 -0
- package/lib/assets/ui/buttonstack.ui.js +1 -0
- package/lib/assets/ui/checkbox.ui.js +1 -0
- package/lib/assets/ui/container.ui.js +1 -0
- package/lib/assets/ui/datagrid.ui.js +1 -0
- package/lib/assets/ui/dialog.js +1 -0
- package/lib/assets/ui/draggable.ui.js +1 -0
- package/lib/assets/ui/hpanel.ui.js +1 -0
- package/lib/assets/ui/iconButtonMenu.ui.js +1 -0
- package/lib/assets/ui/image.ui.js +1 -0
- package/lib/assets/ui/label.ui.js +1 -0
- package/lib/assets/ui/loading.ui.js +1 -0
- package/lib/assets/ui/menu.ui.js +1 -0
- package/lib/assets/ui/progressbar.ui.js +1 -0
- package/lib/assets/ui/radiobutton.ui.js +1 -0
- package/lib/assets/ui/scroll.ui.js +1 -0
- package/lib/assets/ui/select.ui.js +1 -0
- package/lib/assets/ui/styles/accordion.css +1 -0
- package/lib/assets/ui/styles/button.css +1 -0
- package/lib/assets/ui/styles/buttoncolor.css +1 -0
- package/lib/assets/ui/styles/container.css +1 -0
- package/lib/assets/ui/styles/datagrid.css +1 -0
- package/lib/assets/ui/styles/dialog.css +1 -0
- package/lib/assets/ui/styles/draggable.css +1 -0
- package/lib/assets/ui/styles/hpanel.css +1 -0
- package/lib/assets/ui/styles/icon.css +1 -0
- package/lib/assets/ui/styles/image.css +1 -0
- package/lib/assets/ui/styles/label.css +1 -0
- package/lib/assets/ui/styles/loading.css +1 -0
- package/lib/assets/ui/styles/main.css +1 -0
- package/lib/assets/ui/styles/menu.css +1 -0
- package/lib/assets/ui/styles/progressbar.css +1 -0
- package/lib/assets/ui/styles/scroll.css +1 -0
- package/lib/assets/ui/styles/select.css +1 -0
- package/lib/assets/ui/styles/stackbutton.css +1 -0
- package/lib/assets/ui/styles/tabs.css +1 -0
- package/lib/assets/ui/styles/textarea.css +1 -0
- package/lib/assets/ui/styles/textbox.css +1 -0
- package/lib/assets/ui/styles/toolbar.css +1 -0
- package/lib/assets/ui/styles/valuebar.css +1 -0
- package/lib/assets/ui/styles/vpanel.css +1 -0
- package/lib/assets/ui/styles/vstackbutton.css +1 -0
- package/lib/assets/ui/switch.ui.js +1 -0
- package/lib/assets/ui/tabs.ui.js +1 -0
- package/lib/assets/ui/textarea.ui.js +1 -0
- package/lib/assets/ui/toggle.ui.js +1 -0
- package/lib/assets/ui/toolbar.ui.js +1 -0
- package/lib/assets/ui/valuebar.ui.js +1 -0
- package/lib/assets/ui/vpanel.ui.js +1 -0
- package/lib/assets/ui/widget.builder.js +1 -0
- package/lib/assets/ui/widget.collection.js +1 -0
- package/lib/assets/ui/widget.ui.js +1 -0
- package/lib/cedro-logo.png +0 -0
- package/lib/cedro-logo.svg +97 -0
- package/lib/fangio.jpg +0 -0
- package/lib/material-icons-list.json/357/200/272Zone.Identifier +3 -0
- package/package.json +10 -4
- package/rollup.config.js +31 -0
- package/tsconfig.json +3 -0
- package/tsconfig.publish.json +3 -0
- package/vite.publish.config.ts +41 -0
- package/lib/core/application.builder.d.ts +0 -2
- package/lib/core/application.builder.jsx +0 -103
- package/lib/core/application.builder.jsx.map +0 -1
- package/lib/core/application.core.d.ts +0 -96
- package/lib/core/application.core.jsx +0 -290
- package/lib/core/application.core.jsx.map +0 -1
- package/lib/core/index.d.ts +0 -3
- package/lib/core/index.js +0 -4
- package/lib/core/index.js.map +0 -1
- package/lib/core/jsxsupport.d.ts +0 -13
- package/lib/core/jsxsupport.js +0 -82
- package/lib/core/jsxsupport.js.map +0 -1
- package/lib/core/screeen.core.d.ts +0 -41
- package/lib/core/screeen.core.js +0 -76
- package/lib/core/screeen.core.js.map +0 -1
- package/lib/core/seo.d.ts +0 -33
- package/lib/core/seo.js +0 -66
- package/lib/core/seo.js.map +0 -1
- package/lib/core/themes.core.d.ts +0 -22
- package/lib/core/themes.core.js +0 -317
- package/lib/core/themes.core.js.map +0 -1
- package/lib/core/uid.d.ts +0 -1
- package/lib/core/uid.js +0 -4
- package/lib/core/uid.js.map +0 -1
- package/lib/index.d.ts +0 -5
- package/lib/index.js +0 -8
- package/lib/index.js.map +0 -1
- package/lib/interfaces/application.interface.d.ts +0 -39
- package/lib/interfaces/application.interface.js +0 -6
- package/lib/interfaces/application.interface.js.map +0 -1
- package/lib/interfaces/screen.interface.d.ts +0 -12
- package/lib/interfaces/screen.interface.js +0 -2
- package/lib/interfaces/screen.interface.js.map +0 -1
- package/lib/interfaces/themes.interface.d.ts +0 -15
- package/lib/interfaces/themes.interface.js +0 -2
- package/lib/interfaces/themes.interface.js.map +0 -1
- package/lib/interfaces/widget.interface.d.ts +0 -85
- package/lib/interfaces/widget.interface.js +0 -2
- package/lib/interfaces/widget.interface.js.map +0 -1
- package/lib/types/orientation.type.d.ts +0 -1
- package/lib/types/orientation.type.js +0 -2
- package/lib/types/orientation.type.js.map +0 -1
- package/lib/types/select.item.type.d.ts +0 -6
- package/lib/types/select.item.type.js +0 -26
- package/lib/types/select.item.type.js.map +0 -1
- package/lib/types/vector2d.type.d.ts +0 -4
- package/lib/types/vector2d.type.js +0 -2
- package/lib/types/vector2d.type.js.map +0 -1
- package/lib/ui/Icon.ui.d.ts +0 -31
- package/lib/ui/Icon.ui.jsx +0 -121
- package/lib/ui/Icon.ui.jsx.map +0 -1
- package/lib/ui/IconButton.ui.d.ts +0 -32
- package/lib/ui/IconButton.ui.jsx +0 -184
- package/lib/ui/IconButton.ui.jsx.map +0 -1
- package/lib/ui/Textbox.ui.d.ts +0 -32
- package/lib/ui/Textbox.ui.jsx +0 -152
- package/lib/ui/Textbox.ui.jsx.map +0 -1
- package/lib/ui/accordion.ui.d.ts +0 -27
- package/lib/ui/accordion.ui.jsx +0 -108
- package/lib/ui/accordion.ui.jsx.map +0 -1
- package/lib/ui/button.ui.d.ts +0 -44
- package/lib/ui/button.ui.jsx +0 -180
- package/lib/ui/button.ui.jsx.map +0 -1
- package/lib/ui/buttonColor.ui.d.ts +0 -14
- package/lib/ui/buttonColor.ui.jsx +0 -58
- package/lib/ui/buttonColor.ui.jsx.map +0 -1
- package/lib/ui/buttonmenu.ui.d.ts +0 -23
- package/lib/ui/buttonmenu.ui.jsx +0 -104
- package/lib/ui/buttonmenu.ui.jsx.map +0 -1
- package/lib/ui/buttonstack.ui.d.ts +0 -26
- package/lib/ui/buttonstack.ui.jsx +0 -138
- package/lib/ui/buttonstack.ui.jsx.map +0 -1
- package/lib/ui/checkbox.ui.d.ts +0 -12
- package/lib/ui/checkbox.ui.jsx +0 -29
- package/lib/ui/checkbox.ui.jsx.map +0 -1
- package/lib/ui/colors.ui.d.ts +0 -1
- package/lib/ui/colors.ui.js +0 -2
- package/lib/ui/colors.ui.js.map +0 -1
- package/lib/ui/container.ui.d.ts +0 -33
- package/lib/ui/container.ui.jsx +0 -96
- package/lib/ui/container.ui.jsx.map +0 -1
- package/lib/ui/datagrid.ui.d.ts +0 -119
- package/lib/ui/datagrid.ui.jsx +0 -445
- package/lib/ui/datagrid.ui.jsx.map +0 -1
- package/lib/ui/dialog.d.ts +0 -102
- package/lib/ui/dialog.jsx +0 -480
- package/lib/ui/dialog.jsx.map +0 -1
- package/lib/ui/draggable.ui.d.ts +0 -27
- package/lib/ui/draggable.ui.js +0 -183
- package/lib/ui/draggable.ui.js.map +0 -1
- package/lib/ui/hpanel.ui.d.ts +0 -26
- package/lib/ui/hpanel.ui.jsx +0 -183
- package/lib/ui/hpanel.ui.jsx.map +0 -1
- package/lib/ui/iconButtonMenu.ui.d.ts +0 -27
- package/lib/ui/iconButtonMenu.ui.jsx +0 -135
- package/lib/ui/iconButtonMenu.ui.jsx.map +0 -1
- package/lib/ui/image.ui.d.ts +0 -25
- package/lib/ui/image.ui.jsx +0 -88
- package/lib/ui/image.ui.jsx.map +0 -1
- package/lib/ui/index.d.ts +0 -30
- package/lib/ui/index.js +0 -30
- package/lib/ui/index.js.map +0 -1
- package/lib/ui/label.ui.d.ts +0 -37
- package/lib/ui/label.ui.jsx +0 -155
- package/lib/ui/label.ui.jsx.map +0 -1
- package/lib/ui/loading.ui.d.ts +0 -5
- package/lib/ui/loading.ui.js +0 -10
- package/lib/ui/loading.ui.js.map +0 -1
- package/lib/ui/menu.ui.d.ts +0 -19
- package/lib/ui/menu.ui.js +0 -186
- package/lib/ui/menu.ui.js.map +0 -1
- package/lib/ui/progressbar.ui.d.ts +0 -23
- package/lib/ui/progressbar.ui.jsx +0 -109
- package/lib/ui/progressbar.ui.jsx.map +0 -1
- package/lib/ui/radiobutton.ui.d.ts +0 -12
- package/lib/ui/radiobutton.ui.jsx +0 -29
- package/lib/ui/radiobutton.ui.jsx.map +0 -1
- package/lib/ui/scroll.ui.d.ts +0 -13
- package/lib/ui/scroll.ui.js +0 -163
- package/lib/ui/scroll.ui.js.map +0 -1
- package/lib/ui/select.ui.d.ts +0 -29
- package/lib/ui/select.ui.jsx +0 -129
- package/lib/ui/select.ui.jsx.map +0 -1
- package/lib/ui/switch.ui.d.ts +0 -12
- package/lib/ui/switch.ui.jsx +0 -29
- package/lib/ui/switch.ui.jsx.map +0 -1
- package/lib/ui/tabs.ui.d.ts +0 -40
- package/lib/ui/tabs.ui.jsx +0 -242
- package/lib/ui/tabs.ui.jsx.map +0 -1
- package/lib/ui/textarea.ui.d.ts +0 -13
- package/lib/ui/textarea.ui.jsx +0 -34
- package/lib/ui/textarea.ui.jsx.map +0 -1
- package/lib/ui/toggle.ui.d.ts +0 -11
- package/lib/ui/toggle.ui.jsx +0 -48
- package/lib/ui/toggle.ui.jsx.map +0 -1
- package/lib/ui/toolbar.ui.d.ts +0 -44
- package/lib/ui/toolbar.ui.jsx +0 -261
- package/lib/ui/toolbar.ui.jsx.map +0 -1
- package/lib/ui/valuebar.ui.d.ts +0 -23
- package/lib/ui/valuebar.ui.jsx +0 -144
- package/lib/ui/valuebar.ui.jsx.map +0 -1
- package/lib/ui/vpanel.ui.d.ts +0 -24
- package/lib/ui/vpanel.ui.jsx +0 -170
- package/lib/ui/vpanel.ui.jsx.map +0 -1
- package/lib/ui/widget.builder.d.ts +0 -25
- package/lib/ui/widget.builder.js +0 -216
- package/lib/ui/widget.builder.js.map +0 -1
- package/lib/ui/widget.collection.d.ts +0 -20
- package/lib/ui/widget.collection.js +0 -49
- package/lib/ui/widget.collection.js.map +0 -1
- package/lib/ui/widget.ui.d.ts +0 -337
- package/lib/ui/widget.ui.js +0 -964
- package/lib/ui/widget.ui.js.map +0 -1
package/lib/ui/widget.ui.js
DELETED
|
@@ -1,964 +0,0 @@
|
|
|
1
|
-
import { UID } from "../core/uid";
|
|
2
|
-
import { addNewWidget, connectWidget } from "./widget.collection";
|
|
3
|
-
export var WidgetTypes;
|
|
4
|
-
(function (WidgetTypes) {
|
|
5
|
-
WidgetTypes[WidgetTypes["FILL"] = 1] = "FILL";
|
|
6
|
-
WidgetTypes[WidgetTypes["CUSTOM"] = 2] = "CUSTOM";
|
|
7
|
-
WidgetTypes[WidgetTypes["FREE"] = 3] = "FREE";
|
|
8
|
-
})(WidgetTypes || (WidgetTypes = {}));
|
|
9
|
-
export var WidgetAlignTypes;
|
|
10
|
-
(function (WidgetAlignTypes) {
|
|
11
|
-
WidgetAlignTypes[WidgetAlignTypes["HORIZONTAL"] = 1] = "HORIZONTAL";
|
|
12
|
-
WidgetAlignTypes[WidgetAlignTypes["VERTICAL"] = 2] = "VERTICAL";
|
|
13
|
-
})(WidgetAlignTypes || (WidgetAlignTypes = {}));
|
|
14
|
-
export class Widget {
|
|
15
|
-
constructor(id = "", bodyTagName = "div", parent = null) {
|
|
16
|
-
Object.defineProperty(this, "id", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(this, "subscribers", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true,
|
|
25
|
-
writable: true,
|
|
26
|
-
value: void 0
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(this, "padding", {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
configurable: true,
|
|
31
|
-
writable: true,
|
|
32
|
-
value: void 0
|
|
33
|
-
});
|
|
34
|
-
Object.defineProperty(this, "left", {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
writable: true,
|
|
38
|
-
value: void 0
|
|
39
|
-
});
|
|
40
|
-
Object.defineProperty(this, "top", {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
configurable: true,
|
|
43
|
-
writable: true,
|
|
44
|
-
value: void 0
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(this, "width", {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
configurable: true,
|
|
49
|
-
writable: true,
|
|
50
|
-
value: void 0
|
|
51
|
-
});
|
|
52
|
-
Object.defineProperty(this, "height", {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
configurable: true,
|
|
55
|
-
writable: true,
|
|
56
|
-
value: void 0
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(this, "initialWidth", {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
configurable: true,
|
|
61
|
-
writable: true,
|
|
62
|
-
value: void 0
|
|
63
|
-
});
|
|
64
|
-
Object.defineProperty(this, "initialHeight", {
|
|
65
|
-
enumerable: true,
|
|
66
|
-
configurable: true,
|
|
67
|
-
writable: true,
|
|
68
|
-
value: void 0
|
|
69
|
-
});
|
|
70
|
-
Object.defineProperty(this, "overflow", {
|
|
71
|
-
enumerable: true,
|
|
72
|
-
configurable: true,
|
|
73
|
-
writable: true,
|
|
74
|
-
value: void 0
|
|
75
|
-
});
|
|
76
|
-
Object.defineProperty(this, "fixedSize", {
|
|
77
|
-
enumerable: true,
|
|
78
|
-
configurable: true,
|
|
79
|
-
writable: true,
|
|
80
|
-
value: void 0
|
|
81
|
-
});
|
|
82
|
-
Object.defineProperty(this, "type", {
|
|
83
|
-
enumerable: true,
|
|
84
|
-
configurable: true,
|
|
85
|
-
writable: true,
|
|
86
|
-
value: void 0
|
|
87
|
-
});
|
|
88
|
-
Object.defineProperty(this, "align", {
|
|
89
|
-
enumerable: true,
|
|
90
|
-
configurable: true,
|
|
91
|
-
writable: true,
|
|
92
|
-
value: void 0
|
|
93
|
-
});
|
|
94
|
-
Object.defineProperty(this, "visible", {
|
|
95
|
-
enumerable: true,
|
|
96
|
-
configurable: true,
|
|
97
|
-
writable: true,
|
|
98
|
-
value: void 0
|
|
99
|
-
});
|
|
100
|
-
Object.defineProperty(this, "enabled", {
|
|
101
|
-
enumerable: true,
|
|
102
|
-
configurable: true,
|
|
103
|
-
writable: true,
|
|
104
|
-
value: void 0
|
|
105
|
-
});
|
|
106
|
-
Object.defineProperty(this, "parent", {
|
|
107
|
-
enumerable: true,
|
|
108
|
-
configurable: true,
|
|
109
|
-
writable: true,
|
|
110
|
-
value: void 0
|
|
111
|
-
});
|
|
112
|
-
Object.defineProperty(this, "childs", {
|
|
113
|
-
enumerable: true,
|
|
114
|
-
configurable: true,
|
|
115
|
-
writable: true,
|
|
116
|
-
value: void 0
|
|
117
|
-
});
|
|
118
|
-
Object.defineProperty(this, "bodyTagName", {
|
|
119
|
-
enumerable: true,
|
|
120
|
-
configurable: true,
|
|
121
|
-
writable: true,
|
|
122
|
-
value: void 0
|
|
123
|
-
});
|
|
124
|
-
Object.defineProperty(this, "body", {
|
|
125
|
-
enumerable: true,
|
|
126
|
-
configurable: true,
|
|
127
|
-
writable: true,
|
|
128
|
-
value: void 0
|
|
129
|
-
});
|
|
130
|
-
this.id = id ? id : UID();
|
|
131
|
-
this.overflow = false;
|
|
132
|
-
this.subscribers = new Map();
|
|
133
|
-
this.padding = 0;
|
|
134
|
-
this.left = 0;
|
|
135
|
-
this.top = 0;
|
|
136
|
-
this.width = 0;
|
|
137
|
-
this.height = 0;
|
|
138
|
-
this.initialWidth = 0;
|
|
139
|
-
this.initialHeight = 0;
|
|
140
|
-
this.fixedSize = null;
|
|
141
|
-
this.type = WidgetTypes.FREE;
|
|
142
|
-
this.align = WidgetAlignTypes.VERTICAL;
|
|
143
|
-
this.visible = true;
|
|
144
|
-
this.enabled = true;
|
|
145
|
-
this.parent = parent;
|
|
146
|
-
this.childs = [];
|
|
147
|
-
this.bodyTagName = bodyTagName;
|
|
148
|
-
this.body = document.createElement(this.bodyTagName);
|
|
149
|
-
this.body.id = `WUI.${id}.body`;
|
|
150
|
-
if (parent) {
|
|
151
|
-
//this.setType(WidgetTypes.CUSTOM);
|
|
152
|
-
parent.addChild(this);
|
|
153
|
-
parent.getBody().appendChild(this.body);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
this.setType(WidgetTypes.FREE);
|
|
157
|
-
document.body.appendChild(this.body);
|
|
158
|
-
}
|
|
159
|
-
this.body.addEventListener("click", (e) => {
|
|
160
|
-
this.subscribers.forEach((callback) => {
|
|
161
|
-
if (callback.event == "click") {
|
|
162
|
-
callback.then(e, this);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
this.body.addEventListener("mousedown", (e) => {
|
|
167
|
-
this.subscribers.forEach((callback) => {
|
|
168
|
-
if (callback.event == "mousedown") {
|
|
169
|
-
callback.then(e, this);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
this.body.addEventListener("mouseup", (e) => {
|
|
174
|
-
this.subscribers.forEach((callback) => {
|
|
175
|
-
if (callback.event == "mouseup") {
|
|
176
|
-
callback.then(e, this);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
this.body.addEventListener("mousemove", (e) => {
|
|
181
|
-
this.subscribers.forEach((callback) => {
|
|
182
|
-
if (callback.event == "mousemove") {
|
|
183
|
-
callback.then(e, this);
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
this.body.addEventListener("wheel", (e) => {
|
|
188
|
-
this.subscribers.forEach((callback) => {
|
|
189
|
-
if (callback.event == "wheel") {
|
|
190
|
-
callback.then(e, this);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
this.body.addEventListener("mouseout", (e) => {
|
|
195
|
-
this.subscribers.forEach((callback) => {
|
|
196
|
-
if (callback.event == "mouseout") {
|
|
197
|
-
callback.then(e, this);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
this.body.addEventListener("mouseleave", (e) => {
|
|
202
|
-
this.subscribers.forEach((callback) => {
|
|
203
|
-
if (callback.event == "mouseleave") {
|
|
204
|
-
callback.then(e, this);
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
this.init();
|
|
209
|
-
this.getMaxZIndex();
|
|
210
|
-
addNewWidget(this.id, this);
|
|
211
|
-
}
|
|
212
|
-
run(eventId) {
|
|
213
|
-
this.subscribers.forEach((callback) => {
|
|
214
|
-
if (callback.event == eventId) {
|
|
215
|
-
callback.then(new Event(eventId), this);
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
subscribe(cb) {
|
|
220
|
-
const randomId = Math.random().toString(36).substring(2, 15) +
|
|
221
|
-
Math.random().toString(36).substring(2, 15);
|
|
222
|
-
this.subscribers.set(`${randomId}.${cb.event}`, cb);
|
|
223
|
-
}
|
|
224
|
-
unsubscribe(event) {
|
|
225
|
-
this.subscribers.delete(`${event}`);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Sets the padding value for the object.
|
|
229
|
-
*
|
|
230
|
-
* @param {number} p - The padding value to set.
|
|
231
|
-
* @return {void} This function does not return a value.
|
|
232
|
-
*/
|
|
233
|
-
setPadding(p) {
|
|
234
|
-
this.padding = p;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Sets the value of x and updates the left position of the element.
|
|
238
|
-
*
|
|
239
|
-
* @param {number} x - The new value of x.
|
|
240
|
-
* @return {void} This function does not return anything.
|
|
241
|
-
*/
|
|
242
|
-
setX(x) {
|
|
243
|
-
this.left = x;
|
|
244
|
-
this.body.style.left = `${x}px`;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Sets the value of the 'y' property and updates the 'top' and 'body.style.top' properties accordingly.
|
|
248
|
-
*
|
|
249
|
-
* @param {number} y - The new value for the 'y' property.
|
|
250
|
-
* @return {void} This function does not return a value.
|
|
251
|
-
*/
|
|
252
|
-
setY(y) {
|
|
253
|
-
this.top = y;
|
|
254
|
-
this.body.style.top = `${y}px`;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Sets the width of the element and updates the corresponding inline style.
|
|
258
|
-
*
|
|
259
|
-
* @param {number} w - The new width value.
|
|
260
|
-
* @return {void} This function does not return a value.
|
|
261
|
-
*/
|
|
262
|
-
setW(w) {
|
|
263
|
-
//this.width = w;
|
|
264
|
-
this.body.style.width = `${w}px`;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Sets the initial value of the width property.
|
|
268
|
-
*
|
|
269
|
-
* @param {number} w - The initial width value.
|
|
270
|
-
* @return {void} This function does not return a value.
|
|
271
|
-
*/
|
|
272
|
-
setInitialW(w) {
|
|
273
|
-
this.initialWidth = w;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Sets the value of the height property and updates the height of the element.
|
|
277
|
-
*
|
|
278
|
-
* @param {number} h - The new height value.
|
|
279
|
-
* @return {void} This function does not return any value.
|
|
280
|
-
*/
|
|
281
|
-
setH(h) {
|
|
282
|
-
//this.height = h;
|
|
283
|
-
this.body.style.height = `${h}px`;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Sets the initial height of the object.
|
|
287
|
-
*
|
|
288
|
-
* @param {number} h - The initial height value to set.
|
|
289
|
-
* @return {void} This function does not return a value.
|
|
290
|
-
*/
|
|
291
|
-
setInitialH(h) {
|
|
292
|
-
this.initialHeight = h;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Sets the width and height of the element.
|
|
296
|
-
*
|
|
297
|
-
* @param {number} w - The width to set.
|
|
298
|
-
* @param {number} h - The height to set.
|
|
299
|
-
* @return {void} This function does not return anything.
|
|
300
|
-
*/
|
|
301
|
-
setWH(w, h) {
|
|
302
|
-
this.width = w;
|
|
303
|
-
this.height = h;
|
|
304
|
-
this.body.style.width = `${w}px`;
|
|
305
|
-
this.body.style.height = `${h}px`;
|
|
306
|
-
//ejecutar los subscriptores
|
|
307
|
-
this.subscribers.forEach((callback) => {
|
|
308
|
-
if (callback.event == "resize") {
|
|
309
|
-
callback.then(new Event("resize"), this);
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
setFixedSize(s) {
|
|
314
|
-
this.fixedSize = s;
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Sets the type of the widget.
|
|
318
|
-
*
|
|
319
|
-
* @param {WidgetTypes} type - The type of widget to set.
|
|
320
|
-
* @return {void} This function does not return anything.
|
|
321
|
-
*/
|
|
322
|
-
setType(type) {
|
|
323
|
-
this.type = type;
|
|
324
|
-
let freeStyle = false;
|
|
325
|
-
if (this.type === WidgetTypes.FREE) {
|
|
326
|
-
freeStyle = true;
|
|
327
|
-
}
|
|
328
|
-
const parent = this.getParent();
|
|
329
|
-
if (parent) {
|
|
330
|
-
if (parent.type === WidgetTypes.FREE) {
|
|
331
|
-
freeStyle = true;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
if (freeStyle) {
|
|
335
|
-
this.deleteClass("WUINonFreePosition");
|
|
336
|
-
this.addClass("WUIFixPosition");
|
|
337
|
-
this.body.style.left = "";
|
|
338
|
-
this.body.style.top = "";
|
|
339
|
-
this.body.style.width = "";
|
|
340
|
-
this.body.style.height = "";
|
|
341
|
-
this.body.style.bottom = "";
|
|
342
|
-
this.body.style.right = "";
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
if (this.type === WidgetTypes.CUSTOM || this.type === WidgetTypes.FILL) {
|
|
346
|
-
// this.body.style.position = "absolute";
|
|
347
|
-
// this.body.style.overflow = "hidden";
|
|
348
|
-
this.deleteClass("WUIFixPosition");
|
|
349
|
-
this.addClass("WUINonFreePosition");
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
if (this.initialWidth != 0) {
|
|
353
|
-
this.body.style.width = `${this.initialWidth}px`;
|
|
354
|
-
}
|
|
355
|
-
if (this.initialHeight != 0) {
|
|
356
|
-
this.body.style.height = `${this.initialHeight}px`;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Sets the alignment of the widget.
|
|
361
|
-
*
|
|
362
|
-
* @param {WidgetAlignTypes} align - The alignment to set.
|
|
363
|
-
* @return {void}
|
|
364
|
-
*/
|
|
365
|
-
setAlign(align) {
|
|
366
|
-
this.align = align;
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Sets the visibility of the element.
|
|
370
|
-
*
|
|
371
|
-
* @param {boolean} visible - The visibility state of the element.
|
|
372
|
-
* @return {void}
|
|
373
|
-
*/
|
|
374
|
-
setVisible(visible) {
|
|
375
|
-
this.visible = visible;
|
|
376
|
-
this.body.style.display = visible ? "" : "none";
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Sets the enabled status of the object.
|
|
380
|
-
*
|
|
381
|
-
* @param {boolean} enabled - The new enabled status.
|
|
382
|
-
* @return {void} This function does not return a value.
|
|
383
|
-
*/
|
|
384
|
-
setEnabled(enabled) {
|
|
385
|
-
this.enabled = enabled;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Sets the parent of the widget.
|
|
389
|
-
*
|
|
390
|
-
* @param {IWidget | null} parent - The parent widget or null if there is no parent.
|
|
391
|
-
* @return {void} This function does not return anything.
|
|
392
|
-
*/
|
|
393
|
-
setParent(parent) {
|
|
394
|
-
if (this.parent) {
|
|
395
|
-
if (this.body) {
|
|
396
|
-
if (this.body.parentNode) {
|
|
397
|
-
this.body.parentNode.removeChild(this.body);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
this.parent = parent;
|
|
402
|
-
this.parent?.body.appendChild(this.body);
|
|
403
|
-
this.setType(this.type); //TODO: revisar, se coloca para tratar de que reconozca al padre como freestyle en caso de serlo.
|
|
404
|
-
//this.parent?.addChild(this);
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* Sets the body of the element.
|
|
408
|
-
*
|
|
409
|
-
* @param {HTMLElement} body - The new body element.
|
|
410
|
-
* @return {void} This function does not return anything.
|
|
411
|
-
*/
|
|
412
|
-
setBody(body) {
|
|
413
|
-
if (this.body.parentNode) {
|
|
414
|
-
this.body.parentNode.removeChild(this.body);
|
|
415
|
-
}
|
|
416
|
-
this.body = body;
|
|
417
|
-
this.parent?.getBody().appendChild(this.body);
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Sets the array of child widgets for this widget.
|
|
421
|
-
*
|
|
422
|
-
* @param {IWidget[]} childs - The array of child widgets to set.
|
|
423
|
-
* @return {void}
|
|
424
|
-
*/
|
|
425
|
-
setChilds(childs) {
|
|
426
|
-
this.childs = childs;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Sets the overflow value.
|
|
430
|
-
*
|
|
431
|
-
* @param {boolean} overflow - The new value for the overflow.
|
|
432
|
-
* @return {void} This function does not return a value.
|
|
433
|
-
*/
|
|
434
|
-
setOverflow(overflow) {
|
|
435
|
-
this.overflow = overflow;
|
|
436
|
-
this.getBody().style.overflow = this.overflow ? "auto" : "hidden";
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Adds a CSS class to the list of CSS classes.
|
|
440
|
-
*
|
|
441
|
-
* @param {string} cssClass - The CSS class to add.
|
|
442
|
-
* @return {void}
|
|
443
|
-
*/
|
|
444
|
-
addClass(cssClass) {
|
|
445
|
-
this.body.classList.add(cssClass);
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Deletes a CSS class from the list of CSS classes.
|
|
449
|
-
*
|
|
450
|
-
* @param {string} cssClass - The CSS class to be deleted.
|
|
451
|
-
* @return {void} This function does not return a value.
|
|
452
|
-
*/
|
|
453
|
-
deleteClass(cssClass) {
|
|
454
|
-
this.body.classList.remove(cssClass);
|
|
455
|
-
}
|
|
456
|
-
deleteAllClasses() {
|
|
457
|
-
this.body.classList.forEach((cssClass) => {
|
|
458
|
-
this.deleteClass(cssClass);
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Retrieves the padding value.
|
|
463
|
-
*
|
|
464
|
-
* @return {number} The padding value.
|
|
465
|
-
*/
|
|
466
|
-
getPadding() {
|
|
467
|
-
return this.padding;
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Retrieves the value of the 'left' property.
|
|
471
|
-
*
|
|
472
|
-
* @return {number} The value of the 'left' property.
|
|
473
|
-
*/
|
|
474
|
-
getX(recursive = false) {
|
|
475
|
-
if (!recursive) {
|
|
476
|
-
return this.left;
|
|
477
|
-
}
|
|
478
|
-
const parent = this.getParent();
|
|
479
|
-
if (parent) {
|
|
480
|
-
return this.left + parent.getX(true);
|
|
481
|
-
}
|
|
482
|
-
return this.left;
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* Retrieves the value of Y.
|
|
486
|
-
*
|
|
487
|
-
* @return {number} The value of Y.
|
|
488
|
-
*/
|
|
489
|
-
getY(recursive = false) {
|
|
490
|
-
if (!recursive) {
|
|
491
|
-
return this.top;
|
|
492
|
-
}
|
|
493
|
-
const parent = this.getParent();
|
|
494
|
-
if (parent) {
|
|
495
|
-
return this.top + parent.getY(true);
|
|
496
|
-
}
|
|
497
|
-
return this.top;
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* Get the width of the object.
|
|
501
|
-
*
|
|
502
|
-
* @return {number} The width of the object.
|
|
503
|
-
*/
|
|
504
|
-
getW() {
|
|
505
|
-
//return this.width;
|
|
506
|
-
return this.getBody().clientWidth;
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* Returns the value of the height property.
|
|
510
|
-
*
|
|
511
|
-
* @return {number} The value of the height property.
|
|
512
|
-
*/
|
|
513
|
-
getH() {
|
|
514
|
-
//return this.height;
|
|
515
|
-
return this.getBody().clientHeight;
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* Returns the position of the element relative to the viewport.
|
|
519
|
-
*
|
|
520
|
-
* @param {boolean} scroll - Indicates whether to account for scrolling in the position calculation. Defaults to false.
|
|
521
|
-
* @return {Vector2D} An object with x and y properties representing the position of the element.
|
|
522
|
-
*/
|
|
523
|
-
getPosition(scroll = false) {
|
|
524
|
-
var box = this.getBody().getBoundingClientRect();
|
|
525
|
-
var body = document.body;
|
|
526
|
-
var docElem = document.documentElement;
|
|
527
|
-
var scrollTop = scroll ? docElem.scrollTop || body.scrollTop : 0;
|
|
528
|
-
var scrollLeft = scroll ? docElem.scrollLeft || body.scrollLeft : 0;
|
|
529
|
-
var clientTop = docElem.clientTop || body.clientTop || 0;
|
|
530
|
-
var clientLeft = docElem.clientLeft || body.clientLeft || 0;
|
|
531
|
-
var top = box.top + scrollTop - clientTop;
|
|
532
|
-
var left = box.left + scrollLeft - clientLeft;
|
|
533
|
-
return { x: Math.round(left), y: Math.round(top) };
|
|
534
|
-
}
|
|
535
|
-
getFixedSize() {
|
|
536
|
-
return this.fixedSize;
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Returns the type of the widget.
|
|
540
|
-
*
|
|
541
|
-
* @return {WidgetTypes} The type of the widget.
|
|
542
|
-
*/
|
|
543
|
-
getType() {
|
|
544
|
-
return this.type;
|
|
545
|
-
}
|
|
546
|
-
/**
|
|
547
|
-
* Retrieves the alignment of the widget.
|
|
548
|
-
*
|
|
549
|
-
* @return {WidgetAlignTypes} The alignment of the widget.
|
|
550
|
-
*/
|
|
551
|
-
getAlign() {
|
|
552
|
-
return this.align;
|
|
553
|
-
}
|
|
554
|
-
/**
|
|
555
|
-
* Retrieves the value of the enabled flag.
|
|
556
|
-
*
|
|
557
|
-
* @return {boolean} The value of the enabled flag.
|
|
558
|
-
*/
|
|
559
|
-
getEnabled() {
|
|
560
|
-
return this.enabled;
|
|
561
|
-
}
|
|
562
|
-
/**
|
|
563
|
-
* Returns the visibility status of the element.
|
|
564
|
-
*
|
|
565
|
-
* @return {boolean} The visibility status of the element.
|
|
566
|
-
*/
|
|
567
|
-
getVisible() {
|
|
568
|
-
return this.visible;
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Retrieves the parent widget of this widget.
|
|
572
|
-
*
|
|
573
|
-
* @return {IWidget | null} The parent widget or null if there is no parent.
|
|
574
|
-
*/
|
|
575
|
-
getParent() {
|
|
576
|
-
return this.parent;
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* Returns the body element of the object.
|
|
580
|
-
*
|
|
581
|
-
* @return {HTMLElement} The body element.
|
|
582
|
-
*/
|
|
583
|
-
getBody() {
|
|
584
|
-
return this.body;
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* Retrieves the array of child widgets.
|
|
588
|
-
*
|
|
589
|
-
* @return {IWidget[]} The array of child widgets.
|
|
590
|
-
*/
|
|
591
|
-
getChilds() {
|
|
592
|
-
return this.childs;
|
|
593
|
-
}
|
|
594
|
-
/**
|
|
595
|
-
* Returns the value of the 'overflow' property.
|
|
596
|
-
*
|
|
597
|
-
* @return {boolean} The value of the 'overflow' property.
|
|
598
|
-
*/
|
|
599
|
-
getOverflow() {
|
|
600
|
-
return this.overflow;
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Adds a child widget to the current widget.
|
|
604
|
-
*
|
|
605
|
-
* @param {IWidget} child - The widget to be added.
|
|
606
|
-
* @return {void} - This function does not return anything.
|
|
607
|
-
*/
|
|
608
|
-
addChild(child = null) {
|
|
609
|
-
if (!child)
|
|
610
|
-
return;
|
|
611
|
-
this.childs.push(child);
|
|
612
|
-
child.setParent(this);
|
|
613
|
-
child.init();
|
|
614
|
-
/*child.resize();
|
|
615
|
-
child.render();*/
|
|
616
|
-
}
|
|
617
|
-
populate() {
|
|
618
|
-
//se agrega a si mismo a window.w y a sus hijos.
|
|
619
|
-
if (!window.w.get(this.id)) {
|
|
620
|
-
window.w.set(this.id, this);
|
|
621
|
-
}
|
|
622
|
-
for (const child of this.childs) {
|
|
623
|
-
child.populate();
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Disables the selection feature.
|
|
628
|
-
*
|
|
629
|
-
* @param {void} -
|
|
630
|
-
* @return {void} -
|
|
631
|
-
*/
|
|
632
|
-
disableSelection() {
|
|
633
|
-
console.log("disableSelection");
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Enables selection.
|
|
637
|
-
*
|
|
638
|
-
*/
|
|
639
|
-
enableSelection() {
|
|
640
|
-
console.log("enableSelection");
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Hides the element by setting its visibility to false.
|
|
644
|
-
*
|
|
645
|
-
* @param {void} -
|
|
646
|
-
* @return {void} -
|
|
647
|
-
*/
|
|
648
|
-
hide() {
|
|
649
|
-
this.setVisible(false);
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* Initializes the function.
|
|
653
|
-
*
|
|
654
|
-
* @param {type} paramName - description of parameter
|
|
655
|
-
* @return {type} description of return value
|
|
656
|
-
*/
|
|
657
|
-
init() {
|
|
658
|
-
let freeStyle = false;
|
|
659
|
-
if (this.type === WidgetTypes.FREE) {
|
|
660
|
-
freeStyle = true;
|
|
661
|
-
}
|
|
662
|
-
const parent = this.getParent();
|
|
663
|
-
if (parent) {
|
|
664
|
-
if (parent.type === WidgetTypes.FREE) {
|
|
665
|
-
freeStyle = true;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
if (!freeStyle) {
|
|
669
|
-
this.deleteClass("WUIFixPosition");
|
|
670
|
-
this.addClass("WUINonFreePosition");
|
|
671
|
-
// this.body.style.position = "absolute";
|
|
672
|
-
// this.body.style.overflow = "hidden";
|
|
673
|
-
}
|
|
674
|
-
this.initPosition();
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* Initializes the position.
|
|
678
|
-
*
|
|
679
|
-
* @param {void} - No parameters required.
|
|
680
|
-
* @return {void} - No return value.
|
|
681
|
-
*/
|
|
682
|
-
initPosition() {
|
|
683
|
-
if (this.type === WidgetTypes.FILL) {
|
|
684
|
-
if (!this.parent) {
|
|
685
|
-
this.setX(0);
|
|
686
|
-
this.setY(0);
|
|
687
|
-
this.setWH(window.innerWidth, window.innerHeight);
|
|
688
|
-
}
|
|
689
|
-
else {
|
|
690
|
-
//Si tiene padre que lo controle el padre!
|
|
691
|
-
return;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
* Renders the component.
|
|
697
|
-
*
|
|
698
|
-
* @return {void}
|
|
699
|
-
*/
|
|
700
|
-
render() {
|
|
701
|
-
//this.initPosition();
|
|
702
|
-
const padding = this.padding;
|
|
703
|
-
const size = this.align === WidgetAlignTypes.HORIZONTAL ? this.width : this.height;
|
|
704
|
-
let currentPosition = padding;
|
|
705
|
-
//Obtener el available size si hay elementos con fixed size
|
|
706
|
-
let sumFixedSizes = 0;
|
|
707
|
-
let totalFillElements = 0;
|
|
708
|
-
for (const child of this.childs) {
|
|
709
|
-
if (child.type === WidgetTypes.FILL) {
|
|
710
|
-
totalFillElements++;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
let freeElements = totalFillElements;
|
|
714
|
-
for (const child of this.childs) {
|
|
715
|
-
if (child.getFixedSize() !== null) {
|
|
716
|
-
sumFixedSizes += child.getFixedSize();
|
|
717
|
-
freeElements--;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
let availableSize = size - sumFixedSizes;
|
|
721
|
-
/**
|
|
722
|
-
* Elementos que tienen un padre LIBRE
|
|
723
|
-
* ===================================
|
|
724
|
-
*/
|
|
725
|
-
const myParent = this.getParent();
|
|
726
|
-
if (myParent) {
|
|
727
|
-
if (myParent.type === WidgetTypes.FREE) {
|
|
728
|
-
//this.getBody().style.position = "relative";
|
|
729
|
-
this.addClass("WUIFixPosition");
|
|
730
|
-
this.getBody().style.left = "";
|
|
731
|
-
this.getBody().style.top = "";
|
|
732
|
-
this.getBody().style.height = "";
|
|
733
|
-
this.getBody().style.width = "";
|
|
734
|
-
if (this.initialWidth != 0) {
|
|
735
|
-
this.getBody().style.width = `${this.initialWidth}px`;
|
|
736
|
-
}
|
|
737
|
-
if (this.initialHeight != 0) {
|
|
738
|
-
this.getBody().style.height = `${this.initialHeight}px`;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
/************************************ */
|
|
743
|
-
for (const child of this.childs) {
|
|
744
|
-
if (child.type !== WidgetTypes.FILL) {
|
|
745
|
-
child.render();
|
|
746
|
-
continue;
|
|
747
|
-
}
|
|
748
|
-
let elementSize = (availableSize - padding) / freeElements;
|
|
749
|
-
if (child.getFixedSize() !== null) {
|
|
750
|
-
elementSize = child.getFixedSize();
|
|
751
|
-
}
|
|
752
|
-
if (this.align === WidgetAlignTypes.HORIZONTAL) {
|
|
753
|
-
child.setY(padding);
|
|
754
|
-
child.setX(currentPosition);
|
|
755
|
-
if (child.type === WidgetTypes.FILL) {
|
|
756
|
-
child.setWH(elementSize - padding, this.getH() - padding * 2);
|
|
757
|
-
}
|
|
758
|
-
else {
|
|
759
|
-
child.setWH(elementSize - padding, this.getH() - padding * 2);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
else if (this.align === WidgetAlignTypes.VERTICAL) {
|
|
763
|
-
child.setX(padding);
|
|
764
|
-
child.setY(currentPosition);
|
|
765
|
-
if (child.type === WidgetTypes.FILL) {
|
|
766
|
-
child.setWH(this.getW() - padding * 2, elementSize - padding);
|
|
767
|
-
}
|
|
768
|
-
else {
|
|
769
|
-
child.setWH(this.getW() - padding * 2, elementSize - padding);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
currentPosition += elementSize;
|
|
773
|
-
child.render();
|
|
774
|
-
}
|
|
775
|
-
this.subscribers.forEach((callback) => {
|
|
776
|
-
if (callback.event == "render") {
|
|
777
|
-
callback.then(new Event("render"), this);
|
|
778
|
-
}
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Resizes the element and its child elements.
|
|
783
|
-
*/
|
|
784
|
-
resize() {
|
|
785
|
-
// Initialize the position of the element
|
|
786
|
-
this.initPosition();
|
|
787
|
-
this.render();
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* Displays the element on the screen.
|
|
791
|
-
*
|
|
792
|
-
* @return {void} - Does not return a value.
|
|
793
|
-
*/
|
|
794
|
-
display() {
|
|
795
|
-
this.setVisible(true);
|
|
796
|
-
}
|
|
797
|
-
/**
|
|
798
|
-
* Toggles the visibility of something.
|
|
799
|
-
*
|
|
800
|
-
* @return {void} Nothing is returned.
|
|
801
|
-
*/
|
|
802
|
-
toggle() {
|
|
803
|
-
this.setVisible(!this.visible);
|
|
804
|
-
}
|
|
805
|
-
renderHTML(content) {
|
|
806
|
-
this.body.appendChild(content);
|
|
807
|
-
return content;
|
|
808
|
-
}
|
|
809
|
-
getMaxZIndex(maxZindex = 0, node = null) {
|
|
810
|
-
const parent = node ? node : document.body;
|
|
811
|
-
if (parent instanceof HTMLElement) {
|
|
812
|
-
if (parseInt(window.getComputedStyle(parent).zIndex) > maxZindex) {
|
|
813
|
-
maxZindex = parseInt(window.getComputedStyle(parent).zIndex);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
parent?.childNodes.forEach((child) => {
|
|
817
|
-
maxZindex = this.getMaxZIndex(maxZindex, child);
|
|
818
|
-
});
|
|
819
|
-
return maxZindex;
|
|
820
|
-
}
|
|
821
|
-
setZIndex(zIndex) {
|
|
822
|
-
this.getBody().style.zIndex = `${zIndex}`;
|
|
823
|
-
}
|
|
824
|
-
raisteTop() {
|
|
825
|
-
this.setZIndex(this.getMaxZIndex() + 1);
|
|
826
|
-
}
|
|
827
|
-
raiseBottom() {
|
|
828
|
-
this.setZIndex(0);
|
|
829
|
-
}
|
|
830
|
-
/**
|
|
831
|
-
* Attaches a widget to the current widget and delete all pre-existents widgets
|
|
832
|
-
*
|
|
833
|
-
* @param {IWidget} guest - The widget to attach.
|
|
834
|
-
* @return {void} This function does not return anything.
|
|
835
|
-
*/
|
|
836
|
-
attachWidget(guest) {
|
|
837
|
-
this.removeAllChilds();
|
|
838
|
-
this.addChild(guest);
|
|
839
|
-
guest.setParent(this);
|
|
840
|
-
guest.render();
|
|
841
|
-
this.resize();
|
|
842
|
-
this.render();
|
|
843
|
-
}
|
|
844
|
-
/**
|
|
845
|
-
* Removes all child nodes from the current element.
|
|
846
|
-
*
|
|
847
|
-
* @return {void} No return value.
|
|
848
|
-
*/
|
|
849
|
-
removeAllChilds() {
|
|
850
|
-
while (this.getBody().childNodes.length > 0) {
|
|
851
|
-
const child = this.getBody().firstChild;
|
|
852
|
-
if (child)
|
|
853
|
-
this.getBody().removeChild(child);
|
|
854
|
-
}
|
|
855
|
-
this.childs = [];
|
|
856
|
-
}
|
|
857
|
-
free() {
|
|
858
|
-
if (this.childs) {
|
|
859
|
-
for (const child of this.childs) {
|
|
860
|
-
child.free();
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
window.w.delete(this.id);
|
|
864
|
-
const body = this.getBody();
|
|
865
|
-
const parent = body.parentNode;
|
|
866
|
-
if (!parent && !body)
|
|
867
|
-
return;
|
|
868
|
-
parent?.removeChild(body);
|
|
869
|
-
}
|
|
870
|
-
dispose() {
|
|
871
|
-
this.removeAllChilds();
|
|
872
|
-
const body = this.getBody();
|
|
873
|
-
const parent = body.parentNode;
|
|
874
|
-
parent?.removeChild(body);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
export function getOnlyEventProps(props) {
|
|
878
|
-
const eventProps = {
|
|
879
|
-
onClick: props.onClick,
|
|
880
|
-
onDrag: props.onDrag,
|
|
881
|
-
onResize: props.onResize,
|
|
882
|
-
onMouseDown: props.onMouseDown,
|
|
883
|
-
onMouseUp: props.onMouseUp,
|
|
884
|
-
onMouseMove: props.onMouseMove,
|
|
885
|
-
onMouseOut: props.onMouseOut,
|
|
886
|
-
onMouseLeave: props.onMouseLeave,
|
|
887
|
-
onWheel: props.onWheel,
|
|
888
|
-
onRender: props.onRender,
|
|
889
|
-
};
|
|
890
|
-
return eventProps;
|
|
891
|
-
}
|
|
892
|
-
export function connectWidgetCallback(id, props) {
|
|
893
|
-
if (!id)
|
|
894
|
-
return;
|
|
895
|
-
connectWidget("widget-added-" + id, {
|
|
896
|
-
event: "widget-load",
|
|
897
|
-
then: (_e, _w) => {
|
|
898
|
-
const widget = w.get(id);
|
|
899
|
-
if (widget) {
|
|
900
|
-
widget.subscribe({
|
|
901
|
-
event: "click",
|
|
902
|
-
then: (_e, _w) => {
|
|
903
|
-
props.onClick ? props.onClick({}) : null;
|
|
904
|
-
},
|
|
905
|
-
});
|
|
906
|
-
widget.subscribe({
|
|
907
|
-
event: "drag",
|
|
908
|
-
then: (_e, _w) => {
|
|
909
|
-
props.onDrag ? props.onDrag({}) : null;
|
|
910
|
-
},
|
|
911
|
-
});
|
|
912
|
-
widget.subscribe({
|
|
913
|
-
event: "resize",
|
|
914
|
-
then: (_e, _w) => {
|
|
915
|
-
props.onResize ? props.onResize({}) : null;
|
|
916
|
-
},
|
|
917
|
-
});
|
|
918
|
-
widget.subscribe({
|
|
919
|
-
event: "mousedown",
|
|
920
|
-
then: (_e, _w) => {
|
|
921
|
-
props.onMouseDown ? props.onMouseDown({}) : null;
|
|
922
|
-
},
|
|
923
|
-
});
|
|
924
|
-
widget.subscribe({
|
|
925
|
-
event: "mouseup",
|
|
926
|
-
then: (_e, _w) => {
|
|
927
|
-
props.onMouseUp ? props.onMouseUp({}) : null;
|
|
928
|
-
},
|
|
929
|
-
});
|
|
930
|
-
widget.subscribe({
|
|
931
|
-
event: "mousemove",
|
|
932
|
-
then: (_e, _w) => {
|
|
933
|
-
props.onMouseMove ? props.onMouseMove({}) : null;
|
|
934
|
-
},
|
|
935
|
-
});
|
|
936
|
-
widget.subscribe({
|
|
937
|
-
event: "mouseout",
|
|
938
|
-
then: (_e, _w) => {
|
|
939
|
-
props.onMouseOut ? props.onMouseOut({}) : null;
|
|
940
|
-
},
|
|
941
|
-
});
|
|
942
|
-
widget.subscribe({
|
|
943
|
-
event: "mouseleave",
|
|
944
|
-
then: (_e, _w) => {
|
|
945
|
-
props.onMouseLeave ? props.onMouseLeave({}) : null;
|
|
946
|
-
},
|
|
947
|
-
});
|
|
948
|
-
widget.subscribe({
|
|
949
|
-
event: "wheel",
|
|
950
|
-
then: (_e, _w) => {
|
|
951
|
-
props.onWheel ? props.onWheel({}) : null;
|
|
952
|
-
},
|
|
953
|
-
});
|
|
954
|
-
widget.subscribe({
|
|
955
|
-
event: "render",
|
|
956
|
-
then: (_e, _w) => {
|
|
957
|
-
props.onRender ? props.onRender({}) : null;
|
|
958
|
-
},
|
|
959
|
-
});
|
|
960
|
-
}
|
|
961
|
-
},
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
//# sourceMappingURL=widget.ui.js.map
|