@24i/bigscreen-sdk 1.0.1-alpha.2074 → 1.0.2-alpha.2069
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/package.json +2 -2
- package/packages/grid/src/Base/Base.mouse.tsx +24 -0
- package/packages/grid/src/Base/Base.tsx +6 -25
- package/packages/grid/src/Base/index.tizen.tv.ts +1 -0
- package/packages/grid/src/Base/index.webos.tv.ts +1 -0
- package/packages/grid/src/Base/index.webtv.ts +1 -0
- package/packages/grid/src/UnifiedGridController/UnifiedGridController.ts +1 -4
- package/packages/list/src/Base/Base.mouse.tsx +28 -0
- package/packages/list/src/Base/Base.tsx +5 -16
- package/packages/list/src/Base/index.tizen.tv.ts +1 -0
- package/packages/list/src/Base/index.webos.tv.ts +1 -0
- package/packages/list/src/Base/index.webtv.ts +1 -0
- package/packages/list/src/interface.ts +0 -2
- package/packages/mouse-navigation/src/MouseNavigation.tsx +2 -2
- package/utils/create-export-maps/src/__tests__/createExportMaps.spec.ts +2 -2
- package/utils/create-export-maps/src/createExportMaps.ts +1 -1
- package/packages/grid/src/Base/MouseNavigation/MouseNavigation.tsx +0 -58
- package/packages/grid/src/Base/MouseNavigation/MouseNavigationFallback.ts +0 -4
- package/packages/grid/src/Base/MouseNavigation/index.tizen.tv.ts +0 -1
- package/packages/grid/src/Base/MouseNavigation/index.ts +0 -1
- package/packages/grid/src/Base/MouseNavigation/index.webos.tv.ts +0 -1
- package/packages/grid/src/Base/MouseNavigation/index.webtv.ts +0 -1
- package/packages/grid/src/Base/interface.ts +0 -47
- package/packages/list/src/Base/MouseNavigation/MouseNavigation.tsx +0 -58
- package/packages/list/src/Base/MouseNavigation/MouseNavigationFallback.ts +0 -4
- package/packages/list/src/Base/MouseNavigation/index.tizen.tv.ts +0 -1
- package/packages/list/src/Base/MouseNavigation/index.ts +0 -1
- package/packages/list/src/Base/MouseNavigation/index.webos.tv.ts +0 -1
- package/packages/list/src/Base/MouseNavigation/index.webtv.ts +0 -1
- package/packages/list/src/Base/interface.ts +0 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/bigscreen-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2-alpha.2069",
|
|
4
4
|
"description": "SmartApps BIGscreen SDK monorepo",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -271,4 +271,4 @@
|
|
|
271
271
|
"./zapping/interface": "./packages/zapping/src/interface.ts",
|
|
272
272
|
"./zapping": "./packages/zapping/src/index.ts"
|
|
273
273
|
}
|
|
274
|
-
}
|
|
274
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createRef, forwardRef, Reference } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
+
import { MouseNavigation } from '@24i/bigscreen-sdk/mouse-navigation';
|
|
3
|
+
import { GridBase as Base, Props as GridProps } from './Base';
|
|
4
|
+
import { Item } from '../types';
|
|
5
|
+
|
|
6
|
+
export const GridBase = forwardRef(<T extends Item<U>, U>(props: GridProps<T, U>,
|
|
7
|
+
gridRef: Reference<Base<T, U>>,
|
|
8
|
+
) => {
|
|
9
|
+
const direction = props.horizontal ? 'horizontal' : 'vertical';
|
|
10
|
+
const mrcuRef = createRef<MouseNavigation>();
|
|
11
|
+
return (
|
|
12
|
+
<MouseNavigation
|
|
13
|
+
ref={mrcuRef}
|
|
14
|
+
getMountingPoint={() => gridRef.current!.scroller.current!.wrapRef}
|
|
15
|
+
direction={direction}
|
|
16
|
+
forward={props.mrcuForward || props.forwardGroup}
|
|
17
|
+
backward={props.mrcuBackward || props.backwardGroup}
|
|
18
|
+
shouldShowMrcuForward={props.shouldShowMrcuForward}
|
|
19
|
+
shouldShowMrcuBackward={props.shouldShowMrcuBackward}
|
|
20
|
+
>
|
|
21
|
+
<Base {...props} ref={gridRef} mrcuRef={mrcuRef} />
|
|
22
|
+
</MouseNavigation>
|
|
23
|
+
);
|
|
24
|
+
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { createRef, Component, Reference, DeclareProps } from '@24i/bigscreen-sdk/jsx';
|
|
2
2
|
import { device } from '@24i/bigscreen-sdk/device';
|
|
3
|
+
import { MouseNavigation } from '@24i/bigscreen-sdk/mouse-navigation';
|
|
3
4
|
import { Scroller } from '@24i/bigscreen-sdk/scroller';
|
|
4
5
|
import { stopEvent } from '@24i/bigscreen-sdk/utils/stopEvent';
|
|
5
6
|
import { noop } from '@24i/bigscreen-sdk/utils/noop';
|
|
6
7
|
import { forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
7
8
|
import { createTimeout, createCounter, ICounter } from '@24i/bigscreen-sdk/utils';
|
|
8
|
-
import { MouseNavigation } from './MouseNavigation';
|
|
9
9
|
import { FastFocusingOptimizer } from '../FastFocusingOptimizer/FastFocusingOptimizer';
|
|
10
10
|
import { SharedProps, Item } from '../types';
|
|
11
|
-
import { MouseNavigation as IMouseNavigation } from './interface';
|
|
12
11
|
|
|
13
12
|
export type Props<T extends Item<U>, U> = Omit<SharedProps<T, U>, 'scrollStep'> & {
|
|
14
13
|
forward: () => boolean,
|
|
@@ -22,6 +21,7 @@ export type Props<T extends Item<U>, U> = Omit<SharedProps<T, U>, 'scrollStep'>
|
|
|
22
21
|
adjustFocusFromTarget?: (itemRefIndex: number, groupRefIndex: number) => void,
|
|
23
22
|
horizontal?: boolean,
|
|
24
23
|
limit?: number,
|
|
24
|
+
mrcuRef?: Reference<MouseNavigation>;
|
|
25
25
|
shouldApplySlowdown?: () => boolean,
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -55,8 +55,6 @@ export class GridBase<T extends Item<U>, U>
|
|
|
55
55
|
|
|
56
56
|
scrollerDom = createRef<HTMLDivElement>();
|
|
57
57
|
|
|
58
|
-
mrcuRef = createRef<IMouseNavigation>();
|
|
59
|
-
|
|
60
58
|
itemRefs: Reference<T>[] = [];
|
|
61
59
|
|
|
62
60
|
groupRefs: Reference<HTMLDivElement>[] = [];
|
|
@@ -153,13 +151,14 @@ export class GridBase<T extends Item<U>, U>
|
|
|
153
151
|
onWheel = (event: WheelEvent) => {
|
|
154
152
|
const {
|
|
155
153
|
forwardGroup, backwardGroup, shouldApplySlowdown,
|
|
154
|
+
mrcuRef,
|
|
156
155
|
} = this.props;
|
|
157
156
|
let processed;
|
|
158
157
|
if (event.deltaY > 0) processed = shouldApplySlowdown() || forwardGroup();
|
|
159
158
|
else if (event.deltaY < 0) processed = shouldApplySlowdown() || backwardGroup();
|
|
160
159
|
if (processed) {
|
|
161
160
|
stopEvent(event);
|
|
162
|
-
|
|
161
|
+
mrcuRef?.current?.handleArrowState();
|
|
163
162
|
if (this.fastScrollingCounter) {
|
|
164
163
|
this.fastScrollingCounter.add();
|
|
165
164
|
this.fakeWheelStop();
|
|
@@ -435,15 +434,7 @@ export class GridBase<T extends Item<U>, U>
|
|
|
435
434
|
}
|
|
436
435
|
|
|
437
436
|
render() {
|
|
438
|
-
const {
|
|
439
|
-
horizontal,
|
|
440
|
-
className,
|
|
441
|
-
forwardGroup,
|
|
442
|
-
backwardGroup,
|
|
443
|
-
shouldShowMrcuForward,
|
|
444
|
-
shouldShowMrcuBackward,
|
|
445
|
-
} = this.props;
|
|
446
|
-
|
|
437
|
+
const { horizontal, className } = this.props;
|
|
447
438
|
return (
|
|
448
439
|
<Scroller
|
|
449
440
|
className={className}
|
|
@@ -452,17 +443,7 @@ export class GridBase<T extends Item<U>, U>
|
|
|
452
443
|
onKeyDown={this.onKeyDown}
|
|
453
444
|
horizontal={horizontal}
|
|
454
445
|
>
|
|
455
|
-
|
|
456
|
-
<MouseNavigation
|
|
457
|
-
// @ts-ignore - needed to convert fallback (false) to interface
|
|
458
|
-
ref={this.mrcuRef}
|
|
459
|
-
getMountingPoint={() => this.scroller.current!.wrapRef}
|
|
460
|
-
horizontal={horizontal}
|
|
461
|
-
forward={forwardGroup}
|
|
462
|
-
backward={backwardGroup}
|
|
463
|
-
shouldShowMrcuForward={shouldShowMrcuForward}
|
|
464
|
-
shouldShowMrcuBackward={shouldShowMrcuBackward}
|
|
465
|
-
/>
|
|
446
|
+
{this.renderData()}
|
|
466
447
|
</Scroller>
|
|
467
448
|
);
|
|
468
449
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GridBase } from './Base.mouse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GridBase } from './Base.mouse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GridBase } from './Base.mouse';
|
|
@@ -295,8 +295,6 @@ export class UnifiedGridController<T> implements IUnifiedGridController<T> {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
focusToIndex(dataIndex: number, animate = false) {
|
|
298
|
-
const { grid } = this;
|
|
299
|
-
const base = grid.base.current!;
|
|
300
298
|
const targetScrollIndex = this.itemIndexToScrollIndex(dataIndex);
|
|
301
299
|
if (targetScrollIndex > this.scrollIndex) {
|
|
302
300
|
this.adjustGroupsOffsetsForward(targetScrollIndex);
|
|
@@ -306,9 +304,8 @@ export class UnifiedGridController<T> implements IUnifiedGridController<T> {
|
|
|
306
304
|
if (targetScrollIndex !== this.scrollIndex) {
|
|
307
305
|
this.scroll(targetScrollIndex, animate);
|
|
308
306
|
}
|
|
309
|
-
base.index = dataIndex;
|
|
307
|
+
this.grid.base.current!.index = dataIndex;
|
|
310
308
|
this.focusCurrentItem();
|
|
311
|
-
base.mrcuRef.current?.handleArrowState();
|
|
312
309
|
}
|
|
313
310
|
|
|
314
311
|
protected focusScrollWrap() {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createRef, forwardRef, Reference } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
+
import { MouseNavigation } from '@24i/bigscreen-sdk/mouse-navigation';
|
|
3
|
+
import { ListBase as Base, Props as ListProps } from './Base';
|
|
4
|
+
import { Item } from '../types';
|
|
5
|
+
|
|
6
|
+
export const ListBase = forwardRef(<T extends Item<U>, U>(props: ListProps<T, U>,
|
|
7
|
+
listRef: Reference<Base<T, U>>,
|
|
8
|
+
) => {
|
|
9
|
+
const direction = props.horizontal ? 'horizontal' : 'vertical';
|
|
10
|
+
const mrcuRef = createRef<MouseNavigation>();
|
|
11
|
+
return (
|
|
12
|
+
<MouseNavigation
|
|
13
|
+
getMountingPoint={() => listRef.current!.scroller.current!.wrapRef}
|
|
14
|
+
direction={direction}
|
|
15
|
+
forward={props.mrcuForward || props.forward}
|
|
16
|
+
backward={props.mrcuBackward || props.backward}
|
|
17
|
+
shouldShowMrcuForward={props.shouldShowMrcuForward}
|
|
18
|
+
shouldShowMrcuBackward={props.shouldShowMrcuBackward}
|
|
19
|
+
ref={mrcuRef}
|
|
20
|
+
>
|
|
21
|
+
<Base
|
|
22
|
+
{...props}
|
|
23
|
+
mrcuRef={mrcuRef}
|
|
24
|
+
ref={listRef}
|
|
25
|
+
/>
|
|
26
|
+
</MouseNavigation>
|
|
27
|
+
);
|
|
28
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRef, Component, Reference, DeclareProps } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
+
import { MouseNavigation } from '@24i/bigscreen-sdk/mouse-navigation';
|
|
2
3
|
import { device } from '@24i/bigscreen-sdk/device';
|
|
3
4
|
import { Scroller } from '@24i/bigscreen-sdk/scroller';
|
|
4
5
|
import { forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
@@ -9,12 +10,8 @@ import {
|
|
|
9
10
|
ICounter,
|
|
10
11
|
createTimeout,
|
|
11
12
|
} from '@24i/bigscreen-sdk/utils';
|
|
12
|
-
import { MouseNavigation } from './MouseNavigation';
|
|
13
13
|
import { FastFocusingOptimizer } from '../FastFocusingOptimizer/FastFocusingOptimizer';
|
|
14
14
|
import { BasicProps, Item } from '../types';
|
|
15
|
-
import {
|
|
16
|
-
MouseNavigation as IMouseNavigation,
|
|
17
|
-
} from './interface';
|
|
18
15
|
|
|
19
16
|
export type Props<T extends Item<U>, U> = BasicProps<T, U> & {
|
|
20
17
|
forward: () => boolean,
|
|
@@ -24,6 +21,7 @@ export type Props<T extends Item<U>, U> = BasicProps<T, U> & {
|
|
|
24
21
|
shouldShowMrcuForward?: () => boolean,
|
|
25
22
|
shouldShowMrcuBackward?: () => boolean,
|
|
26
23
|
adjustFocusFromTarget?: (itemRefIndex: number) => void,
|
|
24
|
+
mrcuRef?: Reference<MouseNavigation>;
|
|
27
25
|
limit?: number,
|
|
28
26
|
shouldApplySlowdown?: () => boolean,
|
|
29
27
|
};
|
|
@@ -47,8 +45,6 @@ export class ListBase<T extends Item<U>, U>
|
|
|
47
45
|
|
|
48
46
|
scrollerDom = createRef<HTMLDivElement>();
|
|
49
47
|
|
|
50
|
-
mrcuRef = createRef<IMouseNavigation>();
|
|
51
|
-
|
|
52
48
|
itemRefs: Reference<T>[] = [];
|
|
53
49
|
|
|
54
50
|
index = 0;
|
|
@@ -127,16 +123,15 @@ export class ListBase<T extends Item<U>, U>
|
|
|
127
123
|
|
|
128
124
|
onWheel = (event: WheelEvent) => {
|
|
129
125
|
const {
|
|
130
|
-
|
|
126
|
+
forward, backward, mrcuRef, shouldApplySlowdown,
|
|
131
127
|
} = this.props;
|
|
132
128
|
let processed;
|
|
133
|
-
if (horizontal) return;
|
|
134
129
|
if (event.deltaY > 0) processed = shouldApplySlowdown() || forward();
|
|
135
130
|
else if (event.deltaY < 0) processed = shouldApplySlowdown() || backward();
|
|
136
131
|
if (processed) {
|
|
137
132
|
stopEvent(event);
|
|
138
133
|
this.fastScrollingCounter?.add();
|
|
139
|
-
|
|
134
|
+
mrcuRef?.current?.handleArrowState();
|
|
140
135
|
this.fakeWheelStop();
|
|
141
136
|
} else if (processed === false) {
|
|
142
137
|
this.fastFocusingOptimizer.stop();
|
|
@@ -353,13 +348,7 @@ export class ListBase<T extends Item<U>, U>
|
|
|
353
348
|
onKeyDown={this.onKeyDown}
|
|
354
349
|
horizontal={horizontal}
|
|
355
350
|
>
|
|
356
|
-
|
|
357
|
-
<MouseNavigation
|
|
358
|
-
// @ts-ignore - needed to convert fallback (false) to interface
|
|
359
|
-
ref={this.mrcuRef}
|
|
360
|
-
getMountingPoint={() => this.scroller.current!.wrapRef}
|
|
361
|
-
{...this.props}
|
|
362
|
-
/>
|
|
351
|
+
{this.renderData()}
|
|
363
352
|
</Scroller>
|
|
364
353
|
);
|
|
365
354
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ListBase } from './Base.mouse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ListBase } from './Base.mouse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ListBase } from './Base.mouse';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Component, Reference } from '@24i/bigscreen-sdk/jsx';
|
|
2
2
|
import { IFocusable } from '@24i/bigscreen-sdk/focus';
|
|
3
3
|
import { SharedProps, SharedVariedProps, Item } from './types';
|
|
4
|
-
import { ListBase } from './Base';
|
|
5
4
|
|
|
6
5
|
export interface List<
|
|
7
6
|
T extends Item<U>, U, V extends SharedProps<T, U> = SharedProps<T, U>,
|
|
8
7
|
> extends IFocusable, Component<V> {
|
|
9
|
-
base: Reference<ListBase<T, U>>,
|
|
10
8
|
appendData(data: U[]): void,
|
|
11
9
|
prependData(data: U[]): void,
|
|
12
10
|
scrollTo(index: number): void,
|
|
@@ -8,8 +8,8 @@ type Props = {
|
|
|
8
8
|
children: JSX.Element;
|
|
9
9
|
getMountingPoint: () => Reference<HTMLElement>;
|
|
10
10
|
direction: Direction;
|
|
11
|
-
forward: () =>
|
|
12
|
-
backward: () =>
|
|
11
|
+
forward: () => void;
|
|
12
|
+
backward: () => void;
|
|
13
13
|
shouldShowMrcuForward?: () => boolean;
|
|
14
14
|
shouldShowMrcuBackward?: () => boolean;
|
|
15
15
|
};
|
|
@@ -37,14 +37,14 @@ describe('createExportMaps', () => {
|
|
|
37
37
|
createExportMaps();
|
|
38
38
|
expect(writeFileSync).toHaveBeenCalledWith(
|
|
39
39
|
expect.stringContaining('package.json'),
|
|
40
|
-
|
|
40
|
+
JSON.stringify({
|
|
41
41
|
name: 'mock-root-package',
|
|
42
42
|
exports: {
|
|
43
43
|
'./adobe-heartbeat': './packages/adobe-heartbeat/src/index.ts',
|
|
44
44
|
'./animations/mock': './packages/animations/src/__mocks__/JSAnimations.ts',
|
|
45
45
|
'./animations': './packages/animations/src/index.ts',
|
|
46
46
|
}
|
|
47
|
-
}, null, 4)
|
|
47
|
+
}, null, 4),
|
|
48
48
|
);
|
|
49
49
|
});
|
|
50
50
|
});
|
|
@@ -52,7 +52,7 @@ const createPackageJsonMapping = () => {
|
|
|
52
52
|
exports[`./${exportAlias}`] = `./packages/${exportPath}`;
|
|
53
53
|
});
|
|
54
54
|
(packageJson.exports as Record<string, string>) = exports;
|
|
55
|
-
fs.writeFileSync(resolve('./package.json'),
|
|
55
|
+
fs.writeFileSync(resolve('./package.json'), JSON.stringify(packageJson, null, 4));
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
export const createExportMaps = () => {
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Component, createRef } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
import { MouseNavigation as MouseNavigationBase } from '@24i/bigscreen-sdk/mouse-navigation';
|
|
3
|
-
import { device } from '@24i/bigscreen-sdk/device';
|
|
4
|
-
import {
|
|
5
|
-
MouseNavigationProps as Props,
|
|
6
|
-
MouseNavigation as IMouseNavigation,
|
|
7
|
-
} from '../interface';
|
|
8
|
-
|
|
9
|
-
export class MouseNavigation extends Component<Props> implements IMouseNavigation {
|
|
10
|
-
private readonly div = createRef<HTMLDivElement>();
|
|
11
|
-
|
|
12
|
-
private readonly base = createRef<MouseNavigationBase>();
|
|
13
|
-
|
|
14
|
-
componentDidMount() {
|
|
15
|
-
if (device.isMouseUsed()) {
|
|
16
|
-
this.renderArrows();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
handleArrowState() {
|
|
21
|
-
this.base?.current?.handleArrowState();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
renderArrows() {
|
|
25
|
-
const {
|
|
26
|
-
horizontal,
|
|
27
|
-
forward,
|
|
28
|
-
backward,
|
|
29
|
-
shouldShowMrcuForward,
|
|
30
|
-
shouldShowMrcuBackward,
|
|
31
|
-
getMountingPoint,
|
|
32
|
-
} = this.props;
|
|
33
|
-
|
|
34
|
-
const direction = horizontal ? 'horizontal' : 'vertical';
|
|
35
|
-
|
|
36
|
-
this.appendMount(
|
|
37
|
-
<div ref={this.div} className="mouse-navigation">
|
|
38
|
-
<MouseNavigationBase
|
|
39
|
-
// @ts-ignore - needed to convert fallback (false) to interface
|
|
40
|
-
ref={this.base}
|
|
41
|
-
getMountingPoint={() => this.div}
|
|
42
|
-
direction={direction}
|
|
43
|
-
forward={forward}
|
|
44
|
-
backward={backward}
|
|
45
|
-
shouldShowMrcuForward={shouldShowMrcuForward}
|
|
46
|
-
shouldShowMrcuBackward={shouldShowMrcuBackward}
|
|
47
|
-
>
|
|
48
|
-
{null as unknown as JSX.Element}
|
|
49
|
-
</MouseNavigationBase>
|
|
50
|
-
</div>,
|
|
51
|
-
getMountingPoint(),
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
render() {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MouseNavigation } from './MouseNavigation';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MouseNavigation } from './MouseNavigationFallback';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MouseNavigation } from './MouseNavigation';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MouseNavigation } from './MouseNavigation';
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Reference, Component } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
|
|
3
|
-
export type MouseNavigationProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Function to call on the press of the right arrow.
|
|
6
|
-
*/
|
|
7
|
-
forward(): boolean,
|
|
8
|
-
/**
|
|
9
|
-
* Function to call on the press of the left arrow.
|
|
10
|
-
*/
|
|
11
|
-
backward(): boolean,
|
|
12
|
-
/**
|
|
13
|
-
* Function to call on the press of the down arrow.
|
|
14
|
-
*/
|
|
15
|
-
forwardGroup?(): boolean,
|
|
16
|
-
/**
|
|
17
|
-
* Function to call on the press of the up arrow.
|
|
18
|
-
*/
|
|
19
|
-
backwardGroup?(): boolean,
|
|
20
|
-
/**
|
|
21
|
-
* Function which determines whether to show the forward arrow.
|
|
22
|
-
*/
|
|
23
|
-
shouldShowMrcuForward?(): boolean,
|
|
24
|
-
/**
|
|
25
|
-
* Function which determines whether to show the backward arrow.
|
|
26
|
-
*/
|
|
27
|
-
shouldShowMrcuBackward?(): boolean,
|
|
28
|
-
/**
|
|
29
|
-
* Returns a reference to the element where your `children` should be rendered.
|
|
30
|
-
*/
|
|
31
|
-
getMountingPoint(): Reference<HTMLElement>;
|
|
32
|
-
/**
|
|
33
|
-
* Property determines whether navigation is horizontal.
|
|
34
|
-
*/
|
|
35
|
-
horizontal?: boolean,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export interface MouseNavigation extends Component<MouseNavigationProps> {
|
|
39
|
-
/**
|
|
40
|
-
* Function to disable showing an arrow in the given direction.
|
|
41
|
-
*/
|
|
42
|
-
handleArrowState(): void,
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface MouseNavigationComponent {
|
|
46
|
-
new (props: MouseNavigationProps): MouseNavigation,
|
|
47
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Component, createRef } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
import { MouseNavigation as MouseNavigationBase } from '@24i/bigscreen-sdk/mouse-navigation';
|
|
3
|
-
import { device } from '@24i/bigscreen-sdk/device';
|
|
4
|
-
import {
|
|
5
|
-
MouseNavigationProps as Props,
|
|
6
|
-
MouseNavigation as IMouseNavigation,
|
|
7
|
-
} from '../interface';
|
|
8
|
-
|
|
9
|
-
export class MouseNavigation extends Component<Props> implements IMouseNavigation {
|
|
10
|
-
private readonly div = createRef<HTMLDivElement>();
|
|
11
|
-
|
|
12
|
-
private readonly base = createRef<MouseNavigationBase>();
|
|
13
|
-
|
|
14
|
-
componentDidMount() {
|
|
15
|
-
if (device.isMouseUsed()) {
|
|
16
|
-
this.renderArrows();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
handleArrowState() {
|
|
21
|
-
this.base?.current?.handleArrowState();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
renderArrows() {
|
|
25
|
-
const {
|
|
26
|
-
horizontal,
|
|
27
|
-
forward,
|
|
28
|
-
backward,
|
|
29
|
-
shouldShowMrcuForward,
|
|
30
|
-
shouldShowMrcuBackward,
|
|
31
|
-
getMountingPoint,
|
|
32
|
-
} = this.props;
|
|
33
|
-
|
|
34
|
-
const direction = horizontal ? 'horizontal' : 'vertical';
|
|
35
|
-
|
|
36
|
-
this.appendMount(
|
|
37
|
-
<div ref={this.div} className="mouse-navigation">
|
|
38
|
-
<MouseNavigationBase
|
|
39
|
-
// @ts-ignore - needed to convert fallback (false) to interface
|
|
40
|
-
ref={this.base}
|
|
41
|
-
getMountingPoint={() => this.div}
|
|
42
|
-
direction={direction}
|
|
43
|
-
forward={forward}
|
|
44
|
-
backward={backward}
|
|
45
|
-
shouldShowMrcuForward={shouldShowMrcuForward}
|
|
46
|
-
shouldShowMrcuBackward={shouldShowMrcuBackward}
|
|
47
|
-
>
|
|
48
|
-
{null as unknown as JSX.Element}
|
|
49
|
-
</MouseNavigationBase>
|
|
50
|
-
</div>,
|
|
51
|
-
getMountingPoint(),
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
render() {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MouseNavigation } from './MouseNavigation';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MouseNavigation } from './MouseNavigationFallback';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MouseNavigation } from './MouseNavigation';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MouseNavigation } from './MouseNavigation';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Reference, Component } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
|
|
3
|
-
export type MouseNavigationProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Function to call on the press of the right arrow.
|
|
6
|
-
*/
|
|
7
|
-
forward(): boolean,
|
|
8
|
-
/**
|
|
9
|
-
* Function to call on the press of the left arrow.
|
|
10
|
-
*/
|
|
11
|
-
backward(): boolean,
|
|
12
|
-
/**
|
|
13
|
-
* Function which determines whether to show the forward arrow.
|
|
14
|
-
*/
|
|
15
|
-
shouldShowMrcuForward?(): boolean,
|
|
16
|
-
/**
|
|
17
|
-
* Function which determines whether to show the backward arrow.
|
|
18
|
-
*/
|
|
19
|
-
shouldShowMrcuBackward?(): boolean,
|
|
20
|
-
/**
|
|
21
|
-
* Returns a reference to the element where your `children` should be rendered.
|
|
22
|
-
*/
|
|
23
|
-
getMountingPoint(): Reference<HTMLElement>;
|
|
24
|
-
/**
|
|
25
|
-
* Property determines whether navigation is horizontal.
|
|
26
|
-
*/
|
|
27
|
-
horizontal?: boolean,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export interface MouseNavigation extends Component<MouseNavigationProps> {
|
|
31
|
-
/**
|
|
32
|
-
* Function to disable showing an arrow in the given direction.
|
|
33
|
-
*/
|
|
34
|
-
handleArrowState(): void,
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface MouseNavigationComponent {
|
|
38
|
-
new (props: MouseNavigationProps): MouseNavigation,
|
|
39
|
-
}
|