diff --git a/.eslintignore b/.eslintignore
index 0ee78af2..d6d63d38 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -2,6 +2,7 @@ build
node_modules
examples/router/node_modules
packages/*/node_modules
+packages/cdn
lib
dist
test
diff --git a/.eslintrc.js b/.eslintrc.js
index 8240c185..6f9b1b07 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -6,7 +6,8 @@ module.exports = {
// 这里填入你的项目需要的全局变量
// 这里值为 false 表示这个全局变量不允许被重新赋值,比如:
//
- // Vue: false
+ ams: false,
+ define: false
},
rules: {
'no-throw-literal': 'off',
diff --git a/.gitignore b/.gitignore
index b55d9013..828bbc1f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,5 +18,4 @@ package-lock.json
/packages/*/lib
/material-list.json
/test/_coverage
-.scannerwork/
/plugins/vscode/*.vsix
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 00000000..a4379265
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1,5 @@
+node_modules
+/backup
+package-lock.json
+dist
+
diff --git a/docs/package.json b/docs/package.json
index 449fbee6..6662df86 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -17,7 +17,7 @@
"node-sass": "^4.12.0",
"sass-loader": "^7.1.0",
"vue-highlight.js": "^3.1.0",
- "vuepress": "^1.0.4"
+ "vuepress": "^1.2.0"
},
"devDependencies": {
"vuepress-plugin-flowchart": "^1.4.3"
diff --git a/docs/zh-CN/.vuepress/components/block/drawer/block.js b/docs/zh-CN/.vuepress/components/block/drawer/block.js
new file mode 100644
index 00000000..2f6c255d
--- /dev/null
+++ b/docs/zh-CN/.vuepress/components/block/drawer/block.js
@@ -0,0 +1,120 @@
+export default {
+ defaultDrawer: {
+ type: 'component',
+ operations: {
+ addItem: {
+ type: 'button',
+ label: '点击打开弹窗',
+ event: 'adminAddDrawer.show'
+ }
+ },
+ blocks: {
+ adminAddDrawer: {
+ type: 'drawer',
+ data: {
+ title: '我是标题'
+ },
+ props: {
+ 'before-close': function(done){
+ this.$confirm('确认关闭?')
+ .then(_ => {
+ done();
+ })
+ .catch(_ => {});
+ }
+ },
+ operations: {
+ submit: {
+ type: 'button',
+ label: '提交',
+ props: {
+ type: 'primary'
+ }
+ },
+ hide: {
+ type: 'button',
+ label: '关闭'
+ }
+ },
+ actions: {
+ submit() {
+ this.$message('你点击了提交按钮')
+ }
+ },
+ blocks: {
+ dialogText: {
+ type: 'component',
+ options: {
+ is: 'div',
+ text: "我是弹窗内容"
+ }
+ }
+ }
+ }
+ }
+ },
+ drawer: {
+ type: 'component',
+ operations: {
+ addItem: {
+ type: 'button',
+ label: '点击打开弹窗',
+ event: 'adminDrawer.show'
+ }
+ },
+ blocks: {
+ adminDrawer: {
+ type: 'drawer',
+ data: {
+ title: '添加'
+ },
+ blocks: {
+ addDrawerForm: {
+ ctx: 'edit',
+ type: 'form',
+ style: {
+ paddingRight: '20px'
+ },
+ resource: {
+ fields: {
+ text: {
+ label: '新文本',
+ type: 'text'
+ },
+ password: {
+ type: 'password',
+ label: '密码'
+ }
+ }
+ },
+ operations: {
+ submit: {
+ type: 'button',
+ label: '提交',
+ props: {
+ type: 'primary'
+ }
+ },
+ hide: {
+ type: 'button',
+ label: '关闭'
+ }
+ },
+ events: {
+ submit: '@validate @add @adminDrawer.hide @clear'
+ },
+ actions: {
+ add(){
+ this.callAction('@adminListView.add', {item: this.data})
+ },
+ clear() {
+ // 清空表单数据
+ this.data = {}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/docs/zh-CN/.vuepress/components/block/drawer/demo.vue b/docs/zh-CN/.vuepress/components/block/drawer/demo.vue
new file mode 100644
index 00000000..ea4f0188
--- /dev/null
+++ b/docs/zh-CN/.vuepress/components/block/drawer/demo.vue
@@ -0,0 +1,40 @@
+
+
+
+
+
+ {{ configCode }}
+
+
+
+
+ {{ showConfig ? '隐藏' : '显示'}}配置
+ 在线运行
+
+
+
+
+
diff --git a/docs/zh-CN/.vuepress/components/block/grid/block.js b/docs/zh-CN/.vuepress/components/block/grid/block.js
index 97dfb668..b701ad87 100644
--- a/docs/zh-CN/.vuepress/components/block/grid/block.js
+++ b/docs/zh-CN/.vuepress/components/block/grid/block.js
@@ -56,6 +56,46 @@ export default {
}
}
},
+ unsupportGrid: {
+ type: 'grid',
+ style: {
+ height: '200px'
+ },
+ blocks: {
+ unsupportGridheaderTitle1: { // 第一列
+ type: 'card',
+ options: {
+ headerTitle: '卡片类型自带的标题'
+ },
+ style: {
+ width: 'calc(50% - 10px)',
+ height: '100%',
+ 'margin-right': '10px'
+ },
+ blocks: {
+ emptyCardText: {
+ type: 'component',
+ options: {
+ is: 'div',
+ text: '自定义内容'
+ }
+ }
+ }
+ },
+ unsupportGridheaderTitle2: { // 第二列
+ type: 'card',
+ options: {
+ headerTitle: '卡片类型自带的标题'
+ },
+ style: {
+ width: 'calc(50% - 10px)',
+ height: '100%',
+ 'margin-left': '10px'
+ },
+ blocks: ['emptyCardText']
+ }
+ }
+ },
grid3: {
type: 'grid',
style: {
diff --git a/docs/zh-CN/.vuepress/components/block/router/block.js b/docs/zh-CN/.vuepress/components/block/router/block.js
index 8409dbbb..bbdf8082 100644
--- a/docs/zh-CN/.vuepress/components/block/router/block.js
+++ b/docs/zh-CN/.vuepress/components/block/router/block.js
@@ -216,6 +216,14 @@ export default {
},
slot: 'menuTop'
},
+ navRouterLeft: {
+ slot: 'nav-left',
+ type: 'component',
+ options: {
+ is: 'div',
+ text: '导航左侧插槽'
+ }
+ },
navRouterTitle: {
"type": "component",
"options": {
diff --git a/docs/zh-CN/.vuepress/components/changelog/logs.js b/docs/zh-CN/.vuepress/components/changelog/logs.js
index 851d0ac5..c1a196cb 100644
--- a/docs/zh-CN/.vuepress/components/changelog/logs.js
+++ b/docs/zh-CN/.vuepress/components/changelog/logs.js
@@ -1,14 +1,38 @@
// 更新日志
export default [
{
- version: '0.20.2',
- date: '2019.11.7',
+ version: '0.21.6',
+ date: '2019.12.3',
log: [
+ 'feat: text的view组件添加on事件',
+ 'feat: theme-vipshop主题修改',
+ 'feat: block-list的操作按钮context增加数据index',
+ 'feat: block-imagelist增加显示角标信息',
+ 'feat: 添加nav-left插槽',
+ 'feat: 新增drawer抽屉block',
+ 'feat: array-simple数据更换',
+ 'fix: field-image兼容接口通过data直接返回图片地址的情况',
+ 'fix: 修复block-list的表头操作栏样式问题',
+ 'fix: field-image删除previewUrl'
+ ]
+ },
+ {
+ version: '0.20.10',
+ date: '2019.11.18',
+ log: [
+ 'feat:增加事件销毁机制,tabs增加监听resize事件',
+ 'feat:block-chart添加loading',
+ 'feat: block-imagelist增加支持插入分类名称和隐藏标题信息块',
'feat: operations支持配置换行展示',
'feat: 增加block默认data机制',
'feat: 把field-headimage整合到field-image,并删除field-headimage',
'feat: block-card、block-component、block-dialog、block-imagelist、block-tabs增加loading效果,可以在该区块的action通过this.showLoading和this.hideLoading来控制',
- 'feat:增加图标ams-icon-user',
+ 'feat: 增加图标ams-icon-user',
+ 'fix: 修复field-select在view状态下,无法匹配值为空的选项',
+ 'fix: block-chart的图例icon设置为默认图标',
+ 'fix: block-imagelist支持搜索换行',
+ 'fix: block-grid兼容低级浏览器',
+ 'fix: block-imagelist标题块高度不一致、删除title逻辑判断',
'fix: 路由菜单样式',
'fix: fieldChange无法获取不在资源声明的field的name',
'fix: 修复列表在有操作按钮的时候,行距过高的问题'
diff --git a/docs/zh-CN/.vuepress/components/entry.js b/docs/zh-CN/.vuepress/components/entry.js
index 52c935b7..e6652dac 100644
--- a/docs/zh-CN/.vuepress/components/entry.js
+++ b/docs/zh-CN/.vuepress/components/entry.js
@@ -60,4 +60,4 @@ ams.config({
withCredentials: false
}
}
-})
\ No newline at end of file
+})
diff --git a/docs/zh-CN/.vuepress/components/try/config.js b/docs/zh-CN/.vuepress/components/try/config.js
index 7067e9cb..fe8fd516 100644
--- a/docs/zh-CN/.vuepress/components/try/config.js
+++ b/docs/zh-CN/.vuepress/components/try/config.js
@@ -8,6 +8,7 @@ export default [{
"demoResource": {
"api": {
prefix,
+ "withCredentials": false,
"read": "read",
"update": "update",
"list": "list",
diff --git a/docs/zh-CN/.vuepress/config.js b/docs/zh-CN/.vuepress/config.js
index 1af5257e..9c1d3720 100644
--- a/docs/zh-CN/.vuepress/config.js
+++ b/docs/zh-CN/.vuepress/config.js
@@ -2,7 +2,7 @@
const dest = 'dist'
module.exports = {
- title: 'AMS',
+ title: 'AMS文档',
base: '/ams/',
description: '基于JSON配置来快速搭建管理后台前端页面的JavaScript框架',
dest: dest, // 指定 vuepress build 的输出目录, 默认值: .vuepress/dist
@@ -144,6 +144,7 @@ module.exports = {
'imagelist',
'table',
'dialog',
+ 'drawer',
'error',
'router',
'collapse',
diff --git a/docs/zh-CN/.vuepress/public/index/banner-bg.png b/docs/zh-CN/.vuepress/public/index/banner-bg.png
index f3679c72..da1565ce 100644
Binary files a/docs/zh-CN/.vuepress/public/index/banner-bg.png and b/docs/zh-CN/.vuepress/public/index/banner-bg.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/banner-left.png b/docs/zh-CN/.vuepress/public/index/banner-left.png
index 78d03698..a5f221c1 100644
Binary files a/docs/zh-CN/.vuepress/public/index/banner-left.png and b/docs/zh-CN/.vuepress/public/index/banner-left.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/banner-right01.png b/docs/zh-CN/.vuepress/public/index/banner-right01.png
index f574f2f8..54543451 100644
Binary files a/docs/zh-CN/.vuepress/public/index/banner-right01.png and b/docs/zh-CN/.vuepress/public/index/banner-right01.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/banner-right02.png b/docs/zh-CN/.vuepress/public/index/banner-right02.png
index fd88f958..0a4e5a17 100644
Binary files a/docs/zh-CN/.vuepress/public/index/banner-right02.png and b/docs/zh-CN/.vuepress/public/index/banner-right02.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/banner-right03-03.png b/docs/zh-CN/.vuepress/public/index/banner-right03-03.png
index cf349889..a45097cf 100644
Binary files a/docs/zh-CN/.vuepress/public/index/banner-right03-03.png and b/docs/zh-CN/.vuepress/public/index/banner-right03-03.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/banner-right03-04.png b/docs/zh-CN/.vuepress/public/index/banner-right03-04.png
index 1157b1d2..d5ba594f 100644
Binary files a/docs/zh-CN/.vuepress/public/index/banner-right03-04.png and b/docs/zh-CN/.vuepress/public/index/banner-right03-04.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/banner-right03-05.png b/docs/zh-CN/.vuepress/public/index/banner-right03-05.png
index 4245797a..9232eaf7 100644
Binary files a/docs/zh-CN/.vuepress/public/index/banner-right03-05.png and b/docs/zh-CN/.vuepress/public/index/banner-right03-05.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/banner-right03-06.png b/docs/zh-CN/.vuepress/public/index/banner-right03-06.png
index a98c4d20..671ef4ed 100644
Binary files a/docs/zh-CN/.vuepress/public/index/banner-right03-06.png and b/docs/zh-CN/.vuepress/public/index/banner-right03-06.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/banner-right03.png b/docs/zh-CN/.vuepress/public/index/banner-right03.png
index 994c12b0..58cfcc07 100644
Binary files a/docs/zh-CN/.vuepress/public/index/banner-right03.png and b/docs/zh-CN/.vuepress/public/index/banner-right03.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/footer-01.png b/docs/zh-CN/.vuepress/public/index/footer-01.png
index fbbafb2c..50897fe7 100644
Binary files a/docs/zh-CN/.vuepress/public/index/footer-01.png and b/docs/zh-CN/.vuepress/public/index/footer-01.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/footer-02.png b/docs/zh-CN/.vuepress/public/index/footer-02.png
index 4a4958f4..9b52d3b7 100644
Binary files a/docs/zh-CN/.vuepress/public/index/footer-02.png and b/docs/zh-CN/.vuepress/public/index/footer-02.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/git.png b/docs/zh-CN/.vuepress/public/index/git.png
index e1b27c75..afdf6053 100644
Binary files a/docs/zh-CN/.vuepress/public/index/git.png and b/docs/zh-CN/.vuepress/public/index/git.png differ
diff --git a/docs/zh-CN/.vuepress/public/index/start.png b/docs/zh-CN/.vuepress/public/index/start.png
index 5e2687ca..9613fade 100644
Binary files a/docs/zh-CN/.vuepress/public/index/start.png and b/docs/zh-CN/.vuepress/public/index/start.png differ
diff --git a/docs/zh-CN/api/ams-ams.md b/docs/zh-CN/api/ams-ams.md
index 98ceb3bd..f17660c6 100644
--- a/docs/zh-CN/api/ams-ams.md
+++ b/docs/zh-CN/api/ams-ams.md
@@ -140,7 +140,7 @@ action调用显式的返回值,会自动更新 `$prevReturn`,用于action参
返回将post数据 data序列化为`x-www-form-urlencoded`格式
-## ams.createApiAction(params:)
+## ams.createApiAction(params)
- 参数:
- params: `object`
- getOptions: `async Function` 请求参数获取回调
@@ -152,7 +152,7 @@ action调用显式的返回值,会自动更新 `$prevReturn`,用于action参
## ams.request(opt)
- 参数:
- - opt: `object
+ - opt: `object`
- opt.method:'get' | 'post'
- url:string
- data:object
diff --git a/docs/zh-CN/api/default-config.md b/docs/zh-CN/api/default-config.md
index 66ab10b5..1f666ea1 100644
--- a/docs/zh-CN/api/default-config.md
+++ b/docs/zh-CN/api/default-config.md
@@ -5,7 +5,7 @@ DefaultConfig: DefaultConfig 简化配置
通过简化配置可以将一些常用的配置用`常量`标识,减少重复代码的编写。可以使用ams内部继承的配置,也可以在项目自行配置,在文末自定义有使用说明。
-在ams内部目前集成了以下几种简化配置,通过在`Console控制台`打印`ams.configs`也可以查看
+在ams内部目前集成了以下几种简化配置,通过在浏览器控制台`console面板`打印`ams.configs`也可以查看
## FORM_SUBMIT
diff --git a/docs/zh-CN/api/resource.md b/docs/zh-CN/api/resource.md
index 2c4b90ad..57d81582 100644
--- a/docs/zh-CN/api/resource.md
+++ b/docs/zh-CN/api/resource.md
@@ -17,7 +17,8 @@ ams.resource(name: String, config: Object)
```js
ams.resource('demo-resource', {
- key: 'id', // 【非必须】标识该resource的keyName
+ key: 'id',
+ foreignKeys: ['testArrays'],
api: { // 数据接口相关
prefix: '//rap2api.taobao.org/app/mock/231578/ams/mock/',
create: 'create',
@@ -50,6 +51,8 @@ ams.resource('demo-resource', {
- `key`: 【非必须】标识该resource的`keyName`,有些场景需要通过 `queryString` 传入,通过解析 `key=value` 获取
+- `foreignKeys`: 发起resource里的api接口时,可以附带传的参数,接收数组的字段格式,同`key`一样会通过`queryString` 传入
+
- `api`: 对resource的一些内置方法,`prefix`为接口地址,目前提供了`create` `update` `read` `delete` `list` 几个内置请求方法
- `fields`: resource里的详细的字段描述,点击前往[更深入的了解fields](/api/field.html)
diff --git a/docs/zh-CN/block/drawer.md b/docs/zh-CN/block/drawer.md
new file mode 100644
index 00000000..4ecfbdf5
--- /dev/null
+++ b/docs/zh-CN/block/drawer.md
@@ -0,0 +1,17 @@
+---
+Drawer: Drawer 抽屉
+---
+# Drawer 抽屉
+
+### 基础用法
+
+
+
+
+
+### 自定义内容
+和 Dialog 组件一样, Drawer 同样可以在其内部嵌套各种丰富的操作
+
+
+
+
\ No newline at end of file
diff --git a/docs/zh-CN/block/grid.md b/docs/zh-CN/block/grid.md
index 23201919..0a74d5c7 100644
--- a/docs/zh-CN/block/grid.md
+++ b/docs/zh-CN/block/grid.md
@@ -21,6 +21,14 @@ Grid: Grid 网格布局
+### 如何兼容不支持grid布局的浏览器?
+
+不支持grid布局时,ams会把子项按照`inline-block`展示,所以通过给子项配置单独的样式:`width` 和 `height`。
+
+
+
+
+
### 一行三列
> 这个三列默认是由它的子区块blocks个数
diff --git a/docs/zh-CN/block/imagelist.md b/docs/zh-CN/block/imagelist.md
index 6297c812..9eb9cb9c 100644
--- a/docs/zh-CN/block/imagelist.md
+++ b/docs/zh-CN/block/imagelist.md
@@ -104,6 +104,9 @@ options: { // 可以通过options设置显示内容映射的字段名
},
info: { // 主标题右边的信息(默认:list的info)
field: 'info' // 或在这指定其它字段
+ },
+ subscript: { // 右下角角标(默认:list的subscript)
+ field: 'info' // 或在这指定其它字段
}
}
```
diff --git a/docs/zh-CN/block/router.md b/docs/zh-CN/block/router.md
index d4f980bd..391c4e06 100644
--- a/docs/zh-CN/block/router.md
+++ b/docs/zh-CN/block/router.md
@@ -29,12 +29,15 @@ Router: Router 导航路由
#### 导航的位置slot block
-配置子block的slot为`nav`,可以插入在导航的位置。比如下面例子插入了两个操作按钮“反馈”和“帮助”。
+配置子block的slot为`nav`,可以插入在导航的位置。比如下面例子插入了两个操作按钮“反馈”和“帮助”,
+配置子block的slot为`nav-left`,可以插入在导航左侧的位置。比如下面例子插入文本“左侧导航插槽”。
+
+
### 结构
```js
diff --git a/docs/zh-CN/field/select.md b/docs/zh-CN/field/select.md
index a3c48d1d..1f5e2bb5 100644
--- a/docs/zh-CN/field/select.md
+++ b/docs/zh-CN/field/select.md
@@ -40,6 +40,7 @@ String,如`"a,b,c"`
- remoteConfig.isMiniBackfill:最小化options回填,推荐select使用,回填时只会提供当前值对应的options(默认为true)
- remoteConfig.transform:transform函数,可以定制options数据的组装过程,参数为 $field(当前field的vue实例)、 data(接口数据),返回值为组装好的options
- remoteConfig.request:request函数(promise或者async函数),可以定制请求、用于一些需要动态请求参数的场景,参数为 $field(当前field的vue实例)、 query(关键字或者值)、isBackfill(是否是回填),返回值通过ams.request请求的完整res
+- remoteConfig.isInitRemoteOptions:是否初始化的时候触发远程搜索
#### 场景一:远程select、关键字搜索、最小化回填、options缓存
选项值:
diff --git a/docs/zh-CN/field/text.md b/docs/zh-CN/field/text.md
index 5c1b852a..4f6db1be 100644
--- a/docs/zh-CN/field/text.md
+++ b/docs/zh-CN/field/text.md
@@ -46,9 +46,30 @@ title: Text 文本
-### 在线实验室
+### 配置参数
+
+| 参数 | 类型(可选值) | 必填 | 说明
+| -- | -- | -- | --
+| type | string | 是 | 字段类型
+| label | string | 否 | 标签文本
+| ctx | `edit`, `view` | 否 | `edit` 为编辑态,`view` 为展示态,不配置则使用当前block的ctx
+| default | string, number | 否 | 默认值
+| labelWidth | string | 否 | 在form和object内生效,可单独指定当前field的标签文本所占的宽度
+| info | string | 否 | 如配置会在标签处展示tooltip提示
+| desc | string | 否 | 如配置会在ctx为`edit`状态下固定显示在表单项下面
+| hidden | null, boolean | 否 | 默认为`false`,配置为true则改表单项会隐藏
+| show | string, object, function | 否 | 配置后只有满足指定的条件后才显示,实现对目标条件的依赖联动
+| show.name | string | 否 | 目标字段名
+| show.value | string, number | 否 | 目标字段值
+| rules | null, array | 否 | 可以配置多条校验规则,会在form的编辑态通过 `@validate` 来校验,详见 https://github.com/yiminghe/async-validator
+| rules[] | object | 否 |
+| rules[].require | boolean | 否 | 是否必填
+| rules[].type | `string`, `number`, `boolean`, `method`, `regexp`, `integer`, `float`, `array`, `object`, `enum`, `date`, `url`, `hex`, `email` | 否 | 校验类型
+| props | null, object | 否 | 会透传至底层的element-ui组件作为props属性,或者是原生dom元素的属性
+
+
组件更多配置可参考Element:[Input 输入框](http://element-cn.eleme.io/#/zh-CN/component/input)中的Input Attributes
diff --git a/examples/README.md b/examples/README.md
index f8b413e2..b4a4d96f 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -1,11 +1,35 @@
# 示例列表
-## router
+## PC端示例本地开发调试
```
-cd ./examples/router
+cd ./router
npm i
npm run dev
```
- npm 集成
- router
- - 完整示例
\ No newline at end of file
+ - 完整示例
+ - dev
+ - 本地开发dev环境
+
+## 移动端示例本地开发调试
+```
+cd ./mobile
+npm i
+npm run dev
+```
+
+## unpkg本地开发调试
+```
+cd ./router
+npm i
+npm run dev
+```
+打开 [http://localhost:9526/examples/unpkg/script.html]()
+
+- 通过脚本集成示例
+ - script.html
+ - 通过脚本集成
+ - all.html
+ - resources、render集中配置在一个block示例
+
diff --git a/examples/router/public/index.html b/examples/router/public/index.html
index 5a97bd25..75dd25e2 100644
--- a/examples/router/public/index.html
+++ b/examples/router/public/index.html
@@ -4,8 +4,9 @@
+
-
router
+ AMS在线示例