@blocklet/pages-kit 0.2.285 → 0.2.287
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/lib/cjs/builtin/async/ai-runtime/api/assistant.js +26 -0
- package/lib/cjs/builtin/async/ai-runtime/api/dataset.js +127 -0
- package/lib/cjs/builtin/async/ai-runtime/api/message.js +33 -0
- package/lib/cjs/builtin/async/ai-runtime/api/request.js +47 -0
- package/lib/cjs/builtin/async/ai-runtime/api/session.js +121 -0
- package/lib/cjs/builtin/async/ai-runtime/api/subscription.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +63 -0
- package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading.js +60 -0
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingButton.js +40 -0
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingListItemButton.js +51 -0
- package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer.js +156 -0
- package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +43 -0
- package/lib/cjs/builtin/async/ai-runtime/components/PoweredBy.js +30 -0
- package/lib/cjs/builtin/async/ai-runtime/components/RuntimeProvider.js +16 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +109 -0
- package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +102 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +193 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +92 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionListView.js +197 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionView.js +122 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentListView.js +152 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentView.js +135 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/ChatBot.js +105 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.js +35 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/index.js +12 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterForm.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +66 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormFields.js +43 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/QuestionField.js +44 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/SettingButton.js +76 -0
- package/lib/cjs/builtin/async/ai-runtime/components/layout/index.js +15 -0
- package/lib/cjs/builtin/async/ai-runtime/components/lottie/index.js +34 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageActions.js +38 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageErrorView.js +30 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageItemView.js +134 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageListView.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/ReferenceLinks.js +11 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/LanguageField.js +55 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/NumberField.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/SelectField.js +24 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/StringField.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/index.js +37 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +94 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +67 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/index.js +15 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +103 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +22 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +72 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +31 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/index.js +22 -0
- package/lib/cjs/builtin/async/ai-runtime/components/session/CheckSession.js +62 -0
- package/lib/cjs/builtin/async/ai-runtime/components/session/SessionListView.js +88 -0
- package/lib/cjs/builtin/async/ai-runtime/constants.js +5 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/navigate.js +37 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/subscribe.js +35 -0
- package/lib/cjs/builtin/async/ai-runtime/index.js +75 -0
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +147 -0
- package/lib/cjs/builtin/async/ai-runtime/state/assistant.js +59 -0
- package/lib/cjs/builtin/async/ai-runtime/state/index.js +423 -0
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +217 -0
- package/lib/cjs/builtin/async/ai-runtime/state/subscription.js +52 -0
- package/lib/cjs/builtin/async/ai-runtime/utils.js +49 -0
- package/lib/cjs/builtin/async/react-scroll-to-bottom.js +1 -1
- package/lib/cjs/utils/builtin.js +1 -0
- package/lib/cjs/utils/inject-global-components.js +2 -0
- package/lib/esm/builtin/async/ai-runtime/api/assistant.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/api/dataset.js +113 -0
- package/lib/esm/builtin/async/ai-runtime/api/message.js +28 -0
- package/lib/esm/builtin/async/ai-runtime/api/request.js +43 -0
- package/lib/esm/builtin/async/ai-runtime/api/session.js +112 -0
- package/lib/esm/builtin/async/ai-runtime/api/subscription.js +27 -0
- package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +56 -0
- package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading.js +56 -0
- package/lib/esm/builtin/async/ai-runtime/components/LoadingButton.js +38 -0
- package/lib/esm/builtin/async/ai-runtime/components/LoadingListItemButton.js +48 -0
- package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer.js +129 -0
- package/lib/esm/builtin/async/ai-runtime/components/MenuButton.js +40 -0
- package/lib/esm/builtin/async/ai-runtime/components/PoweredBy.js +27 -0
- package/lib/esm/builtin/async/ai-runtime/components/RuntimeProvider.js +10 -0
- package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +101 -0
- package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +93 -0
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +190 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +92 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionListView.js +197 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionView.js +122 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentListView.js +152 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentView.js +135 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/ChatBot.js +99 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.js +15 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.js +30 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/index.js +3 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterForm.js +42 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +59 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormFields.js +37 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/QuestionField.js +38 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/SettingButton.js +73 -0
- package/lib/esm/builtin/async/ai-runtime/components/layout/index.js +12 -0
- package/lib/esm/builtin/async/ai-runtime/components/lottie/index.js +8 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageActions.js +35 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageErrorView.js +24 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageItemView.js +105 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageListView.js +42 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/ReferenceLinks.js +8 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/LanguageField.js +53 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/NumberField.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/SelectField.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/StringField.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/index.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +88 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.js +15 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +61 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/index.js +9 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +97 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +66 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +25 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/index.js +16 -0
- package/lib/esm/builtin/async/ai-runtime/components/session/CheckSession.js +59 -0
- package/lib/esm/builtin/async/ai-runtime/components/session/SessionListView.js +88 -0
- package/lib/esm/builtin/async/ai-runtime/constants.js +2 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/header.js +25 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/navigate.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/subscribe.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/index.js +66 -0
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +144 -0
- package/lib/esm/builtin/async/ai-runtime/state/assistant.js +54 -0
- package/lib/esm/builtin/async/ai-runtime/state/index.js +423 -0
- package/lib/esm/builtin/async/ai-runtime/state/session.js +209 -0
- package/lib/esm/builtin/async/ai-runtime/state/subscription.js +47 -0
- package/lib/esm/builtin/async/ai-runtime/utils.js +42 -0
- package/lib/esm/builtin/async/react-scroll-to-bottom.js +1 -1
- package/lib/esm/utils/builtin.js +1 -0
- package/lib/esm/utils/inject-global-components.js +2 -0
- package/lib/types/builtin/async/ai-runtime/api/assistant.d.ts +18 -0
- package/lib/types/builtin/async/ai-runtime/api/dataset.d.ts +39 -0
- package/lib/types/builtin/async/ai-runtime/api/message.d.ts +39 -0
- package/lib/types/builtin/async/ai-runtime/api/request.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/api/session.d.ts +54 -0
- package/lib/types/builtin/async/ai-runtime/api/subscription.d.ts +15 -0
- package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +11 -0
- package/lib/types/builtin/async/ai-runtime/components/GlobalLoading.d.ts +33 -0
- package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/components/LoadingListItemButton.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/components/MarkdownRenderer.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/components/MenuButton.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/PoweredBy.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/RuntimeProvider.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +61 -0
- package/lib/types/builtin/async/ai-runtime/components/SocialShare.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/components/ThemeProvider.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionEditDialog.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/common/ChatBot.d.ts +13 -0
- package/lib/types/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/common/index.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterForm.d.ts +12 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormDialog.d.ts +28 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormFields.d.ts +8 -0
- package/lib/types/builtin/async/ai-runtime/components/form/QuestionField.d.ts +13 -0
- package/lib/types/builtin/async/ai-runtime/components/form/SettingButton.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/layout/index.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/lottie/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageActions.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageErrorView.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageItemView.d.ts +10 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageListView.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/message/ReferenceLinks.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/LanguageField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/NumberField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/SelectField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/StringField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/index.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/InitialForm.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/session/CheckSession.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/session/SessionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/constants.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/hooks/header.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/hooks/navigate.d.ts +25 -0
- package/lib/types/builtin/async/ai-runtime/hooks/subscribe.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/index.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +126 -0
- package/lib/types/builtin/async/ai-runtime/state/assistant.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/state/index.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/state/session.d.ts +40 -0
- package/lib/types/builtin/async/ai-runtime/state/subscription.d.ts +15 -0
- package/lib/types/builtin/async/ai-runtime/utils.d.ts +20 -0
- package/lib/types/builtin/async/react-scroll-to-bottom.d.ts +3 -2
- package/lib/types/builtin/session.d.ts +11 -1
- package/lib/types/utils/builtin.d.ts +1 -0
- package/package.json +13 -8
- package/tsconfig.json +5 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { Icon } from '@iconify/react';
|
|
3
|
+
// import {
|
|
4
|
+
// Button,
|
|
5
|
+
// Dialog,
|
|
6
|
+
// DialogActions,
|
|
7
|
+
// DialogContent,
|
|
8
|
+
// DialogProps,
|
|
9
|
+
// DialogTitle,
|
|
10
|
+
// Stack,
|
|
11
|
+
// TextField,
|
|
12
|
+
// Typography,
|
|
13
|
+
// } from '@mui/material';
|
|
14
|
+
// import { useEffect } from 'react';
|
|
15
|
+
// import { useForm } from 'react-hook-form';
|
|
16
|
+
// import { useLocaleContext } from '../../../../locale';
|
|
17
|
+
// import LoadingButton from '../LoadingButton';
|
|
18
|
+
// export default function CollectionEditDialog({
|
|
19
|
+
// DialogProps,
|
|
20
|
+
// onSubmit,
|
|
21
|
+
// defaultValues,
|
|
22
|
+
// }: {
|
|
23
|
+
// DialogProps?: DialogProps;
|
|
24
|
+
// onSubmit?: () => any;
|
|
25
|
+
// defaultValues?: any;
|
|
26
|
+
// }) {
|
|
27
|
+
// const { t } = useLocaleContext();
|
|
28
|
+
// const form = useForm();
|
|
29
|
+
// useEffect(() => {
|
|
30
|
+
// if (DialogProps?.open) {
|
|
31
|
+
// form.reset({
|
|
32
|
+
// id: defaultValues?.id,
|
|
33
|
+
// name: defaultValues?.name || '',
|
|
34
|
+
// description: defaultValues?.description || '',
|
|
35
|
+
// });
|
|
36
|
+
// }
|
|
37
|
+
// }, [DialogProps?.open]);
|
|
38
|
+
// const isUpdate = !!form.watch('id');
|
|
39
|
+
// return (
|
|
40
|
+
// <Dialog
|
|
41
|
+
// {...DialogProps}
|
|
42
|
+
// open={DialogProps?.open || false}
|
|
43
|
+
// fullWidth
|
|
44
|
+
// maxWidth="sm"
|
|
45
|
+
// component="form"
|
|
46
|
+
// onSubmit={form.handleSubmit(onSubmit)}>
|
|
47
|
+
// <DialogTitle>{t(isUpdate ? 'editObject' : 'newObject', { object: t('collection') })}</DialogTitle>
|
|
48
|
+
// <DialogContent dividers>
|
|
49
|
+
// <Stack gap={2.5}>
|
|
50
|
+
// <Stack gap={0.5}>
|
|
51
|
+
// <Typography sx={{ fontWeight: 500 }}>{t('name')}</Typography>
|
|
52
|
+
// <TextField
|
|
53
|
+
// size="small"
|
|
54
|
+
// fullWidth
|
|
55
|
+
// hiddenLabel
|
|
56
|
+
// autoFocus
|
|
57
|
+
// placeholder={t('name')}
|
|
58
|
+
// {...form.register('name')}
|
|
59
|
+
// />
|
|
60
|
+
// </Stack>
|
|
61
|
+
// <Stack gap={0.5}>
|
|
62
|
+
// <Typography sx={{ fontWeight: 500 }}>{t('description')}</Typography>
|
|
63
|
+
// <TextField
|
|
64
|
+
// size="small"
|
|
65
|
+
// fullWidth
|
|
66
|
+
// hiddenLabel
|
|
67
|
+
// multiline
|
|
68
|
+
// placeholder={t('description')}
|
|
69
|
+
// minRows={3}
|
|
70
|
+
// {...form.register('description')}
|
|
71
|
+
// />
|
|
72
|
+
// </Stack>
|
|
73
|
+
// </Stack>
|
|
74
|
+
// </DialogContent>
|
|
75
|
+
// <DialogActions>
|
|
76
|
+
// <Button variant="outlined" color="black" size="small" onClick={DialogProps?.onClose}>
|
|
77
|
+
// {t('cancel')}
|
|
78
|
+
// </Button>
|
|
79
|
+
// <LoadingButton
|
|
80
|
+
// variant="contained"
|
|
81
|
+
// type="submit"
|
|
82
|
+
// color="black"
|
|
83
|
+
// size="small"
|
|
84
|
+
// startIcon={<Icon icon={isUpdate ? 'tabler:device-floppy' : 'tabler:plus'} />}
|
|
85
|
+
// loadingPosition="start"
|
|
86
|
+
// loading={form.formState.isSubmitting}>
|
|
87
|
+
// {t(isUpdate ? 'save' : 'create')}
|
|
88
|
+
// </LoadingButton>
|
|
89
|
+
// </DialogActions>
|
|
90
|
+
// </Dialog>
|
|
91
|
+
// );
|
|
92
|
+
// }
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { Icon } from '@iconify/react';
|
|
3
|
+
// import {
|
|
4
|
+
// Box,
|
|
5
|
+
// Button,
|
|
6
|
+
// CircularProgress,
|
|
7
|
+
// ClickAwayListener,
|
|
8
|
+
// List,
|
|
9
|
+
// ListItemButton,
|
|
10
|
+
// Paper,
|
|
11
|
+
// Popper,
|
|
12
|
+
// Stack,
|
|
13
|
+
// Typography,
|
|
14
|
+
// } from '@mui/material';
|
|
15
|
+
// import { useEffect, useState } from 'react';
|
|
16
|
+
// import { Link as RouterLink } from 'react-router-dom';
|
|
17
|
+
// import { Toast } from '../../../../arcblock/ux';
|
|
18
|
+
// import { useLocaleContext } from '../../../../locale';
|
|
19
|
+
// import { useSessionContext } from '../../../../session';
|
|
20
|
+
// import { Dataset } from '../../api/dataset';
|
|
21
|
+
// import { useNavigateTo, useNavigateWithQuery } from '../../hooks/navigate';
|
|
22
|
+
// import { createDatasetState } from '../../state';
|
|
23
|
+
// import Layout from '../layout';
|
|
24
|
+
// import LoadingListItemButton from '../LoadingListItemButton';
|
|
25
|
+
// import CollectionEditDialog from './CollectionEditDialog';
|
|
26
|
+
// export function CollectionListView({ releaseId }: { releaseId: string }) {
|
|
27
|
+
// const { t } = useLocaleContext();
|
|
28
|
+
// const { session: authSession } = useSessionContext();
|
|
29
|
+
// const datasetState = createDatasetState({ releaseId })();
|
|
30
|
+
// const navigate = useNavigateWithQuery();
|
|
31
|
+
// useEffect(() => {
|
|
32
|
+
// if (!datasetState.list && authSession.user) {
|
|
33
|
+
// datasetState.reload();
|
|
34
|
+
// }
|
|
35
|
+
// }, [authSession.user]);
|
|
36
|
+
// const [editTarget, setEditTarget] = useState<Partial<Dataset>>();
|
|
37
|
+
// const createCollection = async ({ id, name, description }: { id?: string; name?: string; description?: string }) => {
|
|
38
|
+
// try {
|
|
39
|
+
// if (id) {
|
|
40
|
+
// await datasetState.updateDataset(id, { name, description });
|
|
41
|
+
// setEditTarget(undefined);
|
|
42
|
+
// } else {
|
|
43
|
+
// const dataset = await datasetState.createDataset({ name, description });
|
|
44
|
+
// setEditTarget(undefined);
|
|
45
|
+
// navigate({ page: 'collection', datasetId: dataset.id });
|
|
46
|
+
// }
|
|
47
|
+
// } catch (error) {
|
|
48
|
+
// Toast.error(error.message);
|
|
49
|
+
// console.error('create collection error', error);
|
|
50
|
+
// }
|
|
51
|
+
// };
|
|
52
|
+
// const onEdit = async (item: Dataset) => {
|
|
53
|
+
// if (!authSession.user) {
|
|
54
|
+
// await new Promise<void>((resolve) => {
|
|
55
|
+
// authSession.login(() => resolve());
|
|
56
|
+
// });
|
|
57
|
+
// }
|
|
58
|
+
// setEditTarget(item);
|
|
59
|
+
// };
|
|
60
|
+
// return (
|
|
61
|
+
// <Layout>
|
|
62
|
+
// <Stack my={2.5}>
|
|
63
|
+
// <Typography component="h1" sx={{ fontSize: 18, lineHeight: '32px', fontWeight: 500, textAlign: 'center' }}>
|
|
64
|
+
// {t('collections')}
|
|
65
|
+
// </Typography>
|
|
66
|
+
// </Stack>
|
|
67
|
+
// <CollectionsView releaseId={releaseId} onEdit={onEdit} />
|
|
68
|
+
// <CollectionEditDialog
|
|
69
|
+
// DialogProps={{ open: !!editTarget, onClose: () => setEditTarget(undefined) }}
|
|
70
|
+
// defaultValues={editTarget}
|
|
71
|
+
// onSubmit={createCollection}
|
|
72
|
+
// />
|
|
73
|
+
// </Layout>
|
|
74
|
+
// );
|
|
75
|
+
// }
|
|
76
|
+
// function CollectionsView({ releaseId, onEdit }: { releaseId: string; onEdit?: (dataset?: Dataset) => void }) {
|
|
77
|
+
// const { t } = useLocaleContext();
|
|
78
|
+
// const datasetState = createDatasetState({ releaseId })();
|
|
79
|
+
// const to = useNavigateTo();
|
|
80
|
+
// const [menuState, setMenuState] = useState<{
|
|
81
|
+
// anchorEl: HTMLElement;
|
|
82
|
+
// dataset: Dataset;
|
|
83
|
+
// }>();
|
|
84
|
+
// return (
|
|
85
|
+
// <>
|
|
86
|
+
// <Stack
|
|
87
|
+
// gap={1.5}
|
|
88
|
+
// sx={{
|
|
89
|
+
// userSelect: 'none',
|
|
90
|
+
// '.item': {
|
|
91
|
+
// '.item-content': {
|
|
92
|
+
// borderRadius: 1,
|
|
93
|
+
// cursor: 'pointer',
|
|
94
|
+
// display: 'flex',
|
|
95
|
+
// flexDirection: 'row',
|
|
96
|
+
// alignItems: 'center',
|
|
97
|
+
// gap: 1,
|
|
98
|
+
// pl: 2.5,
|
|
99
|
+
// pr: 1.5,
|
|
100
|
+
// boxShadow: 1,
|
|
101
|
+
// bgcolor: 'background.paper',
|
|
102
|
+
// '.item-title': {
|
|
103
|
+
// py: 1.5,
|
|
104
|
+
// },
|
|
105
|
+
// },
|
|
106
|
+
// '.hover-visible': { display: 'none' },
|
|
107
|
+
// '&.active,:hover': {
|
|
108
|
+
// '.item-content': {
|
|
109
|
+
// boxShadow: 2,
|
|
110
|
+
// '.hover-visible': {
|
|
111
|
+
// display: 'block',
|
|
112
|
+
// },
|
|
113
|
+
// },
|
|
114
|
+
// },
|
|
115
|
+
// },
|
|
116
|
+
// }}>
|
|
117
|
+
// {!datasetState.list?.length && (
|
|
118
|
+
// <Stack alignItems="center" gap={0.5} mt="10vh" mx={3}>
|
|
119
|
+
// {datasetState.loading ? (
|
|
120
|
+
// <CircularProgress size={24} />
|
|
121
|
+
// ) : (
|
|
122
|
+
// <>
|
|
123
|
+
// <Typography fontSize={18}>📚</Typography>
|
|
124
|
+
// <Typography fontSize={12} sx={{ color: 'text.secondary' }}>
|
|
125
|
+
// {t('noData', { data: t('collection') })}
|
|
126
|
+
// </Typography>
|
|
127
|
+
// </>
|
|
128
|
+
// )}
|
|
129
|
+
// </Stack>
|
|
130
|
+
// )}
|
|
131
|
+
// {datasetState.list?.map((item) => (
|
|
132
|
+
// <Stack
|
|
133
|
+
// key={item.id}
|
|
134
|
+
// className={`item ${item.id === menuState?.dataset?.id ? 'active' : ''}`}
|
|
135
|
+
// component={RouterLink}
|
|
136
|
+
// to={to({ page: 'collection', datasetId: item.id })}>
|
|
137
|
+
// <Stack className="item-content">
|
|
138
|
+
// <Typography className="item-title" noWrap flex={1} fontSize={13} fontWeight={500}>
|
|
139
|
+
// {item.name || t('unnamed')}
|
|
140
|
+
// </Typography>
|
|
141
|
+
// <Box className="hover-visible">
|
|
142
|
+
// <Button
|
|
143
|
+
// sx={{ minWidth: 28, minHeight: 28, p: 0 }}
|
|
144
|
+
// onClick={(e) => {
|
|
145
|
+
// e.preventDefault();
|
|
146
|
+
// setMenuState({
|
|
147
|
+
// anchorEl: e.currentTarget,
|
|
148
|
+
// dataset: item,
|
|
149
|
+
// });
|
|
150
|
+
// }}>
|
|
151
|
+
// <Icon icon="mdi:more-horiz" fontSize={18} />
|
|
152
|
+
// </Button>
|
|
153
|
+
// </Box>
|
|
154
|
+
// </Stack>
|
|
155
|
+
// </Stack>
|
|
156
|
+
// ))}
|
|
157
|
+
// <Box textAlign="center">
|
|
158
|
+
// <Button onClick={() => onEdit?.({})}>{t('createObject', { object: t('collection') })}</Button>
|
|
159
|
+
// </Box>
|
|
160
|
+
// </Stack>
|
|
161
|
+
// <Popper
|
|
162
|
+
// open={Boolean(menuState)}
|
|
163
|
+
// anchorEl={menuState?.anchorEl}
|
|
164
|
+
// placement="bottom-end"
|
|
165
|
+
// sx={{ zIndex: (theme) => theme.zIndex.modal + 1 }}>
|
|
166
|
+
// <ClickAwayListener onClickAway={() => setMenuState(undefined)}>
|
|
167
|
+
// <Paper
|
|
168
|
+
// sx={{
|
|
169
|
+
// mx: 1,
|
|
170
|
+
// mt: -0.25,
|
|
171
|
+
// boxShadow: `0px 8px 16px 0px rgba(2, 7, 19, 0.08), 0px 0px 0px 1px rgba(2, 7, 19, 0.08)`,
|
|
172
|
+
// }}>
|
|
173
|
+
// <List dense sx={{ p: 0.5, '.MuiButtonBase-root': { borderRadius: 1 } }}>
|
|
174
|
+
// <ListItemButton
|
|
175
|
+
// onClick={async () => {
|
|
176
|
+
// if (!menuState?.dataset) return;
|
|
177
|
+
// setMenuState(undefined);
|
|
178
|
+
// onEdit?.(menuState.dataset);
|
|
179
|
+
// }}>
|
|
180
|
+
// {t('rename')}
|
|
181
|
+
// </ListItemButton>
|
|
182
|
+
// <LoadingListItemButton
|
|
183
|
+
// sx={{ color: 'error.main' }}
|
|
184
|
+
// onClick={async () => {
|
|
185
|
+
// if (!menuState?.dataset) return;
|
|
186
|
+
// await datasetState.deleteDataset(menuState.dataset.id);
|
|
187
|
+
// setMenuState(undefined);
|
|
188
|
+
// }}>
|
|
189
|
+
// {t('delete')}
|
|
190
|
+
// </LoadingListItemButton>
|
|
191
|
+
// </List>
|
|
192
|
+
// </Paper>
|
|
193
|
+
// </ClickAwayListener>
|
|
194
|
+
// </Popper>
|
|
195
|
+
// </>
|
|
196
|
+
// );
|
|
197
|
+
// }
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { Icon } from '@iconify/react';
|
|
3
|
+
// import { Button, Stack, Typography } from '@mui/material';
|
|
4
|
+
// import { useEffect, useState } from 'react';
|
|
5
|
+
// import { Result, Toast } from '../../../../arcblock/ux';
|
|
6
|
+
// import { useLocaleContext } from '../../../../locale';
|
|
7
|
+
// import { getSessions } from '../../api/session';
|
|
8
|
+
// import { useCurrentPage, useNavigateTo, useNavigateWithQuery } from '../../hooks/navigate';
|
|
9
|
+
// import { createDatasetDetailState, createState } from '../../state';
|
|
10
|
+
// import { parseIdentity } from '../../utils';
|
|
11
|
+
// import { globalLoadingState } from '../GlobalLoading';
|
|
12
|
+
// import Layout from '../layout';
|
|
13
|
+
// import LoadingButton from '../LoadingButton';
|
|
14
|
+
// export default function CollectionView({ releaseId }: { releaseId: string }) {
|
|
15
|
+
// const { t } = useLocaleContext();
|
|
16
|
+
// const state = createState({ releaseId })();
|
|
17
|
+
// const { datasetId } = useCurrentPage();
|
|
18
|
+
// if (!datasetId) throw new Error('Invalid datasetId');
|
|
19
|
+
// const datasetState = createDatasetDetailState({ datasetId })();
|
|
20
|
+
// const to = useNavigateTo();
|
|
21
|
+
// const navigate = useNavigateWithQuery();
|
|
22
|
+
// useEffect(() => {
|
|
23
|
+
// datasetState.reload();
|
|
24
|
+
// }, []);
|
|
25
|
+
// const startChat = async () => {
|
|
26
|
+
// try {
|
|
27
|
+
// const identity = parseIdentity(releaseId);
|
|
28
|
+
// await globalLoadingState.getState().run(async () => {
|
|
29
|
+
// const { sessions } = await getSessions(identity);
|
|
30
|
+
// const session =
|
|
31
|
+
// sessions?.find((i) => i.parameters.datasetId === datasetId) ??
|
|
32
|
+
// (await state.createSession({ name: datasetState.dataset?.name, parameters: { datasetId } }));
|
|
33
|
+
// navigate({ page: 'session', sessionId: session.id });
|
|
34
|
+
// });
|
|
35
|
+
// } catch (error) {
|
|
36
|
+
// Toast.error(error.message);
|
|
37
|
+
// console.error('create session error', error);
|
|
38
|
+
// }
|
|
39
|
+
// };
|
|
40
|
+
// const [uploading, setUploading] = useState(false);
|
|
41
|
+
// const handleUploadFile = () => {
|
|
42
|
+
// const input = document.createElement('input');
|
|
43
|
+
// input.type = 'file';
|
|
44
|
+
// input.accept = '*.pdf,*.txt,*.doc,*.docx';
|
|
45
|
+
// input.onchange = async (e) => {
|
|
46
|
+
// const files = [...e.target.files];
|
|
47
|
+
// if (!files.length) return;
|
|
48
|
+
// try {
|
|
49
|
+
// setUploading(true);
|
|
50
|
+
// await Promise.all(files.map((file) => datasetState.createDocument('file', file)));
|
|
51
|
+
// } catch (error) {
|
|
52
|
+
// Toast.error(error.message);
|
|
53
|
+
// throw error;
|
|
54
|
+
// } finally {
|
|
55
|
+
// setUploading(false);
|
|
56
|
+
// }
|
|
57
|
+
// };
|
|
58
|
+
// input.click();
|
|
59
|
+
// };
|
|
60
|
+
// if (datasetState.error) {
|
|
61
|
+
// return <Result status="error" title={datasetState.error.message} sx={{ bgcolor: 'transparent', my: 10 }} />;
|
|
62
|
+
// }
|
|
63
|
+
// return (
|
|
64
|
+
// <Layout>
|
|
65
|
+
// <Stack mt={5} mb={2.5} alignItems="flex-start">
|
|
66
|
+
// <Button
|
|
67
|
+
// sx={{ ml: -0.5 }}
|
|
68
|
+
// startIcon={<Icon icon="tabler:chevron-left" />}
|
|
69
|
+
// component={RouterLink}
|
|
70
|
+
// to={to({ page: 'collections', datasetId: undefined })}>
|
|
71
|
+
// {t('back')}
|
|
72
|
+
// </Button>
|
|
73
|
+
// <Stack
|
|
74
|
+
// width="100%"
|
|
75
|
+
// direction="row"
|
|
76
|
+
// flexWrap="wrap"
|
|
77
|
+
// py={2.5}
|
|
78
|
+
// gap={1}
|
|
79
|
+
// justifyContent="space-between"
|
|
80
|
+
// alignItems="center"
|
|
81
|
+
// borderBottom={1}
|
|
82
|
+
// borderColor="divider">
|
|
83
|
+
// <Stack>
|
|
84
|
+
// <Typography component="h1" sx={{ fontSize: 32, lineHeight: '44px', fontWeight: 700 }}>
|
|
85
|
+
// {datasetState.dataset ? datasetState.dataset.name || t('unnamed') : null}
|
|
86
|
+
// </Typography>
|
|
87
|
+
// <Typography>{datasetState.dataset?.description}</Typography>
|
|
88
|
+
// </Stack>
|
|
89
|
+
// <Stack direction="row" alignItems="center" gap={1}>
|
|
90
|
+
// <LoadingButton
|
|
91
|
+
// startIcon={<Icon icon="tabler:upload" />}
|
|
92
|
+
// variant="outlined"
|
|
93
|
+
// color="black"
|
|
94
|
+
// loading={uploading}
|
|
95
|
+
// loadingPosition="start"
|
|
96
|
+
// onClick={() => handleUploadFile()}>
|
|
97
|
+
// {t('uploadFile')}
|
|
98
|
+
// </LoadingButton>
|
|
99
|
+
// <Button
|
|
100
|
+
// startIcon={<Icon icon="tabler:plus" />}
|
|
101
|
+
// variant="outlined"
|
|
102
|
+
// color="black"
|
|
103
|
+
// onClick={() => navigate({ page: 'document', documentId: '' })}>
|
|
104
|
+
// {t('newObject', { object: t('document') })}
|
|
105
|
+
// </Button>
|
|
106
|
+
// <LoadingButton
|
|
107
|
+
// color="black"
|
|
108
|
+
// startIcon={<Icon icon="tabler:message-circle-2" />}
|
|
109
|
+
// variant="contained"
|
|
110
|
+
// onClick={startChat}>
|
|
111
|
+
// {t('chat')}
|
|
112
|
+
// </LoadingButton>
|
|
113
|
+
// </Stack>
|
|
114
|
+
// </Stack>
|
|
115
|
+
// </Stack>
|
|
116
|
+
// <DocumentListView
|
|
117
|
+
// datasetId={datasetId}
|
|
118
|
+
// onEdit={(document) => navigate({ page: 'document', documentId: document?.id || '' })}
|
|
119
|
+
// />
|
|
120
|
+
// </Layout>
|
|
121
|
+
// );
|
|
122
|
+
// }
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { Icon } from '@iconify/react';
|
|
3
|
+
// import {
|
|
4
|
+
// Box,
|
|
5
|
+
// Button,
|
|
6
|
+
// CircularProgress,
|
|
7
|
+
// ClickAwayListener,
|
|
8
|
+
// Divider,
|
|
9
|
+
// Grid,
|
|
10
|
+
// List,
|
|
11
|
+
// ListItemButton,
|
|
12
|
+
// Paper,
|
|
13
|
+
// Popper,
|
|
14
|
+
// Stack,
|
|
15
|
+
// Typography,
|
|
16
|
+
// } from '@mui/material';
|
|
17
|
+
// import { useState } from 'react';
|
|
18
|
+
// import { useLocaleContext } from '../../../../locale';
|
|
19
|
+
// import { createDatasetDetailState } from '../../state';
|
|
20
|
+
// import LoadingListItemButton from '../LoadingListItemButton';
|
|
21
|
+
// export default function DocumentListView({
|
|
22
|
+
// datasetId,
|
|
23
|
+
// onEdit,
|
|
24
|
+
// }: {
|
|
25
|
+
// datasetId: string;
|
|
26
|
+
// onEdit: (doc?: Document) => void;
|
|
27
|
+
// }) {
|
|
28
|
+
// const { t } = useLocaleContext();
|
|
29
|
+
// const state = createDatasetDetailState({ datasetId })();
|
|
30
|
+
// const [menuState, setMenuState] = useState<{
|
|
31
|
+
// anchorEl: HTMLElement;
|
|
32
|
+
// item: Document;
|
|
33
|
+
// }>();
|
|
34
|
+
// return (
|
|
35
|
+
// <Stack>
|
|
36
|
+
// {!state.list?.length && (
|
|
37
|
+
// <Stack textAlign="center" alignItems="center" gap={0.5} mt="10vh" mx={3}>
|
|
38
|
+
// {state.loading ? (
|
|
39
|
+
// <CircularProgress size={24} />
|
|
40
|
+
// ) : (
|
|
41
|
+
// <>
|
|
42
|
+
// <Typography fontSize={18}>{'📄'}</Typography>
|
|
43
|
+
// <Typography fontSize={12} sx={{ color: 'text.secondary' }}>
|
|
44
|
+
// {t('noData', { data: t('document') })}
|
|
45
|
+
// </Typography>
|
|
46
|
+
// <Button onClick={() => onEdit()}>{t('createObject', { object: t('document') })}</Button>
|
|
47
|
+
// </>
|
|
48
|
+
// )}
|
|
49
|
+
// </Stack>
|
|
50
|
+
// )}
|
|
51
|
+
// <Grid container spacing={2} pt="1px">
|
|
52
|
+
// {state.list?.map((item) => (
|
|
53
|
+
// <Grid key={item.id} item xs={6} sm={4} md={3} onClick={() => onEdit(item)}>
|
|
54
|
+
// <Box
|
|
55
|
+
// sx={{
|
|
56
|
+
// width: '100%',
|
|
57
|
+
// position: 'relative',
|
|
58
|
+
// ':before': { content: '""', display: 'block', paddingBottom: '141.4%' },
|
|
59
|
+
// }}>
|
|
60
|
+
// <Paper
|
|
61
|
+
// className={menuState?.item.id === item.id ? 'menu-active' : ''}
|
|
62
|
+
// sx={{
|
|
63
|
+
// position: 'absolute',
|
|
64
|
+
// left: 0,
|
|
65
|
+
// top: 0,
|
|
66
|
+
// width: '100%',
|
|
67
|
+
// height: '100%',
|
|
68
|
+
// overflow: 'hidden',
|
|
69
|
+
// boxShadow: 1,
|
|
70
|
+
// display: 'flex',
|
|
71
|
+
// flexDirection: 'column',
|
|
72
|
+
// pb: 1,
|
|
73
|
+
// cursor: 'pointer',
|
|
74
|
+
// '.hover-visible': { display: 'none' },
|
|
75
|
+
// ':hover, &.menu-active': {
|
|
76
|
+
// boxShadow: 2,
|
|
77
|
+
// '.hover-visible': {
|
|
78
|
+
// display: 'flex',
|
|
79
|
+
// },
|
|
80
|
+
// },
|
|
81
|
+
// }}>
|
|
82
|
+
// <Stack direction="row" sx={{ px: 2, pt: 1.5 }}>
|
|
83
|
+
// <Typography variant="subtitle2" noWrap sx={{ flex: 1, lineHeight: '24px', minHeight: 24 }}>
|
|
84
|
+
// {item.name}
|
|
85
|
+
// </Typography>
|
|
86
|
+
// <Box className="hover-visible">
|
|
87
|
+
// <Button
|
|
88
|
+
// sx={{ minWidth: 24, minHeight: 24, p: 0 }}
|
|
89
|
+
// onClick={(e) => {
|
|
90
|
+
// e.stopPropagation();
|
|
91
|
+
// e.preventDefault();
|
|
92
|
+
// setMenuState({
|
|
93
|
+
// anchorEl: e.currentTarget,
|
|
94
|
+
// item,
|
|
95
|
+
// });
|
|
96
|
+
// }}>
|
|
97
|
+
// <Icon icon="mdi:more-horiz" fontSize={18} />
|
|
98
|
+
// </Button>
|
|
99
|
+
// </Box>
|
|
100
|
+
// </Stack>
|
|
101
|
+
// <Divider sx={{ mx: 2, my: 1 }} />
|
|
102
|
+
// <Typography
|
|
103
|
+
// sx={{
|
|
104
|
+
// flex: 1,
|
|
105
|
+
// px: 2,
|
|
106
|
+
// overflow: 'hidden',
|
|
107
|
+
// wordBreak: 'break-word',
|
|
108
|
+
// fontSize: 10,
|
|
109
|
+
// lineHeight: '16px',
|
|
110
|
+
// }}>
|
|
111
|
+
// {item.content}
|
|
112
|
+
// </Typography>
|
|
113
|
+
// </Paper>
|
|
114
|
+
// </Box>
|
|
115
|
+
// </Grid>
|
|
116
|
+
// ))}
|
|
117
|
+
// </Grid>
|
|
118
|
+
// <Popper
|
|
119
|
+
// open={Boolean(menuState)}
|
|
120
|
+
// anchorEl={menuState?.anchorEl}
|
|
121
|
+
// placement="bottom-start"
|
|
122
|
+
// sx={{ zIndex: (theme) => theme.zIndex.modal + 1 }}>
|
|
123
|
+
// <ClickAwayListener onClickAway={() => setMenuState(undefined)}>
|
|
124
|
+
// <Paper
|
|
125
|
+
// sx={{
|
|
126
|
+
// boxShadow: `0px 8px 16px 0px rgba(2, 7, 19, 0.08), 0px 0px 0px 1px rgba(2, 7, 19, 0.08)`,
|
|
127
|
+
// }}>
|
|
128
|
+
// <List dense sx={{ p: 0.5, '.MuiButtonBase-root': { borderRadius: 1 } }}>
|
|
129
|
+
// <ListItemButton
|
|
130
|
+
// onClick={async () => {
|
|
131
|
+
// if (!menuState?.item) return;
|
|
132
|
+
// onEdit(menuState.item);
|
|
133
|
+
// setMenuState(undefined);
|
|
134
|
+
// }}>
|
|
135
|
+
// {t('edit')}
|
|
136
|
+
// </ListItemButton>
|
|
137
|
+
// <LoadingListItemButton
|
|
138
|
+
// sx={{ color: 'error.main' }}
|
|
139
|
+
// onClick={async () => {
|
|
140
|
+
// if (!menuState?.item) return;
|
|
141
|
+
// await state.deleteDocument(menuState.item.id);
|
|
142
|
+
// setMenuState(undefined);
|
|
143
|
+
// }}>
|
|
144
|
+
// {t('delete')}
|
|
145
|
+
// </LoadingListItemButton>
|
|
146
|
+
// </List>
|
|
147
|
+
// </Paper>
|
|
148
|
+
// </ClickAwayListener>
|
|
149
|
+
// </Popper>
|
|
150
|
+
// </Stack>
|
|
151
|
+
// );
|
|
152
|
+
// }
|