@pie-element/categorize 9.10.7-next.8 → 9.10.8-next.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 CHANGED
@@ -3,6 +3,19 @@
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.10.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize@9.10.6...@pie-element/categorize@9.10.7) (2025-02-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update pie-lib/pie-toolbox PD-4820, PD-4766 ([7ccdb40](https://github.com/pie-framework/pie-elements/commit/7ccdb405614f1c310efe530d97c46fe324c0a669))
12
+ * **categorize:** fix tests PD-4763 ([2a88abb](https://github.com/pie-framework/pie-elements/commit/2a88abb1f62072af281d60060818d13aa3d1ed64))
13
+ * **categorize:** on touch devices on long press do not remove choice PD-4763 ([126c19a](https://github.com/pie-framework/pie-elements/commit/126c19a6e384e29367532e842e5bdcb23890413c))
14
+
15
+
16
+
17
+
18
+
6
19
  ## [9.10.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize@9.10.5...@pie-element/categorize@9.10.6) (2025-02-25)
7
20
 
8
21
  **Note:** Version bump only for package @pie-element/categorize
@@ -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
+ ## [8.4.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize-configure@8.4.4...@pie-element/categorize-configure@8.4.5) (2025-02-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update pie-lib/pie-toolbox PD-4820, PD-4766 ([7ccdb40](https://github.com/pie-framework/pie-elements/commit/7ccdb405614f1c310efe530d97c46fe324c0a669))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [8.4.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize-configure@8.4.3...@pie-element/categorize-configure@8.4.4) (2025-02-19)
7
18
 
8
19
 
@@ -3,7 +3,7 @@
3
3
  "private": true,
4
4
  "main": "lib/index.js",
5
5
  "module": "src/index.js",
6
- "version": "8.4.4",
6
+ "version": "8.4.5",
7
7
  "description": "",
8
8
  "scripts": {},
9
9
  "author": "pie framework developers",
@@ -12,7 +12,7 @@
12
12
  "@material-ui/core": "^3.9.2",
13
13
  "@material-ui/icons": "^3.0.1",
14
14
  "@pie-framework/pie-configure-events": "^1.3.0",
15
- "@pie-lib/pie-toolbox": "2.9.3",
15
+ "@pie-lib/pie-toolbox": "2.9.5",
16
16
  "classnames": "^2.2.5",
17
17
  "debug": "^3.1.0",
18
18
  "lodash": "^4.17.15",
@@ -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.6.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize-controller@7.6.2...@pie-element/categorize-controller@7.6.3) (2025-02-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update pie-lib/pie-toolbox PD-4820, PD-4766 ([7ccdb40](https://github.com/pie-framework/pie-elements/commit/7ccdb405614f1c310efe530d97c46fe324c0a669))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [7.6.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize-controller@7.6.1...@pie-element/categorize-controller@7.6.2) (2025-02-19)
7
18
 
8
19
 
@@ -2,10 +2,10 @@
2
2
  "name": "@pie-element/categorize-controller",
3
3
  "private": true,
4
4
  "dependencies": {
5
- "@pie-lib/pie-toolbox": "2.9.3",
5
+ "@pie-lib/pie-toolbox": "2.9.5",
6
6
  "lodash": "^4.17.15"
7
7
  },
8
- "version": "7.6.2",
8
+ "version": "7.6.3",
9
9
  "description": "",
10
10
  "scripts": {},
11
11
  "main": "lib/index.js",
@@ -203,13 +203,19 @@ var spec = {
203
203
  return out;
204
204
  },
205
205
  endDrag: function endDrag(props, monitor) {
206
- if (!monitor.didDrop()) {
207
- var item = monitor.getItem();
206
+ var delta = monitor.getDifferenceFromInitialOffset();
208
207
 
209
- if (item.categoryId) {
210
- log('wasnt droppped - what to do?');
211
- props.onRemoveChoice(item);
208
+ if (delta && (Math.abs(delta.x) > 5 || Math.abs(delta.y) > 5)) {
209
+ if (!monitor.didDrop()) {
210
+ var item = monitor.getItem();
211
+
212
+ if (item.categoryId) {
213
+ log('wasnt droppped - what to do?');
214
+ props.onRemoveChoice(item);
215
+ }
212
216
  }
217
+ } else {
218
+ log('long press on touch devices, not removing item');
213
219
  }
214
220
  }
215
221
  };
@@ -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","connectDragSource","extraStyle","margin","func","spec","canDrag","beginDrag","out","categoryId","choiceIndex","value","itemType","endDrag","monitor","didDrop","item","getItem","onRemoveChoice","DraggableChoice","uid","connect","dragSource","withUid"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;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,KAAKC,KAA5E;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,UAAiBC,SAAjB,eAAiBA,SAAjB;AAAA,UAA4BR,OAA5B,eAA4BA,OAA5B;A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AAMG,eAAe,GAAG,0BACtB;AAAA,MAAGC,GAAH,QAAGA,GAAH;AAAA,SAAaA,GAAb;AAAA,CADsB,EAEtBf,IAFsB,EAGtB,UAACgB,OAAD,EAAUP,OAAV;AAAA,SAAuB;AACrBb,IAAAA,iBAAiB,EAAEoB,OAAO,CAACC,UAAR,EADE;AAErBxD,IAAAA,UAAU,EAAEgD,OAAO,CAAChD,UAAR;AAFS,GAAvB;AAAA,CAHsB,EAOtBkC,MAPsB,CAAxB;;eASeoB,UAAIG,OAAJ,CAAYJ,eAAZ,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { DragSource } from 'react-dnd';\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 render() {\n const { connectDragSource, id, content, disabled, isDragging, correct, extraStyle } = this.props;\n\n return connectDragSource(\n <div style={{ margin: '4px', ...extraStyle }}>\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\nexport default uid.withUid(DraggableChoice);\n"],"file":"choice.js"}
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","connectDragSource","extraStyle","margin","func","spec","canDrag","beginDrag","out","categoryId","choiceIndex","value","itemType","endDrag","monitor","delta","getDifferenceFromInitialOffset","Math","abs","x","y","didDrop","item","getItem","onRemoveChoice","DraggableChoice","uid","connect","dragSource","withUid"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;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,KAAKC,KAA5E;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,UAAiBC,SAAjB,eAAiBA,SAAjB;AAAA,UAA4BR,OAA5B,eAA4BA,OAA5B;AAAA,UAAqCS,UAArC,eAAqCA,UAArC;AAAA,UAAiDC,QAAjD,eAAiDA,QAAjD;AAAA,UAA2DC,OAA3D,eAA2DA,OAA3D;AAEA,UAAMC,SAAS,GAAG,4BAChBD,OAAO,KAAK,IAAZ,IAAoB,SADJ,EAEhBA,OAAO,KAAK,KAAZ,IAAqB,WAFL,EAGhBJ,OAAO,CAACM,MAHQ,EAIhBJ,UAAU,IAAIF,OAAO,CAACO,QAJN,EAKhBJ,QAAQ,IAAIH,OAAO,CAACG,QALJ,EAMhBF,SANgB,CAAlB;AAQA,UAAMO,SAAS,GAAG,4BAAWR,OAAO,CAACS,IAAnB,CAAlB;AACA,0BACE;AAAK,QAAA,SAAS,EAAEJ;AAAhB,sBACE,gCAAC,gBAAD;AAAM,QAAA,SAAS,EAAEG;AAAjB,sBACE,gCAAC,uBAAD;AAAa,QAAA,OAAO,EAAE;AAAEE,UAAAA,IAAI,EAA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CAAxB;;eASe0B,UAAIG,OAAJ,CAAYJ,eAAZ,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { DragSource } from 'react-dnd';\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 render() {\n const { connectDragSource, id, content, disabled, isDragging, correct, extraStyle } = this.props;\n\n return connectDragSource(\n <div style={{ margin: '4px', ...extraStyle }}>\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 const delta = monitor.getDifferenceFromInitialOffset();\n if (delta && (Math.abs(delta.x) > 5 || Math.abs(delta.y) > 5)) {\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 } else {\n log('long press on touch devices, not removing item');\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\nexport default uid.withUid(DraggableChoice);\n"],"file":"choice.js"}
package/package.json CHANGED
@@ -4,14 +4,14 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "9.10.7-next.8+2a06fe9b9",
7
+ "version": "9.10.8-next.0+8c6e2183d",
8
8
  "description": "",
9
9
  "author": "pie framework developers",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@material-ui/core": "^3.9.2",
13
13
  "@pie-framework/pie-player-events": "^0.1.0",
14
- "@pie-lib/pie-toolbox": "2.9.3",
14
+ "@pie-lib/pie-toolbox": "2.9.5",
15
15
  "classnames": "^2.2.5",
16
16
  "debug": "^4.1.1",
17
17
  "lodash": "^4.17.15",
@@ -20,7 +20,7 @@
20
20
  "react-dnd": "^14.0.5",
21
21
  "react-dom": "^16.8.1"
22
22
  },
23
- "gitHead": "2a06fe9b9fa39f6916a0ad3eb41cb668d580b88e",
23
+ "gitHead": "8c6e2183d3f8e9cd80c59ea408629a79ad31b46c",
24
24
  "scripts": {
25
25
  "postpublish": "../../scripts/postpublish"
26
26
  },