Skip to content

Commit

Permalink
chore: 补充 Github 首页说明 (#1)
Browse files Browse the repository at this point in the history
* chore: 补充 Github 首页说明

* build: 修复 sam 安装失败的问题

* build: 将 CI 中 npm 替换为 yarn

* fix: 修复 eslint 报错问题

---------

Co-authored-by: yanxiong <oujinhui.ojh@antgroup.com>
  • Loading branch information
heiyexing and heiyexing committed Oct 20, 2023
1 parent d6e2f6f commit dd4d507
Show file tree
Hide file tree
Showing 50 changed files with 382 additions and 350 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run ci
- run: yarn
- run: yarn ci
# - name: coverall
# if: success()
# uses: coverallsapp/github-action@master
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
dist: docs-dist
build: |
npm install
npm run docs:build
yarn
yarn docs:build
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: npm run ci
- run: yarn
- run: yarn ci

publish-site:
needs: build
Expand All @@ -23,8 +23,8 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: npm run docs:build
- run: yarn
- run: yarn docs:build
- run: |
cd docs-dist
git init
Expand Down
23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/l7-editor",
"version": "1.1.2",
"version": "1.1.3",
"description": "Geographic data editing tool based on L7",
"files": [
"lib",
Expand All @@ -10,19 +10,18 @@
"module": "es/index.js",
"types": "es/index.d.ts",
"license": "MIT",
"author": "oujinhui.ojh",
"scripts": {
"start": "dumi dev",
"build": "father build",
"i18n:collect": "kiwi --extract src",
"lint": "run-p lint:*",
"lint:ts": "eslint src __tests__ --ext .ts,.tsx --ignore-pattern 'src/**/demos/'",
"lint:style": "stylelint --fix src/**/*.less",
"prettier": "prettier --write 'src/*.{tsx,ts,md,json}'",
"lint-fix": "eslint src __tests__ --fix --ext .ts,.tsx --format=pretty && npm run lint:style",
"lint:ts": "eslint src --ext .ts,.tsx --ignore-pattern 'src/**/demos/'",
"lint-fix": "eslint src --fix --ext .ts,.tsx --format=pretty",
"prettier": "prettier --write 'src/**.{tsx,ts,md,json}'",
"clean": "rimraf es lib dist umd",
"format": "prettier --cache --write .",
"prepare": "dumi setup",
"ci": "run-s lint doctor build",
"setup": "dumi setup",
"doctor": "father doctor",
"docs:build": "dumi build",
Expand Down Expand Up @@ -62,9 +61,6 @@
"wellknown": "^0.5.0",
"xlsx": "^0.18.5"
},
"tnpm": {
"mode": "npm"
},
"yuyanId": "180020010001251474",
"devDependencies": {
"@antv/l7": "^2.11.0",
Expand All @@ -91,6 +87,7 @@
"gh-pages": "^4.0.0",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"npm-run-all": "^4.1.5",
"typescript": "^4.1.2",
"webpack-bundle-analyzer": "^4.9.0"
},
Expand All @@ -110,12 +107,20 @@
"prettier --parser=typescript --write"
]
},
"author": {
"name": "AntV",
"url": "https://antv.antgroup.com"
},
"homepage": "https://l7editor.antv.antgroup.com",
"repository": {
"type": "git",
"url": "https://github.com/antvis/L7Editor"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"bugs": {
"url": "https://github.com/antvis/L7Editor/issues"
}
}
9 changes: 5 additions & 4 deletions src/components/app-header/btn/download-btn.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { CloudDownloadOutlined } from '@ant-design/icons';
import { coordAll } from '@turf/turf';
import { Button, Dropdown, MenuProps } from 'antd';
import type { MenuProps } from 'antd';
import { Button, Dropdown } from 'antd';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { downloadText } from '../../../utils';
import { prettierText } from '../../../utils/prettier-text';
import { useFeature } from './../../../recoil';
// @ts-ignore
import tokml from 'tokml';
import { downloadText } from '../../../utils';
import { prettierText } from '../../../utils/prettier-text';
import { GeoJSON2Wkt } from '../../../utils/wkt';
import { useFeature } from './../../../recoil';

