138 |
145 | {_.map(this.props.engine.getModel().layers.getArray(), layer => {
146 | return React.cloneElement(
147 | this.props.engine.getFactoryForElement(layer).generateWidget(this.props.engine, layer),
148 | {
149 | key: layer.getID()
150 | }
151 | );
152 | })}
153 |
154 |
155 | );
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "name": "storm-react-diagrams",
4 | "compilerOptions": {
5 | "suppressExcessPropertyErrors": true,
6 | "declaration": true,
7 | "outDir": "@types",
8 | "target": "es5",
9 | "strictNullChecks": false,
10 | "sourceMap": true,
11 | "skipLibCheck": true,
12 | "jsx": "react",
13 | "baseUrl": ".",
14 | "experimentalDecorators": true,
15 | "lib": [
16 | "dom",
17 | "es2015"
18 | ]
19 | },
20 | "exclude": [
21 | "node_modules",
22 | "**/*.spec.ts",
23 | "./dist"
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultSeverity": "error",
3 | "extends": [
4 | "tslint:recommended"
5 | ],
6 | "jsRules": {},
7 | "rules": {
8 | "member-access": false,
9 | "comment-format": false,
10 | "max-line-length": false,
11 | "object-literal-sort-keys": false,
12 | "quotemark": [true, "double", "jsx-double"],
13 | "arrow-parens": false,
14 | "indent": [true, "tabs", 2],
15 | "semicolon": false,
16 | "object-literal-key-quotes": [true, "as-needed"],
17 | "no-var-keyword": false,
18 | "jsdoc-format": false,
19 | "prefer-const": false,
20 | "interface-name": false,
21 | "array-type": false,
22 | "trailing-comma": false,
23 | "one-line": false,
24 | "object-literal-shorthand": false,
25 | "no-string-literal": false,
26 | "ordered-imports": false,
27 | "prefer-for-of": false,
28 | "no-empty-interface": false
29 | },
30 | "rulesDirectory": []
31 | }
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const webpack = require("webpack");
2 | const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
3 | const nodeExternals = require('webpack-node-externals');
4 |
5 | const production = process.env.NODE_ENV === "production";
6 | let plugins = [];
7 |
8 | if (production) {
9 | console.log("creating production build");
10 | plugins.push(
11 | new webpack.DefinePlugin({
12 | "process.env.NODE_ENV": '"production"'
13 | })
14 | );
15 | }
16 |
17 | module.exports = {
18 | entry: "./src/main.ts",
19 | output: {
20 | filename: "main.js",
21 | path: __dirname + "/dist",
22 | libraryTarget: "umd",
23 | library: "storm-react-canvas"
24 | },
25 | externals: [nodeExternals()],
26 | plugins: plugins,
27 | module: {
28 | rules: [
29 | {
30 | enforce: "pre",
31 | test: /\.js$/,
32 | loader: "source-map-loader"
33 | },
34 | {
35 | test: /\.tsx?$/,
36 | loader: "ts-loader"
37 | }
38 | ]
39 | },
40 | resolve: {
41 | extensions: [".tsx", ".ts", ".js"]
42 | },
43 | devtool: production ? "source-map" : "cheap-module-source-map",
44 | mode: production ? "production" : "development",
45 | optimization: {
46 | minimizer: [
47 | new UglifyJsPlugin({
48 | uglifyOptions: {
49 | compress: false,
50 | ecma: 5,
51 | mangle: false
52 | },
53 | sourceMap: true
54 | })
55 | ]
56 | }
57 | };
58 |
--------------------------------------------------------------------------------