傅行帆 5 年前
父节点
当前提交
e25fbf89a4
共有 30 个文件被更改,包括 18414 次插入0 次删除
  1. 12
    0
      generator_ice/.editorconfig
  2. 15
    0
      generator_ice/.eslintignore
  3. 3
    0
      generator_ice/.eslintrc.js
  4. 23
    0
      generator_ice/.gitignore
  5. 9
    0
      generator_ice/.prettierignore
  6. 3
    0
      generator_ice/.prettierrc.js
  7. 7
    0
      generator_ice/.stylelintignore
  8. 3
    0
      generator_ice/.stylelintrc.js
  9. 61
    0
      generator_ice/README.md
  10. 18
    0
      generator_ice/build.json
  11. 11
    0
      generator_ice/jsconfig.json
  12. 17849
    0
      generator_ice/package-lock.json
  13. 43
    0
      generator_ice/package.json
  14. 二进制
      generator_ice/public/favicon.png
  15. 13
    0
      generator_ice/public/index.html
  16. 二进制
      generator_ice/screenshot.png
  17. 8
    0
      generator_ice/src/app.js
  18. 7
    0
      generator_ice/src/global.scss
  19. 12
    0
      generator_ice/src/layouts/BasicLayout/components/Footer/index.jsx
  20. 13
    0
      generator_ice/src/layouts/BasicLayout/components/Footer/index.module.scss
  21. 14
    0
      generator_ice/src/layouts/BasicLayout/components/Logo/index.jsx
  22. 18
    0
      generator_ice/src/layouts/BasicLayout/components/Logo/index.module.scss
  23. 68
    0
      generator_ice/src/layouts/BasicLayout/components/PageNav/index.jsx
  24. 79
    0
      generator_ice/src/layouts/BasicLayout/index.jsx
  25. 9
    0
      generator_ice/src/layouts/BasicLayout/menuConfig.js
  26. 33
    0
      generator_ice/src/pages/Dashboard/components/Guide/index.jsx
  27. 19
    0
      generator_ice/src/pages/Dashboard/components/Guide/index.module.scss
  28. 15
    0
      generator_ice/src/pages/Dashboard/index.jsx
  29. 16
    0
      generator_ice/src/routes.js
  30. 33
    0
      generator_ice/tsconfig.json

+ 12
- 0
generator_ice/.editorconfig 查看文件

@@ -0,0 +1,12 @@
1
+# http://editorconfig.org
2
+root = true
3
+
4
+[*]
5
+indent_style = space
6
+indent_size = 2
7
+charset = utf-8
8
+trim_trailing_whitespace = true
9
+insert_final_newline = true
10
+
11
+[*.md]
12
+trim_trailing_whitespace = false

+ 15
- 0
generator_ice/.eslintignore 查看文件

@@ -0,0 +1,15 @@
1
+# 忽略目录
2
+build/
3
+tests/
4
+demo/
5
+.ice/
6
+
7
+# node 覆盖率文件
8
+coverage/
9
+
10
+# 忽略文件
11
+**/*-min.js
12
+**/*.min.js
13
+
14
+package-lock.json
15
+yarn.lock

+ 3
- 0
generator_ice/.eslintrc.js 查看文件

@@ -0,0 +1,3 @@
1
+const { eslint } = require('@ice/spec');
2
+
3
+module.exports = eslint;

+ 23
- 0
generator_ice/.gitignore 查看文件

@@ -0,0 +1,23 @@
1
+# See https://help.github.com/ignore-files/ for more about ignoring files.
2
+
3
+# dependencies
4
+node_modules/
5
+
6
+# production
7
+build/
8
+dist/
9
+tmp/
10
+lib/
11
+
12
+# misc
13
+.idea/
14
+.happypack
15
+.DS_Store
16
+*.swp
17
+*.dia~
18
+.ice
19
+
20
+npm-debug.log*
21
+yarn-debug.log*
22
+yarn-error.log*
23
+index.module.scss.d.ts

