package.dist.ToolbarSelect.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webcomponents Show documentation
Show all versions of webcomponents Show documentation
UI5 Web Components: webcomponents.main
The newest version!
{"version":3,"file":"ToolbarSelect.js","sourceRoot":"","sources":["../src/ToolbarSelect.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,KAAK,MAAM,kDAAkD,CAAC;AAGrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,YAAY;AAEZ,OAAO,qBAAqB,MAAM,oDAAoD,CAAC;AACvF,OAAO,4BAA4B,MAAM,2DAA2D,CAAC;AACrG,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,MAAM,MAAM,aAAa,CAAC;AAMjC;;;;;;;;;;;;;;;;GAgBG;AAgCH,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,WAAW;IA2DtC,MAAM,KAAK,eAAe;QACzB,OAAO,qBAAqB,CAAC;IAC9B,CAAC;IAED,MAAM,KAAK,sBAAsB;QAChC,OAAO,4BAA4B,CAAC;IACrC,CAAC;IAED,IAAI,gBAAgB;QACnB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;QAEtB,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3C,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;QACjD,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,cAAc,EAAE,IAA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,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;iBACpC;qBAAM;oBACN,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;iBACnC;YACF,CAAC,CAAC,CAAC;SACH;IACF,CAAC;IAED,IAAI,MAAM;QACT,OAAO;YACN,KAAK,EAAE,IAAI,CAAC,KAAK;SACjB,CAAC;IACH,CAAC;CACD,CAAA;AAnHA;IADC,QAAQ,EAAE;4CACI;AAYf;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC;8CACvC;AAQrC;IADC,QAAQ,EAAE;iDAC0B;AAUrC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACX;AAQjB;IADC,QAAQ,EAAE;qDACY;AAQvB;IADC,QAAQ,EAAE;wDACgB;AAvDtB,aAAa;IA/BlB,aAAa,CAAC;QACd,GAAG,EAAE,oBAAoB;QACzB,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;KAC9B,CAAC;IAEF;;;;;OAKG;;IACF,KAAK,CAAiC,QAAQ,EAAE;QAChD,MAAM,EAAE;YACP;;cAEE;YACF,cAAc,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;SACrC;KACD,CAAC;IAEF;;;OAGG;;IACF,KAAK,CAAC,MAAM,CAAC;IACd;;;OAGG;;IACF,KAAK,CAAC,OAAO,CAAC;GAET,aAAa,CA4HlB;AAED,mBAAmB,CAAC,aAAa,CAAC,CAAC;AAEnC,aAAa,CAAC,MAAM,EAAE,CAAC;AAEvB,eAAe,aAAa,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event.js\";\nimport type ValueState from \"@ui5/webcomponents-base/dist/types/ValueState.js\";\n\nimport { registerToolbarItem } from \"./ToolbarRegistry.js\";\n\n// Templates\n\nimport ToolbarSelectTemplate from \"./generated/templates/ToolbarSelectTemplate.lit.js\";\nimport ToolbarPopoverSelectTemplate from \"./generated/templates/ToolbarPopoverSelectTemplate.lit.js\";\nimport ToolbarItem from \"./ToolbarItem.js\";\nimport Select from \"./Select.js\";\nimport Option from \"./Option.js\";\nimport type ToolbarSelectOption from \"./ToolbarSelectOption.js\";\nimport type { SelectChangeEventDetail } from \"./Select.js\";\n\ntype ToolbarSelectChangeEventDetail = SelectChangeEventDetail;\n\n/**\n * @class\n *\n * ### Overview\n * The `ui5-toolbar-select` component is used to create a toolbar drop-down list.\n * The items inside the `ui5-toolbar-select` define the available options by using the `ui5-toolbar-select-option` component.\n *\n * ### ES6 Module Import\n * `import \"@ui5/webcomponents/dist/ToolbarSelect.js\";`\n *\n * `import \"@ui5/webcomponents/dist/ToolbarSelectOption.js\";` (comes with `ui5-toolbar-select`)\n * @constructor\n * @abstract\n * @extends ToolbarItem\n * @public\n * @since 1.17.0\n */\n@customElement({\n\ttag: \"ui5-toolbar-select\",\n\tdependencies: [Select, Option],\n})\n\n/**\n * Fired when the selected option changes.\n * @allowPreventDefault\n * @param {HTMLElement} selectedOption the selected option.\n * @public\n */\n@event(\"change\", {\n\tdetail: {\n\t\t/**\n\t\t* @public\n\t\t*/\n\t\tselectedOption: { type: HTMLElement },\n\t},\n})\n\n/**\n * Fired after the component's dropdown menu opens.\n * @public\n */\n@event(\"open\")\n/**\n * Fired after the component's dropdown menu closes.\n * @public\n */\n@event(\"close\")\n\nclass ToolbarSelect extends ToolbarItem {\n\t/**\n\t * Defines the width of the select.\n\t *\n\t * **Note:** all CSS sizes are supported - 'percentage', 'px', 'rem', 'auto', etc.\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\twidth?: string;\n\n\t/**\n\t * Defines the component options.\n\t *\n\t * **Note:** Only one selected option is allowed.\n\t * If more than one option is defined as selected, the last one would be considered as the selected one.\n\t *\n\t * **Note:** Use the `ui5-toolbar-select-option` component to define the desired options.\n\t * @public\n\t */\n\t@slot({ \"default\": true, type: HTMLElement, invalidateOnChildChange: true })\n\toptions!: Array;\n\n\t/**\n\t * Defines the value state of the component.\n\t * @default \"None\"\n\t * @public\n\t */\n\t@property()\n\tvalueState: `${ValueState}` = \"None\";\n\n\t/**\n\t * Defines whether the component is in disabled state.\n\t *\n\t * **Note:** A disabled component is noninteractive.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t/**\n\t * Defines the accessible ARIA name of the component.\n\t * @public\n\t * @default undefined\n\t */\n\t@property()\n\taccessibleName?: string\n\n\t/**\n\t * Receives id(or many ids) of the elements that label the select.\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\taccessibleNameRef?: string;\n\n\t_onEvent: EventListener\n\n\tstatic get toolbarTemplate() {\n\t\treturn ToolbarSelectTemplate;\n\t}\n\n\tstatic get toolbarPopoverTemplate() {\n\t\treturn ToolbarPopoverSelectTemplate;\n\t}\n\n\tget subscribedEvents() {\n\t\tconst map = new Map();\n\n\t\tmap.set(\"click\", { preventClosing: true });\n\t\tmap.set(\"ui5-change\", { preventClosing: false });\n\t\tmap.set(\"ui5-open\", { preventClosing: true });\n\t\tmap.set(\"ui5-close\", { preventClosing: true });\n\n\t\treturn map;\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._onEvent = this._onEventHandler.bind(this);\n\t}\n\n\tonEnterDOM(): void {\n\t\tthis.attachEventListeners();\n\t}\n\n\tonExitDOM(): void {\n\t\tthis.detachEventListeners();\n\t}\n\n\tattachEventListeners(): void {\n\t\t[...this.subscribedEvents.keys()].forEach(e => {\n\t\t\tthis.addEventListener(e, this._onEvent);\n\t\t});\n\t}\n\n\tdetachEventListeners(): void {\n\t\t[...this.subscribedEvents.keys()].forEach(e => {\n\t\t\tthis.removeEventListener(e, this._onEvent);\n\t\t});\n\t}\n\n\t_onEventHandler(e: Event): void {\n\t\tif (e.type === \"ui5-change\") {\n\t\t\t// update options\n\t\t\tconst selectedOption = (e as CustomEvent).detail.selectedOption;\n\t\t\tconst selectedOptionIndex = Number(selectedOption?.getAttribute(\"data-ui5-external-action-item-index\"));\n\t\t\tthis.options.forEach((option: ToolbarSelectOption, index: number) => {\n\t\t\t\tif (index === selectedOptionIndex) {\n\t\t\t\t\toption.setAttribute(\"selected\", \"\");\n\t\t\t\t} else {\n\t\t\t\t\toption.removeAttribute(\"selected\");\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tget styles() {\n\t\treturn {\n\t\t\twidth: this.width,\n\t\t};\n\t}\n}\n\nregisterToolbarItem(ToolbarSelect);\n\nToolbarSelect.define();\n\nexport default ToolbarSelect;\n\nexport type {\n\tToolbarSelectChangeEventDetail,\n};\n"]}