@c8y/ngx-components 1018.0.67 → 1018.0.68
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/assets-navigator/asset-node.service.d.ts +1 -1
- package/assets-navigator/group.service.d.ts +1 -1
- package/core/asset-types/asset-types.service.d.ts +6 -14
- package/core/common/get-group-icon.pipe.d.ts +1 -1
- package/core/common/group.service.d.ts +1 -1
- package/esm2020/assets-navigator/asset-node.mjs +3 -3
- package/esm2020/assets-navigator/asset-node.service.mjs +1 -1
- package/esm2020/assets-navigator/group.service.mjs +1 -1
- package/esm2020/core/asset-types/asset-types.service.mjs +17 -36
- package/esm2020/core/common/get-group-icon.pipe.mjs +2 -2
- package/esm2020/core/common/group.service.mjs +4 -4
- package/esm2020/core/search/search-input.component.mjs +3 -3
- package/esm2020/search/columns/asset-type.cell-renderer.component.mjs +3 -3
- package/esm2020/sub-assets/columns/asset-type.cell-renderer.component.mjs +5 -5
- package/esm2020/sub-assets/group-info.component.mjs +2 -2
- package/fesm2015/c8y-ngx-components-assets-navigator.mjs +5 -3
- package/fesm2015/c8y-ngx-components-assets-navigator.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components-search.mjs +7 -5
- package/fesm2015/c8y-ngx-components-search.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components-sub-assets.mjs +10 -8
- package/fesm2015/c8y-ngx-components-sub-assets.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components.mjs +31 -48
- package/fesm2015/c8y-ngx-components.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-assets-navigator.mjs +2 -2
- package/fesm2020/c8y-ngx-components-assets-navigator.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-search.mjs +2 -2
- package/fesm2020/c8y-ngx-components-search.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-sub-assets.mjs +5 -5
- package/fesm2020/c8y-ngx-components-sub-assets.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components.mjs +22 -41
- package/fesm2020/c8y-ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/search/columns/asset-type.cell-renderer.component.d.ts +1 -1
- package/sub-assets/columns/asset-type.cell-renderer.component.d.ts +2 -2
|
@@ -4680,7 +4680,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
|
|
|
4680
4680
|
/**
|
|
4681
4681
|
* AssetTypesService is being used to manage a cache of all existing asset types.
|
|
4682
4682
|
* This service is injected in the AssetOverviewNavigationFactory class, which will trigger
|
|
4683
|
-
* the initialization of the cache as the
|
|
4683
|
+
* the initialization of the cache as the constructor is called.
|
|
4684
4684
|
*/
|
|
4685
4685
|
class AssetTypesService {
|
|
4686
4686
|
constructor(inventory, apiService, appStateService) {
|
|
@@ -4692,9 +4692,10 @@ class AssetTypesService {
|
|
|
4692
4692
|
__and: [{ __has: 'c8y_IsAssetType' }, { name: 'group' }]
|
|
4693
4693
|
}
|
|
4694
4694
|
};
|
|
4695
|
-
this.assetTypesCache = {};
|
|
4696
4695
|
this.DEFAULT_GROUP_ICON = 'c8y-group';
|
|
4697
4696
|
this.DEFAULT_GROUP_ICON_OPEN = 'c8y-group-open';
|
|
4697
|
+
this.assetTypesCache = {};
|
|
4698
|
+
this.isCacheSet = false;
|
|
4698
4699
|
this.allowedMethods = ['POST', 'PUT', 'DELETE'];
|
|
4699
4700
|
this.appStateService.currentUser
|
|
4700
4701
|
.pipe(map(user => user?.id), distinctUntilChanged(), switchMap(userId => {
|
|
@@ -4711,7 +4712,7 @@ class AssetTypesService {
|
|
|
4711
4712
|
}
|
|
4712
4713
|
/**
|
|
4713
4714
|
* Queries available asset types and adds every asset type to the local cache.
|
|
4714
|
-
* @returns
|
|
4715
|
+
* @returns IManagedObject table of asset types.
|
|
4715
4716
|
*/
|
|
4716
4717
|
async initAssetTypesCache() {
|
|
4717
4718
|
const { data } = await this.inventory.list({
|
|
@@ -4720,7 +4721,8 @@ class AssetTypesService {
|
|
|
4720
4721
|
pageSize: 2000
|
|
4721
4722
|
});
|
|
4722
4723
|
data.forEach(assetType => this.addAssetType(assetType));
|
|
4723
|
-
|
|
4724
|
+
this.isCacheSet = true;
|
|
4725
|
+
return data;
|
|
4724
4726
|
}
|
|
4725
4727
|
/**
|
|
4726
4728
|
* Returns an asset type from the cache based on the unique name property.
|
|
@@ -4751,42 +4753,21 @@ class AssetTypesService {
|
|
|
4751
4753
|
* Defaults to false.
|
|
4752
4754
|
* @returns Returns an icon for a given asset type.
|
|
4753
4755
|
*/
|
|
4754
|
-
getIcon(type, open = false) {
|
|
4756
|
+
async getIcon(type, open = false) {
|
|
4757
|
+
if (!this.isCacheSet) {
|
|
4758
|
+
try {
|
|
4759
|
+
await this.initAssetTypesCache();
|
|
4760
|
+
}
|
|
4761
|
+
catch (error) {
|
|
4762
|
+
// do nothing
|
|
4763
|
+
}
|
|
4764
|
+
}
|
|
4755
4765
|
const assetType = this.getAssetTypeByName(type);
|
|
4756
|
-
|
|
4757
|
-
return icon;
|
|
4766
|
+
return assetType?.c8y_IsAssetType?.icon?.name || this.getDefaultGroupIcon(open);
|
|
4758
4767
|
}
|
|
4759
4768
|
getDefaultGroupIcon(open = false) {
|
|
4760
4769
|
return open ? this.DEFAULT_GROUP_ICON_OPEN : this.DEFAULT_GROUP_ICON;
|
|
4761
4770
|
}
|
|
4762
|
-
/**
|
|
4763
|
-
* Checks if the default asset type 'group' already exists and if it doesn't it will be created.
|
|
4764
|
-
* @returns void.
|
|
4765
|
-
*/
|
|
4766
|
-
async createAssetTypeGroupIfNotExists() {
|
|
4767
|
-
const managedObjects = (await this.inventory.listQuery(this.ASSET_TYPE_GROUP_QUERY)).data;
|
|
4768
|
-
if (managedObjects.length > 0) {
|
|
4769
|
-
return;
|
|
4770
|
-
}
|
|
4771
|
-
// if default group asset type doesn't exit create it
|
|
4772
|
-
await this.createDefaultAssetTypeGroup();
|
|
4773
|
-
}
|
|
4774
|
-
/**
|
|
4775
|
-
* create the default asset type group in the Inventory.
|
|
4776
|
-
*/
|
|
4777
|
-
async createDefaultAssetTypeGroup() {
|
|
4778
|
-
await this.inventory.create({
|
|
4779
|
-
label: 'Group',
|
|
4780
|
-
name: 'group',
|
|
4781
|
-
description: 'Default group asset type',
|
|
4782
|
-
c8y_IsAssetType: {
|
|
4783
|
-
icon: 'folder',
|
|
4784
|
-
propertyIds: [],
|
|
4785
|
-
allowedAssetTypeIds: [],
|
|
4786
|
-
isNoneChildAssetsAllowed: 'false'
|
|
4787
|
-
}
|
|
4788
|
-
});
|
|
4789
|
-
}
|
|
4790
4771
|
/**
|
|
4791
4772
|
* Add an asset type to the local cache.
|
|
4792
4773
|
* @param assetType Asset type which should be added to the cache.
|
|
@@ -4950,10 +4931,10 @@ class GroupService {
|
|
|
4950
4931
|
* @param open Determines whether the method should return an alternative icon showing the open state.
|
|
4951
4932
|
* @returns Returns an icon.
|
|
4952
4933
|
*/
|
|
4953
|
-
getIcon(mo, open = false) {
|
|
4934
|
+
async getIcon(mo, open = false) {
|
|
4954
4935
|
const genericMoType = this.determineMoType(mo);
|
|
4955
4936
|
if (genericMoType === 'asset') {
|
|
4956
|
-
return this.getAssetCustomIcon(mo.type, open);
|
|
4937
|
+
return await this.getAssetCustomIcon(mo.type, open);
|
|
4957
4938
|
}
|
|
4958
4939
|
const typeIcons = this.getDefaultIcon(genericMoType);
|
|
4959
4940
|
return (open && typeIcons.iconOpen) || typeIcons.icon;
|
|
@@ -5049,7 +5030,7 @@ __decorate([
|
|
|
5049
5030
|
memoize(property('id')),
|
|
5050
5031
|
__metadata("design:type", Function),
|
|
5051
5032
|
__metadata("design:paramtypes", [Object, Object]),
|
|
5052
|
-
__metadata("design:returntype",
|
|
5033
|
+
__metadata("design:returntype", Promise)
|
|
5053
5034
|
], GroupService.prototype, "getIcon", null);
|
|
5054
5035
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: GroupService, decorators: [{
|
|
5055
5036
|
type: Injectable,
|
|
@@ -5062,7 +5043,7 @@ class GetGroupIconPipe {
|
|
|
5062
5043
|
constructor(groupService) {
|
|
5063
5044
|
this.groupService = groupService;
|
|
5064
5045
|
}
|
|
5065
|
-
transform(mo) {
|
|
5046
|
+
async transform(mo) {
|
|
5066
5047
|
return this.groupService.getIcon(mo);
|
|
5067
5048
|
}
|
|
5068
5049
|
}
|
|
@@ -17107,10 +17088,10 @@ class SearchInputComponent {
|
|
|
17107
17088
|
}
|
|
17108
17089
|
}
|
|
17109
17090
|
SearchInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: SearchInputComponent, deps: [{ token: i1$6.Router }, { token: i1$1.InventoryService }, { token: InventorySearchService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
17110
|
-
SearchInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: SearchInputComponent, selector: "c8y-search-input", inputs: { mode: "mode", enableCustomTemplatePlaceholder: "enableCustomTemplatePlaceholder", customPlaceholder: "customPlaceholder", externalTerm: "externalTerm", customDataQuery: "customDataQuery", container: "container", groupsOnly: "groupsOnly" }, outputs: { filter: "filter", search: "search", reset: "reset", onClick: "onClick" }, host: { listeners: { "document:keydown": "onKeydownHandler($event)" } }, viewQueries: [{ propertyName: "typeahead", first: true, predicate: TypeaheadComponent, descendants: true }, { propertyName: "dropdown", first: true, predicate: ["searchDropdown"], descendants: true }], ngImport: i0, template: "<div\n class=\"dropdown\"\n #searchDropdown=\"bs-dropdown\"\n [insideClick]=\"true\"\n (isOpenChange)=\"onOpenChange($event)\"\n [cdkTrapFocus]=\"searchDropdown.isOpen\"\n *ngIf=\"mode === 'search'\"\n dropdown\n>\n <button\n class=\"main-header-button dropdown-toggle c8y-dropdown\"\n type=\"button\"\n [title]=\"'Search' | translate\"\n dropdownToggle\n data-cy=\"search-input--search-btn\"\n >\n <i c8yIcon=\"search\" class=\"icon-2x\"></i>\n </button>\n\n <div\n id=\"searchDropdown\"\n *dropdownMenu\n class=\"search-header-menu dropdown-menu dropdown-menu-right\"\n >\n <ng-container *ngTemplateOutlet=\"form\"></ng-container>\n </div>\n</div>\n\n<div class=\"search-header-inline\" *ngIf=\"mode === 'select'\">\n <ng-container *ngTemplateOutlet=\"form\"></ng-container>\n</div>\n<ng-template #form>\n <form [ngClass]=\"{ 'c8y-search-form': mode === 'search' }\" novalidate #searchForm=\"ngForm\">\n <c8y-typeahead\n [(ngModel)]=\"selected\"\n placeholder=\"{{ customPlaceholder ? customPlaceholder : defaultPlaceholder }}\"\n (keydown)=\"keyDown($event)\"\n (onIconClick)=\"onReset($event)\"\n [icon]=\"term ? 'times' : 'search'\"\n [allowFreeEntries]=\"false\"\n [container]=\"container\"\n name=\"selected\"\n title=\"Search\"\n >\n <div\n *ngIf=\"enableCustomTemplatePlaceholder && mode === 'search'\"\n class=\"c8y-list__item p-l-24 p-r-24 p-b-8 separator-bottom sticky-top p-t-4\"\n >\n <ng-content></ng-content>\n </div>\n\n <!-- filter buttons -->\n <c8y-li *ngIf=\"term.length !== 0 && mode === 'search'\">\n <div class=\"d-flex\">\n <p class=\"m-r-4 text-muted\">\n <em translate>Searching by exact match. Click for other search options:</em>\n </p>\n <div class=\"btn-group btn-group-sm\">\n <button\n class=\"btn btn-default\"\n type=\"button\"\n title=\"{{ 'Starts with' | translate }}\"\n data-cy=\"search-input--search-starts-with\"\n (click)=\"onFilter(term + '*')\"\n >\n {{ 'Starts with' | translate }}\n </button>\n <button\n class=\"btn btn-default\"\n type=\"button\"\n title=\"{{ 'Contains' | translate }}\"\n data-cy=\"search-input--search-contains\"\n (click)=\"onFilter('*' + term + '*')\"\n >\n {{ 'Contains' | translate }}\n </button>\n <button\n class=\"btn btn-default\"\n type=\"button\"\n title=\"{{ 'Ends with' | translate }}\"\n data-cy=\"search-input--search-ends-with\"\n (click)=\"onFilter('*' + term)\"\n >\n {{ 'Ends with' | translate }}\n </button>\n </div>\n </div>\n </c8y-li>\n\n <!-- Recent search -->\n <c8y-li\n *ngIf=\"term.length === 0 && recentSearchResults.length > 0\"\n [selectable]=\"false\"\n class=\"p-l-24 p-r-24\"\n >\n <div class=\"legend form-block\">\n <span translate>Recent search views</span>\n </div>\n </c8y-li>\n <c8y-li\n *ngFor=\"let result of term.length === 0 ? recentSearchResults : []\"\n class=\"c8y-list__item--link m-l-16 m-r-16\"\n (click)=\"open($event, result, result.name)\"\n >\n <c8y-li-icon>\n <ng-container *ngIf=\"result | shouldShowMo: deviceType.DEVICE; else group\">\n <device-status [mo]=\"result\"></device-status>\n </ng-container>\n <ng-template #group>\n <i [c8yIcon]=\"result | getGroupIcon\" class=\"c8y-icon-duocolor\"></i>\n </ng-template>\n </c8y-li-icon>\n {{ result.name || '--' }}\n </c8y-li>\n\n <!-- Recently registered devices -->\n <c8y-li\n *ngIf=\"\n term.length === 0 && (recentlyRegisteredResults$ | async)?.data?.length > 0 && !groupsOnly\n \"\n class=\"p-l-24 p-r-24\"\n [selectable]=\"false\"\n >\n <div class=\"legend form-block\">\n <span translate>Recently registered devices</span>\n </div>\n </c8y-li>\n <c8y-li\n *c8yFor=\"\n let result of term.length === 0 && !groupsOnly\n ? recentlyRegisteredResults$\n : { data: [] };\n loadMore: 'none'\n \"\n class=\"c8y-list__item--link m-l-16 m-r-16\"\n (click)=\"open($event, result, result.name)\"\n >\n <c8y-li-icon>\n <ng-container *ngIf=\"result | shouldShowMo: deviceType.DEVICE; else group\">\n <device-status [mo]=\"result\"></device-status>\n </ng-container>\n <ng-template #group>\n <i [c8yIcon]=\"result | getGroupIcon\" class=\"c8y-icon-duocolor\"></i>\n </ng-template>\n </c8y-li-icon>\n {{ result.name || '--' }}\n </c8y-li>\n\n <!-- Search results -->\n <c8y-li *ngIf=\"term.length !== 0\" class=\"p-l-24 p-r-24\" [selectable]=\"false\">\n <div class=\"legend form-block m-0\">\n <span translate>Search results</span>\n </div>\n </c8y-li>\n <c8y-li\n *c8yFor=\"\n let result of results$;\n loadMore: 'auto';\n notFound: notFoundTemplate;\n loadingTemplate: loading;\n loadNextLabel: 'Find more\u2026'\n \"\n class=\"c8y-list__item--link m-l-16 m-r-16\"\n (click)=\"open($event, result, result.name)\"\n [title]=\"result.name\"\n data-cy=\"search-input--search-results\"\n >\n <c8y-li-icon>\n <ng-container *ngIf=\"result | shouldShowMo: deviceType.DEVICE; else group\">\n <device-status [mo]=\"result\"></device-status>\n </ng-container>\n <ng-template #group>\n <i [c8yIcon]=\"result | getGroupIcon\" class=\"c8y-icon-duocolor\"></i>\n </ng-template>\n </c8y-li-icon>\n {{ result.name || '--' }}\n </c8y-li>\n\n <!-- No search results found entry -->\n <ng-template #notFoundTemplate>\n <c8y-ui-empty-state \n data-cy=\"search-input--empty-state\" \n [ngClass]=\"{ 'p-4': mode === 'search' }\"\n [icon]=\"'search'\"\n [title]=\"'No match found.' | translate\"\n [horizontal]=\"true\"\n *ngIf=\"noMatch\"\n >\n <small translate *ngIf=\"mode === 'search'\">\n Try to filter or open the asset grid to show all devices and groups.\n </small>\n <small translate *ngIf=\"mode === 'select'\">Try to rephrase your search word.</small>\n </c8y-ui-empty-state>\n </ng-template>\n\n <!-- loading bar first entries -->\n <c8y-li *ngIf=\"isLoading\">\n <c8y-loading></c8y-loading>\n </c8y-li>\n\n <!-- loading bar for loading more entries (inventory roles) -->\n <ng-template #loading>\n <c8y-li>\n <c8y-loading></c8y-loading>\n </c8y-li>\n </ng-template>\n\n <!-- more filter possibilities -->\n <c8y-li\n class=\"m-t-24 bg-level-2 p-t-16 p-b-16 p-l-24 p-r-24 sticky-bottom\"\n [selectable]=\"false\"\n *ngIf=\"mode === 'search'\"\n >\n <div class=\"d-flex a-i-center\">\n <i c8yIcon=\"info-circle\" class=\"text-info m-r-4\"></i>\n <p translate class=\"m-r-8\">Need more filter possibilities?</p>\n <button\n class=\"m-l-16 btn btn-default btn-sm\"\n type=\"button\"\n title=\"{{ 'Go to the asset data table' | translate }}\"\n (mousedown)=\"onOpenAssetTable()\"\n data-cy=\"search-input--asset-table-btn\"\n >\n {{ 'Go to the asset data table' | translate }}\n </button>\n </div>\n </c8y-li>\n </c8y-typeahead>\n </form>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i6$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: i5.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$5.BsDropdownMenuDirective, selector: "[bsDropdownMenu],[dropdownMenu]", exportAs: ["bs-dropdown-menu"] }, { kind: "directive", type: i1$5.BsDropdownToggleDirective, selector: "[bsDropdownToggle],[dropdownToggle]", exportAs: ["bs-dropdown-toggle"] }, { kind: "directive", type: i1$5.BsDropdownDirective, selector: "[bsDropdown], [dropdown]", inputs: ["placement", "triggers", "container", "dropup", "autoClose", "isAnimated", "insideClick", "isDisabled", "isOpen"], outputs: ["isOpenChange", "onShown", "onHidden"], exportAs: ["bs-dropdown"] }, { kind: "component", type: EmptyStateComponent, selector: "c8y-ui-empty-state", inputs: ["icon", "title", "subtitle", "horizontal"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ForOfDirective, selector: "[c8yFor]", inputs: ["c8yForOf", "c8yForLoadMore", "c8yForPipe", "c8yForNotFound", "c8yForMaxIterations", "c8yForLoadingTemplate", "c8yForLoadNextLabel", "c8yForRealtime", "c8yForRealtimeOptions", "c8yForComparator", "c8yForEnableVirtualScroll", "c8yForVirtualScrollElementSize", "c8yForVirtualScrollStrategy", "c8yForVirtualScrollContainerHeight"], outputs: ["c8yForCount"] }, { kind: "component", type: LoadingComponent, selector: "c8y-loading" }, { kind: "component", type: TypeaheadComponent, selector: "c8y-typeahead", inputs: ["required", "maxlength", "disabled", "allowFreeEntries", "placeholder", "displayProperty", "icon", "name", "autoClose", "hideNew", "container", "selected"], outputs: ["onSearch", "onIconClick"] }, { kind: "component", type: ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "emptyActions", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "component", type: ListItemIconComponent, selector: "c8y-list-item-icon, c8y-li-icon", inputs: ["icon", "status"] }, { kind: "component", type: DeviceStatusComponent, selector: "device-status", inputs: ["mo"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: ShouldShowMoPipe, name: "shouldShowMo" }, { kind: "pipe", type: GetGroupIconPipe, name: "getGroupIcon" }] });
|
|
17091
|
+
SearchInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: SearchInputComponent, selector: "c8y-search-input", inputs: { mode: "mode", enableCustomTemplatePlaceholder: "enableCustomTemplatePlaceholder", customPlaceholder: "customPlaceholder", externalTerm: "externalTerm", customDataQuery: "customDataQuery", container: "container", groupsOnly: "groupsOnly" }, outputs: { filter: "filter", search: "search", reset: "reset", onClick: "onClick" }, host: { listeners: { "document:keydown": "onKeydownHandler($event)" } }, viewQueries: [{ propertyName: "typeahead", first: true, predicate: TypeaheadComponent, descendants: true }, { propertyName: "dropdown", first: true, predicate: ["searchDropdown"], descendants: true }], ngImport: i0, template: "<div\n class=\"dropdown\"\n #searchDropdown=\"bs-dropdown\"\n [insideClick]=\"true\"\n (isOpenChange)=\"onOpenChange($event)\"\n [cdkTrapFocus]=\"searchDropdown.isOpen\"\n *ngIf=\"mode === 'search'\"\n dropdown\n>\n <button\n class=\"main-header-button dropdown-toggle c8y-dropdown\"\n type=\"button\"\n [title]=\"'Search' | translate\"\n type=\"button\"\n dropdownToggle\n data-cy=\"search-input--search-btn\"\n >\n <i\n class=\"icon-2x\"\n c8yIcon=\"search\"\n ></i>\n </button>\n\n <div\n class=\"search-header-menu dropdown-menu dropdown-menu-right\"\n id=\"searchDropdown\"\n *dropdownMenu\n >\n <ng-container *ngTemplateOutlet=\"form\"></ng-container>\n </div>\n</div>\n\n<div \n class=\"search-header-inline\" \n *ngIf=\"mode === 'select'\"\n>\n <ng-container *ngTemplateOutlet=\"form\"></ng-container>\n</div>\n<ng-template #form>\n <form \n [ngClass]=\"{ 'c8y-search-form': mode === 'search' }\" \n novalidate \n #searchForm=\"ngForm\"\n >\n <c8y-typeahead\n [(ngModel)]=\"selected\"\n placeholder=\"{{ customPlaceholder ? customPlaceholder : defaultPlaceholder }}\"\n (keydown)=\"keyDown($event)\"\n (onIconClick)=\"onReset($event)\"\n [icon]=\"term ? 'times' : 'search'\"\n [allowFreeEntries]=\"false\"\n [container]=\"container\"\n name=\"selected\"\n title=\"Search\"\n >\n <div\n class=\"c8y-list__item p-l-24 p-r-24 p-b-8 separator-bottom sticky-top p-t-4\"\n *ngIf=\"enableCustomTemplatePlaceholder && mode === 'search'\"\n >\n <ng-content></ng-content>\n </div>\n\n <!-- filter buttons -->\n <c8y-li *ngIf=\"term.length !== 0 && mode === 'search'\">\n <div class=\"d-flex\">\n <p class=\"m-r-4 text-muted\">\n <em translate>Searching by exact match. Click for other search options:</em>\n </p>\n <div class=\"btn-group btn-group-sm\">\n <button\n class=\"btn btn-default\"\n type=\"button\"\n title=\"{{ 'Starts with' | translate }}\"\n data-cy=\"search-input--search-starts-with\"\n (click)=\"onFilter(term + '*')\"\n >\n {{ 'Starts with' | translate }}\n </button>\n <button\n class=\"btn btn-default\"\n type=\"button\"\n title=\"{{ 'Contains' | translate }}\"\n data-cy=\"search-input--search-contains\"\n (click)=\"onFilter('*' + term + '*')\"\n >\n {{ 'Contains' | translate }}\n </button>\n <button\n class=\"btn btn-default\"\n type=\"button\"\n title=\"{{ 'Ends with' | translate }}\"\n data-cy=\"search-input--search-ends-with\"\n (click)=\"onFilter('*' + term)\"\n >\n {{ 'Ends with' | translate }}\n </button>\n </div>\n </div>\n </c8y-li>\n\n <!-- Recent search -->\n <c8y-li\n class=\"p-l-24 p-r-24\"\n *ngIf=\"term.length === 0 && recentSearchResults.length > 0\"\n [selectable]=\"false\"\n >\n <div class=\"legend form-block\">\n <span translate>Recent search views</span>\n </div>\n </c8y-li>\n <c8y-li\n class=\"c8y-list__item--link m-l-16 m-r-16\"\n *ngFor=\"let result of term.length === 0 ? recentSearchResults : []\"\n (click)=\"open($event, result, result.name)\"\n >\n <c8y-li-icon>\n <ng-container *ngIf=\"result | shouldShowMo: deviceType.DEVICE; else group\">\n <device-status [mo]=\"result\"></device-status>\n </ng-container>\n <ng-template #group>\n <i \n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"result | getGroupIcon | async\"\n >\n </i>\n </ng-template>\n </c8y-li-icon>\n {{ result.name || '--' }}\n </c8y-li>\n\n <!-- Recently registered devices -->\n <c8y-li\n *ngIf=\"\n term.length === 0 && (recentlyRegisteredResults$ | async)?.data?.length > 0 && !groupsOnly\n \"\n class=\"p-l-24 p-r-24\"\n [selectable]=\"false\"\n >\n <div class=\"legend form-block\">\n <span translate>Recently registered devices</span>\n </div>\n </c8y-li>\n <c8y-li\n *c8yFor=\"\n let result of term.length === 0 && !groupsOnly\n ? recentlyRegisteredResults$\n : { data: [] };\n loadMore: 'none'\n \"\n class=\"c8y-list__item--link m-l-16 m-r-16\"\n (click)=\"open($event, result, result.name)\"\n >\n <c8y-li-icon>\n <ng-container *ngIf=\"result | shouldShowMo: deviceType.DEVICE; else group\">\n <device-status [mo]=\"result\"></device-status>\n </ng-container>\n <ng-template #group>\n <i \n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"result | getGroupIcon | async\" \n >\n </i>\n </ng-template>\n </c8y-li-icon>\n {{ result.name || '--' }}\n </c8y-li>\n\n <!-- Search results -->\n <c8y-li *ngIf=\"term.length !== 0\" class=\"p-l-24 p-r-24\" [selectable]=\"false\">\n <div class=\"legend form-block m-0\">\n <span translate>Search results</span>\n </div>\n </c8y-li>\n <c8y-li\n *c8yFor=\"\n let result of results$;\n loadMore: 'auto';\n notFound: notFoundTemplate;\n loadingTemplate: loading;\n loadNextLabel: 'Find more\u2026'\n \"\n class=\"c8y-list__item--link m-l-16 m-r-16\"\n (click)=\"open($event, result, result.name)\"\n [title]=\"result.name\"\n data-cy=\"search-input--search-results\"\n >\n <c8y-li-icon>\n <ng-container *ngIf=\"result | shouldShowMo: deviceType.DEVICE; else group\">\n <device-status [mo]=\"result\"></device-status>\n </ng-container>\n <ng-template #group>\n <i \n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"result | getGroupIcon | async\"\n >\n </i>\n </ng-template>\n </c8y-li-icon>\n {{ result.name || '--' }}\n </c8y-li>\n\n <!-- No search results found entry -->\n <ng-template #notFoundTemplate>\n <c8y-ui-empty-state \n data-cy=\"search-input--empty-state\" \n [ngClass]=\"{ 'p-4': mode === 'search' }\"\n [icon]=\"'search'\"\n [title]=\"'No match found.' | translate\"\n [horizontal]=\"true\"\n *ngIf=\"noMatch\"\n >\n <small translate *ngIf=\"mode === 'search'\">\n Try to filter or open the asset grid to show all devices and groups.\n </small>\n <small translate *ngIf=\"mode === 'select'\">Try to rephrase your search word.</small>\n </c8y-ui-empty-state>\n </ng-template>\n\n <!-- loading bar first entries -->\n <c8y-li *ngIf=\"isLoading\">\n <c8y-loading></c8y-loading>\n </c8y-li>\n\n <!-- loading bar for loading more entries (inventory roles) -->\n <ng-template #loading>\n <c8y-li>\n <c8y-loading></c8y-loading>\n </c8y-li>\n </ng-template>\n\n <!-- more filter possibilities -->\n <c8y-li\n class=\"m-t-24 bg-level-2 p-t-16 p-b-16 p-l-24 p-r-24 sticky-bottom\"\n [selectable]=\"false\"\n *ngIf=\"mode === 'search'\"\n >\n <div class=\"d-flex a-i-center\">\n <i c8yIcon=\"info-circle\" class=\"text-info m-r-4\"></i>\n <p translate class=\"m-r-8\">Need more filter possibilities?</p>\n <button\n class=\"m-l-16 btn btn-default btn-sm\"\n title=\"{{ 'Go to the asset data table' | translate }}\"\n (mousedown)=\"onOpenAssetTable()\"\n data-cy=\"search-input--asset-table-btn\"\n type=\"button\"\n (mousedown)=\"onOpenAssetTable()\"\n >\n {{ 'Go to the asset data table' | translate }}\n </button>\n </div>\n </c8y-li>\n </c8y-typeahead>\n </form>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i6$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: i5.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$5.BsDropdownMenuDirective, selector: "[bsDropdownMenu],[dropdownMenu]", exportAs: ["bs-dropdown-menu"] }, { kind: "directive", type: i1$5.BsDropdownToggleDirective, selector: "[bsDropdownToggle],[dropdownToggle]", exportAs: ["bs-dropdown-toggle"] }, { kind: "directive", type: i1$5.BsDropdownDirective, selector: "[bsDropdown], [dropdown]", inputs: ["placement", "triggers", "container", "dropup", "autoClose", "isAnimated", "insideClick", "isDisabled", "isOpen"], outputs: ["isOpenChange", "onShown", "onHidden"], exportAs: ["bs-dropdown"] }, { kind: "component", type: EmptyStateComponent, selector: "c8y-ui-empty-state", inputs: ["icon", "title", "subtitle", "horizontal"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ForOfDirective, selector: "[c8yFor]", inputs: ["c8yForOf", "c8yForLoadMore", "c8yForPipe", "c8yForNotFound", "c8yForMaxIterations", "c8yForLoadingTemplate", "c8yForLoadNextLabel", "c8yForRealtime", "c8yForRealtimeOptions", "c8yForComparator", "c8yForEnableVirtualScroll", "c8yForVirtualScrollElementSize", "c8yForVirtualScrollStrategy", "c8yForVirtualScrollContainerHeight"], outputs: ["c8yForCount"] }, { kind: "component", type: LoadingComponent, selector: "c8y-loading" }, { kind: "component", type: TypeaheadComponent, selector: "c8y-typeahead", inputs: ["required", "maxlength", "disabled", "allowFreeEntries", "placeholder", "displayProperty", "icon", "name", "autoClose", "hideNew", "container", "selected"], outputs: ["onSearch", "onIconClick"] }, { kind: "component", type: ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "emptyActions", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "component", type: ListItemIconComponent, selector: "c8y-list-item-icon, c8y-li-icon", inputs: ["icon", "status"] }, { kind: "component", type: DeviceStatusComponent, selector: "device-status", inputs: ["mo"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: ShouldShowMoPipe, name: "shouldShowMo" }, { kind: "pipe", type: GetGroupIconPipe, name: "getGroupIcon" }] });
|
|
17111
17092
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: SearchInputComponent, decorators: [{
|
|
17112
17093
|
type: Component,
|
|
17113
|
-
args: [{ selector: 'c8y-search-input', template: "<div\n class=\"dropdown\"\n #searchDropdown=\"bs-dropdown\"\n [insideClick]=\"true\"\n (isOpenChange)=\"onOpenChange($event)\"\n [cdkTrapFocus]=\"searchDropdown.isOpen\"\n *ngIf=\"mode === 'search'\"\n dropdown\n>\n <button\n class=\"main-header-button dropdown-toggle c8y-dropdown\"\n type=\"button\"\n [title]=\"'Search' | translate\"\n dropdownToggle\n data-cy=\"search-input--search-btn\"\n >\n <i
|
|
17094
|
+
args: [{ selector: 'c8y-search-input', template: "<div\n class=\"dropdown\"\n #searchDropdown=\"bs-dropdown\"\n [insideClick]=\"true\"\n (isOpenChange)=\"onOpenChange($event)\"\n [cdkTrapFocus]=\"searchDropdown.isOpen\"\n *ngIf=\"mode === 'search'\"\n dropdown\n>\n <button\n class=\"main-header-button dropdown-toggle c8y-dropdown\"\n type=\"button\"\n [title]=\"'Search' | translate\"\n type=\"button\"\n dropdownToggle\n data-cy=\"search-input--search-btn\"\n >\n <i\n class=\"icon-2x\"\n c8yIcon=\"search\"\n ></i>\n </button>\n\n <div\n class=\"search-header-menu dropdown-menu dropdown-menu-right\"\n id=\"searchDropdown\"\n *dropdownMenu\n >\n <ng-container *ngTemplateOutlet=\"form\"></ng-container>\n </div>\n</div>\n\n<div \n class=\"search-header-inline\" \n *ngIf=\"mode === 'select'\"\n>\n <ng-container *ngTemplateOutlet=\"form\"></ng-container>\n</div>\n<ng-template #form>\n <form \n [ngClass]=\"{ 'c8y-search-form': mode === 'search' }\" \n novalidate \n #searchForm=\"ngForm\"\n >\n <c8y-typeahead\n [(ngModel)]=\"selected\"\n placeholder=\"{{ customPlaceholder ? customPlaceholder : defaultPlaceholder }}\"\n (keydown)=\"keyDown($event)\"\n (onIconClick)=\"onReset($event)\"\n [icon]=\"term ? 'times' : 'search'\"\n [allowFreeEntries]=\"false\"\n [container]=\"container\"\n name=\"selected\"\n title=\"Search\"\n >\n <div\n class=\"c8y-list__item p-l-24 p-r-24 p-b-8 separator-bottom sticky-top p-t-4\"\n *ngIf=\"enableCustomTemplatePlaceholder && mode === 'search'\"\n >\n <ng-content></ng-content>\n </div>\n\n <!-- filter buttons -->\n <c8y-li *ngIf=\"term.length !== 0 && mode === 'search'\">\n <div class=\"d-flex\">\n <p class=\"m-r-4 text-muted\">\n <em translate>Searching by exact match. Click for other search options:</em>\n </p>\n <div class=\"btn-group btn-group-sm\">\n <button\n class=\"btn btn-default\"\n type=\"button\"\n title=\"{{ 'Starts with' | translate }}\"\n data-cy=\"search-input--search-starts-with\"\n (click)=\"onFilter(term + '*')\"\n >\n {{ 'Starts with' | translate }}\n </button>\n <button\n class=\"btn btn-default\"\n type=\"button\"\n title=\"{{ 'Contains' | translate }}\"\n data-cy=\"search-input--search-contains\"\n (click)=\"onFilter('*' + term + '*')\"\n >\n {{ 'Contains' | translate }}\n </button>\n <button\n class=\"btn btn-default\"\n type=\"button\"\n title=\"{{ 'Ends with' | translate }}\"\n data-cy=\"search-input--search-ends-with\"\n (click)=\"onFilter('*' + term)\"\n >\n {{ 'Ends with' | translate }}\n </button>\n </div>\n </div>\n </c8y-li>\n\n <!-- Recent search -->\n <c8y-li\n class=\"p-l-24 p-r-24\"\n *ngIf=\"term.length === 0 && recentSearchResults.length > 0\"\n [selectable]=\"false\"\n >\n <div class=\"legend form-block\">\n <span translate>Recent search views</span>\n </div>\n </c8y-li>\n <c8y-li\n class=\"c8y-list__item--link m-l-16 m-r-16\"\n *ngFor=\"let result of term.length === 0 ? recentSearchResults : []\"\n (click)=\"open($event, result, result.name)\"\n >\n <c8y-li-icon>\n <ng-container *ngIf=\"result | shouldShowMo: deviceType.DEVICE; else group\">\n <device-status [mo]=\"result\"></device-status>\n </ng-container>\n <ng-template #group>\n <i \n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"result | getGroupIcon | async\"\n >\n </i>\n </ng-template>\n </c8y-li-icon>\n {{ result.name || '--' }}\n </c8y-li>\n\n <!-- Recently registered devices -->\n <c8y-li\n *ngIf=\"\n term.length === 0 && (recentlyRegisteredResults$ | async)?.data?.length > 0 && !groupsOnly\n \"\n class=\"p-l-24 p-r-24\"\n [selectable]=\"false\"\n >\n <div class=\"legend form-block\">\n <span translate>Recently registered devices</span>\n </div>\n </c8y-li>\n <c8y-li\n *c8yFor=\"\n let result of term.length === 0 && !groupsOnly\n ? recentlyRegisteredResults$\n : { data: [] };\n loadMore: 'none'\n \"\n class=\"c8y-list__item--link m-l-16 m-r-16\"\n (click)=\"open($event, result, result.name)\"\n >\n <c8y-li-icon>\n <ng-container *ngIf=\"result | shouldShowMo: deviceType.DEVICE; else group\">\n <device-status [mo]=\"result\"></device-status>\n </ng-container>\n <ng-template #group>\n <i \n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"result | getGroupIcon | async\" \n >\n </i>\n </ng-template>\n </c8y-li-icon>\n {{ result.name || '--' }}\n </c8y-li>\n\n <!-- Search results -->\n <c8y-li *ngIf=\"term.length !== 0\" class=\"p-l-24 p-r-24\" [selectable]=\"false\">\n <div class=\"legend form-block m-0\">\n <span translate>Search results</span>\n </div>\n </c8y-li>\n <c8y-li\n *c8yFor=\"\n let result of results$;\n loadMore: 'auto';\n notFound: notFoundTemplate;\n loadingTemplate: loading;\n loadNextLabel: 'Find more\u2026'\n \"\n class=\"c8y-list__item--link m-l-16 m-r-16\"\n (click)=\"open($event, result, result.name)\"\n [title]=\"result.name\"\n data-cy=\"search-input--search-results\"\n >\n <c8y-li-icon>\n <ng-container *ngIf=\"result | shouldShowMo: deviceType.DEVICE; else group\">\n <device-status [mo]=\"result\"></device-status>\n </ng-container>\n <ng-template #group>\n <i \n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"result | getGroupIcon | async\"\n >\n </i>\n </ng-template>\n </c8y-li-icon>\n {{ result.name || '--' }}\n </c8y-li>\n\n <!-- No search results found entry -->\n <ng-template #notFoundTemplate>\n <c8y-ui-empty-state \n data-cy=\"search-input--empty-state\" \n [ngClass]=\"{ 'p-4': mode === 'search' }\"\n [icon]=\"'search'\"\n [title]=\"'No match found.' | translate\"\n [horizontal]=\"true\"\n *ngIf=\"noMatch\"\n >\n <small translate *ngIf=\"mode === 'search'\">\n Try to filter or open the asset grid to show all devices and groups.\n </small>\n <small translate *ngIf=\"mode === 'select'\">Try to rephrase your search word.</small>\n </c8y-ui-empty-state>\n </ng-template>\n\n <!-- loading bar first entries -->\n <c8y-li *ngIf=\"isLoading\">\n <c8y-loading></c8y-loading>\n </c8y-li>\n\n <!-- loading bar for loading more entries (inventory roles) -->\n <ng-template #loading>\n <c8y-li>\n <c8y-loading></c8y-loading>\n </c8y-li>\n </ng-template>\n\n <!-- more filter possibilities -->\n <c8y-li\n class=\"m-t-24 bg-level-2 p-t-16 p-b-16 p-l-24 p-r-24 sticky-bottom\"\n [selectable]=\"false\"\n *ngIf=\"mode === 'search'\"\n >\n <div class=\"d-flex a-i-center\">\n <i c8yIcon=\"info-circle\" class=\"text-info m-r-4\"></i>\n <p translate class=\"m-r-8\">Need more filter possibilities?</p>\n <button\n class=\"m-l-16 btn btn-default btn-sm\"\n title=\"{{ 'Go to the asset data table' | translate }}\"\n (mousedown)=\"onOpenAssetTable()\"\n data-cy=\"search-input--asset-table-btn\"\n type=\"button\"\n (mousedown)=\"onOpenAssetTable()\"\n >\n {{ 'Go to the asset data table' | translate }}\n </button>\n </div>\n </c8y-li>\n </c8y-typeahead>\n </form>\n</ng-template>\n" }]
|
|
17114
17095
|
}], ctorParameters: function () { return [{ type: i1$6.Router }, { type: i1$1.InventoryService }, { type: InventorySearchService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { mode: [{
|
|
17115
17096
|
type: Input
|
|
17116
17097
|
}], enableCustomTemplatePlaceholder: [{
|