eli-video-interview 1.2.36-beta.0 → 1.2.36-beta.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/esm/modules/ai-template/components/QuestionList/Item.js +10 -11
- package/esm/modules/ai-template/components/QuestionList/index.js +1 -1
- package/esm/modules/ai-template/components/QuestionList/interface.d.ts +1 -0
- package/lib/modules/ai-template/components/QuestionList/Item.js +10 -11
- package/lib/modules/ai-template/components/QuestionList/index.js +1 -1
- package/lib/modules/ai-template/components/QuestionList/interface.d.ts +1 -0
- package/package.json +1 -1
|
@@ -14,11 +14,11 @@ import { useAiTemplateStore } from "../../../../store/ai-template/global-store";
|
|
|
14
14
|
import { Box, Checkbox, Chip, styled, Typography } from 'fbm-ui';
|
|
15
15
|
import { useCallback, useEffect, useState } from 'react';
|
|
16
16
|
var QuestionItem = function (_a) {
|
|
17
|
-
var item = _a.item, index = _a.index, onChange = _a.onChange;
|
|
18
|
-
var name = item.name, desc = item.desc, category = item.category, weight = item.weight, originToken = item.originToken
|
|
19
|
-
var
|
|
17
|
+
var item = _a.item, index = _a.index, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange;
|
|
18
|
+
var name = item.name, desc = item.desc, category = item.category, weight = item.weight, originToken = item.originToken;
|
|
19
|
+
var _c = useAiTemplateStore(function (store) { return [store.currentSteps]; }), currentSteps = _c.currentSteps, currentCheckedQuestions = _c.currentCheckedQuestions;
|
|
20
20
|
var isUsed = currentSteps === null || currentSteps === void 0 ? void 0 : currentSteps.find(function (step) { return step.originToken === originToken; });
|
|
21
|
-
var
|
|
21
|
+
var _d = useState(checked), curChecked = _d[0], setChecked = _d[1];
|
|
22
22
|
var UsedTag = styled(Box)(function () { return ({
|
|
23
23
|
position: 'absolute',
|
|
24
24
|
right: -1,
|
|
@@ -33,16 +33,15 @@ var QuestionItem = function (_a) {
|
|
|
33
33
|
fontSize: 12,
|
|
34
34
|
lineHeight: '24px',
|
|
35
35
|
}); });
|
|
36
|
+
console.log('curChecked info:', item.token, index, curChecked, currentCheckedQuestions);
|
|
37
|
+
console.log('currentSteps: ', currentSteps);
|
|
36
38
|
var handleChange = useCallback(function (e) {
|
|
39
|
+
setChecked(e.target.checked);
|
|
37
40
|
onChange === null || onChange === void 0 ? void 0 : onChange(e, index);
|
|
38
41
|
}, [index, onChange]);
|
|
39
42
|
useEffect(function () {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var isChecked = (currentCheckedQuestions === null || currentCheckedQuestions === void 0 ? void 0 : currentCheckedQuestions.findIndex(function (step) { return step.token === token; })) > -1;
|
|
44
|
-
setChecked(isChecked);
|
|
45
|
-
}, [currentCheckedQuestions, token, setChecked]);
|
|
46
|
-
return (_jsxs(Box, __assign({ border: '1px solid rgba(0,0,0, 0.08)', borderRadius: "6px", mt: 2 }, { children: [_jsxs(Box, __assign({ borderBottom: "1px solid rgba(0,0,0, 0.08)", p: 2, display: "flex", alignItems: "center" }, { children: [_jsx(Checkbox, { checked: checked, value: originToken, onChange: handleChange }), _jsxs(Box, __assign({ ml: -1 }, { children: [_jsxs(Typography, __assign({ variant: "body1", weight: "500" }, { children: [index + 1, ".", name] })), _jsx(Typography, __assign({ variant: "body2", color: "secondary", mt: 1 }, { children: desc }))] })), isUsed && (_jsx(UsedTag, { children: _jsx("span", { children: "\u5DF2\u4F7F\u7528" }) }))] })), _jsx(Box, __assign({ display: "flex", justifyContent: "space-between", padding: "8px 8px 8px 50px" }, { children: _jsxs(Box, __assign({ display: "flex", alignItems: "center" }, { children: [category === null || category === void 0 ? void 0 : category.map(function (label) { return (_jsx(Chip, { color: "default", label: label }, label)); }), _jsxs(Typography, __assign({ variant: "body2", ml: 2 }, { children: ["\u6743\u91CD\u5360\u6BD4\uFF1A", weight, "%"] }))] })) }))] })));
|
|
43
|
+
setChecked(checked);
|
|
44
|
+
}, [checked]);
|
|
45
|
+
return (_jsxs(Box, __assign({ border: '1px solid rgba(0,0,0, 0.08)', borderRadius: "6px", mt: 2 }, { children: [_jsxs(Box, __assign({ borderBottom: "1px solid rgba(0,0,0, 0.08)", p: 2, display: "flex", alignItems: "center" }, { children: [_jsx(Checkbox, { checked: curChecked, value: originToken, onChange: handleChange }), _jsxs(Box, __assign({ ml: -1 }, { children: [_jsxs(Typography, __assign({ variant: "body1", weight: "500" }, { children: [index + 1, ".", name] })), _jsx(Typography, __assign({ variant: "body2", color: "secondary", mt: 1 }, { children: desc }))] })), isUsed && (_jsx(UsedTag, { children: _jsx("span", { children: "\u5DF2\u4F7F\u7528" }) }))] })), _jsx(Box, __assign({ display: "flex", justifyContent: "space-between", padding: "8px 8px 8px 50px" }, { children: _jsxs(Box, __assign({ display: "flex", alignItems: "center" }, { children: [category === null || category === void 0 ? void 0 : category.map(function (label) { return (_jsx(Chip, { color: "default", label: label }, label)); }), _jsxs(Typography, __assign({ variant: "body2", ml: 2 }, { children: ["\u6743\u91CD\u5360\u6BD4\uFF1A", weight, "%"] }))] })) }))] })));
|
|
47
46
|
};
|
|
48
47
|
export default QuestionItem;
|
|
@@ -35,6 +35,6 @@ var QuestionList = function (_a) {
|
|
|
35
35
|
? __spreadArray(__spreadArray(__spreadArray([], checkedQuestionList.slice(0, index), true), [item], false), checkedQuestionList.slice(index + 1), true) : __spreadArray(__spreadArray([], checkedQuestionList.slice(0, index), true), checkedQuestionList.slice(index + 1), true);
|
|
36
36
|
onCheckChange(RescheckedQuestionList);
|
|
37
37
|
}, [previewItem, onCheckChange, checkedQuestionList]);
|
|
38
|
-
return (_jsxs(Box, __assign({ display: "flex", flexDirection: "column", mt: 3, width: "760px" }, { children: [_jsx(Box, __assign({ display: "flex", alignItems: "center" }, { children: _jsx(Typography, __assign({ variant: "body1", weight: "500" }, { children: "\u9898\u76EE\u5217\u8868" })) })), _jsx(Box, { children: previewItem === null || previewItem === void 0 ? void 0 : previewItem.list.map(function (item, index) { return (_jsx(QuestionItem, { item: item, index: index, onChange: handleChange }, item.token)); }) })] })));
|
|
38
|
+
return (_jsxs(Box, __assign({ display: "flex", flexDirection: "column", mt: 3, width: "760px" }, { children: [_jsx(Box, __assign({ display: "flex", alignItems: "center" }, { children: _jsx(Typography, __assign({ variant: "body1", weight: "500" }, { children: "\u9898\u76EE\u5217\u8868" })) })), _jsx(Box, { children: previewItem === null || previewItem === void 0 ? void 0 : previewItem.list.map(function (item, index) { return (_jsx(QuestionItem, { checked: (checkedQuestionList === null || checkedQuestionList === void 0 ? void 0 : checkedQuestionList.findIndex(function (v) { return v.originToken === item.originToken; })) > -1, item: item, index: index, onChange: handleChange }, item.token)); }) })] })));
|
|
39
39
|
};
|
|
40
40
|
export default QuestionList;
|
|
@@ -16,11 +16,11 @@ var global_store_1 = require("../../../../store/ai-template/global-store");
|
|
|
16
16
|
var fbm_ui_1 = require("fbm-ui");
|
|
17
17
|
var react_1 = require("react");
|
|
18
18
|
var QuestionItem = function (_a) {
|
|
19
|
-
var item = _a.item, index = _a.index, onChange = _a.onChange;
|
|
20
|
-
var name = item.name, desc = item.desc, category = item.category, weight = item.weight, originToken = item.originToken
|
|
21
|
-
var
|
|
19
|
+
var item = _a.item, index = _a.index, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange;
|
|
20
|
+
var name = item.name, desc = item.desc, category = item.category, weight = item.weight, originToken = item.originToken;
|
|
21
|
+
var _c = (0, global_store_1.useAiTemplateStore)(function (store) { return [store.currentSteps]; }), currentSteps = _c.currentSteps, currentCheckedQuestions = _c.currentCheckedQuestions;
|
|
22
22
|
var isUsed = currentSteps === null || currentSteps === void 0 ? void 0 : currentSteps.find(function (step) { return step.originToken === originToken; });
|
|
23
|
-
var
|
|
23
|
+
var _d = (0, react_1.useState)(checked), curChecked = _d[0], setChecked = _d[1];
|
|
24
24
|
var UsedTag = (0, fbm_ui_1.styled)(fbm_ui_1.Box)(function () { return ({
|
|
25
25
|
position: 'absolute',
|
|
26
26
|
right: -1,
|
|
@@ -35,16 +35,15 @@ var QuestionItem = function (_a) {
|
|
|
35
35
|
fontSize: 12,
|
|
36
36
|
lineHeight: '24px',
|
|
37
37
|
}); });
|
|
38
|
+
console.log('curChecked info:', item.token, index, curChecked, currentCheckedQuestions);
|
|
39
|
+
console.log('currentSteps: ', currentSteps);
|
|
38
40
|
var handleChange = (0, react_1.useCallback)(function (e) {
|
|
41
|
+
setChecked(e.target.checked);
|
|
39
42
|
onChange === null || onChange === void 0 ? void 0 : onChange(e, index);
|
|
40
43
|
}, [index, onChange]);
|
|
41
44
|
(0, react_1.useEffect)(function () {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var isChecked = (currentCheckedQuestions === null || currentCheckedQuestions === void 0 ? void 0 : currentCheckedQuestions.findIndex(function (step) { return step.token === token; })) > -1;
|
|
46
|
-
setChecked(isChecked);
|
|
47
|
-
}, [currentCheckedQuestions, token, setChecked]);
|
|
48
|
-
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ border: '1px solid rgba(0,0,0, 0.08)', borderRadius: "6px", mt: 2 }, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ borderBottom: "1px solid rgba(0,0,0, 0.08)", p: 2, display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Checkbox, { checked: checked, value: originToken, onChange: handleChange }), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ ml: -1 }, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "body1", weight: "500" }, { children: [index + 1, ".", name] })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body2", color: "secondary", mt: 1 }, { children: desc }))] })), isUsed && ((0, jsx_runtime_1.jsx)(UsedTag, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u5DF2\u4F7F\u7528" }) }))] })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", justifyContent: "space-between", padding: "8px 8px 8px 50px" }, { children: (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: [category === null || category === void 0 ? void 0 : category.map(function (label) { return ((0, jsx_runtime_1.jsx)(fbm_ui_1.Chip, { color: "default", label: label }, label)); }), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "body2", ml: 2 }, { children: ["\u6743\u91CD\u5360\u6BD4\uFF1A", weight, "%"] }))] })) }))] })));
|
|
45
|
+
setChecked(checked);
|
|
46
|
+
}, [checked]);
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ border: '1px solid rgba(0,0,0, 0.08)', borderRadius: "6px", mt: 2 }, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ borderBottom: "1px solid rgba(0,0,0, 0.08)", p: 2, display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Checkbox, { checked: curChecked, value: originToken, onChange: handleChange }), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ ml: -1 }, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "body1", weight: "500" }, { children: [index + 1, ".", name] })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body2", color: "secondary", mt: 1 }, { children: desc }))] })), isUsed && ((0, jsx_runtime_1.jsx)(UsedTag, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u5DF2\u4F7F\u7528" }) }))] })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", justifyContent: "space-between", padding: "8px 8px 8px 50px" }, { children: (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: [category === null || category === void 0 ? void 0 : category.map(function (label) { return ((0, jsx_runtime_1.jsx)(fbm_ui_1.Chip, { color: "default", label: label }, label)); }), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "body2", ml: 2 }, { children: ["\u6743\u91CD\u5360\u6BD4\uFF1A", weight, "%"] }))] })) }))] })));
|
|
49
48
|
};
|
|
50
49
|
exports.default = QuestionItem;
|
|
@@ -40,6 +40,6 @@ var QuestionList = function (_a) {
|
|
|
40
40
|
? __spreadArray(__spreadArray(__spreadArray([], checkedQuestionList.slice(0, index), true), [item], false), checkedQuestionList.slice(index + 1), true) : __spreadArray(__spreadArray([], checkedQuestionList.slice(0, index), true), checkedQuestionList.slice(index + 1), true);
|
|
41
41
|
onCheckChange(RescheckedQuestionList);
|
|
42
42
|
}, [previewItem, onCheckChange, checkedQuestionList]);
|
|
43
|
-
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", flexDirection: "column", mt: 3, width: "760px" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body1", weight: "500" }, { children: "\u9898\u76EE\u5217\u8868" })) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, { children: previewItem === null || previewItem === void 0 ? void 0 : previewItem.list.map(function (item, index) { return ((0, jsx_runtime_1.jsx)(Item_1.default, { item: item, index: index, onChange: handleChange }, item.token)); }) })] })));
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", flexDirection: "column", mt: 3, width: "760px" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body1", weight: "500" }, { children: "\u9898\u76EE\u5217\u8868" })) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, { children: previewItem === null || previewItem === void 0 ? void 0 : previewItem.list.map(function (item, index) { return ((0, jsx_runtime_1.jsx)(Item_1.default, { checked: (checkedQuestionList === null || checkedQuestionList === void 0 ? void 0 : checkedQuestionList.findIndex(function (v) { return v.originToken === item.originToken; })) > -1, item: item, index: index, onChange: handleChange }, item.token)); }) })] })));
|
|
44
44
|
};
|
|
45
45
|
exports.default = QuestionList;
|