ng-jvx-multiselect 18.0.0 → 18.0.2

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.
Files changed (26) hide show
  1. package/README.md +11 -28
  2. package/esm2022/lib/chiplist/chip/chip.component.mjs +27 -0
  3. package/esm2022/lib/directives/ng-jvx-disabled-option.directive.mjs +4 -4
  4. package/esm2022/lib/directives/ng-jvx-focus.directive.mjs +4 -4
  5. package/esm2022/lib/directives/ng-jvx-group-header.directive.mjs +4 -4
  6. package/esm2022/lib/directives/ng-jvx-options-template.directive.mjs +4 -4
  7. package/esm2022/lib/directives/ng-jvx-selection-template.directive.mjs +4 -4
  8. package/esm2022/lib/ng-jvx-multiselect.component.mjs +60 -31
  9. package/esm2022/lib/ng-jvx-multiselect.module.mjs +17 -36
  10. package/esm2022/lib/ng-jvx-multiselect.service.mjs +4 -4
  11. package/esm2022/lib/ng-jvx-option/ng-jvx-option.component.mjs +12 -23
  12. package/esm2022/lib/panel/menu-trigger/menu-trigger.directive.mjs +79 -0
  13. package/esm2022/lib/panel/panel.component.mjs +129 -0
  14. package/fesm2022/ng-jvx-multiselect.mjs +328 -110
  15. package/fesm2022/ng-jvx-multiselect.mjs.map +1 -1
  16. package/lib/chiplist/chip/chip.component.d.ts +9 -0
  17. package/lib/ng-jvx-multiselect.component.d.ts +7 -7
  18. package/lib/ng-jvx-multiselect.module.d.ts +15 -19
  19. package/lib/ng-jvx-option/ng-jvx-option.component.d.ts +7 -10
  20. package/lib/panel/menu-trigger/menu-trigger.directive.d.ts +25 -0
  21. package/lib/panel/panel.component.d.ts +19 -0
  22. package/package.json +3 -3
  23. package/src/lib/chiplist/chip/chip.component.scss +32 -0
  24. package/src/lib/ng-jvx-multiselect.component.scss +119 -208
  25. package/src/lib/ng-jvx-option/ng-jvx-option.component.scss +6 -13
  26. package/src/lib/panel/panel.component.scss +10 -0
