Skip to content

Commit

Permalink
feat: v0.22.9
Browse files Browse the repository at this point in the history
  • Loading branch information
jun85.li committed Dec 14, 2019
1 parent 858e450 commit 96b8ad8
Show file tree
Hide file tree
Showing 74 changed files with 832 additions and 218 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ build
node_modules
examples/router/node_modules
packages/*/node_modules
packages/cdn
lib
dist
test
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ module.exports = {
// 这里填入你的项目需要的全局变量
// 这里值为 false 表示这个全局变量不允许被重新赋值,比如:
//
// Vue: false
ams: false,
define: false
},
rules: {
'no-throw-literal': 'off',
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
120 changes: 120 additions & 0 deletions docs/zh-CN/.vuepress/components/block/drawer/block.js
Original file line number Diff line number Diff line change
@@ -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 = {}
}
}
}
}
}
}
}
}
40 changes: 40 additions & 0 deletions docs/zh-CN/.vuepress/components/block/drawer/demo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<el-card shadow="hover" class="demo demo-card">
<ams-block v-if="init" :name="blockName" class="demo-card-preview"/>
<div :class="`demo-card-config ${showConfig ? 'open': ''}`">
<highlight-code lang="javascript">
{{ configCode }}
</highlight-code>
</div>
<div class="demo-card-config-btn" @click="toggleDemoCofig">
<i :class="`el-icon-caret-${showConfig ? 'top': 'bottom'}`"></i>
{{ showConfig ? '隐藏' : '显示'}}配置
<el-link v-if="onlineDemo" :href="onlineDemo" target="_blank" type="success">在线运行</el-link>
</div>
</el-card>
</template>

<script>
import demoMixins from '../../demo/demo-mixin'
import block from './block'
import stringify from '@ams-team/json-stringify'
import beautify from 'js-beautify'
export default {
mixins: [demoMixins],
mounted(){
const stringConfig = stringify(block[this.blockName])
this.configCode = beautify(stringConfig, { indent_size: 2, space_in_empty_paren: true })
// 如果已经注册过则不再注册
if (ams && ams.blocks && ams.blocks[this.blockName]) {
this.init = true;
return;
}
ams.block(this.blockName, block[this.blockName])
this.init = true
}
}
</script>
8 changes: 8 additions & 0 deletions docs/zh-CN/.vuepress/components/block/router/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ export default {
},
slot: 'menuTop'
},
navRouterLeft: {
slot: 'nav-left',
type: 'component',
options: {
is: 'div',
text: '导航左侧插槽'
}
},
navRouterTitle: {
"type": "component",
"options": {
Expand Down
23 changes: 16 additions & 7 deletions docs/zh-CN/.vuepress/components/changelog/logs.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
// 更新日志
export default [
{
version: '0.21.1',
date: '2019.11.20',
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: 解决表格loading弹层 层级问题'
'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',
'fix: block-imagelist标题块高度不一致、删除title逻辑判断',
'fix: block-grid兼容低级浏览器',
'fix:block-chart的图例icon设置为默认图标',
'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: 修复列表在有操作按钮的时候,行距过高的问题'
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/.vuepress/components/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ ams.config({
withCredentials: false
}
}
})
})
1 change: 1 addition & 0 deletions docs/zh-CN/.vuepress/components/try/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docs/zh-CN/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const dest = 'dist'

module.exports = {
title: 'AMS',
title: 'AMS文档',
base: '/ams/',
description: '基于JSON配置来快速搭建管理后台前端页面的JavaScript框架',
dest: dest, // 指定 vuepress build 的输出目录, 默认值: .vuepress/dist
Expand Down Expand Up @@ -144,6 +144,7 @@ module.exports = {
'imagelist',
'table',
'dialog',
'drawer',
'error',
'router',
'collapse',
Expand Down
4 changes: 2 additions & 2 deletions docs/zh-CN/api/ams-ams.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ action调用显式的返回值,会自动更新 `$prevReturn`,用于action参

返回将post数据 data序列化为`x-www-form-urlencoded`格式

## ams.createApiAction(params)
## ams.createApiAction(params)
- 参数:
- params: `object`
- getOptions: `async Function` 请求参数获取回调
Expand All @@ -152,7 +152,7 @@ action调用显式的返回值,会自动更新 `$prevReturn`,用于action参

## ams.request(opt)
- 参数:
- opt: `object
- opt: `object`
- opt.method:'get' | 'post'
- url:string
- data:object
Expand Down
5 changes: 4 additions & 1 deletion docs/zh-CN/api/resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions docs/zh-CN/block/drawer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
Drawer: Drawer 抽屉
---
# Drawer 抽屉

### 基础用法

<ClientOnly>
<block-drawer-demo blockName="defaultDrawer" />
</ClientOnly>

### 自定义内容
和 Dialog 组件一样, Drawer 同样可以在其内部嵌套各种丰富的操作

<ClientOnly>
<block-drawer-demo blockName="drawer" />
</ClientOnly>
3 changes: 3 additions & 0 deletions docs/zh-CN/block/imagelist.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ options: { // 可以通过options设置显示内容映射的字段名
},
info: { // 主标题右边的信息(默认:list的info)
field: 'info' // 或在这指定其它字段
},
subscript: { // 右下角角标(默认:list的subscript)
field: 'info' // 或在这指定其它字段
}
}
```
Expand Down
5 changes: 4 additions & 1 deletion docs/zh-CN/block/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ Router: Router 导航路由

#### 导航的位置slot block

配置子block的slot为`nav`,可以插入在导航的位置。比如下面例子插入了两个操作按钮“反馈”和“帮助”。
配置子block的slot为`nav`,可以插入在导航的位置。比如下面例子插入了两个操作按钮“反馈”和“帮助”,
配置子block的slot为`nav-left`,可以插入在导航左侧的位置。比如下面例子插入文本“左侧导航插槽”。

<ClientOnly>
<block-router-demo blockName="navRouter" onlineDemo="https://codepen.io/w3cmark/pen/KKPRbJr"/>
</ClientOnly>



### 结构

```js
Expand Down
25 changes: 23 additions & 2 deletions docs/zh-CN/field/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,30 @@ title: Text 文本
<field-text-demo blockName="textField7"/>
</ClientOnly>

### 在线实验室
### 配置参数

| 参数 | 类型(可选值) | 必填 | 说明
| -- | -- | -- | --
| 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元素的属性

<!-- ### 在线实验室
<ClientOnly>
<ams-config name="text" type="field"/>
</ClientOnly>
</ClientOnly> -->

组件更多配置可参考Element:[Input 输入框](http://element-cn.eleme.io/#/zh-CN/component/input)中的Input Attributes
Loading

0 comments on commit 96b8ad8

Please sign in to comment.