intentful
Version:
Create Custom Skills with less headache
129 lines (128 loc) • 5.07 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.APLVectorGraphic = void 0;
const helpers_1 = require("../../interfaces/helpers");
const component_1 = require("../component");
class APLVectorGraphic extends component_1.APLComponent {
constructor(props) {
super('VectorGraphic', props);
}
componentSpecificModel() {
return {
/**
* How the graphic should be aligned in the current box
*/
align: this.props.align,
/**
* The URL or direct reference to a vector graphic.
*/
source: this.props.source,
/**
* How the image should be scaled to fill the current box.
*/
scale: this.props.scale,
/**
* Command to execute when the component receives focus.
*/
onFocus: this.props.onFocus,
/**
* Command to execute when the component loses focus.
*/
onBlur: this.props.onBlur,
handleKeyDown: this.props.handleKeyDown,
handleKeyUp: this.props.handleKeyUp,
/**
* The component to focus if the down key is pressed.
*/
nextFocusDown: this.props.nextFocusDown,
/**
* The component to focus if the tab key is pressed.
*/
nextFocusForward: this.props.nextFocusForward,
/**
* The component to focus if the left key is pressed.
*/
nextFocusLeft: this.props.nextFocusLeft,
/**
* The component to focus if the right key is pressed.
*/
nextFocusRight: this.props.nextFocusRight,
/**
* The component to focus if the up key is pressed.
*/
nextFocusUp: this.props.nextFocusUp,
gestures: this.props.gestures,
/**
* Commands to execute when a gesture takes over the pointer.
*/
onCancel: this.props.onCancel,
/**
* Commands to execute when a pointer down event occurs.
*/
onDown: this.props.onDown,
/**
* Commands to execute while moving the pointer.
*/
onMove: this.props.onMove,
/**
* Commands to execute for a pointer down followed by an up.
*/
onPress: this.props.onPress,
/**
* Commands to execute when releasing the pointer.
*/
onUp: this.props.onUp,
/**
* Command(s) to execute when all sources have loaded
*/
onLoad: this.props.onLoad,
/**
* Command(s) to execute if any source fails to load
*/
onFail: this.props.onFail
};
}
componentSpecificRequestHandlers() {
var _a;
const gestures = this.props.gestures ? (_a = this.props.gestures) === null || _a === void 0 ? void 0 : _a.flatMap((gesture) => gesture.getRequestHandlers()) : [];
return [
...gestures,
/**
* Commands to execute when a gesture takes over the pointer.
*/
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onCancel),
/**
* Commands to execute when a pointer down event occurs.
*/
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onDown),
/**
* Commands to execute while moving the pointer.
*/
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onMove),
/**
* Commands to execute for a pointer down followed by an up.
*/
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onPress),
/**
* Commands to execute when releasing the pointer.
*/
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onUp),
/**
* Command(s) to execute when all sources have loaded
*/
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onLoad),
/**
* Command(s) to execute if any source fails to load
*/
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onFail),
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onFocus),
/**
* Command to execute when the component loses focus.
*/
...(0, helpers_1.convertCommandListToRequestHandlers)(this.props.onBlur),
...(0, helpers_1.convertKeyboardHandlerListToRequestHandlers)(this.props.handleKeyDown),
...(0, helpers_1.convertKeyboardHandlerListToRequestHandlers)(this.props.handleKeyUp)
];
}
}
exports.APLVectorGraphic = APLVectorGraphic;