eli-video-interview 1.2.36-beta.1 → 1.2.36

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.
@@ -25,34 +25,37 @@ var AiTemplateDialog = styled(Dialog)({
25
25
  },
26
26
  });
27
27
  var AiTemplateRoot = forwardRef(function (props, ref) {
28
- var _a = useAiTemplateStore(), open = _a.open, previewItem = _a.previewItem, updateProps = _a.updateProps, updateState = _a.updateState, handleIncrUse = _a.handleIncrUse;
29
- var _b = useState([]), checkedQuestionList = _b[0], setCheckedQuestionList = _b[1];
28
+ var _a = useAiTemplateStore(), open = _a.open, previewItem = _a.previewItem, _b = _a.currentCheckedQuestions, currentCheckedQuestions = _b === void 0 ? [] : _b, updateProps = _a.updateProps, updateState = _a.updateState, handleIncrUse = _a.handleIncrUse;
29
+ var _c = useState([]), checkedQuestionList = _c[0], setCheckedQuestionList = _c[1];
30
+ var _d = useState(0), curCheckedQuestionListCount = _d[0], setCurCheckedQuestionListCount = _d[1];
30
31
  var handleUseTemplate = useCallback(function () {
31
32
  var _a, _b;
32
- if (checkedQuestionList === null || checkedQuestionList === void 0 ? void 0 : checkedQuestionList.length) {
33
- (_a = props === null || props === void 0 ? void 0 : props.onUseTemplate) === null || _a === void 0 ? void 0 : _a.call(props, checkedQuestionList);
33
+ if ((currentCheckedQuestions === null || currentCheckedQuestions === void 0 ? void 0 : currentCheckedQuestions.length) > 0) {
34
+ console.log('currentCheckedQuestions', currentCheckedQuestions);
35
+ (_a = props === null || props === void 0 ? void 0 : props.onUseTemplate) === null || _a === void 0 ? void 0 : _a.call(props, currentCheckedQuestions);
34
36
  return;
35
37
  }
36
38
  (_b = props === null || props === void 0 ? void 0 : props.onUseTemplate) === null || _b === void 0 ? void 0 : _b.call(props, previewItem === null || previewItem === void 0 ? void 0 : previewItem.list);
37
39
  if (previewItem === null || previewItem === void 0 ? void 0 : previewItem.token) {
38
40
  handleIncrUse(previewItem === null || previewItem === void 0 ? void 0 : previewItem.token);
39
41
  }
40
- }, [handleIncrUse, previewItem, props, checkedQuestionList]);
42
+ }, [handleIncrUse, previewItem, props, currentCheckedQuestions]);
41
43
  var handleCheckedQuestionList = useCallback(function (list) {
42
44
  setCheckedQuestionList(list);
43
- updateProps(__assign(__assign({}, props), { currentCheckedQuestions: list }));
44
- }, [props, updateProps]);
45
+ var curList = list.filter(function (v) { return v && v.checked; });
46
+ setCurCheckedQuestionListCount(curList.length);
47
+ updateProps(__assign(__assign({}, props), { currentCheckedQuestions: curList }));
48
+ }, [props, updateProps, setCurCheckedQuestionListCount]);
45
49
  var handleCheckChange = useCallback(function (list) {
46
50
  handleCheckedQuestionList(list);
47
51
  }, [handleCheckedQuestionList]);
48
52
  useEffect(function () {
49
53
  if (!props.open) {
50
54
  updateState({ previewItem: undefined });
51
- handleCheckedQuestionList([]);
52
55
  }
53
56
  updateProps(props);
54
57
  // eslint-disable-next-line react-hooks/exhaustive-deps
55
- }, [props, handleCheckedQuestionList]);
58
+ }, [props]);
56
59
  // 重置选择项
