diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..76d0271 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{js,ts,jsx,tsx}] +indent_size = 4 + +[*.{less,html,ejs}] +indent_size = 2 + +[*.json] +indent_size = 2 + +[tsconfig.json] +indent_size = 4 diff --git a/.eslintignore b/.eslintignore index e401845..c94e368 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ types -node_modules/ -dist/ -assets/ \ No newline at end of file +node_modules +dist +assets +docs diff --git a/.eslintrc b/.eslintrc index 63e374d..3a3ff31 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,8 +1,47 @@ + { - "extends": "plugin:@fui/typescript", + "env": { + "browser": true, + "node": true, + "es6": true, + "jest/globals": true + }, + "plugins": ["jest", "react"], + "extends": ["plugin:@fui/typescript", "plugin:@fui/prettier"], "parserOptions": { "ecmaFeatures": { - "legacyDecorators": true + "legacyDecorators": true, + "jsx": true } - } -} \ No newline at end of file + }, + "rules": { + // 由于prettier和eslint一起使用需要关闭一些规则,但是prettier没有以下规则的配置,统一写在这里 + // 对象字面量简写语法 + "object-shorthand": ["error", "always"], + // 函数体在必要的时候使用大括号 + "arrow-body-style": [ + "error", + "as-needed", + { + "requireReturnForObjectLiteral": true + } + ], + // 回调使用用箭头函数 + "prefer-arrow-callback": "error", + // 如果 if 块中包含了一个 return 语句,else 块就成了多余的了。可以将其内容移至块外 + "no-else-return": "error", + "no-use-before-define": "off", + + "react/jsx-uses-react": "error", + "react/jsx-uses-vars": "error" + }, + "overrides": [ + { + "files": ["*.ts", "*.tsx"], + "rules": { + "no-undef": "off", + "no-unused-vars": "off" + } + } + ] +} diff --git a/.gitignore b/.gitignore index 9719d54..ea883ba 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,7 @@ crashlytics.properties crashlytics-build.properties /node_modules/ + +/dist package-lock.json -yarn.lock -/dist \ No newline at end of file +yarn.lock \ No newline at end of file diff --git a/.npmrc b/.npmrc index 21e56c3..ee99b80 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ +registry=https://registry.npm.taobao.org @fui:registry=https://npm.fineres.com/ \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c94e368 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +types +node_modules +dist +assets +docs diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..7bb8fe5 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "singleQuote": true, + "arrowParens": "avoid", + "printWidth": 160 +} diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 0000000..c94e368 --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,5 @@ +types +node_modules +dist +assets +docs diff --git a/.stylelintrc b/.stylelintrc new file mode 100644 index 0000000..c671fba --- /dev/null +++ b/.stylelintrc @@ -0,0 +1,7 @@ +{ + "extends": ["stylelint-config-standard", "stylelint-prettier/recommended"], + "rules": { + "no-descending-specificity": null, + "selector-pseudo-element-colon-notation": "single" + } +} diff --git a/README.md b/README.md index dde098a..427ed9f 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,63 @@ -# FineUI-Start +# README -## 安装运行 -`git clone --recursive https://git.fanruan.com/dailer/FineUI-Start.git` +## 准备工作 -## 安装依赖 -`yarn install` +### 克隆仓库 -## 打开dev模式 -`yarn start` +```shell +git clone https://code.fineres.com/scm/fui/fineui-starter.git +``` -## 打包 -`yarn build` +### 安装依赖 -## 示例效果 -![](./screenshorts/todolist.gif) \ No newline at end of file +```shell +# 账户:public +# 密码:fr123456 +# 邮箱:任意 +npm adduser --registry https://npm.fineres.com +npm install +``` + +### 安装扩展 + +以 VSCode 为例,为保证代码规范和格式统一,请安装`ESLint`、`stylelint`、`Prettier`、`EditorConfig`扩展,以使相关配置文件生效。 + +## 开发工作 + +### 项目基础配置 + +布局配置请见`src/modules/app/layout/layout.constant.ts`。 + +样式配置请见`src/less/`,譬如`src/less/lib/constant`中的`@color-app-primary`表示项目的主色。 + +### 项目调试、打包与测试 + +```shell +# 调试 +npm run start + +# 打包 +npm run build + +# 测试 +npm run test +``` + +### 项目规范和格式检查 + +```shell +# 代码规范 +npm run eslint +npm run eslint:fix + +# 样式规范 +npm run stylelint +npm run stylelint:fix + +# 代码格式 +npm run prettier +``` + +## 效果预览 + +![页面截图](./screenshots/demo.jpeg) diff --git a/advance.html b/advance.html deleted file mode 100644 index 2e85732..0000000 --- a/advance.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - -
- - - - - - - - \ No newline at end of file diff --git a/assets/images/1x/logo.png b/assets/images/1x/logo.png new file mode 100644 index 0000000..11baaa1 Binary files /dev/null and b/assets/images/1x/logo.png differ diff --git a/assets/images/2x/logo.png b/assets/images/2x/logo.png new file mode 100644 index 0000000..17f645e Binary files /dev/null and b/assets/images/2x/logo.png differ diff --git a/babel.config.js b/babel.config.js index 6cf5fff..12cd09e 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1 +1 @@ -module.exports = require('@fui/babel-preset-fineui').configs.ie8; +module.exports = require('@fui/babel-preset-fineui').configs.base; diff --git a/dist/bundle.css b/dist/bundle.css deleted file mode 100644 index 456246a..0000000 --- a/dist/bundle.css +++ /dev/null @@ -1,36 +0,0 @@ -/** - 列表项的less,其中用到了部分FineUI提供的字号,颜色常量,还有border-radius,box-shadow方法等.请选择性使用.不强制要求 - */ -.my-todolist-header { - background-color: #3d4d66; -} -.my-todolist-header .my-todolist-title { - font-size: 22px; - color: #FFF; -} -.my-todolist-header .my-todolist-header-editor { - background-color: #FFF; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; -} -/** - 列表项的less,其中用到了部分FineUI提供的字号,颜色常量,还有border-radius方法等.请选择性使用.不强制要求 - */ -.my-todolist-list .my-todolist-list-text { - font-size: 16px; - font-weight: bold; -} -.my-todolist-list .my-todolist-list-count-container { - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - border-radius: 10px; - background-color: #3d4d66; - color: #ffffff; -} -/** - 列表项的less,其中用到了部分FineUI提供的字号,颜色常量,还有border-radius,box-shadow方法等.请选择性使用.不强制要求 - */ -.my-todolist-background { - background-color: #f7f8fa; -} diff --git a/dist/bundle.js b/dist/bundle.js deleted file mode 100644 index c7db7c3..0000000 --- a/dist/bundle.js +++ /dev/null @@ -1,286 +0,0 @@ -!(function() { - /** - * 顶部组件,提供输入框添加todo项目 - * 布局: bi.horizontal_auto 实现水平居中. bi.left_right_vertical_adapt 实现标题是输入框的靠左靠右垂直居中 - */ - var ToDoListHeader = BI.inherit(BI.Widget, { - - props: { - // 指定组件的className - baseCls: "my-todolist-header" - }, - - render: function() { - var self = this, o = this.options; - return { - type: "bi.horizontal_auto", // 水平居中布局 - items: [ - { - el: { - type: "bi.left_right_vertical_adapt", // 左右垂直居中布局 - width: 600, - height: o.height, - items: { - left: [ - { - el: { - type: "bi.label", - cls: "my-todolist-title", - text: "FineUI ToDoList", - height: o.height - } - } - ], - right: [ - { - el: { - type: "bi.editor", - ref: function(_ref) { - self.editor = _ref; - }, - allowBlank: true, - cls: "my-todolist-header-editor", - watermark: "添加ToDo", - width: 300, - height: 24, - listeners: [ - { // 监听bi.editor 组件的"EVENT_ENTER"事件(即敲回车),触发事件ToDoListHeader.EVENT_ADD事件并将输入框值置空 - eventName: "EVENT_ENTER", - action: function() { - // 注意:在这里this指向的是bi.editor的实例.通过bi.editor的getValue()方法获取输入框输入值. - self.fireEvent(ToDoListHeader.EVENT_ADD, this.getValue()); - self.editor.setValue(""); - } - } - ] - } - } - ] - } - } - } - ] - }; - } - }); - - ToDoListHeader.EVENT_ADD = "EVENT_ADD"; - - BI.shortcut("my.todolist.header", ToDoListHeader); -})();!(function() { - /** - * todo项列表 - * - */ - var List = BI.inherit(BI.Widget, { - - props: { - // 指定组件的className - baseCls: "my-todolist-list", - text: "正在进行" - }, - - render: function() { - var self = this, o = this.options; - return { - type: "bi.vertical", - items: [ - { - el: { - type: "bi.vertical_adapt", - height: 40, - items: [ - { - type: "bi.label", - cls: "my-todolist-list-text", - textAlign: "left", - text: o.text, - width: 580 - }, { - type: "bi.center_adapt", - cls: "my-todolist-list-count-container", - width: 20, - height: 20, - items: [ - { - el: { - type: "bi.label", - ref: function(_ref) { - self.count = _ref; - }, - text: "0" - } - } - ] - } - ] - } - }, { // 用bi.vertical布局作为列表项的容器. - type: "bi.vertical", - vgap: 10, - ref: function(_ref) { - self.list = _ref; - }, - items: this._createItems(o.items) - } - ] - }; - }, - - _createItems: function(items) { - var self = this; - return BI.map(items, function(index, item) { - return BI.extend(item, { - type: "bi.multi_select_item", // 节点采用复选节点展示 - selected: item.done, // 已完成的todo项置为选中状态 - disabled: item.done, // 已完成的todo项置为灰化状态 - listeners: [ - { // 为每个todo项添加"EVENT_CHANGE"事件监听,触发组件自身"EVENT_CHANGE"事件 - eventName: "EVENT_CHANGE", - action: function(v) { - self.fireEvent("EVENT_CHANGE", v); - } - } - ] - }); - }); - }, - - _setCount: function(count) { - this.count.setText(count); - }, - - populate: function(items) { - this.list.populate(this._createItems(items)); - this._setCount(items.length); - } - }); - BI.shortcut("my.todolist.list", List); -})();!(function() { - /** - * todolist 组件 - */ - var ToDoList = BI.inherit(BI.Widget, { - - props: { - baseCls: "fine-to-do-list" - }, - - // 生命周期函数,在组件创建前 - beforeCreate: function() { - // 初始化存储数据 - this.list = localStorage.getItem("fine-todolist") ? JSON.parse(localStorage.getItem("fine-todolist")) : []; - }, - - render: function() { - var self = this, o = this.options; - return { - type: "bi.vtape", // vtape布局,顶部高度固定,下部分列表占满高度 - items: [ - { - el: { - type: "my.todolist.header", // 顶部组件 - listeners: [ - { // 监听组件的EVENT_ADD事件,新建todo项 - eventName: "EVENT_ADD", - action: function(v) { - self.addToDo(v); - } - } - ], - height: 40 - }, - height: 40 - }, { - type: "bi.horizontal_auto", // 水平居中布局 - cls: "my-todolist-background", // 添加className - items: [ - { - el: { - type: "my.todolist.list", // need todo项列表 - ref: function(_ref) { - self.todolist = _ref; - }, - items: this._getNeedTodoList(), - text: "正在进行", - listeners: [ - { // 监听EVENT_CHANGE事件,完成某一项todo - eventName: "EVENT_CHANGE", - action: function(v) { - self.finishTodo(v); - } - } - ], - width: 600 - } - }, { - el: { - type: "my.todolist.list", // 已经完成的todo项列表 - text: "已经完成", - items: this._getAlreadyDoneList(), - ref: function(_ref) { - self.donelist = _ref; - }, - width: 600 - } - } - ] - } - ] - }; - }, - - _updateLocalStorage: function() { - localStorage.setItem("fine-todolist", JSON.stringify(this.list)); - }, - - _getNeedTodoList: function() { - return BI.filter(this.list, function(index, item) { - return !item.done; - }); - }, - - _getAlreadyDoneList: function() { - return BI.filter(this.list, function(index, item) { - return item.done; - }); - }, - - /** - * 添加todo项 - * @param text todo项的内容 - */ - addToDo: function(text) { - this.list.push({ - value: BI.UUID(), - text: text, - done: false - }); - this.todolist.populate(this._getNeedTodoList()); - this._updateLocalStorage(); - }, - - /** - * 完成某一项todo - * @param v todo项的value - */ - finishTodo: function(v) { - BI.some(this.list, function(index, item) { - if (item.value === v) { - item.done = true; - } - }); - this.todolist.populate(this._getNeedTodoList()); - this.donelist.populate(this._getAlreadyDoneList()); - this._updateLocalStorage(); - } - }); - BI.shortcut("my.todolist", ToDoList); -})(); -!(function () { - // 将todolist组件挂载到#wrapper上. - BI.createWidget({ - type: "my.todolist", - element: "#wrapper" - }); -})(); diff --git a/dist/font/iconfont.eot b/dist/font/iconfont.eot deleted file mode 100644 index 693b5dc..0000000 Binary files a/dist/font/iconfont.eot and /dev/null differ diff --git a/dist/font/iconfont.svg b/dist/font/iconfont.svg deleted file mode 100644 index 973571d..0000000 --- a/dist/font/iconfont.svg +++ /dev/null @@ -1,1002 +0,0 @@ - - - - - -Created by iconfont - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dist/font/iconfont.ttf b/dist/font/iconfont.ttf deleted file mode 100644 index e62143d..0000000 Binary files a/dist/font/iconfont.ttf and /dev/null differ diff --git a/dist/font/iconfont.woff b/dist/font/iconfont.woff deleted file mode 100644 index 9c9686c..0000000 Binary files a/dist/font/iconfont.woff and /dev/null differ diff --git a/dist/images/1x/background/auto_color.png b/dist/images/1x/background/auto_color.png deleted file mode 100644 index 63b3edf..0000000 Binary files a/dist/images/1x/background/auto_color.png and /dev/null differ diff --git a/dist/images/1x/background/line_conn.gif b/dist/images/1x/background/line_conn.gif deleted file mode 100644 index d561d36..0000000 Binary files a/dist/images/1x/background/line_conn.gif and /dev/null differ diff --git a/dist/images/1x/background/marker.png b/dist/images/1x/background/marker.png deleted file mode 100644 index 3929bbb..0000000 Binary files a/dist/images/1x/background/marker.png and /dev/null differ diff --git a/dist/images/1x/background/mask.png b/dist/images/1x/background/mask.png deleted file mode 100644 index b0a4d40..0000000 Binary files a/dist/images/1x/background/mask.png and /dev/null differ diff --git a/dist/images/1x/background/trans_color.png b/dist/images/1x/background/trans_color.png deleted file mode 100644 index 8fa4492..0000000 Binary files a/dist/images/1x/background/trans_color.png and /dev/null differ diff --git a/dist/images/1x/background/wheel.png b/dist/images/1x/background/wheel.png deleted file mode 100644 index 97b343d..0000000 Binary files a/dist/images/1x/background/wheel.png and /dev/null differ diff --git a/dist/images/1x/icon/check_box_active.png b/dist/images/1x/icon/check_box_active.png deleted file mode 100644 index af54808..0000000 Binary files a/dist/images/1x/icon/check_box_active.png and /dev/null differ diff --git a/dist/images/1x/icon/check_box_disable.png b/dist/images/1x/icon/check_box_disable.png deleted file mode 100644 index bb7f451..0000000 Binary files a/dist/images/1x/icon/check_box_disable.png and /dev/null differ diff --git a/dist/images/1x/icon/check_box_disable2.png b/dist/images/1x/icon/check_box_disable2.png deleted file mode 100644 index fb593ff..0000000 Binary files a/dist/images/1x/icon/check_box_disable2.png and /dev/null differ diff --git a/dist/images/1x/icon/check_box_normal.png b/dist/images/1x/icon/check_box_normal.png deleted file mode 100644 index 2974ad7..0000000 Binary files a/dist/images/1x/icon/check_box_normal.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_collapse_1.png b/dist/images/1x/icon/dark/tree_collapse_1.png deleted file mode 100644 index 583c00f..0000000 Binary files a/dist/images/1x/icon/dark/tree_collapse_1.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_collapse_2.png b/dist/images/1x/icon/dark/tree_collapse_2.png deleted file mode 100644 index 083529b..0000000 Binary files a/dist/images/1x/icon/dark/tree_collapse_2.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_collapse_3.png b/dist/images/1x/icon/dark/tree_collapse_3.png deleted file mode 100644 index cc3d25c..0000000 Binary files a/dist/images/1x/icon/dark/tree_collapse_3.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_collapse_4.png b/dist/images/1x/icon/dark/tree_collapse_4.png deleted file mode 100644 index d599e57..0000000 Binary files a/dist/images/1x/icon/dark/tree_collapse_4.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_expand_1.png b/dist/images/1x/icon/dark/tree_expand_1.png deleted file mode 100644 index 76c5863..0000000 Binary files a/dist/images/1x/icon/dark/tree_expand_1.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_expand_2.png b/dist/images/1x/icon/dark/tree_expand_2.png deleted file mode 100644 index 53063e7..0000000 Binary files a/dist/images/1x/icon/dark/tree_expand_2.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_expand_3.png b/dist/images/1x/icon/dark/tree_expand_3.png deleted file mode 100644 index 0f35d6e..0000000 Binary files a/dist/images/1x/icon/dark/tree_expand_3.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_expand_4.png b/dist/images/1x/icon/dark/tree_expand_4.png deleted file mode 100644 index 4752f81..0000000 Binary files a/dist/images/1x/icon/dark/tree_expand_4.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_vertical_line_1.png b/dist/images/1x/icon/dark/tree_vertical_line_1.png deleted file mode 100644 index d13fc8d..0000000 Binary files a/dist/images/1x/icon/dark/tree_vertical_line_1.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_vertical_line_2.png b/dist/images/1x/icon/dark/tree_vertical_line_2.png deleted file mode 100644 index ebee980..0000000 Binary files a/dist/images/1x/icon/dark/tree_vertical_line_2.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_vertical_line_3.png b/dist/images/1x/icon/dark/tree_vertical_line_3.png deleted file mode 100644 index d2f7595..0000000 Binary files a/dist/images/1x/icon/dark/tree_vertical_line_3.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_vertical_line_4.png b/dist/images/1x/icon/dark/tree_vertical_line_4.png deleted file mode 100644 index 277d0e5..0000000 Binary files a/dist/images/1x/icon/dark/tree_vertical_line_4.png and /dev/null differ diff --git a/dist/images/1x/icon/dark/tree_vertical_line_5.png b/dist/images/1x/icon/dark/tree_vertical_line_5.png deleted file mode 100644 index 85aa1cc..0000000 Binary files a/dist/images/1x/icon/dark/tree_vertical_line_5.png and /dev/null differ diff --git a/dist/images/1x/icon/dots.png b/dist/images/1x/icon/dots.png deleted file mode 100644 index 55b461b..0000000 Binary files a/dist/images/1x/icon/dots.png and /dev/null differ diff --git a/dist/images/1x/icon/half_selected.png b/dist/images/1x/icon/half_selected.png deleted file mode 100644 index 298dd91..0000000 Binary files a/dist/images/1x/icon/half_selected.png and /dev/null differ diff --git a/dist/images/1x/icon/icon_down_arrow.png b/dist/images/1x/icon/icon_down_arrow.png deleted file mode 100644 index b77c330..0000000 Binary files a/dist/images/1x/icon/icon_down_arrow.png and /dev/null differ diff --git a/dist/images/1x/icon/loading.gif b/dist/images/1x/icon/loading.gif deleted file mode 100644 index d04fdd2..0000000 Binary files a/dist/images/1x/icon/loading.gif and /dev/null differ diff --git a/dist/images/1x/icon/push_down.png b/dist/images/1x/icon/push_down.png deleted file mode 100644 index 7eb88eb..0000000 Binary files a/dist/images/1x/icon/push_down.png and /dev/null differ diff --git a/dist/images/1x/icon/push_up.png b/dist/images/1x/icon/push_up.png deleted file mode 100644 index a3042a4..0000000 Binary files a/dist/images/1x/icon/push_up.png and /dev/null differ diff --git a/dist/images/1x/icon/radio_active.png b/dist/images/1x/icon/radio_active.png deleted file mode 100644 index 7b2ee27..0000000 Binary files a/dist/images/1x/icon/radio_active.png and /dev/null differ diff --git a/dist/images/1x/icon/radio_disable.png b/dist/images/1x/icon/radio_disable.png deleted file mode 100644 index c0389fd..0000000 Binary files a/dist/images/1x/icon/radio_disable.png and /dev/null differ diff --git a/dist/images/1x/icon/radio_disable2.png b/dist/images/1x/icon/radio_disable2.png deleted file mode 100644 index f5a71f3..0000000 Binary files a/dist/images/1x/icon/radio_disable2.png and /dev/null differ diff --git a/dist/images/1x/icon/radio_normal.png b/dist/images/1x/icon/radio_normal.png deleted file mode 100644 index 2388bb8..0000000 Binary files a/dist/images/1x/icon/radio_normal.png and /dev/null differ diff --git a/dist/images/1x/icon/slider_active.png b/dist/images/1x/icon/slider_active.png deleted file mode 100644 index a84164f..0000000 Binary files a/dist/images/1x/icon/slider_active.png and /dev/null differ diff --git a/dist/images/1x/icon/slider_active_small.png b/dist/images/1x/icon/slider_active_small.png deleted file mode 100644 index 1c29cec..0000000 Binary files a/dist/images/1x/icon/slider_active_small.png and /dev/null differ diff --git a/dist/images/1x/icon/slider_normal.png b/dist/images/1x/icon/slider_normal.png deleted file mode 100644 index 8a611ff..0000000 Binary files a/dist/images/1x/icon/slider_normal.png and /dev/null differ diff --git a/dist/images/1x/icon/slider_normal_small.png b/dist/images/1x/icon/slider_normal_small.png deleted file mode 100644 index 7bd6fc7..0000000 Binary files a/dist/images/1x/icon/slider_normal_small.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_collapse_1.png b/dist/images/1x/icon/tree_collapse_1.png deleted file mode 100644 index dfc427e..0000000 Binary files a/dist/images/1x/icon/tree_collapse_1.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_collapse_2.png b/dist/images/1x/icon/tree_collapse_2.png deleted file mode 100644 index 8db0aa7..0000000 Binary files a/dist/images/1x/icon/tree_collapse_2.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_collapse_3.png b/dist/images/1x/icon/tree_collapse_3.png deleted file mode 100644 index efbbed9..0000000 Binary files a/dist/images/1x/icon/tree_collapse_3.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_collapse_4.png b/dist/images/1x/icon/tree_collapse_4.png deleted file mode 100644 index 743bf8b..0000000 Binary files a/dist/images/1x/icon/tree_collapse_4.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_expand_1.png b/dist/images/1x/icon/tree_expand_1.png deleted file mode 100644 index 914e324..0000000 Binary files a/dist/images/1x/icon/tree_expand_1.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_expand_2.png b/dist/images/1x/icon/tree_expand_2.png deleted file mode 100644 index 95a8af0..0000000 Binary files a/dist/images/1x/icon/tree_expand_2.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_expand_3.png b/dist/images/1x/icon/tree_expand_3.png deleted file mode 100644 index b1c1e94..0000000 Binary files a/dist/images/1x/icon/tree_expand_3.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_expand_4.png b/dist/images/1x/icon/tree_expand_4.png deleted file mode 100644 index 6702029..0000000 Binary files a/dist/images/1x/icon/tree_expand_4.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_vertical_line_1.png b/dist/images/1x/icon/tree_vertical_line_1.png deleted file mode 100644 index d13fc8d..0000000 Binary files a/dist/images/1x/icon/tree_vertical_line_1.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_vertical_line_2.png b/dist/images/1x/icon/tree_vertical_line_2.png deleted file mode 100644 index ebee980..0000000 Binary files a/dist/images/1x/icon/tree_vertical_line_2.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_vertical_line_3.png b/dist/images/1x/icon/tree_vertical_line_3.png deleted file mode 100644 index d2f7595..0000000 Binary files a/dist/images/1x/icon/tree_vertical_line_3.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_vertical_line_4.png b/dist/images/1x/icon/tree_vertical_line_4.png deleted file mode 100644 index 277d0e5..0000000 Binary files a/dist/images/1x/icon/tree_vertical_line_4.png and /dev/null differ diff --git a/dist/images/1x/icon/tree_vertical_line_5.png b/dist/images/1x/icon/tree_vertical_line_5.png deleted file mode 100644 index 85aa1cc..0000000 Binary files a/dist/images/1x/icon/tree_vertical_line_5.png and /dev/null differ diff --git a/dist/images/2x/background/auto_color.png b/dist/images/2x/background/auto_color.png deleted file mode 100644 index fc976e4..0000000 Binary files a/dist/images/2x/background/auto_color.png and /dev/null differ diff --git a/dist/images/2x/background/line_conn.gif b/dist/images/2x/background/line_conn.gif deleted file mode 100644 index d561d36..0000000 Binary files a/dist/images/2x/background/line_conn.gif and /dev/null differ diff --git a/dist/images/2x/background/marker.png b/dist/images/2x/background/marker.png deleted file mode 100644 index 3929bbb..0000000 Binary files a/dist/images/2x/background/marker.png and /dev/null differ diff --git a/dist/images/2x/background/mask.png b/dist/images/2x/background/mask.png deleted file mode 100644 index b0a4d40..0000000 Binary files a/dist/images/2x/background/mask.png and /dev/null differ diff --git a/dist/images/2x/background/trans_color.png b/dist/images/2x/background/trans_color.png deleted file mode 100644 index 262626f..0000000 Binary files a/dist/images/2x/background/trans_color.png and /dev/null differ diff --git a/dist/images/2x/background/wheel.png b/dist/images/2x/background/wheel.png deleted file mode 100644 index 97b343d..0000000 Binary files a/dist/images/2x/background/wheel.png and /dev/null differ diff --git a/dist/images/2x/icon/check_box_active.png b/dist/images/2x/icon/check_box_active.png deleted file mode 100644 index f5083b8..0000000 Binary files a/dist/images/2x/icon/check_box_active.png and /dev/null differ diff --git a/dist/images/2x/icon/check_box_disable.png b/dist/images/2x/icon/check_box_disable.png deleted file mode 100644 index b6767f3..0000000 Binary files a/dist/images/2x/icon/check_box_disable.png and /dev/null differ diff --git a/dist/images/2x/icon/check_box_disable2.png b/dist/images/2x/icon/check_box_disable2.png deleted file mode 100644 index dbc3da4..0000000 Binary files a/dist/images/2x/icon/check_box_disable2.png and /dev/null differ diff --git a/dist/images/2x/icon/check_box_normal.png b/dist/images/2x/icon/check_box_normal.png deleted file mode 100644 index cf167a7..0000000 Binary files a/dist/images/2x/icon/check_box_normal.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_collapse_1.png b/dist/images/2x/icon/dark/tree_collapse_1.png deleted file mode 100644 index 740b50a..0000000 Binary files a/dist/images/2x/icon/dark/tree_collapse_1.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_collapse_2.png b/dist/images/2x/icon/dark/tree_collapse_2.png deleted file mode 100644 index 6b7192f..0000000 Binary files a/dist/images/2x/icon/dark/tree_collapse_2.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_collapse_3.png b/dist/images/2x/icon/dark/tree_collapse_3.png deleted file mode 100644 index 172b933..0000000 Binary files a/dist/images/2x/icon/dark/tree_collapse_3.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_collapse_4.png b/dist/images/2x/icon/dark/tree_collapse_4.png deleted file mode 100644 index 69eb9c3..0000000 Binary files a/dist/images/2x/icon/dark/tree_collapse_4.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_expand_1.png b/dist/images/2x/icon/dark/tree_expand_1.png deleted file mode 100644 index ce1480d..0000000 Binary files a/dist/images/2x/icon/dark/tree_expand_1.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_expand_2.png b/dist/images/2x/icon/dark/tree_expand_2.png deleted file mode 100644 index 114dc2f..0000000 Binary files a/dist/images/2x/icon/dark/tree_expand_2.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_expand_3.png b/dist/images/2x/icon/dark/tree_expand_3.png deleted file mode 100644 index fb15500..0000000 Binary files a/dist/images/2x/icon/dark/tree_expand_3.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_expand_4.png b/dist/images/2x/icon/dark/tree_expand_4.png deleted file mode 100644 index 75c9f23..0000000 Binary files a/dist/images/2x/icon/dark/tree_expand_4.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_vertical_line_1.png b/dist/images/2x/icon/dark/tree_vertical_line_1.png deleted file mode 100644 index e88f2a6..0000000 Binary files a/dist/images/2x/icon/dark/tree_vertical_line_1.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_vertical_line_2.png b/dist/images/2x/icon/dark/tree_vertical_line_2.png deleted file mode 100644 index 554d8b3..0000000 Binary files a/dist/images/2x/icon/dark/tree_vertical_line_2.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_vertical_line_3.png b/dist/images/2x/icon/dark/tree_vertical_line_3.png deleted file mode 100644 index 8e7da8a..0000000 Binary files a/dist/images/2x/icon/dark/tree_vertical_line_3.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_vertical_line_4.png b/dist/images/2x/icon/dark/tree_vertical_line_4.png deleted file mode 100644 index 4645b52..0000000 Binary files a/dist/images/2x/icon/dark/tree_vertical_line_4.png and /dev/null differ diff --git a/dist/images/2x/icon/dark/tree_vertical_line_5.png b/dist/images/2x/icon/dark/tree_vertical_line_5.png deleted file mode 100644 index 3fd2c56..0000000 Binary files a/dist/images/2x/icon/dark/tree_vertical_line_5.png and /dev/null differ diff --git a/dist/images/2x/icon/dots.png b/dist/images/2x/icon/dots.png deleted file mode 100644 index beae59d..0000000 Binary files a/dist/images/2x/icon/dots.png and /dev/null differ diff --git a/dist/images/2x/icon/half_selected.png b/dist/images/2x/icon/half_selected.png deleted file mode 100644 index 765aabc..0000000 Binary files a/dist/images/2x/icon/half_selected.png and /dev/null differ diff --git a/dist/images/2x/icon/icon_down_arrow.png b/dist/images/2x/icon/icon_down_arrow.png deleted file mode 100644 index 5285f73..0000000 Binary files a/dist/images/2x/icon/icon_down_arrow.png and /dev/null differ diff --git a/dist/images/2x/icon/loading.gif b/dist/images/2x/icon/loading.gif deleted file mode 100644 index d04fdd2..0000000 Binary files a/dist/images/2x/icon/loading.gif and /dev/null differ diff --git a/dist/images/2x/icon/push_down.png b/dist/images/2x/icon/push_down.png deleted file mode 100644 index 88ef8d5..0000000 Binary files a/dist/images/2x/icon/push_down.png and /dev/null differ diff --git a/dist/images/2x/icon/push_up.png b/dist/images/2x/icon/push_up.png deleted file mode 100644 index 040d502..0000000 Binary files a/dist/images/2x/icon/push_up.png and /dev/null differ diff --git a/dist/images/2x/icon/radio_active.png b/dist/images/2x/icon/radio_active.png deleted file mode 100644 index e465430..0000000 Binary files a/dist/images/2x/icon/radio_active.png and /dev/null differ diff --git a/dist/images/2x/icon/radio_disable.png b/dist/images/2x/icon/radio_disable.png deleted file mode 100644 index dfe0413..0000000 Binary files a/dist/images/2x/icon/radio_disable.png and /dev/null differ diff --git a/dist/images/2x/icon/radio_disable2.png b/dist/images/2x/icon/radio_disable2.png deleted file mode 100644 index 8476062..0000000 Binary files a/dist/images/2x/icon/radio_disable2.png and /dev/null differ diff --git a/dist/images/2x/icon/radio_normal.png b/dist/images/2x/icon/radio_normal.png deleted file mode 100644 index 0bbd274..0000000 Binary files a/dist/images/2x/icon/radio_normal.png and /dev/null differ diff --git a/dist/images/2x/icon/slider_active.png b/dist/images/2x/icon/slider_active.png deleted file mode 100644 index cf361f7..0000000 Binary files a/dist/images/2x/icon/slider_active.png and /dev/null differ diff --git a/dist/images/2x/icon/slider_active_small.png b/dist/images/2x/icon/slider_active_small.png deleted file mode 100644 index 1c29cec..0000000 Binary files a/dist/images/2x/icon/slider_active_small.png and /dev/null differ diff --git a/dist/images/2x/icon/slider_normal.png b/dist/images/2x/icon/slider_normal.png deleted file mode 100644 index a81cf03..0000000 Binary files a/dist/images/2x/icon/slider_normal.png and /dev/null differ diff --git a/dist/images/2x/icon/slider_normal_small.png b/dist/images/2x/icon/slider_normal_small.png deleted file mode 100644 index 7bd6fc7..0000000 Binary files a/dist/images/2x/icon/slider_normal_small.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_collapse_1.png b/dist/images/2x/icon/tree_collapse_1.png deleted file mode 100644 index f2d63e2..0000000 Binary files a/dist/images/2x/icon/tree_collapse_1.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_collapse_2.png b/dist/images/2x/icon/tree_collapse_2.png deleted file mode 100644 index 4f87550..0000000 Binary files a/dist/images/2x/icon/tree_collapse_2.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_collapse_3.png b/dist/images/2x/icon/tree_collapse_3.png deleted file mode 100644 index 88cfeba..0000000 Binary files a/dist/images/2x/icon/tree_collapse_3.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_collapse_4.png b/dist/images/2x/icon/tree_collapse_4.png deleted file mode 100644 index 31c33b9..0000000 Binary files a/dist/images/2x/icon/tree_collapse_4.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_expand_1.png b/dist/images/2x/icon/tree_expand_1.png deleted file mode 100644 index 2fb7e3b..0000000 Binary files a/dist/images/2x/icon/tree_expand_1.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_expand_2.png b/dist/images/2x/icon/tree_expand_2.png deleted file mode 100644 index 9a26edb..0000000 Binary files a/dist/images/2x/icon/tree_expand_2.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_expand_3.png b/dist/images/2x/icon/tree_expand_3.png deleted file mode 100644 index 6f6b5a7..0000000 Binary files a/dist/images/2x/icon/tree_expand_3.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_expand_4.png b/dist/images/2x/icon/tree_expand_4.png deleted file mode 100644 index c202c72..0000000 Binary files a/dist/images/2x/icon/tree_expand_4.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_vertical_line_1.png b/dist/images/2x/icon/tree_vertical_line_1.png deleted file mode 100644 index e88f2a6..0000000 Binary files a/dist/images/2x/icon/tree_vertical_line_1.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_vertical_line_2.png b/dist/images/2x/icon/tree_vertical_line_2.png deleted file mode 100644 index 554d8b3..0000000 Binary files a/dist/images/2x/icon/tree_vertical_line_2.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_vertical_line_3.png b/dist/images/2x/icon/tree_vertical_line_3.png deleted file mode 100644 index 8e7da8a..0000000 Binary files a/dist/images/2x/icon/tree_vertical_line_3.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_vertical_line_4.png b/dist/images/2x/icon/tree_vertical_line_4.png deleted file mode 100644 index 4645b52..0000000 Binary files a/dist/images/2x/icon/tree_vertical_line_4.png and /dev/null differ diff --git a/dist/images/2x/icon/tree_vertical_line_5.png b/dist/images/2x/icon/tree_vertical_line_5.png deleted file mode 100644 index 3fd2c56..0000000 Binary files a/dist/images/2x/icon/tree_vertical_line_5.png and /dev/null differ diff --git a/dist/resource/ZeroClipboard.swf b/dist/resource/ZeroClipboard.swf deleted file mode 100644 index 13bf8e3..0000000 Binary files a/dist/resource/ZeroClipboard.swf and /dev/null differ diff --git a/index.html b/index.html deleted file mode 100644 index fd39c4e..0000000 --- a/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - FineUI-Start - - - - - - - -
- - - - - \ No newline at end of file diff --git a/package.json b/package.json index ae7946f..4888ecd 100644 --- a/package.json +++ b/package.json @@ -1,47 +1,77 @@ { - "name": "fineui-start", + "name": "fineui-starter", "version": "1.0.0", - "description": "fineui start", - "main": "index.js", + "description": "fineui starter", + "scripts": { + "start": "webpack-dev-server -p --progress --host 127.0.0.1 --config=webpack/webpack.dev.js --mode development", + "build": "webpack -p --progress --config=webpack/webpack.prod.js --mode production", + "test": "jest", + "eslint": "eslint \"./**/*.{js,ts,jsx,tsx}\"", + "eslint:fix": "eslint \"./**/*.{js,ts,tsx}\" --fix", + "stylelint": "stylelint \"./**/*.less\" --syntax less", + "stylelint:fix": "stylelint \"./**/*.less\" --syntax less --fix", + "prettier": "prettier --write \"./**/*.{js,ts,jsx,tsx,less}\"" + }, "dependencies": { - "fineui": "^2.0.0" + "@fui/core": "^2.0.0" }, "devDependencies": { "@fui/babel-preset-fineui": "^1.0.0", - "@fui/typescript-configs": "^1.0.1", "@fui/eslint-plugin": "^1.0.7", - "@types/jest": "24.0.11", - "typescript": "3.9.2", - "fork-ts-checker-webpack-plugin": "1.4.3", + "@fui/typescript-configs": "^1.0.1", + "@types/jest": "^24.0.11", "autoprefixer": "9.6.1", "babel-loader": "8.0.6", + "babel-plugin-transform-runtime": "6.23.0", "cross-env": "6.0.0", "css-loader": "3.0.0", + "eslint": "^7.30.0", + "eslint-plugin-jest": "^24.3.6", + "eslint-plugin-react": "^7.24.0", + "fork-ts-checker-webpack-plugin": "1.4.3", "html-webpack-plugin": "3.2.0", + "husky": "^7.0.1", "jest": "24.7.1", "jest-css-modules-transform": "2.5.0", "jest-environment-jsdom": "24.7.1", "jest-snapshot": "23.6.0", "less": "^3.11.3", "less-loader": "5.0.0", + "lint-staged": "^11.0.1", "mini-css-extract-plugin": "0.7.0", "npm-run-all": "4.1.5", "optimize-css-assets-webpack-plugin": "5.0.3", "postcss-loader": "3.0.0", "postcss-simple-vars": "5.0.2", + "prettier": "^2.3.2", "source-map-loader": "0.2.4", "style-loader": "0.23.1", + "stylelint": "^13.13.1", + "stylelint-config-prettier": "^8.0.2", + "stylelint-config-standard": "^22.0.0", + "stylelint-prettier": "^1.2.0", + "typescript": "3.9.2", "uglifyjs-webpack-plugin": "2.2.0", "webpack": "4.35.2", "webpack-cli": "3.3.5", "webpack-dev-server": "3.7.2", "webpack-merge": "4.2.1" }, - "scripts": { - "start": "webpack-dev-server -p --progress --host 127.0.0.1 --config=webpack/webpack.dev.js --mode development", - "build": "webpack -p --progress --config=webpack/webpack.prod.js --mode production", - "test": "jest" - }, "author": "", - "license": "MIT" + "license": "MIT", + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.{js,ts}": [ + "eslint --fix", + "git add" + ], + "*.less": [ + "stylelint --fix", + "git add" + ] + } } diff --git a/screenshorts/todolist.gif b/screenshorts/todolist.gif deleted file mode 100644 index 15a465e..0000000 Binary files a/screenshorts/todolist.gif and /dev/null differ diff --git a/screenshots/demo.jpeg b/screenshots/demo.jpeg new file mode 100644 index 0000000..94decdb Binary files /dev/null and b/screenshots/demo.jpeg differ diff --git a/src/common/app.less b/src/common/app.less deleted file mode 100644 index 491bdf4..0000000 --- a/src/common/app.less +++ /dev/null @@ -1,14 +0,0 @@ -@import "../../fineui/src/less/resource/app"; - -//定义自己的全局样式配置 -#body { -} - -#wrapper { - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - .overflow-hidden(); -} \ No newline at end of file diff --git a/src/common/background.less b/src/common/background.less deleted file mode 100644 index f2dfaa9..0000000 --- a/src/common/background.less +++ /dev/null @@ -1,3 +0,0 @@ -@import "../../fineui/src/less/resource/background"; - -//定义自己的背景 \ No newline at end of file diff --git a/src/common/font.less b/src/common/font.less deleted file mode 100644 index 9459171..0000000 --- a/src/common/font.less +++ /dev/null @@ -1,3 +0,0 @@ -@import "../../fineui/src/less/resource/font"; - -//定义自己的字体 diff --git a/src/common/icon.less b/src/common/icon.less deleted file mode 100644 index 610fc21..0000000 --- a/src/common/icon.less +++ /dev/null @@ -1,3 +0,0 @@ -@import "../../fineui/src/less/resource/icon"; - -//定义自己的icon \ No newline at end of file diff --git a/src/core/javascript/decorator.js b/src/core/javascript/decorator.js deleted file mode 100644 index e5f32dd..0000000 --- a/src/core/javascript/decorator.js +++ /dev/null @@ -1 +0,0 @@ -export const { shortcut, Model, model, store } = BI.Decorators; diff --git a/src/core/typescript/decorator.ts b/src/core/typescript/decorator.ts deleted file mode 100644 index ee94eb1..0000000 --- a/src/core/typescript/decorator.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const { shortcut, Model, model, store } = BI.Decorators; - -export type Constructor = new(...args: any[]) => T; diff --git a/src/index.js b/src/index.js deleted file mode 100644 index 3a8714d..0000000 --- a/src/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import { ToDoList } from "./modules/main"; - -// 将todolist组件挂载到#wrapper上. -BI.createWidget({ - type: ToDoList.xtype, - element: "#wrapper" -}); diff --git a/src/index.less b/src/index.less index 09f8de8..0ec9d28 100644 --- a/src/index.less +++ b/src/index.less @@ -1,5 +1,9 @@ -@import "../node_modules/fineui/src/less/index"; +@import './less/index.less'; -@fontUrl: 'font/'; //字体存放路径 -@imageUrl: 'images/1x/'; //图片的基本地址 -@image2xUrl: 'images/2x/'; //2x图片的基本地址 \ No newline at end of file +#wrapper { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..267debf --- /dev/null +++ b/src/index.ts @@ -0,0 +1,7 @@ +import Layout from '@app/layout/layout'; +import './index.less'; + +BI.createWidget({ + type: Layout.xtype, + element: '#wrapper', +}); diff --git a/src/less/index.less b/src/less/index.less new file mode 100644 index 0000000..4dff600 --- /dev/null +++ b/src/less/index.less @@ -0,0 +1,7 @@ +@import '~@fui/core/src/less/index.less'; +@import '~@fui/core/src/less/image.less'; +@import './var.less'; +@import './resource/app.less'; +@import './resource/background.less'; +@import './resource/font.less'; +@import './resource/custom.less'; diff --git a/src/less/lib/background.less b/src/less/lib/background.less new file mode 100644 index 0000000..09e9a54 --- /dev/null +++ b/src/less/lib/background.less @@ -0,0 +1,3 @@ +// 背景图片 + +@background-logo: 'logo.png'; diff --git a/src/less/lib/constant.less b/src/less/lib/constant.less new file mode 100644 index 0000000..d034086 --- /dev/null +++ b/src/less/lib/constant.less @@ -0,0 +1,3 @@ +// 常量 + +@color-app-primary: yellowgreen; diff --git a/src/less/lib/font.less b/src/less/lib/font.less new file mode 100644 index 0000000..6e91cb0 --- /dev/null +++ b/src/less/lib/font.less @@ -0,0 +1,4 @@ +// 字体图标,请参考:http://fanruan.design/#/docs/spec/icon + +@font-directory: 'e748'; +@font-management: 'e777'; diff --git a/src/less/resource/app.less b/src/less/resource/app.less new file mode 100644 index 0000000..b344a50 --- /dev/null +++ b/src/less/resource/app.less @@ -0,0 +1,47 @@ +@import '../lib/constant.less'; + +// 左边框式列表选项 +.app-list-item-border-left { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + color: @color-bi-text-gray; + &:hover, + &.hover { + color: @color-bi-text-white; + } + &.active, + &:active { + border-left: 4px solid white; + color: @color-bi-text-white; + } + &.disabled { + &, + &:hover, + &:active { + color: @color-bi-text-disabled !important; + } + } +} + +// 下划线式列表选项 +.app-list-item-underline { + .box-sizing(border-box); + &:hover, + &.hover { + font-weight: bold; + } + &.active, + &:active { + border-bottom: 2px solid @color-app-primary; + font-weight: bold; + color: @color-app-primary; + background-color: @color-bi-background-default; + } + &.disabled { + &, + &:hover, + &:active { + color: @color-bi-text-disabled !important; + } + } +} diff --git a/src/less/resource/background.less b/src/less/resource/background.less new file mode 100644 index 0000000..af3c91d --- /dev/null +++ b/src/less/resource/background.less @@ -0,0 +1,3 @@ +@import '../lib/background.less'; + +.background(logo-background, @background-logo); diff --git a/src/less/resource/custom.less b/src/less/resource/custom.less new file mode 100644 index 0000000..9a3823d --- /dev/null +++ b/src/less/resource/custom.less @@ -0,0 +1,40 @@ +@import '../lib/constant.less'; + +.bi-high-light { + color: @color-app-primary; +} + +.bi-high-light-background { + background-color: @color-app-primary; +} + +.bi-list-item-select { + &:hover, + &.hover { + .background-color(@color-app-primary, 10%); + } + &:active, + &.active { + color: white; + background-color: @color-app-primary; + } +} + +.bi-list-item { + &:hover, + &.hover { + .background-color(@color-app-primary, 10%); + } +} + +.bi-list-item-active2 { + &:hover, + &.hover { + .background-color(@color-app-primary, 10%); + } + &:active, + &.active { + color: white; + background-color: @color-app-primary; + } +} diff --git a/src/less/resource/font.less b/src/less/resource/font.less new file mode 100644 index 0000000..0b557c6 --- /dev/null +++ b/src/less/resource/font.less @@ -0,0 +1,4 @@ +@import '../lib/font.less'; + +.font(directory-font, @font-directory); +.font(management-font, @font-management); diff --git a/src/less/var.less b/src/less/var.less new file mode 100644 index 0000000..cfd1607 --- /dev/null +++ b/src/less/var.less @@ -0,0 +1,3 @@ +@fontUrl: 'assets/font/'; // 字体的存放路径 +@imageUrl: 'assets/images/1x/'; // 1x图片的基本路径 +@image2xUrl: 'assets/images/2x/'; // 2x图片的基本路径 diff --git a/src/modules/app/layout/content/content.less b/src/modules/app/layout/content/content.less new file mode 100644 index 0000000..e4e25e3 --- /dev/null +++ b/src/modules/app/layout/content/content.less @@ -0,0 +1,5 @@ +@import '~@/index.less'; + +.app-layout-content { + background-color: @background-color-default; +} diff --git a/src/modules/app/layout/content/content.model.ts b/src/modules/app/layout/content/content.model.ts new file mode 100644 index 0000000..5908489 --- /dev/null +++ b/src/modules/app/layout/content/content.model.ts @@ -0,0 +1,41 @@ +import { model, Model } from '@core/decorator'; +import LayoutModel from '../layout.model'; + +@model() +export default class LayoutContentModel extends Model<{ + types: { + openedCards: LayoutModel['TYPE']['openedCards']; + activeCard: LayoutModel['TYPE']['activeCard']; + }; + context: LayoutContentModel['context']; +}> { + static xtype = 'app.model.layout_content'; + + public context = ['openedCards', 'activeCard']; + + public actions = { + /** + * 切换card + * @param value 要切换的card的key + */ + changeCard: (value: string) => { + this.model.activeCard = value; + }, + /** + * 关闭card + * @param value 要关闭的card的key + */ + closeCard: (value: string) => { + // 获取要关闭card在已打开cards中的下标 + const index = BI.indexOf(this.model.openedCards, value); + // 如果要关闭card就是当前card,则自动切换至其它card + if (value === this.model.activeCard) { + const [prevIndex, nextIndex] = [index - 1, index + 1]; + const [prevCard, nextCard] = [this.model.openedCards[prevIndex], this.model.openedCards[nextIndex]]; + this.model.activeCard = nextCard || prevCard; + } + // 然后从已打开cards中移除目标card + BI.removeAt(this.model.openedCards, index); + }, + }; +} diff --git a/src/modules/app/layout/content/content.tsx b/src/modules/app/layout/content/content.tsx new file mode 100644 index 0000000..9ce508e --- /dev/null +++ b/src/modules/app/layout/content/content.tsx @@ -0,0 +1,156 @@ +import { Tab } from '@fui/core'; +import { shortcut, store } from '@core/decorator'; +import { Nav, NavItemInfo, NavItemStyle } from '@base/nav/nav'; +import { RouteType, RouteInfo, ROUTE_INFOS } from '@/routes'; +import LayoutContentModel from './content.model'; +import LayoutConstant from '../layout.constant'; +import './content.less'; + +// 路由信息value与页面内容的映射关系,可以理解成一个经过faltten的路由信息集合 +export interface ContentsMap { + [key: string]: NavItemInfo & Required> & Partial>; +} + +// 路由类别与导航选项风格的映射关系 +export const ROUTE_TYPE_NAV_ITEM_STYLE_MAP = { + [RouteType.Single]: NavItemStyle.Block, + [RouteType.Multiple]: NavItemStyle.Underline, +}; + +/** + * 应用布局的内容区域,包括导航栏和实际内容区域 + */ +@shortcut() +@store(LayoutContentModel) +export class LayoutContent extends BI.Widget { + static xtype = 'app.layout_content'; + + public props = { + baseCls: 'app-layout-content', + }; + + public watch = { + openedCards: (values: string[]) => { + this.udpateNavItemInfos(values); + this.updateNavValue(); + }, + activeCard: (value: string) => { + this.updateNavItemStyle(value); + this.updateNavValue(); + this.tabRef.setSelect(value); + }, + }; + + private model: LayoutContentModel['model']; + private store: LayoutContentModel['store']; + private navRef: Nav; + private tabRef: Tab; + private contentsMap: ContentsMap; + + /** + * 初始化ContentsMap + * @param routeInfos 路由信息集合 + * @param closable 当前路由信息对应的导航选项是否可关闭 + */ + private initContentsMap(routeInfos: RouteInfo[], closable: boolean) { + if (!this.contentsMap) { + this.contentsMap = {}; + } + for (const routeInfo of routeInfos) { + const { type, value, text, card: Card, cards, children } = routeInfo; + const isHome = type !== undefined; + const newClosable = type === RouteType.Single ? true : closable; + this.contentsMap[value] = { + type, + value, + text: isHome ? '首页' : text, + closable: isHome ? false : newClosable, + card: Card ? : , + }; + if (children) { + this.initContentsMap(children, newClosable); + } + if (cards) { + this.initContentsMap(cards, newClosable); + } + } + } + + /** + * 更新导航组件的itemInfos + * @param values 当前打卡的卡片们的values + */ + private udpateNavItemInfos(values: string[]) { + const itemInfos = BI.map(values, (_index, value) => this.contentsMap[value]); + this.navRef.setItemInfos(itemInfos); + } + + /** + * 更新导航组件的itemStyle + * @param value 当前激活卡片的value + */ + private updateNavItemStyle(value: string) { + const { type } = this.contentsMap[value]; + if (type !== undefined) { + const itemStyle = ROUTE_TYPE_NAV_ITEM_STYLE_MAP[type]; + this.navRef.setItemStyle(itemStyle); + } + } + + /** + * 根据当前激活卡片的value更新导航组件的值 + */ + private updateNavValue() { + this.navRef.setValue(this.model.activeCard); + } + + public init() { + this.initContentsMap([{ value: '', text: 'blank', icon: '' }, ...ROUTE_INFOS], false); + } + + public render() { + const { NAV_HEIGHT } = LayoutConstant; + const navValue = ROUTE_INFOS[0].value; + const navItemInfo = this.contentsMap[navValue]; + const navItemType = navItemInfo.type as RouteType; + const navItemStyle = ROUTE_TYPE_NAV_ITEM_STYLE_MAP[navItemType]; + + return ( + +