wj-elements 0.5.2 → 0.6.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.
@@ -33,6 +33,7 @@ export default class Dialog extends WJElement {
33
33
  */
34
34
  static get observedAttributes(): any[];
35
35
  _instanceId: number;
36
+ _opening: boolean;
36
37
  /**
37
38
  * Sets the value of the 'headline' attribute.
38
39
  * @param {string} value The new value for the 'headline' attribute.
@@ -4,7 +4,9 @@ import { default as WJElement } from '../wje-element/element.js';
4
4
  * @documentation https://elements.webjet.sk/components/Orgchart
5
5
  * @status stable
6
6
  * @augments WJElement
7
+ * @attribute {boolean} flat - Removes the incoming connector spacing for nested charts that should visually continue on the same level.
7
8
  * @csspart - Styles the element.
9
+ * @csspart native - Styles the native element.
8
10
  * @tag wje-orgchart
9
11
  * @example
10
12
  */
@@ -15,12 +17,37 @@ export default class Orgchart extends WJElement {
15
17
  * @returns {CSSStyleSheet}
16
18
  */
17
19
  static get cssStyleSheet(): CSSStyleSheet;
20
+ /**
21
+ * Returns attributes that trigger a redraw when they change.
22
+ * @returns {Array<string>} Attribute names that require a new template render.
23
+ */
24
+ static get observedAttributes(): Array<string>;
25
+ /**
26
+ * Sets whether the chart should omit its incoming connector spacing.
27
+ * @param {boolean} value True when the chart should render without top connector spacing.
28
+ */
29
+ set flat(value: boolean);
30
+ /**
31
+ * Gets whether the chart omits its incoming connector spacing.
32
+ * @returns {boolean} True when the chart has the flat attribute.
33
+ */
34
+ get flat(): boolean;
18
35
  /**
19
36
  * Draws the component for the org chart.
20
37
  * @returns {DocumentFragment}
21
38
  */
22
39
  draw(): DocumentFragment;
23
40
  native: HTMLDivElement;
41
+ defaultSlot: HTMLSlotElement;
42
+ /**
43
+ * Syncs flat chart state to direct slotted children.
44
+ */
45
+ afterDraw(): void;
46
+ /**
47
+ * Marks direct children that are rendered inside a flat chart.
48
+ */
49
+ syncFlatChildren: () => void;
50
+ flatChildren: Set<Element>;
24
51
  /**
25
52
  * Sync ARIA attributes on host.
26
53
  */
@@ -5,11 +5,13 @@ import { default as WJElement } from '../wje-element/element.js';
5
5
  * @status stable
6
6
  * @augments WJElement
7
7
  * @attribute {boolean} boss - The boss of the orgchart item (default: false).
8
+ * @attribute {boolean} virtual - Renders the item as a structural connector without its own card or expander.
8
9
  * @slot - The default slot for the orgchart item.
9
10
  * @slot child - The child slot for the orgchart item.
10
11
  * @csspart - Styles the element.
11
12
  * @csspart native - Styles the native element.
12
13
  * @csspart expander - Styles the expander element.
14
+ * // @fires wje-orgchart-item:click - Emitted when the item card is clicked.
13
15
  * @tag wje-orgchart-item
14
16
  */
15
17
  export default class OrgchartItem extends WJElement {
@@ -19,6 +21,11 @@ export default class OrgchartItem extends WJElement {
19
21
  * @returns {CSSStyleSheet}
20
22
  */
21
23
  static get cssStyleSheet(): CSSStyleSheet;
24
+ /**
25
+ * Returns attributes that trigger a redraw when they change.
26
+ * @returns {Array<string>} Attribute names that require a new template render.
27
+ */
28
+ static get observedAttributes(): Array<string>;
22
29
  /**
23
30
  * Sets the boss of the orgchart item.
24
31
  * @param value
@@ -29,6 +36,16 @@ export default class OrgchartItem extends WJElement {
29
36
  * @returns {boolean}
30
37
  */
31
38
  get boss(): boolean;
39
+ /**
40
+ * Sets whether the item should render only as a structural connector.
41
+ * @param {boolean} value True when the item should not render its own card.
42
+ */
43
+ set virtual(value: boolean);
44
+ /**
45
+ * Gets whether the item renders only as a structural connector.
46
+ * @returns {boolean} True when the item has the virtual attribute.
47
+ */
48
+ get virtual(): boolean;
32
49
  beforeDraw(): void;
33
50
  /**
34
51
  * Draws the component for the org chart item.
@@ -36,14 +53,15 @@ export default class OrgchartItem extends WJElement {
36
53
  */
37
54
  draw(): DocumentFragment;
38
55
  expander: HTMLDivElement;
56
+ card: HTMLElement;
39
57
  /**
40
58
  * After Draws the component for the org chart item.
41
59
  */
42
60
  afterDraw(): void;
61
+ handleItemClick: (e: any) => void;
43
62
  /**
44
63
  * Toggles the children of the orgchart item.
45
64
  * @param e The event object.
46
65
  */
47
66
  toggleChildren: (e: any) => void;
48
- dispatchEvent(e: any): boolean;
49
67
  }
@@ -53,6 +53,13 @@ export default class Popup extends WJElement {
53
53
  */
54
54
  get portal(): boolean;
55
55
  get floatingEl(): HTMLDivElement;
56
+ _hideFloatingLightDomContentBeforeRender(): void;
57
+ _hiddenFloatingLightDomContent: {
58
+ el: Element;
59
+ display: any;
60
+ priority: any;
61
+ }[];
62
+ _restoreFloatingLightDomContentAfterRender(): void;
56
63
  beforeDraw(context: any, store: any, params: any): void;
57
64
  /**
58
65
  * Draws the component for the popup.
@@ -1501,6 +1501,29 @@ class Popup extends WJElement {
1501
1501
  */
1502
1502
  setupAttributes() {
1503
1503
  this.isShadowRoot = "open";
1504
+ this._hideFloatingLightDomContentBeforeRender();
1505
+ }
1506
+ _hideFloatingLightDomContentBeforeRender() {
1507
+ if (this._hiddenFloatingLightDomContent) return;
1508
+ const floatingChildren = Array.from(this.children).filter((el) => el.getAttribute("slot") !== "anchor");
1509
+ if (floatingChildren.length === 0) return;
1510
+ this._hiddenFloatingLightDomContent = floatingChildren.map((el) => {
1511
+ const display = el.style.getPropertyValue("display");
1512
+ const priority = el.style.getPropertyPriority("display");
1513
+ el.style.setProperty("display", "none");
1514
+ return { el, display, priority };
1515
+ });
1516
+ }
1517
+ _restoreFloatingLightDomContentAfterRender() {
1518
+ var _a;
1519
+ (_a = this._hiddenFloatingLightDomContent) == null ? void 0 : _a.forEach(({ el, display, priority }) => {
1520
+ if (display) {
1521
+ el.style.setProperty("display", display, priority);
1522
+ } else {
1523
+ el.style.removeProperty("display");
1524
+ }
1525
+ });
1526
+ this._hiddenFloatingLightDomContent = null;
1504
1527
  }
1505
1528
  afterDisconnect() {
1506
1529
  var _a;
@@ -1546,6 +1569,7 @@ class Popup extends WJElement {
1546
1569
  * After Draws the component.
1547
1570
  */
1548
1571
  afterDraw() {
1572
+ this._restoreFloatingLightDomContentAfterRender();
1549
1573
  this.setAnchor();
1550
1574
  this.addEventListener("wje-popup:content-ready", () => {
1551
1575
  this.markContentReady();
@@ -1898,4 +1922,4 @@ class Popup extends WJElement {
1898
1922
  export {
1899
1923
  Popup as P
1900
1924
  };
1901
- //# sourceMappingURL=popup.element-C8-g3WLs.js.map
1925
+ //# sourceMappingURL=popup.element-B1HZhDZJ.js.map