57
60
  useEffect(function () {
58
61
  if (!previewItem) {
@@ -60,7 +63,7 @@ var AiTemplateRoot = forwardRef(function (props, ref) {
60
63
  }
61
64
  }, [previewItem, handleCheckedQuestionList]);
62
65
  return (_jsx(AiTemplateDialog, __assign({ open: open, size: "lg", header: function () { return (_jsx(TemplateHeader, { name: (previewItem === null || previewItem === void 0 ? void 0 : previewItem.positionName) || (previewItem === null || previewItem === void 0 ? void 0 : previewItem.name), onClose: props.onClose, onBack: function () { return updateState({ previewItem: undefined }); }, onSearch: function () { } })); }, footer: function () {
63
- return previewItem ? (_jsxs(Box, __assign({ display: "flex", justifyContent: checkedQuestionList.length > 0 ? 'space-between' : 'flex-end', alignItems: "center", padding: "12px 0 12px" }, { children: [checkedQuestionList.length > 0 && (_jsxs(Typography, __assign({ variant: "body2" }, { children: ["\u5DF2\u9009\u62E9", _jsx("span", __assign({ style: { color: '#4CAF50', margin: '0 3px', fontWeight: 500 } }, { children: checkedQuestionList.length })), "\u9898"] }))), _jsxs(Box, __assign({ display: "flex", alignItems: "center" }, { children: [checkedQuestionList.length > 0 && (_jsx(Button, __assign({ color: "secondary", variant: "text", sx: { mr: 1, color: 'RGBA(0, 0, 0, 0.56)' }, onClick: function () { return handleCheckedQuestionList([]); } }, { children: "\u53D6\u6D88\u9009\u62E9" }))), _jsx(Button, __assign({ onClick: handleUseTemplate }, { children: checkedQuestionList.length ? '使用选择题目' : '使用该模版' }))] }))] }))) : null;
66
+ return previewItem ? (_jsxs(Box, __assign({ display: "flex", justifyContent: curCheckedQuestionListCount > 0 ? 'space-between' : 'flex-end', alignItems: "center", padding: "12px 0 12px" }, { children: [curCheckedQuestionListCount > 0 && (_jsxs(Typography, __assign({ variant: "body2" }, { children: ["\u5DF2\u9009\u62E9", _jsx("span", __assign({ style: { color: '#4CAF50', margin: '0 3px', fontWeight: 500 } }, { children: curCheckedQuestionListCount })), "\u9898"] }))), _jsxs(Box, __assign({ display: "flex", alignItems: "center" }, { children: [curCheckedQuestionListCount > 0 && (_jsx(Button, __assign({ color: "secondary", variant: "text", sx: { mr: 1, color: 'RGBA(0, 0, 0, 0.56)' }, onClick: function () { return handleCheckedQuestionList([]); } }, { children: "\u53D6\u6D88\u9009\u62E9" }))), _jsx(Button, __assign({ onClick: handleUseTemplate }, { children: curCheckedQuestionListCount ? '使用选择题目' : '使用该模版' }))] }))] }))) : null;
64
67
  }, onClose: props.onClose }, { children: _jsxs(ScrollDialogContent, { children: [_jsxs(Box, __assign({ display: previewItem ? 'flex' : 'none', flexDirection: "column" }, { children: [_jsx(CapabilityModel, {}), _jsx(QuestionList, { checkedQuestionList: checkedQuestionList, onCheckChange: handleCheckChange })] })), _jsxs(Box, __assign({ display: previewItem ? 'none' : 'flex' }, { children: [_jsx(TemplateMenu, {}), _jsx(TemplateList, {})] }))] }) })));
65
68
  });
66
69
  AiTemplateRoot.displayName = 'AiTemplateRoot';
@@ -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, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange;
17
+ var item = _a.item, index = _a.index, onChange = _a.onChange;
18
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;
19
+ var _b = useAiTemplateStore(function (store) { return [store.currentSteps, store.currentCheckedQuestions]; }), currentSteps = _b.currentSteps, currentCheckedQuestions = _b.currentCheckedQuestions;
20
20
  var isUsed = currentSteps === null || currentSteps === void 0 ? void 0 : currentSteps.find(function (step) { return step.originToken === originToken; });
21
- var _d = useState(checked), curChecked = _d[0], setChecked = _d[1];
21
+ var _c = useState(false), curChecked = _c[0], setChecked = _c[1];
22
22
  var UsedTag = styled(Box)(function () { return ({
23
23
  position: 'absolute',
24
24
  right: -1,
@@ -33,15 +33,13 @@ 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);
38
36
  var handleChange = useCallback(function (e) {
39
- setChecked(e.target.checked);
40
37
  onChange === null || onChange === void 0 ? void 0 : onChange(e, index);
41
38
  }, [index, onChange]);
42
39
  useEffect(function () {
40
+ var checked = !!(currentCheckedQuestions === null || currentCheckedQuestions === void 0 ? void 0 : currentCheckedQuestions.find(function (step) { return step.token === item.token; }));
43
41
  setChecked(checked);
44
- }, [checked]);
42
+ }, [currentCheckedQuestions, item.token]);
45
43
  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, "%"] }))] })) }))] })));
