@universal-material/data-grid 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/custom-elements.json +114 -15
  3. package/dist/data/data-source.d.ts +6 -2
  4. package/dist/data/data-source.js.map +1 -1
  5. package/dist/export-xlsx/index.d.ts +2 -1
  6. package/dist/export-xlsx/index.js +4 -2
  7. package/dist/export-xlsx/index.js.map +1 -1
  8. package/dist/features/column-chooser.js +1 -1
  9. package/dist/features/column-chooser.js.map +1 -1
  10. package/dist/features/filter-row.d.ts +1 -0
  11. package/dist/features/filter-row.js +13 -8
  12. package/dist/features/filter-row.js.map +1 -1
  13. package/dist/features/header-filter.d.ts +4 -1
  14. package/dist/features/header-filter.js +7 -5
  15. package/dist/features/header-filter.js.map +1 -1
  16. package/dist/grid-column-def.d.ts +45 -11
  17. package/dist/grid-column-def.js +6 -2
  18. package/dist/grid-column-def.js.map +1 -1
  19. package/dist/grid-column.d.ts +23 -5
  20. package/dist/grid-column.js +32 -5
  21. package/dist/grid-column.js.map +1 -1
  22. package/dist/grid-i18n.js +14 -14
  23. package/dist/grid-i18n.js.map +1 -1
  24. package/dist/grid.d.ts +31 -10
  25. package/dist/grid.js +255 -55
  26. package/dist/grid.js.map +1 -1
  27. package/dist/grid.min.js +457 -418
  28. package/dist/grid.styles.js +42 -6
  29. package/dist/grid.styles.js.map +1 -1
  30. package/dist/render/cell.js +5 -2
  31. package/dist/render/cell.js.map +1 -1
  32. package/dist/row-model/columns.d.ts +21 -3
  33. package/dist/row-model/columns.js +14 -4
  34. package/dist/row-model/columns.js.map +1 -1
  35. package/dist/row-model/filter.d.ts +19 -4
  36. package/dist/row-model/filter.js +29 -9
  37. package/dist/row-model/filter.js.map +1 -1
  38. package/dist/row-model/format.js +1 -1
  39. package/dist/row-model/format.js.map +1 -1
  40. package/dist/state/grid-state.d.ts +2 -2
  41. package/dist/state/grid-state.js.map +1 -1
  42. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"header-filter.js","sourceRoot":"","sources":["../../src/features/header-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAwD,GAAG,EAAuB,MAAM,KAAK,CAAC;AACpH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAQ5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAyB,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,iFAAiF;AACjF,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C,MAAM,SAAS,GAAG,aAAa,CAAC;AAEhC,0DAA0D;AAC1D,MAAM,KAAK,GAAG,CAAC,KAAc,EAAU,EAAE,CACvC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAoBzF;;;;;;GAMG;AACH,MAAM,OAAO,sBAAsB;IACxB,KAAK,CAAmB;IACjC,MAAM,CAAwB;IAC9B,MAAM,CAAS;IACf,eAAe,CAA4B;IAC3C,kEAAkE;IAClE,WAAW,CAAqB;IAChC,4EAA4E;IAC5E,MAAM,CAA8B;IACpC,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AK;2BACC,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,OAAO;mBAClD,UAAU,CAAC,aAAa;UACjC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;;QAE9E,SAAS;QACT,CAAC,CAAC,IAAI,CAAA,yDAAyD,aAAa,CAAC,WAAW,CAAC,qBAAqB,EAAE;YAC9G,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;YAC3B,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;SAC9B,CAAC,MAAM;QACR,CAAC,CAAC,OAAO;sEACqD,UAAU,CAAC,kBAAkB;;mEAEhC,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,WAAW,CAAC,WAAW;;gEAE5D,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,WAAW,CAAC,EAAE;oEACtC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,MAAM;;WAE3G,CAAC;AACZ,CAAC,CAAC","sourcesContent":["import { html, nothing, type ReactiveController, type ReactiveControllerHost, svg, type TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { map } from 'lit/directives/map.js';\n\nimport type {\n GridColumnDef,\n GridFilterCondition,\n GridFilterExpression,\n} from '../grid-column-def.js';\nimport type { GridI18n } from '../grid-i18n.js';\nimport { labelledByHeader } from '../render/header.js';\nimport { columnText } from '../row-model/columns.js';\nimport type { DistinctDateNode, DistinctValue, DistinctValues } from '../row-model/distinct.js';\nimport { type ColumnFilterKind, findColumnCondition, hasColumnCondition } from '../row-model/filter.js';\nimport { createTextMatcher } from '../row-model/fold.js';\nimport { columnKeyOf } from './filter-row.js';\nimport { Debouncer } from './search.js';\nimport { formatMessage } from './sorting.js';\n\n/** Itens desenhados na lista plana; acima disso, a busca do popover estreita. */\nexport const HEADER_FILTER_RENDER_LIMIT = 500;\n\nconst BLANK_KEY = '\\u0000blank';\n\n/** Chave de um valor distinto no conjunto de marcados. */\nconst keyOf = (value: unknown): string =>\n value === null || value === undefined ? BLANK_KEY : `${typeof value}:${String(value)}`;\n\nexport interface HeaderFilterHost extends ReactiveControllerHost {\n readonly renderRoot: HTMLElement | DocumentFragment;\n readonly filterValue: GridFilterExpression | null;\n _distinctValues(column: GridColumnDef): DistinctValues;\n _userFilterColumn(column: GridColumnDef, kind: ColumnFilterKind | 'all', condition: GridFilterCondition | null): void;\n _isRtl(): boolean;\n}\n\ninterface OpenState {\n column: GridColumnDef;\n distinct: DistinctValues;\n /** Todos os valores (vazio = `null`), na ordem da lista. */\n all: unknown[];\n selected: Set<string>;\n search: string;\n expanded: Set<string>;\n}\n\n/**\n * Popover do filtro do cabeçalho: valores distintos (com contagem), busca,\n * \"selecionar tudo\", datas em ano → mês → dia. OK aplica `anyof`/`noneof`\n * (o menor dos dois); Cancelar, Esc e clique fora fecham sem aplicar. Foco\n * preso no popover e devolvido ao botão do funil. O estado (valores, listener\n * do documento) é solto ao fechar e no `hostDisconnected`.\n */\nexport class HeaderFilterController implements ReactiveController {\n readonly #host: HeaderFilterHost;\n #state: OpenState | undefined;\n #shown = false;\n #restoreFocusTo: GridColumnDef | undefined;\n /** Item da árvore com \\`tabindex=\"0\"\\` (roving; spec 17, A10). */\n #activeItem: string | undefined;\n /** Itens do último render (o teclado acha nível, pai e estado por eles). */\n #items: HeaderFilterTreeItem[] = [];\n /** Contagem anunciada depois da busca (região \\`status\\` do popover). */\n #searchAnnouncement = '';\n readonly #announcer: Debouncer<'search'>;\n\n constructor(host: HeaderFilterHost) {\n this.#host = host;\n host.addController(this);\n this.#announcer = new Debouncer(host);\n }\n\n get activeItem(): string | undefined {\n return this.#activeItem;\n }\n\n get searchAnnouncement(): string {\n return this.#searchAnnouncement;\n }\n\n /** Timers do popover (diagnóstico de memória). */\n get timers(): number {\n return this.#announcer.size;\n }\n\n setActiveItem(key: string): void {\n if (this.#activeItem !== key) {\n this.#activeItem = key;\n this.#host.requestUpdate();\n }\n }\n\n /** Linhas da árvore: \"(Vazios)\", depois as datas expandidas ou os valores (até o limite). */\n treeItems(translation: GridI18n): HeaderFilterTreeItem[] {\n const state = this.#state;\n\n if (!state) {\n return this.#items = [];\n }\n\n const searching = !!state.search.trim();\n const blank = state.distinct.blanks > 0 && !searching;\n const offset = blank ? 1 : 0;\n const items: HeaderFilterTreeItem[] = [];\n const flat = state.distinct.tree && !searching ? undefined : this.visibleValues().slice(0, HEADER_FILTER_RENDER_LIMIT);\n const setSize = (flat?.length ?? state.distinct.tree!.length) + offset;\n\n if (blank) {\n items.push({ key: keyOf(null), text: translation.filterBlanks, count: state.distinct.blanks, values: [null], level: 1, setSize, posInSet: 1 });\n }\n\n if (flat) {\n flat.forEach((value, index) => items.push({\n key: keyOf(value.value),\n text: value.text,\n count: value.count,\n values: [value.value],\n level: 1,\n setSize,\n posInSet: index + 1 + offset,\n }));\n } else {\n flattenDates(state.distinct.tree!, state.expanded, 1, undefined, offset, items);\n }\n\n return this.#items = items;\n }\n\n get open(): boolean {\n return !!this.#state;\n }\n\n get column(): GridColumnDef | undefined {\n return this.#state?.column;\n }\n\n get state(): Readonly<OpenState> | undefined {\n return this.#state;\n }\n\n toggle(column: GridColumnDef): void {\n if (this.#state?.column === column) {\n this.close(true);\n return;\n }\n\n this.close();\n\n const distinct = this.#host._distinctValues(column);\n const all = [...distinct.blanks ? [null] : [], ...distinct.values.map(value => value.value)];\n const condition = findColumnCondition(this.#host.filterValue, column, 'header');\n const listed = new Set((Array.isArray(condition?.[1]) ? condition[1] as unknown[] : []).map(keyOf));\n const selected = new Set<string>();\n\n for (const value of all) {\n const key = keyOf(value);\n const inList = listed.has(key);\n\n if (!condition || (condition[0] === 'anyof' ? inList : !inList)) {\n selected.add(key);\n }\n }\n\n this.#state = { column, distinct, all, selected, search: '', expanded: new Set() };\n this.#shown = false;\n this.#host.requestUpdate();\n }\n\n close(restoreFocus = false): void {\n if (!this.#state) {\n return;\n }\n\n this.#restoreFocusTo = restoreFocus ? this.#state.column : undefined;\n this.#popover?.hidePopover?.();\n this.#state = undefined;\n this.#activeItem = undefined;\n this.#items = [];\n this.#searchAnnouncement = '';\n this.#announcer.cancel('search');\n document.removeEventListener('pointerdown', this.#outsidePointerDown, true);\n this.#host.requestUpdate();\n }\n\n /** A coluna do popover saiu das definições: fecha (não segura a coluna). */\n closeIfRemoved(columns: ReadonlySet<GridColumnDef>): void {\n if (this.#state && !columns.has(this.#state.column)) {\n this.close();\n }\n }\n\n /** Marca/desmarca valores (folhas). */\n setSelected(values: readonly unknown[], selected: boolean): void {\n const state = this.#state;\n\n if (!state) {\n return;\n }\n\n for (const value of values) {\n if (selected) {\n state.selected.add(keyOf(value));\n } else {\n state.selected.delete(keyOf(value));\n }\n }\n\n this.#host.requestUpdate();\n }\n\n isSelected(value: unknown): boolean {\n return !!this.#state?.selected.has(keyOf(value));\n }\n\n /** `true`/`false`/`'mixed'` de um grupo de valores (ano, mês, \"selecionar tudo\"). */\n stateOf(values: readonly unknown[]): boolean | 'mixed' {\n let checked = 0;\n\n for (const value of values) {\n if (this.isSelected(value)) {\n checked++;\n }\n }\n\n return checked === 0 ? false : checked === values.length ? true : 'mixed';\n }\n\n setSearch(text: string, translation?: GridI18n): void {\n if (!this.#state) {\n return;\n }\n\n this.#state.search = text;\n // A lista mudou: o roving volta ao 1º item visível (no render).\n this.#activeItem = undefined;\n this.#host.requestUpdate();\n\n if (translation) {\n // Quantos valores restaram, depois de parar de digitar (spec 17, A10).\n this.#announcer.run('search', () => {\n const state = this.#state;\n\n if (state) {\n const count = this.visibleValues().length + (state.distinct.blanks > 0 && !state.search.trim() ? 1 : 0);\n this.#searchAnnouncement = formatMessage(translation.headerFilterSearchAnnouncement, { count: String(count) });\n this.#host.requestUpdate();\n }\n }, 500);\n }\n }\n\n /** Busca do popover: ↓ vai à árvore; Enter = OK. */\n readonly onSearchKeyDown = (event: KeyboardEvent): void => {\n // Enter que confirma a composição (ja/zh/ko) não aplica.\n if (event.isComposing || event.keyCode === 229) {\n return;\n }\n\n if (event.key === 'ArrowDown') {\n const item = (event.currentTarget as HTMLElement).closest('.header-filter')?.querySelector<HTMLElement>('[role=treeitem][tabindex=\"0\"]');\n\n if (item) {\n event.preventDefault();\n item.focus();\n }\n } else if (event.key === 'Enter') {\n event.preventDefault();\n this.apply();\n }\n };\n\n /**\n * Árvore (APG Tree View, um ponto de Tab): ↑/↓/Home/End movem; →/←\n * (invertidas em RTL) expandem/recolhem ou vão ao filho/pai; Espaço marca;\n * Enter = OK; uma letra vai para a busca.\n */\n readonly onTreeKeyDown = (event: KeyboardEvent): void => {\n const tree = event.currentTarget as HTMLElement;\n const nodes = [...tree.querySelectorAll<HTMLElement>('[role=treeitem]')];\n const current = event.target as HTMLElement;\n const index = nodes.indexOf(current);\n const item = this.#items.find(entry => entry.key === current.getAttribute('data-key'));\n\n if (index < 0 || !item) {\n return;\n }\n\n let key = event.key;\n\n if (this.#host._isRtl() && (key === 'ArrowLeft' || key === 'ArrowRight')) {\n key = key === 'ArrowLeft' ? 'ArrowRight' : 'ArrowLeft';\n }\n\n let next: HTMLElement | undefined;\n\n switch (key) {\n case 'ArrowDown':\n next = nodes[index + 1];\n break;\n case 'ArrowUp':\n next = nodes[index - 1];\n break;\n case 'Home':\n next = nodes[0];\n break;\n case 'End':\n next = nodes[nodes.length - 1];\n break;\n case 'ArrowRight':\n if (item.expanded === false) {\n this.toggleExpanded(item.key.slice(2));\n } else if (item.expanded) {\n next = nodes[index + 1];\n }\n\n break;\n case 'ArrowLeft':\n if (item.expanded) {\n this.toggleExpanded(item.key.slice(2));\n } else if (item.parent) {\n next = nodes.find(node => node.getAttribute('data-key') === item.parent);\n }\n\n break;\n case ' ':\n this.setSelected(item.values, this.stateOf(item.values) !== true);\n break;\n case 'Enter':\n event.preventDefault();\n this.apply();\n return;\n default:\n // Digitar: o foco vai para a busca e a letra vai junto (não some).\n if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {\n tree.closest('.header-filter')?.querySelector<HTMLElement>('.header-filter-search')\n ?.focus();\n }\n\n return;\n }\n\n event.preventDefault();\n next?.focus();\n };\n\n toggleExpanded(key: string): void {\n const expanded = this.#state?.expanded;\n\n if (!expanded) {\n return;\n }\n\n if (!expanded.delete(key)) {\n expanded.add(key);\n }\n\n this.#host.requestUpdate();\n }\n\n /** Valores que a busca do popover deixa ver (texto exibido, sem caixa/acento). */\n visibleValues(): DistinctValue[] {\n const state = this.#state;\n\n if (!state) {\n return [];\n }\n\n const matcher = createTextMatcher(state.search);\n\n return matcher ? state.distinct.values.filter(value => matcher.test(value.text)) : state.distinct.values;\n }\n\n /** OK: todos marcados tira a condição; senão o menor entre `anyof` e `noneof`. */\n apply(): void {\n const state = this.#state;\n\n if (!state) {\n return;\n }\n\n const { column, all, selected } = state;\n const checked = all.filter(value => selected.has(keyOf(value)));\n const unchecked = all.filter(value => !selected.has(keyOf(value)));\n let condition: GridFilterCondition | null = null;\n\n if (unchecked.length) {\n condition = checked.length <= unchecked.length\n ? [column.path!, 'anyof', checked]\n : [column.path!, 'noneof', unchecked];\n }\n\n this.close(true);\n this.#host._userFilterColumn(column, 'header', condition);\n }\n\n /** \"Limpar filtro\": tira todas as condições da coluna (linha e cabeçalho). */\n clearColumn(): void {\n const column = this.#state?.column;\n\n if (column) {\n this.close(true);\n this.#host._userFilterColumn(column, 'all', null);\n }\n }\n\n get #popover(): HTMLElement | null {\n return this.#host.renderRoot.querySelector<HTMLElement>('.header-filter');\n }\n\n #buttonOf(column: GridColumnDef): HTMLElement | null {\n return this.#host.renderRoot.querySelector<HTMLElement>(`.header-filter-button[data-column=\"${columnKeyOf(column)}\"]`);\n }\n\n hostUpdated(): void {\n if (!this.#state) {\n if (this.#restoreFocusTo) {\n this.#buttonOf(this.#restoreFocusTo)?.focus();\n this.#restoreFocusTo = undefined;\n }\n\n return;\n }\n\n const popover = this.#popover;\n\n if (!popover || this.#shown) {\n return;\n }\n\n this.#shown = true;\n\n if (typeof popover.showPopover === 'function' && !popover.matches(':popover-open')) {\n popover.showPopover();\n }\n\n this.#position(popover, this.#buttonOf(this.#state.column));\n document.addEventListener('pointerdown', this.#outsidePointerDown, true);\n popover.querySelector<HTMLElement>('.header-filter-search')?.focus();\n }\n\n hostDisconnected(): void {\n document.removeEventListener('pointerdown', this.#outsidePointerDown, true);\n this.#state = undefined;\n this.#shown = false;\n this.#restoreFocusTo = undefined;\n this.#items = [];\n this.#searchAnnouncement = '';\n }\n\n #position(popover: HTMLElement, anchor: HTMLElement | null): void {\n if (!anchor) {\n return;\n }\n\n const rect = anchor.getBoundingClientRect();\n const width = popover.offsetWidth;\n const margin = 8;\n const viewport = document.documentElement.clientWidth;\n // Abre para dentro da tabela: da borda final do botão em LTR, inicial em RTL.\n const left = this.#host._isRtl() ? rect.left : rect.right - width;\n\n popover.style.top = `${Math.round(rect.bottom + 4)}px`;\n popover.style.left = `${Math.round(Math.max(margin, Math.min(left, viewport - width - margin)))}px`;\n }\n\n readonly #outsidePointerDown = (event: PointerEvent): void => {\n const keep = event.composedPath().some(target =>\n target instanceof HTMLElement\n && (target.classList.contains('header-filter') || target.classList.contains('header-filter-button')));\n\n if (!keep) {\n this.close();\n }\n };\n\n /** Esc cancela; Tab circula dentro do popover (foco preso). */\n readonly onKeyDown = (event: KeyboardEvent): void => {\n if (event.isComposing || event.keyCode === 229) {\n return;\n }\n\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n this.close(true);\n return;\n }\n\n if (event.key !== 'Tab') {\n return;\n }\n\n const popover = event.currentTarget as HTMLElement;\n const focusable = [...popover.querySelectorAll<HTMLElement>('input, button, [tabindex=\"0\"]')]\n .filter(element => !element.hasAttribute('disabled'));\n const root = popover.getRootNode() as Document | ShadowRoot;\n const active = root.activeElement;\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n\n if (event.shiftKey && active === first) {\n event.preventDefault();\n last?.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first?.focus();\n }\n };\n}\n\n/** Funil; com filtro ganha um ponto no canto (o estado não fica só na cor; spec 17, A5). */\nconst funnelIcon = (active: boolean) => html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" width=\"1em\" viewBox=\"0 -960 960 960\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M400-240v-80h160v80H400ZM240-440v-80h480v80H240ZM120-640v-80h${active ? 520 : 720}v80H120Z\"/>\n ${active ? svg`<circle class=\"header-filter-badge\" cx=\"800\" cy=\"-760\" r=\"110\"/>` : nothing}\n </svg>`;\n\n/** Botão de funil no cabeçalho; ativo quando a coluna tem alguma condição. */\nexport const renderHeaderFilterButton = (\n controller: HeaderFilterController,\n column: GridColumnDef,\n filterValue: GridFilterExpression | null,\n translation: GridI18n,\n /** Descrição do cabeçalho (traz \"Filtrada\"); spec 17, A5. */\n describedBy?: string,\n /** Sufixo dos ids do cabeçalho: com `headerRenderer` o nome segue o texto renderizado. */\n idSuffix?: string,\n /** Idioma dos textos da interface (o nome é texto da i18n; spec 17). */\n lang?: string,\n): TemplateResult => {\n const active = hasColumnCondition(filterValue, column);\n const label = formatMessage(translation.headerFilterLabel, { column: columnText(column) });\n const named = column.headerRenderer && idSuffix ? labelledByHeader(translation.headerFilterLabel, 'header-filter-name', idSuffix) : undefined;\n\n return html`\n <button\n class=\"header-filter-button ${active ? 'active' : ''}\"\n part=\"header-filter-button\"\n type=\"button\"\n tabindex=\"-1\"\n aria-label=${ifDefined(named ? undefined : label)}\n aria-labelledby=${ifDefined(named?.labelledBy)}\n lang=${ifDefined(lang)}\n title=${ifDefined(named && !column.label ? undefined : label)}\n aria-haspopup=\"dialog\"\n aria-expanded=${controller.column === column ? 'true' : 'false'}\n aria-describedby=${ifDefined(active ? describedBy : undefined)}\n data-column=${columnKeyOf(column)}\n @pointerdown=${(event: PointerEvent) => event.stopPropagation()}\n @click=${(event: MouseEvent) => {\n event.stopPropagation();\n controller.toggle(column);\n }}\n @keydown=${(event: KeyboardEvent) => {\n // Enter/Espaço no funil não podem ordenar a coluna. Fora da ordem de\n // Tab (o grid tem um ponto só): F2 ou Alt+↓ no cabeçalho chegam aqui.\n if (event.key === 'Enter' || event.key === ' ') {\n event.stopPropagation();\n }\n }}>${funnelIcon(active)}${named?.parts ?? nothing}</button>`;\n};\n\nconst checkbox = (\n state: boolean | 'mixed',\n label: string,\n count: number | undefined,\n onChange: (checked: boolean) => void,\n): TemplateResult => html`\n <label class=\"header-filter-check\">\n <input\n type=\"checkbox\"\n .checked=${live(state === true)}\n .indeterminate=${live(state === 'mixed')}\n @change=${(event: Event) => onChange((event.target as HTMLInputElement).checked)}>\n <span class=\"header-filter-text\">${label}</span>\n ${count === undefined ? nothing : html`<span class=\"header-filter-count\">${count}</span>`}\n </label>`;\n\nconst leavesOf = (node: DistinctDateNode | DistinctValue): unknown[] =>\n 'children' in node ? node.children.flatMap(leavesOf) : [node.value];\n\n/** Item da árvore do popover (uma linha desenhada). */\nexport interface HeaderFilterTreeItem {\n key: string;\n text: string;\n count: number;\n /** Valores (folhas) que o item marca/desmarca. */\n values: unknown[];\n level: number;\n setSize: number;\n posInSet: number;\n /** Só nós de data (ano, mês); `undefined` nas folhas. */\n expanded?: boolean;\n /** Chave do pai (← volta a ele). */\n parent?: string;\n}\n\n/** Achata a árvore de datas expandida em itens com nível e posição (spec 17, A10). */\nconst flattenDates = (\n nodes: readonly (DistinctDateNode | DistinctValue)[],\n expanded: ReadonlySet<string>,\n level: number,\n parent: string | undefined,\n offset: number,\n out: HeaderFilterTreeItem[],\n): void => {\n nodes.forEach((node, index) => {\n const isGroup = 'children' in node;\n const key = isGroup ? `d:${node.key}` : keyOf(node.value);\n const open = isGroup && expanded.has(node.key);\n\n out.push({\n key,\n text: node.text,\n count: node.count,\n values: leavesOf(node),\n level,\n setSize: nodes.length + offset,\n posInSet: index + 1 + offset,\n expanded: isGroup ? open : undefined,\n parent,\n });\n\n if (isGroup && open) {\n flattenDates(node.children, expanded, level + 1, key, 0, out);\n }\n });\n};\n\nconst boxIcon = (state: boolean | 'mixed') => html`\n <span class=\"header-filter-box\" aria-hidden=\"true\">${state\n ? html`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" width=\"18\" height=\"18\" fill=\"currentColor\">\n <path d=${state === 'mixed' ? 'M200-440v-80h560v80H200Z' : 'M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z'}/>\n </svg>`\n : nothing}</span>`;\n\nconst renderTreeItem = (controller: HeaderFilterController, item: HeaderFilterTreeItem, active: boolean): TemplateResult => {\n const state = controller.stateOf(item.values);\n\n return html`\n <li\n class=\"header-filter-item\"\n role=\"treeitem\"\n style=\"--_level: ${item.level - 1}\"\n tabindex=${active ? 0 : -1}\n data-key=${item.key}\n aria-level=${item.level}\n aria-setsize=${item.setSize}\n aria-posinset=${item.posInSet}\n aria-checked=${state === 'mixed' ? 'mixed' : state ? 'true' : 'false'}\n aria-expanded=${ifDefined(item.expanded === undefined ? undefined : item.expanded ? 'true' : 'false')}\n @focus=${() => controller.setActiveItem(item.key)}\n @click=${() => controller.setSelected(item.values, state !== true)}>\n ${item.expanded === undefined\n ? nothing\n : html`<span\n class=\"header-filter-expand ${item.expanded ? 'expanded' : ''}\"\n aria-hidden=\"true\"\n @click=${(event: Event) => {\n // Só ponteiro: pelo teclado, →/← no item (o estado está no aria-expanded do item).\n event.stopPropagation();\n controller.toggleExpanded(item.key.slice(2));\n }}>\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" width=\"1em\" viewBox=\"0 -960 960 960\" fill=\"currentColor\">\n <path d=\"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z\"/>\n </svg>\n </span>`}\n ${boxIcon(state)}\n <span class=\"header-filter-text\">${item.text}</span>\n <span class=\"header-filter-count\">${item.count}</span>\n </li>`;\n};\n\n/** O popover (quando aberto). */\nexport const renderHeaderFilter = (controller: HeaderFilterController, translation: GridI18n): TemplateResult | typeof nothing => {\n const state = controller.state;\n\n if (!state) {\n return nothing;\n }\n\n const { distinct, column } = state;\n const searching = !!state.search.trim();\n const useTree = !!distinct.tree && !searching;\n const visible = controller.visibleValues();\n const shown = visible.slice(0, HEADER_FILTER_RENDER_LIMIT);\n const blankVisible = distinct.blanks > 0 && !searching;\n const scope = [...blankVisible ? [null] : [], ...visible.map(value => value.value)];\n const title = formatMessage(translation.headerFilterLabel, { column: columnText(column) });\n const items = controller.treeItems(translation);\n const activeKey = items.some(item => item.key === controller.activeItem) ? controller.activeItem : items[0]?.key;\n const truncated = !useTree && visible.length > shown.length;\n\n return html`\n <div\n class=\"header-filter\"\n part=\"header-filter\"\n .popover=${'manual'}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=${title}\n @keydown=${controller.onKeyDown}>\n <input\n class=\"header-filter-search\"\n type=\"search\"\n autocomplete=\"off\"\n placeholder=${translation.searchPlaceholder}\n aria-label=${translation.headerFilterSearchLabel}\n .value=${live(state.search)}\n @keydown=${controller.onSearchKeyDown}\n @input=${(event: Event) => controller.setSearch((event.target as HTMLInputElement).value, translation)}>\n <div class=\"header-filter-select-all\">\n ${checkbox(\n controller.stateOf(scope),\n searching ? formatMessage(translation.selectAllResults, { count: String(scope.length) }) : translation.selectAll,\n undefined,\n checked => controller.setSelected(scope, checked),\n )}\n </div>\n <ul\n class=\"header-filter-list\"\n role=\"tree\"\n aria-multiselectable=\"true\"\n aria-label=${title}\n aria-describedby=${truncated ? 'header-filter-note' : nothing}\n @keydown=${controller.onTreeKeyDown}>\n ${map(items, item => renderTreeItem(controller, item, item.key === activeKey))}\n </ul>\n ${truncated\n ? html`<p class=\"header-filter-note\" id=\"header-filter-note\">${formatMessage(translation.headerFilterTruncated, {\n shown: String(shown.length),\n count: String(visible.length),\n })}</p>`\n : nothing}\n <div class=\"visually-hidden\" role=\"status\" aria-live=\"polite\">${controller.searchAnnouncement}</div>\n <div class=\"header-filter-actions\">\n <button class=\"header-filter-clear\" type=\"button\" @click=${() => controller.clearColumn()}>${translation.filterClear}</button>\n <span class=\"header-filter-spacer\"></span>\n <button class=\"header-filter-ok\" type=\"button\" @click=${() => controller.apply()}>${translation.ok}</button>\n <button class=\"header-filter-cancel\" type=\"button\" @click=${() => controller.close(true)}>${translation.cancel}</button>\n </div>\n </div>`;\n};\n"]}
