@dnncommunity/dnn-elements 0.13.1 → 0.14.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cjs/dnn-button.cjs.entry.js +1 -1
- package/dist/cjs/{dnn-button_14.cjs.entry.js → dnn-button_16.cjs.entry.js} +273 -38
- package/dist/cjs/dnn-button_16.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/dnn-chevron.cjs.entry.js +1 -1
- package/dist/cjs/dnn-collapsible.cjs.entry.js +1 -1
- package/dist/cjs/dnn-color-picker.cjs.entry.js +1 -1
- package/dist/cjs/dnn-dropzone.cjs.entry.js +1 -1
- package/dist/cjs/dnn-image-cropper.cjs.entry.js +7 -23
- package/dist/cjs/dnn-image-cropper.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-modal.cjs.entry.js +1 -1
- package/dist/cjs/dnn-searchbox.cjs.entry.js +1 -1
- package/dist/cjs/dnn-sort-icon.cjs.entry.js +1 -1
- package/dist/cjs/dnn-tab.cjs.entry.js +1 -1
- package/dist/cjs/dnn-tabs.cjs.entry.js +5 -3
- package/dist/cjs/dnn-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-toggle.cjs.entry.js +1 -1
- package/dist/cjs/dnn-treeview-item.cjs.entry.js +15 -13
- package/dist/cjs/dnn-treeview-item.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-vertical-overflow-menu.cjs.entry.js +123 -0
- package/dist/cjs/dnn-vertical-overflow-menu.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-vertical-splitview.cjs.entry.js +122 -0
- package/dist/cjs/dnn-vertical-splitview.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn.cjs.js +2 -2
- package/dist/cjs/{index-e85ec026.js → index-6a6ac523.js} +4 -1
- package/dist/cjs/index-6a6ac523.js.map +1 -0
- package/dist/cjs/{index-eede7745.js → index-ba8b86b1.js} +2 -2
- package/dist/cjs/index-ba8b86b1.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mouseUtilities-75be531a.js +25 -0
- package/dist/cjs/mouseUtilities-75be531a.js.map +1 -0
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.js +6 -22
- package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.js.map +1 -1
- package/dist/collection/components/dnn-tabs/dnn-tabs.js +4 -2
- package/dist/collection/components/dnn-tabs/dnn-tabs.js.map +1 -1
- package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.js +14 -12
- package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.js.map +1 -1
- package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.css +77 -0
- package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.js +132 -0
- package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.js.map +1 -0
- package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.css +30 -0
- package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.js +223 -0
- package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.js.map +1 -0
- package/dist/collection/utilities/mouseUtilities.js +20 -0
- package/dist/collection/utilities/mouseUtilities.js.map +1 -0
- package/dist/dnn/dnn-button.entry.js +1 -1
- package/dist/dnn/dnn-checkbox.entry.js +1 -1
- package/dist/dnn/dnn-chevron.entry.js +1 -1
- package/dist/dnn/dnn-collapsible.entry.js +1 -1
- package/dist/dnn/dnn-color-picker.entry.js +1 -1
- package/dist/dnn/dnn-dropzone.entry.js +1 -1
- package/dist/dnn/dnn-image-cropper.entry.js +7 -23
- package/dist/dnn/dnn-image-cropper.entry.js.map +1 -1
- package/dist/dnn/dnn-modal.entry.js +1 -1
- package/dist/dnn/dnn-searchbox.entry.js +1 -1
- package/dist/dnn/dnn-sort-icon.entry.js +1 -1
- package/dist/dnn/dnn-tab.entry.js +1 -1
- package/dist/dnn/dnn-tabs.entry.js +5 -3
- package/dist/dnn/dnn-tabs.entry.js.map +1 -1
- package/dist/dnn/dnn-toggle.entry.js +1 -1
- package/dist/dnn/dnn-treeview-item.entry.js +15 -13
- package/dist/dnn/dnn-treeview-item.entry.js.map +1 -1
- package/dist/dnn/dnn-vertical-overflow-menu.entry.js +119 -0
- package/dist/dnn/dnn-vertical-overflow-menu.entry.js.map +1 -0
- package/dist/dnn/dnn-vertical-splitview.entry.js +118 -0
- package/dist/dnn/dnn-vertical-splitview.entry.js.map +1 -0
- package/dist/dnn/dnn.esm.js +2 -2
- package/dist/dnn/{index-6c0764e5.js → index-3e56049b.js} +2 -2
- package/dist/dnn/index-3e56049b.js.map +1 -0
- package/dist/dnn/mouseUtilities-817973b4.js +23 -0
- package/dist/dnn/mouseUtilities-817973b4.js.map +1 -0
- package/dist/dnn/{p-7acf3104.entry.js → p-d03a0f3e.entry.js} +4 -4
- package/dist/dnn/p-d03a0f3e.entry.js.map +1 -0
- package/dist/dnn/p-d10994a3.js +2 -0
- package/dist/dnn/p-d10994a3.js.map +1 -0
- package/dist/esm/dnn-button.entry.js +1 -1
- package/dist/esm/{dnn-button_14.entry.js → dnn-button_16.entry.js} +272 -39
- package/dist/esm/dnn-button_16.entry.js.map +1 -0
- package/dist/esm/dnn-checkbox.entry.js +1 -1
- package/dist/esm/dnn-chevron.entry.js +1 -1
- package/dist/esm/dnn-collapsible.entry.js +1 -1
- package/dist/esm/dnn-color-picker.entry.js +1 -1
- package/dist/esm/dnn-dropzone.entry.js +1 -1
- package/dist/esm/dnn-image-cropper.entry.js +7 -23
- package/dist/esm/dnn-image-cropper.entry.js.map +1 -1
- package/dist/esm/dnn-modal.entry.js +1 -1
- package/dist/esm/dnn-searchbox.entry.js +1 -1
- package/dist/esm/dnn-sort-icon.entry.js +1 -1
- package/dist/esm/dnn-tab.entry.js +1 -1
- package/dist/esm/dnn-tabs.entry.js +5 -3
- package/dist/esm/dnn-tabs.entry.js.map +1 -1
- package/dist/esm/dnn-toggle.entry.js +1 -1
- package/dist/esm/dnn-treeview-item.entry.js +15 -13
- package/dist/esm/dnn-treeview-item.entry.js.map +1 -1
- package/dist/esm/dnn-vertical-overflow-menu.entry.js +119 -0
- package/dist/esm/dnn-vertical-overflow-menu.entry.js.map +1 -0
- package/dist/esm/dnn-vertical-splitview.entry.js +118 -0
- package/dist/esm/dnn-vertical-splitview.entry.js.map +1 -0
- package/dist/esm/dnn.js +2 -2
- package/dist/esm/{index-f79d9e82.js → index-212d30ec.js} +4 -1
- package/dist/esm/index-212d30ec.js.map +1 -0
- package/dist/esm/{index-6c0764e5.js → index-3e56049b.js} +2 -2
- package/dist/esm/index-3e56049b.js.map +1 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/mouseUtilities-817973b4.js +23 -0
- package/dist/esm/mouseUtilities-817973b4.js.map +1 -0
- package/dist/types/components/dnn-image-cropper/dnn-image-cropper.d.ts +0 -1
- package/dist/types/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.d.ts +17 -0
- package/dist/types/components/dnn-vertical-splitview/dnn-vertical-splitview.d.ts +26 -0
- package/dist/types/components.d.ts +54 -0
- package/dist/types/utilities/mouseUtilities.d.ts +4 -0
- package/package.json +1 -1
- package/dist/cjs/dnn-button_14.cjs.entry.js.map +0 -1
- package/dist/cjs/index-e85ec026.js.map +0 -1
- package/dist/cjs/index-eede7745.js.map +0 -1
- package/dist/dnn/index-6c0764e5.js.map +0 -1
- package/dist/dnn/p-7acf3104.entry.js.map +0 -1
- package/dist/dnn/p-bd3d3361.js +0 -2
- package/dist/dnn/p-bd3d3361.js.map +0 -1
- package/dist/esm/dnn-button_14.entry.js.map +0 -1
- package/dist/esm/index-6c0764e5.js.map +0 -1
- package/dist/esm/index-f79d9e82.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
This is a collection of reusable HTML elements (WebComponents) for Dnn.
|
|
9
9
|
|
|
10
10
|
# View demo
|
|
11
|
-
A [demo site](https://
|
|
11
|
+
A [demo site](https://DnnCommunity.github.io/dnn-elements/) is available to play with each component. Open the developer panel in your browser to inspect what various component events do.
|
|
12
12
|
|
|
13
13
|
# Stencil
|
|
14
14
|
|
|
@@ -19,6 +19,6 @@ Stencil combines the best concepts of the most popular frontend frameworks into
|
|
|
19
19
|
Stencil components are just Web Components, so they work in any major framework or with no framework at all.
|
|
20
20
|
|
|
21
21
|
## Using these components
|
|
22
|
-
Run `npm i @
|
|
22
|
+
Run `npm i @dnncommunity/dnn-elements`
|
|
23
23
|
|
|
24
24
|
Usage of each component is documented in the component folder rigth here on github with some code samples too.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-ba8b86b1.js');
|
|
6
6
|
|
|
7
7
|
const dnnButtonCss = ":host{--background-color:transparent;--color:#333;--border-size:1px;--border-color:var(--backround-color);--border-radius:var(--dnn-controls-radius, 5px);--padding:var(--dnn-controls-padding, 5px);display:inline-block;width:auto}:host(.disabled){pointer-events:none}:host(.primary){--background-color:var(--dnn-color-primary, blue);--color:var(--dnn-color-primary-contrast, white);--focus-color:var(--background-color)}:host(.primary.reversed){--background-color:var(--dnn-color-primary-contrast, white);--color:var(--dnn-color-primary, blue);--border-color:var(--dnn-color-primary, blue);--focus-color:var(--color)}:host(.secondary){--background-color:var(--dnn-color-secondary, green);--color:var(--dnn-color-secondary-contrast, white);--focus-color:var(--background-color)}:host(.secondary.reversed){--background-color:var(--dnn-color-secondary-contrast, white);--color:var(--dnn-color-secondary, blue);--border-color:var(--dnn-color-secondary, blue);--focus-color:var(--color)}:host(.tertiary){--background-color:var(--dnn-color-tertiary, yellow);--color:var(--dnn-color-tertiary-contrast, black);--focus-color:var(--background-color)}:host(.tertiary.reversed){--background-color:var(--dnn-color-tertiary-contrast, white);--color:var(--dnn-color-tertiary, blue);--border-color:var(--dnn-color-tertiary, blue);--focus-color:var(--color)}:host(.hydrated) button{border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);padding:var(--padding) calc(var(--padding) * 2);background-color:transparent;background-color:var(--background-color);color:var(--color);outline:none}:host(.hydrated) button:focus,:host(.hydrated) button:hover{box-shadow:0 0 2px 2px var(--focus-color)}:host(:disabled,[disabled]) button{pointer-events:none;opacity:0.5}:host(.small) button{padding:calc(var(--padding) / 2) var(--padding);font-size:0.7em}:host(.large) button{padding:calc(var(--padding) * 1.5) calc(var(--padding) * 3);font-size:1.2em}button{height:100%;width:100%;cursor:pointer}";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-6a6ac523.js');
|
|
6
6
|
const debounce = require('./debounce-1de79bc7.js');
|
|
7
7
|
|
|
8
8
|
const dnnButtonCss = ":host{--background-color:transparent;--color:#333;--border-size:1px;--border-color:var(--backround-color);--border-radius:var(--dnn-controls-radius, 5px);--padding:var(--dnn-controls-padding, 5px);display:inline-block;width:auto}:host(.disabled){pointer-events:none}:host(.primary){--background-color:var(--dnn-color-primary, blue);--color:var(--dnn-color-primary-contrast, white);--focus-color:var(--background-color)}:host(.primary.reversed){--background-color:var(--dnn-color-primary-contrast, white);--color:var(--dnn-color-primary, blue);--border-color:var(--dnn-color-primary, blue);--focus-color:var(--color)}:host(.secondary){--background-color:var(--dnn-color-secondary, green);--color:var(--dnn-color-secondary-contrast, white);--focus-color:var(--background-color)}:host(.secondary.reversed){--background-color:var(--dnn-color-secondary-contrast, white);--color:var(--dnn-color-secondary, blue);--border-color:var(--dnn-color-secondary, blue);--focus-color:var(--color)}:host(.tertiary){--background-color:var(--dnn-color-tertiary, yellow);--color:var(--dnn-color-tertiary-contrast, black);--focus-color:var(--background-color)}:host(.tertiary.reversed){--background-color:var(--dnn-color-tertiary-contrast, white);--color:var(--dnn-color-tertiary, blue);--border-color:var(--dnn-color-tertiary, blue);--focus-color:var(--color)}:host(.hydrated) button{border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);padding:var(--padding) calc(var(--padding) * 2);background-color:transparent;background-color:var(--background-color);color:var(--color);outline:none}:host(.hydrated) button:focus,:host(.hydrated) button:hover{box-shadow:0 0 2px 2px var(--focus-color)}:host(:disabled,[disabled]) button{pointer-events:none;opacity:0.5}:host(.small) button{padding:calc(var(--padding) / 2) var(--padding);font-size:0.7em}:host(.large) button{padding:calc(var(--padding) * 1.5) calc(var(--padding) * 3);font-size:1.2em}button{height:100%;width:100%;cursor:pointer}";
|
|
@@ -901,6 +901,26 @@ var CornerType;
|
|
|
901
901
|
CornerType[CornerType["sw"] = 3] = "sw";
|
|
902
902
|
})(CornerType || (CornerType = {}));
|
|
903
903
|
|
|
904
|
+
function getMovementFromEvent(event, previousTouch) {
|
|
905
|
+
let movementX = 0;
|
|
906
|
+
let movementY = 0;
|
|
907
|
+
if (event instanceof MouseEvent) {
|
|
908
|
+
movementX = event.movementX;
|
|
909
|
+
movementY = event.movementY;
|
|
910
|
+
}
|
|
911
|
+
if (typeof TouchEvent !== "undefined") {
|
|
912
|
+
if (event instanceof TouchEvent) {
|
|
913
|
+
let touch = event.touches[0];
|
|
914
|
+
if (previousTouch != undefined) {
|
|
915
|
+
movementX = touch.pageX - this.previousTouch.pageX;
|
|
916
|
+
movementY = touch.pageY - this.previousTouch.pageY;
|
|
917
|
+
}
|
|
918
|
+
previousTouch = touch;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
return { movementX, movementY };
|
|
922
|
+
}
|
|
923
|
+
|
|
904
924
|
const dnnImageCropperCss = ":host{display:block}canvas{display:none}.view{visibility:hidden;opacity:0;height:0;overflow:hidden;transition:all 300ms ease-in-out}.view.visible{visibility:visible;opacity:1;height:initial;overflow:visible}.view .cropper{position:relative;width:100%}.view .cropper img{width:100%;display:block;margin:0 auto}.view .cropper .backdrop{backdrop-filter:saturate(0.5);backdrop-filter:brightness(0.5);position:absolute;left:0;top:0;width:100%;height:100%}.view .cropper .crop{position:absolute;top:0;left:0;width:100%;height:100%;outline:2px dashed white;box-shadow:black 0 0 0px 2px;backdrop-filter:saturate(2);backdrop-filter:brightness(2);cursor:move}.view .cropper .crop>div{width:20px;height:20px;background-color:white;border:2px solid rgba(0, 0, 0, 0.5);position:absolute}.view .cropper .crop>div.nw,.view .cropper .crop>div.ne{top:-17px}.view .cropper .crop>div.ne,.view .cropper .crop>div.se{right:-17px}.view .cropper .crop>div.se,.view .cropper .crop>div.sw{bottom:-17px}.view .cropper .crop>div.sw,.view .cropper .crop>div.nw{left:-17px}.view .cropper .crop>div.nw,.view .cropper .crop>div.se{cursor:nwse-resize}.view .cropper .crop>div.ne,.view .cropper .crop>div.sw{cursor:nesw-resize}dnn-modal{--max-width:512px}";
|
|
905
925
|
|
|
906
926
|
let DnnImageCropper = class {
|
|
@@ -995,7 +1015,7 @@ let DnnImageCropper = class {
|
|
|
995
1015
|
const wantedRatio = this.width / this.height;
|
|
996
1016
|
const cropRect = this.crop.getBoundingClientRect();
|
|
997
1017
|
const imageRect = this.image.getBoundingClientRect();
|
|
998
|
-
let { movementX, movementY } = this.
|
|
1018
|
+
let { movementX, movementY } = getMovementFromEvent(event, this.previousTouch);
|
|
999
1019
|
if (Math.abs(movementX) < Math.abs(movementY)) {
|
|
1000
1020
|
orientation = "vertical";
|
|
1001
1021
|
}
|
|
@@ -1099,7 +1119,7 @@ let DnnImageCropper = class {
|
|
|
1099
1119
|
if (!this.isMouseStillInTarget(ev)) {
|
|
1100
1120
|
return;
|
|
1101
1121
|
}
|
|
1102
|
-
let { movementX, movementY } = this.
|
|
1122
|
+
let { movementX, movementY } = getMovementFromEvent(ev, this.previousTouch);
|
|
1103
1123
|
let newLeft = this.crop.offsetLeft + movementX;
|
|
1104
1124
|
let newTop = this.crop.offsetTop + movementY;
|
|
1105
1125
|
var imageRect = this.image.getBoundingClientRect();
|
|
@@ -1121,7 +1141,9 @@ let DnnImageCropper = class {
|
|
|
1121
1141
|
};
|
|
1122
1142
|
}
|
|
1123
1143
|
componentDidLoad() {
|
|
1124
|
-
|
|
1144
|
+
requestAnimationFrame(() => {
|
|
1145
|
+
this.setView("noPictureView");
|
|
1146
|
+
});
|
|
1125
1147
|
}
|
|
1126
1148
|
setView(newView) {
|
|
1127
1149
|
const views = this.host.shadowRoot.querySelectorAll(".view");
|
|
@@ -1226,25 +1248,6 @@ let DnnImageCropper = class {
|
|
|
1226
1248
|
}
|
|
1227
1249
|
return { top, left };
|
|
1228
1250
|
}
|
|
1229
|
-
getMouvementFromEvent(event) {
|
|
1230
|
-
let movementX = 0;
|
|
1231
|
-
let movementY = 0;
|
|
1232
|
-
if (event instanceof MouseEvent) {
|
|
1233
|
-
movementX = event.movementX;
|
|
1234
|
-
movementY = event.movementY;
|
|
1235
|
-
}
|
|
1236
|
-
if (typeof TouchEvent !== "undefined") {
|
|
1237
|
-
if (event instanceof TouchEvent) {
|
|
1238
|
-
let touch = event.touches[0];
|
|
1239
|
-
if (this.previousTouch != undefined) {
|
|
1240
|
-
movementX = touch.pageX - this.previousTouch.pageX;
|
|
1241
|
-
movementY = touch.pageY - this.previousTouch.pageY;
|
|
1242
|
-
}
|
|
1243
|
-
this.previousTouch = touch;
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
return { movementX, movementY };
|
|
1247
|
-
}
|
|
1248
1251
|
isMouseStillInTarget(event) {
|
|
1249
1252
|
var inside = false;
|
|
1250
1253
|
let mouseX;
|
|
@@ -1463,8 +1466,10 @@ let DnnTabs = class {
|
|
|
1463
1466
|
this.selectedTabTitle = "";
|
|
1464
1467
|
}
|
|
1465
1468
|
componentDidLoad() {
|
|
1466
|
-
|
|
1467
|
-
|
|
1469
|
+
requestAnimationFrame(() => {
|
|
1470
|
+
this.updateTitles();
|
|
1471
|
+
this.showFirstTab();
|
|
1472
|
+
});
|
|
1468
1473
|
}
|
|
1469
1474
|
getTabs() {
|
|
1470
1475
|
return this.component.shadowRoot.querySelector("slot").assignedElements();
|
|
@@ -1533,18 +1538,20 @@ let DnnTreeviewItem = class {
|
|
|
1533
1538
|
this.hasChildren = false;
|
|
1534
1539
|
}
|
|
1535
1540
|
componentDidLoad() {
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
this.
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1541
|
+
requestAnimationFrame(() => {
|
|
1542
|
+
const children = this.childrenElement.children[0];
|
|
1543
|
+
const count = children.assignedElements().length;
|
|
1544
|
+
if (count > 0) {
|
|
1545
|
+
this.hasChildren = true;
|
|
1546
|
+
}
|
|
1547
|
+
if (this.expanded) {
|
|
1548
|
+
this.expander.classList.add("expanded");
|
|
1549
|
+
this.collapsible.expanded = false;
|
|
1550
|
+
setTimeout(() => {
|
|
1551
|
+
this.collapsible.expanded = true;
|
|
1552
|
+
}, 300);
|
|
1553
|
+
}
|
|
1554
|
+
});
|
|
1548
1555
|
}
|
|
1549
1556
|
toggleCollapse() {
|
|
1550
1557
|
this.expanded = !this.expanded;
|
|
@@ -1562,6 +1569,232 @@ let DnnTreeviewItem = class {
|
|
|
1562
1569
|
};
|
|
1563
1570
|
DnnTreeviewItem.style = dnnTreeviewItemCss;
|
|
1564
1571
|
|
|
1572
|
+
const dnnVerticalOverflowMenuCss = ":host{display:block;--background-color:var(--dnn-color-primary-contrast, white);--foreground-color:var(--dnn-color-primary, blue);--text-color:#222}.menu-container{display:flex;justify-content:flex-start;align-items:center;background-color:var(--background-color);color:var(--text-color)}.menu-container button{cursor:pointer}.menu-container button svg{fill:var(--foreground-color)}.menu-container .menu{margin:0.5em;display:flex;gap:1em;justify-content:flex-start;align-items:center;white-space:nowrap;width:100%}.menu-container .menu a{display:flex;align-items:center;color:var(--text-color);text-decoration:none}.menu-container .menu a svg{fill:var(--foreground-color)}.menu-container .overflow{margin-left:auto;position:relative}.menu-container .overflow button{padding:0;margin:0;background-color:transparent;border:none}.menu-container .overflow .dropdown{position:absolute;display:flex;flex-direction:column;white-space:nowrap;right:0;transition:100ms ease-in-out;height:0;overflow:hidden}.menu-container .overflow .dropdown a{color:var(--text-color)}.menu-container .overflow .dropdown a svg{fill:var(--foreground-color)}.menu-container .overflow .dropdown.visible{padding:1em;gap:0.5em;background-color:var(--background-color);box-shadow:2px 2px 4px rgba(0, 0, 0, 0.7)}.menu-container .overflow .dropdown>*{display:flex;align-items:center}";
|
|
1573
|
+
|
|
1574
|
+
let DnnVerticalOverflowMenu = class {
|
|
1575
|
+
constructor(hostRef) {
|
|
1576
|
+
index.registerInstance(this, hostRef);
|
|
1577
|
+
this.showDropdownButton = false;
|
|
1578
|
+
this.showDropdownMenu = false;
|
|
1579
|
+
this.previousMenuWidth = 0;
|
|
1580
|
+
}
|
|
1581
|
+
componentDidRender() {
|
|
1582
|
+
requestAnimationFrame(() => {
|
|
1583
|
+
this.moveAllSlottedItemsIntoMenu();
|
|
1584
|
+
this.moveItemsToDropDownIfNecessery();
|
|
1585
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
1586
|
+
for (let entry of entries) {
|
|
1587
|
+
if (entry.contentRect.width < this.previousMenuWidth) {
|
|
1588
|
+
this.moveItemsToDropDownIfNecessery();
|
|
1589
|
+
}
|
|
1590
|
+
if (this.previousMenuWidth > 0 && entry.contentRect.width > this.previousMenuWidth) {
|
|
1591
|
+
this.moveItemsToMenuIfPossible();
|
|
1592
|
+
}
|
|
1593
|
+
this.previousMenuWidth = entry.contentRect.width;
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
this.resizeObserver.observe(this.element);
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
moveAllSlottedItemsIntoMenu() {
|
|
1600
|
+
const menuItems = this.element.shadowRoot.querySelector("slot").assignedElements();
|
|
1601
|
+
menuItems.forEach(menuItem => this.menu.appendChild(menuItem));
|
|
1602
|
+
}
|
|
1603
|
+
moveItemsToDropDownIfNecessery() {
|
|
1604
|
+
const menuItems = Array.from(this.menu.children);
|
|
1605
|
+
const availableWidth = this.menu.getBoundingClientRect().width;
|
|
1606
|
+
let neededWidth = parseFloat(getComputedStyle(this.element).fontSize) * 2;
|
|
1607
|
+
menuItems.forEach(item => neededWidth += this.getFullWidth(item));
|
|
1608
|
+
neededWidth += (menuItems.length - 1) * parseFloat(getComputedStyle(this.element).fontSize);
|
|
1609
|
+
if (neededWidth > availableWidth) {
|
|
1610
|
+
this.showDropdownButton = true;
|
|
1611
|
+
var lastItem = menuItems[menuItems.length - 1];
|
|
1612
|
+
if (this.dropdown == undefined) {
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1615
|
+
this.dropdown.prepend(lastItem);
|
|
1616
|
+
this.moveItemsToDropDownIfNecessery();
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
moveItemsToMenuIfPossible() {
|
|
1620
|
+
if (this.dropdown == undefined || !this.dropdown.hasChildNodes()) {
|
|
1621
|
+
return;
|
|
1622
|
+
}
|
|
1623
|
+
const menuItems = Array.from(this.menu.children);
|
|
1624
|
+
const availableWidth = this.menu.getBoundingClientRect().width;
|
|
1625
|
+
let neededWidth = parseFloat(getComputedStyle(this.element).fontSize) * 2;
|
|
1626
|
+
neededWidth += (menuItems.length - 1) * parseFloat(getComputedStyle(this.element).fontSize);
|
|
1627
|
+
menuItems.forEach(item => neededWidth += this.getFullWidth(item));
|
|
1628
|
+
neededWidth += this.getFullWidth(this.dropdown.children[0]);
|
|
1629
|
+
if (neededWidth < availableWidth) {
|
|
1630
|
+
const firstItem = this.dropdown.children[0];
|
|
1631
|
+
this.menu.appendChild(firstItem);
|
|
1632
|
+
if (!this.dropdown.hasChildNodes()) {
|
|
1633
|
+
this.dropdown.classList.remove("visible");
|
|
1634
|
+
this.showDropdownMenu = false;
|
|
1635
|
+
this.showDropdownButton = false;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
getFullWidth(item) {
|
|
1640
|
+
var width = item.getBoundingClientRect().width;
|
|
1641
|
+
var styles = getComputedStyle(item);
|
|
1642
|
+
width += parseFloat(styles.marginLeft);
|
|
1643
|
+
width += parseFloat(styles.marginRight);
|
|
1644
|
+
width += parseFloat(styles.paddingLeft);
|
|
1645
|
+
width += parseFloat(styles.paddingRight);
|
|
1646
|
+
return width;
|
|
1647
|
+
}
|
|
1648
|
+
toggleOverflowMenu() {
|
|
1649
|
+
this.showDropdownMenu = !this.showDropdownMenu;
|
|
1650
|
+
if (this.showDropdownMenu) {
|
|
1651
|
+
this.dropdown.classList.add("visible");
|
|
1652
|
+
let contentHeight = 0;
|
|
1653
|
+
const items = Array.from(this.dropdown.children);
|
|
1654
|
+
items.forEach(item => contentHeight += item.getBoundingClientRect().height);
|
|
1655
|
+
var emHeight = parseFloat(getComputedStyle(this.dropdown).fontSize) * 0.5;
|
|
1656
|
+
var additionalHeight = emHeight * (this.dropdown.children.length - 1);
|
|
1657
|
+
contentHeight += additionalHeight;
|
|
1658
|
+
this.dropdown.style.height = `${contentHeight}px`;
|
|
1659
|
+
const dismissMenu = (e) => {
|
|
1660
|
+
const buttonRect = this.button.getBoundingClientRect();
|
|
1661
|
+
if (e.clientX < buttonRect.left ||
|
|
1662
|
+
e.clientX > buttonRect.right ||
|
|
1663
|
+
e.clientY < buttonRect.top ||
|
|
1664
|
+
e.clientY > buttonRect.bottom) {
|
|
1665
|
+
this.toggleOverflowMenu();
|
|
1666
|
+
}
|
|
1667
|
+
document.removeEventListener("click", dismissMenu);
|
|
1668
|
+
};
|
|
1669
|
+
setTimeout(() => {
|
|
1670
|
+
document.addEventListener("click", dismissMenu, false);
|
|
1671
|
+
}, 100);
|
|
1672
|
+
}
|
|
1673
|
+
else {
|
|
1674
|
+
this.dropdown.classList.remove("visible");
|
|
1675
|
+
this.dropdown.style.height = "0px";
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
render() {
|
|
1679
|
+
return (index.h(index.Host, null, index.h("div", { class: "menu-container" }, index.h("div", { class: "menu", ref: el => this.menu = el }, index.h("slot", null)), this.showDropdownButton &&
|
|
1680
|
+
index.h("div", { class: "overflow" }, index.h("button", { ref: el => this.button = el, class: "icon", onClick: () => this.toggleOverflowMenu() }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, index.h("path", { d: "M0 0h24v24H0z", fill: "none" }), index.h("path", { d: "M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }))), index.h("div", { class: "dropdown", ref: el => this.dropdown = el })))));
|
|
1681
|
+
}
|
|
1682
|
+
get element() { return index.getElement(this); }
|
|
1683
|
+
};
|
|
1684
|
+
DnnVerticalOverflowMenu.style = dnnVerticalOverflowMenuCss;
|
|
1685
|
+
|
|
1686
|
+
const dnnVerticalSplitviewCss = ":host{display:flex;align-items:stretch;margin:0 auto;--left-pane-background-color:transparent;--right-pane-background-color:transparent}button{background-color:var(--right-pane-background-color);border:none;margin:0;padding:0;cursor:ew-resize}.pane{overflow-y:auto}.pane.transition{transition:all 300ms ease-in-out}.pane.left{background-color:var(--left-pane-background-color)}.pane.right{background-color:var(--right-pane-background-color)}";
|
|
1687
|
+
|
|
1688
|
+
let DnnVerticalSplitview = class {
|
|
1689
|
+
constructor(hostRef) {
|
|
1690
|
+
index.registerInstance(this, hostRef);
|
|
1691
|
+
this.widthChanged = index.createEvent(this, "widthChanged", 7);
|
|
1692
|
+
/** The width of the splitter area. */
|
|
1693
|
+
this.splitterWidth = 16;
|
|
1694
|
+
/** The percentage position of the splitter in the container. */
|
|
1695
|
+
this.splitWidthPercentage = 30;
|
|
1696
|
+
this.leftWidth = 0;
|
|
1697
|
+
this.rightWidth = 0;
|
|
1698
|
+
}
|
|
1699
|
+
/** Sets the width percentage of the divider */
|
|
1700
|
+
async setSplitWidthPercentage(newWidth) {
|
|
1701
|
+
const panes = this.element.shadowRoot.querySelectorAll(".pane");
|
|
1702
|
+
requestAnimationFrame(() => {
|
|
1703
|
+
panes.forEach(pane => pane.classList.add("transition"));
|
|
1704
|
+
requestAnimationFrame(() => {
|
|
1705
|
+
const fullWidth = this.element.getBoundingClientRect().width;
|
|
1706
|
+
let newLeft = fullWidth * newWidth / 100;
|
|
1707
|
+
if (newLeft < 0) {
|
|
1708
|
+
newLeft = 0;
|
|
1709
|
+
}
|
|
1710
|
+
if (newLeft > fullWidth) {
|
|
1711
|
+
newLeft = fullWidth;
|
|
1712
|
+
}
|
|
1713
|
+
this.leftWidth = newLeft;
|
|
1714
|
+
this.rightWidth = fullWidth - newLeft;
|
|
1715
|
+
setTimeout(() => {
|
|
1716
|
+
panes.forEach(pane => pane.classList.remove("transition"));
|
|
1717
|
+
}, 300);
|
|
1718
|
+
});
|
|
1719
|
+
});
|
|
1720
|
+
}
|
|
1721
|
+
/** Gets the current divider position percentage. */
|
|
1722
|
+
async getSplitWidthPercentage() {
|
|
1723
|
+
const fullWidth = this.element.getBoundingClientRect().width;
|
|
1724
|
+
return this.leftWidth / fullWidth;
|
|
1725
|
+
}
|
|
1726
|
+
componentDidLoad() {
|
|
1727
|
+
requestAnimationFrame(() => {
|
|
1728
|
+
const fullWidth = this.element.getBoundingClientRect().width;
|
|
1729
|
+
this.leftWidth = fullWidth * this.splitWidthPercentage / 100;
|
|
1730
|
+
this.rightWidth = fullWidth - this.leftWidth;
|
|
1731
|
+
this.widthChanged.emit(this.splitWidthPercentage);
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1734
|
+
handleMouseDown(event) {
|
|
1735
|
+
event.preventDefault();
|
|
1736
|
+
const handleDrag = (ev) => {
|
|
1737
|
+
let { movementX } = getMovementFromEvent(ev, this.previousTouch);
|
|
1738
|
+
let fullWidth = this.element.getBoundingClientRect().width;
|
|
1739
|
+
let newLeft = this.leftWidth + movementX;
|
|
1740
|
+
if (newLeft < 0) {
|
|
1741
|
+
newLeft = 0;
|
|
1742
|
+
}
|
|
1743
|
+
if (newLeft > fullWidth) {
|
|
1744
|
+
newLeft = fullWidth;
|
|
1745
|
+
}
|
|
1746
|
+
this.leftWidth = newLeft;
|
|
1747
|
+
this.rightWidth = fullWidth - newLeft;
|
|
1748
|
+
};
|
|
1749
|
+
const handleDragFinished = () => {
|
|
1750
|
+
document.removeEventListener("mousemove", handleDrag);
|
|
1751
|
+
document.removeEventListener("touchmove", handleDrag);
|
|
1752
|
+
const fullWidth = this.element.getBoundingClientRect().width;
|
|
1753
|
+
const newPercentage = this.leftWidth / fullWidth * 100;
|
|
1754
|
+
this.widthChanged.emit(newPercentage);
|
|
1755
|
+
};
|
|
1756
|
+
document.addEventListener("mouseup", handleDragFinished);
|
|
1757
|
+
document.addEventListener("touchend", handleDragFinished);
|
|
1758
|
+
document.addEventListener("mousemove", handleDrag);
|
|
1759
|
+
document.addEventListener("touchmove", handleDrag);
|
|
1760
|
+
}
|
|
1761
|
+
handleKeyDown(e) {
|
|
1762
|
+
let movementX = 0;
|
|
1763
|
+
switch (e.key) {
|
|
1764
|
+
case "ArrowLeft":
|
|
1765
|
+
movementX = -10;
|
|
1766
|
+
break;
|
|
1767
|
+
case "ArrowRight":
|
|
1768
|
+
movementX = 10;
|
|
1769
|
+
break;
|
|
1770
|
+
default:
|
|
1771
|
+
return;
|
|
1772
|
+
}
|
|
1773
|
+
if (e.shiftKey) {
|
|
1774
|
+
movementX = movementX * 10;
|
|
1775
|
+
}
|
|
1776
|
+
const fullWidth = this.element.getBoundingClientRect().width;
|
|
1777
|
+
let newLeft = this.leftWidth + movementX;
|
|
1778
|
+
if (newLeft < 0) {
|
|
1779
|
+
newLeft = 0;
|
|
1780
|
+
}
|
|
1781
|
+
if (newLeft > fullWidth) {
|
|
1782
|
+
newLeft = fullWidth;
|
|
1783
|
+
}
|
|
1784
|
+
this.leftWidth = newLeft;
|
|
1785
|
+
this.rightWidth = fullWidth - this.leftWidth;
|
|
1786
|
+
}
|
|
1787
|
+
render() {
|
|
1788
|
+
return (index.h(index.Host, null, index.h("div", { class: "left pane", style: {
|
|
1789
|
+
width: `${this.leftWidth}px`,
|
|
1790
|
+
} }, index.h("slot", { name: "left" })), index.h("button", { onMouseDown: e => this.handleMouseDown(e), onTouchStart: e => this.handleMouseDown(e), onKeyDown: e => this.handleKeyDown(e), style: { minWidth: `${this.splitterWidth.toString()}px` } }, index.h("slot", null)), index.h("div", { class: "right pane", style: {
|
|
1791
|
+
width: `${this.rightWidth}px`,
|
|
1792
|
+
} }, index.h("slot", { name: "right" }))));
|
|
1793
|
+
}
|
|
1794
|
+
get element() { return index.getElement(this); }
|
|
1795
|
+
};
|
|
1796
|
+
DnnVerticalSplitview.style = dnnVerticalSplitviewCss;
|
|
1797
|
+
|
|
1565
1798
|
exports.dnn_button = DnnButton;
|
|
1566
1799
|
exports.dnn_checkbox = DnnCheckbox;
|
|
1567
1800
|
exports.dnn_chevron = DnnChevron;
|
|
@@ -1576,5 +1809,7 @@ exports.dnn_tab = DnnTab;
|
|
|
1576
1809
|
exports.dnn_tabs = DnnTabs;
|
|
1577
1810
|
exports.dnn_toggle = DnnToggle;
|
|
1578
1811
|
exports.dnn_treeview_item = DnnTreeviewItem;
|
|
1812
|
+
exports.dnn_vertical_overflow_menu = DnnVerticalOverflowMenu;
|
|
1813
|
+
exports.dnn_vertical_splitview = DnnVerticalSplitview;
|
|
1579
1814
|
|
|
1580
|
-
//# sourceMappingURL=dnn-
|
|
1815
|
+
//# sourceMappingURL=dnn-button_16.cjs.entry.js.map
|