@tectra-ng/ui 0.1.2 → 0.1.3

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 (52) hide show
  1. package/README.md +36 -19
  2. package/analog-clock/README.md +31 -0
  3. package/countdown/README.md +45 -0
  4. package/datepicker/README.md +109 -0
  5. package/export/README.md +79 -0
  6. package/export-font/OFL.txt +93 -0
  7. package/export-font/README.md +7 -0
  8. package/fesm2022/tectra-ng-ui-analog-clock.mjs +386 -0
  9. package/fesm2022/tectra-ng-ui-analog-clock.mjs.map +1 -0
  10. package/fesm2022/tectra-ng-ui-countdown.mjs +513 -0
  11. package/fesm2022/tectra-ng-ui-countdown.mjs.map +1 -0
  12. package/fesm2022/tectra-ng-ui-datepicker.mjs +2640 -0
  13. package/fesm2022/tectra-ng-ui-datepicker.mjs.map +1 -0
  14. package/fesm2022/tectra-ng-ui-export-font.mjs +7 -0
  15. package/fesm2022/tectra-ng-ui-export-font.mjs.map +1 -0
  16. package/fesm2022/tectra-ng-ui-export.mjs +2574 -0
  17. package/fesm2022/tectra-ng-ui-export.mjs.map +1 -0
  18. package/fesm2022/tectra-ng-ui-label.mjs +4 -4
  19. package/fesm2022/tectra-ng-ui-label.mjs.map +1 -1
  20. package/fesm2022/tectra-ng-ui-month-calendar.mjs +601 -0
  21. package/fesm2022/tectra-ng-ui-month-calendar.mjs.map +1 -0
  22. package/fesm2022/tectra-ng-ui-sparkline.mjs +240 -0
  23. package/fesm2022/tectra-ng-ui-sparkline.mjs.map +1 -0
  24. package/fesm2022/tectra-ng-ui-stat-tiles.mjs +661 -0
  25. package/fesm2022/tectra-ng-ui-stat-tiles.mjs.map +1 -0
  26. package/fesm2022/tectra-ng-ui-table.mjs +1 -21
  27. package/fesm2022/tectra-ng-ui-table.mjs.map +1 -1
  28. package/fesm2022/tectra-ng-ui-timeline.mjs +407 -0
  29. package/fesm2022/tectra-ng-ui-timeline.mjs.map +1 -0
  30. package/month-calendar/README.md +46 -0
  31. package/package.json +40 -4
  32. package/sparkline/README.md +27 -0
  33. package/stat-tiles/README.md +53 -0
  34. package/timeline/README.md +42 -0
  35. package/types/tectra-ng-ui-analog-clock.d.ts +127 -0
  36. package/types/tectra-ng-ui-analog-clock.d.ts.map +1 -0
  37. package/types/tectra-ng-ui-countdown.d.ts +150 -0
  38. package/types/tectra-ng-ui-countdown.d.ts.map +1 -0
  39. package/types/tectra-ng-ui-datepicker.d.ts +801 -0
  40. package/types/tectra-ng-ui-datepicker.d.ts.map +1 -0
  41. package/types/tectra-ng-ui-export-font.d.ts +5 -0
  42. package/types/tectra-ng-ui-export-font.d.ts.map +1 -0
  43. package/types/tectra-ng-ui-export.d.ts +427 -0
  44. package/types/tectra-ng-ui-export.d.ts.map +1 -0
  45. package/types/tectra-ng-ui-month-calendar.d.ts +287 -0
  46. package/types/tectra-ng-ui-month-calendar.d.ts.map +1 -0
  47. package/types/tectra-ng-ui-sparkline.d.ts +80 -0
  48. package/types/tectra-ng-ui-sparkline.d.ts.map +1 -0
  49. package/types/tectra-ng-ui-stat-tiles.d.ts +287 -0
  50. package/types/tectra-ng-ui-stat-tiles.d.ts.map +1 -0
  51. package/types/tectra-ng-ui-timeline.d.ts +129 -0
  52. package/types/tectra-ng-ui-timeline.d.ts.map +1 -0
package/README.md CHANGED
@@ -1,27 +1,44 @@
1
1
  # @tectra-ng/ui
2
2
 
