eli-video-interview 1.2.40-alpha.7 → 1.2.40-alpha.8

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.
@@ -13,15 +13,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import AiAssessmentCriteria from '../AiAssessmentCriteria';
14
14
  import { LANGUAGE_NAMES } from '../AiAssessmentCriteria/const';
15
15
  import AnalysisItem from './AnalysisItem';
16
+ import { useUpdateQuestionStore } from "../../../../store/ai-question/question-update-store";
17
+ import { ADD_QUESTION_TYPE } from "../../../../enum/ai-question";
16
18
  import { useAiAnalysisStore } from "../../../../store/ai-question/ai-analysis-store";
17
19
  import { AddIcon, Box, Button, Typography } from 'fbm-ui';
18
20
  import { Divider, List } from 'fbm-ui/lib/mui';
19
21
  import { useState } from 'react';
20
22
  var AiAnalysis = function () {
23
+ var aiShowType = useUpdateQuestionStore(function (store) { return [store.questionState]; }).questionState.aiShowType;
21
24
  var _a = useAiAnalysisStore(function (store) { return [store.aiAbilities, store.analysisState]; }), aiAbilities = _a.aiAbilities, analysisState = _a.analysisState;
22
25
  var _b = useState(false), aiAnalysisOpen = _b[0], setAiAnalysisOpen = _b[1];
23
26
  var language = analysisState.language;
24
27
  var isOpenAiAnalysis = aiAbilities.length > 0;
25
- return (_jsxs(Box, { children: [aiAnalysisOpen && _jsx(AiAssessmentCriteria, { open: aiAnalysisOpen, onClose: function () { return setAiAnalysisOpen(false); } }), isOpenAiAnalysis && (_jsx(Box, __assign({ display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: _jsxs(Box, __assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Typography, __assign({ variant: "subtitle1" }, { children: "\u6743\u91CD\u8BBE\u7F6E" })), language && LANGUAGE_NAMES[language] ? (_jsxs(Typography, __assign({ variant: "caption", color: "secondary", ml: "8px" }, { children: ["\u8BED\u79CD\uFF1A", language && LANGUAGE_NAMES[language]] }))) : ('')] })) }))), aiAbilities.length > 0 && (_jsx(List, { children: aiAbilities.map(function (item, index) { return (_jsx(AnalysisItem, __assign({ index: index }, item), item.token)); }) })), _jsx(Divider, { sx: { mb: 1 } }), _jsx(Button, __assign({ variant: "outlined", color: "inherit", icon: _jsx(AddIcon, {}), onClick: function () { return setAiAnalysisOpen(true); } }, { children: "\u6DFB\u52A0AI\u8003\u6838\u7EF4\u5EA6" }))] }));
28
+ return (_jsxs(Box, { children: [aiAnalysisOpen && _jsx(AiAssessmentCriteria, { open: aiAnalysisOpen, onClose: function () { return setAiAnalysisOpen(false); } }), isOpenAiAnalysis && (_jsx(Box, __assign({ display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: _jsxs(Box, __assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Typography, __assign({ variant: "subtitle1" }, { children: "\u6743\u91CD\u8BBE\u7F6E" })), language && LANGUAGE_NAMES[language] ? (_jsxs(Typography, __assign({ variant: "caption", color: "secondary", ml: "8px" }, { children: ["\u8BED\u79CD\uFF1A", language && LANGUAGE_NAMES[language]] }))) : ('')] })) }))), aiAbilities.length > 0 && (_jsx(List, { children: aiAbilities.map(function (item, index) { return (_jsx(AnalysisItem, __assign({ index: index }, item), item.token)); }) })), _jsx(Divider, { sx: { mb: 1 } }), aiShowType !== ADD_QUESTION_TYPE.SINGLECHIOCE && (_jsx(Button, __assign({ variant: "outlined", color: "inherit", icon: _jsx(AddIcon, {}), onClick: function () { return setAiAnalysisOpen(true); } }, { children: "\u6DFB\u52A0AI\u8003\u6838\u7EF4\u5EA6" })))] }));
26
29
  };
27
30
  export default AiAnalysis;
@@ -83,11 +83,6 @@ var QuestionForm = forwardRef(function (props, ref) {
83
83
  }, [data]);
