@atlaskit/editor-plugin-table 8.4.6 → 8.4.8
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 +15 -0
- package/dist/cjs/nodeviews/OverflowShadowsObserver.js +1 -2
- package/dist/cjs/nodeviews/TableCell.js +6 -9
- package/dist/cjs/nodeviews/TableComponent.js +30 -35
- package/dist/cjs/nodeviews/TableRow.js +15 -18
- package/dist/cjs/nodeviews/TableStickyScrollbar.js +1 -2
- package/dist/cjs/nodeviews/table.js +10 -12
- package/dist/cjs/pm-plugins/plugin-key.js +3 -0
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +1 -2
- package/dist/cjs/pm-plugins/utils/nodes.js +1 -1
- package/dist/cjs/types/index.js +1 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +26 -29
- package/dist/cjs/ui/FloatingDeleteButton/index.js +11 -14
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +1 -2
- package/dist/cjs/ui/FloatingInsertButton/index.js +7 -10
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +9 -12
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +11 -15
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +6 -9
- package/dist/cjs/ui/common-styles.js +2 -0
- package/dist/cjs/ui/consts.js +3 -0
- package/dist/es2019/index.js +3 -0
- package/dist/es2019/pm-plugins/commands/index.js +3 -0
- package/dist/es2019/pm-plugins/plugin-key.js +3 -0
- package/dist/es2019/pm-plugins/utils/nodes.js +1 -1
- package/dist/es2019/types/index.js +3 -0
- package/dist/es2019/ui/common-styles.js +3 -0
- package/dist/es2019/ui/consts.js +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/nodeviews/OverflowShadowsObserver.js +1 -2
- package/dist/esm/nodeviews/TableCell.js +6 -9
- package/dist/esm/nodeviews/TableComponent.js +30 -35
- package/dist/esm/nodeviews/TableRow.js +15 -18
- package/dist/esm/nodeviews/TableStickyScrollbar.js +1 -2
- package/dist/esm/nodeviews/table.js +10 -12
- package/dist/esm/pm-plugins/commands/index.js +3 -0
- package/dist/esm/pm-plugins/plugin-key.js +3 -0
- package/dist/esm/pm-plugins/table-resizing/plugin.js +1 -2
- package/dist/esm/pm-plugins/utils/nodes.js +1 -1
- package/dist/esm/types/index.js +3 -0
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +26 -29
- package/dist/esm/ui/FloatingDeleteButton/index.js +11 -14
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +1 -2
- package/dist/esm/ui/FloatingInsertButton/index.js +7 -10
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +9 -12
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +11 -15
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +6 -9
- package/dist/esm/ui/common-styles.js +3 -0
- package/dist/esm/ui/consts.js +3 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types-ts4.5/types/index.d.ts +3 -0
- package/package.json +4 -4
- package/src/index.ts +3 -0
- package/src/pm-plugins/commands/index.ts +3 -0
- package/src/pm-plugins/plugin-key.ts +3 -0
- package/src/pm-plugins/utils/nodes.ts +3 -1
- package/src/types/index.ts +3 -0
- package/src/ui/common-styles.ts +3 -0
- package/src/ui/consts.ts +3 -0
package/dist/es2019/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
+
// Entry file in package.json
|
|
3
|
+
|
|
1
4
|
export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, setTableHovered } from './hover';
|
|
2
5
|
export { insertColumn, insertRow, createTable } from './insert';
|
|
3
6
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
|
|
@@ -85,7 +85,7 @@ function getTableWidths(node) {
|
|
|
85
85
|
export const isTableNested = (state, tablePos = 0) => {
|
|
86
86
|
const parent = state.doc.resolve(tablePos).parent;
|
|
87
87
|
const nodeTypes = state.schema.nodes;
|
|
88
|
-
return parent.type === nodeTypes.layoutColumn || parent.type === nodeTypes.expand || parent.type === nodeTypes.bodiedExtension || parent.type === nodeTypes.extensionFrame;
|
|
88
|
+
return parent.type === nodeTypes.layoutColumn || parent.type === nodeTypes.expand || parent.type === nodeTypes.bodiedExtension || parent.type === nodeTypes.extensionFrame || parent.type === nodeTypes.tableHeader || parent.type === nodeTypes.tableCell;
|
|
89
89
|
};
|
|
90
90
|
export const isTableNestedInMoreThanOneNode = (state, tablePos = 0) => {
|
|
91
91
|
return state.doc.resolve(tablePos).depth > 2;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
+
// Entry file in package.json
|
|
3
|
+
|
|
1
4
|
import { tableCellSelector, tableHeaderSelector, tablePrefixSelector } from '@atlaskit/adf-schema';
|
|
2
5
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
3
6
|
export const RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
+
// Entry file in package.json
|
|
3
|
+
|
|
1
4
|
import { tableCellBorderWidth, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
2
5
|
import { akEditorTableBorder, akEditorTableBorderSelected, akEditorTableCellBlanketDeleted, akEditorTableCellBlanketSelected, akEditorTableHeaderCellBackground, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
|
|
3
6
|
import { B200, N0, N20, N200, N20A, N300, R300, R400, R75 } from '@atlaskit/theme/colors';
|
package/dist/esm/index.js
CHANGED
|
@@ -93,7 +93,7 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
|
|
|
93
93
|
this.wrapper = wrapper;
|
|
94
94
|
this.init();
|
|
95
95
|
}
|
|
96
|
-
_createClass(OverflowShadowsObserver, [{
|
|
96
|
+
return _createClass(OverflowShadowsObserver, [{
|
|
97
97
|
key: "updateStickyShadowsHeightIfChanged",
|
|
98
98
|
value: function updateStickyShadowsHeightIfChanged() {
|
|
99
99
|
if (!this.isSticky) {
|
|
@@ -122,5 +122,4 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}]);
|
|
125
|
-
return OverflowShadowsObserver;
|
|
126
125
|
}();
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
function
|
|
8
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
9
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
10
|
import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
|
|
12
11
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
@@ -37,12 +36,10 @@ function delayUntilIdle(cb) {
|
|
|
37
36
|
}
|
|
38
37
|
var cssVariablePattern = /^VAR\(--.*\)$/;
|
|
39
38
|
var TableCell = /*#__PURE__*/function (_TableNodeView) {
|
|
40
|
-
_inherits(TableCell, _TableNodeView);
|
|
41
|
-
var _super = _createSuper(TableCell);
|
|
42
39
|
function TableCell(node, view, getPos, eventDispatcher, editorAnalyticsAPI) {
|
|
43
40
|
var _this;
|
|
44
41
|
_classCallCheck(this, TableCell);
|
|
45
|
-
_this =
|
|
42
|
+
_this = _callSuper(this, TableCell, [node, view, getPos, eventDispatcher]);
|
|
46
43
|
|
|
47
44
|
// CONFCLOUD-78239: Previously we had a bug which tried to invert the heading colour of a table
|
|
48
45
|
// Obviously design tokens can't be inverted and so it would result in `VAR(--DS-BACKGROUND-ACCENT-GRAY-SUBTLEST, #F4F5F7)`
|
|
@@ -54,7 +51,7 @@ var TableCell = /*#__PURE__*/function (_TableNodeView) {
|
|
|
54
51
|
// This is a workaround to fix those cases on the fly. Note it is super specific on purpose
|
|
55
52
|
// so that it just fixes the heading token (other tokens should be unaffected)
|
|
56
53
|
// At some point in the future
|
|
57
|
-
_defineProperty(
|
|
54
|
+
_defineProperty(_this, "destroy", function () {
|
|
58
55
|
if (_this.delayHandle && typeof window !== 'undefined') {
|
|
59
56
|
var _window, _window$cancelIdleCal, _window2, _window2$cancelAnimat;
|
|
60
57
|
// eslint-disable-next-line compat/compat
|
|
@@ -82,7 +79,8 @@ var TableCell = /*#__PURE__*/function (_TableNodeView) {
|
|
|
82
79
|
}
|
|
83
80
|
return _this;
|
|
84
81
|
}
|
|
85
|
-
|
|
82
|
+
_inherits(TableCell, _TableNodeView);
|
|
83
|
+
return _createClass(TableCell, [{
|
|
86
84
|
key: "update",
|
|
87
85
|
value: function update(node) {
|
|
88
86
|
var didUpdate = this.updateNodeView(node);
|
|
@@ -140,6 +138,5 @@ var TableCell = /*#__PURE__*/function (_TableNodeView) {
|
|
|
140
138
|
return false;
|
|
141
139
|
}
|
|
142
140
|
}]);
|
|
143
|
-
return TableCell;
|
|
144
141
|
}(TableNodeView);
|
|
145
142
|
export { TableCell as default };
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
8
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
10
9
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
10
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
function
|
|
13
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
15
14
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
16
15
|
import React from 'react';
|
|
17
16
|
import classnames from 'classnames';
|
|
@@ -63,30 +62,27 @@ var isOverflowAnalyticsEnabled = false;
|
|
|
63
62
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
64
63
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
65
64
|
var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
66
|
-
_inherits(TableComponent, _React$Component);
|
|
67
|
-
var _super = _createSuper(TableComponent);
|
|
68
65
|
function TableComponent(props) {
|
|
69
|
-
var _defineProperty2;
|
|
70
66
|
var _this;
|
|
71
67
|
_classCallCheck(this, TableComponent);
|
|
72
|
-
_this =
|
|
73
|
-
_defineProperty(
|
|
68
|
+
_this = _callSuper(this, TableComponent, [props]);
|
|
69
|
+
_defineProperty(_this, "state", _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
74
70
|
scroll: 0,
|
|
75
71
|
parentWidth: undefined
|
|
76
|
-
},
|
|
77
|
-
_defineProperty(
|
|
72
|
+
}, ShadowEvent.SHOW_BEFORE_SHADOW, false), ShadowEvent.SHOW_AFTER_SHADOW, false), "tableWrapperWidth", undefined), "tableWrapperHeight", undefined));
|
|
73
|
+
_defineProperty(_this, "handleMouseOut", function (event) {
|
|
78
74
|
if (!isTableInFocus(_this.props.view)) {
|
|
79
75
|
return false;
|
|
80
76
|
}
|
|
81
77
|
return handleMouseOut(_this.props.view, event);
|
|
82
78
|
});
|
|
83
|
-
_defineProperty(
|
|
79
|
+
_defineProperty(_this, "handleMouseOver", function (event) {
|
|
84
80
|
if (!isTableInFocus(_this.props.view)) {
|
|
85
81
|
return false;
|
|
86
82
|
}
|
|
87
83
|
return withCellTracking(handleMouseOver)(_this.props.view, event);
|
|
88
84
|
});
|
|
89
|
-
_defineProperty(
|
|
85
|
+
_defineProperty(_this, "handleMouseEnter", function () {
|
|
90
86
|
var node = _this.props.getNode();
|
|
91
87
|
var pos = _this.props.getPos();
|
|
92
88
|
var tr = _this.props.view.state.tr;
|
|
@@ -94,13 +90,13 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
94
90
|
tr.setMeta('mouseEnterTable', [tableId, node, pos]);
|
|
95
91
|
_this.props.view.dispatch(tr);
|
|
96
92
|
});
|
|
97
|
-
_defineProperty(
|
|
93
|
+
_defineProperty(_this, "updateShadowState", function (shadowKey, value) {
|
|
98
94
|
if (_this.state[shadowKey] === value) {
|
|
99
95
|
return;
|
|
100
96
|
}
|
|
101
97
|
_this.setState(_defineProperty({}, shadowKey, value));
|
|
102
98
|
});
|
|
103
|
-
_defineProperty(
|
|
99
|
+
_defineProperty(_this, "createShadowSentinels", function (table) {
|
|
104
100
|
if (table) {
|
|
105
101
|
var shadowSentinelLeft = document.createElement('span');
|
|
106
102
|
shadowSentinelLeft.className = ClassName.TABLE_SHADOW_SENTINEL_LEFT;
|
|
@@ -110,7 +106,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
110
106
|
table.prepend(shadowSentinelRight);
|
|
111
107
|
}
|
|
112
108
|
});
|
|
113
|
-
_defineProperty(
|
|
109
|
+
_defineProperty(_this, "onStickyState", function (state) {
|
|
114
110
|
var pos = _this.props.getPos();
|
|
115
111
|
if (!isValidPosition(pos, _this.props.view.state)) {
|
|
116
112
|
return;
|
|
@@ -125,8 +121,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
123
|
});
|
|
128
|
-
_defineProperty(
|
|
129
|
-
_defineProperty(
|
|
124
|
+
_defineProperty(_this, "prevTableState", null);
|
|
125
|
+
_defineProperty(_this, "handleScroll", function (event) {
|
|
130
126
|
if (!_this.wrapper || event.target !== _this.wrapper) {
|
|
131
127
|
return;
|
|
132
128
|
}
|
|
@@ -144,7 +140,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
144
140
|
}
|
|
145
141
|
_this.setState(_defineProperty({}, ShadowEvent.SHOW_BEFORE_SHADOW, _this.wrapper.scrollLeft !== 0));
|
|
146
142
|
});
|
|
147
|
-
_defineProperty(
|
|
143
|
+
_defineProperty(_this, "handleTableResizing", function () {
|
|
148
144
|
var _this$props = _this.props,
|
|
149
145
|
getNode = _this$props.getNode,
|
|
150
146
|
containerWidth = _this$props.containerWidth,
|
|
@@ -207,7 +203,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
207
203
|
_this.layoutSize = layoutSize;
|
|
208
204
|
});
|
|
209
205
|
// Function gets called when table is nested.
|
|
210
|
-
_defineProperty(
|
|
206
|
+
_defineProperty(_this, "scaleTable", function (scaleOptions) {
|
|
211
207
|
var isUserTriggered = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
212
208
|
var _this$props2 = _this.props,
|
|
213
209
|
view = _this$props2.view,
|
|
@@ -240,7 +236,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
240
236
|
}
|
|
241
237
|
dispatch(tr);
|
|
242
238
|
});
|
|
243
|
-
_defineProperty(
|
|
239
|
+
_defineProperty(_this, "setTimerToSendInitialOverflowCaptured", function (isOverflowing) {
|
|
244
240
|
var _this$state;
|
|
245
241
|
var _this$props3 = _this.props,
|
|
246
242
|
dispatchAnalyticsEvent = _this$props3.dispatchAnalyticsEvent,
|
|
@@ -264,7 +260,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
264
260
|
_this.isInitialOverflowSent = true;
|
|
265
261
|
}, initialOverflowCaptureTimeroutDelay);
|
|
266
262
|
});
|
|
267
|
-
_defineProperty(
|
|
263
|
+
_defineProperty(_this, "handleAutoSize", function () {
|
|
268
264
|
if (_this.table) {
|
|
269
265
|
var _this$props4 = _this.props,
|
|
270
266
|
view = _this$props4.view,
|
|
@@ -281,7 +277,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
281
277
|
});
|
|
282
278
|
}
|
|
283
279
|
});
|
|
284
|
-
_defineProperty(
|
|
280
|
+
_defineProperty(_this, "handleWindowResize", function () {
|
|
285
281
|
var _this$props5 = _this.props,
|
|
286
282
|
getNode = _this$props5.getNode,
|
|
287
283
|
containerWidth = _this$props5.containerWidth;
|
|
@@ -295,7 +291,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
295
291
|
parentWidth: parentWidth
|
|
296
292
|
});
|
|
297
293
|
});
|
|
298
|
-
_defineProperty(
|
|
294
|
+
_defineProperty(_this, "getParentNodeWidth", function () {
|
|
299
295
|
var _this$props6 = _this.props,
|
|
300
296
|
getPos = _this$props6.getPos,
|
|
301
297
|
containerWidth = _this$props6.containerWidth,
|
|
@@ -308,19 +304,19 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
308
304
|
var parentNodeWith = getParentNodeWidth(pos, state, containerWidth, options && options.isFullWidthModeEnabled);
|
|
309
305
|
return parentNodeWith;
|
|
310
306
|
});
|
|
311
|
-
_defineProperty(
|
|
307
|
+
_defineProperty(_this, "updateParentWidth", function (width) {
|
|
312
308
|
_this.setState({
|
|
313
309
|
parentWidth: width
|
|
314
310
|
});
|
|
315
311
|
});
|
|
316
|
-
_defineProperty(
|
|
312
|
+
_defineProperty(_this, "tableNodeLayoutSize", function (node, containerWidth, options) {
|
|
317
313
|
return getLayoutSize(node.attrs.layout, containerWidth || _this.props.containerWidth.width, options || _this.props.options || {});
|
|
318
314
|
});
|
|
319
|
-
_defineProperty(
|
|
320
|
-
_defineProperty(
|
|
321
|
-
_defineProperty(
|
|
322
|
-
_defineProperty(
|
|
323
|
-
_defineProperty(
|
|
315
|
+
_defineProperty(_this, "scaleTableDebounced", rafSchedule(_this.scaleTable));
|
|
316
|
+
_defineProperty(_this, "handleTableResizingDebounced", rafSchedule(_this.handleTableResizing));
|
|
317
|
+
_defineProperty(_this, "handleScrollDebounced", rafSchedule(_this.handleScroll));
|
|
318
|
+
_defineProperty(_this, "handleAutoSizeDebounced", rafSchedule(_this.handleAutoSize));
|
|
319
|
+
_defineProperty(_this, "handleWindowResizeDebounced", rafSchedule(_this.handleWindowResize));
|
|
324
320
|
var _options = props.options,
|
|
325
321
|
_containerWidth = props.containerWidth,
|
|
326
322
|
_getNode = props.getNode;
|
|
@@ -371,7 +367,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
371
367
|
}
|
|
372
368
|
return _this;
|
|
373
369
|
}
|
|
374
|
-
|
|
370
|
+
_inherits(TableComponent, _React$Component);
|
|
371
|
+
return _createClass(TableComponent, [{
|
|
375
372
|
key: "componentDidMount",
|
|
376
373
|
value: function componentDidMount() {
|
|
377
374
|
var _this$table,
|
|
@@ -752,8 +749,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
752
749
|
var _this5 = this,
|
|
753
750
|
_this$state$stickyHea2,
|
|
754
751
|
_this$state$stickyHea3,
|
|
755
|
-
_this$props$options10
|
|
756
|
-
_classnames;
|
|
752
|
+
_this$props$options10;
|
|
757
753
|
var _this$props12 = this.props,
|
|
758
754
|
view = _this$props12.view,
|
|
759
755
|
getNode = _this$props12.getNode,
|
|
@@ -877,7 +873,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
877
873
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
878
874
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
879
875
|
, {
|
|
880
|
-
className: classnames(ClassName.TABLE_CONTAINER, (
|
|
876
|
+
className: classnames(ClassName.TABLE_CONTAINER, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ClassName.WITH_CONTROLS, allowControls && tableActive), ClassName.TABLE_STICKY, this.state.stickyHeader && hasHeaderRow), ClassName.HOVERED_DELETE_BUTTON, isInDanger), ClassName.TABLE_SELECTED, isTableSelected(view.state.selection))),
|
|
881
877
|
editorView: view,
|
|
882
878
|
getPos: getPos,
|
|
883
879
|
node: node,
|
|
@@ -997,7 +993,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
997
993
|
}));
|
|
998
994
|
}
|
|
999
995
|
}]);
|
|
1000
|
-
return TableComponent;
|
|
1001
996
|
}(React.Component);
|
|
1002
997
|
_defineProperty(TableComponent, "displayName", 'TableComponent');
|
|
1003
998
|
export default injectIntl(TableComponent);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
function
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
9
|
import debounce from 'lodash/debounce';
|
|
11
10
|
import throttle from 'lodash/throttle';
|
|
@@ -27,17 +26,15 @@ var HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
|
27
26
|
// if too short it would trigger too many dom updates.
|
|
28
27
|
var HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
|
|
29
28
|
var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
30
|
-
_inherits(TableRow, _TableNodeView);
|
|
31
|
-
var _super = _createSuper(TableRow);
|
|
32
29
|
function TableRow(node, view, getPos, eventDispatcher) {
|
|
33
30
|
var _this;
|
|
34
31
|
_classCallCheck(this, TableRow);
|
|
35
|
-
_this =
|
|
36
|
-
_defineProperty(
|
|
37
|
-
_defineProperty(
|
|
38
|
-
_defineProperty(
|
|
39
|
-
_defineProperty(
|
|
40
|
-
_defineProperty(
|
|
32
|
+
_this = _callSuper(this, TableRow, [node, view, getPos, eventDispatcher]);
|
|
33
|
+
_defineProperty(_this, "colControlsOffset", 0);
|
|
34
|
+
_defineProperty(_this, "focused", false);
|
|
35
|
+
_defineProperty(_this, "topPosEditorElement", 0);
|
|
36
|
+
_defineProperty(_this, "sentinels", {});
|
|
37
|
+
_defineProperty(_this, "sentinelData", {
|
|
41
38
|
top: {
|
|
42
39
|
isIntersecting: false,
|
|
43
40
|
boundingClientRect: null,
|
|
@@ -49,19 +46,19 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
49
46
|
rootBounds: null
|
|
50
47
|
}
|
|
51
48
|
});
|
|
52
|
-
_defineProperty(
|
|
53
|
-
_defineProperty(
|
|
54
|
-
_defineProperty(
|
|
49
|
+
_defineProperty(_this, "listening", false);
|
|
50
|
+
_defineProperty(_this, "padding", 0);
|
|
51
|
+
_defineProperty(_this, "top", 0);
|
|
55
52
|
/**
|
|
56
53
|
* Methods
|
|
57
54
|
*/
|
|
58
|
-
_defineProperty(
|
|
55
|
+
_defineProperty(_this, "headerRowMouseScrollEnd", debounce(function () {
|
|
59
56
|
_this.dom.classList.remove('no-pointer-events');
|
|
60
57
|
}, HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT));
|
|
61
58
|
// When the header is sticky, the header row is set to position: fixed
|
|
62
59
|
// This prevents mouse wheel scrolling on the scroll-parent div when user's mouse is hovering the header row.
|
|
63
60
|
// This fix sets pointer-events: none on the header row briefly to avoid this behaviour
|
|
64
|
-
_defineProperty(
|
|
61
|
+
_defineProperty(_this, "headerRowMouseScroll", throttle(function () {
|
|
65
62
|
if (_this.isSticky) {
|
|
66
63
|
_this.dom.classList.add('no-pointer-events');
|
|
67
64
|
_this.headerRowMouseScrollEnd();
|
|
@@ -84,7 +81,8 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
84
81
|
/**
|
|
85
82
|
* Variables
|
|
86
83
|
*/
|
|
87
|
-
|
|
84
|
+
_inherits(TableRow, _TableNodeView);
|
|
85
|
+
return _createClass(TableRow, [{
|
|
88
86
|
key: "update",
|
|
89
87
|
value:
|
|
90
88
|
/**
|
|
@@ -577,6 +575,5 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
577
575
|
}
|
|
578
576
|
}
|
|
579
577
|
}]);
|
|
580
|
-
return TableRow;
|
|
581
578
|
}(TableNodeView);
|
|
582
579
|
export { TableRow as default };
|
|
@@ -25,7 +25,7 @@ export var TableStickyScrollbar = /*#__PURE__*/function () {
|
|
|
25
25
|
this.init();
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
_createClass(TableStickyScrollbar, [{
|
|
28
|
+
return _createClass(TableStickyScrollbar, [{
|
|
29
29
|
key: "dispose",
|
|
30
30
|
value: function dispose() {
|
|
31
31
|
if (this.stickyScrollbarContainerElement) {
|
|
@@ -142,5 +142,4 @@ export var TableStickyScrollbar = /*#__PURE__*/function () {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}]);
|
|
145
|
-
return TableStickyScrollbar;
|
|
146
145
|
}();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _get from "@babel/runtime/helpers/get";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
import _get from "@babel/runtime/helpers/get";
|
|
7
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
9
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
9
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
11
|
-
function
|
|
10
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
|
+
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
15
15
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
@@ -68,23 +68,22 @@ var toDOM = function toDOM(node, props) {
|
|
|
68
68
|
return ['table', tableAttributes(node), colgroup, ['tbody', 0]];
|
|
69
69
|
};
|
|
70
70
|
var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
71
|
-
_inherits(TableView, _ReactNodeView);
|
|
72
|
-
var _super = _createSuper(TableView);
|
|
73
71
|
function TableView(props) {
|
|
74
72
|
var _this;
|
|
75
73
|
_classCallCheck(this, TableView);
|
|
76
|
-
_this =
|
|
77
|
-
_defineProperty(
|
|
74
|
+
_this = _callSuper(this, TableView, [props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props]);
|
|
75
|
+
_defineProperty(_this, "getNode", function () {
|
|
78
76
|
return _this.node;
|
|
79
77
|
});
|
|
80
|
-
_defineProperty(
|
|
78
|
+
_defineProperty(_this, "hasHoveredRows", false);
|
|
81
79
|
_this.getPos = props.getPos;
|
|
82
80
|
_this.eventDispatcher = props.eventDispatcher;
|
|
83
81
|
_this.options = props.options;
|
|
84
82
|
_this.getEditorFeatureFlags = props.getEditorFeatureFlags;
|
|
85
83
|
return _this;
|
|
86
84
|
}
|
|
87
|
-
|
|
85
|
+
_inherits(TableView, _ReactNodeView);
|
|
86
|
+
return _createClass(TableView, [{
|
|
88
87
|
key: "getContentDOM",
|
|
89
88
|
value: function getContentDOM() {
|
|
90
89
|
var rendered = DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
|
|
@@ -285,10 +284,9 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
285
284
|
this.resizeObserver.disconnect();
|
|
286
285
|
}
|
|
287
286
|
(_this$eventDispatcher = this.eventDispatcher) === null || _this$eventDispatcher === void 0 || _this$eventDispatcher.emit('TABLE_DELETED', this.node);
|
|
288
|
-
|
|
287
|
+
_superPropGet(TableView, "destroy", this, 3)([]);
|
|
289
288
|
}
|
|
290
289
|
}]);
|
|
291
|
-
return TableView;
|
|
292
290
|
}(ReactNodeView);
|
|
293
291
|
export { TableView as default };
|
|
294
292
|
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor) {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
+
// Entry file in package.json
|
|
3
|
+
|
|
1
4
|
export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, setTableHovered } from './hover';
|
|
2
5
|
export { insertColumn, insertRow, createTable } from './insert';
|
|
3
6
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
|
|
@@ -21,10 +21,9 @@ export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorF
|
|
|
21
21
|
}),
|
|
22
22
|
props: {
|
|
23
23
|
attributes: function attributes(state) {
|
|
24
|
-
var _classnames;
|
|
25
24
|
var pluginState = getPluginState(state);
|
|
26
25
|
return {
|
|
27
|
-
class: classnames(ClassName.RESIZING_PLUGIN, (
|
|
26
|
+
class: classnames(ClassName.RESIZING_PLUGIN, _defineProperty(_defineProperty({}, ClassName.RESIZE_CURSOR, pluginState.resizeHandlePos !== null), ClassName.IS_RESIZING, !!pluginState.dragging))
|
|
28
27
|
};
|
|
29
28
|
},
|
|
30
29
|
handleDOMEvents: {
|
|
@@ -97,7 +97,7 @@ export var isTableNested = function isTableNested(state) {
|
|
|
97
97
|
var tablePos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
98
98
|
var parent = state.doc.resolve(tablePos).parent;
|
|
99
99
|
var nodeTypes = state.schema.nodes;
|
|
100
|
-
return parent.type === nodeTypes.layoutColumn || parent.type === nodeTypes.expand || parent.type === nodeTypes.bodiedExtension || parent.type === nodeTypes.extensionFrame;
|
|
100
|
+
return parent.type === nodeTypes.layoutColumn || parent.type === nodeTypes.expand || parent.type === nodeTypes.bodiedExtension || parent.type === nodeTypes.extensionFrame || parent.type === nodeTypes.tableHeader || parent.type === nodeTypes.tableCell;
|
|
101
101
|
};
|
|
102
102
|
export var isTableNestedInMoreThanOneNode = function isTableNestedInMoreThanOneNode(state) {
|
|
103
103
|
var tablePos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
package/dist/esm/types/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
5
|
+
// Entry file in package.json
|
|
6
|
+
|
|
4
7
|
import { tableCellSelector, tableHeaderSelector, tablePrefixSelector } from '@atlaskit/adf-schema';
|
|
5
8
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
6
9
|
export var RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
|