@nxgt/material-vue 0.24.0 → 0.25.1
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/README.md +17 -19
- package/dist/{Button-DOcT4Pej.js → Button-C1aaI0Gw.js} +1 -1
- package/dist/{HoverCardTrigger-WQe85PCH.js → HoverCardTrigger-JtHn0IFQ.js} +2 -2
- package/dist/{camera-BNbLUPb1.js → camera-BacVyXl0.js} +13 -13
- package/dist/{components-YlYuHLEI.js → components-DRBKkOqk.js} +15333 -13879
- package/dist/components.js +8 -8
- package/dist/composables.js +2 -2
- package/dist/dnd.js +1 -1
- package/dist/form-scope-VxlJuvFe.js +43 -0
- package/dist/{i18n-provider-DTuxugHO.js → i18n-provider-D0oYv0XS.js} +1 -1
- package/dist/i18n.js +4 -4
- package/dist/{icon-button-DKLuZ2c-.js → icon-button-B2FQtIHS.js} +1 -1
- package/dist/lib/components/ui/collections/tree/use-tree.d.ts +2 -0
- package/dist/lib/components/ui/dates/date-field/date-field.vue.d.ts +10 -1
- package/dist/lib/components/ui/dates/date-field/date-form-field.vue.d.ts +3 -1
- package/dist/lib/components/ui/dates/date-field/day-matcher.d.ts +26 -0
- package/dist/lib/components/ui/dates/date-field/index.d.ts +1 -0
- package/dist/lib/components/ui/dates/date-field/partials/date-field-content.vue.d.ts +2 -0
- package/dist/lib/components/ui/dates/date-range-field/date-range-field.utils.d.ts +11 -0
- package/dist/lib/components/ui/dates/date-range-field/date-range-field.vue.d.ts +26 -1
- package/dist/lib/components/ui/dates/date-range-field/date-range-form-field.vue.d.ts +3 -1
- package/dist/lib/components/ui/dates/date-range-field/index.d.ts +1 -0
- package/dist/lib/components/ui/dates/date-range-field/partials/date-range-calendar.vue.d.ts +5 -0
- package/dist/lib/components/ui/dates/date-range-field/partials/date-range-field-trigger.vue.d.ts +2 -0
- package/dist/lib/components/ui/dates/date-range-field/partials/date-range-presets.vue.d.ts +12 -0
- package/dist/lib/components/ui/dates/date-range-field/partials/date-range-times.vue.d.ts +13 -0
- package/dist/lib/components/ui/dates/date-range-field/use-date-range-presets.d.ts +23 -0
- package/dist/lib/components/ui/dates/time-picker/time-picker-utils.d.ts +7 -0
- package/dist/lib/components/ui/display/accordion-card/accordion-card.vue.d.ts +29 -1
- package/dist/lib/components/ui/display/avatar/Avatar.vue.d.ts +14 -3
- package/dist/lib/components/ui/display/avatar/index.d.ts +1 -0
- package/dist/lib/components/ui/display/cards/cards.gallery.d.ts +5 -9
- package/dist/lib/components/ui/display/qrcode/qrcode.vue.d.ts +5 -3
- package/dist/lib/components/ui/display/status-indicator/status-tone.d.ts +3 -0
- package/dist/lib/components/ui/feedback/confirmation-dialog/async-form-scope.d.ts +15 -0
- package/dist/lib/components/ui/feedback/confirmation-dialog/confirmation-dialog.vue.d.ts +37 -24
- package/dist/lib/components/ui/feedback/confirmation-dialog/index.d.ts +1 -1
- package/dist/lib/components/ui/feedback/confirmation-dialog/partials/confirmation-dialog-form-error.vue.d.ts +3 -0
- package/dist/lib/components/ui/fields/attributes/form-schema.d.ts +24 -22
- package/dist/lib/components/ui/fields/contacts/consts.d.ts +1 -1
- package/dist/lib/components/ui/fields/number-field/number-field.vue.d.ts +2 -0
- package/dist/lib/components/ui/fields/slider/partials/slider-field-row.vue.d.ts +32 -0
- package/dist/lib/components/ui/fields/slider/slider-field.vue.d.ts +22 -1
- package/dist/lib/components/ui/fields/slider/slider-form-field.vue.d.ts +13 -1
- package/dist/lib/components/ui/forms/form-scope-schema.d.ts +43 -0
- package/dist/lib/components/ui/forms/form-scope.vue.d.ts +33 -0
- package/dist/lib/components/ui/media/file-preview/file-preview-pdf.lazy.d.ts +8 -0
- package/dist/lib/components/ui/media/file-preview/file-preview.vue.d.ts +9 -0
- package/dist/lib/components/ui/media/file-preview/index.d.ts +3 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-body.vue.d.ts +21 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-card.vue.d.ts +15 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-download.vue.d.ts +11 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-media.vue.d.ts +17 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-pdf.vue.d.ts +21 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-status.vue.d.ts +22 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-text.vue.d.ts +16 -0
- package/dist/lib/components/ui/media/file-preview/types.d.ts +19 -0
- package/dist/lib/components/ui/media/file-preview/use-file-preview.d.ts +21 -0
- package/dist/lib/components/ui/media/file-preview/use-text-preview.d.ts +17 -0
- package/dist/lib/components/ui/media/files-form-field/files-form-field.vue.d.ts +29 -0
- package/dist/lib/components/ui/media/files-form-field/index.d.ts +2 -0
- package/dist/lib/components/ui/media/image-cropper/partials/image-cropper-canvas.vue.d.ts +1 -1
- package/dist/lib/components/ui/media/index.d.ts +2 -0
- package/dist/lib/components/ui/media/pdf-viewer/partials/pdf-page.vue.d.ts +1 -1
- package/dist/lib/components/ui/media/pdf-viewer/partials/pdf-reader-body.vue.d.ts +2 -2
- package/dist/lib/components/ui/media/upload/network-upload-field/use-image-preview.d.ts +9 -1
- package/dist/lib/components/ui/primitives/tabs/Tabs.vue.d.ts +3 -0
- package/dist/lib/components/ui/primitives/tabs/index.d.ts +1 -0
- package/dist/lib/components/ui/primitives/tabs/tabs-variant.d.ts +9 -0
- package/dist/lib/components/ui/selection/autocomplete/autocomplete-form-field.vue.d.ts +31 -5
- package/dist/lib/components/ui/selection/autocomplete/autocomplete-items.d.ts +23 -0
- package/dist/lib/components/ui/selection/autocomplete/autocomplete.vue.d.ts +48 -13
- package/dist/lib/components/ui/selection/autocomplete/filter-options.d.ts +2 -1
- package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-box.vue.d.ts +13 -1
- package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-list.vue.d.ts +17 -3
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-items.d.ts +15 -0
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-open.d.ts +15 -0
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-texts.d.ts +14 -0
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete.d.ts +34 -0
- package/dist/lib/components/ui/selection/index.d.ts +1 -0
- package/dist/lib/components/ui/selection/select-field/select-field.vue.d.ts +16 -1
- package/dist/lib/components/ui/selection/select-field/select-form-field.vue.d.ts +16 -2
- package/dist/lib/components/ui/selection/tree-select-field/index.d.ts +3 -0
- package/dist/lib/components/ui/selection/tree-select-field/partials/tree-select-panel.vue.d.ts +27 -0
- package/dist/lib/components/ui/selection/tree-select-field/partials/tree-select-trigger.vue.d.ts +28 -0
- package/dist/lib/components/ui/selection/tree-select-field/tree-select-field.vue.d.ts +8 -0
- package/dist/lib/components/ui/selection/tree-select-field/tree-select-form-field.vue.d.ts +8 -0
- package/dist/lib/components/ui/selection/tree-select-field/tree-select.utils.d.ts +29 -0
- package/dist/lib/components/ui/selection/tree-select-field/types.d.ts +28 -0
- package/dist/lib/components/ui/selection/tree-select-field/use-tree-select-field.d.ts +19 -0
- package/dist/lib/components/ui/widgets/code-editor/code-editor-options.d.ts +4 -1
- package/dist/lib/components/ui/widgets/code-editor/code-editor.vue.d.ts +7 -0
- package/dist/lib/components/ui/widgets/code-editor/index.d.ts +1 -0
- package/dist/lib/components/ui/widgets/code-editor/monaco-editor.vue.d.ts +3 -0
- package/dist/lib/i18n/resources/en/en.d.ts +33 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +36 -3
- package/dist/lib/i18n/resources/fr/fr.d.ts +33 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +36 -3
- package/dist/lib/i18n/resources/resources.d.ts +66 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/nuxt/component-names.d.ts +1 -1
- package/dist/lib.js +2 -2
- package/dist/main.js +17 -17
- package/dist/map.js +4 -4
- package/dist/material-vue.css +1 -1
- package/dist/{pdf-outline-sidebar-0I-LGrgY.js → pdf-outline-sidebar-jJfhNjnN.js} +2 -2
- package/dist/{pdf-page-C74-6lyZ.js → pdf-page-BW1hXzPu.js} +1 -1
- package/dist/{pdf-page-list-DPsquYPY.js → pdf-page-list-D277RtWS.js} +2 -2
- package/dist/{pdf-reader-Bkpp7UZ7.js → pdf-reader-BReUTsn_.js} +73 -71
- package/dist/{pdf-sidebar-BH-1jvy-.js → pdf-sidebar-Bk6PowY1.js} +3 -3
- package/dist/{pdf-thumbnail-sidebar-ByqNaYfz.js → pdf-thumbnail-sidebar-BcNDFsks.js} +3 -3
- package/dist/{pdf-toolbar-BRnmzddi.js → pdf-toolbar-CHjaMhH9.js} +4 -4
- package/dist/pdf.js +2 -2
- package/dist/{sortable-provider-CC9eO1nm.js → sortable-provider-C83VBfGl.js} +2 -2
- package/dist/{stored-language-N_UoPJsY.js → stored-language-CC_vdcCN.js} +72 -6
- package/dist/{stx-player-BGKIDqNX.js → stx-player-BMQ1D2Li.js} +20 -20
- package/dist/{translator-CU0jKvzB.js → translator-B-X_1taI.js} +1 -1
- package/dist/{use-heading-spy-Bw1LIAkC.js → use-heading-spy-C_ySuvTl.js} +1 -1
- package/dist/{use-material-translation-8hUB2M-S.js → use-material-translation-B6sIk0mF.js} +3 -3
- package/docs/components/README.md +2 -1
- package/docs/components/data-display.md +51 -10
- package/docs/components/data-table-filter-and-lists.md +4 -0
- package/docs/components/date-and-time.md +116 -9
- package/docs/components/feedback-and-status.md +56 -4
- package/docs/components/form-fields.md +15 -5
- package/docs/components/media-and-files.md +119 -5
- package/docs/components/navigation-and-layout.md +2 -1
- package/docs/components/primitives.md +21 -4
- package/docs/components/rich-widgets.md +20 -3
- package/docs/components/selection-and-choice.md +135 -9
- package/docs/guides/forms.md +3 -4
- package/docs/guides/i18n.md +44 -4
- package/docs/previews/date-time-daterangefield.webp +0 -0
- package/docs/previews/media-files-filepreview.webp +0 -0
- package/docs/previews/selection-choice-treeselectfield.webp +0 -0
- package/docs/roadmap.md +45 -37
- package/docs/troubleshooting.md +140 -1
- package/lib/nuxt/component-names.ts +4 -0
- package/package.json +2 -2
package/docs/troubleshooting.md
CHANGED
|
@@ -49,6 +49,11 @@ words in your error.
|
|
|
49
49
|
- [A `*FormField` is missing from the submitted values, or never shows an error](#a-formfield-is-missing-from-the-submitted-values-or-never-shows-an-error)
|
|
50
50
|
- [`meta.touched` stays false after leaving a field](#metatouched-stays-false-after-leaving-a-field)
|
|
51
51
|
- [A multi-step form reopens at a later step](#a-multi-step-form-reopens-at-a-later-step)
|
|
52
|
+
- [The form could not be loaded.](#the-form-could-not-be-loaded)
|
|
53
|
+
|
|
54
|
+
**TypeScript**
|
|
55
|
+
|
|
56
|
+
- [`does not satisfy the constraint 'abstract new (...args: any) => any'`](#does-not-satisfy-the-constraint-abstract-new-args-any--any)
|
|
52
57
|
|
|
53
58
|
**Printing**
|
|
54
59
|
|
|
@@ -112,6 +117,7 @@ words in your error.
|
|
|
112
117
|
- [A form with a required `Switch` no longer submits](#a-form-with-a-required-switch-no-longer-submits)
|
|
113
118
|
- [A `RichTextEditor` became editable after upgrading](#a-richtexteditor-became-editable-after-upgrading)
|
|
114
119
|
- [Focus falls to `<body>` when a controlled `Drawer` closes](#focus-falls-to-body-when-a-controlled-drawer-closes)
|
|
120
|
+
- [A `TimePicker` test expects AM / PM to add 12 hours, or a click on the pressed half to switch to PM](#a-timepicker-test-expects-am--pm-to-add-12-hours-or-a-click-on-the-pressed-half-to-switch-to-pm)
|
|
115
121
|
|
|
116
122
|
**PDF reader**
|
|
117
123
|
|
|
@@ -136,6 +142,9 @@ words in your error.
|
|
|
136
142
|
- [A PDF page shows sideways in `PdfReader`](#a-pdf-page-shows-sideways-in-pdfreader)
|
|
137
143
|
- [The zoom changes by itself while a long PDF is open](#the-zoom-changes-by-itself-while-a-long-pdf-is-open)
|
|
138
144
|
- [`@page-change` is not called when `initialPage` is past the end, or after a new file](#page-change-is-not-called-when-initialpage-is-past-the-end-or-after-a-new-file)
|
|
145
|
+
- [`@page-change` reports another page after opening on `initialPage`](#page-change-reports-another-page-after-opening-on-initialpage)
|
|
146
|
+
- [`FilePreview` shows a file card with a Download link for a PDF](#filepreview-shows-a-file-card-with-a-download-link-for-a-pdf)
|
|
147
|
+
- [`FilePreview` says "This file could not be previewed."](#filepreview-says-this-file-could-not-be-previewed)
|
|
139
148
|
- [Reporting a bug](#reporting-a-bug)
|
|
140
149
|
|
|
141
150
|
---
|
|
@@ -564,7 +573,7 @@ hidden hint sits inside the helper element, so match its text with
|
|
|
564
573
|
|
|
565
574
|
### A `Table`'s `id`, `aria-*` or `style` is no longer on its scrolling container
|
|
566
575
|
|
|
567
|
-
**When:** after upgrading, either:
|
|
576
|
+
**When:** after upgrading to 0.24.0, either:
|
|
568
577
|
|
|
569
578
|
- a selector or listener aimed at the attributes you put on `<Table>` finds
|
|
570
579
|
nothing on `div[data-slot="table-container"]` (`#orders` matches the
|
|
@@ -966,6 +975,52 @@ In an SSR app the server renders step 0. A client hydrating that page renders
|
|
|
966
975
|
step 0 too and resumes at the stored step once mounted, so hydration matches
|
|
967
976
|
without `clientOnly`: see [forms](guides/forms.md#a-multi-step-form).
|
|
968
977
|
|
|
978
|
+
### The form could not be loaded.
|
|
979
|
+
|
|
980
|
+
**When:** a `ConfirmationDialog` with `form-options` shows this line
|
|
981
|
+
("Le formulaire n’a pas pu être chargé." in French,
|
|
982
|
+
`material.confirm-dialog.form-failed`) where its form should be, and its
|
|
983
|
+
confirm button stays disabled. The form's code is a separate chunk, loaded the
|
|
984
|
+
first time such a dialog renders it, and that load failed twice: the browser
|
|
985
|
+
was offline, or a deploy removed the chunk the page still names.
|
|
986
|
+
**Why:** each dialog tries the load once more after a failure, then gives up
|
|
987
|
+
and keeps that result: reopening the same dialog shows the message again
|
|
988
|
+
without a new attempt. A dialog rendered anew (another page, a remounted
|
|
989
|
+
component) tries again from the start.
|
|
990
|
+
**Fix:** reload the page — after a deploy, that fetches the new chunk names.
|
|
991
|
+
If it keeps happening, check that your server or CDN serves the chunk that holds
|
|
992
|
+
the dialog's form (its name usually starts with `form-scope`) with the rest of
|
|
993
|
+
the same build, and keeps the previous build's chunks for pages already open.
|
|
994
|
+
|
|
995
|
+
## TypeScript
|
|
996
|
+
|
|
997
|
+
### `does not satisfy the constraint 'abstract new (...args: any) => any'`
|
|
998
|
+
|
|
999
|
+
**When:** `vue-tsc` on code that types a template ref with
|
|
1000
|
+
`InstanceType<typeof Autocomplete>` (or `AutocompleteFormField`,
|
|
1001
|
+
`ConfirmationDialog`, `FilesFormField`). The whole message reads:
|
|
1002
|
+
|
|
1003
|
+
```text
|
|
1004
|
+
error TS2344: Type '<T extends AutocompleteOption = AutocompleteOption>(__VLS_props: …) => …' does not satisfy the constraint 'abstract new (...args: any) => any'.
|
|
1005
|
+
… provides no match for the signature 'new (...args: any): any'.
|
|
1006
|
+
```
|
|
1007
|
+
|
|
1008
|
+
**Why:** these four components are generic (`<script setup generic>`): your
|
|
1009
|
+
option type, or your form schema, types their props and slots. A generic
|
|
1010
|
+
component's default export is a function, not a component constructor, so
|
|
1011
|
+
`InstanceType` has nothing to read.
|
|
1012
|
+
**Fix:** use `ComponentExposed` from `vue-component-type-helpers` (the helpers
|
|
1013
|
+
`vue-tsc` itself ships; add it as a dev dependency if your app does not list
|
|
1014
|
+
it):
|
|
1015
|
+
|
|
1016
|
+
```ts
|
|
1017
|
+
import { useTemplateRef } from 'vue';
|
|
1018
|
+
import type { ComponentExposed } from 'vue-component-type-helpers';
|
|
1019
|
+
import { Autocomplete } from '@nxgt/material-vue/components';
|
|
1020
|
+
|
|
1021
|
+
const field = useTemplateRef<ComponentExposed<typeof Autocomplete>>('field');
|
|
1022
|
+
```
|
|
1023
|
+
|
|
969
1024
|
## Printing
|
|
970
1025
|
|
|
971
1026
|
### The table header and the total row print blank
|
|
@@ -2019,6 +2074,33 @@ const opener = useTemplateRef<InstanceType<typeof Button>>('opener');
|
|
|
2019
2074
|
</template>
|
|
2020
2075
|
```
|
|
2021
2076
|
|
|
2077
|
+
### A `TimePicker` test expects AM / PM to add 12 hours, or a click on the pressed half to switch to PM
|
|
2078
|
+
|
|
2079
|
+
**When:** after upgrading to 0.25.0, a test (or code of yours) around a
|
|
2080
|
+
`TimePicker` — or the popover of a `DateField` with `show-time-picker`, a
|
|
2081
|
+
`TimeField` or a `DateRangeField` with `with-time`, which hold one — sees a
|
|
2082
|
+
different time, or no `change` event, when it clicks AM or PM.
|
|
2083
|
+
**Why:** before 0.25.0 the toggle added 12 hours on every PM and took
|
|
2084
|
+
`% 12` on AM. A time already in the afternoon went 12 hours further — PM on
|
|
2085
|
+
14:00 gave 02:00 the next day — and a click on the half already pressed
|
|
2086
|
+
(which Reka reports as no value, unpressing it) was read as PM and did the
|
|
2087
|
+
same. The AM / PM shown was also read once, from the first `date`, so a
|
|
2088
|
+
`date` changed from outside kept its old half. Now AM / PM follows the `date`
|
|
2089
|
+
it is given, switching moves the time into that half and no further (09:30 +
|
|
2090
|
+
PM is 21:30, 21:30 + PM stays 21:30, 21:30 + AM is 09:30, on the same day),
|
|
2091
|
+
and a click on the pressed half changes nothing and emits no `change`. This
|
|
2092
|
+
is the same fix as `@nxgt/material`'s 2.6.0 (`periodOf` / `withPeriod`). The
|
|
2093
|
+
hours and minutes inputs are also named "Hours" and "Minutes"
|
|
2094
|
+
(`material.time-picker.hours`, `material.time-picker.minutes`).
|
|
2095
|
+
**Fix:** expect the time in the half you picked, and no event for a click on
|
|
2096
|
+
the pressed half. Find the inputs by their names rather than by position:
|
|
2097
|
+
|
|
2098
|
+
```ts
|
|
2099
|
+
await userEvent.click(canvas.getByRole('button', { name: 'PM' }));
|
|
2100
|
+
expect(onChange).toHaveBeenLastCalledWith(new Date(2026, 0, 1, 21, 30)); // from 09:30
|
|
2101
|
+
await userEvent.type(canvas.getByRole('spinbutton', { name: 'Hours' }), '10');
|
|
2102
|
+
```
|
|
2103
|
+
|
|
2022
2104
|
---
|
|
2023
2105
|
|
|
2024
2106
|
## PDF reader
|
|
@@ -2379,6 +2461,63 @@ last page without reporting it; or `file` changes and the reader goes back to
|
|
|
2379
2461
|
to itself. Since 0.22.0 both are reported, once.
|
|
2380
2462
|
**Fix:** update `@nxgt/material-vue`. A page you kept in sync by hand can go.
|
|
2381
2463
|
|
|
2464
|
+
### `@page-change` reports another page after opening on `initialPage`
|
|
2465
|
+
|
|
2466
|
+
**When:** the reader opens on `initialPage` and, without the user scrolling,
|
|
2467
|
+
`@page-change` reports another page, most often the last one, and the page field
|
|
2468
|
+
shows it. Seen on slow devices and busy machines, near the end of a
|
|
2469
|
+
document, with `@nxgt/material-vue` 0.24.0 and earlier.
|
|
2470
|
+
**Why:** after placing the opening page, the reader ignored scrolling for
|
|
2471
|
+
only 150 ms. When the placement scroll landed later (a late frame), it was
|
|
2472
|
+
read as the user's, and at the end of the pages that is the last page.
|
|
2473
|
+
**Fix:** update `@nxgt/material-vue`. The opening page now keeps the page number while
|
|
2474
|
+
the view stays on it; the user's own scroll, find in page or a screen
|
|
2475
|
+
reader moving the view still report the page they reach.
|
|
2476
|
+
|
|
2477
|
+
### `FilePreview` shows a file card with a Download link for a PDF
|
|
2478
|
+
|
|
2479
|
+
**When:** a PDF given to `FilePreview` shows its name, size and a Download
|
|
2480
|
+
link instead of the reader.
|
|
2481
|
+
**Why:** `FilePreview` imports `PdfReader` the first time it previews a PDF,
|
|
2482
|
+
and falls back to the file card when that import fails: the viewer's chunk
|
|
2483
|
+
could not be fetched (a deploy replaced the chunks the open page was built
|
|
2484
|
+
with, or a network error), or the bundle has no `pdfjs-dist` — they are
|
|
2485
|
+
dependencies of `@nxgt/material-vue`, not optional peers, so this is a bundler
|
|
2486
|
+
configuration that left them out. Nothing is thrown; the next PDF previewed
|
|
2487
|
+
tries again.
|
|
2488
|
+
**Fix:** reload the page after a deploy; otherwise check that your bundler
|
|
2489
|
+
keeps `pdfjs-dist` and pdf.js's worker (see `PdfReader` in
|
|
2490
|
+
[Media & files](components/media-and-files.md#pdfreader)). The same file in a
|
|
2491
|
+
`PdfReader` of its own shows the underlying error. A PDF the reader loaded
|
|
2492
|
+
but cannot open (a corrupt or password-protected file, a URL that answers an
|
|
2493
|
+
error page) is different: the preview stays `ready` and `PdfReader` shows its
|
|
2494
|
+
own error inside it.
|
|
2495
|
+
|
|
2496
|
+
### `FilePreview` says "This file could not be previewed."
|
|
2497
|
+
|
|
2498
|
+
**When:** a `FilePreview` given a URL, or a file it cannot show, renders that
|
|
2499
|
+
message (and `@error` receives the error).
|
|
2500
|
+
**Why:** a text, JSON, CSV or Markdown URL is fetched with `fetch`: an HTTP
|
|
2501
|
+
error is a `FilePreviewHttpError` with its `status`, whose message is
|
|
2502
|
+
`Could not read …: HTTP 404` (the URL as you passed it, then the status —
|
|
2503
|
+
`Could not read /files/notes.txt: HTTP 404`), and a cross-origin URL
|
|
2504
|
+
without CORS headers is a `TypeError: Failed to fetch`. An image, video or
|
|
2505
|
+
audio file the browser cannot decode (a corrupt file, a codec the browser
|
|
2506
|
+
lacks, a URL that answers an error page) fails in its own element. A URL
|
|
2507
|
+
that is not `http(s):`, relative, `blob:`, or a `data:` URL of an image,
|
|
2508
|
+
video, audio file, plain text, CSV, Markdown, JSON or PDF (`javascript:`,
|
|
2509
|
+
`data:text/html`, and also a `data:` URL of XML, TSV or YAML, though
|
|
2510
|
+
`FilePreview` would show those kinds from a `Blob`) is refused before
|
|
2511
|
+
anything is linked, loaded or fetched: the error is a
|
|
2512
|
+
`FilePreviewUnsafeUrlError`, "Refused to preview a URL with an unsafe scheme", and there is no
|
|
2513
|
+
Download link.
|
|
2514
|
+
**Fix:** serve the file with `Access-Control-Allow-Origin` for your page's
|
|
2515
|
+
origin, or fetch it yourself (with your credentials) and pass the `Blob`;
|
|
2516
|
+
pass `type` when the server answers `application/octet-stream` for a file
|
|
2517
|
+
whose URL has no extension; pass a refused URL's file as a `Blob`, or from
|
|
2518
|
+
an `https:` URL. A text file larger than `max-text-bytes` is not an error: its
|
|
2519
|
+
beginning is shown, with "Showing the first … of this file." below.
|
|
2520
|
+
|
|
2382
2521
|
---
|
|
2383
2522
|
|
|
2384
2523
|
## Reporting a bug
|
|
@@ -247,6 +247,8 @@ export const COMPONENT_NAMES = [
|
|
|
247
247
|
'FileListFormField',
|
|
248
248
|
'FileListS3Field',
|
|
249
249
|
'FileListS3FormField',
|
|
250
|
+
'FilePreview',
|
|
251
|
+
'FilesFormField',
|
|
250
252
|
'Filter',
|
|
251
253
|
'FilterActions',
|
|
252
254
|
'FilterChips',
|
|
@@ -567,6 +569,8 @@ export const COMPONENT_NAMES = [
|
|
|
567
569
|
'TransferListFormField',
|
|
568
570
|
'Tree',
|
|
569
571
|
'TreeItem',
|
|
572
|
+
'TreeSelectField',
|
|
573
|
+
'TreeSelectFormField',
|
|
570
574
|
'TrendCard',
|
|
571
575
|
'Typography',
|
|
572
576
|
'UploadField',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxgt/material-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"email": "stevegires@gmail.com"
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"docs:previews": "vitest run --project previews"
|
|
119
119
|
},
|
|
120
120
|
"dependencies": {
|
|
121
|
-
"@nxgt/material-core": "^0.
|
|
121
|
+
"@nxgt/material-core": "^0.3.1",
|
|
122
122
|
"@floating-ui/dom": "^1.8.0",
|
|
123
123
|
"@fortawesome/fontawesome-common-types": "7.3.1",
|
|
124
124
|
"@lucide/vue": "^1.45.0",
|