84
84
  var form = useForm({
85
85
  initialValues: initialValues,
86
- validate: function (values) {
87
- var errors = {};
88
- // console.log(values);
89
- return errors;
90
- },
91
86
  onSubmit: function (values) { return __awaiter(void 0, void 0, void 0, function () {
92
87
  return __generator(this, function (_a) {
93
88
  switch (_a.label) {
@@ -122,6 +117,7 @@ var QuestionForm = forwardRef(function (props, ref) {
122
117
  useImperativeHandle(ref, function () { return ({
123
118
  handleValues: function () { return form.values; },
124
119
  handleSubmit: function () { return form.handleSubmit(); },
120
+ errors: function () { return form.errors; },
125
121
  setFormValues: function (values) { return form.setValues(__assign(__assign({}, form.values), values)); },
126
122
  }); });
127
123
  useEffect(function () {
@@ -188,9 +188,23 @@ var QuestionUpdate = function () {
188
188
  }
189
189
  });
190
190
  }); }, [getModelParams, item, updateQuestionState]);
191
- var handleOk = function () { return __awaiter(void 0, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
192
- return [2 /*return*/, (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.handleSubmit()];
193
- }); }); };
191
+ var handleOk = function () { return __awaiter(void 0, void 0, void 0, function () {
192
+ var _a;
193
+ return __generator(this, function (_b) {
194
+ switch (_b.label) {
195
+ case 0: return [4 /*yield*/, ((_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.handleSubmit())];
196
+ case 1:
197
+ _b.sent();
198
+ setTimeout(function () {
199
+ var _a;
200
+ if (Object.keys(((_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.errors()) || {}).length > 0) {
201
+ Message.error('有必填项未填');
202
+ }
203
+ }, 200);
204
+ return [2 /*return*/];
205
+ }
206
+ });
207
+ }); };
194
208
  var handleSubmit = useCallback(function (values) { return __awaiter(void 0, void 0, void 0, function () {
195
209
  var _a, errorIndexes, params, _b, minResponseDuration, duration;
196
210
  return __generator(this, function (_c) {
@@ -1,4 +1,5 @@
1
1
  import { BaseAiAbilityParams, BaseExtraParams } from '@/modules/ai-question/interface';
2
+ import type { FormikErrors } from 'formik';
2
3
  export interface VideoBroadcastParams {
3
4
  videoRetry?: number;
4
5
  videoUrl?: string;
@@ -74,6 +75,7 @@ export interface UpdateQuestionState {
74
75
  export interface FormRef {
75
76
  handleValues: () => QuestionFormValues;
76
77
  handleSubmit: () => void;
78
+ errors: () => FormikErrors<QuestionFormValues>;
77
79
  setFormValues: (values: Partial<QuestionFormValues>) => void;
78
80
  }
79
81
  export interface RandomQuestionProps {
@@ -98,6 +98,9 @@ export var ChoiceItemInput = styled(Input)({
98
98
  fontSize: 14,
99
99
  position: 'relative',
100
100
  top: 0.5,
101
+ '&::after': {
102
+ bottom: '1px',
103
+ },
101
104
  '&::before': {
102
105
  display: 'none',
103
106
  },
@@ -18,15 +18,18 @@ var jsx_runtime_1 = require("react/jsx-runtime");
18
18
  var AiAssessmentCriteria_1 = __importDefault(require("../AiAssessmentCriteria"));
19
19
  var const_1 = require("../AiAssessmentCriteria/const");
20
20
  var AnalysisItem_1 = __importDefault(require("./AnalysisItem"));
21
+ var question_update_store_1 = require("../../../../store/ai-question/question-update-store");
22
+ var ai_question_1 = require("../../../../enum/ai-question");
21
23
  var ai_analysis_store_1 = require("../../../../store/ai-question/ai-analysis-store");
22
24
  var fbm_ui_1 = require("fbm-ui");
23
25
  var mui_1 = require("fbm-ui/lib/mui");
24
26
  var react_1 = require("react");
25
27
  var AiAnalysis = function () {
28
+ var aiShowType = (0, question_update_store_1.useUpdateQuestionStore)(function (store) { return [store.questionState]; }).questionState.aiShowType;
26
29
  var _a = (0, ai_analysis_store_1.useAiAnalysisStore)(function (store) { return [store.aiAbilities, store.analysisState]; }), aiAbilities = _a.aiAbilities, analysisState = _a.analysisState;
27
30
  var _b = (0, react_1.useState)(false), aiAnalysisOpen = _b[0], setAiAnalysisOpen = _b[1];
28
31
  var language = analysisState.language;
29
32
  var isOpenAiAnalysis = aiAbilities.length > 0;
30
- return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, { children: [aiAnalysisOpen && (0, jsx_runtime_1.jsx)(AiAssessmentCriteria_1.default, { open: aiAnalysisOpen, onClose: function () { return setAiAnalysisOpen(false); } }), isOpenAiAnalysis && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "subtitle1" }, { children: "\u6743\u91CD\u8BBE\u7F6E" })), language && const_1.LANGUAGE_NAMES[language] ? ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "caption", color: "secondary", ml: "8px" }, { children: ["\u8BED\u79CD\uFF1A", language && const_1.LANGUAGE_NAMES[language]] }))) : ('')] })) }))), aiAbilities.length > 0 && ((0, jsx_runtime_1.jsx)(mui_1.List, { children: aiAbilities.map(function (item, index) { return ((0, jsx_runtime_1.jsx)(AnalysisItem_1.default, __assign({ index: index }, item), item.token)); }) })), (0, jsx_runtime_1.jsx)(mui_1.Divider, { sx: { mb: 1 } }), (0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ variant: "outlined", color: "inherit", icon: (0, jsx_runtime_1.jsx)(fbm_ui_1.AddIcon, {}), onClick: function () { return setAiAnalysisOpen(true); } }, { children: "\u6DFB\u52A0AI\u8003\u6838\u7EF4\u5EA6" }))] }));
33
+ return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, { children: [aiAnalysisOpen && (0, jsx_runtime_1.jsx)(AiAssessmentCriteria_1.default, { open: aiAnalysisOpen, onClose: function () { return setAiAnalysisOpen(false); } }), isOpenAiAnalysis && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "subtitle1" }, { children: "\u6743\u91CD\u8BBE\u7F6E" })), language && const_1.LANGUAGE_NAMES[language] ? ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "caption", color: "secondary", ml: "8px" }, { children: ["\u8BED\u79CD\uFF1A", language && const_1.LANGUAGE_NAMES[language]] }))) : ('')] })) }))), aiAbilities.length > 0 && ((0, jsx_runtime_1.jsx)(mui_1.List, { children: aiAbilities.map(function (item, index) { return ((0, jsx_runtime_1.jsx)(AnalysisItem_1.default, __assign({ index: index }, item), item.token)); }) })), (0, jsx_runtime_1.jsx)(mui_1.Divider, { sx: { mb: 1 } }), aiShowType !== ai_question_1.ADD_QUESTION_TYPE.SINGLECHIOCE && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ variant: "outlined", color: "inherit", icon: (0, jsx_runtime_1.jsx)(fbm_ui_1.AddIcon, {}), onClick: function () { return setAiAnalysisOpen(true); } }, { children: "\u6DFB\u52A0AI\u8003\u6838\u7EF4\u5EA6" })))] }));
31
34
  };