+ 9
- 0
generator_ice/.prettierignore 查看文件

@@ -0,0 +1,9 @@
1
+build/
2
+tests/
3
+demo/
4
+.ice/
5
+coverage/
6
+**/*-min.js
7
+**/*.min.js
8
+package-lock.json
9
+yarn.lock

+ 3
- 0
generator_ice/.prettierrc.js 查看文件

@@ -0,0 +1,3 @@
1
+const { prettier } = require('@ice/spec');
2
+
3
+module.exports = prettier;

+ 7
- 0
generator_ice/.stylelintignore 查看文件

@@ -0,0 +1,7 @@
1
+# 忽略目录
2
+build/
3
+tests/
4
+demo/
5
+
6
+# node 覆盖率文件
7
+coverage/

+ 3
- 0
generator_ice/.stylelintrc.js 查看文件

@@ -0,0 +1,3 @@
1
+const { stylelint } = require('@ice/spec');
2
+
3
+module.exports = stylelint;

+ 61
- 0
generator_ice/README.md 查看文件

@@ -0,0 +1,61 @@
1
+
2
+## Scaffold Lite - JS
3
+
4
+> 轻量级模板,使用 JavaScript,仅包含基础的 Layout。
5
+
6
+## 使用
7
+
8
+```bash
9
+# 安装依赖
10
+$ npm install
11
+
12
+# 启动服务
13
+$ npm start  # visit http://localhost:3333
14
+```
15
+
16
+[More docs](https://ice.work/docs/guide/about).
17
+
18
+## 目录
19
+
20
+```md
21
+├── build/                         # 构建产物
22
+├── mock/                          # 本地模拟数据
23
+│   ├── index.[j,t]s
24
+├── public/
25
+│   ├── index.html                 # 应用入口 HTML
26
+│   └── favicon.png                # Favicon
27
+├── src/                           # 源码路径
28
+│   ├── components/                # 自定义业务组件
29
+│   │   └── Guide/
30
+│   │       ├── index.[j,t]sx
31
+│   │       ├── index.module.scss
32
+│   ├── layouts/                   # 布局组件
33
+│   │   └── BasicLayout/
34
+│   │       ├── index.[j,t]sx
35
+│   │       └── index.module.scss
36
+│   ├── pages/                     # 页面
37
+│   │   └── Home/                  # home 页面,约定路由转成小写
38
+│   │       ├── components/        # 页面级自定义业务组件
39
+│   │       ├── models.[j,t]sx     # 页面级数据状态
40
+│   │       ├── index.[j,t]sx      # 页面入口
41
+│   │       └── index.module.scss  # 页面样式文件
42
+│   ├── configs/                   # [可选] 配置文件
43
+│   │   └── menu.[j,t]s            # [可选] 菜单配置
44
+│   ├── models/                    # [可选] 应用级数据状态
45
+│   │   └── user.[j,t]s
46
+│   ├── utils/                     # [可选] 工具库
47
+│   ├── global.scss                # 全局样式
48
+│   ├── routes.[j,t]s              # 路由配置
49
+│   └── app.[j,t]s[x]              # 应用入口脚本
50
+├── build.json                     # 工程配置
51
+├── README.md
52
+├── package.json
53
+├── .editorconfig
54
+├── .eslintignore
55
+├── .eslintrc.[j,t]s
56
+├── .gitignore
57
+├── .stylelintignore
58
+├── .stylelintrc.[j,t]s
59
+├── .gitignore
60
+└── [j,t]sconfig.json
61
+```

+ 18
- 0
generator_ice/build.json 查看文件

@@ -0,0 +1,18 @@
1
+{
2
+  "plugins": [
3
+    [
4
+      "build-plugin-fusion",
5
+      {
6
+        "themePackage": "@alifd/theme-design-pro"
7
+      }
8
+    ],
9
+    [
10
+      "build-plugin-moment-locales",
11
+      {
12
+        "locales": [
13
+          "zh-cn"
14
+        ]
15
+      }
16
+    ]
17
+  ]
18
+}

+ 11
- 0
generator_ice/jsconfig.json 查看文件

@@ -0,0 +1,11 @@
1
+{
2
+  "compilerOptions": {
3
+    "baseUrl": ".",
4
+    "jsx": "react",
5
+    "paths": {
6
+      "@/*": ["./src/*"],
7
+      "ice": [".ice/index.ts"],
8
+      "ice/*": [".ice/pages/*"]
9
+    }
10
+  }
11
+}

+ 17849
- 0
generator_ice/package-lock.json
文件差异内容过多而无法显示
查看文件


+ 43
- 0
generator_ice/package.json 查看文件

@@ -0,0 +1,43 @@
1
+{
2
+  "name": "@alifd/scaffold-lite-js",
3
+  "version": "0.1.6",
4
+  "description": "轻量级模板,使用 JavaScript,仅包含基础的 Layout。",
5
+  "dependencies": {
6
+    "@alifd/next": "^1.19.4",
7
+    "moment": "^2.24.0",
8
+    "react": "^16.4.1",
9
+    "react-dom": "^16.4.1",
10
+    "@alifd/theme-design-pro": "^0.x"
11
+  },
12
+  "devDependencies": {
13
+    "@ice/spec": "^1.0.0",
14
+    "build-plugin-fusion": "^0.1.0",
15
+    "build-plugin-moment-locales": "^0.1.0",
16
+    "eslint": "^6.0.1",
17
+    "ice.js": "^1.0.0",
18
+    "stylelint": "^13.2.0"
19
+  },
20
+  "scripts": {
21
+    "start": "icejs start",
22
+    "build": "icejs build",
23
+    "lint": "npm run eslint && npm run stylelint",
24
+    "eslint": "eslint --cache --ext .js,.jsx ./",
25
+    "stylelint": "stylelint ./**/*.scss"
26
+  },
27
+  "ideMode": {
28
+    "name": "ice-react"
29
+  },
30
+  "iceworks": {
31
+    "type": "react",
32
+    "adapter": "adapter-react-v3"
33
+  },
34
+  "engines": {
35
+    "node": ">=8.0.0"
36
+  },
37
+  "repository": {
38
+    "type": "git",
39
+    "url": "https://github.com/alibaba-fusion/materials/tree/master/scaffolds/scaffold-lite-js"
40
+  },
41
+  "private": true,
42
+  "originTemplate": "@alifd/scaffold-lite-js"
43
+}

二进制
generator_ice/public/favicon.png 查看文件


+ 13
- 0
generator_ice/public/index.html 查看文件

@@ -0,0 +1,13 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <meta charset="utf-8" />
5
+    <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
6
+    <meta name="viewport" content="width=device-width" />
7
+    <title>Scaffold Lite - JS</title>
8
+  </head>
9
+
10
+  <body>
11
+    <div id="ice-container"></div>
12
+  </body>
13
+</html>

二进制
generator_ice/screenshot.png 查看文件


+ 8
- 0
generator_ice/src/app.js 查看文件

@@ -0,0 +1,8 @@
1
+import { createApp } from 'ice';
2
+
3
+const appConfig = {
4
+  app: {
5
+    rootId: 'ice-container',
6
+  },
7
+};
8
+createApp(appConfig);

+ 7
- 0
generator_ice/src/global.scss 查看文件

@@ -0,0 +1,7 @@
1
+// 引入默认全局样式
2
+@import '@alifd/next/reset.scss';
3
+
4
+body {
5
+  -webkit-font-smoothing: antialiased;
6
+}
7
+

+ 12
- 0
generator_ice/src/layouts/BasicLayout/components/Footer/index.jsx 查看文件

@@ -0,0 +1,12 @@
1
+import React from 'react';
2
+import styles from './index.module.scss';
3
+
4
+export default function Footer() {
5
+  return (
6
+    <p className={styles.footer}>
7
+      <span className={styles.logo}>Alibaba Fusion</span>
8
+      <br />
9
+      <span className={styles.copyright}>© 2019-现在 Alibaba Fusion & ICE</span>
10
+    </p>
11
+  );
12
+}

+ 13
- 0
generator_ice/src/layouts/BasicLayout/components/Footer/index.module.scss 查看文件

@@ -0,0 +1,13 @@
1
+.footer {
2
+  line-height: 20px;
3
+  text-align: center;
4
+}
5
+
6
+.logo {
7
+  font-weight: bold;
8
+  font-size: 16px;
9
+}
10
+
11
+.copyright {
12
+  font-size: 12px;
13
+}

+ 14
- 0
generator_ice/src/layouts/BasicLayout/components/Logo/index.jsx 查看文件

@@ -0,0 +1,14 @@
1
+import React from 'react';
2
+import { Link } from 'ice';
3
+import styles from './index.module.scss';
4
+
5
+export default function Logo({ image, text, url }) {
6
+  return (
7
+    <div className="logo">
8
+      <Link to={url || '/'} className={styles.logo}>
9
+        {image && <img src={image} alt="logo" />}
10
+        <span>{text}</span>
11
+      </Link>
12
+    </div>
13
+  );
14
+}

+ 18
- 0
generator_ice/src/layouts/BasicLayout/components/Logo/index.module.scss 查看文件

@@ -0,0 +1,18 @@
1
+.logo{
2
+  display: flex;
3
+  align-items: center;
4
+  justify-content: center;
5
+  color: $color-text1-1;
6
+  font-weight: bold;
7
+  font-size: 14px;
8
+  line-height: 22px;
9
+
10
+  &:visited, &:link {
11
+    color: $color-text1-1;
12
+  }
13
+
14
+  img {
15
+    height: 24px;
16
+    margin-right: 10px;
17
+  }
18
+}

+ 68
- 0
generator_ice/src/layouts/BasicLayout/components/PageNav/index.jsx 查看文件

@@ -0,0 +1,68 @@
1
+import React from 'react';
2
+import PropTypes from 'prop-types';
3
+import { Link, withRouter } from 'ice';
4
+import { Nav } from '@alifd/next';
5
+import { asideMenuConfig } from '../../menuConfig';
6
+
7
+const { SubNav } = Nav;
8
+const NavItem = Nav.Item;
9
+
10
+function getNavMenuItems(menusData) {
11
+  if (!menusData) {
12
+    return [];
13
+  }
14
+
15
+  return menusData
16
+    .filter(item => item.name && !item.hideInMenu)
17
+    .map((item, index) => getSubMenuOrItem(item, index));
18
+}
19
+
20
+function getSubMenuOrItem(item, index) {
21
+  if (item.children && item.children.some(child => child.name)) {
22
+    const childrenItems = getNavMenuItems(item.children);
23
+
24
+    if (childrenItems && childrenItems.length > 0) {
25
+      const subNav = (
26
+        <SubNav key={index} icon={item.icon} label={item.name}>
27
+          {childrenItems}
28
+        </SubNav>
29
+      );
30
+      return subNav;
31
+    }
32
+
33
+    return null;
34
+  }
35
+
36
+  const navItem = (
37
+    <NavItem key={item.path} icon={item.icon}>
38
+      <Link to={item.path}>{item.name}</Link>
39
+    </NavItem>
40
+  );
41
+  return navItem;
42
+}
43
+
44
+const Navigation = (props, context) => {
45
+  const { location } = props;
46
+  const { pathname } = location;
47
+  const { isCollapse } = context;
48
+  return (
49
+    <Nav
50
+      type="primary"
51
+      selectedKeys={[pathname]}
52
+      defaultSelectedKeys={[pathname]}
53
+      embeddable
54
+      openMode="single"
55
+      iconOnly={isCollapse}
56
+      hasArrow={false}
57
+      mode={isCollapse ? 'popup' : 'inline'}
58
+    >
59
+      {getNavMenuItems(asideMenuConfig)}
60
+    </Nav>
61
+  );
62
+};
63
+
64
+Navigation.contextTypes = {
65
+  isCollapse: PropTypes.bool,
66
+};
67
+const PageNav = withRouter(Navigation);
68
+export default PageNav;

+ 79
- 0
generator_ice/src/layouts/BasicLayout/index.jsx 查看文件

@@ -0,0 +1,79 @@
1
+import React, { useState } from 'react';
2
+import { Shell, ConfigProvider } from '@alifd/next';
3
+import PageNav from './components/PageNav';
4
+import Logo from './components/Logo';
5
+import Footer from './components/Footer';
6
+
7
+(function() {
8
+  const throttle = function(type, name, obj = window) {
9
+    let running = false;
10
+
11
+    const func = () => {
12
+      if (running) {
13
+        return;
14
+      }
15
+
16
+      running = true;
17
+      requestAnimationFrame(() => {
18
+        obj.dispatchEvent(new CustomEvent(name));
19
+        running = false;
20
+      });
21
+    };
22
+
23
+    obj.addEventListener(type, func);
24
+  };
25
+
26
+  throttle('resize', 'optimizedResize');
27
+})();
28
+
29
+export default function BasicLayout({ children }) {
30
+  const getDevice = width => {
31
+    const isPhone =
32
+      typeof navigator !== 'undefined' && navigator && navigator.userAgent.match(/phone/gi);
33
+
34
+    if (width < 680 || isPhone) {
35
+      return 'phone';
36
+    }
37
+    if (width < 1280 && width > 680) {
38
+      return 'tablet';
39
+    }
40
+    return 'desktop';
41
+  };
42
+
43
+  const [device, setDevice] = useState(getDevice(NaN));
44
+  window.addEventListener('optimizedResize', e => {
45
+    setDevice(getDevice(e && e.target && e.target.innerWidth));
46
+  });
47
+  return (
48
+    <ConfigProvider device={device}>
49
+      <Shell
50
+        type="dark"
51
+        style={{
52
+          minHeight: '100vh',
53
+        }}
54
+      >
55
+        <Shell.Branding>
56
+          <Logo
57
+            image="https://img.alicdn.com/tfs/TB1.ZBecq67gK0jSZFHXXa9jVXa-904-826.png"
58
+            text="Logo"
59
+          />
60
+        </Shell.Branding>
61
+        <Shell.Navigation
62
+          direction="hoz"
63
+          style={{
64
+            marginRight: 10,
65
+          }}
66
+        ></Shell.Navigation>
67
+        <Shell.Action></Shell.Action>
68
+        <Shell.Navigation>
69
+          <PageNav />
70
+        </Shell.Navigation>
71
+
72
+        <Shell.Content>{children}</Shell.Content>
73
+        <Shell.Footer>
74
+          <Footer />
75
+        </Shell.Footer>
76
+      </Shell>
77
+    </ConfigProvider>
78
+  );
79
+}

+ 9
- 0
generator_ice/src/layouts/BasicLayout/menuConfig.js 查看文件

@@ -0,0 +1,9 @@
1
+const headerMenuConfig = [];
2
+const asideMenuConfig = [
3
+  {
4
+    name: 'Dashboard',
5
+    path: '/',
6
+    icon: 'smile',
7
+  },
8
+];
9
+export { headerMenuConfig, asideMenuConfig };

+ 33
- 0
generator_ice/src/pages/Dashboard/components/Guide/index.jsx 查看文件

@@ -0,0 +1,33 @@
1
+import * as React from 'react';
2
+import { Button } from '@alifd/next';
3
+import styles from './index.module.scss';
4
+
5
+const Guide = () => (
6
+  <div className={styles.container}>
7
+    <h2 className={styles.title}>Welcome to icejs!</h2>
8
+
9
+    <p className={styles.description}>This is a awesome project, enjoy it!</p>
10
+
11
+    <div className={styles.action}>
12
+      <a
13
+        href="https://ice.work/docs/guide/about"
14
+        target="_blank"
15
+        rel="noopener noreferrer"
16
+        style={{
17
+          marginRight: 20,
18
+        }}
19
+      >
20
+        <Button type="primary" size="large">
21
+          使用文档
22
+        </Button>
23
+      </a>
24
+      <a href="https://github.com/ice-lab/icejs" target="_blank" rel="noopener noreferrer">
25
+        <Button type="secondary" size="large">
26
+          GitHub
27
+        </Button>
28
+      </a>
29
+    </div>
30
+  </div>
31
+);
32
+
33
+export default Guide;

+ 19
- 0
generator_ice/src/pages/Dashboard/components/Guide/index.module.scss 查看文件

@@ -0,0 +1,19 @@
1
+.container {
2
+  min-height: 600px;
3
+  overflow: hidden;
4
+  text-align: center;
5
+  background-color: $color-white;
6
+}
7
+
8
+.title {
9
+  font-size: 40px;
10
+  text-align: center;
11
+}
12
+
13
+.description {
14
+  margin-top: 40px;
15
+}
16
+
17
+.action {
18
+  margin-top: 40px;
19
+}

+ 15
- 0
generator_ice/src/pages/Dashboard/index.jsx 查看文件

@@ -0,0 +1,15 @@
1
+import React from 'react';
2
+import { ResponsiveGrid } from '@alifd/next';
3
+import Guide from './components/Guide';
4
+
5
+const { Cell } = ResponsiveGrid;
6
+
7
+const Dashboard = () => (
8
+  <ResponsiveGrid gap={20}>
9
+    <Cell colSpan={12}>
10
+      <Guide />
11
+    </Cell>
12
+  </ResponsiveGrid>
13
+);
14
+
15
+export default Dashboard;

+ 16
- 0
generator_ice/src/routes.js 查看文件

@@ -0,0 +1,16 @@
1
+import BasicLayout from '@/layouts/BasicLayout';
2
+import Dashboard from '@/pages/Dashboard';
3
+
4
+const routerConfig = [
5
+  {
6
+    path: '/',
7
+    component: BasicLayout,
8
+    children: [
9
+      {
10
+        path: '/',
11
+        component: Dashboard,
12
+      },
13
+    ],
14
+  },
15
+];
16
+export default routerConfig;

+ 33
- 0
generator_ice/tsconfig.json 查看文件

@@ -0,0 +1,33 @@
1
+{
2
+  "compileOnSave": false,
3
+  "buildOnSave": false,
4
+  "compilerOptions": {
5
+    "baseUrl": ".",
6
+    "outDir": "build",
7
+    "module": "esnext",
8
+    "target": "es6",
9
+    "jsx": "react",
10
+    "moduleResolution": "node",
11
+    "allowSyntheticDefaultImports": true,
12
+    "lib": ["es6", "dom"],
13
+    "sourceMap": true,
14
+    "allowJs": true,
15
+    "rootDir": "./",
16
+    "forceConsistentCasingInFileNames": true,
17
+    "noImplicitReturns": true,
18
+    "noImplicitThis": true,
19
+    "noImplicitAny": false,
20
+    "importHelpers": true,
21
+    "strictNullChecks": true,
22
+    "suppressImplicitAnyIndexErrors": true,
23
+    "noUnusedLocals": true,
24
+    "skipLibCheck": true,
25
+    "paths": {
26
+      "@/*": ["./src/*"],
27
+      "ice": [".ice/index.ts"],
28
+      "ice/*": [".ice/pages/*"]
29
+    }
30
+  },
31
+  "include": ["src/*", ".ice"],
32
+  "exclude": ["node_modules", "build", "public"]
33
+}