@24i/bigscreen-sdk 1.0.4 → 1.0.5-4.alpha-2832
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 +2 -3
- package/ci/is_ci_job_skippable.sh +153 -0
- package/package.json +55 -34
- package/packages/adobe-heartbeat/src/AdobeHeartbeat.ts +9 -9
- package/packages/analytics/README.md +8 -0
- package/packages/analytics/src/A.ts +1 -0
- package/packages/analytics/src/Analytics.ts +1 -0
- package/packages/analytics/src/analyticsOnScroll.ts +1 -0
- package/packages/analytics/src/clients/ConsoleAnalytics/ConsoleAnalytics.ts +1 -0
- package/packages/analytics/src/clients/ConsoleAnalytics/index.ts +1 -0
- package/packages/analytics/src/clients/GoogleAnalytics/GoogleAnalytics.ts +196 -0
- package/packages/analytics/src/clients/GoogleAnalytics/constants.ts +126 -0
- package/packages/analytics/src/clients/GoogleAnalytics/getUrl.ts +17 -0
- package/packages/analytics/src/clients/GoogleAnalytics/index.ts +2 -0
- package/packages/analytics/src/clients/GoogleAnalytics/interface.ts +82 -0
- package/packages/analytics/src/clients/GoogleAnalytics/mapPayload.ts +51 -0
- package/packages/analytics/src/clients/GoogleAnalytics/prepareBody.ts +14 -0
- package/packages/analytics/src/clients/TealiumAnalytics/TealiumAnalytics.ts +181 -0
- package/packages/analytics/src/clients/TealiumAnalytics/constants.ts +106 -0
- package/packages/analytics/src/clients/TealiumAnalytics/findForLanguage.ts +9 -0
- package/packages/analytics/src/clients/TealiumAnalytics/index.ts +4 -0
- package/packages/analytics/src/clients/TealiumAnalytics/interface.ts +35 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/__mocks__/mediaPayload.ts +72 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/helper.ts +36 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppError.ts +13 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppOpen.ts +13 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteAdd.ts +11 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteRemove.ts +11 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerClose.ts +15 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerOpen.ts +15 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSceneView.ts +18 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearch.ts +18 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchFailed.ts +8 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchSuccess.ts +8 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoPause.ts +15 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoProgress.ts +18 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoResume.ts +15 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStart.ts +15 -0
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStop.ts +15 -0
- package/packages/analytics/src/clients/TealiumAnalytics/types.ts +161 -0
- package/packages/analytics/src/clients/TwentyFourIQ/TwentyFourIQClient.ts +107 -0
- package/packages/analytics/src/clients/TwentyFourIQ/constants.ts +111 -0
- package/packages/analytics/src/clients/TwentyFourIQ/helper.ts +34 -0
- package/packages/analytics/src/clients/TwentyFourIQ/index.ts +2 -0
- package/packages/analytics/src/clients/TwentyFourIQ/interface.ts +34 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdEvent.ts +20 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBase.ts +24 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBuffering.ts +15 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerClose.ts +25 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerOpen.ts +17 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapSceneView.ts +15 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapScroll.ts +17 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoComplete.ts +22 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoPause.ts +25 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoProgress.ts +25 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStart.ts +34 -0
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStop.ts +32 -0
- package/packages/analytics/src/clients/TwentyFourIQ/types.ts +132 -0
- package/packages/analytics/src/constants.ts +1 -0
- package/packages/analytics/src/index.ts +3 -0
- package/packages/analytics/src/interface.ts +1 -0
- package/packages/analytics/src/utils/generateSessionId.ts +8 -0
- package/packages/async-image/src/AsyncImage.tsx +15 -10
- package/packages/developer-tools/PlayerDebugWindow/README.md +1 -1
- package/packages/developer-tools/src/DeveloperConsole/DeveloperConsole.tsx +1 -0
- package/packages/developer-tools/src/DeveloperToolsService/DeveloperToolsList.tsx +11 -0
- package/packages/developer-tools/src/PlayerDebugWindow/PlayerDebugWindow.tsx +5 -5
- package/packages/developer-tools/src/PlayerDebugWindow/constants.ts +15 -0
- package/packages/developer-tools/src/TechnicalInfo/TechnicalInfo.tsx +2 -0
- package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoDetail.tsx +2 -1
- package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoProvider.ts +57 -5
- package/packages/developer-tools/src/TechnicalInfo/__mocks__/Device.ts +12 -0
- package/packages/developer-tools/src/TechnicalInfo/translations.ts +8 -0
- package/packages/device/src/driver/index.android.tv.ts +1 -0
- package/packages/device/src/driver/index.firetv.ts +1 -0
- package/packages/device/src/driver/index.smartcast.tv.ts +1 -0
- package/packages/device/src/getKeyDigit.ts +2 -2
- package/packages/device/src/resolver/resolver.ts +19 -0
- package/packages/digital-clock/src/DigitalClock.tsx +15 -4
- package/packages/driver-androidtv/src/DeviceAndroidTV.ts +262 -0
- package/packages/driver-androidtv/src/__mocks__/javaScriptBridge.ts +45 -0
- package/packages/driver-androidtv/src/formatUserAgent.ts +11 -0
- package/packages/driver-androidtv/src/index.ts +2 -0
- package/packages/driver-androidtv/src/keymap.ts +27 -0
- package/packages/driver-androidtv/src/types.ts +155 -0
- package/packages/driver-base/src/DeviceBase.ts +73 -2
- package/packages/driver-base/src/KeyMap/Key.ts +8 -1
- package/packages/driver-base/src/KeyMap/KeyMap.ts +4 -0
- package/packages/driver-base/src/KeyMap/interface.ts +1 -0
- package/packages/driver-base/src/KeyMap/overrideValues.ts +2 -1
- package/packages/driver-base/src/__mocks__/DeviceBase.ts +24 -0
- package/packages/driver-base/src/__mocks__/keyMap.ts +1 -0
- package/packages/driver-base/src/index.ts +3 -0
- package/packages/driver-base/src/types/AdInfo.ts +5 -0
- package/packages/driver-base/src/types/DeviceEvent.ts +2 -0
- package/packages/driver-base/src/types/InAppPurchase.ts +20 -0
- package/packages/driver-base/src/types/KeycodeKeyMap.ts +1 -0
- package/packages/driver-browser/src/DeviceBrowser.ts +26 -0
- package/packages/driver-browser/src/keymap.ts +8 -0
- package/packages/driver-entone/src/DeviceEntone.ts +31 -1
- package/packages/driver-entone/src/keymap.ts +1 -0
- package/packages/driver-firetv/src/DeviceFireTV.ts +86 -0
- package/packages/driver-firetv/src/__mocks__/javaScriptBridge.ts +45 -0
- package/packages/driver-firetv/src/index.ts +1 -0
- package/packages/driver-firetv/src/types.ts +1 -0
- package/packages/driver-hbbtv/src/DeviceHbbTV.ts +26 -0
- package/packages/driver-kreatv/src/DeviceKreaTV.ts +26 -0
- package/packages/driver-saphi/src/DeviceSaphi.ts +26 -0
- package/packages/driver-smartcast/src/DeviceSmartCast.ts +380 -0
- package/packages/driver-smartcast/src/__mocks__/api.ts +69 -0
- package/packages/driver-smartcast/src/index.ts +1 -0
- package/packages/driver-smartcast/src/keymap.ts +9 -0
- package/packages/driver-smartcast/src/types.ts +102 -0
- package/packages/driver-tizen/src/DeviceTizen.ts +121 -7
- package/packages/driver-tizen/src/ITizen.ts +15116 -202
- package/packages/driver-tizen/src/IWebapis.ts +8643 -87
- package/packages/driver-tizen/src/TizenKeys.ts +4 -2
- package/packages/driver-tizen/src/__mocks__/tizen.ts +7 -8
- package/packages/driver-tizen/src/constants.ts +1 -195
- package/packages/driver-vidaa/src/DeviceVidaa.ts +29 -2
- package/packages/driver-vidaa/src/__mocks__/vidaa.ts +1 -1
- package/packages/driver-vidaa/src/keymap.ts +2 -0
- package/packages/driver-webos/src/DeviceWebos.ts +55 -0
- package/packages/driver-webos/src/__mocks__/webos.ts +33 -0
- package/packages/driver-webos/src/constants.ts +1 -0
- package/packages/driver-webos/src/keymap.ts +2 -1
- package/packages/driver-webos/src/types.ts +30 -0
- package/packages/driver-xbox/src/DeviceXbox.ts +30 -1
- package/packages/driver-xbox/src/keymap.ts +1 -1
- package/packages/epg/README.md +3 -1
- package/packages/epg/src/v2/Cell.tsx +16 -2
- package/packages/epg/src/v2/DataManager.ts +112 -41
- package/packages/epg/src/v2/DatePicker.tsx +9 -3
- package/packages/epg/src/v2/DateToast/DateToast.tsx +12 -9
- package/packages/epg/src/v2/Day.tsx +6 -3
- package/packages/epg/src/v2/Epg.tsx +5 -5
- package/packages/epg/src/v2/MockGenerator/generator.ts +3 -2
- package/packages/epg/src/v2/ProgramInfo/utils.ts +4 -3
- package/packages/epg/src/v2/Row.tsx +3 -1
- package/packages/epg/src/v2/TimelineSection.tsx +4 -1
- package/packages/epg/src/v2/basic/CellsManager.tsx +7 -2
- package/packages/epg/src/v2/basic/RowsManager.tsx +3 -1
- package/packages/epg/src/v2/interface.ts +13 -0
- package/packages/events-manager/src/EventsManager.ts +1 -56
- package/packages/focus/README.md +33 -0
- package/packages/focus/src/IFocusable.ts +1 -0
- package/packages/focus/src/Layout/Base.tsx +41 -6
- package/packages/focus/src/Layout/Matrix.tsx +51 -19
- package/packages/focus/src/focusFirstExisting.ts +7 -1
- package/packages/focus/src/hasFocus.ts +36 -0
- package/packages/focus/src/index.ts +2 -1
- package/packages/gallup/src/Gallup.ts +3 -3
- package/packages/grid/src/Base/Base.tsx +15 -10
- package/packages/grid/src/FirstOnlyGrid/FirstOnlyGrid.tsx +4 -2
- package/packages/grid/src/UnifiedGridController/UnifiedGridController.ts +6 -6
- package/packages/icon/src/Icon.tsx +27 -5
- package/packages/input/README.md +1 -1
- package/packages/input/src/Input.tsx +10 -10
- package/packages/interactable/README.md +2 -1
- package/packages/interactable/src/Interactable.tsx +9 -3
- package/packages/interactable/src/interface.ts +1 -0
- package/packages/jsx/src/index.ts +1 -1
- package/packages/jsx/src/test-utils/index.ts +1 -0
- package/packages/jsx/src/test-utils/keyup.ts +27 -0
- package/packages/keyboard/README.md +2 -0
- package/packages/keyboard/src/Backdrop/Backdrop.scss +2 -0
- package/packages/keyboard/src/KeyboardBase.tsx +16 -4
- package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.scss +10 -0
- package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.tsx +128 -142
- package/packages/keyboard/src/WhitelabelKeyboard/WhitelabelStyles/whitelabel.scss +4 -0
- package/packages/keyboard/src/WhitelabelKeyboard/_sizes.1080.scss +1 -0
- package/packages/keyboard/src/WhitelabelKeyboard/_sizes.scss +1 -0
- package/packages/keyboard/src/WhitelabelKeyboard/icons/key_language.svg +20 -0
- package/packages/keyboard/src/WhitelabelKeyboard/index.ts +1 -1
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/arabic.ts +27 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/burmese.ts +27 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/dari.ts +28 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/hebrew.ts +28 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/index.ts +15 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/korean.ts +26 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/latin.ts +26 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/pashto.ts +27 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/persian.ts +27 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/russian.ts +27 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/spanish.ts +26 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/special.ts +28 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/tibetan.ts +26 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/turkish.ts +26 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/ukrainian.ts +27 -0
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/urdu.ts +26 -0
- package/packages/keyboard/src/WhitelabelKeyboard/types.ts +22 -2
- package/packages/keyboard/src/types/index.ts +1 -1
- package/packages/keyboard/src/utils/caret.ts +5 -8
- package/packages/keyboard/src/utils/input.ts +5 -6
- package/packages/keyboard/src/utils/setInputSelectionRange.ts +10 -0
- package/packages/l10n/README.md +18 -0
- package/packages/l10n/src/date/common.ts +18 -6
- package/packages/l10n/src/date/cs.ts +2 -8
- package/packages/l10n/src/date/de.ts +97 -0
- package/packages/l10n/src/date/en-001.ts +3 -3
- package/packages/l10n/src/date/en-common.ts +5 -4
- package/packages/l10n/src/date/en-us.ts +3 -3
- package/packages/l10n/src/date/es.ts +71 -0
- package/packages/l10n/src/date/fr.ts +94 -0
- package/packages/l10n/src/date/he.ts +101 -0
- package/packages/l10n/src/date/iso.ts +12 -13
- package/packages/l10n/src/date/types.ts +9 -0
- package/packages/l10n/src/l10n.ts +61 -3
- package/packages/list/src/Base/Base.tsx +19 -9
- package/packages/list/src/Base/interface.ts +2 -2
- package/packages/list/src/BasicList/BasicList.tsx +7 -7
- package/packages/list/src/CenteredList/CenteredList.tsx +2 -2
- package/packages/list/src/CenteredList/controller.ts +0 -1
- package/packages/list/src/EdgeOffsetList/EdgeOffsetList.tsx +10 -10
- package/packages/list/src/FirstOnlyList/FirstOnlyList.tsx +2 -2
- package/packages/list/src/FirstOnlyVariedList/FirstOnlyVariedList.tsx +2 -2
- package/packages/list/src/FixedToEndList/FixedToEndList.tsx +2 -2
- package/packages/list/src/UnifiedListController/UnifiedListController.ts +6 -2
- package/packages/list/src/interface.ts +2 -2
- package/packages/logger/src/loggers/ConsoleLogger/ConsoleLogger.ts +7 -1
- package/packages/logger/src/loggers/SentryLogger/Sentry.ts +1 -0
- package/packages/logger/src/loggers/SentryLogger/SentryLogger.ts +5 -3
- package/packages/menu/src/MenuAndContentContainer/MenuAndContentContainer.tsx +31 -3
- package/packages/menu/src/MenuAndContentContainer/interface.ts +8 -0
- package/packages/modal-service/README.md +4 -1
- package/packages/modal-service/src/ModalService.tsx +29 -5
- package/packages/perf-utils/README.md +1 -120
- package/packages/perf-utils/src/array/filter.ts +1 -54
- package/packages/perf-utils/src/array/find.ts +1 -43
- package/packages/perf-utils/src/array/findIndex.ts +1 -43
- package/packages/perf-utils/src/array/forEach.ts +1 -48
- package/packages/perf-utils/src/array/includes.ts +1 -41
- package/packages/perf-utils/src/array/includesNaN.ts +1 -32
- package/packages/perf-utils/src/array/index.ts +1 -7
- package/packages/perf-utils/src/array/map.ts +1 -52
- package/packages/player-ui/README.md +1 -1
- package/packages/player-ui/src/CurrentTime.tsx +2 -2
- package/packages/player-ui/src/Duration.tsx +2 -2
- package/packages/player-ui/src/PauseButton.tsx +8 -0
- package/packages/player-ui/src/PlayerInteractable.tsx +1 -0
- package/packages/player-ui/src/PlayerTime.tsx +3 -1
- package/packages/player-ui/src/PlayerUI.tsx +68 -35
- package/packages/player-ui/src/RemainingTime.tsx +2 -2
- package/packages/player-ui/src/Seekbar.tsx +110 -18
- package/packages/player-ui/src/Seeking.ts +57 -16
- package/packages/player-ui/src/Subtitles.tsx +2 -2
- package/packages/player-ui/src/index.ts +1 -0
- package/packages/player-ui/src/mocks.ts +32 -8
- package/packages/player-ui/src/timeUtils.ts +3 -3
- package/packages/player-ui/src/types.ts +9 -3
- package/packages/router/README.md +1 -0
- package/packages/router/src/Route.tsx +61 -27
- package/packages/router/src/Router.tsx +63 -14
- package/packages/router/src/history.ts +8 -1
- package/packages/router/src/index.ts +1 -1
- package/packages/router/src/utils.ts +9 -4
- package/packages/sass-utils/src/linear-gradient.scss +9 -4
- package/packages/sass-utils/src/scale.1080.scss +3 -1
- package/packages/sass-utils/src/scale.720.scss +1 -1
- package/packages/time/README.md +4 -1
- package/packages/time/src/Time.ts +35 -13
- package/packages/time/src/adapters/24iMediaTimeApi.ts +47 -0
- package/packages/time/src/constants.ts +1 -0
- package/packages/time/src/services/24iMediaTimeApi/24iMediaTimeApi.ts +43 -0
- package/packages/time/src/services/24iMediaTimeApi/index.ts +6 -0
- package/packages/toast/src/ToastService.scss +1 -0
- package/packages/toast/src/ToastService.tsx +16 -5
- package/packages/types-bigscreen-jsx/README.md +5 -4
- package/packages/types-bigscreen-jsx/index.d.ts +72 -67
- package/packages/utils/README.md +27 -0
- package/packages/utils/src/elementUtils.ts +25 -0
- package/packages/utils/src/forceReflow.ts +14 -0
- package/packages/utils/src/index.ts +8 -0
- package/packages/utils/src/keyPress/index.ts +6 -0
- package/packages/utils/src/keyPress/keyPressSimulator.ts +74 -0
- package/packages/utils/src/keyPress/simulateKeyPress.ts +25 -0
- package/packages/utils/src/scaledImage.ts +6 -3
- package/packages/utils/src/textUtils.ts +46 -14
- package/packages/utils/src/wait.ts +3 -1
- package/packages/utils/src/xhr/xhrSend.ts +3 -1
- package/packages/utils/src/xhr/xhrSendRetry.ts +3 -1
- package/packages/zapping/src/ChannelZapping.ts +9 -0
- package/packages/zapping/src/Zapping.tsx +10 -0
- package/utils/release/release.ts +156 -0
- package/packages/driver-tizen/src/types.ts +0 -14
- package/packages/focus/src/Layout/__test__/Base.spec.ts +0 -180
- package/packages/focus/src/Layout/__test__/Horizontal.spec.ts +0 -94
- package/packages/focus/src/Layout/__test__/Matrix.spec.ts +0 -261
- package/packages/focus/src/Layout/__test__/Vertical.spec.ts +0 -46
- package/packages/focus/src/Layout/__test__/isRtl.spec.ts +0 -23
- package/packages/focus/src/Layout/__test__/shared.ts +0 -19
- package/packages/keyboard/src/WhitelabelKeyboard/focusMatrix.ts +0 -19
|
@@ -100,11 +100,13 @@ export class ListBase<T extends Item<U>, U>
|
|
|
100
100
|
componentDidMount() {
|
|
101
101
|
this.scrollerDom.current!.addEventListener('wheel', this.onWheel);
|
|
102
102
|
this.scroller.current!.wrapRef.current!.addEventListener('keyup', this.onKeyUp);
|
|
103
|
+
window.document.addEventListener('keyup', this.onGlobalKeyUp, true);
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
componentWillUnmount() {
|
|
106
107
|
this.scrollerDom.current!.removeEventListener('wheel', this.onWheel);
|
|
107
108
|
this.scroller.current!.wrapRef.current!.removeEventListener('keyup', this.onKeyUp);
|
|
109
|
+
window.document.removeEventListener('keyup', this.onGlobalKeyUp, true);
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
onKeyDown = (event: KeyboardEvent) => {
|
|
@@ -130,6 +132,9 @@ export class ListBase<T extends Item<U>, U>
|
|
|
130
132
|
onKeyUp = () => {
|
|
131
133
|
this.stopFastScrolling();
|
|
132
134
|
this.fastFocusingOptimizer.stop();
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
onGlobalKeyUp = () => {
|
|
133
138
|
this.preventBlurCounter = 0;
|
|
134
139
|
};
|
|
135
140
|
|
|
@@ -152,14 +157,6 @@ export class ListBase<T extends Item<U>, U>
|
|
|
152
157
|
}
|
|
153
158
|
};
|
|
154
159
|
|
|
155
|
-
shouldPreventBlur(event: KeyboardEvent) {
|
|
156
|
-
const { horizontal, preventBlurOnLongPress } = this.props;
|
|
157
|
-
return (this.preventBlurCounter >= PREVENT_BLUR_ON_LONG_PRESS_KEYDOWNS && (
|
|
158
|
-
(preventBlurOnLongPress.forward && isForward(event, horizontal))
|
|
159
|
-
|| (preventBlurOnLongPress.backward && isBackward(event, horizontal))
|
|
160
|
-
));
|
|
161
|
-
}
|
|
162
|
-
|
|
163
160
|
getRefAtIndex(i: number): Reference<T> {
|
|
164
161
|
const ref = this.itemRefs[i];
|
|
165
162
|
if (!ref) {
|
|
@@ -201,6 +198,14 @@ export class ListBase<T extends Item<U>, U>
|
|
|
201
198
|
this.fastScrollingCounter.reset();
|
|
202
199
|
}
|
|
203
200
|
|
|
201
|
+
shouldPreventBlur(event: KeyboardEvent) {
|
|
202
|
+
const { horizontal, preventBlurOnLongPress } = this.props;
|
|
203
|
+
return (this.preventBlurCounter >= PREVENT_BLUR_ON_LONG_PRESS_KEYDOWNS && (
|
|
204
|
+
(preventBlurOnLongPress.forward && isForward(event, horizontal))
|
|
205
|
+
|| (preventBlurOnLongPress.backward && isBackward(event, horizontal))
|
|
206
|
+
));
|
|
207
|
+
}
|
|
208
|
+
|
|
204
209
|
animatedScrollStarted() {
|
|
205
210
|
this.isAnimatedScrollRunning = true;
|
|
206
211
|
}
|
|
@@ -360,7 +365,10 @@ export class ListBase<T extends Item<U>, U>
|
|
|
360
365
|
}
|
|
361
366
|
|
|
362
367
|
render() {
|
|
363
|
-
const {
|
|
368
|
+
const {
|
|
369
|
+
horizontal, className,
|
|
370
|
+
mrcuMountingPoint, mrcuForward, mrcuBackward, forward, backward,
|
|
371
|
+
} = this.props;
|
|
364
372
|
return (
|
|
365
373
|
<Scroller
|
|
366
374
|
className={className}
|
|
@@ -375,6 +383,8 @@ export class ListBase<T extends Item<U>, U>
|
|
|
375
383
|
ref={this.mrcuRef}
|
|
376
384
|
getMountingPoint={() => mrcuMountingPoint || this.scroller.current!.wrapRef}
|
|
377
385
|
{...this.props}
|
|
386
|
+
forward={mrcuForward || forward}
|
|
387
|
+
backward={mrcuBackward || backward}
|
|
378
388
|
/>
|
|
379
389
|
</Scroller>
|
|
380
390
|
);
|
|
@@ -4,11 +4,11 @@ export type MouseNavigationProps = {
|
|
|
4
4
|
/**
|
|
5
5
|
* Function to call on the press of the right arrow.
|
|
6
6
|
*/
|
|
7
|
-
forward():
|
|
7
|
+
forward(): void,
|
|
8
8
|
/**
|
|
9
9
|
* Function to call on the press of the left arrow.
|
|
10
10
|
*/
|
|
11
|
-
backward():
|
|
11
|
+
backward(): void,
|
|
12
12
|
/**
|
|
13
13
|
* Function which determines whether to show the forward arrow.
|
|
14
14
|
*/
|
|
@@ -127,34 +127,34 @@ export class BasicList<T extends Item<U>, U>
|
|
|
127
127
|
this.controller.focusCurrentItem(options);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
scrollTo(index: number) {
|
|
130
|
+
scrollTo(index: number, animate?: boolean) {
|
|
131
131
|
const list = this.base.current!;
|
|
132
132
|
const safeIndex = Math.max(0, Math.min(index, list.data.length - 1));
|
|
133
133
|
if (list.index === safeIndex) return;
|
|
134
134
|
if (list.index < safeIndex) {
|
|
135
|
-
this.scrollToForward(safeIndex);
|
|
135
|
+
this.scrollToForward(safeIndex, animate);
|
|
136
136
|
} else {
|
|
137
|
-
this.scrollToBackward(safeIndex);
|
|
137
|
+
this.scrollToBackward(safeIndex, animate);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
private scrollToForward(index: number) {
|
|
141
|
+
private scrollToForward(index: number, animate?: boolean) {
|
|
142
142
|
const { visibleItems } = this.props;
|
|
143
143
|
const list = this.base.current!;
|
|
144
144
|
list.index = index;
|
|
145
145
|
const scrollTarget = list.index - visibleItems + VISIBLE_ITEMS_OFFSET;
|
|
146
146
|
if (scrollTarget > this.controller.scrollIndex) {
|
|
147
|
-
this.controller.scroll(scrollTarget);
|
|
147
|
+
this.controller.scroll(scrollTarget, animate);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
private scrollToBackward(index: number) {
|
|
151
|
+
private scrollToBackward(index: number, animate?: boolean) {
|
|
152
152
|
const { firstScrollStep, scrollStep } = this.props;
|
|
153
153
|
const list = this.base.current!;
|
|
154
154
|
list.index = index;
|
|
155
155
|
const offset = firstScrollStep < scrollStep ? 1 : 0;
|
|
156
156
|
if (list.index - offset < this.controller.scrollIndex) {
|
|
157
|
-
this.controller.scroll(list.index);
|
|
157
|
+
this.controller.scroll(list.index, animate);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -90,12 +90,12 @@ export class CenteredList<T extends Item<U>, U>
|
|
|
90
90
|
this.controller.focusCurrentItem(options);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
scrollTo(index: number) {
|
|
93
|
+
scrollTo(index: number, animate?: boolean) {
|
|
94
94
|
const list = this.base.current!;
|
|
95
95
|
const safeIndex = Math.max(0, Math.min(index, list.data.length - 1));
|
|
96
96
|
if (list.index === safeIndex) return;
|
|
97
97
|
list.index = safeIndex;
|
|
98
|
-
this.controller.scroll(list.index);
|
|
98
|
+
this.controller.scroll(list.index, animate);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
render() {
|
|
@@ -30,7 +30,6 @@ export class CenteredListController<T> extends UnifiedListController<T, Props<an
|
|
|
30
30
|
this.scrollListScroller(-this.topOffset);
|
|
31
31
|
if (initialFocusIndex !== 0) {
|
|
32
32
|
base.index = initialFocusIndex!;
|
|
33
|
-
this.focusCurrentItem();
|
|
34
33
|
this.scroll(base.index, false);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
@@ -81,14 +81,14 @@ export class EdgeOffsetList<T extends Item<U>, U>
|
|
|
81
81
|
const list = this.base.current!;
|
|
82
82
|
list.index = Math.max(
|
|
83
83
|
0,
|
|
84
|
-
Math.min(scrollIndex + visibleItems - VISIBLE_ITEMS_OFFSET, list.data.length - 1),
|
|
84
|
+
Math.min(scrollIndex + visibleItems - VISIBLE_ITEMS_OFFSET - 1, list.data.length - 1),
|
|
85
85
|
);
|
|
86
86
|
this.forward();
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
mrcuBackward = () => {
|
|
90
90
|
const list = this.base.current!;
|
|
91
|
-
list.index = this.controller.scrollIndex;
|
|
91
|
+
list.index = this.controller.scrollIndex + 1;
|
|
92
92
|
this.backward();
|
|
93
93
|
};
|
|
94
94
|
|
|
@@ -120,18 +120,18 @@ export class EdgeOffsetList<T extends Item<U>, U>
|
|
|
120
120
|
this.controller.focusCurrentItem(options);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
scrollTo(index: number) {
|
|
123
|
+
scrollTo(index: number, animate?: boolean) {
|
|
124
124
|
const list = this.base.current!;
|
|
125
125
|
const safeIndex = Math.max(0, Math.min(index, list.data.length - 1));
|
|
126
126
|
if (list.index === safeIndex) return;
|
|
127
127
|
if (list.index < safeIndex) {
|
|
128
|
-
this.scrollToForward(safeIndex);
|
|
128
|
+
this.scrollToForward(safeIndex, animate);
|
|
129
129
|
} else {
|
|
130
|
-
this.scrollToBackward(safeIndex);
|
|
130
|
+
this.scrollToBackward(safeIndex, animate);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
private scrollToForward(index: number) {
|
|
134
|
+
private scrollToForward(index: number, animate?: boolean) {
|
|
135
135
|
const { visibleItems, edgeOffset } = this.props;
|
|
136
136
|
const list = this.base.current!;
|
|
137
137
|
list.index = index;
|
|
@@ -140,16 +140,16 @@ export class EdgeOffsetList<T extends Item<U>, U>
|
|
|
140
140
|
: edgeOffset + list.index - list.data.length - 1;
|
|
141
141
|
const scrollTarget = list.index - visibleItems + offset + VISIBLE_ITEMS_OFFSET;
|
|
142
142
|
if (scrollTarget > this.controller.scrollIndex) {
|
|
143
|
-
this.controller.scroll(scrollTarget);
|
|
143
|
+
this.controller.scroll(scrollTarget, animate);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
private scrollToBackward(index: number) {
|
|
147
|
+
private scrollToBackward(index: number, animate?: boolean) {
|
|
148
148
|
const { edgeOffset } = this.props;
|
|
149
149
|
const list = this.base.current!;
|
|
150
150
|
list.index = index;
|
|
151
|
-
if (list.index
|
|
152
|
-
this.controller.scroll(list.index < edgeOffset ? 0 : list.index - edgeOffset);
|
|
151
|
+
if (list.index <= this.controller.scrollIndex) {
|
|
152
|
+
this.controller.scroll(list.index < edgeOffset ? 0 : list.index - edgeOffset, animate);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -96,12 +96,12 @@ export class FirstOnlyList<T extends Item<U>, U>
|
|
|
96
96
|
this.controller.focusCurrentItem(options);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
scrollTo(index: number) {
|
|
99
|
+
scrollTo(index: number, animate?: boolean) {
|
|
100
100
|
const list = this.base.current!;
|
|
101
101
|
const safeIndex = Math.max(0, Math.min(index, list.data.length - 1));
|
|
102
102
|
if (list.index === safeIndex) return;
|
|
103
103
|
list.index = safeIndex;
|
|
104
|
-
this.controller.scroll(list.index);
|
|
104
|
+
this.controller.scroll(list.index, animate);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
render() {
|
|
@@ -106,12 +106,12 @@ export class FirstOnlyVariedList<T extends Item<U>, U> extends Component<Props<T
|
|
|
106
106
|
this.controller.focusCurrentItem(options);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
scrollTo(index: number) {
|
|
109
|
+
scrollTo(index: number, animate?: boolean) {
|
|
110
110
|
const list = this.base.current!;
|
|
111
111
|
const safeIndex = Math.max(0, Math.min(index, list.data.length - 1));
|
|
112
112
|
if (list.index === safeIndex) return;
|
|
113
113
|
list.index = safeIndex;
|
|
114
|
-
this.controller.scroll(0);
|
|
114
|
+
this.controller.scroll(0, animate);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
render() {
|
|
@@ -99,12 +99,12 @@ export class FixedToEndList<T extends Item<U>, U>
|
|
|
99
99
|
this.controller.focusCurrentItem(options);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
scrollTo(index: number) {
|
|
102
|
+
scrollTo(index: number, animate?: boolean) {
|
|
103
103
|
const list = this.base.current!;
|
|
104
104
|
const safeIndex = Math.max(0, Math.min(index, list.data.length - 1));
|
|
105
105
|
if (list.index === safeIndex) return;
|
|
106
106
|
list.index = safeIndex;
|
|
107
|
-
this.controller.scroll(list.index);
|
|
107
|
+
this.controller.scroll(list.index, animate);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
render() {
|
|
@@ -144,12 +144,16 @@ extends SharedProps<any, any> = SharedProps<any, any>>
|
|
|
144
144
|
if (backward) {
|
|
145
145
|
nextScrollIndex = this.scrollPixelsToIndex(scrollValuePx, backward);
|
|
146
146
|
if (this.lastScrollIndex !== nextScrollIndex) {
|
|
147
|
-
this.
|
|
147
|
+
for (let i = this.lastScrollIndex - 1; i >= nextScrollIndex; i--) {
|
|
148
|
+
this.adjustItemsOffsetsBackward(i);
|
|
149
|
+
}
|
|
148
150
|
}
|
|
149
151
|
} else {
|
|
150
152
|
nextScrollIndex = this.scrollPixelsToIndex(scrollValuePx, backward);
|
|
151
153
|
if (this.lastScrollIndex !== nextScrollIndex) {
|
|
152
|
-
this.
|
|
154
|
+
for (let i = this.lastScrollIndex + 1; i <= nextScrollIndex; i++) {
|
|
155
|
+
this.adjustItemsOffsetsForward(i);
|
|
156
|
+
}
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
159
|
this.lastScrollIndex = nextScrollIndex;
|
|
@@ -12,7 +12,7 @@ export interface List<
|
|
|
12
12
|
controller: UnifiedListController<U>,
|
|
13
13
|
appendData(data: U[]): void,
|
|
14
14
|
prependData(data: U[]): void,
|
|
15
|
-
scrollTo(index: number): void,
|
|
15
|
+
scrollTo(index: number, animate?: boolean): void,
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface VariedList<
|
|
@@ -22,7 +22,7 @@ export interface VariedList<
|
|
|
22
22
|
controller: UnifiedVariedListController<U>,
|
|
23
23
|
appendData(data: U[]): void,
|
|
24
24
|
prependData(data: U[]): void,
|
|
25
|
-
scrollTo(index: number): void,
|
|
25
|
+
scrollTo(index: number, animate?: boolean): void,
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export interface ListComponent<
|
|
@@ -43,7 +43,13 @@ export class ConsoleLogger extends LoggerBase {
|
|
|
43
43
|
let errorMessage = category ? `[${category.toUpperCase()}] ${message}` : message;
|
|
44
44
|
if (additionalData) {
|
|
45
45
|
if (additionalData.message) errorMessage += ` - ${additionalData.message}`;
|
|
46
|
-
|
|
46
|
+
let stringifiedAdditionalData;
|
|
47
|
+
try {
|
|
48
|
+
stringifiedAdditionalData = JSON.stringify(
|
|
49
|
+
additionalData, null, LOG_MESSAGE_SPACE_SIZE,
|
|
50
|
+
);
|
|
51
|
+
} catch {}
|
|
52
|
+
logFunction(errorMessage, stringifiedAdditionalData);
|
|
47
53
|
} else {
|
|
48
54
|
logFunction(errorMessage);
|
|
49
55
|
}
|
|
@@ -3,7 +3,7 @@ import { IStorage, Storage as DefaultStorage } from '@24i/bigscreen-sdk/storage'
|
|
|
3
3
|
import { LogOptions, LogLevel, SentryLoggerEnvironment, XhrBreadcrumbData } from '../../types';
|
|
4
4
|
import { getFormattedMemoryHeapInfo, getFormattedUsedLocalStorageSize } from '../../utils';
|
|
5
5
|
import { LoggerBase, Config as LoggerBaseConfig } from '../LoggerBase';
|
|
6
|
-
import { Sentry } from './Sentry';
|
|
6
|
+
import { Sentry, ErrorEvent } from './Sentry';
|
|
7
7
|
|
|
8
8
|
type Config = {
|
|
9
9
|
sentryOptions: Sentry.BrowserOptions;
|
|
@@ -46,7 +46,7 @@ export class SentryLogger extends LoggerBase {
|
|
|
46
46
|
const { beforeSend, ...restOptions } = options;
|
|
47
47
|
Sentry.init({
|
|
48
48
|
...restOptions,
|
|
49
|
-
beforeSend: async (event:
|
|
49
|
+
beforeSend: async (event: ErrorEvent, hint: Sentry.EventHint) => {
|
|
50
50
|
if (this.mute) return null;
|
|
51
51
|
await this.sendMemoryInfo(event);
|
|
52
52
|
return beforeSend ? beforeSend(event, hint) : event;
|
|
@@ -170,7 +170,9 @@ export class SentryLogger extends LoggerBase {
|
|
|
170
170
|
}
|
|
171
171
|
if (additionalData) {
|
|
172
172
|
if (additionalData.message) logMessage += ` - ${additionalData.message}`;
|
|
173
|
-
|
|
173
|
+
try {
|
|
174
|
+
scope.setExtra(contextKeys.ADDITIONAL_DATA, JSON.stringify(additionalData));
|
|
175
|
+
} catch {}
|
|
174
176
|
}
|
|
175
177
|
Sentry.captureMessage(logMessage, level);
|
|
176
178
|
});
|
|
@@ -100,7 +100,7 @@ export class MenuAndContentContainer<T extends string = string>
|
|
|
100
100
|
* Handles opening with mouse.
|
|
101
101
|
* @param event mouse event
|
|
102
102
|
*/
|
|
103
|
-
|
|
103
|
+
onMouseDown = (event: MouseEvent) => {
|
|
104
104
|
const menu = this.menu.current!;
|
|
105
105
|
if (this.isMenuAvailable() && !menu.isOpen()) {
|
|
106
106
|
menu.open();
|
|
@@ -108,6 +108,30 @@ export class MenuAndContentContainer<T extends string = string>
|
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Handles hover with mouse.
|
|
113
|
+
* @param event mouse event
|
|
114
|
+
*/
|
|
115
|
+
onMouseEnter = (event: MouseEvent) => {
|
|
116
|
+
const menu = this.menu.current!;
|
|
117
|
+
if (this.isMenuAvailable() && !menu.isOpen() && menu.mrcuEnter) {
|
|
118
|
+
menu.mrcuEnter();
|
|
119
|
+
stopEvent(event);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Handles hover end with mouse.
|
|
125
|
+
* @param event mouse event
|
|
126
|
+
*/
|
|
127
|
+
onMouseLeave = (event: MouseEvent) => {
|
|
128
|
+
const menu = this.menu.current!;
|
|
129
|
+
if (this.isMenuAvailable() && !menu.isOpen() && menu.mrcuLeave) {
|
|
130
|
+
menu.mrcuLeave();
|
|
131
|
+
stopEvent(event);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
111
135
|
/**
|
|
112
136
|
* Handles adding/removing mouse listeners based on whether the mouse is used or not.
|
|
113
137
|
* @param event mouse active event
|
|
@@ -137,7 +161,9 @@ export class MenuAndContentContainer<T extends string = string>
|
|
|
137
161
|
if (!this.listensToMouse) {
|
|
138
162
|
this.listensToMouse = true;
|
|
139
163
|
if (!this.menu.current!.isOpen()) this.mouseTriggerElementDisplayToggler.show();
|
|
140
|
-
this.mouseTriggerElement.current!.addEventListener('
|
|
164
|
+
this.mouseTriggerElement.current!.addEventListener('mousedown', this.onMouseDown);
|
|
165
|
+
this.mouseTriggerElement.current!.addEventListener('mouseenter', this.onMouseEnter);
|
|
166
|
+
this.mouseTriggerElement.current!.addEventListener('mouseleave', this.onMouseLeave);
|
|
141
167
|
}
|
|
142
168
|
}
|
|
143
169
|
|
|
@@ -148,7 +174,9 @@ export class MenuAndContentContainer<T extends string = string>
|
|
|
148
174
|
if (this.listensToMouse) {
|
|
149
175
|
this.listensToMouse = false;
|
|
150
176
|
if (!this.menu.current!.isOpen()) this.mouseTriggerElementDisplayToggler.hide();
|
|
151
|
-
this.mouseTriggerElement.current!.removeEventListener('
|
|
177
|
+
this.mouseTriggerElement.current!.removeEventListener('mousedown', this.onMouseDown);
|
|
178
|
+
this.mouseTriggerElement.current!.removeEventListener('mouseenter', this.onMouseEnter);
|
|
179
|
+
this.mouseTriggerElement.current!.removeEventListener('mouseleave', this.onMouseLeave);
|
|
152
180
|
}
|
|
153
181
|
}
|
|
154
182
|
|
|
@@ -112,6 +112,14 @@ export interface Menu<
|
|
|
112
112
|
* Function to close the menu.
|
|
113
113
|
*/
|
|
114
114
|
close(): void,
|
|
115
|
+
/**
|
|
116
|
+
* Function for "hover" effect on the menu.
|
|
117
|
+
*/
|
|
118
|
+
mrcuEnter?(): void,
|
|
119
|
+
/**
|
|
120
|
+
* Function for ending "hover" effect on the menu.
|
|
121
|
+
*/
|
|
122
|
+
mrcuLeave?(): void,
|
|
115
123
|
/**
|
|
116
124
|
* Renders new menu items.
|
|
117
125
|
* @param items new items to render
|
|
@@ -9,7 +9,10 @@ sidebar_label: Modal Service
|
|
|
9
9
|
A component which helps managing modal windows. Handles rendering and focus management.
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
|
-
- ref - the reference to the modal service instance
|
|
12
|
+
- ```ref``` - the reference to the modal service instance
|
|
13
|
+
- ```className``` - custom class name for modal service div
|
|
14
|
+
- ```isFocusable``` - whether is modal focusable or not
|
|
15
|
+
- ```onCloseLastModal``` - function called when the last modal is closed
|
|
13
16
|
|
|
14
17
|
## Provided functionality
|
|
15
18
|
- exports interface which needs to be implemented by the modal component
|
|
@@ -1,27 +1,36 @@
|
|
|
1
|
-
import { Component, createRef, Reference, clearNode } from '@24i/bigscreen-sdk/jsx';
|
|
1
|
+
import { Component, createRef, Reference, clearNode, DeclareProps } from '@24i/bigscreen-sdk/jsx';
|
|
2
2
|
import {
|
|
3
3
|
setActiveElementAsFocusCandidate, focusCandidate, refocusAfterHashChange,
|
|
4
4
|
} from '@24i/bigscreen-sdk/focus';
|
|
5
|
+
import { noop } from '@24i/bigscreen-sdk/utils';
|
|
5
6
|
import { IModal } from './IModal';
|
|
6
7
|
import './ModalService.styles';
|
|
7
8
|
|
|
8
9
|
type Props = {
|
|
9
10
|
className?: string;
|
|
10
11
|
isFocusable?: boolean;
|
|
12
|
+
onCloseLastModal?: Function,
|
|
11
13
|
};
|
|
12
14
|
|
|
15
|
+
type RenderFunction = (ref:Reference) => JSX.Element;
|
|
16
|
+
|
|
13
17
|
export class ModalService extends Component<Props> {
|
|
14
18
|
private openState = false;
|
|
15
19
|
|
|
16
20
|
private readonly rootRef = createRef<HTMLDivElement>();
|
|
17
21
|
|
|
22
|
+
private readonly modalQueue: RenderFunction[] = [];
|
|
23
|
+
|
|
18
24
|
modalRef = createRef<any>();
|
|
19
25
|
|
|
20
26
|
static defaultProps = {
|
|
21
27
|
className: '',
|
|
22
28
|
isFocusable: true,
|
|
29
|
+
onCloseLastModal: noop,
|
|
23
30
|
};
|
|
24
31
|
|
|
32
|
+
declare props: DeclareProps<Props, typeof ModalService.defaultProps>;
|
|
33
|
+
|
|
25
34
|
componentDidMount() {
|
|
26
35
|
window.addEventListener('hashchange', this.onHashChange);
|
|
27
36
|
}
|
|
@@ -37,10 +46,22 @@ export class ModalService extends Component<Props> {
|
|
|
37
46
|
};
|
|
38
47
|
|
|
39
48
|
getMountedComponent() {
|
|
40
|
-
return this.modalRef
|
|
49
|
+
return this.modalRef as Reference<IModal>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private enqueueModal(modal: RenderFunction) {
|
|
53
|
+
this.modalQueue.push(modal);
|
|
41
54
|
}
|
|
42
55
|
|
|
43
|
-
|
|
56
|
+
private dequeueModal() {
|
|
57
|
+
return this.modalQueue.shift();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
open<T extends IModal>(render: (ref: Reference<T>) => JSX.Element, queueModal = false) {
|
|
61
|
+
if (queueModal && this.openState) {
|
|
62
|
+
this.enqueueModal(render);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
44
65
|
const { isFocusable } = this.props;
|
|
45
66
|
this.openState = true;
|
|
46
67
|
this.clearMount(
|
|
@@ -53,13 +74,16 @@ export class ModalService extends Component<Props> {
|
|
|
53
74
|
}
|
|
54
75
|
}
|
|
55
76
|
|
|
56
|
-
close() {
|
|
57
|
-
const { isFocusable } = this.props;
|
|
77
|
+
close(ignoreQueue = false) {
|
|
78
|
+
const { isFocusable, onCloseLastModal } = this.props;
|
|
58
79
|
this.openState = false;
|
|
59
80
|
clearNode(this.rootRef);
|
|
60
81
|
if (isFocusable) {
|
|
61
82
|
focusCandidate();
|
|
62
83
|
}
|
|
84
|
+
const modalFromQueue = this.dequeueModal();
|
|
85
|
+
if (modalFromQueue && !ignoreQueue) this.open(modalFromQueue);
|
|
86
|
+
if (!this.modalQueue.length) onCloseLastModal();
|
|
63
87
|
}
|
|
64
88
|
|
|
65
89
|
isOpen() {
|
|
@@ -5,123 +5,4 @@ hide_title: true
|
|
|
5
5
|
sidebar_label: Performance Utils
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
Set of utilities that should increase a performance if they are used instead of a native way, mainly on older devices (e.g. Entone/Kamai set-top-boxes).
|
|
10
|
-
|
|
11
|
-
> **Please check the limitations of each performance utility You want to use in a code.**
|
|
12
|
-
|
|
13
|
-
## Available perf utils
|
|
14
|
-
- **[Array](#array-perf-utils)**
|
|
15
|
-
- [filter](#filter)
|
|
16
|
-
- [forEach](#foreach)
|
|
17
|
-
- [includes](#includes)
|
|
18
|
-
- [includesNaN](#includesnan)
|
|
19
|
-
- [map](#map)
|
|
20
|
-
|
|
21
|
-
## Array perf utils
|
|
22
|
-
|
|
23
|
-
> In general, each Array utility which requires a callback will iterate over all array items, even if array index hasn't been initialized yet (to understand the issue, see [An adventure in sparse arrays](https://remysharp.com/2018/06/26/an-adventure-in-sparse-arrays)).
|
|
24
|
-
|
|
25
|
-
### filter()
|
|
26
|
-
> The filter() method creates a new array with all elements that pass the test implemented by the provided function.
|
|
27
|
-
|
|
28
|
-
For more info, please see [native **filter** method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
|
|
29
|
-
|
|
30
|
-
#### Limitations against native implementation
|
|
31
|
-
- **`callback` is invoked for all indexes of the array** (not only for indexes with assigned values like [native filter implementation](http://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter#Description)).
|
|
32
|
-
- **Doesn't coerce returned value from a callback to `true` or `false`**, the callback has to return a boolean value directly.
|
|
33
|
-
- Doesn't accept the `scope` as last argument.
|
|
34
|
-
|
|
35
|
-
#### Usage
|
|
36
|
-
```javascript
|
|
37
|
-
import { filter } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
38
|
-
|
|
39
|
-
const array = ['spray', 'limit', 'elite', 'exuberant', 'destruction'];
|
|
40
|
-
//const result = array.filter(word => word.length > 6); // slower native solution
|
|
41
|
-
const result = filter(array, word => word.length > 6); // faster
|
|
42
|
-
|
|
43
|
-
console.log(result);
|
|
44
|
-
// expected output: Array ["exuberant", "destruction"]
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### forEach()
|
|
48
|
-
> The forEach() method executes a provided function once for each array element.
|
|
49
|
-
|
|
50
|
-
For more info, please see [native **forEach** method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
|
|
51
|
-
|
|
52
|
-
#### Limitations against native implementation
|
|
53
|
-
- **`callback` is invoked for all indexes of the array** (not only for indexes with assigned values like [native forEach implementation](http://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Description)).
|
|
54
|
-
- Doesn't accept the `scope` as last argument.
|
|
55
|
-
|
|
56
|
-
#### Usage
|
|
57
|
-
```javascript
|
|
58
|
-
import { forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
59
|
-
|
|
60
|
-
const array = ['a', 'b', 'c'];
|
|
61
|
-
// array.forEach(item => console.log(item)); // slower native solution
|
|
62
|
-
forEach(array, item => console.log(item)); // faster
|
|
63
|
-
|
|
64
|
-
// expected output: "a"
|
|
65
|
-
// expected output: "b"
|
|
66
|
-
// expected output: "c"
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### includes()
|
|
70
|
-
> The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate.
|
|
71
|
-
|
|
72
|
-
For more info, please see [native **includes** method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
|
|
73
|
-
|
|
74
|
-
#### Limitations against native implementation
|
|
75
|
-
- **Doesn't work for searching NaN value!** For that purpose, please use [includesNaN()](#includesnan).
|
|
76
|
-
- Doesn't support negative indexes for `fromIndex` param - the entire array will be processed.
|
|
77
|
-
|
|
78
|
-
#### Usage
|
|
79
|
-
```javascript
|
|
80
|
-
import { includes } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
81
|
-
|
|
82
|
-
const array = ['item0', 'item1', 'item2'];
|
|
83
|
-
|
|
84
|
-
//console.log(array.includes('item1')); // slower native solution
|
|
85
|
-
console.log(includes(array, 'item1')); // faster
|
|
86
|
-
// expected output: true
|
|
87
|
-
|
|
88
|
-
//console.log(array.includes('item1')); // slower native solution
|
|
89
|
-
console.log(includes(array, 'item1', 2)); // faster
|
|
90
|
-
// expected output: false
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### includesNaN()
|
|
94
|
-
> The includesNaN() method determines whether an array includes NaN value among its entries, returning true or false as appropriate.
|
|
95
|
-
|
|
96
|
-
#### Usage
|
|
97
|
-
```javascript
|
|
98
|
-
import { includesNaN } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
99
|
-
|
|
100
|
-
console.log(includesNaN([0, NaN, 1]));
|
|
101
|
-
// expected output: true
|
|
102
|
-
|
|
103
|
-
console.log(includesNaN([0, NaN, 1], 2));
|
|
104
|
-
// expected output: false
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### map()
|
|
108
|
-
> The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.
|
|
109
|
-
|
|
110
|
-
For more info, please see [native **map** method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
|
|
111
|
-
|
|
112
|
-
#### Limitations against native implementation
|
|
113
|
-
- **`callback` is invoked for all indexes of the array** (not only for indexes with assigned values like [native map implementation](http://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map#Description)).
|
|
114
|
-
- Doesn't accept the `scope` as last argument.
|
|
115
|
-
|
|
116
|
-
#### Usage
|
|
117
|
-
```javascript
|
|
118
|
-
import { map } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
119
|
-
|
|
120
|
-
const array = [1, 4, 9, 16];
|
|
121
|
-
|
|
122
|
-
// const mappedArray = array.map(x => x * 2); // slower native solution
|
|
123
|
-
const mappedArray = map(array, x => x * 2); // faster
|
|
124
|
-
|
|
125
|
-
console.log(mappedArray);
|
|
126
|
-
// expected output: Array [2, 8, 18, 32]
|
|
127
|
-
```
|
|
8
|
+
https://github.com/24i/appstage-shared-packages/blob/main/packages/perf-utils/README.md
|