@lowdefy/blocks-table 0.0.0-experimental-20260929110023
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/LICENSE +201 -0
- package/README.md +12 -0
- package/dist/blocks/Table/Table.js +25 -0
- package/dist/blocks/Table/Table.lazy.js +33 -0
- package/dist/blocks/Table/TableFallback.js +35 -0
- package/dist/blocks/Table/e2e.js +47 -0
- package/dist/blocks/Table/gallery.yaml +836 -0
- package/dist/blocks/Table/meta.js +964 -0
- package/dist/blocks/Table/tests/Table.e2e.yaml +434 -0
- package/dist/blocks/Table/tests/TableFeatures.e2e.yaml +291 -0
- package/dist/blocks/Table/tests/TableLinkTarget.e2e.yaml +25 -0
- package/dist/blocks/Table/tests/TableParity.e2e.yaml +101 -0
- package/dist/blocks/Table/tests/bulk.e2e.yaml +271 -0
- package/dist/blocks/Table/tests/deals.yaml +30 -0
- package/dist/blocks/Table/tests/deals_columns.yaml +37 -0
- package/dist/blocks/Table/tests/editing.e2e.yaml +501 -0
- package/dist/blocks/Table/tests/expandable.e2e.yaml +87 -0
- package/dist/blocks/Table/tests/filtering.e2e.yaml +251 -0
- package/dist/blocks/Table/tests/grouping.e2e.yaml +272 -0
- package/dist/blocks/Table/tests/grouping_deals.yaml +24 -0
- package/dist/blocks/Table/tests/grouping_deals_columns.yaml +32 -0
- package/dist/blocks/Table/tests/headerMenu.e2e.yaml +134 -0
- package/dist/blocks/Table/tests/parity_properties.yaml +144 -0
- package/dist/blocks/Table/tests/people.yaml +39 -0
- package/dist/blocks/Table/tests/people_columns.yaml +22 -0
- package/dist/blocks/Table/tests/polish.e2e.yaml +372 -0
- package/dist/blocks/Table/tests/server-mongodb.e2e.yaml +169 -0
- package/dist/blocks/Table/tests/server.e2e.yaml +267 -0
- package/dist/blocks/Table/tests/toolbar.e2e.yaml +140 -0
- package/dist/blocks/Table/tests/tree.e2e.yaml +245 -0
- package/dist/blocks/Table/tests/views.e2e.yaml +235 -0
- package/dist/blocks/TableInput/TableInput.js +24 -0
- package/dist/blocks/TableInput/TableInput.lazy.js +17 -0
- package/dist/blocks/TableInput/TableInputRoot.js +65 -0
- package/dist/blocks/TableInput/e2e.js +16 -0
- package/dist/blocks/TableInput/gallery.yaml +153 -0
- package/dist/blocks/TableInput/meta.js +93 -0
- package/dist/blocks/TableInput/tests/TableInput.e2e.yaml +272 -0
- package/dist/blocks.js +16 -0
- package/dist/core/Body.js +112 -0
- package/dist/core/Cell.js +86 -0
- package/dist/core/Chevron.js +32 -0
- package/dist/core/EmptyState.js +32 -0
- package/dist/core/Grid.js +219 -0
- package/dist/core/GroupHeaderRow.js +81 -0
- package/dist/core/HeaderCell.js +58 -0
- package/dist/core/HeaderRow.js +76 -0
- package/dist/core/HeaderTitle.js +49 -0
- package/dist/core/LazyCell.js +71 -0
- package/dist/core/LoadingRows.js +38 -0
- package/dist/core/RenderProbeContext.js +19 -0
- package/dist/core/Row.js +98 -0
- package/dist/core/SkeletonRow.js +42 -0
- package/dist/core/SummaryRow.js +86 -0
- package/dist/core/TableRoot.js +195 -0
- package/dist/core/aggregateShortLabels.js +25 -0
- package/dist/core/applyLayoutVars.js +22 -0
- package/dist/core/buildGroupSegments.js +36 -0
- package/dist/core/collectBodyOverlays.js +20 -0
- package/dist/core/collectCellLeads.js +21 -0
- package/dist/core/collectClaimedViewKeys.js +26 -0
- package/dist/core/collectGridHandlers.js +29 -0
- package/dist/core/collectHeaderParts.js +20 -0
- package/dist/core/collectRowRenderers.js +21 -0
- package/dist/core/collectSliceDefinitions.js +29 -0
- package/dist/core/computeLayout.js +133 -0
- package/dist/core/createAccessor.js +39 -0
- package/dist/core/createApi.js +86 -0
- package/dist/core/createCellActivity.js +47 -0
- package/dist/core/createColumnDefs.js +42 -0
- package/dist/core/createFeatureActions.js +24 -0
- package/dist/core/createFeatureSet.js +39 -0
- package/dist/core/createInitialState.js +63 -0
- package/dist/core/createKeyIndex.js +26 -0
- package/dist/core/createMethodStubs.js +30 -0
- package/dist/core/createSliceHandlers.js +26 -0
- package/dist/core/createStableCoreRowModel.js +91 -0
- package/dist/core/createTanstackFeatures.js +24 -0
- package/dist/core/createTextMeasure.js +106 -0
- package/dist/core/densityHeights.js +20 -0
- package/dist/core/deriveValue.js +53 -0
- package/dist/core/dispatchGridEvent.js +21 -0
- package/dist/core/distributeFlex.js +28 -0
- package/dist/core/getCellFit.js +34 -0
- package/dist/core/getHeaderCellProps.js +21 -0
- package/dist/core/getHeaderLevels.js +50 -0
- package/dist/core/getRecordCount.js +23 -0
- package/dist/core/getSummaryLabel.js +35 -0
- package/dist/core/getValueSignature.js +26 -0
- package/dist/core/isDataItem.js +21 -0
- package/dist/core/isDefaultViewColumns.js +36 -0
- package/dist/core/isRowEqual.js +40 -0
- package/dist/core/isSameSignature.js +19 -0
- package/dist/core/lazyCellTypes.js +33 -0
- package/dist/core/lazyComponent.js +30 -0
- package/dist/core/loadOptionalFeature.js +35 -0
- package/dist/core/normalizeViewColumn.js +29 -0
- package/dist/core/pickViewPart.js +23 -0
- package/dist/core/renderRegion.js +21 -0
- package/dist/core/resolveMountValue.js +31 -0
- package/dist/core/resolveViewColumns.js +65 -0
- package/dist/core/someColumnConfig.js +30 -0
- package/dist/core/stabilizeData.js +90 -0
- package/dist/core/table.css +557 -0
- package/dist/core/useFeatureData.js +35 -0
- package/dist/core/useFeatureFragments.js +55 -0
- package/dist/core/useFeatureItems.js +78 -0
- package/dist/core/useFeatureMethods.js +29 -0
- package/dist/core/useFeatureRows.js +36 -0
- package/dist/core/useFeatureSet.js +54 -0
- package/dist/core/useForeignKeys.js +38 -0
- package/dist/core/useGridFeatures.js +26 -0
- package/dist/core/useStableConfig.js +34 -0
- package/dist/core/useSummary.js +73 -0
- package/dist/core/useTableConfig.js +189 -0
- package/dist/core/useTableState.js +150 -0
- package/dist/core/useViewportSize.js +40 -0
- package/dist/e2e.js +16 -0
- package/dist/features/bulk/BulkBar.js +46 -0
- package/dist/features/bulk/bulk.css +57 -0
- package/dist/features/bulk/bulkFeature.js +28 -0
- package/dist/features/bulk/countSelection.js +27 -0
- package/dist/features/bulk/createSelectAllMatching.js +43 -0
- package/dist/features/bulk/useBulkBar.js +42 -0
- package/dist/features/clipboard/clipboardFeature.js +24 -0
- package/dist/features/clipboard/createPasteCells.js +61 -0
- package/dist/features/clipboard/getCopyText.js +57 -0
- package/dist/features/clipboard/handleCopyKeyDown.js +37 -0
- package/dist/features/clipboard/parseTsv.js +70 -0
- package/dist/features/clipboard/pasteFeature.js +26 -0
- package/dist/features/clipboard/planPaste.js +101 -0
- package/dist/features/clipboard/serializeTsv.js +25 -0
- package/dist/features/clipboard/usePasteListener.js +45 -0
- package/dist/features/columnManager/ColumnManager.js +253 -0
- package/dist/features/columnManager/ColumnManagerPopover.js +37 -0
- package/dist/features/columnManager/DragHandleIcon.js +39 -0
- package/dist/features/columnManager/LazyColumnManagerPopover.js +19 -0
- package/dist/features/columnManager/applyManagerRegions.js +43 -0
- package/dist/features/columnManager/boundaryIds.js +21 -0
- package/dist/features/columnManager/buildManagerSequence.js +38 -0
- package/dist/features/columnManager/columnManager.css +155 -0
- package/dist/features/columnManager/columnManagerFeature.js +37 -0
- package/dist/features/columnManager/createCloseColumnManager.js +21 -0
- package/dist/features/columnManager/createOpenColumnManager.js +21 -0
- package/dist/features/columnManager/createResetColumns.js +43 -0
- package/dist/features/columnManager/getColumnManagerMenuItems.js +26 -0
- package/dist/features/columnManager/getListRoom.js +31 -0
- package/dist/features/columnManager/getManagerEntries.js +31 -0
- package/dist/features/columnManager/moveSequenceEntry.js +25 -0
- package/dist/features/columnManager/sequenceToRegions.js +38 -0
- package/dist/features/columnManager/snapListHeight.js +35 -0
- package/dist/features/columnManager/updateScrollHints.js +23 -0
- package/dist/features/columnManager/useColumnManager.js +36 -0
- package/dist/features/density/densityFeature.js +39 -0
- package/dist/features/density/densityToValue.js +23 -0
- package/dist/features/density/getViewWrapColumn.js +53 -0
- package/dist/features/density/initDensity.js +27 -0
- package/dist/features/density/initWrap.js +23 -0
- package/dist/features/editing/AddRowButton.js +28 -0
- package/dist/features/editing/CellEditor.js +284 -0
- package/dist/features/editing/EditMarker.js +38 -0
- package/dist/features/editing/EditingLayer.js +148 -0
- package/dist/features/editing/RowControlsCell.js +89 -0
- package/dist/features/editing/RowControlsHeader.js +18 -0
- package/dist/features/editing/SelectedTag.js +33 -0
- package/dist/features/editing/addChangeRow.js +34 -0
- package/dist/features/editing/applyChangeUpdates.js +28 -0
- package/dist/features/editing/applyChanges.js +90 -0
- package/dist/features/editing/applyMoveOverlay.js +44 -0
- package/dist/features/editing/applyMoveToChanges.js +66 -0
- package/dist/features/editing/applyOverlay.js +41 -0
- package/dist/features/editing/coerceCellValue.js +187 -0
- package/dist/features/editing/collectRawColumns.js +38 -0
- package/dist/features/editing/computeEditTargets.js +108 -0
- package/dist/features/editing/computeRowMove.js +78 -0
- package/dist/features/editing/createAddRow.js +68 -0
- package/dist/features/editing/createCancelEdit.js +29 -0
- package/dist/features/editing/createCommitEdit.js +124 -0
- package/dist/features/editing/createDeleteRow.js +39 -0
- package/dist/features/editing/createEditSpecs.js +80 -0
- package/dist/features/editing/createEmptyChanges.js +23 -0
- package/dist/features/editing/createMoveRow.js +65 -0
- package/dist/features/editing/createNewRow.js +32 -0
- package/dist/features/editing/createResetChanges.js +29 -0
- package/dist/features/editing/createSaveCellEdit.js +113 -0
- package/dist/features/editing/createSaveRowMove.js +90 -0
- package/dist/features/editing/createStartEdit.js +57 -0
- package/dist/features/editing/createStepHistory.js +33 -0
- package/dist/features/editing/createUndoStack.js +67 -0
- package/dist/features/editing/createValueStore.js +34 -0
- package/dist/features/editing/createWriteCell.js +34 -0
- package/dist/features/editing/createWriteChanges.js +43 -0
- package/dist/features/editing/editing.css +223 -0
- package/dist/features/editing/editingFeature.js +66 -0
- package/dist/features/editing/findCellByKey.js +23 -0
- package/dist/features/editing/findInvalidCells.js +41 -0
- package/dist/features/editing/findNextEditableCell.js +54 -0
- package/dist/features/editing/focusCell.js +28 -0
- package/dist/features/editing/fromDateValue.js +29 -0
- package/dist/features/editing/fromEditorDraft.js +45 -0
- package/dist/features/editing/generateRowKey.js +25 -0
- package/dist/features/editing/getDataGap.js +28 -0
- package/dist/features/editing/getEditOptions.js +33 -0
- package/dist/features/editing/getEditorKind.js +36 -0
- package/dist/features/editing/getEventError.js +24 -0
- package/dist/features/editing/getKeyField.js +23 -0
- package/dist/features/editing/getReorderBlock.js +33 -0
- package/dist/features/editing/handleEditDoubleClick.js +34 -0
- package/dist/features/editing/handleEditKeyDown.js +123 -0
- package/dist/features/editing/handleRowControlsClick.js +29 -0
- package/dist/features/editing/handleRowDragPointerDown.js +95 -0
- package/dist/features/editing/isCellEditable.js +20 -0
- package/dist/features/editing/isPrintableKey.js +22 -0
- package/dist/features/editing/isSameTargets.js +19 -0
- package/dist/features/editing/matchOption.js +21 -0
- package/dist/features/editing/needsEditing.js +26 -0
- package/dist/features/editing/normalizeChanges.js +37 -0
- package/dist/features/editing/positionBetween.js +30 -0
- package/dist/features/editing/pruneOverlay.js +39 -0
- package/dist/features/editing/removeChangeRow.js +48 -0
- package/dist/features/editing/reorderByKeys.js +34 -0
- package/dist/features/editing/rowControlsColumn.js +33 -0
- package/dist/features/editing/setChangeField.js +72 -0
- package/dist/features/editing/setRowField.js +23 -0
- package/dist/features/editing/sortByPosition.js +31 -0
- package/dist/features/editing/toDateValue.js +38 -0
- package/dist/features/editing/toEditorDraft.js +56 -0
- package/dist/features/editing/toSelectOptions.js +39 -0
- package/dist/features/editing/useEditingData.js +199 -0
- package/dist/features/editing/useEditingFragments.js +77 -0
- package/dist/features/editing/useEditingGrid.js +25 -0
- package/dist/features/editing/validateCellValue.js +25 -0
- package/dist/features/editing/valuesEqual.js +31 -0
- package/dist/features/editing/warnMissingEvent.js +23 -0
- package/dist/features/events/createActivateRow.js +54 -0
- package/dist/features/events/eventsFeature.js +35 -0
- package/dist/features/events/getBodyTarget.js +27 -0
- package/dist/features/events/getRowIndex.js +24 -0
- package/dist/features/events/handleAuxClick.js +38 -0
- package/dist/features/events/handlePointerDown.js +22 -0
- package/dist/features/events/handleRowClick.js +57 -0
- package/dist/features/events/handleRowDoubleClick.js +45 -0
- package/dist/features/events/isTextDrag.js +30 -0
- package/dist/features/events/openRowLink.js +29 -0
- package/dist/features/expandable/DetailRow.js +57 -0
- package/dist/features/expandable/ExpandToggle.js +34 -0
- package/dist/features/expandable/expandable.css +40 -0
- package/dist/features/expandable/expandableFeature.js +34 -0
- package/dist/features/expandable/handleExpandClick.js +25 -0
- package/dist/features/expandable/needsExpandable.js +20 -0
- package/dist/features/expandable/normalizeExpandable.js +52 -0
- package/dist/features/expandable/useExpandableItems.js +101 -0
- package/dist/features/expansion/createToggleRowExpanded.js +52 -0
- package/dist/features/expansion/expansionFeature.js +31 -0
- package/dist/features/expansion/getExpandedIds.js +26 -0
- package/dist/features/expansion/initExpanded.js +22 -0
- package/dist/features/export/buildCsv.js +39 -0
- package/dist/features/export/createExportCsv.js +59 -0
- package/dist/features/export/exportFeature.js +25 -0
- package/dist/features/export/toCsvField.js +20 -0
- package/dist/features/filtering/ChoiceFilter.js +30 -0
- package/dist/features/filtering/CloseIcon.js +29 -0
- package/dist/features/filtering/ColumnFilter.js +192 -0
- package/dist/features/filtering/ColumnFilterPopover.js +38 -0
- package/dist/features/filtering/DateFilter.js +80 -0
- package/dist/features/filtering/DraftInput.js +37 -0
- package/dist/features/filtering/DraftInputNumber.js +36 -0
- package/dist/features/filtering/FilterBuilder.js +45 -0
- package/dist/features/filtering/FilterGroup.js +116 -0
- package/dist/features/filtering/FilterIcon.js +26 -0
- package/dist/features/filtering/FilterIndicator.js +40 -0
- package/dist/features/filtering/FilterLeaf.js +86 -0
- package/dist/features/filtering/LazyColumnFilterPopover.js +19 -0
- package/dist/features/filtering/LazyFilterBuilder.js +19 -0
- package/dist/features/filtering/NumberFilter.js +43 -0
- package/dist/features/filtering/OptionsFilter.js +72 -0
- package/dist/features/filtering/RelativeDateEditor.js +90 -0
- package/dist/features/filtering/TextFilter.js +51 -0
- package/dist/features/filtering/ValueEditor.js +210 -0
- package/dist/features/filtering/buildColumnFilter.js +95 -0
- package/dist/features/filtering/changeLeafOperator.js +46 -0
- package/dist/features/filtering/createApplyFiltering.js +78 -0
- package/dist/features/filtering/createClearFilters.js +24 -0
- package/dist/features/filtering/createCloseColumnFilter.js +28 -0
- package/dist/features/filtering/createConditionFilteredRowModel.js +40 -0
- package/dist/features/filtering/createDefaultLeaf.js +31 -0
- package/dist/features/filtering/createOpenColumnFilter.js +25 -0
- package/dist/features/filtering/createRowTest.js +32 -0
- package/dist/features/filtering/createSearchMatcher.js +35 -0
- package/dist/features/filtering/createSetFilter.js +27 -0
- package/dist/features/filtering/createSetSearch.js +29 -0
- package/dist/features/filtering/createUpdateColumnFilter.js +29 -0
- package/dist/features/filtering/defaultRelativeDate.js +20 -0
- package/dist/features/filtering/filterRowModel.js +66 -0
- package/dist/features/filtering/filtering.css +151 -0
- package/dist/features/filtering/filteringFeature.js +82 -0
- package/dist/features/filtering/filteringToValue.js +23 -0
- package/dist/features/filtering/formatFilterDate.js +24 -0
- package/dist/features/filtering/getColumnConditions.js +24 -0
- package/dist/features/filtering/getConditionKeys.js +31 -0
- package/dist/features/filtering/getDistinctOptions.js +52 -0
- package/dist/features/filtering/getFilterKind.js +37 -0
- package/dist/features/filtering/getFilterResultKey.js +26 -0
- package/dist/features/filtering/getFilterResults.js +53 -0
- package/dist/features/filtering/getFilteredKeys.js +31 -0
- package/dist/features/filtering/getFilteringHeaderProps.js +22 -0
- package/dist/features/filtering/getFilteringMenuItems.js +42 -0
- package/dist/features/filtering/getFilteringTableOptions.js +33 -0
- package/dist/features/filtering/getGroupOperator.js +23 -0
- package/dist/features/filtering/getOperatorLabel.js +50 -0
- package/dist/features/filtering/getPlainTitle.js +26 -0
- package/dist/features/filtering/getSearchColumns.js +23 -0
- package/dist/features/filtering/getSearchKey.js +19 -0
- package/dist/features/filtering/getSearchText.js +57 -0
- package/dist/features/filtering/getTopLevelConditions.js +25 -0
- package/dist/features/filtering/getValueShape.js +30 -0
- package/dist/features/filtering/handleFilterIndicatorClick.js +25 -0
- package/dist/features/filtering/initFilter.js +25 -0
- package/dist/features/filtering/initSearch.js +24 -0
- package/dist/features/filtering/isColumnCondition.js +22 -0
- package/dist/features/filtering/isCompleteLeaf.js +45 -0
- package/dist/features/filtering/isServerMode.js +21 -0
- package/dist/features/filtering/normalizeSearch.js +21 -0
- package/dist/features/filtering/parseColumnFilter.js +128 -0
- package/dist/features/filtering/parseFilterDate.js +24 -0
- package/dist/features/filtering/prepareFilterResult.js +63 -0
- package/dist/features/filtering/pruneCondition.js +35 -0
- package/dist/features/filtering/setColumnFilter.js +51 -0
- package/dist/features/filtering/textFilterOperators.js +26 -0
- package/dist/features/filtering/toRootGroup.js +34 -0
- package/dist/features/filtering/useDraft.js +65 -0
- package/dist/features/filtering/useFilteringState.js +32 -0
- package/dist/features/filtering/useSyncedState.js +45 -0
- package/dist/features/grouping/GroupCell.js +72 -0
- package/dist/features/grouping/GroupCheckbox.js +38 -0
- package/dist/features/grouping/GroupLabel.js +73 -0
- package/dist/features/grouping/GroupRow.js +103 -0
- package/dist/features/grouping/StickyGroupRow.js +136 -0
- package/dist/features/grouping/buildGroupTree.js +138 -0
- package/dist/features/grouping/buildStickyLevels.js +35 -0
- package/dist/features/grouping/countGroupSelection.js +26 -0
- package/dist/features/grouping/createAggregateColumns.js +38 -0
- package/dist/features/grouping/createCollapseAllGroups.js +26 -0
- package/dist/features/grouping/createExpandAllGroups.js +23 -0
- package/dist/features/grouping/createGroupLevels.js +46 -0
- package/dist/features/grouping/createSetCollapsedGroups.js +27 -0
- package/dist/features/grouping/createSetGroup.js +35 -0
- package/dist/features/grouping/createSetGroupKeys.js +27 -0
- package/dist/features/grouping/createToggleGroup.js +38 -0
- package/dist/features/grouping/createToggleGroupSelected.js +49 -0
- package/dist/features/grouping/findGroupIndices.js +25 -0
- package/dist/features/grouping/flattenGroups.js +58 -0
- package/dist/features/grouping/getGroupLabel.js +34 -0
- package/dist/features/grouping/getStickyGroups.js +60 -0
- package/dist/features/grouping/groupRowsFeature.js +57 -0
- package/dist/features/grouping/grouping.css +128 -0
- package/dist/features/grouping/groupingFeature.js +48 -0
- package/dist/features/grouping/groupingHeaderMenuItems.js +44 -0
- package/dist/features/grouping/groupingToValue.js +26 -0
- package/dist/features/grouping/handleGroupClick.js +51 -0
- package/dist/features/grouping/handleGroupKeyDown.js +60 -0
- package/dist/features/grouping/initAggregates.js +36 -0
- package/dist/features/grouping/initCollapsedGroups.js +29 -0
- package/dist/features/grouping/initGrouping.js +34 -0
- package/dist/features/grouping/needsGroupRows.js +23 -0
- package/dist/features/grouping/orderGroups.js +49 -0
- package/dist/features/grouping/resolveAggregates.js +29 -0
- package/dist/features/grouping/toGroupIdentity.js +24 -0
- package/dist/features/grouping/toGroupKeys.js +24 -0
- package/dist/features/grouping/useGrouping.js +91 -0
- package/dist/features/headerMenu/HeaderMenuDropdown.js +86 -0
- package/dist/features/headerMenu/HeaderMenuTrigger.js +44 -0
- package/dist/features/headerMenu/LazyHeaderMenuDropdown.js +19 -0
- package/dist/features/headerMenu/MenuIcon.js +38 -0
- package/dist/features/headerMenu/collectHeaderMenuItems.js +69 -0
- package/dist/features/headerMenu/createAutosizeColumn.js +35 -0
- package/dist/features/headerMenu/createCloseHeaderMenu.js +28 -0
- package/dist/features/headerMenu/createOpenHeaderMenu.js +30 -0
- package/dist/features/headerMenu/focusHeaderControl.js +31 -0
- package/dist/features/headerMenu/freezeColumns.js +31 -0
- package/dist/features/headerMenu/getChromeMenuItems.js +144 -0
- package/dist/features/headerMenu/getVisibleOrder.js +19 -0
- package/dist/features/headerMenu/handleHeaderButtonPointerDown.js +27 -0
- package/dist/features/headerMenu/handleHeaderMenuClick.js +26 -0
- package/dist/features/headerMenu/handleHeaderMenuKeyDown.js +28 -0
- package/dist/features/headerMenu/headerMenu.css +122 -0
- package/dist/features/headerMenu/headerMenuFeature.js +46 -0
- package/dist/features/headerMenu/measureColumnWidth.js +51 -0
- package/dist/features/headerMenu/pinColumn.js +27 -0
- package/dist/features/headerMenu/sectionOrder.js +25 -0
- package/dist/features/headerMenu/useHeaderMenuState.js +27 -0
- package/dist/features/index.js +149 -0
- package/dist/features/keyboard/findCellElement.js +21 -0
- package/dist/features/keyboard/getNextCell.js +74 -0
- package/dist/features/keyboard/handleGridFocus.js +31 -0
- package/dist/features/keyboard/handleGridKeyDown.js +72 -0
- package/dist/features/keyboard/isCellRendered.js +22 -0
- package/dist/features/keyboard/keyboardFeature.js +26 -0
- package/dist/features/keyboard/useKeyboard.js +84 -0
- package/dist/features/lazyCells/getBodyRowKey.js +19 -0
- package/dist/features/lazyCells/handlePointerLeave.js +21 -0
- package/dist/features/lazyCells/handlePointerOver.js +22 -0
- package/dist/features/lazyCells/handleRowBlur.js +22 -0
- package/dist/features/lazyCells/handleRowFocus.js +26 -0
- package/dist/features/lazyCells/lazyCellsFeature.js +33 -0
- package/dist/features/lazyCells/useFastScroll.js +57 -0
- package/dist/features/ordering/getColumnClientBounds.js +32 -0
- package/dist/features/ordering/handleReorderPointerDown.js +137 -0
- package/dist/features/ordering/initColumnOrder.js +18 -0
- package/dist/features/ordering/moveKeys.js +27 -0
- package/dist/features/ordering/orderingFeature.js +35 -0
- package/dist/features/pagination/TablePagination.js +31 -0
- package/dist/features/pagination/initPageSize.js +28 -0
- package/dist/features/pagination/paginationFeature.js +36 -0
- package/dist/features/pagination/paginationToValue.js +24 -0
- package/dist/features/pagination/usePager.js +32 -0
- package/dist/features/pagination/usePagination.js +58 -0
- package/dist/features/pinning/initColumnPinning.js +21 -0
- package/dist/features/pinning/pinningFeature.js +33 -0
- package/dist/features/pinning/pinningToViewColumn.js +24 -0
- package/dist/features/queue/createAfterRowAction.js +40 -0
- package/dist/features/queue/findNextRowId.js +26 -0
- package/dist/features/queue/findRowAction.js +77 -0
- package/dist/features/queue/handleRowActionKey.js +44 -0
- package/dist/features/queue/queueFeature.js +27 -0
- package/dist/features/selection/SelectAllHeader.js +40 -0
- package/dist/features/selection/SelectCell.js +30 -0
- package/dist/features/selection/countSelectedRows.js +31 -0
- package/dist/features/selection/createClearSelection.js +29 -0
- package/dist/features/selection/createToggleAllRowsSelected.js +60 -0
- package/dist/features/selection/createToggleRowSelected.js +86 -0
- package/dist/features/selection/getRawRowKey.js +23 -0
- package/dist/features/selection/getSelectAllExcept.js +23 -0
- package/dist/features/selection/getSelectAllState.js +42 -0
- package/dist/features/selection/handleSelectionClick.js +30 -0
- package/dist/features/selection/initRowSelection.js +36 -0
- package/dist/features/selection/initSelectionMode.js +19 -0
- package/dist/features/selection/initSelectionView.js +35 -0
- package/dist/features/selection/isSelectAllValue.js +19 -0
- package/dist/features/selection/isSelectionViewCurrent.js +22 -0
- package/dist/features/selection/notifySelectionChange.js +32 -0
- package/dist/features/selection/pruneRowSelection.js +26 -0
- package/dist/features/selection/selectionFeature.js +69 -0
- package/dist/features/selection/selectionToValue.js +48 -0
- package/dist/features/selection/useSelection.js +77 -0
- package/dist/features/serverData/buildServerItems.js +109 -0
- package/dist/features/serverData/createBlockCache.js +205 -0
- package/dist/features/serverData/createRefresh.js +23 -0
- package/dist/features/serverData/createServerStore.js +360 -0
- package/dist/features/serverData/getBlockRange.js +29 -0
- package/dist/features/serverData/getListKey.js +20 -0
- package/dist/features/serverData/getNeededBlocks.js +45 -0
- package/dist/features/serverData/needsServerData.js +20 -0
- package/dist/features/serverData/normalizeServerData.js +41 -0
- package/dist/features/serverData/pickServerView.js +43 -0
- package/dist/features/serverData/readFetchResult.js +36 -0
- package/dist/features/serverData/serverData.css +21 -0
- package/dist/features/serverData/serverDataFeature.js +38 -0
- package/dist/features/serverData/serverRangeFeature.js +22 -0
- package/dist/features/serverData/useServerData.js +48 -0
- package/dist/features/serverData/useServerItems.js +35 -0
- package/dist/features/serverData/useServerRange.js +35 -0
- package/dist/features/serverData/useServerView.js +70 -0
- package/dist/features/sizing/ResizeHandle.js +24 -0
- package/dist/features/sizing/handleResizePointerDown.js +66 -0
- package/dist/features/sizing/initColumnSizing.js +23 -0
- package/dist/features/sizing/sizingFeature.js +39 -0
- package/dist/features/sizing/sizingToViewColumn.js +24 -0
- package/dist/features/sorting/SortIndicator.js +37 -0
- package/dist/features/sorting/buildSortKeys.js +52 -0
- package/dist/features/sorting/collectSortKeys.js +30 -0
- package/dist/features/sorting/createClearSort.js +21 -0
- package/dist/features/sorting/createIndexSortedRowModel.js +33 -0
- package/dist/features/sorting/createSetSort.js +43 -0
- package/dist/features/sorting/createSortKeyCollector.js +59 -0
- package/dist/features/sorting/createToggleSort.js +42 -0
- package/dist/features/sorting/getCachedSortKeys.js +19 -0
- package/dist/features/sorting/getSortHeaderProps.js +25 -0
- package/dist/features/sorting/getSortKeys.js +38 -0
- package/dist/features/sorting/handleSortClick.js +27 -0
- package/dist/features/sorting/initSorting.js +37 -0
- package/dist/features/sorting/isNumericSortType.js +21 -0
- package/dist/features/sorting/prepareSortKeys.js +92 -0
- package/dist/features/sorting/rankSortKeys.js +33 -0
- package/dist/features/sorting/setCachedSortKeys.js +24 -0
- package/dist/features/sorting/sortInSlices.js +69 -0
- package/dist/features/sorting/sortIndices.js +40 -0
- package/dist/features/sorting/sortKeysCache.js +19 -0
- package/dist/features/sorting/sortRowModel.js +84 -0
- package/dist/features/sorting/sortingFeature.js +62 -0
- package/dist/features/sorting/sortingToValue.js +27 -0
- package/dist/features/sorting/toFloatSortKeys.js +24 -0
- package/dist/features/sorting/yieldToMain.js +27 -0
- package/dist/features/toolbar/ColumnTitle.js +28 -0
- package/dist/features/toolbar/DensityToggle.js +53 -0
- package/dist/features/toolbar/FilterButton.js +56 -0
- package/dist/features/toolbar/GroupButton.js +51 -0
- package/dist/features/toolbar/OptionsQuickFilter.js +72 -0
- package/dist/features/toolbar/QuickFilter.js +46 -0
- package/dist/features/toolbar/RecordCount.js +27 -0
- package/dist/features/toolbar/SaveViewAs.js +66 -0
- package/dist/features/toolbar/SortButton.js +94 -0
- package/dist/features/toolbar/Toolbar.js +88 -0
- package/dist/features/toolbar/ToolbarCount.js +25 -0
- package/dist/features/toolbar/ToolbarIcon.js +28 -0
- package/dist/features/toolbar/ToolbarList.js +100 -0
- package/dist/features/toolbar/ToolbarSearch.js +63 -0
- package/dist/features/toolbar/ViewActions.js +41 -0
- package/dist/features/toolbar/ViewTabLabel.js +39 -0
- package/dist/features/toolbar/ViewTabMenu.js +48 -0
- package/dist/features/toolbar/ViewTabs.js +44 -0
- package/dist/features/toolbar/countConditions.js +25 -0
- package/dist/features/toolbar/formatRecordCount.js +19 -0
- package/dist/features/toolbar/getQuickFilterValues.js +25 -0
- package/dist/features/toolbar/getRootConditions.js +25 -0
- package/dist/features/toolbar/handleToolbarKeyDown.js +28 -0
- package/dist/features/toolbar/isDefaultSorting.js +26 -0
- package/dist/features/toolbar/isQuickFilterLeaf.js +20 -0
- package/dist/features/toolbar/moveItem.js +25 -0
- package/dist/features/toolbar/needsToolbar.js +21 -0
- package/dist/features/toolbar/normalizeToolbar.js +61 -0
- package/dist/features/toolbar/setQuickFilterValues.js +35 -0
- package/dist/features/toolbar/toolbar.css +185 -0
- package/dist/features/toolbar/toolbarFeature.js +27 -0
- package/dist/features/toolbar/useToolbar.js +41 -0
- package/dist/features/toolbar/validateQuickFilters.js +28 -0
- package/dist/features/transactions/applyTransactionToRows.js +56 -0
- package/dist/features/transactions/createApplyTransaction.js +26 -0
- package/dist/features/transactions/normalizeTransaction.js +49 -0
- package/dist/features/transactions/transactionsFeature.js +24 -0
- package/dist/features/transactions/useTransactionData.js +44 -0
- package/dist/features/tree/TreeToggle.js +39 -0
- package/dist/features/tree/buildTreeIndex.js +60 -0
- package/dist/features/tree/buildTreeItems.js +96 -0
- package/dist/features/tree/flattenTreeData.js +45 -0
- package/dist/features/tree/getDescendantIds.js +28 -0
- package/dist/features/tree/handleTreeClick.js +25 -0
- package/dist/features/tree/handleTreeKeyDown.js +58 -0
- package/dist/features/tree/needsTree.js +20 -0
- package/dist/features/tree/normalizeTree.js +41 -0
- package/dist/features/tree/rowNeedsChildren.js +25 -0
- package/dist/features/tree/tree.css +55 -0
- package/dist/features/tree/treeFeature.js +35 -0
- package/dist/features/tree/useTreeData.js +33 -0
- package/dist/features/tree/useTreeItems.js +61 -0
- package/dist/features/views/compactView.js +30 -0
- package/dist/features/views/createViewsApi.js +74 -0
- package/dist/features/views/decodeViewParam.js +30 -0
- package/dist/features/views/encodeViewParam.js +25 -0
- package/dist/features/views/findActiveView.js +23 -0
- package/dist/features/views/getStorageKey.js +20 -0
- package/dist/features/views/getViewKey.js +27 -0
- package/dist/features/views/getViewSliceDeps.js +27 -0
- package/dist/features/views/isViewDirty.js +34 -0
- package/dist/features/views/mountViewValue.js +36 -0
- package/dist/features/views/needsViews.js +23 -0
- package/dist/features/views/normalizePersist.js +27 -0
- package/dist/features/views/normalizeViews.js +41 -0
- package/dist/features/views/notifyViewSelect.js +29 -0
- package/dist/features/views/readMountPayload.js +31 -0
- package/dist/features/views/readPersistedView.js +45 -0
- package/dist/features/views/sanitizePersistedView.js +49 -0
- package/dist/features/views/stableStringify.js +27 -0
- package/dist/features/views/useViews.js +136 -0
- package/dist/features/views/viewKeys.js +28 -0
- package/dist/features/views/viewsFeature.js +26 -0
- package/dist/features/views/writePersistedView.js +42 -0
- package/dist/features/virtualization/computeRowOffsets.js +29 -0
- package/dist/features/virtualization/computeWindow.js +92 -0
- package/dist/features/virtualization/createScrollToRow.js +36 -0
- package/dist/features/virtualization/firstIndexAbove.js +30 -0
- package/dist/features/virtualization/getMeasureKey.js +23 -0
- package/dist/features/virtualization/isMeasuredColumn.js +20 -0
- package/dist/features/virtualization/isSameRange.js +18 -0
- package/dist/features/virtualization/positionedRowsFeature.js +22 -0
- package/dist/features/virtualization/scrollToCell.js +49 -0
- package/dist/features/virtualization/shiftRowOffsets.js +35 -0
- package/dist/features/virtualization/usePositionedRows.js +37 -0
- package/dist/features/virtualization/useRowOffsets.js +123 -0
- package/dist/features/virtualization/useScrollWindow.js +114 -0
- package/dist/features/virtualization/useTanstackRowWindow.js +43 -0
- package/dist/features/virtualization/useVirtualization.js +64 -0
- package/dist/features/virtualization/virtualizationFeature.js +24 -0
- package/dist/features/virtualization/writeScrollEdges.js +33 -0
- package/dist/features/visibility/initColumnVisibility.js +22 -0
- package/dist/features/visibility/visibilityFeature.js +31 -0
- package/dist/features/visibility/visibilityToViewColumn.js +20 -0
- package/dist/metas.js +16 -0
- package/dist/types.js +17 -0
- package/package.json +91 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import createAddRow from './createAddRow.js';
|
|
16
|
+
import createCancelEdit from './createCancelEdit.js';
|
|
17
|
+
import createCommitEdit from './createCommitEdit.js';
|
|
18
|
+
import createDeleteRow from './createDeleteRow.js';
|
|
19
|
+
import createMoveRow from './createMoveRow.js';
|
|
20
|
+
import createResetChanges from './createResetChanges.js';
|
|
21
|
+
import createSaveCellEdit from './createSaveCellEdit.js';
|
|
22
|
+
import createSaveRowMove from './createSaveRowMove.js';
|
|
23
|
+
import createStartEdit from './createStartEdit.js';
|
|
24
|
+
import createStepHistory from './createStepHistory.js';
|
|
25
|
+
import createWriteCell from './createWriteCell.js';
|
|
26
|
+
import createWriteChanges from './createWriteChanges.js';
|
|
27
|
+
import handleEditDoubleClick from './handleEditDoubleClick.js';
|
|
28
|
+
import handleEditKeyDown from './handleEditKeyDown.js';
|
|
29
|
+
import handleRowControlsClick from './handleRowControlsClick.js';
|
|
30
|
+
import handleRowDragPointerDown from './handleRowDragPointerDown.js';
|
|
31
|
+
import useEditingData from './useEditingData.js';
|
|
32
|
+
import useEditingFragments from './useEditingFragments.js';
|
|
33
|
+
import useEditingGrid from './useEditingGrid.js';
|
|
34
|
+
// Cell editing (D8) and row reorder for Table and TableInput. Table edits and moves are events:
|
|
35
|
+
// onCellEdit / onRowMove are awaited while the table shows the change optimistically (keyed by
|
|
36
|
+
// row key, never by writing `data`). TableInput records edits, added and deleted rows and moves
|
|
37
|
+
// in its value, a changeset over `data`, with undo/redo. Placed before selection, keyboard and
|
|
38
|
+
// events: its keys (Enter, F2, typing) and double-click win over row activation, and clicks on
|
|
39
|
+
// the row controls never select.
|
|
40
|
+
const editingFeature = {
|
|
41
|
+
name: 'editing',
|
|
42
|
+
useRows: useEditingData,
|
|
43
|
+
useFeature: useEditingFragments,
|
|
44
|
+
useGridFeature: useEditingGrid,
|
|
45
|
+
actions: {
|
|
46
|
+
addRow: createAddRow,
|
|
47
|
+
cancelEdit: createCancelEdit,
|
|
48
|
+
commitEdit: createCommitEdit,
|
|
49
|
+
deleteRow: createDeleteRow,
|
|
50
|
+
moveRow: createMoveRow,
|
|
51
|
+
resetChanges: createResetChanges,
|
|
52
|
+
saveCellEdit: createSaveCellEdit,
|
|
53
|
+
saveRowMove: createSaveRowMove,
|
|
54
|
+
startEdit: createStartEdit,
|
|
55
|
+
stepHistory: createStepHistory,
|
|
56
|
+
writeCell: createWriteCell,
|
|
57
|
+
writeChanges: createWriteChanges
|
|
58
|
+
},
|
|
59
|
+
gridHandlers: {
|
|
60
|
+
click: handleRowControlsClick,
|
|
61
|
+
dblclick: handleEditDoubleClick,
|
|
62
|
+
keydown: handleEditKeyDown,
|
|
63
|
+
pointerdown: handleRowDragPointerDown
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export default editingFeature;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ // The rendered body cell of a row (by row id, which is the row key as a string) and column, or
|
|
16
|
+
// null when it is outside the rendered window. Editing addresses cells by key, never by display
|
|
17
|
+
// index, so a sort or a new row between two renders cannot retarget an edit.
|
|
18
|
+
function findCellByKey({ api, rowId, colKey }) {
|
|
19
|
+
const scroller = api.scrollerRef.current;
|
|
20
|
+
if (!scroller) return null;
|
|
21
|
+
return scroller.querySelector(`.lf-table-body [data-row-key="${CSS.escape(rowId)}"] [data-lf-cell][data-col-key="${CSS.escape(colKey)}"]`);
|
|
22
|
+
}
|
|
23
|
+
export default findCellByKey;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { get } from '@lowdefy/helpers';
|
|
16
|
+
import validateCellValue from './validateCellValue.js';
|
|
17
|
+
const EMPTY = new Map();
|
|
18
|
+
// TableInput's inline validation: every cell whose value fails its column's `required` or
|
|
19
|
+
// `validate`, as rowKey -> (columnKey -> message). Only columns with checks are visited.
|
|
20
|
+
function findInvalidCells({ rows, specs, getKey }) {
|
|
21
|
+
const checked = [
|
|
22
|
+
...specs.values()
|
|
23
|
+
].filter((spec)=>spec.required || spec.validate.length > 0);
|
|
24
|
+
if (checked.length === 0) return EMPTY;
|
|
25
|
+
const invalid = new Map();
|
|
26
|
+
rows.forEach((row)=>{
|
|
27
|
+
checked.forEach((spec)=>{
|
|
28
|
+
const message = validateCellValue({
|
|
29
|
+
spec,
|
|
30
|
+
row,
|
|
31
|
+
value: get(row, spec.field)
|
|
32
|
+
});
|
|
33
|
+
if (message === null) return;
|
|
34
|
+
const key = String(getKey(row));
|
|
35
|
+
if (!invalid.has(key)) invalid.set(key, new Map());
|
|
36
|
+
invalid.get(key).set(spec.key, message);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
return invalid;
|
|
40
|
+
}
|
|
41
|
+
export default findInvalidCells;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import isCellEditable from './isCellEditable.js';
|
|
16
|
+
import isDataItem from '../../core/isDataItem.js';
|
|
17
|
+
// Tab / Shift+Tab from an editor: the next editable cell in display order, along the row and
|
|
18
|
+
// then on to the next row (the previous one for -1). Row-level `editable.when` is tested per
|
|
19
|
+
// row. Returns { rowIndex, colIndex, rowId, colKey } or null at the end of the table.
|
|
20
|
+
function findNextEditableCell({ rows, cols, specs, rowIndex, colIndex, direction }) {
|
|
21
|
+
let r = rowIndex;
|
|
22
|
+
let c = colIndex;
|
|
23
|
+
const total = rows.length * cols.length;
|
|
24
|
+
for(let step = 0; step < total; step++){
|
|
25
|
+
c += direction;
|
|
26
|
+
if (c >= cols.length) {
|
|
27
|
+
c = 0;
|
|
28
|
+
r += 1;
|
|
29
|
+
} else if (c < 0) {
|
|
30
|
+
c = cols.length - 1;
|
|
31
|
+
r -= 1;
|
|
32
|
+
}
|
|
33
|
+
if (r < 0 || r >= rows.length) return null;
|
|
34
|
+
const col = cols[c];
|
|
35
|
+
if (col.special) continue;
|
|
36
|
+
const row = rows[r];
|
|
37
|
+
if (!isDataItem(row)) continue;
|
|
38
|
+
const spec = specs.get(col.key);
|
|
39
|
+
if (isCellEditable({
|
|
40
|
+
spec,
|
|
41
|
+
row: row.original,
|
|
42
|
+
value: col.accessor(row.original)
|
|
43
|
+
})) {
|
|
44
|
+
return {
|
|
45
|
+
rowIndex: r,
|
|
46
|
+
colIndex: c,
|
|
47
|
+
rowId: row.id,
|
|
48
|
+
colKey: col.key
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
export default findNextEditableCell;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import findCellByKey from './findCellByKey.js';
|
|
16
|
+
// Returns keyboard focus to a cell after its editor closes; the keyboard feature's focus handler
|
|
17
|
+
// makes it the active cell again, so arrows continue from where the edit was.
|
|
18
|
+
function focusCell({ api, rowId, colKey }) {
|
|
19
|
+
const cell = findCellByKey({
|
|
20
|
+
api,
|
|
21
|
+
rowId,
|
|
22
|
+
colKey
|
|
23
|
+
});
|
|
24
|
+
cell?.focus({
|
|
25
|
+
preventScroll: true
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export default focusCell;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import dayjs from 'dayjs';
|
|
16
|
+
import utc from 'dayjs/plugin/utc.js';
|
|
17
|
+
import { type } from '@lowdefy/helpers';
|
|
18
|
+
dayjs.extend(utc);
|
|
19
|
+
// The picker value for a stored date. A `date` Date is read as its UTC calendar day (see
|
|
20
|
+
// toDateValue), shown as that day in the browser's zone so the picker highlights the right day.
|
|
21
|
+
function fromDateValue({ value, kind }) {
|
|
22
|
+
if (type.isNone(value) || value === '') return null;
|
|
23
|
+
if (kind === 'date' && type.isDate(value)) {
|
|
24
|
+
return dayjs(dayjs.utc(value).format('YYYY-MM-DD'));
|
|
25
|
+
}
|
|
26
|
+
const parsed = dayjs(value);
|
|
27
|
+
return parsed.isValid() ? parsed : null;
|
|
28
|
+
}
|
|
29
|
+
export default fromDateValue;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
import toDateValue from './toDateValue.js';
|
|
17
|
+
// The cell value an editor's draft commits (the inverse of toEditorDraft).
|
|
18
|
+
function fromEditorDraft({ spec, draft, previous }) {
|
|
19
|
+
switch(spec.kind){
|
|
20
|
+
case 'text':
|
|
21
|
+
return type.isNone(draft) ? '' : String(draft);
|
|
22
|
+
case 'number':
|
|
23
|
+
if (type.isNone(draft) || draft === '') return null;
|
|
24
|
+
if (spec.type === 'percent') return Math.round(Number(draft) / 100 * 1e10) / 1e10;
|
|
25
|
+
return Number(draft);
|
|
26
|
+
case 'date':
|
|
27
|
+
case 'datetime':
|
|
28
|
+
return toDateValue({
|
|
29
|
+
date: draft,
|
|
30
|
+
kind: spec.kind,
|
|
31
|
+
previous
|
|
32
|
+
});
|
|
33
|
+
case 'boolean':
|
|
34
|
+
return draft === true;
|
|
35
|
+
case 'select':
|
|
36
|
+
return type.isNone(draft) ? null : draft;
|
|
37
|
+
case 'multiSelect':
|
|
38
|
+
return type.isArray(draft) ? draft : [];
|
|
39
|
+
case 'rating':
|
|
40
|
+
return type.isNone(draft) ? null : Number(draft);
|
|
41
|
+
default:
|
|
42
|
+
return draft;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export default fromEditorDraft;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ let counter = 0;
|
|
16
|
+
// A key for a row added in the browser. It only has to be unique within the table's value;
|
|
17
|
+
// crypto.randomUUID is missing on insecure origins (plain http on a LAN address).
|
|
18
|
+
function generateRowKey() {
|
|
19
|
+
if (typeof window.crypto?.randomUUID === 'function') {
|
|
20
|
+
return window.crypto.randomUUID();
|
|
21
|
+
}
|
|
22
|
+
counter += 1;
|
|
23
|
+
return `row_${Date.now().toString(36)}_${counter.toString(36)}`;
|
|
24
|
+
}
|
|
25
|
+
export default generateRowKey;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import isDataItem from '../../core/isDataItem.js';
|
|
16
|
+
// A drop gap in the displayed list (`api.rows`: the current page, detail rows included) as a gap
|
|
17
|
+
// in every data row in display order (`api.dataRows`): the index of the first data row at or
|
|
18
|
+
// after it, or one past the last data row before it. A gap stays within the page, so a row
|
|
19
|
+
// dragged (or moved with the keys) past the page's edge lands at that edge.
|
|
20
|
+
function getDataGap({ api, gap }) {
|
|
21
|
+
const clamped = Math.min(Math.max(gap, 0), api.rows.length);
|
|
22
|
+
const next = api.rows.slice(clamped).find(isDataItem);
|
|
23
|
+
if (next !== undefined) return api.dataRows.findIndex((row)=>row.id === next.id);
|
|
24
|
+
const previous = api.rows.slice(0, clamped).findLast(isDataItem);
|
|
25
|
+
if (previous !== undefined) return api.dataRows.findIndex((row)=>row.id === previous.id) + 1;
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
export default getDataGap;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
function getPositionField(rowDrag) {
|
|
17
|
+
if (!type.isObject(rowDrag)) return null;
|
|
18
|
+
return type.isString(rowDrag.positionField) ? rowDrag.positionField : null;
|
|
19
|
+
}
|
|
20
|
+
// The row-level editing options. Row drag works on both blocks (Table saves a move through
|
|
21
|
+
// onRowMove, TableInput records it in its changeset); adding and deleting rows is TableInput's.
|
|
22
|
+
function getEditOptions({ input, properties }) {
|
|
23
|
+
const rowDrag = properties.rowDrag === true || type.isObject(properties.rowDrag);
|
|
24
|
+
return {
|
|
25
|
+
addRow: Boolean(input) && properties.addRow === true,
|
|
26
|
+
addRowText: type.isString(properties.addRowText) ? properties.addRowText : null,
|
|
27
|
+
deleteButton: Boolean(input) && properties.rowActions?.delete === true,
|
|
28
|
+
deleteRows: Boolean(input) && properties.deleteRows === true,
|
|
29
|
+
positionField: rowDrag ? getPositionField(properties.rowDrag) : null,
|
|
30
|
+
rowDrag
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export default getEditOptions;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ // The editor a cell type edits with (D8). Types without an editor (link, people, relation, json,
|
|
16
|
+
// image, html, progress, avatar, buttons, menu) are never editable, even with `editable: true`.
|
|
17
|
+
const EDITOR_KINDS = {
|
|
18
|
+
text: 'text',
|
|
19
|
+
email: 'text',
|
|
20
|
+
phone: 'text',
|
|
21
|
+
url: 'text',
|
|
22
|
+
number: 'number',
|
|
23
|
+
currency: 'number',
|
|
24
|
+
percent: 'number',
|
|
25
|
+
date: 'date',
|
|
26
|
+
datetime: 'datetime',
|
|
27
|
+
boolean: 'boolean',
|
|
28
|
+
tag: 'select',
|
|
29
|
+
status: 'select',
|
|
30
|
+
tags: 'multiSelect',
|
|
31
|
+
rating: 'rating'
|
|
32
|
+
};
|
|
33
|
+
function getEditorKind(cellType) {
|
|
34
|
+
return EDITOR_KINDS[cellType] ?? null;
|
|
35
|
+
}
|
|
36
|
+
export default getEditorKind;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ const FALLBACK_MESSAGE = 'The change was not saved.';
|
|
16
|
+
// The failure message of a `triggerEvent` result, or null when the event succeeded. A failed
|
|
17
|
+
// action chain resolves (it does not reject) with `success: false` and `error` holding the thrown
|
|
18
|
+
// `{ error, action, index }`; the message the user should see is that inner error's. A bounced
|
|
19
|
+
// (debounced) event is not a failure: a later trigger carries the change.
|
|
20
|
+
function getEventError(result) {
|
|
21
|
+
if (result?.success !== false) return null;
|
|
22
|
+
return result.error?.error?.message ?? result.error?.message ?? FALLBACK_MESSAGE;
|
|
23
|
+
}
|
|
24
|
+
export default getEventError;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { get, type } from '@lowdefy/helpers';
|
|
16
|
+
// The field that holds a row's key, where an added row shows its temporary key: `rowKey`, else
|
|
17
|
+
// the default key field the data uses (`_id` before `id`, as the row key getter reads them).
|
|
18
|
+
function getKeyField({ rowKey, rows }) {
|
|
19
|
+
if (type.isString(rowKey)) return rowKey;
|
|
20
|
+
if ((rows ?? []).some((row)=>!type.isNone(get(row, '_id')))) return '_id';
|
|
21
|
+
return 'id';
|
|
22
|
+
}
|
|
23
|
+
export default getKeyField;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ // Why rows cannot be reordered right now, or null when they can. A move is placed between the
|
|
16
|
+
// row's display neighbours, which are its neighbours in the saved order only while the table
|
|
17
|
+
// shows the data order: no grouping, no client filter, and no sort except ascending by the
|
|
18
|
+
// position field itself.
|
|
19
|
+
function getReorderBlock({ config, data, positionField, state, table }) {
|
|
20
|
+
// Server rows and tree rows have no single saved order the display neighbours come from.
|
|
21
|
+
if (config.server) return 'Rows cannot be reordered in server mode.';
|
|
22
|
+
if (config.tree) return 'Rows cannot be reordered in a tree.';
|
|
23
|
+
if ((state.grouping?.length ?? 0) > 0) return 'Rows cannot be reordered while grouped.';
|
|
24
|
+
if (table.getRowModel().rows.length !== data.length) {
|
|
25
|
+
return 'Clear the filter to reorder rows.';
|
|
26
|
+
}
|
|
27
|
+
const sorting = state.sorting ?? [];
|
|
28
|
+
if (sorting.length === 0) return null;
|
|
29
|
+
const positionColumn = positionField ? config.columns.find((column)=>column.field === positionField) : null;
|
|
30
|
+
const byPosition = Boolean(positionColumn) && sorting.length === 1 && sorting[0].id === positionColumn.key && sorting[0].desc !== true;
|
|
31
|
+
return byPosition ? null : 'Clear the sort to reorder rows.';
|
|
32
|
+
}
|
|
33
|
+
export default getReorderBlock;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import isControlTarget from '@lowdefy/blocks-antd/table/isControlTarget.js';
|
|
16
|
+
// Double-click on an editable cell opens its editor; the double-click is the edit's, not
|
|
17
|
+
// onRowDoubleClick's. Double-clicks inside an open editor (selecting a word) stay the editor's.
|
|
18
|
+
function handleEditDoubleClick(event, api) {
|
|
19
|
+
if (!api.editing?.enabled) return false;
|
|
20
|
+
if (event.target.closest('[data-lf-editor]')) return true;
|
|
21
|
+
const cell = event.target.closest('[data-lf-cell]');
|
|
22
|
+
if (!cell || !api.contains(cell) || cell.dataset.special) return false;
|
|
23
|
+
const rowElement = cell.closest('[data-row-key]');
|
|
24
|
+
if (!rowElement) return false;
|
|
25
|
+
if (isControlTarget({
|
|
26
|
+
target: event.target,
|
|
27
|
+
container: cell
|
|
28
|
+
})) return false;
|
|
29
|
+
return api.actions.startEdit({
|
|
30
|
+
rowId: rowElement.dataset.rowKey,
|
|
31
|
+
colKey: cell.dataset.colKey
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export default handleEditDoubleClick;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import isPrintableKey from './isPrintableKey.js';
|
|
16
|
+
import { ROW_CONTROLS_SPECIAL } from './rowControlsColumn.js';
|
|
17
|
+
function handleInputKeys({ event, api, rowElement, rowIndex, cell }) {
|
|
18
|
+
const modified = event.ctrlKey || event.metaKey;
|
|
19
|
+
const key = event.key.toLowerCase();
|
|
20
|
+
if (modified && key === 'z') {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
api.actions.stepHistory({
|
|
23
|
+
direction: event.shiftKey ? 'redo' : 'undo'
|
|
24
|
+
});
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
if (event.ctrlKey && !event.metaKey && key === 'y') {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
api.actions.stepHistory({
|
|
30
|
+
direction: 'redo'
|
|
31
|
+
});
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
if (!modified && api.editing.options.deleteRows && (event.key === 'Delete' || event.key === 'Backspace')) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
const col = Number(cell.dataset.colIndex);
|
|
37
|
+
if (api.actions.deleteRow({
|
|
38
|
+
rowId: rowElement.dataset.rowKey
|
|
39
|
+
})) {
|
|
40
|
+
api.keyboard?.moveTo({
|
|
41
|
+
row: rowIndex,
|
|
42
|
+
col
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
// Alt+Shift+ArrowUp/Down moves the focused row one place (`rowDrag`), the keyboard way to drag;
|
|
50
|
+
// focus stays on the moved row.
|
|
51
|
+
function handleMoveKeys({ event, api, rowElement, rowIndex, cell }) {
|
|
52
|
+
if (!api.editing.options.rowDrag || !event.altKey || !event.shiftKey) return false;
|
|
53
|
+
if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return false;
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
const up = event.key === 'ArrowUp';
|
|
56
|
+
const gap = up ? rowIndex - 1 : rowIndex + 2;
|
|
57
|
+
const move = api.actions.moveRow({
|
|
58
|
+
rowId: rowElement.dataset.rowKey,
|
|
59
|
+
gap
|
|
60
|
+
});
|
|
61
|
+
// The move's indices are in the whole list; the row moved one place in the display.
|
|
62
|
+
if (move) {
|
|
63
|
+
api.keyboard?.moveTo({
|
|
64
|
+
row: up ? rowIndex - 1 : rowIndex + 1,
|
|
65
|
+
col: Number(cell.dataset.colIndex)
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
// Keys on a focused cell (not inside an open editor, whose own handler keeps its keys): Enter or
|
|
71
|
+
// F2 opens the editor, a printable key opens it seeded with that character (D8, D11). With
|
|
72
|
+
// `rowDrag`, Alt+Shift+Arrow moves the row. TableInput adds undo/redo and, with `deleteRows`,
|
|
73
|
+
// Delete on a focused row. Runs before the keyboard feature, so Enter on an editable cell edits
|
|
74
|
+
// instead of activating the row.
|
|
75
|
+
function handleEditKeyDown(event, api) {
|
|
76
|
+
if (!api.editing?.enabled || !api.editing.layer) return false;
|
|
77
|
+
const cell = event.target.closest('[data-lf-cell]');
|
|
78
|
+
if (!cell || !api.contains(cell) || event.target !== cell) return false;
|
|
79
|
+
const rowElement = cell.closest('[data-row-index]');
|
|
80
|
+
const rowIndex = Number(rowElement.dataset.rowIndex);
|
|
81
|
+
if (rowIndex < 0) {
|
|
82
|
+
// The row controls header has nothing to activate (and no column to sort).
|
|
83
|
+
if (cell.dataset.special !== ROW_CONTROLS_SPECIAL) return false;
|
|
84
|
+
return event.key === 'Enter' || event.key === ' ';
|
|
85
|
+
}
|
|
86
|
+
if (handleMoveKeys({
|
|
87
|
+
event,
|
|
88
|
+
api,
|
|
89
|
+
rowElement,
|
|
90
|
+
rowIndex,
|
|
91
|
+
cell
|
|
92
|
+
})) return true;
|
|
93
|
+
if (api.editing.input && handleInputKeys({
|
|
94
|
+
event,
|
|
95
|
+
api,
|
|
96
|
+
rowElement,
|
|
97
|
+
rowIndex,
|
|
98
|
+
cell
|
|
99
|
+
})) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
if (cell.dataset.special) return false;
|
|
103
|
+
const rowId = rowElement.dataset.rowKey;
|
|
104
|
+
const colKey = cell.dataset.colKey;
|
|
105
|
+
if (event.key === 'Enter' || event.key === 'F2') {
|
|
106
|
+
if (!api.actions.startEdit({
|
|
107
|
+
rowId,
|
|
108
|
+
colKey
|
|
109
|
+
})) return false;
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
if (!isPrintableKey(event)) return false;
|
|
114
|
+
if (event.key === ' ' && api.config.rowSelection) return false;
|
|
115
|
+
if (!api.actions.startEdit({
|
|
116
|
+
rowId,
|
|
117
|
+
colKey,
|
|
118
|
+
seed: event.key
|
|
119
|
+
})) return false;
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
export default handleEditKeyDown;
|