@atlaskit/editor-plugin-table 0.0.7 → 0.0.9
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 +12 -0
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +4 -2
- package/dist/cjs/plugins/table/nodeviews/table.js +4 -2
- package/dist/cjs/plugins/table/toolbar.js +0 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +23 -10
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +23 -10
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +4 -4
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +4 -2
- package/dist/es2019/plugins/table/nodeviews/table.js +4 -2
- package/dist/es2019/plugins/table/toolbar.js +1 -2
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +18 -3
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +18 -3
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +4 -2
- package/dist/esm/plugins/table/nodeviews/table.js +4 -2
- package/dist/esm/plugins/table/toolbar.js +1 -2
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +19 -9
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +19 -9
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/nodeviews/types.d.ts +1 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +5 -8
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +5 -5
- package/dist/types-ts4.0/plugins/table/nodeviews/types.d.ts +1 -0
- package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +5 -8
- package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +5 -5
- package/package.json +7 -2
- package/src/__tests__/unit/hover-selection.ts +1 -1
- package/src/__tests__/unit/index-with-fake-timers.ts +1 -0
- package/src/__tests__/unit/ui/CornerControls.tsx +22 -22
- package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +3 -3
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +15 -15
- package/src/__tests__/unit/ui/RowControls.tsx +1 -1
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +2 -2
- package/src/plugins/table/__tests__/unit/commands/insert.ts +2 -2
- package/src/plugins/table/__tests__/unit/commands.ts +2 -2
- package/src/plugins/table/__tests__/unit/nodeviews/TableComponent.tsx +2 -2
- package/src/plugins/table/__tests__/unit/nodeviews/table.ts +1 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +25 -47
- package/src/plugins/table/nodeviews/TableComponent.tsx +8 -2
- package/src/plugins/table/nodeviews/table.tsx +7 -0
- package/src/plugins/table/nodeviews/types.ts +1 -0
- package/src/plugins/table/toolbar.ts +0 -1
- package/src/plugins/table/ui/FloatingContextualMenu/__tests__/ContextualMenu.tsx +1 -1
- package/src/plugins/table/ui/FloatingContextualMenu/__tests__/FloatingContextualMenu.tsx +1 -1
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/index.tsx +19 -1
- package/src/plugins/table/ui/TableFloatingControls/RowControls/index.tsx +16 -1
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 0.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`30d47a9f80d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/30d47a9f80d) - This change adds data-testid to the top and bottom sticky sentinels in TableComponent and updates tests to access the sentinels by the testId.
|
|
8
|
+
|
|
9
|
+
## 0.0.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`e5b0deecf68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e5b0deecf68) - Add ability to localize for nodeview and add aria labels to RowControl and CornerControl
|
|
14
|
+
|
|
3
15
|
## 0.0.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -558,7 +558,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
558
558
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
559
559
|
"data-layout": node.attrs.layout
|
|
560
560
|
}, stickyHeadersOptimization && /*#__PURE__*/_react.default.createElement("div", {
|
|
561
|
-
className: _types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP
|
|
561
|
+
className: _types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
562
|
+
"data-testid": "sticky-sentinel-top"
|
|
562
563
|
}), allowControls && (!isLoading || initialRenderOptimization) && rowControls, /*#__PURE__*/_react.default.createElement("div", {
|
|
563
564
|
style: shadowStyle(showBeforeShadow),
|
|
564
565
|
className: _types.TableCssClassName.TABLE_LEFT_SHADOW
|
|
@@ -598,7 +599,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
598
599
|
top: "".concat(this.state.stickyHeader.top + this.state.stickyHeader.padding + shadowPadding + 2, "px")
|
|
599
600
|
}
|
|
600
601
|
})), stickyHeadersOptimization && /*#__PURE__*/_react.default.createElement("div", {
|
|
601
|
-
className: _types.TableCssClassName.TABLE_STICKY_SENTINEL_BOTTOM
|
|
602
|
+
className: _types.TableCssClassName.TABLE_STICKY_SENTINEL_BOTTOM,
|
|
603
|
+
"data-testid": "sticky-sentinel-bottom"
|
|
602
604
|
}));
|
|
603
605
|
}
|
|
604
606
|
}]);
|
|
@@ -81,7 +81,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
81
81
|
var _this;
|
|
82
82
|
|
|
83
83
|
(0, _classCallCheck2.default)(this, TableView);
|
|
84
|
-
_this = _super.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
|
|
84
|
+
_this = _super.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, undefined, undefined, props.hasIntlContext);
|
|
85
85
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getNode", function () {
|
|
86
86
|
return _this.node;
|
|
87
87
|
});
|
|
@@ -250,6 +250,7 @@ var createTableView = function createTableView(node, view, getPos, portalProvide
|
|
|
250
250
|
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
251
251
|
tableRenderOptimization = _getEditorFeatureFlag.tableRenderOptimization;
|
|
252
252
|
|
|
253
|
+
var hasIntlContext = true;
|
|
253
254
|
return new TableView({
|
|
254
255
|
node: node,
|
|
255
256
|
view: view,
|
|
@@ -260,7 +261,8 @@ var createTableView = function createTableView(node, view, getPos, portalProvide
|
|
|
260
261
|
options: options,
|
|
261
262
|
tableRenderOptimization: tableRenderOptimization,
|
|
262
263
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
263
|
-
getEditorFeatureFlags: getEditorFeatureFlags
|
|
264
|
+
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
265
|
+
hasIntlContext: hasIntlContext
|
|
264
266
|
}).init();
|
|
265
267
|
};
|
|
266
268
|
|
|
@@ -41,7 +41,6 @@ var _prosemirrorUtils = require("prosemirror-utils");
|
|
|
41
41
|
|
|
42
42
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
43
43
|
|
|
44
|
-
// TODO: ED-14403 investigate why these translations don't work
|
|
45
44
|
var messages = (0, _reactIntlNext.defineMessages)({
|
|
46
45
|
tableOptions: {
|
|
47
46
|
id: 'fabric.editor.tableOptions',
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.
|
|
10
|
+
exports.CornerControls = void 0;
|
|
11
11
|
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
|
|
@@ -25,6 +25,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
25
25
|
|
|
26
26
|
var _react = _interopRequireWildcard(require("react"));
|
|
27
27
|
|
|
28
|
+
var _reactIntlNext = require("react-intl-next");
|
|
29
|
+
|
|
28
30
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
29
31
|
|
|
30
32
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
@@ -43,15 +45,23 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
43
45
|
|
|
44
46
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
47
|
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
+
var messages = (0, _reactIntlNext.defineMessages)({
|
|
49
|
+
cornerControl: {
|
|
50
|
+
id: 'fabric.editor.cornerControl',
|
|
51
|
+
defaultMessage: 'Highlight table',
|
|
52
|
+
description: 'A button on the upper left corner of the table that shows up when the table is in focus. Clicking on it will select the entire table.'
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
var CornerControlComponent = /*#__PURE__*/function (_Component) {
|
|
57
|
+
(0, _inherits2.default)(CornerControlComponent, _Component);
|
|
48
58
|
|
|
49
|
-
var _super = _createSuper(
|
|
59
|
+
var _super = _createSuper(CornerControlComponent);
|
|
50
60
|
|
|
51
|
-
function
|
|
61
|
+
function CornerControlComponent() {
|
|
52
62
|
var _this;
|
|
53
63
|
|
|
54
|
-
(0, _classCallCheck2.default)(this,
|
|
64
|
+
(0, _classCallCheck2.default)(this, CornerControlComponent);
|
|
55
65
|
|
|
56
66
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
57
67
|
args[_key] = arguments[_key];
|
|
@@ -93,14 +103,15 @@ var CornerControls = /*#__PURE__*/function (_Component) {
|
|
|
93
103
|
return _this;
|
|
94
104
|
}
|
|
95
105
|
|
|
96
|
-
(0, _createClass2.default)(
|
|
106
|
+
(0, _createClass2.default)(CornerControlComponent, [{
|
|
97
107
|
key: "render",
|
|
98
108
|
value: function render() {
|
|
99
109
|
var _this$props2 = this.props,
|
|
100
110
|
isInDanger = _this$props2.isInDanger,
|
|
101
111
|
tableRef = _this$props2.tableRef,
|
|
102
112
|
isHeaderColumnEnabled = _this$props2.isHeaderColumnEnabled,
|
|
103
|
-
isHeaderRowEnabled = _this$props2.isHeaderRowEnabled
|
|
113
|
+
isHeaderRowEnabled = _this$props2.isHeaderRowEnabled,
|
|
114
|
+
formatMessage = _this$props2.intl.formatMessage;
|
|
104
115
|
|
|
105
116
|
if (!tableRef) {
|
|
106
117
|
return null;
|
|
@@ -116,6 +127,7 @@ var CornerControls = /*#__PURE__*/function (_Component) {
|
|
|
116
127
|
top: this.props.stickyTop !== undefined ? "".concat(this.props.stickyTop, "px") : undefined
|
|
117
128
|
}
|
|
118
129
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
130
|
+
"aria-label": formatMessage(messages.cornerControl),
|
|
119
131
|
type: "button",
|
|
120
132
|
className: (0, _classnames.default)(_types.TableCssClassName.CONTROLS_CORNER_BUTTON, {
|
|
121
133
|
danger: isActive && isInDanger
|
|
@@ -134,7 +146,8 @@ var CornerControls = /*#__PURE__*/function (_Component) {
|
|
|
134
146
|
})));
|
|
135
147
|
}
|
|
136
148
|
}]);
|
|
137
|
-
return
|
|
149
|
+
return CornerControlComponent;
|
|
138
150
|
}(_react.Component);
|
|
139
151
|
|
|
140
|
-
|
|
152
|
+
var CornerControls = (0, _reactIntlNext.injectIntl)(CornerControlComponent);
|
|
153
|
+
exports.CornerControls = CornerControls;
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.
|
|
10
|
+
exports.RowControls = void 0;
|
|
11
11
|
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
|
|
@@ -25,6 +25,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
25
25
|
|
|
26
26
|
var _react = _interopRequireWildcard(require("react"));
|
|
27
27
|
|
|
28
|
+
var _reactIntlNext = require("react-intl-next");
|
|
29
|
+
|
|
28
30
|
var _commands = require("../../../commands");
|
|
29
31
|
|
|
30
32
|
var _types = require("../../../types");
|
|
@@ -41,15 +43,23 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
41
43
|
|
|
42
44
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
45
|
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
+
var messages = (0, _reactIntlNext.defineMessages)({
|
|
47
|
+
rowControl: {
|
|
48
|
+
id: 'fabric.editor.rowControl',
|
|
49
|
+
defaultMessage: 'Highlight row',
|
|
50
|
+
description: 'A button on the left of each row that shows up when the table is in focus. Clicking on it will select the entire row.'
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
var RowControlsComponent = /*#__PURE__*/function (_Component) {
|
|
55
|
+
(0, _inherits2.default)(RowControlsComponent, _Component);
|
|
46
56
|
|
|
47
|
-
var _super = _createSuper(
|
|
57
|
+
var _super = _createSuper(RowControlsComponent);
|
|
48
58
|
|
|
49
|
-
function
|
|
59
|
+
function RowControlsComponent() {
|
|
50
60
|
var _this;
|
|
51
61
|
|
|
52
|
-
(0, _classCallCheck2.default)(this,
|
|
62
|
+
(0, _classCallCheck2.default)(this, RowControlsComponent);
|
|
53
63
|
|
|
54
64
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
55
65
|
args[_key] = arguments[_key];
|
|
@@ -65,7 +75,7 @@ var RowControls = /*#__PURE__*/function (_Component) {
|
|
|
65
75
|
return _this;
|
|
66
76
|
}
|
|
67
77
|
|
|
68
|
-
(0, _createClass2.default)(
|
|
78
|
+
(0, _createClass2.default)(RowControlsComponent, [{
|
|
69
79
|
key: "render",
|
|
70
80
|
value: function render() {
|
|
71
81
|
var _this2 = this;
|
|
@@ -75,7 +85,8 @@ var RowControls = /*#__PURE__*/function (_Component) {
|
|
|
75
85
|
tableRef = _this$props.tableRef,
|
|
76
86
|
hoveredRows = _this$props.hoveredRows,
|
|
77
87
|
isInDanger = _this$props.isInDanger,
|
|
78
|
-
isResizing = _this$props.isResizing
|
|
88
|
+
isResizing = _this$props.isResizing,
|
|
89
|
+
formatMessage = _this$props.intl.formatMessage;
|
|
79
90
|
|
|
80
91
|
if (!tableRef) {
|
|
81
92
|
return null;
|
|
@@ -112,6 +123,7 @@ var RowControls = /*#__PURE__*/function (_Component) {
|
|
|
112
123
|
paddingTop: thisRowSticky ? "".concat(_consts.tableControlsSpacing, "px") : undefined
|
|
113
124
|
}
|
|
114
125
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
126
|
+
"aria-label": formatMessage(messages.rowControl),
|
|
115
127
|
type: "button",
|
|
116
128
|
className: "".concat(_types.TableCssClassName.ROW_CONTROLS_BUTTON, "\n ").concat(_types.TableCssClassName.CONTROLS_BUTTON, "\n "),
|
|
117
129
|
onClick: function onClick(event) {
|
|
@@ -129,7 +141,8 @@ var RowControls = /*#__PURE__*/function (_Component) {
|
|
|
129
141
|
})));
|
|
130
142
|
}
|
|
131
143
|
}]);
|
|
132
|
-
return
|
|
144
|
+
return RowControlsComponent;
|
|
133
145
|
}(_react.Component);
|
|
134
146
|
|
|
135
|
-
|
|
147
|
+
var RowControls = (0, _reactIntlNext.injectIntl)(RowControlsComponent);
|
|
148
|
+
exports.RowControls = RowControls;
|
|
@@ -31,11 +31,11 @@ var _commands = require("../../commands");
|
|
|
31
31
|
|
|
32
32
|
var _utils2 = require("../../utils");
|
|
33
33
|
|
|
34
|
-
var _CornerControls =
|
|
34
|
+
var _CornerControls = require("./CornerControls");
|
|
35
35
|
|
|
36
36
|
var _NumberColumn = _interopRequireDefault(require("./NumberColumn"));
|
|
37
37
|
|
|
38
|
-
var _RowControls =
|
|
38
|
+
var _RowControls = require("./RowControls");
|
|
39
39
|
|
|
40
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
41
41
|
|
|
@@ -201,7 +201,7 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
|
|
|
201
201
|
isResizing: isResizing,
|
|
202
202
|
selectRow: this.selectRow,
|
|
203
203
|
stickyTop: stickyTop
|
|
204
|
-
}) : null, tableActive && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CornerControls.
|
|
204
|
+
}) : null, tableActive && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CornerControls.CornerControls, {
|
|
205
205
|
editorView: editorView,
|
|
206
206
|
tableRef: tableRef,
|
|
207
207
|
isInDanger: isInDanger,
|
|
@@ -210,7 +210,7 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
|
|
|
210
210
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
211
211
|
hoveredRows: hoveredRows,
|
|
212
212
|
stickyTop: tableActive ? stickyTop : undefined
|
|
213
|
-
}), /*#__PURE__*/_react.default.createElement(_RowControls.
|
|
213
|
+
}), /*#__PURE__*/_react.default.createElement(_RowControls.RowControls, {
|
|
214
214
|
editorView: editorView,
|
|
215
215
|
tableRef: tableRef,
|
|
216
216
|
hoverRows: this.hoverRows,
|
package/dist/cjs/version.json
CHANGED
|
@@ -528,7 +528,8 @@ class TableComponent extends React.Component {
|
|
|
528
528
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
529
529
|
"data-layout": node.attrs.layout
|
|
530
530
|
}, stickyHeadersOptimization && /*#__PURE__*/React.createElement("div", {
|
|
531
|
-
className: ClassName.TABLE_STICKY_SENTINEL_TOP
|
|
531
|
+
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
532
|
+
"data-testid": "sticky-sentinel-top"
|
|
532
533
|
}), allowControls && (!isLoading || initialRenderOptimization) && rowControls, /*#__PURE__*/React.createElement("div", {
|
|
533
534
|
style: shadowStyle(showBeforeShadow),
|
|
534
535
|
className: ClassName.TABLE_LEFT_SHADOW
|
|
@@ -567,7 +568,8 @@ class TableComponent extends React.Component {
|
|
|
567
568
|
top: `${this.state.stickyHeader.top + this.state.stickyHeader.padding + shadowPadding + 2}px`
|
|
568
569
|
}
|
|
569
570
|
})), stickyHeadersOptimization && /*#__PURE__*/React.createElement("div", {
|
|
570
|
-
className: ClassName.TABLE_STICKY_SENTINEL_BOTTOM
|
|
571
|
+
className: ClassName.TABLE_STICKY_SENTINEL_BOTTOM,
|
|
572
|
+
"data-testid": "sticky-sentinel-bottom"
|
|
571
573
|
}));
|
|
572
574
|
}
|
|
573
575
|
|
|
@@ -32,7 +32,7 @@ const toDOM = (node, props) => {
|
|
|
32
32
|
|
|
33
33
|
export default class TableView extends ReactNodeView {
|
|
34
34
|
constructor(props) {
|
|
35
|
-
super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
|
|
35
|
+
super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, undefined, undefined, props.hasIntlContext);
|
|
36
36
|
|
|
37
37
|
_defineProperty(this, "getNode", () => {
|
|
38
38
|
return this.node;
|
|
@@ -190,6 +190,7 @@ export const createTableView = (node, view, getPos, portalProviderAPI, eventDisp
|
|
|
190
190
|
const {
|
|
191
191
|
tableRenderOptimization
|
|
192
192
|
} = getEditorFeatureFlags();
|
|
193
|
+
const hasIntlContext = true;
|
|
193
194
|
return new TableView({
|
|
194
195
|
node,
|
|
195
196
|
view,
|
|
@@ -200,6 +201,7 @@ export const createTableView = (node, view, getPos, portalProviderAPI, eventDisp
|
|
|
200
201
|
options,
|
|
201
202
|
tableRenderOptimization,
|
|
202
203
|
getEditorContainerWidth,
|
|
203
|
-
getEditorFeatureFlags
|
|
204
|
+
getEditorFeatureFlags,
|
|
205
|
+
hasIntlContext
|
|
204
206
|
}).init();
|
|
205
207
|
};
|
|
@@ -14,8 +14,7 @@ import { splitCell } from '@atlaskit/editor-tables/utils';
|
|
|
14
14
|
import tableMessages from './ui/messages';
|
|
15
15
|
import { messages as ContextualMenuMessages } from './ui/FloatingContextualMenu/ContextualMenu';
|
|
16
16
|
import { findParentDomRefOfType } from 'prosemirror-utils';
|
|
17
|
-
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
18
|
-
|
|
17
|
+
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
19
18
|
export const messages = defineMessages({
|
|
20
19
|
tableOptions: {
|
|
21
20
|
id: 'fabric.editor.tableOptions',
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
|
+
import { defineMessages, injectIntl } from 'react-intl-next';
|
|
3
4
|
import classnames from 'classnames';
|
|
4
5
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
5
6
|
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
6
7
|
import { clearHoverSelection, hoverTable } from '../../../commands';
|
|
7
8
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
8
|
-
|
|
9
|
+
const messages = defineMessages({
|
|
10
|
+
cornerControl: {
|
|
11
|
+
id: 'fabric.editor.cornerControl',
|
|
12
|
+
defaultMessage: 'Highlight table',
|
|
13
|
+
description: 'A button on the upper left corner of the table that shows up when the table is in focus. Clicking on it will select the entire table.'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
class CornerControlComponent extends Component {
|
|
9
18
|
constructor(...args) {
|
|
10
19
|
super(...args);
|
|
11
20
|
|
|
@@ -57,7 +66,10 @@ export default class CornerControls extends Component {
|
|
|
57
66
|
isInDanger,
|
|
58
67
|
tableRef,
|
|
59
68
|
isHeaderColumnEnabled,
|
|
60
|
-
isHeaderRowEnabled
|
|
69
|
+
isHeaderRowEnabled,
|
|
70
|
+
intl: {
|
|
71
|
+
formatMessage
|
|
72
|
+
}
|
|
61
73
|
} = this.props;
|
|
62
74
|
|
|
63
75
|
if (!tableRef) {
|
|
@@ -74,6 +86,7 @@ export default class CornerControls extends Component {
|
|
|
74
86
|
top: this.props.stickyTop !== undefined ? `${this.props.stickyTop}px` : undefined
|
|
75
87
|
}
|
|
76
88
|
}, /*#__PURE__*/React.createElement("button", {
|
|
89
|
+
"aria-label": formatMessage(messages.cornerControl),
|
|
77
90
|
type: "button",
|
|
78
91
|
className: classnames(ClassName.CONTROLS_CORNER_BUTTON, {
|
|
79
92
|
danger: isActive && isInDanger
|
|
@@ -92,4 +105,6 @@ export default class CornerControls extends Component {
|
|
|
92
105
|
})));
|
|
93
106
|
}
|
|
94
107
|
|
|
95
|
-
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const CornerControls = injectIntl(CornerControlComponent);
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
|
+
import { defineMessages, injectIntl } from 'react-intl-next';
|
|
3
4
|
import { clearHoverSelection } from '../../../commands';
|
|
4
5
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
5
6
|
import { getRowClassNames, getRowHeights, getRowsParams } from '../../../utils';
|
|
6
7
|
import { tableControlsSpacing, tableToolbarSize } from '../../consts';
|
|
7
|
-
|
|
8
|
+
const messages = defineMessages({
|
|
9
|
+
rowControl: {
|
|
10
|
+
id: 'fabric.editor.rowControl',
|
|
11
|
+
defaultMessage: 'Highlight row',
|
|
12
|
+
description: 'A button on the left of each row that shows up when the table is in focus. Clicking on it will select the entire row.'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
class RowControlsComponent extends Component {
|
|
8
17
|
constructor(...args) {
|
|
9
18
|
super(...args);
|
|
10
19
|
|
|
@@ -23,7 +32,10 @@ export default class RowControls extends Component {
|
|
|
23
32
|
tableRef,
|
|
24
33
|
hoveredRows,
|
|
25
34
|
isInDanger,
|
|
26
|
-
isResizing
|
|
35
|
+
isResizing,
|
|
36
|
+
intl: {
|
|
37
|
+
formatMessage
|
|
38
|
+
}
|
|
27
39
|
} = this.props;
|
|
28
40
|
|
|
29
41
|
if (!tableRef) {
|
|
@@ -64,6 +76,7 @@ export default class RowControls extends Component {
|
|
|
64
76
|
paddingTop: thisRowSticky ? `${tableControlsSpacing}px` : undefined
|
|
65
77
|
}
|
|
66
78
|
}, /*#__PURE__*/React.createElement("button", {
|
|
79
|
+
"aria-label": formatMessage(messages.rowControl),
|
|
67
80
|
type: "button",
|
|
68
81
|
className: `${ClassName.ROW_CONTROLS_BUTTON}
|
|
69
82
|
${ClassName.CONTROLS_BUTTON}
|
|
@@ -79,4 +92,6 @@ export default class RowControls extends Component {
|
|
|
79
92
|
})));
|
|
80
93
|
}
|
|
81
94
|
|
|
82
|
-
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const RowControls = injectIntl(RowControlsComponent);
|
|
@@ -3,9 +3,9 @@ import React, { Component } from 'react';
|
|
|
3
3
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { hoverRows, selectRow } from '../../commands';
|
|
5
5
|
import { isSelectionUpdated } from '../../utils';
|
|
6
|
-
import CornerControls from './CornerControls';
|
|
6
|
+
import { CornerControls } from './CornerControls';
|
|
7
7
|
import NumberColumn from './NumberColumn';
|
|
8
|
-
import RowControls from './RowControls';
|
|
8
|
+
import { RowControls } from './RowControls';
|
|
9
9
|
export default class TableFloatingControls extends Component {
|
|
10
10
|
constructor(...args) {
|
|
11
11
|
super(...args);
|
package/dist/es2019/version.json
CHANGED
|
@@ -543,7 +543,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
543
543
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
544
544
|
"data-layout": node.attrs.layout
|
|
545
545
|
}, stickyHeadersOptimization && /*#__PURE__*/React.createElement("div", {
|
|
546
|
-
className: ClassName.TABLE_STICKY_SENTINEL_TOP
|
|
546
|
+
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
547
|
+
"data-testid": "sticky-sentinel-top"
|
|
547
548
|
}), allowControls && (!isLoading || initialRenderOptimization) && rowControls, /*#__PURE__*/React.createElement("div", {
|
|
548
549
|
style: shadowStyle(showBeforeShadow),
|
|
549
550
|
className: ClassName.TABLE_LEFT_SHADOW
|
|
@@ -583,7 +584,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
583
584
|
top: "".concat(this.state.stickyHeader.top + this.state.stickyHeader.padding + shadowPadding + 2, "px")
|
|
584
585
|
}
|
|
585
586
|
})), stickyHeadersOptimization && /*#__PURE__*/React.createElement("div", {
|
|
586
|
-
className: ClassName.TABLE_STICKY_SENTINEL_BOTTOM
|
|
587
|
+
className: ClassName.TABLE_STICKY_SENTINEL_BOTTOM,
|
|
588
|
+
"data-testid": "sticky-sentinel-bottom"
|
|
587
589
|
}));
|
|
588
590
|
}
|
|
589
591
|
}]);
|
|
@@ -54,7 +54,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
54
54
|
|
|
55
55
|
_classCallCheck(this, TableView);
|
|
56
56
|
|
|
57
|
-
_this = _super.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
|
|
57
|
+
_this = _super.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, undefined, undefined, props.hasIntlContext);
|
|
58
58
|
|
|
59
59
|
_defineProperty(_assertThisInitialized(_this), "getNode", function () {
|
|
60
60
|
return _this.node;
|
|
@@ -226,6 +226,7 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
226
226
|
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
227
227
|
tableRenderOptimization = _getEditorFeatureFlag.tableRenderOptimization;
|
|
228
228
|
|
|
229
|
+
var hasIntlContext = true;
|
|
229
230
|
return new TableView({
|
|
230
231
|
node: node,
|
|
231
232
|
view: view,
|
|
@@ -236,6 +237,7 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
236
237
|
options: options,
|
|
237
238
|
tableRenderOptimization: tableRenderOptimization,
|
|
238
239
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
239
|
-
getEditorFeatureFlags: getEditorFeatureFlags
|
|
240
|
+
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
241
|
+
hasIntlContext: hasIntlContext
|
|
240
242
|
}).init();
|
|
241
243
|
};
|
|
@@ -15,8 +15,7 @@ import { splitCell } from '@atlaskit/editor-tables/utils';
|
|
|
15
15
|
import tableMessages from './ui/messages';
|
|
16
16
|
import { messages as ContextualMenuMessages } from './ui/FloatingContextualMenu/ContextualMenu';
|
|
17
17
|
import { findParentDomRefOfType } from 'prosemirror-utils';
|
|
18
|
-
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
19
|
-
|
|
18
|
+
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
20
19
|
export var messages = defineMessages({
|
|
21
20
|
tableOptions: {
|
|
22
21
|
id: 'fabric.editor.tableOptions',
|
|
@@ -11,21 +11,29 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
12
|
|
|
13
13
|
import React, { Component } from 'react';
|
|
14
|
+
import { defineMessages, injectIntl } from 'react-intl-next';
|
|
14
15
|
import classnames from 'classnames';
|
|
15
16
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
16
17
|
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
17
18
|
import { clearHoverSelection, hoverTable } from '../../../commands';
|
|
18
19
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
20
|
+
var messages = defineMessages({
|
|
21
|
+
cornerControl: {
|
|
22
|
+
id: 'fabric.editor.cornerControl',
|
|
23
|
+
defaultMessage: 'Highlight table',
|
|
24
|
+
description: 'A button on the upper left corner of the table that shows up when the table is in focus. Clicking on it will select the entire table.'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
19
27
|
|
|
20
|
-
var
|
|
21
|
-
_inherits(
|
|
28
|
+
var CornerControlComponent = /*#__PURE__*/function (_Component) {
|
|
29
|
+
_inherits(CornerControlComponent, _Component);
|
|
22
30
|
|
|
23
|
-
var _super = _createSuper(
|
|
31
|
+
var _super = _createSuper(CornerControlComponent);
|
|
24
32
|
|
|
25
|
-
function
|
|
33
|
+
function CornerControlComponent() {
|
|
26
34
|
var _this;
|
|
27
35
|
|
|
28
|
-
_classCallCheck(this,
|
|
36
|
+
_classCallCheck(this, CornerControlComponent);
|
|
29
37
|
|
|
30
38
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
39
|
args[_key] = arguments[_key];
|
|
@@ -72,14 +80,15 @@ var CornerControls = /*#__PURE__*/function (_Component) {
|
|
|
72
80
|
return _this;
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
_createClass(
|
|
83
|
+
_createClass(CornerControlComponent, [{
|
|
76
84
|
key: "render",
|
|
77
85
|
value: function render() {
|
|
78
86
|
var _this$props2 = this.props,
|
|
79
87
|
isInDanger = _this$props2.isInDanger,
|
|
80
88
|
tableRef = _this$props2.tableRef,
|
|
81
89
|
isHeaderColumnEnabled = _this$props2.isHeaderColumnEnabled,
|
|
82
|
-
isHeaderRowEnabled = _this$props2.isHeaderRowEnabled
|
|
90
|
+
isHeaderRowEnabled = _this$props2.isHeaderRowEnabled,
|
|
91
|
+
formatMessage = _this$props2.intl.formatMessage;
|
|
83
92
|
|
|
84
93
|
if (!tableRef) {
|
|
85
94
|
return null;
|
|
@@ -95,6 +104,7 @@ var CornerControls = /*#__PURE__*/function (_Component) {
|
|
|
95
104
|
top: this.props.stickyTop !== undefined ? "".concat(this.props.stickyTop, "px") : undefined
|
|
96
105
|
}
|
|
97
106
|
}, /*#__PURE__*/React.createElement("button", {
|
|
107
|
+
"aria-label": formatMessage(messages.cornerControl),
|
|
98
108
|
type: "button",
|
|
99
109
|
className: classnames(ClassName.CONTROLS_CORNER_BUTTON, {
|
|
100
110
|
danger: isActive && isInDanger
|
|
@@ -114,7 +124,7 @@ var CornerControls = /*#__PURE__*/function (_Component) {
|
|
|
114
124
|
}
|
|
115
125
|
}]);
|
|
116
126
|
|
|
117
|
-
return
|
|
127
|
+
return CornerControlComponent;
|
|
118
128
|
}(Component);
|
|
119
129
|
|
|
120
|
-
export
|
|
130
|
+
export var CornerControls = injectIntl(CornerControlComponent);
|