@tachybase/client 0.23.17 → 0.23.18
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/es/built-in/assistant/Assistant.provider.d.ts +5 -0
- package/es/built-in/assistant/Assistant.provider.mjs +64 -16
- package/es/built-in/assistant/context.d.ts +3 -0
- package/es/built-in/assistant/context.mjs +6 -0
- package/es/built-in/assistant/index.d.ts +3 -0
- package/es/built-in/assistant/index.mjs +6 -2
- package/es/i18n/i18n.mjs +12 -10
- package/es/index.d.ts +1 -0
- package/es/index.mjs +1 -0
- package/lib/built-in/assistant/Assistant.provider.js +66 -30
- package/lib/built-in/assistant/{ai-chat/index.module.js → context.js} +6 -30
- package/lib/built-in/assistant/index.js +71 -10
- package/lib/i18n/i18n.js +12 -10
- package/lib/index.js +86 -71
- package/package.json +7 -7
- package/es/built-in/assistant/ai-chat/index.d.ts +0 -8
- package/es/built-in/assistant/ai-chat/index.mjs +0 -330
- package/es/built-in/assistant/ai-chat/index.module.mjs +0 -30
- package/es/built-in/assistant/ai-chat/index_module.css +0 -257
- package/lib/built-in/assistant/ai-chat/index.js +0 -378
- package/lib/built-in/assistant/ai-chat/index_module.css +0 -257
|
@@ -2,3 +2,8 @@ import React from 'react';
|
|
|
2
2
|
export declare const AssistantProvider: ({ children }: {
|
|
3
3
|
children: any;
|
|
4
4
|
}) => React.JSX.Element;
|
|
5
|
+
export declare const AssistantListProvider: (props: {
|
|
6
|
+
items: any;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}) => React.JSX.Element;
|
|
9
|
+
export declare const AssistantList: () => React.JSX.Element;
|
|
@@ -1,20 +1,41 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
3
4
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
|
|
4
5
|
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
|
5
8
|
import * as __WEBPACK_EXTERNAL_MODULE_react_hotkeys_hook__ from "react-hotkeys-hook";
|
|
6
9
|
import * as __WEBPACK_EXTERNAL_MODULE__icon_index_mjs__ from "../../icon/index.mjs";
|
|
7
10
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../schema-component/index.mjs";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE__acl_index_mjs__ from "../acl/index.mjs";
|
|
8
12
|
import * as __WEBPACK_EXTERNAL_MODULE__context_menu_index_mjs__ from "../context-menu/index.mjs";
|
|
9
|
-
import * as __WEBPACK_EXTERNAL_MODULE__ai_chat_index_mjs__ from "./ai-chat/index.mjs";
|
|
10
13
|
import * as __WEBPACK_EXTERNAL_MODULE__calculator_CalculatorProvider_mjs__ from "./calculator/CalculatorProvider.mjs";
|
|
14
|
+
import * as __WEBPACK_EXTERNAL_MODULE__context_mjs__ from "./context.mjs";
|
|
11
15
|
import * as __WEBPACK_EXTERNAL_MODULE__search_and_jump_index_mjs__ from "./search-and-jump/index.mjs";
|
|
16
|
+
function _tagged_template_literal(strings, raw) {
|
|
17
|
+
if (!raw) raw = strings.slice(0);
|
|
18
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
19
|
+
raw: {
|
|
20
|
+
value: Object.freeze(raw)
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
function _templateObject() {
|
|
25
|
+
const data = _tagged_template_literal([
|
|
26
|
+
"\n display: inline-block;\n .ant-btn {\n border: 0;\n height: var(--tb-header-height);\n width: 46px;\n border-radius: 0;\n color: rgba(255, 255, 255, 0.65);\n &:hover {\n background: rgba(255, 255, 255, 0.1) !important;\n }\n }\n "
|
|
27
|
+
]);
|
|
28
|
+
_templateObject = function() {
|
|
29
|
+
return data;
|
|
30
|
+
};
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
12
33
|
const AssistantProvider = (param)=>{
|
|
13
34
|
let { children } = param;
|
|
14
35
|
const { designable, setDesignable } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
|
|
15
36
|
const { visible, setVisible } = (0, __WEBPACK_EXTERNAL_MODULE__calculator_CalculatorProvider_mjs__.useCalculator)();
|
|
16
37
|
const { setOpen } = (0, __WEBPACK_EXTERNAL_MODULE__search_and_jump_index_mjs__.useSearchAndJump)();
|
|
17
|
-
|
|
38
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)();
|
|
18
39
|
(0, __WEBPACK_EXTERNAL_MODULE_react_hotkeys_hook__.useHotkeys)('Ctrl+Shift+U', ()=>setDesignable(!designable), [
|
|
19
40
|
designable
|
|
20
41
|
]);
|
|
@@ -24,11 +45,6 @@ const AssistantProvider = (param)=>{
|
|
|
24
45
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
|
|
25
46
|
children: [
|
|
26
47
|
children,
|
|
27
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ai_chat_index_mjs__["default"], {
|
|
28
|
-
mRef: ref,
|
|
29
|
-
onGenerateLoad: async (msg)=>true,
|
|
30
|
-
onReloadWrite: ()=>{}
|
|
31
|
-
}),
|
|
32
48
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_antd__.FloatButton.Group, {
|
|
33
49
|
trigger: "hover",
|
|
34
50
|
type: "default",
|
|
@@ -56,22 +72,54 @@ const AssistantProvider = (param)=>{
|
|
|
56
72
|
setVisible((visible)=>!visible);
|
|
57
73
|
}
|
|
58
74
|
}),
|
|
59
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.FloatButton, {
|
|
60
|
-
icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.CommentOutlined, {}),
|
|
61
|
-
onClick: ()=>{
|
|
62
|
-
var _ref_current;
|
|
63
|
-
null === (_ref_current = ref.current) || void 0 === _ref_current || _ref_current.openModal();
|
|
64
|
-
}
|
|
65
|
-
}),
|
|
66
75
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.FloatButton, {
|
|
67
76
|
type: contextMenuEnabled ? 'primary' : 'default',
|
|
68
77
|
icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.ToolOutlined, {
|
|
69
78
|
onClick: ()=>setContextMenuEnable(!contextMenuEnabled)
|
|
70
79
|
})
|
|
71
|
-
})
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(AssistantList, {})
|
|
72
82
|
]
|
|
73
83
|
})
|
|
74
84
|
]
|
|
75
85
|
});
|
|
76
86
|
};
|
|
77
|
-
|
|
87
|
+
const AssistantListProvider = (props)=>{
|
|
88
|
+
const { children, items } = props;
|
|
89
|
+
const ctx = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__context_mjs__.AssistantListContext);
|
|
90
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
|
|
91
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__context_mjs__.AssistantListContext.Provider, {
|
|
92
|
+
value: {
|
|
93
|
+
items: {
|
|
94
|
+
...ctx.items,
|
|
95
|
+
...items
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
children: children
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
const useStyles = (0, __WEBPACK_EXTERNAL_MODULE_antd_style__.createStyles)((param)=>{
|
|
103
|
+
let { css } = param;
|
|
104
|
+
return {
|
|
105
|
+
container: css(_templateObject())
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
const AssistantList = ()=>{
|
|
109
|
+
const { allowAll, snippets } = (0, __WEBPACK_EXTERNAL_MODULE__acl_index_mjs__.useACLRoleContext)();
|
|
110
|
+
const getSnippetsAllow = function(aclKey) {
|
|
111
|
+
let isPublic = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
112
|
+
return allowAll || isPublic || (null == snippets ? void 0 : snippets.includes(aclKey));
|
|
113
|
+
};
|
|
114
|
+
const { styles } = useStyles();
|
|
115
|
+
const ctx = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__context_mjs__.AssistantListContext);
|
|
116
|
+
const { components } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.SchemaOptionsContext);
|
|
117
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
|
|
118
|
+
className: styles.container,
|
|
119
|
+
children: Object.keys(ctx.items).sort((a, b)=>ctx.items[a].order - ctx.items[b].order).filter((key)=>getSnippetsAllow(ctx.items[key].snippet, ctx.items[key].isPublic)).map((key)=>{
|
|
120
|
+
const Action = (0, __WEBPACK_EXTERNAL_MODULE_lodash__.get)(components, ctx.items[key].component);
|
|
121
|
+
return Action ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(Action, {}, key) : null;
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
export { AssistantList, AssistantListProvider, AssistantProvider };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE__application_Plugin_mjs__ from "../../application/Plugin.mjs";
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE__Assistant_provider_mjs__ from "./Assistant.provider.mjs";
|
|
3
2
|
import * as __WEBPACK_EXTERNAL_MODULE__calculator_CalculatorProvider_mjs__ from "./calculator/CalculatorProvider.mjs";
|
|
4
3
|
import * as __WEBPACK_EXTERNAL_MODULE__search_and_jump_index_mjs__ from "./search-and-jump/index.mjs";
|
|
4
|
+
export * from "./context.mjs";
|
|
5
|
+
export * from "./Assistant.provider.mjs";
|
|
5
6
|
class PluginAssistant extends __WEBPACK_EXTERNAL_MODULE__application_Plugin_mjs__.Plugin {
|
|
6
7
|
async load() {
|
|
7
8
|
this.app.use(__WEBPACK_EXTERNAL_MODULE__search_and_jump_index_mjs__.SearchAndJumpProvider);
|
|
8
9
|
this.app.use(__WEBPACK_EXTERNAL_MODULE__calculator_CalculatorProvider_mjs__.CalculatorProvider);
|
|
9
|
-
this.app.use(
|
|
10
|
+
this.app.use(AssistantListProvider, this.options.config);
|
|
11
|
+
}
|
|
12
|
+
async afterLoad() {
|
|
13
|
+
this.app.use(AssistantProvider);
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
export { PluginAssistant };
|
package/es/i18n/i18n.mjs
CHANGED
|
@@ -10,14 +10,16 @@ const resources = {};
|
|
|
10
10
|
Object.keys(__WEBPACK_EXTERNAL_MODULE__locale_index_mjs__["default"]).forEach((lang)=>{
|
|
11
11
|
resources[lang] = __WEBPACK_EXTERNAL_MODULE__locale_index_mjs__["default"][lang].resources;
|
|
12
12
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
if ('undefined' != typeof localStorage) {
|
|
14
|
+
i18n.use(__WEBPACK_EXTERNAL_MODULE_react_i18next__.initReactI18next).init({
|
|
15
|
+
lng: localStorage.getItem('TACHYBASE_LOCALE') || 'en-US',
|
|
16
|
+
defaultNS: 'core',
|
|
17
|
+
resources: {},
|
|
18
|
+
keySeparator: false,
|
|
19
|
+
nsSeparator: false
|
|
20
|
+
});
|
|
21
|
+
i18n.on('languageChanged', (lng)=>{
|
|
22
|
+
localStorage.setItem('TACHYBASE_LOCALE', lng);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
23
25
|
export { i18n, tval };
|
package/es/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from './i18n';
|
|
|
18
18
|
export * from './icon';
|
|
19
19
|
export { default as locale } from './locale';
|
|
20
20
|
export * from './built-in';
|
|
21
|
+
export * from './built-in/assistant';
|
|
21
22
|
export * from './built-in/pinned-list';
|
|
22
23
|
export * from './built-in/pm';
|
|
23
24
|
export * from './powered-by';
|
package/es/index.mjs
CHANGED
|
@@ -21,6 +21,7 @@ export * from "./hooks/index.mjs";
|
|
|
21
21
|
export * from "./i18n/index.mjs";
|
|
22
22
|
export * from "./icon/index.mjs";
|
|
23
23
|
export * from "./built-in/index.mjs";
|
|
24
|
+
export * from "./built-in/assistant/index.mjs";
|
|
24
25
|
export * from "./built-in/pinned-list/index.mjs";
|
|
25
26
|
export * from "./built-in/pm/index.mjs";
|
|
26
27
|
export * from "./powered-by/index.mjs";
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = function(module) {
|
|
5
|
-
var getter = module && module.__esModule ? function() {
|
|
6
|
-
return module['default'];
|
|
7
|
-
} : function() {
|
|
8
|
-
return module;
|
|
9
|
-
};
|
|
10
|
-
__webpack_require__.d(getter, {
|
|
11
|
-
a: getter
|
|
12
|
-
});
|
|
13
|
-
return getter;
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
3
|
(()=>{
|
|
17
4
|
__webpack_require__.d = function(exports1, definition) {
|
|
18
5
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -39,26 +26,48 @@ var __webpack_require__ = {};
|
|
|
39
26
|
var __webpack_exports__ = {};
|
|
40
27
|
__webpack_require__.r(__webpack_exports__);
|
|
41
28
|
__webpack_require__.d(__webpack_exports__, {
|
|
42
|
-
AssistantProvider: ()=>AssistantProvider
|
|
29
|
+
AssistantProvider: ()=>AssistantProvider,
|
|
30
|
+
AssistantList: ()=>AssistantList,
|
|
31
|
+
AssistantListProvider: ()=>AssistantListProvider
|
|
43
32
|
});
|
|
44
33
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
45
34
|
const external_react_namespaceObject = require("react");
|
|
35
|
+
const schema_namespaceObject = require("@tachybase/schema");
|
|
46
36
|
const icons_namespaceObject = require("@ant-design/icons");
|
|
47
37
|
const external_antd_namespaceObject = require("antd");
|
|
38
|
+
const external_antd_style_namespaceObject = require("antd-style");
|
|
39
|
+
const external_lodash_namespaceObject = require("lodash");
|
|
48
40
|
const external_react_hotkeys_hook_namespaceObject = require("react-hotkeys-hook");
|
|
49
41
|
const index_js_namespaceObject = require("../../icon/index.js");
|
|
50
42
|
const external_schema_component_index_js_namespaceObject = require("../../schema-component/index.js");
|
|
43
|
+
const external_acl_index_js_namespaceObject = require("../acl/index.js");
|
|
51
44
|
const external_context_menu_index_js_namespaceObject = require("../context-menu/index.js");
|
|
52
|
-
const external_ai_chat_index_js_namespaceObject = require("./ai-chat/index.js");
|
|
53
|
-
var external_ai_chat_index_js_default = /*#__PURE__*/ __webpack_require__.n(external_ai_chat_index_js_namespaceObject);
|
|
54
45
|
const CalculatorProvider_js_namespaceObject = require("./calculator/CalculatorProvider.js");
|
|
46
|
+
const external_context_js_namespaceObject = require("./context.js");
|
|
55
47
|
const external_search_and_jump_index_js_namespaceObject = require("./search-and-jump/index.js");
|
|
48
|
+
function _tagged_template_literal(strings, raw) {
|
|
49
|
+
if (!raw) raw = strings.slice(0);
|
|
50
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
51
|
+
raw: {
|
|
52
|
+
value: Object.freeze(raw)
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
function _templateObject() {
|
|
57
|
+
const data = _tagged_template_literal([
|
|
58
|
+
"\n display: inline-block;\n .ant-btn {\n border: 0;\n height: var(--tb-header-height);\n width: 46px;\n border-radius: 0;\n color: rgba(255, 255, 255, 0.65);\n &:hover {\n background: rgba(255, 255, 255, 0.1) !important;\n }\n }\n "
|
|
59
|
+
]);
|
|
60
|
+
_templateObject = function() {
|
|
61
|
+
return data;
|
|
62
|
+
};
|
|
63
|
+
return data;
|
|
64
|
+
}
|
|
56
65
|
const AssistantProvider = (param)=>{
|
|
57
66
|
let { children } = param;
|
|
58
67
|
const { designable, setDesignable } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
|
|
59
68
|
const { visible, setVisible } = (0, CalculatorProvider_js_namespaceObject.useCalculator)();
|
|
60
69
|
const { setOpen } = (0, external_search_and_jump_index_js_namespaceObject.useSearchAndJump)();
|
|
61
|
-
|
|
70
|
+
(0, external_react_namespaceObject.useRef)();
|
|
62
71
|
(0, external_react_hotkeys_hook_namespaceObject.useHotkeys)('Ctrl+Shift+U', ()=>setDesignable(!designable), [
|
|
63
72
|
designable
|
|
64
73
|
]);
|
|
@@ -68,11 +77,6 @@ const AssistantProvider = (param)=>{
|
|
|
68
77
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
69
78
|
children: [
|
|
70
79
|
children,
|
|
71
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ai_chat_index_js_default(), {
|
|
72
|
-
mRef: ref,
|
|
73
|
-
onGenerateLoad: async (msg)=>true,
|
|
74
|
-
onReloadWrite: ()=>{}
|
|
75
|
-
}),
|
|
76
80
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.FloatButton.Group, {
|
|
77
81
|
trigger: "hover",
|
|
78
82
|
type: "default",
|
|
@@ -100,24 +104,56 @@ const AssistantProvider = (param)=>{
|
|
|
100
104
|
setVisible((visible)=>!visible);
|
|
101
105
|
}
|
|
102
106
|
}),
|
|
103
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.FloatButton, {
|
|
104
|
-
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.CommentOutlined, {}),
|
|
105
|
-
onClick: ()=>{
|
|
106
|
-
var _ref_current;
|
|
107
|
-
null === (_ref_current = ref.current) || void 0 === _ref_current || _ref_current.openModal();
|
|
108
|
-
}
|
|
109
|
-
}),
|
|
110
107
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.FloatButton, {
|
|
111
108
|
type: contextMenuEnabled ? 'primary' : 'default',
|
|
112
109
|
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.ToolOutlined, {
|
|
113
110
|
onClick: ()=>setContextMenuEnable(!contextMenuEnabled)
|
|
114
111
|
})
|
|
115
|
-
})
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AssistantList, {})
|
|
116
114
|
]
|
|
117
115
|
})
|
|
118
116
|
]
|
|
119
117
|
});
|
|
120
118
|
};
|
|
119
|
+
const AssistantListProvider = (props)=>{
|
|
120
|
+
const { children, items } = props;
|
|
121
|
+
const ctx = (0, external_react_namespaceObject.useContext)(external_context_js_namespaceObject.AssistantListContext);
|
|
122
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
|
|
123
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_context_js_namespaceObject.AssistantListContext.Provider, {
|
|
124
|
+
value: {
|
|
125
|
+
items: {
|
|
126
|
+
...ctx.items,
|
|
127
|
+
...items
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
children: children
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
const useStyles = (0, external_antd_style_namespaceObject.createStyles)((param)=>{
|
|
135
|
+
let { css } = param;
|
|
136
|
+
return {
|
|
137
|
+
container: css(_templateObject())
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
const AssistantList = ()=>{
|
|
141
|
+
const { allowAll, snippets } = (0, external_acl_index_js_namespaceObject.useACLRoleContext)();
|
|
142
|
+
const getSnippetsAllow = function(aclKey) {
|
|
143
|
+
let isPublic = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
144
|
+
return allowAll || isPublic || (null == snippets ? void 0 : snippets.includes(aclKey));
|
|
145
|
+
};
|
|
146
|
+
const { styles } = useStyles();
|
|
147
|
+
const ctx = (0, external_react_namespaceObject.useContext)(external_context_js_namespaceObject.AssistantListContext);
|
|
148
|
+
const { components } = (0, external_react_namespaceObject.useContext)(schema_namespaceObject.SchemaOptionsContext);
|
|
149
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
150
|
+
className: styles.container,
|
|
151
|
+
children: Object.keys(ctx.items).sort((a, b)=>ctx.items[a].order - ctx.items[b].order).filter((key)=>getSnippetsAllow(ctx.items[key].snippet, ctx.items[key].isPublic)).map((key)=>{
|
|
152
|
+
const Action = (0, external_lodash_namespaceObject.get)(components, ctx.items[key].component);
|
|
153
|
+
return Action ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Action, {}, key) : null;
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
};
|
|
121
157
|
var __webpack_export_target__ = exports;
|
|
122
158
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
123
159
|
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
@@ -26,37 +26,13 @@ var __webpack_require__ = {};
|
|
|
26
26
|
var __webpack_exports__ = {};
|
|
27
27
|
__webpack_require__.r(__webpack_exports__);
|
|
28
28
|
__webpack_require__.d(__webpack_exports__, {
|
|
29
|
-
|
|
29
|
+
AssistantListContext: ()=>AssistantListContext
|
|
30
30
|
});
|
|
31
|
-
require("
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
hideModal: "hideModal-X40Vc3",
|
|
37
|
-
modalContent: "modalContent-ezOZkD",
|
|
38
|
-
modalHeader: "modalHeader-nOGcoS",
|
|
39
|
-
closeButton: "closeButton-sQRFHO",
|
|
40
|
-
title: "title-Y7yOZf",
|
|
41
|
-
marsailogo: "marsailogo-uzJ6wj",
|
|
42
|
-
modalBody: "modalBody-znsaSD",
|
|
43
|
-
chatContent: "chatContent-pNV258",
|
|
44
|
-
welcomeText: "welcomeText-rhomeV",
|
|
45
|
-
chatItem: "chatItem-NWq8xW",
|
|
46
|
-
chatInfo: "chatInfo-JXKVGs",
|
|
47
|
-
avatar: "avatar-p1qeb8",
|
|
48
|
-
chatName: "chatName-Snh5k_",
|
|
49
|
-
chatText: "chatText-LyRqZ_",
|
|
50
|
-
chatResponce: "chatResponce-HQaYAb",
|
|
51
|
-
chatLoad: "chatLoad-GYl_Mi",
|
|
52
|
-
load: "load-q1byGM",
|
|
53
|
-
chatExamples: "chatExamples-lfggyG",
|
|
54
|
-
chatExampleItem: "chatExampleItem-7D1scl",
|
|
55
|
-
chatInput: "chatInput-OYNsM0",
|
|
56
|
-
chatOtherInfo: "chatOtherInfo-sj2Wal",
|
|
57
|
-
"ant-popover": "ant-popover-DNZLKL",
|
|
58
|
-
antPopover: "ant-popover-DNZLKL"
|
|
59
|
-
};
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
|
+
const AssistantListContext = (0, external_react_namespaceObject.createContext)({
|
|
33
|
+
items: {}
|
|
34
|
+
});
|
|
35
|
+
AssistantListContext.displayName = 'AssistantListContext';
|
|
60
36
|
var __webpack_export_target__ = exports;
|
|
61
37
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
62
38
|
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"../../application/Plugin": function(module) {
|
|
4
|
+
module.exports = require("../../application/Plugin.js");
|
|
5
|
+
},
|
|
6
|
+
"./Assistant.provider": function(module) {
|
|
7
|
+
module.exports = require("./Assistant.provider.js");
|
|
8
|
+
},
|
|
9
|
+
"./calculator/CalculatorProvider": function(module) {
|
|
10
|
+
module.exports = require("./calculator/CalculatorProvider.js");
|
|
11
|
+
},
|
|
12
|
+
"./context?d80f": function(module) {
|
|
13
|
+
module.exports = require("./context.js");
|
|
14
|
+
},
|
|
15
|
+
"./search-and-jump": function(module) {
|
|
16
|
+
module.exports = require("./search-and-jump/index.js");
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var __webpack_module_cache__ = {};
|
|
20
|
+
function __webpack_require__(moduleId) {
|
|
21
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
22
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
23
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
24
|
+
exports: {}
|
|
25
|
+
};
|
|
26
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
27
|
+
return module.exports;
|
|
28
|
+
}
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.n = function(module) {
|
|
31
|
+
var getter = module && module.__esModule ? function() {
|
|
32
|
+
return module['default'];
|
|
33
|
+
} : function() {
|
|
34
|
+
return module;
|
|
35
|
+
};
|
|
36
|
+
__webpack_require__.d(getter, {
|
|
37
|
+
a: getter
|
|
38
|
+
});
|
|
39
|
+
return getter;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
3
42
|
(()=>{
|
|
4
43
|
__webpack_require__.d = function(exports1, definition) {
|
|
5
44
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -26,17 +65,39 @@ var __webpack_require__ = {};
|
|
|
26
65
|
var __webpack_exports__ = {};
|
|
27
66
|
__webpack_require__.r(__webpack_exports__);
|
|
28
67
|
__webpack_require__.d(__webpack_exports__, {
|
|
29
|
-
PluginAssistant: ()
|
|
68
|
+
PluginAssistant: function() {
|
|
69
|
+
return PluginAssistant;
|
|
70
|
+
}
|
|
30
71
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
72
|
+
var _application_Plugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../application/Plugin");
|
|
73
|
+
var _Assistant_provider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./Assistant.provider");
|
|
74
|
+
var _calculator_CalculatorProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./calculator/CalculatorProvider");
|
|
75
|
+
var _search_and_jump__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./search-and-jump");
|
|
76
|
+
var _context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./context?d80f");
|
|
77
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
78
|
+
for(var __WEBPACK_IMPORT_KEY__ in _context__WEBPACK_IMPORTED_MODULE_4__)if ([
|
|
79
|
+
"default",
|
|
80
|
+
"PluginAssistant"
|
|
81
|
+
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
82
|
+
return _context__WEBPACK_IMPORTED_MODULE_4__[key];
|
|
83
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
84
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
85
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
86
|
+
for(var __WEBPACK_IMPORT_KEY__ in _Assistant_provider__WEBPACK_IMPORTED_MODULE_1__)if ([
|
|
87
|
+
"PluginAssistant",
|
|
88
|
+
"default"
|
|
89
|
+
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
90
|
+
return _Assistant_provider__WEBPACK_IMPORTED_MODULE_1__[key];
|
|
91
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
92
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
93
|
+
class PluginAssistant extends _application_Plugin__WEBPACK_IMPORTED_MODULE_0__.Plugin {
|
|
36
94
|
async load() {
|
|
37
|
-
this.app.use(
|
|
38
|
-
this.app.use(
|
|
39
|
-
this.app.use(
|
|
95
|
+
this.app.use(_search_and_jump__WEBPACK_IMPORTED_MODULE_3__.SearchAndJumpProvider);
|
|
96
|
+
this.app.use(_calculator_CalculatorProvider__WEBPACK_IMPORTED_MODULE_2__.CalculatorProvider);
|
|
97
|
+
this.app.use(_Assistant_provider__WEBPACK_IMPORTED_MODULE_1__.AssistantListProvider, this.options.config);
|
|
98
|
+
}
|
|
99
|
+
async afterLoad() {
|
|
100
|
+
this.app.use(_Assistant_provider__WEBPACK_IMPORTED_MODULE_1__.AssistantProvider);
|
|
40
101
|
}
|
|
41
102
|
}
|
|
42
103
|
var __webpack_export_target__ = exports;
|
package/lib/i18n/i18n.js
CHANGED
|
@@ -56,16 +56,18 @@ const resources = {};
|
|
|
56
56
|
Object.keys(index_js_default()).forEach((lang)=>{
|
|
57
57
|
resources[lang] = index_js_default()[lang].resources;
|
|
58
58
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
if ('undefined' != typeof localStorage) {
|
|
60
|
+
i18n.use(external_react_i18next_namespaceObject.initReactI18next).init({
|
|
61
|
+
lng: localStorage.getItem('TACHYBASE_LOCALE') || 'en-US',
|
|
62
|
+
defaultNS: 'core',
|
|
63
|
+
resources: {},
|
|
64
|
+
keySeparator: false,
|
|
65
|
+
nsSeparator: false
|
|
66
|
+
});
|
|
67
|
+
i18n.on('languageChanged', (lng)=>{
|
|
68
|
+
localStorage.setItem('TACHYBASE_LOCALE', lng);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
69
71
|
var __webpack_export_target__ = exports;
|
|
70
72
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
71
73
|
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|