@dso-toolkit/core 30.1.0 → 32.0.0
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-alert.cjs.entry.js +1 -1
- package/dist/cjs/dso-autosuggest.cjs.entry.js +14 -2
- package/dist/cjs/dso-banner.cjs.entry.js +1 -1
- package/dist/cjs/dso-date-picker.cjs.entry.js +54 -14
- package/dist/cjs/dso-highlight-box.cjs.entry.js +1 -1
- package/dist/cjs/dso-icon.cjs.entry.js +6 -4
- package/dist/cjs/dso-info-button.cjs.entry.js +26 -0
- package/dist/cjs/{dso-info_3.cjs.entry.js → dso-info_2.cjs.entry.js} +1 -21
- package/dist/cjs/dso-label.cjs.entry.js +1 -1
- package/dist/cjs/dso-ozon-content.cjs.entry.js +48 -11
- package/dist/cjs/dso-toggletip.cjs.entry.js +62 -0
- package/dist/cjs/dso-toolkit.cjs.js +1 -1
- package/dist/cjs/dso-tooltip.cjs.entry.js +33 -26
- package/dist/cjs/dso-tree-view.cjs.entry.js +180 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/alert/alert.css +2 -0
- package/dist/collection/components/autosuggest/autosuggest.js +3 -2
- package/dist/collection/components/banner/banner.css +2 -0
- package/dist/collection/components/date-picker/date-localization.js +1 -1
- package/dist/collection/components/date-picker/date-picker.css +0 -3
- package/dist/collection/components/date-picker/date-picker.js +108 -14
- package/dist/collection/components/date-picker/date-picker.template.js +2 -1
- package/dist/collection/components/highlight-box/highlight-box.css +1 -1
- package/dist/collection/components/icon/icon.js +9 -7
- package/dist/collection/components/info/info.css +4 -4
- package/dist/collection/components/info-button/info-button.css +10 -3
- package/dist/collection/components/info-button/info-button.js +18 -1
- package/dist/collection/components/info-button/info-button.template.js +2 -1
- package/dist/collection/components/label/label.decorator.js +6 -0
- package/dist/collection/components/label/label.js +1 -0
- package/dist/collection/components/label/label.template.js +10 -2
- package/dist/collection/components/ozon-content/ozon-content.transformer.js +1 -1
- package/dist/collection/components/toggletip/toggletip.css +8 -0
- package/dist/collection/components/toggletip/toggletip.js +137 -0
- package/dist/collection/components/toggletip/toggletip.template.js +12 -0
- package/dist/collection/components/tooltip/tooltip.css +1 -1
- package/dist/collection/components/tooltip/tooltip.js +49 -25
- package/dist/collection/components/tree-view/tree-item.js +20 -0
- package/dist/collection/components/tree-view/tree-view.css +43 -0
- package/dist/collection/components/tree-view/tree-view.interfaces.js +1 -0
- package/dist/collection/components/tree-view/tree-view.js +239 -0
- package/dist/collection/components/tree-view/tree-view.template.js +11 -0
- package/dist/custom-elements/index.d.ts +12 -0
- package/dist/custom-elements/index.js +402 -69
- package/dist/dso-toolkit/dso-toolkit.css +1 -1
- package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
- package/dist/dso-toolkit/{p-968d9e1d.entry.js → p-19de4cc7.entry.js} +1 -1
- package/dist/dso-toolkit/p-39dae284.entry.js +1 -0
- package/dist/dso-toolkit/p-5665f1ee.entry.js +1 -0
- package/dist/dso-toolkit/{p-eadba8c3.entry.js → p-5a67f3f7.entry.js} +1 -1
- package/dist/dso-toolkit/p-759920d0.entry.js +1 -0
- package/dist/dso-toolkit/{p-d748df48.entry.js → p-83f166b3.entry.js} +1 -1
- package/dist/dso-toolkit/p-9e9f8bcf.entry.js +1 -0
- package/dist/dso-toolkit/p-a52d3623.entry.js +1 -0
- package/dist/dso-toolkit/p-ad8f467f.entry.js +1 -0
- package/dist/dso-toolkit/{p-a2357726.entry.js → p-affe82e6.entry.js} +1 -1
- package/dist/dso-toolkit/{p-ae6209c6.entry.js → p-be5682cc.entry.js} +1 -1
- package/dist/dso-toolkit/p-e03d7741.entry.js +1 -0
- package/dist/dso-toolkit/p-e2dc97c4.entry.js +1 -0
- package/dist/esm/dso-alert.entry.js +1 -1
- package/dist/esm/dso-autosuggest.entry.js +14 -2
- package/dist/esm/dso-banner.entry.js +1 -1
- package/dist/esm/dso-date-picker.entry.js +54 -14
- package/dist/esm/dso-highlight-box.entry.js +1 -1
- package/dist/esm/dso-icon.entry.js +6 -4
- package/dist/esm/dso-info-button.entry.js +22 -0
- package/dist/esm/{dso-info_3.entry.js → dso-info_2.entry.js} +2 -21
- package/dist/esm/dso-label.entry.js +1 -1
- package/dist/esm/dso-ozon-content.entry.js +48 -11
- package/dist/esm/dso-toggletip.entry.js +58 -0
- package/dist/esm/dso-toolkit.js +1 -1
- package/dist/esm/dso-tooltip.entry.js +33 -26
- package/dist/esm/dso-tree-view.entry.js +176 -0
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +20 -0
- package/dist/types/components/date-picker/date-picker.template.d.ts +1 -1
- package/dist/types/components/icon/icon.d.ts +1 -1
- package/dist/types/components/info-button/info-button.d.ts +1 -0
- package/dist/types/components/info-button/info-button.template.d.ts +1 -1
- package/dist/types/components/label/label.decorator.d.ts +3 -0
- package/dist/types/components/label/label.template.d.ts +1 -1
- package/dist/types/components/toggletip/toggletip.d.ts +17 -0
- package/dist/types/components/toggletip/toggletip.template.d.ts +2 -0
- package/dist/types/components/tooltip/tooltip.d.ts +6 -2
- package/dist/types/components/tree-view/tree-item.d.ts +13 -0
- package/dist/types/components/tree-view/tree-view.d.ts +36 -0
- package/dist/types/components/tree-view/tree-view.interfaces.d.ts +24 -0
- package/dist/types/components/tree-view/tree-view.template.d.ts +2 -0
- package/dist/types/components.d.ts +84 -3
- package/package.json +2 -1
- package/dist/dso-toolkit/p-112ed9ac.entry.js +0 -1
- package/dist/dso-toolkit/p-187782ee.entry.js +0 -1
- package/dist/dso-toolkit/p-2c6e9460.entry.js +0 -1
- package/dist/dso-toolkit/p-6fcc89f9.entry.js +0 -1
- package/dist/dso-toolkit/p-c5acf7e2.entry.js +0 -1
|
@@ -1743,7 +1743,7 @@ var createPopper = /*#__PURE__*/popperGenerator({
|
|
|
1743
1743
|
defaultModifiers: defaultModifiers
|
|
1744
1744
|
}); // eslint-disable-next-line import/no-unused-modules
|
|
1745
1745
|
|
|
1746
|
-
const tooltipCss = ":host(:not([hidden])){display:block}*,*::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:1070}.tooltip.in{opacity:0.9}.tooltip .tooltip-inner{background-color:#fff;border-radius:4px;color:#191919;display:inline-block;font-size:16px;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;position:absolute;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;left:50%;margin-left:-6px}.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;margin-top:-6px;top:50%}.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;left:50%;margin-left:-6px;top:0}.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;margin-top:-6px;right:0;top:50%}";
|
|
1746
|
+
const tooltipCss = ":host(:not([hidden])){display:inline-block}*,*::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:1070}.tooltip.in{opacity:0.9}.tooltip .tooltip-inner{background-color:#fff;border-radius:4px;color:#191919;display:inline-block;font-size:16px;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;position:absolute;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;left:50%;margin-left:-6px}.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;margin-top:-6px;top:50%}.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;left:50%;margin-left:-6px;top:0}.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;margin-top:-6px;right:0;top:50%}";
|
|
1747
1747
|
|
|
1748
1748
|
// Keep const in sync with $tooltip-transition-duration in @dso-toolkit/sources/tooltip.scss tooltip_root() mixin
|
|
1749
1749
|
const transitionDuration = 150;
|
|
@@ -1785,8 +1785,25 @@ let Tooltip = class {
|
|
|
1785
1785
|
});
|
|
1786
1786
|
}
|
|
1787
1787
|
watchActive() {
|
|
1788
|
+
var _a;
|
|
1788
1789
|
if (this.active) {
|
|
1789
1790
|
this.hidden = false;
|
|
1791
|
+
if (!this.stateless) {
|
|
1792
|
+
setTimeout(() => {
|
|
1793
|
+
var _a;
|
|
1794
|
+
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.setOptions({
|
|
1795
|
+
modifiers: [{ name: 'eventListeners', enabled: true }]
|
|
1796
|
+
});
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
else {
|
|
1801
|
+
if (!this.stateless) {
|
|
1802
|
+
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.setOptions({
|
|
1803
|
+
modifiers: [{ name: 'eventListeners', enabled: false }]
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
setTimeout(() => (this.hidden = true), transitionDuration);
|
|
1790
1807
|
}
|
|
1791
1808
|
}
|
|
1792
1809
|
listenClick(e) {
|
|
@@ -1806,34 +1823,20 @@ let Tooltip = class {
|
|
|
1806
1823
|
placement: this.position
|
|
1807
1824
|
});
|
|
1808
1825
|
this.callbacks = {
|
|
1809
|
-
activate: () =>
|
|
1810
|
-
|
|
1811
|
-
setTimeout(() => {
|
|
1812
|
-
var _a;
|
|
1813
|
-
this.active = true;
|
|
1814
|
-
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.setOptions({
|
|
1815
|
-
modifiers: [{ name: 'eventListeners', enabled: true }]
|
|
1816
|
-
});
|
|
1817
|
-
});
|
|
1818
|
-
},
|
|
1819
|
-
deactivate: () => {
|
|
1820
|
-
var _a;
|
|
1821
|
-
this.active = false;
|
|
1822
|
-
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.setOptions({
|
|
1823
|
-
modifiers: [{ name: 'eventListeners', enabled: false }]
|
|
1824
|
-
});
|
|
1825
|
-
setTimeout(() => this.hidden = true, transitionDuration);
|
|
1826
|
-
}
|
|
1826
|
+
activate: () => (this.active = true),
|
|
1827
|
+
deactivate: () => (this.active = false)
|
|
1827
1828
|
};
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1829
|
+
if (!this.stateless) {
|
|
1830
|
+
this.target.addEventListener('mouseenter', this.callbacks.activate);
|
|
1831
|
+
this.target.addEventListener('mouseleave', this.callbacks.deactivate);
|
|
1832
|
+
this.target.addEventListener('focus', this.callbacks.activate);
|
|
1833
|
+
this.target.addEventListener('blur', this.callbacks.deactivate);
|
|
1834
|
+
}
|
|
1832
1835
|
}
|
|
1833
1836
|
disconnectedCallback() {
|
|
1834
1837
|
var _a;
|
|
1835
1838
|
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
1836
|
-
if (this.target && this.callbacks) {
|
|
1839
|
+
if (!this.stateless && this.target && this.callbacks) {
|
|
1837
1840
|
this.target.removeEventListener('mouseenter', this.callbacks.activate);
|
|
1838
1841
|
this.target.removeEventListener('mouseleave', this.callbacks.deactivate);
|
|
1839
1842
|
this.target.removeEventListener('focus', this.callbacks.activate);
|
|
@@ -1849,14 +1852,18 @@ let Tooltip = class {
|
|
|
1849
1852
|
}
|
|
1850
1853
|
}
|
|
1851
1854
|
render() {
|
|
1852
|
-
return (index.h(index.Host, { hidden: this.hidden }, index.h("div", { class: clsx_m.clsx('tooltip', { in: this.active }), role: "tooltip" }, !this.noArrow &&
|
|
1855
|
+
return (index.h(index.Host, { hidden: this.hidden }, index.h("div", { class: clsx_m.clsx('tooltip', { in: this.active }), role: "tooltip" }, !this.noArrow && index.h("div", { class: "tooltip-arrow" }), index.h("div", { class: clsx_m.clsx('tooltip-inner', { 'dso-small': this.small }) }, index.h("slot", null)))));
|
|
1853
1856
|
}
|
|
1854
1857
|
getTarget() {
|
|
1855
1858
|
if (this.for instanceof HTMLElement) {
|
|
1856
1859
|
return this.for;
|
|
1857
1860
|
}
|
|
1858
1861
|
if (typeof this.for === 'string') {
|
|
1859
|
-
const
|
|
1862
|
+
const rootNode = this.element.getRootNode();
|
|
1863
|
+
if (!(rootNode instanceof Document || rootNode instanceof ShadowRoot)) {
|
|
1864
|
+
throw new Error(`rootNode is not instance of Document or ShadowRoot`);
|
|
1865
|
+
}
|
|
1866
|
+
const reference = rootNode.getElementById(this.for);
|
|
1860
1867
|
if (!reference) {
|
|
1861
1868
|
throw new Error(`Unable to find reference with id ${this.for}`);
|
|
1862
1869
|
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-fcdfdd38.js');
|
|
6
|
+
const clsx_m = require('./clsx.m-b00fa5e1.js');
|
|
7
|
+
|
|
8
|
+
const DsoTreeItem = ({ owner, ancestors, item, index: index$1, level, setSize }) => {
|
|
9
|
+
var _a, _b, _c;
|
|
10
|
+
return (index.h("li", { key: item.reference, class: clsx_m.clsx('tree-item', { 'has-child': item.hasItems }), role: 'none' },
|
|
11
|
+
index.h("div", { class: "tree-branch-control" }, item.hasItems
|
|
12
|
+
?
|
|
13
|
+
index.h("div", { onClick: (e) => owner.itemClick(e, ancestors, item) },
|
|
14
|
+
index.h("dso-icon", { icon: item.open ? 'chevron-down' : 'chevron-right' }))
|
|
15
|
+
: index.h("dso-icon", null)),
|
|
16
|
+
index.h("p", { class: "tree-content", tabindex: level === 1 && index$1 === 0 ? 0 : -1, role: "treeitem", "aria-expanded": item.hasItems ? '' + (!!item.open && !!((_a = item.items) === null || _a === void 0 ? void 0 : _a.length)) : undefined, "aria-level": level, "aria-setsize": setSize, "aria-posinset": index$1 + 1, "aria-busy": item.loading ? 'true' : undefined, onClick: (e) => owner.itemClick(e, ancestors, item) },
|
|
17
|
+
item.href
|
|
18
|
+
? index.h("a", { href: item.href, tabindex: "-1" }, item.label)
|
|
19
|
+
: index.h("span", null, item.label), (_b = item.icons) === null || _b === void 0 ? void 0 :
|
|
20
|
+
_b.map((icon) => index.h("dso-icon", { icon: icon.icon, title: icon.label }))),
|
|
21
|
+
item.open &&
|
|
22
|
+
index.h(index.Fragment, null, item.hasItems && !item.items && item.loading
|
|
23
|
+
? index.h("dso-progress-indicator", { size: "small", label: "Resultaten laden: een moment geduld alstublieft." })
|
|
24
|
+
: index.h("ul", { role: "group" }, (_c = item.items) === null || _c === void 0 ? void 0 : _c.map((childItem, index$1, org) => index.h(DsoTreeItem, { owner: owner, ancestors: [...ancestors, item], item: childItem, index: index$1, level: level + 1, setSize: org.length }))))));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const treeViewCss = ":host ul{list-style-type:none}:host ul[role=tree]{padding-left:0}:host li[role=treeitem]>ul{padding-left:1.5em}:host .tree-branch-control{cursor:pointer;display:inline-block}:host .tree-content{cursor:pointer;display:inline-block;margin:8px 0}:host .tree-content a,:host .tree-content a:visited{color:#39870c;text-decoration:none}:host .tree-content a:hover,:host .tree-content a:focus{color:#676cb0;text-decoration:underline}:host .tree-content a:active{text-decoration:none}:host .tree-content dso-icon{vertical-align:text-bottom;font-size:0.75em;margin-left:0.5em}*,*::after,*::before{box-sizing:border-box}";
|
|
28
|
+
|
|
29
|
+
let TreeView = class {
|
|
30
|
+
constructor(hostRef) {
|
|
31
|
+
index.registerInstance(this, hostRef);
|
|
32
|
+
this.openItem = index.createEvent(this, "openItem", 7);
|
|
33
|
+
this.closeItem = index.createEvent(this, "closeItem", 7);
|
|
34
|
+
this.clickItem = index.createEvent(this, "clickItem", 7);
|
|
35
|
+
this.keyDownListener = (event) => {
|
|
36
|
+
if (event.defaultPrevented) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const isIndexLetter = (str) => str.length === 1 && str.match(/\S/);
|
|
40
|
+
const tree = event.composedPath().find(item => (item instanceof HTMLElement) ? item.className === 'dso-tree' : false);
|
|
41
|
+
if (!(event.target instanceof HTMLParagraphElement) || !(tree instanceof HTMLElement)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
switch (event.key) {
|
|
45
|
+
case "ArrowDown":
|
|
46
|
+
TreeView.moveFocus(tree, event.target, 'next');
|
|
47
|
+
break;
|
|
48
|
+
case "ArrowUp":
|
|
49
|
+
TreeView.moveFocus(tree, event.target, 'previous');
|
|
50
|
+
break;
|
|
51
|
+
case "ArrowRight":
|
|
52
|
+
TreeView.expandItemOrFocusChild(tree, event.target);
|
|
53
|
+
break;
|
|
54
|
+
case "ArrowLeft":
|
|
55
|
+
TreeView.collapseItemOrFocusParent(tree, event.target);
|
|
56
|
+
break;
|
|
57
|
+
case "End":
|
|
58
|
+
TreeView.moveFocus(tree, event.target, 'last');
|
|
59
|
+
break;
|
|
60
|
+
case "Home":
|
|
61
|
+
TreeView.moveFocus(tree, event.target, 'first');
|
|
62
|
+
break;
|
|
63
|
+
case "Enter":
|
|
64
|
+
case " ":
|
|
65
|
+
event.target.click();
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
if (isIndexLetter(event.key)) {
|
|
69
|
+
if (TreeView.setFocusByFirstCharacter(tree, event.target, event.key, event.shiftKey)) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
};
|
|
77
|
+
this.itemClick = (event, ancestors, item) => {
|
|
78
|
+
if (!(event.target instanceof HTMLElement)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const contentElement = event.target.closest('.tree-content');
|
|
82
|
+
if (contentElement) {
|
|
83
|
+
const tree = event.composedPath().find(item => (item instanceof HTMLElement) ? item.className === 'dso-tree' : false);
|
|
84
|
+
if (!(contentElement instanceof HTMLParagraphElement) || !(tree instanceof HTMLElement)) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
TreeView.setFocus(tree, contentElement);
|
|
88
|
+
this.clickItem.emit([...ancestors, item]);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (item.open) {
|
|
92
|
+
this.closeItem.emit([...ancestors, item]);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.openItem.emit([...ancestors, item]);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
static setFocus(tree, target) {
|
|
100
|
+
if (target) {
|
|
101
|
+
Array.from(tree.querySelectorAll('p'))
|
|
102
|
+
.filter(item => item.tabIndex === 0)
|
|
103
|
+
.forEach(item => item.tabIndex = -1);
|
|
104
|
+
target.tabIndex = 0;
|
|
105
|
+
target.focus();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
static moveFocus(tree, el, moveTo) {
|
|
109
|
+
const focusableItems = Array.from(tree.querySelectorAll('p'))
|
|
110
|
+
.filter(item => item.offsetWidth > 0 && item.offsetHeight > 0);
|
|
111
|
+
let index = 0;
|
|
112
|
+
switch (moveTo) {
|
|
113
|
+
case 'first':
|
|
114
|
+
index = 0;
|
|
115
|
+
break;
|
|
116
|
+
case 'previous':
|
|
117
|
+
index = focusableItems.indexOf(el) - 1;
|
|
118
|
+
break;
|
|
119
|
+
case 'next':
|
|
120
|
+
index = focusableItems.indexOf(el) + 1;
|
|
121
|
+
break;
|
|
122
|
+
case 'last':
|
|
123
|
+
index = focusableItems.length - 1;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
TreeView.setFocus(tree, focusableItems[index]);
|
|
127
|
+
}
|
|
128
|
+
static expandItemOrFocusChild(tree, target) {
|
|
129
|
+
var _a;
|
|
130
|
+
if ((target === null || target === void 0 ? void 0 : target.getAttribute('aria-expanded')) === 'true') {
|
|
131
|
+
TreeView.moveFocus(tree, target, 'next');
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
const controlElement = (_a = target.previousElementSibling) === null || _a === void 0 ? void 0 : _a.firstElementChild;
|
|
135
|
+
if (controlElement instanceof HTMLElement) {
|
|
136
|
+
controlElement.click();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
static collapseItemOrFocusParent(tree, target) {
|
|
141
|
+
var _a, _b, _c;
|
|
142
|
+
if ((target === null || target === void 0 ? void 0 : target.getAttribute('aria-expanded')) === 'true') {
|
|
143
|
+
const controlElement = (_a = target.previousElementSibling) === null || _a === void 0 ? void 0 : _a.firstElementChild;
|
|
144
|
+
if (controlElement instanceof HTMLElement) {
|
|
145
|
+
controlElement.click();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const parentTarget = (_c = (_b = target === null || target === void 0 ? void 0 : target.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.previousElementSibling;
|
|
150
|
+
if (parentTarget instanceof HTMLElement) {
|
|
151
|
+
TreeView.setFocus(tree, parentTarget);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
static setFocusByFirstCharacter(tree, el, char, backwards) {
|
|
156
|
+
const focusableItems = Array.from(tree.querySelectorAll('p'))
|
|
157
|
+
.filter(item => item.offsetWidth > 0 && item.offsetHeight > 0);
|
|
158
|
+
if (backwards) {
|
|
159
|
+
focusableItems.reverse();
|
|
160
|
+
}
|
|
161
|
+
const current = focusableItems.indexOf(el);
|
|
162
|
+
char = char.toLowerCase();
|
|
163
|
+
let nextItem = focusableItems.find((item, index) => { var _a; return index > current && ((_a = item.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase().startsWith(char)); });
|
|
164
|
+
if (!nextItem) {
|
|
165
|
+
nextItem = focusableItems.find((item, index) => { var _a; return index < current && ((_a = item.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase().startsWith(char)); });
|
|
166
|
+
}
|
|
167
|
+
if (nextItem) {
|
|
168
|
+
TreeView.setFocus(tree, nextItem);
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
render() {
|
|
174
|
+
var _a;
|
|
175
|
+
return (index.h("div", { id: "tree", class: "dso-tree", onKeyDown: (e) => this.keyDownListener(e) }, index.h("ul", { role: "tree", "aria-label": "Objectenboom" }, (_a = this.collection) === null || _a === void 0 ? void 0 : _a.map((item, index$1) => index.h(DsoTreeItem, { owner: this, ancestors: [], item: item, index: index$1, level: 1, setSize: this.collection.length })))));
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
TreeView.style = treeViewCss;
|
|
179
|
+
|
|
180
|
+
exports.dso_tree_view = TreeView;
|
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-map-base-layers.cjs",[[1,"dso-map-base-layers",{"baseLayers":[16],"selectedBaseLayer":[1040]}]]],["dso-map-overlays.cjs",[[1,"dso-map-overlays",{"overlays":[16],"checkedOverlays":[1040]}]]],["dso-date-picker.cjs",[[1,"dso-date-picker",{"name":[1],"identifier":[1],"disabled":[516],"role":[1],"direction":[1],"required":[4],"value":[
|
|
17
|
+
return index.bootstrapLazy([["dso-map-base-layers.cjs",[[1,"dso-map-base-layers",{"baseLayers":[16],"selectedBaseLayer":[1040]}]]],["dso-map-overlays.cjs",[[1,"dso-map-overlays",{"overlays":[16],"checkedOverlays":[1040]}]]],["dso-toggletip.cjs",[[1,"dso-toggletip",{"label":[1],"position":[1],"small":[4],"secondary":[4],"active":[32]}]]],["dso-tree-view.cjs",[[1,"dso-tree-view",{"collection":[16]}]]],["dso-date-picker.cjs",[[1,"dso-date-picker",{"name":[1],"identifier":[1],"disabled":[516],"role":[1],"direction":[1],"required":[4],"dsoAutofocus":[4,"dso-autofocus"],"value":[1537],"min":[1],"max":[1],"activeFocus":[32],"focusedDay":[32],"open":[32],"setFocus":[64],"show":[64],"hide":[64]},[[6,"click","handleDocumentClick"]]]]],["dso-label.cjs",[[1,"dso-label",{"compact":[4],"removable":[4],"status":[1],"hover":[32]}]]],["dso-map-controls.cjs",[[1,"dso-map-controls",{"open":[1540],"disableZoom":[1,"disable-zoom"],"hideContent":[32]}]]],["dso-alert.cjs",[[1,"dso-alert",{"status":[1],"roleAlert":[4,"role-alert"]}]]],["dso-attachments-counter.cjs",[[1,"dso-attachments-counter",{"count":[2]}]]],["dso-autosuggest.cjs",[[6,"dso-autosuggest",{"suggestions":[16],"suggestOnFocus":[4,"suggest-on-focus"],"showSuggestions":[32],"selectedSuggestion":[32]},[[4,"click","onDocumentClick"]]]]],["dso-badge.cjs",[[1,"dso-badge",{"status":[1]}]]],["dso-banner.cjs",[[1,"dso-banner",{"status":[1]}]]],["dso-dropdown-menu.cjs",[[1,"dso-dropdown-menu",{"open":[1540],"dropdownAlign":[1,"dropdown-align"],"checkable":[4]}]]],["dso-highlight-box.cjs",[[1,"dso-highlight-box",{"yellow":[4],"border":[4],"white":[4],"dropShadow":[4,"drop-shadow"],"step":[2]}]]],["dso-ozon-content.cjs",[[0,"dso-ozon-content",{"content":[1]},[[0,"click","handleClick"]]]]],["dso-progress-bar.cjs",[[1,"dso-progress-bar",{"progress":[2],"min":[2],"max":[2]}]]],["dso-progress-indicator.cjs",[[1,"dso-progress-indicator",{"label":[1],"size":[1],"block":[4]}]]],["dso-tooltip.cjs",[[1,"dso-tooltip",{"position":[1],"for":[1],"noArrow":[4,"no-arrow"],"stateless":[4],"small":[4],"active":[1540],"hidden":[32],"activate":[64],"deactivate":[64]},[[0,"click","listenClick"]]]]],["dso-icon.cjs",[[1,"dso-icon",{"icon":[1]}]]],["dso-info-button.cjs",[[1,"dso-info-button",{"active":[1540],"secondary":[4],"label":[1]}]]],["dso-info_2.cjs",[[1,"dso-selectable",{"type":[1],"identifier":[1],"name":[1],"value":[1],"invalid":[4],"describedById":[1,"described-by-id"],"disabled":[4],"required":[4],"checked":[4],"indeterminate":[4],"infoFixed":[4,"info-fixed"],"infoActive":[32]}],[1,"dso-info",{"fixed":[516],"active":[516]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
"./components/ozon-content/ozon-content.js",
|
|
20
20
|
"./components/progress-bar/progress-bar.js",
|
|
21
21
|
"./components/progress-indicator/progress-indicator.js",
|
|
22
|
-
"./components/
|
|
22
|
+
"./components/toggletip/toggletip.js",
|
|
23
|
+
"./components/tooltip/tooltip.js",
|
|
24
|
+
"./components/tree-view/tree-view.js"
|
|
23
25
|
],
|
|
24
26
|
"compiler": {
|
|
25
27
|
"name": "@stencil/core",
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
--di-status-danger: url("data:image/svg+xml,%3csvg id='status-danger-line' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e %3cg%3e %3cpath d='M22.6%2c18.51c.86%2c1.37.29%2c2.49-1.25%2c2.49H2.65C1.11%2c21%2c.54%2c19.88%2c1.4%2c18.51L10.44%2c4a1.7%2c1.7%2c0%2c0%2c1%2c3.12%2c0Z' style='fill: %23ce3f51'/%3e %3cpath d='M12%2c3a1.9%2c1.9%2c0%2c0%2c1%2c1.56%2c1l9%2c14.48c.86%2c1.37.29%2c2.49-1.25%2c2.49H2.65C1.11%2c21%2c.54%2c19.88%2c1.4%2c18.51L10.44%2c4A1.9%2c1.9%2c0%2c0%2c1%2c12%2c3m0-1A2.89%2c2.89%2c0%2c0%2c0%2c9.6%2c3.5L.55%2c18a2.75%2c2.75%2c0%2c0%2c0-.28%2c2.81A2.59%2c2.59%2c0%2c0%2c0%2c2.65%2c22h18.7a2.59%2c2.59%2c0%2c0%2c0%2c2.38-1.21A2.75%2c2.75%2c0%2c0%2c0%2c23.45%2c18L14.4%2c3.5A2.89%2c2.89%2c0%2c0%2c0%2c12%2c2Z' style='fill: white'/%3e %3c/g%3e %3cpath d='M12%2c16a1%2c1%2c0%2c0%2c1-1-.91V8.91a1%2c1%2c0%2c0%2c1%2c2%2c0v6.18A1%2c1%2c0%2c0%2c1%2c12%2c16Zm0%2c1a1%2c1%2c0%2c1%2c0%2c1%2c1A1%2c1%2c0%2c0%2c0%2c12%2c17Z' style='fill: white'/%3e %3c/svg%3e");
|
|
18
18
|
--di-status-warning: url("data:image/svg+xml,%3csvg id='status-warning' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e %3cg%3e %3cpath d='M22.6%2c18.51c.86%2c1.37.29%2c2.49-1.25%2c2.49H2.65C1.11%2c21%2c.54%2c19.88%2c1.4%2c18.51L10.44%2c4a1.7%2c1.7%2c0%2c0%2c1%2c3.12%2c0Z' style='fill: %23dcd400'/%3e %3cpath d='M12%2c3a1.9%2c1.9%2c0%2c0%2c1%2c1.56%2c1l9%2c14.48c.86%2c1.37.29%2c2.49-1.25%2c2.49H2.65C1.11%2c21%2c.54%2c19.88%2c1.4%2c18.51L10.44%2c4A1.9%2c1.9%2c0%2c0%2c1%2c12%2c3m0-1A2.89%2c2.89%2c0%2c0%2c0%2c9.6%2c3.5L.55%2c18a2.75%2c2.75%2c0%2c0%2c0-.28%2c2.81A2.59%2c2.59%2c0%2c0%2c0%2c2.65%2c22h18.7a2.59%2c2.59%2c0%2c0%2c0%2c2.38-1.21A2.75%2c2.75%2c0%2c0%2c0%2c23.45%2c18L14.4%2c3.5A2.89%2c2.89%2c0%2c0%2c0%2c12%2c2Z' style='fill: white'/%3e %3c/g%3e %3cpath d='M11.73%2c15.85a1%2c1%2c0%2c0%2c1-1-.91V8.76a1%2c1%2c0%2c0%2c1%2c2%2c0v6.18A1%2c1%2c0%2c0%2c1%2c11.73%2c15.85Zm0%2c1a1%2c1%2c0%2c1%2c0%2c1%2c1A1%2c1%2c0%2c0%2c0%2c11.73%2c16.85Z'/%3e %3c/svg%3e");
|
|
19
19
|
--di-status-info: url("data:image/svg+xml,%3csvg id='status-info' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e %3cg%3e %3ccircle cx='12' cy='12' r='11' style='fill: %232b5780'/%3e %3cpath d='M12%2c1A11%2c11%2c0%2c1%2c1%2c1%2c12%2c11%2c11%2c0%2c0%2c1%2c12%2c1m0-1A12%2c12%2c0%2c1%2c0%2c24%2c12%2c12%2c12%2c0%2c0%2c0%2c12%2c0Z' style='fill: white'/%3e %3c/g%3e %3cpath d='M11%2c8a1%2c1%2c0%2c1%2c1%2c1%2c1A1%2c1%2c0%2c0%2c1%2c11%2c8Zm2%2c8.79V11.21A1.12%2c1.12%2c0%2c0%2c0%2c12%2c10a1.12%2c1.12%2c0%2c0%2c0-1%2c1.21v5.58A1.12%2c1.12%2c0%2c0%2c0%2c12%2c18%2c1.12%2c1.12%2c0%2c0%2c0%2c13%2c16.79Z' style='fill: white'/%3e %3c/svg%3e");
|
|
20
|
+
--di-download-grijs90: url("data:image/svg+xml,%3csvg id='download' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' style='color: %23191919%3b'%3e %3cpath fill='currentColor' d='M18.72%2c10.44%2c12%2c17l-6.7-6.52C4.8%2c10%2c5%2c9.63%2c5.63%2c9.63H8.5V1.82A.8.8%2c0%2c0%2c1%2c9.28%2c1h5.44a.8.8%2c0%2c0%2c1%2c.78.82V9.61h2.87C19%2c9.6%2c19.2%2c10%2c18.72%2c10.44ZM1%2c17v6H23V17Zm16%2c3a2%2c2%2c0%2c1%2c1-2-2A2%2c2%2c0%2c0%2c1%2c17%2c20Zm5%2c0a2%2c2%2c0%2c1%2c1-2-2A2%2c2%2c0%2c0%2c1%2c22%2c20Z'/%3e %3c/svg%3e");
|
|
21
|
+
--di-external-link-grijs90: url("data:image/svg+xml,%3csvg id='external-link' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' style='color: %23191919%3b'%3e %3cpath fill='currentColor' d='M19%2c6V9.69c0%2c.33-.2.41-.43.17L17.06%2c8.35l-3.35%2c3.36a1%2c1%2c0%2c0%2c1-1.42%2c0%2c1%2c1%2c0%2c0%2c1%2c0-1.42l3.36-3.35L14.14%2c5.43C13.9%2c5.19%2c14%2c5%2c14.31%2c5H19V6ZM18%2c17V13a1%2c1%2c0%2c0%2c0-2%2c0v4a1%2c1%2c0%2c0%2c1-1%2c1H7a1%2c1%2c0%2c0%2c1-1-1V9A1%2c1%2c0%2c0%2c1%2c7%2c8h4a1%2c1%2c0%2c0%2c0%2c0-2H7A3%2c3%2c0%2c0%2c0%2c4%2c9v8a3%2c3%2c0%2c0%2c0%2c3%2c3h8A3%2c3%2c0%2c0%2c0%2c18%2c17Z'/%3e %3c/svg%3e");
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
:host(:not(:first-child)) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, Element, h, Listen, Prop, State, Fragment, Event, Watch, } from "@stencil/core";
|
|
2
2
|
import debounce from "debounce";
|
|
3
3
|
import { v4 } from "uuid";
|
|
4
|
+
import escapeStringRegexp from "escape-string-regexp";
|
|
4
5
|
export class Autosuggest {
|
|
5
6
|
constructor() {
|
|
6
7
|
/**
|
|
@@ -123,7 +124,7 @@ export class Autosuggest {
|
|
|
123
124
|
if (!suggestionValue || !terms || terms.length === 0) {
|
|
124
125
|
return [''];
|
|
125
126
|
}
|
|
126
|
-
const termRegex = new RegExp(`(${terms[0]})`, 'gi');
|
|
127
|
+
const termRegex = new RegExp(`(${escapeStringRegexp(terms[0])})`, 'gi');
|
|
127
128
|
return suggestionValue.split(termRegex).map((valuePart) => {
|
|
128
129
|
if (!valuePart) {
|
|
129
130
|
return '';
|
|
@@ -198,7 +199,7 @@ export class Autosuggest {
|
|
|
198
199
|
return `${this.inputId}-${this.suggestions.indexOf(suggestion) + 1}`;
|
|
199
200
|
}
|
|
200
201
|
render() {
|
|
201
|
-
const terms = this.input.value.split(' ');
|
|
202
|
+
const terms = this.input.value.split(' ').filter(t => t);
|
|
202
203
|
return (h(Fragment, null,
|
|
203
204
|
h("slot", null),
|
|
204
205
|
h("ul", { role: "listbox", id: this.listboxId, "aria-labelledby": this.labelId, ref: element => this.listbox = element, hidden: !this.showSuggestions }, this.showSuggestions
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
display: block;
|
|
6
6
|
--di-status-danger: url("data:image/svg+xml,%3csvg id='status-danger-line' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e %3cg%3e %3cpath d='M22.6%2c18.51c.86%2c1.37.29%2c2.49-1.25%2c2.49H2.65C1.11%2c21%2c.54%2c19.88%2c1.4%2c18.51L10.44%2c4a1.7%2c1.7%2c0%2c0%2c1%2c3.12%2c0Z' style='fill: %23ce3f51'/%3e %3cpath d='M12%2c3a1.9%2c1.9%2c0%2c0%2c1%2c1.56%2c1l9%2c14.48c.86%2c1.37.29%2c2.49-1.25%2c2.49H2.65C1.11%2c21%2c.54%2c19.88%2c1.4%2c18.51L10.44%2c4A1.9%2c1.9%2c0%2c0%2c1%2c12%2c3m0-1A2.89%2c2.89%2c0%2c0%2c0%2c9.6%2c3.5L.55%2c18a2.75%2c2.75%2c0%2c0%2c0-.28%2c2.81A2.59%2c2.59%2c0%2c0%2c0%2c2.65%2c22h18.7a2.59%2c2.59%2c0%2c0%2c0%2c2.38-1.21A2.75%2c2.75%2c0%2c0%2c0%2c23.45%2c18L14.4%2c3.5A2.89%2c2.89%2c0%2c0%2c0%2c12%2c2Z' style='fill: white'/%3e %3c/g%3e %3cpath d='M12%2c16a1%2c1%2c0%2c0%2c1-1-.91V8.91a1%2c1%2c0%2c0%2c1%2c2%2c0v6.18A1%2c1%2c0%2c0%2c1%2c12%2c16Zm0%2c1a1%2c1%2c0%2c1%2c0%2c1%2c1A1%2c1%2c0%2c0%2c0%2c12%2c17Z' style='fill: white'/%3e %3c/svg%3e");
|
|
7
7
|
--di-status-warning: url("data:image/svg+xml,%3csvg id='status-warning' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e %3cg%3e %3cpath d='M22.6%2c18.51c.86%2c1.37.29%2c2.49-1.25%2c2.49H2.65C1.11%2c21%2c.54%2c19.88%2c1.4%2c18.51L10.44%2c4a1.7%2c1.7%2c0%2c0%2c1%2c3.12%2c0Z' style='fill: %23dcd400'/%3e %3cpath d='M12%2c3a1.9%2c1.9%2c0%2c0%2c1%2c1.56%2c1l9%2c14.48c.86%2c1.37.29%2c2.49-1.25%2c2.49H2.65C1.11%2c21%2c.54%2c19.88%2c1.4%2c18.51L10.44%2c4A1.9%2c1.9%2c0%2c0%2c1%2c12%2c3m0-1A2.89%2c2.89%2c0%2c0%2c0%2c9.6%2c3.5L.55%2c18a2.75%2c2.75%2c0%2c0%2c0-.28%2c2.81A2.59%2c2.59%2c0%2c0%2c0%2c2.65%2c22h18.7a2.59%2c2.59%2c0%2c0%2c0%2c2.38-1.21A2.75%2c2.75%2c0%2c0%2c0%2c23.45%2c18L14.4%2c3.5A2.89%2c2.89%2c0%2c0%2c0%2c12%2c2Z' style='fill: white'/%3e %3c/g%3e %3cpath d='M11.73%2c15.85a1%2c1%2c0%2c0%2c1-1-.91V8.76a1%2c1%2c0%2c0%2c1%2c2%2c0v6.18A1%2c1%2c0%2c0%2c1%2c11.73%2c15.85Zm0%2c1a1%2c1%2c0%2c1%2c0%2c1%2c1A1%2c1%2c0%2c0%2c0%2c11.73%2c16.85Z'/%3e %3c/svg%3e");
|
|
8
|
+
--di-download-grijs90: url("data:image/svg+xml,%3csvg id='download' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' style='color: %23191919%3b'%3e %3cpath fill='currentColor' d='M18.72%2c10.44%2c12%2c17l-6.7-6.52C4.8%2c10%2c5%2c9.63%2c5.63%2c9.63H8.5V1.82A.8.8%2c0%2c0%2c1%2c9.28%2c1h5.44a.8.8%2c0%2c0%2c1%2c.78.82V9.61h2.87C19%2c9.6%2c19.2%2c10%2c18.72%2c10.44ZM1%2c17v6H23V17Zm16%2c3a2%2c2%2c0%2c1%2c1-2-2A2%2c2%2c0%2c0%2c1%2c17%2c20Zm5%2c0a2%2c2%2c0%2c1%2c1-2-2A2%2c2%2c0%2c0%2c1%2c22%2c20Z'/%3e %3c/svg%3e");
|
|
9
|
+
--di-external-link-grijs90: url("data:image/svg+xml,%3csvg id='external-link' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' style='color: %23191919%3b'%3e %3cpath fill='currentColor' d='M19%2c6V9.69c0%2c.33-.2.41-.43.17L17.06%2c8.35l-3.35%2c3.36a1%2c1%2c0%2c0%2c1-1.42%2c0%2c1%2c1%2c0%2c0%2c1%2c0-1.42l3.36-3.35L14.14%2c5.43C13.9%2c5.19%2c14%2c5%2c14.31%2c5H19V6ZM18%2c17V13a1%2c1%2c0%2c0%2c0-2%2c0v4a1%2c1%2c0%2c0%2c1-1%2c1H7a1%2c1%2c0%2c0%2c1-1-1V9A1%2c1%2c0%2c0%2c1%2c7%2c8h4a1%2c1%2c0%2c0%2c0%2c0-2H7A3%2c3%2c0%2c0%2c0%2c4%2c9v8a3%2c3%2c0%2c0%2c0%2c3%2c3h8A3%2c3%2c0%2c0%2c0%2c18%2c17Z'/%3e %3c/svg%3e");
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
*,
|
|
@@ -6,7 +6,7 @@ const localization = {
|
|
|
6
6
|
nextMonthLabel: 'Volgende maand',
|
|
7
7
|
monthSelectLabel: 'Maand',
|
|
8
8
|
yearSelectLabel: 'Jaar',
|
|
9
|
-
closeLabel: '
|
|
9
|
+
closeLabel: 'Sluiten',
|
|
10
10
|
keyboardInstruction: 'Gebruik de pijltjestoetsen om een dag te kiezen',
|
|
11
11
|
calendarHeading: 'Kies een datum',
|
|
12
12
|
dayNames: [
|
|
@@ -63,6 +63,10 @@ export class DsoDatePicker {
|
|
|
63
63
|
* Should the input be marked as required?
|
|
64
64
|
*/
|
|
65
65
|
this.required = false;
|
|
66
|
+
/**
|
|
67
|
+
* Should the input be focused on load?
|
|
68
|
+
*/
|
|
69
|
+
this.dsoAutofocus = false;
|
|
66
70
|
/**
|
|
67
71
|
* Date value. Must be in Dutch date format: DD-MM-YYYY.
|
|
68
72
|
*/
|
|
@@ -91,6 +95,20 @@ export class DsoDatePicker {
|
|
|
91
95
|
component: "dso-date-picker",
|
|
92
96
|
});
|
|
93
97
|
};
|
|
98
|
+
this.handleKeyUp = (event) => {
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
this.dsoKeyUp.emit({
|
|
101
|
+
component: "dso-date-picker",
|
|
102
|
+
originalEvent: event
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
this.handleKeyDown = (event) => {
|
|
106
|
+
event.stopPropagation();
|
|
107
|
+
this.dsoKeyDown.emit({
|
|
108
|
+
component: "dso-date-picker",
|
|
109
|
+
originalEvent: event
|
|
110
|
+
});
|
|
111
|
+
};
|
|
94
112
|
this.handleFocus = (event) => {
|
|
95
113
|
event.stopPropagation();
|
|
96
114
|
this.dsoFocus.emit({
|
|
@@ -211,12 +229,8 @@ export class DsoDatePicker {
|
|
|
211
229
|
};
|
|
212
230
|
this.handleInputChange = (e) => {
|
|
213
231
|
const target = e.target;
|
|
214
|
-
// clean up any invalid characters
|
|
215
232
|
target.value = target.value.replace(DISALLOWED_CHARACTERS, "");
|
|
216
|
-
|
|
217
|
-
if (parsed || target.value === "") {
|
|
218
|
-
this.setValue(parsed);
|
|
219
|
-
}
|
|
233
|
+
this.setValue(target.value);
|
|
220
234
|
};
|
|
221
235
|
this.processFocusedDayNode = (element) => {
|
|
222
236
|
this.focusedDayNode = element;
|
|
@@ -308,13 +322,37 @@ export class DsoDatePicker {
|
|
|
308
322
|
setFocusedDay(day) {
|
|
309
323
|
this.focusedDay = clamp(day, parseDutchDate(this.min), parseDutchDate(this.max));
|
|
310
324
|
}
|
|
311
|
-
setValue(
|
|
312
|
-
|
|
313
|
-
this.dateChange.emit({
|
|
325
|
+
setValue(value) {
|
|
326
|
+
var event = {
|
|
314
327
|
component: "dso-date-picker",
|
|
315
|
-
value:
|
|
316
|
-
valueAsDate:
|
|
317
|
-
}
|
|
328
|
+
value: "",
|
|
329
|
+
valueAsDate: undefined
|
|
330
|
+
};
|
|
331
|
+
if (value instanceof Date) {
|
|
332
|
+
event.valueAsDate = value;
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
event.value = value;
|
|
336
|
+
event.valueAsDate = parseDutchDate(value);
|
|
337
|
+
}
|
|
338
|
+
if (event.valueAsDate) {
|
|
339
|
+
event.value = this.value = printDutchDate(event.valueAsDate);
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
this.value = "";
|
|
343
|
+
}
|
|
344
|
+
if (!event.valueAsDate && this.required) {
|
|
345
|
+
event.error = "required";
|
|
346
|
+
}
|
|
347
|
+
if (event.value && !event.valueAsDate) {
|
|
348
|
+
event.error = "invalid";
|
|
349
|
+
}
|
|
350
|
+
this.dateChange.emit(event);
|
|
351
|
+
}
|
|
352
|
+
componentDidLoad() {
|
|
353
|
+
if (this.dsoAutofocus) {
|
|
354
|
+
this.setFocus();
|
|
355
|
+
}
|
|
318
356
|
}
|
|
319
357
|
/**
|
|
320
358
|
* render() function
|
|
@@ -341,7 +379,7 @@ export class DsoDatePicker {
|
|
|
341
379
|
return (h(Host, null,
|
|
342
380
|
h("div", { class: "dso-date" },
|
|
343
381
|
h("div", { class: "dso-date__input-wrapper" },
|
|
344
|
-
h("input", { class: "dso-date__input", value: formattedDate, placeholder: this.localization.placeholder, id: this.identifier, disabled: this.disabled, role: this.role, required: this.required ? true : undefined, "aria-autocomplete": "none", onInput: this.handleInputChange, onFocus: this.handleFocus, onBlur: this.handleBlur, autoComplete: "off", ref: element => (this.datePickerInput = element) }),
|
|
382
|
+
h("input", { class: "dso-date__input", value: formattedDate, placeholder: this.localization.placeholder, id: this.identifier, disabled: this.disabled, role: this.role, required: this.required ? true : undefined, "aria-autocomplete": "none", onInput: this.handleInputChange, onFocus: this.handleFocus, onBlur: this.handleBlur, onKeyUp: this.handleKeyUp, onKeyDown: this.handleKeyDown, autoComplete: "off", ref: element => (this.datePickerInput = element) }),
|
|
345
383
|
h("button", { type: "button", class: "dso-date__toggle", onClick: this.toggleOpen, disabled: this.disabled, ref: element => (this.datePickerButton = element) },
|
|
346
384
|
h("span", { class: "dso-date__toggle-icon" },
|
|
347
385
|
h("dso-icon", { icon: "calendar" })),
|
|
@@ -510,9 +548,27 @@ export class DsoDatePicker {
|
|
|
510
548
|
"reflect": false,
|
|
511
549
|
"defaultValue": "false"
|
|
512
550
|
},
|
|
551
|
+
"dsoAutofocus": {
|
|
552
|
+
"type": "boolean",
|
|
553
|
+
"mutable": false,
|
|
554
|
+
"complexType": {
|
|
555
|
+
"original": "boolean",
|
|
556
|
+
"resolved": "boolean",
|
|
557
|
+
"references": {}
|
|
558
|
+
},
|
|
559
|
+
"required": false,
|
|
560
|
+
"optional": false,
|
|
561
|
+
"docs": {
|
|
562
|
+
"tags": [],
|
|
563
|
+
"text": "Should the input be focused on load?"
|
|
564
|
+
},
|
|
565
|
+
"attribute": "dso-autofocus",
|
|
566
|
+
"reflect": false,
|
|
567
|
+
"defaultValue": "false"
|
|
568
|
+
},
|
|
513
569
|
"value": {
|
|
514
570
|
"type": "string",
|
|
515
|
-
"mutable":
|
|
571
|
+
"mutable": true,
|
|
516
572
|
"complexType": {
|
|
517
573
|
"original": "string",
|
|
518
574
|
"resolved": "string",
|
|
@@ -580,7 +636,7 @@ export class DsoDatePicker {
|
|
|
580
636
|
},
|
|
581
637
|
"complexType": {
|
|
582
638
|
"original": "DsoDatePickerChangeEvent",
|
|
583
|
-
"resolved": "{ component: \"dso-date-picker\"; valueAsDate: Date | undefined; value: string; }",
|
|
639
|
+
"resolved": "{ component: \"dso-date-picker\"; valueAsDate: Date | undefined; value: string; error?: \"invalid\" | \"required\" | undefined; }",
|
|
584
640
|
"references": {
|
|
585
641
|
"DsoDatePickerChangeEvent": {
|
|
586
642
|
"location": "local"
|
|
@@ -606,6 +662,44 @@ export class DsoDatePicker {
|
|
|
606
662
|
}
|
|
607
663
|
}
|
|
608
664
|
}
|
|
665
|
+
}, {
|
|
666
|
+
"method": "dsoKeyUp",
|
|
667
|
+
"name": "dsoKeyUp",
|
|
668
|
+
"bubbles": true,
|
|
669
|
+
"cancelable": true,
|
|
670
|
+
"composed": true,
|
|
671
|
+
"docs": {
|
|
672
|
+
"tags": [],
|
|
673
|
+
"text": "Event emitted on key up in the date picker input."
|
|
674
|
+
},
|
|
675
|
+
"complexType": {
|
|
676
|
+
"original": "DsoDatePickerKeyboardEvent",
|
|
677
|
+
"resolved": "{ component: \"dso-date-picker\"; originalEvent: KeyboardEvent; }",
|
|
678
|
+
"references": {
|
|
679
|
+
"DsoDatePickerKeyboardEvent": {
|
|
680
|
+
"location": "local"
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}, {
|
|
685
|
+
"method": "dsoKeyDown",
|
|
686
|
+
"name": "dsoKeyDown",
|
|
687
|
+
"bubbles": true,
|
|
688
|
+
"cancelable": true,
|
|
689
|
+
"composed": true,
|
|
690
|
+
"docs": {
|
|
691
|
+
"tags": [],
|
|
692
|
+
"text": "Event emitted on key down in the date picker input."
|
|
693
|
+
},
|
|
694
|
+
"complexType": {
|
|
695
|
+
"original": "DsoDatePickerKeyboardEvent",
|
|
696
|
+
"resolved": "{ component: \"dso-date-picker\"; originalEvent: KeyboardEvent; }",
|
|
697
|
+
"references": {
|
|
698
|
+
"DsoDatePickerKeyboardEvent": {
|
|
699
|
+
"location": "local"
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
609
703
|
}, {
|
|
610
704
|
"method": "dsoFocus",
|
|
611
705
|
"name": "dsoFocus",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
2
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
3
|
-
export function datePickerTemplate({ id, onDateChange, value, min, max, disabled }) {
|
|
3
|
+
export function datePickerTemplate({ id, onDateChange, value, min, max, disabled, autofocus }) {
|
|
4
4
|
return html `
|
|
5
5
|
<dso-date-picker
|
|
6
6
|
@dateChange=${(e) => onDateChange(e)}
|
|
@@ -8,6 +8,7 @@ export function datePickerTemplate({ id, onDateChange, value, min, max, disabled
|
|
|
8
8
|
value=${ifDefined(value || undefined)}
|
|
9
9
|
min=${ifDefined(min || undefined)}
|
|
10
10
|
max=${ifDefined(max || undefined)}
|
|
11
|
+
dso-autofocus=${ifDefined(autofocus || undefined)}
|
|
11
12
|
?disabled=${disabled}
|
|
12
13
|
></dso-date-picker>
|
|
13
14
|
`;
|
|
@@ -179,11 +179,13 @@ const icons = [
|
|
|
179
179
|
];
|
|
180
180
|
export class Icon {
|
|
181
181
|
render() {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
if (this.icon) {
|
|
183
|
+
const icon = icons.find(i => i.alias === this.icon);
|
|
184
|
+
if (!icon) {
|
|
185
|
+
throw new TypeError(`Unknown svg: ${this.icon}`);
|
|
186
|
+
}
|
|
187
|
+
return h("span", { class: "icon-container", innerHTML: icon.svg });
|
|
185
188
|
}
|
|
186
|
-
return h("span", { class: "icon-container", innerHTML: icon.svg });
|
|
187
189
|
}
|
|
188
190
|
static get is() { return "dso-icon"; }
|
|
189
191
|
static get encapsulation() { return "shadow"; }
|
|
@@ -199,11 +201,11 @@ export class Icon {
|
|
|
199
201
|
"mutable": false,
|
|
200
202
|
"complexType": {
|
|
201
203
|
"original": "string",
|
|
202
|
-
"resolved": "string",
|
|
204
|
+
"resolved": "string | undefined",
|
|
203
205
|
"references": {}
|
|
204
206
|
},
|
|
205
|
-
"required":
|
|
206
|
-
"optional":
|
|
207
|
+
"required": false,
|
|
208
|
+
"optional": true,
|
|
207
209
|
"docs": {
|
|
208
210
|
"tags": [],
|
|
209
211
|
"text": ""
|