Skip to content

Commit 391abf1

Browse files
authored
fix(UI5DomRef - TypeScript): update interface to latest methods and properties (#4872)
1 parent 5b3faa9 commit 391abf1

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

packages/main/src/interfaces/Ui5DomRef.ts

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export interface Ui5DomRef extends Omit<HTMLElement, 'focus'> {
1+
export interface Ui5DomRef extends HTMLElement {
22
/**
33
* Attach a callback that will be executed whenever the component is invalidated
44
*
@@ -11,6 +11,33 @@ export interface Ui5DomRef extends Omit<HTMLElement, 'focus'> {
1111
* @param callback
1212
*/
1313
detachInvalidate: (callback) => void;
14+
/**
15+
* A callback that is executed each time an already rendered component is invalidated (scheduled for re-rendering)
16+
*
17+
* @param changeInfo An object with information about the change that caused invalidation.
18+
* The object can have the following properties:
19+
* - type: (property|slot) tells what caused the invalidation
20+
* 1) property: a property value was changed either directly or as a result of changing the corresponding attribute
21+
* 2) slot: a slotted node(nodes) changed in one of several ways (see "reason")
22+
*
23+
* - name: the name of the property or slot that caused the invalidation
24+
*
25+
* - reason: (children|textcontent|childchange|slotchange) relevant only for type="slot" only and tells exactly what changed in the slot
26+
* 1) children: immediate children (HTML elements or text nodes) were added, removed or reordered in the slot
27+
* 2) textcontent: text nodes in the slot changed value (or nested text nodes were added or changed value). Can only trigger for slots of "type: Node"
28+
* 3) slotchange: a slot element, slotted inside that slot had its "slotchange" event listener called. This practically means that transitively slotted children changed.
29+
* Can only trigger if the child of a slot is a slot element itself.
30+
* 4) childchange: indicates that a UI5Element child in that slot was invalidated and in turn invalidated the component.
31+
* Can only trigger for slots with "invalidateOnChildChange" metadata descriptor
32+
*
33+
* - newValue: the new value of the property (for type="property" only)
34+
*
35+
* - oldValue: the old value of the property (for type="property" only)
36+
*
37+
* - child the child that was changed (for type="slot" and reason="childchange" only)
38+
*
39+
*/
40+
onInvalidation: (changeInfo) => void;
1441
/**
1542
* Returns the DOM Element inside the Shadow Root that corresponds to the opening tag in the UI5 Web Component's template
1643
*
@@ -31,8 +58,30 @@ export interface Ui5DomRef extends Omit<HTMLElement, 'focus'> {
3158
getFocusDomRefAsync: () => Promise<HTMLElement>;
3259
/**
3360
* Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
61+
* @param {FocusOptions} focusOptions additional options for the focus
62+
*/
63+
focus: (focusOptions?: FocusOptions) => Promise<void>;
64+
/**
65+
*
66+
* @param name - name of the event
67+
* @param data - additional data for the event
68+
* @param cancelable - true, if the user can call preventDefault on the event object
69+
* @param bubbles - true, if the event bubbles
70+
* @returns {boolean} false, if the event was cancelled (preventDefault called), true otherwise
71+
*/
72+
fireEvent: <T>(name: string, data?: T, cancelable?: boolean, bubbles?: boolean) => boolean;
73+
/**
74+
* Returns the actual children, associated with a slot.
75+
* Useful when there are transitive slots in nested component scenarios and you don't want to get a list of the slots, but rather of their content.
76+
*/
77+
getSlottedNodes: <T = Node>(slotName: string) => Array<T>;
78+
/**
79+
* Determines whether the component should be rendered in RTL mode or not.
80+
* Returns: "rtl", "ltr" or undefined
81+
*
82+
* @returns {string|undefined}
3483
*/
35-
focus: () => Promise<void>;
84+
readonly effectiveDir: string | undefined;
3685
/**
3786
* Used to duck-type UI5 elements without using instanceof
3887
*/

0 commit comments

Comments
 (0)