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
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { SpreadsheetUnknownPolicy } from './columns.js';
|
|
2
|
+
import type { SpreadsheetResolvedOption } from './options.js';
|
|
3
|
+
/** An answer to a value that is not an option; it applies to every row with the value. */
|
|
4
|
+
export type SpreadsheetValueAnswer = {
|
|
5
|
+
action: 'map';
|
|
6
|
+
value: unknown;
|
|
7
|
+
label: string;
|
|
8
|
+
} | {
|
|
9
|
+
action: 'leave-empty';
|
|
10
|
+
} | {
|
|
11
|
+
action: 'skip-rows';
|
|
12
|
+
} | {
|
|
13
|
+
action: 'create';
|
|
14
|
+
};
|
|
15
|
+
/** Answers by field path, then by answer key (see `SpreadsheetValueQuestion['key']`). */
|
|
16
|
+
export type SpreadsheetValueAnswers = Readonly<Record<string, Readonly<Record<string, SpreadsheetValueAnswer>>>>;
|
|
17
|
+
/** A field whose value decides the options, with its values in the rows of a question. */
|
|
18
|
+
export interface SpreadsheetValueScopeField {
|
|
19
|
+
field: string;
|
|
20
|
+
label: string;
|
|
21
|
+
/** Distinct values, as displayed. */
|
|
22
|
+
values: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The set of options a value was checked against, when a column's options depend on the row
|
|
26
|
+
* (`options: ({ row }) => …`). The same value is asked once per set of options.
|
|
27
|
+
*/
|
|
28
|
+
export interface SpreadsheetValueScope {
|
|
29
|
+
id: string;
|
|
30
|
+
/** Fields the options read, with their values in the question's rows: `Product: English`. */
|
|
31
|
+
dependsOn: readonly SpreadsheetValueScopeField[];
|
|
32
|
+
}
|
|
33
|
+
/** One distinct value of a select column that matches no option. */
|
|
34
|
+
export interface SpreadsheetValueQuestion<TPath extends string = string> {
|
|
35
|
+
/** `field::key` */
|
|
36
|
+
id: string;
|
|
37
|
+
field: TPath;
|
|
38
|
+
fieldLabel: string;
|
|
39
|
+
/** Value as written in the file (first occurrence). */
|
|
40
|
+
value: string;
|
|
41
|
+
/** The answer key: the normalized value, prefixed by the scope id when there is a scope. */
|
|
42
|
+
key: string;
|
|
43
|
+
/** Set of options the value was checked against, when they depend on the row. */
|
|
44
|
+
scope: SpreadsheetValueScope | null;
|
|
45
|
+
/** Options the value can map to. Empty for a remote list: search it. */
|
|
46
|
+
choices: readonly SpreadsheetResolvedOption[];
|
|
47
|
+
/** Header of the column the value comes from. */
|
|
48
|
+
header: string;
|
|
49
|
+
/** Indexes of the rows using the value. */
|
|
50
|
+
rows: readonly number[];
|
|
51
|
+
state: 'open' | 'answered';
|
|
52
|
+
answer: SpreadsheetValueAnswer | null;
|
|
53
|
+
/** `policy` when the column's `unknown` policy answered. */
|
|
54
|
+
answeredBy: 'user' | 'policy' | null;
|
|
55
|
+
policy: SpreadsheetUnknownPolicy;
|
|
56
|
+
/** The column can create new values. */
|
|
57
|
+
canCreate: boolean;
|
|
58
|
+
/** Choices come from a remote search rather than a list. */
|
|
59
|
+
remote: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** A distinct value of a select column that matched an option. */
|
|
62
|
+
export interface SpreadsheetRecognizedValue<TPath extends string = string> {
|
|
63
|
+
field: TPath;
|
|
64
|
+
value: string;
|
|
65
|
+
/** Id of the set of options, when they depend on the row. */
|
|
66
|
+
scope: string | null;
|
|
67
|
+
option: SpreadsheetResolvedOption;
|
|
68
|
+
rows: readonly number[];
|
|
69
|
+
}
|
|
70
|
+
/** Options of a select field, resolved and indexed for exact matching. */
|
|
71
|
+
export interface SpreadsheetFieldOptions {
|
|
72
|
+
status: 'loading' | 'ready' | 'error';
|
|
73
|
+
options: readonly SpreadsheetResolvedOption[];
|
|
74
|
+
index: ReadonlyMap<string, SpreadsheetResolvedOption>;
|
|
75
|
+
remote: boolean;
|
|
76
|
+
error: unknown;
|
|
77
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SpreadsheetField, SpreadsheetFieldOptions, SpreadsheetRowIssue } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The rows as they are in the file, edits included, with an extra column listing their issues, so
|
|
4
|
+
* they can be fixed and imported again.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createSpreadsheetIssuesWorkbook(params: {
|
|
7
|
+
headers: readonly string[];
|
|
8
|
+
rows: readonly {
|
|
9
|
+
cells: readonly string[];
|
|
10
|
+
issues: readonly SpreadsheetRowIssue[];
|
|
11
|
+
}[];
|
|
12
|
+
issuesHeader: string;
|
|
13
|
+
labels: ReadonlyMap<string, string>;
|
|
14
|
+
}): Blob;
|
|
15
|
+
/**
|
|
16
|
+
* The file to fill in: one column per field that reads its own column, named by its first declared
|
|
17
|
+
* header, and a sheet describing each column and its allowed values.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createSpreadsheetTemplateWorkbook(params: {
|
|
20
|
+
fields: readonly SpreadsheetField[];
|
|
21
|
+
options: ReadonlyMap<string, SpreadsheetFieldOptions>;
|
|
22
|
+
sheetName: string;
|
|
23
|
+
guideName: string;
|
|
24
|
+
guideHeaders: readonly [column: string, required: string, allowed: string, description: string];
|
|
25
|
+
yes: string;
|
|
26
|
+
}): Blob;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { utils, write } from "xlsx";
|
|
2
|
+
const XLSX_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
3
|
+
function toBlob(sheets) {
|
|
4
|
+
const workbook = utils.book_new();
|
|
5
|
+
for (const sheet of sheets)
|
|
6
|
+
utils.book_append_sheet(
|
|
7
|
+
workbook,
|
|
8
|
+
utils.aoa_to_sheet(sheet.rows.map((row) => [...row])),
|
|
9
|
+
sheet.name.slice(0, 31)
|
|
10
|
+
);
|
|
11
|
+
const binary = write(workbook, { bookType: "xlsx", type: "array" });
|
|
12
|
+
return new Blob([binary], { type: XLSX_TYPE });
|
|
13
|
+
}
|
|
14
|
+
export function createSpreadsheetIssuesWorkbook(params) {
|
|
15
|
+
return toBlob([
|
|
16
|
+
{
|
|
17
|
+
name: "Rows",
|
|
18
|
+
rows: [
|
|
19
|
+
[...params.headers, params.issuesHeader],
|
|
20
|
+
...params.rows.map((row) => [
|
|
21
|
+
...row.cells,
|
|
22
|
+
row.issues.map(
|
|
23
|
+
(issue) => issue.field ? `${params.labels.get(issue.field) ?? issue.field}: ${issue.message}` : issue.message
|
|
24
|
+
).join("\n")
|
|
25
|
+
])
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
export function createSpreadsheetTemplateWorkbook(params) {
|
|
31
|
+
const fields = params.fields.filter((field) => !field.select?.from);
|
|
32
|
+
return toBlob([
|
|
33
|
+
{
|
|
34
|
+
name: params.sheetName,
|
|
35
|
+
rows: [fields.map((field) => field.name), fields.map((field) => field.example)]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: params.guideName,
|
|
39
|
+
rows: [
|
|
40
|
+
[...params.guideHeaders],
|
|
41
|
+
...fields.map((field) => [
|
|
42
|
+
field.name,
|
|
43
|
+
field.required ? params.yes : "",
|
|
44
|
+
(params.options.get(field.path)?.options ?? []).slice(0, 50).map((option) => option.label).join(", "),
|
|
45
|
+
field.description
|
|
46
|
+
])
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { UiToolsTranslator } from '#ui-tools/i18n';
|
|
2
|
+
import type { SpreadsheetEntry, SpreadsheetField, SpreadsheetFieldGroup, SpreadsheetRecord } from '../types/index.js';
|
|
3
|
+
/** `secureCode` → `Secure code`. */
|
|
4
|
+
export declare function humanizeSpreadsheetKey(key: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Paths of the row a function reads, found by running it on a recording row. Reading a missing
|
|
7
|
+
* value returns a recording object too, so `row.levels.general` is seen whole; converting one to
|
|
8
|
+
* text gives `''`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function recordSpreadsheetRowReads(read: (row: SpreadsheetRecord) => unknown): {
|
|
11
|
+
paths: Set<string>;
|
|
12
|
+
result: unknown;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Resolves the schema's columns for a context: groups are flattened into field paths, dynamic
|
|
16
|
+
* groups get one column per item, columns and groups whose `when` returns `false` are left out,
|
|
17
|
+
* and texts, rules, and options depending on the row are resolved.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveSpreadsheetFields(params: {
|
|
20
|
+
entries: readonly SpreadsheetEntry[];
|
|
21
|
+
ctx: unknown;
|
|
22
|
+
t: UiToolsTranslator;
|
|
23
|
+
}): {
|
|
24
|
+
fields: SpreadsheetField[];
|
|
25
|
+
groups: SpreadsheetFieldGroup[];
|
|
26
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { resolveTextValue } from "#ui-tools/shared/utils/render";
|
|
2
|
+
import { createSpreadsheetColumnFactory } from "../schema/builder.js";
|
|
3
|
+
import {
|
|
4
|
+
isSpreadsheetMatcherList,
|
|
5
|
+
isSpreadsheetOptionList,
|
|
6
|
+
isSpreadsheetOptionsResolver,
|
|
7
|
+
isSpreadsheetRowCallback,
|
|
8
|
+
isSpreadsheetRuleList
|
|
9
|
+
} from "./guards.js";
|
|
10
|
+
import { isSpreadsheetRecord } from "./paths.js";
|
|
11
|
+
import { createSpreadsheetRuleBuilder } from "./rules.js";
|
|
12
|
+
const DEFAULT_TRUE = ["yes", "y", "oui", "o", "true", "vrai", "x", "1"];
|
|
13
|
+
const DEFAULT_FALSE = ["no", "n", "non", "false", "faux", "0"];
|
|
14
|
+
export function humanizeSpreadsheetKey(key) {
|
|
15
|
+
const words = key.replaceAll(/([a-z\d])([A-Z])/gu, "$1 $2").replaceAll(/[_-]+/gu, " ").trim().toLowerCase();
|
|
16
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
17
|
+
}
|
|
18
|
+
function isOptionsConfig(input) {
|
|
19
|
+
return isSpreadsheetRecord(input) && "source" in input && !("queryKey" in input) && !("load" in input);
|
|
20
|
+
}
|
|
21
|
+
function toMatchers(value) {
|
|
22
|
+
if (value === void 0) return [];
|
|
23
|
+
return isSpreadsheetMatcherList(value) ? value : [value];
|
|
24
|
+
}
|
|
25
|
+
function resolveRules(column, t, ctx) {
|
|
26
|
+
const rules = column.config.rules;
|
|
27
|
+
if (!rules) return { rulesOf: () => [], staticRules: true };
|
|
28
|
+
if (isSpreadsheetRuleList(rules)) return { rulesOf: () => rules, staticRules: true };
|
|
29
|
+
const builder = createSpreadsheetRuleBuilder(t);
|
|
30
|
+
if (rules.length >= 2)
|
|
31
|
+
return { rulesOf: (row) => rules(builder, { ctx, row }), staticRules: false };
|
|
32
|
+
const resolved = rules(builder, { ctx, row: {} });
|
|
33
|
+
return { rulesOf: () => resolved, staticRules: true };
|
|
34
|
+
}
|
|
35
|
+
export function recordSpreadsheetRowReads(read) {
|
|
36
|
+
const paths = /* @__PURE__ */ new Set();
|
|
37
|
+
function record(prefix) {
|
|
38
|
+
return new Proxy(
|
|
39
|
+
{},
|
|
40
|
+
{
|
|
41
|
+
get(_, property) {
|
|
42
|
+
if (property === Symbol.toPrimitive) return () => "";
|
|
43
|
+
if (typeof property !== "string") return void 0;
|
|
44
|
+
const path = prefix ? `${prefix}.${property}` : property;
|
|
45
|
+
paths.add(path);
|
|
46
|
+
return record(path);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
let result = void 0;
|
|
52
|
+
try {
|
|
53
|
+
result = read(record(""));
|
|
54
|
+
} catch {
|
|
55
|
+
}
|
|
56
|
+
return { paths, result };
|
|
57
|
+
}
|
|
58
|
+
function resolveRowOptions(params) {
|
|
59
|
+
const source = params.source;
|
|
60
|
+
if (!isSpreadsheetOptionsResolver(source)) return null;
|
|
61
|
+
const { paths, result } = recordSpreadsheetRowReads((row) => source({ ctx: params.ctx, row }));
|
|
62
|
+
if (!paths.size) return null;
|
|
63
|
+
if (result !== void 0 && !isSpreadsheetOptionList(result))
|
|
64
|
+
throw new Error(`[spreadsheet] "${params.path}" reads the row: its options must be a list.`);
|
|
65
|
+
return {
|
|
66
|
+
dependsOn: params.fieldPaths.filter((path) => paths.has(path)),
|
|
67
|
+
resolve: (row) => {
|
|
68
|
+
const resolved = source({ ctx: params.ctx, row });
|
|
69
|
+
return isSpreadsheetOptionList(resolved) ? resolved : [];
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function resolveColumn(params) {
|
|
74
|
+
const { column, ctx } = params;
|
|
75
|
+
const config = column.config;
|
|
76
|
+
const path = params.parent ? `${params.parent}.${column.key}` : column.key;
|
|
77
|
+
const label = resolveTextValue(config.label, humanizeSpreadsheetKey(column.key));
|
|
78
|
+
const declared = toMatchers(config.headers);
|
|
79
|
+
const headers = [label, column.key, ...declared];
|
|
80
|
+
const name = declared.find((matcher) => typeof matcher === "string");
|
|
81
|
+
const fallback = config.default;
|
|
82
|
+
const defaultOf = fallback === void 0 ? null : isSpreadsheetRowCallback(fallback) ? (row) => fallback({ ctx, row }) : () => fallback;
|
|
83
|
+
const multiple = config.multiple;
|
|
84
|
+
const separator = multiple === true ? "," : multiple ? multiple.separator ?? "," : null;
|
|
85
|
+
let select = null;
|
|
86
|
+
if (column.kind === "select" && config.options) {
|
|
87
|
+
const options = config.options;
|
|
88
|
+
const create = isOptionsConfig(options) ? options.create ?? null : null;
|
|
89
|
+
const unknown = config.unknown ?? "ask";
|
|
90
|
+
if (unknown === "create" && !create)
|
|
91
|
+
throw new Error(`[spreadsheet] "${path}" sets unknown: 'create' without options.create.`);
|
|
92
|
+
const source = isOptionsConfig(options) ? options.source : options;
|
|
93
|
+
select = {
|
|
94
|
+
create,
|
|
95
|
+
from: config.from ?? null,
|
|
96
|
+
rowOptions: resolveRowOptions({ ctx, fieldPaths: params.fieldPaths, path, source }),
|
|
97
|
+
source,
|
|
98
|
+
unknown
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
decimal: config.decimal ?? ".",
|
|
103
|
+
defaultOf,
|
|
104
|
+
description: resolveTextValue(config.description),
|
|
105
|
+
editable: config.editable ?? true,
|
|
106
|
+
example: resolveTextValue(config.example),
|
|
107
|
+
falseTexts: config.false ?? DEFAULT_FALSE,
|
|
108
|
+
formats: config.formats ?? [],
|
|
109
|
+
group: params.group,
|
|
110
|
+
hasDefault: fallback !== void 0,
|
|
111
|
+
headers,
|
|
112
|
+
kind: column.kind,
|
|
113
|
+
label,
|
|
114
|
+
name: typeof name === "string" ? name : label,
|
|
115
|
+
parse: config.parse ?? null,
|
|
116
|
+
path,
|
|
117
|
+
required: config.required ?? false,
|
|
118
|
+
...resolveRules(column, params.t, ctx),
|
|
119
|
+
select,
|
|
120
|
+
separator,
|
|
121
|
+
trueTexts: config.true ?? DEFAULT_TRUE
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function buildDynamicColumns(entry, ctx) {
|
|
125
|
+
const factory = createSpreadsheetColumnFactory();
|
|
126
|
+
return entry.config.items({ ctx }).map((item) => entry.config.column(item, factory));
|
|
127
|
+
}
|
|
128
|
+
export function resolveSpreadsheetFields(params) {
|
|
129
|
+
const fields = [];
|
|
130
|
+
const groups = [];
|
|
131
|
+
const visible = (entry) => !entry.config.when || entry.config.when({ ctx: params.ctx });
|
|
132
|
+
function add(column, parent, group) {
|
|
133
|
+
if (!visible(column)) return;
|
|
134
|
+
fields.push(
|
|
135
|
+
resolveColumn({
|
|
136
|
+
column,
|
|
137
|
+
ctx: params.ctx,
|
|
138
|
+
fieldPaths: fields.map((field) => field.path),
|
|
139
|
+
group,
|
|
140
|
+
parent,
|
|
141
|
+
t: params.t
|
|
142
|
+
})
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
for (const entry of params.entries) {
|
|
146
|
+
if (entry.entry === "column") {
|
|
147
|
+
add(entry, "", null);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (!visible(entry)) continue;
|
|
151
|
+
const group = {
|
|
152
|
+
description: resolveTextValue(entry.config.description),
|
|
153
|
+
dynamic: entry.entry === "dynamic",
|
|
154
|
+
label: resolveTextValue(entry.config.label, humanizeSpreadsheetKey(entry.key)),
|
|
155
|
+
path: entry.key
|
|
156
|
+
};
|
|
157
|
+
groups.push(group);
|
|
158
|
+
const columns = entry.entry === "group" ? entry.children : buildDynamicColumns(entry, params.ctx);
|
|
159
|
+
for (const column of columns) add(column, entry.key, group);
|
|
160
|
+
}
|
|
161
|
+
for (const [index, field] of fields.entries()) {
|
|
162
|
+
const from = field.select?.from;
|
|
163
|
+
if (from && !fields.slice(0, index).some((other) => other.path === from))
|
|
164
|
+
throw new Error(
|
|
165
|
+
`[spreadsheet] "${field.path}" reads from "${from}", which is not a column above.`
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
return { fields, groups };
|
|
169
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SpreadsheetContextCallback, SpreadsheetHeaderMatcher, SpreadsheetRowCallback, SpreadsheetOptionEntry, SpreadsheetOptionItem, SpreadsheetOptionsResolver, SpreadsheetOptionsSource, SpreadsheetRule, SpreadsheetRuleBuilder, SpreadsheetRuleMessage, SpreadsheetRecord, SpreadsheetRowKey } from '../types/index.js';
|
|
2
|
+
export declare function isSpreadsheetContextCallback<TResult>(value: unknown): value is SpreadsheetContextCallback<unknown, TResult>;
|
|
3
|
+
export declare function isSpreadsheetRowCallback<TResult>(value: unknown): value is SpreadsheetRowCallback<unknown, SpreadsheetRecord, TResult>;
|
|
4
|
+
export declare function isSpreadsheetRuleList(value: readonly SpreadsheetRule<unknown>[] | {
|
|
5
|
+
bivarianceHack(rules: SpreadsheetRuleBuilder<unknown>, params: {
|
|
6
|
+
row: unknown;
|
|
7
|
+
ctx: unknown;
|
|
8
|
+
}): readonly SpreadsheetRule<unknown>[];
|
|
9
|
+
}['bivarianceHack']): value is readonly SpreadsheetRule<unknown>[];
|
|
10
|
+
export declare function isSpreadsheetMatcherList(value: SpreadsheetHeaderMatcher | readonly SpreadsheetHeaderMatcher[]): value is readonly SpreadsheetHeaderMatcher[];
|
|
11
|
+
export declare function isSpreadsheetOptionsResolver(value: SpreadsheetOptionsSource<unknown, SpreadsheetOptionItem, unknown>): value is SpreadsheetOptionsResolver<unknown, SpreadsheetOptionItem, unknown>;
|
|
12
|
+
export declare function isSpreadsheetOptionList(value: unknown): value is readonly SpreadsheetOptionItem[];
|
|
13
|
+
export declare function isSpreadsheetOptionEntry(value: SpreadsheetOptionItem): value is SpreadsheetOptionEntry;
|
|
14
|
+
export declare function isSpreadsheetMessageFunction<TValue>(value: SpreadsheetRuleMessage<TValue, unknown>): value is (params: {
|
|
15
|
+
value: TValue;
|
|
16
|
+
ctx: unknown;
|
|
17
|
+
}) => string;
|
|
18
|
+
export declare function isSpreadsheetKeyTuple(value: SpreadsheetRowKey): value is readonly (string | number)[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function isSpreadsheetContextCallback(value) {
|
|
2
|
+
return typeof value === "function";
|
|
3
|
+
}
|
|
4
|
+
export function isSpreadsheetRowCallback(value) {
|
|
5
|
+
return typeof value === "function";
|
|
6
|
+
}
|
|
7
|
+
export function isSpreadsheetRuleList(value) {
|
|
8
|
+
return Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
export function isSpreadsheetMatcherList(value) {
|
|
11
|
+
return Array.isArray(value);
|
|
12
|
+
}
|
|
13
|
+
export function isSpreadsheetOptionsResolver(value) {
|
|
14
|
+
return typeof value === "function";
|
|
15
|
+
}
|
|
16
|
+
export function isSpreadsheetOptionList(value) {
|
|
17
|
+
return Array.isArray(value);
|
|
18
|
+
}
|
|
19
|
+
export function isSpreadsheetOptionEntry(value) {
|
|
20
|
+
return typeof value === "object" && value !== null && "value" in value;
|
|
21
|
+
}
|
|
22
|
+
export function isSpreadsheetMessageFunction(value) {
|
|
23
|
+
return typeof value === "function";
|
|
24
|
+
}
|
|
25
|
+
export function isSpreadsheetKeyTuple(value) {
|
|
26
|
+
return Array.isArray(value);
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SpreadsheetField, SpreadsheetHeaderCell } from '../types/index.js';
|
|
2
|
+
export declare function createSpreadsheetHeaderCells(row: readonly string[]): SpreadsheetHeaderCell[];
|
|
3
|
+
/** Whether a header is one of the field's declared names. */
|
|
4
|
+
export declare function isSpreadsheetHeaderOf(field: SpreadsheetField, header: SpreadsheetHeaderCell, ctx: unknown): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Assigns a column to each field that reads its own column. Choices made by the user come first
|
|
7
|
+
* (`null` leaves the field out); then each field takes the first free header that is one of its
|
|
8
|
+
* names. Nothing is guessed.
|
|
9
|
+
*/
|
|
10
|
+
export declare function matchSpreadsheetHeaders(params: {
|
|
11
|
+
fields: readonly SpreadsheetField[];
|
|
12
|
+
headers: readonly SpreadsheetHeaderCell[];
|
|
13
|
+
ctx: unknown;
|
|
14
|
+
manual?: Readonly<Record<string, number | null>>;
|
|
15
|
+
}): Map<string, number>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isFunction, isString } from "#ui-tools/shared/utils/predicate";
|
|
2
|
+
import { normalizeSpreadsheetText } from "./text.js";
|
|
3
|
+
export function createSpreadsheetHeaderCells(row) {
|
|
4
|
+
return row.map((text, index) => ({ index, normalized: normalizeSpreadsheetText(text), text }));
|
|
5
|
+
}
|
|
6
|
+
function matchesHeader(matcher, header, ctx) {
|
|
7
|
+
if (isString(matcher)) return normalizeSpreadsheetText(matcher) === header.normalized;
|
|
8
|
+
if (matcher instanceof RegExp) {
|
|
9
|
+
matcher.lastIndex = 0;
|
|
10
|
+
return matcher.test(header.text);
|
|
11
|
+
}
|
|
12
|
+
return isFunction(matcher) ? matcher({ ctx, header }) : false;
|
|
13
|
+
}
|
|
14
|
+
export function isSpreadsheetHeaderOf(field, header, ctx) {
|
|
15
|
+
return Boolean(header.normalized) && field.headers.some((matcher) => matchesHeader(matcher, header, ctx));
|
|
16
|
+
}
|
|
17
|
+
export function matchSpreadsheetHeaders(params) {
|
|
18
|
+
const matches = /* @__PURE__ */ new Map();
|
|
19
|
+
const used = /* @__PURE__ */ new Set();
|
|
20
|
+
const manual = params.manual ?? {};
|
|
21
|
+
for (const [path, index] of Object.entries(manual)) {
|
|
22
|
+
if (index === null || used.has(index)) continue;
|
|
23
|
+
matches.set(path, index);
|
|
24
|
+
used.add(index);
|
|
25
|
+
}
|
|
26
|
+
for (const field of params.fields) {
|
|
27
|
+
if (field.select?.from || field.path in manual) continue;
|
|
28
|
+
const header = params.headers.find(
|
|
29
|
+
(candidate) => !used.has(candidate.index) && isSpreadsheetHeaderOf(field, candidate, params.ctx)
|
|
30
|
+
);
|
|
31
|
+
if (!header) continue;
|
|
32
|
+
matches.set(field.path, header.index);
|
|
33
|
+
used.add(header.index);
|
|
34
|
+
}
|
|
35
|
+
return matches;
|
|
36
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SpreadsheetExistingAction, SpreadsheetRecord } from '../types/index.js';
|
|
2
|
+
/** Text form of a row key, used to compare keys; `null` when the key is empty. */
|
|
3
|
+
export declare function serializeSpreadsheetRowKey(value: unknown): string | null;
|
|
4
|
+
/**
|
|
5
|
+
* Field paths a key function reads, found by running it on a recording copy of a row. Duplicate
|
|
6
|
+
* issues are attached to these cells.
|
|
7
|
+
*/
|
|
8
|
+
export declare function detectSpreadsheetKeyFields(key: (row: SpreadsheetRecord) => unknown, sample: SpreadsheetRecord): string[];
|
|
9
|
+
/** Fields of a row whose value differs from the stored record, for the fields the record has. */
|
|
10
|
+
export declare function diffSpreadsheetRow(params: {
|
|
11
|
+
paths: readonly string[];
|
|
12
|
+
data: SpreadsheetRecord;
|
|
13
|
+
existing: unknown;
|
|
14
|
+
}): string[];
|
|
15
|
+
export declare function resolveSpreadsheetExistingAction(params: {
|
|
16
|
+
action: SpreadsheetExistingAction | ((params: {
|
|
17
|
+
row: SpreadsheetRecord;
|
|
18
|
+
existing: unknown;
|
|
19
|
+
ctx: unknown;
|
|
20
|
+
}) => SpreadsheetExistingAction) | undefined;
|
|
21
|
+
row: SpreadsheetRecord;
|
|
22
|
+
existing: unknown;
|
|
23
|
+
ctx: unknown;
|
|
24
|
+
}): SpreadsheetExistingAction;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { isSpreadsheetKeyTuple } from "./guards.js";
|
|
2
|
+
import { getSpreadsheetPathValue, isSpreadsheetRecord } from "./paths.js";
|
|
3
|
+
import { toSpreadsheetText } from "./text.js";
|
|
4
|
+
function isRowKey(value) {
|
|
5
|
+
if (typeof value === "string") return value.trim() !== "";
|
|
6
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
7
|
+
return Array.isArray(value) && value.length > 0 && value.every(
|
|
8
|
+
(part) => typeof part === "string" && part.trim() !== "" || typeof part === "number"
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
export function serializeSpreadsheetRowKey(value) {
|
|
12
|
+
if (!isRowKey(value)) return null;
|
|
13
|
+
if (isSpreadsheetKeyTuple(value))
|
|
14
|
+
return JSON.stringify(value.map((part) => normalizeKeyPart(part)));
|
|
15
|
+
return normalizeKeyPart(value);
|
|
16
|
+
}
|
|
17
|
+
function normalizeKeyPart(value) {
|
|
18
|
+
return typeof value === "number" ? String(value) : value.trim().toLowerCase();
|
|
19
|
+
}
|
|
20
|
+
export function detectSpreadsheetKeyFields(key, sample) {
|
|
21
|
+
const paths = /* @__PURE__ */ new Set();
|
|
22
|
+
function record(target, prefix) {
|
|
23
|
+
return new Proxy(target, {
|
|
24
|
+
get(object, property) {
|
|
25
|
+
if (typeof property !== "string") return void 0;
|
|
26
|
+
const path = prefix ? `${prefix}.${property}` : property;
|
|
27
|
+
const value = object[property];
|
|
28
|
+
if (isSpreadsheetRecord(value)) return record(value, path);
|
|
29
|
+
paths.add(path);
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
key(record(sample, ""));
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
return [...paths];
|
|
39
|
+
}
|
|
40
|
+
export function diffSpreadsheetRow(params) {
|
|
41
|
+
if (!isSpreadsheetRecord(params.existing)) return [];
|
|
42
|
+
const existing = params.existing;
|
|
43
|
+
return params.paths.filter((path) => {
|
|
44
|
+
const stored = getSpreadsheetPathValue(existing, path);
|
|
45
|
+
if (stored === void 0) return false;
|
|
46
|
+
return format(stored) !== format(getSpreadsheetPathValue(params.data, path));
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function format(value) {
|
|
50
|
+
if (Array.isArray(value)) return value.map(format).join(", ");
|
|
51
|
+
return toSpreadsheetText(value);
|
|
52
|
+
}
|
|
53
|
+
export function resolveSpreadsheetExistingAction(params) {
|
|
54
|
+
if (!params.action) return "update";
|
|
55
|
+
if (typeof params.action === "string") return params.action;
|
|
56
|
+
return params.action({ ctx: params.ctx, existing: params.existing, row: params.row });
|
|
57
|
+
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
1
|
+
export * from './export.js';
|
|
2
|
+
export * from './fields.js';
|
|
3
|
+
export * from './guards.js';
|
|
4
|
+
export * from './headers.js';
|
|
5
|
+
export * from './identity.js';
|
|
6
|
+
export * from './layout.js';
|
|
7
|
+
export * from './options.js';
|
|
8
|
+
export * from './parse.js';
|
|
9
|
+
export * from './paths.js';
|
|
10
|
+
export * from './rows.js';
|
|
11
|
+
export * from './rules.js';
|
|
12
|
+
export * from './suggestions.js';
|
|
13
|
+
export * from './text.js';
|
|
14
|
+
export * from './workbook.js';
|
|
15
|
+
export * from './download.js';
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
1
|
+
export * from "./export.js";
|
|
2
|
+
export * from "./fields.js";
|
|
3
|
+
export * from "./guards.js";
|
|
4
|
+
export * from "./headers.js";
|
|
5
|
+
export * from "./identity.js";
|
|
6
|
+
export * from "./layout.js";
|
|
7
|
+
export * from "./options.js";
|
|
8
|
+
export * from "./parse.js";
|
|
9
|
+
export * from "./paths.js";
|
|
10
|
+
export * from "./rows.js";
|
|
11
|
+
export * from "./rules.js";
|
|
12
|
+
export * from "./suggestions.js";
|
|
13
|
+
export * from "./text.js";
|
|
14
|
+
export * from "./workbook.js";
|
|
15
|
+
export * from "./download.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SpreadsheetField, SpreadsheetLayoutDetection, SpreadsheetWorkbook } from '../types/index.js';
|
|
2
|
+
/** Rows scanned per sheet when looking for the header row. */
|
|
3
|
+
export declare const SPREADSHEET_HEADER_SCAN_ROWS = 20;
|
|
4
|
+
/**
|
|
5
|
+
* Scores the first rows of every sheet by how many fields their cells name. The best row of a
|
|
6
|
+
* sheet is its header row; the best sheet wins. Title rows and empty sheets score zero.
|
|
7
|
+
*/
|
|
8
|
+
export declare function detectSpreadsheetLayout(params: {
|
|
9
|
+
workbook: SpreadsheetWorkbook;
|
|
10
|
+
fields: readonly SpreadsheetField[];
|
|
11
|
+
ctx: unknown;
|
|
12
|
+
}): SpreadsheetLayoutDetection;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createSpreadsheetHeaderCells, matchSpreadsheetHeaders } from "./headers.js";
|
|
2
|
+
export const SPREADSHEET_HEADER_SCAN_ROWS = 20;
|
|
3
|
+
export function detectSpreadsheetLayout(params) {
|
|
4
|
+
const sheets = params.workbook.sheets.map((sheet) => {
|
|
5
|
+
const candidates = sheet.rows.slice(0, SPREADSHEET_HEADER_SCAN_ROWS).map((row, index) => ({
|
|
6
|
+
index,
|
|
7
|
+
matchCount: matchSpreadsheetHeaders({
|
|
8
|
+
ctx: params.ctx,
|
|
9
|
+
fields: params.fields,
|
|
10
|
+
headers: createSpreadsheetHeaderCells(row)
|
|
11
|
+
}).size,
|
|
12
|
+
preview: row.filter(Boolean).slice(0, 4),
|
|
13
|
+
rowNumber: sheet.rowNumbers[index] ?? index + 1
|
|
14
|
+
}));
|
|
15
|
+
const best = candidates.reduce(
|
|
16
|
+
(winner, candidate) => candidate.matchCount > winner.matchCount ? candidate : winner,
|
|
17
|
+
candidates[0] ?? { index: 0, matchCount: 0, preview: [], rowNumber: 1 }
|
|
18
|
+
);
|
|
19
|
+
return {
|
|
20
|
+
candidates,
|
|
21
|
+
headerRow: best.index,
|
|
22
|
+
matchCount: best.matchCount,
|
|
23
|
+
name: sheet.name,
|
|
24
|
+
rowCount: Math.max(sheet.rows.length - best.index - 1, 0)
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
const top = sheets.reduce(
|
|
28
|
+
(winner, sheet) => !winner || sheet.matchCount > winner.matchCount ? sheet : winner,
|
|
29
|
+
null
|
|
30
|
+
);
|
|
31
|
+
const tied = top ? sheets.filter((sheet) => sheet.matchCount === top.matchCount) : [];
|
|
32
|
+
return {
|
|
33
|
+
ambiguous: Boolean(top && top.matchCount > 0 && tied.length > 1),
|
|
34
|
+
best: top && top.matchCount > 0 ? { headerRow: top.headerRow, matchCount: top.matchCount, sheet: top.name } : null,
|
|
35
|
+
sheets
|
|
36
|
+
};
|
|
37
|
+
}
|