x4js 2.0.12 → 2.0.14
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/.vscode/launch.json +14 -0
- package/README.md +20 -15
- package/{lib/src/demo → demo}/assets/radio.svg +3 -3
- package/{lib/src/demo → demo}/index.html +11 -11
- package/{lib/src/demo → demo}/main.scss +23 -21
- package/{lib/src/demo/main.tsx → demo/main.ts} +324 -323
- package/demo/package.json +26 -0
- package/demo/scss.d.ts +4 -0
- package/demo/svg.d.ts +1 -0
- package/demo/tsconfig.json +14 -0
- package/lib/README.txt +20 -15
- package/lib/cjs/x4.css +1 -1
- package/lib/cjs/x4.js +2 -1
- package/lib/esm/x4.css +1 -1
- package/lib/esm/x4.mjs +2 -1
- package/lib/src/components/base.scss +25 -26
- package/lib/src/components/boxes/boxes.module.scss +54 -37
- package/lib/src/components/boxes/boxes.ts +278 -125
- package/lib/src/components/breadcrumb/breadcrumb.scss +56 -0
- package/lib/src/components/breadcrumb/breadcrumb.ts +93 -0
- package/lib/src/components/breadcrumb/chevron-right.svg +1 -0
- package/lib/src/components/btngroup/btngroup.module.scss +40 -28
- package/lib/src/components/btngroup/btngroup.ts +152 -101
- package/lib/src/components/button/button.module.scss +172 -153
- package/lib/src/components/button/button.ts +185 -117
- package/lib/src/components/calendar/calendar.module.scss +162 -162
- package/lib/src/components/calendar/calendar.ts +326 -325
- package/lib/src/components/canvas/canvas.module.scss +25 -0
- package/lib/src/components/canvas/canvas.ts +189 -0
- package/lib/src/components/canvas/canvas_ex.ts +269 -0
- package/lib/src/components/checkbox/check.svg +3 -3
- package/lib/src/components/checkbox/checkbox.module.scss +141 -141
- package/lib/src/components/checkbox/checkbox.ts +139 -124
- package/lib/src/components/colorinput/colorinput.module.scss +64 -64
- package/lib/src/components/colorinput/colorinput.ts +90 -87
- package/lib/src/components/colorpicker/colorpicker.module.scss +132 -132
- package/lib/src/components/colorpicker/colorpicker.ts +481 -476
- package/lib/src/components/combobox/combobox.module.scss +132 -120
- package/lib/src/components/combobox/combobox.ts +275 -190
- package/lib/src/components/combobox/updown.svg +3 -3
- package/lib/src/components/components.ts +41 -0
- package/lib/src/components/dialog/dialog.module.scss +105 -71
- package/lib/src/components/dialog/dialog.ts +212 -92
- package/lib/src/components/filedrop/cloud-arrow-up.svg +1 -0
- package/lib/src/components/filedrop/filedrop.module.scss +70 -0
- package/lib/src/components/filedrop/filedrop.ts +131 -0
- package/lib/src/components/form/form.module.scss +38 -34
- package/lib/src/components/form/form.ts +172 -36
- package/lib/src/components/gridview/arrow-down-light.svg +1 -0
- package/lib/src/components/gridview/arrow-up-light.svg +1 -0
- package/lib/src/components/gridview/gridview.module.scss +324 -0
- package/lib/src/components/gridview/gridview.ts +1175 -0
- package/lib/src/components/header/header.module.scss +39 -39
- package/lib/src/components/header/header.ts +129 -123
- package/lib/src/components/icon/icon.module.scss +30 -30
- package/lib/src/components/icon/icon.ts +139 -134
- package/lib/src/components/image/image.module.scss +27 -20
- package/lib/src/components/image/image.ts +168 -67
- package/lib/src/components/input/input.module.scss +74 -69
- package/lib/src/components/input/input.ts +398 -274
- package/lib/src/components/keyboard/arrow-up.svg +1 -0
- package/lib/src/components/keyboard/delete-left.svg +1 -0
- package/lib/src/components/keyboard/eye-slash.svg +1 -0
- package/lib/src/components/keyboard/keyboard.module.scss +134 -0
- package/lib/src/components/keyboard/keyboard.ts +525 -0
- package/lib/src/components/label/label.module.scss +76 -52
- package/lib/src/components/label/label.ts +97 -55
- package/lib/src/components/link/link.ts +81 -0
- package/lib/src/components/listbox/listbox.module.scss +161 -103
- package/lib/src/components/listbox/listbox.ts +539 -427
- package/lib/src/components/menu/menu.module.scss +116 -107
- package/lib/src/components/menu/menu.ts +174 -168
- package/lib/src/components/messages/messages.module.scss +92 -47
- package/lib/src/components/messages/messages.ts +215 -64
- package/lib/src/components/messages/pen-field.svg +1 -0
- package/lib/src/components/normalize.scss +391 -386
- package/lib/src/components/notification/notification.module.scss +83 -81
- package/lib/src/components/notification/notification.ts +107 -108
- package/lib/src/components/panel/panel.module.scss +59 -47
- package/lib/src/components/panel/panel.ts +57 -56
- package/lib/src/components/popup/popup.module.scss +45 -43
- package/lib/src/components/popup/popup.ts +440 -395
- package/lib/src/components/progress/progress.module.scss +56 -56
- package/lib/src/components/progress/progress.ts +43 -42
- package/lib/src/components/propgrid/folder-closed.svg +1 -0
- package/lib/src/components/propgrid/folder-open.svg +1 -0
- package/lib/src/components/propgrid/progrid.module.scss +108 -0
- package/lib/src/components/propgrid/propgrid.ts +271 -0
- package/lib/src/components/propgrid/updown.svg +4 -0
- package/lib/src/components/radio/radio.module.scss +147 -0
- package/lib/src/components/radio/radio.svg +4 -0
- package/lib/src/components/radio/radio.ts +142 -0
- package/lib/src/components/rating/rating.module.scss +22 -22
- package/lib/src/components/rating/rating.ts +131 -125
- package/lib/src/components/select/select.module.scss +9 -0
- package/lib/src/components/select/select.ts +134 -0
- package/lib/src/components/shared.scss +137 -76
- package/lib/src/components/sizers/sizer.module.scss +89 -89
- package/lib/src/components/sizers/sizer.ts +130 -119
- package/lib/src/components/slider/slider.module.scss +117 -70
- package/lib/src/components/slider/slider.ts +197 -142
- package/lib/src/components/switch/switch.module.scss +126 -126
- package/lib/src/components/switch/switch.ts +61 -55
- package/lib/src/components/tabs/tabs.module.scss +45 -46
- package/lib/src/components/tabs/tabs.ts +199 -157
- package/lib/src/components/textarea/textarea.module.scss +63 -59
- package/lib/src/components/textarea/textarea.ts +125 -54
- package/lib/src/components/textedit/textedit.module.scss +115 -113
- package/lib/src/components/textedit/textedit.ts +110 -82
- package/lib/src/components/themes.scss +88 -77
- package/lib/src/components/tickline/tickline.module.scss +26 -0
- package/lib/src/components/tickline/tickline.ts +82 -0
- package/lib/src/components/tooltips/comments-question.svg +1 -0
- package/lib/src/components/tooltips/tooltips.scss +71 -50
- package/lib/src/components/tooltips/tooltips.ts +108 -102
- package/lib/src/components/treeview/treeview.module.scss +184 -115
- package/lib/src/components/treeview/treeview.ts +445 -403
- package/lib/src/components/viewport/viewport.module.scss +31 -24
- package/lib/src/components/viewport/viewport.ts +41 -38
- package/lib/src/core/component.ts +1072 -979
- package/lib/src/core/core_application.ts +264 -0
- package/lib/src/core/core_colors.ts +249 -249
- package/lib/src/core/core_data.ts +1309 -0
- package/lib/src/core/core_dom.ts +471 -471
- package/lib/src/core/core_dragdrop.ts +200 -200
- package/lib/src/core/core_element.ts +109 -97
- package/lib/src/core/core_events.ts +177 -149
- package/lib/src/core/core_i18n.ts +393 -377
- package/lib/src/core/core_react.ts +79 -0
- package/lib/src/core/core_router.ts +237 -221
- package/lib/src/core/core_styles.ts +214 -214
- package/lib/src/core/core_svg.ts +711 -550
- package/lib/src/core/core_tools.ts +906 -673
- package/lib/src/types/scss.d.ts +4 -4
- package/lib/src/types/x4react.d.ts +8 -8
- package/lib/src/x4.scss +18 -18
- package/lib/src/x4.ts +31 -62
- package/lib/src/x4tsx.d.ts +25 -0
- package/lib/styles/x4.css +1 -1
- package/lib/types/x4js.d.ts +853 -127
- package/package.json +5 -6
- package/scripts/build.mjs +378 -0
- package/scripts/prepack.mjs +346 -0
- package/src/components/base.scss +25 -0
- package/src/components/boxes/boxes.module.scss +54 -0
- package/src/components/boxes/boxes.ts +278 -0
- package/src/components/breadcrumb/breadcrumb.scss +56 -0
- package/src/components/breadcrumb/breadcrumb.ts +93 -0
- package/src/components/breadcrumb/chevron-right.svg +1 -0
- package/src/components/btngroup/btngroup.module.scss +41 -0
- package/src/components/btngroup/btngroup.ts +153 -0
- package/src/components/button/button.module.scss +173 -0
- package/src/components/button/button.ts +185 -0
- package/src/components/calendar/calendar-check-sharp-light.svg +1 -0
- package/src/components/calendar/calendar.module.scss +163 -0
- package/src/components/calendar/calendar.ts +327 -0
- package/src/components/calendar/chevron-left-sharp-light.svg +1 -0
- package/src/components/calendar/chevron-right-sharp-light.svg +1 -0
- package/src/components/canvas/canvas.module.scss +25 -0
- package/src/components/canvas/canvas.ts +189 -0
- package/src/components/canvas/canvas_ex.ts +269 -0
- package/src/components/checkbox/check.svg +4 -0
- package/src/components/checkbox/checkbox.module.scss +142 -0
- package/src/components/checkbox/checkbox.ts +140 -0
- package/src/components/colorinput/colorinput.module.scss +65 -0
- package/src/components/colorinput/colorinput.ts +91 -0
- package/src/components/colorinput/crosshairs-simple-sharp-light.svg +1 -0
- package/src/components/colorpicker/colorpicker.module.scss +133 -0
- package/src/components/colorpicker/colorpicker.ts +482 -0
- package/src/components/combobox/combobox.module.scss +133 -0
- package/src/components/combobox/combobox.ts +275 -0
- package/src/components/combobox/updown.svg +4 -0
- package/src/components/components.ts +41 -0
- package/src/components/dialog/dialog.module.scss +105 -0
- package/src/components/dialog/dialog.ts +212 -0
- package/src/components/dialog/xmark-sharp-light.svg +1 -0
- package/src/components/filedrop/cloud-arrow-up.svg +1 -0
- package/src/components/filedrop/filedrop.module.scss +70 -0
- package/src/components/filedrop/filedrop.ts +131 -0
- package/src/components/form/form.module.scss +38 -0
- package/src/components/form/form.ts +172 -0
- package/src/components/gridview/arrow-down-light.svg +1 -0
- package/src/components/gridview/arrow-up-light.svg +1 -0
- package/src/components/gridview/gridview.module.scss +324 -0
- package/src/components/gridview/gridview.ts +1175 -0
- package/src/components/header/header.module.scss +40 -0
- package/src/components/header/header.ts +130 -0
- package/src/components/icon/icon.module.scss +30 -0
- package/src/components/icon/icon.ts +139 -0
- package/src/components/image/image.module.scss +28 -0
- package/src/components/image/image.ts +168 -0
- package/src/components/input/input.module.scss +74 -0
- package/src/components/input/input.ts +398 -0
- package/src/components/keyboard/arrow-up.svg +1 -0
- package/src/components/keyboard/delete-left.svg +1 -0
- package/src/components/keyboard/eye-slash.svg +1 -0
- package/src/components/keyboard/keyboard.module.scss +134 -0
- package/src/components/keyboard/keyboard.ts +525 -0
- package/src/components/label/label.module.scss +76 -0
- package/src/components/label/label.ts +97 -0
- package/src/components/link/link.ts +81 -0
- package/src/components/listbox/listbox.module.scss +161 -0
- package/src/components/listbox/listbox.ts +539 -0
- package/src/components/menu/caret-right-solid.svg +1 -0
- package/src/components/menu/menu.module.scss +117 -0
- package/src/components/menu/menu.ts +174 -0
- package/src/components/messages/circle-exclamation.svg +1 -0
- package/src/components/messages/messages.module.scss +92 -0
- package/src/components/messages/messages.ts +215 -0
- package/src/components/messages/pen-field.svg +1 -0
- package/src/components/normalize.scss +391 -0
- package/src/components/notification/circle-check-solid.svg +1 -0
- package/src/components/notification/circle-exclamation-solid.svg +1 -0
- package/src/components/notification/circle-notch-light.svg +1 -0
- package/src/components/notification/notification.module.scss +84 -0
- package/src/components/notification/notification.ts +107 -0
- package/src/components/notification/xmark-sharp-light.svg +1 -0
- package/src/components/panel/panel.module.scss +60 -0
- package/src/components/panel/panel.ts +58 -0
- package/src/components/popup/popup.module.scss +45 -0
- package/src/components/popup/popup.ts +440 -0
- package/src/components/progress/progress.module.scss +57 -0
- package/src/components/progress/progress.ts +44 -0
- package/src/components/propgrid/folder-closed.svg +1 -0
- package/src/components/propgrid/folder-open.svg +1 -0
- package/src/components/propgrid/progrid.module.scss +108 -0
- package/src/components/propgrid/propgrid.ts +271 -0
- package/src/components/propgrid/updown.svg +4 -0
- package/src/components/radio/radio.module.scss +147 -0
- package/src/components/radio/radio.svg +4 -0
- package/src/components/radio/radio.ts +142 -0
- package/src/components/rating/rating.module.scss +23 -0
- package/src/components/rating/rating.ts +131 -0
- package/src/components/rating/star-sharp-light.svg +1 -0
- package/src/components/rating/star-sharp-solid.svg +1 -0
- package/src/components/select/select.module.scss +9 -0
- package/src/components/select/select.ts +134 -0
- package/src/components/shared.scss +137 -0
- package/src/components/sizers/sizer.module.scss +90 -0
- package/src/components/sizers/sizer.ts +131 -0
- package/src/components/slider/slider.module.scss +118 -0
- package/src/components/slider/slider.ts +198 -0
- package/src/components/switch/switch.module.scss +127 -0
- package/src/components/switch/switch.ts +62 -0
- package/src/components/tabs/tabs.module.scss +45 -0
- package/src/components/tabs/tabs.ts +199 -0
- package/src/components/textarea/textarea.module.scss +63 -0
- package/src/components/textarea/textarea.ts +125 -0
- package/src/components/textedit/textedit.module.scss +116 -0
- package/src/components/textedit/textedit.ts +110 -0
- package/src/components/themes.scss +88 -0
- package/src/components/tickline/tickline.module.scss +26 -0
- package/src/components/tickline/tickline.ts +82 -0
- package/src/components/tooltips/circle-info-sharp-light.svg +1 -0
- package/src/components/tooltips/comments-question.svg +1 -0
- package/src/components/tooltips/tooltips.scss +72 -0
- package/src/components/tooltips/tooltips.ts +109 -0
- package/src/components/treeview/chevron-down-light.svg +1 -0
- package/src/components/treeview/treeview.module.scss +185 -0
- package/src/components/treeview/treeview.ts +445 -0
- package/src/components/viewport/viewport.module.scss +32 -0
- package/src/components/viewport/viewport.ts +41 -0
- package/src/core/component.ts +1072 -0
- package/src/core/core_application.ts +264 -0
- package/src/core/core_colors.ts +250 -0
- package/src/core/core_data.ts +1309 -0
- package/src/core/core_dom.ts +471 -0
- package/src/core/core_dragdrop.ts +201 -0
- package/src/core/core_element.ts +110 -0
- package/src/core/core_events.ts +177 -0
- package/src/core/core_i18n.ts +393 -0
- package/src/core/core_react.ts +79 -0
- package/src/core/core_router.ts +237 -0
- package/src/core/core_styles.ts +214 -0
- package/src/core/core_svg.ts +711 -0
- package/src/core/core_tools.ts +906 -0
- package/src/types/scss.d.ts +4 -0
- package/src/types/svg.d.ts +1 -0
- package/src/types/x4react.d.ts +9 -0
- package/src/x4.scss +19 -0
- package/src/x4.ts +31 -62
- package/src/x4tsx.d.ts +25 -0
- package/tsconfig.json +14 -0
- /package/{lib/src/demo → demo}/assets/house-light.svg +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file popup.module.scss
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
*
|
|
11
|
+
* @copyright (c) 2024 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* Use of this source code is governed by an MIT-style license
|
|
14
|
+
* that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
|
15
|
+
**/
|
|
16
|
+
|
|
17
|
+
:root {
|
|
18
|
+
--modal-mask-background: rgb(0 0 0 / 60% );
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.x4popup {
|
|
22
|
+
position: absolute !important;
|
|
23
|
+
background-color: var(--fill-color);
|
|
24
|
+
border: 1px solid var(--border-color);
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
z-index: 1000;
|
|
27
|
+
border-radius: var(--bradius);
|
|
28
|
+
|
|
29
|
+
&.popup-caption,
|
|
30
|
+
.popup-caption {
|
|
31
|
+
cursor: move;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
::backdrop,
|
|
36
|
+
.x4modal-mask {
|
|
37
|
+
background-color: var( --modal-mask-background );
|
|
38
|
+
backdrop-filter: blur(8px);
|
|
39
|
+
position: absolute;
|
|
40
|
+
left: 0;
|
|
41
|
+
top: 0;
|
|
42
|
+
right: 0;
|
|
43
|
+
bottom: 0;
|
|
44
|
+
z-index: 1000;
|
|
45
|
+
}
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file popup.ts
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
*
|
|
11
|
+
* @copyright (c) 2024 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* Use of this source code is governed by an MIT-style license
|
|
14
|
+
* that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
|
15
|
+
**/
|
|
16
|
+
|
|
17
|
+
import { Component, ComponentEvent, ComponentEvents, ComponentProps, componentFromDOM, makeUniqueComponentId } from "../../core/component"
|
|
18
|
+
|
|
19
|
+
import { CSizer } from '../sizers/sizer';
|
|
20
|
+
import { Rect, Point, class_ns, asap } from '../../core/core_tools.js';
|
|
21
|
+
import { Box } from '../boxes/boxes'
|
|
22
|
+
|
|
23
|
+
import "./popup.module.scss"
|
|
24
|
+
|
|
25
|
+
export interface PopupEvents extends ComponentEvents {
|
|
26
|
+
closed: ComponentEvent;
|
|
27
|
+
opened: ComponentEvent;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface PopupProps extends ComponentProps {
|
|
31
|
+
autoClose?: boolean | string;
|
|
32
|
+
sizable?: boolean;
|
|
33
|
+
movable?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let autoclose_list: Popup[] = [];
|
|
37
|
+
let popup_list: Popup[] = [];
|
|
38
|
+
|
|
39
|
+
let modal_stack: Popup[] = [];
|
|
40
|
+
let modal_mask: Component;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function getRoot( ) {
|
|
44
|
+
return document.body;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
@class_ns( "x4" )
|
|
52
|
+
export class Popup<P extends PopupProps = PopupProps, E extends PopupEvents = PopupEvents> extends Box<P,E> {
|
|
53
|
+
|
|
54
|
+
private _isshown = false;
|
|
55
|
+
protected _ismodal = false;
|
|
56
|
+
|
|
57
|
+
constructor( props: P ) {
|
|
58
|
+
super( props );
|
|
59
|
+
|
|
60
|
+
if( this.props.sizable ) {
|
|
61
|
+
this._createSizers( );
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// wait for element to create it's childs
|
|
65
|
+
asap( ( ) => {
|
|
66
|
+
if( this.props.movable===true || (this.props.sizable && this.props.movable===undefined) ) {
|
|
67
|
+
const movers = this.queryAll( ".caption-element" );
|
|
68
|
+
movers.forEach( m => new CMover(m,this) );
|
|
69
|
+
|
|
70
|
+
if( this.hasClass("popup-caption") ) {
|
|
71
|
+
new CMover(this,this);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
} );
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
displayNear( rc: Rect, dst = "top left", src = "top left", offset = {x:0,y:0} ) {
|
|
82
|
+
|
|
83
|
+
this.setStyle( { left: "0px", top: "0px" } ); // avoid scrollbar
|
|
84
|
+
this._do_show( ); // to compute size
|
|
85
|
+
|
|
86
|
+
let rm = this.getBoundingRect();
|
|
87
|
+
|
|
88
|
+
let xref = rc.left;
|
|
89
|
+
let yref = rc.top;
|
|
90
|
+
|
|
91
|
+
if( src.indexOf('right')>=0 ) {
|
|
92
|
+
xref = (rc.left+rc.width);
|
|
93
|
+
}
|
|
94
|
+
else if( src.indexOf('center')>=0 ) {
|
|
95
|
+
xref = rc.left + rc.width/2;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if( src.indexOf('bottom')>=0 ) {
|
|
99
|
+
yref = rc.bottom;
|
|
100
|
+
}
|
|
101
|
+
else if( src.indexOf('middle')>=0 ) {
|
|
102
|
+
yref = rc.top + rc.height/2;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (dst.indexOf('right') >= 0) {
|
|
106
|
+
xref -= rm.width;
|
|
107
|
+
}
|
|
108
|
+
else if( dst.indexOf('center')>=0 ) {
|
|
109
|
+
xref -= rm.width/2;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (dst.indexOf('bottom') >= 0) {
|
|
113
|
+
yref -= rm.height;
|
|
114
|
+
}
|
|
115
|
+
else if( dst.indexOf('middle')>=0 ) {
|
|
116
|
+
yref -= rm.height/2;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (offset) {
|
|
120
|
+
xref += offset.x;
|
|
121
|
+
yref += offset.y;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// our parent is body, so take care of the scroll position
|
|
125
|
+
xref += document.scrollingElement.scrollLeft;
|
|
126
|
+
yref += document.scrollingElement.scrollTop;
|
|
127
|
+
|
|
128
|
+
this.displayAt( xref, yref );
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
*
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
displayCenter( ) {
|
|
136
|
+
this.displayNear( new Rect( window.innerWidth/2, window.innerHeight/2, 0, 0 ), "center middle" );
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
displayAt( x: number, y: number ) {
|
|
144
|
+
//TODO: check is already visible
|
|
145
|
+
this.setStyle( {
|
|
146
|
+
left: x+"px",
|
|
147
|
+
top: y+"px",
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
this._do_show( ); // to compute size
|
|
151
|
+
|
|
152
|
+
const rc = this.getBoundingRect( );
|
|
153
|
+
const width = window.innerWidth - 16;
|
|
154
|
+
const height = window.innerHeight - 16;
|
|
155
|
+
|
|
156
|
+
if( rc.right>width ) {
|
|
157
|
+
this.setStyleValue( "left", width-rc.width );
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if( rc.bottom>height ) {
|
|
161
|
+
this.setStyleValue( "top", height-rc.height );
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
isOpen( ) {
|
|
166
|
+
return this._isshown;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
protected _do_hide( ) {
|
|
170
|
+
|
|
171
|
+
if( !this._isshown ) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
this.__hide( );
|
|
176
|
+
this.__remove( );
|
|
177
|
+
|
|
178
|
+
if( this._ismodal ) {
|
|
179
|
+
modal_stack.pop( );
|
|
180
|
+
this._hideModalMask( );
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// remove from popup list
|
|
184
|
+
const idx = popup_list.indexOf( this );
|
|
185
|
+
console.assert( idx>=0 );
|
|
186
|
+
popup_list.splice( idx, 1 );
|
|
187
|
+
|
|
188
|
+
// remove from auto close list
|
|
189
|
+
if( this.props.autoClose ) {
|
|
190
|
+
const idx = autoclose_list.indexOf( this );
|
|
191
|
+
if( idx>=0 ) {
|
|
192
|
+
autoclose_list.splice( idx, 1 );
|
|
193
|
+
if( autoclose_list.length==0 ) {
|
|
194
|
+
document.removeEventListener( "pointerdown", this._dismiss );
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
this._isshown = false;
|
|
200
|
+
this.fire( "closed", {} );
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
*
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
protected _do_show( ) {
|
|
208
|
+
if( this._isshown ) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
this._isshown = true;
|
|
213
|
+
this.__append( );
|
|
214
|
+
|
|
215
|
+
if( this._ismodal ) {
|
|
216
|
+
modal_stack.push( this );
|
|
217
|
+
this._showModalMask( );
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
this.__show( );
|
|
221
|
+
|
|
222
|
+
if( this.props.autoClose ) {
|
|
223
|
+
if( autoclose_list.length==0 ) {
|
|
224
|
+
document.addEventListener( "pointerdown", this._dismiss );
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
autoclose_list.push( this );
|
|
228
|
+
this.setData( "close", this.props.autoClose===true ? makeUniqueComponentId() : this.props.autoClose );
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
popup_list.push( this );
|
|
232
|
+
|
|
233
|
+
this.fire( "opened", {} );
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
*
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
protected __show( ) {
|
|
241
|
+
super.show( true );
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
protected __hide( ) {
|
|
245
|
+
super.show( false );
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
protected __append( ) {
|
|
249
|
+
const root = getRoot( );
|
|
250
|
+
root.appendChild( this.dom );
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
protected __remove( ) {
|
|
254
|
+
const root = getRoot( );
|
|
255
|
+
root.removeChild( this.dom );
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
*
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
override show( show = true ) : this {
|
|
263
|
+
if( show ) {
|
|
264
|
+
this.displayCenter( );
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
this._do_hide( );
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return this;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
*
|
|
275
|
+
*/
|
|
276
|
+
|
|
277
|
+
close( ) {
|
|
278
|
+
this._do_hide( );
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* binded
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
private _dismiss = ( e: UIEvent ) => {
|
|
286
|
+
const onac = autoclose_list.some( x=> x.dom.contains(e.target as Node) )
|
|
287
|
+
if( onac ) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
e.preventDefault( );
|
|
292
|
+
e.stopPropagation( );
|
|
293
|
+
|
|
294
|
+
this.dismiss( );
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* dismiss all popup belonging to the same group as 'this'
|
|
299
|
+
*/
|
|
300
|
+
|
|
301
|
+
dismiss( after = false ) {
|
|
302
|
+
|
|
303
|
+
if( autoclose_list.length==0 ) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const cgroup = this.getData( "close" );
|
|
308
|
+
const inc_group: Popup[] = [];
|
|
309
|
+
const excl_group: Popup[] = [];
|
|
310
|
+
|
|
311
|
+
let aidx = -1;
|
|
312
|
+
if( after ) {
|
|
313
|
+
aidx = autoclose_list.indexOf( this );
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
autoclose_list.forEach( (x,idx) => {
|
|
317
|
+
const group = x.getData( "close" );
|
|
318
|
+
if( group==cgroup && idx>aidx) {
|
|
319
|
+
inc_group.push( x );
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
excl_group.push( x );
|
|
323
|
+
}
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
const list = inc_group.reverse( );
|
|
327
|
+
autoclose_list = excl_group;
|
|
328
|
+
if( autoclose_list.length==0 ) {
|
|
329
|
+
document.removeEventListener( "pointerdown", this._dismiss );
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
list.forEach( x => x.close() );
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
*
|
|
337
|
+
*/
|
|
338
|
+
|
|
339
|
+
private _createSizers( ) {
|
|
340
|
+
this.appendContent( [
|
|
341
|
+
new CSizer( "top" ),
|
|
342
|
+
new CSizer( "bottom" ),
|
|
343
|
+
new CSizer( "left" ),
|
|
344
|
+
new CSizer( "right" ),
|
|
345
|
+
new CSizer( "top-left" ),
|
|
346
|
+
new CSizer( "bottom-left" ),
|
|
347
|
+
new CSizer( "top-right" ),
|
|
348
|
+
new CSizer( "bottom-right" ),
|
|
349
|
+
])
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
private _showModalMask( ) {
|
|
353
|
+
if( !modal_mask ) {
|
|
354
|
+
modal_mask = new Component( { cls: 'x4modal-mask' } )
|
|
355
|
+
//document.body.appendChild( modal_mask.dom );
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const root = getRoot( );
|
|
359
|
+
root.insertBefore( modal_mask.dom, this.dom );
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
private _hideModalMask( ) {
|
|
363
|
+
if( modal_mask ) {
|
|
364
|
+
const root = getRoot( );
|
|
365
|
+
if( modal_stack.length ) {
|
|
366
|
+
const top = modal_stack[ modal_stack.length-1 ];
|
|
367
|
+
root.insertBefore( modal_mask.dom, top.dom );
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
root.removeChild( modal_mask.dom );
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
*
|
|
379
|
+
*/
|
|
380
|
+
|
|
381
|
+
export
|
|
382
|
+
class CMover {
|
|
383
|
+
private ref: Component;
|
|
384
|
+
private delta: Point;
|
|
385
|
+
private self: boolean;
|
|
386
|
+
|
|
387
|
+
constructor( x: Component, ref?: Component ) {
|
|
388
|
+
|
|
389
|
+
this.self = ref ? true : false;
|
|
390
|
+
|
|
391
|
+
x.addDOMEvent( "pointerdown", ( e: PointerEvent ) => {
|
|
392
|
+
if( this.self && e.target!=x.dom ) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
x.setCapture( e.pointerId );
|
|
397
|
+
|
|
398
|
+
this.ref = ref ?? componentFromDOM( x.dom.parentElement );
|
|
399
|
+
|
|
400
|
+
this.delta = {x:0,y:0};
|
|
401
|
+
const rc = this.ref.getBoundingRect();
|
|
402
|
+
|
|
403
|
+
this.delta.x = e.pageX-rc.left;
|
|
404
|
+
this.delta.y = e.pageY-rc.top;
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
x.addDOMEvent( "pointerup", ( e: PointerEvent ) => {
|
|
408
|
+
x.releaseCapture( e.pointerId );
|
|
409
|
+
this.ref = null;
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
x.addDOMEvent( "pointermove", ( e: PointerEvent ) => {
|
|
413
|
+
this._onMouseMove( e );
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
private _onMouseMove( e: PointerEvent ) {
|
|
418
|
+
if( !this.ref ) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
const pt = { x: e.pageX-this.delta.x, y: e.pageY-this.delta.y };
|
|
423
|
+
const rc = this.ref.getBoundingRect( );
|
|
424
|
+
|
|
425
|
+
let nr: any = {
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
this.ref.setStyle( {
|
|
429
|
+
top: pt.y+"",
|
|
430
|
+
left: pt.x+"",
|
|
431
|
+
} );
|
|
432
|
+
|
|
433
|
+
e.preventDefault( );
|
|
434
|
+
e.stopPropagation( );
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file progress.module.scss
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
*
|
|
11
|
+
* @copyright (c) 2024 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* Use of this source code is governed by an MIT-style license
|
|
14
|
+
* that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
|
15
|
+
**/
|
|
16
|
+
|
|
17
|
+
:root {
|
|
18
|
+
--progress-background: var( --border );
|
|
19
|
+
--progress-color: var( --accent-background );
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.x4progress {
|
|
23
|
+
background-color: var( --progress-background );
|
|
24
|
+
position: relative;
|
|
25
|
+
height: 6px;
|
|
26
|
+
margin: 0 5px;
|
|
27
|
+
border-radius: 3px;
|
|
28
|
+
|
|
29
|
+
.bar {
|
|
30
|
+
position: absolute;
|
|
31
|
+
left: 0;
|
|
32
|
+
top: 0;
|
|
33
|
+
bottom: 0;
|
|
34
|
+
width: 0;
|
|
35
|
+
|
|
36
|
+
background-color: var( --progress-color );
|
|
37
|
+
border-radius: 3px;
|
|
38
|
+
|
|
39
|
+
transition: width ease 0.2s;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.indeterm .bar {
|
|
43
|
+
background-image: linear-gradient(45deg,hsla(0,0%,100%,.15) 25%,transparent 0,transparent 50%,hsla(0,0%,100%,.15) 0,hsla(0,0%,100%,.15) 75%,transparent 0,transparent);
|
|
44
|
+
background-size: 20px 20px;
|
|
45
|
+
animation: slide 1s linear infinite;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes slide {
|
|
50
|
+
0% {
|
|
51
|
+
background-position: 0 0
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
to {
|
|
55
|
+
background-position: 2.5rem 0
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file progress.ts
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
*
|
|
11
|
+
* @copyright (c) 2024 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* Use of this source code is governed by an MIT-style license
|
|
14
|
+
* that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
|
15
|
+
**/
|
|
16
|
+
|
|
17
|
+
import { class_ns } from '@core/core_tools.js';
|
|
18
|
+
import { Component, ComponentProps } from '../../core/component';
|
|
19
|
+
|
|
20
|
+
import "./progress.module.scss";
|
|
21
|
+
|
|
22
|
+
interface ProgressProps extends ComponentProps {
|
|
23
|
+
value: number;
|
|
24
|
+
min: number;
|
|
25
|
+
max: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@class_ns( "x4" )
|
|
29
|
+
export class Progress extends Component<ProgressProps> {
|
|
30
|
+
|
|
31
|
+
private _bar: Component;
|
|
32
|
+
|
|
33
|
+
constructor( props: ProgressProps ) {
|
|
34
|
+
super( props );
|
|
35
|
+
|
|
36
|
+
this.setContent( this._bar=new Component( { cls: "bar" } ) );
|
|
37
|
+
this.setValue( props.value );
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
setValue( value: number ) {
|
|
41
|
+
const perc = value / (this.props.max-this.props.min) * 100;
|
|
42
|
+
this._bar.setStyleValue( "width", perc+"%" );
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Pro 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path class="fa-secondary" opacity=".4" d="M32 224l448 0 0 224L32 448l0-224z"/><path class="fa-primary" d="M32 32l192 0 48 64 208 0 32 0 0 32 0 320 0 32-32 0L32 480 0 480l0-32L0 64 0 32l32 0zm240 96l-16 0-9.6-12.8L208 64 32 64l0 128 448 0 0-64-208 0zM32 224l0 224 448 0 0-224L32 224z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Pro 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path class="fa-secondary" opacity=".4" d="M32 64l0 280.4L108.2 192 448 192l0-64-176 0-13.3 0-9.4-9.4L194.7 64 32 64zM51.8 448L384 448l44.2 0 96-192-376.4 0-96 192z"/><path class="fa-primary" d="M272 96L208 32 32 32 0 32 0 64 0 448l0 32 32 0 3.8 0L384 480l64 0L560 256l16-32-35.8 0L128 224 32 416 32 64l162.7 0 54.6 54.6 9.4 9.4 13.3 0 176 0 0 64 32 0 0-64 0-32-32 0L272 96zM51.8 448l96-192 376.4 0-96 192L384 448 51.8 448z"/></svg>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file progrid.module.scss
|
|
3
|
+
* @author Etienne Cochard
|
|
4
|
+
* @copyright (c) 2025 InCare
|
|
5
|
+
**/
|
|
6
|
+
|
|
7
|
+
:root {
|
|
8
|
+
--propertygrid-background: white;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.x4propertygrid {
|
|
12
|
+
background: var( --propertygrid-background );
|
|
13
|
+
border: 1px solid var(--color-primary-a50);
|
|
14
|
+
overflow-y: auto;
|
|
15
|
+
flex-basis: 0;
|
|
16
|
+
|
|
17
|
+
.root {
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-template-columns: 1fr;
|
|
20
|
+
grid-template-rows: auto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.group {
|
|
24
|
+
padding: 6px 4px 4px 4px;
|
|
25
|
+
min-height: 2em;
|
|
26
|
+
font-weight: bold;
|
|
27
|
+
background-color: white;
|
|
28
|
+
color: var(--color-primary-a50);
|
|
29
|
+
|
|
30
|
+
.x4box > .desc {
|
|
31
|
+
font-style: italic;
|
|
32
|
+
font-weight: normal;
|
|
33
|
+
font-size: 90%;
|
|
34
|
+
color: var( --text-ternary );
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:not(:first-child ) {
|
|
38
|
+
border-top: 1px solid var(--color-primary-a50);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:not( :last-child ) {
|
|
42
|
+
border-bottom: 1px solid var(--color-primary-a50);
|
|
43
|
+
box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
padding-left: 8px;
|
|
49
|
+
gap: 8px;
|
|
50
|
+
|
|
51
|
+
&>.x4box {
|
|
52
|
+
flex-grow: 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&>.x4icon {
|
|
56
|
+
.fa-secondary,
|
|
57
|
+
.fa-primary {
|
|
58
|
+
fill: var( --color-primary-a50 );
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
width: 1em;
|
|
62
|
+
height: 1em;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&>.x4button {
|
|
66
|
+
background-color: transparent;
|
|
67
|
+
color: var(--color-primary-a50);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.row {
|
|
72
|
+
border-bottom: 1px solid var( --border-light );
|
|
73
|
+
//border-top: none;
|
|
74
|
+
//border-left: 1px solid var(--color-primary-a50);
|
|
75
|
+
//border-right: 1px solid var(--color-primary-a50);
|
|
76
|
+
|
|
77
|
+
&:has(:focus) {
|
|
78
|
+
background-color: var(--color-primary-a20);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&:hover {
|
|
82
|
+
background-color: var(--color-primary-a10);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.cell {
|
|
86
|
+
flex-grow: 1;
|
|
87
|
+
flex-basis: 10px;
|
|
88
|
+
padding: 4px;
|
|
89
|
+
|
|
90
|
+
&>* {
|
|
91
|
+
width: 100%;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
input {
|
|
95
|
+
background: rgba(255,255,255,0.6);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.cell:first-child {
|
|
100
|
+
border-right: 1px solid var( --border );
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.hdr {
|
|
104
|
+
padding: 8px;
|
|
105
|
+
padding-left: 34px;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|