const DownloadBtn: React.FC = () => {
const { editorText, fc } = useFeature();
Expand Down
39 changes: 21 additions & 18 deletions src/components/app-header/btn/import-btn/file-upload.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { FileTextOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { Geometry, feature, featureCollection } from '@turf/turf';
import { Form, Select, Tooltip, Upload, UploadFile, message } from 'antd';
import type { Geometry } from '@turf/turf';
import { feature, featureCollection } from '@turf/turf';
import type { UploadFile } from 'antd';
import { Form, Select, Tooltip, Upload, message } from 'antd';
import { cloneDeep } from 'lodash';
import React, {
forwardRef,
Expand Down Expand Up @@ -114,46 +116,47 @@ const FileUpload = forwardRef<any>(function FileUpload({}, ref) {
}
}),
}),
[fileList, uploadData],
[fileList, t, uploadData],
);

const selectItem = useMemo(() => {
if (selectList.length) {
const data = selectList.map((item, index) => {
const options = item.columns.map((item: string | number) => {
const options = item.columns.map((option: string | number) => {
return {
value: item,
label: item,
value: option,
label: option,
};
});
return (
<Form.Item
name={item.id}
label={`${t('import_btn.file_upload.wenJian')}${index + 1}`}
key={item.id}
>
<Select
options={options}
style={{ width: 300 }}
onChange={(e) => {
const newData = selectList.find((v) => v.id === item.id);
const data = newData?.data.map((value: any) => {
const newData1 = selectList.find((v) => v.id === item.id);
const newData2 = newData1?.data.map((value: any) => {
return value[e];
});
const propertiesList = newData?.data.map((v: any) => {
const propertiesList = newData1?.data.map((v: any) => {
const properties = cloneDeep(v);
delete properties[e];
return { ...properties };
});
let newGeoJson = [];
if (isWkt(data[0])) {
newGeoJson = data.map((v: string, index: number) => {
if (isWkt(newData2[0])) {
newGeoJson = newData2.map((v: string, geojsonIndex: number) => {
const geometry = parse(v) as Geometry;
return feature(geometry, { ...propertiesList[index] });
return feature(geometry, { ...propertiesList[geojsonIndex] });
});
} else if (isGeometry(data[0])) {
newGeoJson = data.map((v: string, index: number) => {
} else if (isGeometry(newData2[0])) {
newGeoJson = newData2.map((v: string, geojsonIndex: number) => {
return feature(JSON.parse(v), {
...propertiesList[index],
...propertiesList[geojsonIndex],
});
});
} else {
Expand All @@ -162,9 +165,9 @@ const FileUpload = forwardRef<any>(function FileUpload({}, ref) {
);
}
const newDates = uploadData.filter(
(item) => item.id !== newData?.id,
(updateItem) => updateItem.id !== newData1?.id,
);
newDates.push({ features: newGeoJson, id: newData?.id });
newDates.push({ features: newGeoJson, id: newData1?.id });
setUploadData(newDates);
}}
/>
Expand All @@ -173,7 +176,7 @@ const FileUpload = forwardRef<any>(function FileUpload({}, ref) {
});
return data;
}
}, [selectList, uploadData]);
}, [selectList, t, uploadData]);

return (
<>
Expand Down
16 changes: 4 additions & 12 deletions src/components/app-header/btn/import-btn/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import { CloudUploadOutlined } from '@ant-design/icons';
import { FeatureCollection } from '@turf/turf';
import {
Button,
Form,
message,
Modal,
Radio,
Tabs,
TabsProps,
Tooltip,
} from 'antd';
import type { FeatureCollection } from '@turf/turf';
import type { TabsProps } from 'antd';
import { Button, Form, message, Modal, Radio, Tabs, Tooltip } from 'antd';
import React, { useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { GeoJsonEditor } from '../../../../components/geojson-editor';
import { FeatureCollectionVT } from '../../../../constants/variable-type';
import { useFeature } from '../../../../recoil';
import { IFeatures } from '../../../../types';
import type { IFeatures } from '../../../../types';
import FileUpload from './file-upload';
import UrlUpload from './url-upload';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Form, Input, Radio } from 'antd';
import React, { forwardRef, useImperativeHandle } from 'react';
import { useTranslation } from 'react-i18next';
import { useLnglat } from '../../../../recoil';
import { LngLatImportType } from '../../../../types';
import type { LngLatImportType } from '../../../../types';

const LngLatImportBtn = forwardRef(({}, ref) => {
const {
Expand All @@ -15,10 +15,10 @@ const LngLatImportBtn = forwardRef(({}, ref) => {
} = useLnglat();
const { t } = useTranslation();

const LngLatImportTypeOptions: Array<{
const LngLatImportTypeOptions: {
label: string;
value: LngLatImportType;
}> = [
}[] = [
{
label: t('import_btn.lnglat_import_btn.dian'),
value: 'Point',
Expand Down Expand Up @@ -46,7 +46,7 @@ const LngLatImportBtn = forwardRef(({}, ref) => {
reject(t('import_btn.lnglat_import_btn.lNGLA'));
}),
}),
[lngLatText, lngLatImportType],
[lngLatText, importLngLatText, t],
);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/app-header/btn/import-btn/url-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const UrlUpload = forwardRef(({}, ref) => {
}
}),
}),
[inputValue, radioValue],
[inputValue, radioValue, t],
);

return (
Expand Down
1 change: 1 addition & 0 deletions src/components/app-header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const AppHeader: React.FC<AppHeaderProps> = ({ toolbar }) => {
});
setFirstOpen(false);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const DropdownMenuItems: MenuProps['items'] = [
Expand Down
3 changes: 1 addition & 2 deletions src/components/app-header/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { theme } from 'antd';
const useStyle = () => {
const { useToken } = theme;
const { token } = useToken();
const { colorBorder, colorBgContainer, colorText, colorIcon, colorFill } =
token;
const { colorBorder, colorBgContainer, colorText } = token;

return {
mapHeader: css`
Expand Down
5 changes: 4 additions & 1 deletion src/components/app-map/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { LarkMap } from '@antv/larkmap';
import { useMount } from 'ahooks';
import { message } from 'antd';
import React, { ReactNode, useEffect, useMemo } from 'react';
import type { ReactNode } from 'react';
import React, { useEffect, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import {
FeatureCollectionVT,
Expand Down Expand Up @@ -42,6 +43,7 @@ export const AppMap: React.FC<AppMapProps> = ({ children }) => {
if (scene) {
bboxAutoFit();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [scene]);

useEffect(() => {
Expand All @@ -54,6 +56,7 @@ export const AppMap: React.FC<AppMapProps> = ({ children }) => {
JSON.stringify({ type: 'FeatureCollection', features: [] }, null, 2),
);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const mapOptions = useMemo(() => {
Expand Down
25 changes: 19 additions & 6 deletions src/components/app-table/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { DeleteOutlined, PlusSquareOutlined } from '@ant-design/icons';
import { Scene } from '@antv/l7';
import { Feature, bbox, center, featureCollection } from '@turf/turf';
import type { Scene } from '@antv/l7';
import type { Feature } from '@turf/turf';
import { bbox, center, featureCollection } from '@turf/turf';
import { useSize } from 'ahooks';
import type { FormInstance } from 'antd';
import {
Button,
Empty,
Form,
FormInstance,
Input,
InputNumber,
Popconfirm,
Expand Down Expand Up @@ -210,7 +211,7 @@ export const AppTable: React.FC = () => {
width: 80,
align: 'center',
fixed: 'left',
sorter: (a: any, b: any) => a['__index'] - b['__index'],
sorter: (a: any, b: any) => a.__index - b.__index,
});
}

Expand Down Expand Up @@ -373,7 +374,7 @@ export const AppTable: React.FC = () => {
<a
onClick={() => {
resetFeatures(
features.filter((_, index) => {
features.filter((feature, index) => {
return index !== record[FeatureKey.Index];
}),
);
Expand All @@ -387,7 +388,19 @@ export const AppTable: React.FC = () => {
),
});
return newColumns;
}, [features, newDataSource, resetFeatures, scene, t, transformCoord]);
}, [
addInputValue,
features,
newDataSource,
resetFeatures,
scene,
styles.addButton,
styles.addColumns,
styles.delButton,
styles.deleteColumns,
t,
transformCoord,
]);

const handleSave = (row: any) => {
const newData = [...newDataSource];
Expand Down
Loading

0 comments on commit dd4d507

Please sign in to comment.