32
35
  exports.default = AiAnalysis;
@@ -88,11 +88,6 @@ var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
88
88
  }, [data]);
89
89
  var form = (0, fbm_ui_1.useForm)({
90
90
  initialValues: initialValues,
91
- validate: function (values) {
92
- var errors = {};
93
- // console.log(values);
94
- return errors;
95
- },
96
91
  onSubmit: function (values) { return __awaiter(void 0, void 0, void 0, function () {
97
92
  return __generator(this, function (_a) {
98
93
  switch (_a.label) {
@@ -127,6 +122,7 @@ var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
127
122
  (0, react_1.useImperativeHandle)(ref, function () { return ({
128
123
  handleValues: function () { return form.values; },
129
124
  handleSubmit: function () { return form.handleSubmit(); },
125
+ errors: function () { return form.errors; },
130
126
  setFormValues: function (values) { return form.setValues(__assign(__assign({}, form.values), values)); },
131
127
  }); });
132
128
  (0, react_1.useEffect)(function () {
@@ -193,9 +193,23 @@ var QuestionUpdate = function () {
193
193
  }
194
194
  });
195
195
  }); }, [getModelParams, item, updateQuestionState]);
196
- var handleOk = function () { return __awaiter(void 0, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
197
- return [2 /*return*/, (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.handleSubmit()];
198
- }); }); };
196
+ var handleOk = function () { return __awaiter(void 0, void 0, void 0, function () {
197
+ var _a;
198
+ return __generator(this, function (_b) {
199
+ switch (_b.label) {
200
+ case 0: return [4 /*yield*/, ((_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.handleSubmit())];
201
+ case 1:
202
+ _b.sent();
203
+ setTimeout(function () {
204
+ var _a;
205
+ if (Object.keys(((_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.errors()) || {}).length > 0) {
206
+ fbm_ui_1.Message.error('有必填项未填');
207
+ }
208
+ }, 200);
209
+ return [2 /*return*/];
210
+ }
211
+ });
212
+ }); };
199
213
  var handleSubmit = (0, react_1.useCallback)(function (values) { return __awaiter(void 0, void 0, void 0, function () {
200
214
  var _a, errorIndexes, params, _b, minResponseDuration, duration;
201
215
  return __generator(this, function (_c) {
@@ -1,4 +1,5 @@
1
1
  import { BaseAiAbilityParams, BaseExtraParams } from '@/modules/ai-question/interface';
2
+ import type { FormikErrors } from 'formik';
2
3
  export interface VideoBroadcastParams {
3
4
  videoRetry?: number;
4
5
  videoUrl?: string;
@@ -74,6 +75,7 @@ export interface UpdateQuestionState {
74
75
  export interface FormRef {
75
76
  handleValues: () => QuestionFormValues;
76
77
  handleSubmit: () => void;
78
+ errors: () => FormikErrors<QuestionFormValues>;
77
79
  setFormValues: (values: Partial<QuestionFormValues>) => void;
78
80
  }
79
81
  export interface RandomQuestionProps {
@@ -101,6 +101,9 @@ exports.ChoiceItemInput = (0, fbm_ui_1.styled)(fbm_ui_1.Input)({
101
101
  fontSize: 14,
102
102
  position: 'relative',
103
103
  top: 0.5,
104
+ '&::after': {
105
+ bottom: '1px',
106
+ },
104
107
  '&::before': {
105
108
  display: 'none',
106
109
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eli-video-interview",
3
- "version": "1.2.40-alpha.7",
3
+ "version": "1.2.40-alpha.8",
4
4
  "description": "鳄梨科技 AI视频面试 React SDK",
5
5
  "author": "鳄梨科技",
6
6
  "license": "MIT",