Просмотр исходного кода

:globe_with_meridians: selected

visuddhinanda 3 лет назад
Родитель
Сommit
cd053089e1

+ 1 - 0
dashboard/src/locales/zh-Hans/buttons.ts

@@ -4,6 +4,7 @@ const items = {
 	"buttons.edit": "编辑",
 	"buttons.delete": "删除",
 	"buttons.delete.all": "批量删除",
+	"buttons.selected": "已经选择",
 };
 
 export default items;

+ 2 - 1
dashboard/src/pages/studio/anthology/list.tsx

@@ -151,7 +151,8 @@ const Widget = () => {
 				}) => (
 					<Space size={24}>
 						<span>
-							已选 {selectedRowKeys.length} 项
+							{intl.formatMessage({ id: "buttons.selected" })}{" "}
+							{selectedRowKeys.length}
 							<Button
 								type="link"
 								style={{ marginInlineStart: 8 }}

+ 4 - 1
dashboard/src/pages/studio/channel/list.tsx

@@ -168,7 +168,10 @@ const Widget = () => {
 				}) => (
 					<Space size={24}>
 						<span>
-							已选 {selectedRowKeys.length} 项
+							{intl.formatMessage({
+								id: "buttons.selected",
+							})}
+							{selectedRowKeys.length}
 							<Button
 								type="link"
 								style={{ marginInlineStart: 8 }}

+ 54 - 16
dashboard/src/pages/studio/dict/list.tsx

@@ -38,14 +38,18 @@ const Widget = () => {
 			<ProTable<IItem>
 				columns={[
 					{
-						title: intl.formatMessage({ id: "dict.fields.sn.label" }),
+						title: intl.formatMessage({
+							id: "dict.fields.sn.label",
+						}),
 						dataIndex: "id",
 						key: "id",
 						width: 80,
 						search: false,
 					},
 					{
-						title: intl.formatMessage({ id: "dict.fields.word.label" }),
+						title: intl.formatMessage({
+							id: "dict.fields.word.label",
+						}),
 						dataIndex: "word",
 						key: "word",
 						render: (_) => <Link to="">{_}</Link>,
@@ -53,7 +57,9 @@ const Widget = () => {
 						ellipsis: true,
 					},
 					{
-						title: intl.formatMessage({ id: "dict.fields.type.label" }),
+						title: intl.formatMessage({
+							id: "dict.fields.type.label",
+						}),
 						dataIndex: "type",
 						key: "type",
 						search: false,
@@ -68,25 +74,33 @@ const Widget = () => {
 						},
 					},
 					{
-						title: intl.formatMessage({ id: "dict.fields.grammar.label" }),
+						title: intl.formatMessage({
+							id: "dict.fields.grammar.label",
+						}),
 						dataIndex: "grammar",
 						key: "grammar",
 						search: false,
 					},
 					{
-						title: intl.formatMessage({ id: "dict.fields.parent.label" }),
+						title: intl.formatMessage({
+							id: "dict.fields.parent.label",
+						}),
 						dataIndex: "parent",
 						key: "parent",
 					},
 					{
-						title: intl.formatMessage({ id: "dict.fields.meaning.label" }),
+						title: intl.formatMessage({
+							id: "dict.fields.meaning.label",
+						}),
 						dataIndex: "meaning",
 						key: "meaning",
 						tip: "意思过长会自动收缩",
 						ellipsis: true,
 					},
 					{
-						title: intl.formatMessage({ id: "dict.fields.note.label" }),
+						title: intl.formatMessage({
+							id: "dict.fields.note.label",
+						}),
 						dataIndex: "note",
 						key: "note",
 						search: false,
@@ -94,13 +108,17 @@ const Widget = () => {
 						ellipsis: true,
 					},
 					{
-						title: intl.formatMessage({ id: "dict.fields.factors.label" }),
+						title: intl.formatMessage({
+							id: "dict.fields.factors.label",
+						}),
 						dataIndex: "factors",
 						key: "factors",
 						search: false,
 					},
 					{
-						title: intl.formatMessage({ id: "forms.fields.created-at.label" }),
+						title: intl.formatMessage({
+							id: "forms.fields.created-at.label",
+						}),
 						key: "created-at",
 						width: 200,
 
@@ -115,11 +133,20 @@ const Widget = () => {
 					// 注释该行则默认不显示下拉选项
 					selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
 				}}
-				tableAlertRender={({ selectedRowKeys, selectedRows, onCleanSelected }) => (
+				tableAlertRender={({
+					selectedRowKeys,
+					selectedRows,
+					onCleanSelected,
+				}) => (
 					<Space size={24}>
 						<span>
-							已选 {selectedRowKeys.length} 项
-							<Button type="link" style={{ marginInlineStart: 8 }} onClick={onCleanSelected}>
+							{intl.formatMessage({ id: "buttons.selected" })}
+							{selectedRowKeys.length}
+							<Button
+								type="link"
+								style={{ marginInlineStart: 8 }}
+								onClick={onCleanSelected}
+							>
 								取消选择
 							</Button>
 						</span>
@@ -142,7 +169,8 @@ const Widget = () => {
 						total: 1 << 12,
 						success: true,
 						data: Array.from(Array(size).keys()).map((x) => {
-							const id = ((params.current || 1) - 1) * size + x + 1;
+							const id =
+								((params.current || 1) - 1) * size + x + 1;
 
 							var it: IItem = {
 								id,
@@ -153,7 +181,9 @@ const Widget = () => {
 								meaning: `meaning ${id}`,
 								note: `note ${id}`,
 								factors: `factors ${id}`,
-								createdAt: Date.now() - Math.floor(Math.random() * 200000),
+								createdAt:
+									Date.now() -
+									Math.floor(Math.random() * 200000),
 							};
 							return it;
 						}),
@@ -171,8 +201,16 @@ const Widget = () => {
 				}}
 				headerTitle=""
 				toolBarRender={() => [
-					<Popover content={dictCreate} title="new channel" placement="bottomRight">
-						<Button key="button" icon={<PlusOutlined />} type="primary">
+					<Popover
+						content={dictCreate}
+						title="new channel"
+						placement="bottomRight"
+					>
+						<Button
+							key="button"
+							icon={<PlusOutlined />}
+							type="primary"
+						>
 							{intl.formatMessage({ id: "buttons.create" })}
 						</Button>
 					</Popover>,

+ 44 - 13
dashboard/src/pages/studio/recent/index.tsx

@@ -58,14 +58,18 @@ const Widget = () => {
 				<ProTable<IItem>
 					columns={[
 						{
-							title: intl.formatMessage({ id: "dict.fields.sn.label" }),
+							title: intl.formatMessage({
+								id: "dict.fields.sn.label",
+							}),
 							dataIndex: "id",
 							key: "id",
 							width: 50,
 							search: false,
 						},
 						{
-							title: intl.formatMessage({ id: "forms.fields.title.label" }),
+							title: intl.formatMessage({
+								id: "forms.fields.title.label",
+							}),
 							dataIndex: "title",
 							key: "title",
 							tip: "过长会自动收缩",
@@ -74,7 +78,9 @@ const Widget = () => {
 								return (
 									<div>
 										<div>
-											<Link to="edit/12345">{row.title}</Link>
+											<Link to="edit/12345">
+												{row.title}
+											</Link>
 										</div>
 										<div>{row.subtitle}</div>
 									</div>
@@ -82,7 +88,9 @@ const Widget = () => {
 							},
 						},
 						{
-							title: intl.formatMessage({ id: "forms.fields.publicity.label" }),
+							title: intl.formatMessage({
+								id: "forms.fields.publicity.label",
+							}),
 							dataIndex: "publicity",
 							key: "publicity",
 							width: 100,
@@ -99,7 +107,9 @@ const Widget = () => {
 							},
 						},
 						{
-							title: intl.formatMessage({ id: "forms.fields.created-at.label" }),
+							title: intl.formatMessage({
+								id: "forms.fields.created-at.label",
+							}),
 							key: "created-at",
 							width: 100,
 							search: false,
@@ -113,7 +123,11 @@ const Widget = () => {
 							width: 120,
 							valueType: "option",
 							render: (text, row, index, action) => [
-								<Dropdown.Button type="link" key={index} overlay={menu}>
+								<Dropdown.Button
+									type="link"
+									key={index}
+									overlay={menu}
+								>
 									{intl.formatMessage({ id: "buttons.edit" })}
 								</Dropdown.Button>,
 							],
@@ -122,13 +136,25 @@ const Widget = () => {
 					rowSelection={{
 						// 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
 						// 注释该行则默认不显示下拉选项
-						selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
+						selections: [
+							Table.SELECTION_ALL,
+							Table.SELECTION_INVERT,
+						],
 					}}
-					tableAlertRender={({ selectedRowKeys, selectedRows, onCleanSelected }) => (
+					tableAlertRender={({
+						selectedRowKeys,
+						selectedRows,
+						onCleanSelected,
+					}) => (
 						<Space size={24}>
 							<span>
-								已选 {selectedRowKeys.length} 项
-								<Button type="link" style={{ marginInlineStart: 8 }} onClick={onCleanSelected}>
+								{intl.formatMessage({ id: "buttons.selected" })}
+								{selectedRowKeys.length}
+								<Button
+									type="link"
+									style={{ marginInlineStart: 8 }}
+									onClick={onCleanSelected}
+								>
 									取消选择
 								</Button>
 							</span>
@@ -150,14 +176,19 @@ const Widget = () => {
 							total: 1 << 12,
 							success: true,
 							data: Array.from(Array(size).keys()).map((x) => {
-								const id = ((params.current || 1) - 1) * size + x + 1;
+								const id =
+									((params.current || 1) - 1) * size + x + 1;
 
 								var it: IItem = {
 									id,
 									title: `title ${id}`,
 									subtitle: `subtitle ${id}`,
-									publicity: (Math.floor(Math.random() * 3) + 1) * 10,
-									createdAt: Date.now() - Math.floor(Math.random() * 2000000000),
+									publicity:
+										(Math.floor(Math.random() * 3) + 1) *
+										10,
+									createdAt:
+										Date.now() -
+										Math.floor(Math.random() * 2000000000),
 								};
 								return it;
 							}),

+ 50 - 15
dashboard/src/pages/studio/term/list.tsx

@@ -28,14 +28,18 @@ const Widget = () => {
 			<ProTable<IItem>
 				columns={[
 					{
-						title: intl.formatMessage({ id: "term.fields.sn.label" }),
+						title: intl.formatMessage({
+							id: "term.fields.sn.label",
+						}),
 						dataIndex: "id",
 						key: "id",
 						width: 80,
 						search: false,
 					},
 					{
-						title: intl.formatMessage({ id: "term.fields.word.label" }),
+						title: intl.formatMessage({
+							id: "term.fields.word.label",
+						}),
 						dataIndex: "word",
 						key: "word",
 						render: (_) => <Link to="">{_}</Link>,
@@ -51,13 +55,17 @@ const Widget = () => {
 						},
 					},
 					{
-						title: intl.formatMessage({ id: "term.fields.description.label" }),
+						title: intl.formatMessage({
+							id: "term.fields.description.label",
+						}),
 						dataIndex: "tag",
 						key: "description",
 						search: false,
 					},
 					{
-						title: intl.formatMessage({ id: "term.fields.channel.label" }),
+						title: intl.formatMessage({
+							id: "term.fields.channel.label",
+						}),
 						dataIndex: "channel",
 						valueType: "select",
 						valueEnum: {
@@ -70,19 +78,25 @@ const Widget = () => {
 						},
 					},
 					{
-						title: intl.formatMessage({ id: "term.fields.meaning.label" }),
+						title: intl.formatMessage({
+							id: "term.fields.meaning.label",
+						}),
 						dataIndex: "meaning",
 						key: "meaning",
 					},
 					{
-						title: intl.formatMessage({ id: "term.fields.meaning2.label" }),
+						title: intl.formatMessage({
+							id: "term.fields.meaning2.label",
+						}),
 						dataIndex: "meaning2",
 						key: "meaning2",
 						tip: "意思过长会自动收缩",
 						ellipsis: true,
 					},
 					{
-						title: intl.formatMessage({ id: "term.fields.note.label" }),
+						title: intl.formatMessage({
+							id: "term.fields.note.label",
+						}),
 						dataIndex: "note",
 						key: "note",
 						search: false,
@@ -90,7 +104,9 @@ const Widget = () => {
 						ellipsis: true,
 					},
 					{
-						title: intl.formatMessage({ id: "forms.fields.created-at.label" }),
+						title: intl.formatMessage({
+							id: "forms.fields.created-at.label",
+						}),
 						key: "created-at",
 						width: 200,
 						search: false,
@@ -104,11 +120,20 @@ const Widget = () => {
 					// 注释该行则默认不显示下拉选项
 					selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
 				}}
-				tableAlertRender={({ selectedRowKeys, selectedRows, onCleanSelected }) => (
+				tableAlertRender={({
+					selectedRowKeys,
+					selectedRows,
+					onCleanSelected,
+				}) => (
 					<Space size={24}>
 						<span>
-							已选 {selectedRowKeys.length} 项
-							<Button type="link" style={{ marginInlineStart: 8 }} onClick={onCleanSelected}>
+							{intl.formatMessage({ id: "buttons.selected" })}
+							{selectedRowKeys.length}
+							<Button
+								type="link"
+								style={{ marginInlineStart: 8 }}
+								onClick={onCleanSelected}
+							>
 								取消选择
 							</Button>
 						</span>
@@ -131,7 +156,8 @@ const Widget = () => {
 						total: 1 << 12,
 						success: true,
 						data: Array.from(Array(size).keys()).map((x) => {
-							const id = ((params.current || 1) - 1) * size + x + 1;
+							const id =
+								((params.current || 1) - 1) * size + x + 1;
 
 							var it: IItem = {
 								id,
@@ -141,7 +167,9 @@ const Widget = () => {
 								meaning: `parent ${id}`,
 								meaning2: `meaning ${id}`,
 								note: `note ${id}`,
-								createdAt: Date.now() - Math.floor(Math.random() * 200000),
+								createdAt:
+									Date.now() -
+									Math.floor(Math.random() * 200000),
 							};
 							return it;
 						}),
@@ -155,8 +183,15 @@ const Widget = () => {
 				}}
 				headerTitle={intl.formatMessage({ id: "dict" })}
 				toolBarRender={() => [
-					<Popover content={<TermCreate studio={studioname} />} placement="bottomRight">
-						<Button key="button" icon={<PlusOutlined />} type="primary">
+					<Popover
+						content={<TermCreate studio={studioname} />}
+						placement="bottomRight"
+					>
+						<Button
+							key="button"
+							icon={<PlusOutlined />}
+							type="primary"
+						>
 							{intl.formatMessage({ id: "buttons.create" })}
 						</Button>
 					</Popover>,