46
44
  };
47
45
  export default QuestionItem;
@@ -9,15 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
- if (ar || !(i in from)) {
15
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
- ar[i] = from[i];
17
- }
18
- }
19
- return to.concat(ar || Array.prototype.slice.call(from));
20
- };
21
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
13
  import QuestionItem from './Item';
23
14
  import { useAiTemplateStore } from "../../../../store/ai-template/global-store";
@@ -31,10 +22,10 @@ var QuestionList = function (_a) {
31
22
  var item = previewItem === null || previewItem === void 0 ? void 0 : previewItem.list[index];
32
23
  if (!item)
33
24
  return;
34
- var RescheckedQuestionList = checked
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
- onCheckChange(RescheckedQuestionList);
25
+ item.checked = checked;
26
+ checkedQuestionList[index] = item;
27
+ onCheckChange(checkedQuestionList);
37
28
  }, [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, { 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)); }) })] })));
29
+ 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)); }) })] })));
39
30
  };
40
31
  export default QuestionList;
@@ -2,7 +2,6 @@ import { QuestionList } from '@/modules/ai-template/interface';
2
2
  export interface QuestionItemProps {
3
3
  item: QuestionList;
4
4
  index: number;
5
- checked: boolean;
6
5
  onChange?: (e: any, index: number) => void;
7
6
  }
8
7
  export interface QuestionListProps {
@@ -1,6 +1,7 @@
1
1
  import { QuestionModelStep } from '@/modules/ai-question/components/QuestionModel/interface';
2
2
  import { AiTemplatesCollection, AiTemplatesList } from '@/modules/ai-template/components/TemplateList/interface';
3
3
  export interface QuestionList extends QuestionModelStep {
4
+ checked?: boolean;
4
5
  }
5
6
  export interface HistoryPatterns {
6
7
  token?: string;
@@ -30,34 +30,37 @@ var AiTemplateDialog = (0, fbm_ui_1.styled)(fbm_ui_1.Dialog)({
30
30
  },
31
31
  });
32
32
  var AiTemplateRoot = (0, react_1.forwardRef)(function (props, ref) {
33
- var _a = (0, global_store_1.useAiTemplateStore)(), open = _a.open, previewItem = _a.previewItem, updateProps = _a.updateProps, updateState = _a.updateState, handleIncrUse = _a.handleIncrUse;
34
- var _b = (0, react_1.useState)([]), checkedQuestionList = _b[0], setCheckedQuestionList = _b[1];
33
+ var _a = (0, global_store_1.useAiTemplateStore)(), open = _a.open, previewItem = _a.previewItem, _b = _a.currentCheckedQuestions, currentCheckedQuestions = _b === void 0 ? [] : _b, updateProps = _a.updateProps, updateState = _a.updateState, handleIncrUse = _a.handleIncrUse;
34
+ var _c = (0, react_1.useState)([]), checkedQuestionList = _c[0], setCheckedQuestionList = _c[1];
35
+ var _d = (0, react_1.useState)(0), curCheckedQuestionListCount = _d[0], setCurCheckedQuestionListCount = _d[1];
35
36
  var handleUseTemplate = (0, react_1.useCallback)(function () {
36
37
  var _a, _b;
37
- if (checkedQuestionList === null || checkedQuestionList === void 0 ? void 0 : checkedQuestionList.length) {
38
- (_a = props === null || props === void 0 ? void 0 : props.onUseTemplate) === null || _a === void 0 ? void 0 : _a.call(props, checkedQuestionList);
38
+ if ((currentCheckedQuestions === null || currentCheckedQuestions === void 0 ? void 0 : currentCheckedQuestions.length) > 0) {
39
+ console.log('currentCheckedQuestions', currentCheckedQuestions);
40
+ (_a = props === null || props === void 0 ? void 0 : props.onUseTemplate) === null || _a === void 0 ? void 0 : _a.call(props, currentCheckedQuestions);
39
41
  return;
40
42
  }
41
43
  (_b = props === null || props === void 0 ? void 0 : props.onUseTemplate) === null || _b === void 0 ? void 0 : _b.call(props, previewItem === null || previewItem === void 0 ? void 0 : previewItem.list);
42
44
  if (previewItem === null || previewItem === void 0 ? void 0 : previewItem.token) {
43
45
  handleIncrUse(previewItem === null || previewItem === void 0 ? void 0 : previewItem.token);
44
46
  }
45
- }, [handleIncrUse, previewItem, props, checkedQuestionList]);
47
+ }, [handleIncrUse, previewItem, props, currentCheckedQuestions]);
46
48
  var handleCheckedQuestionList = (0, react_1.useCallback)(function (list) {
47
49
  setCheckedQuestionList(list);
48
- updateProps(__assign(__assign({}, props), { currentCheckedQuestions: list }));
49
- }, [props, updateProps]);
50
+ var curList = list.filter(function (v) { return v && v.checked; });
51
+ setCurCheckedQuestionListCount(curList.length);
52
+ updateProps(__assign(__assign({}, props), { currentCheckedQuestions: curList }));
53
+ }, [props, updateProps, setCurCheckedQuestionListCount]);
50
54
  var handleCheckChange = (0, react_1.useCallback)(function (list) {
51
55
  handleCheckedQuestionList(list);
52
56
  }, [handleCheckedQuestionList]);
