intentful
Version:
Create Custom Skills with less headache
50 lines (49 loc) • 2.38 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.APLTouchWrapper = void 0;
const helpers_1 = require("../../interfaces/helpers");
const component_1 = require("../component");
class APLTouchWrapper extends component_1.APLComponent {
constructor(props) {
super('TouchWrapper', props);
this.props = props;
}
componentSpecificModel() {
return {
onFocus: this.props.onFocus,
onBlur: this.props.onBlur,
handleKeyDown: this.props.handleKeyDown,
handleKeyUp: this.props.handleKeyUp,
nextFocusDown: this.props.nextFocusDown,
nextFocusForward: this.props.nextFocusForward,
nextFocusLeft: this.props.nextFocusLeft,
nextFocusRight: this.props.nextFocusRight,
nextFocusUp: this.props.nextFocusUp,
gestures: this.props.gestures,
onCancel: this.props.onCancel,
onDown: this.props.onDown,
onMove: this.props.onMove,
onPress: this.props.onPress,
onUp: this.props.onUp,
items: this.props.items
};
}
componentSpecificRequestHandlers() {
var _a;
const gestureList = this.props.gestures ? (_a = this.props.gestures) === null || _a === void 0 ? void 0 : _a.flatMap((gesture) => gesture.getRequestHandlers()) : [];
return [
...(0, helpers_1.convertComponentListToRequestHandlers)(this.props.items),
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onFocus),
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onBlur),
...(0, helpers_1.convertKeyboardHandlerListToRequestHandlers)(this.props.handleKeyDown),
...(0, helpers_1.convertKeyboardHandlerListToRequestHandlers)(this.props.handleKeyUp),
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onCancel),
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onDown),
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onMove),
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onPress),
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onUp),
...gestureList
];
}
}
exports.APLTouchWrapper = APLTouchWrapper;