@universal-material/data-grid 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +155 -2
- package/custom-elements.json +4624 -0
- package/dist/attribute-converters.d.ts +53 -0
- package/dist/attribute-converters.js +98 -0
- package/dist/attribute-converters.js.map +1 -0
- package/dist/change-source.d.ts +3 -0
- package/dist/change-source.js +2 -0
- package/dist/change-source.js.map +1 -0
- package/dist/data/data-source.d.ts +164 -0
- package/dist/data/data-source.js +75 -0
- package/dist/data/data-source.js.map +1 -0
- package/dist/data/local-source.d.ts +20 -0
- package/dist/data/local-source.js +94 -0
- package/dist/data/local-source.js.map +1 -0
- package/dist/data/remote-loader.d.ts +190 -0
- package/dist/data/remote-loader.js +608 -0
- package/dist/data/remote-loader.js.map +1 -0
- package/dist/export/csv.d.ts +28 -0
- package/dist/export/csv.js +61 -0
- package/dist/export/csv.js.map +1 -0
- package/dist/export/download.d.ts +7 -0
- package/dist/export/download.js +17 -0
- package/dist/export/download.js.map +1 -0
- package/dist/export/rows.d.ts +75 -0
- package/dist/export/rows.js +134 -0
- package/dist/export/rows.js.map +1 -0
- package/dist/export/slice.d.ts +15 -0
- package/dist/export/slice.js +35 -0
- package/dist/export/slice.js.map +1 -0
- package/dist/export/types.d.ts +155 -0
- package/dist/export/types.js +2 -0
- package/dist/export/types.js.map +1 -0
- package/dist/export/write.d.ts +38 -0
- package/dist/export/write.js +178 -0
- package/dist/export/write.js.map +1 -0
- package/dist/export-pdf/client.d.ts +75 -0
- package/dist/export-pdf/client.js +155 -0
- package/dist/export-pdf/client.js.map +1 -0
- package/dist/export-pdf/engine.d.ts +73 -0
- package/dist/export-pdf/engine.js +131 -0
- package/dist/export-pdf/engine.js.map +1 -0
- package/dist/export-pdf/grid-pdf.wasm +0 -0
- package/dist/export-pdf/index.d.ts +27 -0
- package/dist/export-pdf/index.js +566 -0
- package/dist/export-pdf/index.js.map +1 -0
- package/dist/export-pdf/serialize.d.ts +23 -0
- package/dist/export-pdf/serialize.js +127 -0
- package/dist/export-pdf/serialize.js.map +1 -0
- package/dist/export-pdf/types.d.ts +150 -0
- package/dist/export-pdf/types.js +2 -0
- package/dist/export-pdf/types.js.map +1 -0
- package/dist/export-pdf/worker.d.ts +2 -0
- package/dist/export-pdf/worker.js +81 -0
- package/dist/export-pdf/worker.js.map +1 -0
- package/dist/export-xlsx/formats.d.ts +14 -0
- package/dist/export-xlsx/formats.js +40 -0
- package/dist/export-xlsx/formats.js.map +1 -0
- package/dist/export-xlsx/index.d.ts +74 -0
- package/dist/export-xlsx/index.js +137 -0
- package/dist/export-xlsx/index.js.map +1 -0
- package/dist/features/adaptive.d.ts +25 -0
- package/dist/features/adaptive.js +47 -0
- package/dist/features/adaptive.js.map +1 -0
- package/dist/features/cell-content-focus.d.ts +29 -0
- package/dist/features/cell-content-focus.js +95 -0
- package/dist/features/cell-content-focus.js.map +1 -0
- package/dist/features/cell-range.d.ts +97 -0
- package/dist/features/cell-range.js +75 -0
- package/dist/features/cell-range.js.map +1 -0
- package/dist/features/clipboard.d.ts +28 -0
- package/dist/features/clipboard.js +48 -0
- package/dist/features/clipboard.js.map +1 -0
- package/dist/features/column-chooser.d.ts +91 -0
- package/dist/features/column-chooser.js +450 -0
- package/dist/features/column-chooser.js.map +1 -0
- package/dist/features/column-dnd.d.ts +10 -0
- package/dist/features/column-dnd.js +126 -0
- package/dist/features/column-dnd.js.map +1 -0
- package/dist/features/context-menu.d.ts +122 -0
- package/dist/features/context-menu.js +153 -0
- package/dist/features/context-menu.js.map +1 -0
- package/dist/features/drag-helper.d.ts +39 -0
- package/dist/features/drag-helper.js +108 -0
- package/dist/features/drag-helper.js.map +1 -0
- package/dist/features/drop-position.d.ts +15 -0
- package/dist/features/drop-position.js +24 -0
- package/dist/features/drop-position.js.map +1 -0
- package/dist/features/editing.d.ts +111 -0
- package/dist/features/editing.js +244 -0
- package/dist/features/editing.js.map +1 -0
- package/dist/features/filter-row.d.ts +80 -0
- package/dist/features/filter-row.js +537 -0
- package/dist/features/filter-row.js.map +1 -0
- package/dist/features/filtering.d.ts +55 -0
- package/dist/features/filtering.js +209 -0
- package/dist/features/filtering.js.map +1 -0
- package/dist/features/group-dnd.d.ts +11 -0
- package/dist/features/group-dnd.js +119 -0
- package/dist/features/group-dnd.js.map +1 -0
- package/dist/features/header-filter.d.ts +96 -0
- package/dist/features/header-filter.js +579 -0
- package/dist/features/header-filter.js.map +1 -0
- package/dist/features/host-label.d.ts +36 -0
- package/dist/features/host-label.js +184 -0
- package/dist/features/host-label.js.map +1 -0
- package/dist/features/keyboard.d.ts +59 -0
- package/dist/features/keyboard.js +127 -0
- package/dist/features/keyboard.js.map +1 -0
- package/dist/features/menu.d.ts +113 -0
- package/dist/features/menu.js +491 -0
- package/dist/features/menu.js.map +1 -0
- package/dist/features/resize.d.ts +82 -0
- package/dist/features/resize.js +214 -0
- package/dist/features/resize.js.map +1 -0
- package/dist/features/search.d.ts +45 -0
- package/dist/features/search.js +123 -0
- package/dist/features/search.js.map +1 -0
- package/dist/features/selection.d.ts +37 -0
- package/dist/features/selection.js +103 -0
- package/dist/features/selection.js.map +1 -0
- package/dist/features/sorting.d.ts +39 -0
- package/dist/features/sorting.js +53 -0
- package/dist/features/sorting.js.map +1 -0
- package/dist/features/toolbar.d.ts +125 -0
- package/dist/features/toolbar.js +135 -0
- package/dist/features/toolbar.js.map +1 -0
- package/dist/features/tree.d.ts +53 -0
- package/dist/features/tree.js +94 -0
- package/dist/features/tree.js.map +1 -0
- package/dist/features/validation.d.ts +48 -0
- package/dist/features/validation.js +172 -0
- package/dist/features/validation.js.map +1 -0
- package/dist/grid-column-def.d.ts +509 -0
- package/dist/grid-column-def.js +32 -0
- package/dist/grid-column-def.js.map +1 -0
- package/dist/grid-column.d.ts +167 -0
- package/dist/grid-column.js +376 -0
- package/dist/grid-column.js.map +1 -0
- package/dist/grid-i18n.d.ts +469 -0
- package/dist/grid-i18n.js +3222 -0
- package/dist/grid-i18n.js.map +1 -0
- package/dist/grid.d.ts +1484 -0
- package/dist/grid.js +15579 -0
- package/dist/grid.js.map +1 -0
- package/dist/grid.min.js +3858 -0
- package/dist/grid.styles.d.ts +2 -0
- package/dist/grid.styles.js +2747 -0
- package/dist/grid.styles.js.map +1 -0
- package/dist/render/cell.d.ts +16 -0
- package/dist/render/cell.js +78 -0
- package/dist/render/cell.js.map +1 -0
- package/dist/render/column-window.d.ts +18 -0
- package/dist/render/column-window.js +50 -0
- package/dist/render/column-window.js.map +1 -0
- package/dist/render/content.d.ts +45 -0
- package/dist/render/content.js +140 -0
- package/dist/render/content.js.map +1 -0
- package/dist/render/editors.d.ts +28 -0
- package/dist/render/editors.js +41 -0
- package/dist/render/editors.js.map +1 -0
- package/dist/render/footer.d.ts +61 -0
- package/dist/render/footer.js +61 -0
- package/dist/render/footer.js.map +1 -0
- package/dist/render/group-row.d.ts +35 -0
- package/dist/render/group-row.js +59 -0
- package/dist/render/group-row.js.map +1 -0
- package/dist/render/header.d.ts +92 -0
- package/dist/render/header.js +103 -0
- package/dist/render/header.js.map +1 -0
- package/dist/render/keyed-rows.d.ts +25 -0
- package/dist/render/keyed-rows.js +98 -0
- package/dist/render/keyed-rows.js.map +1 -0
- package/dist/render/virtualizer.d.ts +110 -0
- package/dist/render/virtualizer.js +509 -0
- package/dist/render/virtualizer.js.map +1 -0
- package/dist/row-model/added-rows.d.ts +32 -0
- package/dist/row-model/added-rows.js +95 -0
- package/dist/row-model/added-rows.js.map +1 -0
- package/dist/row-model/cell-range.d.ts +71 -0
- package/dist/row-model/cell-range.js +187 -0
- package/dist/row-model/cell-range.js.map +1 -0
- package/dist/row-model/columns.d.ts +80 -0
- package/dist/row-model/columns.js +207 -0
- package/dist/row-model/columns.js.map +1 -0
- package/dist/row-model/compare.d.ts +40 -0
- package/dist/row-model/compare.js +590 -0
- package/dist/row-model/compare.js.map +1 -0
- package/dist/row-model/distinct.d.ts +39 -0
- package/dist/row-model/distinct.js +105 -0
- package/dist/row-model/distinct.js.map +1 -0
- package/dist/row-model/filter.d.ts +80 -0
- package/dist/row-model/filter.js +582 -0
- package/dist/row-model/filter.js.map +1 -0
- package/dist/row-model/flatten.d.ts +129 -0
- package/dist/row-model/flatten.js +511 -0
- package/dist/row-model/flatten.js.map +1 -0
- package/dist/row-model/fold.d.ts +25 -0
- package/dist/row-model/fold.js +104 -0
- package/dist/row-model/fold.js.map +1 -0
- package/dist/row-model/format.d.ts +58 -0
- package/dist/row-model/format.js +239 -0
- package/dist/row-model/format.js.map +1 -0
- package/dist/row-model/group.d.ts +30 -0
- package/dist/row-model/group.js +173 -0
- package/dist/row-model/group.js.map +1 -0
- package/dist/row-model/lru.d.ts +19 -0
- package/dist/row-model/lru.js +48 -0
- package/dist/row-model/lru.js.map +1 -0
- package/dist/row-model/sort.d.ts +30 -0
- package/dist/row-model/sort.js +107 -0
- package/dist/row-model/sort.js.map +1 -0
- package/dist/row-model/summary.d.ts +64 -0
- package/dist/row-model/summary.js +213 -0
- package/dist/row-model/summary.js.map +1 -0
- package/dist/row-model/tree.d.ts +116 -0
- package/dist/row-model/tree.js +478 -0
- package/dist/row-model/tree.js.map +1 -0
- package/dist/row-model/types.d.ts +109 -0
- package/dist/row-model/types.js +5 -0
- package/dist/row-model/types.js.map +1 -0
- package/dist/row-model/value.d.ts +20 -0
- package/dist/row-model/value.js +57 -0
- package/dist/row-model/value.js.map +1 -0
- package/dist/state/grid-state.d.ts +147 -0
- package/dist/state/grid-state.js +295 -0
- package/dist/state/grid-state.js.map +1 -0
- package/dist/state/storage.d.ts +33 -0
- package/dist/state/storage.js +62 -0
- package/dist/state/storage.js.map +1 -0
- package/dist/state/versioned.d.ts +18 -0
- package/dist/state/versioned.js +56 -0
- package/dist/state/versioned.js.map +1 -0
- package/package.json +141 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/export-pdf/index.ts"],"names":[],"mappings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AI,EAAE;QACvE,GAAG,OAAO;QACV,YAAY;QACZ,MAAM;QACN,UAAU,EAAE,QAAQ,CAAC,EAAE;YACrB,OAAO,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAC;YAC/B,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAC;QACzB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["/* eslint-disable no-bitwise -- bits de estilo das células no protocolo do motor. */\n/**\n * Exportação em PDF (frente 26): `@universal-material/data-grid/export-pdf`.\n *\n * PDF marcado (alvo PDF/UA-1) gerado por um motor WebAssembly (crate `pdf/`)\n * num Web Worker: lê o que o usuário vê em blocos (`_exportStream`), aplica\n * `customizeCell`, serializa e manda ao motor; o arquivo volta em blocos.\n * O `.wasm` e o worker só são baixados ao exportar.\n */\nimport { downloadBlob } from '../export/download.js';\nimport { createSlicer } from '../export/slice.js';\nimport type { GridExportColumn, GridExportData, GridExporter, GridExportRow } from '../export/types.js';\nimport { type GridI18n, resolveGridTranslation } from '../grid-i18n.js';\nimport type { DataGrid } from '../grid.js';\nimport { LruCache } from '../row-model/lru.js';\nimport { type Client, localClient, workerClient } from './client.js';\nimport { EngineCode, EngineError, readFileUrl } from './engine.js';\nimport { contrast, parseColor, Writer } from './serialize.js';\nimport type {\n GridPdfCell,\n GridPdfCellStyle,\n GridPdfDownloadOptions,\n GridPdfExporterOptions,\n GridPdfFont,\n GridPdfOptions,\n GridPdfPaperSize,\n GridPdfProgress,\n} from './types.js';\n\nexport type {\n GridPdfCell,\n GridPdfCellStyle,\n GridPdfDownloadOptions,\n GridPdfExporterOptions,\n GridPdfFont,\n GridPdfImage,\n GridPdfLayout,\n GridPdfLink,\n GridPdfOptions,\n GridPdfOrientation,\n GridPdfPaperSize,\n GridPdfProgress,\n GridPdfTheme,\n} from './types.js';\n\n/** Some characters have no glyph in any of the `fonts`: the PDF would lose them (PDF/UA). Add a font that covers them. */\nexport class GridPdfMissingGlyphError extends Error {\n /** The code points without a glyph. */\n readonly codePoints: readonly number[];\n\n constructor(codePoints: readonly number[]) {\n const list = codePoints.slice(0, 12).map(cp => `U+${cp.toString(16).toUpperCase()\n .padStart(4, '0')}`)\n .join(', ');\n super(`No font covers ${codePoints.length} character(s): ${list}${codePoints.length > 12 ? ', …' : ''}. Add a font for them to \"fonts\".`);\n this.name = 'GridPdfMissingGlyphError';\n this.codePoints = Object.freeze([...codePoints]);\n }\n}\n\n// ------------------------------------------------------------------ padrões\n\nconst PAPER: Record<Exclude<GridPdfPaperSize, 'auto'>, [number, number]> = {\n a4: [595.28, 841.89],\n letter: [612, 792],\n legal: [612, 1008],\n a3: [841.89, 1190.55],\n};\n\n/** Regiões que usam Carta (Letter). */\nconst LETTER_REGIONS = new Set(['US', 'CA', 'MX', 'PH', 'CL', 'CO', 'VE', 'PR', 'GT', 'CR', 'PA', 'DO', 'SV', 'NI', 'HN', 'BO', 'BZ']);\n\nconst THEME = {\n color: 0x1a1a1a,\n headerBackgroundColor: 0xe6e6e6,\n groupBackgroundColor: 0xf0f0f0,\n stripedBackgroundColor: 0xf7f7f7,\n summaryBackgroundColor: 0xececec,\n lineColor: 0x8a8a8a,\n};\n\nconst WHITE = 0xffffff;\nconst MIN_CONTRAST = 4.5;\nconst MARGIN = 36;\nconst BATCH_ROWS = 2000;\nconst PROGRESS_MS = 250;\n/** Orçamento de uma fatia de serialização na thread principal (ms de relógio). */\nconst PDF_SLICE_MS = 4;\n/** Tamanho da fonte do grid quando não há grid (px). */\nconst GRID_FONT_PX = 14;\n/** Largura de coluna sem largura conhecida (px), como a regra da spec 21. */\nconst DEFAULT_COLUMN_PX = 150;\n\n// ------------------------------------------------------------------ avisos limitados\n\nconst warned = new LruCache<string, true>(64);\n\nconst warnOnce = (key: string, message: string) => {\n if (!warned.get(key)) {\n warned.set(key, true);\n console.warn(`<u-grid> PDF: ${message}`);\n }\n};\n\n// ------------------------------------------------------------------ fontes\n\n/** Fontes lidas (cópias), por origem: limitado. */\nconst fontCache = new LruCache<unknown, Promise<Uint8Array>>(8);\n\nconst loadFont = (font: GridPdfFont, signal: AbortSignal | null | undefined): Promise<Uint8Array> => {\n const source = font.source;\n const key = typeof source === 'string' || source instanceof URL ? String(source) : source;\n let bytes = fontCache.get(key);\n\n if (!bytes) {\n bytes = (async () => {\n if (typeof source === 'string' || source instanceof URL) {\n const href = String(source);\n\n if (href.startsWith('file:')) {\n return readFileUrl(href);\n }\n\n const response = await fetch(source, { signal: signal ?? undefined });\n\n if (!response.ok) {\n throw new Error(`could not load font ${String(source)} (${response.status})`);\n }\n\n return new Uint8Array(await response.arrayBuffer());\n }\n\n // cópia: o buffer do hospedeiro nunca é transferido nem mudado\n return source instanceof Uint8Array ? source.slice() : new Uint8Array(source.slice(0));\n })();\n bytes.catch(() => fontCache.delete(key));\n fontCache.set(key, bytes);\n }\n\n return bytes;\n};\n\nconst validate = (options: GridPdfOptions | GridPdfExporterOptions): void => {\n if (!options || !Array.isArray(options.fonts) || options.fonts.length === 0) {\n throw new TypeError('<u-grid> PDF: \"fonts\" must be a non-empty array of fonts.');\n }\n\n options.fonts.forEach((font, i) => {\n const s = font?.source;\n\n if (!(s instanceof ArrayBuffer || s instanceof Uint8Array || typeof s === 'string' || s instanceof URL)) {\n throw new TypeError(`<u-grid> PDF: fonts[${i}].source must be an ArrayBuffer, a Uint8Array or a URL.`);\n }\n });\n\n if (options.layout && !['table', 'sections', 'list'].includes(options.layout)) {\n throw new TypeError(`<u-grid> PDF: unknown layout \"${options.layout}\".`);\n }\n};\n\n// ------------------------------------------------------------------ contexto\n\ninterface Context {\n title: string;\n language: string;\n textLanguage: string;\n rtl: boolean;\n translation: GridI18n;\n striped: boolean;\n autoHide: boolean;\n gridFontPx: number;\n columns: GridExportColumn[];\n rows: Iterator<GridExportRow>;\n totalCount: number;\n}\n\nconst isGrid = (source: DataGrid | GridExportData): source is DataGrid =>\n typeof (source as Partial<DataGrid>)._exportStream === 'function';\n\nconst validLanguage = (language: string | undefined): string | undefined => {\n if (!language) {\n return undefined;\n }\n\n try {\n return Intl.getCanonicalLocales(language)[0];\n } catch {\n warnOnce(`lang:${language}`, `\"${language}\" is not a valid language tag; it was ignored.`);\n return undefined;\n }\n};\n\nconst contextOf = (source: DataGrid | GridExportData, options: GridPdfOptions): Context => {\n const includeGroups = options.layout !== 'list';\n\n if (isGrid(source)) {\n const stream = source._exportStream({ ...options, includeGroups });\n const { content, text } = source._exportLanguages;\n const language = validLanguage(options.language) ?? validLanguage(content) ?? 'en';\n const translation = source._exportTranslation;\n const style = getComputedStyle(source);\n\n return {\n title: options.title?.trim() || source._exportName.trim() || translation.pdfDefaultTitle,\n language,\n textLanguage: text,\n rtl: (options.direction ?? style.direction) === 'rtl',\n translation,\n striped: options.striped ?? source.striped,\n autoHide: options.autoHideColumns ?? source.autoHideColumns,\n gridFontPx: parseFloat(style.fontSize) || GRID_FONT_PX,\n columns: stream.columns,\n rows: stream.rows,\n totalCount: stream.totalCount,\n };\n }\n\n const language = validLanguage(options.language) ?? 'en';\n const translation = resolveGridTranslation(language);\n\n return {\n title: options.title?.trim() || translation.pdfDefaultTitle,\n language,\n textLanguage: language,\n rtl: options.direction === 'rtl',\n translation,\n striped: !!options.striped,\n autoHide: !!options.autoHideColumns,\n gridFontPx: GRID_FONT_PX,\n columns: source.columns,\n rows: source.rows[Symbol.iterator](),\n totalCount: source.rows.filter(row => row.rowType === 'data').length,\n };\n};\n\n// ------------------------------------------------------------------ configuração\n\nconst paperOf = (size: GridPdfPaperSize | undefined, language: string): [number, number] => {\n if (size && size !== 'auto') {\n return PAPER[size] ?? PAPER.a4;\n }\n\n let region: string | undefined;\n\n try {\n region = new Intl.Locale(language).maximize().region;\n } catch {\n region = undefined;\n }\n\n return region && LETTER_REGIONS.has(region) ? PAPER.letter : PAPER.a4;\n};\n\ninterface Theme {\n color: number;\n header: number;\n group: number;\n stripe: number;\n summary: number;\n line: number;\n}\n\n/** Tema com contraste: a cor reprovada volta ao padrão (com aviso). */\nconst themeOf = (options: GridPdfOptions): Theme => {\n const t = options.theme ?? {};\n\n const pick = (name: keyof typeof THEME): number => {\n const value = t[name];\n\n if (value === undefined) {\n return THEME[name];\n }\n\n const parsed = parseColor(value);\n\n if (parsed === undefined) {\n warnOnce(`color:${value}`, `\"${value}\" is not a color; the default ${name} was used.`);\n return THEME[name];\n }\n\n return parsed;\n };\n\n let color = pick('color');\n\n if (contrast(color, WHITE) < MIN_CONTRAST) {\n warnOnce(`theme-color:${color}`, 'theme.color has a contrast below 4.5:1 with the page; the default was used.');\n color = THEME.color;\n }\n\n const background = (name: keyof typeof THEME): number => {\n const bg = pick(name);\n\n if (contrast(color, bg) < MIN_CONTRAST) {\n warnOnce(`theme-${name}:${bg}`, `theme.${name} has a contrast below 4.5:1 with the text; the default was used.`);\n return THEME[name];\n }\n\n return bg;\n };\n\n return {\n color,\n header: background('headerBackgroundColor'),\n group: background('groupBackgroundColor'),\n stripe: background('stripedBackgroundColor'),\n summary: background('summaryBackgroundColor'),\n line: pick('lineColor'),\n };\n};\n\nconst ALIGN = { start: 0, left: 0, center: 1, end: 2, right: 2 } as const;\n\nconst configOf = (ctx: Context, options: GridPdfOptions, theme: Theme): Uint8Array => {\n const w = new Writer();\n const fontSize = Math.max(6, options.theme?.fontSize ?? 8);\n const [pw, ph] = paperOf(options.paperSize, ctx.language);\n const scale = fontSize / ctx.gridFontPx;\n const anyPriority = ctx.columns.some(c => Number.isFinite(c.column.hidingPriority));\n w.u8(1);\n w.str(ctx.title);\n w.str(ctx.language);\n w.str(ctx.textLanguage);\n w.u8(ctx.rtl ? 1 : 0);\n w.u8(options.layout === 'sections' ? 1 : options.layout === 'list' ? 2 : 0);\n w.f32(pw);\n w.f32(ph);\n w.u8(options.orientation === 'portrait' ? 1 : options.orientation === 'landscape' ? 2 : 0);\n w.f32(MARGIN);\n w.f32(fontSize);\n w.u32((options.includePageNumbers !== false ? 1 : 0)\n | (options.bookmarks !== false ? 2 : 0)\n | (ctx.striped ? 4 : 0)\n | (ctx.autoHide ? 8 : 0)\n | (anyPriority ? 16 : 0));\n\n for (const c of [theme.color, theme.header, theme.group, theme.stripe, theme.summary, theme.line]) {\n w.u32(c);\n }\n\n w.str(ctx.translation.pdfPageNumber);\n w.str(ctx.translation.adaptiveLabelSeparator);\n w.str(ctx.translation.pdfTotalRow);\n w.u16(ctx.columns.length);\n\n for (const c of ctx.columns) {\n const px = c.width ?? Math.max(Number(c.column.minWidth) || 0, DEFAULT_COLUMN_PX);\n w.str(c.label);\n w.f32(px * scale);\n w.u8(ALIGN[c.alignment as keyof typeof ALIGN] ?? 0);\n w.i32(Number.isFinite(c.column.hidingPriority) ? Math.trunc(c.column.hidingPriority!) : -2147483648);\n w.u8(c.column.fixed ? 1 : 0);\n }\n\n return w.take();\n};\n\n// ------------------------------------------------------------------ células\n\ninterface Pending {\n images: Map<Uint8Array, number>;\n client: Client;\n /** O motor numera as imagens na ordem de chegada: o id é conhecido sem esperar. */\n nextImage: number;\n /** Registros de imagem em voo (os erros aparecem no próximo bloco). */\n registering: Promise<number>[];\n}\n\nconst rowBackground = (rowType: GridPdfCell['rowType'], theme: Theme): number[] =>\n rowType === 'header' ? [theme.header] : rowType === 'group' ? [theme.group] : rowType === 'data' ? [WHITE, theme.stripe] : [theme.summary];\n\n/** Célula sem `customizeCell` (o caso comum): só texto e negrito. */\nconst writePlain = (w: Writer, text: string, bold: boolean): void => {\n w.u16(bold ? 1 : 0);\n w.str(text);\n};\n\n/** Aplica `customizeCell` e escreve a célula (síncrono: a imagem nova é registrada sem esperar). */\nconst writeCell = (\n w: Writer,\n pending: Pending,\n theme: Theme,\n options: GridPdfOptions,\n base: Omit<GridPdfCell, 'text' | 'style'> & { text: string; style: GridPdfCellStyle },\n): void => {\n if (!options.customizeCell) {\n writePlain(w, base.text, !!base.style.bold);\n return;\n }\n\n const cell: GridPdfCell = { ...base, style: { ...base.style } };\n options.customizeCell?.(cell);\n const text = typeof cell.text === 'string' ? cell.text : String(cell.text ?? '');\n const style = cell.style ?? {};\n let color = parseColor(style.color);\n let bg = parseColor(style.backgroundColor);\n const finalBgs = bg !== undefined ? [bg] : rowBackground(base.rowType, theme);\n const finalColor = color ?? theme.color;\n\n if (finalBgs.some(b => contrast(finalColor, b) < MIN_CONTRAST)) {\n warnOnce(`cell:${finalColor}:${finalBgs.join()}`, 'a cell color has a contrast below 4.5:1 with its background; the theme colors were used.');\n color = undefined;\n\n if (bg !== undefined && contrast(theme.color, bg) < MIN_CONTRAST) {\n bg = undefined;\n }\n }\n\n const lang = validLanguage(cell.lang);\n let image: number | undefined;\n let alt = '';\n\n if (cell.image) {\n const img = cell.image;\n\n if (!(img.data instanceof Uint8Array) || (img.format !== 'png' && img.format !== 'jpeg')) {\n warnOnce('image-format', 'customizeCell image needs \"data\" (Uint8Array) and \"format\" (png or jpeg); it was ignored.');\n } else if (typeof img.alt !== 'string') {\n warnOnce('image-alt', 'customizeCell image without \"alt\" was ignored (use \"\" for a decorative image).');\n } else if ((base.rowType === 'header' || base.rowType === 'group') && !text && !img.alt.trim()) {\n warnOnce('image-header', 'an image in a header or group cell needs a text or a non-empty \"alt\"; it was ignored.');\n } else {\n let id = pending.images.get(img.data);\n\n if (id === undefined) {\n // as mensagens ao motor são em ordem: a imagem chega antes do bloco que a usa\n id = pending.nextImage++;\n const registering = pending.client.addImage(img.data, img.format === 'jpeg' ? 1 : 0, Math.max(1, img.width || 0), Math.max(1, img.height || 0));\n registering.catch(() => undefined);\n pending.registering.push(registering);\n pending.images.set(img.data, id);\n }\n\n image = id;\n alt = img.alt;\n }\n }\n\n let link: [string, string] | undefined;\n\n if (cell.link) {\n const url = String(cell.link.url ?? '').trim();\n const description = String(cell.link.description ?? '');\n\n if (!(/^(https?:|mailto:)/i).test(url)) {\n warnOnce(`link:${url.slice(0, 20)}`, `link \"${url.slice(0, 40)}\" was ignored (only http:, https: and mailto:).`);\n } else if (!text && !alt && !description) {\n warnOnce('link-text', 'a link without text, alt or description was ignored.');\n } else {\n link = [url, description];\n }\n }\n\n const align = style.alignment ? ALIGN[style.alignment as keyof typeof ALIGN] + 1 : 0;\n const flags = (style.bold ? 1 : 0)\n | (style.italic ? 2 : 0)\n | (color !== undefined ? 4 : 0)\n | (bg !== undefined ? 8 : 0)\n | (lang ? 16 : 0)\n | (image !== undefined ? 32 : 0)\n | (link ? 64 : 0)\n | (align << 8);\n w.u16(flags);\n w.str(text);\n\n if (color !== undefined) {\n w.u32(color);\n }\n\n if (bg !== undefined) {\n w.u32(bg);\n }\n\n if (lang) {\n w.str(lang);\n }\n\n if (image !== undefined) {\n w.u32(image);\n w.str(alt);\n }\n\n if (link) {\n w.str(link[0]);\n w.str(link[1]);\n }\n};\n\nconst KIND = { data: 0, group: 1, 'group-footer': 2, total: 3 } as const;\n\n// ------------------------------------------------------------------ exportação\n\nconst clientOf = async (options: GridPdfOptions): Promise<Client> => {\n // `new URL('./…', import.meta.url)` literal: os bundlers (Vite, webpack, esbuild) copiam o arquivo\n const wasm = options.assetsUrl ? new URL('grid-pdf.wasm', options.assetsUrl).href : new URL('./grid-pdf.wasm', import.meta.url).href;\n const factory = options.worker;\n\n if (factory === false || (typeof factory !== 'function' && typeof Worker === 'undefined')) {\n return localClient(wasm);\n }\n\n // dois workers: o motor (layout) e o montador (deflate e escrita), em paralelo\n const create = typeof factory === 'function'\n ? factory\n : () => options.assetsUrl\n ? new Worker(new URL('worker.js', options.assetsUrl), { type: 'module' })\n : new Worker(new URL('./worker.js', import.meta.url), { type: 'module' });\n const engine = create();\n let assembler: Worker | undefined;\n\n try {\n assembler = create();\n return await workerClient(engine, assembler, wasm);\n } catch (error) {\n engine.terminate();\n assembler?.terminate();\n throw error;\n }\n};\n\nconst rethrow = (error: unknown): never => {\n if (error instanceof EngineError && error.code === EngineCode.MissingGlyph) {\n throw new GridPdfMissingGlyphError(error.message.split(',').filter(Boolean)\n .map(hex => parseInt(hex, 16)));\n }\n\n throw error;\n};\n\n/**\n * The PDF of what the user sees (with a grid: visible columns in the current\n * order, filter, sorting, groups and summaries) or of ready data: a tagged PDF\n * (PDF/UA-1 target) with the given fonts embedded. Runs in a Web Worker; the\n * `.wasm` and the worker load on the first export.\n */\nexport const exportPdf = async (source: DataGrid | GridExportData, options: GridPdfOptions): Promise<Blob> => {\n validate(options);\n const signal = options.signal;\n signal?.throwIfAborted();\n const ctx = contextOf(source, options);\n const theme = themeOf(options);\n const fonts = await Promise.all(options.fonts.map(font => loadFont(font, signal)));\n signal?.throwIfAborted();\n const client = await clientOf(options);\n const onAbort = () => client.dispose();\n signal?.addEventListener('abort', onAbort, { once: true });\n const parts: Blob[] = [];\n\n const keep = (chunks: Uint8Array[]) => {\n for (const chunk of chunks) {\n parts.push(new Blob([chunk as BlobPart]));\n }\n };\n\n let pageCount = 0;\n let rowCount = 0;\n let lastProgress = 0;\n\n const progress = (force = false) => {\n const now = performance.now();\n\n if (options.onProgress && !signal?.aborted && (force || now - lastProgress >= PROGRESS_MS)) {\n lastProgress = now;\n\n try {\n options.onProgress({ rowCount, totalCount: Math.max(ctx.totalCount, rowCount), pageCount } satisfies GridPdfProgress);\n } catch (error) {\n console.error('<u-grid> PDF: onProgress failed.', error);\n }\n }\n };\n\n try {\n for (const [i, bytes] of fonts.entries()) {\n const font = options.fonts[i];\n await client.addFont(bytes, font.weight === 'bold', font.style === 'italic');\n }\n\n await client.begin(configOf(ctx, options, theme));\n const pending: Pending = { images: new Map(), client, nextImage: 0, registering: [] };\n const w = new Writer();\n let count = 0;\n // Um bloco em voo: o worker faz o layout de um enquanto a thread principal serializa o próximo.\n let inflight: Promise<void> | null = null;\n // o bloco começa pelo total de linhas, preenchido no envio\n w.u32(0);\n\n const flush = async (last: boolean) => {\n w.setU32(0, count);\n const data = w.take();\n w.u32(0);\n count = 0;\n\n if (pending.registering.length) {\n const registering = pending.registering;\n pending.registering = [];\n await Promise.all(registering);\n }\n\n if (inflight) {\n await inflight;\n }\n\n signal?.throwIfAborted();\n inflight = client.rows(data, last).then(r => {\n keep(r.chunks);\n pageCount = r.pages;\n progress();\n });\n // Falha do bloco em voo: tratada aqui e relançada no próximo `await` (sem \"unhandled rejection\").\n inflight.catch(() => undefined);\n\n if (last) {\n await inflight;\n inflight = null;\n }\n };\n\n // cabeçalho\n w.u8(4);\n w.u8(0);\n w.u16(ctx.columns.length);\n\n for (const [i, column] of ctx.columns.entries()) {\n writeCell(w, pending, theme, options, { rowType: 'header', row: null, column, columnIndex: i, value: column.label, text: column.label, style: { bold: true } });\n }\n\n count++;\n\n const groupText: string[] = [];\n // fatia menor que a do CSV: a thread principal também recebe os blocos do worker (Blobs,\n // repasse ao montador) e o GC desses objetos cai nas mesmas tarefas\n const slicer = createSlicer(PDF_SLICE_MS);\n let next = ctx.rows.next();\n\n while (!next.done) {\n const row = next.value;\n const kind = KIND[row.rowType];\n\n if (kind === undefined) {\n warnOnce(`row:${String(row.rowType)}`, `rows of type \"${String(row.rowType)}\" are not supported and were left out.`);\n next = ctx.rows.next();\n continue;\n }\n\n w.u8(kind);\n w.u8(Math.min(255, row.level));\n\n if (row.rowType === 'group') {\n groupText[row.level] = row.text;\n groupText.length = row.level + 1;\n w.u16(1 + ctx.columns.length);\n writeCell(w, pending, theme, options, { rowType: 'group', row, column: null, columnIndex: -1, value: row.value, text: row.label, style: { bold: true } });\n\n for (const [i, column] of ctx.columns.entries()) {\n writeCell(w, pending, theme, options, { rowType: 'group', row, column, columnIndex: i, value: row.summaries[i], text: row.texts[i] ?? '', style: {} });\n }\n } else if (row.rowType === 'data' && !options.customizeCell) {\n // caminho rápido (o caso comum): só os textos, sem objetos por célula\n const texts = row.texts;\n const n = ctx.columns.length;\n w.u16(n);\n\n for (let i = 0; i < n; i++) {\n writePlain(w, texts[i] ?? '', false);\n }\n\n rowCount++;\n } else {\n const total = row.rowType === 'total';\n w.u16(ctx.columns.length);\n\n for (const [i, column] of ctx.columns.entries()) {\n let text = row.texts[i] ?? '';\n\n // 1ª célula do rodapé de grupo: o grupo (cabeçalho de linha no PDF)\n if (i === 0 && !text && row.rowType === 'group-footer') {\n text = groupText[Math.max(0, row.level - 1)] ?? '';\n }\n\n const value = row.rowType === 'data' ? row.values[i] : row.summaries[i];\n writeCell(w, pending, theme, options, { rowType: row.rowType, row, column, columnIndex: i, value, text, style: { bold: total } });\n }\n\n if (row.rowType === 'data') {\n rowCount++;\n }\n }\n\n count++;\n\n if (count >= BATCH_ROWS) {\n await flush(false);\n }\n\n const pause = slicer.tick();\n\n if (pause) {\n await pause;\n signal?.throwIfAborted();\n }\n\n next = ctx.rows.next();\n }\n\n await flush(true);\n keep(await client.finish());\n signal?.throwIfAborted();\n progress(true);\n } catch (error) {\n client.dispose();\n\n if (signal?.aborted) {\n throw signal.reason;\n }\n\n rethrow(error);\n } finally {\n signal?.removeEventListener('abort', onAbort);\n }\n\n client.dispose();\n\n return new Blob(parts, { type: 'application/pdf' });\n};\n\n/** Builds the PDF (`exportPdf`) and downloads it as `fileName` (default `export.pdf`). */\nexport const downloadPdf = async (source: DataGrid | GridExportData, options: GridPdfDownloadOptions): Promise<void> => {\n downloadBlob(await exportPdf(source, options), options.fileName || 'export.pdf');\n};\n\n/**\n * The PDF entry of the grid export UI: `grid.pdfExporter =\n * createPdfExporter({ fonts })` (with `export-formats=\"… pdf\"`). The grid\n * passes `selectedOnly`, a `signal` (cancel, disconnect) and `onProgress`\n * (shown in the export button). Options are checked now (`TypeError`).\n */\nexport const createPdfExporter = (options: GridPdfExporterOptions): GridExporter => {\n validate(options);\n\n return (grid, { selectedOnly, signal, onProgress }) => downloadPdf(grid, {\n ...options,\n selectedOnly,\n signal,\n onProgress: progress => {\n options.onProgress?.(progress);\n onProgress?.(progress);\n },\n });\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocolo binário JS → motor (o mesmo de `pdf/src/input.rs`): configuração
|
|
3
|
+
* e blocos de linhas, little endian, strings em UTF-8 com o tamanho antes.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Writer {
|
|
6
|
+
#private;
|
|
7
|
+
u8(v: number): void;
|
|
8
|
+
u16(v: number): void;
|
|
9
|
+
u32(v: number): void;
|
|
10
|
+
i32(v: number): void;
|
|
11
|
+
f32(v: number): void;
|
|
12
|
+
str(v: string): void;
|
|
13
|
+
/** Reescreve um `u32` já escrito (o total de linhas do bloco, conhecido no fim). */
|
|
14
|
+
setU32(at: number, v: number): void;
|
|
15
|
+
get length(): number;
|
|
16
|
+
/** Bytes escritos (cópia) e recomeça. */
|
|
17
|
+
take(): Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
/** Cor CSS → RGB (`0xRRGGBB`); `undefined` quando não dá para ler. */
|
|
20
|
+
export declare const parseColor: (color: string | undefined | null) => number | undefined;
|
|
21
|
+
/** Contraste WCAG entre duas cores. */
|
|
22
|
+
export declare const contrast: (a: number, b: number) => number;
|
|
23
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/* eslint-disable no-bitwise -- protocolo binário do motor e cores 0xRRGGBB. */
|
|
2
|
+
/**
|
|
3
|
+
* Protocolo binário JS → motor (o mesmo de `pdf/src/input.rs`): configuração
|
|
4
|
+
* e blocos de linhas, little endian, strings em UTF-8 com o tamanho antes.
|
|
5
|
+
*/
|
|
6
|
+
const encoder = new TextEncoder();
|
|
7
|
+
export class Writer {
|
|
8
|
+
#buf = new Uint8Array(64 * 1024);
|
|
9
|
+
#view = new DataView(this.#buf.buffer);
|
|
10
|
+
#len = 0;
|
|
11
|
+
#room(n) {
|
|
12
|
+
if (this.#len + n > this.#buf.length) {
|
|
13
|
+
let size = this.#buf.length * 2;
|
|
14
|
+
while (size < this.#len + n) {
|
|
15
|
+
size *= 2;
|
|
16
|
+
}
|
|
17
|
+
const next = new Uint8Array(size);
|
|
18
|
+
next.set(this.#buf.subarray(0, this.#len));
|
|
19
|
+
this.#buf = next;
|
|
20
|
+
this.#view = new DataView(next.buffer);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
u8(v) {
|
|
24
|
+
this.#room(1);
|
|
25
|
+
this.#view.setUint8(this.#len, v);
|
|
26
|
+
this.#len += 1;
|
|
27
|
+
}
|
|
28
|
+
u16(v) {
|
|
29
|
+
this.#room(2);
|
|
30
|
+
this.#view.setUint16(this.#len, v, true);
|
|
31
|
+
this.#len += 2;
|
|
32
|
+
}
|
|
33
|
+
u32(v) {
|
|
34
|
+
this.#room(4);
|
|
35
|
+
this.#view.setUint32(this.#len, v >>> 0, true);
|
|
36
|
+
this.#len += 4;
|
|
37
|
+
}
|
|
38
|
+
i32(v) {
|
|
39
|
+
this.#room(4);
|
|
40
|
+
this.#view.setInt32(this.#len, v, true);
|
|
41
|
+
this.#len += 4;
|
|
42
|
+
}
|
|
43
|
+
f32(v) {
|
|
44
|
+
this.#room(4);
|
|
45
|
+
this.#view.setFloat32(this.#len, v, true);
|
|
46
|
+
this.#len += 4;
|
|
47
|
+
}
|
|
48
|
+
str(v) {
|
|
49
|
+
const n = v.length;
|
|
50
|
+
// UTF-8 tem no máximo 3 bytes por unidade UTF-16
|
|
51
|
+
this.#room(4 + n * 3);
|
|
52
|
+
const buf = this.#buf;
|
|
53
|
+
let p = this.#len + 4;
|
|
54
|
+
let i = 0;
|
|
55
|
+
// ASCII (o caso comum: números, datas, códigos) byte a byte, sem criar vistas
|
|
56
|
+
for (; i < n; i++) {
|
|
57
|
+
const c = v.charCodeAt(i);
|
|
58
|
+
if (c >= 0x80) {
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
buf[p++] = c;
|
|
62
|
+
}
|
|
63
|
+
if (i < n) {
|
|
64
|
+
p += encoder.encodeInto(i ? v.slice(i) : v, buf.subarray(p)).written;
|
|
65
|
+
}
|
|
66
|
+
this.#view.setUint32(this.#len, p - this.#len - 4, true);
|
|
67
|
+
this.#len = p;
|
|
68
|
+
}
|
|
69
|
+
/** Reescreve um `u32` já escrito (o total de linhas do bloco, conhecido no fim). */
|
|
70
|
+
setU32(at, v) {
|
|
71
|
+
this.#view.setUint32(at, v >>> 0, true);
|
|
72
|
+
}
|
|
73
|
+
get length() {
|
|
74
|
+
return this.#len;
|
|
75
|
+
}
|
|
76
|
+
/** Bytes escritos (cópia) e recomeça. */
|
|
77
|
+
take() {
|
|
78
|
+
const out = this.#buf.slice(0, this.#len);
|
|
79
|
+
this.#len = 0;
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** Cor CSS → RGB (`0xRRGGBB`); `undefined` quando não dá para ler. */
|
|
84
|
+
export const parseColor = (color) => {
|
|
85
|
+
if (!color) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
const c = color.trim().toLowerCase();
|
|
89
|
+
let m = (/^#([0-9a-f]{3})$/).exec(c);
|
|
90
|
+
if (m) {
|
|
91
|
+
const [r, g, b] = [m[1][0], m[1][1], m[1][2]].map(x => parseInt(x + x, 16));
|
|
92
|
+
return (r << 16) | (g << 8) | b;
|
|
93
|
+
}
|
|
94
|
+
m = (/^#([0-9a-f]{6})$/).exec(c);
|
|
95
|
+
if (m) {
|
|
96
|
+
return parseInt(m[1], 16);
|
|
97
|
+
}
|
|
98
|
+
m = (/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/).exec(c);
|
|
99
|
+
if (m) {
|
|
100
|
+
return (Math.min(255, +m[1]) << 16) | (Math.min(255, +m[2]) << 8) | Math.min(255, +m[3]);
|
|
101
|
+
}
|
|
102
|
+
// nomes e outros formatos: o canvas normaliza (só no navegador)
|
|
103
|
+
if (typeof OffscreenCanvas !== 'undefined' || typeof document !== 'undefined') {
|
|
104
|
+
const canvas = typeof OffscreenCanvas !== 'undefined' ? new OffscreenCanvas(1, 1) : document.createElement('canvas');
|
|
105
|
+
const ctx = canvas.getContext('2d');
|
|
106
|
+
if (ctx) {
|
|
107
|
+
ctx.fillStyle = '#010203';
|
|
108
|
+
ctx.fillStyle = color;
|
|
109
|
+
const normalized = String(ctx.fillStyle);
|
|
110
|
+
if (normalized !== '#010203' || c === '#010203') {
|
|
111
|
+
return parseColor(normalized);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
};
|
|
117
|
+
const channel = (v) => {
|
|
118
|
+
const s = v / 255;
|
|
119
|
+
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
120
|
+
};
|
|
121
|
+
const luminance = (rgb) => 0.2126 * channel((rgb >> 16) & 255) + 0.7152 * channel((rgb >> 8) & 255) + 0.0722 * channel(rgb & 255);
|
|
122
|
+
/** Contraste WCAG entre duas cores. */
|
|
123
|
+
export const contrast = (a, b) => {
|
|
124
|
+
const [l1, l2] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
|
125
|
+
return (l1 + 0.05) / (l2 + 0.05);
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/export-pdf/serialize.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E;;;GAGG;AAEH,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,MAAM,OAAO,MAAM;IACjB,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACjC,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,GAAG,CAAC,CAAC;IAET,KAAK,CAAC,CAAS;QACb,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACrC,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;YAEhC,OAAO,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBAC5B,IAAI,IAAI,CAAC,CAAC;YACZ,CAAC;YAED,MAAM,IAA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AAE,EAAE;IAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IAClB,OAAO,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;AAE1I,uCAAuC;AACvC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE;IACvD,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC","sourcesContent":["/* eslint-disable no-bitwise -- protocolo binário do motor e cores 0xRRGGBB. */\n/**\n * Protocolo binário JS → motor (o mesmo de `pdf/src/input.rs`): configuração\n * e blocos de linhas, little endian, strings em UTF-8 com o tamanho antes.\n */\n\nconst encoder = new TextEncoder();\n\nexport class Writer {\n #buf = new Uint8Array(64 * 1024);\n #view = new DataView(this.#buf.buffer);\n #len = 0;\n\n #room(n: number) {\n if (this.#len + n > this.#buf.length) {\n let size = this.#buf.length * 2;\n\n while (size < this.#len + n) {\n size *= 2;\n }\n\n const next = new Uint8Array(size);\n next.set(this.#buf.subarray(0, this.#len));\n this.#buf = next;\n this.#view = new DataView(next.buffer);\n }\n }\n\n u8(v: number) {\n this.#room(1);\n this.#view.setUint8(this.#len, v);\n this.#len += 1;\n }\n\n u16(v: number) {\n this.#room(2);\n this.#view.setUint16(this.#len, v, true);\n this.#len += 2;\n }\n\n u32(v: number) {\n this.#room(4);\n this.#view.setUint32(this.#len, v >>> 0, true);\n this.#len += 4;\n }\n\n i32(v: number) {\n this.#room(4);\n this.#view.setInt32(this.#len, v, true);\n this.#len += 4;\n }\n\n f32(v: number) {\n this.#room(4);\n this.#view.setFloat32(this.#len, v, true);\n this.#len += 4;\n }\n\n str(v: string) {\n const n = v.length;\n // UTF-8 tem no máximo 3 bytes por unidade UTF-16\n this.#room(4 + n * 3);\n const buf = this.#buf;\n let p = this.#len + 4;\n let i = 0;\n\n // ASCII (o caso comum: números, datas, códigos) byte a byte, sem criar vistas\n for (; i < n; i++) {\n const c = v.charCodeAt(i);\n\n if (c >= 0x80) {\n break;\n }\n\n buf[p++] = c;\n }\n\n if (i < n) {\n p += encoder.encodeInto(i ? v.slice(i) : v, buf.subarray(p)).written;\n }\n\n this.#view.setUint32(this.#len, p - this.#len - 4, true);\n this.#len = p;\n }\n\n /** Reescreve um `u32` já escrito (o total de linhas do bloco, conhecido no fim). */\n setU32(at: number, v: number) {\n this.#view.setUint32(at, v >>> 0, true);\n }\n\n get length(): number {\n return this.#len;\n }\n\n /** Bytes escritos (cópia) e recomeça. */\n take(): Uint8Array {\n const out = this.#buf.slice(0, this.#len);\n this.#len = 0;\n return out;\n }\n}\n\n/** Cor CSS → RGB (`0xRRGGBB`); `undefined` quando não dá para ler. */\nexport const parseColor = (color: string | undefined | null): number | undefined => {\n if (!color) {\n return undefined;\n }\n\n const c = color.trim().toLowerCase();\n let m = (/^#([0-9a-f]{3})$/).exec(c);\n\n if (m) {\n const [r, g, b] = [m[1][0], m[1][1], m[1][2]].map(x => parseInt(x + x, 16));\n return (r << 16) | (g << 8) | b;\n }\n\n m = (/^#([0-9a-f]{6})$/).exec(c);\n\n if (m) {\n return parseInt(m[1], 16);\n }\n\n m = (/^rgba?\\(\\s*(\\d+)[\\s,]+(\\d+)[\\s,]+(\\d+)/).exec(c);\n\n if (m) {\n return (Math.min(255, +m[1]) << 16) | (Math.min(255, +m[2]) << 8) | Math.min(255, +m[3]);\n }\n\n // nomes e outros formatos: o canvas normaliza (só no navegador)\n if (typeof OffscreenCanvas !== 'undefined' || typeof document !== 'undefined') {\n const canvas = typeof OffscreenCanvas !== 'undefined' ? new OffscreenCanvas(1, 1) : document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n\n if (ctx) {\n ctx.fillStyle = '#010203';\n ctx.fillStyle = color;\n const normalized = String(ctx.fillStyle);\n\n if (normalized !== '#010203' || c === '#010203') {\n return parseColor(normalized);\n }\n }\n }\n\n return undefined;\n};\n\nconst channel = (v: number) => {\n const s = v / 255;\n return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;\n};\n\nconst luminance = (rgb: number) => 0.2126 * channel((rgb >> 16) & 255) + 0.7152 * channel((rgb >> 8) & 255) + 0.0722 * channel(rgb & 255);\n\n/** Contraste WCAG entre duas cores. */\nexport const contrast = (a: number, b: number): number => {\n const [l1, l2] = [luminance(a), luminance(b)].sort((x, y) => y - x);\n return (l1 + 0.05) / (l2 + 0.05);\n};\n"]}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { GridExportColumn, GridExportOptions, GridExportProgress, GridExportRow } from '../export/types.js';
|
|
2
|
+
import type { GridColumnAlignment } from '../grid-column-def.js';
|
|
3
|
+
/** A font for the PDF. Every font is embedded (subset); the order is the fallback order per character. */
|
|
4
|
+
export interface GridPdfFont {
|
|
5
|
+
/**
|
|
6
|
+
* The font file (TrueType, OpenType or a TrueType collection): bytes or a
|
|
7
|
+
* URL to fetch. The buffer is copied, never transferred or changed.
|
|
8
|
+
*/
|
|
9
|
+
source: ArrayBuffer | Uint8Array | string | URL;
|
|
10
|
+
/** Default `'normal'`. Without a bold font, bold text uses the regular one. */
|
|
11
|
+
weight?: 'normal' | 'bold';
|
|
12
|
+
/** Default `'normal'`. */
|
|
13
|
+
style?: 'normal' | 'italic';
|
|
14
|
+
}
|
|
15
|
+
/** `'table'`: one table, groups as rows. `'sections'`: one titled section per first-level group. `'list'`: a flat list (grouped columns first). */
|
|
16
|
+
export type GridPdfLayout = 'table' | 'sections' | 'list';
|
|
17
|
+
/** `'auto'`: Letter where it is the usual paper (US, CA, MX, …), A4 elsewhere. */
|
|
18
|
+
export type GridPdfPaperSize = 'auto' | 'a4' | 'letter' | 'legal' | 'a3';
|
|
19
|
+
/** `'auto'`: landscape when the columns do not fit in portrait. */
|
|
20
|
+
export type GridPdfOrientation = 'auto' | 'portrait' | 'landscape';
|
|
21
|
+
/**
|
|
22
|
+
* Colors (any CSS color) and text size of the PDF. Text colors must keep a
|
|
23
|
+
* contrast of at least 4.5:1 with every background: a color that does not is
|
|
24
|
+
* replaced by the default (with a warning).
|
|
25
|
+
*/
|
|
26
|
+
export interface GridPdfTheme {
|
|
27
|
+
/** Text size in pt. Default 8, minimum 6. */
|
|
28
|
+
fontSize?: number;
|
|
29
|
+
/** Text color (CSS). Default `#1a1a1a`. */
|
|
30
|
+
color?: string;
|
|
31
|
+
/** Background of the header row (CSS). Default `#e6e6e6`. */
|
|
32
|
+
headerBackgroundColor?: string;
|
|
33
|
+
/** Background of group rows (CSS). Default `#f0f0f0`. */
|
|
34
|
+
groupBackgroundColor?: string;
|
|
35
|
+
/** Background of every other data row when `striped` (CSS). Default `#f7f7f7`. */
|
|
36
|
+
stripedBackgroundColor?: string;
|
|
37
|
+
/** Background of group footer and totals rows (CSS). Default `#ececec`. */
|
|
38
|
+
summaryBackgroundColor?: string;
|
|
39
|
+
/** Color of the table rules (CSS). Default `#8a8a8a`. */
|
|
40
|
+
lineColor?: string;
|
|
41
|
+
}
|
|
42
|
+
/** Style of one PDF cell (`customizeCell`). */
|
|
43
|
+
export interface GridPdfCellStyle {
|
|
44
|
+
bold?: boolean;
|
|
45
|
+
italic?: boolean;
|
|
46
|
+
/** Text color (CSS). Must keep a contrast of 4.5:1 with the background. */
|
|
47
|
+
color?: string;
|
|
48
|
+
/** Background color (CSS). */
|
|
49
|
+
backgroundColor?: string;
|
|
50
|
+
/** Logical alignment of the text (`start`/`end` follow the direction). */
|
|
51
|
+
alignment?: GridColumnAlignment;
|
|
52
|
+
}
|
|
53
|
+
/** An image in a cell, above its text. Sizes in pt. */
|
|
54
|
+
export interface GridPdfImage {
|
|
55
|
+
/** The PNG or JPEG file (copied). */
|
|
56
|
+
data: Uint8Array;
|
|
57
|
+
/** Format of `data`. */
|
|
58
|
+
format: 'png' | 'jpeg';
|
|
59
|
+
/** Width in pt (shrinks to the column). */
|
|
60
|
+
width: number;
|
|
61
|
+
/** Height in pt. */
|
|
62
|
+
height: number;
|
|
63
|
+
/** Text alternative (required). `''` marks the image as decorative. */
|
|
64
|
+
alt: string;
|
|
65
|
+
}
|
|
66
|
+
/** A link on the cell text (`http:`, `https:` or `mailto:` only). */
|
|
67
|
+
export interface GridPdfLink {
|
|
68
|
+
/** Target (`http:`, `https:` or `mailto:`; others are ignored with a warning). */
|
|
69
|
+
url: string;
|
|
70
|
+
/** Accessible description of the link target when the cell text alone is not enough. */
|
|
71
|
+
description?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A cell of the PDF, passed to `customizeCell` before it is laid out: change
|
|
75
|
+
* `text`, `lang`, `style`, `image` or `link`. Called for header, data, group,
|
|
76
|
+
* group footer and totals cells (not for the title nor the line of hidden
|
|
77
|
+
* columns). Synchronous.
|
|
78
|
+
*/
|
|
79
|
+
export interface GridPdfCell<TItem = any> {
|
|
80
|
+
readonly rowType: GridExportRow['rowType'] | 'header';
|
|
81
|
+
/** The exported row (`null` in the header). */
|
|
82
|
+
readonly row: GridExportRow<TItem> | null;
|
|
83
|
+
/** The column (`null` for the label cell of a group row). */
|
|
84
|
+
readonly column: GridExportColumn<TItem> | null;
|
|
85
|
+
/** Index in `columns` (`-1` for the label cell of a group row). */
|
|
86
|
+
readonly columnIndex: number;
|
|
87
|
+
/** Cell value (in the header, the column label). */
|
|
88
|
+
readonly value: unknown;
|
|
89
|
+
/** Text drawn in the cell (wraps; never cut). */
|
|
90
|
+
text: string;
|
|
91
|
+
/** Language of the text (BCP 47) when it differs from the document. The grid does not guess languages from scripts. */
|
|
92
|
+
lang?: string;
|
|
93
|
+
/** Style of the cell (replace the object or change its fields). */
|
|
94
|
+
style: GridPdfCellStyle;
|
|
95
|
+
/** An image above the text (`alt` required). */
|
|
96
|
+
image?: GridPdfImage;
|
|
97
|
+
/** Makes the cell text a link (underlined; the PDF annotation is tagged). */
|
|
98
|
+
link?: GridPdfLink;
|
|
99
|
+
}
|
|
100
|
+
/** Progress of `exportPdf` (`onProgress`). */
|
|
101
|
+
export type GridPdfProgress = GridExportProgress;
|
|
102
|
+
/** Options of `exportPdf()`. */
|
|
103
|
+
export interface GridPdfOptions extends Omit<GridExportOptions, 'includeGroups'> {
|
|
104
|
+
/** The fonts (required, not empty), in fallback order per character. */
|
|
105
|
+
fonts: readonly GridPdfFont[];
|
|
106
|
+
/** Default `'table'`. `'sections'` without grouping is `'table'`; `'list'` is `includeGroups: false`. */
|
|
107
|
+
layout?: GridPdfLayout;
|
|
108
|
+
/** Document title (metadata, shown by the reader, and the heading of page 1). Default: the accessible name of the grid, else "Data". */
|
|
109
|
+
title?: string;
|
|
110
|
+
/** Language of the document (BCP 47). Default: the language of the grid. */
|
|
111
|
+
language?: string;
|
|
112
|
+
/** Default: the direction of the grid. `rtl` mirrors the table. */
|
|
113
|
+
direction?: 'ltr' | 'rtl';
|
|
114
|
+
/** Default `'auto'`: Letter in the US, Canada, Mexico…, A4 elsewhere (from the language region). */
|
|
115
|
+
paperSize?: GridPdfPaperSize;
|
|
116
|
+
/** Default `'auto'`: landscape when the columns do not fit in portrait. */
|
|
117
|
+
orientation?: GridPdfOrientation;
|
|
118
|
+
/** Columns that do not fit the page move to a "Label: value" line under each row (rule of `hidingPriority`). Default: `autoHideColumns` of the grid. */
|
|
119
|
+
autoHideColumns?: boolean;
|
|
120
|
+
/** Alternate row backgrounds. Default: `striped` of the grid. */
|
|
121
|
+
striped?: boolean;
|
|
122
|
+
/** Font size and colors (text colors below 4.5:1 contrast fall back to the default, with a warning). */
|
|
123
|
+
theme?: GridPdfTheme;
|
|
124
|
+
/** "Page X of Y" in the footer. Default `true`. */
|
|
125
|
+
includePageNumbers?: boolean;
|
|
126
|
+
/** Bookmarks for the first-level groups. Default `true` when the rows are grouped. */
|
|
127
|
+
bookmarks?: boolean;
|
|
128
|
+
/** Changes each cell before it is laid out (style, image, link, language); see {@link GridPdfCell}. */
|
|
129
|
+
customizeCell?: ((cell: GridPdfCell) => void) | null;
|
|
130
|
+
/** Called about every 250 ms and once at the end (never after an abort). */
|
|
131
|
+
onProgress?: ((progress: GridPdfProgress) => void) | null;
|
|
132
|
+
/**
|
|
133
|
+
* Generate in Web Workers (default `true` when `Worker` exists), on the
|
|
134
|
+
* main thread in time slices (`false`), or in the workers a factory returns
|
|
135
|
+
* (CDN, strict CSP: a Blob URL of `worker.js`). The factory is called twice
|
|
136
|
+
* per export (an engine worker and an assembler that compresses in
|
|
137
|
+
* parallel) and must return a new `Worker` each time.
|
|
138
|
+
*/
|
|
139
|
+
worker?: boolean | (() => Worker);
|
|
140
|
+
/** Where `grid-pdf.wasm` and `worker.js` are. Default: next to this module. */
|
|
141
|
+
assetsUrl?: string | URL;
|
|
142
|
+
}
|
|
143
|
+
/** Options of `downloadPdf()`. */
|
|
144
|
+
export interface GridPdfDownloadOptions extends GridPdfOptions {
|
|
145
|
+
/** Name of the downloaded file. Default `export.pdf`. */
|
|
146
|
+
fileName?: string;
|
|
147
|
+
}
|
|
148
|
+
/** Options of `createPdfExporter()`: those of `downloadPdf` without `selectedOnly` and `signal` (set by the grid). */
|
|
149
|
+
export type GridPdfExporterOptions = Omit<GridPdfDownloadOptions, 'selectedOnly' | 'signal'>;
|
|
150
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/export-pdf/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GridExportColumn, GridExportOptions, GridExportProgress, GridExportRow } from '../export/types.js';\nimport type { GridColumnAlignment } from '../grid-column-def.js';\n\n/** A font for the PDF. Every font is embedded (subset); the order is the fallback order per character. */\nexport interface GridPdfFont {\n /**\n * The font file (TrueType, OpenType or a TrueType collection): bytes or a\n * URL to fetch. The buffer is copied, never transferred or changed.\n */\n source: ArrayBuffer | Uint8Array | string | URL;\n /** Default `'normal'`. Without a bold font, bold text uses the regular one. */\n weight?: 'normal' | 'bold';\n /** Default `'normal'`. */\n style?: 'normal' | 'italic';\n}\n\n/** `'table'`: one table, groups as rows. `'sections'`: one titled section per first-level group. `'list'`: a flat list (grouped columns first). */\nexport type GridPdfLayout = 'table' | 'sections' | 'list';\n\n/** `'auto'`: Letter where it is the usual paper (US, CA, MX, …), A4 elsewhere. */\nexport type GridPdfPaperSize = 'auto' | 'a4' | 'letter' | 'legal' | 'a3';\n\n/** `'auto'`: landscape when the columns do not fit in portrait. */\nexport type GridPdfOrientation = 'auto' | 'portrait' | 'landscape';\n\n/**\n * Colors (any CSS color) and text size of the PDF. Text colors must keep a\n * contrast of at least 4.5:1 with every background: a color that does not is\n * replaced by the default (with a warning).\n */\nexport interface GridPdfTheme {\n /** Text size in pt. Default 8, minimum 6. */\n fontSize?: number;\n /** Text color (CSS). Default `#1a1a1a`. */\n color?: string;\n /** Background of the header row (CSS). Default `#e6e6e6`. */\n headerBackgroundColor?: string;\n /** Background of group rows (CSS). Default `#f0f0f0`. */\n groupBackgroundColor?: string;\n /** Background of every other data row when `striped` (CSS). Default `#f7f7f7`. */\n stripedBackgroundColor?: string;\n /** Background of group footer and totals rows (CSS). Default `#ececec`. */\n summaryBackgroundColor?: string;\n /** Color of the table rules (CSS). Default `#8a8a8a`. */\n lineColor?: string;\n}\n\n/** Style of one PDF cell (`customizeCell`). */\nexport interface GridPdfCellStyle {\n bold?: boolean;\n italic?: boolean;\n /** Text color (CSS). Must keep a contrast of 4.5:1 with the background. */\n color?: string;\n /** Background color (CSS). */\n backgroundColor?: string;\n /** Logical alignment of the text (`start`/`end` follow the direction). */\n alignment?: GridColumnAlignment;\n}\n\n/** An image in a cell, above its text. Sizes in pt. */\nexport interface GridPdfImage {\n /** The PNG or JPEG file (copied). */\n data: Uint8Array;\n /** Format of `data`. */\n format: 'png' | 'jpeg';\n /** Width in pt (shrinks to the column). */\n width: number;\n /** Height in pt. */\n height: number;\n /** Text alternative (required). `''` marks the image as decorative. */\n alt: string;\n}\n\n/** A link on the cell text (`http:`, `https:` or `mailto:` only). */\nexport interface GridPdfLink {\n /** Target (`http:`, `https:` or `mailto:`; others are ignored with a warning). */\n url: string;\n /** Accessible description of the link target when the cell text alone is not enough. */\n description?: string;\n}\n\n/**\n * A cell of the PDF, passed to `customizeCell` before it is laid out: change\n * `text`, `lang`, `style`, `image` or `link`. Called for header, data, group,\n * group footer and totals cells (not for the title nor the line of hidden\n * columns). Synchronous.\n */\nexport interface GridPdfCell<TItem = any> {\n readonly rowType: GridExportRow['rowType'] | 'header';\n /** The exported row (`null` in the header). */\n readonly row: GridExportRow<TItem> | null;\n /** The column (`null` for the label cell of a group row). */\n readonly column: GridExportColumn<TItem> | null;\n /** Index in `columns` (`-1` for the label cell of a group row). */\n readonly columnIndex: number;\n /** Cell value (in the header, the column label). */\n readonly value: unknown;\n /** Text drawn in the cell (wraps; never cut). */\n text: string;\n /** Language of the text (BCP 47) when it differs from the document. The grid does not guess languages from scripts. */\n lang?: string;\n /** Style of the cell (replace the object or change its fields). */\n style: GridPdfCellStyle;\n /** An image above the text (`alt` required). */\n image?: GridPdfImage;\n /** Makes the cell text a link (underlined; the PDF annotation is tagged). */\n link?: GridPdfLink;\n}\n\n/** Progress of `exportPdf` (`onProgress`). */\nexport type GridPdfProgress = GridExportProgress;\n\n/** Options of `exportPdf()`. */\nexport interface GridPdfOptions extends Omit<GridExportOptions, 'includeGroups'> {\n /** The fonts (required, not empty), in fallback order per character. */\n fonts: readonly GridPdfFont[];\n /** Default `'table'`. `'sections'` without grouping is `'table'`; `'list'` is `includeGroups: false`. */\n layout?: GridPdfLayout;\n /** Document title (metadata, shown by the reader, and the heading of page 1). Default: the accessible name of the grid, else \"Data\". */\n title?: string;\n /** Language of the document (BCP 47). Default: the language of the grid. */\n language?: string;\n /** Default: the direction of the grid. `rtl` mirrors the table. */\n direction?: 'ltr' | 'rtl';\n /** Default `'auto'`: Letter in the US, Canada, Mexico…, A4 elsewhere (from the language region). */\n paperSize?: GridPdfPaperSize;\n /** Default `'auto'`: landscape when the columns do not fit in portrait. */\n orientation?: GridPdfOrientation;\n /** Columns that do not fit the page move to a \"Label: value\" line under each row (rule of `hidingPriority`). Default: `autoHideColumns` of the grid. */\n autoHideColumns?: boolean;\n /** Alternate row backgrounds. Default: `striped` of the grid. */\n striped?: boolean;\n /** Font size and colors (text colors below 4.5:1 contrast fall back to the default, with a warning). */\n theme?: GridPdfTheme;\n /** \"Page X of Y\" in the footer. Default `true`. */\n includePageNumbers?: boolean;\n /** Bookmarks for the first-level groups. Default `true` when the rows are grouped. */\n bookmarks?: boolean;\n /** Changes each cell before it is laid out (style, image, link, language); see {@link GridPdfCell}. */\n customizeCell?: ((cell: GridPdfCell) => void) | null;\n /** Called about every 250 ms and once at the end (never after an abort). */\n onProgress?: ((progress: GridPdfProgress) => void) | null;\n /**\n * Generate in Web Workers (default `true` when `Worker` exists), on the\n * main thread in time slices (`false`), or in the workers a factory returns\n * (CDN, strict CSP: a Blob URL of `worker.js`). The factory is called twice\n * per export (an engine worker and an assembler that compresses in\n * parallel) and must return a new `Worker` each time.\n */\n worker?: boolean | (() => Worker);\n /** Where `grid-pdf.wasm` and `worker.js` are. Default: next to this module. */\n assetsUrl?: string | URL;\n}\n\n/** Options of `downloadPdf()`. */\nexport interface GridPdfDownloadOptions extends GridPdfOptions {\n /** Name of the downloaded file. Default `export.pdf`. */\n fileName?: string;\n}\n\n/** Options of `createPdfExporter()`: those of `downloadPdf` without `selectedOnly` and `signal` (set by the grid). */\nexport type GridPdfExporterOptions = Omit<GridPdfDownloadOptions, 'selectedOnly' | 'signal'>;\n"]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Assembler, Engine, EngineError } from './engine.js';
|
|
2
|
+
const scope = self;
|
|
3
|
+
let engine = null;
|
|
4
|
+
let assembler = null;
|
|
5
|
+
const reply = (message, transfer = []) => scope.postMessage(message, transfer);
|
|
6
|
+
const chunks = (e) => e.takeChunks().map(c => c.buffer);
|
|
7
|
+
scope.onmessage = async (event) => {
|
|
8
|
+
const r = event.data;
|
|
9
|
+
try {
|
|
10
|
+
switch (r.op) {
|
|
11
|
+
case 'init': {
|
|
12
|
+
const exports = (await WebAssembly.instantiate(r.module, {})).exports;
|
|
13
|
+
if (r.role === 'assembler') {
|
|
14
|
+
assembler = new Assembler(exports);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
engine = new Engine(exports, r.deferred);
|
|
18
|
+
}
|
|
19
|
+
reply({ id: r.id, ok: true });
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case 'segments': {
|
|
23
|
+
const a = assembler;
|
|
24
|
+
let done = false;
|
|
25
|
+
for (const data of r.data) {
|
|
26
|
+
done = a.push(new Uint8Array(data));
|
|
27
|
+
}
|
|
28
|
+
const out = chunks(a);
|
|
29
|
+
reply({ id: r.id, ok: true, chunks: out, done }, out);
|
|
30
|
+
if (done) {
|
|
31
|
+
a.dispose();
|
|
32
|
+
assembler = null;
|
|
33
|
+
}
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case 'font':
|
|
37
|
+
engine.addFont(new Uint8Array(r.bytes), r.bold, r.italic);
|
|
38
|
+
reply({ id: r.id, ok: true });
|
|
39
|
+
break;
|
|
40
|
+
case 'begin':
|
|
41
|
+
engine.begin(new Uint8Array(r.config));
|
|
42
|
+
reply({ id: r.id, ok: true });
|
|
43
|
+
break;
|
|
44
|
+
case 'image':
|
|
45
|
+
reply({ id: r.id, ok: true, value: engine.addImage(new Uint8Array(r.bytes), r.format, r.width, r.height) });
|
|
46
|
+
break;
|
|
47
|
+
case 'rows': {
|
|
48
|
+
const e = engine;
|
|
49
|
+
e.pushRows(new Uint8Array(r.data));
|
|
50
|
+
if (r.last) {
|
|
51
|
+
e.endInput();
|
|
52
|
+
}
|
|
53
|
+
let done = false;
|
|
54
|
+
do {
|
|
55
|
+
done = e.layout(20);
|
|
56
|
+
} while (!done && e.pendingRows > 0);
|
|
57
|
+
const out = chunks(e);
|
|
58
|
+
reply({ id: r.id, ok: true, chunks: out, pages: e.pageCount, done }, out);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
case 'finish': {
|
|
62
|
+
const e = engine;
|
|
63
|
+
e.finish();
|
|
64
|
+
const out = chunks(e);
|
|
65
|
+
reply({ id: r.id, ok: true, chunks: out }, out);
|
|
66
|
+
e.dispose();
|
|
67
|
+
engine = null;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
reply({
|
|
74
|
+
id: r.id,
|
|
75
|
+
ok: false,
|
|
76
|
+
code: error instanceof EngineError ? error.code : -1,
|
|
77
|
+
message: error instanceof Error ? error.message : String(error),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/export-pdf/worker.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AAO3E,MAAM,KAAK,GAAG,I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CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAChE,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC","sourcesContent":["/**\n * Web Worker da exportação PDF, em um de dois papéis: o motor (fontes,\n * configuração, imagens e blocos de linhas → segmentos do arquivo) ou o\n * montador (segmentos → blocos do arquivo comprimido).\n */\nimport type { WorkerRequest, WorkerResponse } from './client.js';\nimport { Assembler, Engine, EngineError, type Exports } from './engine.js';\n\ninterface WorkerScope {\n onmessage: ((event: MessageEvent<WorkerRequest>) => void) | null;\n postMessage(message: WorkerResponse, transfer?: Transferable[]): void;\n}\n\nconst scope = self as unknown as WorkerScope;\nlet engine: Engine | null = null;\nlet assembler: Assembler | null = null;\n\nconst reply = (message: WorkerResponse, transfer: Transferable[] = []) => scope.postMessage(message, transfer);\n\nconst chunks = (e: Engine | Assembler): ArrayBuffer[] => e.takeChunks().map(c => c.buffer as ArrayBuffer);\n\nscope.onmessage = async (event: MessageEvent<WorkerRequest>) => {\n const r = event.data;\n\n try {\n switch (r.op) {\n case 'init': {\n const exports = (await WebAssembly.instantiate(r.module, {})).exports as unknown as Exports;\n\n if (r.role === 'assembler') {\n assembler = new Assembler(exports);\n } else {\n engine = new Engine(exports, r.deferred);\n }\n\n reply({ id: r.id, ok: true });\n break;\n }\n\n case 'segments': {\n const a = assembler!;\n let done = false;\n\n for (const data of r.data) {\n done = a.push(new Uint8Array(data));\n }\n\n const out = chunks(a);\n reply({ id: r.id, ok: true, chunks: out, done }, out);\n\n if (done) {\n a.dispose();\n assembler = null;\n }\n\n break;\n }\n\n case 'font':\n engine!.addFont(new Uint8Array(r.bytes), r.bold, r.italic);\n reply({ id: r.id, ok: true });\n break;\n\n case 'begin':\n engine!.begin(new Uint8Array(r.config));\n reply({ id: r.id, ok: true });\n break;\n\n case 'image':\n reply({ id: r.id, ok: true, value: engine!.addImage(new Uint8Array(r.bytes), r.format, r.width, r.height) });\n break;\n\n case 'rows': {\n const e = engine!;\n e.pushRows(new Uint8Array(r.data));\n\n if (r.last) {\n e.endInput();\n }\n\n let done = false;\n\n do {\n done = e.layout(20);\n } while (!done && e.pendingRows > 0);\n\n const out = chunks(e);\n reply({ id: r.id, ok: true, chunks: out, pages: e.pageCount, done }, out);\n break;\n }\n\n case 'finish': {\n const e = engine!;\n e.finish();\n const out = chunks(e);\n reply({ id: r.id, ok: true, chunks: out }, out);\n e.dispose();\n engine = null;\n break;\n }\n }\n } catch (error) {\n reply({\n id: r.id,\n ok: false,\n code: error instanceof EngineError ? error.code : -1,\n message: error instanceof Error ? error.message : String(error),\n });\n }\n};\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatos do Excel (`numFmt`) a partir das opções `Intl` da coluna — interno
|
|
3
|
+
* do adaptador `export-xlsx` (não é exportado pela entrada do pacote).
|
|
4
|
+
*/
|
|
5
|
+
import type { GridColumnDataType } from '../grid-column-def.js';
|
|
6
|
+
/**
|
|
7
|
+
* `numFmt` próximo das opções `Intl` da coluna: casas decimais, milhar,
|
|
8
|
+
* porcentagem e símbolo da moeda. Com casas opcionais (padrão do grid: até
|
|
9
|
+
* 20 casas, sem milhar) fica `General`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const numberFormatOf: (format: Intl.NumberFormatOptions | null | undefined, language: string | undefined) => string | undefined;
|
|
12
|
+
/** Padrão de data do Excel na ordem do idioma (`dd/mm/yyyy`, `m/d/yyyy`…); `datetime` com hora. */
|
|
13
|
+
export declare const datePatternOf: (dataType: GridColumnDataType, language: string | undefined) => string;
|
|
14
|
+
//# sourceMappingURL=formats.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { getDateTimeFormat, getNumberFormat } from '../row-model/format.js';
|
|
2
|
+
/**
|
|
3
|
+
* `numFmt` próximo das opções `Intl` da coluna: casas decimais, milhar,
|
|
4
|
+
* porcentagem e símbolo da moeda. Com casas opcionais (padrão do grid: até
|
|
5
|
+
* 20 casas, sem milhar) fica `General`.
|
|
6
|
+
*/
|
|
7
|
+
export const numberFormatOf = (format, language) => {
|
|
8
|
+
const formatter = getNumberFormat(language, format ?? undefined);
|
|
9
|
+
const options = formatter.resolvedOptions();
|
|
10
|
+
const min = options.minimumFractionDigits ?? 0;
|
|
11
|
+
const max = options.maximumFractionDigits ?? min;
|
|
12
|
+
// Casas opcionais (`0.##`) deixam "5." no Excel: melhor o `General`.
|
|
13
|
+
if (min === 0 && max > 0 && options.style !== 'percent' && options.style !== 'currency') {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const decimals = '0'.repeat(min) + '#'.repeat(Math.max(max - min, 0));
|
|
17
|
+
const integer = options.useGrouping ? '#,##0' : '0';
|
|
18
|
+
let body = decimals ? `${integer}.${decimals}` : integer;
|
|
19
|
+
if (options.style === 'percent') {
|
|
20
|
+
body += '%';
|
|
21
|
+
}
|
|
22
|
+
else if (options.style === 'currency') {
|
|
23
|
+
const parts = formatter.formatToParts(1);
|
|
24
|
+
const symbol = parts.find(part => part.type === 'currency')?.value ?? '';
|
|
25
|
+
const before = parts.findIndex(part => part.type === 'currency') < parts.findIndex(part => part.type === 'integer');
|
|
26
|
+
const quoted = `"${symbol.replaceAll('"', '')}"`;
|
|
27
|
+
body = before ? `${quoted}${body}` : `${body} ${quoted}`;
|
|
28
|
+
}
|
|
29
|
+
return body;
|
|
30
|
+
};
|
|
31
|
+
/** Padrão de data do Excel na ordem do idioma (`dd/mm/yyyy`, `m/d/yyyy`…); `datetime` com hora. */
|
|
32
|
+
export const datePatternOf = (dataType, language) => {
|
|
33
|
+
const parts = getDateTimeFormat(language, { year: 'numeric', month: '2-digit', day: '2-digit' }).formatToParts(new Date(2024, 10, 22));
|
|
34
|
+
const tokens = { year: 'yyyy', month: 'mm', day: 'dd' };
|
|
35
|
+
const date = parts
|
|
36
|
+
.map(part => tokens[part.type] ?? (part.type === 'literal' ? part.value.replace(/[^\s/.\-,]/g, '') : ''))
|
|
37
|
+
.join('');
|
|
38
|
+
return dataType === 'datetime' ? `${date} hh:mm` : date;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=formats.js.map
|