@instructure/ui-editable 8.25.1-snapshot.0 → 8.26.0
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 +4 -0
- package/es/Editable/index.js +13 -14
- package/es/Editable/props.js +0 -40
- package/es/InPlaceEdit/index.js +18 -12
- package/es/InPlaceEdit/props.js +0 -70
- package/lib/Editable/index.js +13 -14
- package/lib/Editable/props.js +0 -40
- package/lib/InPlaceEdit/index.js +18 -12
- package/lib/InPlaceEdit/props.js +0 -70
- package/package.json +14 -15
- package/src/Editable/index.tsx +33 -43
- package/src/Editable/props.ts +78 -31
- package/src/InPlaceEdit/index.tsx +29 -26
- package/src/InPlaceEdit/props.ts +62 -37
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Editable/index.d.ts +30 -50
- package/types/Editable/index.d.ts.map +1 -1
- package/types/Editable/props.d.ts +75 -5
- package/types/Editable/props.d.ts.map +1 -1
- package/types/InPlaceEdit/index.d.ts +45 -38
- package/types/InPlaceEdit/index.d.ts.map +1 -1
- package/types/InPlaceEdit/props.d.ts +86 -5
- package/types/InPlaceEdit/props.d.ts.map +1 -1
- package/LICENSE.md +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.26.0](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.26.0) (2022-06-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-editable
|
|
9
|
+
|
|
6
10
|
# [8.25.0](https://github.com/instructure/instructure-ui/compare/v8.24.5...v8.25.0) (2022-06-03)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-editable
|
package/es/Editable/index.js
CHANGED
|
@@ -30,8 +30,8 @@ import { propTypes, allowedProps } from './props';
|
|
|
30
30
|
/**
|
|
31
31
|
---
|
|
32
32
|
category: components
|
|
33
|
-
experimental: true
|
|
34
33
|
---
|
|
34
|
+
@tsProps
|
|
35
35
|
**/
|
|
36
36
|
class Editable extends Component {
|
|
37
37
|
constructor(_props) {
|
|
@@ -80,23 +80,23 @@ class Editable extends Component {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
this.handleEditBlur =
|
|
83
|
+
this.handleEditBlur = () => {
|
|
84
84
|
this.enterView();
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
this.handleEditButtonFocus =
|
|
87
|
+
this.handleEditButtonFocus = () => {
|
|
88
88
|
this.setState({
|
|
89
89
|
showModeToggle: true
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
this.handleEditButtonBlur =
|
|
93
|
+
this.handleEditButtonBlur = () => {
|
|
94
94
|
this.setState({
|
|
95
95
|
showModeToggle: false
|
|
96
96
|
});
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
this.handleEditButtonClick =
|
|
99
|
+
this.handleEditButtonClick = () => {
|
|
100
100
|
this.enterEdit();
|
|
101
101
|
};
|
|
102
102
|
|
|
@@ -119,8 +119,8 @@ class Editable extends Component {
|
|
|
119
119
|
return {
|
|
120
120
|
onMouseOver: _this.handleViewMouseOver,
|
|
121
121
|
onMouseOut: _this.handleViewMouseOut,
|
|
122
|
-
onMouseDown: mode !== 'edit' ? _this.handleViewClick :
|
|
123
|
-
onKeyUp: mode === 'edit' ? _this.handleEditESC :
|
|
122
|
+
onMouseDown: mode !== 'edit' ? _this.handleViewClick : void 0,
|
|
123
|
+
onKeyUp: mode === 'edit' ? _this.handleEditESC : void 0,
|
|
124
124
|
readOnly,
|
|
125
125
|
...props,
|
|
126
126
|
ref: _this.handleContainerRef
|
|
@@ -136,14 +136,15 @@ class Editable extends Component {
|
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
this.getEditorProps =
|
|
139
|
+
this.getEditorProps = function () {
|
|
140
|
+
let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
140
141
|
return {
|
|
141
|
-
mode:
|
|
142
|
-
onBlur:
|
|
142
|
+
mode: _this.props.mode,
|
|
143
|
+
onBlur: _this.handleEditBlur,
|
|
143
144
|
editorRef: el => {
|
|
144
|
-
|
|
145
|
+
_this._editorRef = el;
|
|
145
146
|
},
|
|
146
|
-
readOnly:
|
|
147
|
+
readOnly: _this.props.readOnly,
|
|
147
148
|
...props
|
|
148
149
|
};
|
|
149
150
|
};
|
|
@@ -172,8 +173,6 @@ class Editable extends Component {
|
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
componentWillUnmount() {}
|
|
176
|
-
|
|
177
176
|
componentDidUpdate(prevProps) {
|
|
178
177
|
const _this$props2 = this.props,
|
|
179
178
|
mode = _this$props2.mode,
|
package/es/Editable/props.js
CHANGED
|
@@ -23,53 +23,13 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
const propTypes = {
|
|
26
|
-
/**
|
|
27
|
-
* If `'view'`: the view component is rendered,
|
|
28
|
-
* if `'edit'`: the edit component is rendered
|
|
29
|
-
*/
|
|
30
26
|
mode: PropTypes.oneOf(['view', 'edit']).isRequired,
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Called when the component's mode changes
|
|
34
|
-
* @param {string} new_mode
|
|
35
|
-
*/
|
|
36
27
|
onChangeMode: PropTypes.func.isRequired,
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @param {Object} renderProps
|
|
40
|
-
* @param {Boolean} mode
|
|
41
|
-
* @param {Function} renderProps.getContainerProps - Props to be spread onto the container element
|
|
42
|
-
* @param {Function} renderProps.getEditorProps - Props to be spread onto the editor element
|
|
43
|
-
* @param {Function} renderProps.getEditButtonProps - Props to be spread onto the edit button element
|
|
44
|
-
*/
|
|
45
28
|
children: PropTypes.func,
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Identical to children
|
|
49
|
-
*/
|
|
50
29
|
render: PropTypes.func,
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The current value.
|
|
54
|
-
* The value is managed by the consuming app, but we need to tell Editable
|
|
55
|
-
* it's changed or it won't re-render
|
|
56
|
-
*/
|
|
57
30
|
value: PropTypes.any,
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Called when Editable switches from edit to view mode and the value has changed.
|
|
61
|
-
* @param {any} value
|
|
62
|
-
*/
|
|
63
31
|
onChange: PropTypes.func,
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* The mode is fixed as 'view'
|
|
67
|
-
*/
|
|
68
32
|
readOnly: PropTypes.bool,
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* provides a reference to the underlying html root element (container)
|
|
72
|
-
*/
|
|
73
33
|
elementRef: PropTypes.func
|
|
74
34
|
};
|
|
75
35
|
const allowedProps = ['mode', 'onChangeMode', 'children', 'render', 'value', 'onChange', 'readOnly', 'elementRef'];
|
package/es/InPlaceEdit/index.js
CHANGED
|
@@ -45,11 +45,13 @@ import { propTypes, allowedProps } from './props';
|
|
|
45
45
|
---
|
|
46
46
|
category: components
|
|
47
47
|
---
|
|
48
|
+
@tsProps
|
|
48
49
|
**/
|
|
49
50
|
let InPlaceEdit = (_dec = withStyle(generateStyle, null), _dec(_class = (_class2 = class InPlaceEdit extends Component {
|
|
50
51
|
constructor(props) {
|
|
51
52
|
super(props);
|
|
52
53
|
this.ref = null;
|
|
54
|
+
this._editButtonRef = null;
|
|
53
55
|
|
|
54
56
|
this.handleRef = el => {
|
|
55
57
|
this.ref = el;
|
|
@@ -83,11 +85,15 @@ let InPlaceEdit = (_dec = withStyle(generateStyle, null), _dec(_class = (_class2
|
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
componentDidMount() {
|
|
86
|
-
|
|
88
|
+
var _this$props$makeStyle, _this$props;
|
|
89
|
+
|
|
90
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
87
91
|
}
|
|
88
92
|
|
|
89
|
-
componentDidUpdate(
|
|
90
|
-
|
|
93
|
+
componentDidUpdate() {
|
|
94
|
+
var _this$props$makeStyle2, _this$props2;
|
|
95
|
+
|
|
96
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
renderEditor(_ref2) {
|
|
@@ -97,9 +103,9 @@ let InPlaceEdit = (_dec = withStyle(generateStyle, null), _dec(_class = (_class2
|
|
|
97
103
|
onBlur = _ref2.onBlur,
|
|
98
104
|
editorRef = _ref2.editorRef,
|
|
99
105
|
readOnly = _ref2.readOnly;
|
|
100
|
-
const _this$
|
|
101
|
-
showFocusRing = _this$
|
|
102
|
-
renderEditor = _this$
|
|
106
|
+
const _this$props3 = this.props,
|
|
107
|
+
showFocusRing = _this$props3.showFocusRing,
|
|
108
|
+
renderEditor = _this$props3.renderEditor;
|
|
103
109
|
const isEditMode = !readOnly && mode === 'edit';
|
|
104
110
|
return isEditMode ? jsx(View, {
|
|
105
111
|
as: "span",
|
|
@@ -134,12 +140,12 @@ let InPlaceEdit = (_dec = withStyle(generateStyle, null), _dec(_class = (_class2
|
|
|
134
140
|
|
|
135
141
|
|
|
136
142
|
render() {
|
|
137
|
-
const _this$
|
|
138
|
-
mode = _this$
|
|
139
|
-
value = _this$
|
|
140
|
-
onChange = _this$
|
|
141
|
-
onChangeMode = _this$
|
|
142
|
-
readOnly = _this$
|
|
143
|
+
const _this$props4 = this.props,
|
|
144
|
+
mode = _this$props4.mode,
|
|
145
|
+
value = _this$props4.value,
|
|
146
|
+
onChange = _this$props4.onChange,
|
|
147
|
+
onChangeMode = _this$props4.onChangeMode,
|
|
148
|
+
readOnly = _this$props4.readOnly;
|
|
143
149
|
return jsx(Editable, {
|
|
144
150
|
mode: mode,
|
|
145
151
|
onChangeMode: onChangeMode,
|
package/es/InPlaceEdit/props.js
CHANGED
|
@@ -23,86 +23,16 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
const propTypes = {
|
|
26
|
-
/**
|
|
27
|
-
* Function to render the view mode component.
|
|
28
|
-
* It is the consumer's responsibility to provide the
|
|
29
|
-
* current value or children.
|
|
30
|
-
*
|
|
31
|
-
* @returns {element} the viewer DOM sub-tree.
|
|
32
|
-
*/
|
|
33
26
|
renderViewer: PropTypes.func.isRequired,
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Function to render the edit mode component
|
|
37
|
-
* It is the consumer's responsibility to provide the
|
|
38
|
-
* current value, and to attach the appropriate onChange
|
|
39
|
-
* event handler needed to capture the updated value. This
|
|
40
|
-
* new value must then be forwarded to the view mode component.
|
|
41
|
-
*
|
|
42
|
-
* @returns {element} the editor DOM sub-tree.
|
|
43
|
-
*/
|
|
44
27
|
renderEditor: PropTypes.func.isRequired,
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Function to render the edit button.
|
|
48
|
-
*
|
|
49
|
-
* @param {Object} { isVisible, onClick, onFocus, onBlur, buttonRef }
|
|
50
|
-
* @returns {element} the edit button DOM sub-tree
|
|
51
|
-
*
|
|
52
|
-
* If you choose to use the default edit button, add `label` to the
|
|
53
|
-
* incoming `props` parameter and call `InPlaceEdit.renderDefaultEditButton(props)`
|
|
54
|
-
*
|
|
55
|
-
* If you choose to render a custom button, attach the on* event handlers
|
|
56
|
-
* and set `buttonRef` as a `ref` type property on the `button` element.
|
|
57
|
-
*
|
|
58
|
-
* `isVisible` is a hint as to whether the button is _typically_ shown,
|
|
59
|
-
* but you're free to ignore it for your use-case.
|
|
60
|
-
*/
|
|
61
28
|
renderEditButton: PropTypes.func.isRequired,
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* If `'view'`: the view component is rendered,
|
|
65
|
-
* if `'edit'`: the edit component is rendered
|
|
66
|
-
*/
|
|
67
29
|
mode: PropTypes.oneOf(['view', 'edit']).isRequired,
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Called when the component's mode changes
|
|
71
|
-
* @param {string} newMode
|
|
72
|
-
*/
|
|
73
30
|
onChangeMode: PropTypes.func.isRequired,
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* The current value.
|
|
77
|
-
* The value is managed by the consuming app, but we need to tell InPlaceEdit
|
|
78
|
-
* it's changed or it won't re-render
|
|
79
|
-
*/
|
|
80
31
|
value: PropTypes.any,
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Called when Editable switches from edit to view mode and the value has changed.
|
|
84
|
-
* @param {any} value
|
|
85
|
-
*/
|
|
86
32
|
onChange: PropTypes.func,
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* The mode is fixed as 'view'
|
|
90
|
-
*/
|
|
91
33
|
readOnly: PropTypes.bool,
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Show a focus outline when the input is focused
|
|
95
|
-
*/
|
|
96
34
|
showFocusRing: PropTypes.bool,
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Put the edit button before or after the view
|
|
100
|
-
*/
|
|
101
35
|
editButtonPlacement: PropTypes.oneOf(['start', 'end']),
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Render outermost element inline v. block
|
|
105
|
-
*/
|
|
106
36
|
inline: PropTypes.bool
|
|
107
37
|
};
|
|
108
38
|
const allowedProps = ['renderViewer', 'renderEditor', 'renderEditButton', 'mode', 'onChangeMode', 'value', 'onChange', 'readOnly', 'showFocusRing', 'editButtonPlacement', 'inline'];
|
package/lib/Editable/index.js
CHANGED
|
@@ -42,8 +42,8 @@ var _props2 = require("./props");
|
|
|
42
42
|
/**
|
|
43
43
|
---
|
|
44
44
|
category: components
|
|
45
|
-
experimental: true
|
|
46
45
|
---
|
|
46
|
+
@tsProps
|
|
47
47
|
**/
|
|
48
48
|
class Editable extends _react.Component {
|
|
49
49
|
constructor(_props) {
|
|
@@ -92,23 +92,23 @@ class Editable extends _react.Component {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
this.handleEditBlur =
|
|
95
|
+
this.handleEditBlur = () => {
|
|
96
96
|
this.enterView();
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
this.handleEditButtonFocus =
|
|
99
|
+
this.handleEditButtonFocus = () => {
|
|
100
100
|
this.setState({
|
|
101
101
|
showModeToggle: true
|
|
102
102
|
});
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
this.handleEditButtonBlur =
|
|
105
|
+
this.handleEditButtonBlur = () => {
|
|
106
106
|
this.setState({
|
|
107
107
|
showModeToggle: false
|
|
108
108
|
});
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
this.handleEditButtonClick =
|
|
111
|
+
this.handleEditButtonClick = () => {
|
|
112
112
|
this.enterEdit();
|
|
113
113
|
};
|
|
114
114
|
|
|
@@ -131,8 +131,8 @@ class Editable extends _react.Component {
|
|
|
131
131
|
return {
|
|
132
132
|
onMouseOver: _this.handleViewMouseOver,
|
|
133
133
|
onMouseOut: _this.handleViewMouseOut,
|
|
134
|
-
onMouseDown: mode !== 'edit' ? _this.handleViewClick :
|
|
135
|
-
onKeyUp: mode === 'edit' ? _this.handleEditESC :
|
|
134
|
+
onMouseDown: mode !== 'edit' ? _this.handleViewClick : void 0,
|
|
135
|
+
onKeyUp: mode === 'edit' ? _this.handleEditESC : void 0,
|
|
136
136
|
readOnly,
|
|
137
137
|
...props,
|
|
138
138
|
ref: _this.handleContainerRef
|
|
@@ -148,14 +148,15 @@ class Editable extends _react.Component {
|
|
|
148
148
|
};
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
-
this.getEditorProps =
|
|
151
|
+
this.getEditorProps = function () {
|
|
152
|
+
let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
152
153
|
return {
|
|
153
|
-
mode:
|
|
154
|
-
onBlur:
|
|
154
|
+
mode: _this.props.mode,
|
|
155
|
+
onBlur: _this.handleEditBlur,
|
|
155
156
|
editorRef: el => {
|
|
156
|
-
|
|
157
|
+
_this._editorRef = el;
|
|
157
158
|
},
|
|
158
|
-
readOnly:
|
|
159
|
+
readOnly: _this.props.readOnly,
|
|
159
160
|
...props
|
|
160
161
|
};
|
|
161
162
|
};
|
|
@@ -184,8 +185,6 @@ class Editable extends _react.Component {
|
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
|
|
187
|
-
componentWillUnmount() {}
|
|
188
|
-
|
|
189
188
|
componentDidUpdate(prevProps) {
|
|
190
189
|
const _this$props2 = this.props,
|
|
191
190
|
mode = _this$props2.mode,
|
package/lib/Editable/props.js
CHANGED
|
@@ -33,53 +33,13 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
33
33
|
* SOFTWARE.
|
|
34
34
|
*/
|
|
35
35
|
const propTypes = {
|
|
36
|
-
/**
|
|
37
|
-
* If `'view'`: the view component is rendered,
|
|
38
|
-
* if `'edit'`: the edit component is rendered
|
|
39
|
-
*/
|
|
40
36
|
mode: _propTypes.default.oneOf(['view', 'edit']).isRequired,
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Called when the component's mode changes
|
|
44
|
-
* @param {string} new_mode
|
|
45
|
-
*/
|
|
46
37
|
onChangeMode: _propTypes.default.func.isRequired,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @param {Object} renderProps
|
|
50
|
-
* @param {Boolean} mode
|
|
51
|
-
* @param {Function} renderProps.getContainerProps - Props to be spread onto the container element
|
|
52
|
-
* @param {Function} renderProps.getEditorProps - Props to be spread onto the editor element
|
|
53
|
-
* @param {Function} renderProps.getEditButtonProps - Props to be spread onto the edit button element
|
|
54
|
-
*/
|
|
55
38
|
children: _propTypes.default.func,
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Identical to children
|
|
59
|
-
*/
|
|
60
39
|
render: _propTypes.default.func,
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* The current value.
|
|
64
|
-
* The value is managed by the consuming app, but we need to tell Editable
|
|
65
|
-
* it's changed or it won't re-render
|
|
66
|
-
*/
|
|
67
40
|
value: _propTypes.default.any,
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Called when Editable switches from edit to view mode and the value has changed.
|
|
71
|
-
* @param {any} value
|
|
72
|
-
*/
|
|
73
41
|
onChange: _propTypes.default.func,
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* The mode is fixed as 'view'
|
|
77
|
-
*/
|
|
78
42
|
readOnly: _propTypes.default.bool,
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* provides a reference to the underlying html root element (container)
|
|
82
|
-
*/
|
|
83
43
|
elementRef: _propTypes.default.func
|
|
84
44
|
};
|
|
85
45
|
exports.propTypes = propTypes;
|
package/lib/InPlaceEdit/index.js
CHANGED
|
@@ -40,11 +40,13 @@ var _dec, _class, _class2;
|
|
|
40
40
|
---
|
|
41
41
|
category: components
|
|
42
42
|
---
|
|
43
|
+
@tsProps
|
|
43
44
|
**/
|
|
44
45
|
let InPlaceEdit = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_class = (_class2 = class InPlaceEdit extends _react.Component {
|
|
45
46
|
constructor(props) {
|
|
46
47
|
super(props);
|
|
47
48
|
this.ref = null;
|
|
49
|
+
this._editButtonRef = null;
|
|
48
50
|
|
|
49
51
|
this.handleRef = el => {
|
|
50
52
|
this.ref = el;
|
|
@@ -78,11 +80,15 @@ let InPlaceEdit = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_
|
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
componentDidMount() {
|
|
81
|
-
|
|
83
|
+
var _this$props$makeStyle, _this$props;
|
|
84
|
+
|
|
85
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
82
86
|
}
|
|
83
87
|
|
|
84
|
-
componentDidUpdate(
|
|
85
|
-
|
|
88
|
+
componentDidUpdate() {
|
|
89
|
+
var _this$props$makeStyle2, _this$props2;
|
|
90
|
+
|
|
91
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
renderEditor(_ref2) {
|
|
@@ -92,9 +98,9 @@ let InPlaceEdit = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_
|
|
|
92
98
|
onBlur = _ref2.onBlur,
|
|
93
99
|
editorRef = _ref2.editorRef,
|
|
94
100
|
readOnly = _ref2.readOnly;
|
|
95
|
-
const _this$
|
|
96
|
-
showFocusRing = _this$
|
|
97
|
-
renderEditor = _this$
|
|
101
|
+
const _this$props3 = this.props,
|
|
102
|
+
showFocusRing = _this$props3.showFocusRing,
|
|
103
|
+
renderEditor = _this$props3.renderEditor;
|
|
98
104
|
const isEditMode = !readOnly && mode === 'edit';
|
|
99
105
|
return isEditMode ? (0, _emotion.jsx)(_View.View, {
|
|
100
106
|
as: "span",
|
|
@@ -128,12 +134,12 @@ let InPlaceEdit = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_
|
|
|
128
134
|
|
|
129
135
|
|
|
130
136
|
render() {
|
|
131
|
-
const _this$
|
|
132
|
-
mode = _this$
|
|
133
|
-
value = _this$
|
|
134
|
-
onChange = _this$
|
|
135
|
-
onChangeMode = _this$
|
|
136
|
-
readOnly = _this$
|
|
137
|
+
const _this$props4 = this.props,
|
|
138
|
+
mode = _this$props4.mode,
|
|
139
|
+
value = _this$props4.value,
|
|
140
|
+
onChange = _this$props4.onChange,
|
|
141
|
+
onChangeMode = _this$props4.onChangeMode,
|
|
142
|
+
readOnly = _this$props4.readOnly;
|
|
137
143
|
return (0, _emotion.jsx)(_Editable.Editable, {
|
|
138
144
|
mode: mode,
|
|
139
145
|
onChangeMode: onChangeMode,
|
package/lib/InPlaceEdit/props.js
CHANGED
|
@@ -33,86 +33,16 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
33
33
|
* SOFTWARE.
|
|
34
34
|
*/
|
|
35
35
|
const propTypes = {
|
|
36
|
-
/**
|
|
37
|
-
* Function to render the view mode component.
|
|
38
|
-
* It is the consumer's responsibility to provide the
|
|
39
|
-
* current value or children.
|
|
40
|
-
*
|
|
41
|
-
* @returns {element} the viewer DOM sub-tree.
|
|
42
|
-
*/
|
|
43
36
|
renderViewer: _propTypes.default.func.isRequired,
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Function to render the edit mode component
|
|
47
|
-
* It is the consumer's responsibility to provide the
|
|
48
|
-
* current value, and to attach the appropriate onChange
|
|
49
|
-
* event handler needed to capture the updated value. This
|
|
50
|
-
* new value must then be forwarded to the view mode component.
|
|
51
|
-
*
|
|
52
|
-
* @returns {element} the editor DOM sub-tree.
|
|
53
|
-
*/
|
|
54
37
|
renderEditor: _propTypes.default.func.isRequired,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Function to render the edit button.
|
|
58
|
-
*
|
|
59
|
-
* @param {Object} { isVisible, onClick, onFocus, onBlur, buttonRef }
|
|
60
|
-
* @returns {element} the edit button DOM sub-tree
|
|
61
|
-
*
|
|
62
|
-
* If you choose to use the default edit button, add `label` to the
|
|
63
|
-
* incoming `props` parameter and call `InPlaceEdit.renderDefaultEditButton(props)`
|
|
64
|
-
*
|
|
65
|
-
* If you choose to render a custom button, attach the on* event handlers
|
|
66
|
-
* and set `buttonRef` as a `ref` type property on the `button` element.
|
|
67
|
-
*
|
|
68
|
-
* `isVisible` is a hint as to whether the button is _typically_ shown,
|
|
69
|
-
* but you're free to ignore it for your use-case.
|
|
70
|
-
*/
|
|
71
38
|
renderEditButton: _propTypes.default.func.isRequired,
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* If `'view'`: the view component is rendered,
|
|
75
|
-
* if `'edit'`: the edit component is rendered
|
|
76
|
-
*/
|
|
77
39
|
mode: _propTypes.default.oneOf(['view', 'edit']).isRequired,
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Called when the component's mode changes
|
|
81
|
-
* @param {string} newMode
|
|
82
|
-
*/
|
|
83
40
|
onChangeMode: _propTypes.default.func.isRequired,
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* The current value.
|
|
87
|
-
* The value is managed by the consuming app, but we need to tell InPlaceEdit
|
|
88
|
-
* it's changed or it won't re-render
|
|
89
|
-
*/
|
|
90
41
|
value: _propTypes.default.any,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Called when Editable switches from edit to view mode and the value has changed.
|
|
94
|
-
* @param {any} value
|
|
95
|
-
*/
|
|
96
42
|
onChange: _propTypes.default.func,
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* The mode is fixed as 'view'
|
|
100
|
-
*/
|
|
101
43
|
readOnly: _propTypes.default.bool,
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Show a focus outline when the input is focused
|
|
105
|
-
*/
|
|
106
44
|
showFocusRing: _propTypes.default.bool,
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Put the edit button before or after the view
|
|
110
|
-
*/
|
|
111
45
|
editButtonPlacement: _propTypes.default.oneOf(['start', 'end']),
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Render outermost element inline v. block
|
|
115
|
-
*/
|
|
116
46
|
inline: _propTypes.default.bool
|
|
117
47
|
};
|
|
118
48
|
exports.propTypes = propTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-editable",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.26.0",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,21 +23,21 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.
|
|
27
|
-
"@instructure/ui-test-utils": "8.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.26.0",
|
|
27
|
+
"@instructure/ui-test-utils": "8.26.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.13.10",
|
|
31
|
-
"@instructure/console": "8.
|
|
32
|
-
"@instructure/emotion": "8.
|
|
33
|
-
"@instructure/ui-a11y-content": "8.
|
|
34
|
-
"@instructure/ui-buttons": "8.
|
|
35
|
-
"@instructure/ui-dom-utils": "8.
|
|
36
|
-
"@instructure/ui-flex": "8.
|
|
37
|
-
"@instructure/ui-focusable": "8.
|
|
38
|
-
"@instructure/ui-icons": "8.
|
|
39
|
-
"@instructure/ui-utils": "8.
|
|
40
|
-
"@instructure/ui-view": "8.
|
|
31
|
+
"@instructure/console": "8.26.0",
|
|
32
|
+
"@instructure/emotion": "8.26.0",
|
|
33
|
+
"@instructure/ui-a11y-content": "8.26.0",
|
|
34
|
+
"@instructure/ui-buttons": "8.26.0",
|
|
35
|
+
"@instructure/ui-dom-utils": "8.26.0",
|
|
36
|
+
"@instructure/ui-flex": "8.26.0",
|
|
37
|
+
"@instructure/ui-focusable": "8.26.0",
|
|
38
|
+
"@instructure/ui-icons": "8.26.0",
|
|
39
|
+
"@instructure/ui-utils": "8.26.0",
|
|
40
|
+
"@instructure/ui-view": "8.26.0",
|
|
41
41
|
"prop-types": "^15"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -47,6 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"sideEffects": false
|
|
51
|
-
"gitHead": "59b6babce07a9242111475156f544ec11c1a9283"
|
|
50
|
+
"sideEffects": false
|
|
52
51
|
}
|