|
| 1 | +import {BaseElement} from "./smart.element" |
| 2 | + |
| 3 | +/** |
| 4 | + Accordion organizes content within collapsable items. |
| 5 | +*/ |
| 6 | +export interface Accordion extends BaseElement { |
| 7 | + /** |
| 8 | + * Sets or gets the animation mode. Animation is disabled when the property is set to 'none' |
| 9 | + * Default value: advanced |
| 10 | + */ |
| 11 | + animation: "none" | "simple" | "advanced"; |
| 12 | + /** |
| 13 | + * Enables or disables the accordion. Disabled elements can not be interacted with. |
| 14 | + * Default value: false |
| 15 | + */ |
| 16 | + disabled: boolean; |
| 17 | + /** |
| 18 | + * Sets or gets the expanded item indexes. Using this property items can be expanded by passing in their indexes. The number of expanded items is limited by the expandMode. |
| 19 | + * Default value: |
| 20 | + */ |
| 21 | + expandedIndexes: number[]; |
| 22 | + /** |
| 23 | + * Sets or gets the expand mode. Expand mode determines how the items will expand or collapse. |
| 24 | + * Default value: singleFitHeight |
| 25 | + */ |
| 26 | + expandMode: "single" | "singleFitHeight" | "multiple" | "toggle" | "none"; |
| 27 | + /** |
| 28 | + * Sets or gets the language. Used in conjunction with the property messages. |
| 29 | + * Default value: "en" |
| 30 | + */ |
| 31 | + locale: string; |
| 32 | + /** |
| 33 | + * Callback used to customize the format of the messages that are returned from the Localization Module. |
| 34 | + * Default value: null |
| 35 | + */ |
| 36 | + localizeFormatFunction: any; |
| 37 | + /** |
| 38 | + * Sets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale. |
| 39 | + * Default value: * { |
| 40 | + * "en": { |
| 41 | + * "propertyUnknownType": "'' property is with undefined 'type' member!", |
| 42 | + * "propertyInvalidValue": "Invalid '!", |
| 43 | + * "propertyInvalidValueType": "Invalid '!", |
| 44 | + * "elementNotInDOM": "Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.", |
| 45 | + * "moduleUndefined": "Module is undefined.", |
| 46 | + * "missingReference": ".", |
| 47 | + * "htmlTemplateNotSuported": ": Browser doesn't support HTMLTemplate elements.", |
| 48 | + * "invalidTemplate": "' property accepts a string that must match the id of an HTMLTemplate element from the DOM.", |
| 49 | + * "accordionItemRequired": "' requires an item from type \"smart-accordion-item\".", |
| 50 | + * "indexOutOfBound": "' method.", |
| 51 | + * "invalidSettings": "' method accepts a string or an object as it's second parameter.", |
| 52 | + * "noItems": ": No child elements found.", |
| 53 | + * "overridingProperties": "' property is used by default." |
| 54 | + * } |
| 55 | + * } |
| 56 | + */ |
| 57 | + messages: any; |
| 58 | + /** |
| 59 | + * Determines if the element is readonly or not. If the element true, users cannot interact with it. |
| 60 | + * Default value: false |
| 61 | + */ |
| 62 | + readonly: boolean; |
| 63 | + /** |
| 64 | + * Enables or disables accordion reordering. |
| 65 | + * Default value: false |
| 66 | + */ |
| 67 | + reorder: boolean; |
| 68 | + /** |
| 69 | + * Sets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts. |
| 70 | + * Default value: false |
| 71 | + */ |
| 72 | + rightToLeft: boolean; |
| 73 | + /** |
| 74 | + * Determines the theme. Theme defines the look of the element |
| 75 | + * Default value: "" |
| 76 | + */ |
| 77 | + theme: string; |
| 78 | + /** |
| 79 | + * Determines whether the element can be focused or not. |
| 80 | + * Default value: false |
| 81 | + */ |
| 82 | + unfocusable: boolean; |
| 83 | + /** |
| 84 | + * This event is triggered when an item is collapsed. |
| 85 | + * @param ev. The custom event. Custom data event was created with: ev.detail(content, index, label) |
| 86 | + * content - The content of the item. |
| 87 | + * index - The index of the item. |
| 88 | + * label - The label of the item |
| 89 | + */ |
| 90 | + oncollapse: ((this: Window, ev: Event) => any) | null; |
| 91 | + /** |
| 92 | + * This event is triggered when an item is going to be collapsed. |
| 93 | + * @param ev. The custom event. Custom data event was created with: ev.detail(content, index, label) |
| 94 | + * content - The content of the item. |
| 95 | + * index - The index of the item. |
| 96 | + * label - The label of the item |
| 97 | + */ |
| 98 | + oncollapsing: ((this: Window, ev: Event) => any) | null; |
| 99 | + /** |
| 100 | + * This event is triggered when a reordering operation is completed. |
| 101 | + * @param ev. The custom event. Custom data event was created with: ev.detail(position, target, content, index, label) |
| 102 | + * position - The current top and left position of the item that was dragged. |
| 103 | + * target - The item that was dragged. |
| 104 | + * content - The content of the item. |
| 105 | + * index - The index of the item. |
| 106 | + * label - The label of the item. |
| 107 | + */ |
| 108 | + ondragend: ((this: Window, ev: Event) => any) | null; |
| 109 | + /** |
| 110 | + * This event is triggered when a reordering operation is started. |
| 111 | + * @param ev. The custom event. Custom data event was created with: ev.detail(position, target, content, index, label) |
| 112 | + * position - The current top and left position of the item that is about to be dragged. |
| 113 | + * target - The item that is about to be dragged. |
| 114 | + * content - The content of the item. |
| 115 | + * index - The index of the item. |
| 116 | + * label - The label of the item. |
| 117 | + */ |
| 118 | + ondragstart: ((this: Window, ev: Event) => any) | null; |
| 119 | + /** |
| 120 | + * This event is triggered when an item is expanded. |
| 121 | + * @param ev. The custom event. Custom data event was created with: ev.detail(position, target, content, index, label) |
| 122 | + * position - The current top and left position of the item. |
| 123 | + * target - The item that was dragged. |
| 124 | + * content - The content of the item. |
| 125 | + * index - The index of the item. |
| 126 | + * label - The label of the item. |
| 127 | + */ |
| 128 | + onexpand: ((this: Window, ev: Event) => any) | null; |
| 129 | + /** |
| 130 | + * This event is triggered when an item is going to be expanded. |
| 131 | + * @param ev. The custom event. Custom data event was created with: ev.detail(content, index, label) |
| 132 | + * content - The content of the item. |
| 133 | + * index - The index of the item. |
| 134 | + * label - The label of the item |
| 135 | + */ |
| 136 | + onexpanding: ((this: Window, ev: Event) => any) | null; |
| 137 | + /** |
| 138 | + * Collapses an item at a specified index. |
| 139 | + * @param {number} position. The index of the collapsed item. |
| 140 | + */ |
| 141 | + collapse(position: number): void; |
| 142 | + /** |
| 143 | + * Expands an item at a specified index. |
| 144 | + * @param {number} position. The index of the expanded item. |
| 145 | + */ |
| 146 | + expand(position: number): void; |
| 147 | + /** |
| 148 | + * Inserts a new item at a specified index. |
| 149 | + * @param {number} index. The index where the item must be inserted. |
| 150 | + * @param {any} item. An object containing the values for the properties of the new item to be inserted. |
| 151 | + */ |
| 152 | + insert(index: number, item: any): void; |
| 153 | + /** |
| 154 | + * Removes an item at a specified index. |
| 155 | + * @param {number} position. The index of the item to be removed. |
| 156 | + */ |
| 157 | + removeAt(position: number): void; |
| 158 | + /** |
| 159 | + * Updates an item from the element. |
| 160 | + * @param {number} index. The index of the item to be updated. |
| 161 | + * @param {any} settings. An object containing the values for the properties of the item that will be updated. |
| 162 | + */ |
| 163 | + update(index: number, settings: any): void; |
| 164 | +} |
| 165 | + |
| 166 | +declare global { |
| 167 | + interface Document { |
| 168 | + createElement(tagName: "smart-accordion"): Accordion; |
| 169 | + } |
| 170 | +} |
| 171 | + |
| 172 | +/** |
| 173 | + Single item in an Accordion view. |
| 174 | +*/ |
| 175 | +export interface AccordionItem extends BaseElement { |
| 176 | + /** |
| 177 | + * Sets or gets header's arrow position. If the value is 'none' the arrow is not shown. |
| 178 | + * Default value: left |
| 179 | + */ |
| 180 | + arrow: "left" | "right" | "none"; |
| 181 | + /** |
| 182 | + * Sets or gets the content if the item. |
| 183 | + * Default value: """" |
| 184 | + */ |
| 185 | + content: string; |
| 186 | + /** |
| 187 | + * Sets or gets the expanded state. |
| 188 | + * Default value: false |
| 189 | + */ |
| 190 | + expanded: boolean; |
| 191 | + /** |
| 192 | + * Sets or gets the focus state. |
| 193 | + * Default value: false |
| 194 | + */ |
| 195 | + focused: boolean; |
| 196 | + /** |
| 197 | + * Sets or gets the label if the item. |
| 198 | + * Default value: """" |
| 199 | + */ |
| 200 | + label: string; |
| 201 | + /** |
| 202 | + * This event is triggered when the item is collapsed. |
| 203 | + * @param ev. The custom event. */ |
| 204 | + oncollapse: ((this: Window, ev: Event) => any) | null; |
| 205 | + /** |
| 206 | + * This event is triggered when the item is expanded. |
| 207 | + * @param ev. The custom event. */ |
| 208 | + onexpand: ((this: Window, ev: Event) => any) | null; |
| 209 | +} |
| 210 | + |
| 211 | +declare global { |
| 212 | + interface Document { |
| 213 | + createElement(tagName: "smart-accordion-item"): AccordionItem; |
| 214 | + } |
| 215 | +} |
| 216 | + |
0 commit comments