@instructure/ui-editable 8.25.1-snapshot-7 → 8.25.1-snapshot-14
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 +1 -1
- package/es/Editable/index.js +13 -13
- 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 -13
- package/lib/Editable/props.js +0 -40
- package/lib/InPlaceEdit/index.js +18 -12
- package/lib/InPlaceEdit/props.js +0 -70
- package/package.json +13 -13
- package/src/Editable/index.tsx +33 -42
- 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 -49
- 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/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.25.1-snapshot-
|
|
6
|
+
## [8.25.1-snapshot-14](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-14) (2022-06-23)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-editable
|
|
9
9
|
|
package/es/Editable/index.js
CHANGED
|
@@ -32,6 +32,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
32
32
|
category: components
|
|
33
33
|
experimental: true
|
|
34
34
|
---
|
|
35
|
+
@tsProps
|
|
35
36
|
**/
|
|
36
37
|
class Editable extends Component {
|
|
37
38
|
constructor(_props) {
|
|
@@ -80,23 +81,23 @@ class Editable extends Component {
|
|
|
80
81
|
}
|
|
81
82
|
};
|
|
82
83
|
|
|
83
|
-
this.handleEditBlur =
|
|
84
|
+
this.handleEditBlur = () => {
|
|
84
85
|
this.enterView();
|
|
85
86
|
};
|
|
86
87
|
|
|
87
|
-
this.handleEditButtonFocus =
|
|
88
|
+
this.handleEditButtonFocus = () => {
|
|
88
89
|
this.setState({
|
|
89
90
|
showModeToggle: true
|
|
90
91
|
});
|
|
91
92
|
};
|
|
92
93
|
|
|
93
|
-
this.handleEditButtonBlur =
|
|
94
|
+
this.handleEditButtonBlur = () => {
|
|
94
95
|
this.setState({
|
|
95
96
|
showModeToggle: false
|
|
96
97
|
});
|
|
97
98
|
};
|
|
98
99
|
|
|
99
|
-
this.handleEditButtonClick =
|
|
100
|
+
this.handleEditButtonClick = () => {
|
|
100
101
|
this.enterEdit();
|
|
101
102
|
};
|
|
102
103
|
|
|
@@ -119,8 +120,8 @@ class Editable extends Component {
|
|
|
119
120
|
return {
|
|
120
121
|
onMouseOver: _this.handleViewMouseOver,
|
|
121
122
|
onMouseOut: _this.handleViewMouseOut,
|
|
122
|
-
onMouseDown: mode !== 'edit' ? _this.handleViewClick :
|
|
123
|
-
onKeyUp: mode === 'edit' ? _this.handleEditESC :
|
|
123
|
+
onMouseDown: mode !== 'edit' ? _this.handleViewClick : void 0,
|
|
124
|
+
onKeyUp: mode === 'edit' ? _this.handleEditESC : void 0,
|
|
124
125
|
readOnly,
|
|
125
126
|
...props,
|
|
126
127
|
ref: _this.handleContainerRef
|
|
@@ -136,14 +137,15 @@ class Editable extends Component {
|
|
|
136
137
|
};
|
|
137
138
|
};
|
|
138
139
|
|
|
139
|
-
this.getEditorProps =
|
|
140
|
+
this.getEditorProps = function () {
|
|
141
|
+
let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
140
142
|
return {
|
|
141
|
-
mode:
|
|
142
|
-
onBlur:
|
|
143
|
+
mode: _this.props.mode,
|
|
144
|
+
onBlur: _this.handleEditBlur,
|
|
143
145
|
editorRef: el => {
|
|
144
|
-
|
|
146
|
+
_this._editorRef = el;
|
|
145
147
|
},
|
|
146
|
-
readOnly:
|
|
148
|
+
readOnly: _this.props.readOnly,
|
|
147
149
|
...props
|
|
148
150
|
};
|
|
149
151
|
};
|
|
@@ -172,8 +174,6 @@ class Editable extends Component {
|
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
|
|
175
|
-
componentWillUnmount() {}
|
|
176
|
-
|
|
177
177
|
componentDidUpdate(prevProps) {
|
|
178
178
|
const _this$props2 = this.props,
|
|
179
179
|
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
|
@@ -44,6 +44,7 @@ var _props2 = require("./props");
|
|
|
44
44
|
category: components
|
|
45
45
|
experimental: true
|
|
46
46
|
---
|
|
47
|
+
@tsProps
|
|
47
48
|
**/
|
|
48
49
|
class Editable extends _react.Component {
|
|
49
50
|
constructor(_props) {
|
|
@@ -92,23 +93,23 @@ class Editable extends _react.Component {
|
|
|
92
93
|
}
|
|
93
94
|
};
|
|
94
95
|
|
|
95
|
-
this.handleEditBlur =
|
|
96
|
+
this.handleEditBlur = () => {
|
|
96
97
|
this.enterView();
|
|
97
98
|
};
|
|
98
99
|
|
|
99
|
-
this.handleEditButtonFocus =
|
|
100
|
+
this.handleEditButtonFocus = () => {
|
|
100
101
|
this.setState({
|
|
101
102
|
showModeToggle: true
|
|
102
103
|
});
|
|
103
104
|
};
|
|
104
105
|
|
|
105
|
-
this.handleEditButtonBlur =
|
|
106
|
+
this.handleEditButtonBlur = () => {
|
|
106
107
|
this.setState({
|
|
107
108
|
showModeToggle: false
|
|
108
109
|
});
|
|
109
110
|
};
|
|
110
111
|
|
|
111
|
-
this.handleEditButtonClick =
|
|
112
|
+
this.handleEditButtonClick = () => {
|
|
112
113
|
this.enterEdit();
|
|
113
114
|
};
|
|
114
115
|
|
|
@@ -131,8 +132,8 @@ class Editable extends _react.Component {
|
|
|
131
132
|
return {
|
|
132
133
|
onMouseOver: _this.handleViewMouseOver,
|
|
133
134
|
onMouseOut: _this.handleViewMouseOut,
|
|
134
|
-
onMouseDown: mode !== 'edit' ? _this.handleViewClick :
|
|
135
|
-
onKeyUp: mode === 'edit' ? _this.handleEditESC :
|
|
135
|
+
onMouseDown: mode !== 'edit' ? _this.handleViewClick : void 0,
|
|
136
|
+
onKeyUp: mode === 'edit' ? _this.handleEditESC : void 0,
|
|
136
137
|
readOnly,
|
|
137
138
|
...props,
|
|
138
139
|
ref: _this.handleContainerRef
|
|
@@ -148,14 +149,15 @@ class Editable extends _react.Component {
|
|
|
148
149
|
};
|
|
149
150
|
};
|
|
150
151
|
|
|
151
|
-
this.getEditorProps =
|
|
152
|
+
this.getEditorProps = function () {
|
|
153
|
+
let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
152
154
|
return {
|
|
153
|
-
mode:
|
|
154
|
-
onBlur:
|
|
155
|
+
mode: _this.props.mode,
|
|
156
|
+
onBlur: _this.handleEditBlur,
|
|
155
157
|
editorRef: el => {
|
|
156
|
-
|
|
158
|
+
_this._editorRef = el;
|
|
157
159
|
},
|
|
158
|
-
readOnly:
|
|
160
|
+
readOnly: _this.props.readOnly,
|
|
159
161
|
...props
|
|
160
162
|
};
|
|
161
163
|
};
|
|
@@ -184,8 +186,6 @@ class Editable extends _react.Component {
|
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
|
|
187
|
-
componentWillUnmount() {}
|
|
188
|
-
|
|
189
189
|
componentDidUpdate(prevProps) {
|
|
190
190
|
const _this$props2 = this.props,
|
|
191
191
|
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.25.1-snapshot-
|
|
3
|
+
"version": "8.25.1-snapshot-14",
|
|
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.25.1-snapshot-
|
|
27
|
-
"@instructure/ui-test-utils": "8.25.1-snapshot-
|
|
26
|
+
"@instructure/ui-babel-preset": "8.25.1-snapshot-14",
|
|
27
|
+
"@instructure/ui-test-utils": "8.25.1-snapshot-14"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.13.10",
|
|
31
|
-
"@instructure/console": "8.25.1-snapshot-
|
|
32
|
-
"@instructure/emotion": "8.25.1-snapshot-
|
|
33
|
-
"@instructure/ui-a11y-content": "8.25.1-snapshot-
|
|
34
|
-
"@instructure/ui-buttons": "8.25.1-snapshot-
|
|
35
|
-
"@instructure/ui-dom-utils": "8.25.1-snapshot-
|
|
36
|
-
"@instructure/ui-flex": "8.25.1-snapshot-
|
|
37
|
-
"@instructure/ui-focusable": "8.25.1-snapshot-
|
|
38
|
-
"@instructure/ui-icons": "8.25.1-snapshot-
|
|
39
|
-
"@instructure/ui-utils": "8.25.1-snapshot-
|
|
40
|
-
"@instructure/ui-view": "8.25.1-snapshot-
|
|
31
|
+
"@instructure/console": "8.25.1-snapshot-14",
|
|
32
|
+
"@instructure/emotion": "8.25.1-snapshot-14",
|
|
33
|
+
"@instructure/ui-a11y-content": "8.25.1-snapshot-14",
|
|
34
|
+
"@instructure/ui-buttons": "8.25.1-snapshot-14",
|
|
35
|
+
"@instructure/ui-dom-utils": "8.25.1-snapshot-14",
|
|
36
|
+
"@instructure/ui-flex": "8.25.1-snapshot-14",
|
|
37
|
+
"@instructure/ui-focusable": "8.25.1-snapshot-14",
|
|
38
|
+
"@instructure/ui-icons": "8.25.1-snapshot-14",
|
|
39
|
+
"@instructure/ui-utils": "8.25.1-snapshot-14",
|
|
40
|
+
"@instructure/ui-view": "8.25.1-snapshot-14",
|
|
41
41
|
"prop-types": "^15"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|