@atlaskit/editor-plugin-table 8.4.6 → 8.4.7
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 +6 -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/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/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/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/types/index.ts +3 -0
- package/src/ui/common-styles.ts +3 -0
- package/src/ui/consts.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -100,7 +100,7 @@ var OverflowShadowsObserver = exports.OverflowShadowsObserver = /*#__PURE__*/fun
|
|
|
100
100
|
this.wrapper = wrapper;
|
|
101
101
|
this.init();
|
|
102
102
|
}
|
|
103
|
-
(0, _createClass2.default)(OverflowShadowsObserver, [{
|
|
103
|
+
return (0, _createClass2.default)(OverflowShadowsObserver, [{
|
|
104
104
|
key: "updateStickyShadowsHeightIfChanged",
|
|
105
105
|
value: function updateStickyShadowsHeightIfChanged() {
|
|
106
106
|
if (!this.isSticky) {
|
|
@@ -129,5 +129,4 @@ var OverflowShadowsObserver = exports.OverflowShadowsObserver = /*#__PURE__*/fun
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
}]);
|
|
132
|
-
return OverflowShadowsObserver;
|
|
133
132
|
}();
|
|
@@ -8,16 +8,15 @@ exports.default = void 0;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
15
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
17
16
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
18
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
18
|
var _TableNodeViewBase = _interopRequireDefault(require("./TableNodeViewBase"));
|
|
20
|
-
function
|
|
19
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
21
20
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
21
|
var DEFAULT_COL_SPAN = 1;
|
|
23
22
|
var DEFAULT_ROW_SPAN = 1;
|
|
@@ -44,12 +43,10 @@ function delayUntilIdle(cb) {
|
|
|
44
43
|
}
|
|
45
44
|
var cssVariablePattern = /^VAR\(--.*\)$/;
|
|
46
45
|
var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
47
|
-
(0, _inherits2.default)(TableCell, _TableNodeView);
|
|
48
|
-
var _super = _createSuper(TableCell);
|
|
49
46
|
function TableCell(node, view, getPos, eventDispatcher, editorAnalyticsAPI) {
|
|
50
47
|
var _this;
|
|
51
48
|
(0, _classCallCheck2.default)(this, TableCell);
|
|
52
|
-
_this =
|
|
49
|
+
_this = _callSuper(this, TableCell, [node, view, getPos, eventDispatcher]);
|
|
53
50
|
|
|
54
51
|
// CONFCLOUD-78239: Previously we had a bug which tried to invert the heading colour of a table
|
|
55
52
|
// Obviously design tokens can't be inverted and so it would result in `VAR(--DS-BACKGROUND-ACCENT-GRAY-SUBTLEST, #F4F5F7)`
|
|
@@ -61,7 +58,7 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
61
58
|
// This is a workaround to fix those cases on the fly. Note it is super specific on purpose
|
|
62
59
|
// so that it just fixes the heading token (other tokens should be unaffected)
|
|
63
60
|
// At some point in the future
|
|
64
|
-
(0, _defineProperty2.default)(
|
|
61
|
+
(0, _defineProperty2.default)(_this, "destroy", function () {
|
|
65
62
|
if (_this.delayHandle && typeof window !== 'undefined') {
|
|
66
63
|
var _window, _window$cancelIdleCal, _window2, _window2$cancelAnimat;
|
|
67
64
|
// eslint-disable-next-line compat/compat
|
|
@@ -89,7 +86,8 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
89
86
|
}
|
|
90
87
|
return _this;
|
|
91
88
|
}
|
|
92
|
-
(0,
|
|
89
|
+
(0, _inherits2.default)(TableCell, _TableNodeView);
|
|
90
|
+
return (0, _createClass2.default)(TableCell, [{
|
|
93
91
|
key: "update",
|
|
94
92
|
value: function update(node) {
|
|
95
93
|
var didUpdate = this.updateNodeView(node);
|
|
@@ -147,5 +145,4 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
147
145
|
return false;
|
|
148
146
|
}
|
|
149
147
|
}]);
|
|
150
|
-
return TableCell;
|
|
151
148
|
}(_TableNodeViewBase.default);
|
|
@@ -8,10 +8,9 @@ exports.default = void 0;
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
14
|
var _defineProperty3 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
15
|
var _react = _interopRequireDefault(require("react"));
|
|
17
16
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
@@ -52,7 +51,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
52
51
|
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; }
|
|
53
52
|
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; }
|
|
54
53
|
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) { (0, _defineProperty3.default)(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; }
|
|
55
|
-
function
|
|
54
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
56
55
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
57
56
|
var isIE11 = _utils.browser.ie_version === 11;
|
|
58
57
|
// When table is inserted via paste, keyboard shortcut or quickInsert,
|
|
@@ -70,30 +69,27 @@ var isOverflowAnalyticsEnabled = false;
|
|
|
70
69
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
71
70
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
72
71
|
var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
73
|
-
(0, _inherits2.default)(TableComponent, _React$Component);
|
|
74
|
-
var _super = _createSuper(TableComponent);
|
|
75
72
|
function TableComponent(props) {
|
|
76
|
-
var _defineProperty2;
|
|
77
73
|
var _this;
|
|
78
74
|
(0, _classCallCheck2.default)(this, TableComponent);
|
|
79
|
-
_this =
|
|
80
|
-
(0, _defineProperty3.default)((0,
|
|
75
|
+
_this = _callSuper(this, TableComponent, [props]);
|
|
76
|
+
(0, _defineProperty3.default)(_this, "state", (0, _defineProperty3.default)((0, _defineProperty3.default)((0, _defineProperty3.default)((0, _defineProperty3.default)({
|
|
81
77
|
scroll: 0,
|
|
82
78
|
parentWidth: undefined
|
|
83
|
-
},
|
|
84
|
-
(0, _defineProperty3.default)(
|
|
79
|
+
}, _types.ShadowEvent.SHOW_BEFORE_SHADOW, false), _types.ShadowEvent.SHOW_AFTER_SHADOW, false), "tableWrapperWidth", undefined), "tableWrapperHeight", undefined));
|
|
80
|
+
(0, _defineProperty3.default)(_this, "handleMouseOut", function (event) {
|
|
85
81
|
if (!(0, _eventHandlers.isTableInFocus)(_this.props.view)) {
|
|
86
82
|
return false;
|
|
87
83
|
}
|
|
88
84
|
return (0, _eventHandlers.handleMouseOut)(_this.props.view, event);
|
|
89
85
|
});
|
|
90
|
-
(0, _defineProperty3.default)(
|
|
86
|
+
(0, _defineProperty3.default)(_this, "handleMouseOver", function (event) {
|
|
91
87
|
if (!(0, _eventHandlers.isTableInFocus)(_this.props.view)) {
|
|
92
88
|
return false;
|
|
93
89
|
}
|
|
94
90
|
return (0, _eventHandlers.withCellTracking)(_eventHandlers.handleMouseOver)(_this.props.view, event);
|
|
95
91
|
});
|
|
96
|
-
(0, _defineProperty3.default)(
|
|
92
|
+
(0, _defineProperty3.default)(_this, "handleMouseEnter", function () {
|
|
97
93
|
var node = _this.props.getNode();
|
|
98
94
|
var pos = _this.props.getPos();
|
|
99
95
|
var tr = _this.props.view.state.tr;
|
|
@@ -101,13 +97,13 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
101
97
|
tr.setMeta('mouseEnterTable', [tableId, node, pos]);
|
|
102
98
|
_this.props.view.dispatch(tr);
|
|
103
99
|
});
|
|
104
|
-
(0, _defineProperty3.default)(
|
|
100
|
+
(0, _defineProperty3.default)(_this, "updateShadowState", function (shadowKey, value) {
|
|
105
101
|
if (_this.state[shadowKey] === value) {
|
|
106
102
|
return;
|
|
107
103
|
}
|
|
108
104
|
_this.setState((0, _defineProperty3.default)({}, shadowKey, value));
|
|
109
105
|
});
|
|
110
|
-
(0, _defineProperty3.default)(
|
|
106
|
+
(0, _defineProperty3.default)(_this, "createShadowSentinels", function (table) {
|
|
111
107
|
if (table) {
|
|
112
108
|
var shadowSentinelLeft = document.createElement('span');
|
|
113
109
|
shadowSentinelLeft.className = _types.TableCssClassName.TABLE_SHADOW_SENTINEL_LEFT;
|
|
@@ -117,7 +113,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
117
113
|
table.prepend(shadowSentinelRight);
|
|
118
114
|
}
|
|
119
115
|
});
|
|
120
|
-
(0, _defineProperty3.default)(
|
|
116
|
+
(0, _defineProperty3.default)(_this, "onStickyState", function (state) {
|
|
121
117
|
var pos = _this.props.getPos();
|
|
122
118
|
if (!(0, _utils.isValidPosition)(pos, _this.props.view.state)) {
|
|
123
119
|
return;
|
|
@@ -132,8 +128,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
132
128
|
}
|
|
133
129
|
}
|
|
134
130
|
});
|
|
135
|
-
(0, _defineProperty3.default)(
|
|
136
|
-
(0, _defineProperty3.default)(
|
|
131
|
+
(0, _defineProperty3.default)(_this, "prevTableState", null);
|
|
132
|
+
(0, _defineProperty3.default)(_this, "handleScroll", function (event) {
|
|
137
133
|
if (!_this.wrapper || event.target !== _this.wrapper) {
|
|
138
134
|
return;
|
|
139
135
|
}
|
|
@@ -151,7 +147,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
151
147
|
}
|
|
152
148
|
_this.setState((0, _defineProperty3.default)({}, _types.ShadowEvent.SHOW_BEFORE_SHADOW, _this.wrapper.scrollLeft !== 0));
|
|
153
149
|
});
|
|
154
|
-
(0, _defineProperty3.default)(
|
|
150
|
+
(0, _defineProperty3.default)(_this, "handleTableResizing", function () {
|
|
155
151
|
var _this$props = _this.props,
|
|
156
152
|
getNode = _this$props.getNode,
|
|
157
153
|
containerWidth = _this$props.containerWidth,
|
|
@@ -214,7 +210,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
214
210
|
_this.layoutSize = layoutSize;
|
|
215
211
|
});
|
|
216
212
|
// Function gets called when table is nested.
|
|
217
|
-
(0, _defineProperty3.default)(
|
|
213
|
+
(0, _defineProperty3.default)(_this, "scaleTable", function (scaleOptions) {
|
|
218
214
|
var isUserTriggered = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
219
215
|
var _this$props2 = _this.props,
|
|
220
216
|
view = _this$props2.view,
|
|
@@ -247,7 +243,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
247
243
|
}
|
|
248
244
|
dispatch(tr);
|
|
249
245
|
});
|
|
250
|
-
(0, _defineProperty3.default)(
|
|
246
|
+
(0, _defineProperty3.default)(_this, "setTimerToSendInitialOverflowCaptured", function (isOverflowing) {
|
|
251
247
|
var _this$state;
|
|
252
248
|
var _this$props3 = _this.props,
|
|
253
249
|
dispatchAnalyticsEvent = _this$props3.dispatchAnalyticsEvent,
|
|
@@ -271,7 +267,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
271
267
|
_this.isInitialOverflowSent = true;
|
|
272
268
|
}, initialOverflowCaptureTimeroutDelay);
|
|
273
269
|
});
|
|
274
|
-
(0, _defineProperty3.default)(
|
|
270
|
+
(0, _defineProperty3.default)(_this, "handleAutoSize", function () {
|
|
275
271
|
if (_this.table) {
|
|
276
272
|
var _this$props4 = _this.props,
|
|
277
273
|
view = _this$props4.view,
|
|
@@ -288,7 +284,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
288
284
|
});
|
|
289
285
|
}
|
|
290
286
|
});
|
|
291
|
-
(0, _defineProperty3.default)(
|
|
287
|
+
(0, _defineProperty3.default)(_this, "handleWindowResize", function () {
|
|
292
288
|
var _this$props5 = _this.props,
|
|
293
289
|
getNode = _this$props5.getNode,
|
|
294
290
|
containerWidth = _this$props5.containerWidth;
|
|
@@ -302,7 +298,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
302
298
|
parentWidth: parentWidth
|
|
303
299
|
});
|
|
304
300
|
});
|
|
305
|
-
(0, _defineProperty3.default)(
|
|
301
|
+
(0, _defineProperty3.default)(_this, "getParentNodeWidth", function () {
|
|
306
302
|
var _this$props6 = _this.props,
|
|
307
303
|
getPos = _this$props6.getPos,
|
|
308
304
|
containerWidth = _this$props6.containerWidth,
|
|
@@ -315,19 +311,19 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
315
311
|
var parentNodeWith = (0, _nodeWidth.getParentNodeWidth)(pos, state, containerWidth, options && options.isFullWidthModeEnabled);
|
|
316
312
|
return parentNodeWith;
|
|
317
313
|
});
|
|
318
|
-
(0, _defineProperty3.default)(
|
|
314
|
+
(0, _defineProperty3.default)(_this, "updateParentWidth", function (width) {
|
|
319
315
|
_this.setState({
|
|
320
316
|
parentWidth: width
|
|
321
317
|
});
|
|
322
318
|
});
|
|
323
|
-
(0, _defineProperty3.default)(
|
|
319
|
+
(0, _defineProperty3.default)(_this, "tableNodeLayoutSize", function (node, containerWidth, options) {
|
|
324
320
|
return (0, _utils4.getLayoutSize)(node.attrs.layout, containerWidth || _this.props.containerWidth.width, options || _this.props.options || {});
|
|
325
321
|
});
|
|
326
|
-
(0, _defineProperty3.default)(
|
|
327
|
-
(0, _defineProperty3.default)(
|
|
328
|
-
(0, _defineProperty3.default)(
|
|
329
|
-
(0, _defineProperty3.default)(
|
|
330
|
-
(0, _defineProperty3.default)(
|
|
322
|
+
(0, _defineProperty3.default)(_this, "scaleTableDebounced", (0, _rafSchd.default)(_this.scaleTable));
|
|
323
|
+
(0, _defineProperty3.default)(_this, "handleTableResizingDebounced", (0, _rafSchd.default)(_this.handleTableResizing));
|
|
324
|
+
(0, _defineProperty3.default)(_this, "handleScrollDebounced", (0, _rafSchd.default)(_this.handleScroll));
|
|
325
|
+
(0, _defineProperty3.default)(_this, "handleAutoSizeDebounced", (0, _rafSchd.default)(_this.handleAutoSize));
|
|
326
|
+
(0, _defineProperty3.default)(_this, "handleWindowResizeDebounced", (0, _rafSchd.default)(_this.handleWindowResize));
|
|
331
327
|
var _options = props.options,
|
|
332
328
|
_containerWidth = props.containerWidth,
|
|
333
329
|
_getNode = props.getNode;
|
|
@@ -378,7 +374,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
378
374
|
}
|
|
379
375
|
return _this;
|
|
380
376
|
}
|
|
381
|
-
(0,
|
|
377
|
+
(0, _inherits2.default)(TableComponent, _React$Component);
|
|
378
|
+
return (0, _createClass2.default)(TableComponent, [{
|
|
382
379
|
key: "componentDidMount",
|
|
383
380
|
value: function componentDidMount() {
|
|
384
381
|
var _this$table,
|
|
@@ -759,8 +756,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
759
756
|
var _this5 = this,
|
|
760
757
|
_this$state$stickyHea2,
|
|
761
758
|
_this$state$stickyHea3,
|
|
762
|
-
_this$props$options10
|
|
763
|
-
_classnames;
|
|
759
|
+
_this$props$options10;
|
|
764
760
|
var _this$props12 = this.props,
|
|
765
761
|
view = _this$props12.view,
|
|
766
762
|
getNode = _this$props12.getNode,
|
|
@@ -884,7 +880,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
884
880
|
return /*#__PURE__*/_react.default.createElement(_TableContainer.TableContainer
|
|
885
881
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
886
882
|
, {
|
|
887
|
-
className: (0, _classnames2.default)(_types.TableCssClassName.TABLE_CONTAINER, (
|
|
883
|
+
className: (0, _classnames2.default)(_types.TableCssClassName.TABLE_CONTAINER, (0, _defineProperty3.default)((0, _defineProperty3.default)((0, _defineProperty3.default)((0, _defineProperty3.default)({}, _types.TableCssClassName.WITH_CONTROLS, allowControls && tableActive), _types.TableCssClassName.TABLE_STICKY, this.state.stickyHeader && hasHeaderRow), _types.TableCssClassName.HOVERED_DELETE_BUTTON, isInDanger), _types.TableCssClassName.TABLE_SELECTED, (0, _utils2.isTableSelected)(view.state.selection))),
|
|
888
884
|
editorView: view,
|
|
889
885
|
getPos: getPos,
|
|
890
886
|
node: node,
|
|
@@ -1004,7 +1000,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1004
1000
|
}));
|
|
1005
1001
|
}
|
|
1006
1002
|
}]);
|
|
1007
|
-
return TableComponent;
|
|
1008
1003
|
}(_react.default.Component);
|
|
1009
1004
|
(0, _defineProperty3.default)(TableComponent, "displayName", 'TableComponent');
|
|
1010
1005
|
var _default = exports.default = (0, _reactIntlNext.injectIntl)(TableComponent);
|
|
@@ -7,10 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
14
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
16
15
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
@@ -25,7 +24,7 @@ var _nodes = require("../pm-plugins/utils/nodes");
|
|
|
25
24
|
var _types = require("../types");
|
|
26
25
|
var _consts = require("../ui/consts");
|
|
27
26
|
var _TableNodeViewBase = _interopRequireDefault(require("./TableNodeViewBase"));
|
|
28
|
-
function
|
|
27
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
29
28
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
30
29
|
// limit scroll event calls
|
|
31
30
|
var HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
@@ -34,17 +33,15 @@ var HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
|
34
33
|
// if too short it would trigger too many dom updates.
|
|
35
34
|
var HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
|
|
36
35
|
var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
37
|
-
(0, _inherits2.default)(TableRow, _TableNodeView);
|
|
38
|
-
var _super = _createSuper(TableRow);
|
|
39
36
|
function TableRow(node, view, getPos, eventDispatcher) {
|
|
40
37
|
var _this;
|
|
41
38
|
(0, _classCallCheck2.default)(this, TableRow);
|
|
42
|
-
_this =
|
|
43
|
-
(0, _defineProperty2.default)(
|
|
44
|
-
(0, _defineProperty2.default)(
|
|
45
|
-
(0, _defineProperty2.default)(
|
|
46
|
-
(0, _defineProperty2.default)(
|
|
47
|
-
(0, _defineProperty2.default)(
|
|
39
|
+
_this = _callSuper(this, TableRow, [node, view, getPos, eventDispatcher]);
|
|
40
|
+
(0, _defineProperty2.default)(_this, "colControlsOffset", 0);
|
|
41
|
+
(0, _defineProperty2.default)(_this, "focused", false);
|
|
42
|
+
(0, _defineProperty2.default)(_this, "topPosEditorElement", 0);
|
|
43
|
+
(0, _defineProperty2.default)(_this, "sentinels", {});
|
|
44
|
+
(0, _defineProperty2.default)(_this, "sentinelData", {
|
|
48
45
|
top: {
|
|
49
46
|
isIntersecting: false,
|
|
50
47
|
boundingClientRect: null,
|
|
@@ -56,19 +53,19 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
56
53
|
rootBounds: null
|
|
57
54
|
}
|
|
58
55
|
});
|
|
59
|
-
(0, _defineProperty2.default)(
|
|
60
|
-
(0, _defineProperty2.default)(
|
|
61
|
-
(0, _defineProperty2.default)(
|
|
56
|
+
(0, _defineProperty2.default)(_this, "listening", false);
|
|
57
|
+
(0, _defineProperty2.default)(_this, "padding", 0);
|
|
58
|
+
(0, _defineProperty2.default)(_this, "top", 0);
|
|
62
59
|
/**
|
|
63
60
|
* Methods
|
|
64
61
|
*/
|
|
65
|
-
(0, _defineProperty2.default)(
|
|
62
|
+
(0, _defineProperty2.default)(_this, "headerRowMouseScrollEnd", (0, _debounce.default)(function () {
|
|
66
63
|
_this.dom.classList.remove('no-pointer-events');
|
|
67
64
|
}, HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT));
|
|
68
65
|
// When the header is sticky, the header row is set to position: fixed
|
|
69
66
|
// This prevents mouse wheel scrolling on the scroll-parent div when user's mouse is hovering the header row.
|
|
70
67
|
// This fix sets pointer-events: none on the header row briefly to avoid this behaviour
|
|
71
|
-
(0, _defineProperty2.default)(
|
|
68
|
+
(0, _defineProperty2.default)(_this, "headerRowMouseScroll", (0, _throttle.default)(function () {
|
|
72
69
|
if (_this.isSticky) {
|
|
73
70
|
_this.dom.classList.add('no-pointer-events');
|
|
74
71
|
_this.headerRowMouseScrollEnd();
|
|
@@ -91,7 +88,8 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
91
88
|
/**
|
|
92
89
|
* Variables
|
|
93
90
|
*/
|
|
94
|
-
(0,
|
|
91
|
+
(0, _inherits2.default)(TableRow, _TableNodeView);
|
|
92
|
+
return (0, _createClass2.default)(TableRow, [{
|
|
95
93
|
key: "update",
|
|
96
94
|
value:
|
|
97
95
|
/**
|
|
@@ -584,5 +582,4 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
584
582
|
}
|
|
585
583
|
}
|
|
586
584
|
}]);
|
|
587
|
-
return TableRow;
|
|
588
585
|
}(_TableNodeViewBase.default);
|
|
@@ -32,7 +32,7 @@ var TableStickyScrollbar = exports.TableStickyScrollbar = /*#__PURE__*/function
|
|
|
32
32
|
this.init();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
(0, _createClass2.default)(TableStickyScrollbar, [{
|
|
35
|
+
return (0, _createClass2.default)(TableStickyScrollbar, [{
|
|
36
36
|
key: "dispose",
|
|
37
37
|
value: function dispose() {
|
|
38
38
|
if (this.stickyScrollbarContainerElement) {
|
|
@@ -149,5 +149,4 @@ var TableStickyScrollbar = exports.TableStickyScrollbar = /*#__PURE__*/function
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}]);
|
|
152
|
-
return TableStickyScrollbar;
|
|
153
152
|
}();
|
|
@@ -8,11 +8,10 @@ exports.default = exports.createTableView = void 0;
|
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
16
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
18
17
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -34,8 +33,9 @@ var _tableWidth = require("../pm-plugins/table-width");
|
|
|
34
33
|
var _utils2 = require("../pm-plugins/utils");
|
|
35
34
|
var _TableComponent = _interopRequireDefault(require("./TableComponent"));
|
|
36
35
|
var _TableComponentWithSharedState = require("./TableComponentWithSharedState");
|
|
37
|
-
function
|
|
36
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
38
37
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
38
|
+
function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
39
39
|
var tableAttributes = function tableAttributes(node) {
|
|
40
40
|
return {
|
|
41
41
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
@@ -75,23 +75,22 @@ var toDOM = function toDOM(node, props) {
|
|
|
75
75
|
return ['table', tableAttributes(node), colgroup, ['tbody', 0]];
|
|
76
76
|
};
|
|
77
77
|
var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
78
|
-
(0, _inherits2.default)(TableView, _ReactNodeView);
|
|
79
|
-
var _super = _createSuper(TableView);
|
|
80
78
|
function TableView(props) {
|
|
81
79
|
var _this;
|
|
82
80
|
(0, _classCallCheck2.default)(this, TableView);
|
|
83
|
-
_this =
|
|
84
|
-
(0, _defineProperty2.default)(
|
|
81
|
+
_this = _callSuper(this, TableView, [props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props]);
|
|
82
|
+
(0, _defineProperty2.default)(_this, "getNode", function () {
|
|
85
83
|
return _this.node;
|
|
86
84
|
});
|
|
87
|
-
(0, _defineProperty2.default)(
|
|
85
|
+
(0, _defineProperty2.default)(_this, "hasHoveredRows", false);
|
|
88
86
|
_this.getPos = props.getPos;
|
|
89
87
|
_this.eventDispatcher = props.eventDispatcher;
|
|
90
88
|
_this.options = props.options;
|
|
91
89
|
_this.getEditorFeatureFlags = props.getEditorFeatureFlags;
|
|
92
90
|
return _this;
|
|
93
91
|
}
|
|
94
|
-
(0,
|
|
92
|
+
(0, _inherits2.default)(TableView, _ReactNodeView);
|
|
93
|
+
return (0, _createClass2.default)(TableView, [{
|
|
95
94
|
key: "getContentDOM",
|
|
96
95
|
value: function getContentDOM() {
|
|
97
96
|
var rendered = _model.DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
|
|
@@ -292,10 +291,9 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
292
291
|
this.resizeObserver.disconnect();
|
|
293
292
|
}
|
|
294
293
|
(_this$eventDispatcher = this.eventDispatcher) === null || _this$eventDispatcher === void 0 || _this$eventDispatcher.emit('TABLE_DELETED', this.node);
|
|
295
|
-
(
|
|
294
|
+
_superPropGet(TableView, "destroy", this, 3)([]);
|
|
296
295
|
}
|
|
297
296
|
}]);
|
|
298
|
-
return TableView;
|
|
299
297
|
}(_reactNodeView.default);
|
|
300
298
|
var createTableView = exports.createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor) {
|
|
301
299
|
var _pluginInjectionApi$t;
|
|
@@ -5,4 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.pluginKey = void 0;
|
|
7
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
|
+
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
9
|
+
// Entry file in package.json
|
|
10
|
+
|
|
8
11
|
var pluginKey = exports.pluginKey = new _state.PluginKey('tablePlugin');
|
|
@@ -28,10 +28,9 @@ function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureF
|
|
|
28
28
|
}),
|
|
29
29
|
props: {
|
|
30
30
|
attributes: function attributes(state) {
|
|
31
|
-
var _classnames;
|
|
32
31
|
var pluginState = (0, _pluginFactory2.getPluginState)(state);
|
|
33
32
|
return {
|
|
34
|
-
class: (0, _classnames2.default)(_types.TableCssClassName.RESIZING_PLUGIN, (
|
|
33
|
+
class: (0, _classnames2.default)(_types.TableCssClassName.RESIZING_PLUGIN, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.TableCssClassName.RESIZE_CURSOR, pluginState.resizeHandlePos !== null), _types.TableCssClassName.IS_RESIZING, !!pluginState.dragging))
|
|
35
34
|
};
|
|
36
35
|
},
|
|
37
36
|
handleDOMEvents: {
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
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; }
|
|
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) { (0, _defineProperty2.default)(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; }
|
|
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) { (0, _defineProperty2.default)(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; } /* eslint-disable @atlaskit/editor/no-re-export */ // Entry file in package.json
|
|
13
13
|
var RESIZE_HANDLE_AREA_DECORATION_GAP = exports.RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
|
|
14
14
|
|
|
15
15
|
/**
|