@lavalogic/scoria 0.11.15 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Components/Action.svelte +7 -32
- package/dist/Components/Action.svelte.d.ts +1 -27
- package/dist/Components/ActionProps.d.ts +27 -0
- package/dist/Components/ActionProps.js +1 -0
- package/dist/Components/AlertModal.svelte +7 -5
- package/dist/Components/Base/ContextWrapper.svelte +4 -9
- package/dist/Components/Base/ContextWrapper.svelte.d.ts +1 -5
- package/dist/Components/Base/ContextWrapperProps.d.ts +5 -0
- package/dist/Components/Base/ContextWrapperProps.js +1 -0
- package/dist/Components/Base/Pagination.svelte +22 -31
- package/dist/Components/Base/Pagination.svelte.d.ts +1 -12
- package/dist/Components/Base/PaginationProps.d.ts +12 -0
- package/dist/Components/Base/PaginationProps.js +1 -0
- package/dist/Components/BigRadioSet.svelte +4 -11
- package/dist/Components/BigRadioSet.svelte.d.ts +1 -6
- package/dist/Components/BigRadioSetProps.d.ts +6 -0
- package/dist/Components/BigRadioSetProps.js +1 -0
- package/dist/Components/Bubble.svelte +4 -21
- package/dist/Components/Bubble.svelte.d.ts +1 -18
- package/dist/Components/BubbleColour.d.ts +5 -0
- package/dist/Components/BubbleColour.js +1 -0
- package/dist/Components/BubbleProps.d.ts +14 -0
- package/dist/Components/BubbleProps.js +1 -0
- package/dist/Components/Button.svelte +21 -48
- package/dist/Components/Button.svelte.d.ts +1 -29
- package/dist/Components/ButtonProps.d.ts +29 -0
- package/dist/Components/ButtonProps.js +1 -0
- package/dist/Components/Checkbox.svelte +4 -21
- package/dist/Components/Checkbox.svelte.d.ts +2 -2
- package/dist/Components/CollapsibleCard.svelte +3 -15
- package/dist/Components/CollapsibleCard.svelte.d.ts +2 -10
- package/dist/Components/CollapsibleCardProps.d.ts +9 -0
- package/dist/Components/CollapsibleCardProps.js +1 -0
- package/dist/Components/Contexts/ContextMenu.svelte +14 -11
- package/dist/Components/Contexts/ContextMenuOption.svelte +2 -11
- package/dist/Components/Contexts/ContextMenuOption.svelte.d.ts +1 -7
- package/dist/Components/Contexts/ContextMenuOptionProps.d.ts +7 -0
- package/dist/Components/Contexts/ContextMenuOptionProps.js +1 -0
- package/dist/Components/Contexts/Toast.svelte +1 -6
- package/dist/Components/Contexts/Toast.svelte.d.ts +1 -5
- package/dist/Components/Contexts/ToastContainer.svelte +4 -1
- package/dist/Components/Contexts/ToastProps.d.ts +5 -0
- package/dist/Components/Contexts/ToastProps.js +1 -0
- package/dist/Components/Contexts/Tooltip.svelte +1 -4
- package/dist/Components/DataMatrixIcon.svelte +3 -11
- package/dist/Components/DataMatrixIcon.svelte.d.ts +1 -6
- package/dist/Components/DataMatrixIconProps.d.ts +6 -0
- package/dist/Components/DataMatrixIconProps.js +1 -0
- package/dist/Components/DateInput.svelte +3 -42
- package/dist/Components/DateInput.svelte.d.ts +1 -40
- package/dist/Components/DateInputProps.d.ts +3 -0
- package/dist/Components/DateInputProps.js +1 -0
- package/dist/Components/DateOnlyInputProps.d.ts +21 -0
- package/dist/Components/DateOnlyInputProps.js +1 -0
- package/dist/Components/DatePicker.svelte +26 -36
- package/dist/Components/DatePicker.svelte.d.ts +1 -8
- package/dist/Components/DatePickerProps.d.ts +8 -0
- package/dist/Components/DatePickerProps.js +1 -0
- package/dist/Components/DateTimeInputProps.d.ts +21 -0
- package/dist/Components/DateTimeInputProps.js +1 -0
- package/dist/Components/DesktopModal.svelte +3 -25
- package/dist/Components/DesktopModal.svelte.d.ts +1 -20
- package/dist/Components/DesktopModalProps.d.ts +20 -0
- package/dist/Components/DesktopModalProps.js +1 -0
- package/dist/Components/Dial.svelte +2 -18
- package/dist/Components/Dial.svelte.d.ts +1 -13
- package/dist/Components/DialProps.d.ts +13 -0
- package/dist/Components/DialProps.js +1 -0
- package/dist/Components/DimensionInput.svelte +21 -48
- package/dist/Components/DimensionInput.svelte.d.ts +1 -29
- package/dist/Components/DimensionInputProps.d.ts +29 -0
- package/dist/Components/DimensionInputProps.js +1 -0
- package/dist/Components/DragMenu/DragMenuHolder.svelte +10 -57
- package/dist/Components/DragMenu/DragMenuHolder.svelte.d.ts +1 -17
- package/dist/Components/DragMenu/DragMenuHolderProps.d.ts +10 -0
- package/dist/Components/DragMenu/DragMenuHolderProps.js +1 -0
- package/dist/Components/DragMenu/Draggable.d.ts +8 -0
- package/dist/Components/DragMenu/Draggable.js +1 -0
- package/dist/Components/DragMenu/DraggableCard.svelte +6 -14
- package/dist/Components/DragMenu/DraggableCard.svelte.d.ts +1 -9
- package/dist/Components/DragMenu/DraggableCardProps.d.ts +9 -0
- package/dist/Components/DragMenu/DraggableCardProps.js +1 -0
- package/dist/Components/FileCard.svelte +1 -7
- package/dist/Components/FileCard.svelte.d.ts +1 -4
- package/dist/Components/FileCardProps.d.ts +4 -0
- package/dist/Components/FileCardProps.js +1 -0
- package/dist/Components/FileUpload.svelte +9 -31
- package/dist/Components/FileUpload.svelte.d.ts +1 -24
- package/dist/Components/FileUploadProps.d.ts +24 -0
- package/dist/Components/FileUploadProps.js +1 -0
- package/dist/Components/GridInput.svelte +30 -28
- package/dist/Components/GridInput.svelte.d.ts +1 -6
- package/dist/Components/GridInputProps.d.ts +7 -0
- package/dist/Components/GridInputProps.js +1 -0
- package/dist/Components/GridInputSet.svelte +2 -11
- package/dist/Components/GridInputSet.svelte.d.ts +1 -6
- package/dist/Components/GridInputSetProps.d.ts +7 -0
- package/dist/Components/GridInputSetProps.js +1 -0
- package/dist/Components/HorizontalTabGroup.svelte +3 -16
- package/dist/Components/HorizontalTabGroup.svelte.d.ts +2 -11
- package/dist/Components/HorizontalTabGroupButton.svelte +11 -15
- package/dist/Components/HorizontalTabGroupButton.svelte.d.ts +2 -6
- package/dist/Components/HorizontalTabGroupProps.d.ts +10 -0
- package/dist/Components/HorizontalTabGroupProps.js +1 -0
- package/dist/Components/Icon.svelte +5 -1257
- package/dist/Components/Icon.svelte.d.ts +1 -884
- package/dist/Components/IconProps.d.ts +24 -0
- package/dist/Components/IconProps.js +1 -0
- package/dist/Components/Icons.d.ts +858 -0
- package/dist/Components/Icons.js +1222 -0
- package/dist/Components/InputProps.d.ts +15 -0
- package/dist/Components/InputProps.js +1 -0
- package/dist/Components/LoadingModal.svelte +2 -2
- package/dist/Components/Modal.svelte +24 -25
- package/dist/Components/Modal.svelte.d.ts +3 -6
- package/dist/Components/MultiSelect.svelte +35 -73
- package/dist/Components/MultiSelect.svelte.d.ts +14 -37
- package/dist/Components/MultiSelectCommonProps.d.ts +16 -0
- package/dist/Components/MultiSelectCommonProps.js +1 -0
- package/dist/Components/MultiSelectProps.d.ts +4 -0
- package/dist/Components/MultiSelectProps.js +1 -0
- package/dist/Components/MultiSelectPropsAsObject.d.ts +6 -0
- package/dist/Components/MultiSelectPropsAsObject.js +1 -0
- package/dist/Components/MultiSelectPropsAsPrimitive.d.ts +6 -0
- package/dist/Components/MultiSelectPropsAsPrimitive.js +1 -0
- package/dist/Components/NumberInput.svelte +8 -37
- package/dist/Components/NumberInput.svelte.d.ts +1 -29
- package/dist/Components/NumberInputProps.d.ts +29 -0
- package/dist/Components/NumberInputProps.js +1 -0
- package/dist/Components/PartialIconProps.d.ts +4 -0
- package/dist/Components/PartialIconProps.js +1 -0
- package/dist/Components/PasswordInput.svelte +4 -22
- package/dist/Components/PasswordInput.svelte.d.ts +1 -15
- package/dist/Components/Portal.svelte +3 -9
- package/dist/Components/Portal.svelte.d.ts +1 -5
- package/dist/Components/PortalProps.d.ts +5 -0
- package/dist/Components/PortalProps.js +1 -0
- package/dist/Components/ProgressBubble.svelte +20 -22
- package/dist/Components/ProgressBubble.svelte.d.ts +2 -6
- package/dist/Components/ProgressBubbleProps.d.ts +5 -0
- package/dist/Components/ProgressBubbleProps.js +1 -0
- package/dist/Components/QuerySelect.svelte +70 -49
- package/dist/Components/QuerySelect.svelte.d.ts +3 -3
- package/dist/Components/SingleSelect.svelte +28 -71
- package/dist/Components/SingleSelect.svelte.d.ts +2 -37
- package/dist/Components/SingleSelectCommonProps.d.ts +27 -0
- package/dist/Components/SingleSelectCommonProps.js +1 -0
- package/dist/Components/SingleSelectProps.d.ts +4 -0
- package/dist/Components/SingleSelectProps.js +1 -0
- package/dist/Components/SingleSelectPropsAsObject.d.ts +6 -0
- package/dist/Components/SingleSelectPropsAsObject.js +1 -0
- package/dist/Components/SingleSelectPropsAsPrimitive.d.ts +6 -0
- package/dist/Components/SingleSelectPropsAsPrimitive.js +1 -0
- package/dist/Components/Switch.svelte +2 -13
- package/dist/Components/Switch.svelte.d.ts +1 -9
- package/dist/Components/SwitchProps.d.ts +9 -0
- package/dist/Components/SwitchProps.js +1 -0
- package/dist/Components/TabGroupButtonProps.d.ts +5 -0
- package/dist/Components/TabGroupButtonProps.js +1 -0
- package/dist/Components/Table/Body/HeightData.d.ts +6 -0
- package/dist/Components/Table/Body/HeightData.js +1 -0
- package/dist/Components/Table/Body/QuickSearchCell.svelte +59 -82
- package/dist/Components/Table/Body/QuickSearchCell.svelte.d.ts +1 -6
- package/dist/Components/Table/Body/QuickSearchCellProps.d.ts +6 -0
- package/dist/Components/Table/Body/QuickSearchCellProps.js +1 -0
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +4 -9
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte.d.ts +1 -5
- package/dist/Components/Table/Body/Rows/ColumnHighlightProps.d.ts +5 -0
- package/dist/Components/Table/Body/Rows/ColumnHighlightProps.js +1 -0
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +5 -10
- package/dist/Components/Table/Body/Rows/ColumnList.svelte.d.ts +1 -3
- package/dist/Components/Table/Body/Rows/ColumnListProps.d.ts +3 -0
- package/dist/Components/Table/Body/Rows/ColumnListProps.js +1 -0
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +15 -25
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte.d.ts +1 -4
- package/dist/Components/Table/Body/Rows/ColumnListRowProps.d.ts +4 -0
- package/dist/Components/Table/Body/Rows/ColumnListRowProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +7 -11
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte.d.ts +1 -4
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponentProps.d.ts +4 -0
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponentProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +39 -48
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte.d.ts +1 -4
- package/dist/Components/Table/Body/Rows/Columns/ActionsCellProps.d.ts +4 -0
- package/dist/Components/Table/Body/Rows/Columns/ActionsCellProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/ActionsColumn.d.ts +5 -0
- package/dist/Components/Table/Body/Rows/Columns/ActionsColumn.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/ActionsTableCell.d.ts +5 -0
- package/dist/Components/Table/Body/Rows/Columns/ActionsTableCell.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +26 -25
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte.d.ts +1 -4
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +11 -18
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte.d.ts +13 -19
- package/dist/Components/Table/Body/Rows/Columns/ExpandCellProps.d.ts +7 -0
- package/dist/Components/Table/Body/Rows/Columns/ExpandCellProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +10 -16
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte.d.ts +1 -6
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCellProps.d.ts +6 -0
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCellProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +22 -15
- package/dist/Components/Table/Body/Rows/Columns/SelectColumn.d.ts +5 -0
- package/dist/Components/Table/Body/Rows/Columns/SelectColumn.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/SelectTableCell.d.ts +5 -0
- package/dist/Components/Table/Body/Rows/Columns/SelectTableCell.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +7 -20
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte.d.ts +1 -9
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +17 -20
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +38 -22
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte.d.ts +2 -2
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +41 -34
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte.d.ts +1 -4
- package/dist/Components/Table/Body/Rows/Columns/TableDatePickerProps.d.ts +4 -0
- package/dist/Components/Table/Body/Rows/Columns/TableDatePickerProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +67 -46
- package/dist/Components/Table/Body/Rows/Columns/TableQueryCell.d.ts +5 -0
- package/dist/Components/Table/Body/Rows/Columns/TableQueryCell.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/TableQueryColumn.d.ts +5 -0
- package/dist/Components/Table/Body/Rows/Columns/TableQueryColumn.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +93 -105
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte.d.ts +1 -12
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelectProps.d.ts +4 -0
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelectProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +4 -2
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +78 -65
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte.d.ts +1 -12
- package/dist/Components/Table/Body/Rows/Columns/TableSelectProps.d.ts +4 -0
- package/dist/Components/Table/Body/Rows/Columns/TableSelectProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +82 -59
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte.d.ts +1 -4
- package/dist/Components/Table/Body/Rows/Columns/TableTextInputProps.d.ts +4 -0
- package/dist/Components/Table/Body/Rows/Columns/TableTextInputProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +10 -15
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte.d.ts +1 -4
- package/dist/Components/Table/Body/Rows/Columns/ValidityCellProps.d.ts +4 -0
- package/dist/Components/Table/Body/Rows/Columns/ValidityCellProps.js +1 -0
- package/dist/Components/Table/Body/Rows/TableRow.svelte +38 -31
- package/dist/Components/Table/Body/Rows/TableRow.svelte.d.ts +1 -8
- package/dist/Components/Table/Body/Rows/TableRowProps.d.ts +8 -0
- package/dist/Components/Table/Body/Rows/TableRowProps.js +1 -0
- package/dist/Components/Table/Body/TableBody.svelte +10 -21
- package/dist/Components/Table/Body/TableBody.svelte.d.ts +1 -12
- package/dist/Components/Table/Body/TableBodyProps.d.ts +8 -0
- package/dist/Components/Table/Body/TableBodyProps.js +1 -0
- package/dist/Components/Table/ColumnDefinitions/ExampleItemColumnDefRepository.svelte.d.ts +2 -4
- package/dist/Components/Table/ColumnDefinitions/ExampleItemColumnDefRepository.svelte.js +159 -161
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +8 -5
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +1 -1
- package/dist/Components/Table/Headers/TableHead.svelte +29 -18
- package/dist/Components/Table/Misc/ColumnPanel.svelte +4 -4
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +5 -10
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte.d.ts +1 -3
- package/dist/Components/Table/Misc/ColumnPanelModalProps.d.ts +3 -0
- package/dist/Components/Table/Misc/ColumnPanelModalProps.js +1 -0
- package/dist/Components/Table/Misc/FilterInput.svelte +75 -145
- package/dist/Components/Table/Misc/FilterInput.svelte.d.ts +1 -16
- package/dist/Components/Table/Misc/FilterInputProps.d.ts +6 -0
- package/dist/Components/Table/Misc/FilterInputProps.js +1 -0
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +2 -5
- package/dist/Components/Table/Misc/TableFooter.svelte +22 -21
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +7 -5
- package/dist/Components/Table/Misc/TableSidebar.svelte +2 -2
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +2 -7
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte.d.ts +1 -3
- package/dist/Components/Table/Misc/ToolboxPanelModalProps.d.ts +3 -0
- package/dist/Components/Table/Misc/ToolboxPanelModalProps.js +1 -0
- package/dist/Components/Table/Misc/numberDateFilterTypes.d.ts +5 -0
- package/dist/Components/Table/Misc/numberDateFilterTypes.js +13 -0
- package/dist/Components/Table/Misc/stringFilterTypes.d.ts +5 -0
- package/dist/Components/Table/Misc/stringFilterTypes.js +15 -0
- package/dist/Components/Table/NestedTable.svelte +5 -3
- package/dist/Components/Table/NestedTable.svelte.d.ts +1 -1
- package/dist/Components/Table/Table.svelte +72 -40
- package/dist/Components/Table/Table.svelte.d.ts +1 -1
- package/dist/Components/Table/Types/Columns/Column.d.ts +1 -1
- package/dist/Components/Table/Types/Columns/DateColumn.d.ts +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/CheckboxDef.svelte.d.ts +1 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/CheckboxDef.svelte.js +2 -0
- package/dist/Components/Table/Types/Columns/Definitions/Actions/ActionsDef.svelte.d.ts +2 -2
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +3 -3
- package/dist/Components/Table/Types/Columns/Definitions/Display/AbstractDisplayDef.svelte.d.ts +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/Display/AbstractDisplayDef.svelte.js +3 -2
- package/dist/Components/Table/Types/Columns/Definitions/Display/BubbleDef.svelte.d.ts +3 -3
- package/dist/Components/Table/Types/Columns/Definitions/Display/BubbleDef.svelte.js +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/Display/DisplayDef.svelte.d.ts +6 -7
- package/dist/Components/Table/Types/Columns/Definitions/Display/DisplayDef.svelte.js +4 -1
- package/dist/Components/Table/Types/Columns/Definitions/Display/ProgressBarDef.svelte.d.ts +2 -2
- package/dist/Components/Table/Types/Columns/Definitions/Display/ProgressBarDef.svelte.js +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/Display/ValidityDef.svelte.d.ts +2 -2
- package/dist/Components/Table/Types/Columns/Definitions/Display/ValidityDef.svelte.js +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.d.ts +3 -2
- package/dist/Components/Table/Types/Columns/Definitions/FilterOnly/FilterOnlyDef.svelte.d.ts +1 -3
- package/dist/Components/Table/Types/Columns/Definitions/FilterOnly/FilterOnlyDef.svelte.js +4 -3
- package/dist/Components/Table/Types/Columns/DefsWrapper.d.ts +1 -1
- package/dist/Components/Table/Types/Columns/ExpandColumn.d.ts +2 -2
- package/dist/Components/Table/Types/Columns/ExpandTableCell.d.ts +2 -2
- package/dist/Components/Table/Types/Columns/ProgressBarColumn.d.ts +1 -1
- package/dist/Components/Table/Types/Columns/ProgressBarTableCell.d.ts +2 -1
- package/dist/Components/Table/Types/Columns/VisibilityState.d.ts +1 -1
- package/dist/Components/Table/Types/Context/ITable.d.ts +8 -8
- package/dist/Components/Table/Types/Context/ReadonlyRowModel.d.ts +1 -1
- package/dist/Components/Table/Types/Context/Row.d.ts +4 -4
- package/dist/Components/Table/Types/Context/RowModel.d.ts +1 -1
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +13 -17
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +300 -354
- package/dist/Components/Table/Types/Context/TableSettings.d.ts +8 -0
- package/dist/Components/Table/Types/DataRepository/IDataRepository.d.ts +6 -6
- package/dist/Components/Table/Types/DataRepository/ILocalDataRepository.d.ts +1 -1
- package/dist/Components/Table/Types/DataRepository/LocalTableDataRepository.svelte.d.ts +2 -2
- package/dist/Components/Table/Types/DataRepository/LocalTableDataRepository.svelte.js +10 -8
- package/dist/Components/Table/Types/DataRepository/SortingState.d.ts +1 -1
- package/dist/Components/Table/Types/DataRepository/TableDataRepository.svelte.d.ts +5 -5
- package/dist/Components/Table/Types/DataRepository/TableDataRepository.svelte.js +5 -3
- package/dist/Components/Table/Types/Filtering/ColumnFiltersState.d.ts +1 -1
- package/dist/Components/Table/Types/Filtering/FilterFn.d.ts +1 -1
- package/dist/Components/Table/Types/Focus/TableFocusDetails.svelte.js +3 -2
- package/dist/Components/TextArea.svelte +2 -30
- package/dist/Components/TextArea.svelte.d.ts +1 -26
- package/dist/Components/TextAreaProps.d.ts +26 -0
- package/dist/Components/TextAreaProps.js +1 -0
- package/dist/Components/TextInput.svelte +6 -40
- package/dist/Components/TextInput.svelte.d.ts +1 -31
- package/dist/Components/TextInputProps.d.ts +31 -0
- package/dist/Components/TextInputProps.js +1 -0
- package/dist/Components/ThreeStateRadio.svelte +4 -23
- package/dist/Components/ThreeStateRadio.svelte.d.ts +1 -19
- package/dist/Components/ThreeStateRadioProps.d.ts +19 -0
- package/dist/Components/ThreeStateRadioProps.js +1 -0
- package/dist/Components/Touch/BoolCard.svelte +3 -2
- package/dist/Components/Touch/DateModal.svelte +23 -11
- package/dist/Components/Touch/DefaultTimer.d.ts +5 -0
- package/dist/Components/Touch/DefaultTimer.js +1 -0
- package/dist/Components/Touch/EditCard.svelte +3 -17
- package/dist/Components/Touch/EditCard.svelte.d.ts +1 -12
- package/dist/Components/Touch/EditCardProps.d.ts +12 -0
- package/dist/Components/Touch/EditCardProps.js +1 -0
- package/dist/Components/Touch/InfoCard.svelte +3 -12
- package/dist/Components/Touch/InfoCard.svelte.d.ts +1 -8
- package/dist/Components/Touch/InfoCardProps.d.ts +8 -0
- package/dist/Components/Touch/InfoCardProps.js +1 -0
- package/dist/Components/Touch/InfoTextCard.svelte +3 -12
- package/dist/Components/Touch/InfoTextCard.svelte.d.ts +1 -7
- package/dist/Components/Touch/InfoTextCardProps.d.ts +7 -0
- package/dist/Components/Touch/InfoTextCardProps.js +1 -0
- package/dist/Components/Touch/KeyValuePair.d.ts +4 -0
- package/dist/Components/Touch/KeyValuePair.js +1 -0
- package/dist/Components/Touch/NumberKeyboard.svelte +54 -37
- package/dist/Components/Touch/NumberKeyboard.svelte.d.ts +1 -11
- package/dist/Components/Touch/NumberKeyboardProps.d.ts +11 -0
- package/dist/Components/Touch/NumberKeyboardProps.js +1 -0
- package/dist/Components/Touch/NumberModal.svelte +19 -26
- package/dist/Components/Touch/NumberModal.svelte.d.ts +1 -15
- package/dist/Components/Touch/NumberModalProps.d.ts +15 -0
- package/dist/Components/Touch/NumberModalProps.js +1 -0
- package/dist/Components/Touch/PlusMinusCard.svelte +6 -2
- package/dist/Components/Touch/SelectModal.svelte +26 -27
- package/dist/Components/Touch/SelectModal.svelte.d.ts +1 -8
- package/dist/Components/Touch/SelectModalProps.d.ts +8 -0
- package/dist/Components/Touch/SelectModalProps.js +1 -0
- package/dist/Components/Touch/SummaryCard.svelte +3 -20
- package/dist/Components/Touch/SummaryCard.svelte.d.ts +1 -15
- package/dist/Components/Touch/SummaryCardProps.d.ts +12 -0
- package/dist/Components/Touch/SummaryCardProps.js +1 -0
- package/dist/Components/Touch/TextAreaModal.svelte +20 -23
- package/dist/Components/Touch/TextAreaModal.svelte.d.ts +1 -12
- package/dist/Components/Touch/TextAreaModalProps.d.ts +12 -0
- package/dist/Components/Touch/TextAreaModalProps.js +1 -0
- package/dist/Components/Touch/TextModal.svelte +24 -33
- package/dist/Components/Touch/TextModal.svelte.d.ts +1 -19
- package/dist/Components/Touch/TextModalProps.d.ts +19 -0
- package/dist/Components/Touch/TextModalProps.js +1 -0
- package/dist/Components/Touch/TouchCard.svelte +2 -11
- package/dist/Components/Touch/TouchCard.svelte.d.ts +1 -6
- package/dist/Components/Touch/TouchCardProps.d.ts +6 -0
- package/dist/Components/Touch/TouchCardProps.js +1 -0
- package/dist/Components/Touch/TouchModal.svelte +14 -46
- package/dist/Components/Touch/TouchModal.svelte.d.ts +1 -31
- package/dist/Components/Touch/TouchModalProps.d.ts +27 -0
- package/dist/Components/Touch/TouchModalProps.js +1 -0
- package/dist/Components/Touch/UtilityButton.svelte +5 -23
- package/dist/Components/Touch/UtilityButton.svelte.d.ts +1 -20
- package/dist/Components/Touch/UtilityButtonProps.d.ts +20 -0
- package/dist/Components/Touch/UtilityButtonProps.js +1 -0
- package/dist/Components/VerticalTabGroup.svelte +2 -12
- package/dist/Components/VerticalTabGroup.svelte.d.ts +1 -10
- package/dist/Components/VerticalTabGroupButton.svelte +18 -20
- package/dist/Components/VerticalTabGroupButton.svelte.d.ts +23 -6
- package/dist/Components/VerticalTabGroupProps.d.ts +10 -0
- package/dist/Components/VerticalTabGroupProps.js +1 -0
- package/dist/Contexts/ContextMenuContext.svelte.d.ts +3 -3
- package/dist/Contexts/ToastContext.svelte.d.ts +1 -1
- package/dist/Contexts/ToastContext.svelte.js +4 -2
- package/dist/Contexts/UntypedInputContext.svelte.d.ts +2 -2
- package/dist/Contexts/UntypedInputContext.svelte.js +10 -12
- package/dist/Helpers/Datamatrix.d.ts +1 -2
- package/dist/Helpers/Helpers.svelte.d.ts +8 -3
- package/dist/Helpers/Helpers.svelte.js +44 -8
- package/dist/Types/Examples/ExampleItem.d.ts +1 -1
- package/dist/Types/Examples/ExampleModal.svelte +1 -1
- package/dist/Types/Internal/AttributeOperation.js +0 -2
- package/dist/Types/Internal/CallbackButton.d.ts +1 -1
- package/dist/Types/Internal/GridItem.d.ts +1 -1
- package/dist/Types/Internal/GridMultiSelectItem.d.ts +2 -2
- package/dist/Types/Internal/GridSelectItem.d.ts +1 -1
- package/dist/Types/Internal/TabOption.d.ts +1 -1
- package/dist/index.d.ts +158 -73
- package/dist/index.js +80 -51
- package/package.json +15 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { browser, dev } from '$app/environment';
|
|
2
|
-
import { asyncAll, asyncFilterIndices, asyncSleep, getCanvasContext, getErrorMessage } from '../../../../Helpers/Helpers.svelte.js';
|
|
3
|
-
import { tick
|
|
2
|
+
import { asyncAll, asyncFilterIndices, asyncSleep, devCatch, getCanvasContext, getErrorMessage } from '../../../../Helpers/Helpers.svelte.js';
|
|
3
|
+
import { tick } from 'svelte';
|
|
4
4
|
import { SvelteMap, SvelteSet } from 'svelte/reactivity';
|
|
5
5
|
import { ColumnType } from '../Columns/ColumnType.js';
|
|
6
6
|
import { AccessorDef } from '../Columns/Definitions/Accessors/AccessorDef.svelte.js';
|
|
@@ -45,7 +45,7 @@ export class TableContext {
|
|
|
45
45
|
return context;
|
|
46
46
|
}
|
|
47
47
|
// #region constructor
|
|
48
|
-
constructor(INTERNAL_ONLY, defaultColumnDefs, tableName, dataRepo, allowCopy, enableResize, allowColumnReordering, allowQuickFiltering, showQuickFilterByDefault, allowAdvancedFiltering, toolbarPosition, displayFooter, selectionExtractor, getUserId, _onEditCell =
|
|
48
|
+
constructor(INTERNAL_ONLY, defaultColumnDefs, tableName, dataRepo, allowCopy, enableResize, allowColumnReordering, allowQuickFiltering, showQuickFilterByDefault, allowAdvancedFiltering, toolbarPosition, displayFooter, selectionExtractor, getUserId, _onEditCell = () => {
|
|
49
49
|
console.warn('Cannot edit immutable table');
|
|
50
50
|
}) {
|
|
51
51
|
this.defaultColumnDefs = defaultColumnDefs;
|
|
@@ -66,76 +66,6 @@ export class TableContext {
|
|
|
66
66
|
}
|
|
67
67
|
this._dataRepo = $state(dataRepo);
|
|
68
68
|
// this.dataRepo.forceRefresh = this.forceVisibilityUpdate;
|
|
69
|
-
$effect(() => {
|
|
70
|
-
const fd = (() => {
|
|
71
|
-
if (this.paginationRepo?.paginationType == PaginationType.Local) {
|
|
72
|
-
const data = this.showSelectedOnly
|
|
73
|
-
? // FIXME this will show the selected items by order of insertion to the selectedItems map.
|
|
74
|
-
[...this.selectedItems.values()]
|
|
75
|
-
: (this.filteredIndices.map((index) => {
|
|
76
|
-
return dataRepo.data[index];
|
|
77
|
-
}) ?? []);
|
|
78
|
-
return data;
|
|
79
|
-
}
|
|
80
|
-
return this.showSelectedOnly ? [...this.selectedItems.values()] : (dataRepo?.data ?? []);
|
|
81
|
-
})();
|
|
82
|
-
const sd = (() => {
|
|
83
|
-
if (this.paginationRepo?.paginationType == PaginationType.Local) {
|
|
84
|
-
const state = dataRepo.sorting ?? [];
|
|
85
|
-
const dataToSort = fd.concat();
|
|
86
|
-
dataToSort.sort((a, b) => {
|
|
87
|
-
const end = state.length;
|
|
88
|
-
for (let i = 0; i < end; i++) {
|
|
89
|
-
const { id, desc } = state[i];
|
|
90
|
-
const sortingFn = this.getSortingFn(id, desc);
|
|
91
|
-
if (sortingFn) {
|
|
92
|
-
const result = sortingFn(a, b);
|
|
93
|
-
if (result != 0) {
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
else if (dev) {
|
|
98
|
-
console.warn('no sorting fn found for ' + id);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return 0;
|
|
102
|
-
});
|
|
103
|
-
return dataToSort;
|
|
104
|
-
}
|
|
105
|
-
return fd ?? [];
|
|
106
|
-
})();
|
|
107
|
-
const cpd = (() => {
|
|
108
|
-
if (dataRepo.paginationType != PaginationType.Local) {
|
|
109
|
-
return sd ?? [];
|
|
110
|
-
}
|
|
111
|
-
const x = sd.slice(dataRepo.pageStartIndex, dataRepo.pageEndIndexExclusive);
|
|
112
|
-
if (dev) {
|
|
113
|
-
console.log(x);
|
|
114
|
-
}
|
|
115
|
-
return x;
|
|
116
|
-
})();
|
|
117
|
-
const ori = new Map((dataRepo.data ?? []).map((item, index) => [item, index]));
|
|
118
|
-
this._filteredData = fd;
|
|
119
|
-
this._sortedData = sd;
|
|
120
|
-
this._currentPageData = cpd;
|
|
121
|
-
this._originalRowIndices = ori;
|
|
122
|
-
});
|
|
123
|
-
$effect(() => {
|
|
124
|
-
if (this._currentPageData) {
|
|
125
|
-
void this.selectedItems;
|
|
126
|
-
untrack(() => {
|
|
127
|
-
if (this.paginationRepo?.paginationState.pageIndex != undefined &&
|
|
128
|
-
this.paginationRepo?.paginationState.pageSize != undefined) {
|
|
129
|
-
this.updateSelectedItems();
|
|
130
|
-
this.resetHighlightedRows();
|
|
131
|
-
this.recalculateAllSelectedInCurrentPage();
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
$effect(() => {
|
|
137
|
-
$inspect(this.sortedData, this._currentPageData, this._originalRowIndices);
|
|
138
|
-
});
|
|
139
69
|
if (defaultColumnDefs.remoteFilters) {
|
|
140
70
|
this.remoteFilters = defaultColumnDefs.remoteFilters;
|
|
141
71
|
}
|
|
@@ -193,45 +123,44 @@ export class TableContext {
|
|
|
193
123
|
const preset = presets.find((it) => it.name === savedPresetName);
|
|
194
124
|
if (preset && areDefsEquivalent(this.columnDefs, preset.columnDefs)) {
|
|
195
125
|
this.columnDefs = preset.columnDefs;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
if (preset.columnPinningState) {
|
|
200
|
-
this.columnPinning = preset.columnPinningState;
|
|
201
|
-
}
|
|
126
|
+
this.columnVisibility = preset.visibilityState;
|
|
127
|
+
this.columnPinning = preset.columnPinningState;
|
|
202
128
|
this.selectedPreset = preset;
|
|
203
129
|
}
|
|
204
130
|
else {
|
|
205
131
|
localStorage.removeItem(`${this.userId}-${tableName}-selected-preset-name`);
|
|
206
132
|
this.selectedPreset = presets[0];
|
|
207
|
-
if (presets
|
|
133
|
+
if (presets.at(0)?.visibilityState) {
|
|
208
134
|
this.columnVisibility = presets[0].visibilityState;
|
|
209
135
|
}
|
|
210
136
|
}
|
|
211
137
|
this.columnPresets = presets;
|
|
212
138
|
}
|
|
213
|
-
})
|
|
139
|
+
})
|
|
140
|
+
.catch(devCatch);
|
|
214
141
|
}
|
|
215
142
|
$effect(() => {
|
|
216
143
|
void this.paginationRepo?.paginationType;
|
|
217
|
-
void this.dataRepo
|
|
218
|
-
void this.dataRepo
|
|
219
|
-
void this.dataRepo
|
|
144
|
+
void this.dataRepo.filtering;
|
|
145
|
+
void this.dataRepo.filterModes.values();
|
|
146
|
+
void this.dataRepo.data;
|
|
220
147
|
(async () => {
|
|
221
148
|
const startTime = Date.now();
|
|
222
|
-
let
|
|
149
|
+
let currentTimerPromise;
|
|
223
150
|
const abortController = new AbortController();
|
|
224
151
|
try {
|
|
225
152
|
if (this.paginationRepo?.paginationType == PaginationType.Local) {
|
|
153
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
226
154
|
const checkedIds = new Set();
|
|
227
|
-
const filterState = this.dataRepo
|
|
155
|
+
const filterState = this.dataRepo.filtering.filter((filter) => {
|
|
228
156
|
const snapshot = $state.snapshot(filter.value);
|
|
229
157
|
checkedIds.add(filter.id);
|
|
230
|
-
const
|
|
231
|
-
return (
|
|
232
|
-
(
|
|
233
|
-
|
|
234
|
-
|
|
158
|
+
const filterMode = this.dataRepo.filterModes.get(filter.id);
|
|
159
|
+
return (!!filterMode &&
|
|
160
|
+
(allowedEmptyFilterModes.has(filterMode) ||
|
|
161
|
+
(snapshot !== '' && (!Array.isArray(snapshot) || snapshot[0] !== ''))));
|
|
162
|
+
});
|
|
163
|
+
const data = this.dataRepo.data;
|
|
235
164
|
// HACK add filter state for filters that don't require a value to function
|
|
236
165
|
// this.dataRepo?.filterModes?.entries().forEach(([key, value]) => {
|
|
237
166
|
// if (!checkedIds.has(key)) {
|
|
@@ -246,66 +175,58 @@ export class TableContext {
|
|
|
246
175
|
// console.warn(`key ${key} was already checked, new value:`, value);
|
|
247
176
|
// }
|
|
248
177
|
// });
|
|
249
|
-
|
|
178
|
+
if (!filterState.length) {
|
|
179
|
+
this.filteredIndices = data.map((_, index) => index);
|
|
180
|
+
}
|
|
181
|
+
currentTimerPromise = this.filterTimer = this.filterTimer + 1;
|
|
250
182
|
await asyncSleep(150);
|
|
251
|
-
|
|
183
|
+
const currentTimer = currentTimerPromise;
|
|
184
|
+
if (currentTimerPromise != this.filterTimer) {
|
|
252
185
|
throw new Error('stale filter');
|
|
253
186
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
let settled = false;
|
|
265
|
-
const filterPromise = asyncFilterIndices(data, async (item, index) => {
|
|
266
|
-
if (item == null) {
|
|
267
|
-
throw new Error(`Found a nullish data item at async filter at index ${index}`);
|
|
268
|
-
}
|
|
269
|
-
const row = this.createRow(item, index, index);
|
|
270
|
-
return asyncAll(filterState, async (filter) => {
|
|
271
|
-
abortController.signal.throwIfAborted();
|
|
272
|
-
const def = this.columnDefsById.get(filter.id);
|
|
273
|
-
if (!def) {
|
|
274
|
-
console.warn(`Could not find column def for filter with id ${filter.id}`);
|
|
275
|
-
return false;
|
|
276
|
-
}
|
|
277
|
-
if (def.filterFn) {
|
|
278
|
-
return def.filterFn(row, filter.id, filter.value);
|
|
279
|
-
}
|
|
280
|
-
if (dev) {
|
|
281
|
-
console.warn(`column ${def.id} did not have a filter function`);
|
|
282
|
-
}
|
|
187
|
+
let settled = false;
|
|
188
|
+
const filterPromise = asyncFilterIndices(data, async (item, index) => {
|
|
189
|
+
const row = this.createRow(item, index, index);
|
|
190
|
+
return asyncAll(filterState, async (filter) => {
|
|
191
|
+
abortController.signal.throwIfAborted();
|
|
192
|
+
const def = this.columnDefsById.get(filter.id);
|
|
193
|
+
if (!def) {
|
|
194
|
+
console.warn(`Could not find column def for filter with id ${filter.id}`);
|
|
283
195
|
return false;
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
filterPromise
|
|
287
|
-
.then((indices) => {
|
|
288
|
-
this.filteredIndices = indices;
|
|
289
|
-
})
|
|
290
|
-
.catch((e) => {
|
|
291
|
-
if (dev) {
|
|
292
|
-
console.log(`caught filter rejection:`, e);
|
|
293
|
-
console.log(`iteration ${currentTimer} cancelled after ${Date.now() - startTime}ms`);
|
|
294
196
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
settled = true;
|
|
298
|
-
});
|
|
299
|
-
for (;;) {
|
|
300
|
-
if (currentTimer !== this.filterTimer) {
|
|
301
|
-
abortController.abort('stale data');
|
|
197
|
+
if (def.filterFn) {
|
|
198
|
+
return def.filterFn(row, filter.id, filter.value);
|
|
302
199
|
}
|
|
303
|
-
if (
|
|
304
|
-
console.
|
|
305
|
-
return;
|
|
200
|
+
if (dev) {
|
|
201
|
+
console.warn(`column ${def.id} did not have a filter function`);
|
|
306
202
|
}
|
|
307
|
-
|
|
203
|
+
return false;
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
filterPromise
|
|
207
|
+
.then((indices) => {
|
|
208
|
+
this.filteredIndices = indices;
|
|
209
|
+
})
|
|
210
|
+
.catch((e) => {
|
|
211
|
+
if (dev) {
|
|
212
|
+
console.log(`caught filter rejection:`, e);
|
|
213
|
+
console.log(`iteration ${currentTimer} cancelled after ${Date.now() - startTime}ms`);
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
.finally(() => {
|
|
217
|
+
settled = true;
|
|
218
|
+
});
|
|
219
|
+
for (;;) {
|
|
220
|
+
if (currentTimerPromise !== this.filterTimer) {
|
|
221
|
+
abortController.abort('stale data');
|
|
222
|
+
}
|
|
223
|
+
// HACK this warning is wrong. We're in an async context and settled is being changed in the finally callback above
|
|
224
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
225
|
+
if (settled) {
|
|
226
|
+
console.log(`iteration ${currentTimerPromise} finished ${Date.now() - startTime}ms`);
|
|
227
|
+
return;
|
|
308
228
|
}
|
|
229
|
+
await tick();
|
|
309
230
|
}
|
|
310
231
|
}
|
|
311
232
|
}
|
|
@@ -315,10 +236,10 @@ export class TableContext {
|
|
|
315
236
|
if (!message.toLocaleLowerCase().startsWith('stale')) {
|
|
316
237
|
console.error(e);
|
|
317
238
|
}
|
|
318
|
-
console.log(`iteration ${
|
|
239
|
+
console.log(`iteration ${currentTimerPromise} cancelled after ${Date.now() - startTime}ms`);
|
|
319
240
|
}
|
|
320
241
|
}
|
|
321
|
-
})();
|
|
242
|
+
})().catch(devCatch);
|
|
322
243
|
});
|
|
323
244
|
}
|
|
324
245
|
// #endregion
|
|
@@ -384,7 +305,12 @@ export class TableContext {
|
|
|
384
305
|
return this._columnDefs;
|
|
385
306
|
}
|
|
386
307
|
set columnDefs(v) {
|
|
308
|
+
// if (this._columnDefs.length > 0 && v != this._columnDefs) {
|
|
309
|
+
// debugger;
|
|
310
|
+
// }
|
|
387
311
|
this._columnDefs = v;
|
|
312
|
+
// this causes an error...?
|
|
313
|
+
// this.table = createTable(this.tableOptions);
|
|
388
314
|
}
|
|
389
315
|
_columnPresets = $state([]);
|
|
390
316
|
get columnPresets() {
|
|
@@ -520,16 +446,13 @@ export class TableContext {
|
|
|
520
446
|
this._openModalCoordinates = v;
|
|
521
447
|
}
|
|
522
448
|
_allSelectedInCurrentPage = $derived.by(() => {
|
|
523
|
-
if (
|
|
449
|
+
if (this.selectedItems.size === 0) {
|
|
524
450
|
return Promise.resolve(false);
|
|
525
451
|
}
|
|
526
452
|
const pageStartIndex = this.paginationRepo ? this.paginationRepo.pageStartIndex : 0;
|
|
527
453
|
const pageEndIndexExclusive = this.paginationRepo
|
|
528
454
|
? Math.min(this.paginationRepo.pageEndIndexExclusive, this.sortedData.length)
|
|
529
455
|
: this.sortedData.length;
|
|
530
|
-
if (pageStartIndex == undefined || pageEndIndexExclusive == undefined) {
|
|
531
|
-
return Promise.resolve(false);
|
|
532
|
-
}
|
|
533
456
|
const selectableMethod = this.columnDefs.find((it) => it instanceof RowSelectionDef)?.isSelectable;
|
|
534
457
|
return this.allSelectedBySelectableMethod(pageStartIndex, pageEndIndexExclusive, selectableMethod);
|
|
535
458
|
});
|
|
@@ -537,9 +460,6 @@ export class TableContext {
|
|
|
537
460
|
return this._allSelectedInCurrentPage;
|
|
538
461
|
}
|
|
539
462
|
async allSelectedBySelectableMethod(pageStartIndex, pageEndIndexExclusive, selectableMethod) {
|
|
540
|
-
if (!this.dataRepo) {
|
|
541
|
-
return Promise.resolve(false);
|
|
542
|
-
}
|
|
543
463
|
if (selectableMethod) {
|
|
544
464
|
for (let index = pageStartIndex; index < pageEndIndexExclusive; index++) {
|
|
545
465
|
const item = this.sortedData[index];
|
|
@@ -560,9 +480,6 @@ export class TableContext {
|
|
|
560
480
|
return Promise.resolve(true);
|
|
561
481
|
}
|
|
562
482
|
async _areAllHighlighted(pageStartIndex, pageEndIndexExclusive) {
|
|
563
|
-
if (!this.dataRepo) {
|
|
564
|
-
return Promise.resolve(false);
|
|
565
|
-
}
|
|
566
483
|
for (let index = pageStartIndex; index < pageEndIndexExclusive; index++) {
|
|
567
484
|
const item = this.sortedData[index];
|
|
568
485
|
if (!this.highlightedItems.has(this.selectionExtractor(item))) {
|
|
@@ -572,16 +489,13 @@ export class TableContext {
|
|
|
572
489
|
return Promise.resolve(true);
|
|
573
490
|
}
|
|
574
491
|
_allHighlighted = $derived.by(() => {
|
|
575
|
-
if (
|
|
492
|
+
if (this.highlightedItems.size === 0) {
|
|
576
493
|
return Promise.resolve(false);
|
|
577
494
|
}
|
|
578
495
|
const pageStartIndex = this.paginationRepo ? this.paginationRepo.pageStartIndex : 0;
|
|
579
496
|
const pageEndIndexExclusive = this.paginationRepo
|
|
580
497
|
? Math.min(this.paginationRepo.pageEndIndexExclusive, this.sortedData.length)
|
|
581
498
|
: this.sortedData.length;
|
|
582
|
-
if (pageStartIndex == undefined || pageEndIndexExclusive == undefined) {
|
|
583
|
-
return Promise.resolve(false);
|
|
584
|
-
}
|
|
585
499
|
return this._areAllHighlighted(pageStartIndex, pageEndIndexExclusive);
|
|
586
500
|
});
|
|
587
501
|
get allHighlighted() {
|
|
@@ -646,12 +560,14 @@ export class TableContext {
|
|
|
646
560
|
set hasInvalidSelectedItems(v) {
|
|
647
561
|
this._hasInvalidSelectedItems = v;
|
|
648
562
|
}
|
|
563
|
+
// FIXME decide
|
|
564
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
649
565
|
columnDefsById = $derived(new Map(this.columnDefs.map((it) => [it.id, it])));
|
|
650
566
|
getSortingFn = (id, desc) => {
|
|
651
|
-
if (this.dataRepo
|
|
567
|
+
if (this.dataRepo.data.length == 0) {
|
|
652
568
|
return undefined;
|
|
653
569
|
}
|
|
654
|
-
const def = this.columnDefsById
|
|
570
|
+
const def = this.columnDefsById.get(id);
|
|
655
571
|
if (!def) {
|
|
656
572
|
return undefined;
|
|
657
573
|
}
|
|
@@ -675,6 +591,10 @@ export class TableContext {
|
|
|
675
591
|
// }
|
|
676
592
|
return comparableSortingFn(id, desc);
|
|
677
593
|
};
|
|
594
|
+
originalRowIndices = $derived(
|
|
595
|
+
// TODO decide
|
|
596
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
597
|
+
new Map(this.dataRepo.data.map((item, index) => [item, index])));
|
|
678
598
|
// private _filterTimer: ReturnType<typeof setTimeout> | undefined;
|
|
679
599
|
_filterTimer = 1;
|
|
680
600
|
get filterTimer() {
|
|
@@ -690,21 +610,49 @@ export class TableContext {
|
|
|
690
610
|
set filteredIndices(v) {
|
|
691
611
|
this._filteredIndices = v;
|
|
692
612
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
613
|
+
filteredData = $derived.by(() => {
|
|
614
|
+
if (this.paginationRepo?.paginationType == PaginationType.Local) {
|
|
615
|
+
const data = this.showSelectedOnly
|
|
616
|
+
? // FIXME this will show the selected items by order of insertion to the selectedItems map.
|
|
617
|
+
[...this.selectedItems.values()]
|
|
618
|
+
: this.filteredIndices.map((index) => {
|
|
619
|
+
return this.dataRepo.data[index];
|
|
620
|
+
});
|
|
621
|
+
return data;
|
|
622
|
+
}
|
|
623
|
+
return this.showSelectedOnly ? [...this.selectedItems.values()] : this.dataRepo.data;
|
|
624
|
+
});
|
|
625
|
+
sortedData = $derived.by(() => {
|
|
626
|
+
if (this.paginationRepo?.paginationType == PaginationType.Local) {
|
|
627
|
+
const state = this.dataRepo.sorting;
|
|
628
|
+
const sortedData = this.showSelectedOnly
|
|
629
|
+
? // FIXME this will show the selected items by order of insertion to the selectedItems map.
|
|
630
|
+
[...this.selectedItems.values()]
|
|
631
|
+
: this.filteredData.concat();
|
|
632
|
+
sortedData.sort((a, b) => {
|
|
633
|
+
const end = state.length;
|
|
634
|
+
for (let i = 0; i < end; i++) {
|
|
635
|
+
const { id, desc } = state[i];
|
|
636
|
+
const sortingFn = this.getSortingFn(id, desc);
|
|
637
|
+
if (sortingFn) {
|
|
638
|
+
const result = sortingFn(a, b);
|
|
639
|
+
if (result != 0) {
|
|
640
|
+
return result;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
console.warn('no sorting fn found for ' + id);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
return 0;
|
|
648
|
+
});
|
|
649
|
+
return sortedData;
|
|
650
|
+
}
|
|
651
|
+
return this.filteredData;
|
|
652
|
+
});
|
|
701
653
|
sortedRowModel = $derived.by(() => {
|
|
702
654
|
const rows = this.sortedData.map((item, index) => {
|
|
703
|
-
const
|
|
704
|
-
const unsortedIndex = originalIndex ?? index;
|
|
705
|
-
if (originalIndex == null) {
|
|
706
|
-
throw new Error(`Sorted Data not found in Original Row Indices: original index ${originalIndex}, index ${index}`);
|
|
707
|
-
}
|
|
655
|
+
const unsortedIndex = this.originalRowIndices.get(item) ?? index;
|
|
708
656
|
return this.createRow(item, index, unsortedIndex);
|
|
709
657
|
});
|
|
710
658
|
return {
|
|
@@ -713,26 +661,16 @@ export class TableContext {
|
|
|
713
661
|
rowsById: new Map(rows.map((it, index) => [index.toString(), it])) //FIXME should this be by sorted id or by original id?
|
|
714
662
|
};
|
|
715
663
|
});
|
|
716
|
-
_currentPageData = $
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
}
|
|
720
|
-
// FIXME this is most likely the cuplrit for add pod not working on receipt. It may be one tick behind the other values
|
|
721
|
-
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
722
|
-
_originalRowIndices = $state(new Map());
|
|
723
|
-
get originalRowIndices() {
|
|
724
|
-
return this._originalRowIndices;
|
|
725
|
-
}
|
|
664
|
+
_currentPageData = $derived(this.dataRepo.paginationType == PaginationType.Local
|
|
665
|
+
? this.sortedData.slice(this.dataRepo.pageStartIndex, this.dataRepo.pageEndIndexExclusive)
|
|
666
|
+
: this.sortedData);
|
|
726
667
|
paginationRowModel = $derived.by(() => {
|
|
727
|
-
const
|
|
728
|
-
const rows =
|
|
729
|
-
const unsortedIndex = this.
|
|
730
|
-
if (!item) {
|
|
731
|
-
throw new Error(`No Item was found at index ${index}`);
|
|
732
|
-
}
|
|
668
|
+
const sortedData = this._currentPageData;
|
|
669
|
+
const rows = sortedData.map((item, index) => {
|
|
670
|
+
const unsortedIndex = this.originalRowIndices.get(item) ?? index;
|
|
733
671
|
const row = {
|
|
734
672
|
getValue: async (key) => {
|
|
735
|
-
const gotValue = this.columnDefsById.get(key)
|
|
673
|
+
const gotValue = await this.columnDefsById.get(key)?.accessorFn?.(item, index);
|
|
736
674
|
if (gotValue !== undefined) {
|
|
737
675
|
return gotValue;
|
|
738
676
|
}
|
|
@@ -781,10 +719,13 @@ export class TableContext {
|
|
|
781
719
|
};
|
|
782
720
|
const makeCellFromId = (columnId) => {
|
|
783
721
|
const def = this.columnDefsById.get(columnId);
|
|
722
|
+
if (!def) {
|
|
723
|
+
throw new Error(`Could not find column with id ${columnId}`);
|
|
724
|
+
}
|
|
784
725
|
return makeRow(def);
|
|
785
726
|
};
|
|
786
|
-
const leftVisibleCells = $derived([...(this.columnPinning.left?.keys() ?? [])].map(makeCellFromId)
|
|
787
|
-
const rightVisibleCells = $derived([...(this.columnPinning.right?.keys() ?? [])].map(makeCellFromId)
|
|
727
|
+
const leftVisibleCells = $derived([...(this.columnPinning.left?.keys() ?? [])].map(makeCellFromId));
|
|
728
|
+
const rightVisibleCells = $derived([...(this.columnPinning.right?.keys() ?? [])].map(makeCellFromId));
|
|
788
729
|
const centerVisibleCells = $derived(this.columnDefs
|
|
789
730
|
.filter((it) => {
|
|
790
731
|
return !(this.columnPinning.left?.has(it.id) || this.columnPinning.right?.has(it.id));
|
|
@@ -798,17 +739,33 @@ export class TableContext {
|
|
|
798
739
|
rowsById: new Map(rows.map((it, index) => [index.toString(), it])) //FIXME should this be by sorted id or by original id?
|
|
799
740
|
};
|
|
800
741
|
});
|
|
742
|
+
get currentPageData() {
|
|
743
|
+
return this._currentPageData;
|
|
744
|
+
}
|
|
801
745
|
// #endregion
|
|
802
746
|
// #region public methods
|
|
803
747
|
selectionContains = (item) => {
|
|
804
|
-
if (!this.selectionExtractor) {
|
|
805
|
-
throw new Error('No selection extractor was supplied');
|
|
806
|
-
}
|
|
807
748
|
if (!this.isSelectable) {
|
|
808
749
|
return true;
|
|
809
750
|
}
|
|
810
751
|
return this.selectedItems.has(this.selectionExtractor(item));
|
|
811
752
|
};
|
|
753
|
+
// public readonly HACK__reselectItem = (item: T) => {
|
|
754
|
+
// if (!this.selectionExtractor) {
|
|
755
|
+
// throw new Error('No selection extractor was supplied');
|
|
756
|
+
// }
|
|
757
|
+
// if (!this.isSelectable) {
|
|
758
|
+
// return true;
|
|
759
|
+
// }
|
|
760
|
+
// const key = this.selectionExtractor(item);
|
|
761
|
+
// if (this.selectedItems.has(key)) {
|
|
762
|
+
// this.selectedItems.delete(key);
|
|
763
|
+
// this.selectedItems.set(key, item);
|
|
764
|
+
// } else {
|
|
765
|
+
// this.selectedItems.set(key, item);
|
|
766
|
+
// this.selectedItems.delete(key);
|
|
767
|
+
// }
|
|
768
|
+
// };
|
|
812
769
|
addInvalidValue = (item) => {
|
|
813
770
|
this.invalidValues.set(this.selectionExtractor(item), item);
|
|
814
771
|
};
|
|
@@ -827,6 +784,13 @@ export class TableContext {
|
|
|
827
784
|
this.highlightedItems.set(key, item);
|
|
828
785
|
}
|
|
829
786
|
};
|
|
787
|
+
// public readonly toggleHighlightedRow = (rowIndex: number) => {
|
|
788
|
+
// if (this.highlightedRowIndexIds.has(rowIndex)) {
|
|
789
|
+
// this.highlightedRowIndexIds.delete(rowIndex);
|
|
790
|
+
// } else {
|
|
791
|
+
// this.highlightedRowIndexIds.add(rowIndex);
|
|
792
|
+
// }
|
|
793
|
+
// };
|
|
830
794
|
resetHighlightedRows = () => {
|
|
831
795
|
this.highlightedItems.clear();
|
|
832
796
|
};
|
|
@@ -838,50 +802,40 @@ export class TableContext {
|
|
|
838
802
|
else {
|
|
839
803
|
this.selectedItems.delete(key);
|
|
840
804
|
}
|
|
805
|
+
this.recalculateAllSelectedInCurrentPage();
|
|
841
806
|
};
|
|
842
807
|
setSelectionMap = (set) => {
|
|
843
808
|
this.selectedItems = set;
|
|
844
809
|
};
|
|
845
810
|
updateSelectedItems = async () => {
|
|
846
|
-
if (!this.dataRepo) {
|
|
847
|
-
return;
|
|
848
|
-
}
|
|
849
811
|
const pageStartIndex = this.paginationRepo ? this.paginationRepo.pageStartIndex : 0;
|
|
850
812
|
const pageEndIndexExclusive = this.paginationRepo
|
|
851
813
|
? Math.min(this.paginationRepo.pageEndIndexExclusive, this.sortedData.length)
|
|
852
814
|
: this.sortedData.length;
|
|
853
815
|
const selectableMethod = this.columnDefs.find((it) => it instanceof RowSelectionDef)?.isSelectable;
|
|
854
|
-
const updateSelectedItem = (item) => {
|
|
855
|
-
const key = this.selectionExtractor(item);
|
|
856
|
-
if (this.selectedItems.has(key)) {
|
|
857
|
-
//replace selected item with newer version of the same identity
|
|
858
|
-
this.selectedItems.set(key, item);
|
|
859
|
-
}
|
|
860
|
-
};
|
|
861
816
|
if (selectableMethod) {
|
|
862
817
|
for (let index = pageStartIndex; index < pageEndIndexExclusive; index++) {
|
|
863
818
|
const item = this.sortedData[index];
|
|
864
|
-
// HACK: Please find why this is happening and fix it properly
|
|
865
|
-
if (!item) {
|
|
866
|
-
console.warn(`skipping update because there is a data mismatch (with selectable method)`);
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
819
|
if (await selectableMethod(item, index)) {
|
|
870
|
-
|
|
820
|
+
const key = this.selectionExtractor(item);
|
|
821
|
+
if (this.selectedItems.has(key)) {
|
|
822
|
+
//replace selected item with newer version of the same identity
|
|
823
|
+
this.selectedItems.set(key, item);
|
|
824
|
+
}
|
|
871
825
|
}
|
|
872
826
|
}
|
|
873
827
|
}
|
|
874
828
|
else {
|
|
875
829
|
for (let index = pageStartIndex; index < pageEndIndexExclusive; index++) {
|
|
876
830
|
const item = this.sortedData[index];
|
|
877
|
-
|
|
878
|
-
if (
|
|
879
|
-
|
|
880
|
-
|
|
831
|
+
const key = this.selectionExtractor(item);
|
|
832
|
+
if (this.selectedItems.has(key)) {
|
|
833
|
+
//replace selected item with newer version of the same identity
|
|
834
|
+
this.selectedItems.set(key, item);
|
|
881
835
|
}
|
|
882
|
-
updateSelectedItem(item);
|
|
883
836
|
}
|
|
884
837
|
}
|
|
838
|
+
this.recalculateAllSelectedInCurrentPage();
|
|
885
839
|
};
|
|
886
840
|
resetSelectedItems = () => {
|
|
887
841
|
for (const key of this.selectedItems.keys()) {
|
|
@@ -889,32 +843,16 @@ export class TableContext {
|
|
|
889
843
|
}
|
|
890
844
|
this.recalculateAllSelectedInCurrentPage();
|
|
891
845
|
};
|
|
892
|
-
lastIncrement = Number.MIN_SAFE_INTEGER;
|
|
893
846
|
recalculateAllSelectedInCurrentPage = () => {
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
if (this.lastIncrement == currentIncrement) {
|
|
900
|
-
this.hasInvalidSelectedItems = allSelectedInCurrentPage.some((key) => {
|
|
901
|
-
return invalidValues.has(key);
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
else {
|
|
905
|
-
if (dev) {
|
|
906
|
-
console.log('skipping recalculation due to stale data');
|
|
907
|
-
}
|
|
908
|
-
}
|
|
847
|
+
tick()
|
|
848
|
+
.then(() => {
|
|
849
|
+
return this.allSelectedInCurrentPage.then(() => {
|
|
850
|
+
this.hasInvalidSelectedItems = [...this.selectedItems.keys()].some((key) => this._invalidValues.has(key));
|
|
851
|
+
});
|
|
909
852
|
})
|
|
910
|
-
.catch(
|
|
911
|
-
console.log(e);
|
|
912
|
-
});
|
|
853
|
+
.catch(devCatch);
|
|
913
854
|
};
|
|
914
855
|
selectAllInCurrentPage = async () => {
|
|
915
|
-
if (!this.dataRepo) {
|
|
916
|
-
return;
|
|
917
|
-
}
|
|
918
856
|
if (await this.allSelectedInCurrentPage) {
|
|
919
857
|
// this.resetSelectedItems();
|
|
920
858
|
const pageStartIndex = this.paginationRepo ? this.paginationRepo.pageStartIndex : 0;
|
|
@@ -949,12 +887,11 @@ export class TableContext {
|
|
|
949
887
|
}
|
|
950
888
|
}
|
|
951
889
|
}
|
|
890
|
+
this.recalculateAllSelectedInCurrentPage();
|
|
952
891
|
};
|
|
953
892
|
onHighlightAll = () => {
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
}
|
|
957
|
-
this.allHighlighted.then((areAllHighlighted) => {
|
|
893
|
+
this.allHighlighted
|
|
894
|
+
.then((areAllHighlighted) => {
|
|
958
895
|
if (areAllHighlighted) {
|
|
959
896
|
this.highlightedItems.clear();
|
|
960
897
|
}
|
|
@@ -963,17 +900,19 @@ export class TableContext {
|
|
|
963
900
|
this.highlightedItems.set(this.selectionExtractor(item), item);
|
|
964
901
|
});
|
|
965
902
|
}
|
|
966
|
-
})
|
|
903
|
+
})
|
|
904
|
+
.catch(devCatch);
|
|
967
905
|
};
|
|
968
906
|
onEditCell = async (item, coords, value) => {
|
|
969
|
-
const oldKey = this.selectionExtractor
|
|
907
|
+
const oldKey = this.selectionExtractor(item);
|
|
970
908
|
const wasSelected = oldKey != null && this.selectedItems.has(oldKey);
|
|
909
|
+
// debugger;
|
|
971
910
|
if (wasSelected) {
|
|
972
911
|
this.selectedItems.delete(oldKey);
|
|
973
912
|
}
|
|
974
|
-
await this._onEditCell(item, coords, value);
|
|
913
|
+
await this._onEditCell?.(item, coords, value);
|
|
975
914
|
if (wasSelected && this.isSelectable) {
|
|
976
|
-
const newKey = this.selectionExtractor
|
|
915
|
+
const newKey = this.selectionExtractor(item);
|
|
977
916
|
if (newKey) {
|
|
978
917
|
this.selectedItems.set(newKey, item);
|
|
979
918
|
}
|
|
@@ -1012,7 +951,7 @@ export class TableContext {
|
|
|
1012
951
|
switch (e.key) {
|
|
1013
952
|
case 'Enter':
|
|
1014
953
|
case 'F2':
|
|
1015
|
-
if (!e.target?.classList
|
|
954
|
+
if (!e.target?.classList.contains('editable')) {
|
|
1016
955
|
break;
|
|
1017
956
|
}
|
|
1018
957
|
e.preventDefault();
|
|
@@ -1084,10 +1023,10 @@ export class TableContext {
|
|
|
1084
1023
|
}
|
|
1085
1024
|
//these two at the bottom shouldn't happen on a home press
|
|
1086
1025
|
}
|
|
1087
|
-
else if (e.getModifierState('Shift') && this.allowCopy
|
|
1026
|
+
else if (e.getModifierState('Shift') && this.allowCopy) {
|
|
1088
1027
|
this.moveFocusLeft();
|
|
1089
1028
|
}
|
|
1090
|
-
else
|
|
1029
|
+
else {
|
|
1091
1030
|
this.setFocusLeft();
|
|
1092
1031
|
}
|
|
1093
1032
|
return;
|
|
@@ -1106,10 +1045,10 @@ export class TableContext {
|
|
|
1106
1045
|
this.moveToEnd();
|
|
1107
1046
|
}
|
|
1108
1047
|
}
|
|
1109
|
-
else if (e.getModifierState('Shift') && this.allowCopy
|
|
1048
|
+
else if (e.getModifierState('Shift') && this.allowCopy) {
|
|
1110
1049
|
this.moveFocusRight();
|
|
1111
1050
|
}
|
|
1112
|
-
else
|
|
1051
|
+
else {
|
|
1113
1052
|
this.setFocusRight();
|
|
1114
1053
|
}
|
|
1115
1054
|
}
|
|
@@ -1130,9 +1069,7 @@ export class TableContext {
|
|
|
1130
1069
|
case 'C':
|
|
1131
1070
|
if (e.getModifierState('Control')) {
|
|
1132
1071
|
e.preventDefault();
|
|
1133
|
-
|
|
1134
|
-
this.copyDataToClipboard();
|
|
1135
|
-
}
|
|
1072
|
+
this.copyDataToClipboard().catch(devCatch);
|
|
1136
1073
|
}
|
|
1137
1074
|
break;
|
|
1138
1075
|
}
|
|
@@ -1146,11 +1083,13 @@ export class TableContext {
|
|
|
1146
1083
|
? `#${this.tableName}-cell-${fs.row}-${fs.id}`
|
|
1147
1084
|
: `#${this.tableName}-cell-quicksearch-${fs.id}`);
|
|
1148
1085
|
this.showQuickFiltering = !this.showQuickFiltering;
|
|
1149
|
-
tick()
|
|
1086
|
+
tick()
|
|
1087
|
+
.then(() => {
|
|
1150
1088
|
if (idToFocusTo) {
|
|
1151
1089
|
document.querySelector(idToFocusTo)?.focus();
|
|
1152
1090
|
}
|
|
1153
|
-
})
|
|
1091
|
+
})
|
|
1092
|
+
.catch(devCatch);
|
|
1154
1093
|
}
|
|
1155
1094
|
};
|
|
1156
1095
|
setColumnPinning = (updater) => {
|
|
@@ -1182,10 +1121,10 @@ export class TableContext {
|
|
|
1182
1121
|
// public get rowModel() {
|
|
1183
1122
|
// return this._rowModel;
|
|
1184
1123
|
// }
|
|
1185
|
-
lastPage = $derived(this.dataRepo
|
|
1124
|
+
lastPage = $derived(this.dataRepo.lastPage ?? 0);
|
|
1186
1125
|
measureHeaderWidth = (columnDef) => {
|
|
1187
1126
|
const label = columnDef.header;
|
|
1188
|
-
if (typeof label === 'string' &&
|
|
1127
|
+
if (typeof label === 'string' && browser) {
|
|
1189
1128
|
const extraWidth = columnDef.allowSorting ? SORTING_ICON_WIDTH : 0;
|
|
1190
1129
|
const canvasContext = getCanvasContext();
|
|
1191
1130
|
if (canvasContext) {
|
|
@@ -1205,7 +1144,7 @@ export class TableContext {
|
|
|
1205
1144
|
return 0;
|
|
1206
1145
|
};
|
|
1207
1146
|
autoResize = async (columnDef) => {
|
|
1208
|
-
if (!
|
|
1147
|
+
if (!browser) {
|
|
1209
1148
|
return;
|
|
1210
1149
|
}
|
|
1211
1150
|
const ctx = getCanvasContext();
|
|
@@ -1218,16 +1157,13 @@ export class TableContext {
|
|
|
1218
1157
|
if (columnDef.accessorFn) {
|
|
1219
1158
|
for (let i = currentPageContents.length - 1; i > -1; i--) {
|
|
1220
1159
|
const row = currentPageContents[i];
|
|
1221
|
-
const label = (
|
|
1222
|
-
const currentWidth = ctx
|
|
1160
|
+
const label = (await columnDef.accessorFn(row, i))?.toString() ?? '';
|
|
1161
|
+
const currentWidth = ctx?.measureText(label).width ?? 0;
|
|
1223
1162
|
maxWidth = Math.max(maxWidth, currentWidth);
|
|
1224
1163
|
}
|
|
1225
1164
|
}
|
|
1226
1165
|
else {
|
|
1227
|
-
const currentWidth = columnDef.width
|
|
1228
|
-
ctx.measureText(
|
|
1229
|
-
// TODO
|
|
1230
|
-
(typeof columnDef.header == 'string' ? columnDef.header : 'TODO') ?? '-').width;
|
|
1166
|
+
const currentWidth = columnDef.width;
|
|
1231
1167
|
maxWidth = Math.max(maxWidth, currentWidth);
|
|
1232
1168
|
}
|
|
1233
1169
|
this.columnSizing[colId] = maxWidth + 32; //standard extra cell padding
|
|
@@ -1239,16 +1175,17 @@ export class TableContext {
|
|
|
1239
1175
|
if (!this.dragTarget || !dropTarget) {
|
|
1240
1176
|
return;
|
|
1241
1177
|
}
|
|
1178
|
+
const dragTarget = this.dragTarget;
|
|
1242
1179
|
const newDefs = this.columnDefs.concat();
|
|
1243
1180
|
newDefs
|
|
1244
1181
|
.sort((a, b) => a.index - b.index)
|
|
1245
1182
|
.forEach((element, index) => {
|
|
1246
1183
|
element.index = index;
|
|
1247
1184
|
});
|
|
1248
|
-
const originalIndex = newDefs.findIndex((it) => it.id ===
|
|
1185
|
+
const originalIndex = newDefs.findIndex((it) => it.id === dragTarget.id);
|
|
1249
1186
|
if (originalIndex === -1) {
|
|
1250
|
-
console.warn("couldn't find target's original index");
|
|
1251
|
-
return
|
|
1187
|
+
console.warn("couldn't find target's original index", dragTarget);
|
|
1188
|
+
return;
|
|
1252
1189
|
}
|
|
1253
1190
|
newDefs.splice(originalIndex, 1);
|
|
1254
1191
|
const isDraggedToFirst = dropTarget.id === `${this.tableName}-column-settings-top-anchor` ||
|
|
@@ -1293,6 +1230,8 @@ export class TableContext {
|
|
|
1293
1230
|
// this.forceVisibilityUpdate();
|
|
1294
1231
|
};
|
|
1295
1232
|
copyHighlightedRowsToClipboard = async () => {
|
|
1233
|
+
// HACK clipboard does not exist in http environments
|
|
1234
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1296
1235
|
if (!navigator.clipboard) {
|
|
1297
1236
|
alert('cannot copy in an insecure connection');
|
|
1298
1237
|
return;
|
|
@@ -1300,6 +1239,8 @@ export class TableContext {
|
|
|
1300
1239
|
return this._performRowCopy(await this.getHighlightedRowData());
|
|
1301
1240
|
};
|
|
1302
1241
|
copyDataToClipboard = async () => {
|
|
1242
|
+
// HACK clipboard does not exist in http environments
|
|
1243
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1303
1244
|
if (!navigator.clipboard) {
|
|
1304
1245
|
alert('cannot copy in an insecure connection');
|
|
1305
1246
|
return;
|
|
@@ -1309,13 +1250,16 @@ export class TableContext {
|
|
|
1309
1250
|
_performRowCopy = async ({ items, indicesByItem, focusedElementData, affectedColumns }) => {
|
|
1310
1251
|
const focusedColumnIds = affectedColumns.map((it) => encapsulate(typeof it.header === 'string' ? it.header : it.id));
|
|
1311
1252
|
const value = await (async () => {
|
|
1253
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
1312
1254
|
const selectColumns = new Map();
|
|
1313
1255
|
for (let i = affectedColumns.length - 1; i > -1; i--) {
|
|
1314
1256
|
const columnDef = affectedColumns[i];
|
|
1315
1257
|
if (columnDef instanceof SelectDef) {
|
|
1316
1258
|
const item = items[i];
|
|
1317
|
-
|
|
1318
|
-
|
|
1259
|
+
const defOptions = indicesByItem.get(item);
|
|
1260
|
+
selectColumns.set(i, await (defOptions
|
|
1261
|
+
? (columnDef.getSpecificOptions?.(item, defOptions) ?? columnDef.getOptions())
|
|
1262
|
+
: columnDef.getOptions()));
|
|
1319
1263
|
}
|
|
1320
1264
|
}
|
|
1321
1265
|
const separator = this.commaSeparatedCopy ? ',' : '\t';
|
|
@@ -1325,7 +1269,7 @@ export class TableContext {
|
|
|
1325
1269
|
if (focusedElementData.length === 1 && focusedElementData[0].length === 1) {
|
|
1326
1270
|
if (selectColumns.has(0)) {
|
|
1327
1271
|
const columnOptions = selectColumns.get(0);
|
|
1328
|
-
const value = columnOptions
|
|
1272
|
+
const value = columnOptions?.find((it) => it.value === focusedElementData[0][0])?.label ??
|
|
1329
1273
|
focusedElementData[0][0]?.toString() ??
|
|
1330
1274
|
'';
|
|
1331
1275
|
return value;
|
|
@@ -1343,7 +1287,10 @@ export class TableContext {
|
|
|
1343
1287
|
}
|
|
1344
1288
|
if (selectColumns.has(i)) {
|
|
1345
1289
|
const columnOptions = selectColumns.get(i);
|
|
1346
|
-
|
|
1290
|
+
if (dev && !columnOptions) {
|
|
1291
|
+
console.warn(`could not find colum with index ${i}`);
|
|
1292
|
+
}
|
|
1293
|
+
const value = columnOptions?.find((it) => it.value === toCopy)?.label ??
|
|
1347
1294
|
toCopy?.toString() ??
|
|
1348
1295
|
'';
|
|
1349
1296
|
return encapsulate(value);
|
|
@@ -1356,7 +1303,7 @@ export class TableContext {
|
|
|
1356
1303
|
.join(separator))
|
|
1357
1304
|
.join('\n')}`;
|
|
1358
1305
|
})();
|
|
1359
|
-
navigator.clipboard.writeText(value
|
|
1306
|
+
navigator.clipboard.writeText(value).catch(devCatch);
|
|
1360
1307
|
};
|
|
1361
1308
|
startFocus = (coords) => {
|
|
1362
1309
|
this.isMousingDown = true;
|
|
@@ -1366,9 +1313,11 @@ export class TableContext {
|
|
|
1366
1313
|
this.focusStart = { ...coords };
|
|
1367
1314
|
this.focusEnd = { ...coords };
|
|
1368
1315
|
if (startEditing) {
|
|
1369
|
-
tick()
|
|
1316
|
+
tick()
|
|
1317
|
+
.then(() => {
|
|
1370
1318
|
this.focusStartIsBeingEdited = true;
|
|
1371
|
-
})
|
|
1319
|
+
})
|
|
1320
|
+
.catch(devCatch);
|
|
1372
1321
|
}
|
|
1373
1322
|
};
|
|
1374
1323
|
unfocus = () => {
|
|
@@ -1459,7 +1408,7 @@ export class TableContext {
|
|
|
1459
1408
|
return;
|
|
1460
1409
|
}
|
|
1461
1410
|
if (!this.focusEnd) {
|
|
1462
|
-
return
|
|
1411
|
+
return;
|
|
1463
1412
|
}
|
|
1464
1413
|
const visibility = this.columnVisibility;
|
|
1465
1414
|
const columnDefs = this.columnDefs;
|
|
@@ -1495,8 +1444,9 @@ export class TableContext {
|
|
|
1495
1444
|
if (!this.allowCopy) {
|
|
1496
1445
|
return;
|
|
1497
1446
|
}
|
|
1498
|
-
if (!this.focusEnd)
|
|
1499
|
-
return
|
|
1447
|
+
if (!this.focusEnd) {
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1500
1450
|
const current = this.focusEnd;
|
|
1501
1451
|
const visibility = this.columnVisibility;
|
|
1502
1452
|
const columnDefs = this.columnDefs;
|
|
@@ -1513,8 +1463,9 @@ export class TableContext {
|
|
|
1513
1463
|
this.focusEnd = current;
|
|
1514
1464
|
};
|
|
1515
1465
|
moveToEnd = () => {
|
|
1516
|
-
if (!this.focusStart)
|
|
1466
|
+
if (!this.focusStart) {
|
|
1517
1467
|
return;
|
|
1468
|
+
}
|
|
1518
1469
|
const visibility = this.columnVisibility;
|
|
1519
1470
|
const columnDefs = this.columnDefs;
|
|
1520
1471
|
const current = this.focusStart.column;
|
|
@@ -1556,22 +1507,21 @@ export class TableContext {
|
|
|
1556
1507
|
}
|
|
1557
1508
|
};
|
|
1558
1509
|
setFocusLeft = () => {
|
|
1559
|
-
if (!this.focusStart)
|
|
1510
|
+
if (!this.focusStart) {
|
|
1560
1511
|
return;
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
}
|
|
1571
|
-
--index;
|
|
1512
|
+
}
|
|
1513
|
+
const visibility = this.columnVisibility;
|
|
1514
|
+
const columnDefs = this.columnDefs;
|
|
1515
|
+
let index = this.focusStart.column - 1;
|
|
1516
|
+
while (index > -1) {
|
|
1517
|
+
const newId = columnDefs[index].id;
|
|
1518
|
+
if (newId && visibility[newId] !== false) {
|
|
1519
|
+
this.moveFocus({ ...this.focusStart, id: newId, column: index });
|
|
1520
|
+
return;
|
|
1572
1521
|
}
|
|
1573
|
-
|
|
1522
|
+
--index;
|
|
1574
1523
|
}
|
|
1524
|
+
//otherwise return without doing anything
|
|
1575
1525
|
};
|
|
1576
1526
|
moveFocusRight = () => {
|
|
1577
1527
|
if (!this.allowCopy) {
|
|
@@ -1593,23 +1543,22 @@ export class TableContext {
|
|
|
1593
1543
|
}
|
|
1594
1544
|
};
|
|
1595
1545
|
setFocusRight = () => {
|
|
1596
|
-
if (!this.focusStart)
|
|
1546
|
+
if (!this.focusStart) {
|
|
1597
1547
|
return;
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
}
|
|
1609
|
-
++index;
|
|
1548
|
+
}
|
|
1549
|
+
const visibility = this.columnVisibility;
|
|
1550
|
+
const columnDefs = this.columnDefs;
|
|
1551
|
+
const upperBounds = columnDefs.length;
|
|
1552
|
+
let index = this.focusStart.column + 1;
|
|
1553
|
+
while (index < upperBounds) {
|
|
1554
|
+
const newId = columnDefs[index].id;
|
|
1555
|
+
if (newId && visibility[newId] !== false) {
|
|
1556
|
+
this.moveFocus({ ...this.focusStart, id: newId, column: index });
|
|
1557
|
+
return;
|
|
1610
1558
|
}
|
|
1611
|
-
|
|
1559
|
+
++index;
|
|
1612
1560
|
}
|
|
1561
|
+
//otherwise return without doing anything
|
|
1613
1562
|
};
|
|
1614
1563
|
endFocus = (coords) => {
|
|
1615
1564
|
if (this.isMousingDown) {
|
|
@@ -1663,18 +1612,12 @@ export class TableContext {
|
|
|
1663
1612
|
// };
|
|
1664
1613
|
setSelectedPreset = (preset) => {
|
|
1665
1614
|
this.columnDefs = preset.columnDefs;
|
|
1666
|
-
if (
|
|
1667
|
-
|
|
1668
|
-
console.warn('no sorting state found');
|
|
1669
|
-
}
|
|
1670
|
-
this.paginationRepo?.updateSorting?.(preset.sortingState);
|
|
1671
|
-
}
|
|
1672
|
-
if (preset.visibilityState) {
|
|
1673
|
-
this.columnVisibility = preset.visibilityState;
|
|
1674
|
-
}
|
|
1675
|
-
if (preset.columnPinningState) {
|
|
1676
|
-
this.columnPinning = preset.columnPinningState;
|
|
1615
|
+
if (!this.paginationRepo?.updateSorting) {
|
|
1616
|
+
console.warn('no sorting state found');
|
|
1677
1617
|
}
|
|
1618
|
+
this.paginationRepo?.updateSorting?.(preset.sortingState);
|
|
1619
|
+
this.columnVisibility = preset.visibilityState;
|
|
1620
|
+
this.columnPinning = preset.columnPinningState;
|
|
1678
1621
|
this.selectedPreset = preset;
|
|
1679
1622
|
localStorage.setItem(`${this.userId}-${this.tableName}-selected-preset-name`, preset.name);
|
|
1680
1623
|
};
|
|
@@ -1685,7 +1628,7 @@ export class TableContext {
|
|
|
1685
1628
|
const visibilityState = this.columnVisibility;
|
|
1686
1629
|
const columnPinningState = this.columnPinning;
|
|
1687
1630
|
const columnDefs = this.columnDefs;
|
|
1688
|
-
const sortingState =
|
|
1631
|
+
const sortingState = this.paginationRepo?.sorting || [];
|
|
1689
1632
|
const newPreset = { columnDefs, name, visibilityState, columnPinningState, sortingState };
|
|
1690
1633
|
const lowercasePresetname = name.toLocaleLowerCase();
|
|
1691
1634
|
const indexToReplace = this.columnPresets.findIndex((oldPreset) => oldPreset.name.toLocaleLowerCase() === lowercasePresetname);
|
|
@@ -1721,12 +1664,9 @@ export class TableContext {
|
|
|
1721
1664
|
};
|
|
1722
1665
|
// #region private methods
|
|
1723
1666
|
createRow(item, index, unsortedIndex) {
|
|
1724
|
-
if (!item) {
|
|
1725
|
-
throw new Error(`No Item was found at index ${index} (unsorted index ${unsortedIndex})`);
|
|
1726
|
-
}
|
|
1727
1667
|
const row = {
|
|
1728
1668
|
getValue: async (key) => {
|
|
1729
|
-
const gotValue = this.columnDefsById.get(key)
|
|
1669
|
+
const gotValue = await this.columnDefsById.get(key)?.accessorFn?.(item, unsortedIndex);
|
|
1730
1670
|
if (gotValue !== undefined) {
|
|
1731
1671
|
return gotValue;
|
|
1732
1672
|
}
|
|
@@ -1775,10 +1715,13 @@ export class TableContext {
|
|
|
1775
1715
|
};
|
|
1776
1716
|
const makeCellFromId = (columnId) => {
|
|
1777
1717
|
const def = this.columnDefsById.get(columnId);
|
|
1718
|
+
if (!def) {
|
|
1719
|
+
throw new Error(`Could not make cell from id ${columnId}: Coloumn Def was not found`);
|
|
1720
|
+
}
|
|
1778
1721
|
return makeRow(def);
|
|
1779
1722
|
};
|
|
1780
|
-
const leftVisibleCells = $derived([...(this.columnPinning.left?.keys() ?? [])].map(makeCellFromId)
|
|
1781
|
-
const rightVisibleCells = $derived([...(this.columnPinning.right?.keys() ?? [])].map(makeCellFromId)
|
|
1723
|
+
const leftVisibleCells = $derived([...(this.columnPinning.left?.keys() ?? [])].map(makeCellFromId));
|
|
1724
|
+
const rightVisibleCells = $derived([...(this.columnPinning.right?.keys() ?? [])].map(makeCellFromId));
|
|
1782
1725
|
const centerVisibleCells = $derived(this.columnDefs
|
|
1783
1726
|
.filter((it) => {
|
|
1784
1727
|
return !(this.columnPinning.left?.has(it.id) || this.columnPinning.right?.has(it.id));
|
|
@@ -1787,9 +1730,6 @@ export class TableContext {
|
|
|
1787
1730
|
return row;
|
|
1788
1731
|
}
|
|
1789
1732
|
columnDefReturnsTextValue = (it) => {
|
|
1790
|
-
if (!this.dataRepo) {
|
|
1791
|
-
return false;
|
|
1792
|
-
}
|
|
1793
1733
|
return ('index' in it &&
|
|
1794
1734
|
this.columnVisibility[it.id] !== false &&
|
|
1795
1735
|
!uncopyableColumns.has(it.columnType));
|
|
@@ -1819,8 +1759,9 @@ export class TableContext {
|
|
|
1819
1759
|
console.warn('no focusEnd found');
|
|
1820
1760
|
return;
|
|
1821
1761
|
}
|
|
1762
|
+
const focusEnd = this.focusEnd;
|
|
1822
1763
|
const rows = this.paginationRowModel.rows;
|
|
1823
|
-
const endRowIndex = rows.findIndex((row) => row.visibleIndex ===
|
|
1764
|
+
const endRowIndex = rows.findIndex((row) => row.visibleIndex === focusEnd.row);
|
|
1824
1765
|
this.focusEnd = {
|
|
1825
1766
|
...this.focusEnd,
|
|
1826
1767
|
row: rows[Math.max(Math.min(endRowIndex + offset, rows.length - 1), 0)].visibleIndex
|
|
@@ -1829,11 +1770,12 @@ export class TableContext {
|
|
|
1829
1770
|
_moveFocusRow(offset) {
|
|
1830
1771
|
if (!this.focusStart) {
|
|
1831
1772
|
console.warn('no focusStart found');
|
|
1832
|
-
return
|
|
1773
|
+
return;
|
|
1833
1774
|
}
|
|
1775
|
+
const focusStart = this.focusStart;
|
|
1834
1776
|
const newEndRowIndex = (() => {
|
|
1835
1777
|
const rows = this.paginationRowModel.rows;
|
|
1836
|
-
const endRowIndex = rows.findIndex((row) => row.visibleIndex ===
|
|
1778
|
+
const endRowIndex = rows.findIndex((row) => row.visibleIndex === focusStart.row);
|
|
1837
1779
|
return rows[Math.max(Math.min(endRowIndex + offset, rows.length - 1), 0)].visibleIndex;
|
|
1838
1780
|
})();
|
|
1839
1781
|
this.moveFocus({ ...this.focusStart, row: newEndRowIndex });
|
|
@@ -1847,9 +1789,9 @@ export class TableContext {
|
|
|
1847
1789
|
const { row: startRowIndexId, column: startColumnIndex } = this.focusStart;
|
|
1848
1790
|
const { row: endRowIndexId, column: endColumnIndex } = this.focusEnd;
|
|
1849
1791
|
const model = this.sortedRowModel;
|
|
1850
|
-
const startRowIndex = model
|
|
1851
|
-
const endRowIndex = model
|
|
1852
|
-
if (
|
|
1792
|
+
const startRowIndex = model.rows.findIndex((row) => row.visibleIndex === startRowIndexId);
|
|
1793
|
+
const endRowIndex = model.rows.findIndex((row) => row.visibleIndex === endRowIndexId);
|
|
1794
|
+
if (startRowIndex == -1 || endRowIndex == -1) {
|
|
1853
1795
|
return;
|
|
1854
1796
|
}
|
|
1855
1797
|
const minRowIndex = Math.min(startRowIndex, endRowIndex);
|
|
@@ -1876,17 +1818,15 @@ export class TableContext {
|
|
|
1876
1818
|
this.focusedColumnIds = affectedColumns;
|
|
1877
1819
|
}
|
|
1878
1820
|
async getHighlightedRowData() {
|
|
1879
|
-
if (!this.dataRepo) {
|
|
1880
|
-
throw new Error('No data found');
|
|
1881
|
-
}
|
|
1882
1821
|
const affectedColumns = this.columnDefs.filter(this.columnDefReturnsTextValue);
|
|
1822
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
1883
1823
|
const indices = new Map();
|
|
1884
1824
|
const selectedRows = [...this.highlightedItems.values()];
|
|
1885
1825
|
for (const item of selectedRows) {
|
|
1886
1826
|
const rowIndex = this.sortedData.indexOf(item);
|
|
1887
1827
|
if (rowIndex == -1) {
|
|
1888
|
-
|
|
1889
|
-
|
|
1828
|
+
// eslint-disable-next-line no-debugger
|
|
1829
|
+
debugger;
|
|
1890
1830
|
}
|
|
1891
1831
|
indices.set(item, rowIndex);
|
|
1892
1832
|
}
|
|
@@ -1895,7 +1835,7 @@ export class TableContext {
|
|
|
1895
1835
|
const rowLength = selectedRows.length;
|
|
1896
1836
|
for (let rowIndex = 0; rowIndex < rowLength; rowIndex++) {
|
|
1897
1837
|
const item = selectedRows[rowIndex];
|
|
1898
|
-
const key = this.selectionExtractor
|
|
1838
|
+
const key = this.selectionExtractor(item);
|
|
1899
1839
|
selectedCells[rowIndex] = [];
|
|
1900
1840
|
const targetRow = selectedCells[rowIndex];
|
|
1901
1841
|
const colLength = affectedColumns.length;
|
|
@@ -1939,9 +1879,9 @@ export class TableContext {
|
|
|
1939
1879
|
const { row: endRowIndexId, column: endColumnIndex } = this.focusEnd;
|
|
1940
1880
|
// const model = this._currentPageData;
|
|
1941
1881
|
const model = this.paginationRowModel;
|
|
1942
|
-
const startRowIndex = model
|
|
1943
|
-
const endRowIndex = model
|
|
1944
|
-
if (!this._currentPageData
|
|
1882
|
+
const startRowIndex = model.rows.findIndex((row) => row.visibleIndex === startRowIndexId);
|
|
1883
|
+
const endRowIndex = model.rows.findIndex((row) => row.visibleIndex === endRowIndexId);
|
|
1884
|
+
if (!this._currentPageData.length || startRowIndex == -1 || endRowIndex == -1) {
|
|
1945
1885
|
throw new Error(`copy was missing one of the two indices. First: ${startRowIndex}, second: ${endRowIndex}`);
|
|
1946
1886
|
}
|
|
1947
1887
|
const minRowIndex = Math.min(startRowIndex, endRowIndex);
|
|
@@ -1968,7 +1908,7 @@ export class TableContext {
|
|
|
1968
1908
|
const rowLength = selectedRows.length;
|
|
1969
1909
|
for (let rowIndex = 0; rowIndex < rowLength; rowIndex++) {
|
|
1970
1910
|
const item = selectedRows[rowIndex];
|
|
1971
|
-
const key = this.selectionExtractor
|
|
1911
|
+
const key = this.selectionExtractor(item);
|
|
1972
1912
|
selectedCells[rowIndex] = [];
|
|
1973
1913
|
const targetRow = selectedCells[rowIndex];
|
|
1974
1914
|
const colLength = affectedColumns.length;
|
|
@@ -2006,6 +1946,7 @@ export class TableContext {
|
|
|
2006
1946
|
affectedColumns
|
|
2007
1947
|
};
|
|
2008
1948
|
}
|
|
1949
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
2009
1950
|
return { items: [], indicesByItem: new Map(), focusedElementData: [], affectedColumns: [] };
|
|
2010
1951
|
}
|
|
2011
1952
|
updateDefsBasedOnPinning = () => {
|
|
@@ -2033,6 +1974,7 @@ export class TableContext {
|
|
|
2033
1974
|
return allDefs;
|
|
2034
1975
|
};
|
|
2035
1976
|
assertNoDuplicateIds() {
|
|
1977
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
2036
1978
|
const foundIds = new Set();
|
|
2037
1979
|
this.defaultColumnDefs.defs.forEach((def) => {
|
|
2038
1980
|
if (foundIds.has(def.id)) {
|
|
@@ -2041,12 +1983,14 @@ export class TableContext {
|
|
|
2041
1983
|
foundIds.add(def.id);
|
|
2042
1984
|
});
|
|
2043
1985
|
}
|
|
1986
|
+
// FIXME
|
|
1987
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
2044
1988
|
async setupDefaultColumnDefs() {
|
|
2045
1989
|
// const helper = createColumnHelper<T>();
|
|
2046
1990
|
this.assertNoDuplicateIds();
|
|
2047
|
-
const adjustedDefsPromises = this.defaultColumnDefs.defs.map(
|
|
1991
|
+
const adjustedDefsPromises = this.defaultColumnDefs.defs.map((def) => {
|
|
2048
1992
|
if (def instanceof AccessorDef) {
|
|
2049
|
-
if (def.allowFiltering
|
|
1993
|
+
if (!def.allowFiltering) {
|
|
2050
1994
|
if (def.debug) {
|
|
2051
1995
|
console.log(`${def.id}: does not allow filtering`, def);
|
|
2052
1996
|
}
|
|
@@ -2103,7 +2047,7 @@ export class TableContext {
|
|
|
2103
2047
|
else if (
|
|
2104
2048
|
// this.paginationRepo?.paginationType == PaginationType.Local &&
|
|
2105
2049
|
!def.filterFn &&
|
|
2106
|
-
def.allowFiltering
|
|
2050
|
+
def.allowFiltering) {
|
|
2107
2051
|
if (def instanceof DisplayDef) {
|
|
2108
2052
|
if (def.debug) {
|
|
2109
2053
|
console.log(`${def.id}: is a display def`, def);
|
|
@@ -2168,7 +2112,7 @@ export class TableContext {
|
|
|
2168
2112
|
}
|
|
2169
2113
|
return def;
|
|
2170
2114
|
});
|
|
2171
|
-
const adjustedDefs =
|
|
2115
|
+
const adjustedDefs = adjustedDefsPromises
|
|
2172
2116
|
.sort((a, b) => a.index - b.index)
|
|
2173
2117
|
.map((def, index) => {
|
|
2174
2118
|
def.index = index;
|
|
@@ -2209,7 +2153,7 @@ export class TableContext {
|
|
|
2209
2153
|
left: new Map(this.columnPinning.left &&
|
|
2210
2154
|
this.columnDefs
|
|
2211
2155
|
.filter((col) => {
|
|
2212
|
-
this.columnPinning.left?.has(col.id);
|
|
2156
|
+
return this.columnPinning.left?.has(col.id);
|
|
2213
2157
|
})
|
|
2214
2158
|
.map((col, index) => [col.id, index])),
|
|
2215
2159
|
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
@@ -2219,7 +2163,7 @@ export class TableContext {
|
|
|
2219
2163
|
.map((col, index) => [col.id, index]))
|
|
2220
2164
|
}; // TODO
|
|
2221
2165
|
}
|
|
2222
|
-
getToggleSortingHandler = (def) => (
|
|
2166
|
+
getToggleSortingHandler = (def) => () => {
|
|
2223
2167
|
this.paginationRepo?.updateSorting?.((state) => {
|
|
2224
2168
|
const newState = state.concat();
|
|
2225
2169
|
const index = newState.findIndex((it) => it.id === def.id);
|
|
@@ -2241,6 +2185,8 @@ export class TableContext {
|
|
|
2241
2185
|
return newState;
|
|
2242
2186
|
});
|
|
2243
2187
|
};
|
|
2188
|
+
// FIXME
|
|
2189
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
2244
2190
|
async reassignDefsToPresets(presets) {
|
|
2245
2191
|
const adjustedDefs = this.columnDefs;
|
|
2246
2192
|
const asMap = columnDefsToMap(adjustedDefs);
|
|
@@ -2289,6 +2235,7 @@ function areDefsEquivalent(newColumnDefs, oldColumnDefs) {
|
|
|
2289
2235
|
});
|
|
2290
2236
|
}
|
|
2291
2237
|
function columnDefsToMap(defs) {
|
|
2238
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
2292
2239
|
const map = new Map();
|
|
2293
2240
|
defs.forEach((def) => {
|
|
2294
2241
|
map.set(def.id, def);
|
|
@@ -2309,8 +2256,8 @@ function encapsulate(value) {
|
|
|
2309
2256
|
}
|
|
2310
2257
|
function generateTableOptions(contextObj) {
|
|
2311
2258
|
const _pagination = $derived.by(() => {
|
|
2312
|
-
void contextObj.paginationRepo?.paginationState
|
|
2313
|
-
void contextObj.paginationRepo?.paginationState
|
|
2259
|
+
void contextObj.paginationRepo?.paginationState.pageSize;
|
|
2260
|
+
void contextObj.paginationRepo?.paginationState.pageIndex;
|
|
2314
2261
|
return contextObj.paginationRepo?.paginationState;
|
|
2315
2262
|
});
|
|
2316
2263
|
const makeHeader = (def) => {
|
|
@@ -2328,7 +2275,6 @@ function generateTableOptions(contextObj) {
|
|
|
2328
2275
|
});
|
|
2329
2276
|
let originalWidth = 0;
|
|
2330
2277
|
let mouseStartingPoint = 0;
|
|
2331
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2332
2278
|
function addOverrideResizeHandler(e) {
|
|
2333
2279
|
originalWidth = def.width;
|
|
2334
2280
|
mouseStartingPoint = e.clientX;
|
|
@@ -2339,7 +2285,7 @@ function generateTableOptions(contextObj) {
|
|
|
2339
2285
|
function onResize(e) {
|
|
2340
2286
|
def.width = originalWidth - (mouseStartingPoint - e.clientX);
|
|
2341
2287
|
}
|
|
2342
|
-
function removeOverrideResizeHandler(
|
|
2288
|
+
function removeOverrideResizeHandler() {
|
|
2343
2289
|
def.isResizing = false;
|
|
2344
2290
|
window.removeEventListener('mousemove', onResize);
|
|
2345
2291
|
}
|