@worktile/planet 10.0.0 → 12.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.all-contributorsrc +84 -0
- package/.circleci/config.yml +17 -0
- package/.coveralls.yml +1 -0
- package/.docgeni/public/assets/favicon.ico +0 -0
- package/.docgeni/public/index.html +13 -0
- package/.docgenirc.js +35 -0
- package/.dockerignore +1 -0
- package/.editorconfig +22 -0
- package/.github/FUNDING.yml +12 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.prettierignore +7 -0
- package/.prettierrc +28 -0
- package/.travis.yml +26 -0
- package/.wpmrc.js +11 -0
- package/CHANGELOG.md +391 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/Dockerfile +11 -0
- package/LICENSE +21 -0
- package/README.md +348 -0
- package/README.zh-CN.md +307 -0
- package/SECURITY.md +21 -0
- package/angular.json +373 -0
- package/commitlint.config.js +6 -0
- package/docs/api/defineApplication.md +46 -0
- package/docs/api/globalEventDispatcher.md +51 -0
- package/docs/api/index.md +5 -0
- package/docs/api/planet.md +117 -0
- package/docs/guides/getting-started.md +174 -0
- package/docs/guides/index.md +5 -0
- package/docs/guides/intro.md +216 -0
- package/examples/app1/browserslist +11 -0
- package/examples/app1/extra-webpack.config.js +33 -0
- package/examples/app1/karma.conf.js +31 -0
- package/examples/app1/postcss.config.js +1 -0
- package/examples/app1/src/app/app.module.ts +44 -0
- package/examples/app1/src/app/app.routing.ts +49 -0
- package/examples/app1/src/app/counter.service.ts +16 -0
- package/examples/app1/src/app/dashboard/dashboard.component.html +51 -0
- package/examples/app1/src/app/dashboard/dashboard.component.ts +70 -0
- package/examples/app1/src/app/detail/detail.component.html +8 -0
- package/examples/app1/src/app/detail/detail.component.ts +18 -0
- package/examples/app1/src/app/overlay.ts +26 -0
- package/examples/app1/src/app/projects/dialog/projects-dialog.component.html +10 -0
- package/examples/app1/src/app/projects/dialog/projects-dialog.component.ts +41 -0
- package/examples/app1/src/app/projects/projects.component.ts +33 -0
- package/examples/app1/src/app/root/root.component.css +3 -0
- package/examples/app1/src/app/root/root.component.html +16 -0
- package/examples/app1/src/app/root/root.component.ts +35 -0
- package/examples/app1/src/app/services/initialized-data.resolver.ts +15 -0
- package/examples/app1/src/app/shared.module.ts +57 -0
- package/examples/app1/src/app/user/detail/user-detail.component.html +5 -0
- package/examples/app1/src/app/user/detail/user-detail.component.ts +20 -0
- package/examples/app1/src/app/user/user-list.component.html +7 -0
- package/examples/app1/src/app/user/user-list.component.ts +20 -0
- package/examples/app1/src/app/user/user.module.ts +31 -0
- package/examples/app1/src/assets/.gitkeep +0 -0
- package/examples/app1/src/assets/github.png +0 -0
- package/examples/app1/src/assets/main.css +3 -0
- package/examples/app1/src/environments/environment.prod.ts +3 -0
- package/examples/app1/src/environments/environment.ts +16 -0
- package/examples/app1/src/favicon.ico +0 -0
- package/examples/app1/src/index.html +14 -0
- package/examples/app1/src/main.ts +35 -0
- package/examples/app1/src/polyfills.ts +84 -0
- package/examples/app1/src/styles.scss +35 -0
- package/examples/app1/src/test.ts +14 -0
- package/examples/app1/temp.js +221 -0
- package/examples/app1/tsconfig.app.json +10 -0
- package/examples/app1/tsconfig.spec.json +18 -0
- package/examples/app1/tslint.json +17 -0
- package/examples/app1/webpack.config.js +127 -0
- package/examples/app2/browserslist +11 -0
- package/examples/app2/extra-webpack.config.js +32 -0
- package/examples/app2/karma.conf.js +31 -0
- package/examples/app2/src/app/app.module.ts +90 -0
- package/examples/app2/src/app/dashboard/dashboard.component.html +21 -0
- package/examples/app2/src/app/dashboard/dashboard.component.ts +27 -0
- package/examples/app2/src/app/overlay.ts +26 -0
- package/examples/app2/src/app/projects/detail/detail.component.html +16 -0
- package/examples/app2/src/app/projects/detail/detail.component.ts +21 -0
- package/examples/app2/src/app/projects/project-list.component.html +29 -0
- package/examples/app2/src/app/projects/project-list.component.ts +58 -0
- package/examples/app2/src/app/projects/project.resolver.ts +15 -0
- package/examples/app2/src/app/projects/projects.service.ts +28 -0
- package/examples/app2/src/app/projects/tasks/tasks.component.html +10 -0
- package/examples/app2/src/app/projects/tasks/tasks.component.ts +16 -0
- package/examples/app2/src/app/projects/view/view.component.html +1 -0
- package/examples/app2/src/app/projects/view/view.component.ts +20 -0
- package/examples/app2/src/app/root/root.component.html +14 -0
- package/examples/app2/src/app/root/root.component.scss +12 -0
- package/examples/app2/src/app/root/root.component.ts +28 -0
- package/examples/app2/src/app/shared.module.ts +59 -0
- package/examples/app2/src/assets/.gitkeep +0 -0
- package/examples/app2/src/environments/environment.prod.ts +3 -0
- package/examples/app2/src/environments/environment.ts +16 -0
- package/examples/app2/src/favicon.ico +0 -0
- package/examples/app2/src/index.html +14 -0
- package/examples/app2/src/main.ts +36 -0
- package/examples/app2/src/polyfills.ts +84 -0
- package/examples/app2/src/styles.scss +28 -0
- package/examples/app2/src/test.ts +14 -0
- package/examples/app2/tsconfig.app.json +10 -0
- package/examples/app2/tsconfig.spec.json +18 -0
- package/examples/app2/tslint.json +7 -0
- package/examples/app2/webpack.config.js +92 -0
- package/examples/common/app-root-context.ts +10 -0
- package/examples/common/cache.ts +82 -0
- package/examples/common/index.ts +13 -0
- package/examples/common/module.ts +10 -0
- package/examples/common/overlay-container.service.ts +28 -0
- package/examples/common/section-card/section-card.component.html +5 -0
- package/examples/common/section-card/section-card.component.scss +15 -0
- package/examples/common/section-card/section-card.component.ts +11 -0
- package/examples/common/utils.ts +0 -0
- package/examples/portal/src/app/a-detail/a-detail.component.html +8 -0
- package/examples/portal/src/app/a-detail/a-detail.component.ts +18 -0
- package/examples/portal/src/app/about/about.component.html +27 -0
- package/examples/portal/src/app/about/about.component.scss +0 -0
- package/examples/portal/src/app/about/about.component.spec.ts +26 -0
- package/examples/portal/src/app/about/about.component.ts +26 -0
- package/examples/portal/src/app/app-routing.module.ts +57 -0
- package/examples/portal/src/app/app.component.html +73 -0
- package/examples/portal/src/app/app.component.scss +58 -0
- package/examples/portal/src/app/app.component.spec.ts +33 -0
- package/examples/portal/src/app/app.component.ts +111 -0
- package/examples/portal/src/app/app.module.ts +64 -0
- package/examples/portal/src/app/custom-settings.service.ts +44 -0
- package/examples/portal/src/app/overlay.ts +26 -0
- package/examples/portal/src/app/settings/settings.component.html +31 -0
- package/examples/portal/src/app/settings/settings.component.scss +3 -0
- package/examples/portal/src/app/settings/settings.component.ts +43 -0
- package/examples/portal/src/assets/.gitkeep +0 -0
- package/examples/portal/src/assets/apps.json +29 -0
- package/examples/portal/src/assets/icons/sprite.defs.svg +1 -0
- package/examples/portal/src/assets/images/logo.svg +16 -0
- package/examples/portal/src/assets/ngx-planet-micro-front-end.gif +0 -0
- package/examples/portal/src/browserslist +11 -0
- package/examples/portal/src/environments/environment.prod.ts +3 -0
- package/examples/portal/src/environments/environment.ts +16 -0
- package/examples/portal/src/extra-webpack.config.js +32 -0
- package/examples/portal/src/favicon.ico +0 -0
- package/examples/portal/src/index.html +14 -0
- package/examples/portal/src/karma.conf.js +31 -0
- package/examples/portal/src/main.ts +18 -0
- package/examples/portal/src/polyfills.ts +84 -0
- package/examples/portal/src/reboot.scss +14 -0
- package/examples/portal/src/styles.scss +14 -0
- package/examples/portal/src/test.ts +14 -0
- package/examples/portal/src/tsconfig.app.json +10 -0
- package/examples/portal/src/tsconfig.spec.json +9 -0
- package/examples/portal/src/tslint.json +7 -0
- package/extra-webpack.config.js +5 -0
- package/nginx.conf +17 -0
- package/package.json +120 -15
- package/packages/planet/karma.conf.js +37 -0
- package/packages/planet/ng-package.json +7 -0
- package/packages/planet/package.json +10 -0
- package/packages/planet/src/application/planet-application-loader.spec.ts +1102 -0
- package/packages/planet/src/application/planet-application-loader.ts +549 -0
- package/packages/planet/src/application/planet-application-ref.spec.ts +233 -0
- package/packages/planet/src/application/planet-application-ref.ts +131 -0
- package/packages/planet/src/application/planet-application.service.spec.ts +145 -0
- package/packages/planet/src/application/planet-application.service.ts +88 -0
- package/packages/planet/src/application/portal-application.spec.ts +53 -0
- package/packages/planet/src/application/portal-application.ts +28 -0
- package/packages/planet/src/assets-loader.spec.ts +689 -0
- package/packages/planet/src/assets-loader.ts +247 -0
- package/packages/planet/src/component/planet-component-loader.spec.ts +187 -0
- package/packages/planet/src/component/planet-component-loader.ts +173 -0
- package/{component/planet-component-ref.d.ts → packages/planet/src/component/planet-component-ref.ts} +3 -2
- package/{component/plant-component.config.d.ts → packages/planet/src/component/plant-component.config.ts} +4 -3
- package/packages/planet/src/debug.spec.ts +58 -0
- package/packages/planet/src/debug.ts +66 -0
- package/packages/planet/src/empty/empty.component.spec.ts +34 -0
- package/packages/planet/src/empty/empty.component.ts +7 -0
- package/packages/planet/src/global-event-dispatcher.spec.ts +81 -0
- package/packages/planet/src/global-event-dispatcher.ts +82 -0
- package/packages/planet/src/global-planet.spec.ts +39 -0
- package/packages/planet/src/global-planet.ts +73 -0
- package/packages/planet/src/helpers.spec.ts +242 -0
- package/packages/planet/src/helpers.ts +125 -0
- package/packages/planet/src/module.spec.ts +79 -0
- package/packages/planet/src/module.ts +25 -0
- package/packages/planet/src/planet.class.ts +59 -0
- package/packages/planet/src/planet.spec.ts +226 -0
- package/packages/planet/src/planet.ts +113 -0
- package/{public-api.d.ts → packages/planet/src/public-api.ts} +4 -0
- package/packages/planet/src/sandbox/constants.ts +6 -0
- package/packages/planet/src/sandbox/exec.ts +22 -0
- package/packages/planet/src/sandbox/index.ts +24 -0
- package/packages/planet/src/sandbox/proxy/patches/document.ts +13 -0
- package/packages/planet/src/sandbox/proxy/patches/eventListener.ts +49 -0
- package/packages/planet/src/sandbox/proxy/patches/index.ts +13 -0
- package/packages/planet/src/sandbox/proxy/patches/storage.ts +53 -0
- package/packages/planet/src/sandbox/proxy/patches/timer.ts +50 -0
- package/packages/planet/src/sandbox/proxy/proxies/common.ts +137 -0
- package/packages/planet/src/sandbox/proxy/proxies/document.ts +140 -0
- package/packages/planet/src/sandbox/proxy/proxies/window.ts +176 -0
- package/packages/planet/src/sandbox/proxy/proxy-sandbox.ts +59 -0
- package/packages/planet/src/sandbox/proxy/types.ts +20 -0
- package/packages/planet/src/sandbox/sandbox.ts +20 -0
- package/packages/planet/src/sandbox/snapshot/snapshot-sandbox.ts +12 -0
- package/packages/planet/src/sandbox/types.ts +1 -0
- package/packages/planet/src/test.ts +16 -0
- package/packages/planet/src/testing/app1.module.ts +34 -0
- package/packages/planet/src/testing/app2.module.ts +24 -0
- package/packages/planet/src/testing/applications.ts +58 -0
- package/packages/planet/src/testing/index.ts +2 -0
- package/packages/planet/src/testing/utils.ts +31 -0
- package/packages/planet/tsconfig.lib.json +27 -0
- package/packages/planet/tsconfig.lib.prod.json +9 -0
- package/packages/planet/tsconfig.spec.json +17 -0
- package/packages/planet/tslint.json +7 -0
- package/postcss.config.js +3 -0
- package/proxy.conf.js +15 -0
- package/tsconfig.json +23 -0
- package/tslint.json +80 -0
- package/application/planet-application-loader.d.ts +0 -68
- package/application/planet-application-ref.d.ts +0 -32
- package/application/planet-application.service.d.ts +0 -18
- package/application/portal-application.d.ts +0 -14
- package/assets-loader.d.ts +0 -23
- package/bundles/worktile-planet.umd.js +0 -1670
- package/bundles/worktile-planet.umd.js.map +0 -1
- package/bundles/worktile-planet.umd.min.js +0 -16
- package/bundles/worktile-planet.umd.min.js.map +0 -1
- package/component/planet-component-loader.d.ts +0 -27
- package/empty/empty.component.d.ts +0 -2
- package/esm2015/application/planet-application-loader.js +0 -417
- package/esm2015/application/planet-application-ref.js +0 -86
- package/esm2015/application/planet-application.service.js +0 -87
- package/esm2015/application/portal-application.js +0 -16
- package/esm2015/assets-loader.js +0 -165
- package/esm2015/component/planet-component-loader.js +0 -157
- package/esm2015/component/planet-component-ref.js +0 -3
- package/esm2015/component/plant-component.config.js +0 -7
- package/esm2015/empty/empty.component.js +0 -10
- package/esm2015/global-event-dispatcher.js +0 -71
- package/esm2015/global-planet.js +0 -51
- package/esm2015/helpers.js +0 -116
- package/esm2015/module.js +0 -27
- package/esm2015/planet.class.js +0 -9
- package/esm2015/planet.js +0 -86
- package/esm2015/public-api.js +0 -18
- package/esm2015/worktile-planet.js +0 -6
- package/fesm2015/worktile-planet.js +0 -1257
- package/fesm2015/worktile-planet.js.map +0 -1
- package/global-event-dispatcher.d.ts +0 -19
- package/global-planet.d.ts +0 -22
- package/helpers.d.ts +0 -37
- package/module.d.ts +0 -5
- package/planet.class.d.ts +0 -34
- package/planet.d.ts +0 -24
- package/worktile-planet.d.ts +0 -5
- package/worktile-planet.metadata.json +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// const ngToolsWebpack = require('@ngtools/webpack');
|
|
2
|
+
// const path = require('path');
|
|
3
|
+
// const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
4
|
+
// const ProgressPlugin = require('webpack/lib/ProgressPlugin');
|
|
5
|
+
// const workspaceRoot = path.resolve(__dirname, './');
|
|
6
|
+
// const projectRoot = path.resolve(__dirname, './');
|
|
7
|
+
// const {
|
|
8
|
+
// IndexHtmlWebpackPlugin
|
|
9
|
+
// } = require('@angular-devkit/build-angular/src/angular-cli-files/plugins/index-html-webpack-plugin');
|
|
10
|
+
// const WebpackAssetsManifest = require('webpack-assets-manifest');
|
|
11
|
+
|
|
12
|
+
// const config = {
|
|
13
|
+
// mode: 'development',
|
|
14
|
+
// resolve: {
|
|
15
|
+
// extensions: ['.ts', '.js']
|
|
16
|
+
// },
|
|
17
|
+
// context: projectRoot,
|
|
18
|
+
// entry: {
|
|
19
|
+
// main: path.resolve(projectRoot, './src/main.ts'),
|
|
20
|
+
// polyfills: path.resolve(projectRoot, './src/polyfills.ts')
|
|
21
|
+
// },
|
|
22
|
+
// output: {
|
|
23
|
+
// path: path.resolve(workspaceRoot, './dist'),
|
|
24
|
+
// filename: `[name].js`,
|
|
25
|
+
// libraryTarget: 'umd',
|
|
26
|
+
// library: 'app2'
|
|
27
|
+
// },
|
|
28
|
+
// plugins: [
|
|
29
|
+
// new WebpackAssetsManifest(),
|
|
30
|
+
// new ngToolsWebpack.AngularCompilerPlugin({
|
|
31
|
+
// tsConfigPath: path.resolve(projectRoot, './src/tsconfig.app.json'),
|
|
32
|
+
// mainPath: path.resolve(projectRoot, './src/main.ts'),
|
|
33
|
+
// hostReplacementPaths: {
|
|
34
|
+
// './src/environments/environment.ts': './src/environments/environment.prod.ts'
|
|
35
|
+
// },
|
|
36
|
+
// sourceMap: true,
|
|
37
|
+
// compilerOptions: {}
|
|
38
|
+
// }),
|
|
39
|
+
// new IndexHtmlWebpackPlugin({
|
|
40
|
+
// input: path.resolve(__dirname, './src/index.html'),
|
|
41
|
+
// output: path.basename('./src/index.html')
|
|
42
|
+
// // baseHref: buildOptions.baseHref,
|
|
43
|
+
// // entrypoints: generateEntryPoints(buildOptions),
|
|
44
|
+
// // deployUrl: buildOptions.deployUrl,
|
|
45
|
+
// // sri: buildOptions.subresourceIntegrity
|
|
46
|
+
// }),
|
|
47
|
+
// // new HtmlWebpackPlugin({
|
|
48
|
+
// // filename: 'src/index.html'
|
|
49
|
+
// // })
|
|
50
|
+
// new ProgressPlugin()
|
|
51
|
+
// ],
|
|
52
|
+
// module: {
|
|
53
|
+
// rules: [
|
|
54
|
+
// { test: /\.scss$/, loaders: ['raw-loader', 'sass-loader'] },
|
|
55
|
+
// { test: /\.css$/, loader: 'raw-loader' },
|
|
56
|
+
// { test: /\.html$/, loader: 'raw-loader' },
|
|
57
|
+
// {
|
|
58
|
+
// // Mark files inside `@angular/core` as using SystemJS style dynamic imports.
|
|
59
|
+
// // Removing this will cause deprecation warnings to appear.
|
|
60
|
+
// test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/,
|
|
61
|
+
// parser: { system: true }
|
|
62
|
+
// },
|
|
63
|
+
// // require.resolve is required only because of the monorepo structure here.
|
|
64
|
+
// {
|
|
65
|
+
// test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
|
|
66
|
+
// // test: /\.ts$/,
|
|
67
|
+
// loader: require.resolve('@ngtools/webpack')
|
|
68
|
+
// }
|
|
69
|
+
// ]
|
|
70
|
+
// },
|
|
71
|
+
// devServer: {
|
|
72
|
+
// historyApiFallback: true,
|
|
73
|
+
// port: 3002
|
|
74
|
+
// },
|
|
75
|
+
// watch: true
|
|
76
|
+
// };
|
|
77
|
+
|
|
78
|
+
// const assets = ['favicon.ico', 'assets/'];
|
|
79
|
+
// const copyWebpackPluginPatterns = assets.map(asset => {
|
|
80
|
+
// return {
|
|
81
|
+
// from: `src/${asset}`,
|
|
82
|
+
// to: asset.includes('.') ? '' : asset
|
|
83
|
+
// };
|
|
84
|
+
// });
|
|
85
|
+
// const copyWebpackPluginOptions = {
|
|
86
|
+
// ignore: ['.gitkeep', '**/.DS_Store', '**/Thumbs.db']
|
|
87
|
+
// };
|
|
88
|
+
|
|
89
|
+
// const copyWebpackPluginInstance = new CopyWebpackPlugin(copyWebpackPluginPatterns, copyWebpackPluginOptions);
|
|
90
|
+
// config.plugins.push(copyWebpackPluginInstance);
|
|
91
|
+
|
|
92
|
+
// module.exports = config;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { helpers } from 'ngx-tethys/util';
|
|
2
|
+
const { isString, isNumber } = helpers;
|
|
3
|
+
const NUMBER_PREFIX = `____n____`;
|
|
4
|
+
|
|
5
|
+
const supportedStorage = window && window.localStorage;
|
|
6
|
+
const storageSource = window.localStorage || window.sessionStorage;
|
|
7
|
+
|
|
8
|
+
const cache = {
|
|
9
|
+
/**
|
|
10
|
+
* set item to local storage
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* cache.set('key1', 'key1-value');
|
|
14
|
+
* cache.set('key1', 10);
|
|
15
|
+
* cache.set('key1', { id: 1, name: 'name 1'});
|
|
16
|
+
* cache.set('key1', 'key1-value', false);
|
|
17
|
+
* @param key string
|
|
18
|
+
* @param value string | number | object
|
|
19
|
+
*/
|
|
20
|
+
set<TValue = string>(key: string, value: TValue) {
|
|
21
|
+
const itemValue = isString(value)
|
|
22
|
+
? value
|
|
23
|
+
: isNumber(value)
|
|
24
|
+
? `${NUMBER_PREFIX}${value}`
|
|
25
|
+
: JSON.stringify(value);
|
|
26
|
+
if (supportedStorage) {
|
|
27
|
+
storageSource.setItem(key, itemValue as string);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* get item from local storage
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* cache.get('key1');
|
|
35
|
+
* cache.get<number>('key1');
|
|
36
|
+
* cache.get<User>('key1');
|
|
37
|
+
* cache.get<User[]>('key1');
|
|
38
|
+
* cache.get('key1', false);
|
|
39
|
+
*
|
|
40
|
+
* @param key string
|
|
41
|
+
*/
|
|
42
|
+
get<TValue = string>(key: string): TValue {
|
|
43
|
+
if (supportedStorage) {
|
|
44
|
+
const value = storageSource.getItem(key);
|
|
45
|
+
if (value) {
|
|
46
|
+
try {
|
|
47
|
+
const result = JSON.parse(value);
|
|
48
|
+
return result;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if (isString(value) && value.includes(NUMBER_PREFIX)) {
|
|
51
|
+
return parseInt(value.replace(NUMBER_PREFIX, ''), 10) as any;
|
|
52
|
+
} else {
|
|
53
|
+
return value as any;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* remove key from storage
|
|
65
|
+
* @param key cache key
|
|
66
|
+
*/
|
|
67
|
+
remove(key: string) {
|
|
68
|
+
if (supportedStorage) {
|
|
69
|
+
storageSource.removeItem(key);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* clear all storage
|
|
74
|
+
*/
|
|
75
|
+
clear() {
|
|
76
|
+
if (supportedStorage) {
|
|
77
|
+
storageSource.clear();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export { cache };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Overlay, OverlayContainer } from '@angular/cdk/overlay';
|
|
2
|
+
import { Provider } from '@angular/core';
|
|
3
|
+
import { PlanetOverlayContainer } from './overlay-container.service';
|
|
4
|
+
|
|
5
|
+
export * from './app-root-context';
|
|
6
|
+
export * from './module';
|
|
7
|
+
export * from './cache';
|
|
8
|
+
export * from './overlay-container.service';
|
|
9
|
+
|
|
10
|
+
export const OVERLAY_PROVIDER: Provider = {
|
|
11
|
+
provide: OverlayContainer,
|
|
12
|
+
useClass: PlanetOverlayContainer
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { SectionCardComponent } from './section-card/section-card.component';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
declarations: [SectionCardComponent],
|
|
7
|
+
imports: [CommonModule],
|
|
8
|
+
exports: [SectionCardComponent]
|
|
9
|
+
})
|
|
10
|
+
export class DemoCommonModule {}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { OverlayContainer } from '@angular/cdk/overlay';
|
|
2
|
+
import { Platform } from '@angular/cdk/platform';
|
|
3
|
+
import { DOCUMENT } from '@angular/common';
|
|
4
|
+
import { Inject, Injectable } from '@angular/core';
|
|
5
|
+
|
|
6
|
+
@Injectable({ providedIn: 'root' })
|
|
7
|
+
export class PlanetOverlayContainer extends OverlayContainer {
|
|
8
|
+
constructor(@Inject(DOCUMENT) document: any, protected _platform: Platform) {
|
|
9
|
+
super(document, _platform);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
private _getContainerElement(): HTMLElement {
|
|
13
|
+
if (!this._containerElement) {
|
|
14
|
+
this._containerElement = this._document.querySelector('.cdk-overlay-container');
|
|
15
|
+
return this._containerElement;
|
|
16
|
+
} else {
|
|
17
|
+
return this._containerElement;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getContainerElement(): HTMLElement {
|
|
22
|
+
if (!this._getContainerElement()) {
|
|
23
|
+
this._createContainer();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return this._containerElement;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.section-card {
|
|
2
|
+
display: block;
|
|
3
|
+
position: relative;
|
|
4
|
+
padding: 15px;
|
|
5
|
+
border: 2px $gray-300 dashed;
|
|
6
|
+
|
|
7
|
+
.section-card-header {
|
|
8
|
+
position: absolute;
|
|
9
|
+
padding: 0 10px;
|
|
10
|
+
background: $white;
|
|
11
|
+
top: -10px;
|
|
12
|
+
left: 5px;
|
|
13
|
+
color: $gray-600; // $gray-500;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Component, HostBinding, Input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'section-card',
|
|
5
|
+
templateUrl: './section-card.component.html'
|
|
6
|
+
})
|
|
7
|
+
export class SectionCardComponent {
|
|
8
|
+
@HostBinding('class.section-card') addSectionCard = true;
|
|
9
|
+
|
|
10
|
+
@Input() title: string;
|
|
11
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<thy-dialog-header thyTitle="a Detail from Portal"> </thy-dialog-header>
|
|
2
|
+
<thy-dialog-body>
|
|
3
|
+
<span class="resame-name">This is Micro Front-end application example.</span>
|
|
4
|
+
<div class="btn-pair mt-2">
|
|
5
|
+
<button thyButton="primary-square" (click)="ok()">Ok</button>
|
|
6
|
+
<button thyButton="link-secondary" (click)="close()">Cancel</button>
|
|
7
|
+
</div>
|
|
8
|
+
</thy-dialog-body>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { ThyDialogRef } from 'ngx-tethys/dialog';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-a-detail',
|
|
6
|
+
templateUrl: './a-detail.component.html'
|
|
7
|
+
})
|
|
8
|
+
export class ADetailComponent {
|
|
9
|
+
constructor(private dialogRef: ThyDialogRef<ADetailComponent>) {}
|
|
10
|
+
|
|
11
|
+
ok() {
|
|
12
|
+
this.dialogRef.close();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
close() {
|
|
16
|
+
this.dialogRef.close();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<section-card title="Planet">
|
|
2
|
+
<code>ngx-planet</code> is a powerful and easy micro front-end library only for angular.<br />
|
|
3
|
+
This is live demo for planet which contains portal, app1, app2.<br /><br />
|
|
4
|
+
<span class="text-danger">Github Repository </span>
|
|
5
|
+
<a target="_blank" href="https://github.com/worktile/ngx-planet">https://github.com/worktile/ngx-planet</a>
|
|
6
|
+
</section-card>
|
|
7
|
+
|
|
8
|
+
<section-card class="mt-5" title="AppRootContext data, it can be change in app1">
|
|
9
|
+
<span class="text-desc">appRootContext.name: </span> <span class="text-danger">{{ appRootContext.name }}</span>
|
|
10
|
+
</section-card>
|
|
11
|
+
|
|
12
|
+
<section-card class="mt-5" title="Links to app1 and app2 from portal">
|
|
13
|
+
<a [routerLink]="['/app1/dashboard']" routerLinkActive="active">To App1's Dashboard</a> <br />
|
|
14
|
+
<a href="javascript:;" (click)="toApp2Dashboard()">To App2's Dashboard</a>
|
|
15
|
+
</section-card>
|
|
16
|
+
|
|
17
|
+
<section-card class="mt-5" title="Open detail by dialog, it can be opened in app1">
|
|
18
|
+
<button thyButton="primary-square" (click)="openADetail()">Open A Detail</button>
|
|
19
|
+
</section-card>
|
|
20
|
+
|
|
21
|
+
<section-card class="mt-5 portal-special" title="Portal 特有的样式">
|
|
22
|
+
<span class="text-desc">portal 特有样式: </span> <span class="text-danger">font-size: 20px</span>
|
|
23
|
+
</section-card>
|
|
24
|
+
|
|
25
|
+
<section-card class="mt-5 same-name" title="同名样式">
|
|
26
|
+
<span class="text-desc">同名样式: </span> <span class="text-danger">color: blue, font-size:12px</span>
|
|
27
|
+
</section-card>
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { AboutComponent } from './about.component';
|
|
4
|
+
|
|
5
|
+
describe('AboutComponent', () => {
|
|
6
|
+
let component: AboutComponent;
|
|
7
|
+
let fixture: ComponentFixture<AboutComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(
|
|
10
|
+
waitForAsync(() => {
|
|
11
|
+
TestBed.configureTestingModule({
|
|
12
|
+
declarations: [AboutComponent]
|
|
13
|
+
}).compileComponents();
|
|
14
|
+
})
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
fixture = TestBed.createComponent(AboutComponent);
|
|
19
|
+
component = fixture.componentInstance;
|
|
20
|
+
fixture.detectChanges();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should create', () => {
|
|
24
|
+
expect(component).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Component, OnInit, HostBinding } from '@angular/core';
|
|
2
|
+
import { Router } from '@angular/router';
|
|
3
|
+
import { ThyDialog } from 'ngx-tethys/dialog';
|
|
4
|
+
import { ADetailComponent } from '../a-detail/a-detail.component';
|
|
5
|
+
import { AppRootContext } from '@demo/common';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'app-about',
|
|
9
|
+
templateUrl: './about.component.html',
|
|
10
|
+
styleUrls: ['./about.component.scss']
|
|
11
|
+
})
|
|
12
|
+
export class AboutComponent implements OnInit {
|
|
13
|
+
@HostBinding(`class.thy-layout-content`) isThyLayoutContent = true;
|
|
14
|
+
|
|
15
|
+
constructor(private router: Router, private thyDialog: ThyDialog, public appRootContext: AppRootContext) {}
|
|
16
|
+
|
|
17
|
+
ngOnInit() {}
|
|
18
|
+
|
|
19
|
+
toApp2Dashboard() {
|
|
20
|
+
this.router.navigateByUrl(`/app2/dashboard`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
openADetail() {
|
|
24
|
+
this.thyDialog.open(ADetailComponent);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { Routes, RouterModule } from '@angular/router';
|
|
3
|
+
import { AboutComponent } from './about/about.component';
|
|
4
|
+
import { SettingsComponent } from './settings/settings.component';
|
|
5
|
+
import { EmptyComponent } from 'ngx-planet';
|
|
6
|
+
|
|
7
|
+
const routes: Routes = [
|
|
8
|
+
{
|
|
9
|
+
path: '',
|
|
10
|
+
redirectTo: 'about',
|
|
11
|
+
pathMatch: 'full'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
path: 'about',
|
|
15
|
+
component: AboutComponent
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
path: 'settings',
|
|
19
|
+
component: SettingsComponent
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
path: 'app1',
|
|
23
|
+
component: EmptyComponent,
|
|
24
|
+
children: [
|
|
25
|
+
{
|
|
26
|
+
path: '**',
|
|
27
|
+
component: EmptyComponent
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
path: 'app2',
|
|
33
|
+
component: EmptyComponent,
|
|
34
|
+
children: [
|
|
35
|
+
{
|
|
36
|
+
path: '**',
|
|
37
|
+
component: EmptyComponent
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
path: 'app4',
|
|
43
|
+
component: EmptyComponent,
|
|
44
|
+
children: [
|
|
45
|
+
{
|
|
46
|
+
path: '**',
|
|
47
|
+
component: EmptyComponent
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
@NgModule({
|
|
54
|
+
imports: [RouterModule.forRoot(routes, { paramsInheritanceStrategy: 'always', relativeLinkResolution: 'legacy' })],
|
|
55
|
+
exports: [RouterModule]
|
|
56
|
+
})
|
|
57
|
+
export class AppRoutingModule {}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<thy-layout>
|
|
2
|
+
<div class="portal">
|
|
3
|
+
<thy-sidebar class="app-nav">
|
|
4
|
+
<img class="logo" src="/assets/images/logo.svg" />
|
|
5
|
+
<thy-nav [thyVertical]="'true'" class="mt-2" [thyType]="'primary'">
|
|
6
|
+
<a
|
|
7
|
+
thyNavLink
|
|
8
|
+
thyTooltip="App1"
|
|
9
|
+
[routerLink]="['/app1']"
|
|
10
|
+
routerLinkActive="active"
|
|
11
|
+
thyTooltip="App1"
|
|
12
|
+
thyTooltipPlacement="right"
|
|
13
|
+
>
|
|
14
|
+
<thy-icon thyIconName="application"></thy-icon>
|
|
15
|
+
</a>
|
|
16
|
+
<a thyNavLink [routerLink]="['/app2']" routerLinkActive="active" thyTooltip="App2" thyTooltipPlacement="right">
|
|
17
|
+
<thy-icon thyIconName="app-agile"></thy-icon>
|
|
18
|
+
</a>
|
|
19
|
+
<a
|
|
20
|
+
thyNavLink
|
|
21
|
+
[routerLink]="['/about']"
|
|
22
|
+
routerLinkActive="active"
|
|
23
|
+
thyTooltip="About"
|
|
24
|
+
thyTooltipPlacement="right"
|
|
25
|
+
>
|
|
26
|
+
<thy-icon thyIconName="smile"></thy-icon>
|
|
27
|
+
</a>
|
|
28
|
+
<a
|
|
29
|
+
thyNavLink
|
|
30
|
+
[routerLink]="['/settings']"
|
|
31
|
+
routerLinkActive="active"
|
|
32
|
+
thyTooltip="Settings"
|
|
33
|
+
thyTooltipPlacement="right"
|
|
34
|
+
><thy-icon thyIconName="settings"></thy-icon
|
|
35
|
+
></a>
|
|
36
|
+
<a
|
|
37
|
+
thyNavLink
|
|
38
|
+
href="javascript:;"
|
|
39
|
+
[thyPopover]="more"
|
|
40
|
+
thyPlacement="right"
|
|
41
|
+
thyTooltip="More"
|
|
42
|
+
thyTooltipPlacement="right"
|
|
43
|
+
>
|
|
44
|
+
<thy-icon thyIconName="more"></thy-icon>
|
|
45
|
+
</a>
|
|
46
|
+
|
|
47
|
+
<ng-template #more>
|
|
48
|
+
<thy-action-menu>
|
|
49
|
+
<a thyActionMenuItem routerLinkActive="active" [routerLink]="['/app1/dashboard']">
|
|
50
|
+
<span thyActionMenuItemIcon>
|
|
51
|
+
<thy-icon thyIconName="house"></thy-icon>
|
|
52
|
+
</span>
|
|
53
|
+
<span thyActionMenuItemName>To App1's dashboard</span>
|
|
54
|
+
</a>
|
|
55
|
+
<a thyActionMenuItem routerLinkActive="active" [routerLink]="['/app1/users']">
|
|
56
|
+
<span thyActionMenuItemIcon>
|
|
57
|
+
<thy-icon thyIconName="user-group"></thy-icon>
|
|
58
|
+
</span>
|
|
59
|
+
<span thyActionMenuItemName>To App1's users</span>
|
|
60
|
+
</a>
|
|
61
|
+
</thy-action-menu>
|
|
62
|
+
</ng-template>
|
|
63
|
+
</thy-nav>
|
|
64
|
+
</thy-sidebar>
|
|
65
|
+
</div>
|
|
66
|
+
<div id="app-host-container" class="thy-layout" [ngClass]="{ hide: !loadingDone }">
|
|
67
|
+
<div class="portal portal-container">
|
|
68
|
+
<router-outlet></router-outlet>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<thy-loading class="portal" *ngIf="!loadingDone" [thyDone]="loadingDone"></thy-loading>
|
|
73
|
+
</thy-layout>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
$app-nav-width: 70px;
|
|
2
|
+
$app-nav-bg-color: #48525c;
|
|
3
|
+
|
|
4
|
+
.portal-container {
|
|
5
|
+
display: contents;
|
|
6
|
+
height: 100%ß;
|
|
7
|
+
}
|
|
8
|
+
.app-nav {
|
|
9
|
+
width: $app-nav-width;
|
|
10
|
+
background: $app-nav-bg-color;
|
|
11
|
+
height: 100%;
|
|
12
|
+
|
|
13
|
+
.logo {
|
|
14
|
+
height: 50px;
|
|
15
|
+
margin-top: 15px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.thy-layout-sidebar {
|
|
19
|
+
border-right: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.nav-link {
|
|
23
|
+
opacity: 0.8;
|
|
24
|
+
min-width: $app-nav-width;
|
|
25
|
+
color: $white;
|
|
26
|
+
height: $app-nav-width;
|
|
27
|
+
text-align: center;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
.thy-icon {
|
|
31
|
+
color: $white;
|
|
32
|
+
font-size: $font-size-xlg;
|
|
33
|
+
}
|
|
34
|
+
&.active,
|
|
35
|
+
&:hover {
|
|
36
|
+
background: rgb(57, 65, 76);
|
|
37
|
+
color: $white;
|
|
38
|
+
.thy-icon {
|
|
39
|
+
color: $white;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// .thy-nav--vertical {
|
|
45
|
+
// .nav-link {
|
|
46
|
+
// border-left-width: 0px;
|
|
47
|
+
// }
|
|
48
|
+
// }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.same-name {
|
|
52
|
+
color: blue;
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.portal-special {
|
|
57
|
+
font-size: 20px;
|
|
58
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TestBed, waitForAsync } from '@angular/core/testing';
|
|
2
|
+
import { RouterTestingModule } from '@angular/router/testing';
|
|
3
|
+
import { AppComponent } from './app.component';
|
|
4
|
+
|
|
5
|
+
describe('AppComponent', () => {
|
|
6
|
+
beforeEach(
|
|
7
|
+
waitForAsync(() => {
|
|
8
|
+
TestBed.configureTestingModule({
|
|
9
|
+
imports: [RouterTestingModule],
|
|
10
|
+
declarations: [AppComponent]
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
})
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
it('should create the app', () => {
|
|
16
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
17
|
+
const app = fixture.debugElement.componentInstance;
|
|
18
|
+
expect(app).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it(`should have as title 'ngx-micro-frontend'`, () => {
|
|
22
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
23
|
+
const app = fixture.debugElement.componentInstance;
|
|
24
|
+
expect(app.title).toEqual('ngx-micro-frontend');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should render title in a h1 tag', () => {
|
|
28
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
29
|
+
fixture.detectChanges();
|
|
30
|
+
const compiled = fixture.debugElement.nativeElement;
|
|
31
|
+
expect(compiled.querySelector('h1').textContent).toContain('Welcome to ngx-micro-frontend!');
|
|
32
|
+
});
|
|
33
|
+
});
|