@atlaskit/task-decision 17.10.4 → 17.10.5
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 +8 -0
- package/dist/cjs/components/ResourcedTaskItem.js +17 -3
- package/dist/cjs/components/TaskItem.js +7 -3
- package/dist/es2019/components/ResourcedTaskItem.js +19 -3
- package/dist/es2019/components/TaskItem.js +7 -3
- package/dist/esm/components/ResourcedTaskItem.js +17 -3
- package/dist/esm/components/TaskItem.js +7 -3
- package/dist/types/components/ResourcedTaskItem.d.ts +5 -0
- package/dist/types/components/TaskItem.d.ts +3 -1
- package/dist/types-ts4.5/components/ResourcedTaskItem.d.ts +5 -0
- package/dist/types-ts4.5/components/TaskItem.d.ts +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/task-decision
|
|
2
2
|
|
|
3
|
+
## 17.10.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#142911](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/142911)
|
|
8
|
+
[`f661df7842ec7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f661df7842ec7) -
|
|
9
|
+
[ux] [ED-24772] create request to edit component under feature toggle
|
|
10
|
+
|
|
3
11
|
## 17.10.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -39,7 +39,12 @@ var ResourcedTaskItem = exports.default = /*#__PURE__*/function (_PureComponent)
|
|
|
39
39
|
var _this$props = _this.props,
|
|
40
40
|
taskDecisionProvider = _this$props.taskDecisionProvider,
|
|
41
41
|
objectAri = _this$props.objectAri,
|
|
42
|
-
onChange = _this$props.onChange
|
|
42
|
+
onChange = _this$props.onChange,
|
|
43
|
+
disableOnChange = _this$props.disableOnChange;
|
|
44
|
+
if (disableOnChange) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
// Optimistically update the task
|
|
44
49
|
_this.setState({
|
|
45
50
|
isDone: isDone
|
|
@@ -68,6 +73,12 @@ var ResourcedTaskItem = exports.default = /*#__PURE__*/function (_PureComponent)
|
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
75
|
});
|
|
76
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOnClick", function () {
|
|
77
|
+
var onClick = _this.props.onClick;
|
|
78
|
+
if (onClick) {
|
|
79
|
+
onClick();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
71
82
|
_this.state = {
|
|
72
83
|
isDone: props.isDone
|
|
73
84
|
};
|
|
@@ -157,7 +168,8 @@ var ResourcedTaskItem = exports.default = /*#__PURE__*/function (_PureComponent)
|
|
|
157
168
|
disabled = _this$props3.disabled,
|
|
158
169
|
dataAttributes = _this$props3.dataAttributes,
|
|
159
170
|
isRenderer = _this$props3.isRenderer,
|
|
160
|
-
isFocused = _this$props3.isFocused
|
|
171
|
+
isFocused = _this$props3.isFocused,
|
|
172
|
+
inputRef = _this$props3.inputRef;
|
|
161
173
|
return /*#__PURE__*/_react.default.createElement(_analyticsNamespacedContext.FabricElementsAnalyticsContext, {
|
|
162
174
|
data: {
|
|
163
175
|
objectAri: objectAri
|
|
@@ -168,12 +180,14 @@ var ResourcedTaskItem = exports.default = /*#__PURE__*/function (_PureComponent)
|
|
|
168
180
|
isFocused: isFocused,
|
|
169
181
|
taskId: taskId,
|
|
170
182
|
onChange: this.handleOnChange,
|
|
183
|
+
onClick: this.handleOnClick,
|
|
171
184
|
appearance: appearance,
|
|
172
185
|
contentRef: contentRef,
|
|
173
186
|
showPlaceholder: showPlaceholder,
|
|
174
187
|
placeholder: placeholder,
|
|
175
188
|
disabled: disabled,
|
|
176
|
-
dataAttributes: dataAttributes
|
|
189
|
+
dataAttributes: dataAttributes,
|
|
190
|
+
inputRef: inputRef
|
|
177
191
|
}, children));
|
|
178
192
|
}
|
|
179
193
|
}]);
|
|
@@ -39,7 +39,9 @@ var TaskItem = function TaskItem(props) {
|
|
|
39
39
|
dataAttributes = props.dataAttributes,
|
|
40
40
|
taskId = props.taskId,
|
|
41
41
|
onChange = props.onChange,
|
|
42
|
-
|
|
42
|
+
onClick = props.onClick,
|
|
43
|
+
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
44
|
+
inputRefFromProps = props.inputRef;
|
|
43
45
|
var checkBoxId = (0, _react.useMemo)(function () {
|
|
44
46
|
return getCheckBoxId(taskId);
|
|
45
47
|
}, [taskId]);
|
|
@@ -69,7 +71,8 @@ var TaskItem = function TaskItem(props) {
|
|
|
69
71
|
}
|
|
70
72
|
};
|
|
71
73
|
}, [handleOnChange]);
|
|
72
|
-
var
|
|
74
|
+
var defaultInputRef = (0, _react.useRef)(null);
|
|
75
|
+
var inputRef = inputRefFromProps !== null && inputRefFromProps !== void 0 ? inputRefFromProps : defaultInputRef;
|
|
73
76
|
var icon =
|
|
74
77
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
75
78
|
(0, _react2.jsx)("span", {
|
|
@@ -81,6 +84,7 @@ var TaskItem = function TaskItem(props) {
|
|
|
81
84
|
name: checkBoxId,
|
|
82
85
|
type: "checkbox",
|
|
83
86
|
onChange: handleOnChange,
|
|
87
|
+
onClick: onClick,
|
|
84
88
|
checked: !!isDone,
|
|
85
89
|
disabled: !!disabled,
|
|
86
90
|
suppressHydrationWarning: true,
|
|
@@ -99,7 +103,7 @@ var TaskItem = function TaskItem(props) {
|
|
|
99
103
|
(_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 || _inputRef$current3.focus();
|
|
100
104
|
}, 100);
|
|
101
105
|
}
|
|
102
|
-
}, [isFocused]);
|
|
106
|
+
}, [isFocused, inputRef]);
|
|
103
107
|
return (0, _react2.jsx)(_Item.default, {
|
|
104
108
|
appearance: appearance,
|
|
105
109
|
contentRef: contentRef,
|
|
@@ -16,8 +16,13 @@ export default class ResourcedTaskItem extends PureComponent {
|
|
|
16
16
|
const {
|
|
17
17
|
taskDecisionProvider,
|
|
18
18
|
objectAri,
|
|
19
|
-
onChange
|
|
19
|
+
onChange,
|
|
20
|
+
disableOnChange
|
|
20
21
|
} = this.props;
|
|
22
|
+
if (disableOnChange) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
// Optimistically update the task
|
|
22
27
|
this.setState({
|
|
23
28
|
isDone
|
|
@@ -46,6 +51,14 @@ export default class ResourcedTaskItem extends PureComponent {
|
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
});
|
|
54
|
+
_defineProperty(this, "handleOnClick", () => {
|
|
55
|
+
const {
|
|
56
|
+
onClick
|
|
57
|
+
} = this.props;
|
|
58
|
+
if (onClick) {
|
|
59
|
+
onClick();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
49
62
|
this.state = {
|
|
50
63
|
isDone: props.isDone
|
|
51
64
|
};
|
|
@@ -126,7 +139,8 @@ export default class ResourcedTaskItem extends PureComponent {
|
|
|
126
139
|
disabled,
|
|
127
140
|
dataAttributes,
|
|
128
141
|
isRenderer,
|
|
129
|
-
isFocused
|
|
142
|
+
isFocused,
|
|
143
|
+
inputRef
|
|
130
144
|
} = this.props;
|
|
131
145
|
return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
|
|
132
146
|
data: {
|
|
@@ -138,12 +152,14 @@ export default class ResourcedTaskItem extends PureComponent {
|
|
|
138
152
|
isFocused: isFocused,
|
|
139
153
|
taskId: taskId,
|
|
140
154
|
onChange: this.handleOnChange,
|
|
155
|
+
onClick: this.handleOnClick,
|
|
141
156
|
appearance: appearance,
|
|
142
157
|
contentRef: contentRef,
|
|
143
158
|
showPlaceholder: showPlaceholder,
|
|
144
159
|
placeholder: placeholder,
|
|
145
160
|
disabled: disabled,
|
|
146
|
-
dataAttributes: dataAttributes
|
|
161
|
+
dataAttributes: dataAttributes,
|
|
162
|
+
inputRef: inputRef
|
|
147
163
|
}, children));
|
|
148
164
|
}
|
|
149
165
|
}
|
|
@@ -26,7 +26,9 @@ const TaskItem = props => {
|
|
|
26
26
|
dataAttributes,
|
|
27
27
|
taskId,
|
|
28
28
|
onChange,
|
|
29
|
-
|
|
29
|
+
onClick,
|
|
30
|
+
createAnalyticsEvent,
|
|
31
|
+
inputRef: inputRefFromProps
|
|
30
32
|
} = props;
|
|
31
33
|
const checkBoxId = useMemo(() => getCheckBoxId(taskId), [taskId]);
|
|
32
34
|
const handleOnChange = useMemo(() => {
|
|
@@ -53,7 +55,8 @@ const TaskItem = props => {
|
|
|
53
55
|
handleOnChange(event);
|
|
54
56
|
}
|
|
55
57
|
}, [handleOnChange]);
|
|
56
|
-
const
|
|
58
|
+
const defaultInputRef = useRef(null);
|
|
59
|
+
const inputRef = inputRefFromProps !== null && inputRefFromProps !== void 0 ? inputRefFromProps : defaultInputRef;
|
|
57
60
|
const icon =
|
|
58
61
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
59
62
|
jsx("span", {
|
|
@@ -65,6 +68,7 @@ const TaskItem = props => {
|
|
|
65
68
|
name: checkBoxId,
|
|
66
69
|
type: "checkbox",
|
|
67
70
|
onChange: handleOnChange,
|
|
71
|
+
onClick: onClick,
|
|
68
72
|
checked: !!isDone,
|
|
69
73
|
disabled: !!disabled,
|
|
70
74
|
suppressHydrationWarning: true,
|
|
@@ -83,7 +87,7 @@ const TaskItem = props => {
|
|
|
83
87
|
(_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.focus();
|
|
84
88
|
}, 100);
|
|
85
89
|
}
|
|
86
|
-
}, [isFocused]);
|
|
90
|
+
}, [isFocused, inputRef]);
|
|
87
91
|
return jsx(Item, {
|
|
88
92
|
appearance: appearance,
|
|
89
93
|
contentRef: contentRef,
|
|
@@ -30,7 +30,12 @@ var ResourcedTaskItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
30
30
|
var _this$props = _this.props,
|
|
31
31
|
taskDecisionProvider = _this$props.taskDecisionProvider,
|
|
32
32
|
objectAri = _this$props.objectAri,
|
|
33
|
-
onChange = _this$props.onChange
|
|
33
|
+
onChange = _this$props.onChange,
|
|
34
|
+
disableOnChange = _this$props.disableOnChange;
|
|
35
|
+
if (disableOnChange) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
// Optimistically update the task
|
|
35
40
|
_this.setState({
|
|
36
41
|
isDone: isDone
|
|
@@ -59,6 +64,12 @@ var ResourcedTaskItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
59
64
|
}
|
|
60
65
|
}
|
|
61
66
|
});
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "handleOnClick", function () {
|
|
68
|
+
var onClick = _this.props.onClick;
|
|
69
|
+
if (onClick) {
|
|
70
|
+
onClick();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
62
73
|
_this.state = {
|
|
63
74
|
isDone: props.isDone
|
|
64
75
|
};
|
|
@@ -148,7 +159,8 @@ var ResourcedTaskItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
148
159
|
disabled = _this$props3.disabled,
|
|
149
160
|
dataAttributes = _this$props3.dataAttributes,
|
|
150
161
|
isRenderer = _this$props3.isRenderer,
|
|
151
|
-
isFocused = _this$props3.isFocused
|
|
162
|
+
isFocused = _this$props3.isFocused,
|
|
163
|
+
inputRef = _this$props3.inputRef;
|
|
152
164
|
return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
|
|
153
165
|
data: {
|
|
154
166
|
objectAri: objectAri
|
|
@@ -159,12 +171,14 @@ var ResourcedTaskItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
159
171
|
isFocused: isFocused,
|
|
160
172
|
taskId: taskId,
|
|
161
173
|
onChange: this.handleOnChange,
|
|
174
|
+
onClick: this.handleOnClick,
|
|
162
175
|
appearance: appearance,
|
|
163
176
|
contentRef: contentRef,
|
|
164
177
|
showPlaceholder: showPlaceholder,
|
|
165
178
|
placeholder: placeholder,
|
|
166
179
|
disabled: disabled,
|
|
167
|
-
dataAttributes: dataAttributes
|
|
180
|
+
dataAttributes: dataAttributes,
|
|
181
|
+
inputRef: inputRef
|
|
168
182
|
}, children));
|
|
169
183
|
}
|
|
170
184
|
}]);
|
|
@@ -27,7 +27,9 @@ var TaskItem = function TaskItem(props) {
|
|
|
27
27
|
dataAttributes = props.dataAttributes,
|
|
28
28
|
taskId = props.taskId,
|
|
29
29
|
onChange = props.onChange,
|
|
30
|
-
|
|
30
|
+
onClick = props.onClick,
|
|
31
|
+
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
32
|
+
inputRefFromProps = props.inputRef;
|
|
31
33
|
var checkBoxId = useMemo(function () {
|
|
32
34
|
return getCheckBoxId(taskId);
|
|
33
35
|
}, [taskId]);
|
|
@@ -57,7 +59,8 @@ var TaskItem = function TaskItem(props) {
|
|
|
57
59
|
}
|
|
58
60
|
};
|
|
59
61
|
}, [handleOnChange]);
|
|
60
|
-
var
|
|
62
|
+
var defaultInputRef = useRef(null);
|
|
63
|
+
var inputRef = inputRefFromProps !== null && inputRefFromProps !== void 0 ? inputRefFromProps : defaultInputRef;
|
|
61
64
|
var icon =
|
|
62
65
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
63
66
|
jsx("span", {
|
|
@@ -69,6 +72,7 @@ var TaskItem = function TaskItem(props) {
|
|
|
69
72
|
name: checkBoxId,
|
|
70
73
|
type: "checkbox",
|
|
71
74
|
onChange: handleOnChange,
|
|
75
|
+
onClick: onClick,
|
|
72
76
|
checked: !!isDone,
|
|
73
77
|
disabled: !!disabled,
|
|
74
78
|
suppressHydrationWarning: true,
|
|
@@ -87,7 +91,7 @@ var TaskItem = function TaskItem(props) {
|
|
|
87
91
|
(_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 || _inputRef$current3.focus();
|
|
88
92
|
}, 100);
|
|
89
93
|
}
|
|
90
|
-
}, [isFocused]);
|
|
94
|
+
}, [isFocused, inputRef]);
|
|
91
95
|
return jsx(Item, {
|
|
92
96
|
appearance: appearance,
|
|
93
97
|
contentRef: contentRef,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
1
2
|
import { PureComponent } from 'react';
|
|
2
3
|
import { type Appearance, type ContentRef, type TaskDecisionProvider } from '../types';
|
|
3
4
|
export interface Props {
|
|
@@ -6,6 +7,7 @@ export interface Props {
|
|
|
6
7
|
isRenderer?: boolean;
|
|
7
8
|
isFocused?: boolean;
|
|
8
9
|
onChange?: (taskId: string, isChecked: boolean) => void;
|
|
10
|
+
onClick?: () => void;
|
|
9
11
|
contentRef?: ContentRef;
|
|
10
12
|
children?: any;
|
|
11
13
|
taskDecisionProvider?: Promise<TaskDecisionProvider>;
|
|
@@ -17,6 +19,8 @@ export interface Props {
|
|
|
17
19
|
dataAttributes?: {
|
|
18
20
|
[key: string]: string | number;
|
|
19
21
|
};
|
|
22
|
+
inputRef?: RefObject<HTMLInputElement>;
|
|
23
|
+
disableOnChange?: boolean;
|
|
20
24
|
}
|
|
21
25
|
export interface State {
|
|
22
26
|
isDone?: boolean;
|
|
@@ -32,5 +36,6 @@ export default class ResourcedTaskItem extends PureComponent<Props, State> {
|
|
|
32
36
|
private unsubscribe;
|
|
33
37
|
private onUpdate;
|
|
34
38
|
private handleOnChange;
|
|
39
|
+
private handleOnClick;
|
|
35
40
|
render(): JSX.Element;
|
|
36
41
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { type RefObject } from 'react';
|
|
6
6
|
import { type Appearance, type ContentRef } from '../types';
|
|
7
7
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
8
8
|
export interface Props {
|
|
@@ -11,6 +11,7 @@ export interface Props {
|
|
|
11
11
|
isFocused?: boolean;
|
|
12
12
|
isRenderer?: boolean;
|
|
13
13
|
onChange?: (taskId: string, isChecked: boolean) => void;
|
|
14
|
+
onClick?: () => void;
|
|
14
15
|
contentRef?: ContentRef;
|
|
15
16
|
children?: any;
|
|
16
17
|
placeholder?: string;
|
|
@@ -20,6 +21,7 @@ export interface Props {
|
|
|
20
21
|
dataAttributes?: {
|
|
21
22
|
[key: string]: string | number;
|
|
22
23
|
};
|
|
24
|
+
inputRef?: RefObject<HTMLInputElement>;
|
|
23
25
|
}
|
|
24
26
|
declare const _default: React.ForwardRefExoticComponent<Omit<Props & WithAnalyticsEventsProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
25
27
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
1
2
|
import { PureComponent } from 'react';
|
|
2
3
|
import { type Appearance, type ContentRef, type TaskDecisionProvider } from '../types';
|
|
3
4
|
export interface Props {
|
|
@@ -6,6 +7,7 @@ export interface Props {
|
|
|
6
7
|
isRenderer?: boolean;
|
|
7
8
|
isFocused?: boolean;
|
|
8
9
|
onChange?: (taskId: string, isChecked: boolean) => void;
|
|
10
|
+
onClick?: () => void;
|
|
9
11
|
contentRef?: ContentRef;
|
|
10
12
|
children?: any;
|
|
11
13
|
taskDecisionProvider?: Promise<TaskDecisionProvider>;
|
|
@@ -17,6 +19,8 @@ export interface Props {
|
|
|
17
19
|
dataAttributes?: {
|
|
18
20
|
[key: string]: string | number;
|
|
19
21
|
};
|
|
22
|
+
inputRef?: RefObject<HTMLInputElement>;
|
|
23
|
+
disableOnChange?: boolean;
|
|
20
24
|
}
|
|
21
25
|
export interface State {
|
|
22
26
|
isDone?: boolean;
|
|
@@ -32,5 +36,6 @@ export default class ResourcedTaskItem extends PureComponent<Props, State> {
|
|
|
32
36
|
private unsubscribe;
|
|
33
37
|
private onUpdate;
|
|
34
38
|
private handleOnChange;
|
|
39
|
+
private handleOnClick;
|
|
35
40
|
render(): JSX.Element;
|
|
36
41
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { type RefObject } from 'react';
|
|
6
6
|
import { type Appearance, type ContentRef } from '../types';
|
|
7
7
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
8
8
|
export interface Props {
|
|
@@ -11,6 +11,7 @@ export interface Props {
|
|
|
11
11
|
isFocused?: boolean;
|
|
12
12
|
isRenderer?: boolean;
|
|
13
13
|
onChange?: (taskId: string, isChecked: boolean) => void;
|
|
14
|
+
onClick?: () => void;
|
|
14
15
|
contentRef?: ContentRef;
|
|
15
16
|
children?: any;
|
|
16
17
|
placeholder?: string;
|
|
@@ -20,6 +21,7 @@ export interface Props {
|
|
|
20
21
|
dataAttributes?: {
|
|
21
22
|
[key: string]: string | number;
|
|
22
23
|
};
|
|
24
|
+
inputRef?: RefObject<HTMLInputElement>;
|
|
23
25
|
}
|
|
24
26
|
declare const _default: React.ForwardRefExoticComponent<Omit<Props & WithAnalyticsEventsProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
25
27
|
export default _default;
|