@iamproperty/components 1.0.12 → 2.1.0
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/README.md +120 -12
- package/assets/.DS_Store +0 -0
- package/assets/css/core.min.css +1 -0
- package/assets/css/core.min.css.map +1 -0
- package/assets/css/style.min.css +1 -0
- package/assets/css/style.min.css.map +1 -0
- package/assets/favicons/android-chrome-192x192.png +0 -0
- package/assets/favicons/android-chrome-512x512.png +0 -0
- package/assets/favicons/apple-touch-icon.png +0 -0
- package/assets/favicons/favicon-16x16.png +0 -0
- package/assets/favicons/favicon-32x32.png +0 -0
- package/assets/favicons/favicon.ico +0 -0
- package/assets/fonts/qanelas-medium-webfont.woff +0 -0
- package/assets/fonts/qanelas-medium-webfont.woff2 +0 -0
- package/assets/fonts/qanelassoft-extrabold-webfont.woff +0 -0
- package/assets/fonts/qanelassoft-extrabold-webfont.woff2 +0 -0
- package/assets/img/.DS_Store +0 -0
- package/{src/assets → assets}/img/logo.png +0 -0
- package/assets/js/main.js +62 -0
- package/assets/js/modules/accordion.js +36 -0
- package/assets/js/modules/carousel.js +102 -0
- package/assets/js/modules/drawer.js +16 -0
- package/assets/js/modules/form.js +49 -0
- package/assets/js/modules/helpers.js +93 -0
- package/assets/js/modules/modal.js +72 -0
- package/assets/js/modules/nav.js +27 -0
- package/assets/js/modules/table.js +573 -0
- package/assets/js/modules/testimonial.js +83 -0
- package/assets/js/scripts.bundle.js +1313 -0
- package/assets/js/scripts.bundle.js.map +1 -0
- package/assets/js/scripts.bundle.min.js +7 -0
- package/assets/js/scripts.bundle.min.js.map +1 -0
- package/assets/sass/.DS_Store +0 -0
- package/assets/sass/_components.scss +35 -0
- package/assets/sass/_corefiles.scss +58 -0
- package/assets/sass/_func.scss +9 -0
- package/assets/sass/_functions/functions.scss +95 -0
- package/assets/sass/_functions/mixins.scss +109 -0
- package/assets/sass/_functions/utilities.scss +198 -0
- package/assets/sass/_functions/variables.scss +365 -0
- package/assets/sass/components/accordion.scss +194 -0
- package/assets/sass/components/card.scss +168 -0
- package/assets/sass/components/cardDeck.scss +107 -0
- package/assets/sass/components/carousel.scss +265 -0
- package/assets/sass/components/charts.scss +562 -0
- package/assets/sass/components/drawer.scss +45 -0
- package/assets/sass/components/header.scss +57 -0
- package/assets/sass/components/modal.scss +133 -0
- package/assets/sass/components/nav.scss +619 -0
- package/assets/sass/components/property-searchbar.scss +138 -0
- package/assets/sass/components/snapshot.scss +69 -0
- package/assets/sass/components/tabs.scss +46 -0
- package/assets/sass/components/testimonial.scss +131 -0
- package/assets/sass/components/timeline.scss +93 -0
- package/assets/sass/core.scss +4 -0
- package/assets/sass/elements/buttons.scss +263 -0
- package/assets/sass/elements/container.scss +134 -0
- package/assets/sass/elements/forms.scss +128 -0
- package/assets/sass/elements/links.scss +95 -0
- package/assets/sass/elements/lists.scss +21 -0
- package/assets/sass/elements/media.scss +3 -0
- package/assets/sass/elements/tables.scss +247 -0
- package/assets/sass/elements/tooltips.scss +71 -0
- package/assets/sass/elements/type.scss +99 -0
- package/assets/sass/foundations/brand.scss +64 -0
- package/assets/sass/foundations/circles.scss +66 -0
- package/assets/sass/foundations/fonts.scss +17 -0
- package/assets/sass/foundations/icons.scss +46 -0
- package/assets/sass/foundations/reboot.scss +110 -0
- package/assets/sass/foundations/root.scss +42 -0
- package/assets/sass/main.scss +5 -0
- package/assets/svg/.DS_Store +0 -0
- package/assets/svg/flat/.DS_Store +0 -0
- package/assets/svg/flat/agreed.svg +1 -0
- package/assets/svg/flat/alert.svg +1 -0
- package/assets/svg/flat/asset-37.svg +1 -0
- package/assets/svg/flat/asset-73.svg +1 -0
- package/assets/svg/flat/asset-82.svg +1 -0
- package/assets/svg/flat/award.svg +1 -0
- package/assets/svg/flat/bath.svg +1 -0
- package/assets/svg/flat/bed.svg +1 -0
- package/assets/svg/flat/calculate.svg +1 -0
- package/assets/svg/flat/calendar.svg +1 -0
- package/assets/svg/flat/celebrate.svg +1 -0
- package/assets/svg/flat/chat-house.svg +1 -0
- package/assets/svg/flat/chat.svg +1 -0
- package/assets/svg/flat/circle.svg +1 -0
- package/assets/svg/flat/clean.svg +1 -0
- package/assets/svg/flat/clock.svg +1 -0
- package/assets/svg/flat/computer.svg +1 -0
- package/assets/svg/flat/down.svg +1 -0
- package/assets/svg/flat/edit.svg +1 -0
- package/assets/svg/flat/email.svg +1 -0
- package/assets/svg/flat/event.svg +1 -0
- package/assets/svg/flat/family.svg +1 -0
- package/assets/svg/flat/file.svg +1 -0
- package/assets/svg/flat/find.svg +1 -0
- package/assets/svg/flat/fireworks.svg +1 -0
- package/assets/svg/flat/fist-left.svg +1 -0
- package/assets/svg/flat/fist.svg +1 -0
- package/assets/svg/flat/folder.svg +1 -0
- package/assets/svg/flat/footprints.svg +1 -0
- package/assets/svg/flat/hand.svg +1 -0
- package/assets/svg/flat/hands.svg +1 -0
- package/assets/svg/flat/house-2.svg +1 -0
- package/assets/svg/flat/house.svg +1 -0
- package/assets/svg/flat/idea.svg +1 -0
- package/assets/svg/flat/judge-house.svg +1 -0
- package/assets/svg/flat/judge.svg +1 -0
- package/assets/svg/flat/keys-house.svg +1 -0
- package/assets/svg/flat/lock.svg +1 -0
- package/assets/svg/flat/mobile.svg +1 -0
- package/assets/svg/flat/money.svg +1 -0
- package/assets/svg/flat/monument.svg +1 -0
- package/assets/svg/flat/online-judgement.svg +1 -0
- package/assets/svg/flat/paint.svg +1 -0
- package/assets/svg/flat/person-2.svg +1 -0
- package/assets/svg/flat/person.svg +1 -0
- package/assets/svg/flat/phone.svg +1 -0
- package/assets/svg/flat/pin.svg +1 -0
- package/assets/svg/flat/pound.svg +1 -0
- package/assets/svg/flat/present.svg +1 -0
- package/assets/svg/flat/qualification.svg +1 -0
- package/assets/svg/flat/rocket.svg +1 -0
- package/assets/svg/flat/sale.svg +1 -0
- package/assets/svg/flat/save.svg +1 -0
- package/assets/svg/flat/scale.svg +1 -0
- package/assets/svg/flat/send.svg +1 -0
- package/assets/svg/flat/share.svg +1 -0
- package/assets/svg/flat/sofa.svg +1 -0
- package/assets/svg/flat/sold.svg +1 -0
- package/assets/svg/flat/star.svg +1 -0
- package/assets/svg/flat/stopwatch.svg +1 -0
- package/assets/svg/flat/task.svg +1 -0
- package/assets/svg/flat/telescope.svg +1 -0
- package/assets/svg/flat/thumb.svg +1 -0
- package/assets/svg/flat/time.svg +1 -0
- package/assets/svg/flat/up.svg +1 -0
- package/assets/svg/flat/valuation.svg +1 -0
- package/assets/svg/flat/value-house.svg +1 -0
- package/assets/svg/flat/warning.svg +1 -0
- package/assets/svg/flat/water.svg +1 -0
- package/assets/svg/icons.svg +51 -0
- package/assets/svg/illustrations/commuter1.svg +1 -0
- package/assets/svg/illustrations/commuter2.svg +1 -0
- package/assets/svg/illustrations/commuter3.svg +1 -0
- package/assets/svg/logo.svg +43 -0
- package/dist/components.common.js +8253 -328
- package/dist/components.common.js.map +1 -1
- package/dist/components.css +2 -1
- package/dist/components.css.map +1 -0
- package/dist/components.umd.js +8253 -328
- 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 +91 -57
- package/src/.DS_Store +0 -0
- package/src/components/Accordion/Accordion.vue +24 -0
- package/src/components/Accordion/AccordionItem.vue +43 -0
- package/src/components/Accordion/README.md +34 -0
- package/src/components/Banner/Banner.vue +38 -0
- package/src/components/Banner/README.md +24 -0
- package/src/components/Card/Card.vue +115 -0
- package/src/components/Card/README.md +24 -0
- package/src/components/CardDeck/CardDeck.vue +78 -0
- package/src/components/CardDeck/README.md +25 -0
- package/src/components/Carousel/Carousel.vue +86 -0
- package/src/components/Carousel/README.md +20 -0
- package/src/components/Chart/Chart.vue +246 -0
- package/src/components/Chart/README.md +18 -0
- package/src/components/Drawer/Drawer.vue +54 -0
- package/src/components/Drawer/README.md +23 -0
- package/src/components/Header/Header.vue +39 -0
- package/src/components/Header/README.md +28 -0
- package/src/components/Modal/Modal.vue +44 -0
- package/src/components/Modal/README.md +20 -0
- package/src/components/Nav/Nav.vue +129 -0
- package/src/components/Nav/README.md +23 -0
- package/src/components/PropertySearchbar/PropertySearchbar.vue +206 -0
- package/src/components/PropertySearchbar/README.md +26 -0
- package/src/components/Snapshot/README.md +21 -0
- package/src/components/Snapshot/Snapshot.vue +33 -0
- package/src/components/Tabs/README.md +27 -0
- package/src/components/Tabs/Tab.vue +17 -0
- package/src/components/Tabs/Tabs.vue +55 -0
- package/src/components/Testimonial/README.md +26 -0
- package/src/components/Testimonial/Testimonial.vue +61 -0
- package/src/components/Timeline/README.md +18 -0
- package/src/components/Timeline/Timeline.vue +25 -0
- package/src/elements/Input/Input.vue +236 -0
- package/src/elements/Input/README.md +18 -0
- package/src/elements/Table/README.md +55 -0
- package/src/elements/Table/Table.vue +112 -0
- package/src/foundations/Icon/Icon.vue +21 -0
- package/src/foundations/Icon/README.md +11 -0
- package/src/foundations/Logo/Logo.vue +39 -0
- package/src/foundations/Logo/README.md +20 -0
- package/src/helpers/strings.js +12 -0
- package/src/index.js +21 -4
- package/src/assets/css/default.css +0 -99
- package/src/assets/logo.png +0 -0
- package/src/assets/scss/_variables.scss +0 -13
- package/src/components/KeyFacts/KeyFact.vue +0 -45
- package/src/components/KeyFacts/KeyFactGroup.vue +0 -44
- package/src/components/KeyFacts/README.md +0 -23
- package/src/components/PropertyTaskIntro/PropertyTaskIntro.vue +0 -74
- package/src/components/PropertyTaskIntro/README.md +0 -27
- package/src/components/TaskTitle/README.md +0 -24
- package/src/components/TaskTitle/TaskTitle.vue +0 -68
|
@@ -0,0 +1,1313 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap v2.1.0
|
|
3
|
+
* Copyright 2011-2021 [object Object]
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (factory) {
|
|
7
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
8
|
+
factory();
|
|
9
|
+
})((function () { 'use strict';
|
|
10
|
+
|
|
11
|
+
var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
|
|
12
|
+
var redefine$1 = require('../internals/redefine');
|
|
13
|
+
var toString$3 = require('../internals/object-to-string');
|
|
14
|
+
|
|
15
|
+
// `Object.prototype.toString` method
|
|
16
|
+
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
17
|
+
if (!TO_STRING_TAG_SUPPORT) {
|
|
18
|
+
redefine$1(Object.prototype, 'toString', toString$3, { unsafe: true });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var global$1 = require('../internals/global');
|
|
22
|
+
var DOMIterables = require('../internals/dom-iterables');
|
|
23
|
+
var DOMTokenListPrototype = require('../internals/dom-token-list-prototype');
|
|
24
|
+
var forEach = require('../internals/array-for-each');
|
|
25
|
+
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
26
|
+
|
|
27
|
+
var handlePrototype = function (CollectionPrototype) {
|
|
28
|
+
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
29
|
+
if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
|
|
30
|
+
createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
CollectionPrototype.forEach = forEach;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
for (var COLLECTION_NAME in DOMIterables) {
|
|
37
|
+
if (DOMIterables[COLLECTION_NAME]) {
|
|
38
|
+
handlePrototype(global$1[COLLECTION_NAME] && global$1[COLLECTION_NAME].prototype);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
handlePrototype(DOMTokenListPrototype);
|
|
43
|
+
|
|
44
|
+
var $$7 = require('../internals/export');
|
|
45
|
+
var from = require('../internals/array-from');
|
|
46
|
+
var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
|
|
47
|
+
|
|
48
|
+
var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
|
|
49
|
+
// eslint-disable-next-line es/no-array-from -- required for testing
|
|
50
|
+
Array.from(iterable);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// `Array.from` method
|
|
54
|
+
// https://tc39.es/ecma262/#sec-array.from
|
|
55
|
+
$$7({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
|
|
56
|
+
from: from
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
var charAt = require('../internals/string-multibyte').charAt;
|
|
60
|
+
var toString$2 = require('../internals/to-string');
|
|
61
|
+
var InternalStateModule = require('../internals/internal-state');
|
|
62
|
+
var defineIterator = require('../internals/define-iterator');
|
|
63
|
+
|
|
64
|
+
var STRING_ITERATOR = 'String Iterator';
|
|
65
|
+
var setInternalState = InternalStateModule.set;
|
|
66
|
+
var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
|
|
67
|
+
|
|
68
|
+
// `String.prototype[@@iterator]` method
|
|
69
|
+
// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
|
|
70
|
+
defineIterator(String, 'String', function (iterated) {
|
|
71
|
+
setInternalState(this, {
|
|
72
|
+
type: STRING_ITERATOR,
|
|
73
|
+
string: toString$2(iterated),
|
|
74
|
+
index: 0
|
|
75
|
+
});
|
|
76
|
+
// `%StringIteratorPrototype%.next` method
|
|
77
|
+
// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
|
|
78
|
+
}, function next() {
|
|
79
|
+
var state = getInternalState(this);
|
|
80
|
+
var string = state.string;
|
|
81
|
+
var index = state.index;
|
|
82
|
+
var point;
|
|
83
|
+
if (index >= string.length) return { value: undefined, done: true };
|
|
84
|
+
point = charAt(string, index);
|
|
85
|
+
state.index += point.length;
|
|
86
|
+
return { value: point, done: false };
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
var $$6 = require('../internals/export');
|
|
90
|
+
var $padStart = require('../internals/string-pad').start;
|
|
91
|
+
var WEBKIT_BUG = require('../internals/string-pad-webkit-bug');
|
|
92
|
+
|
|
93
|
+
// `String.prototype.padStart` method
|
|
94
|
+
// https://tc39.es/ecma262/#sec-string.prototype.padstart
|
|
95
|
+
$$6({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
|
|
96
|
+
padStart: function padStart(maxLength /* , fillString = ' ' */) {
|
|
97
|
+
return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Global helper functions to help maintain and enhance framework elements.
|
|
103
|
+
* @module Helpers
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Add global classes used by the CSS and later JavaScript.
|
|
108
|
+
* @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.
|
|
109
|
+
*/
|
|
110
|
+
var addBodyClasses = function addBodyClasses(body) {
|
|
111
|
+
body.classList.add("js-enabled");
|
|
112
|
+
|
|
113
|
+
if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {
|
|
114
|
+
body.classList.add("ie");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return null;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Check if an element contains certain elements that needs enhancing with the JavaScript helpers, it is recommended to do this on the page body after the dom is loaded. Elements that are loaded via ajax should also run this function.
|
|
121
|
+
* @param {HTMLElement} element Dom element, this doesn't have to be the body but it is recommended.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
var checkElements = function checkElements(element) {
|
|
126
|
+
// Tables
|
|
127
|
+
Array.from(element.querySelectorAll('table')).forEach(function (table, index) {
|
|
128
|
+
tableStacked(table);
|
|
129
|
+
tableWrap(table);
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Wrap tables with a table wrapper div to help maintain its responsive design.
|
|
134
|
+
* @param {HTMLElement} table Dom table element
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
var tableWrap = function tableWrap(table) {
|
|
139
|
+
if (!table.parentNode.classList.contains('table__wrapper')) {
|
|
140
|
+
var tableHTML = table.outerHTML;
|
|
141
|
+
table.outerHTML = "<div class=\"table__wrapper\">".concat(tableHTML, "</div>");
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Creates data attributes to be used by the CSS for mobile views.
|
|
146
|
+
* @param {HTMLElement} table Dom table element
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
var tableStacked = function tableStacked(table) {
|
|
151
|
+
var colHeadings = Array.from(table.querySelectorAll('thead th'));
|
|
152
|
+
var colRows = Array.from(table.querySelectorAll('tbody tr'));
|
|
153
|
+
colRows.forEach(function (row, index) {
|
|
154
|
+
var cells = Array.from(row.querySelectorAll('th, td'));
|
|
155
|
+
cells.forEach(function (cell, cellIndex) {
|
|
156
|
+
var heading = colHeadings[cellIndex];
|
|
157
|
+
|
|
158
|
+
if (typeof heading != "undefined") {
|
|
159
|
+
var tempDiv = document.createElement("div");
|
|
160
|
+
tempDiv.innerHTML = heading.innerHTML;
|
|
161
|
+
var headingText = tempDiv.textContent || tempDiv.innerText || "";
|
|
162
|
+
cell.setAttribute('data-label', headingText);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
var isNumeric = function isNumeric(str) {
|
|
169
|
+
if (typeof str != "string") return false; // we only process strings!
|
|
170
|
+
|
|
171
|
+
return !isNaN(str) && // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)...
|
|
172
|
+
!isNaN(parseFloat(str)); // ...and ensure strings of whitespace fail
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
var zeroPad = function zeroPad(num, places) {
|
|
176
|
+
return String(num).padStart(places, '0');
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
function _arrayWithHoles(arr) {
|
|
180
|
+
if (Array.isArray(arr)) return arr;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function _iterableToArrayLimit(arr, i) {
|
|
184
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
185
|
+
|
|
186
|
+
if (_i == null) return;
|
|
187
|
+
var _arr = [];
|
|
188
|
+
var _n = true;
|
|
189
|
+
var _d = false;
|
|
190
|
+
|
|
191
|
+
var _s, _e;
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
195
|
+
_arr.push(_s.value);
|
|
196
|
+
|
|
197
|
+
if (i && _arr.length === i) break;
|
|
198
|
+
}
|
|
199
|
+
} catch (err) {
|
|
200
|
+
_d = true;
|
|
201
|
+
_e = err;
|
|
202
|
+
} finally {
|
|
203
|
+
try {
|
|
204
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
205
|
+
} finally {
|
|
206
|
+
if (_d) throw _e;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return _arr;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function _arrayLikeToArray(arr, len) {
|
|
214
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
215
|
+
|
|
216
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
217
|
+
arr2[i] = arr[i];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return arr2;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
224
|
+
if (!o) return;
|
|
225
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
226
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
227
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
228
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
229
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function _nonIterableRest() {
|
|
233
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function _slicedToArray(arr, i) {
|
|
237
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
var navbar = function navbar(element) {
|
|
241
|
+
Array.from(element.querySelectorAll('details')).forEach(function (detail, index) {
|
|
242
|
+
detail.addEventListener('mouseenter', function (e) {
|
|
243
|
+
if (window.matchMedia('(min-width: 62em)').matches) detail.setAttribute('open', 'true');
|
|
244
|
+
}, false);
|
|
245
|
+
detail.addEventListener('mouseleave', function (e) {
|
|
246
|
+
if (window.matchMedia('(min-width: 62em)').matches) detail.removeAttribute('open');
|
|
247
|
+
}, false);
|
|
248
|
+
});
|
|
249
|
+
var observer = new IntersectionObserver(function (_ref) {
|
|
250
|
+
var _ref2 = _slicedToArray(_ref, 1),
|
|
251
|
+
e = _ref2[0];
|
|
252
|
+
|
|
253
|
+
return e.target.classList.toggle("is-stuck", e.intersectionRatio < 1);
|
|
254
|
+
}, {
|
|
255
|
+
threshold: [1]
|
|
256
|
+
});
|
|
257
|
+
observer.observe(element);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
function _typeof(obj) {
|
|
261
|
+
"@babel/helpers - typeof";
|
|
262
|
+
|
|
263
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
264
|
+
_typeof = function _typeof(obj) {
|
|
265
|
+
return typeof obj;
|
|
266
|
+
};
|
|
267
|
+
} else {
|
|
268
|
+
_typeof = function _typeof(obj) {
|
|
269
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return _typeof(obj);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
var uncurryThis$3 = require('../internals/function-uncurry-this');
|
|
277
|
+
var PROPER_FUNCTION_NAME = require('../internals/function-name').PROPER;
|
|
278
|
+
var redefine = require('../internals/redefine');
|
|
279
|
+
var anObject$1 = require('../internals/an-object');
|
|
280
|
+
var isPrototypeOf = require('../internals/object-is-prototype-of');
|
|
281
|
+
var $toString = require('../internals/to-string');
|
|
282
|
+
var fails$4 = require('../internals/fails');
|
|
283
|
+
var regExpFlags = require('../internals/regexp-flags');
|
|
284
|
+
|
|
285
|
+
var TO_STRING = 'toString';
|
|
286
|
+
var RegExpPrototype = RegExp.prototype;
|
|
287
|
+
var n$ToString = RegExpPrototype[TO_STRING];
|
|
288
|
+
var getFlags = uncurryThis$3(regExpFlags);
|
|
289
|
+
|
|
290
|
+
var NOT_GENERIC = fails$4(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
|
|
291
|
+
// FF44- RegExp#toString has a wrong name
|
|
292
|
+
var INCORRECT_NAME = PROPER_FUNCTION_NAME && n$ToString.name != TO_STRING;
|
|
293
|
+
|
|
294
|
+
// `RegExp.prototype.toString` method
|
|
295
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
|
|
296
|
+
if (NOT_GENERIC || INCORRECT_NAME) {
|
|
297
|
+
redefine(RegExp.prototype, TO_STRING, function toString() {
|
|
298
|
+
var R = anObject$1(this);
|
|
299
|
+
var p = $toString(R.source);
|
|
300
|
+
var rf = R.flags;
|
|
301
|
+
var f = $toString(rf === undefined && isPrototypeOf(RegExpPrototype, R) && !('flags' in RegExpPrototype) ? getFlags(R) : rf);
|
|
302
|
+
return '/' + p + '/' + f;
|
|
303
|
+
}, { unsafe: true });
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
var $$5 = require('../internals/export');
|
|
307
|
+
var uncurryThis$2 = require('../internals/function-uncurry-this');
|
|
308
|
+
var aCallable = require('../internals/a-callable');
|
|
309
|
+
var toObject$2 = require('../internals/to-object');
|
|
310
|
+
var lengthOfArrayLike$1 = require('../internals/length-of-array-like');
|
|
311
|
+
var toString$1 = require('../internals/to-string');
|
|
312
|
+
var fails$3 = require('../internals/fails');
|
|
313
|
+
var internalSort = require('../internals/array-sort');
|
|
314
|
+
var arrayMethodIsStrict$1 = require('../internals/array-method-is-strict');
|
|
315
|
+
var FF = require('../internals/engine-ff-version');
|
|
316
|
+
var IE_OR_EDGE = require('../internals/engine-is-ie-or-edge');
|
|
317
|
+
var V8 = require('../internals/engine-v8-version');
|
|
318
|
+
var WEBKIT = require('../internals/engine-webkit-version');
|
|
319
|
+
|
|
320
|
+
var test = [];
|
|
321
|
+
var un$Sort = uncurryThis$2(test.sort);
|
|
322
|
+
var push$1 = uncurryThis$2(test.push);
|
|
323
|
+
|
|
324
|
+
// IE8-
|
|
325
|
+
var FAILS_ON_UNDEFINED = fails$3(function () {
|
|
326
|
+
test.sort(undefined);
|
|
327
|
+
});
|
|
328
|
+
// V8 bug
|
|
329
|
+
var FAILS_ON_NULL = fails$3(function () {
|
|
330
|
+
test.sort(null);
|
|
331
|
+
});
|
|
332
|
+
// Old WebKit
|
|
333
|
+
var STRICT_METHOD$1 = arrayMethodIsStrict$1('sort');
|
|
334
|
+
|
|
335
|
+
var STABLE_SORT = !fails$3(function () {
|
|
336
|
+
// feature detection can be too slow, so check engines versions
|
|
337
|
+
if (V8) return V8 < 70;
|
|
338
|
+
if (FF && FF > 3) return;
|
|
339
|
+
if (IE_OR_EDGE) return true;
|
|
340
|
+
if (WEBKIT) return WEBKIT < 603;
|
|
341
|
+
|
|
342
|
+
var result = '';
|
|
343
|
+
var code, chr, value, index;
|
|
344
|
+
|
|
345
|
+
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
|
|
346
|
+
for (code = 65; code < 76; code++) {
|
|
347
|
+
chr = String.fromCharCode(code);
|
|
348
|
+
|
|
349
|
+
switch (code) {
|
|
350
|
+
case 66: case 69: case 70: case 72: value = 3; break;
|
|
351
|
+
case 68: case 71: value = 4; break;
|
|
352
|
+
default: value = 2;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
for (index = 0; index < 47; index++) {
|
|
356
|
+
test.push({ k: chr + index, v: value });
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
test.sort(function (a, b) { return b.v - a.v; });
|
|
361
|
+
|
|
362
|
+
for (index = 0; index < test.length; index++) {
|
|
363
|
+
chr = test[index].k.charAt(0);
|
|
364
|
+
if (result.charAt(result.length - 1) !== chr) result += chr;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return result !== 'DGBEFHACIJK';
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$1 || !STABLE_SORT;
|
|
371
|
+
|
|
372
|
+
var getSortCompare = function (comparefn) {
|
|
373
|
+
return function (x, y) {
|
|
374
|
+
if (y === undefined) return -1;
|
|
375
|
+
if (x === undefined) return 1;
|
|
376
|
+
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
377
|
+
return toString$1(x) > toString$1(y) ? 1 : -1;
|
|
378
|
+
};
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
// `Array.prototype.sort` method
|
|
382
|
+
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
383
|
+
$$5({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
384
|
+
sort: function sort(comparefn) {
|
|
385
|
+
if (comparefn !== undefined) aCallable(comparefn);
|
|
386
|
+
|
|
387
|
+
var array = toObject$2(this);
|
|
388
|
+
|
|
389
|
+
if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
|
|
390
|
+
|
|
391
|
+
var items = [];
|
|
392
|
+
var arrayLength = lengthOfArrayLike$1(array);
|
|
393
|
+
var itemsLength, index;
|
|
394
|
+
|
|
395
|
+
for (index = 0; index < arrayLength; index++) {
|
|
396
|
+
if (index in array) push$1(items, array[index]);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
internalSort(items, getSortCompare(comparefn));
|
|
400
|
+
|
|
401
|
+
itemsLength = items.length;
|
|
402
|
+
index = 0;
|
|
403
|
+
|
|
404
|
+
while (index < itemsLength) array[index] = items[index++];
|
|
405
|
+
while (index < arrayLength) delete array[index++];
|
|
406
|
+
|
|
407
|
+
return array;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
var $$4 = require('../internals/export');
|
|
412
|
+
var global = require('../internals/global');
|
|
413
|
+
var fails$2 = require('../internals/fails');
|
|
414
|
+
var isArray = require('../internals/is-array');
|
|
415
|
+
var isObject = require('../internals/is-object');
|
|
416
|
+
var toObject$1 = require('../internals/to-object');
|
|
417
|
+
var lengthOfArrayLike = require('../internals/length-of-array-like');
|
|
418
|
+
var createProperty = require('../internals/create-property');
|
|
419
|
+
var arraySpeciesCreate = require('../internals/array-species-create');
|
|
420
|
+
var arrayMethodHasSpeciesSupport$1 = require('../internals/array-method-has-species-support');
|
|
421
|
+
var wellKnownSymbol$1 = require('../internals/well-known-symbol');
|
|
422
|
+
var V8_VERSION = require('../internals/engine-v8-version');
|
|
423
|
+
|
|
424
|
+
var IS_CONCAT_SPREADABLE = wellKnownSymbol$1('isConcatSpreadable');
|
|
425
|
+
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
|
426
|
+
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
|
427
|
+
var TypeError$1 = global.TypeError;
|
|
428
|
+
|
|
429
|
+
// We can't use this feature detection in V8 since it causes
|
|
430
|
+
// deoptimization and serious performance degradation
|
|
431
|
+
// https://github.com/zloirock/core-js/issues/679
|
|
432
|
+
var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails$2(function () {
|
|
433
|
+
var array = [];
|
|
434
|
+
array[IS_CONCAT_SPREADABLE] = false;
|
|
435
|
+
return array.concat()[0] !== array;
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$1('concat');
|
|
439
|
+
|
|
440
|
+
var isConcatSpreadable = function (O) {
|
|
441
|
+
if (!isObject(O)) return false;
|
|
442
|
+
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
443
|
+
return spreadable !== undefined ? !!spreadable : isArray(O);
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
447
|
+
|
|
448
|
+
// `Array.prototype.concat` method
|
|
449
|
+
// https://tc39.es/ecma262/#sec-array.prototype.concat
|
|
450
|
+
// with adding support of @@isConcatSpreadable and @@species
|
|
451
|
+
$$4({ target: 'Array', proto: true, forced: FORCED }, {
|
|
452
|
+
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
453
|
+
concat: function concat(arg) {
|
|
454
|
+
var O = toObject$1(this);
|
|
455
|
+
var A = arraySpeciesCreate(O, 0);
|
|
456
|
+
var n = 0;
|
|
457
|
+
var i, k, length, len, E;
|
|
458
|
+
for (i = -1, length = arguments.length; i < length; i++) {
|
|
459
|
+
E = i === -1 ? O : arguments[i];
|
|
460
|
+
if (isConcatSpreadable(E)) {
|
|
461
|
+
len = lengthOfArrayLike(E);
|
|
462
|
+
if (n + len > MAX_SAFE_INTEGER) throw TypeError$1(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
463
|
+
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
464
|
+
} else {
|
|
465
|
+
if (n >= MAX_SAFE_INTEGER) throw TypeError$1(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
466
|
+
createProperty(A, n++, E);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
A.length = n;
|
|
470
|
+
return A;
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
var $$3 = require('../internals/export');
|
|
475
|
+
var uncurryThis$1 = require('../internals/function-uncurry-this');
|
|
476
|
+
var IndexedObject = require('../internals/indexed-object');
|
|
477
|
+
var toIndexedObject = require('../internals/to-indexed-object');
|
|
478
|
+
var arrayMethodIsStrict = require('../internals/array-method-is-strict');
|
|
479
|
+
|
|
480
|
+
var un$Join = uncurryThis$1([].join);
|
|
481
|
+
|
|
482
|
+
var ES3_STRINGS = IndexedObject != Object;
|
|
483
|
+
var STRICT_METHOD = arrayMethodIsStrict('join', ',');
|
|
484
|
+
|
|
485
|
+
// `Array.prototype.join` method
|
|
486
|
+
// https://tc39.es/ecma262/#sec-array.prototype.join
|
|
487
|
+
$$3({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
|
|
488
|
+
join: function join(separator) {
|
|
489
|
+
return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
var $$2 = require('../internals/export');
|
|
494
|
+
var $map = require('../internals/array-iteration').map;
|
|
495
|
+
var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
|
|
496
|
+
|
|
497
|
+
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
|
|
498
|
+
|
|
499
|
+
// `Array.prototype.map` method
|
|
500
|
+
// https://tc39.es/ecma262/#sec-array.prototype.map
|
|
501
|
+
// with adding support of @@species
|
|
502
|
+
$$2({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
|
|
503
|
+
map: function map(callbackfn /* , thisArg */) {
|
|
504
|
+
return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
var $$1 = require('../internals/export');
|
|
509
|
+
var toObject = require('../internals/to-object');
|
|
510
|
+
var nativeKeys = require('../internals/object-keys');
|
|
511
|
+
var fails$1 = require('../internals/fails');
|
|
512
|
+
|
|
513
|
+
var FAILS_ON_PRIMITIVES = fails$1(function () { nativeKeys(1); });
|
|
514
|
+
|
|
515
|
+
// `Object.keys` method
|
|
516
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
517
|
+
$$1({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
|
518
|
+
keys: function keys(it) {
|
|
519
|
+
return nativeKeys(toObject(it));
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
var $ = require('../internals/export');
|
|
524
|
+
var exec = require('../internals/regexp-exec');
|
|
525
|
+
|
|
526
|
+
// `RegExp.prototype.exec` method
|
|
527
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.exec
|
|
528
|
+
$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
|
|
529
|
+
exec: exec
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
var apply = require('../internals/function-apply');
|
|
533
|
+
var call = require('../internals/function-call');
|
|
534
|
+
var uncurryThis = require('../internals/function-uncurry-this');
|
|
535
|
+
var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
|
|
536
|
+
var fails = require('../internals/fails');
|
|
537
|
+
var anObject = require('../internals/an-object');
|
|
538
|
+
var isCallable = require('../internals/is-callable');
|
|
539
|
+
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
|
|
540
|
+
var toLength = require('../internals/to-length');
|
|
541
|
+
var toString = require('../internals/to-string');
|
|
542
|
+
var requireObjectCoercible = require('../internals/require-object-coercible');
|
|
543
|
+
var advanceStringIndex = require('../internals/advance-string-index');
|
|
544
|
+
var getMethod = require('../internals/get-method');
|
|
545
|
+
var getSubstitution = require('../internals/get-substitution');
|
|
546
|
+
var regExpExec = require('../internals/regexp-exec-abstract');
|
|
547
|
+
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
548
|
+
|
|
549
|
+
var REPLACE = wellKnownSymbol('replace');
|
|
550
|
+
var max = Math.max;
|
|
551
|
+
var min = Math.min;
|
|
552
|
+
var concat = uncurryThis([].concat);
|
|
553
|
+
var push = uncurryThis([].push);
|
|
554
|
+
var stringIndexOf = uncurryThis(''.indexOf);
|
|
555
|
+
var stringSlice = uncurryThis(''.slice);
|
|
556
|
+
|
|
557
|
+
var maybeToString = function (it) {
|
|
558
|
+
return it === undefined ? it : String(it);
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
// IE <= 11 replaces $0 with the whole match, as if it was $&
|
|
562
|
+
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
|
|
563
|
+
var REPLACE_KEEPS_$0 = (function () {
|
|
564
|
+
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
|
|
565
|
+
return 'a'.replace(/./, '$0') === '$0';
|
|
566
|
+
})();
|
|
567
|
+
|
|
568
|
+
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
569
|
+
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
570
|
+
if (/./[REPLACE]) {
|
|
571
|
+
return /./[REPLACE]('a', '$0') === '';
|
|
572
|
+
}
|
|
573
|
+
return false;
|
|
574
|
+
})();
|
|
575
|
+
|
|
576
|
+
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
|
|
577
|
+
var re = /./;
|
|
578
|
+
re.exec = function () {
|
|
579
|
+
var result = [];
|
|
580
|
+
result.groups = { a: '7' };
|
|
581
|
+
return result;
|
|
582
|
+
};
|
|
583
|
+
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
|
|
584
|
+
return ''.replace(re, '$<a>') !== '7';
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
// @@replace logic
|
|
588
|
+
fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
|
|
589
|
+
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
|
|
590
|
+
|
|
591
|
+
return [
|
|
592
|
+
// `String.prototype.replace` method
|
|
593
|
+
// https://tc39.es/ecma262/#sec-string.prototype.replace
|
|
594
|
+
function replace(searchValue, replaceValue) {
|
|
595
|
+
var O = requireObjectCoercible(this);
|
|
596
|
+
var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
|
|
597
|
+
return replacer
|
|
598
|
+
? call(replacer, searchValue, O, replaceValue)
|
|
599
|
+
: call(nativeReplace, toString(O), searchValue, replaceValue);
|
|
600
|
+
},
|
|
601
|
+
// `RegExp.prototype[@@replace]` method
|
|
602
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
|
|
603
|
+
function (string, replaceValue) {
|
|
604
|
+
var rx = anObject(this);
|
|
605
|
+
var S = toString(string);
|
|
606
|
+
|
|
607
|
+
if (
|
|
608
|
+
typeof replaceValue == 'string' &&
|
|
609
|
+
stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
|
|
610
|
+
stringIndexOf(replaceValue, '$<') === -1
|
|
611
|
+
) {
|
|
612
|
+
var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
|
|
613
|
+
if (res.done) return res.value;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
var functionalReplace = isCallable(replaceValue);
|
|
617
|
+
if (!functionalReplace) replaceValue = toString(replaceValue);
|
|
618
|
+
|
|
619
|
+
var global = rx.global;
|
|
620
|
+
if (global) {
|
|
621
|
+
var fullUnicode = rx.unicode;
|
|
622
|
+
rx.lastIndex = 0;
|
|
623
|
+
}
|
|
624
|
+
var results = [];
|
|
625
|
+
while (true) {
|
|
626
|
+
var result = regExpExec(rx, S);
|
|
627
|
+
if (result === null) break;
|
|
628
|
+
|
|
629
|
+
push(results, result);
|
|
630
|
+
if (!global) break;
|
|
631
|
+
|
|
632
|
+
var matchStr = toString(result[0]);
|
|
633
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
var accumulatedResult = '';
|
|
637
|
+
var nextSourcePosition = 0;
|
|
638
|
+
for (var i = 0; i < results.length; i++) {
|
|
639
|
+
result = results[i];
|
|
640
|
+
|
|
641
|
+
var matched = toString(result[0]);
|
|
642
|
+
var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
|
|
643
|
+
var captures = [];
|
|
644
|
+
// NOTE: This is equivalent to
|
|
645
|
+
// captures = result.slice(1).map(maybeToString)
|
|
646
|
+
// but for some reason `nativeSlice.call(result, 1, result.length)` (called in
|
|
647
|
+
// the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
|
|
648
|
+
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
|
|
649
|
+
for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
|
|
650
|
+
var namedCaptures = result.groups;
|
|
651
|
+
if (functionalReplace) {
|
|
652
|
+
var replacerArgs = concat([matched], captures, position, S);
|
|
653
|
+
if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
|
|
654
|
+
var replacement = toString(apply(replaceValue, undefined, replacerArgs));
|
|
655
|
+
} else {
|
|
656
|
+
replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
|
|
657
|
+
}
|
|
658
|
+
if (position >= nextSourcePosition) {
|
|
659
|
+
accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
|
|
660
|
+
nextSourcePosition = position + matched.length;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
return accumulatedResult + stringSlice(S, nextSourcePosition);
|
|
664
|
+
}
|
|
665
|
+
];
|
|
666
|
+
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
667
|
+
|
|
668
|
+
function table(tableElement) {
|
|
669
|
+
if (_typeof(tableElement) != "object") return false;
|
|
670
|
+
var thead = tableElement.querySelector('thead');
|
|
671
|
+
var tbody = tableElement.querySelector('tbody');
|
|
672
|
+
var storedData = tbody.cloneNode(true);
|
|
673
|
+
var sortedEvent = new Event('sorted');
|
|
674
|
+
var filteredEvent = new Event('filtered');
|
|
675
|
+
var randID = 'tabe_' + Math.random().toString(36).substr(2, 9); // Random to make sure IDs created are unique
|
|
676
|
+
|
|
677
|
+
var draggedRow;
|
|
678
|
+
tableElement.setAttribute('id', randID); // #region Sortable
|
|
679
|
+
|
|
680
|
+
var sortTable = function sortTable(sortBy, sort) {
|
|
681
|
+
// Create an array from the table rows, the index created is then used to sort the array
|
|
682
|
+
var tableArr = [];
|
|
683
|
+
Array.from(tbody.querySelectorAll('tr')).forEach(function (tableRow, index) {
|
|
684
|
+
var rowIndex = tableRow.querySelector('td[data-label="' + sortBy + '"], th[data-label="' + sortBy + '"]').textContent;
|
|
685
|
+
if (isNumeric(rowIndex)) rowIndex = zeroPad(rowIndex, 10);
|
|
686
|
+
var dataRow = {
|
|
687
|
+
index: rowIndex,
|
|
688
|
+
row: tableRow
|
|
689
|
+
};
|
|
690
|
+
tableArr.push(dataRow);
|
|
691
|
+
}); // Sort array
|
|
692
|
+
|
|
693
|
+
tableArr.sort(function (a, b) {
|
|
694
|
+
return a.index > b.index ? 1 : -1;
|
|
695
|
+
}); // Reverse if descending
|
|
696
|
+
|
|
697
|
+
if (sort == "descending") tableArr = tableArr.reverse(); // Create a string to return and populate the tbody
|
|
698
|
+
|
|
699
|
+
var strTbody = '';
|
|
700
|
+
tableArr.forEach(function (tableRow, index) {
|
|
701
|
+
strTbody += tableRow.row.outerHTML;
|
|
702
|
+
});
|
|
703
|
+
tbody.innerHTML = strTbody; // Dispatch the sortable event
|
|
704
|
+
|
|
705
|
+
tableElement.dispatchEvent(sortedEvent);
|
|
706
|
+
}; // Declare event handlers
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
tableElement.addEventListener('click', function (e) {
|
|
710
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
711
|
+
if (target.matches('[data-sortable]')) {
|
|
712
|
+
// Get current sort order
|
|
713
|
+
var sort = target.getAttribute('aria-sort') == "ascending" ? "descending" : "ascending"; // unset sort attributes
|
|
714
|
+
|
|
715
|
+
Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach(function (col, index) {
|
|
716
|
+
col.setAttribute('aria-sort', 'none');
|
|
717
|
+
}); // Set the sort order attribute
|
|
718
|
+
|
|
719
|
+
target.setAttribute('aria-sort', sort); // Save the sort options on the table element so that it can be re-sorted later
|
|
720
|
+
|
|
721
|
+
tableElement.setAttribute('data-sort', sort);
|
|
722
|
+
tableElement.setAttribute('data-sortBy', target.textContent); // Sort the table
|
|
723
|
+
|
|
724
|
+
sortTable(target.textContent, sort);
|
|
725
|
+
Array.from(tableElement.querySelectorAll('tr[draggable]')).forEach(function (tableRow, index) {
|
|
726
|
+
tableRow.removeAttribute('draggable');
|
|
727
|
+
});
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}, false); // On page load check if the table should be pre-sorted, if so trigger a click
|
|
732
|
+
|
|
733
|
+
if (tableElement.getAttribute('data-sortBy')) {
|
|
734
|
+
var sort = tableElement.getAttribute('data-sort') == "ascending" ? "descending" : "ascending";
|
|
735
|
+
Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach(function (col, index) {
|
|
736
|
+
if (col.textContent == tableElement.getAttribute('data-sortBy')) {
|
|
737
|
+
col.setAttribute('aria-sort', sort);
|
|
738
|
+
col.click();
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
} // #endregion Sortable
|
|
742
|
+
// #region Filters
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
var createFilterForm = function createFilterForm(count) {
|
|
746
|
+
// Create wrapper div
|
|
747
|
+
var form = document.createElement("div");
|
|
748
|
+
form.classList.add('table__filters');
|
|
749
|
+
form.classList.add('row');
|
|
750
|
+
form.classList.add('pt-1');
|
|
751
|
+
form.classList.add('pb-3'); // Create the filter options array
|
|
752
|
+
|
|
753
|
+
var filterColumns = Array.from(tableElement.querySelectorAll('th[data-filterable]')); // Populate a list of searchable terms from the cells of the columns that could be used as a filter
|
|
754
|
+
|
|
755
|
+
var searchableTerms = {};
|
|
756
|
+
filterColumns.forEach(function (columnHeading, index) {
|
|
757
|
+
Array.from(tableElement.querySelectorAll('td[data-label="' + columnHeading.textContent + '"]')).forEach(function (label, index) {
|
|
758
|
+
searchableTerms[label.textContent] = label.textContent;
|
|
759
|
+
});
|
|
760
|
+
}); // Create the form
|
|
761
|
+
|
|
762
|
+
var filterTitle = filterColumns.length == 1 ? "Filter by " + filterColumns[0].textContent : "Filter"; // Update title if only one filter is chosen
|
|
763
|
+
|
|
764
|
+
var checkboxClass = filterColumns.length == 1 ? "d-none" : "d-sm-flex"; // Hide controls when only one filter is chosen
|
|
765
|
+
|
|
766
|
+
form.innerHTML = "<div class=\"col-sm-6 col-md-4 pb-3\">\n <div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_filter\" class=\"form-label\">").concat(filterTitle, ":</label>\n <input type=\"search\" name=\"").concat(randID, "_filter\" id=\"").concat(randID, "_filter\" class=\"form-control form-control-sm\" placeholder=\"\" list=\"").concat(randID, "_list\" />\n </div>\n <datalist id=\"").concat(randID, "_list\">\n ").concat(Object.keys(searchableTerms).map(function (term) {
|
|
767
|
+
return "<option value=\"".concat(term, "\"></option>");
|
|
768
|
+
}).join(""), "\n </datalist>\n</div>\n<div class=\"col-md-8 align-items-center pb-3 ").concat(checkboxClass, "\">\n ").concat("<span class=\"pe-3 text-nowrap h5 mb-0\">Filter by: </span>" + filterColumns.map(function (column) {
|
|
769
|
+
return "<div class=\"form-check pe-3 mt-0 mb-0\"><input class=\"form-check-input\" type=\"checkbox\" id=\"".concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\" checked=\"checked\" /><label class=\"form-check-label text-nowrap\" for=\"").concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\">").concat(column.textContent, "</label></div>");
|
|
770
|
+
}).join(""), "\n</div>"); // Add before the actual table
|
|
771
|
+
|
|
772
|
+
tableElement.prepend(form);
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
var filterTable = function filterTable(searchTerm) {
|
|
776
|
+
// Create an array of rows that match the search term
|
|
777
|
+
var tableArr = [];
|
|
778
|
+
Array.from(storedData.querySelectorAll('tr')).forEach(function (tableRow, index) {
|
|
779
|
+
// We want one long search string per row including each filterable table cell
|
|
780
|
+
var rowSearchString = '';
|
|
781
|
+
Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach(function (label, index) {
|
|
782
|
+
rowSearchString += tableRow.querySelector('td[data-label="' + label.textContent + '"]').textContent + ' | ';
|
|
783
|
+
}); // Check if the table row search string contains the search term
|
|
784
|
+
|
|
785
|
+
if (rowSearchString.indexOf(searchTerm) >= 0) {
|
|
786
|
+
var dataRow = {
|
|
787
|
+
row: tableRow
|
|
788
|
+
};
|
|
789
|
+
tableArr.push(dataRow);
|
|
790
|
+
}
|
|
791
|
+
}); // Create a string to return and populate the tbody
|
|
792
|
+
|
|
793
|
+
var strTbody = '';
|
|
794
|
+
tableArr.forEach(function (tableRow, index) {
|
|
795
|
+
strTbody += tableRow.row.outerHTML;
|
|
796
|
+
});
|
|
797
|
+
tbody.innerHTML = strTbody; // Dispatch the filter event.
|
|
798
|
+
|
|
799
|
+
tableElement.dispatchEvent(filteredEvent);
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
var createFilterList = function createFilterList() {
|
|
803
|
+
// Check which options are checked
|
|
804
|
+
var filterOptions = [];
|
|
805
|
+
Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach(function (label, index) {
|
|
806
|
+
filterOptions.push(label.textContent);
|
|
807
|
+
}); // Build up the list of searchable terms
|
|
808
|
+
|
|
809
|
+
var searchableTerms = [];
|
|
810
|
+
filterOptions.forEach(function (option, index) {
|
|
811
|
+
Array.from(tableElement.querySelectorAll('td[data-label="' + option + '"]')).forEach(function (label, index) {
|
|
812
|
+
searchableTerms[label.textContent] = label.textContent;
|
|
813
|
+
});
|
|
814
|
+
}); // Rebuild the list
|
|
815
|
+
|
|
816
|
+
var dataList = tableElement.querySelector('datalist');
|
|
817
|
+
dataList.innerHTML = Object.keys(searchableTerms).map(function (term) {
|
|
818
|
+
return "<option value=\"".concat(term, "\"></option>");
|
|
819
|
+
}).join("");
|
|
820
|
+
}; // On page load check if filters are needed
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
if (Array.from(tableElement.querySelectorAll('[data-filterable]')).length) {
|
|
824
|
+
// Create the filter options
|
|
825
|
+
createFilterForm(tableElement, Array.from(tableElement.querySelectorAll('[data-filterable]')).length); // Add event handlers for the filter options
|
|
826
|
+
|
|
827
|
+
tableElement.addEventListener('keyup', function (e) {
|
|
828
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
829
|
+
if (target.matches('input[type="search"]')) {
|
|
830
|
+
var searchTerm = target.value;
|
|
831
|
+
filterTable(searchTerm);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
tableElement.addEventListener('change', function (e) {
|
|
836
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
837
|
+
if (target.matches('input[type="search"]')) {
|
|
838
|
+
var searchTerm = target.value;
|
|
839
|
+
filterTable(searchTerm);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
tableElement.addEventListener('change', function (e) {
|
|
844
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
845
|
+
if (target.matches('input[type="checkbox"]')) {
|
|
846
|
+
var searchTerm = tableElement.querySelector('input[type="search"]').value;
|
|
847
|
+
filterTable(searchTerm);
|
|
848
|
+
createFilterList();
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
} // #endregion Filters
|
|
853
|
+
// #region Pagination
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
var paginateRows = function paginateRows(show, page) {
|
|
857
|
+
// Create some inline CSS to control what is viewed on the table, unline the filters we are just hiding the rable rows not removing them from the DOM.
|
|
858
|
+
var style = document.getElementById(randID + '_style');
|
|
859
|
+
|
|
860
|
+
if (style == null) {
|
|
861
|
+
style = document.createElement("style");
|
|
862
|
+
style.setAttribute('id', randID + '_style');
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
var startShowing = show * (page - 1) + 1;
|
|
866
|
+
var stopShowing = show * page;
|
|
867
|
+
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: table-row;\n }\n #").concat(randID, " tbody tr:nth-child(").concat(stopShowing, ") ~ tr{\n display: none;\n }\n ");
|
|
868
|
+
tableElement.append(style);
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
var createPaginationForm = function createPaginationForm(show, page, totalRows) {
|
|
872
|
+
var form = document.createElement("div");
|
|
873
|
+
form.classList.add('table__pagination');
|
|
874
|
+
form.classList.add('row');
|
|
875
|
+
form.classList.add('pt-3');
|
|
876
|
+
form.classList.add('pb-3'); // Create the form and create a container div to hold the pagination buttons
|
|
877
|
+
|
|
878
|
+
form.innerHTML = "<div class=\"col-6 col-sm-3 col-md-2 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\" 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-6 col-sm-2 col-md-2 d-flex align-items-center mb-3\"><span class=\"label\">per page</span></div>\n<div class=\"col-sm-7 col-md-8 d-sm-flex justify-content-end align-items-center mb-3\" id=\"").concat(randID, "_paginationBtns\"></div>"); // Add after the actual table
|
|
879
|
+
|
|
880
|
+
tableElement.append(form);
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
var createPaginationButttons = function createPaginationButttons(show, page, totalRows) {
|
|
884
|
+
var paginationButtonsWrapper = document.getElementById(randID + '_paginationBtns');
|
|
885
|
+
if (paginationButtonsWrapper == null) return false;
|
|
886
|
+
var numberPages = Math.ceil(totalRows / show);
|
|
887
|
+
|
|
888
|
+
if (numberPages == 1) {
|
|
889
|
+
// Remore the buttons or dont display any if we dont need them
|
|
890
|
+
paginationButtonsWrapper.innerHTML = '';
|
|
891
|
+
} else if (numberPages < 5) {
|
|
892
|
+
// If less than 5 pages (which fits comfortably on mobile) we display buttons
|
|
893
|
+
var strButtons = '';
|
|
894
|
+
|
|
895
|
+
for (var i = 1; i <= numberPages; i++) {
|
|
896
|
+
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>");
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
paginationButtonsWrapper.innerHTML = "<span class=\"pe-2\">Page: </span><ul class=\"pagination mb-0\">\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>");
|
|
900
|
+
} else {
|
|
901
|
+
// If more than 5 lets show a select field instead so that we dont have loads and loads of buttons
|
|
902
|
+
var strOptions = '';
|
|
903
|
+
|
|
904
|
+
for (var _i = 1; _i <= numberPages; _i++) {
|
|
905
|
+
if (_i == page) strOptions += "<option value=\"".concat(_i, "\" selected>Page ").concat(_i, "</option>");else strOptions += "<option value=\"".concat(_i, "\">Page ").concat(_i, "</option>");
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
paginationButtonsWrapper.innerHTML = "\n<select class=\"form-select mb-3\">\n ".concat(strOptions, "\n</select>\n ");
|
|
909
|
+
}
|
|
910
|
+
}; // On page load check if the table should be paginated
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
if (tableElement.getAttribute('data-show')) {
|
|
914
|
+
var show = parseInt(tableElement.getAttribute('data-show'));
|
|
915
|
+
var page = parseInt(tableElement.getAttribute('data-page')) ? parseInt(tableElement.getAttribute('data-page')) : 1;
|
|
916
|
+
var totalRows = tableElement.querySelectorAll('tbody tr').length;
|
|
917
|
+
|
|
918
|
+
if (show < totalRows) {
|
|
919
|
+
paginateRows(show, page);
|
|
920
|
+
createPaginationForm(show, page, totalRows);
|
|
921
|
+
createPaginationButttons(show, page, totalRows);
|
|
922
|
+
tableElement.addEventListener('change', function (e) {
|
|
923
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
924
|
+
if (target.matches('.table__pagination input[type="number"]')) {
|
|
925
|
+
paginateRows(target.value, page);
|
|
926
|
+
createPaginationButttons(target.value, page, totalRows);
|
|
927
|
+
tableElement.setAttribute('data-show', target.value);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
tableElement.addEventListener('click', function (e) {
|
|
932
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
933
|
+
if (target.matches('.page-item:not(.active):not(.disabled) .page-link')) {
|
|
934
|
+
paginateRows(tableElement.getAttribute('data-show'), target.getAttribute('data-page'));
|
|
935
|
+
createPaginationButttons(tableElement.getAttribute('data-show'), target.getAttribute('data-page'), totalRows);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}, false);
|
|
939
|
+
tableElement.addEventListener('change', function (e) {
|
|
940
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
941
|
+
if (target.matches('.table__pagination select')) {
|
|
942
|
+
paginateRows(tableElement.getAttribute('data-show'), target.value);
|
|
943
|
+
createPaginationButttons(tableElement.getAttribute('data-show'), target.value, totalRows);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
} // #endregion Pagination
|
|
949
|
+
// #region Reorderable
|
|
950
|
+
// Set the row thats being dragged and copy the row
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
function setDraggedRow(e) {
|
|
954
|
+
e.dataTransfer.setData("text/plain", e.target.id);
|
|
955
|
+
draggedRow = e.target;
|
|
956
|
+
e.target.classList.add('tr--dragging');
|
|
957
|
+
} // Create the order column and event handler for rows
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
var setReorderRows = function setReorderRows() {
|
|
961
|
+
Array.from(tbody.querySelectorAll('tr')).forEach(function (tableRow, index) {
|
|
962
|
+
// Create column if not already created
|
|
963
|
+
if (tableRow.querySelector('[data-label="Order"]') == null) {
|
|
964
|
+
var orderColumn = document.createElement('th');
|
|
965
|
+
orderColumn.innerHTML = index + 1;
|
|
966
|
+
orderColumn.setAttribute('data-label', 'Order');
|
|
967
|
+
tableRow.prepend(orderColumn);
|
|
968
|
+
} // Make draggable
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
tableRow.setAttribute('id', randID + '_row_' + (index + 1));
|
|
972
|
+
tableRow.setAttribute('data-order', index + 1);
|
|
973
|
+
tableRow.setAttribute('draggable', 'true');
|
|
974
|
+
tableRow.addEventListener("dragstart", setDraggedRow);
|
|
975
|
+
});
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
if (tableElement.getAttribute('data-reorder')) {
|
|
979
|
+
// Add column heading
|
|
980
|
+
var orderHeading = document.createElement('th');
|
|
981
|
+
orderHeading.innerHTML = 'Order';
|
|
982
|
+
orderHeading.classList.add('table-order-reset');
|
|
983
|
+
thead.querySelector('tr').prepend(orderHeading);
|
|
984
|
+
setReorderRows(); // Reset order button
|
|
985
|
+
|
|
986
|
+
tableElement.addEventListener('click', function (e) {
|
|
987
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
988
|
+
if (target.matches('.table-order-reset')) {
|
|
989
|
+
// unset sort attributes
|
|
990
|
+
Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach(function (col, index) {
|
|
991
|
+
col.setAttribute('aria-sort', 'none');
|
|
992
|
+
}); // Save the sort options on the table element so that it can be re-sorted later
|
|
993
|
+
|
|
994
|
+
tableElement.removeAttribute('data-sort');
|
|
995
|
+
tableElement.removeAttribute('data-sortBy'); // Sort the table
|
|
996
|
+
|
|
997
|
+
sortTable('Order', 'ascending');
|
|
998
|
+
Array.from(tableElement.querySelectorAll('tbody tr')).forEach(function (tableRow, index) {
|
|
999
|
+
tableRow.setAttribute('draggable', 'true');
|
|
1000
|
+
});
|
|
1001
|
+
break;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}, false);
|
|
1005
|
+
document.addEventListener("dragover", function (e) {
|
|
1006
|
+
// prevent default to allow drop
|
|
1007
|
+
e.preventDefault();
|
|
1008
|
+
}, false);
|
|
1009
|
+
document.addEventListener("dragenter", function (e) {
|
|
1010
|
+
// prevent default to allow drop
|
|
1011
|
+
e.preventDefault();
|
|
1012
|
+
e.dataTransfer.dropEffect = "move";
|
|
1013
|
+
|
|
1014
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
1015
|
+
if (target.matches('[data-reorder] tbody tr')) {
|
|
1016
|
+
target.classList.add('tr--dropable');
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}, false);
|
|
1020
|
+
document.addEventListener("dragleave", function (e) {
|
|
1021
|
+
// prevent default to allow drop
|
|
1022
|
+
e.preventDefault();
|
|
1023
|
+
|
|
1024
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
1025
|
+
if (target.matches('[data-reorder] tbody tr')) {
|
|
1026
|
+
target.classList.remove('tr--dropable');
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}, false);
|
|
1030
|
+
document.addEventListener("drop", function (e) {
|
|
1031
|
+
e.preventDefault();
|
|
1032
|
+
|
|
1033
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
1034
|
+
if (target.matches('[data-reorder] tbody tr')) {
|
|
1035
|
+
if (target.parentNode != null && draggedRow.parentNode != null && target != draggedRow) {
|
|
1036
|
+
draggedRow.parentNode.removeChild(draggedRow);
|
|
1037
|
+
if (draggedRow.getAttribute('data-order') > target.getAttribute('data-order')) target.parentNode.insertBefore(draggedRow, target);else target.parentNode.insertBefore(draggedRow, target.nextElementSibling); // Re label the rows
|
|
1038
|
+
|
|
1039
|
+
Array.from(tbody.querySelectorAll('tr')).forEach(function (tableRowOrder, index) {
|
|
1040
|
+
tableRowOrder.classList.remove('tr--dragging');
|
|
1041
|
+
tableRowOrder.classList.remove('tr--dropable');
|
|
1042
|
+
tableRowOrder.querySelector('th').innerHTML = index + 1;
|
|
1043
|
+
tableRowOrder.setAttribute('data-order', index + 1);
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
break;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
}, false);
|
|
1051
|
+
} // #endregion Reorderable
|
|
1052
|
+
// Watch for the filterable event and re-sort the tbody
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
tableElement.addEventListener('filtered', function (e) {
|
|
1056
|
+
if (tableElement.getAttribute('data-sortBy') && tableElement.getAttribute('data-sort')) sortTable(tableElement.getAttribute('data-sortBy'), tableElement.getAttribute('data-sort'));
|
|
1057
|
+
|
|
1058
|
+
if (tableElement.getAttribute('data-show')) {
|
|
1059
|
+
var _show = parseInt(tableElement.getAttribute('data-show'));
|
|
1060
|
+
|
|
1061
|
+
var _totalRows = tableElement.querySelectorAll('tbody tr').length;
|
|
1062
|
+
var tablePagination = tableElement.querySelector('.table__pagination');
|
|
1063
|
+
if (tablePagination != null) tablePagination.remove();
|
|
1064
|
+
|
|
1065
|
+
if (_show < _totalRows) {
|
|
1066
|
+
paginateRows(_show, 1);
|
|
1067
|
+
createPaginationForm(_show, 1, _totalRows);
|
|
1068
|
+
createPaginationButttons(_show, 1, _totalRows);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
if (tableElement.getAttribute('data-reorder')) {
|
|
1073
|
+
setReorderRows();
|
|
1074
|
+
}
|
|
1075
|
+
}, false);
|
|
1076
|
+
tableElement.addEventListener('sorted', function (e) {
|
|
1077
|
+
if (tableElement.getAttribute('data-reorder')) {
|
|
1078
|
+
setReorderRows();
|
|
1079
|
+
}
|
|
1080
|
+
}, false);
|
|
1081
|
+
tableElement.addEventListener('populated', function (e) {
|
|
1082
|
+
var tableFilter = tableElement.querySelector('.table__filters');
|
|
1083
|
+
tableFilter.remove();
|
|
1084
|
+
var tablePagination = tableElement.querySelector('.table__pagination');
|
|
1085
|
+
tablePagination.remove();
|
|
1086
|
+
var newTable = tableElement.cloneNode(true);
|
|
1087
|
+
tableElement.parentNode.replaceChild(newTable, tableElement);
|
|
1088
|
+
table(newTable);
|
|
1089
|
+
}, false);
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
function accordion(accordionElement) {
|
|
1093
|
+
// Fetch all the details element.
|
|
1094
|
+
if (!accordionElement.classList.contains('accordion--keep-open')) {
|
|
1095
|
+
var details = accordionElement.querySelectorAll(":scope > details"); // Add the onclick listeners.
|
|
1096
|
+
|
|
1097
|
+
details.forEach(function (targetDetail) {
|
|
1098
|
+
targetDetail.addEventListener("click", function () {
|
|
1099
|
+
// Close all the details that are not targetDetail.
|
|
1100
|
+
details.forEach(function (detail) {
|
|
1101
|
+
if (detail !== targetDetail) {
|
|
1102
|
+
detail.removeAttribute("open");
|
|
1103
|
+
}
|
|
1104
|
+
});
|
|
1105
|
+
});
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
if (window.location.hash && document.querySelector(window.location.hash + ':not([open]) summary')) {
|
|
1110
|
+
var detail = document.querySelector(window.location.hash + ' summary');
|
|
1111
|
+
detail.click();
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
window.addEventListener('hashchange', function () {
|
|
1115
|
+
if (window.location.hash && document.querySelector(window.location.hash + ' summary')) {
|
|
1116
|
+
var _detail = document.querySelector(window.location.hash + ' summary');
|
|
1117
|
+
|
|
1118
|
+
_detail.click();
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
function testimonial(testimonialElement) {
|
|
1124
|
+
var scrollTimeout;
|
|
1125
|
+
var imagesCarousel = testimonialElement.querySelector('.testimonial__images');
|
|
1126
|
+
var itemCount = imagesCarousel.querySelectorAll('img').length; // If we only have 1 item lets not bother doing anything else
|
|
1127
|
+
|
|
1128
|
+
if (itemCount == 1) {
|
|
1129
|
+
return false;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
testimonialElement.classList.add('testimonial--multi'); // Set where the buttons go to
|
|
1133
|
+
|
|
1134
|
+
var setButtons = function setButtons(scrollTo) {
|
|
1135
|
+
var nextButton = testimonialElement.querySelector('.btn-next');
|
|
1136
|
+
var prevButton = testimonialElement.querySelector('.btn-prev');
|
|
1137
|
+
nextButton.setAttribute('data-go', scrollTo + 1);
|
|
1138
|
+
prevButton.setAttribute('data-go', scrollTo - 1);
|
|
1139
|
+
nextButton.removeAttribute('disabled');
|
|
1140
|
+
prevButton.removeAttribute('disabled');
|
|
1141
|
+
if (scrollTo == 1) prevButton.setAttribute('disabled', true);else if (scrollTo == itemCount) nextButton.setAttribute('disabled', true);
|
|
1142
|
+
}; // On scroll we need to make sure the buttons get corrected and the next testimonial is shown
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
imagesCarousel.addEventListener('scroll', function (e) {
|
|
1146
|
+
clearTimeout(scrollTimeout);
|
|
1147
|
+
scrollTimeout = setTimeout(function () {
|
|
1148
|
+
var scrollWidth = imagesCarousel.scrollWidth;
|
|
1149
|
+
var scrollHeight = imagesCarousel.scrollHeight;
|
|
1150
|
+
var scrollLeft = imagesCarousel.scrollLeft;
|
|
1151
|
+
var scrollDown = imagesCarousel.scrollTop;
|
|
1152
|
+
var scrollTo = Math.round(scrollLeft / scrollWidth * itemCount) + 1; // Change in scroll direction
|
|
1153
|
+
|
|
1154
|
+
if (scrollLeft == 0 && scrollDown != 0) scrollTo = Math.round(scrollDown / scrollHeight * itemCount) + 1;
|
|
1155
|
+
testimonialElement.setAttribute('data-show', scrollTo);
|
|
1156
|
+
setButtons(scrollTo);
|
|
1157
|
+
}, 300);
|
|
1158
|
+
}, false); // when the buttons are used we need to make sure the carousel scrolls to the correct place
|
|
1159
|
+
|
|
1160
|
+
testimonialElement.addEventListener('click', function (e) {
|
|
1161
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
1162
|
+
if (target.matches('[data-go]')) {
|
|
1163
|
+
var scrollTo = parseInt(target.getAttribute('data-go'));
|
|
1164
|
+
var scrollDown = 0;
|
|
1165
|
+
var scrollLeft = 0;
|
|
1166
|
+
var scrollWidth = imagesCarousel.scrollWidth;
|
|
1167
|
+
var scrollHeight = imagesCarousel.scrollHeight;
|
|
1168
|
+
if (scrollWidth > scrollHeight) scrollLeft = Math.floor(scrollWidth * ((scrollTo - 1) / itemCount));else scrollDown = Math.floor(scrollHeight * ((scrollTo - 1) / itemCount)); // Trigger the scroll
|
|
1169
|
+
|
|
1170
|
+
imagesCarousel.scroll({
|
|
1171
|
+
top: scrollDown,
|
|
1172
|
+
left: scrollLeft,
|
|
1173
|
+
behavior: 'smooth'
|
|
1174
|
+
});
|
|
1175
|
+
break;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}, false);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
function carousel(carouselElement) {
|
|
1182
|
+
var scrollTimeout;
|
|
1183
|
+
var carouselInner = carouselElement.querySelector('.carousel__inner');
|
|
1184
|
+
var itemCount = carouselElement.querySelectorAll('.carousel__item').length;
|
|
1185
|
+
carouselElement.getAttribute('data-cols');
|
|
1186
|
+
var smCols = carouselElement.getAttribute('data-sm-cols');
|
|
1187
|
+
var mdCols = carouselElement.getAttribute('data-md-cols');
|
|
1188
|
+
carouselElement.querySelector('.carousel__controls a').classList.add('active'); // On scroll we need to make sure the buttons get corrected and the next testimonial is shown
|
|
1189
|
+
|
|
1190
|
+
carouselInner.addEventListener('scroll', function (e) {
|
|
1191
|
+
clearTimeout(scrollTimeout);
|
|
1192
|
+
scrollTimeout = setTimeout(function () {
|
|
1193
|
+
var scrollArea = carouselInner.clientWidth;
|
|
1194
|
+
var scrollWidth = carouselInner.scrollWidth;
|
|
1195
|
+
var scrollLeft = carouselInner.scrollLeft;
|
|
1196
|
+
var targetSlide = Math.round(scrollLeft / scrollWidth * itemCount) + 1;
|
|
1197
|
+
var lastItemOffset = carouselElement.querySelector('.carousel__item:last-child').offsetLeft;
|
|
1198
|
+
Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach(function (link, index) {
|
|
1199
|
+
link.classList.remove('active');
|
|
1200
|
+
});
|
|
1201
|
+
carouselElement.querySelector('.control-' + targetSlide).classList.add('active'); // Disable the previous button
|
|
1202
|
+
|
|
1203
|
+
if (targetSlide == 1) carouselElement.querySelector('.btn-prev').setAttribute('disabled', 'disabled');else carouselElement.querySelector('.btn-prev').removeAttribute('disabled'); // Disable the next button if the last item is in view
|
|
1204
|
+
|
|
1205
|
+
if (carouselInner.scrollLeft + scrollArea > lastItemOffset) carouselElement.querySelector('.btn-next').setAttribute('disabled', 'disabled');else carouselElement.querySelector('.btn-next').removeAttribute('disabled');
|
|
1206
|
+
}, 100);
|
|
1207
|
+
}, false); // when the buttons are used we need to make sure the carousel scrolls to the correct place
|
|
1208
|
+
|
|
1209
|
+
carouselElement.addEventListener('click', function (e) {
|
|
1210
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
1211
|
+
if (target.matches('.carousel__controls a')) {
|
|
1212
|
+
e.preventDefault();
|
|
1213
|
+
Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach(function (link, index) {
|
|
1214
|
+
link.classList.remove('active');
|
|
1215
|
+
});
|
|
1216
|
+
target.classList.add('active');
|
|
1217
|
+
var el = document.querySelector(target.getAttribute('href'));
|
|
1218
|
+
carouselInner.scroll({
|
|
1219
|
+
top: 0,
|
|
1220
|
+
left: el.offsetLeft,
|
|
1221
|
+
behavior: 'smooth'
|
|
1222
|
+
});
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}, false);
|
|
1227
|
+
carouselElement.addEventListener('click', function (e) {
|
|
1228
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
1229
|
+
if (target.matches('.btn-next, .btn-prev')) {
|
|
1230
|
+
e.preventDefault();
|
|
1231
|
+
var scrollTo = target.classList.contains('btn-prev') ? carouselInner.scrollLeft - carouselInner.clientWidth : carouselInner.scrollLeft + carouselInner.clientWidth;
|
|
1232
|
+
carouselInner.scroll({
|
|
1233
|
+
top: 0,
|
|
1234
|
+
left: scrollTo,
|
|
1235
|
+
behavior: 'smooth'
|
|
1236
|
+
});
|
|
1237
|
+
break;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
}, false); // Add responsive hide button classes
|
|
1241
|
+
|
|
1242
|
+
if (itemCount == 1) carouselElement.classList.add('hide-btns');
|
|
1243
|
+
if (smCols >= itemCount) carouselElement.classList.add('hide-sm-btns');
|
|
1244
|
+
if (mdCols >= itemCount) carouselElement.classList.add('hide-md-btns');
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
// Create a link between two input/selects with one acting as setting a minimum value and the second a maximum
|
|
1248
|
+
// The link between the two will prevent the max input field form setting a lower value than the min and vice versa
|
|
1249
|
+
function inputRange(inputWrapper) {
|
|
1250
|
+
inputWrapper.addEventListener('change', function (e) {
|
|
1251
|
+
var min = parseInt(inputWrapper.querySelector('[data-min] select,[data-min] input').value);
|
|
1252
|
+
var max = parseInt(inputWrapper.querySelector('[data-max] select,[data-max] input').value); // Set attributes for input fields
|
|
1253
|
+
|
|
1254
|
+
Array.from(inputWrapper.querySelectorAll('[data-min] input')).forEach(function (input, index) {
|
|
1255
|
+
input.setAttribute('max', max);
|
|
1256
|
+
});
|
|
1257
|
+
Array.from(inputWrapper.querySelectorAll('[data-max] input')).forEach(function (input, index) {
|
|
1258
|
+
input.setAttribute('min', min);
|
|
1259
|
+
}); // Hide select options if they are higher or lower than the min and max values
|
|
1260
|
+
|
|
1261
|
+
Array.from(inputWrapper.querySelectorAll('[data-min] select option')).forEach(function (option, index) {
|
|
1262
|
+
if (parseInt(option.getAttribute('value')) > max) option.classList.add('d-none');else option.classList.remove('d-none');
|
|
1263
|
+
});
|
|
1264
|
+
Array.from(inputWrapper.querySelectorAll('[data-max] select option')).forEach(function (option, index) {
|
|
1265
|
+
if (parseInt(option.getAttribute('value')) < min) option.classList.add('d-none');else option.classList.remove('d-none');
|
|
1266
|
+
});
|
|
1267
|
+
}, false);
|
|
1268
|
+
} // Acts as an overall initialise function to trigger other functions.
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
function form(formElement) {
|
|
1272
|
+
// Check for input range groups
|
|
1273
|
+
Array.from(formElement.querySelectorAll('[data-input-range]')).forEach(function (arrayElement, index) {
|
|
1274
|
+
inputRange(arrayElement);
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
1279
|
+
addBodyClasses(document.body);
|
|
1280
|
+
checkElements(document.body);
|
|
1281
|
+
console.log('test.js'); // ANav
|
|
1282
|
+
|
|
1283
|
+
Array.from(document.querySelectorAll('.nav')).forEach(function (arrayElement, index) {
|
|
1284
|
+
navbar(arrayElement);
|
|
1285
|
+
}); // Advanced tables
|
|
1286
|
+
|
|
1287
|
+
Array.from(document.querySelectorAll('.table__wrapper')).forEach(function (arrayElement, index) {
|
|
1288
|
+
table(arrayElement);
|
|
1289
|
+
}); // Accordions
|
|
1290
|
+
|
|
1291
|
+
Array.from(document.querySelectorAll('.accordion')).forEach(function (arrayElement, index) {
|
|
1292
|
+
accordion(arrayElement);
|
|
1293
|
+
}); // Testimonial
|
|
1294
|
+
|
|
1295
|
+
Array.from(document.querySelectorAll('.testimonial')).forEach(function (arrayElement, index) {
|
|
1296
|
+
testimonial(arrayElement);
|
|
1297
|
+
}); // Carousel
|
|
1298
|
+
|
|
1299
|
+
Array.from(document.querySelectorAll('.carousel')).forEach(function (arrayElement, index) {
|
|
1300
|
+
carousel(arrayElement);
|
|
1301
|
+
}); // Form
|
|
1302
|
+
|
|
1303
|
+
Array.from(document.querySelectorAll('form')).forEach(function (arrayElement, index) {
|
|
1304
|
+
form(arrayElement);
|
|
1305
|
+
}); // Modal
|
|
1306
|
+
|
|
1307
|
+
Array.from(document.querySelectorAll('.modal')).forEach(function (arrayElement, index) {
|
|
1308
|
+
modal(arrayElement);
|
|
1309
|
+
});
|
|
1310
|
+
});
|
|
1311
|
+
|
|
1312
|
+
}));
|
|
1313
|
+
//# sourceMappingURL=scripts.bundle.js.map
|