diff --git a/packages/dev/package.json b/packages/dev/package.json deleted file mode 100644 index e8f26d78..00000000 --- a/packages/dev/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "@kanaries/dev", - "version": "1.0.0", - "description": "", - "main": "src/index.ts", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC" -} diff --git a/packages/dev/src/index.ts b/packages/dev/src/index.ts deleted file mode 100644 index 646f7ff3..00000000 --- a/packages/dev/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function dev_test () { - console.log('this is a dev module test') -} \ No newline at end of file diff --git a/packages/dev/tsconfig.json b/packages/dev/tsconfig.json deleted file mode 100644 index 2f245bb6..00000000 --- a/packages/dev/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "outDir": "build", - "module": "ES6", - "lib": ["dom", "es2015", "ESNext"], - "types": ["node"], - "target": "ES2019", - "moduleResolution": "node", - "strict": true, - "noEmit": true, - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true - }, - "include": [ - "src" - ] -} \ No newline at end of file diff --git a/packages/rath-client/package.json b/packages/rath-client/package.json index c8263cab..e53087bd 100644 --- a/packages/rath-client/package.json +++ b/packages/rath-client/package.json @@ -14,7 +14,6 @@ "@kanaries/graphic-walker": "0.1.0", "@kanaries/loa": "0.0.5", "@kanaries/web-data-loader": "0.1.7", - "@kanaries/dev": "1.0.0", "@material-ui/core": "^5.0.0-beta.5", "@uifabric/icons": "^7.5.17", "@uifabric/react-hooks": "^7.13.9", diff --git a/packages/rath-client/public/locales/en-US.json b/packages/rath-client/public/locales/en-US.json index 4250e1f8..18a4e890 100644 --- a/packages/rath-client/public/locales/en-US.json +++ b/packages/rath-client/public/locales/en-US.json @@ -7,7 +7,14 @@ "settings": "Settings", "history": "History", "hide": "Hide", - "expand": "Expand" + "expand": "Expand", + "filter": "Filter", + "semanticType": { + "nominal": "nominal", + "ordinal": "ordinal", + "temporal": "temporal", + "quantitative": "quantitative" + } }, "menu": { "dataSource": "DataSource", diff --git a/packages/rath-client/public/locales/zh-CN.json b/packages/rath-client/public/locales/zh-CN.json index d47638a6..e2918e3f 100644 --- a/packages/rath-client/public/locales/zh-CN.json +++ b/packages/rath-client/public/locales/zh-CN.json @@ -7,7 +7,14 @@ "settings": "设置", "history": "历史记录", "hide": "隐藏", - "expand": "展开" + "expand": "展开", + "filter": "筛选", + "semanticType": { + "nominal": "类别类型", + "ordinal": "有序类型", + "temporal": "时间类型", + "quantitative": "数值类型" + } }, "menu": { "dataSource": "数据源", diff --git a/packages/rath-client/src/components/dropDownSelect.tsx b/packages/rath-client/src/components/dropDownSelect.tsx index 4142b3f7..86cf91da 100644 --- a/packages/rath-client/src/components/dropDownSelect.tsx +++ b/packages/rath-client/src/components/dropDownSelect.tsx @@ -46,7 +46,7 @@ const Cont = styled.div<{border?: boolean}>` font-size: inherit; height: 100%; outline: none; - padding-left: 7px; + padding-left: ${props => props.border ? '7px' : '0px'}; width: 100%; } ` diff --git a/packages/rath-client/src/components/fieldFilter/index.tsx b/packages/rath-client/src/components/fieldFilter/index.tsx index 8b8238f3..fcf7f46d 100644 --- a/packages/rath-client/src/components/fieldFilter/index.tsx +++ b/packages/rath-client/src/components/fieldFilter/index.tsx @@ -2,12 +2,13 @@ import { useId } from '@uifabric/react-hooks'; import produce from 'immer'; import { toJS } from 'mobx'; import { observer } from 'mobx-react-lite'; -import { Callout, ChoiceGroup, DefaultButton, IconButton, PrimaryButton, Stack, Selection, SelectionMode, Toggle } from 'office-ui-fabric-react'; +import { Callout, ChoiceGroup, DefaultButton, PrimaryButton, Stack, Selection, SelectionMode, Toggle, ActionButton } from 'office-ui-fabric-react'; import React, { useCallback, useMemo, useState } from 'react'; import { IFilter } from '../../interfaces'; import { useGlobalStore } from '../../store'; import RangeSelection from './rangeSelection'; import SetSelection from './setSelection'; +import intl from 'react-intl-universal'; interface FieldFilterProps { @@ -75,8 +76,8 @@ const FieldFilter: React.FC = props => { }, []) return
- diff --git a/packages/rath-client/src/pages/dataSource/dataTable/distributionMiniChart.tsx b/packages/rath-client/src/pages/dataSource/dataTable/distributionMiniChart.tsx deleted file mode 100644 index 1cb582c8..00000000 --- a/packages/rath-client/src/pages/dataSource/dataTable/distributionMiniChart.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import React, { useRef, useEffect } from 'react'; -import embed from 'vega-embed'; -import { ISemanticType } from 'visual-insights'; -import { IRow } from '../../../interfaces'; -export interface DistributionChartProps { - fieldType: ISemanticType; - x: string; - y: string; - dataSource: IRow[] -} - -const DistributionChart: React.FC = (props) => { - const chart = useRef(null); - const { x, y, dataSource, fieldType } = props; - useEffect(() => { - if (chart.current) { - let values: typeof dataSource = []; - let hasIndex = false; - if (fieldType === 'ordinal' && dataSource.some(member => { - return /(\[|\()-?([0-9.]+|Infinity),\s*([0-9.]+|Infinity)(\]|\))/.test(member.memberName) - })) { - values = dataSource.map(member => { - hasIndex = true; - let result = /(\[|\()(?-?([0-9.]+|Infinity)),\s*([0-9.]+|Infinity)(\]|\))/.exec(member.memberName); - - return { - ...member, - index: result === null ? member.name : Number(result.groups!.left) - } - }) - } else { - values = dataSource - } - values = values.slice(0, 100) - let sortBy: string | undefined | any = undefined; - if (fieldType === 'nominal') { - sortBy = '-y' - } else if (fieldType === 'ordinal' && hasIndex) { - sortBy = { field: 'index' } - } - const resultPromise = embed(chart.current, { - background: 'rgba(0,0,0,0)', - data: { - values - }, - view: { - stroke: null, - fill: null - }, - height: 80, - width: 180, - mark: ['quantitative', 'temporal'].includes(fieldType) ? 'line' : 'bar', - encoding: { - x: { - field: x, - title: null, - axis: null, - type: fieldType, sort: sortBy - }, - y: { field: y, type: 'quantitative', aggregate: 'sum', title: null, axis: null } - } - }, { - actions: false - }) - return () => { - resultPromise.then(res => { - if (res) { - res.finalize() - } - }).catch(console.error) - } - } - }, [x, y, dataSource, fieldType]) - return
-} - -export default DistributionChart; \ No newline at end of file diff --git a/packages/rath-client/src/pages/dataSource/dataTable/headerCell.tsx b/packages/rath-client/src/pages/dataSource/dataTable/headerCell.tsx index e1835bd0..4941651c 100644 --- a/packages/rath-client/src/pages/dataSource/dataTable/headerCell.tsx +++ b/packages/rath-client/src/pages/dataSource/dataTable/headerCell.tsx @@ -1,7 +1,6 @@ import React, { useMemo, useState } from 'react'; import styled from 'styled-components'; import intl from 'react-intl-universal'; -// import DistributionMiniChart from './distributionMiniChart'; import DistributionChart from '../metaView/distChart'; import DropdownSelect from '../../../components/dropDownSelect' import { IFieldMeta, IRawField } from '../../../interfaces'; @@ -18,6 +17,12 @@ const HeaderCellContainer = styled.div` right: 0px; top: 0px; margin: 0px 1px; + } + .info-container{ + min-height: 50px; + } + .viz-container{ + } .dim { background-color: #1890ff; @@ -31,10 +36,20 @@ const HeaderCellContainer = styled.div` .header{ margin-top: 0px; margin-bottom: 0px; + font-size: 18px; + line-height: 36px; + } + .checkbox-container{ + display: flex; + items-align: center; + margin-top: 2px; + label{ + margin-right: 6px; + } } `; -function getClassName (type: 'dimension' | 'measure', disable: boolean) { +function getClassName(type: 'dimension' | 'measure', disable: boolean) { if (disable) return 'disable' return type === "dimension" ? "dim" : "mea" } @@ -56,7 +71,7 @@ const DataTypeOptions: IOption[] = [ { key: 'temporal', text: 'temporal' } ] -function useBIFieldTypeOptions (): IOption[] { +function useBIFieldTypeOptions(): IOption[] { const dimensionLabel = intl.get('meta.dimension'); const measureLabel = intl.get('meta.measure'); const options = useMemo[]>(() => { @@ -75,76 +90,81 @@ const HeaderCell: React.FC = props => { const buttonId = useId('edit-button'); return ( -

