primeng 8.0.2 → 8.1.1
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/CHANGELOG.md +135 -0
- package/components/accordion/accordion.js +3 -1
- package/components/accordion/accordion.js.map +1 -1
- package/components/accordion/accordion.metadata.json +1 -1
- package/components/autocomplete/autocomplete.d.ts +3 -0
- package/components/autocomplete/autocomplete.js +18 -3
- package/components/autocomplete/autocomplete.js.map +1 -1
- package/components/autocomplete/autocomplete.metadata.json +1 -1
- package/components/breadcrumb/breadcrumb.js +1 -1
- package/components/breadcrumb/breadcrumb.js.map +1 -1
- package/components/breadcrumb/breadcrumb.metadata.json +1 -1
- package/components/button/button.js +1 -1
- package/components/button/button.js.map +1 -1
- package/components/button/button.metadata.json +1 -1
- package/components/calendar/calendar.d.ts +1 -0
- package/components/calendar/calendar.js +23 -5
- package/components/calendar/calendar.js.map +1 -1
- package/components/calendar/calendar.metadata.json +1 -1
- package/components/carousel/carousel.d.ts +66 -47
- package/components/carousel/carousel.js +406 -197
- package/components/carousel/carousel.js.map +1 -1
- package/components/carousel/carousel.metadata.json +1 -1
- package/components/checkbox/checkbox.d.ts +1 -0
- package/components/checkbox/checkbox.js +10 -4
- package/components/checkbox/checkbox.js.map +1 -1
- package/components/checkbox/checkbox.metadata.json +1 -1
- package/components/common/api.d.ts +1 -0
- package/components/common/api.js +2 -0
- package/components/common/api.js.map +1 -1
- package/components/common/api.metadata.json +1 -1
- package/components/common/menuitem.d.ts +1 -0
- package/components/confirmdialog/confirmdialog.d.ts +1 -0
- package/components/confirmdialog/confirmdialog.js +34 -3
- package/components/confirmdialog/confirmdialog.js.map +1 -1
- package/components/confirmdialog/confirmdialog.metadata.json +1 -1
- package/components/contextmenu/contextmenu.d.ts +3 -1
- package/components/contextmenu/contextmenu.js +22 -8
- package/components/contextmenu/contextmenu.js.map +1 -1
- package/components/contextmenu/contextmenu.metadata.json +1 -1
- package/components/dataview/dataview.d.ts +1 -1
- package/components/dataview/dataview.js +4 -2
- package/components/dataview/dataview.js.map +1 -1
- package/components/dataview/dataview.metadata.json +1 -1
- package/components/dialog/dialog.js +7 -3
- package/components/dialog/dialog.js.map +1 -1
- package/components/dialog/dialog.metadata.json +1 -1
- package/components/dragdrop/dragdrop.d.ts +2 -1
- package/components/dragdrop/dragdrop.js +23 -5
- package/components/dragdrop/dragdrop.js.map +1 -1
- package/components/dragdrop/dragdrop.metadata.json +1 -1
- package/components/dropdown/dropdown.d.ts +13 -5
- package/components/dropdown/dropdown.js +82 -33
- package/components/dropdown/dropdown.js.map +1 -1
- package/components/dropdown/dropdown.metadata.json +1 -1
- package/components/focustrap/focustrap.js +1 -1
- package/components/focustrap/focustrap.js.map +1 -1
- package/components/inplace/inplace.d.ts +2 -2
- package/components/inplace/inplace.js.map +1 -1
- package/components/inputmask/inputmask.js +1 -1
- package/components/inputmask/inputmask.js.map +1 -1
- package/components/inputmask/inputmask.metadata.json +1 -1
- package/components/inputtextarea/inputtextarea.js +1 -0
- package/components/inputtextarea/inputtextarea.js.map +1 -1
- package/components/inputtextarea/inputtextarea.metadata.json +1 -1
- package/components/listbox/listbox.d.ts +2 -0
- package/components/listbox/listbox.js +41 -13
- package/components/listbox/listbox.js.map +1 -1
- package/components/listbox/listbox.metadata.json +1 -1
- package/components/megamenu/megamenu.js +1 -1
- package/components/megamenu/megamenu.js.map +1 -1
- package/components/megamenu/megamenu.metadata.json +1 -1
- package/components/menu/menu.js +1 -1
- package/components/menu/menu.js.map +1 -1
- package/components/menu/menu.metadata.json +1 -1
- package/components/menubar/menubar.d.ts +5 -3
- package/components/menubar/menubar.js +56 -33
- package/components/menubar/menubar.js.map +1 -1
- package/components/menubar/menubar.metadata.json +1 -1
- package/components/multiselect/multiselect.d.ts +7 -2
- package/components/multiselect/multiselect.js +40 -19
- package/components/multiselect/multiselect.js.map +1 -1
- package/components/multiselect/multiselect.metadata.json +1 -1
- package/components/orderlist/orderlist.d.ts +1 -0
- package/components/orderlist/orderlist.js +7 -1
- package/components/orderlist/orderlist.js.map +1 -1
- package/components/orderlist/orderlist.metadata.json +1 -1
- package/components/panelmenu/panelmenu.js +2 -2
- package/components/panelmenu/panelmenu.js.map +1 -1
- package/components/panelmenu/panelmenu.metadata.json +1 -1
- package/components/picklist/picklist.d.ts +1 -0
- package/components/picklist/picklist.js +8 -2
- package/components/picklist/picklist.js.map +1 -1
- package/components/picklist/picklist.metadata.json +1 -1
- package/components/slidemenu/slidemenu.js +1 -1
- package/components/slidemenu/slidemenu.js.map +1 -1
- package/components/slidemenu/slidemenu.metadata.json +1 -1
- package/components/slider/slider.d.ts +7 -1
- package/components/slider/slider.js +43 -1
- package/components/slider/slider.js.map +1 -1
- package/components/slider/slider.metadata.json +1 -1
- package/components/spinner/spinner.js +6 -0
- package/components/spinner/spinner.js.map +1 -1
- package/components/spinner/spinner.metadata.json +1 -1
- package/components/steps/steps.js +1 -1
- package/components/steps/steps.js.map +1 -1
- package/components/steps/steps.metadata.json +1 -1
- package/components/table/table.d.ts +3 -15
- package/components/table/table.js +15 -133
- package/components/table/table.js.map +1 -1
- package/components/table/table.metadata.json +1 -1
- package/components/tabmenu/tabmenu.js +3 -3
- package/components/tabmenu/tabmenu.js.map +1 -1
- package/components/tabmenu/tabmenu.metadata.json +1 -1
- package/components/tabview/tabview.d.ts +3 -0
- package/components/tabview/tabview.js +15 -1
- package/components/tabview/tabview.js.map +1 -1
- package/components/tabview/tabview.metadata.json +1 -1
- package/components/tieredmenu/tieredmenu.d.ts +14 -8
- package/components/tieredmenu/tieredmenu.js +89 -43
- package/components/tieredmenu/tieredmenu.js.map +1 -1
- package/components/tieredmenu/tieredmenu.metadata.json +1 -1
- package/components/tree/tree.js +9 -4
- package/components/tree/tree.js.map +1 -1
- package/components/tree/tree.metadata.json +1 -1
- package/components/treetable/treetable.d.ts +0 -12
- package/components/treetable/treetable.js +5 -122
- package/components/treetable/treetable.js.map +1 -1
- package/components/treetable/treetable.metadata.json +1 -1
- package/components/tristatecheckbox/tristatecheckbox.d.ts +1 -0
- package/components/tristatecheckbox/tristatecheckbox.js +7 -3
- package/components/tristatecheckbox/tristatecheckbox.js.map +1 -1
- package/components/tristatecheckbox/tristatecheckbox.metadata.json +1 -1
- package/components/utils/filterutils.d.ts +13 -0
- package/components/utils/filterutils.js +147 -0
- package/components/utils/filterutils.js.map +1 -0
- package/components/utils/filterutils.metadata.json +1 -0
- package/components/utils/objectutils.d.ts +0 -1
- package/components/utils/objectutils.js +0 -18
- package/components/utils/objectutils.js.map +1 -1
- package/components/utils/uniquecomponentid.d.ts +2 -0
- package/components/utils/uniquecomponentid.js +10 -0
- package/components/utils/uniquecomponentid.js.map +1 -0
- package/components/utils/uniquecomponentid.metadata.json +1 -0
- package/package.json +9 -5
- package/resources/components/carousel/carousel.css +57 -58
- package/resources/components/checkbox/checkbox.css +4 -0
- package/resources/components/colorpicker/images/color.png +0 -0
- package/resources/components/colorpicker/images/hue.png +0 -0
- package/resources/components/lightbox/images/loading.gif +0 -0
- package/resources/components/password/images/password-meter.png +0 -0
- package/resources/components/sidebar/sidebar.css +5 -1
- package/resources/components/table/table.css +4 -0
- package/resources/components/tree/images/line.gif +0 -0
- package/resources/primeng.css +608 -596
- package/resources/primeng.min.css +1 -1
- package/resources/themes/luna-amber/theme.css +2261 -2977
- package/resources/themes/luna-blue/theme.css +2253 -2969
- package/resources/themes/luna-green/theme.css +2253 -2969
- package/resources/themes/luna-pink/theme.css +2253 -2969
- package/resources/themes/nova-colored/theme.css +2267 -2983
- package/resources/themes/nova-dark/theme.css +2267 -2983
- package/resources/themes/nova-light/theme.css +2282 -2998
- package/resources/themes/rhea/theme.css +2250 -2966
- package/.editorconfig +0 -13
- package/.travis.yml +0 -23
- package/.vscode/settings.json +0 -2
@@ -10,29 +10,107 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
var core_1 = require("@angular/core");
|
13
|
-
var domhandler_1 = require("../dom/domhandler");
|
14
13
|
var shared_1 = require("../common/shared");
|
15
14
|
var common_1 = require("@angular/common");
|
15
|
+
var uniquecomponentid_1 = require("../utils/uniquecomponentid");
|
16
16
|
var Carousel = /** @class */ (function () {
|
17
|
-
function Carousel(el,
|
17
|
+
function Carousel(el, zone) {
|
18
18
|
this.el = el;
|
19
|
-
this.
|
20
|
-
this.
|
21
|
-
this.
|
22
|
-
this.
|
19
|
+
this.zone = zone;
|
20
|
+
this.orientation = "horizontal";
|
21
|
+
this.verticalViewPortHeight = "300px";
|
22
|
+
this.contentClass = "";
|
23
|
+
this.dotsContainerClass = "";
|
23
24
|
this.circular = false;
|
24
|
-
this.breakpoint = 560;
|
25
|
-
this.responsive = true;
|
26
25
|
this.autoplayInterval = 0;
|
27
|
-
this.effectDuration = '1s';
|
28
|
-
this.easing = 'ease-out';
|
29
|
-
this.pageLinks = 3;
|
30
26
|
this.onPage = new core_1.EventEmitter();
|
31
|
-
this.
|
32
|
-
this.
|
27
|
+
this._numVisible = 1;
|
28
|
+
this._numScroll = 1;
|
29
|
+
this._oldNumScroll = 0;
|
30
|
+
this.prevState = {
|
31
|
+
numScroll: 0,
|
32
|
+
numVisible: 0,
|
33
|
+
value: []
|
34
|
+
};
|
35
|
+
this.defaultNumScroll = 1;
|
36
|
+
this.defaultNumVisible = 1;
|
37
|
+
this._page = 0;
|
38
|
+
this.isRemainingItemsAdded = false;
|
39
|
+
this.remainingItems = 0;
|
40
|
+
this.totalShiftedItems = this.page * this.numScroll * -1;
|
33
41
|
}
|
42
|
+
Object.defineProperty(Carousel.prototype, "page", {
|
43
|
+
get: function () {
|
44
|
+
return this._page;
|
45
|
+
},
|
46
|
+
set: function (val) {
|
47
|
+
if (this.isCreated && val !== this._page) {
|
48
|
+
if (this.autoplayInterval) {
|
49
|
+
this.stopAutoplay();
|
50
|
+
this.allowAutoplay = false;
|
51
|
+
}
|
52
|
+
if (val > this._page && val < (this.totalDots() - 1)) {
|
53
|
+
this.step(-1, val);
|
54
|
+
}
|
55
|
+
else if (val < this._page && val !== 0) {
|
56
|
+
this.step(1, val);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
this._page = val;
|
60
|
+
},
|
61
|
+
enumerable: true,
|
62
|
+
configurable: true
|
63
|
+
});
|
64
|
+
Object.defineProperty(Carousel.prototype, "numVisible", {
|
65
|
+
get: function () {
|
66
|
+
return this._numVisible;
|
67
|
+
},
|
68
|
+
set: function (val) {
|
69
|
+
this._numVisible = val;
|
70
|
+
},
|
71
|
+
enumerable: true,
|
72
|
+
configurable: true
|
73
|
+
});
|
74
|
+
Object.defineProperty(Carousel.prototype, "numScroll", {
|
75
|
+
get: function () {
|
76
|
+
return this._numVisible;
|
77
|
+
},
|
78
|
+
set: function (val) {
|
79
|
+
this._numScroll = val;
|
80
|
+
},
|
81
|
+
enumerable: true,
|
82
|
+
configurable: true
|
83
|
+
});
|
84
|
+
Object.defineProperty(Carousel.prototype, "value", {
|
85
|
+
get: function () {
|
86
|
+
return this._value;
|
87
|
+
},
|
88
|
+
set: function (val) {
|
89
|
+
this._value = val;
|
90
|
+
if (this.circular && this._value) {
|
91
|
+
this.setCloneItems();
|
92
|
+
}
|
93
|
+
},
|
94
|
+
enumerable: true,
|
95
|
+
configurable: true
|
96
|
+
});
|
97
|
+
;
|
34
98
|
Carousel.prototype.ngAfterContentInit = function () {
|
35
99
|
var _this = this;
|
100
|
+
this.id = uniquecomponentid_1.UniqueComponentId();
|
101
|
+
this.allowAutoplay = !!this.autoplayInterval;
|
102
|
+
if (this.circular) {
|
103
|
+
this.setCloneItems();
|
104
|
+
}
|
105
|
+
if (this.responsiveOptions) {
|
106
|
+
this.defaultNumScroll = this._numScroll;
|
107
|
+
this.defaultNumVisible = this._numVisible;
|
108
|
+
}
|
109
|
+
this.createStyle();
|
110
|
+
this.calculatePosition();
|
111
|
+
if (this.responsiveOptions) {
|
112
|
+
this.bindDocumentListeners();
|
113
|
+
}
|
36
114
|
this.templates.forEach(function (item) {
|
37
115
|
switch (item.getType()) {
|
38
116
|
case 'item':
|
@@ -44,189 +122,317 @@ var Carousel = /** @class */ (function () {
|
|
44
122
|
}
|
45
123
|
});
|
46
124
|
};
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
125
|
+
Carousel.prototype.ngAfterContentChecked = function () {
|
126
|
+
var isCircular = this.isCircular();
|
127
|
+
var totalShiftedItems = this.totalShiftedItems;
|
128
|
+
if (this.value && (this.prevState.numScroll !== this._numScroll || this.prevState.numVisible !== this._numVisible || this.prevState.value.length !== this.value.length)) {
|
129
|
+
if (this.autoplayInterval) {
|
130
|
+
this.stopAutoplay();
|
131
|
+
}
|
132
|
+
this.remainingItems = (this.value.length - this._numVisible) % this._numScroll;
|
133
|
+
var page = this._page;
|
134
|
+
if (this.totalDots() !== 0 && page >= this.totalDots()) {
|
135
|
+
page = this.totalDots() - 1;
|
136
|
+
this._page = page;
|
137
|
+
this.onPage.emit({
|
138
|
+
page: this.page
|
139
|
+
});
|
140
|
+
}
|
141
|
+
totalShiftedItems = (page * this._numScroll) * -1;
|
142
|
+
if (isCircular) {
|
143
|
+
totalShiftedItems -= this._numVisible;
|
144
|
+
}
|
145
|
+
if (page === (this.totalDots() - 1) && this.remainingItems > 0) {
|
146
|
+
totalShiftedItems += (-1 * this.remainingItems) + this._numScroll;
|
147
|
+
this.isRemainingItemsAdded = true;
|
148
|
+
}
|
149
|
+
else {
|
150
|
+
this.isRemainingItemsAdded = false;
|
151
|
+
}
|
152
|
+
if (totalShiftedItems !== this.totalShiftedItems) {
|
153
|
+
this.totalShiftedItems = totalShiftedItems;
|
154
|
+
}
|
155
|
+
this._oldNumScroll = this._numScroll;
|
156
|
+
this.prevState.numScroll = this._numScroll;
|
157
|
+
this.prevState.numVisible = this._numVisible;
|
158
|
+
this.prevState.value = this._value;
|
159
|
+
this.itemsContainer.nativeElement.style.transform = this.isVertical() ? "translate3d(0, " + totalShiftedItems * (100 / this._numVisible) + "%, 0)" : "translate3d(" + totalShiftedItems * (100 / this._numVisible) + "%, 0, 0)";
|
160
|
+
this.isCreated = true;
|
161
|
+
if (this.autoplayInterval && this.isAutoplay()) {
|
162
|
+
this.startAutoplay();
|
62
163
|
}
|
63
164
|
}
|
64
|
-
|
65
|
-
this.
|
165
|
+
if (isCircular) {
|
166
|
+
if (this.page === 0) {
|
167
|
+
totalShiftedItems = -1 * this._numVisible;
|
168
|
+
}
|
169
|
+
else if (totalShiftedItems === 0) {
|
170
|
+
totalShiftedItems = -1 * this.value.length;
|
171
|
+
if (this.remainingItems > 0) {
|
172
|
+
this.isRemainingItemsAdded = true;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
if (totalShiftedItems !== this.totalShiftedItems) {
|
176
|
+
this.totalShiftedItems = totalShiftedItems;
|
177
|
+
}
|
66
178
|
}
|
67
|
-
this.valuesChanged = true;
|
68
179
|
};
|
69
|
-
Carousel.prototype.
|
70
|
-
if (this.
|
71
|
-
this.
|
72
|
-
this.
|
180
|
+
Carousel.prototype.createStyle = function () {
|
181
|
+
if (!this.carouselStyle) {
|
182
|
+
this.carouselStyle = document.createElement('style');
|
183
|
+
this.carouselStyle.type = 'text/css';
|
184
|
+
document.body.appendChild(this.carouselStyle);
|
73
185
|
}
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
186
|
+
var innerHTML = "\n #" + this.id + " .ui-carousel-item {\n\t\t\t\tflex: 1 0 " + (100 / this.numVisible) + "%\n\t\t\t}\n ";
|
187
|
+
if (this.responsiveOptions) {
|
188
|
+
this.responsiveOptions.sort(function (data1, data2) {
|
189
|
+
var value1 = data1.breakpoint;
|
190
|
+
var value2 = data2.breakpoint;
|
191
|
+
var result = null;
|
192
|
+
if (value1 == null && value2 != null)
|
193
|
+
result = -1;
|
194
|
+
else if (value1 != null && value2 == null)
|
195
|
+
result = 1;
|
196
|
+
else if (value1 == null && value2 == null)
|
197
|
+
result = 0;
|
198
|
+
else if (typeof value1 === 'string' && typeof value2 === 'string')
|
199
|
+
result = value1.localeCompare(value2, undefined, { numeric: true });
|
200
|
+
else
|
201
|
+
result = (value1 < value2) ? -1 : (value1 > value2) ? 1 : 0;
|
202
|
+
return -1 * result;
|
80
203
|
});
|
204
|
+
for (var i = 0; i < this.responsiveOptions.length; i++) {
|
205
|
+
var res = this.responsiveOptions[i];
|
206
|
+
innerHTML += "\n @media screen and (max-width: " + res.breakpoint + ") {\n #" + this.id + " .ui-carousel-item {\n flex: 1 0 " + (100 / res.numVisible) + "%\n }\n }\n ";
|
207
|
+
}
|
81
208
|
}
|
209
|
+
this.carouselStyle.innerHTML = innerHTML;
|
82
210
|
};
|
83
|
-
Carousel.prototype.
|
84
|
-
this.
|
85
|
-
|
86
|
-
|
211
|
+
Carousel.prototype.calculatePosition = function () {
|
212
|
+
if (this.itemsContainer && this.responsiveOptions) {
|
213
|
+
var windowWidth = window.innerWidth;
|
214
|
+
var matchedResponsiveData = {
|
215
|
+
numVisible: this.defaultNumVisible,
|
216
|
+
numScroll: this.defaultNumScroll
|
217
|
+
};
|
218
|
+
for (var i = 0; i < this.responsiveOptions.length; i++) {
|
219
|
+
var res = this.responsiveOptions[i];
|
220
|
+
if (parseInt(res.breakpoint, 10) >= windowWidth) {
|
221
|
+
matchedResponsiveData = res;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
if (this._numScroll !== matchedResponsiveData.numScroll) {
|
225
|
+
var page = this._page;
|
226
|
+
page = Math.floor((page * this._numScroll) / matchedResponsiveData.numScroll);
|
227
|
+
var totalShiftedItems = (matchedResponsiveData.numScroll * this.page) * -1;
|
228
|
+
if (this.isCircular()) {
|
229
|
+
totalShiftedItems -= matchedResponsiveData.numVisible;
|
230
|
+
}
|
231
|
+
this.totalShiftedItems = totalShiftedItems;
|
232
|
+
this._numScroll = matchedResponsiveData.numScroll;
|
233
|
+
this._page = page;
|
234
|
+
this.onPage.emit({
|
235
|
+
page: this.page
|
236
|
+
});
|
237
|
+
}
|
238
|
+
if (this._numVisible !== matchedResponsiveData.numVisible) {
|
239
|
+
this._numVisible = matchedResponsiveData.numVisible;
|
240
|
+
this.setCloneItems();
|
241
|
+
}
|
87
242
|
}
|
88
243
|
};
|
89
|
-
Carousel.prototype.
|
90
|
-
|
91
|
-
|
92
|
-
|
244
|
+
Carousel.prototype.setCloneItems = function () {
|
245
|
+
var _a, _b;
|
246
|
+
this.clonedItemsForStarting = [];
|
247
|
+
this.clonedItemsForFinishing = [];
|
248
|
+
if (this.isCircular()) {
|
249
|
+
(_a = this.clonedItemsForStarting).push.apply(_a, this.value.slice(-1 * this._numVisible));
|
250
|
+
(_b = this.clonedItemsForFinishing).push.apply(_b, this.value.slice(0, this._numVisible));
|
93
251
|
}
|
94
252
|
};
|
95
|
-
Carousel.prototype.
|
96
|
-
this.
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
253
|
+
Carousel.prototype.firstIndex = function () {
|
254
|
+
return this.isCircular() ? (-1 * (this.totalShiftedItems + this.numVisible)) : (this.totalShiftedItems * -1);
|
255
|
+
};
|
256
|
+
Carousel.prototype.lastIndex = function () {
|
257
|
+
return this.firstIndex() + this.numVisible - 1;
|
258
|
+
};
|
259
|
+
Carousel.prototype.totalDots = function () {
|
260
|
+
return this.value ? Math.ceil((this.value.length - this._numVisible) / this._numScroll) + 1 : 0;
|
261
|
+
};
|
262
|
+
Carousel.prototype.totalDotsArray = function () {
|
263
|
+
return Array(this.value ? Math.ceil((this.value.length - this._numVisible) / this._numScroll) + 1 : 0).fill(0);
|
264
|
+
;
|
265
|
+
};
|
266
|
+
Carousel.prototype.containerClass = function () {
|
267
|
+
return { 'ui-carousel ui-widget': true,
|
268
|
+
'ui-carousel-vertical': this.isVertical(),
|
269
|
+
'ui-carousel-horizontal': !this.isVertical()
|
270
|
+
};
|
271
|
+
};
|
272
|
+
Carousel.prototype.contentClasses = function () {
|
273
|
+
return 'ui-carousel-content ' + this.contentClass;
|
274
|
+
};
|
275
|
+
Carousel.prototype.dotsContentClasses = function () {
|
276
|
+
return 'ui-carousel-dots-container ui-helper-reset ' + this.dotsContainerClass;
|
277
|
+
};
|
278
|
+
Carousel.prototype.isVertical = function () {
|
279
|
+
return this.orientation === 'vertical';
|
280
|
+
};
|
281
|
+
Carousel.prototype.isCircular = function () {
|
282
|
+
return this.circular && this.value && this.value.length >= this.numVisible;
|
283
|
+
};
|
284
|
+
Carousel.prototype.isAutoplay = function () {
|
285
|
+
return this.autoplayInterval && this.allowAutoplay;
|
102
286
|
};
|
103
|
-
Carousel.prototype.
|
287
|
+
Carousel.prototype.navForward = function (e, index) {
|
288
|
+
if (this.circular || this._page < (this.totalDots() - 1)) {
|
289
|
+
this.step(-1, index);
|
290
|
+
}
|
104
291
|
if (this.autoplayInterval) {
|
105
292
|
this.stopAutoplay();
|
293
|
+
this.allowAutoplay = false;
|
294
|
+
}
|
295
|
+
if (e && e.cancelable) {
|
296
|
+
e.preventDefault();
|
106
297
|
}
|
107
|
-
|
108
|
-
|
109
|
-
this.
|
110
|
-
|
111
|
-
if (!this.responsive) {
|
112
|
-
this.containerViewChild.nativeElement.style.width = (domhandler_1.DomHandler.width(this.containerViewChild.nativeElement)) + 'px';
|
298
|
+
};
|
299
|
+
Carousel.prototype.navBackward = function (e, index) {
|
300
|
+
if (this.circular || this._page !== 0) {
|
301
|
+
this.step(1, index);
|
113
302
|
}
|
114
303
|
if (this.autoplayInterval) {
|
115
|
-
this.
|
116
|
-
this.
|
304
|
+
this.stopAutoplay();
|
305
|
+
this.allowAutoplay = false;
|
306
|
+
}
|
307
|
+
if (e && e.cancelable) {
|
308
|
+
e.preventDefault();
|
117
309
|
}
|
118
|
-
this.updateMobileDropdown();
|
119
|
-
this.updateLinks();
|
120
|
-
this.updateDropdown();
|
121
|
-
this.cd.detectChanges();
|
122
310
|
};
|
123
|
-
Carousel.prototype.
|
124
|
-
var
|
125
|
-
if (
|
126
|
-
|
127
|
-
|
128
|
-
|
311
|
+
Carousel.prototype.onDotClick = function (e, index) {
|
312
|
+
var page = this._page;
|
313
|
+
if (this.autoplayInterval) {
|
314
|
+
this.stopAutoplay();
|
315
|
+
this.allowAutoplay = false;
|
316
|
+
}
|
317
|
+
if (index > page) {
|
318
|
+
this.navForward(e, index);
|
319
|
+
}
|
320
|
+
else if (index < page) {
|
321
|
+
this.navBackward(e, index);
|
129
322
|
}
|
130
323
|
};
|
131
|
-
Carousel.prototype.
|
132
|
-
|
133
|
-
|
134
|
-
|
324
|
+
Carousel.prototype.step = function (dir, page) {
|
325
|
+
var totalShiftedItems = this.totalShiftedItems;
|
326
|
+
var isCircular = this.isCircular();
|
327
|
+
if (page != null) {
|
328
|
+
totalShiftedItems = (this._numScroll * page) * -1;
|
329
|
+
if (isCircular) {
|
330
|
+
totalShiftedItems -= this._numVisible;
|
331
|
+
}
|
332
|
+
this.isRemainingItemsAdded = false;
|
135
333
|
}
|
136
334
|
else {
|
137
|
-
this.
|
138
|
-
this.
|
335
|
+
totalShiftedItems += (this._numScroll * dir);
|
336
|
+
if (this.isRemainingItemsAdded) {
|
337
|
+
totalShiftedItems += this.remainingItems - (this._numScroll * dir);
|
338
|
+
this.isRemainingItemsAdded = false;
|
339
|
+
}
|
340
|
+
var originalShiftedItems = isCircular ? (totalShiftedItems + this._numVisible) : totalShiftedItems;
|
341
|
+
page = Math.abs(Math.floor((originalShiftedItems / this._numScroll)));
|
139
342
|
}
|
140
|
-
this.page
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
if (
|
145
|
-
|
146
|
-
|
147
|
-
|
343
|
+
if (isCircular && this.page === (this.totalDots() - 1) && dir === -1) {
|
344
|
+
totalShiftedItems = -1 * (this.value.length + this._numVisible);
|
345
|
+
page = 0;
|
346
|
+
}
|
347
|
+
else if (isCircular && this.page === 0 && dir === 1) {
|
348
|
+
totalShiftedItems = 0;
|
349
|
+
page = (this.totalDots() - 1);
|
350
|
+
}
|
351
|
+
else if (page === (this.totalDots() - 1) && this.remainingItems > 0) {
|
352
|
+
totalShiftedItems += ((this.remainingItems * -1) - (this._numScroll * dir));
|
353
|
+
this.isRemainingItemsAdded = true;
|
354
|
+
}
|
355
|
+
if (this.itemsContainer) {
|
356
|
+
this.itemsContainer.nativeElement.style.transform = this.isVertical() ? "translate3d(0, " + totalShiftedItems * (100 / this._numVisible) + "%, 0)" : "translate3d(" + totalShiftedItems * (100 / this._numVisible) + "%, 0, 0)";
|
357
|
+
this.itemsContainer.nativeElement.style.transition = 'transform 500ms ease 0s';
|
358
|
+
}
|
359
|
+
this.totalShiftedItems = totalShiftedItems;
|
360
|
+
this._page = page;
|
361
|
+
this.onPage.emit({
|
362
|
+
page: this.page
|
363
|
+
});
|
148
364
|
};
|
149
|
-
Carousel.prototype.
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
365
|
+
Carousel.prototype.startAutoplay = function () {
|
366
|
+
var _this = this;
|
367
|
+
this.interval = setInterval(function () {
|
368
|
+
if (_this.page === (_this.totalDots() - 1)) {
|
369
|
+
_this.step(-1, 0);
|
370
|
+
}
|
371
|
+
else {
|
372
|
+
_this.step(-1, _this.page + 1);
|
373
|
+
}
|
374
|
+
}, this.autoplayInterval);
|
154
375
|
};
|
155
|
-
Carousel.prototype.
|
156
|
-
this.
|
157
|
-
|
376
|
+
Carousel.prototype.stopAutoplay = function () {
|
377
|
+
if (this.interval) {
|
378
|
+
clearInterval(this.interval);
|
379
|
+
}
|
158
380
|
};
|
159
|
-
Carousel.prototype.
|
160
|
-
if (
|
161
|
-
this.
|
162
|
-
this.
|
163
|
-
|
164
|
-
|
165
|
-
page: this.page
|
166
|
-
});
|
381
|
+
Carousel.prototype.onTransitionEnd = function () {
|
382
|
+
if (this.itemsContainer) {
|
383
|
+
this.itemsContainer.nativeElement.style.transition = '';
|
384
|
+
if ((this.page === 0 || this.page === (this.totalDots() - 1)) && this.isCircular()) {
|
385
|
+
this.itemsContainer.nativeElement.style.transform = this.isVertical() ? "translate3d(0, " + this.totalShiftedItems * (100 / this._numVisible) + "%, 0)" : "translate3d(" + this.totalShiftedItems * (100 / this._numVisible) + "%, 0, 0)";
|
386
|
+
}
|
167
387
|
}
|
168
388
|
};
|
169
|
-
Carousel.prototype.
|
170
|
-
|
389
|
+
Carousel.prototype.onTouchStart = function (e) {
|
390
|
+
var touchobj = e.changedTouches[0];
|
391
|
+
this.startPos = {
|
392
|
+
x: touchobj.pageX,
|
393
|
+
y: touchobj.pageY
|
394
|
+
};
|
171
395
|
};
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
}
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
});
|
186
|
-
Object.defineProperty(Carousel.prototype, "totalPages", {
|
187
|
-
get: function () {
|
188
|
-
return (this.value && this.value.length) ? Math.ceil(this.value.length / this.columns) : 0;
|
189
|
-
},
|
190
|
-
enumerable: true,
|
191
|
-
configurable: true
|
192
|
-
});
|
193
|
-
Carousel.prototype.routerDisplay = function () {
|
194
|
-
var win = window;
|
195
|
-
if (win.innerWidth <= this.breakpoint)
|
196
|
-
return true;
|
197
|
-
else
|
198
|
-
return false;
|
396
|
+
Carousel.prototype.onTouchMove = function (e) {
|
397
|
+
if (e.cancelable) {
|
398
|
+
e.preventDefault();
|
399
|
+
}
|
400
|
+
};
|
401
|
+
Carousel.prototype.onTouchEnd = function (e) {
|
402
|
+
var touchobj = e.changedTouches[0];
|
403
|
+
if (this.isVertical()) {
|
404
|
+
this.changePageOnTouch(e, (touchobj.pageY - this.startPos.y));
|
405
|
+
}
|
406
|
+
else {
|
407
|
+
this.changePageOnTouch(e, (touchobj.pageX - this.startPos.x));
|
408
|
+
}
|
199
409
|
};
|
200
|
-
Carousel.prototype.
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
this.shrinked = false;
|
208
|
-
this.columns = this.numVisible;
|
209
|
-
this.updateLinks();
|
210
|
-
this.updateDropdown();
|
211
|
-
}
|
212
|
-
this.calculateItemWidths();
|
213
|
-
this.setPage(Math.floor(this.firstVisible / this.columns), true);
|
410
|
+
Carousel.prototype.changePageOnTouch = function (e, diff) {
|
411
|
+
if (diff < 0) {
|
412
|
+
this.navForward(e);
|
413
|
+
}
|
414
|
+
else {
|
415
|
+
this.navBackward(e);
|
416
|
+
}
|
214
417
|
};
|
215
|
-
Carousel.prototype.
|
418
|
+
Carousel.prototype.bindDocumentListeners = function () {
|
216
419
|
var _this = this;
|
217
|
-
this.
|
218
|
-
|
219
|
-
_this.
|
220
|
-
|
221
|
-
|
222
|
-
}
|
420
|
+
if (!this.documentResizeListener) {
|
421
|
+
this.documentResizeListener = function (e) {
|
422
|
+
_this.calculatePosition();
|
423
|
+
};
|
424
|
+
window.addEventListener('resize', this.documentResizeListener);
|
425
|
+
}
|
223
426
|
};
|
224
|
-
Carousel.prototype.
|
225
|
-
|
427
|
+
Carousel.prototype.unbindDocumentListeners = function () {
|
428
|
+
if (this.documentResizeListener) {
|
429
|
+
window.removeEventListener('resize', this.documentResizeListener);
|
430
|
+
this.documentResizeListener = null;
|
431
|
+
}
|
226
432
|
};
|
227
433
|
Carousel.prototype.ngOnDestroy = function () {
|
228
|
-
if (this.
|
229
|
-
this.
|
434
|
+
if (this.responsiveOptions) {
|
435
|
+
this.unbindDocumentListeners();
|
230
436
|
}
|
231
437
|
if (this.autoplayInterval) {
|
232
438
|
this.stopAutoplay();
|
@@ -234,44 +440,52 @@ var Carousel = /** @class */ (function () {
|
|
234
440
|
};
|
235
441
|
__decorate([
|
236
442
|
core_1.Input(),
|
237
|
-
__metadata("design:type", Number)
|
238
|
-
|
443
|
+
__metadata("design:type", Number),
|
444
|
+
__metadata("design:paramtypes", [Number])
|
445
|
+
], Carousel.prototype, "page", null);
|
239
446
|
__decorate([
|
240
447
|
core_1.Input(),
|
241
|
-
__metadata("design:type", Number)
|
242
|
-
|
448
|
+
__metadata("design:type", Number),
|
449
|
+
__metadata("design:paramtypes", [Number])
|
450
|
+
], Carousel.prototype, "numVisible", null);
|
243
451
|
__decorate([
|
244
452
|
core_1.Input(),
|
245
|
-
__metadata("design:type",
|
246
|
-
|
453
|
+
__metadata("design:type", Number),
|
454
|
+
__metadata("design:paramtypes", [Number])
|
455
|
+
], Carousel.prototype, "numScroll", null);
|
247
456
|
__decorate([
|
248
457
|
core_1.Input(),
|
249
|
-
__metadata("design:type",
|
250
|
-
], Carousel.prototype, "
|
458
|
+
__metadata("design:type", Array)
|
459
|
+
], Carousel.prototype, "responsiveOptions", void 0);
|
251
460
|
__decorate([
|
252
461
|
core_1.Input(),
|
253
|
-
__metadata("design:type",
|
254
|
-
], Carousel.prototype, "
|
462
|
+
__metadata("design:type", Object)
|
463
|
+
], Carousel.prototype, "orientation", void 0);
|
255
464
|
__decorate([
|
256
465
|
core_1.Input(),
|
257
|
-
__metadata("design:type",
|
258
|
-
], Carousel.prototype, "
|
466
|
+
__metadata("design:type", Object)
|
467
|
+
], Carousel.prototype, "verticalViewPortHeight", void 0);
|
259
468
|
__decorate([
|
260
469
|
core_1.Input(),
|
261
|
-
__metadata("design:type",
|
262
|
-
], Carousel.prototype, "
|
470
|
+
__metadata("design:type", String)
|
471
|
+
], Carousel.prototype, "contentClass", void 0);
|
263
472
|
__decorate([
|
264
473
|
core_1.Input(),
|
265
|
-
__metadata("design:type",
|
266
|
-
], Carousel.prototype, "
|
474
|
+
__metadata("design:type", String)
|
475
|
+
], Carousel.prototype, "dotsContainerClass", void 0);
|
267
476
|
__decorate([
|
268
477
|
core_1.Input(),
|
269
|
-
__metadata("design:type",
|
270
|
-
|
478
|
+
__metadata("design:type", Array),
|
479
|
+
__metadata("design:paramtypes", [Object])
|
480
|
+
], Carousel.prototype, "value", null);
|
481
|
+
__decorate([
|
482
|
+
core_1.Input(),
|
483
|
+
__metadata("design:type", Boolean)
|
484
|
+
], Carousel.prototype, "circular", void 0);
|
271
485
|
__decorate([
|
272
486
|
core_1.Input(),
|
273
487
|
__metadata("design:type", Number)
|
274
|
-
], Carousel.prototype, "
|
488
|
+
], Carousel.prototype, "autoplayInterval", void 0);
|
275
489
|
__decorate([
|
276
490
|
core_1.Input(),
|
277
491
|
__metadata("design:type", Object)
|
@@ -285,32 +499,27 @@ var Carousel = /** @class */ (function () {
|
|
285
499
|
__metadata("design:type", core_1.EventEmitter)
|
286
500
|
], Carousel.prototype, "onPage", void 0);
|
287
501
|
__decorate([
|
288
|
-
core_1.
|
289
|
-
__metadata("design:type", core_1.QueryList)
|
290
|
-
], Carousel.prototype, "templates", void 0);
|
291
|
-
__decorate([
|
292
|
-
core_1.ViewChild('container', { static: false }),
|
502
|
+
core_1.ViewChild('itemsContainer', { static: true }),
|
293
503
|
__metadata("design:type", core_1.ElementRef)
|
294
|
-
], Carousel.prototype, "
|
504
|
+
], Carousel.prototype, "itemsContainer", void 0);
|
295
505
|
__decorate([
|
296
|
-
core_1.
|
297
|
-
__metadata("design:type",
|
298
|
-
], Carousel.prototype, "
|
506
|
+
core_1.ContentChild(shared_1.Header, { static: false }),
|
507
|
+
__metadata("design:type", Object)
|
508
|
+
], Carousel.prototype, "headerFacet", void 0);
|
299
509
|
__decorate([
|
300
|
-
core_1.
|
301
|
-
__metadata("design:type",
|
302
|
-
], Carousel.prototype, "
|
510
|
+
core_1.ContentChild(shared_1.Footer, { static: false }),
|
511
|
+
__metadata("design:type", Object)
|
512
|
+
], Carousel.prototype, "footerFacet", void 0);
|
303
513
|
__decorate([
|
304
|
-
core_1.
|
305
|
-
__metadata("design:type",
|
306
|
-
|
307
|
-
], Carousel.prototype, "value", null);
|
514
|
+
core_1.ContentChildren(shared_1.PrimeTemplate),
|
515
|
+
__metadata("design:type", core_1.QueryList)
|
516
|
+
], Carousel.prototype, "templates", void 0);
|
308
517
|
Carousel = __decorate([
|
309
518
|
core_1.Component({
|
310
519
|
selector: 'p-carousel',
|
311
|
-
template: "\n
|
520
|
+
template: "\n\t\t<div [attr.id]=\"id\" [ngClass]=\"containerClass()\" [ngStyle]=\"style\" [class]=\"styleClass\">\n\t\t\t<div class=\"ui-carousel-header\" *ngIf=\"headerFacet\">\n\t\t\t\t<ng-content select=\"p-header\"></ng-content>\n\t\t\t</div>\n\t\t\t<div [class]=\"contentClasses()\">\n\t\t\t\t<div class=\"ui-carousel-container\">\n\t\t\t\t\t<button [ngClass]=\"{'ui-carousel-prev ui-button ui-widget ui-state-default ui-corner-all':true, 'ui-state-disabled': _page === 0 && !circular}\" [disabled]=\"_page === 0 && !circular\" (click)=\"navBackward($event)\">\n\t\t\t\t\t\t<span [ngClass]=\"{'ui-carousel-prev-icon pi': true, 'pi-chevron-left': !isVertical(), 'pi-chevron-up': isVertical()}\"></span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"ui-carousel-items-content\" [ngStyle]=\"{'height': isVertical() ? verticalViewPortHeight : 'auto'}\">\n\t\t\t\t\t\t<div #itemsContainer class=\"ui-carousel-items-container\" (transitionend)=\"onTransitionEnd()\" (touchend)=\"onTouchEnd($event)\" (touchstart)=\"onTouchStart($event)\" (touchmove)=\"onTouchMove($event)\">\n\t\t\t\t\t\t\t<div *ngFor=\"let item of clonedItemsForStarting; let index = index\" [ngClass]= \"{'ui-carousel-item ui-carousel-item-cloned': true,'ui-carousel-item-active': (totalShiftedItems * -1) === (value.length),\n\t\t\t\t\t\t\t'ui-carousel-item-start': 0 === index,\n\t\t\t\t\t\t\t'ui-carousel-item-end': (clonedItemsForStarting.length - 1) === index}\">\n\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"itemTemplate; context: {$implicit: item}\"></ng-container>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div *ngFor=\"let item of value; let index = index\" [ngClass]= \"{'ui-carousel-item': true,'ui-carousel-item-active': (firstIndex() <= index && lastIndex() >= index),\n\t\t\t\t\t\t\t'ui-carousel-item-start': firstIndex() === index,\n\t\t\t\t\t\t\t'ui-carousel-item-end': lastIndex() === index}\">\n\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"itemTemplate; context: {$implicit: item}\"></ng-container>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div *ngFor=\"let item of clonedItemsForFinishing; let index = index\" [ngClass]= \"{'ui-carousel-item ui-carousel-item-cloned': true,'ui-carousel-item-active': ((totalShiftedItems *-1) === numVisible),\n\t\t\t\t\t\t\t'ui-carousel-item-start': 0 === index,\n\t\t\t\t\t\t\t'ui-carousel-item-end': (clonedItemsForFinishing.length - 1) === index}\">\n\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"itemTemplate; context: {$implicit: item}\"></ng-container>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<button [ngClass]=\"{'ui-carousel-next ui-button ui-widget ui-state-default ui-corner-all': true, 'ui-state-disabled': (_page === totalDots()-1 && !circular)}\" [disabled]=\"_page === totalDots()-1 && !circular\" (click)=\"navForward($event)\">\n\t\t\t\t\t\t<span [ngClass]=\"{'ui-carousel-next-icon pi': true, 'pi-chevron-right': !isVertical(), 'pi-chevron-down': isVertical()}\"></span>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<ul [class]=\"dotsContentClasses()\">\n\t\t\t\t\t<li *ngFor=\"let totalDot of totalDotsArray(); let i = index\" [ngClass]=\"{'ui-carousel-dot-item':true,'ui-state-highlight': _page === i}\">\n\t\t\t\t\t\t<button class=\"ui-button ui-widget ui-state-default ui-corner-all\" (click)=\"onDotClick($event, i)\">\n\t\t\t\t\t\t\t<span [ngClass]=\"{'ui-carousel-dot-icon pi':true, 'pi-circle-on': _page === i, 'pi-circle-off': !(_page === i)}\"></span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t\t<div class=\"ui-carousel-footer\" *ngIf=\"footerFacet\">\n\t\t\t\t<ng-content select=\"p-footer\"></ng-content>\n\t\t\t</div>\n\t\t</div>\n\t"
|
312
521
|
}),
|
313
|
-
__metadata("design:paramtypes", [core_1.ElementRef, core_1.
|
522
|
+
__metadata("design:paramtypes", [core_1.ElementRef, core_1.NgZone])
|
314
523
|
], Carousel);
|
315
524
|
return Carousel;
|
316
525
|
}());
|
@@ -321,7 +530,7 @@ var CarouselModule = /** @class */ (function () {
|
|
321
530
|
CarouselModule = __decorate([
|
322
531
|
core_1.NgModule({
|
323
532
|
imports: [common_1.CommonModule, shared_1.SharedModule],
|
324
|
-
exports: [Carousel, shared_1.SharedModule],
|
533
|
+
exports: [common_1.CommonModule, Carousel, shared_1.SharedModule],
|
325
534
|
declarations: [Carousel]
|
326
535
|
})
|
327
536
|
], CarouselModule);
|