@iamproperty/components 2.7.6 → 2.7.7
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/assets/css/core.min.css +1 -1
- package/assets/css/core.min.css.map +1 -1
- package/assets/css/style.min.css +1 -1
- package/assets/css/style.min.css.map +1 -1
- package/assets/js/modules/chart.js +217 -0
- package/assets/js/modules/helpers.js +18 -14
- package/assets/js/modules/table.js +89 -89
- package/assets/js/scripts.bundle.js +49 -55
- package/assets/js/scripts.bundle.js.map +1 -1
- package/assets/js/scripts.bundle.min.js +2 -2
- package/assets/js/scripts.bundle.min.js.map +1 -1
- package/assets/sass/foundations/icons.scss +3 -2
- package/assets/svg/icons.svg +483 -0
- package/dist/components.common.js +57 -56
- package/dist/components.common.js.map +1 -1
- package/dist/components.umd.js +57 -56
- package/dist/components.umd.js.map +1 -1
- package/dist/components.umd.min.js +1 -1
- package/dist/components.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Chart/Chart.vue +8 -165
package/dist/components.umd.js
CHANGED
|
@@ -475,7 +475,6 @@ var addBodyClasses = body => {
|
|
|
475
475
|
* @param {HTMLElement} element Dom element, this doesn't have to be the body but it is recommended.
|
|
476
476
|
*/
|
|
477
477
|
|
|
478
|
-
|
|
479
478
|
var checkElements = element => {
|
|
480
479
|
// Tables
|
|
481
480
|
Array.from(element.querySelectorAll('table')).forEach((table, index) => {
|
|
@@ -488,7 +487,6 @@ var checkElements = element => {
|
|
|
488
487
|
* @param {HTMLElement} table Dom table element
|
|
489
488
|
*/
|
|
490
489
|
|
|
491
|
-
|
|
492
490
|
var tableWrap = table => {
|
|
493
491
|
if (!table.parentNode.classList.contains('table__wrapper')) {
|
|
494
492
|
var tableHTML = table.outerHTML;
|
|
@@ -500,7 +498,6 @@ var tableWrap = table => {
|
|
|
500
498
|
* @param {HTMLElement} table Dom table element
|
|
501
499
|
*/
|
|
502
500
|
|
|
503
|
-
|
|
504
501
|
var tableStacked = table => {
|
|
505
502
|
var colHeadings = Array.from(table.querySelectorAll('thead th'));
|
|
506
503
|
var colRows = Array.from(table.querySelectorAll('tbody tr'));
|
|
@@ -518,17 +515,23 @@ var tableStacked = table => {
|
|
|
518
515
|
});
|
|
519
516
|
});
|
|
520
517
|
};
|
|
521
|
-
|
|
522
518
|
var isNumeric = function isNumeric(str) {
|
|
523
519
|
if (typeof str != "string") return false; // we only process strings!
|
|
524
520
|
|
|
525
521
|
return !isNaN(str) && // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)...
|
|
526
522
|
!isNaN(parseFloat(str)); // ...and ensure strings of whitespace fail
|
|
527
523
|
};
|
|
528
|
-
|
|
529
524
|
var zeroPad = (num, places) => String(num).padStart(places, '0');
|
|
530
|
-
|
|
531
|
-
|
|
525
|
+
var helpers_ucfirst = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
526
|
+
var helpers_ucwords = str => str.split(' ').map(s => helpers_ucfirst(s)).join(' ');
|
|
527
|
+
var helpers_unsnake = str => str.replace(/_/g, ' ');
|
|
528
|
+
var helpers_snake = str => str.replace(/ /g, '_');
|
|
529
|
+
var helpers_safeID = function safeID(str) {
|
|
530
|
+
str = str.toLowerCase();
|
|
531
|
+
str = helpers_snake(str);
|
|
532
|
+
str = str.replace(/\W/g, '');
|
|
533
|
+
return str;
|
|
534
|
+
};
|
|
532
535
|
;// CONCATENATED MODULE: ./assets/js/modules/table.js
|
|
533
536
|
|
|
534
537
|
|
|
@@ -540,7 +543,7 @@ function table(tableElement) {
|
|
|
540
543
|
var sortedEvent = new Event('sorted');
|
|
541
544
|
var filteredEvent = new Event('filtered');
|
|
542
545
|
var reorderedEvent = new Event('reordered');
|
|
543
|
-
var randID = '
|
|
546
|
+
var randID = 'table_' + Math.random().toString(36).substr(2, 9); // Random to make sure IDs created are unique
|
|
544
547
|
|
|
545
548
|
var draggedRow;
|
|
546
549
|
tableElement.setAttribute('id', randID); // #region Sortable
|
|
@@ -726,47 +729,6 @@ function table(tableElement) {
|
|
|
726
729
|
var stopShowing = show * page;
|
|
727
730
|
style.innerHTML = "\n #".concat(randID, " tbody tr {\n display: none;\n }\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, "),\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, ") ~ tr{\n display: block;\n }\n @media screen and (min-width: 36em) {\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, "),\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, ") ~ tr{\n display: table-row;\n }\n }\n #").concat(randID, " tbody tr:nth-child(").concat(stopShowing, ") ~ tr{\n display: none;\n }\n ");
|
|
728
731
|
tableElement.append(style);
|
|
729
|
-
};
|
|
730
|
-
|
|
731
|
-
var createPaginationForm = function createPaginationForm(show, page, totalRows) {
|
|
732
|
-
var form = document.createElement("div");
|
|
733
|
-
form.classList.add('table__pagination');
|
|
734
|
-
form.classList.add('row');
|
|
735
|
-
form.classList.add('pt-3');
|
|
736
|
-
form.classList.add('pb-3'); // Create the form and create a container div to hold the pagination buttons
|
|
737
|
-
|
|
738
|
-
form.innerHTML = "<div class=\"col mw-fit-content mb-3\">\n <div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_showing\" class=\"form-label\">Showing:</label>\n <input type=\"number\" name=\"").concat(randID, "_showing\" id=\"").concat(randID, "_showing\" class=\"form-control form-control-sm showing-input-field\" placeholder=\"\" list=\"").concat(randID, "_pagination\" value=\"").concat(show, "\" min=\"1\" max=\"").concat(totalRows, "\" />\n </div>\n <datalist id=\"").concat(randID, "_pagination\">\n <option value=\"5\">5</option>\n ").concat(totalRows > 10 ? "<option value=\"10\">10</option>" : '', "\n ").concat(totalRows > 20 ? "<option value=\"20\">20</option>" : '', "\n <option value=\"").concat(totalRows, "\">").concat(totalRows, "</option>\n </datalist>\n</div>\n<div class=\"col mw-fit-content me-auto d-flex align-items-center mb-3\"><span class=\"label\">per page</span></div>\n<div class=\"col mw-fit-content d-sm-flex justify-content-end align-items-center\" id=\"").concat(randID, "_paginationBtns\"></div>"); // Add after the actual table
|
|
739
|
-
|
|
740
|
-
tableElement.append(form);
|
|
741
|
-
};
|
|
742
|
-
|
|
743
|
-
var createPaginationButttons = function createPaginationButttons(show, page, totalRows) {
|
|
744
|
-
var paginationButtonsWrapper = document.getElementById(randID + '_paginationBtns');
|
|
745
|
-
if (paginationButtonsWrapper == null) return false;
|
|
746
|
-
var numberPages = Math.ceil(totalRows / show);
|
|
747
|
-
|
|
748
|
-
if (numberPages == 1) {
|
|
749
|
-
// Remore the buttons or dont display any if we dont need them
|
|
750
|
-
paginationButtonsWrapper.innerHTML = '';
|
|
751
|
-
} else if (numberPages < 5) {
|
|
752
|
-
// If less than 5 pages (which fits comfortably on mobile) we display buttons
|
|
753
|
-
var strButtons = '';
|
|
754
|
-
|
|
755
|
-
for (var i = 1; i <= numberPages; i++) {
|
|
756
|
-
if (i == page) strButtons += "<li class=\"page-item active\" aria-current=\"page\"><span class=\"page-link\">".concat(i, "</span></li>");else strButtons += "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(i, "\">").concat(i, "</button></li>");
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
paginationButtonsWrapper.innerHTML = "<span class=\"pe-2 mb-3\">Page: </span><ul class=\"pagination mb-3\">\n ".concat(page == 1 ? "<li class=\"page-item disabled\"><span class=\"page-link\">Previous</span></li>" : "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(parseInt(page) - 1, "\">Previous</button></li>"), "\n ").concat(strButtons, "\n ").concat(page == numberPages ? "<li class=\"page-item disabled\"><span class=\"page-link\">Next</span></li>" : "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(parseInt(page) + 1, "\">Next</button></li>"), "\n </ul>");
|
|
760
|
-
} else {
|
|
761
|
-
// If more than 5 lets show a select field instead so that we dont have loads and loads of buttons
|
|
762
|
-
var strOptions = '';
|
|
763
|
-
|
|
764
|
-
for (var _i = 1; _i <= numberPages; _i++) {
|
|
765
|
-
if (_i == page) strOptions += "<option value=\"".concat(_i, "\" selected>Page ").concat(_i, "</option>");else strOptions += "<option value=\"".concat(_i, "\">Page ").concat(_i, "</option>");
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
paginationButtonsWrapper.innerHTML = "\n<div class=\"form-control__wrapper page-number mb-2\">\n<select class=\"form-select\">\n ".concat(strOptions, "\n</select>\n</div>\n ");
|
|
769
|
-
}
|
|
770
732
|
}; // On page load check if the table should be paginated
|
|
771
733
|
|
|
772
734
|
|
|
@@ -777,13 +739,13 @@ function table(tableElement) {
|
|
|
777
739
|
|
|
778
740
|
if (show < totalRows) {
|
|
779
741
|
paginateRows(show, page);
|
|
780
|
-
createPaginationForm(show, page, totalRows);
|
|
781
|
-
createPaginationButttons(show, page, totalRows);
|
|
742
|
+
createPaginationForm(randID, tableElement, show, page, totalRows);
|
|
743
|
+
createPaginationButttons(randID, tableElement, show, page, totalRows);
|
|
782
744
|
tableElement.addEventListener('change', function (e) {
|
|
783
745
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
784
746
|
if (target.matches('.table__pagination input[type="number"]')) {
|
|
785
747
|
paginateRows(target.value, page);
|
|
786
|
-
createPaginationButttons(target.value, page, totalRows);
|
|
748
|
+
createPaginationButttons(randID, tableElement, target.value, page, totalRows);
|
|
787
749
|
tableElement.setAttribute('data-show', target.value);
|
|
788
750
|
}
|
|
789
751
|
}
|
|
@@ -792,7 +754,7 @@ function table(tableElement) {
|
|
|
792
754
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
793
755
|
if (target.matches('.page-item:not(.active):not(.disabled) .page-link')) {
|
|
794
756
|
paginateRows(tableElement.getAttribute('data-show'), target.getAttribute('data-page'));
|
|
795
|
-
createPaginationButttons(tableElement.getAttribute('data-show'), target.getAttribute('data-page'), totalRows);
|
|
757
|
+
createPaginationButttons(randID, tableElement, tableElement.getAttribute('data-show'), target.getAttribute('data-page'), totalRows);
|
|
796
758
|
}
|
|
797
759
|
}
|
|
798
760
|
}, false);
|
|
@@ -800,7 +762,7 @@ function table(tableElement) {
|
|
|
800
762
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
801
763
|
if (target.matches('.table__pagination select')) {
|
|
802
764
|
paginateRows(tableElement.getAttribute('data-show'), target.value);
|
|
803
|
-
createPaginationButttons(tableElement.getAttribute('data-show'), target.value, totalRows);
|
|
765
|
+
createPaginationButttons(randID, tableElement, tableElement.getAttribute('data-show'), target.value, totalRows);
|
|
804
766
|
}
|
|
805
767
|
}
|
|
806
768
|
});
|
|
@@ -926,8 +888,8 @@ function table(tableElement) {
|
|
|
926
888
|
|
|
927
889
|
if (_show < _totalRows) {
|
|
928
890
|
paginateRows(_show, 1);
|
|
929
|
-
createPaginationForm(_show, 1, _totalRows);
|
|
930
|
-
createPaginationButttons(_show, 1, _totalRows);
|
|
891
|
+
createPaginationForm(randID, tableElement, _show, 1, _totalRows);
|
|
892
|
+
createPaginationButttons(randID, tableElement, _show, 1, _totalRows);
|
|
931
893
|
}
|
|
932
894
|
}
|
|
933
895
|
|
|
@@ -951,6 +913,45 @@ function table(tableElement) {
|
|
|
951
913
|
}, false);
|
|
952
914
|
}
|
|
953
915
|
|
|
916
|
+
var createPaginationForm = function createPaginationForm(randID, tableElement, show, page, totalRows) {
|
|
917
|
+
var form = document.createElement("div");
|
|
918
|
+
form.classList.add('table__pagination');
|
|
919
|
+
form.classList.add('row');
|
|
920
|
+
form.classList.add('pt-3');
|
|
921
|
+
form.classList.add('pb-3'); // Create the form and create a container div to hold the pagination buttons
|
|
922
|
+
|
|
923
|
+
form.innerHTML = "<div class=\"col mw-fit-content mb-3\">\n<div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_showing\" class=\"form-label\">Showing:</label>\n <input type=\"number\" name=\"").concat(randID, "_showing\" id=\"").concat(randID, "_showing\" class=\"form-control form-control-sm showing-input-field\" placeholder=\"\" list=\"").concat(randID, "_pagination\" value=\"").concat(show, "\" min=\"1\" max=\"").concat(totalRows, "\" />\n</div>\n<datalist id=\"").concat(randID, "_pagination\">\n<option value=\"5\">5</option>\n").concat(totalRows > 10 ? "<option value=\"10\">10</option>" : '', "\n").concat(totalRows > 20 ? "<option value=\"20\">20</option>" : '', "\n<option value=\"").concat(totalRows, "\">").concat(totalRows, "</option>\n</datalist>\n</div>\n<div class=\"col mw-fit-content me-auto d-flex align-items-center mb-3\"><span class=\"label\">per page</span></div>\n<div class=\"col mw-fit-content d-sm-flex justify-content-end align-items-center\" id=\"").concat(randID, "_paginationBtns\"></div>"); // Add after the actual table
|
|
924
|
+
|
|
925
|
+
tableElement.append(form);
|
|
926
|
+
};
|
|
927
|
+
var createPaginationButttons = function createPaginationButttons(randID, tableElement, show, page, totalRows) {
|
|
928
|
+
var paginationButtonsWrapper = document.getElementById(randID + '_paginationBtns');
|
|
929
|
+
if (paginationButtonsWrapper == null) return false;
|
|
930
|
+
var numberPages = Math.ceil(totalRows / show);
|
|
931
|
+
|
|
932
|
+
if (numberPages == 1) {
|
|
933
|
+
// Remore the buttons or dont display any if we dont need them
|
|
934
|
+
paginationButtonsWrapper.innerHTML = '';
|
|
935
|
+
} else if (numberPages < 5) {
|
|
936
|
+
// If less than 5 pages (which fits comfortably on mobile) we display buttons
|
|
937
|
+
var strButtons = '';
|
|
938
|
+
|
|
939
|
+
for (var i = 1; i <= numberPages; i++) {
|
|
940
|
+
if (i == page) strButtons += "<li class=\"page-item active\" aria-current=\"page\"><span class=\"page-link\">".concat(i, "</span></li>");else strButtons += "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(i, "\">").concat(i, "</button></li>");
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
paginationButtonsWrapper.innerHTML = "<span class=\"pe-2 mb-3\">Page: </span><ul class=\"pagination mb-3\">\n ".concat(page == 1 ? "<li class=\"page-item disabled\"><span class=\"page-link\">Previous</span></li>" : "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(parseInt(page) - 1, "\">Previous</button></li>"), "\n ").concat(strButtons, "\n ").concat(page == numberPages ? "<li class=\"page-item disabled\"><span class=\"page-link\">Next</span></li>" : "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(parseInt(page) + 1, "\">Next</button></li>"), "\n </ul>");
|
|
944
|
+
} else {
|
|
945
|
+
// If more than 5 lets show a select field instead so that we dont have loads and loads of buttons
|
|
946
|
+
var strOptions = '';
|
|
947
|
+
|
|
948
|
+
for (var _i = 1; _i <= numberPages; _i++) {
|
|
949
|
+
if (_i == page) strOptions += "<option value=\"".concat(_i, "\" selected>Page ").concat(_i, "</option>");else strOptions += "<option value=\"".concat(_i, "\">Page ").concat(_i, "</option>");
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
paginationButtonsWrapper.innerHTML = "\n<div class=\"form-control__wrapper page-number mb-2\">\n<select class=\"form-select\">\n".concat(strOptions, "\n</select>\n</div>\n ");
|
|
953
|
+
}
|
|
954
|
+
};
|
|
954
955
|
/* harmony default export */ var modules_table = (table);
|
|
955
956
|
;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??clonedRuleSet-82[0].rules[0].use[0]!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].rules[0].use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/elements/Table/Table.vue?vue&type=script&lang=js&
|
|
956
957
|
//
|