53
57
  (0, react_1.useEffect)(function () {
54
58
  if (!props.open) {
55
59
  updateState({ previewItem: undefined });
56
- handleCheckedQuestionList([]);
57
60
  }
58
61
  updateProps(props);
59
62
  // eslint-disable-next-line react-hooks/exhaustive-deps
60
- }, [props, handleCheckedQuestionList]);
63
+ }, [props]);
61
64
  // 重置选择项
62
65
  (0, react_1.useEffect)(function () {
63
66
  if (!previewItem) {
@@ -65,7 +68,7 @@ var AiTemplateRoot = (0, react_1.forwardRef)(function (props, ref) {
65
68
  }
66
69
  }, [previewItem, handleCheckedQuestionList]);
67
70
  return ((0, jsx_runtime_1.jsx)(AiTemplateDialog, __assign({ open: open, size: "lg", header: function () { return ((0, jsx_runtime_1.jsx)(TemplateHeader_1.default, { name: (previewItem === null || previewItem === void 0 ? void 0 : previewItem.positionName) || (previewItem === null || previewItem === void 0 ? void 0 : previewItem.name), onClose: props.onClose, onBack: function () { return updateState({ previewItem: undefined }); }, onSearch: function () { } })); }, footer: function () {
68
- return previewItem ? ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", justifyContent: checkedQuestionList.length > 0 ? 'space-between' : 'flex-end', alignItems: "center", padding: "12px 0 12px" }, { children: [checkedQuestionList.length > 0 && ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "body2" }, { children: ["\u5DF2\u9009\u62E9", (0, jsx_runtime_1.jsx)("span", __assign({ style: { color: '#4CAF50', margin: '0 3px', fontWeight: 500 } }, { children: checkedQuestionList.length })), "\u9898"] }))), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: [checkedQuestionList.length > 0 && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ color: "secondary", variant: "text", sx: { mr: 1, color: 'RGBA(0, 0, 0, 0.56)' }, onClick: function () { return handleCheckedQuestionList([]); } }, { children: "\u53D6\u6D88\u9009\u62E9" }))), (0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ onClick: handleUseTemplate }, { children: checkedQuestionList.length ? '使用选择题目' : '使用该模版' }))] }))] }))) : null;
71
+ return previewItem ? ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", justifyContent: curCheckedQuestionListCount > 0 ? 'space-between' : 'flex-end', alignItems: "center", padding: "12px 0 12px" }, { children: [curCheckedQuestionListCount > 0 && ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "body2" }, { children: ["\u5DF2\u9009\u62E9", (0, jsx_runtime_1.jsx)("span", __assign({ style: { color: '#4CAF50', margin: '0 3px', fontWeight: 500 } }, { children: curCheckedQuestionListCount })), "\u9898"] }))), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: [curCheckedQuestionListCount > 0 && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ color: "secondary", variant: "text", sx: { mr: 1, color: 'RGBA(0, 0, 0, 0.56)' }, onClick: function () { return handleCheckedQuestionList([]); } }, { children: "\u53D6\u6D88\u9009\u62E9" }))), (0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ onClick: handleUseTemplate }, { children: curCheckedQuestionListCount ? '使用选择题目' : '使用该模版' }))] }))] }))) : null;
69
72
  }, onClose: props.onClose }, { children: (0, jsx_runtime_1.jsxs)(ScrollDialogContent_1.default, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: previewItem ? 'flex' : 'none', flexDirection: "column" }, { children: [(0, jsx_runtime_1.jsx)(CapabilityModel_1.default, {}), (0, jsx_runtime_1.jsx)(QuestionList_1.default, { checkedQuestionList: checkedQuestionList, onCheckChange: handleCheckChange })] })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: previewItem ? 'none' : 'flex' }, { children: [(0, jsx_runtime_1.jsx)(TemplateMenu_1.default, {}), (0, jsx_runtime_1.jsx)(TemplateList_1.default, {})] }))] }) })));
