torch-glare 2.5.6 → 2.6.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/README.md +4 -3
- package/dist/bin/index.js +9 -24
- package/dist/bin/index.js.map +1 -1
- package/dist/src/commands/add.d.ts +2 -2
- package/dist/src/commands/add.d.ts.map +1 -1
- package/dist/src/commands/add.js +4 -70
- package/dist/src/commands/add.js.map +1 -1
- package/dist/src/commands/hook.d.ts +5 -4
- package/dist/src/commands/hook.d.ts.map +1 -1
- package/dist/src/commands/hook.js +7 -75
- package/dist/src/commands/hook.js.map +1 -1
- package/dist/src/commands/init.js +1 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/layout.d.ts +5 -4
- package/dist/src/commands/layout.d.ts.map +1 -1
- package/dist/src/commands/layout.js +7 -75
- package/dist/src/commands/layout.js.map +1 -1
- package/dist/src/commands/provider.d.ts +5 -4
- package/dist/src/commands/provider.d.ts.map +1 -1
- package/dist/src/commands/provider.js +7 -75
- package/dist/src/commands/provider.js.map +1 -1
- package/dist/src/commands/update.d.ts.map +1 -1
- package/dist/src/commands/update.js +78 -43
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/utils.d.ts +5 -4
- package/dist/src/commands/utils.d.ts.map +1 -1
- package/dist/src/commands/utils.js +7 -80
- package/dist/src/commands/utils.js.map +1 -1
- package/dist/src/shared/addFromRegistry.d.ts +16 -0
- package/dist/src/shared/addFromRegistry.d.ts.map +1 -0
- package/dist/src/shared/addFromRegistry.js +88 -0
- package/dist/src/shared/addFromRegistry.js.map +1 -0
- package/dist/src/shared/getInstallCommand.d.ts.map +1 -1
- package/dist/src/shared/getInstallCommand.js +5 -0
- package/dist/src/shared/getInstallCommand.js.map +1 -1
- package/dist/src/shared/installDependencies.d.ts +0 -10
- package/dist/src/shared/installDependencies.d.ts.map +1 -1
- package/dist/src/shared/installDependencies.js +0 -17
- package/dist/src/shared/installDependencies.js.map +1 -1
- package/dist/src/shared/installFromPlan.d.ts +7 -5
- package/dist/src/shared/installFromPlan.d.ts.map +1 -1
- package/dist/src/shared/installFromPlan.js +103 -36
- package/dist/src/shared/installFromPlan.js.map +1 -1
- package/dist/src/shared/loadRegistry.d.ts +12 -3
- package/dist/src/shared/loadRegistry.d.ts.map +1 -1
- package/dist/src/shared/loadRegistry.js +19 -20
- package/dist/src/shared/loadRegistry.js.map +1 -1
- package/dist/src/shared/registryClient.d.ts +19 -0
- package/dist/src/shared/registryClient.d.ts.map +1 -0
- package/dist/src/shared/registryClient.js +128 -0
- package/dist/src/shared/registryClient.js.map +1 -0
- package/dist/src/shared/resolveEntry.d.ts +10 -7
- package/dist/src/shared/resolveEntry.d.ts.map +1 -1
- package/dist/src/shared/resolveEntry.js +18 -13
- package/dist/src/shared/resolveEntry.js.map +1 -1
- package/dist/src/shared/suggestOtherCommand.d.ts +7 -1
- package/dist/src/shared/suggestOtherCommand.d.ts.map +1 -1
- package/dist/src/shared/suggestOtherCommand.js +29 -23
- package/dist/src/shared/suggestOtherCommand.js.map +1 -1
- package/dist/src/types/main.d.ts +31 -2
- package/dist/src/types/main.d.ts.map +1 -1
- package/package.json +6 -11
- package/apps/lib/components/ActionButton.tsx +0 -93
- package/apps/lib/components/ActionsGroup.tsx +0 -27
- package/apps/lib/components/AlertDialog.tsx +0 -204
- package/apps/lib/components/Avatar.tsx +0 -46
- package/apps/lib/components/Badge.tsx +0 -250
- package/apps/lib/components/BadgeField.tsx +0 -403
- package/apps/lib/components/Breadcrumb.tsx +0 -280
- package/apps/lib/components/Button.tsx +0 -325
- package/apps/lib/components/ButtonGroup.tsx +0 -190
- package/apps/lib/components/Calendar.tsx +0 -115
- package/apps/lib/components/Card.tsx +0 -95
- package/apps/lib/components/Checkbox.tsx +0 -42
- package/apps/lib/components/ColorPicker.tsx +0 -441
- package/apps/lib/components/ConclusionHeader.tsx +0 -148
- package/apps/lib/components/ContextMenu.tsx +0 -571
- package/apps/lib/components/CountBadge.tsx +0 -52
- package/apps/lib/components/DataTable.tsx +0 -213
- package/apps/lib/components/DataViews/badge.ts +0 -49
- package/apps/lib/components/DataViews/cell.tsx +0 -324
- package/apps/lib/components/DataViews/context.ts +0 -144
- package/apps/lib/components/DataViews/data-views.tsx +0 -395
- package/apps/lib/components/DataViews/filters/children.tsx +0 -98
- package/apps/lib/components/DataViews/filters/custom.tsx +0 -34
- package/apps/lib/components/DataViews/filters/filters.tsx +0 -157
- package/apps/lib/components/DataViews/filters/index.ts +0 -4
- package/apps/lib/components/DataViews/filters/labelled.tsx +0 -20
- package/apps/lib/components/DataViews/filters/presets.tsx +0 -65
- package/apps/lib/components/DataViews/filters/sync.tsx +0 -35
- package/apps/lib/components/DataViews/filters/values.ts +0 -173
- package/apps/lib/components/DataViews/header.tsx +0 -220
- package/apps/lib/components/DataViews/hooks/index.ts +0 -5
- package/apps/lib/components/DataViews/hooks/useActiveRow.ts +0 -22
- package/apps/lib/components/DataViews/hooks/useControllable.ts +0 -52
- package/apps/lib/components/DataViews/index.ts +0 -88
- package/apps/lib/components/DataViews/panel/columns.tsx +0 -153
- package/apps/lib/components/DataViews/panel/controls.tsx +0 -106
- package/apps/lib/components/DataViews/panel/index.ts +0 -3
- package/apps/lib/components/DataViews/panel/panel.tsx +0 -164
- package/apps/lib/components/DataViews/panel/saved-views.tsx +0 -67
- package/apps/lib/components/DataViews/panel/section.tsx +0 -81
- package/apps/lib/components/DataViews/panel/sort.tsx +0 -42
- package/apps/lib/components/DataViews/panel/tab.tsx +0 -31
- package/apps/lib/components/DataViews/slots.ts +0 -72
- package/apps/lib/components/DataViews/states.tsx +0 -73
- package/apps/lib/components/DataViews/types.ts +0 -510
- package/apps/lib/components/DataViews/views/board-view.tsx +0 -381
- package/apps/lib/components/DataViews/views/card-rows.tsx +0 -36
- package/apps/lib/components/DataViews/views/inbox-view.tsx +0 -260
- package/apps/lib/components/DataViews/views/pane-views.tsx +0 -196
- package/apps/lib/components/DataViews/views/table-view.tsx +0 -493
- package/apps/lib/components/DataViews/views/tree-view.tsx +0 -367
- package/apps/lib/components/DatePicker.tsx +0 -232
- package/apps/lib/components/Dialog.tsx +0 -116
- package/apps/lib/components/Divider.tsx +0 -28
- package/apps/lib/components/Drawer.tsx +0 -451
- package/apps/lib/components/DropdownMenu.tsx +0 -554
- package/apps/lib/components/FieldHint.tsx +0 -69
- package/apps/lib/components/Form.tsx +0 -182
- package/apps/lib/components/FormBuilder/context.ts +0 -85
- package/apps/lib/components/FormBuilder/field-kind.ts +0 -28
- package/apps/lib/components/FormBuilder/fields/ChoiceFields.tsx +0 -60
- package/apps/lib/components/FormBuilder/fields/ColorField.tsx +0 -59
- package/apps/lib/components/FormBuilder/fields/CustomField.tsx +0 -11
- package/apps/lib/components/FormBuilder/fields/DateField.tsx +0 -32
- package/apps/lib/components/FormBuilder/fields/FieldArray.tsx +0 -74
- package/apps/lib/components/FormBuilder/fields/FieldShell.tsx +0 -168
- package/apps/lib/components/FormBuilder/fields/FileField.tsx +0 -39
- package/apps/lib/components/FormBuilder/fields/OptionListFields.tsx +0 -132
- package/apps/lib/components/FormBuilder/fields/OtpField.tsx +0 -31
- package/apps/lib/components/FormBuilder/fields/PhoneField.tsx +0 -109
- package/apps/lib/components/FormBuilder/fields/RichTextEditorField.tsx +0 -31
- package/apps/lib/components/FormBuilder/fields/SelectField.tsx +0 -114
- package/apps/lib/components/FormBuilder/fields/SignatureField.tsx +0 -157
- package/apps/lib/components/FormBuilder/fields/SliderField.tsx +0 -67
- package/apps/lib/components/FormBuilder/fields/SwitchBoxField.tsx +0 -41
- package/apps/lib/components/FormBuilder/fields/TableField.tsx +0 -336
- package/apps/lib/components/FormBuilder/fields/TextField.tsx +0 -213
- package/apps/lib/components/FormBuilder/fields/TreeSelectField.tsx +0 -43
- package/apps/lib/components/FormBuilder/fields/countries.ts +0 -303
- package/apps/lib/components/FormBuilder/fields/index.ts +0 -25
- package/apps/lib/components/FormBuilder/form-builder.tsx +0 -198
- package/apps/lib/components/FormBuilder/index.ts +0 -31
- package/apps/lib/components/FormBuilder/numberFormat.ts +0 -16
- package/apps/lib/components/FormBuilder/submit.tsx +0 -67
- package/apps/lib/components/FormBuilder/types.ts +0 -316
- package/apps/lib/components/FormRenderer/FormDrawer.tsx +0 -250
- package/apps/lib/components/FormRenderer/detail.tsx +0 -256
- package/apps/lib/components/FormRenderer/form-renderer.tsx +0 -358
- package/apps/lib/components/FormRenderer/header.tsx +0 -88
- package/apps/lib/components/FormRenderer/index.ts +0 -17
- package/apps/lib/components/FormRenderer/notch-action.tsx +0 -64
- package/apps/lib/components/FormRenderer/section.tsx +0 -39
- package/apps/lib/components/FormRenderer/stepper.tsx +0 -393
- package/apps/lib/components/FormRenderer/types.ts +0 -115
- package/apps/lib/components/FormSummary.tsx +0 -282
- package/apps/lib/components/HeaderBar.tsx +0 -117
- package/apps/lib/components/ImageAttachment.tsx +0 -209
- package/apps/lib/components/InnerLabelField.tsx +0 -154
- package/apps/lib/components/Input.tsx +0 -224
- package/apps/lib/components/InputField.tsx +0 -147
- package/apps/lib/components/InputOTP.tsx +0 -84
- package/apps/lib/components/Label.tsx +0 -129
- package/apps/lib/components/LabelField.tsx +0 -76
- package/apps/lib/components/LabeledCheckBox.tsx +0 -51
- package/apps/lib/components/LabeledRadio.tsx +0 -51
- package/apps/lib/components/LinkButton.tsx +0 -94
- package/apps/lib/components/LoginButton.tsx +0 -51
- package/apps/lib/components/PasswordLevel.tsx +0 -58
- package/apps/lib/components/Popover.tsx +0 -312
- package/apps/lib/components/ProfileMenu.tsx +0 -85
- package/apps/lib/components/Radio.tsx +0 -59
- package/apps/lib/components/RadioCard.tsx +0 -50
- package/apps/lib/components/ScrollArea.tsx +0 -54
- package/apps/lib/components/SearchField.tsx +0 -62
- package/apps/lib/components/SearchableSelect.tsx +0 -318
- package/apps/lib/components/SearchableTable.tsx +0 -344
- package/apps/lib/components/SearchableTree.tsx +0 -485
- package/apps/lib/components/SearchableTreeDialog.tsx +0 -502
- package/apps/lib/components/SectionBlock.tsx +0 -168
- package/apps/lib/components/Select.tsx +0 -347
- package/apps/lib/components/SimpleSelect.tsx +0 -225
- package/apps/lib/components/Skeleton.tsx +0 -12
- package/apps/lib/components/SlideDatePicker.tsx +0 -255
- package/apps/lib/components/SpinLoading.tsx +0 -174
- package/apps/lib/components/Stepper.tsx +0 -480
- package/apps/lib/components/Switch.tsx +0 -82
- package/apps/lib/components/TabFormItem.tsx +0 -153
- package/apps/lib/components/TabSwitch.tsx +0 -172
- package/apps/lib/components/Table.tsx +0 -597
- package/apps/lib/components/TextEditor/ChartBlockTool.ts +0 -676
- package/apps/lib/components/TextEditor/RichTextField.tsx +0 -46
- package/apps/lib/components/TextEditor/TableDnDWrapper.ts +0 -462
- package/apps/lib/components/TextEditor/TextEditor.tsx +0 -1164
- package/apps/lib/components/TextEditor/TextEditorToolbar.tsx +0 -429
- package/apps/lib/components/TextEditor/editor-tools/AlignmentTune.ts +0 -70
- package/apps/lib/components/TextEditor/editor-tools/ColorInlineTool.ts +0 -50
- package/apps/lib/components/TextEditor/editor-tools/StrikethroughInlineTool.ts +0 -48
- package/apps/lib/components/TextEditor/editor-tools/inlineFormat.ts +0 -98
- package/apps/lib/components/TextEditor/editorjs.d.ts +0 -60
- package/apps/lib/components/TextEditor/index.ts +0 -7
- package/apps/lib/components/TextEditor/markdownParser.ts +0 -346
- package/apps/lib/components/Textarea.tsx +0 -117
- package/apps/lib/components/Timeline.tsx +0 -263
- package/apps/lib/components/Toast.tsx +0 -87
- package/apps/lib/components/Toggle.tsx +0 -125
- package/apps/lib/components/ToggleButton.tsx +0 -140
- package/apps/lib/components/Tooltip.tsx +0 -116
- package/apps/lib/components/TransparentLabel.tsx +0 -71
- package/apps/lib/components/TreeDropDown.tsx +0 -115
- package/apps/lib/components/TreeFolder/TreeFolder.tsx +0 -380
- package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +0 -75
- package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +0 -354
- package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +0 -60
- package/apps/lib/components/TreeFolder/icons.tsx +0 -60
- package/apps/lib/components/TreeFolder/index.ts +0 -24
- package/apps/lib/components/TreeFolder/treeFolderUtils.ts +0 -109
- package/apps/lib/components/TreeFolder/types.ts +0 -77
- package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +0 -118
- package/apps/lib/hooks/useActiveTreeItem.ts +0 -61
- package/apps/lib/hooks/useClickOutside.ts +0 -27
- package/apps/lib/hooks/useDragDrop.tsx +0 -365
- package/apps/lib/hooks/useHtmlDir.ts +0 -31
- package/apps/lib/hooks/useInfiniteScroll.ts +0 -108
- package/apps/lib/hooks/useIsMobile.ts +0 -21
- package/apps/lib/hooks/useResize.ts +0 -67
- package/apps/lib/hooks/useTagSelection.ts +0 -300
- package/apps/lib/layouts/CNLayout.tsx +0 -372
- package/apps/lib/layouts/DataViewCard.tsx +0 -62
- package/apps/lib/layouts/FieldSection.tsx +0 -91
- package/apps/lib/layouts/TreeSubLayout.tsx +0 -173
- package/apps/lib/providers/ThemeProvider.tsx +0 -84
- package/apps/lib/registry.json +0 -1217
- package/apps/lib/tsconfig.json +0 -9
- package/apps/lib/tsconfig.tsbuildinfo +0 -1
- package/apps/lib/utils/cn.ts +0 -6
- package/apps/lib/utils/color.ts +0 -175
- package/apps/lib/utils/dataViews/path.ts +0 -67
- package/apps/lib/utils/dataViews/query.ts +0 -73
- package/apps/lib/utils/dataViews/types.ts +0 -187
- package/apps/lib/utils/dateFormat.ts +0 -108
- package/apps/lib/utils/resize.ts +0 -31
- package/apps/lib/utils/scroller.ts +0 -26
- package/apps/lib/utils/types.ts +0 -16
- package/docs/BLOCKS.md +0 -129
- package/docs/CHANGELOG-1.1.16.md +0 -108
- package/docs/Cover.png +0 -0
- package/docs/README.md +0 -215
- package/docs/components/action-button.md +0 -638
- package/docs/components/actions-group.md +0 -708
- package/docs/components/alert-dialog.md +0 -920
- package/docs/components/avatar.md +0 -709
- package/docs/components/badge-field.md +0 -738
- package/docs/components/badge.md +0 -301
- package/docs/components/breadcrumb.md +0 -930
- package/docs/components/button-group.md +0 -650
- package/docs/components/button.md +0 -639
- package/docs/components/calendar.md +0 -555
- package/docs/components/card.md +0 -622
- package/docs/components/chart-block-tool.md +0 -129
- package/docs/components/checkbox.md +0 -699
- package/docs/components/cn-layout.md +0 -854
- package/docs/components/color-picker.md +0 -101
- package/docs/components/conclusion-header.md +0 -80
- package/docs/components/context-menu.md +0 -483
- package/docs/components/count-badge.md +0 -560
- package/docs/components/data-table.md +0 -854
- package/docs/components/data-views/backend-response.md +0 -324
- package/docs/components/data-views/examples/a11y-rtl.md +0 -250
- package/docs/components/data-views/examples/api-orders-route.md +0 -130
- package/docs/components/data-views/examples/fields.md +0 -362
- package/docs/components/data-views/examples/filters.md +0 -307
- package/docs/components/data-views/examples/inbox-routing.md +0 -218
- package/docs/components/data-views/examples/index.md +0 -29
- package/docs/components/data-views/examples/overview.md +0 -244
- package/docs/components/data-views/examples/panel.md +0 -212
- package/docs/components/data-views/examples/scale.md +0 -231
- package/docs/components/data-views/examples/server-side.md +0 -210
- package/docs/components/data-views/examples/state.md +0 -250
- package/docs/components/data-views/examples/tree-custom.md +0 -388
- package/docs/components/data-views/examples/view-registry.md +0 -313
- package/docs/components/data-views/examples/views.md +0 -534
- package/docs/components/data-views/guide.md +0 -405
- package/docs/components/data-views/index.md +0 -1521
- package/docs/components/data-views/migration.md +0 -81
- package/docs/components/date-picker.md +0 -857
- package/docs/components/dialog.md +0 -929
- package/docs/components/divider.md +0 -766
- package/docs/components/drawer.md +0 -654
- package/docs/components/dropdown-menu.md +0 -668
- package/docs/components/field-hint.md +0 -898
- package/docs/components/field-section.md +0 -781
- package/docs/components/form-builder.md +0 -284
- package/docs/components/form-renderer.md +0 -396
- package/docs/components/form-summary.md +0 -138
- package/docs/components/form.md +0 -785
- package/docs/components/header-bar.md +0 -188
- package/docs/components/image-attachment.md +0 -906
- package/docs/components/inner-label-field.md +0 -819
- package/docs/components/input-field.md +0 -623
- package/docs/components/input-otp.md +0 -756
- package/docs/components/input.md +0 -634
- package/docs/components/label-field.md +0 -770
- package/docs/components/label.md +0 -761
- package/docs/components/labeled-check-box.md +0 -642
- package/docs/components/labeled-radio.md +0 -796
- package/docs/components/link-button.md +0 -685
- package/docs/components/login-button.md +0 -872
- package/docs/components/password-level.md +0 -803
- package/docs/components/popover.md +0 -649
- package/docs/components/profile-menu.md +0 -656
- package/docs/components/radio-card.md +0 -801
- package/docs/components/radio.md +0 -735
- package/docs/components/scroll-area.md +0 -691
- package/docs/components/search-field.md +0 -702
- package/docs/components/searchable-select.md +0 -368
- package/docs/components/searchable-table.md +0 -438
- package/docs/components/searchable-tree-dialog.md +0 -190
- package/docs/components/searchable-tree.md +0 -200
- package/docs/components/section-block.md +0 -483
- package/docs/components/select.md +0 -709
- package/docs/components/simple-select.md +0 -741
- package/docs/components/skeleton.md +0 -706
- package/docs/components/slide-date-picker.md +0 -837
- package/docs/components/spin-loading.md +0 -696
- package/docs/components/stepper.md +0 -316
- package/docs/components/switch.md +0 -770
- package/docs/components/tab-form-item.md +0 -773
- package/docs/components/tab-switch.md +0 -170
- package/docs/components/table-dnd-wrapper.md +0 -107
- package/docs/components/table.md +0 -1088
- package/docs/components/text-editor.md +0 -735
- package/docs/components/textarea.md +0 -681
- package/docs/components/timeline.md +0 -254
- package/docs/components/toast.md +0 -773
- package/docs/components/toggle-button.md +0 -643
- package/docs/components/toggle.md +0 -882
- package/docs/components/tooltip.md +0 -513
- package/docs/components/transparent-label.md +0 -721
- package/docs/components/tree-drop-down.md +0 -740
- package/docs/components/tree-folder.md +0 -110
- package/docs/components/tree-sub-layout.md +0 -707
- package/docs/explanation/architecture.md +0 -54
- package/docs/explanation/design-system.md +0 -52
- package/docs/how-to/form-and-list-recipes.md +0 -386
- package/docs/how-to/forms-with-form-builder.md +0 -472
- package/docs/how-to/guides.md +0 -1027
- package/docs/migration/changelog.md +0 -60
- package/docs/migration/form-builder-2.5.2.md +0 -113
- package/docs/reference/cli.md +0 -112
- package/docs/reference/components.md +0 -572
- package/docs/reference/hooks.md +0 -1523
- package/docs/reference/providers.md +0 -866
- package/docs/reference/tailwind-plugins.md +0 -942
- package/docs/reference/theme.md +0 -85
- package/docs/reference/types.md +0 -1016
- package/docs/reference/utilities.md +0 -726
- package/docs/tutorials/building-first-form.md +0 -846
- package/docs/tutorials/component-composition.md +0 -882
- package/docs/tutorials/getting-started.md +0 -302
- package/docs/tutorials/theming-basics.md +0 -785
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { lazy, Suspense, useEffect, useState } from "react";
|
|
4
|
-
import type { OutputData } from "@editorjs/editorjs";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Client-only, lazily-loaded wrapper around the EditorJS `TextEditor`.
|
|
8
|
-
*
|
|
9
|
-
* EditorJS references DOM globals (`Element`) at module-load time, which crashes
|
|
10
|
-
* server-side rendering. Statically importing `TextEditor` in the field registry
|
|
11
|
-
* would pull it into the SSR bundle; loading it lazily + only after mount keeps
|
|
12
|
-
* the builder SSR-safe — the editor is imported on the client, on demand.
|
|
13
|
-
*/
|
|
14
|
-
const TextEditorLazy = lazy(() => import("./TextEditor").then((m) => ({ default: m.TextEditor })));
|
|
15
|
-
|
|
16
|
-
export interface RichTextFieldProps {
|
|
17
|
-
data?: OutputData;
|
|
18
|
-
onChange?: (data: OutputData) => void;
|
|
19
|
-
readOnly?: boolean;
|
|
20
|
-
placeholder?: string;
|
|
21
|
-
/** Editor size — controls min-height + padding (the toolbar gutter). Default "M". */
|
|
22
|
-
size?: "S" | "M" | "L" | "XL";
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const placeholderBox = (
|
|
26
|
-
<div className="min-h-[200px] w-full rounded-[6px] border border-border-presentation-action-primary bg-background-presentation-form-field-primary" />
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
export function RichTextField({ size = "M", ...props }: RichTextFieldProps) {
|
|
30
|
-
const [mounted, setMounted] = useState(false);
|
|
31
|
-
useEffect(() => setMounted(true), []);
|
|
32
|
-
|
|
33
|
-
if (!mounted) return placeholderBox;
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<Suspense fallback={placeholderBox}>
|
|
37
|
-
<TextEditorLazy
|
|
38
|
-
size={size}
|
|
39
|
-
className="border border-border-presentation-action-primary"
|
|
40
|
-
{...props}
|
|
41
|
-
/>
|
|
42
|
-
</Suspense>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
RichTextField.displayName = "RichTextField";
|
|
@@ -1,462 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TableDnDWrapper
|
|
3
|
-
*
|
|
4
|
-
* Wraps @editorjs/table and adds drag-and-drop reordering for rows
|
|
5
|
-
* and columns by hijacking the existing .tc-toolbox toggler elements.
|
|
6
|
-
*
|
|
7
|
-
* - Click the toggler → opens the original popover menu (unchanged)
|
|
8
|
-
* - Drag the toggler → reorders the row/column (new behavior)
|
|
9
|
-
*
|
|
10
|
-
* No extra UI elements are injected — we reuse what the table plugin
|
|
11
|
-
* already renders.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
type TableClass = any;
|
|
16
|
-
|
|
17
|
-
const DRAG_THRESHOLD = 5; // px before a pointerdown becomes a drag
|
|
18
|
-
|
|
19
|
-
interface DragState {
|
|
20
|
-
active: boolean;
|
|
21
|
-
pending: boolean; // pointerdown happened but haven't passed threshold
|
|
22
|
-
type: "row" | "col" | null;
|
|
23
|
-
index: number;
|
|
24
|
-
dropIndex: number;
|
|
25
|
-
pointerId: number;
|
|
26
|
-
startX: number;
|
|
27
|
-
startY: number;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default function createTableDnDClass(OriginalTable: TableClass): TableClass {
|
|
31
|
-
return class TableDnD extends OriginalTable {
|
|
32
|
-
private _drag: DragState = {
|
|
33
|
-
active: false,
|
|
34
|
-
pending: false,
|
|
35
|
-
type: null,
|
|
36
|
-
index: -1,
|
|
37
|
-
dropIndex: -1,
|
|
38
|
-
pointerId: -1,
|
|
39
|
-
startX: 0,
|
|
40
|
-
startY: 0,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
private _indicator: HTMLDivElement | null = null;
|
|
44
|
-
private _wrapperRef: HTMLElement | null = null;
|
|
45
|
-
private _onMoveBound = this._onPointerMove.bind(this);
|
|
46
|
-
private _onUpBound = this._onPointerUp.bind(this);
|
|
47
|
-
private _mutationObs: MutationObserver | null = null;
|
|
48
|
-
private _rafId: number | null = null;
|
|
49
|
-
private _attachedTogglers = new WeakSet<HTMLElement>();
|
|
50
|
-
|
|
51
|
-
// ─── Lifecycle ──────────────────────────────────────────────────────
|
|
52
|
-
|
|
53
|
-
render(): HTMLElement {
|
|
54
|
-
const wrapper: HTMLElement = super.render();
|
|
55
|
-
this._wrapperRef = wrapper;
|
|
56
|
-
|
|
57
|
-
if (this.readOnly) return wrapper;
|
|
58
|
-
|
|
59
|
-
this._waitForLayout(wrapper, () => this._setup(wrapper));
|
|
60
|
-
return wrapper;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
destroy(): void {
|
|
64
|
-
this._teardown();
|
|
65
|
-
if (super.destroy) super.destroy();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// ─── Wait for DOM ───────────────────────────────────────────────────
|
|
69
|
-
|
|
70
|
-
private _waitForLayout(el: HTMLElement, cb: () => void): void {
|
|
71
|
-
const check = () => {
|
|
72
|
-
if (el.offsetHeight > 0 && el.querySelector(".tc-row")) {
|
|
73
|
-
cb();
|
|
74
|
-
} else {
|
|
75
|
-
this._rafId = requestAnimationFrame(check);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
this._rafId = requestAnimationFrame(check);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// ─── Setup ──────────────────────────────────────────────────────────
|
|
82
|
-
|
|
83
|
-
private _setup(wrapper: HTMLElement): void {
|
|
84
|
-
wrapper.classList.add("tc-dnd-wrap");
|
|
85
|
-
|
|
86
|
-
// Drop indicator
|
|
87
|
-
this._indicator = document.createElement("div");
|
|
88
|
-
this._indicator.className = "tc-dnd__indicator";
|
|
89
|
-
wrapper.appendChild(this._indicator);
|
|
90
|
-
|
|
91
|
-
// Attach to existing togglers
|
|
92
|
-
this._attachTogglers(wrapper);
|
|
93
|
-
|
|
94
|
-
// Re-attach when DOM changes (new rows/cols might create new togglers)
|
|
95
|
-
this._mutationObs = new MutationObserver(() => {
|
|
96
|
-
this._attachTogglers(wrapper);
|
|
97
|
-
});
|
|
98
|
-
this._mutationObs.observe(wrapper, { childList: true, subtree: true });
|
|
99
|
-
|
|
100
|
-
// Proximity-based toolbox visibility:
|
|
101
|
-
// Only show row handle near left edge, column handle near top edge
|
|
102
|
-
wrapper.addEventListener("mousemove", (e) => this._onWrapperMouseMove(e));
|
|
103
|
-
wrapper.addEventListener("mouseleave", () => {
|
|
104
|
-
wrapper.classList.remove("tc-dnd--show-row", "tc-dnd--show-col");
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// ─── Attach to .tc-toolbox__toggler elements ────────────────────────
|
|
109
|
-
|
|
110
|
-
private _attachTogglers(wrapper: HTMLElement): void {
|
|
111
|
-
// Row toolbox toggler
|
|
112
|
-
const rowToolbox = wrapper.querySelector<HTMLElement>(
|
|
113
|
-
".tc-toolbox--row .tc-toolbox__toggler",
|
|
114
|
-
);
|
|
115
|
-
if (rowToolbox && !this._attachedTogglers.has(rowToolbox)) {
|
|
116
|
-
this._attachedTogglers.add(rowToolbox);
|
|
117
|
-
rowToolbox.style.cursor = "grab";
|
|
118
|
-
rowToolbox.addEventListener("pointerdown", (e) => {
|
|
119
|
-
this._onTogglerDown("row", wrapper, e);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Column toolbox toggler
|
|
124
|
-
const colToolbox = wrapper.querySelector<HTMLElement>(
|
|
125
|
-
".tc-toolbox--column .tc-toolbox__toggler",
|
|
126
|
-
);
|
|
127
|
-
if (colToolbox && !this._attachedTogglers.has(colToolbox)) {
|
|
128
|
-
this._attachedTogglers.add(colToolbox);
|
|
129
|
-
colToolbox.style.cursor = "grab";
|
|
130
|
-
colToolbox.addEventListener("pointerdown", (e) => {
|
|
131
|
-
this._onTogglerDown("col", wrapper, e);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// ─── Proximity-based toolbox visibility ──────────────────────────────
|
|
137
|
-
|
|
138
|
-
private _onWrapperMouseMove(e: MouseEvent): void {
|
|
139
|
-
const tableEl = this._wrapperRef?.querySelector<HTMLElement>(".tc-table");
|
|
140
|
-
if (!tableEl || !this._wrapperRef) return;
|
|
141
|
-
|
|
142
|
-
const tableRect = tableEl.getBoundingClientRect();
|
|
143
|
-
const distFromLeft = e.clientX - tableRect.left;
|
|
144
|
-
const distFromTop = e.clientY - tableRect.top;
|
|
145
|
-
|
|
146
|
-
const LEFT_THRESHOLD = 50;
|
|
147
|
-
const TOP_THRESHOLD = 35;
|
|
148
|
-
|
|
149
|
-
const nearLeft = distFromLeft <= LEFT_THRESHOLD && distFromLeft >= -30;
|
|
150
|
-
const nearTop = distFromTop <= TOP_THRESHOLD && distFromTop >= -25;
|
|
151
|
-
|
|
152
|
-
if (nearLeft && nearTop) {
|
|
153
|
-
// Corner: pick the proportionally closer edge
|
|
154
|
-
const leftRatio = Math.abs(distFromLeft) / LEFT_THRESHOLD;
|
|
155
|
-
const topRatio = Math.abs(distFromTop) / TOP_THRESHOLD;
|
|
156
|
-
if (leftRatio < topRatio) {
|
|
157
|
-
this._wrapperRef.classList.add("tc-dnd--show-row");
|
|
158
|
-
this._wrapperRef.classList.remove("tc-dnd--show-col");
|
|
159
|
-
} else {
|
|
160
|
-
this._wrapperRef.classList.add("tc-dnd--show-col");
|
|
161
|
-
this._wrapperRef.classList.remove("tc-dnd--show-row");
|
|
162
|
-
}
|
|
163
|
-
} else if (nearLeft) {
|
|
164
|
-
this._wrapperRef.classList.add("tc-dnd--show-row");
|
|
165
|
-
this._wrapperRef.classList.remove("tc-dnd--show-col");
|
|
166
|
-
} else if (nearTop) {
|
|
167
|
-
this._wrapperRef.classList.add("tc-dnd--show-col");
|
|
168
|
-
this._wrapperRef.classList.remove("tc-dnd--show-row");
|
|
169
|
-
} else {
|
|
170
|
-
this._wrapperRef.classList.remove("tc-dnd--show-row", "tc-dnd--show-col");
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// ─── Toggler pointerdown (start pending drag) ───────────────────────
|
|
175
|
-
|
|
176
|
-
private _onTogglerDown(type: "row" | "col", wrapper: HTMLElement, e: PointerEvent): void {
|
|
177
|
-
// Detect which row/col is currently hovered by the table plugin
|
|
178
|
-
const index = this._detectHoveredIndex(type, wrapper);
|
|
179
|
-
if (index < 0) return;
|
|
180
|
-
|
|
181
|
-
this._drag = {
|
|
182
|
-
active: false,
|
|
183
|
-
pending: true,
|
|
184
|
-
type,
|
|
185
|
-
index,
|
|
186
|
-
dropIndex: index,
|
|
187
|
-
pointerId: e.pointerId,
|
|
188
|
-
startX: e.clientX,
|
|
189
|
-
startY: e.clientY,
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
document.addEventListener("pointermove", this._onMoveBound);
|
|
193
|
-
document.addEventListener("pointerup", this._onUpBound);
|
|
194
|
-
document.addEventListener("pointercancel", this._onUpBound);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// ─── Detect hovered row/col index ───────────────────────────────────
|
|
198
|
-
|
|
199
|
-
private _detectHoveredIndex(type: "row" | "col", wrapper: HTMLElement): number {
|
|
200
|
-
const tableEl = wrapper.querySelector<HTMLElement>(".tc-table");
|
|
201
|
-
if (!tableEl) return -1;
|
|
202
|
-
|
|
203
|
-
if (type === "row") {
|
|
204
|
-
// The row toolbox is positioned at the hovered row.
|
|
205
|
-
// Find which row by comparing toolbox top to row tops.
|
|
206
|
-
const toolbox = wrapper.querySelector<HTMLElement>(".tc-toolbox--row");
|
|
207
|
-
if (!toolbox) return -1;
|
|
208
|
-
const toolboxRect = toolbox.getBoundingClientRect();
|
|
209
|
-
const toolboxMid = toolboxRect.top + toolboxRect.height / 2;
|
|
210
|
-
|
|
211
|
-
const rows = tableEl.querySelectorAll<HTMLElement>(".tc-row");
|
|
212
|
-
for (let i = 0; i < rows.length; i++) {
|
|
213
|
-
const r = rows[i].getBoundingClientRect();
|
|
214
|
-
if (toolboxMid >= r.top && toolboxMid <= r.bottom) return i;
|
|
215
|
-
}
|
|
216
|
-
return -1;
|
|
217
|
-
} else {
|
|
218
|
-
const toolbox = wrapper.querySelector<HTMLElement>(".tc-toolbox--column");
|
|
219
|
-
if (!toolbox) return -1;
|
|
220
|
-
const toolboxRect = toolbox.getBoundingClientRect();
|
|
221
|
-
const toolboxMid = toolboxRect.left + toolboxRect.width / 2;
|
|
222
|
-
|
|
223
|
-
const firstRow = tableEl.querySelector<HTMLElement>(".tc-row");
|
|
224
|
-
if (!firstRow) return -1;
|
|
225
|
-
const cells = firstRow.querySelectorAll<HTMLElement>(".tc-cell");
|
|
226
|
-
for (let i = 0; i < cells.length; i++) {
|
|
227
|
-
const r = cells[i].getBoundingClientRect();
|
|
228
|
-
if (toolboxMid >= r.left && toolboxMid <= r.right) return i;
|
|
229
|
-
}
|
|
230
|
-
return -1;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// ─── Pointer Move ───────────────────────────────────────────────────
|
|
235
|
-
|
|
236
|
-
private _onPointerMove(e: PointerEvent): void {
|
|
237
|
-
const d = this._drag;
|
|
238
|
-
if (!d.pending && !d.active) return;
|
|
239
|
-
|
|
240
|
-
// Check threshold to start drag
|
|
241
|
-
if (d.pending && !d.active) {
|
|
242
|
-
const dx = e.clientX - d.startX;
|
|
243
|
-
const dy = e.clientY - d.startY;
|
|
244
|
-
if (Math.abs(dx) + Math.abs(dy) < DRAG_THRESHOLD) return;
|
|
245
|
-
|
|
246
|
-
// Passed threshold → start real drag
|
|
247
|
-
d.pending = false;
|
|
248
|
-
d.active = true;
|
|
249
|
-
|
|
250
|
-
// Close any open popover from the table plugin
|
|
251
|
-
const openPopover = this._wrapperRef?.querySelector<HTMLElement>(".tc-popover--opened");
|
|
252
|
-
openPopover?.classList.remove("tc-popover--opened");
|
|
253
|
-
|
|
254
|
-
this._highlight(d.type!, d.index, true);
|
|
255
|
-
document.body.style.cursor = "grabbing";
|
|
256
|
-
document.body.style.userSelect = "none";
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (!d.active || !this._wrapperRef) return;
|
|
260
|
-
e.preventDefault();
|
|
261
|
-
|
|
262
|
-
const drop = this._calcDrop(this._wrapperRef, e.clientX, e.clientY);
|
|
263
|
-
if (drop !== d.dropIndex) {
|
|
264
|
-
d.dropIndex = drop;
|
|
265
|
-
this._showIndicator(this._wrapperRef, drop);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// ─── Pointer Up ─────────────────────────────────────────────────────
|
|
270
|
-
|
|
271
|
-
private _onPointerUp(e: PointerEvent): void {
|
|
272
|
-
const d = this._drag;
|
|
273
|
-
const wasDragging = d.active;
|
|
274
|
-
|
|
275
|
-
if (wasDragging) {
|
|
276
|
-
e.preventDefault();
|
|
277
|
-
e.stopPropagation();
|
|
278
|
-
|
|
279
|
-
this._highlight(d.type!, d.index, false);
|
|
280
|
-
if (this._indicator) this._indicator.style.display = "none";
|
|
281
|
-
|
|
282
|
-
document.body.style.cursor = "";
|
|
283
|
-
document.body.style.userSelect = "";
|
|
284
|
-
|
|
285
|
-
if (d.dropIndex !== d.index && d.dropIndex !== -1) {
|
|
286
|
-
if (d.type === "row") this._moveRow(d.index, d.dropIndex);
|
|
287
|
-
else this._moveCol(d.index, d.dropIndex);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// Swallow the click event that the browser fires after pointerup
|
|
291
|
-
// so the popover menu doesn't open after a drag.
|
|
292
|
-
const swallowClick = (ev: Event) => {
|
|
293
|
-
ev.preventDefault();
|
|
294
|
-
ev.stopPropagation();
|
|
295
|
-
ev.stopImmediatePropagation();
|
|
296
|
-
};
|
|
297
|
-
document.addEventListener("click", swallowClick, {
|
|
298
|
-
capture: true,
|
|
299
|
-
once: true,
|
|
300
|
-
});
|
|
301
|
-
// Safety: remove after a short delay in case click never fires
|
|
302
|
-
setTimeout(() => {
|
|
303
|
-
document.removeEventListener("click", swallowClick, {
|
|
304
|
-
capture: true,
|
|
305
|
-
});
|
|
306
|
-
}, 200);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// If pending (no drag threshold met) — let the click go through
|
|
310
|
-
// to the original popover menu handler.
|
|
311
|
-
|
|
312
|
-
// Reset
|
|
313
|
-
d.active = false;
|
|
314
|
-
d.pending = false;
|
|
315
|
-
document.removeEventListener("pointermove", this._onMoveBound);
|
|
316
|
-
document.removeEventListener("pointerup", this._onUpBound);
|
|
317
|
-
document.removeEventListener("pointercancel", this._onUpBound);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
// ─── Move Row / Column ──────────────────────────────────────────────
|
|
321
|
-
|
|
322
|
-
private _moveRow(from: number, to: number): void {
|
|
323
|
-
const tableEl = this._wrapperRef?.querySelector<HTMLElement>(".tc-table");
|
|
324
|
-
if (!tableEl) return;
|
|
325
|
-
|
|
326
|
-
const rows = Array.from(tableEl.querySelectorAll<HTMLElement>(".tc-row"));
|
|
327
|
-
if (from < 0 || from >= rows.length) return;
|
|
328
|
-
|
|
329
|
-
const target = to > from ? to - 1 : to;
|
|
330
|
-
if (target === from) return;
|
|
331
|
-
|
|
332
|
-
const row = rows[from];
|
|
333
|
-
const ref = rows[target];
|
|
334
|
-
if (target > from) {
|
|
335
|
-
ref.parentElement!.insertBefore(row, ref.nextSibling);
|
|
336
|
-
} else {
|
|
337
|
-
ref.parentElement!.insertBefore(row, ref);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
private _moveCol(from: number, to: number): void {
|
|
342
|
-
const tableEl = this._wrapperRef?.querySelector<HTMLElement>(".tc-table");
|
|
343
|
-
if (!tableEl) return;
|
|
344
|
-
|
|
345
|
-
const target = to > from ? to - 1 : to;
|
|
346
|
-
if (target === from) return;
|
|
347
|
-
|
|
348
|
-
tableEl.querySelectorAll<HTMLElement>(".tc-row").forEach((row) => {
|
|
349
|
-
const cells = Array.from(row.querySelectorAll<HTMLElement>(".tc-cell"));
|
|
350
|
-
if (from >= cells.length) return;
|
|
351
|
-
|
|
352
|
-
const cell = cells[from];
|
|
353
|
-
const ref = cells[target];
|
|
354
|
-
if (target > from) {
|
|
355
|
-
row.insertBefore(cell, ref.nextSibling);
|
|
356
|
-
} else {
|
|
357
|
-
row.insertBefore(cell, ref);
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// ─── Drop Index Calc ────────────────────────────────────────────────
|
|
363
|
-
|
|
364
|
-
private _calcDrop(wrapper: HTMLElement, cx: number, cy: number): number {
|
|
365
|
-
const tableEl = wrapper.querySelector<HTMLElement>(".tc-table");
|
|
366
|
-
if (!tableEl) return this._drag.index;
|
|
367
|
-
|
|
368
|
-
if (this._drag.type === "row") {
|
|
369
|
-
const rows = tableEl.querySelectorAll<HTMLElement>(".tc-row");
|
|
370
|
-
for (let i = 0; i < rows.length; i++) {
|
|
371
|
-
const r = rows[i].getBoundingClientRect();
|
|
372
|
-
if (cy < r.top + r.height / 2) return i;
|
|
373
|
-
}
|
|
374
|
-
return rows.length;
|
|
375
|
-
} else {
|
|
376
|
-
const first = tableEl.querySelector<HTMLElement>(".tc-row");
|
|
377
|
-
if (!first) return this._drag.index;
|
|
378
|
-
const cells = first.querySelectorAll<HTMLElement>(".tc-cell");
|
|
379
|
-
for (let i = 0; i < cells.length; i++) {
|
|
380
|
-
const r = cells[i].getBoundingClientRect();
|
|
381
|
-
if (cx < r.left + r.width / 2) return i;
|
|
382
|
-
}
|
|
383
|
-
return cells.length;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
// ─── Visual Feedback ────────────────────────────────────────────────
|
|
388
|
-
|
|
389
|
-
private _highlight(type: "row" | "col", idx: number, on: boolean): void {
|
|
390
|
-
const tableEl = this._wrapperRef?.querySelector<HTMLElement>(".tc-table");
|
|
391
|
-
if (!tableEl) return;
|
|
392
|
-
|
|
393
|
-
if (type === "row") {
|
|
394
|
-
const rows = tableEl.querySelectorAll<HTMLElement>(".tc-row");
|
|
395
|
-
rows[idx]?.classList.toggle("tc-dnd__row--dragging", on);
|
|
396
|
-
} else {
|
|
397
|
-
tableEl.querySelectorAll<HTMLElement>(".tc-row").forEach((row) => {
|
|
398
|
-
const cells = row.querySelectorAll<HTMLElement>(".tc-cell");
|
|
399
|
-
cells[idx]?.classList.toggle("tc-dnd__cell--dragging", on);
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
private _showIndicator(wrapper: HTMLElement, dropIdx: number): void {
|
|
405
|
-
if (!this._indicator) return;
|
|
406
|
-
const tableEl = wrapper.querySelector<HTMLElement>(".tc-table");
|
|
407
|
-
if (!tableEl) return;
|
|
408
|
-
|
|
409
|
-
const { type, index } = this._drag;
|
|
410
|
-
if (dropIdx === index || dropIdx === index + 1) {
|
|
411
|
-
this._indicator.style.display = "none";
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
const wrapRect = wrapper.getBoundingClientRect();
|
|
416
|
-
this._indicator.style.display = "block";
|
|
417
|
-
|
|
418
|
-
if (type === "row") {
|
|
419
|
-
const rows = tableEl.querySelectorAll<HTMLElement>(".tc-row");
|
|
420
|
-
const tableRect = tableEl.getBoundingClientRect();
|
|
421
|
-
let y: number;
|
|
422
|
-
if (dropIdx >= rows.length) {
|
|
423
|
-
y = rows[rows.length - 1].getBoundingClientRect().bottom;
|
|
424
|
-
} else {
|
|
425
|
-
y = rows[dropIdx].getBoundingClientRect().top;
|
|
426
|
-
}
|
|
427
|
-
this._indicator.style.left = `${tableRect.left - wrapRect.left}px`;
|
|
428
|
-
this._indicator.style.top = `${y - wrapRect.top - 2}px`;
|
|
429
|
-
this._indicator.style.width = `${tableRect.width}px`;
|
|
430
|
-
this._indicator.style.height = "4px";
|
|
431
|
-
} else {
|
|
432
|
-
const first = tableEl.querySelector<HTMLElement>(".tc-row");
|
|
433
|
-
if (!first) return;
|
|
434
|
-
const cells = first.querySelectorAll<HTMLElement>(".tc-cell");
|
|
435
|
-
const tableRect = tableEl.getBoundingClientRect();
|
|
436
|
-
let x: number;
|
|
437
|
-
if (dropIdx >= cells.length) {
|
|
438
|
-
x = cells[cells.length - 1].getBoundingClientRect().right;
|
|
439
|
-
} else {
|
|
440
|
-
x = cells[dropIdx].getBoundingClientRect().left;
|
|
441
|
-
}
|
|
442
|
-
this._indicator.style.left = `${x - wrapRect.left - 2}px`;
|
|
443
|
-
this._indicator.style.top = `${tableRect.top - wrapRect.top}px`;
|
|
444
|
-
this._indicator.style.width = "4px";
|
|
445
|
-
this._indicator.style.height = `${tableRect.height}px`;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
// ─── Cleanup ────────────────────────────────────────────────────────
|
|
450
|
-
|
|
451
|
-
private _teardown(): void {
|
|
452
|
-
if (this._rafId) cancelAnimationFrame(this._rafId);
|
|
453
|
-
document.removeEventListener("pointermove", this._onMoveBound);
|
|
454
|
-
document.removeEventListener("pointerup", this._onUpBound);
|
|
455
|
-
document.removeEventListener("pointercancel", this._onUpBound);
|
|
456
|
-
this._mutationObs?.disconnect();
|
|
457
|
-
this._indicator?.remove();
|
|
458
|
-
document.body.style.cursor = "";
|
|
459
|
-
document.body.style.userSelect = "";
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
}
|