nuxt-ui-tools 1.11.2 → 1.13.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/README.md +11 -5
- package/dist/module.json +1 -1
- package/dist/module.mjs +46 -0
- package/dist/runtime/dashboard/components/dashboard-stat.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-stat.vue.d.ts +1 -1
- package/dist/runtime/file-preview/components/shell/file-preview-stage.d.vue.ts +2 -2
- package/dist/runtime/file-preview/components/shell/file-preview-stage.vue.d.ts +2 -2
- package/dist/runtime/form/fields/array-collapse/component.vue +2 -1
- package/dist/runtime/form/fields/array-list/component.vue +72 -63
- package/dist/runtime/form/fields/array-list/use-array-items.d.ts +1 -0
- package/dist/runtime/form/fields/array-list/use-array-items.js +4 -0
- package/dist/runtime/form/fields/array-table/component.vue +2 -1
- package/dist/runtime/form/types/api.d.ts +10 -2
- package/dist/runtime/i18n/locales/en.js +252 -130
- package/dist/runtime/i18n/locales/fr.js +252 -130
- package/dist/runtime/i18n/types.d.ts +242 -119
- package/dist/runtime/shared/types/query.d.ts +14 -4
- package/dist/runtime/shared/types/remote-options.d.ts +11 -0
- package/dist/runtime/shared/utils/define-remote-options.js +6 -0
- package/dist/runtime/shared/utils/file.d.ts +1 -1
- package/dist/runtime/spreadsheet/components/{steps/review/spreadsheet-review-overflow-alert.d.vue.ts → internal/spreadsheet-import-cell-editor.d.vue.ts} +8 -5
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-cell-editor.vue +73 -0
- package/dist/runtime/spreadsheet/components/{steps/review/spreadsheet-review-overflow-alert.vue.d.ts → internal/spreadsheet-import-cell-editor.vue.d.ts} +8 -5
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-column-row.d.vue.ts +17 -0
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-column-row.vue +98 -0
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-column-row.vue.d.ts +17 -0
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-heading.d.vue.ts +17 -0
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-heading.vue +20 -0
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-heading.vue.d.ts +17 -0
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-status-badge.d.vue.ts +10 -0
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-status-badge.vue +34 -0
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-status-badge.vue.d.ts +10 -0
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-value-row.d.vue.ts +13 -0
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-value-row.vue +113 -0
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-value-row.vue.d.ts +13 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-column-mapping.d.vue.ts +35 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-column-mapping.vue +154 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-column-mapping.vue.d.ts +35 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-dropzone.d.vue.ts +23 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-dropzone.vue +83 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-dropzone.vue.d.ts +23 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-expected-columns.d.vue.ts +19 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-expected-columns.vue +45 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-expected-columns.vue.d.ts +19 -0
- package/dist/runtime/spreadsheet/components/{shared/spreadsheet-object-preview-table.d.vue.ts → parts/spreadsheet-import-export-button.d.vue.ts} +3 -2
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-export-button.vue +34 -0
- package/dist/runtime/spreadsheet/components/{layout/spreadsheet-import-file-bar.vue.d.ts → parts/spreadsheet-import-export-button.vue.d.ts} +3 -4
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-file-card.d.vue.ts +17 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-file-card.vue +49 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-file-card.vue.d.ts +17 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-progress.d.vue.ts +18 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-progress.vue +101 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-progress.vue.d.ts +18 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-row-inspector.d.vue.ts +22 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-row-inspector.vue +276 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-row-inspector.vue.d.ts +22 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-source-settings.d.vue.ts +11 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-source-settings.vue +164 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-source-settings.vue.d.ts +11 -0
- package/dist/runtime/spreadsheet/components/{shared/spreadsheet-value-preview.d.vue.ts → parts/spreadsheet-import-stat.d.vue.ts} +7 -4
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-stat.vue +30 -0
- package/dist/runtime/spreadsheet/components/{shared/spreadsheet-value-preview.vue.d.ts → parts/spreadsheet-import-stat.vue.d.ts} +7 -4
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-stats.d.vue.ts +26 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-stats.vue +55 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-stats.vue.d.ts +26 -0
- package/dist/runtime/spreadsheet/components/{shared/spreadsheet-object-preview-table.vue.d.ts → parts/spreadsheet-import-submit-button.d.vue.ts} +3 -2
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-submit-button.vue +27 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-submit-button.vue.d.ts +8 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-summary.d.vue.ts +16 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-summary.vue +51 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-summary.vue.d.ts +16 -0
- package/dist/runtime/spreadsheet/components/{layout/spreadsheet-import-file-bar.d.vue.ts → parts/spreadsheet-import-table-toolbar.d.vue.ts} +2 -4
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-table-toolbar.vue +217 -0
- package/dist/runtime/spreadsheet/components/{shared/spreadsheet-raw-preview-table.d.vue.ts → parts/spreadsheet-import-table-toolbar.vue.d.ts} +2 -2
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-table.d.vue.ts +33 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-table.vue +302 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-table.vue.d.ts +33 -0
- package/dist/runtime/spreadsheet/components/{layout/spreadsheet-import-sidebar.d.vue.ts → parts/spreadsheet-import-template-button.d.vue.ts} +5 -4
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-template-button.vue +31 -0
- package/dist/runtime/spreadsheet/components/{layout/spreadsheet-import-sidebar.vue.d.ts → parts/spreadsheet-import-template-button.vue.d.ts} +5 -4
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-value-mapping.d.vue.ts +27 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-value-mapping.vue +162 -0
- package/dist/runtime/spreadsheet/components/parts/spreadsheet-import-value-mapping.vue.d.ts +27 -0
- package/dist/runtime/spreadsheet/components/spreadsheet-import-root.d.vue.ts +24 -0
- package/dist/runtime/spreadsheet/components/spreadsheet-import-root.vue +23 -0
- package/dist/runtime/spreadsheet/components/spreadsheet-import-root.vue.d.ts +24 -0
- package/dist/runtime/spreadsheet/components/spreadsheet-import.d.vue.ts +21 -6
- package/dist/runtime/spreadsheet/components/spreadsheet-import.vue +46 -262
- package/dist/runtime/spreadsheet/components/spreadsheet-import.vue.d.ts +21 -6
- package/dist/runtime/spreadsheet/components/{layout/spreadsheet-import-header.d.vue.ts → steps/spreadsheet-import-step-nav.d.vue.ts} +6 -2
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-step-nav.vue +116 -0
- package/dist/runtime/spreadsheet/components/{layout/spreadsheet-import-header.vue.d.ts → steps/spreadsheet-import-step-nav.vue.d.ts} +6 -2
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-step.d.vue.ts +26 -0
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-step.vue +106 -0
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-step.vue.d.ts +26 -0
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-stepper.d.vue.ts +15 -0
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-stepper.vue +131 -0
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-stepper.vue.d.ts +15 -0
- package/dist/runtime/spreadsheet/composables/index.d.ts +2 -0
- package/dist/runtime/spreadsheet/composables/index.js +2 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-answers.d.ts +8 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-answers.js +19 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-columns.d.ts +23 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-columns.js +75 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-context.d.ts +8 -45
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-context.js +28 -32
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-edits.d.ts +11 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-edits.js +25 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-fields.d.ts +16 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-fields.js +20 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-file.d.ts +14 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-file.js +44 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-import-context.d.ts +12 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-import-context.js +22 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-import.d.ts +18 -7
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-import.js +340 -109
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-layout.d.ts +36 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-layout.js +95 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-options.d.ts +24 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-options.js +159 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-queries.d.ts +14 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-queries.js +11 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-review.d.ts +37 -169
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-review.js +148 -408
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-rows.d.ts +48 -26
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-rows.js +334 -21
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-steps.d.ts +33 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-steps.js +126 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-submit.d.ts +37 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-submit.js +136 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-values.d.ts +27 -0
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-values.js +121 -0
- package/dist/runtime/spreadsheet/index.d.ts +0 -1
- package/dist/runtime/spreadsheet/index.js +0 -1
- package/dist/runtime/spreadsheet/schema/builder.d.ts +8 -0
- package/dist/runtime/spreadsheet/schema/builder.js +31 -0
- package/dist/runtime/spreadsheet/schema/index.d.ts +24 -32
- package/dist/runtime/spreadsheet/schema/index.js +4 -21
- package/dist/runtime/spreadsheet/types/columns.d.ts +252 -273
- package/dist/runtime/spreadsheet/types/fields.d.ts +64 -0
- package/dist/runtime/spreadsheet/types/importer.d.ts +308 -0
- package/dist/runtime/spreadsheet/types/index.d.ts +6 -10
- package/dist/runtime/spreadsheet/types/options.d.ts +47 -9
- package/dist/runtime/spreadsheet/types/rows.d.ts +57 -48
- package/dist/runtime/spreadsheet/types/schema.d.ts +162 -76
- package/dist/runtime/spreadsheet/types/shared.d.ts +19 -21
- package/dist/runtime/spreadsheet/types/source.d.ts +39 -15
- package/dist/runtime/spreadsheet/types/steps.d.ts +76 -0
- package/dist/runtime/spreadsheet/types/validation.d.ts +49 -69
- package/dist/runtime/spreadsheet/types/values.d.ts +77 -0
- package/dist/runtime/spreadsheet/utils/download.d.ts +2 -0
- package/dist/runtime/spreadsheet/utils/download.js +8 -0
- package/dist/runtime/spreadsheet/utils/export.d.ts +26 -0
- package/dist/runtime/spreadsheet/utils/export.js +50 -0
- package/dist/runtime/spreadsheet/utils/fields.d.ts +26 -0
- package/dist/runtime/spreadsheet/utils/fields.js +169 -0
- package/dist/runtime/spreadsheet/utils/guards.d.ts +18 -0
- package/dist/runtime/spreadsheet/utils/guards.js +27 -0
- package/dist/runtime/spreadsheet/utils/headers.d.ts +15 -0
- package/dist/runtime/spreadsheet/utils/headers.js +36 -0
- package/dist/runtime/spreadsheet/utils/identity.d.ts +24 -0
- package/dist/runtime/spreadsheet/utils/identity.js +57 -0
- package/dist/runtime/spreadsheet/utils/index.d.ts +15 -6
- package/dist/runtime/spreadsheet/utils/index.js +15 -6
- package/dist/runtime/spreadsheet/utils/layout.d.ts +12 -0
- package/dist/runtime/spreadsheet/utils/layout.js +37 -0
- package/dist/runtime/spreadsheet/utils/options.d.ts +31 -10
- package/dist/runtime/spreadsheet/utils/options.js +58 -30
- package/dist/runtime/spreadsheet/utils/parse.d.ts +6 -0
- package/dist/runtime/spreadsheet/utils/parse.js +147 -0
- package/dist/runtime/spreadsheet/utils/paths.d.ts +4 -0
- package/dist/runtime/spreadsheet/utils/paths.js +29 -0
- package/dist/runtime/spreadsheet/utils/rows.d.ts +69 -0
- package/dist/runtime/spreadsheet/utils/rows.js +168 -0
- package/dist/runtime/spreadsheet/utils/rules.d.ts +4 -0
- package/dist/runtime/spreadsheet/utils/rules.js +95 -0
- package/dist/runtime/spreadsheet/utils/suggestions.d.ts +20 -0
- package/dist/runtime/spreadsheet/utils/suggestions.js +43 -0
- package/dist/runtime/spreadsheet/utils/text.d.ts +9 -0
- package/dist/runtime/spreadsheet/utils/text.js +11 -0
- package/dist/runtime/spreadsheet/utils/workbook.d.ts +13 -0
- package/dist/runtime/spreadsheet/utils/workbook.js +121 -0
- package/dist/runtime/table/components/filters/tags/boolean-filter-tag.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/tags/boolean-filter-tag.vue.d.ts +2 -2
- package/dist/runtime/table/components/filters/tags/date-filter-tag.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/tags/date-filter-tag.vue.d.ts +2 -2
- package/dist/runtime/table/components/filters/tags/number-filter-tag.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/tags/number-filter-tag.vue.d.ts +2 -2
- package/dist/runtime/table/components/filters/tags/option-filter-tag.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/tags/option-filter-tag.vue.d.ts +2 -2
- package/dist/runtime/table/components/filters/tags/text-filter-tag.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/tags/text-filter-tag.vue.d.ts +2 -2
- package/dist/runtime/table/components/table/table-cell-ellipsis.d.ts +1 -1
- package/dist/runtime/table/composables/use-table-actions.d.ts +1 -1
- package/dist/runtime/table/composables/use-table-actions.js +11 -3
- package/dist/runtime/table/composables/use-table-internals.d.ts +3 -3
- package/dist/runtime/table/types/actions.d.ts +8 -1
- package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
- package/package.json +18 -3
- package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-file-bar.vue +0 -31
- package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.d.vue.ts +0 -24
- package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.vue +0 -69
- package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.vue.d.ts +0 -24
- package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-header.vue +0 -36
- package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-sidebar.vue +0 -63
- package/dist/runtime/spreadsheet/components/shared/spreadsheet-object-preview-table.vue +0 -67
- package/dist/runtime/spreadsheet/components/shared/spreadsheet-raw-preview-table.vue +0 -41
- package/dist/runtime/spreadsheet/components/shared/spreadsheet-raw-preview-table.vue.d.ts +0 -7
- package/dist/runtime/spreadsheet/components/shared/spreadsheet-summary-stats.d.vue.ts +0 -10
- package/dist/runtime/spreadsheet/components/shared/spreadsheet-summary-stats.vue +0 -25
- package/dist/runtime/spreadsheet/components/shared/spreadsheet-summary-stats.vue.d.ts +0 -10
- package/dist/runtime/spreadsheet/components/shared/spreadsheet-value-preview.vue +0 -201
- package/dist/runtime/spreadsheet/components/steps/matching/spreadsheet-matching-summary.d.vue.ts +0 -11
- package/dist/runtime/spreadsheet/components/steps/matching/spreadsheet-matching-summary.vue +0 -38
- package/dist/runtime/spreadsheet/components/steps/matching/spreadsheet-matching-summary.vue.d.ts +0 -11
- package/dist/runtime/spreadsheet/components/steps/matching/spreadsheet-matching-table.d.vue.ts +0 -45
- package/dist/runtime/spreadsheet/components/steps/matching/spreadsheet-matching-table.vue +0 -219
- package/dist/runtime/spreadsheet/components/steps/matching/spreadsheet-matching-table.vue.d.ts +0 -45
- package/dist/runtime/spreadsheet/components/steps/references/spreadsheet-references-accordion.d.vue.ts +0 -51
- package/dist/runtime/spreadsheet/components/steps/references/spreadsheet-references-accordion.vue +0 -166
- package/dist/runtime/spreadsheet/components/steps/references/spreadsheet-references-accordion.vue.d.ts +0 -51
- package/dist/runtime/spreadsheet/components/steps/references/spreadsheet-references-summary.d.vue.ts +0 -11
- package/dist/runtime/spreadsheet/components/steps/references/spreadsheet-references-summary.vue +0 -26
- package/dist/runtime/spreadsheet/components/steps/references/spreadsheet-references-summary.vue.d.ts +0 -11
- package/dist/runtime/spreadsheet/components/steps/review/spreadsheet-review-inspection.d.vue.ts +0 -41
- package/dist/runtime/spreadsheet/components/steps/review/spreadsheet-review-inspection.vue +0 -392
- package/dist/runtime/spreadsheet/components/steps/review/spreadsheet-review-inspection.vue.d.ts +0 -41
- package/dist/runtime/spreadsheet/components/steps/review/spreadsheet-review-overflow-alert.vue +0 -43
- package/dist/runtime/spreadsheet/components/steps/review/spreadsheet-review-stats.d.vue.ts +0 -15
- package/dist/runtime/spreadsheet/components/steps/review/spreadsheet-review-stats.vue +0 -40
- package/dist/runtime/spreadsheet/components/steps/review/spreadsheet-review-stats.vue.d.ts +0 -15
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-matching-step.d.vue.ts +0 -7
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-matching-step.vue +0 -137
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-matching-step.vue.d.ts +0 -7
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-references-step.d.vue.ts +0 -7
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-references-step.vue +0 -222
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-references-step.vue.d.ts +0 -7
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-review-step.d.vue.ts +0 -7
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-review-step.vue +0 -191
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-review-step.vue.d.ts +0 -7
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-structure-step.d.vue.ts +0 -7
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-structure-step.vue +0 -62
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-structure-step.vue.d.ts +0 -7
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-upload-step.d.vue.ts +0 -8
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-upload-step.vue +0 -81
- package/dist/runtime/spreadsheet/components/steps/spreadsheet-import-upload-step.vue.d.ts +0 -8
- package/dist/runtime/spreadsheet/components/steps/structure/spreadsheet-structure-preview-table.d.vue.ts +0 -15
- package/dist/runtime/spreadsheet/components/steps/structure/spreadsheet-structure-preview-table.vue +0 -95
- package/dist/runtime/spreadsheet/components/steps/structure/spreadsheet-structure-preview-table.vue.d.ts +0 -15
- package/dist/runtime/spreadsheet/components/steps/structure/spreadsheet-structure-sheet-list.d.vue.ts +0 -15
- package/dist/runtime/spreadsheet/components/steps/structure/spreadsheet-structure-sheet-list.vue +0 -56
- package/dist/runtime/spreadsheet/components/steps/structure/spreadsheet-structure-sheet-list.vue.d.ts +0 -15
- package/dist/runtime/spreadsheet/components/types.d.ts +0 -41
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-column-matching.d.ts +0 -18
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-column-matching.js +0 -62
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-internals.d.ts +0 -629
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-internals.js +0 -68
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-references.d.ts +0 -1
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-references.js +0 -3
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-resolutions.d.ts +0 -40
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-resolutions.js +0 -97
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-row-state.d.ts +0 -24
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-row-state.js +0 -74
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-source.d.ts +0 -27
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-source.js +0 -109
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-view.d.ts +0 -15
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-view.js +0 -109
- package/dist/runtime/spreadsheet/schema/normalize.d.ts +0 -73
- package/dist/runtime/spreadsheet/schema/normalize.js +0 -136
- package/dist/runtime/spreadsheet/types/context.d.ts +0 -9
- package/dist/runtime/spreadsheet/types/import.d.ts +0 -55
- package/dist/runtime/spreadsheet/types/inference.d.ts +0 -83
- package/dist/runtime/spreadsheet/types/normalized.d.ts +0 -50
- package/dist/runtime/spreadsheet/types/normalized.js +0 -0
- package/dist/runtime/spreadsheet/types/pipeline.d.ts +0 -7
- package/dist/runtime/spreadsheet/types/pipeline.js +0 -0
- package/dist/runtime/spreadsheet/types/reference-session.d.ts +0 -43
- package/dist/runtime/spreadsheet/types/reference-session.js +0 -0
- package/dist/runtime/spreadsheet/types/references.d.ts +0 -32
- package/dist/runtime/spreadsheet/types/references.js +0 -0
- package/dist/runtime/spreadsheet/types/resolution.d.ts +0 -43
- package/dist/runtime/spreadsheet/types/resolution.js +0 -0
- package/dist/runtime/spreadsheet/utils/builders/core.d.ts +0 -17
- package/dist/runtime/spreadsheet/utils/builders/core.js +0 -262
- package/dist/runtime/spreadsheet/utils/builders/index.d.ts +0 -1
- package/dist/runtime/spreadsheet/utils/builders/index.js +0 -1
- package/dist/runtime/spreadsheet/utils/context.d.ts +0 -20
- package/dist/runtime/spreadsheet/utils/context.js +0 -25
- package/dist/runtime/spreadsheet/utils/display.d.ts +0 -6
- package/dist/runtime/spreadsheet/utils/display.js +0 -26
- package/dist/runtime/spreadsheet/utils/object.d.ts +0 -9
- package/dist/runtime/spreadsheet/utils/object.js +0 -78
- package/dist/runtime/spreadsheet/utils/references/candidates.d.ts +0 -6
- package/dist/runtime/spreadsheet/utils/references/candidates.js +0 -28
- package/dist/runtime/spreadsheet/utils/references/core.d.ts +0 -3
- package/dist/runtime/spreadsheet/utils/references/core.js +0 -3
- package/dist/runtime/spreadsheet/utils/references/guards.d.ts +0 -4
- package/dist/runtime/spreadsheet/utils/references/guards.js +0 -28
- package/dist/runtime/spreadsheet/utils/references/index.d.ts +0 -1
- package/dist/runtime/spreadsheet/utils/references/index.js +0 -1
- package/dist/runtime/spreadsheet/utils/references/resolutions.d.ts +0 -17
- package/dist/runtime/spreadsheet/utils/references/resolutions.js +0 -172
- package/dist/runtime/spreadsheet/utils/references/shared.d.ts +0 -3
- package/dist/runtime/spreadsheet/utils/references/shared.js +0 -26
- package/dist/runtime/spreadsheet/utils/references/sources.d.ts +0 -9
- package/dist/runtime/spreadsheet/utils/references/sources.js +0 -38
- package/dist/runtime/spreadsheet/utils/rows/core.d.ts +0 -4
- package/dist/runtime/spreadsheet/utils/rows/core.js +0 -4
- package/dist/runtime/spreadsheet/utils/rows/headers.d.ts +0 -2
- package/dist/runtime/spreadsheet/utils/rows/headers.js +0 -9
- package/dist/runtime/spreadsheet/utils/rows/index.d.ts +0 -1
- package/dist/runtime/spreadsheet/utils/rows/index.js +0 -1
- package/dist/runtime/spreadsheet/utils/rows/matching.d.ts +0 -5
- package/dist/runtime/spreadsheet/utils/rows/matching.js +0 -209
- package/dist/runtime/spreadsheet/utils/rows/parsing.d.ts +0 -7
- package/dist/runtime/spreadsheet/utils/rows/parsing.js +0 -209
- package/dist/runtime/spreadsheet/utils/rows/shared.d.ts +0 -17
- package/dist/runtime/spreadsheet/utils/rows/shared.js +0 -309
- package/dist/runtime/spreadsheet/utils/rows/summary.d.ts +0 -2
- package/dist/runtime/spreadsheet/utils/rows/summary.js +0 -10
- package/dist/runtime/spreadsheet/utils/source/core.d.ts +0 -9
- package/dist/runtime/spreadsheet/utils/source/core.js +0 -65
- package/dist/runtime/spreadsheet/utils/source/index.d.ts +0 -1
- package/dist/runtime/spreadsheet/utils/source/index.js +0 -1
- package/dist/runtime/spreadsheet/utils/validation/core.d.ts +0 -16
- package/dist/runtime/spreadsheet/utils/validation/core.js +0 -211
- package/dist/runtime/spreadsheet/utils/validation/index.d.ts +0 -1
- package/dist/runtime/spreadsheet/utils/validation/index.js +0 -1
- /package/dist/runtime/spreadsheet/{components/types.js → types/fields.js} +0 -0
- /package/dist/runtime/spreadsheet/types/{context.js → importer.js} +0 -0
- /package/dist/runtime/spreadsheet/types/{import.js → steps.js} +0 -0
- /package/dist/runtime/spreadsheet/types/{inference.js → values.js} +0 -0
|
@@ -1,88 +1,174 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type { SpreadsheetFieldRules, SpreadsheetRuleBuilder } from './validation.js';
|
|
1
|
+
import type { QueryKey } from '@tanstack/vue-query';
|
|
2
|
+
import type { QueryFunctionResult } from '#ui-tools/shared/types/query';
|
|
3
|
+
import type { MaybePromise } from '#ui-tools/shared/types/utils';
|
|
4
|
+
import type { SpreadsheetColumnsBuilder, SpreadsheetEntry, SpreadsheetFieldPath } from './columns.js';
|
|
5
|
+
import type { SpreadsheetIssueLevel, SpreadsheetPrettify, SpreadsheetRecord } from './shared.js';
|
|
7
6
|
export interface SpreadsheetFileDefinition {
|
|
7
|
+
/** Accepted extensions. Defaults to `.xlsx`, `.xls`, and `.csv`. */
|
|
8
8
|
accept?: readonly string[];
|
|
9
|
-
|
|
9
|
+
/** Rows past this number are left out with the reason `limit`. */
|
|
10
|
+
maxRows?: number;
|
|
11
|
+
/** `'auto'` (default): the sheet whose rows match the most columns. Otherwise a sheet name. */
|
|
12
|
+
sheet?: string;
|
|
13
|
+
/** `'auto'` (default): the row, among the first 20, matching the most columns. Or a 1-based row. */
|
|
14
|
+
headerRow?: 'auto' | number;
|
|
10
15
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
/** What happens to a row: created, updated from the file, or left as it is. */
|
|
17
|
+
export type SpreadsheetRowMode = 'create' | 'update' | 'skip';
|
|
18
|
+
/** What to do with a row whose key matches a stored record. */
|
|
19
|
+
export type SpreadsheetExistingAction = 'update' | 'skip' | 'error';
|
|
20
|
+
/** Value identifying a row: text, a number, or several of them for a key of several fields. */
|
|
21
|
+
export type SpreadsheetRowKey = string | number | readonly (string | number)[];
|
|
22
|
+
/** A query definition (with `queryKey` and `queryFn`) or a promise of the stored records. */
|
|
23
|
+
export type SpreadsheetLookupResult = {
|
|
24
|
+
queryKey: QueryKey;
|
|
25
|
+
} | MaybePromise<readonly unknown[]>;
|
|
26
|
+
/** Record type returned by a lookup, from a query definition or a promise. */
|
|
27
|
+
export type SpreadsheetLookupRecord<TResult> = unknown extends TResult ? unknown : TResult extends {
|
|
28
|
+
queryKey: QueryKey;
|
|
29
|
+
} ? QueryFunctionResult<TResult> extends readonly (infer TRecord)[] ? TRecord : never : Awaited<TResult> extends readonly (infer TRecord)[] ? TRecord : never;
|
|
30
|
+
export interface SpreadsheetExistingDefinition<TContext, TRow, TKeyValue, TLookup> {
|
|
31
|
+
/**
|
|
32
|
+
* Returns the stored records whose keys are in `keys`, in one query. Called again when the keys
|
|
33
|
+
* of the file change.
|
|
34
|
+
*/
|
|
35
|
+
lookup(params: {
|
|
36
|
+
keys: readonly TKeyValue[];
|
|
37
|
+
ctx: TContext;
|
|
38
|
+
}): TLookup;
|
|
39
|
+
/** Key of a stored record. Defaults to `rows.key` applied to the record. */
|
|
40
|
+
keyOf?(record: SpreadsheetLookupRecord<TLookup>): TKeyValue;
|
|
41
|
+
/**
|
|
42
|
+
* `update` (default) re-syncs the stored record, `skip` leaves it as it is, `error` blocks the
|
|
43
|
+
* row. A function decides per row, with the stored record at hand.
|
|
44
|
+
*/
|
|
45
|
+
action?: SpreadsheetExistingAction | {
|
|
46
|
+
bivarianceHack(params: {
|
|
47
|
+
row: TRow;
|
|
48
|
+
existing: SpreadsheetLookupRecord<TLookup>;
|
|
49
|
+
ctx: TContext;
|
|
50
|
+
}): SpreadsheetExistingAction;
|
|
51
|
+
}['bivarianceHack'];
|
|
14
52
|
}
|
|
15
|
-
export interface
|
|
16
|
-
|
|
53
|
+
export interface SpreadsheetRowsDefinition<TContext, TRow, TKeyValue, TLookup> {
|
|
54
|
+
/**
|
|
55
|
+
* Identifies a row, in the file and among stored records: `(row) => row.secureCode`, or a tuple
|
|
56
|
+
* for several fields. A row whose key is empty is not identified.
|
|
57
|
+
*/
|
|
58
|
+
key?(row: TRow): TKeyValue | null | undefined;
|
|
59
|
+
/** Two rows of the file with the same key. Defaults to `error`: both rows are blocked. */
|
|
60
|
+
duplicates?: 'error' | 'keep-first' | 'keep-last';
|
|
61
|
+
/** Rows whose key matches a stored record. */
|
|
62
|
+
existing?: SpreadsheetExistingDefinition<TContext, TRow, TKeyValue, TLookup>;
|
|
17
63
|
}
|
|
18
|
-
|
|
19
|
-
|
|
64
|
+
/** An issue raised by `validate`. */
|
|
65
|
+
export interface SpreadsheetIssueInput {
|
|
66
|
+
field: string;
|
|
67
|
+
message: string;
|
|
68
|
+
level: SpreadsheetIssueLevel;
|
|
69
|
+
code: string;
|
|
20
70
|
}
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
71
|
+
export type SpreadsheetIssueFactory<TRow> = (field: SpreadsheetFieldPath<TRow>, message: string, options?: {
|
|
72
|
+
level?: SpreadsheetIssueLevel;
|
|
73
|
+
code?: string;
|
|
74
|
+
}) => SpreadsheetIssueInput;
|
|
75
|
+
type SpreadsheetFalsy = false | null | undefined | 0 | '';
|
|
76
|
+
/**
|
|
77
|
+
* What `defineSpreadsheetSchema` receives. Declare `columns` before the callbacks that read rows:
|
|
78
|
+
* they are typed from it.
|
|
79
|
+
*/
|
|
80
|
+
export interface SpreadsheetSchemaDefinition<TContext, TRow, TKeyValue, TLookup, TOutput> {
|
|
81
|
+
/** Names the import: query keys and the memory of past answers. */
|
|
82
|
+
key: string;
|
|
83
|
+
file?: SpreadsheetFileDefinition;
|
|
84
|
+
/** The columns, chained: `(c) => c.text(…).select(…)`. */
|
|
85
|
+
columns(c: SpreadsheetColumnsBuilder<TContext, NonNullable<unknown>>): SpreadsheetColumnsBuilder<TContext, TRow>;
|
|
86
|
+
rows?: SpreadsheetRowsDefinition<TContext, SpreadsheetPrettify<TRow>, TKeyValue, TLookup>;
|
|
87
|
+
/** Rules across fields. Return issues, or falsy values to skip. */
|
|
88
|
+
validate?(params: {
|
|
89
|
+
row: SpreadsheetPrettify<TRow>;
|
|
90
|
+
ctx: TContext;
|
|
91
|
+
issue: SpreadsheetIssueFactory<SpreadsheetPrettify<TRow>>;
|
|
92
|
+
}): readonly (SpreadsheetIssueInput | SpreadsheetFalsy)[];
|
|
93
|
+
/** What `onSubmit` receives for each imported row. Defaults to the row. */
|
|
94
|
+
output?(params: {
|
|
95
|
+
row: SpreadsheetPrettify<TRow>;
|
|
96
|
+
mode: Exclude<SpreadsheetRowMode, 'skip'>;
|
|
97
|
+
existing: SpreadsheetLookupRecord<TLookup> | undefined;
|
|
98
|
+
ctx: TContext;
|
|
99
|
+
}): MaybePromise<TOutput>;
|
|
37
100
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
condition?: (row: TRow) => boolean;
|
|
43
|
-
rules: (rules: SpreadsheetRuleBuilder, row: TRow) => SpreadsheetFieldRules<SpreadsheetValueAtPath<TRow, TColumn>>;
|
|
101
|
+
/** A schema, as `defineSpreadsheetSchema` returns it. */
|
|
102
|
+
export interface SpreadsheetSchema<TContext = unknown, TRow = unknown, TKeyValue = unknown, TLookup = unknown, TOutput = unknown> extends SpreadsheetSchemaDefinition<TContext, TRow, TKeyValue, TLookup, TOutput> {
|
|
103
|
+
/** Type only. */
|
|
104
|
+
readonly '~context'?: TContext;
|
|
44
105
|
}
|
|
45
|
-
|
|
46
|
-
[TColumn in SpreadsheetRelationPath<TRow>]: SpreadsheetRelationDefinition<TRow, TColumn>;
|
|
47
|
-
}[SpreadsheetRelationPath<TRow>][];
|
|
48
|
-
export type SpreadsheetBuildRowDefinition<TContext = unknown, TRow = unknown> = (params: {
|
|
106
|
+
type SpreadsheetSchemaParts<TSchema> = TSchema extends SpreadsheetSchema<infer TContext, infer TRow, infer TKey, infer TLookup, infer TOutput> ? {
|
|
49
107
|
context: TContext;
|
|
50
108
|
row: TRow;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
columns?: TColumns;
|
|
61
|
-
references?: TReferences;
|
|
62
|
-
relations?: TRelations;
|
|
63
|
-
buildRow?: TBuildRow;
|
|
64
|
-
review?: SpreadsheetReviewStepDefinition;
|
|
65
|
-
}
|
|
66
|
-
export interface SpreadsheetSchemaRefinement<TRow> {
|
|
67
|
-
relations?: SpreadsheetRelationsDefinition<TRow>;
|
|
68
|
-
}
|
|
69
|
-
export type SpreadsheetSchemaWithRefine<TSchema extends {
|
|
70
|
-
importKey: string;
|
|
71
|
-
}> = TSchema & {
|
|
72
|
-
refine<const TRelations extends SpreadsheetRelationsDefinition<ExtractSpreadsheetValidationRow<TSchema>>>(refinement: {
|
|
73
|
-
relations: TRelations;
|
|
74
|
-
}): SpreadsheetSchemaWithRefine<TSchema & {
|
|
75
|
-
relations: SpreadsheetRelationsDefinition<ExtractSpreadsheetValidationRow<TSchema>>;
|
|
76
|
-
}>;
|
|
109
|
+
key: TKey;
|
|
110
|
+
lookup: TLookup;
|
|
111
|
+
output: TOutput;
|
|
112
|
+
} : {
|
|
113
|
+
context: unknown;
|
|
114
|
+
row: SpreadsheetRecord;
|
|
115
|
+
key: unknown;
|
|
116
|
+
lookup: unknown;
|
|
117
|
+
output: unknown;
|
|
77
118
|
};
|
|
78
|
-
export type
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
export type
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
119
|
+
export type ExtractSpreadsheetContext<TSchema> = SpreadsheetSchemaParts<TSchema>['context'];
|
|
120
|
+
export type ExtractSpreadsheetRow<TSchema> = SpreadsheetPrettify<SpreadsheetSchemaParts<TSchema>['row']>;
|
|
121
|
+
export type ExtractSpreadsheetOutput<TSchema> = SpreadsheetSchemaParts<TSchema>['output'];
|
|
122
|
+
export type ExtractSpreadsheetExisting<TSchema> = SpreadsheetLookupRecord<SpreadsheetSchemaParts<TSchema>['lookup']>;
|
|
123
|
+
export type ExtractSpreadsheetKeyValue<TSchema> = SpreadsheetSchemaParts<TSchema>['key'];
|
|
124
|
+
export type ExtractSpreadsheetFieldPath<TSchema> = SpreadsheetFieldPath<ExtractSpreadsheetRow<TSchema>>;
|
|
125
|
+
/**
|
|
126
|
+
* A schema as the runtime reads it: every type parameter erased. Any schema made by
|
|
127
|
+
* `defineSpreadsheetSchema` fits it, because its callbacks are declared as methods and the
|
|
128
|
+
* functions the runtime passes to them accept anything.
|
|
129
|
+
*/
|
|
130
|
+
export interface SpreadsheetRuntimeSchema {
|
|
131
|
+
readonly key: string;
|
|
132
|
+
readonly file?: SpreadsheetFileDefinition;
|
|
133
|
+
/** Receives the builder; typed loosely so that the builder of any context fits. */
|
|
134
|
+
columns(c: {
|
|
135
|
+
readonly '~entries': readonly SpreadsheetEntry[];
|
|
136
|
+
}): {
|
|
137
|
+
readonly '~entries': readonly SpreadsheetEntry[];
|
|
138
|
+
};
|
|
139
|
+
readonly rows?: {
|
|
140
|
+
key?(row: SpreadsheetRecord): unknown;
|
|
141
|
+
readonly duplicates?: 'error' | 'keep-first' | 'keep-last';
|
|
142
|
+
readonly existing?: {
|
|
143
|
+
lookup(params: {
|
|
144
|
+
keys: readonly unknown[];
|
|
145
|
+
ctx: unknown;
|
|
146
|
+
}): unknown;
|
|
147
|
+
keyOf?(record: unknown): unknown;
|
|
148
|
+
readonly action?: SpreadsheetExistingAction | {
|
|
149
|
+
bivarianceHack(params: {
|
|
150
|
+
row: SpreadsheetRecord;
|
|
151
|
+
existing: unknown;
|
|
152
|
+
ctx: unknown;
|
|
153
|
+
}): SpreadsheetExistingAction;
|
|
154
|
+
}['bivarianceHack'];
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
validate?(params: {
|
|
158
|
+
row: SpreadsheetRecord;
|
|
159
|
+
ctx: unknown;
|
|
160
|
+
issue: (field: never, message: string, options?: {
|
|
161
|
+
level?: SpreadsheetIssueLevel;
|
|
162
|
+
code?: string;
|
|
163
|
+
}) => SpreadsheetIssueInput;
|
|
164
|
+
}): readonly (SpreadsheetIssueInput | SpreadsheetFalsy)[];
|
|
165
|
+
output?(params: {
|
|
166
|
+
row: SpreadsheetRecord;
|
|
167
|
+
mode: Exclude<SpreadsheetRowMode, 'skip'>;
|
|
168
|
+
existing: unknown;
|
|
169
|
+
ctx: unknown;
|
|
170
|
+
}): unknown;
|
|
171
|
+
/** Type only. */
|
|
172
|
+
readonly '~context'?: unknown;
|
|
173
|
+
}
|
|
88
174
|
export {};
|
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import type { QueryFunction, QueryKey, UseQueryOptions } from '@tanstack/vue-query';
|
|
2
1
|
import type { GenericObject } from '#ui-tools/shared/types/utils';
|
|
3
|
-
/** Runtime
|
|
2
|
+
/** Runtime value read from a cell, a row, or the context. */
|
|
4
3
|
export type SpreadsheetValue = GenericObject[string];
|
|
5
|
-
/**
|
|
4
|
+
/** Row or context data decoded at runtime. */
|
|
6
5
|
export type SpreadsheetRecord = {
|
|
7
6
|
[key: string]: SpreadsheetValue;
|
|
8
7
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
/** Severity of an issue: only `error` keeps a row out of the import. */
|
|
9
|
+
export type SpreadsheetIssueLevel = 'info' | 'warning' | 'error';
|
|
10
|
+
/** One cell as a column parser receives it. */
|
|
11
|
+
export interface SpreadsheetCell {
|
|
12
|
+
/** Text as displayed in the file, trimmed. Edits made in review replace it. */
|
|
14
13
|
text: string;
|
|
14
|
+
/** Typed value when the file stores one (number, boolean, date), otherwise the text. */
|
|
15
15
|
raw: unknown;
|
|
16
|
+
/** Header of the column the cell comes from, or an empty string without a column. */
|
|
16
17
|
header: string;
|
|
17
|
-
|
|
18
|
+
/** 0-based index of the data row. */
|
|
18
19
|
rowIndex: number;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
/** A header cell of the selected sheet. */
|
|
22
|
+
export interface SpreadsheetHeaderCell {
|
|
23
|
+
/** 0-based column index in the sheet. */
|
|
21
24
|
index: number;
|
|
22
25
|
text: string;
|
|
26
|
+
/** Text used for exact matching: no case, accents, or repeated spaces. */
|
|
23
27
|
normalized: string;
|
|
24
28
|
}
|
|
25
|
-
|
|
26
|
-
export type
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
export
|
|
30
|
-
headers: readonly SpreadsheetHeaderMatcher[];
|
|
31
|
-
prefer?: 'first' | 'best-score';
|
|
32
|
-
minScore?: number;
|
|
33
|
-
required?: boolean;
|
|
34
|
-
}
|
|
35
|
-
export type SpreadsheetIssueLevel = 'info' | 'warning' | 'error';
|
|
29
|
+
/** Removes `readonly` from arrays and flattens intersections, for readable inferred types. */
|
|
30
|
+
export type SpreadsheetPrettify<T> = {
|
|
31
|
+
[K in keyof T]: T[K];
|
|
32
|
+
} & NonNullable<unknown>;
|
|
33
|
+
export type SpreadsheetUnionToIntersection<U> = (U extends unknown ? (value: U) => void : never) extends (value: infer I) => void ? I : never;
|
|
@@ -1,20 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
export interface
|
|
1
|
+
/** One sheet of a file: displayed text of each non-empty row, typed cell values, row numbers. */
|
|
2
|
+
export interface SpreadsheetSheet {
|
|
3
3
|
name: string;
|
|
4
|
-
rows
|
|
4
|
+
/** Text of each cell as displayed in the file, trimmed. Empty rows are left out. */
|
|
5
|
+
rows: readonly (readonly string[])[];
|
|
6
|
+
/** Typed values (number, boolean, `Date`) of each row, where the file stores one. */
|
|
7
|
+
raws: readonly (readonly unknown[] | undefined)[];
|
|
8
|
+
/** Row number in the file (1-based) of each row. */
|
|
9
|
+
rowNumbers: readonly number[];
|
|
5
10
|
}
|
|
6
|
-
export interface
|
|
7
|
-
|
|
8
|
-
sheets: readonly
|
|
11
|
+
export interface SpreadsheetWorkbook {
|
|
12
|
+
name: string;
|
|
13
|
+
sheets: readonly SpreadsheetSheet[];
|
|
14
|
+
}
|
|
15
|
+
/** What `importer.file.load` accepts. */
|
|
16
|
+
export type SpreadsheetFileSource = File | Blob | ArrayBuffer | Uint8Array;
|
|
17
|
+
/** A row of a sheet scored as a header row: how many columns of the schema its cells match. */
|
|
18
|
+
export interface SpreadsheetHeaderRowCandidate {
|
|
19
|
+
/** 0-based index among the sheet's rows. */
|
|
20
|
+
index: number;
|
|
21
|
+
rowNumber: number;
|
|
22
|
+
matchCount: number;
|
|
23
|
+
/** First non-empty cells of the row. */
|
|
24
|
+
preview: readonly string[];
|
|
9
25
|
}
|
|
10
|
-
export interface
|
|
11
|
-
|
|
12
|
-
|
|
26
|
+
export interface SpreadsheetSheetLayout {
|
|
27
|
+
name: string;
|
|
28
|
+
/** Best header row of the sheet. */
|
|
29
|
+
headerRow: number;
|
|
30
|
+
matchCount: number;
|
|
31
|
+
/** Data rows under the best header row. */
|
|
32
|
+
rowCount: number;
|
|
33
|
+
candidates: readonly SpreadsheetHeaderRowCandidate[];
|
|
13
34
|
}
|
|
14
|
-
export interface
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
35
|
+
export interface SpreadsheetLayoutDetection {
|
|
36
|
+
sheets: readonly SpreadsheetSheetLayout[];
|
|
37
|
+
best: {
|
|
38
|
+
sheet: string;
|
|
39
|
+
headerRow: number;
|
|
40
|
+
matchCount: number;
|
|
41
|
+
} | null;
|
|
42
|
+
/** Several sheets match equally well. */
|
|
43
|
+
ambiguous: boolean;
|
|
18
44
|
}
|
|
19
|
-
export type SpreadsheetBinarySource = ArrayBuffer | Uint8Array | Blob | File;
|
|
20
|
-
export type SpreadsheetBinaryRef = Ref<SpreadsheetBinarySource | null> | ComputedRef<SpreadsheetBinarySource | null>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { LazyTextValue } from '#ui-tools/shared/types/utils';
|
|
2
|
+
import type { SpreadsheetFieldStatus, SpreadsheetFileModel, SpreadsheetReadiness, SpreadsheetSubmitModel } from './importer.js';
|
|
3
|
+
/** What step checks read: the importer of any schema fits it. */
|
|
4
|
+
export interface SpreadsheetStepContext {
|
|
5
|
+
readonly file: Pick<SpreadsheetFileModel, 'loaded' | 'reading'>;
|
|
6
|
+
readonly columns: {
|
|
7
|
+
readonly missing: readonly unknown[];
|
|
8
|
+
readonly fields: readonly {
|
|
9
|
+
readonly status: SpreadsheetFieldStatus;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
readonly values: {
|
|
13
|
+
readonly open: readonly unknown[];
|
|
14
|
+
readonly questions: readonly unknown[];
|
|
15
|
+
};
|
|
16
|
+
readonly rows: {
|
|
17
|
+
readonly all: readonly unknown[];
|
|
18
|
+
readonly invalid: readonly unknown[];
|
|
19
|
+
};
|
|
20
|
+
readonly readiness: SpreadsheetReadiness;
|
|
21
|
+
readonly submit: Pick<SpreadsheetSubmitModel, 'status'>;
|
|
22
|
+
}
|
|
23
|
+
/** Keys of the built-in steps. */
|
|
24
|
+
export type SpreadsheetBuiltInStep = 'file' | 'columns' | 'values' | 'review' | 'submit';
|
|
25
|
+
/**
|
|
26
|
+
* A step of a wizard. Built-in steps come from `spreadsheetSteps.*`; a step of your own is the same
|
|
27
|
+
* object with its own `key`, label, and checks.
|
|
28
|
+
*/
|
|
29
|
+
export interface SpreadsheetStep {
|
|
30
|
+
key: string;
|
|
31
|
+
/** The built-in step this one is, for its default content. */
|
|
32
|
+
builtIn?: SpreadsheetBuiltInStep;
|
|
33
|
+
label?: LazyTextValue;
|
|
34
|
+
hint?: LazyTextValue;
|
|
35
|
+
/**
|
|
36
|
+
* `always` (default) shows the step; `when-needed` skips it when it has nothing to do, shown as
|
|
37
|
+
* done in the stepper.
|
|
38
|
+
*/
|
|
39
|
+
show?: 'always' | 'when-needed';
|
|
40
|
+
/** Whether the user can move on. Defaults to `true`. */
|
|
41
|
+
ready?: (importer: SpreadsheetStepContext) => boolean;
|
|
42
|
+
/** With `show: 'when-needed'`: whether the step has something to do. Defaults to `true`. */
|
|
43
|
+
needed?: (importer: SpreadsheetStepContext) => boolean;
|
|
44
|
+
/** What still blocks the step, shown next to the navigation. */
|
|
45
|
+
blockers?: (importer: SpreadsheetStepContext) => number;
|
|
46
|
+
}
|
|
47
|
+
export type SpreadsheetStepState = 'done' | 'current' | 'upcoming' | 'skipped';
|
|
48
|
+
/** A step with its state in the wizard. */
|
|
49
|
+
export interface SpreadsheetStepStatus {
|
|
50
|
+
key: string;
|
|
51
|
+
builtIn: SpreadsheetBuiltInStep | null;
|
|
52
|
+
label: LazyTextValue | undefined;
|
|
53
|
+
hint: LazyTextValue | undefined;
|
|
54
|
+
state: SpreadsheetStepState;
|
|
55
|
+
/** 1-based position among the steps. */
|
|
56
|
+
position: number;
|
|
57
|
+
ready: boolean;
|
|
58
|
+
skipped: boolean;
|
|
59
|
+
blockers: number;
|
|
60
|
+
}
|
|
61
|
+
export interface SpreadsheetSteps {
|
|
62
|
+
readonly list: readonly SpreadsheetStepStatus[];
|
|
63
|
+
/** Key of the current step. */
|
|
64
|
+
readonly current: string;
|
|
65
|
+
readonly step: SpreadsheetStepStatus | null;
|
|
66
|
+
readonly canNext: boolean;
|
|
67
|
+
readonly canBack: boolean;
|
|
68
|
+
readonly isLast: boolean;
|
|
69
|
+
/** Moves to the next step that is not skipped, when the current one is ready. */
|
|
70
|
+
next(): void;
|
|
71
|
+
back(): void;
|
|
72
|
+
/** Moves to a step before the current one, or to the current one. */
|
|
73
|
+
goTo(key: string): void;
|
|
74
|
+
/** Back to the first step. */
|
|
75
|
+
reset(): void;
|
|
76
|
+
}
|
|
@@ -1,76 +1,56 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} & TMeta);
|
|
6
|
-
export type SpreadsheetMessageContext<TValue, TParams extends unknown[] = [], TMeta extends SpreadsheetRecord = NonNullable<unknown>> = {
|
|
7
|
-
[key: string]: SpreadsheetRecord[string];
|
|
8
|
-
$valid?: boolean;
|
|
1
|
+
import type { LazyTextValue } from '#ui-tools/shared/types/utils';
|
|
2
|
+
import type { SpreadsheetIssueLevel } from './shared.js';
|
|
3
|
+
/** Message of a failed rule: text, lazy text, or a function of the value and the context. */
|
|
4
|
+
export type SpreadsheetRuleMessage<TValue, TContext = unknown> = LazyTextValue | ((params: {
|
|
9
5
|
value: TValue;
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
export interface
|
|
13
|
-
message?:
|
|
6
|
+
ctx: TContext;
|
|
7
|
+
}) => string);
|
|
8
|
+
export interface SpreadsheetRuleOptions<TValue, TContext = unknown> {
|
|
9
|
+
message?: SpreadsheetRuleMessage<TValue, TContext>;
|
|
10
|
+
/** `error` (default) keeps the row out of the import; `warning` and `info` only inform. */
|
|
11
|
+
level?: SpreadsheetIssueLevel;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
$meta: TMeta;
|
|
22
|
-
}
|
|
23
|
-
export interface SpreadsheetRule<TValue, TFlags extends SpreadsheetRuleFlags = SpreadsheetRuleFlags> {
|
|
24
|
-
readonly flags?: TFlags;
|
|
25
|
-
readonly $rule: true;
|
|
26
|
-
readonly name?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A rule checks one value. Rules run on non-empty values only, except `required`; on a column
|
|
15
|
+
* with `multiple`, they run on each item.
|
|
16
|
+
*/
|
|
17
|
+
export interface SpreadsheetRule<TValue> {
|
|
18
|
+
readonly name: string;
|
|
27
19
|
readonly level: SpreadsheetIssueLevel;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
/** The rule also runs on empty values. */
|
|
21
|
+
readonly required: boolean;
|
|
22
|
+
/** Returns the message when the value fails, `null` when it passes. */
|
|
23
|
+
check(value: TValue, context: {
|
|
24
|
+
ctx: unknown;
|
|
25
|
+
}): string | null;
|
|
31
26
|
}
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
export interface SpreadsheetRuleBuilder<TContext> {
|
|
28
|
+
/** The value must not be empty. Prefer the column's `required` flag unless you need a level. */
|
|
29
|
+
required: (options?: SpreadsheetRuleOptions<unknown, TContext>) => SpreadsheetRule<unknown>;
|
|
30
|
+
/** A rule of your own. */
|
|
31
|
+
validate: <TValue>(options: {
|
|
35
32
|
name?: string;
|
|
36
|
-
validator: (value: TValue
|
|
37
|
-
|
|
33
|
+
validator: (value: TValue, context: {
|
|
34
|
+
ctx: TContext;
|
|
35
|
+
}) => boolean;
|
|
36
|
+
message: SpreadsheetRuleMessage<TValue, TContext>;
|
|
37
|
+
level?: SpreadsheetIssueLevel;
|
|
38
38
|
}) => SpreadsheetRule<TValue>;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
maxLength:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
number: CreateSpreadsheetRuleReturn<number, [], NonNullable<unknown>>;
|
|
49
|
-
min: CreateSpreadsheetRuleReturn<number, [min: number], {
|
|
50
|
-
min: number;
|
|
51
|
-
}>;
|
|
52
|
-
max: CreateSpreadsheetRuleReturn<number, [max: number], {
|
|
53
|
-
max: number;
|
|
54
|
-
}>;
|
|
55
|
-
between: CreateSpreadsheetRuleReturn<number, [
|
|
56
|
-
min: number,
|
|
57
|
-
max: number
|
|
58
|
-
], {
|
|
59
|
-
min: number;
|
|
60
|
-
max: number;
|
|
61
|
-
}>;
|
|
62
|
-
oneOf: <const TValues extends readonly unknown[]>(values: TValues, overrides?: SpreadsheetRuleOverrides<SpreadsheetWidenLiteral<TValues[number]>, [
|
|
63
|
-
TValues
|
|
64
|
-
], {
|
|
65
|
-
values: TValues;
|
|
66
|
-
}>) => SpreadsheetRule<SpreadsheetWidenLiteral<TValues[number]>>;
|
|
39
|
+
email: (options?: SpreadsheetRuleOptions<string, TContext>) => SpreadsheetRule<string>;
|
|
40
|
+
pattern: (pattern: RegExp, options?: SpreadsheetRuleOptions<string, TContext>) => SpreadsheetRule<string>;
|
|
41
|
+
minLength: (min: number, options?: SpreadsheetRuleOptions<string, TContext>) => SpreadsheetRule<string>;
|
|
42
|
+
maxLength: (max: number, options?: SpreadsheetRuleOptions<string, TContext>) => SpreadsheetRule<string>;
|
|
43
|
+
min: (min: number, options?: SpreadsheetRuleOptions<number, TContext>) => SpreadsheetRule<number>;
|
|
44
|
+
max: (max: number, options?: SpreadsheetRuleOptions<number, TContext>) => SpreadsheetRule<number>;
|
|
45
|
+
between: (min: number, max: number, options?: SpreadsheetRuleOptions<number, TContext>) => SpreadsheetRule<number>;
|
|
46
|
+
/** ISO dates only: the date must not be after today. */
|
|
47
|
+
notFuture: (options?: SpreadsheetRuleOptions<string, TContext>) => SpreadsheetRule<string>;
|
|
67
48
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}) => CreateSpreadsheetRuleReturn<TValue, TParams, TMeta, TFlags>;
|
|
49
|
+
/**
|
|
50
|
+
* Rules of a column. The function form also receives the row so far (the columns declared before
|
|
51
|
+
* this one) and the context, for rules that depend on another column.
|
|
52
|
+
*/
|
|
53
|
+
export type SpreadsheetRulesInput<TValue, TContext, TRow = unknown> = readonly SpreadsheetRule<TValue>[] | ((rules: SpreadsheetRuleBuilder<TContext>, params: {
|
|
54
|
+
row: TRow;
|
|
55
|
+
ctx: TContext;
|
|
56
|
+
}) => readonly SpreadsheetRule<TValue>[]);
|