@dso-toolkit/core 52.0.1 → 52.0.2
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/dist/cjs/dso-label.cjs.entry.js +38 -43
- package/dist/cjs/dso-toolkit.cjs.js +1 -1
- package/dist/cjs/dso-tooltip.cjs.entry.js +75 -40
- package/dist/cjs/dso-viewer-grid.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/label/label.js +29 -23
- package/dist/collection/components/label/resize-observer.js +6 -6
- package/dist/collection/components/tooltip/tooltip.js +75 -40
- package/dist/collection/components/viewer-grid/viewer-grid.js +1 -1
- package/dist/components/dso-label.js +34 -39
- package/dist/components/dso-viewer-grid.js +1 -1
- package/dist/components/tooltip.js +76 -41
- package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
- package/dist/dso-toolkit/{p-4d70d9c0.entry.js → p-1ab86eed.entry.js} +1 -1
- package/dist/dso-toolkit/p-3b83e9c6.entry.js +1 -0
- package/dist/dso-toolkit/p-8a0a97de.entry.js +1 -0
- package/dist/esm/dso-label.entry.js +32 -37
- package/dist/esm/dso-toolkit.js +1 -1
- package/dist/esm/dso-tooltip.entry.js +76 -41
- package/dist/esm/dso-viewer-grid.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/label/label.d.ts +7 -3
- package/dist/types/components/tooltip/tooltip.d.ts +6 -3
- package/dist/types/components.d.ts +4 -1
- package/package.json +2 -2
- package/dist/collection/components/label/mutation-observer.js +0 -11
- package/dist/dso-toolkit/p-0f37693a.entry.js +0 -1
- package/dist/dso-toolkit/p-bdc3b14b.entry.js +0 -1
- package/dist/types/components/label/mutation-observer.d.ts +0 -1
|
@@ -2,29 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-ecec64a0.js');
|
|
5
|
+
const index$1 = require('./index-ecec64a0.js');
|
|
6
6
|
const clsx_m = require('./clsx.m-b81c6b86.js');
|
|
7
|
+
const index = require('./index-794ad37a.js');
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
entries.forEach((
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
component.updateTooltipText();
|
|
9
|
+
const resizeObserver = new ResizeObserver(index.debounce_1.debounce((entries) => {
|
|
10
|
+
entries.forEach(({ target }) => {
|
|
11
|
+
if (isDsoLabelComponent(target)) {
|
|
12
|
+
target.truncateLabel();
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
});
|
|
16
|
-
function isDsoLabelComponent$1(element) {
|
|
17
|
-
return element.updateTooltipText !== undefined;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
21
|
-
entries.forEach((entry) => {
|
|
22
|
-
const component = entry.target;
|
|
23
|
-
if (isDsoLabelComponent(component)) {
|
|
24
|
-
component.truncateLabel();
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
15
|
+
}, 150));
|
|
28
16
|
function isDsoLabelComponent(element) {
|
|
29
17
|
return element.truncateLabel !== undefined;
|
|
30
18
|
}
|
|
@@ -36,8 +24,8 @@ function hasEllipses(el) {
|
|
|
36
24
|
}
|
|
37
25
|
const Label = class {
|
|
38
26
|
constructor(hostRef) {
|
|
39
|
-
index.registerInstance(this, hostRef);
|
|
40
|
-
this.dsoRemoveClick = index.createEvent(this, "dsoRemoveClick", 7);
|
|
27
|
+
index$1.registerInstance(this, hostRef);
|
|
28
|
+
this.dsoRemoveClick = index$1.createEvent(this, "dsoRemoveClick", 7);
|
|
41
29
|
this.keydownListenerActive = false;
|
|
42
30
|
this.keyDownListener = (event) => {
|
|
43
31
|
if (event.key === "Escape") {
|
|
@@ -53,8 +41,8 @@ const Label = class {
|
|
|
53
41
|
this.truncate = undefined;
|
|
54
42
|
this.textHover = undefined;
|
|
55
43
|
this.textFocus = undefined;
|
|
56
|
-
this.
|
|
57
|
-
this.labelText =
|
|
44
|
+
this.isTruncated = undefined;
|
|
45
|
+
this.labelText = null;
|
|
58
46
|
}
|
|
59
47
|
watchTruncate(truncate) {
|
|
60
48
|
if (truncate) {
|
|
@@ -76,54 +64,61 @@ const Label = class {
|
|
|
76
64
|
}
|
|
77
65
|
async truncateLabel() {
|
|
78
66
|
setTimeout(() => {
|
|
79
|
-
|
|
80
|
-
this.truncatedContent = hasEllipses(this.labelContent) ? this.host.innerText : undefined;
|
|
81
|
-
}
|
|
67
|
+
this.isTruncated = this.labelContent && hasEllipses(this.labelContent);
|
|
82
68
|
});
|
|
83
69
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.truncateLabel();
|
|
88
|
-
}
|
|
70
|
+
/** **[Internal]** Synchronizes the text on the remove button and tooltip. You should never have to use this. */
|
|
71
|
+
async syncLabelText() {
|
|
72
|
+
this.labelText = this.host.textContent;
|
|
89
73
|
}
|
|
90
74
|
componentDidLoad() {
|
|
91
|
-
this.labelText = this.host.innerText;
|
|
92
|
-
mutationObserver.observe(this.host, {
|
|
93
|
-
attributes: true,
|
|
94
|
-
subtree: true,
|
|
95
|
-
});
|
|
96
75
|
if (this.truncate) {
|
|
97
76
|
this.startTruncate();
|
|
98
77
|
}
|
|
78
|
+
if (this.removable) {
|
|
79
|
+
this.startMutationObserver();
|
|
80
|
+
}
|
|
99
81
|
}
|
|
100
82
|
disconnectedCallback() {
|
|
101
|
-
mutationObserver === null || mutationObserver === void 0 ? void 0 : mutationObserver.disconnect();
|
|
102
83
|
this.stopTruncate();
|
|
103
84
|
}
|
|
85
|
+
/** The mutationObserver fetches the text placed inside the label, this is then used for the remove button and tooltip. */
|
|
86
|
+
startMutationObserver() {
|
|
87
|
+
if (this.mutationObserver) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.mutationObserver = new MutationObserver((entries) => entries.forEach(() => this.syncLabelText()));
|
|
91
|
+
this.mutationObserver.observe(this.host, {
|
|
92
|
+
characterData: true,
|
|
93
|
+
subtree: true,
|
|
94
|
+
attributes: true,
|
|
95
|
+
});
|
|
96
|
+
this.labelText = this.host.textContent;
|
|
97
|
+
}
|
|
104
98
|
startTruncate() {
|
|
105
99
|
resizeObserver.observe(this.host);
|
|
100
|
+
this.startMutationObserver();
|
|
106
101
|
this.truncateLabel();
|
|
107
102
|
}
|
|
108
103
|
stopTruncate() {
|
|
109
104
|
document.removeEventListener("keydown", this.keyDownListener);
|
|
110
105
|
resizeObserver.unobserve(this.host);
|
|
111
|
-
this.
|
|
106
|
+
this.isTruncated = undefined;
|
|
112
107
|
this.keydownListenerActive = false;
|
|
113
108
|
}
|
|
114
109
|
render() {
|
|
115
110
|
const status = this.status && Label.statusMap.get(this.status);
|
|
116
|
-
return (index.h(index.Host, { "aria-roledescription": this.truncate && this.
|
|
111
|
+
return (index$1.h(index$1.Host, { "aria-roledescription": this.truncate && this.isTruncated
|
|
117
112
|
? "Deze tekst is visueel afgekapt en wordt volledig zichtbaar bij focus."
|
|
118
|
-
: undefined }, index.h("span", { "aria-describedby": "toggle-anchor", class: clsx_m.clsx("dso-label", {
|
|
113
|
+
: undefined }, index$1.h("span", { "aria-describedby": "toggle-anchor", class: clsx_m.clsx("dso-label", {
|
|
119
114
|
[`dso-label-${this.status}`]: this.status,
|
|
120
115
|
"dso-compact": this.compact && !this.removable,
|
|
121
116
|
"dso-hover": this.removeHover || this.removeFocus,
|
|
122
|
-
}) }, index.h("slot", { name: "symbol" }), status && index.h("span", { class: "sr-only" }, status, ": "), index.h("span", { class: clsx_m.clsx("dso-label-content", {
|
|
117
|
+
}) }, index$1.h("slot", { name: "symbol" }), status && index$1.h("span", { class: "sr-only" }, status, ": "), index$1.h("span", { class: clsx_m.clsx("dso-label-content", {
|
|
123
118
|
"dso-truncate": !!this.truncate,
|
|
124
|
-
}), ref: (element) => (this.labelContent = element), tabindex: this.truncate && this.
|
|
119
|
+
}), ref: (element) => (this.labelContent = element), tabindex: this.truncate && this.isTruncated ? 0 : undefined, onMouseEnter: () => (this.textHover = true), onMouseLeave: () => (this.textHover = false), onFocus: () => (this.textFocus = true), onBlur: () => (this.textFocus = false) }, index$1.h("slot", null)), this.removable && (index$1.h("button", { type: "button", onClick: (e) => this.dsoRemoveClick.emit(e), onMouseEnter: () => (this.removeHover = true), onMouseLeave: () => (this.removeHover = false), onFocus: () => (this.removeFocus = true), onBlur: () => (this.removeFocus = false) }, index$1.h("span", { class: "sr-only" }, "Verwijder: ", this.labelText), index$1.h("dso-icon", { icon: "times" })))), this.isTruncated && (index$1.h("dso-tooltip", { stateless: true, id: "toggle-anchor", active: this.textHover || this.textFocus, position: "top", strategy: "absolute" }, this.labelText))));
|
|
125
120
|
}
|
|
126
|
-
get host() { return index.getElement(this); }
|
|
121
|
+
get host() { return index$1.getElement(this); }
|
|
127
122
|
static get watchers() { return {
|
|
128
123
|
"truncate": ["watchTruncate"],
|
|
129
124
|
"textHover": ["watchTooltipActive"],
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["dso-icon.cjs",[[1,"dso-icon",{"icon":[1]}]]],["dso-map-base-layers.cjs",[[1,"dso-map-base-layers",{"group":[1],"baseLayers":[16]}]]],["dso-map-overlays.cjs",[[1,"dso-map-overlays",{"group":[1],"overlays":[16]}]]],["dso-annotation-output.cjs",[[4,"dso-annotation-output",{"identifier":[1],"annotationPrefix":[1,"annotation-prefix"],"toggleAnnotation":[64]}]]],["dso-toggletip.cjs",[[1,"dso-toggletip",{"label":[1],"position":[1],"small":[4],"secondary":[4],"active":[32]}]]],["dso-expandable-heading.cjs",[[1,"dso-expandable-heading",{"open":[4],"heading":[1],"color":[1]}]]],["dso-header.cjs",[[6,"dso-header",{"mainMenu":[16],"useDropDownMenu":[1,"use-drop-down-menu"],"authStatus":[1,"auth-status"],"loginUrl":[1,"login-url"],"logoutUrl":[1,"logout-url"],"userProfileName":[1,"user-profile-name"],"userProfileUrl":[1,"user-profile-url"],"userHomeUrl":[1,"user-home-url"],"showDropDown":[32],"hasSubLogo":[32],"overflowMenuItems":[32]}]]],["dso-label.cjs",[[1,"dso-label",{"compact":[4],"removable":[4],"status":[1],"truncate":[4],"removeHover":[32],"removeFocus":[32],"textHover":[32],"textFocus":[32],"
|
|
18
|
+
return index.bootstrapLazy([["dso-icon.cjs",[[1,"dso-icon",{"icon":[1]}]]],["dso-map-base-layers.cjs",[[1,"dso-map-base-layers",{"group":[1],"baseLayers":[16]}]]],["dso-map-overlays.cjs",[[1,"dso-map-overlays",{"group":[1],"overlays":[16]}]]],["dso-annotation-output.cjs",[[4,"dso-annotation-output",{"identifier":[1],"annotationPrefix":[1,"annotation-prefix"],"toggleAnnotation":[64]}]]],["dso-toggletip.cjs",[[1,"dso-toggletip",{"label":[1],"position":[1],"small":[4],"secondary":[4],"active":[32]}]]],["dso-expandable-heading.cjs",[[1,"dso-expandable-heading",{"open":[4],"heading":[1],"color":[1]}]]],["dso-header.cjs",[[6,"dso-header",{"mainMenu":[16],"useDropDownMenu":[1,"use-drop-down-menu"],"authStatus":[1,"auth-status"],"loginUrl":[1,"login-url"],"logoutUrl":[1,"logout-url"],"userProfileName":[1,"user-profile-name"],"userProfileUrl":[1,"user-profile-url"],"userHomeUrl":[1,"user-home-url"],"showDropDown":[32],"hasSubLogo":[32],"overflowMenuItems":[32]}]]],["dso-label.cjs",[[1,"dso-label",{"compact":[4],"removable":[4],"status":[1],"truncate":[4],"removeHover":[32],"removeFocus":[32],"textHover":[32],"textFocus":[32],"isTruncated":[32],"labelText":[32],"truncateLabel":[64],"syncLabelText":[64]}]]],["dso-pagination.cjs",[[1,"dso-pagination",{"totalPages":[2,"total-pages"],"currentPage":[2,"current-page"],"formatHref":[16],"availablePositions":[32]},[[0,"dsoSizeChange","sizeChangeHandler"]]]]],["dso-tree-view.cjs",[[1,"dso-tree-view",{"collection":[16],"focusItem":[64]}]]],["dso-accordion-section.cjs",[[1,"dso-accordion-section",{"handleTitle":[1,"handle-title"],"heading":[1],"handleUrl":[1,"handle-url"],"state":[1],"attachmentCount":[2,"attachment-count"],"icon":[1],"status":[1],"open":[1540],"hasNestedSection":[32],"toggleSection":[64],"scrollSectionIntoView":[64]}]]],["dso-alert.cjs",[[1,"dso-alert",{"status":[1],"roleAlert":[4,"role-alert"]}]]],["dso-annotation-button.cjs",[[0,"dso-annotation-button",{"identifier":[1]}]]],["dso-attachments-counter.cjs",[[1,"dso-attachments-counter",{"count":[2]}]]],["dso-autosuggest.cjs",[[6,"dso-autosuggest",{"suggestions":[16],"loading":[4],"loadingLabel":[1,"loading-label"],"loadingDelayed":[2,"loading-delayed"],"notFoundLabel":[1,"not-found-label"],"suggestOnFocus":[4,"suggest-on-focus"],"showSuggestions":[32],"selectedSuggestion":[32],"notFound":[32],"showLoading":[32]},[[4,"click","onDocumentClick"]]]]],["dso-date-picker.cjs",[[2,"dso-date-picker",{"name":[1],"identifier":[1],"disabled":[516],"role":[1],"direction":[1],"required":[4],"invalid":[4],"dsoAutofocus":[4,"dso-autofocus"],"value":[1537],"min":[1],"max":[1],"activeFocus":[32],"focusedDay":[32],"open":[32],"visible":[32],"setFocus":[64],"show":[64],"hide":[64]},[[6,"click","handleDocumentClick"]]]]],["dso-helpcenter-panel.cjs",[[1,"dso-helpcenter-panel",{"label":[1],"url":[1],"visibility":[32],"isOpen":[32],"slideState":[32],"loadIframe":[32]},[[8,"keydown","keyDownListener"]]]]],["dso-image-overlay.cjs",[[1,"dso-image-overlay",{"active":[32],"zoomable":[32]},[[2,"load","loadListener"]]]]],["dso-list-button.cjs",[[1,"dso-list-button",{"label":[1],"sublabel":[1],"subcontent":[1],"count":[2],"min":[8],"max":[8],"checked":[516],"disabled":[516],"manualInputWrapperElement":[32],"manualCount":[32]}]]],["dso-map-controls.cjs",[[1,"dso-map-controls",{"open":[1540],"disableZoom":[1,"disable-zoom"],"hideContent":[32],"toggleVisibility":[64]}]]],["dso-modal.cjs",[[1,"dso-modal",{"modalTitle":[1,"modal-title"],"role":[1],"showCloseButton":[4,"show-close-button"],"initialFocus":[1,"initial-focus"],"ariaId":[32],"hasFooter":[32]}]]],["dso-table.cjs",[[1,"dso-table",{"noModal":[516,"no-modal"],"isResponsive":[516,"is-responsive"],"modalActive":[32],"placeholderHeight":[32]}]]],["dso-viewer-grid.cjs",[[1,"dso-viewer-grid",{"filterpanelOpen":[516,"filterpanel-open"],"overlayOpen":[516,"overlay-open"],"initialMainSize":[1,"initial-main-size"],"mainSize":[32]}]]],["dso-accordion.cjs",[[1,"dso-accordion",{"variant":[513],"reverseAlign":[516,"reverse-align"],"allowMultipleOpen":[516,"allow-multiple-open"],"getState":[64],"toggleSection":[64],"animationEnd":[64],"closeOpenSections":[64]}]]],["dso-badge.cjs",[[1,"dso-badge",{"status":[1]}]]],["dso-banner.cjs",[[1,"dso-banner",{"status":[513]}]]],["dso-card.cjs",[[1,"dso-card",{"isSelectable":[516,"is-selectable"],"hasImage":[516,"has-image"],"clickable":[4],"imageShape":[513,"image-shape"]}]]],["dso-card-container.cjs",[[1,"dso-card-container",{"mode":[513]}]]],["dso-highlight-box.cjs",[[1,"dso-highlight-box",{"yellow":[4],"border":[4],"white":[4],"dropShadow":[4,"drop-shadow"],"step":[2]}]]],["dso-ozon-content.cjs",[[6,"dso-ozon-content",{"content":[1],"inline":[516],"deleted":[516],"interactive":[520],"state":[32]}]]],["dso-progress-bar.cjs",[[1,"dso-progress-bar",{"progress":[2],"min":[2],"max":[2]}]]],["dso-slide-toggle.cjs",[[4,"dso-slide-toggle",{"checked":[4],"disabled":[4],"accessibleLabel":[1,"accessible-label"],"labelledbyId":[1,"labelledby-id"],"identifier":[1],"hasVisibleLabel":[32]}]]],["dso-dropdown-menu.cjs",[[1,"dso-dropdown-menu",{"open":[1540],"dropdownAlign":[1,"dropdown-align"],"checkable":[4],"boundary":[1],"strategy":[1]}]]],["dso-expandable.cjs",[[1,"dso-expandable",{"open":[516]}]]],["dso-progress-indicator.cjs",[[1,"dso-progress-indicator",{"label":[1],"size":[513],"block":[4]}]]],["dso-responsive-element.cjs",[[1,"dso-responsive-element",{"sizeAlias":[32],"sizeWidth":[32],"getSize":[64]}]]],["dso-tooltip.cjs",[[1,"dso-tooltip",{"descriptive":[516],"position":[1],"strategy":[1],"noArrow":[4,"no-arrow"],"stateless":[4],"small":[4],"active":[1540],"hidden":[32],"activate":[64],"deactivate":[64]},[[0,"click","listenClick"]]]]],["dso-info-button.cjs",[[1,"dso-info-button",{"active":[1540],"secondary":[4],"label":[1],"hover":[32],"setFocus":[64]}]]],["dso-info_2.cjs",[[6,"dso-selectable",{"type":[1],"identifier":[1],"name":[1],"value":[1],"invalid":[4],"describedById":[1,"described-by-id"],"labelledById":[1,"labelled-by-id"],"disabled":[4],"required":[4],"checked":[4],"indeterminate":[4],"infoFixed":[4,"info-fixed"],"infoActive":[32],"toggleInfo":[64]}],[1,"dso-info",{"fixed":[516],"active":[516]}]]]], options);
|
|
19
19
|
});
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-ecec64a0.js');
|
|
6
6
|
const hasOverflow = require('./has-overflow-b1b4f3f3.js');
|
|
7
7
|
const clsx_m = require('./clsx.m-b81c6b86.js');
|
|
8
|
+
const index$1 = require('./index-794ad37a.js');
|
|
8
9
|
|
|
9
10
|
var maxSize = {
|
|
10
11
|
name: 'maxSize',
|
|
@@ -42,29 +43,57 @@ var maxSize = {
|
|
|
42
43
|
|
|
43
44
|
const tooltipCss = ":host(.hidden){visibility:hidden}:host-context(dso-toggletip){color:red !important}:host-context(dso-toggletip) *[data-popper-placement=top] .tooltip-arrow{margin-left:3px}:host-context(dso-toggletip) *[data-popper-placement=right] .tooltip-arrow{margin-top:0}:host-context(dso-toggletip) *[data-popper-placement=bottom] .tooltip-arrow{margin-left:3px}:host-context(dso-toggletip) *[data-popper-placement=left]{margin-right:-8px !important}:host-context(dso-toggletip) *[data-popper-placement=left] .tooltip-arrow{margin-top:0}*,*::after,*::before{box-sizing:border-box}.tooltip{font-family:Asap, sans-serif;font-style:normal;font-weight:400;line-height:1.5;line-break:auto;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;display:block;filter:drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));font-size:14px;opacity:0;position:absolute;transition:opacity 0.15s linear;z-index:410}.tooltip.in{opacity:1}.tooltip .tooltip-inner{background-color:#fff;border-radius:4px;color:#191919;display:inline-block;font-size:1rem;max-width:640px;padding:8px 16px;position:relative}.tooltip .tooltip-inner.dso-small{max-width:320px}.tooltip .tooltip-arrow{border-color:transparent;border-style:solid;height:0;width:0}.tooltip[data-popper-placement=top]{margin-top:-3px;padding:6px 0}.tooltip[data-popper-placement=top] .tooltip-arrow{border-top-color:#fff;border-width:6px 6px 0;bottom:0}.tooltip[data-popper-placement=top] .tooltip-arrow{margin-left:-3px}.tooltip[data-popper-placement=right]{margin-left:3px;padding:0 6px}.tooltip[data-popper-placement=right] .tooltip-arrow{border-right-color:#fff;border-width:6px 6px 6px 0;left:0}.tooltip[data-popper-placement=right] .tooltip-arrow{margin-top:-3px}.tooltip[data-popper-placement=bottom]{margin-top:3px;padding:6px 0}.tooltip[data-popper-placement=bottom] .tooltip-arrow{border-bottom-color:#fff;border-width:0 6px 6px;top:0}.tooltip[data-popper-placement=bottom] .tooltip-arrow{margin-left:-3px}.tooltip[data-popper-placement=left]{margin-left:-3px;padding:0 6px}.tooltip[data-popper-placement=left] .tooltip-arrow{border-left-color:#fff;border-width:6px 0 6px 6px;right:0}.tooltip[data-popper-placement=left] .tooltip-arrow{margin-top:-3px}";
|
|
44
45
|
|
|
46
|
+
var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
47
|
+
if (kind === "a" && !f)
|
|
48
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
49
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
50
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
51
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
52
|
+
};
|
|
53
|
+
var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
54
|
+
if (kind === "m")
|
|
55
|
+
throw new TypeError("Private method is not writable");
|
|
56
|
+
if (kind === "a" && !f)
|
|
57
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
58
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
59
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
60
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
61
|
+
};
|
|
62
|
+
var _Tooltip_target;
|
|
45
63
|
// Keep const in sync with $tooltip-transition-duration in dso-toolkit/src/components/tooltip/tooltip.scss tooltip_root() mixin
|
|
46
64
|
const transitionDuration = 150;
|
|
65
|
+
const applyMaxSize = {
|
|
66
|
+
name: "applyMaxSize",
|
|
67
|
+
enabled: true,
|
|
68
|
+
phase: hasOverflow.beforeWrite,
|
|
69
|
+
requires: ["maxSize"],
|
|
70
|
+
fn({ state }) {
|
|
71
|
+
let { width } = state.modifiersData.maxSize;
|
|
72
|
+
if (width < 160) {
|
|
73
|
+
width = 160;
|
|
74
|
+
}
|
|
75
|
+
state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), { maxWidth: `${width}px` });
|
|
76
|
+
},
|
|
77
|
+
};
|
|
47
78
|
const Tooltip = class {
|
|
48
79
|
constructor(hostRef) {
|
|
49
80
|
index.registerInstance(this, hostRef);
|
|
50
|
-
this.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
phase: hasOverflow.beforeWrite,
|
|
54
|
-
requires: ["maxSize"],
|
|
55
|
-
fn({ state }) {
|
|
56
|
-
let { width } = state.modifiersData.maxSize;
|
|
57
|
-
if (width < 160) {
|
|
58
|
-
width = 160;
|
|
59
|
-
}
|
|
60
|
-
state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), { maxWidth: `${width}px` });
|
|
61
|
-
},
|
|
81
|
+
this.callbacks = {
|
|
82
|
+
activate: () => (this.active = true),
|
|
83
|
+
deactivate: () => (this.active = false),
|
|
62
84
|
};
|
|
63
85
|
this.keyDownListener = (event) => {
|
|
64
86
|
if (event.key === "Escape") {
|
|
65
87
|
this.deactivate();
|
|
66
88
|
}
|
|
67
89
|
};
|
|
90
|
+
this.deactivatePopper = index$1.debounce_1(() => {
|
|
91
|
+
var _a;
|
|
92
|
+
this.hidden = true;
|
|
93
|
+
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
94
|
+
this.popper = undefined;
|
|
95
|
+
}, transitionDuration);
|
|
96
|
+
_Tooltip_target.set(this, void 0);
|
|
68
97
|
this.descriptive = false;
|
|
69
98
|
this.position = "top";
|
|
70
99
|
this.strategy = "auto";
|
|
@@ -122,9 +151,8 @@ const Tooltip = class {
|
|
|
122
151
|
});
|
|
123
152
|
}
|
|
124
153
|
watchActive() {
|
|
125
|
-
var _a;
|
|
126
154
|
if (this.active) {
|
|
127
|
-
this.
|
|
155
|
+
this.activatePopper();
|
|
128
156
|
if (!this.stateless) {
|
|
129
157
|
setTimeout(() => {
|
|
130
158
|
var _a;
|
|
@@ -136,13 +164,8 @@ const Tooltip = class {
|
|
|
136
164
|
}
|
|
137
165
|
}
|
|
138
166
|
else {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
modifiers: [{ name: "eventListeners", enabled: false }],
|
|
142
|
-
});
|
|
143
|
-
document.removeEventListener("keydown", this.keyDownListener);
|
|
144
|
-
}
|
|
145
|
-
setTimeout(() => (this.hidden = true), transitionDuration);
|
|
167
|
+
document.removeEventListener("keydown", this.keyDownListener);
|
|
168
|
+
this.deactivatePopper();
|
|
146
169
|
}
|
|
147
170
|
}
|
|
148
171
|
listenClick(e) {
|
|
@@ -150,25 +173,10 @@ const Tooltip = class {
|
|
|
150
173
|
}
|
|
151
174
|
componentDidLoad() {
|
|
152
175
|
var _a;
|
|
153
|
-
if (this.popper) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
176
|
const tooltip = (_a = this.element.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".tooltip");
|
|
157
177
|
if (!(tooltip instanceof HTMLElement)) {
|
|
158
178
|
throw new Error("tooltip element is not instanceof HTMLElement");
|
|
159
179
|
}
|
|
160
|
-
if (!this.element.id) {
|
|
161
|
-
throw new Error("Unable to find reference tooltip has no [id] attribute.");
|
|
162
|
-
}
|
|
163
|
-
this.target = this.getTarget(this.element.id);
|
|
164
|
-
this.popper = hasOverflow.createPopper(this.target, tooltip, {
|
|
165
|
-
placement: this.position,
|
|
166
|
-
modifiers: [maxSize, this.applyMaxSize],
|
|
167
|
-
});
|
|
168
|
-
this.callbacks = {
|
|
169
|
-
activate: () => (this.active = true),
|
|
170
|
-
deactivate: () => (this.active = false),
|
|
171
|
-
};
|
|
172
180
|
if (!this.stateless) {
|
|
173
181
|
this.target.addEventListener("mouseenter", this.callbacks.activate);
|
|
174
182
|
this.target.addEventListener("mouseleave", this.callbacks.deactivate);
|
|
@@ -179,18 +187,16 @@ const Tooltip = class {
|
|
|
179
187
|
disconnectedCallback() {
|
|
180
188
|
var _a;
|
|
181
189
|
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
182
|
-
if (!this.stateless && this.target
|
|
190
|
+
if (!this.stateless && this.target) {
|
|
183
191
|
this.target.removeEventListener("mouseenter", this.callbacks.activate);
|
|
184
192
|
this.target.removeEventListener("mouseleave", this.callbacks.deactivate);
|
|
185
193
|
this.target.removeEventListener("focus", this.callbacks.activate);
|
|
186
194
|
this.target.removeEventListener("blur", this.callbacks.deactivate);
|
|
187
195
|
}
|
|
188
|
-
this.callbacks = undefined;
|
|
189
196
|
this.target = undefined;
|
|
190
197
|
}
|
|
191
198
|
componentDidRender() {
|
|
192
199
|
var _a;
|
|
193
|
-
this.setStrategy();
|
|
194
200
|
if (this.active) {
|
|
195
201
|
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.update();
|
|
196
202
|
}
|
|
@@ -198,7 +204,34 @@ const Tooltip = class {
|
|
|
198
204
|
render() {
|
|
199
205
|
return (index.h(index.Host, { class: { hidden: this.hidden }, role: "tooltip" }, index.h("div", { class: clsx_m.clsx("tooltip", { in: this.active }) }, !this.noArrow && index.h("div", { "data-popper-arrow": true, class: "tooltip-arrow" }), index.h("div", { "aria-hidden": !this.descriptive || undefined, class: clsx_m.clsx("tooltip-inner", { "dso-small": this.small }) }, index.h("slot", null)))));
|
|
200
206
|
}
|
|
201
|
-
|
|
207
|
+
activatePopper() {
|
|
208
|
+
var _a;
|
|
209
|
+
this.hidden = false;
|
|
210
|
+
if (this.popper) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const tooltip = (_a = this.element.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".tooltip");
|
|
214
|
+
if (!(tooltip instanceof HTMLElement)) {
|
|
215
|
+
throw new Error("tooltip element is not instanceof HTMLElement");
|
|
216
|
+
}
|
|
217
|
+
this.popper = hasOverflow.createPopper(this.target, tooltip, {
|
|
218
|
+
placement: this.position,
|
|
219
|
+
modifiers: [maxSize, applyMaxSize, { name: "eventListeners", enabled: false }],
|
|
220
|
+
});
|
|
221
|
+
this.setStrategy();
|
|
222
|
+
}
|
|
223
|
+
get target() {
|
|
224
|
+
var _a;
|
|
225
|
+
return (_a = __classPrivateFieldGet(this, _Tooltip_target, "f")) !== null && _a !== void 0 ? _a : this.initializeTarget();
|
|
226
|
+
}
|
|
227
|
+
set target(element) {
|
|
228
|
+
__classPrivateFieldSet(this, _Tooltip_target, element, "f");
|
|
229
|
+
}
|
|
230
|
+
initializeTarget() {
|
|
231
|
+
const id = this.element.id;
|
|
232
|
+
if (!id) {
|
|
233
|
+
throw new Error("Unable to find reference tooltip has no [id] attribute.");
|
|
234
|
+
}
|
|
202
235
|
const rootNode = this.element.getRootNode();
|
|
203
236
|
if (!(rootNode instanceof Document || rootNode instanceof ShadowRoot)) {
|
|
204
237
|
throw new Error(`rootNode is not instance of Document or ShadowRoot`);
|
|
@@ -207,6 +240,7 @@ const Tooltip = class {
|
|
|
207
240
|
if (!reference) {
|
|
208
241
|
throw new Error(`Unable to find reference with aria-describedby ${id}`);
|
|
209
242
|
}
|
|
243
|
+
__classPrivateFieldSet(this, _Tooltip_target, reference, "f");
|
|
210
244
|
return reference;
|
|
211
245
|
}
|
|
212
246
|
get element() { return index.getElement(this); }
|
|
@@ -216,6 +250,7 @@ const Tooltip = class {
|
|
|
216
250
|
"active": ["watchActive"]
|
|
217
251
|
}; }
|
|
218
252
|
};
|
|
253
|
+
_Tooltip_target = new WeakMap();
|
|
219
254
|
Tooltip.style = tooltipCss;
|
|
220
255
|
|
|
221
256
|
exports.dso_tooltip = Tooltip;
|
|
@@ -135,7 +135,7 @@ const ViewerGrid = class {
|
|
|
135
135
|
this.dsoFilterpanelCancel.emit({ originalEvent: mouseEvent });
|
|
136
136
|
}
|
|
137
137
|
render() {
|
|
138
|
-
return (index.h(index.Host, Object.assign({}, { [this.mainSize]: true }), index.h("div", { class: "dso-map-panel", ref: (element) => (this.mapPanel = element) }, index.h("div", { class: "sizing-buttons" }, index.h("span", { class: "sr-only", "aria-live": "polite", "aria-atomic": "true" }, "breedte tekstpaneel: ", this.sizeLabelMap[this.mainSize]), index.h("button", { type: "button", class: "shrink", disabled: this.mainSize === "small", onClick: this.shrinkMain }, index.h("span", { class: "sr-only" }, "Kaartpaneel smaller maken"), index.h("dso-icon", { icon: "chevron-left" })), index.h("button", { type: "button", class: "expand", disabled: this.mainSize === "large", onClick: this.expandMain }, index.h("span", { class: "sr-only" }, "Kaartpaneel breder maken"), index.h("dso-icon", { icon: "chevron-right" }))), index.h("div", { class: "main" }, index.h("slot", { name: "main" }))), index.h("div", { id: "filterpanel", class: "filterpanel", hidden: !this.filterpanelOpen || !this.filterpanelSlot, ref: (element) => (this.filterpanel = element) }, index.h("
|
|
138
|
+
return (index.h(index.Host, Object.assign({}, { [this.mainSize]: true }), index.h("div", { class: "dso-map-panel", ref: (element) => (this.mapPanel = element) }, index.h("div", { class: "sizing-buttons" }, index.h("span", { class: "sr-only", "aria-live": "polite", "aria-atomic": "true" }, "breedte tekstpaneel: ", this.sizeLabelMap[this.mainSize]), index.h("button", { type: "button", class: "shrink", disabled: this.mainSize === "small", onClick: this.shrinkMain }, index.h("span", { class: "sr-only" }, "Kaartpaneel smaller maken"), index.h("dso-icon", { icon: "chevron-left" })), index.h("button", { type: "button", class: "expand", disabled: this.mainSize === "large", onClick: this.expandMain }, index.h("span", { class: "sr-only" }, "Kaartpaneel breder maken"), index.h("dso-icon", { icon: "chevron-right" }))), index.h("div", { class: "main" }, index.h("slot", { name: "main" }))), index.h("div", { id: "filterpanel", class: "filterpanel", hidden: !this.filterpanelOpen || !this.filterpanelSlot, ref: (element) => (this.filterpanel = element) }, index.h("h1", null, "Uw keuzes"), index.h(ViewerGridFilterpanelButtons, { onApply: (e) => this.handleFilterpanelApply(e), onCancel: (e) => this.handleFilterpanelCancel(e) }), index.h("slot", { name: "filterpanel" }), index.h(ViewerGridFilterpanelButtons, { onApply: (e) => this.handleFilterpanelApply(e), onCancel: (e) => this.handleFilterpanelCancel(e) })), index.h("div", { class: "map" }, index.h("slot", { name: "map" })), index.h("div", { hidden: !this.overlayOpen || !this.overlaySlot, class: "dimscreen" }), index.h("div", { class: "overlay", hidden: !this.overlayOpen || !this.overlaySlot, ref: (element) => (this.overlay = element) }, index.h("button", { type: "button", class: "overlay-close-button", onClick: (e) => this.dsoCloseOverlay.emit(e) }, index.h("dso-icon", { icon: "times" }), index.h("span", { class: "sr-only" }, "sluiten")), index.h("slot", { name: "overlay" }), index.h("button", { "aria-hidden": "true", type: "button", class: "overlay-close-button", style: { zIndex: "-100" } }, index.h("dso-icon", { icon: "times" }), index.h("span", { class: "sr-only" }, "sluiten")))));
|
|
139
139
|
}
|
|
140
140
|
get host() { return index.getElement(this); }
|
|
141
141
|
static get watchers() { return {
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["dso-icon.cjs",[[1,"dso-icon",{"icon":[1]}]]],["dso-map-base-layers.cjs",[[1,"dso-map-base-layers",{"group":[1],"baseLayers":[16]}]]],["dso-map-overlays.cjs",[[1,"dso-map-overlays",{"group":[1],"overlays":[16]}]]],["dso-annotation-output.cjs",[[4,"dso-annotation-output",{"identifier":[1],"annotationPrefix":[1,"annotation-prefix"],"toggleAnnotation":[64]}]]],["dso-toggletip.cjs",[[1,"dso-toggletip",{"label":[1],"position":[1],"small":[4],"secondary":[4],"active":[32]}]]],["dso-expandable-heading.cjs",[[1,"dso-expandable-heading",{"open":[4],"heading":[1],"color":[1]}]]],["dso-header.cjs",[[6,"dso-header",{"mainMenu":[16],"useDropDownMenu":[1,"use-drop-down-menu"],"authStatus":[1,"auth-status"],"loginUrl":[1,"login-url"],"logoutUrl":[1,"logout-url"],"userProfileName":[1,"user-profile-name"],"userProfileUrl":[1,"user-profile-url"],"userHomeUrl":[1,"user-home-url"],"showDropDown":[32],"hasSubLogo":[32],"overflowMenuItems":[32]}]]],["dso-label.cjs",[[1,"dso-label",{"compact":[4],"removable":[4],"status":[1],"truncate":[4],"removeHover":[32],"removeFocus":[32],"textHover":[32],"textFocus":[32],"
|
|
17
|
+
return index.bootstrapLazy([["dso-icon.cjs",[[1,"dso-icon",{"icon":[1]}]]],["dso-map-base-layers.cjs",[[1,"dso-map-base-layers",{"group":[1],"baseLayers":[16]}]]],["dso-map-overlays.cjs",[[1,"dso-map-overlays",{"group":[1],"overlays":[16]}]]],["dso-annotation-output.cjs",[[4,"dso-annotation-output",{"identifier":[1],"annotationPrefix":[1,"annotation-prefix"],"toggleAnnotation":[64]}]]],["dso-toggletip.cjs",[[1,"dso-toggletip",{"label":[1],"position":[1],"small":[4],"secondary":[4],"active":[32]}]]],["dso-expandable-heading.cjs",[[1,"dso-expandable-heading",{"open":[4],"heading":[1],"color":[1]}]]],["dso-header.cjs",[[6,"dso-header",{"mainMenu":[16],"useDropDownMenu":[1,"use-drop-down-menu"],"authStatus":[1,"auth-status"],"loginUrl":[1,"login-url"],"logoutUrl":[1,"logout-url"],"userProfileName":[1,"user-profile-name"],"userProfileUrl":[1,"user-profile-url"],"userHomeUrl":[1,"user-home-url"],"showDropDown":[32],"hasSubLogo":[32],"overflowMenuItems":[32]}]]],["dso-label.cjs",[[1,"dso-label",{"compact":[4],"removable":[4],"status":[1],"truncate":[4],"removeHover":[32],"removeFocus":[32],"textHover":[32],"textFocus":[32],"isTruncated":[32],"labelText":[32],"truncateLabel":[64],"syncLabelText":[64]}]]],["dso-pagination.cjs",[[1,"dso-pagination",{"totalPages":[2,"total-pages"],"currentPage":[2,"current-page"],"formatHref":[16],"availablePositions":[32]},[[0,"dsoSizeChange","sizeChangeHandler"]]]]],["dso-tree-view.cjs",[[1,"dso-tree-view",{"collection":[16],"focusItem":[64]}]]],["dso-accordion-section.cjs",[[1,"dso-accordion-section",{"handleTitle":[1,"handle-title"],"heading":[1],"handleUrl":[1,"handle-url"],"state":[1],"attachmentCount":[2,"attachment-count"],"icon":[1],"status":[1],"open":[1540],"hasNestedSection":[32],"toggleSection":[64],"scrollSectionIntoView":[64]}]]],["dso-alert.cjs",[[1,"dso-alert",{"status":[1],"roleAlert":[4,"role-alert"]}]]],["dso-annotation-button.cjs",[[0,"dso-annotation-button",{"identifier":[1]}]]],["dso-attachments-counter.cjs",[[1,"dso-attachments-counter",{"count":[2]}]]],["dso-autosuggest.cjs",[[6,"dso-autosuggest",{"suggestions":[16],"loading":[4],"loadingLabel":[1,"loading-label"],"loadingDelayed":[2,"loading-delayed"],"notFoundLabel":[1,"not-found-label"],"suggestOnFocus":[4,"suggest-on-focus"],"showSuggestions":[32],"selectedSuggestion":[32],"notFound":[32],"showLoading":[32]},[[4,"click","onDocumentClick"]]]]],["dso-date-picker.cjs",[[2,"dso-date-picker",{"name":[1],"identifier":[1],"disabled":[516],"role":[1],"direction":[1],"required":[4],"invalid":[4],"dsoAutofocus":[4,"dso-autofocus"],"value":[1537],"min":[1],"max":[1],"activeFocus":[32],"focusedDay":[32],"open":[32],"visible":[32],"setFocus":[64],"show":[64],"hide":[64]},[[6,"click","handleDocumentClick"]]]]],["dso-helpcenter-panel.cjs",[[1,"dso-helpcenter-panel",{"label":[1],"url":[1],"visibility":[32],"isOpen":[32],"slideState":[32],"loadIframe":[32]},[[8,"keydown","keyDownListener"]]]]],["dso-image-overlay.cjs",[[1,"dso-image-overlay",{"active":[32],"zoomable":[32]},[[2,"load","loadListener"]]]]],["dso-list-button.cjs",[[1,"dso-list-button",{"label":[1],"sublabel":[1],"subcontent":[1],"count":[2],"min":[8],"max":[8],"checked":[516],"disabled":[516],"manualInputWrapperElement":[32],"manualCount":[32]}]]],["dso-map-controls.cjs",[[1,"dso-map-controls",{"open":[1540],"disableZoom":[1,"disable-zoom"],"hideContent":[32],"toggleVisibility":[64]}]]],["dso-modal.cjs",[[1,"dso-modal",{"modalTitle":[1,"modal-title"],"role":[1],"showCloseButton":[4,"show-close-button"],"initialFocus":[1,"initial-focus"],"ariaId":[32],"hasFooter":[32]}]]],["dso-table.cjs",[[1,"dso-table",{"noModal":[516,"no-modal"],"isResponsive":[516,"is-responsive"],"modalActive":[32],"placeholderHeight":[32]}]]],["dso-viewer-grid.cjs",[[1,"dso-viewer-grid",{"filterpanelOpen":[516,"filterpanel-open"],"overlayOpen":[516,"overlay-open"],"initialMainSize":[1,"initial-main-size"],"mainSize":[32]}]]],["dso-accordion.cjs",[[1,"dso-accordion",{"variant":[513],"reverseAlign":[516,"reverse-align"],"allowMultipleOpen":[516,"allow-multiple-open"],"getState":[64],"toggleSection":[64],"animationEnd":[64],"closeOpenSections":[64]}]]],["dso-badge.cjs",[[1,"dso-badge",{"status":[1]}]]],["dso-banner.cjs",[[1,"dso-banner",{"status":[513]}]]],["dso-card.cjs",[[1,"dso-card",{"isSelectable":[516,"is-selectable"],"hasImage":[516,"has-image"],"clickable":[4],"imageShape":[513,"image-shape"]}]]],["dso-card-container.cjs",[[1,"dso-card-container",{"mode":[513]}]]],["dso-highlight-box.cjs",[[1,"dso-highlight-box",{"yellow":[4],"border":[4],"white":[4],"dropShadow":[4,"drop-shadow"],"step":[2]}]]],["dso-ozon-content.cjs",[[6,"dso-ozon-content",{"content":[1],"inline":[516],"deleted":[516],"interactive":[520],"state":[32]}]]],["dso-progress-bar.cjs",[[1,"dso-progress-bar",{"progress":[2],"min":[2],"max":[2]}]]],["dso-slide-toggle.cjs",[[4,"dso-slide-toggle",{"checked":[4],"disabled":[4],"accessibleLabel":[1,"accessible-label"],"labelledbyId":[1,"labelledby-id"],"identifier":[1],"hasVisibleLabel":[32]}]]],["dso-dropdown-menu.cjs",[[1,"dso-dropdown-menu",{"open":[1540],"dropdownAlign":[1,"dropdown-align"],"checkable":[4],"boundary":[1],"strategy":[1]}]]],["dso-expandable.cjs",[[1,"dso-expandable",{"open":[516]}]]],["dso-progress-indicator.cjs",[[1,"dso-progress-indicator",{"label":[1],"size":[513],"block":[4]}]]],["dso-responsive-element.cjs",[[1,"dso-responsive-element",{"sizeAlias":[32],"sizeWidth":[32],"getSize":[64]}]]],["dso-tooltip.cjs",[[1,"dso-tooltip",{"descriptive":[516],"position":[1],"strategy":[1],"noArrow":[4,"no-arrow"],"stateless":[4],"small":[4],"active":[1540],"hidden":[32],"activate":[64],"deactivate":[64]},[[0,"click","listenClick"]]]]],["dso-info-button.cjs",[[1,"dso-info-button",{"active":[1540],"secondary":[4],"label":[1],"hover":[32],"setFocus":[64]}]]],["dso-info_2.cjs",[[6,"dso-selectable",{"type":[1],"identifier":[1],"name":[1],"value":[1],"invalid":[4],"describedById":[1,"described-by-id"],"labelledById":[1,"labelled-by-id"],"disabled":[4],"required":[4],"checked":[4],"indeterminate":[4],"infoFixed":[4,"info-fixed"],"infoActive":[32],"toggleInfo":[64]}],[1,"dso-info",{"fixed":[516],"active":[516]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import { mutationObserver } from "./mutation-observer";
|
|
4
3
|
import { resizeObserver } from "./resize-observer";
|
|
5
4
|
function hasEllipses(el) {
|
|
6
5
|
return el.scrollWidth > el.clientWidth;
|
|
@@ -22,8 +21,8 @@ export class Label {
|
|
|
22
21
|
this.truncate = undefined;
|
|
23
22
|
this.textHover = undefined;
|
|
24
23
|
this.textFocus = undefined;
|
|
25
|
-
this.
|
|
26
|
-
this.labelText =
|
|
24
|
+
this.isTruncated = undefined;
|
|
25
|
+
this.labelText = null;
|
|
27
26
|
}
|
|
28
27
|
watchTruncate(truncate) {
|
|
29
28
|
if (truncate) {
|
|
@@ -45,44 +44,51 @@ export class Label {
|
|
|
45
44
|
}
|
|
46
45
|
async truncateLabel() {
|
|
47
46
|
setTimeout(() => {
|
|
48
|
-
|
|
49
|
-
this.truncatedContent = hasEllipses(this.labelContent) ? this.host.innerText : undefined;
|
|
50
|
-
}
|
|
47
|
+
this.isTruncated = this.labelContent && hasEllipses(this.labelContent);
|
|
51
48
|
});
|
|
52
49
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.truncateLabel();
|
|
57
|
-
}
|
|
50
|
+
/** **[Internal]** Synchronizes the text on the remove button and tooltip. You should never have to use this. */
|
|
51
|
+
async syncLabelText() {
|
|
52
|
+
this.labelText = this.host.textContent;
|
|
58
53
|
}
|
|
59
54
|
componentDidLoad() {
|
|
60
|
-
this.labelText = this.host.innerText;
|
|
61
|
-
mutationObserver.observe(this.host, {
|
|
62
|
-
attributes: true,
|
|
63
|
-
subtree: true,
|
|
64
|
-
});
|
|
65
55
|
if (this.truncate) {
|
|
66
56
|
this.startTruncate();
|
|
67
57
|
}
|
|
58
|
+
if (this.removable) {
|
|
59
|
+
this.startMutationObserver();
|
|
60
|
+
}
|
|
68
61
|
}
|
|
69
62
|
disconnectedCallback() {
|
|
70
|
-
mutationObserver === null || mutationObserver === void 0 ? void 0 : mutationObserver.disconnect();
|
|
71
63
|
this.stopTruncate();
|
|
72
64
|
}
|
|
65
|
+
/** The mutationObserver fetches the text placed inside the label, this is then used for the remove button and tooltip. */
|
|
66
|
+
startMutationObserver() {
|
|
67
|
+
if (this.mutationObserver) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this.mutationObserver = new MutationObserver((entries) => entries.forEach(() => this.syncLabelText()));
|
|
71
|
+
this.mutationObserver.observe(this.host, {
|
|
72
|
+
characterData: true,
|
|
73
|
+
subtree: true,
|
|
74
|
+
attributes: true,
|
|
75
|
+
});
|
|
76
|
+
this.labelText = this.host.textContent;
|
|
77
|
+
}
|
|
73
78
|
startTruncate() {
|
|
74
79
|
resizeObserver.observe(this.host);
|
|
80
|
+
this.startMutationObserver();
|
|
75
81
|
this.truncateLabel();
|
|
76
82
|
}
|
|
77
83
|
stopTruncate() {
|
|
78
84
|
document.removeEventListener("keydown", this.keyDownListener);
|
|
79
85
|
resizeObserver.unobserve(this.host);
|
|
80
|
-
this.
|
|
86
|
+
this.isTruncated = undefined;
|
|
81
87
|
this.keydownListenerActive = false;
|
|
82
88
|
}
|
|
83
89
|
render() {
|
|
84
90
|
const status = this.status && Label.statusMap.get(this.status);
|
|
85
|
-
return (h(Host, { "aria-roledescription": this.truncate && this.
|
|
91
|
+
return (h(Host, { "aria-roledescription": this.truncate && this.isTruncated
|
|
86
92
|
? "Deze tekst is visueel afgekapt en wordt volledig zichtbaar bij focus."
|
|
87
93
|
: undefined }, h("span", { "aria-describedby": "toggle-anchor", class: clsx("dso-label", {
|
|
88
94
|
[`dso-label-${this.status}`]: this.status,
|
|
@@ -90,7 +96,7 @@ export class Label {
|
|
|
90
96
|
"dso-hover": this.removeHover || this.removeFocus,
|
|
91
97
|
}) }, h("slot", { name: "symbol" }), status && h("span", { class: "sr-only" }, status, ": "), h("span", { class: clsx("dso-label-content", {
|
|
92
98
|
"dso-truncate": !!this.truncate,
|
|
93
|
-
}), ref: (element) => (this.labelContent = element), tabindex: this.truncate && this.
|
|
99
|
+
}), ref: (element) => (this.labelContent = element), tabindex: this.truncate && this.isTruncated ? 0 : undefined, onMouseEnter: () => (this.textHover = true), onMouseLeave: () => (this.textHover = false), onFocus: () => (this.textFocus = true), onBlur: () => (this.textFocus = false) }, h("slot", null)), this.removable && (h("button", { type: "button", onClick: (e) => this.dsoRemoveClick.emit(e), onMouseEnter: () => (this.removeHover = true), onMouseLeave: () => (this.removeHover = false), onFocus: () => (this.removeFocus = true), onBlur: () => (this.removeFocus = false) }, h("span", { class: "sr-only" }, "Verwijder: ", this.labelText), h("dso-icon", { icon: "times" })))), this.isTruncated && (h("dso-tooltip", { stateless: true, id: "toggle-anchor", active: this.textHover || this.textFocus, position: "top", strategy: "absolute" }, this.labelText))));
|
|
94
100
|
}
|
|
95
101
|
static get is() { return "dso-label"; }
|
|
96
102
|
static get encapsulation() { return "shadow"; }
|
|
@@ -182,7 +188,7 @@ export class Label {
|
|
|
182
188
|
"removeFocus": {},
|
|
183
189
|
"textHover": {},
|
|
184
190
|
"textFocus": {},
|
|
185
|
-
"
|
|
191
|
+
"isTruncated": {},
|
|
186
192
|
"labelText": {}
|
|
187
193
|
};
|
|
188
194
|
}
|
|
@@ -226,7 +232,7 @@ export class Label {
|
|
|
226
232
|
"tags": []
|
|
227
233
|
}
|
|
228
234
|
},
|
|
229
|
-
"
|
|
235
|
+
"syncLabelText": {
|
|
230
236
|
"complexType": {
|
|
231
237
|
"signature": "() => Promise<void>",
|
|
232
238
|
"parameters": [],
|
|
@@ -238,7 +244,7 @@ export class Label {
|
|
|
238
244
|
"return": "Promise<void>"
|
|
239
245
|
},
|
|
240
246
|
"docs": {
|
|
241
|
-
"text": "",
|
|
247
|
+
"text": "**[Internal]** Synchronizes the text on the remove button and tooltip. You should never have to use this.",
|
|
242
248
|
"tags": []
|
|
243
249
|
}
|
|
244
250
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (isDsoLabelComponent(
|
|
5
|
-
|
|
1
|
+
import { debounce } from "debounce";
|
|
2
|
+
export const resizeObserver = new ResizeObserver(debounce((entries) => {
|
|
3
|
+
entries.forEach(({ target }) => {
|
|
4
|
+
if (isDsoLabelComponent(target)) {
|
|
5
|
+
target.truncateLabel();
|
|
6
6
|
}
|
|
7
7
|
});
|
|
8
|
-
});
|
|
8
|
+
}, 150));
|
|
9
9
|
function isDsoLabelComponent(element) {
|
|
10
10
|
return element.truncateLabel !== undefined;
|
|
11
11
|
}
|