-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: refactoring, removed unnecessary code, added correct build ops
- Loading branch information
Showing
8 changed files
with
136 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
build | ||
dist | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import peerDepsExternal from "rollup-plugin-peer-deps-external"; | ||
import postcss from "rollup-plugin-postcss"; | ||
import resolve from "@rollup/plugin-node-resolve"; | ||
import typescript from "rollup-plugin-typescript2"; | ||
|
||
const packageJson = require("./package.json"); | ||
|
||
export default { | ||
input: "src/index.ts", | ||
output: [ | ||
{ | ||
file: packageJson.iife, | ||
format: "iife", | ||
name: "SDS", | ||
}, | ||
], | ||
plugins: [peerDepsExternal(), resolve(), commonjs(), typescript({ useTsconfigDeclarationDir: true }), postcss()], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import Dashboard from "./Dashboard/Dashboard"; | ||
import { DataProviderInterface } from "./DataProvider.types"; | ||
import DefaultDataProvider from "./DataProvider"; | ||
import render from "./render"; | ||
|
||
export { Dashboard, DataProviderInterface, DefaultDataProvider }; | ||
export { render, Dashboard, DataProviderInterface, DefaultDataProvider }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import Dashboard from "./Dashboard/Dashboard"; | ||
import { UiConfigType } from "./Dashboard/Embedded"; | ||
import DataProvider from "./DataProvider"; | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
|
||
function render( | ||
elementId: string, | ||
endpoint: string, | ||
username: string, | ||
password: string, | ||
uuid: string, | ||
placeholder?: string | boolean, | ||
autosize: boolean = false, | ||
uiConfig?: UiConfigType | ||
) { | ||
const element = document.getElementById(elementId); | ||
if (!element) { | ||
console.error(`Element with id ${elementId} not found`); | ||
return; | ||
} | ||
const dataProvider = new DataProvider(endpoint, { username, password }); | ||
|
||
ReactDOM.render( | ||
<React.StrictMode> | ||
<Dashboard | ||
placeholder={placeholder} | ||
autosize={autosize} | ||
domain={endpoint} | ||
dataProvider={dataProvider} | ||
uuid={uuid} | ||
uiConfig={uiConfig} | ||
/> | ||
</React.StrictMode>, | ||
document.getElementById(elementId) | ||
); | ||
} | ||
|
||
export default render; |