primereact 7.2.0 → 7.2.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/calendar/calendar.cjs.js +1 -1
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +1 -1
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +1 -1
- package/calendar/calendar.min.js +1 -1
- package/carousel/carousel.cjs.js +212 -5
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +212 -5
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +212 -5
- package/carousel/carousel.min.js +1 -1
- package/core/core.js +34 -3
- package/core/core.min.js +4 -4
- package/datatable/datatable.cjs.js +21 -16
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.d.ts +1 -0
- package/datatable/datatable.esm.js +21 -16
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +21 -16
- package/datatable/datatable.min.js +1 -1
- package/dataview/dataview.cjs.js +1 -5
- package/dataview/dataview.cjs.min.js +1 -1
- package/dataview/dataview.esm.js +1 -5
- package/dataview/dataview.esm.min.js +1 -1
- package/dataview/dataview.js +1 -5
- package/dataview/dataview.min.js +1 -1
- package/dropdown/dropdown.cjs.js +1 -1
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +1 -1
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +1 -1
- package/dropdown/dropdown.min.js +1 -1
- package/galleria/galleria.cjs.js +212 -5
- package/galleria/galleria.cjs.min.js +1 -1
- package/galleria/galleria.esm.js +212 -5
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +212 -5
- package/galleria/galleria.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +5 -1
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +5 -1
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +5 -1
- package/inputnumber/inputnumber.min.js +1 -1
- package/knob/knob.cjs.js +1 -1
- package/knob/knob.cjs.min.js +1 -1
- package/knob/knob.esm.js +1 -1
- package/knob/knob.esm.min.js +1 -1
- package/knob/knob.js +1 -1
- package/knob/knob.min.js +1 -1
- package/multiselect/multiselect.cjs.js +1 -1
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.esm.js +1 -1
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +1 -1
- package/multiselect/multiselect.min.js +1 -1
- package/package.json +1 -1
- package/primereact.all.cjs.js +142 -122
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +142 -122
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +142 -122
- package/primereact.all.min.js +1 -1
- package/resources/primereact.css +7 -2
- package/resources/primereact.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +254 -2
- package/resources/themes/arya-green/theme.css +254 -2
- package/resources/themes/arya-orange/theme.css +254 -2
- package/resources/themes/arya-purple/theme.css +254 -2
- package/resources/themes/bootstrap4-dark-blue/theme.css +254 -2
- package/resources/themes/bootstrap4-dark-purple/theme.css +254 -2
- package/resources/themes/bootstrap4-light-blue/theme.css +252 -0
- package/resources/themes/bootstrap4-light-purple/theme.css +252 -0
- package/resources/themes/fluent-light/theme.css +252 -0
- package/resources/themes/lara-dark-blue/theme.css +261 -44
- package/resources/themes/lara-dark-indigo/theme.css +261 -44
- package/resources/themes/lara-dark-purple/theme.css +261 -44
- package/resources/themes/lara-dark-teal/theme.css +261 -44
- package/resources/themes/lara-light-blue/theme.css +259 -42
- package/resources/themes/lara-light-indigo/theme.css +259 -42
- package/resources/themes/lara-light-purple/theme.css +259 -42
- package/resources/themes/lara-light-teal/theme.css +259 -42
- package/resources/themes/luna-amber/theme.css +252 -0
- package/resources/themes/luna-blue/theme.css +252 -0
- package/resources/themes/luna-green/theme.css +252 -0
- package/resources/themes/luna-pink/theme.css +252 -0
- package/resources/themes/md-dark-deeppurple/theme.css +328 -2
- package/resources/themes/md-dark-indigo/theme.css +328 -2
- package/resources/themes/md-light-deeppurple/theme.css +326 -0
- package/resources/themes/md-light-indigo/theme.css +326 -0
- package/resources/themes/mdc-dark-deeppurple/theme.css +328 -2
- package/resources/themes/mdc-dark-indigo/theme.css +328 -2
- package/resources/themes/mdc-light-deeppurple/theme.css +326 -0
- package/resources/themes/mdc-light-indigo/theme.css +326 -0
- package/resources/themes/nova/theme.css +252 -0
- package/resources/themes/nova-accent/theme.css +252 -0
- package/resources/themes/nova-alt/theme.css +252 -0
- package/resources/themes/rhea/theme.css +252 -0
- package/resources/themes/saga-blue/theme.css +252 -0
- package/resources/themes/saga-green/theme.css +252 -0
- package/resources/themes/saga-orange/theme.css +252 -0
- package/resources/themes/saga-purple/theme.css +252 -0
- package/resources/themes/tailwind-light/theme.css +252 -0
- package/resources/themes/vela-blue/theme.css +254 -2
- package/resources/themes/vela-green/theme.css +254 -2
- package/resources/themes/vela-orange/theme.css +254 -2
- package/resources/themes/vela-purple/theme.css +254 -2
- package/splitbutton/splitbutton.d.ts +4 -1
- package/splitbutton/splitbutton.min.css +1 -1
- package/tabmenu/tabmenu.cjs.js +1 -1
- package/tabmenu/tabmenu.cjs.min.js +1 -1
- package/tabmenu/tabmenu.esm.js +1 -1
- package/tabmenu/tabmenu.esm.min.js +1 -1
- package/tabmenu/tabmenu.js +1 -1
- package/tabmenu/tabmenu.min.js +1 -1
- package/tabview/tabview.cjs.js +1 -1
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.esm.js +1 -1
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +1 -1
- package/tabview/tabview.min.js +1 -1
- package/toolbar/toolbar.min.css +1 -1
- package/tree/tree.cjs.js +2 -1
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +2 -1
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +2 -1
- package/tree/tree.min.js +1 -1
- package/treeselect/treeselect.cjs.js +3 -3
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +3 -3
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +3 -3
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +12 -10
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +8 -7
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +12 -10
- package/treetable/treetable.min.js +1 -1
- package/utils/utils.cjs.js +26 -0
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.d.ts +1 -0
- package/utils/utils.esm.js +26 -0
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +26 -0
- package/utils/utils.min.js +1 -1
- package/web-types.json +15 -3
- package/resources/themes/lara-dark-blue/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-SemiBold.woff2 +0 -0
package/galleria/galleria.esm.js
CHANGED
|
@@ -404,6 +404,217 @@ function _toConsumableArray(arr) {
|
|
|
404
404
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
+
var ObjectUtils = /*#__PURE__*/function () {
|
|
408
|
+
function ObjectUtils() {
|
|
409
|
+
_classCallCheck(this, ObjectUtils);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
_createClass(ObjectUtils, null, [{
|
|
413
|
+
key: "equals",
|
|
414
|
+
value: function equals(obj1, obj2, field) {
|
|
415
|
+
if (field && obj1 && _typeof(obj1) === 'object' && obj2 && _typeof(obj2) === 'object') return this.resolveFieldData(obj1, field) === this.resolveFieldData(obj2, field);else return this.deepEquals(obj1, obj2);
|
|
416
|
+
}
|
|
417
|
+
}, {
|
|
418
|
+
key: "deepEquals",
|
|
419
|
+
value: function deepEquals(a, b) {
|
|
420
|
+
if (a === b) return true;
|
|
421
|
+
|
|
422
|
+
if (a && b && _typeof(a) == 'object' && _typeof(b) == 'object') {
|
|
423
|
+
var arrA = Array.isArray(a),
|
|
424
|
+
arrB = Array.isArray(b),
|
|
425
|
+
i,
|
|
426
|
+
length,
|
|
427
|
+
key;
|
|
428
|
+
|
|
429
|
+
if (arrA && arrB) {
|
|
430
|
+
length = a.length;
|
|
431
|
+
if (length !== b.length) return false;
|
|
432
|
+
|
|
433
|
+
for (i = length; i-- !== 0;) {
|
|
434
|
+
if (!this.deepEquals(a[i], b[i])) return false;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return true;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (arrA !== arrB) return false;
|
|
441
|
+
var dateA = a instanceof Date,
|
|
442
|
+
dateB = b instanceof Date;
|
|
443
|
+
if (dateA !== dateB) return false;
|
|
444
|
+
if (dateA && dateB) return a.getTime() === b.getTime();
|
|
445
|
+
var regexpA = a instanceof RegExp,
|
|
446
|
+
regexpB = b instanceof RegExp;
|
|
447
|
+
if (regexpA !== regexpB) return false;
|
|
448
|
+
if (regexpA && regexpB) return a.toString() === b.toString();
|
|
449
|
+
var keys = Object.keys(a);
|
|
450
|
+
length = keys.length;
|
|
451
|
+
if (length !== Object.keys(b).length) return false;
|
|
452
|
+
|
|
453
|
+
for (i = length; i-- !== 0;) {
|
|
454
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
for (i = length; i-- !== 0;) {
|
|
458
|
+
key = keys[i];
|
|
459
|
+
if (!this.deepEquals(a[key], b[key])) return false;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
/*eslint no-self-compare: "off"*/
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
return a !== a && b !== b;
|
|
468
|
+
}
|
|
469
|
+
}, {
|
|
470
|
+
key: "resolveFieldData",
|
|
471
|
+
value: function resolveFieldData(data, field) {
|
|
472
|
+
if (data && Object.keys(data).length && field) {
|
|
473
|
+
if (this.isFunction(field)) {
|
|
474
|
+
return field(data);
|
|
475
|
+
} else if (field.indexOf('.') === -1) {
|
|
476
|
+
return data[field];
|
|
477
|
+
} else {
|
|
478
|
+
var fields = field.split('.');
|
|
479
|
+
var value = data;
|
|
480
|
+
|
|
481
|
+
for (var i = 0, len = fields.length; i < len; ++i) {
|
|
482
|
+
if (value == null) {
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
value = value[fields[i]];
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return value;
|
|
490
|
+
}
|
|
491
|
+
} else {
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}, {
|
|
496
|
+
key: "isFunction",
|
|
497
|
+
value: function isFunction(obj) {
|
|
498
|
+
return !!(obj && obj.constructor && obj.call && obj.apply);
|
|
499
|
+
}
|
|
500
|
+
}, {
|
|
501
|
+
key: "findDiffKeys",
|
|
502
|
+
value: function findDiffKeys(obj1, obj2) {
|
|
503
|
+
if (!obj1 || !obj2) {
|
|
504
|
+
return {};
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
return Object.keys(obj1).filter(function (key) {
|
|
508
|
+
return !obj2.hasOwnProperty(key);
|
|
509
|
+
}).reduce(function (result, current) {
|
|
510
|
+
result[current] = obj1[current];
|
|
511
|
+
return result;
|
|
512
|
+
}, {});
|
|
513
|
+
}
|
|
514
|
+
}, {
|
|
515
|
+
key: "reorderArray",
|
|
516
|
+
value: function reorderArray(value, from, to) {
|
|
517
|
+
var target;
|
|
518
|
+
|
|
519
|
+
if (value && from !== to) {
|
|
520
|
+
if (to >= value.length) {
|
|
521
|
+
target = to - value.length;
|
|
522
|
+
|
|
523
|
+
while (target-- + 1) {
|
|
524
|
+
value.push(undefined);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
value.splice(to, 0, value.splice(from, 1)[0]);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}, {
|
|
532
|
+
key: "findIndexInList",
|
|
533
|
+
value: function findIndexInList(value, list, dataKey) {
|
|
534
|
+
var _this = this;
|
|
535
|
+
|
|
536
|
+
if (list) {
|
|
537
|
+
return dataKey ? list.findIndex(function (item) {
|
|
538
|
+
return _this.equals(item, value, dataKey);
|
|
539
|
+
}) : list.findIndex(function (item) {
|
|
540
|
+
return item === value;
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
return -1;
|
|
545
|
+
}
|
|
546
|
+
}, {
|
|
547
|
+
key: "getJSXElement",
|
|
548
|
+
value: function getJSXElement(obj) {
|
|
549
|
+
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
550
|
+
params[_key - 1] = arguments[_key];
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
|
|
554
|
+
}
|
|
555
|
+
}, {
|
|
556
|
+
key: "getPropValue",
|
|
557
|
+
value: function getPropValue(obj) {
|
|
558
|
+
for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
559
|
+
params[_key2 - 1] = arguments[_key2];
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
|
|
563
|
+
}
|
|
564
|
+
}, {
|
|
565
|
+
key: "getRefElement",
|
|
566
|
+
value: function getRefElement(ref) {
|
|
567
|
+
if (ref) {
|
|
568
|
+
return _typeof(ref) === 'object' && ref.hasOwnProperty('current') ? ref.current : ref;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
return null;
|
|
572
|
+
}
|
|
573
|
+
}, {
|
|
574
|
+
key: "removeAccents",
|
|
575
|
+
value: function removeAccents(str) {
|
|
576
|
+
if (str && str.search(/[\xC0-\xFF]/g) > -1) {
|
|
577
|
+
str = str.replace(/[\xC0-\xC5]/g, "A").replace(/[\xC6]/g, "AE").replace(/[\xC7]/g, "C").replace(/[\xC8-\xCB]/g, "E").replace(/[\xCC-\xCF]/g, "I").replace(/[\xD0]/g, "D").replace(/[\xD1]/g, "N").replace(/[\xD2-\xD6\xD8]/g, "O").replace(/[\xD9-\xDC]/g, "U").replace(/[\xDD]/g, "Y").replace(/[\xDE]/g, "P").replace(/[\xE0-\xE5]/g, "a").replace(/[\xE6]/g, "ae").replace(/[\xE7]/g, "c").replace(/[\xE8-\xEB]/g, "e").replace(/[\xEC-\xEF]/g, "i").replace(/[\xF1]/g, "n").replace(/[\xF2-\xF6\xF8]/g, "o").replace(/[\xF9-\xFC]/g, "u").replace(/[\xFE]/g, "p").replace(/[\xFD\xFF]/g, "y");
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return str;
|
|
581
|
+
}
|
|
582
|
+
}, {
|
|
583
|
+
key: "isEmpty",
|
|
584
|
+
value: function isEmpty(value) {
|
|
585
|
+
return value === null || value === undefined || value === '' || Array.isArray(value) && value.length === 0 || !(value instanceof Date) && _typeof(value) === 'object' && Object.keys(value).length === 0;
|
|
586
|
+
}
|
|
587
|
+
}, {
|
|
588
|
+
key: "isNotEmpty",
|
|
589
|
+
value: function isNotEmpty(value) {
|
|
590
|
+
return !this.isEmpty(value);
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Compare value1 and value2 ascending by default (1) or pass in order as -1 for descending.
|
|
594
|
+
*
|
|
595
|
+
* @param {any} value1 the first value
|
|
596
|
+
* @param {any} value2 the second value
|
|
597
|
+
* @param {number | undefined} order by default ascending (1) set to descending (-1)
|
|
598
|
+
* @param {string | undefined} locale the locale to use (default to browser locale if null)
|
|
599
|
+
* @returns either 0, 1 or -1 for comparing the two values
|
|
600
|
+
*/
|
|
601
|
+
|
|
602
|
+
}, {
|
|
603
|
+
key: "sort",
|
|
604
|
+
value: function sort(value1, value2) {
|
|
605
|
+
var order = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
606
|
+
var locale = arguments.length > 3 ? arguments[3] : undefined;
|
|
607
|
+
var result = null;
|
|
608
|
+
if (value1 == null && value2 != null) result = -1;else if (value1 != null && value2 == null) result = 1;else if (value1 == null && value2 == null) result = 0;else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2, locale, {
|
|
609
|
+
numeric: true
|
|
610
|
+
});else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
|
611
|
+
return order * result;
|
|
612
|
+
}
|
|
613
|
+
}]);
|
|
614
|
+
|
|
615
|
+
return ObjectUtils;
|
|
616
|
+
}();
|
|
617
|
+
|
|
407
618
|
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
408
619
|
|
|
409
620
|
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -678,11 +889,7 @@ var GalleriaThumbnails = /*#__PURE__*/function (_Component2) {
|
|
|
678
889
|
this.responsiveOptions.sort(function (data1, data2) {
|
|
679
890
|
var value1 = data1.breakpoint;
|
|
680
891
|
var value2 = data2.breakpoint;
|
|
681
|
-
|
|
682
|
-
if (value1 == null && value2 != null) result = -1;else if (value1 != null && value2 == null) result = 1;else if (value1 == null && value2 == null) result = 0;else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2, undefined, {
|
|
683
|
-
numeric: true
|
|
684
|
-
});else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
|
685
|
-
return -1 * result;
|
|
892
|
+
return ObjectUtils.sort(value1, value2, -1, PrimeReact.locale);
|
|
686
893
|
});
|
|
687
894
|
|
|
688
895
|
for (var i = 0; i < this.responsiveOptions.length; i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t,{Component as e}from"react";import{classNames as i,UniqueComponentId as n,DomHandler as r,ZIndexUtils as s}from"primereact/utils";import{Ripple as a}from"primereact/ripple";import o from"primereact/api";import{CSSTransition as l}from"primereact/csstransition";import{Portal as p}from"primereact/portal";function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function u(t,e,i){return e&&h(t.prototype,e),i&&h(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function m(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function d(t,e){return d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},d(t,e)}function v(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function b(t,e){if(e&&("object"===f(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return m(t)}function I(t){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},I(t)}function y(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function g(){return g=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},g.apply(this,arguments)}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var S=function(n){v(l,e);var r,s,o=(r=l,s=w(),function(){var t,e=I(r);if(s){var i=I(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return b(this,t)});function l(t){var e;return c(this,l),(e=o.call(this,t)).navForward=e.navForward.bind(m(e)),e.navBackward=e.navBackward.bind(m(e)),e.next=e.next.bind(m(e)),e.prev=e.prev.bind(m(e)),e}return u(l,[{key:"step",value:function(t){this.itemsContainer&&(this.itemsContainer.style.transform=this.isVertical()?"translate3d(0, ".concat(100*t,"%, 0)"):"translate3d(".concat(100*t,"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s")}},{key:"next",value:function(){this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:this.props.activeItemIndex+1})}},{key:"prev",value:function(){this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"navBackward",value:function(t){this.stopSlideShow(),this.prev(),t&&t.cancelable&&t.preventDefault()}},{key:"navForward",value:function(t){this.stopSlideShow(),this.next(),t&&t.cancelable&&t.preventDefault()}},{key:"onIndicatorClick",value:function(t){this.stopSlideShow(),this.props.onActiveItemChange({index:t})}},{key:"onIndicatorMouseEnter",value:function(t){this.props.changeItemOnIndicatorHover&&(this.stopSlideShow(),this.props.onActiveItemChange({index:t}))}},{key:"onIndicatorKeyDown",value:function(t,e){13===t.which&&(this.stopSlideShow(),this.props.onActiveItemChange({index:e}))}},{key:"componentDidMount",value:function(){this.props.autoPlay&&this.props.startSlideShow()}},{key:"renderBackwardNavigator",value:function(){if(this.props.showItemNavigators){var e=!this.props.circular&&0===this.props.activeItemIndex,n=i("p-galleria-item-prev p-galleria-item-nav p-link",{"p-disabled":e});return t.createElement("button",{type:"button",className:n,onClick:this.navBackward,disabled:e},t.createElement("span",{className:"p-galleria-item-prev-icon pi pi-chevron-left"}),t.createElement(a,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showItemNavigators){var e=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1,n=i("p-galleria-item-next p-galleria-item-nav p-link",{"p-disabled":e});return t.createElement("button",{type:"button",className:n,onClick:this.navForward,disabled:e},t.createElement("span",{className:"p-galleria-item-next-icon pi pi-chevron-right"}),t.createElement(a,null))}return null}},{key:"renderCaption",value:function(){if(this.props.caption){var e=this.props.caption(this.props.value[this.props.activeItemIndex]);return t.createElement("div",{className:"p-galleria-caption"},e)}return null}},{key:"renderIndicator",value:function(e){var n=this,r=this.props.indicator&&this.props.indicator(e),s=i("p-galleria-indicator",{"p-highlight":this.props.activeItemIndex===e});return r||(r=t.createElement("button",{type:"button",tabIndex:-1,className:"p-link"},t.createElement(a,null))),t.createElement("li",{className:s,key:"p-galleria-indicator-"+e,tabIndex:0,onClick:function(){return n.onIndicatorClick(e)},onMouseEnter:function(){return n.onIndicatorMouseEnter(e)},onKeyDown:function(t){return n.onIndicatorKeyDown(t,e)}},r)}},{key:"renderIndicators",value:function(){if(this.props.showIndicators){for(var e=i("p-galleria-indicators p-reset",this.props.indicatorsContentClassName),n=[],r=0;r<this.props.value.length;r++)n.push(this.renderIndicator(r));return t.createElement("ul",{className:e},n)}return null}},{key:"render",value:function(){var e=this,i=this.props.itemTemplate&&this.props.itemTemplate(this.props.value[this.props.activeItemIndex]),n=this.renderBackwardNavigator(),r=this.renderForwardNavigator(),s=this.renderCaption(),a=this.renderIndicators();return t.createElement("div",{ref:function(t){return e.props.forwardRef(t)},className:"p-galleria-item-wrapper"},t.createElement("div",{className:"p-galleria-item-container"},n,t.createElement("div",{className:"p-galleria-item"},i),r,s),a)}}]),l}(),k=t.forwardRef((function(e,i){return t.createElement(S,g({forwardRef:i},e))}));function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function E(t){if(Array.isArray(t))return x(t)}function C(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function O(t,e){if(t){if("string"==typeof t)return x(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?x(t,e):void 0}}function N(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function V(t){var e=P();return function(){var i,n=I(t);if(e){var r=I(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return b(this,i)}}function P(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var T=function(n){v(s,e);var r=V(s);function s(t){var e;return c(this,s),(e=r.call(this,t)).onItemClick=e.onItemClick.bind(m(e)),e.onItemKeyDown=e.onItemKeyDown.bind(m(e)),e}return u(s,[{key:"onItemClick",value:function(t){this.props.onItemClick({originalEvent:t,index:this.props.index})}},{key:"onItemKeyDown",value:function(t){13===t.which&&this.props.onItemClick({originalEvent:t,index:this.props.index})}},{key:"render",value:function(){var e=this.props.template&&this.props.template(this.props.item),n=i(this.props.className,"p-galleria-thumbnail-item",{"p-galleria-thumbnail-item-current":this.props.current,"p-galleria-thumbnail-item-active":this.props.active,"p-galleria-thumbnail-item-start":this.props.start,"p-galleria-thumbnail-item-end":this.props.end});return t.createElement("div",{className:n},t.createElement("div",{className:"p-galleria-thumbnail-item-content",tabIndex:this.props.active?0:null,onClick:this.onItemClick,onKeyDown:this.onItemKeyDown},e))}}]),s}();y(T,"defaultProps",{index:null,template:null,item:null,current:!1,active:!1,start:!1,end:!1,className:null,onItemClick:null});var A=function(s){v(p,e);var l=V(p);function p(t){var e;return c(this,p),(e=l.call(this,t)).state={numVisible:t.numVisible,totalShiftedItems:0,page:0},e.navForward=e.navForward.bind(m(e)),e.navBackward=e.navBackward.bind(m(e)),e.onTransitionEnd=e.onTransitionEnd.bind(m(e)),e.onTouchStart=e.onTouchStart.bind(m(e)),e.onTouchMove=e.onTouchMove.bind(m(e)),e.onTouchEnd=e.onTouchEnd.bind(m(e)),e.onItemClick=e.onItemClick.bind(m(e)),e.attributeSelector=n(),e}return u(p,[{key:"step",value:function(t){var e=this.state.totalShiftedItems+t;t<0&&-1*e+this.state.numVisible>this.props.value.length-1?e=this.state.numVisible-this.props.value.length:t>0&&e>0&&(e=0),this.props.circular&&(t<0&&this.props.value.length-1===this.props.activeItemIndex?e=0:t>0&&0===this.props.activeItemIndex&&(e=this.state.numVisible-this.props.value.length)),this.itemsContainer&&(r.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(e*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(e*(100/this.state.numVisible),"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s"),this.setState({totalShiftedItems:e})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"getMedianItemIndex",value:function(){var t=Math.floor(this.state.numVisible/2);return this.state.numVisible%2?t:t-1}},{key:"navBackward",value:function(t){this.stopSlideShow();var e=0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0;this.state.numVisible-(e+this.state.totalShiftedItems)-1>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems!=0||this.props.circular)&&this.step(1),this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:e}),t.cancelable&&t.preventDefault()}},{key:"navForward",value:function(t){this.stopSlideShow();var e=this.props.activeItemIndex+1;e+this.state.totalShiftedItems>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1||this.props.circular)&&this.step(-1),this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:e}),t.cancelable&&t.preventDefault()}},{key:"onItemClick",value:function(t){this.stopSlideShow();var e=t.index;if(e!==this.props.activeItemIndex){var i=e+this.state.totalShiftedItems,n=0;e<this.props.activeItemIndex?(n=this.state.numVisible-i-1-this.getMedianItemIndex())>0&&-1*this.state.totalShiftedItems!=0&&this.step(n):(n=this.getMedianItemIndex()-i)<0&&-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1&&this.step(n),this.props.onActiveItemChange({index:e})}}},{key:"onTransitionEnd",value:function(t){this.itemsContainer&&"transform"===t.propertyName&&(r.addClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="")}},{key:"onTouchStart",value:function(t){var e=t.changedTouches[0];this.startPos={x:e.pageX,y:e.pageY}}},{key:"onTouchMove",value:function(t){t.cancelable&&t.preventDefault()}},{key:"onTouchEnd",value:function(t){var e=t.changedTouches[0];this.changePageOnTouch(t,this.props.isVertical?e.pageY-this.startPos.y:e.pageX-this.startPos.x)}},{key:"changePageOnTouch",value:function(t,e){e<0?this.navForward(t):this.navBackward(t)}},{key:"getTotalPageNumber",value:function(){return this.props.value.length>this.state.numVisible?this.props.value.length-this.state.numVisible+1:0}},{key:"createStyle",value:function(){this.thumbnailsStyle||(this.thumbnailsStyle=r.createInlineStyle(o.nonce));var t,e="\n .p-galleria-thumbnail-items[".concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/this.state.numVisible,"%\n }\n ");if(this.props.responsiveOptions){this.responsiveOptions=E(t=this.props.responsiveOptions)||C(t)||O(t)||N(),this.responsiveOptions.sort((function(t,e){var i=t.breakpoint,n=e.breakpoint;return-1*(null==i&&null!=n?-1:null!=i&&null==n?1:null==i&&null==n?0:"string"==typeof i&&"string"==typeof n?i.localeCompare(n,void 0,{numeric:!0}):i<n?-1:i>n?1:0)}));for(var i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];e+="\n @media screen and (max-width: ".concat(n.breakpoint,") {\n .p-galleria-thumbnail-items[").concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/n.numVisible,"%\n }\n }\n ")}}this.thumbnailsStyle.innerHTML=e}},{key:"calculatePosition",value:function(){if(this.itemsContainer&&this.responsiveOptions){for(var t=window.innerWidth,e={numVisible:this.props.numVisible},i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];parseInt(n.breakpoint,10)>=t&&(e=n)}this.state.numVisible!==e.numVisible&&this.setState({numVisible:e.numVisible})}}},{key:"bindDocumentListeners",value:function(){var t=this;this.documentResizeListener||(this.documentResizeListener=function(){t.calculatePosition()},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentListeners",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.itemsContainer&&this.itemsContainer.setAttribute(this.attributeSelector,""),this.createStyle(),this.calculatePosition(),this.props.responsiveOptions&&this.bindDocumentListeners()}},{key:"componentDidUpdate",value:function(t,e){var i=this.state.totalShiftedItems;e.numVisible===this.state.numVisible&&t.activeItemIndex===this.props.activeItemIndex||((i=this.props.activeItemIndex<=this.getMedianItemIndex()?0:this.props.value.length-this.state.numVisible+this.getMedianItemIndex()<this.props.activeItemIndex?this.state.numVisible-this.props.value.length:this.props.value.length-this.state.numVisible<this.props.activeItemIndex&&this.state.numVisible%2==0?-1*this.props.activeItemIndex+this.getMedianItemIndex()+1:-1*this.props.activeItemIndex+this.getMedianItemIndex())!==this.state.totalShiftedItems&&this.setState({totalShiftedItems:i}),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(i*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(i*(100/this.state.numVisible),"%, 0, 0)"),t.activeItemIndex!==this.props.activeItemIndex&&(r.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="transform 500ms ease 0s"))}},{key:"componentWillUnmount",value:function(){this.props.responsiveOptions&&this.unbindDocumentListeners()}},{key:"renderItems",value:function(){var e=this;return this.props.value.map((function(i,n){var r=-1*e.state.totalShiftedItems,s=r+e.state.numVisible-1;return t.createElement(T,{key:n,index:n,template:e.props.itemTemplate,item:i,active:r<=n&&s>=n,start:r===n,end:s===n,onItemClick:e.onItemClick,current:e.props.activeItemIndex===n})}))}},{key:"renderBackwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var e=!this.props.circular&&0===this.props.activeItemIndex||this.props.value.length<=this.state.numVisible,n=i("p-galleria-thumbnail-prev p-link",{"p-disabled":e}),r=i("p-galleria-thumbnail-prev-icon pi",{"pi-chevron-left":!this.props.isVertical,"pi-chevron-up":this.props.isVertical});return t.createElement("button",{className:n,onClick:this.navBackward,disabled:e},t.createElement("span",{className:r}),t.createElement(a,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var e=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1||this.props.value.length<=this.state.numVisible,n=i("p-galleria-thumbnail-next p-link",{"p-disabled":e}),r=i("p-galleria-thumbnail-next-icon pi",{"pi-chevron-right":!this.props.isVertical,"pi-chevron-down":this.props.isVertical});return t.createElement("button",{className:n,onClick:this.navForward,disabled:e},t.createElement("span",{className:r}),t.createElement(a,null))}return null}},{key:"renderContent",value:function(){var e=this,i=this.renderItems(),n=this.props.isVertical?this.props.contentHeight:"",r=this.renderBackwardNavigator(),s=this.renderForwardNavigator();return t.createElement("div",{className:"p-galleria-thumbnail-container"},r,t.createElement("div",{className:"p-galleria-thumbnail-items-container",style:{height:n}},t.createElement("div",{ref:function(t){return e.itemsContainer=t},className:"p-galleria-thumbnail-items",onTransitionEnd:this.onTransitionEnd,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd},i)),s)}},{key:"render",value:function(){var e=this.renderContent();return t.createElement("div",{className:"p-galleria-thumbnail-wrapper"},e)}}]),p}();function R(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function j(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?R(Object(i),!0).forEach((function(e){y(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):R(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function D(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var M=function(n){v(y,e);var h,d,f=(h=y,d=D(),function(){var t,e=I(h);if(d){var i=I(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return b(this,t)});function y(e){var i;return c(this,y),(i=f.call(this,e)).state={visible:!1,numVisible:e.numVisible,slideShowActive:!1},i.props.onItemChange||(i.state=j(j({},i.state),{},{activeIndex:e.activeIndex})),i.onActiveItemChange=i.onActiveItemChange.bind(m(i)),i.show=i.show.bind(m(i)),i.hide=i.hide.bind(m(i)),i.startSlideShow=i.startSlideShow.bind(m(i)),i.stopSlideShow=i.stopSlideShow.bind(m(i)),i.onEnter=i.onEnter.bind(m(i)),i.onEntering=i.onEntering.bind(m(i)),i.onEntered=i.onEntered.bind(m(i)),i.onExit=i.onExit.bind(m(i)),i.onExited=i.onExited.bind(m(i)),i.galleriaRef=t.createRef(),i}return u(y,[{key:"activeItemIndex",get:function(){return this.props.onItemChange?this.props.activeIndex:this.state.activeIndex}},{key:"onActiveItemChange",value:function(t){this.props.onItemChange?this.props.onItemChange(t):this.setState({activeIndex:t.index})}},{key:"show",value:function(){this.setState({visible:!0})}},{key:"hide",value:function(){this.setState({visible:!1})}},{key:"onEnter",value:function(){r.addClass(document.body,"p-overflow-hidden")}},{key:"onEntering",value:function(){s.set("modal",this.mask,o.autoZIndex,this.props.baseZIndex||o.zIndex.modal),r.addMultipleClasses(this.mask,"p-component-overlay p-component-overlay-enter")}},{key:"onEntered",value:function(){this.props.onShow&&this.props.onShow()}},{key:"onExit",value:function(){r.removeClass(document.body,"p-overflow-hidden"),r.addClass(this.mask,"p-component-overlay-leave")}},{key:"onExited",value:function(){s.clear(this.mask),this.props.onHide&&this.props.onHide()}},{key:"isAutoPlayActive",value:function(){return this.state.slideShowActive}},{key:"startSlideShow",value:function(){var t=this;this.interval=setInterval((function(){t.onActiveItemChange({index:t.props.circular&&t.props.value.length-1===t.activeItemIndex?0:t.activeItemIndex+1})}),this.props.transitionInterval),this.setState({slideShowActive:!0})}},{key:"stopSlideShow",value:function(){this.interval&&clearInterval(this.interval),this.setState({slideShowActive:!1})}},{key:"getPositionClassName",value:function(t,e){var i=["top","left","bottom","right"].find((function(t){return t===e}));return i?"".concat(t,"-").concat(i):""}},{key:"isVertical",value:function(){return"left"===this.props.thumbnailsPosition||"right"===this.props.thumbnailsPosition}},{key:"componentDidUpdate",value:function(t,e){t.value!==this.props.value&&this.props.value&&this.props.value.length<this.state.numVisible&&this.setState({numVisible:this.props.value.length}),t.numVisible!==this.props.numVisible&&this.setState({numVisible:this.props.numVisible})}},{key:"componentWillUnmount",value:function(){this.state.slideShowActive&&this.stopSlideShow(),s.clear(this.mask)}},{key:"renderHeader",value:function(){return this.props.header?t.createElement("div",{className:"p-galleria-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?t.createElement("div",{className:"p-galleria-footer"},this.props.footer):null}},{key:"renderElement",value:function(){var e=this,n=this.isVertical(),r=this.props.showThumbnails&&this.getPositionClassName("p-galleria-thumbnails",this.props.thumbnailsPosition),s=this.props.showIndicators&&this.getPositionClassName("p-galleria-indicators",this.props.indicatorsPosition),o=i("p-galleria p-component",this.props.className,{"p-galleria-fullscreen":this.props.fullScreen,"p-galleria-indicator-onitem":this.props.showIndicatorsOnItem,"p-galleria-item-nav-onhover":this.props.showItemNavigatorsOnHover&&!this.props.fullScreen},r,s),l=this.props.fullScreen&&t.createElement("button",{type:"button",className:"p-galleria-close p-link",onClick:this.hide},t.createElement("span",{className:"p-galleria-close-icon pi pi-times"}),t.createElement(a,null)),p=this.renderHeader(),c=this.renderFooter();return t.createElement("div",{ref:this.galleriaRef,id:this.props.id,className:o,style:this.props.style},l,p,t.createElement("div",{className:"p-galleria-content"},t.createElement(k,{ref:function(t){return e.previewContent=t},value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.item,circular:this.props.circular,caption:this.props.caption,showIndicators:this.props.showIndicators,changeItemOnIndicatorHover:this.props.changeItemOnIndicatorHover,indicator:this.props.indicator,showItemNavigators:this.props.showItemNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,startSlideShow:this.startSlideShow,stopSlideShow:this.stopSlideShow}),this.props.showThumbnails&&t.createElement(A,{value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.thumbnail,numVisible:this.state.numVisible,responsiveOptions:this.props.responsiveOptions,circular:this.props.circular,isVertical:n,contentHeight:this.props.verticalThumbnailViewPortHeight,showThumbnailNavigators:this.props.showThumbnailNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,stopSlideShow:this.stopSlideShow})),c)}},{key:"renderGalleria",value:function(){var e=this,n=this.renderElement();if(this.props.fullScreen){var r=i("p-galleria-mask",{"p-galleria-visible":this.state.visible});return t.createElement(p,{element:t.createElement("div",{ref:function(t){return e.mask=t},className:r},t.createElement(l,{nodeRef:this.galleriaRef,classNames:"p-galleria",in:this.state.visible,timeout:{enter:150,exit:150},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntering:this.onEntering,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},n))})}return n}},{key:"render",value:function(){return this.props.value&&this.props.value.length>0&&this.renderGalleria()}}]),y}();y(M,"defaultProps",{id:null,value:null,activeIndex:0,fullScreen:!1,item:null,thumbnail:null,indicator:null,caption:null,className:null,style:null,header:null,footer:null,numVisible:3,responsiveOptions:null,showItemNavigators:!1,showThumbnailNavigators:!0,showItemNavigatorsOnHover:!1,changeItemOnIndicatorHover:!1,circular:!1,autoPlay:!1,transitionInterval:4e3,showThumbnails:!0,thumbnailsPosition:"bottom",verticalThumbnailViewPortHeight:"300px",showIndicators:!1,showIndicatorsOnItem:!1,indicatorsPosition:"bottom",baseZIndex:0,transitionOptions:null,onItemChange:null});export{M as Galleria};
|
|
1
|
+
import e,{Component as t}from"react";import{classNames as i,UniqueComponentId as n,DomHandler as r,ZIndexUtils as s}from"primereact/utils";import{Ripple as a}from"primereact/ripple";import o from"primereact/api";import{CSSTransition as l}from"primereact/csstransition";import{Portal as c}from"primereact/portal";function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t,i){return t&&u(e.prototype,t),i&&u(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function v(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function g(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function b(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function I(){return I=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},I.apply(this,arguments)}function x(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var w=function(n){v(l,t);var r,s,o=(r=l,s=x(),function(){var e,t=y(r);if(s){var i=y(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return g(this,e)});function l(e){var t;return p(this,l),(t=o.call(this,e)).navForward=t.navForward.bind(m(t)),t.navBackward=t.navBackward.bind(m(t)),t.next=t.next.bind(m(t)),t.prev=t.prev.bind(m(t)),t}return h(l,[{key:"step",value:function(e){this.itemsContainer&&(this.itemsContainer.style.transform=this.isVertical()?"translate3d(0, ".concat(100*e,"%, 0)"):"translate3d(".concat(100*e,"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s")}},{key:"next",value:function(){this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:this.props.activeItemIndex+1})}},{key:"prev",value:function(){this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"navBackward",value:function(e){this.stopSlideShow(),this.prev(),e&&e.cancelable&&e.preventDefault()}},{key:"navForward",value:function(e){this.stopSlideShow(),this.next(),e&&e.cancelable&&e.preventDefault()}},{key:"onIndicatorClick",value:function(e){this.stopSlideShow(),this.props.onActiveItemChange({index:e})}},{key:"onIndicatorMouseEnter",value:function(e){this.props.changeItemOnIndicatorHover&&(this.stopSlideShow(),this.props.onActiveItemChange({index:e}))}},{key:"onIndicatorKeyDown",value:function(e,t){13===e.which&&(this.stopSlideShow(),this.props.onActiveItemChange({index:t}))}},{key:"componentDidMount",value:function(){this.props.autoPlay&&this.props.startSlideShow()}},{key:"renderBackwardNavigator",value:function(){if(this.props.showItemNavigators){var t=!this.props.circular&&0===this.props.activeItemIndex,n=i("p-galleria-item-prev p-galleria-item-nav p-link",{"p-disabled":t});return e.createElement("button",{type:"button",className:n,onClick:this.navBackward,disabled:t},e.createElement("span",{className:"p-galleria-item-prev-icon pi pi-chevron-left"}),e.createElement(a,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showItemNavigators){var t=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1,n=i("p-galleria-item-next p-galleria-item-nav p-link",{"p-disabled":t});return e.createElement("button",{type:"button",className:n,onClick:this.navForward,disabled:t},e.createElement("span",{className:"p-galleria-item-next-icon pi pi-chevron-right"}),e.createElement(a,null))}return null}},{key:"renderCaption",value:function(){if(this.props.caption){var t=this.props.caption(this.props.value[this.props.activeItemIndex]);return e.createElement("div",{className:"p-galleria-caption"},t)}return null}},{key:"renderIndicator",value:function(t){var n=this,r=this.props.indicator&&this.props.indicator(t),s=i("p-galleria-indicator",{"p-highlight":this.props.activeItemIndex===t});return r||(r=e.createElement("button",{type:"button",tabIndex:-1,className:"p-link"},e.createElement(a,null))),e.createElement("li",{className:s,key:"p-galleria-indicator-"+t,tabIndex:0,onClick:function(){return n.onIndicatorClick(t)},onMouseEnter:function(){return n.onIndicatorMouseEnter(t)},onKeyDown:function(e){return n.onIndicatorKeyDown(e,t)}},r)}},{key:"renderIndicators",value:function(){if(this.props.showIndicators){for(var t=i("p-galleria-indicators p-reset",this.props.indicatorsContentClassName),n=[],r=0;r<this.props.value.length;r++)n.push(this.renderIndicator(r));return e.createElement("ul",{className:t},n)}return null}},{key:"render",value:function(){var t=this,i=this.props.itemTemplate&&this.props.itemTemplate(this.props.value[this.props.activeItemIndex]),n=this.renderBackwardNavigator(),r=this.renderForwardNavigator(),s=this.renderCaption(),a=this.renderIndicators();return e.createElement("div",{ref:function(e){return t.props.forwardRef(e)},className:"p-galleria-item-wrapper"},e.createElement("div",{className:"p-galleria-item-container"},n,e.createElement("div",{className:"p-galleria-item"},i),r,s),a)}}]),l}(),k=e.forwardRef((function(t,i){return e.createElement(w,I({forwardRef:i},t))}));function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function E(e){if(Array.isArray(e))return S(e)}function C(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function O(e,t){if(e){if("string"==typeof e)return S(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?S(e,t):void 0}}function N(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var V=function(){function e(){p(this,e)}return h(e,null,[{key:"equals",value:function(e,t,i){return i&&e&&"object"===f(e)&&t&&"object"===f(t)?this.resolveFieldData(e,i)===this.resolveFieldData(t,i):this.deepEquals(e,t)}},{key:"deepEquals",value:function(e,t){if(e===t)return!0;if(e&&t&&"object"==f(e)&&"object"==f(t)){var i,n,r,s=Array.isArray(e),a=Array.isArray(t);if(s&&a){if((n=e.length)!==t.length)return!1;for(i=n;0!=i--;)if(!this.deepEquals(e[i],t[i]))return!1;return!0}if(s!==a)return!1;var o=e instanceof Date,l=t instanceof Date;if(o!==l)return!1;if(o&&l)return e.getTime()===t.getTime();var c=e instanceof RegExp,p=t instanceof RegExp;if(c!==p)return!1;if(c&&p)return e.toString()===t.toString();var u=Object.keys(e);if((n=u.length)!==Object.keys(t).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,u[i]))return!1;for(i=n;0!=i--;)if(!this.deepEquals(e[r=u[i]],t[r]))return!1;return!0}return e!=e&&t!=t}},{key:"resolveFieldData",value:function(e,t){if(e&&Object.keys(e).length&&t){if(this.isFunction(t))return t(e);if(-1===t.indexOf("."))return e[t];for(var i=t.split("."),n=e,r=0,s=i.length;r<s;++r){if(null==n)return null;n=n[i[r]]}return n}return null}},{key:"isFunction",value:function(e){return!!(e&&e.constructor&&e.call&&e.apply)}},{key:"findDiffKeys",value:function(e,t){return e&&t?Object.keys(e).filter((function(e){return!t.hasOwnProperty(e)})).reduce((function(t,i){return t[i]=e[i],t}),{}):{}}},{key:"reorderArray",value:function(e,t,i){var n;if(e&&t!==i){if(i>=e.length)for(n=i-e.length;1+n--;)e.push(void 0);e.splice(i,0,e.splice(t,1)[0])}}},{key:"findIndexInList",value:function(e,t,i){var n=this;return t?t.findIndex(i?function(t){return n.equals(t,e,i)}:function(t){return t===e}):-1}},{key:"getJSXElement",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return this.isFunction(e)?e.apply(void 0,i):e}},{key:"getPropValue",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return this.isFunction(e)?e.apply(void 0,i):e}},{key:"getRefElement",value:function(e){return e?"object"===f(e)&&e.hasOwnProperty("current")?e.current:e:null}},{key:"removeAccents",value:function(e){return e&&e.search(/[\xC0-\xFF]/g)>-1&&(e=e.replace(/[\xC0-\xC5]/g,"A").replace(/[\xC6]/g,"AE").replace(/[\xC7]/g,"C").replace(/[\xC8-\xCB]/g,"E").replace(/[\xCC-\xCF]/g,"I").replace(/[\xD0]/g,"D").replace(/[\xD1]/g,"N").replace(/[\xD2-\xD6\xD8]/g,"O").replace(/[\xD9-\xDC]/g,"U").replace(/[\xDD]/g,"Y").replace(/[\xDE]/g,"P").replace(/[\xE0-\xE5]/g,"a").replace(/[\xE6]/g,"ae").replace(/[\xE7]/g,"c").replace(/[\xE8-\xEB]/g,"e").replace(/[\xEC-\xEF]/g,"i").replace(/[\xF1]/g,"n").replace(/[\xF2-\xF6\xF8]/g,"o").replace(/[\xF9-\xFC]/g,"u").replace(/[\xFE]/g,"p").replace(/[\xFD\xFF]/g,"y")),e}},{key:"isEmpty",value:function(e){return null==e||""===e||Array.isArray(e)&&0===e.length||!(e instanceof Date)&&"object"===f(e)&&0===Object.keys(e).length}},{key:"isNotEmpty",value:function(e){return!this.isEmpty(e)}},{key:"sort",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3?arguments[3]:void 0;return i*(null==e&&null!=t?-1:null!=e&&null==t?1:null==e&&null==t?0:"string"==typeof e&&"string"==typeof t?e.localeCompare(t,n,{numeric:!0}):e<t?-1:e>t?1:0)}}]),e}();function P(e){var t=A();return function(){var i,n=y(e);if(t){var r=y(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return g(this,i)}}function A(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var T=function(n){v(s,t);var r=P(s);function s(e){var t;return p(this,s),(t=r.call(this,e)).onItemClick=t.onItemClick.bind(m(t)),t.onItemKeyDown=t.onItemKeyDown.bind(m(t)),t}return h(s,[{key:"onItemClick",value:function(e){this.props.onItemClick({originalEvent:e,index:this.props.index})}},{key:"onItemKeyDown",value:function(e){13===e.which&&this.props.onItemClick({originalEvent:e,index:this.props.index})}},{key:"render",value:function(){var t=this.props.template&&this.props.template(this.props.item),n=i(this.props.className,"p-galleria-thumbnail-item",{"p-galleria-thumbnail-item-current":this.props.current,"p-galleria-thumbnail-item-active":this.props.active,"p-galleria-thumbnail-item-start":this.props.start,"p-galleria-thumbnail-item-end":this.props.end});return e.createElement("div",{className:n},e.createElement("div",{className:"p-galleria-thumbnail-item-content",tabIndex:this.props.active?0:null,onClick:this.onItemClick,onKeyDown:this.onItemKeyDown},t))}}]),s}();b(T,"defaultProps",{index:null,template:null,item:null,current:!1,active:!1,start:!1,end:!1,className:null,onItemClick:null});var D=function(s){v(c,t);var l=P(c);function c(e){var t;return p(this,c),(t=l.call(this,e)).state={numVisible:e.numVisible,totalShiftedItems:0,page:0},t.navForward=t.navForward.bind(m(t)),t.navBackward=t.navBackward.bind(m(t)),t.onTransitionEnd=t.onTransitionEnd.bind(m(t)),t.onTouchStart=t.onTouchStart.bind(m(t)),t.onTouchMove=t.onTouchMove.bind(m(t)),t.onTouchEnd=t.onTouchEnd.bind(m(t)),t.onItemClick=t.onItemClick.bind(m(t)),t.attributeSelector=n(),t}return h(c,[{key:"step",value:function(e){var t=this.state.totalShiftedItems+e;e<0&&-1*t+this.state.numVisible>this.props.value.length-1?t=this.state.numVisible-this.props.value.length:e>0&&t>0&&(t=0),this.props.circular&&(e<0&&this.props.value.length-1===this.props.activeItemIndex?t=0:e>0&&0===this.props.activeItemIndex&&(t=this.state.numVisible-this.props.value.length)),this.itemsContainer&&(r.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(t*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(t*(100/this.state.numVisible),"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s"),this.setState({totalShiftedItems:t})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"getMedianItemIndex",value:function(){var e=Math.floor(this.state.numVisible/2);return this.state.numVisible%2?e:e-1}},{key:"navBackward",value:function(e){this.stopSlideShow();var t=0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0;this.state.numVisible-(t+this.state.totalShiftedItems)-1>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems!=0||this.props.circular)&&this.step(1),this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:t}),e.cancelable&&e.preventDefault()}},{key:"navForward",value:function(e){this.stopSlideShow();var t=this.props.activeItemIndex+1;t+this.state.totalShiftedItems>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1||this.props.circular)&&this.step(-1),this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:t}),e.cancelable&&e.preventDefault()}},{key:"onItemClick",value:function(e){this.stopSlideShow();var t=e.index;if(t!==this.props.activeItemIndex){var i=t+this.state.totalShiftedItems,n=0;t<this.props.activeItemIndex?(n=this.state.numVisible-i-1-this.getMedianItemIndex())>0&&-1*this.state.totalShiftedItems!=0&&this.step(n):(n=this.getMedianItemIndex()-i)<0&&-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1&&this.step(n),this.props.onActiveItemChange({index:t})}}},{key:"onTransitionEnd",value:function(e){this.itemsContainer&&"transform"===e.propertyName&&(r.addClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="")}},{key:"onTouchStart",value:function(e){var t=e.changedTouches[0];this.startPos={x:t.pageX,y:t.pageY}}},{key:"onTouchMove",value:function(e){e.cancelable&&e.preventDefault()}},{key:"onTouchEnd",value:function(e){var t=e.changedTouches[0];this.changePageOnTouch(e,this.props.isVertical?t.pageY-this.startPos.y:t.pageX-this.startPos.x)}},{key:"changePageOnTouch",value:function(e,t){t<0?this.navForward(e):this.navBackward(e)}},{key:"getTotalPageNumber",value:function(){return this.props.value.length>this.state.numVisible?this.props.value.length-this.state.numVisible+1:0}},{key:"createStyle",value:function(){this.thumbnailsStyle||(this.thumbnailsStyle=r.createInlineStyle(o.nonce));var e,t="\n .p-galleria-thumbnail-items[".concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/this.state.numVisible,"%\n }\n ");if(this.props.responsiveOptions){this.responsiveOptions=E(e=this.props.responsiveOptions)||C(e)||O(e)||N(),this.responsiveOptions.sort((function(e,t){return V.sort(e.breakpoint,t.breakpoint,-1,o.locale)}));for(var i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];t+="\n @media screen and (max-width: ".concat(n.breakpoint,") {\n .p-galleria-thumbnail-items[").concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/n.numVisible,"%\n }\n }\n ")}}this.thumbnailsStyle.innerHTML=t}},{key:"calculatePosition",value:function(){if(this.itemsContainer&&this.responsiveOptions){for(var e=window.innerWidth,t={numVisible:this.props.numVisible},i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];parseInt(n.breakpoint,10)>=e&&(t=n)}this.state.numVisible!==t.numVisible&&this.setState({numVisible:t.numVisible})}}},{key:"bindDocumentListeners",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(){e.calculatePosition()},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentListeners",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.itemsContainer&&this.itemsContainer.setAttribute(this.attributeSelector,""),this.createStyle(),this.calculatePosition(),this.props.responsiveOptions&&this.bindDocumentListeners()}},{key:"componentDidUpdate",value:function(e,t){var i=this.state.totalShiftedItems;t.numVisible===this.state.numVisible&&e.activeItemIndex===this.props.activeItemIndex||((i=this.props.activeItemIndex<=this.getMedianItemIndex()?0:this.props.value.length-this.state.numVisible+this.getMedianItemIndex()<this.props.activeItemIndex?this.state.numVisible-this.props.value.length:this.props.value.length-this.state.numVisible<this.props.activeItemIndex&&this.state.numVisible%2==0?-1*this.props.activeItemIndex+this.getMedianItemIndex()+1:-1*this.props.activeItemIndex+this.getMedianItemIndex())!==this.state.totalShiftedItems&&this.setState({totalShiftedItems:i}),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(i*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(i*(100/this.state.numVisible),"%, 0, 0)"),e.activeItemIndex!==this.props.activeItemIndex&&(r.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="transform 500ms ease 0s"))}},{key:"componentWillUnmount",value:function(){this.props.responsiveOptions&&this.unbindDocumentListeners()}},{key:"renderItems",value:function(){var t=this;return this.props.value.map((function(i,n){var r=-1*t.state.totalShiftedItems,s=r+t.state.numVisible-1;return e.createElement(T,{key:n,index:n,template:t.props.itemTemplate,item:i,active:r<=n&&s>=n,start:r===n,end:s===n,onItemClick:t.onItemClick,current:t.props.activeItemIndex===n})}))}},{key:"renderBackwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var t=!this.props.circular&&0===this.props.activeItemIndex||this.props.value.length<=this.state.numVisible,n=i("p-galleria-thumbnail-prev p-link",{"p-disabled":t}),r=i("p-galleria-thumbnail-prev-icon pi",{"pi-chevron-left":!this.props.isVertical,"pi-chevron-up":this.props.isVertical});return e.createElement("button",{className:n,onClick:this.navBackward,disabled:t},e.createElement("span",{className:r}),e.createElement(a,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var t=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1||this.props.value.length<=this.state.numVisible,n=i("p-galleria-thumbnail-next p-link",{"p-disabled":t}),r=i("p-galleria-thumbnail-next-icon pi",{"pi-chevron-right":!this.props.isVertical,"pi-chevron-down":this.props.isVertical});return e.createElement("button",{className:n,onClick:this.navForward,disabled:t},e.createElement("span",{className:r}),e.createElement(a,null))}return null}},{key:"renderContent",value:function(){var t=this,i=this.renderItems(),n=this.props.isVertical?this.props.contentHeight:"",r=this.renderBackwardNavigator(),s=this.renderForwardNavigator();return e.createElement("div",{className:"p-galleria-thumbnail-container"},r,e.createElement("div",{className:"p-galleria-thumbnail-items-container",style:{height:n}},e.createElement("div",{ref:function(e){return t.itemsContainer=e},className:"p-galleria-thumbnail-items",onTransitionEnd:this.onTransitionEnd,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd},i)),s)}},{key:"render",value:function(){var t=this.renderContent();return e.createElement("div",{className:"p-galleria-thumbnail-wrapper"},t)}}]),c}();function j(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function F(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?j(Object(i),!0).forEach((function(t){b(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):j(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function R(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var M=function(n){v(b,t);var u,d,f=(u=b,d=R(),function(){var e,t=y(u);if(d){var i=y(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return g(this,e)});function b(t){var i;return p(this,b),(i=f.call(this,t)).state={visible:!1,numVisible:t.numVisible,slideShowActive:!1},i.props.onItemChange||(i.state=F(F({},i.state),{},{activeIndex:t.activeIndex})),i.onActiveItemChange=i.onActiveItemChange.bind(m(i)),i.show=i.show.bind(m(i)),i.hide=i.hide.bind(m(i)),i.startSlideShow=i.startSlideShow.bind(m(i)),i.stopSlideShow=i.stopSlideShow.bind(m(i)),i.onEnter=i.onEnter.bind(m(i)),i.onEntering=i.onEntering.bind(m(i)),i.onEntered=i.onEntered.bind(m(i)),i.onExit=i.onExit.bind(m(i)),i.onExited=i.onExited.bind(m(i)),i.galleriaRef=e.createRef(),i}return h(b,[{key:"activeItemIndex",get:function(){return this.props.onItemChange?this.props.activeIndex:this.state.activeIndex}},{key:"onActiveItemChange",value:function(e){this.props.onItemChange?this.props.onItemChange(e):this.setState({activeIndex:e.index})}},{key:"show",value:function(){this.setState({visible:!0})}},{key:"hide",value:function(){this.setState({visible:!1})}},{key:"onEnter",value:function(){r.addClass(document.body,"p-overflow-hidden")}},{key:"onEntering",value:function(){s.set("modal",this.mask,o.autoZIndex,this.props.baseZIndex||o.zIndex.modal),r.addMultipleClasses(this.mask,"p-component-overlay p-component-overlay-enter")}},{key:"onEntered",value:function(){this.props.onShow&&this.props.onShow()}},{key:"onExit",value:function(){r.removeClass(document.body,"p-overflow-hidden"),r.addClass(this.mask,"p-component-overlay-leave")}},{key:"onExited",value:function(){s.clear(this.mask),this.props.onHide&&this.props.onHide()}},{key:"isAutoPlayActive",value:function(){return this.state.slideShowActive}},{key:"startSlideShow",value:function(){var e=this;this.interval=setInterval((function(){e.onActiveItemChange({index:e.props.circular&&e.props.value.length-1===e.activeItemIndex?0:e.activeItemIndex+1})}),this.props.transitionInterval),this.setState({slideShowActive:!0})}},{key:"stopSlideShow",value:function(){this.interval&&clearInterval(this.interval),this.setState({slideShowActive:!1})}},{key:"getPositionClassName",value:function(e,t){var i=["top","left","bottom","right"].find((function(e){return e===t}));return i?"".concat(e,"-").concat(i):""}},{key:"isVertical",value:function(){return"left"===this.props.thumbnailsPosition||"right"===this.props.thumbnailsPosition}},{key:"componentDidUpdate",value:function(e,t){e.value!==this.props.value&&this.props.value&&this.props.value.length<this.state.numVisible&&this.setState({numVisible:this.props.value.length}),e.numVisible!==this.props.numVisible&&this.setState({numVisible:this.props.numVisible})}},{key:"componentWillUnmount",value:function(){this.state.slideShowActive&&this.stopSlideShow(),s.clear(this.mask)}},{key:"renderHeader",value:function(){return this.props.header?e.createElement("div",{className:"p-galleria-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?e.createElement("div",{className:"p-galleria-footer"},this.props.footer):null}},{key:"renderElement",value:function(){var t=this,n=this.isVertical(),r=this.props.showThumbnails&&this.getPositionClassName("p-galleria-thumbnails",this.props.thumbnailsPosition),s=this.props.showIndicators&&this.getPositionClassName("p-galleria-indicators",this.props.indicatorsPosition),o=i("p-galleria p-component",this.props.className,{"p-galleria-fullscreen":this.props.fullScreen,"p-galleria-indicator-onitem":this.props.showIndicatorsOnItem,"p-galleria-item-nav-onhover":this.props.showItemNavigatorsOnHover&&!this.props.fullScreen},r,s),l=this.props.fullScreen&&e.createElement("button",{type:"button",className:"p-galleria-close p-link",onClick:this.hide},e.createElement("span",{className:"p-galleria-close-icon pi pi-times"}),e.createElement(a,null)),c=this.renderHeader(),p=this.renderFooter();return e.createElement("div",{ref:this.galleriaRef,id:this.props.id,className:o,style:this.props.style},l,c,e.createElement("div",{className:"p-galleria-content"},e.createElement(k,{ref:function(e){return t.previewContent=e},value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.item,circular:this.props.circular,caption:this.props.caption,showIndicators:this.props.showIndicators,changeItemOnIndicatorHover:this.props.changeItemOnIndicatorHover,indicator:this.props.indicator,showItemNavigators:this.props.showItemNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,startSlideShow:this.startSlideShow,stopSlideShow:this.stopSlideShow}),this.props.showThumbnails&&e.createElement(D,{value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.thumbnail,numVisible:this.state.numVisible,responsiveOptions:this.props.responsiveOptions,circular:this.props.circular,isVertical:n,contentHeight:this.props.verticalThumbnailViewPortHeight,showThumbnailNavigators:this.props.showThumbnailNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,stopSlideShow:this.stopSlideShow})),p)}},{key:"renderGalleria",value:function(){var t=this,n=this.renderElement();if(this.props.fullScreen){var r=i("p-galleria-mask",{"p-galleria-visible":this.state.visible});return e.createElement(c,{element:e.createElement("div",{ref:function(e){return t.mask=e},className:r},e.createElement(l,{nodeRef:this.galleriaRef,classNames:"p-galleria",in:this.state.visible,timeout:{enter:150,exit:150},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntering:this.onEntering,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},n))})}return n}},{key:"render",value:function(){return this.props.value&&this.props.value.length>0&&this.renderGalleria()}}]),b}();b(M,"defaultProps",{id:null,value:null,activeIndex:0,fullScreen:!1,item:null,thumbnail:null,indicator:null,caption:null,className:null,style:null,header:null,footer:null,numVisible:3,responsiveOptions:null,showItemNavigators:!1,showThumbnailNavigators:!0,showItemNavigatorsOnHover:!1,changeItemOnIndicatorHover:!1,circular:!1,autoPlay:!1,transitionInterval:4e3,showThumbnails:!0,thumbnailsPosition:"bottom",verticalThumbnailViewPortHeight:"300px",showIndicators:!1,showIndicatorsOnItem:!1,indicatorsPosition:"bottom",baseZIndex:0,transitionOptions:null,onItemChange:null});export{M as Galleria};
|
package/galleria/galleria.js
CHANGED
|
@@ -406,6 +406,217 @@ this.primereact.galleria = (function (exports, React, utils, ripple, PrimeReact,
|
|
|
406
406
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
+
var ObjectUtils = /*#__PURE__*/function () {
|
|
410
|
+
function ObjectUtils() {
|
|
411
|
+
_classCallCheck(this, ObjectUtils);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
_createClass(ObjectUtils, null, [{
|
|
415
|
+
key: "equals",
|
|
416
|
+
value: function equals(obj1, obj2, field) {
|
|
417
|
+
if (field && obj1 && _typeof(obj1) === 'object' && obj2 && _typeof(obj2) === 'object') return this.resolveFieldData(obj1, field) === this.resolveFieldData(obj2, field);else return this.deepEquals(obj1, obj2);
|
|
418
|
+
}
|
|
419
|
+
}, {
|
|
420
|
+
key: "deepEquals",
|
|
421
|
+
value: function deepEquals(a, b) {
|
|
422
|
+
if (a === b) return true;
|
|
423
|
+
|
|
424
|
+
if (a && b && _typeof(a) == 'object' && _typeof(b) == 'object') {
|
|
425
|
+
var arrA = Array.isArray(a),
|
|
426
|
+
arrB = Array.isArray(b),
|
|
427
|
+
i,
|
|
428
|
+
length,
|
|
429
|
+
key;
|
|
430
|
+
|
|
431
|
+
if (arrA && arrB) {
|
|
432
|
+
length = a.length;
|
|
433
|
+
if (length !== b.length) return false;
|
|
434
|
+
|
|
435
|
+
for (i = length; i-- !== 0;) {
|
|
436
|
+
if (!this.deepEquals(a[i], b[i])) return false;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
return true;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (arrA !== arrB) return false;
|
|
443
|
+
var dateA = a instanceof Date,
|
|
444
|
+
dateB = b instanceof Date;
|
|
445
|
+
if (dateA !== dateB) return false;
|
|
446
|
+
if (dateA && dateB) return a.getTime() === b.getTime();
|
|
447
|
+
var regexpA = a instanceof RegExp,
|
|
448
|
+
regexpB = b instanceof RegExp;
|
|
449
|
+
if (regexpA !== regexpB) return false;
|
|
450
|
+
if (regexpA && regexpB) return a.toString() === b.toString();
|
|
451
|
+
var keys = Object.keys(a);
|
|
452
|
+
length = keys.length;
|
|
453
|
+
if (length !== Object.keys(b).length) return false;
|
|
454
|
+
|
|
455
|
+
for (i = length; i-- !== 0;) {
|
|
456
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
for (i = length; i-- !== 0;) {
|
|
460
|
+
key = keys[i];
|
|
461
|
+
if (!this.deepEquals(a[key], b[key])) return false;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return true;
|
|
465
|
+
}
|
|
466
|
+
/*eslint no-self-compare: "off"*/
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
return a !== a && b !== b;
|
|
470
|
+
}
|
|
471
|
+
}, {
|
|
472
|
+
key: "resolveFieldData",
|
|
473
|
+
value: function resolveFieldData(data, field) {
|
|
474
|
+
if (data && Object.keys(data).length && field) {
|
|
475
|
+
if (this.isFunction(field)) {
|
|
476
|
+
return field(data);
|
|
477
|
+
} else if (field.indexOf('.') === -1) {
|
|
478
|
+
return data[field];
|
|
479
|
+
} else {
|
|
480
|
+
var fields = field.split('.');
|
|
481
|
+
var value = data;
|
|
482
|
+
|
|
483
|
+
for (var i = 0, len = fields.length; i < len; ++i) {
|
|
484
|
+
if (value == null) {
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
value = value[fields[i]];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
return value;
|
|
492
|
+
}
|
|
493
|
+
} else {
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}, {
|
|
498
|
+
key: "isFunction",
|
|
499
|
+
value: function isFunction(obj) {
|
|
500
|
+
return !!(obj && obj.constructor && obj.call && obj.apply);
|
|
501
|
+
}
|
|
502
|
+
}, {
|
|
503
|
+
key: "findDiffKeys",
|
|
504
|
+
value: function findDiffKeys(obj1, obj2) {
|
|
505
|
+
if (!obj1 || !obj2) {
|
|
506
|
+
return {};
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
return Object.keys(obj1).filter(function (key) {
|
|
510
|
+
return !obj2.hasOwnProperty(key);
|
|
511
|
+
}).reduce(function (result, current) {
|
|
512
|
+
result[current] = obj1[current];
|
|
513
|
+
return result;
|
|
514
|
+
}, {});
|
|
515
|
+
}
|
|
516
|
+
}, {
|
|
517
|
+
key: "reorderArray",
|
|
518
|
+
value: function reorderArray(value, from, to) {
|
|
519
|
+
var target;
|
|
520
|
+
|
|
521
|
+
if (value && from !== to) {
|
|
522
|
+
if (to >= value.length) {
|
|
523
|
+
target = to - value.length;
|
|
524
|
+
|
|
525
|
+
while (target-- + 1) {
|
|
526
|
+
value.push(undefined);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
value.splice(to, 0, value.splice(from, 1)[0]);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}, {
|
|
534
|
+
key: "findIndexInList",
|
|
535
|
+
value: function findIndexInList(value, list, dataKey) {
|
|
536
|
+
var _this = this;
|
|
537
|
+
|
|
538
|
+
if (list) {
|
|
539
|
+
return dataKey ? list.findIndex(function (item) {
|
|
540
|
+
return _this.equals(item, value, dataKey);
|
|
541
|
+
}) : list.findIndex(function (item) {
|
|
542
|
+
return item === value;
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
return -1;
|
|
547
|
+
}
|
|
548
|
+
}, {
|
|
549
|
+
key: "getJSXElement",
|
|
550
|
+
value: function getJSXElement(obj) {
|
|
551
|
+
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
552
|
+
params[_key - 1] = arguments[_key];
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
|
|
556
|
+
}
|
|
557
|
+
}, {
|
|
558
|
+
key: "getPropValue",
|
|
559
|
+
value: function getPropValue(obj) {
|
|
560
|
+
for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
561
|
+
params[_key2 - 1] = arguments[_key2];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
|
|
565
|
+
}
|
|
566
|
+
}, {
|
|
567
|
+
key: "getRefElement",
|
|
568
|
+
value: function getRefElement(ref) {
|
|
569
|
+
if (ref) {
|
|
570
|
+
return _typeof(ref) === 'object' && ref.hasOwnProperty('current') ? ref.current : ref;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
return null;
|
|
574
|
+
}
|
|
575
|
+
}, {
|
|
576
|
+
key: "removeAccents",
|
|
577
|
+
value: function removeAccents(str) {
|
|
578
|
+
if (str && str.search(/[\xC0-\xFF]/g) > -1) {
|
|
579
|
+
str = str.replace(/[\xC0-\xC5]/g, "A").replace(/[\xC6]/g, "AE").replace(/[\xC7]/g, "C").replace(/[\xC8-\xCB]/g, "E").replace(/[\xCC-\xCF]/g, "I").replace(/[\xD0]/g, "D").replace(/[\xD1]/g, "N").replace(/[\xD2-\xD6\xD8]/g, "O").replace(/[\xD9-\xDC]/g, "U").replace(/[\xDD]/g, "Y").replace(/[\xDE]/g, "P").replace(/[\xE0-\xE5]/g, "a").replace(/[\xE6]/g, "ae").replace(/[\xE7]/g, "c").replace(/[\xE8-\xEB]/g, "e").replace(/[\xEC-\xEF]/g, "i").replace(/[\xF1]/g, "n").replace(/[\xF2-\xF6\xF8]/g, "o").replace(/[\xF9-\xFC]/g, "u").replace(/[\xFE]/g, "p").replace(/[\xFD\xFF]/g, "y");
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
return str;
|
|
583
|
+
}
|
|
584
|
+
}, {
|
|
585
|
+
key: "isEmpty",
|
|
586
|
+
value: function isEmpty(value) {
|
|
587
|
+
return value === null || value === undefined || value === '' || Array.isArray(value) && value.length === 0 || !(value instanceof Date) && _typeof(value) === 'object' && Object.keys(value).length === 0;
|
|
588
|
+
}
|
|
589
|
+
}, {
|
|
590
|
+
key: "isNotEmpty",
|
|
591
|
+
value: function isNotEmpty(value) {
|
|
592
|
+
return !this.isEmpty(value);
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Compare value1 and value2 ascending by default (1) or pass in order as -1 for descending.
|
|
596
|
+
*
|
|
597
|
+
* @param {any} value1 the first value
|
|
598
|
+
* @param {any} value2 the second value
|
|
599
|
+
* @param {number | undefined} order by default ascending (1) set to descending (-1)
|
|
600
|
+
* @param {string | undefined} locale the locale to use (default to browser locale if null)
|
|
601
|
+
* @returns either 0, 1 or -1 for comparing the two values
|
|
602
|
+
*/
|
|
603
|
+
|
|
604
|
+
}, {
|
|
605
|
+
key: "sort",
|
|
606
|
+
value: function sort(value1, value2) {
|
|
607
|
+
var order = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
608
|
+
var locale = arguments.length > 3 ? arguments[3] : undefined;
|
|
609
|
+
var result = null;
|
|
610
|
+
if (value1 == null && value2 != null) result = -1;else if (value1 != null && value2 == null) result = 1;else if (value1 == null && value2 == null) result = 0;else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2, locale, {
|
|
611
|
+
numeric: true
|
|
612
|
+
});else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
|
613
|
+
return order * result;
|
|
614
|
+
}
|
|
615
|
+
}]);
|
|
616
|
+
|
|
617
|
+
return ObjectUtils;
|
|
618
|
+
}();
|
|
619
|
+
|
|
409
620
|
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
410
621
|
|
|
411
622
|
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -680,11 +891,7 @@ this.primereact.galleria = (function (exports, React, utils, ripple, PrimeReact,
|
|
|
680
891
|
this.responsiveOptions.sort(function (data1, data2) {
|
|
681
892
|
var value1 = data1.breakpoint;
|
|
682
893
|
var value2 = data2.breakpoint;
|
|
683
|
-
|
|
684
|
-
if (value1 == null && value2 != null) result = -1;else if (value1 != null && value2 == null) result = 1;else if (value1 == null && value2 == null) result = 0;else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2, undefined, {
|
|
685
|
-
numeric: true
|
|
686
|
-
});else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
|
687
|
-
return -1 * result;
|
|
894
|
+
return ObjectUtils.sort(value1, value2, -1, PrimeReact__default["default"].locale);
|
|
688
895
|
});
|
|
689
896
|
|
|
690
897
|
for (var i = 0; i < this.responsiveOptions.length; i++) {
|