react-web-native-sketch
Version:
[TODO: We need an overview of how this can be used via npm vs as a local package]
67 lines • 3.42 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var react_i18next_1 = require("react-i18next");
var redux_1 = require("redux");
var index_1 = require("../../index");
var platform_1 = require("../../primitives/platform/platform");
var enums_1 = require("../../utils/enums");
var i18n_1 = require("../../utils/i18n");
var strings_1 = require("../../utils/strings");
var tableExport_1 = require("./tableExport");
var styles = {
tableOptions: {
justifyContent: 'space-between',
flexShrink: 0,
flexDirection: 'row',
},
buttonLeft: {
paddingTop: 8,
paddingRight: 15,
paddingBottom: 8,
paddingLeft: 0
},
buttonRight: {
paddingTop: 8,
paddingRight: 1,
paddingBottom: 8,
paddingLeft: 15
},
iconRight: {
width: 18,
height: 18
}
};
var CTableTopActions = /** @class */ (function (_super) {
__extends(CTableTopActions, _super);
function CTableTopActions() {
return _super !== null && _super.apply(this, arguments) || this;
}
CTableTopActions.prototype.render = function () {
var _a = this.props, classes = _a.classes, columns = _a.columns, refreshMethod = _a.refreshMethod, t = _a.t, tableActions = _a.tableActions, tableData = _a.tableData, title = _a.title, hideExportButton = _a.hideExportButton, hideRefreshButton = _a.hideRefreshButton;
return (React.createElement(index_1.View, { style: classes.tableOptions },
!!refreshMethod && !hideRefreshButton &&
React.createElement(index_1.Button, { title: t(strings_1.REFRESH), onPress: !!refreshMethod && refreshMethod, styles: { root: styles.buttonLeft, iconRight: classes.iconRight } }),
platform_1.isWeb && !hideExportButton &&
React.createElement(index_1.Button, { title: t(strings_1.EXPORT), onPress: tableExport_1.exportToCsv.bind(this, title + '_' + i18n_1.formatDate(enums_1.MOMENT_FORMAT.L_LT, new Date()) + '.csv', columns, tableData) }),
(tableActions || []).map(function (action) { return (React.createElement(index_1.Button, { key: title + '_table_button_' + action.title, iconLeft: index_1.isXs() ? action.iconXs : action.icon, title: index_1.isXs() ? (action.titleXs || '') : (action.title || ''), styles: { root: styles.buttonRight },
// iconStyle={classes.optionsIconStyle}
// labelStyle={classes.optionsTitleStyle}
// touchableStyle={classes.optionsTouchableStyle}
// style={classes.optionsTouchableStyle}
onPress: action.onPress })); })));
};
return CTableTopActions;
}(React.PureComponent));
exports.TableTopActions = redux_1.compose(react_i18next_1.translate(), index_1.createStyles(styles, 'TableTopActions'))(CTableTopActions);
//# sourceMappingURL=TableTopActions.js.map