@abraca/nuxt 1.9.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.d.mts +4 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +9 -1
- package/dist/runtime/components/ADocumentTree.vue +1 -1
- package/dist/runtime/components/AEditor.d.vue.ts +26 -1
- package/dist/runtime/components/AEditor.vue +153 -4
- package/dist/runtime/components/AEditor.vue.d.ts +26 -1
- package/dist/runtime/components/AIdentityModal.d.vue.ts +46 -0
- package/dist/runtime/components/AIdentityModal.vue +157 -0
- package/dist/runtime/components/AIdentityModal.vue.d.ts +46 -0
- package/dist/runtime/components/AMnemonicLoginModal.d.vue.ts +35 -0
- package/dist/runtime/components/AMnemonicLoginModal.vue +173 -0
- package/dist/runtime/components/AMnemonicLoginModal.vue.d.ts +35 -0
- package/dist/runtime/components/ANodePanel.d.vue.ts +29 -2
- package/dist/runtime/components/ANodePanel.vue +148 -27
- package/dist/runtime/components/ANodePanel.vue.d.ts +29 -2
- package/dist/runtime/components/ANodePanelHeader.d.vue.ts +64 -0
- package/dist/runtime/components/ANodePanelHeader.vue +105 -0
- package/dist/runtime/components/ANodePanelHeader.vue.d.ts +64 -0
- package/dist/runtime/components/ANodeSettingsPanel.d.vue.ts +49 -0
- package/dist/runtime/components/ANodeSettingsPanel.vue +59 -0
- package/dist/runtime/components/ANodeSettingsPanel.vue.d.ts +49 -0
- package/dist/runtime/components/ANotificationBell.d.vue.ts +26 -0
- package/dist/runtime/components/ANotificationBell.vue +55 -0
- package/dist/runtime/components/ANotificationBell.vue.d.ts +26 -0
- package/dist/runtime/components/AOfflineSync.d.vue.ts +11 -0
- package/dist/runtime/components/AOfflineSync.vue +217 -0
- package/dist/runtime/components/AOfflineSync.vue.d.ts +11 -0
- package/dist/runtime/components/ARecoveryPhraseDisplay.d.vue.ts +26 -0
- package/dist/runtime/components/ARecoveryPhraseDisplay.vue +94 -0
- package/dist/runtime/components/ARecoveryPhraseDisplay.vue.d.ts +26 -0
- package/dist/runtime/components/AServerInfoModal.d.vue.ts +43 -0
- package/dist/runtime/components/AServerInfoModal.vue +150 -0
- package/dist/runtime/components/AServerInfoModal.vue.d.ts +43 -0
- package/dist/runtime/components/ASpaceFormModal.vue +1 -1
- package/dist/runtime/components/aware/AAccordion.d.vue.ts +25 -0
- package/dist/runtime/components/aware/AAccordion.vue +107 -0
- package/dist/runtime/components/aware/AAccordion.vue.d.ts +25 -0
- package/dist/runtime/components/aware/AArea.vue +24 -11
- package/dist/runtime/components/aware/AAvatar.d.vue.ts +6 -0
- package/dist/runtime/components/aware/AAvatar.vue +33 -3
- package/dist/runtime/components/aware/AAvatar.vue.d.ts +6 -0
- package/dist/runtime/components/aware/AAvatarGroup.d.vue.ts +10 -0
- package/dist/runtime/components/aware/AAvatarGroup.vue +30 -0
- package/dist/runtime/components/aware/AAvatarGroup.vue.d.ts +10 -0
- package/dist/runtime/components/aware/AButton.d.vue.ts +4 -2
- package/dist/runtime/components/aware/AButton.vue +46 -14
- package/dist/runtime/components/aware/AButton.vue.d.ts +4 -2
- package/dist/runtime/components/aware/ACalendar.d.vue.ts +17 -0
- package/dist/runtime/components/aware/ACalendar.vue +145 -0
- package/dist/runtime/components/aware/ACalendar.vue.d.ts +17 -0
- package/dist/runtime/components/aware/ACarousel.d.vue.ts +25 -0
- package/dist/runtime/components/aware/ACarousel.vue +39 -0
- package/dist/runtime/components/aware/ACarousel.vue.d.ts +25 -0
- package/dist/runtime/components/aware/ACheckbox.d.vue.ts +11 -0
- package/dist/runtime/components/aware/ACheckbox.vue +74 -0
- package/dist/runtime/components/aware/ACheckbox.vue.d.ts +11 -0
- package/dist/runtime/components/aware/ACheckboxGroup.d.vue.ts +27 -0
- package/dist/runtime/components/aware/ACheckboxGroup.vue +79 -0
- package/dist/runtime/components/aware/ACheckboxGroup.vue.d.ts +27 -0
- package/dist/runtime/components/aware/ACollapsible.d.vue.ts +25 -0
- package/dist/runtime/components/aware/ACollapsible.vue +45 -0
- package/dist/runtime/components/aware/ACollapsible.vue.d.ts +25 -0
- package/dist/runtime/components/aware/AColorPicker.d.vue.ts +15 -0
- package/dist/runtime/components/aware/AColorPicker.vue +48 -0
- package/dist/runtime/components/aware/AColorPicker.vue.d.ts +15 -0
- package/dist/runtime/components/aware/ACommandPalette.d.vue.ts +33 -0
- package/dist/runtime/components/aware/ACommandPalette.vue +123 -0
- package/dist/runtime/components/aware/ACommandPalette.vue.d.ts +33 -0
- package/dist/runtime/components/aware/AContextMenu.d.vue.ts +25 -0
- package/dist/runtime/components/aware/AContextMenu.vue +63 -0
- package/dist/runtime/components/aware/AContextMenu.vue.d.ts +25 -0
- package/dist/runtime/components/aware/ADrawer.d.vue.ts +25 -0
- package/dist/runtime/components/aware/ADrawer.vue +57 -0
- package/dist/runtime/components/aware/ADrawer.vue.d.ts +25 -0
- package/dist/runtime/components/aware/ADropdownMenu.d.vue.ts +25 -0
- package/dist/runtime/components/aware/ADropdownMenu.vue +63 -0
- package/dist/runtime/components/aware/ADropdownMenu.vue.d.ts +25 -0
- package/dist/runtime/components/aware/AFileUpload.d.vue.ts +27 -0
- package/dist/runtime/components/aware/AFileUpload.vue +67 -0
- package/dist/runtime/components/aware/AFileUpload.vue.d.ts +27 -0
- package/dist/runtime/components/aware/AFollowBar.d.vue.ts +21 -0
- package/dist/runtime/components/aware/AFollowBar.vue +62 -0
- package/dist/runtime/components/aware/AFollowBar.vue.d.ts +21 -0
- package/dist/runtime/components/aware/AFollowScroll.d.vue.ts +7 -0
- package/dist/runtime/components/aware/AFollowScroll.vue +17 -0
- package/dist/runtime/components/aware/AFollowScroll.vue.d.ts +7 -0
- package/dist/runtime/components/aware/AFormSync.d.vue.ts +21 -0
- package/dist/runtime/components/aware/AFormSync.vue +52 -0
- package/dist/runtime/components/aware/AFormSync.vue.d.ts +21 -0
- package/dist/runtime/components/aware/AGlobalFocusLayer.d.vue.ts +3 -0
- package/dist/runtime/components/aware/AGlobalFocusLayer.vue +90 -0
- package/dist/runtime/components/aware/AGlobalFocusLayer.vue.d.ts +3 -0
- package/dist/runtime/components/aware/AHoverItem.d.vue.ts +27 -0
- package/dist/runtime/components/aware/AHoverItem.vue +124 -0
- package/dist/runtime/components/aware/AHoverItem.vue.d.ts +27 -0
- package/dist/runtime/components/aware/AInput.d.vue.ts +12 -2
- package/dist/runtime/components/aware/AInput.vue +72 -19
- package/dist/runtime/components/aware/AInput.vue.d.ts +12 -2
- package/dist/runtime/components/aware/AInputMenu.d.vue.ts +17 -0
- package/dist/runtime/components/aware/AInputMenu.vue +138 -0
- package/dist/runtime/components/aware/AInputMenu.vue.d.ts +17 -0
- package/dist/runtime/components/aware/AInputNumber.d.vue.ts +15 -0
- package/dist/runtime/components/aware/AInputNumber.vue +67 -0
- package/dist/runtime/components/aware/AInputNumber.vue.d.ts +15 -0
- package/dist/runtime/components/aware/AInputTags.d.vue.ts +15 -0
- package/dist/runtime/components/aware/AInputTags.vue +67 -0
- package/dist/runtime/components/aware/AInputTags.vue.d.ts +15 -0
- package/dist/runtime/components/aware/AKeyHint.d.vue.ts +3 -0
- package/dist/runtime/components/aware/AKeyHint.vue +23 -0
- package/dist/runtime/components/aware/AKeyHint.vue.d.ts +3 -0
- package/dist/runtime/components/aware/AMedia.d.vue.ts +19 -0
- package/dist/runtime/components/aware/AMedia.vue +85 -0
- package/dist/runtime/components/aware/AMedia.vue.d.ts +19 -0
- package/dist/runtime/components/aware/AModal.d.vue.ts +33 -0
- package/dist/runtime/components/aware/AModal.vue +110 -0
- package/dist/runtime/components/aware/AModal.vue.d.ts +33 -0
- package/dist/runtime/components/aware/ANavigationMenu.d.vue.ts +25 -0
- package/dist/runtime/components/aware/ANavigationMenu.vue +82 -0
- package/dist/runtime/components/aware/ANavigationMenu.vue.d.ts +25 -0
- package/dist/runtime/components/aware/APagination.d.vue.ts +13 -0
- package/dist/runtime/components/aware/APagination.vue +53 -0
- package/dist/runtime/components/aware/APagination.vue.d.ts +13 -0
- package/dist/runtime/components/aware/APeerCaretLayer.d.vue.ts +10 -0
- package/dist/runtime/components/aware/APeerCaretLayer.vue +133 -0
- package/dist/runtime/components/aware/APeerCaretLayer.vue.d.ts +10 -0
- package/dist/runtime/components/aware/APinInput.d.vue.ts +15 -0
- package/dist/runtime/components/aware/APinInput.vue +48 -0
- package/dist/runtime/components/aware/APinInput.vue.d.ts +15 -0
- package/dist/runtime/components/aware/APopover.d.vue.ts +25 -0
- package/dist/runtime/components/aware/APopover.vue +57 -0
- package/dist/runtime/components/aware/APopover.vue.d.ts +25 -0
- package/dist/runtime/components/aware/APresenceBlobs.d.vue.ts +3 -0
- package/dist/runtime/components/aware/APresenceBlobs.vue +69 -0
- package/dist/runtime/components/aware/APresenceBlobs.vue.d.ts +3 -0
- package/dist/runtime/components/aware/APresenceCursors.d.vue.ts +20 -0
- package/dist/runtime/components/aware/APresenceCursors.vue +47 -0
- package/dist/runtime/components/aware/APresenceCursors.vue.d.ts +20 -0
- package/dist/runtime/components/aware/ARadioGroup.d.vue.ts +27 -0
- package/dist/runtime/components/aware/ARadioGroup.vue +86 -0
- package/dist/runtime/components/aware/ARadioGroup.vue.d.ts +27 -0
- package/dist/runtime/components/aware/AScroll.d.vue.ts +25 -0
- package/dist/runtime/components/aware/AScroll.vue +87 -0
- package/dist/runtime/components/aware/AScroll.vue.d.ts +25 -0
- package/dist/runtime/components/aware/ASelect.d.vue.ts +12 -2
- package/dist/runtime/components/aware/ASelect.vue +146 -22
- package/dist/runtime/components/aware/ASelect.vue.d.ts +12 -2
- package/dist/runtime/components/aware/ASelectMenu.d.vue.ts +17 -0
- package/dist/runtime/components/aware/ASelectMenu.vue +139 -0
- package/dist/runtime/components/aware/ASelectMenu.vue.d.ts +17 -0
- package/dist/runtime/components/aware/ASlideover.d.vue.ts +33 -0
- package/dist/runtime/components/aware/ASlideover.vue +110 -0
- package/dist/runtime/components/aware/ASlideover.vue.d.ts +33 -0
- package/dist/runtime/components/aware/ASlider.d.vue.ts +19 -0
- package/dist/runtime/components/aware/ASlider.vue +77 -0
- package/dist/runtime/components/aware/ASlider.vue.d.ts +19 -0
- package/dist/runtime/components/aware/AStepper.d.vue.ts +25 -0
- package/dist/runtime/components/aware/AStepper.vue +82 -0
- package/dist/runtime/components/aware/AStepper.vue.d.ts +25 -0
- package/dist/runtime/components/aware/ASwitch.d.vue.ts +11 -0
- package/dist/runtime/components/aware/ASwitch.vue +75 -0
- package/dist/runtime/components/aware/ASwitch.vue.d.ts +11 -0
- package/dist/runtime/components/aware/ATable.d.vue.ts +23 -0
- package/dist/runtime/components/aware/ATable.vue +97 -0
- package/dist/runtime/components/aware/ATable.vue.d.ts +23 -0
- package/dist/runtime/components/aware/ATabs.d.vue.ts +27 -0
- package/dist/runtime/components/aware/ATabs.vue +128 -0
- package/dist/runtime/components/aware/ATabs.vue.d.ts +27 -0
- package/dist/runtime/components/aware/ATextarea.d.vue.ts +12 -2
- package/dist/runtime/components/aware/ATextarea.vue +72 -19
- package/dist/runtime/components/aware/ATextarea.vue.d.ts +12 -2
- package/dist/runtime/components/aware/AToggleGroup.d.vue.ts +27 -0
- package/dist/runtime/components/aware/AToggleGroup.vue +79 -0
- package/dist/runtime/components/aware/AToggleGroup.vue.d.ts +27 -0
- package/dist/runtime/components/aware/ATree.d.vue.ts +27 -0
- package/dist/runtime/components/aware/ATree.vue +111 -0
- package/dist/runtime/components/aware/ATree.vue.d.ts +27 -0
- package/dist/runtime/components/chat/AChatPanel.d.vue.ts +6 -6
- package/dist/runtime/components/chat/AChatPanel.vue.d.ts +6 -6
- package/dist/runtime/components/chat/ANodeChatPanel.d.vue.ts +42 -0
- package/dist/runtime/components/chat/ANodeChatPanel.vue +53 -0
- package/dist/runtime/components/chat/ANodeChatPanel.vue.d.ts +42 -0
- package/dist/runtime/components/docs/ADocsSearch.d.vue.ts +2 -2
- package/dist/runtime/components/docs/ADocsSearch.vue.d.ts +2 -2
- package/dist/runtime/components/docs/ADocsSearchButton.d.vue.ts +3 -3
- package/dist/runtime/components/docs/ADocsSearchButton.vue.d.ts +3 -3
- package/dist/runtime/components/editor/AEditorRedoButton.d.vue.ts +26 -0
- package/dist/runtime/components/editor/AEditorRedoButton.vue +38 -0
- package/dist/runtime/components/editor/AEditorRedoButton.vue.d.ts +26 -0
- package/dist/runtime/components/editor/AEditorUndoButton.d.vue.ts +26 -0
- package/dist/runtime/components/editor/AEditorUndoButton.vue +38 -0
- package/dist/runtime/components/editor/AEditorUndoButton.vue.d.ts +26 -0
- package/dist/runtime/components/editor/AIconPickerPopover.d.vue.ts +24 -0
- package/dist/runtime/components/editor/AIconPickerPopover.vue +113 -0
- package/dist/runtime/components/editor/AIconPickerPopover.vue.d.ts +24 -0
- package/dist/runtime/components/editor/ANodeInlineLabel.d.vue.ts +24 -0
- package/dist/runtime/components/editor/ANodeInlineLabel.vue +101 -0
- package/dist/runtime/components/editor/ANodeInlineLabel.vue.d.ts +24 -0
- package/dist/runtime/components/renderers/ADocLoadError.d.vue.ts +3 -0
- package/dist/runtime/components/renderers/ADocLoadError.vue +11 -0
- package/dist/runtime/components/renderers/ADocLoadError.vue.d.ts +3 -0
- package/dist/runtime/components/renderers/ADocLoadingSkeleton.d.vue.ts +3 -0
- package/dist/runtime/components/renderers/ADocLoadingSkeleton.vue +5 -0
- package/dist/runtime/components/renderers/ADocLoadingSkeleton.vue.d.ts +3 -0
- package/dist/runtime/components/renderers/AOverviewRenderer.d.vue.ts +22 -0
- package/dist/runtime/components/renderers/AOverviewRenderer.vue +1041 -0
- package/dist/runtime/components/renderers/AOverviewRenderer.vue.d.ts +22 -0
- package/dist/runtime/components/renderers/AProseRenderer.d.vue.ts +23 -0
- package/dist/runtime/components/renderers/AProseRenderer.vue +31 -0
- package/dist/runtime/components/renderers/AProseRenderer.vue.d.ts +23 -0
- package/dist/runtime/components/renderers/ASheetsRenderer.client.d.vue.ts +19 -0
- package/dist/runtime/components/renderers/ASheetsRenderer.client.vue +865 -0
- package/dist/runtime/components/renderers/ASheetsRenderer.client.vue.d.ts +19 -0
- package/dist/runtime/components/renderers/calendar/ACalendarDayCell.d.vue.ts +14 -0
- package/dist/runtime/components/renderers/calendar/ACalendarDayCell.vue +45 -15
- package/dist/runtime/components/renderers/calendar/ACalendarDayCell.vue.d.ts +14 -0
- package/dist/runtime/components/renderers/calendar/ACalendarDayView.d.vue.ts +15 -0
- package/dist/runtime/components/renderers/calendar/ACalendarDayView.vue +93 -20
- package/dist/runtime/components/renderers/calendar/ACalendarDayView.vue.d.ts +15 -0
- package/dist/runtime/components/renderers/calendar/ACalendarEventChip.d.vue.ts +9 -0
- package/dist/runtime/components/renderers/calendar/ACalendarEventChip.vue +31 -2
- package/dist/runtime/components/renderers/calendar/ACalendarEventChip.vue.d.ts +9 -0
- package/dist/runtime/components/renderers/calendar/ACalendarToolbar.d.vue.ts +4 -4
- package/dist/runtime/components/renderers/calendar/ACalendarToolbar.vue.d.ts +4 -4
- package/dist/runtime/components/renderers/calendar/ACalendarWeekView.d.vue.ts +15 -0
- package/dist/runtime/components/renderers/calendar/ACalendarWeekView.vue +94 -21
- package/dist/runtime/components/renderers/calendar/ACalendarWeekView.vue.d.ts +15 -0
- package/dist/runtime/components/renderers/media/MediaTransportBar.d.vue.ts +2 -2
- package/dist/runtime/components/renderers/media/MediaTransportBar.vue.d.ts +2 -2
- package/dist/runtime/components/renderers/sheets/ASheetsCell.d.vue.ts +45 -0
- package/dist/runtime/components/renderers/sheets/ASheetsCell.vue +123 -0
- package/dist/runtime/components/renderers/sheets/ASheetsCell.vue.d.ts +45 -0
- package/dist/runtime/components/renderers/sheets/ASheetsGrid.d.vue.ts +111 -0
- package/dist/runtime/components/renderers/sheets/ASheetsGrid.vue +737 -0
- package/dist/runtime/components/renderers/sheets/ASheetsGrid.vue.d.ts +111 -0
- package/dist/runtime/components/renderers/sheets/ASheetsMobileActionBar.d.vue.ts +26 -0
- package/dist/runtime/components/renderers/sheets/ASheetsMobileActionBar.vue +100 -0
- package/dist/runtime/components/renderers/sheets/ASheetsMobileActionBar.vue.d.ts +26 -0
- package/dist/runtime/components/renderers/sheets/ASheetsToolbar.d.vue.ts +48 -0
- package/dist/runtime/components/renderers/sheets/ASheetsToolbar.vue +243 -0
- package/dist/runtime/components/renderers/sheets/ASheetsToolbar.vue.d.ts +48 -0
- package/dist/runtime/components/renderers/table/cells/ATableCellColor.d.vue.ts +1 -0
- package/dist/runtime/components/renderers/table/cells/ATableCellColor.vue +13 -32
- package/dist/runtime/components/renderers/table/cells/ATableCellColor.vue.d.ts +1 -0
- package/dist/runtime/components/renderers/timeline/ATimelineBar.d.vue.ts +6 -0
- package/dist/runtime/components/renderers/timeline/ATimelineBar.vue +34 -4
- package/dist/runtime/components/renderers/timeline/ATimelineBar.vue.d.ts +6 -0
- package/dist/runtime/components/renderers/timeline/ATimelineBarArea.d.vue.ts +16 -0
- package/dist/runtime/components/renderers/timeline/ATimelineBarArea.vue +14 -3
- package/dist/runtime/components/renderers/timeline/ATimelineBarArea.vue.d.ts +16 -0
- package/dist/runtime/components/renderers/timeline/ATimelineLabelPanel.d.vue.ts +13 -1
- package/dist/runtime/components/renderers/timeline/ATimelineLabelPanel.vue +114 -47
- package/dist/runtime/components/renderers/timeline/ATimelineLabelPanel.vue.d.ts +13 -1
- package/dist/runtime/components/renderers/timeline/ATimelineMilestone.d.vue.ts +4 -0
- package/dist/runtime/components/renderers/timeline/ATimelineMilestone.vue +21 -4
- package/dist/runtime/components/renderers/timeline/ATimelineMilestone.vue.d.ts +4 -0
- package/dist/runtime/components/renderers/timeline/ATimelineToolbar.d.vue.ts +2 -2
- package/dist/runtime/components/renderers/timeline/ATimelineToolbar.vue.d.ts +2 -2
- package/dist/runtime/components/settings/ASettingsSpacesPanel.vue +7 -25
- package/dist/runtime/components/shell/ADocPanelSettings.d.vue.ts +3 -3
- package/dist/runtime/components/shell/ADocPanelSettings.vue.d.ts +3 -3
- package/dist/runtime/components/shell/ASyncStatus.d.vue.ts +1 -1
- package/dist/runtime/components/shell/ASyncStatus.vue.d.ts +1 -1
- package/dist/runtime/components/shell/AUserMenu.d.vue.ts +2 -2
- package/dist/runtime/components/shell/AUserMenu.vue.d.ts +2 -2
- package/dist/runtime/components/shell/AWelcomeScreen.d.vue.ts +1 -1
- package/dist/runtime/components/shell/AWelcomeScreen.vue.d.ts +1 -1
- package/dist/runtime/composables/useAACaret.d.ts +29 -0
- package/dist/runtime/composables/useAACaret.js +64 -0
- package/dist/runtime/composables/useAAEphemeral.d.ts +32 -0
- package/dist/runtime/composables/useAAEphemeral.js +33 -0
- package/dist/runtime/composables/useAAField.d.ts +10 -2
- package/dist/runtime/composables/useAAField.js +31 -2
- package/dist/runtime/composables/useAAFieldValue.d.ts +26 -0
- package/dist/runtime/composables/useAAFieldValue.js +32 -0
- package/dist/runtime/composables/useAAFocus.d.ts +68 -0
- package/dist/runtime/composables/useAAFocus.js +174 -0
- package/dist/runtime/composables/useAAFollowAnchor.d.ts +25 -0
- package/dist/runtime/composables/useAAFollowAnchor.js +69 -0
- package/dist/runtime/composables/useAAFollowPeer.d.ts +29 -0
- package/dist/runtime/composables/useAAFollowPeer.js +75 -0
- package/dist/runtime/composables/useAAKey.d.ts +22 -0
- package/dist/runtime/composables/useAAKey.js +24 -0
- package/dist/runtime/composables/useAAPointer.d.ts +30 -0
- package/dist/runtime/composables/useAAPointer.js +53 -0
- package/dist/runtime/composables/useAAUIState.d.ts +29 -0
- package/dist/runtime/composables/useAAUIState.js +28 -0
- package/dist/runtime/composables/useAAViewport.d.ts +22 -0
- package/dist/runtime/composables/useAAViewport.js +50 -0
- package/dist/runtime/composables/useAbraAdmin.d.ts +54 -0
- package/dist/runtime/composables/useAbraAdmin.js +115 -0
- package/dist/runtime/composables/useAbracadabraAuth.d.ts +8 -0
- package/dist/runtime/composables/useAbracadabraAuth.js +8 -0
- package/dist/runtime/composables/useAggregatedPresence.d.ts +23 -0
- package/dist/runtime/composables/useAggregatedPresence.js +140 -0
- package/dist/runtime/composables/useChat.d.ts +16 -2
- package/dist/runtime/composables/useChat.js +257 -66
- package/dist/runtime/composables/useChatUsers.d.ts +2 -0
- package/dist/runtime/composables/useChatUsers.js +2 -1
- package/dist/runtime/composables/useDocLookup.d.ts +4 -0
- package/dist/runtime/composables/useDocLookup.js +25 -0
- package/dist/runtime/composables/useDocSnapshots.d.ts +79 -0
- package/dist/runtime/composables/useDocSnapshots.js +234 -0
- package/dist/runtime/composables/useEditorDragHandle.d.ts +7 -0
- package/dist/runtime/composables/useEditorDragHandle.js +19 -1
- package/dist/runtime/composables/useEditorSuggestions.js +26 -1
- package/dist/runtime/composables/useEditorToolbar.js +9 -1
- package/dist/runtime/composables/useEmailVerification.d.ts +33 -0
- package/dist/runtime/composables/useEmailVerification.js +58 -0
- package/dist/runtime/composables/useIdentityDoc.js +0 -3
- package/dist/runtime/composables/useItemPresence.d.ts +47 -0
- package/dist/runtime/composables/useItemPresence.js +73 -0
- package/dist/runtime/composables/useResizableWidth.d.ts +24 -0
- package/dist/runtime/composables/useResizableWidth.js +87 -0
- package/dist/runtime/composables/useServerInfo.d.ts +17 -2
- package/dist/runtime/composables/useServerInfo.js +30 -6
- package/dist/runtime/composables/useServerSearch.d.ts +36 -0
- package/dist/runtime/composables/useServerSearch.js +91 -0
- package/dist/runtime/composables/useServerTrash.d.ts +67 -0
- package/dist/runtime/composables/useServerTrash.js +128 -0
- package/dist/runtime/composables/useSheetsClipboard.d.ts +42 -0
- package/dist/runtime/composables/useSheetsClipboard.js +109 -0
- package/dist/runtime/composables/useSheetsFormulas.d.ts +38 -0
- package/dist/runtime/composables/useSheetsFormulas.js +725 -0
- package/dist/runtime/composables/useSheetsSelection.d.ts +68 -0
- package/dist/runtime/composables/useSheetsSelection.js +390 -0
- package/dist/runtime/composables/useSheetsView.d.ts +31 -0
- package/dist/runtime/composables/useSheetsView.js +77 -0
- package/dist/runtime/composables/useSpaceConnections.d.ts +43 -0
- package/dist/runtime/composables/useSpaceConnections.js +72 -0
- package/dist/runtime/composables/useSpaces.d.ts +1 -3
- package/dist/runtime/composables/useSpaces.js +2 -5
- package/dist/runtime/composables/useTiptapHistory.d.ts +22 -0
- package/dist/runtime/composables/useTiptapHistory.js +12 -0
- package/dist/runtime/composables/useTreeExpansion.d.ts +28 -0
- package/dist/runtime/composables/useTreeExpansion.js +94 -0
- package/dist/runtime/composables/useYDoc.js +12 -1
- package/dist/runtime/extensions/button.d.ts +3 -0
- package/dist/runtime/extensions/button.js +62 -0
- package/dist/runtime/extensions/color-swatch.d.ts +2 -0
- package/dist/runtime/extensions/color-swatch.js +34 -0
- package/dist/runtime/extensions/diff.d.ts +2 -0
- package/dist/runtime/extensions/diff.js +40 -0
- package/dist/runtime/extensions/divider.d.ts +2 -0
- package/dist/runtime/extensions/divider.js +33 -0
- package/dist/runtime/extensions/embed.d.ts +2 -0
- package/dist/runtime/extensions/embed.js +40 -0
- package/dist/runtime/extensions/figure.d.ts +2 -0
- package/dist/runtime/extensions/figure.js +49 -0
- package/dist/runtime/extensions/math.d.ts +15 -0
- package/dist/runtime/extensions/math.js +66 -0
- package/dist/runtime/extensions/progress.d.ts +2 -0
- package/dist/runtime/extensions/progress.js +43 -0
- package/dist/runtime/extensions/quote.d.ts +2 -0
- package/dist/runtime/extensions/quote.js +39 -0
- package/dist/runtime/extensions/spoiler.d.ts +2 -0
- package/dist/runtime/extensions/spoiler.js +36 -0
- package/dist/runtime/extensions/stat.d.ts +3 -0
- package/dist/runtime/extensions/stat.js +58 -0
- package/dist/runtime/extensions/video.d.ts +2 -0
- package/dist/runtime/extensions/video.js +40 -0
- package/dist/runtime/extensions/views/ButtonGroupView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/ButtonGroupView.vue +25 -0
- package/dist/runtime/extensions/views/ButtonGroupView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/ButtonView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/ButtonView.vue +171 -0
- package/dist/runtime/extensions/views/ButtonView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/ColorSwatchView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/ColorSwatchView.vue +134 -0
- package/dist/runtime/extensions/views/ColorSwatchView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/DiffView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/DiffView.vue +163 -0
- package/dist/runtime/extensions/views/DiffView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/DividerView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/DividerView.vue +40 -0
- package/dist/runtime/extensions/views/DividerView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/EmbedView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/EmbedView.vue +166 -0
- package/dist/runtime/extensions/views/EmbedView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/FigureView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/FigureView.vue +122 -0
- package/dist/runtime/extensions/views/FigureView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/FileNodeView.vue +21 -24
- package/dist/runtime/extensions/views/MathBlockView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/MathBlockView.vue +151 -0
- package/dist/runtime/extensions/views/MathBlockView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/MathInlineView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/MathInlineView.vue +149 -0
- package/dist/runtime/extensions/views/MathInlineView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/MetaFieldView.vue +1129 -550
- package/dist/runtime/extensions/views/ProgressView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/ProgressView.vue +156 -0
- package/dist/runtime/extensions/views/ProgressView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/QuoteView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/QuoteView.vue +128 -0
- package/dist/runtime/extensions/views/QuoteView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/SpoilerView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/SpoilerView.vue +62 -0
- package/dist/runtime/extensions/views/SpoilerView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/StatGroupView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/StatGroupView.vue +25 -0
- package/dist/runtime/extensions/views/StatGroupView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/StatView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/StatView.vue +89 -0
- package/dist/runtime/extensions/views/StatView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/VideoView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/VideoView.vue +190 -0
- package/dist/runtime/extensions/views/VideoView.vue.d.ts +4 -0
- package/dist/runtime/locale.d.ts +133 -0
- package/dist/runtime/locale.js +121 -2
- package/dist/runtime/plugin-abracadabra.client.js +233 -36
- package/dist/runtime/plugin-abracadabra.server.js +0 -1
- package/dist/runtime/plugins/core.plugin.js +73 -4
- package/dist/runtime/server/plugins/abracadabra-service.js +1 -1
- package/dist/runtime/server/utils/rpcHandler.d.ts +74 -0
- package/dist/runtime/server/utils/rpcHandler.js +74 -0
- package/dist/runtime/server/utils/spaceManager.js +10 -9
- package/dist/runtime/types.d.ts +63 -10
- package/dist/runtime/utils/awareRingStyle.d.ts +22 -0
- package/dist/runtime/utils/awareRingStyle.js +16 -0
- package/dist/runtime/utils/caretCoordinates.d.ts +41 -0
- package/dist/runtime/utils/caretCoordinates.js +126 -0
- package/dist/runtime/utils/content.d.ts +1 -1
- package/dist/runtime/utils/docTypes.js +44 -13
- package/dist/runtime/utils/domPath.d.ts +42 -0
- package/dist/runtime/utils/domPath.js +89 -0
- package/dist/runtime/utils/loadKatex.d.ts +1 -0
- package/dist/runtime/utils/loadKatex.js +29 -0
- package/dist/runtime/utils/lucideIcons.d.ts +16 -0
- package/dist/runtime/utils/lucideIcons.js +451 -0
- package/dist/runtime/utils/time.d.ts +15 -0
- package/dist/runtime/utils/time.js +5 -0
- package/dist/types.d.mts +4 -0
- package/package.json +27 -16
|
@@ -0,0 +1,865 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, watch, inject, nextTick, onBeforeUnmount } from "vue";
|
|
3
|
+
import { useRuntimeConfig } from "#imports";
|
|
4
|
+
import { useMediaQuery } from "@vueuse/core";
|
|
5
|
+
import { useRendererBase } from "../../composables/useRendererBase";
|
|
6
|
+
import { useNodePanel } from "../../composables/useNodePanel";
|
|
7
|
+
import { useNodePanelFollow } from "../../composables/useNodePanelFollow";
|
|
8
|
+
import { treeUndoKey } from "../../composables/useTreeUndoManager";
|
|
9
|
+
import { useSheetsView } from "../../composables/useSheetsView";
|
|
10
|
+
import { useSheetsSelection } from "../../composables/useSheetsSelection";
|
|
11
|
+
import { useSheetsClipboard } from "../../composables/useSheetsClipboard";
|
|
12
|
+
import {
|
|
13
|
+
evaluateFormula,
|
|
14
|
+
formatFormulaResult,
|
|
15
|
+
FormulaError,
|
|
16
|
+
extractCellRefs,
|
|
17
|
+
adjustFormulaRefs
|
|
18
|
+
} from "../../composables/useSheetsFormulas";
|
|
19
|
+
import { useDocumentPermissions } from "../../composables/useDocumentPermissions";
|
|
20
|
+
import { useAbracadabra } from "../../composables/useAbracadabra";
|
|
21
|
+
import { DEFAULT_LOCALE } from "../../locale";
|
|
22
|
+
import ASheetsToolbar from "./sheets/ASheetsToolbar.vue";
|
|
23
|
+
import ASheetsGrid from "./sheets/ASheetsGrid.vue";
|
|
24
|
+
import ASheetsMobileActionBar from "./sheets/ASheetsMobileActionBar.vue";
|
|
25
|
+
const props = defineProps({
|
|
26
|
+
docId: { type: String, required: true },
|
|
27
|
+
childProvider: { type: null, required: true },
|
|
28
|
+
docLabel: { type: String, required: true },
|
|
29
|
+
pageTypes: { type: Array, required: false },
|
|
30
|
+
followingUser: { type: [String, null], required: false, default: null },
|
|
31
|
+
labels: { type: Object, required: false }
|
|
32
|
+
});
|
|
33
|
+
const config = useRuntimeConfig();
|
|
34
|
+
const locale = computed(() => ({
|
|
35
|
+
...DEFAULT_LOCALE.renderers.sheets,
|
|
36
|
+
...config.public?.abracadabra?.locale?.renderers?.sheets ?? {},
|
|
37
|
+
...props.labels ?? {}
|
|
38
|
+
}));
|
|
39
|
+
const { childProviderRef, childDoc: _childDoc, rootDoc, tree, connectedUsers, states, setLocalState } = useRendererBase(props);
|
|
40
|
+
const { canWrite } = useDocumentPermissions(useAbracadabra().effectiveRole);
|
|
41
|
+
const {
|
|
42
|
+
openNodeId,
|
|
43
|
+
openNodeLabel,
|
|
44
|
+
openNodeProvider,
|
|
45
|
+
isLoading: nodePanelLoading,
|
|
46
|
+
openNode,
|
|
47
|
+
closePanel
|
|
48
|
+
} = useNodePanel(childProviderRef);
|
|
49
|
+
useNodePanelFollow(openNodeId, openNodeLabel, openNode, closePanel, () => props.followingUser, states, setLocalState);
|
|
50
|
+
const isMobile = useMediaQuery("(max-width: 640px)");
|
|
51
|
+
const sheetsView = useSheetsView(tree, props.docId);
|
|
52
|
+
const MIN_DISPLAY_COLS = 26;
|
|
53
|
+
const MIN_DISPLAY_ROWS = 50;
|
|
54
|
+
const columns = computed(() => tree.childrenOf(null));
|
|
55
|
+
const dataRowCount = computed(() => {
|
|
56
|
+
let max = 0;
|
|
57
|
+
for (const col of columns.value) {
|
|
58
|
+
const count = tree.childrenOf(col.id).length;
|
|
59
|
+
if (count > max) max = count;
|
|
60
|
+
}
|
|
61
|
+
return max + 1;
|
|
62
|
+
});
|
|
63
|
+
const displayRowCount = computed(() => Math.max(dataRowCount.value, MIN_DISPLAY_ROWS));
|
|
64
|
+
const columnPositions = computed(
|
|
65
|
+
() => sheetsView.getColumnPositions(columns.value, MIN_DISPLAY_COLS)
|
|
66
|
+
);
|
|
67
|
+
function getCellEntry(colIdx, rowIdx) {
|
|
68
|
+
const col = columns.value[colIdx];
|
|
69
|
+
if (!col) return void 0;
|
|
70
|
+
return tree.childrenOf(col.id)[rowIdx];
|
|
71
|
+
}
|
|
72
|
+
function getCellValue(colIdx, rowIdx) {
|
|
73
|
+
const entry = getCellEntry(colIdx, rowIdx);
|
|
74
|
+
if (!entry) return "";
|
|
75
|
+
return entry.label === "Untitled" ? "" : entry.label;
|
|
76
|
+
}
|
|
77
|
+
function childrenOfLive(parentId) {
|
|
78
|
+
const yMap = tree.treeMap.yMap?.value;
|
|
79
|
+
if (!yMap) return [];
|
|
80
|
+
const target = parentId === null ? props.docId : parentId;
|
|
81
|
+
const list = [];
|
|
82
|
+
yMap.forEach((v, id) => {
|
|
83
|
+
const raw = v && typeof v === "object" && "toJSON" in v && typeof v.toJSON === "function" && v._map !== void 0 ? v.toJSON() : v;
|
|
84
|
+
const pid = raw.parentId ?? null;
|
|
85
|
+
if (pid !== target) return;
|
|
86
|
+
list.push({
|
|
87
|
+
id,
|
|
88
|
+
label: raw.label || "Untitled",
|
|
89
|
+
parentId: pid,
|
|
90
|
+
order: raw.order ?? 0,
|
|
91
|
+
meta: raw.meta
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
list.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
95
|
+
return list;
|
|
96
|
+
}
|
|
97
|
+
function getCellComputedValue(colIdx, rowIdx) {
|
|
98
|
+
const entry = getCellEntry(colIdx, rowIdx);
|
|
99
|
+
if (!entry) return 0;
|
|
100
|
+
if (entry.meta?.number !== void 0 && entry.meta.number !== null) return entry.meta.number;
|
|
101
|
+
const label = entry.label === "Untitled" ? "" : entry.label;
|
|
102
|
+
const num = Number(label);
|
|
103
|
+
return label !== "" && !isNaN(num) ? num : label;
|
|
104
|
+
}
|
|
105
|
+
function makeFormulaCtx() {
|
|
106
|
+
return {
|
|
107
|
+
getCellValue: getCellComputedValue,
|
|
108
|
+
colLetterToIndex: sheetsView.colLetterToIndex,
|
|
109
|
+
indexToColLetter: sheetsView.indexToColLetter,
|
|
110
|
+
evaluating: /* @__PURE__ */ new Set()
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function recalcFormulas() {
|
|
114
|
+
const ctx = makeFormulaCtx();
|
|
115
|
+
const cols = columns.value;
|
|
116
|
+
for (let colIdx = 0; colIdx < cols.length; colIdx++) {
|
|
117
|
+
const cells = tree.childrenOf(cols[colIdx].id);
|
|
118
|
+
for (let rowIdx = 0; rowIdx < cells.length; rowIdx++) {
|
|
119
|
+
const cell = cells[rowIdx];
|
|
120
|
+
const formula = cell.meta?.formula;
|
|
121
|
+
if (!formula) continue;
|
|
122
|
+
ctx.evaluating.clear();
|
|
123
|
+
ctx.evaluating.add(`${colIdx}:${rowIdx}`);
|
|
124
|
+
const result = evaluateFormula(formula, ctx);
|
|
125
|
+
ctx.evaluating.clear();
|
|
126
|
+
const display = formatFormulaResult(result);
|
|
127
|
+
if (cell.label !== display) tree.renameEntry(cell.id, display);
|
|
128
|
+
const numVal = result instanceof FormulaError ? void 0 : typeof result === "number" ? result : void 0;
|
|
129
|
+
if (cell.meta?.number !== numVal) tree.updateMeta(cell.id, { number: numVal });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function ensureCell(colIdx, rowIdx) {
|
|
134
|
+
let colsLive = childrenOfLive(null);
|
|
135
|
+
if (!colsLive[colIdx]) {
|
|
136
|
+
for (let i = colsLive.length; i <= colIdx; i++) {
|
|
137
|
+
tree.createChild(null, sheetsView.indexToColLetter(i));
|
|
138
|
+
}
|
|
139
|
+
colsLive = childrenOfLive(null);
|
|
140
|
+
}
|
|
141
|
+
const col = colsLive[colIdx];
|
|
142
|
+
if (!col) return "";
|
|
143
|
+
const cells = childrenOfLive(col.id);
|
|
144
|
+
const existing = cells[rowIdx];
|
|
145
|
+
if (existing) return existing.id;
|
|
146
|
+
for (let i = cells.length; i < rowIdx; i++) {
|
|
147
|
+
tree.createChild(col.id, "");
|
|
148
|
+
}
|
|
149
|
+
return tree.createChild(col.id, "");
|
|
150
|
+
}
|
|
151
|
+
function writeCellValue(colIdx, rowIdx, value) {
|
|
152
|
+
const cellId = ensureCell(colIdx, rowIdx);
|
|
153
|
+
if (!cellId) return;
|
|
154
|
+
if (value.startsWith("=")) {
|
|
155
|
+
const formulaText = value.slice(1);
|
|
156
|
+
const ctx = makeFormulaCtx();
|
|
157
|
+
ctx.evaluating.add(`${colIdx}:${rowIdx}`);
|
|
158
|
+
const result = evaluateFormula(formulaText, ctx);
|
|
159
|
+
const display = formatFormulaResult(result);
|
|
160
|
+
tree.renameEntry(cellId, display);
|
|
161
|
+
tree.updateMeta(cellId, {
|
|
162
|
+
formula: formulaText,
|
|
163
|
+
number: result instanceof FormulaError ? void 0 : typeof result === "number" ? result : void 0
|
|
164
|
+
});
|
|
165
|
+
} else {
|
|
166
|
+
tree.renameEntry(cellId, value);
|
|
167
|
+
const num = Number(value);
|
|
168
|
+
tree.updateMeta(cellId, {
|
|
169
|
+
formula: void 0,
|
|
170
|
+
number: value !== "" && !isNaN(num) ? num : void 0
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function commitCellValue(colIdx, rowIdx, value) {
|
|
175
|
+
writeCellValue(colIdx, rowIdx, value);
|
|
176
|
+
recalcFormulas();
|
|
177
|
+
stopUndoCapturing();
|
|
178
|
+
}
|
|
179
|
+
function clearCellValue(colIdx, rowIdx) {
|
|
180
|
+
const entry = getCellEntry(colIdx, rowIdx);
|
|
181
|
+
if (entry) {
|
|
182
|
+
tree.renameEntry(entry.id, "");
|
|
183
|
+
tree.updateMeta(entry.id, { number: void 0, formula: void 0 });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function clearCell(colIdx, rowIdx) {
|
|
187
|
+
clearCellValue(colIdx, rowIdx);
|
|
188
|
+
recalcFormulas();
|
|
189
|
+
stopUndoCapturing();
|
|
190
|
+
}
|
|
191
|
+
function transact(fn) {
|
|
192
|
+
const doc = rootDoc.value;
|
|
193
|
+
if (doc) doc.transact(fn);
|
|
194
|
+
else fn();
|
|
195
|
+
}
|
|
196
|
+
const treeUndo = inject(treeUndoKey, null);
|
|
197
|
+
function stopUndoCapturing() {
|
|
198
|
+
treeUndo?.undoManager.value?.stopCapturing();
|
|
199
|
+
}
|
|
200
|
+
function getCellEditableValue(colIdx, rowIdx) {
|
|
201
|
+
const entry = getCellEntry(colIdx, rowIdx);
|
|
202
|
+
if (entry?.meta?.formula) return `=${entry.meta.formula}`;
|
|
203
|
+
return getCellValue(colIdx, rowIdx);
|
|
204
|
+
}
|
|
205
|
+
const selection = useSheetsSelection({
|
|
206
|
+
colCount: computed(() => Math.max(columns.value.length + 1, MIN_DISPLAY_COLS)),
|
|
207
|
+
rowCount: displayRowCount,
|
|
208
|
+
getCellValue: getCellEditableValue,
|
|
209
|
+
commitValue: commitCellValue,
|
|
210
|
+
clearCell,
|
|
211
|
+
clearCellValue,
|
|
212
|
+
transact,
|
|
213
|
+
recalcFormulas
|
|
214
|
+
});
|
|
215
|
+
const clipboard = useSheetsClipboard({
|
|
216
|
+
activeCell: selection.activeCell,
|
|
217
|
+
normalizedRange: selection.normalizedRange,
|
|
218
|
+
onCommit: () => stopUndoCapturing(),
|
|
219
|
+
getCellValue,
|
|
220
|
+
commitCellValue,
|
|
221
|
+
writeCellValue,
|
|
222
|
+
clearCell,
|
|
223
|
+
clearCellValue,
|
|
224
|
+
transact,
|
|
225
|
+
recalcFormulas
|
|
226
|
+
});
|
|
227
|
+
watch([() => selection.activeCell.value, () => selection.editMode.value], () => {
|
|
228
|
+
const ac = selection.activeCell.value;
|
|
229
|
+
if (ac) {
|
|
230
|
+
setLocalState({
|
|
231
|
+
"sheets:activeCell": {
|
|
232
|
+
colIdx: ac.colIdx,
|
|
233
|
+
rowIdx: ac.rowIdx,
|
|
234
|
+
editing: selection.editMode.value,
|
|
235
|
+
t: Date.now()
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
} else {
|
|
239
|
+
setLocalState({ "sheets:activeCell": null });
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
watch(() => {
|
|
243
|
+
const ac = selection.activeCell.value;
|
|
244
|
+
return ac ? `${ac.colIdx}:${ac.rowIdx}` : null;
|
|
245
|
+
}, () => {
|
|
246
|
+
stopUndoCapturing();
|
|
247
|
+
});
|
|
248
|
+
watch(() => selection.selectionRange.value, (range) => {
|
|
249
|
+
if (props.followingUser) return;
|
|
250
|
+
setLocalState({
|
|
251
|
+
"sheets:selection": range ? { startCol: range.startCol, startRow: range.startRow, endCol: range.endCol, endRow: range.endRow, t: Date.now() } : null
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
onBeforeUnmount(() => {
|
|
255
|
+
setLocalState({ "sheets:activeCell": null, "sheets:selection": null });
|
|
256
|
+
});
|
|
257
|
+
const remoteEditors = computed(() => {
|
|
258
|
+
const map = /* @__PURE__ */ new Map();
|
|
259
|
+
for (const s of states.value) {
|
|
260
|
+
const ac = s["sheets:activeCell"];
|
|
261
|
+
if (ac?.editing && s.user) {
|
|
262
|
+
const key = `${ac.colIdx}:${ac.rowIdx}`;
|
|
263
|
+
map.set(key, { name: s.user.name ?? "", color: s.user.color ?? "#888" });
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return map;
|
|
267
|
+
});
|
|
268
|
+
const remoteActiveCells = computed(() => {
|
|
269
|
+
const map = /* @__PURE__ */ new Map();
|
|
270
|
+
for (const s of states.value) {
|
|
271
|
+
const ac = s["sheets:activeCell"];
|
|
272
|
+
if (ac && !ac.editing && s.user) {
|
|
273
|
+
const key = `${ac.colIdx}:${ac.rowIdx}`;
|
|
274
|
+
map.set(key, { name: s.user.name ?? "", color: s.user.color ?? "#888" });
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return map;
|
|
278
|
+
});
|
|
279
|
+
const remoteSelections = computed(() => {
|
|
280
|
+
const result = [];
|
|
281
|
+
for (const s of states.value) {
|
|
282
|
+
const sel = s["sheets:selection"];
|
|
283
|
+
if (sel && s.user) {
|
|
284
|
+
result.push({
|
|
285
|
+
name: s.user.name ?? "",
|
|
286
|
+
color: s.user.color ?? "#888",
|
|
287
|
+
minCol: Math.min(sel.startCol, sel.endCol),
|
|
288
|
+
maxCol: Math.max(sel.startCol, sel.endCol),
|
|
289
|
+
minRow: Math.min(sel.startRow, sel.endRow),
|
|
290
|
+
maxRow: Math.max(sel.startRow, sel.endRow)
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return result;
|
|
295
|
+
});
|
|
296
|
+
const sheetsGridRef = ref(null);
|
|
297
|
+
let lastFollowedCellKey = "";
|
|
298
|
+
watch([() => props.followingUser, states], () => {
|
|
299
|
+
const key = props.followingUser;
|
|
300
|
+
if (!key) return;
|
|
301
|
+
const state = states.value.find((s) => s.user?.publicKey === key);
|
|
302
|
+
const ac = state?.["sheets:activeCell"];
|
|
303
|
+
if (!ac) return;
|
|
304
|
+
const cellKey = `${ac.colIdx}:${ac.rowIdx}`;
|
|
305
|
+
if (cellKey === lastFollowedCellKey) return;
|
|
306
|
+
lastFollowedCellKey = cellKey;
|
|
307
|
+
sheetsGridRef.value?.scrollToCell?.(ac.colIdx, ac.rowIdx);
|
|
308
|
+
});
|
|
309
|
+
const cellRef = computed(() => {
|
|
310
|
+
if (!selection.activeCell.value) return "";
|
|
311
|
+
const { colIdx, rowIdx } = selection.activeCell.value;
|
|
312
|
+
return `${sheetsView.indexToColLetter(colIdx)}${rowIdx + 1}`;
|
|
313
|
+
});
|
|
314
|
+
const cellDisplayValue = computed(() => {
|
|
315
|
+
if (!selection.activeCell.value) return "";
|
|
316
|
+
const entry = getCellEntry(selection.activeCell.value.colIdx, selection.activeCell.value.rowIdx);
|
|
317
|
+
if (entry?.meta?.formula) return `=${entry.meta.formula}`;
|
|
318
|
+
return getCellValue(selection.activeCell.value.colIdx, selection.activeCell.value.rowIdx);
|
|
319
|
+
});
|
|
320
|
+
function getSelectionBounds() {
|
|
321
|
+
const range = selection.normalizedRange.value;
|
|
322
|
+
const ac = selection.activeCell.value;
|
|
323
|
+
if (!range && !ac) return null;
|
|
324
|
+
return {
|
|
325
|
+
startCol: range?.startCol ?? ac.colIdx,
|
|
326
|
+
endCol: range?.endCol ?? ac.colIdx,
|
|
327
|
+
startRow: range?.startRow ?? ac.rowIdx,
|
|
328
|
+
endRow: range?.endRow ?? ac.rowIdx
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function getSelectionFormat(key) {
|
|
332
|
+
const bounds = getSelectionBounds();
|
|
333
|
+
if (!bounds) return void 0;
|
|
334
|
+
let commonVal = void 0;
|
|
335
|
+
let first = true;
|
|
336
|
+
for (let c = bounds.startCol; c <= bounds.endCol; c++) {
|
|
337
|
+
for (let r = bounds.startRow; r <= bounds.endRow; r++) {
|
|
338
|
+
const entry = getCellEntry(c, r);
|
|
339
|
+
const val = entry?.meta?.[key];
|
|
340
|
+
if (first) {
|
|
341
|
+
commonVal = val;
|
|
342
|
+
first = false;
|
|
343
|
+
} else if (val !== commonVal) return void 0;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return commonVal;
|
|
347
|
+
}
|
|
348
|
+
function applyFormatting(key, value) {
|
|
349
|
+
const bounds = getSelectionBounds();
|
|
350
|
+
if (!bounds) return;
|
|
351
|
+
transact(() => {
|
|
352
|
+
for (let c = bounds.startCol; c <= bounds.endCol; c++) {
|
|
353
|
+
for (let r = bounds.startRow; r <= bounds.endRow; r++) {
|
|
354
|
+
const cellId = ensureCell(c, r);
|
|
355
|
+
if (cellId) tree.updateMeta(cellId, { [key]: value });
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
stopUndoCapturing();
|
|
360
|
+
}
|
|
361
|
+
function toggleFormat(key) {
|
|
362
|
+
const current = getSelectionFormat(key);
|
|
363
|
+
applyFormatting(key, !current);
|
|
364
|
+
}
|
|
365
|
+
const selectionFormats = computed(() => {
|
|
366
|
+
const bounds = getSelectionBounds();
|
|
367
|
+
if (!bounds) return { bold: false, italic: false, align: void 0, textColor: void 0, bgColor: void 0, numberFormat: void 0 };
|
|
368
|
+
const keys = ["bold", "italic", "align", "textColor", "bgColor", "numberFormat"];
|
|
369
|
+
const common = {};
|
|
370
|
+
const first = {};
|
|
371
|
+
let isFirst = true;
|
|
372
|
+
for (let c = bounds.startCol; c <= bounds.endCol; c++) {
|
|
373
|
+
for (let r = bounds.startRow; r <= bounds.endRow; r++) {
|
|
374
|
+
const entry = getCellEntry(c, r);
|
|
375
|
+
for (const key of keys) {
|
|
376
|
+
const val = entry?.meta?.[key];
|
|
377
|
+
if (isFirst) {
|
|
378
|
+
first[key] = val;
|
|
379
|
+
common[key] = val;
|
|
380
|
+
} else if (common[key] !== val) common[key] = void 0;
|
|
381
|
+
}
|
|
382
|
+
isFirst = false;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return {
|
|
386
|
+
bold: !!common.bold,
|
|
387
|
+
italic: !!common.italic,
|
|
388
|
+
align: common.align,
|
|
389
|
+
textColor: common.textColor,
|
|
390
|
+
bgColor: common.bgColor,
|
|
391
|
+
numberFormat: common.numberFormat
|
|
392
|
+
};
|
|
393
|
+
});
|
|
394
|
+
const selectionBold = computed(() => selectionFormats.value.bold);
|
|
395
|
+
const selectionItalic = computed(() => selectionFormats.value.italic);
|
|
396
|
+
const selectionAlign = computed(() => selectionFormats.value.align);
|
|
397
|
+
const selectionTextColor = computed(() => selectionFormats.value.textColor);
|
|
398
|
+
const selectionBgColor = computed(() => selectionFormats.value.bgColor);
|
|
399
|
+
const selectionNumberFormat = computed(() => selectionFormats.value.numberFormat);
|
|
400
|
+
const formulaRefMode = computed(
|
|
401
|
+
() => selection.editMode.value && selection.editValue.value.startsWith("=")
|
|
402
|
+
);
|
|
403
|
+
const REF_COLORS = ["#3b82f6", "#ef4444", "#22c55e", "#a855f7", "#f97316"];
|
|
404
|
+
const formulaRefHighlights = computed(() => {
|
|
405
|
+
if (!formulaRefMode.value) return /* @__PURE__ */ new Map();
|
|
406
|
+
const formula = selection.editValue.value.slice(1);
|
|
407
|
+
const refs = extractCellRefs(formula);
|
|
408
|
+
const map = /* @__PURE__ */ new Map();
|
|
409
|
+
refs.forEach((r, idx) => {
|
|
410
|
+
const color = REF_COLORS[idx % REF_COLORS.length];
|
|
411
|
+
if ("range" in r) {
|
|
412
|
+
const minC = Math.min(r.startCol, r.endCol);
|
|
413
|
+
const maxC = Math.max(r.startCol, r.endCol);
|
|
414
|
+
const minR = Math.min(r.startRow, r.endRow);
|
|
415
|
+
const maxR = Math.max(r.startRow, r.endRow);
|
|
416
|
+
for (let c = minC; c <= maxC; c++) {
|
|
417
|
+
for (let row = minR; row <= maxR; row++) {
|
|
418
|
+
map.set(`${c}:${row}`, color);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
} else {
|
|
422
|
+
map.set(`${r.colIdx}:${r.rowIdx}`, color);
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
return map;
|
|
426
|
+
});
|
|
427
|
+
const formulaRefDragStart = ref(null);
|
|
428
|
+
function onFormulaRefDragStart(colIdx, rowIdx) {
|
|
429
|
+
formulaRefDragStart.value = { colIdx, rowIdx };
|
|
430
|
+
insertFormulaRef(colIdx, rowIdx, colIdx, rowIdx);
|
|
431
|
+
}
|
|
432
|
+
function onFormulaRefDragMove(colIdx, rowIdx) {
|
|
433
|
+
if (!formulaRefDragStart.value) return;
|
|
434
|
+
const start = formulaRefDragStart.value;
|
|
435
|
+
insertFormulaRef(start.colIdx, start.rowIdx, colIdx, rowIdx);
|
|
436
|
+
}
|
|
437
|
+
function onFormulaRefDragEnd() {
|
|
438
|
+
formulaRefDragStart.value = null;
|
|
439
|
+
}
|
|
440
|
+
function insertFormulaRef(startCol, startRow, endCol, endRow) {
|
|
441
|
+
const val = selection.editValue.value;
|
|
442
|
+
const insertPos = findFormulaInsertPos(val);
|
|
443
|
+
const prefix = val.slice(0, insertPos);
|
|
444
|
+
const startRef = `${sheetsView.indexToColLetter(startCol)}${startRow + 1}`;
|
|
445
|
+
let ref2;
|
|
446
|
+
if (startCol === endCol && startRow === endRow) {
|
|
447
|
+
ref2 = startRef;
|
|
448
|
+
} else {
|
|
449
|
+
const endRef = `${sheetsView.indexToColLetter(endCol)}${endRow + 1}`;
|
|
450
|
+
ref2 = `${startRef}:${endRef}`;
|
|
451
|
+
}
|
|
452
|
+
selection.editValue.value = prefix + ref2;
|
|
453
|
+
}
|
|
454
|
+
function findFormulaInsertPos(val) {
|
|
455
|
+
let lastDelim = 0;
|
|
456
|
+
for (let i = 0; i < val.length; i++) {
|
|
457
|
+
const ch = val[i];
|
|
458
|
+
if (ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "^" || ch === "(" || ch === "," || ch === "=" || ch === ">" || ch === "<" || ch === " ") {
|
|
459
|
+
lastDelim = i + 1;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return lastDelim;
|
|
463
|
+
}
|
|
464
|
+
function orderBetween(list, targetIdx) {
|
|
465
|
+
const prev = list[targetIdx - 1];
|
|
466
|
+
const next = list[targetIdx];
|
|
467
|
+
if (!prev && !next) return Date.now();
|
|
468
|
+
if (!prev) return next.order - 1e3;
|
|
469
|
+
if (!next) return prev.order + 1e3;
|
|
470
|
+
return (prev.order + next.order) / 2;
|
|
471
|
+
}
|
|
472
|
+
function relabelColumns() {
|
|
473
|
+
const cols = tree.childrenOf(null);
|
|
474
|
+
for (let i = 0; i < cols.length; i++) {
|
|
475
|
+
const expected = sheetsView.indexToColLetter(i);
|
|
476
|
+
if (cols[i].label !== expected) {
|
|
477
|
+
tree.renameEntry(cols[i].id, expected);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
function insertRowAt(rowIdx) {
|
|
482
|
+
transact(() => {
|
|
483
|
+
for (const col of columns.value) {
|
|
484
|
+
const cells = tree.childrenOf(col.id);
|
|
485
|
+
const order = orderBetween(cells, rowIdx);
|
|
486
|
+
const id = tree.createChild(col.id, "");
|
|
487
|
+
tree.moveEntry(id, col.id, order);
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
function insertColAt(colIdx) {
|
|
492
|
+
transact(() => {
|
|
493
|
+
const cols = columns.value;
|
|
494
|
+
const order = orderBetween(cols, colIdx);
|
|
495
|
+
tree.createChild(null, sheetsView.indexToColLetter(colIdx));
|
|
496
|
+
const newCols = tree.childrenOf(null);
|
|
497
|
+
const created = newCols[newCols.length - 1];
|
|
498
|
+
if (created) tree.moveEntry(created.id, null, order);
|
|
499
|
+
relabelColumns();
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
function deleteColumnAt(colIdx) {
|
|
503
|
+
const col = columns.value[colIdx];
|
|
504
|
+
if (!col) return;
|
|
505
|
+
transact(() => {
|
|
506
|
+
tree.deleteEntry(col.id);
|
|
507
|
+
relabelColumns();
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
function deleteRowAt(rowIdx) {
|
|
511
|
+
transact(() => {
|
|
512
|
+
for (const col of columns.value) {
|
|
513
|
+
const cells = tree.childrenOf(col.id);
|
|
514
|
+
const cell = cells[rowIdx];
|
|
515
|
+
if (cell) tree.deleteEntry(cell.id);
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
const fillTargetRow = ref(null);
|
|
520
|
+
const fillPreview = computed(() => {
|
|
521
|
+
const target = fillTargetRow.value;
|
|
522
|
+
if (target === null) return null;
|
|
523
|
+
const range = selection.normalizedRange.value;
|
|
524
|
+
const ac = selection.activeCell.value;
|
|
525
|
+
if (!ac) return null;
|
|
526
|
+
const startCol = range?.startCol ?? ac.colIdx;
|
|
527
|
+
const endCol = range?.endCol ?? ac.colIdx;
|
|
528
|
+
const srcStartRow = range?.startRow ?? ac.rowIdx;
|
|
529
|
+
const srcEndRow = range?.endRow ?? ac.rowIdx;
|
|
530
|
+
if (target >= srcStartRow && target <= srcEndRow) return null;
|
|
531
|
+
const fillDown = target > srcEndRow;
|
|
532
|
+
return {
|
|
533
|
+
startCol,
|
|
534
|
+
endCol,
|
|
535
|
+
fromRow: fillDown ? srcEndRow + 1 : target,
|
|
536
|
+
toRow: fillDown ? target : srcStartRow - 1
|
|
537
|
+
};
|
|
538
|
+
});
|
|
539
|
+
function onFillDragStart(rowIdx) {
|
|
540
|
+
fillTargetRow.value = rowIdx;
|
|
541
|
+
}
|
|
542
|
+
function onFillDragMove(rowIdx) {
|
|
543
|
+
fillTargetRow.value = rowIdx;
|
|
544
|
+
}
|
|
545
|
+
function onFillDragEnd() {
|
|
546
|
+
const target = fillTargetRow.value;
|
|
547
|
+
fillTargetRow.value = null;
|
|
548
|
+
if (target === null) return;
|
|
549
|
+
const range = selection.normalizedRange.value;
|
|
550
|
+
const ac = selection.activeCell.value;
|
|
551
|
+
if (!ac) return;
|
|
552
|
+
const startCol = range?.startCol ?? ac.colIdx;
|
|
553
|
+
const endCol = range?.endCol ?? ac.colIdx;
|
|
554
|
+
const srcStartRow = range?.startRow ?? ac.rowIdx;
|
|
555
|
+
const srcEndRow = range?.endRow ?? ac.rowIdx;
|
|
556
|
+
const srcLen = srcEndRow - srcStartRow + 1;
|
|
557
|
+
if (target <= srcEndRow && target >= srcStartRow) return;
|
|
558
|
+
transact(() => {
|
|
559
|
+
const fillDown = target > srcEndRow;
|
|
560
|
+
const fillStart = fillDown ? srcEndRow + 1 : target;
|
|
561
|
+
const fillEnd = fillDown ? target : srcStartRow - 1;
|
|
562
|
+
for (let r = fillStart; r <= fillEnd; r++) {
|
|
563
|
+
const srcRowIdx = srcStartRow + (r - fillStart) % srcLen;
|
|
564
|
+
const rowOffset = r - srcRowIdx;
|
|
565
|
+
for (let c = startCol; c <= endCol; c++) {
|
|
566
|
+
const srcEntry = getCellEntry(c, srcRowIdx);
|
|
567
|
+
const srcFormula = srcEntry?.meta?.formula;
|
|
568
|
+
const srcValue = getCellValue(c, srcRowIdx);
|
|
569
|
+
if (srcFormula) {
|
|
570
|
+
const adjusted = adjustFormulaRefs(srcFormula, 0, rowOffset);
|
|
571
|
+
writeCellValue(c, r, `=${adjusted}`);
|
|
572
|
+
} else if (srcLen >= 2 && srcValue !== "" && !isNaN(Number(srcValue))) {
|
|
573
|
+
const prevValue = getCellValue(c, srcRowIdx === srcStartRow && srcLen > 1 ? srcStartRow : srcRowIdx - 1);
|
|
574
|
+
if (prevValue !== "" && !isNaN(Number(prevValue)) && srcLen >= 2) {
|
|
575
|
+
const first = Number(getCellValue(c, srcStartRow));
|
|
576
|
+
const last = Number(getCellValue(c, srcEndRow));
|
|
577
|
+
const step = (last - first) / (srcLen - 1);
|
|
578
|
+
if (step !== 0) {
|
|
579
|
+
writeCellValue(c, r, String(first + step * (r - srcStartRow)));
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
writeCellValue(c, r, srcValue);
|
|
584
|
+
} else {
|
|
585
|
+
writeCellValue(c, r, srcValue);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
recalcFormulas();
|
|
590
|
+
});
|
|
591
|
+
stopUndoCapturing();
|
|
592
|
+
}
|
|
593
|
+
function autoFitColumn(colId) {
|
|
594
|
+
const colIdx = columns.value.findIndex((c) => c.id === colId);
|
|
595
|
+
if (colIdx === -1) return;
|
|
596
|
+
let maxWidth = 40;
|
|
597
|
+
for (let r = 0; r < dataRowCount.value; r++) {
|
|
598
|
+
const val = getCellValue(colIdx, r);
|
|
599
|
+
const width = val.length * 8 + 24;
|
|
600
|
+
if (width > maxWidth) maxWidth = width;
|
|
601
|
+
}
|
|
602
|
+
const col = columns.value[colIdx];
|
|
603
|
+
if (col) {
|
|
604
|
+
const headerWidth = col.label.length * 8 + 24;
|
|
605
|
+
if (headerWidth > maxWidth) maxWidth = headerWidth;
|
|
606
|
+
}
|
|
607
|
+
sheetsView.setColWidth(colId, Math.min(maxWidth, 400));
|
|
608
|
+
}
|
|
609
|
+
function sortByColumn(colIdx, ascending) {
|
|
610
|
+
const sortCol = columns.value[colIdx];
|
|
611
|
+
if (!sortCol) return;
|
|
612
|
+
transact(() => {
|
|
613
|
+
const sortCells = tree.childrenOf(sortCol.id);
|
|
614
|
+
const indices = sortCells.map((cell, i) => ({ idx: i, val: cell.label }));
|
|
615
|
+
indices.sort((a, b) => {
|
|
616
|
+
const na = Number(a.val);
|
|
617
|
+
const nb = Number(b.val);
|
|
618
|
+
const bothNum = !isNaN(na) && a.val !== "" && !isNaN(nb) && b.val !== "";
|
|
619
|
+
const cmp = bothNum ? na - nb : a.val.localeCompare(b.val);
|
|
620
|
+
return ascending ? cmp : -cmp;
|
|
621
|
+
});
|
|
622
|
+
for (const col of columns.value) {
|
|
623
|
+
const cells = tree.childrenOf(col.id);
|
|
624
|
+
let order = 1e3;
|
|
625
|
+
for (const { idx } of indices) {
|
|
626
|
+
const cell = cells[idx];
|
|
627
|
+
if (cell) tree.moveEntry(cell.id, col.id, order);
|
|
628
|
+
order += 1e3;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
recalcFormulas();
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
const cellContextItems = computed(() => {
|
|
635
|
+
if (!canWrite.value) return [];
|
|
636
|
+
const ac = selection.activeCell.value;
|
|
637
|
+
return [
|
|
638
|
+
[
|
|
639
|
+
{ label: locale.value.cut, icon: "i-lucide-scissors", onSelect: () => clipboard.cut() },
|
|
640
|
+
{ label: locale.value.copy, icon: "i-lucide-copy", onSelect: () => clipboard.copy() },
|
|
641
|
+
{ label: locale.value.paste, icon: "i-lucide-clipboard-paste", onSelect: () => clipboard.paste() }
|
|
642
|
+
],
|
|
643
|
+
[
|
|
644
|
+
{ label: locale.value.clearContents, icon: "i-lucide-eraser", onSelect: () => selection.clearRange() }
|
|
645
|
+
],
|
|
646
|
+
[
|
|
647
|
+
{ label: locale.value.sortAsc, icon: "i-lucide-arrow-up-a-z", onSelect: () => ac && sortByColumn(ac.colIdx, true) },
|
|
648
|
+
{ label: locale.value.sortDesc, icon: "i-lucide-arrow-down-z-a", onSelect: () => ac && sortByColumn(ac.colIdx, false) }
|
|
649
|
+
],
|
|
650
|
+
[
|
|
651
|
+
{ label: locale.value.insertRowAbove, icon: "i-lucide-arrow-up", onSelect: () => ac && insertRowAt(ac.rowIdx) },
|
|
652
|
+
{ label: locale.value.insertRowBelow, icon: "i-lucide-arrow-down", onSelect: () => ac && insertRowAt(ac.rowIdx + 1) }
|
|
653
|
+
],
|
|
654
|
+
[
|
|
655
|
+
{ label: locale.value.insertColumnLeft, icon: "i-lucide-arrow-left", onSelect: () => ac && insertColAt(ac.colIdx) },
|
|
656
|
+
{ label: locale.value.insertColumnRight, icon: "i-lucide-arrow-right", onSelect: () => ac && insertColAt(ac.colIdx + 1) }
|
|
657
|
+
],
|
|
658
|
+
[
|
|
659
|
+
{ label: locale.value.deleteRow, icon: "i-lucide-trash-2", color: "error", onSelect: () => ac && deleteRowAt(ac.rowIdx) },
|
|
660
|
+
{ label: locale.value.deleteColumn, icon: "i-lucide-trash-2", color: "error", onSelect: () => ac && deleteColumnAt(ac.colIdx) }
|
|
661
|
+
]
|
|
662
|
+
];
|
|
663
|
+
});
|
|
664
|
+
function colHeaderContextItems(colIdx) {
|
|
665
|
+
if (!canWrite.value) return [];
|
|
666
|
+
return [
|
|
667
|
+
[
|
|
668
|
+
{ label: locale.value.sortAsc, icon: "i-lucide-arrow-up-a-z", onSelect: () => sortByColumn(colIdx, true) },
|
|
669
|
+
{ label: locale.value.sortDesc, icon: "i-lucide-arrow-down-z-a", onSelect: () => sortByColumn(colIdx, false) }
|
|
670
|
+
],
|
|
671
|
+
[
|
|
672
|
+
{ label: locale.value.renameColumn, icon: "i-lucide-pencil", onSelect: () => {
|
|
673
|
+
} }
|
|
674
|
+
],
|
|
675
|
+
[
|
|
676
|
+
{ label: locale.value.insertColumnLeft, icon: "i-lucide-arrow-left", onSelect: () => insertColAt(colIdx) },
|
|
677
|
+
{ label: locale.value.insertColumnRight, icon: "i-lucide-arrow-right", onSelect: () => insertColAt(colIdx + 1) }
|
|
678
|
+
],
|
|
679
|
+
[
|
|
680
|
+
{ label: locale.value.deleteColumn, icon: "i-lucide-trash-2", color: "error", onSelect: () => deleteColumnAt(colIdx) }
|
|
681
|
+
]
|
|
682
|
+
];
|
|
683
|
+
}
|
|
684
|
+
function rowHeaderContextItems(rowIdx) {
|
|
685
|
+
if (!canWrite.value) return [];
|
|
686
|
+
return [
|
|
687
|
+
[
|
|
688
|
+
{ label: locale.value.insertRowAbove, icon: "i-lucide-arrow-up", onSelect: () => insertRowAt(rowIdx) },
|
|
689
|
+
{ label: locale.value.insertRowBelow, icon: "i-lucide-arrow-down", onSelect: () => insertRowAt(rowIdx + 1) }
|
|
690
|
+
],
|
|
691
|
+
[
|
|
692
|
+
{ label: locale.value.deleteRow, icon: "i-lucide-trash-2", color: "error", onSelect: () => deleteRowAt(rowIdx) }
|
|
693
|
+
]
|
|
694
|
+
];
|
|
695
|
+
}
|
|
696
|
+
function addColumn() {
|
|
697
|
+
const label = sheetsView.indexToColLetter(columns.value.length);
|
|
698
|
+
tree.createChild(null, label);
|
|
699
|
+
}
|
|
700
|
+
function addRow() {
|
|
701
|
+
const col = columns.value[0];
|
|
702
|
+
if (!col) {
|
|
703
|
+
const colId = tree.createChild(null, "A");
|
|
704
|
+
tree.createChild(colId, "");
|
|
705
|
+
} else {
|
|
706
|
+
tree.createChild(col.id, "");
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
function renameColumn(colId, label) {
|
|
710
|
+
tree.renameEntry(colId, label);
|
|
711
|
+
}
|
|
712
|
+
function resizeColumn(colId, width) {
|
|
713
|
+
sheetsView.setColWidth(colId, width);
|
|
714
|
+
}
|
|
715
|
+
function onStartEditFromBar() {
|
|
716
|
+
if (selection.activeCell.value) selection.startEdit(true);
|
|
717
|
+
}
|
|
718
|
+
function onCommitFormulaBar() {
|
|
719
|
+
selection.commitEdit();
|
|
720
|
+
}
|
|
721
|
+
function onCancelFormulaBar() {
|
|
722
|
+
selection.cancelEdit();
|
|
723
|
+
}
|
|
724
|
+
function onGridKeydown(e) {
|
|
725
|
+
selection.onKeydown(e);
|
|
726
|
+
}
|
|
727
|
+
void nextTick;
|
|
728
|
+
defineExpose({ connectedUsers });
|
|
729
|
+
</script>
|
|
730
|
+
|
|
731
|
+
<template>
|
|
732
|
+
<div class="flex-1 min-h-0 flex flex-col relative">
|
|
733
|
+
<ASheetsToolbar
|
|
734
|
+
:active-cell="selection.activeCell.value"
|
|
735
|
+
:edit-mode="selection.editMode.value"
|
|
736
|
+
:edit-value="selection.editValue.value"
|
|
737
|
+
:cell-display-value="cellDisplayValue"
|
|
738
|
+
:cell-ref="cellRef"
|
|
739
|
+
:col-count="columns.length"
|
|
740
|
+
:row-count="dataRowCount - 1"
|
|
741
|
+
:editable="canWrite"
|
|
742
|
+
:selection-bold="selectionBold"
|
|
743
|
+
:selection-italic="selectionItalic"
|
|
744
|
+
:selection-align="selectionAlign"
|
|
745
|
+
:selection-text-color="selectionTextColor"
|
|
746
|
+
:selection-bg-color="selectionBgColor"
|
|
747
|
+
:selection-number-format="selectionNumberFormat"
|
|
748
|
+
:labels="labels"
|
|
749
|
+
@add-column="addColumn"
|
|
750
|
+
@add-row="addRow"
|
|
751
|
+
@update:edit-value="selection.editValue.value = $event"
|
|
752
|
+
@commit-formula-bar="onCommitFormulaBar"
|
|
753
|
+
@cancel-formula-bar="onCancelFormulaBar"
|
|
754
|
+
@start-edit-from-bar="onStartEditFromBar"
|
|
755
|
+
@toggle-bold="toggleFormat('bold')"
|
|
756
|
+
@toggle-italic="toggleFormat('italic')"
|
|
757
|
+
@set-text-color="(c) => applyFormatting('textColor', c)"
|
|
758
|
+
@set-bg-color="(c) => applyFormatting('bgColor', c)"
|
|
759
|
+
@set-align="(a) => applyFormatting('align', a)"
|
|
760
|
+
@set-number-format="(f) => applyFormatting('numberFormat', f)"
|
|
761
|
+
/>
|
|
762
|
+
|
|
763
|
+
<!-- Empty state -->
|
|
764
|
+
<div
|
|
765
|
+
v-if="columns.length === 0"
|
|
766
|
+
class="flex-1 flex flex-col items-center justify-center text-(--ui-text-dimmed)"
|
|
767
|
+
>
|
|
768
|
+
<UIcon name="i-lucide-grid-3x3" class="size-12 mb-3 opacity-20" />
|
|
769
|
+
<p class="text-sm font-medium">
|
|
770
|
+
{{ locale.emptyTitle }}
|
|
771
|
+
</p>
|
|
772
|
+
<p class="text-xs mt-1 opacity-60 max-w-xs text-center">
|
|
773
|
+
{{ locale.emptyHint }}
|
|
774
|
+
</p>
|
|
775
|
+
<UButton
|
|
776
|
+
v-if="canWrite"
|
|
777
|
+
icon="i-lucide-plus"
|
|
778
|
+
size="sm"
|
|
779
|
+
variant="soft"
|
|
780
|
+
class="mt-4"
|
|
781
|
+
:label="locale.addColumn"
|
|
782
|
+
@click="addColumn"
|
|
783
|
+
/>
|
|
784
|
+
</div>
|
|
785
|
+
|
|
786
|
+
<!-- Grid -->
|
|
787
|
+
<ASheetsGrid
|
|
788
|
+
v-else
|
|
789
|
+
ref="sheetsGridRef"
|
|
790
|
+
:column-positions="columnPositions"
|
|
791
|
+
:data-columns="columns"
|
|
792
|
+
:row-count="dataRowCount"
|
|
793
|
+
:display-row-count="displayRowCount"
|
|
794
|
+
:get-row-height="(rowIdx) => sheetsView.getRowHeight(rowIdx)"
|
|
795
|
+
:default-row-height="sheetsView.defaultRowHeight.value"
|
|
796
|
+
:get-cell-value="getCellValue"
|
|
797
|
+
:get-cell-entry="getCellEntry"
|
|
798
|
+
:active-cell="selection.activeCell.value"
|
|
799
|
+
:edit-mode="selection.editMode.value"
|
|
800
|
+
:edit-value="selection.editValue.value"
|
|
801
|
+
:selection-range="selection.selectionRange.value"
|
|
802
|
+
:cut-range="clipboard.cutRange.value"
|
|
803
|
+
:show-gridlines="sheetsView.showGridlines.value"
|
|
804
|
+
:editable="canWrite"
|
|
805
|
+
:remote-editors="remoteEditors"
|
|
806
|
+
:remote-active-cells="remoteActiveCells"
|
|
807
|
+
:remote-selections="remoteSelections"
|
|
808
|
+
:cell-context-items="cellContextItems"
|
|
809
|
+
:col-header-context-items="colHeaderContextItems"
|
|
810
|
+
:row-header-context-items="rowHeaderContextItems"
|
|
811
|
+
:formula-ref-mode="formulaRefMode"
|
|
812
|
+
:formula-ref-highlights="formulaRefHighlights"
|
|
813
|
+
:fill-preview="fillPreview"
|
|
814
|
+
@select-cell="selection.selectCell"
|
|
815
|
+
@activate-cell="selection.activateCell"
|
|
816
|
+
@update:edit-value="selection.editValue.value = $event"
|
|
817
|
+
@commit-edit="selection.commitEdit"
|
|
818
|
+
@cancel-edit="selection.cancelEdit"
|
|
819
|
+
@resize-column="resizeColumn"
|
|
820
|
+
@rename-column="renameColumn"
|
|
821
|
+
@select-row="selection.selectRow"
|
|
822
|
+
@select-column="selection.selectColumn"
|
|
823
|
+
@begin-drag="selection.beginDrag"
|
|
824
|
+
@continue-drag="selection.continueDrag"
|
|
825
|
+
@end-drag="selection.endDrag"
|
|
826
|
+
@set-range="selection.setRange"
|
|
827
|
+
@formula-ref-click="onFormulaRefDragStart"
|
|
828
|
+
@formula-ref-drag-start="onFormulaRefDragStart"
|
|
829
|
+
@formula-ref-drag-move="onFormulaRefDragMove"
|
|
830
|
+
@formula-ref-drag-end="onFormulaRefDragEnd"
|
|
831
|
+
@fill-drag-start="onFillDragStart"
|
|
832
|
+
@fill-drag-move="onFillDragMove"
|
|
833
|
+
@fill-drag-end="onFillDragEnd"
|
|
834
|
+
@auto-fit-column="autoFitColumn"
|
|
835
|
+
@keydown="onGridKeydown"
|
|
836
|
+
@paste="clipboard.onPaste"
|
|
837
|
+
@copy="clipboard.onCopy"
|
|
838
|
+
@cut="clipboard.onCut"
|
|
839
|
+
/>
|
|
840
|
+
|
|
841
|
+
<ASheetsMobileActionBar
|
|
842
|
+
:visible="isMobile && !!selection.activeCell.value && !selection.editMode.value && columns.length > 0"
|
|
843
|
+
:editable="canWrite"
|
|
844
|
+
:cell-ref="cellRef"
|
|
845
|
+
:has-range="!!selection.selectionRange.value"
|
|
846
|
+
:cell-context-items="cellContextItems"
|
|
847
|
+
@edit="onStartEditFromBar"
|
|
848
|
+
@copy="clipboard.copy"
|
|
849
|
+
@cut="clipboard.cut"
|
|
850
|
+
@paste="clipboard.paste"
|
|
851
|
+
@clear="selection.clearRange"
|
|
852
|
+
@toggle-bold="toggleFormat('bold')"
|
|
853
|
+
@toggle-italic="toggleFormat('italic')"
|
|
854
|
+
/>
|
|
855
|
+
|
|
856
|
+
<ANodePanel
|
|
857
|
+
:node-id="openNodeId"
|
|
858
|
+
:node-label="openNodeLabel"
|
|
859
|
+
:child-provider="openNodeProvider"
|
|
860
|
+
:is-loading="nodePanelLoading"
|
|
861
|
+
:following-user="followingUser"
|
|
862
|
+
@close="closePanel"
|
|
863
|
+
/>
|
|
864
|
+
</div>
|
|
865
|
+
</template>
|