Skip to content

Commit

Permalink
Merge branch 'feature/sc-46279/explo-sdk-table-render-mini-map-for-ge…
Browse files Browse the repository at this point in the history
…o-point' into feature/sc-46279/explo-sdk-table-render-mini-map-for-geo-point--add-geo-shape
  • Loading branch information
KevinFabre-ods committed Jul 3, 2024
2 parents c52124e + 9ae11aa commit e679902
Show file tree
Hide file tree
Showing 45 changed files with 474 additions and 290 deletions.
285 changes: 132 additions & 153 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
"build-ci": "npm ci --workspaces --include-workspace-root --install-links",
"test": "lerna run test --parallel --no-bail",
"watch": "lerna run watch --parallel --stream",
"lint": "lerna run lint:prettier:check,lint:eslint:check --parallel --no-bail",
"lint": "lerna run lint:prettier:check,lint:eslint:check,lint:svelte:check --parallel --no-bail",
"lint:fix": "lerna run lint:prettier:fix,lint:eslint:fix --parallel --no-bail",
"build-package-lock": "lerna run build-package-lock",
"storybook": "lerna run --scope=@opendatasoft/visualizations-react storybook"
},
"devDependencies": {
"lerna": "^8.1.2",
"nx": "^19.0.7"
"nx": "^19.2.3"
},
"dependencies": {
"-": "^0.0.1"
Expand Down
11 changes: 11 additions & 0 deletions packages/visualizations-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.25.0](https://github.com/opendatasoft/ods-dataviz-sdk/compare/@opendatasoft/[email protected]...@opendatasoft/[email protected]) (2024-06-26)


### Features

* **Table:** loading state ([#240](https://github.com/opendatasoft/ods-dataviz-sdk/issues/240)) ([65bbcea](https://github.com/opendatasoft/ods-dataviz-sdk/commit/65bbcea85313c602bebb0f46c4b6647594c9c623))





## [0.24.1](https://github.com/opendatasoft/ods-dataviz-sdk/compare/@opendatasoft/[email protected]...@opendatasoft/[email protected]) (2024-06-03)


Expand Down
21 changes: 21 additions & 0 deletions packages/visualizations-react/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021 Opendatasoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 3 additions & 3 deletions packages/visualizations-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opendatasoft/visualizations-react",
"version": "0.24.1",
"version": "0.25.0",
"license": "MIT",
"author": "opendatasoft",
"homepage": "https://github.com/opendatasoft/ods-dataviz-sdk",
Expand Down Expand Up @@ -52,7 +52,7 @@
"arrowParens": "avoid"
},
"dependencies": {
"@opendatasoft/visualizations": "0.24.1",
"@opendatasoft/visualizations": "0.25.0",
"use-callback-ref": "^1.2.4"
},
"devDependencies": {
Expand Down Expand Up @@ -114,5 +114,5 @@
"tslib": "^2.1.0",
"typescript": "4.6"
},
"gitHead": "d8439e859fbc458019572f50ac920e367719476a"
"gitHead": "5b28cc594764f53129f0de5847152dd55e27ab24"
}
4 changes: 2 additions & 2 deletions packages/visualizations-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type {
MarkdownTextProps,
ChoroplethGeoJsonProps,
ChoroplethVectorTilesProps,
MapPoiProps,
PoiMapProps,
TableProps,
} from '@opendatasoft/visualizations';
import reactifySvelte from 'reactify';
Expand All @@ -39,5 +39,5 @@ export const ChoroplethSvg = reactifySvelte<ChoroplethGeoJsonProps>(
_ChoroplethSvg,
'ods-visualizations-choropleth-svg'
);
export const PoiMap = reactifySvelte<MapPoiProps>(_PoiMap, 'ods-visualizations-poi-map');
export const PoiMap = reactifySvelte<PoiMapProps>(_PoiMap, 'ods-visualizations-poi-map');
export const Table = reactifySvelte<TableProps>(_Table, 'ods-visualizations-table');
19 changes: 18 additions & 1 deletion packages/visualizations-react/stories/Table/Table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const data: Async<TableData> = {
loading: false,
};

const fetchingData: Async<TableData> = {
value: [],
loading: true,
};

const Template: ComponentStory<typeof Table> = args => <Table {...args} />;

export const Playground = Template.bind({});
Expand Down Expand Up @@ -76,4 +81,16 @@ export const Unstyled = Template.bind({});
Unstyled.args = {
data,
options: { ...options, unstyled: true },
};
};

export const Loading = Template.bind({});
Loading.args = {
data: fetchingData,
options,
};

