@flarehr/apollo-benefits 0.1.109 → 0.3.53405
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/assets/@splitsoftware-7d799540.js +18 -0
- package/dist/assets/all_tab_color-548783b9.svg +21 -0
- package/dist/assets/all_tab_gray-a5051313.svg +6 -0
- package/dist/assets/check-57fe1dcb.svg +15 -0
- package/dist/assets/datadog-ff247651.js +5 -0
- package/dist/assets/date-fns-c5d8fbc0.js +1 -0
- package/dist/assets/default_backdrop-fdd955b8.png +0 -0
- package/dist/assets/external_link-599a0aec.svg +3 -0
- package/dist/assets/external_link_white-55111b2e.svg +3 -0
- package/dist/assets/framer-motion-bb8d6b82.js +1 -0
- package/dist/assets/index-0b3afb09.js +5 -0
- package/dist/assets/index-5e9e5aa9.js +35 -0
- package/dist/assets/index-cfa25e28.css +1 -0
- package/dist/assets/lodash-5d893f8c.js +1 -0
- package/dist/assets/logo-a34e9b4b.png +0 -0
- package/dist/assets/oidc-client-6f6e47c2.js +101 -0
- package/dist/assets/padlock-8c081120.svg +26 -0
- package/dist/assets/suitcase-6471ad05.svg +17 -0
- package/dist/assets/vendor-2d0139ca.js +788 -0
- package/dist/assets/warning-a7f1af23.svg +14 -0
- package/dist/assets/welcome_image_mobile-dbde6c80.png +0 -0
- package/dist/assets/welcome_image_v2-869c59e4.png +0 -0
- package/dist/assets/wellbeing_banner-6903d615.png +0 -0
- package/dist/assets/workplace_link_banner_mobile-6ebaa24b.png +0 -0
- package/dist/assets/workplace_link_banner_v2-c81ed849.png +0 -0
- package/dist/config.json +14 -0
- package/dist/favicon.ico +0 -0
- package/dist/icons/android-chrome-192x192.png +0 -0
- package/dist/icons/android-chrome-512x512.png +0 -0
- package/dist/icons/apple-touch-icon.png +0 -0
- package/dist/icons/favicon-16x16.png +0 -0
- package/dist/icons/favicon-32x32.png +0 -0
- package/dist/index.html +114 -0
- package/dist/manifest.json +21 -0
- package/dist/sw-esm.js +16 -0
- package/package.json +129 -60
- package/LICENSE +0 -21
- package/dist/lib/apollo-benefits/apollo-benefits.esm.js +0 -1
- package/dist/lib/apollo-benefits/assets/car-placeholder.svg +0 -5
- package/dist/lib/apollo-benefits/assets/check.svg +0 -13
- package/dist/lib/apollo-benefits/index.esm.js +0 -0
- package/dist/lib/apollo-benefits/p-06a1f65f.js +0 -1
- package/dist/lib/apollo-benefits/p-077d7f8d.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-14054f15.js +0 -1
- package/dist/lib/apollo-benefits/p-24a37d64.js +0 -1
- package/dist/lib/apollo-benefits/p-2b3f3b72.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-3111d565.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-327396fa.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-3d4d2683.js +0 -1
- package/dist/lib/apollo-benefits/p-4474bcf8.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-4bff99bd.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-50fe790f.js +0 -1
- package/dist/lib/apollo-benefits/p-53bcbd1d.js +0 -1
- package/dist/lib/apollo-benefits/p-68c136da.js +0 -1
- package/dist/lib/apollo-benefits/p-6bd16f5b.js +0 -1
- package/dist/lib/apollo-benefits/p-71dbc8ff.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-774d9bc5.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-7a2ca86d.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-7a572b50.js +0 -1
- package/dist/lib/apollo-benefits/p-7c2cd94a.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-839493d7.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-a24d169b.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-b33fc683.js +0 -1
- package/dist/lib/apollo-benefits/p-beb8f728.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-e241f55b.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-e28cee25.js +0 -1
- package/dist/lib/apollo-benefits/p-e3cf51f1.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-ef8ea713.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-f0a7c9fa.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-f603197d.js +0 -15
- package/dist/lib/cjs/active-router-0ecaf2b8.js +0 -75
- package/dist/lib/cjs/ap-ben-choose-vehicle-section_4.cjs.entry.js +0 -2708
- package/dist/lib/cjs/ap-ben-complete-section_4.cjs.entry.js +0 -108
- package/dist/lib/cjs/ap-ben-notifications-section.cjs.entry.js +0 -238
- package/dist/lib/cjs/apollo-benefits.cjs.js +0 -25
- package/dist/lib/cjs/app-globals-67583b8b.js +0 -12
- package/dist/lib/cjs/async-6a7926f0.js +0 -753
- package/dist/lib/cjs/cars-calculator-app.cjs.entry.js +0 -55
- package/dist/lib/cjs/cars-calculator.service-c0e51584.js +0 -904
- package/dist/lib/cjs/context-consumer.cjs.entry.js +0 -29
- package/dist/lib/cjs/datorama-akita-31d23240.js +0 -2551
- package/dist/lib/cjs/delay-d31618c3.js +0 -206
- package/dist/lib/cjs/distinctUntilChanged-e8538790.js +0 -371
- package/dist/lib/cjs/dom-utils-b8befdd5.js +0 -63
- package/dist/lib/cjs/fl-button_2.cjs.entry.js +0 -50
- package/dist/lib/cjs/fl-dropdown-async_2.cjs.entry.js +0 -467
- package/dist/lib/cjs/fl-dropdown.cjs.entry.js +0 -232
- package/dist/lib/cjs/fl-style-guide.cjs.entry.js +0 -91
- package/dist/lib/cjs/index-f1fadf90.js +0 -1735
- package/dist/lib/cjs/index.cjs.js +0 -2
- package/dist/lib/cjs/loader.cjs.js +0 -27
- package/dist/lib/cjs/location-utils-36fe7e5e.js +0 -237
- package/dist/lib/cjs/match-path-be4ea5f6.js +0 -279
- package/dist/lib/cjs/session.query-d61ba7ec.js +0 -1731
- package/dist/lib/cjs/stencil-async-content.cjs.entry.js +0 -32
- package/dist/lib/cjs/stencil-route-link.cjs.entry.js +0 -78
- package/dist/lib/cjs/stencil-route-switch.cjs.entry.js +0 -104
- package/dist/lib/cjs/stencil-route-title.cjs.entry.js +0 -32
- package/dist/lib/cjs/stencil-route.cjs.entry.js +0 -97
- package/dist/lib/cjs/stencil-router-prompt.cjs.entry.js +0 -59
- package/dist/lib/cjs/stencil-router-redirect.cjs.entry.js +0 -32
- package/dist/lib/cjs/stencil-router.cjs.entry.js +0 -640
- package/dist/lib/collection/assets/image/complete.svg +0 -122
- package/dist/lib/collection/collection-manifest.json +0 -53
- package/dist/lib/collection/components/cars-calculator-app/api/api-client.js +0 -5
- package/dist/lib/collection/components/cars-calculator-app/api/cars-calculator.api.js +0 -45
- package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.css +0 -22
- package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.js +0 -97
- package/dist/lib/collection/components/cars-calculator-app/modal-section/modal-section.css +0 -0
- package/dist/lib/collection/components/cars-calculator-app/modal-section/modal-section.js +0 -144
- package/dist/lib/collection/components/cars-calculator-app/notifications-section/notifications-section.js +0 -25
- package/dist/lib/collection/components/cars-calculator-app/pages/assets/car-placeholder.svg +0 -5
- package/dist/lib/collection/components/cars-calculator-app/pages/assets/check.svg +0 -13
- package/dist/lib/collection/components/cars-calculator-app/pages/choose-vehicle-section.component.js +0 -196
- package/dist/lib/collection/components/cars-calculator-app/pages/complete-section.component.js +0 -38
- package/dist/lib/collection/components/cars-calculator-app/pages/cost-breakdown-section.component.js +0 -45
- package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.css +0 -34
- package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.js +0 -85
- package/dist/lib/collection/components/cars-calculator-app/pages/personal-info-section.component.js +0 -66
- package/dist/lib/collection/components/cars-calculator-app/pages/quote-result-section.component.js +0 -86
- package/dist/lib/collection/components/cars-calculator-app/pages/submit-quote-section.component.js +0 -75
- package/dist/lib/collection/components/cars-calculator-app/services/app-configuration.service.js +0 -13
- package/dist/lib/collection/components/cars-calculator-app/services/cars-calculator.service.js +0 -106
- package/dist/lib/collection/components/cars-calculator-app/services/notifications.service.js +0 -37
- package/dist/lib/collection/components/cars-calculator-app/services/notifications.store.js +0 -3
- package/dist/lib/collection/components/cars-calculator-app/services/session.query.js +0 -35
- package/dist/lib/collection/components/cars-calculator-app/services/session.store.js +0 -78
- package/dist/lib/collection/global/config.js +0 -2
- package/dist/lib/collection/global/main.dev.js +0 -5
- package/dist/lib/collection/global/main.js +0 -5
- package/dist/lib/collection/index.js +0 -2
- package/dist/lib/collection/utils/config.js +0 -2
- package/dist/lib/collection/utils/index.js +0 -15
- package/dist/lib/collection/utils/lazy.js +0 -29
- package/dist/lib/esm/active-router-7c2ca849.js +0 -73
- package/dist/lib/esm/ap-ben-choose-vehicle-section_4.entry.js +0 -2701
- package/dist/lib/esm/ap-ben-complete-section_4.entry.js +0 -101
- package/dist/lib/esm/ap-ben-notifications-section.entry.js +0 -234
- package/dist/lib/esm/apollo-benefits.js +0 -23
- package/dist/lib/esm/app-globals-65714cca.js +0 -10
- package/dist/lib/esm/async-68e9cad7.js +0 -738
- package/dist/lib/esm/cars-calculator-app.entry.js +0 -51
- package/dist/lib/esm/cars-calculator.service-27826530.js +0 -897
- package/dist/lib/esm/context-consumer.entry.js +0 -25
- package/dist/lib/esm/datorama-akita-c87196a0.js +0 -2545
- package/dist/lib/esm/delay-115d4292.js +0 -200
- package/dist/lib/esm/distinctUntilChanged-bf69e0f8.js +0 -363
- package/dist/lib/esm/dom-utils-109a7d75.js +0 -55
- package/dist/lib/esm/fl-button_2.entry.js +0 -45
- package/dist/lib/esm/fl-dropdown-async_2.entry.js +0 -462
- package/dist/lib/esm/fl-dropdown.entry.js +0 -228
- package/dist/lib/esm/fl-style-guide.entry.js +0 -87
- package/dist/lib/esm/index-19c4d245.js +0 -1703
- package/dist/lib/esm/index.js +0 -1
- package/dist/lib/esm/loader.js +0 -23
- package/dist/lib/esm/location-utils-312665d3.js +0 -226
- package/dist/lib/esm/match-path-4b5c7d98.js +0 -276
- package/dist/lib/esm/polyfills/core-js.js +0 -11
- package/dist/lib/esm/polyfills/css-shim.js +0 -1
- package/dist/lib/esm/polyfills/dom.js +0 -79
- package/dist/lib/esm/polyfills/es5-html-element.js +0 -1
- package/dist/lib/esm/polyfills/index.js +0 -34
- package/dist/lib/esm/polyfills/system.js +0 -6
- package/dist/lib/esm/session.query-0f1c9503.js +0 -1719
- package/dist/lib/esm/stencil-async-content.entry.js +0 -28
- package/dist/lib/esm/stencil-route-link.entry.js +0 -74
- package/dist/lib/esm/stencil-route-switch.entry.js +0 -100
- package/dist/lib/esm/stencil-route-title.entry.js +0 -28
- package/dist/lib/esm/stencil-route.entry.js +0 -93
- package/dist/lib/esm/stencil-router-prompt.entry.js +0 -55
- package/dist/lib/esm/stencil-router-redirect.entry.js +0 -28
- package/dist/lib/esm/stencil-router.entry.js +0 -636
- package/dist/lib/index.cjs.js +0 -1
- package/dist/lib/index.js +0 -1
- package/dist/lib/loader/cdn.js +0 -3
- package/dist/lib/loader/index.cjs.js +0 -3
- package/dist/lib/loader/index.d.ts +0 -13
- package/dist/lib/loader/index.es2017.js +0 -3
- package/dist/lib/loader/index.js +0 -4
- package/dist/lib/loader/package.json +0 -10
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/button/button.css +0 -45
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown/dropdown.css +0 -9
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown-async/dropdown-async.css +0 -9
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/loading-indicator/loading-indicator.css +0 -141
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/promise-button/promise-button.css +0 -5
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/style-guide/style-guide.css +0 -0
- package/dist/lib/node_modules/@stencil/router/dist/collection/components/route/route.css +0 -3
- package/dist/lib/types/components/cars-calculator-app/api/api-client.d.ts +0 -2
- package/dist/lib/types/components/cars-calculator-app/api/cars-calculator.api.d.ts +0 -99
- package/dist/lib/types/components/cars-calculator-app/cars-calculator-app.d.ts +0 -17
- package/dist/lib/types/components/cars-calculator-app/modal-section/modal-section.d.ts +0 -16
- package/dist/lib/types/components/cars-calculator-app/notifications-section/notifications-section.d.ts +0 -5
- package/dist/lib/types/components/cars-calculator-app/pages/choose-vehicle-section.component.d.ts +0 -23
- package/dist/lib/types/components/cars-calculator-app/pages/complete-section.component.d.ts +0 -5
- package/dist/lib/types/components/cars-calculator-app/pages/cost-breakdown-section.component.d.ts +0 -6
- package/dist/lib/types/components/cars-calculator-app/pages/model-variants-section.component.d.ts +0 -12
- package/dist/lib/types/components/cars-calculator-app/pages/personal-info-section.component.d.ts +0 -10
- package/dist/lib/types/components/cars-calculator-app/pages/quote-result-section.component.d.ts +0 -13
- package/dist/lib/types/components/cars-calculator-app/pages/submit-quote-section.component.d.ts +0 -10
- package/dist/lib/types/components/cars-calculator-app/services/app-configuration.service.d.ts +0 -7
- package/dist/lib/types/components/cars-calculator-app/services/cars-calculator.service.d.ts +0 -11
- package/dist/lib/types/components/cars-calculator-app/services/notifications.service.d.ts +0 -15
- package/dist/lib/types/components/cars-calculator-app/services/notifications.store.d.ts +0 -14
- package/dist/lib/types/components/cars-calculator-app/services/session.query.d.ts +0 -25
- package/dist/lib/types/components/cars-calculator-app/services/session.store.d.ts +0 -77
- package/dist/lib/types/components.d.ts +0 -170
- package/dist/lib/types/global/config.d.ts +0 -2
- package/dist/lib/types/global/main.d.ts +0 -1
- package/dist/lib/types/global/main.dev.d.ts +0 -1
- package/dist/lib/types/index.d.ts +0 -2
- package/dist/lib/types/stencil-public-runtime.d.ts +0 -1555
- package/dist/lib/types/utils/config.d.ts +0 -2
- package/dist/lib/types/utils/index.d.ts +0 -7
- package/dist/lib/types/utils/lazy.d.ts +0 -12
- package/readme.md +0 -1
|
@@ -1,462 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, e as createEvent, h } from './index-19c4d245.js';
|
|
2
|
-
import { e as isArray, O as Observable, f as isFunction, d as async, a as Subscriber } from './async-68e9cad7.js';
|
|
3
|
-
import { f as from, m as map, S as SimpleOuterSubscriber, a as SimpleInnerSubscriber, i as innerSubscribe, d as distinctUntilChanged, b as filter } from './distinctUntilChanged-bf69e0f8.js';
|
|
4
|
-
|
|
5
|
-
function noop() { }
|
|
6
|
-
|
|
7
|
-
function mergeMap(project, resultSelector, concurrent = Number.POSITIVE_INFINITY) {
|
|
8
|
-
if (typeof resultSelector === 'function') {
|
|
9
|
-
return (source) => source.pipe(mergeMap((a, i) => from(project(a, i)).pipe(map((b, ii) => resultSelector(a, b, i, ii))), concurrent));
|
|
10
|
-
}
|
|
11
|
-
else if (typeof resultSelector === 'number') {
|
|
12
|
-
concurrent = resultSelector;
|
|
13
|
-
}
|
|
14
|
-
return (source) => source.lift(new MergeMapOperator(project, concurrent));
|
|
15
|
-
}
|
|
16
|
-
class MergeMapOperator {
|
|
17
|
-
constructor(project, concurrent = Number.POSITIVE_INFINITY) {
|
|
18
|
-
this.project = project;
|
|
19
|
-
this.concurrent = concurrent;
|
|
20
|
-
}
|
|
21
|
-
call(observer, source) {
|
|
22
|
-
return source.subscribe(new MergeMapSubscriber(observer, this.project, this.concurrent));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
class MergeMapSubscriber extends SimpleOuterSubscriber {
|
|
26
|
-
constructor(destination, project, concurrent = Number.POSITIVE_INFINITY) {
|
|
27
|
-
super(destination);
|
|
28
|
-
this.project = project;
|
|
29
|
-
this.concurrent = concurrent;
|
|
30
|
-
this.hasCompleted = false;
|
|
31
|
-
this.buffer = [];
|
|
32
|
-
this.active = 0;
|
|
33
|
-
this.index = 0;
|
|
34
|
-
}
|
|
35
|
-
_next(value) {
|
|
36
|
-
if (this.active < this.concurrent) {
|
|
37
|
-
this._tryNext(value);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
this.buffer.push(value);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
_tryNext(value) {
|
|
44
|
-
let result;
|
|
45
|
-
const index = this.index++;
|
|
46
|
-
try {
|
|
47
|
-
result = this.project(value, index);
|
|
48
|
-
}
|
|
49
|
-
catch (err) {
|
|
50
|
-
this.destination.error(err);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
this.active++;
|
|
54
|
-
this._innerSub(result);
|
|
55
|
-
}
|
|
56
|
-
_innerSub(ish) {
|
|
57
|
-
const innerSubscriber = new SimpleInnerSubscriber(this);
|
|
58
|
-
const destination = this.destination;
|
|
59
|
-
destination.add(innerSubscriber);
|
|
60
|
-
const innerSubscription = innerSubscribe(ish, innerSubscriber);
|
|
61
|
-
if (innerSubscription !== innerSubscriber) {
|
|
62
|
-
destination.add(innerSubscription);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
_complete() {
|
|
66
|
-
this.hasCompleted = true;
|
|
67
|
-
if (this.active === 0 && this.buffer.length === 0) {
|
|
68
|
-
this.destination.complete();
|
|
69
|
-
}
|
|
70
|
-
this.unsubscribe();
|
|
71
|
-
}
|
|
72
|
-
notifyNext(innerValue) {
|
|
73
|
-
this.destination.next(innerValue);
|
|
74
|
-
}
|
|
75
|
-
notifyComplete() {
|
|
76
|
-
const buffer = this.buffer;
|
|
77
|
-
this.active--;
|
|
78
|
-
if (buffer.length > 0) {
|
|
79
|
-
this._next(buffer.shift());
|
|
80
|
-
}
|
|
81
|
-
else if (this.active === 0 && this.hasCompleted) {
|
|
82
|
-
this.destination.complete();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function fromEvent(target, eventName, options, resultSelector) {
|
|
88
|
-
if (isFunction(options)) {
|
|
89
|
-
resultSelector = options;
|
|
90
|
-
options = undefined;
|
|
91
|
-
}
|
|
92
|
-
if (resultSelector) {
|
|
93
|
-
return fromEvent(target, eventName, options).pipe(map(args => isArray(args) ? resultSelector(...args) : resultSelector(args)));
|
|
94
|
-
}
|
|
95
|
-
return new Observable(subscriber => {
|
|
96
|
-
function handler(e) {
|
|
97
|
-
if (arguments.length > 1) {
|
|
98
|
-
subscriber.next(Array.prototype.slice.call(arguments));
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
subscriber.next(e);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
setupSubscription(target, eventName, handler, subscriber, options);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
function setupSubscription(sourceObj, eventName, handler, subscriber, options) {
|
|
108
|
-
let unsubscribe;
|
|
109
|
-
if (isEventTarget(sourceObj)) {
|
|
110
|
-
const source = sourceObj;
|
|
111
|
-
sourceObj.addEventListener(eventName, handler, options);
|
|
112
|
-
unsubscribe = () => source.removeEventListener(eventName, handler, options);
|
|
113
|
-
}
|
|
114
|
-
else if (isJQueryStyleEventEmitter(sourceObj)) {
|
|
115
|
-
const source = sourceObj;
|
|
116
|
-
sourceObj.on(eventName, handler);
|
|
117
|
-
unsubscribe = () => source.off(eventName, handler);
|
|
118
|
-
}
|
|
119
|
-
else if (isNodeStyleEventEmitter(sourceObj)) {
|
|
120
|
-
const source = sourceObj;
|
|
121
|
-
sourceObj.addListener(eventName, handler);
|
|
122
|
-
unsubscribe = () => source.removeListener(eventName, handler);
|
|
123
|
-
}
|
|
124
|
-
else if (sourceObj && sourceObj.length) {
|
|
125
|
-
for (let i = 0, len = sourceObj.length; i < len; i++) {
|
|
126
|
-
setupSubscription(sourceObj[i], eventName, handler, subscriber, options);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
throw new TypeError('Invalid event target');
|
|
131
|
-
}
|
|
132
|
-
subscriber.add(unsubscribe);
|
|
133
|
-
}
|
|
134
|
-
function isNodeStyleEventEmitter(sourceObj) {
|
|
135
|
-
return sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function';
|
|
136
|
-
}
|
|
137
|
-
function isJQueryStyleEventEmitter(sourceObj) {
|
|
138
|
-
return sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function';
|
|
139
|
-
}
|
|
140
|
-
function isEventTarget(sourceObj) {
|
|
141
|
-
return sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function';
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function debounceTime(dueTime, scheduler = async) {
|
|
145
|
-
return (source) => source.lift(new DebounceTimeOperator(dueTime, scheduler));
|
|
146
|
-
}
|
|
147
|
-
class DebounceTimeOperator {
|
|
148
|
-
constructor(dueTime, scheduler) {
|
|
149
|
-
this.dueTime = dueTime;
|
|
150
|
-
this.scheduler = scheduler;
|
|
151
|
-
}
|
|
152
|
-
call(subscriber, source) {
|
|
153
|
-
return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler));
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
class DebounceTimeSubscriber extends Subscriber {
|
|
157
|
-
constructor(destination, dueTime, scheduler) {
|
|
158
|
-
super(destination);
|
|
159
|
-
this.dueTime = dueTime;
|
|
160
|
-
this.scheduler = scheduler;
|
|
161
|
-
this.debouncedSubscription = null;
|
|
162
|
-
this.lastValue = null;
|
|
163
|
-
this.hasValue = false;
|
|
164
|
-
}
|
|
165
|
-
_next(value) {
|
|
166
|
-
this.clearDebounce();
|
|
167
|
-
this.lastValue = value;
|
|
168
|
-
this.hasValue = true;
|
|
169
|
-
this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this));
|
|
170
|
-
}
|
|
171
|
-
_complete() {
|
|
172
|
-
this.debouncedNext();
|
|
173
|
-
this.destination.complete();
|
|
174
|
-
}
|
|
175
|
-
debouncedNext() {
|
|
176
|
-
this.clearDebounce();
|
|
177
|
-
if (this.hasValue) {
|
|
178
|
-
const { lastValue } = this;
|
|
179
|
-
this.lastValue = null;
|
|
180
|
-
this.hasValue = false;
|
|
181
|
-
this.destination.next(lastValue);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
clearDebounce() {
|
|
185
|
-
const debouncedSubscription = this.debouncedSubscription;
|
|
186
|
-
if (debouncedSubscription !== null) {
|
|
187
|
-
this.remove(debouncedSubscription);
|
|
188
|
-
debouncedSubscription.unsubscribe();
|
|
189
|
-
this.debouncedSubscription = null;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
function dispatchNext(subscriber) {
|
|
194
|
-
subscriber.debouncedNext();
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function tap(nextOrObserver, error, complete) {
|
|
198
|
-
return function tapOperatorFunction(source) {
|
|
199
|
-
return source.lift(new DoOperator(nextOrObserver, error, complete));
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
class DoOperator {
|
|
203
|
-
constructor(nextOrObserver, error, complete) {
|
|
204
|
-
this.nextOrObserver = nextOrObserver;
|
|
205
|
-
this.error = error;
|
|
206
|
-
this.complete = complete;
|
|
207
|
-
}
|
|
208
|
-
call(subscriber, source) {
|
|
209
|
-
return source.subscribe(new TapSubscriber(subscriber, this.nextOrObserver, this.error, this.complete));
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
class TapSubscriber extends Subscriber {
|
|
213
|
-
constructor(destination, observerOrNext, error, complete) {
|
|
214
|
-
super(destination);
|
|
215
|
-
this._tapNext = noop;
|
|
216
|
-
this._tapError = noop;
|
|
217
|
-
this._tapComplete = noop;
|
|
218
|
-
this._tapError = error || noop;
|
|
219
|
-
this._tapComplete = complete || noop;
|
|
220
|
-
if (isFunction(observerOrNext)) {
|
|
221
|
-
this._context = this;
|
|
222
|
-
this._tapNext = observerOrNext;
|
|
223
|
-
}
|
|
224
|
-
else if (observerOrNext) {
|
|
225
|
-
this._context = observerOrNext;
|
|
226
|
-
this._tapNext = observerOrNext.next || noop;
|
|
227
|
-
this._tapError = observerOrNext.error || noop;
|
|
228
|
-
this._tapComplete = observerOrNext.complete || noop;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
_next(value) {
|
|
232
|
-
try {
|
|
233
|
-
this._tapNext.call(this._context, value);
|
|
234
|
-
}
|
|
235
|
-
catch (err) {
|
|
236
|
-
this.destination.error(err);
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
this.destination.next(value);
|
|
240
|
-
}
|
|
241
|
-
_error(err) {
|
|
242
|
-
try {
|
|
243
|
-
this._tapError.call(this._context, err);
|
|
244
|
-
}
|
|
245
|
-
catch (err) {
|
|
246
|
-
this.destination.error(err);
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
this.destination.error(err);
|
|
250
|
-
}
|
|
251
|
-
_complete() {
|
|
252
|
-
try {
|
|
253
|
-
this._tapComplete.call(this._context);
|
|
254
|
-
}
|
|
255
|
-
catch (err) {
|
|
256
|
-
this.destination.error(err);
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
return this.destination.complete();
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
const dropdownAsyncCss = "fl-dropdown .dropdown-menu{max-height:min(20rem, 50vh)}fl-dropdown .dropdown-menu .dropdown-item{cursor:pointer}fl-dropdown .dropdown-menu .dropdown-item.selected{background-color:rgba(253, 189, 0, 0.5)}";
|
|
264
|
-
|
|
265
|
-
const DEFAULT_SEARCH_LENGTH = 3;
|
|
266
|
-
const SelectInputAsync = class {
|
|
267
|
-
constructor(hostRef) {
|
|
268
|
-
registerInstance(this, hostRef);
|
|
269
|
-
this.valueChanged = createEvent(this, "valueChanged", 7);
|
|
270
|
-
this.required = false;
|
|
271
|
-
this.disabled = false;
|
|
272
|
-
this.minSearchStringLength = DEFAULT_SEARCH_LENGTH;
|
|
273
|
-
this.isMouseOver = false;
|
|
274
|
-
this.searchState = 'pristine';
|
|
275
|
-
this.inputValue = '';
|
|
276
|
-
this.isDropdownVisible = false;
|
|
277
|
-
this.filteredOptions = [];
|
|
278
|
-
this.shouldExecuteSearch = (searchQuery) => {
|
|
279
|
-
var _a;
|
|
280
|
-
return (this.isDropdownVisible &&
|
|
281
|
-
(searchQuery === null || searchQuery === void 0 ? void 0 : searchQuery.length) >= this.minSearchStringLength &&
|
|
282
|
-
((_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.label) !== searchQuery);
|
|
283
|
-
};
|
|
284
|
-
this.onBeginSearch = (searchQuery) => {
|
|
285
|
-
this.inputValue = searchQuery;
|
|
286
|
-
this.searchState = 'in progress';
|
|
287
|
-
};
|
|
288
|
-
this.onCompleteSearch = (results) => {
|
|
289
|
-
this.filteredOptions = results;
|
|
290
|
-
this.highlightedOptionIndex = undefined;
|
|
291
|
-
this.searchState = 'done';
|
|
292
|
-
};
|
|
293
|
-
this.renderFilteredResults = () => {
|
|
294
|
-
if (this.searchState === 'pristine') {
|
|
295
|
-
return h("span", { class: "dropdown-item disabled" }, "Start typing to find the results");
|
|
296
|
-
}
|
|
297
|
-
if (this.searchState === 'in progress') {
|
|
298
|
-
return (h("div", { class: "d-flex justify-content-end align-items-center pr-4" }, h("span", { class: "dropdown-item disabled" }, "Searching..."), h("i", { class: "dot-falling" })));
|
|
299
|
-
}
|
|
300
|
-
if (this.filteredOptions.length === 0) {
|
|
301
|
-
return h("span", { class: "dropdown-item disabled" }, "No items match your search");
|
|
302
|
-
}
|
|
303
|
-
return this.filteredOptions.map((option, index) => (h("span", { class: {
|
|
304
|
-
'dropdown-item text-wrap': true,
|
|
305
|
-
selected: this.isOptionSelected(option),
|
|
306
|
-
active: this.highlightedOptionIndex === index
|
|
307
|
-
}, onClick: (_event) => {
|
|
308
|
-
this.toggleDropdown(false);
|
|
309
|
-
this.selectOption(option);
|
|
310
|
-
} }, option.label)));
|
|
311
|
-
};
|
|
312
|
-
this.resetInput = () => {
|
|
313
|
-
var _a, _b;
|
|
314
|
-
this.inputValue = (_b = (_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : '';
|
|
315
|
-
};
|
|
316
|
-
this.toggleDropdown = (newState) => {
|
|
317
|
-
this.isDropdownVisible = newState;
|
|
318
|
-
};
|
|
319
|
-
this.processKeyboardNavigation = (event) => {
|
|
320
|
-
const ENTER_KEY = 'Enter';
|
|
321
|
-
const DOWN_KEY = 'ArrowDown';
|
|
322
|
-
const UP_KEY = 'ArrowUp';
|
|
323
|
-
const ESC_KEY = 'Escape';
|
|
324
|
-
switch (event.key) {
|
|
325
|
-
case DOWN_KEY:
|
|
326
|
-
this.toggleDropdown(true);
|
|
327
|
-
this.highlightNextItem();
|
|
328
|
-
return true;
|
|
329
|
-
case UP_KEY:
|
|
330
|
-
this.highlightPreviousItem();
|
|
331
|
-
return true;
|
|
332
|
-
case ENTER_KEY:
|
|
333
|
-
if (this.highlightedOptionIndex !== undefined) {
|
|
334
|
-
this.toggleDropdown(false);
|
|
335
|
-
this.selectOption(this.filteredOptions[this.highlightedOptionIndex]);
|
|
336
|
-
}
|
|
337
|
-
return true;
|
|
338
|
-
case ESC_KEY:
|
|
339
|
-
this.inputElement.blur();
|
|
340
|
-
return true;
|
|
341
|
-
}
|
|
342
|
-
return false;
|
|
343
|
-
};
|
|
344
|
-
this.highlightPreviousItem = () => {
|
|
345
|
-
if (this.filteredOptions.length === 0) {
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
this.highlightedOptionIndex =
|
|
349
|
-
this.highlightedOptionIndex === undefined ? 0 : Math.max(this.highlightedOptionIndex - 1, 0);
|
|
350
|
-
};
|
|
351
|
-
this.highlightNextItem = () => {
|
|
352
|
-
if (this.filteredOptions.length === 0) {
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
this.highlightedOptionIndex =
|
|
356
|
-
this.highlightedOptionIndex === undefined
|
|
357
|
-
? 0
|
|
358
|
-
: Math.min(this.highlightedOptionIndex + 1, this.filteredOptions.length - 1);
|
|
359
|
-
};
|
|
360
|
-
this.selectOption = (option) => {
|
|
361
|
-
this.selectedOption = option;
|
|
362
|
-
this.inputValue = option.label;
|
|
363
|
-
this.valueChanged.emit(option);
|
|
364
|
-
};
|
|
365
|
-
this.isOptionSelected = (option) => {
|
|
366
|
-
var _a;
|
|
367
|
-
return ((_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.label) === option.label;
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
componentWillLoad() {
|
|
371
|
-
this.selectedOption = this.value;
|
|
372
|
-
}
|
|
373
|
-
componentDidLoad() {
|
|
374
|
-
this.searchResultsSubscription = fromEvent(this.inputElement, 'keyup')
|
|
375
|
-
.pipe(debounceTime(500), map((_) => this.inputElement.value), distinctUntilChanged(), filter(this.shouldExecuteSearch), tap(this.onBeginSearch), mergeMap(this._searchFunction), tap(this.onCompleteSearch))
|
|
376
|
-
.subscribe();
|
|
377
|
-
}
|
|
378
|
-
componentDidUnload() {
|
|
379
|
-
this.searchResultsSubscription.unsubscribe();
|
|
380
|
-
}
|
|
381
|
-
handleFocus() {
|
|
382
|
-
this.toggleDropdown(true);
|
|
383
|
-
}
|
|
384
|
-
handleBlur() {
|
|
385
|
-
if (this.isMouseOver) {
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
this.toggleDropdown(false);
|
|
389
|
-
this.highlightedOptionIndex = undefined;
|
|
390
|
-
this.resetInput();
|
|
391
|
-
}
|
|
392
|
-
handleKeyDown(event) {
|
|
393
|
-
if (this.processKeyboardNavigation(event)) {
|
|
394
|
-
event.preventDefault();
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
render() {
|
|
398
|
-
var _a;
|
|
399
|
-
return [
|
|
400
|
-
h("div", { class: "dropdown" }, h("input", { type: "text", class: "form-control", placeholder: this.placeholder, required: this.required, disabled: this.disabled, value: this.inputValue, ref: (el) => (this.inputElement = el) }), h("div", { class: {
|
|
401
|
-
'invalid-feedback': true,
|
|
402
|
-
'd-none': this.isDropdownVisible
|
|
403
|
-
} }, (_a = this.requiredValidationMessage) !== null && _a !== void 0 ? _a : 'Required.'), h("div", { class: {
|
|
404
|
-
'dropdown-menu shadow mt-0 w-100 overflow-auto': true,
|
|
405
|
-
show: this.isDropdownVisible
|
|
406
|
-
}, onMouseEnter: (_event) => (this.isMouseOver = true), onMouseLeave: (_event) => (this.isMouseOver = false) }, this.renderFilteredResults()))
|
|
407
|
-
];
|
|
408
|
-
}
|
|
409
|
-
get _searchFunction() {
|
|
410
|
-
if (this.searchFunction === undefined) {
|
|
411
|
-
throw new Error("Can't render <fl-dropdown-async/> component with no searchFunction");
|
|
412
|
-
}
|
|
413
|
-
return this.searchFunction;
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
SelectInputAsync.style = dropdownAsyncCss;
|
|
417
|
-
|
|
418
|
-
const promiseButtonCss = "fl-promise-button fl-loading-indicator{left:50%;top:50%;transform:translate(-50%, -50%)}";
|
|
419
|
-
|
|
420
|
-
var PromiseButtonState;
|
|
421
|
-
(function (PromiseButtonState) {
|
|
422
|
-
PromiseButtonState[PromiseButtonState["Available"] = 0] = "Available";
|
|
423
|
-
PromiseButtonState[PromiseButtonState["Pending"] = 1] = "Pending";
|
|
424
|
-
PromiseButtonState[PromiseButtonState["Error"] = 2] = "Error";
|
|
425
|
-
})(PromiseButtonState || (PromiseButtonState = {}));
|
|
426
|
-
const PromiseButton = class {
|
|
427
|
-
constructor(hostRef) {
|
|
428
|
-
registerInstance(this, hostRef);
|
|
429
|
-
this.isBlockElement = false;
|
|
430
|
-
this.isRounded = false;
|
|
431
|
-
this.disabled = false;
|
|
432
|
-
this.variant = 'primary';
|
|
433
|
-
this.promiseFn = () => Promise.resolve();
|
|
434
|
-
// tslint:disable-next-line: member-ordering
|
|
435
|
-
this.state = PromiseButtonState.Available;
|
|
436
|
-
}
|
|
437
|
-
render() {
|
|
438
|
-
return this.state === PromiseButtonState.Pending
|
|
439
|
-
? this.renderLoadingButton()
|
|
440
|
-
: this.renderActiveButton();
|
|
441
|
-
}
|
|
442
|
-
renderActiveButton() {
|
|
443
|
-
return (h("fl-button", { disabled: this.disabled, onClick: () => this.clicked(), isBlockElement: this.isBlockElement, variant: this.variant }, h("div", null, h("slot", null))));
|
|
444
|
-
}
|
|
445
|
-
renderLoadingButton() {
|
|
446
|
-
return (h("fl-button", { disabled: true, onClick: () => this.clicked(), isBlockElement: this.isBlockElement, class: "position-relative", variant: this.variant }, h("fl-loading-indicator", { class: "position-absolute", theme: "dark" }), h("div", { class: "invisible" }, h("slot", null))));
|
|
447
|
-
}
|
|
448
|
-
async clicked() {
|
|
449
|
-
this.state = PromiseButtonState.Pending;
|
|
450
|
-
try {
|
|
451
|
-
await this.promiseFn();
|
|
452
|
-
this.state = PromiseButtonState.Available;
|
|
453
|
-
}
|
|
454
|
-
catch (err) {
|
|
455
|
-
this.state = PromiseButtonState.Error;
|
|
456
|
-
throw err;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
PromiseButton.style = promiseButtonCss;
|
|
461
|
-
|
|
462
|
-
export { SelectInputAsync as fl_dropdown_async, PromiseButton as fl_promise_button };
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, e as createEvent, h } from './index-19c4d245.js';
|
|
2
|
-
|
|
3
|
-
var src = {
|
|
4
|
-
compareTwoStrings,
|
|
5
|
-
findBestMatch
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
function compareTwoStrings(first, second) {
|
|
9
|
-
first = first.replace(/\s+/g, '');
|
|
10
|
-
second = second.replace(/\s+/g, '');
|
|
11
|
-
|
|
12
|
-
if (!first.length && !second.length) return 1; // if both are empty strings
|
|
13
|
-
if (!first.length || !second.length) return 0; // if only one is empty string
|
|
14
|
-
if (first === second) return 1; // identical
|
|
15
|
-
if (first.length === 1 && second.length === 1) return 0; // both are 1-letter strings
|
|
16
|
-
if (first.length < 2 || second.length < 2) return 0; // if either is a 1-letter string
|
|
17
|
-
|
|
18
|
-
let firstBigrams = new Map();
|
|
19
|
-
for (let i = 0; i < first.length - 1; i++) {
|
|
20
|
-
const bigram = first.substring(i, i + 2);
|
|
21
|
-
const count = firstBigrams.has(bigram)
|
|
22
|
-
? firstBigrams.get(bigram) + 1
|
|
23
|
-
: 1;
|
|
24
|
-
|
|
25
|
-
firstBigrams.set(bigram, count);
|
|
26
|
-
}
|
|
27
|
-
let intersectionSize = 0;
|
|
28
|
-
for (let i = 0; i < second.length - 1; i++) {
|
|
29
|
-
const bigram = second.substring(i, i + 2);
|
|
30
|
-
const count = firstBigrams.has(bigram)
|
|
31
|
-
? firstBigrams.get(bigram)
|
|
32
|
-
: 0;
|
|
33
|
-
|
|
34
|
-
if (count > 0) {
|
|
35
|
-
firstBigrams.set(bigram, count - 1);
|
|
36
|
-
intersectionSize++;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (2.0 * intersectionSize) / (first.length + second.length - 2);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function findBestMatch(mainString, targetStrings) {
|
|
44
|
-
if (!areArgsValid(mainString, targetStrings)) throw new Error('Bad arguments: First argument should be a string, second should be an array of strings');
|
|
45
|
-
|
|
46
|
-
const ratings = [];
|
|
47
|
-
let bestMatchIndex = 0;
|
|
48
|
-
|
|
49
|
-
for (let i = 0; i < targetStrings.length; i++) {
|
|
50
|
-
const currentTargetString = targetStrings[i];
|
|
51
|
-
const currentRating = compareTwoStrings(mainString, currentTargetString);
|
|
52
|
-
ratings.push({target: currentTargetString, rating: currentRating});
|
|
53
|
-
if (currentRating > ratings[bestMatchIndex].rating) {
|
|
54
|
-
bestMatchIndex = i;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const bestMatch = ratings[bestMatchIndex];
|
|
60
|
-
|
|
61
|
-
return { ratings, bestMatch, bestMatchIndex };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function areArgsValid(mainString, targetStrings) {
|
|
65
|
-
if (typeof mainString !== 'string') return false;
|
|
66
|
-
if (!Array.isArray(targetStrings)) return false;
|
|
67
|
-
if (!targetStrings.length) return false;
|
|
68
|
-
if (targetStrings.find(s => typeof s !== 'string')) return false;
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const dropdownCss = "fl-dropdown .dropdown-menu{max-height:min(20rem, 50vh)}fl-dropdown .dropdown-menu .dropdown-item{cursor:pointer}fl-dropdown .dropdown-menu .dropdown-item.selected{background-color:rgba(253, 189, 0, 0.5)}";
|
|
73
|
-
|
|
74
|
-
const Dropdown = class {
|
|
75
|
-
constructor(hostRef) {
|
|
76
|
-
registerInstance(this, hostRef);
|
|
77
|
-
this.valueChanged = createEvent(this, "valueChanged", 7);
|
|
78
|
-
this.required = false;
|
|
79
|
-
this.disabled = false;
|
|
80
|
-
this.isMouseOver = false;
|
|
81
|
-
this.inputValue = '';
|
|
82
|
-
this.isDropdownVisible = false;
|
|
83
|
-
this.filteredOptions = [];
|
|
84
|
-
this.renderFilteredResults = () => {
|
|
85
|
-
if (this.filteredOptions.length === 0) {
|
|
86
|
-
return h("span", { class: "dropdown-item disabled" }, "No items match your search");
|
|
87
|
-
}
|
|
88
|
-
return this.filteredOptions.map((option, index) => (h("span", { class: {
|
|
89
|
-
'dropdown-item text-wrap': true,
|
|
90
|
-
selected: this.isOptionSelected(option),
|
|
91
|
-
active: this.highlightedOptionIndex === index
|
|
92
|
-
}, onClick: (_event) => {
|
|
93
|
-
this.toggleDropdown(false);
|
|
94
|
-
this.selectOption(option);
|
|
95
|
-
} }, h("span", null, option.label))));
|
|
96
|
-
};
|
|
97
|
-
this.filterResults = (searchString) => {
|
|
98
|
-
this.filteredOptions = this.sortOptionsByRelevancy(this._options.filter((option) => option.label.toLowerCase().includes(searchString.toLowerCase())), searchString);
|
|
99
|
-
this.highlightedOptionIndex = undefined;
|
|
100
|
-
};
|
|
101
|
-
this.selectOption = (option) => {
|
|
102
|
-
this.selectedOption = option;
|
|
103
|
-
this.inputValue = option.label;
|
|
104
|
-
this.valueChanged.emit(option);
|
|
105
|
-
};
|
|
106
|
-
this.isOptionSelected = (option) => {
|
|
107
|
-
var _a;
|
|
108
|
-
return ((_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.label) === option.label;
|
|
109
|
-
};
|
|
110
|
-
this.toggleDropdown = (newState) => {
|
|
111
|
-
this.isDropdownVisible = newState;
|
|
112
|
-
};
|
|
113
|
-
this.resetInput = () => {
|
|
114
|
-
var _a, _b;
|
|
115
|
-
this.inputValue = (_b = (_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : '';
|
|
116
|
-
this.filteredOptions = this._options;
|
|
117
|
-
};
|
|
118
|
-
this.processKeyboardNavigation = (event) => {
|
|
119
|
-
const ENTER_KEY = 'Enter';
|
|
120
|
-
const DOWN_KEY = 'ArrowDown';
|
|
121
|
-
const UP_KEY = 'ArrowUp';
|
|
122
|
-
const ESC_KEY = 'Escape';
|
|
123
|
-
switch (event.key) {
|
|
124
|
-
case DOWN_KEY:
|
|
125
|
-
this.toggleDropdown(true);
|
|
126
|
-
this.highlightNextItem();
|
|
127
|
-
return true;
|
|
128
|
-
case UP_KEY:
|
|
129
|
-
this.highlightPreviousItem();
|
|
130
|
-
return true;
|
|
131
|
-
case ENTER_KEY:
|
|
132
|
-
if (this.highlightedOptionIndex !== undefined) {
|
|
133
|
-
this.toggleDropdown(false);
|
|
134
|
-
this.selectOption(this.filteredOptions[this.highlightedOptionIndex]);
|
|
135
|
-
}
|
|
136
|
-
return true;
|
|
137
|
-
case ESC_KEY:
|
|
138
|
-
this.inputElement.blur();
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
return false;
|
|
142
|
-
};
|
|
143
|
-
this.highlightPreviousItem = () => {
|
|
144
|
-
if (this.filteredOptions.length === 0) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
this.highlightedOptionIndex =
|
|
148
|
-
this.highlightedOptionIndex === undefined ? 0 : Math.max(this.highlightedOptionIndex - 1, 0);
|
|
149
|
-
};
|
|
150
|
-
this.highlightNextItem = () => {
|
|
151
|
-
if (this.filteredOptions.length === 0) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
this.highlightedOptionIndex =
|
|
155
|
-
this.highlightedOptionIndex === undefined
|
|
156
|
-
? 0
|
|
157
|
-
: Math.min(this.highlightedOptionIndex + 1, this.filteredOptions.length - 1);
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
get _options() {
|
|
161
|
-
if (this.options === undefined) {
|
|
162
|
-
throw new Error("Can't render <fl-dropdown /> component with no options");
|
|
163
|
-
}
|
|
164
|
-
return this.options;
|
|
165
|
-
}
|
|
166
|
-
componentWillLoad() {
|
|
167
|
-
var _a, _b;
|
|
168
|
-
this.filteredOptions = this._options;
|
|
169
|
-
this.selectedOption = this._options.find((item) => item.value === this.value);
|
|
170
|
-
this.inputValue = (_b = (_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : '';
|
|
171
|
-
}
|
|
172
|
-
handleFocus() {
|
|
173
|
-
this.toggleDropdown(true);
|
|
174
|
-
}
|
|
175
|
-
handleBlur() {
|
|
176
|
-
if (this.isMouseOver) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
this.toggleDropdown(false);
|
|
180
|
-
this.resetInput();
|
|
181
|
-
}
|
|
182
|
-
handleKeyDown(event) {
|
|
183
|
-
if (this.processKeyboardNavigation(event)) {
|
|
184
|
-
event.preventDefault();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
onOptionsChanged() {
|
|
188
|
-
this.filteredOptions = this._options;
|
|
189
|
-
}
|
|
190
|
-
onValueChanged() {
|
|
191
|
-
var _a, _b;
|
|
192
|
-
this.selectedOption = this._options.find((item) => item.value === this.value);
|
|
193
|
-
this.inputValue = (_b = (_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : '';
|
|
194
|
-
}
|
|
195
|
-
render() {
|
|
196
|
-
var _a;
|
|
197
|
-
return [
|
|
198
|
-
h("div", { class: "dropdown" }, h("input", { type: "text", class: "form-control custom-select", placeholder: this.placeholder, required: this.required, disabled: this.disabled, value: this.inputValue, onInput: (event) => {
|
|
199
|
-
const newValue = event.target.value;
|
|
200
|
-
this.inputValue = newValue;
|
|
201
|
-
this.filterResults(newValue);
|
|
202
|
-
this.toggleDropdown(true);
|
|
203
|
-
}, ref: (el) => (this.inputElement = el) }), h("div", { class: {
|
|
204
|
-
'invalid-feedback': true,
|
|
205
|
-
'd-none': this.isDropdownVisible
|
|
206
|
-
} }, (_a = this.requiredValidationMessage) !== null && _a !== void 0 ? _a : 'Required.'), h("div", { class: {
|
|
207
|
-
'dropdown-menu shadow mt-0 w-100 overflow-auto': true,
|
|
208
|
-
show: this.isDropdownVisible
|
|
209
|
-
}, onMouseEnter: (_event) => (this.isMouseOver = true), onMouseLeave: (_event) => (this.isMouseOver = false) }, this.renderFilteredResults()))
|
|
210
|
-
];
|
|
211
|
-
}
|
|
212
|
-
sortOptionsByRelevancy(options, searchString) {
|
|
213
|
-
return options
|
|
214
|
-
.map((option) => (Object.assign(Object.assign({}, option), { relevancyScore: src.compareTwoStrings(option.label.toLowerCase(), searchString.toLowerCase()) })))
|
|
215
|
-
.sort((a, b) => b.relevancyScore - a.relevancyScore)
|
|
216
|
-
.map((weightedOption) => ({
|
|
217
|
-
label: weightedOption.label,
|
|
218
|
-
value: weightedOption.value
|
|
219
|
-
}));
|
|
220
|
-
}
|
|
221
|
-
static get watchers() { return {
|
|
222
|
-
"options": ["onOptionsChanged"],
|
|
223
|
-
"value": ["onValueChanged"]
|
|
224
|
-
}; }
|
|
225
|
-
};
|
|
226
|
-
Dropdown.style = dropdownCss;
|
|
227
|
-
|
|
228
|
-
export { Dropdown as fl_dropdown };
|