UNPKG

@synergy-design-system/angular

Version:
411 lines (407 loc) 16.1 kB
import * as i0 from '@angular/core'; import { EventEmitter, Output, Input, Component } from '@angular/core'; import '@synergy-design-system/components/components/select/select.js'; // --------------------------------------------------------------------- // 🔒 AUTOGENERATED @synergy-design-system/angular wrappers for @synergy-design-system/components // Please do not edit this file directly! // It will get recreated when running pnpm build. // --------------------------------------------------------------------- /** * @summary Selects allow you to choose items from a menu of predefined options. * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-select--docs * @status stable * @since 2.0 * * @dependency syn-icon * @dependency syn-popup * @dependency syn-tag * * @slot - The listbox options. Must be `<syn-option>` elements. You can use `<syn-divider>` to group items visually. * @slot label - The input's label. Alternatively, you can use the `label` attribute. * @slot prefix - Used to prepend a presentational icon or similar element to the combobox. * @slot suffix - Used to append a presentational icon or similar element to the combobox. * @slot clear-icon - An icon to use in lieu of the default clear icon. * @slot expand-icon - The icon to show when the control is expanded and collapsed. Rotates on open and close. * @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute. * * @event syn-change - Emitted when the control's value changes. * @event syn-clear - Emitted when the control's value is cleared. * @event syn-input - Emitted when the control receives input. * @event syn-focus - Emitted when the control gains focus. * @event syn-blur - Emitted when the control loses focus. * @event syn-show - Emitted when the select's menu opens. * @event syn-after-show - Emitted after the select's menu opens and all animations are complete. * @event syn-hide - Emitted when the select's menu closes. * @event syn-after-hide - Emitted after the select's menu closes and all animations are complete. * @event syn-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied. * * @csspart form-control - The form control that wraps the label, input, and help text. * @csspart form-control-label - The label's wrapper. * @csspart form-control-input - The select's wrapper. * @csspart form-control-help-text - The help text's wrapper. * @csspart combobox - The container the wraps the prefix, suffix, combobox, clear icon, and expand button. * @csspart prefix - The container that wraps the prefix slot. * @csspart suffix - The container that wraps the suffix slot. * @csspart display-input - The element that displays the selected option's label, an `<input>` element. * @csspart listbox - The listbox container where options are slotted. * @csspart tags - The container that houses option tags when `multiselect` is used. * @csspart tag - The individual tags that represent each multiselect option. * @csspart tag__base - The tag's base part. * @csspart tag__content - The tag's content part. * @csspart tag__remove-button - The tag's remove button. * @csspart tag__remove-button__base - The tag's remove button base part. * @csspart clear-button - The clear button. * @csspart expand-icon - The container that wraps the expand icon. * @csspart popup - The popup's exported `popup` part. Use this to target the tooltip's popup container. */ class SynSelectComponent { nativeElement; _ngZone; modelSignal = new AbortController(); constructor(e, ngZone) { this.nativeElement = e.nativeElement; this._ngZone = ngZone; this.nativeElement.addEventListener('syn-change', (e) => { this.synChangeEvent.emit(e); }); this.nativeElement.addEventListener('syn-clear', (e) => { this.synClearEvent.emit(e); }); this.nativeElement.addEventListener('syn-input', (e) => { this.synInputEvent.emit(e); }); this.nativeElement.addEventListener('syn-focus', (e) => { this.synFocusEvent.emit(e); }); this.nativeElement.addEventListener('syn-blur', (e) => { this.synBlurEvent.emit(e); }); this.nativeElement.addEventListener('syn-show', (e) => { this.synShowEvent.emit(e); }); this.nativeElement.addEventListener('syn-after-show', (e) => { this.synAfterShowEvent.emit(e); }); this.nativeElement.addEventListener('syn-hide', (e) => { this.synHideEvent.emit(e); }); this.nativeElement.addEventListener('syn-after-hide', (e) => { this.synAfterHideEvent.emit(e); }); this.nativeElement.addEventListener('syn-invalid', (e) => { this.synInvalidEvent.emit(e); }); this.ngModelUpdateOn = 'syn-input'; } /** * The event that will trigger the ngModel update. * By default, this is set to "syn-input". */ set ngModelUpdateOn(v) { this.modelSignal.abort(); this.modelSignal = new AbortController(); const option = v || 'syn-input'; this.nativeElement.addEventListener(option, () => { this.valueChange.emit(this.value); }, { signal: this.modelSignal.signal, }); } get ngModelUpdateOn() { return this.ngModelUpdateOn; } /** * The delimiter to use when setting the value when `multiple` is enabled. The default is a space, but you can set it to a comma or other character. */ set delimiter(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.delimiter = v)); } get delimiter() { return this.nativeElement.delimiter; } /** * The name of the select, submitted as a name/value pair with form data. */ set name(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.name = v)); } get name() { return this.nativeElement.name; } /** * The select's size. */ set size(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.size = v)); } get size() { return this.nativeElement.size; } /** * Placeholder text to show as a hint when the select is empty. */ set placeholder(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.placeholder = v)); } get placeholder() { return this.nativeElement.placeholder; } /** * Allows more than one option to be selected. */ set multiple(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.multiple = v === '' || v)); } get multiple() { return this.nativeElement.multiple; } /** * The maximum number of selected options to show when `multiple` is true. * After the maximum, "+n" will be shown to indicate the number of additional items that are selected. * Set to 0 to remove the limit. */ set maxOptionsVisible(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.maxOptionsVisible = v)); } get maxOptionsVisible() { return this.nativeElement.maxOptionsVisible; } /** * Disables the select control. */ set disabled(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.disabled = v === '' || v)); } get disabled() { return this.nativeElement.disabled; } /** * Adds a clear button when the select is not empty. */ set clearable(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.clearable = v === '' || v)); } get clearable() { return this.nativeElement.clearable; } /** * Indicates whether or not the select is open. * You can toggle this attribute to show and hide the menu, or you can use the `show()` and `hide()` methods and this attribute will reflect the select's open state. */ set open(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.open = v === '' || v)); } get open() { return this.nativeElement.open; } /** * Enable this option to prevent the listbox from being clipped when the component is placed inside a container with `overflow: auto|scroll`. * Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios. */ set hoist(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.hoist = v === '' || v)); } get hoist() { return this.nativeElement.hoist; } /** * The select's label. * If you need to display HTML, use the `label` slot instead. */ set label(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.label = v)); } get label() { return this.nativeElement.label; } /** * The preferred placement of the select's menu. * Note that the actual placement may vary as needed to keep the listbox inside of the viewport. */ set placement(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.placement = v)); } get placement() { return this.nativeElement.placement; } /** * The select's help text. * If you need to display HTML, use the `help-text` slot instead. */ set helpText(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.helpText = v)); } get helpText() { return this.nativeElement.helpText; } /** * By default, form controls are associated with the nearest containing `<form>` element. * This attribute allows you to place the form control outside of a form and associate it with the form that has this `id`. * The form must be in the same document or shadow root for this to work. */ set form(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.form = v)); } get form() { return this.nativeElement.form; } /** * The select's required attribute. */ set required(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.required = v === '' || v)); } get required() { return this.nativeElement.required; } /** * A function that customizes the tags to be rendered when multiple=true. * The first argument is the option, the second is the current tag's index. * The function should return either a Lit TemplateResult or a string containing trusted HTML of the symbol to render at the specified value. */ set getTag(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.getTag = v)); } get getTag() { return this.nativeElement.getTag; } /** * The current value of the select, submitted as a name/value pair with form data. * When `multiple` is enabled, the value attribute will be a space-delimited list of values based on the options selected, and the value property will be an array. * **For this reason, values must not contain spaces.** */ set value(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.value = v)); } get value() { return this.nativeElement.value; } /** * Emitted when the control's value changes. */ synChangeEvent = new EventEmitter(); /** * Emitted when the control's value is cleared. */ synClearEvent = new EventEmitter(); /** * Emitted when the control receives input. */ synInputEvent = new EventEmitter(); /** * Emitted when the control gains focus. */ synFocusEvent = new EventEmitter(); /** * Emitted when the control loses focus. */ synBlurEvent = new EventEmitter(); /** * Emitted when the select's menu opens. */ synShowEvent = new EventEmitter(); /** * Emitted after the select's menu opens and all animations are complete. */ synAfterShowEvent = new EventEmitter(); /** * Emitted when the select's menu closes. */ synHideEvent = new EventEmitter(); /** * Emitted after the select's menu closes and all animations are complete. */ synAfterHideEvent = new EventEmitter(); /** * Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ synInvalidEvent = new EventEmitter(); /** * Support for two way data binding */ valueChange = new EventEmitter(); static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynSelectComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.1", type: SynSelectComponent, isStandalone: true, selector: "syn-select", inputs: { ngModelUpdateOn: "ngModelUpdateOn", delimiter: "delimiter", name: "name", size: "size", placeholder: "placeholder", multiple: "multiple", maxOptionsVisible: "maxOptionsVisible", disabled: "disabled", clearable: "clearable", open: "open", hoist: "hoist", label: "label", placement: "placement", helpText: "helpText", form: "form", required: "required", getTag: "getTag", value: "value" }, outputs: { synChangeEvent: "synChangeEvent", synClearEvent: "synClearEvent", synInputEvent: "synInputEvent", synFocusEvent: "synFocusEvent", synBlurEvent: "synBlurEvent", synShowEvent: "synShowEvent", synAfterShowEvent: "synAfterShowEvent", synHideEvent: "synHideEvent", synAfterHideEvent: "synAfterHideEvent", synInvalidEvent: "synInvalidEvent", valueChange: "valueChange" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynSelectComponent, decorators: [{ type: Component, args: [{ selector: 'syn-select', standalone: true, template: '<ng-content></ng-content>', }] }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }], propDecorators: { ngModelUpdateOn: [{ type: Input }], delimiter: [{ type: Input }], name: [{ type: Input }], size: [{ type: Input }], placeholder: [{ type: Input }], multiple: [{ type: Input }], maxOptionsVisible: [{ type: Input }], disabled: [{ type: Input }], clearable: [{ type: Input }], open: [{ type: Input }], hoist: [{ type: Input }], label: [{ type: Input }], placement: [{ type: Input }], helpText: [{ type: Input }], form: [{ type: Input }], required: [{ type: Input }], getTag: [{ type: Input }], value: [{ type: Input }], synChangeEvent: [{ type: Output }], synClearEvent: [{ type: Output }], synInputEvent: [{ type: Output }], synFocusEvent: [{ type: Output }], synBlurEvent: [{ type: Output }], synShowEvent: [{ type: Output }], synAfterShowEvent: [{ type: Output }], synHideEvent: [{ type: Output }], synAfterHideEvent: [{ type: Output }], synInvalidEvent: [{ type: Output }], valueChange: [{ type: Output }] } }); /** * Generated bundle index. Do not edit. */ export { SynSelectComponent }; //# sourceMappingURL=synergy-design-system-angular-components-select.mjs.map