ngx-sfc-common 0.0.30 → 0.0.32
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/esm2020/lib/components/load-container/load-container.component.mjs +3 -3
- package/esm2020/lib/components/load-container/models/load-container-parameters.model.mjs +1 -1
- package/esm2020/lib/components/tag/tag.component.mjs +16 -10
- package/esm2020/lib/components/tag/tag.model.mjs +1 -1
- package/esm2020/lib/utils/common.utils.mjs +80 -1
- package/esm2020/lib/utils/index.mjs +2 -2
- package/fesm2015/ngx-sfc-common.mjs +894 -807
- package/fesm2015/ngx-sfc-common.mjs.map +1 -1
- package/fesm2020/ngx-sfc-common.mjs +890 -805
- package/fesm2020/ngx-sfc-common.mjs.map +1 -1
- package/lib/components/load-container/models/load-container-parameters.model.d.ts +1 -0
- package/lib/components/tag/tag.component.d.ts +4 -3
- package/lib/components/tag/tag.model.d.ts +4 -1
- package/lib/utils/common.utils.d.ts +26 -0
- package/lib/utils/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -593,1068 +593,1146 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
593
593
|
}] } });
|
|
594
594
|
|
|
595
595
|
/**
|
|
596
|
-
*
|
|
597
|
-
* @param
|
|
598
|
-
* @
|
|
599
|
-
* @returns Date with minute value
|
|
596
|
+
* Return true if string has value(not empty string)
|
|
597
|
+
* @param value String value to check
|
|
598
|
+
* @returns True if string is not null and defined(not empty string)
|
|
600
599
|
*/
|
|
601
|
-
function
|
|
602
|
-
|
|
603
|
-
result.setMinutes(minute);
|
|
604
|
-
return result;
|
|
600
|
+
function isNullOrEmptyString(value) {
|
|
601
|
+
return !isDefined(value) || value === CommonConstants.EMPTY_STRING;
|
|
605
602
|
}
|
|
606
603
|
/**
|
|
607
|
-
*
|
|
608
|
-
* @param
|
|
609
|
-
* @param
|
|
610
|
-
* @returns
|
|
604
|
+
* Return true if value contains includeValue
|
|
605
|
+
* @param value String value to check
|
|
606
|
+
* @param includeValue Value to check if it include
|
|
607
|
+
* @returns True if value contains includeValue
|
|
611
608
|
*/
|
|
612
|
-
function
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
609
|
+
function contains(value, includeValue) {
|
|
610
|
+
return !isNullOrEmptyString(value) && !isNullOrEmptyString(includeValue)
|
|
611
|
+
? value.toLowerCase()
|
|
612
|
+
.includes(includeValue.toLowerCase())
|
|
613
|
+
: false;
|
|
616
614
|
}
|
|
617
615
|
/**
|
|
618
|
-
*
|
|
619
|
-
* @param
|
|
620
|
-
* @
|
|
621
|
-
* @returns Date with day number
|
|
616
|
+
* Return trimed value
|
|
617
|
+
* @param value Value for trim modification
|
|
618
|
+
* @returns Trimed value
|
|
622
619
|
*/
|
|
623
|
-
function
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}
|
|
620
|
+
function trim(value) {
|
|
621
|
+
return isNullOrEmptyString(value) ? value : value.replace(/\s/g, '');
|
|
622
|
+
}
|
|
623
|
+
|
|
628
624
|
/**
|
|
629
|
-
*
|
|
630
|
-
* @param
|
|
631
|
-
* @
|
|
632
|
-
* @returns Date with year value
|
|
625
|
+
* Return true if collection not empty
|
|
626
|
+
* @param collection Array of items
|
|
627
|
+
* @returns True if collection not empty
|
|
633
628
|
*/
|
|
634
|
-
function
|
|
635
|
-
|
|
636
|
-
result.setFullYear(year);
|
|
637
|
-
return result;
|
|
629
|
+
function any(collection) {
|
|
630
|
+
return isDefined(collection) && collection.length > 0;
|
|
638
631
|
}
|
|
639
632
|
/**
|
|
640
|
-
*
|
|
641
|
-
* @param
|
|
642
|
-
* @param value
|
|
643
|
-
* @returns
|
|
633
|
+
* Return true if collection has such value
|
|
634
|
+
* @param collection Array of items
|
|
635
|
+
* @param value Value to check
|
|
636
|
+
* @returns True if found value in collection
|
|
644
637
|
*/
|
|
645
|
-
function
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
return result;
|
|
638
|
+
function hasItem(collection, value) {
|
|
639
|
+
return any(collection)
|
|
640
|
+
&& collection.findIndex(item => item === value) !== CommonConstants.NOT_FOUND_INDEX;
|
|
649
641
|
}
|
|
650
642
|
/**
|
|
651
|
-
*
|
|
652
|
-
* @param
|
|
653
|
-
* @param
|
|
654
|
-
* @returns
|
|
643
|
+
* Return true if collection has such value by predicate function
|
|
644
|
+
* @param collection Array of items
|
|
645
|
+
* @param predicate Function to define check logic
|
|
646
|
+
* @returns True if found value in collection
|
|
655
647
|
*/
|
|
656
|
-
function
|
|
657
|
-
|
|
658
|
-
result.setMilliseconds(value);
|
|
659
|
-
return result;
|
|
648
|
+
function hasItemBy(collection, predicate) {
|
|
649
|
+
return any(collection) && collection.findIndex(predicate) !== CommonConstants.NOT_FOUND_INDEX;
|
|
660
650
|
}
|
|
661
651
|
/**
|
|
662
|
-
*
|
|
663
|
-
* @param
|
|
664
|
-
* @
|
|
652
|
+
* Return true if collection of objects has such value as object
|
|
653
|
+
* @param collection Array of objects
|
|
654
|
+
* @param property Property name
|
|
655
|
+
* @param value Value to check
|
|
656
|
+
* @returns True if found value in collection
|
|
665
657
|
*/
|
|
666
|
-
function
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
658
|
+
function hasObjectItem(collection, // TODO <-- Array<T>
|
|
659
|
+
property, value) {
|
|
660
|
+
return any(collection)
|
|
661
|
+
&& collection.findIndex(item => item.hasOwnProperty(property)
|
|
662
|
+
&& item[property] === value) !== CommonConstants.NOT_FOUND_INDEX;
|
|
671
663
|
}
|
|
672
664
|
/**
|
|
673
|
-
*
|
|
674
|
-
* @param
|
|
675
|
-
* @
|
|
665
|
+
* Return true if first collection has item in second collection
|
|
666
|
+
* @param collection1 Array of objects where search
|
|
667
|
+
* @param collection2 Array of objects where try to find
|
|
668
|
+
* @returns
|
|
676
669
|
*/
|
|
677
|
-
function
|
|
678
|
-
|
|
679
|
-
nextDate.setDate(date.getDate() + 1);
|
|
680
|
-
return nextDate;
|
|
670
|
+
function hasAnyItem(collection1, collection2) {
|
|
671
|
+
return collection1.some(item => collection2.includes(item));
|
|
681
672
|
}
|
|
682
673
|
/**
|
|
683
|
-
*
|
|
684
|
-
* @param
|
|
685
|
-
* @
|
|
674
|
+
* Return value from collection by predicate function
|
|
675
|
+
* @param collection Array of items
|
|
676
|
+
* @param predicate Function to define search logic
|
|
677
|
+
* @returns Value from collection
|
|
686
678
|
*/
|
|
687
|
-
function
|
|
688
|
-
|
|
689
|
-
nextDate.setDate(date.getDate() - 1);
|
|
690
|
-
return nextDate;
|
|
679
|
+
function firstOrDefault(collection, predicate) {
|
|
680
|
+
return any(collection) ? collection?.find(predicate) : undefined;
|
|
691
681
|
}
|
|
692
682
|
/**
|
|
693
|
-
*
|
|
694
|
-
* @param
|
|
695
|
-
* @returns
|
|
683
|
+
* Return first item from collection
|
|
684
|
+
* @param collection Array of items
|
|
685
|
+
* @returns First value from collection
|
|
696
686
|
*/
|
|
697
|
-
function
|
|
698
|
-
|
|
699
|
-
nextMonth.setMonth(date.getMonth() + 1);
|
|
700
|
-
return nextMonth;
|
|
687
|
+
function firstItem(collection) {
|
|
688
|
+
return any(collection) ? collection[0] : null;
|
|
701
689
|
}
|
|
702
690
|
/**
|
|
703
|
-
*
|
|
704
|
-
* @param
|
|
705
|
-
* @returns
|
|
691
|
+
* Return last item from collection
|
|
692
|
+
* @param collection Array of items
|
|
693
|
+
* @returns Last value from collection
|
|
706
694
|
*/
|
|
707
|
-
function
|
|
708
|
-
|
|
709
|
-
prevMonth.setMonth(date.getMonth() - 1);
|
|
710
|
-
return prevMonth;
|
|
695
|
+
function lastItem(collection) {
|
|
696
|
+
return any(collection) ? collection[collection.length - 1] : null;
|
|
711
697
|
}
|
|
712
698
|
/**
|
|
713
|
-
*
|
|
714
|
-
* @param
|
|
715
|
-
* @
|
|
699
|
+
* Return True if all values match predicate function
|
|
700
|
+
* @param collection Array of objects
|
|
701
|
+
* @param predicate Function to define check logic
|
|
702
|
+
* @returns True if all values match predicate
|
|
716
703
|
*/
|
|
717
|
-
function
|
|
718
|
-
|
|
719
|
-
nextYear.setFullYear(date.getFullYear() + 1);
|
|
720
|
-
return nextYear;
|
|
704
|
+
function all(collection, predicate) {
|
|
705
|
+
return any(collection) ? collection.filter(predicate).length == collection.length : false;
|
|
721
706
|
}
|
|
722
707
|
/**
|
|
723
|
-
*
|
|
724
|
-
* @param
|
|
725
|
-
* @
|
|
708
|
+
* Return count by predicate
|
|
709
|
+
* @param collection Array of objects
|
|
710
|
+
* @param predicate Function to define check logic
|
|
711
|
+
* @returns Items count
|
|
726
712
|
*/
|
|
727
|
-
function
|
|
728
|
-
|
|
729
|
-
prevYear.setFullYear(date.getFullYear() - 1);
|
|
730
|
-
return prevYear;
|
|
713
|
+
function count(collection, predicate) {
|
|
714
|
+
return collection.filter(predicate).length;
|
|
731
715
|
}
|
|
732
716
|
/**
|
|
733
|
-
* Return
|
|
734
|
-
* @param
|
|
735
|
-
* @
|
|
717
|
+
* Return items from collection by predicate function
|
|
718
|
+
* @param collection Array of items
|
|
719
|
+
* @param predicate Function to define search logic
|
|
720
|
+
* @returns Values from collection
|
|
736
721
|
*/
|
|
737
|
-
function
|
|
738
|
-
|
|
739
|
-
const year = date.getFullYear(), month = date.getMonth();
|
|
740
|
-
return new Date(year, month, 1);
|
|
741
|
-
}
|
|
742
|
-
return date;
|
|
722
|
+
function where(collection, predicate) {
|
|
723
|
+
return any(collection) ? collection.filter(predicate) : null;
|
|
743
724
|
}
|
|
744
725
|
/**
|
|
745
|
-
* Return
|
|
746
|
-
* @param
|
|
747
|
-
* @
|
|
726
|
+
* Return sliced collection by page number and page size
|
|
727
|
+
* @param collection Array of items
|
|
728
|
+
* @param page Page number
|
|
729
|
+
* @param size Page size
|
|
730
|
+
* @returns Sliced collection
|
|
748
731
|
*/
|
|
749
|
-
function
|
|
750
|
-
if (
|
|
751
|
-
|
|
752
|
-
return
|
|
732
|
+
function skip(collection, page, size) {
|
|
733
|
+
if (any(collection)) {
|
|
734
|
+
let start = (page - 1) * size;
|
|
735
|
+
return collection.slice(start, start + size);
|
|
753
736
|
}
|
|
754
|
-
return
|
|
737
|
+
return collection;
|
|
755
738
|
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
function getFirstDayOfYear(date) {
|
|
762
|
-
if (isDefined(date) && date instanceof Date) {
|
|
763
|
-
return new Date(date.getFullYear(), 0, 1);
|
|
739
|
+
function sort(collection, direction = SortingDirection.Ascending) {
|
|
740
|
+
if (any(collection)) {
|
|
741
|
+
return direction == SortingDirection.Ascending
|
|
742
|
+
? collection.sort((a, b) => a - b)
|
|
743
|
+
: collection.sort((a, b) => b - a);
|
|
764
744
|
}
|
|
765
|
-
return
|
|
745
|
+
return collection;
|
|
766
746
|
}
|
|
767
747
|
/**
|
|
768
|
-
* Return
|
|
769
|
-
* @param
|
|
770
|
-
* @
|
|
748
|
+
* Return sorted collection of objects by property
|
|
749
|
+
* @param collection Array of items
|
|
750
|
+
* @param property Property name
|
|
751
|
+
* @param direction Sorting direction
|
|
752
|
+
* @returns Sorted collection
|
|
771
753
|
*/
|
|
772
|
-
function
|
|
773
|
-
if (
|
|
774
|
-
|
|
754
|
+
function sortBy(collection, property, direction) {
|
|
755
|
+
if (any(collection)) {
|
|
756
|
+
let _sortFunc = (a, b) => (t1, t2) => (a[property] > b[property] ? t1 : t2);
|
|
757
|
+
return direction == SortingDirection.Ascending
|
|
758
|
+
? collection.sort((a, b) => _sortFunc(a, b)(1, -1))
|
|
759
|
+
: collection.sort((a, b) => _sortFunc(a, b)(-1, 1));
|
|
775
760
|
}
|
|
776
|
-
return
|
|
761
|
+
return collection;
|
|
777
762
|
}
|
|
778
763
|
/**
|
|
779
|
-
* Return
|
|
780
|
-
* @param
|
|
781
|
-
* @param
|
|
782
|
-
* @
|
|
783
|
-
|
|
784
|
-
function getFirstDayOfMonthByYearAndMonth(year, month) {
|
|
785
|
-
return new Date(year, month, 1);
|
|
786
|
-
}
|
|
787
|
-
/**
|
|
788
|
-
* Return last day of month as date
|
|
789
|
-
* @param year Year value
|
|
790
|
-
* @param month Month value
|
|
791
|
-
* @returns Last day of month
|
|
764
|
+
* Return sorted collection of objects by path
|
|
765
|
+
* @param collection Array of items
|
|
766
|
+
* @param path Path to property
|
|
767
|
+
* @param direction Sorting direction
|
|
768
|
+
* @returns Sorted collection
|
|
792
769
|
*/
|
|
793
|
-
function
|
|
794
|
-
|
|
770
|
+
function sortByPath(collection, path, direction) {
|
|
771
|
+
if (any(collection)) {
|
|
772
|
+
if (isNullOrEmptyString(path))
|
|
773
|
+
throw new Error('Collection utils | Sort By Path function --> Path is empty.');
|
|
774
|
+
const pathParts = path.split('.');
|
|
775
|
+
if (!any(pathParts))
|
|
776
|
+
throw new Error('Collection utils | Sort By Path function --> Path is incorrect.');
|
|
777
|
+
const partsLength = pathParts.length;
|
|
778
|
+
collection.sort((a, b) => {
|
|
779
|
+
var i = 0;
|
|
780
|
+
while (i < partsLength) {
|
|
781
|
+
a = a[pathParts[i]];
|
|
782
|
+
b = b[pathParts[i]];
|
|
783
|
+
i++;
|
|
784
|
+
}
|
|
785
|
+
return direction == SortingDirection.Ascending
|
|
786
|
+
? a >= b ? 1 : -1
|
|
787
|
+
: a > b ? -1 : 1;
|
|
788
|
+
});
|
|
789
|
+
return collection;
|
|
790
|
+
}
|
|
791
|
+
return collection;
|
|
795
792
|
}
|
|
796
793
|
/**
|
|
797
|
-
* Return
|
|
798
|
-
* @param
|
|
799
|
-
* @returns
|
|
794
|
+
* Return collection without matches
|
|
795
|
+
* @param collection Array of items
|
|
796
|
+
* @returns Collection without matches
|
|
800
797
|
*/
|
|
801
|
-
function
|
|
802
|
-
|
|
803
|
-
|
|
798
|
+
function distinct(collection) {
|
|
799
|
+
return any(collection)
|
|
800
|
+
? collection.filter((value, index, self) => self.indexOf(value) === index)
|
|
801
|
+
: collection;
|
|
804
802
|
}
|
|
805
803
|
/**
|
|
806
|
-
* Return
|
|
807
|
-
* @param
|
|
808
|
-
* @param
|
|
809
|
-
* @returns
|
|
804
|
+
* Return sum value from collection items by map function
|
|
805
|
+
* @param collection Array of items
|
|
806
|
+
* @param select Map function
|
|
807
|
+
* @returns Sum value of colection items
|
|
810
808
|
*/
|
|
811
|
-
function
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
809
|
+
function sum(collection, select) {
|
|
810
|
+
return any(collection)
|
|
811
|
+
? collection
|
|
812
|
+
.map(select)
|
|
813
|
+
.reduce((a, b) => { return a + b; }, 0)
|
|
814
|
+
: 0;
|
|
816
815
|
}
|
|
817
816
|
/**
|
|
818
|
-
* Return
|
|
819
|
-
* @param
|
|
820
|
-
* @param
|
|
821
|
-
* @returns
|
|
817
|
+
* Return max value from collection items by map function
|
|
818
|
+
* @param collection Array of items
|
|
819
|
+
* @param select Map function
|
|
820
|
+
* @returns Max value of collection items
|
|
822
821
|
*/
|
|
823
|
-
function
|
|
824
|
-
|
|
825
|
-
|
|
822
|
+
function max(collection, select) {
|
|
823
|
+
if (any(collection))
|
|
824
|
+
return Math.max(...collection.map(select));
|
|
825
|
+
throw new Error('Collection utils | Max function --> Collection is empty.');
|
|
826
826
|
}
|
|
827
827
|
/**
|
|
828
|
-
*
|
|
829
|
-
* @param
|
|
830
|
-
* @param
|
|
831
|
-
* @returns True if first date greater than second date
|
|
828
|
+
* Delete items from collection by predicate
|
|
829
|
+
* @param collection Array of items
|
|
830
|
+
* @param predicate Function to define remove logic
|
|
832
831
|
*/
|
|
833
|
-
function
|
|
834
|
-
|
|
835
|
-
|
|
832
|
+
function remove(collection, predicate) {
|
|
833
|
+
var i = collection.length;
|
|
834
|
+
while (i--) {
|
|
835
|
+
if (predicate(collection[i])) {
|
|
836
|
+
collection.splice(i, 1);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
836
839
|
}
|
|
837
840
|
/**
|
|
838
|
-
*
|
|
839
|
-
* @param
|
|
840
|
-
* @param
|
|
841
|
-
* @
|
|
841
|
+
* Add item to collection
|
|
842
|
+
* @param collection Array of items
|
|
843
|
+
* @param item New item
|
|
844
|
+
* @param predicate Function to define if allowed to add new item
|
|
845
|
+
* @returns True if successfully added
|
|
842
846
|
*/
|
|
843
|
-
function
|
|
844
|
-
|
|
845
|
-
|
|
847
|
+
function addItem(collection, item, predicate = null) {
|
|
848
|
+
if (!isDefined(collection))
|
|
849
|
+
collection = new Array();
|
|
850
|
+
if (isDefined(predicate) && predicate(item))
|
|
851
|
+
return false;
|
|
852
|
+
collection.push(item);
|
|
853
|
+
return true;
|
|
846
854
|
}
|
|
847
855
|
/**
|
|
848
|
-
*
|
|
849
|
-
* @param
|
|
850
|
-
* @param
|
|
851
|
-
* @returns True if
|
|
856
|
+
* Delete item from collection
|
|
857
|
+
* @param collection Array of items
|
|
858
|
+
* @param item Item to delete
|
|
859
|
+
* @returns True if successfully removed
|
|
852
860
|
*/
|
|
853
|
-
function
|
|
854
|
-
|
|
855
|
-
|
|
861
|
+
function removeItem(collection, item) {
|
|
862
|
+
if (isDefined(item) && hasItem(collection, item)) {
|
|
863
|
+
collection.splice(collection.indexOf(item), 1);
|
|
864
|
+
return true;
|
|
865
|
+
}
|
|
866
|
+
return false;
|
|
856
867
|
}
|
|
857
868
|
/**
|
|
858
|
-
*
|
|
859
|
-
* @param
|
|
860
|
-
* @param
|
|
861
|
-
* @returns True if
|
|
869
|
+
* Delete item from collection by predicate
|
|
870
|
+
* @param collection Array of items
|
|
871
|
+
* @param predicate Function to define remove logic
|
|
872
|
+
* @returns True if successfully removed
|
|
862
873
|
*/
|
|
863
|
-
function
|
|
864
|
-
|
|
865
|
-
|
|
874
|
+
function removeItemBy(collection, predicate) {
|
|
875
|
+
const foundItem = firstOrDefault(collection, predicate);
|
|
876
|
+
if (isDefined(foundItem)) {
|
|
877
|
+
collection.splice(collection.indexOf(foundItem), 1);
|
|
878
|
+
return true;
|
|
879
|
+
}
|
|
880
|
+
return false;
|
|
866
881
|
}
|
|
867
882
|
/**
|
|
868
|
-
*
|
|
869
|
-
* @param
|
|
870
|
-
* @param
|
|
871
|
-
* @returns True if
|
|
883
|
+
* Update item in collection by predicate
|
|
884
|
+
* @param collection Array of items
|
|
885
|
+
* @param predicate Function to define item for deleting
|
|
886
|
+
* @returns True if successfully removed
|
|
872
887
|
*/
|
|
873
|
-
function
|
|
874
|
-
|
|
875
|
-
|
|
888
|
+
function updateItemBy(collection, predicate, newItem) {
|
|
889
|
+
const itemIndex = collection.findIndex(predicate);
|
|
890
|
+
if (itemIndex !== CommonConstants.NOT_FOUND_INDEX) {
|
|
891
|
+
const result = collection.slice(0);
|
|
892
|
+
result[itemIndex] = {
|
|
893
|
+
...collection[itemIndex],
|
|
894
|
+
...newItem
|
|
895
|
+
};
|
|
896
|
+
return result;
|
|
897
|
+
}
|
|
898
|
+
return null;
|
|
876
899
|
}
|
|
877
900
|
/**
|
|
878
|
-
* Return
|
|
879
|
-
* @param
|
|
880
|
-
* @
|
|
881
|
-
* @returns True if first time less or equal to second time
|
|
901
|
+
* Return collection or empty if collection is not defined
|
|
902
|
+
* @param collection Array of items
|
|
903
|
+
* @returns Collection or empty
|
|
882
904
|
*/
|
|
883
|
-
function
|
|
884
|
-
return
|
|
885
|
-
<= new Date(0, 0, 0, date2.getHours(), date2.getMinutes());
|
|
905
|
+
function getCollectionOrEmpty(collection) {
|
|
906
|
+
return isDefined(collection) ? collection : [];
|
|
886
907
|
}
|
|
887
908
|
/**
|
|
888
|
-
*
|
|
889
|
-
* @param
|
|
890
|
-
* @param
|
|
891
|
-
* @returns True if
|
|
909
|
+
* Check if arrays are equal
|
|
910
|
+
* @param a First array
|
|
911
|
+
* @param b Second array
|
|
912
|
+
* @returns True if arrays are equal
|
|
892
913
|
*/
|
|
893
|
-
function
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
914
|
+
function isArraysEquals(a, b) {
|
|
915
|
+
if (a.length !== b.length)
|
|
916
|
+
return false;
|
|
917
|
+
a.sort();
|
|
918
|
+
b.sort();
|
|
919
|
+
for (let i = 0; i < a.length; i++) {
|
|
920
|
+
if (a[i] !== b[i])
|
|
921
|
+
return false;
|
|
922
|
+
}
|
|
923
|
+
return true;
|
|
924
|
+
}
|
|
925
|
+
|
|
897
926
|
/**
|
|
898
|
-
*
|
|
927
|
+
* Set minutes for date
|
|
899
928
|
* @param date Date value
|
|
900
|
-
* @
|
|
929
|
+
* @param minute Minute value
|
|
930
|
+
* @returns Date with minute value
|
|
901
931
|
*/
|
|
902
|
-
function
|
|
903
|
-
|
|
932
|
+
function setMinutes(date, minute) {
|
|
933
|
+
const result = new Date(date);
|
|
934
|
+
result.setMinutes(minute);
|
|
935
|
+
return result;
|
|
904
936
|
}
|
|
905
937
|
/**
|
|
906
|
-
*
|
|
907
|
-
* @param
|
|
908
|
-
* @
|
|
938
|
+
* Set hours for date
|
|
939
|
+
* @param date Date value
|
|
940
|
+
* @param hour Hour value
|
|
941
|
+
* @returns Date with hour value
|
|
909
942
|
*/
|
|
910
|
-
function
|
|
911
|
-
const
|
|
912
|
-
result.setHours(
|
|
913
|
-
result.setMinutes(+tempTime[1]);
|
|
914
|
-
result.setSeconds(+tempTime[2]);
|
|
943
|
+
function setHours(date, hour) {
|
|
944
|
+
const result = new Date(date);
|
|
945
|
+
result.setHours(hour);
|
|
915
946
|
return result;
|
|
916
947
|
}
|
|
917
948
|
/**
|
|
918
|
-
*
|
|
949
|
+
* Set day for date value
|
|
919
950
|
* @param date Date value
|
|
920
|
-
* @param
|
|
921
|
-
* @returns
|
|
951
|
+
* @param dayNumber Day number
|
|
952
|
+
* @returns Date with day number
|
|
922
953
|
*/
|
|
923
|
-
function
|
|
924
|
-
|
|
954
|
+
function setDay(date, dayNumber) {
|
|
955
|
+
const nextDate = new Date(date);
|
|
956
|
+
nextDate.setDate(dayNumber);
|
|
957
|
+
return nextDate;
|
|
925
958
|
}
|
|
926
959
|
/**
|
|
927
|
-
*
|
|
928
|
-
* @param
|
|
929
|
-
* @
|
|
960
|
+
* Set year for date
|
|
961
|
+
* @param date Date value
|
|
962
|
+
* @param year Year value
|
|
963
|
+
* @returns Date with year value
|
|
930
964
|
*/
|
|
931
|
-
function
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
const monthDifference = now.getMonth() - birthdate.getMonth();
|
|
937
|
-
if (monthDifference < 0 || (monthDifference === 0 && now.getDate() < birthdate.getDate())) {
|
|
938
|
-
age--;
|
|
939
|
-
}
|
|
940
|
-
return age;
|
|
941
|
-
}
|
|
942
|
-
|
|
965
|
+
function setYear(date, year) {
|
|
966
|
+
const result = new Date(date);
|
|
967
|
+
result.setFullYear(year);
|
|
968
|
+
return result;
|
|
969
|
+
}
|
|
943
970
|
/**
|
|
944
|
-
*
|
|
945
|
-
* @param
|
|
946
|
-
* @
|
|
971
|
+
* Set seconds for date
|
|
972
|
+
* @param date Date value
|
|
973
|
+
* @param value Seconds value
|
|
974
|
+
* @returns Date with minute value
|
|
947
975
|
*/
|
|
948
|
-
function
|
|
949
|
-
|
|
976
|
+
function setSeconds(date, value) {
|
|
977
|
+
const result = new Date(date);
|
|
978
|
+
result.setSeconds(value);
|
|
979
|
+
return result;
|
|
950
980
|
}
|
|
951
981
|
/**
|
|
952
|
-
*
|
|
953
|
-
* @param
|
|
954
|
-
* @
|
|
982
|
+
* Set milliseconds for date
|
|
983
|
+
* @param date Date value
|
|
984
|
+
* @param value Milliseconds value
|
|
985
|
+
* @returns Date with minute value
|
|
955
986
|
*/
|
|
956
|
-
function
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
987
|
+
function setMilliseconds(date, value) {
|
|
988
|
+
const result = new Date(date);
|
|
989
|
+
result.setMilliseconds(value);
|
|
990
|
+
return result;
|
|
960
991
|
}
|
|
961
992
|
/**
|
|
962
|
-
*
|
|
963
|
-
* @param
|
|
964
|
-
* @returns
|
|
993
|
+
* Set 0 for seconds and milliseconds of date
|
|
994
|
+
* @param date Date value
|
|
995
|
+
* @returns Date with minute value
|
|
965
996
|
*/
|
|
966
|
-
function
|
|
967
|
-
|
|
997
|
+
function setDefaultSecondsAndMiliseconds(date) {
|
|
998
|
+
const result = new Date(date);
|
|
999
|
+
result.setSeconds(0);
|
|
1000
|
+
result.setMilliseconds(0);
|
|
1001
|
+
return result;
|
|
968
1002
|
}
|
|
969
1003
|
/**
|
|
970
|
-
*
|
|
971
|
-
* @param
|
|
972
|
-
* @
|
|
973
|
-
* @param value Value for new property
|
|
974
|
-
* @returns Extended object with new property
|
|
1004
|
+
* Get next date
|
|
1005
|
+
* @param date Date value
|
|
1006
|
+
* @returns Next date
|
|
975
1007
|
*/
|
|
976
|
-
function
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
obj = { ...obj, ...newObj };
|
|
981
|
-
}
|
|
982
|
-
return obj;
|
|
1008
|
+
function getNextDate(date) {
|
|
1009
|
+
const nextDate = new Date(date);
|
|
1010
|
+
nextDate.setDate(date.getDate() + 1);
|
|
1011
|
+
return nextDate;
|
|
983
1012
|
}
|
|
984
1013
|
/**
|
|
985
|
-
*
|
|
986
|
-
* @param
|
|
987
|
-
* @
|
|
1014
|
+
* Get previous date
|
|
1015
|
+
* @param date Date value
|
|
1016
|
+
* @returns Previous date
|
|
988
1017
|
*/
|
|
989
|
-
function
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1018
|
+
function getPreviousDate(date) {
|
|
1019
|
+
const nextDate = new Date(date);
|
|
1020
|
+
nextDate.setDate(date.getDate() - 1);
|
|
1021
|
+
return nextDate;
|
|
993
1022
|
}
|
|
994
1023
|
/**
|
|
995
|
-
*
|
|
996
|
-
* @param
|
|
997
|
-
* @
|
|
998
|
-
* @returns Merged object
|
|
1024
|
+
* Get next month as date
|
|
1025
|
+
* @param date Date value
|
|
1026
|
+
* @returns Next month as date
|
|
999
1027
|
*/
|
|
1000
|
-
function
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
if (isObject(target) && isObject(source)) {
|
|
1005
|
-
for (const key in source) {
|
|
1006
|
-
if (isObject(source[key])) {
|
|
1007
|
-
if (!target[key])
|
|
1008
|
-
Object.assign(target, { [key]: {} });
|
|
1009
|
-
mergeDeep(target[key], source[key]);
|
|
1010
|
-
}
|
|
1011
|
-
else {
|
|
1012
|
-
Object.assign(target, { [key]: source[key] });
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
return mergeDeep(target, ...sources);
|
|
1028
|
+
function getNextMonth(date) {
|
|
1029
|
+
const nextMonth = new Date(date);
|
|
1030
|
+
nextMonth.setMonth(date.getMonth() + 1);
|
|
1031
|
+
return nextMonth;
|
|
1017
1032
|
}
|
|
1018
1033
|
/**
|
|
1019
|
-
* Get
|
|
1020
|
-
* @param
|
|
1021
|
-
* @returns
|
|
1034
|
+
* Get previous month as date
|
|
1035
|
+
* @param date Date value
|
|
1036
|
+
* @returns Previous month as date
|
|
1022
1037
|
*/
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
* @returns - An indication if the input is a Number or can be coerced to a Number
|
|
1028
|
-
*/
|
|
1029
|
-
function isNumeric(number) {
|
|
1030
|
-
return !isNaN(parseFloat(number));
|
|
1038
|
+
function getPreviousMonth(date) {
|
|
1039
|
+
const prevMonth = new Date(date);
|
|
1040
|
+
prevMonth.setMonth(date.getMonth() - 1);
|
|
1041
|
+
return prevMonth;
|
|
1031
1042
|
}
|
|
1032
1043
|
/**
|
|
1033
|
-
*
|
|
1034
|
-
* @param
|
|
1035
|
-
* @returns
|
|
1044
|
+
* Get next year as date
|
|
1045
|
+
* @param date Date value
|
|
1046
|
+
* @returns Next year as date
|
|
1036
1047
|
*/
|
|
1037
|
-
function
|
|
1038
|
-
|
|
1048
|
+
function getNextYear(date) {
|
|
1049
|
+
const nextYear = new Date(date);
|
|
1050
|
+
nextYear.setFullYear(date.getFullYear() + 1);
|
|
1051
|
+
return nextYear;
|
|
1039
1052
|
}
|
|
1040
1053
|
/**
|
|
1041
|
-
*
|
|
1042
|
-
* @
|
|
1054
|
+
* Get previous year as date
|
|
1055
|
+
* @param date Date value
|
|
1056
|
+
* @returns Previous year as date
|
|
1043
1057
|
*/
|
|
1044
|
-
function
|
|
1045
|
-
|
|
1058
|
+
function getPreviousYear(date) {
|
|
1059
|
+
const prevYear = new Date(date);
|
|
1060
|
+
prevYear.setFullYear(date.getFullYear() - 1);
|
|
1061
|
+
return prevYear;
|
|
1046
1062
|
}
|
|
1047
1063
|
/**
|
|
1048
|
-
* Return
|
|
1049
|
-
* @
|
|
1064
|
+
* Return first day of month as date from date value
|
|
1065
|
+
* @param date Date value
|
|
1066
|
+
* @returns First day of month as date
|
|
1050
1067
|
*/
|
|
1051
|
-
function
|
|
1052
|
-
|
|
1068
|
+
function getFirstDayOfMonth(date) {
|
|
1069
|
+
if (isDefined(date) && date instanceof Date) {
|
|
1070
|
+
const year = date.getFullYear(), month = date.getMonth();
|
|
1071
|
+
return new Date(year, month, 1);
|
|
1072
|
+
}
|
|
1073
|
+
return date;
|
|
1053
1074
|
}
|
|
1054
1075
|
/**
|
|
1055
|
-
* Return
|
|
1056
|
-
* @
|
|
1076
|
+
* Return last day of month as date from date value
|
|
1077
|
+
* @param date Date value
|
|
1078
|
+
* @returns Last day of month as date
|
|
1057
1079
|
*/
|
|
1058
|
-
function
|
|
1059
|
-
|
|
1080
|
+
function getLastDayOfMonth(date) {
|
|
1081
|
+
if (isDefined(date) && date instanceof Date) {
|
|
1082
|
+
const year = date.getFullYear(), month = date.getMonth();
|
|
1083
|
+
return new Date(year, month + 1, 0);
|
|
1084
|
+
}
|
|
1085
|
+
return date;
|
|
1060
1086
|
}
|
|
1061
1087
|
/**
|
|
1062
|
-
* Return
|
|
1063
|
-
* @param
|
|
1064
|
-
* @
|
|
1065
|
-
* @returns True if equal
|
|
1088
|
+
* Return first day of year as date from date value
|
|
1089
|
+
* @param date Date value
|
|
1090
|
+
* @returns First day of year as date
|
|
1066
1091
|
*/
|
|
1067
|
-
function
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
* @param {Object} obj The object
|
|
1071
|
-
* @return {String} The object type
|
|
1072
|
-
*/
|
|
1073
|
-
function getType(obj) {
|
|
1074
|
-
return Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();
|
|
1075
|
-
}
|
|
1076
|
-
function areArraysEqual() {
|
|
1077
|
-
// Check length
|
|
1078
|
-
if (obj1.length !== obj2.length)
|
|
1079
|
-
return false;
|
|
1080
|
-
// Check each item in the array
|
|
1081
|
-
for (let i = 0; i < obj1.length; i++) {
|
|
1082
|
-
if (!isEqual(obj1[i], obj2[i]))
|
|
1083
|
-
return false;
|
|
1084
|
-
}
|
|
1085
|
-
// If no errors, return true
|
|
1086
|
-
return true;
|
|
1087
|
-
}
|
|
1088
|
-
function areObjectsEqual() {
|
|
1089
|
-
if (Object.keys(obj1).length !== Object.keys(obj2).length)
|
|
1090
|
-
return false;
|
|
1091
|
-
// Check each item in the object
|
|
1092
|
-
for (let key in obj1) {
|
|
1093
|
-
if (Object.prototype.hasOwnProperty.call(obj1, key)) {
|
|
1094
|
-
if (!isEqual(obj1[key], obj2[key])) {
|
|
1095
|
-
return false;
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
// If no errors, return true
|
|
1100
|
-
return true;
|
|
1101
|
-
}
|
|
1102
|
-
function areFilesEqual() {
|
|
1103
|
-
return obj1.lastModified === obj2.lastModified
|
|
1104
|
-
&& obj1.size === obj2.size
|
|
1105
|
-
&& obj1.type === obj2.type;
|
|
1106
|
-
}
|
|
1107
|
-
function areFunctionsEqual() {
|
|
1108
|
-
return obj1.toString() === obj2.toString();
|
|
1109
|
-
}
|
|
1110
|
-
function arePrimativesEqual() {
|
|
1111
|
-
return obj1 === obj2;
|
|
1092
|
+
function getFirstDayOfYear(date) {
|
|
1093
|
+
if (isDefined(date) && date instanceof Date) {
|
|
1094
|
+
return new Date(date.getFullYear(), 0, 1);
|
|
1112
1095
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1096
|
+
return date;
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Return last day of year as date from date value
|
|
1100
|
+
* @param date Date value
|
|
1101
|
+
* @returns Last day of year as date
|
|
1102
|
+
*/
|
|
1103
|
+
function getLastDayOfYear(date) {
|
|
1104
|
+
if (isDefined(date) && date instanceof Date) {
|
|
1105
|
+
return new Date(date.getFullYear(), 12, 0);
|
|
1115
1106
|
}
|
|
1116
|
-
|
|
1117
|
-
let type = getType(obj1);
|
|
1118
|
-
// If the two items are not the same type, return false
|
|
1119
|
-
if (type !== getType(obj2))
|
|
1120
|
-
return false;
|
|
1121
|
-
// Compare based on type
|
|
1122
|
-
if (type === 'array')
|
|
1123
|
-
return areArraysEqual();
|
|
1124
|
-
if (type === 'date')
|
|
1125
|
-
return areDatesEqual();
|
|
1126
|
-
if (type === 'file')
|
|
1127
|
-
return areFilesEqual();
|
|
1128
|
-
if (type === 'object')
|
|
1129
|
-
return areObjectsEqual();
|
|
1130
|
-
if (type === 'function')
|
|
1131
|
-
return areFunctionsEqual();
|
|
1132
|
-
return arePrimativesEqual();
|
|
1107
|
+
return date;
|
|
1133
1108
|
}
|
|
1134
1109
|
/**
|
|
1135
|
-
*
|
|
1136
|
-
* @
|
|
1110
|
+
* Return first day of month as date
|
|
1111
|
+
* @param year Year value
|
|
1112
|
+
* @param month Month value
|
|
1113
|
+
* @returns First day of month
|
|
1137
1114
|
*/
|
|
1138
|
-
function
|
|
1139
|
-
|
|
1140
|
-
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
1141
|
-
};
|
|
1142
|
-
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
|
|
1115
|
+
function getFirstDayOfMonthByYearAndMonth(year, month) {
|
|
1116
|
+
return new Date(year, month, 1);
|
|
1143
1117
|
}
|
|
1144
1118
|
/**
|
|
1145
|
-
*
|
|
1146
|
-
* @param
|
|
1147
|
-
* @
|
|
1119
|
+
* Return last day of month as date
|
|
1120
|
+
* @param year Year value
|
|
1121
|
+
* @param month Month value
|
|
1122
|
+
* @returns Last day of month
|
|
1148
1123
|
*/
|
|
1149
|
-
function
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1124
|
+
function getLastDayOfMonthByYearAndMonth(year, month) {
|
|
1125
|
+
return new Date(year, month + 1, 0);
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Return week number in month from date value
|
|
1129
|
+
* @param date Date value
|
|
1130
|
+
* @returns Week number
|
|
1131
|
+
*/
|
|
1132
|
+
function getWeeksNumberInMonth(date) {
|
|
1133
|
+
const firstOfMonth = getFirstDayOfMonth(date), lastOfMonth = getLastDayOfMonth(date), used = firstOfMonth.getDay() + lastOfMonth.getDate();
|
|
1134
|
+
return Math.ceil(used / DateTimeConstants.DAYS_IN_WEEK);
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Return true if first and second date are equal
|
|
1138
|
+
* @param date1 First date value
|
|
1139
|
+
* @param date2 Second date value
|
|
1140
|
+
* @returns True if first and second date are equal
|
|
1141
|
+
*/
|
|
1142
|
+
function isEqualDates(date1, date2) {
|
|
1143
|
+
const date1Value = new Date(date1), date2Value = new Date(date2);
|
|
1144
|
+
date1Value.setHours(0, 0, 0, 0);
|
|
1145
|
+
date2Value.setHours(0, 0, 0, 0);
|
|
1146
|
+
return date1Value.getTime() === date2Value.getTime();
|
|
1147
|
+
}
|
|
1148
|
+
/**
|
|
1149
|
+
* Return true if first and second datetime are equal
|
|
1150
|
+
* @param date1 First datetime value
|
|
1151
|
+
* @param date2 Second datetime value
|
|
1152
|
+
* @returns True if first and second datetime are equal
|
|
1153
|
+
*/
|
|
1154
|
+
function isEqualDateTimes(date1, date2) {
|
|
1155
|
+
const date1Value = new Date(date1), date2Value = new Date(date2);
|
|
1156
|
+
return date1Value.getTime() === date2Value.getTime();
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Return true if first date greater than second date
|
|
1160
|
+
* @param date1 First date value
|
|
1161
|
+
* @param date2 Second date value
|
|
1162
|
+
* @returns True if first date greater than second date
|
|
1163
|
+
*/
|
|
1164
|
+
function isDateGreat(date1, date2) {
|
|
1165
|
+
return new Date(date1.getFullYear(), date1.getMonth(), date1.getDate())
|
|
1166
|
+
> new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
|
|
1157
1167
|
}
|
|
1158
1168
|
/**
|
|
1159
|
-
*
|
|
1160
|
-
* @param
|
|
1169
|
+
* Return true if first date greater or equal to second date
|
|
1170
|
+
* @param date1 First date value
|
|
1171
|
+
* @param date2 Second date value
|
|
1172
|
+
* @returns True if first date greater or equal to second date
|
|
1161
1173
|
*/
|
|
1162
|
-
function
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1174
|
+
function isDateGreatOrEqual(date1, date2) {
|
|
1175
|
+
return new Date(date1.getFullYear(), date1.getMonth(), date1.getDate())
|
|
1176
|
+
>= new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
|
|
1177
|
+
}
|
|
1167
1178
|
/**
|
|
1168
|
-
* Return true if
|
|
1169
|
-
* @param
|
|
1170
|
-
* @
|
|
1179
|
+
* Return true if first date time greater than second date time
|
|
1180
|
+
* @param date1 First date time value
|
|
1181
|
+
* @param date2 Second date time value
|
|
1182
|
+
* @returns True if first date time greater than second date time
|
|
1171
1183
|
*/
|
|
1172
|
-
function
|
|
1173
|
-
return
|
|
1184
|
+
function isDateTimeGreat(date1, date2) {
|
|
1185
|
+
return new Date(date1.getFullYear(), date1.getMonth(), date1.getDate(), date1.getHours(), date1.getMinutes())
|
|
1186
|
+
> new Date(date2.getFullYear(), date2.getMonth(), date2.getDate(), date2.getHours(), date2.getMinutes());
|
|
1174
1187
|
}
|
|
1175
1188
|
/**
|
|
1176
|
-
* Return true if
|
|
1177
|
-
* @param
|
|
1178
|
-
* @param
|
|
1179
|
-
* @returns True if
|
|
1189
|
+
* Return true if first date time greater or equal to second date time
|
|
1190
|
+
* @param date1 First date time value
|
|
1191
|
+
* @param date2 Second date time value
|
|
1192
|
+
* @returns True if first date time greater or equal to second date time
|
|
1180
1193
|
*/
|
|
1181
|
-
function
|
|
1182
|
-
return
|
|
1183
|
-
|
|
1184
|
-
.includes(includeValue.toLowerCase())
|
|
1185
|
-
: false;
|
|
1194
|
+
function isDateTimeGreatOrEqual(date1, date2) {
|
|
1195
|
+
return new Date(date1.getFullYear(), date1.getMonth(), date1.getDate(), date1.getHours(), date1.getMinutes())
|
|
1196
|
+
>= new Date(date2.getFullYear(), date2.getMonth(), date2.getDate(), date2.getHours(), date2.getMinutes());
|
|
1186
1197
|
}
|
|
1187
1198
|
/**
|
|
1188
|
-
* Return
|
|
1189
|
-
* @param
|
|
1190
|
-
* @
|
|
1199
|
+
* Return true if first time greater or equal to second time
|
|
1200
|
+
* @param date1 First date time value
|
|
1201
|
+
* @param date2 Second date time value
|
|
1202
|
+
* @returns True if first time greater or equal to second time
|
|
1191
1203
|
*/
|
|
1192
|
-
function
|
|
1193
|
-
return
|
|
1194
|
-
|
|
1195
|
-
|
|
1204
|
+
function isTimeGreatOrEqual(date1, date2) {
|
|
1205
|
+
return new Date(0, 0, 0, date1.getHours(), date1.getMinutes())
|
|
1206
|
+
>= new Date(0, 0, 0, date2.getHours(), date2.getMinutes());
|
|
1207
|
+
}
|
|
1196
1208
|
/**
|
|
1197
|
-
* Return
|
|
1198
|
-
* @param
|
|
1199
|
-
* @param
|
|
1200
|
-
* @returns
|
|
1209
|
+
* Return true if first time less or equal to second time
|
|
1210
|
+
* @param date1 First date time value
|
|
1211
|
+
* @param date2 Second date time value
|
|
1212
|
+
* @returns True if first time less or equal to second time
|
|
1201
1213
|
*/
|
|
1202
|
-
function
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
const k = 1024;
|
|
1206
|
-
const dm = decimals < 0 ? 0 : decimals;
|
|
1207
|
-
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
1208
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1209
|
-
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
|
1214
|
+
function isDateTimeLessOrEqual(date1, date2) {
|
|
1215
|
+
return new Date(0, 0, 0, date1.getHours(), date1.getMinutes())
|
|
1216
|
+
<= new Date(0, 0, 0, date2.getHours(), date2.getMinutes());
|
|
1210
1217
|
}
|
|
1211
1218
|
/**
|
|
1212
|
-
* Return
|
|
1213
|
-
* @param
|
|
1214
|
-
* @
|
|
1219
|
+
* Return true if first time less or equal to second time
|
|
1220
|
+
* @param date1 First date time value
|
|
1221
|
+
* @param date2 Second date time value
|
|
1222
|
+
* @returns True if first time less or equal to second time
|
|
1215
1223
|
*/
|
|
1216
|
-
function
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
if (file.name.indexOf('.') === CommonConstants.NOT_FOUND_INDEX) {
|
|
1220
|
-
return CommonConstants.EMPTY_STRING;
|
|
1221
|
-
}
|
|
1222
|
-
return file.name.split('.').pop();
|
|
1224
|
+
function isTimeLessOrEqual(date1, date2) {
|
|
1225
|
+
return new Date(date1.getFullYear(), date1.getMonth(), date1.getDate(), date1.getHours(), date1.getMinutes())
|
|
1226
|
+
<= new Date(date2.getFullYear(), date2.getMonth(), date2.getDate(), date2.getHours(), date2.getMinutes());
|
|
1223
1227
|
}
|
|
1224
1228
|
/**
|
|
1225
|
-
*
|
|
1226
|
-
* @param
|
|
1227
|
-
* @
|
|
1229
|
+
* Convert UTC date to local
|
|
1230
|
+
* @param date Date value
|
|
1231
|
+
* @returns Locale date
|
|
1228
1232
|
*/
|
|
1229
|
-
function
|
|
1230
|
-
|
|
1231
|
-
const reader = new FileReader();
|
|
1232
|
-
reader.onload = () => onLoad(reader.result);
|
|
1233
|
-
reader.readAsDataURL(file);
|
|
1234
|
-
}
|
|
1235
|
-
else
|
|
1236
|
-
throw new Error('File utils | Read as data URL function --> File is empty.');
|
|
1233
|
+
function convertUTCDateToLocalDate(date) {
|
|
1234
|
+
return new Date(date.getTime() - date.getTimezoneOffset() * 60 * 1000);
|
|
1237
1235
|
}
|
|
1238
1236
|
/**
|
|
1239
|
-
*
|
|
1240
|
-
* @param
|
|
1241
|
-
* @returns
|
|
1237
|
+
* Convert Json representation of timestamp to date value
|
|
1238
|
+
* @param timestamp Timestamp for example - 12:23:45
|
|
1239
|
+
* @returns Date value
|
|
1242
1240
|
*/
|
|
1243
|
-
function
|
|
1244
|
-
|
|
1241
|
+
function convertTimestampToDate(timestamp) {
|
|
1242
|
+
const tempTime = timestamp.split(":"), result = new Date();
|
|
1243
|
+
result.setHours(+tempTime[0]);
|
|
1244
|
+
result.setMinutes(+tempTime[1]);
|
|
1245
|
+
result.setSeconds(+tempTime[2]);
|
|
1246
|
+
return result;
|
|
1245
1247
|
}
|
|
1246
1248
|
/**
|
|
1247
|
-
* Convert
|
|
1248
|
-
* @param
|
|
1249
|
-
* @
|
|
1249
|
+
* Convert Date object to timestamp string
|
|
1250
|
+
* @param date Date value
|
|
1251
|
+
* @param locale Locale value
|
|
1252
|
+
* @returns String representation of date value, for example - 12:23
|
|
1250
1253
|
*/
|
|
1251
|
-
function
|
|
1252
|
-
return
|
|
1253
|
-
const reader = new FileReader();
|
|
1254
|
-
reader.readAsDataURL(file);
|
|
1255
|
-
reader.onload = () => resolve(reader.result);
|
|
1256
|
-
reader.onerror = reject;
|
|
1257
|
-
});
|
|
1254
|
+
function convertDateToTimestamp(date, locale = DateTimeConstants.DEFAULT_LOCALE) {
|
|
1255
|
+
return `${formatDate(date, 'HH', locale)}:${formatDate(date, 'mm', locale)}`;
|
|
1258
1256
|
}
|
|
1259
1257
|
/**
|
|
1260
|
-
*
|
|
1261
|
-
* @param
|
|
1262
|
-
* @
|
|
1263
|
-
* @returns File value
|
|
1258
|
+
* Get age from
|
|
1259
|
+
* @param birthdate Date of birth
|
|
1260
|
+
* @returns Age
|
|
1264
1261
|
*/
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1262
|
+
function getAge(birthdate) {
|
|
1263
|
+
if (!birthdate)
|
|
1264
|
+
return null;
|
|
1265
|
+
const now = new Date();
|
|
1266
|
+
let age = now.getFullYear() - birthdate.getFullYear();
|
|
1267
|
+
const monthDifference = now.getMonth() - birthdate.getMonth();
|
|
1268
|
+
if (monthDifference < 0 || (monthDifference === 0 && now.getDate() < birthdate.getDate())) {
|
|
1269
|
+
age--;
|
|
1270
|
+
}
|
|
1271
|
+
return age;
|
|
1268
1272
|
}
|
|
1269
1273
|
|
|
1270
1274
|
/**
|
|
1271
|
-
* Return
|
|
1272
|
-
* @param value Value
|
|
1273
|
-
* @returns
|
|
1274
|
-
*/
|
|
1275
|
-
function getCssLikeValue(value, type = UIConstants.CSS_PIXELS) {
|
|
1276
|
-
return value + type;
|
|
1277
|
-
}
|
|
1278
|
-
/**
|
|
1279
|
-
* Parse CSS like value to number
|
|
1280
|
-
* @param value CSS like value
|
|
1281
|
-
* @returns Number value
|
|
1275
|
+
* Return true if value defined
|
|
1276
|
+
* @param value Value to check
|
|
1277
|
+
* @returns True if value is not null and defined
|
|
1282
1278
|
*/
|
|
1283
|
-
function
|
|
1284
|
-
return
|
|
1279
|
+
function isDefined(value) {
|
|
1280
|
+
return value !== undefined && value !== null;
|
|
1285
1281
|
}
|
|
1286
1282
|
/**
|
|
1287
|
-
* Return
|
|
1288
|
-
* @param value
|
|
1289
|
-
* @
|
|
1290
|
-
* @returns Calc value
|
|
1283
|
+
* Return true if value is object
|
|
1284
|
+
* @param value Value to check
|
|
1285
|
+
* @returns True if value is object
|
|
1291
1286
|
*/
|
|
1292
|
-
function
|
|
1293
|
-
return
|
|
1287
|
+
function isObject(value) {
|
|
1288
|
+
return (isDefined(value) && typeof value === 'object'
|
|
1289
|
+
&& !Array.isArray(value)
|
|
1290
|
+
&& !(value instanceof Date || value instanceof File));
|
|
1294
1291
|
}
|
|
1295
1292
|
/**
|
|
1296
|
-
* Return
|
|
1297
|
-
* @param
|
|
1298
|
-
* @returns
|
|
1293
|
+
* Return true if data is observable
|
|
1294
|
+
* @param data Object to check
|
|
1295
|
+
* @returns True if data is observable
|
|
1299
1296
|
*/
|
|
1300
|
-
function
|
|
1301
|
-
return
|
|
1297
|
+
function isAsyncData(data) {
|
|
1298
|
+
return data instanceof Observable;
|
|
1302
1299
|
}
|
|
1303
1300
|
/**
|
|
1304
|
-
*
|
|
1305
|
-
* @param
|
|
1306
|
-
* @param
|
|
1301
|
+
* Return extended object with new property
|
|
1302
|
+
* @param obj Object to extend by property
|
|
1303
|
+
* @param property New property name
|
|
1304
|
+
* @param value Value for new property
|
|
1305
|
+
* @returns Extended object with new property
|
|
1307
1306
|
*/
|
|
1308
|
-
function
|
|
1309
|
-
if (isDefined(
|
|
1310
|
-
|
|
1307
|
+
function addPropertyToObject(obj, property, value = null) {
|
|
1308
|
+
if (isDefined(property) && !obj.hasOwnProperty(property)) {
|
|
1309
|
+
let newObj = {};
|
|
1310
|
+
newObj[property] = value;
|
|
1311
|
+
obj = { ...obj, ...newObj };
|
|
1311
1312
|
}
|
|
1313
|
+
return obj;
|
|
1312
1314
|
}
|
|
1313
1315
|
/**
|
|
1314
|
-
* Remove
|
|
1315
|
-
* @param
|
|
1316
|
-
* @param
|
|
1316
|
+
* Remove property from object
|
|
1317
|
+
* @param obj Object for removing property
|
|
1318
|
+
* @param property Property name to remove
|
|
1317
1319
|
*/
|
|
1318
|
-
function
|
|
1319
|
-
if (
|
|
1320
|
-
|
|
1320
|
+
function removePropertyFromObject(obj, property) {
|
|
1321
|
+
if (obj.hasOwnProperty(property)) {
|
|
1322
|
+
delete obj[property];
|
|
1321
1323
|
}
|
|
1322
1324
|
}
|
|
1323
1325
|
/**
|
|
1324
|
-
*
|
|
1325
|
-
* @param
|
|
1326
|
-
* @param
|
|
1327
|
-
* @
|
|
1328
|
-
* @returns HEX value
|
|
1329
|
-
*/
|
|
1330
|
-
function rgbToHex(r, g, b) {
|
|
1331
|
-
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
1332
|
-
}
|
|
1333
|
-
/**
|
|
1334
|
-
* Convert HEX to RGB value
|
|
1335
|
-
* @param hex HEX value
|
|
1336
|
-
* @returns RGB value
|
|
1326
|
+
* Deep merge object with others
|
|
1327
|
+
* @param target Object to merge
|
|
1328
|
+
* @param sources Objects to be merged with target
|
|
1329
|
+
* @returns Merged object
|
|
1337
1330
|
*/
|
|
1338
|
-
function
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1331
|
+
function mergeDeep(target, ...sources) {
|
|
1332
|
+
if (!sources.length)
|
|
1333
|
+
return target;
|
|
1334
|
+
const source = sources.shift();
|
|
1335
|
+
if (isObject(target) && isObject(source)) {
|
|
1336
|
+
for (const key in source) {
|
|
1337
|
+
if (isObject(source[key])) {
|
|
1338
|
+
if (!target[key])
|
|
1339
|
+
Object.assign(target, { [key]: {} });
|
|
1340
|
+
mergeDeep(target[key], source[key]);
|
|
1341
|
+
}
|
|
1342
|
+
else {
|
|
1343
|
+
Object.assign(target, { [key]: source[key] });
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1345
1346
|
}
|
|
1346
|
-
return
|
|
1347
|
+
return mergeDeep(target, ...sources);
|
|
1347
1348
|
}
|
|
1348
1349
|
/**
|
|
1349
|
-
*
|
|
1350
|
-
* @param
|
|
1351
|
-
* @
|
|
1352
|
-
* @returns RGB value with relevant opacity
|
|
1350
|
+
* Get type's property name safety
|
|
1351
|
+
* @param name KeyOf property
|
|
1352
|
+
* @returns Type's property name
|
|
1353
1353
|
*/
|
|
1354
|
-
|
|
1355
|
-
return rgb.replace(UIConstants.RGB_OPACITY_PLACEHOLDER, opacity.toString());
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1354
|
+
const nameof = (name) => name;
|
|
1358
1355
|
/**
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
function
|
|
1364
|
-
return
|
|
1356
|
+
* Determines if the input is a Number or something that can be coerced to a Number
|
|
1357
|
+
* @param number The input to be tested
|
|
1358
|
+
* @returns - An indication if the input is a Number or can be coerced to a Number
|
|
1359
|
+
*/
|
|
1360
|
+
function isNumeric(number) {
|
|
1361
|
+
return !isNaN(parseFloat(number));
|
|
1365
1362
|
}
|
|
1366
1363
|
/**
|
|
1367
|
-
*
|
|
1368
|
-
* @param
|
|
1369
|
-
* @
|
|
1370
|
-
* @returns True if found value in collection
|
|
1364
|
+
* Determines if the input is a string
|
|
1365
|
+
* @param value The input to be tested
|
|
1366
|
+
* @returns An indication if the input is a string
|
|
1371
1367
|
*/
|
|
1372
|
-
function
|
|
1373
|
-
return
|
|
1374
|
-
&& collection.findIndex(item => item === value) !== CommonConstants.NOT_FOUND_INDEX;
|
|
1368
|
+
function isString(value) {
|
|
1369
|
+
return typeof value === 'string';
|
|
1375
1370
|
}
|
|
1376
1371
|
/**
|
|
1377
|
-
* Return true if
|
|
1378
|
-
* @
|
|
1379
|
-
* @param predicate Function to define check logic
|
|
1380
|
-
* @returns True if found value in collection
|
|
1372
|
+
* Return true if current browser is Chrome
|
|
1373
|
+
* @returns If current browser is Chrome
|
|
1381
1374
|
*/
|
|
1382
|
-
function
|
|
1383
|
-
return
|
|
1375
|
+
function isChromeBrowser() {
|
|
1376
|
+
return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
|
|
1384
1377
|
}
|
|
1385
1378
|
/**
|
|
1386
|
-
* Return true if
|
|
1387
|
-
* @
|
|
1388
|
-
* @param property Property name
|
|
1389
|
-
* @param value Value to check
|
|
1390
|
-
* @returns True if found value in collection
|
|
1379
|
+
* Return true if value is valid email address
|
|
1380
|
+
* @returns True if it's valid email address
|
|
1391
1381
|
*/
|
|
1392
|
-
function
|
|
1393
|
-
|
|
1394
|
-
return any(collection)
|
|
1395
|
-
&& collection.findIndex(item => item.hasOwnProperty(property)
|
|
1396
|
-
&& item[property] === value) !== CommonConstants.NOT_FOUND_INDEX;
|
|
1382
|
+
function isEmail(value) {
|
|
1383
|
+
return isDefined(value.match(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/));
|
|
1397
1384
|
}
|
|
1398
1385
|
/**
|
|
1399
|
-
* Return true if
|
|
1400
|
-
* @
|
|
1401
|
-
* @param collection2 Array of objects where try to find
|
|
1402
|
-
* @returns
|
|
1386
|
+
* Return true if string is "true"
|
|
1387
|
+
* @returns parsed string as boolean
|
|
1403
1388
|
*/
|
|
1404
|
-
function
|
|
1405
|
-
return
|
|
1389
|
+
function parseBoolean(value) {
|
|
1390
|
+
return /^true$/i.test(value);
|
|
1406
1391
|
}
|
|
1407
1392
|
/**
|
|
1408
|
-
* Return
|
|
1409
|
-
* @param
|
|
1410
|
-
* @param
|
|
1411
|
-
* @returns
|
|
1393
|
+
* Return true if values equal
|
|
1394
|
+
* @param obj1 First value to compare
|
|
1395
|
+
* @param obj2 Second value to compare
|
|
1396
|
+
* @returns True if equal
|
|
1412
1397
|
*/
|
|
1413
|
-
function
|
|
1414
|
-
|
|
1398
|
+
function isEqual(obj1, obj2) {
|
|
1399
|
+
/**
|
|
1400
|
+
* More accurately check the type of a JavaScript object
|
|
1401
|
+
* @param {Object} obj The object
|
|
1402
|
+
* @return {String} The object type
|
|
1403
|
+
*/
|
|
1404
|
+
function getType(obj) {
|
|
1405
|
+
return Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();
|
|
1406
|
+
}
|
|
1407
|
+
function areArraysEqual() {
|
|
1408
|
+
// Check length
|
|
1409
|
+
if (obj1.length !== obj2.length)
|
|
1410
|
+
return false;
|
|
1411
|
+
// Check each item in the array
|
|
1412
|
+
for (let i = 0; i < obj1.length; i++) {
|
|
1413
|
+
if (!isEqual(obj1[i], obj2[i]))
|
|
1414
|
+
return false;
|
|
1415
|
+
}
|
|
1416
|
+
// If no errors, return true
|
|
1417
|
+
return true;
|
|
1418
|
+
}
|
|
1419
|
+
function areObjectsEqual() {
|
|
1420
|
+
if (Object.keys(obj1).length !== Object.keys(obj2).length)
|
|
1421
|
+
return false;
|
|
1422
|
+
// Check each item in the object
|
|
1423
|
+
for (let key in obj1) {
|
|
1424
|
+
if (Object.prototype.hasOwnProperty.call(obj1, key)) {
|
|
1425
|
+
if (!isEqual(obj1[key], obj2[key])) {
|
|
1426
|
+
return false;
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
// If no errors, return true
|
|
1431
|
+
return true;
|
|
1432
|
+
}
|
|
1433
|
+
function areFilesEqual() {
|
|
1434
|
+
return obj1.lastModified === obj2.lastModified
|
|
1435
|
+
&& obj1.size === obj2.size
|
|
1436
|
+
&& obj1.type === obj2.type;
|
|
1437
|
+
}
|
|
1438
|
+
function areFunctionsEqual() {
|
|
1439
|
+
return obj1.toString() === obj2.toString();
|
|
1440
|
+
}
|
|
1441
|
+
function arePrimativesEqual() {
|
|
1442
|
+
return obj1 === obj2;
|
|
1443
|
+
}
|
|
1444
|
+
function areDatesEqual() {
|
|
1445
|
+
return isEqualDateTimes(obj1, obj2);
|
|
1446
|
+
}
|
|
1447
|
+
// Get the object type
|
|
1448
|
+
let type = getType(obj1);
|
|
1449
|
+
// If the two items are not the same type, return false
|
|
1450
|
+
if (type !== getType(obj2))
|
|
1451
|
+
return false;
|
|
1452
|
+
// Compare based on type
|
|
1453
|
+
if (type === 'array')
|
|
1454
|
+
return areArraysEqual();
|
|
1455
|
+
if (type === 'date')
|
|
1456
|
+
return areDatesEqual();
|
|
1457
|
+
if (type === 'file')
|
|
1458
|
+
return areFilesEqual();
|
|
1459
|
+
if (type === 'object')
|
|
1460
|
+
return areObjectsEqual();
|
|
1461
|
+
if (type === 'function')
|
|
1462
|
+
return areFunctionsEqual();
|
|
1463
|
+
return arePrimativesEqual();
|
|
1415
1464
|
}
|
|
1416
1465
|
/**
|
|
1417
|
-
*
|
|
1418
|
-
* @
|
|
1419
|
-
* @returns First value from collection
|
|
1466
|
+
* Generate unique identificator
|
|
1467
|
+
* @returns Random GUID
|
|
1420
1468
|
*/
|
|
1421
|
-
function
|
|
1422
|
-
|
|
1469
|
+
function generateGuid() {
|
|
1470
|
+
let S4 = function () {
|
|
1471
|
+
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
1472
|
+
};
|
|
1473
|
+
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
|
|
1423
1474
|
}
|
|
1424
1475
|
/**
|
|
1425
|
-
*
|
|
1426
|
-
* @param
|
|
1427
|
-
* @returns
|
|
1476
|
+
* Check if value is Json parsable string
|
|
1477
|
+
* @param value string value
|
|
1478
|
+
* @returns True if string can be JSON parsed
|
|
1428
1479
|
*/
|
|
1429
|
-
function
|
|
1430
|
-
|
|
1480
|
+
function isJsonString(value) {
|
|
1481
|
+
try {
|
|
1482
|
+
const json = JSON.parse(value);
|
|
1483
|
+
return (typeof json === 'object');
|
|
1484
|
+
}
|
|
1485
|
+
catch (e) {
|
|
1486
|
+
return false;
|
|
1487
|
+
}
|
|
1431
1488
|
}
|
|
1432
1489
|
/**
|
|
1433
|
-
*
|
|
1434
|
-
* @param
|
|
1435
|
-
* @param predicate Function to define check logic
|
|
1436
|
-
* @returns True if all values match predicate
|
|
1490
|
+
* Stop propagation and prevent default
|
|
1491
|
+
* @param event Event object
|
|
1437
1492
|
*/
|
|
1438
|
-
function
|
|
1439
|
-
|
|
1493
|
+
function stopAndPreventPropagation(event) {
|
|
1494
|
+
event.preventDefault();
|
|
1495
|
+
event.stopPropagation();
|
|
1440
1496
|
}
|
|
1441
1497
|
/**
|
|
1442
|
-
*
|
|
1443
|
-
* @param
|
|
1444
|
-
* @param
|
|
1445
|
-
* @
|
|
1498
|
+
* Update property in object by key
|
|
1499
|
+
* @param obj Object to change
|
|
1500
|
+
* @param propertyKey Property to change
|
|
1501
|
+
* @param newPropertyValue New property value
|
|
1502
|
+
* @param oldPropertyValue Old property value
|
|
1503
|
+
* @returns Updated object
|
|
1446
1504
|
*/
|
|
1447
|
-
function
|
|
1448
|
-
|
|
1505
|
+
function updatePropertyByKey(obj, propertyKey, newPropertyValue, oldPropertyValue) {
|
|
1506
|
+
if (Array.isArray(obj)) {
|
|
1507
|
+
return obj.map(item => {
|
|
1508
|
+
return isObject(item) && item !== null
|
|
1509
|
+
? updatePropertyByKey(item, propertyKey, newPropertyValue, oldPropertyValue)
|
|
1510
|
+
: item;
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
else if (isObject(obj) && obj !== null) {
|
|
1514
|
+
const updatedObj = {};
|
|
1515
|
+
for (const key in obj) {
|
|
1516
|
+
if (key === propertyKey) {
|
|
1517
|
+
if (Array.isArray(obj[key])) {
|
|
1518
|
+
if (hasItem(obj[key], oldPropertyValue)) {
|
|
1519
|
+
removeItem(obj[key], oldPropertyValue);
|
|
1520
|
+
}
|
|
1521
|
+
else {
|
|
1522
|
+
addItem(obj[key], oldPropertyValue);
|
|
1523
|
+
}
|
|
1524
|
+
updatedObj[key] = obj[key];
|
|
1525
|
+
}
|
|
1526
|
+
else {
|
|
1527
|
+
updatedObj[key] = newPropertyValue;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
else {
|
|
1531
|
+
updatedObj[key] = updatePropertyByKey(obj[key], propertyKey, newPropertyValue, oldPropertyValue);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
return updatedObj;
|
|
1535
|
+
}
|
|
1536
|
+
return obj;
|
|
1449
1537
|
}
|
|
1450
1538
|
/**
|
|
1451
|
-
*
|
|
1452
|
-
* @param
|
|
1453
|
-
* @param
|
|
1454
|
-
* @
|
|
1539
|
+
* Get changed property path
|
|
1540
|
+
* @param previous Previous value
|
|
1541
|
+
* @param current Currency value
|
|
1542
|
+
* @param parentKey Parent object key name
|
|
1543
|
+
* @returns Path of property that was changed
|
|
1455
1544
|
*/
|
|
1456
|
-
function
|
|
1457
|
-
|
|
1545
|
+
function findChangedPropertyPath(previous, current, parentKey = '') {
|
|
1546
|
+
for (const key of Object.keys(current)) {
|
|
1547
|
+
const fullKey = parentKey ? `${parentKey}.${key}` : key;
|
|
1548
|
+
if (isObject(current[key]) && current[key] !== null && previous[key]) {
|
|
1549
|
+
const nestedChange = findChangedPropertyPath(previous[key], current[key], fullKey);
|
|
1550
|
+
if (nestedChange) {
|
|
1551
|
+
return nestedChange;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
else {
|
|
1555
|
+
if (previous[key] !== current[key]) {
|
|
1556
|
+
return fullKey;
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
return null;
|
|
1458
1561
|
}
|
|
1459
1562
|
/**
|
|
1460
|
-
*
|
|
1461
|
-
* @param
|
|
1462
|
-
* @param
|
|
1463
|
-
* @
|
|
1464
|
-
* @returns Sliced collection
|
|
1563
|
+
* Get changed property key
|
|
1564
|
+
* @param previous Previous value
|
|
1565
|
+
* @param current Currency value
|
|
1566
|
+
* @returns Key of property that was changed
|
|
1465
1567
|
*/
|
|
1466
|
-
function
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
return collection.slice(start, start + size);
|
|
1470
|
-
}
|
|
1471
|
-
return collection;
|
|
1568
|
+
function findChangedPropertyKey(previous, current) {
|
|
1569
|
+
const path = findChangedPropertyPath(previous, current), parts = path?.split('.');
|
|
1570
|
+
return parts && parts.length ? parts[parts.length - 1] : undefined;
|
|
1472
1571
|
}
|
|
1473
|
-
function
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1572
|
+
function deepClone(value) {
|
|
1573
|
+
return JSON.parse(JSON.stringify(value));
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
/**
|
|
1577
|
+
* Return parsed file size as string
|
|
1578
|
+
* @param bytes Bytes count
|
|
1579
|
+
* @param decimals Value after dot
|
|
1580
|
+
* @returns Parsed file size
|
|
1581
|
+
*/
|
|
1582
|
+
function parseFileSize(bytes, decimals = 2) {
|
|
1583
|
+
if (bytes === 0)
|
|
1584
|
+
return '0';
|
|
1585
|
+
const k = 1024;
|
|
1586
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
1587
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
1588
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1589
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
|
1480
1590
|
}
|
|
1481
1591
|
/**
|
|
1482
|
-
* Return
|
|
1483
|
-
* @param
|
|
1484
|
-
* @
|
|
1485
|
-
* @param direction Sorting direction
|
|
1486
|
-
* @returns Sorted collection
|
|
1592
|
+
* Return file extension
|
|
1593
|
+
* @param file File value
|
|
1594
|
+
* @returns File extension
|
|
1487
1595
|
*/
|
|
1488
|
-
function
|
|
1489
|
-
if (
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
: collection.sort((a, b) => _sortFunc(a, b)(-1, 1));
|
|
1596
|
+
function getFileExtension(file) {
|
|
1597
|
+
if (!isDefined(file))
|
|
1598
|
+
return CommonConstants.EMPTY_STRING;
|
|
1599
|
+
if (file.name.indexOf('.') === CommonConstants.NOT_FOUND_INDEX) {
|
|
1600
|
+
return CommonConstants.EMPTY_STRING;
|
|
1494
1601
|
}
|
|
1495
|
-
return
|
|
1602
|
+
return file.name.split('.').pop();
|
|
1496
1603
|
}
|
|
1497
1604
|
/**
|
|
1498
|
-
*
|
|
1499
|
-
* @param
|
|
1500
|
-
* @param
|
|
1501
|
-
* @param direction Sorting direction
|
|
1502
|
-
* @returns Sorted collection
|
|
1605
|
+
* Read file as data URL
|
|
1606
|
+
* @param file File value
|
|
1607
|
+
* @param onLoad On load action
|
|
1503
1608
|
*/
|
|
1504
|
-
function
|
|
1505
|
-
if (
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
if (!any(pathParts))
|
|
1510
|
-
throw new Error('Collection utils | Sort By Path function --> Path is incorrect.');
|
|
1511
|
-
const partsLength = pathParts.length;
|
|
1512
|
-
collection.sort((a, b) => {
|
|
1513
|
-
var i = 0;
|
|
1514
|
-
while (i < partsLength) {
|
|
1515
|
-
a = a[pathParts[i]];
|
|
1516
|
-
b = b[pathParts[i]];
|
|
1517
|
-
i++;
|
|
1518
|
-
}
|
|
1519
|
-
return direction == SortingDirection.Ascending
|
|
1520
|
-
? a >= b ? 1 : -1
|
|
1521
|
-
: a > b ? -1 : 1;
|
|
1522
|
-
});
|
|
1523
|
-
return collection;
|
|
1609
|
+
function readAsDataURL(file, onLoad) {
|
|
1610
|
+
if (isDefined(file)) {
|
|
1611
|
+
const reader = new FileReader();
|
|
1612
|
+
reader.onload = () => onLoad(reader.result);
|
|
1613
|
+
reader.readAsDataURL(file);
|
|
1524
1614
|
}
|
|
1525
|
-
|
|
1615
|
+
else
|
|
1616
|
+
throw new Error('File utils | Read as data URL function --> File is empty.');
|
|
1526
1617
|
}
|
|
1527
1618
|
/**
|
|
1528
|
-
* Return
|
|
1529
|
-
* @param
|
|
1530
|
-
* @returns
|
|
1619
|
+
* Return true if file is image
|
|
1620
|
+
* @param file File value
|
|
1621
|
+
* @returns True if file is image
|
|
1531
1622
|
*/
|
|
1532
|
-
function
|
|
1533
|
-
return
|
|
1534
|
-
? collection.filter((value, index, self) => self.indexOf(value) === index)
|
|
1535
|
-
: collection;
|
|
1623
|
+
function isImage(file) {
|
|
1624
|
+
return isDefined(file) && (/\.(gif|jpe?g|jpg|tiff|png|webp|bmp)$/i).test(file.name);
|
|
1536
1625
|
}
|
|
1537
1626
|
/**
|
|
1538
|
-
*
|
|
1539
|
-
* @param
|
|
1540
|
-
* @
|
|
1541
|
-
* @returns Sum value of colection items
|
|
1627
|
+
* Convert file to base64 string
|
|
1628
|
+
* @param file File value
|
|
1629
|
+
* @returns Base64 string
|
|
1542
1630
|
*/
|
|
1543
|
-
function
|
|
1544
|
-
return
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1631
|
+
function convertToBase64String(file) {
|
|
1632
|
+
return new Promise((resolve, reject) => {
|
|
1633
|
+
const reader = new FileReader();
|
|
1634
|
+
reader.readAsDataURL(file);
|
|
1635
|
+
reader.onload = () => resolve(reader.result);
|
|
1636
|
+
reader.onerror = reject;
|
|
1637
|
+
});
|
|
1549
1638
|
}
|
|
1550
1639
|
/**
|
|
1551
|
-
*
|
|
1552
|
-
* @param
|
|
1553
|
-
* @param
|
|
1554
|
-
* @returns
|
|
1640
|
+
* Convert base64 string to file
|
|
1641
|
+
* @param base64 Base64 string
|
|
1642
|
+
* @param name File name
|
|
1643
|
+
* @returns File value
|
|
1555
1644
|
*/
|
|
1556
|
-
function
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1645
|
+
async function convertFromBase64String(base64, name) {
|
|
1646
|
+
const res = await fetch(base64), blob = await res.blob(), extension = base64.substring("data:image/".length, base64.indexOf(";base64"));
|
|
1647
|
+
return new File([blob], `${name}.${extension}`, { type: `image/${extension}` });
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
/**
|
|
1651
|
+
* Return CSS like value
|
|
1652
|
+
* @param value Value as number
|
|
1653
|
+
* @returns Value as '1px'
|
|
1654
|
+
*/
|
|
1655
|
+
function getCssLikeValue(value, type = UIConstants.CSS_PIXELS) {
|
|
1656
|
+
return value + type;
|
|
1560
1657
|
}
|
|
1561
1658
|
/**
|
|
1562
|
-
*
|
|
1563
|
-
* @param
|
|
1564
|
-
* @
|
|
1659
|
+
* Parse CSS like value to number
|
|
1660
|
+
* @param value CSS like value
|
|
1661
|
+
* @returns Number value
|
|
1565
1662
|
*/
|
|
1566
|
-
function
|
|
1567
|
-
|
|
1568
|
-
while (i--) {
|
|
1569
|
-
if (predicate(collection[i])) {
|
|
1570
|
-
collection.splice(i, 1);
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1663
|
+
function getValueFromCssLikeValue(value, type = UIConstants.CSS_PIXELS) {
|
|
1664
|
+
return +value.replace(type, CommonConstants.EMPTY_STRING);
|
|
1573
1665
|
}
|
|
1574
1666
|
/**
|
|
1575
|
-
*
|
|
1576
|
-
* @param
|
|
1577
|
-
* @param
|
|
1578
|
-
* @
|
|
1579
|
-
* @returns True if successfully added
|
|
1667
|
+
* Return CCS like calc value
|
|
1668
|
+
* @param value All value (100% by default)
|
|
1669
|
+
* @param part Part value
|
|
1670
|
+
* @returns Calc value
|
|
1580
1671
|
*/
|
|
1581
|
-
function
|
|
1582
|
-
|
|
1583
|
-
collection = new Array();
|
|
1584
|
-
if (isDefined(predicate) && predicate(item))
|
|
1585
|
-
return false;
|
|
1586
|
-
collection.push(item);
|
|
1587
|
-
return true;
|
|
1672
|
+
function getCalcValue(part, value = 100) {
|
|
1673
|
+
return `calc(${value}${UIConstants.CSS_PERCENTAGE} / ${part} )`;
|
|
1588
1674
|
}
|
|
1589
1675
|
/**
|
|
1590
|
-
*
|
|
1591
|
-
* @param
|
|
1592
|
-
* @
|
|
1593
|
-
* @returns True if successfully removed
|
|
1676
|
+
* Return CCS like rotate value
|
|
1677
|
+
* @param value value as degrees
|
|
1678
|
+
* @returns Rotate value
|
|
1594
1679
|
*/
|
|
1595
|
-
function
|
|
1596
|
-
|
|
1597
|
-
collection.splice(collection.indexOf(item), 1);
|
|
1598
|
-
return true;
|
|
1599
|
-
}
|
|
1600
|
-
return false;
|
|
1680
|
+
function getRotateValue(value) {
|
|
1681
|
+
return `rotate(${value}deg)`;
|
|
1601
1682
|
}
|
|
1602
1683
|
/**
|
|
1603
|
-
*
|
|
1604
|
-
* @param
|
|
1605
|
-
* @param
|
|
1606
|
-
* @returns True if successfully removed
|
|
1684
|
+
* Add classes to HTML element
|
|
1685
|
+
* @param element HTML element
|
|
1686
|
+
* @param classNames Array of CSS classes
|
|
1607
1687
|
*/
|
|
1608
|
-
function
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
collection.splice(collection.indexOf(foundItem), 1);
|
|
1612
|
-
return true;
|
|
1688
|
+
function addClasses(element, ...classNames) {
|
|
1689
|
+
if (isDefined(element)) {
|
|
1690
|
+
classNames.forEach((className) => element.classList.add(className));
|
|
1613
1691
|
}
|
|
1614
|
-
return false;
|
|
1615
1692
|
}
|
|
1616
1693
|
/**
|
|
1617
|
-
*
|
|
1618
|
-
* @param
|
|
1619
|
-
* @param
|
|
1620
|
-
* @returns True if successfully removed
|
|
1694
|
+
* Remove classes to HTML element
|
|
1695
|
+
* @param element HTML element
|
|
1696
|
+
* @param classNames Array of CSS classes
|
|
1621
1697
|
*/
|
|
1622
|
-
function
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
const result = collection.slice(0);
|
|
1626
|
-
result[itemIndex] = {
|
|
1627
|
-
...collection[itemIndex],
|
|
1628
|
-
...newItem
|
|
1629
|
-
};
|
|
1630
|
-
return result;
|
|
1698
|
+
function removeClasses(element, ...classNames) {
|
|
1699
|
+
if (isDefined(element)) {
|
|
1700
|
+
classNames.forEach((className) => element.classList.remove(className));
|
|
1631
1701
|
}
|
|
1632
|
-
return null;
|
|
1633
1702
|
}
|
|
1634
1703
|
/**
|
|
1635
|
-
*
|
|
1636
|
-
* @param
|
|
1637
|
-
* @
|
|
1704
|
+
* Convert RGB color to HEX
|
|
1705
|
+
* @param r Red
|
|
1706
|
+
* @param g Green
|
|
1707
|
+
* @param b Blue
|
|
1708
|
+
* @returns HEX value
|
|
1638
1709
|
*/
|
|
1639
|
-
function
|
|
1640
|
-
return
|
|
1710
|
+
function rgbToHex(r, g, b) {
|
|
1711
|
+
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
1641
1712
|
}
|
|
1642
1713
|
/**
|
|
1643
|
-
*
|
|
1644
|
-
* @param
|
|
1645
|
-
* @
|
|
1646
|
-
* @returns True if arrays are equal
|
|
1714
|
+
* Convert HEX to RGB value
|
|
1715
|
+
* @param hex HEX value
|
|
1716
|
+
* @returns RGB value
|
|
1647
1717
|
*/
|
|
1648
|
-
function
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
return false;
|
|
1718
|
+
function hexToRgb(hex) {
|
|
1719
|
+
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
1720
|
+
if (result) {
|
|
1721
|
+
var r = parseInt(result[1], 16);
|
|
1722
|
+
var g = parseInt(result[2], 16);
|
|
1723
|
+
var b = parseInt(result[3], 16);
|
|
1724
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
1656
1725
|
}
|
|
1657
|
-
return
|
|
1726
|
+
return null;
|
|
1727
|
+
}
|
|
1728
|
+
/**
|
|
1729
|
+
* Set opacity for RGB value
|
|
1730
|
+
* @param rgb Rgb value with {opacity} placeholder
|
|
1731
|
+
* @param opacity Opacity value
|
|
1732
|
+
* @returns RGB value with relevant opacity
|
|
1733
|
+
*/
|
|
1734
|
+
function replaceRgbOpacity(rgb, opacity) {
|
|
1735
|
+
return rgb.replace(UIConstants.RGB_OPACITY_PLACEHOLDER, opacity.toString());
|
|
1658
1736
|
}
|
|
1659
1737
|
|
|
1660
1738
|
/**
|
|
@@ -3234,7 +3312,7 @@ class LoadContainerComponent {
|
|
|
3234
3312
|
})), loader$ = this.pagination ? pagination$ : more$;
|
|
3235
3313
|
return loader$.pipe(map(() => ({ params: params, page: this.page })));
|
|
3236
3314
|
}));
|
|
3237
|
-
return combineLatest([this.sortingService.sorting$.pipe(startWith(this.model.sorting)), parameters$]).pipe(tap(() => this.loading = true), map(([sorting, parameters]) => ({ params: parameters.params, page: parameters.page, sorting: sorting })));
|
|
3315
|
+
return combineLatest([this.sortingService.sorting$.pipe(startWith(this.model.sorting)), parameters$]).pipe(tap(() => this.loading = true), map(([sorting, parameters]) => ({ params: parameters.params, page: parameters.page, size: this.model.pagination?.size, sorting: sorting })));
|
|
3238
3316
|
}
|
|
3239
3317
|
buildDynamic(parameters$, loader) {
|
|
3240
3318
|
return parameters$.pipe(switchMap((parameters) => loader(parameters)), map((model) => ({ ...model, reset: this.reset, page: this.page })));
|
|
@@ -3246,7 +3324,7 @@ class LoadContainerComponent {
|
|
|
3246
3324
|
if (this.source == LoadContainerChangesSource.Data
|
|
3247
3325
|
&& parameters.page != LoadMoreService.START_PAGE) {
|
|
3248
3326
|
this.resetParameters();
|
|
3249
|
-
parameters = { params: parameters.params, page: this.page, sorting: parameters.sorting };
|
|
3327
|
+
parameters = { params: parameters.params, page: this.page, size: this.model.pagination?.size, sorting: parameters.sorting };
|
|
3250
3328
|
}
|
|
3251
3329
|
const filtered = model.filter ? model.filter(items, parameters) : items, sorted = parameters.sorting ? sortBy([...filtered], parameters.sorting.id, parameters.sorting.direction) : filtered, data = sorted ? {
|
|
3252
3330
|
items: this.model.pagination ? skip(sorted, parameters.page, this.model.pagination?.size) : sorted,
|
|
@@ -3445,28 +3523,34 @@ TagConstants.DEFAULT_LABEL = 'Tag';
|
|
|
3445
3523
|
|
|
3446
3524
|
class TagComponent {
|
|
3447
3525
|
constructor() {
|
|
3448
|
-
this.
|
|
3526
|
+
this.remove = false;
|
|
3449
3527
|
this.model = {
|
|
3450
3528
|
key: CommonConstants.DEFAULT_KEY_VALUE,
|
|
3451
3529
|
label: TagConstants.DEFAULT_LABEL
|
|
3452
3530
|
};
|
|
3453
|
-
this.
|
|
3531
|
+
this.removeAction = new EventEmitter();
|
|
3454
3532
|
}
|
|
3533
|
+
_onClick() { if (this.model.click)
|
|
3534
|
+
this.model.click(this.model); }
|
|
3455
3535
|
onRemove() {
|
|
3456
|
-
this.
|
|
3536
|
+
this.removeAction.emit(this.model);
|
|
3457
3537
|
}
|
|
3458
3538
|
}
|
|
3459
3539
|
TagComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: TagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3460
|
-
TagComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: TagComponent, selector: "sfc-
|
|
3540
|
+
TagComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: TagComponent, selector: "sfc-tag", inputs: { remove: "remove", model: "model" }, outputs: { removeAction: "remove" }, host: { listeners: { "click": "_onClick()" } }, ngImport: i0, template: "<div class=\"container\">\r\n <div class=\"content\">\r\n <sfc-icon *ngIf=\"model.icon || model.imageSrc\" [icon]=\"model.icon\" [imageSrc]=\"model.imageSrc\"></sfc-icon>\r\n <span>{{model.label}}</span>\r\n <sfc-close *ngIf=\"model.remove\" (click)=\"onRemove()\"></sfc-close>\r\n </div>\r\n</div>", styles: [":host{display:inline-block}:host .container .content{display:flex;align-items:center;text-align:center;padding:.3em .8em;display:inline-flex;border-radius:1em;font-weight:700;-webkit-user-select:none;user-select:none;transition:color .5s ease;transition:background-color .5s ease;transition:color .5s ease,background-color .5s ease,border-color .5s ease;border:.125em solid transparent}:host .container .content,:host-context(.sfc-default-theme) :host .container .content{color:#fff}:host-context(.sfc-dark-theme) :host .container .content{color:#545e61}:host .container .content,:host-context(.sfc-default-theme) :host .container .content{background-color:#545e61}:host-context(.sfc-dark-theme) :host .container .content{background-color:#fff}:host .container .content sfc-icon{margin-right:.2em}:host .container .content sfc-icon ::ng-deep .container img{max-width:1em;max-height:1em}:host .container .content sfc-close{margin-left:.6em;color:#ed5565;font-size:.8em}:host:hover .container .content{background-color:#ffce54;color:#fff}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CloseComponent, selector: "sfc-close" }, { kind: "component", type: IconComponent, selector: "sfc-icon", inputs: ["icon", "imageSrc"] }] });
|
|
3461
3541
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: TagComponent, decorators: [{
|
|
3462
3542
|
type: Component,
|
|
3463
|
-
args: [{ selector: 'sfc-
|
|
3464
|
-
}], propDecorators: {
|
|
3543
|
+
args: [{ selector: 'sfc-tag', template: "<div class=\"container\">\r\n <div class=\"content\">\r\n <sfc-icon *ngIf=\"model.icon || model.imageSrc\" [icon]=\"model.icon\" [imageSrc]=\"model.imageSrc\"></sfc-icon>\r\n <span>{{model.label}}</span>\r\n <sfc-close *ngIf=\"model.remove\" (click)=\"onRemove()\"></sfc-close>\r\n </div>\r\n</div>", styles: [":host{display:inline-block}:host .container .content{display:flex;align-items:center;text-align:center;padding:.3em .8em;display:inline-flex;border-radius:1em;font-weight:700;-webkit-user-select:none;user-select:none;transition:color .5s ease;transition:background-color .5s ease;transition:color .5s ease,background-color .5s ease,border-color .5s ease;border:.125em solid transparent}:host .container .content,:host-context(.sfc-default-theme) :host .container .content{color:#fff}:host-context(.sfc-dark-theme) :host .container .content{color:#545e61}:host .container .content,:host-context(.sfc-default-theme) :host .container .content{background-color:#545e61}:host-context(.sfc-dark-theme) :host .container .content{background-color:#fff}:host .container .content sfc-icon{margin-right:.2em}:host .container .content sfc-icon ::ng-deep .container img{max-width:1em;max-height:1em}:host .container .content sfc-close{margin-left:.6em;color:#ed5565;font-size:.8em}:host:hover .container .content{background-color:#ffce54;color:#fff}\n"] }]
|
|
3544
|
+
}], propDecorators: { remove: [{
|
|
3465
3545
|
type: Input
|
|
3466
3546
|
}], model: [{
|
|
3467
3547
|
type: Input
|
|
3468
|
-
}],
|
|
3469
|
-
type: Output
|
|
3548
|
+
}], removeAction: [{
|
|
3549
|
+
type: Output,
|
|
3550
|
+
args: ['remove']
|
|
3551
|
+
}], _onClick: [{
|
|
3552
|
+
type: HostListener,
|
|
3553
|
+
args: ['click']
|
|
3470
3554
|
}] } });
|
|
3471
3555
|
|
|
3472
3556
|
class NgxSfcCommonModule {
|
|
@@ -3695,5 +3779,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
3695
3779
|
* Generated bundle index. Do not edit.
|
|
3696
3780
|
*/
|
|
3697
3781
|
|
|
3698
|
-
export { BounceLoaderComponent, BrowserDocumentRef, BrowserWindowRef, ButtonComponent, ButtonType, CheckmarkComponent, CheckmarkType, CircleLoaderComponent, CircleLoaderType, ClickOutsideDirective, CloseComponent, CollapseExpandComponent, CollapseExpandContainerComponent, CollapseExpandDirective, CommonConstants, Compare, ComponentReferenceDirective, ComponentSize, ComponentSizeDirective, DOCUMENT, DOCUMENT_PROVIDERS, DateTimeConstants, DefaultModalFooterComponent, DefaultModalHeaderComponent, DelimeterComponent, DestroyParentDirective, Direction, DocumentRef, DomChangesDirective, DotComponent, DotsComponent, HamburgerComponent, HamburgerMenuComponent, IconComponent, IfDirective, ImageLoadDirective, ImageLoadService, ItemsView, LoadContainerChangesSource, LoadContainerComponent, LoadContainerLoadType, LoadContainerType, LoadMoreButtonComponent, LoadMoreService, LoaderService, MediaLimits, MessageComponent, ModalComponent, ModalOpenDirective, ModalOpenOnClickDirective, ModalService, ModalTemplate, MouseDownDirective, NgxSfcCommonModule, NotificationType, ObservableBehaviorModel, ObservableModel, PaginationComponent, PaginationConstants, PaginationService, Position, ReloadService, RepeatPipe, ResizeService, ScrollIntoViewDirective, ScrollTrackerDirective, Select, Sequence, ShowHideElementDirective, SortByPipe, SortingDirection, SortingService, State, SwitchMultiCasePipe, TagComponent, TemplateContentComponent, TemplateReferenceDirective, Theme, ThrowElementOnHoverDirective, ToggleComponent, ToggleSwitcherComponent, TooltipComponent, TooltipType, UIClass, UIConstants, WINDOW, WINDOW_PROVIDERS, WindowRef, addClasses, addItem, addPropertyToObject, all, any, browserDocumentProvider, browserWindowProvider, buildHttpParams, contains, convertDateToTimestamp, convertFromBase64String, convertTimestampToDate, convertToBase64String, convertUTCDateToLocalDate, count, distinct, documentFactory, documentProvider, firstItem, firstOrDefault, generateGuid, getAge, getCalcValue, getCollectionOrEmpty, getCssLikeValue, getFileExtension, getFirstDayOfMonth, getFirstDayOfMonthByYearAndMonth, getFirstDayOfYear, getLastDayOfMonth, getLastDayOfMonthByYearAndMonth, getLastDayOfYear, getNextDate, getNextMonth, getNextYear, getPreviousDate, getPreviousMonth, getPreviousYear, getRotateValue, getValueFromCssLikeValue, getWeeksNumberInMonth, hasAnyItem, hasItem, hasItemBy, hasObjectItem, hexToRgb, isArraysEquals, isAsyncData, isChromeBrowser, isDateGreat, isDateGreatOrEqual, isDateTimeGreat, isDateTimeGreatOrEqual, isDateTimeLessOrEqual, isDefined, isEmail, isEqual, isEqualDateTimes, isEqualDates, isImage, isJsonString, isNullOrEmptyString, isNumeric, isObject, isString, isTimeGreatOrEqual, isTimeLessOrEqual, lastItem, max, mergeDeep, nameof, parseBoolean, parseFileSize, readAsDataURL, remove, removeClasses, removeItem, removeItemBy, removePropertyFromObject, replaceRgbOpacity, rgbToHex, setDay, setDefaultSecondsAndMiliseconds, setHours, setMilliseconds, setMinutes, setSeconds, setYear, skip, sort, sortBy, sortByPath, stopAndPreventPropagation, sum, trim, updateItemBy, where, windowFactory, windowProvider };
|
|
3782
|
+
export { BounceLoaderComponent, BrowserDocumentRef, BrowserWindowRef, ButtonComponent, ButtonType, CheckmarkComponent, CheckmarkType, CircleLoaderComponent, CircleLoaderType, ClickOutsideDirective, CloseComponent, CollapseExpandComponent, CollapseExpandContainerComponent, CollapseExpandDirective, CommonConstants, Compare, ComponentReferenceDirective, ComponentSize, ComponentSizeDirective, DOCUMENT, DOCUMENT_PROVIDERS, DateTimeConstants, DefaultModalFooterComponent, DefaultModalHeaderComponent, DelimeterComponent, DestroyParentDirective, Direction, DocumentRef, DomChangesDirective, DotComponent, DotsComponent, HamburgerComponent, HamburgerMenuComponent, IconComponent, IfDirective, ImageLoadDirective, ImageLoadService, ItemsView, LoadContainerChangesSource, LoadContainerComponent, LoadContainerLoadType, LoadContainerType, LoadMoreButtonComponent, LoadMoreService, LoaderService, MediaLimits, MessageComponent, ModalComponent, ModalOpenDirective, ModalOpenOnClickDirective, ModalService, ModalTemplate, MouseDownDirective, NgxSfcCommonModule, NotificationType, ObservableBehaviorModel, ObservableModel, PaginationComponent, PaginationConstants, PaginationService, Position, ReloadService, RepeatPipe, ResizeService, ScrollIntoViewDirective, ScrollTrackerDirective, Select, Sequence, ShowHideElementDirective, SortByPipe, SortingDirection, SortingService, State, SwitchMultiCasePipe, TagComponent, TemplateContentComponent, TemplateReferenceDirective, Theme, ThrowElementOnHoverDirective, ToggleComponent, ToggleSwitcherComponent, TooltipComponent, TooltipType, UIClass, UIConstants, WINDOW, WINDOW_PROVIDERS, WindowRef, addClasses, addItem, addPropertyToObject, all, any, browserDocumentProvider, browserWindowProvider, buildHttpParams, contains, convertDateToTimestamp, convertFromBase64String, convertTimestampToDate, convertToBase64String, convertUTCDateToLocalDate, count, deepClone, distinct, documentFactory, documentProvider, findChangedPropertyKey, findChangedPropertyPath, firstItem, firstOrDefault, generateGuid, getAge, getCalcValue, getCollectionOrEmpty, getCssLikeValue, getFileExtension, getFirstDayOfMonth, getFirstDayOfMonthByYearAndMonth, getFirstDayOfYear, getLastDayOfMonth, getLastDayOfMonthByYearAndMonth, getLastDayOfYear, getNextDate, getNextMonth, getNextYear, getPreviousDate, getPreviousMonth, getPreviousYear, getRotateValue, getValueFromCssLikeValue, getWeeksNumberInMonth, hasAnyItem, hasItem, hasItemBy, hasObjectItem, hexToRgb, isArraysEquals, isAsyncData, isChromeBrowser, isDateGreat, isDateGreatOrEqual, isDateTimeGreat, isDateTimeGreatOrEqual, isDateTimeLessOrEqual, isDefined, isEmail, isEqual, isEqualDateTimes, isEqualDates, isImage, isJsonString, isNullOrEmptyString, isNumeric, isObject, isString, isTimeGreatOrEqual, isTimeLessOrEqual, lastItem, max, mergeDeep, nameof, parseBoolean, parseFileSize, readAsDataURL, remove, removeClasses, removeItem, removeItemBy, removePropertyFromObject, replaceRgbOpacity, rgbToHex, setDay, setDefaultSecondsAndMiliseconds, setHours, setMilliseconds, setMinutes, setSeconds, setYear, skip, sort, sortBy, sortByPath, stopAndPreventPropagation, sum, trim, updateItemBy, updatePropertyByKey, where, windowFactory, windowProvider };
|
|
3783
|
+
//# sourceMappingURL=ngx-sfc-common.mjs.map
|
|
3699
3784
|
//# sourceMappingURL=ngx-sfc-common.mjs.map
|