@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,108 @@
|
|
|
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
|
+
import { ROW_CONTROLS_KEY } from './rowControlsColumn.js';
|
|
17
|
+
const EMPTY = [];
|
|
18
|
+
function isEditingCell({ session, rowId, colKey }) {
|
|
19
|
+
return Boolean(session) && session.rowId === rowId && session.colKey === colKey;
|
|
20
|
+
}
|
|
21
|
+
// The rendered cells the editing layer draws into: the open editor's cell, cells with an edit
|
|
22
|
+
// saving or failed and the handle of a row move saving or failed (Table), and cells failing
|
|
23
|
+
// inline validation (TableInput). Only cells in the rendered window are found, so the work per
|
|
24
|
+
// scroll frame is bounded by the window, and a cell that scrolls back in gets its editor or
|
|
25
|
+
// marker again.
|
|
26
|
+
function computeEditTargets({ api, session }) {
|
|
27
|
+
const scroller = api.scrollerRef.current;
|
|
28
|
+
const { invalid, moveOverlay, overlay } = api.editing;
|
|
29
|
+
const moveMarked = Boolean(moveOverlay) && moveOverlay.status !== 'saved';
|
|
30
|
+
if (!scroller || !session && overlay.size === 0 && invalid.size === 0 && !moveMarked) {
|
|
31
|
+
return EMPTY;
|
|
32
|
+
}
|
|
33
|
+
const targets = [];
|
|
34
|
+
if (session) {
|
|
35
|
+
const element = findCellByKey({
|
|
36
|
+
api,
|
|
37
|
+
rowId: session.rowId,
|
|
38
|
+
colKey: session.colKey
|
|
39
|
+
});
|
|
40
|
+
if (element) targets.push({
|
|
41
|
+
id: `editor:${session.id}`,
|
|
42
|
+
kind: 'editor',
|
|
43
|
+
element
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
overlay.forEach((entry, id)=>{
|
|
47
|
+
if (entry.status === 'saved') return;
|
|
48
|
+
if (isEditingCell({
|
|
49
|
+
session,
|
|
50
|
+
rowId: entry.rowKey,
|
|
51
|
+
colKey: entry.colKey
|
|
52
|
+
})) return;
|
|
53
|
+
const element = findCellByKey({
|
|
54
|
+
api,
|
|
55
|
+
rowId: entry.rowKey,
|
|
56
|
+
colKey: entry.colKey
|
|
57
|
+
});
|
|
58
|
+
if (!element) return;
|
|
59
|
+
targets.push({
|
|
60
|
+
id: `mark:${id}`,
|
|
61
|
+
kind: 'marker',
|
|
62
|
+
element,
|
|
63
|
+
message: entry.message ?? null,
|
|
64
|
+
status: entry.status
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
if (moveMarked) {
|
|
68
|
+
const element = findCellByKey({
|
|
69
|
+
api,
|
|
70
|
+
rowId: moveOverlay.rowKey,
|
|
71
|
+
colKey: ROW_CONTROLS_KEY
|
|
72
|
+
});
|
|
73
|
+
if (element) {
|
|
74
|
+
targets.push({
|
|
75
|
+
id: 'move',
|
|
76
|
+
kind: 'marker',
|
|
77
|
+
element,
|
|
78
|
+
message: moveOverlay.message,
|
|
79
|
+
status: moveOverlay.status
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (invalid.size > 0) {
|
|
84
|
+
scroller.querySelectorAll('.lf-table-body [data-row-key]').forEach((rowElement)=>{
|
|
85
|
+
const rowId = rowElement.dataset.rowKey;
|
|
86
|
+
const cells = invalid.get(rowId);
|
|
87
|
+
if (!cells) return;
|
|
88
|
+
cells.forEach((message, colKey)=>{
|
|
89
|
+
if (isEditingCell({
|
|
90
|
+
session,
|
|
91
|
+
rowId,
|
|
92
|
+
colKey
|
|
93
|
+
})) return;
|
|
94
|
+
const element = rowElement.querySelector(`[data-lf-cell][data-col-key="${CSS.escape(colKey)}"]`);
|
|
95
|
+
if (!element) return;
|
|
96
|
+
targets.push({
|
|
97
|
+
id: `invalid:${rowId}\u0000${colKey}`,
|
|
98
|
+
kind: 'marker',
|
|
99
|
+
element,
|
|
100
|
+
message,
|
|
101
|
+
status: 'invalid'
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return targets;
|
|
107
|
+
}
|
|
108
|
+
export default computeEditTargets;
|
|
@@ -0,0 +1,78 @@
|
|
|
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 positionBetween, { POSITION_STEP } from './positionBetween.js';
|
|
17
|
+
// A row move (drag or Alt+Shift+Arrow) on the rows in display order. `gap` is the insertion
|
|
18
|
+
// point (0 = before the first row, rows.length = after the last). Returns null when the row
|
|
19
|
+
// would land where it is, else
|
|
20
|
+
// { rowKey, fromIndex, toIndex, beforeKey, afterKey, order, position, positions }
|
|
21
|
+
// `order` is every key in the new order. With `positionField`, one new position is computed for
|
|
22
|
+
// the moved row (fractional indexing), so a save writes one row: `positions` is
|
|
23
|
+
// `{ [rowKey]: position }`. Only when there is no room between the neighbours is the whole list
|
|
24
|
+
// renumbered in steps of 1024, and `positions` holds every row whose position changed.
|
|
25
|
+
function computeRowMove({ rows, getKey, positionField, rowKey, gap }) {
|
|
26
|
+
const from = rows.findIndex((row)=>String(getKey(row)) === String(rowKey));
|
|
27
|
+
if (from === -1) return null;
|
|
28
|
+
const clamped = Math.min(Math.max(gap, 0), rows.length);
|
|
29
|
+
const to = clamped > from ? clamped - 1 : clamped;
|
|
30
|
+
if (to === from) return null;
|
|
31
|
+
const moving = rows[from];
|
|
32
|
+
const rest = [
|
|
33
|
+
...rows.slice(0, from),
|
|
34
|
+
...rows.slice(from + 1)
|
|
35
|
+
];
|
|
36
|
+
const before = rest[to - 1];
|
|
37
|
+
const after = rest[to];
|
|
38
|
+
const arranged = [
|
|
39
|
+
...rest.slice(0, to),
|
|
40
|
+
moving,
|
|
41
|
+
...rest.slice(to)
|
|
42
|
+
];
|
|
43
|
+
const move = {
|
|
44
|
+
rowKey: getKey(moving),
|
|
45
|
+
fromIndex: from,
|
|
46
|
+
toIndex: to,
|
|
47
|
+
beforeKey: before === undefined ? null : getKey(before),
|
|
48
|
+
afterKey: after === undefined ? null : getKey(after),
|
|
49
|
+
order: arranged.map(getKey),
|
|
50
|
+
position: undefined,
|
|
51
|
+
positions: undefined
|
|
52
|
+
};
|
|
53
|
+
if (!positionField) return move;
|
|
54
|
+
const position = positionBetween({
|
|
55
|
+
// A neighbour without a position is null (no room), unlike a missing neighbour.
|
|
56
|
+
before: before === undefined ? undefined : get(before, positionField, {
|
|
57
|
+
default: null
|
|
58
|
+
}),
|
|
59
|
+
after: after === undefined ? undefined : get(after, positionField, {
|
|
60
|
+
default: null
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
if (position !== null) {
|
|
64
|
+
move.position = position;
|
|
65
|
+
move.positions = {
|
|
66
|
+
[String(move.rowKey)]: position
|
|
67
|
+
};
|
|
68
|
+
return move;
|
|
69
|
+
}
|
|
70
|
+
move.positions = {};
|
|
71
|
+
arranged.forEach((row, index)=>{
|
|
72
|
+
const renumbered = (index + 1) * POSITION_STEP;
|
|
73
|
+
if (get(row, positionField) !== renumbered) move.positions[String(getKey(row))] = renumbered;
|
|
74
|
+
});
|
|
75
|
+
move.position = (to + 1) * POSITION_STEP;
|
|
76
|
+
return move;
|
|
77
|
+
}
|
|
78
|
+
export default computeRowMove;
|
|
@@ -0,0 +1,68 @@
|
|
|
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, set, type } from '@lowdefy/helpers';
|
|
16
|
+
import addChangeRow from './addChangeRow.js';
|
|
17
|
+
import createNewRow from './createNewRow.js';
|
|
18
|
+
import generateRowKey from './generateRowKey.js';
|
|
19
|
+
import positionBetween, { POSITION_STEP } from './positionBetween.js';
|
|
20
|
+
// With a position field, an added row goes after the last data row (of every page).
|
|
21
|
+
function nextPosition({ api, positionField }) {
|
|
22
|
+
const last = api.dataRows[api.dataRows.length - 1]?.original;
|
|
23
|
+
if (last === undefined) return positionBetween();
|
|
24
|
+
return positionBetween({
|
|
25
|
+
before: get(last, positionField)
|
|
26
|
+
}) ?? POSITION_STEP;
|
|
27
|
+
}
|
|
28
|
+
// "+ Add row": adds `{ rowKey, ...defaults }` to the changeset, then opens the editor on the new
|
|
29
|
+
// row's first editable cell once it renders (the layer resolves `pendingStart` after the write).
|
|
30
|
+
function createAddRow(api) {
|
|
31
|
+
return function addRow() {
|
|
32
|
+
const { editing } = api;
|
|
33
|
+
const { positionField } = editing.options;
|
|
34
|
+
const { rowKey, fields } = createNewRow({
|
|
35
|
+
specs: editing.specs,
|
|
36
|
+
keyField: editing.keyField,
|
|
37
|
+
generateKey: generateRowKey
|
|
38
|
+
});
|
|
39
|
+
if (positionField && type.isNone(get(fields, positionField))) {
|
|
40
|
+
set(fields, positionField, nextPosition({
|
|
41
|
+
api,
|
|
42
|
+
positionField
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
const firstEditable = api.layout.cols.find((col)=>!col.special && editing.specs.get(col.key)?.editable);
|
|
46
|
+
api.actions.cancelEdit({
|
|
47
|
+
refocus: false
|
|
48
|
+
});
|
|
49
|
+
const changes = addChangeRow({
|
|
50
|
+
changes: editing.changes,
|
|
51
|
+
rowKey,
|
|
52
|
+
fields
|
|
53
|
+
});
|
|
54
|
+
const written = api.actions.writeChanges({
|
|
55
|
+
changes,
|
|
56
|
+
cause: 'add',
|
|
57
|
+
rowKey
|
|
58
|
+
});
|
|
59
|
+
if (written && firstEditable) {
|
|
60
|
+
editing.pendingStart = {
|
|
61
|
+
rowId: String(rowKey),
|
|
62
|
+
colKey: firstEditable.key
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return written;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export default createAddRow;
|
|
@@ -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 focusCell from './focusCell.js';
|
|
16
|
+
// Esc: closes the editor and drops the draft; focus returns to the cell.
|
|
17
|
+
function createCancelEdit(api) {
|
|
18
|
+
return function cancelEdit({ refocus = true } = {}) {
|
|
19
|
+
const session = api.editing.layer?.getSession();
|
|
20
|
+
if (!session) return;
|
|
21
|
+
api.editing.layer.setSession(null);
|
|
22
|
+
if (refocus) focusCell({
|
|
23
|
+
api,
|
|
24
|
+
rowId: session.rowId,
|
|
25
|
+
colKey: session.colKey
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export default createCancelEdit;
|
|
@@ -0,0 +1,124 @@
|
|
|
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 findNextEditableCell from './findNextEditableCell.js';
|
|
16
|
+
import focusCell from './focusCell.js';
|
|
17
|
+
import fromEditorDraft from './fromEditorDraft.js';
|
|
18
|
+
import setRowField from './setRowField.js';
|
|
19
|
+
import validateCellValue from './validateCellValue.js';
|
|
20
|
+
import valuesEqual from './valuesEqual.js';
|
|
21
|
+
import scrollToCell from '../virtualization/scrollToCell.js';
|
|
22
|
+
import isDataItem from '../../core/isDataItem.js';
|
|
23
|
+
function openNext({ api, next }) {
|
|
24
|
+
scrollToCell({
|
|
25
|
+
api,
|
|
26
|
+
row: next.rowIndex,
|
|
27
|
+
col: next.colIndex
|
|
28
|
+
});
|
|
29
|
+
api.keyboard?.setActive({
|
|
30
|
+
row: next.rowIndex,
|
|
31
|
+
col: next.colIndex
|
|
32
|
+
});
|
|
33
|
+
api.actions.startEdit({
|
|
34
|
+
rowId: next.rowId,
|
|
35
|
+
colKey: next.colKey
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// Commits the open editor (Enter, Tab, blur, or a pick in a select, date, switch or rating).
|
|
39
|
+
// The draft is validated first: a failing `required` / `validate` keeps the editor open with the
|
|
40
|
+
// message and returns false. An unchanged value closes the editor without an event. Otherwise the
|
|
41
|
+
// editor closes and the value goes to the block: TableInput writes its rows, Table saves through
|
|
42
|
+
// onCellEdit. `move` (Tab: 1, Shift+Tab: -1) opens the next editable cell, found in display
|
|
43
|
+
// order before the write, so a re-sort caused by the edit does not change where Tab goes.
|
|
44
|
+
function createCommitEdit(api) {
|
|
45
|
+
return function commitEdit({ move } = {}) {
|
|
46
|
+
const { editing } = api;
|
|
47
|
+
const session = editing.layer?.getSession();
|
|
48
|
+
if (!session) return true;
|
|
49
|
+
const row = api.table.getRow(session.rowId, true);
|
|
50
|
+
const col = api.layout.byKey.get(session.colKey);
|
|
51
|
+
if (!row || !col) {
|
|
52
|
+
editing.layer.setSession(null);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
const spec = editing.specs.get(session.colKey);
|
|
56
|
+
const previous = col.accessor(row.original);
|
|
57
|
+
const draft = editing.layer.getDraft(session.id);
|
|
58
|
+
const value = draft.has ? fromEditorDraft({
|
|
59
|
+
spec,
|
|
60
|
+
draft: draft.value,
|
|
61
|
+
previous
|
|
62
|
+
}) : previous;
|
|
63
|
+
const changed = !valuesEqual(value, previous);
|
|
64
|
+
if (changed) {
|
|
65
|
+
const nextRow = setRowField({
|
|
66
|
+
row: row.original,
|
|
67
|
+
field: spec.field,
|
|
68
|
+
value
|
|
69
|
+
});
|
|
70
|
+
const message = validateCellValue({
|
|
71
|
+
spec,
|
|
72
|
+
row: nextRow,
|
|
73
|
+
value
|
|
74
|
+
});
|
|
75
|
+
if (message !== null) {
|
|
76
|
+
editing.layer.updateSession({
|
|
77
|
+
error: message
|
|
78
|
+
});
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const next = move ? findNextEditableCell({
|
|
83
|
+
rows: api.rows,
|
|
84
|
+
cols: api.layout.cols,
|
|
85
|
+
specs: editing.specs,
|
|
86
|
+
rowIndex: api.rows.findIndex((candidate)=>isDataItem(candidate) && candidate.id === session.rowId),
|
|
87
|
+
colIndex: col.index,
|
|
88
|
+
direction: move
|
|
89
|
+
}) : null;
|
|
90
|
+
editing.layer.setSession(null);
|
|
91
|
+
if (changed) {
|
|
92
|
+
const rowKey = api.config.getKey(row.original);
|
|
93
|
+
if (editing.input) {
|
|
94
|
+
api.actions.writeCell({
|
|
95
|
+
rowKey,
|
|
96
|
+
field: spec.field,
|
|
97
|
+
value
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
api.actions.saveCellEdit({
|
|
101
|
+
row: row.original,
|
|
102
|
+
rowKey,
|
|
103
|
+
spec,
|
|
104
|
+
value,
|
|
105
|
+
previous
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (next) {
|
|
110
|
+
openNext({
|
|
111
|
+
api,
|
|
112
|
+
next
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
focusCell({
|
|
116
|
+
api,
|
|
117
|
+
rowId: session.rowId,
|
|
118
|
+
colKey: session.colKey
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export default createCommitEdit;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 removeChangeRow from './removeChangeRow.js';
|
|
16
|
+
// Deletes a TableInput row (the row controls' delete button, or Delete on a focused row with
|
|
17
|
+
// `deleteRows`). An editor open on that row closes without committing.
|
|
18
|
+
function createDeleteRow(api) {
|
|
19
|
+
return function deleteRow({ rowId }) {
|
|
20
|
+
const row = api.table.getRow(rowId, true);
|
|
21
|
+
if (!row) return false;
|
|
22
|
+
const rowKey = api.config.getKey(row.original);
|
|
23
|
+
if (api.editing.layer?.getSession()?.rowId === rowId) {
|
|
24
|
+
api.actions.cancelEdit({
|
|
25
|
+
refocus: false
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const changes = removeChangeRow({
|
|
29
|
+
changes: api.editing.changes,
|
|
30
|
+
rowKey
|
|
31
|
+
});
|
|
32
|
+
return api.actions.writeChanges({
|
|
33
|
+
changes,
|
|
34
|
+
cause: 'delete',
|
|
35
|
+
rowKey
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export default createDeleteRow;
|
|
@@ -0,0 +1,80 @@
|
|
|
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 { type } from '@lowdefy/helpers';
|
|
17
|
+
import compileCondition from '@lowdefy/blocks-antd/table/compileCondition.js';
|
|
18
|
+
import normalizeOptions from '@lowdefy/blocks-antd/table/normalizeOptions.js';
|
|
19
|
+
import collectRawColumns from './collectRawColumns.js';
|
|
20
|
+
import getEditorKind from './getEditorKind.js';
|
|
21
|
+
const DEFAULT_RATING_MAX = 5;
|
|
22
|
+
function getEditable({ raw, defaultColumn, column }) {
|
|
23
|
+
if (!type.isUndefined(raw?.editable)) return raw.editable;
|
|
24
|
+
if (!type.isUndefined(defaultColumn?.editable)) return defaultColumn.editable;
|
|
25
|
+
return column.editable;
|
|
26
|
+
}
|
|
27
|
+
// Everything editing needs per column, compiled once per column config: the editor kind, the
|
|
28
|
+
// row-level `editable: { when }` test, the `validate` tests and `required`, and the `default`
|
|
29
|
+
// for added rows. Conditions compile with the shared condition core, so `editable.when` and
|
|
30
|
+
// `validate[].pass` read exactly like filters and rules.
|
|
31
|
+
function createEditSpecs({ columns, rawColumns, defaultColumn }) {
|
|
32
|
+
const rawByKey = collectRawColumns({
|
|
33
|
+
columns: rawColumns
|
|
34
|
+
});
|
|
35
|
+
const columnsByKey = Object.fromEntries(columns.map((column)=>[
|
|
36
|
+
column.key,
|
|
37
|
+
column
|
|
38
|
+
]));
|
|
39
|
+
const now = dayjs();
|
|
40
|
+
const specs = new Map();
|
|
41
|
+
columns.forEach((column)=>{
|
|
42
|
+
const raw = rawByKey.get(column.key);
|
|
43
|
+
const kind = getEditorKind(column.type);
|
|
44
|
+
const editable = getEditable({
|
|
45
|
+
raw,
|
|
46
|
+
defaultColumn,
|
|
47
|
+
column
|
|
48
|
+
});
|
|
49
|
+
const validate = (raw?.validate ?? column.validate ?? []).map((rule)=>({
|
|
50
|
+
message: rule.message ?? 'Invalid value.',
|
|
51
|
+
test: compileCondition({
|
|
52
|
+
condition: rule.pass,
|
|
53
|
+
columnsByKey,
|
|
54
|
+
column,
|
|
55
|
+
now
|
|
56
|
+
})
|
|
57
|
+
}));
|
|
58
|
+
specs.set(column.key, {
|
|
59
|
+
column,
|
|
60
|
+
default: raw?.default,
|
|
61
|
+
editable: kind !== null && (editable === true || type.isObject(editable)),
|
|
62
|
+
field: column.field,
|
|
63
|
+
key: column.key,
|
|
64
|
+
kind,
|
|
65
|
+
max: column.cell?.max ?? DEFAULT_RATING_MAX,
|
|
66
|
+
options: normalizeOptions(column.options),
|
|
67
|
+
required: raw?.required === true,
|
|
68
|
+
type: column.type,
|
|
69
|
+
validate,
|
|
70
|
+
when: type.isObject(editable) ? compileCondition({
|
|
71
|
+
condition: editable.when,
|
|
72
|
+
columnsByKey,
|
|
73
|
+
column,
|
|
74
|
+
now
|
|
75
|
+
}) : null
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
return specs;
|
|
79
|
+
}
|
|
80
|
+
export default createEditSpecs;
|
|
@@ -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
|
+
*/ // TableInput's value with nothing changed.
|
|
16
|
+
function createEmptyChanges() {
|
|
17
|
+
return {
|
|
18
|
+
updated: {},
|
|
19
|
+
added: [],
|
|
20
|
+
removed: []
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export default createEmptyChanges;
|
|
@@ -0,0 +1,65 @@
|
|
|
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 applyMoveToChanges from './applyMoveToChanges.js';
|
|
16
|
+
import computeRowMove from './computeRowMove.js';
|
|
17
|
+
import getDataGap from './getDataGap.js';
|
|
18
|
+
// A row move from a drag drop or Alt+Shift+Arrow, on the rows in display order. Moves are only
|
|
19
|
+
// offered while the display order is the data order (or the position order), so the move's
|
|
20
|
+
// neighbours are the row's neighbours in the saved order. The move is computed over every data
|
|
21
|
+
// row (`api.dataRows`), not only the current page, so its indices, neighbours, key order and
|
|
22
|
+
// positions hold for the whole list. TableInput records the move in its changeset; Table saves it
|
|
23
|
+
// through onRowMove. Returns the move, or null when nothing moved.
|
|
24
|
+
function createMoveRow(api) {
|
|
25
|
+
return function moveRow({ rowId, gap }) {
|
|
26
|
+
const { editing } = api;
|
|
27
|
+
if (!editing.options.rowDrag || editing.reorderBlock.get()) return null;
|
|
28
|
+
const row = api.table.getRow(rowId, true);
|
|
29
|
+
if (!row) return null;
|
|
30
|
+
const move = computeRowMove({
|
|
31
|
+
rows: api.dataRows.map((dataRow)=>dataRow.original),
|
|
32
|
+
getKey: api.config.getKey,
|
|
33
|
+
positionField: editing.options.positionField,
|
|
34
|
+
rowKey: rowId,
|
|
35
|
+
gap: getDataGap({
|
|
36
|
+
api,
|
|
37
|
+
gap
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
if (!move) return null;
|
|
41
|
+
api.actions.cancelEdit({
|
|
42
|
+
refocus: false
|
|
43
|
+
});
|
|
44
|
+
if (editing.input) {
|
|
45
|
+
const changes = applyMoveToChanges({
|
|
46
|
+
changes: editing.changes,
|
|
47
|
+
move,
|
|
48
|
+
positionField: editing.options.positionField,
|
|
49
|
+
dataByKey: editing.getDataByKey()
|
|
50
|
+
});
|
|
51
|
+
api.actions.writeChanges({
|
|
52
|
+
changes,
|
|
53
|
+
cause: 'move',
|
|
54
|
+
rowKey: move.rowKey
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
api.actions.saveRowMove({
|
|
58
|
+
move,
|
|
59
|
+
row: row.original
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return move;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export default createMoveRow;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { serializer, set, type, unset } from '@lowdefy/helpers';
|
|
16
|
+
// A row for "+ Add row": `fields` holds each column's `default` at its field. The row always gets
|
|
17
|
+
// a generated temporary key, kept out of `fields` so the server assigns the real one (the table
|
|
18
|
+
// shows the temporary key until then). A default on the key column is ignored: every added row
|
|
19
|
+
// would share it, and changes are recorded by key.
|
|
20
|
+
function createNewRow({ specs, keyField, generateKey }) {
|
|
21
|
+
const fields = {};
|
|
22
|
+
specs.forEach((spec)=>{
|
|
23
|
+
if (type.isUndefined(spec.default)) return;
|
|
24
|
+
set(fields, spec.field, serializer.copy(spec.default));
|
|
25
|
+
});
|
|
26
|
+
unset(fields, keyField);
|
|
27
|
+
return {
|
|
28
|
+
rowKey: generateKey(),
|
|
29
|
+
fields
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export default createNewRow;
|
|
@@ -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 createEmptyChanges from './createEmptyChanges.js';
|
|
16
|
+
// TableInput's `resetChanges` method: drops every change (after the app saved them, or to
|
|
17
|
+
// discard them) and the undo history. A method call is the app's, so no onChange fires.
|
|
18
|
+
function createResetChanges(api) {
|
|
19
|
+
return function resetChanges() {
|
|
20
|
+
const { editing } = api;
|
|
21
|
+
api.actions.cancelEdit({
|
|
22
|
+
refocus: false
|
|
23
|
+
});
|
|
24
|
+
editing.undo.clear();
|
|
25
|
+
editing.changes = createEmptyChanges();
|
|
26
|
+
editing.input.methods.setValue(editing.changes);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export default createResetChanges;
|