70
73
  });
71
74
  AiTemplateRoot.displayName = 'AiTemplateRoot';
@@ -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, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange;
19
+ var item = _a.item, index = _a.index, onChange = _a.onChange;
20
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;
21
+ var _b = (0, global_store_1.useAiTemplateStore)(function (store) { return [store.currentSteps, store.currentCheckedQuestions]; }), currentSteps = _b.currentSteps, currentCheckedQuestions = _b.currentCheckedQuestions;
22
22
  var isUsed = currentSteps === null || currentSteps === void 0 ? void 0 : currentSteps.find(function (step) { return step.originToken === originToken; });
23
- var _d = (0, react_1.useState)(checked), curChecked = _d[0], setChecked = _d[1];
23
+ var _c = (0, react_1.useState)(false), curChecked = _c[0], setChecked = _c[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,15 +35,13 @@ 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);
40
38
  var handleChange = (0, react_1.useCallback)(function (e) {
41
- setChecked(e.target.checked);
42
39
  onChange === null || onChange === void 0 ? void 0 : onChange(e, index);
43
40
  }, [index, onChange]);
44
41
  (0, react_1.useEffect)(function () {
42
+ var checked = !!(currentCheckedQuestions === null || currentCheckedQuestions === void 0 ? void 0 : currentCheckedQuestions.find(function (step) { return step.token === item.token; }));
45
43
  setChecked(checked);
46
- }, [checked]);
44
+ }, [currentCheckedQuestions, item.token]);
47
45
  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, "%"] }))] })) }))] })));
48
46
  };
49
47
  exports.default = QuestionItem;
@@ -10,15 +10,6 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
- if (ar || !(i in from)) {
16
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
- ar[i] = from[i];
18
- }
19
- }
20
- return to.concat(ar || Array.prototype.slice.call(from));
21
- };
22
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
23
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
15
  };
@@ -36,10 +27,10 @@ var QuestionList = function (_a) {
36
27
  var item = previewItem === null || previewItem === void 0 ? void 0 : previewItem.list[index];
37
28
  if (!item)
38
29
  return;
39
- var RescheckedQuestionList = checked
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
- onCheckChange(RescheckedQuestionList);
30
+ item.checked = checked;
31
+ checkedQuestionList[index] = item;
32
+ onCheckChange(checkedQuestionList);
42
33
  }, [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, { 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)); }) })] })));
34
+ 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)); }) })] })));
44
35
  };
45
36
  exports.default = QuestionList;
@@ -2,7 +2,6 @@ import { QuestionList } from '@/modules/ai-template/interface';
2
2
  export interface QuestionItemProps {
3
3
  item: QuestionList;
4
4
  index: number;
5
- checked: boolean;
6
5
  onChange?: (e: any, index: number) => void;
7
6
  }
8
7
  export interface QuestionListProps {
@@ -1,6 +1,7 @@
1
1
  import { QuestionModelStep } from '@/modules/ai-question/components/QuestionModel/interface';
2
2
  import { AiTemplatesCollection, AiTemplatesList } from '@/modules/ai-template/components/TemplateList/interface';
3
3
  export interface QuestionList extends QuestionModelStep {
4
+ checked?: boolean;
4
5
  }
5
6
  export interface HistoryPatterns {
6
7
  token?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eli-video-interview",
3
- "version": "1.2.36-beta.1",
3
+ "version": "1.2.36",
4
4
  "description": "鳄梨科技 AI视频面试 React SDK",
5
5
  "author": "鳄梨科技",
6
6
  "license": "MIT",