UNPKG

@alicloud/console-components-truncate

Version:

React component for Alibaba Cloud.

19 lines (16 loc) 1.62 kB
import { __makeTemplateObject } from 'tslib'; import styled from 'styled-components'; import FilteredSpan from '../components/FilteredSpan.js'; import { BASE_CLASS_NAME, MAIN_CLASS_NAME, OMISSION_CLASS_NAME } from '../constants.js'; var computeThreshold = function computeThreshold(_a) { var threshold = _a.threshold; return typeof threshold === 'number' ? "".concat(threshold, "px") : threshold; }; var computeTextOverflow = function computeTextOverflow(_a) { var omissionByCss = _a.omissionByCss; return omissionByCss ? 'text-overflow: ellipsis;' : ''; }; var TruncateWidthContainer = styled(FilteredSpan)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &.", " {\n display: inline-flex;\n overflow: hidden;\n max-width: ", ";\n .", " {\n overflow: hidden;\n white-space: nowrap;\n /* \u662F\u5426\u901A\u8FC7css\u6765\u6E32\u67D3\u7701\u7565\u7B26 */\n ", "\n }\n .", " {\n flex: 0 0 auto;\n }\n }\n"], ["\n &.", " {\n display: inline-flex;\n overflow: hidden;\n max-width: ", ";\n .", " {\n overflow: hidden;\n white-space: nowrap;\n /* \u662F\u5426\u901A\u8FC7css\u6765\u6E32\u67D3\u7701\u7565\u7B26 */\n ", "\n }\n .", " {\n flex: 0 0 auto;\n }\n }\n"])), BASE_CLASS_NAME, computeThreshold, MAIN_CLASS_NAME, computeTextOverflow, OMISSION_CLASS_NAME); var Wrapper = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-block;\n"], ["\n display: inline-block;\n"]))); var templateObject_1, templateObject_2; export { TruncateWidthContainer, Wrapper };