@piserve-tech/drop-down 1.2.108 → 1.2.110
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/assets/images/down_arrow.svg +7 -0
- package/assets/images/edit.svg +8 -0
- package/assets/images/view.svg +8 -0
- package/ng-package.json +7 -0
- package/package.json +16 -29
- package/src/lib/dropdown.component.html +236 -0
- package/src/lib/dropdown.component.scss +374 -0
- package/src/lib/dropdown.component.spec.ts +21 -0
- package/src/lib/dropdown.component.ts +226 -0
- package/{lib/dropdown.model.d.ts → src/lib/dropdown.model.ts} +7 -6
- package/src/lib/dropdown.module.ts +20 -0
- package/src/lib/dropdown.service.spec.ts +16 -0
- package/src/lib/dropdown.service.ts +9 -0
- package/{public-api.d.ts → src/public-api.ts} +7 -3
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/esm2022/lib/dropdown.component.mjs +0 -211
- package/esm2022/lib/dropdown.model.mjs +0 -2
- package/esm2022/lib/dropdown.module.mjs +0 -28
- package/esm2022/lib/dropdown.service.mjs +0 -14
- package/esm2022/piserve-tech-drop-down.mjs +0 -5
- package/esm2022/public-api.mjs +0 -7
- package/fesm2022/piserve-tech-drop-down.mjs +0 -259
- package/fesm2022/piserve-tech-drop-down.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/dropdown.component.d.ts +0 -56
- package/lib/dropdown.module.d.ts +0 -9
- package/lib/dropdown.service.d.ts +0 -6
package/README.md
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
## Dropdown library
|
|
2
|
-
|
|
3
|
-
To use the library in a project import the library module in the imports array of which module you are going to implement the library.
|
|
4
|
-
|
|
5
|
-
To use the dropdown add the selector '<lib-dropdown></lib-dropdown>' in the position where you need the dropdown.
|
|
6
|
-
|
|
7
|
-
## Attribute List
|
|
8
|
-
|
|
9
|
-
1. items - It takes an array of objects as input and iterate the array to show the options in dropdown.
|
|
10
|
-
|
|
11
|
-
2. label - label specifies the attribute name that has to be shown as the options in dropdown.
|
|
12
|
-
|
|
13
|
-
3. multiple - It is a boolean variable to define whether the dropdown is single selection or multi selection.By default it will be single selection.
|
|
14
|
-
|
|
15
|
-
4. selectedItems - Its a two way binding attribute which is used to get the selected values from the dropdown.
|
|
16
|
-
|
|
17
|
-
5. placeholder - String attribute to hold the value for showing placeholder of dropdown.
|
|
18
|
-
|
|
19
|
-
6. customButtons - It takes an array of objects as input for the custom buttons. Each object contains 4 elements
|
|
20
|
-
|
|
21
|
-
label - Specifies button name.
|
|
22
|
-
|
|
23
|
-
icon - It should be a font awesome icon class name for showing the icon as button.
|
|
24
|
-
|
|
25
|
-
color - For styling the button.
|
|
26
|
-
|
|
27
|
-
action - Specifies the function that should be called when the button is clicked.
|
|
28
|
-
|
|
29
|
-
7. onScroll - Define a function that should be called when scrolled to the bottom of the dropdown.
|
|
30
|
-
|
|
31
|
-
8. showCreateNew - Boolean variable to show and hide create new button.
|
|
32
|
-
|
|
33
|
-
9. createNewEvent - Define a function that should be called when createNew button is clicked.
|
|
34
|
-
|
|
35
|
-
10. onSearch - If apiSearch is true, through this attribute we can get the searchTerm for performing api search.
|
|
36
|
-
|
|
37
|
-
11. showBorder - A boolean variable to show and hide the border of dropdown. By default it will be true.
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
## Dropdown library
|
|
2
|
+
|
|
3
|
+
To use the library in a project import the library module in the imports array of which module you are going to implement the library.
|
|
4
|
+
|
|
5
|
+
To use the dropdown add the selector '<lib-dropdown></lib-dropdown>' in the position where you need the dropdown.
|
|
6
|
+
|
|
7
|
+
## Attribute List
|
|
8
|
+
|
|
9
|
+
1. items - It takes an array of objects as input and iterate the array to show the options in dropdown.
|
|
10
|
+
|
|
11
|
+
2. label - label specifies the attribute name that has to be shown as the options in dropdown.
|
|
12
|
+
|
|
13
|
+
3. multiple - It is a boolean variable to define whether the dropdown is single selection or multi selection.By default it will be single selection.
|
|
14
|
+
|
|
15
|
+
4. selectedItems - Its a two way binding attribute which is used to get the selected values from the dropdown.
|
|
16
|
+
|
|
17
|
+
5. placeholder - String attribute to hold the value for showing placeholder of dropdown.
|
|
18
|
+
|
|
19
|
+
6. customButtons - It takes an array of objects as input for the custom buttons. Each object contains 4 elements
|
|
20
|
+
|
|
21
|
+
label - Specifies button name.
|
|
22
|
+
|
|
23
|
+
icon - It should be a font awesome icon class name for showing the icon as button.
|
|
24
|
+
|
|
25
|
+
color - For styling the button.
|
|
26
|
+
|
|
27
|
+
action - Specifies the function that should be called when the button is clicked.
|
|
28
|
+
|
|
29
|
+
7. onScroll - Define a function that should be called when scrolled to the bottom of the dropdown.
|
|
30
|
+
|
|
31
|
+
8. showCreateNew - Boolean variable to show and hide create new button.
|
|
32
|
+
|
|
33
|
+
9. createNewEvent - Define a function that should be called when createNew button is clicked.
|
|
34
|
+
|
|
35
|
+
10. onSearch - If apiSearch is true, through this attribute we can get the searchTerm for performing api search.
|
|
36
|
+
|
|
37
|
+
11. showBorder - A boolean variable to show and hide the border of dropdown. By default it will be true.
|
|
38
|
+
|
|
39
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
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>
|
|
@@ -0,0 +1,8 @@
|
|
|
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>
|
|
@@ -0,0 +1,8 @@
|
|
|
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>
|
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,29 +1,16 @@
|
|
|
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
|
-
|
|
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
|
+
{
|
|
2
|
+
"name": "@piserve-tech/drop-down",
|
|
3
|
+
"version": "1.2.110",
|
|
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
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<div
|
|
2
|
+
#dropdown
|
|
3
|
+
class="dropdown"
|
|
4
|
+
[ngClass]="{
|
|
5
|
+
opened: showBorder && dropdownOpened,
|
|
6
|
+
closed: showBorder && !dropdownOpened,
|
|
7
|
+
'dropdown-disabled': disable
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
class="dropdown-field"
|
|
12
|
+
id="division"
|
|
13
|
+
[ngClass]="{
|
|
14
|
+
opened: showBorder && dropdownOpened,
|
|
15
|
+
closed: showBorder && !dropdownOpened,
|
|
16
|
+
}"
|
|
17
|
+
(click)="openDropdown()"
|
|
18
|
+
>
|
|
19
|
+
<!-- <div *ngIf="selectedValues !== '' && !selectedItemName" class="selected">
|
|
20
|
+
{{ selectedValues }}
|
|
21
|
+
</div> -->
|
|
22
|
+
<div class="flexSection">
|
|
23
|
+
<div class="dataSection" *ngIf="!selectedItem && multiple">
|
|
24
|
+
<div class="selected selectedList">
|
|
25
|
+
<ng-container *ngFor="let selectedItem of selectedItems">
|
|
26
|
+
<div class="selected-item">
|
|
27
|
+
<img
|
|
28
|
+
*ngIf="selectedItem?.image"
|
|
29
|
+
class="multiSelected-icon-size"
|
|
30
|
+
[src]="selectedItem?.image"
|
|
31
|
+
alt="image"
|
|
32
|
+
/>
|
|
33
|
+
<span>{{ selectedItem.label }}</span>
|
|
34
|
+
<span (click)="unselectItem(selectedItem)" class="close-icon"
|
|
35
|
+
>×</span
|
|
36
|
+
>
|
|
37
|
+
</div>
|
|
38
|
+
</ng-container>
|
|
39
|
+
|
|
40
|
+
<div class="input-field">
|
|
41
|
+
<input
|
|
42
|
+
[id]="'searchInput-' + dropdownId"
|
|
43
|
+
class="dropdown_text inline-input"
|
|
44
|
+
[(ngModel)]="searchText"
|
|
45
|
+
[placeholder]="placeholder"
|
|
46
|
+
(input)="search($event)"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="dataSection single-input" *ngIf="!multiple">
|
|
52
|
+
<div class="input-field">
|
|
53
|
+
<div class="input-with-icon">
|
|
54
|
+
<img
|
|
55
|
+
*ngIf="selectedItemImage"
|
|
56
|
+
class="selected-icon-size"
|
|
57
|
+
[src]="selectedItemImage"
|
|
58
|
+
alt="image"
|
|
59
|
+
/>
|
|
60
|
+
<input
|
|
61
|
+
[id]="'searchInput-' + dropdownId"
|
|
62
|
+
class="dropdown_text inline-input"
|
|
63
|
+
[placeholder]="placeholder"
|
|
64
|
+
[(ngModel)]="selectedItemName"
|
|
65
|
+
(input)="search($event)"
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="iconSection">
|
|
71
|
+
<div class="dropdown-icons-container">
|
|
72
|
+
<div>
|
|
73
|
+
<span
|
|
74
|
+
(click)="unselectAll()"
|
|
75
|
+
*ngIf="selectedItems.length > 0 && multiple"
|
|
76
|
+
class="deselect"
|
|
77
|
+
>×
|
|
78
|
+
</span>
|
|
79
|
+
</div>
|
|
80
|
+
<div
|
|
81
|
+
class="dropdown-down-arrow"
|
|
82
|
+
[ngClass]="{ opened: dropdownOpened, closed: !dropdownOpened }"
|
|
83
|
+
>
|
|
84
|
+
<svg
|
|
85
|
+
width="1em"
|
|
86
|
+
viewBox="0 0 24 25"
|
|
87
|
+
fill="none"
|
|
88
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
89
|
+
class="down-arrow-img"
|
|
90
|
+
>
|
|
91
|
+
<g id="Down Arrow">
|
|
92
|
+
<g id="Group">
|
|
93
|
+
<path
|
|
94
|
+
id="Path"
|
|
95
|
+
d="M6 9.13741L12 15.229L18 9.13741"
|
|
96
|
+
stroke="#8E9AA0"
|
|
97
|
+
stroke-width="1.5"
|
|
98
|
+
stroke-linecap="round"
|
|
99
|
+
stroke-linejoin="round"
|
|
100
|
+
/>
|
|
101
|
+
</g>
|
|
102
|
+
</g>
|
|
103
|
+
</svg>
|
|
104
|
+
</div>
|
|
105
|
+
<div
|
|
106
|
+
class="dropdown-up-arrow"
|
|
107
|
+
[ngClass]="{ opened: dropdownOpened, closed: !dropdownOpened }"
|
|
108
|
+
>
|
|
109
|
+
<svg
|
|
110
|
+
width="1em"
|
|
111
|
+
viewBox="0 0 24 25"
|
|
112
|
+
fill="none"
|
|
113
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
114
|
+
class="up-arrow-img"
|
|
115
|
+
>
|
|
116
|
+
<path
|
|
117
|
+
d="M18 15.229L12 9.1374L6 15.229"
|
|
118
|
+
stroke="#8E9AA0"
|
|
119
|
+
stroke-width="1.5"
|
|
120
|
+
stroke-linecap="round"
|
|
121
|
+
stroke-linejoin="round"
|
|
122
|
+
/>
|
|
123
|
+
</svg>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div
|
|
131
|
+
#dropdownItems
|
|
132
|
+
class="dropdown-items"
|
|
133
|
+
*ngIf="dropdownOpened"
|
|
134
|
+
(scroll)="dropdownScroll($event)"
|
|
135
|
+
>
|
|
136
|
+
<div (click)="createNew()">
|
|
137
|
+
<a class="create_button" *ngIf="showCreateNew">Create new</a>
|
|
138
|
+
</div>
|
|
139
|
+
<ng-container *ngIf="items.length > 0; else noDataAvailable">
|
|
140
|
+
<ng-container *ngIf="multiple; else singleSelection">
|
|
141
|
+
<a
|
|
142
|
+
[ngClass]="{
|
|
143
|
+
compact: !item?.image && !item?.subLabel,
|
|
144
|
+
expanded: item?.image || item?.subLabel
|
|
145
|
+
}"
|
|
146
|
+
class="items d-block"
|
|
147
|
+
*ngFor="let item of _filteredItems"
|
|
148
|
+
(click)="selectItem(item)"
|
|
149
|
+
>
|
|
150
|
+
<div class="dropdown-item">
|
|
151
|
+
<div class="item-details">
|
|
152
|
+
<div class="content-wrapper">
|
|
153
|
+
<img
|
|
154
|
+
*ngIf="item?.image"
|
|
155
|
+
[src]="item?.image"
|
|
156
|
+
alt="Item Image"
|
|
157
|
+
class="item-image icon-size"
|
|
158
|
+
/>
|
|
159
|
+
<div class="text-content">
|
|
160
|
+
<div
|
|
161
|
+
class="item-label"
|
|
162
|
+
[innerHTML]="highlightMatch(item.label)"
|
|
163
|
+
></div>
|
|
164
|
+
<div *ngIf="showSubLabel" class="item-sublabel">
|
|
165
|
+
{{ item?.subLabel }}
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
<div
|
|
170
|
+
class="dropdown_buttons"
|
|
171
|
+
[class.empty]="customButtons.length === 0"
|
|
172
|
+
>
|
|
173
|
+
<button
|
|
174
|
+
*ngFor="let button of customButtons"
|
|
175
|
+
(click)="handleButtonClick(button.action)"
|
|
176
|
+
>
|
|
177
|
+
<i [class]="button.icon" [style.color]="button.color"></i>
|
|
178
|
+
</button>
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
</a>
|
|
183
|
+
</ng-container>
|
|
184
|
+
|
|
185
|
+
<ng-template #singleSelection>
|
|
186
|
+
<a
|
|
187
|
+
class="items d-block"
|
|
188
|
+
[ngClass]="{
|
|
189
|
+
compact: !item?.image && !item?.subLabel,
|
|
190
|
+
expanded: item?.image || item?.subLabel
|
|
191
|
+
}"
|
|
192
|
+
*ngFor="let item of _filteredItems"
|
|
193
|
+
(click)="selectItem(item)"
|
|
194
|
+
>
|
|
195
|
+
<div class="dropdown-item">
|
|
196
|
+
<div class="item-details">
|
|
197
|
+
<div class="content-wrapper">
|
|
198
|
+
<img
|
|
199
|
+
*ngIf="item?.image"
|
|
200
|
+
[src]="item?.image"
|
|
201
|
+
alt="Item Image"
|
|
202
|
+
class="item-image icon-size"
|
|
203
|
+
/>
|
|
204
|
+
<div class="text-content">
|
|
205
|
+
<div
|
|
206
|
+
class="item-label"
|
|
207
|
+
[innerHTML]="highlightMatch(item.label)"
|
|
208
|
+
></div>
|
|
209
|
+
<div *ngIf="showSubLabel" class="item-sublabel">
|
|
210
|
+
{{ item?.subLabel }}
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
<div
|
|
215
|
+
class="dropdown_buttons"
|
|
216
|
+
[class.empty]="customButtons.length === 0"
|
|
217
|
+
>
|
|
218
|
+
<button
|
|
219
|
+
*ngFor="let button of customButtons"
|
|
220
|
+
(click)="handleButtonClick(button.action)"
|
|
221
|
+
>
|
|
222
|
+
<i [class]="button.icon" [style.color]="button.color"></i>
|
|
223
|
+
</button>
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
</a>
|
|
228
|
+
</ng-template>
|
|
229
|
+
</ng-container>
|
|
230
|
+
|
|
231
|
+
<!-- "No data available" message if the drop down is empty -->
|
|
232
|
+
<ng-template #noDataAvailable>
|
|
233
|
+
<div class="items">No data available</div>
|
|
234
|
+
</ng-template>
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|