eli-video-interview 1.2.29-beta.2 → 1.2.29-beta.3

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.
Files changed (85) hide show
  1. package/esm/components/BigBallSvg/styled.d.ts +2 -2
  2. package/esm/components/ScoreBigBall/styled.d.ts +1 -1
  3. package/esm/components/ScrollDialogContent/index.d.ts +1 -1
  4. package/esm/components/VideoPreview/styled.d.ts +3 -3
  5. package/esm/index.d.ts +0 -1
  6. package/esm/index.js +0 -1
  7. package/esm/modules/ai-ability/Root.js +29 -17
  8. package/esm/modules/ai-ability/components/AbilityFormItem/index.d.ts +13 -0
  9. package/esm/modules/ai-ability/components/AbilityFormItem/index.js +126 -0
  10. package/esm/modules/ai-ability/components/AddAbility/index.d.ts +4 -0
  11. package/esm/modules/ai-ability/components/AddAbility/index.js +178 -0
  12. package/esm/modules/ai-ability/components/UpdateAbility/index.d.ts +2 -2
  13. package/esm/modules/ai-ability/components/UpdateAbility/index.js +125 -21
  14. package/esm/modules/ai-ability/index.js +1 -1
  15. package/esm/modules/ai-ability/interface.d.ts +27 -0
  16. package/esm/modules/ai-ability/styled.d.ts +4 -1
  17. package/esm/modules/ai-ability/styled.js +5 -1
  18. package/esm/modules/ai-question/components/AiAnalysis/AnalysisItem.js +3 -3
  19. package/esm/modules/ai-question/components/AiAssessmentCriteria/styled.d.ts +1 -1
  20. package/esm/modules/ai-question/components/BaseAccordion/styled.d.ts +3 -3
  21. package/esm/modules/ai-question/components/BootVideo/styled.d.ts +4 -4
  22. package/esm/modules/ai-question/components/QuestionModel/styled.d.ts +1 -1
  23. package/esm/modules/ai-question/components/QuestionPreview/styled.d.ts +2 -2
  24. package/esm/modules/ai-report/components/MenuAnchor/index.d.ts +3 -3
  25. package/esm/modules/ai-report/components/MenuAnchor/index.js +103 -8
  26. package/esm/modules/ai-report/components/RankingRange/styled.d.ts +2 -2
  27. package/esm/modules/ai-report/components/ScoreReport/styled.d.ts +5 -5
  28. package/esm/modules/ai-report/components/VideoQuestion/styled.d.ts +7 -7
  29. package/esm/modules/ai-report/components/WorkPlaces/index.js +2 -3
  30. package/esm/modules/ai-report/components/WorkPlaces/styled.d.ts +4 -4
  31. package/esm/modules/ai-report/index.js +1 -0
  32. package/esm/modules/ai-report/interface.d.ts +10 -0
  33. package/esm/modules/ai-template/components/TemplateList/styled.d.ts +10 -10
  34. package/esm/modules/ai-template/components/TemplateMenu/styled.d.ts +4 -4
  35. package/esm/services/ai-ability.d.ts +12 -3
  36. package/esm/services/ai-ability.js +5 -2
  37. package/lib/components/BigBallSvg/styled.d.ts +2 -2
  38. package/lib/components/ScoreBigBall/styled.d.ts +1 -1
  39. package/lib/components/ScrollDialogContent/index.d.ts +1 -1
  40. package/lib/components/VideoPreview/styled.d.ts +3 -3
  41. package/lib/index.d.ts +0 -1
  42. package/lib/index.js +1 -3
  43. package/lib/modules/ai-ability/Root.js +29 -17
  44. package/lib/modules/ai-ability/components/AbilityFormItem/index.d.ts +13 -0
  45. package/lib/modules/ai-ability/components/AbilityFormItem/index.js +128 -0
  46. package/lib/modules/ai-ability/components/AddAbility/index.d.ts +4 -0
  47. package/lib/modules/ai-ability/components/AddAbility/index.js +183 -0
  48. package/lib/modules/ai-ability/components/UpdateAbility/index.d.ts +2 -2
  49. package/lib/modules/ai-ability/components/UpdateAbility/index.js +127 -20
  50. package/lib/modules/ai-ability/index.js +1 -1
  51. package/lib/modules/ai-ability/interface.d.ts +27 -0
  52. package/lib/modules/ai-ability/styled.d.ts +4 -1
  53. package/lib/modules/ai-ability/styled.js +5 -1
  54. package/lib/modules/ai-question/components/AiAnalysis/AnalysisItem.js +1 -1
  55. package/lib/modules/ai-question/components/AiAssessmentCriteria/styled.d.ts +1 -1
  56. package/lib/modules/ai-question/components/BaseAccordion/styled.d.ts +3 -3
  57. package/lib/modules/ai-question/components/BootVideo/styled.d.ts +4 -4
  58. package/lib/modules/ai-question/components/QuestionModel/styled.d.ts +1 -1
  59. package/lib/modules/ai-question/components/QuestionPreview/styled.d.ts +2 -2
  60. package/lib/modules/ai-report/components/MenuAnchor/index.d.ts +3 -3
  61. package/lib/modules/ai-report/components/MenuAnchor/index.js +101 -9
  62. package/lib/modules/ai-report/components/RankingRange/styled.d.ts +2 -2
  63. package/lib/modules/ai-report/components/ScoreReport/styled.d.ts +5 -5
  64. package/lib/modules/ai-report/components/VideoQuestion/styled.d.ts +7 -7
  65. package/lib/modules/ai-report/components/WorkPlaces/index.js +1 -2
  66. package/lib/modules/ai-report/components/WorkPlaces/styled.d.ts +4 -4
  67. package/lib/modules/ai-report/index.js +1 -0
  68. package/lib/modules/ai-report/interface.d.ts +10 -0
  69. package/lib/modules/ai-template/components/TemplateList/styled.d.ts +10 -10
  70. package/lib/modules/ai-template/components/TemplateMenu/styled.d.ts +4 -4
  71. package/lib/services/ai-ability.d.ts +12 -3
  72. package/lib/services/ai-ability.js +9 -4
  73. package/package.json +1 -1
  74. package/esm/modules/ai-ability/components/UpdateAbility/interface.d.ts +0 -7
  75. package/esm/modules/ai-ability/components/UpdateAbility/interface.js +0 -1
  76. package/esm/modules/ai-report/components/MenuAnchor/MenuAnchor.d.ts +0 -4
  77. package/esm/modules/ai-report/components/MenuAnchor/MenuAnchor.js +0 -106
  78. package/esm/modules/ai-report/components/MenuAnchor/interface.d.ts +0 -10
  79. package/esm/modules/ai-report/components/MenuAnchor/interface.js +0 -1
  80. package/lib/modules/ai-ability/components/UpdateAbility/interface.d.ts +0 -7
  81. package/lib/modules/ai-ability/components/UpdateAbility/interface.js +0 -2
  82. package/lib/modules/ai-report/components/MenuAnchor/MenuAnchor.d.ts +0 -4
  83. package/lib/modules/ai-report/components/MenuAnchor/MenuAnchor.js +0 -108
  84. package/lib/modules/ai-report/components/MenuAnchor/interface.d.ts +0 -10
  85. package/lib/modules/ai-report/components/MenuAnchor/interface.js +0 -2
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- export declare const SvgRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").SVGProps<SVGSVGElement>, {}>;
3
- export declare const SvgGRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").SVGProps<SVGGElement>, {}>;
2
+ export declare const SvgRoot: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").SVGProps<SVGSVGElement>, {}>;
3
+ export declare const SvgGRoot: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").SVGProps<SVGGElement>, {}>;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  export declare const ScoreBigBallRoot: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Box").BoxProps & {
3
3
  children?: import("react").ReactNode;
4
- } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
4
+ } & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  declare const ScrollDialogContent: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Box").BoxProps & {
3
3
  children?: import("react").ReactNode;
