Birch UI v0.1
Pricing

@birchui/element

Custom elements for the grid and scheduler.

Open .md
npm install @birchui/elementLicense: MIT

Key exports: defineBirchGrid, defineBirchScheduler

Guides: Web Component

@birchui/element#

createElementClassfunction#

function createElementClass<TOptions, TEvents extends object, TWidget extends Widget<TOptions, TEvents>, TKey extends keyof TOptions & string = never>(definition: WidgetDefinition<TOptions, TEvents, TWidget>, config: ElementConfig<TOptions, TKey> = {}): BirchElementConstructor<BirchElementInstance<TOptions, TEvents, TWidget, TKey>>
ParameterTypeDescription
definitionWidgetDefinition<TOptions, TEvents, TWidget>—
configoptionalElementConfig<TOptions, TKey>—

Defined in packages/element/src/create-element.ts:88

createElementRegistrationfunction#

function createElementRegistration<TOptions, TEvents extends object, TWidget extends Widget<TOptions, TEvents>, TKey extends keyof TOptions & string = never>(definition: WidgetDefinition<TOptions, TEvents, TWidget>, config: ElementConfig<TOptions, TKey> = {}): ElementRegistration<BirchElementInstance<TOptions, TEvents, TWidget, TKey>>
ParameterTypeDescription
definitionWidgetDefinition<TOptions, TEvents, TWidget>—
configoptionalElementConfig<TOptions, TKey>—

Defined in packages/element/src/create-element.ts:231

defineBirchGridfunction#

function defineBirchGrid(tagName: string = gridDefinition.tagName): BirchElementConstructor<BirchGridElement> | undefined
ParameterTypeDescription
tagNameoptionalstring—

Defined in packages/element/src/index.ts:94

getBirchGridElementfunction#

function getBirchGridElement(): BirchElementConstructor<BirchGridElement>

Defined in packages/element/src/index.ts:90

GRID_ATTRIBUTESconst#

const GRID_ATTRIBUTES: { readonly theme: "string"; readonly density: "string"; readonly 'row-height': "number"; readonly 'header-height': "number"; readonly 'quick-filter': "string"; readonly 'license-key': "string"; readonly locale: "string"; }

Defined in packages/element/src/index.ts:65

GRID_OPTION_KEYSconst#

const GRID_OPTION_KEYS: readonly ["columns", "rows", "getRowId", "rowHeight", "headerHeight", "floatingFilters", "quickFilter", "sort", "multiSort", "filterModel", "rowSelection", "checkboxSelection", "pagination", "theme", "density", "defaultColumn", "modules", "licenseKey", "overscanRows", "overscanColumns", "rowClass", "emptyMessage", "injectStyles", "locale", "stripes", "groupBy", "groupDefaultExpanded", "groupPanel", "groupColumn", "groupTotals", "treeData", "getDataPath", "getParentId", "pivot", "rangeSelection", "fillHandle", "clipboard", "statusBar", "masterDetail"]

Defined in packages/element/src/index.ts:23

BirchElementinterface#

