@piserve-tech/drop-down 1.2.110 → 1.2.112
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/README.md +39 -39
- package/esm2022/lib/dropdown.component.mjs +212 -0
- package/esm2022/lib/dropdown.model.mjs +2 -0
- package/esm2022/lib/dropdown.module.mjs +28 -0
- package/esm2022/lib/dropdown.service.mjs +14 -0
- package/esm2022/piserve-tech-drop-down.mjs +5 -0
- package/esm2022/public-api.mjs +7 -0
- package/fesm2022/piserve-tech-drop-down.mjs +260 -0
- package/fesm2022/piserve-tech-drop-down.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/dropdown.component.d.ts +56 -0
- package/{src/lib/dropdown.model.ts → lib/dropdown.model.d.ts} +6 -7
- package/lib/dropdown.module.d.ts +9 -0
- package/lib/dropdown.service.d.ts +6 -0
- package/package.json +29 -16
- package/{src/public-api.ts → public-api.d.ts} +3 -7
- package/assets/images/down_arrow.svg +0 -7
- package/assets/images/edit.svg +0 -8
- package/assets/images/view.svg +0 -8
- package/ng-package.json +0 -7
- package/src/lib/dropdown.component.html +0 -236
- package/src/lib/dropdown.component.scss +0 -374
- package/src/lib/dropdown.component.spec.ts +0 -21
- package/src/lib/dropdown.component.ts +0 -226
- package/src/lib/dropdown.module.ts +0 -20
- package/src/lib/dropdown.service.spec.ts +0 -16
- package/src/lib/dropdown.service.ts +0 -9
- package/tsconfig.lib.json +0 -14
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, ViewChild, HostListener, NgModule } from '@angular/core';
|
|
3
|
+
import { v4 } from 'uuid';
|
|
4
|
+
import * as i1 from '@angular/forms';
|
|
5
|
+
import { FormsModule } from '@angular/forms';
|
|
6
|
+
import * as i2 from '@angular/common';
|
|
7
|
+
import { CommonModule } from '@angular/common';
|
|
8
|
+
|
|
9
|
+
class DropdownService {
|
|
10
|
+
constructor() { }
|
|
11
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropdownService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
12
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropdownService, providedIn: 'root' }); }
|
|
13
|
+
}
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropdownService, decorators: [{
|
|
15
|
+
type: Injectable,
|
|
16
|
+
args: [{
|
|
17
|
+
providedIn: 'root'
|
|
18
|
+
}]
|
|
19
|
+
}], ctorParameters: function () { return []; } });
|
|
20
|
+
|
|
21
|
+
class DropdownComponent {
|
|
22
|
+
set items(value) {
|
|
23
|
+
this._items = value || [];
|
|
24
|
+
this.originalItems = this._items.slice();
|
|
25
|
+
this._filteredItems = this._items.slice(); // use a separate variable for rendering
|
|
26
|
+
this.cdr.markForCheck();
|
|
27
|
+
}
|
|
28
|
+
get items() {
|
|
29
|
+
return this._items;
|
|
30
|
+
}
|
|
31
|
+
constructor(cdr) {
|
|
32
|
+
this.cdr = cdr;
|
|
33
|
+
this.selectedItems = [];
|
|
34
|
+
this.placeholder = "";
|
|
35
|
+
this.selectedValues = "";
|
|
36
|
+
this.customButtons = [];
|
|
37
|
+
this.showBorder = true;
|
|
38
|
+
this.disable = false;
|
|
39
|
+
this.buttonClick = new EventEmitter();
|
|
40
|
+
this.selectedItemsChange = new EventEmitter();
|
|
41
|
+
this.onDropdownScroll = new EventEmitter();
|
|
42
|
+
this.onCreateNew = new EventEmitter();
|
|
43
|
+
this.onSearch = new EventEmitter();
|
|
44
|
+
//subLabel
|
|
45
|
+
this.showSubLabel = false;
|
|
46
|
+
this.dropdownId = v4();
|
|
47
|
+
this.dropdownOpened = false;
|
|
48
|
+
this.selectedItemName = "";
|
|
49
|
+
this.selectedItemImage = "";
|
|
50
|
+
this.originalItems = [];
|
|
51
|
+
this.searchTerm = "";
|
|
52
|
+
this.initialized = false;
|
|
53
|
+
this.searchText = "";
|
|
54
|
+
this._filteredItems = [];
|
|
55
|
+
this._items = [];
|
|
56
|
+
}
|
|
57
|
+
ngOnInit() { }
|
|
58
|
+
ngOnChanges(changes) {
|
|
59
|
+
if (changes["selectedItems"]) {
|
|
60
|
+
const item = changes["selectedItems"]["currentValue"];
|
|
61
|
+
this.selectedItems = item;
|
|
62
|
+
this.selectedItemName = this.selectedItems[0]?.label;
|
|
63
|
+
this.selectedItemImage = this.selectedItems[0]?.image;
|
|
64
|
+
}
|
|
65
|
+
if (changes["items"]) {
|
|
66
|
+
this.initialize();
|
|
67
|
+
this.originalItems = this.items.slice();
|
|
68
|
+
this.cdr.markForCheck();
|
|
69
|
+
}
|
|
70
|
+
if (changes["selectedValues"]) {
|
|
71
|
+
this.selectedItemName = this.selectedValues;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
initialize() {
|
|
75
|
+
setTimeout(() => {
|
|
76
|
+
if (this.selectedItems && this.selectedItems.length > 0) {
|
|
77
|
+
if (!this.multiple) {
|
|
78
|
+
this.searchText = "";
|
|
79
|
+
this.selectedItemName = this.selectedItems[0]?.label;
|
|
80
|
+
this.selectedItemImage = this.selectedItems[0]?.image;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, 1000);
|
|
84
|
+
const uniqueItems = this.items.filter((selected, index, self) => index === self.findIndex((t) => t.value === selected.value));
|
|
85
|
+
this.items = uniqueItems;
|
|
86
|
+
}
|
|
87
|
+
openDropdown() {
|
|
88
|
+
this.dropdownOpened = !this.dropdownOpened;
|
|
89
|
+
const inputId = `searchInput-${this.dropdownId}`;
|
|
90
|
+
const inputEl = document.getElementById(inputId);
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
inputEl?.focus();
|
|
93
|
+
}, 0);
|
|
94
|
+
}
|
|
95
|
+
dropdownScroll(event) {
|
|
96
|
+
if (this.onDropdownScroll.observed) {
|
|
97
|
+
this.onDropdownScroll.emit(event);
|
|
98
|
+
this.cdr.markForCheck();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
selectItem(item) {
|
|
102
|
+
if (this.multiple) {
|
|
103
|
+
if (!this.selectedItems.includes(item)) {
|
|
104
|
+
this.selectedItems.push(item);
|
|
105
|
+
this.selectedItemsChange.emit(this.selectedItems);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
this.selectedItems = this.selectedItems.filter((selected) => selected !== item);
|
|
109
|
+
this.selectedItemsChange.emit(this.selectedItems);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this.searchText = "";
|
|
114
|
+
this.selectedItems[0] = item;
|
|
115
|
+
this.selectedItemName = this.selectedItems[0]?.label;
|
|
116
|
+
this.selectedItemImage = this.selectedItems[0]?.image;
|
|
117
|
+
this.dropdownOpened = false;
|
|
118
|
+
this.selectedItemsChange.emit(this.selectedItems);
|
|
119
|
+
}
|
|
120
|
+
this._filteredItems = this.originalItems.slice();
|
|
121
|
+
}
|
|
122
|
+
unselectItem(item) {
|
|
123
|
+
this.selectedItems = this.selectedItems.filter((selected) => selected !== item);
|
|
124
|
+
this.selectedItemsChange.emit(this.selectedItems);
|
|
125
|
+
}
|
|
126
|
+
unselectAll() {
|
|
127
|
+
this.selectedItems = [];
|
|
128
|
+
this.selectedItemName = "";
|
|
129
|
+
this.selectedItemImage = "";
|
|
130
|
+
this.selectedItemsChange.emit(this.selectedItems);
|
|
131
|
+
this.cdr.markForCheck();
|
|
132
|
+
}
|
|
133
|
+
onDocumentClick(event) {
|
|
134
|
+
const isClickInsideDropdown = this.dropdown.nativeElement.contains(event.target);
|
|
135
|
+
if (!isClickInsideDropdown) {
|
|
136
|
+
this.dropdownOpened = false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
createNew() {
|
|
140
|
+
this.onCreateNew.emit();
|
|
141
|
+
this.dropdownOpened = false;
|
|
142
|
+
}
|
|
143
|
+
search(event) {
|
|
144
|
+
const keyCode = event.keyCode;
|
|
145
|
+
this.dropdownOpened = true;
|
|
146
|
+
this.searchTerm = event.target.value.toLowerCase();
|
|
147
|
+
if (!this.onSearch.observed) {
|
|
148
|
+
if (this.searchTerm.trim() === "") {
|
|
149
|
+
if (!this.multiple) {
|
|
150
|
+
this.unselectAll();
|
|
151
|
+
}
|
|
152
|
+
this._filteredItems = this.originalItems.slice();
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
const lowerCaseSearchTerm = this.searchTerm.toLowerCase();
|
|
156
|
+
this._filteredItems = this.originalItems.filter((item) => item.label.toLowerCase().includes(lowerCaseSearchTerm) ||
|
|
157
|
+
(item.value &&
|
|
158
|
+
item.value.toLowerCase().includes(lowerCaseSearchTerm)));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
this.onSearch.emit(this.searchTerm);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
handleButtonClick(action) {
|
|
166
|
+
action();
|
|
167
|
+
this.buttonClick.emit();
|
|
168
|
+
}
|
|
169
|
+
highlightMatch(text) {
|
|
170
|
+
const search = this.searchText?.trim() || this.searchTerm?.trim();
|
|
171
|
+
if (!search || !text)
|
|
172
|
+
return text;
|
|
173
|
+
const index = text.toLowerCase().indexOf(search.toLowerCase());
|
|
174
|
+
if (index === -1)
|
|
175
|
+
return text;
|
|
176
|
+
const before = text.substring(0, index);
|
|
177
|
+
const match = text.substring(index, index + search.length);
|
|
178
|
+
const after = text.substring(index + search.length);
|
|
179
|
+
return `${before}<span class="highlight-text">${match}</span>${after}`;
|
|
180
|
+
}
|
|
181
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropdownComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
182
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DropdownComponent, selector: "lib-dropdown", inputs: { multiple: "multiple", selectedItems: "selectedItems", placeholder: "placeholder", showCreateNew: "showCreateNew", selectedValues: "selectedValues", customButtons: "customButtons", showBorder: "showBorder", disable: "disable", showSubLabel: "showSubLabel", items: "items" }, outputs: { buttonClick: "buttonClick", selectedItemsChange: "selectedItemsChange", onDropdownScroll: "onDropdownScroll", onCreateNew: "onCreateNew", onSearch: "onSearch" }, host: { listeners: { "document:click": "onDocumentClick($event)" } }, viewQueries: [{ propertyName: "dropdownitems", first: true, predicate: ["dropdownItems"], descendants: true }, { propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\n #dropdown\n class=\"dropdown\"\n [ngClass]=\"{\n opened: showBorder && dropdownOpened,\n closed: showBorder && !dropdownOpened,\n 'dropdown-disabled': disable\n }\"\n>\n <div\n class=\"dropdown-field\"\n id=\"division\"\n [ngClass]=\"{\n opened: showBorder && dropdownOpened,\n closed: showBorder && !dropdownOpened,\n }\"\n (click)=\"openDropdown()\"\n >\n <!-- <div *ngIf=\"selectedValues !== '' && !selectedItemName\" class=\"selected\">\n {{ selectedValues }}\n </div> -->\n <div class=\"flexSection\">\n <div class=\"dataSection\" *ngIf=\"!selectedItem && multiple\">\n <div class=\"selected selectedList\">\n <ng-container *ngFor=\"let selectedItem of selectedItems\">\n <div class=\"selected-item\">\n <img\n *ngIf=\"selectedItem?.image\"\n class=\"multiSelected-icon-size\"\n [src]=\"selectedItem?.image\"\n alt=\"image\"\n />\n <span>{{ selectedItem.label }}</span>\n <span (click)=\"unselectItem(selectedItem)\" class=\"close-icon\"\n >×</span\n >\n </div>\n </ng-container>\n\n <div class=\"input-field\">\n <input\n [id]=\"'searchInput-' + dropdownId\"\n class=\"dropdown_text inline-input\"\n [(ngModel)]=\"searchText\"\n [placeholder]=\"placeholder\"\n (input)=\"search($event)\"\n />\n </div>\n </div>\n </div>\n <div class=\"dataSection single-input\" *ngIf=\"!multiple\">\n <div class=\"input-field\">\n <div class=\"input-with-icon\">\n <img\n *ngIf=\"selectedItemImage\"\n class=\"selected-icon-size\"\n [src]=\"selectedItemImage\"\n alt=\"image\"\n />\n <input\n [id]=\"'searchInput-' + dropdownId\"\n class=\"dropdown_text inline-input\"\n [placeholder]=\"placeholder\"\n [(ngModel)]=\"selectedItemName\"\n (input)=\"search($event)\"\n [readonly] = \"selectedItems.length > 0\"\n />\n </div>\n </div>\n </div>\n <div class=\"iconSection\">\n <div class=\"dropdown-icons-container\">\n <div>\n <span\n (click)=\"unselectAll()\"\n *ngIf=\"selectedItems.length > 0\"\n class=\"deselect\"\n >×\n </span>\n </div>\n <div\n class=\"dropdown-down-arrow\"\n [ngClass]=\"{ opened: dropdownOpened, closed: !dropdownOpened }\"\n >\n <svg\n width=\"1em\"\n viewBox=\"0 0 24 25\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"down-arrow-img\"\n >\n <g id=\"Down Arrow\">\n <g id=\"Group\">\n <path\n id=\"Path\"\n d=\"M6 9.13741L12 15.229L18 9.13741\"\n stroke=\"#8E9AA0\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </g>\n </g>\n </svg>\n </div>\n <div\n class=\"dropdown-up-arrow\"\n [ngClass]=\"{ opened: dropdownOpened, closed: !dropdownOpened }\"\n >\n <svg\n width=\"1em\"\n viewBox=\"0 0 24 25\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"up-arrow-img\"\n >\n <path\n d=\"M18 15.229L12 9.1374L6 15.229\"\n stroke=\"#8E9AA0\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div\n #dropdownItems\n class=\"dropdown-items\"\n *ngIf=\"dropdownOpened\"\n (scroll)=\"dropdownScroll($event)\"\n >\n <div (click)=\"createNew()\">\n <a class=\"create_button\" *ngIf=\"showCreateNew\">Create new</a>\n </div>\n <ng-container *ngIf=\"items.length > 0; else noDataAvailable\">\n <ng-container *ngIf=\"multiple; else singleSelection\">\n <a\n [ngClass]=\"{\n compact: !item?.image && !item?.subLabel,\n expanded: item?.image || item?.subLabel\n }\"\n class=\"items d-block\"\n *ngFor=\"let item of _filteredItems\"\n (click)=\"selectItem(item)\"\n >\n <div class=\"dropdown-item\">\n <div class=\"item-details\">\n <div class=\"content-wrapper\">\n <img\n *ngIf=\"item?.image\"\n [src]=\"item?.image\"\n alt=\"Item Image\"\n class=\"item-image icon-size\"\n />\n <div class=\"text-content\">\n <div\n class=\"item-label\"\n [innerHTML]=\"highlightMatch(item.label)\"\n ></div>\n <div *ngIf=\"showSubLabel\" class=\"item-sublabel\">\n {{ item?.subLabel }}\n </div>\n </div>\n </div>\n <div\n class=\"dropdown_buttons\"\n [class.empty]=\"customButtons.length === 0\"\n >\n <button\n *ngFor=\"let button of customButtons\"\n (click)=\"handleButtonClick(button.action)\"\n >\n <i [class]=\"button.icon\" [style.color]=\"button.color\"></i>\n </button>\n </div>\n </div>\n </div>\n </a>\n </ng-container>\n\n <ng-template #singleSelection>\n <a\n class=\"items d-block\"\n [ngClass]=\"{\n compact: !item?.image && !item?.subLabel,\n expanded: item?.image || item?.subLabel\n }\"\n *ngFor=\"let item of _filteredItems\"\n (click)=\"selectItem(item)\"\n >\n <div class=\"dropdown-item\">\n <div class=\"item-details\">\n <div class=\"content-wrapper\">\n <img\n *ngIf=\"item?.image\"\n [src]=\"item?.image\"\n alt=\"Item Image\"\n class=\"item-image icon-size\"\n />\n <div class=\"text-content\">\n <div\n class=\"item-label\"\n [innerHTML]=\"highlightMatch(item.label)\"\n ></div>\n <div *ngIf=\"showSubLabel\" class=\"item-sublabel\">\n {{ item?.subLabel }}\n </div>\n </div>\n </div>\n <div\n class=\"dropdown_buttons\"\n [class.empty]=\"customButtons.length === 0\"\n >\n <button\n *ngFor=\"let button of customButtons\"\n (click)=\"handleButtonClick(button.action)\"\n >\n <i [class]=\"button.icon\" [style.color]=\"button.color\"></i>\n </button>\n </div>\n </div>\n </div>\n </a>\n </ng-template>\n </ng-container>\n\n <!-- \"No data available\" message if the drop down is empty -->\n <ng-template #noDataAvailable>\n <div class=\"items\">No data available</div>\n </ng-template>\n </div>\n</div>\n", styles: [".dropdown{background:#fff;border-radius:6px}.dropdown .dropdown-field{background:#fff;border-radius:6px;position:relative;cursor:pointer}.dropdown .dropdown-field .selected.selectedList{display:flex;flex-wrap:wrap;max-height:80px;overflow-y:auto;overflow-x:hidden}.dropdown .dropdown-field .selected .selected-item{background:#e3e3da;display:inline;margin:5px;padding:2px;border-radius:5px;font-size:small}.dropdown .dropdown-field .selected .remaining-items{margin:5px;padding:2px;font-size:smaller;display:block}.dropdown .dropdown-field .input-field .dropdown_text{width:100%;border:none;padding:2px;margin-left:3px;margin-right:3px;outline:none;box-sizing:border-box;font-style:normal}@media (max-width: 576px){.dropdown .dropdown-field .input-field .dropdown_text{width:53%;margin-left:3px;padding-left:2px}}@media (max-width: 420px){.dropdown .dropdown-field .input-field .dropdown_text{width:53%;margin-left:3px;padding-left:2px}}@media only screen and (min-width: 576px){.dropdown .dropdown-field .input-field .dropdown_text{height:25px}}@media only screen and (min-width: 992px){.dropdown .dropdown-field .input-field .dropdown_text{height:30px}}@media only screen and (min-width: 1200px){.dropdown .dropdown-field .input-field .dropdown_text{height:35px}}.dropdown .dropdown-field.closed{border:1px solid #d8d8d8}.dropdown .dropdown-field.opened{border-bottom:1px solid #d8d8d8}.dropdown .dropdown-items{overflow-y:auto;overflow-x:auto;position:absolute!important;top:100%;left:0;width:100%;background:#fff;z-index:9999999;border:solid 1px #dbdbdb;box-shadow:0 4px 4px -5px #00000040;transition:transform .3s ease-out;scroll-behavior:smooth;cursor:pointer}@media only screen and (min-width: 276px){.dropdown .dropdown-items{max-height:150px;padding:3px}}@media only screen and (min-width: 576px){.dropdown .dropdown-items{max-height:150px;padding:3px}}@media only screen and (min-width: 992px){.dropdown .dropdown-items{max-height:150px;padding:5px}}@media only screen and (min-width: 1441px){.dropdown .dropdown-items{max-height:200px;padding:7px}}.dropdown .dropdown-items .create_button{text-decoration:none;cursor:pointer}@media only screen and (min-width: 576px){.dropdown .dropdown-items .create_button{padding-left:8px}}@media only screen and (min-width: 992px){.dropdown .dropdown-items .create_button{padding-left:8px}}@media only screen and (min-width: 1200px){.dropdown .dropdown-items .create_button{padding-left:8px}}.dropdown .dropdown-items .items{text-decoration:none;color:inherit;position:relative;cursor:pointer}@media only screen and (min-width: 576px){.dropdown .dropdown-items .items{padding-left:8px;font-size:small}}@media only screen and (min-width: 992px){.dropdown .dropdown-items .items{padding-left:8px}}@media only screen and (min-width: 1200px){.dropdown .dropdown-items .items{padding-left:8px;font-size:small}}.dropdown .dropdown-items .items:hover{background:#ebedef;border-radius:6px}.dropdown .dropdown-items .items:hover button{visibility:visible}.dropdown .dropdown-items .items .dropdown_buttons{display:inline}.dropdown .dropdown-items .items button{border:0;background:transparent;visibility:hidden}.dropdown.opened{border:1px #d8d8d8 solid}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background-color:transparent}::-webkit-scrollbar-thumb{background-color:#b2b2b2;border-radius:6px}.space{width:10px}.icon-size{width:30px;height:30px;margin-right:7px}.smallSpace{width:3px}.selected-icon-size{width:25px;height:20px;margin-left:10px}@media (max-width: 576px){.selected-icon-size{width:21px;height:15px;margin-right:7px;margin-bottom:1px}}.multiSelected-icon-size{width:25px;height:20px;margin-left:1px;margin-bottom:1px;margin-right:3px}.flexSection{display:flex;justify-content:space-between}.dropdown-down-arrow,.dropdown-up-arrow,.deselect{width:20px;height:20px;display:flex;align-items:center;justify-content:center;cursor:pointer}.dropdown-down-arrow{cursor:pointer}.dropdown-down-arrow.opened{display:none}.dropdown-down-arrow.closed{display:block}.dropdown-up-arrow{cursor:pointer}.dropdown-up-arrow.closed{display:none}.close-icon{margin-left:8px;margin-right:5px}.iconSection{display:flex;flex-direction:row-reverse;padding:1px;position:relative;justify-content:center;align-items:center}.dropdown-icons-container{display:flex;gap:10px}.item-details{display:flex;align-items:center;justify-content:space-between}.content-wrapper{display:flex;align-items:center;gap:8px;flex:1}.text-content{display:flex;flex-direction:column}.item-label{font-size:14px;font-weight:400;line-height:1.3}.item-sublabel{font-size:11px;color:#666;line-height:1.2}.dropdown_buttons{display:flex;gap:4px}.dropdown_buttons.empty:after{content:\"\";display:inline-block;width:4px;height:1px}.compact{line-height:32px}.expanded{line-height:41px}.input-field{width:100%}.input-with-icon{display:flex;align-items:center;gap:8px;width:100%}.selected-icon-size{width:20px;height:20px;flex-shrink:0}.dropdown_text.inline-input{flex:1;border:none;outline:none;padding:0;background:transparent;font-family:inherit;font-size:inherit;color:inherit}.single-input{width:80%;white-space:nowrap}.item-label{font-size:14px;line-height:1.4;color:#333}.highlight-text{font-weight:600;background-repeat:no-repeat;background-size:100% .3em;background-position:0 88%;padding:.1em .05em;border-radius:2px;color:#1a1a1a;transition:all .2s ease-in-out}.dropdown .dropdown-field .input-field .dropdown_text{background:#fff!important}.dropdown.dropdown-disabled .dropdown-field .input-field .dropdown_text,.dropdown.dropdown-disabled .dropdown-field{background:#e9ecef!important;pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
183
|
+
}
|
|
184
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropdownComponent, decorators: [{
|
|
185
|
+
type: Component,
|
|
186
|
+
args: [{ selector: "lib-dropdown", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n #dropdown\n class=\"dropdown\"\n [ngClass]=\"{\n opened: showBorder && dropdownOpened,\n closed: showBorder && !dropdownOpened,\n 'dropdown-disabled': disable\n }\"\n>\n <div\n class=\"dropdown-field\"\n id=\"division\"\n [ngClass]=\"{\n opened: showBorder && dropdownOpened,\n closed: showBorder && !dropdownOpened,\n }\"\n (click)=\"openDropdown()\"\n >\n <!-- <div *ngIf=\"selectedValues !== '' && !selectedItemName\" class=\"selected\">\n {{ selectedValues }}\n </div> -->\n <div class=\"flexSection\">\n <div class=\"dataSection\" *ngIf=\"!selectedItem && multiple\">\n <div class=\"selected selectedList\">\n <ng-container *ngFor=\"let selectedItem of selectedItems\">\n <div class=\"selected-item\">\n <img\n *ngIf=\"selectedItem?.image\"\n class=\"multiSelected-icon-size\"\n [src]=\"selectedItem?.image\"\n alt=\"image\"\n />\n <span>{{ selectedItem.label }}</span>\n <span (click)=\"unselectItem(selectedItem)\" class=\"close-icon\"\n >×</span\n >\n </div>\n </ng-container>\n\n <div class=\"input-field\">\n <input\n [id]=\"'searchInput-' + dropdownId\"\n class=\"dropdown_text inline-input\"\n [(ngModel)]=\"searchText\"\n [placeholder]=\"placeholder\"\n (input)=\"search($event)\"\n />\n </div>\n </div>\n </div>\n <div class=\"dataSection single-input\" *ngIf=\"!multiple\">\n <div class=\"input-field\">\n <div class=\"input-with-icon\">\n <img\n *ngIf=\"selectedItemImage\"\n class=\"selected-icon-size\"\n [src]=\"selectedItemImage\"\n alt=\"image\"\n />\n <input\n [id]=\"'searchInput-' + dropdownId\"\n class=\"dropdown_text inline-input\"\n [placeholder]=\"placeholder\"\n [(ngModel)]=\"selectedItemName\"\n (input)=\"search($event)\"\n [readonly] = \"selectedItems.length > 0\"\n />\n </div>\n </div>\n </div>\n <div class=\"iconSection\">\n <div class=\"dropdown-icons-container\">\n <div>\n <span\n (click)=\"unselectAll()\"\n *ngIf=\"selectedItems.length > 0\"\n class=\"deselect\"\n >×\n </span>\n </div>\n <div\n class=\"dropdown-down-arrow\"\n [ngClass]=\"{ opened: dropdownOpened, closed: !dropdownOpened }\"\n >\n <svg\n width=\"1em\"\n viewBox=\"0 0 24 25\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"down-arrow-img\"\n >\n <g id=\"Down Arrow\">\n <g id=\"Group\">\n <path\n id=\"Path\"\n d=\"M6 9.13741L12 15.229L18 9.13741\"\n stroke=\"#8E9AA0\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </g>\n </g>\n </svg>\n </div>\n <div\n class=\"dropdown-up-arrow\"\n [ngClass]=\"{ opened: dropdownOpened, closed: !dropdownOpened }\"\n >\n <svg\n width=\"1em\"\n viewBox=\"0 0 24 25\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"up-arrow-img\"\n >\n <path\n d=\"M18 15.229L12 9.1374L6 15.229\"\n stroke=\"#8E9AA0\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div\n #dropdownItems\n class=\"dropdown-items\"\n *ngIf=\"dropdownOpened\"\n (scroll)=\"dropdownScroll($event)\"\n >\n <div (click)=\"createNew()\">\n <a class=\"create_button\" *ngIf=\"showCreateNew\">Create new</a>\n </div>\n <ng-container *ngIf=\"items.length > 0; else noDataAvailable\">\n <ng-container *ngIf=\"multiple; else singleSelection\">\n <a\n [ngClass]=\"{\n compact: !item?.image && !item?.subLabel,\n expanded: item?.image || item?.subLabel\n }\"\n class=\"items d-block\"\n *ngFor=\"let item of _filteredItems\"\n (click)=\"selectItem(item)\"\n >\n <div class=\"dropdown-item\">\n <div class=\"item-details\">\n <div class=\"content-wrapper\">\n <img\n *ngIf=\"item?.image\"\n [src]=\"item?.image\"\n alt=\"Item Image\"\n class=\"item-image icon-size\"\n />\n <div class=\"text-content\">\n <div\n class=\"item-label\"\n [innerHTML]=\"highlightMatch(item.label)\"\n ></div>\n <div *ngIf=\"showSubLabel\" class=\"item-sublabel\">\n {{ item?.subLabel }}\n </div>\n </div>\n </div>\n <div\n class=\"dropdown_buttons\"\n [class.empty]=\"customButtons.length === 0\"\n >\n <button\n *ngFor=\"let button of customButtons\"\n (click)=\"handleButtonClick(button.action)\"\n >\n <i [class]=\"button.icon\" [style.color]=\"button.color\"></i>\n </button>\n </div>\n </div>\n </div>\n </a>\n </ng-container>\n\n <ng-template #singleSelection>\n <a\n class=\"items d-block\"\n [ngClass]=\"{\n compact: !item?.image && !item?.subLabel,\n expanded: item?.image || item?.subLabel\n }\"\n *ngFor=\"let item of _filteredItems\"\n (click)=\"selectItem(item)\"\n >\n <div class=\"dropdown-item\">\n <div class=\"item-details\">\n <div class=\"content-wrapper\">\n <img\n *ngIf=\"item?.image\"\n [src]=\"item?.image\"\n alt=\"Item Image\"\n class=\"item-image icon-size\"\n />\n <div class=\"text-content\">\n <div\n class=\"item-label\"\n [innerHTML]=\"highlightMatch(item.label)\"\n ></div>\n <div *ngIf=\"showSubLabel\" class=\"item-sublabel\">\n {{ item?.subLabel }}\n </div>\n </div>\n </div>\n <div\n class=\"dropdown_buttons\"\n [class.empty]=\"customButtons.length === 0\"\n >\n <button\n *ngFor=\"let button of customButtons\"\n (click)=\"handleButtonClick(button.action)\"\n >\n <i [class]=\"button.icon\" [style.color]=\"button.color\"></i>\n </button>\n </div>\n </div>\n </div>\n </a>\n </ng-template>\n </ng-container>\n\n <!-- \"No data available\" message if the drop down is empty -->\n <ng-template #noDataAvailable>\n <div class=\"items\">No data available</div>\n </ng-template>\n </div>\n</div>\n", styles: [".dropdown{background:#fff;border-radius:6px}.dropdown .dropdown-field{background:#fff;border-radius:6px;position:relative;cursor:pointer}.dropdown .dropdown-field .selected.selectedList{display:flex;flex-wrap:wrap;max-height:80px;overflow-y:auto;overflow-x:hidden}.dropdown .dropdown-field .selected .selected-item{background:#e3e3da;display:inline;margin:5px;padding:2px;border-radius:5px;font-size:small}.dropdown .dropdown-field .selected .remaining-items{margin:5px;padding:2px;font-size:smaller;display:block}.dropdown .dropdown-field .input-field .dropdown_text{width:100%;border:none;padding:2px;margin-left:3px;margin-right:3px;outline:none;box-sizing:border-box;font-style:normal}@media (max-width: 576px){.dropdown .dropdown-field .input-field .dropdown_text{width:53%;margin-left:3px;padding-left:2px}}@media (max-width: 420px){.dropdown .dropdown-field .input-field .dropdown_text{width:53%;margin-left:3px;padding-left:2px}}@media only screen and (min-width: 576px){.dropdown .dropdown-field .input-field .dropdown_text{height:25px}}@media only screen and (min-width: 992px){.dropdown .dropdown-field .input-field .dropdown_text{height:30px}}@media only screen and (min-width: 1200px){.dropdown .dropdown-field .input-field .dropdown_text{height:35px}}.dropdown .dropdown-field.closed{border:1px solid #d8d8d8}.dropdown .dropdown-field.opened{border-bottom:1px solid #d8d8d8}.dropdown .dropdown-items{overflow-y:auto;overflow-x:auto;position:absolute!important;top:100%;left:0;width:100%;background:#fff;z-index:9999999;border:solid 1px #dbdbdb;box-shadow:0 4px 4px -5px #00000040;transition:transform .3s ease-out;scroll-behavior:smooth;cursor:pointer}@media only screen and (min-width: 276px){.dropdown .dropdown-items{max-height:150px;padding:3px}}@media only screen and (min-width: 576px){.dropdown .dropdown-items{max-height:150px;padding:3px}}@media only screen and (min-width: 992px){.dropdown .dropdown-items{max-height:150px;padding:5px}}@media only screen and (min-width: 1441px){.dropdown .dropdown-items{max-height:200px;padding:7px}}.dropdown .dropdown-items .create_button{text-decoration:none;cursor:pointer}@media only screen and (min-width: 576px){.dropdown .dropdown-items .create_button{padding-left:8px}}@media only screen and (min-width: 992px){.dropdown .dropdown-items .create_button{padding-left:8px}}@media only screen and (min-width: 1200px){.dropdown .dropdown-items .create_button{padding-left:8px}}.dropdown .dropdown-items .items{text-decoration:none;color:inherit;position:relative;cursor:pointer}@media only screen and (min-width: 576px){.dropdown .dropdown-items .items{padding-left:8px;font-size:small}}@media only screen and (min-width: 992px){.dropdown .dropdown-items .items{padding-left:8px}}@media only screen and (min-width: 1200px){.dropdown .dropdown-items .items{padding-left:8px;font-size:small}}.dropdown .dropdown-items .items:hover{background:#ebedef;border-radius:6px}.dropdown .dropdown-items .items:hover button{visibility:visible}.dropdown .dropdown-items .items .dropdown_buttons{display:inline}.dropdown .dropdown-items .items button{border:0;background:transparent;visibility:hidden}.dropdown.opened{border:1px #d8d8d8 solid}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background-color:transparent}::-webkit-scrollbar-thumb{background-color:#b2b2b2;border-radius:6px}.space{width:10px}.icon-size{width:30px;height:30px;margin-right:7px}.smallSpace{width:3px}.selected-icon-size{width:25px;height:20px;margin-left:10px}@media (max-width: 576px){.selected-icon-size{width:21px;height:15px;margin-right:7px;margin-bottom:1px}}.multiSelected-icon-size{width:25px;height:20px;margin-left:1px;margin-bottom:1px;margin-right:3px}.flexSection{display:flex;justify-content:space-between}.dropdown-down-arrow,.dropdown-up-arrow,.deselect{width:20px;height:20px;display:flex;align-items:center;justify-content:center;cursor:pointer}.dropdown-down-arrow{cursor:pointer}.dropdown-down-arrow.opened{display:none}.dropdown-down-arrow.closed{display:block}.dropdown-up-arrow{cursor:pointer}.dropdown-up-arrow.closed{display:none}.close-icon{margin-left:8px;margin-right:5px}.iconSection{display:flex;flex-direction:row-reverse;padding:1px;position:relative;justify-content:center;align-items:center}.dropdown-icons-container{display:flex;gap:10px}.item-details{display:flex;align-items:center;justify-content:space-between}.content-wrapper{display:flex;align-items:center;gap:8px;flex:1}.text-content{display:flex;flex-direction:column}.item-label{font-size:14px;font-weight:400;line-height:1.3}.item-sublabel{font-size:11px;color:#666;line-height:1.2}.dropdown_buttons{display:flex;gap:4px}.dropdown_buttons.empty:after{content:\"\";display:inline-block;width:4px;height:1px}.compact{line-height:32px}.expanded{line-height:41px}.input-field{width:100%}.input-with-icon{display:flex;align-items:center;gap:8px;width:100%}.selected-icon-size{width:20px;height:20px;flex-shrink:0}.dropdown_text.inline-input{flex:1;border:none;outline:none;padding:0;background:transparent;font-family:inherit;font-size:inherit;color:inherit}.single-input{width:80%;white-space:nowrap}.item-label{font-size:14px;line-height:1.4;color:#333}.highlight-text{font-weight:600;background-repeat:no-repeat;background-size:100% .3em;background-position:0 88%;padding:.1em .05em;border-radius:2px;color:#1a1a1a;transition:all .2s ease-in-out}.dropdown .dropdown-field .input-field .dropdown_text{background:#fff!important}.dropdown.dropdown-disabled .dropdown-field .input-field .dropdown_text,.dropdown.dropdown-disabled .dropdown-field{background:#e9ecef!important;pointer-events:none}\n"] }]
|
|
187
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { multiple: [{
|
|
188
|
+
type: Input
|
|
189
|
+
}], selectedItems: [{
|
|
190
|
+
type: Input
|
|
191
|
+
}], placeholder: [{
|
|
192
|
+
type: Input
|
|
193
|
+
}], showCreateNew: [{
|
|
194
|
+
type: Input
|
|
195
|
+
}], selectedValues: [{
|
|
196
|
+
type: Input
|
|
197
|
+
}], customButtons: [{
|
|
198
|
+
type: Input
|
|
199
|
+
}], showBorder: [{
|
|
200
|
+
type: Input
|
|
201
|
+
}], disable: [{
|
|
202
|
+
type: Input
|
|
203
|
+
}], buttonClick: [{
|
|
204
|
+
type: Output
|
|
205
|
+
}], selectedItemsChange: [{
|
|
206
|
+
type: Output
|
|
207
|
+
}], onDropdownScroll: [{
|
|
208
|
+
type: Output
|
|
209
|
+
}], onCreateNew: [{
|
|
210
|
+
type: Output
|
|
211
|
+
}], onSearch: [{
|
|
212
|
+
type: Output
|
|
213
|
+
}], showSubLabel: [{
|
|
214
|
+
type: Input
|
|
215
|
+
}], items: [{
|
|
216
|
+
type: Input
|
|
217
|
+
}], dropdownitems: [{
|
|
218
|
+
type: ViewChild,
|
|
219
|
+
args: ["dropdownItems"]
|
|
220
|
+
}], dropdown: [{
|
|
221
|
+
type: ViewChild,
|
|
222
|
+
args: ["dropdown"]
|
|
223
|
+
}], onDocumentClick: [{
|
|
224
|
+
type: HostListener,
|
|
225
|
+
args: ["document:click", ["$event"]]
|
|
226
|
+
}] } });
|
|
227
|
+
|
|
228
|
+
class DropdownModule {
|
|
229
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
230
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: DropdownModule, declarations: [DropdownComponent], imports: [FormsModule,
|
|
231
|
+
CommonModule], exports: [DropdownComponent] }); }
|
|
232
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropdownModule, imports: [FormsModule,
|
|
233
|
+
CommonModule] }); }
|
|
234
|
+
}
|
|
235
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropdownModule, decorators: [{
|
|
236
|
+
type: NgModule,
|
|
237
|
+
args: [{
|
|
238
|
+
declarations: [
|
|
239
|
+
DropdownComponent
|
|
240
|
+
],
|
|
241
|
+
imports: [
|
|
242
|
+
FormsModule,
|
|
243
|
+
CommonModule,
|
|
244
|
+
],
|
|
245
|
+
exports: [
|
|
246
|
+
DropdownComponent
|
|
247
|
+
]
|
|
248
|
+
}]
|
|
249
|
+
}] });
|
|
250
|
+
|
|
251
|
+
/*
|
|
252
|
+
* Public API Surface of dropdown
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Generated bundle index. Do not edit.
|
|
257
|
+
*/
|
|
258
|
+
|
|
259
|
+
export { DropdownComponent, DropdownModule, DropdownService };
|
|
260
|
+
//# sourceMappingURL=piserve-tech-drop-down.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piserve-tech-drop-down.mjs","sources":["../../../projects/dropdown/src/lib/dropdown.service.ts","../../../projects/dropdown/src/lib/dropdown.component.ts","../../../projects/dropdown/src/lib/dropdown.component.html","../../../projects/dropdown/src/lib/dropdown.module.ts","../../../projects/dropdown/src/public-api.ts","../../../projects/dropdown/src/piserve-tech-drop-down.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DropdownService {\n\n constructor() { }\n}\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n OnInit,\n Output,\n SimpleChanges,\n ViewChild,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport { DropdownItem } from \"./dropdown.model\";\nimport { v4 as uuidv4 } from 'uuid';\n\n@Component({\n selector: \"lib-dropdown\",\n templateUrl: \"./dropdown.component.html\",\n styleUrls: [\"./dropdown.component.scss\"],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DropdownComponent implements OnInit {\n @Input() multiple!: boolean;\n @Input() selectedItems: any[] = [];\n @Input() placeholder: String = \"\";\n @Input() showCreateNew!: boolean;\n @Input() selectedValues: string = \"\";\n @Input() customButtons: {\n label: string;\n icon: string;\n color: string;\n action: () => void;\n }[] = [];\n @Input() showBorder: boolean = true;\n @Input() disable: boolean = false;\n @Output() buttonClick: EventEmitter<Event> = new EventEmitter<Event>();\n @Output() selectedItemsChange: EventEmitter<any[]> = new EventEmitter<\n any[]\n >();\n @Output() onDropdownScroll: EventEmitter<Event> = new EventEmitter<Event>();\n @Output() onCreateNew: EventEmitter<Event> = new EventEmitter<Event>();\n @Output() onSearch: EventEmitter<string> = new EventEmitter<string>();\n //subLabel\n @Input() showSubLabel: boolean = false;\n dropdownId = uuidv4();\n dropdownOpened: boolean = false;\n selectedItem: any;\n selectedItemName: string = \"\";\n selectedItemImage: string = \"\";\n originalItems: DropdownItem[] = [];\n searchTerm: string = \"\";\n initialized: boolean = false;\n searchText: string = \"\";\n _filteredItems: DropdownItem[] = [];\n\n private _items: DropdownItem[] = [];\n\n @Input()\n set items(value: DropdownItem[]) {\n this._items = value || [];\n this.originalItems = this._items.slice();\n this._filteredItems = this._items.slice(); // use a separate variable for rendering\n this.cdr.markForCheck();\n }\n get items(): DropdownItem[] {\n return this._items;\n }\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit(): void {}\n\n\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes[\"selectedItems\"]) {\n const item = changes[\"selectedItems\"][\"currentValue\"];\n this.selectedItems = item;\n this.selectedItemName = this.selectedItems[0]?.label;\n this.selectedItemImage = this.selectedItems[0]?.image;\n }\n if (changes[\"items\"]) {\n this.initialize();\n this.originalItems = this.items.slice();\n this.cdr.markForCheck();\n }\n if (changes[\"selectedValues\"]) {\n this.selectedItemName = this.selectedValues;\n }\n }\n\n initialize() {\n setTimeout(() => {\n if (this.selectedItems && this.selectedItems.length > 0) {\n if (!this.multiple) {\n this.searchText = \"\";\n this.selectedItemName = this.selectedItems[0]?.label;\n this.selectedItemImage = this.selectedItems[0]?.image;\n }\n }\n }, 1000);\n const uniqueItems = this.items.filter(\n (selected, index, self) =>\n index === self.findIndex((t) => t.value === selected.value)\n );\n\n this.items = uniqueItems;\n }\n\n openDropdown() {\n this.dropdownOpened = !this.dropdownOpened;\n const inputId = `searchInput-${this.dropdownId}`;\n const inputEl = document.getElementById(inputId);\n setTimeout(() => {\n inputEl?.focus();\n }, 0);\n \n }\n\n @ViewChild(\"dropdownItems\") dropdownitems!: ElementRef<any>;\n dropdownScroll(event: any): void {\n if (this.onDropdownScroll.observed) {\n this.onDropdownScroll.emit(event);\n this.cdr.markForCheck();\n }\n }\n\n selectItem(item: any) {\n if (this.multiple) {\n if (!this.selectedItems.includes(item)) {\n this.selectedItems.push(item);\n this.selectedItemsChange.emit(this.selectedItems);\n } else {\n this.selectedItems = this.selectedItems.filter(\n (selected: any) => selected !== item\n );\n this.selectedItemsChange.emit(this.selectedItems);\n }\n } else {\n this.searchText = \"\";\n this.selectedItems[0] = item;\n this.selectedItemName = this.selectedItems[0]?.label;\n this.selectedItemImage = this.selectedItems[0]?.image;\n this.dropdownOpened = false;\n this.selectedItemsChange.emit(this.selectedItems);\n }\n this._filteredItems = this.originalItems.slice();\n }\n\n unselectItem(item: any): void {\n this.selectedItems = this.selectedItems.filter(\n (selected: any) => selected !== item\n );\n this.selectedItemsChange.emit(this.selectedItems);\n }\n\n unselectAll() {\n this.selectedItems = [];\n this.selectedItemName = \"\";\n this.selectedItemImage = \"\";\n this.selectedItemsChange.emit(this.selectedItems);\n this.cdr.markForCheck();\n }\n\n @ViewChild(\"dropdown\") dropdown!: ElementRef;\n @HostListener(\"document:click\", [\"$event\"])\n onDocumentClick(event: Event): void {\n const isClickInsideDropdown = this.dropdown.nativeElement.contains(\n event.target\n );\n\n if (!isClickInsideDropdown) {\n this.dropdownOpened = false;\n }\n }\n\n createNew() {\n this.onCreateNew.emit();\n this.dropdownOpened = false;\n }\n\n search(event: any): void {\n const keyCode = event.keyCode;\n this.dropdownOpened = true;\n this.searchTerm = event.target.value.toLowerCase();\n if (!this.onSearch.observed) {\n if (this.searchTerm.trim() === \"\") {\n if (!this.multiple) {\n this.unselectAll();\n }\n this._filteredItems = this.originalItems.slice();\n } else {\n const lowerCaseSearchTerm = this.searchTerm.toLowerCase();\n this._filteredItems = this.originalItems.filter(\n (item) =>\n item.label.toLowerCase().includes(lowerCaseSearchTerm) ||\n (item.value &&\n item.value.toLowerCase().includes(lowerCaseSearchTerm))\n );\n }\n } else {\n this.onSearch.emit(this.searchTerm);\n }\n }\n\n handleButtonClick(action: () => void): void {\n action();\n this.buttonClick.emit();\n }\n\n highlightMatch(text: string): string {\n const search = this.searchText?.trim() || this.searchTerm?.trim();\n if (!search || !text) return text;\n\n const index = text.toLowerCase().indexOf(search.toLowerCase());\n if (index === -1) return text;\n\n const before = text.substring(0, index);\n const match = text.substring(index, index + search.length);\n const after = text.substring(index + search.length);\n\n return `${before}<span class=\"highlight-text\">${match}</span>${after}`;\n }\n}\n","<div\n #dropdown\n class=\"dropdown\"\n [ngClass]=\"{\n opened: showBorder && dropdownOpened,\n closed: showBorder && !dropdownOpened,\n 'dropdown-disabled': disable\n }\"\n>\n <div\n class=\"dropdown-field\"\n id=\"division\"\n [ngClass]=\"{\n opened: showBorder && dropdownOpened,\n closed: showBorder && !dropdownOpened,\n }\"\n (click)=\"openDropdown()\"\n >\n <!-- <div *ngIf=\"selectedValues !== '' && !selectedItemName\" class=\"selected\">\n {{ selectedValues }}\n </div> -->\n <div class=\"flexSection\">\n <div class=\"dataSection\" *ngIf=\"!selectedItem && multiple\">\n <div class=\"selected selectedList\">\n <ng-container *ngFor=\"let selectedItem of selectedItems\">\n <div class=\"selected-item\">\n <img\n *ngIf=\"selectedItem?.image\"\n class=\"multiSelected-icon-size\"\n [src]=\"selectedItem?.image\"\n alt=\"image\"\n />\n <span>{{ selectedItem.label }}</span>\n <span (click)=\"unselectItem(selectedItem)\" class=\"close-icon\"\n >×</span\n >\n </div>\n </ng-container>\n\n <div class=\"input-field\">\n <input\n [id]=\"'searchInput-' + dropdownId\"\n class=\"dropdown_text inline-input\"\n [(ngModel)]=\"searchText\"\n [placeholder]=\"placeholder\"\n (input)=\"search($event)\"\n />\n </div>\n </div>\n </div>\n <div class=\"dataSection single-input\" *ngIf=\"!multiple\">\n <div class=\"input-field\">\n <div class=\"input-with-icon\">\n <img\n *ngIf=\"selectedItemImage\"\n class=\"selected-icon-size\"\n [src]=\"selectedItemImage\"\n alt=\"image\"\n />\n <input\n [id]=\"'searchInput-' + dropdownId\"\n class=\"dropdown_text inline-input\"\n [placeholder]=\"placeholder\"\n [(ngModel)]=\"selectedItemName\"\n (input)=\"search($event)\"\n [readonly] = \"selectedItems.length > 0\"\n />\n </div>\n </div>\n </div>\n <div class=\"iconSection\">\n <div class=\"dropdown-icons-container\">\n <div>\n <span\n (click)=\"unselectAll()\"\n *ngIf=\"selectedItems.length > 0\"\n class=\"deselect\"\n >×\n </span>\n </div>\n <div\n class=\"dropdown-down-arrow\"\n [ngClass]=\"{ opened: dropdownOpened, closed: !dropdownOpened }\"\n >\n <svg\n width=\"1em\"\n viewBox=\"0 0 24 25\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"down-arrow-img\"\n >\n <g id=\"Down Arrow\">\n <g id=\"Group\">\n <path\n id=\"Path\"\n d=\"M6 9.13741L12 15.229L18 9.13741\"\n stroke=\"#8E9AA0\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </g>\n </g>\n </svg>\n </div>\n <div\n class=\"dropdown-up-arrow\"\n [ngClass]=\"{ opened: dropdownOpened, closed: !dropdownOpened }\"\n >\n <svg\n width=\"1em\"\n viewBox=\"0 0 24 25\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"up-arrow-img\"\n >\n <path\n d=\"M18 15.229L12 9.1374L6 15.229\"\n stroke=\"#8E9AA0\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div\n #dropdownItems\n class=\"dropdown-items\"\n *ngIf=\"dropdownOpened\"\n (scroll)=\"dropdownScroll($event)\"\n >\n <div (click)=\"createNew()\">\n <a class=\"create_button\" *ngIf=\"showCreateNew\">Create new</a>\n </div>\n <ng-container *ngIf=\"items.length > 0; else noDataAvailable\">\n <ng-container *ngIf=\"multiple; else singleSelection\">\n <a\n [ngClass]=\"{\n compact: !item?.image && !item?.subLabel,\n expanded: item?.image || item?.subLabel\n }\"\n class=\"items d-block\"\n *ngFor=\"let item of _filteredItems\"\n (click)=\"selectItem(item)\"\n >\n <div class=\"dropdown-item\">\n <div class=\"item-details\">\n <div class=\"content-wrapper\">\n <img\n *ngIf=\"item?.image\"\n [src]=\"item?.image\"\n alt=\"Item Image\"\n class=\"item-image icon-size\"\n />\n <div class=\"text-content\">\n <div\n class=\"item-label\"\n [innerHTML]=\"highlightMatch(item.label)\"\n ></div>\n <div *ngIf=\"showSubLabel\" class=\"item-sublabel\">\n {{ item?.subLabel }}\n </div>\n </div>\n </div>\n <div\n class=\"dropdown_buttons\"\n [class.empty]=\"customButtons.length === 0\"\n >\n <button\n *ngFor=\"let button of customButtons\"\n (click)=\"handleButtonClick(button.action)\"\n >\n <i [class]=\"button.icon\" [style.color]=\"button.color\"></i>\n </button>\n </div>\n </div>\n </div>\n </a>\n </ng-container>\n\n <ng-template #singleSelection>\n <a\n class=\"items d-block\"\n [ngClass]=\"{\n compact: !item?.image && !item?.subLabel,\n expanded: item?.image || item?.subLabel\n }\"\n *ngFor=\"let item of _filteredItems\"\n (click)=\"selectItem(item)\"\n >\n <div class=\"dropdown-item\">\n <div class=\"item-details\">\n <div class=\"content-wrapper\">\n <img\n *ngIf=\"item?.image\"\n [src]=\"item?.image\"\n alt=\"Item Image\"\n class=\"item-image icon-size\"\n />\n <div class=\"text-content\">\n <div\n class=\"item-label\"\n [innerHTML]=\"highlightMatch(item.label)\"\n ></div>\n <div *ngIf=\"showSubLabel\" class=\"item-sublabel\">\n {{ item?.subLabel }}\n </div>\n </div>\n </div>\n <div\n class=\"dropdown_buttons\"\n [class.empty]=\"customButtons.length === 0\"\n >\n <button\n *ngFor=\"let button of customButtons\"\n (click)=\"handleButtonClick(button.action)\"\n >\n <i [class]=\"button.icon\" [style.color]=\"button.color\"></i>\n </button>\n </div>\n </div>\n </div>\n </a>\n </ng-template>\n </ng-container>\n\n <!-- \"No data available\" message if the drop down is empty -->\n <ng-template #noDataAvailable>\n <div class=\"items\">No data available</div>\n </ng-template>\n </div>\n</div>\n","import { NgModule } from '@angular/core';\nimport { DropdownComponent } from './dropdown.component';\nimport { FormsModule } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\n\n\n\n@NgModule({\n declarations: [\n DropdownComponent\n ],\n imports: [\n FormsModule,\n CommonModule,\n ],\n exports: [\n DropdownComponent\n ]\n})\nexport class DropdownModule { }\n","/*\n * Public API Surface of dropdown\n */\n\nexport * from './lib/dropdown.service';\nexport * from './lib/dropdown.component';\nexport * from './lib/dropdown.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["uuidv4"],"mappings":";;;;;;;;MAKa,eAAe,CAAA;AAE1B,IAAA,WAAA,GAAA,GAAiB;+GAFN,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAAf,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cAFd,MAAM,EAAA,CAAA,CAAA,EAAA;;4FAEP,eAAe,EAAA,UAAA,EAAA,CAAA;kBAH3B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;MCoBY,iBAAiB,CAAA;IAoC5B,IACI,KAAK,CAAC,KAAqB,EAAA;AAC7B,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK,IAAI,EAAE,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC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AAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;gHAAd,cAAc,EAAA,YAAA,EAAA,CAVvB,iBAAiB,CAAA,EAAA,OAAA,EAAA,CAGjB,WAAW;AACX,YAAA,YAAY,aAGZ,iBAAiB,CAAA,EAAA,CAAA,CAAA,EAAA;AAGR,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,YAPvB,WAAW;YACX,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAMH,cAAc,EAAA,UAAA,EAAA,CAAA;kBAZ1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,iBAAiB;AAClB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,WAAW;wBACX,YAAY;AACb,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,iBAAiB;AAClB,qBAAA;AACF,iBAAA,CAAA;;;AClBD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ChangeDetectorRef, ElementRef, EventEmitter, OnInit, SimpleChanges } from "@angular/core";
|
|
2
|
+
import { DropdownItem } from "./dropdown.model";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DropdownComponent implements OnInit {
|
|
5
|
+
private cdr;
|
|
6
|
+
multiple: boolean;
|
|
7
|
+
selectedItems: any[];
|
|
8
|
+
placeholder: String;
|
|
9
|
+
showCreateNew: boolean;
|
|
10
|
+
selectedValues: string;
|
|
11
|
+
customButtons: {
|
|
12
|
+
label: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
color: string;
|
|
15
|
+
action: () => void;
|
|
16
|
+
}[];
|
|
17
|
+
showBorder: boolean;
|
|
18
|
+
disable: boolean;
|
|
19
|
+
buttonClick: EventEmitter<Event>;
|
|
20
|
+
selectedItemsChange: EventEmitter<any[]>;
|
|
21
|
+
onDropdownScroll: EventEmitter<Event>;
|
|
22
|
+
onCreateNew: EventEmitter<Event>;
|
|
23
|
+
onSearch: EventEmitter<string>;
|
|
24
|
+
showSubLabel: boolean;
|
|
25
|
+
dropdownId: string;
|
|
26
|
+
dropdownOpened: boolean;
|
|
27
|
+
selectedItem: any;
|
|
28
|
+
selectedItemName: string;
|
|
29
|
+
selectedItemImage: string;
|
|
30
|
+
originalItems: DropdownItem[];
|
|
31
|
+
searchTerm: string;
|
|
32
|
+
initialized: boolean;
|
|
33
|
+
searchText: string;
|
|
34
|
+
_filteredItems: DropdownItem[];
|
|
35
|
+
private _items;
|
|
36
|
+
set items(value: DropdownItem[]);
|
|
37
|
+
get items(): DropdownItem[];
|
|
38
|
+
constructor(cdr: ChangeDetectorRef);
|
|
39
|
+
ngOnInit(): void;
|
|
40
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
41
|
+
initialize(): void;
|
|
42
|
+
openDropdown(): void;
|
|
43
|
+
dropdownitems: ElementRef<any>;
|
|
44
|
+
dropdownScroll(event: any): void;
|
|
45
|
+
selectItem(item: any): void;
|
|
46
|
+
unselectItem(item: any): void;
|
|
47
|
+
unselectAll(): void;
|
|
48
|
+
dropdown: ElementRef;
|
|
49
|
+
onDocumentClick(event: Event): void;
|
|
50
|
+
createNew(): void;
|
|
51
|
+
search(event: any): void;
|
|
52
|
+
handleButtonClick(action: () => void): void;
|
|
53
|
+
highlightMatch(text: string): string;
|
|
54
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DropdownComponent, never>;
|
|
55
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DropdownComponent, "lib-dropdown", never, { "multiple": { "alias": "multiple"; "required": false; }; "selectedItems": { "alias": "selectedItems"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "showCreateNew": { "alias": "showCreateNew"; "required": false; }; "selectedValues": { "alias": "selectedValues"; "required": false; }; "customButtons": { "alias": "customButtons"; "required": false; }; "showBorder": { "alias": "showBorder"; "required": false; }; "disable": { "alias": "disable"; "required": false; }; "showSubLabel": { "alias": "showSubLabel"; "required": false; }; "items": { "alias": "items"; "required": false; }; }, { "buttonClick": "buttonClick"; "selectedItemsChange": "selectedItemsChange"; "onDropdownScroll": "onDropdownScroll"; "onCreateNew": "onCreateNew"; "onSearch": "onSearch"; }, never, never, false, never>;
|
|
56
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export interface DropdownItem {
|
|
2
|
-
value: string;
|
|
3
|
-
label: string;
|
|
4
|
-
image: string;
|
|
5
|
-
subLabel?: string
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export interface DropdownItem {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
image: string;
|
|
5
|
+
subLabel?: string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./dropdown.component";
|
|
3
|
+
import * as i2 from "@angular/forms";
|
|
4
|
+
import * as i3 from "@angular/common";
|
|
5
|
+
export declare class DropdownModule {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DropdownModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DropdownModule, [typeof i1.DropdownComponent], [typeof i2.FormsModule, typeof i3.CommonModule], [typeof i1.DropdownComponent]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DropdownModule>;
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@piserve-tech/drop-down",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^16.2.0",
|
|
6
|
-
"@angular/core": "^16.2.0"
|
|
7
|
-
},
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"tslib": "^2.3.0"
|
|
10
|
-
},
|
|
11
|
-
"sideEffects": false,
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://penta.internal.piserve.com/form-builder/library-dropdown"
|
|
15
|
-
}
|
|
16
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@piserve-tech/drop-down",
|
|
3
|
+
"version": "1.2.112",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^16.2.0",
|
|
6
|
+
"@angular/core": "^16.2.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://penta.internal.piserve.com/form-builder/library-dropdown"
|
|
15
|
+
},
|
|
16
|
+
"module": "fesm2022/piserve-tech-drop-down.mjs",
|
|
17
|
+
"typings": "index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
"./package.json": {
|
|
20
|
+
"default": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./index.d.ts",
|
|
24
|
+
"esm2022": "./esm2022/piserve-tech-drop-down.mjs",
|
|
25
|
+
"esm": "./esm2022/piserve-tech-drop-down.mjs",
|
|
26
|
+
"default": "./fesm2022/piserve-tech-drop-down.mjs"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export * from './lib/dropdown.service';
|
|
6
|
-
export * from './lib/dropdown.component';
|
|
7
|
-
export * from './lib/dropdown.module';
|
|
1
|
+
export * from './lib/dropdown.service';
|
|
2
|
+
export * from './lib/dropdown.component';
|
|
3
|
+
export * from './lib/dropdown.module';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g id="Down Arrow">
|
|
3
|
-
<g id="Group">
|
|
4
|
-
<path id="Path" d="M6 9.13741L12 15.229L18 9.13741" stroke="#8E9AA0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
-
</g>
|
|
6
|
-
</g>
|
|
7
|
-
</svg>
|
package/assets/images/edit.svg
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g id="Group">
|
|
3
|
-
<g id="Group 78">
|
|
4
|
-
<path id="Path" fill-rule="evenodd" clip-rule="evenodd" d="M3.90685 12.0417H0.958008V9.09284C0.958008 8.79057 1.07803 8.50068 1.29181 8.28701L8.2861 1.29272C8.49977 1.07864 8.7898 0.958344 9.09226 0.958344C9.39471 0.958344 9.68475 1.07864 9.89841 1.29272L11.707 3.10127C11.921 3.31493 12.0413 3.60497 12.0413 3.90743C12.0413 4.20988 11.921 4.49992 11.707 4.71358L4.71268 11.7079C4.49884 11.9214 4.20905 12.0415 3.90685 12.0417Z" stroke="#084FFF" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
-
<path id="Path_2" d="M7.19482 3.03896L9.96566 5.80979" stroke="#084FFF" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
-
</g>
|
|
7
|
-
</g>
|
|
8
|
-
</svg>
|
package/assets/images/view.svg
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g id="Group">
|
|
3
|
-
<g id="Group_2">
|
|
4
|
-
<path id="Path" d="M9.15028 4.91C10.0611 5.78825 10.0611 7.214 9.15028 8.09375C8.2395 8.972 6.76094 8.972 5.84861 8.09375C4.93783 7.2155 4.93783 5.78975 5.84861 4.91C6.76094 4.03025 8.23872 4.03025 9.15028 4.91" stroke="#084FFF" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
-
<path id="Path_2" fill-rule="evenodd" clip-rule="evenodd" d="M0.5 6.5C0.5 6.00575 0.618222 5.51675 0.846889 5.066V5.066C2.02522 2.74325 4.62922 1.25 7.5 1.25C10.3708 1.25 12.9748 2.74325 14.1531 5.066V5.066C14.3818 5.51675 14.5 6.00575 14.5 6.5C14.5 6.99425 14.3818 7.48325 14.1531 7.934V7.934C12.9748 10.2567 10.3708 11.75 7.5 11.75C4.62922 11.75 2.02522 10.2567 0.846889 7.934V7.934C0.618222 7.48325 0.5 6.99425 0.5 6.5Z" stroke="#084FFF" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
-
</g>
|
|
7
|
-
</g>
|
|
8
|
-
</svg>
|