본문으로 건너뛰기
cccskills
무료GitHub에 공개

ui

UI building guidelines for Datagrok TypeScript components, viewers, and drag-and-drop

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Datagrok UI Building Guidelines

Rules and patterns for building UI in TypeScript packages and libraries. These are authoritative — follow them unless the user explicitly overrides.

Tab Controls

  • Always use addPane with a lazy getContent callback — never pass pre-built elements
  • This avoids creating heavy components (grids, viewers, DataFrames) for tabs the user may never open
// Good
const tabs = ui.tabControl();
tabs.addPane('Sheet 1', () => {
  const df = buildDataFrame();
  const grid = DG.Viewer.grid(df);
  return grid.root;
});

// Bad — all tabs built eagerly
const tabs = ui.tabControl({
  'Sheet 1': buildExpensiveGrid(),
  'Sheet 2': buildExpensiveGrid(),
});

Grids and Viewers

  • Prefer DG.Viewer.grid(df) for embedding a grid inside a composite layout
  • Prefer DG.TableView.create(df, false) when the grid IS the entire view
  • The second argument (false) prevents the table from being added to the workspace

Layouts

  • Use ui.splitH / ui.splitV for resizable split panels
  • Use ui.divV / ui.divH for simple stacking without resize handles
  • Set flex: 1 on the element that should fill remaining space
  • For tree + content layouts, use ui.splitH([tree.root, contentPanel])

Dialogs and Inputs

  • Use ui.dialog() for modal interactions
  • Use ui.input.choice(), ui.input.int(), ui.input.bool(), etc. for typed inputs - full set of input functions is in js-api/ui.ts. Prefer onValueChanged in the options object over .onChanged.subscribe():
  ui.input.bool('Debug', {value: DG.Test.isInDebug, onValueChanged: (v) => DG.Test.isInDebug = v});

Use ui.form([...inputs]) to render a labeled list of inputs inside a dialog

  • For property panels, prefer DG.JsViewer properties (this.string(...), this.int(...)) which automatically appear in the context panel

Toggle Settings in Popup Menus

For toggleable settings in a DG.Menu.popup(), use menu.items() with isChecked — never use text-prefix hacks like `${flag ? '✓ ' : ''}Label`:

const toggles = [
  {label: 'Debug', get: () => DG.Test.isInDebug, set: (v: boolean) => { DG.Test.isInDebug = v; }},
  {label: 'Benchmark', get: () => DG.Test.isInBenchmark, set: (v: boolean) => { DG.Test.isInBenchmark = v; }},
];
const menu = DG.Menu.popup();
menu.closeOnClick = false;
const refresh = () => {
  menu.clear();
  menu.items(toggles, (t) => { t.set(!t.get()); refresh(); }, {isChecked: (t) => t.get()});
};
refresh();
menu.show();

Performance

  • Debounce resize and selection handlers: DG.debounce(observable, 50)
  • For large datasets, prefer canvas-based rendering over DOM elements
  • Avoid re-creating viewers on every data change — update in place when possible

Accordion

  • Use ui.accordion() with lazy getContent callbacks (same principle as tab controls)
const acc = ui.accordion();
acc.addPane('Details', () => buildDetailsPanel());
acc.addPane('Statistics', () => buildStatsPanel());

Drag and Drop

  • ui.makeDroppable(el, IDragAndDropOptions<T>) — receive entities dragged from the browse tree, grid, or other sources.
    • acceptDrop(obj) — fast predicate for showing the zone.
    • doDrop(args) — handle the drop. args is a DragDropArgs<T> with dragObject, dragSource, dragObjectType, copying (Ctrl/Cmd), link (Alt), handled.
    • Rich hooks: acceptDrag, onBeginDrag, onEndDrag, onMouseEnter/Over/Leave/Out, dropSuggestion, makeDropZone, dropZoneRectTransformation, dropIndication.
  • ui.makeDraggable(el, {getDragObject, getDragCaption}) — make your own UI a drag source.
  • Sample: ApiSamples/scripts/ui/interactivity/drag-and-drop.js.

Common Anti-Patterns

  • Do not use raw document.createElement when ui.* helpers exist
  • Do not set innerHTML with user data — use ui.divText() or textContent
  • Do not use style.width = '100%' on tables — let them size to content
  • Do not build all content eagerly in multi-pane layouts (tabs, accordions)

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Add support for a new curve data format in the Curves package converter system

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 22일 업데이트

Create info panels that appear in the context panel based on semantic types

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 22일 업데이트

Add a new single-objective optimization algorithm to the sci-comp library. Use when the user asks to implement a new optimizer (e.g. gradient descent, BFGS, simulated annealing, differential evolution).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 22일 업데이트

Add unit tests to a Datagrok package

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 22일 업데이트

Answer a "how do I …" question about the platform with a Gherkin scenario on @datagrok-libraries/bdd that is filmed into a how-to video (grok-bdd guide), so the answer is demonstrated, sent as a video plus numbered steps, and kept as a regression test; the same scenarios, filmed in help mode, are the GIFs of the help pages

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 22일 업데이트

Translate hand-written Playwright specs (or any existing UI tests) into Gherkin features on @datagrok-libraries/bdd, then prove the features test what they claim by backward-matching them against the originals with independent reviewers, and fix the gaps in the core, the library and the features

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 22일 업데이트

datagrok-ai의 스킬 모두 보기

이 스킬의 문제 신고