UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

123 lines (107 loc) 3.94 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _inherits from "@babel/runtime/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; function _createSuper(Derived) { function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } return function () { var Super = _getPrototypeOf(Derived), result; if (isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } import { __decorate } from "tslib"; import React, { Component } from 'react'; import { observer } from 'mobx-react'; import noop from 'lodash/noop'; import { getProPrefixCls } from '../../../../es/configure/utils'; import FilterSelect from './FilterSelect'; import ColumnFilter from './ColumnFilter'; import { $l } from '../../locale-context'; var TableFilterBar = /*#__PURE__*/ function (_Component) { _inherits(TableFilterBar, _Component); var _super = _createSuper(TableFilterBar); function TableFilterBar() { _classCallCheck(this, TableFilterBar); return _super.apply(this, arguments); } _createClass(TableFilterBar, [{ key: "renderSuffix", value: function renderSuffix() { var prefixCls = this.props.prefixCls; return React.createElement(ColumnFilter, { prefixCls: prefixCls }); } }, { key: "getButtons", value: function getButtons() { var _this$props = this.props, prefixCls = _this$props.prefixCls, buttons = _this$props.buttons; if (buttons.length) { return React.createElement("div", { key: "toolbar", className: "".concat(prefixCls, "-toolbar") }, React.createElement("span", { className: "".concat(prefixCls, "-toolbar-button-group") }, buttons)); } } }, { key: "render", value: function render() { var _this$props2 = this.props, prefixCls = _this$props2.prefixCls, dataSet = _this$props2.dataSet, queryDataSet = _this$props2.queryDataSet, paramName = _this$props2.paramName, _this$props2$placehol = _this$props2.placeholder, placeholder = _this$props2$placehol === void 0 ? $l('Table', 'filter_bar_placeholder') : _this$props2$placehol, pagination = _this$props2.pagination, _this$props2$onQuery = _this$props2.onQuery, onQuery = _this$props2$onQuery === void 0 ? noop : _this$props2$onQuery, _this$props2$onReset = _this$props2.onReset, onReset = _this$props2$onReset === void 0 ? noop : _this$props2$onReset; var buttons = this.getButtons(); return [buttons, pagination, React.createElement(FilterSelect, { key: "filter", prefixCls: "".concat(prefixCls, "-filter-select"), optionDataSet: dataSet, queryDataSet: queryDataSet, placeholder: placeholder, suffix: this.renderSuffix(), paramName: paramName, onQuery: onQuery, onReset: onReset })]; } }]); return TableFilterBar; }(Component); TableFilterBar.defaultProps = { prefixCls: getProPrefixCls('table'), paramName: 'params' }; TableFilterBar = __decorate([observer], TableFilterBar); export default TableFilterBar; //# sourceMappingURL=TableFilterBar.js.map