3
- ONE npm package, one entry point per component: `import { TxSelect } from '@tectra-ng/ui/select'` — only the select lands in the bundle.
3
+ Angular components of tectra — standalone, signals, OnPush, accessible, themable with design tokens. One npm package, one entry point per component: `import { TxSelect } from '@tectra-ng/ui/select'` puts only the select into the bundle.
4
4
 
5
- Every component folder looks the same (see `select/`):
5
+ ```bash
6
+ npm i @tectra-ng/ui
7
+ ```
8
+
9
+ `@tectra-ng/core`, `@tectra-ng/themes`, `@tectra-ng/tokens` and `@tectra-ng/icons` come with it as peer dependencies; `@angular/cdk`, `@angular/forms` and `@angular/common` are needed too, `@angular/router` only for router links.
6
10
 
11
+ ```ts
12
+ // app.config.ts
13
+ import { provideTectra } from '@tectra-ng/core/config';
14
+ import { Tectra } from '@tectra-ng/themes';
15
+
16
+ export const appConfig = { providers: [provideTectra({ preset: Tectra })] };
7
17
  ```
8
- select/
9
- src/
10
- select.component.ts|html|scss the component (styles use only --tx-* variables)
11
- select.component.spec.ts unit tests
12
- select-option.directive.ts template slots (#option, #empty, …)
13
- select.tokens.ts component tokens → docs "Theming" tab
14
- select.types.ts public types
15
- index.ts public API of the entry point
16
- ng-package.json makes it @tectra-ng/ui/select
17
- README.md descriptions → docs "API" tab
18
+
19
+ ```ts
20
+ import { TxButton } from '@tectra-ng/ui/button';
21
+ import { TxDatePicker } from '@tectra-ng/ui/datepicker';
18
22
  ```
19
23
 
20
- Planned (~70): button, input, textarea, checkbox, radio, switch, input-number, input-mask, input-otp, password, slider, rating,
21
- tooltip, popover, dialog, drawer, toast, menu, context-menu, confirm-popup,
22
- select, multiselect, autocomplete, listbox, tree-select, chips, color-picker,
23
- paginator, table, tree, tree-table, data-view, virtual-scroller, timeline,
24
- datepicker, tabs, accordion, stepper, breadcrumb, menubar, splitter, card, toolbar, divider,
25
- file-upload, image, carousel, avatar, badge, tag, progress, skeleton, spinner, editor …
24
+ Every component takes `dt` (design tokens of this instance), `pt` / `ptOptions` (classes and styles of its parts) and `unstyled`; form fields work with reactive forms, `ngModel` and signal forms. Docs, examples and the API of each entry point: [tectra-ng.com](https://tectra-ng.com).
25
+
26
+ ## Entry points
27
+
28
+ | Group | `@tectra-ng/ui/…` |
29
+ |---|---|
30
+ | Form | `autocomplete`, `cascade-select`, `checkbox`, `chips-input`, `color-picker`, `country-select`, `datepicker`, `email-suggestion`, `field`, `icon-field`, `input`, `input-group`, `input-mask`, `input-number`, `input-otp`, `key-filter`, `knob`, `label`, `listbox`, `mention-textarea`, `multiselect`, `password`, `password-generator`, `radio-button`, `rating`, `select`, `slider`, `textarea`, `toggle-button`, `toggle-switch`, `tree-select` |
31
+ | Actions | `button`, `button-group`, `speed-dial`, `split-button` |
32
+ | Data | `data-view`, `export`, `month-calendar`, `paginator`, `sparkline`, `stat-tiles`, `table`, `timeline`, `tree`, `tree-table`, `virtual-scroller` |
33
+ | Overlay | `confirm`, `dialog`, `drawer`, `menu`, `popover`, `toast`, `tooltip` |
34
+ | Display | `amount`, `avatar`, `badge`, `chip`, `country`, `highlight-text`, `link`, `overlay-badge`, `pill`, `status-icon`, `tag` |
35
+ | Feedback | `message`, `progress-bar`, `progress-spinner`, `skeleton` |
36
+ | Layout | `card`, `divider`, `fieldset`, `panel` |
37
+ | Misc | `analog-clock`, `countdown` |
38
+ | Assets | `export-font` — Onest (SIL Open Font License, see `export-font/OFL.txt`) for PDF export, loaded by `@tectra-ng/ui/export` on the first PDF export |
39
+
40
+ Each entry point has its own `README.md` with the inputs, outputs, slots and keyboard map.
41
+
42
+ ## License
26
43
 
27
- Depends on: `@tectra-ng/core`, `@tectra-ng/icons`.
44
+ MIT. The Onest font in `export-font` is © The Onest Project Authors, SIL Open Font License 1.1.
@@ -0,0 +1,31 @@
1
+ # Analog clock
2
+
3
+ A clock face with hour and minute hands (and an optional second hand) that shows the time of an IANA time zone — for "local time of the client / office" blocks. The `txAnalogClockHands` pipe gives the same time as `HH:mm` and the hand angles for an own display.
4
+
5
+ ```html
6
+ <tx-analog-clock timezone="Europe/Kyiv" ariaLabel="Kyiv office" />
7
+ ```
8
+
9
+ ## Inputs
10
+ | Name | Description |
11
+ |---|---|
12
+ | timezone | IANA time zone such as `Europe/Kyiv`; empty or unknown is the local time |
13
+ | time | A fixed time (`Date` or ms) instead of the running clock |
14
+ | showSeconds | Adds a second hand; the clock then updates every second instead of every minute |
15
+ | ariaLabel | Text before the time in the accessible name, e.g. the city |
16
+ | dt | Design tokens of this instance (`analogClock`) |
17
+ | pt | Classes and styles of the parts: `root`, `face`, `tick`, `hourHand`, `minuteHand`, `secondHand`, `pin` |
18
+ | ptOptions | How `pt` merges with the global pass-through |
19
+ | unstyled | Removes the tectra styles |
20
+
21
+ ## Keyboard
22
+ | Key | Action |
23
+ |---|---|
24
+ | — | Not focusable |
25
+
26
+ ## Notes
27
+
28
+ - The face is `role="img"` named by the time (`14:30`, after `ariaLabel` when set).
29
+ - Hands turn with a soft spring and always forward — from :59 to :00 they go on, not back around the face; with reduced motion they jump.
30
+ - The clock updates at the start of each minute (or second), so it stays exact without polling.
31
+ - `txAnalogClockHands` (pipe) and `clockHands(ms, timezone)` return `{ time, hourAngle, minuteAngle, secondAngle }`.
@@ -0,0 +1,45 @@
1
+ # Countdown
2
+
3
+ Counts down to zero — a number of seconds, minutes, hours or days, or the time left to a date — and fires `completed` once at zero. For "redirect in 5 s", "auto-apply in 30 s", "offer ends in 02:14:09" or "3 days left". The `txRemainingTime` pipe formats any remaining milliseconds the same way.
4
+
5
+ ```html
6
+ <tx-countdown [value]="5" unit="seconds" suffix="s" (completed)="redirect()" />
7
+ <tx-countdown [target]="offerEndsAt" [endingSoon]="60000" />
8
+ ```
9
+
10
+ ## Inputs
11
+ | Name | Description |
12
+ |---|---|
13
+ | value | Number of `unit`s to count down from; a new value starts again |
14
+ | unit | `seconds`, `minutes`, `hours` or `days` |
15
+ | target | A date (`Date`, ISO string or ms) to count down to, instead of `value` |
16
+ | suffix | Text after the value, e.g. `s` or a translated unit |
17
+ | format | `number` — whole units left (default with `value`), `clock` — `mm:ss` or `h:mm:ss` (default with `target`) |
18
+ | endingSoon | Milliseconds before zero when the countdown turns to the "ending" colour (`tx-countdown--ending`); `0` never |
19
+ | paused | Stops the countdown and keeps the time left; it goes on from there |
20
+ | ariaLive | `off` (default — a ticking timer would talk every second), `polite` or `assertive` |
21
+ | dt | Design tokens of this instance (`countdown`) |
22
+ | pt | Classes and styles of the root |
23
+ | ptOptions | How `pt` merges with the global pass-through |
24
+ | unstyled | Removes the tectra styles |
25
+
26
+ ## Outputs
27
+ | Name | Description |
28
+ |---|---|
29
+ | completed | Zero was reached; fires once per start |
30
+ | tick | The time left in milliseconds, whenever the shown value changes |
31
+
32
+ ## Slots
33
+ | Name | Description |
34
+ |---|---|
35
+ | txCountdownValue | `<ng-template txCountdownValue let-ms let-days="days" let-hours="hours" let-minutes="minutes" let-seconds="seconds" let-expired="expired">` — own display |
36
+
37
+ ## Keyboard
38
+ | Key | Action |
39
+ |---|---|
40
+ | — | Not focusable |
41
+
42
+ ## Notes
43
+
44
+ - The countdown is a `role="timer"` region. It follows the clock, not the number of ticks, so a background tab or a slow device does not make it drift; it updates only when the shown value changes (every second for `clock`, every unit for `number`).
45
+ - `txRemainingTime` (pipe) and `formatRemaining(ms)` give `mm:ss` below an hour and `h:mm:ss` above; `splitRemaining(ms)` gives days, hours, minutes and seconds.
@@ -0,0 +1,109 @@
1
+ # Date picker
2
+
3
+ A date field with a calendar panel — one date, several dates or a range, with or without time, typed or picked, in a popup, a touch dialog or inline. Works with `formControl`, `ngModel` and signal forms.
4
+
5
+ ```html
6
+ <tx-datepicker [formControl]="period" selectionMode="range" dateFormat="dd.mm.yy" [showIcon]="true" [showClear]="true" placeholder="Period" />
7
+ ```
8
+
9
+ ## Inputs
10
+ | Name | Description |
11
+ |---|---|
12
+ | selectionMode | `single`, `multiple` or `range` (the value is `[start, end]`, `end` is `null` until picked; while the end is not picked, the days up to the hovered or focused day are highlighted) |
13
+ | dateFormat | Format of the field: `d` / `dd` day, `o` / `oo` day of the year, `D` / `DD` weekday name, `m` / `mm` month, `M` / `MM` month name, `y` / `yy` year, `@` Unix ms, `!` ticks, `'text'` literal; locale default (`mm/dd/yy` us, `dd.mm.yy` ua) |
14
+ | placeholder | Text of the empty field |
15
+ | inputId | Id of the input, for an outside `<label for>` |
16
+ | name | Name of the input |
17
+ | ariaLabel | Accessible name of the field and the panel |
18
+ | ariaLabelledBy | Id of the element that names the field |
19
+ | iconAriaLabel | Accessible name of the icon button; "Choose date" by default |
20
+ | inline | Shows the calendar in place, without a field |
21
+ | showIcon | Shows the calendar icon |
22
+ | iconDisplay | `button` — a button joined to the field, `input` — an icon inside the field |
23
+ | icon | Icon name |
24
+ | showClear | Shows a clear button in the field when it has a value |
25
+ | showButtonBar | Today and Clear buttons under the calendar |
26
+ | showOtherMonths | Shows days of the previous / next month |
27
+ | selectOtherMonths | Lets those days be picked; on by default (off in PrimeNG) |
28
+ | showWeek | Week numbers (ISO) |
29
+ | startWeekFromFirstDayOfYear | Counts week 1 from January 1 |
30
+ | showTime | Hours and minutes under the calendar |
31
+ | timeOnly | Only the time picker |
32
+ | hourFormat | `24` or `12` (with AM / PM) |
33
+ | showSeconds | Seconds in the time picker |
34
+ | stepHour | Hours per click |
35
+ | stepMinute | Minutes per click |
36
+ | stepSecond | Seconds per click |
37
+ | timeSeparator | Between hours, minutes and seconds; `:` by default |
38
+ | view | `date`, `month` (pick a month) or `year` (pick a year) |
39
+ | numberOfMonths | Months side by side |
40
+ | responsiveOptions | `[{ breakpoint: '768px', numberOfMonths: 1 }]` — fewer months on narrow screens |
41
+ | firstDayOfWeek | 0 Sunday … 6 Saturday; locale default |
42
+ | minDate | Earliest date |
43
+ | maxDate | Latest date |
44
+ | disabledDates | Dates that cannot be picked |
45
+ | disabledDays | Weekdays that cannot be picked (0 Sunday … 6 Saturday) |
46
+ | maxDateCount | Most dates in `multiple` mode |
47
+ | defaultDate | Month shown and time used while there is no value |
48
+ | readonlyInput | The field takes no typing, only the calendar |
49
+ | keepInvalid | Keeps text that is not a valid date after blur |
50
+ | hideOnDateTimeSelect | Closes the panel once the date (or the range end) is picked; not with time |
51
+ | showOnFocus | Opens the panel when the field gets focus or a click |
52
+ | touchUI | Opens the calendar as a centred dialog with a mask, for touch screens |
53
+ | dataType | `date` — `Date` values, `string` — strings in `dateFormat` |
54
+ | multipleSeparator | Between dates in `multiple` mode; `,` |
55
+ | rangeSeparator | Between the start and the end; `-` |
56
+ | shortYearCutoff | Two-digit years up to this one are this century (`+10` = ten years ahead) |
57
+ | size | `small`, `medium` or `large` |
58
+ | variant | `outlined` or `filled` |
59
+ | fluid | Takes the full width (also inside `<tx-fluid>`) |
60
+ | invalid | Marks the field invalid; also taken from the form control |
61
+ | disabled | Disables the field |
62
+ | readonly | Shows the value without changes |
63
+ | required | Sets `required` on the input |
64
+ | dt | Design tokens of this instance (`datePicker`) |
65
+ | pt | Classes and styles of the parts: `root`, `input`, `dropdown`, `inputIcon`, `clear`, `panel`, `header`, `title`, `previous`, `next`, `selectMonth`, `selectYear`, `calendar`, `table`, `weekday`, `weekNumber`, `day`, `monthView`, `month`, `yearView`, `year`, `timePicker`, `buttonbar` |
66
+ | ptOptions | How `pt` merges with the global pass-through |
67
+ | unstyled | Removes the tectra styles |
68
+
69
+ ## Outputs
70
+ | Name | Description |
71
+ |---|---|
72
+ | selected | A date was picked in the calendar |
73
+ | cleared | The value was cleared |
74
+ | todayClicked | The Today button was clicked |
75
+ | clearClicked | The Clear button was clicked |
76
+ | monthChange | The calendar moved to another month: `{ month, year }` (month 1–12) |
77
+ | yearChange | The calendar moved to another year |
78
+ | opened | The panel opened |
79
+ | closed | The panel closed |
80
+ | focused | The field got focus |
81
+ | blurred | The field lost focus |
82
+ | typed | The text in the field changed |
83
+
84
+ ## Slots
85
+ | Name | Description |
86
+ |---|---|
87
+ | txDatePickerDate | `<ng-template txDatePickerDate let-day let-selected="selected">` — content of a day: `day`, `month`, `year`, `today`, `otherMonth`, `selectable` |
88
+ | txDatePickerHeader | `<ng-template txDatePickerHeader>` — content above the calendar |
89
+ | txDatePickerFooter | `<ng-template txDatePickerFooter>` — content under the calendar |
90
+ | txDatePickerDecade | `<ng-template txDatePickerDecade let-years>` — title of the year view |
91
+ | txDatePickerButtonBar | `<ng-template txDatePickerButtonBar let-today="today" let-clear="clear">` — own button bar |
92
+ | txDatePickerTriggerIcon | `<ng-template txDatePickerTriggerIcon>` — content of the icon button |
93
+ | txDatePickerInputIcon | `<ng-template txDatePickerInputIcon let-toggle>` — icon inside the field |
94
+
95
+ ## Keyboard
96
+ | Key | Action |
97
+ |---|---|
98
+ | ArrowDown / Alt + ArrowDown | Field — opens the panel and moves focus to the date |
99
+ | Enter | Field — applies the typed text and closes the panel |
100
+ | Escape | Closes the panel and returns to the field |
101
+ | Tab | Field — applies the text, closes the panel and moves on; panel — moves between its buttons and the grid (focus stays in the panel) |
102
+ | Arrow keys | Grid — previous / next day or week; month and year views — previous / next item or row |
103
+ | Home / End | First / last day of the week |
104
+ | PageUp / PageDown | Previous / next month; with Shift — year |
105
+ | Enter / Space | Picks the focused day, month or year |
106
+
107
+ ## Accessibility
108
+
109
+ The field is a `combobox` with `aria-haspopup="dialog"`; the panel is a `dialog` (`aria-modal`) with a focus trap, or a `group` when inline. Days are a `grid` with one focusable cell (roving focus), full date names, `aria-selected` for the picked dates and the range, `aria-disabled`, `aria-current="date"` for today. A picked date is announced. Previous / next, month, year and time buttons are labelled in the current locale.
@@ -0,0 +1,79 @@
1
+ # Export
2
+
3
+ Saves rows as a file in the browser — CSV, Excel (`.xlsx`), Word (`.docx`), PDF, JSON, HTML, Markdown — copies them as a table or prints them, without any third-party library. The Excel and Word files are written by the kit itself (zip + Office XML); the PDF embeds only the glyphs it uses from the Onest font (Latin and Cyrillic, loaded from `@tectra-ng/ui/export-font` on the first PDF export), so its text is real and searchable.
4
+
5
+ Each format has its own icon button — `<tx-export-csv>`, `<tx-export-excel>`, `<tx-export-word>`, `<tx-export-pdf>`, or `<tx-export-button format="…">` for any of them — and `<tx-export>` is one "Export" split button with a menu of formats. They all take the same `fields`, `data` / `fetchData` and `options`.
6
+
7
+ ```html
8
+ <tx-export-excel [data]="users()" [fields]="exportFields" filename="users" />
9
+ <tx-export [fields]="exportFields" [fetchData]="loadAllUsers" title="Users" />
10
+ ```
11
+
12
+ ```ts
13
+ exportFields: TxExportField<User>[] = [
14
+ { field: 'number', title: '#', width: 6 },
15
+ { field: 'name', title: 'Name', width: 28 },
16
+ { field: 'balance', title: 'Balance', type: 'number', format: '#,##0.00' },
17
+ { field: 'createdAt', title: 'Created', type: 'date' },
18
+ { field: 'notes', title: 'Notes', formats: ['excel', 'csv'] },
19
+ ];
20
+ ```
21
+
22
+ ## Inputs
23
+ | Name | Description |
24
+ |---|---|
25
+ | data | Rows to export; two-way, replaced by the result of `fetchData` |
26
+ | fields | Columns in order (`TxExportField`): `field` (a key or a path like `team.title`), `title`, `aggregator(value, row, index)`, `type` (`text`, `number`, `date`, `datetime`, `boolean`; guessed from the values), `width` (in characters, all formats), `align` (`start`, `center`, `end`), `format` (Excel number format such as `#,##0.00` or `dd.mm.yyyy`), `formats` (only in these formats). A `number` or `place` field without an aggregator gets the row number |
27
+ | fetchData | `() => Promise<rows \| null>` called on click before the export, e.g. to load every page from the server; `null` cancels |
28
+ | options | `TxExportOptions` — `filename`, `title`, `subtitle`, `showDate`, `locale` and one object per format: `csv`, `excel`, `word`, `pdf`, `json`, `html`, `markdown`, `copy`, `print` (see below); merged over `provideTxExport()` |
29
+ | filename | File name, with or without the extension; `ExportedData` by default |
30
+ | title | Title of the PDF, Word, HTML and printed documents and of the Excel file |
31
+ | format | `tx-export-button` — `csv`, `excel`, `word`, `pdf`, `json`, `html`, `markdown`, `copy` or `print` |
32
+ | formats | `tx-export` — formats in the menu, in order; the main button runs the first one |
33
+ | loading | Shows the spinner; the button also spins by itself while an export runs |
34
+ | disabled | Disables the button |
35
+ | label | Text of the button; empty shows an icon-only button named by the tooltip (`tx-export` shows "Export") |
36
+ | tooltip | Own tooltip; defaults to the translated "Export to CSV", "Copy table"… |
37
+ | severity | Button severity |
38
+ | variant | Button variant: `outlined`, `text` or `link` |
39
+ | size | Button size |
40
+ | pt | Classes and styles of the parts: `root`, `button` |
41
+ | ptOptions | How `pt` merges with the global pass-through |
42
+ | unstyled | Removes the tectra styles of the button |
43
+
44
+ ## Outputs
45
+ | Name | Description |
46
+ |---|---|
47
+ | exported | Done: `{ format, filename, rows, data }` (`filename` is `null` for copy and print) |
48
+ | failed | `fetchData`, the writer or the clipboard threw; the button is ready for the next click |
49
+ | dataChange | The rows changed after `fetchData` |
50
+
51
+ ## Keyboard
52
+ | Key | Action |
53
+ |---|---|
54
+ | Enter / Space | Runs the export of the focused button |
55
+ | Alt + ArrowDown | `tx-export` — opens the menu of formats (see split button) |
56
+
57
+ ## Options per format
58
+
59
+ | Format | Options |
60
+ |---|---|
61
+ | csv | `separator` (`,`), `bom` (true — spreadsheet apps read non-Latin text), `lineEnding` (`\r\n`), `header`, `quoteAll`, `formulaGuard` (true — cells starting with `=`, `+`, `-`, `@` get a leading `'`; signed numbers stay) |
62
+ | excel | `sheetName`, `header`, `freezeHeader`, `autoFilter`, `autoWidth`, `minWidth` / `maxWidth` (characters), `headerBold`, `headerBackground` / `headerColor` (hex or `none`), `wrapText`, `numberFormat`, `dateFormat`, `dateTimeFormat`, `title`, `author`, `compress` |
63
+ | word, pdf | `title`, `subtitle`, `showDate`, `header`, `pageSize` (`a3`, `a4`, `a5`, `letter`, `legal` or `[width, height]` in points), `orientation` (`auto` — landscape above 5 columns, `portrait`, `landscape`), `margin` (points or `[top, right, bottom, left]`), `fontSize`, `pageNumbers`, `repeatHeader`, `striped`, `gridlines`, `headerBackground`, `stripeBackground`, `borderColor`, `textColor`, `mutedColor`, `compress`; PDF also `font` (own TrueType loader), `lineHeight`, `cellPadding`, `author` |
64
+ | json | `keys` (`field` or `title`), `indent` |
65
+ | html | `title`, `subtitle`, `showDate`, `header`, `styles` (own CSS) |
66
+ | markdown | `title`, `header` |
67
+ | copy | `header`, `html` (also puts an HTML table on the clipboard so it pastes as a table) |
68
+ | print | `title`, `subtitle`, `showDate`, `header`, `pageSize`, `orientation`, `margin`, `styles` |
69
+
70
+ `provideTxExport(options)` sets defaults for the app or for one component subtree.
71
+
72
+ ## Accessibility
73
+
74
+ Icon-only buttons are named by their tooltip. While an export runs the button spins, has `aria-busy` and ignores more clicks. After copying, the button shows a check, its name becomes "Table copied" and the text is announced.
75
+
76
+ ## Notes
77
+
78
+ - `TxExportService.export({ format, rows, fields, options })` runs an export from code; `buildExportTable`, `writeCsv`, `writeXlsx`, `writeDocx`, `writePdf`, `writeJson`, `writeHtml`, `writeMarkdown` and `zip` are exported for own flows. `tx-table` `exportCSV()` uses the same CSV writer.
79
+ - PDF uses a TrueType font without shaping, so scripts that need it (Arabic, Indic) need their own font through `pdf.font`, and right-to-left text is not reordered.
@@ -0,0 +1,93 @@
1
+ Copyright 2021 The Onest Project Authors (https://github.com/googlefonts/onest)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,7 @@
1
+ # Export font
2
+
3
+ Onest Regular and SemiBold (Latin and Cyrillic) for `tx-export` PDF files, as base64 strings: `TX_EXPORT_FONT`. The PDF writer loads this entry point only on the first PDF export, keeps only the glyphs a file uses and embeds them, so the text in the PDF is real, selectable and searchable.
4
+
5
+ Onest is © The Onest Project Authors, licensed under the SIL Open Font License 1.1 — see `OFL.txt` next to this file. Regenerate with `npm run export-font -- <folder of an Onest release>`.
6
+
7
+ To use another font (another script, a brand font), give the PDF options a loader: `{ pdf: { font: () => fetch('/fonts/brand.ttf').then((response) => response.arrayBuffer()).then((regular) => ({ regular })) } }`. TrueType outlines (`.ttf`) only.