Skip to content

Commit 7f0d07d

Browse files
committed
fix: add translation
1 parent 59aed48 commit 7f0d07d

5 files changed

Lines changed: 31 additions & 9 deletions

File tree

src/package.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@taoist-labs/components",
3-
"version": "0.3.11",
3+
"version": "0.3.13",
44
"description": "components",
55
"main": "index.js",
66
"repository": "",

src/packages/components/batchTable.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {TableProps, thProps} from "../type/compontent.type";
44
import AddIcon from '../svg/addPrimary';
55
import ImportImg from "../svg/table";
66
import * as XLSX from 'xlsx';
7+
import Lan from "../utils/lan";
78

89
const OuterBox = styled.div`
910
`
@@ -103,7 +104,7 @@ const BtnBox = styled.label`
103104
}
104105
`;
105106

106-
export default function BatchTable({item,showImport}:TableProps){
107+
export default function BatchTable({item,showImport,language}:TableProps){
107108

108109
const [column,setColumn] = useState(0);
109110
const [width,setWidth] = useState<number[]>([]);
@@ -197,7 +198,7 @@ export default function BatchTable({item,showImport}:TableProps){
197198

198199
</table>
199200
<MidBox>
200-
<div className="button" onClick={()=>showImport(1)}><AddIcon /> <span>添加明细</span></div>
201+
<div className="button" onClick={()=>showImport(1)}><AddIcon /> <span>{Lan[language ?? "zh"]?.addItem}</span></div>
201202

202203

203204
<BtnBox htmlFor="fileUpload" onChange={(e) => updateFile(e)}>
@@ -211,7 +212,7 @@ export default function BatchTable({item,showImport}:TableProps){
211212
}}
212213
/>
213214
<ImportImg />
214-
<span>导入表格</span>
215+
<span>{Lan[language ?? "zh"]?.Import}</span>
215216
</BtnBox>
216217

217218
</MidBox>

src/packages/components/component.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import DateTime from "./dateTime";
1111
import RichText from "./richText";
1212
import BatchTable from "./batchTable";
1313
import * as XLSX from 'xlsx';
14+
import Lan from "../utils/lan";
1415

1516

1617
const Box = styled.div`
@@ -57,10 +58,16 @@ const Tips = styled.div`
5758
const TipsBox = styled.div`
5859
`
5960

60-
const BackNav = styled.div`
61-
padding-bottom: 10px;
61+
const BackNav = styled.div<{theme?:string}>`
62+
6263
position: relative;
6364
z-index: 9;
65+
display: inline-block;
66+
padding:10px;
67+
border-radius: 5px;
68+
background: ${props=> props.theme === 'true'?"#2D2736":"rgba(82, 0, 255, 0.08)"};
69+
margin-bottom: 10px;
70+
margin-left: 5px;
6471
`
6572

6673
const Component = ({listArr,control,setValue,reset,data,getValues,theme,language,name,baseUrl,version,token,errors,watch,setError,clearErrors,operate,movitationSum,rpc}:ChildProps) =>{
@@ -197,7 +204,7 @@ const Component = ({listArr,control,setValue,reset,data,getValues,theme,language
197204
}
198205
{
199206
item.type === "table" && typeof list?.batchImport === "boolean" && (!batchShow || !!item?.value) && <BackNav onClick={()=>handleBack(index)}>
200-
&lt;返回上一层
207+
&lt; {Lan[language ?? "zh"]?.back}
201208
</BackNav>
202209
}
203210

@@ -206,6 +213,7 @@ const Component = ({listArr,control,setValue,reset,data,getValues,theme,language
206213
<BatchTable
207214
item={item}
208215
showImport={showImport}
216+
language={language}
209217
/>
210218
</TipsBox>
211219
}

src/packages/components/template.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,13 @@ const P32 = styled.div`
220220
}else{
221221
DataSource.map((dItem:any)=>{
222222
const cptIndex = initialItems.findIndex((item:any)=> item.name === dItem.name);
223+
if(cptIndex === -1){
224+
return;
225+
}
223226

224227
initialItems[cptIndex].data = dItem?.data ;
225228

229+
226230
updateRht.push({...initialItems[cptIndex], dragType: 'form'});
227231
})
228232
}

src/packages/utils/lan.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ interface Language {
1212
selectError:string;
1313
fileError:string
1414
status:string
15+
back:string
16+
addItem:string
17+
Import:string
1518
};
1619
}
1720

@@ -27,7 +30,10 @@ const Lan:Language = {
2730
inputError:"请选择正确内容",
2831
selectError:"请输入正确内容",
2932
fileError:"请选择正确的文件",
30-
status:"已通过"
33+
status:"已通过",
34+
back:"返回上一层",
35+
addItem:"添加明细",
36+
Import:"导入表格"
3137
},
3238
en:{
3339
dragTips:"Please select the components from the right",
@@ -40,7 +46,10 @@ const Lan:Language = {
4046
inputError:"Please enter the correct content.",
4147
selectError:"Please select the correct content",
4248
fileError:"Please select the correct file",
43-
status:"Passed"
49+
status:"Passed",
50+
back:"Back",
51+
addItem:"Add Item",
52+
Import:"Import"
4453
}
4554
}
4655
export default Lan

0 commit comments

Comments
 (0)