@atlaskit/editor-plugin-table 0.1.0 → 0.1.1

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.
Files changed (190) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +2 -1
  3. package/dist/cjs/version.json +1 -1
  4. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +2 -1
  5. package/dist/es2019/version.json +1 -1
  6. package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +2 -1
  7. package/dist/esm/version.json +1 -1
  8. package/examples/99-testing.tsx +35 -30
  9. package/package.json +2 -11
  10. package/src/__tests__/integration/__fixtures__/auto-size-documents.ts +5 -10
  11. package/src/__tests__/integration/__fixtures__/layout-documents.ts +1 -2
  12. package/src/__tests__/integration/__fixtures__/resize-documents.ts +5 -10
  13. package/src/__tests__/integration/resize.ts +1 -2
  14. package/src/__tests__/unit/analytics.ts +33 -32
  15. package/src/__tests__/unit/collab.ts +12 -9
  16. package/src/__tests__/unit/commands/sort.ts +28 -28
  17. package/src/__tests__/unit/copy-paste.ts +6 -8
  18. package/src/__tests__/unit/event-handlers.ts +7 -10
  19. package/src/__tests__/unit/fix-tables.ts +17 -23
  20. package/src/__tests__/unit/get-toolbar-config.ts +0 -5
  21. package/src/__tests__/unit/hover-selection.ts +1 -66
  22. package/src/__tests__/unit/index-with-fake-timers.ts +1 -1
  23. package/src/__tests__/unit/index.ts +5 -5
  24. package/src/__tests__/unit/nodeviews/TableComponent.tsx +11 -218
  25. package/src/__tests__/unit/nodeviews/cell.ts +12 -10
  26. package/src/__tests__/unit/nodeviews/table.ts +25 -26
  27. package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +11 -8
  28. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +11 -12
  29. package/src/__tests__/unit/toolbar.ts +18 -5
  30. package/src/__tests__/unit/ui/ContextualMenu.tsx +55 -0
  31. package/src/__tests__/unit/ui/CornerControls.tsx +7 -7
  32. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +45 -49
  33. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +49 -0
  34. package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +30 -2
  35. package/src/__tests__/unit/ui/FloatingInsertButton.tsx +143 -111
  36. package/src/__tests__/unit/ui/RowControls.tsx +112 -141
  37. package/src/__tests__/unit/ui/TableFloatingControls.tsx +18 -15
  38. package/src/__tests__/unit/undo-redo.ts +10 -9
  39. package/src/__tests__/unit/utils/nodes.ts +8 -4
  40. package/src/__tests__/unit/utils/row-controls.ts +8 -4
  41. package/src/plugins/table/commands/clear.ts +30 -29
  42. package/src/plugins/table/commands/go-to-next-cell.ts +41 -38
  43. package/src/plugins/table/commands/insert.ts +91 -91
  44. package/src/plugins/table/commands/misc.ts +123 -125
  45. package/src/plugins/table/commands/selection.ts +329 -319
  46. package/src/plugins/table/commands-with-analytics.ts +299 -294
  47. package/src/plugins/table/event-handlers.ts +111 -111
  48. package/src/plugins/table/handlers.ts +95 -94
  49. package/src/plugins/table/nodeviews/OverflowShadowsObserver.ts +4 -3
  50. package/src/plugins/table/nodeviews/TableComponent.tsx +6 -9
  51. package/src/plugins/table/nodeviews/update-overflow-shadows.ts +39 -39
  52. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +7 -9
  53. package/src/plugins/table/pm-plugins/decorations/utils/column-resizing.ts +30 -30
  54. package/src/plugins/table/pm-plugins/decorations/utils/compose-decorations.ts +7 -7
  55. package/src/plugins/table/pm-plugins/plugin-factory.ts +33 -33
  56. package/src/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.ts +6 -9
  57. package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +3 -2
  58. package/src/plugins/table/pm-plugins/table-resizing/commands.ts +98 -90
  59. package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +46 -47
  60. package/src/plugins/table/toolbar.tsx +116 -113
  61. package/src/plugins/table/transforms/column-width.ts +143 -146
  62. package/src/plugins/table/transforms/delete-columns.ts +144 -142
  63. package/src/plugins/table/transforms/delete-rows.ts +110 -111
  64. package/src/plugins/table/transforms/metadata.ts +9 -9
  65. package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +7 -6
  66. package/src/plugins/table/ui/FloatingDeleteButton/index.tsx +3 -2
  67. package/src/plugins/table/ui/FloatingInsertButton/index.tsx +2 -5
  68. package/src/plugins/table/ui/LayoutButton/index.tsx +2 -6
  69. package/src/plugins/table/ui/common-styles.ts +1 -3
  70. package/src/plugins/table/utils/analytics.ts +24 -25
  71. package/src/plugins/table/utils/dom.ts +3 -3
  72. package/src/plugins/table/utils/row-controls.ts +92 -93
  73. package/dist/types-ts4.0/index.d.ts +0 -1
  74. package/dist/types-ts4.0/plugins/table/commands/clear.d.ts +0 -3
  75. package/dist/types-ts4.0/plugins/table/commands/collapse.d.ts +0 -2
  76. package/dist/types-ts4.0/plugins/table/commands/go-to-next-cell.d.ts +0 -4
  77. package/dist/types-ts4.0/plugins/table/commands/hover.d.ts +0 -8
  78. package/dist/types-ts4.0/plugins/table/commands/index.d.ts +0 -7
  79. package/dist/types-ts4.0/plugins/table/commands/insert.d.ts +0 -10
  80. package/dist/types-ts4.0/plugins/table/commands/misc.d.ts +0 -27
  81. package/dist/types-ts4.0/plugins/table/commands/selection.d.ts +0 -8
  82. package/dist/types-ts4.0/plugins/table/commands/sort.d.ts +0 -3
  83. package/dist/types-ts4.0/plugins/table/commands/split-cell.d.ts +0 -6
  84. package/dist/types-ts4.0/plugins/table/commands/toggle.d.ts +0 -12
  85. package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +0 -26
  86. package/dist/types-ts4.0/plugins/table/create-plugin-config.d.ts +0 -2
  87. package/dist/types-ts4.0/plugins/table/event-handlers.d.ts +0 -16
  88. package/dist/types-ts4.0/plugins/table/handlers.d.ts +0 -3
  89. package/dist/types-ts4.0/plugins/table/index.d.ts +0 -17
  90. package/dist/types-ts4.0/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +0 -26
  91. package/dist/types-ts4.0/plugins/table/nodeviews/TableComponent.d.ts +0 -72
  92. package/dist/types-ts4.0/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +0 -9
  93. package/dist/types-ts4.0/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +0 -9
  94. package/dist/types-ts4.0/plugins/table/nodeviews/table.d.ts +0 -31
  95. package/dist/types-ts4.0/plugins/table/nodeviews/tableCell.d.ts +0 -19
  96. package/dist/types-ts4.0/plugins/table/nodeviews/types.d.ts +0 -24
  97. package/dist/types-ts4.0/plugins/table/nodeviews/update-overflow-shadows.d.ts +0 -8
  98. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/plugin.d.ts +0 -7
  99. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +0 -3
  100. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +0 -2
  101. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +0 -2
  102. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/index.d.ts +0 -3
  103. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/types.d.ts +0 -6
  104. package/dist/types-ts4.0/plugins/table/pm-plugins/default-table-selection.d.ts +0 -5
  105. package/dist/types-ts4.0/plugins/table/pm-plugins/keymap.d.ts +0 -5
  106. package/dist/types-ts4.0/plugins/table/pm-plugins/main.d.ts +0 -8
  107. package/dist/types-ts4.0/plugins/table/pm-plugins/plugin-factory.d.ts +0 -1
  108. package/dist/types-ts4.0/plugins/table/pm-plugins/plugin-key.d.ts +0 -3
  109. package/dist/types-ts4.0/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.d.ts +0 -4
  110. package/dist/types-ts4.0/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +0 -15
  111. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/commands.d.ts +0 -3
  112. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/index.d.ts +0 -6
  113. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +0 -6
  114. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +0 -65
  115. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +0 -3
  116. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +0 -3
  117. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +0 -4
  118. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/types.d.ts +0 -16
  119. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/util.d.ts +0 -2
  120. package/dist/types-ts4.0/plugins/table/pm-plugins/table-local-id.d.ts +0 -22
  121. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/commands.d.ts +0 -25
  122. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +0 -4
  123. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/index.d.ts +0 -4
  124. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +0 -4
  125. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +0 -3
  126. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin.d.ts +0 -6
  127. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/reducer.d.ts +0 -3
  128. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +0 -8
  129. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +0 -14
  130. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +0 -4
  131. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +0 -13
  132. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +0 -12
  133. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +0 -22
  134. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +0 -2
  135. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +0 -4
  136. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +0 -29
  137. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -17
  138. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +0 -22
  139. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +0 -1
  140. package/dist/types-ts4.0/plugins/table/pm-plugins/table-selection-keymap.d.ts +0 -4
  141. package/dist/types-ts4.0/plugins/table/reducer.d.ts +0 -3
  142. package/dist/types-ts4.0/plugins/table/toolbar.d.ts +0 -36
  143. package/dist/types-ts4.0/plugins/table/transforms/column-width.d.ts +0 -18
  144. package/dist/types-ts4.0/plugins/table/transforms/delete-columns.d.ts +0 -3
  145. package/dist/types-ts4.0/plugins/table/transforms/delete-rows.d.ts +0 -3
  146. package/dist/types-ts4.0/plugins/table/transforms/fix-tables.d.ts +0 -10
  147. package/dist/types-ts4.0/plugins/table/transforms/index.d.ts +0 -7
  148. package/dist/types-ts4.0/plugins/table/transforms/merge.d.ts +0 -5
  149. package/dist/types-ts4.0/plugins/table/transforms/metadata.d.ts +0 -21
  150. package/dist/types-ts4.0/plugins/table/transforms/replace-table.d.ts +0 -5
  151. package/dist/types-ts4.0/plugins/table/transforms/split.d.ts +0 -9
  152. package/dist/types-ts4.0/plugins/table/types.d.ts +0 -328
  153. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualButton/index.d.ts +0 -29
  154. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualButton/styles.d.ts +0 -1
  155. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +0 -87
  156. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/index.d.ts +0 -22
  157. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/styles.d.ts +0 -2
  158. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +0 -14
  159. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +0 -10
  160. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/index.d.ts +0 -54
  161. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/types.d.ts +0 -1
  162. package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +0 -12
  163. package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +0 -3
  164. package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/index.d.ts +0 -35
  165. package/dist/types-ts4.0/plugins/table/ui/LayoutButton/index.d.ts +0 -21
  166. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +0 -16
  167. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +0 -21
  168. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +0 -17
  169. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/index.d.ts +0 -40
  170. package/dist/types-ts4.0/plugins/table/ui/common-styles.d.ts +0 -4
  171. package/dist/types-ts4.0/plugins/table/ui/consts.d.ts +0 -39
  172. package/dist/types-ts4.0/plugins/table/ui/messages.d.ts +0 -38
  173. package/dist/types-ts4.0/plugins/table/ui/ui-styles.d.ts +0 -15
  174. package/dist/types-ts4.0/plugins/table/utils/analytics.d.ts +0 -18
  175. package/dist/types-ts4.0/plugins/table/utils/collapse.d.ts +0 -29
  176. package/dist/types-ts4.0/plugins/table/utils/column-controls.d.ts +0 -10
  177. package/dist/types-ts4.0/plugins/table/utils/decoration.d.ts +0 -16
  178. package/dist/types-ts4.0/plugins/table/utils/dom.d.ts +0 -20
  179. package/dist/types-ts4.0/plugins/table/utils/get-allow-add-column-custom-step.d.ts +0 -2
  180. package/dist/types-ts4.0/plugins/table/utils/index.d.ts +0 -11
  181. package/dist/types-ts4.0/plugins/table/utils/nodes.d.ts +0 -12
  182. package/dist/types-ts4.0/plugins/table/utils/paste.d.ts +0 -14
  183. package/dist/types-ts4.0/plugins/table/utils/referentiality.d.ts +0 -2
  184. package/dist/types-ts4.0/plugins/table/utils/row-controls.d.ts +0 -16
  185. package/dist/types-ts4.0/plugins/table/utils/selection.d.ts +0 -6
  186. package/dist/types-ts4.0/plugins/table/utils/table.d.ts +0 -4
  187. package/dist/types-ts4.0/plugins/table/utils/update-plugin-state-decorations.d.ts +0 -4
  188. package/dist/types-ts4.0/plugins/table-plugin.d.ts +0 -2
  189. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/ContextualMenu.tsx +0 -56
  190. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/FloatingContextualMenu.tsx +0 -50
