@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
|
@@ -465,7 +465,6 @@ var addBodyClasses = body => {
|
|
|
465
465
|
* @param {HTMLElement} element Dom element, this doesn't have to be the body but it is recommended.
|
|
466
466
|
*/
|
|
467
467
|
|
|
468
|
-
|
|
469
468
|
var checkElements = element => {
|
|
470
469
|
// Tables
|
|
471
470
|
Array.from(element.querySelectorAll('table')).forEach((table, index) => {
|
|
@@ -478,7 +477,6 @@ var checkElements = element => {
|
|
|
478
477
|
* @param {HTMLElement} table Dom table element
|
|
479
478
|
*/
|
|
480
479
|
|
|
481
|
-
|
|
482
480
|
var tableWrap = table => {
|
|
483
481
|
if (!table.parentNode.classList.contains('table__wrapper')) {
|
|
484
482
|
var tableHTML = table.outerHTML;
|
|
@@ -490,7 +488,6 @@ var tableWrap = table => {
|
|
|
490
488
|
* @param {HTMLElement} table Dom table element
|
|
491
489
|
*/
|
|
492
490
|
|
|
493
|
-
|
|
494
491
|
var tableStacked = table => {
|
|
495
492
|
var colHeadings = Array.from(table.querySelectorAll('thead th'));
|
|
496
493
|
var colRows = Array.from(table.querySelectorAll('tbody tr'));
|
|
@@ -508,17 +505,23 @@ var tableStacked = table => {
|
|
|
508
505
|
});
|
|
509
506
|
});
|
|
510
507
|
};
|
|
511
|
-
|
|
512
508
|
var isNumeric = function isNumeric(str) {
|
|
513
509
|
if (typeof str != "string") return false; // we only process strings!
|
|
514
510
|
|
|
515
511
|
return !isNaN(str) && // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)...
|
|
516
512
|
!isNaN(parseFloat(str)); // ...and ensure strings of whitespace fail
|
|
517
513
|
};
|
|
518
|
-
|
|
519
514
|
var zeroPad = (num, places) => String(num).padStart(places, '0');
|
|
520
|
-
|
|
521
|
-
|
|
515
|
+
var helpers_ucfirst = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
516
|
+
var helpers_ucwords = str => str.split(' ').map(s => helpers_ucfirst(s)).join(' ');
|
|
517
|
+
var helpers_unsnake = str => str.replace(/_/g, ' ');
|
|
518
|
+
var helpers_snake = str => str.replace(/ /g, '_');
|
|
519
|
+
var helpers_safeID = function safeID(str) {
|
|
520
|
+
str = str.toLowerCase();
|
|
521
|
+
str = helpers_snake(str);
|
|
522
|
+
str = str.replace(/\W/g, '');
|
|
523
|
+
return str;
|
|
524
|
+
};
|
|
522
525
|
;// CONCATENATED MODULE: ./assets/js/modules/table.js
|
|
523
526
|
|
|
524
527
|
|
|
@@ -530,7 +533,7 @@ function table(tableElement) {
|
|
|
530
533
|
var sortedEvent = new Event('sorted');
|
|
531
534
|
var filteredEvent = new Event('filtered');
|
|
532
535
|
var reorderedEvent = new Event('reordered');
|
|
533
|
-
var randID = '
|
|
536
|
+
var randID = 'table_' + Math.random().toString(36).substr(2, 9); // Random to make sure IDs created are unique
|
|
534
537
|
|
|
535
538
|
var draggedRow;
|
|
536
539
|
tableElement.setAttribute('id', randID); // #region Sortable
|
|
@@ -716,47 +719,6 @@ function table(tableElement) {
|
|
|
716
719
|
var stopShowing = show * page;
|
|
717
720
|
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 ");
|
|
718
721
|
tableElement.append(style);
|
|
719
|
-
};
|
|
720
|
-
|
|
721
|
-
var createPaginationForm = function createPaginationForm(show, page, totalRows) {
|
|
722
|
-
var form = document.createElement("div");
|
|
723
|
-
form.classList.add('table__pagination');
|
|
724
|
-
form.classList.add('row');
|
|
725
|
-
form.classList.add('pt-3');
|
|
726
|
-
form.classList.add('pb-3'); // Create the form and create a container div to hold the pagination buttons
|
|
727
|
-
|
|
728
|
-
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
|
|
729
|
-
|
|
730
|
-
tableElement.append(form);
|
|
731
|
-
};
|
|
732
|
-
|
|
733
|
-
var createPaginationButttons = function createPaginationButttons(show, page, totalRows) {
|
|
734
|
-
var paginationButtonsWrapper = document.getElementById(randID + '_paginationBtns');
|
|
735
|
-
if (paginationButtonsWrapper == null) return false;
|
|
736
|
-
var numberPages = Math.ceil(totalRows / show);
|
|
737
|
-
|
|
738
|
-
if (numberPages == 1) {
|
|
739
|
-
// Remore the buttons or dont display any if we dont need them
|
|
740
|
-
paginationButtonsWrapper.innerHTML = '';
|
|
741
|
-
} else if (numberPages < 5) {
|
|
742
|
-
// If less than 5 pages (which fits comfortably on mobile) we display buttons
|
|
743
|
-
var strButtons = '';
|
|
744
|
-
|
|
745
|
-
for (var i = 1; i <= numberPages; i++) {
|
|
746
|
-
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>");
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
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>");
|
|
750
|
-
} else {
|
|
751
|
-
// If more than 5 lets show a select field instead so that we dont have loads and loads of buttons
|
|
752
|
-
var strOptions = '';
|
|
753
|
-
|
|
754
|
-
for (var _i = 1; _i <= numberPages; _i++) {
|
|
755
|
-
if (_i == page) strOptions += "<option value=\"".concat(_i, "\" selected>Page ").concat(_i, "</option>");else strOptions += "<option value=\"".concat(_i, "\">Page ").concat(_i, "</option>");
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
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 ");
|
|
759
|
-
}
|
|
760
722
|
}; // On page load check if the table should be paginated
|
|
761
723
|
|
|
762
724
|
|
|
@@ -767,13 +729,13 @@ function table(tableElement) {
|
|
|
767
729
|
|
|
768
730
|
if (show < totalRows) {
|
|
769
731
|
paginateRows(show, page);
|
|
770
|
-
createPaginationForm(show, page, totalRows);
|
|
771
|
-
createPaginationButttons(show, page, totalRows);
|
|
732
|
+
createPaginationForm(randID, tableElement, show, page, totalRows);
|
|
733
|
+
createPaginationButttons(randID, tableElement, show, page, totalRows);
|
|
772
734
|
tableElement.addEventListener('change', function (e) {
|
|
773
735
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
774
736
|
if (target.matches('.table__pagination input[type="number"]')) {
|
|
775
737
|
paginateRows(target.value, page);
|
|
776
|
-
createPaginationButttons(target.value, page, totalRows);
|
|
738
|
+
createPaginationButttons(randID, tableElement, target.value, page, totalRows);
|
|
777
739
|
tableElement.setAttribute('data-show', target.value);
|
|
778
740
|
}
|
|
779
741
|
}
|
|
@@ -782,7 +744,7 @@ function table(tableElement) {
|
|
|
782
744
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
783
745
|
if (target.matches('.page-item:not(.active):not(.disabled) .page-link')) {
|
|
784
746
|
paginateRows(tableElement.getAttribute('data-show'), target.getAttribute('data-page'));
|
|
785
|
-
createPaginationButttons(tableElement.getAttribute('data-show'), target.getAttribute('data-page'), totalRows);
|
|
747
|
+
createPaginationButttons(randID, tableElement, tableElement.getAttribute('data-show'), target.getAttribute('data-page'), totalRows);
|
|
786
748
|
}
|
|
787
749
|
}
|
|
788
750
|
}, false);
|
|
@@ -790,7 +752,7 @@ function table(tableElement) {
|
|
|
790
752
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
791
753
|
if (target.matches('.table__pagination select')) {
|
|
792
754
|
paginateRows(tableElement.getAttribute('data-show'), target.value);
|
|
793
|
-
createPaginationButttons(tableElement.getAttribute('data-show'), target.value, totalRows);
|
|
755
|
+
createPaginationButttons(randID, tableElement, tableElement.getAttribute('data-show'), target.value, totalRows);
|
|
794
756
|
}
|
|
795
757
|
}
|
|
796
758
|
});
|
|
@@ -916,8 +878,8 @@ function table(tableElement) {
|
|
|
916
878
|
|
|
917
879
|
if (_show < _totalRows) {
|
|
918
880
|
paginateRows(_show, 1);
|
|
919
|
-
createPaginationForm(_show, 1, _totalRows);
|
|
920
|
-
createPaginationButttons(_show, 1, _totalRows);
|
|
881
|
+
createPaginationForm(randID, tableElement, _show, 1, _totalRows);
|
|
882
|
+
createPaginationButttons(randID, tableElement, _show, 1, _totalRows);
|
|
921
883
|
}
|
|
922
884
|
}
|
|
923
885
|
|
|
@@ -941,6 +903,45 @@ function table(tableElement) {
|
|
|
941
903
|
}, false);
|
|
942
904
|
}
|
|
943
905
|
|
|
906
|
+
var createPaginationForm = function createPaginationForm(randID, tableElement, show, page, totalRows) {
|
|
907
|
+
var form = document.createElement("div");
|
|
908
|
+
form.classList.add('table__pagination');
|
|
909
|
+
form.classList.add('row');
|
|
910
|
+
form.classList.add('pt-3');
|
|
911
|
+
form.classList.add('pb-3'); // Create the form and create a container div to hold the pagination buttons
|
|
912
|
+
|
|
913
|
+
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
|
|
914
|
+
|
|
915
|
+
tableElement.append(form);
|
|
916
|
+
};
|
|
917
|
+
var createPaginationButttons = function createPaginationButttons(randID, tableElement, show, page, totalRows) {
|
|
918
|
+
var paginationButtonsWrapper = document.getElementById(randID + '_paginationBtns');
|
|
919
|
+
if (paginationButtonsWrapper == null) return false;
|
|
920
|
+
var numberPages = Math.ceil(totalRows / show);
|
|
921
|
+
|
|
922
|
+
if (numberPages == 1) {
|
|
923
|
+
// Remore the buttons or dont display any if we dont need them
|
|
924
|
+
paginationButtonsWrapper.innerHTML = '';
|
|
925
|
+
} else if (numberPages < 5) {
|
|
926
|
+
// If less than 5 pages (which fits comfortably on mobile) we display buttons
|
|
927
|
+
var strButtons = '';
|
|
928
|
+
|
|
929
|
+
for (var i = 1; i <= numberPages; i++) {
|
|
930
|
+
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>");
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
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>");
|
|
934
|
+
} else {
|
|
935
|
+
// If more than 5 lets show a select field instead so that we dont have loads and loads of buttons
|
|
936
|
+
var strOptions = '';
|
|
937
|
+
|
|
938
|
+
for (var _i = 1; _i <= numberPages; _i++) {
|
|
939
|
+
if (_i == page) strOptions += "<option value=\"".concat(_i, "\" selected>Page ").concat(_i, "</option>");else strOptions += "<option value=\"".concat(_i, "\">Page ").concat(_i, "</option>");
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
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 ");
|
|
943
|
+
}
|
|
944
|
+
};
|
|
944
945
|
/* harmony default export */ var modules_table = (table);
|
|
945
946
|
;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??clonedRuleSet-40[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&
|
|
946
947
|
//
|