@elice/material-quiz 1.240712.0 → 1.240715.0-touch.1
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/cjs/components/eb-sortable/EbDraggable.d.ts +1 -12
- package/cjs/components/eb-sortable/EbDraggable.js +26 -91
- package/cjs/components/eb-sortable/EbDroppable.d.ts +3 -8
- package/cjs/components/eb-sortable/EbDroppable.js +18 -37
- package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +2 -1
- package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +204 -121
- package/cjs/components/material-quiz/MaterialQuizSelectOne.js +2 -1
- package/cjs/components/material-quiz/QuizResultBadge.js +10 -2
- package/cjs/components/material-quiz/QuizSubmitStatusText.js +6 -1
- package/cjs/components/material-quiz/constants/color.d.ts +5 -0
- package/cjs/components/material-quiz/constants/color.js +15 -0
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +34 -11
- package/cjs/components/shared/QuestionBox.js +11 -5
- package/cjs/components/shared/QuizDraggbleDroppedOption.d.ts +1 -1
- package/cjs/components/shared/QuizDraggbleDroppedOption.js +23 -3
- package/cjs/components/shared/QuizDraggbleDummyOption.d.ts +1 -3
- package/cjs/components/shared/QuizDraggbleDummyOption.js +8 -3
- package/cjs/components/shared/QuizDraggbleOption.d.ts +0 -1
- package/cjs/components/shared/QuizDraggbleOption.js +9 -2
- package/cjs/components/shared/question-radio/QuestionRadioOption.js +3 -2
- package/cjs/components/shared/utils/getQuestionStatusStyle.js +3 -2
- package/es/components/eb-sortable/EbDraggable.d.ts +1 -12
- package/es/components/eb-sortable/EbDraggable.js +26 -91
- package/es/components/eb-sortable/EbDroppable.d.ts +3 -8
- package/es/components/eb-sortable/EbDroppable.js +18 -37
- package/es/components/material-quiz/MaterialQuizSelectMultiple.js +2 -1
- package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +204 -121
- package/es/components/material-quiz/MaterialQuizSelectOne.js +2 -1
- package/es/components/material-quiz/QuizResultBadge.js +10 -2
- package/es/components/material-quiz/QuizSubmitStatusText.js +6 -1
- package/es/components/material-quiz/constants/color.d.ts +5 -0
- package/es/components/material-quiz/constants/color.js +9 -0
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +34 -11
- package/es/components/shared/QuestionBox.js +12 -6
- package/es/components/shared/QuizDraggbleDroppedOption.d.ts +1 -1
- package/es/components/shared/QuizDraggbleDroppedOption.js +23 -3
- package/es/components/shared/QuizDraggbleDummyOption.d.ts +1 -3
- package/es/components/shared/QuizDraggbleDummyOption.js +8 -3
- package/es/components/shared/QuizDraggbleOption.d.ts +0 -1
- package/es/components/shared/QuizDraggbleOption.js +9 -2
- package/es/components/shared/question-radio/QuestionRadioOption.js +3 -2
- package/es/components/shared/utils/getQuestionStatusStyle.js +3 -2
- package/package.json +6 -4
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
/// <reference types="jquery" />
|
|
2
|
-
/// <reference types="jquery" />
|
|
3
|
-
/// <reference types="jqueryui" />
|
|
4
1
|
import React from 'react';
|
|
5
|
-
import 'jquery-ui/ui/widgets/draggable';
|
|
6
2
|
interface EbDraggableProps {
|
|
7
|
-
id
|
|
3
|
+
id: string;
|
|
8
4
|
className?: string;
|
|
9
|
-
connectWith?: JQuery.Selector;
|
|
10
5
|
disabled?: boolean;
|
|
11
|
-
revert?: boolean;
|
|
12
|
-
clone?: boolean;
|
|
13
|
-
onStart?: (event: JQueryEventObject, ui: JQueryUI.DraggableEventUIParams) => void;
|
|
14
|
-
onStop?: (event: JQueryEventObject, ui: JQueryUI.DraggableEventUIParams) => void;
|
|
15
|
-
onDrag?: (event: JQueryEventObject, ui: JQueryUI.DraggableEventUIParams) => void;
|
|
16
|
-
onCreate?: (event: JQueryEventObject, ui: JQueryUI.DraggableEventUIParams) => void;
|
|
17
6
|
}
|
|
18
7
|
declare const EbDraggable: React.FC<EbDraggableProps>;
|
|
19
8
|
export default EbDraggable;
|
|
@@ -3,104 +3,39 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
7
|
-
require('
|
|
6
|
+
var core = require('@dnd-kit/core');
|
|
7
|
+
var utilities = require('@dnd-kit/utilities');
|
|
8
8
|
|
|
9
|
+
//
|
|
10
|
+
//
|
|
11
|
+
//
|
|
9
12
|
const EbDraggable = ({
|
|
10
13
|
children,
|
|
11
14
|
id,
|
|
12
|
-
disabled = false,
|
|
13
|
-
revert = true,
|
|
14
|
-
clone = false,
|
|
15
15
|
className,
|
|
16
|
-
|
|
17
|
-
onStop,
|
|
18
|
-
onDrag,
|
|
19
|
-
onCreate
|
|
16
|
+
disabled = false
|
|
20
17
|
}) => {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, [onStop]);
|
|
40
|
-
const onDragCallback = React.useCallback((event, ui) => {
|
|
41
|
-
if (onDrag) {
|
|
42
|
-
return onDrag(event, ui);
|
|
43
|
-
} else {
|
|
44
|
-
return () => {
|
|
45
|
-
return;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}, [onDrag]);
|
|
49
|
-
const onCreateCallback = React.useCallback((event, ui) => {
|
|
50
|
-
if (onCreate) {
|
|
51
|
-
return onCreate(event, ui);
|
|
52
|
-
} else {
|
|
53
|
-
return () => {
|
|
54
|
-
return;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}, [onCreate]);
|
|
58
|
-
React.useEffect(() => {
|
|
59
|
-
if (!rootEl.current) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const draggableEl = $(rootEl.current);
|
|
63
|
-
draggableEl.draggable(Object.assign(Object.assign(Object.assign(Object.assign({}, disabled ? {
|
|
64
|
-
disabled
|
|
65
|
-
} : null), revert ? {
|
|
66
|
-
revert
|
|
67
|
-
} : null), clone ? {
|
|
68
|
-
helper: 'clone'
|
|
69
|
-
} : null), {
|
|
70
|
-
zIndex: 200,
|
|
71
|
-
revertDuration: 0,
|
|
72
|
-
start: (event, ui) => {
|
|
73
|
-
if (!onStartCallback) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
onStartCallback(event, ui);
|
|
77
|
-
},
|
|
78
|
-
stop: (event, ui) => {
|
|
79
|
-
if (!onStopCallback) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
// draggableEl.draggable('cancel');
|
|
83
|
-
onStopCallback(event, ui);
|
|
84
|
-
},
|
|
85
|
-
drag: (event, ui) => {
|
|
86
|
-
onDragCallback(event, ui);
|
|
87
|
-
},
|
|
88
|
-
create: (event, ui) => {
|
|
89
|
-
onCreateCallback(event, ui);
|
|
90
|
-
}
|
|
91
|
-
}));
|
|
92
|
-
return () => {
|
|
93
|
-
draggableEl.draggable('destroy');
|
|
94
|
-
};
|
|
95
|
-
}, [clone, disabled, onCreateCallback, onDragCallback, onStartCallback, onStopCallback, revert]);
|
|
96
|
-
return React.createElement("div", {
|
|
97
|
-
ref: rootEl,
|
|
98
|
-
id: id,
|
|
18
|
+
const {
|
|
19
|
+
attributes,
|
|
20
|
+
listeners,
|
|
21
|
+
setNodeRef,
|
|
22
|
+
transform
|
|
23
|
+
} = core.useDraggable({
|
|
24
|
+
id,
|
|
25
|
+
disabled
|
|
26
|
+
});
|
|
27
|
+
const style = {
|
|
28
|
+
transform: utilities.CSS.Translate.toString(transform),
|
|
29
|
+
cursor: disabled ? 'auto' : 'move'
|
|
30
|
+
};
|
|
31
|
+
//
|
|
32
|
+
//
|
|
33
|
+
//
|
|
34
|
+
return React.createElement("div", Object.assign({
|
|
35
|
+
ref: setNodeRef,
|
|
99
36
|
className: className,
|
|
100
|
-
style:
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
}, children);
|
|
37
|
+
style: style
|
|
38
|
+
}, listeners, attributes), children);
|
|
104
39
|
};
|
|
105
40
|
|
|
106
41
|
exports.default = EbDraggable;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
/// <reference types="jquery" />
|
|
2
|
-
/// <reference types="jquery" />
|
|
3
|
-
/// <reference types="jqueryui" />
|
|
4
1
|
import React from 'react';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
id?: string;
|
|
2
|
+
interface EbDroppableProps {
|
|
3
|
+
id: string;
|
|
8
4
|
className?: string;
|
|
9
5
|
disabled?: boolean;
|
|
10
|
-
accept?:
|
|
11
|
-
onDrop?: (event: JQueryEventObject, ui: JQueryUI.DroppableEventUIParam) => void;
|
|
6
|
+
accept?: string;
|
|
12
7
|
}
|
|
13
8
|
declare const EbDroppable: React.FC<EbDroppableProps>;
|
|
14
9
|
export default EbDroppable;
|
|
@@ -3,51 +3,32 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
7
|
-
require('jquery-ui/ui/widgets/droppable');
|
|
6
|
+
var core = require('@dnd-kit/core');
|
|
8
7
|
|
|
8
|
+
//
|
|
9
|
+
//
|
|
10
|
+
//
|
|
9
11
|
const EbDroppable = ({
|
|
10
12
|
children,
|
|
11
13
|
id,
|
|
12
|
-
disabled = false,
|
|
13
|
-
accept,
|
|
14
14
|
className,
|
|
15
|
-
|
|
15
|
+
disabled = false,
|
|
16
|
+
accept
|
|
16
17
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}, [onDrop]);
|
|
27
|
-
React.useEffect(() => {
|
|
28
|
-
if (!rootEl.current) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const draggableEl = $(rootEl.current);
|
|
32
|
-
draggableEl.droppable(Object.assign(Object.assign(Object.assign({}, disabled ? {
|
|
33
|
-
disabled
|
|
34
|
-
} : null), accept ? {
|
|
18
|
+
const {
|
|
19
|
+
setNodeRef
|
|
20
|
+
} = core.useDroppable({
|
|
21
|
+
id,
|
|
22
|
+
disabled,
|
|
23
|
+
data: {
|
|
35
24
|
accept
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
onDropCallback(event, ui);
|
|
42
|
-
}
|
|
43
|
-
}));
|
|
44
|
-
return () => {
|
|
45
|
-
draggableEl.droppable('destroy');
|
|
46
|
-
};
|
|
47
|
-
}, [accept, disabled, onDropCallback]);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//
|
|
28
|
+
//
|
|
29
|
+
//
|
|
48
30
|
return React.createElement("div", {
|
|
49
|
-
ref:
|
|
50
|
-
id: id,
|
|
31
|
+
ref: setNodeRef,
|
|
51
32
|
className: className
|
|
52
33
|
}, children);
|
|
53
34
|
};
|
|
@@ -10,8 +10,9 @@ var material = require('@mui/material');
|
|
|
10
10
|
var element = require('../../constant/element.js');
|
|
11
11
|
var index = require('../../helpers/index.js');
|
|
12
12
|
var useCaculatePassage = require('../../hooks/useCaculatePassage.js');
|
|
13
|
-
require('../shared/
|
|
13
|
+
require('../shared/QuizDraggbleDroppedOption.js');
|
|
14
14
|
require('../shared/QuizDraggbleDummyOption.js');
|
|
15
|
+
require('../shared/QuizDraggbleOption.js');
|
|
15
16
|
require('../shared/question-radio/QuestionRadio.js');
|
|
16
17
|
require('../shared/question-radio/QuestionRadioOption.js');
|
|
17
18
|
var QuestionCheckbox = require('../shared/question-checkbox/QuestionCheckbox.js');
|