q2-tecton-elements 1.4.4 → 1.5.3
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/dist/cjs/click-elsewhere.cjs.entry.js +1 -1
- package/dist/cjs/{index-88eda03b.js → index-56373ad4.js} +6 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{patch-e20a85b4.js → patch-9ecad880.js} +1 -1
- package/dist/cjs/q2-avatar.cjs.entry.js +1 -1
- package/dist/cjs/q2-btn.cjs.entry.js +1 -1
- package/dist/cjs/q2-calendar.cjs.entry.js +1 -1
- package/dist/cjs/q2-carousel-pane.cjs.entry.js +1 -1
- package/dist/cjs/q2-carousel.cjs.entry.js +1 -1
- package/dist/cjs/q2-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/q2-dropdown-item.cjs.entry.js +1 -1
- package/dist/cjs/q2-dropdown.cjs.entry.js +6 -4
- package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
- package/dist/cjs/q2-icon.cjs.entry.js +1 -1
- package/dist/cjs/q2-input_2.cjs.entry.js +2 -2
- package/dist/cjs/q2-loading-element.cjs.entry.js +2 -2
- package/dist/cjs/q2-loading.cjs.entry.js +2 -2
- package/dist/cjs/q2-loc.cjs.entry.js +1 -1
- package/dist/cjs/q2-optgroup.cjs.entry.js +1 -1
- package/dist/cjs/q2-option.cjs.entry.js +1 -1
- package/dist/cjs/q2-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-radio.cjs.entry.js +1 -1
- package/dist/cjs/q2-section.cjs.entry.js +1 -1
- package/dist/cjs/q2-select.cjs.entry.js +1 -1
- package/dist/cjs/q2-tab-container.cjs.entry.js +521 -1042
- package/dist/cjs/q2-tab-pane.cjs.entry.js +1 -1
- package/dist/cjs/q2-tecton-elements.cjs.js +3 -3
- package/dist/cjs/{shapes-00766dc3.js → shapes-8ec3a001.js} +1 -1
- package/dist/cjs/tecton-tab-pane.cjs.entry.js +2 -1
- package/dist/collection/components/q2-dropdown/index.js +8 -4
- package/dist/collection/components/q2-input/formatting/phone.js +1 -1
- package/dist/collection/components/q2-tab-container/index.js +108 -38
- package/dist/collection/components/q2-tab-container/styles.css +4 -2
- package/dist/collection/components/tecton-tab-pane/index.js +1 -0
- package/dist/esm/click-elsewhere.entry.js +1 -1
- package/dist/esm/{index-b70f7228.js → index-06403810.js} +6 -1
- package/dist/esm/loader.mjs +3 -3
- package/dist/esm/{patch-187aa2d6.js → patch-580829e4.js} +1 -1
- package/dist/esm/q2-avatar.entry.js +1 -1
- package/dist/esm/q2-btn.entry.js +1 -1
- package/dist/esm/q2-calendar.entry.js +1 -1
- package/dist/esm/q2-carousel-pane.entry.js +1 -1
- package/dist/esm/q2-carousel.entry.js +1 -1
- package/dist/esm/q2-checkbox-group.entry.js +1 -1
- package/dist/esm/q2-checkbox.entry.js +1 -1
- package/dist/esm/q2-dropdown-item.entry.js +1 -1
- package/dist/esm/q2-dropdown.entry.js +6 -4
- package/dist/esm/q2-editable-field.entry.js +1 -1
- package/dist/esm/q2-icon.entry.js +1 -1
- package/dist/esm/q2-input_2.entry.js +2 -2
- package/dist/esm/q2-loading-element.entry.js +2 -2
- package/dist/esm/q2-loading.entry.js +2 -2
- package/dist/esm/q2-loc.entry.js +1 -1
- package/dist/esm/q2-optgroup.entry.js +1 -1
- package/dist/esm/q2-option.entry.js +1 -1
- package/dist/esm/q2-radio-group.entry.js +1 -1
- package/dist/esm/q2-radio.entry.js +1 -1
- package/dist/esm/q2-section.entry.js +1 -1
- package/dist/esm/q2-select.entry.js +1 -1
- package/dist/esm/q2-tab-container.entry.js +521 -1042
- package/dist/esm/q2-tab-pane.entry.js +1 -1
- package/dist/esm/q2-tecton-elements.mjs +3 -3
- package/dist/esm/{shapes-1a12324b.js → shapes-ac99fc8e.js} +1 -1
- package/dist/esm/tecton-tab-pane.entry.js +2 -1
- package/dist/esm-es5/click-elsewhere.entry.js +1 -1
- package/dist/esm-es5/{index-b70f7228.js → index-06403810.js} +6 -1
- package/dist/esm-es5/loader.mjs +3 -3
- package/dist/esm-es5/{patch-187aa2d6.js → patch-580829e4.js} +1 -1
- package/dist/esm-es5/q2-avatar.entry.js +1 -1
- package/dist/esm-es5/q2-btn.entry.js +1 -1
- package/dist/esm-es5/q2-calendar.entry.js +1 -1
- package/dist/esm-es5/q2-carousel-pane.entry.js +1 -1
- package/dist/esm-es5/q2-carousel.entry.js +1 -1
- package/dist/esm-es5/q2-checkbox-group.entry.js +1 -1
- package/dist/esm-es5/q2-checkbox.entry.js +1 -1
- package/dist/esm-es5/q2-dropdown-item.entry.js +1 -1
- package/dist/esm-es5/q2-dropdown.entry.js +6 -4
- package/dist/esm-es5/q2-editable-field.entry.js +1 -1
- package/dist/esm-es5/q2-icon.entry.js +1 -1
- package/dist/esm-es5/q2-input_2.entry.js +2 -2
- package/dist/esm-es5/q2-loading-element.entry.js +2 -2
- package/dist/esm-es5/q2-loading.entry.js +2 -2
- package/dist/esm-es5/q2-loc.entry.js +1 -1
- package/dist/esm-es5/q2-optgroup.entry.js +1 -1
- package/dist/esm-es5/q2-option.entry.js +1 -1
- package/dist/esm-es5/q2-radio-group.entry.js +1 -1
- package/dist/esm-es5/q2-radio.entry.js +1 -1
- package/dist/esm-es5/q2-section.entry.js +1 -1
- package/dist/esm-es5/q2-select.entry.js +1 -1
- package/dist/esm-es5/q2-tab-container.entry.js +426 -1068
- package/dist/esm-es5/q2-tab-pane.entry.js +1 -1
- package/dist/esm-es5/q2-tecton-elements.mjs +3 -3
- package/dist/esm-es5/{shapes-1a12324b.js → shapes-ac99fc8e.js} +1 -1
- package/dist/esm-es5/tecton-tab-pane.entry.js +2 -1
- package/dist/q2-tecton-elements/{p-c96424ae.entry.js → p-0898c601.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-c164ff6e.entry.js → p-1118a9a2.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-06e01d71.system.js → p-1b41293f.system.js} +1 -1
- package/dist/q2-tecton-elements/{p-b1fb02bf.entry.js → p-2071c411.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-2b69fdec.system.js +1 -0
- package/dist/q2-tecton-elements/p-2b775411.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-30c73ea9.entry.js → p-368f6eee.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-33a4a4e6.system.entry.js → p-3788add3.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-5adaa91d.system.entry.js → p-3de63622.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-43a05b9f.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-b96a2e11.entry.js → p-441decb7.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-5f52c28d.system.js → p-46e098a0.system.js} +1 -1
- package/dist/q2-tecton-elements/{p-843fdb33.system.entry.js → p-55ff8885.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-f01bebc8.system.entry.js → p-560cadce.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-9fc24628.js → p-5f9033b7.js} +1 -1
- package/dist/q2-tecton-elements/{p-1113bf25.system.entry.js → p-63ec6e3d.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-323cbdd3.entry.js → p-65d32cb9.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-a53e34ff.system.entry.js → p-66c9c34a.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-6c2249f2.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-d3d487ce.entry.js → p-7624ed0d.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-9f4d9ea2.system.entry.js → p-7e5a1320.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-a68a88bb.system.entry.js → p-824c4b15.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-3d8e5455.system.entry.js → p-82ce1d2d.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-12cf6e8b.entry.js → p-84e239ae.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-ce2eb03c.js → p-885ad5bb.js} +1 -1
- package/dist/q2-tecton-elements/{p-208d0c6e.system.entry.js → p-8fa28d27.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-7b10d18b.entry.js → p-94944dd4.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-94a26b0f.system.js +1 -0
- package/dist/q2-tecton-elements/{p-b88eabe8.system.entry.js → p-9644093a.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-5fc58e19.entry.js → p-967e5b17.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-9d45cb48.system.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-b2a4162a.entry.js → p-9d82b5a4.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-4b737f84.system.entry.js → p-a0865160.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-832f3e02.entry.js → p-a7831802.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-aa243b6a.system.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-5f0adaa9.system.entry.js → p-ad806b56.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-75be017a.entry.js → p-b0d0f85d.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-2fce6304.entry.js → p-b3b046f3.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-b5ebb4cb.js +1 -0
- package/dist/q2-tecton-elements/{p-f6023957.entry.js → p-ba96d37c.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-f6f4572b.system.entry.js → p-bbef2e56.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-07203a0e.entry.js → p-c39e81d3.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-46204d10.entry.js → p-c3d24f40.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-c88975f8.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-535687b4.system.entry.js → p-cb8d4e07.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-ad2fa69f.system.entry.js → p-cf340d13.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-390b9415.entry.js → p-d30f657f.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-8dfd0e89.system.entry.js → p-db3ade12.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-7b3a7b01.entry.js → p-dc4b38dc.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-4fd89735.system.entry.js → p-ebc8a18d.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-83ac78cd.entry.js → p-ed186964.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-3a2e7aad.system.entry.js → p-f1717e3c.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-dbf210b9.system.entry.js → p-f248c3db.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-9a298ef4.entry.js → p-f7f06773.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-fc9ea618.system.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-49ec33ae.system.entry.js → p-fcc00d73.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-b4637b36.system.entry.js → p-fefca9c1.system.entry.js} +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.js +1 -1
- package/dist/types/components/q2-dropdown/index.d.ts +1 -0
- package/dist/types/components/q2-tab-container/index.d.ts +8 -4
- package/dist/types/workspace/workspace/{_tecton-production_release_1.4.x → _tecton-production_release_1.5.x}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +0 -0
- package/package.json +3 -2
- package/dist/q2-tecton-elements/p-00067d0a.system.js +0 -1
- package/dist/q2-tecton-elements/p-154bd5bd.entry.js +0 -1
- package/dist/q2-tecton-elements/p-1a8e579d.js +0 -1
- package/dist/q2-tecton-elements/p-268818c7.entry.js +0 -1
- package/dist/q2-tecton-elements/p-7e020511.system.entry.js +0 -1
- package/dist/q2-tecton-elements/p-bc15b363.entry.js +0 -1
- package/dist/q2-tecton-elements/p-ce8573ad.system.entry.js +0 -1
- package/dist/q2-tecton-elements/p-e41762c1.system.entry.js +0 -1
- package/dist/q2-tecton-elements/p-f08aea0c.system.js +0 -1
- package/dist/q2-tecton-elements/p-f15af226.entry.js +0 -1
|
@@ -1,1034 +1,463 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-06403810.js';
|
|
2
2
|
import { c as createGuid } from './index-ff056163.js';
|
|
3
3
|
|
|
4
|
-
function
|
|
5
|
-
|
|
4
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
5
|
+
return module = {
|
|
6
|
+
path: basedir,
|
|
7
|
+
exports: {},
|
|
8
|
+
require: function (path, base) {
|
|
9
|
+
return commonjsRequire();
|
|
10
|
+
}
|
|
11
|
+
}, fn(module, module.exports), module.exports;
|
|
6
12
|
}
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Promise: undefined,
|
|
11
|
-
set useDeprecatedSynchronousErrorHandling(value) {
|
|
12
|
-
if (value) {
|
|
13
|
-
const error = new Error();
|
|
14
|
-
console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
|
|
15
|
-
}
|
|
16
|
-
else if (_enable_super_gross_mode_that_will_cause_bad_things) {
|
|
17
|
-
console.log('RxJS: Back to a better error behavior. Thank you. <3');
|
|
18
|
-
}
|
|
19
|
-
_enable_super_gross_mode_that_will_cause_bad_things = value;
|
|
20
|
-
},
|
|
21
|
-
get useDeprecatedSynchronousErrorHandling() {
|
|
22
|
-
return _enable_super_gross_mode_that_will_cause_bad_things;
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
function hostReportError(err) {
|
|
27
|
-
setTimeout(() => { throw err; }, 0);
|
|
14
|
+
function commonjsRequire () {
|
|
15
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
28
16
|
}
|
|
29
17
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
error(err) {
|
|
34
|
-
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
35
|
-
throw err;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
hostReportError(err);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
complete() { }
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const isArray = (() => Array.isArray || ((x) => x && typeof x.length === 'number'))();
|
|
18
|
+
var smoothscroll = createCommonjsModule(function (module, exports) {
|
|
19
|
+
/* smoothscroll v0.4.4 - 2019 - Dustan Kasten, Jeremias Menichelli - MIT License */
|
|
20
|
+
(function () {
|
|
45
21
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
22
|
+
// polyfill
|
|
23
|
+
function polyfill() {
|
|
24
|
+
// aliases
|
|
25
|
+
var w = window;
|
|
26
|
+
var d = document;
|
|
49
27
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.name = 'UnsubscriptionError';
|
|
57
|
-
this.errors = errors;
|
|
58
|
-
return this;
|
|
28
|
+
// return if scroll behavior is supported and polyfill is not forced
|
|
29
|
+
if (
|
|
30
|
+
'scrollBehavior' in d.documentElement.style &&
|
|
31
|
+
w.__forceSmoothScrollPolyfill__ !== true
|
|
32
|
+
) {
|
|
33
|
+
return;
|
|
59
34
|
}
|
|
60
|
-
UnsubscriptionErrorImpl.prototype = Object.create(Error.prototype);
|
|
61
|
-
return UnsubscriptionErrorImpl;
|
|
62
|
-
})();
|
|
63
|
-
const UnsubscriptionError = UnsubscriptionErrorImpl;
|
|
64
35
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this._parentOrParents = null;
|
|
69
|
-
this._subscriptions = null;
|
|
70
|
-
if (unsubscribe) {
|
|
71
|
-
this._ctorUnsubscribe = true;
|
|
72
|
-
this._unsubscribe = unsubscribe;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
unsubscribe() {
|
|
76
|
-
let errors;
|
|
77
|
-
if (this.closed) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
let { _parentOrParents, _ctorUnsubscribe, _unsubscribe, _subscriptions } = this;
|
|
81
|
-
this.closed = true;
|
|
82
|
-
this._parentOrParents = null;
|
|
83
|
-
this._subscriptions = null;
|
|
84
|
-
if (_parentOrParents instanceof Subscription) {
|
|
85
|
-
_parentOrParents.remove(this);
|
|
86
|
-
}
|
|
87
|
-
else if (_parentOrParents !== null) {
|
|
88
|
-
for (let index = 0; index < _parentOrParents.length; ++index) {
|
|
89
|
-
const parent = _parentOrParents[index];
|
|
90
|
-
parent.remove(this);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (isFunction(_unsubscribe)) {
|
|
94
|
-
if (_ctorUnsubscribe) {
|
|
95
|
-
this._unsubscribe = undefined;
|
|
96
|
-
}
|
|
97
|
-
try {
|
|
98
|
-
_unsubscribe.call(this);
|
|
99
|
-
}
|
|
100
|
-
catch (e) {
|
|
101
|
-
errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (isArray(_subscriptions)) {
|
|
105
|
-
let index = -1;
|
|
106
|
-
let len = _subscriptions.length;
|
|
107
|
-
while (++index < len) {
|
|
108
|
-
const sub = _subscriptions[index];
|
|
109
|
-
if (isObject(sub)) {
|
|
110
|
-
try {
|
|
111
|
-
sub.unsubscribe();
|
|
112
|
-
}
|
|
113
|
-
catch (e) {
|
|
114
|
-
errors = errors || [];
|
|
115
|
-
if (e instanceof UnsubscriptionError) {
|
|
116
|
-
errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
errors.push(e);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
if (errors) {
|
|
126
|
-
throw new UnsubscriptionError(errors);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
add(teardown) {
|
|
130
|
-
let subscription = teardown;
|
|
131
|
-
if (!teardown) {
|
|
132
|
-
return Subscription.EMPTY;
|
|
133
|
-
}
|
|
134
|
-
switch (typeof teardown) {
|
|
135
|
-
case 'function':
|
|
136
|
-
subscription = new Subscription(teardown);
|
|
137
|
-
case 'object':
|
|
138
|
-
if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
|
|
139
|
-
return subscription;
|
|
140
|
-
}
|
|
141
|
-
else if (this.closed) {
|
|
142
|
-
subscription.unsubscribe();
|
|
143
|
-
return subscription;
|
|
144
|
-
}
|
|
145
|
-
else if (!(subscription instanceof Subscription)) {
|
|
146
|
-
const tmp = subscription;
|
|
147
|
-
subscription = new Subscription();
|
|
148
|
-
subscription._subscriptions = [tmp];
|
|
149
|
-
}
|
|
150
|
-
break;
|
|
151
|
-
default: {
|
|
152
|
-
throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
let { _parentOrParents } = subscription;
|
|
156
|
-
if (_parentOrParents === null) {
|
|
157
|
-
subscription._parentOrParents = this;
|
|
158
|
-
}
|
|
159
|
-
else if (_parentOrParents instanceof Subscription) {
|
|
160
|
-
if (_parentOrParents === this) {
|
|
161
|
-
return subscription;
|
|
162
|
-
}
|
|
163
|
-
subscription._parentOrParents = [_parentOrParents, this];
|
|
164
|
-
}
|
|
165
|
-
else if (_parentOrParents.indexOf(this) === -1) {
|
|
166
|
-
_parentOrParents.push(this);
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
return subscription;
|
|
170
|
-
}
|
|
171
|
-
const subscriptions = this._subscriptions;
|
|
172
|
-
if (subscriptions === null) {
|
|
173
|
-
this._subscriptions = [subscription];
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
subscriptions.push(subscription);
|
|
177
|
-
}
|
|
178
|
-
return subscription;
|
|
179
|
-
}
|
|
180
|
-
remove(subscription) {
|
|
181
|
-
const subscriptions = this._subscriptions;
|
|
182
|
-
if (subscriptions) {
|
|
183
|
-
const subscriptionIndex = subscriptions.indexOf(subscription);
|
|
184
|
-
if (subscriptionIndex !== -1) {
|
|
185
|
-
subscriptions.splice(subscriptionIndex, 1);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
Subscription.EMPTY = (function (empty) {
|
|
191
|
-
empty.closed = true;
|
|
192
|
-
return empty;
|
|
193
|
-
}(new Subscription()));
|
|
194
|
-
function flattenUnsubscriptionErrors(errors) {
|
|
195
|
-
return errors.reduce((errs, err) => errs.concat((err instanceof UnsubscriptionError) ? err.errors : err), []);
|
|
196
|
-
}
|
|
36
|
+
// globals
|
|
37
|
+
var Element = w.HTMLElement || w.Element;
|
|
38
|
+
var SCROLL_TIME = 468;
|
|
197
39
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
40
|
+
// object gathering original scroll methods
|
|
41
|
+
var original = {
|
|
42
|
+
scroll: w.scroll || w.scrollTo,
|
|
43
|
+
scrollBy: w.scrollBy,
|
|
44
|
+
elementScroll: Element.prototype.scroll || scrollElement,
|
|
45
|
+
scrollIntoView: Element.prototype.scrollIntoView
|
|
46
|
+
};
|
|
201
47
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
this.destination.error(err);
|
|
271
|
-
this.unsubscribe();
|
|
272
|
-
}
|
|
273
|
-
_complete() {
|
|
274
|
-
this.destination.complete();
|
|
275
|
-
this.unsubscribe();
|
|
276
|
-
}
|
|
277
|
-
_unsubscribeAndRecycle() {
|
|
278
|
-
const { _parentOrParents } = this;
|
|
279
|
-
this._parentOrParents = null;
|
|
280
|
-
this.unsubscribe();
|
|
281
|
-
this.closed = false;
|
|
282
|
-
this.isStopped = false;
|
|
283
|
-
this._parentOrParents = _parentOrParents;
|
|
284
|
-
return this;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
class SafeSubscriber extends Subscriber {
|
|
288
|
-
constructor(_parentSubscriber, observerOrNext, error, complete) {
|
|
289
|
-
super();
|
|
290
|
-
this._parentSubscriber = _parentSubscriber;
|
|
291
|
-
let next;
|
|
292
|
-
let context = this;
|
|
293
|
-
if (isFunction(observerOrNext)) {
|
|
294
|
-
next = observerOrNext;
|
|
295
|
-
}
|
|
296
|
-
else if (observerOrNext) {
|
|
297
|
-
next = observerOrNext.next;
|
|
298
|
-
error = observerOrNext.error;
|
|
299
|
-
complete = observerOrNext.complete;
|
|
300
|
-
if (observerOrNext !== empty) {
|
|
301
|
-
context = Object.create(observerOrNext);
|
|
302
|
-
if (isFunction(context.unsubscribe)) {
|
|
303
|
-
this.add(context.unsubscribe.bind(context));
|
|
304
|
-
}
|
|
305
|
-
context.unsubscribe = this.unsubscribe.bind(this);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
this._context = context;
|
|
309
|
-
this._next = next;
|
|
310
|
-
this._error = error;
|
|
311
|
-
this._complete = complete;
|
|
312
|
-
}
|
|
313
|
-
next(value) {
|
|
314
|
-
if (!this.isStopped && this._next) {
|
|
315
|
-
const { _parentSubscriber } = this;
|
|
316
|
-
if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
317
|
-
this.__tryOrUnsub(this._next, value);
|
|
318
|
-
}
|
|
319
|
-
else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
|
|
320
|
-
this.unsubscribe();
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
error(err) {
|
|
325
|
-
if (!this.isStopped) {
|
|
326
|
-
const { _parentSubscriber } = this;
|
|
327
|
-
const { useDeprecatedSynchronousErrorHandling } = config;
|
|
328
|
-
if (this._error) {
|
|
329
|
-
if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
330
|
-
this.__tryOrUnsub(this._error, err);
|
|
331
|
-
this.unsubscribe();
|
|
332
|
-
}
|
|
333
|
-
else {
|
|
334
|
-
this.__tryOrSetError(_parentSubscriber, this._error, err);
|
|
335
|
-
this.unsubscribe();
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
else if (!_parentSubscriber.syncErrorThrowable) {
|
|
339
|
-
this.unsubscribe();
|
|
340
|
-
if (useDeprecatedSynchronousErrorHandling) {
|
|
341
|
-
throw err;
|
|
342
|
-
}
|
|
343
|
-
hostReportError(err);
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
if (useDeprecatedSynchronousErrorHandling) {
|
|
347
|
-
_parentSubscriber.syncErrorValue = err;
|
|
348
|
-
_parentSubscriber.syncErrorThrown = true;
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
hostReportError(err);
|
|
352
|
-
}
|
|
353
|
-
this.unsubscribe();
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
complete() {
|
|
358
|
-
if (!this.isStopped) {
|
|
359
|
-
const { _parentSubscriber } = this;
|
|
360
|
-
if (this._complete) {
|
|
361
|
-
const wrappedComplete = () => this._complete.call(this._context);
|
|
362
|
-
if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
363
|
-
this.__tryOrUnsub(wrappedComplete);
|
|
364
|
-
this.unsubscribe();
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
this.__tryOrSetError(_parentSubscriber, wrappedComplete);
|
|
368
|
-
this.unsubscribe();
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
else {
|
|
372
|
-
this.unsubscribe();
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
__tryOrUnsub(fn, value) {
|
|
377
|
-
try {
|
|
378
|
-
fn.call(this._context, value);
|
|
379
|
-
}
|
|
380
|
-
catch (err) {
|
|
381
|
-
this.unsubscribe();
|
|
382
|
-
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
383
|
-
throw err;
|
|
384
|
-
}
|
|
385
|
-
else {
|
|
386
|
-
hostReportError(err);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
__tryOrSetError(parent, fn, value) {
|
|
391
|
-
if (!config.useDeprecatedSynchronousErrorHandling) {
|
|
392
|
-
throw new Error('bad call');
|
|
393
|
-
}
|
|
394
|
-
try {
|
|
395
|
-
fn.call(this._context, value);
|
|
396
|
-
}
|
|
397
|
-
catch (err) {
|
|
398
|
-
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
399
|
-
parent.syncErrorValue = err;
|
|
400
|
-
parent.syncErrorThrown = true;
|
|
401
|
-
return true;
|
|
402
|
-
}
|
|
403
|
-
else {
|
|
404
|
-
hostReportError(err);
|
|
405
|
-
return true;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
48
|
+
// define timing method
|
|
49
|
+
var now =
|
|
50
|
+
w.performance && w.performance.now
|
|
51
|
+
? w.performance.now.bind(w.performance)
|
|
52
|
+
: Date.now;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* indicates if a the current browser is made by Microsoft
|
|
56
|
+
* @method isMicrosoftBrowser
|
|
57
|
+
* @param {String} userAgent
|
|
58
|
+
* @returns {Boolean}
|
|
59
|
+
*/
|
|
60
|
+
function isMicrosoftBrowser(userAgent) {
|
|
61
|
+
var userAgentPatterns = ['MSIE ', 'Trident/', 'Edge/'];
|
|
62
|
+
|
|
63
|
+
return new RegExp(userAgentPatterns.join('|')).test(userAgent);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* IE has rounding bug rounding down clientHeight and clientWidth and
|
|
68
|
+
* rounding up scrollHeight and scrollWidth causing false positives
|
|
69
|
+
* on hasScrollableSpace
|
|
70
|
+
*/
|
|
71
|
+
var ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* changes scroll position inside an element
|
|
75
|
+
* @method scrollElement
|
|
76
|
+
* @param {Number} x
|
|
77
|
+
* @param {Number} y
|
|
78
|
+
* @returns {undefined}
|
|
79
|
+
*/
|
|
80
|
+
function scrollElement(x, y) {
|
|
81
|
+
this.scrollLeft = x;
|
|
82
|
+
this.scrollTop = y;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* returns result of applying ease math function to a number
|
|
87
|
+
* @method ease
|
|
88
|
+
* @param {Number} k
|
|
89
|
+
* @returns {Number}
|
|
90
|
+
*/
|
|
91
|
+
function ease(k) {
|
|
92
|
+
return 0.5 * (1 - Math.cos(Math.PI * k));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* indicates if a smooth behavior should be applied
|
|
97
|
+
* @method shouldBailOut
|
|
98
|
+
* @param {Number|Object} firstArg
|
|
99
|
+
* @returns {Boolean}
|
|
100
|
+
*/
|
|
101
|
+
function shouldBailOut(firstArg) {
|
|
102
|
+
if (
|
|
103
|
+
firstArg === null ||
|
|
104
|
+
typeof firstArg !== 'object' ||
|
|
105
|
+
firstArg.behavior === undefined ||
|
|
106
|
+
firstArg.behavior === 'auto' ||
|
|
107
|
+
firstArg.behavior === 'instant'
|
|
108
|
+
) {
|
|
109
|
+
// first argument is not an object/null
|
|
110
|
+
// or behavior is auto, instant or undefined
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (typeof firstArg === 'object' && firstArg.behavior === 'smooth') {
|
|
115
|
+
// first argument is an object and behavior is smooth
|
|
408
116
|
return false;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// throw error when behavior is not supported
|
|
120
|
+
throw new TypeError(
|
|
121
|
+
'behavior member of ScrollOptions ' +
|
|
122
|
+
firstArg.behavior +
|
|
123
|
+
' is not a valid value for enumeration ScrollBehavior.'
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* indicates if an element has scrollable space in the provided axis
|
|
129
|
+
* @method hasScrollableSpace
|
|
130
|
+
* @param {Node} el
|
|
131
|
+
* @param {String} axis
|
|
132
|
+
* @returns {Boolean}
|
|
133
|
+
*/
|
|
134
|
+
function hasScrollableSpace(el, axis) {
|
|
135
|
+
if (axis === 'Y') {
|
|
136
|
+
return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (axis === 'X') {
|
|
140
|
+
return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* indicates if an element has a scrollable overflow property in the axis
|
|
146
|
+
* @method canOverflow
|
|
147
|
+
* @param {Node} el
|
|
148
|
+
* @param {String} axis
|
|
149
|
+
* @returns {Boolean}
|
|
150
|
+
*/
|
|
151
|
+
function canOverflow(el, axis) {
|
|
152
|
+
var overflowValue = w.getComputedStyle(el, null)['overflow' + axis];
|
|
153
|
+
|
|
154
|
+
return overflowValue === 'auto' || overflowValue === 'scroll';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* indicates if an element can be scrolled in either axis
|
|
159
|
+
* @method isScrollable
|
|
160
|
+
* @param {Node} el
|
|
161
|
+
* @param {String} axis
|
|
162
|
+
* @returns {Boolean}
|
|
163
|
+
*/
|
|
164
|
+
function isScrollable(el) {
|
|
165
|
+
var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y');
|
|
166
|
+
var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X');
|
|
167
|
+
|
|
168
|
+
return isScrollableY || isScrollableX;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* finds scrollable parent of an element
|
|
173
|
+
* @method findScrollableParent
|
|
174
|
+
* @param {Node} el
|
|
175
|
+
* @returns {Node} el
|
|
176
|
+
*/
|
|
177
|
+
function findScrollableParent(el) {
|
|
178
|
+
while (el !== d.body && isScrollable(el) === false) {
|
|
179
|
+
el = el.parentNode || el.host;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return el;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* self invoked function that, given a context, steps through scrolling
|
|
187
|
+
* @method step
|
|
188
|
+
* @param {Object} context
|
|
189
|
+
* @returns {undefined}
|
|
190
|
+
*/
|
|
191
|
+
function step(context) {
|
|
192
|
+
var time = now();
|
|
193
|
+
var value;
|
|
194
|
+
var currentX;
|
|
195
|
+
var currentY;
|
|
196
|
+
var elapsed = (time - context.startTime) / SCROLL_TIME;
|
|
197
|
+
|
|
198
|
+
// avoid elapsed times higher than one
|
|
199
|
+
elapsed = elapsed > 1 ? 1 : elapsed;
|
|
200
|
+
|
|
201
|
+
// apply easing to elapsed time
|
|
202
|
+
value = ease(elapsed);
|
|
203
|
+
|
|
204
|
+
currentX = context.startX + (context.x - context.startX) * value;
|
|
205
|
+
currentY = context.startY + (context.y - context.startY) * value;
|
|
206
|
+
|
|
207
|
+
context.method.call(context.scrollable, currentX, currentY);
|
|
208
|
+
|
|
209
|
+
// scroll more if we have not reached our destination
|
|
210
|
+
if (currentX !== context.x || currentY !== context.y) {
|
|
211
|
+
w.requestAnimationFrame(step.bind(w, context));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* scrolls window or element with a smooth behavior
|
|
217
|
+
* @method smoothScroll
|
|
218
|
+
* @param {Object|Node} el
|
|
219
|
+
* @param {Number} x
|
|
220
|
+
* @param {Number} y
|
|
221
|
+
* @returns {undefined}
|
|
222
|
+
*/
|
|
223
|
+
function smoothScroll(el, x, y) {
|
|
224
|
+
var scrollable;
|
|
225
|
+
var startX;
|
|
226
|
+
var startY;
|
|
227
|
+
var method;
|
|
228
|
+
var startTime = now();
|
|
229
|
+
|
|
230
|
+
// define scroll context
|
|
231
|
+
if (el === d.body) {
|
|
232
|
+
scrollable = w;
|
|
233
|
+
startX = w.scrollX || w.pageXOffset;
|
|
234
|
+
startY = w.scrollY || w.pageYOffset;
|
|
235
|
+
method = original.scroll;
|
|
236
|
+
} else {
|
|
237
|
+
scrollable = el;
|
|
238
|
+
startX = el.scrollLeft;
|
|
239
|
+
startY = el.scrollTop;
|
|
240
|
+
method = scrollElement;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// scroll looping over a frame
|
|
244
|
+
step({
|
|
245
|
+
scrollable: scrollable,
|
|
246
|
+
method: method,
|
|
247
|
+
startTime: startTime,
|
|
248
|
+
startX: startX,
|
|
249
|
+
startY: startY,
|
|
250
|
+
x: x,
|
|
251
|
+
y: y
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// ORIGINAL METHODS OVERRIDES
|
|
256
|
+
// w.scroll and w.scrollTo
|
|
257
|
+
w.scroll = w.scrollTo = function() {
|
|
258
|
+
// avoid action when no arguments are passed
|
|
259
|
+
if (arguments[0] === undefined) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// avoid smooth behavior if not required
|
|
264
|
+
if (shouldBailOut(arguments[0]) === true) {
|
|
265
|
+
original.scroll.call(
|
|
266
|
+
w,
|
|
267
|
+
arguments[0].left !== undefined
|
|
268
|
+
? arguments[0].left
|
|
269
|
+
: typeof arguments[0] !== 'object'
|
|
270
|
+
? arguments[0]
|
|
271
|
+
: w.scrollX || w.pageXOffset,
|
|
272
|
+
// use top prop, second argument if present or fallback to scrollY
|
|
273
|
+
arguments[0].top !== undefined
|
|
274
|
+
? arguments[0].top
|
|
275
|
+
: arguments[1] !== undefined
|
|
276
|
+
? arguments[1]
|
|
277
|
+
: w.scrollY || w.pageYOffset
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// LET THE SMOOTHNESS BEGIN!
|
|
284
|
+
smoothScroll.call(
|
|
285
|
+
w,
|
|
286
|
+
d.body,
|
|
287
|
+
arguments[0].left !== undefined
|
|
288
|
+
? ~~arguments[0].left
|
|
289
|
+
: w.scrollX || w.pageXOffset,
|
|
290
|
+
arguments[0].top !== undefined
|
|
291
|
+
? ~~arguments[0].top
|
|
292
|
+
: w.scrollY || w.pageYOffset
|
|
293
|
+
);
|
|
464
294
|
};
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
class Observable {
|
|
468
|
-
constructor(subscribe) {
|
|
469
|
-
this._isScalar = false;
|
|
470
|
-
if (subscribe) {
|
|
471
|
-
this._subscribe = subscribe;
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
lift(operator) {
|
|
475
|
-
const observable = new Observable();
|
|
476
|
-
observable.source = this;
|
|
477
|
-
observable.operator = operator;
|
|
478
|
-
return observable;
|
|
479
|
-
}
|
|
480
|
-
subscribe(observerOrNext, error, complete) {
|
|
481
|
-
const { operator } = this;
|
|
482
|
-
const sink = toSubscriber(observerOrNext, error, complete);
|
|
483
|
-
if (operator) {
|
|
484
|
-
sink.add(operator.call(sink, this.source));
|
|
485
|
-
}
|
|
486
|
-
else {
|
|
487
|
-
sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
|
|
488
|
-
this._subscribe(sink) :
|
|
489
|
-
this._trySubscribe(sink));
|
|
490
|
-
}
|
|
491
|
-
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
492
|
-
if (sink.syncErrorThrowable) {
|
|
493
|
-
sink.syncErrorThrowable = false;
|
|
494
|
-
if (sink.syncErrorThrown) {
|
|
495
|
-
throw sink.syncErrorValue;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
return sink;
|
|
500
|
-
}
|
|
501
|
-
_trySubscribe(sink) {
|
|
502
|
-
try {
|
|
503
|
-
return this._subscribe(sink);
|
|
504
|
-
}
|
|
505
|
-
catch (err) {
|
|
506
|
-
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
507
|
-
sink.syncErrorThrown = true;
|
|
508
|
-
sink.syncErrorValue = err;
|
|
509
|
-
}
|
|
510
|
-
if (canReportError(sink)) {
|
|
511
|
-
sink.error(err);
|
|
512
|
-
}
|
|
513
|
-
else {
|
|
514
|
-
console.warn(err);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
forEach(next, promiseCtor) {
|
|
519
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
520
|
-
return new promiseCtor((resolve, reject) => {
|
|
521
|
-
let subscription;
|
|
522
|
-
subscription = this.subscribe((value) => {
|
|
523
|
-
try {
|
|
524
|
-
next(value);
|
|
525
|
-
}
|
|
526
|
-
catch (err) {
|
|
527
|
-
reject(err);
|
|
528
|
-
if (subscription) {
|
|
529
|
-
subscription.unsubscribe();
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
}, reject, resolve);
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
_subscribe(subscriber) {
|
|
536
|
-
const { source } = this;
|
|
537
|
-
return source && source.subscribe(subscriber);
|
|
538
|
-
}
|
|
539
|
-
[observable]() {
|
|
540
|
-
return this;
|
|
541
|
-
}
|
|
542
|
-
pipe(...operations) {
|
|
543
|
-
if (operations.length === 0) {
|
|
544
|
-
return this;
|
|
545
|
-
}
|
|
546
|
-
return pipeFromArray(operations)(this);
|
|
547
|
-
}
|
|
548
|
-
toPromise(promiseCtor) {
|
|
549
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
550
|
-
return new promiseCtor((resolve, reject) => {
|
|
551
|
-
let value;
|
|
552
|
-
this.subscribe((x) => value = x, (err) => reject(err), () => resolve(value));
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
Observable.create = (subscribe) => {
|
|
557
|
-
return new Observable(subscribe);
|
|
558
|
-
};
|
|
559
|
-
function getPromiseCtor(promiseCtor) {
|
|
560
|
-
if (!promiseCtor) {
|
|
561
|
-
promiseCtor = Promise;
|
|
562
|
-
}
|
|
563
|
-
if (!promiseCtor) {
|
|
564
|
-
throw new Error('no Promise impl found');
|
|
565
|
-
}
|
|
566
|
-
return promiseCtor;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
class Action extends Subscription {
|
|
570
|
-
constructor(scheduler, work) {
|
|
571
|
-
super();
|
|
572
|
-
}
|
|
573
|
-
schedule(state, delay = 0) {
|
|
574
|
-
return this;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
class AsyncAction extends Action {
|
|
579
|
-
constructor(scheduler, work) {
|
|
580
|
-
super(scheduler, work);
|
|
581
|
-
this.scheduler = scheduler;
|
|
582
|
-
this.work = work;
|
|
583
|
-
this.pending = false;
|
|
584
|
-
}
|
|
585
|
-
schedule(state, delay = 0) {
|
|
586
|
-
if (this.closed) {
|
|
587
|
-
return this;
|
|
588
|
-
}
|
|
589
|
-
this.state = state;
|
|
590
|
-
const id = this.id;
|
|
591
|
-
const scheduler = this.scheduler;
|
|
592
|
-
if (id != null) {
|
|
593
|
-
this.id = this.recycleAsyncId(scheduler, id, delay);
|
|
594
|
-
}
|
|
595
|
-
this.pending = true;
|
|
596
|
-
this.delay = delay;
|
|
597
|
-
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
|
|
598
|
-
return this;
|
|
599
|
-
}
|
|
600
|
-
requestAsyncId(scheduler, id, delay = 0) {
|
|
601
|
-
return setInterval(scheduler.flush.bind(scheduler, this), delay);
|
|
602
|
-
}
|
|
603
|
-
recycleAsyncId(scheduler, id, delay = 0) {
|
|
604
|
-
if (delay !== null && this.delay === delay && this.pending === false) {
|
|
605
|
-
return id;
|
|
606
|
-
}
|
|
607
|
-
clearInterval(id);
|
|
608
|
-
return undefined;
|
|
609
|
-
}
|
|
610
|
-
execute(state, delay) {
|
|
611
|
-
if (this.closed) {
|
|
612
|
-
return new Error('executing a cancelled action');
|
|
613
|
-
}
|
|
614
|
-
this.pending = false;
|
|
615
|
-
const error = this._execute(state, delay);
|
|
616
|
-
if (error) {
|
|
617
|
-
return error;
|
|
618
|
-
}
|
|
619
|
-
else if (this.pending === false && this.id != null) {
|
|
620
|
-
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
_execute(state, delay) {
|
|
624
|
-
let errored = false;
|
|
625
|
-
let errorValue = undefined;
|
|
626
|
-
try {
|
|
627
|
-
this.work(state);
|
|
628
|
-
}
|
|
629
|
-
catch (e) {
|
|
630
|
-
errored = true;
|
|
631
|
-
errorValue = !!e && e || new Error(e);
|
|
632
|
-
}
|
|
633
|
-
if (errored) {
|
|
634
|
-
this.unsubscribe();
|
|
635
|
-
return errorValue;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
_unsubscribe() {
|
|
639
|
-
const id = this.id;
|
|
640
|
-
const scheduler = this.scheduler;
|
|
641
|
-
const actions = scheduler.actions;
|
|
642
|
-
const index = actions.indexOf(this);
|
|
643
|
-
this.work = null;
|
|
644
|
-
this.state = null;
|
|
645
|
-
this.pending = false;
|
|
646
|
-
this.scheduler = null;
|
|
647
|
-
if (index !== -1) {
|
|
648
|
-
actions.splice(index, 1);
|
|
649
|
-
}
|
|
650
|
-
if (id != null) {
|
|
651
|
-
this.id = this.recycleAsyncId(scheduler, id, null);
|
|
652
|
-
}
|
|
653
|
-
this.delay = null;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
class Scheduler {
|
|
658
|
-
constructor(SchedulerAction, now = Scheduler.now) {
|
|
659
|
-
this.SchedulerAction = SchedulerAction;
|
|
660
|
-
this.now = now;
|
|
661
|
-
}
|
|
662
|
-
schedule(work, delay = 0, state) {
|
|
663
|
-
return new this.SchedulerAction(this, work).schedule(state, delay);
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
Scheduler.now = () => Date.now();
|
|
667
|
-
|
|
668
|
-
class AsyncScheduler extends Scheduler {
|
|
669
|
-
constructor(SchedulerAction, now = Scheduler.now) {
|
|
670
|
-
super(SchedulerAction, () => {
|
|
671
|
-
if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
|
|
672
|
-
return AsyncScheduler.delegate.now();
|
|
673
|
-
}
|
|
674
|
-
else {
|
|
675
|
-
return now();
|
|
676
|
-
}
|
|
677
|
-
});
|
|
678
|
-
this.actions = [];
|
|
679
|
-
this.active = false;
|
|
680
|
-
this.scheduled = undefined;
|
|
681
|
-
}
|
|
682
|
-
schedule(work, delay = 0, state) {
|
|
683
|
-
if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
|
|
684
|
-
return AsyncScheduler.delegate.schedule(work, delay, state);
|
|
685
|
-
}
|
|
686
|
-
else {
|
|
687
|
-
return super.schedule(work, delay, state);
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
flush(action) {
|
|
691
|
-
const { actions } = this;
|
|
692
|
-
if (this.active) {
|
|
693
|
-
actions.push(action);
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
696
|
-
let error;
|
|
697
|
-
this.active = true;
|
|
698
|
-
do {
|
|
699
|
-
if (error = action.execute(action.state, action.delay)) {
|
|
700
|
-
break;
|
|
701
|
-
}
|
|
702
|
-
} while (action = actions.shift());
|
|
703
|
-
this.active = false;
|
|
704
|
-
if (error) {
|
|
705
|
-
while (action = actions.shift()) {
|
|
706
|
-
action.unsubscribe();
|
|
707
|
-
}
|
|
708
|
-
throw error;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
295
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
296
|
+
// w.scrollBy
|
|
297
|
+
w.scrollBy = function() {
|
|
298
|
+
// avoid action when no arguments are passed
|
|
299
|
+
if (arguments[0] === undefined) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// avoid smooth behavior if not required
|
|
304
|
+
if (shouldBailOut(arguments[0])) {
|
|
305
|
+
original.scrollBy.call(
|
|
306
|
+
w,
|
|
307
|
+
arguments[0].left !== undefined
|
|
308
|
+
? arguments[0].left
|
|
309
|
+
: typeof arguments[0] !== 'object' ? arguments[0] : 0,
|
|
310
|
+
arguments[0].top !== undefined
|
|
311
|
+
? arguments[0].top
|
|
312
|
+
: arguments[1] !== undefined ? arguments[1] : 0
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// LET THE SMOOTHNESS BEGIN!
|
|
319
|
+
smoothScroll.call(
|
|
320
|
+
w,
|
|
321
|
+
d.body,
|
|
322
|
+
~~arguments[0].left + (w.scrollX || w.pageXOffset),
|
|
323
|
+
~~arguments[0].top + (w.scrollY || w.pageYOffset)
|
|
324
|
+
);
|
|
729
325
|
};
|
|
730
|
-
}
|
|
731
|
-
class MapOperator {
|
|
732
|
-
constructor(project, thisArg) {
|
|
733
|
-
this.project = project;
|
|
734
|
-
this.thisArg = thisArg;
|
|
735
|
-
}
|
|
736
|
-
call(subscriber, source) {
|
|
737
|
-
return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
class MapSubscriber extends Subscriber {
|
|
741
|
-
constructor(destination, project, thisArg) {
|
|
742
|
-
super(destination);
|
|
743
|
-
this.project = project;
|
|
744
|
-
this.count = 0;
|
|
745
|
-
this.thisArg = thisArg || this;
|
|
746
|
-
}
|
|
747
|
-
_next(value) {
|
|
748
|
-
let result;
|
|
749
|
-
try {
|
|
750
|
-
result = this.project.call(this.thisArg, value, this.count++);
|
|
751
|
-
}
|
|
752
|
-
catch (err) {
|
|
753
|
-
this.destination.error(err);
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
this.destination.next(result);
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
326
|
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
327
|
+
// Element.prototype.scroll and Element.prototype.scrollTo
|
|
328
|
+
Element.prototype.scroll = Element.prototype.scrollTo = function() {
|
|
329
|
+
// avoid action when no arguments are passed
|
|
330
|
+
if (arguments[0] === undefined) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// avoid smooth behavior if not required
|
|
335
|
+
if (shouldBailOut(arguments[0]) === true) {
|
|
336
|
+
// if one number is passed, throw error to match Firefox implementation
|
|
337
|
+
if (typeof arguments[0] === 'number' && arguments[1] === undefined) {
|
|
338
|
+
throw new SyntaxError('Value could not be converted');
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
original.elementScroll.call(
|
|
342
|
+
this,
|
|
343
|
+
// use left prop, first number argument or fallback to scrollLeft
|
|
344
|
+
arguments[0].left !== undefined
|
|
345
|
+
? ~~arguments[0].left
|
|
346
|
+
: typeof arguments[0] !== 'object' ? ~~arguments[0] : this.scrollLeft,
|
|
347
|
+
// use top prop, second argument or fallback to scrollTop
|
|
348
|
+
arguments[0].top !== undefined
|
|
349
|
+
? ~~arguments[0].top
|
|
350
|
+
: arguments[1] !== undefined ? ~~arguments[1] : this.scrollTop
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
var left = arguments[0].left;
|
|
357
|
+
var top = arguments[0].top;
|
|
358
|
+
|
|
359
|
+
// LET THE SMOOTHNESS BEGIN!
|
|
360
|
+
smoothScroll.call(
|
|
361
|
+
this,
|
|
362
|
+
this,
|
|
363
|
+
typeof left === 'undefined' ? this.scrollLeft : ~~left,
|
|
364
|
+
typeof top === 'undefined' ? this.scrollTop : ~~top
|
|
365
|
+
);
|
|
366
|
+
};
|
|
770
367
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
|
|
368
|
+
// Element.prototype.scrollBy
|
|
369
|
+
Element.prototype.scrollBy = function() {
|
|
370
|
+
// avoid action when no arguments are passed
|
|
371
|
+
if (arguments[0] === undefined) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// avoid smooth behavior if not required
|
|
376
|
+
if (shouldBailOut(arguments[0]) === true) {
|
|
377
|
+
original.elementScroll.call(
|
|
378
|
+
this,
|
|
379
|
+
arguments[0].left !== undefined
|
|
380
|
+
? ~~arguments[0].left + this.scrollLeft
|
|
381
|
+
: ~~arguments[0] + this.scrollLeft,
|
|
382
|
+
arguments[0].top !== undefined
|
|
383
|
+
? ~~arguments[0].top + this.scrollTop
|
|
384
|
+
: ~~arguments[1] + this.scrollTop
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
this.scroll({
|
|
391
|
+
left: ~~arguments[0].left + this.scrollLeft,
|
|
392
|
+
top: ~~arguments[0].top + this.scrollTop,
|
|
393
|
+
behavior: arguments[0].behavior
|
|
394
|
+
});
|
|
395
|
+
};
|
|
778
396
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
397
|
+
// Element.prototype.scrollIntoView
|
|
398
|
+
Element.prototype.scrollIntoView = function() {
|
|
399
|
+
// avoid smooth behavior if not required
|
|
400
|
+
if (shouldBailOut(arguments[0]) === true) {
|
|
401
|
+
original.scrollIntoView.call(
|
|
402
|
+
this,
|
|
403
|
+
arguments[0] === undefined ? true : arguments[0]
|
|
404
|
+
);
|
|
405
|
+
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// LET THE SMOOTHNESS BEGIN!
|
|
410
|
+
var scrollableParent = findScrollableParent(this);
|
|
411
|
+
var parentRects = scrollableParent.getBoundingClientRect();
|
|
412
|
+
var clientRects = this.getBoundingClientRect();
|
|
413
|
+
|
|
414
|
+
if (scrollableParent !== d.body) {
|
|
415
|
+
// reveal element inside parent
|
|
416
|
+
smoothScroll.call(
|
|
417
|
+
this,
|
|
418
|
+
scrollableParent,
|
|
419
|
+
scrollableParent.scrollLeft + clientRects.left - parentRects.left,
|
|
420
|
+
scrollableParent.scrollTop + clientRects.top - parentRects.top
|
|
421
|
+
);
|
|
422
|
+
|
|
423
|
+
// reveal parent in viewport unless is fixed
|
|
424
|
+
if (w.getComputedStyle(scrollableParent).position !== 'fixed') {
|
|
425
|
+
w.scrollBy({
|
|
426
|
+
left: parentRects.left,
|
|
427
|
+
top: parentRects.top,
|
|
428
|
+
behavior: 'smooth'
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
} else {
|
|
432
|
+
// reveal element in viewport
|
|
433
|
+
w.scrollBy({
|
|
434
|
+
left: clientRects.left,
|
|
435
|
+
top: clientRects.top,
|
|
436
|
+
behavior: 'smooth'
|
|
804
437
|
});
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
const subscribeToObservable = (obj) => (subscriber) => {
|
|
810
|
-
const obs = obj[observable]();
|
|
811
|
-
if (typeof obs.subscribe !== 'function') {
|
|
812
|
-
throw new TypeError('Provided object does not correctly implement Symbol.observable');
|
|
813
|
-
}
|
|
814
|
-
else {
|
|
815
|
-
return obs.subscribe(subscriber);
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
|
|
819
|
-
const isArrayLike = ((x) => x && typeof x.length === 'number' && typeof x !== 'function');
|
|
820
|
-
|
|
821
|
-
function isPromise(value) {
|
|
822
|
-
return !!value && typeof value.subscribe !== 'function' && typeof value.then === 'function';
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
const subscribeTo = (result) => {
|
|
826
|
-
if (!!result && typeof result[observable] === 'function') {
|
|
827
|
-
return subscribeToObservable(result);
|
|
828
|
-
}
|
|
829
|
-
else if (isArrayLike(result)) {
|
|
830
|
-
return subscribeToArray(result);
|
|
831
|
-
}
|
|
832
|
-
else if (isPromise(result)) {
|
|
833
|
-
return subscribeToPromise(result);
|
|
834
|
-
}
|
|
835
|
-
else if (!!result && typeof result[iterator] === 'function') {
|
|
836
|
-
return subscribeToIterable(result);
|
|
837
|
-
}
|
|
838
|
-
else {
|
|
839
|
-
const value = isObject(result) ? 'an invalid object' : `'${result}'`;
|
|
840
|
-
const msg = `You provided ${value} where a stream was expected.`
|
|
841
|
-
+ ' You can provide an Observable, Promise, Array, or Iterable.';
|
|
842
|
-
throw new TypeError(msg);
|
|
843
|
-
}
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
class SimpleInnerSubscriber extends Subscriber {
|
|
847
|
-
constructor(parent) {
|
|
848
|
-
super();
|
|
849
|
-
this.parent = parent;
|
|
850
|
-
}
|
|
851
|
-
_next(value) {
|
|
852
|
-
this.parent.notifyNext(value);
|
|
853
|
-
}
|
|
854
|
-
_error(error) {
|
|
855
|
-
this.parent.notifyError(error);
|
|
856
|
-
this.unsubscribe();
|
|
857
|
-
}
|
|
858
|
-
_complete() {
|
|
859
|
-
this.parent.notifyComplete();
|
|
860
|
-
this.unsubscribe();
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
class SimpleOuterSubscriber extends Subscriber {
|
|
864
|
-
notifyNext(innerValue) {
|
|
865
|
-
this.destination.next(innerValue);
|
|
866
|
-
}
|
|
867
|
-
notifyError(err) {
|
|
868
|
-
this.destination.error(err);
|
|
869
|
-
}
|
|
870
|
-
notifyComplete() {
|
|
871
|
-
this.destination.complete();
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
function innerSubscribe(result, innerSubscriber) {
|
|
875
|
-
if (innerSubscriber.closed) {
|
|
876
|
-
return undefined;
|
|
877
|
-
}
|
|
878
|
-
if (result instanceof Observable) {
|
|
879
|
-
return result.subscribe(innerSubscriber);
|
|
880
|
-
}
|
|
881
|
-
return subscribeTo(result)(innerSubscriber);
|
|
882
|
-
}
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
883
441
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}
|
|
889
|
-
if (resultSelector) {
|
|
890
|
-
return fromEvent(target, eventName, options).pipe(map(args => isArray(args) ? resultSelector(...args) : resultSelector(args)));
|
|
891
|
-
}
|
|
892
|
-
return new Observable(subscriber => {
|
|
893
|
-
function handler(e) {
|
|
894
|
-
if (arguments.length > 1) {
|
|
895
|
-
subscriber.next(Array.prototype.slice.call(arguments));
|
|
896
|
-
}
|
|
897
|
-
else {
|
|
898
|
-
subscriber.next(e);
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
setupSubscription(target, eventName, handler, subscriber, options);
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
function setupSubscription(sourceObj, eventName, handler, subscriber, options) {
|
|
905
|
-
let unsubscribe;
|
|
906
|
-
if (isEventTarget(sourceObj)) {
|
|
907
|
-
const source = sourceObj;
|
|
908
|
-
sourceObj.addEventListener(eventName, handler, options);
|
|
909
|
-
unsubscribe = () => source.removeEventListener(eventName, handler, options);
|
|
910
|
-
}
|
|
911
|
-
else if (isJQueryStyleEventEmitter(sourceObj)) {
|
|
912
|
-
const source = sourceObj;
|
|
913
|
-
sourceObj.on(eventName, handler);
|
|
914
|
-
unsubscribe = () => source.off(eventName, handler);
|
|
915
|
-
}
|
|
916
|
-
else if (isNodeStyleEventEmitter(sourceObj)) {
|
|
917
|
-
const source = sourceObj;
|
|
918
|
-
sourceObj.addListener(eventName, handler);
|
|
919
|
-
unsubscribe = () => source.removeListener(eventName, handler);
|
|
920
|
-
}
|
|
921
|
-
else if (sourceObj && sourceObj.length) {
|
|
922
|
-
for (let i = 0, len = sourceObj.length; i < len; i++) {
|
|
923
|
-
setupSubscription(sourceObj[i], eventName, handler, subscriber, options);
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
else {
|
|
927
|
-
throw new TypeError('Invalid event target');
|
|
928
|
-
}
|
|
929
|
-
subscriber.add(unsubscribe);
|
|
930
|
-
}
|
|
931
|
-
function isNodeStyleEventEmitter(sourceObj) {
|
|
932
|
-
return sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function';
|
|
933
|
-
}
|
|
934
|
-
function isJQueryStyleEventEmitter(sourceObj) {
|
|
935
|
-
return sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function';
|
|
936
|
-
}
|
|
937
|
-
function isEventTarget(sourceObj) {
|
|
938
|
-
return sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function';
|
|
939
|
-
}
|
|
442
|
+
{
|
|
443
|
+
// commonjs
|
|
444
|
+
module.exports = { polyfill: polyfill };
|
|
445
|
+
}
|
|
940
446
|
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
}
|
|
447
|
+
}());
|
|
448
|
+
});
|
|
944
449
|
|
|
945
|
-
|
|
946
|
-
if (!isNumeric(period) || period < 0) {
|
|
947
|
-
period = 0;
|
|
948
|
-
}
|
|
949
|
-
if (!scheduler || typeof scheduler.schedule !== 'function') {
|
|
950
|
-
scheduler = async;
|
|
951
|
-
}
|
|
952
|
-
return new Observable(subscriber => {
|
|
953
|
-
subscriber.add(scheduler.schedule(dispatch, period, { subscriber, counter: 0, period }));
|
|
954
|
-
return subscriber;
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
function dispatch(state) {
|
|
958
|
-
const { subscriber, counter, period } = state;
|
|
959
|
-
subscriber.next(counter);
|
|
960
|
-
this.schedule({ subscriber, counter: counter + 1, period }, period);
|
|
961
|
-
}
|
|
450
|
+
const stylesCss = "*{-webkit-box-sizing:border-box;box-sizing:border-box}*:active{outline:none}*:focus{outline:none;-webkit-box-shadow:var(--const-global-focus);box-shadow:var(--const-global-focus)}:host{-webkit-box-shadow:none !important;box-shadow:none !important}::-moz-focus-inner{border:none}input,button{font-family:inherit;font-size:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.tab-container{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.tab-list{padding:0;display:-ms-flexbox;display:flex;margin:0;list-style:none;border-bottom:1px solid\n var(--tct-tab-container-border-color, var(--tct-gray-l1, var(--app-gray-l1, #cccccc)));white-space:nowrap;overflow-x:hidden;-ms-flex-align:center;align-items:center}.tab-list li.nav{position:absolute;height:44px;width:46px}.tab-list li.nav-left{left:-15px;background:-webkit-gradient(linear, left top, right top, color-stop(60%, var(--tct-section-bg, var(--t-section-bg, #ffffff))), to(rgba(255,255,255,0)));background:linear-gradient(to right, var(--tct-section-bg, var(--t-section-bg, #ffffff)) 60%, rgba(255,255,255,0))}.tab-list li.nav-right{right:-15px;background:-webkit-gradient(linear, right top, left top, color-stop(60%, var(--tct-section-bg, var(--t-section-bg, #ffffff))), to(rgba(255,255,255,0)));background:linear-gradient(to left, var(--tct-section-bg, var(--t-section-bg, #ffffff)) 60%, rgba(255,255,255,0))}.tab-list li.nav .arrow-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:inherit;width:inherit;cursor:pointer}.tab-list li.nav .arrow-container a{padding:0;margin:0;height:inherit;width:inherit;border-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.tab-list li.nav .arrow-container a q2-icon{width:19px;height:19px}.tab-list a{width:var(--tct-tab-hover-width, var(--t-tab-hover-width, 100%));text-align:center;text-decoration:none;padding:var(--tct-scale-2, var(--app-scale-2, 10px));margin:var(--tct-scale-1, var(--app-scale-1, 5px)) var(--tct-scale-1, var(--app-scale-1, 5px))\n 0;color:var(--tct-tab-inactive-color, var(--t-tab-inactive, inherit));font-size:var(--tct-tab-font-size, var(--t-tab-font-size, 17px));border-bottom:3px solid transparent;display:block;-webkit-transition:color var(--tct-tween-2, var(--app-tween-2, 0.4s ease)),\n border-color var(--tct-tween-1, var(--app-tween-1, 0.2s ease));transition:color var(--tct-tween-2, var(--app-tween-2, 0.4s ease)),\n border-color var(--tct-tween-1, var(--app-tween-1, 0.2s ease))}:host([type='section']) .tab-list a{font-size:inherit;padding:var(--tct-scale-2, var(--app-scale-2, 10px))\n var(--tct-scale-1, var(--app-scale-1, 5px))}@media screen and (max-width: 767px){.tab-list a{font-size:inherit;padding:var(--tct-scale-2, var(--app-scale-2, 10px))\n var(--tct-scale-1, var(--app-scale-1, 5px))}}.tab-list a:hover{color:var(--tct-tab-active-color, var(--t-tab-active, #2e2e2e));background-color:var(--tct-tab-hover-bg-color, var(--t-tab-hover-bg-color, inherit));width:var(--tct-tab-hover-width, var(--t-tab-hover-width, 100%))}.tab-list a[aria-selected='true']{color:var(--tct-tab-active-color, var(--t-tab-active, #2e2e2e));border-color:currentColor;width:var(--tct-tab-active-width, var(--t-tab-active-width, 100%));background-color:var(--tct-tab-active-bg-color, var(--t-tab-active-bg-color, inherit))}:host([color='alt']) .tab-list a{color:var(--tct-tab-alt-inactive-color, var(--t-tab-alt-inactive, inherit))}:host([color='alt']) .tab-list a:hover,:host([color='alt']) .tab-list a[aria-selected='true']{color:var(--tct-tab-alt-active-color, var(--t-tab-alt-active, inherit))}.tab-content{padding:var(--tct-scale-2, var(--app-scale-2, 10px)) 0}";
|
|
962
451
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector));
|
|
972
|
-
}
|
|
452
|
+
// enable scroll animation polyfill only on safari
|
|
453
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
454
|
+
const isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');
|
|
455
|
+
const isFirefox = userAgent.includes('firefox');
|
|
456
|
+
if (isSafari) {
|
|
457
|
+
// smooth scroll is not supported on safari
|
|
458
|
+
smoothscroll.polyfill();
|
|
459
|
+
window['__forceSmoothScrollPolyfill__'] = true;
|
|
973
460
|
}
|
|
974
|
-
class DebounceSubscriber extends SimpleOuterSubscriber {
|
|
975
|
-
constructor(destination, durationSelector) {
|
|
976
|
-
super(destination);
|
|
977
|
-
this.durationSelector = durationSelector;
|
|
978
|
-
this.hasValue = false;
|
|
979
|
-
}
|
|
980
|
-
_next(value) {
|
|
981
|
-
try {
|
|
982
|
-
const result = this.durationSelector.call(this, value);
|
|
983
|
-
if (result) {
|
|
984
|
-
this._tryNext(value, result);
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
catch (err) {
|
|
988
|
-
this.destination.error(err);
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
_complete() {
|
|
992
|
-
this.emitValue();
|
|
993
|
-
this.destination.complete();
|
|
994
|
-
}
|
|
995
|
-
_tryNext(value, duration) {
|
|
996
|
-
let subscription = this.durationSubscription;
|
|
997
|
-
this.value = value;
|
|
998
|
-
this.hasValue = true;
|
|
999
|
-
if (subscription) {
|
|
1000
|
-
subscription.unsubscribe();
|
|
1001
|
-
this.remove(subscription);
|
|
1002
|
-
}
|
|
1003
|
-
subscription = innerSubscribe(duration, new SimpleInnerSubscriber(this));
|
|
1004
|
-
if (subscription && !subscription.closed) {
|
|
1005
|
-
this.add(this.durationSubscription = subscription);
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
notifyNext() {
|
|
1009
|
-
this.emitValue();
|
|
1010
|
-
}
|
|
1011
|
-
notifyComplete() {
|
|
1012
|
-
this.emitValue();
|
|
1013
|
-
}
|
|
1014
|
-
emitValue() {
|
|
1015
|
-
if (this.hasValue) {
|
|
1016
|
-
const value = this.value;
|
|
1017
|
-
const subscription = this.durationSubscription;
|
|
1018
|
-
if (subscription) {
|
|
1019
|
-
this.durationSubscription = undefined;
|
|
1020
|
-
subscription.unsubscribe();
|
|
1021
|
-
this.remove(subscription);
|
|
1022
|
-
}
|
|
1023
|
-
this.value = undefined;
|
|
1024
|
-
this.hasValue = false;
|
|
1025
|
-
super._next(value);
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
const stylesCss = "*{-webkit-box-sizing:border-box;box-sizing:border-box}*:active{outline:none}*:focus{outline:none;-webkit-box-shadow:var(--const-global-focus);box-shadow:var(--const-global-focus)}:host{-webkit-box-shadow:none !important;box-shadow:none !important}::-moz-focus-inner{border:none}input,button{font-family:inherit;font-size:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.tab-container{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.tab-list{padding:0;display:-ms-flexbox;display:flex;margin:0;list-style:none;border-bottom:1px solid\n var(--tct-tab-container-border-color, var(--tct-gray-l1, var(--app-gray-l1, #cccccc)));white-space:nowrap;overflow-x:hidden;-ms-flex-align:center;align-items:center}.tab-list li.nav{position:absolute;height:44px;width:46px}.tab-list li.nav-left{left:-15px;background:-webkit-gradient(linear, left top, right top, color-stop(60%, var(--tct-section-bg, var(--t-section-bg, #ffffff))), to(transparent));background:linear-gradient(to right, var(--tct-section-bg, var(--t-section-bg, #ffffff)) 60%, transparent)}.tab-list li.nav-right{right:-15px;background:-webkit-gradient(linear, right top, left top, color-stop(60%, var(--tct-section-bg, var(--t-section-bg, #ffffff))), to(transparent));background:linear-gradient(to left, var(--tct-section-bg, var(--t-section-bg, #ffffff)) 60%, transparent)}.tab-list li.nav .arrow-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:inherit;width:inherit;cursor:pointer}.tab-list li.nav .arrow-container a{padding:0;margin:0;height:inherit;width:inherit;border-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.tab-list li.nav .arrow-container a q2-icon{width:19px;height:19px}.tab-list a{text-decoration:none;padding:var(--tct-scale-2, var(--app-scale-2, 10px));margin:var(--tct-scale-1, var(--app-scale-1, 5px)) var(--tct-scale-1, var(--app-scale-1, 5px))\n 0;color:var(--tct-tab-inactive-color, var(--t-tab-inactive, inherit));font-size:var(--tct-tab-font-size, var(--t-tab-font-size, 17px));border-bottom:3px solid transparent;display:block;-webkit-transition:color var(--tct-tween-2, var(--app-tween-2, 0.4s ease)),\n border-color var(--tct-tween-1, var(--app-tween-1, 0.2s ease));transition:color var(--tct-tween-2, var(--app-tween-2, 0.4s ease)),\n border-color var(--tct-tween-1, var(--app-tween-1, 0.2s ease))}:host([type='section']) .tab-list a{font-size:inherit;padding:var(--tct-scale-2, var(--app-scale-2, 10px))\n var(--tct-scale-1, var(--app-scale-1, 5px))}@media screen and (max-width: 767px){.tab-list a{font-size:inherit;padding:var(--tct-scale-2, var(--app-scale-2, 10px))\n var(--tct-scale-1, var(--app-scale-1, 5px))}}.tab-list a:hover{color:var(--tct-tab-active-color, var(--t-tab-active, #2e2e2e));background-color:var(--tct-tab-hover-bg-color, var(--t-tab-hover-bg-color, inherit));width:var(--tct-tab-hover-width, var(--t-tab-hover-width, 100%))}.tab-list a[aria-selected='true']{color:var(--tct-tab-active-color, var(--t-tab-active, #2e2e2e));border-color:currentColor;width:var(--tct-tab-active-width, var(--t-tab-active-width, 100%));background-color:var(--tct-tab-active-bg-color, var(--t-tab-active-bg-color, inherit))}:host([color='alt']) .tab-list a{color:var(--tct-tab-alt-inactive-color, var(--t-tab-alt-inactive, inherit))}:host([color='alt']) .tab-list a:hover,:host([color='alt']) .tab-list a[aria-selected='true']{color:var(--tct-tab-alt-active-color, var(--t-tab-alt-active, inherit))}.tab-content{padding:var(--tct-scale-2, var(--app-scale-2, 10px)) 0}";
|
|
1031
|
-
|
|
1032
461
|
const Q2TabContainer = class {
|
|
1033
462
|
constructor(hostRef) {
|
|
1034
463
|
registerInstance(this, hostRef);
|
|
@@ -1036,16 +465,9 @@ const Q2TabContainer = class {
|
|
|
1036
465
|
this.settled = createEvent(this, "settled", 7);
|
|
1037
466
|
this.guid = createGuid();
|
|
1038
467
|
this.scheduledAfterRender = [];
|
|
468
|
+
this.lastScrolled = new Date(null).getTime();
|
|
1039
469
|
this.hasLeft = false;
|
|
1040
470
|
this.hasRight = false;
|
|
1041
|
-
this.initTabScroll = () => {
|
|
1042
|
-
const tabList = this.hostElement.shadowRoot.querySelector('.tab-list');
|
|
1043
|
-
if (tabList) {
|
|
1044
|
-
const { scrollWidth, clientWidth, scrollLeft } = tabList;
|
|
1045
|
-
this.hasLeft = scrollLeft > 0;
|
|
1046
|
-
this.hasRight = scrollWidth > clientWidth;
|
|
1047
|
-
}
|
|
1048
|
-
};
|
|
1049
471
|
///////// Actions /////////
|
|
1050
472
|
this.updateTabData = () => {
|
|
1051
473
|
this.updateTabPaneProps();
|
|
@@ -1081,34 +503,77 @@ const Q2TabContainer = class {
|
|
|
1081
503
|
this.moveToAdjacentTab(value, 'prev');
|
|
1082
504
|
return;
|
|
1083
505
|
}
|
|
506
|
+
if (event.code === 'Space' || event.code === 'Enter') {
|
|
507
|
+
// to prevent triggering scroll when press the space key
|
|
508
|
+
event.preventDefault();
|
|
509
|
+
this.change.emit({ value });
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
1084
512
|
};
|
|
1085
513
|
this.moveToAdjacentTab = (value, direction) => {
|
|
1086
514
|
let index = this.tabs.map(({ value }) => value).indexOf(value);
|
|
1087
|
-
let
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
515
|
+
let newIndex = direction === 'next'
|
|
516
|
+
? Math.min(index + 1, this.tabs.length - 1)
|
|
517
|
+
: Math.max(index - 1, 0);
|
|
518
|
+
if (index !== newIndex) {
|
|
519
|
+
const focusedTab = this.moveFocus(newIndex);
|
|
520
|
+
// Scroll only if it overflows
|
|
521
|
+
if (this.tabList.scrollWidth > this.tabList.clientWidth) {
|
|
522
|
+
// Scroll only if it's first or last tab
|
|
523
|
+
if (newIndex !== 0 && newIndex !== this.tabs.length - 1) {
|
|
524
|
+
this.scrollByKeyboard(direction, focusedTab);
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
// first or last element: just show or hide nav arrow
|
|
528
|
+
this.onTabScroll(direction);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
1095
531
|
}
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
532
|
+
};
|
|
533
|
+
this.moveFocus = (index) => {
|
|
534
|
+
const focusedValue = this.tabs[index].value;
|
|
535
|
+
const focusedTab = this.hostElement.shadowRoot.querySelector(`.tab-list a[data-value="${focusedValue}"]`);
|
|
536
|
+
focusedTab.focus({ preventScroll: true });
|
|
537
|
+
return focusedTab;
|
|
538
|
+
};
|
|
539
|
+
this.calculateKeyboardScroll = (direction, focusedTab) => {
|
|
540
|
+
const { left: tabListLeft } = this.tabList.getBoundingClientRect();
|
|
541
|
+
const { left: focusedTabLeft } = focusedTab.getBoundingClientRect();
|
|
542
|
+
const arrowWidth = 46;
|
|
543
|
+
let scrollAmount = 0;
|
|
544
|
+
// check how much focused tab overflows
|
|
545
|
+
if (direction === 'next' &&
|
|
546
|
+
focusedTabLeft + focusedTab.clientWidth >
|
|
547
|
+
tabListLeft + this.tabList.clientWidth + arrowWidth) {
|
|
548
|
+
scrollAmount =
|
|
549
|
+
this.tabList.scrollLeft +
|
|
550
|
+
arrowWidth +
|
|
551
|
+
(focusedTabLeft + focusedTab.clientWidth) -
|
|
552
|
+
(tabListLeft + this.tabList.clientWidth);
|
|
553
|
+
}
|
|
554
|
+
else if (direction === 'prev' && focusedTabLeft + arrowWidth < tabListLeft) {
|
|
555
|
+
scrollAmount = this.tabList.scrollLeft - arrowWidth + (focusedTabLeft - tabListLeft);
|
|
556
|
+
}
|
|
557
|
+
return scrollAmount;
|
|
558
|
+
};
|
|
559
|
+
this.scrollByKeyboard = (direction, focusedTab) => {
|
|
560
|
+
const scrollAmount = this.calculateKeyboardScroll(direction, focusedTab);
|
|
561
|
+
if (scrollAmount !== 0) {
|
|
562
|
+
this.tabList.scroll({ left: scrollAmount, behavior: 'smooth' });
|
|
563
|
+
// wait to finish scroll then show or hide nav arrow
|
|
564
|
+
setTimeout(() => this.onTabScroll(), 100);
|
|
1102
565
|
}
|
|
1103
566
|
};
|
|
1104
567
|
this.calculateTabScroll = ({ direction, scrollWidth, clientWidth, scrollLeft }) => {
|
|
568
|
+
const directions = { prev: -1, next: 1 };
|
|
569
|
+
// step 0 means no scroll needed, re-render or resize can trigger this
|
|
570
|
+
const step = directions[direction] || 0;
|
|
1105
571
|
const scrollRate = 0.5; // half of visual width
|
|
1106
|
-
const step = direction === 'left' ? -1 : 1;
|
|
1107
572
|
const delta = Math.round(clientWidth * scrollRate);
|
|
1108
573
|
const newScrollLeft = scrollLeft + step * delta;
|
|
1109
574
|
const scrolled = clientWidth + newScrollLeft;
|
|
1110
575
|
const hasLeft = newScrollLeft > 0;
|
|
1111
|
-
const hasRight = scrollWidth
|
|
576
|
+
const hasRight = scrollWidth > scrolled;
|
|
1112
577
|
return {
|
|
1113
578
|
newScrollLeft,
|
|
1114
579
|
hasLeft,
|
|
@@ -1116,8 +581,14 @@ const Q2TabContainer = class {
|
|
|
1116
581
|
};
|
|
1117
582
|
};
|
|
1118
583
|
this.onTabScroll = (direction) => {
|
|
1119
|
-
|
|
1120
|
-
|
|
584
|
+
// throttle under 50ms due to re-rendering & resizing
|
|
585
|
+
const now = new Date().getTime();
|
|
586
|
+
if (now - this.lastScrolled < 50)
|
|
587
|
+
return;
|
|
588
|
+
this.lastScrolled = now;
|
|
589
|
+
if (!this.tabList)
|
|
590
|
+
return;
|
|
591
|
+
let { scrollWidth, clientWidth, scrollLeft } = this.tabList;
|
|
1121
592
|
const { newScrollLeft, hasLeft, hasRight } = this.calculateTabScroll({
|
|
1122
593
|
direction,
|
|
1123
594
|
scrollWidth,
|
|
@@ -1126,7 +597,9 @@ const Q2TabContainer = class {
|
|
|
1126
597
|
});
|
|
1127
598
|
this.hasLeft = hasLeft;
|
|
1128
599
|
this.hasRight = hasRight;
|
|
1129
|
-
|
|
600
|
+
if (direction) {
|
|
601
|
+
this.tabList.scroll({ left: newScrollLeft, behavior: 'smooth' });
|
|
602
|
+
}
|
|
1130
603
|
};
|
|
1131
604
|
}
|
|
1132
605
|
loc(key, subs) {
|
|
@@ -1149,12 +622,25 @@ const Q2TabContainer = class {
|
|
|
1149
622
|
get selectedTabValue() {
|
|
1150
623
|
return this.value || this.tabPanes[0].value || '';
|
|
1151
624
|
}
|
|
625
|
+
get tabList() {
|
|
626
|
+
return this.hostElement.shadowRoot.querySelector('.tab-list');
|
|
627
|
+
}
|
|
1152
628
|
///////// Default Handler /////////
|
|
1153
629
|
defaultChangeHandler(event) {
|
|
1154
630
|
if (event.target === this.hostElement && !this.hostElement.onchange) {
|
|
1155
631
|
this.value = event.detail.value;
|
|
1156
632
|
}
|
|
1157
633
|
}
|
|
634
|
+
onResize() {
|
|
635
|
+
this.onTabScroll();
|
|
636
|
+
}
|
|
637
|
+
onFocus() {
|
|
638
|
+
// firefox receives focus on overflowed element even if it's not interactive element
|
|
639
|
+
if (isFirefox) {
|
|
640
|
+
const index = this.tabs.findIndex(el => el.value === this.selectedTabValue);
|
|
641
|
+
this.moveFocus(index);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
1158
644
|
///////// Lifecycle Hooks /////////
|
|
1159
645
|
componentWillLoad() {
|
|
1160
646
|
const observer = new MutationObserver(this.updateTabData);
|
|
@@ -1166,18 +652,11 @@ const Q2TabContainer = class {
|
|
|
1166
652
|
this.scheduledAfterRender.forEach(fn => fn());
|
|
1167
653
|
this.scheduledAfterRender = [];
|
|
1168
654
|
this.settled.emit();
|
|
1169
|
-
|
|
1170
|
-
this.initTabScroll();
|
|
1171
|
-
this.resizeSubscription = fromEvent(window, 'resize')
|
|
1172
|
-
.pipe(debounce(() => interval(200)))
|
|
1173
|
-
.subscribe(this.initTabScroll);
|
|
1174
|
-
}
|
|
655
|
+
this.onTabScroll();
|
|
1175
656
|
}
|
|
1176
657
|
disconnectedCallback() {
|
|
1177
658
|
this.mutationObserver.disconnect();
|
|
1178
659
|
this.mutationObserver = null;
|
|
1179
|
-
this.resizeSubscription.unsubscribe();
|
|
1180
|
-
this.resizeSubscription = null;
|
|
1181
660
|
}
|
|
1182
661
|
///////// Observers /////////
|
|
1183
662
|
valueObserver() {
|
|
@@ -1189,7 +668,7 @@ const Q2TabContainer = class {
|
|
|
1189
668
|
}
|
|
1190
669
|
///////// View Methods /////////
|
|
1191
670
|
render() {
|
|
1192
|
-
return (h("div", { class: "tab-container" }, h("ul", { class: "tab-list", role: "tablist" }, this.hasLeft && (h("li", { role: "presentation", class: "nav nav-left", onClick: () => this.onTabScroll('
|
|
671
|
+
return (h("div", { class: "tab-container" }, h("ul", { class: "tab-list", role: "tablist" }, this.hasLeft && (h("li", { role: "presentation", class: "nav nav-left", onClick: () => this.onTabScroll('prev') }, h("div", { class: "arrow-container" }, h("a", null, h("q2-icon", { type: "chevron-left" }))))), this.tabs.map((tab, index) => this.generateTab(tab, index)), this.hasRight && (h("li", { role: "presentation", class: "nav nav-right", onClick: () => this.onTabScroll('next') }, h("div", { class: "arrow-container" }, h("a", null, h("q2-icon", { type: "chevron-right" })))))), h("div", { class: "tab-content" }, h("slot", null))));
|
|
1193
672
|
}
|
|
1194
673
|
generateTab(tab, index) {
|
|
1195
674
|
const { label, value } = tab;
|