@dnncommunity/dnn-elements 0.13.1 → 0.14.0-beta.1
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} +274 -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 +123 -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 +21 -0
- package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.js +219 -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 +119 -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-d10994a3.js +2 -0
- package/dist/dnn/p-d10994a3.js.map +1 -0
- package/dist/dnn/{p-7acf3104.entry.js → p-fef1bc51.entry.js} +4 -4
- package/dist/dnn/p-fef1bc51.entry.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} +273 -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 +119 -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 +21 -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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-212d30ec.js';
|
|
2
2
|
import { D as Debounce } from './debounce-06f55268.js';
|
|
3
3
|
|
|
4
4
|
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}";
|
|
@@ -897,6 +897,26 @@ var CornerType;
|
|
|
897
897
|
CornerType[CornerType["sw"] = 3] = "sw";
|
|
898
898
|
})(CornerType || (CornerType = {}));
|
|
899
899
|
|
|
900
|
+
function getMovementFromEvent(event, previousTouch) {
|
|
901
|
+
let movementX = 0;
|
|
902
|
+
let movementY = 0;
|
|
903
|
+
if (event instanceof MouseEvent) {
|
|
904
|
+
movementX = event.movementX;
|
|
905
|
+
movementY = event.movementY;
|
|
906
|
+
}
|
|
907
|
+
if (typeof TouchEvent !== "undefined") {
|
|
908
|
+
if (event instanceof TouchEvent) {
|
|
909
|
+
let touch = event.touches[0];
|
|
910
|
+
if (previousTouch != undefined) {
|
|
911
|
+
movementX = touch.pageX - this.previousTouch.pageX;
|
|
912
|
+
movementY = touch.pageY - this.previousTouch.pageY;
|
|
913
|
+
}
|
|
914
|
+
previousTouch = touch;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
return { movementX, movementY };
|
|
918
|
+
}
|
|
919
|
+
|
|
900
920
|
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}";
|
|
901
921
|
|
|
902
922
|
let DnnImageCropper = class {
|
|
@@ -991,7 +1011,7 @@ let DnnImageCropper = class {
|
|
|
991
1011
|
const wantedRatio = this.width / this.height;
|
|
992
1012
|
const cropRect = this.crop.getBoundingClientRect();
|
|
993
1013
|
const imageRect = this.image.getBoundingClientRect();
|
|
994
|
-
let { movementX, movementY } = this.
|
|
1014
|
+
let { movementX, movementY } = getMovementFromEvent(event, this.previousTouch);
|
|
995
1015
|
if (Math.abs(movementX) < Math.abs(movementY)) {
|
|
996
1016
|
orientation = "vertical";
|
|
997
1017
|
}
|
|
@@ -1095,7 +1115,7 @@ let DnnImageCropper = class {
|
|
|
1095
1115
|
if (!this.isMouseStillInTarget(ev)) {
|
|
1096
1116
|
return;
|
|
1097
1117
|
}
|
|
1098
|
-
let { movementX, movementY } = this.
|
|
1118
|
+
let { movementX, movementY } = getMovementFromEvent(ev, this.previousTouch);
|
|
1099
1119
|
let newLeft = this.crop.offsetLeft + movementX;
|
|
1100
1120
|
let newTop = this.crop.offsetTop + movementY;
|
|
1101
1121
|
var imageRect = this.image.getBoundingClientRect();
|
|
@@ -1117,7 +1137,9 @@ let DnnImageCropper = class {
|
|
|
1117
1137
|
};
|
|
1118
1138
|
}
|
|
1119
1139
|
componentDidLoad() {
|
|
1120
|
-
|
|
1140
|
+
requestAnimationFrame(() => {
|
|
1141
|
+
this.setView("noPictureView");
|
|
1142
|
+
});
|
|
1121
1143
|
}
|
|
1122
1144
|
setView(newView) {
|
|
1123
1145
|
const views = this.host.shadowRoot.querySelectorAll(".view");
|
|
@@ -1222,25 +1244,6 @@ let DnnImageCropper = class {
|
|
|
1222
1244
|
}
|
|
1223
1245
|
return { top, left };
|
|
1224
1246
|
}
|
|
1225
|
-
getMouvementFromEvent(event) {
|
|
1226
|
-
let movementX = 0;
|
|
1227
|
-
let movementY = 0;
|
|
1228
|
-
if (event instanceof MouseEvent) {
|
|
1229
|
-
movementX = event.movementX;
|
|
1230
|
-
movementY = event.movementY;
|
|
1231
|
-
}
|
|
1232
|
-
if (typeof TouchEvent !== "undefined") {
|
|
1233
|
-
if (event instanceof TouchEvent) {
|
|
1234
|
-
let touch = event.touches[0];
|
|
1235
|
-
if (this.previousTouch != undefined) {
|
|
1236
|
-
movementX = touch.pageX - this.previousTouch.pageX;
|
|
1237
|
-
movementY = touch.pageY - this.previousTouch.pageY;
|
|
1238
|
-
}
|
|
1239
|
-
this.previousTouch = touch;
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
return { movementX, movementY };
|
|
1243
|
-
}
|
|
1244
1247
|
isMouseStillInTarget(event) {
|
|
1245
1248
|
var inside = false;
|
|
1246
1249
|
let mouseX;
|
|
@@ -1459,8 +1462,10 @@ let DnnTabs = class {
|
|
|
1459
1462
|
this.selectedTabTitle = "";
|
|
1460
1463
|
}
|
|
1461
1464
|
componentDidLoad() {
|
|
1462
|
-
|
|
1463
|
-
|
|
1465
|
+
requestAnimationFrame(() => {
|
|
1466
|
+
this.updateTitles();
|
|
1467
|
+
this.showFirstTab();
|
|
1468
|
+
});
|
|
1464
1469
|
}
|
|
1465
1470
|
getTabs() {
|
|
1466
1471
|
return this.component.shadowRoot.querySelector("slot").assignedElements();
|
|
@@ -1529,18 +1534,20 @@ let DnnTreeviewItem = class {
|
|
|
1529
1534
|
this.hasChildren = false;
|
|
1530
1535
|
}
|
|
1531
1536
|
componentDidLoad() {
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
this.
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1537
|
+
requestAnimationFrame(() => {
|
|
1538
|
+
const children = this.childrenElement.children[0];
|
|
1539
|
+
const count = children.assignedElements().length;
|
|
1540
|
+
if (count > 0) {
|
|
1541
|
+
this.hasChildren = true;
|
|
1542
|
+
}
|
|
1543
|
+
if (this.expanded) {
|
|
1544
|
+
this.expander.classList.add("expanded");
|
|
1545
|
+
this.collapsible.expanded = false;
|
|
1546
|
+
setTimeout(() => {
|
|
1547
|
+
this.collapsible.expanded = true;
|
|
1548
|
+
}, 300);
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1544
1551
|
}
|
|
1545
1552
|
toggleCollapse() {
|
|
1546
1553
|
this.expanded = !this.expanded;
|
|
@@ -1558,6 +1565,233 @@ let DnnTreeviewItem = class {
|
|
|
1558
1565
|
};
|
|
1559
1566
|
DnnTreeviewItem.style = dnnTreeviewItemCss;
|
|
1560
1567
|
|
|
1561
|
-
|
|
1568
|
+
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}";
|
|
1569
|
+
|
|
1570
|
+
let DnnVerticalOverflowMenu = class {
|
|
1571
|
+
constructor(hostRef) {
|
|
1572
|
+
registerInstance(this, hostRef);
|
|
1573
|
+
this.showDropdownButton = false;
|
|
1574
|
+
this.showDropdownMenu = false;
|
|
1575
|
+
this.previousMenuWidth = 0;
|
|
1576
|
+
}
|
|
1577
|
+
componentDidRender() {
|
|
1578
|
+
requestAnimationFrame(() => {
|
|
1579
|
+
this.moveAllSlottedItemsIntoMenu();
|
|
1580
|
+
this.moveItemsToDropDownIfNecessery();
|
|
1581
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
1582
|
+
for (let entry of entries) {
|
|
1583
|
+
if (entry.contentRect.width < this.previousMenuWidth) {
|
|
1584
|
+
this.moveItemsToDropDownIfNecessery();
|
|
1585
|
+
}
|
|
1586
|
+
if (this.previousMenuWidth > 0 && entry.contentRect.width > this.previousMenuWidth) {
|
|
1587
|
+
this.moveItemsToMenuIfPossible();
|
|
1588
|
+
}
|
|
1589
|
+
this.previousMenuWidth = entry.contentRect.width;
|
|
1590
|
+
}
|
|
1591
|
+
});
|
|
1592
|
+
this.resizeObserver.observe(this.element);
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
moveAllSlottedItemsIntoMenu() {
|
|
1596
|
+
const menuItems = this.element.shadowRoot.querySelector("slot").assignedElements();
|
|
1597
|
+
menuItems.forEach(menuItem => this.menu.appendChild(menuItem));
|
|
1598
|
+
}
|
|
1599
|
+
moveItemsToDropDownIfNecessery() {
|
|
1600
|
+
const menuItems = Array.from(this.menu.children);
|
|
1601
|
+
const availableWidth = this.menu.getBoundingClientRect().width;
|
|
1602
|
+
let neededWidth = parseFloat(getComputedStyle(this.element).fontSize) * 2;
|
|
1603
|
+
menuItems.forEach(item => neededWidth += this.getFullWidth(item));
|
|
1604
|
+
neededWidth += (menuItems.length - 1) * parseFloat(getComputedStyle(this.element).fontSize);
|
|
1605
|
+
if (neededWidth > availableWidth) {
|
|
1606
|
+
this.showDropdownButton = true;
|
|
1607
|
+
var lastItem = menuItems[menuItems.length - 1];
|
|
1608
|
+
if (this.dropdown == undefined) {
|
|
1609
|
+
return;
|
|
1610
|
+
}
|
|
1611
|
+
this.dropdown.prepend(lastItem);
|
|
1612
|
+
this.moveItemsToDropDownIfNecessery();
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
moveItemsToMenuIfPossible() {
|
|
1616
|
+
if (this.dropdown == undefined || !this.dropdown.hasChildNodes()) {
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
const menuItems = Array.from(this.menu.children);
|
|
1620
|
+
const availableWidth = this.menu.getBoundingClientRect().width;
|
|
1621
|
+
let neededWidth = parseFloat(getComputedStyle(this.element).fontSize) * 2;
|
|
1622
|
+
neededWidth += (menuItems.length - 1) * parseFloat(getComputedStyle(this.element).fontSize);
|
|
1623
|
+
menuItems.forEach(item => neededWidth += this.getFullWidth(item));
|
|
1624
|
+
neededWidth += this.getFullWidth(this.dropdown.children[0]);
|
|
1625
|
+
if (neededWidth < availableWidth) {
|
|
1626
|
+
const firstItem = this.dropdown.children[0];
|
|
1627
|
+
this.menu.appendChild(firstItem);
|
|
1628
|
+
if (!this.dropdown.hasChildNodes()) {
|
|
1629
|
+
this.dropdown.classList.remove("visible");
|
|
1630
|
+
this.showDropdownMenu = false;
|
|
1631
|
+
this.showDropdownButton = false;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
getFullWidth(item) {
|
|
1636
|
+
var width = item.getBoundingClientRect().width;
|
|
1637
|
+
var styles = getComputedStyle(item);
|
|
1638
|
+
width += parseFloat(styles.marginLeft);
|
|
1639
|
+
width += parseFloat(styles.marginRight);
|
|
1640
|
+
width += parseFloat(styles.paddingLeft);
|
|
1641
|
+
width += parseFloat(styles.paddingRight);
|
|
1642
|
+
return width;
|
|
1643
|
+
}
|
|
1644
|
+
toggleOverflowMenu() {
|
|
1645
|
+
this.showDropdownMenu = !this.showDropdownMenu;
|
|
1646
|
+
if (this.showDropdownMenu) {
|
|
1647
|
+
this.dropdown.classList.add("visible");
|
|
1648
|
+
let contentHeight = 0;
|
|
1649
|
+
const items = Array.from(this.dropdown.children);
|
|
1650
|
+
items.forEach(item => contentHeight += item.getBoundingClientRect().height);
|
|
1651
|
+
var emHeight = parseFloat(getComputedStyle(this.dropdown).fontSize) * 0.5;
|
|
1652
|
+
var additionalHeight = emHeight * (this.dropdown.children.length - 1);
|
|
1653
|
+
contentHeight += additionalHeight;
|
|
1654
|
+
this.dropdown.style.height = `${contentHeight}px`;
|
|
1655
|
+
const dismissMenu = (e) => {
|
|
1656
|
+
const buttonRect = this.button.getBoundingClientRect();
|
|
1657
|
+
if (e.clientX < buttonRect.left ||
|
|
1658
|
+
e.clientX > buttonRect.right ||
|
|
1659
|
+
e.clientY < buttonRect.top ||
|
|
1660
|
+
e.clientY > buttonRect.bottom) {
|
|
1661
|
+
this.toggleOverflowMenu();
|
|
1662
|
+
}
|
|
1663
|
+
document.removeEventListener("click", dismissMenu);
|
|
1664
|
+
};
|
|
1665
|
+
setTimeout(() => {
|
|
1666
|
+
document.addEventListener("click", dismissMenu, false);
|
|
1667
|
+
}, 100);
|
|
1668
|
+
}
|
|
1669
|
+
else {
|
|
1670
|
+
this.dropdown.classList.remove("visible");
|
|
1671
|
+
this.dropdown.style.height = "0px";
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
render() {
|
|
1675
|
+
return (h(Host, null, h("div", { class: "menu-container" }, h("div", { class: "menu", ref: el => this.menu = el }, h("slot", null)), this.showDropdownButton &&
|
|
1676
|
+
h("div", { class: "overflow" }, h("button", { ref: el => this.button = el, class: "icon", onClick: () => this.toggleOverflowMenu() }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, h("path", { d: "M0 0h24v24H0z", fill: "none" }), 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" }))), h("div", { class: "dropdown", ref: el => this.dropdown = el })))));
|
|
1677
|
+
}
|
|
1678
|
+
get element() { return getElement(this); }
|
|
1679
|
+
};
|
|
1680
|
+
DnnVerticalOverflowMenu.style = dnnVerticalOverflowMenuCss;
|
|
1681
|
+
|
|
1682
|
+
const dnnVerticalSplitviewCss = ":host{display:flex;align-items:stretch;margin:0 auto}button{background-color:transparent;border:none;margin:0;padding:0;cursor:ew-resize}.pane{height:100%;overflow-y:auto}.pane.transition{transition:all 300ms ease-in-out}";
|
|
1683
|
+
|
|
1684
|
+
let DnnVerticalSplitview = class {
|
|
1685
|
+
constructor(hostRef) {
|
|
1686
|
+
registerInstance(this, hostRef);
|
|
1687
|
+
this.widthChanged = createEvent(this, "widthChanged", 7);
|
|
1688
|
+
/** The width of the splitter area. */
|
|
1689
|
+
this.splitterWidth = 16;
|
|
1690
|
+
/** The percentage position of the splitter in the container. */
|
|
1691
|
+
this.splitWidthPercentage = 30;
|
|
1692
|
+
this.leftWidth = 0;
|
|
1693
|
+
this.rightWidth = 0;
|
|
1694
|
+
}
|
|
1695
|
+
/** Sets the width percentage of the divider */
|
|
1696
|
+
async setSplitWidthPercentage(newWidth) {
|
|
1697
|
+
const panes = this.element.shadowRoot.querySelectorAll(".pane");
|
|
1698
|
+
requestAnimationFrame(() => {
|
|
1699
|
+
panes.forEach(pane => pane.classList.add("transition"));
|
|
1700
|
+
requestAnimationFrame(() => {
|
|
1701
|
+
const fullWidth = this.element.getBoundingClientRect().width;
|
|
1702
|
+
let newLeft = fullWidth * newWidth / 100;
|
|
1703
|
+
if (newLeft < 0) {
|
|
1704
|
+
newLeft = 0;
|
|
1705
|
+
}
|
|
1706
|
+
if (newLeft > fullWidth) {
|
|
1707
|
+
newLeft = fullWidth;
|
|
1708
|
+
}
|
|
1709
|
+
this.leftWidth = newLeft;
|
|
1710
|
+
this.rightWidth = fullWidth - newLeft;
|
|
1711
|
+
setTimeout(() => {
|
|
1712
|
+
panes.forEach(pane => pane.classList.remove("transition"));
|
|
1713
|
+
}, 300);
|
|
1714
|
+
});
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
/** Gets the current divider position percentage. */
|
|
1718
|
+
async getSplitWidthPercentage() {
|
|
1719
|
+
const fullWidth = this.element.getBoundingClientRect().width;
|
|
1720
|
+
return this.leftWidth / fullWidth;
|
|
1721
|
+
}
|
|
1722
|
+
componentDidLoad() {
|
|
1723
|
+
requestAnimationFrame(() => {
|
|
1724
|
+
const fullWidth = this.element.getBoundingClientRect().width;
|
|
1725
|
+
this.leftWidth = fullWidth * this.splitWidthPercentage / 100;
|
|
1726
|
+
this.rightWidth = fullWidth - this.leftWidth;
|
|
1727
|
+
this.widthChanged.emit(this.splitWidthPercentage);
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
handleMouseDown(event) {
|
|
1731
|
+
event.preventDefault();
|
|
1732
|
+
const handleDrag = (ev) => {
|
|
1733
|
+
let { movementX } = getMovementFromEvent(ev, this.previousTouch);
|
|
1734
|
+
let fullWidth = this.element.getBoundingClientRect().width;
|
|
1735
|
+
let newLeft = this.leftWidth + movementX;
|
|
1736
|
+
if (newLeft < 0) {
|
|
1737
|
+
newLeft = 0;
|
|
1738
|
+
}
|
|
1739
|
+
if (newLeft > fullWidth) {
|
|
1740
|
+
newLeft = fullWidth;
|
|
1741
|
+
}
|
|
1742
|
+
this.leftWidth = newLeft;
|
|
1743
|
+
this.rightWidth = fullWidth - newLeft;
|
|
1744
|
+
};
|
|
1745
|
+
const handleDragFinished = () => {
|
|
1746
|
+
document.removeEventListener("mousemove", handleDrag);
|
|
1747
|
+
document.removeEventListener("touchmove", handleDrag);
|
|
1748
|
+
const fullWidth = this.element.getBoundingClientRect().width;
|
|
1749
|
+
const newPercentage = this.leftWidth / fullWidth * 100;
|
|
1750
|
+
this.widthChanged.emit(newPercentage);
|
|
1751
|
+
};
|
|
1752
|
+
document.addEventListener("mouseup", handleDragFinished);
|
|
1753
|
+
document.addEventListener("touchend", handleDragFinished);
|
|
1754
|
+
document.addEventListener("mousemove", handleDrag);
|
|
1755
|
+
document.addEventListener("touchmove", handleDrag);
|
|
1756
|
+
}
|
|
1757
|
+
handleKeyDown(e) {
|
|
1758
|
+
let movementX = 0;
|
|
1759
|
+
switch (e.key) {
|
|
1760
|
+
case "ArrowLeft":
|
|
1761
|
+
movementX = -10;
|
|
1762
|
+
break;
|
|
1763
|
+
case "ArrowRight":
|
|
1764
|
+
movementX = 10;
|
|
1765
|
+
break;
|
|
1766
|
+
default:
|
|
1767
|
+
return;
|
|
1768
|
+
}
|
|
1769
|
+
if (e.shiftKey) {
|
|
1770
|
+
movementX = movementX * 10;
|
|
1771
|
+
}
|
|
1772
|
+
const fullWidth = this.element.getBoundingClientRect().width;
|
|
1773
|
+
let newLeft = this.leftWidth + movementX;
|
|
1774
|
+
if (newLeft < 0) {
|
|
1775
|
+
newLeft = 0;
|
|
1776
|
+
}
|
|
1777
|
+
if (newLeft > fullWidth) {
|
|
1778
|
+
newLeft = fullWidth;
|
|
1779
|
+
}
|
|
1780
|
+
this.leftWidth = newLeft;
|
|
1781
|
+
this.rightWidth = fullWidth - this.leftWidth;
|
|
1782
|
+
}
|
|
1783
|
+
render() {
|
|
1784
|
+
return (h(Host, null, h("div", { class: "pane", style: {
|
|
1785
|
+
width: `${this.leftWidth}px`,
|
|
1786
|
+
height: "100%",
|
|
1787
|
+
} }, h("slot", { name: "left" })), h("button", { onMouseDown: e => this.handleMouseDown(e), onTouchStart: e => this.handleMouseDown(e), onKeyDown: e => this.handleKeyDown(e), style: { minWidth: `${this.splitterWidth.toString()}px` } }, h("slot", null)), h("div", { class: "pane", style: {
|
|
1788
|
+
width: `${this.rightWidth}px`,
|
|
1789
|
+
} }, h("slot", { name: "right" }))));
|
|
1790
|
+
}
|
|
1791
|
+
get element() { return getElement(this); }
|
|
1792
|
+
};
|
|
1793
|
+
DnnVerticalSplitview.style = dnnVerticalSplitviewCss;
|
|
1794
|
+
|
|
1795
|
+
export { DnnButton as dnn_button, DnnCheckbox as dnn_checkbox, DnnChevron as dnn_chevron, DnnCollapsible as dnn_collapsible, DnnColorPicker as dnn_color_picker, DnnDropzone as dnn_dropzone, DnnImageCropper as dnn_image_cropper, DnnModal as dnn_modal, DnnSearchbox as dnn_searchbox, DnnSortIcon as dnn_sort_icon, DnnTab as dnn_tab, DnnTabs as dnn_tabs, DnnToggle as dnn_toggle, DnnTreeviewItem as dnn_treeview_item, DnnVerticalOverflowMenu as dnn_vertical_overflow_menu, DnnVerticalSplitview as dnn_vertical_splitview };
|
|
1562
1796
|
|
|
1563
|
-
//# sourceMappingURL=dnn-
|
|
1797
|
+
//# sourceMappingURL=dnn-button_16.entry.js.map
|