@quandis/qbo4.ui 4.0.1-CI-20240919-212536 → 4.0.1-CI-20240925-135339
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/package.json +2 -2
- package/readme.md +1 -1
- package/src/qbo/Program.d.ts +1 -0
- package/src/qbo/Program.js +1 -0
- package/src/qbo/Program.ts +1 -0
- package/src/qbo/qbo-resize.d.ts +22 -0
- package/src/qbo/qbo-resize.js +108 -0
- package/src/qbo/qbo-resize.ts +103 -0
- package/wwwroot/js/qbo4.ui-code.js +40 -36
- package/wwwroot/js/qbo4.ui-code.min.js +1 -1
- package/wwwroot/js/qbo4.ui-code.min.js.map +1 -1
- package/wwwroot/js/qbo4.ui.js +361 -199
- package/wwwroot/js/qbo4.ui.min.js +29 -28
- package/wwwroot/js/qbo4.ui.min.js.LICENSE.txt +1 -1
- package/wwwroot/js/qbo4.ui.min.js.map +1 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Quandis, Inc.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "4.0.1-CI-
|
|
6
|
+
"version": "4.0.1-CI-20240925-135339",
|
|
7
7
|
"workspaces": [
|
|
8
8
|
"code"
|
|
9
9
|
],
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@codemirror/commands": "^6.5.0",
|
|
27
27
|
"@codemirror/lang-html": "^6.4.9",
|
|
28
28
|
"@joint/core": "^4.0.4",
|
|
29
|
-
"@quandis/qbo4.logging": "
|
|
29
|
+
"@quandis/qbo4.logging": "*",
|
|
30
30
|
"bootstrap": "^5.3.3",
|
|
31
31
|
"bootstrap-icons": "^1.11.3",
|
|
32
32
|
"codemirror": "6.0.1",
|
package/readme.md
CHANGED
package/src/qbo/Program.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './qbo-microphone.js';
|
|
|
17
17
|
export * from './qbo-popover.js';
|
|
18
18
|
export * from './qbo-popup.js';
|
|
19
19
|
export * from './qbo-popup-listener.js';
|
|
20
|
+
export * from './qbo-resize.js';
|
|
20
21
|
export * from './qbo-select.js';
|
|
21
22
|
export * from './qbo-table.js';
|
|
22
23
|
export * from './qbo-validate.js';
|
package/src/qbo/Program.js
CHANGED
|
@@ -18,6 +18,7 @@ export * from './qbo-microphone.js';
|
|
|
18
18
|
export * from './qbo-popover.js';
|
|
19
19
|
export * from './qbo-popup.js';
|
|
20
20
|
export * from './qbo-popup-listener.js';
|
|
21
|
+
export * from './qbo-resize.js';
|
|
21
22
|
export * from './qbo-select.js';
|
|
22
23
|
export * from './qbo-table.js';
|
|
23
24
|
export * from './qbo-validate.js';
|
package/src/qbo/Program.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from './qbo-microphone.js'
|
|
|
20
20
|
export * from './qbo-popover.js'
|
|
21
21
|
export * from './qbo-popup.js';
|
|
22
22
|
export * from './qbo-popup-listener.js';
|
|
23
|
+
export * from './qbo-resize.js';
|
|
23
24
|
export * from './qbo-select.js';
|
|
24
25
|
export * from './qbo-table.js';
|
|
25
26
|
export * from './qbo-validate.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare enum ResizeType {
|
|
3
|
+
Horizontal = "horizontal",
|
|
4
|
+
Vertical = "vertical"
|
|
5
|
+
}
|
|
6
|
+
export declare class QboResize extends LitElement {
|
|
7
|
+
static styles: import("lit").CSSResult;
|
|
8
|
+
private isResizing;
|
|
9
|
+
type: ResizeType;
|
|
10
|
+
private startX;
|
|
11
|
+
private startY;
|
|
12
|
+
private startWidth;
|
|
13
|
+
private startHeight;
|
|
14
|
+
private previous;
|
|
15
|
+
private next;
|
|
16
|
+
xcreateRenderRoot(): this;
|
|
17
|
+
connectedCallback(): void;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
clear(): void;
|
|
20
|
+
onMouseDown(event: MouseEvent): void;
|
|
21
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { LitElement, html, css } from 'lit';
|
|
11
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
12
|
+
export var ResizeType;
|
|
13
|
+
(function (ResizeType) {
|
|
14
|
+
ResizeType["Horizontal"] = "horizontal";
|
|
15
|
+
ResizeType["Vertical"] = "vertical";
|
|
16
|
+
})(ResizeType || (ResizeType = {}));
|
|
17
|
+
let QboResize = class QboResize extends LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.isResizing = false;
|
|
21
|
+
this.type = ResizeType.Horizontal;
|
|
22
|
+
this.startX = 0;
|
|
23
|
+
this.startY = 0;
|
|
24
|
+
this.startWidth = 0;
|
|
25
|
+
this.startHeight = 0;
|
|
26
|
+
this.previous = null;
|
|
27
|
+
this.next = null;
|
|
28
|
+
}
|
|
29
|
+
static { this.styles = css `
|
|
30
|
+
`; }
|
|
31
|
+
xcreateRenderRoot() {
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
super.connectedCallback();
|
|
36
|
+
this.classList.add(this.type === ResizeType.Horizontal ? 'horizontal' : 'vertical');
|
|
37
|
+
this.previous = this.previousElementSibling;
|
|
38
|
+
this.next = this.nextElementSibling;
|
|
39
|
+
this.addEventListener('mousedown', this.onMouseDown);
|
|
40
|
+
this.addEventListener('dblclick', this.clear);
|
|
41
|
+
document.addEventListener('qbo-reset', this.clear.bind(this));
|
|
42
|
+
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
super.disconnectedCallback();
|
|
45
|
+
this.removeEventListener('mousedown', this.onMouseDown);
|
|
46
|
+
this.removeEventListener('dblclick', this.clear);
|
|
47
|
+
document.removeEventListener('qbo-reset', this.clear.bind(this));
|
|
48
|
+
}
|
|
49
|
+
clear() {
|
|
50
|
+
this.next?.classList.toggle('qbo-resize', false);
|
|
51
|
+
this.previous.style.removeProperty('height');
|
|
52
|
+
this.previous.style.removeProperty('width');
|
|
53
|
+
this.next.style.removeProperty('height');
|
|
54
|
+
this.next.style.removeProperty('width');
|
|
55
|
+
}
|
|
56
|
+
onMouseDown(event) {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
this.isResizing = true;
|
|
59
|
+
this.startX = event.clientX;
|
|
60
|
+
this.startY = event.clientY;
|
|
61
|
+
//this.startWidth = this.leftElement?.offsetWidth || this.topElement?.offsetWidth || 0;
|
|
62
|
+
//this.startHeight = this.topElement?.offsetHeight || this.leftElement?.offsetHeight || 0;
|
|
63
|
+
this.startWidth = this.previous?.offsetWidth || 0;
|
|
64
|
+
this.startHeight = this.previous?.offsetHeight || 0;
|
|
65
|
+
const onMouseMove = (event) => {
|
|
66
|
+
if (this.isResizing) {
|
|
67
|
+
const deltaX = event.clientX - this.startX;
|
|
68
|
+
const deltaY = event.clientY - this.startY;
|
|
69
|
+
const newWidth = Math.max(this.startWidth + deltaX, 50);
|
|
70
|
+
const newHeight = Math.max(this.startHeight + deltaY, 50);
|
|
71
|
+
if (deltaX !== 0)
|
|
72
|
+
this.next?.classList.toggle('qbo-resize', true);
|
|
73
|
+
if (this.type === ResizeType.Vertical) {
|
|
74
|
+
this.previous.style.height = `${newHeight}px`;
|
|
75
|
+
this.next.style.height = `calc(100% - ${newHeight}px - ${this.offsetHeight}px)`;
|
|
76
|
+
// console.log('resized ', this.previous, this.previous?.style.height, this.next, this.next?.style.height);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.previous.style.width = `${newWidth}px`;
|
|
80
|
+
this.next.style.width = `calc(100% - ${newWidth}px - ${this.offsetWidth}px)`;
|
|
81
|
+
// console.log('resized ', this.previous, this.previous?.style.width, this.next, this.next?.style.width);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const onMouseUp = () => {
|
|
86
|
+
this.isResizing = false;
|
|
87
|
+
document.removeEventListener('mousemove', onMouseMove);
|
|
88
|
+
document.removeEventListener('mouseup', onMouseUp);
|
|
89
|
+
};
|
|
90
|
+
document.addEventListener('mousemove', onMouseMove);
|
|
91
|
+
document.addEventListener('mouseup', onMouseUp);
|
|
92
|
+
}
|
|
93
|
+
render() {
|
|
94
|
+
return html `<slot><span></span></slot>`;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
__decorate([
|
|
98
|
+
state(),
|
|
99
|
+
__metadata("design:type", Object)
|
|
100
|
+
], QboResize.prototype, "isResizing", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
property(),
|
|
103
|
+
__metadata("design:type", String)
|
|
104
|
+
], QboResize.prototype, "type", void 0);
|
|
105
|
+
QboResize = __decorate([
|
|
106
|
+
customElement('qbo-resize')
|
|
107
|
+
], QboResize);
|
|
108
|
+
export { QboResize };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { LitElement, html, css, svg } from 'lit';
|
|
2
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
export enum ResizeType {
|
|
5
|
+
Horizontal = 'horizontal',
|
|
6
|
+
Vertical = 'vertical'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@customElement('qbo-resize')
|
|
11
|
+
export class QboResize extends LitElement {
|
|
12
|
+
static styles = css`
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
@state()
|
|
16
|
+
private isResizing = false;
|
|
17
|
+
|
|
18
|
+
@property()
|
|
19
|
+
type: ResizeType = ResizeType.Horizontal;
|
|
20
|
+
|
|
21
|
+
private startX = 0;
|
|
22
|
+
private startY = 0;
|
|
23
|
+
private startWidth = 0;
|
|
24
|
+
private startHeight = 0;
|
|
25
|
+
private previous: HTMLElement | null = null;
|
|
26
|
+
private next: HTMLElement | null = null;
|
|
27
|
+
|
|
28
|
+
xcreateRenderRoot() {
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
super.connectedCallback();
|
|
34
|
+
this.classList.add(this.type === ResizeType.Horizontal ? 'horizontal' : 'vertical');
|
|
35
|
+
this.previous = this.previousElementSibling as HTMLElement;
|
|
36
|
+
this.next = this.nextElementSibling as HTMLElement;
|
|
37
|
+
this.addEventListener('mousedown', this.onMouseDown);
|
|
38
|
+
this.addEventListener('dblclick', this.clear);
|
|
39
|
+
document.addEventListener('qbo-reset', this.clear.bind(this));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
super.disconnectedCallback();
|
|
44
|
+
this.removeEventListener('mousedown', this.onMouseDown);
|
|
45
|
+
this.removeEventListener('dblclick', this.clear);
|
|
46
|
+
document.removeEventListener('qbo-reset', this.clear.bind(this));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
clear() {
|
|
50
|
+
this.next?.classList.toggle('qbo-resize', false);
|
|
51
|
+
|
|
52
|
+
this.previous!.style.removeProperty('height');
|
|
53
|
+
this.previous!.style.removeProperty('width');
|
|
54
|
+
this.next!.style.removeProperty('height');
|
|
55
|
+
this.next!.style.removeProperty('width');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
onMouseDown(event: MouseEvent) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
this.isResizing = true;
|
|
61
|
+
this.startX = event.clientX;
|
|
62
|
+
this.startY = event.clientY;
|
|
63
|
+
//this.startWidth = this.leftElement?.offsetWidth || this.topElement?.offsetWidth || 0;
|
|
64
|
+
//this.startHeight = this.topElement?.offsetHeight || this.leftElement?.offsetHeight || 0;
|
|
65
|
+
this.startWidth = this.previous?.offsetWidth || 0;
|
|
66
|
+
this.startHeight = this.previous?.offsetHeight || 0;
|
|
67
|
+
|
|
68
|
+
const onMouseMove = (event: MouseEvent) => {
|
|
69
|
+
if (this.isResizing) {
|
|
70
|
+
const deltaX = event.clientX - this.startX;
|
|
71
|
+
const deltaY = event.clientY - this.startY;
|
|
72
|
+
const newWidth = Math.max(this.startWidth + deltaX, 50);
|
|
73
|
+
const newHeight = Math.max(this.startHeight + deltaY, 50);
|
|
74
|
+
|
|
75
|
+
if (deltaX !== 0)
|
|
76
|
+
this.next?.classList.toggle('qbo-resize', true);
|
|
77
|
+
|
|
78
|
+
if (this.type === ResizeType.Vertical) {
|
|
79
|
+
this.previous!.style.height = `${newHeight}px`;
|
|
80
|
+
this.next!.style.height = `calc(100% - ${newHeight}px - ${this.offsetHeight}px)`;
|
|
81
|
+
// console.log('resized ', this.previous, this.previous?.style.height, this.next, this.next?.style.height);
|
|
82
|
+
} else {
|
|
83
|
+
this.previous!.style.width = `${newWidth}px`;
|
|
84
|
+
this.next!.style.width = `calc(100% - ${newWidth}px - ${this.offsetWidth}px)`;
|
|
85
|
+
// console.log('resized ', this.previous, this.previous?.style.width, this.next, this.next?.style.width);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const onMouseUp = () => {
|
|
91
|
+
this.isResizing = false;
|
|
92
|
+
document.removeEventListener('mousemove', onMouseMove);
|
|
93
|
+
document.removeEventListener('mouseup', onMouseUp);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
document.addEventListener('mousemove', onMouseMove);
|
|
97
|
+
document.addEventListener('mouseup', onMouseUp);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
render() {
|
|
101
|
+
return html`<slot><span></span></slot>`;
|
|
102
|
+
}
|
|
103
|
+
}
|