@@ -0,0 +1,19 @@
1
+ import { ElementRef, EventEmitter, OnDestroy, TemplateRef } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class PanelComponent implements OnDestroy {
4
+ menuTemplate: TemplateRef<any>;
5
+ protected isOpen: import("@angular/core").WritableSignal<boolean>;
6
+ private unsubscribe;
7
+ trigger: ElementRef<any>;
8
+ yPosition: 'above' | 'below';
9
+ onClose: EventEmitter<void>;
10
+ onClosed: EventEmitter<void>;
11
+ onOpened: EventEmitter<void>;
12
+ constructor();
13
+ ngOnDestroy(): void;
14
+ open(): void;
15
+ close(): void;
16
+ protected clickOnMenu(): void;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<PanelComponent, never>;
18
+ static ɵcmp: i0.ɵɵComponentDeclaration<PanelComponent, "lib-panel", never, { "trigger": { "alias": "trigger"; "required": false; }; "yPosition": { "alias": "yPosition"; "required": false; }; }, { "onClose": "onClose"; "onClosed": "onClosed"; "onOpened": "onOpened"; }, never, ["*"], true, never>;
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-jvx-multiselect",
3
- "version": "18.0.0",
3
+ "version": "18.0.2",
4
4
  "license": "MIT",
5
5
  "description": "ng-jvx-multiselect is a select based on angular material. It handles both single and multiple selections and allows to retrieves the options via asynchronous calls.",
6
6
  "exports": {
@@ -18,8 +18,8 @@
18
18
  "peerDependencies": {
19
19
  "@angular/common": "^18.0.5",
20
20
  "@angular/core": "^18.0.5",
21
- "@angular/material": "^18.0.5",
22
- "ngx-scrollbar": "^13.0.3"
21
+ "ngx-scrollbar": "^13.0.3",
22
+ "@angular/cdk": "^18.0.5"
23
23
  },
24
24
  "dependencies": {
25
25
  "tslib": "^2.0.0"
@@ -0,0 +1,32 @@
1
+ lib-chip{
2
+ > div{
3
+ padding: 0 .2rem;
4
+ height: 1.8rem;
5
+ font-size: 1rem;
6
+ line-height: 1.5rem;
7
+ border-radius: 1rem;
8
+ width: auto;
9
+ background-color: var(--jvx-multiselect-primary);
10
+ color: var(--jvx-multiselect-on-primary);
11
+ display: flex;
12
+ align-items: center;
13
+ .chip-text{
14
+ flex: 1 1 100%;
15
+ padding-inline: .5rem;
16
+ }
17
+ .remove-button{
18
+ cursor: pointer;
19
+ color: var(--jvx-multiselect-on-primary);
20
+ }
21
+ &.disabled{
22
+ background-color: #c2c3c4;
23
+ color: currentColor;
24
+ .chip-text {
25
+ pointer-events: none;
26
+ }
27
+ .remove-button{
28
+ color: currentColor;
29
+ }
30
+ }
31
+ }
32
+ }
@@ -1,260 +1,171 @@
1
- @use '@angular/material' as mat;
2
1
  @use 'sass:map';
3
2
 
4
- $primary: var(--jvx-multiselect-primary);
5
- $accent: var(--jvx-multiselect-accent);
6
- $warn: var(--jvx-multiselect-warn);
7
- ng-jvx-multiselect {
3
+ $primary: var(--jvx-multiselect-primary);
4
+ $accent: var(--jvx-multiselect-accent);
5
+ $warn: var(--jvx-multiselect-warn);
6
+ ng-jvx-multiselect {
7
+ display: flex;
8
+ align-items: center;
9
+ width: 100%;
10
+
11
+ .ng-jvx-multiselect {
12
+ width: 100%;
8
13
  display: flex;
9
14
  align-items: center;
10
- width: 100%;
11
15
 
12
- .ng-jvx-multiselect {
16
+ .ng-jvx-multiselect-value-container {
13
17
  width: 100%;
14
18
  display: flex;
19
+ cursor: pointer;
20
+ position: relative;
21
+ justify-content: space-between;
15
22
  align-items: center;
16
23
 
17
- .ng-jvx-multiselect-value-container {
18
- width: 100%;
24
+ .ng-jvx-multiselect__placeholder {
25
+ height: 100%;
19
26
  display: flex;
20
- cursor: pointer;
21
- position: relative;
22
- justify-content: space-between;
23
27
  align-items: center;
28
+ position: absolute;
29
+ }
24
30
 
25
- .ng-jvx-multiselect__placeholder {
26
- height: 100%;
27
- display: flex;
28
- align-items: center;
29
- position: absolute;
30
- }
31
-
32
- .ng-jvx-multiselect-value {
33
- flex: 1 1 100%;
34
- max-width: calc(100% - 28px);
35
- display: flex;
36
- align-items: center;
37
- /* TODO(mdc-migration): The following rule targets internal classes of chips that may no longer apply for the MDC version. */
38
- /* TODO(mdc-migration): The following rule targets internal classes of chips that may no longer apply for the MDC version. */
39
- .mat-chip-list-wrapper {
40
- .mat-mdc-standard-chip {
41
- padding: 0 5px 0 7px;
42
- margin: 4px 5px 0;
31
+ .ng-jvx-multiselect-value {
32
+ flex: 1 1 100%;
33
+ max-width: calc(100% - 28px);
34
+ display: flex;
35
+ align-items: center;
36
+ }
43
37
 
44
- .chip-content {
45
- margin-left: 4px;
46
- white-space: nowrap;
47
- overflow: hidden;
48
- text-overflow: ellipsis;
49
- display: inline-block;
50
- }
51
- }
52
- }
53
38
 
54
- }
39
+ .ng-jvx-multiselect__remove-button {
40
+ display: flex;
41
+ height: 100%;
42
+ align-items: center;
43
+ }
55
44
 
45
+ .ng-jvx-multiselect-arrow {
46
+ width: 24px;
47
+ padding-right: 4px;
48
+ display: flex;
49
+ align-items: center;
50
+ height: 24px;
56
51
 
57
- .ng-jvx-multiselect__remove-button {
58
- display: flex;
59
- height: 100%;
60
- align-items: center;
52
+ svg {
53
+ transition: transform 0.3s ease-in-out;
61
54
  }
62
55
 
63
- .ng-jvx-multiselect-arrow {
64
- width: 24px;
65
- padding-right: 4px;
66
- display: flex;
67
- align-items: center;
68
-
69
- mat-icon {
70
- transition: transform 0.3s ease-in-out;
56
+ @keyframes lds-ring {
57
+ 0% {
58
+ transform: rotate(0deg);
71
59
  }
72
-
73
- @keyframes lds-ring {
74
- 0% {
75
- transform: rotate(0deg);
76
- }
77
- 100% {
78
- transform: rotate(360deg);
79
- }
60
+ 100% {
61
+ transform: rotate(360deg);
80
62
  }
63
+ }
81
64
 
82
- .lds-ring {
83
- display: inline-block;
84
- position: relative;
85
- width: 24px;
86
- height: 24px;
87
-
88
- div {
89
- box-sizing: border-box;
90
- display: block;
91
- position: absolute;
92
- width: 6px;
93
- height: 16px;
94
- margin: 4px;
95
- border: 2px solid;
96
- border-radius: 50%;
97
- animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
98
- border-color: #{$accent} transparent transparent transparent;
99
-
100
- &:nth-child(1) {
101
- animation-delay: -0.45s;
102
- }
103
-
104
- &:nth-child(2) {
105
- animation-delay: -0.3s;
106
- }
65
+ .lds-ring {
66
+ display: inline-block;
67
+ position: relative;
68
+ width: 24px;
69
+ height: 24px;
70
+
71
+ div {
72
+ box-sizing: border-box;
73
+ display: block;
74
+ position: absolute;
75
+ width: 6px;
76
+ height: 16px;
77
+ margin: 4px;
78
+ border: 2px solid;
79
+ border-radius: 50%;
80
+ animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
81
+ border-color: #{$accent} transparent transparent transparent;
82
+
83
+ &:nth-child(1) {
84
+ animation-delay: -0.45s;
85
+ }
107
86
 
108
- &:nth-child(3) {
109
- animation-delay: -0.15s;
110
- }
87
+ &:nth-child(2) {
88
+ animation-delay: -0.3s;
111
89
  }
112
- }
113
- }
114
90
 
115
- &.is-open {
116
- .ng-jvx-multiselect-arrow {
117
- mat-icon {
118
- transform: rotate(180deg);
91
+ &:nth-child(3) {
92
+ animation-delay: -0.15s;
119
93
  }
120
94
  }
121
95
  }
122
-
123
96
  }
124
97
 
125
- &.disabled {
126
- pointer-events: none;
127
-
98
+ &.is-open {
128
99
  .ng-jvx-multiselect-arrow {
129
- mat-icon {
130
- opacity: 0.3;
100
+ svg {
101
+ transform: rotate(180deg);
131
102
  }
132
103
  }
133
104
  }
134
105
 
135
- &.has-errors {
136
- color: red;
106
+ }
137
107
 
138
- .ng-jvx-multiselect-value {
139
- &.single-value-container {
140
- color: red;
141
- }
108
+ &.disabled {
109
+ pointer-events: none;
142
110
 
143
- &.multi-value-container {
144
- width: 100%;
145
- }
146
- }
147
-
148
- .ng-jvx-multiselect-arrow {
149
- mat-icon {
150
- color: red;
151
- }
111
+ .ng-jvx-multiselect-arrow {
112
+ svg {
113
+ opacity: 0.3;
152
114
  }
153
115
  }
154
116
  }
155
- }
156
- /* TODO(mdc-migration): The following rule targets internal classes of select that may no longer apply for the MDC version. */
157
- .mat-select-test {
158
- width: 250px;
159
- }
160
117
 
161
- .menu-list-container {
162
- max-height: 300px;
163
- display: flex;
164
- flex-direction: column;
165
- }
166
- .menu-footer {
167
- max-height: 30px;
168
- overflow: hidden;
169
- }
170
- .cdk-overlay-pane {
171
- .mat-mdc-menu-panel.jvx-multiselect-panel {
172
- //min-width: 100%;
173
- max-width: 100%;
174
- position: relative;
175
- overflow: visible;
118
+ &.has-errors {
119
+ color: red;
176
120
 
177
- .closeMenuButton {
178
- height: 22px;
179
- width: 22px;
180
- background-color: #{$primary};
181
- position: absolute;
182
- top: -11px;
183
- right: 11px;
184
- border-radius: 100%;
185
- cursor: pointer;
186
- color: #fff;
187
- z-index: 10;
121
+ .ng-jvx-multiselect-value {
122
+ &.single-value-container {
123
+ color: red;
124
+ }
188
125
 
189
- mat-icon {
190
- color: #fff;
191
- font-size: 15px;
192
- height: 100%;
126
+ &.multi-value-container {
193
127
  width: 100%;
194
- display: flex;
195
- align-items: center;
196
- justify-content: center;
197
128
  }
198
129
  }
199
130
 
200
- .mat-mdc-menu-content {
201
- padding-top: 0 !important;
202
- padding-bottom: 0 !important;
203
-
204
- .menu-list-container {
205
- ng-scrollbar {
206
- --scrollbar-color: transparent;
207
- --scrollbar-container-color: transparent;
208
- --scrollbar-thumb-color: #{$accent};
209
- --scrollbar-thumb-hover-color: #{$accent};
210
- --scrollbar-border-radius: 4px;
211
- --scrollbar-size: 6px;
212
- --scrollbar-padding: 8px;
213
- --scroll-view-margin: 0;
214
- --scroll-view-color: transparent;
215
- }
131
+ .ng-jvx-multiselect-arrow {
132
+ svg {
133
+ color: red;
216
134
  }
135
+ }
136
+ }
137
+ }
138
+ }
217
139
 
218
- .search-input-container {
219
- height: 40px;
220
- display: flex;
221
- align-items: center;
222
- padding: 10px;
223
-
224
- input {
225
- width: 100%;
226
- outline: none;
227
- border: none;
228
-
229
- &:focus {
230
- outline: none;
231
- }
232
-
233
- &:active {
234
- outline: none
235
- }
236
- }
237
- }
238
-
239
- .mat-mdc-selection-list {
240
- padding-top: 0 !important;
241
- padding-bottom: 0 !important;
242
-
243
- .mat-mdc-list-option[aria-selected="true"], .mat-mdc-list-option[aria-selected="false"] {
244
- .ng-jvx-option-wrapper{
245
- padding-inline: 10px;
246
- }
247
- .mdc-list-item__end {
248
- display: none;
140
+ .menu-list-container {
141
+ max-height: 300px;
142
+ display: flex;
143
+ flex-direction: column;
144
+ }
249
145
 
250
- }
251
- //.mdc-checkbox {
252
- // display: none
253
- //}
254
- }
255
- }
146
+ .menu-footer {
147
+ max-height: 30px;
148
+ overflow: hidden;
149
+ }
256
150
 
257
- }
151
+ .cdk-overlay-pane {
152
+ .closeMenuButton {
153
+ height: 22px;
154
+ width: 22px;
155
+ background-color: #{$primary};
156
+ position: absolute;
157
+ top: -11px;
158
+ right: 11px;
159
+ border-radius: 100%;
160
+ cursor: pointer;
161
+ color: #fff;
162
+ z-index: 10;
163
+
164
+ svg {
165
+ fill: var(--jvx-multiselect-on-primary);
166
+ font-size: 15px;
167
+ height: 100%;
168
+ width: 100%;
258
169
  }
259
-
170
+ }
260
171
  }
@@ -1,25 +1,17 @@
1
- @use '@angular/material' as mat;
2
1
  @use 'sass:map';
3
2
 
4
3
  $primary: var(--jvx-multiselect-primary);
5
4
  $accent: var(--jvx-multiselect-accent);
6
5
  $warn: var(--jvx-multiselect-warn);
7
6
  ng-jvx-option {
8
- .mat-mdc-list-item.mat-mdc-list-option.ng-jvx-option {
7
+ .ng-jvx-option {
9
8
  padding: 0;
10
9
  height: auto;
11
10
  min-height: 48px;
11
+ cursor: pointer;
12
+ position: relative;
12
13
 
13
-
14
- .mat-list-text {
15
- min-height: 48px;
16
- display: flex;
17
- justify-content: center;
18
- }
19
-
20
- &[aria-selected="true"] {
21
-
22
- color: #{$primary};
14
+ &.ng-jvx-single-selected-option {
23
15
 
24
16
  .list-option-background {
25
17
  position: absolute;
@@ -29,7 +21,8 @@ ng-jvx-option {
29
21
  opacity: 0.45;
30
22
  height: 100%;
31
23
  width: 100%;
32
- background: #{$primary};
24
+ background-color: #{$primary};
25
+ background-opacity: .3;
33
26
  }
34
27
  }
35
28
  }
@@ -0,0 +1,10 @@
1
+ @import '@angular/cdk/overlay-prebuilt';
2
+
3
+ .ng-jvx-panel{
4
+ display: inline-block;
5
+ box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, .2), 0px 2px 2px 0px rgba(0, 0, 0, .14), 0px 1px 5px 0px rgba(0, 0, 0, .12);
6
+ background: var(--jvx-multiselect-panel-bg);
7
+ }
8
+ .ng-jvx-panel-overlay{
9
+ background-opacity: 0;
10
+ }