4
- } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
4
+ } & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
5
5
  export default ScrollDialogContent;
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  export declare const VideoPreviewRoot: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Box").BoxProps & {
3
3
  children?: import("react").ReactNode;
4
- } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
4
+ } & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
5
5
  export declare const PageTurningRoot: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Box").BoxProps & {
6
6
  children?: import("react").ReactNode;
7
- } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
7
+ } & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
8
8
  export declare const FaceAnalysisRoot: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Box").BoxProps & {
9
9
  children?: import("react").ReactNode;
10
- } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
10
+ } & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
package/esm/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export { default as AiQuestion } from './modules/ai-question';
2
2
  export { default as AiReport } from './modules/ai-report';
3
- export { default as MenuAnchor } from './modules/ai-report/components/MenuAnchor/MenuAnchor';
4
3
  export { default as AiTemplate } from './modules/ai-template';
5
4
  export { default as AiAbility } from './modules/ai-ability';
6
5
  export { default as VideoPreview } from './components/VideoPreview';
package/esm/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  export { default as AiQuestion } from './modules/ai-question';
2
2
  export { default as AiReport } from './modules/ai-report';
3
- export { default as MenuAnchor } from './modules/ai-report/components/MenuAnchor/MenuAnchor';
4
3
  export { default as AiTemplate } from './modules/ai-template';
