Compare commits

..

6 Commits

Author SHA1 Message Date
João Demenech
8086e2a2d1 [components,excel][xs]: change data for one of the stories 2023-07-13 11:04:36 -03:00
João Demenech
537d19cb2a Bump version 2023-07-12 18:20:31 -03:00
João Demenech
ea6f6a219f [components,map,excel][l]: fix leaflet map markers on prod and implement excel component 2023-07-12 18:16:22 -03:00
João Demenech
af548c56fd Merge branch 'main' of github.com:datopian/portaljs into feature/excel-component 2023-07-12 16:47:10 -03:00
João Demenech
990939175e [components,excel][m]: add support for multiple sheets 2023-07-11 17:43:30 -03:00
João Demenech
cbe693825c [components,excel][m]: initial version of the <Excel /> component 2023-07-10 17:44:11 -03:00
6 changed files with 11 additions and 100 deletions

View File

@@ -47,9 +47,6 @@
"vega": "5.25.0",
"vega-lite": "5.1.0",
"vitest": "^0.31.4",
"@react-pdf-viewer/core": "3.6.0",
"@react-pdf-viewer/default-layout": "3.6.0",
"pdfjs-dist": "2.15.349",
"xlsx": "^0.18.5"
},
"devDependencies": {

View File

@@ -1,32 +0,0 @@
// Core viewer
import { Viewer, Worker, SpecialZoomLevel } from '@react-pdf-viewer/core';
import { defaultLayoutPlugin } from '@react-pdf-viewer/default-layout';
// Import styles
import '@react-pdf-viewer/core/lib/styles/index.css';
import '@react-pdf-viewer/default-layout/lib/styles/index.css';
export interface PdfViewerProps {
url: string;
layout: boolean;
parentClassName?: string;
}
export function PdfViewer({
url,
layout = false,
parentClassName,
}: PdfViewerProps) {
const defaultLayoutPluginInstance = defaultLayoutPlugin();
return (
<Worker workerUrl="https://unpkg.com/pdfjs-dist@2.15.349/build/pdf.worker.js">
<div className={parentClassName}>
<Viewer
defaultScale={SpecialZoomLevel.PageWidth}
fileUrl={url}
plugins={layout ? [defaultLayoutPluginInstance] : []}
/>
</div>
</Worker>
);
}

View File

@@ -1,10 +1,9 @@
export * from './components/Table';
export * from './components/Catalog';
export * from './components/LineChart';
export * from './components/Vega';
export * from './components/VegaLite';
export * from './components/FlatUiTable';
export * from "./components/Table";
export * from "./components/Catalog";
export * from "./components/LineChart";
export * from "./components/Vega";
export * from "./components/VegaLite";
export * from "./components/FlatUiTable";
export * from './components/OpenLayers/OpenLayers';
export * from './components/Map';
export * from './components/PdfViewer';
export * from "./components/Map";
export * from "./components/Excel";

View File

@@ -1,50 +0,0 @@
import type { Meta, StoryObj } from '@storybook/react';
import { PdfViewer, PdfViewerProps } from '../src/components/PdfViewer';
const meta: Meta = {
title: 'Components/PdfViewer',
component: PdfViewer,
tags: ['autodocs'],
argTypes: {
url: {
description: 'URL to PDF file',
},
parentClassName: {
description: 'Classname for the parent div of the pdf viewer',
},
layour: {
description:
'Set to true if you want to have a layout with zoom level, page count, printing button etc',
defaultValue: false,
},
},
};
export default meta;
type Story = StoryObj<PdfViewerProps>;
export const PdfViewerStory: Story = {
name: 'PdfViewer',
args: {
url: 'https://cdn.filestackcontent.com/wcrjf9qPTCKXV3hMXDwK',
},
};
export const PdfViewerStoryWithLayout: Story = {
name: 'PdfViewer with the default layout',
args: {
url: 'https://cdn.filestackcontent.com/wcrjf9qPTCKXV3hMXDwK',
layout: true,
},
};
export const PdfViewerStoryWithHeight: Story = {
name: 'PdfViewer with a custom height',
args: {
url: 'https://cdn.filestackcontent.com/wcrjf9qPTCKXV3hMXDwK',
parentClassName: 'h-96',
layout: true,
},
};

View File

@@ -1,10 +1,6 @@
/** @type {import('tailwindcss').Config} */
export default {
content: [
'./index.html',
'./src/**/*.{js,ts,jsx,tsx}',
'./stories/*.{js,ts,jsx,tsx}',
],
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
theme: {},
plugins: [],
};

View File

@@ -4,6 +4,7 @@ import { defineConfig } from 'vitest/config';
import dts from 'vite-plugin-dts';
import tailwindcss from 'tailwindcss';
import { UserConfigExport } from 'vite';
import replace from 'rollup-plugin-re';
const app = async (): Promise<UserConfigExport> => {
return defineConfig({
@@ -36,7 +37,7 @@ const app = async (): Promise<UserConfigExport> => {
'vega',
'react-vega',
'ol',
'leaflet',
'leaflet'
],
output: {
manualChunks: undefined,
@@ -47,7 +48,7 @@ const app = async (): Promise<UserConfigExport> => {
'react-vega': 'react-vega',
'react-dom': 'ReactDOM',
tailwindcss: 'tailwindcss',
leaflet: 'leaflet',
leaflet: 'leaflet'
},
},
},