@atlaskit/editor-plugin-table 10.1.1 → 10.1.2
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 +10 -0
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +9 -3
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +16 -6
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +8 -2
- package/package.json +5 -2
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +16 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#119754](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/119754)
|
|
8
|
+
[`dd36ff28f174a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dd36ff28f174a) -
|
|
9
|
+
[ux] ED-26740 Bugfix to prevent a table with numbered column and a nested table with numbered
|
|
10
|
+
column from highlighting the nested table's rows when a parent table's row is selected
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 10.1.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -13,9 +13,10 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
|
-
var
|
|
16
|
+
var _classnames3 = _interopRequireDefault(require("classnames"));
|
|
17
17
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
18
18
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
var _commands = require("../../../pm-plugins/commands");
|
|
20
21
|
var _rowControls = require("../../../pm-plugins/utils/row-controls");
|
|
21
22
|
var _types = require("../../../types");
|
|
@@ -91,9 +92,14 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
91
92
|
hoveredRows = _this$props4.hoveredRows,
|
|
92
93
|
editorView = _this$props4.editorView,
|
|
93
94
|
isInDanger = _this$props4.isInDanger,
|
|
94
|
-
isResizing = _this$props4.isResizing
|
|
95
|
+
isResizing = _this$props4.isResizing,
|
|
96
|
+
tableActive = _this$props4.tableActive;
|
|
95
97
|
var isActive = (0, _utils.isRowSelected)(index)(editorView.state.selection) || (hoveredRows || []).indexOf(index) !== -1 && !isResizing;
|
|
96
|
-
|
|
98
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_nested_tables_number_column_fixes')) {
|
|
99
|
+
return (0, _classnames3.default)(_types.TableCssClassName.NUMBERED_COLUMN_BUTTON, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON_DISABLED, isButtonDisabled), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, tableActive && isActive && isInDanger), _types.TableCssClassName.HOVERED_CELL_ACTIVE, tableActive && isActive));
|
|
100
|
+
} else {
|
|
101
|
+
return (0, _classnames3.default)(_types.TableCssClassName.NUMBERED_COLUMN_BUTTON, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON_DISABLED, isButtonDisabled), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, isActive && isInDanger), _types.TableCssClassName.HOVERED_CELL_ACTIVE, isActive));
|
|
102
|
+
}
|
|
97
103
|
});
|
|
98
104
|
return _this;
|
|
99
105
|
}
|
|
@@ -3,6 +3,7 @@ import React, { Component } from 'react';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
7
8
|
import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
|
|
8
9
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -74,14 +75,23 @@ export default class NumberColumn extends Component {
|
|
|
74
75
|
hoveredRows,
|
|
75
76
|
editorView,
|
|
76
77
|
isInDanger,
|
|
77
|
-
isResizing
|
|
78
|
+
isResizing,
|
|
79
|
+
tableActive
|
|
78
80
|
} = this.props;
|
|
79
81
|
const isActive = isRowSelected(index)(editorView.state.selection) || (hoveredRows || []).indexOf(index) !== -1 && !isResizing;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
if (fg('platform_editor_nested_tables_number_column_fixes')) {
|
|
83
|
+
return classnames(ClassName.NUMBERED_COLUMN_BUTTON, {
|
|
84
|
+
[ClassName.NUMBERED_COLUMN_BUTTON_DISABLED]: isButtonDisabled,
|
|
85
|
+
[ClassName.HOVERED_CELL_IN_DANGER]: tableActive && isActive && isInDanger,
|
|
86
|
+
[ClassName.HOVERED_CELL_ACTIVE]: tableActive && isActive
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
return classnames(ClassName.NUMBERED_COLUMN_BUTTON, {
|
|
90
|
+
[ClassName.NUMBERED_COLUMN_BUTTON_DISABLED]: isButtonDisabled,
|
|
91
|
+
[ClassName.HOVERED_CELL_IN_DANGER]: isActive && isInDanger,
|
|
92
|
+
[ClassName.HOVERED_CELL_ACTIVE]: isActive
|
|
93
|
+
});
|
|
94
|
+
}
|
|
85
95
|
});
|
|
86
96
|
}
|
|
87
97
|
render() {
|
|
@@ -10,6 +10,7 @@ import React, { Component } from 'react';
|
|
|
10
10
|
import classnames from 'classnames';
|
|
11
11
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
12
12
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
14
15
|
import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
|
|
15
16
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -81,9 +82,14 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
|
|
|
81
82
|
hoveredRows = _this$props4.hoveredRows,
|
|
82
83
|
editorView = _this$props4.editorView,
|
|
83
84
|
isInDanger = _this$props4.isInDanger,
|
|
84
|
-
isResizing = _this$props4.isResizing
|
|
85
|
+
isResizing = _this$props4.isResizing,
|
|
86
|
+
tableActive = _this$props4.tableActive;
|
|
85
87
|
var isActive = isRowSelected(index)(editorView.state.selection) || (hoveredRows || []).indexOf(index) !== -1 && !isResizing;
|
|
86
|
-
|
|
88
|
+
if (fg('platform_editor_nested_tables_number_column_fixes')) {
|
|
89
|
+
return classnames(ClassName.NUMBERED_COLUMN_BUTTON, _defineProperty(_defineProperty(_defineProperty({}, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, isButtonDisabled), ClassName.HOVERED_CELL_IN_DANGER, tableActive && isActive && isInDanger), ClassName.HOVERED_CELL_ACTIVE, tableActive && isActive));
|
|
90
|
+
} else {
|
|
91
|
+
return classnames(ClassName.NUMBERED_COLUMN_BUTTON, _defineProperty(_defineProperty(_defineProperty({}, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, isButtonDisabled), ClassName.HOVERED_CELL_IN_DANGER, isActive && isInDanger), ClassName.HOVERED_CELL_ACTIVE, isActive));
|
|
92
|
+
}
|
|
87
93
|
});
|
|
88
94
|
return _this;
|
|
89
95
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.2",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@atlaskit/adf-schema": "^47.2.1",
|
|
31
31
|
"@atlaskit/button": "^21.1.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.10.0",
|
|
33
|
-
"@atlaskit/editor-common": "^100.
|
|
33
|
+
"@atlaskit/editor-common": "^100.2.0",
|
|
34
34
|
"@atlaskit/editor-palette": "2.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^2.0.0",
|
|
@@ -173,6 +173,9 @@
|
|
|
173
173
|
},
|
|
174
174
|
"platform_editor_nested_table_drag_controls": {
|
|
175
175
|
"type": "boolean"
|
|
176
|
+
},
|
|
177
|
+
"platform_editor_nested_tables_number_column_fixes": {
|
|
178
|
+
"type": "boolean"
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
181
|
}
|
|
@@ -5,6 +5,7 @@ import classnames from 'classnames';
|
|
|
5
5
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
|
|
9
10
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
10
11
|
import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
|
|
@@ -135,15 +136,24 @@ export default class NumberColumn extends Component<Props, any> {
|
|
|
135
136
|
};
|
|
136
137
|
|
|
137
138
|
private getClassNames = (index: number, isButtonDisabled = false) => {
|
|
138
|
-
const { hoveredRows, editorView, isInDanger, isResizing } = this.props;
|
|
139
|
+
const { hoveredRows, editorView, isInDanger, isResizing, tableActive } = this.props;
|
|
140
|
+
|
|
139
141
|
const isActive =
|
|
140
142
|
isRowSelected(index)(editorView.state.selection) ||
|
|
141
143
|
((hoveredRows || []).indexOf(index) !== -1 && !isResizing);
|
|
142
144
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
if (fg('platform_editor_nested_tables_number_column_fixes')) {
|
|
146
|
+
return classnames(ClassName.NUMBERED_COLUMN_BUTTON, {
|
|
147
|
+
[ClassName.NUMBERED_COLUMN_BUTTON_DISABLED]: isButtonDisabled,
|
|
148
|
+
[ClassName.HOVERED_CELL_IN_DANGER]: tableActive && isActive && isInDanger,
|
|
149
|
+
[ClassName.HOVERED_CELL_ACTIVE]: tableActive && isActive,
|
|
150
|
+
});
|
|
151
|
+
} else {
|
|
152
|
+
return classnames(ClassName.NUMBERED_COLUMN_BUTTON, {
|
|
153
|
+
[ClassName.NUMBERED_COLUMN_BUTTON_DISABLED]: isButtonDisabled,
|
|
154
|
+
[ClassName.HOVERED_CELL_IN_DANGER]: isActive && isInDanger,
|
|
155
|
+
[ClassName.HOVERED_CELL_ACTIVE]: isActive,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
148
158
|
};
|
|
149
159
|
}
|