@anglr/select 17.2.0 → 18.0.0-beta.20260805043138
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.
- package/.claude/skills/angular-developer/SKILL.md +130 -130
- package/.claude/skills/angular-developer/references/angular-animations.md +160 -160
- package/.claude/skills/angular-developer/references/angular-aria.md +410 -410
- package/.claude/skills/angular-developer/references/cli.md +86 -86
- package/.claude/skills/angular-developer/references/component-harnesses.md +59 -59
- package/.claude/skills/angular-developer/references/component-styling.md +91 -91
- package/.claude/skills/angular-developer/references/components.md +117 -117
- package/.claude/skills/angular-developer/references/creating-services.md +97 -97
- package/.claude/skills/angular-developer/references/data-resolvers.md +69 -69
- package/.claude/skills/angular-developer/references/define-routes.md +67 -67
- package/.claude/skills/angular-developer/references/defining-providers.md +72 -72
- package/.claude/skills/angular-developer/references/di-fundamentals.md +120 -120
- package/.claude/skills/angular-developer/references/e2e-testing.md +66 -66
- package/.claude/skills/angular-developer/references/effects.md +83 -83
- package/.claude/skills/angular-developer/references/hierarchical-injectors.md +43 -43
- package/.claude/skills/angular-developer/references/host-elements.md +80 -80
- package/.claude/skills/angular-developer/references/injection-context.md +63 -63
- package/.claude/skills/angular-developer/references/inputs.md +101 -101
- package/.claude/skills/angular-developer/references/linked-signal.md +59 -59
- package/.claude/skills/angular-developer/references/loading-strategies.md +61 -61
- package/.claude/skills/angular-developer/references/mcp.md +106 -106
- package/.claude/skills/angular-developer/references/migrations.md +30 -30
- package/.claude/skills/angular-developer/references/navigate-to-routes.md +69 -69
- package/.claude/skills/angular-developer/references/outputs.md +86 -86
- package/.claude/skills/angular-developer/references/reactive-forms.md +122 -122
- package/.claude/skills/angular-developer/references/rendering-strategies.md +44 -44
- package/.claude/skills/angular-developer/references/resource.md +77 -77
- package/.claude/skills/angular-developer/references/route-animations.md +56 -56
- package/.claude/skills/angular-developer/references/route-guards.md +52 -52
- package/.claude/skills/angular-developer/references/router-lifecycle.md +45 -45
- package/.claude/skills/angular-developer/references/router-testing.md +87 -87
- package/.claude/skills/angular-developer/references/show-routes-with-outlets.md +68 -68
- package/.claude/skills/angular-developer/references/signal-forms.md +897 -897
- package/.claude/skills/angular-developer/references/signals-overview.md +94 -94
- package/.claude/skills/angular-developer/references/tailwind-css.md +69 -69
- package/.claude/skills/angular-developer/references/template-driven-forms.md +114 -114
- package/.claude/skills/angular-developer/references/testing-fundamentals.md +66 -66
- package/.github/instructions/typescript/code-conventions.md +7 -7
- package/.github/instructions/typescript/comments.md +40 -40
- package/.github/instructions/typescript/formatting.md +41 -41
- package/.github/instructions/typescript/naming-conventions.md +6 -6
- package/es2022/extensions/src/extensions/getSearch.js.map +1 -1
- package/es2022/extensions/src/extensions/getSelectedOption.js.map +1 -1
- package/es2022/extensions/src/extensions/getSelectedOptions.js.map +1 -1
- package/es2022/extensions/src/extensions/getValue.js.map +1 -1
- package/es2022/extensions/src/extensions/setReadonly.js.map +1 -1
- package/es2022/extensions/src/extensions/setValue.js.map +1 -1
- package/es2022/extensions/src/index.js.map +1 -1
- package/es2022/src/components/index.js.map +1 -1
- package/es2022/src/components/option/option.component.js.map +1 -1
- package/es2022/src/components/optionGroup/optgroup.component.js.map +1 -1
- package/es2022/src/components/select/select.component.js +2 -2
- package/es2022/src/components/select/select.component.js.map +1 -1
- package/es2022/src/decorators/index.js.map +1 -1
- package/es2022/src/decorators/mergeOptionsAsSignal/mergeOptionsAsSignal.decorator.js.map +1 -1
- package/es2022/src/directives/highlightInstance/highlightInstance.directive.js.map +1 -1
- package/es2022/src/directives/highlightSearch/highlightSearch.directive.js.map +1 -1
- package/es2022/src/directives/highlightText/highlightText.directive.js.map +1 -1
- package/es2022/src/directives/index.js.map +1 -1
- package/es2022/src/directives/normalStateTagTemplate/normalStateTagTemplate.directive.js.map +1 -1
- package/es2022/src/directives/normalStateTemplate/normalStateTemplate.directive.js.map +1 -1
- package/es2022/src/directives/optionGroupTemplate/optionGroupTemplate.directive.js.map +1 -1
- package/es2022/src/directives/optionTemplate/optionTemplate.directive.js.map +1 -1
- package/es2022/src/directives/selectAbsolute/selectAbsolute.directive.js.map +1 -1
- package/es2022/src/directives/selectControlValueAccessor/selectControlValueAccessor.directive.js.map +1 -1
- package/es2022/src/directives/selectEdit/selectEdit.directive.js.map +1 -1
- package/es2022/src/directives/selectFormControl/selectFormControl.directive.js.map +1 -1
- package/es2022/src/directives/selectMultipleKeepPopup/selectMultipleKeepPopup.directive.js.map +1 -1
- package/es2022/src/directives/selectNoCarret/selectNoCarret.directive.js.map +1 -1
- package/es2022/src/directives/selectPlaceholder/selectPlaceholder.directive.js.map +1 -1
- package/es2022/src/directives/withDirectAccess/withDirectAccess.directive.js.map +1 -1
- package/es2022/src/index.js.map +1 -1
- package/es2022/src/interfaces/index.js.map +1 -1
- package/es2022/src/interfaces/initState/initState.interface.js.map +1 -1
- package/es2022/src/interfaces/keyboardAction/keyboardAction.interface.js.map +1 -1
- package/es2022/src/interfaces/normalStateContext/normalStateContext.interface.js.map +1 -1
- package/es2022/src/interfaces/normalStateTagContext/normalStateTagContext.interface.js.map +1 -1
- package/es2022/src/interfaces/optionsGatherer/optionsGatherer.interface.js.map +1 -1
- package/es2022/src/interfaces/pluginDescription/pluginDescription.interface.js.map +1 -1
- package/es2022/src/interfaces/pluginOptions/pluginOptions.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/index.js.map +1 -1
- package/es2022/src/interfaces/plugins/interactions/interactions.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/keyboardHandler/keyboardHandler.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/keyboardHandler/simpleKeyboardHandler.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/liveSearch/editLiveSearch.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/liveSearch/filterLiveSearch.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/liveSearch/liveSearch.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/normalState/editNormalState.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/normalState/normalState.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/normalState/simpleNormalState.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/optionsHandler/optionsHandler.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/optionsHandler/simpleOptionsHandler.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/popup/popup.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/popup/simplePopup.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/positioner/commonPositioner.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/positioner/popoverPositioner.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/positioner/positioner.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/readonlyState/readonlyState.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/valueHandler/dynamicValueHandler.interface.js.map +1 -1
- package/es2022/src/interfaces/plugins/valueHandler/valueHandler.interface.js.map +1 -1
- package/es2022/src/interfaces/popupContext/popupContext.interface.js.map +1 -1
- package/es2022/src/interfaces/selectApi/selectApi.interface.js.map +1 -1
- package/es2022/src/interfaces/selectBusOptions/selectBusOptions.interface.js.map +1 -1
- package/es2022/src/interfaces/selectCssClasses/selectCssClasses.interface.js.map +1 -1
- package/es2022/src/interfaces/selectEvent/selectEvent.interface.js.map +1 -1
- package/es2022/src/interfaces/selectEvents/selectEvents.interface.js.map +1 -1
- package/es2022/src/interfaces/selectOption/selectOption.interface.js.map +1 -1
- package/es2022/src/interfaces/selectOptionGroup/selectOptionGroup.interface.js.map +1 -1
- package/es2022/src/interfaces/selectOptionState/selectOptionState.interface.js.map +1 -1
- package/es2022/src/interfaces/selectOptionStateSyntetic/selectOptionStateSyntetic.interface.js.map +1 -1
- package/es2022/src/interfaces/selectOptions/selectOptions.interface.js.map +1 -1
- package/es2022/src/interfaces/selectPlugin/selectPlugin.interface.js.map +1 -1
- package/es2022/src/interfaces/selectPluginTypes/selectPluginTypes.interface.js.map +1 -1
- package/es2022/src/interfaces/tempValue/tempValue.interface.js.map +1 -1
- package/es2022/src/interfaces/templateGatherer/templateGatherer.interface.js.map +1 -1
- package/es2022/src/interfaces/visualPluginOptions/visualPluginOptions.interface.js.map +1 -1
- package/es2022/src/misc/classes/codeOptionsGatherer/codeOptionsGatherer.interface.js.map +1 -1
- package/es2022/src/misc/classes/index.js.map +1 -1
- package/es2022/src/misc/classes/selectBus/selectBus.js.map +1 -1
- package/es2022/src/misc/classes/selectPluginInstances/selectPluginInstances.js.map +1 -1
- package/es2022/src/misc/enums.js.map +1 -1
- package/es2022/src/misc/providers.js.map +1 -1
- package/es2022/src/misc/tokens.js.map +1 -1
- package/es2022/src/misc/types.js.map +1 -1
- package/es2022/src/misc/utils.js.map +1 -1
- package/es2022/src/modules/index.js.map +1 -1
- package/es2022/src/modules/select.module.js.map +1 -1
- package/es2022/src/pipes/addNewOption/addNewOption.pipe.js.map +1 -1
- package/es2022/src/pipes/displayOptionValue/displayOptionValue.pipe.js.map +1 -1
- package/es2022/src/pipes/displayValue/displayValue.pipe.js.map +1 -1
- package/es2022/src/pipes/getPlugin/getPlugin.pipe.js.map +1 -1
- package/es2022/src/pipes/groupedListOptions/groupedListOptions.pipe.js.map +1 -1
- package/es2022/src/pipes/hasValue/hasValue.pipe.js.map +1 -1
- package/es2022/src/pipes/index.js.map +1 -1
- package/es2022/src/pipes/optionCssClasses/optionCssClasses.pipe.js.map +1 -1
- package/es2022/src/plugins/index.js.map +1 -1
- package/es2022/src/plugins/interactions/index.js.map +1 -1
- package/es2022/src/plugins/interactions/simpleInteractions/simpleInteractions.component.js.map +1 -1
- package/es2022/src/plugins/keyboardHandler/index.js.map +1 -1
- package/es2022/src/plugins/keyboardHandler/simpleKeyboardHandler/simpleKeyboardHandler.component.js.map +1 -1
- package/es2022/src/plugins/liveSearch/editLiveSearch/editLiveSearch.component.js +2 -2
- package/es2022/src/plugins/liveSearch/editLiveSearch/editLiveSearch.component.js.map +1 -1
- package/es2022/src/plugins/liveSearch/filterLiveSearch/filterLiveSearch.component.js.map +1 -1
- package/es2022/src/plugins/liveSearch/index.js.map +1 -1
- package/es2022/src/plugins/liveSearch/noLiveSearch/noLiveSearch.component.js.map +1 -1
- package/es2022/src/plugins/normalState/editNormalState/editNormalState.component.js +2 -2
- package/es2022/src/plugins/normalState/editNormalState/editNormalState.component.js.map +1 -1
- package/es2022/src/plugins/normalState/index.js.map +1 -1
- package/es2022/src/plugins/normalState/simpleNormalState/simpleNormalState.component.js +5 -6
- package/es2022/src/plugins/normalState/simpleNormalState/simpleNormalState.component.js.map +1 -1
- package/es2022/src/plugins/optionsHandler/index.js.map +1 -1
- package/es2022/src/plugins/optionsHandler/noOptionsHandler/noOptionsHandler.component.js.map +1 -1
- package/es2022/src/plugins/optionsHandler/optionsHandlerBase.js.map +1 -1
- package/es2022/src/plugins/optionsHandler/simpleOptionsHandler/simpleOptionsHandler.component.js.map +1 -1
- package/es2022/src/plugins/popup/index.js.map +1 -1
- package/es2022/src/plugins/popup/simplePopup/simplePopup.component.js +2 -2
- package/es2022/src/plugins/popup/simplePopup/simplePopup.component.js.map +1 -1
- package/es2022/src/plugins/positioner/commonPositioner/commonPositioner.component.js.map +1 -1
- package/es2022/src/plugins/positioner/index.js.map +1 -1
- package/es2022/src/plugins/positioner/noPositioner/noPositioner.component.js.map +1 -1
- package/es2022/src/plugins/positioner/popoverPositioner/popoverPositioner.component.js.map +1 -1
- package/es2022/src/plugins/valueHandler/dynamicValueHandler/dynamicValueHandler.component.js.map +1 -1
- package/es2022/src/plugins/valueHandler/index.js.map +1 -1
- package/es2022/src/plugins/valueHandler/staticValueHandler/staticValueHandler.component.js.map +1 -1
- package/package.json +125 -125
- package/src/components/select/select.component.css +5 -5
- package/src/interfaces/plugins/normalState/simpleNormalState.interface.d.ts +1 -5
- package/src/interfaces/plugins/normalState/simpleNormalState.interface.d.ts.map +1 -1
- package/src/plugins/liveSearch/editLiveSearch/editLiveSearch.component.html +19 -19
- package/src/plugins/normalState/editNormalState/editNormalState.component.html +50 -50
- package/src/plugins/normalState/simpleNormalState/simpleNormalState.component.d.ts.map +1 -1
- package/src/plugins/normalState/simpleNormalState/simpleNormalState.component.html +36 -37
- package/src/plugins/popup/simplePopup/simplePopup.component.html +56 -56
- package/styles/components/_liveSearch.scss +32 -32
- package/styles/components/_normalState.scss +116 -116
- package/styles/components/_popup.scss +107 -107
- package/styles/components/_select.scss +14 -14
- package/styles/core/_defaultTheme.scss +105 -105
- package/styles/core/_misc.scss +34 -34
- package/styles/core/_mixins.scss +29 -29
- package/styles/index.scss +2 -2
- package/styles/themes/dark.scss +63 -63
- package/styles/themes/light.scss +64 -64
- package/version.bak +1 -1
|
@@ -172,7 +172,7 @@ export class EditLiveSearch {
|
|
|
172
172
|
this.valueOutput.set('');
|
|
173
173
|
}
|
|
174
174
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: EditLiveSearch, deps: [{ token: LIVE_SEARCH_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
175
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.4", type: EditLiveSearch, isStandalone: true, selector: "edit-live-search", host: { properties: { "class": "options.cssClasses.componentElement" } }, viewQueries: [{ propertyName: "htmlInput", first: true, predicate: ["htmlInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<input #htmlInput\n type=\"text\"\n aria-autocomplete=\"list\"\n autocorrect=\"off\"\n autocapitalize=\"none\"\n autocomplete=\"off\"\n role=\"combobox\"\n [attr.aria-expanded]=\"selectBus.popupVisible()\"\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\n [attr.aria-controls]=\"selectBus.popupVisible() ? selectBus.id : null\"\n [attr.aria-activedescendant]=\"selectBus.popupVisible() ? activeDescendant() : null\"\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\n [class]=\"cssClasses()\"\n [tooltip]=\"selectBus.selectedOptions() | displayValue | localize\"\n [disabled]=\"selectBus.selectOptions().readonly\"\n [placeholder]=\"(!(selectBus.selectedOptions() | hasValue) ? selectBus.selectOptions().placeholder : '') | localize\"\n (click)=\"click()\"\n (focus)=\"handleFocus()\"\n (blur)=\"blur()\"\n (input)=\"input($event)\">", dependencies: [{ kind: "directive", type: TooltipDirective, selector: "[tooltip]", inputs: ["tooltip", "allowHtml", "template", "tooltipOptions", "tooltipVisible", "containerElement"] }, { kind: "pipe", type: HasValue, name: "hasValue" }, { kind: "pipe", type: DisplayValue, name: "displayValue" }, { kind: "pipe", type: LocalizePipe, name: "localize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
175
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.4", type: EditLiveSearch, isStandalone: true, selector: "edit-live-search", host: { properties: { "class": "options.cssClasses.componentElement" } }, viewQueries: [{ propertyName: "htmlInput", first: true, predicate: ["htmlInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<input #htmlInput\r\n type=\"text\"\r\n aria-autocomplete=\"list\"\r\n autocorrect=\"off\"\r\n autocapitalize=\"none\"\r\n autocomplete=\"off\"\r\n role=\"combobox\"\r\n [attr.aria-expanded]=\"selectBus.popupVisible()\"\r\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [attr.aria-controls]=\"selectBus.popupVisible() ? selectBus.id : null\"\r\n [attr.aria-activedescendant]=\"selectBus.popupVisible() ? activeDescendant() : null\"\r\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [class]=\"cssClasses()\"\r\n [tooltip]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [disabled]=\"selectBus.selectOptions().readonly\"\r\n [placeholder]=\"(!(selectBus.selectedOptions() | hasValue) ? selectBus.selectOptions().placeholder : '') | localize\"\r\n (click)=\"click()\"\r\n (focus)=\"handleFocus()\"\r\n (blur)=\"blur()\"\r\n (input)=\"input($event)\">", dependencies: [{ kind: "directive", type: TooltipDirective, selector: "[tooltip]", inputs: ["tooltip", "allowHtml", "template", "tooltipOptions", "tooltipVisible", "containerElement"] }, { kind: "pipe", type: HasValue, name: "hasValue" }, { kind: "pipe", type: DisplayValue, name: "displayValue" }, { kind: "pipe", type: LocalizePipe, name: "localize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
176
176
|
}
|
|
177
177
|
__decorate([
|
|
178
178
|
CopyOptionsAsSignal(),
|
|
@@ -187,7 +187,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
187
187
|
DisplayValue,
|
|
188
188
|
LocalizePipe,
|
|
189
189
|
TooltipDirective,
|
|
190
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<input #htmlInput\n type=\"text\"\n aria-autocomplete=\"list\"\n autocorrect=\"off\"\n autocapitalize=\"none\"\n autocomplete=\"off\"\n role=\"combobox\"\n [attr.aria-expanded]=\"selectBus.popupVisible()\"\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\n [attr.aria-controls]=\"selectBus.popupVisible() ? selectBus.id : null\"\n [attr.aria-activedescendant]=\"selectBus.popupVisible() ? activeDescendant() : null\"\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\n [class]=\"cssClasses()\"\n [tooltip]=\"selectBus.selectedOptions() | displayValue | localize\"\n [disabled]=\"selectBus.selectOptions().readonly\"\n [placeholder]=\"(!(selectBus.selectedOptions() | hasValue) ? selectBus.selectOptions().placeholder : '') | localize\"\n (click)=\"click()\"\n (focus)=\"handleFocus()\"\n (blur)=\"blur()\"\n (input)=\"input($event)\">" }]
|
|
190
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<input #htmlInput\r\n type=\"text\"\r\n aria-autocomplete=\"list\"\r\n autocorrect=\"off\"\r\n autocapitalize=\"none\"\r\n autocomplete=\"off\"\r\n role=\"combobox\"\r\n [attr.aria-expanded]=\"selectBus.popupVisible()\"\r\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [attr.aria-controls]=\"selectBus.popupVisible() ? selectBus.id : null\"\r\n [attr.aria-activedescendant]=\"selectBus.popupVisible() ? activeDescendant() : null\"\r\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [class]=\"cssClasses()\"\r\n [tooltip]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [disabled]=\"selectBus.selectOptions().readonly\"\r\n [placeholder]=\"(!(selectBus.selectedOptions() | hasValue) ? selectBus.selectOptions().placeholder : '') | localize\"\r\n (click)=\"click()\"\r\n (focus)=\"handleFocus()\"\r\n (blur)=\"blur()\"\r\n (input)=\"input($event)\">" }]
|
|
191
191
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
192
192
|
type: Inject,
|
|
193
193
|
args: [LIVE_SEARCH_OPTIONS]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editLiveSearch.component.js","sourceRoot":"","sources":["../../../../../src/plugins/liveSearch/editLiveSearch/editLiveSearch.component.ts","../../../../../src/plugins/liveSearch/editLiveSearch/editLiveSearch.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,iBAAiB,EAAE,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAa,QAAQ,EAAE,MAAM,EAAU,SAAS,EAAiB,MAAM,eAAe,CAAC;AAC5M,OAAO,EAAC,YAAY,EAAE,MAAM,EAAU,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,YAAY,EAAE,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAC,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAC,qBAAqB,EAAE,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,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AAc,kBAuFH,mBAAmB;kGAvF9B,cAAc,8QC3C3B,++BAmB+B,4CDoBvB,gBAAgB,uJAHhB,QAAQ,4CACR,YAAY,gDACZ,YAAY;;AAwCT;IADN,mBAAmB,EAAE;;+CACsC;2FAnCnD,cAAc;kBAjB1B,SAAS;+BAEI,kBAAkB,QAG5B;wBACI,SAAS,EAAE,qCAAqC;qBACnD,WAED;wBACI,QAAQ;wBACR,YAAY;wBACZ,YAAY;wBACZ,gBAAgB;qBACnB,mBACgB,uBAAuB,CAAC,MAAM;;0BAyFlC,MAAM;2BAAC,mBAAmB;;0BAAG,QAAQ;+FA9B6B,WAAW","sourcesContent":["import {afterRenderEffect, ChangeDetectionStrategy, Component, computed, DOCUMENT, effect, ElementRef, Inject, inject, OnDestroy, Optional, signal, Signal, viewChild, WritableSignal} from '@angular/core';\nimport {LocalizePipe, LOGGER, Logger, TooltipDirective} from '@anglr/common';\nimport {isDescendant, isPresent, RecursivePartial} from '@jscrpt/common';\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\n\nimport {LiveSearch, EditLiveSearchCssClasses, LiveSearchOptions, SelectPlugin} from '../../../interfaces';\nimport {SelectPluginInstances, SelectBus} from '../../../misc/classes';\nimport {CopyOptionsAsSignal} from '../../../decorators';\nimport {LIVE_SEARCH_OPTIONS} from '../../../misc/tokens';\nimport {DisplayValue, HasValue} from '../../../pipes';\n\nconst defaultOptions: LiveSearchOptions<EditLiveSearchCssClasses> =\n{\n searchDebounceTimeout: 280,\n cssClasses:\n {\n componentElement: 'live-search-component',\n searchElement: 'live-search-input',\n multiple: 'select-flex-1',\n single: 'absolute-input',\n },\n};\n\n/**\n * Live search component used for in edit Select.\n */\n@Component(\n{\n selector: 'edit-live-search',\n templateUrl: 'editLiveSearch.component.html',\n host:\n {\n '[class]': 'options.cssClasses.componentElement',\n },\n imports:\n [\n HasValue,\n DisplayValue,\n LocalizePipe,\n TooltipDirective,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class EditLiveSearch<TValue = unknown, TPublicValue = TValue> implements LiveSearch<TValue, TPublicValue, LiveSearchOptions<EditLiveSearchCssClasses>>, OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Indication whether input search value is empty\n */\n protected emptyInputSignal: WritableSignal<boolean> = signal(true);\n\n /**\n * Timeout used for debouncing search input\n */\n protected timeout: number|undefined|null;\n\n /**\n * Instance of logger for logging purposes\n */\n protected logger: Logger = inject(LOGGER);\n\n /**\n * Value of search input holding value that was set by user\n */\n protected valueOutput: WritableSignal<string> = signal('');\n\n /**\n * Reference to document object for DOM operations\n */\n protected document: Document = inject(DOCUMENT);\n\n //######################### public properties - implementation of SelectPlugin #########################\n\n /**\n * @inheritdoc\n */\n @CopyOptionsAsSignal()\n public options: LiveSearchOptions<EditLiveSearchCssClasses>;\n\n /**\n * @inheritdoc\n */\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\n\n /**\n * @inheritdoc\n */\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\n\n /**\n * @inheritdoc\n */\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\n\n //######################### protected properties - children #########################\n\n /**\n * HTML input element used for search input\n */\n protected htmlInput: Signal<ElementRef<HTMLInputElement>> = viewChild.required('htmlInput');\n\n //######################### protected properties - template bindings #########################\n\n /**\n * Css classes applied to search input element\n */\n protected cssClasses: Signal<string[]>;\n\n /**\n * Active descendant for aria-activedescendant attribute\n */\n protected activeDescendant: Signal<string>;\n\n //######################### public properties - implementation of LiveSearch #########################\n\n /**\n * @inheritdoc\n */\n public readonly search: Signal<string>;\n\n /**\n * @inheritdoc\n */\n public get emptyInput(): Signal<boolean>\n {\n return this.emptyInputSignal.asReadonly();\n }\n\n //######################### constructor #########################\n constructor(@Inject(LIVE_SEARCH_OPTIONS) @Optional() options?: RecursivePartial<LiveSearchOptions<EditLiveSearchCssClasses>>|null,)\n {\n this.options = deepCopyWithArrayOverride(defaultOptions as LiveSearchOptions<EditLiveSearchCssClasses>,\n options);\n\n this.search = computed(() => this.valueOutput());\n\n const ref = afterRenderEffect(() =>\n {\n if(this.pluginElement.nativeElement.parentElement?.nodeName == 'NG-SELECT')\n {\n this.logger.verbose('Select: Live Search: removing plugin from DOM');\n this.pluginElement.nativeElement.remove();\n }\n\n ref.destroy();\n });\n\n effect(() =>\n {\n this.selectBus.selectedOptions();\n this.logger.verbose('Select: Live Search: selected value changed, resetting search input');\n\n this.clearSearchInput();\n });\n\n effect(() =>\n {\n //prevents clearing when changing tab or window\n if(!this.selectBus.hasFocusComputed() && (!this.document.activeElement || !isDescendant(this.selectBus.selectElement().nativeElement, this.document.activeElement as HTMLElement)))\n {\n this.logger.verbose('Select: Live Search: select lost focus, resetting search input');\n this.clearSearchInput();\n }\n });\n\n this.cssClasses = computed(() => [this.options.cssClasses.searchElement,\n ...(this.selectBus.selectOptions().multiple ? [...this.options.cssClasses.multiple.split(' ')] : [...this.options.cssClasses.single.split(' ')])]);\n\n this.activeDescendant = computed(() => `${this.selectBus.id}-${this.selectPlugins.optionsHandler()?.listOptions()?.find(option => option.active())?.index}`);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * @inheritdoc\n */\n public ngOnDestroy(): void\n {\n if(isPresent(this.timeout))\n {\n clearTimeout(this.timeout);\n }\n }\n\n //######################### public methods - implementation of LiveSearch #########################\n\n /**\n * @inheritdoc\n */\n public focus(): void\n {\n this.htmlInput().nativeElement.focus();\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Handles click event\n */\n protected click(): void\n {\n if(this.selectBus.popupVisible())\n {\n return;\n }\n\n this.selectBus.click.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles focus event\n */\n protected handleFocus(): void\n {\n this.selectBus.internalsFocus.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles blur event\n */\n protected blur(): void\n {\n this.selectBus.internalsBlur.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles input event on search input\n * @param event - Event that occured\n */\n protected input(event: Event): void\n {\n this.selectBus.showPopup.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n\n if(isPresent(this.timeout))\n {\n clearTimeout(this.timeout);\n }\n\n this.emptyInputSignal.set((event.target as HTMLInputElement).value.length == 0);\n\n this.timeout = setTimeout(() =>\n {\n this.logger.verbose('Select: Live Search: emitting search value {{value}}', {value: (event.target as HTMLInputElement).value});\n this.valueOutput.set((event.target as HTMLInputElement).value);\n }, this.options.searchDebounceTimeout) as unknown as number;\n }\n\n //######################### protected methods #########################\n\n /**\n * Clears search input value and sets empty input signal to true\n */\n protected clearSearchInput(): void\n {\n this.htmlInput().nativeElement.value = '';\n this.emptyInputSignal.set(true);\n this.valueOutput.set('');\n }\n}\n","<input #htmlInput\n type=\"text\"\n aria-autocomplete=\"list\"\n autocorrect=\"off\"\n autocapitalize=\"none\"\n autocomplete=\"off\"\n role=\"combobox\"\n [attr.aria-expanded]=\"selectBus.popupVisible()\"\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\n [attr.aria-controls]=\"selectBus.popupVisible() ? selectBus.id : null\"\n [attr.aria-activedescendant]=\"selectBus.popupVisible() ? activeDescendant() : null\"\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\n [class]=\"cssClasses()\"\n [tooltip]=\"selectBus.selectedOptions() | displayValue | localize\"\n [disabled]=\"selectBus.selectOptions().readonly\"\n [placeholder]=\"(!(selectBus.selectedOptions() | hasValue) ? selectBus.selectOptions().placeholder : '') | localize\"\n (click)=\"click()\"\n (focus)=\"handleFocus()\"\n (blur)=\"blur()\"\n (input)=\"input($event)\">"]}
|
|
1
|
+
{"version":3,"file":"editLiveSearch.component.js","sourceRoot":"","sources":["../../../../../src/plugins/liveSearch/editLiveSearch/editLiveSearch.component.ts","../../../../../src/plugins/liveSearch/editLiveSearch/editLiveSearch.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,iBAAiB,EAAE,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAa,QAAQ,EAAE,MAAM,EAAU,SAAS,EAAiB,MAAM,eAAe,CAAC;AAC5M,OAAO,EAAC,YAAY,EAAE,MAAM,EAAU,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,YAAY,EAAE,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAC,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAC,qBAAqB,EAAE,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;;AAEtD,MAAM,cAAc,GACpB;IACI,qBAAqB,EAAE,GAAG;IAC1B,UAAU,EACV;QACI,gBAAgB,EAAE,uBAAuB;QACzC,aAAa,EAAE,mBAAmB;QAClC,QAAQ,EAAE,eAAe;QACzB,MAAM,EAAE,gBAAgB;KAC3B;CACJ,CAAC;AAEF;;GAEG;AAkBH,MAAM,OAAO,cAAc;IA8EvB;;OAEG;IACH,IAAW,UAAU;QAEjB,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;IAC9C,CAAC;IAED,iEAAiE;IACjE,YAAqD,OAA4E;QArFjI,sEAAsE;QAEtE;;WAEG;QACO,qBAAgB,GAA4B,MAAM,CAAC,IAAI;6FAAC,CAAC;QAOnE;;WAEG;QACO,WAAM,GAAW,MAAM,CAAC,MAAM,CAAC,CAAC;QAE1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AAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAE3B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,sDAAsD,EAAE,EAAC,KAAK,EAAG,KAAK,CAAC,MAA2B,CAAC,KAAK,EAAC,CAAC,CAAC;YAC/H,IAAI,CAAC,WAAW,CAAC,GAAG,CAAE,KAAK,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAC;QACnE,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAsB,CAAC;IAChE,CAAC;IAED,uEAAuE;IAEvE;;OAEG;IACO,gBAAgB;QAEtB,IAAI,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,KAAK,GAAG,EAAE,CAAC;QAC1C,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;8GA3OQ,cAAc,kBAuFH,mBAAmB;kGAvF9B,cAAc,8QC3C3B,qhCAmB+B,4CDoBvB,gBAAgB,uJAHhB,QAAQ,4CACR,YAAY,gDACZ,YAAY;;AAwCT;IADN,mBAAmB,EAAE;;+CACsC;2FAnCnD,cAAc;kBAjB1B,SAAS;+BAEI,kBAAkB,QAG5B;wBACI,SAAS,EAAE,qCAAqC;qBACnD,WAED;wBACI,QAAQ;wBACR,YAAY;wBACZ,YAAY;wBACZ,gBAAgB;qBACnB,mBACgB,uBAAuB,CAAC,MAAM;;0BAyFlC,MAAM;2BAAC,mBAAmB;;0BAAG,QAAQ;+FA9B6B,WAAW","sourcesContent":["import {afterRenderEffect, ChangeDetectionStrategy, Component, computed, DOCUMENT, effect, ElementRef, Inject, inject, OnDestroy, Optional, signal, Signal, viewChild, WritableSignal} from '@angular/core';\r\nimport {LocalizePipe, LOGGER, Logger, TooltipDirective} from '@anglr/common';\r\nimport {isDescendant, isPresent, RecursivePartial} from '@jscrpt/common';\r\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\r\n\r\nimport {LiveSearch, EditLiveSearchCssClasses, LiveSearchOptions, SelectPlugin} from '../../../interfaces';\r\nimport {SelectPluginInstances, SelectBus} from '../../../misc/classes';\r\nimport {CopyOptionsAsSignal} from '../../../decorators';\r\nimport {LIVE_SEARCH_OPTIONS} from '../../../misc/tokens';\r\nimport {DisplayValue, HasValue} from '../../../pipes';\r\n\r\nconst defaultOptions: LiveSearchOptions<EditLiveSearchCssClasses> =\r\n{\r\n searchDebounceTimeout: 280,\r\n cssClasses:\r\n {\r\n componentElement: 'live-search-component',\r\n searchElement: 'live-search-input',\r\n multiple: 'select-flex-1',\r\n single: 'absolute-input',\r\n },\r\n};\r\n\r\n/**\r\n * Live search component used for in edit Select.\r\n */\r\n@Component(\r\n{\r\n selector: 'edit-live-search',\r\n templateUrl: 'editLiveSearch.component.html',\r\n host:\r\n {\r\n '[class]': 'options.cssClasses.componentElement',\r\n },\r\n imports:\r\n [\r\n HasValue,\r\n DisplayValue,\r\n LocalizePipe,\r\n TooltipDirective,\r\n ],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class EditLiveSearch<TValue = unknown, TPublicValue = TValue> implements LiveSearch<TValue, TPublicValue, LiveSearchOptions<EditLiveSearchCssClasses>>, OnDestroy\r\n{\r\n //######################### protected fields #########################\r\n\r\n /**\r\n * Indication whether input search value is empty\r\n */\r\n protected emptyInputSignal: WritableSignal<boolean> = signal(true);\r\n\r\n /**\r\n * Timeout used for debouncing search input\r\n */\r\n protected timeout: number|undefined|null;\r\n\r\n /**\r\n * Instance of logger for logging purposes\r\n */\r\n protected logger: Logger = inject(LOGGER);\r\n\r\n /**\r\n * Value of search input holding value that was set by user\r\n */\r\n protected valueOutput: WritableSignal<string> = signal('');\r\n\r\n /**\r\n * Reference to document object for DOM operations\r\n */\r\n protected document: Document = inject(DOCUMENT);\r\n\r\n //######################### public properties - implementation of SelectPlugin #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n @CopyOptionsAsSignal()\r\n public options: LiveSearchOptions<EditLiveSearchCssClasses>;\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\r\n\r\n //######################### protected properties - children #########################\r\n\r\n /**\r\n * HTML input element used for search input\r\n */\r\n protected htmlInput: Signal<ElementRef<HTMLInputElement>> = viewChild.required('htmlInput');\r\n\r\n //######################### protected properties - template bindings #########################\r\n\r\n /**\r\n * Css classes applied to search input element\r\n */\r\n protected cssClasses: Signal<string[]>;\r\n\r\n /**\r\n * Active descendant for aria-activedescendant attribute\r\n */\r\n protected activeDescendant: Signal<string>;\r\n\r\n //######################### public properties - implementation of LiveSearch #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public readonly search: Signal<string>;\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public get emptyInput(): Signal<boolean>\r\n {\r\n return this.emptyInputSignal.asReadonly();\r\n }\r\n\r\n //######################### constructor #########################\r\n constructor(@Inject(LIVE_SEARCH_OPTIONS) @Optional() options?: RecursivePartial<LiveSearchOptions<EditLiveSearchCssClasses>>|null,)\r\n {\r\n this.options = deepCopyWithArrayOverride(defaultOptions as LiveSearchOptions<EditLiveSearchCssClasses>,\r\n options);\r\n\r\n this.search = computed(() => this.valueOutput());\r\n\r\n const ref = afterRenderEffect(() =>\r\n {\r\n if(this.pluginElement.nativeElement.parentElement?.nodeName == 'NG-SELECT')\r\n {\r\n this.logger.verbose('Select: Live Search: removing plugin from DOM');\r\n this.pluginElement.nativeElement.remove();\r\n }\r\n\r\n ref.destroy();\r\n });\r\n\r\n effect(() =>\r\n {\r\n this.selectBus.selectedOptions();\r\n this.logger.verbose('Select: Live Search: selected value changed, resetting search input');\r\n\r\n this.clearSearchInput();\r\n });\r\n\r\n effect(() =>\r\n {\r\n //prevents clearing when changing tab or window\r\n if(!this.selectBus.hasFocusComputed() && (!this.document.activeElement || !isDescendant(this.selectBus.selectElement().nativeElement, this.document.activeElement as HTMLElement)))\r\n {\r\n this.logger.verbose('Select: Live Search: select lost focus, resetting search input');\r\n this.clearSearchInput();\r\n }\r\n });\r\n\r\n this.cssClasses = computed(() => [this.options.cssClasses.searchElement,\r\n ...(this.selectBus.selectOptions().multiple ? [...this.options.cssClasses.multiple.split(' ')] : [...this.options.cssClasses.single.split(' ')])]);\r\n\r\n this.activeDescendant = computed(() => `${this.selectBus.id}-${this.selectPlugins.optionsHandler()?.listOptions()?.find(option => option.active())?.index}`);\r\n }\r\n\r\n //######################### public methods - implementation of OnDestroy #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public ngOnDestroy(): void\r\n {\r\n if(isPresent(this.timeout))\r\n {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n //######################### public methods - implementation of LiveSearch #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public focus(): void\r\n {\r\n this.htmlInput().nativeElement.focus();\r\n }\r\n\r\n //######################### protected methods - template bindings #########################\r\n\r\n /**\r\n * Handles click event\r\n */\r\n protected click(): void\r\n {\r\n if(this.selectBus.popupVisible())\r\n {\r\n return;\r\n }\r\n\r\n this.selectBus.click.next(\r\n {\r\n source: this as SelectPlugin,\r\n sourceElement: this.pluginElement.nativeElement,\r\n data: null,\r\n });\r\n }\r\n\r\n /**\r\n * Handles focus event\r\n */\r\n protected handleFocus(): void\r\n {\r\n this.selectBus.internalsFocus.next(\r\n {\r\n source: this as SelectPlugin,\r\n sourceElement: this.pluginElement.nativeElement,\r\n data: null,\r\n });\r\n }\r\n\r\n /**\r\n * Handles blur event\r\n */\r\n protected blur(): void\r\n {\r\n this.selectBus.internalsBlur.next(\r\n {\r\n source: this as SelectPlugin,\r\n sourceElement: this.pluginElement.nativeElement,\r\n data: null,\r\n });\r\n }\r\n\r\n /**\r\n * Handles input event on search input\r\n * @param event - Event that occured\r\n */\r\n protected input(event: Event): void\r\n {\r\n this.selectBus.showPopup.next(\r\n {\r\n source: this as SelectPlugin,\r\n sourceElement: this.pluginElement.nativeElement,\r\n data: null,\r\n });\r\n\r\n if(isPresent(this.timeout))\r\n {\r\n clearTimeout(this.timeout);\r\n }\r\n\r\n this.emptyInputSignal.set((event.target as HTMLInputElement).value.length == 0);\r\n\r\n this.timeout = setTimeout(() =>\r\n {\r\n this.logger.verbose('Select: Live Search: emitting search value {{value}}', {value: (event.target as HTMLInputElement).value});\r\n this.valueOutput.set((event.target as HTMLInputElement).value);\r\n }, this.options.searchDebounceTimeout) as unknown as number;\r\n }\r\n\r\n //######################### protected methods #########################\r\n\r\n /**\r\n * Clears search input value and sets empty input signal to true\r\n */\r\n protected clearSearchInput(): void\r\n {\r\n this.htmlInput().nativeElement.value = '';\r\n this.emptyInputSignal.set(true);\r\n this.valueOutput.set('');\r\n }\r\n}\r\n","<input #htmlInput\r\n type=\"text\"\r\n aria-autocomplete=\"list\"\r\n autocorrect=\"off\"\r\n autocapitalize=\"none\"\r\n autocomplete=\"off\"\r\n role=\"combobox\"\r\n [attr.aria-expanded]=\"selectBus.popupVisible()\"\r\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [attr.aria-controls]=\"selectBus.popupVisible() ? selectBus.id : null\"\r\n [attr.aria-activedescendant]=\"selectBus.popupVisible() ? activeDescendant() : null\"\r\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [class]=\"cssClasses()\"\r\n [tooltip]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [disabled]=\"selectBus.selectOptions().readonly\"\r\n [placeholder]=\"(!(selectBus.selectedOptions() | hasValue) ? selectBus.selectOptions().placeholder : '') | localize\"\r\n (click)=\"click()\"\r\n (focus)=\"handleFocus()\"\r\n (blur)=\"blur()\"\r\n (input)=\"input($event)\">"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterLiveSearch.component.js","sourceRoot":"","sources":["../../../../../src/plugins/liveSearch/filterLiveSearch/filterLiveSearch.component.ts","../../../../../src/plugins/liveSearch/filterLiveSearch/filterLiveSearch.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,iBAAiB,EAAE,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAyB,MAAM,eAAe,CAAC;AACpK,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAC,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAC,qBAAqB,EAAE,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;;AAEzD,MAAM,cAAc,GACpB;IACI,qBAAqB,EAAE,GAAG;IAC1B,KAAK,EACL;QACI,iBAAiB,EAAE,gBAAgB;KACtC;IACD,UAAU,EACV;QACI,gBAAgB,EAAE,uBAAuB;KAC5C;CACJ,CAAC;AAEF;;GAEG;AAgBH,MAAM,OAAO,gBAAgB;IA8CzB;;OAEG;IACH,IAAW,UAAU;QAEjB,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;IAC9C,CAAC;IAED,iEAAiE;IACjE,YAAqD,OAA8E;QArDnI,sEAAsE;QAEtE;;WAEG;QACO,qBAAgB,GAA4B,MAAM,CAAC,IAAI;6FAAC,CAAC;QAiBnE;;WAEG;QACI,kBAAa,GAAgD,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAElG;;WAEG;QACI,kBAAa,GAA4B,MA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,SAAS;wBACT,YAAY;qBACf,mBACgB,uBAAuB,CAAC,MAAM;;0BAyDlC,MAAM;2BAAC,mBAAmB;;0BAAG,QAAQ","sourcesContent":["import {afterRenderEffect, ChangeDetectionStrategy, Component, computed, ElementRef, Inject, inject, Optional, signal, Signal, WritableSignal} from '@angular/core';\nimport {debounce, form, FormField} from '@angular/forms/signals';\nimport {LocalizePipe} from '@anglr/common';\nimport {RecursivePartial} from '@jscrpt/common';\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\n\nimport {LiveSearch, LiveSearchCssClasses, FilterLiveSearchOptions} from '../../../interfaces';\nimport {SelectPluginInstances, SelectBus} from '../../../misc/classes';\nimport {CopyOptionsAsSignal} from '../../../decorators';\nimport {LIVE_SEARCH_OPTIONS} from '../../../misc/tokens';\n\nconst defaultOptions: FilterLiveSearchOptions<LiveSearchCssClasses> =\n{\n searchDebounceTimeout: 280,\n texts:\n {\n searchPlaceholder: 'filter options',\n },\n cssClasses:\n {\n componentElement: 'live-search-component',\n },\n};\n\n/**\n * Live search component used for filtering listed options\n */\n@Component(\n{\n selector: 'filter-live-search',\n templateUrl: 'filterLiveSearch.component.html',\n host:\n {\n '[class]': 'options.cssClasses.componentElement',\n },\n imports:\n [\n FormField,\n LocalizePipe,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FilterLiveSearch<TValue = unknown, TPublicValue = TValue> implements LiveSearch<TValue, TPublicValue, FilterLiveSearchOptions<LiveSearchCssClasses>>\n{\n //######################### protected fields #########################\n\n /**\n * Indication whether input search value is empty\n */\n protected emptyInputSignal: WritableSignal<boolean> = signal(true);\n\n //######################### protected properties - template bindings #########################\n\n /**\n * Instance of form value\n */\n protected value;\n\n //######################### public properties - implementation of SelectPlugin #########################\n\n /**\n * @inheritdoc\n */\n @CopyOptionsAsSignal()\n public options: FilterLiveSearchOptions<LiveSearchCssClasses>;\n\n /**\n * @inheritdoc\n */\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\n\n /**\n * @inheritdoc\n */\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\n\n /**\n * @inheritdoc\n */\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\n\n //######################### public properties - implementation of LiveSearch #########################\n\n /**\n * @inheritdoc\n */\n public readonly search: Signal<string>;\n\n /**\n * @inheritdoc\n */\n public get emptyInput(): Signal<boolean>\n {\n return this.emptyInputSignal.asReadonly();\n }\n\n //######################### constructor #########################\n constructor(@Inject(LIVE_SEARCH_OPTIONS) @Optional() options?: RecursivePartial<FilterLiveSearchOptions<LiveSearchCssClasses>>|null,)\n {\n this.options = deepCopyWithArrayOverride(defaultOptions as FilterLiveSearchOptions<LiveSearchCssClasses>,\n options);\n\n this.value = form(signal(''), path => debounce(path, this.options.searchDebounceTimeout));\n\n this.search = computed(() =>\n {\n return this.value().value();\n });\n\n const ref = afterRenderEffect(() =>\n {\n if(this.pluginElement.nativeElement.parentElement?.nodeName == 'NG-SELECT')\n {\n this.pluginElement.nativeElement.remove();\n }\n\n ref.destroy();\n });\n }\n\n //######################### public methods - implementation of LiveSearch #########################\n\n /**\n * @inheritdoc\n */\n public focus(): void\n {\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Handles input event on search input\n * @param event - Event that occured\n */\n protected input(event: Event): void\n {\n this.emptyInputSignal.set((event.target as HTMLInputElement).value.length == 0);\n }\n}\n","<input type=\"text\" [placeholder]=\"options.texts.searchPlaceholder | localize\" [formField]=\"value\">"]}
|
|
1
|
+
{"version":3,"file":"filterLiveSearch.component.js","sourceRoot":"","sources":["../../../../../src/plugins/liveSearch/filterLiveSearch/filterLiveSearch.component.ts","../../../../../src/plugins/liveSearch/filterLiveSearch/filterLiveSearch.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,iBAAiB,EAAE,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,E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CAAC,CAAC;QAE1F,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,EAAE;YAExB,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;QAChC,CAAC;mFAAC,CAAC;QAEH,MAAM,GAAG,GAAG,iBAAiB,CAAC,GAAG,EAAE;YAE/B,IAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,EAAE,QAAQ,IAAI,WAAW,EAC1E,CAAC;gBACG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;YAC9C,CAAC;YAED,GAAG,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,mGAAmG;IAEnG;;OAEG;IACI,KAAK;IAEZ,CAAC;IAED,2FAA2F;IAE3F;;;OAGG;IACO,KAAK,CAAC,KAAY;QAExB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAE,KAAK,CAAC,MAA2B,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IACpF,CAAC;8GAhGQ,gBAAgB,kBAuDL,mBAAmB;kGAvD9B,gBAAgB,wJC1C7B,0GAAkG,4CDqC1F,SAAS,mGACT,YAAY;;AA0BT;IADN,mBAAmB,EAAE;;iDACwC;2FAtBrD,gBAAgB;kBAf5B,SAAS;+BAEI,oBAAoB,QAG9B;wBACI,SAAS,EAAE,qCAAqC;qBACnD,WAED;wBACI,SAAS;wBACT,YAAY;qBACf,mBACgB,uBAAuB,CAAC,MAAM;;0BAyDlC,MAAM;2BAAC,mBAAmB;;0BAAG,QAAQ","sourcesContent":["import {afterRenderEffect, ChangeDetectionStrategy, Component, computed, ElementRef, Inject, inject, Optional, signal, Signal, WritableSignal} from '@angular/core';\r\nimport {debounce, form, FormField} from '@angular/forms/signals';\r\nimport {LocalizePipe} from '@anglr/common';\r\nimport {RecursivePartial} from '@jscrpt/common';\r\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\r\n\r\nimport {LiveSearch, LiveSearchCssClasses, FilterLiveSearchOptions} from '../../../interfaces';\r\nimport {SelectPluginInstances, SelectBus} from '../../../misc/classes';\r\nimport {CopyOptionsAsSignal} from '../../../decorators';\r\nimport {LIVE_SEARCH_OPTIONS} from '../../../misc/tokens';\r\n\r\nconst defaultOptions: FilterLiveSearchOptions<LiveSearchCssClasses> =\r\n{\r\n searchDebounceTimeout: 280,\r\n texts:\r\n {\r\n searchPlaceholder: 'filter options',\r\n },\r\n cssClasses:\r\n {\r\n componentElement: 'live-search-component',\r\n },\r\n};\r\n\r\n/**\r\n * Live search component used for filtering listed options\r\n */\r\n@Component(\r\n{\r\n selector: 'filter-live-search',\r\n templateUrl: 'filterLiveSearch.component.html',\r\n host:\r\n {\r\n '[class]': 'options.cssClasses.componentElement',\r\n },\r\n imports:\r\n [\r\n FormField,\r\n LocalizePipe,\r\n ],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class FilterLiveSearch<TValue = unknown, TPublicValue = TValue> implements LiveSearch<TValue, TPublicValue, FilterLiveSearchOptions<LiveSearchCssClasses>>\r\n{\r\n //######################### protected fields #########################\r\n\r\n /**\r\n * Indication whether input search value is empty\r\n */\r\n protected emptyInputSignal: WritableSignal<boolean> = signal(true);\r\n\r\n //######################### protected properties - template bindings #########################\r\n\r\n /**\r\n * Instance of form value\r\n */\r\n protected value;\r\n\r\n //######################### public properties - implementation of SelectPlugin #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n @CopyOptionsAsSignal()\r\n public options: FilterLiveSearchOptions<LiveSearchCssClasses>;\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\r\n\r\n //######################### public properties - implementation of LiveSearch #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public readonly search: Signal<string>;\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public get emptyInput(): Signal<boolean>\r\n {\r\n return this.emptyInputSignal.asReadonly();\r\n }\r\n\r\n //######################### constructor #########################\r\n constructor(@Inject(LIVE_SEARCH_OPTIONS) @Optional() options?: RecursivePartial<FilterLiveSearchOptions<LiveSearchCssClasses>>|null,)\r\n {\r\n this.options = deepCopyWithArrayOverride(defaultOptions as FilterLiveSearchOptions<LiveSearchCssClasses>,\r\n options);\r\n\r\n this.value = form(signal(''), path => debounce(path, this.options.searchDebounceTimeout));\r\n\r\n this.search = computed(() =>\r\n {\r\n return this.value().value();\r\n });\r\n\r\n const ref = afterRenderEffect(() =>\r\n {\r\n if(this.pluginElement.nativeElement.parentElement?.nodeName == 'NG-SELECT')\r\n {\r\n this.pluginElement.nativeElement.remove();\r\n }\r\n\r\n ref.destroy();\r\n });\r\n }\r\n\r\n //######################### public methods - implementation of LiveSearch #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public focus(): void\r\n {\r\n }\r\n\r\n //######################### protected methods - template bindings #########################\r\n\r\n /**\r\n * Handles input event on search input\r\n * @param event - Event that occured\r\n */\r\n protected input(event: Event): void\r\n {\r\n this.emptyInputSignal.set((event.target as HTMLInputElement).value.length == 0);\r\n }\r\n}\r\n","<input type=\"text\" [placeholder]=\"options.texts.searchPlaceholder | localize\" [formField]=\"value\">"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/liveSearch/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,uCAAuC,CAAC","sourcesContent":["export * from './editLiveSearch/editLiveSearch.component';\nexport * from './filterLiveSearch/filterLiveSearch.component';\nexport * from './noLiveSearch/noLiveSearch.component';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/liveSearch/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,uCAAuC,CAAC","sourcesContent":["export * from './editLiveSearch/editLiveSearch.component';\r\nexport * from './filterLiveSearch/filterLiveSearch.component';\r\nexport * from './noLiveSearch/noLiveSearch.component';\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noLiveSearch.component.js","sourceRoot":"","sources":["../../../../../src/plugins/liveSearch/noLiveSearch/noLiveSearch.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,uBAAuB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAU,MAAM,EAAC,MAAM,eAAe,CAAC;AAGrG,OAAO,EAAC,qBAAqB,EAAE,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;;AAExD;;GAEG;AAWH,MAAM,OAAO,YAAY;IAVzB;QAYI,wGAAwG;QAExG;;WAEG;QAEI,YAAO,GAAsB,EAAC,UAAU,EAAE,EAAC,gBAAgB,EAAE,uBAAuB,EAAC,EAAE,qBAAqB,EAAE,CAAC,EAAC,CAAC;QAExH;;WAEG;QACI,kBAAa,GAAgD,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAElG;;WAEG;QACI,kBAAa,GAA4B,MAAM,CAAC,UAAU,CAAC,CAAC;QAEnE;;WAEG;QACI,cAAS,GAAoC,MAAM,CAAC,SAAS,CAAC,CAAC;QAEtE,sGAAsG;QAEtG;;WAEG;QACa,WAAM,GAAmB,MAAM,CAAC,EAAE;mFAAC,CAAC;QAEpD;;WAEG;QACa,eAAU,GAAoB,MAAM,CAAC,IAAI;uFAAC,CAAC;KAU9D;IARG,mGAAmG;IAEnG;;OAEG;IACI,KAAK;IAEZ,CAAC;8GA5CQ,YAAY;kGAAZ,YAAY,oJAPX,EAAE;;AAeL;IADN,mBAAmB,EAAE;;6CACkG;2FAR/G,YAAY;kBAVxB,SAAS;mBACV;oBACI,QAAQ,EAAE,gBAAgB;oBAC1B,QAAQ,EAAE,EAAE;oBACZ,IAAI,EACJ;wBACI,SAAS,EAAE,qCAAqC;qBACnD;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAClD","sourcesContent":["import {ChangeDetectionStrategy, Component, ElementRef, inject, Signal, signal} from '@angular/core';\n\nimport {LiveSearch, LiveSearchOptions} from '../../../interfaces';\nimport {SelectPluginInstances, SelectBus} from '../../../misc/classes';\nimport {CopyOptionsAsSignal} from '../../../decorators';\n\n/**\n * Component used for no live search\n */\n@Component(\n{\n selector: 'no-live-search',\n template: '',\n host:\n {\n '[class]': 'options.cssClasses.componentElement',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NoLiveSearch<TValue = unknown, TPublicValue = TValue> implements LiveSearch<TValue, TPublicValue, LiveSearchOptions>\n{\n //######################### public properties - implementation of SelectPlugin #########################\n\n /**\n * @inheritdoc\n */\n @CopyOptionsAsSignal()\n public options: LiveSearchOptions = {cssClasses: {componentElement: 'live-search-component'}, searchDebounceTimeout: 0};\n\n /**\n * @inheritdoc\n */\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\n\n /**\n * @inheritdoc\n */\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\n\n /**\n * @inheritdoc\n */\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\n\n //######################### public properties - implementation of LiveSearch #########################\n\n /**\n * @inheritdoc\n */\n public readonly search: Signal<string> = signal('');\n\n /**\n * @inheritdoc\n */\n public readonly emptyInput: Signal<boolean> = signal(true);\n\n //######################### public methods - implementation of LiveSearch #########################\n\n /**\n * @inheritdoc\n */\n public focus(): void\n {\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"noLiveSearch.component.js","sourceRoot":"","sources":["../../../../../src/plugins/liveSearch/noLiveSearch/noLiveSearch.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,uBAAuB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAU,MAAM,EAAC,MAAM,eAAe,CAAC;AAGrG,OAAO,EAAC,qBAAqB,EAAE,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;;AAExD;;GAEG;AAWH,MAAM,OAAO,YAAY;IAVzB;QAYI,wGAAwG;QAExG;;WAEG;QAEI,YAAO,GAAsB,EAAC,UAAU,EAAE,EAAC,gBAAgB,EAAE,uBAAuB,EAAC,EAAE,qBAAqB,EAAE,CAAC,EAAC,CAAC;QAExH;;WAEG;QACI,kBAAa,GAAgD,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAElG;;WAEG;QACI,kBAAa,GAA4B,MAAM,CAAC,UAAU,CAAC,CAAC;QAEnE;;WAEG;QACI,cAAS,GAAoC,MAAM,CAAC,SAAS,CAAC,CAAC;QAEtE,sGAAsG;QAEtG;;WAEG;QACa,WAAM,GAAmB,MAAM,CAAC,EAAE;mFAAC,CAAC;QAEpD;;WAEG;QACa,eAAU,GAAoB,MAAM,CAAC,IAAI;uFAAC,CAAC;KAU9D;IARG,mGAAmG;IAEnG;;OAEG;IACI,KAAK;IAEZ,CAAC;8GA5CQ,YAAY;kGAAZ,YAAY,oJAPX,EAAE;;AAeL;IADN,mBAAmB,EAAE;;6CACkG;2FAR/G,YAAY;kBAVxB,SAAS;mBACV;oBACI,QAAQ,EAAE,gBAAgB;oBAC1B,QAAQ,EAAE,EAAE;oBACZ,IAAI,EACJ;wBACI,SAAS,EAAE,qCAAqC;qBACnD;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAClD","sourcesContent":["import {ChangeDetectionStrategy, Component, ElementRef, inject, Signal, signal} from '@angular/core';\r\n\r\nimport {LiveSearch, LiveSearchOptions} from '../../../interfaces';\r\nimport {SelectPluginInstances, SelectBus} from '../../../misc/classes';\r\nimport {CopyOptionsAsSignal} from '../../../decorators';\r\n\r\n/**\r\n * Component used for no live search\r\n */\r\n@Component(\r\n{\r\n selector: 'no-live-search',\r\n template: '',\r\n host:\r\n {\r\n '[class]': 'options.cssClasses.componentElement',\r\n },\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class NoLiveSearch<TValue = unknown, TPublicValue = TValue> implements LiveSearch<TValue, TPublicValue, LiveSearchOptions>\r\n{\r\n //######################### public properties - implementation of SelectPlugin #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n @CopyOptionsAsSignal()\r\n public options: LiveSearchOptions = {cssClasses: {componentElement: 'live-search-component'}, searchDebounceTimeout: 0};\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\r\n\r\n //######################### public properties - implementation of LiveSearch #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public readonly search: Signal<string> = signal('');\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public readonly emptyInput: Signal<boolean> = signal(true);\r\n\r\n //######################### public methods - implementation of LiveSearch #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public focus(): void\r\n {\r\n }\r\n}\r\n"]}
|
|
@@ -129,7 +129,7 @@ export class EditNormalState {
|
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: EditNormalState, deps: [{ token: NORMAL_STATE_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
132
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: EditNormalState, isStandalone: true, selector: "edit-normal-state", host: { properties: { "class": "options.cssClasses.componentElement", "class.disabled": "!!selectBus.selectOptions().readonly" } }, viewQueries: [{ propertyName: "liveSearchPlaceholder", first: true, predicate: ["liveSearchPlaceholder"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<ng-template #defaultSingleLook=\"normalStateTemplate\" normalStateTemplate>{{selectBus.selectedOptions() | displayValue: '' | localize}}</ng-template>\n<ng-template #defaultMultipleLook=\"normalStateTagTemplate\" normalStateTagTemplate let-option let-normalState=\"normalState\">\n <div [class]=\"options.cssClasses.tag\">\n <span>{{option | displayValue | localize}}</span>\n <button type=\"button\" (click)=\"optionClick(option)\" tabindex=\"-1\" aria-hidden=\"true\">\n <span>x</span>\n </button>\n </div>\n</ng-template>\n\n<div [class]=\"options.cssClasses.valueWrapper\">\n @if(showValue())\n {\n <div [class]=\"cssClasses()\">\n @if(!selectBus.selectOptions().multiple)\n {\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTemplate() || defaultSingleLook.template; context: {$implicit: $any(this)}\"/>\n }\n @else\n {\n @for(option of selectedOptionsMultiple(); track option)\n {\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTagTemplate() || defaultMultipleLook.template; context: {$implicit: option, normalState: this}\"/>\n }\n }\n </div>\n }\n\n <ng-container #liveSearchPlaceholder/>\n</div>\n\n@if(options.cancelValue && (selectBus.selectedOptions() | hasValue))\n{\n <button type=\"button\"\n [disabled]=\"!!selectBus.selectOptions().readonly\"\n [class]=\"options.cssClasses.cancel\" \n [tooltip]=\"options.texts.cancelTitle | localize\" \n [attr.aria-label]=\"options.texts.cancelTitle | localize\"\n (focus)=\"handleFocus()\" \n (blur)=\"blur()\" \n (click)=\"cancel()\">\n <span [class]=\"options.cssClasses.cancelIcon\"></span>\n </button>\n}\n\n@if(options.carret)\n{\n <button type=\"button\" [disabled]=\"!!selectBus.selectOptions().readonly\" (click)=\"click(); selectBus.setFocus()\" (focus)=\"handleFocus()\" (blur)=\"blur()\" tabindex=\"-1\" aria-hidden=\"true\">\n <span [class]=\"options.cssClasses.carret\"></span>\n </button>\n}", dependencies: [{ kind: "directive", type: TooltipDirective, selector: "[tooltip]", inputs: ["tooltip", "allowHtml", "template", "tooltipOptions", "tooltipVisible", "containerElement"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NormalStateTemplate, selector: "[normalStateTemplate]", exportAs: ["normalStateTemplate", ""] }, { kind: "directive", type: NormalStateTagTemplate, selector: "[normalStateTagTemplate]", exportAs: ["normalStateTagTemplate", ""] }, { kind: "pipe", type: HasValue, name: "hasValue" }, { kind: "pipe", type: DisplayValue, name: "displayValue" }, { kind: "pipe", type: LocalizePipe, name: "localize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
132
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: EditNormalState, isStandalone: true, selector: "edit-normal-state", host: { properties: { "class": "options.cssClasses.componentElement", "class.disabled": "!!selectBus.selectOptions().readonly" } }, viewQueries: [{ propertyName: "liveSearchPlaceholder", first: true, predicate: ["liveSearchPlaceholder"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<ng-template #defaultSingleLook=\"normalStateTemplate\" normalStateTemplate>{{selectBus.selectedOptions() | displayValue: '' | localize}}</ng-template>\r\n<ng-template #defaultMultipleLook=\"normalStateTagTemplate\" normalStateTagTemplate let-option let-normalState=\"normalState\">\r\n <div [class]=\"options.cssClasses.tag\">\r\n <span>{{option | displayValue | localize}}</span>\r\n <button type=\"button\" (click)=\"optionClick(option)\" tabindex=\"-1\" aria-hidden=\"true\">\r\n <span>x</span>\r\n </button>\r\n </div>\r\n</ng-template>\r\n\r\n<div [class]=\"options.cssClasses.valueWrapper\">\r\n @if(showValue())\r\n {\r\n <div [class]=\"cssClasses()\">\r\n @if(!selectBus.selectOptions().multiple)\r\n {\r\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTemplate() || defaultSingleLook.template; context: {$implicit: $any(this)}\"/>\r\n }\r\n @else\r\n {\r\n @for(option of selectedOptionsMultiple(); track option)\r\n {\r\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTagTemplate() || defaultMultipleLook.template; context: {$implicit: option, normalState: this}\"/>\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n <ng-container #liveSearchPlaceholder/>\r\n</div>\r\n\r\n@if(options.cancelValue && (selectBus.selectedOptions() | hasValue))\r\n{\r\n <button type=\"button\"\r\n [disabled]=\"!!selectBus.selectOptions().readonly\"\r\n [class]=\"options.cssClasses.cancel\" \r\n [tooltip]=\"options.texts.cancelTitle | localize\" \r\n [attr.aria-label]=\"options.texts.cancelTitle | localize\"\r\n (focus)=\"handleFocus()\" \r\n (blur)=\"blur()\" \r\n (click)=\"cancel()\">\r\n <span [class]=\"options.cssClasses.cancelIcon\"></span>\r\n </button>\r\n}\r\n\r\n@if(options.carret)\r\n{\r\n <button type=\"button\" [disabled]=\"!!selectBus.selectOptions().readonly\" (click)=\"click(); selectBus.setFocus()\" (focus)=\"handleFocus()\" (blur)=\"blur()\" tabindex=\"-1\" aria-hidden=\"true\">\r\n <span [class]=\"options.cssClasses.carret\"></span>\r\n </button>\r\n}", dependencies: [{ kind: "directive", type: TooltipDirective, selector: "[tooltip]", inputs: ["tooltip", "allowHtml", "template", "tooltipOptions", "tooltipVisible", "containerElement"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NormalStateTemplate, selector: "[normalStateTemplate]", exportAs: ["normalStateTemplate", ""] }, { kind: "directive", type: NormalStateTagTemplate, selector: "[normalStateTagTemplate]", exportAs: ["normalStateTagTemplate", ""] }, { kind: "pipe", type: HasValue, name: "hasValue" }, { kind: "pipe", type: DisplayValue, name: "displayValue" }, { kind: "pipe", type: LocalizePipe, name: "localize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
133
133
|
}
|
|
134
134
|
__decorate([
|
|
135
135
|
CopyOptionsAsSignal(),
|
|
@@ -148,7 +148,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
148
148
|
NgTemplateOutlet,
|
|
149
149
|
NormalStateTemplate,
|
|
150
150
|
NormalStateTagTemplate,
|
|
151
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #defaultSingleLook=\"normalStateTemplate\" normalStateTemplate>{{selectBus.selectedOptions() | displayValue: '' | localize}}</ng-template>\n<ng-template #defaultMultipleLook=\"normalStateTagTemplate\" normalStateTagTemplate let-option let-normalState=\"normalState\">\n <div [class]=\"options.cssClasses.tag\">\n <span>{{option | displayValue | localize}}</span>\n <button type=\"button\" (click)=\"optionClick(option)\" tabindex=\"-1\" aria-hidden=\"true\">\n <span>x</span>\n </button>\n </div>\n</ng-template>\n\n<div [class]=\"options.cssClasses.valueWrapper\">\n @if(showValue())\n {\n <div [class]=\"cssClasses()\">\n @if(!selectBus.selectOptions().multiple)\n {\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTemplate() || defaultSingleLook.template; context: {$implicit: $any(this)}\"/>\n }\n @else\n {\n @for(option of selectedOptionsMultiple(); track option)\n {\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTagTemplate() || defaultMultipleLook.template; context: {$implicit: option, normalState: this}\"/>\n }\n }\n </div>\n }\n\n <ng-container #liveSearchPlaceholder/>\n</div>\n\n@if(options.cancelValue && (selectBus.selectedOptions() | hasValue))\n{\n <button type=\"button\"\n [disabled]=\"!!selectBus.selectOptions().readonly\"\n [class]=\"options.cssClasses.cancel\" \n [tooltip]=\"options.texts.cancelTitle | localize\" \n [attr.aria-label]=\"options.texts.cancelTitle | localize\"\n (focus)=\"handleFocus()\" \n (blur)=\"blur()\" \n (click)=\"cancel()\">\n <span [class]=\"options.cssClasses.cancelIcon\"></span>\n </button>\n}\n\n@if(options.carret)\n{\n <button type=\"button\" [disabled]=\"!!selectBus.selectOptions().readonly\" (click)=\"click(); selectBus.setFocus()\" (focus)=\"handleFocus()\" (blur)=\"blur()\" tabindex=\"-1\" aria-hidden=\"true\">\n <span [class]=\"options.cssClasses.carret\"></span>\n </button>\n}" }]
|
|
151
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #defaultSingleLook=\"normalStateTemplate\" normalStateTemplate>{{selectBus.selectedOptions() | displayValue: '' | localize}}</ng-template>\r\n<ng-template #defaultMultipleLook=\"normalStateTagTemplate\" normalStateTagTemplate let-option let-normalState=\"normalState\">\r\n <div [class]=\"options.cssClasses.tag\">\r\n <span>{{option | displayValue | localize}}</span>\r\n <button type=\"button\" (click)=\"optionClick(option)\" tabindex=\"-1\" aria-hidden=\"true\">\r\n <span>x</span>\r\n </button>\r\n </div>\r\n</ng-template>\r\n\r\n<div [class]=\"options.cssClasses.valueWrapper\">\r\n @if(showValue())\r\n {\r\n <div [class]=\"cssClasses()\">\r\n @if(!selectBus.selectOptions().multiple)\r\n {\r\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTemplate() || defaultSingleLook.template; context: {$implicit: $any(this)}\"/>\r\n }\r\n @else\r\n {\r\n @for(option of selectedOptionsMultiple(); track option)\r\n {\r\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTagTemplate() || defaultMultipleLook.template; context: {$implicit: option, normalState: this}\"/>\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n <ng-container #liveSearchPlaceholder/>\r\n</div>\r\n\r\n@if(options.cancelValue && (selectBus.selectedOptions() | hasValue))\r\n{\r\n <button type=\"button\"\r\n [disabled]=\"!!selectBus.selectOptions().readonly\"\r\n [class]=\"options.cssClasses.cancel\" \r\n [tooltip]=\"options.texts.cancelTitle | localize\" \r\n [attr.aria-label]=\"options.texts.cancelTitle | localize\"\r\n (focus)=\"handleFocus()\" \r\n (blur)=\"blur()\" \r\n (click)=\"cancel()\">\r\n <span [class]=\"options.cssClasses.cancelIcon\"></span>\r\n </button>\r\n}\r\n\r\n@if(options.carret)\r\n{\r\n <button type=\"button\" [disabled]=\"!!selectBus.selectOptions().readonly\" (click)=\"click(); selectBus.setFocus()\" (focus)=\"handleFocus()\" (blur)=\"blur()\" tabindex=\"-1\" aria-hidden=\"true\">\r\n <span [class]=\"options.cssClasses.carret\"></span>\r\n </button>\r\n}" }]
|
|
152
152
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
153
153
|
type: Inject,
|
|
154
154
|
args: [NORMAL_STATE_OPTIONS]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editNormalState.component.js","sourceRoot":"","sources":["../../../../../src/plugins/normalState/editNormalState/editNormalState.component.ts","../../../../../src/plugins/normalState/editNormalState/editNormalState.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAU,SAAS,EAAC,MAAM,eAAe,CAAC;AAC5I,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAC,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAC,qBAAqB,EAAE,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,M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,kBAkDJ,oBAAoB;kGAlD/B,eAAe,4TA+C8F,UAAU,6CC7GpI,ktEAkDC,4CDKO,gBAAgB,4JAChB,gBAAgB,oJAChB,mBAAmB,yGACnB,sBAAsB,0GANtB,QAAQ,4CACR,YAAY,gDACZ,YAAY;;AAgBT;IADN,mBAAmB,EAAE;;gDAC4C;2FARzD,eAAe;kBArB3B,SAAS;+BAEI,mBAAmB,QAG7B;wBACI,SAAS,EAAE,qCAAqC;wBAChD,kBAAkB,EAAE,sCAAsC;qBAC7D,WAED;wBACI,QAAQ;wBACR,YAAY;wBACZ,YAAY;wBACZ,gBAAgB;wBAChB,gBAAgB;wBAChB,mBAAmB;wBACnB,sBAAsB;qBACzB,mBACgB,uBAAuB,CAAC,MAAM;;0BAoDlC,MAAM;2BAAC,oBAAoB;;0BAAG,QAAQ;2GAHmC,uBAAuB,OAAE,EAAC,IAAI,EAAE,UAAU,EAAC","sourcesContent":["import {ChangeDetectionStrategy, Component, computed, effect, ElementRef, Inject, inject, Optional, Signal, viewChild} from '@angular/core';\nimport {NgTemplateOutlet} from '@angular/common';\nimport {LocalizePipe, TooltipDirective} from '@anglr/common';\nimport {RecursivePartial} from '@jscrpt/common';\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\n\nimport {NormalState, EditNormalStateOptions, SelectPlugin, EditNormalStateCssClasses, SelectOptionState} from '../../../interfaces';\nimport {SelectPluginInstances, SelectBus} from '../../../misc/classes';\nimport {CopyOptionsAsSignal} from '../../../decorators';\nimport {NORMAL_STATE_OPTIONS} from '../../../misc/tokens';\nimport {DisplayValue, HasValue} from '../../../pipes';\nimport {NormalStateTagTemplate, NormalStateTemplate} from '../../../directives';\nimport {hasValue} from '../../../misc/utils';\n\n//TODO: improvement, carret direction\n\nconst defaultOptions: EditNormalStateOptions<EditNormalStateCssClasses> =\n{\n cancelValue: true,\n carret: true,\n texts:\n {\n cancelTitle: 'cancel selected values',\n },\n cssClasses:\n {\n componentElement: 'normal-state-component',\n value: 'normal-state-value',\n tag: 'select-tag',\n carret: 'fas fa-caret-down select-align-self-center',\n cancel: 'normal-state-cancel',\n cancelIcon: 'fas fa-times select-align-self-center',\n valueWrapper: 'select-relative select-flex-1 select-flex-row select-normal-state-gap',\n valueMultiple: 'select-normal-state-gap select-flex-row',\n valueSingle: 'select-flex-1',\n },\n};\n\n/**\n * Simple normal state displaying value as 'button' that opens popup with options when clicked.\n */\n@Component(\n{\n selector: 'edit-normal-state',\n templateUrl: 'editNormalState.component.html',\n host:\n {\n '[class]': 'options.cssClasses.componentElement',\n '[class.disabled]': '!!selectBus.selectOptions().readonly',\n },\n imports:\n [\n HasValue,\n DisplayValue,\n LocalizePipe,\n TooltipDirective,\n NgTemplateOutlet,\n NormalStateTemplate,\n NormalStateTagTemplate,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class EditNormalState<TValue = unknown, TPublicValue = TValue> implements NormalState<TValue, TPublicValue, EditNormalStateOptions<EditNormalStateCssClasses>>\n{\n //######################### public properties - implementation of SelectPlugin #########################\n\n /**\n * @inheritdoc\n */\n @CopyOptionsAsSignal()\n public options: EditNormalStateOptions<EditNormalStateCssClasses>;\n\n /**\n * @inheritdoc\n */\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\n\n /**\n * @inheritdoc\n */\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\n\n /**\n * @inheritdoc\n */\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\n\n //######################### protected properties - template bindings #########################\n\n /**\n * Instance of selected options for multiple select\n */\n protected selectedOptionsMultiple: Signal<SelectOptionState<TValue>[]>;\n\n /**\n * Indication whether show value\n */\n protected showValue: Signal<boolean>;\n\n /**\n * Css classes applied to value element\n */\n protected cssClasses: Signal<string[]>;\n\n //######################### protected properties - children #########################\n\n /**\n * Instance of element that is used as placeholder for live search\n */\n protected liveSearchPlaceholder: Signal<ElementRef<HTMLElement>> = viewChild.required('liveSearchPlaceholder', {read: ElementRef});\n\n //######################### constructor #########################\n constructor(@Inject(NORMAL_STATE_OPTIONS) @Optional() options?: RecursivePartial<EditNormalStateOptions<EditNormalStateCssClasses>>|null,)\n {\n this.options = deepCopyWithArrayOverride(defaultOptions as EditNormalStateOptions<EditNormalStateCssClasses>,\n options);\n\n effect(() => this.liveSearchPlaceholder().nativeElement.after(this.selectPlugins.LiveSearch.pluginElement.nativeElement));\n\n this.selectedOptionsMultiple = computed(() =>\n {\n const selectedOptions = this.selectBus.selectedOptions();\n\n if(!this.selectBus.selectOptions().multiple || !Array.isArray(selectedOptions))\n {\n return [];\n }\n\n return selectedOptions;\n });\n\n this.showValue = computed(() => ((hasValue(this.selectBus.selectedOptions()) || !this.selectBus.selectOptions().multiple) &&\n (this.selectPlugins.liveSearch()?.emptyInput() || this.selectBus.selectOptions().multiple)) ||\n (!this.selectBus.selectOptions().multiple && !hasValue(this.selectBus.selectedOptions()) && !this.selectPlugins.liveSearch()?.emptyInput()));\n\n this.cssClasses = computed(() => [this.options.cssClasses.value,\n ...(this.selectBus.selectOptions().multiple ? [...this.options.cssClasses.valueMultiple.split(' ')] : [...this.options.cssClasses.valueSingle.split(' ')])]);\n }\n\n //######################### public methods - implementation of LiveSearch #########################\n\n /**\n * @inheritdoc\n */\n public focus(): void\n {\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Handles click event\n */\n protected click(): void\n {\n this.selectBus.click.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles focus event\n */\n protected handleFocus(): void\n {\n this.selectBus.internalsFocus.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles blur event\n */\n protected blur(): void\n {\n this.selectBus.internalsBlur.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles cancel value\n */\n protected cancel(): void\n {\n this.selectBus.optionActivate.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles option click\n * @param option - Option that was clicked\n */\n protected optionClick(option: SelectOptionState<TValue>): void\n {\n this.selectBus.optionActivate.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: option,\n });\n }\n}\n","<ng-template #defaultSingleLook=\"normalStateTemplate\" normalStateTemplate>{{selectBus.selectedOptions() | displayValue: '' | localize}}</ng-template>\n<ng-template #defaultMultipleLook=\"normalStateTagTemplate\" normalStateTagTemplate let-option let-normalState=\"normalState\">\n <div [class]=\"options.cssClasses.tag\">\n <span>{{option | displayValue | localize}}</span>\n <button type=\"button\" (click)=\"optionClick(option)\" tabindex=\"-1\" aria-hidden=\"true\">\n <span>x</span>\n </button>\n </div>\n</ng-template>\n\n<div [class]=\"options.cssClasses.valueWrapper\">\n @if(showValue())\n {\n <div [class]=\"cssClasses()\">\n @if(!selectBus.selectOptions().multiple)\n {\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTemplate() || defaultSingleLook.template; context: {$implicit: $any(this)}\"/>\n }\n @else\n {\n @for(option of selectedOptionsMultiple(); track option)\n {\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTagTemplate() || defaultMultipleLook.template; context: {$implicit: option, normalState: this}\"/>\n }\n }\n </div>\n }\n\n <ng-container #liveSearchPlaceholder/>\n</div>\n\n@if(options.cancelValue && (selectBus.selectedOptions() | hasValue))\n{\n <button type=\"button\"\n [disabled]=\"!!selectBus.selectOptions().readonly\"\n [class]=\"options.cssClasses.cancel\" \n [tooltip]=\"options.texts.cancelTitle | localize\" \n [attr.aria-label]=\"options.texts.cancelTitle | localize\"\n (focus)=\"handleFocus()\" \n (blur)=\"blur()\" \n (click)=\"cancel()\">\n <span [class]=\"options.cssClasses.cancelIcon\"></span>\n </button>\n}\n\n@if(options.carret)\n{\n <button type=\"button\" [disabled]=\"!!selectBus.selectOptions().readonly\" (click)=\"click(); selectBus.setFocus()\" (focus)=\"handleFocus()\" (blur)=\"blur()\" tabindex=\"-1\" aria-hidden=\"true\">\n <span [class]=\"options.cssClasses.carret\"></span>\n </button>\n}"]}
|
|
1
|
+
{"version":3,"file":"editNormalState.component.js","sourceRoot":"","sources":["../../../../../src/plugins/normalState/editNormalState/editNormalState.component.ts","../../../../../src/plugins/normalState/editNormalState/editNormalState.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAU,SAAS,EAAC,MAAM,eAAe,CAAC;AAC5I,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAC,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAC,qBAAqB,EAAE,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;;AAE7C,qCAAqC;AAErC,MAAM,cAAc,GACpB;IACI,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,IAAI;IACZ,KAAK,EACL;QACI,WAAW,EAAE,wBAAwB;KACxC;IACD,UAAU,EACV;QACI,gBAAgB,EAAE,wBAAwB;QAC1C,KAAK,EAAE,oBAAoB;QAC3B,GAAG,EAAE,YAAY;QACjB,MAAM,EAAE,4CAA4C;Q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;;0BAoDlC,MAAM;2BAAC,oBAAoB;;0BAAG,QAAQ;2GAHmC,uBAAuB,OAAE,EAAC,IAAI,EAAE,UAAU,EAAC","sourcesContent":["import {ChangeDetectionStrategy, Component, computed, effect, ElementRef, Inject, inject, Optional, Signal, viewChild} from '@angular/core';\r\nimport {NgTemplateOutlet} from '@angular/common';\r\nimport {LocalizePipe, TooltipDirective} from '@anglr/common';\r\nimport {RecursivePartial} from '@jscrpt/common';\r\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\r\n\r\nimport {NormalState, EditNormalStateOptions, SelectPlugin, EditNormalStateCssClasses, SelectOptionState} from '../../../interfaces';\r\nimport {SelectPluginInstances, SelectBus} from '../../../misc/classes';\r\nimport {CopyOptionsAsSignal} from '../../../decorators';\r\nimport {NORMAL_STATE_OPTIONS} from '../../../misc/tokens';\r\nimport {DisplayValue, HasValue} from '../../../pipes';\r\nimport {NormalStateTagTemplate, NormalStateTemplate} from '../../../directives';\r\nimport {hasValue} from '../../../misc/utils';\r\n\r\n//TODO: improvement, carret direction\r\n\r\nconst defaultOptions: EditNormalStateOptions<EditNormalStateCssClasses> =\r\n{\r\n cancelValue: true,\r\n carret: true,\r\n texts:\r\n {\r\n cancelTitle: 'cancel selected values',\r\n },\r\n cssClasses:\r\n {\r\n componentElement: 'normal-state-component',\r\n value: 'normal-state-value',\r\n tag: 'select-tag',\r\n carret: 'fas fa-caret-down select-align-self-center',\r\n cancel: 'normal-state-cancel',\r\n cancelIcon: 'fas fa-times select-align-self-center',\r\n valueWrapper: 'select-relative select-flex-1 select-flex-row select-normal-state-gap',\r\n valueMultiple: 'select-normal-state-gap select-flex-row',\r\n valueSingle: 'select-flex-1',\r\n },\r\n};\r\n\r\n/**\r\n * Simple normal state displaying value as 'button' that opens popup with options when clicked.\r\n */\r\n@Component(\r\n{\r\n selector: 'edit-normal-state',\r\n templateUrl: 'editNormalState.component.html',\r\n host:\r\n {\r\n '[class]': 'options.cssClasses.componentElement',\r\n '[class.disabled]': '!!selectBus.selectOptions().readonly',\r\n },\r\n imports:\r\n [\r\n HasValue,\r\n DisplayValue,\r\n LocalizePipe,\r\n TooltipDirective,\r\n NgTemplateOutlet,\r\n NormalStateTemplate,\r\n NormalStateTagTemplate,\r\n ],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class EditNormalState<TValue = unknown, TPublicValue = TValue> implements NormalState<TValue, TPublicValue, EditNormalStateOptions<EditNormalStateCssClasses>>\r\n{\r\n //######################### public properties - implementation of SelectPlugin #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n @CopyOptionsAsSignal()\r\n public options: EditNormalStateOptions<EditNormalStateCssClasses>;\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\r\n\r\n //######################### protected properties - template bindings #########################\r\n\r\n /**\r\n * Instance of selected options for multiple select\r\n */\r\n protected selectedOptionsMultiple: Signal<SelectOptionState<TValue>[]>;\r\n\r\n /**\r\n * Indication whether show value\r\n */\r\n protected showValue: Signal<boolean>;\r\n\r\n /**\r\n * Css classes applied to value element\r\n */\r\n protected cssClasses: Signal<string[]>;\r\n\r\n //######################### protected properties - children #########################\r\n\r\n /**\r\n * Instance of element that is used as placeholder for live search\r\n */\r\n protected liveSearchPlaceholder: Signal<ElementRef<HTMLElement>> = viewChild.required('liveSearchPlaceholder', {read: ElementRef});\r\n\r\n //######################### constructor #########################\r\n constructor(@Inject(NORMAL_STATE_OPTIONS) @Optional() options?: RecursivePartial<EditNormalStateOptions<EditNormalStateCssClasses>>|null,)\r\n {\r\n this.options = deepCopyWithArrayOverride(defaultOptions as EditNormalStateOptions<EditNormalStateCssClasses>,\r\n options);\r\n\r\n effect(() => this.liveSearchPlaceholder().nativeElement.after(this.selectPlugins.LiveSearch.pluginElement.nativeElement));\r\n\r\n this.selectedOptionsMultiple = computed(() =>\r\n {\r\n const selectedOptions = this.selectBus.selectedOptions();\r\n\r\n if(!this.selectBus.selectOptions().multiple || !Array.isArray(selectedOptions))\r\n {\r\n return [];\r\n }\r\n\r\n return selectedOptions;\r\n });\r\n\r\n this.showValue = computed(() => ((hasValue(this.selectBus.selectedOptions()) || !this.selectBus.selectOptions().multiple) &&\r\n (this.selectPlugins.liveSearch()?.emptyInput() || this.selectBus.selectOptions().multiple)) ||\r\n (!this.selectBus.selectOptions().multiple && !hasValue(this.selectBus.selectedOptions()) && !this.selectPlugins.liveSearch()?.emptyInput()));\r\n\r\n this.cssClasses = computed(() => [this.options.cssClasses.value,\r\n ...(this.selectBus.selectOptions().multiple ? [...this.options.cssClasses.valueMultiple.split(' ')] : [...this.options.cssClasses.valueSingle.split(' ')])]);\r\n }\r\n\r\n //######################### public methods - implementation of LiveSearch #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public focus(): void\r\n {\r\n }\r\n\r\n //######################### protected methods - template bindings #########################\r\n\r\n /**\r\n * Handles click event\r\n */\r\n protected click(): void\r\n {\r\n this.selectBus.click.next(\r\n {\r\n source: this as SelectPlugin,\r\n sourceElement: this.pluginElement.nativeElement,\r\n data: null,\r\n });\r\n }\r\n\r\n /**\r\n * Handles focus event\r\n */\r\n protected handleFocus(): void\r\n {\r\n this.selectBus.internalsFocus.next(\r\n {\r\n source: this as SelectPlugin,\r\n sourceElement: this.pluginElement.nativeElement,\r\n data: null,\r\n });\r\n }\r\n\r\n /**\r\n * Handles blur event\r\n */\r\n protected blur(): void\r\n {\r\n this.selectBus.internalsBlur.next(\r\n {\r\n source: this as SelectPlugin,\r\n sourceElement: this.pluginElement.nativeElement,\r\n data: null,\r\n });\r\n }\r\n\r\n /**\r\n * Handles cancel value\r\n */\r\n protected cancel(): void\r\n {\r\n this.selectBus.optionActivate.next(\r\n {\r\n source: this as SelectPlugin,\r\n sourceElement: this.pluginElement.nativeElement,\r\n data: null,\r\n });\r\n }\r\n\r\n /**\r\n * Handles option click\r\n * @param option - Option that was clicked\r\n */\r\n protected optionClick(option: SelectOptionState<TValue>): void\r\n {\r\n this.selectBus.optionActivate.next(\r\n {\r\n source: this as SelectPlugin,\r\n sourceElement: this.pluginElement.nativeElement,\r\n data: option,\r\n });\r\n }\r\n}\r\n","<ng-template #defaultSingleLook=\"normalStateTemplate\" normalStateTemplate>{{selectBus.selectedOptions() | displayValue: '' | localize}}</ng-template>\r\n<ng-template #defaultMultipleLook=\"normalStateTagTemplate\" normalStateTagTemplate let-option let-normalState=\"normalState\">\r\n <div [class]=\"options.cssClasses.tag\">\r\n <span>{{option | displayValue | localize}}</span>\r\n <button type=\"button\" (click)=\"optionClick(option)\" tabindex=\"-1\" aria-hidden=\"true\">\r\n <span>x</span>\r\n </button>\r\n </div>\r\n</ng-template>\r\n\r\n<div [class]=\"options.cssClasses.valueWrapper\">\r\n @if(showValue())\r\n {\r\n <div [class]=\"cssClasses()\">\r\n @if(!selectBus.selectOptions().multiple)\r\n {\r\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTemplate() || defaultSingleLook.template; context: {$implicit: $any(this)}\"/>\r\n }\r\n @else\r\n {\r\n @for(option of selectedOptionsMultiple(); track option)\r\n {\r\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTagTemplate() || defaultMultipleLook.template; context: {$implicit: option, normalState: this}\"/>\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n <ng-container #liveSearchPlaceholder/>\r\n</div>\r\n\r\n@if(options.cancelValue && (selectBus.selectedOptions() | hasValue))\r\n{\r\n <button type=\"button\"\r\n [disabled]=\"!!selectBus.selectOptions().readonly\"\r\n [class]=\"options.cssClasses.cancel\" \r\n [tooltip]=\"options.texts.cancelTitle | localize\" \r\n [attr.aria-label]=\"options.texts.cancelTitle | localize\"\r\n (focus)=\"handleFocus()\" \r\n (blur)=\"blur()\" \r\n (click)=\"cancel()\">\r\n <span [class]=\"options.cssClasses.cancelIcon\"></span>\r\n </button>\r\n}\r\n\r\n@if(options.carret)\r\n{\r\n <button type=\"button\" [disabled]=\"!!selectBus.selectOptions().readonly\" (click)=\"click(); selectBus.setFocus()\" (focus)=\"handleFocus()\" (blur)=\"blur()\" tabindex=\"-1\" aria-hidden=\"true\">\r\n <span [class]=\"options.cssClasses.carret\"></span>\r\n </button>\r\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/normalState/index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iDAAiD,CAAC","sourcesContent":["export * from './editNormalState/editNormalState.component';\nexport * from './simpleNormalState/simpleNormalState.component';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/normalState/index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iDAAiD,CAAC","sourcesContent":["export * from './editNormalState/editNormalState.component';\r\nexport * from './simpleNormalState/simpleNormalState.component';\r\n"]}
|
|
@@ -16,10 +16,9 @@ const defaultOptions = {
|
|
|
16
16
|
},
|
|
17
17
|
cssClasses: {
|
|
18
18
|
componentElement: 'normal-state-component',
|
|
19
|
-
|
|
20
|
-
value: 'select-align-self-center',
|
|
21
|
-
|
|
22
|
-
carretIcon: 'fas fa-caret-down select-align-self-center',
|
|
19
|
+
interactiveElement: 'normal-state-interactive-element',
|
|
20
|
+
value: 'normal-state-value select-align-self-center',
|
|
21
|
+
carretIcon: 'normal-state-carret fas fa-caret-down select-align-self-center',
|
|
23
22
|
cancel: 'normal-state-cancel',
|
|
24
23
|
cancelIcon: 'fas fa-times select-align-self-center',
|
|
25
24
|
},
|
|
@@ -100,7 +99,7 @@ export class SimpleNormalState {
|
|
|
100
99
|
});
|
|
101
100
|
}
|
|
102
101
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SimpleNormalState, deps: [{ token: NORMAL_STATE_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
103
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: SimpleNormalState, isStandalone: true, selector: "simple-normal-state", host: { properties: { "class": "options.cssClasses.componentElement", "class.disabled": "!!selectBus.selectOptions().readonly" } }, viewQueries: [{ propertyName: "htmlButton", first: true, predicate: ["htmlButton"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<ng-template #defaultLook>{{selectBus.selectedOptions() | displayValue | localize}}</ng-template>\n\n<button #htmlButton\n type=\"button\"\n role=\"combobox\"\n [class]=\"options.cssClasses.
|
|
102
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: SimpleNormalState, isStandalone: true, selector: "simple-normal-state", host: { properties: { "class": "options.cssClasses.componentElement", "class.disabled": "!!selectBus.selectOptions().readonly" } }, viewQueries: [{ propertyName: "htmlButton", first: true, predicate: ["htmlButton"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<ng-template #defaultLook>{{selectBus.selectedOptions() | displayValue | localize}}</ng-template>\r\n\r\n<button #htmlButton\r\n type=\"button\"\r\n role=\"combobox\"\r\n [class]=\"options.cssClasses.interactiveElement\"\r\n [disabled]=\"!!selectBus.selectOptions().readonly\"\r\n [attr.aria-expanded]=\"selectBus.popupVisible()\"\r\n [attr.aria-controls]=\"selectBus.popupVisible() ? selectBus.id : null\"\r\n [attr.aria-activedescendant]=\"selectBus.popupVisible() ? activeDescendant() : null\"\r\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [tooltip]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n (click)=\"click()\"\r\n (blur)=\"blur()\"\r\n (focus)=\"handleFocus()\">\r\n</button>\r\n\r\n<span [class]=\"options.cssClasses.value\" aria-hidden=\"true\" role=\"presentation\">\r\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTemplate() || defaultLook; context: {$implicit: this}\"/>\r\n</span>\r\n\r\n@if(options.cancelValue && (selectBus.selectedOptions() | hasValue))\r\n{\r\n <button type=\"button\" \r\n [disabled]=\"!!selectBus.selectOptions().readonly\"\r\n [class]=\"options.cssClasses.cancel\" \r\n [tooltip]=\"options.texts.cancelTitle | localize\" \r\n [attr.aria-label]=\"options.texts.cancelTitle | localize\"\r\n (click)=\"cancel()\" \r\n (blur)=\"blur()\" \r\n (focus)=\"handleFocus()\">\r\n <span [class]=\"options.cssClasses.cancelIcon\"></span>\r\n </button>\r\n}\r\n\r\n<span aria-hidden=\"true\" role=\"presentation\" [class]=\"options.cssClasses.carretIcon\"></span>", dependencies: [{ kind: "directive", type: TooltipDirective, selector: "[tooltip]", inputs: ["tooltip", "allowHtml", "template", "tooltipOptions", "tooltipVisible", "containerElement"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: HasValue, name: "hasValue" }, { kind: "pipe", type: DisplayValue, name: "displayValue" }, { kind: "pipe", type: LocalizePipe, name: "localize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
104
103
|
}
|
|
105
104
|
__decorate([
|
|
106
105
|
CopyOptionsAsSignal(),
|
|
@@ -117,7 +116,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
117
116
|
LocalizePipe,
|
|
118
117
|
TooltipDirective,
|
|
119
118
|
NgTemplateOutlet,
|
|
120
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #defaultLook>{{selectBus.selectedOptions() | displayValue | localize}}</ng-template>\n\n<button #htmlButton\n type=\"button\"\n role=\"combobox\"\n [class]=\"options.cssClasses.
|
|
119
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #defaultLook>{{selectBus.selectedOptions() | displayValue | localize}}</ng-template>\r\n\r\n<button #htmlButton\r\n type=\"button\"\r\n role=\"combobox\"\r\n [class]=\"options.cssClasses.interactiveElement\"\r\n [disabled]=\"!!selectBus.selectOptions().readonly\"\r\n [attr.aria-expanded]=\"selectBus.popupVisible()\"\r\n [attr.aria-controls]=\"selectBus.popupVisible() ? selectBus.id : null\"\r\n [attr.aria-activedescendant]=\"selectBus.popupVisible() ? activeDescendant() : null\"\r\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [tooltip]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n (click)=\"click()\"\r\n (blur)=\"blur()\"\r\n (focus)=\"handleFocus()\">\r\n</button>\r\n\r\n<span [class]=\"options.cssClasses.value\" aria-hidden=\"true\" role=\"presentation\">\r\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTemplate() || defaultLook; context: {$implicit: this}\"/>\r\n</span>\r\n\r\n@if(options.cancelValue && (selectBus.selectedOptions() | hasValue))\r\n{\r\n <button type=\"button\" \r\n [disabled]=\"!!selectBus.selectOptions().readonly\"\r\n [class]=\"options.cssClasses.cancel\" \r\n [tooltip]=\"options.texts.cancelTitle | localize\" \r\n [attr.aria-label]=\"options.texts.cancelTitle | localize\"\r\n (click)=\"cancel()\" \r\n (blur)=\"blur()\" \r\n (focus)=\"handleFocus()\">\r\n <span [class]=\"options.cssClasses.cancelIcon\"></span>\r\n </button>\r\n}\r\n\r\n<span aria-hidden=\"true\" role=\"presentation\" [class]=\"options.cssClasses.carretIcon\"></span>" }]
|
|
121
120
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
122
121
|
type: Inject,
|
|
123
122
|
args: [NORMAL_STATE_OPTIONS]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleNormalState.component.js","sourceRoot":"","sources":["../../../../../src/plugins/normalState/simpleNormalState/simpleNormalState.component.ts","../../../../../src/plugins/normalState/simpleNormalState/simpleNormalState.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAU,SAAS,EAAC,MAAM,eAAe,CAAC;AACpI,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAC,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAC,qBAAqB,EAAE,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;;AAEtD,qCAAqC;AAErC,MAAM,cAAc,GACpB;IACI,WAAW,EAAE,KAAK;IAClB,KAAK,EACL;QACI,WAAW,EAAE,wBAAwB;KACxC;IACD,UAAU,EACV;QACI,gBAAgB,EAAE,wBAAwB;QAC1C,OAAO,EAAE,sBAAsB;QAC/B,KAAK,EAAE,0BAA0B;QACjC,MAAM,EAAE,qBAAqB;QAC7B,UAAU,EAAE,4CAA4C;QACxD,MAAM,EAAE,qBAAqB;QAC7B,UAAU,EAAE,uCAAuC;KACtD;CACJ,CAAC;AAEF;;GAEG;AAoBH,MAAM,OAAO,iBAAiB;IAuC1B,iEAAiE;IACjE,YAAsD,OAAgF;QA9BtI;;WAEG;QACI,kBAAa,GAAgD,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAElG;;WAEG;QACI,kBAAa,GAA4B,MAAM,CAAC,UAAU,CAAC,CAAC;QAEnE;;W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I,EAAE,IAAI;SACb,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACO,MAAM;QAEZ,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAClC;YACI,MAAM,EAAE,IAAoB;YAC5B,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa;YAC/C,IAAI,EAAE,IAAI;SACb,CAAC,CAAC;IACP,CAAC;8GA9GQ,iBAAiB,kBAwCN,oBAAoB;kGAxC/B,iBAAiB,wSAqC4E,UAAU,6CC5FpH,s0DAoCS,4CDcD,gBAAgB,4JAChB,gBAAgB,+IAJhB,QAAQ,4CACR,YAAY,gDACZ,YAAY;;AAcT;IADN,mBAAmB,EAAE;;kDAC0C;2FARvD,iBAAiB;kBAnB7B,SAAS;+BAEI,qBAAqB,QAG/B;wBACI,SAAS,EAAE,qCAAqC;wBAChD,kBAAkB,EAAE,sCAAsC;qBAC7D,WAED;wBACI,QAAQ;wBACR,YAAY;wBACZ,YAAY;wBACZ,gBAAgB;wBAChB,gBAAgB;qBACnB,mBACgB,uBAAuB,CAAC,MAAM;;0BA0ClC,MAAM;2BAAC,oBAAoB;;0BAAG,QAAQ;gGAH8B,YAAY,OAAE,EAAC,IAAI,EAAE,UAAU,EAAC","sourcesContent":["import {ChangeDetectionStrategy, Component, computed, ElementRef, Inject, inject, Optional, Signal, viewChild} from '@angular/core';\nimport {NgTemplateOutlet} from '@angular/common';\nimport {LocalizePipe, TooltipDirective} from '@anglr/common';\nimport {RecursivePartial} from '@jscrpt/common';\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\n\nimport {NormalState, NormalStateOptions, SelectPlugin, SimpleNormalStateCssClasses} from '../../../interfaces';\nimport {SelectPluginInstances, SelectBus} from '../../../misc/classes';\nimport {CopyOptionsAsSignal} from '../../../decorators';\nimport {NORMAL_STATE_OPTIONS} from '../../../misc/tokens';\nimport {DisplayValue, HasValue} from '../../../pipes';\n\n//TODO: improvement, carret direction\n\nconst defaultOptions: NormalStateOptions<SimpleNormalStateCssClasses> =\n{\n cancelValue: false,\n texts:\n {\n cancelTitle: 'cancel selected values',\n },\n cssClasses:\n {\n componentElement: 'normal-state-component',\n element: 'normal-state-element',\n value: 'select-align-self-center',\n carret: 'normal-state-carret',\n carretIcon: 'fas fa-caret-down select-align-self-center',\n cancel: 'normal-state-cancel',\n cancelIcon: 'fas fa-times select-align-self-center',\n },\n};\n\n/**\n * Simple normal state displaying value as 'button' that opens popup with options when clicked.\n */\n@Component(\n{\n selector: 'simple-normal-state',\n templateUrl: 'simpleNormalState.component.html',\n host:\n {\n '[class]': 'options.cssClasses.componentElement',\n '[class.disabled]': '!!selectBus.selectOptions().readonly',\n },\n imports:\n [\n HasValue,\n DisplayValue,\n LocalizePipe,\n TooltipDirective,\n NgTemplateOutlet,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SimpleNormalState<TValue = unknown, TPublicValue = TValue> implements NormalState<TValue, TPublicValue, NormalStateOptions<SimpleNormalStateCssClasses>>\n{\n //######################### public properties - implementation of SelectPlugin #########################\n\n /**\n * @inheritdoc\n */\n @CopyOptionsAsSignal()\n public options: NormalStateOptions<SimpleNormalStateCssClasses>;\n\n /**\n * @inheritdoc\n */\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\n\n /**\n * @inheritdoc\n */\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\n\n /**\n * @inheritdoc\n */\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\n\n //######################### protected properties - template bindings #########################\n\n /**\n * Active descendant for aria-activedescendant attribute\n */\n protected activeDescendant: Signal<string>;\n\n //######################### protected properties - children #########################\n\n /**\n * Reference to button element in template\n */\n protected htmlButton: Signal<ElementRef<HTMLButtonElement>> = viewChild.required('htmlButton', {read: ElementRef});\n\n //######################### constructor #########################\n constructor(@Inject(NORMAL_STATE_OPTIONS) @Optional() options?: RecursivePartial<NormalStateOptions<SimpleNormalStateCssClasses>>|null,)\n {\n this.options = deepCopyWithArrayOverride(defaultOptions as NormalStateOptions<SimpleNormalStateCssClasses>,\n options);\n\n this.activeDescendant = computed(() => `${this.selectBus.id}-${this.selectPlugins.optionsHandler()?.listOptions()?.find(option => option.active())?.index}`);\n }\n\n //######################### public methods - implementation of LiveSearch #########################\n\n /**\n * @inheritdoc\n */\n public focus(): void\n {\n this.htmlButton()?.nativeElement.focus();\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Handles click event\n */\n protected click(): void\n {\n this.selectBus.click.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles focus event\n */\n protected handleFocus(): void\n {\n this.selectBus.internalsFocus.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles blur event\n */\n protected blur(): void\n {\n this.selectBus.internalsBlur.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles cancel value\n */\n protected cancel(): void\n {\n this.selectBus.optionActivate.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n}\n","<ng-template #defaultLook>{{selectBus.selectedOptions() | displayValue | localize}}</ng-template>\n\n<button #htmlButton\n type=\"button\"\n role=\"combobox\"\n [class]=\"options.cssClasses.element\"\n [disabled]=\"!!selectBus.selectOptions().readonly\"\n [attr.aria-expanded]=\"selectBus.popupVisible()\"\n [attr.aria-controls]=\"selectBus.popupVisible() ? selectBus.id : null\"\n [attr.aria-activedescendant]=\"selectBus.popupVisible() ? activeDescendant() : null\"\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\n [tooltip]=\"selectBus.selectedOptions() | displayValue | localize\"\n (click)=\"click()\"\n (blur)=\"blur()\"\n (focus)=\"handleFocus()\">\n <span [class]=\"options.cssClasses.value\">\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTemplate() || defaultLook; context: {$implicit: this}\"/>\n </span>\n</button>\n\n@if(options.cancelValue && (selectBus.selectedOptions() | hasValue))\n{\n <button type=\"button\" \n [disabled]=\"!!selectBus.selectOptions().readonly\"\n [class]=\"options.cssClasses.cancel\" \n [tooltip]=\"options.texts.cancelTitle | localize\" \n [attr.aria-label]=\"options.texts.cancelTitle | localize\"\n (click)=\"cancel()\" \n (blur)=\"blur()\" \n (focus)=\"handleFocus()\">\n <span [class]=\"options.cssClasses.cancelIcon\"></span>\n </button>\n}\n\n<button type=\"button\" [class]=\"options.cssClasses.carret\" [disabled]=\"!!selectBus.selectOptions().readonly\" (click)=\"click(); selectBus.setFocus()\" (focus)=\"handleFocus()\" (blur)=\"blur()\" tabindex=\"-1\" aria-hidden=\"true\">\n <span [class]=\"options.cssClasses.carretIcon\"></span>\n</button>"]}
|
|
1
|
+
{"version":3,"file":"simpleNormalState.component.js","sourceRoot":"","sources":["../../../../../src/plugins/normalState/simpleNormalState/simpleNormalState.component.ts","../../../../../src/plugins/normalState/simpleNormalState/simpleNormalState.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAU,SAAS,EAAC,MAAM,eAAe,CAAC;AACpI,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAC,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAC,qBAAqB,EAAE,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,gBAAgB,C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BAAoB;;0BAAG,QAAQ;gGAH8B,YAAY,OAAE,EAAC,IAAI,EAAE,UAAU,EAAC","sourcesContent":["import {ChangeDetectionStrategy, Component, computed, ElementRef, Inject, inject, Optional, Signal, viewChild} from '@angular/core';\nimport {NgTemplateOutlet} from '@angular/common';\nimport {LocalizePipe, TooltipDirective} from '@anglr/common';\nimport {RecursivePartial} from '@jscrpt/common';\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\n\nimport {NormalState, NormalStateOptions, SelectPlugin, SimpleNormalStateCssClasses} from '../../../interfaces';\nimport {SelectPluginInstances, SelectBus} from '../../../misc/classes';\nimport {CopyOptionsAsSignal} from '../../../decorators';\nimport {NORMAL_STATE_OPTIONS} from '../../../misc/tokens';\nimport {DisplayValue, HasValue} from '../../../pipes';\n\n//TODO: improvement, carret direction\n\nconst defaultOptions: NormalStateOptions<SimpleNormalStateCssClasses> =\n{\n cancelValue: false,\n texts:\n {\n cancelTitle: 'cancel selected values',\n },\n cssClasses:\n {\n componentElement: 'normal-state-component',\n interactiveElement: 'normal-state-interactive-element',\n value: 'normal-state-value select-align-self-center',\n carretIcon: 'normal-state-carret fas fa-caret-down select-align-self-center',\n cancel: 'normal-state-cancel',\n cancelIcon: 'fas fa-times select-align-self-center',\n },\n};\n\n/**\n * Simple normal state displaying value as 'button' that opens popup with options when clicked.\n */\n@Component(\n{\n selector: 'simple-normal-state',\n templateUrl: 'simpleNormalState.component.html',\n host:\n {\n '[class]': 'options.cssClasses.componentElement',\n '[class.disabled]': '!!selectBus.selectOptions().readonly',\n },\n imports:\n [\n HasValue,\n DisplayValue,\n LocalizePipe,\n TooltipDirective,\n NgTemplateOutlet,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SimpleNormalState<TValue = unknown, TPublicValue = TValue> implements NormalState<TValue, TPublicValue, NormalStateOptions<SimpleNormalStateCssClasses>>\n{\n //######################### public properties - implementation of SelectPlugin #########################\n\n /**\n * @inheritdoc\n */\n @CopyOptionsAsSignal()\n public options: NormalStateOptions<SimpleNormalStateCssClasses>;\n\n /**\n * @inheritdoc\n */\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\n\n /**\n * @inheritdoc\n */\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\n\n /**\n * @inheritdoc\n */\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\n\n //######################### protected properties - template bindings #########################\n\n /**\n * Active descendant for aria-activedescendant attribute\n */\n protected activeDescendant: Signal<string>;\n\n //######################### protected properties - children #########################\n\n /**\n * Reference to button element in template\n */\n protected htmlButton: Signal<ElementRef<HTMLButtonElement>> = viewChild.required('htmlButton', {read: ElementRef});\n\n //######################### constructor #########################\n constructor(@Inject(NORMAL_STATE_OPTIONS) @Optional() options?: RecursivePartial<NormalStateOptions<SimpleNormalStateCssClasses>>|null,)\n {\n this.options = deepCopyWithArrayOverride(defaultOptions as NormalStateOptions<SimpleNormalStateCssClasses>,\n options);\n\n this.activeDescendant = computed(() => `${this.selectBus.id}-${this.selectPlugins.optionsHandler()?.listOptions()?.find(option => option.active())?.index}`);\n }\n\n //######################### public methods - implementation of LiveSearch #########################\n\n /**\n * @inheritdoc\n */\n public focus(): void\n {\n this.htmlButton()?.nativeElement.focus();\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Handles click event\n */\n protected click(): void\n {\n this.selectBus.click.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles focus event\n */\n protected handleFocus(): void\n {\n this.selectBus.internalsFocus.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles blur event\n */\n protected blur(): void\n {\n this.selectBus.internalsBlur.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n\n /**\n * Handles cancel value\n */\n protected cancel(): void\n {\n this.selectBus.optionActivate.next(\n {\n source: this as SelectPlugin,\n sourceElement: this.pluginElement.nativeElement,\n data: null,\n });\n }\n}\n","<ng-template #defaultLook>{{selectBus.selectedOptions() | displayValue | localize}}</ng-template>\r\n\r\n<button #htmlButton\r\n type=\"button\"\r\n role=\"combobox\"\r\n [class]=\"options.cssClasses.interactiveElement\"\r\n [disabled]=\"!!selectBus.selectOptions().readonly\"\r\n [attr.aria-expanded]=\"selectBus.popupVisible()\"\r\n [attr.aria-controls]=\"selectBus.popupVisible() ? selectBus.id : null\"\r\n [attr.aria-activedescendant]=\"selectBus.popupVisible() ? activeDescendant() : null\"\r\n [attr.aria-label]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n [tooltip]=\"selectBus.selectedOptions() | displayValue | localize\"\r\n (click)=\"click()\"\r\n (blur)=\"blur()\"\r\n (focus)=\"handleFocus()\">\r\n</button>\r\n\r\n<span [class]=\"options.cssClasses.value\" aria-hidden=\"true\" role=\"presentation\">\r\n <ng-container *ngTemplateOutlet=\"selectBus.selectOptions().templateGatherer.normalStateTemplate() || defaultLook; context: {$implicit: this}\"/>\r\n</span>\r\n\r\n@if(options.cancelValue && (selectBus.selectedOptions() | hasValue))\r\n{\r\n <button type=\"button\" \r\n [disabled]=\"!!selectBus.selectOptions().readonly\"\r\n [class]=\"options.cssClasses.cancel\" \r\n [tooltip]=\"options.texts.cancelTitle | localize\" \r\n [attr.aria-label]=\"options.texts.cancelTitle | localize\"\r\n (click)=\"cancel()\" \r\n (blur)=\"blur()\" \r\n (focus)=\"handleFocus()\">\r\n <span [class]=\"options.cssClasses.cancelIcon\"></span>\r\n </button>\r\n}\r\n\r\n<span aria-hidden=\"true\" role=\"presentation\" [class]=\"options.cssClasses.carretIcon\"></span>"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/optionsHandler/index.ts"],"names":[],"mappings":"AAAA,cAAc,+CAA+C,CAAC;AAC9D,cAAc,uDAAuD,CAAC;AACtE,cAAc,sBAAsB,CAAC","sourcesContent":["export * from './noOptionsHandler/noOptionsHandler.component';\nexport * from './simpleOptionsHandler/simpleOptionsHandler.component';\nexport * from './optionsHandlerBase';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/optionsHandler/index.ts"],"names":[],"mappings":"AAAA,cAAc,+CAA+C,CAAC;AAC9D,cAAc,uDAAuD,CAAC;AACtE,cAAc,sBAAsB,CAAC","sourcesContent":["export * from './noOptionsHandler/noOptionsHandler.component';\r\nexport * from './simpleOptionsHandler/simpleOptionsHandler.component';\r\nexport * from './optionsHandlerBase';\r\n"]}
|
package/es2022/src/plugins/optionsHandler/noOptionsHandler/noOptionsHandler.component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noOptionsHandler.component.js","sourceRoot":"","sources":["../../../../../src/plugins/optionsHandler/noOptionsHandler/noOptionsHandler.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAS,MAAM,eAAe,CAAC;AAErG,OAAO,EAAC,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,uBAAuB,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;;AAEzD,MAAM,cAAc,GACpB;IACI,eAAe,EAAE,SAAS;IAC1B,0BAA0B,EAAE,KAAK;CACpC,CAAC;AAEF;;GAEG;AAOH,MAAM,OAAO,gBAA0D,SAAQ,kBAAuE;IAsBlJ,iEAAiE;IACjE,YAAyD,OAA8D;QAEnH,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,yBAAyB,CAAC,cAA+C,EAC/C,OAAO,CAAC,CAAC;QAElD,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,eAAe,CAAC,gBAAgB,EAAE;6FAAC,CAAC;QAC1G,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,GAAG,EAAE;YAE7B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YACvC,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,EAAoD,CAAC;YAEnG,IAAG,WAAW,IAAI,gBAAgB,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,0BAA0B,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAC5G,CAAC;gBACG,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAC1C,CAAC;YAED,OAAO,gBAAgB,CAAC;QAC5B,CAAC;wFAAC,CAAC;IACP,CAAC;8GA3CQ,gBAAgB,kBAuBL,uBAAuB;kGAvBlC,gBAAgB,qGAHf,EAAE;;AAWL;IADN,mBAAmB,EAAE;;iDACwB;2FARrC,gBAAgB;kBAN5B,SAAS;mBACV;oBACI,QAAQ,EAAE,oBAAoB;oBAC9B,QAAQ,EAAE,EAAE;oBACZ,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAClD;;0BAwBgB,MAAM;2BAAC,uBAAuB;;0BAAG,QAAQ","sourcesContent":["import {ChangeDetectionStrategy, Component, computed, Inject, Optional, Signal} from '@angular/core';\nimport {RecursivePartial} from '@jscrpt/common';\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\n\nimport {OptionsHandler, SelectOptionState, OptionsHandlerOptions} from '../../../interfaces';\nimport {CopyOptionsAsSignal} from '../../../decorators';\nimport {OPTIONS_HANDLER_OPTIONS} from '../../../misc/tokens';\nimport {OptionsHandlerBase} from '../optionsHandlerBase';\n\nconst defaultOptions: OptionsHandlerOptions<unknown> =\n{\n newOptionGetter: undefined,\n newOptionOnlyWhenNoOptions: false,\n};\n\n/**\n * Options handler that does nothing to obtained options, use them as they are\n */\n@Component(\n{\n selector: 'no-options-handler',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NoOptionsHandler<TValue = unknown, TPublicValue = TValue> extends OptionsHandlerBase<TValue, TPublicValue, OptionsHandlerOptions<TValue>> implements OptionsHandler<TValue, TPublicValue, OptionsHandlerOptions<TValue>>\n{\n //######################### public properties - implementation of SelectPlugin #########################\n\n /**\n * @inheritdoc\n */\n @CopyOptionsAsSignal()\n public options: OptionsHandlerOptions<TValue>;\n\n //######################### public properties - implementation of OptionsHandler #########################\n\n /**\n * @inheritdoc\n */\n public readonly availableOptions: Signal<readonly SelectOptionState<TValue>[]|undefined|null>;\n\n /**\n * @inheritdoc\n */\n public readonly listOptions: Signal<readonly SelectOptionState<TValue>[]|undefined|null>;\n\n //######################### constructor #########################\n constructor(@Inject(OPTIONS_HANDLER_OPTIONS) @Optional() options?: RecursivePartial<OptionsHandlerOptions<TValue>>|null,)\n {\n super();\n\n this.options = deepCopyWithArrayOverride(defaultOptions as OptionsHandlerOptions<TValue>,\n options);\n\n this.availableOptions = computed(() => this.selectBus.selectOptions().optionsGatherer.availableOptions());\n this.listOptions = computed(() =>\n {\n const firstOption = this.firstOption();\n const availableOptions = this.availableOptions() as SelectOptionState<TValue>[] | null | undefined;\n\n if(firstOption && availableOptions && (!this.options.newOptionOnlyWhenNoOptions || !availableOptions.length))\n {\n availableOptions.unshift(firstOption);\n }\n\n return availableOptions;\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"noOptionsHandler.component.js","sourceRoot":"","sources":["../../../../../src/plugins/optionsHandler/noOptionsHandler/noOptionsHandler.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAS,MAAM,eAAe,CAAC;AAErG,OAAO,EAAC,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAC,mBAAmB,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AClD;;0BAwBgB,MAAM;2BAAC,uBAAuB;;0BAAG,QAAQ","sourcesContent":["import {ChangeDetectionStrategy, Component, computed, Inject, Optional, Signal} from '@angular/core';\r\nimport {RecursivePartial} from '@jscrpt/common';\r\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\r\n\r\nimport {OptionsHandler, SelectOptionState, OptionsHandlerOptions} from '../../../interfaces';\r\nimport {CopyOptionsAsSignal} from '../../../decorators';\r\nimport {OPTIONS_HANDLER_OPTIONS} from '../../../misc/tokens';\r\nimport {OptionsHandlerBase} from '../optionsHandlerBase';\r\n\r\nconst defaultOptions: OptionsHandlerOptions<unknown> =\r\n{\r\n newOptionGetter: undefined,\r\n newOptionOnlyWhenNoOptions: false,\r\n};\r\n\r\n/**\r\n * Options handler that does nothing to obtained options, use them as they are\r\n */\r\n@Component(\r\n{\r\n selector: 'no-options-handler',\r\n template: '',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class NoOptionsHandler<TValue = unknown, TPublicValue = TValue> extends OptionsHandlerBase<TValue, TPublicValue, OptionsHandlerOptions<TValue>> implements OptionsHandler<TValue, TPublicValue, OptionsHandlerOptions<TValue>>\r\n{\r\n //######################### public properties - implementation of SelectPlugin #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n @CopyOptionsAsSignal()\r\n public options: OptionsHandlerOptions<TValue>;\r\n\r\n //######################### public properties - implementation of OptionsHandler #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public readonly availableOptions: Signal<readonly SelectOptionState<TValue>[]|undefined|null>;\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public readonly listOptions: Signal<readonly SelectOptionState<TValue>[]|undefined|null>;\r\n\r\n //######################### constructor #########################\r\n constructor(@Inject(OPTIONS_HANDLER_OPTIONS) @Optional() options?: RecursivePartial<OptionsHandlerOptions<TValue>>|null,)\r\n {\r\n super();\r\n\r\n this.options = deepCopyWithArrayOverride(defaultOptions as OptionsHandlerOptions<TValue>,\r\n options);\r\n\r\n this.availableOptions = computed(() => this.selectBus.selectOptions().optionsGatherer.availableOptions());\r\n this.listOptions = computed(() =>\r\n {\r\n const firstOption = this.firstOption();\r\n const availableOptions = this.availableOptions() as SelectOptionState<TValue>[] | null | undefined;\r\n\r\n if(firstOption && availableOptions && (!this.options.newOptionOnlyWhenNoOptions || !availableOptions.length))\r\n {\r\n availableOptions.unshift(firstOption);\r\n }\r\n\r\n return availableOptions;\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optionsHandlerBase.js","sourceRoot":"","sources":["../../../../src/plugins/optionsHandler/optionsHandlerBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AAG5F,OAAO,EAAC,SAAS,EAAE,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;;AAEpE;;GAEG;AAEH,MAAM,OAAgB,kBAAkB;IA+BpC,iEAAiE;IACjE;QA9BA,sEAAsE;QAEtE;;WAEG;QACO,gBAAW,GAAqE,MAAM,CAAC,IAAI;wFAAC,CAAC;QASvG;;WAEG;QACI,kBAAa,GAAgD,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAElG;;WAEG;QACI,kBAAa,GAA4B,MAAM,CAAC,UAAU,CAAC,CAAC;QAEnE;;WAEG;QACI,cAAS,GAAoC,MAAM,CAAC,SAAS,CAAC,CAAC;QAKlE,MAAM,CAAC,GAAG,EAAE;YAER,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;YAEtD,IAAG,CAAC,gBAAgB,EACpB,CAAC;gBACG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAE3B,OAAO;YACX,CAAC;YAED,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAEtD,IAAG,CAAC,MAAM,EACV,CAAC;gBACG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAE3B,OAAO;YACX,CAAC;YAED,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAsC,CAAC;YAChF,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;YACzB,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC,KAAK;yFAAC,CAAC;YACnC,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK;uFAAC,CAAC;YACjC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC;YAEpB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACP,CAAC;8GA9DiB,kBAAkB;kGAAlB,kBAAkB;;2FAAlB,kBAAkB;kBADvC,SAAS","sourcesContent":["import {Directive, effect, ElementRef, inject, signal, WritableSignal} from '@angular/core';\n\nimport {OptionsHandlerOptions, SelectOptionStateSyntetic} from '../../interfaces';\nimport {SelectBus, SelectPluginInstances} from '../../misc/classes';\n\n/**\n * Base class for options handlers.\n */\n@Directive()\nexport abstract class OptionsHandlerBase<TValue = unknown, TPublicValue = TValue, TOptions extends OptionsHandlerOptions<TValue> = OptionsHandlerOptions<TValue>>\n{\n //######################### protected fields #########################\n\n /**\n * First option to be inserted into options list, when adding new option is enabled\n */\n protected firstOption: WritableSignal<SelectOptionStateSyntetic<TValue>|undefined|null> = signal(null);\n\n //######################### public properties - implementation of SelectPlugin #########################\n\n /**\n * @inheritdoc\n */\n public abstract options: TOptions;\n\n /**\n * @inheritdoc\n */\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\n\n /**\n * @inheritdoc\n */\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\n\n /**\n * @inheritdoc\n */\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\n\n //######################### constructor #########################\n constructor()\n {\n effect(() =>\n {\n const newOptionsGetter = this.options.newOptionGetter;\n\n if(!newOptionsGetter)\n {\n this.firstOption.set(null);\n\n return;\n }\n\n const search = this.selectPlugins.LiveSearch.search();\n\n if(!search)\n {\n this.firstOption.set(null);\n\n return;\n }\n\n const newOption = newOptionsGetter(search) as SelectOptionStateSyntetic<TValue>;\n newOption.created = true;\n newOption.selected = signal(false);\n newOption.active = signal(false);\n newOption.index = 0;\n\n this.firstOption.set(newOption);\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"optionsHandlerBase.js","sourceRoot":"","sources":["../../../../src/plugins/optionsHandler/optionsHandlerBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AAG5F,OAAO,EAAC,SAAS,EAAE,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;;AAEpE;;GAEG;AAEH,MAAM,OAAgB,kBAAkB;IA+BpC,iEAAiE;IACjE;QA9BA,sEAAsE;QAEtE;;WAEG;QACO,gBAAW,GAAqE,MAAM,CAAC,IAAI;wFAAC,CAAC;QASvG;;WAEG;QACI,kBAAa,GAAgD,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAElG;;WAEG;QACI,kBAAa,GAA4B,MAAM,CAAC,UAAU,CAAC,CAAC;QAEnE;;WAEG;QACI,cAAS,GAAoC,MAAM,CAAC,SAAS,CAAC,CAAC;QAKlE,MAAM,CAAC,GAAG,EAAE;YAER,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;YAEtD,IAAG,CAAC,gBAAgB,EACpB,CAAC;gBACG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAE3B,OAAO;YACX,CAAC;YAED,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAEtD,IAAG,CAAC,MAAM,EACV,CAAC;gBACG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAE3B,OAAO;YACX,CAAC;YAED,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAsC,CAAC;YAChF,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;YACzB,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC,KAAK;yFAAC,CAAC;YACnC,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK;uFAAC,CAAC;YACjC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC;YAEpB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACP,CAAC;8GA9DiB,kBAAkB;kGAAlB,kBAAkB;;2FAAlB,kBAAkB;kBADvC,SAAS","sourcesContent":["import {Directive, effect, ElementRef, inject, signal, WritableSignal} from '@angular/core';\r\n\r\nimport {OptionsHandlerOptions, SelectOptionStateSyntetic} from '../../interfaces';\r\nimport {SelectBus, SelectPluginInstances} from '../../misc/classes';\r\n\r\n/**\r\n * Base class for options handlers.\r\n */\r\n@Directive()\r\nexport abstract class OptionsHandlerBase<TValue = unknown, TPublicValue = TValue, TOptions extends OptionsHandlerOptions<TValue> = OptionsHandlerOptions<TValue>>\r\n{\r\n //######################### protected fields #########################\r\n\r\n /**\r\n * First option to be inserted into options list, when adding new option is enabled\r\n */\r\n protected firstOption: WritableSignal<SelectOptionStateSyntetic<TValue>|undefined|null> = signal(null);\r\n\r\n //######################### public properties - implementation of SelectPlugin #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public abstract options: TOptions;\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public selectPlugins: SelectPluginInstances<TValue, TPublicValue> = inject(SelectPluginInstances);\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public pluginElement: ElementRef<HTMLElement> = inject(ElementRef);\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public selectBus: SelectBus<TValue, TPublicValue> = inject(SelectBus);\r\n\r\n //######################### constructor #########################\r\n constructor()\r\n {\r\n effect(() =>\r\n {\r\n const newOptionsGetter = this.options.newOptionGetter;\r\n\r\n if(!newOptionsGetter)\r\n {\r\n this.firstOption.set(null);\r\n\r\n return;\r\n }\r\n\r\n const search = this.selectPlugins.LiveSearch.search();\r\n\r\n if(!search)\r\n {\r\n this.firstOption.set(null);\r\n\r\n return;\r\n }\r\n\r\n const newOption = newOptionsGetter(search) as SelectOptionStateSyntetic<TValue>;\r\n newOption.created = true;\r\n newOption.selected = signal(false);\r\n newOption.active = signal(false);\r\n newOption.index = 0;\r\n\r\n this.firstOption.set(newOption);\r\n });\r\n }\r\n}\r\n"]}
|
package/es2022/src/plugins/optionsHandler/simpleOptionsHandler/simpleOptionsHandler.component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleOptionsHandler.component.js","sourceRoot":"","sources":["../../../../../src/plugins/optionsHandler/simpleOptionsHandler/simpleOptionsHandler.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAS,MAAM,eAAe,CAAC;AAErG,OAAO,EAAC,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,uBAAuB,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;;AAEzD,MAAM,cAAc,GACpB;IACI,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,SAAS;IAC1B,0BAA0B,EAAE,KAAK;CACpC,CAAC;AAEF;;GAEG;AAOH,MAAM,OAAO,oBAA8D,SAAQ,kBAA6E;IAsB5J,iEAAiE;IACjE,YA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C,CAAC;gBAC1C,CAAC;gBAED,OAAO,gBAAgB,CAAC;YAC5B,CAAC;YAED,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;YAC/C,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;YAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;YACpC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;YAExC,gBAAgB,GAAG,gBAAgB;gBAC/B,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAEjF,IAAG,WAAW,IAAI,gBAAgB,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,0BAA0B,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAC5G,CAAC;gBACG,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAC1C,CAAC;YAED,OAAO,gBAAgB,CAAC;QAC5B,CAAC;wFAAC,CAAC;IACP,CAAC;8GAxEQ,oBAAoB,kBAuBT,uBAAuB;kGAvBlC,oBAAoB,yGAHnB,EAAE;;AAWL;IADN,mBAAmB,EAAE;;qDAC8B;2FAR3C,oBAAoB;kBANhC,SAAS;mBACV;oBACI,QAAQ,EAAE,wBAAwB;oBAClC,QAAQ,EAAE,EAAE;oBACZ,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAClD;;0BAwBgB,MAAM;2BAAC,uBAAuB;;0BAAG,QAAQ","sourcesContent":["import {ChangeDetectionStrategy, Component, computed, Inject, Optional, Signal} from '@angular/core';\nimport {RecursivePartial} from '@jscrpt/common';\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\n\nimport {OptionsHandler, SelectOptionState, SimpleOptionsHandlerOptions} from '../../../interfaces';\nimport {CopyOptionsAsSignal} from '../../../decorators';\nimport {OPTIONS_HANDLER_OPTIONS} from '../../../misc/tokens';\nimport {compareSelectOptions} from '../../../misc/utils';\nimport {OptionsHandlerBase} from '../optionsHandlerBase';\n\nconst defaultOptions: SimpleOptionsHandlerOptions<unknown> =\n{\n listSelected: true,\n newOptionGetter: undefined,\n newOptionOnlyWhenNoOptions: false,\n};\n\n/**\n * Options handler that does apply live search and allows to remove selected option(s) from options list\n */\n@Component(\n{\n selector: 'simple-options-handler',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SimpleOptionsHandler<TValue = unknown, TPublicValue = TValue> extends OptionsHandlerBase<TValue, TPublicValue, SimpleOptionsHandlerOptions<TValue>> implements OptionsHandler<TValue, TPublicValue, SimpleOptionsHandlerOptions<TValue>>\n{\n //######################### public properties - implementation of SelectPlugin #########################\n\n /**\n * @inheritdoc\n */\n @CopyOptionsAsSignal()\n public options: SimpleOptionsHandlerOptions<TValue>;\n\n //######################### public properties - implementation of OptionsHandler #########################\n\n /**\n * @inheritdoc\n */\n public readonly availableOptions: Signal<readonly SelectOptionState<TValue>[]|undefined|null>;\n\n /**\n * @inheritdoc\n */\n public readonly listOptions: Signal<readonly SelectOptionState<TValue>[]|undefined|null>;\n\n //######################### constructor #########################\n constructor(@Inject(OPTIONS_HANDLER_OPTIONS) @Optional() options?: RecursivePartial<SimpleOptionsHandlerOptions<TValue>>|null,)\n {\n super();\n\n this.options = deepCopyWithArrayOverride(defaultOptions as SimpleOptionsHandlerOptions<TValue>,\n options);\n\n this.availableOptions = computed(() => this.selectBus.selectOptions().optionsGatherer.availableOptions());\n this.listOptions = computed(() =>\n {\n const text = this.selectPlugins.LiveSearch.search();\n const selectedOptions = this.selectBus.selectedOptions() ?? [];\n const opts = Array.isArray(selectedOptions) ? selectedOptions : [selectedOptions];\n const firstOption = this.firstOption();\n let availableOptions = this.availableOptions() as SelectOptionState<TValue>[] | null | undefined;\n\n if(!this.options.listSelected)\n {\n availableOptions = availableOptions?.filter(itm =>\n {\n return !opts.some(it => compareSelectOptions(it, itm, this.selectBus));\n });\n }\n\n if(!text)\n {\n if(firstOption && availableOptions && (!this.options.newOptionOnlyWhenNoOptions || !availableOptions.length))\n {\n availableOptions.unshift(firstOption);\n }\n\n return availableOptions;\n }\n\n const options = this.selectBus.selectOptions();\n const textExtractor = options.textExtractor;\n const normalize = options.normalize;\n const textCompare = options.textCompare;\n\n availableOptions = availableOptions\n ?.filter(itm => textCompare(normalize(textExtractor(itm)), normalize(text)));\n\n if(firstOption && availableOptions && (!this.options.newOptionOnlyWhenNoOptions || !availableOptions.length))\n {\n availableOptions.unshift(firstOption);\n }\n\n return availableOptions;\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"simpleOptionsHandler.component.js","sourceRoot":"","sources":["../../../../../src/plugins/optionsHandler/simpleOptionsHandler/simpleOptionsHandler.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAS,MAAM,eAAe,CAAC;AAErG,OAAO,EAAC,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,uBAAuB,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;;AAEzD,MAAM,cAAc,GACpB;IACI,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,SAAS;IAC1B,0BAA0B,EAAE,KAAK;CACpC,CAAC;AAEF;;GAEG;AAOH,MAAM,OAAO,oBAA8D,SAAQ,kBAA6E;IAsB5J,iEAAiE;IACjE,YAAyD,OAAoE;QAEzH,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,yBAAyB,CAAC,cAAqD,EACrD,OAAO,CAAC,CAAC;QAElD,IAAI,CAAC,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C/C,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;YAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;YACpC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;YAExC,gBAAgB,GAAG,gBAAgB;gBAC/B,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAEjF,IAAG,WAAW,IAAI,gBAAgB,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,0BAA0B,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAC5G,CAAC;gBACG,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAC1C,CAAC;YAED,OAAO,gBAAgB,CAAC;QAC5B,CAAC;wFAAC,CAAC;IACP,CAAC;8GAxEQ,oBAAoB,kBAuBT,uBAAuB;kGAvBlC,oBAAoB,yGAHnB,EAAE;;AAWL;IADN,mBAAmB,EAAE;;qDAC8B;2FAR3C,oBAAoB;kBANhC,SAAS;mBACV;oBACI,QAAQ,EAAE,wBAAwB;oBAClC,QAAQ,EAAE,EAAE;oBACZ,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAClD;;0BAwBgB,MAAM;2BAAC,uBAAuB;;0BAAG,QAAQ","sourcesContent":["import {ChangeDetectionStrategy, Component, computed, Inject, Optional, Signal} from '@angular/core';\r\nimport {RecursivePartial} from '@jscrpt/common';\r\nimport {deepCopyWithArrayOverride} from '@jscrpt/common/lodash';\r\n\r\nimport {OptionsHandler, SelectOptionState, SimpleOptionsHandlerOptions} from '../../../interfaces';\r\nimport {CopyOptionsAsSignal} from '../../../decorators';\r\nimport {OPTIONS_HANDLER_OPTIONS} from '../../../misc/tokens';\r\nimport {compareSelectOptions} from '../../../misc/utils';\r\nimport {OptionsHandlerBase} from '../optionsHandlerBase';\r\n\r\nconst defaultOptions: SimpleOptionsHandlerOptions<unknown> =\r\n{\r\n listSelected: true,\r\n newOptionGetter: undefined,\r\n newOptionOnlyWhenNoOptions: false,\r\n};\r\n\r\n/**\r\n * Options handler that does apply live search and allows to remove selected option(s) from options list\r\n */\r\n@Component(\r\n{\r\n selector: 'simple-options-handler',\r\n template: '',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class SimpleOptionsHandler<TValue = unknown, TPublicValue = TValue> extends OptionsHandlerBase<TValue, TPublicValue, SimpleOptionsHandlerOptions<TValue>> implements OptionsHandler<TValue, TPublicValue, SimpleOptionsHandlerOptions<TValue>>\r\n{\r\n //######################### public properties - implementation of SelectPlugin #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n @CopyOptionsAsSignal()\r\n public options: SimpleOptionsHandlerOptions<TValue>;\r\n\r\n //######################### public properties - implementation of OptionsHandler #########################\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public readonly availableOptions: Signal<readonly SelectOptionState<TValue>[]|undefined|null>;\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n public readonly listOptions: Signal<readonly SelectOptionState<TValue>[]|undefined|null>;\r\n\r\n //######################### constructor #########################\r\n constructor(@Inject(OPTIONS_HANDLER_OPTIONS) @Optional() options?: RecursivePartial<SimpleOptionsHandlerOptions<TValue>>|null,)\r\n {\r\n super();\r\n\r\n this.options = deepCopyWithArrayOverride(defaultOptions as SimpleOptionsHandlerOptions<TValue>,\r\n options);\r\n\r\n this.availableOptions = computed(() => this.selectBus.selectOptions().optionsGatherer.availableOptions());\r\n this.listOptions = computed(() =>\r\n {\r\n const text = this.selectPlugins.LiveSearch.search();\r\n const selectedOptions = this.selectBus.selectedOptions() ?? [];\r\n const opts = Array.isArray(selectedOptions) ? selectedOptions : [selectedOptions];\r\n const firstOption = this.firstOption();\r\n let availableOptions = this.availableOptions() as SelectOptionState<TValue>[] | null | undefined;\r\n\r\n if(!this.options.listSelected)\r\n {\r\n availableOptions = availableOptions?.filter(itm =>\r\n {\r\n return !opts.some(it => compareSelectOptions(it, itm, this.selectBus));\r\n });\r\n }\r\n\r\n if(!text)\r\n {\r\n if(firstOption && availableOptions && (!this.options.newOptionOnlyWhenNoOptions || !availableOptions.length))\r\n {\r\n availableOptions.unshift(firstOption);\r\n }\r\n\r\n return availableOptions;\r\n }\r\n\r\n const options = this.selectBus.selectOptions();\r\n const textExtractor = options.textExtractor;\r\n const normalize = options.normalize;\r\n const textCompare = options.textCompare;\r\n\r\n availableOptions = availableOptions\r\n ?.filter(itm => textCompare(normalize(textExtractor(itm)), normalize(text)));\r\n\r\n if(firstOption && availableOptions && (!this.options.newOptionOnlyWhenNoOptions || !availableOptions.length))\r\n {\r\n availableOptions.unshift(firstOption);\r\n }\r\n\r\n return availableOptions;\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/popup/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC","sourcesContent":["export * from './simplePopup/simplePopup.component';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/popup/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC","sourcesContent":["export * from './simplePopup/simplePopup.component';\r\n"]}
|