5
4
  export { default as AiAbility } from './modules/ai-ability';
6
5
  export { default as VideoPreview } from './components/VideoPreview';
@@ -46,16 +46,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
46
  }
47
47
  };
48
48
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
- import { useCallback } from 'react';
50
- import { AddIcon, Box, Button, confirm, DeleteIcon, EditIcon, Header, Link, Message, Table } from 'fbm-ui';
51
- import { useRequest, useSetState } from 'ahooks';
52
- import dayjs from 'dayjs';
53
- import { PostQuestionCollectionDelete, PostQuestionCollectionList } from "../../services/ai-ability";
49
+ import AddAbility from './components/AddAbility';
54
50
  import UpdateAbility from './components/UpdateAbility';
55
51
  import { AbilityRoot } from './styled';
52
+ import { PostQuestionCollectionDelete, PostQuestionCollectionList } from "../../services/ai-ability";
53
+ import { useRequest, useSetState } from 'ahooks';
54
+ import dayjs from 'dayjs';
55
+ import { AddIcon, Box, Button, confirm, DeleteIcon, DocumentIcon, Header, Link, Message, Table, Tooltip } from 'fbm-ui';
56
+ import { useCallback, useState } from 'react';
56
57
  var AiAbilityRoot = function () {
57
- var _a = useSetState({ open: false, name: '', token: '' }), state = _a[0], setState = _a[1];
58
- var _b = useRequest(PostQuestionCollectionList), data = _b.data, getList = _b.run, listLoading = _b.loading;
58
+ var _a = useSetState({
59
+ name: '',
60
+ token: '',
61
+ type: 3,
62
+ isWorkplace: false,
63
+ }), state = _a[0], setState = _a[1];
64
+ var _b = useState(false), AddAbilityOpen = _b[0], setAddAbilityOpen = _b[1];
65
+ var _c = useState(false), UpdateAbilityOpen = _c[0], setUpdateAbilityOpen = _c[1];
66
+ var _d = useRequest(PostQuestionCollectionList), data = _d.data, getList = _d.run, listLoading = _d.loading;
59
67
  var deleteList = useRequest(PostQuestionCollectionDelete, {
60
68
  manual: true,
61
69
  onSuccess: function () {
@@ -64,12 +72,14 @@ var AiAbilityRoot = function () {
64
72
  },
65
73
  }).run;
66
74
  var handleAdd = useCallback(function () {
67
- setState({ open: true });
68
- }, [setState]);
75
+ setState({ name: '', token: '' });
76
+ setAddAbilityOpen(true);
77
+ }, [setState, setAddAbilityOpen]);
69
78
  var handleEdit = useCallback(function (_a) {
70
- var name = _a.name, token = _a.token;
71
- setState({ open: true, name: name, token: token });
72
- }, [setState]);
79
+ var name = _a.name, token = _a.token, type = _a.type, isWorkplace = _a.isWorkplace;
80
+ setState({ name: name, token: token, type: type, isWorkplace: isWorkplace });
81
+ setUpdateAbilityOpen(true);
82
+ }, [setState, setUpdateAbilityOpen]);
73
83
  var handleDelete = useCallback(function (_a) {
74
84
  var token = _a.token, used = _a.used, tag = _a.tag;
75
85
  if (used) {
@@ -78,7 +88,7 @@ var AiAbilityRoot = function () {
78
88
  else {
79
89
  confirm({
80
90
  title: '确认删除?',
81
- content: "\u786E\u8BA4\u5C06".concat(tag, "\u4ECE\u7CFB\u7EDF\u4E2D\u5220\u9664\u5417\uFF1F\u8BE5\u5220\u9664\u52A8\u4F5C\u65E0\u6CD5\u88AB\u64A4\u9500\u3002"),
91
+ content: "\u786E\u8BA4\u5C06\u201C".concat(tag, "\u201D\u4ECE\u7CFB\u7EDF\u4E2D\u5220\u9664\u5417\uFF1F\u8BE5\u5220\u9664\u52A8\u4F5C\u65E0\u6CD5\u88AB\u64A4\u9500\u3002"),
82
92
  okText: '删除',
83
93
  okProps: {
84
94
  color: 'error',
@@ -98,8 +108,10 @@ var AiAbilityRoot = function () {
98
108
  }
99
109
  }, [deleteList]);
100
110
  var handleClose = useCallback(function () {
101
- setState({ open: false, name: '', token: '' });
102
- }, [setState]);
111
+ setState({ name: '' });
112
+ setAddAbilityOpen(false);
113
+ setUpdateAbilityOpen(false);
114
+ }, [setState, setAddAbilityOpen, setUpdateAbilityOpen]);
103
115
  var columns = [
104
116
  {
105
117
  id: 'name',
@@ -126,10 +138,10 @@ var AiAbilityRoot = function () {
126
138
  label: '操作',
127
139
  render: function (_a) {
128
140
  var row = _a.row;
129
- return row.type === 1 ? null : (_jsxs(_Fragment, { children: [_jsx(Link, { sx: { color: 'rgba(0, 0, 0, 0.56)', mr: 3, cursor: 'pointer' }, text: _jsx(EditIcon, {}), onClick: function () { return handleEdit(row); } }), _jsx(Link, { sx: { color: 'rgba(0, 0, 0, 0.56)', cursor: 'pointer' }, text: _jsx(DeleteIcon, {}), onClick: function () { return handleDelete(row); } })] }));
141
+ return row.type === 1 ? (_jsx(Tooltip, __assign({ title: "\u80FD\u529B\u8BE6\u60C5" }, { children: _jsx(Link, { sx: { color: 'rgba(0, 0, 0, 0.56)', mr: 3, cursor: 'pointer' }, text: _jsx(DocumentIcon, {}), onClick: function () { return handleEdit(row); } }) }))) : (_jsxs(_Fragment, { children: [_jsx(Tooltip, __assign({ title: "\u80FD\u529B\u8BE6\u60C5" }, { children: _jsx(Link, { sx: { color: 'rgba(0, 0, 0, 0.56)', mr: 3, cursor: 'pointer' }, text: _jsx(DocumentIcon, {}), onClick: function () { return handleEdit(row); } }) })), _jsx(Link, { sx: { color: 'rgba(0, 0, 0, 0.56)', cursor: 'pointer' }, text: _jsx(DeleteIcon, {}), onClick: function () { return handleDelete(row); } })] }));
130
142
  },
131
143
  },
132
144
  ];
133
- return (_jsxs(AbilityRoot, { children: [_jsx(UpdateAbility, __assign({}, state, { onClose: handleClose, onSuccess: getList })), _jsx(Header, { title: "\u8003\u5BDF\u80FD\u529B\u7BA1\u7406", renderAction: function () { return (_jsx(Button, __assign({ icon: _jsx(AddIcon, {}), onClick: handleAdd }, { children: "\u65B0\u589E\u80FD\u529B" }))); } }), _jsx(Box, __assign({ mt: 2, border: "1px solid rgba(0, 0, 0, 0.08)", borderRadius: 0.5, overflow: "hidden" }, { children: _jsx(Table, { emptyText: "\u6682\u65E0\u6570\u636E", loading: listLoading, data: data === null || data === void 0 ? void 0 : data.data.list, columns: columns }) }))] }));
145
+ return (_jsxs(AbilityRoot, { children: [_jsx(AddAbility, __assign({}, state, { open: AddAbilityOpen, onClose: handleClose, onSuccess: getList })), _jsx(UpdateAbility, __assign({}, state, { open: UpdateAbilityOpen, onClose: handleClose, onSuccess: getList })), _jsx(Header, { title: "\u8003\u5BDF\u80FD\u529B\u7BA1\u7406", renderAction: function () { return (_jsx(Button, __assign({ icon: _jsx(AddIcon, {}), onClick: handleAdd }, { children: "\u65B0\u589E\u80FD\u529B" }))); } }), _jsx(Box, __assign({ mt: 2, border: "1px solid rgba(0, 0, 0, 0.08)", borderRadius: 0.5, overflow: "hidden" }, { children: _jsx(Table, { emptyText: "\u6682\u65E0\u6570\u636E", loading: listLoading, data: data === null || data === void 0 ? void 0 : data.data.list, columns: columns }) }))] }));
134
146
  };
135
147
  export default AiAbilityRoot;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ interface AbilityFormItemProps {
3
+ token?: string;
4
+ title: string;
5
+ name: string;
6
+ type: number;
7
+ answer?: string;
8
+ mode: string;
9
+ canReplace?: boolean;
10
+ onChange?: (v: any) => void;
11
+ }
12
+ declare const AbilityFormItem: React.FC<AbilityFormItemProps>;
13
+ export default AbilityFormItem;
@@ -0,0 +1,126 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
+ import { GetAiDefine } from "../../../../services/ai-ability";
50
+ import { useRequest } from 'ahooks';
51
+ import { Button, RefreshIcon, TextField, Typography, useTextField } from 'fbm-ui';
52
+ import { Box, Stack } from 'fbm-ui/lib/mui';
53
+ import { useCallback, useEffect, useState } from 'react';
54
+ var AbilityFormItem = function (_a) {
55
+ var token = _a.token, title = _a.title, name = _a.name, type = _a.type, _b = _a.answer, answer = _b === void 0 ? '' : _b, _c = _a.mode, mode = _c === void 0 ? 'show' : _c, _d = _a.canReplace, canReplace = _d === void 0 ? false : _d, onChange = _a.onChange;
56
+ var _e = useState(answer), content = _e[0], setContent = _e[1];
57
+ var _f = useState(mode), internalMode = _f[0], setMode = _f[1];
58
+ var _g = useRequest(GetAiDefine, {
59
+ manual: true,
60
+ onSuccess: function (_a) {
61
+ var data = _a.data;
62
+ var _b = data.list, list = _b === void 0 ? [] : _b;
63
+ var defineRes = list[0].items[0];
64
+ setContent(defineRes);
65
+ },
66
+ onError: function (err) {
67
+ console.log(err);
68
+ },
69
+ }), PostAiDefine = _g.run, loading = _g.loading;
70
+ var handleChange = useCallback(function (e) {
71
+ var value = e.target.value;
72
+ setContent(value);
73
+ }, []);
74
+ var handleReplace = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
75
+ return __generator(this, function (_a) {
76
+ PostAiDefine({
77
+ queryType: type,
78
+ collectionName: name,
79
+ });
80
+ return [2 /*return*/];
81
+ });
82
+ }); }, [type, name, PostAiDefine]);
83
+ var nameTextField = useTextField({
84
+ value: content,
85
+ name: type,
86
+ required: true,
87
+ disabled: loading,
88
+ rules: [
89
+ {
90
+ required: true,
91
+ message: "\u8BF7\u8F93\u5165".concat(title),
92
+ },
93
+ ],
94
+ onChange: handleChange,
95
+ max: 100,
96
+ rows: 3,
97
+ multiline: true,
98
+ sx: {
99
+ marginBottom: '32px',
100
+ },
101
+ });
102
+ useEffect(function () {
103
+ setMode(mode);
104
+ }, [mode]);
105
+ useEffect(function () {
106
+ onChange === null || onChange === void 0 ? void 0 : onChange({
107
+ name: title,
108
+ type: type,
109
+ items: content ? [content] : [],
110
+ });
111
+ // nameTextField.handleValidate();
112
+ // eslint-disable-next-line react-hooks/exhaustive-deps
113
+ }, [content, title, type]);
114
+ useEffect(function () {
115
+ // don't excute when edit detail
116
+ if (token)
117
+ return;
118
+ PostAiDefine({
119
+ queryType: type,
120
+ collectionName: name,
121
+ });
122
+ // eslint-disable-next-line react-hooks/exhaustive-deps
123
+ }, [type, name, token]);
124
+ return (_jsxs(Stack, { children: [_jsxs(Stack, __assign({ style: { marginBottom: '18px' }, direction: "row", alignItems: "center", justifyContent: "space-between" }, { children: [_jsx(Typography, __assign({ variant: "body2", fontWeight: "medium" }, { children: title })), canReplace && (_jsx(Button, __assign({ loading: loading, onClick: handleReplace, variant: "outlined", color: "inherit", size: "small", icon: _jsx(RefreshIcon, {}) }, { children: loading ? '生成中' : '换一换' })))] })), internalMode === 'edit' && (_jsx(Box, __assign({ width: 1, pr: 2 }, { children: _jsx(TextField, __assign({}, nameTextField)) }))), internalMode === 'show' && (_jsx(Box, __assign({ style: { marginTop: '-8px', marginBottom: '24px' } }, { children: _jsx(Typography, __assign({ variant: "body2", sx: { whiteSpace: 'pre-wrap', color: 'RGBA(0, 0, 0, 0.56)' } }, { children: content })) })))] }));
125
+ };
126
+ export default AbilityFormItem;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { AbilityProps } from '../../interface';
3
+ declare const AddAbility: React.FC<AbilityProps>;
4
+ export default AddAbility;
@@ -0,0 +1,178 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
+ import AbilityFormItem from '../AbilityFormItem';
50
+ import { PostQuestionCollectionUpsert } from "../../../../services/ai-ability";
51
+ import { useRequest } from 'ahooks';
52
+ import { Box, Button, Drawer, Message, TextField, Typography, useTextField } from 'fbm-ui';
53
+ import { useCallback, useEffect, useState } from 'react';
54
+ var AddAbility = function (props) {
55
+ var open = props.open, _a = props.name, name = _a === void 0 ? '' : _a, _b = props.type, type = _b === void 0 ? 3 : _b, token = props.token, onClose = props.onClose, onSuccess = props.onSuccess;
56
+ var _c = useState(''), value = _c[0], setValue = _c[1];
57
+ var _d = useState(1), step = _d[0], setStep = _d[1];
58
+ var _e = useState(false), stepLoading = _e[0], setStepLoading = _e[1];
59
+ var initialValues = {
60
+ workPlaceItems: [
61
+ {
62
+ name: '能力定义',
63
+ type: 1,
64
+ answer: '',
65
+ },
66
+ {
67
+ name: '次表现-优秀表现',
68
+ type: 2,
69
+ answer: '',
70
+ },
71
+ {
72
+ name: '优次表现-较差表现',
73
+ type: 3,
74
+ answer: '',
75
+ },
76
+ {
77
+ name: '考察建议-面试题目',
78
+ type: 4,
79
+ answer: '',
80
+ },
81
+ {
82
+ name: '考察建议-评分关键点',
83
+ type: 5,
84
+ answer: '',
85
+ },
86
+ ],
87
+ };
88
+ var _f = useState(initialValues.workPlaceItems), workPlaceItems = _f[0], setWorkPlaceItems = _f[1];
89
+ var _g = useRequest(PostQuestionCollectionUpsert, {
90
+ manual: true,
91
+ onSuccess: function () {
92
+ Message.success('新增能力成功');
93
+ onClose();
94
+ onSuccess();
95
+ },
96
+ }), run = _g.run, loading = _g.loading;
97
+ var nameTextField = useTextField({
98
+ value: value,
99
+ label: '能力名称',
100
+ required: true,
101
+ rules: [
102
+ {
103
+ required: true,
104
+ message: '请输入能力名称',
105
+ },
106
+ ],
107
+ onChange: function (e) { return setValue(e.target.value); },
108
+ max: 7,
109
+ sx: {
110
+ height: '48px',
111
+ width: '320px',
112
+ marginTop: '16px',
113
+ },
114
+ });
115
+ var handleStep = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
116
+ var error;
117
+ return __generator(this, function (_a) {
118
+ switch (_a.label) {
119
+ case 0: return [4 /*yield*/, nameTextField.handleValidate()];
120
+ case 1:
121
+ error = _a.sent();
122
+ if (!error) {
123
+ setStepLoading(true);
124
+ setTimeout(function () {
125
+ setStep(2);
126
+ setStepLoading(false);
127
+ }, 300);
128
+ }
129
+ return [2 /*return*/];
130
+ }
131
+ });
132
+ }); }, [nameTextField]);
133
+ var handleValue = useCallback(function (v) {
134
+ var index = workPlaceItems.findIndex(function (ele) { return ele.type === v.type; });
135
+ workPlaceItems.splice(index, 1, v);
136
+ var list = workPlaceItems;
137
+ console.log(v, list);
138
+ setWorkPlaceItems(list);
139
+ }, [workPlaceItems]);
140
+ var handleOk = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
141
+ var error, avocadoConfig;
142
+ return __generator(this, function (_a) {
143
+ console.log(workPlaceItems);
144
+ error = workPlaceItems.some(function (v) { return v.items.length === 0; });
145
+ if (!error) {
146
+ avocadoConfig = window['AvocadoVideoInterviewConfig'];
147
+ run({
148
+ name: value,
149
+ tag: value,
150
+ token: token,
151
+ type: type,
152
+ workPlaceItems: workPlaceItems,
153
+ mateData: {
154
+ account: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.account,
155
+ enterpriseId: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.enterpriseId,
156
+ },
157
+ });
158
+ }
159
+ return [2 /*return*/];
160
+ });
161
+ }); }, [run, type, token, value, workPlaceItems]);
162
+ var footer = useCallback(function () {
163
+ return step === 1 ? (_jsxs(Box, __assign({ display: "flex", justifyContent: "flex-end", padding: "12px 16px" }, { children: [_jsx(Button, __assign({ sx: { mr: 1, fontWeight: 400 }, variant: "text", color: "inherit", onClick: onClose }, { children: "\u53D6\u6D88" })), _jsx(Button, __assign({ loading: stepLoading, onClick: handleStep }, { children: "\u4E0B\u4E00\u6B65" }))] }))) : (_jsxs(Box, __assign({ display: "flex", justifyContent: "space-between", padding: "12px 16px" }, { children: [_jsx(Button, __assign({ variant: "outlined", color: "inherit", onClick: function () { return setStep(1); } }, { children: "\u4E0A\u4E00\u6B65" })), _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(Button, __assign({ sx: { mr: 1, fontWeight: 400 }, variant: "text", color: "inherit", onClick: onClose }, { children: "\u53D6\u6D88" })), _jsx(Button, __assign({ loading: loading, onClick: handleOk }, { children: "\u65B0\u589E" }))] }))] })));
164
+ }, [step, loading, stepLoading, handleStep, setStep, handleOk, onClose]);
165
+ useEffect(function () {
166
+ setValue(name);
167
+ }, [name]);
168
+ useEffect(function () {
169
+ if (!open) {
170
+ setValue('');
171
+ setStep(1);
172
+ nameTextField.setError();
173
+ }
174
+ // eslint-disable-next-line react-hooks/exhaustive-deps
175
+ }, [open]);
176
+ return (_jsx(Drawer, __assign({ className: "abilityDrawer", title: '新增能力', open: open, footer: footer, onClose: onClose }, { children: step === 1 ? (_jsxs(Box, __assign({ style: { width: '556px' } }, { children: [_jsx(Typography, __assign({ variant: "body2", color: "secondary" }, { children: "\u4F7F\u7528\u901A\u7528\u7684\u80FD\u529B\u540D\u79F0\uFF08\u4F8B\u5982\uFF1A\u9886\u5BFC\u529B\u3001\u5E94\u53D8\u80FD\u529B\u7B49\u5E38\u89C1\u8003\u6838\u9879\uFF09\u547D\u540D\u6709\u52A9\u4E8E\u63D0\u9AD8 AI \u8BC4\u4EF7\u53CA\u8BC4\u5206\u51C6\u786E\u6027\u3002" })), _jsx(TextField, __assign({}, nameTextField))] }))) : (_jsxs(Box, __assign({ style: { width: '556px' } }, { children: [_jsx(Typography, __assign({ variant: "body1", fontWeight: "medium", mb: 2 }, { children: "\u80FD\u529B\u6807\u51C6" })), _jsxs(Typography, __assign({ variant: "body2", color: "secondary", mb: 2 }, { children: ["\u6839\u636E\u60A8\u8F93\u5165\u7684\u80FD\u529B\u540D\u79F0\u300C", _jsx("span", __assign({ style: { color: '#4CAF50', fontWeight: '500' } }, { children: value })), "\u300D\uFF0C\u5E2E\u60A8\u81EA\u52A8\u751F\u6210\u5173\u4E8E\u8BE5\u80FD\u529B\u7684\u5B9A\u4E49\u5185\u5BB9\u3001\u4F18\u6B21\u8868\u73B0\u4EE5\u53CA\u8003\u5BDF\u5EFA\u8BAE\u5185\u5BB9\uFF0C\u786E\u5B9A\u540E\u5C06\u4F1A\u6309\u7167\u8BE5\u6807\u51C6\u751F\u6210AI\u62A5\u544A\u3002"] })), initialValues.workPlaceItems.map(function (v) { return (_jsx(AbilityFormItem, { name: value, title: v.name, type: v.type, answer: v.answer, mode: "edit", canReplace: true, onChange: handleValue }, v.type)); })] }))) })));
177
+ };
178
+ export default AddAbility;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { UpdateAbilityProps } from './interface';
3
- declare const UpdateAbility: React.FC<UpdateAbilityProps>;
2
+ import { AbilityProps } from '../../interface';
3
+ declare const UpdateAbility: React.FC<AbilityProps>;
4
4
  export default UpdateAbility;