@atlaskit/renderer 108.15.14 → 108.15.15
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/i18n/da.js +6 -1
- package/dist/cjs/i18n/de.js +6 -1
- package/dist/cjs/i18n/es.js +6 -1
- package/dist/cjs/i18n/fr.js +6 -1
- package/dist/cjs/i18n/hu.js +6 -1
- package/dist/cjs/i18n/it.js +6 -1
- package/dist/cjs/i18n/ko.js +6 -1
- package/dist/cjs/i18n/nb.js +6 -1
- package/dist/cjs/i18n/nl.js +6 -1
- package/dist/cjs/i18n/pl.js +6 -1
- package/dist/cjs/i18n/sv.js +6 -1
- package/dist/cjs/i18n/th.js +6 -1
- package/dist/cjs/i18n/tr.js +6 -1
- package/dist/cjs/i18n/uk.js +1 -1
- package/dist/cjs/i18n/vi.js +6 -1
- package/dist/cjs/i18n/zh.js +6 -1
- package/dist/cjs/i18n/zh_TW.js +6 -1
- package/dist/cjs/react/marks/textColor.js +64 -1
- package/dist/cjs/react/nodes/tableCell.js +175 -133
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/i18n/da.js +6 -1
- package/dist/es2019/i18n/de.js +6 -1
- package/dist/es2019/i18n/es.js +6 -1
- package/dist/es2019/i18n/fr.js +6 -1
- package/dist/es2019/i18n/hu.js +6 -1
- package/dist/es2019/i18n/it.js +6 -1
- package/dist/es2019/i18n/ko.js +6 -1
- package/dist/es2019/i18n/nb.js +6 -1
- package/dist/es2019/i18n/nl.js +6 -1
- package/dist/es2019/i18n/pl.js +6 -1
- package/dist/es2019/i18n/sv.js +6 -1
- package/dist/es2019/i18n/th.js +6 -1
- package/dist/es2019/i18n/tr.js +6 -1
- package/dist/es2019/i18n/uk.js +1 -1
- package/dist/es2019/i18n/vi.js +6 -1
- package/dist/es2019/i18n/zh.js +6 -1
- package/dist/es2019/i18n/zh_TW.js +6 -1
- package/dist/es2019/react/marks/textColor.js +65 -1
- package/dist/es2019/react/nodes/tableCell.js +180 -106
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/i18n/da.js +6 -1
- package/dist/esm/i18n/de.js +6 -1
- package/dist/esm/i18n/es.js +6 -1
- package/dist/esm/i18n/fr.js +6 -1
- package/dist/esm/i18n/hu.js +6 -1
- package/dist/esm/i18n/it.js +6 -1
- package/dist/esm/i18n/ko.js +6 -1
- package/dist/esm/i18n/nb.js +6 -1
- package/dist/esm/i18n/nl.js +6 -1
- package/dist/esm/i18n/pl.js +6 -1
- package/dist/esm/i18n/sv.js +6 -1
- package/dist/esm/i18n/th.js +6 -1
- package/dist/esm/i18n/tr.js +6 -1
- package/dist/esm/i18n/uk.js +1 -1
- package/dist/esm/i18n/vi.js +6 -1
- package/dist/esm/i18n/zh.js +6 -1
- package/dist/esm/i18n/zh_TW.js +6 -1
- package/dist/esm/react/marks/textColor.js +64 -1
- package/dist/esm/react/nodes/tableCell.js +177 -135
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/i18n/da.d.ts +5 -0
- package/dist/types/i18n/de.d.ts +5 -0
- package/dist/types/i18n/es.d.ts +5 -0
- package/dist/types/i18n/fr.d.ts +5 -0
- package/dist/types/i18n/hu.d.ts +5 -0
- package/dist/types/i18n/it.d.ts +5 -0
- package/dist/types/i18n/ko.d.ts +5 -0
- package/dist/types/i18n/nb.d.ts +5 -0
- package/dist/types/i18n/nl.d.ts +5 -0
- package/dist/types/i18n/pl.d.ts +5 -0
- package/dist/types/i18n/sv.d.ts +5 -0
- package/dist/types/i18n/th.d.ts +5 -0
- package/dist/types/i18n/tr.d.ts +5 -0
- package/dist/types/i18n/vi.d.ts +5 -0
- package/dist/types/i18n/zh.d.ts +5 -0
- package/dist/types/i18n/zh_TW.d.ts +5 -0
- package/dist/types/react/marks/textColor.d.ts +2 -2
- package/dist/types/react/nodes/tableCell.d.ts +5 -62
- package/dist/types-ts4.5/i18n/da.d.ts +5 -0
- package/dist/types-ts4.5/i18n/de.d.ts +5 -0
- package/dist/types-ts4.5/i18n/es.d.ts +5 -0
- package/dist/types-ts4.5/i18n/fr.d.ts +5 -0
- package/dist/types-ts4.5/i18n/hu.d.ts +5 -0
- package/dist/types-ts4.5/i18n/it.d.ts +5 -0
- package/dist/types-ts4.5/i18n/ko.d.ts +5 -0
- package/dist/types-ts4.5/i18n/nb.d.ts +5 -0
- package/dist/types-ts4.5/i18n/nl.d.ts +5 -0
- package/dist/types-ts4.5/i18n/pl.d.ts +5 -0
- package/dist/types-ts4.5/i18n/sv.d.ts +5 -0
- package/dist/types-ts4.5/i18n/th.d.ts +5 -0
- package/dist/types-ts4.5/i18n/tr.d.ts +5 -0
- package/dist/types-ts4.5/i18n/vi.d.ts +5 -0
- package/dist/types-ts4.5/i18n/zh.d.ts +5 -0
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +5 -0
- package/dist/types-ts4.5/react/marks/textColor.d.ts +2 -2
- package/dist/types-ts4.5/react/nodes/tableCell.d.ts +5 -62
- package/package.json +13 -7
|
@@ -1,12 +1,75 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
|
+
import { isHex, isRgb, rgbToHex } from '@atlaskit/adf-schema';
|
|
4
5
|
import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { useThemeObserver } from '@atlaskit/tokens';
|
|
8
|
+
/**
|
|
9
|
+
* This function is duplicated in
|
|
10
|
+
* - @atlaskit/adf-schema
|
|
11
|
+
* - ../nodes/tableCell.tsx
|
|
12
|
+
* it takes a color string, and if the color string is a hex or rgb value
|
|
13
|
+
* it will invert the color and return the inverted color.
|
|
14
|
+
*/
|
|
15
|
+
function invertCustomColor(customColor) {
|
|
16
|
+
var hex;
|
|
17
|
+
if (isHex(customColor)) {
|
|
18
|
+
hex = customColor;
|
|
19
|
+
} else if (isRgb(customColor)) {
|
|
20
|
+
hex = rgbToHex(customColor);
|
|
21
|
+
} else {
|
|
22
|
+
return customColor;
|
|
23
|
+
}
|
|
24
|
+
var hexWithoutHash = hex.replace('#', '');
|
|
25
|
+
|
|
26
|
+
// This inverts the hex color by
|
|
27
|
+
// 1. converting the hex code to a number
|
|
28
|
+
// 2. XORing it with 0xffffff
|
|
29
|
+
// 3. Converting the result back to hex
|
|
30
|
+
// 4. Removing the leading 1 from the result
|
|
31
|
+
return "#".concat((Number("0x1".concat(hexWithoutHash)) ^ 0xffffff).toString(16).substring(1).toUpperCase());
|
|
32
|
+
}
|
|
5
33
|
export default function TextColor(props) {
|
|
34
|
+
var _useThemeObserver = useThemeObserver(),
|
|
35
|
+
colorMode = _useThemeObserver.colorMode;
|
|
6
36
|
// Note -- while there is no way to create custom colors using default tooling
|
|
7
37
|
// the editor does supported ad hoc color values -- and there may be content
|
|
8
38
|
// which has been migrated or created via apis which use such values.
|
|
9
|
-
var paletteColorValue
|
|
39
|
+
var paletteColorValue;
|
|
40
|
+
if (getBooleanFF('platform.editor.dm-invert-text-color_cvho2')) {
|
|
41
|
+
/**
|
|
42
|
+
* The Editor persists custom text colors when content has been migrated from the old editor, or created via
|
|
43
|
+
* apis.
|
|
44
|
+
*
|
|
45
|
+
* This behaviour predates the introduction of dark mode.
|
|
46
|
+
*
|
|
47
|
+
* Without the inversion logic below, text with custom colors, can be hard to read when the user loads the page in dark mode.
|
|
48
|
+
*
|
|
49
|
+
* This introduces inversion of the presentation of the custom text colors when the user is in dark mode.
|
|
50
|
+
*
|
|
51
|
+
* This can be done without additional changes to account for users copying and pasting content inside the Editor, because of
|
|
52
|
+
* how we detect text colors copied from external editor sources. Where we load the background color from a
|
|
53
|
+
* seperate attribute (data-text-custom-color), instead of the inline style.
|
|
54
|
+
*
|
|
55
|
+
* See the following document for more details on this behaviour
|
|
56
|
+
* https://hello.atlassian.net/wiki/spaces/CCECO/pages/2908658046/Unsupported+custom+text+colors+in+dark+theme+Editor+Job+Story
|
|
57
|
+
*/
|
|
58
|
+
var tokenColor = hexToEditorTextPaletteColor(props.color);
|
|
59
|
+
if (tokenColor) {
|
|
60
|
+
paletteColorValue = hexToEditorTextPaletteColor(props.color) || props.color;
|
|
61
|
+
} else {
|
|
62
|
+
if (colorMode === 'dark') {
|
|
63
|
+
// if we have a custom color, we need to check if we are in dark mode
|
|
64
|
+
paletteColorValue = invertCustomColor(props.color);
|
|
65
|
+
} else {
|
|
66
|
+
// if we are in light mode, we can just set the color
|
|
67
|
+
paletteColorValue = props.color;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
paletteColorValue = hexToEditorTextPaletteColor(props.color) || props.color;
|
|
72
|
+
}
|
|
10
73
|
var style = useMemo(function () {
|
|
11
74
|
return _defineProperty({}, '--custom-palette-color', paletteColorValue);
|
|
12
75
|
}, [paletteColorValue]);
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
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; } }
|
|
11
2
|
import React from 'react';
|
|
12
|
-
import { tableBackgroundColorPalette } from '@atlaskit/adf-schema';
|
|
13
|
-
import {
|
|
3
|
+
import { isHex, isRgb, rgbToHex, tableBackgroundColorPalette } from '@atlaskit/adf-schema';
|
|
4
|
+
import { useThemeObserver } from '@atlaskit/tokens';
|
|
14
5
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
15
6
|
import { hexToEditorBackgroundPaletteRawValue } from '@atlaskit/editor-palette';
|
|
7
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
16
8
|
import SortingIcon from '../../ui/SortingIcon';
|
|
17
9
|
import { MODE, PLATFORM } from '../../analytics/events';
|
|
18
10
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
19
11
|
import { RendererCssClassName } from '../../consts';
|
|
20
|
-
import {
|
|
12
|
+
import { useIntl } from 'react-intl-next';
|
|
21
13
|
import { tableCellMessages } from '../../messages';
|
|
22
14
|
var IgnoreSorting = ['LABEL', 'INPUT'];
|
|
23
15
|
var nextStatusOrder = function nextStatusOrder(currentSortOrder) {
|
|
@@ -70,13 +62,76 @@ var getDataAttributes = function getDataAttributes(colwidth, background) {
|
|
|
70
62
|
}
|
|
71
63
|
return attrs;
|
|
72
64
|
};
|
|
73
|
-
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* This function is duplicated in
|
|
68
|
+
* - @atlaskit/adf-schema
|
|
69
|
+
* - ../marks/textColor.tsx
|
|
70
|
+
* it takes a color string, and if the color string is a hex or rgb value
|
|
71
|
+
* it will invert the color and return the inverted color.
|
|
72
|
+
*/
|
|
73
|
+
function invertCustomColor(customColor) {
|
|
74
|
+
var hex;
|
|
75
|
+
if (isHex(customColor)) {
|
|
76
|
+
hex = customColor;
|
|
77
|
+
} else if (isRgb(customColor)) {
|
|
78
|
+
hex = rgbToHex(customColor);
|
|
79
|
+
} else {
|
|
80
|
+
return customColor;
|
|
81
|
+
}
|
|
82
|
+
var hexWithoutHash = hex.replace('#', '');
|
|
83
|
+
|
|
84
|
+
// This inverts the hex color by
|
|
85
|
+
// 1. converting the hex code to a number
|
|
86
|
+
// 2. XORing it with 0xffffff
|
|
87
|
+
// 3. Converting the result back to hex
|
|
88
|
+
// 4. Removing the leading 1 from the result
|
|
89
|
+
return "#".concat((Number("0x1".concat(hexWithoutHash)) ^ 0xffffff).toString(16).substring(1).toUpperCase());
|
|
90
|
+
}
|
|
91
|
+
var getStyle = function getStyle(_ref) {
|
|
92
|
+
var background = _ref.background,
|
|
93
|
+
colGroupWidth = _ref.colGroupWidth,
|
|
94
|
+
offsetTop = _ref.offsetTop,
|
|
95
|
+
colorMode = _ref.colorMode;
|
|
74
96
|
var style = {};
|
|
75
97
|
if (background &&
|
|
76
98
|
// ignore setting inline styles if ds neutral token is detected
|
|
77
99
|
!background.includes('--ds-background-neutral')) {
|
|
78
|
-
|
|
79
|
-
|
|
100
|
+
if (getBooleanFF('platform.editor.dm-invert-tablecell-bgcolor_9fz6s')) {
|
|
101
|
+
/**
|
|
102
|
+
* The Editor supports users pasting content from external sources with custom table cell backgrounds and having those
|
|
103
|
+
* backgrounds persisted.
|
|
104
|
+
*
|
|
105
|
+
* This feature predates the introduction of dark mode.
|
|
106
|
+
*
|
|
107
|
+
* Without the inversion logic below, tokenised content (ie. text), can be hard to read when the user loads the page in dark mode.
|
|
108
|
+
*
|
|
109
|
+
* This introduces inversion of the presentation of the custom background color when the user is in dark mode.
|
|
110
|
+
*
|
|
111
|
+
* This can be done without additional changes to account for users copying and pasting content inside the Editor, because of
|
|
112
|
+
* how we detect table cell background colors copied from external editor sources. Where we load the background color from a
|
|
113
|
+
* seperate attribute (data-cell-background), instead of the inline style.
|
|
114
|
+
*
|
|
115
|
+
* See the following document for more details on this behaviour
|
|
116
|
+
* https://hello.atlassian.net/wiki/spaces/CCECO/pages/2892247168/Unsupported+custom+table+cell+background+colors+in+dark+theme+Editor+Job+Story
|
|
117
|
+
*/
|
|
118
|
+
var tokenColor = hexToEditorBackgroundPaletteRawValue(background);
|
|
119
|
+
if (tokenColor) {
|
|
120
|
+
style.backgroundColor = tokenColor;
|
|
121
|
+
} else {
|
|
122
|
+
// if we have a custom color, we need to check if we are in dark mode
|
|
123
|
+
if (colorMode === 'dark') {
|
|
124
|
+
// if we are in dark mode, we need to invert the color
|
|
125
|
+
style.backgroundColor = invertCustomColor(background);
|
|
126
|
+
} else {
|
|
127
|
+
// if we are in light mode, we can just set the color
|
|
128
|
+
style.backgroundColor = background;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
var _tokenColor = hexToEditorBackgroundPaletteRawValue(background) || background;
|
|
133
|
+
style.backgroundColor = _tokenColor;
|
|
134
|
+
}
|
|
80
135
|
}
|
|
81
136
|
if (colGroupWidth) {
|
|
82
137
|
style.width = colGroupWidth;
|
|
@@ -87,128 +142,115 @@ var getStyle = function getStyle(background, colGroupWidth, offsetTop) {
|
|
|
87
142
|
}
|
|
88
143
|
return style;
|
|
89
144
|
};
|
|
90
|
-
var
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
145
|
+
var getWithCellProps = function getWithCellProps(WrapperComponent) {
|
|
146
|
+
return function WithCellProps(props) {
|
|
147
|
+
var _useThemeObserver = useThemeObserver(),
|
|
148
|
+
colorMode = _useThemeObserver.colorMode;
|
|
149
|
+
var children = props.children,
|
|
150
|
+
className = props.className,
|
|
151
|
+
onClick = props.onClick,
|
|
152
|
+
colwidth = props.colwidth,
|
|
153
|
+
colGroupWidth = props.colGroupWidth,
|
|
154
|
+
rowspan = props.rowspan,
|
|
155
|
+
colspan = props.colspan,
|
|
156
|
+
background = props.background,
|
|
157
|
+
offsetTop = props.offsetTop,
|
|
158
|
+
ariaSort = props.ariaSort;
|
|
159
|
+
|
|
160
|
+
// This is used to set the background color of the cell
|
|
161
|
+
// to a dark mode color in mobile dark mode
|
|
162
|
+
var colorName = background ? tableBackgroundColorPalette.get(background) : '';
|
|
163
|
+
return /*#__PURE__*/React.createElement(WrapperComponent, _extends({
|
|
164
|
+
rowSpan: rowspan,
|
|
165
|
+
colSpan: colspan
|
|
166
|
+
// Note: When content from a renderer is pasted into an editor
|
|
167
|
+
// the background color is not taken from the inline style.
|
|
168
|
+
// Instead it is taken from the data-cell-background attribute
|
|
169
|
+
// (added via getDataAttributes below).
|
|
170
|
+
,
|
|
171
|
+
style: getStyle({
|
|
172
|
+
background: background,
|
|
173
|
+
colGroupWidth: colGroupWidth,
|
|
174
|
+
offsetTop: offsetTop,
|
|
175
|
+
colorMode: colorMode
|
|
176
|
+
}),
|
|
177
|
+
colorname: colorName,
|
|
178
|
+
onClick: onClick,
|
|
179
|
+
className: className
|
|
180
|
+
}, getDataAttributes(colwidth, background), {
|
|
181
|
+
"aria-sort": ariaSort
|
|
182
|
+
}), children);
|
|
183
|
+
};
|
|
127
184
|
};
|
|
185
|
+
var TH = getWithCellProps('th');
|
|
128
186
|
export var withSortableColumn = function withSortableColumn(WrapperComponent) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
tagName = _ref.tagName;
|
|
140
|
-
// trigger sorting if space or enter are clicked but not when in an input field (template variables)
|
|
141
|
-
if (keys.includes(event.key) && !IgnoreSorting.includes(tagName)) {
|
|
142
|
-
event.preventDefault();
|
|
143
|
-
_this.sort();
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
_defineProperty(_assertThisInitialized(_this), "sort", function () {
|
|
147
|
-
var _this$props2 = _this.props,
|
|
148
|
-
fireAnalyticsEvent = _this$props2.fireAnalyticsEvent,
|
|
149
|
-
onSorting = _this$props2.onSorting,
|
|
150
|
-
columnIndex = _this$props2.columnIndex,
|
|
151
|
-
sortOrdered = _this$props2.sortOrdered;
|
|
152
|
-
if (onSorting && columnIndex != null) {
|
|
153
|
-
var sortOrder = nextStatusOrder(sortOrdered);
|
|
154
|
-
onSorting(columnIndex, sortOrder);
|
|
155
|
-
fireAnalyticsEvent && fireAnalyticsEvent({
|
|
156
|
-
action: ACTION.SORT_COLUMN,
|
|
157
|
-
actionSubject: ACTION_SUBJECT.TABLE,
|
|
158
|
-
attributes: {
|
|
159
|
-
platform: PLATFORM.WEB,
|
|
160
|
-
mode: MODE.RENDERER,
|
|
161
|
-
columnIndex: columnIndex,
|
|
162
|
-
sortOrder: sortOrder
|
|
163
|
-
},
|
|
164
|
-
eventType: EVENT_TYPE.TRACK
|
|
165
|
-
});
|
|
166
|
-
} else {
|
|
167
|
-
fireAnalyticsEvent && fireAnalyticsEvent({
|
|
168
|
-
action: ACTION.SORT_COLUMN_NOT_ALLOWED,
|
|
169
|
-
actionSubject: ACTION_SUBJECT.TABLE,
|
|
170
|
-
attributes: {
|
|
171
|
-
platform: PLATFORM.WEB,
|
|
172
|
-
mode: MODE.RENDERER
|
|
173
|
-
},
|
|
174
|
-
eventType: EVENT_TYPE.TRACK
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
return _this;
|
|
187
|
+
return function THWithSortableColumn(props) {
|
|
188
|
+
var intl = useIntl();
|
|
189
|
+
var allowColumnSorting = props.allowColumnSorting,
|
|
190
|
+
onSorting = props.onSorting,
|
|
191
|
+
children = props.children,
|
|
192
|
+
sortOrdered = props.sortOrdered,
|
|
193
|
+
isHeaderRow = props.isHeaderRow;
|
|
194
|
+
var sortOrderedClassName = sortOrdered === SortOrder.NO_ORDER ? RendererCssClassName.SORTABLE_COLUMN_NO_ORDER : '';
|
|
195
|
+
if (!allowColumnSorting || !isHeaderRow) {
|
|
196
|
+
return /*#__PURE__*/React.createElement(WrapperComponent, props);
|
|
179
197
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}, /*#__PURE__*/React.createElement(SortingIcon, {
|
|
202
|
-
isSortingAllowed: !!onSorting,
|
|
203
|
-
sortOrdered: sortOrdered,
|
|
204
|
-
onClick: this.sort,
|
|
205
|
-
onKeyDown: this.onKeyPress
|
|
206
|
-
}))));
|
|
198
|
+
return /*#__PURE__*/React.createElement(WrapperComponent, _extends({}, props, {
|
|
199
|
+
className: RendererCssClassName.SORTABLE_COLUMN_WRAPPER,
|
|
200
|
+
ariaSort: getSortOrderLabel(intl, sortOrdered)
|
|
201
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
202
|
+
className: RendererCssClassName.SORTABLE_COLUMN
|
|
203
|
+
}, children, /*#__PURE__*/React.createElement("figure", {
|
|
204
|
+
className: "".concat(RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER, " ").concat(sortOrderedClassName)
|
|
205
|
+
}, /*#__PURE__*/React.createElement(SortingIcon, {
|
|
206
|
+
isSortingAllowed: !!onSorting,
|
|
207
|
+
sortOrdered: sortOrdered,
|
|
208
|
+
onClick: sort,
|
|
209
|
+
onKeyDown: onKeyPress
|
|
210
|
+
}))));
|
|
211
|
+
function onKeyPress(event) {
|
|
212
|
+
var keys = [' ', 'Enter', 'Spacebar'];
|
|
213
|
+
var _ref2 = event.target,
|
|
214
|
+
tagName = _ref2.tagName;
|
|
215
|
+
// trigger sorting if space or enter are clicked but not when in an input field (template variables)
|
|
216
|
+
if (keys.includes(event.key) && !IgnoreSorting.includes(tagName)) {
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
sort();
|
|
207
219
|
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
220
|
+
}
|
|
221
|
+
function sort() {
|
|
222
|
+
var fireAnalyticsEvent = props.fireAnalyticsEvent,
|
|
223
|
+
onSorting = props.onSorting,
|
|
224
|
+
columnIndex = props.columnIndex,
|
|
225
|
+
sortOrdered = props.sortOrdered;
|
|
226
|
+
if (onSorting && columnIndex != null) {
|
|
227
|
+
var sortOrder = nextStatusOrder(sortOrdered);
|
|
228
|
+
onSorting(columnIndex, sortOrder);
|
|
229
|
+
fireAnalyticsEvent && fireAnalyticsEvent({
|
|
230
|
+
action: ACTION.SORT_COLUMN,
|
|
231
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
232
|
+
attributes: {
|
|
233
|
+
platform: PLATFORM.WEB,
|
|
234
|
+
mode: MODE.RENDERER,
|
|
235
|
+
columnIndex: columnIndex,
|
|
236
|
+
sortOrder: sortOrder
|
|
237
|
+
},
|
|
238
|
+
eventType: EVENT_TYPE.TRACK
|
|
239
|
+
});
|
|
240
|
+
} else {
|
|
241
|
+
fireAnalyticsEvent && fireAnalyticsEvent({
|
|
242
|
+
action: ACTION.SORT_COLUMN_NOT_ALLOWED,
|
|
243
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
244
|
+
attributes: {
|
|
245
|
+
platform: PLATFORM.WEB,
|
|
246
|
+
mode: MODE.RENDERER
|
|
247
|
+
},
|
|
248
|
+
eventType: EVENT_TYPE.TRACK
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
212
253
|
};
|
|
213
|
-
export var TableHeader =
|
|
214
|
-
|
|
254
|
+
export var TableHeader = withSortableColumn(TH);
|
|
255
|
+
var TD = getWithCellProps('td');
|
|
256
|
+
export var TableCell = TD;
|
|
@@ -45,7 +45,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
|
|
|
45
45
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
46
46
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
47
47
|
var packageName = "@atlaskit/renderer";
|
|
48
|
-
var packageVersion = "108.15.
|
|
48
|
+
var packageVersion = "108.15.15";
|
|
49
49
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
50
50
|
_inherits(Renderer, _PureComponent);
|
|
51
51
|
var _super = _createSuper(Renderer);
|
package/dist/types/i18n/da.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/de.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/es.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/fr.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/hu.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/it.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/ko.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/nb.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/nl.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/pl.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/sv.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/th.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/tr.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/vi.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
package/dist/types/i18n/zh.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
|
@@ -16,5 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'fabric.editor.headingLink.invalidLabel': string;
|
|
17
17
|
'fabric.editor.headingLink.noOrderLabel': string;
|
|
18
18
|
'fabric.editor.headingLink.noneSortingLabel': string;
|
|
19
|
+
'fabric.editor.tableHeader.sorting.asc': string;
|
|
20
|
+
'fabric.editor.tableHeader.sorting.default': string;
|
|
21
|
+
'fabric.editor.tableHeader.sorting.desc': string;
|
|
22
|
+
'fabric.editor.tableHeader.sorting.invalid': string;
|
|
23
|
+
'fabric.editor.tableHeader.sorting.no': string;
|
|
19
24
|
};
|
|
20
25
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TextColorAttributes } from '@atlaskit/adf-schema';
|
|
3
|
-
import { MarkProps } from '../types';
|
|
2
|
+
import type { TextColorAttributes } from '@atlaskit/adf-schema';
|
|
3
|
+
import type { MarkProps } from '../types';
|
|
4
4
|
export default function TextColor(props: MarkProps<TextColorAttributes>): JSX.Element;
|