- {name} - { - setShowNameEditor(true) - }} - /> - {meta && meta.geoRole !== 'none' && 'lalal'} +
+

+ {name} + { + setShowNameEditor(true) + }} + /> + {meta && meta.geoRole !== 'none' && 'lalal'} + { + meta && meta.geoRole !== 'none' && + } +

{ - meta && meta.geoRole !== 'none' && - } -

- { - showNameEditor && { setShowNameEditor(false); }} - > -
-

{intl.get('dataSource.table.edit')}

+ showNameEditor && { setShowNameEditor(false); }} + >
- { - onChange && onChange(code, 'name', `${val}`) - }} /> +

{intl.get('dataSource.table.edit')}

+
+ { + onChange && onChange(code, 'name', `${val}`) + }} /> +
-
-
- } - {meta && ( - { - if (onChange) { - onChange(code, 'semanticType', e.target.value as ISemanticType) - } - }}> - {DataTypeOptions.map((op) => ( - - ))} - - )} - { - { - if (onChange) { - // FIXME: 弱约束问题 - onChange(code, 'analyticType', e.target.value as IAnalyticType); - } - }}> - { - optionsOfBIFieldType.map(op => ) - } - - } -
- - { - onChange && onChange(code, 'disable', !e.target.checked) - }} /> + + } + {meta && ( + { + if (onChange) { + onChange(code, 'semanticType', e.target.value as ISemanticType) + } + }}> + {DataTypeOptions.map((op) => ( + + ))} + + )} + { + { + if (onChange) { + // FIXME: 弱约束问题 + onChange(code, 'analyticType', e.target.value as IAnalyticType); + } + }}> + { + optionsOfBIFieldType.map(op => ) + } + + } +
+ + { + onChange && onChange(code, 'disable', !e.target.checked) + }} /> +
+
+
+ {meta && }
{/* { onChange && onChange(code, 'disable', !isChecked) }} /> */} {/* {meta && } */} - {meta && } +
); diff --git a/packages/rath-client/src/pages/dataSource/dataTable/index.tsx b/packages/rath-client/src/pages/dataSource/dataTable/index.tsx index 0a175d5d..d70bf56b 100644 --- a/packages/rath-client/src/pages/dataSource/dataTable/index.tsx +++ b/packages/rath-client/src/pages/dataSource/dataTable/index.tsx @@ -12,6 +12,9 @@ const CustomBaseTable = styled(BaseTable)` .${Classes.tableHeaderCell} { position: relative; } + thead{ + vertical-align: top; + } `; const TableInnerStyle = { diff --git a/packages/rath-client/src/pages/dataSource/index.tsx b/packages/rath-client/src/pages/dataSource/index.tsx index 6fcf873d..463d3196 100644 --- a/packages/rath-client/src/pages/dataSource/index.tsx +++ b/packages/rath-client/src/pages/dataSource/index.tsx @@ -262,7 +262,6 @@ const DataSourceBoard: React.FC = (props) => { /> - {intl.get('dataSource.recordCount', { count: cleanedData.length })}
{intl.get('dataSource.rowsInViews', { origin: rawData.length, select: filteredData.length, clean: cleanedData.length })}
({ - [valueField]: `[${i + 1}]${Math.round(_min + i * step)}`, + [valueField]: Math.round(_min + i * step), [ctField]: b })) } diff --git a/packages/rath-client/src/pages/dataSource/metaView/metaList.tsx b/packages/rath-client/src/pages/dataSource/metaView/metaList.tsx index f32d3291..e51d0fd2 100644 --- a/packages/rath-client/src/pages/dataSource/metaView/metaList.tsx +++ b/packages/rath-client/src/pages/dataSource/metaView/metaList.tsx @@ -100,6 +100,11 @@ const MetaItem: React.FC = props => { ...ch, text: intl.get(`common.${ch.key}`) })) + + const SEMANTIC_TYPE_CHOICES_LANG: IChoiceGroupOption[] = SEMANTIC_TYPE_CHOICES.map(ch => ({ + ...ch, + text: intl.get(`common.semanticType.${ch.key}`) + })) return
@@ -130,7 +135,7 @@ const MetaItem: React.FC = props => {
{ onChange && option && onChange(colKey, 'semanticType', option.key) diff --git a/packages/rath-embed/package.json b/packages/rath-embed/package.json deleted file mode 100644 index f2bd3da1..00000000 --- a/packages/rath-embed/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "rath-embed", - "version": "0.0.1", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "GPL" -}