@@ -1,18 +0,0 @@
1
- import { Node as PMNode } from 'prosemirror-model';
2
- import { Transaction } from 'prosemirror-state';
3
- import { ResizeState } from '../pm-plugins/table-resizing/utils';
4
- import { ContentNodeWithPos } from 'prosemirror-utils';
5
- import { EditorView } from 'prosemirror-view';
6
- import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
7
- export declare const updateColumnWidths: (resizeState: ResizeState, table: PMNode, start: number) => (tr: Transaction) => Transaction;
8
- /**
9
- * This function is called when user inserts/deletes a column in a table to;
10
- * - rescale all columns (if the table did not overflow before the insertion)
11
- * - and update column widths.
12
- *
13
- * This is done manually to avoid a multi-dispatch in TableComponent. See [ED-8288].
14
- * @param table
15
- * @param view
16
- * @returns Updated transaction with rescaled columns for a given table
17
- */
18
- export declare const rescaleColumns: (getEditorContainerWidth: GetEditorContainerWidth) => (table: ContentNodeWithPos, view: EditorView | undefined) => (tr: Transaction) => Transaction;
@@ -1,3 +0,0 @@
1
- import { Transaction } from 'prosemirror-state';
2
- import { Rect } from '@atlaskit/editor-tables/table-map';
3
- export declare const deleteColumns: (rect: Rect, allowAddColumnCustomStep?: boolean) => (tr: Transaction) => Transaction;
@@ -1,3 +0,0 @@
1
- import { Transaction } from 'prosemirror-state';
2
- import { Rect } from '@atlaskit/editor-tables/table-map';
3
- export declare const deleteRows: (rect: Rect, isHeaderRowRequired?: boolean) => (tr: Transaction) => Transaction;
@@ -1,10 +0,0 @@
1
- import { Node as PMNode } from 'prosemirror-model';
2
- import { Transaction } from 'prosemirror-state';
3
- import { EditorView } from 'prosemirror-view';
4
- import { ReportInvalidNodeAttrs } from '../types';
5
- export declare const fireAnalytics: (properties?: {}) => Promise<Response>;
6
- export declare const removeExtraneousColumnWidths: (node: PMNode, basePos: number, tr: Transaction, reportInvalidTableCellSpanAttrs?: ReportInvalidNodeAttrs | undefined) => boolean;
7
- export declare const fixTables: (tr: Transaction, reportInvalidTableCellSpanAttrs?: ReportInvalidNodeAttrs | undefined) => Transaction | undefined;
8
- export declare const fixAutoSizedTable: (view: EditorView, tableNode: PMNode, tableRef: HTMLTableElement, tablePos: number, opts: {
9
- containerWidth: number;
10
- }) => Transaction;
@@ -1,7 +0,0 @@
1
- export { mergeCells, canMergeCells, removeEmptyColumns } from './merge';
2
- export { fireAnalytics, fixTables, fixAutoSizedTable } from './fix-tables';
3
- export { deleteColumns } from './delete-columns';
4
- export { deleteRows } from './delete-rows';
5
- export { updateColumnWidths } from './column-width';
6
- export { setMeta } from './metadata';
7
- export { replaceSelectedTable } from './replace-table';
@@ -1,5 +0,0 @@
1
- import { Node as PMNode } from 'prosemirror-model';
2
- import { Transaction } from 'prosemirror-state';
3
- export declare function mergeCells(tr: Transaction): Transaction;
4
- export declare function canMergeCells(tr: Transaction): boolean;
5
- export declare function removeEmptyColumns(table: PMNode): PMNode | null;
@@ -1,21 +0,0 @@
1
- import { Transaction } from 'prosemirror-state';
2
- declare type TableProblems = 'NEGATIVE_ROWSPAN' | 'REMOVE_EMPTY_ROWS' | 'REMOVE_EMPTY_COLUMNS' | 'EMPTY_TABLE' | 'FIX_ROWSPANS' | 'COLWIDTHS_BEFORE_UPDATE' | 'COLWIDTHS_AFTER_UPDATE';
3
- export declare type TableMetaData = {
4
- type: 'MERGE_CELLS';
5
- problem?: TableProblems;
6
- } | {
7
- type: 'DELETE_ROWS';
8
- problem?: TableProblems;
9
- } | {
10
- type: 'DELETE_COLUMNS';
11
- problem?: TableProblems;
12
- } | {
13
- type: 'UPDATE_COLUMN_WIDTHS';
14
- data: {
15
- colwidths: number[];
16
- colspan: number;
17
- };
18
- problem?: TableProblems;
19
- };
20
- export declare const setMeta: (meta: TableMetaData) => (tr: Transaction) => Transaction;
21
- export {};
@@ -1,5 +0,0 @@
1
- import { Transaction, EditorState } from 'prosemirror-state';
2
- import { Slice } from 'prosemirror-model';
3
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
- export declare const replaceSelectedTable: (state: EditorState, content: string | Slice, inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.CLIPBOARD, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Transaction;
@@ -1,9 +0,0 @@
1
- import { Transaction } from 'prosemirror-state';
2
- /**
3
- * Helper to split all the cells in a range of columns
4
- * @param tr
5
- * @param tablePos
6
- * @param columnStart - Start of the rect included (rect.left)
7
- * @param columnEnd - End of the rect not included (rect.right)
8
- */
9
- export declare function splitCellsInColumns(tr: Transaction, tablePos: number, columnStart: number, columnEnd: number): Transaction;
@@ -1,328 +0,0 @@
1
- import { Node as PmNode } from 'prosemirror-model';
2
- import { Transaction } from 'prosemirror-state';
3
- import { Rect } from '@atlaskit/editor-tables/table-map';
4
- import { DecorationSet } from 'prosemirror-view';
5
- import { IntlShape } from 'react-intl-next';
6
- import { TableLayout } from '@atlaskit/adf-schema';
7
- import { TableColumnOrdering } from '@atlaskit/adf-schema/steps';
8
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
9
- export declare const RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
10
- export declare type RowInsertPosition = 'TOP' | 'BOTTOM';
11
- export declare type PermittedLayoutsDescriptor = TableLayout[] | 'all';
12
- export declare type Cell = {
13
- pos: number;
14
- start: number;
15
- node: PmNode;
16
- };
17
- export declare type CellTransform = (cell: Cell) => (tr: Transaction) => Transaction;
18
- export interface InsertRowOptions {
19
- index: number;
20
- moveCursorToInsertedRow: boolean;
21
- }
22
- export declare type InsertRowMethods = INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB;
23
- export interface PluginConfig {
24
- advanced?: boolean;
25
- allowBackgroundColor?: boolean;
26
- allowColumnResizing?: boolean;
27
- allowHeaderColumn?: boolean;
28
- allowHeaderRow?: boolean;
29
- allowMergeCells?: boolean;
30
- allowNumberColumn?: boolean;
31
- allowColumnSorting?: boolean;
32
- allowAddColumnWithCustomStep?: boolean;
33
- allowCollapse?: boolean;
34
- isHeaderRowRequired?: boolean;
35
- stickToolbarToBottom?: boolean;
36
- permittedLayouts?: PermittedLayoutsDescriptor;
37
- allowControls?: boolean;
38
- stickyHeaders?: boolean;
39
- allowCellOptionsInFloatingToolbar?: boolean;
40
- tableCellOptimization?: boolean;
41
- tableRenderOptimization?: boolean;
42
- stickyHeadersOptimization?: boolean;
43
- initialRenderOptimization?: boolean;
44
- mouseMoveOptimization?: boolean;
45
- tableOverflowShadowsOptimization?: boolean;
46
- allowDistributeColumns?: boolean;
47
- }
48
- export interface ColumnResizingPluginState {
49
- resizeHandlePos: number | null;
50
- dragging: {
51
- startX: number;
52
- startWidth: number;
53
- } | null;
54
- lastClick: {
55
- x: number;
56
- y: number;
57
- time: number;
58
- } | null;
59
- lastColumnResizable?: boolean;
60
- }
61
- export declare type CellColumnPositioning = Pick<Rect, 'right' | 'left'>;
62
- export interface TablePluginState {
63
- editorHasFocus?: boolean;
64
- hoveredColumns: number[];
65
- hoveredRows: number[];
66
- pluginConfig: PluginConfig;
67
- isHeaderColumnEnabled: boolean;
68
- isHeaderRowEnabled: boolean;
69
- isNumberColumnEnabled?: boolean;
70
- targetCellPosition?: number;
71
- tableNode?: PmNode;
72
- tableRef?: HTMLTableElement;
73
- tablePos?: number;
74
- tableWrapperTarget?: HTMLElement;
75
- isContextualMenuOpen?: boolean;
76
- isInDanger?: boolean;
77
- insertColumnButtonIndex?: number;
78
- insertRowButtonIndex?: number;
79
- isFullWidthModeEnabled?: boolean;
80
- layout?: TableLayout;
81
- ordering?: TableColumnOrdering;
82
- resizeHandleColumnIndex?: number;
83
- tableCellOptimization?: boolean;
84
- isTableCollapsed?: boolean;
85
- canCollapseTable?: boolean;
86
- }
87
- export declare type TablePluginAction = {
88
- type: 'SET_EDITOR_FOCUS';
89
- data: {
90
- editorHasFocus: boolean;
91
- };
92
- } | {
93
- type: 'TOGGLE_HEADER_ROW';
94
- } | {
95
- type: 'TOGGLE_HEADER_COLUMN';
96
- } | {
97
- type: 'SORT_TABLE';
98
- data: {
99
- ordering: TableColumnOrdering;
100
- };
101
- } | {
102
- type: 'SET_TABLE_REF';
103
- data: {
104
- tableRef?: HTMLTableElement;
105
- tableNode?: PmNode;
106
- tableWrapperTarget?: HTMLElement;
107
- layout: TableLayout;
108
- isHeaderRowEnabled: boolean;
109
- isHeaderColumnEnabled: boolean;
110
- };
111
- } | {
112
- type: 'HOVER_ROWS';
113
- data: {
114
- decorationSet: DecorationSet;
115
- hoveredRows: number[];
116
- isInDanger?: boolean;
117
- };
118
- } | {
119
- type: 'HOVER_CELLS';
120
- data: {
121
- decorationSet: DecorationSet;
122
- };
123
- } | {
124
- type: 'HOVER_COLUMNS';
125
- data: {
126
- decorationSet: DecorationSet;
127
- hoveredColumns: number[];
128
- isInDanger?: boolean;
129
- };
130
- } | {
131
- type: 'HOVER_TABLE';
132
- data: {
133
- decorationSet: DecorationSet;
134
- hoveredRows: number[];
135
- hoveredColumns: number[];
136
- isInDanger?: boolean;
137
- };
138
- } | {
139
- type: 'ADD_RESIZE_HANDLE_DECORATIONS';
140
- data: {
141
- decorationSet: DecorationSet;
142
- resizeHandleColumnIndex: number;
143
- };
144
- } | {
145
- type: 'CLEAR_HOVER_SELECTION';
146
- data: {
147
- decorationSet: DecorationSet;
148
- };
149
- } | {
150
- type: 'SHOW_RESIZE_HANDLE_LINE';
151
- data: {
152
- decorationSet: DecorationSet;
153
- };
154
- } | {
155
- type: 'HIDE_RESIZE_HANDLE_LINE';
156
- data: {
157
- decorationSet: DecorationSet;
158
- };
159
- } | {
160
- type: 'SET_TARGET_CELL_POSITION';
161
- data: {
162
- targetCellPosition?: number;
163
- };
164
- } | {
165
- type: 'SELECT_COLUMN';
166
- data: {
167
- targetCellPosition: number;
168
- decorationSet: DecorationSet;
169
- };
170
- } | {
171
- type: 'SET_TABLE_LAYOUT';
172
- data: {
173
- layout: TableLayout;
174
- };
175
- } | {
176
- type: 'SHOW_INSERT_ROW_BUTTON';
177
- data: {
178
- insertRowButtonIndex: number;
179
- };
180
- } | {
181
- type: 'SHOW_INSERT_COLUMN_BUTTON';
182
- data: {
183
- insertColumnButtonIndex: number;
184
- };
185
- } | {
186
- type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON';
187
- } | {
188
- type: 'TOGGLE_CONTEXTUAL_MENU';
189
- };
190
- export declare type ColumnResizingPluginAction = {
191
- type: 'SET_RESIZE_HANDLE_POSITION';
192
- data: {
193
- resizeHandlePos: number | null;
194
- };
195
- } | {
196
- type: 'STOP_RESIZING';
197
- } | {
198
- type: 'SET_DRAGGING';
199
- data: {
200
- dragging: {
201
- startX: number;
202
- startWidth: number;
203
- } | null;
204
- };
205
- } | {
206
- type: 'SET_LAST_CLICK';
207
- data: {
208
- lastClick: {
209
- x: number;
210
- y: number;
211
- time: number;
212
- } | null;
213
- };
214
- };
215
- export declare enum TableDecorations {
216
- ALL_CONTROLS_HOVER = "CONTROLS_HOVER",
217
- ROW_CONTROLS_HOVER = "ROW_CONTROLS_HOVER",
218
- COLUMN_CONTROLS_HOVER = "COLUMN_CONTROLS_HOVER",
219
- TABLE_CONTROLS_HOVER = "TABLE_CONTROLS_HOVER",
220
- CELL_CONTROLS_HOVER = "CELL_CONTROLS_HOVER",
221
- COLUMN_CONTROLS_DECORATIONS = "COLUMN_CONTROLS_DECORATIONS",
222
- COLUMN_SELECTED = "COLUMN_SELECTED",
223
- COLUMN_RESIZING_HANDLE = "COLUMN_RESIZING_HANDLE",
224
- COLUMN_RESIZING_HANDLE_LINE = "COLUMN_RESIZING_HANDLE_LINE",
225
- LAST_CELL_ELEMENT = "LAST_CELL_ELEMENT"
226
- }
227
- export declare const TableCssClassName: {
228
- COLUMN_CONTROLS: string;
229
- COLUMN_CONTROLS_DECORATIONS: string;
230
- COLUMN_SELECTED: string;
231
- ROW_CONTROLS_WRAPPER: string;
232
- ROW_CONTROLS: string;
233
- ROW_CONTROLS_INNER: string;
234
- ROW_CONTROLS_BUTTON_WRAP: string;
235
- ROW_CONTROLS_BUTTON: string;
236
- CONTROLS_BUTTON: string;
237
- CONTROLS_BUTTON_ICON: string;
238
- CONTROLS_INSERT_BUTTON: string;
239
- CONTROLS_INSERT_BUTTON_INNER: string;
240
- CONTROLS_INSERT_BUTTON_WRAP: string;
241
- CONTROLS_INSERT_LINE: string;
242
- CONTROLS_BUTTON_OVERLAY: string;
243
- LAYOUT_BUTTON: string;
244
- CONTROLS_INSERT_MARKER: string;
245
- CONTROLS_INSERT_COLUMN: string;
246
- CONTROLS_INSERT_ROW: string;
247
- CONTROLS_DELETE_BUTTON_WRAP: string;
248
- CONTROLS_DELETE_BUTTON: string;
249
- CONTROLS_FLOATING_BUTTON_COLUMN: string;
250
- CONTROLS_FLOATING_BUTTON_ROW: string;
251
- CORNER_CONTROLS: string;
252
- CORNER_CONTROLS_INSERT_ROW_MARKER: string;
253
- CORNER_CONTROLS_INSERT_COLUMN_MARKER: string;
254
- CONTROLS_CORNER_BUTTON: string;
255
- NUMBERED_COLUMN: string;
256
- NUMBERED_COLUMN_BUTTON: string;
257
- HOVERED_COLUMN: string;
258
- HOVERED_ROW: string;
259
- HOVERED_TABLE: string;
260
- HOVERED_CELL: string;
261
- HOVERED_CELL_IN_DANGER: string;
262
- HOVERED_CELL_ACTIVE: string;
263
- HOVERED_CELL_WARNING: string;
264
- HOVERED_DELETE_BUTTON: string;
265
- WITH_CONTROLS: string;
266
- RESIZING_PLUGIN: string;
267
- RESIZE_CURSOR: string;
268
- IS_RESIZING: string;
269
- RESIZE_HANDLE: string;
270
- RESIZE_HANDLE_DECORATION: string;
271
- CONTEXTUAL_SUBMENU: string;
272
- CONTEXTUAL_MENU_BUTTON_WRAP: string;
273
- CONTEXTUAL_MENU_BUTTON: string;
274
- CONTEXTUAL_MENU_ICON: string;
275
- SELECTED_CELL: string;
276
- NODEVIEW_WRAPPER: string;
277
- TABLE_SELECTED: string;
278
- TABLE_CELL: string;
279
- TABLE_HEADER_CELL: string;
280
- TABLE_STICKY: string;
281
- TOP_LEFT_CELL: string;
282
- LAST_ITEM_IN_CELL: string;
283
- WITH_RESIZE_LINE: string;
284
- TABLE_CONTAINER: string;
285
- TABLE_NODE_WRAPPER: string;
286
- TABLE_LEFT_SHADOW: string;
287
- TABLE_RIGHT_SHADOW: string;
288
- TABLE_STICKY_SHADOW: string;
289
- TABLE_STICKY_WRAPPER: string;
290
- TABLE_STICKY_SENTINEL_TOP: string;
291
- TABLE_STICKY_SENTINEL_BOTTOM: string;
292
- TABLE_CELL_NODEVIEW_CONTENT_DOM: string;
293
- TABLE_CELL_WRAPPER: string;
294
- TABLE_HEADER_CELL_WRAPPER: string;
295
- TABLE_ROW_CONTROLS_WRAPPER: string;
296
- TABLE_COLUMN_CONTROLS_DECORATIONS: string;
297
- };
298
- export interface ToolbarMenuConfig {
299
- allowHeaderRow?: boolean;
300
- allowHeaderColumn?: boolean;
301
- allowNumberColumn?: boolean;
302
- allowCollapse?: boolean;
303
- }
304
- export interface ToolbarMenuState {
305
- isHeaderRowEnabled?: boolean;
306
- isHeaderColumnEnabled?: boolean;
307
- isNumberColumnEnabled?: boolean;
308
- isTableCollapsed?: boolean;
309
- canCollapseTable?: boolean;
310
- }
311
- export interface ToolbarMenuContext {
312
- formatMessage: IntlShape['formatMessage'];
313
- }
314
- export declare type ElementContentRects = {
315
- [key: string]: ResizeObserverEntry['contentRect'];
316
- };
317
- export declare enum ShadowEvent {
318
- SHOW_BEFORE_SHADOW = "showBeforeShadow",
319
- SHOW_AFTER_SHADOW = "showAfterShadow"
320
- }
321
- export declare type ReportInvalidNodeAttrs = (invalidNodeAttrs: InvalidNodeAttr) => void;
322
- export declare type InvalidNodeAttr = {
323
- nodeType: string;
324
- attribute: string;
325
- reason: string;
326
- spanValue: number;
327
- tableLocalId: string;
328
- };
@@ -1,29 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from '@emotion/react';
4
- import { EditorView } from 'prosemirror-view';
5
- import { WrappedComponentProps } from 'react-intl-next';
6
- import { TableLayout } from '@atlaskit/adf-schema';
7
- import { RowStickyState } from '../../pm-plugins/sticky-headers';
8
- import { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
9
- import { Node as PMNode } from 'prosemirror-model';
10
- export interface Props {
11
- editorView: EditorView;
12
- tableNode?: PMNode;
13
- targetCellPosition: number;
14
- isContextualMenuOpen?: boolean;
15
- mountPoint?: HTMLElement;
16
- boundariesElement?: HTMLElement;
17
- scrollableElement?: HTMLElement;
18
- layout?: TableLayout;
19
- isNumberColumnEnabled?: boolean;
20
- stickyHeader?: RowStickyState;
21
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
22
- }
23
- export declare class FloatingContextualButtonInner extends React.Component<Props & WrappedComponentProps, any> {
24
- static displayName: string;
25
- render(): jsx.JSX.Element | null;
26
- shouldComponentUpdate(nextProps: Props): boolean;
27
- private handleClick;
28
- }
29
- export default function (props: Props): jsx.JSX.Element;
@@ -1 +0,0 @@
1
- export declare const tableFloatingCellButtonStyles: import("@emotion/react").SerializedStyles;
@@ -1,87 +0,0 @@
1
- /** @jsx jsx */
2
- import { Component } from 'react';
3
- import { jsx } from '@emotion/react';
4
- import { Rect } from '@atlaskit/editor-tables/table-map';
5
- import { EditorView } from 'prosemirror-view';
6
- import { WrappedComponentProps } from 'react-intl-next';
7
- import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
8
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
9
- export declare const messages: {
10
- cellBackground: {
11
- id: string;
12
- defaultMessage: string;
13
- description: string;
14
- };
15
- mergeCells: {
16
- id: string;
17
- defaultMessage: string;
18
- description: string;
19
- };
20
- splitCell: {
21
- id: string;
22
- defaultMessage: string;
23
- description: string;
24
- };
25
- clearCells: {
26
- id: string;
27
- defaultMessage: string;
28
- description: string;
29
- };
30
- sortColumnASC: {
31
- id: string;
32
- defaultMessage: string;
33
- description: string;
34
- };
35
- sortColumnDESC: {
36
- id: string;
37
- defaultMessage: string;
38
- description: string;
39
- };
40
- canNotSortTable: {
41
- id: string;
42
- defaultMessage: string;
43
- description: string;
44
- };
45
- distributeColumns: {
46
- id: string;
47
- defaultMessage: string;
48
- description: string;
49
- };
50
- };
51
- export interface Props {
52
- editorView: EditorView;
53
- isOpen: boolean;
54
- selectionRect: Rect;
55
- targetCellPosition?: number;
56
- mountPoint?: HTMLElement;
57
- allowMergeCells?: boolean;
58
- allowColumnSorting?: boolean;
59
- allowBackgroundColor?: boolean;
60
- boundariesElement?: HTMLElement;
61
- offset?: Array<number>;
62
- editorAnalyticsAPI?: EditorAnalyticsAPI;
63
- getEditorContainerWidth: GetEditorContainerWidth;
64
- }
65
- export interface State {
66
- isSubmenuOpen: boolean;
67
- }
68
- export declare class ContextualMenu extends Component<Props & WrappedComponentProps, State> {
69
- state: State;
70
- static defaultProps: {
71
- boundariesElement: HTMLElement;
72
- };
73
- render(): jsx.JSX.Element | null;
74
- private handleSubMenuRef;
75
- private createItems;
76
- private onMenuItemActivated;
77
- private toggleOpen;
78
- private handleOpenChange;
79
- private handleItemMouseEnter;
80
- private handleItemMouseLeave;
81
- private closeSubmenu;
82
- private setColor;
83
- }
84
- declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
85
- WrappedComponent: import("react").ComponentType<Props & WrappedComponentProps<"intl">>;
86
- };
87
- export default _default;
@@ -1,22 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import { EditorView } from 'prosemirror-view';
4
- import { PluginConfig } from '../../types';
5
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
6
- import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
7
- export interface Props {
8
- editorView: EditorView;
9
- isOpen: boolean;
10
- getEditorContainerWidth: GetEditorContainerWidth;
11
- targetCellPosition?: number;
12
- mountPoint?: HTMLElement;
13
- boundariesElement?: HTMLElement;
14
- scrollableElement?: HTMLElement;
15
- pluginConfig?: PluginConfig;
16
- editorAnalyticsAPI?: EditorAnalyticsAPI;
17
- }
18
- declare const FloatingContextualMenu: {
19
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, }: Props): jsx.JSX.Element | null;
20
- displayName: string;
21
- };
22
- export default FloatingContextualMenu;
@@ -1,2 +0,0 @@
1
- export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
2
- export declare const tablePopupStyles: import("@emotion/react").SerializedStyles;
@@ -1,14 +0,0 @@
1
- import React, { SyntheticEvent } from 'react';
2
- import { WrappedComponentProps } from 'react-intl-next';
3
- import { MessageDescriptor } from 'react-intl-next';
4
- export interface ButtonProps {
5
- removeLabel: MessageDescriptor;
6
- style?: object;
7
- onClick?: (event: SyntheticEvent) => void;
8
- onMouseEnter?: (event: SyntheticEvent) => void;
9
- onMouseLeave?: (event: SyntheticEvent) => void;
10
- }
11
- declare const _default: React.FC<import("react-intl-next").WithIntlProps<ButtonProps & WrappedComponentProps<"intl">>> & {
12
- WrappedComponent: React.ComponentType<ButtonProps & WrappedComponentProps<"intl">>;
13
- };
14
- export default _default;
@@ -1,10 +0,0 @@
1
- import type { PopupProps } from '@atlaskit/editor-common/ui';
2
- import { CellSelectionType } from './types';
3
- interface GetPopupOptions {
4
- left: number;
5
- top: number;
6
- selectionType?: CellSelectionType;
7
- tableWrapper: HTMLElement | null;
8
- }
9
- export default function getPopupOptions({ left, top, selectionType, tableWrapper, }: GetPopupOptions): Partial<PopupProps>;
10
- export {};
@@ -1,54 +0,0 @@
1
- import { Component } from 'react';
2
- import { Selection } from 'prosemirror-state';
3
- import { EditorView } from 'prosemirror-view';
4
- import { RowStickyState } from '../../pm-plugins/sticky-headers';
5
- import { CellSelectionType } from './types';
6
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
7
- export interface Props {
8
- editorView: EditorView;
9
- selection: Selection;
10
- tableRef?: HTMLTableElement;
11
- mountPoint?: HTMLElement;
12
- boundariesElement?: HTMLElement;
13
- scrollableElement?: HTMLElement;
14
- stickyHeaders?: RowStickyState;
15
- isNumberColumnEnabled?: boolean;
16
- editorAnalyticsAPI?: EditorAnalyticsAPI;
17
- }
18
- export interface State {
19
- selectionType?: CellSelectionType;
20
- left: number;
21
- top: number;
22
- indexes: number[];
23
- position?: string;
24
- scrollLeft: number;
25
- }
26
- export declare function getSelectionType(selection: Selection): 'column' | 'row' | undefined;
27
- declare class FloatingDeleteButton extends Component<Props, State> {
28
- static displayName: string;
29
- wrapper: HTMLElement | null;
30
- constructor(props: Props);
31
- shouldComponentUpdate(_: Props, nextState: State): boolean;
32
- componentDidMount(): void;
33
- componentDidUpdate(): void;
34
- updateWrapper: () => void;
35
- componentWillUnmount(): void;
36
- onWrapperScrolled: (e: Event) => void;
37
- /**
38
- * We derivate the button state from the properties passed.
39
- * We do this in here because we need this information in different places
40
- * and this prevent to do multiple width calculations in the same component.
41
- */
42
- static getDerivedStateFromProps(nextProps: Readonly<Props>, prevState: State): Partial<State> | null;
43
- private handleMouseEnter;
44
- private handleMouseLeave;
45
- /**
46
- *
47
- *
48
- * @private
49
- * @memberof FloatingDeleteButton
50
- */
51
- private handleClick;
52
- render(): JSX.Element | null;
53
- }
54
- export default FloatingDeleteButton;
@@ -1 +0,0 @@
1
- export declare type CellSelectionType = 'column' | 'row' | undefined;
@@ -1,12 +0,0 @@
1
- import React, { SyntheticEvent } from 'react';
2
- import { WrappedComponentProps } from 'react-intl-next';
3
- export interface ButtonProps {
4
- type: 'row' | 'column';
5
- tableRef: HTMLElement;
6
- onMouseDown: (event: SyntheticEvent<HTMLButtonElement>) => void;
7
- hasStickyHeaders: boolean;
8
- }
9
- declare const _default: React.FC<import("react-intl-next").WithIntlProps<ButtonProps & WrappedComponentProps<"intl">>> & {
10
- WrappedComponent: React.ComponentType<ButtonProps & WrappedComponentProps<"intl">>;
11
- };
12
- export default _default;
@@ -1,3 +0,0 @@
1
- import type { PopupProps } from '@atlaskit/editor-common/ui';
2
- declare function getPopupOptions(type: 'column' | 'row', index: number, hasNumberedColumns: boolean, tableContainer: HTMLElement | null): Partial<PopupProps>;
3
- export default getPopupOptions;