UNPKG

@visactor/vrender-components

Version:

components library for dp visualization

35 lines (32 loc) 1.42 kB
import { array, isNil, merge } from "@visactor/vutils"; export const mergeRowAttrs = (target, ...sources) => { const shapeList = [ target.shape, ...sources.map((s => null == s ? void 0 : s.shape)) ], keyList = [ target.key, ...sources.map((s => null == s ? void 0 : s.key)) ], valueList = [ target.value, ...sources.map((s => null == s ? void 0 : s.value)) ]; return merge(target, ...sources, { shape: shapeList.every(isNil) ? void 0 : merge({}, ...shapeList), key: keyList.every(isNil) ? void 0 : merge({}, ...keyList), value: valueList.every(isNil) ? void 0 : merge({}, ...valueList) }); }; export const getRichTextAttribute = attr => { const {width: width, height: height, wordBreak: wordBreak = "break-word", textAlign: textAlign, textBaseline: textBaseline, text: text} = attr; return Array.isArray(text) ? { width: width, height: height, wordBreak: wordBreak, textAlign: textAlign, textBaseline: textBaseline, singleLine: !1, textConfig: array(text).map((text => Object.assign(Object.assign({}, attr), { text: text }))) } : { width: width, height: height, wordBreak: wordBreak, textAlign: textAlign, textBaseline: textBaseline, singleLine: !1, textConfig: null == text ? void 0 : text.text }; }; //# sourceMappingURL=util.js.map