UNPKG

react-application-core

Version:

A react-based application core for the business applications.

71 lines 2.49 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.PropsUtils = void 0; var R = require("ramda"); var event_1 = require("./event"); var di_services_1 = require("../di/di.services"); var type_1 = require("./type"); /** * @stable [21.08.2020] * @param props * @param systemProps */ var mergeWithSystemProps = function (props, systemProps) { return R.isNil(systemProps) ? props : __assign(__assign({}, props), systemProps); }; /** * @stable [21.08.2020] * @param childProps * @param parent */ var mergeWithParentDefaultProps = function (childProps, parent) { return R.mergeDeepLeft(childProps, parent.defaultProps || {}); }; /** * @stable [18.08.2020] * @param handler * @param canAttachHandler * @param touched */ var buildClickHandlerProps = function (handler, canAttachHandler, touched) { if (touched === void 0) { touched = true; } return canAttachHandler && type_1.TypeUtils.isFn(handler) ? (__assign(__assign({}, (touched === true && di_services_1.DiServices.environment().mobilePlatform) && ({ onClick: event_1.cancelEvent, onDoubleClick: event_1.cancelEvent, onTouchStart: function (e) { event_1.cancelEvent(e, true); handler(e); }, })), (touched === false || !di_services_1.DiServices.environment().mobilePlatform) && ({ onClick: function (e) { event_1.cancelEvent(e); handler(e); }, }))) : {}; }; /** * @stable [18.05.2020] */ var PropsUtils = /** @class */ (function () { function PropsUtils() { } PropsUtils.buildClickHandlerProps = buildClickHandlerProps; /* @stable [22.05.2020] */ PropsUtils.mergeWithParentDefaultProps = mergeWithParentDefaultProps; /* @stable [21.08.2020] */ PropsUtils.mergeWithSystemProps = mergeWithSystemProps; /* @stable [18.05.2020] */ return PropsUtils; }()); exports.PropsUtils = PropsUtils; //# sourceMappingURL=props.js.map