export const emptyState = Template.bind({});
emptyState.args = {
data: { value: [], loading: false },
options: { ...options, emptyStateLabel: 'Neniuj registroj trovitaj...' },
};
1 change: 0 additions & 1 deletion packages/visualizations-react/stories/Table/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export const columns: Column[] = [
bbox: [-6.855469, 41.343825, 11.645508, 51.37178],
zoom: 3,
},
display: () => 'Click to open map',
sources: (v: unknown) => ({
'table-stories' : {
type: 'geojson',
Expand Down
16 changes: 16 additions & 0 deletions packages/visualizations/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.25.0](https://github.com/opendatasoft/ods-dataviz-sdk/compare/@opendatasoft/[email protected]...@opendatasoft/[email protected]) (2024-06-26)


### Bug Fixes

* **Table:** basic select style ([#244](https://github.com/opendatasoft/ods-dataviz-sdk/issues/244)) ([6095574](https://github.com/opendatasoft/ods-dataviz-sdk/commit/6095574a7a0df037b4710ddcd778bdc72b200498))


### Features

* **Table:** loading state ([#240](https://github.com/opendatasoft/ods-dataviz-sdk/issues/240)) ([65bbcea](https://github.com/opendatasoft/ods-dataviz-sdk/commit/65bbcea85313c602bebb0f46c4b6647594c9c623))





## [0.24.1](https://github.com/opendatasoft/ods-dataviz-sdk/compare/@opendatasoft/[email protected]...@opendatasoft/[email protected]) (2024-06-03)


Expand Down
21 changes: 21 additions & 0 deletions packages/visualizations/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021 Opendatasoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 5 additions & 3 deletions packages/visualizations/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opendatasoft/visualizations",
"version": "0.24.1",
"version": "0.25.0",
"license": "MIT",
"author": "opendatasoft",
"homepage": "https://github.com/opendatasoft/ods-dataviz-sdk",
Expand All @@ -21,6 +21,7 @@
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
"styles": "dist/index.css",
"svelte": "src/index.ts",
"scripts": {
"prepare": "rimraf dist && rollup --config",
"build": "rollup --config",
Expand Down Expand Up @@ -79,7 +80,6 @@
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-svelte": "^6.1.0",
"rollup-plugin-terser": "^7.0.2",
"sass": "^1.70.0",
"svelte": "^3.43.2",
"svelte-check": "^2.2.7",
"svelte-eslint-parser": "^0.33.1",
Expand All @@ -104,6 +104,8 @@
"markdown-it": "^12.0.4",
"markdown-it-link-attributes": "^3.0.0",
"markdown-it-mark": "^3.0.1",
"sass": "^1.70.0",
"tippy.js": "^6.3.7"
}
},
"gitHead": "5b28cc594764f53129f0de5847152dd55e27ab24"
}
21 changes: 9 additions & 12 deletions packages/visualizations/src/components/Chart/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import * as ChartJs from 'chart.js';
import { Chart as ChartModule, registerables, defaults } from 'chart.js';
import { TreemapController, TreemapElement } from 'chartjs-chart-treemap';
import ChartDataLabels from 'chartjs-plugin-datalabels';
import DataLabels from 'chartjs-plugin-datalabels';
import Stacked100Plugin from 'chartjs-plugin-stacked100';
import Chart from './Chart.svelte';
import PieDataLabelsPlugin from './pieDataLabelsPlugin';

ChartJs.Chart.register(...ChartJs.registerables);
ChartJs.Chart.register(ChartDataLabels);
ChartJs.Chart.register(PieDataLabelsPlugin);
ChartJs.Chart.register(Stacked100Plugin);
ChartJs.Chart.register(TreemapController, TreemapElement);
ChartModule.register(...registerables);
ChartModule.register(DataLabels);
ChartModule.register(PieDataLabelsPlugin);
ChartModule.register(Stacked100Plugin);
ChartModule.register(TreemapController, TreemapElement);

ChartJs.defaults.animation = false;
defaults.animation = false;

// Export ChartJS to allow reusing instance and changing default, use case not supported
// eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle
export const _ChartJs = ChartJs;
// eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle
export const _ChartDataLabels = ChartDataLabels;
export const _ChartDataLabels = DataLabels;
export default Chart;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { geoPath, GeoProjection } from 'd3-geo';
import { geoPath } from 'd3-geo';
import type { GeoProjection } from 'd3-geo';
import type { Feature, FeatureCollection } from 'geojson';
import type { SvgPropertyMapping } from './types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<svelte:options immutable={true} />

<script lang="ts">
import maplibregl, {
Map as MapType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<svelte:options immutable={true} />

<script lang="ts">
import { onDestroy } from 'svelte';
import { debounce } from 'lodash';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<script lang="ts">
import CategoryLegend from '../Legend/CategoryLegend.svelte';
import SourceLink from '../utils/SourceLink.svelte';
import Map from '../utils/Map';
import CategoryLegend from '../../Legend/CategoryLegend.svelte';
import SourceLink from '../../utils/SourceLink.svelte';
import WelGlMap from '../WebGl';
import type { MapPoiProps } from './types';
import type { PoiMapProps } from './types';
import { DEFAULT_ASPECT_RATIO } from './constants';
// ensure exported type matches declared props
type $$Props = MapPoiProps;
type $$Props = PoiMapProps;
export let data: $$Props['data'];
export let options: $$Props['options'];
Expand Down Expand Up @@ -44,7 +44,7 @@
{/if}
<div class="main" aria-describedby={description ? mapId.toString() : undefined}>
{#key options.style}
<Map {options} data={data.value} />
<WelGlMap {options} data={data.value} />
{/key}
</div>
{#if description}
Expand Down
3 changes: 3 additions & 0 deletions packages/visualizations/src/components/Map/Poi/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import PoiMap from './Poi.svelte';

export default PoiMap;
20 changes: 20 additions & 0 deletions packages/visualizations/src/components/Map/Poi/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Async } from '../../../types';
import type { Source } from '../../types';
import type { WebGlMapData, WebGlMapOptions } from '../WebGl/types';
import type { CategoryLegend } from '../../Legend/types';

export type PoiMapData = Async<WebGlMapData>;

export type PoiMapOptions = WebGlMapOptions & {
title?: string;
subtitle?: string;
description?: string;
legend?: CategoryLegend;
/** Link button to source */
sourceLink?: Source;
};

export type PoiMapProps = {
data: PoiMapData;
options: PoiMapOptions;
};
Loading

0 comments on commit e679902

Please sign in to comment.