UNPKG

@antv/t8

Version:

T8 is a text visualization solution for unstructured data within the AntV technology stack, and it is a declarative T8 markdown syntax that can be used to describe the content of data interpretation reports.

44 lines (41 loc) 2.16 kB
import { jsxs, jsx } from 'preact/jsx-runtime'; import { v4 } from 'uuid'; import { Li, Ol, Ul } from '../styled/bullet.js'; import '../styled/container.js'; import '../styled/entity.js'; import '../styled/heading.js'; import '../styled/marks.js'; import '../styled/paragraph.js'; import { Phrases } from '../phrases/index.js'; import { getPrefixCls } from '../../utils/getPrefixCls.js'; import { classnames } from '../../utils/classnames.js'; import { useTheme } from '../context/hooks/theme.js'; import '../context/hooks/plugin.js'; import { useEvent } from '../context/hooks/event.js'; import '../context/hooks/currentParagraphInfo.js'; import '../../plugin/index.js'; import 'tslib'; import '../../theme/seed/index.js'; function Bullets(_a) { var _b; var spec = _a.spec; var onEvent = useEvent().onEvent; var children = (_b = spec.bullets) === null || _b === void 0 ? void 0 : _b.map(function (bullet) { var onLiClick = function () { onEvent === null || onEvent === void 0 ? void 0 : onEvent('paragraph:click', bullet); }; var onLiMouseEnter = function () { onEvent === null || onEvent === void 0 ? void 0 : onEvent('paragraph:mouseenter', bullet); }; var onLiMouseLeave = function () { onEvent === null || onEvent === void 0 ? void 0 : onEvent('paragraph:mouseleave', bullet); }; return (jsxs(Li, { className: classnames(getPrefixCls('li'), bullet.className), style: bullet.styles, onClick: onLiClick, onMouseEnter: onLiMouseEnter, onMouseLeave: onLiMouseLeave, children: [jsx(Phrases, { spec: bullet.phrases }), (bullet === null || bullet === void 0 ? void 0 : bullet.subBullet) ? jsx(Bullets, { spec: bullet === null || bullet === void 0 ? void 0 : bullet.subBullet }) : null] }, spec.key || v4())); }); var tag = spec.isOrder ? 'ol' : 'ul'; var Comp = spec.isOrder ? Ol : Ul; var themeSeedToken = useTheme(); return (jsx(Comp, { as: tag, theme: themeSeedToken, className: classnames(getPrefixCls(tag), spec.className), style: spec.styles, children: children })); } export { Bullets }; //# sourceMappingURL=Bullets.js.map