@iamproperty/components 3.4.7 → 3.5.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/assets/bootstrap/LICENSE +22 -0
- package/assets/bootstrap/README.md +246 -0
- package/assets/bootstrap/js/src/alert.js +87 -0
- package/assets/bootstrap/js/src/base-component.js +85 -0
- package/assets/bootstrap/js/src/button.js +72 -0
- package/assets/bootstrap/js/src/carousel.js +475 -0
- package/assets/bootstrap/js/src/collapse.js +302 -0
- package/assets/bootstrap/js/src/dom/data.js +55 -0
- package/assets/bootstrap/js/src/dom/event-handler.js +320 -0
- package/assets/bootstrap/js/src/dom/manipulator.js +71 -0
- package/assets/bootstrap/js/src/dom/selector-engine.js +83 -0
- package/assets/bootstrap/js/src/dropdown.js +454 -0
- package/assets/bootstrap/js/src/modal.js +377 -0
- package/assets/bootstrap/js/src/offcanvas.js +283 -0
- package/assets/bootstrap/js/src/popover.js +97 -0
- package/assets/bootstrap/js/src/scrollspy.js +294 -0
- package/assets/bootstrap/js/src/tab.js +305 -0
- package/assets/bootstrap/js/src/toast.js +225 -0
- package/assets/bootstrap/js/src/tooltip.js +633 -0
- package/assets/bootstrap/js/src/util/backdrop.js +149 -0
- package/assets/bootstrap/js/src/util/component-functions.js +34 -0
- package/assets/bootstrap/js/src/util/config.js +66 -0
- package/assets/bootstrap/js/src/util/focustrap.js +115 -0
- package/assets/bootstrap/js/src/util/index.js +336 -0
- package/assets/bootstrap/js/src/util/sanitizer.js +118 -0
- package/assets/bootstrap/js/src/util/scrollbar.js +114 -0
- package/assets/bootstrap/js/src/util/swipe.js +146 -0
- package/assets/bootstrap/js/src/util/template-factory.js +160 -0
- package/assets/bootstrap/package.json +181 -0
- package/assets/bootstrap/scss/_accordion.scss +149 -0
- package/assets/bootstrap/scss/_alert.scss +71 -0
- package/assets/bootstrap/scss/_badge.scss +38 -0
- package/assets/bootstrap/scss/_breadcrumb.scss +40 -0
- package/assets/bootstrap/scss/_button-group.scss +142 -0
- package/assets/bootstrap/scss/_buttons.scss +207 -0
- package/assets/bootstrap/scss/_card.scss +234 -0
- package/assets/bootstrap/scss/_carousel.scss +226 -0
- package/assets/bootstrap/scss/_close.scss +40 -0
- package/assets/bootstrap/scss/_containers.scss +41 -0
- package/assets/bootstrap/scss/_dropdown.scss +249 -0
- package/assets/bootstrap/scss/_forms.scss +9 -0
- package/assets/bootstrap/scss/_functions.scss +302 -0
- package/assets/bootstrap/scss/_grid.scss +33 -0
- package/assets/bootstrap/scss/_helpers.scss +10 -0
- package/assets/bootstrap/scss/_images.scss +42 -0
- package/assets/bootstrap/scss/_list-group.scss +192 -0
- package/assets/bootstrap/scss/_maps.scss +54 -0
- package/assets/bootstrap/scss/_mixins.scss +43 -0
- package/assets/bootstrap/scss/_modal.scss +237 -0
- package/assets/bootstrap/scss/_nav.scss +172 -0
- package/assets/bootstrap/scss/_navbar.scss +278 -0
- package/assets/bootstrap/scss/_offcanvas.scss +144 -0
- package/assets/bootstrap/scss/_pagination.scss +109 -0
- package/assets/bootstrap/scss/_placeholders.scss +51 -0
- package/assets/bootstrap/scss/_popover.scss +196 -0
- package/assets/bootstrap/scss/_progress.scss +59 -0
- package/assets/bootstrap/scss/_reboot.scss +610 -0
- package/assets/bootstrap/scss/_root.scss +73 -0
- package/assets/bootstrap/scss/_spinners.scss +85 -0
- package/assets/bootstrap/scss/_tables.scss +164 -0
- package/assets/bootstrap/scss/_toasts.scss +73 -0
- package/assets/bootstrap/scss/_tooltip.scss +120 -0
- package/assets/bootstrap/scss/_transitions.scss +27 -0
- package/assets/bootstrap/scss/_type.scss +106 -0
- package/assets/bootstrap/scss/_utilities.scss +647 -0
- package/assets/bootstrap/scss/_variables.scss +1634 -0
- package/assets/bootstrap/scss/bootstrap-grid.scss +64 -0
- package/assets/bootstrap/scss/bootstrap-reboot.scss +9 -0
- package/assets/bootstrap/scss/bootstrap-utilities.scss +18 -0
- package/assets/bootstrap/scss/bootstrap.scss +51 -0
- package/assets/bootstrap/scss/forms/_floating-labels.scss +75 -0
- package/assets/bootstrap/scss/forms/_form-check.scss +175 -0
- package/assets/bootstrap/scss/forms/_form-control.scss +194 -0
- package/assets/bootstrap/scss/forms/_form-range.scss +91 -0
- package/assets/bootstrap/scss/forms/_form-select.scss +71 -0
- package/assets/bootstrap/scss/forms/_form-text.scss +11 -0
- package/assets/bootstrap/scss/forms/_input-group.scss +132 -0
- package/assets/bootstrap/scss/forms/_labels.scss +36 -0
- package/assets/bootstrap/scss/forms/_validation.scss +12 -0
- package/assets/bootstrap/scss/helpers/_clearfix.scss +3 -0
- package/assets/bootstrap/scss/helpers/_color-bg.scss +10 -0
- package/assets/bootstrap/scss/helpers/_colored-links.scss +12 -0
- package/assets/bootstrap/scss/helpers/_position.scss +36 -0
- package/assets/bootstrap/scss/helpers/_ratio.scss +26 -0
- package/assets/bootstrap/scss/helpers/_stacks.scss +15 -0
- package/assets/bootstrap/scss/helpers/_stretched-link.scss +15 -0
- package/assets/bootstrap/scss/helpers/_text-truncation.scss +7 -0
- package/assets/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
- package/assets/bootstrap/scss/helpers/_vr.scss +8 -0
- package/assets/bootstrap/scss/mixins/_alert.scss +15 -0
- package/assets/bootstrap/scss/mixins/_backdrop.scss +14 -0
- package/assets/bootstrap/scss/mixins/_banner.scss +9 -0
- package/assets/bootstrap/scss/mixins/_border-radius.scss +78 -0
- package/assets/bootstrap/scss/mixins/_box-shadow.scss +18 -0
- package/assets/bootstrap/scss/mixins/_breakpoints.scss +127 -0
- package/assets/bootstrap/scss/mixins/_buttons.scss +70 -0
- package/assets/bootstrap/scss/mixins/_caret.scss +64 -0
- package/assets/bootstrap/scss/mixins/_clearfix.scss +9 -0
- package/assets/bootstrap/scss/mixins/_color-scheme.scss +7 -0
- package/assets/bootstrap/scss/mixins/_container.scss +11 -0
- package/assets/bootstrap/scss/mixins/_deprecate.scss +10 -0
- package/assets/bootstrap/scss/mixins/_forms.scss +152 -0
- package/assets/bootstrap/scss/mixins/_gradients.scss +47 -0
- package/assets/bootstrap/scss/mixins/_grid.scss +151 -0
- package/assets/bootstrap/scss/mixins/_image.scss +16 -0
- package/assets/bootstrap/scss/mixins/_list-group.scss +24 -0
- package/assets/bootstrap/scss/mixins/_lists.scss +7 -0
- package/assets/bootstrap/scss/mixins/_pagination.scss +10 -0
- package/assets/bootstrap/scss/mixins/_reset-text.scss +17 -0
- package/assets/bootstrap/scss/mixins/_resize.scss +6 -0
- package/assets/bootstrap/scss/mixins/_table-variants.scss +24 -0
- package/assets/bootstrap/scss/mixins/_text-truncate.scss +8 -0
- package/assets/bootstrap/scss/mixins/_transition.scss +26 -0
- package/assets/bootstrap/scss/mixins/_utilities.scss +97 -0
- package/assets/bootstrap/scss/mixins/_visually-hidden.scss +29 -0
- package/assets/bootstrap/scss/utilities/_api.scss +47 -0
- package/assets/bootstrap/scss/vendor/_rfs.scss +354 -0
- package/assets/css/components/accordion.css +1 -1
- package/assets/css/components/accordion.css.map +1 -1
- package/assets/css/components/admin-panel.css +1 -0
- package/assets/css/components/admin-panel.css.map +1 -0
- package/assets/css/components/alert.css +1 -1
- package/assets/css/components/alert.css.map +1 -1
- package/assets/css/components/carousel.css +1 -1
- package/assets/css/components/carousel.css.map +1 -1
- package/assets/css/components/charts.css +1 -1
- package/assets/css/components/charts.css.map +1 -1
- package/assets/css/components/container.css.map +1 -1
- package/assets/css/components/dialog.css +1 -1
- package/assets/css/components/dialog.css.map +1 -1
- package/assets/css/components/forms.css.map +1 -1
- package/assets/css/components/header.css +1 -1
- package/assets/css/components/header.css.map +1 -1
- package/assets/css/components/lists.css +1 -1
- package/assets/css/components/lists.css.map +1 -1
- package/assets/css/components/nav.css +1 -1
- package/assets/css/components/nav.css.map +1 -1
- package/assets/css/components/pagination.css.map +1 -1
- package/assets/css/components/property-searchbar.css +1 -1
- package/assets/css/components/property-searchbar.css.map +1 -1
- package/assets/css/components/stepper.css +1 -1
- package/assets/css/components/stepper.css.map +1 -1
- package/assets/css/components/table.css +1 -1
- package/assets/css/components/table.css.map +1 -1
- package/assets/css/components/tabs.css +1 -1
- package/assets/css/components/tabs.css.map +1 -1
- package/assets/css/components/tooltips.css +1 -1
- package/assets/css/components/tooltips.css.map +1 -1
- 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/components/accordion/accordion.component.min.js +1 -1
- package/assets/js/components/card/card.component.min.js +1 -1
- package/assets/js/components/filterlist/filterlist.component.min.js +1 -1
- package/assets/js/components/header/header.component.min.js +5 -5
- package/assets/js/components/table/table.component.js +4 -0
- package/assets/js/components/table/table.component.min.js +5 -5
- package/assets/js/components/table/table.component.min.js.map +1 -1
- package/assets/js/components/tabs/tabs.component.min.js +5 -5
- package/assets/js/dynamic.min.js +2 -2
- package/assets/js/dynamic.min.js.map +1 -1
- package/assets/js/modules/helpers.js +31 -6
- package/assets/js/modules/table.js +4 -5
- package/assets/js/scripts.bundle.js +31 -31
- 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/js/tests/table.spec.js +3 -1
- package/assets/sass/_corefiles.scss +15 -15
- package/assets/sass/_forms.scss +7 -7
- package/assets/sass/_functions/functions.scss +1 -1
- package/assets/sass/_functions/mixins.scss +19 -21
- package/assets/sass/_functions/utilities.scss +51 -9
- package/assets/sass/_functions/variables.scss +77 -37
- package/assets/sass/_tests/colours.spec.scss +8 -22
- package/assets/sass/components/accordion.scss +13 -0
- package/assets/sass/components/admin-panel.scss +106 -0
- package/assets/sass/components/alert.scss +22 -0
- package/assets/sass/components/carousel.scss +72 -0
- package/assets/sass/components/charts.scss +37 -1
- package/assets/sass/components/container.scss +1 -1
- package/assets/sass/components/dialog.scss +7 -1
- package/assets/sass/components/lists.scss +14 -0
- package/assets/sass/components/nav.scss +1 -1
- package/assets/sass/components/pagination.scss +1 -1
- package/assets/sass/components/stepper.scss +3 -3
- package/assets/sass/components/table.scss +19 -15
- package/assets/sass/components/tabs.scss +20 -7
- package/assets/sass/components/tooltips.scss +1 -1
- package/assets/sass/foundations/buttons.scss +366 -0
- package/assets/sass/foundations/links.scss +75 -75
- package/assets/sass/foundations/media.scss +1 -1
- package/assets/sass/foundations/reboot.scss +3 -5
- package/assets/sass/foundations/root.scss +9 -29
- package/assets/sass/foundations/type.scss +1 -1
- package/assets/ts/components/table/table.component.ts +5 -0
- package/assets/ts/modules/helpers.ts +49 -8
- package/assets/ts/modules/table.ts +6 -6
- package/assets/ts/tests/table.spec.ts +4 -1
- package/dist/components.es.js +46 -42
- package/dist/components.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/assets/css/components/buttons.css +0 -1
- package/assets/css/components/buttons.css.map +0 -1
- package/assets/css/components/panel.css +0 -1
- package/assets/css/components/panel.css.map +0 -1
- package/assets/sass/components/buttons.scss +0 -252
- package/assets/sass/components/panel.scss +0 -161
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap (v5.2.3): util/sanitizer.js
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const uriAttributes = new Set([
|
|
9
|
+
'background',
|
|
10
|
+
'cite',
|
|
11
|
+
'href',
|
|
12
|
+
'itemtype',
|
|
13
|
+
'longdesc',
|
|
14
|
+
'poster',
|
|
15
|
+
'src',
|
|
16
|
+
'xlink:href'
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
|
23
|
+
*
|
|
24
|
+
* Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
|
25
|
+
*/
|
|
26
|
+
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
|
30
|
+
*
|
|
31
|
+
* Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
|
32
|
+
*/
|
|
33
|
+
const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i
|
|
34
|
+
|
|
35
|
+
const allowedAttribute = (attribute, allowedAttributeList) => {
|
|
36
|
+
const attributeName = attribute.nodeName.toLowerCase()
|
|
37
|
+
|
|
38
|
+
if (allowedAttributeList.includes(attributeName)) {
|
|
39
|
+
if (uriAttributes.has(attributeName)) {
|
|
40
|
+
return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue))
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return true
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Check if a regular expression validates the attribute.
|
|
47
|
+
return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)
|
|
48
|
+
.some(regex => regex.test(attributeName))
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const DefaultAllowlist = {
|
|
52
|
+
// Global attributes allowed on any supplied element below.
|
|
53
|
+
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
|
54
|
+
a: ['target', 'href', 'title', 'rel'],
|
|
55
|
+
area: [],
|
|
56
|
+
b: [],
|
|
57
|
+
br: [],
|
|
58
|
+
col: [],
|
|
59
|
+
code: [],
|
|
60
|
+
div: [],
|
|
61
|
+
em: [],
|
|
62
|
+
hr: [],
|
|
63
|
+
h1: [],
|
|
64
|
+
h2: [],
|
|
65
|
+
h3: [],
|
|
66
|
+
h4: [],
|
|
67
|
+
h5: [],
|
|
68
|
+
h6: [],
|
|
69
|
+
i: [],
|
|
70
|
+
img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
|
|
71
|
+
li: [],
|
|
72
|
+
ol: [],
|
|
73
|
+
p: [],
|
|
74
|
+
pre: [],
|
|
75
|
+
s: [],
|
|
76
|
+
small: [],
|
|
77
|
+
span: [],
|
|
78
|
+
sub: [],
|
|
79
|
+
sup: [],
|
|
80
|
+
strong: [],
|
|
81
|
+
u: [],
|
|
82
|
+
ul: []
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
|
|
86
|
+
if (!unsafeHtml.length) {
|
|
87
|
+
return unsafeHtml
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (sanitizeFunction && typeof sanitizeFunction === 'function') {
|
|
91
|
+
return sanitizeFunction(unsafeHtml)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const domParser = new window.DOMParser()
|
|
95
|
+
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')
|
|
96
|
+
const elements = [].concat(...createdDocument.body.querySelectorAll('*'))
|
|
97
|
+
|
|
98
|
+
for (const element of elements) {
|
|
99
|
+
const elementName = element.nodeName.toLowerCase()
|
|
100
|
+
|
|
101
|
+
if (!Object.keys(allowList).includes(elementName)) {
|
|
102
|
+
element.remove()
|
|
103
|
+
|
|
104
|
+
continue
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const attributeList = [].concat(...element.attributes)
|
|
108
|
+
const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || [])
|
|
109
|
+
|
|
110
|
+
for (const attribute of attributeList) {
|
|
111
|
+
if (!allowedAttribute(attribute, allowedAttributes)) {
|
|
112
|
+
element.removeAttribute(attribute.nodeName)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return createdDocument.body.innerHTML
|
|
118
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap (v5.2.3): util/scrollBar.js
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import SelectorEngine from '../dom/selector-engine'
|
|
9
|
+
import Manipulator from '../dom/manipulator'
|
|
10
|
+
import { isElement } from './index'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Constants
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'
|
|
17
|
+
const SELECTOR_STICKY_CONTENT = '.sticky-top'
|
|
18
|
+
const PROPERTY_PADDING = 'padding-right'
|
|
19
|
+
const PROPERTY_MARGIN = 'margin-right'
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Class definition
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
class ScrollBarHelper {
|
|
26
|
+
constructor() {
|
|
27
|
+
this._element = document.body
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Public
|
|
31
|
+
getWidth() {
|
|
32
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
|
33
|
+
const documentWidth = document.documentElement.clientWidth
|
|
34
|
+
return Math.abs(window.innerWidth - documentWidth)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
hide() {
|
|
38
|
+
const width = this.getWidth()
|
|
39
|
+
this._disableOverFlow()
|
|
40
|
+
// give padding to element to balance the hidden scrollbar width
|
|
41
|
+
this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width)
|
|
42
|
+
// trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
|
|
43
|
+
this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width)
|
|
44
|
+
this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
reset() {
|
|
48
|
+
this._resetElementAttributes(this._element, 'overflow')
|
|
49
|
+
this._resetElementAttributes(this._element, PROPERTY_PADDING)
|
|
50
|
+
this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING)
|
|
51
|
+
this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
isOverflowing() {
|
|
55
|
+
return this.getWidth() > 0
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Private
|
|
59
|
+
_disableOverFlow() {
|
|
60
|
+
this._saveInitialAttribute(this._element, 'overflow')
|
|
61
|
+
this._element.style.overflow = 'hidden'
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_setElementAttributes(selector, styleProperty, callback) {
|
|
65
|
+
const scrollbarWidth = this.getWidth()
|
|
66
|
+
const manipulationCallBack = element => {
|
|
67
|
+
if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this._saveInitialAttribute(element, styleProperty)
|
|
72
|
+
const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty)
|
|
73
|
+
element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this._applyManipulationCallback(selector, manipulationCallBack)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
_saveInitialAttribute(element, styleProperty) {
|
|
80
|
+
const actualValue = element.style.getPropertyValue(styleProperty)
|
|
81
|
+
if (actualValue) {
|
|
82
|
+
Manipulator.setDataAttribute(element, styleProperty, actualValue)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
_resetElementAttributes(selector, styleProperty) {
|
|
87
|
+
const manipulationCallBack = element => {
|
|
88
|
+
const value = Manipulator.getDataAttribute(element, styleProperty)
|
|
89
|
+
// We only want to remove the property if the value is `null`; the value can also be zero
|
|
90
|
+
if (value === null) {
|
|
91
|
+
element.style.removeProperty(styleProperty)
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
Manipulator.removeDataAttribute(element, styleProperty)
|
|
96
|
+
element.style.setProperty(styleProperty, value)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this._applyManipulationCallback(selector, manipulationCallBack)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
_applyManipulationCallback(selector, callBack) {
|
|
103
|
+
if (isElement(selector)) {
|
|
104
|
+
callBack(selector)
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
for (const sel of SelectorEngine.find(selector, this._element)) {
|
|
109
|
+
callBack(sel)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export default ScrollBarHelper
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap (v5.2.3): util/swipe.js
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import Config from './config'
|
|
9
|
+
import EventHandler from '../dom/event-handler'
|
|
10
|
+
import { execute } from './index'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Constants
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const NAME = 'swipe'
|
|
17
|
+
const EVENT_KEY = '.bs.swipe'
|
|
18
|
+
const EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`
|
|
19
|
+
const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`
|
|
20
|
+
const EVENT_TOUCHEND = `touchend${EVENT_KEY}`
|
|
21
|
+
const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`
|
|
22
|
+
const EVENT_POINTERUP = `pointerup${EVENT_KEY}`
|
|
23
|
+
const POINTER_TYPE_TOUCH = 'touch'
|
|
24
|
+
const POINTER_TYPE_PEN = 'pen'
|
|
25
|
+
const CLASS_NAME_POINTER_EVENT = 'pointer-event'
|
|
26
|
+
const SWIPE_THRESHOLD = 40
|
|
27
|
+
|
|
28
|
+
const Default = {
|
|
29
|
+
endCallback: null,
|
|
30
|
+
leftCallback: null,
|
|
31
|
+
rightCallback: null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const DefaultType = {
|
|
35
|
+
endCallback: '(function|null)',
|
|
36
|
+
leftCallback: '(function|null)',
|
|
37
|
+
rightCallback: '(function|null)'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Class definition
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
class Swipe extends Config {
|
|
45
|
+
constructor(element, config) {
|
|
46
|
+
super()
|
|
47
|
+
this._element = element
|
|
48
|
+
|
|
49
|
+
if (!element || !Swipe.isSupported()) {
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this._config = this._getConfig(config)
|
|
54
|
+
this._deltaX = 0
|
|
55
|
+
this._supportPointerEvents = Boolean(window.PointerEvent)
|
|
56
|
+
this._initEvents()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Getters
|
|
60
|
+
static get Default() {
|
|
61
|
+
return Default
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static get DefaultType() {
|
|
65
|
+
return DefaultType
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static get NAME() {
|
|
69
|
+
return NAME
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Public
|
|
73
|
+
dispose() {
|
|
74
|
+
EventHandler.off(this._element, EVENT_KEY)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Private
|
|
78
|
+
_start(event) {
|
|
79
|
+
if (!this._supportPointerEvents) {
|
|
80
|
+
this._deltaX = event.touches[0].clientX
|
|
81
|
+
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (this._eventIsPointerPenTouch(event)) {
|
|
86
|
+
this._deltaX = event.clientX
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
_end(event) {
|
|
91
|
+
if (this._eventIsPointerPenTouch(event)) {
|
|
92
|
+
this._deltaX = event.clientX - this._deltaX
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
this._handleSwipe()
|
|
96
|
+
execute(this._config.endCallback)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
_move(event) {
|
|
100
|
+
this._deltaX = event.touches && event.touches.length > 1 ?
|
|
101
|
+
0 :
|
|
102
|
+
event.touches[0].clientX - this._deltaX
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_handleSwipe() {
|
|
106
|
+
const absDeltaX = Math.abs(this._deltaX)
|
|
107
|
+
|
|
108
|
+
if (absDeltaX <= SWIPE_THRESHOLD) {
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const direction = absDeltaX / this._deltaX
|
|
113
|
+
|
|
114
|
+
this._deltaX = 0
|
|
115
|
+
|
|
116
|
+
if (!direction) {
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
_initEvents() {
|
|
124
|
+
if (this._supportPointerEvents) {
|
|
125
|
+
EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event))
|
|
126
|
+
EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event))
|
|
127
|
+
|
|
128
|
+
this._element.classList.add(CLASS_NAME_POINTER_EVENT)
|
|
129
|
+
} else {
|
|
130
|
+
EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event))
|
|
131
|
+
EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event))
|
|
132
|
+
EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event))
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
_eventIsPointerPenTouch(event) {
|
|
137
|
+
return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Static
|
|
141
|
+
static isSupported() {
|
|
142
|
+
return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export default Swipe
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* Bootstrap (v5.2.3): util/template-factory.js
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { DefaultAllowlist, sanitizeHtml } from './sanitizer'
|
|
9
|
+
import { getElement, isElement } from '../util/index'
|
|
10
|
+
import SelectorEngine from '../dom/selector-engine'
|
|
11
|
+
import Config from './config'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Constants
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const NAME = 'TemplateFactory'
|
|
18
|
+
|
|
19
|
+
const Default = {
|
|
20
|
+
allowList: DefaultAllowlist,
|
|
21
|
+
content: {}, // { selector : text , selector2 : text2 , }
|
|
22
|
+
extraClass: '',
|
|
23
|
+
html: false,
|
|
24
|
+
sanitize: true,
|
|
25
|
+
sanitizeFn: null,
|
|
26
|
+
template: '<div></div>'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const DefaultType = {
|
|
30
|
+
allowList: 'object',
|
|
31
|
+
content: 'object',
|
|
32
|
+
extraClass: '(string|function)',
|
|
33
|
+
html: 'boolean',
|
|
34
|
+
sanitize: 'boolean',
|
|
35
|
+
sanitizeFn: '(null|function)',
|
|
36
|
+
template: 'string'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const DefaultContentType = {
|
|
40
|
+
entry: '(string|element|function|null)',
|
|
41
|
+
selector: '(string|element)'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Class definition
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
class TemplateFactory extends Config {
|
|
49
|
+
constructor(config) {
|
|
50
|
+
super()
|
|
51
|
+
this._config = this._getConfig(config)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Getters
|
|
55
|
+
static get Default() {
|
|
56
|
+
return Default
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static get DefaultType() {
|
|
60
|
+
return DefaultType
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static get NAME() {
|
|
64
|
+
return NAME
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Public
|
|
68
|
+
getContent() {
|
|
69
|
+
return Object.values(this._config.content)
|
|
70
|
+
.map(config => this._resolvePossibleFunction(config))
|
|
71
|
+
.filter(Boolean)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
hasContent() {
|
|
75
|
+
return this.getContent().length > 0
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
changeContent(content) {
|
|
79
|
+
this._checkContent(content)
|
|
80
|
+
this._config.content = { ...this._config.content, ...content }
|
|
81
|
+
return this
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
toHtml() {
|
|
85
|
+
const templateWrapper = document.createElement('div')
|
|
86
|
+
templateWrapper.innerHTML = this._maybeSanitize(this._config.template)
|
|
87
|
+
|
|
88
|
+
for (const [selector, text] of Object.entries(this._config.content)) {
|
|
89
|
+
this._setContent(templateWrapper, text, selector)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const template = templateWrapper.children[0]
|
|
93
|
+
const extraClass = this._resolvePossibleFunction(this._config.extraClass)
|
|
94
|
+
|
|
95
|
+
if (extraClass) {
|
|
96
|
+
template.classList.add(...extraClass.split(' '))
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return template
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Private
|
|
103
|
+
_typeCheckConfig(config) {
|
|
104
|
+
super._typeCheckConfig(config)
|
|
105
|
+
this._checkContent(config.content)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
_checkContent(arg) {
|
|
109
|
+
for (const [selector, content] of Object.entries(arg)) {
|
|
110
|
+
super._typeCheckConfig({ selector, entry: content }, DefaultContentType)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
_setContent(template, content, selector) {
|
|
115
|
+
const templateElement = SelectorEngine.findOne(selector, template)
|
|
116
|
+
|
|
117
|
+
if (!templateElement) {
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
content = this._resolvePossibleFunction(content)
|
|
122
|
+
|
|
123
|
+
if (!content) {
|
|
124
|
+
templateElement.remove()
|
|
125
|
+
return
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (isElement(content)) {
|
|
129
|
+
this._putElementInTemplate(getElement(content), templateElement)
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (this._config.html) {
|
|
134
|
+
templateElement.innerHTML = this._maybeSanitize(content)
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
templateElement.textContent = content
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
_maybeSanitize(arg) {
|
|
142
|
+
return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
_resolvePossibleFunction(arg) {
|
|
146
|
+
return typeof arg === 'function' ? arg(this) : arg
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
_putElementInTemplate(element, templateElement) {
|
|
150
|
+
if (this._config.html) {
|
|
151
|
+
templateElement.innerHTML = ''
|
|
152
|
+
templateElement.append(element)
|
|
153
|
+
return
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
templateElement.textContent = element.textContent
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export default TemplateFactory
|