interface BirchElement<TOptions, TEvents extends object, TWidget> extends HTMLElement
PropertyTypeDescription
optionsPartial<TOptions>—
apireadonlyTWidget | null—
set()<K extends keyof TOptions>(key: K, value: TOptions[K] | undefined) => void—
create()() => TWidget | null—
addEventListener()<K extends keyof ElementEventMap<TEvents>>(type: K, listener: (this: this, event: ElementEventMap<TEvents>[K]) => unknown, options?: boolean | AddEventListenerOptions) => void | (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => voidThe addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
removeEventListener()<K extends keyof ElementEventMap<TEvents>>(type: K, listener: (this: this, event: ElementEventMap<TEvents>[K]) => unknown, options?: boolean | EventListenerOptions) => void | (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => voidThe removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)

Defined in packages/element/src/create-element.ts:19

BirchElementConstructorinterface#

interface BirchElementConstructor<TInstance extends HTMLElement>
new (): TInstance
PropertyTypeDescription
prototypereadonlyTInstance—
observedAttributesreadonlyreadonly string[]—

Defined in packages/element/src/create-element.ts:58

ElementConfiginterface#

interface ElementConfig<TOptions, TKey extends keyof TOptions & string = never>
PropertyTypeDescription
optionKeysoptionalreadonly TKey[]—
attributesoptionalReadonly<Record<string, AttributeType>>—
requiredOptionsoptionalreadonly (keyof TOptions & string)[]—

Defined in packages/element/src/create-element.ts:13

ElementRegistrationinterface#

interface ElementRegistration<TInstance extends HTMLElement>
PropertyTypeDescription
getElement()() => BirchElementConstructor<TInstance>—
define()(tagName?: string) => BirchElementConstructor<TInstance> | undefined—

Defined in packages/element/src/create-element.ts:226

AttributeTypetype#

type AttributeType = 'string' | 'number' | 'boolean';

Defined in packages/element/src/create-element.ts:3

BirchElementInstancetype#

type BirchElementInstance<
  TOptions,
  TEvents extends object,
  TWidget,
  TKey extends keyof TOptions & string = never,
> = BirchElement<TOptions, TEvents, TWidget> & { [K in TKey]: TOptions[K] | undefined };

Defined in packages/element/src/create-element.ts:46

BirchGridElementtype#

type BirchGridElement<TRow = RowData> = BirchElementInstance<
  GridOptions<TRow>,
  GridEvents<TRow>,
  GridApi<TRow>,
  GridElementOptionKey
>;

Defined in packages/element/src/index.ts:77

ElementEventMaptype#

type ElementEventMap<TEvents extends object> = HTMLElementEventMap & {
  [K in keyof TEvents & string as KebabCase<K>]: CustomEvent<TEvents[K]>;
};

Defined in packages/element/src/create-element.ts:9

ElementInstanceOftype#

type ElementInstanceOf<TDefinition> =
  TDefinition extends WidgetDefinition<infer TOptions, infer TEvents, infer TWidget>
    ? BirchElementInstance<TOptions, TEvents, TWidget>
    : never;

Defined in packages/element/src/create-element.ts:53

GridElementOptionKeytype#

type GridElementOptionKey = (typeof GRID_OPTION_KEYS)[number];

Defined in packages/element/src/index.ts:75

KebabCasetype#

type KebabCase<S extends string> = S extends `${infer Head}${infer Tail}`
  ? `${Head extends Lowercase<Head> ? Head : `-${Lowercase<Head>}`}${KebabCase<Tail>}`
  : S;

Defined in packages/element/src/create-element.ts:5

@birchui/element/document#

defineBirchDocumentEditorfunction#

function defineBirchDocumentEditor(tagName: string = documentEditorDefinition.tagName): BirchElementConstructor<BirchDocumentEditorElement> | undefined
ParameterTypeDescription
tagNameoptionalstring—

Defined in packages/element/src/document.ts:25

getBirchDocumentEditorElementfunction#

function getBirchDocumentEditorElement(): BirchElementConstructor<BirchDocumentEditorElement>

Defined in packages/element/src/document.ts:21

BirchDocumentEditorElementtype#

type BirchDocumentEditorElement = BirchElementInstance<
  DocumentEditorOptions,
  DocumentEditorEvents,
  DocumentEditorApi
>;

Defined in packages/element/src/document.ts:9

@birchui/element/pdf#

defineBirchPdfViewerfunction#

function defineBirchPdfViewer(tagName: string = pdfViewerDefinition.tagName): BirchElementConstructor<BirchPdfViewerElement> | undefined
ParameterTypeDescription
tagNameoptionalstring—

Defined in packages/element/src/pdf.ts:14

getBirchPdfViewerElementfunction#

function getBirchPdfViewerElement(): BirchElementConstructor<BirchPdfViewerElement>

Defined in packages/element/src/pdf.ts:10

BirchPdfViewerElementtype#

type BirchPdfViewerElement = BirchElementInstance<PdfViewerOptions, PdfViewerEvents, PdfViewerApi>;

Defined in packages/element/src/pdf.ts:4

@birchui/element/scheduler#

defineBirchSchedulerfunction#

function defineBirchScheduler(tagName: string = schedulerDefinition.tagName): BirchElementConstructor<BirchSchedulerElement> | undefined
ParameterTypeDescription
tagNameoptionalstring—

Defined in packages/element/src/scheduler.ts:12

getBirchSchedulerElementfunction#

function getBirchSchedulerElement(): BirchElementConstructor<BirchSchedulerElement>

Defined in packages/element/src/scheduler.ts:8

BirchSchedulerElementtype#

type BirchSchedulerElement = ElementInstanceOf<typeof schedulerDefinition>;

Defined in packages/element/src/scheduler.ts:4

↑ ↓ to move, Enter to open, Esc to close