@atlaskit/editor-plugin-table 12.2.5 → 12.2.6

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 12.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`83a86aaf799cc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/83a86aaf799cc) -
8
+ hide numbered column on SSR
9
+
3
10
  ## 12.2.5
4
11
 
5
12
  ### Patch Changes
@@ -14,13 +14,17 @@ 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
16
  var _classnames2 = _interopRequireDefault(require("classnames"));
17
+ var _coreUtils = require("@atlaskit/editor-common/core-utils");
17
18
  var _state = require("@atlaskit/editor-prosemirror/state");
18
19
  var _utils = require("@atlaskit/editor-tables/utils");
20
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
19
21
  var _commands = require("../../../pm-plugins/commands");
20
22
  var _rowControls = require("../../../pm-plugins/utils/row-controls");
21
23
  var _types = require("../../../types");
22
24
  var _consts = require("../../consts");
23
25
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
26
+ 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; }
27
+ 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; }
24
28
  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)); }
25
29
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
26
30
  // Ignored via go/ees005
@@ -109,16 +113,34 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
109
113
  tableActive = _this$props5.tableActive,
110
114
  updateCellHoverLocation = _this$props5.updateCellHoverLocation;
111
115
  var rowHeights = (0, _rowControls.getRowHeights)(tableRef);
116
+ if ((0, _coreUtils.isSSR)() && (0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true)) {
117
+ return /*#__PURE__*/_react.default.createElement("div", {
118
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
119
+ className: _types.TableCssClassName.NUMBERED_COLUMN,
120
+ style: {
121
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
122
+ marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
123
+ borderLeft:
124
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
125
+ isDragAndDropEnabled && tableActive ? "1px solid ".concat(_consts.tableBorderColor) : undefined,
126
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
127
+ visibility: 'hidden' // Ensure the column is not visible during SSR
128
+ },
129
+ contentEditable: false
130
+ });
131
+ }
112
132
  return /*#__PURE__*/_react.default.createElement("div", {
113
133
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
114
134
  className: _types.TableCssClassName.NUMBERED_COLUMN,
115
- style: {
135
+ style: _objectSpread({
116
136
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
117
137
  marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
118
138
  borderLeft:
119
139
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
120
140
  isDragAndDropEnabled && tableActive ? "1px solid ".concat(_consts.tableBorderColor) : undefined
121
- },
141
+ }, (0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true) ? {
142
+ visibility: 'visible'
143
+ } : {}),
122
144
  contentEditable: false
123
145
  }, rowHeights.map(function (rowHeight, index) {
124
146
  return isDragAndDropEnabled ?
@@ -1,8 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { Component } from 'react';
3
3
  import classnames from 'classnames';
4
+ import { isSSR } from '@atlaskit/editor-common/core-utils';
4
5
  import { Selection } from '@atlaskit/editor-prosemirror/state';
5
6
  import { isRowSelected } from '@atlaskit/editor-tables/utils';
7
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
8
  import { clearHoverSelection } from '../../../pm-plugins/commands';
7
9
  import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
8
10
  import { TableCssClassName as ClassName } from '../../../types';
@@ -94,6 +96,22 @@ export default class NumberColumn extends Component {
94
96
  updateCellHoverLocation
95
97
  } = this.props;
96
98
  const rowHeights = getRowHeights(tableRef);
99
+ if (isSSR() && expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
100
+ return /*#__PURE__*/React.createElement("div", {
101
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
102
+ className: ClassName.NUMBERED_COLUMN,
103
+ style: {
104
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
105
+ marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
106
+ borderLeft:
107
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
108
+ isDragAndDropEnabled && tableActive ? `1px solid ${tableBorderColor}` : undefined,
109
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
110
+ visibility: 'hidden' // Ensure the column is not visible during SSR
111
+ },
112
+ contentEditable: false
113
+ });
114
+ }
97
115
  return /*#__PURE__*/React.createElement("div", {
98
116
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
99
117
  className: ClassName.NUMBERED_COLUMN,
@@ -102,7 +120,11 @@ export default class NumberColumn extends Component {
102
120
  marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
103
121
  borderLeft:
104
122
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
105
- isDragAndDropEnabled && tableActive ? `1px solid ${tableBorderColor}` : undefined
123
+ isDragAndDropEnabled && tableActive ? `1px solid ${tableBorderColor}` : undefined,
124
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
125
+ ...(expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true) ? {
126
+ visibility: 'visible'
127
+ } : {})
106
128
  },
107
129
  contentEditable: false
108
130
  }, rowHeights.map((rowHeight, index) => isDragAndDropEnabled ?
@@ -4,12 +4,16 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
4
4
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
5
  import _inherits from "@babel/runtime/helpers/inherits";
6
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
+ 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; }
8
+ 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; }
7
9
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
11
  import React, { Component } from 'react';
10
12
  import classnames from 'classnames';
13
+ import { isSSR } from '@atlaskit/editor-common/core-utils';
11
14
  import { Selection } from '@atlaskit/editor-prosemirror/state';
12
15
  import { isRowSelected } from '@atlaskit/editor-tables/utils';
16
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
17
  import { clearHoverSelection } from '../../../pm-plugins/commands';
14
18
  import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
15
19
  import { TableCssClassName as ClassName } from '../../../types';
@@ -100,16 +104,34 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
100
104
  tableActive = _this$props5.tableActive,
101
105
  updateCellHoverLocation = _this$props5.updateCellHoverLocation;
102
106
  var rowHeights = getRowHeights(tableRef);
107
+ if (isSSR() && expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
108
+ return /*#__PURE__*/React.createElement("div", {
109
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
110
+ className: ClassName.NUMBERED_COLUMN,
111
+ style: {
112
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
113
+ marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
114
+ borderLeft:
115
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
116
+ isDragAndDropEnabled && tableActive ? "1px solid ".concat(tableBorderColor) : undefined,
117
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
118
+ visibility: 'hidden' // Ensure the column is not visible during SSR
119
+ },
120
+ contentEditable: false
121
+ });
122
+ }
103
123
  return /*#__PURE__*/React.createElement("div", {
104
124
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
105
125
  className: ClassName.NUMBERED_COLUMN,
106
- style: {
126
+ style: _objectSpread({
107
127
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
108
128
  marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
109
129
  borderLeft:
110
130
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
111
131
  isDragAndDropEnabled && tableActive ? "1px solid ".concat(tableBorderColor) : undefined
112
- },
132
+ }, expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true) ? {
133
+ visibility: 'visible'
134
+ } : {}),
113
135
  contentEditable: false
114
136
  }, rowHeights.map(function (rowHeight, index) {
115
137
  return isDragAndDropEnabled ?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "12.2.5",
3
+ "version": "12.2.6",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -70,7 +70,7 @@
70
70
  "uuid": "^3.1.0"
71
71
  },
72
72
  "peerDependencies": {
73
- "@atlaskit/editor-common": "^107.26.0",
73
+ "@atlaskit/editor-common": "^107.27.0",
74
74
  "react": "^18.2.0",
75
75
  "react-dom": "^18.2.0",
76
76
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -2,9 +2,11 @@ import React, { Component } from 'react';
2
2
 
3
3
  import classnames from 'classnames';
4
4
 
5
+ import { isSSR } from '@atlaskit/editor-common/core-utils';
5
6
  import { Selection } from '@atlaskit/editor-prosemirror/state';
6
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
8
  import { isRowSelected } from '@atlaskit/editor-tables/utils';
9
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
10
 
9
11
  import { clearHoverSelection } from '../../../pm-plugins/commands';
10
12
  import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
@@ -34,6 +36,25 @@ export default class NumberColumn extends Component<Props, any> {
34
36
  this.props;
35
37
  const rowHeights = getRowHeights(tableRef);
36
38
 
39
+ if (isSSR() && expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
40
+ return (
41
+ <div
42
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
43
+ className={ClassName.NUMBERED_COLUMN}
44
+ style={{
45
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
46
+ marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
47
+ borderLeft:
48
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
49
+ isDragAndDropEnabled && tableActive ? `1px solid ${tableBorderColor}` : undefined,
50
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
51
+ visibility: 'hidden', // Ensure the column is not visible during SSR
52
+ }}
53
+ contentEditable={false}
54
+ />
55
+ )
56
+ }
57
+
37
58
  return (
38
59
  <div
39
60
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -44,6 +65,10 @@ export default class NumberColumn extends Component<Props, any> {
44
65
  borderLeft:
45
66
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
46
67
  isDragAndDropEnabled && tableActive ? `1px solid ${tableBorderColor}` : undefined,
68
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
69
+ ...(expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)
70
+ ? { visibility: 'visible' }
71
+ : {}),
47
72
  }}
48
73
  contentEditable={false}
49
74
  >