UNPKG

choerodon-ui

Version:

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

89 lines (80 loc) 3.12 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _inherits from "@babel/runtime/helpers/inherits"; import _createSuper from "@babel/runtime/helpers/createSuper"; 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 /*#__PURE__*/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 /*#__PURE__*/React.createElement("div", { key: "toolbar", className: "".concat(prefixCls, "-toolbar") }, /*#__PURE__*/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, /*#__PURE__*/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