@sqaitech/visualizer 0.30.10
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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/es/component/blackboard/index.css +33 -0
- package/dist/es/component/blackboard/index.mjs +278 -0
- package/dist/es/component/config-selector/index.mjs +104 -0
- package/dist/es/component/context-preview/index.mjs +38 -0
- package/dist/es/component/env-config/index.mjs +112 -0
- package/dist/es/component/env-config-reminder/index.css +22 -0
- package/dist/es/component/env-config-reminder/index.mjs +28 -0
- package/dist/es/component/form-field/index.mjs +163 -0
- package/dist/es/component/history-selector/index.css +135 -0
- package/dist/es/component/history-selector/index.mjs +170 -0
- package/dist/es/component/index.mjs +1 -0
- package/dist/es/component/logo/index.css +13 -0
- package/dist/es/component/logo/index.mjs +20 -0
- package/dist/es/component/misc/index.mjs +94 -0
- package/dist/es/component/nav-actions/index.mjs +32 -0
- package/dist/es/component/nav-actions/style.css +35 -0
- package/dist/es/component/player/index.css +185 -0
- package/dist/es/component/player/index.mjs +856 -0
- package/dist/es/component/playground/index.css +431 -0
- package/dist/es/component/playground/index.mjs +8 -0
- package/dist/es/component/playground/playground-demo-ui-context.json +290 -0
- package/dist/es/component/playground-result/index.css +34 -0
- package/dist/es/component/playground-result/index.mjs +62 -0
- package/dist/es/component/prompt-input/index.css +391 -0
- package/dist/es/component/prompt-input/index.mjs +730 -0
- package/dist/es/component/service-mode-control/index.mjs +105 -0
- package/dist/es/component/shiny-text/index.css +75 -0
- package/dist/es/component/shiny-text/index.mjs +15 -0
- package/dist/es/component/universal-playground/index.css +341 -0
- package/dist/es/component/universal-playground/index.mjs +302 -0
- package/dist/es/component/universal-playground/providers/context-provider.mjs +52 -0
- package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +207 -0
- package/dist/es/component/universal-playground/providers/storage-provider.mjs +210 -0
- package/dist/es/hooks/usePlaygroundExecution.mjs +180 -0
- package/dist/es/hooks/usePlaygroundState.mjs +203 -0
- package/dist/es/hooks/useSafeOverrideAIConfig.mjs +24 -0
- package/dist/es/hooks/useServerValid.mjs +30 -0
- package/dist/es/icons/avatar.mjs +28 -0
- package/dist/es/icons/close.mjs +19 -0
- package/dist/es/icons/global-perspective.mjs +16 -0
- package/dist/es/icons/history.mjs +30 -0
- package/dist/es/icons/magnifying-glass.mjs +39 -0
- package/dist/es/icons/player-setting.mjs +26 -0
- package/dist/es/icons/setting.mjs +20 -0
- package/dist/es/icons/show-marker.mjs +16 -0
- package/dist/es/index.mjs +25 -0
- package/dist/es/store/history.mjs +89 -0
- package/dist/es/store/store.mjs +186 -0
- package/dist/es/types.mjs +70 -0
- package/dist/es/utils/color.mjs +35 -0
- package/dist/es/utils/constants.mjs +99 -0
- package/dist/es/utils/index.mjs +10 -0
- package/dist/es/utils/pixi-loader.mjs +16 -0
- package/dist/es/utils/playground-utils.mjs +67 -0
- package/dist/es/utils/replay-scripts.mjs +312 -0
- package/dist/lib/component/blackboard/index.css +33 -0
- package/dist/lib/component/blackboard/index.js +321 -0
- package/dist/lib/component/config-selector/index.js +148 -0
- package/dist/lib/component/context-preview/index.js +83 -0
- package/dist/lib/component/env-config/index.js +146 -0
- package/dist/lib/component/env-config-reminder/index.css +22 -0
- package/dist/lib/component/env-config-reminder/index.js +62 -0
- package/dist/lib/component/form-field/index.js +209 -0
- package/dist/lib/component/history-selector/index.css +135 -0
- package/dist/lib/component/history-selector/index.js +216 -0
- package/dist/lib/component/index.js +60 -0
- package/dist/lib/component/logo/index.css +13 -0
- package/dist/lib/component/logo/index.js +57 -0
- package/dist/lib/component/misc/index.js +150 -0
- package/dist/lib/component/nav-actions/index.js +66 -0
- package/dist/lib/component/nav-actions/style.css +35 -0
- package/dist/lib/component/player/index.css +185 -0
- package/dist/lib/component/player/index.js +902 -0
- package/dist/lib/component/playground/index.css +431 -0
- package/dist/lib/component/playground/index.js +113 -0
- package/dist/lib/component/playground/playground-demo-ui-context.json +290 -0
- package/dist/lib/component/playground-result/index.css +34 -0
- package/dist/lib/component/playground-result/index.js +106 -0
- package/dist/lib/component/prompt-input/index.css +391 -0
- package/dist/lib/component/prompt-input/index.js +774 -0
- package/dist/lib/component/service-mode-control/index.js +139 -0
- package/dist/lib/component/shiny-text/index.css +75 -0
- package/dist/lib/component/shiny-text/index.js +49 -0
- package/dist/lib/component/universal-playground/index.css +341 -0
- package/dist/lib/component/universal-playground/index.js +350 -0
- package/dist/lib/component/universal-playground/providers/context-provider.js +95 -0
- package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +247 -0
- package/dist/lib/component/universal-playground/providers/storage-provider.js +268 -0
- package/dist/lib/hooks/usePlaygroundExecution.js +214 -0
- package/dist/lib/hooks/usePlaygroundState.js +237 -0
- package/dist/lib/hooks/useSafeOverrideAIConfig.js +61 -0
- package/dist/lib/hooks/useServerValid.js +64 -0
- package/dist/lib/icons/avatar.js +62 -0
- package/dist/lib/icons/close.js +53 -0
- package/dist/lib/icons/global-perspective.js +50 -0
- package/dist/lib/icons/history.js +64 -0
- package/dist/lib/icons/magnifying-glass.js +73 -0
- package/dist/lib/icons/player-setting.js +60 -0
- package/dist/lib/icons/setting.js +54 -0
- package/dist/lib/icons/show-marker.js +50 -0
- package/dist/lib/index.js +187 -0
- package/dist/lib/store/history.js +96 -0
- package/dist/lib/store/store.js +196 -0
- package/dist/lib/types.js +116 -0
- package/dist/lib/utils/color.js +75 -0
- package/dist/lib/utils/constants.js +154 -0
- package/dist/lib/utils/index.js +63 -0
- package/dist/lib/utils/pixi-loader.js +56 -0
- package/dist/lib/utils/playground-utils.js +110 -0
- package/dist/lib/utils/replay-scripts.js +355 -0
- package/dist/types/component/blackboard/index.d.ts +15 -0
- package/dist/types/component/config-selector/index.d.ts +9 -0
- package/dist/types/component/context-preview/index.d.ts +9 -0
- package/dist/types/component/env-config/index.d.ts +6 -0
- package/dist/types/component/env-config-reminder/index.d.ts +6 -0
- package/dist/types/component/form-field/index.d.ts +17 -0
- package/dist/types/component/history-selector/index.d.ts +10 -0
- package/dist/types/component/index.d.ts +1 -0
- package/dist/types/component/logo/index.d.ts +5 -0
- package/dist/types/component/misc/index.d.ts +6 -0
- package/dist/types/component/nav-actions/index.d.ts +10 -0
- package/dist/types/component/player/index.d.ts +13 -0
- package/dist/types/component/playground/index.d.ts +7 -0
- package/dist/types/component/playground-result/index.d.ts +20 -0
- package/dist/types/component/prompt-input/index.d.ts +22 -0
- package/dist/types/component/service-mode-control/index.d.ts +6 -0
- package/dist/types/component/shiny-text/index.d.ts +12 -0
- package/dist/types/component/universal-playground/index.d.ts +4 -0
- package/dist/types/component/universal-playground/providers/context-provider.d.ts +37 -0
- package/dist/types/component/universal-playground/providers/indexeddb-storage-provider.d.ts +71 -0
- package/dist/types/component/universal-playground/providers/storage-provider.d.ts +58 -0
- package/dist/types/hooks/usePlaygroundExecution.d.ts +10 -0
- package/dist/types/hooks/usePlaygroundState.d.ts +26 -0
- package/dist/types/hooks/useSafeOverrideAIConfig.d.ts +16 -0
- package/dist/types/hooks/useServerValid.d.ts +1 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/store/history.d.ts +16 -0
- package/dist/types/store/store.d.ts +36 -0
- package/dist/types/types.d.ts +161 -0
- package/dist/types/utils/color.d.ts +4 -0
- package/dist/types/utils/constants.d.ts +74 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/pixi-loader.d.ts +5 -0
- package/dist/types/utils/playground-utils.d.ts +6 -0
- package/dist/types/utils/replay-scripts.d.ts +34 -0
- package/package.json +85 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
EnvConfig: ()=>EnvConfig
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const icons_namespaceObject = require("@ant-design/icons");
|
|
31
|
+
const external_antd_namespaceObject = require("antd");
|
|
32
|
+
const external_react_namespaceObject = require("react");
|
|
33
|
+
const store_js_namespaceObject = require("../../store/store.js");
|
|
34
|
+
function EnvConfig(param) {
|
|
35
|
+
let { showTooltipWhenEmpty = true, showModelName = true, tooltipPlacement = 'bottom', mode = 'icon' } = param;
|
|
36
|
+
const { config, configString, loadConfig, syncFromStorage } = (0, store_js_namespaceObject.useEnvConfig)();
|
|
37
|
+
const [isModalOpen, setIsModalOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
38
|
+
const [tempConfigString, setTempConfigString] = (0, external_react_namespaceObject.useState)(configString);
|
|
39
|
+
const midsceneModelName = config.MIDSCENE_MODEL_NAME;
|
|
40
|
+
const componentRef = (0, external_react_namespaceObject.useRef)(null);
|
|
41
|
+
const showModal = (e)=>{
|
|
42
|
+
syncFromStorage();
|
|
43
|
+
setIsModalOpen(true);
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
};
|
|
47
|
+
const handleOk = ()=>{
|
|
48
|
+
setIsModalOpen(false);
|
|
49
|
+
loadConfig(tempConfigString);
|
|
50
|
+
};
|
|
51
|
+
const handleCancel = ()=>{
|
|
52
|
+
setIsModalOpen(false);
|
|
53
|
+
};
|
|
54
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
55
|
+
if (isModalOpen) setTempConfigString(configString);
|
|
56
|
+
}, [
|
|
57
|
+
isModalOpen,
|
|
58
|
+
configString
|
|
59
|
+
]);
|
|
60
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
61
|
+
style: {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
justifyContent: 'flex-end',
|
|
64
|
+
gap: '10px',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
height: '100%',
|
|
67
|
+
minHeight: '32px'
|
|
68
|
+
},
|
|
69
|
+
ref: componentRef,
|
|
70
|
+
children: [
|
|
71
|
+
showModelName ? midsceneModelName : null,
|
|
72
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tooltip, {
|
|
73
|
+
title: "Please set up your environment variables before using.",
|
|
74
|
+
placement: tooltipPlacement,
|
|
75
|
+
align: {
|
|
76
|
+
offset: [
|
|
77
|
+
-10,
|
|
78
|
+
5
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
getPopupContainer: ()=>componentRef.current,
|
|
82
|
+
open: isModalOpen ? false : showTooltipWhenEmpty ? 0 === Object.keys(config).length : void 0,
|
|
83
|
+
children: 'icon' === mode ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.SettingOutlined, {
|
|
84
|
+
onClick: showModal
|
|
85
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
86
|
+
onClick: showModal,
|
|
87
|
+
style: {
|
|
88
|
+
color: '#006AFF',
|
|
89
|
+
cursor: 'pointer'
|
|
90
|
+
},
|
|
91
|
+
children: "set up"
|
|
92
|
+
})
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Modal, {
|
|
95
|
+
title: "Model Env Config",
|
|
96
|
+
open: isModalOpen,
|
|
97
|
+
onOk: handleOk,
|
|
98
|
+
onCancel: handleCancel,
|
|
99
|
+
okText: "Save",
|
|
100
|
+
style: {
|
|
101
|
+
width: '800px',
|
|
102
|
+
height: '100%',
|
|
103
|
+
marginTop: '10%'
|
|
104
|
+
},
|
|
105
|
+
destroyOnClose: true,
|
|
106
|
+
maskClosable: true,
|
|
107
|
+
centered: true,
|
|
108
|
+
children: [
|
|
109
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Input.TextArea, {
|
|
110
|
+
rows: 7,
|
|
111
|
+
placeholder: 'OPENAI_API_KEY=sk-...\nMIDSCENE_MODEL_NAME=gpt-4o-2024-08-06\n...',
|
|
112
|
+
value: tempConfigString,
|
|
113
|
+
onChange: (e)=>setTempConfigString(e.target.value),
|
|
114
|
+
style: {
|
|
115
|
+
whiteSpace: 'nowrap',
|
|
116
|
+
wordWrap: 'break-word'
|
|
117
|
+
}
|
|
118
|
+
}),
|
|
119
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
120
|
+
children: [
|
|
121
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
122
|
+
children: "The format is KEY=VALUE and separated by new lines."
|
|
123
|
+
}),
|
|
124
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("p", {
|
|
125
|
+
children: [
|
|
126
|
+
"These data will be saved ",
|
|
127
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("strong", {
|
|
128
|
+
children: "locally in your browser"
|
|
129
|
+
}),
|
|
130
|
+
"."
|
|
131
|
+
]
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
exports.EnvConfig = __webpack_exports__.EnvConfig;
|
|
141
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
142
|
+
"EnvConfig"
|
|
143
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
144
|
+
Object.defineProperty(exports, '__esModule', {
|
|
145
|
+
value: true
|
|
146
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.env-config-reminder {
|
|
2
|
+
background: #fff2e8;
|
|
3
|
+
border-radius: 12px;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 12px;
|
|
6
|
+
margin-bottom: 12px;
|
|
7
|
+
padding: 12px 16px;
|
|
8
|
+
display: flex;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.env-config-reminder .reminder-icon {
|
|
12
|
+
color: #fa541c;
|
|
13
|
+
width: 16px;
|
|
14
|
+
height: 16px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.env-config-reminder .reminder-text {
|
|
18
|
+
color: #000;
|
|
19
|
+
flex: 1;
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
EnvConfigReminder: ()=>EnvConfigReminder
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const icons_namespaceObject = require("@ant-design/icons");
|
|
31
|
+
const store_js_namespaceObject = require("../../store/store.js");
|
|
32
|
+
const index_js_namespaceObject = require("../env-config/index.js");
|
|
33
|
+
require("./index.css");
|
|
34
|
+
const EnvConfigReminder = (param)=>{
|
|
35
|
+
let { className = '' } = param;
|
|
36
|
+
const { config } = (0, store_js_namespaceObject.useEnvConfig)();
|
|
37
|
+
const configAlreadySet = Object.keys(config || {}).length >= 1;
|
|
38
|
+
if (configAlreadySet) return null;
|
|
39
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
40
|
+
className: `env-config-reminder ${className}`,
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.ExclamationCircleFilled, {
|
|
43
|
+
className: "reminder-icon"
|
|
44
|
+
}),
|
|
45
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
46
|
+
className: "reminder-text",
|
|
47
|
+
children: "Please set up your environment variables before using."
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.EnvConfig, {
|
|
50
|
+
mode: "text",
|
|
51
|
+
showTooltipWhenEmpty: false
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
exports.EnvConfigReminder = __webpack_exports__.EnvConfigReminder;
|
|
57
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
58
|
+
"EnvConfigReminder"
|
|
59
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
60
|
+
Object.defineProperty(exports, '__esModule', {
|
|
61
|
+
value: true
|
|
62
|
+
});
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
BooleanField: ()=>BooleanField,
|
|
28
|
+
NumberField: ()=>NumberField,
|
|
29
|
+
TextField: ()=>TextField,
|
|
30
|
+
LocateField: ()=>LocateField,
|
|
31
|
+
EnumField: ()=>EnumField
|
|
32
|
+
});
|
|
33
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
34
|
+
const external_antd_namespaceObject = require("antd");
|
|
35
|
+
const { TextArea } = external_antd_namespaceObject.Input;
|
|
36
|
+
const renderLabel = (label, isOptional)=>`${label}${isOptional ? ' (Optional)' : ''}`;
|
|
37
|
+
const TextField = (param)=>{
|
|
38
|
+
let { name, label, isRequired, marginBottom, placeholder: customPlaceholder } = param;
|
|
39
|
+
const placeholder = customPlaceholder || `Enter ${name}`;
|
|
40
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
41
|
+
name: [
|
|
42
|
+
'params',
|
|
43
|
+
name
|
|
44
|
+
],
|
|
45
|
+
label: renderLabel(label, !isRequired),
|
|
46
|
+
rules: isRequired ? [
|
|
47
|
+
{
|
|
48
|
+
required: true,
|
|
49
|
+
message: `Please input ${name}`
|
|
50
|
+
}
|
|
51
|
+
] : [],
|
|
52
|
+
style: {
|
|
53
|
+
marginBottom
|
|
54
|
+
},
|
|
55
|
+
colon: false,
|
|
56
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Input, {
|
|
57
|
+
placeholder: placeholder
|
|
58
|
+
})
|
|
59
|
+
}, name);
|
|
60
|
+
};
|
|
61
|
+
const LocateField = (param)=>{
|
|
62
|
+
let { name, label, isRequired, marginBottom, placeholder: customPlaceholder } = param;
|
|
63
|
+
const placeholder = customPlaceholder || `Describe the ${name}, use natural language`;
|
|
64
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
65
|
+
name: [
|
|
66
|
+
'params',
|
|
67
|
+
name
|
|
68
|
+
],
|
|
69
|
+
label: renderLabel(label, !isRequired),
|
|
70
|
+
rules: isRequired ? [
|
|
71
|
+
{
|
|
72
|
+
required: true,
|
|
73
|
+
message: `The ${name} is required`
|
|
74
|
+
}
|
|
75
|
+
] : [],
|
|
76
|
+
style: {
|
|
77
|
+
marginBottom
|
|
78
|
+
},
|
|
79
|
+
colon: false,
|
|
80
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TextArea, {
|
|
81
|
+
rows: 2,
|
|
82
|
+
placeholder: placeholder
|
|
83
|
+
})
|
|
84
|
+
}, name);
|
|
85
|
+
};
|
|
86
|
+
const EnumField = (param)=>{
|
|
87
|
+
let { name, label, fieldSchema, isRequired, marginBottom, placeholder: customPlaceholder } = param;
|
|
88
|
+
var _fieldSchema__def;
|
|
89
|
+
const enumValues = (null == (_fieldSchema__def = fieldSchema._def) ? void 0 : _fieldSchema__def.values) || [];
|
|
90
|
+
const selectOptions = enumValues.map((value)=>({
|
|
91
|
+
value,
|
|
92
|
+
label: value.charAt(0).toUpperCase() + value.slice(1)
|
|
93
|
+
}));
|
|
94
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
95
|
+
name: [
|
|
96
|
+
'params',
|
|
97
|
+
name
|
|
98
|
+
],
|
|
99
|
+
label: label,
|
|
100
|
+
rules: isRequired ? [
|
|
101
|
+
{
|
|
102
|
+
required: true,
|
|
103
|
+
message: `Please select ${name}`
|
|
104
|
+
}
|
|
105
|
+
] : [],
|
|
106
|
+
style: {
|
|
107
|
+
marginBottom
|
|
108
|
+
},
|
|
109
|
+
colon: false,
|
|
110
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Select, {
|
|
111
|
+
placeholder: customPlaceholder || `Select ${name}`,
|
|
112
|
+
options: selectOptions
|
|
113
|
+
})
|
|
114
|
+
}, name);
|
|
115
|
+
};
|
|
116
|
+
const NumberField = (param)=>{
|
|
117
|
+
let { name, label, isRequired, marginBottom, placeholder: customPlaceholder } = param;
|
|
118
|
+
const defaultPlaceholder = 'distance' === name ? 500 : 0;
|
|
119
|
+
const placeholderValue = customPlaceholder ? Number(customPlaceholder) || defaultPlaceholder : defaultPlaceholder;
|
|
120
|
+
const min = 0;
|
|
121
|
+
const max = 'distance' === name ? 10000 : void 0;
|
|
122
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
123
|
+
name: [
|
|
124
|
+
'params',
|
|
125
|
+
name
|
|
126
|
+
],
|
|
127
|
+
label: `${label}${'distance' === name ? ' (px)' : ''}`,
|
|
128
|
+
rules: isRequired ? [
|
|
129
|
+
{
|
|
130
|
+
required: true,
|
|
131
|
+
message: `Please input ${name}`
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: 'number',
|
|
135
|
+
min,
|
|
136
|
+
message: `${label} must be at least ${min}`
|
|
137
|
+
}
|
|
138
|
+
] : [
|
|
139
|
+
{
|
|
140
|
+
type: 'number',
|
|
141
|
+
min,
|
|
142
|
+
message: `${label} must be at least ${min}`
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
style: {
|
|
146
|
+
flex: 'distance' === name ? 1 : void 0,
|
|
147
|
+
marginBottom
|
|
148
|
+
},
|
|
149
|
+
colon: false,
|
|
150
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.InputNumber, {
|
|
151
|
+
placeholder: placeholderValue.toString(),
|
|
152
|
+
min: min,
|
|
153
|
+
max: max,
|
|
154
|
+
step: 'distance' === name ? 10 : 1,
|
|
155
|
+
style: {
|
|
156
|
+
width: '100%'
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
}, name);
|
|
160
|
+
};
|
|
161
|
+
const BooleanField = (param)=>{
|
|
162
|
+
let { name, label, isRequired, marginBottom, placeholder: customPlaceholder } = param;
|
|
163
|
+
const selectOptions = [
|
|
164
|
+
{
|
|
165
|
+
value: true,
|
|
166
|
+
label: 'True'
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
value: false,
|
|
170
|
+
label: 'False'
|
|
171
|
+
}
|
|
172
|
+
];
|
|
173
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
174
|
+
name: [
|
|
175
|
+
'params',
|
|
176
|
+
name
|
|
177
|
+
],
|
|
178
|
+
label: renderLabel(label, !isRequired),
|
|
179
|
+
rules: isRequired ? [
|
|
180
|
+
{
|
|
181
|
+
required: true,
|
|
182
|
+
message: `Please select ${name}`
|
|
183
|
+
}
|
|
184
|
+
] : [],
|
|
185
|
+
style: {
|
|
186
|
+
marginBottom
|
|
187
|
+
},
|
|
188
|
+
colon: false,
|
|
189
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Select, {
|
|
190
|
+
placeholder: customPlaceholder || `Select ${name}`,
|
|
191
|
+
options: selectOptions
|
|
192
|
+
})
|
|
193
|
+
}, name);
|
|
194
|
+
};
|
|
195
|
+
exports.BooleanField = __webpack_exports__.BooleanField;
|
|
196
|
+
exports.EnumField = __webpack_exports__.EnumField;
|
|
197
|
+
exports.LocateField = __webpack_exports__.LocateField;
|
|
198
|
+
exports.NumberField = __webpack_exports__.NumberField;
|
|
199
|
+
exports.TextField = __webpack_exports__.TextField;
|
|
200
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
201
|
+
"BooleanField",
|
|
202
|
+
"EnumField",
|
|
203
|
+
"LocateField",
|
|
204
|
+
"NumberField",
|
|
205
|
+
"TextField"
|
|
206
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
207
|
+
Object.defineProperty(exports, '__esModule', {
|
|
208
|
+
value: true
|
|
209
|
+
});
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
.history-selector-wrapper {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.history-modal-overlay {
|
|
6
|
+
z-index: 9999;
|
|
7
|
+
background: #fff;
|
|
8
|
+
border: 1px solid rgba(0, 0, 0, .08);
|
|
9
|
+
border-radius: 12px;
|
|
10
|
+
width: 320px;
|
|
11
|
+
height: 400px;
|
|
12
|
+
position: fixed;
|
|
13
|
+
top: auto;
|
|
14
|
+
bottom: 20px;
|
|
15
|
+
right: 20px;
|
|
16
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.history-modal-container {
|
|
20
|
+
border-radius: 12px;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
display: flex;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.history-modal-container .history-modal-header {
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
align-items: center;
|
|
31
|
+
height: 48px;
|
|
32
|
+
padding: 0 25px;
|
|
33
|
+
line-height: 48px;
|
|
34
|
+
display: flex;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.history-modal-container .history-modal-header .close-button {
|
|
38
|
+
justify-content: center;
|
|
39
|
+
align-items: center;
|
|
40
|
+
margin-right: -4px;
|
|
41
|
+
padding: 4px;
|
|
42
|
+
display: flex;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.history-modal-container .history-modal-header .close-button .anticon {
|
|
46
|
+
color: #999;
|
|
47
|
+
font-size: 18px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.history-modal-container .history-modal-header .close-button:hover .anticon {
|
|
51
|
+
color: #666;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.history-modal-container .history-search-section {
|
|
55
|
+
background: #fff;
|
|
56
|
+
padding: 16px 20px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.history-modal-container .history-search-section .search-input-wrapper {
|
|
60
|
+
color: rgba(0, 0, 0, .25);
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: 12px;
|
|
63
|
+
display: flex;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.history-modal-container .history-search-section .search-input-wrapper .search-input {
|
|
67
|
+
background: #f1f2f3;
|
|
68
|
+
border: none;
|
|
69
|
+
border-radius: 16px;
|
|
70
|
+
flex: 1;
|
|
71
|
+
height: 36px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.history-modal-container .history-search-section .search-input-wrapper .search-input .ant-input {
|
|
75
|
+
box-shadow: none;
|
|
76
|
+
background: none;
|
|
77
|
+
border: none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.history-modal-container .history-search-section .search-input-wrapper .search-input:hover, .history-modal-container .history-search-section .search-input-wrapper .search-input:focus-within {
|
|
81
|
+
background: #fff;
|
|
82
|
+
border-color: #d9d9d9;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.history-modal-container .history-search-section .search-input-wrapper .clear-button {
|
|
86
|
+
color: #1890ff;
|
|
87
|
+
height: auto;
|
|
88
|
+
padding: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.history-modal-container .history-search-section .search-input-wrapper .clear-button:hover {
|
|
92
|
+
color: #40a9ff;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.history-modal-container .history-content {
|
|
96
|
+
flex: 1;
|
|
97
|
+
padding: 0 25px 25px;
|
|
98
|
+
overflow-y: auto;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.history-modal-container .history-content .history-group {
|
|
102
|
+
margin-bottom: 10px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.history-modal-container .history-content .history-group .history-group-title {
|
|
106
|
+
color: rgba(0, 0, 0, .45);
|
|
107
|
+
height: 40px;
|
|
108
|
+
font-size: 12px;
|
|
109
|
+
font-weight: 400;
|
|
110
|
+
line-height: 40px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.history-modal-container .history-content .history-group .history-item {
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
color: rgba(0, 0, 0, .85);
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
text-overflow: ellipsis;
|
|
118
|
+
height: 40px;
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
line-height: 40px;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.history-modal-container .history-content .history-group .history-item:hover {
|
|
125
|
+
background: #f2f4f7;
|
|
126
|
+
margin: 0 -8px;
|
|
127
|
+
padding: 0 8px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.history-modal-container .history-content .no-results {
|
|
131
|
+
text-align: center;
|
|
132
|
+
color: #999;
|
|
133
|
+
padding: 40px 20px;
|
|
134
|
+
}
|
|
135
|
+
|