@pie-element/categorize 9.10.9-next.9 → 9.11.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 +17 -0
- package/controller/CHANGELOG.md +11 -0
- package/controller/package.json +1 -1
- package/lib/categorize/choice.js +53 -16
- package/lib/categorize/choice.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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
|
+
# [9.11.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize@9.10.8...@pie-element/categorize@9.11.0) (2025-03-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **categorize:** remove test as logic was removed regarding small movement on token PD-4866 ([d8619fa](https://github.com/pie-framework/pie-elements/commit/d8619fa9f23a52e3dd6a4cbef1fd123197c1015b))
|
|
12
|
+
* **multiple-choice, categorize, ditb, hotspot, ica:** remove audio events listeners on disconnectedCallback PD-4852 ([35937aa](https://github.com/pie-framework/pie-elements/commit/35937aa5a790e24ead17b95561c368056b5a14f8))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **categorize:** add customAudioButton PD-4795 ([d712cff](https://github.com/pie-framework/pie-elements/commit/d712cff7b3c0c26219768a12f0419a9d3629daf3))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [9.10.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize@9.10.7...@pie-element/categorize@9.10.8) (2025-03-03)
|
|
7
24
|
|
|
8
25
|
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# [7.7.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize-controller@7.6.4...@pie-element/categorize-controller@7.7.0) (2025-03-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **categorize:** add customAudioButton PD-4795 ([d712cff](https://github.com/pie-framework/pie-elements/commit/d712cff7b3c0c26219768a12f0419a9d3629daf3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [7.6.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize-controller@7.6.3...@pie-element/categorize-controller@7.6.4) (2025-03-03)
|
|
7
18
|
|
|
8
19
|
|
package/controller/package.json
CHANGED
package/lib/categorize/choice.js
CHANGED
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.spec = exports["default"] = exports.Layout = exports.ChoiceType = exports.Choice = void 0;
|
|
9
9
|
|
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
+
|
|
10
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
13
|
|
|
12
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -29,6 +31,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
29
31
|
|
|
30
32
|
var _reactDnd = require("react-dnd");
|
|
31
33
|
|
|
34
|
+
var _reactDndHtml5Backend = _interopRequireDefault(require("react-dnd-html5-backend"));
|
|
35
|
+
|
|
32
36
|
var _drag = require("@pie-lib/pie-toolbox/drag");
|
|
33
37
|
|
|
34
38
|
var _Card = _interopRequireDefault(require("@material-ui/core/Card"));
|
|
@@ -151,13 +155,42 @@ var Choice = /*#__PURE__*/function (_React$Component2) {
|
|
|
151
155
|
var _super2 = _createSuper(Choice);
|
|
152
156
|
|
|
153
157
|
function Choice() {
|
|
158
|
+
var _this;
|
|
159
|
+
|
|
154
160
|
(0, _classCallCheck2["default"])(this, Choice);
|
|
155
|
-
|
|
161
|
+
|
|
162
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
163
|
+
args[_key] = arguments[_key];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
_this = _super2.call.apply(_super2, [this].concat(args));
|
|
167
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleTouchStart", function (e) {
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
});
|
|
170
|
+
return _this;
|
|
156
171
|
}
|
|
157
172
|
|
|
158
173
|
(0, _createClass2["default"])(Choice, [{
|
|
174
|
+
key: "componentDidMount",
|
|
175
|
+
value: function componentDidMount() {
|
|
176
|
+
if (this.ref) {
|
|
177
|
+
this.ref.addEventListener('touchstart', this.handleTouchStart, {
|
|
178
|
+
passive: false
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}, {
|
|
183
|
+
key: "componentWillUnmount",
|
|
184
|
+
value: function componentWillUnmount() {
|
|
185
|
+
if (this.ref) {
|
|
186
|
+
this.ref.removeEventListener('touchstart', this.handleTouchStart);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
159
190
|
key: "render",
|
|
160
191
|
value: function render() {
|
|
192
|
+
var _this2 = this;
|
|
193
|
+
|
|
161
194
|
var _this$props2 = this.props,
|
|
162
195
|
connectDragSource = _this$props2.connectDragSource,
|
|
163
196
|
id = _this$props2.id,
|
|
@@ -169,7 +202,11 @@ var Choice = /*#__PURE__*/function (_React$Component2) {
|
|
|
169
202
|
return connectDragSource( /*#__PURE__*/_react["default"].createElement("div", {
|
|
170
203
|
style: _objectSpread({
|
|
171
204
|
margin: '4px'
|
|
172
|
-
}, extraStyle)
|
|
205
|
+
}, extraStyle),
|
|
206
|
+
ref: function ref(_ref) {
|
|
207
|
+
return _this2.ref = _ref;
|
|
208
|
+
},
|
|
209
|
+
draggable: !disabled
|
|
173
210
|
}, /*#__PURE__*/_react["default"].createElement(Styled, {
|
|
174
211
|
id: id,
|
|
175
212
|
content: content,
|
|
@@ -203,25 +240,19 @@ var spec = {
|
|
|
203
240
|
return out;
|
|
204
241
|
},
|
|
205
242
|
endDrag: function endDrag(props, monitor) {
|
|
206
|
-
|
|
243
|
+
if (!monitor.didDrop()) {
|
|
244
|
+
var item = monitor.getItem();
|
|
207
245
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (item.categoryId) {
|
|
213
|
-
log('wasnt droppped - what to do?');
|
|
214
|
-
props.onRemoveChoice(item);
|
|
215
|
-
}
|
|
246
|
+
if (item.categoryId) {
|
|
247
|
+
log('wasnt droppped - what to do?');
|
|
248
|
+
props.onRemoveChoice(item);
|
|
216
249
|
}
|
|
217
|
-
} else {
|
|
218
|
-
log('long press on touch devices, not removing item');
|
|
219
250
|
}
|
|
220
251
|
}
|
|
221
252
|
};
|
|
222
253
|
exports.spec = spec;
|
|
223
|
-
var DraggableChoice = (0, _reactDnd.DragSource)(function (
|
|
224
|
-
var uid =
|
|
254
|
+
var DraggableChoice = (0, _reactDnd.DragSource)(function (_ref2) {
|
|
255
|
+
var uid = _ref2.uid;
|
|
225
256
|
return uid;
|
|
226
257
|
}, spec, function (connect, monitor) {
|
|
227
258
|
return {
|
|
@@ -230,7 +261,13 @@ var DraggableChoice = (0, _reactDnd.DragSource)(function (_ref) {
|
|
|
230
261
|
};
|
|
231
262
|
})(Choice);
|
|
232
263
|
|
|
233
|
-
var
|
|
264
|
+
var DraggableChoiceWithProvider = function DraggableChoiceWithProvider(props) {
|
|
265
|
+
return /*#__PURE__*/_react["default"].createElement(_reactDnd.DndProvider, {
|
|
266
|
+
backend: _reactDndHtml5Backend["default"]
|
|
267
|
+
}, /*#__PURE__*/_react["default"].createElement(DraggableChoice, props));
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
var _default = _drag.uid.withUid(DraggableChoiceWithProvider);
|
|
234
271
|
|
|
235
272
|
exports["default"] = _default;
|
|
236
273
|
//# sourceMappingURL=choice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/categorize/choice.jsx"],"names":["log","ChoiceType","content","PropTypes","string","isRequired","id","Layout","props","classes","className","isDragging","disabled","correct","rootNames","choice","dragging","cardNames","card","root","cardRoot","__html","React","Component","object","bool","styles","theme","direction","cursor","width","border","color","incorrect","borderRadius","text","backgroundColor","white","paddingBottom","spacing","unit","opacity","background","pointerEvents","Styled","Choice","
|
|
1
|
+
{"version":3,"sources":["../../src/categorize/choice.jsx"],"names":["log","ChoiceType","content","PropTypes","string","isRequired","id","Layout","props","classes","className","isDragging","disabled","correct","rootNames","choice","dragging","cardNames","card","root","cardRoot","__html","React","Component","object","bool","styles","theme","direction","cursor","width","border","color","incorrect","borderRadius","text","backgroundColor","white","paddingBottom","spacing","unit","opacity","background","pointerEvents","Styled","Choice","e","preventDefault","ref","addEventListener","handleTouchStart","passive","removeEventListener","connectDragSource","extraStyle","margin","func","spec","canDrag","beginDrag","out","categoryId","choiceIndex","value","itemType","endDrag","monitor","didDrop","item","getItem","onRemoveChoice","DraggableChoice","uid","connect","dragSource","DraggableChoiceWithProvider","HTML5Backend","withUid"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;AAEO,IAAMC,UAAU,GAAG;AACxBC,EAAAA,OAAO,EAAEC,sBAAUC,MAAV,CAAiBC,UADF;AAExBC,EAAAA,EAAE,EAAEH,sBAAUC;AAFU,CAAnB;;;IAKMG,M;;;;;;;;;;;;WASX,kBAAS;AACP,wBAAuE,K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,EAAE,EAAEE,KAAK,CAACF,EADA;AAEVuD,MAAAA,UAAU,EAAErD,KAAK,CAACqD,UAFR;AAGVC,MAAAA,WAAW,EAAEtD,KAAK,CAACsD,WAHT;AAIVC,MAAAA,KAAK,EAAEvD,KAAK,CAACN,OAJH;AAKV8D,MAAAA,QAAQ,EAAE;AALA,KAAZ;AAOAhE,IAAAA,GAAG,CAAC,kBAAD,EAAqB4D,GAArB,CAAH;AACA,WAAOA,GAAP;AACD,GAZiB;AAalBK,EAAAA,OAAO,EAAE,iBAACzD,KAAD,EAAQ0D,OAAR,EAAoB;AACzB,QAAI,CAACA,OAAO,CAACC,OAAR,EAAL,EAAwB;AACtB,UAAMC,IAAI,GAAGF,OAAO,CAACG,OAAR,EAAb;;AACA,UAAID,IAAI,CAACP,UAAT,EAAqB;AACnB7D,QAAAA,GAAG,CAAC,8BAAD,CAAH;AACAQ,QAAAA,KAAK,CAAC8D,cAAN,CAAqBF,IAArB;AACD;AACF;AACF;AArBe,CAAb;;AAwBP,IAAMG,eAAe,GAAG,0BACtB;AAAA,MAAGC,GAAH,SAAGA,GAAH;AAAA,SAAaA,GAAb;AAAA,CADsB,EAEtBf,IAFsB,EAGtB,UAACgB,OAAD,EAAUP,OAAV;AAAA,SAAuB;AACrBb,IAAAA,iBAAiB,EAAEoB,OAAO,CAACC,UAAR,EADE;AAErB/D,IAAAA,UAAU,EAAEuD,OAAO,CAACvD,UAAR;AAFS,GAAvB;AAAA,CAHsB,EAOtBkC,MAPsB,CAAxB;;AASA,IAAM8B,2BAA2B,GAAG,SAA9BA,2BAA8B,CAACnE,KAAD;AAAA,sBAChC,gCAAC,qBAAD;AAAa,IAAA,OAAO,EAAEoE;AAAtB,kBACE,gCAAC,eAAD,EAAqBpE,KAArB,CADF,CADgC;AAAA,CAApC;;eAMegE,UAAIK,OAAJ,CAAYF,2BAAZ,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { DragSource, DndProvider } from 'react-dnd';\nimport HTML5Backend from 'react-dnd-html5-backend';\nimport { uid } from '@pie-lib/pie-toolbox/drag';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport { color } from '@pie-lib/pie-toolbox/render-ui';\nimport debug from 'debug';\n\nconst log = debug('@pie-ui:categorize:choice');\n\nexport const ChoiceType = {\n content: PropTypes.string.isRequired,\n id: PropTypes.string,\n};\n\nexport class Layout extends React.Component {\n static propTypes = {\n ...ChoiceType,\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n correct: PropTypes.bool,\n };\n static defaultProps = {};\n render() {\n const { classes, className, content, isDragging, disabled, correct } = this.props;\n\n const rootNames = classNames(\n correct === true && 'correct',\n correct === false && 'incorrect',\n classes.choice,\n isDragging && classes.dragging,\n disabled && classes.disabled,\n className,\n );\n const cardNames = classNames(classes.card);\n return (\n <div className={rootNames}>\n <Card className={cardNames}>\n <CardContent classes={{ root: classes.cardRoot }} dangerouslySetInnerHTML={{ __html: content }} />\n </Card>\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n choice: {\n direction: 'initial',\n cursor: 'pointer',\n width: '100%',\n '&.correct': {\n border: `solid 2px ${color.correct()}`,\n },\n '&.incorrect': {\n border: `solid 2px ${color.incorrect()}`,\n },\n borderRadius: '6px',\n },\n cardRoot: {\n color: color.text(),\n backgroundColor: color.white(),\n '&:last-child': {\n paddingBottom: theme.spacing.unit * 2,\n },\n borderRadius: '4px',\n border: '1px solid',\n },\n disabled: {\n cursor: 'not-allowed',\n opacity: '0.6',\n },\n dragging: {\n cursor: 'move',\n },\n card: {\n color: color.text(),\n backgroundColor: color.background(),\n width: '100%',\n // Added for touch devices, for image content.\n // This will prevent the context menu from appearing and not allowing other interactions with the image.\n pointerEvents: 'none',\n },\n});\n\nconst Styled = withStyles(styles)(Layout);\n\nexport class Choice extends React.Component {\n static propTypes = {\n ...ChoiceType,\n extraStyle: PropTypes.object,\n connectDragSource: PropTypes.func.isRequired,\n };\n\n componentDidMount() {\n if (this.ref) {\n this.ref.addEventListener('touchstart', this.handleTouchStart, { passive: false });\n }\n }\n\n componentWillUnmount() {\n if (this.ref) {\n this.ref.removeEventListener('touchstart', this.handleTouchStart);\n }\n }\n\n handleTouchStart = (e) => {\n e.preventDefault();\n };\n\n render() {\n const { connectDragSource, id, content, disabled, isDragging, correct, extraStyle } = this.props;\n\n return connectDragSource(\n <div\n style={{ margin: '4px', ...extraStyle }}\n ref={(ref) => (this.ref = ref)}\n draggable={!disabled}\n >\n <Styled id={id} content={content} disabled={disabled} correct={correct} isDragging={isDragging} />\n </div>,\n );\n }\n}\n\nexport const spec = {\n canDrag: (props) => !props.disabled,\n beginDrag: (props) => {\n const out = {\n id: props.id,\n categoryId: props.categoryId,\n choiceIndex: props.choiceIndex,\n value: props.content,\n itemType: 'categorize'\n };\n log('[beginDrag] out:', out);\n return out;\n },\n endDrag: (props, monitor) => {\n if (!monitor.didDrop()) {\n const item = monitor.getItem();\n if (item.categoryId) {\n log('wasnt droppped - what to do?');\n props.onRemoveChoice(item);\n }\n }\n }\n};\n\nconst DraggableChoice = DragSource(\n ({ uid }) => uid,\n spec,\n (connect, monitor) => ({\n connectDragSource: connect.dragSource(),\n isDragging: monitor.isDragging(),\n }),\n)(Choice);\n\nconst DraggableChoiceWithProvider = (props) => (\n <DndProvider backend={HTML5Backend}>\n <DraggableChoice {...props} />\n </DndProvider>\n);\n\nexport default uid.withUid(DraggableChoiceWithProvider);"],"file":"choice.js"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "9.
|
|
7
|
+
"version": "9.11.0",
|
|
8
8
|
"description": "",
|
|
9
9
|
"author": "pie framework developers",
|
|
10
10
|
"license": "ISC",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"react-dnd": "^14.0.5",
|
|
21
21
|
"react-dom": "^16.8.1"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "2624c38405c9aeb903d5420667e085cd69c79e20",
|
|
24
24
|
"scripts": {
|
|
25
25
|
"postpublish": "../../scripts/postpublish"
|
|
26
26
|
},
|