@platforma-sdk/ui-vue 1.86.0 → 1.86.5
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/.turbo/turbo-build.log +210 -211
- package/.turbo/turbo-formatter$colon$check.log +4 -6
- package/.turbo/turbo-linter$colon$check.log +4 -6
- package/.turbo/turbo-types$colon$check.log +3 -5
- package/CHANGELOG.md +23 -0
- package/dist/AgGridVue/AgGridTheme.js +1 -2
- package/dist/AgGridVue/AgGridTheme.js.map +1 -1
- package/dist/AgGridVue/ag-override.js +1 -2
- package/dist/AgGridVue/ag-override.js.map +1 -1
- package/dist/AgGridVue/createAgGridColDef.js +2 -3
- package/dist/AgGridVue/createAgGridColDef.js.map +1 -1
- package/dist/AgGridVue/index.js +5 -4
- package/dist/AgGridVue/selection.js +1 -2
- package/dist/AgGridVue/selection.js.map +1 -1
- package/dist/AgGridVue/useAgGridOptions.js +1 -2
- package/dist/AgGridVue/useAgGridOptions.js.map +1 -1
- package/dist/_virtual/_plugin-vue_export-helper.js +1 -2
- package/dist/components/BlockLayout.js +1 -2
- package/dist/components/BlockLayout.js.map +1 -1
- package/dist/components/BlockLayout.style.js +3 -3
- package/dist/components/BlockLayout.style.js.map +1 -1
- package/dist/components/BlockLayout.vue2.js +2 -3
- package/dist/components/BlockLayout.vue2.js.map +1 -1
- package/dist/components/BlockLoader.js +1 -2
- package/dist/components/BlockLoader.js.map +1 -1
- package/dist/components/BlockLoader.vue2.js +2 -3
- package/dist/components/BlockLoader.vue2.js.map +1 -1
- package/dist/components/LoaderPage.js +2 -3
- package/dist/components/LoaderPage.js.map +1 -1
- package/dist/components/NotFound.js +1 -2
- package/dist/components/NotFound.js.map +1 -1
- package/dist/components/NotFound.vue2.js +2 -3
- package/dist/components/NotFound.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.js +1 -2
- package/dist/components/PlAdvancedFilter/FilterEditor.js.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.style.js +16 -16
- package/dist/components/PlAdvancedFilter/FilterEditor.style.js.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.vue2.js +4 -5
- package/dist/components/PlAdvancedFilter/FilterEditor.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/OperandButton.js +1 -2
- package/dist/components/PlAdvancedFilter/OperandButton.js.map +1 -1
- package/dist/components/PlAdvancedFilter/OperandButton.style.js +6 -6
- package/dist/components/PlAdvancedFilter/OperandButton.style.js.map +1 -1
- package/dist/components/PlAdvancedFilter/OperandButton.vue2.js +2 -3
- package/dist/components/PlAdvancedFilter/OperandButton.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.js +1 -2
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.js.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.style.js +11 -11
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.style.js.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue2.js +4 -5
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/constants.js +1 -2
- package/dist/components/PlAdvancedFilter/constants.js.map +1 -1
- package/dist/components/PlAdvancedFilter/index.js +4 -5
- package/dist/components/PlAdvancedFilter/index.js.map +1 -1
- package/dist/components/PlAdvancedFilter/utils.js +2 -3
- package/dist/components/PlAdvancedFilter/utils.js.map +1 -1
- package/dist/components/PlAgCellFile/PlAgCellFile.js +1 -2
- package/dist/components/PlAgCellFile/PlAgCellFile.js.map +1 -1
- package/dist/components/PlAgCellFile/PlAgCellFile.vue2.js +2 -3
- package/dist/components/PlAgCellFile/PlAgCellFile.vue2.js.map +1 -1
- package/dist/components/PlAgCellFile/index.js +1 -1
- package/dist/components/PlAgCellProgress/PlAgCellProgress.js +1 -2
- package/dist/components/PlAgCellProgress/PlAgCellProgress.js.map +1 -1
- package/dist/components/PlAgCellProgress/PlAgCellProgress.vue2.js +2 -3
- package/dist/components/PlAgCellProgress/PlAgCellProgress.vue2.js.map +1 -1
- package/dist/components/PlAgCellProgress/index.js +1 -1
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.js +1 -2
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.js.map +1 -1
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.vue2.js +2 -3
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.vue2.js.map +1 -1
- package/dist/components/PlAgCellStatusTag/index.js +1 -1
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.js +1 -2
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.js.map +1 -1
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.vue2.js +2 -3
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.vue2.js.map +1 -1
- package/dist/components/PlAgChartHistogramCell/index.js +1 -1
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.js +1 -2
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.js.map +1 -1
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.vue2.js +2 -3
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.vue2.js.map +1 -1
- package/dist/components/PlAgChartStackedBarCell/index.js +1 -1
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.js +1 -2
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.js.map +1 -1
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.vue2.js +2 -3
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.vue2.js.map +1 -1
- package/dist/components/PlAgColumnHeader/index.js +1 -1
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.js +1 -2
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.js.map +1 -1
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.vue2.js +2 -3
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.vue2.js.map +1 -1
- package/dist/components/PlAgCsvExporter/export-csv.js +3 -4
- package/dist/components/PlAgCsvExporter/export-csv.js.map +1 -1
- package/dist/components/PlAgCsvExporter/index.js +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.js +1 -2
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.style.js +3 -3
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.style.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.vue2.js +4 -5
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.js +1 -2
- package/dist/components/PlAgDataTable/PlAgDataTableV2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.style.js +5 -5
- package/dist/components/PlAgDataTable/PlAgDataTableV2.style.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js +132 -133
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.js +1 -2
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.vue2.js +2 -3
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.js +1 -2
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.vue2.js +2 -3
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgRowCount.js +1 -2
- package/dist/components/PlAgDataTable/PlAgRowCount.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgRowCount.vue2.js +2 -3
- package/dist/components/PlAgDataTable/PlAgRowCount.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/compositions/useFilterableColumns.js +1 -2
- package/dist/components/PlAgDataTable/compositions/useFilterableColumns.js.map +1 -1
- package/dist/components/PlAgDataTable/compositions/useGrid.js +1 -2
- package/dist/components/PlAgDataTable/compositions/useGrid.js.map +1 -1
- package/dist/components/PlAgDataTable/index.js +11 -11
- package/dist/components/PlAgDataTable/index.js.map +1 -1
- package/dist/components/PlAgDataTable/pl-ag-overlay-loading.module.js +7 -7
- package/dist/components/PlAgDataTable/pl-ag-overlay-loading.module.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/common.js +1 -2
- package/dist/components/PlAgDataTable/sources/common.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/focus-row.js +1 -2
- package/dist/components/PlAgDataTable/sources/focus-row.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/grid-state.js +3 -4
- package/dist/components/PlAgDataTable/sources/grid-state.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/menu-items.js +1 -2
- package/dist/components/PlAgDataTable/sources/menu-items.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/row-number.js +2 -3
- package/dist/components/PlAgDataTable/sources/row-number.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-source-v2.js +8 -15
- package/dist/components/PlAgDataTable/sources/table-source-v2.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-state-v2.js +2 -3
- package/dist/components/PlAgDataTable/sources/table-state-v2.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/value-rendering.js +6 -9
- package/dist/components/PlAgDataTable/sources/value-rendering.js.map +1 -1
- package/dist/components/PlAgDataTable/types.js +1 -2
- package/dist/components/PlAgDataTable/types.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.js +1 -2
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.style.js +6 -6
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.style.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue2.js +19 -20
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue2.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/index.js +1 -1
- package/dist/components/PlAgGridColumnManager/useFilteredItems.js +2 -3
- package/dist/components/PlAgGridColumnManager/useFilteredItems.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/useGridColumns.js +1 -2
- package/dist/components/PlAgGridColumnManager/useGridColumns.js.map +1 -1
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.js +1 -2
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.js.map +1 -1
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue2.js +2 -3
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue2.js.map +1 -1
- package/dist/components/PlAgRowNumCheckbox/index.js +1 -1
- package/dist/components/PlAgRowNumCheckbox/pl-ag-row-num-checkbox.module.js +7 -7
- package/dist/components/PlAgRowNumCheckbox/pl-ag-row-num-checkbox.module.js.map +1 -1
- package/dist/components/PlAgRowNumHeader.js +1 -2
- package/dist/components/PlAgRowNumHeader.js.map +1 -1
- package/dist/components/PlAgRowNumHeader.vue2.js +2 -3
- package/dist/components/PlAgRowNumHeader.vue2.js.map +1 -1
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.js +1 -2
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.js.map +1 -1
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.vue2.js +2 -3
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.vue2.js.map +1 -1
- package/dist/components/PlAgTextAndButtonCell/index.js +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.js +1 -2
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.js.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.style.js +9 -9
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js +2 -3
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.js +1 -2
- package/dist/components/PlAnnotations/components/FilterSidebar.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.style.js +5 -5
- package/dist/components/PlAnnotations/components/FilterSidebar.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js +2 -3
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.js +1 -2
- package/dist/components/PlAnnotations/components/PlAnnotations.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.style.js +3 -3
- package/dist/components/PlAnnotations/components/PlAnnotations.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js +2 -3
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.js +1 -2
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.style.js +5 -5
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue2.js +2 -3
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/style.module.js +6 -6
- package/dist/components/PlAnnotations/components/style.module.js.map +1 -1
- package/dist/components/PlAnnotations/index.js +3 -2
- package/dist/components/PlAnnotations/utils.js +1 -2
- package/dist/components/PlAnnotations/utils.js.map +1 -1
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.js +1 -2
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.js.map +1 -1
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.vue2.js +2 -3
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.vue2.js.map +1 -1
- package/dist/components/PlAppErrorNotificationAlert/index.js +1 -1
- package/dist/components/PlBtnExportArchive/Item.js +1 -2
- package/dist/components/PlBtnExportArchive/Item.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Item.style.js +7 -7
- package/dist/components/PlBtnExportArchive/Item.style.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Item.vue2.js +2 -3
- package/dist/components/PlBtnExportArchive/Item.vue2.js.map +1 -1
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.js +1 -2
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.js.map +1 -1
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.style.js +6 -6
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.style.js.map +1 -1
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue2.js +16 -17
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue2.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Summary.js +1 -2
- package/dist/components/PlBtnExportArchive/Summary.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Summary.style.js +6 -6
- package/dist/components/PlBtnExportArchive/Summary.style.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Summary.vue2.js +2 -3
- package/dist/components/PlBtnExportArchive/Summary.vue2.js.map +1 -1
- package/dist/components/PlBtnExportArchive/index.js +1 -1
- package/dist/components/PlDatasetSelector/PlDatasetSelector.js +1 -2
- package/dist/components/PlDatasetSelector/PlDatasetSelector.js.map +1 -1
- package/dist/components/PlDatasetSelector/PlDatasetSelector.vue2.js +3 -8
- package/dist/components/PlDatasetSelector/PlDatasetSelector.vue2.js.map +1 -1
- package/dist/components/PlDatasetSelector/index.js +1 -1
- package/dist/components/PlTableFastSearch/PlTableFastSearch.js +1 -2
- package/dist/components/PlTableFastSearch/PlTableFastSearch.js.map +1 -1
- package/dist/components/PlTableFastSearch/PlTableFastSearch.vue2.js +2 -3
- package/dist/components/PlTableFastSearch/PlTableFastSearch.vue2.js.map +1 -1
- package/dist/components/PlTableFastSearch/index.js +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.js +1 -2
- package/dist/components/PlTableFilters/PlTableFiltersV2.js.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.style.js +6 -6
- package/dist/components/PlTableFilters/PlTableFiltersV2.style.js.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue2.js +8 -7
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue2.js.map +1 -1
- package/dist/components/PlTableFilters/index.js +1 -1
- package/dist/components/PlTableFilters/suggest-source.js +1 -2
- package/dist/components/PlTableFilters/suggest-source.js.map +1 -1
- package/dist/composition/AgGrid/index.js +1 -2
- package/dist/composition/AgGrid/index.js.map +1 -1
- package/dist/composition/fileContent.js +9 -5
- package/dist/composition/fileContent.js.map +1 -1
- package/dist/composition/usePlugin.js +1 -2
- package/dist/composition/usePlugin.js.map +1 -1
- package/dist/computedResult.js +1 -2
- package/dist/computedResult.js.map +1 -1
- package/dist/createModel.js +8 -7
- package/dist/createModel.js.map +1 -1
- package/dist/defineApp.js +5 -3
- package/dist/defineApp.js.map +1 -1
- package/dist/defineStore.js +1 -2
- package/dist/defineStore.js.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/UpdateSerializer.js +2 -2
- package/dist/internal/UpdateSerializer.js.map +1 -1
- package/dist/internal/createAppV3.js +2 -3
- package/dist/internal/createAppV3.js.map +1 -1
- package/dist/internal/getServices.js +4 -5
- package/dist/internal/getServices.js.map +1 -1
- package/dist/internal/service_factories.js +1 -2
- package/dist/internal/service_factories.js.map +1 -1
- package/dist/internal/utils.js +1 -2
- package/dist/internal/utils.js.map +1 -1
- package/dist/lib/util/helpers/dist/functions.js +1 -2
- package/dist/lib/util/helpers/dist/functions.js.map +1 -1
- package/dist/lib/util/helpers/dist/hash.js +0 -1
- package/dist/lib/util/helpers/dist/hash.js.map +1 -1
- package/dist/lib/util/helpers/dist/index.js +7 -6
- package/dist/lib/util/helpers/dist/objects.js +7 -6
- package/dist/lib/util/helpers/dist/objects.js.map +1 -1
- package/dist/lib/util/helpers/dist/prettyBytes.js +1 -2
- package/dist/lib/util/helpers/dist/prettyBytes.js.map +1 -1
- package/dist/lib/util/helpers/dist/random.js +1 -2
- package/dist/lib/util/helpers/dist/random.js.map +1 -1
- package/dist/lib/util/helpers/dist/strings.js +1 -2
- package/dist/lib/util/helpers/dist/strings.js.map +1 -1
- package/dist/lib/util/helpers/dist/uniqId.js +1 -2
- package/dist/lib/util/helpers/dist/uniqId.js.map +1 -1
- package/dist/lib/util/helpers/dist/utils.js +1 -2
- package/dist/lib/util/helpers/dist/utils.js.map +1 -1
- package/dist/lib.js +38 -38
- package/dist/objectHash.js +1 -2
- package/dist/objectHash.js.map +1 -1
- package/dist/plugins/Monetization/EndOfPeriod.js +1 -2
- package/dist/plugins/Monetization/EndOfPeriod.js.map +1 -1
- package/dist/plugins/Monetization/EndOfPeriod.style.js +3 -3
- package/dist/plugins/Monetization/EndOfPeriod.style.js.map +1 -1
- package/dist/plugins/Monetization/EndOfPeriod.vue2.js +2 -3
- package/dist/plugins/Monetization/EndOfPeriod.vue2.js.map +1 -1
- package/dist/plugins/Monetization/LimitCard.js +1 -2
- package/dist/plugins/Monetization/LimitCard.js.map +1 -1
- package/dist/plugins/Monetization/LimitCard.style.js +16 -16
- package/dist/plugins/Monetization/LimitCard.style.js.map +1 -1
- package/dist/plugins/Monetization/LimitCard.vue2.js +3 -4
- package/dist/plugins/Monetization/LimitCard.vue2.js.map +1 -1
- package/dist/plugins/Monetization/MonetizationSidebar.js +1 -2
- package/dist/plugins/Monetization/MonetizationSidebar.js.map +1 -1
- package/dist/plugins/Monetization/MonetizationSidebar.vue2.js +2 -3
- package/dist/plugins/Monetization/MonetizationSidebar.vue2.js.map +1 -1
- package/dist/plugins/Monetization/RunStatus.js +1 -2
- package/dist/plugins/Monetization/RunStatus.js.map +1 -1
- package/dist/plugins/Monetization/RunStatus.style.js +9 -9
- package/dist/plugins/Monetization/RunStatus.style.js.map +1 -1
- package/dist/plugins/Monetization/RunStatus.vue2.js +2 -3
- package/dist/plugins/Monetization/RunStatus.vue2.js.map +1 -1
- package/dist/plugins/Monetization/UserCabinetCard.js +1 -2
- package/dist/plugins/Monetization/UserCabinetCard.js.map +1 -1
- package/dist/plugins/Monetization/UserCabinetCard.style.js +10 -10
- package/dist/plugins/Monetization/UserCabinetCard.style.js.map +1 -1
- package/dist/plugins/Monetization/UserCabinetCard.vue2.js +2 -3
- package/dist/plugins/Monetization/UserCabinetCard.vue2.js.map +1 -1
- package/dist/plugins/Monetization/index.js +1 -1
- package/dist/plugins/Monetization/useButtonTarget.js +2 -7
- package/dist/plugins/Monetization/useButtonTarget.js.map +1 -1
- package/dist/plugins/Monetization/useInfo.js +1 -2
- package/dist/plugins/Monetization/useInfo.js.map +1 -1
- package/dist/plugins/Monetization/validation.js +2 -3
- package/dist/plugins/Monetization/validation.js.map +1 -1
- package/dist/urls.js +1 -2
- package/dist/urls.js.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/utils.js.map +1 -1
- package/package.json +20 -21
- package/src/components/PlAdvancedFilter/FilterEditor.test.ts +1 -1
- package/src/components/PlAgDataTable/PlAgDataTableSheets.vue +1 -1
- package/src/components/PlAgDataTable/sources/table-state-v2.test.ts +1 -1
- package/dist/_virtual/_rolldown/runtime.js +0 -17
- /package/dist/components/{BlockLayout.vue.css → BlockLayout.style.css} +0 -0
- /package/dist/components/PlAdvancedFilter/{FilterEditor.vue.css → FilterEditor.style.css} +0 -0
- /package/dist/components/PlAdvancedFilter/{OperandButton.vue.css → OperandButton.style.css} +0 -0
- /package/dist/components/PlAdvancedFilter/{PlAdvancedFilter.vue.css → PlAdvancedFilter.style.css} +0 -0
- /package/dist/components/PlAgDataTable/{PlAgDataTableSheets.vue.css → PlAgDataTableSheets.style.css} +0 -0
- /package/dist/components/PlAgDataTable/{PlAgDataTableV2.vue.css → PlAgDataTableV2.style.css} +0 -0
- /package/dist/components/PlAgGridColumnManager/{PlAgGridColumnManager.vue.css → PlAgGridColumnManager.style.css} +0 -0
- /package/dist/components/PlAnnotations/components/{AnnotationsSidebar.vue.css → AnnotationsSidebar.style.css} +0 -0
- /package/dist/components/PlAnnotations/components/{FilterSidebar.vue.css → FilterSidebar.style.css} +0 -0
- /package/dist/components/PlAnnotations/components/{PlAnnotations.vue.css → PlAnnotations.style.css} +0 -0
- /package/dist/components/PlAnnotations/components/{PlAnnotationsModal.vue.css → PlAnnotationsModal.style.css} +0 -0
- /package/dist/components/PlBtnExportArchive/{Item.vue.css → Item.style.css} +0 -0
- /package/dist/components/PlBtnExportArchive/{PlBtnExportArchive.vue.css → PlBtnExportArchive.style.css} +0 -0
- /package/dist/components/PlBtnExportArchive/{Summary.vue.css → Summary.style.css} +0 -0
- /package/dist/components/PlTableFilters/{PlTableFiltersV2.vue.css → PlTableFiltersV2.style.css} +0 -0
- /package/dist/plugins/Monetization/{EndOfPeriod.vue.css → EndOfPeriod.style.css} +0 -0
- /package/dist/plugins/Monetization/{LimitCard.vue.css → LimitCard.style.css} +0 -0
- /package/dist/plugins/Monetization/{RunStatus.vue.css → RunStatus.style.css} +0 -0
- /package/dist/plugins/Monetization/{UserCabinetCard.vue.css → UserCabinetCard.style.css} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import e from "./PlTableFastSearch.vue2.js";
|
|
2
|
-
|
|
2
|
+
// src/components/PlTableFastSearch/PlTableFastSearch.vue
|
|
3
3
|
var t = e;
|
|
4
|
-
//#endregion
|
|
5
4
|
export { t as default };
|
|
6
5
|
|
|
7
6
|
//# sourceMappingURL=PlTableFastSearch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlTableFastSearch.js","names":[],"sources":["../../../src/components/PlTableFastSearch/PlTableFastSearch.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { PlSearchField } from \"@milaboratories/uikit\";\n\nconst model = defineModel<string>({ required: true });\n</script>\n\n<template>\n <PlSearchField\n v-model=\"model\"\n data-testid=\"pl-table-fast-search\"\n clearable\n placeholder=\"Search...\"\n >\n <template #helper>\n <b>How table search works:</b>\n <br />\n <ul>\n <li>\n <b>Exact match only.</b><br />\n No partials, wildcards, ranges, or regex.\n </li>\n <li>\n <b>Scope:</b> Searches all visible columns. To include a column, make it visible in\n Columns.\n </li>\n <li>\n <b>Text columns:</b> Exact string equality. Characters must match exactly (including case,\n spaces, and punctuation).\n </li>\n <li>\n <b>Number columns:</b> Exact numeric equality. 71 matches 71 and 71.0; it does not match\n 715 or 0.71/0.85.\n </li>\n </ul>\n <b>Examples:</b>\n <br />\n <ul>\n <li>CASSLDRGTEAFF → shows rows where any visible column equals that full string.</li>\n <li>85 → matches 85 / 85.0, not 0.85 or 850.</li>\n </ul>\n </template>\n </PlSearchField>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"PlTableFastSearch.js","names":["_sfc_main","PlTableFastSearch_vue_vue_type_script_setup_true_lang_default","PlTableFastSearch_default"],"sources":["../../../src/components/PlTableFastSearch/PlTableFastSearch.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { PlSearchField } from \"@milaboratories/uikit\";\n\nconst model = defineModel<string>({ required: true });\n</script>\n\n<template>\n <PlSearchField\n v-model=\"model\"\n data-testid=\"pl-table-fast-search\"\n clearable\n placeholder=\"Search...\"\n >\n <template #helper>\n <b>How table search works:</b>\n <br />\n <ul>\n <li>\n <b>Exact match only.</b><br />\n No partials, wildcards, ranges, or regex.\n </li>\n <li>\n <b>Scope:</b> Searches all visible columns. To include a column, make it visible in\n Columns.\n </li>\n <li>\n <b>Text columns:</b> Exact string equality. Characters must match exactly (including case,\n spaces, and punctuation).\n </li>\n <li>\n <b>Number columns:</b> Exact numeric equality. 71 matches 71 and 71.0; it does not match\n 715 or 0.71/0.85.\n </li>\n </ul>\n <b>Examples:</b>\n <br />\n <ul>\n <li>CASSLDRGTEAFF → shows rows where any visible column equals that full string.</li>\n <li>85 → matches 85 / 85.0, not 0.85 or 850.</li>\n </ul>\n </template>\n </PlSearchField>\n</template>\n"],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createBlock as e, createElementVNode as t, createTextVNode as n, defineComponent as r, openBlock as i, unref as a, useModel as o, withCtx as s } from "vue";
|
|
2
2
|
import { PlSearchField as c } from "@milaboratories/uikit";
|
|
3
|
-
|
|
4
|
-
var l =
|
|
3
|
+
// src/components/PlTableFastSearch/PlTableFastSearch.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var l = /*@__PURE__*/ r({
|
|
5
5
|
__name: "PlTableFastSearch",
|
|
6
6
|
props: {
|
|
7
7
|
modelValue: { required: !0 },
|
|
@@ -38,7 +38,6 @@ var l = /* @__PURE__ */ r({
|
|
|
38
38
|
}, 8, ["modelValue"]));
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
//#endregion
|
|
42
41
|
export { l as default };
|
|
43
42
|
|
|
44
43
|
//# sourceMappingURL=PlTableFastSearch.vue2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlTableFastSearch.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/PlTableFastSearch/PlTableFastSearch.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { PlSearchField } from \"@milaboratories/uikit\";\n\nconst model = defineModel<string>({ required: true });\n</script>\n\n<template>\n <PlSearchField\n v-model=\"model\"\n data-testid=\"pl-table-fast-search\"\n clearable\n placeholder=\"Search...\"\n >\n <template #helper>\n <b>How table search works:</b>\n <br />\n <ul>\n <li>\n <b>Exact match only.</b><br />\n No partials, wildcards, ranges, or regex.\n </li>\n <li>\n <b>Scope:</b> Searches all visible columns. To include a column, make it visible in\n Columns.\n </li>\n <li>\n <b>Text columns:</b> Exact string equality. Characters must match exactly (including case,\n spaces, and punctuation).\n </li>\n <li>\n <b>Number columns:</b> Exact numeric equality. 71 matches 71 and 71.0; it does not match\n 715 or 0.71/0.85.\n </li>\n </ul>\n <b>Examples:</b>\n <br />\n <ul>\n <li>CASSLDRGTEAFF → shows rows where any visible column equals that full string.</li>\n <li>85 → matches 85 / 85.0, not 0.85 or 850.</li>\n </ul>\n </template>\n </PlSearchField>\n</template>\n"],"mappings":";;;;;;;;;;;EAGA,
|
|
1
|
+
{"version":3,"file":"PlTableFastSearch.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createBlock","_unref","_withCtx","_createElementVNode","_createTextVNode","PlTableFastSearch_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","model","useModel","__props","openBlock","createBlock","unref","PlSearchField","_cache","$event","withCtx","createElementVNode","createTextVNode"],"sources":["../../../src/components/PlTableFastSearch/PlTableFastSearch.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { PlSearchField } from \"@milaboratories/uikit\";\n\nconst model = defineModel<string>({ required: true });\n</script>\n\n<template>\n <PlSearchField\n v-model=\"model\"\n data-testid=\"pl-table-fast-search\"\n clearable\n placeholder=\"Search...\"\n >\n <template #helper>\n <b>How table search works:</b>\n <br />\n <ul>\n <li>\n <b>Exact match only.</b><br />\n No partials, wildcards, ranges, or regex.\n </li>\n <li>\n <b>Scope:</b> Searches all visible columns. To include a column, make it visible in\n Columns.\n </li>\n <li>\n <b>Text columns:</b> Exact string equality. Characters must match exactly (including case,\n spaces, and punctuation).\n </li>\n <li>\n <b>Number columns:</b> Exact numeric equality. 71 matches 71 and 71.0; it does not match\n 715 or 0.71/0.85.\n </li>\n </ul>\n <b>Examples:</b>\n <br />\n <ul>\n <li>CASSLDRGTEAFF → shows rows where any visible column equals that full string.</li>\n <li>85 → matches 85 / 85.0, not 0.85 or 850.</li>\n </ul>\n </template>\n </PlSearchField>\n</template>\n"],"mappings":";;;;;;;;;;;EAGA,IAAMU,IAAQV,EAAmBY,GAAA,YAAmB;E,kBAIlDX,EAAA,GAAAC,EAkCgBC,EAAAa,CAAA,GAAA;GAjCL,YAAAN,EAAA;GAAA,uBAAA,AAAAO,EAAA,QAAA,MAAA,EAAK,QAAAC;GACd,eAAY;GACZ,WAAA;GACA,aAAY;;GAED,QAAMd,QACe,CAAA,GAAA,AAAAa,EAAA,OAAA;IAA9BZ,EAA8B,KAAA,MAA3B,2BAAuB,EAAA;IAC1BA,EAAM,MAAA,MAAA,MAAA,EAAA;IACNA,EAiBK,MAAA,MAAA;KAhBHA,EAGK,MAAA,MAAA;MAFHA,EAAwB,KAAA,MAArB,mBAAiB;MAAIA,EAAM,IAAA;MAAAC,EAAA,6CAEhC;;KACAD,EAGK,MAAA,MAAA,CAFHA,EAAa,KAAA,MAAV,QAAM,GAAIC,EAAA,kFAEf,C;KACAD,EAGK,MAAA,MAAA,CAFHA,EAAoB,KAAA,MAAjB,eAAa,GAAIC,EAAA,mGAEtB,C;KACAD,EAGK,MAAA,MAAA,CAFHA,EAAsB,KAAA,MAAnB,iBAAe,GAAIC,EAAA,uFAExB,C;;IAEFD,EAAgB,KAAA,MAAb,aAAS,EAAA;IACZA,EAAM,MAAA,MAAA,MAAA,EAAA;IACNA,EAGK,MAAA,MAAA,CAFHA,EAAqF,MAAA,MAAjF,8EAA4E,GAChFA,EAAiD,MAAA,MAA7C,0CAAwC,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default as PlTableFastSearch } from "./PlTableFastSearch.js";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
2
|
import t from "./PlTableFiltersV2.vue2.js";
|
|
3
3
|
import n from "./PlTableFiltersV2.style.js";
|
|
4
|
-
var r =
|
|
5
|
-
//#endregion
|
|
4
|
+
var r = /*#__PURE__*/ e(t, [["__cssModules", { $style: n }]]);
|
|
6
5
|
export { r as default };
|
|
7
6
|
|
|
8
7
|
//# sourceMappingURL=PlTableFiltersV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlTableFiltersV2.js","names":[],"sources":["../../../src/components/PlTableFilters/PlTableFiltersV2.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n PTableColumnSpec,\n PlDataTableFiltersWithMeta,\n PFrameHandle,\n PTableColumnId,\n PColumnSpec,\n PlDataTableColumnsMeta,\n} from \"@platforma-sdk/model\";\nimport {\n Annotation,\n Domain,\n readAnnotation,\n readDomain,\n getUniqueAxisValuesWithLabels,\n getUniqueSourceValuesWithLabels,\n getPTableColumnId,\n deriveDistinctLabels,\n peerLinkedLast,\n} from \"@platforma-sdk/model\";\nimport { computed, ref } from \"vue\";\nimport { PlBtnGhost, PlSlideModal, usePlBlockPageTitleTeleportTarget } from \"@milaboratories/uikit\";\nimport {\n PlAdvancedFilter,\n PlAdvancedFilterComponent,\n type PlAdvancedFilterItem,\n} from \"../PlAdvancedFilter\";\nimport type { PlAdvancedFilterColumnId } from \"../PlAdvancedFilter/types\";\nimport type { Nil } from \"@milaboratories/helpers\";\nimport { isFunction, isNil } from \"es-toolkit\";\nimport { resolveSuggestSource, TABLE_FILTER_TYPES } from \"./suggest-source\";\nimport { effectiveLinkHint } from \"../PlAgDataTable/sources/table-source-v2\";\n\nconst props = defineProps<{\n columns: PTableColumnSpec[];\n pframeHandle: Nil | PFrameHandle;\n columnsMeta?: PlDataTableColumnsMeta;\n filters: PlDataTableFiltersWithMeta;\n defaultFilters: Nil | PlDataTableFiltersWithMeta;\n onUpdateFilters: (value: PlDataTableFiltersWithMeta) => void;\n onResetDefaultFilters?: () => void;\n onUpdateDefaultFilters?: (value: PlDataTableFiltersWithMeta) => void;\n}>();\n\nconst teleportTarget = usePlBlockPageTitleTeleportTarget(\"PlTableFiltersV2\");\nconst showManager = ref(false);\nconst hasFilters = computed(() => props.filters.filters.length > 0);\nconst hasDefaultFilters = computed(\n () => !isNil(props.defaultFilters) && props.defaultFilters.filters.length > 0,\n);\nconst filters = computed<PlDataTableFiltersWithMeta>(() => {\n if (isNil(props.defaultFilters) || props.defaultFilters?.filters.length === 0) {\n return props.filters;\n }\n\n return {\n ...props.filters,\n filters: [...(props.defaultFilters?.filters ?? []), ...props.filters.filters],\n };\n});\nconst onUpdateFilters = (_value: PlAdvancedFilter) => {\n const value = _value as PlDataTableFiltersWithMeta;\n\n if (isNil(props.defaultFilters)) {\n return props.onUpdateFilters(value);\n }\n\n const [defaults, ...rest] = value.filters;\n props.onUpdateFilters({ ...value, filters: rest });\n props.onUpdateDefaultFilters?.({ ...props.defaultFilters, filters: [defaults] });\n};\n\nconst options = computed<PlAdvancedFilterItem[]>(() => {\n const columnEntries: { idx: number; spec: PColumnSpec }[] = [];\n props.columns.forEach((col, idx) => {\n if (col.type === \"column\") columnEntries.push({ idx, spec: col.spec });\n });\n const distinctLabelByIdx = new Map<number, string>();\n deriveDistinctLabels(\n columnEntries.map((e) => e.spec),\n {},\n ).forEach((label, i) => distinctLabelByIdx.set(columnEntries[i].idx, label));\n\n const items = props.columns.map((col, idx) => {\n const id = getPTableColumnId(col);\n const label =\n distinctLabelByIdx.get(idx)?.trim() ||\n readAnnotation(col.spec, Annotation.Label)?.trim() ||\n `Unlabeled ${col.type} ${idx}`;\n const alphabet =\n readDomain(col.spec, Domain.Alphabet) ?? readAnnotation(col.spec, Annotation.Alphabet);\n return {\n id,\n label,\n linkHint: effectiveLinkHint(col, props.columnsMeta),\n spec: col.spec,\n alphabet: alphabet ?? undefined,\n };\n });\n // Peer-linked columns last, as in the table.\n return peerLinkedLast(items, (item) => item.linkHint !== undefined);\n});\n\nconst supportedFilters = TABLE_FILTER_TYPES;\n\n// getSuggestOptions - provide discrete values from column annotations\nfunction handleSuggestOptions(params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n}) {\n if (isNil(props.pframeHandle)) {\n console.warn(\"PFrame handle is not available, cannot fetch suggest options\");\n return [];\n }\n\n const tableColumnId = params.columnId as PTableColumnId;\n if (typeof tableColumnId !== \"object\" || tableColumnId === null) {\n throw new Error(\"ColumnId should be a table column id for suggest options\");\n }\n\n const search = {\n limit: 100,\n searchQuery: params.searchType === \"label\" ? params.searchStr : undefined,\n searchQueryValue: params.searchType === \"value\" ? params.searchStr : undefined,\n };\n const source = resolveSuggestSource(props.columns, tableColumnId, params.axisIdx);\n const response =\n source.type === \"column\"\n ? getUniqueSourceValuesWithLabels(props.pframeHandle, {\n columnId: source.columnId,\n axisIdx: source.axisIdx,\n ...search,\n })\n : getUniqueAxisValuesWithLabels(props.pframeHandle, {\n axisSpec: source.axisSpec,\n parentColumnIds: source.parentColumnIds,\n ...search,\n });\n return response.then((v) => v.values);\n}\n</script>\n\n<template>\n <Teleport v-if=\"teleportTarget\" :to=\"teleportTarget\">\n <PlBtnGhost\n data-testid=\"pl-table-filters\"\n :icon=\"hasFilters || hasDefaultFilters ? 'filter-on' : 'filter'\"\n @click.stop=\"showManager = true\"\n >\n Filters\n </PlBtnGhost>\n </Teleport>\n\n <PlSlideModal\n v-model=\"showManager\"\n data-testid=\"pl-table-filters-panel\"\n :close-on-outside-click=\"false\"\n >\n <template #title>Manage Filters</template>\n\n <div data-testid=\"pl-table-filters-content\" :class=\"$style.root\">\n <PlAdvancedFilterComponent\n :filters=\"filters as PlAdvancedFilter\"\n :options=\"options\"\n :supported-filters=\"supportedFilters\"\n :get-suggest-options=\"handleSuggestOptions\"\n :is-pinned=\"(_, index) => hasDefaultFilters && index === 0\"\n :is-removable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :is-draggable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :enable-dnd=\"false\"\n :enable-toggling=\"true\"\n :enable-add-group-button=\"true\"\n @update-filters=\"onUpdateFilters\"\n >\n <template #group-title=\"{ index }\">\n <div\n v-if=\"hasDefaultFilters && index === 0\"\n data-testid=\"pl-table-filters-default-group-title\"\n :class=\"$style.defaultGroupTitle\"\n >\n Default Group\n <PlBtnGhost\n v-if=\"isFunction(props.onResetDefaultFilters)\"\n data-testid=\"pl-table-filters-reset-default\"\n icon=\"restart\"\n :class=\"$style.restartBtn\"\n @click.stop=\"props.onResetDefaultFilters()\"\n />\n </div>\n <div v-else data-testid=\"pl-table-filters-custom-group-title\">Custom Group</div>\n </template>\n </PlAdvancedFilterComponent>\n </div>\n </PlSlideModal>\n</template>\n\n<style module>\n.root {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n.defaultGroupTitle {\n display: flex;\n align-items: center;\n gap: 4px;\n}\n.restartBtn {\n width: 24px;\n height: 24px;\n padding: 4px;\n --button-width: 24px;\n --btn-min-width: 24px;\n --button-height: 24px;\n --btn-min-height: 24x;\n}\n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"PlTableFiltersV2.js","names":["style0","_sfc_main","_plugin_vue_export_helper_default","PlTableFiltersV2_vue_vue_type_script_setup_true_lang_default","PlTableFiltersV2_vue_vue_type_style_index_0_lang_module_default","PlTableFiltersV2_default","\"$style\""],"sources":["../../../src/components/PlTableFilters/PlTableFiltersV2.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n PTableColumnSpec,\n PlDataTableFiltersWithMeta,\n PFrameHandle,\n PTableColumnId,\n PColumnSpec,\n PlDataTableColumnsMeta,\n} from \"@platforma-sdk/model\";\nimport {\n Annotation,\n Domain,\n readAnnotation,\n readDomain,\n getUniqueAxisValuesWithLabels,\n getUniqueSourceValuesWithLabels,\n getPTableColumnId,\n deriveDistinctLabels,\n peerLinkedLast,\n} from \"@platforma-sdk/model\";\nimport { computed, ref } from \"vue\";\nimport { PlBtnGhost, PlSlideModal, usePlBlockPageTitleTeleportTarget } from \"@milaboratories/uikit\";\nimport {\n PlAdvancedFilter,\n PlAdvancedFilterComponent,\n type PlAdvancedFilterItem,\n} from \"../PlAdvancedFilter\";\nimport type { PlAdvancedFilterColumnId } from \"../PlAdvancedFilter/types\";\nimport type { Nil } from \"@milaboratories/helpers\";\nimport { isFunction, isNil } from \"es-toolkit\";\nimport { resolveSuggestSource, TABLE_FILTER_TYPES } from \"./suggest-source\";\nimport { effectiveLinkHint } from \"../PlAgDataTable/sources/table-source-v2\";\n\nconst props = defineProps<{\n columns: PTableColumnSpec[];\n pframeHandle: Nil | PFrameHandle;\n columnsMeta?: PlDataTableColumnsMeta;\n filters: PlDataTableFiltersWithMeta;\n defaultFilters: Nil | PlDataTableFiltersWithMeta;\n onUpdateFilters: (value: PlDataTableFiltersWithMeta) => void;\n onResetDefaultFilters?: () => void;\n onUpdateDefaultFilters?: (value: PlDataTableFiltersWithMeta) => void;\n}>();\n\nconst teleportTarget = usePlBlockPageTitleTeleportTarget(\"PlTableFiltersV2\");\nconst showManager = ref(false);\nconst hasFilters = computed(() => props.filters.filters.length > 0);\nconst hasDefaultFilters = computed(\n () => !isNil(props.defaultFilters) && props.defaultFilters.filters.length > 0,\n);\nconst filters = computed<PlDataTableFiltersWithMeta>(() => {\n if (isNil(props.defaultFilters) || props.defaultFilters?.filters.length === 0) {\n return props.filters;\n }\n\n return {\n ...props.filters,\n filters: [...(props.defaultFilters?.filters ?? []), ...props.filters.filters],\n };\n});\nconst onUpdateFilters = (_value: PlAdvancedFilter) => {\n const value = _value as PlDataTableFiltersWithMeta;\n\n if (isNil(props.defaultFilters)) {\n return props.onUpdateFilters(value);\n }\n\n const [defaults, ...rest] = value.filters;\n props.onUpdateFilters({ ...value, filters: rest });\n props.onUpdateDefaultFilters?.({ ...props.defaultFilters, filters: [defaults] });\n};\n\nconst options = computed<PlAdvancedFilterItem[]>(() => {\n const columnEntries: { idx: number; spec: PColumnSpec }[] = [];\n props.columns.forEach((col, idx) => {\n if (col.type === \"column\") columnEntries.push({ idx, spec: col.spec });\n });\n const distinctLabelByIdx = new Map<number, string>();\n deriveDistinctLabels(\n columnEntries.map((e) => e.spec),\n {},\n ).forEach((label, i) => distinctLabelByIdx.set(columnEntries[i].idx, label));\n\n const items = props.columns.map((col, idx) => {\n const id = getPTableColumnId(col);\n const label =\n distinctLabelByIdx.get(idx)?.trim() ||\n readAnnotation(col.spec, Annotation.Label)?.trim() ||\n `Unlabeled ${col.type} ${idx}`;\n const alphabet =\n readDomain(col.spec, Domain.Alphabet) ?? readAnnotation(col.spec, Annotation.Alphabet);\n return {\n id,\n label,\n linkHint: effectiveLinkHint(col, props.columnsMeta),\n spec: col.spec,\n alphabet: alphabet ?? undefined,\n };\n });\n // Peer-linked columns last, as in the table.\n return peerLinkedLast(items, (item) => item.linkHint !== undefined);\n});\n\nconst supportedFilters = TABLE_FILTER_TYPES;\n\n// getSuggestOptions - provide discrete values from column annotations\nfunction handleSuggestOptions(params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n}) {\n if (isNil(props.pframeHandle)) {\n console.warn(\"PFrame handle is not available, cannot fetch suggest options\");\n return [];\n }\n\n const tableColumnId = params.columnId as PTableColumnId;\n if (typeof tableColumnId !== \"object\" || tableColumnId === null) {\n throw new Error(\"ColumnId should be a table column id for suggest options\");\n }\n\n const search = {\n limit: 100,\n searchQuery: params.searchType === \"label\" ? params.searchStr : undefined,\n searchQueryValue: params.searchType === \"value\" ? params.searchStr : undefined,\n };\n const source = resolveSuggestSource(props.columns, tableColumnId, params.axisIdx);\n const response =\n source.type === \"column\"\n ? getUniqueSourceValuesWithLabels(props.pframeHandle, {\n columnId: source.columnId,\n axisIdx: source.axisIdx,\n ...search,\n })\n : getUniqueAxisValuesWithLabels(props.pframeHandle, {\n axisSpec: source.axisSpec,\n parentColumnIds: source.parentColumnIds,\n ...search,\n });\n return response.then((v) => v.values);\n}\n</script>\n\n<template>\n <Teleport v-if=\"teleportTarget\" :to=\"teleportTarget\">\n <PlBtnGhost\n data-testid=\"pl-table-filters\"\n :icon=\"hasFilters || hasDefaultFilters ? 'filter-on' : 'filter'\"\n @click.stop=\"showManager = true\"\n >\n Filters\n </PlBtnGhost>\n </Teleport>\n\n <PlSlideModal\n v-model=\"showManager\"\n data-testid=\"pl-table-filters-panel\"\n :close-on-outside-click=\"false\"\n >\n <template #title>Manage Filters</template>\n\n <div data-testid=\"pl-table-filters-content\" :class=\"$style.root\">\n <PlAdvancedFilterComponent\n :filters=\"filters as PlAdvancedFilter\"\n :options=\"options\"\n :supported-filters=\"supportedFilters\"\n :get-suggest-options=\"handleSuggestOptions\"\n :is-pinned=\"(_, index) => hasDefaultFilters && index === 0\"\n :is-removable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :is-draggable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :enable-dnd=\"false\"\n :enable-toggling=\"true\"\n :enable-add-group-button=\"true\"\n @update-filters=\"onUpdateFilters\"\n >\n <template #group-title=\"{ index }\">\n <div\n v-if=\"hasDefaultFilters && index === 0\"\n data-testid=\"pl-table-filters-default-group-title\"\n :class=\"$style.defaultGroupTitle\"\n >\n Default Group\n <PlBtnGhost\n v-if=\"isFunction(props.onResetDefaultFilters)\"\n data-testid=\"pl-table-filters-reset-default\"\n icon=\"restart\"\n :class=\"$style.restartBtn\"\n @click.stop=\"props.onResetDefaultFilters()\"\n />\n </div>\n <div v-else data-testid=\"pl-table-filters-custom-group-title\">Custom Group</div>\n </template>\n </PlAdvancedFilterComponent>\n </div>\n </PlSlideModal>\n</template>\n\n<style module>\n.root {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n.defaultGroupTitle {\n display: flex;\n align-items: center;\n gap: 4px;\n}\n.restartBtn {\n width: 24px;\n height: 24px;\n padding: 4px;\n --button-width: 24px;\n --btn-min-width: 24px;\n --button-height: 24px;\n --btn-min-height: 24x;\n}\n</style>\n"],"mappings":""}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import './PlTableFiltersV2.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import './PlTableFiltersV2.style.css';// src/components/PlTableFilters/PlTableFiltersV2.vue?vue&type=style&index=0&lang.module.css
|
|
2
|
+
var e = "_root_1da3c_2", t = "_defaultGroupTitle_1da3c_7", n = "_restartBtn_1da3c_12", r = {
|
|
3
|
+
root: e,
|
|
4
|
+
defaultGroupTitle: t,
|
|
5
|
+
restartBtn: n
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
-
export { e as default };
|
|
7
|
+
export { r as default, t as defaultGroupTitle, n as restartBtn, e as root };
|
|
8
8
|
|
|
9
9
|
//# sourceMappingURL=PlTableFiltersV2.style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlTableFiltersV2.vue_vue_type_style_index_0_lang.module.js","names":[],"sources":["../../../src/components/PlTableFilters/PlTableFiltersV2.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n PTableColumnSpec,\n PlDataTableFiltersWithMeta,\n PFrameHandle,\n PTableColumnId,\n PColumnSpec,\n PlDataTableColumnsMeta,\n} from \"@platforma-sdk/model\";\nimport {\n Annotation,\n Domain,\n readAnnotation,\n readDomain,\n getUniqueAxisValuesWithLabels,\n getUniqueSourceValuesWithLabels,\n getPTableColumnId,\n deriveDistinctLabels,\n peerLinkedLast,\n} from \"@platforma-sdk/model\";\nimport { computed, ref } from \"vue\";\nimport { PlBtnGhost, PlSlideModal, usePlBlockPageTitleTeleportTarget } from \"@milaboratories/uikit\";\nimport {\n PlAdvancedFilter,\n PlAdvancedFilterComponent,\n type PlAdvancedFilterItem,\n} from \"../PlAdvancedFilter\";\nimport type { PlAdvancedFilterColumnId } from \"../PlAdvancedFilter/types\";\nimport type { Nil } from \"@milaboratories/helpers\";\nimport { isFunction, isNil } from \"es-toolkit\";\nimport { resolveSuggestSource, TABLE_FILTER_TYPES } from \"./suggest-source\";\nimport { effectiveLinkHint } from \"../PlAgDataTable/sources/table-source-v2\";\n\nconst props = defineProps<{\n columns: PTableColumnSpec[];\n pframeHandle: Nil | PFrameHandle;\n columnsMeta?: PlDataTableColumnsMeta;\n filters: PlDataTableFiltersWithMeta;\n defaultFilters: Nil | PlDataTableFiltersWithMeta;\n onUpdateFilters: (value: PlDataTableFiltersWithMeta) => void;\n onResetDefaultFilters?: () => void;\n onUpdateDefaultFilters?: (value: PlDataTableFiltersWithMeta) => void;\n}>();\n\nconst teleportTarget = usePlBlockPageTitleTeleportTarget(\"PlTableFiltersV2\");\nconst showManager = ref(false);\nconst hasFilters = computed(() => props.filters.filters.length > 0);\nconst hasDefaultFilters = computed(\n () => !isNil(props.defaultFilters) && props.defaultFilters.filters.length > 0,\n);\nconst filters = computed<PlDataTableFiltersWithMeta>(() => {\n if (isNil(props.defaultFilters) || props.defaultFilters?.filters.length === 0) {\n return props.filters;\n }\n\n return {\n ...props.filters,\n filters: [...(props.defaultFilters?.filters ?? []), ...props.filters.filters],\n };\n});\nconst onUpdateFilters = (_value: PlAdvancedFilter) => {\n const value = _value as PlDataTableFiltersWithMeta;\n\n if (isNil(props.defaultFilters)) {\n return props.onUpdateFilters(value);\n }\n\n const [defaults, ...rest] = value.filters;\n props.onUpdateFilters({ ...value, filters: rest });\n props.onUpdateDefaultFilters?.({ ...props.defaultFilters, filters: [defaults] });\n};\n\nconst options = computed<PlAdvancedFilterItem[]>(() => {\n const columnEntries: { idx: number; spec: PColumnSpec }[] = [];\n props.columns.forEach((col, idx) => {\n if (col.type === \"column\") columnEntries.push({ idx, spec: col.spec });\n });\n const distinctLabelByIdx = new Map<number, string>();\n deriveDistinctLabels(\n columnEntries.map((e) => e.spec),\n {},\n ).forEach((label, i) => distinctLabelByIdx.set(columnEntries[i].idx, label));\n\n const items = props.columns.map((col, idx) => {\n const id = getPTableColumnId(col);\n const label =\n distinctLabelByIdx.get(idx)?.trim() ||\n readAnnotation(col.spec, Annotation.Label)?.trim() ||\n `Unlabeled ${col.type} ${idx}`;\n const alphabet =\n readDomain(col.spec, Domain.Alphabet) ?? readAnnotation(col.spec, Annotation.Alphabet);\n return {\n id,\n label,\n linkHint: effectiveLinkHint(col, props.columnsMeta),\n spec: col.spec,\n alphabet: alphabet ?? undefined,\n };\n });\n // Peer-linked columns last, as in the table.\n return peerLinkedLast(items, (item) => item.linkHint !== undefined);\n});\n\nconst supportedFilters = TABLE_FILTER_TYPES;\n\n// getSuggestOptions - provide discrete values from column annotations\nfunction handleSuggestOptions(params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n}) {\n if (isNil(props.pframeHandle)) {\n console.warn(\"PFrame handle is not available, cannot fetch suggest options\");\n return [];\n }\n\n const tableColumnId = params.columnId as PTableColumnId;\n if (typeof tableColumnId !== \"object\" || tableColumnId === null) {\n throw new Error(\"ColumnId should be a table column id for suggest options\");\n }\n\n const search = {\n limit: 100,\n searchQuery: params.searchType === \"label\" ? params.searchStr : undefined,\n searchQueryValue: params.searchType === \"value\" ? params.searchStr : undefined,\n };\n const source = resolveSuggestSource(props.columns, tableColumnId, params.axisIdx);\n const response =\n source.type === \"column\"\n ? getUniqueSourceValuesWithLabels(props.pframeHandle, {\n columnId: source.columnId,\n axisIdx: source.axisIdx,\n ...search,\n })\n : getUniqueAxisValuesWithLabels(props.pframeHandle, {\n axisSpec: source.axisSpec,\n parentColumnIds: source.parentColumnIds,\n ...search,\n });\n return response.then((v) => v.values);\n}\n</script>\n\n<template>\n <Teleport v-if=\"teleportTarget\" :to=\"teleportTarget\">\n <PlBtnGhost\n data-testid=\"pl-table-filters\"\n :icon=\"hasFilters || hasDefaultFilters ? 'filter-on' : 'filter'\"\n @click.stop=\"showManager = true\"\n >\n Filters\n </PlBtnGhost>\n </Teleport>\n\n <PlSlideModal\n v-model=\"showManager\"\n data-testid=\"pl-table-filters-panel\"\n :close-on-outside-click=\"false\"\n >\n <template #title>Manage Filters</template>\n\n <div data-testid=\"pl-table-filters-content\" :class=\"$style.root\">\n <PlAdvancedFilterComponent\n :filters=\"filters as PlAdvancedFilter\"\n :options=\"options\"\n :supported-filters=\"supportedFilters\"\n :get-suggest-options=\"handleSuggestOptions\"\n :is-pinned=\"(_, index) => hasDefaultFilters && index === 0\"\n :is-removable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :is-draggable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :enable-dnd=\"false\"\n :enable-toggling=\"true\"\n :enable-add-group-button=\"true\"\n @update-filters=\"onUpdateFilters\"\n >\n <template #group-title=\"{ index }\">\n <div\n v-if=\"hasDefaultFilters && index === 0\"\n data-testid=\"pl-table-filters-default-group-title\"\n :class=\"$style.defaultGroupTitle\"\n >\n Default Group\n <PlBtnGhost\n v-if=\"isFunction(props.onResetDefaultFilters)\"\n data-testid=\"pl-table-filters-reset-default\"\n icon=\"restart\"\n :class=\"$style.restartBtn\"\n @click.stop=\"props.onResetDefaultFilters()\"\n />\n </div>\n <div v-else data-testid=\"pl-table-filters-custom-group-title\">Custom Group</div>\n </template>\n </PlAdvancedFilterComponent>\n </div>\n </PlSlideModal>\n</template>\n\n<style module>\n.root {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n.defaultGroupTitle {\n display: flex;\n align-items: center;\n gap: 4px;\n}\n.restartBtn {\n width: 24px;\n height: 24px;\n padding: 4px;\n --button-width: 24px;\n --btn-min-width: 24px;\n --button-height: 24px;\n --btn-min-height: 24x;\n}\n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"PlTableFiltersV2.vue_vue_type_style_index_0_lang.module.js","names":["root","defaultGroupTitle","restartBtn","PlTableFiltersV2_vue_vue_type_style_index_0_lang_module_default"],"sources":["../../../src/components/PlTableFilters/PlTableFiltersV2.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n PTableColumnSpec,\n PlDataTableFiltersWithMeta,\n PFrameHandle,\n PTableColumnId,\n PColumnSpec,\n PlDataTableColumnsMeta,\n} from \"@platforma-sdk/model\";\nimport {\n Annotation,\n Domain,\n readAnnotation,\n readDomain,\n getUniqueAxisValuesWithLabels,\n getUniqueSourceValuesWithLabels,\n getPTableColumnId,\n deriveDistinctLabels,\n peerLinkedLast,\n} from \"@platforma-sdk/model\";\nimport { computed, ref } from \"vue\";\nimport { PlBtnGhost, PlSlideModal, usePlBlockPageTitleTeleportTarget } from \"@milaboratories/uikit\";\nimport {\n PlAdvancedFilter,\n PlAdvancedFilterComponent,\n type PlAdvancedFilterItem,\n} from \"../PlAdvancedFilter\";\nimport type { PlAdvancedFilterColumnId } from \"../PlAdvancedFilter/types\";\nimport type { Nil } from \"@milaboratories/helpers\";\nimport { isFunction, isNil } from \"es-toolkit\";\nimport { resolveSuggestSource, TABLE_FILTER_TYPES } from \"./suggest-source\";\nimport { effectiveLinkHint } from \"../PlAgDataTable/sources/table-source-v2\";\n\nconst props = defineProps<{\n columns: PTableColumnSpec[];\n pframeHandle: Nil | PFrameHandle;\n columnsMeta?: PlDataTableColumnsMeta;\n filters: PlDataTableFiltersWithMeta;\n defaultFilters: Nil | PlDataTableFiltersWithMeta;\n onUpdateFilters: (value: PlDataTableFiltersWithMeta) => void;\n onResetDefaultFilters?: () => void;\n onUpdateDefaultFilters?: (value: PlDataTableFiltersWithMeta) => void;\n}>();\n\nconst teleportTarget = usePlBlockPageTitleTeleportTarget(\"PlTableFiltersV2\");\nconst showManager = ref(false);\nconst hasFilters = computed(() => props.filters.filters.length > 0);\nconst hasDefaultFilters = computed(\n () => !isNil(props.defaultFilters) && props.defaultFilters.filters.length > 0,\n);\nconst filters = computed<PlDataTableFiltersWithMeta>(() => {\n if (isNil(props.defaultFilters) || props.defaultFilters?.filters.length === 0) {\n return props.filters;\n }\n\n return {\n ...props.filters,\n filters: [...(props.defaultFilters?.filters ?? []), ...props.filters.filters],\n };\n});\nconst onUpdateFilters = (_value: PlAdvancedFilter) => {\n const value = _value as PlDataTableFiltersWithMeta;\n\n if (isNil(props.defaultFilters)) {\n return props.onUpdateFilters(value);\n }\n\n const [defaults, ...rest] = value.filters;\n props.onUpdateFilters({ ...value, filters: rest });\n props.onUpdateDefaultFilters?.({ ...props.defaultFilters, filters: [defaults] });\n};\n\nconst options = computed<PlAdvancedFilterItem[]>(() => {\n const columnEntries: { idx: number; spec: PColumnSpec }[] = [];\n props.columns.forEach((col, idx) => {\n if (col.type === \"column\") columnEntries.push({ idx, spec: col.spec });\n });\n const distinctLabelByIdx = new Map<number, string>();\n deriveDistinctLabels(\n columnEntries.map((e) => e.spec),\n {},\n ).forEach((label, i) => distinctLabelByIdx.set(columnEntries[i].idx, label));\n\n const items = props.columns.map((col, idx) => {\n const id = getPTableColumnId(col);\n const label =\n distinctLabelByIdx.get(idx)?.trim() ||\n readAnnotation(col.spec, Annotation.Label)?.trim() ||\n `Unlabeled ${col.type} ${idx}`;\n const alphabet =\n readDomain(col.spec, Domain.Alphabet) ?? readAnnotation(col.spec, Annotation.Alphabet);\n return {\n id,\n label,\n linkHint: effectiveLinkHint(col, props.columnsMeta),\n spec: col.spec,\n alphabet: alphabet ?? undefined,\n };\n });\n // Peer-linked columns last, as in the table.\n return peerLinkedLast(items, (item) => item.linkHint !== undefined);\n});\n\nconst supportedFilters = TABLE_FILTER_TYPES;\n\n// getSuggestOptions - provide discrete values from column annotations\nfunction handleSuggestOptions(params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n}) {\n if (isNil(props.pframeHandle)) {\n console.warn(\"PFrame handle is not available, cannot fetch suggest options\");\n return [];\n }\n\n const tableColumnId = params.columnId as PTableColumnId;\n if (typeof tableColumnId !== \"object\" || tableColumnId === null) {\n throw new Error(\"ColumnId should be a table column id for suggest options\");\n }\n\n const search = {\n limit: 100,\n searchQuery: params.searchType === \"label\" ? params.searchStr : undefined,\n searchQueryValue: params.searchType === \"value\" ? params.searchStr : undefined,\n };\n const source = resolveSuggestSource(props.columns, tableColumnId, params.axisIdx);\n const response =\n source.type === \"column\"\n ? getUniqueSourceValuesWithLabels(props.pframeHandle, {\n columnId: source.columnId,\n axisIdx: source.axisIdx,\n ...search,\n })\n : getUniqueAxisValuesWithLabels(props.pframeHandle, {\n axisSpec: source.axisSpec,\n parentColumnIds: source.parentColumnIds,\n ...search,\n });\n return response.then((v) => v.values);\n}\n</script>\n\n<template>\n <Teleport v-if=\"teleportTarget\" :to=\"teleportTarget\">\n <PlBtnGhost\n data-testid=\"pl-table-filters\"\n :icon=\"hasFilters || hasDefaultFilters ? 'filter-on' : 'filter'\"\n @click.stop=\"showManager = true\"\n >\n Filters\n </PlBtnGhost>\n </Teleport>\n\n <PlSlideModal\n v-model=\"showManager\"\n data-testid=\"pl-table-filters-panel\"\n :close-on-outside-click=\"false\"\n >\n <template #title>Manage Filters</template>\n\n <div data-testid=\"pl-table-filters-content\" :class=\"$style.root\">\n <PlAdvancedFilterComponent\n :filters=\"filters as PlAdvancedFilter\"\n :options=\"options\"\n :supported-filters=\"supportedFilters\"\n :get-suggest-options=\"handleSuggestOptions\"\n :is-pinned=\"(_, index) => hasDefaultFilters && index === 0\"\n :is-removable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :is-draggable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :enable-dnd=\"false\"\n :enable-toggling=\"true\"\n :enable-add-group-button=\"true\"\n @update-filters=\"onUpdateFilters\"\n >\n <template #group-title=\"{ index }\">\n <div\n v-if=\"hasDefaultFilters && index === 0\"\n data-testid=\"pl-table-filters-default-group-title\"\n :class=\"$style.defaultGroupTitle\"\n >\n Default Group\n <PlBtnGhost\n v-if=\"isFunction(props.onResetDefaultFilters)\"\n data-testid=\"pl-table-filters-reset-default\"\n icon=\"restart\"\n :class=\"$style.restartBtn\"\n @click.stop=\"props.onResetDefaultFilters()\"\n />\n </div>\n <div v-else data-testid=\"pl-table-filters-custom-group-title\">Custom Group</div>\n </template>\n </PlAdvancedFilterComponent>\n </div>\n </PlSlideModal>\n</template>\n\n<style module>\n.root {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n.defaultGroupTitle {\n display: flex;\n align-items: center;\n gap: 4px;\n}\n.restartBtn {\n width: 24px;\n height: 24px;\n padding: 4px;\n --button-width: 24px;\n --btn-min-width: 24px;\n --button-height: 24px;\n --btn-min-height: 24x;\n}\n</style>\n"],"mappings":""}
|
|
@@ -6,11 +6,11 @@ import { Fragment as i, Teleport as a, computed as o, createBlock as s, createCo
|
|
|
6
6
|
import { Annotation as b, Domain as x, deriveDistinctLabels as S, getPTableColumnId as C, getUniqueAxisValuesWithLabels as w, getUniqueSourceValuesWithLabels as T, peerLinkedLast as E, readAnnotation as D, readDomain as O } from "@platforma-sdk/model";
|
|
7
7
|
import { isFunction as k, isNil as A } from "es-toolkit";
|
|
8
8
|
import { PlBtnGhost as j, PlSlideModal as M, usePlBlockPageTitleTeleportTarget as N } from "@milaboratories/uikit";
|
|
9
|
-
|
|
9
|
+
// src/components/PlTableFilters/PlTableFiltersV2.vue?vue&type=script&setup=true&lang.ts
|
|
10
10
|
var P = {
|
|
11
11
|
key: 1,
|
|
12
12
|
"data-testid": "pl-table-filters-custom-group-title"
|
|
13
|
-
}, F =
|
|
13
|
+
}, F = /*@__PURE__*/ p({
|
|
14
14
|
__name: "PlTableFiltersV2",
|
|
15
15
|
props: {
|
|
16
16
|
columns: {},
|
|
@@ -46,7 +46,8 @@ var P = {
|
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
48
|
let n = /* @__PURE__ */ new Map();
|
|
49
|
-
|
|
49
|
+
S(t.map((e) => e.spec), {}).forEach((e, r) => n.set(t[r].idx, e));
|
|
50
|
+
let r = F.columns.map((t, r) => {
|
|
50
51
|
let i = C(t), a = n.get(r)?.trim() || D(t.spec, b.Label)?.trim() || `Unlabeled ${t.type} ${r}`, o = O(t.spec, x.Alphabet) ?? D(t.spec, b.Alphabet);
|
|
51
52
|
return {
|
|
52
53
|
id: i,
|
|
@@ -55,7 +56,8 @@ var P = {
|
|
|
55
56
|
spec: t.spec,
|
|
56
57
|
alphabet: o ?? void 0
|
|
57
58
|
};
|
|
58
|
-
})
|
|
59
|
+
});
|
|
60
|
+
return E(r, (e) => e.linkHint !== void 0);
|
|
59
61
|
}), U = n;
|
|
60
62
|
function W(e) {
|
|
61
63
|
if (A(F.pframeHandle)) return console.warn("PFrame handle is not available, cannot fetch suggest options"), [];
|
|
@@ -102,8 +104,8 @@ var P = {
|
|
|
102
104
|
"supported-filters": _(U),
|
|
103
105
|
"get-suggest-options": W,
|
|
104
106
|
"is-pinned": (e, t) => z.value && t === 0,
|
|
105
|
-
"is-removable": (e, t) => z.value
|
|
106
|
-
"is-draggable": (e, t) => z.value
|
|
107
|
+
"is-removable": (e, t) => !z.value || t > 0,
|
|
108
|
+
"is-draggable": (e, t) => !z.value || t > 0,
|
|
107
109
|
"enable-dnd": !1,
|
|
108
110
|
"enable-toggling": !0,
|
|
109
111
|
"enable-add-group-button": !0,
|
|
@@ -133,7 +135,6 @@ var P = {
|
|
|
133
135
|
}, 8, ["modelValue"])], 64));
|
|
134
136
|
}
|
|
135
137
|
});
|
|
136
|
-
//#endregion
|
|
137
138
|
export { F as default };
|
|
138
139
|
|
|
139
140
|
//# sourceMappingURL=PlTableFiltersV2.vue2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlTableFiltersV2.vue_vue_type_script_setup_true_lang.js","names":["$style"],"sources":["../../../src/components/PlTableFilters/PlTableFiltersV2.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n PTableColumnSpec,\n PlDataTableFiltersWithMeta,\n PFrameHandle,\n PTableColumnId,\n PColumnSpec,\n PlDataTableColumnsMeta,\n} from \"@platforma-sdk/model\";\nimport {\n Annotation,\n Domain,\n readAnnotation,\n readDomain,\n getUniqueAxisValuesWithLabels,\n getUniqueSourceValuesWithLabels,\n getPTableColumnId,\n deriveDistinctLabels,\n peerLinkedLast,\n} from \"@platforma-sdk/model\";\nimport { computed, ref } from \"vue\";\nimport { PlBtnGhost, PlSlideModal, usePlBlockPageTitleTeleportTarget } from \"@milaboratories/uikit\";\nimport {\n PlAdvancedFilter,\n PlAdvancedFilterComponent,\n type PlAdvancedFilterItem,\n} from \"../PlAdvancedFilter\";\nimport type { PlAdvancedFilterColumnId } from \"../PlAdvancedFilter/types\";\nimport type { Nil } from \"@milaboratories/helpers\";\nimport { isFunction, isNil } from \"es-toolkit\";\nimport { resolveSuggestSource, TABLE_FILTER_TYPES } from \"./suggest-source\";\nimport { effectiveLinkHint } from \"../PlAgDataTable/sources/table-source-v2\";\n\nconst props = defineProps<{\n columns: PTableColumnSpec[];\n pframeHandle: Nil | PFrameHandle;\n columnsMeta?: PlDataTableColumnsMeta;\n filters: PlDataTableFiltersWithMeta;\n defaultFilters: Nil | PlDataTableFiltersWithMeta;\n onUpdateFilters: (value: PlDataTableFiltersWithMeta) => void;\n onResetDefaultFilters?: () => void;\n onUpdateDefaultFilters?: (value: PlDataTableFiltersWithMeta) => void;\n}>();\n\nconst teleportTarget = usePlBlockPageTitleTeleportTarget(\"PlTableFiltersV2\");\nconst showManager = ref(false);\nconst hasFilters = computed(() => props.filters.filters.length > 0);\nconst hasDefaultFilters = computed(\n () => !isNil(props.defaultFilters) && props.defaultFilters.filters.length > 0,\n);\nconst filters = computed<PlDataTableFiltersWithMeta>(() => {\n if (isNil(props.defaultFilters) || props.defaultFilters?.filters.length === 0) {\n return props.filters;\n }\n\n return {\n ...props.filters,\n filters: [...(props.defaultFilters?.filters ?? []), ...props.filters.filters],\n };\n});\nconst onUpdateFilters = (_value: PlAdvancedFilter) => {\n const value = _value as PlDataTableFiltersWithMeta;\n\n if (isNil(props.defaultFilters)) {\n return props.onUpdateFilters(value);\n }\n\n const [defaults, ...rest] = value.filters;\n props.onUpdateFilters({ ...value, filters: rest });\n props.onUpdateDefaultFilters?.({ ...props.defaultFilters, filters: [defaults] });\n};\n\nconst options = computed<PlAdvancedFilterItem[]>(() => {\n const columnEntries: { idx: number; spec: PColumnSpec }[] = [];\n props.columns.forEach((col, idx) => {\n if (col.type === \"column\") columnEntries.push({ idx, spec: col.spec });\n });\n const distinctLabelByIdx = new Map<number, string>();\n deriveDistinctLabels(\n columnEntries.map((e) => e.spec),\n {},\n ).forEach((label, i) => distinctLabelByIdx.set(columnEntries[i].idx, label));\n\n const items = props.columns.map((col, idx) => {\n const id = getPTableColumnId(col);\n const label =\n distinctLabelByIdx.get(idx)?.trim() ||\n readAnnotation(col.spec, Annotation.Label)?.trim() ||\n `Unlabeled ${col.type} ${idx}`;\n const alphabet =\n readDomain(col.spec, Domain.Alphabet) ?? readAnnotation(col.spec, Annotation.Alphabet);\n return {\n id,\n label,\n linkHint: effectiveLinkHint(col, props.columnsMeta),\n spec: col.spec,\n alphabet: alphabet ?? undefined,\n };\n });\n // Peer-linked columns last, as in the table.\n return peerLinkedLast(items, (item) => item.linkHint !== undefined);\n});\n\nconst supportedFilters = TABLE_FILTER_TYPES;\n\n// getSuggestOptions - provide discrete values from column annotations\nfunction handleSuggestOptions(params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n}) {\n if (isNil(props.pframeHandle)) {\n console.warn(\"PFrame handle is not available, cannot fetch suggest options\");\n return [];\n }\n\n const tableColumnId = params.columnId as PTableColumnId;\n if (typeof tableColumnId !== \"object\" || tableColumnId === null) {\n throw new Error(\"ColumnId should be a table column id for suggest options\");\n }\n\n const search = {\n limit: 100,\n searchQuery: params.searchType === \"label\" ? params.searchStr : undefined,\n searchQueryValue: params.searchType === \"value\" ? params.searchStr : undefined,\n };\n const source = resolveSuggestSource(props.columns, tableColumnId, params.axisIdx);\n const response =\n source.type === \"column\"\n ? getUniqueSourceValuesWithLabels(props.pframeHandle, {\n columnId: source.columnId,\n axisIdx: source.axisIdx,\n ...search,\n })\n : getUniqueAxisValuesWithLabels(props.pframeHandle, {\n axisSpec: source.axisSpec,\n parentColumnIds: source.parentColumnIds,\n ...search,\n });\n return response.then((v) => v.values);\n}\n</script>\n\n<template>\n <Teleport v-if=\"teleportTarget\" :to=\"teleportTarget\">\n <PlBtnGhost\n data-testid=\"pl-table-filters\"\n :icon=\"hasFilters || hasDefaultFilters ? 'filter-on' : 'filter'\"\n @click.stop=\"showManager = true\"\n >\n Filters\n </PlBtnGhost>\n </Teleport>\n\n <PlSlideModal\n v-model=\"showManager\"\n data-testid=\"pl-table-filters-panel\"\n :close-on-outside-click=\"false\"\n >\n <template #title>Manage Filters</template>\n\n <div data-testid=\"pl-table-filters-content\" :class=\"$style.root\">\n <PlAdvancedFilterComponent\n :filters=\"filters as PlAdvancedFilter\"\n :options=\"options\"\n :supported-filters=\"supportedFilters\"\n :get-suggest-options=\"handleSuggestOptions\"\n :is-pinned=\"(_, index) => hasDefaultFilters && index === 0\"\n :is-removable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :is-draggable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :enable-dnd=\"false\"\n :enable-toggling=\"true\"\n :enable-add-group-button=\"true\"\n @update-filters=\"onUpdateFilters\"\n >\n <template #group-title=\"{ index }\">\n <div\n v-if=\"hasDefaultFilters && index === 0\"\n data-testid=\"pl-table-filters-default-group-title\"\n :class=\"$style.defaultGroupTitle\"\n >\n Default Group\n <PlBtnGhost\n v-if=\"isFunction(props.onResetDefaultFilters)\"\n data-testid=\"pl-table-filters-reset-default\"\n icon=\"restart\"\n :class=\"$style.restartBtn\"\n @click.stop=\"props.onResetDefaultFilters()\"\n />\n </div>\n <div v-else data-testid=\"pl-table-filters-custom-group-title\">Custom Group</div>\n </template>\n </PlAdvancedFilterComponent>\n </div>\n </PlSlideModal>\n</template>\n\n<style module>\n.root {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n.defaultGroupTitle {\n display: flex;\n align-items: center;\n gap: 4px;\n}\n.restartBtn {\n width: 24px;\n height: 24px;\n padding: 4px;\n --button-width: 24px;\n --btn-min-width: 24px;\n --button-height: 24px;\n --btn-min-height: 24x;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAiCA,IAAM,IAAQ,GAWR,IAAiB,EAAkC,mBAAmB,EACtE,IAAc,EAAI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AAd,kBAAc,GAAA,CAAA,CAAA,CAAA;oBAkCzB,CAhCN,EAgCM,OAAA;IAhCD,eAAY;IAA4B,OAAK,EAAEA,EAAAA,OAAO,KAAI;OAC7D,EA8B4B,EAAA,EAAA,EAAA;IA7BzB,SAAS,EAAA;IACT,SAAS,EAAA;IACT,qBAAmB,EAAA,EAAgB;IACnC,uBAAqB;IACrB,cAAY,GAAG,MAAU,EAAA,SAAqB,MAAK;IACnD,iBAAe,GAAG,MAAW,EAAA,QAAoB,IAAK,IAAA;IACtD,iBAAe,GAAG,MAAW,EAAA,QAAoB,IAAK,IAAA;IACtD,cAAY;IACZ,mBAAiB;IACjB,2BAAyB;IACT;;IAEN,eAAW,GAcd,EAdkB,eAAK,CAErB,EAAA,SAAqB,MAAK,KAAA,GAAA,EADlC,EAaM,OAAA;;KAXJ,eAAY;KACX,OAAK,EAAEA,EAAAA,OAAO,kBAAiB;mBACjC,mBAEC,GAAA,EACQ,EAAA,EAAU,CAAC,EAAM,sBAAqB,IAAA,GAAA,EAD9C,EAME,EAAA,EAAA,EAAA;;KAJA,eAAY;KACZ,MAAK;KACJ,OAAK,EAAEA,EAAAA,OAAO,WAAU;KACxB,SAAK,AAAA,EAAA,OAAA,GAAA,MAAO,EAAM,uBAAqB,EAAA,CAAA,OAAA,CAAA;sDAG5C,EAAgF,OAAhF,GAA8D,eAAY,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"PlTableFiltersV2.vue_vue_type_script_setup_true_lang.js","names":["$style","_openBlock","_createElementBlock","_Fragment","_unref","_createBlock","_Teleport","_createVNode","_withModifiers","_withCtx","_createTextVNode","_createCommentVNode","_createElementVNode","_normalizeClass","PlAdvancedFilterComponent","PlAdvancedFilter_default","_hoisted_1","PlTableFiltersV2_vue_vue_type_script_setup_true_lang_default","props","__props","teleportTarget","usePlBlockPageTitleTeleportTarget","showManager","ref","hasFilters","computed","hasDefaultFilters","isNil","filters","onUpdateFilters","value","_value","defaults","rest","options","columnEntries","col","distinctLabelByIdx","i","label","items","id","getPTableColumnId","idx","readAnnotation","Annotation","alphabet","readDomain","Domain","effectiveLinkHint","peerLinkedLast","item","supportedFilters","TABLE_FILTER_TYPES","handleSuggestOptions","tableColumnId","params","search","source","resolveSuggestSource","getUniqueSourceValuesWithLabels","getUniqueAxisValuesWithLabels","v","openBlock","createElementBlock","Fragment","unref","createBlock","Teleport","createVNode","PlBtnGhost","_cache","withModifiers","withCtx","createTextVNode","createCommentVNode","PlSlideModal","$event","createElementVNode","normalizeClass","_ctx","index","isFunction"],"sources":["../../../src/components/PlTableFilters/PlTableFiltersV2.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n PTableColumnSpec,\n PlDataTableFiltersWithMeta,\n PFrameHandle,\n PTableColumnId,\n PColumnSpec,\n PlDataTableColumnsMeta,\n} from \"@platforma-sdk/model\";\nimport {\n Annotation,\n Domain,\n readAnnotation,\n readDomain,\n getUniqueAxisValuesWithLabels,\n getUniqueSourceValuesWithLabels,\n getPTableColumnId,\n deriveDistinctLabels,\n peerLinkedLast,\n} from \"@platforma-sdk/model\";\nimport { computed, ref } from \"vue\";\nimport { PlBtnGhost, PlSlideModal, usePlBlockPageTitleTeleportTarget } from \"@milaboratories/uikit\";\nimport {\n PlAdvancedFilter,\n PlAdvancedFilterComponent,\n type PlAdvancedFilterItem,\n} from \"../PlAdvancedFilter\";\nimport type { PlAdvancedFilterColumnId } from \"../PlAdvancedFilter/types\";\nimport type { Nil } from \"@milaboratories/helpers\";\nimport { isFunction, isNil } from \"es-toolkit\";\nimport { resolveSuggestSource, TABLE_FILTER_TYPES } from \"./suggest-source\";\nimport { effectiveLinkHint } from \"../PlAgDataTable/sources/table-source-v2\";\n\nconst props = defineProps<{\n columns: PTableColumnSpec[];\n pframeHandle: Nil | PFrameHandle;\n columnsMeta?: PlDataTableColumnsMeta;\n filters: PlDataTableFiltersWithMeta;\n defaultFilters: Nil | PlDataTableFiltersWithMeta;\n onUpdateFilters: (value: PlDataTableFiltersWithMeta) => void;\n onResetDefaultFilters?: () => void;\n onUpdateDefaultFilters?: (value: PlDataTableFiltersWithMeta) => void;\n}>();\n\nconst teleportTarget = usePlBlockPageTitleTeleportTarget(\"PlTableFiltersV2\");\nconst showManager = ref(false);\nconst hasFilters = computed(() => props.filters.filters.length > 0);\nconst hasDefaultFilters = computed(\n () => !isNil(props.defaultFilters) && props.defaultFilters.filters.length > 0,\n);\nconst filters = computed<PlDataTableFiltersWithMeta>(() => {\n if (isNil(props.defaultFilters) || props.defaultFilters?.filters.length === 0) {\n return props.filters;\n }\n\n return {\n ...props.filters,\n filters: [...(props.defaultFilters?.filters ?? []), ...props.filters.filters],\n };\n});\nconst onUpdateFilters = (_value: PlAdvancedFilter) => {\n const value = _value as PlDataTableFiltersWithMeta;\n\n if (isNil(props.defaultFilters)) {\n return props.onUpdateFilters(value);\n }\n\n const [defaults, ...rest] = value.filters;\n props.onUpdateFilters({ ...value, filters: rest });\n props.onUpdateDefaultFilters?.({ ...props.defaultFilters, filters: [defaults] });\n};\n\nconst options = computed<PlAdvancedFilterItem[]>(() => {\n const columnEntries: { idx: number; spec: PColumnSpec }[] = [];\n props.columns.forEach((col, idx) => {\n if (col.type === \"column\") columnEntries.push({ idx, spec: col.spec });\n });\n const distinctLabelByIdx = new Map<number, string>();\n deriveDistinctLabels(\n columnEntries.map((e) => e.spec),\n {},\n ).forEach((label, i) => distinctLabelByIdx.set(columnEntries[i].idx, label));\n\n const items = props.columns.map((col, idx) => {\n const id = getPTableColumnId(col);\n const label =\n distinctLabelByIdx.get(idx)?.trim() ||\n readAnnotation(col.spec, Annotation.Label)?.trim() ||\n `Unlabeled ${col.type} ${idx}`;\n const alphabet =\n readDomain(col.spec, Domain.Alphabet) ?? readAnnotation(col.spec, Annotation.Alphabet);\n return {\n id,\n label,\n linkHint: effectiveLinkHint(col, props.columnsMeta),\n spec: col.spec,\n alphabet: alphabet ?? undefined,\n };\n });\n // Peer-linked columns last, as in the table.\n return peerLinkedLast(items, (item) => item.linkHint !== undefined);\n});\n\nconst supportedFilters = TABLE_FILTER_TYPES;\n\n// getSuggestOptions - provide discrete values from column annotations\nfunction handleSuggestOptions(params: {\n columnId: PlAdvancedFilterColumnId;\n axisIdx?: number;\n searchStr: string;\n searchType: \"value\" | \"label\";\n}) {\n if (isNil(props.pframeHandle)) {\n console.warn(\"PFrame handle is not available, cannot fetch suggest options\");\n return [];\n }\n\n const tableColumnId = params.columnId as PTableColumnId;\n if (typeof tableColumnId !== \"object\" || tableColumnId === null) {\n throw new Error(\"ColumnId should be a table column id for suggest options\");\n }\n\n const search = {\n limit: 100,\n searchQuery: params.searchType === \"label\" ? params.searchStr : undefined,\n searchQueryValue: params.searchType === \"value\" ? params.searchStr : undefined,\n };\n const source = resolveSuggestSource(props.columns, tableColumnId, params.axisIdx);\n const response =\n source.type === \"column\"\n ? getUniqueSourceValuesWithLabels(props.pframeHandle, {\n columnId: source.columnId,\n axisIdx: source.axisIdx,\n ...search,\n })\n : getUniqueAxisValuesWithLabels(props.pframeHandle, {\n axisSpec: source.axisSpec,\n parentColumnIds: source.parentColumnIds,\n ...search,\n });\n return response.then((v) => v.values);\n}\n</script>\n\n<template>\n <Teleport v-if=\"teleportTarget\" :to=\"teleportTarget\">\n <PlBtnGhost\n data-testid=\"pl-table-filters\"\n :icon=\"hasFilters || hasDefaultFilters ? 'filter-on' : 'filter'\"\n @click.stop=\"showManager = true\"\n >\n Filters\n </PlBtnGhost>\n </Teleport>\n\n <PlSlideModal\n v-model=\"showManager\"\n data-testid=\"pl-table-filters-panel\"\n :close-on-outside-click=\"false\"\n >\n <template #title>Manage Filters</template>\n\n <div data-testid=\"pl-table-filters-content\" :class=\"$style.root\">\n <PlAdvancedFilterComponent\n :filters=\"filters as PlAdvancedFilter\"\n :options=\"options\"\n :supported-filters=\"supportedFilters\"\n :get-suggest-options=\"handleSuggestOptions\"\n :is-pinned=\"(_, index) => hasDefaultFilters && index === 0\"\n :is-removable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :is-draggable=\"(_, index) => (hasDefaultFilters ? index > 0 : true)\"\n :enable-dnd=\"false\"\n :enable-toggling=\"true\"\n :enable-add-group-button=\"true\"\n @update-filters=\"onUpdateFilters\"\n >\n <template #group-title=\"{ index }\">\n <div\n v-if=\"hasDefaultFilters && index === 0\"\n data-testid=\"pl-table-filters-default-group-title\"\n :class=\"$style.defaultGroupTitle\"\n >\n Default Group\n <PlBtnGhost\n v-if=\"isFunction(props.onResetDefaultFilters)\"\n data-testid=\"pl-table-filters-reset-default\"\n icon=\"restart\"\n :class=\"$style.restartBtn\"\n @click.stop=\"props.onResetDefaultFilters()\"\n />\n </div>\n <div v-else data-testid=\"pl-table-filters-custom-group-title\">Custom Group</div>\n </template>\n </PlAdvancedFilterComponent>\n </div>\n </PlSlideModal>\n</template>\n\n<style module>\n.root {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n.defaultGroupTitle {\n display: flex;\n align-items: center;\n gap: 4px;\n}\n.restartBtn {\n width: 24px;\n height: 24px;\n padding: 4px;\n --button-width: 24px;\n --btn-min-width: 24px;\n --button-height: 24px;\n --btn-min-height: 24x;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAiCA,IAAMkB,IAAQC,GAWRC,IAAiBC,EAAkC,kBAAkB,GACrEC,IAAcC,EAAI,EAAK,GACvBC,IAAaC,QAAeP,EAAM,QAAQ,QAAQ,SAAS,CAAC,GAC5DQ,IAAoBD,QAClB,CAACE,EAAMT,EAAM,cAAc,KAAKA,EAAM,eAAe,QAAQ,SAAS,CAC9E,GACMU,IAAUH,QACVE,EAAMT,EAAM,cAAc,KAAKA,EAAM,gBAAgB,QAAQ,WAAW,IACnEA,EAAM,UAGR;GACL,GAAGA,EAAM;GACT,SAAS,CAAC,GAAIA,EAAM,gBAAgB,WAAW,CAAC,GAAI,GAAGA,EAAM,QAAQ,OAAO;EAC9E,CACD,GACKW,KAAmB,MAA6B;GACpD,IAAMC,IAAQC;GAEd,IAA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7DO,EA8B4BH,EAAAU,CAAA,GAAA;IA7BzB,SAASc,EAAA;IACT,SAASM,EAAA;IACT,qBAAmB9B,EAAAgD,CAAA;IACnB,uBAAqBE;IACrB,cAAY,GAAG,MAAU5B,EAAA,SAAqBuD,MAAK;IACnD,iBAAe,GAAG,MAAW,GAAA,SAAoBA,IAAK;IACtD,iBAAe,GAAG,MAAW,GAAA,SAAoBA,IAAK;IACtD,cAAY;IACZ,mBAAiB;IACjB,2BAAyB;IACT;;IAEN,eAAWxE,GAcd,EAdkB,eAAK,CAErBiB,EAAA,SAAqBuD,MAAK,KADlChF,EAAA,GAAAC,EAaM,OAAA;;KAXJ,eAAY;KACX,OAAKW,EAAEb,EAAAA,OAAO,iBAAiB;I,IACjC,AAAAuE,EAAA,OAAA7D,EAAA,mBAEC,EAAA,GACQN,EAAA8E,CAAA,CAAU,CAAChE,EAAM,qBAAqB,KAD9CjB,EAAA,GAAAI,EAMED,EAAAkE,CAAA,GAAA;;KAJA,eAAY;KACZ,MAAK;KACJ,OAAKzD,EAAEb,EAAAA,OAAO,UAAU;KACxB,SAAK,AAAAuE,EAAA,OAAA/D,GAAA,MAAOU,EAAM,sBAAqB,GAAA,CAAA,MAAA,CAAA;I,6CAG5CjB,EAAA,GAAAC,EAAgF,OAAhFc,GAA8D,cAAY,E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default as PlTableFiltersV2 } from "./PlTableFiltersV2.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { canonicalizeAxisId as e, extractPObjectId as t, getAxisId as n } from "@platforma-sdk/model";
|
|
2
|
-
|
|
2
|
+
// src/components/PlTableFilters/suggest-source.ts
|
|
3
3
|
var r = [
|
|
4
4
|
"isNA",
|
|
5
5
|
"isNotNA",
|
|
@@ -36,7 +36,6 @@ function i(n, r, i) {
|
|
|
36
36
|
function a(t, r) {
|
|
37
37
|
return t.some((t) => e(n(t)) === r);
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { r as TABLE_FILTER_TYPES, i as resolveSuggestSource };
|
|
41
40
|
|
|
42
41
|
//# sourceMappingURL=suggest-source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest-source.js","names":[],"sources":["../../../src/components/PlTableFilters/suggest-source.ts"],"sourcesContent":["import type { AxisSpec, PObjectId, PTableColumnId, PTableColumnSpec } from \"@platforma-sdk/model\";\nimport { canonicalizeAxisId, extractPObjectId, getAxisId } from \"@platforma-sdk/model\";\nimport type { SupportedFilterTypes } from \"../PlAdvancedFilter/types\";\n\n/** Predicates the table filter offers (same set as FilterSidebar, plus list membership). */\nexport const TABLE_FILTER_TYPES: SupportedFilterTypes[] = [\n \"isNA\",\n \"isNotNA\",\n \"greaterThan\",\n \"greaterThanOrEqual\",\n \"lessThan\",\n \"lessThanOrEqual\",\n \"patternEquals\",\n \"patternNotEquals\",\n \"patternContainSubsequence\",\n \"patternNotContainSubsequence\",\n \"patternMatchesRegularExpression\",\n \"patternFuzzyContainSubsequence\",\n \"equal\",\n \"notEqual\",\n \"inSet\",\n \"notInSet\",\n];\n\n/** Where value suggestions for a filtered table column come from. */\nexport type SuggestSource =\n | { type: \"column\"; columnId: PObjectId; axisIdx: undefined | number }\n | { type: \"axis\"; axisSpec: AxisSpec; parentColumnIds: PObjectId[] };\n\n/**\n * A data column suggests its own values. An axis suggests the keys of every\n * table column carrying it: a full join can hold keys that only some of those\n * columns have, and the user can filter by any of them.\n */\nexport function resolveSuggestSource(\n columns: PTableColumnSpec[],\n tableColumnId: PTableColumnId,\n axisIdx: undefined | number,\n): SuggestSource {\n if (tableColumnId.type === \"column\") {\n return { type: \"column\", columnId: extractPObjectId(tableColumnId.id), axisIdx };\n }\n\n const strAxisId = canonicalizeAxisId(tableColumnId.id);\n let axisSpec: undefined | AxisSpec;\n const parentColumnIds = new Set<PObjectId>();\n for (const col of columns) {\n if (col.type === \"axis\") {\n if (canonicalizeAxisId(col.id) === strAxisId) axisSpec = col.spec;\n } else if (carriesAxis(col.spec.axesSpec, strAxisId)) {\n parentColumnIds.add(extractPObjectId(col.id));\n }\n }\n if (axisSpec === undefined || parentColumnIds.size === 0) {\n throw new Error(\n `No column in the table carries axis ${tableColumnId.id.name}, cannot fetch suggest options`,\n );\n }\n return { type: \"axis\", axisSpec, parentColumnIds: [...parentColumnIds] };\n}\n\n// Internals\n\nfunction carriesAxis(axesSpec: AxisSpec[], strAxisId: string): boolean {\n return axesSpec.some((axis) => canonicalizeAxisId(getAxisId(axis)) === strAxisId);\n}\n"],"mappings":";;AAKA,
|
|
1
|
+
{"version":3,"file":"suggest-source.js","names":["TABLE_FILTER_TYPES","resolveSuggestSource","tableColumnId","extractPObjectId","strAxisId","canonicalizeAxisId","axisSpec","parentColumnIds","col","columns","carriesAxis","axesSpec","getAxisId","axis"],"sources":["../../../src/components/PlTableFilters/suggest-source.ts"],"sourcesContent":["import type { AxisSpec, PObjectId, PTableColumnId, PTableColumnSpec } from \"@platforma-sdk/model\";\nimport { canonicalizeAxisId, extractPObjectId, getAxisId } from \"@platforma-sdk/model\";\nimport type { SupportedFilterTypes } from \"../PlAdvancedFilter/types\";\n\n/** Predicates the table filter offers (same set as FilterSidebar, plus list membership). */\nexport const TABLE_FILTER_TYPES: SupportedFilterTypes[] = [\n \"isNA\",\n \"isNotNA\",\n \"greaterThan\",\n \"greaterThanOrEqual\",\n \"lessThan\",\n \"lessThanOrEqual\",\n \"patternEquals\",\n \"patternNotEquals\",\n \"patternContainSubsequence\",\n \"patternNotContainSubsequence\",\n \"patternMatchesRegularExpression\",\n \"patternFuzzyContainSubsequence\",\n \"equal\",\n \"notEqual\",\n \"inSet\",\n \"notInSet\",\n];\n\n/** Where value suggestions for a filtered table column come from. */\nexport type SuggestSource =\n | { type: \"column\"; columnId: PObjectId; axisIdx: undefined | number }\n | { type: \"axis\"; axisSpec: AxisSpec; parentColumnIds: PObjectId[] };\n\n/**\n * A data column suggests its own values. An axis suggests the keys of every\n * table column carrying it: a full join can hold keys that only some of those\n * columns have, and the user can filter by any of them.\n */\nexport function resolveSuggestSource(\n columns: PTableColumnSpec[],\n tableColumnId: PTableColumnId,\n axisIdx: undefined | number,\n): SuggestSource {\n if (tableColumnId.type === \"column\") {\n return { type: \"column\", columnId: extractPObjectId(tableColumnId.id), axisIdx };\n }\n\n const strAxisId = canonicalizeAxisId(tableColumnId.id);\n let axisSpec: undefined | AxisSpec;\n const parentColumnIds = new Set<PObjectId>();\n for (const col of columns) {\n if (col.type === \"axis\") {\n if (canonicalizeAxisId(col.id) === strAxisId) axisSpec = col.spec;\n } else if (carriesAxis(col.spec.axesSpec, strAxisId)) {\n parentColumnIds.add(extractPObjectId(col.id));\n }\n }\n if (axisSpec === undefined || parentColumnIds.size === 0) {\n throw new Error(\n `No column in the table carries axis ${tableColumnId.id.name}, cannot fetch suggest options`,\n );\n }\n return { type: \"axis\", axisSpec, parentColumnIds: [...parentColumnIds] };\n}\n\n// Internals\n\nfunction carriesAxis(axesSpec: AxisSpec[], strAxisId: string): boolean {\n return axesSpec.some((axis) => canonicalizeAxisId(getAxisId(axis)) === strAxisId);\n}\n"],"mappings":";;AAKA,IAAaA,IAA6C;CACxD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAYA,SAAgBC,EACd,GACA,GACA,GACe;CACf,IAAIC,EAAc,SAAS,UACzB,OAAO;EAAE,MAAM;EAAU,UAAUC,EAAiBD,EAAc,EAAE;EAAG;CAAQ;CAGjF,IAAME,IAAYC,EAAmBH,EAAc,EAAE,GACjDI,GACEC,oBAAkB,IAAI,IAAe;CAC3C,KAAK,IAAMC,KAAOC,GAChB,AAAID,EAAI,SAAS,SACXH,EAAmBG,EAAI,EAAE,MAAMJ,MAAW,IAAWI,EAAI,QACpDE,EAAYF,EAAI,KAAK,UAAUJ,CAAS,KACjDG,EAAgB,IAAIJ,EAAiBK,EAAI,EAAE,CAAC;CAGhD,IAAIF,MAAa,KAAA,KAAaC,EAAgB,SAAS,GACrD,MAAU,MACR,uCAAuCL,EAAc,GAAG,KAAK,+BAC/D;CAEF,OAAO;EAAE,MAAM;EAAQ;EAAU,iBAAiB,CAAC,GAAGK,CAAe;CAAE;AACzE;AAIA,SAASG,EAAY,GAAsB,GAA4B;CACrE,OAAOC,EAAS,MAAM,MAASN,EAAmBO,EAAUC,CAAI,CAAC,MAAMT,CAAS;AAClF"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { getEnvironmentValue as e } from "@platforma-sdk/model";
|
|
2
2
|
import { AllEnterpriseModule as t, LicenseManager as n, ModuleRegistry as r } from "ag-grid-enterprise";
|
|
3
|
-
|
|
3
|
+
// src/composition/AgGrid/index.ts
|
|
4
4
|
function i() {
|
|
5
5
|
r.registerModules([t]);
|
|
6
6
|
let i = e("AGGRID_LICENSE");
|
|
7
7
|
i ? (n.setLicenseKey(i), console.log("AG Grid Activated")) : console.log("AG Grid License not found");
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { i as activateAgGrid };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/composition/AgGrid/index.ts"],"sourcesContent":["import { AllEnterpriseModule, LicenseManager, ModuleRegistry } from \"ag-grid-enterprise\";\nimport { getEnvironmentValue } from \"@platforma-sdk/model\";\n\nexport function activateAgGrid() {\n ModuleRegistry.registerModules([AllEnterpriseModule]);\n const agGridLicense = getEnvironmentValue(\"AGGRID_LICENSE\");\n if (agGridLicense) {\n LicenseManager.setLicenseKey(agGridLicense);\n console.log(\"AG Grid Activated\");\n } else {\n console.log(\"AG Grid License not found\");\n }\n}\n"],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["activateAgGrid","AllEnterpriseModule","agGridLicense","getEnvironmentValue","LicenseManager"],"sources":["../../../src/composition/AgGrid/index.ts"],"sourcesContent":["import { AllEnterpriseModule, LicenseManager, ModuleRegistry } from \"ag-grid-enterprise\";\nimport { getEnvironmentValue } from \"@platforma-sdk/model\";\n\nexport function activateAgGrid() {\n ModuleRegistry.registerModules([AllEnterpriseModule]);\n const agGridLicense = getEnvironmentValue(\"AGGRID_LICENSE\");\n if (agGridLicense) {\n LicenseManager.setLicenseKey(agGridLicense);\n console.log(\"AG Grid Activated\");\n } else {\n console.log(\"AG Grid License not found\");\n }\n}\n"],"mappings":";;;AAGA,SAAgBA,IAAiB;CAC/B,EAAe,gBAAgB,CAACC,CAAmB,CAAC;CACpD,IAAMC,IAAgBC,EAAoB,gBAAgB;CAC1D,AAAID,KACFE,EAAe,cAAcF,CAAa,GAC1C,QAAQ,IAAI,mBAAmB,KAE/B,QAAQ,IAAI,2BAA2B;AAE3C"}
|
|
@@ -3,8 +3,9 @@ import "../lib/util/helpers/dist/index.js";
|
|
|
3
3
|
import { computed as t, effectScope as n, getCurrentScope as r, onScopeDispose as i, shallowRef as a } from "vue";
|
|
4
4
|
import { getRawPlatformaInstance as o } from "@platforma-sdk/model";
|
|
5
5
|
import { LRUCache as s } from "lru-cache";
|
|
6
|
-
|
|
6
|
+
// src/composition/fileContent.ts
|
|
7
7
|
var c = { cacheSize: 15e6 }, l = class {
|
|
8
|
+
bytes;
|
|
8
9
|
_str = void 0;
|
|
9
10
|
_rawJson = void 0;
|
|
10
11
|
_zodSchema = void 0;
|
|
@@ -29,6 +30,7 @@ var f = new s({
|
|
|
29
30
|
maxSize: c.cacheSize,
|
|
30
31
|
sizeCalculation: (e) => e.bytes.length
|
|
31
32
|
}), p = new e(), m = class m {
|
|
33
|
+
currentScope;
|
|
32
34
|
fileDataCache;
|
|
33
35
|
fetcher;
|
|
34
36
|
ns = /* @__PURE__ */ new Map();
|
|
@@ -90,7 +92,8 @@ var f = new s({
|
|
|
90
92
|
let r = a();
|
|
91
93
|
return t.set(e, r), (async () => {
|
|
92
94
|
for (let t = 0; t < 8; t++) try {
|
|
93
|
-
|
|
95
|
+
let t = await this.doFetch(e);
|
|
96
|
+
r.value = t;
|
|
94
97
|
return;
|
|
95
98
|
} catch (e) {
|
|
96
99
|
console.error(`File download attempt ${t + 1}/8 failed:`, e), t < 7 ? await new Promise((e) => setTimeout(e, 1e3)) : console.error("Failed to download file after 8 attempts");
|
|
@@ -119,17 +122,18 @@ var f = new s({
|
|
|
119
122
|
}), t;
|
|
120
123
|
}
|
|
121
124
|
static use(e, t) {
|
|
122
|
-
|
|
125
|
+
let n = this.initScope(t);
|
|
126
|
+
return new m(n, { ...e });
|
|
123
127
|
}
|
|
124
128
|
static useGlobal(e, t) {
|
|
125
|
-
|
|
129
|
+
let n = this.initScope(t);
|
|
130
|
+
return new m(n, {
|
|
126
131
|
...e,
|
|
127
132
|
lruCache: f,
|
|
128
133
|
fetcher: p
|
|
129
134
|
});
|
|
130
135
|
}
|
|
131
136
|
};
|
|
132
|
-
//#endregion
|
|
133
137
|
export { m as ReactiveFileContent };
|
|
134
138
|
|
|
135
139
|
//# sourceMappingURL=fileContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileContent.js","names":[],"sources":["../../src/composition/fileContent.ts"],"sourcesContent":["import type { BlobHandleAndSize } from \"@platforma-sdk/model\";\nimport { getRawPlatformaInstance } from \"@platforma-sdk/model\";\nimport { LRUCache } from \"lru-cache\";\nimport type { ComputedRef, ShallowRef, EffectScope } from \"vue\";\nimport { computed, shallowRef, getCurrentScope, onScopeDispose, effectScope } from \"vue\";\nimport type { ZodSchema, SafeParseReturnType } from \"zod\";\nimport { Fetcher } from \"@milaboratories/helpers\";\n\ntype FileHandle = BlobHandleAndSize[\"handle\"];\n\nexport type ReactiveFileContentOps = {\n /** Maximum size in bytes of file content to cache */\n cacheSize: number;\n lruCache?: LRUCache<FileHandle, FileContentData>;\n fetcher?: Fetcher<FileHandle, FileContentData>;\n};\n\nconst DefaultReactiveFileContentOps: ReactiveFileContentOps = {\n cacheSize: 15_000_000, // 15 Mb\n};\n\nclass FileContentData {\n private _str: string | undefined = undefined;\n private _rawJson: unknown | undefined = undefined;\n private _zodSchema: ZodSchema | undefined = undefined;\n private _validatedJson: SafeParseReturnType<unknown, unknown> | undefined = undefined;\n\n constructor(public readonly bytes: Uint8Array) {}\n\n public get str(): string {\n if (this._str === undefined) this._str = new TextDecoder().decode(this.bytes);\n return this._str;\n }\n\n public get rawJson(): unknown {\n if (this._rawJson === undefined) this._rawJson = JSON.parse(this.str);\n return this._rawJson;\n }\n\n public validatedJson<T>(schema: ZodSchema<T>): T | undefined {\n if (this._zodSchema !== schema) {\n this._validatedJson = schema.safeParse(this.rawJson);\n this._zodSchema = schema;\n }\n return this._validatedJson?.success ? (this._validatedJson.data as T) : undefined;\n }\n}\n\nconst scopes = new WeakMap<EffectScope, Map<FileHandle, ShallowRef<FileContentData | undefined>>>();\n\nfunction addScope(scope: EffectScope) {\n scopes.set(scope, new Map<FileHandle, ShallowRef<FileContentData | undefined>>());\n}\n\nconst globalCache = new LRUCache<FileHandle, FileContentData>({\n maxSize: DefaultReactiveFileContentOps.cacheSize,\n sizeCalculation: (value) => value.bytes.length,\n});\n\nconst globalFetcher = new Fetcher<FileHandle, FileContentData>();\n\nexport class ReactiveFileContent {\n private readonly fileDataCache: LRUCache<FileHandle, FileContentData>;\n private readonly fetcher: Fetcher<FileHandle, FileContentData>;\n private ns = new Map<string, Set<FileHandle>>();\n private currentKey: string | undefined;\n\n private constructor(\n private currentScope: EffectScope,\n _ops?: Partial<ReactiveFileContentOps>,\n ) {\n const ops: ReactiveFileContentOps = { ...DefaultReactiveFileContentOps, ..._ops };\n this.fileDataCache =\n ops.lruCache ??\n new LRUCache<FileHandle, FileContentData>({\n maxSize: ops.cacheSize,\n sizeCalculation: (value) => value.bytes.length,\n });\n this.fetcher = ops.fetcher ?? new Fetcher<FileHandle, FileContentData>();\n }\n\n /**\n * Experimental method to invalidate the refs map cache for a given key.\n */\n public withInvalidate<T>(key: string, cb: () => T) {\n const previous = this.ns.get(key);\n this.ns.set(key, new Set());\n this.currentKey = key;\n try {\n const res = cb();\n this.invalidate(key, previous);\n return res;\n } finally {\n this.currentKey = undefined;\n }\n }\n\n public stopScope() {\n scopes.delete(this.currentScope);\n this.currentScope.stop();\n }\n\n private async doFetch(handle: FileHandle) {\n if (!this.fileDataCache.has(handle)) {\n const fileContentData = await this.fetcher.fetch(\n handle,\n async () =>\n new FileContentData(await getRawPlatformaInstance().blobDriver.getContent(handle)),\n );\n this.fileDataCache.set(handle, fileContentData);\n }\n\n return this.fileDataCache.get(handle)!;\n }\n\n private getSize() {\n const refsMap = this.getRefsMap();\n return refsMap ? refsMap.size : 0;\n }\n\n private getRefsMap() {\n return scopes.get(this.currentScope);\n }\n\n private invalidate(key: string, previous: Set<FileHandle> | undefined) {\n if (!previous) {\n return;\n }\n\n const actual = this.ns.get(key)!;\n\n for (const handle of actual) {\n previous.delete(handle);\n }\n\n const map = this.getRefsMap();\n\n for (const handle of previous) {\n map?.delete(handle);\n }\n }\n\n private withHandle(handle: FileHandle) {\n if (this.currentKey) {\n this.ns.get(this.currentKey)?.add(handle);\n }\n }\n\n private getDataRef(handle: FileHandle): ShallowRef<FileContentData | undefined> {\n const refsMap = this.getRefsMap();\n\n if (!refsMap) {\n throw new Error(\"ReactiveFileContent must be used within a Vue component or effect scope.\");\n }\n\n this.withHandle(handle);\n\n const refFromMap = refsMap.get(handle);\n\n if (refFromMap !== undefined) {\n return refFromMap;\n }\n\n const newRef = shallowRef<FileContentData>();\n refsMap.set(handle, newRef);\n\n // Initiating actual fetch from the cache, that will in turn initiate upload\n (async () => {\n const maxRetries = 8;\n const retryDelay = 1000; // 1 second\n\n for (let attempt = 0; attempt < maxRetries; attempt++) {\n try {\n const data = await this.doFetch(handle);\n newRef.value = data;\n return;\n } catch (err: unknown) {\n console.error(`File download attempt ${attempt + 1}/${maxRetries} failed:`, err);\n\n if (attempt < maxRetries - 1) {\n await new Promise((resolve) => setTimeout(resolve, retryDelay));\n } else {\n console.error(`Failed to download file after ${maxRetries} attempts`);\n }\n }\n }\n })();\n\n return newRef;\n }\n\n public getContentBytes(handle: FileHandle): ComputedRef<Uint8Array | undefined>;\n public getContentBytes(\n handle: FileHandle | undefined,\n ): ComputedRef<Uint8Array | undefined> | undefined;\n public getContentBytes(\n handle: FileHandle | undefined,\n ): ComputedRef<Uint8Array | undefined> | undefined {\n if (handle === undefined) return undefined;\n const dataRef = this.getDataRef(handle);\n return computed(() => dataRef.value?.bytes);\n }\n\n public getContentString(handle: FileHandle): ComputedRef<string | undefined>;\n public getContentString(\n handle: FileHandle | undefined,\n ): ComputedRef<string | undefined> | undefined;\n public getContentString(\n handle: FileHandle | undefined,\n ): ComputedRef<string | undefined> | undefined {\n if (handle === undefined) return undefined;\n const dataRef = this.getDataRef(handle);\n return computed(() => dataRef.value?.str);\n }\n\n public getContentJson<T>(handle: FileHandle, schema: ZodSchema<T>): ComputedRef<T | undefined>;\n public getContentJson<T>(\n handle: FileHandle | undefined,\n schema: ZodSchema<T>,\n ): ComputedRef<T | undefined> | undefined;\n public getContentJson<T = unknown>(handle: FileHandle): ComputedRef<T | undefined>;\n public getContentJson<T = unknown>(\n handle: FileHandle | undefined,\n ): ComputedRef<T | undefined> | undefined;\n public getContentJson<T>(\n handle: FileHandle | undefined,\n schema?: ZodSchema<T>,\n ): ComputedRef<T | undefined> | undefined;\n public getContentJson<T>(\n handle: FileHandle | undefined,\n schema?: ZodSchema<T>,\n ): ComputedRef<T | undefined> | undefined {\n if (handle === undefined) return undefined;\n const dataRef = this.getDataRef(handle);\n return computed(\n () =>\n (schema === undefined ? dataRef.value?.rawJson : dataRef.value?.validatedJson(schema)) as T,\n );\n }\n\n private static initScope(_scope: EffectScope | undefined) {\n let scope = getCurrentScope() ?? _scope;\n\n if (!scope) {\n console.warn(\"Current scope not found, using new detached scope...\");\n scope = effectScope(true);\n }\n\n addScope(scope);\n\n onScopeDispose(() => {\n scopes.delete(scope);\n });\n\n return scope;\n }\n\n /**\n * Creates a ReactiveFileContent instance with isolated cache and fetcher.\n * Use this when you need component-specific caching.\n *\n * @example\n * ```ts\n * import { ReactiveFileContent } from '@platforma-sdk/ui-vue';\n * import { computed } from 'vue';\n *\n * const fileContent = ReactiveFileContent.use();\n *\n * const processedData = computed(() => {\n * const content = fileContent.getContentString(fileHandle).value;\n * return content?.split('\\n').length ?? 0;\n * });\n * ```\n */\n public static use(_ops?: Partial<ReactiveFileContentOps>, _scope?: EffectScope) {\n const scope = this.initScope(_scope);\n\n return new ReactiveFileContent(scope, { ..._ops });\n }\n\n /**\n * Creates a ReactiveFileContent instance with globally shared cache and fetcher.\n * Use this to share file content cache across multiple components.\n *\n * @example\n * ```ts\n * import { ReactiveFileContent } from '@platforma-sdk/ui-vue';\n * import { computed } from 'vue';\n *\n * const fileContent = ReactiveFileContent.useGlobal();\n *\n * const combinedData = computed(() => {\n * const data1 = fileContent.getContentJson(handle1).value;\n * const data2 = fileContent.getContentJson(handle2).value;\n * return { data1, data2 };\n * });\n * ```\n */\n public static useGlobal(_ops?: Partial<ReactiveFileContentOps>, _scope?: EffectScope) {\n const scope = this.initScope(_scope);\n\n return new ReactiveFileContent(scope, {\n ..._ops,\n lruCache: globalCache,\n fetcher: globalFetcher,\n });\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAM,IAAwD,EAC5D,WAAW,MACZ,EAEK,IAAN,MAAsB;CACpB,OAAmC,KAAA;CACnC,WAAwC,KAAA;CACxC,aAA4C,KAAA;CAC5C,iBAA4E,KAAA;CAE5E,YAAY,GAAmC;AAAnB,OAAA,QAAA;;CAE5B,IAAW,MAAc;AAEvB,SADI,KAAK,SAAS,KAAA,MAAW,KAAK,OAAO,IAAI,aAAa,CAAC,OAAO,KAAK,MAAM,GACtE,KAAK;;CAGd,IAAW,UAAmB;AAE5B,SADI,KAAK,aAAa,KAAA,MAAW,KAAK,WAAW,KAAK,MAAM,KAAK,IAAI,GAC9D,KAAK;;CAGd,cAAwB,GAAqC;AAK3D,SAJI,KA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U,KAAK,WAAW,EAAO;AACvC,SAAO,QAAe,EAAQ,OAAO,IAAI;;CAgB3C,eACE,GACA,GACwC;AACxC,MAAI,MAAW,KAAA,EAAW;EAC1B,IAAM,IAAU,KAAK,WAAW,EAAO;AACvC,SAAO,QAEF,MAAW,KAAA,IAAY,EAAQ,OAAO,UAAU,EAAQ,OAAO,cAAc,EAAO,CACxF;;CAGH,OAAe,UAAU,GAAiC;EACxD,IAAI,IAAQ,GAAiB,IAAI;AAajC,SAXA,AAEE,OADA,QAAQ,KAAK,uDAAuD,EAC5D,EAAY,GAAK,GAG3B,EAAS,EAAM,EAEf,QAAqB;AACnB,KAAO,OAAO,EAAM;IACpB,EAEK;;CAoBT,OAAc,IAAI,GAAwC,GAAsB;AAG9E,SAAO,IAAI,EAFG,KAAK,UAAU,EAAO,EAEE,EAAE,GAAG,GAAM,CAAC;;CAqBpD,OAAc,UAAU,GAAwC,GAAsB;AAGpF,SAAO,IAAI,EAFG,KAAK,UAAU,EAAO,EAEE;GACpC,GAAG;GACH,UAAU;GACV,SAAS;GACV,CAAC"}
|
|
1
|
+
{"version":3,"file":"fileContent.js","names":["DefaultReactiveFileContentOps","FileContentData","bytes","schema","scopes","addScope","scope","globalCache","LRUCache","value","globalFetcher","Fetcher","ReactiveFileContent","currentScope","ops","_ops","previous","key","res","cb","handle","fileContentData","getRawPlatformaInstance","refsMap","actual","map","refFromMap","newRef","shallowRef","attempt","data","err","resolve","dataRef","computed","getCurrentScope","_scope","effectScope","onScopeDispose"],"sources":["../../src/composition/fileContent.ts"],"sourcesContent":["import type { BlobHandleAndSize } from \"@platforma-sdk/model\";\nimport { getRawPlatformaInstance } from \"@platforma-sdk/model\";\nimport { LRUCache } from \"lru-cache\";\nimport type { ComputedRef, ShallowRef, EffectScope } from \"vue\";\nimport { computed, shallowRef, getCurrentScope, onScopeDispose, effectScope } from \"vue\";\nimport type { ZodSchema, SafeParseReturnType } from \"zod\";\nimport { Fetcher } from \"@milaboratories/helpers\";\n\ntype FileHandle = BlobHandleAndSize[\"handle\"];\n\nexport type ReactiveFileContentOps = {\n /** Maximum size in bytes of file content to cache */\n cacheSize: number;\n lruCache?: LRUCache<FileHandle, FileContentData>;\n fetcher?: Fetcher<FileHandle, FileContentData>;\n};\n\nconst DefaultReactiveFileContentOps: ReactiveFileContentOps = {\n cacheSize: 15_000_000, // 15 Mb\n};\n\nclass FileContentData {\n private _str: string | undefined = undefined;\n private _rawJson: unknown | undefined = undefined;\n private _zodSchema: ZodSchema | undefined = undefined;\n private _validatedJson: SafeParseReturnType<unknown, unknown> | undefined = undefined;\n\n constructor(public readonly bytes: Uint8Array) {}\n\n public get str(): string {\n if (this._str === undefined) this._str = new TextDecoder().decode(this.bytes);\n return this._str;\n }\n\n public get rawJson(): unknown {\n if (this._rawJson === undefined) this._rawJson = JSON.parse(this.str);\n return this._rawJson;\n }\n\n public validatedJson<T>(schema: ZodSchema<T>): T | undefined {\n if (this._zodSchema !== schema) {\n this._validatedJson = schema.safeParse(this.rawJson);\n this._zodSchema = schema;\n }\n return this._validatedJson?.success ? (this._validatedJson.data as T) : undefined;\n }\n}\n\nconst scopes = new WeakMap<EffectScope, Map<FileHandle, ShallowRef<FileContentData | undefined>>>();\n\nfunction addScope(scope: EffectScope) {\n scopes.set(scope, new Map<FileHandle, ShallowRef<FileContentData | undefined>>());\n}\n\nconst globalCache = new LRUCache<FileHandle, FileContentData>({\n maxSize: DefaultReactiveFileContentOps.cacheSize,\n sizeCalculation: (value) => value.bytes.length,\n});\n\nconst globalFetcher = new Fetcher<FileHandle, FileContentData>();\n\nexport class ReactiveFileContent {\n private readonly fileDataCache: LRUCache<FileHandle, FileContentData>;\n private readonly fetcher: Fetcher<FileHandle, FileContentData>;\n private ns = new Map<string, Set<FileHandle>>();\n private currentKey: string | undefined;\n\n private constructor(\n private currentScope: EffectScope,\n _ops?: Partial<ReactiveFileContentOps>,\n ) {\n const ops: ReactiveFileContentOps = { ...DefaultReactiveFileContentOps, ..._ops };\n this.fileDataCache =\n ops.lruCache ??\n new LRUCache<FileHandle, FileContentData>({\n maxSize: ops.cacheSize,\n sizeCalculation: (value) => value.bytes.length,\n });\n this.fetcher = ops.fetcher ?? new Fetcher<FileHandle, FileContentData>();\n }\n\n /**\n * Experimental method to invalidate the refs map cache for a given key.\n */\n public withInvalidate<T>(key: string, cb: () => T) {\n const previous = this.ns.get(key);\n this.ns.set(key, new Set());\n this.currentKey = key;\n try {\n const res = cb();\n this.invalidate(key, previous);\n return res;\n } finally {\n this.currentKey = undefined;\n }\n }\n\n public stopScope() {\n scopes.delete(this.currentScope);\n this.currentScope.stop();\n }\n\n private async doFetch(handle: FileHandle) {\n if (!this.fileDataCache.has(handle)) {\n const fileContentData = await this.fetcher.fetch(\n handle,\n async () =>\n new FileContentData(await getRawPlatformaInstance().blobDriver.getContent(handle)),\n );\n this.fileDataCache.set(handle, fileContentData);\n }\n\n return this.fileDataCache.get(handle)!;\n }\n\n private getSize() {\n const refsMap = this.getRefsMap();\n return refsMap ? refsMap.size : 0;\n }\n\n private getRefsMap() {\n return scopes.get(this.currentScope);\n }\n\n private invalidate(key: string, previous: Set<FileHandle> | undefined) {\n if (!previous) {\n return;\n }\n\n const actual = this.ns.get(key)!;\n\n for (const handle of actual) {\n previous.delete(handle);\n }\n\n const map = this.getRefsMap();\n\n for (const handle of previous) {\n map?.delete(handle);\n }\n }\n\n private withHandle(handle: FileHandle) {\n if (this.currentKey) {\n this.ns.get(this.currentKey)?.add(handle);\n }\n }\n\n private getDataRef(handle: FileHandle): ShallowRef<FileContentData | undefined> {\n const refsMap = this.getRefsMap();\n\n if (!refsMap) {\n throw new Error(\"ReactiveFileContent must be used within a Vue component or effect scope.\");\n }\n\n this.withHandle(handle);\n\n const refFromMap = refsMap.get(handle);\n\n if (refFromMap !== undefined) {\n return refFromMap;\n }\n\n const newRef = shallowRef<FileContentData>();\n refsMap.set(handle, newRef);\n\n // Initiating actual fetch from the cache, that will in turn initiate upload\n (async () => {\n const maxRetries = 8;\n const retryDelay = 1000; // 1 second\n\n for (let attempt = 0; attempt < maxRetries; attempt++) {\n try {\n const data = await this.doFetch(handle);\n newRef.value = data;\n return;\n } catch (err: unknown) {\n console.error(`File download attempt ${attempt + 1}/${maxRetries} failed:`, err);\n\n if (attempt < maxRetries - 1) {\n await new Promise((resolve) => setTimeout(resolve, retryDelay));\n } else {\n console.error(`Failed to download file after ${maxRetries} attempts`);\n }\n }\n }\n })();\n\n return newRef;\n }\n\n public getContentBytes(handle: FileHandle): ComputedRef<Uint8Array | undefined>;\n public getContentBytes(\n handle: FileHandle | undefined,\n ): ComputedRef<Uint8Array | undefined> | undefined;\n public getContentBytes(\n handle: FileHandle | undefined,\n ): ComputedRef<Uint8Array | undefined> | undefined {\n if (handle === undefined) return undefined;\n const dataRef = this.getDataRef(handle);\n return computed(() => dataRef.value?.bytes);\n }\n\n public getContentString(handle: FileHandle): ComputedRef<string | undefined>;\n public getContentString(\n handle: FileHandle | undefined,\n ): ComputedRef<string | undefined> | undefined;\n public getContentString(\n handle: FileHandle | undefined,\n ): ComputedRef<string | undefined> | undefined {\n if (handle === undefined) return undefined;\n const dataRef = this.getDataRef(handle);\n return computed(() => dataRef.value?.str);\n }\n\n public getContentJson<T>(handle: FileHandle, schema: ZodSchema<T>): ComputedRef<T | undefined>;\n public getContentJson<T>(\n handle: FileHandle | undefined,\n schema: ZodSchema<T>,\n ): ComputedRef<T | undefined> | undefined;\n public getContentJson<T = unknown>(handle: FileHandle): ComputedRef<T | undefined>;\n public getContentJson<T = unknown>(\n handle: FileHandle | undefined,\n ): ComputedRef<T | undefined> | undefined;\n public getContentJson<T>(\n handle: FileHandle | undefined,\n schema?: ZodSchema<T>,\n ): ComputedRef<T | undefined> | undefined;\n public getContentJson<T>(\n handle: FileHandle | undefined,\n schema?: ZodSchema<T>,\n ): ComputedRef<T | undefined> | undefined {\n if (handle === undefined) return undefined;\n const dataRef = this.getDataRef(handle);\n return computed(\n () =>\n (schema === undefined ? dataRef.value?.rawJson : dataRef.value?.validatedJson(schema)) as T,\n );\n }\n\n private static initScope(_scope: EffectScope | undefined) {\n let scope = getCurrentScope() ?? _scope;\n\n if (!scope) {\n console.warn(\"Current scope not found, using new detached scope...\");\n scope = effectScope(true);\n }\n\n addScope(scope);\n\n onScopeDispose(() => {\n scopes.delete(scope);\n });\n\n return scope;\n }\n\n /**\n * Creates a ReactiveFileContent instance with isolated cache and fetcher.\n * Use this when you need component-specific caching.\n *\n * @example\n * ```ts\n * import { ReactiveFileContent } from '@platforma-sdk/ui-vue';\n * import { computed } from 'vue';\n *\n * const fileContent = ReactiveFileContent.use();\n *\n * const processedData = computed(() => {\n * const content = fileContent.getContentString(fileHandle).value;\n * return content?.split('\\n').length ?? 0;\n * });\n * ```\n */\n public static use(_ops?: Partial<ReactiveFileContentOps>, _scope?: EffectScope) {\n const scope = this.initScope(_scope);\n\n return new ReactiveFileContent(scope, { ..._ops });\n }\n\n /**\n * Creates a ReactiveFileContent instance with globally shared cache and fetcher.\n * Use this to share file content cache across multiple components.\n *\n * @example\n * ```ts\n * import { ReactiveFileContent } from '@platforma-sdk/ui-vue';\n * import { computed } from 'vue';\n *\n * const fileContent = ReactiveFileContent.useGlobal();\n *\n * const combinedData = computed(() => {\n * const data1 = fileContent.getContentJson(handle1).value;\n * const data2 = fileContent.getContentJson(handle2).value;\n * return { data1, data2 };\n * });\n * ```\n */\n public static useGlobal(_ops?: Partial<ReactiveFileContentOps>, _scope?: EffectScope) {\n const scope = this.initScope(_scope);\n\n return new ReactiveFileContent(scope, {\n ..._ops,\n lruCache: globalCache,\n fetcher: globalFetcher,\n });\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAMA,IAAwD,EAC5D,WAAW,KACb,GAEMC,IAAN,MAAsB;CAMQ;CAL5B,OAAmC,KAAA;CACnC,WAAwC,KAAA;CACxC,aAA4C,KAAA;CAC5C,iBAA4E,KAAA;CAE5E,YAAY,GAAmC;EAAnB,KAAA,QAAAC;CAAoB;CAEhD,IAAW,MAAc;EAEv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,SAASG;EACX,CAAC;CACH;AACF"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { pluginDataKey as e } from "../defineApp.js";
|
|
2
2
|
import { inject as t } from "vue";
|
|
3
|
-
|
|
3
|
+
// src/composition/usePlugin.ts
|
|
4
4
|
function n(n) {
|
|
5
5
|
let r = t(e);
|
|
6
6
|
if (!r) throw Error("usePlugin requires a V3 block (BlockModelV3). Make sure the block uses apiVersion 3 and the plugin is installed.");
|
|
7
7
|
return r.getOrCreatePluginState(n);
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { n as usePlugin };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=usePlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlugin.js","names":[],"sources":["../../src/composition/usePlugin.ts"],"sourcesContent":["import { inject, type Reactive } from \"vue\";\nimport { pluginDataKey } from \"../defineApp\";\nimport type {\n PluginHandle,\n InferFactoryData,\n InferFactoryOutputs,\n InferFactoryUiServices,\n PluginFactoryLike,\n} from \"@platforma-sdk/model\";\n\n/** Per-plugin reactive model exposed to consumers via usePlugin(). */\nexport interface PluginState<\n Data = unknown,\n Outputs = unknown,\n Services = Record<string, unknown>,\n> {\n readonly model: Reactive<{\n data: Data;\n outputs: Outputs extends Record<string, unknown>\n ? { [K in keyof Outputs]: Outputs[K] | undefined }\n : Record<string, unknown>;\n outputErrors: Outputs extends Record<string, unknown>\n ? { [K in keyof Outputs]?: Error }\n : Record<string, Error | undefined>;\n }>;\n readonly services: Services;\n}\n\n/** Internal interface for plugin access — provided via Vue injection to usePlugin(). */\nexport interface PluginAccess {\n getOrCreatePluginState<F extends PluginFactoryLike>(\n handle: PluginHandle<F>,\n ): PluginState<InferFactoryData<F>, InferFactoryOutputs<F>, InferFactoryUiServices<F>>;\n}\n\n/**\n * Composable for accessing a plugin's reactive model: data, outputs, and outputErrors.\n *\n * Mirrors the `app.model` access pattern — `plugin.model.data` is reactive and deep-watched,\n * mutations are automatically queued and sent to storage.\n *\n * @param handle - Opaque plugin handle obtained from `app.plugins`.\n * @typeParam F - The plugin factory type (inferred from the handle)\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { usePlugin, type InferPluginHandle } from '@platforma-sdk/ui-vue';\n * import type { CounterPlugin } from './plugins/counter';\n *\n * const props = defineProps<{ instance: InferPluginHandle<CounterPlugin> }>();\n * const plugin = usePlugin(props.instance);\n *\n * plugin.model.data.count += 1; // reactive, triggers storage update\n * plugin.model.outputs.displayText // computed, plugin's own outputs only\n * plugin.model.outputErrors.displayText // Error | undefined\n * </script>\n * ```\n */\nexport function usePlugin<F extends PluginFactoryLike>(handle: PluginHandle<F>) {\n const access = inject<PluginAccess>(pluginDataKey);\n\n if (!access) {\n throw new Error(\n \"usePlugin requires a V3 block (BlockModelV3). \" +\n \"Make sure the block uses apiVersion 3 and the plugin is installed.\",\n );\n }\n\n return access.getOrCreatePluginState<F>(handle);\n}\n"],"mappings":";;;AA2DA,
|
|
1
|
+
{"version":3,"file":"usePlugin.js","names":["usePlugin","access","inject","pluginDataKey","handle"],"sources":["../../src/composition/usePlugin.ts"],"sourcesContent":["import { inject, type Reactive } from \"vue\";\nimport { pluginDataKey } from \"../defineApp\";\nimport type {\n PluginHandle,\n InferFactoryData,\n InferFactoryOutputs,\n InferFactoryUiServices,\n PluginFactoryLike,\n} from \"@platforma-sdk/model\";\n\n/** Per-plugin reactive model exposed to consumers via usePlugin(). */\nexport interface PluginState<\n Data = unknown,\n Outputs = unknown,\n Services = Record<string, unknown>,\n> {\n readonly model: Reactive<{\n data: Data;\n outputs: Outputs extends Record<string, unknown>\n ? { [K in keyof Outputs]: Outputs[K] | undefined }\n : Record<string, unknown>;\n outputErrors: Outputs extends Record<string, unknown>\n ? { [K in keyof Outputs]?: Error }\n : Record<string, Error | undefined>;\n }>;\n readonly services: Services;\n}\n\n/** Internal interface for plugin access — provided via Vue injection to usePlugin(). */\nexport interface PluginAccess {\n getOrCreatePluginState<F extends PluginFactoryLike>(\n handle: PluginHandle<F>,\n ): PluginState<InferFactoryData<F>, InferFactoryOutputs<F>, InferFactoryUiServices<F>>;\n}\n\n/**\n * Composable for accessing a plugin's reactive model: data, outputs, and outputErrors.\n *\n * Mirrors the `app.model` access pattern — `plugin.model.data` is reactive and deep-watched,\n * mutations are automatically queued and sent to storage.\n *\n * @param handle - Opaque plugin handle obtained from `app.plugins`.\n * @typeParam F - The plugin factory type (inferred from the handle)\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { usePlugin, type InferPluginHandle } from '@platforma-sdk/ui-vue';\n * import type { CounterPlugin } from './plugins/counter';\n *\n * const props = defineProps<{ instance: InferPluginHandle<CounterPlugin> }>();\n * const plugin = usePlugin(props.instance);\n *\n * plugin.model.data.count += 1; // reactive, triggers storage update\n * plugin.model.outputs.displayText // computed, plugin's own outputs only\n * plugin.model.outputErrors.displayText // Error | undefined\n * </script>\n * ```\n */\nexport function usePlugin<F extends PluginFactoryLike>(handle: PluginHandle<F>) {\n const access = inject<PluginAccess>(pluginDataKey);\n\n if (!access) {\n throw new Error(\n \"usePlugin requires a V3 block (BlockModelV3). \" +\n \"Make sure the block uses apiVersion 3 and the plugin is installed.\",\n );\n }\n\n return access.getOrCreatePluginState<F>(handle);\n}\n"],"mappings":";;;AA2DA,SAAgBA,EAAuC,GAAyB;CAC9E,IAAMC,IAASC,EAAqBC,CAAa;CAEjD,IAAI,CAACF,GACH,MAAU,MACR,kHAEF;CAGF,OAAOA,EAAO,uBAA0BG,CAAM;AAChD"}
|
package/dist/computedResult.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { wrapOptionalResult as e } from "./utils.js";
|
|
2
2
|
import { computed as t } from "vue";
|
|
3
3
|
import { ensureErrorLike as n } from "@platforma-sdk/model";
|
|
4
|
-
|
|
4
|
+
// src/computedResult.ts
|
|
5
5
|
function r(r) {
|
|
6
6
|
return t(() => {
|
|
7
7
|
try {
|
|
@@ -14,7 +14,6 @@ function r(r) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
17
|
export { r as computedResult };
|
|
19
18
|
|
|
20
19
|
//# sourceMappingURL=computedResult.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computedResult.js","names":[],"sources":["../src/computedResult.ts"],"sourcesContent":["import type { ComputedRef } from \"vue\";\nimport { computed, type ComputedGetter } from \"vue\";\nimport type { OptionalResult } from \"./types\";\nimport { wrapOptionalResult } from \"./utils\";\nimport { ensureErrorLike } from \"@platforma-sdk/model\";\n\n/**\n * Creates a computed reference that wraps the result of a getter function in an `OptionalResult` object.\n * This wrapper provides error handling, ensuring that if an error occurs during the computation of the result,\n * the error is captured and included in the `OptionalResult` instead of throwing the error.\n *\n * @template V - The type of the value returned by the getter function.\n *\n * @param {ComputedGetter<V>} getter - A function that returns a value of type `V`. This function is executed inside\n * the computed reference and its result is wrapped in an `OptionalResult`.\n *\n * @returns {ComputedRef<OptionalResult<V>>} - A computed reference containing the result of the getter function\n * wrapped in an `OptionalResult`. If the getter function executes successfully, the `value` property of the `OptionalResult`\n * will contain the result. If an error occurs, the `errors` property will contain the error message, and `value` will be `undefined`.\n *\n * @example\n * const myGetter = () => {\n * if (someCondition) {\n * throw new Error('An error occurred');\n * }\n * return 'Success';\n * };\n *\n * const myComputedResult = computedResult(myGetter);\n *\n * // If someCondition is true:\n * // myComputedResult.value will be { errors: ['An error occurred'], value: undefined }\n *\n * // If someCondition is false:\n * // myComputedResult.value will be { errors: undefined, value: 'Success' }\n */\nexport function computedResult<V>(getter: ComputedGetter<V>): ComputedRef<OptionalResult<V>> {\n return computed(() => {\n try {\n return wrapOptionalResult(getter());\n } catch (err) {\n return {\n errors: [ensureErrorLike(err)],\n value: undefined,\n };\n }\n });\n}\n"],"mappings":";;;;AAoCA,
|
|
1
|
+
{"version":3,"file":"computedResult.js","names":["computedResult","computed","wrapOptionalResult","getter","err","ensureErrorLike"],"sources":["../src/computedResult.ts"],"sourcesContent":["import type { ComputedRef } from \"vue\";\nimport { computed, type ComputedGetter } from \"vue\";\nimport type { OptionalResult } from \"./types\";\nimport { wrapOptionalResult } from \"./utils\";\nimport { ensureErrorLike } from \"@platforma-sdk/model\";\n\n/**\n * Creates a computed reference that wraps the result of a getter function in an `OptionalResult` object.\n * This wrapper provides error handling, ensuring that if an error occurs during the computation of the result,\n * the error is captured and included in the `OptionalResult` instead of throwing the error.\n *\n * @template V - The type of the value returned by the getter function.\n *\n * @param {ComputedGetter<V>} getter - A function that returns a value of type `V`. This function is executed inside\n * the computed reference and its result is wrapped in an `OptionalResult`.\n *\n * @returns {ComputedRef<OptionalResult<V>>} - A computed reference containing the result of the getter function\n * wrapped in an `OptionalResult`. If the getter function executes successfully, the `value` property of the `OptionalResult`\n * will contain the result. If an error occurs, the `errors` property will contain the error message, and `value` will be `undefined`.\n *\n * @example\n * const myGetter = () => {\n * if (someCondition) {\n * throw new Error('An error occurred');\n * }\n * return 'Success';\n * };\n *\n * const myComputedResult = computedResult(myGetter);\n *\n * // If someCondition is true:\n * // myComputedResult.value will be { errors: ['An error occurred'], value: undefined }\n *\n * // If someCondition is false:\n * // myComputedResult.value will be { errors: undefined, value: 'Success' }\n */\nexport function computedResult<V>(getter: ComputedGetter<V>): ComputedRef<OptionalResult<V>> {\n return computed(() => {\n try {\n return wrapOptionalResult(getter());\n } catch (err) {\n return {\n errors: [ensureErrorLike(err)],\n value: undefined,\n };\n }\n });\n}\n"],"mappings":";;;;AAoCA,SAAgBA,EAAkB,GAA2D;CAC3F,OAAOC,QAAe;EACpB,IAAI;GACF,OAAOC,EAAmBC,EAAO,CAAC;EACpC,SAASC,GAAK;GACZ,OAAO;IACL,QAAQ,CAACC,EAAgBD,CAAG,CAAC;IAC7B,OAAO,KAAA;GACT;EACF;CACF,CAAC;AACH"}
|
package/dist/createModel.js
CHANGED
|
@@ -2,7 +2,7 @@ import { deepClone as e, isJsonEqual as t } from "./lib/util/helpers/dist/object
|
|
|
2
2
|
import "./lib/util/helpers/dist/index.js";
|
|
3
3
|
import { ensureError as n, formatZodError as r, identity as i, isZodError as a } from "./utils.js";
|
|
4
4
|
import { computed as o, reactive as s, ref as c, unref as l, watch as u } from "vue";
|
|
5
|
-
|
|
5
|
+
// src/createModel.ts
|
|
6
6
|
function d(d) {
|
|
7
7
|
let f = d.validate ?? i, { autoSave: p } = d, m = c(), h = c(), g = (t) => {
|
|
8
8
|
h.value = { model: e(t) };
|
|
@@ -28,20 +28,21 @@ function d(d) {
|
|
|
28
28
|
g(e), b(e);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
|
|
31
|
+
u(h, (e, t) => {
|
|
32
32
|
e && e === t && b(e.model);
|
|
33
|
-
}, { deep: !0 })
|
|
33
|
+
}, { deep: !0 });
|
|
34
|
+
let S = o(() => !m.value), C = o(() => !t(d.get(), l(h))), w = o(() => m.value ? m.value.message : "");
|
|
35
|
+
return s({
|
|
34
36
|
model: x,
|
|
35
|
-
valid:
|
|
36
|
-
isChanged:
|
|
37
|
+
valid: S,
|
|
38
|
+
isChanged: C,
|
|
37
39
|
error: m,
|
|
38
|
-
errorString:
|
|
40
|
+
errorString: w,
|
|
39
41
|
save: _,
|
|
40
42
|
revert: v,
|
|
41
43
|
setError: y
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
|
-
//#endregion
|
|
45
46
|
export { d as createModel };
|
|
46
47
|
|
|
47
48
|
//# sourceMappingURL=createModel.js.map
|