├── .editorconfig
├── .eslintrc
├── .gitignore
├── .prettierrc.js
├── CHANGELOG.md
├── LICENSE
├── README.md
├── build
├── assets.json
├── gulpfile.js
├── tasks
│ ├── task_app.js
│ ├── task_module.js
│ ├── task_module_aot.js
│ ├── task_module_rollup.js
│ └── task_vendor.js
├── util.js
└── webpack.common.js
├── docs
├── app
│ ├── app.css
│ ├── app.js
│ ├── common.css
│ └── common.js
├── index.html
├── modules
│ └── demo1
│ │ ├── app.css
│ │ └── app.js
└── static
│ ├── css
│ └── vendor.css
│ ├── fonts
│ ├── FontAwesome.otf
│ ├── fontawesome-webfont.eot
│ ├── fontawesome-webfont.svg
│ ├── fontawesome-webfont.ttf
│ ├── fontawesome-webfont.woff
│ ├── fontawesome-webfont.woff2
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.svg
│ ├── glyphicons-halflings-regular.ttf
│ ├── glyphicons-halflings-regular.woff
│ └── glyphicons-halflings-regular.woff2
│ ├── img
│ ├── avatar.png
│ ├── avatar04.png
│ ├── avatar2.png
│ ├── avatar3.png
│ ├── avatar5.png
│ ├── boxed-bg.jpg
│ ├── boxed-bg.png
│ ├── credit
│ │ ├── american-express.png
│ │ ├── cirrus.png
│ │ ├── mastercard.png
│ │ ├── mestro.png
│ │ ├── paypal.png
│ │ ├── paypal2.png
│ │ └── visa.png
│ ├── default-50x50.gif
│ ├── icons.png
│ ├── photo1.png
│ ├── photo2.png
│ ├── photo3.jpg
│ ├── photo4.jpg
│ ├── user1-128x128.jpg
│ ├── user2-160x160.jpg
│ ├── user3-128x128.jpg
│ ├── user4-128x128.jpg
│ ├── user5-128x128.jpg
│ ├── user6-128x128.jpg
│ ├── user7-128x128.jpg
│ └── user8-128x128.jpg
│ └── js
│ └── vendor.js
├── index.html
├── modules
└── demo1
│ ├── app-aot.ts
│ ├── app.module.ts
│ ├── app.routing.ts
│ ├── app.ts
│ ├── index-aot.ts
│ ├── index.ts
│ ├── pages
│ ├── index.ts
│ ├── page1
│ │ ├── page1.component.html
│ │ └── page1.component.ts
│ └── page2
│ │ ├── page2.component.html
│ │ └── page2.component.ts
│ └── styl
│ └── all.styl
├── package-lock.json
├── package.json
├── src
├── app.module.ts
├── app.routing.ts
├── app.ts
├── common_module
│ ├── app.ts
│ ├── common.module.ts
│ ├── components
│ │ └── index.ts
│ ├── index.ts
│ ├── pipes
│ │ └── index.ts
│ ├── services
│ │ ├── index.ts
│ │ └── module-loader.service.ts
│ ├── styl
│ │ └── all.styl
│ └── tsconfig.json
├── components
│ ├── index.ts
│ ├── menu
│ │ ├── menu.component.html
│ │ ├── menu.component.styl
│ │ └── menu.component.ts
│ └── tabset
│ │ ├── tab-item.component.html
│ │ ├── tab-item.component.ts
│ │ ├── tabset.component.html
│ │ ├── tabset.component.styl
│ │ └── tabset.component.ts
├── config
│ ├── config.dev.ts
│ └── config.prod.ts
├── index.ts
├── pages
│ ├── 404
│ │ └── notfound.component.ts
│ ├── app
│ │ ├── app.component.html
│ │ └── app.component.ts
│ ├── home
│ │ ├── home.component.html
│ │ └── home.component.ts
│ ├── index.ts
│ ├── layout
│ │ ├── layout.component.html
│ │ └── layout.component.ts
│ ├── login
│ │ ├── login.component.html
│ │ └── login.component.ts
│ └── logout
│ │ ├── logout.component.html
│ │ └── logout.component.ts
├── pipes
│ └── index.ts
├── services
│ ├── auth-guard.ts
│ ├── index.ts
│ └── menu.service.ts
└── styl
│ ├── all.styl
│ ├── layout.styl
│ └── vendor-reset.styl
├── tsconfig-aot.json
├── tsconfig.json
├── tslint.json
└── types
└── typing.d.ts
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | end_of_line = 1f
5 | insert_final_newline = true
6 |
7 | indent_style = space
8 | indent_size = 2
9 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "parserOptions": {
3 | "ecmaVersion": 2017,
4 | "sourceType": "module"
5 | },
6 | "env": {
7 | "node": true,
8 | "browser": true
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | dist/
3 | .vscode/
4 | aot/
5 | npm-debug.log
6 | aot-dist/
7 |
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | parser: "babylon",
3 | printWidth: 120,
4 | semi: true,
5 | singleQuote: true
6 | };
7 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | ## 0.3.0 (2018-xx-xx,未发布)
6 |
7 | - 升级 `Angular` 到 `6.x`
8 | - 升级开发依赖库
9 | - 升级 `webpack` 到 `4.x`
10 |
11 | ## v_0.2.0 (2018-07-07)
12 |
13 | - 实现多 Tab 页动态加载
14 | - Tab 页增加名称属性,同名 Tab 只允许打开一个
15 |
16 | ## v_0.1.0 (2017-11-21)
17 |
18 | - 升级 `Angular` 到 `5.x beta` 版本
19 | - 引入 Google 分析
20 | - 基于 NProgress 实现页面加载进度条
21 | - 增加面包屑区域
22 | - 优化菜单路由关联
23 | - 优化构建,忽略不必要的目录监控
24 | - AOT 优化,更高效的执行模式
25 | - `ts-lint` 检测完全通过
26 |
27 | ## v_0.0.3 (2017.01.06)
28 |
29 | - 增加 `build` 命令:`npm run build`,用于生成线上包到 `dist` 目录中
30 | - 增加全局 `config` 配置
31 | - 增加环境变量 `env`,可以通过 `process.env.NODE_ENV === 'production'` 来判断是否是产线环境
32 | - 修复 “代码变更之后无法自动刷新”
33 | - 优化构建,提高性能和修复 bug
34 |
35 | ## v0.0.2 (2017.01.05)
36 |
37 | - 增加对三大预处理器的支持
38 | - 提取每个模块的 CSS 到单一文件
39 | - 实现对模块样式的动态载入以及切换
40 | - 通过自定义加载方式,实现模块间的相互依赖
41 |
42 | ## v0.0.1 (2016.12.13)
43 |
44 | - 实现动态加载模块基本功能
45 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Jay.M.Hu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # angular-modular-platform
2 | A development platform based Angular2, easy for multiple teams development.
3 |
4 | 基于 `Angular` 的模块化开发平台。
5 |
6 | # Usage
7 |
8 | ```bash
9 | # 初始化依赖
10 | npm i
11 | # 生成type define文件(如果要运行框架代码,请务必执行该命令,否则ts-loader会有一堆错误)
12 | npm run types
13 |
14 | # 运行(执行编译并监控,非AOT模式)
15 | npm run dev
16 |
17 | # 模块相关命令
18 | npm run modules # JIT编译模块
19 | npm run modules:ngc # angular-compiler-cli 编译模块
20 | npm run modules:aot # AOT编译模块(会先执行 modules:ngc)
21 |
22 | # 生成Demo发布包
23 | npm run build
24 | ```
25 |
26 | **注:框架默认只安装了 `css-loader`,但提供了 `sass less stylus` 的支持,如果需要使用以上几种预处理器,请务必安装相关插件**
27 |
28 | ```bash
29 | # sass
30 | npm i --save-dev node-sass sass-loader
31 |
32 | # less
33 | npm i --save-dev less less-loader
34 |
35 | # stylus
36 | npm i --save-dev stylus stylus-loader
37 | ```
38 |
39 | # 目录结构
40 |
41 | ```
42 | build/ -- 构建代码目录
43 | modules/ -- 模块放置目录
44 | demo1/ -- 模块1
45 | demo2/ -- 模块2
46 | src/ -- 源代码目录
47 | app/ -- 页面目录
48 | common_module/ -- 公共模块目录
49 | filters/ -- 公共过滤器
50 | services/ -- 公共服务
51 | common.module.ts -- 公共模块定义
52 | index.ts -- 导出公共模块
53 | app.module.ts -- 根模块
54 | app.routing.ts -- 顶级路由配置
55 | bootstrap.ts -- 程序入口
56 | ```
57 |
58 | # 核心思想
59 |
60 | ### 需求
61 |
62 | 1. 首先,需要维护一个独立的平台,支持多个团队通过可视化操作提交开发的模块到平台中,通过配置菜单即可访问到。
63 | 2. 基于 `Angular` 搭建
64 | 3. 支持模块的动态加载
65 | 4. 需要提供公共服务/组件等
66 | 5. 其他更细致的业务相关需求,不再罗列
67 |
68 | ### 如何实现?
69 |
70 | 1. 提供一个部署好的站点
71 | 2. 提供一个可供开发团队使用的开发包(包含构建,公共功能)
72 | 3. 提供模块打包等一系列辅助功能(通过cli)
73 |
74 | ### 遇到的问题
75 |
76 | 1. 如何高效的打包模块?
77 |
78 | 使用 `webpack` 的外部依赖功能,将所有依赖的平台插件,先行构建好,然后模块只打包它本身独立的功能。
79 |
80 | 2. 如何实现AOT?
81 |
82 | 模块本身是可以直接AOT的,通过搭配 `angular-compiler-cli` 和 `webpack` 实现模块的cli加载。
83 |
84 | 3. 其他问题~
85 |
86 | 待挖掘
87 |
88 | ### 注意事项
89 |
90 | 1. 进行模块开发, 如果有框架依赖,一定要引用完整依赖,如 `import { xxx } from 'rxjs'`
91 | 2. 要使用公共模块,请务必使用 `import { xxx } from 'app/common'`
92 |
93 | # Change log
94 |
95 | [查看变更日志](CHANGELOG.md)
96 |
97 | # License
98 |
99 | [MIT License](LICENSE)
100 |
--------------------------------------------------------------------------------
/build/assets.json:
--------------------------------------------------------------------------------
1 | {
2 | "vendor.js": [
3 | "./node_modules/zone.js/dist/zone.js",
4 | "./node_modules/rxjs/bundles/rxjs.umd.js",
5 | "./node_modules/reflect-metadata/Reflect.js",
6 | "./node_modules/jquery/dist/jquery.js",
7 | "./node_modules/nprogress/nprogress.js",
8 | "./node_modules/bootstrap/dist/js/bootstrap.js",
9 | "./node_modules/admin-lte/dist/js/adminlte.js",
10 | "./node_modules/@angular/core/bundles/core.umd.js",
11 | "./node_modules/@angular/compiler/bundles/compiler.umd.js",
12 | "./node_modules/@angular/common/bundles/common.umd.js",
13 | "./node_modules/@angular/platform-browser/bundles/platform-browser.umd.js",
14 | "./node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js",
15 | "./node_modules/@angular/router/bundles/router.umd.js",
16 | "./node_modules/@angular/forms/bundles/forms.umd.js",
17 | "./node_modules/@angular/http/bundles/http.umd.js",
18 | "./node_modules/@angular/animations/bundles/animations.umd.js"
19 | ],
20 | "vendor.js.min": [
21 | "./node_modules/zone.js/dist/zone.min.js",
22 | "./node_modules/rxjs/bundles/rxjs.umd.min.js",
23 | "./node_modules/reflect-metadata/Reflect.js",
24 | "./node_modules/jquery/dist/jquery.min.js",
25 | "./node_modules/nprogress/nprogress.js",
26 | "./node_modules/bootstrap/dist/js/bootstrap.min.js",
27 | "./node_modules/admin-lte/dist/js/adminlte.min.js",
28 | "./node_modules/@angular/core/bundles/core.umd.min.js",
29 | "./node_modules/@angular/compiler/bundles/compiler.umd.min.js",
30 | "./node_modules/@angular/common/bundles/common.umd.min.js",
31 | "./node_modules/@angular/platform-browser/bundles/platform-browser.umd.min.js",
32 | "./node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.min.js",
33 | "./node_modules/@angular/router/bundles/router.umd.min.js",
34 | "./node_modules/@angular/forms/bundles/forms.umd.min.js",
35 | "./node_modules/@angular/http/bundles/http.umd.min.js",
36 | "./node_modules/@angular/animations/bundles/animations.umd.min.js"
37 | ],
38 | "vendor.css": [
39 | "./node_modules/font-awesome/css/font-awesome.css",
40 | "./node_modules/bootstrap/dist/css/bootstrap.css",
41 | "./node_modules/nprogress/nprogress.css",
42 | "./node_modules/admin-lte/dist/css/AdminLTE.css",
43 | "./node_modules/admin-lte/dist/css/skins/_all-skins.css"
44 | ],
45 | "vendor.css.min": [
46 | "./node_modules/font-awesome/css/font-awesome.min.css",
47 | "./node_modules/bootstrap/dist/css/bootstrap.min.css",
48 | "./node_modules/nprogress/nprogress.css",
49 | "./node_modules/admin-lte/dist/css/AdminLTE.min.css",
50 | "./node_modules/admin-lte/dist/css/skins/_all-skins.min.css"
51 | ],
52 | "vendor.static": [
53 | "./node_modules/font-awesome/fonts*/*.*",
54 | "./node_modules/bootstrap/dist/fonts*/*.*",
55 | "./node_modules/admin-lte/dist/img*/**/*"
56 | ]
57 | }
58 |
--------------------------------------------------------------------------------
/build/gulpfile.js:
--------------------------------------------------------------------------------
1 | require('shelljs/global');
2 | const gulp = require('gulp');
3 | const concat = require('gulp-concat');
4 | const browserSync = require('browser-sync');
5 | const historyApiFallback = require('connect-history-api-fallback');
6 | const notifier = require('node-notifier');
7 |
8 | const isRelease = process.argv.indexOf('-r') >= 0;
9 | const params = {
10 | isRelease
11 | };
12 |
13 | [
14 | 'task_vendor',
15 | 'task_app',
16 | 'task_module',
17 | 'task_module_aot',
18 | 'task_module_rollup'
19 | ].forEach(f => {
20 | require(`./tasks/${f}`)(gulp, params);
21 | });
22 |
23 | gulp.task('clean', done => {
24 | rm('-rf', 'dist');
25 | done();
26 | });
27 |
28 | gulp.task('serve', done => {
29 | browserSync.init({
30 | server: {
31 | baseDir: 'dist/'
32 | },
33 | middleware: [historyApiFallback()],
34 | ghostMode: false,
35 | port: 10000
36 | });
37 | done();
38 | });
39 |
40 | gulp.task('bs-reload', done => {
41 | notifier.notify({ title: 'Newkit', message: 'Build successfully.' });
42 | browserSync.reload();
43 | done();
44 | });
45 |
46 | gulp.task('build', gulp.parallel('vendor', 'app', 'modules'));
47 |
48 | gulp.task(
49 | 'release',
50 | gulp.series('clean', gulp.parallel('vendor', 'app', 'modules-aot'))
51 | );
52 |
53 | gulp.task('default', gulp.series('clean', 'build', 'serve'));
54 |
--------------------------------------------------------------------------------
/build/tasks/task_app.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const webpack = require('webpack');
3 | const webpackMerge = require('webpack-merge');
4 | const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5 |
6 | const commonConfig = require('./../webpack.common');
7 | const util = require('./../util');
8 |
9 | module.exports = (gulp, params) => {
10 | gulp.task('build:types', done => {
11 | cd('./src/common_module');
12 | exec('tsc');
13 | cd('../../'); // 退回到根目录
14 | fs.writeFileSync('./node_modules/@types/app/index.d.ts', 'export {};', 'utf8');
15 | done();
16 | });
17 |
18 | gulp.task('app:html', () => {
19 | return gulp.src('index.html').pipe(gulp.dest('dist/'));
20 | });
21 |
22 | gulp.task('app:watch', done => {
23 | gulp.watch('index.html', gulp.series('app:html', 'bs-reload'));
24 | done();
25 | });
26 |
27 | gulp.task('app:js', done => {
28 | let opt = webpackMerge(commonConfig, {
29 | entry: {
30 | app: './src/index.ts',
31 | common: './src/common_module/index.ts'
32 | },
33 | output: {
34 | path: util.root('dist'),
35 | filename: 'app/[name].js',
36 | library: ['ampApp', '[name]'],
37 | chunkFilename: '[id].js'
38 | },
39 | plugins: [
40 | new webpack.DefinePlugin({
41 | 'process.env': {
42 | NODE_ENV: params.isRelease ? '"production"' : '"development"'
43 | }
44 | }),
45 | new MiniCssExtractPlugin({
46 | filename: 'app/[name].css'
47 | })
48 | ]
49 | });
50 | if (params.isRelease) {
51 | opt.mode = 'production';
52 | }
53 | const compiler = webpack(opt);
54 | if (params.isRelease) {
55 | compiler.run((err, stats) => {
56 | util.showWebpackError(err, stats);
57 | gulp.series('bs-reload')();
58 | done();
59 | });
60 | } else {
61 | compiler.watch({ aggregateTimeout: 500, poll: false, ignored: [/modules/, /dist/] }, (err, stats) => {
62 | util.showWebpackError(err, stats);
63 | gulp.series('bs-reload')();
64 | done();
65 | });
66 | }
67 | });
68 | const tasks = ['app:html', 'app:js'];
69 | if (!params.isRelease) {
70 | tasks.push('app:watch');
71 | }
72 | gulp.task('app', gulp.parallel(...tasks));
73 | };
74 |
--------------------------------------------------------------------------------
/build/tasks/task_module.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const path = require('path');
3 | const webpack = require('webpack');
4 | const webpackMerge = require('webpack-merge');
5 | const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6 |
7 | const commonConfig = require('./../webpack.common');
8 | const util = require('./../util');
9 |
10 | module.exports = (gulp, params) => {
11 | let modules = {};
12 | let moduleFolder = path.join(__dirname, './../../', 'modules');
13 | fs.readdirSync(moduleFolder).forEach(name => {
14 | let modulePath = path.join(moduleFolder, name);
15 | // 不是目录就忽略
16 | if (!fs.statSync(modulePath).isDirectory()) {
17 | return;
18 | }
19 | modules[name] = `./modules/${name}/index.ts`;
20 | });
21 |
22 | gulp.task('modules:js', done => {
23 | let opt = webpackMerge(commonConfig, {
24 | entry: modules,
25 | output: {
26 | path: util.root('dist'),
27 | filename: 'modules/[name]/app.js',
28 | library: ['ampApp', '[name]'],
29 | chunkFilename: '[id].js'
30 | },
31 | plugins: [
32 | new webpack.DefinePlugin({
33 | 'process.env': {
34 | NODE_ENV: params.isRelease ? '"production"' : '"development"'
35 | }
36 | }),
37 | new MiniCssExtractPlugin({
38 | filename: 'modules/[name]/app.css'
39 | })
40 | ]
41 | });
42 | if (params.isRelease) {
43 | opt.mode = 'production';
44 | }
45 | const compiler = webpack(opt);
46 | if (params.isRelease) {
47 | compiler.run((err, stats) => {
48 | util.showWebpackError(err, stats);
49 | done();
50 | });
51 | } else {
52 | compiler.watch(
53 | {
54 | aggregateTimeout: 500,
55 | poll: false,
56 | ignored: [/src/, /dist/, /node_modules/]
57 | },
58 | (err, stats) => {
59 | util.showWebpackError(err, stats);
60 | gulp.series('bs-reload')();
61 | done();
62 | }
63 | );
64 | }
65 | });
66 |
67 | gulp.task('modules', gulp.parallel('modules:js'));
68 | };
69 |
--------------------------------------------------------------------------------
/build/tasks/task_module_aot.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const path = require('path');
3 | const webpack = require('webpack');
4 | const webpackMerge = require('webpack-merge');
5 | const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6 |
7 | const commonConfig = require('./../webpack.common');
8 | const util = require('./../util');
9 |
10 | module.exports = (gulp, params) => {
11 | let modules = {};
12 | let moduleFolder = path.join(__dirname, './../../', 'modules');
13 | fs.readdirSync(moduleFolder).forEach(name => {
14 | let modulePath = path.join(moduleFolder, name);
15 | // 不是目录就忽略
16 | if (!fs.statSync(modulePath).isDirectory()) {
17 | return;
18 | }
19 | modules[name] = `./modules/${name}/index-aot.ts`;
20 | });
21 |
22 | gulp.task('modules:aot-js', done => {
23 | let opt = webpackMerge(commonConfig, {
24 | entry: modules,
25 | output: {
26 | path: util.root('dist'),
27 | filename: 'modules/[name]/app.js',
28 | library: ['ampApp', '[name]'],
29 | chunkFilename: '[id].js'
30 | },
31 | plugins: [
32 | new webpack.DefinePlugin({
33 | 'process.env': {
34 | NODE_ENV: params.isRelease ? '"production"' : '"development"'
35 | }
36 | }),
37 | new MiniCssExtractPlugin({ filename: 'modules/[name]/app.css' })
38 | ]
39 | });
40 | if (params.isRelease) {
41 | opt.mode = 'production';
42 | }
43 | const compiler = webpack(opt);
44 | if (params.isRelease) {
45 | compiler.run((err, stats) => {
46 | util.showWebpackError(err, stats);
47 | gulp.series('bs-reload')();
48 | done();
49 | });
50 | } else {
51 | compiler.watch(
52 | { aggregateTimeout: 500, poll: false, ignored: [/aot-dist/, /src/, /dist/, /node_modules/] },
53 | (err, stats) => {
54 | util.showWebpackError(err, stats);
55 | gulp.series('bs-reload')();
56 | done();
57 | }
58 | );
59 | }
60 | });
61 |
62 | gulp.task('modules-aot', gulp.parallel('modules:aot-js'));
63 | };
64 |
--------------------------------------------------------------------------------
/build/tasks/task_module_rollup.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const fs = require('fs');
3 | const rollup = require('rollup');
4 | const resolve = require('rollup-plugin-node-resolve');
5 | const commonjs = require('rollup-plugin-commonjs');
6 | const sourcemaps = require('rollup-plugin-sourcemaps');
7 | const uglify = require('rollup-plugin-uglify');
8 | const buildOptimizer = require('rollup-plugin-angular-optimizer').default;
9 |
10 | const globals = {
11 | '@angular/animations': 'ng.animations',
12 | '@angular/core': 'ng.core',
13 | '@angular/common': 'ng.common',
14 | '@angular/compiler': 'ng.compiler',
15 | '@angular/forms': 'ng.forms',
16 | '@angular/platform-browser': 'ng.platformBrowser',
17 | '@angular/platform-browser/animations': 'ng.platformBrowser.animations',
18 | 'rxjs': 'Rx',
19 | 'rxjs/Observable': 'Rx',
20 | 'rxjs/Subject': 'Rx',
21 | 'rxjs/observable/fromPromise': 'Rx.Observable',
22 | 'rxjs/observable/forkJoin': 'Rx.Observable',
23 | 'rxjs/operator/map': 'Rx.Observable.prototype',
24 | 'app/common': 'app.common'
25 | };
26 |
27 | const getModules = () => {
28 | let modulesFolder = path.join(__dirname, '../../modules');
29 | return fs.readdirSync(modulesFolder).filter(name => {
30 | let modulePath = path.join(modulesFolder, name);
31 | return fs.statSync(modulePath).isDirectory();
32 | });
33 | }
34 |
35 | module.exports = (gulp, params) => {
36 | gulp.task('modules-rollup', done => {
37 | let modules = getModules();
38 | modules.forEach(async (moduleName) => {
39 | try {
40 | const bundle = await rollup.rollup({
41 | input: `modules/${moduleName}/app-aot.ts`,
42 | plugins: [resolve(), commonjs(), sourcemaps(), buildOptimizer(), /*uglify()*/],
43 | external: Object.keys(globals)
44 | });
45 | await bundle.write({
46 | file: `dist/modules/${moduleName}/app.js`,
47 | format: 'umd',
48 | globals,
49 | name: `app.${moduleName}`,
50 | amd: { id: `app.${moduleName}` }
51 | });
52 | } catch (e) {
53 | console.log(moduleName, ':', e);
54 | }
55 | });
56 | done();
57 | });
58 | }
--------------------------------------------------------------------------------
/build/tasks/task_vendor.js:
--------------------------------------------------------------------------------
1 | const concat = require('gulp-concat');
2 | const assets = require('./../assets.json');
3 |
4 | module.exports = (gulp, params) => {
5 | gulp.task('vendor:js', () => {
6 | return gulp.src(assets[params.isRelease ? 'vendor.js.min' : 'vendor.js'])
7 | .pipe(concat('vendor.js', { newLine: ';\n' }))
8 | .pipe(gulp.dest('./dist/static/js'));
9 | });
10 |
11 | gulp.task('vendor:css', () => {
12 | return gulp.src(assets[params.isRelease ? 'vendor.css.min' : 'vendor.css'])
13 | .pipe(concat('vendor.css', { newLine: '\n\n' }))
14 | .pipe(gulp.dest('./dist/static/css'));
15 | });
16 |
17 | gulp.task('vendor:static', () => {
18 | return gulp.src(assets['vendor.static'])
19 | .pipe(gulp.dest('./dist/static'));
20 | });
21 |
22 | gulp.task('vendor', gulp.parallel('vendor:js', 'vendor:css', 'vendor:static'));
23 | };
24 |
--------------------------------------------------------------------------------
/build/util.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const gutil = require('gulp-util');
3 |
4 | const showWebpackError = (err, stats) => {
5 | if (err) {
6 | throw new gutil.PluginError('webpack', err);
7 | }
8 | let statColor = stats.compilation.warnings.length < 1 ? 'green' : 'yellow';
9 | if (stats.compilation.warnings.length > 0) {
10 | stats.compilation.errors.forEach(error => {
11 | statColor = 'red';
12 | });
13 | } else {
14 | gutil.log(stats.toString({
15 | colors: gutil.colors.supportsColor,
16 | hash: false,
17 | timings: true,
18 | chunks: true,
19 | chunkModules: false,
20 | modules: false,
21 | children: false,
22 | version: true,
23 | cached: true,
24 | cachedAssets: true,
25 | reasons: false,
26 | source: false,
27 | errorDetails: false
28 | }));
29 | }
30 | };
31 |
32 | const root = folder => {
33 | return path.join(__dirname, '../', folder);
34 | };
35 |
36 | module.exports = {
37 | showWebpackError,
38 | root
39 | };
--------------------------------------------------------------------------------
/build/webpack.common.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const webpack = require('webpack');
3 | const { CheckerPlugin } = require('awesome-typescript-loader');
4 | const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5 |
6 | function genarateCssLoader(test, lang, options) {
7 | return {
8 | test,
9 | use: [{ loader: MiniCssExtractPlugin.loader }, 'css-loader', { loader: `${lang}-loader`, options: options || {} }]
10 | };
11 | }
12 |
13 | module.exports = {
14 | devtool: 'cheap-source-map',
15 | target: 'web',
16 | mode: 'development',
17 | stats: 'errors-only',
18 | cache: true, // Default in watch mode
19 | resolve: {
20 | extensions: ['.ts', '.js'],
21 | alias: {}
22 | },
23 | watchOptions: {
24 | ignored: /node_modules/
25 | },
26 | externals: [
27 | {
28 | rxjs: 'rxjs',
29 | '@angular/common': 'ng.common',
30 | '@angular/compiler': 'ng.compiler',
31 | '@angular/core': 'ng.core',
32 | '@angular/http': 'ng.http',
33 | '@angular/platform-browser': 'ng.platformBrowser',
34 | '@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic',
35 | '@angular/router': 'ng.router',
36 | '@angular/forms': 'ng.forms',
37 | 'app/common': 'ampApp.common',
38 | '@angular/animations': 'ng.animations'
39 | },
40 | (context, request, callback) => {
41 | if (request.indexOf('app/') === 0) {
42 | let key = request.split('/')[1];
43 | return callback(null, `var ampApp['${key}']`);
44 | }
45 | callback();
46 | }
47 | ],
48 | module: {
49 | rules: [
50 | {
51 | test: /\.ts$/,
52 | use: ['awesome-typescript-loader', 'angular2-template-loader'],
53 | exclude: /node_modules/
54 | },
55 | { test: /\.html$/, use: 'raw-loader' },
56 | {
57 | test: /\.css$/,
58 | use: [{ loader: MiniCssExtractPlugin.loader }, 'css-loader']
59 | },
60 | genarateCssLoader(/\.styl$/, 'stylus'),
61 | genarateCssLoader(/\.less$/, 'less'),
62 | genarateCssLoader(/\.scss$/, 'sass'),
63 | genarateCssLoader(/\.sass$/, 'sass', { indentedSyntax: true })
64 | ]
65 | },
66 | plugins: [new CheckerPlugin()]
67 | };
68 |
--------------------------------------------------------------------------------
/docs/app/app.css:
--------------------------------------------------------------------------------
1 | #nprogress .bar {
2 | background: #d54d36;
3 | }
4 | .content-wrapper {
5 | height: 100vh;
6 | }
7 | .content-wrapper .content-header {
8 | height: 40px;
9 | padding: 0;
10 | box-shadow: 0px 0px 1px #222d32;
11 | }
12 | .content-wrapper .content-header .breadcrumb {
13 | top: 3px;
14 | right: auto;
15 | font-size: 14px;
16 | }
17 | .navbar-nav > .user-menu > .dropdown-menu.praise-ul {
18 | width: 400px;
19 | }
20 | .praise {
21 | font-size: 0;
22 | }
23 | .praise img {
24 | width: 48%;
25 | }
26 | .praise img:nth-child(1) {
27 | margin-right: 4%;
28 | }
29 | .navbar-nav > .user-menu > .dropdown-menu > li.user-header {
30 | height: auto;
31 | }
32 |
33 | .j-menu:.sidebar-menu .ul-active .treeview-menu {
34 | display: block;
35 | }
36 | .j-menu .treeview.open > a {
37 | color: #fff;
38 | }
39 |
40 | .j-tabset .nav.nav-tabs li {
41 | min-width: 80px;
42 | text-align: center;
43 | }
44 | .j-tabset .nav.nav-tabs .tab-close {
45 | position: absolute;
46 | right: 2px;
47 | top: 2px;
48 | cursor: pointer;
49 | border-radius: 50%;
50 | }
51 | .j-tabset .nav.nav-tabs .tab-close:hover {
52 | color: #c9302c;
53 | }
54 |
55 |
56 | /*# sourceMappingURL=app.css.map*/
--------------------------------------------------------------------------------
/docs/app/app.js:
--------------------------------------------------------------------------------
1 | var ampApp="object"==typeof ampApp?ampApp:{};ampApp.app=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=9)}([function(e,t){e.exports=ng.core},function(e,t){e.exports=ng.router},function(e,t){e.exports=ampApp.common},,function(e,t){e.exports=ng.common},,function(e,t){e.exports=ng.platformBrowser},function(e,t){e.exports=ng.platformBrowserDynamic},,function(e,t,n){"use strict";n.r(t);var r=n(7),o=(n(27),n(2)),a=n(0),i=n(6),c=n(1),s=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i},l=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},p=function(){function e(){}return e.prototype.ngOnInit=function(){},e.prototype.ngOnDestroy=function(){},e=s([Object(a.Component)({selector:"angular-app",template:n(24)}),l("design:paramtypes",[])],e)}(),f=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i},u=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},d=function(){function e(){}return e.prototype.ngOnInit=function(){},e=f([Object(a.Component)({template:n(23)}),u("design:paramtypes",[])],e)}(),m=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i},h=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},g=function(){function e(){}return e.prototype.ngOnInit=function(){},e=m([Object(a.Component)({template:"
404 Not Found.
"}),h("design:paramtypes",[])],e)}(),b=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i},v=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},y=function(){function e(){}return e.prototype.ngOnInit=function(){},e=b([Object(a.Component)({template:n(22)}),v("design:paramtypes",[])],e)}(),j=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i},O=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},R=function(){function e(){}return e.prototype.ngOnInit=function(){},e=j([Object(a.Component)({template:n(21)}),O("design:paramtypes",[])],e)}(),C=n(4),x=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i},w=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},I=function(){function e(e,t){var n=this;this.router=e,this.moduleLoader=t,this.router.events.subscribe(function(e){var t=window.NProgress;if(e instanceof c.NavigationStart)t.start();else if(e instanceof c.NavigationEnd||e instanceof c.NavigationError){var r=window.ga;r&&r("send","pageview",n.router.url),t.done()}})}return e.prototype.canActivate=function(e,t,n){void 0===n&&(n=!1);var r=t.url.split("/")[1];return n||this.moduleLoader.useModuleStyles(r),Promise.resolve(!0)},e.prototype.canActivateChild=function(e,t){return this.canActivate(e,t,!0)},e=x([Object(a.Injectable)(),w("design:paramtypes",[c.Router,o.ModuleLoaderService])],e)}(),M=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i},P=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},A=function(){function e(){this.menuData=[{text:"Control Panel",icon:"fa fa-cogs",children:[{text:"Level 2 Menu",icon:"fa fa-home",children:[{text:"Level 3 Menu",icon:"fa fa-star",url:"/"}]},{text:"Not Found",icon:"fa fa-close",url:"/404"}]},{text:"Demo Module",icon:"fa fa-list",children:[{text:"Demo Page1",icon:"fa fa-home",url:"/demo1"},{text:"Demo Page2",icon:"fa fa-lock",url:"/demo1/page2"}]}]}return e.prototype.getMenuData=function(){return Promise.resolve(this.menuData)},e=M([Object(a.Injectable)(),P("design:paramtypes",[])],e)}(),$=[I,A],D=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i},S=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},_=function(){function e(e,t,n,r){this.location=e,this.router=t,this.route=n,this.menuService=r,this.menuData=[],this.pageList=[{header:"Home",comp:d,name:"page1"}],this.selectedPage="page1"}return e.prototype.ngOnInit=function(){var e=this;this.watchRouterChange(),this.menuService.getMenuData().then(function(t){e.menuData=t})},e.prototype.watchRouterChange=function(){var e=this;this.router.events.subscribe(function(t){if(t instanceof c.NavigationEnd){var n,r=void 0;try{var o=e.route.children[0].children[0];n=e.location.path(),r=o.component}catch(e){n="$$notfound",r=g}var a=e.pageList.length+1;e.pageList.find(function(e){return e.name===n})||e.pageList.push({header:"页面"+a,comp:r,name:n,closable:!0}),setTimeout(function(){e.selectedPage=n})}})},e=D([Object(a.Component)({template:n(20)}),S("design:paramtypes",[C.Location,c.Router,c.ActivatedRoute,A])],e)}(),L=[p,d,g,y,R,_],N=[];[{path:"demo1",module:"demo1"}].forEach(function(e){N.push({path:e.path,loadChildren:function(e){return function(){return o.ModuleLoaderService.load(e)}}(e.module),canActivate:[I],canActivateChild:[I]})});var E=[{path:"login",component:y},{path:"logout",component:R},{path:"",component:_,canActivate:[I],canActivateChild:[I],children:[{path:"",component:d}].concat(N,[{path:"**",component:g}])}],T=c.RouterModule.forRoot(E,{useHash:!0}),k=(n(19),function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}),F=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},U=function(){function e(e){var t=this;this.router=e,this.router.events.subscribe(function(e){e instanceof c.NavigationEnd&&t.setMenuStatus(e.url)})}return Object.defineProperty(e.prototype,"menuData",{set:function(e){this.processMenuData(e),this.menus=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.onMenuClick=function(e,t){e.stopPropagation(),t.$hasChildren?t.$open=!t.$open:this.router.navigate([t.url])},e.prototype.findMenuByUrl=function(e,t){for(var n=0,r=t;n0&&(e.$hasChildren=!0,n.processMenuData(e.children,e))})},e.prototype.setAllMenuInActive=function(e){var t=this;e.forEach(function(e){e.$active=!1,e.$open=!1,e.$hasChildren&&t.setAllMenuInActive(e.children)})},e.prototype.setMenuFamilyActive=function(e){e.$open=!0,e.$parent&&this.setMenuFamilyActive(e.$parent)},e.prototype.setMenuStatus=function(e){var t=this;setTimeout(function(){t.setAllMenuInActive(t.menus);var n=t.findMenuByUrl(e,t.menus);n&&(n.$active=!0,t.setMenuFamilyActive(n))})},k([Object(a.Input)(),F("design:type",Object),F("design:paramtypes",[Object])],e.prototype,"menuData",null),e=k([Object(a.Component)({selector:"j-menu",template:n(17)}),F("design:paramtypes",[c.Router])],e)}(),B=(n(16),function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}),H=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},V=function(){function e(){this.tabItems=[],this.data=[],this.dataChange=new a.EventEmitter,this.tabsLeft=!1,this.selectedChange=new a.EventEmitter}return e.prototype.ngOnInit=function(){},e.prototype.ngOnChanges=function(e){e.selected&&this._processSelectedChange(this.selected)},e.prototype.ngAfterViewInit=function(){var e=this;setTimeout(function(){e._setTabItemsName(),e._processSelectedChange(e.selected)})},e.prototype.removeTab=function(e,t,n){e&&e.stopPropagation&&e.stopPropagation();var r=this.tabItems.indexOf(t),o=this.tabItems[r];if(o.destroy(),this.tabItems.splice(r,1),this.data.splice(r,1),this.dataChange.emit(this.data),this.selected===o.name){var a=this.tabItems[Math.min(r,this.tabItems.length-1)].name;this.selected=a,this.selectedChange.emit(this.selected)}},e.prototype.setActiveItem=function(e){this._currentTabItem!==e&&(this._currentTabItem&&(this._currentTabItem.active=!1),this._currentTabItem=e,this._currentTabItem.active=!0,this.selectedChange.emit(this._currentTabItem.innerName))},e.prototype._processSelectedChange=function(e){var t=this.tabItems.find(function(t){return t.innerName===e})||this.tabItems[0];t&&this.setActiveItem(t)},e.prototype._setTabItemsName=function(){this.tabItems.forEach(function(e,t){e.innerName||(e.innerName="tabpane-"+t)})},B([Object(a.Input)(),H("design:type",Array)],e.prototype,"data",void 0),B([Object(a.Output)(),H("design:type",Object)],e.prototype,"dataChange",void 0),B([Object(a.Input)(),H("design:type",String)],e.prototype,"selected",void 0),B([Object(a.Input)(),H("design:type",Object)],e.prototype,"tabsLeft",void 0),B([Object(a.Output)(),H("design:type",Object)],e.prototype,"selectedChange",void 0),e=B([Object(a.Component)({selector:"j-tabset",template:n(14)}),H("design:paramtypes",[])],e)}(),q=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i},J=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},W=function(){function e(e,t,n,r,o){this.elementRef=e,this.renderer=t,this.tabset=n,this.resolver=r,this.parentContexts=o,this._active=!1,this.closable=!1}return Object.defineProperty(e.prototype,"active",{get:function(){return this._active},set:function(e){this._active=e,e?this.renderer.addClass(this.elementRef.nativeElement,"active"):this.renderer.removeClass(this.elementRef.nativeElement,"active")},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.tabset.tabItems.push(this),this.elementRef.nativeElement.className="j-tab-item tab-pane"},e.prototype.ngOnChanges=function(e){e.name&&(this.innerName=this.name),e.comp&&this.loadComponent(this.comp)},e.prototype.destroy=function(){var e=this.elementRef.nativeElement;e.parentNode&&e.parentNode.removeChild(e)},e.prototype.loadComponent=function(e){var t=this.parentContexts.getContext(c.PRIMARY_OUTLET),n=(a.ReflectiveInjector.fromResolvedProviders([],this.dynamicComponentContainer.injector),(t.resolver||this.resolver).resolveComponentFactory(e));this.dynamicComponentContainer.createComponent(n)},q([Object(a.Input)(),J("design:type",String)],e.prototype,"name",void 0),q([Object(a.Input)(),J("design:type",String)],e.prototype,"header",void 0),q([Object(a.Input)(),J("design:type",String)],e.prototype,"icon",void 0),q([Object(a.Input)(),J("design:type",Object)],e.prototype,"comp",void 0),q([Object(a.Input)(),J("design:type",Object)],e.prototype,"closable",void 0),q([Object(a.ViewChild)("dynamicComponentContainer",{read:a.ViewContainerRef}),J("design:type",a.ViewContainerRef)],e.prototype,"dynamicComponentContainer",void 0),e=q([Object(a.Component)({selector:"j-tab-item",template:n(13)}),J("design:paramtypes",[a.ElementRef,a.Renderer2,V,a.ComponentFactoryResolver,c.ChildrenOutletContexts])],e)}(),Y=[U,V,W],z=[],G=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i},K=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Q=function(){function e(e){this.moduleLoader=e}return e=G([Object(a.NgModule)({imports:[i.BrowserModule,o.AppCommonModule,T],declarations:Y.concat(L,z),providers:o.COMMON_SERVICES.concat($),bootstrap:[p]}),K("design:paramtypes",[o.ModuleLoaderService])],e)}();n(25),window.defineModule=o.ModuleLoaderService.defineModule,Object(r.platformBrowserDynamic)().bootstrapModule(Q)},,,,function(e,t){e.exports='\r\n
\r\n'},function(e,t){e.exports='\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n'},,function(e,t,n){},function(e,t){e.exports='\r\n'},,function(e,t,n){},function(e,t){e.exports='\r\n \r\n \x3c!-- mini logo for sidebar mini 50x50 pixels --\x3e\r\n \r\n MP\r\n \r\n \x3c!-- logo for regular state and mobile devices --\x3e\r\n \r\n MODULAR\r\n PLATFORM\r\n \r\n \x3c!-- Header Navbar: style can be found in header.less --\x3e\r\n \r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \x3c!-- --\x3e\r\n \r\n
'},function(e,t){e.exports='\r\n
Logout
\r\n'},function(e,t){e.exports='\r\n
Login
\r\n'},function(e,t){e.exports="Home Component
"},function(e,t){e.exports='\r\n \r\n
\r\n'},function(e,t){window.AppConf={modulePath:"modules/"}},,function(e,t,n){}]);
2 | //# sourceMappingURL=app.js.map
--------------------------------------------------------------------------------
/docs/app/common.css:
--------------------------------------------------------------------------------
1 |
2 |
3 | /*# sourceMappingURL=common.css.map*/
--------------------------------------------------------------------------------
/docs/app/common.js:
--------------------------------------------------------------------------------
1 | var ampApp="object"==typeof ampApp?ampApp:{};ampApp.common=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t){e.exports=ng.core},function(e,t){e.exports=ng.router},,function(e,t){e.exports=ng.http},function(e,t){e.exports=ng.common},function(e,t){e.exports=ng.forms},,,function(e,t,n){"use strict";n.r(t);n(12);var o=n(0),r=n(4),u=n(3),c=n(5),i=n(1),f=[],l=[],p=function(e,t,n,o){var r,u=arguments.length,c=u<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,n,o);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(c=(u<3?r(c):u>3?r(t,n,c):r(t,n))||c);return u>3&&c&&Object.defineProperty(t,n,c),c},a=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},d=function(){function e(){}return e=p([Object(o.NgModule)({imports:[u.HttpModule],exports:[r.CommonModule,u.HttpModule,u.JsonpModule,c.FormsModule,i.RouterModule],declarations:f.concat(l),providers:[]}),a("design:paramtypes",[])],e)}(),s=(n(10),function(e,t,n,o){var r,u=arguments.length,c=u<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,n,o);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(c=(u<3?r(c):u>3?r(t,n,c):r(t,n))||c);return u>3&&c&&Object.defineProperty(t,n,c),c}),m=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},y=new Map,v=null,h=function(){function e(e){this.http=e,v=this}return e.load=function(e){return v.load(e)},e.defineModule=function(e,t,n){var o=Promise.resolve();if(y.set(e,t||[]),t&&t.length>0){var r=t.map(function(e){return v.load(e,!0)});o=Promise.all(r)}return o.then(function(){return n()})},e.prototype.load=function(e,t){var n=this;return void 0===t&&(t=!1),new Promise(function(t,o){var r=""+AppConf.modulePath+e+"/app.js";n._loadCss(e),n.http.get(r).toPromise().then(function(t){var o=t.text();return n._DomEval(o),window.ampApp[e]}).then(function(e){var n=e.AppModule;t(n)}).catch(function(e){return o(e)})})},e.prototype.useModuleStyles=function(e){var t=[].slice.apply(document.querySelectorAll(".dynamic-module-style")),n=this._getModuleAndDeps(e);t.forEach(function(e){for(var t=!0,o=n.length-1;o>=0;o--)if(e.className.indexOf(n[o])>=0){t=!1,n.splice(o,1);break}e.disabled=t})},e.prototype._getModuleAndDeps=function(e){var t=this;if("system"===e)return[];if(!y.has(e))return console.warn("module "+e+" not found."),[];var n=[e];return y.get(e).forEach(function(e){n.push.apply(n,t._getModuleAndDeps(e))}),n},e.prototype._loadCss=function(e){var t=""+AppConf.modulePath+e+"/app.css",n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",t),n.setAttribute("class","dynamic-module-style "+e),document.querySelector("head").appendChild(n)},e.prototype._DomEval=function(e,t){var n=(t=t||document).createElement("script");n.text=e,t.head.appendChild(n).parentNode.removeChild(n)},e=s([Object(o.Injectable)(),m("design:paramtypes",[u.Http])],e)}(),b=[h];n.d(t,"AppCommonModule",function(){return d}),n.d(t,"ModuleLoaderService",function(){return h}),n.d(t,"COMMON_SERVICES",function(){return b}),n.d(t,"COMMON_PIPES",function(){return l}),n.d(t,"COMMON_COMPONENTS",function(){return f})},,function(e,t){e.exports=rxjs},,function(e,t,n){}]);
2 | //# sourceMappingURL=common.js.map
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | ANGULAR-MODULAR-PLATFORM
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Loading...
19 |
20 |
21 |
22 |
23 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/docs/modules/demo1/app.css:
--------------------------------------------------------------------------------
1 |
2 |
3 | /*# sourceMappingURL=app.css.map*/
--------------------------------------------------------------------------------
/docs/modules/demo1/app.js:
--------------------------------------------------------------------------------
1 | var ampApp="object"==typeof ampApp?ampApp:{};ampApp.demo1=function(n){var e={};function t(o){if(e[o])return e[o].exports;var l=e[o]={i:o,l:!1,exports:{}};return n[o].call(l.exports,l,l.exports,t),l.l=!0,l.exports}return t.m=n,t.c=e,t.d=function(n,e,o){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:o})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var l in n)t.d(o,l,function(e){return n[e]}.bind(null,l));return o},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=10)}([function(n,e){n.exports=ng.core},function(n,e){n.exports=ng.http},function(n,e){n.exports=ng.router},function(n,e){n.exports=ng.forms},function(n,e){n.exports=ng.common},function(n,e){n.exports=ampApp.common},function(n,e){n.exports=ampApp.common},function(n,e,t){"use strict";t.r(e);t(9);var o=t(0),l=function(){function n(){}return n.prototype.ngOnInit=function(){},n.decorators=[{type:o.Component,args:[{templateUrl:"./page1.component.html"}]}],n.ctorParameters=function(){return[]},n}(),u=function(){function n(){}return n.prototype.ngOnInit=function(){},n.decorators=[{type:o.Component,args:[{templateUrl:"./page2.component.html"}]}],n.ctorParameters=function(){return[]},n}(),r=[l,u],p=t(6),a=t(2),c=[{path:"",component:l},{path:"page2",component:u}],d=a.RouterModule.forChild(c),m=function(){function n(){}return n.decorators=[{type:o.NgModule,args:[{imports:[p.AppCommonModule,d],declarations:r.slice(),providers:[],entryComponents:r.slice()}]}],n}(),s=(o["ɵcmf"](a.RouterModule,[],function(n){return o["ɵmod"]([o["ɵmpd"](512,o.ComponentFactoryResolver,o["ɵCodegenComponentFactoryResolver"],[[8,[f]],[3,o.ComponentFactoryResolver],o.NgModuleRef]),o["ɵmpd"](1073742336,a.RouterModule,a.RouterModule,[[2,a["ɵangular_packages_router_router_a"]],[2,a.Router]])])}),o["ɵcrt"]({encapsulation:2,styles:[],data:{}}));function i(n){return o["ɵvid"](0,[(n()(),o["ɵeld"](0,16777216,null,null,1,"router-outlet",[],null,null,null,null,null)),o["ɵdid"](1,212992,null,0,a.RouterOutlet,[a.ChildrenOutletContexts,o.ViewContainerRef,o.ComponentFactoryResolver,[8,null],o.ChangeDetectorRef],null,null)],function(n,e){n(e,1,0)},null)}var f=o["ɵccf"]("ng-component",a["ɵEmptyOutletComponent"],function(n){return o["ɵvid"](0,[(n()(),o["ɵeld"](0,0,null,null,1,"ng-component",[],null,null,null,i,s)),o["ɵdid"](1,49152,null,0,a["ɵEmptyOutletComponent"],[],null,null)],null,null)},{},{},[]),g=o["ɵcrt"]({encapsulation:2,styles:[],data:{}});function _(n){return o["ɵvid"](0,[(n()(),o["ɵeld"](0,0,null,null,1,"h1",[],null,null,null,null,null)),(n()(),o["ɵted"](-1,null,["Demo1 -> Page1"]))],null,null)}var R=o["ɵccf"]("ng-component",l,function(n){return o["ɵvid"](0,[(n()(),o["ɵeld"](0,0,null,null,1,"ng-component",[],null,null,null,_,g)),o["ɵdid"](1,114688,null,0,l,[],null,null)],function(n,e){n(e,1,0)},null)},{},{},[]),y=o["ɵcrt"]({encapsulation:2,styles:[],data:{}});function h(n){return o["ɵvid"](0,[(n()(),o["ɵeld"](0,0,null,null,1,"h1",[],null,null,null,null,null)),(n()(),o["ɵted"](-1,null,["Demo1 -> Page2"]))],null,null)}var v=o["ɵccf"]("ng-component",u,function(n){return o["ɵvid"](0,[(n()(),o["ɵeld"](0,0,null,null,1,"ng-component",[],null,null,null,h,y)),o["ɵdid"](1,114688,null,0,u,[],null,null)],function(n,e){n(e,1,0)},null)},{},{},[]),M=t(1),O=t(4),C=t(3),b=t(5),k=o["ɵcmf"](m,[],function(n){return o["ɵmod"]([o["ɵmpd"](512,o.ComponentFactoryResolver,o["ɵCodegenComponentFactoryResolver"],[[8,[f,R,v]],[3,o.ComponentFactoryResolver],o.NgModuleRef]),o["ɵmpd"](4608,M.BrowserXhr,M.BrowserXhr,[]),o["ɵmpd"](4608,M.ResponseOptions,M.BaseResponseOptions,[]),o["ɵmpd"](5120,M.XSRFStrategy,M["ɵangular_packages_http_http_a"],[]),o["ɵmpd"](4608,M.XHRBackend,M.XHRBackend,[M.BrowserXhr,M.ResponseOptions,M.XSRFStrategy]),o["ɵmpd"](4608,M.RequestOptions,M.BaseRequestOptions,[]),o["ɵmpd"](5120,M.Http,M["ɵangular_packages_http_http_b"],[M.XHRBackend,M.RequestOptions]),o["ɵmpd"](4608,O.NgLocalization,O.NgLocaleLocalization,[o.LOCALE_ID,[2,O["ɵangular_packages_common_common_a"]]]),o["ɵmpd"](4608,M["ɵangular_packages_http_http_e"],M["ɵangular_packages_http_http_e"],[]),o["ɵmpd"](4608,M.JSONPBackend,M.JSONPBackend,[M["ɵangular_packages_http_http_e"],M.ResponseOptions]),o["ɵmpd"](5120,M.Jsonp,M["ɵangular_packages_http_http_c"],[M.JSONPBackend,M.RequestOptions]),o["ɵmpd"](4608,C["ɵangular_packages_forms_forms_i"],C["ɵangular_packages_forms_forms_i"],[]),o["ɵmpd"](1073742336,M.HttpModule,M.HttpModule,[]),o["ɵmpd"](1073742336,O.CommonModule,O.CommonModule,[]),o["ɵmpd"](1073742336,M.JsonpModule,M.JsonpModule,[]),o["ɵmpd"](1073742336,C["ɵangular_packages_forms_forms_bb"],C["ɵangular_packages_forms_forms_bb"],[]),o["ɵmpd"](1073742336,C.FormsModule,C.FormsModule,[]),o["ɵmpd"](1073742336,a.RouterModule,a.RouterModule,[[2,a["ɵangular_packages_router_router_a"]],[2,a.Router]]),o["ɵmpd"](1073742336,b.AppCommonModule,b.AppCommonModule,[]),o["ɵmpd"](1073742336,m,m,[]),o["ɵmpd"](1024,a.ROUTES,function(){return[[{path:"",component:l},{path:"page2",component:u}]]},[])])});t.d(e,"AppModule",function(){return k})},,function(n,e,t){},function(n,e,t){n.exports=window.defineModule("demo1",[],function(){return t(7)})}]);
2 | //# sourceMappingURL=app.js.map
--------------------------------------------------------------------------------
/docs/static/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/docs/static/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/docs/static/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/docs/static/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/docs/static/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/docs/static/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/docs/static/fonts/glyphicons-halflings-regular.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/docs/static/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/docs/static/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/docs/static/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/docs/static/img/avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/avatar.png
--------------------------------------------------------------------------------
/docs/static/img/avatar04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/avatar04.png
--------------------------------------------------------------------------------
/docs/static/img/avatar2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/avatar2.png
--------------------------------------------------------------------------------
/docs/static/img/avatar3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/avatar3.png
--------------------------------------------------------------------------------
/docs/static/img/avatar5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/avatar5.png
--------------------------------------------------------------------------------
/docs/static/img/boxed-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/boxed-bg.jpg
--------------------------------------------------------------------------------
/docs/static/img/boxed-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/boxed-bg.png
--------------------------------------------------------------------------------
/docs/static/img/credit/american-express.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/credit/american-express.png
--------------------------------------------------------------------------------
/docs/static/img/credit/cirrus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/credit/cirrus.png
--------------------------------------------------------------------------------
/docs/static/img/credit/mastercard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/credit/mastercard.png
--------------------------------------------------------------------------------
/docs/static/img/credit/mestro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/credit/mestro.png
--------------------------------------------------------------------------------
/docs/static/img/credit/paypal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/credit/paypal.png
--------------------------------------------------------------------------------
/docs/static/img/credit/paypal2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/credit/paypal2.png
--------------------------------------------------------------------------------
/docs/static/img/credit/visa.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/credit/visa.png
--------------------------------------------------------------------------------
/docs/static/img/default-50x50.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/default-50x50.gif
--------------------------------------------------------------------------------
/docs/static/img/icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/icons.png
--------------------------------------------------------------------------------
/docs/static/img/photo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/photo1.png
--------------------------------------------------------------------------------
/docs/static/img/photo2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/photo2.png
--------------------------------------------------------------------------------
/docs/static/img/photo3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/photo3.jpg
--------------------------------------------------------------------------------
/docs/static/img/photo4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/photo4.jpg
--------------------------------------------------------------------------------
/docs/static/img/user1-128x128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/user1-128x128.jpg
--------------------------------------------------------------------------------
/docs/static/img/user2-160x160.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/user2-160x160.jpg
--------------------------------------------------------------------------------
/docs/static/img/user3-128x128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/user3-128x128.jpg
--------------------------------------------------------------------------------
/docs/static/img/user4-128x128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/user4-128x128.jpg
--------------------------------------------------------------------------------
/docs/static/img/user5-128x128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/user5-128x128.jpg
--------------------------------------------------------------------------------
/docs/static/img/user6-128x128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/user6-128x128.jpg
--------------------------------------------------------------------------------
/docs/static/img/user7-128x128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/user7-128x128.jpg
--------------------------------------------------------------------------------
/docs/static/img/user8-128x128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/docs/static/img/user8-128x128.jpg
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | ANGULAR-MODULAR-PLATFORM
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Loading...
19 |
20 |
21 |
22 |
23 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/modules/demo1/app-aot.ts:
--------------------------------------------------------------------------------
1 | import './styl/all.styl';
2 |
3 | import { AppModuleNgFactory as AppModule } from '../../aot-dist/modules/demo1/app.module.ngfactory';
4 |
5 | export {
6 | AppModule
7 | };
8 |
--------------------------------------------------------------------------------
/modules/demo1/app.module.ts:
--------------------------------------------------------------------------------
1 | import { ALL_PAGES } from './pages';
2 | import { AppCommonModule } from 'app/common';
3 | import { NgModule } from '@angular/core';
4 | import { routing } from './app.routing';
5 |
6 | @NgModule({
7 | imports: [
8 | AppCommonModule,
9 | routing
10 | ],
11 | declarations: [...ALL_PAGES],
12 | providers: [],
13 | entryComponents: [...ALL_PAGES]
14 | })
15 | export class AppModule {
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/modules/demo1/app.routing.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Page1Component,
3 | Page2Component
4 | } from './pages';
5 | import { RouterModule, Routes } from '@angular/router';
6 |
7 | import { ModuleWithProviders } from '@angular/core';
8 |
9 | const appRoutes: Routes = [
10 | { path: '', component: Page1Component },
11 | { path: 'page2', component: Page2Component },
12 | ];
13 |
14 | export const routing: ModuleWithProviders = RouterModule.forChild(appRoutes);
15 |
--------------------------------------------------------------------------------
/modules/demo1/app.ts:
--------------------------------------------------------------------------------
1 | import { AppModule } from './app.module';
2 | import './styl/all.styl';
3 |
4 | export {
5 | AppModule
6 | };
7 |
--------------------------------------------------------------------------------
/modules/demo1/index-aot.ts:
--------------------------------------------------------------------------------
1 | module.exports = window['defineModule']('demo1', [], () => {
2 | return require('./app-aot.ts');
3 | });
4 |
--------------------------------------------------------------------------------
/modules/demo1/index.ts:
--------------------------------------------------------------------------------
1 | module.exports = window['defineModule']('demo1', [], () => {
2 | return require('./app.ts');
3 | });
4 |
--------------------------------------------------------------------------------
/modules/demo1/pages/index.ts:
--------------------------------------------------------------------------------
1 | import { Page1Component } from './page1/page1.component';
2 | import { Page2Component } from './page2/page2.component';
3 |
4 | export {
5 | Page1Component,
6 | Page2Component
7 | };
8 |
9 | export const ALL_PAGES = [
10 | Page1Component,
11 | Page2Component
12 | ];
13 |
--------------------------------------------------------------------------------
/modules/demo1/pages/page1/page1.component.html:
--------------------------------------------------------------------------------
1 | Demo1 -> Page1
--------------------------------------------------------------------------------
/modules/demo1/pages/page1/page1.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | templateUrl: './page1.component.html'
5 | })
6 | export class Page1Component implements OnInit {
7 | constructor() { }
8 |
9 | ngOnInit() { }
10 | }
11 |
--------------------------------------------------------------------------------
/modules/demo1/pages/page2/page2.component.html:
--------------------------------------------------------------------------------
1 | Demo1 -> Page2
--------------------------------------------------------------------------------
/modules/demo1/pages/page2/page2.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | templateUrl: './page2.component.html'
5 | })
6 | export class Page2Component implements OnInit {
7 | constructor() { }
8 |
9 | ngOnInit() { }
10 | }
11 |
--------------------------------------------------------------------------------
/modules/demo1/styl/all.styl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/modules/demo1/styl/all.styl
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ngx-modular-platform",
3 | "version": "0.1.0",
4 | "description": "A development platform based Angular, easy for multiple teams development.",
5 | "main": "index.js",
6 | "types": "types",
7 | "scripts": {
8 | "types": "gulp build:types --gulpfile build/gulpfile.js --cwd ./",
9 | "lint": "tslint -c tslint.json 'src/**/*.ts' 'modules/**/*.ts' || true",
10 | "modules": "gulp modules --gulpfile build/gulpfile.js --cwd ./",
11 | "modules:ngc": "ngc -p tsconfig-aot.json",
12 | "modules:aot": "npm run modules:ngc && gulp modules-aot -r --gulpfile build/gulpfile.js --cwd ./",
13 | "dev:app": "gulp app --gulpfile build/gulpfile.js --cwd ./",
14 | "dev:vendor": "gulp vendor --gulpfile build/gulpfile.js --cwd ./",
15 | "dev": "gulp --gulpfile build/gulpfile.js --cwd ./",
16 | "build": "gulp release -r --gulpfile build/gulpfile.js --cwd ./",
17 | "rollup": "gulp modules-rollup --gulpfile build/gulpfile.js --cwd ./",
18 | "test": "test"
19 | },
20 | "repository": {
21 | "type": "git",
22 | "url": "git+https://github.com/hstarorg/ngx-modular-platform.git"
23 | },
24 | "keywords": [
25 | "angular",
26 | "modular",
27 | "development",
28 | "platform"
29 | ],
30 | "author": "Jay.M.Hu",
31 | "license": "MIT",
32 | "bugs": {
33 | "url": "https://github.com/hstarorg/ngx-modular-platform/issues"
34 | },
35 | "homepage": "https://github.com/hstarorg/ngx-modular-platform#readme",
36 | "dependencies": {
37 | "@angular/common": "6.0.7",
38 | "@angular/compiler": "6.0.7",
39 | "@angular/core": "6.0.7",
40 | "@angular/forms": "6.0.7",
41 | "@angular/http": "6.0.7",
42 | "@angular/platform-browser": "6.0.7",
43 | "@angular/platform-browser-dynamic": "6.0.7",
44 | "@angular/router": "6.0.7",
45 | "@angular/animations": "6.0.7",
46 | "admin-lte": "2.4.2",
47 | "bootstrap": "3.3.7",
48 | "font-awesome": "^4.7.0",
49 | "jquery": "3.2.1",
50 | "reflect-metadata": "0.1.12",
51 | "rxjs": "6.2.1",
52 | "zone.js": "0.8.26"
53 | },
54 | "devDependencies": {
55 | "@angular/compiler-cli": "^6.0.7",
56 | "@types/node": "^8.5.2",
57 | "angular2-template-loader": "0.6.2",
58 | "awesome-typescript-loader": "5.2.0",
59 | "browser-sync": "2.24.5",
60 | "connect-history-api-fallback": "1.5.0",
61 | "css-loader": "1.0.0",
62 | "extract-text-webpack-plugin": "3.0.2",
63 | "gulp": "^4.0.0",
64 | "gulp-concat": "2.6.1",
65 | "gulp-util": "3.0.8",
66 | "mini-css-extract-plugin": "^0.4.1",
67 | "node-notifier": "5.2.1",
68 | "nprogress": "^0.2.0",
69 | "raw-loader": "0.5.1",
70 | "rollup": "^0.62.0",
71 | "rollup-plugin-angular-optimizer": "^0.2.0",
72 | "rollup-plugin-commonjs": "^9.1.3",
73 | "rollup-plugin-node-resolve": "^3.3.0",
74 | "rollup-plugin-sourcemaps": "^0.4.2",
75 | "rollup-plugin-uglify": "^4.0.0",
76 | "shelljs": "0.8.2",
77 | "stylus": "0.54.5",
78 | "stylus-loader": "3.0.2",
79 | "tslint": "5.10.0",
80 | "typescript": "2.7.2",
81 | "webpack": "4.15.1",
82 | "webpack-merge": "4.1.3"
83 | },
84 | "peerDependencies": {
85 | "less": "^2.7.2",
86 | "less-loader": "^2.2.3",
87 | "node-sass": "^4.5.1",
88 | "sass-loader": "^6.0.3"
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/src/app.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { BrowserModule } from '@angular/platform-browser';
3 | import { RouterModule } from '@angular/router';
4 | import {
5 | AppCommonModule,
6 | COMMON_SERVICES,
7 | ModuleLoaderService
8 | } from 'app/common';
9 | import { routing } from './app.routing';
10 | import { ALL_COMPONENTS } from './components';
11 | import { ALL_PAGES, AppComponent } from './pages';
12 | import { ALL_PIPES } from './pipes';
13 | import { ALL_SERVICES } from './services';
14 |
15 | @NgModule({
16 | imports: [BrowserModule, AppCommonModule, routing],
17 | declarations: [...ALL_COMPONENTS, ...ALL_PAGES, ...ALL_PIPES],
18 | providers: [...COMMON_SERVICES, ...ALL_SERVICES],
19 | bootstrap: [AppComponent]
20 | })
21 | export class AppModule {
22 | constructor(private moduleLoader: ModuleLoaderService) {}
23 | }
24 |
--------------------------------------------------------------------------------
/src/app.routing.ts:
--------------------------------------------------------------------------------
1 | import { ApplicationRef, ModuleWithProviders } from '@angular/core';
2 | import { ConnectionBackend, Http } from '@angular/http';
3 | import { RouterModule, Routes } from '@angular/router';
4 | import { ModuleLoaderService } from 'app/common';
5 | import {
6 | HomeComponent,
7 | LayoutComponent,
8 | LoginComponent,
9 | LogoutComponent,
10 | NotFoundComponent
11 | } from './pages';
12 | import { AuthGuard } from './services';
13 |
14 | const loadModule = (moduleName: string) => {
15 | return () => {
16 | return ModuleLoaderService.load(moduleName);
17 | };
18 | };
19 |
20 | // 定义模块 - URL 映射
21 | let modules: Array<{ path: string; module: string }> = [
22 | { path: 'demo1', module: 'demo1' }
23 | ];
24 |
25 | let dynamicRoutes: Routes = [];
26 |
27 | modules.forEach(m => {
28 | dynamicRoutes.push({
29 | path: m.path,
30 | loadChildren: loadModule(m.module),
31 | canActivate: [AuthGuard],
32 | canActivateChild: [AuthGuard]
33 | });
34 | });
35 |
36 | const appRoutes: Routes = [
37 | {
38 | path: 'login',
39 | component: LoginComponent
40 | },
41 | {
42 | path: 'logout',
43 | component: LogoutComponent
44 | },
45 | {
46 | path: '',
47 | component: LayoutComponent,
48 | canActivate: [AuthGuard],
49 | canActivateChild: [AuthGuard],
50 | children: [
51 | { path: '', component: HomeComponent },
52 | ...dynamicRoutes,
53 | { path: '**', component: NotFoundComponent }
54 | ]
55 | }
56 | ];
57 |
58 | export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes, {
59 | useHash: true
60 | });
61 |
--------------------------------------------------------------------------------
/src/app.ts:
--------------------------------------------------------------------------------
1 | import './styl/all.styl';
2 |
3 | import { ModuleLoaderService } from 'app/common';
4 |
5 | if (process.env.NODE_ENV === 'production') {
6 | require('./config/config.prod');
7 | } else {
8 | require('./config/config.dev');
9 | }
10 |
11 |
12 | window['defineModule'] = ModuleLoaderService.defineModule;
13 |
14 | export * from './app.module';
15 |
--------------------------------------------------------------------------------
/src/common_module/app.ts:
--------------------------------------------------------------------------------
1 | import './styl/all.styl';
2 |
3 | import { AppCommonModule } from './common.module';
4 |
5 | export * from './services';
6 | export * from './pipes';
7 | export * from './components';
8 |
9 | export {
10 | AppCommonModule
11 | };
12 |
--------------------------------------------------------------------------------
/src/common_module/common.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { HttpModule, JsonpModule } from '@angular/http';
4 | import { FormsModule } from '@angular/forms';
5 | import { RouterModule } from '@angular/router';
6 |
7 | import { COMMON_COMPONENTS } from './components';
8 | import { COMMON_PIPES } from './pipes';
9 |
10 | @NgModule({
11 | imports: [
12 | HttpModule
13 | ],
14 | exports: [
15 | CommonModule,
16 | HttpModule,
17 | JsonpModule,
18 | FormsModule,
19 | RouterModule
20 | ],
21 | declarations: [...COMMON_COMPONENTS, ...COMMON_PIPES],
22 | providers: [],
23 | })
24 | export class AppCommonModule {
25 | constructor() {
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/common_module/components/index.ts:
--------------------------------------------------------------------------------
1 | export {
2 |
3 | };
4 |
5 | export const COMMON_COMPONENTS: any[] = [
6 |
7 | ];
8 |
--------------------------------------------------------------------------------
/src/common_module/index.ts:
--------------------------------------------------------------------------------
1 | export * from './app';
2 |
--------------------------------------------------------------------------------
/src/common_module/pipes/index.ts:
--------------------------------------------------------------------------------
1 | export {
2 |
3 | };
4 |
5 | export const COMMON_PIPES: any[] = [
6 |
7 | ];
8 |
--------------------------------------------------------------------------------
/src/common_module/services/index.ts:
--------------------------------------------------------------------------------
1 | import { ModuleLoaderService } from './module-loader.service';
2 |
3 | export {
4 | ModuleLoaderService
5 | };
6 |
7 | export const COMMON_SERVICES = [
8 | ModuleLoaderService
9 | ];
10 |
--------------------------------------------------------------------------------
/src/common_module/services/module-loader.service.ts:
--------------------------------------------------------------------------------
1 | import 'rxjs';
2 |
3 | import { Inject, Injectable } from '@angular/core';
4 |
5 | import { Http } from '@angular/http';
6 |
7 | const moduleDepsMapping: Map = new Map();
8 |
9 | let instance: ModuleLoaderService = null;
10 |
11 | @Injectable()
12 | export class ModuleLoaderService {
13 |
14 | public static load(moduleName: string) {
15 | return instance.load(moduleName);
16 | }
17 |
18 | public static defineModule(name: string, deps: string[], callback: Function) {
19 | let p: Promise = Promise.resolve();
20 | moduleDepsMapping.set(name, deps || []);
21 | if (deps && deps.length > 0) {
22 | let depArr = deps.map(dep => instance.load(dep, true));
23 | p = Promise.all(depArr);
24 | }
25 | return p.then(() => {
26 | const mod = callback();
27 | return mod;
28 | });
29 | }
30 |
31 | constructor(private http: Http) {
32 | instance = this;
33 | }
34 |
35 | load(moduleName: string, isDepModule = false): Promise {
36 | return new Promise((resolve, reject) => {
37 | let path = `${AppConf.modulePath}${moduleName}/app.js`;
38 | this._loadCss(moduleName);
39 | this.http.get(path)
40 | .toPromise()
41 | .then(res => {
42 | let code = res.text();
43 | this._DomEval(code);
44 | return window['ampApp'][moduleName];
45 | })
46 | .then(mod => {
47 | let AppModule = mod.AppModule;
48 | // route change will call useModuleStyles function.
49 | // this.useModuleStyles(moduleName, isDepModule);
50 | resolve(AppModule);
51 | })
52 | .catch(err => reject(err));
53 | });
54 | }
55 |
56 | useModuleStyles(moduleName: string): void {
57 | let newkitModuleStyles = [].slice.apply(document.querySelectorAll('.dynamic-module-style'));
58 | let moduleDeps = this._getModuleAndDeps(moduleName);
59 | newkitModuleStyles.forEach((link: HTMLLinkElement) => {
60 | let disabled = true;
61 | for (let i = moduleDeps.length - 1; i >= 0; i--) {
62 | if (link.className.indexOf(moduleDeps[i]) >= 0) {
63 | disabled = false;
64 | moduleDeps.splice(i, 1);
65 | break;
66 | }
67 | }
68 | link.disabled = disabled;
69 | });
70 | }
71 |
72 | _getModuleAndDeps(moduleName: string): Array {
73 | if (moduleName === 'system') {
74 | return [];
75 | }
76 | if (!moduleDepsMapping.has(moduleName)) {
77 | console.warn(`module ${moduleName} not found.`);
78 | return [];
79 | }
80 | let result = [moduleName];
81 | let deps = moduleDepsMapping.get(moduleName);
82 | deps.forEach(dep => {
83 | result.push(...this._getModuleAndDeps(dep));
84 | });
85 | return result;
86 | }
87 |
88 | _loadCss(moduleName: string): void {
89 | let cssPath = `${AppConf.modulePath}${moduleName}/app.css`;
90 | let link = document.createElement('link');
91 | link.setAttribute('rel', 'stylesheet');
92 | link.setAttribute('href', cssPath);
93 | link.setAttribute('class', `dynamic-module-style ${moduleName}`);
94 | document.querySelector('head').appendChild(link);
95 | }
96 |
97 | _DomEval(code: string, doc?: Document) {
98 | doc = doc || document;
99 | let script = doc.createElement('script');
100 | script.text = code;
101 | doc.head.appendChild(script).parentNode.removeChild(script);
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/src/common_module/styl/all.styl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hstarorg/ngx-modular-platform/33d0ca12466010094d1dfbf2543d85c6494ed5c2/src/common_module/styl/all.styl
--------------------------------------------------------------------------------
/src/common_module/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES5",
4 | "module": "commonjs",
5 | "moduleResolution": "node",
6 | "noLib": false,
7 | "emitDecoratorMetadata": true,
8 | "experimentalDecorators": true,
9 | "sourceMap": false,
10 | "noEmitOnError": false,
11 | "baseUrl": "./",
12 | "typeRoots": [
13 | "./../../node_modules/@types",
14 | "./../../src"
15 | ],
16 | "declaration": true,
17 | "declarationDir": "./../../node_modules/@types/app/common",
18 | "outDir": "./../../dist"
19 | },
20 | "awesomeTypescriptLoaderOptions": {
21 | "forkChecker": true,
22 | "useWebpackText": true
23 | }
24 | }
--------------------------------------------------------------------------------
/src/components/index.ts:
--------------------------------------------------------------------------------
1 | import { MenuComponent } from './menu/menu.component';
2 | import { TabItemComponent } from './tabset/tab-item.component';
3 | import { TabsetComponent } from './tabset/tabset.component';
4 |
5 | export const ALL_COMPONENTS = [
6 | MenuComponent,
7 | TabsetComponent,
8 | TabItemComponent
9 | ];
10 |
--------------------------------------------------------------------------------
/src/components/menu/menu.component.html:
--------------------------------------------------------------------------------
1 |
31 |
--------------------------------------------------------------------------------
/src/components/menu/menu.component.styl:
--------------------------------------------------------------------------------
1 | .j-menu{
2 | &:.sidebar-menu .ul-active .treeview-menu{
3 | display: block;
4 | }
5 | .treeview.open > a{
6 | color: #fff;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/components/menu/menu.component.ts:
--------------------------------------------------------------------------------
1 | import './menu.component.styl';
2 |
3 | import { Component, Input, OnInit } from '@angular/core';
4 | import { NavigationEnd, Router } from '@angular/router';
5 |
6 | export interface MenuEntity {
7 | text: string;
8 | url?: string;
9 | children?: Array;
10 | $parent: MenuEntity | null;
11 | $active: boolean;
12 | $open: boolean;
13 | $hasChildren: boolean;
14 | }
15 |
16 | @Component({
17 | selector: 'j-menu',
18 | templateUrl: 'menu.component.html'
19 | })
20 | export class MenuComponent implements OnInit {
21 | private menus: Array;
22 |
23 | @Input()
24 | private set menuData(value: any) {
25 | this.processMenuData(value);
26 | this.menus = value;
27 | }
28 |
29 | constructor(private router: Router) {
30 | this.router.events.subscribe(evt => {
31 | if (evt instanceof NavigationEnd) {
32 | this.setMenuStatus(evt.url);
33 | }
34 | });
35 | }
36 |
37 | ngOnInit() {}
38 |
39 | private onMenuClick(evt: MouseEvent, menu: MenuEntity) {
40 | evt.stopPropagation();
41 | if (menu.$hasChildren) {
42 | menu.$open = !menu.$open;
43 | } else {
44 | this.router.navigate([menu.url]);
45 | }
46 | }
47 |
48 | private findMenuByUrl(url: string, menus: Array): MenuEntity {
49 | for (let m of menus) {
50 | if (m.url && m.url === url) {
51 | return m;
52 | }
53 | if (m.$hasChildren) {
54 | let menu = this.findMenuByUrl(url, m.children);
55 | if (menu) {
56 | return menu;
57 | }
58 | }
59 | }
60 | }
61 |
62 | private processMenuData(
63 | menuData: Array,
64 | parent: MenuEntity = null
65 | ): void {
66 | if (!Array.isArray(menuData)) {
67 | return;
68 | }
69 | menuData.forEach(menu => {
70 | menu.$active = false;
71 | menu.$parent = parent;
72 | if (menu.children && menu.children.length > 0) {
73 | menu.$hasChildren = true;
74 | this.processMenuData(menu.children, menu);
75 | }
76 | });
77 | }
78 |
79 | private setAllMenuInActive(menus: Array) {
80 | menus.forEach(x => {
81 | x.$active = false;
82 | x.$open = false;
83 | if (x.$hasChildren) {
84 | this.setAllMenuInActive(x.children);
85 | }
86 | });
87 | }
88 |
89 | private setMenuFamilyActive(menu: MenuEntity) {
90 | menu.$open = true;
91 | if (menu.$parent) {
92 | this.setMenuFamilyActive(menu.$parent);
93 | }
94 | }
95 |
96 | private setMenuStatus(url: string) {
97 | setTimeout(() => {
98 | this.setAllMenuInActive(this.menus);
99 | let menu = this.findMenuByUrl(url, this.menus);
100 | if (menu) {
101 | menu.$active = true;
102 | this.setMenuFamilyActive(menu);
103 | }
104 | });
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/src/components/tabset/tab-item.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/components/tabset/tab-item.component.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Component,
3 | ComponentFactoryResolver,
4 | ElementRef,
5 | Input,
6 | OnChanges,
7 | OnInit,
8 | ReflectiveInjector,
9 | Renderer2,
10 | SimpleChanges,
11 | ViewChild,
12 | ViewContainerRef
13 | } from '@angular/core';
14 | import { ChildrenOutletContexts, PRIMARY_OUTLET } from '@angular/router';
15 | import { TabsetComponent } from './tabset.component';
16 |
17 | @Component({
18 | selector: 'j-tab-item',
19 | templateUrl: 'tab-item.component.html'
20 | })
21 | export class TabItemComponent implements OnInit, OnChanges {
22 | public innerName: string;
23 | private _active = false;
24 | public get active() {
25 | return this._active;
26 | }
27 | public set active(val) {
28 | this._active = val;
29 | if (val) {
30 | this.renderer.addClass(this.elementRef.nativeElement, 'active');
31 | } else {
32 | this.renderer.removeClass(this.elementRef.nativeElement, 'active');
33 | }
34 | }
35 |
36 | @Input() name: string;
37 | @Input() header: string;
38 | @Input() icon: string;
39 | @Input() comp: any;
40 | @Input() closable = false;
41 | @ViewChild('dynamicComponentContainer', { read: ViewContainerRef })
42 | dynamicComponentContainer: ViewContainerRef;
43 |
44 | constructor(
45 | private elementRef: ElementRef,
46 | private renderer: Renderer2,
47 | private tabset: TabsetComponent,
48 | private resolver: ComponentFactoryResolver,
49 | private parentContexts: ChildrenOutletContexts
50 | ) {}
51 |
52 | ngOnInit() {
53 | this.tabset.tabItems.push(this);
54 | this.elementRef.nativeElement.className = 'j-tab-item tab-pane';
55 | }
56 |
57 | ngOnChanges(changes: SimpleChanges) {
58 | if (changes.name) {
59 | this.innerName = this.name;
60 | }
61 | if (changes.comp) {
62 | // 动态加载组件
63 | this.loadComponent(this.comp);
64 | }
65 | }
66 |
67 | public destroy() {
68 | let el = this.elementRef.nativeElement as HTMLElement;
69 | // tslint:disable-next-line:no-unused-expression
70 | el.parentNode && el.parentNode.removeChild(el);
71 | }
72 |
73 | private loadComponent(component: any) {
74 | let context = this.parentContexts.getContext(PRIMARY_OUTLET);
75 | let injector = ReflectiveInjector.fromResolvedProviders(
76 | [],
77 | this.dynamicComponentContainer.injector
78 | );
79 | const resolver = context.resolver || this.resolver;
80 | let factory = resolver.resolveComponentFactory(component);
81 | // let componentIns = factory.create(injector);
82 | // this.dynamicComponentContainer.insert(componentIns.hostView);
83 | this.dynamicComponentContainer.createComponent(factory);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/components/tabset/tabset.component.html:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/components/tabset/tabset.component.styl:
--------------------------------------------------------------------------------
1 | .j-tabset {
2 | .nav.nav-tabs {
3 | li {
4 | min-width: 80px;
5 | text-align: center;
6 | }
7 |
8 | .tab-close {
9 | position: absolute;
10 | right: 2px;
11 | top: 2px;
12 | cursor: pointer;
13 | border-radius: 50%;
14 |
15 | &:hover {
16 | color: #c9302c;
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/components/tabset/tabset.component.ts:
--------------------------------------------------------------------------------
1 | import './tabset.component.styl';
2 |
3 | import {
4 | AfterViewInit,
5 | Component,
6 | EventEmitter,
7 | Input,
8 | OnChanges,
9 | OnInit,
10 | Output,
11 | SimpleChanges
12 | } from '@angular/core';
13 | import { TabItemComponent } from './tab-item.component';
14 |
15 | @Component({
16 | selector: 'j-tabset',
17 | templateUrl: 'tabset.component.html'
18 | })
19 | export class TabsetComponent implements OnInit {
20 | private _currentTabItem: TabItemComponent;
21 | public tabItems: TabItemComponent[] = [];
22 |
23 | @Input() data: any[] = [];
24 | @Output() dataChange = new EventEmitter();
25 | @Input() selected: string;
26 | @Input() tabsLeft = false;
27 | @Output() selectedChange = new EventEmitter();
28 |
29 | constructor() {}
30 |
31 | ngOnInit() {}
32 |
33 | ngOnChanges(changes: SimpleChanges) {
34 | if (changes.selected) {
35 | this._processSelectedChange(this.selected);
36 | }
37 | }
38 |
39 | ngAfterViewInit() {
40 | setTimeout(() => {
41 | this._setTabItemsName();
42 | this._processSelectedChange(this.selected);
43 | });
44 | }
45 |
46 | public removeTab(evt: MouseEvent, tab: TabItemComponent, $event) {
47 | // tslint:disable-next-line:no-unused-expression
48 | evt && evt.stopPropagation && evt.stopPropagation();
49 | let findTabIdx = this.tabItems.indexOf(tab);
50 | let findTab = this.tabItems[findTabIdx];
51 | // 主动释放自己
52 | findTab.destroy();
53 | this.tabItems.splice(findTabIdx, 1);
54 | this.data.splice(findTabIdx, 1);
55 | this.dataChange.emit(this.data);
56 | if (this.selected === findTab.name) {
57 | let selected = this.tabItems[
58 | Math.min(findTabIdx, this.tabItems.length - 1)
59 | ].name;
60 | this.selected = selected;
61 | this.selectedChange.emit(this.selected);
62 | }
63 | }
64 |
65 | public setActiveItem(tabItem: TabItemComponent) {
66 | if (this._currentTabItem === tabItem) {
67 | return;
68 | }
69 | if (this._currentTabItem) {
70 | this._currentTabItem.active = false;
71 | }
72 | this._currentTabItem = tabItem;
73 | this._currentTabItem.active = true;
74 | this.selectedChange.emit(this._currentTabItem.innerName);
75 | }
76 |
77 | private _processSelectedChange(name: string) {
78 | let findTabItem =
79 | this.tabItems.find(x => x.innerName === name) || this.tabItems[0];
80 | if (findTabItem) {
81 | this.setActiveItem(findTabItem);
82 | }
83 | }
84 |
85 | private _setTabItemsName() {
86 | this.tabItems.forEach((item: TabItemComponent, idx: number) => {
87 | if (!item.innerName) {
88 | item.innerName = `tabpane-${idx}`;
89 | }
90 | });
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/config/config.dev.ts:
--------------------------------------------------------------------------------
1 | const configDev = {
2 | modulePath: 'modules/'
3 | };
4 |
5 | window['AppConf'] = configDev;
6 |
--------------------------------------------------------------------------------
/src/config/config.prod.ts:
--------------------------------------------------------------------------------
1 | const configProd = {
2 | modulePath: 'modules/'
3 | };
4 |
5 | window['AppConf'] = configProd;
6 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2 | import { AppModule } from './app';
3 |
4 | platformBrowserDynamic().bootstrapModule(AppModule);
5 |
--------------------------------------------------------------------------------
/src/pages/404/notfound.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | template: '404 Not Found.
'
5 | })
6 | export class NotFoundComponent implements OnInit {
7 | constructor() { }
8 |
9 | ngOnInit() { }
10 | }
11 |
--------------------------------------------------------------------------------
/src/pages/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/pages/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, AfterContentInit, AfterViewInit, OnDestroy } from '@angular/core';
2 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
3 | import { Router } from '@angular/router';
4 |
5 |
6 | @Component({
7 | selector: 'angular-app',
8 | templateUrl: 'app.component.html'
9 | })
10 | export class AppComponent implements OnInit, OnDestroy {
11 |
12 | constructor() {
13 | }
14 |
15 | ngOnInit() {
16 |
17 | }
18 |
19 | ngOnDestroy() {
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/pages/home/home.component.html:
--------------------------------------------------------------------------------
1 | Home Component
--------------------------------------------------------------------------------
/src/pages/home/home.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | templateUrl: './home.component.html'
5 | })
6 | export class HomeComponent implements OnInit {
7 | constructor() { }
8 |
9 | ngOnInit() { }
10 | }
11 |
--------------------------------------------------------------------------------
/src/pages/index.ts:
--------------------------------------------------------------------------------
1 | import { AppComponent } from './app/app.component';
2 | import { HomeComponent } from './home/home.component';
3 | import { NotFoundComponent } from './404/notfound.component';
4 | import { LoginComponent } from './login/login.component';
5 | import { LogoutComponent } from './logout/logout.component';
6 | import { LayoutComponent } from './layout/layout.component';
7 |
8 | export {
9 | AppComponent,
10 | HomeComponent,
11 | NotFoundComponent,
12 | LoginComponent,
13 | LogoutComponent,
14 | LayoutComponent
15 | };
16 |
17 | export const ALL_PAGES = [
18 | AppComponent,
19 | HomeComponent,
20 | NotFoundComponent,
21 | LoginComponent,
22 | LogoutComponent,
23 | LayoutComponent
24 | ];
25 |
--------------------------------------------------------------------------------
/src/pages/layout/layout.component.html:
--------------------------------------------------------------------------------
1 |
69 |
84 |
85 |
94 |
100 |
--------------------------------------------------------------------------------
/src/pages/layout/layout.component.ts:
--------------------------------------------------------------------------------
1 | import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
2 | import { Component, OnInit } from '@angular/core';
3 |
4 | import { HomeComponent } from '../home/home.component';
5 | import { Location } from '@angular/common';
6 | import { MenuService } from '../../services';
7 | import { NotFoundComponent } from '../404/notfound.component';
8 |
9 | interface PageEntity {
10 | header: string;
11 | comp: any;
12 | name: string;
13 | closable?: boolean;
14 | }
15 |
16 | @Component({
17 | templateUrl: 'layout.component.html'
18 | })
19 | export class LayoutComponent implements OnInit {
20 |
21 | private menuData: Array = [];
22 | public pageList: PageEntity[] = [{
23 | header: 'Home',
24 | comp: HomeComponent,
25 | name: 'page1'
26 | }];
27 | public selectedPage = 'page1';
28 |
29 | constructor(
30 | private location: Location,
31 | private router: Router,
32 | private route: ActivatedRoute,
33 | private menuService: MenuService
34 | ) {
35 | }
36 |
37 | ngOnInit() {
38 | this.watchRouterChange();
39 | this.menuService.getMenuData()
40 | .then(data => {
41 | this.menuData = data;
42 | });
43 | }
44 |
45 | private watchRouterChange() {
46 | this.router.events.subscribe(evt => {
47 | if (evt instanceof NavigationEnd) {
48 | let pageComponent;
49 | let pageName;
50 | try {
51 | let nextRoute = this.route.children[0].children[0];
52 | pageName = this.location.path();
53 | pageComponent = nextRoute.component;
54 | } catch (e) {
55 | pageName = '$$notfound';
56 | pageComponent = NotFoundComponent;
57 | }
58 | let idx = this.pageList.length + 1;
59 | if (!this.pageList.find(x => x.name === pageName)) {
60 | this.pageList.push({
61 | header: `页面${idx}`,
62 | comp: pageComponent,
63 | name: pageName,
64 | closable: true
65 | });
66 | }
67 | setTimeout(() => {
68 | this.selectedPage = pageName;
69 | });
70 | }
71 | });
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/pages/login/login.component.html:
--------------------------------------------------------------------------------
1 |
2 |
Login
3 |
--------------------------------------------------------------------------------
/src/pages/login/login.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | templateUrl: 'login.component.html'
5 | })
6 | export class LoginComponent implements OnInit {
7 | constructor() { }
8 |
9 | ngOnInit() { }
10 | }
11 |
--------------------------------------------------------------------------------
/src/pages/logout/logout.component.html:
--------------------------------------------------------------------------------
1 |
2 |
Logout
3 |
--------------------------------------------------------------------------------
/src/pages/logout/logout.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | templateUrl: 'logout.component.html'
5 | })
6 | export class LogoutComponent implements OnInit {
7 | constructor() { }
8 |
9 | ngOnInit() { }
10 | }
11 |
--------------------------------------------------------------------------------
/src/pipes/index.ts:
--------------------------------------------------------------------------------
1 | export const ALL_PIPES: any[] = [];
2 |
--------------------------------------------------------------------------------
/src/services/auth-guard.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import {
3 | ActivatedRouteSnapshot,
4 | CanActivate,
5 | CanActivateChild,
6 | CanLoad,
7 | NavigationEnd,
8 | NavigationError,
9 | NavigationStart,
10 | Router,
11 | RouterStateSnapshot
12 | } from '@angular/router';
13 | import { ModuleLoaderService } from 'app/common';
14 |
15 | @Injectable()
16 | export class AuthGuard implements CanActivate, CanActivateChild {
17 | constructor(
18 | private router: Router,
19 | private moduleLoader: ModuleLoaderService
20 | ) {
21 | this.router.events.subscribe(evt => {
22 | let NProgress = (window as any).NProgress;
23 | if (evt instanceof NavigationStart) {
24 | NProgress.start();
25 | } else if (
26 | evt instanceof NavigationEnd ||
27 | evt instanceof NavigationError
28 | ) {
29 | let ga = window['ga'];
30 | // tslint:disable-next-line:no-unused-expression
31 | ga && ga('send', 'pageview', this.router.url);
32 | NProgress.done();
33 | }
34 | });
35 | }
36 |
37 | canActivate(
38 | route: ActivatedRouteSnapshot,
39 | state: RouterStateSnapshot,
40 | isChild = false
41 | ): Promise {
42 | let moduleName = state.url.split('/')[1];
43 | if (!isChild) {
44 | this.moduleLoader.useModuleStyles(moduleName);
45 | }
46 | return Promise.resolve(true);
47 | }
48 |
49 | canActivateChild(
50 | route: ActivatedRouteSnapshot,
51 | state: RouterStateSnapshot
52 | ): Promise {
53 | return this.canActivate(route, state, true);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/services/index.ts:
--------------------------------------------------------------------------------
1 | import { AuthGuard } from './auth-guard';
2 | import { MenuService } from './menu.service';
3 |
4 | export { AuthGuard, MenuService };
5 |
6 | export const ALL_SERVICES = [AuthGuard, MenuService];
7 |
--------------------------------------------------------------------------------
/src/services/menu.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 |
3 | @Injectable()
4 | export class MenuService {
5 | private menuData = [
6 | {
7 | text: 'Control Panel',
8 | icon: 'fa fa-cogs',
9 | children: [
10 | {
11 | text: 'Level 2 Menu',
12 | icon: 'fa fa-home',
13 | children: [{ text: 'Level 3 Menu', icon: 'fa fa-star', url: '/' }]
14 | },
15 | { text: 'Not Found', icon: 'fa fa-close', url: '/404' }
16 | ]
17 | },
18 | {
19 | text: 'Demo Module',
20 | icon: 'fa fa-list',
21 | children: [
22 | { text: 'Demo Page1', icon: 'fa fa-home', url: '/demo1' },
23 | { text: 'Demo Page2', icon: 'fa fa-lock', url: '/demo1/page2' }
24 | ]
25 | }
26 | ];
27 |
28 | constructor() {}
29 |
30 | getMenuData() {
31 | return Promise.resolve(this.menuData);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/styl/all.styl:
--------------------------------------------------------------------------------
1 | @import 'vendor-reset.styl';
2 |
3 | @import 'layout.styl';
4 |
--------------------------------------------------------------------------------
/src/styl/layout.styl:
--------------------------------------------------------------------------------
1 | .content-wrapper{
2 | height: 100vh;
3 | .content-header{
4 | height: 40px;
5 | padding: 0;
6 | box-shadow: 0px 0px 1px #222d32;
7 | .breadcrumb{
8 | top: 3px;
9 | right: auto;
10 | font-size: 14px;
11 | }
12 | }
13 | }
14 | .navbar-nav > .user-menu > .dropdown-menu.praise-ul{
15 | width: 400px;
16 | }
17 | .praise{
18 | font-size: 0;
19 | img {
20 | width: 48%;
21 | &:nth-child(1){
22 | margin-right: 4%;
23 | }
24 | }
25 | }
26 |
27 | .navbar-nav > .user-menu > .dropdown-menu > li.user-header{
28 | height: auto;
29 | }
--------------------------------------------------------------------------------
/src/styl/vendor-reset.styl:
--------------------------------------------------------------------------------
1 | #nprogress .bar{
2 | background: #d54d36;
3 | }
--------------------------------------------------------------------------------
/tsconfig-aot.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": [
4 | "modules"
5 | ],
6 | "exclude": [
7 | "aot-dist",
8 | "**/*-aot.ts"
9 | ],
10 | "compilerOptions": {
11 | "outDir": "aot-dist"
12 | },
13 | "angularCompilerOptions": {
14 | "genDir": "aot",
15 | "skipMetadataEmit": false
16 | }
17 | }
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "es2015",
5 | "declaration": false,
6 | "moduleResolution": "node",
7 | "emitDecoratorMetadata": true,
8 | "experimentalDecorators": true,
9 | "noImplicitAny": false,
10 | "suppressImplicitAnyIndexErrors": true,
11 | "sourceMap": false,
12 | "noEmitOnError": true,
13 | "traceResolution": false,
14 | "lib": [
15 | "dom",
16 | "es2017"
17 | ],
18 | "typeRoots": [
19 | "node_modules/@types"
20 | ],
21 | "types": [
22 | "node"
23 | ]
24 | },
25 | "include": [
26 | "src",
27 | "module",
28 | "types"
29 | ],
30 | "exclude": [
31 | "*-aot.ts",
32 | "node_modules",
33 | "docs",
34 | "aot",
35 | "aot-dist"
36 | ],
37 | "awesomeTypescriptLoaderOptions": {
38 | "forkChecker": true,
39 | "useWebpackText": true
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "class-name": true,
4 | "comment-format": [
5 | true,
6 | "check-space"
7 | ],
8 | "curly": true,
9 | "eofline": true,
10 | "forin": true,
11 | "indent": [
12 | true,
13 | "spaces"
14 | ],
15 | "label-position": true,
16 | "max-line-length": [
17 | true,
18 | 140
19 | ],
20 | "member-access": false,
21 | "no-arg": true,
22 | "no-bitwise": true,
23 | "no-console": [
24 | true,
25 | "debug",
26 | "info",
27 | "time",
28 | "timeEnd",
29 | "trace"
30 | ],
31 | "no-construct": true,
32 | "no-debugger": true,
33 | "no-duplicate-variable": true,
34 | "no-empty": false,
35 | "no-eval": true,
36 | "no-inferrable-types": true,
37 | "no-shadowed-variable": true,
38 | "no-string-literal": false,
39 | "no-switch-case-fall-through": true,
40 | "no-trailing-whitespace": true,
41 | "no-unused-expression": true,
42 | "no-use-before-declare": true,
43 | "no-var-keyword": true,
44 | "object-literal-sort-keys": false,
45 | "one-line": [
46 | true,
47 | "check-open-brace",
48 | "check-catch",
49 | "check-else",
50 | "check-whitespace"
51 | ],
52 | "quotemark": [
53 | true,
54 | "single"
55 | ],
56 | "radix": true,
57 | "semicolon": true,
58 | "triple-equals": [
59 | true,
60 | "allow-null-check"
61 | ],
62 | "typedef-whitespace": [
63 | true,
64 | {
65 | "call-signature": "nospace",
66 | "index-signature": "nospace",
67 | "parameter": "nospace",
68 | "property-declaration": "nospace",
69 | "variable-declaration": "nospace"
70 | }
71 | ],
72 | "variable-name": false,
73 | "whitespace": [
74 | true,
75 | "check-branch",
76 | "check-decl",
77 | "check-operator",
78 | "check-separator",
79 | "check-type"
80 | ]
81 | }
82 | }
--------------------------------------------------------------------------------
/types/typing.d.ts:
--------------------------------------------------------------------------------
1 | declare const defineModule: Function;
2 | declare const AppConf: {
3 | modulePath: string;
4 | menuData: Array;
5 | };
6 |
--------------------------------------------------------------------------------