lowcoder-comps 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/icons/icon-chart.svg +15 -0
- package/icons/icon-comp-calendar.svg +22 -0
- package/index.html +26 -0
- package/index.tsx +19 -0
- package/jest.config.js +5 -0
- package/package/012a06bb.js +34 -0
- package/package/06481cb7.js +1060 -0
- package/package/0c8b29d5.js +6 -0
- package/package/114884df.js +805 -0
- package/package/1264ddb2.js +194 -0
- package/package/1cee31ec.js +1095 -0
- package/package/269c3ba3.js +46662 -0
- package/package/2a2c2e55.js +799 -0
- package/package/2b3ab1e4.js +98763 -0
- package/package/37590a81.js +967 -0
- package/package/3cd7980e.js +184 -0
- package/package/40112498.js +424 -0
- package/package/4b6e1d6f.js +24 -0
- package/package/4bc1082b.js +86 -0
- package/package/53e49f9b.js +1600 -0
- package/package/55bd5c26.js +266 -0
- package/package/591684c8.js +2071 -0
- package/package/6c000872.js +16 -0
- package/package/756addec.js +775 -0
- package/package/7668124e.js +8 -0
- package/package/79e8eeeb.js +949 -0
- package/package/926fbfec.js +91 -0
- package/package/945eefb3.js +2665 -0
- package/package/a35f148e.js +1228 -0
- package/package/a4d12a43.js +175 -0
- package/package/a60de5d1.js +804 -0
- package/package/a8dde1ea.js +589 -0
- package/package/b4148642.js +7 -0
- package/package/b7dd22a2.js +847 -0
- package/package/d4f3a2c4.js +18046 -0
- package/package/e0f479f3.js +91 -0
- package/package/eaa160c9.js +341 -0
- package/package/f1bfd8b5.js +311 -0
- package/package/f1f9ba79.js +900 -0
- package/package/fba61f63.js +2868 -0
- package/package/icons/icon-chart.svg +15 -0
- package/package/icons/icon-comp-calendar.svg +22 -0
- package/package/index.js +5 -0
- package/package/package.json +73 -0
- package/package.json +1 -4
- package/src/__test__/allComp.test.tsx +61 -0
- package/src/app-env.d.ts +3 -0
- package/src/comps/calendarComp/calendarComp.tsx +442 -0
- package/src/comps/calendarComp/calendarConstants.tsx +897 -0
- package/src/comps/chartComp/chartComp.tsx +249 -0
- package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +51 -0
- package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +307 -0
- package/src/comps/chartComp/chartConfigs/chartUrls.tsx +6 -0
- package/src/comps/chartComp/chartConfigs/legendConfig.tsx +55 -0
- package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +96 -0
- package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +83 -0
- package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +62 -0
- package/src/comps/chartComp/chartConstants.tsx +243 -0
- package/src/comps/chartComp/chartPropertyView.tsx +161 -0
- package/src/comps/chartComp/chartUtils.ts +240 -0
- package/src/comps/chartComp/reactEcharts/core.tsx +187 -0
- package/src/comps/chartComp/reactEcharts/index.ts +20 -0
- package/src/comps/chartComp/reactEcharts/types.ts +70 -0
- package/src/comps/chartComp/seriesComp.tsx +119 -0
- package/src/comps/imageEditorComp/imageEditorClass.tsx +52 -0
- package/src/comps/imageEditorComp/imageEditorConstants.tsx +109 -0
- package/src/comps/imageEditorComp/index.tsx +184 -0
- package/src/comps/mermaidComp/index.tsx +44 -0
- package/src/comps/mermaidComp/mermaid.tsx +29 -0
- package/src/global.ts +1 -0
- package/src/i18n/comps/index.tsx +29 -0
- package/src/i18n/comps/locales/en.ts +142 -0
- package/src/i18n/comps/locales/enObj.tsx +120 -0
- package/src/i18n/comps/locales/index.ts +7 -0
- package/src/i18n/comps/locales/types.tsx +9 -0
- package/src/i18n/comps/locales/zh.ts +4 -0
- package/src/i18n/comps/locales/zhObj.tsx +4 -0
- package/src/index.ts +11 -0
- package/vite.config.js +10 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { Button } from "antd";
|
|
3
|
+
import { EventConfigType } from "lowcoder-sdk";
|
|
4
|
+
import { trans } from "i18n/comps";
|
|
5
|
+
|
|
6
|
+
export const saveEvent: EventConfigType = {
|
|
7
|
+
label: trans("imageEditor.save"),
|
|
8
|
+
value: "save",
|
|
9
|
+
description: trans("imageEditor.saveDesc"),
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Container = styled.div`
|
|
13
|
+
height: 100%;
|
|
14
|
+
width: 100%;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
.tui-image-editor-container.top .tui-image-editor-controls-logo {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
21
|
+
.tui-image-editor-container .tui-image-editor-header-logo,
|
|
22
|
+
.tui-image-editor-container .tui-image-editor-controls-logo {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
.tui-image-editor-container .tui-image-editor-header-buttons button,
|
|
26
|
+
.tui-image-editor-container .tui-image-editor-header-buttons div,
|
|
27
|
+
.tui-image-editor-container .tui-image-editor-controls-buttons button,
|
|
28
|
+
.tui-image-editor-container .tui-image-editor-controls-buttons div {
|
|
29
|
+
display: none;
|
|
30
|
+
}
|
|
31
|
+
.tie-btn-hand {
|
|
32
|
+
display: none !important;
|
|
33
|
+
}
|
|
34
|
+
.tui-image-editor-container .tui-image-editor-menu,
|
|
35
|
+
.tui-image-editor-container .tui-image-editor-help-menu {
|
|
36
|
+
background-color: #f3f4f6 !important;
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
export const EmbeddedButton = styled(Button)`
|
|
41
|
+
position: absolute;
|
|
42
|
+
right: 8px;
|
|
43
|
+
bottom: 4px;
|
|
44
|
+
z-index: 100;
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
export const customTheme = {
|
|
48
|
+
// image
|
|
49
|
+
"common.bi.image": "",
|
|
50
|
+
"common.bisize.width": "0px",
|
|
51
|
+
"common.bisize.height": "0px",
|
|
52
|
+
"common.backgroundImage": "none",
|
|
53
|
+
"common.backgroundColor": "#f3f4f6",
|
|
54
|
+
"common.border": "1px solid #444",
|
|
55
|
+
|
|
56
|
+
// header
|
|
57
|
+
"header.backgroundImage": "none",
|
|
58
|
+
"header.backgroundColor": "#f3f4f6",
|
|
59
|
+
"header.border": "0px",
|
|
60
|
+
"header.display": "none",
|
|
61
|
+
|
|
62
|
+
// icons default
|
|
63
|
+
"menu.normalIcon.color": "#8a8a8a",
|
|
64
|
+
"menu.activeIcon.color": "#555555",
|
|
65
|
+
"menu.disabledIcon.color": "#434343",
|
|
66
|
+
"menu.hoverIcon.color": "#e9e9e9",
|
|
67
|
+
"submenu.normalIcon.color": "#8a8a8a",
|
|
68
|
+
"submenu.activeIcon.color": "#e9e9e9",
|
|
69
|
+
|
|
70
|
+
"menu.iconSize.width": "24px",
|
|
71
|
+
"menu.iconSize.height": "24px",
|
|
72
|
+
"submenu.iconSize.width": "32px",
|
|
73
|
+
"submenu.iconSize.height": "32px",
|
|
74
|
+
|
|
75
|
+
// submenu primary color
|
|
76
|
+
"submenu.backgroundColor": "#1e1e1e",
|
|
77
|
+
"submenu.partition.color": "#858585",
|
|
78
|
+
|
|
79
|
+
// submenu labels
|
|
80
|
+
"submenu.normalLabel.color": "#858585",
|
|
81
|
+
"submenu.normalLabel.fontWeight": "lighter",
|
|
82
|
+
"submenu.activeLabel.color": "#fff",
|
|
83
|
+
"submenu.activeLabel.fontWeight": "lighter",
|
|
84
|
+
|
|
85
|
+
// checkbox style
|
|
86
|
+
"checkbox.border": "1px solid #ccc",
|
|
87
|
+
"checkbox.backgroundColor": "#fff",
|
|
88
|
+
|
|
89
|
+
// rango style
|
|
90
|
+
"range.pointer.color": "#fff",
|
|
91
|
+
"range.bar.color": "#666",
|
|
92
|
+
"range.subbar.color": "#d1d1d1",
|
|
93
|
+
|
|
94
|
+
"range.disabledPointer.color": "#414141",
|
|
95
|
+
"range.disabledBar.color": "#282828",
|
|
96
|
+
"range.disabledSubbar.color": "#414141",
|
|
97
|
+
|
|
98
|
+
"range.value.color": "#fff",
|
|
99
|
+
"range.value.fontWeight": "lighter",
|
|
100
|
+
"range.value.fontSize": "11px",
|
|
101
|
+
"range.value.border": "1px solid #353535",
|
|
102
|
+
"range.value.backgroundColor": "#151515",
|
|
103
|
+
"range.title.color": "#fff",
|
|
104
|
+
"range.title.fontWeight": "lighter",
|
|
105
|
+
|
|
106
|
+
// colorpicker style
|
|
107
|
+
"colorpicker.button.border": "1px solid #1e1e1e",
|
|
108
|
+
"colorpicker.title.color": "#fff",
|
|
109
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BoolControl,
|
|
3
|
+
hiddenPropertyView,
|
|
4
|
+
NameConfig,
|
|
5
|
+
Section,
|
|
6
|
+
sectionNames,
|
|
7
|
+
StringStateControl,
|
|
8
|
+
UICompBuilder,
|
|
9
|
+
withDefault,
|
|
10
|
+
withExposingConfigs,
|
|
11
|
+
eventHandlerControl,
|
|
12
|
+
NameConfigHidden,
|
|
13
|
+
stringExposingStateControl,
|
|
14
|
+
} from "lowcoder-sdk";
|
|
15
|
+
import { useRef } from "react";
|
|
16
|
+
import ReactResizeDetector from "react-resize-detector";
|
|
17
|
+
import _ from "lodash";
|
|
18
|
+
import { RecordConstructorToView } from "lowcoder-core";
|
|
19
|
+
import { Container, customTheme, EmbeddedButton, saveEvent } from "./imageEditorConstants";
|
|
20
|
+
import { ImageEditor } from "./imageEditorClass";
|
|
21
|
+
import { i18nObjs, trans } from "i18n/comps";
|
|
22
|
+
|
|
23
|
+
const childrenMap = {
|
|
24
|
+
src: withDefault(StringStateControl, trans("imageEditor.defaultSrc")),
|
|
25
|
+
name: withDefault(StringStateControl, "Example"),
|
|
26
|
+
crop: withDefault(BoolControl, true),
|
|
27
|
+
flip: withDefault(BoolControl, true),
|
|
28
|
+
rotate: withDefault(BoolControl, true),
|
|
29
|
+
draw: withDefault(BoolControl, true),
|
|
30
|
+
shape: withDefault(BoolControl, true),
|
|
31
|
+
icon: withDefault(BoolControl, true),
|
|
32
|
+
text: withDefault(BoolControl, true),
|
|
33
|
+
mask: withDefault(BoolControl, true),
|
|
34
|
+
filter: withDefault(BoolControl, true),
|
|
35
|
+
dataURI: stringExposingStateControl("dataURI"),
|
|
36
|
+
data: stringExposingStateControl("data"),
|
|
37
|
+
onEvent: eventHandlerControl([saveEvent] as const),
|
|
38
|
+
buttonText: withDefault(StringStateControl, trans("imageEditor.save")),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const ContainerImageEditor = (props: RecordConstructorToView<typeof childrenMap>) => {
|
|
42
|
+
const editorRef = useRef<any>(null);
|
|
43
|
+
const conRef = useRef<HTMLDivElement>(null);
|
|
44
|
+
|
|
45
|
+
const menu = ["crop", "flip", "rotate", "draw", "shape", "icon", "text", "mask", "filter"];
|
|
46
|
+
const menuMap = new Map<string, boolean>();
|
|
47
|
+
menuMap.set("crop", props.crop);
|
|
48
|
+
menuMap.set("flip", props.flip);
|
|
49
|
+
menuMap.set("rotate", props.rotate);
|
|
50
|
+
menuMap.set("draw", props.draw);
|
|
51
|
+
menuMap.set("shape", props.shape);
|
|
52
|
+
menuMap.set("icon", props.icon);
|
|
53
|
+
menuMap.set("text", props.text);
|
|
54
|
+
menuMap.set("mask", props.mask);
|
|
55
|
+
menuMap.set("filter", props.filter);
|
|
56
|
+
let filteredMenu = menu.filter((ele) => {
|
|
57
|
+
return menuMap.get(ele);
|
|
58
|
+
});
|
|
59
|
+
const onResize = () => {
|
|
60
|
+
const editor = editorRef.current;
|
|
61
|
+
const container = conRef.current;
|
|
62
|
+
editor.imageEditorInst.ui.resizeEditor({
|
|
63
|
+
uiSize: { width: container?.clientWidth, height: container?.clientHeight },
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const saveImage = () => {
|
|
68
|
+
let imageEditorInst = editorRef.current.imageEditorInst;
|
|
69
|
+
let dataURL = imageEditorInst.toDataURL();
|
|
70
|
+
props.dataURI.onChange(dataURL);
|
|
71
|
+
props.data.onChange(dataURL.split(",")[1]);
|
|
72
|
+
};
|
|
73
|
+
return (
|
|
74
|
+
<Container ref={conRef}>
|
|
75
|
+
<EmbeddedButton
|
|
76
|
+
type="primary"
|
|
77
|
+
onClick={() => {
|
|
78
|
+
saveImage();
|
|
79
|
+
props.onEvent("save");
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
{props.buttonText.value}
|
|
83
|
+
</EmbeddedButton>
|
|
84
|
+
<ReactResizeDetector onResize={onResize}>
|
|
85
|
+
<div style={{ width: "100%", height: "100%" }}>
|
|
86
|
+
<ImageEditor
|
|
87
|
+
ref={editorRef}
|
|
88
|
+
includeUI={{
|
|
89
|
+
loadImage: {
|
|
90
|
+
path: props.src.value,
|
|
91
|
+
name: props.name.value,
|
|
92
|
+
},
|
|
93
|
+
menu: filteredMenu,
|
|
94
|
+
theme: customTheme,
|
|
95
|
+
uiSize: {
|
|
96
|
+
width: "100%",
|
|
97
|
+
height: "100%",
|
|
98
|
+
},
|
|
99
|
+
menuBarPosition: "bottom",
|
|
100
|
+
locale: i18nObjs.imageEditorLocale ?? {},
|
|
101
|
+
}}
|
|
102
|
+
cssMaxWidth={document.documentElement.clientWidth}
|
|
103
|
+
cssMaxHeight={document.documentElement.clientHeight}
|
|
104
|
+
selectionStyle={{
|
|
105
|
+
cornerSize: 50,
|
|
106
|
+
rotatingPointOffset: 100,
|
|
107
|
+
}}
|
|
108
|
+
usageStatistics={false}
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
</ReactResizeDetector>
|
|
112
|
+
</Container>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
let ImageEditorBasicComp = (function () {
|
|
116
|
+
return new UICompBuilder(childrenMap, (props) => {
|
|
117
|
+
return <ContainerImageEditor {...props} />;
|
|
118
|
+
})
|
|
119
|
+
.setPropertyViewFn((children) => {
|
|
120
|
+
return (
|
|
121
|
+
<>
|
|
122
|
+
<Section name={sectionNames.basic}>
|
|
123
|
+
{children.src.propertyView({
|
|
124
|
+
label: trans("imageEditor.src"),
|
|
125
|
+
placeholder: "http://xxx.jpg",
|
|
126
|
+
})}
|
|
127
|
+
{children.name.propertyView({
|
|
128
|
+
label: trans("imageEditor.name"),
|
|
129
|
+
})}
|
|
130
|
+
{children.buttonText.propertyView({
|
|
131
|
+
label: trans("imageEditor.buttonText"),
|
|
132
|
+
})}
|
|
133
|
+
</Section>
|
|
134
|
+
<Section name={sectionNames.interaction}>{children.onEvent.getPropertyView()}</Section>
|
|
135
|
+
<Section name={sectionNames.advanced}>
|
|
136
|
+
{children.crop.propertyView({
|
|
137
|
+
label: "Crop",
|
|
138
|
+
})}
|
|
139
|
+
{children.flip.propertyView({
|
|
140
|
+
label: "Flip",
|
|
141
|
+
})}
|
|
142
|
+
{children.rotate.propertyView({
|
|
143
|
+
label: "Rotate",
|
|
144
|
+
})}
|
|
145
|
+
{children.draw.propertyView({
|
|
146
|
+
label: "Draw",
|
|
147
|
+
})}
|
|
148
|
+
{children.shape.propertyView({
|
|
149
|
+
label: "Shape",
|
|
150
|
+
})}
|
|
151
|
+
{children.icon.propertyView({
|
|
152
|
+
label: "Icon",
|
|
153
|
+
})}
|
|
154
|
+
{children.text.propertyView({
|
|
155
|
+
label: "Text",
|
|
156
|
+
})}
|
|
157
|
+
{children.mask.propertyView({
|
|
158
|
+
label: "Mask",
|
|
159
|
+
})}
|
|
160
|
+
{children.filter.propertyView({
|
|
161
|
+
label: "Filter",
|
|
162
|
+
})}
|
|
163
|
+
</Section>
|
|
164
|
+
<Section name={sectionNames.layout}>{hiddenPropertyView(children)}</Section>
|
|
165
|
+
</>
|
|
166
|
+
);
|
|
167
|
+
})
|
|
168
|
+
.build();
|
|
169
|
+
})();
|
|
170
|
+
|
|
171
|
+
ImageEditorBasicComp = class extends ImageEditorBasicComp {
|
|
172
|
+
override autoHeight(): boolean {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export const ImageEditorComp = withExposingConfigs(ImageEditorBasicComp, [
|
|
178
|
+
new NameConfig("src", trans("imageEditor.srcDesc")),
|
|
179
|
+
new NameConfig("name", trans("imageEditor.nameDesc")),
|
|
180
|
+
new NameConfig("dataURI", trans("imageEditor.dataURIDesc")),
|
|
181
|
+
new NameConfig("data", trans("imageEditor.dataDesc")),
|
|
182
|
+
new NameConfig("buttonText", trans("imageEditor.buttonTextDesc")),
|
|
183
|
+
NameConfigHidden,
|
|
184
|
+
]);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UICompBuilder,
|
|
3
|
+
Section,
|
|
4
|
+
withExposingConfigs,
|
|
5
|
+
stringExposingStateControl,
|
|
6
|
+
NameConfig,
|
|
7
|
+
eventHandlerControl,
|
|
8
|
+
withMethodExposing,
|
|
9
|
+
} from "lowcoder-sdk";
|
|
10
|
+
|
|
11
|
+
import Mermaid from "./mermaid";
|
|
12
|
+
|
|
13
|
+
const childrenMap = {
|
|
14
|
+
code: stringExposingStateControl(
|
|
15
|
+
"code",
|
|
16
|
+
`graph LR
|
|
17
|
+
Start --> Stop`
|
|
18
|
+
),
|
|
19
|
+
onEvent: eventHandlerControl([
|
|
20
|
+
{
|
|
21
|
+
label: "onChange",
|
|
22
|
+
value: "change",
|
|
23
|
+
description: "",
|
|
24
|
+
},
|
|
25
|
+
]),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const CompBase = new UICompBuilder(childrenMap, (props: any) => {
|
|
29
|
+
const code = props.code.value;
|
|
30
|
+
return <Mermaid code={code} />;
|
|
31
|
+
})
|
|
32
|
+
.setPropertyViewFn((children: any) => {
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<Section name="Basic">{children.code.propertyView({ label: "code" })}</Section>
|
|
36
|
+
<Section name="Interaction">{children.onEvent.propertyView()}</Section>
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
})
|
|
40
|
+
.build();
|
|
41
|
+
|
|
42
|
+
const AppViewCompTemp = withMethodExposing(CompBase, []);
|
|
43
|
+
|
|
44
|
+
export const MermaidComp = withExposingConfigs(AppViewCompTemp, [new NameConfig("code", "")]);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import mermaid from "mermaid";
|
|
3
|
+
|
|
4
|
+
function escape(str: string): string {
|
|
5
|
+
const entries: { [index: string]: any } = { lt: "<", gt: ">", nbsp: " ", amp: "&", quot: '"' };
|
|
6
|
+
return str
|
|
7
|
+
.replace(/&(lt|gt|nbsp|amp|quot);/gi, function (_, t) {
|
|
8
|
+
return entries[t];
|
|
9
|
+
})
|
|
10
|
+
.trim();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default ({ id = "graphDiv", code = "" }) => {
|
|
14
|
+
const [svg, setSvg] = useState("");
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
mermaid.initialize({ startOnLoad: false });
|
|
18
|
+
}, []);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!code) return;
|
|
22
|
+
|
|
23
|
+
mermaid.mermaidAPI.render(id, escape(code)).then((res) => {
|
|
24
|
+
setSvg(res.svg);
|
|
25
|
+
});
|
|
26
|
+
}, [code, setSvg]);
|
|
27
|
+
|
|
28
|
+
return <pre className="mermaid" dangerouslySetInnerHTML={{ __html: svg }}></pre>;
|
|
29
|
+
};
|
package/src/global.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../lowcoder/src/global";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getI18nObjects, getValueByLocale, Translator } from "lowcoder-core";
|
|
2
|
+
import * as localeData from "./locales";
|
|
3
|
+
import { I18nObjects } from "./locales/types";
|
|
4
|
+
|
|
5
|
+
export const { trans, language } = new Translator<typeof localeData.en>(
|
|
6
|
+
localeData,
|
|
7
|
+
REACT_APP_LANGUAGES
|
|
8
|
+
);
|
|
9
|
+
export const i18nObjs = getI18nObjects<I18nObjects>(localeData, REACT_APP_LANGUAGES);
|
|
10
|
+
|
|
11
|
+
export function getEchartsLocale() {
|
|
12
|
+
return getValueByLocale("EN", (locale) => {
|
|
13
|
+
switch (locale.language) {
|
|
14
|
+
case "en":
|
|
15
|
+
return "EN";
|
|
16
|
+
case "zh":
|
|
17
|
+
return "ZH";
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getCalendarLocale() {
|
|
23
|
+
switch (language) {
|
|
24
|
+
case "zh":
|
|
25
|
+
return "zh-cn";
|
|
26
|
+
default:
|
|
27
|
+
return "en-gb";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export const en = {
|
|
2
|
+
chart: {
|
|
3
|
+
delete: "Delete",
|
|
4
|
+
data: "Data",
|
|
5
|
+
mode: "Mode",
|
|
6
|
+
config: "Configuration",
|
|
7
|
+
UIMode: "UI Mode",
|
|
8
|
+
chartType: "Chart type",
|
|
9
|
+
xAxis: "X-axis",
|
|
10
|
+
chartSeries: "Chart series",
|
|
11
|
+
customSeries: "Custom series",
|
|
12
|
+
add: "Add",
|
|
13
|
+
confirmDelete: "Confirm Delete: ",
|
|
14
|
+
seriesName: "Series Name",
|
|
15
|
+
dataColumns: "Data columns",
|
|
16
|
+
title: "Title",
|
|
17
|
+
xAxisDirection: "X axis direction",
|
|
18
|
+
xAxisName: "X axis name",
|
|
19
|
+
xAxisType: "X axis type",
|
|
20
|
+
xAxisTypeTooltip:
|
|
21
|
+
"By default, it will be automatically detected according to X-axis data. For the type description, please refer to: ",
|
|
22
|
+
logBase: "LogBase",
|
|
23
|
+
yAxisName: "Y axis name",
|
|
24
|
+
yAxisType: "Y axis type",
|
|
25
|
+
yAxisDataFormat: "Y axis data type",
|
|
26
|
+
yAxisDataFormatTooltip: `Value indicates the value of each coordinate. Example: '{{value * 100 + "%"}}'`,
|
|
27
|
+
basicBar: "Basic bar",
|
|
28
|
+
stackedBar: "Stacked bar",
|
|
29
|
+
barType: "Bar chart type",
|
|
30
|
+
categoryAxis: "Category axis",
|
|
31
|
+
valueAxis: "Value axis",
|
|
32
|
+
timeAxis: "Time axis",
|
|
33
|
+
logAxis: "Log axis",
|
|
34
|
+
auto: "Default",
|
|
35
|
+
legendPosition: "Legend position",
|
|
36
|
+
basicLine: "Basic line",
|
|
37
|
+
stackedLine: "Stacked line",
|
|
38
|
+
areaLine: "Area line",
|
|
39
|
+
smooth: "Smooth curve",
|
|
40
|
+
lineType: "Line chart type",
|
|
41
|
+
basicPie: "Basic pie",
|
|
42
|
+
doughnutPie: "Doughnut pie",
|
|
43
|
+
rosePie: "Rose pie",
|
|
44
|
+
pieType: "Pie chart type",
|
|
45
|
+
spending: "Spending",
|
|
46
|
+
budget: "Budget",
|
|
47
|
+
bar: "Bar chart",
|
|
48
|
+
line: "Line chart",
|
|
49
|
+
scatter: "Scatter chart",
|
|
50
|
+
pie: "Pie chart",
|
|
51
|
+
horizontal: "Horizontal",
|
|
52
|
+
vertical: "Vertical",
|
|
53
|
+
noData: "No data",
|
|
54
|
+
unknown: "Unknown",
|
|
55
|
+
select: "Select",
|
|
56
|
+
unSelect: "Unselect",
|
|
57
|
+
echartsOptionLabel: "Option",
|
|
58
|
+
echartsOptionTooltip: "ECharts option",
|
|
59
|
+
echartsOptionExamples: "ECharts examples",
|
|
60
|
+
selectDesc: "Triggered when the user selects part of the data in the chart",
|
|
61
|
+
unselectDesc: "Triggered when the user unselects part of the data in the chart",
|
|
62
|
+
selectedPointsDesc: "Selected points",
|
|
63
|
+
dataDesc: "The raw data used in the current chart",
|
|
64
|
+
titleDesc: "Current chart title",
|
|
65
|
+
scatterShape: "Scatter shape",
|
|
66
|
+
circle: "Circle",
|
|
67
|
+
rect: "Rect",
|
|
68
|
+
triangle: "Triangle",
|
|
69
|
+
diamond: "Diamond",
|
|
70
|
+
pin: "Pin",
|
|
71
|
+
arrow: "Arrow",
|
|
72
|
+
pointColorLabel: "Point color",
|
|
73
|
+
pointColorTooltip: `Set the point color according to the series name and current point value, optional variables: seriesName, value. Example: '{{value < 25000 ? "red" : "green"}}'`,
|
|
74
|
+
},
|
|
75
|
+
imageEditor: {
|
|
76
|
+
defaultSrc: "",
|
|
77
|
+
save: "Save",
|
|
78
|
+
saveDesc: "Save image",
|
|
79
|
+
src: "Image source",
|
|
80
|
+
name: "Image name",
|
|
81
|
+
buttonText: "Button text",
|
|
82
|
+
srcDesc: "Image source",
|
|
83
|
+
nameDesc: "Image name",
|
|
84
|
+
dataURIDesc: "Image data URI",
|
|
85
|
+
dataDesc: "Image data",
|
|
86
|
+
buttonTextDesc: "Button text",
|
|
87
|
+
},
|
|
88
|
+
calendar: {
|
|
89
|
+
events: "Events data",
|
|
90
|
+
editable: "Editable",
|
|
91
|
+
defaultDate: "Default date",
|
|
92
|
+
defaultDateTooltip: "The date that the calendar initially displays",
|
|
93
|
+
defaultView: "Default view",
|
|
94
|
+
defaultViewTooltip: "The view that the calendar initially displays",
|
|
95
|
+
showEventTime: "Show event times",
|
|
96
|
+
showEventTimeTooltip: "Whether to display the time text of the event",
|
|
97
|
+
showWeekends: "Show weekends",
|
|
98
|
+
showAllDay: "Show all-day",
|
|
99
|
+
showAllDayTooltip: "Whether to display the all-day slot in the week and day views",
|
|
100
|
+
dayMaxEvents: "Day max events",
|
|
101
|
+
dayMaxEventsTooltip:
|
|
102
|
+
"The maximum number of events to display in the month view per day, with 0 being limited to the height of the cell",
|
|
103
|
+
eventMaxStack: "Event max stack",
|
|
104
|
+
eventMaxStackTooltip:
|
|
105
|
+
"The maximum number of events to stack horizontally in the week and day views, with 0 being no limit",
|
|
106
|
+
selectInterval: "The interval selected on the calendar",
|
|
107
|
+
selectEvent: "Selected event",
|
|
108
|
+
changeSet:
|
|
109
|
+
"The event object changed by dragging in the calendar, the key is the eventId, and the value is the event",
|
|
110
|
+
headerBtnBackground: "Button background",
|
|
111
|
+
btnText: "Button text",
|
|
112
|
+
title: "Title",
|
|
113
|
+
selectBackground: "Selected background",
|
|
114
|
+
today: "Today",
|
|
115
|
+
month: "Month",
|
|
116
|
+
week: "Week",
|
|
117
|
+
day: "Day",
|
|
118
|
+
list: "List",
|
|
119
|
+
monday: "Monday",
|
|
120
|
+
tuesday: "Tuesday",
|
|
121
|
+
wednesday: "Wednesday",
|
|
122
|
+
thursday: "Thursday",
|
|
123
|
+
friday: "Friday",
|
|
124
|
+
saturday: "Saturday",
|
|
125
|
+
sunday: "Sunday",
|
|
126
|
+
startWeek: "Start from",
|
|
127
|
+
creatEvent: "Create event",
|
|
128
|
+
editEvent: "Edit event",
|
|
129
|
+
eventName: "Event name",
|
|
130
|
+
eventColor: "Event color",
|
|
131
|
+
eventGroupId: "Group ID",
|
|
132
|
+
groupIdTooltip:
|
|
133
|
+
"Group ID is used to group different events, and events in the same group can be dragged and resized together.",
|
|
134
|
+
more: "more",
|
|
135
|
+
allDay: "All day",
|
|
136
|
+
eventNameRequire: "Please enter Event name",
|
|
137
|
+
eventId: "Event ID",
|
|
138
|
+
eventIdRequire: "Please enter Event ID",
|
|
139
|
+
eventIdTooltip: "Unique ID for each event",
|
|
140
|
+
eventIdExist: "ID already exists",
|
|
141
|
+
},
|
|
142
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { I18nObjects } from "./types";
|
|
2
|
+
import { chartColorPalette } from "lowcoder-sdk";
|
|
3
|
+
|
|
4
|
+
export const enObj: I18nObjects = {
|
|
5
|
+
defaultDataSource: [
|
|
6
|
+
{
|
|
7
|
+
date: "2021-09",
|
|
8
|
+
department: "Administration",
|
|
9
|
+
spending: 9003,
|
|
10
|
+
budget: 8000,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
date: "2021-09",
|
|
14
|
+
department: "Finance",
|
|
15
|
+
spending: 3033,
|
|
16
|
+
budget: 4000,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
date: "2021-09",
|
|
20
|
+
department: "Sales",
|
|
21
|
+
spending: 9230,
|
|
22
|
+
budget: 8000,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
date: "2021-10",
|
|
26
|
+
department: "Administration",
|
|
27
|
+
spending: 13032,
|
|
28
|
+
budget: 15000,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
date: "2021-10",
|
|
32
|
+
department: "Finance",
|
|
33
|
+
spending: 2300,
|
|
34
|
+
budget: 5000,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
date: "2021-10",
|
|
38
|
+
department: "Sales",
|
|
39
|
+
spending: 7323.5,
|
|
40
|
+
budget: 8000,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
date: "2021-11",
|
|
44
|
+
department: "Administration",
|
|
45
|
+
spending: 13000,
|
|
46
|
+
budget: 16023,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
date: "2021-11",
|
|
50
|
+
department: "Finance",
|
|
51
|
+
spending: 3569.5,
|
|
52
|
+
budget: 3000,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
date: "2021-11",
|
|
56
|
+
department: "Sales",
|
|
57
|
+
spending: 10000,
|
|
58
|
+
budget: 9932,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
date: "2021-12",
|
|
62
|
+
department: "Administration",
|
|
63
|
+
spending: 18033,
|
|
64
|
+
budget: 20000,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
date: "2021-12",
|
|
68
|
+
department: "Finance",
|
|
69
|
+
spending: 4890,
|
|
70
|
+
budget: 4500,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
date: "2021-12",
|
|
74
|
+
department: "Sales",
|
|
75
|
+
spending: 9322,
|
|
76
|
+
budget: 8000,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
|
|
80
|
+
defaultEchartsJsonOption: {
|
|
81
|
+
title: {
|
|
82
|
+
text: "Funnel Chart",
|
|
83
|
+
left: "center",
|
|
84
|
+
},
|
|
85
|
+
backgroundColor: "#ffffff",
|
|
86
|
+
color: chartColorPalette,
|
|
87
|
+
tooltip: {
|
|
88
|
+
trigger: "item",
|
|
89
|
+
formatter: "{a} <br/>{b} : {c}%",
|
|
90
|
+
},
|
|
91
|
+
legend: {
|
|
92
|
+
data: ["Show", "Click", "Visit", "Query", "Buy"],
|
|
93
|
+
top: "bottom",
|
|
94
|
+
},
|
|
95
|
+
series: [
|
|
96
|
+
{
|
|
97
|
+
name: "Funnel",
|
|
98
|
+
type: "funnel",
|
|
99
|
+
left: "10%",
|
|
100
|
+
top: 60,
|
|
101
|
+
bottom: 60,
|
|
102
|
+
width: "80%",
|
|
103
|
+
min: 0,
|
|
104
|
+
max: 100,
|
|
105
|
+
gap: 2,
|
|
106
|
+
label: {
|
|
107
|
+
show: true,
|
|
108
|
+
position: "inside",
|
|
109
|
+
},
|
|
110
|
+
data: [
|
|
111
|
+
{ value: 100, name: "Show" },
|
|
112
|
+
{ value: 80, name: "Click" },
|
|
113
|
+
{ value: 60, name: "Visit" },
|
|
114
|
+
{ value: 40, name: "Query" },
|
|
115
|
+
{ value: 20, name: "Buy" },
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JSONObject } from "lowcoder-sdk";
|
|
2
|
+
import { XAXisComponentOption } from "echarts";
|
|
3
|
+
|
|
4
|
+
export type I18nObjects = {
|
|
5
|
+
defaultDataSource: JSONObject[];
|
|
6
|
+
defaultEchartsJsonOption: Record<string, unknown>;
|
|
7
|
+
timeXAxisLabel?: XAXisComponentOption["axisLabel"];
|
|
8
|
+
imageEditorLocale?: Record<string, string>;
|
|
9
|
+
};
|