UNPKG

devexpress-richedit

Version:

DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.

27 lines (26 loc) 1.15 kB
import { Pair } from '@devexpress/utils/lib/class/pair'; import { ListUtils } from '@devexpress/utils/lib/utils/list'; import { BaseFormatter, StdProps } from './base-formatter'; import { DivElement, SpanElement } from './elements'; export class CCF_Array extends BaseFormatter { isHandleObject(obj) { return Array.isArray(obj); } getShortDescription(_config) { if (!this.curr.length) return new DivElement().setText("[]"); const list = this.getList(); list.unshift(new Pair("", new SpanElement().setText(this.curr.length ? `(${this.curr.length})` : "").setColor(BaseFormatter.blackColor))); return this.stdShow(new StdProps(list).showAsLine().setStdNumElements().setBoundChars("[", "]")); } availableFullDescription(_config) { return true; } getFullDescription(_config) { return this.stdShow(new StdProps(this.getList()).showAsColumn()); } getList() { return ListUtils.map(this.curr, (val, ind) => new Pair(ind.toString(), val)); } } CCF_Array._foo = BaseFormatter.addToFormattersList(new CCF_Array());