@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,53 @@
|
|
|
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 getCellLayout from '@lowdefy/blocks-antd/table/getCellLayout.js';
|
|
17
|
+
// Column types whose text reads on several lines. Tags, statuses, numbers and dates keep their
|
|
18
|
+
// single-line layout.
|
|
19
|
+
const WRAP_TYPES = new Set([
|
|
20
|
+
'text',
|
|
21
|
+
'email',
|
|
22
|
+
'phone',
|
|
23
|
+
'url',
|
|
24
|
+
'link',
|
|
25
|
+
'html',
|
|
26
|
+
'relation'
|
|
27
|
+
]);
|
|
28
|
+
// Wrapped copies, one per column object, so layout columns stay stable across renders.
|
|
29
|
+
const wrapped = new WeakMap();
|
|
30
|
+
// With `view.wrap`, every text-like column without its own line layout (`wrap`, or `ellipsis`
|
|
31
|
+
// lines) wraps: its cells get the wrap class, and its rows are measured (isMeasuredColumn).
|
|
32
|
+
function getViewWrapColumn(column) {
|
|
33
|
+
if (column.wrap || type.isInt(column.ellipsis) || !WRAP_TYPES.has(column.type)) return column;
|
|
34
|
+
let copy = wrapped.get(column);
|
|
35
|
+
if (copy === undefined) {
|
|
36
|
+
const layout = getCellLayout({
|
|
37
|
+
...column,
|
|
38
|
+
wrap: true
|
|
39
|
+
});
|
|
40
|
+
copy = {
|
|
41
|
+
...column,
|
|
42
|
+
wrap: true,
|
|
43
|
+
compiled: {
|
|
44
|
+
...column.compiled,
|
|
45
|
+
className: layout.className,
|
|
46
|
+
style: layout.style
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
wrapped.set(column, copy);
|
|
50
|
+
}
|
|
51
|
+
return copy;
|
|
52
|
+
}
|
|
53
|
+
export default getViewWrapColumn;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 densityHeights from '../../core/densityHeights.js';
|
|
17
|
+
import pickViewPart from '../../core/pickViewPart.js';
|
|
18
|
+
// The view's density, else the one `size` sets (TableLight's `size`, the same names).
|
|
19
|
+
function initDensity({ value, defaultView, config }) {
|
|
20
|
+
const density = pickViewPart({
|
|
21
|
+
value,
|
|
22
|
+
defaultView,
|
|
23
|
+
key: 'density'
|
|
24
|
+
});
|
|
25
|
+
return type.isUndefined(densityHeights[density]) ? config.defaultDensity : density;
|
|
26
|
+
}
|
|
27
|
+
export default initDensity;
|
|
@@ -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 pickViewPart from '../../core/pickViewPart.js';
|
|
16
|
+
function initWrap({ value, defaultView }) {
|
|
17
|
+
return pickViewPart({
|
|
18
|
+
value,
|
|
19
|
+
defaultView,
|
|
20
|
+
key: 'wrap'
|
|
21
|
+
}) === true;
|
|
22
|
+
}
|
|
23
|
+
export default initWrap;
|
|
@@ -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 React from 'react';
|
|
16
|
+
// TableInput's "+ Add row" row under the grid (`addRow: true`).
|
|
17
|
+
function AddRowButton({ api, text }) {
|
|
18
|
+
return /*#__PURE__*/ React.createElement("button", {
|
|
19
|
+
className: "lf-table-add-row",
|
|
20
|
+
"data-lf-add-row": "",
|
|
21
|
+
onClick: ()=>api.actions.addRow(),
|
|
22
|
+
type: "button"
|
|
23
|
+
}, /*#__PURE__*/ React.createElement("span", {
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
className: "lf-table-add-row-icon"
|
|
26
|
+
}, "+"), text ?? 'Add row');
|
|
27
|
+
}
|
|
28
|
+
export default AddRowButton;
|
|
@@ -0,0 +1,284 @@
|
|
|
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 React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
16
|
+
import { DatePicker, Input, InputNumber, Rate, Select, Switch, Tooltip } from 'antd';
|
|
17
|
+
import SelectedTag from './SelectedTag.js';
|
|
18
|
+
import toEditorDraft from './toEditorDraft.js';
|
|
19
|
+
import toSelectOptions from './toSelectOptions.js';
|
|
20
|
+
const POPUP_CLASS = 'lf-table-editor-popup';
|
|
21
|
+
const POPUP_KINDS = new Set([
|
|
22
|
+
'date',
|
|
23
|
+
'datetime',
|
|
24
|
+
'select',
|
|
25
|
+
'multiSelect'
|
|
26
|
+
]);
|
|
27
|
+
const FOCUS_SELECTOR = 'input, [role="switch"], [role="radiogroup"], .ant-rate';
|
|
28
|
+
function filterOption(search, option) {
|
|
29
|
+
return String(option?.text ?? '').toLowerCase().includes(search.toLowerCase());
|
|
30
|
+
}
|
|
31
|
+
// The count of picked values that do not fit the tags editor, as the cell shows it.
|
|
32
|
+
function renderMoreTags(omitted) {
|
|
33
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
34
|
+
className: "lf-table-more"
|
|
35
|
+
}, "+", omitted.length);
|
|
36
|
+
}
|
|
37
|
+
// A select column without options has nothing to pick from: it edits as text.
|
|
38
|
+
function getKind(spec) {
|
|
39
|
+
if (spec.kind === 'select' && !spec.options) return 'text';
|
|
40
|
+
return spec.kind;
|
|
41
|
+
}
|
|
42
|
+
function focusControl({ wrapper, seeded }) {
|
|
43
|
+
const control = wrapper?.querySelector(FOCUS_SELECTOR);
|
|
44
|
+
if (!control) return;
|
|
45
|
+
control.focus({
|
|
46
|
+
preventScroll: true
|
|
47
|
+
});
|
|
48
|
+
if (control.tagName !== 'INPUT' || control.type === 'hidden') return;
|
|
49
|
+
if (seeded) {
|
|
50
|
+
const end = control.value.length;
|
|
51
|
+
control.setSelectionRange?.(end, end);
|
|
52
|
+
} else {
|
|
53
|
+
control.select?.();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// The one mounted cell editor (loaded on first edit). The control comes from the column type
|
|
57
|
+
// (D8): Input, InputNumber, DatePicker, Switch, Select (single or multiple) or Rate. Keys are the
|
|
58
|
+
// editor's: Enter commits, Tab commits and moves on, Esc cancels. While a picker or dropdown is
|
|
59
|
+
// open, Enter and Esc belong to it (pick, close). Picking in a select, date picker, switch or
|
|
60
|
+
// rating commits at once. Leaving the editor (a click elsewhere) commits. A failed `validate`
|
|
61
|
+
// keeps the editor open with the message under it.
|
|
62
|
+
function CellEditor({ api, session }) {
|
|
63
|
+
const { editing } = api;
|
|
64
|
+
const spec = editing.specs.get(session.colKey);
|
|
65
|
+
const kind = getKind(spec);
|
|
66
|
+
const [row] = useState(()=>api.table.getRow(session.rowId, true)?.original);
|
|
67
|
+
const [initial] = useState(()=>{
|
|
68
|
+
const saved = editing.layer.getDraft(session.id);
|
|
69
|
+
if (saved.has) return saved.value;
|
|
70
|
+
const col = api.layout.byKey.get(session.colKey);
|
|
71
|
+
return toEditorDraft({
|
|
72
|
+
spec: kind === spec.kind ? spec : {
|
|
73
|
+
...spec,
|
|
74
|
+
kind
|
|
75
|
+
},
|
|
76
|
+
value: col.accessor(row),
|
|
77
|
+
seed: session.seed
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
const [draft, setDraftState] = useState(initial);
|
|
81
|
+
const [search, setSearch] = useState(()=>kind === 'select' || kind === 'multiSelect' ? session.seed ?? '' : '');
|
|
82
|
+
const wrapperRef = useRef(null);
|
|
83
|
+
const seedPending = useRef(session.seed !== undefined);
|
|
84
|
+
const popupOpen = useRef(POPUP_KINDS.has(kind));
|
|
85
|
+
const openAtKeyDown = useRef(false);
|
|
86
|
+
const options = useMemo(()=>toSelectOptions({
|
|
87
|
+
components: api.components,
|
|
88
|
+
spec,
|
|
89
|
+
row
|
|
90
|
+
}), [
|
|
91
|
+
spec,
|
|
92
|
+
row
|
|
93
|
+
]);
|
|
94
|
+
function setDraft(value) {
|
|
95
|
+
setDraftState(value);
|
|
96
|
+
editing.layer.setDraft(session.id, value);
|
|
97
|
+
}
|
|
98
|
+
function commitValue(value) {
|
|
99
|
+
setDraft(value);
|
|
100
|
+
api.actions.commitEdit({});
|
|
101
|
+
}
|
|
102
|
+
useEffect(()=>{
|
|
103
|
+
// A printable key that opened the editor is already the edit.
|
|
104
|
+
if (kind !== 'select' && kind !== 'multiSelect' && session.seed !== undefined) {
|
|
105
|
+
editing.layer.setDraft(session.id, initial);
|
|
106
|
+
}
|
|
107
|
+
focusControl({
|
|
108
|
+
wrapper: wrapperRef.current,
|
|
109
|
+
seeded: session.seed !== undefined
|
|
110
|
+
});
|
|
111
|
+
}, []);
|
|
112
|
+
useEffect(()=>{
|
|
113
|
+
if (session.error) focusControl({
|
|
114
|
+
wrapper: wrapperRef.current,
|
|
115
|
+
seeded: true
|
|
116
|
+
});
|
|
117
|
+
}, [
|
|
118
|
+
session.error
|
|
119
|
+
]);
|
|
120
|
+
function handleSearch(value) {
|
|
121
|
+
// The select clears its search as it opens; the typed character that opened it must stay.
|
|
122
|
+
if (value === '' && seedPending.current) {
|
|
123
|
+
seedPending.current = false;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
seedPending.current = false;
|
|
127
|
+
setSearch(value);
|
|
128
|
+
}
|
|
129
|
+
function handleKeyDownCapture(event) {
|
|
130
|
+
openAtKeyDown.current = popupOpen.current;
|
|
131
|
+
// Tab is the table's, before a select can treat it as picking the active option.
|
|
132
|
+
if (event.key !== 'Tab') return;
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
event.stopPropagation();
|
|
135
|
+
api.actions.commitEdit({
|
|
136
|
+
move: event.shiftKey ? -1 : 1
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function handleKeyDown(event) {
|
|
140
|
+
// Keys typed into the editor never reach the grid's navigation.
|
|
141
|
+
event.stopPropagation();
|
|
142
|
+
if (event.key === 'Escape') {
|
|
143
|
+
if (openAtKeyDown.current) return;
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
api.actions.cancelEdit();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (event.key === 'Enter') {
|
|
149
|
+
if (openAtKeyDown.current) return;
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
api.actions.commitEdit({});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function handleBlur() {
|
|
155
|
+
const { id } = session;
|
|
156
|
+
// Focus moves after blur: wait for it to land before deciding the editor was left.
|
|
157
|
+
setTimeout(()=>{
|
|
158
|
+
if (editing.layer?.getSession()?.id !== id) return;
|
|
159
|
+
const active = document.activeElement;
|
|
160
|
+
if (wrapperRef.current?.contains(active)) return;
|
|
161
|
+
if (active?.closest?.(`.${POPUP_CLASS}`)) return;
|
|
162
|
+
api.actions.commitEdit({});
|
|
163
|
+
}, 0);
|
|
164
|
+
}
|
|
165
|
+
const size = api.rowHeight < 40 ? 'small' : 'middle';
|
|
166
|
+
const status = session.error ? 'error' : undefined;
|
|
167
|
+
const onOpenChange = (open)=>{
|
|
168
|
+
popupOpen.current = open;
|
|
169
|
+
};
|
|
170
|
+
let control;
|
|
171
|
+
switch(kind){
|
|
172
|
+
case 'number':
|
|
173
|
+
control = /*#__PURE__*/ React.createElement(InputNumber, {
|
|
174
|
+
onChange: (value)=>setDraft(value),
|
|
175
|
+
size: size,
|
|
176
|
+
status: status,
|
|
177
|
+
style: {
|
|
178
|
+
width: '100%'
|
|
179
|
+
},
|
|
180
|
+
suffix: spec.type === 'percent' ? '%' : undefined,
|
|
181
|
+
value: draft
|
|
182
|
+
});
|
|
183
|
+
break;
|
|
184
|
+
case 'date':
|
|
185
|
+
case 'datetime':
|
|
186
|
+
control = /*#__PURE__*/ React.createElement(DatePicker, {
|
|
187
|
+
classNames: {
|
|
188
|
+
popup: {
|
|
189
|
+
root: POPUP_CLASS
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
defaultOpen: true,
|
|
193
|
+
onChange: (date)=>commitValue(date),
|
|
194
|
+
onOpenChange: onOpenChange,
|
|
195
|
+
showTime: kind === 'datetime',
|
|
196
|
+
size: size,
|
|
197
|
+
status: status,
|
|
198
|
+
style: {
|
|
199
|
+
width: '100%'
|
|
200
|
+
},
|
|
201
|
+
value: draft
|
|
202
|
+
});
|
|
203
|
+
break;
|
|
204
|
+
case 'boolean':
|
|
205
|
+
control = /*#__PURE__*/ React.createElement(Switch, {
|
|
206
|
+
checked: draft === true,
|
|
207
|
+
onChange: (checked)=>commitValue(checked),
|
|
208
|
+
size: size === 'small' ? 'small' : 'default'
|
|
209
|
+
});
|
|
210
|
+
break;
|
|
211
|
+
case 'select':
|
|
212
|
+
case 'multiSelect':
|
|
213
|
+
{
|
|
214
|
+
const multiple = kind === 'multiSelect';
|
|
215
|
+
let mode;
|
|
216
|
+
if (multiple) mode = spec.options ? 'multiple' : 'tags';
|
|
217
|
+
control = /*#__PURE__*/ React.createElement(Select, {
|
|
218
|
+
allowClear: true,
|
|
219
|
+
classNames: {
|
|
220
|
+
popup: {
|
|
221
|
+
root: POPUP_CLASS
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
defaultOpen: true,
|
|
225
|
+
maxTagCount: "responsive",
|
|
226
|
+
mode: mode,
|
|
227
|
+
onChange: (value)=>{
|
|
228
|
+
if (multiple) {
|
|
229
|
+
setDraft(value ?? []);
|
|
230
|
+
} else {
|
|
231
|
+
commitValue(value ?? null);
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
onOpenChange: onOpenChange,
|
|
235
|
+
options: options,
|
|
236
|
+
showSearch: {
|
|
237
|
+
filterOption,
|
|
238
|
+
onSearch: handleSearch,
|
|
239
|
+
searchValue: search
|
|
240
|
+
},
|
|
241
|
+
size: size,
|
|
242
|
+
status: status,
|
|
243
|
+
style: {
|
|
244
|
+
width: '100%'
|
|
245
|
+
},
|
|
246
|
+
maxTagPlaceholder: renderMoreTags,
|
|
247
|
+
tagRender: mode === 'multiple' ? SelectedTag : undefined,
|
|
248
|
+
value: draft
|
|
249
|
+
});
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
case 'rating':
|
|
253
|
+
control = /*#__PURE__*/ React.createElement(Rate, {
|
|
254
|
+
count: spec.max,
|
|
255
|
+
onChange: (value)=>commitValue(value),
|
|
256
|
+
value: draft
|
|
257
|
+
});
|
|
258
|
+
break;
|
|
259
|
+
default:
|
|
260
|
+
control = /*#__PURE__*/ React.createElement(Input, {
|
|
261
|
+
autoComplete: "off",
|
|
262
|
+
onChange: (event)=>setDraft(event.target.value),
|
|
263
|
+
size: size,
|
|
264
|
+
status: status,
|
|
265
|
+
value: draft ?? ''
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
return /*#__PURE__*/ React.createElement(Tooltip, {
|
|
269
|
+
open: Boolean(session.error),
|
|
270
|
+
placement: "bottom",
|
|
271
|
+
title: session.error
|
|
272
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
273
|
+
className: "lf-table-editor",
|
|
274
|
+
"data-lf-control": "",
|
|
275
|
+
"data-lf-editor": "",
|
|
276
|
+
"data-lf-editor-error": session.error ?? undefined,
|
|
277
|
+
"data-lf-editor-kind": kind,
|
|
278
|
+
onBlur: handleBlur,
|
|
279
|
+
onKeyDown: handleKeyDown,
|
|
280
|
+
onKeyDownCapture: handleKeyDownCapture,
|
|
281
|
+
ref: wrapperRef
|
|
282
|
+
}, control));
|
|
283
|
+
}
|
|
284
|
+
export default CellEditor;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 React from 'react';
|
|
16
|
+
import { Tooltip } from 'antd';
|
|
17
|
+
const LABELS = {
|
|
18
|
+
error: 'Not saved',
|
|
19
|
+
invalid: 'Invalid',
|
|
20
|
+
saving: 'Saving'
|
|
21
|
+
};
|
|
22
|
+
// A cell's edit status, drawn into the cell by the editing layer: a spinner while onCellEdit runs,
|
|
23
|
+
// a corner flag with the message in a tooltip when the save failed or the value is invalid.
|
|
24
|
+
function EditMarker({ message, status }) {
|
|
25
|
+
const label = message ? `${LABELS[status]}: ${message}` : LABELS[status];
|
|
26
|
+
const marker = /*#__PURE__*/ React.createElement("span", {
|
|
27
|
+
"aria-label": label,
|
|
28
|
+
className: "lf-table-edit-marker",
|
|
29
|
+
"data-lf-edit-message": message ?? undefined,
|
|
30
|
+
"data-lf-edit-status": status,
|
|
31
|
+
role: "img"
|
|
32
|
+
});
|
|
33
|
+
if (!message) return marker;
|
|
34
|
+
return /*#__PURE__*/ React.createElement(Tooltip, {
|
|
35
|
+
title: message
|
|
36
|
+
}, marker);
|
|
37
|
+
}
|
|
38
|
+
export default EditMarker;
|
|
@@ -0,0 +1,148 @@
|
|
|
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 React, { lazy, Suspense, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
16
|
+
import { createPortal } from 'react-dom';
|
|
17
|
+
import computeEditTargets from './computeEditTargets.js';
|
|
18
|
+
import EditMarker from './EditMarker.js';
|
|
19
|
+
import isSameTargets from './isSameTargets.js';
|
|
20
|
+
import isDataItem from '../../core/isDataItem.js';
|
|
21
|
+
import scrollToCell from '../virtualization/scrollToCell.js';
|
|
22
|
+
import './editing.css';
|
|
23
|
+
const CellEditor = /*#__PURE__*/ lazy(()=>import('./CellEditor.js'));
|
|
24
|
+
const EMPTY = [];
|
|
25
|
+
const NO_DRAFT = {
|
|
26
|
+
has: false
|
|
27
|
+
};
|
|
28
|
+
const NOTICE_MS = 6000;
|
|
29
|
+
function startPending(api) {
|
|
30
|
+
const pending = api.editing.pendingStart;
|
|
31
|
+
if (!pending) return;
|
|
32
|
+
const index = api.rows.findIndex((row)=>isDataItem(row) && row.id === pending.rowId);
|
|
33
|
+
if (index === -1) return;
|
|
34
|
+
api.editing.pendingStart = null;
|
|
35
|
+
const col = api.layout.byKey.get(pending.colKey);
|
|
36
|
+
if (!col) return;
|
|
37
|
+
scrollToCell({
|
|
38
|
+
api,
|
|
39
|
+
row: index,
|
|
40
|
+
col: col.index
|
|
41
|
+
});
|
|
42
|
+
api.keyboard?.setActive({
|
|
43
|
+
row: index,
|
|
44
|
+
col: col.index
|
|
45
|
+
});
|
|
46
|
+
api.actions.startEdit({
|
|
47
|
+
rowId: pending.rowId,
|
|
48
|
+
colKey: pending.colKey
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// The one component that draws editing into the grid. Cells stay tier-0 and never know about
|
|
52
|
+
// editing: the open editor (at most one, D10 tier 1) and the status markers are portalled into the
|
|
53
|
+
// rendered cell elements, found by row key and column key. `sync` runs after every grid render
|
|
54
|
+
// (scroll included) and after the layer's own, so a cell that remounts gets its editor or
|
|
55
|
+
// marker back. The editor session and its draft live here and are reached through
|
|
56
|
+
// `api.editing.layer` by the handlers and actions.
|
|
57
|
+
function EditingLayer({ api }) {
|
|
58
|
+
const [session, setSessionState] = useState(null);
|
|
59
|
+
const [targets, setTargets] = useState(EMPTY);
|
|
60
|
+
const [notice, setNotice] = useState(null);
|
|
61
|
+
const sessionRef = useRef(null);
|
|
62
|
+
const draftRef = useRef({
|
|
63
|
+
id: null,
|
|
64
|
+
has: false,
|
|
65
|
+
value: undefined
|
|
66
|
+
});
|
|
67
|
+
const targetsRef = useRef(EMPTY);
|
|
68
|
+
const layer = useMemo(()=>({
|
|
69
|
+
getSession: ()=>sessionRef.current,
|
|
70
|
+
setSession (next) {
|
|
71
|
+
sessionRef.current = next;
|
|
72
|
+
draftRef.current = {
|
|
73
|
+
id: next?.id ?? null,
|
|
74
|
+
has: false,
|
|
75
|
+
value: undefined
|
|
76
|
+
};
|
|
77
|
+
setSessionState(next);
|
|
78
|
+
},
|
|
79
|
+
updateSession (patch) {
|
|
80
|
+
if (!sessionRef.current) return;
|
|
81
|
+
sessionRef.current = {
|
|
82
|
+
...sessionRef.current,
|
|
83
|
+
...patch
|
|
84
|
+
};
|
|
85
|
+
setSessionState(sessionRef.current);
|
|
86
|
+
},
|
|
87
|
+
getDraft (id) {
|
|
88
|
+
return draftRef.current.id === id ? draftRef.current : NO_DRAFT;
|
|
89
|
+
},
|
|
90
|
+
setDraft (id, value) {
|
|
91
|
+
if (draftRef.current.id !== id) return;
|
|
92
|
+
draftRef.current = {
|
|
93
|
+
id,
|
|
94
|
+
has: true,
|
|
95
|
+
value
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
notify: setNotice,
|
|
99
|
+
sync () {
|
|
100
|
+
startPending(api);
|
|
101
|
+
const next = computeEditTargets({
|
|
102
|
+
api,
|
|
103
|
+
session: sessionRef.current
|
|
104
|
+
});
|
|
105
|
+
if (isSameTargets(targetsRef.current, next)) return;
|
|
106
|
+
targetsRef.current = next;
|
|
107
|
+
setTargets(next);
|
|
108
|
+
}
|
|
109
|
+
}), [
|
|
110
|
+
api
|
|
111
|
+
]);
|
|
112
|
+
api.editing.layer = layer;
|
|
113
|
+
useLayoutEffect(()=>{
|
|
114
|
+
layer.sync();
|
|
115
|
+
});
|
|
116
|
+
useLayoutEffect(()=>()=>{
|
|
117
|
+
if (api.editing.layer === layer) api.editing.layer = null;
|
|
118
|
+
}, [
|
|
119
|
+
layer
|
|
120
|
+
]);
|
|
121
|
+
useEffect(()=>{
|
|
122
|
+
if (!notice) return undefined;
|
|
123
|
+
const timeout = setTimeout(()=>setNotice(null), NOTICE_MS);
|
|
124
|
+
return ()=>clearTimeout(timeout);
|
|
125
|
+
}, [
|
|
126
|
+
notice
|
|
127
|
+
]);
|
|
128
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, targets.map((target)=>{
|
|
129
|
+
if (target.kind === 'editor') {
|
|
130
|
+
if (!session || target.id !== `editor:${session.id}`) return null;
|
|
131
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ React.createElement(Suspense, {
|
|
132
|
+
fallback: null
|
|
133
|
+
}, /*#__PURE__*/ React.createElement(CellEditor, {
|
|
134
|
+
api: api,
|
|
135
|
+
session: session
|
|
136
|
+
})), target.element, target.id);
|
|
137
|
+
}
|
|
138
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ React.createElement(EditMarker, {
|
|
139
|
+
message: target.message,
|
|
140
|
+
status: target.status
|
|
141
|
+
}), target.element, target.id);
|
|
142
|
+
}), notice ? /*#__PURE__*/ React.createElement("div", {
|
|
143
|
+
className: "lf-table-edit-notice",
|
|
144
|
+
role: "status",
|
|
145
|
+
title: notice.details
|
|
146
|
+
}, notice.text) : null);
|
|
147
|
+
}
|
|
148
|
+
export default EditingLayer;
|