@atlaskit/editor-plugin-table 3.1.2 → 3.2.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/CHANGELOG.md +16 -0
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +36 -2
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +7 -1
- package/dist/cjs/plugins/table/nodeviews/TableStickyScrollbar.js +154 -0
- package/dist/cjs/plugins/table/toolbar.js +6 -0
- package/dist/cjs/plugins/table/ui/common-styles.js +9 -2
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +37 -3
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +11 -1
- package/dist/es2019/plugins/table/nodeviews/TableStickyScrollbar.js +112 -0
- package/dist/es2019/plugins/table/toolbar.js +6 -0
- package/dist/es2019/plugins/table/ui/common-styles.js +33 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +37 -3
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +7 -1
- package/dist/esm/plugins/table/nodeviews/TableStickyScrollbar.js +146 -0
- package/dist/esm/plugins/table/toolbar.js +6 -0
- package/dist/esm/plugins/table/ui/common-styles.js +8 -2
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types/plugins/table/nodeviews/TableStickyScrollbar.d.ts +24 -0
- package/dist/types/plugins/table/toolbar.d.ts +4 -4
- package/dist/types/plugins/table/types.d.ts +3 -0
- package/dist/types/plugins/table/ui/common-styles.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableStickyScrollbar.d.ts +24 -0
- package/dist/types-ts4.5/plugins/table/toolbar.d.ts +4 -4
- package/dist/types-ts4.5/plugins/table/types.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/common-styles.d.ts +1 -0
- package/package.json +6 -3
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +43 -18
- package/src/plugins/table/nodeviews/TableComponent.tsx +54 -3
- package/src/plugins/table/nodeviews/TableResizer.tsx +7 -1
- package/src/plugins/table/nodeviews/TableStickyScrollbar.ts +204 -0
- package/src/plugins/table/toolbar.tsx +10 -6
- package/src/plugins/table/ui/common-styles.ts +38 -0
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
akEditorTableToolbarSize,
|
|
15
15
|
akEditorUnitZIndex,
|
|
16
16
|
getSelectionStyles,
|
|
17
|
+
MAX_BROWSER_SCROLLBAR_HEIGHT,
|
|
17
18
|
relativeFontSizeToBase16,
|
|
18
19
|
SelectionStyle,
|
|
19
20
|
} from '@atlaskit/editor-shared-styles';
|
|
@@ -75,6 +76,7 @@ const cornerControlHeight = tableToolbarSize + 1;
|
|
|
75
76
|
its center should be aligned with the edge
|
|
76
77
|
*/
|
|
77
78
|
export const insertColumnButtonOffset = tableInsertColumnButtonSize / 2;
|
|
79
|
+
export const tableRowHeight = 44;
|
|
78
80
|
|
|
79
81
|
const rangeSelectionStyles = `
|
|
80
82
|
.${ClassName.NODEVIEW_WRAPPER}.${akEditorSelectedNodeClassName} table tbody tr {
|
|
@@ -114,6 +116,41 @@ const sentinelStyles = `.${ClassName.TABLE_CONTAINER} {
|
|
|
114
116
|
}
|
|
115
117
|
}`;
|
|
116
118
|
|
|
119
|
+
const stickyScrollbarSentinelStyles = `.${ClassName.TABLE_CONTAINER} {
|
|
120
|
+
> .${ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_BOTTOM},
|
|
121
|
+
> .${ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_TOP} {
|
|
122
|
+
position: absolute;
|
|
123
|
+
width: 100%;
|
|
124
|
+
height: 1px;
|
|
125
|
+
margin-top: -1px;
|
|
126
|
+
// need this to avoid sentinel being focused via keyboard
|
|
127
|
+
// this still allows it to be detected by intersection observer
|
|
128
|
+
visibility: hidden;
|
|
129
|
+
}
|
|
130
|
+
> .${ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_TOP} {
|
|
131
|
+
top: ${columnControlsDecorationHeight + tableRowHeight * 3}px;
|
|
132
|
+
}
|
|
133
|
+
> .${ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_BOTTOM} {
|
|
134
|
+
bottom: ${MAX_BROWSER_SCROLLBAR_HEIGHT}px;
|
|
135
|
+
}
|
|
136
|
+
}`;
|
|
137
|
+
|
|
138
|
+
const stickyScrollbarContainerStyles = `.${ClassName.TABLE_CONTAINER} {
|
|
139
|
+
> .${ClassName.TABLE_STICKY_SCROLLBAR_CONTAINER} {
|
|
140
|
+
width: 100%;
|
|
141
|
+
display: none;
|
|
142
|
+
overflow-x: auto;
|
|
143
|
+
position: sticky;
|
|
144
|
+
bottom: 0;
|
|
145
|
+
}
|
|
146
|
+
}`;
|
|
147
|
+
|
|
148
|
+
const stickyScrollbarStyles = () => {
|
|
149
|
+
return getBooleanFF('platform.editor.table-sticky-scrollbar')
|
|
150
|
+
? `${stickyScrollbarContainerStyles} ${stickyScrollbarSentinelStyles}`
|
|
151
|
+
: '';
|
|
152
|
+
};
|
|
153
|
+
|
|
117
154
|
const shadowSentinelStyles = `
|
|
118
155
|
.${ClassName.TABLE_SHADOW_SENTINEL_LEFT},
|
|
119
156
|
.${ClassName.TABLE_SHADOW_SENTINEL_RIGHT} {
|
|
@@ -417,6 +454,7 @@ export const tableStyles = (
|
|
|
417
454
|
|
|
418
455
|
${sentinelStyles}
|
|
419
456
|
${OverflowShadow(props)}
|
|
457
|
+
${stickyScrollbarStyles()}
|
|
420
458
|
|
|
421
459
|
.${ClassName.TABLE_STICKY} .${ClassName.TABLE_STICKY_SHADOW} {
|
|
422
460
|
height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts
|