1
+ {"version":3,"file":"header-filter.js","sourceRoot":"","sources":["../../src/features/header-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAwD,GAAG,EAAuB,MAAM,KAAK,CAAC;AACpH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAQ5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAmD,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjJ,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,iFAAiF;AACjF,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C,MAAM,SAAS,GAAG,aAAa,CAAC;AAEhC,0DAA0D;AAC1D,MAAM,KAAK,GAAG,CAAC,KAAc,EAAU,EAAE,CACvC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,C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import { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { map } from 'lit/directives/map.js';\n\nimport type {\n GridColumnDef,\n GridFilterCondition,\n GridFilterExpression,\n} from '../grid-column-def.js';\nimport type { GridI18n } from '../grid-i18n.js';\nimport { labelledByHeader } from '../render/header.js';\nimport { columnText } from '../row-model/columns.js';\nimport type { DistinctDateNode, DistinctValue, DistinctValues } from '../row-model/distinct.js';\nimport { type ColumnFilterKind, type FilterFieldResolver, filterFieldOf, findColumnCondition, hasColumnCondition } from '../row-model/filter.js';\nimport { createTextMatcher } from '../row-model/fold.js';\nimport { columnKeyOf } from './filter-row.js';\nimport { Debouncer } from './search.js';\nimport { formatMessage } from './sorting.js';\n\n/** Itens desenhados na lista plana; acima disso, a busca do popover estreita. */\nexport const HEADER_FILTER_RENDER_LIMIT = 500;\n\nconst BLANK_KEY = '\\u0000blank';\n\n/** Chave de um valor distinto no conjunto de marcados. */\nconst keyOf = (value: unknown): string =>\n value === null || value === undefined ? BLANK_KEY : `${typeof value}:${String(value)}`;\n\nexport interface HeaderFilterHost extends ReactiveControllerHost {\n readonly renderRoot: HTMLElement | DocumentFragment;\n readonly filterValue: GridFilterExpression | null;\n _distinctValues(column: GridColumnDef): DistinctValues;\n _userFilterColumn(column: GridColumnDef, kind: ColumnFilterKind | 'all', condition: GridFilterCondition | null): void;\n _resolveFilterField(field: string): GridColumnDef | undefined;\n _isRtl(): boolean;\n}\n\ninterface OpenState {\n column: GridColumnDef;\n distinct: DistinctValues;\n /** Todos os valores (vazio = `null`), na ordem da lista. */\n all: unknown[];\n selected: Set<string>;\n search: string;\n expanded: Set<string>;\n}\n\n/**\n * Popover do filtro do cabeçalho: valores distintos (com contagem), busca,\n * \"selecionar tudo\", datas em ano → mês → dia. OK aplica `anyof`/`noneof`\n * (o menor dos dois); Cancelar, Esc e clique fora fecham sem aplicar. Foco\n * preso no popover e devolvido ao botão do funil. O estado (valores, listener\n * do documento) é solto ao fechar e no `hostDisconnected`.\n */\nexport class HeaderFilterController implements ReactiveController {\n readonly #host: HeaderFilterHost;\n #state: OpenState | undefined;\n #shown = false;\n #restoreFocusTo: GridColumnDef | undefined;\n /** Item da árvore com \\`tabindex=\"0\"\\` (roving; spec 17, A10). */\n #activeItem: string | undefined;\n /** Itens do último render (o teclado acha nível, pai e estado por eles). */\n #items: HeaderFilterTreeItem[] = [];\n /** Contagem anunciada depois da busca (região \\`status\\` do popover). */\n #searchAnnouncement = '';\n readonly #announcer: Debouncer<'search'>;\n\n constructor(host: HeaderFilterHost) {\n this.#host = host;\n host.addController(this);\n this.#announcer = new Debouncer(host);\n }\n\n get activeItem(): string | undefined {\n return this.#activeItem;\n }\n\n get searchAnnouncement(): string {\n return this.#searchAnnouncement;\n }\n\n /** Timers do popover (diagnóstico de memória). */\n get timers(): number {\n return this.#announcer.size;\n }\n\n setActiveItem(key: string): void {\n if (this.#activeItem !== key) {\n this.#activeItem = key;\n this.#host.requestUpdate();\n }\n }\n\n /** Linhas da árvore: \"(Vazios)\", depois as datas expandidas ou os valores (até o limite). */\n treeItems(translation: GridI18n): HeaderFilterTreeItem[] {\n const state = this.#state;\n\n if (!state) {\n return this.#items = [];\n }\n\n const searching = !!state.search.trim();\n const blank = state.distinct.blanks > 0 && !searching;\n const offset = blank ? 1 : 0;\n const items: HeaderFilterTreeItem[] = [];\n const flat = state.distinct.tree && !searching ? undefined : this.visibleValues().slice(0, HEADER_FILTER_RENDER_LIMIT);\n const setSize = (flat?.length ?? state.distinct.tree!.length) + offset;\n\n if (blank) {\n items.push({ key: keyOf(null), text: translation.filterBlanks, count: state.distinct.blanks, values: [null], level: 1, setSize, posInSet: 1 });\n }\n\n if (flat) {\n flat.forEach((value, index) => items.push({\n key: keyOf(value.value),\n text: value.text,\n count: value.count,\n values: [value.value],\n level: 1,\n setSize,\n posInSet: index + 1 + offset,\n }));\n } else {\n flattenDates(state.distinct.tree!, state.expanded, 1, undefined, offset, items);\n }\n\n return this.#items = items;\n }\n\n get open(): boolean {\n return !!this.#state;\n }\n\n get column(): GridColumnDef | undefined {\n return this.#state?.column;\n }\n\n get state(): Readonly<OpenState> | undefined {\n return this.#state;\n }\n\n toggle(column: GridColumnDef): void {\n if (this.#state?.column === column) {\n this.close(true);\n return;\n }\n\n this.close();\n\n const distinct = this.#host._distinctValues(column);\n const all = [...distinct.blanks ? [null] : [], ...distinct.values.map(value => value.value)];\n const condition = findColumnCondition(this.#host.filterValue, column, 'header', field => this.#host._resolveFilterField(field));\n const listed = new Set((Array.isArray(condition?.[1]) ? condition[1] as unknown[] : []).map(keyOf));\n const selected = new Set<string>();\n\n for (const value of all) {\n const key = keyOf(value);\n const inList = listed.has(key);\n\n if (!condition || (condition[0] === 'anyof' ? inList : !inList)) {\n selected.add(key);\n }\n }\n\n this.#state = { column, distinct, all, selected, search: '', expanded: new Set() };\n this.#shown = false;\n this.#host.requestUpdate();\n }\n\n close(restoreFocus = false): void {\n if (!this.#state) {\n return;\n }\n\n this.#restoreFocusTo = restoreFocus ? this.#state.column : undefined;\n this.#popover?.hidePopover?.();\n this.#state = undefined;\n this.#activeItem = undefined;\n this.#items = [];\n this.#searchAnnouncement = '';\n this.#announcer.cancel('search');\n document.removeEventListener('pointerdown', this.#outsidePointerDown, true);\n this.#host.requestUpdate();\n }\n\n /** A coluna do popover saiu das definições: fecha (não segura a coluna). */\n closeIfRemoved(columns: ReadonlySet<GridColumnDef>): void {\n if (this.#state && !columns.has(this.#state.column)) {\n this.close();\n }\n }\n\n /** Marca/desmarca valores (folhas). */\n setSelected(values: readonly unknown[], selected: boolean): void {\n const state = this.#state;\n\n if (!state) {\n return;\n }\n\n for (const value of values) {\n if (selected) {\n state.selected.add(keyOf(value));\n } else {\n state.selected.delete(keyOf(value));\n }\n }\n\n this.#host.requestUpdate();\n }\n\n isSelected(value: unknown): boolean {\n return !!this.#state?.selected.has(keyOf(value));\n }\n\n /** `true`/`false`/`'mixed'` de um grupo de valores (ano, mês, \"selecionar tudo\"). */\n stateOf(values: readonly unknown[]): boolean | 'mixed' {\n let checked = 0;\n\n for (const value of values) {\n if (this.isSelected(value)) {\n checked++;\n }\n }\n\n return checked === 0 ? false : checked === values.length ? true : 'mixed';\n }\n\n setSearch(text: string, translation?: GridI18n): void {\n if (!this.#state) {\n return;\n }\n\n this.#state.search = text;\n // A lista mudou: o roving volta ao 1º item visível (no render).\n this.#activeItem = undefined;\n this.#host.requestUpdate();\n\n if (translation) {\n // Quantos valores restaram, depois de parar de digitar (spec 17, A10).\n this.#announcer.run('search', () => {\n const state = this.#state;\n\n if (state) {\n const count = this.visibleValues().length + (state.distinct.blanks > 0 && !state.search.trim() ? 1 : 0);\n this.#searchAnnouncement = formatMessage(translation.headerFilterSearchAnnouncement, { count: String(count) });\n this.#host.requestUpdate();\n }\n }, 500);\n }\n }\n\n /** Busca do popover: ↓ vai à árvore; Enter = OK. */\n readonly onSearchKeyDown = (event: KeyboardEvent): void => {\n // Enter que confirma a composição (ja/zh/ko) não aplica.\n if (event.isComposing || event.keyCode === 229) {\n return;\n }\n\n if (event.key === 'ArrowDown') {\n const item = (event.currentTarget as HTMLElement).closest('.header-filter')?.querySelector<HTMLElement>('[role=treeitem][tabindex=\"0\"]');\n\n if (item) {\n event.preventDefault();\n item.focus();\n }\n } else if (event.key === 'Enter') {\n event.preventDefault();\n this.apply();\n }\n };\n\n /**\n * Árvore (APG Tree View, um ponto de Tab): ↑/↓/Home/End movem; →/←\n * (invertidas em RTL) expandem/recolhem ou vão ao filho/pai; Espaço marca;\n * Enter = OK; uma letra vai para a busca.\n */\n readonly onTreeKeyDown = (event: KeyboardEvent): void => {\n const tree = event.currentTarget as HTMLElement;\n const nodes = [...tree.querySelectorAll<HTMLElement>('[role=treeitem]')];\n const current = event.target as HTMLElement;\n const index = nodes.indexOf(current);\n const item = this.#items.find(entry => entry.key === current.getAttribute('data-key'));\n\n if (index < 0 || !item) {\n return;\n }\n\n let key = event.key;\n\n if (this.#host._isRtl() && (key === 'ArrowLeft' || key === 'ArrowRight')) {\n key = key === 'ArrowLeft' ? 'ArrowRight' : 'ArrowLeft';\n }\n\n let next: HTMLElement | undefined;\n\n switch (key) {\n case 'ArrowDown':\n next = nodes[index + 1];\n break;\n case 'ArrowUp':\n next = nodes[index - 1];\n break;\n case 'Home':\n next = nodes[0];\n break;\n case 'End':\n next = nodes[nodes.length - 1];\n break;\n case 'ArrowRight':\n if (item.expanded === false) {\n this.toggleExpanded(item.key.slice(2));\n } else if (item.expanded) {\n next = nodes[index + 1];\n }\n\n break;\n case 'ArrowLeft':\n if (item.expanded) {\n this.toggleExpanded(item.key.slice(2));\n } else if (item.parent) {\n next = nodes.find(node => node.getAttribute('data-key') === item.parent);\n }\n\n break;\n case ' ':\n this.setSelected(item.values, this.stateOf(item.values) !== true);\n break;\n case 'Enter':\n event.preventDefault();\n this.apply();\n return;\n default:\n // Digitar: o foco vai para a busca e a letra vai junto (não some).\n if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {\n tree.closest('.header-filter')?.querySelector<HTMLElement>('.header-filter-search')\n ?.focus();\n }\n\n return;\n }\n\n event.preventDefault();\n next?.focus();\n };\n\n toggleExpanded(key: string): void {\n const expanded = this.#state?.expanded;\n\n if (!expanded) {\n return;\n }\n\n if (!expanded.delete(key)) {\n expanded.add(key);\n }\n\n this.#host.requestUpdate();\n }\n\n /** Valores que a busca do popover deixa ver (texto exibido, sem caixa/acento). */\n visibleValues(): DistinctValue[] {\n const state = this.#state;\n\n if (!state) {\n return [];\n }\n\n const matcher = createTextMatcher(state.search);\n\n return matcher ? state.distinct.values.filter(value => matcher.test(value.text)) : state.distinct.values;\n }\n\n /** OK: todos marcados tira a condição; senão o menor entre `anyof` e `noneof`. */\n apply(): void {\n const state = this.#state;\n\n if (!state) {\n return;\n }\n\n const { column, all, selected } = state;\n const checked = all.filter(value => selected.has(keyOf(value)));\n const unchecked = all.filter(value => !selected.has(keyOf(value)));\n let condition: GridFilterCondition | null = null;\n\n if (unchecked.length) {\n condition = checked.length <= unchecked.length\n ? [filterFieldOf(column)!, 'anyof', checked]\n : [filterFieldOf(column)!, 'noneof', unchecked];\n }\n\n this.close(true);\n this.#host._userFilterColumn(column, 'header', condition);\n }\n\n /** \"Limpar filtro\": tira todas as condições da coluna (linha e cabeçalho). */\n clearColumn(): void {\n const column = this.#state?.column;\n\n if (column) {\n this.close(true);\n this.#host._userFilterColumn(column, 'all', null);\n }\n }\n\n get #popover(): HTMLElement | null {\n return this.#host.renderRoot.querySelector<HTMLElement>('.header-filter');\n }\n\n #buttonOf(column: GridColumnDef): HTMLElement | null {\n return this.#host.renderRoot.querySelector<HTMLElement>(`.header-filter-button[data-column=\"${columnKeyOf(column)}\"]`);\n }\n\n hostUpdated(): void {\n if (!this.#state) {\n if (this.#restoreFocusTo) {\n this.#buttonOf(this.#restoreFocusTo)?.focus();\n this.#restoreFocusTo = undefined;\n }\n\n return;\n }\n\n const popover = this.#popover;\n\n if (!popover || this.#shown) {\n return;\n }\n\n this.#shown = true;\n\n if (typeof popover.showPopover === 'function' && !popover.matches(':popover-open')) {\n popover.showPopover();\n }\n\n this.#position(popover, this.#buttonOf(this.#state.column));\n document.addEventListener('pointerdown', this.#outsidePointerDown, true);\n popover.querySelector<HTMLElement>('.header-filter-search')?.focus();\n }\n\n hostDisconnected(): void {\n document.removeEventListener('pointerdown', this.#outsidePointerDown, true);\n this.#state = undefined;\n this.#shown = false;\n this.#restoreFocusTo = undefined;\n this.#items = [];\n this.#searchAnnouncement = '';\n }\n\n #position(popover: HTMLElement, anchor: HTMLElement | null): void {\n if (!anchor) {\n return;\n }\n\n const rect = anchor.getBoundingClientRect();\n const width = popover.offsetWidth;\n const margin = 8;\n const viewport = document.documentElement.clientWidth;\n // Abre para dentro da tabela: da borda final do botão em LTR, inicial em RTL.\n const left = this.#host._isRtl() ? rect.left : rect.right - width;\n\n popover.style.top = `${Math.round(rect.bottom + 4)}px`;\n popover.style.left = `${Math.round(Math.max(margin, Math.min(left, viewport - width - margin)))}px`;\n }\n\n readonly #outsidePointerDown = (event: PointerEvent): void => {\n const keep = event.composedPath().some(target =>\n target instanceof HTMLElement\n && (target.classList.contains('header-filter') || target.classList.contains('header-filter-button')));\n\n if (!keep) {\n this.close();\n }\n };\n\n /** Esc cancela; Tab circula dentro do popover (foco preso). */\n readonly onKeyDown = (event: KeyboardEvent): void => {\n if (event.isComposing || event.keyCode === 229) {\n return;\n }\n\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n this.close(true);\n return;\n }\n\n if (event.key !== 'Tab') {\n return;\n }\n\n const popover = event.currentTarget as HTMLElement;\n const focusable = [...popover.querySelectorAll<HTMLElement>('input, button, [tabindex=\"0\"]')]\n .filter(element => !element.hasAttribute('disabled'));\n const root = popover.getRootNode() as Document | ShadowRoot;\n const active = root.activeElement;\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n\n if (event.shiftKey && active === first) {\n event.preventDefault();\n last?.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first?.focus();\n }\n };\n}\n\n/** Funil; com filtro ganha um ponto no canto (o estado não fica só na cor; spec 17, A5). */\nconst funnelIcon = (active: boolean) => html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" width=\"1em\" viewBox=\"0 -960 960 960\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M400-240v-80h160v80H400ZM240-440v-80h480v80H240ZM120-640v-80h${active ? 520 : 720}v80H120Z\"/>\n ${active ? svg`<circle class=\"header-filter-badge\" cx=\"800\" cy=\"-760\" r=\"110\"/>` : nothing}\n </svg>`;\n\n/** Botão de funil no cabeçalho; ativo quando a coluna tem alguma condição. */\nexport const renderHeaderFilterButton = (\n controller: HeaderFilterController,\n column: GridColumnDef,\n filterValue: GridFilterExpression | null,\n translation: GridI18n,\n /** Campo de condição → coluna (spec 28); o mesmo do avaliador. */\n resolve: FilterFieldResolver,\n /** Descrição do cabeçalho (traz \"Filtrada\"); spec 17, A5. */\n describedBy?: string,\n /** Sufixo dos ids do cabeçalho: com `headerRenderer` o nome segue o texto renderizado. */\n idSuffix?: string,\n /** Idioma dos textos da interface (o nome é texto da i18n; spec 17). */\n lang?: string,\n): TemplateResult => {\n const active = hasColumnCondition(filterValue, column, resolve);\n const label = formatMessage(translation.headerFilterLabel, { column: columnText(column) });\n const named = column.headerRenderer && idSuffix ? labelledByHeader(translation.headerFilterLabel, 'header-filter-name', idSuffix) : undefined;\n\n return html`\n <button\n class=\"header-filter-button ${active ? 'active' : ''}\"\n part=\"header-filter-button\"\n type=\"button\"\n tabindex=\"-1\"\n aria-label=${ifDefined(named ? undefined : label)}\n aria-labelledby=${ifDefined(named?.labelledBy)}\n lang=${ifDefined(lang)}\n title=${ifDefined(named && !column.label ? undefined : label)}\n aria-haspopup=\"dialog\"\n aria-expanded=${controller.column === column ? 'true' : 'false'}\n aria-describedby=${ifDefined(active ? describedBy : undefined)}\n data-column=${columnKeyOf(column)}\n @pointerdown=${(event: PointerEvent) => event.stopPropagation()}\n @click=${(event: MouseEvent) => {\n event.stopPropagation();\n controller.toggle(column);\n }}\n @keydown=${(event: KeyboardEvent) => {\n // Enter/Espaço no funil não podem ordenar a coluna. Fora da ordem de\n // Tab (o grid tem um ponto só): F2 ou Alt+↓ no cabeçalho chegam aqui.\n if (event.key === 'Enter' || event.key === ' ') {\n event.stopPropagation();\n }\n }}>${funnelIcon(active)}${named?.parts ?? nothing}</button>`;\n};\n\nconst checkbox = (\n state: boolean | 'mixed',\n label: string,\n count: number | undefined,\n onChange: (checked: boolean) => void,\n): TemplateResult => html`\n <label class=\"header-filter-check\">\n <input\n type=\"checkbox\"\n .checked=${live(state === true)}\n .indeterminate=${live(state === 'mixed')}\n @change=${(event: Event) => onChange((event.target as HTMLInputElement).checked)}>\n <span class=\"header-filter-text\">${label}</span>\n ${count === undefined ? nothing : html`<span class=\"header-filter-count\">${count}</span>`}\n </label>`;\n\nconst leavesOf = (node: DistinctDateNode | DistinctValue): unknown[] =>\n 'children' in node ? node.children.flatMap(leavesOf) : [node.value];\n\n/** Item da árvore do popover (uma linha desenhada). */\nexport interface HeaderFilterTreeItem {\n key: string;\n text: string;\n count: number;\n /** Valores (folhas) que o item marca/desmarca. */\n values: unknown[];\n level: number;\n setSize: number;\n posInSet: number;\n /** Só nós de data (ano, mês); `undefined` nas folhas. */\n expanded?: boolean;\n /** Chave do pai (← volta a ele). */\n parent?: string;\n}\n\n/** Achata a árvore de datas expandida em itens com nível e posição (spec 17, A10). */\nconst flattenDates = (\n nodes: readonly (DistinctDateNode | DistinctValue)[],\n expanded: ReadonlySet<string>,\n level: number,\n parent: string | undefined,\n offset: number,\n out: HeaderFilterTreeItem[],\n): void => {\n nodes.forEach((node, index) => {\n const isGroup = 'children' in node;\n const key = isGroup ? `d:${node.key}` : keyOf(node.value);\n const open = isGroup && expanded.has(node.key);\n\n out.push({\n key,\n text: node.text,\n count: node.count,\n values: leavesOf(node),\n level,\n setSize: nodes.length + offset,\n posInSet: index + 1 + offset,\n expanded: isGroup ? open : undefined,\n parent,\n });\n\n if (isGroup && open) {\n flattenDates(node.children, expanded, level + 1, key, 0, out);\n }\n });\n};\n\nconst boxIcon = (state: boolean | 'mixed') => html`\n <span class=\"header-filter-box\" aria-hidden=\"true\">${state\n ? html`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" width=\"18\" height=\"18\" fill=\"currentColor\">\n <path d=${state === 'mixed' ? 'M200-440v-80h560v80H200Z' : 'M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z'}/>\n </svg>`\n : nothing}</span>`;\n\nconst renderTreeItem = (controller: HeaderFilterController, item: HeaderFilterTreeItem, active: boolean): TemplateResult => {\n const state = controller.stateOf(item.values);\n\n return html`\n <li\n class=\"header-filter-item\"\n role=\"treeitem\"\n style=\"--_level: ${item.level - 1}\"\n tabindex=${active ? 0 : -1}\n data-key=${item.key}\n aria-level=${item.level}\n aria-setsize=${item.setSize}\n aria-posinset=${item.posInSet}\n aria-checked=${state === 'mixed' ? 'mixed' : state ? 'true' : 'false'}\n aria-expanded=${ifDefined(item.expanded === undefined ? undefined : item.expanded ? 'true' : 'false')}\n @focus=${() => controller.setActiveItem(item.key)}\n @click=${() => controller.setSelected(item.values, state !== true)}>\n ${item.expanded === undefined\n ? nothing\n : html`<span\n class=\"header-filter-expand ${item.expanded ? 'expanded' : ''}\"\n aria-hidden=\"true\"\n @click=${(event: Event) => {\n // Só ponteiro: pelo teclado, →/← no item (o estado está no aria-expanded do item).\n event.stopPropagation();\n controller.toggleExpanded(item.key.slice(2));\n }}>\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" width=\"1em\" viewBox=\"0 -960 960 960\" fill=\"currentColor\">\n <path d=\"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z\"/>\n </svg>\n </span>`}\n ${boxIcon(state)}\n <span class=\"header-filter-text\">${item.text}</span>\n <span class=\"header-filter-count\">${item.count}</span>\n </li>`;\n};\n\n/** O popover (quando aberto). */\nexport const renderHeaderFilter = (controller: HeaderFilterController, translation: GridI18n): TemplateResult | typeof nothing => {\n const state = controller.state;\n\n if (!state) {\n return nothing;\n }\n\n const { distinct, column } = state;\n const searching = !!state.search.trim();\n const useTree = !!distinct.tree && !searching;\n const visible = controller.visibleValues();\n const shown = visible.slice(0, HEADER_FILTER_RENDER_LIMIT);\n const blankVisible = distinct.blanks > 0 && !searching;\n const scope = [...blankVisible ? [null] : [], ...visible.map(value => value.value)];\n const title = formatMessage(translation.headerFilterLabel, { column: columnText(column) });\n const items = controller.treeItems(translation);\n const activeKey = items.some(item => item.key === controller.activeItem) ? controller.activeItem : items[0]?.key;\n const truncated = !useTree && visible.length > shown.length;\n\n return html`\n <div\n class=\"header-filter\"\n part=\"header-filter\"\n .popover=${'manual'}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=${title}\n @keydown=${controller.onKeyDown}>\n <input\n class=\"header-filter-search\"\n type=\"search\"\n autocomplete=\"off\"\n placeholder=${translation.searchPlaceholder}\n aria-label=${translation.headerFilterSearchLabel}\n .value=${live(state.search)}\n @keydown=${controller.onSearchKeyDown}\n @input=${(event: Event) => controller.setSearch((event.target as HTMLInputElement).value, translation)}>\n <div class=\"header-filter-select-all\">\n ${checkbox(\n controller.stateOf(scope),\n searching ? formatMessage(translation.selectAllResults, { count: String(scope.length) }) : translation.selectAll,\n undefined,\n checked => controller.setSelected(scope, checked),\n )}\n </div>\n <ul\n class=\"header-filter-list\"\n role=\"tree\"\n aria-multiselectable=\"true\"\n aria-label=${title}\n aria-describedby=${truncated ? 'header-filter-note' : nothing}\n @keydown=${controller.onTreeKeyDown}>\n ${map(items, item => renderTreeItem(controller, item, item.key === activeKey))}\n </ul>\n ${truncated\n ? html`<p class=\"header-filter-note\" id=\"header-filter-note\">${formatMessage(translation.headerFilterTruncated, {\n shown: String(shown.length),\n count: String(visible.length),\n })}</p>`\n : nothing}\n <div class=\"visually-hidden\" role=\"status\" aria-live=\"polite\">${controller.searchAnnouncement}</div>\n <div class=\"header-filter-actions\">\n <button class=\"header-filter-clear\" type=\"button\" @click=${() => controller.clearColumn()}>${translation.filterClear}</button>\n <span class=\"header-filter-spacer\"></span>\n <button class=\"header-filter-ok\" type=\"button\" @click=${() => controller.apply()}>${translation.ok}</button>\n <button class=\"header-filter-cancel\" type=\"button\" @click=${() => controller.close(true)}>${translation.cancel}</button>\n </div>\n </div>`;\n};\n"]}
@@ -16,8 +16,12 @@ export type GridColumnComparator<TItem = any> = (a: any, b: any, itemA: TItem, i
16
16
  export type GridColumnDataType = 'string' | 'number' | 'date' | 'datetime' | 'boolean';
17
17
  /** Logical alignment: `start`/`end` follow the direction (RTL). */
18
18
  export type GridColumnAlignment = 'start' | 'center' | 'end';
19
- /** Boolean as text (`trueText`/`falseText`) or as a read-only check icon. */
20
- export type GridColumnBooleanDisplay = 'text' | 'icon';
19
+ /**
20
+ * Boolean as text (`trueText`/`falseText`), as a read-only check/cross icon
21
+ * (`icon`) or as a check for `true` only (`check`: `false` shows nothing, its
22
+ * text stays for screen readers).
23
+ */
24
+ export type GridColumnBooleanDisplay = 'text' | 'icon' | 'check';
21
25
  /** Formats a cell value into its displayed text. */
22
26
  export type GridColumnFormatter<TItem = any> = (value: unknown, item: TItem) => string;
23
27
  /** `Intl` number/date options or a formatter function. */
@@ -28,11 +32,14 @@ export type GridColumnFormat<TItem = any> = Intl.NumberFormatOptions | Intl.Date
28
32
  */
29
33
  export type GridFilterOperation = '=' | '<>' | '<' | '<=' | '>' | '>=' | 'contains' | 'notcontains' | 'startswith' | 'endswith' | 'between' | 'anyof' | 'noneof' | 'isblank' | 'isnotblank';
30
34
  /**
31
- * One condition: `[path, operation, value]`. `path` is the column `path`;
35
+ * One condition: `[field, operation, value]`. `field` is the column `path`
36
+ * or, for a column without `path` (computed by `valueGetter`), its `name`;
37
+ * a `path` match wins over a `name` (the reverse of `GridColumnRef`), and a
38
+ * field that matches no column is read from the items as a dot path.
32
39
  * `between` takes `[start, end]` (inclusive, either may be `null`), `anyof` /
33
40
  * `noneof` take a list, `isblank` / `isnotblank` take no value.
34
41
  */
35
- export type GridFilterCondition = readonly [path: string, operation: GridFilterOperation, value?: unknown] | readonly [path: string, value: unknown];
42
+ export type GridFilterCondition = readonly [field: string, operation: GridFilterOperation, value?: unknown] | readonly [field: string, value: unknown];
36
43
  /**
37
44
  * Serializable filter expression (same shape as DevExtreme): a condition, a
38
45
  * negation `['!', expression]` or a group of expressions joined by `'and'` /
@@ -68,7 +75,7 @@ export interface GridColumnDef<TItem = any> {
68
75
  groupIndex?: number | null;
69
76
  /**
70
77
  * The column's name as text: the header text (unless `headerRenderer`;
71
- * empty: `path`) and its name everywhere else (header buttons, group chip
78
+ * empty: `path`, or the `name` of a column with a `valueGetter`) and its name everywhere else (header buttons, group chip
72
79
  * and rows, column chooser, row details, announcements, export; empty:
73
80
  * `path`, then `name`, as is). Set it also with `headerRenderer`.
74
81
  */
@@ -78,8 +85,9 @@ export interface GridColumnDef<TItem = any> {
78
85
  /**
79
86
  * Stable id of the column in the grid state (`getState`, `stateStorage`)
80
87
  * and in string column references (`summary` items look it up before
81
- * `path`). Default: `path`. A column without `name` and `path` is left out
82
- * of the state.
88
+ * `path`) and, for a column without `path`, in filter conditions
89
+ * (`filterValue`). Default: `path`. A column without `name` and `path` is
90
+ * left out of the state.
83
91
  */
84
92
  name?: string;
85
93
  /** Data type; without it, inferred from the first non-null value. */
@@ -92,10 +100,29 @@ export interface GridColumnDef<TItem = any> {
92
100
  valueGetter?: ((item: TItem) => unknown) | null;
93
101
  /** Displayed text (cell and group row); wins over `format`. */
94
102
  displayValue?: ((value: unknown, item: TItem) => string) | null;
95
- /** Boolean as text (default) or icon; the icon has the text as its accessible name. */
103
+ /**
104
+ * `'text'` (default: `trueText`/`falseText`), `'icon'` (read-only check/cross,
105
+ * the text as its accessible name) or `'check'` (check for `true` only;
106
+ * `false` keeps its text for screen readers).
107
+ */
96
108
  booleanDisplay?: GridColumnBooleanDisplay | null;
97
- /** Wraps the text in several lines instead of an ellipsis. */
109
+ /**
110
+ * Text of `true` in a boolean column (declared or inferred): cell, icon
111
+ * name, group row, filters, copy/paste, summaries and export. Empty or
112
+ * `null`: the language's `trueText`. A fixed text: it does not follow
113
+ * `language`.
114
+ */
115
+ trueText?: string | null;
116
+ /** Text of `false` in a boolean column, like `trueText`. Empty or `null`: the language's `falseText`. */
117
+ falseText?: string | null;
118
+ /** Wraps the cell text in several lines instead of an ellipsis (cells only; see `headerWrap`). */
98
119
  wrap?: boolean;
120
+ /**
121
+ * Wraps the header label in several lines instead of an ellipsis; the
122
+ * header row grows. `null`/absent: the grid's `headerWrap`; `false` turns it
123
+ * off for this column.
124
+ */
125
+ headerWrap?: boolean | null;
99
126
  /** Text for empty values (`null`/`undefined`). */
100
127
  emptyText?: string | null;
101
128
  /**
@@ -122,8 +149,9 @@ export interface GridColumnDef<TItem = any> {
122
149
  comparator?: GridColumnComparator<TItem> | null;
123
150
  /**
124
151
  * Allows filtering by this column (filter row, header filter and, by
125
- * default, the search panel). Default: `true` when the column has a `path`
126
- * (the filter expression refers to columns by `path`).
152
+ * default, the search panel). Default: `true` with a `path`, or with a
153
+ * `valueGetter` and a `name` (not with remote filtering). The filter
154
+ * expression refers to the column by `path` or, without one, by `name`.
127
155
  */
128
156
  filterable?: boolean | null;
129
157
  /**
@@ -334,6 +362,12 @@ export interface GridGroupRenderContext<TItem = any> extends GridRenderContextBa
334
362
  readonly itemCount: number;
335
363
  /** Whether the group is expanded. */
336
364
  readonly expanded: boolean;
365
+ /**
366
+ * The first row of the group in the current order (after filtering), to
367
+ * show data of the group's rows (an icon, a link); `undefined` when the
368
+ * group has no loaded rows (remote groups).
369
+ */
370
+ readonly firstItem: TItem | undefined;
337
371
  /** Summaries shown in the group row text (`display: 'inline'`). */
338
372
  readonly summaries: readonly GridSummaryValue<TItem>[];
339
373
  /** The full label the grid would show (`"Country: Brazil (3, Sum of Population: 1,234)"`). */
@@ -14,10 +14,14 @@ export const isColumnSortable = (column) => column.sortable ?? (!!column.path ||
14
14
  */
15
15
  export const isColumnExportable = (column) => column.exportable ?? (!!column.path || !!column.valueGetter || !!column.displayValue);
16
16
  /**
17
- * A coluna pode ser filtrada pelo usuário? (a expressão aponta a coluna pelo `path`)
17
+ * A coluna pode ser filtrada pelo usuário, olhando só a coluna? A condição a
18
+ * aponta pelo `path` ou, sem `path`, pelo `name` (spec 28). Padrão: com
19
+ * `path`, ou com `valueGetter` e `name` (sem getter a coluna sem `path` não
20
+ * tem valor; `filterable: true` não muda isso). O grid ainda tira a colisão
21
+ * de `name` e o remoto.
18
22
  * @internal
19
23
  */
20
- export const isColumnFilterable = (column) => !!column.path && column.filterable !== false;
24
+ export const isColumnFilterable = (column) => column.filterable !== false && (!!column.path || (!!column.valueGetter && !!column.name));
21
25
  /**
22
26
  * A coluna é editável (sem olhar o `allowEditing` do grid)? Padrão: com
23
27
  * `path` ou `valueSetter`.
@@ -1 +1 @@
1
- {"version":3,"file":"grid-column-def.js","sourceRoot":"","sources":["../src/grid-column-def.ts"],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,CAAC,MAAM,GAAG,CAAC,CAAC","sourcesContent":["import type { nothing, TemplateResult } from 'lit';\r\n\r\nimport type { DataGrid } from './grid.js';\r\n\r\n/** Sort direction: ascending or descending. */\r\nexport type GridSortOrder = 'asc' | 'desc';\r\n\r\n/** A column of the current sorting and its direction (`getSorting()`). */\r\nexport interface GridSort {\r\n column: GridColumnDef;\r\n order: GridSortOrder;\r\n}\r\n\r\n/**\r\n * Custom comparator of a column, in ascending order (the grid applies the\r\n * direction). Receives the cell values and the row items.\r\n */\r\nexport type GridColumnComparator<TItem = any> = (a: any, b: any, itemA: TItem, itemB: TItem) => number;\r\n\r\n/** Data type of a column; without `dataType`, inferred from the first non-null value. */\r\nexport type GridColumnDataType = 'string' | 'number' | 'date' | 'datetime' | 'boolean';\r\n\r\n/** Logical alignment: `start`/`end` follow the direction (RTL). */\r\nexport type GridColumnAlignment = 'start' | 'center' | 'end';\r\n\r\n/** Boolean as text (`trueText`/`falseText`) or as a read-only check icon. */\r\nexport type GridColumnBooleanDisplay = 'text' | 'icon';\r\n\r\n/** Formats a cell value into its displayed text. */\r\nexport type GridColumnFormatter<TItem = any> = (value: unknown, item: TItem) => string;\r\n\r\n/** `Intl` number/date options or a formatter function. */\r\nexport type GridColumnFormat<TItem = any> = Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | GridColumnFormatter<TItem>;\r\n\r\n/**\r\n * Filter operation of a condition. Text operations (`contains`, `notcontains`,\r\n * `startswith`, `endswith`) and `=` on text ignore case and accents.\r\n */\r\nexport type GridFilterOperation =\r\n | '=' | '<>' | '<' | '<=' | '>' | '>='\r\n | 'contains' | 'notcontains' | 'startswith' | 'endswith'\r\n | 'between' | 'anyof' | 'noneof' | 'isblank' | 'isnotblank';\r\n\r\n/**\r\n * One condition: `[path, operation, value]`. `path` is the column `path`;\r\n * `between` takes `[start, end]` (inclusive, either may be `null`), `anyof` /\r\n * `noneof` take a list, `isblank` / `isnotblank` take no value.\r\n */\r\nexport type GridFilterCondition =\r\n | readonly [path: string, operation: GridFilterOperation, value?: unknown]\r\n | readonly [path: string, value: unknown];\r\n\r\n/**\r\n * Serializable filter expression (same shape as DevExtreme): a condition, a\r\n * negation `['!', expression]` or a group of expressions joined by `'and'` /\r\n * `'or'` (`and` binds tighter; two expressions in a row mean `and`).\r\n */\r\nexport type GridFilterExpression =\r\n | GridFilterCondition\r\n | readonly ['!', GridFilterExpression]\r\n | readonly (GridFilterExpression | 'and' | 'or')[];\r\n\r\n/** Side a column is fixed to (logical: mirrors in RTL). */\r\nexport type GridColumnFixed = 'start' | 'end' | null;\r\n\r\n/**\r\n * Column definition (the `columns` property of `<u-grid>`). Mirrors the\r\n * `<u-grid-column>` element: same names, types and defaults. `TItem` types\r\n * the row item in the callbacks.\r\n */\r\nexport interface GridColumnDef<TItem = any> {\r\n /**\r\n * Nested columns: a column with at least one nested column is a BAND (a\r\n * header over its columns, no cells). In a band only `label`,\r\n * `headerRenderer`, `alignment` (of the label; default `start`), `fixed`,\r\n * `visible` and `showInChooser` apply; the other fields are ignored. A band\r\n * is shown while it is visible and has a visible column. Columns reorder\r\n * only inside their own band; only leaf columns sort, group and export.\r\n * `null` or `[]` = a regular column.\r\n */\r\n columns?: readonly GridColumnDef<TItem>[] | null;\r\n /**\r\n * Width in px. Under virtual column rendering (`columnRenderingMode`) a\r\n * column without `width` takes its auto-size width or `max(minWidth, 150)` px.\r\n */\r\n width?: number | null;\r\n /** Minimum width in px (also when resizing and auto-sizing). */\r\n minWidth?: number | null;\r\n /** INITIAL grouping level; afterwards grouping is grid state (`groupColumn`, `ungroupColumn`). */\r\n groupIndex?: number | null;\r\n /**\r\n * The column's name as text: the header text (unless `headerRenderer`;\r\n * empty: `path`) and its name everywhere else (header buttons, group chip\r\n * and rows, column chooser, row details, announcements, export; empty:\r\n * `path`, then `name`, as is). Set it also with `headerRenderer`.\r\n */\r\n label?: string;\r\n /** Dot path of the cell value in the row item (`\"address.city\"`). */\r\n path?: string;\r\n /**\r\n * Stable id of the column in the grid state (`getState`, `stateStorage`)\r\n * and in string column references (`summary` items look it up before\r\n * `path`). Default: `path`. A column without `name` and `path` is left out\r\n * of the state.\r\n */\r\n name?: string;\r\n /** Data type; without it, inferred from the first non-null value. */\r\n dataType?: GridColumnDataType | null;\r\n /** `Intl` options or a formatter function. */\r\n format?: GridColumnFormat<TItem> | null;\r\n /** Logical alignment; default by data type (numbers at the end). In a band, of the header label (default `start`). */\r\n alignment?: GridColumnAlignment | null;\r\n /** Cell value used to group, sort and filter. Default: read `path`. */\r\n valueGetter?: ((item: TItem) => unknown) | null;\r\n /** Displayed text (cell and group row); wins over `format`. */\r\n displayValue?: ((value: unknown, item: TItem) => string) | null;\r\n /** Boolean as text (default) or icon; the icon has the text as its accessible name. */\r\n booleanDisplay?: GridColumnBooleanDisplay | null;\r\n /** Wraps the text in several lines instead of an ellipsis. */\r\n wrap?: boolean;\r\n /** Text for empty values (`null`/`undefined`). */\r\n emptyText?: string | null;\r\n /**\r\n * Builds the cell content: a Lit `TemplateResult` (recommended), a string\r\n * (text, never HTML) or an `HTMLElement` (placed in the grid's light DOM).\r\n * `null`, `undefined` and Lit's `nothing` render an empty cell. See `GridCellRenderer`.\r\n */\r\n renderer?: GridCellRenderer<TItem> | null;\r\n /**\r\n * Builds the header label (sort arrow, filter button and resize handle stay; their accessible names\r\n * follow the rendered text). Set `label` too: it names the column outside the header (without it\r\n * the grid warns once and uses `path`, then `name`).\r\n */\r\n headerRenderer?: GridHeaderRenderer<TItem> | null;\r\n /** Builds the label of the group rows of this column (expand button and aligned summaries stay). */\r\n groupRenderer?: GridGroupRenderer<TItem> | null;\r\n /** Allows sorting from the header. Default: `true` when the column has a `path`, `valueGetter` or `comparator`. */\r\n sortable?: boolean | null;\r\n /** INITIAL sort direction; afterwards sorting is grid state (`sortColumn`, `getSorting`). */\r\n sortOrder?: GridSortOrder | null;\r\n /** Priority of the initial sort among columns (lower first). */\r\n sortIndex?: number | null;\r\n /** Custom ascending comparator. */\r\n comparator?: GridColumnComparator<TItem> | null;\r\n /**\r\n * Allows filtering by this column (filter row, header filter and, by\r\n * default, the search panel). Default: `true` when the column has a `path`\r\n * (the filter expression refers to columns by `path`).\r\n */\r\n filterable?: boolean | null;\r\n /**\r\n * Operations offered in the filter row operation menu (only the menu: the\r\n * header filter and `filterValue` are not checked). Default by data type.\r\n */\r\n filterOperations?: readonly GridFilterOperation[] | null;\r\n /** Operation of the filter row editor. Default: `contains` for text, `=` otherwise (or the first of `filterOperations`). */\r\n defaultFilterOperation?: GridFilterOperation | null;\r\n /** `false` prevents resizing this column even with `column-resizing`. */\r\n resizable?: boolean | null;\r\n /** Maximum width in px when resizing and auto-sizing. */\r\n maxWidth?: number | null;\r\n /**\r\n * Order in which the column leaves the table when the grid is too narrow\r\n * (`autoHideColumns`; its values move to the row details): the lowest goes\r\n * first, ties from the end. When any column of `columns` has a\r\n * `hidingPriority` (grouped or hidden ones included), only those columns\r\n * hide; otherwise columns hide from the last one. Fixed\r\n * columns never hide. Ignored on bands.\r\n */\r\n hidingPriority?: number | null;\r\n /**\r\n * Fixes the column at the start or end of the scrollable area. A fixed band\r\n * fixes its columns; ignored on nested columns (they follow the top band).\r\n */\r\n fixed?: GridColumnFixed;\r\n /** INITIAL visibility (default `true`); afterwards the user changes it in the chooser. */\r\n visible?: boolean | null;\r\n /** `false` removes the column from the chooser (the user cannot hide it). */\r\n showInChooser?: boolean | null;\r\n /**\r\n * Value used to GROUP by this column instead of the cell value: a range or\r\n * bucket (decade, initial letter). Groups are identified, sorted and shown\r\n * by the returned value; the column `dataType`, `comparator`, `format` and\r\n * `displayValue` do not apply to it. Return a string or a number.\r\n */\r\n groupValueGetter?: ((item: TItem) => unknown) | null;\r\n /**\r\n * Allows the user to group by this column (drag to the group panel).\r\n * Default: `true` when the column has a `path`, `valueGetter` or\r\n * `groupValueGetter`. Only limits the user: `groupColumn()` still works.\r\n */\r\n groupable?: boolean | null;\r\n /**\r\n * Includes this column in exports (`exportCsv`, `getExportData`, the xlsx\r\n * adapter) and in Ctrl+C. Default: `true` when the column has a `path`,\r\n * `valueGetter` or `displayValue` (a `renderer`-only column has no text).\r\n */\r\n exportable?: boolean | null;\r\n /**\r\n * Allows editing the cells of this column (with `allowEditing` on the grid;\r\n * new rows with `allowAdding`). Default: `true` when the column has a\r\n * `path` or a `valueSetter`.\r\n */\r\n editable?: boolean | null;\r\n /**\r\n * Builds the editor of a cell instead of the built-in one (text, number,\r\n * date, checkbox). See `GridEditorRenderer`.\r\n */\r\n editorRenderer?: GridEditorRenderer<TItem> | null;\r\n /** Rules checked when a value is committed and before saving. See `GridValidationRule`. */\r\n validationRules?: readonly GridValidationRule<TItem>[] | null;\r\n /**\r\n * Writes an edited value into `data`, the pending change of the row (a\r\n * partial item owned by the grid). Default: sets `path` (dots create nested\r\n * objects). Set other fields too to edit computed columns.\r\n */\r\n valueSetter?: GridValueSetter<TItem> | null;\r\n}\r\n\r\n/**\r\n * A column of the grid: its `name`, its `path` (first column with that name, else with that path) or the column itself.\r\n * Leaf columns only, including columns inside a band; a band is not a column reference.\r\n */\r\nexport type GridColumnRef<TItem = any> = string | GridColumnDef<TItem>;\r\n\r\n/** Values of a group from the outermost level, e.g. `['Brazil', 'SP']`. */\r\nexport type GridGroupPath = readonly unknown[];\r\n\r\n/** Built-in summary aggregates. `sum`/`min`/`max`/`avg` ignore empty values; `count` counts rows. */\r\nexport type GridSummaryType = 'sum' | 'min' | 'max' | 'avg' | 'count';\r\n\r\n/** Custom aggregate: receives the column values and the row items of the group (or of all rows). */\r\nexport type GridSummaryAggregator<TItem = any> = (values: readonly unknown[], items: readonly TItem[]) => unknown;\r\n\r\n/** `Intl` options or a function that formats the summary value. */\r\nexport type GridSummaryFormat = Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | ((value: unknown) => string);\r\n\r\n/** A summary (aggregate) of a column. */\r\nexport interface GridSummaryItem<TItem = any> {\r\n /** Column whose values are aggregated and under which the summary is shown. */\r\n column: GridColumnRef<TItem>;\r\n /** Built-in aggregate or a custom function. */\r\n type: GridSummaryType | GridSummaryAggregator<TItem>;\r\n /**\r\n * Replaces the aggregate name in the text (`\"Total: 1,234\"`). Without it a\r\n * custom aggregate shows `\"{column}: {value}\"` in group rows and only the\r\n * value in cells.\r\n */\r\n label?: string;\r\n /**\r\n * Formats the value. Default: the column `format` when it is `Intl`\r\n * options (a formatter function is not inherited); `count` uses the\r\n * integer format of the language.\r\n */\r\n format?: GridSummaryFormat | null;\r\n /** Identifies the summary in `getSummaryValues()`. */\r\n name?: string;\r\n}\r\n\r\n/** A summary of each group. */\r\nexport interface GridGroupSummaryItem<TItem = any> extends GridSummaryItem<TItem> {\r\n /**\r\n * Where it is shown: `inline` (default) in the group row text,\r\n * `column` in the group row under its column, `footer` in a footer row\r\n * after the group items.\r\n */\r\n display?: 'inline' | 'column' | 'footer';\r\n}\r\n\r\n/** The `summary` property of `<u-grid>`. */\r\nexport interface GridSummary<TItem = any> {\r\n /** Totals: a footer fixed at the bottom, under the columns. */\r\n total?: GridSummaryItem<TItem>[];\r\n /** Summaries of each group (ignored with `treeMode`). */\r\n group?: GridGroupSummaryItem<TItem>[];\r\n /**\r\n * Tree data (`treeMode`): summaries of each node with children, over its\r\n * visible descendants (not the node itself). Off with `dataSource`.\r\n */\r\n node?: GridNodeSummaryItem<TItem>[];\r\n}\r\n\r\n/**\r\n * A summary of each tree node: `inline` (default) after the tree cell text,\r\n * `column` instead of the node value in that column, `footer` in a row after\r\n * the children of an expanded node.\r\n */\r\nexport interface GridNodeSummaryItem<TItem = any> extends GridSummaryItem<TItem> {\r\n /**\r\n * Where it is shown: `inline` (default) after the tree cell text, `column`\r\n * instead of the node value in its column, `footer` in a row after the\r\n * children of an expanded node.\r\n */\r\n display?: 'inline' | 'column' | 'footer';\r\n}\r\n\r\n/** A computed summary (`getSummaryValues()`). */\r\nexport interface GridSummaryValue<TItem = any> {\r\n /** The summary definition. */\r\n item: GridSummaryItem<TItem>;\r\n /** Raw aggregate (without values: `sum` = `0`, the others `null`). */\r\n value: unknown;\r\n /** Formatted value, as shown. */\r\n text: string;\r\n}\r\n\r\n// --------------------------------------------------------------- renderers\r\n\r\n/**\r\n * What a renderer returns. A Lit `TemplateResult` (recommended) or a string\r\n * (always text, never parsed as HTML) is rendered inside the grid's shadow\r\n * DOM — also on the server — and styled through the `part` names the\r\n * template declares (`u-grid::part(my-badge)`). An `HTMLElement` is placed\r\n * in the grid's light DOM and projected by a slot: page styles apply, but it\r\n * only renders in the browser (the server leaves the slot empty). `null`,\r\n * `undefined` and Lit's `nothing` render nothing. Return the same kind of\r\n * result on the server and on the client (don't branch on `typeof document`).\r\n */\r\nexport type GridRenderResult = TemplateResult | HTMLElement | string | typeof nothing | null | undefined;\r\n\r\n/** Members shared by every renderer context. */\r\nexport interface GridRenderContextBase {\r\n /** The grid rendering the content (a renderer may be shared by several grids). */\r\n readonly grid: DataGrid;\r\n /**\r\n * Aborted when the grid discards this content (the row leaves the virtual\r\n * window, the detail is collapsed, the column or the renderer changes, the\r\n * grid is disconnected): unmount framework roots here. Created on first\r\n * access.\r\n */\r\n readonly signal: AbortSignal;\r\n}\r\n\r\n/** Context of a cell `renderer`. */\r\nexport interface GridCellRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The row item. */\r\n readonly item: TItem;\r\n /** Cell value (`valueGetter` or `path`). */\r\n readonly value: unknown;\r\n /** The text the native cell would show (`format`, `displayValue`, `emptyText`, boolean texts). */\r\n readonly text: string;\r\n /** The column of the cell. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Row key (without `keyExpr`, the item itself). */\r\n readonly rowKey: unknown;\r\n /**\r\n * `true` when the value is drawn in the row details because the column is\r\n * hidden for lack of space (`autoHideColumns`), `false` in the table cell.\r\n * Moving between the two discards the content (the `signal` aborts).\r\n */\r\n readonly adaptive: boolean;\r\n}\r\n\r\n/** Context of a `headerRenderer`. */\r\nexport interface GridHeaderRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The column of the header; in a band header, the band (it has `columns` and no `path`). */\r\n readonly column: GridColumnDef<TItem>;\r\n}\r\n\r\n/** Context of a `groupRenderer`. */\r\nexport interface GridGroupRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The grouped column. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Group value. */\r\n readonly value: unknown;\r\n /** Group value formatted as the grid shows it. */\r\n readonly text: string;\r\n /** Values of the group from the outermost level. */\r\n readonly groupPath: GridGroupPath;\r\n /** Grouping level (0-based). */\r\n readonly groupIndex: number;\r\n /** Rows in the group (after filtering). */\r\n readonly itemCount: number;\r\n /** Whether the group is expanded. */\r\n readonly expanded: boolean;\r\n /** Summaries shown in the group row text (`display: 'inline'`). */\r\n readonly summaries: readonly GridSummaryValue<TItem>[];\r\n /** The full label the grid would show (`\"Country: Brazil (3, Sum of Population: 1,234)\"`). */\r\n readonly defaultText: string;\r\n}\r\n\r\n/** Context of the grid `detailRenderer`. */\r\nexport interface GridDetailRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The master row item. */\r\n readonly item: TItem;\r\n /** Key of the master row. */\r\n readonly rowKey: unknown;\r\n}\r\n\r\n/** Side a row is fixed to (`fixedTopItems` / `fixedBottomItems`); `null` = a body row. */\r\nexport type GridRowFixed = 'top' | 'bottom' | null;\r\n\r\n/** Context of the grid `rowRenderer`. */\r\nexport interface GridRowRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The row item. */\r\n readonly item: TItem;\r\n /** Row key (without `keyExpr`, the item itself). */\r\n readonly rowKey: unknown;\r\n /** `'top'`/`'bottom'` in a fixed row, `null` in a body row. */\r\n readonly fixed: GridRowFixed;\r\n /**\r\n * Aborted when the grid discards this content (the row leaves the virtual\r\n * window, the item or the renderer changes, the grid is disconnected) and\r\n * immediately when the renderer returns `false`. Created on first access.\r\n */\r\n readonly signal: AbortSignal;\r\n}\r\n\r\n/** Context of the grid `noDataRenderer`. */\r\nexport interface GridNoDataRenderContext extends GridRenderContextBase {\r\n /** `true` when there are items but the filter or the search hides them all. */\r\n readonly filtered: boolean;\r\n}\r\n\r\n/**\r\n * Cell renderer: a pure function of the item and the column. It runs again\r\n * when the item, the column object or the language change and when the row\r\n * comes back to the virtual window — so it may run several times for the\r\n * same item —, never when selecting, focusing or sorting (nor when the item\r\n * is mutated).\r\n */\r\nexport type GridCellRenderer<TItem = any> = (item: TItem, ctx: GridCellRenderContext<TItem>) => GridRenderResult;\r\n\r\n/** Header label renderer (runs again when the column or the language change). */\r\nexport type GridHeaderRenderer<TItem = any> = (ctx: GridHeaderRenderContext<TItem>) => GridRenderResult;\r\n\r\n/** Group row label renderer (runs again when any member of the context changes). */\r\nexport type GridGroupRenderer<TItem = any> = (ctx: GridGroupRenderContext<TItem>) => GridRenderResult;\r\n\r\n/** Detail row renderer (master-detail). `null` renders an empty detail row (the toggle stays). */\r\nexport type GridDetailRenderer<TItem = any> = (item: TItem, ctx: GridDetailRenderContext<TItem>) => GridRenderResult;\r\n\r\n/**\r\n * What a `rowRenderer` returns: the content of a full-width row, or `false`\r\n * to keep the row's columns. `null`, `undefined`, `''` and Lit's `nothing`\r\n * are an EMPTY full-width row, not a normal one.\r\n */\r\nexport type GridRowRenderResult = GridRenderResult | false;\r\n\r\n/**\r\n * Full-width row renderer: the content of ONE cell spanning the data\r\n * columns of a data or fixed row (the group indents, the detail toggle and\r\n * the selection checkbox stay). Return `false` (not `nothing`/`null`/`''`)\r\n * to keep that row's columns — `cond && html\\`…\\`` works,\r\n * `cond ? html\\`…\\` : nothing` gives empty full-width rows.\r\n *\r\n * Called for every rendered data or fixed row: decide `false` first,\r\n * deterministically and without touching `document` (the server and the\r\n * client must take the same decision), before building any content. The\r\n * result (including `false`) is cached per row: it runs again when the item\r\n * object, the `rowRenderer` function or the language change and when the\r\n * row comes back to the virtual window — to re-decide, assign a new item\r\n * object or a new function. A renderer that throws keeps the row's columns\r\n * (one `console.error`). Never called for group, summary, detail and\r\n * skeleton rows nor for a row being added (`addRow`).\r\n */\r\nexport type GridRowRenderer<TItem = any> = (item: TItem, ctx: GridRowRenderContext<TItem>) => GridRowRenderResult;\r\n\r\n/** Empty state renderer (no rows to show). */\r\nexport type GridNoDataRenderer = (ctx: GridNoDataRenderContext) => GridRenderResult;\r\n\r\n/**\r\n * O usuário pode agrupar pela coluna?\r\n * @internal\r\n */\r\nexport const isColumnGroupable = (column: GridColumnDef): boolean =>\r\n column.groupable ?? (!!column.path || !!column.valueGetter || !!column.groupValueGetter);\r\n\r\n/**\r\n * A coluna pode ser ordenada pelo usuário?\r\n * @internal\r\n */\r\nexport const isColumnSortable = (column: GridColumnDef): boolean =>\r\n column.sortable ?? (!!column.path || !!column.valueGetter || !!column.comparator);\r\n\r\n/**\r\n * A coluna entra na exportação e na área de transferência?\r\n * @internal\r\n */\r\nexport const isColumnExportable = (column: GridColumnDef): boolean =>\r\n column.exportable ?? (!!column.path || !!column.valueGetter || !!column.displayValue);\r\n\r\n/**\r\n * A coluna pode ser filtrada pelo usuário? (a expressão aponta a coluna pelo `path`)\r\n * @internal\r\n */\r\nexport const isColumnFilterable = (column: GridColumnDef): boolean =>\r\n !!column.path && column.filterable !== false;\r\n\r\n// ----------------------------------------------------------------- edição\r\n\r\n/** Writes an edited `value` into `data` (the pending change of the row); `item` is the original row (empty object for new rows). */\r\nexport type GridValueSetter<TItem = any> = (data: Partial<TItem>, value: unknown, item: TItem) => void;\r\n\r\n/** What a validation rule receives. */\r\nexport interface GridValidationContext<TItem = any> {\r\n /** The value being checked. */\r\n readonly value: unknown;\r\n /** The original row item (empty object for a new row). */\r\n readonly item: TItem;\r\n /** The pending change of the row (fields edited so far, this value included). */\r\n readonly data: Partial<TItem>;\r\n /** The column of the value. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Row key (a new row has an opaque provisional key). */\r\n readonly rowKey: unknown;\r\n}\r\n\r\n/** Members shared by every validation rule. */\r\nexport interface GridValidationRuleBase {\r\n /** Error text; default: the grid translation of the rule. */\r\n message?: string;\r\n}\r\n\r\n/** The value cannot be empty (`null`, `undefined`, `''`, or only spaces with `trim`). */\r\nexport interface GridRequiredRule extends GridValidationRuleBase {\r\n type: 'required';\r\n /** Spaces only count as empty. Default `true`. */\r\n trim?: boolean;\r\n}\r\n\r\n/** A number or date between `min` and `max` (inclusive). */\r\nexport interface GridRangeRule extends GridValidationRuleBase {\r\n type: 'range';\r\n min?: number | Date;\r\n max?: number | Date;\r\n}\r\n\r\n/** Text length between `min` and `max` characters. */\r\nexport interface GridStringLengthRule extends GridValidationRuleBase {\r\n type: 'stringLength';\r\n min?: number;\r\n max?: number;\r\n}\r\n\r\n/** The text matches `pattern`; a string matches the whole value, like the HTML `pattern` attribute. */\r\nexport interface GridPatternRule extends GridValidationRuleBase {\r\n type: 'pattern';\r\n pattern: RegExp | string;\r\n}\r\n\r\n/** An e-mail address (the rule of `<input type=\"email\">`). */\r\nexport interface GridEmailRule extends GridValidationRuleBase {\r\n type: 'email';\r\n}\r\n\r\n/**\r\n * Host check: return `true` (valid), `false` (invalid, `message` or the\r\n * default text) or an error text; or a promise of it (server check). The\r\n * `signal` aborts when the value changes again or the edit ends: a stale\r\n * answer is ignored.\r\n */\r\nexport interface GridCustomRule<TItem = any> extends GridValidationRuleBase {\r\n type: 'custom';\r\n validate: (ctx: GridValidationContext<TItem>, signal: AbortSignal) => boolean | string | Promise<boolean | string>;\r\n}\r\n\r\n/**\r\n * A validation rule of `validationRules`. Empty values only fail `required`\r\n * (and `custom`, which always runs).\r\n */\r\nexport type GridValidationRule<TItem = any> =\r\n | GridRequiredRule\r\n | GridRangeRule\r\n | GridStringLengthRule\r\n | GridPatternRule\r\n | GridEmailRule\r\n | GridCustomRule<TItem>;\r\n\r\n/** Context of an `editorRenderer`. */\r\nexport interface GridEditorRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The original row item (empty object for a new row). */\r\n readonly item: TItem;\r\n /** The value being edited (pending, not yet saved). */\r\n readonly value: unknown;\r\n /** The pending change of the row. */\r\n readonly data: Partial<TItem>;\r\n /** The column of the cell. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Row key (a new row has an opaque provisional key). */\r\n readonly rowKey: unknown;\r\n /** Accessible name for the editor (the column label). */\r\n readonly label: string;\r\n /** `true` when the editor is in the row details (column hidden for lack of space, `autoHideColumns`). */\r\n readonly adaptive: boolean;\r\n /** The value failed a validation rule. */\r\n readonly invalid: boolean;\r\n /** Error text of the value (`''` when valid). */\r\n readonly errorMessage: string;\r\n /**\r\n * Id of the element with the error text, for `aria-describedby` — only for\r\n * editors rendered in the grid's shadow DOM (`TemplateResult`). For an\r\n * `HTMLElement` editor the grid places the text in its light DOM and sets\r\n * `aria-label`, `aria-invalid` and `aria-describedby` when missing.\r\n */\r\n readonly describedBy: string;\r\n /** Changes the edited value (the grid validates it on commit). */\r\n setValue(value: unknown): void;\r\n /** Commits the value (like Enter, without moving). */\r\n commit(): void;\r\n /** Discards the value and closes the editor (like Esc). */\r\n cancel(): void;\r\n}\r\n\r\n/**\r\n * Editor of a cell: focus goes to the first focusable element it renders.\r\n * It runs when the editor opens and again when the validity of the value\r\n * changes (`invalid`, `errorMessage`): keep the value in `setValue`.\r\n * The grid handles Enter, Tab and Esc unless the editor calls\r\n * `preventDefault()` on the `keydown` (a combobox that uses Enter).\r\n */\r\nexport type GridEditorRenderer<TItem = any> = (item: TItem, ctx: GridEditorRenderContext<TItem>) => GridRenderResult;\r\n\r\n/**\r\n * A coluna é editável (sem olhar o `allowEditing` do grid)? Padrão: com\r\n * `path` ou `valueSetter`.\r\n * @internal\r\n */\r\nexport const isColumnEditable = (column: GridColumnDef): boolean =>\r\n column.editable ?? (!!column.path || !!column.valueSetter);\r\n\r\n/**\r\n * A coluna é banda (`columns` com pelo menos 1 item).\r\n * @internal\r\n */\r\nexport const isBand = (column: GridColumnDef | null | undefined): boolean =>\r\n !!column && Array.isArray(column.columns) && column.columns.length > 0;\r\n\r\n/**\r\n * How columns are rendered: `virtual` keeps only the columns in view (plus the\r\n * fixed ones and the focused one) in the DOM; `standard` renders all;\r\n * `auto` is `virtual` with more than 50 leaf columns defined.\r\n */\r\nexport type GridColumnRenderingMode = 'auto' | 'virtual' | 'standard';\r\n"]}
1
+ {"version":3,"file":"grid-column-def.js","sourceRoot":"","sources":["../src/grid-column-def.ts"],"names":[],"mappings":"AA+eA;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAqB,EAAW,EAAE,CAClE,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAE3F;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAqB,EAAW,EAAE,CACjE,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAEpF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAW,EAAE,CACnE,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AAExF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAW,EAAE,CACnE,MAAM,CAAC,UAAU,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AA8H5F;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAqB,EAAW,EAAE,CACjE,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAE7D;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAwC,EAAW,EAAE,CAC1E,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC","sourcesContent":["import type { nothing, TemplateResult } from 'lit';\r\n\r\nimport type { DataGrid } from './grid.js';\r\n\r\n/** Sort direction: ascending or descending. */\r\nexport type GridSortOrder = 'asc' | 'desc';\r\n\r\n/** A column of the current sorting and its direction (`getSorting()`). */\r\nexport interface GridSort {\r\n column: GridColumnDef;\r\n order: GridSortOrder;\r\n}\r\n\r\n/**\r\n * Custom comparator of a column, in ascending order (the grid applies the\r\n * direction). Receives the cell values and the row items.\r\n */\r\nexport type GridColumnComparator<TItem = any> = (a: any, b: any, itemA: TItem, itemB: TItem) => number;\r\n\r\n/** Data type of a column; without `dataType`, inferred from the first non-null value. */\r\nexport type GridColumnDataType = 'string' | 'number' | 'date' | 'datetime' | 'boolean';\r\n\r\n/** Logical alignment: `start`/`end` follow the direction (RTL). */\r\nexport type GridColumnAlignment = 'start' | 'center' | 'end';\r\n\r\n/**\r\n * Boolean as text (`trueText`/`falseText`), as a read-only check/cross icon\r\n * (`icon`) or as a check for `true` only (`check`: `false` shows nothing, its\r\n * text stays for screen readers).\r\n */\r\nexport type GridColumnBooleanDisplay = 'text' | 'icon' | 'check';\r\n\r\n/** Formats a cell value into its displayed text. */\r\nexport type GridColumnFormatter<TItem = any> = (value: unknown, item: TItem) => string;\r\n\r\n/** `Intl` number/date options or a formatter function. */\r\nexport type GridColumnFormat<TItem = any> = Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | GridColumnFormatter<TItem>;\r\n\r\n/**\r\n * Filter operation of a condition. Text operations (`contains`, `notcontains`,\r\n * `startswith`, `endswith`) and `=` on text ignore case and accents.\r\n */\r\nexport type GridFilterOperation =\r\n | '=' | '<>' | '<' | '<=' | '>' | '>='\r\n | 'contains' | 'notcontains' | 'startswith' | 'endswith'\r\n | 'between' | 'anyof' | 'noneof' | 'isblank' | 'isnotblank';\r\n\r\n/**\r\n * One condition: `[field, operation, value]`. `field` is the column `path`\r\n * or, for a column without `path` (computed by `valueGetter`), its `name`;\r\n * a `path` match wins over a `name` (the reverse of `GridColumnRef`), and a\r\n * field that matches no column is read from the items as a dot path.\r\n * `between` takes `[start, end]` (inclusive, either may be `null`), `anyof` /\r\n * `noneof` take a list, `isblank` / `isnotblank` take no value.\r\n */\r\nexport type GridFilterCondition =\r\n | readonly [field: string, operation: GridFilterOperation, value?: unknown]\r\n | readonly [field: string, value: unknown];\r\n\r\n/**\r\n * Serializable filter expression (same shape as DevExtreme): a condition, a\r\n * negation `['!', expression]` or a group of expressions joined by `'and'` /\r\n * `'or'` (`and` binds tighter; two expressions in a row mean `and`).\r\n */\r\nexport type GridFilterExpression =\r\n | GridFilterCondition\r\n | readonly ['!', GridFilterExpression]\r\n | readonly (GridFilterExpression | 'and' | 'or')[];\r\n\r\n/** Side a column is fixed to (logical: mirrors in RTL). */\r\nexport type GridColumnFixed = 'start' | 'end' | null;\r\n\r\n/**\r\n * Column definition (the `columns` property of `<u-grid>`). Mirrors the\r\n * `<u-grid-column>` element: same names, types and defaults. `TItem` types\r\n * the row item in the callbacks.\r\n */\r\nexport interface GridColumnDef<TItem = any> {\r\n /**\r\n * Nested columns: a column with at least one nested column is a BAND (a\r\n * header over its columns, no cells). In a band only `label`,\r\n * `headerRenderer`, `alignment` (of the label; default `start`), `fixed`,\r\n * `visible` and `showInChooser` apply; the other fields are ignored. A band\r\n * is shown while it is visible and has a visible column. Columns reorder\r\n * only inside their own band; only leaf columns sort, group and export.\r\n * `null` or `[]` = a regular column.\r\n */\r\n columns?: readonly GridColumnDef<TItem>[] | null;\r\n /**\r\n * Width in px. Under virtual column rendering (`columnRenderingMode`) a\r\n * column without `width` takes its auto-size width or `max(minWidth, 150)` px.\r\n */\r\n width?: number | null;\r\n /** Minimum width in px (also when resizing and auto-sizing). */\r\n minWidth?: number | null;\r\n /** INITIAL grouping level; afterwards grouping is grid state (`groupColumn`, `ungroupColumn`). */\r\n groupIndex?: number | null;\r\n /**\r\n * The column's name as text: the header text (unless `headerRenderer`;\r\n * empty: `path`, or the `name` of a column with a `valueGetter`) and its name everywhere else (header buttons, group chip\r\n * and rows, column chooser, row details, announcements, export; empty:\r\n * `path`, then `name`, as is). Set it also with `headerRenderer`.\r\n */\r\n label?: string;\r\n /** Dot path of the cell value in the row item (`\"address.city\"`). */\r\n path?: string;\r\n /**\r\n * Stable id of the column in the grid state (`getState`, `stateStorage`)\r\n * and in string column references (`summary` items look it up before\r\n * `path`) and, for a column without `path`, in filter conditions\r\n * (`filterValue`). Default: `path`. A column without `name` and `path` is\r\n * left out of the state.\r\n */\r\n name?: string;\r\n /** Data type; without it, inferred from the first non-null value. */\r\n dataType?: GridColumnDataType | null;\r\n /** `Intl` options or a formatter function. */\r\n format?: GridColumnFormat<TItem> | null;\r\n /** Logical alignment; default by data type (numbers at the end). In a band, of the header label (default `start`). */\r\n alignment?: GridColumnAlignment | null;\r\n /** Cell value used to group, sort and filter. Default: read `path`. */\r\n valueGetter?: ((item: TItem) => unknown) | null;\r\n /** Displayed text (cell and group row); wins over `format`. */\r\n displayValue?: ((value: unknown, item: TItem) => string) | null;\r\n /**\r\n * `'text'` (default: `trueText`/`falseText`), `'icon'` (read-only check/cross,\r\n * the text as its accessible name) or `'check'` (check for `true` only;\r\n * `false` keeps its text for screen readers).\r\n */\r\n booleanDisplay?: GridColumnBooleanDisplay | null;\r\n /**\r\n * Text of `true` in a boolean column (declared or inferred): cell, icon\r\n * name, group row, filters, copy/paste, summaries and export. Empty or\r\n * `null`: the language's `trueText`. A fixed text: it does not follow\r\n * `language`.\r\n */\r\n trueText?: string | null;\r\n /** Text of `false` in a boolean column, like `trueText`. Empty or `null`: the language's `falseText`. */\r\n falseText?: string | null;\r\n /** Wraps the cell text in several lines instead of an ellipsis (cells only; see `headerWrap`). */\r\n wrap?: boolean;\r\n /**\r\n * Wraps the header label in several lines instead of an ellipsis; the\r\n * header row grows. `null`/absent: the grid's `headerWrap`; `false` turns it\r\n * off for this column.\r\n */\r\n headerWrap?: boolean | null;\r\n /** Text for empty values (`null`/`undefined`). */\r\n emptyText?: string | null;\r\n /**\r\n * Builds the cell content: a Lit `TemplateResult` (recommended), a string\r\n * (text, never HTML) or an `HTMLElement` (placed in the grid's light DOM).\r\n * `null`, `undefined` and Lit's `nothing` render an empty cell. See `GridCellRenderer`.\r\n */\r\n renderer?: GridCellRenderer<TItem> | null;\r\n /**\r\n * Builds the header label (sort arrow, filter button and resize handle stay; their accessible names\r\n * follow the rendered text). Set `label` too: it names the column outside the header (without it\r\n * the grid warns once and uses `path`, then `name`).\r\n */\r\n headerRenderer?: GridHeaderRenderer<TItem> | null;\r\n /** Builds the label of the group rows of this column (expand button and aligned summaries stay). */\r\n groupRenderer?: GridGroupRenderer<TItem> | null;\r\n /** Allows sorting from the header. Default: `true` when the column has a `path`, `valueGetter` or `comparator`. */\r\n sortable?: boolean | null;\r\n /** INITIAL sort direction; afterwards sorting is grid state (`sortColumn`, `getSorting`). */\r\n sortOrder?: GridSortOrder | null;\r\n /** Priority of the initial sort among columns (lower first). */\r\n sortIndex?: number | null;\r\n /** Custom ascending comparator. */\r\n comparator?: GridColumnComparator<TItem> | null;\r\n /**\r\n * Allows filtering by this column (filter row, header filter and, by\r\n * default, the search panel). Default: `true` with a `path`, or with a\r\n * `valueGetter` and a `name` (not with remote filtering). The filter\r\n * expression refers to the column by `path` or, without one, by `name`.\r\n */\r\n filterable?: boolean | null;\r\n /**\r\n * Operations offered in the filter row operation menu (only the menu: the\r\n * header filter and `filterValue` are not checked). Default by data type.\r\n */\r\n filterOperations?: readonly GridFilterOperation[] | null;\r\n /** Operation of the filter row editor. Default: `contains` for text, `=` otherwise (or the first of `filterOperations`). */\r\n defaultFilterOperation?: GridFilterOperation | null;\r\n /** `false` prevents resizing this column even with `column-resizing`. */\r\n resizable?: boolean | null;\r\n /** Maximum width in px when resizing and auto-sizing. */\r\n maxWidth?: number | null;\r\n /**\r\n * Order in which the column leaves the table when the grid is too narrow\r\n * (`autoHideColumns`; its values move to the row details): the lowest goes\r\n * first, ties from the end. When any column of `columns` has a\r\n * `hidingPriority` (grouped or hidden ones included), only those columns\r\n * hide; otherwise columns hide from the last one. Fixed\r\n * columns never hide. Ignored on bands.\r\n */\r\n hidingPriority?: number | null;\r\n /**\r\n * Fixes the column at the start or end of the scrollable area. A fixed band\r\n * fixes its columns; ignored on nested columns (they follow the top band).\r\n */\r\n fixed?: GridColumnFixed;\r\n /** INITIAL visibility (default `true`); afterwards the user changes it in the chooser. */\r\n visible?: boolean | null;\r\n /** `false` removes the column from the chooser (the user cannot hide it). */\r\n showInChooser?: boolean | null;\r\n /**\r\n * Value used to GROUP by this column instead of the cell value: a range or\r\n * bucket (decade, initial letter). Groups are identified, sorted and shown\r\n * by the returned value; the column `dataType`, `comparator`, `format` and\r\n * `displayValue` do not apply to it. Return a string or a number.\r\n */\r\n groupValueGetter?: ((item: TItem) => unknown) | null;\r\n /**\r\n * Allows the user to group by this column (drag to the group panel).\r\n * Default: `true` when the column has a `path`, `valueGetter` or\r\n * `groupValueGetter`. Only limits the user: `groupColumn()` still works.\r\n */\r\n groupable?: boolean | null;\r\n /**\r\n * Includes this column in exports (`exportCsv`, `getExportData`, the xlsx\r\n * adapter) and in Ctrl+C. Default: `true` when the column has a `path`,\r\n * `valueGetter` or `displayValue` (a `renderer`-only column has no text).\r\n */\r\n exportable?: boolean | null;\r\n /**\r\n * Allows editing the cells of this column (with `allowEditing` on the grid;\r\n * new rows with `allowAdding`). Default: `true` when the column has a\r\n * `path` or a `valueSetter`.\r\n */\r\n editable?: boolean | null;\r\n /**\r\n * Builds the editor of a cell instead of the built-in one (text, number,\r\n * date, checkbox). See `GridEditorRenderer`.\r\n */\r\n editorRenderer?: GridEditorRenderer<TItem> | null;\r\n /** Rules checked when a value is committed and before saving. See `GridValidationRule`. */\r\n validationRules?: readonly GridValidationRule<TItem>[] | null;\r\n /**\r\n * Writes an edited value into `data`, the pending change of the row (a\r\n * partial item owned by the grid). Default: sets `path` (dots create nested\r\n * objects). Set other fields too to edit computed columns.\r\n */\r\n valueSetter?: GridValueSetter<TItem> | null;\r\n}\r\n\r\n/**\r\n * A column of the grid: its `name`, its `path` (first column with that name, else with that path) or the column itself.\r\n * Leaf columns only, including columns inside a band; a band is not a column reference.\r\n */\r\nexport type GridColumnRef<TItem = any> = string | GridColumnDef<TItem>;\r\n\r\n/** Values of a group from the outermost level, e.g. `['Brazil', 'SP']`. */\r\nexport type GridGroupPath = readonly unknown[];\r\n\r\n/** Built-in summary aggregates. `sum`/`min`/`max`/`avg` ignore empty values; `count` counts rows. */\r\nexport type GridSummaryType = 'sum' | 'min' | 'max' | 'avg' | 'count';\r\n\r\n/** Custom aggregate: receives the column values and the row items of the group (or of all rows). */\r\nexport type GridSummaryAggregator<TItem = any> = (values: readonly unknown[], items: readonly TItem[]) => unknown;\r\n\r\n/** `Intl` options or a function that formats the summary value. */\r\nexport type GridSummaryFormat = Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | ((value: unknown) => string);\r\n\r\n/** A summary (aggregate) of a column. */\r\nexport interface GridSummaryItem<TItem = any> {\r\n /** Column whose values are aggregated and under which the summary is shown. */\r\n column: GridColumnRef<TItem>;\r\n /** Built-in aggregate or a custom function. */\r\n type: GridSummaryType | GridSummaryAggregator<TItem>;\r\n /**\r\n * Replaces the aggregate name in the text (`\"Total: 1,234\"`). Without it a\r\n * custom aggregate shows `\"{column}: {value}\"` in group rows and only the\r\n * value in cells.\r\n */\r\n label?: string;\r\n /**\r\n * Formats the value. Default: the column `format` when it is `Intl`\r\n * options (a formatter function is not inherited); `count` uses the\r\n * integer format of the language.\r\n */\r\n format?: GridSummaryFormat | null;\r\n /** Identifies the summary in `getSummaryValues()`. */\r\n name?: string;\r\n}\r\n\r\n/** A summary of each group. */\r\nexport interface GridGroupSummaryItem<TItem = any> extends GridSummaryItem<TItem> {\r\n /**\r\n * Where it is shown: `inline` (default) in the group row text,\r\n * `column` in the group row under its column, `footer` in a footer row\r\n * after the group items.\r\n */\r\n display?: 'inline' | 'column' | 'footer';\r\n}\r\n\r\n/** The `summary` property of `<u-grid>`. */\r\nexport interface GridSummary<TItem = any> {\r\n /** Totals: a footer fixed at the bottom, under the columns. */\r\n total?: GridSummaryItem<TItem>[];\r\n /** Summaries of each group (ignored with `treeMode`). */\r\n group?: GridGroupSummaryItem<TItem>[];\r\n /**\r\n * Tree data (`treeMode`): summaries of each node with children, over its\r\n * visible descendants (not the node itself). Off with `dataSource`.\r\n */\r\n node?: GridNodeSummaryItem<TItem>[];\r\n}\r\n\r\n/**\r\n * A summary of each tree node: `inline` (default) after the tree cell text,\r\n * `column` instead of the node value in that column, `footer` in a row after\r\n * the children of an expanded node.\r\n */\r\nexport interface GridNodeSummaryItem<TItem = any> extends GridSummaryItem<TItem> {\r\n /**\r\n * Where it is shown: `inline` (default) after the tree cell text, `column`\r\n * instead of the node value in its column, `footer` in a row after the\r\n * children of an expanded node.\r\n */\r\n display?: 'inline' | 'column' | 'footer';\r\n}\r\n\r\n/** A computed summary (`getSummaryValues()`). */\r\nexport interface GridSummaryValue<TItem = any> {\r\n /** The summary definition. */\r\n item: GridSummaryItem<TItem>;\r\n /** Raw aggregate (without values: `sum` = `0`, the others `null`). */\r\n value: unknown;\r\n /** Formatted value, as shown. */\r\n text: string;\r\n}\r\n\r\n// --------------------------------------------------------------- renderers\r\n\r\n/**\r\n * What a renderer returns. A Lit `TemplateResult` (recommended) or a string\r\n * (always text, never parsed as HTML) is rendered inside the grid's shadow\r\n * DOM — also on the server — and styled through the `part` names the\r\n * template declares (`u-grid::part(my-badge)`). An `HTMLElement` is placed\r\n * in the grid's light DOM and projected by a slot: page styles apply, but it\r\n * only renders in the browser (the server leaves the slot empty). `null`,\r\n * `undefined` and Lit's `nothing` render nothing. Return the same kind of\r\n * result on the server and on the client (don't branch on `typeof document`).\r\n */\r\nexport type GridRenderResult = TemplateResult | HTMLElement | string | typeof nothing | null | undefined;\r\n\r\n/** Members shared by every renderer context. */\r\nexport interface GridRenderContextBase {\r\n /** The grid rendering the content (a renderer may be shared by several grids). */\r\n readonly grid: DataGrid;\r\n /**\r\n * Aborted when the grid discards this content (the row leaves the virtual\r\n * window, the detail is collapsed, the column or the renderer changes, the\r\n * grid is disconnected): unmount framework roots here. Created on first\r\n * access.\r\n */\r\n readonly signal: AbortSignal;\r\n}\r\n\r\n/** Context of a cell `renderer`. */\r\nexport interface GridCellRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The row item. */\r\n readonly item: TItem;\r\n /** Cell value (`valueGetter` or `path`). */\r\n readonly value: unknown;\r\n /** The text the native cell would show (`format`, `displayValue`, `emptyText`, boolean texts). */\r\n readonly text: string;\r\n /** The column of the cell. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Row key (without `keyExpr`, the item itself). */\r\n readonly rowKey: unknown;\r\n /**\r\n * `true` when the value is drawn in the row details because the column is\r\n * hidden for lack of space (`autoHideColumns`), `false` in the table cell.\r\n * Moving between the two discards the content (the `signal` aborts).\r\n */\r\n readonly adaptive: boolean;\r\n}\r\n\r\n/** Context of a `headerRenderer`. */\r\nexport interface GridHeaderRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The column of the header; in a band header, the band (it has `columns` and no `path`). */\r\n readonly column: GridColumnDef<TItem>;\r\n}\r\n\r\n/** Context of a `groupRenderer`. */\r\nexport interface GridGroupRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The grouped column. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Group value. */\r\n readonly value: unknown;\r\n /** Group value formatted as the grid shows it. */\r\n readonly text: string;\r\n /** Values of the group from the outermost level. */\r\n readonly groupPath: GridGroupPath;\r\n /** Grouping level (0-based). */\r\n readonly groupIndex: number;\r\n /** Rows in the group (after filtering). */\r\n readonly itemCount: number;\r\n /** Whether the group is expanded. */\r\n readonly expanded: boolean;\r\n /**\r\n * The first row of the group in the current order (after filtering), to\r\n * show data of the group's rows (an icon, a link); `undefined` when the\r\n * group has no loaded rows (remote groups).\r\n */\r\n readonly firstItem: TItem | undefined;\r\n /** Summaries shown in the group row text (`display: 'inline'`). */\r\n readonly summaries: readonly GridSummaryValue<TItem>[];\r\n /** The full label the grid would show (`\"Country: Brazil (3, Sum of Population: 1,234)\"`). */\r\n readonly defaultText: string;\r\n}\r\n\r\n/** Context of the grid `detailRenderer`. */\r\nexport interface GridDetailRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The master row item. */\r\n readonly item: TItem;\r\n /** Key of the master row. */\r\n readonly rowKey: unknown;\r\n}\r\n\r\n/** Side a row is fixed to (`fixedTopItems` / `fixedBottomItems`); `null` = a body row. */\r\nexport type GridRowFixed = 'top' | 'bottom' | null;\r\n\r\n/** Context of the grid `rowRenderer`. */\r\nexport interface GridRowRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The row item. */\r\n readonly item: TItem;\r\n /** Row key (without `keyExpr`, the item itself). */\r\n readonly rowKey: unknown;\r\n /** `'top'`/`'bottom'` in a fixed row, `null` in a body row. */\r\n readonly fixed: GridRowFixed;\r\n /**\r\n * Aborted when the grid discards this content (the row leaves the virtual\r\n * window, the item or the renderer changes, the grid is disconnected) and\r\n * immediately when the renderer returns `false`. Created on first access.\r\n */\r\n readonly signal: AbortSignal;\r\n}\r\n\r\n/** Context of the grid `noDataRenderer`. */\r\nexport interface GridNoDataRenderContext extends GridRenderContextBase {\r\n /** `true` when there are items but the filter or the search hides them all. */\r\n readonly filtered: boolean;\r\n}\r\n\r\n/**\r\n * Cell renderer: a pure function of the item and the column. It runs again\r\n * when the item, the column object or the language change and when the row\r\n * comes back to the virtual window — so it may run several times for the\r\n * same item —, never when selecting, focusing or sorting (nor when the item\r\n * is mutated).\r\n */\r\nexport type GridCellRenderer<TItem = any> = (item: TItem, ctx: GridCellRenderContext<TItem>) => GridRenderResult;\r\n\r\n/** Header label renderer (runs again when the column or the language change). */\r\nexport type GridHeaderRenderer<TItem = any> = (ctx: GridHeaderRenderContext<TItem>) => GridRenderResult;\r\n\r\n/** Group row label renderer (runs again when any member of the context changes). */\r\nexport type GridGroupRenderer<TItem = any> = (ctx: GridGroupRenderContext<TItem>) => GridRenderResult;\r\n\r\n/** Detail row renderer (master-detail). `null` renders an empty detail row (the toggle stays). */\r\nexport type GridDetailRenderer<TItem = any> = (item: TItem, ctx: GridDetailRenderContext<TItem>) => GridRenderResult;\r\n\r\n/**\r\n * What a `rowRenderer` returns: the content of a full-width row, or `false`\r\n * to keep the row's columns. `null`, `undefined`, `''` and Lit's `nothing`\r\n * are an EMPTY full-width row, not a normal one.\r\n */\r\nexport type GridRowRenderResult = GridRenderResult | false;\r\n\r\n/**\r\n * Full-width row renderer: the content of ONE cell spanning the data\r\n * columns of a data or fixed row (the group indents, the detail toggle and\r\n * the selection checkbox stay). Return `false` (not `nothing`/`null`/`''`)\r\n * to keep that row's columns — `cond && html\\`…\\`` works,\r\n * `cond ? html\\`…\\` : nothing` gives empty full-width rows.\r\n *\r\n * Called for every rendered data or fixed row: decide `false` first,\r\n * deterministically and without touching `document` (the server and the\r\n * client must take the same decision), before building any content. The\r\n * result (including `false`) is cached per row: it runs again when the item\r\n * object, the `rowRenderer` function or the language change and when the\r\n * row comes back to the virtual window — to re-decide, assign a new item\r\n * object or a new function. A renderer that throws keeps the row's columns\r\n * (one `console.error`). Never called for group, summary, detail and\r\n * skeleton rows nor for a row being added (`addRow`).\r\n */\r\nexport type GridRowRenderer<TItem = any> = (item: TItem, ctx: GridRowRenderContext<TItem>) => GridRowRenderResult;\r\n\r\n/** Empty state renderer (no rows to show). */\r\nexport type GridNoDataRenderer = (ctx: GridNoDataRenderContext) => GridRenderResult;\r\n\r\n/**\r\n * O usuário pode agrupar pela coluna?\r\n * @internal\r\n */\r\nexport const isColumnGroupable = (column: GridColumnDef): boolean =>\r\n column.groupable ?? (!!column.path || !!column.valueGetter || !!column.groupValueGetter);\r\n\r\n/**\r\n * A coluna pode ser ordenada pelo usuário?\r\n * @internal\r\n */\r\nexport const isColumnSortable = (column: GridColumnDef): boolean =>\r\n column.sortable ?? (!!column.path || !!column.valueGetter || !!column.comparator);\r\n\r\n/**\r\n * A coluna entra na exportação e na área de transferência?\r\n * @internal\r\n */\r\nexport const isColumnExportable = (column: GridColumnDef): boolean =>\r\n column.exportable ?? (!!column.path || !!column.valueGetter || !!column.displayValue);\r\n\r\n/**\r\n * A coluna pode ser filtrada pelo usuário, olhando só a coluna? A condição a\r\n * aponta pelo `path` ou, sem `path`, pelo `name` (spec 28). Padrão: com\r\n * `path`, ou com `valueGetter` e `name` (sem getter a coluna sem `path` não\r\n * tem valor; `filterable: true` não muda isso). O grid ainda tira a colisão\r\n * de `name` e o remoto.\r\n * @internal\r\n */\r\nexport const isColumnFilterable = (column: GridColumnDef): boolean =>\r\n column.filterable !== false && (!!column.path || (!!column.valueGetter && !!column.name));\r\n\r\n// ----------------------------------------------------------------- edição\r\n\r\n/** Writes an edited `value` into `data` (the pending change of the row); `item` is the original row (empty object for new rows). */\r\nexport type GridValueSetter<TItem = any> = (data: Partial<TItem>, value: unknown, item: TItem) => void;\r\n\r\n/** What a validation rule receives. */\r\nexport interface GridValidationContext<TItem = any> {\r\n /** The value being checked. */\r\n readonly value: unknown;\r\n /** The original row item (empty object for a new row). */\r\n readonly item: TItem;\r\n /** The pending change of the row (fields edited so far, this value included). */\r\n readonly data: Partial<TItem>;\r\n /** The column of the value. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Row key (a new row has an opaque provisional key). */\r\n readonly rowKey: unknown;\r\n}\r\n\r\n/** Members shared by every validation rule. */\r\nexport interface GridValidationRuleBase {\r\n /** Error text; default: the grid translation of the rule. */\r\n message?: string;\r\n}\r\n\r\n/** The value cannot be empty (`null`, `undefined`, `''`, or only spaces with `trim`). */\r\nexport interface GridRequiredRule extends GridValidationRuleBase {\r\n type: 'required';\r\n /** Spaces only count as empty. Default `true`. */\r\n trim?: boolean;\r\n}\r\n\r\n/** A number or date between `min` and `max` (inclusive). */\r\nexport interface GridRangeRule extends GridValidationRuleBase {\r\n type: 'range';\r\n min?: number | Date;\r\n max?: number | Date;\r\n}\r\n\r\n/** Text length between `min` and `max` characters. */\r\nexport interface GridStringLengthRule extends GridValidationRuleBase {\r\n type: 'stringLength';\r\n min?: number;\r\n max?: number;\r\n}\r\n\r\n/** The text matches `pattern`; a string matches the whole value, like the HTML `pattern` attribute. */\r\nexport interface GridPatternRule extends GridValidationRuleBase {\r\n type: 'pattern';\r\n pattern: RegExp | string;\r\n}\r\n\r\n/** An e-mail address (the rule of `<input type=\"email\">`). */\r\nexport interface GridEmailRule extends GridValidationRuleBase {\r\n type: 'email';\r\n}\r\n\r\n/**\r\n * Host check: return `true` (valid), `false` (invalid, `message` or the\r\n * default text) or an error text; or a promise of it (server check). The\r\n * `signal` aborts when the value changes again or the edit ends: a stale\r\n * answer is ignored.\r\n */\r\nexport interface GridCustomRule<TItem = any> extends GridValidationRuleBase {\r\n type: 'custom';\r\n validate: (ctx: GridValidationContext<TItem>, signal: AbortSignal) => boolean | string | Promise<boolean | string>;\r\n}\r\n\r\n/**\r\n * A validation rule of `validationRules`. Empty values only fail `required`\r\n * (and `custom`, which always runs).\r\n */\r\nexport type GridValidationRule<TItem = any> =\r\n | GridRequiredRule\r\n | GridRangeRule\r\n | GridStringLengthRule\r\n | GridPatternRule\r\n | GridEmailRule\r\n | GridCustomRule<TItem>;\r\n\r\n/** Context of an `editorRenderer`. */\r\nexport interface GridEditorRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The original row item (empty object for a new row). */\r\n readonly item: TItem;\r\n /** The value being edited (pending, not yet saved). */\r\n readonly value: unknown;\r\n /** The pending change of the row. */\r\n readonly data: Partial<TItem>;\r\n /** The column of the cell. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Row key (a new row has an opaque provisional key). */\r\n readonly rowKey: unknown;\r\n /** Accessible name for the editor (the column label). */\r\n readonly label: string;\r\n /** `true` when the editor is in the row details (column hidden for lack of space, `autoHideColumns`). */\r\n readonly adaptive: boolean;\r\n /** The value failed a validation rule. */\r\n readonly invalid: boolean;\r\n /** Error text of the value (`''` when valid). */\r\n readonly errorMessage: string;\r\n /**\r\n * Id of the element with the error text, for `aria-describedby` — only for\r\n * editors rendered in the grid's shadow DOM (`TemplateResult`). For an\r\n * `HTMLElement` editor the grid places the text in its light DOM and sets\r\n * `aria-label`, `aria-invalid` and `aria-describedby` when missing.\r\n */\r\n readonly describedBy: string;\r\n /** Changes the edited value (the grid validates it on commit). */\r\n setValue(value: unknown): void;\r\n /** Commits the value (like Enter, without moving). */\r\n commit(): void;\r\n /** Discards the value and closes the editor (like Esc). */\r\n cancel(): void;\r\n}\r\n\r\n/**\r\n * Editor of a cell: focus goes to the first focusable element it renders.\r\n * It runs when the editor opens and again when the validity of the value\r\n * changes (`invalid`, `errorMessage`): keep the value in `setValue`.\r\n * The grid handles Enter, Tab and Esc unless the editor calls\r\n * `preventDefault()` on the `keydown` (a combobox that uses Enter).\r\n */\r\nexport type GridEditorRenderer<TItem = any> = (item: TItem, ctx: GridEditorRenderContext<TItem>) => GridRenderResult;\r\n\r\n/**\r\n * A coluna é editável (sem olhar o `allowEditing` do grid)? Padrão: com\r\n * `path` ou `valueSetter`.\r\n * @internal\r\n */\r\nexport const isColumnEditable = (column: GridColumnDef): boolean =>\r\n column.editable ?? (!!column.path || !!column.valueSetter);\r\n\r\n/**\r\n * A coluna é banda (`columns` com pelo menos 1 item).\r\n * @internal\r\n */\r\nexport const isBand = (column: GridColumnDef | null | undefined): boolean =>\r\n !!column && Array.isArray(column.columns) && column.columns.length > 0;\r\n\r\n/**\r\n * How columns are rendered: `virtual` keeps only the columns in view (plus the\r\n * fixed ones and the focused one) in the DOM; `standard` renders all;\r\n * `auto` is `virtual` with more than 50 leaf columns defined.\r\n */\r\nexport type GridColumnRenderingMode = 'auto' | 'virtual' | 'standard';\r\n"]}
@@ -30,8 +30,9 @@ export declare class DataGridColumn extends LitElement implements GridColumnDef
30
30
  /**
31
31
  * Stable id of the column in the grid state (`getState`, `stateStorage`)
32
32
  * and in string column references (`summary` items look it up before
33
- * `path`). Default: `path`. A column without `name` and `path` is left out
34
- * of the state.
33
+ * `path`) and, for a column without `path`, in filter conditions
34
+ * (`filterValue`). Default: `path`. A column without `name` and `path` is
35
+ * left out of the state.
35
36
  */
36
37
  name: string;
37
38
  /**
@@ -62,10 +63,26 @@ export declare class DataGridColumn extends LitElement implements GridColumnDef
62
63
  valueGetter: ((item: any) => unknown) | null;
63
64
  /** Displayed text (cell and group row); wins over `format` (property only). */
64
65
  displayValue: ((value: unknown, item: any) => string) | null;
65
- /** `text` (default) or `icon` (read-only check icon) for boolean columns. */
66
+ /**
67
+ * `text` (default), `icon` (read-only check/cross icon) or `check` (check
68
+ * icon for `true`, nothing visible for `false`) for boolean columns.
69
+ */
66
70
  booleanDisplay: GridColumnBooleanDisplay | null;
71
+ /**
72
+ * Text of `true` in this boolean column (cell, icon name, group row, filters,
73
+ * copy/paste, summaries, export). Empty or unset: the language's `trueText`;
74
+ * a fixed text, it does not follow `language`.
75
+ */
76
+ trueText: string | null;
77
+ /** Text of `false` in this boolean column, like `trueText`. Empty or unset: the language's `falseText`. */
78
+ falseText: string | null;
67
79
  /** Wraps the text in several lines instead of an ellipsis (`wrap="false"` turns it off). */
68
80
  wrap: boolean;
81
+ /**
82
+ * Wraps the header label in several lines (`header-wrap`); `header-wrap="false"`
83
+ * turns off the grid's `header-wrap` for this column. Unset: the grid's.
84
+ */
85
+ headerWrap: boolean | null;
69
86
  /** Minimum width in px (also when resizing and auto-sizing). */
70
87
  minWidth: number | null;
71
88
  /** Text for empty values (`null`/`undefined`). */
@@ -115,8 +132,9 @@ export declare class DataGridColumn extends LitElement implements GridColumnDef
115
132
  groupable: boolean | null;
116
133
  /**
117
134
  * Allows filtering by this column (filter row, header filter and, by
118
- * default, the search panel). Default (`null`): `true` when the column has
119
- * a `path`. `filterable="false"` disables it.
135
+ * default, the search panel). Default (`null`): `true` with a `path`, or
136
+ * with a `valueGetter` and a `name` (not with remote filtering).
137
+ * `filterable="false"` disables it.
120
138
  */
121
139
  filterable: boolean | null;
122
140
  /**