Skip to content

Commit

Permalink
Merge pull request #9 from vipshop/develop
Browse files Browse the repository at this point in the history
v0.15.11
  • Loading branch information
w3cmark authored Sep 16, 2019
2 parents a3dab0a + f73c2f1 commit cbcf015
Show file tree
Hide file tree
Showing 178 changed files with 4,575 additions and 770 deletions.
12 changes: 11 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ module.exports = {
// eslint 的检测较弱、会误报、先关闭
'vue/valid-template-root': 'off',
// eslint 的检测较弱、会误报、先关闭
'vue/require-component-is': 'off'
'vue/require-component-is': 'off',
'vue/html-indent': 'off',
'vue/html-closing-bracket-spacing': 'off',
'vue/mustache-interpolation-spacing': 'off',
'function-paren-newline': 'off',
'vue/attributes-order': 'off',
'vue/html-closing-bracket-newline': 'off',
'vue/multiline-html-element-content-newline': 'off',
'implicit-arrow-linebreak': 'off',
'function-call-argument-newline': 'off',
'vue/require-default-prop': 'off'
},
env: {
'jest': true
Expand Down
6 changes: 3 additions & 3 deletions build/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,23 @@ module.exports = {
loader: 'url-loader',
query: {
limit: 10000,
name: path.posix.join('static', '[name].[hash:7].[ext]')
name: path.posix.join('./theme-default', '[name].[hash:7].[ext]')
}
},
{
test: /\.svg(\?\S*)?$/,
loader: 'url-loader',
query: {
limit: 10000,
name: path.posix.join('static', '[name].[hash:7].[ext]')
name: path.posix.join('./theme-default', '[name].[hash:7].[ext]')
}
},
{
test: /\.(gif|png|jpe?g)(\?\S*)?$/,
loader: 'url-loader',
query: {
limit: 10000,
name: path.posix.join('static', '[name].[hash:7].[ext]')
name: path.posix.join('./theme-default', '[name].[hash:7].[ext]')
}
}
]
Expand Down
20 changes: 16 additions & 4 deletions build/webpack.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,23 @@ module.exports = {
loader: 'url-loader',
query: {
limit: 10000,
name: path.posix.join('static', '[name].[hash:7].[ext]')
name: path.posix.join('./lib/theme-default', '[name].[hash:7].[ext]')
}
},
{
test: /\.svg(\?\S*)?$/,
loader: 'url-loader',
query: {
limit: 10000,
name: path.posix.join('static', '[name].[hash:7].[ext]')
name: path.posix.join('./lib/theme-default', '[name].[hash:7].[ext]')
}
},
{
test: /\.(gif|png|jpe?g)(\?\S*)?$/,
loader: 'url-loader',
query: {
limit: 10000,
name: path.posix.join('static', '[name].[hash:7].[ext]')
name: path.posix.join('./lib/theme-default', '[name].[hash:7].[ext]')
}
}
]
Expand All @@ -92,7 +92,19 @@ module.exports = {
'./lib/ams.js'
),
destination: './dist/ams@' + pkg.version + '.js'
}]
}, {
source: path.join(
process.cwd(),
'./lib/theme-default'
),
destination: './dist/theme-default'
}],
archive: [ // 将dist文件夹打包成ams.zip并放在dist目录
{
source: './dist/',
destination: './dist/ams.zip'
}
]
}
}),
// new BundleAnalyzerPlugin()
Expand Down
102 changes: 102 additions & 0 deletions build/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
const path = require('path');
const webpack = require('webpack');
const { VueLoaderPlugin } = require('vue-loader');
const vueLoaderConfig = require('./vue-loader.conf');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');

const config = require('./config');

module.exports = {
mode: 'development',
entry: {
app: ['./examples/dev/app.js']
},
devtool: 'cheap-source-map',
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@ams-team/ams': path.join(__dirname, '../')
}
},
devServer: {
clientLogLevel: 'warning',
historyApiFallback: true,
hot: true,
compress: true,
host: 'localhost',
port: config.dev.port,
open: true,
overlay: { warnings: false, errors: true },
publicPath: '/',
proxy: {},
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: false
},
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Content-Type'
}
},
module: {
rules: [
{
test: /\.(jsx?|babel|es6)$/,
include: process.cwd(),
exclude: config.jsexclude,
loader: 'babel-loader'
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.css$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader']
},
{
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.otf|ttf|woff2?|eot(\?\S*)?$/,
loader: 'url-loader',
query: {
limit: 10000,
name: path.posix.join('./lib/theme-default', '[name].[hash:7].[ext]')
}
},
{
test: /\.svg(\?\S*)?$/,
loader: 'url-loader',
query: {
limit: 10000,
name: path.posix.join('./lib/theme-default', '[name].[hash:7].[ext]')
}
},
{
test: /\.(gif|png|jpe?g)(\?\S*)?$/,
loader: 'url-loader',
query: {
limit: 10000,
name: path.posix.join('./lib/theme-default', '[name].[hash:7].[ext]')
}
}
]
},
plugins: [
new VueLoaderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin(),
new FriendlyErrorsPlugin({
compilationSuccessInfo: {
messages: [
`Your application is running here: http://localhost:${config.dev.port}`
]
}
})
// new BundleAnalyzerPlugin()
]
};
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"private": true,
"dependencies": {
"@ams-team/ams": "^0.15.6",
"@ams-team/ams": "^0.15.11",
"@ams-team/block-ams-config": "latest",
"@ams-team/block-chart": "latest",
"@ams-team/json-stringify": "latest",
Expand All @@ -17,7 +17,7 @@
"node-sass": "^4.12.0",
"sass-loader": "^7.1.0",
"vue-highlight.js": "^3.1.0",
"vuepress": "^1.0.0-alpha.47"
"vuepress": "^1.0.4"
},
"devDependencies": {
"vuepress-plugin-flowchart": "^1.4.3"
Expand Down
125 changes: 125 additions & 0 deletions docs/zh-CN/.vuepress/components/api/field/block.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
export default {
getSetView: {
resources: {
getSetView: {
api: {
prefix: '/test/',
create: 'create'
},
fields: {
datetime: {
label: '时间',
type: 'datetime',
get(value) {
// 格式化成13位时间戳(datetime组件)
console.log('get', value);
return Number(value.slice(5));
},
set(value) {
// localValue可能为Date或者是时间戳
console.log('set', value);
return 'date:' + (value instanceof Date ? value.getTime() : value);
},
view(value) {
// 格式化13位时间戳
console.log('view', value);
return value.slice(5) / 1000;
}
},
testSelect: {
type: 'select',
label: '字符串多选',
props: {
multiple: true,
options: {
'a': '黄金糕',
'b': '双皮奶',
'c': '蚵仔煎'
}
}
},
testArraySelect: {
type: 'select',
label: '数组多选',
props: {
multiple: true,
options: {
'a': '黄金糕',
'b': '双皮奶',
'c': '蚵仔煎'
}
},
get(value) {
console.log('get', value);
if (typeof value === 'string') {
return value.split(',');
}
return value;
},
set(value) {
// localValue可能为Date或者是时间戳
console.log('set', value);
if (typeof value === 'string') {
return value.split(',');
}
return value;
}
}
}
}
},
blocks: {
editGetSetView: {
data: {
datetime: '',
testSelect: '',
testArraySelect: []
},
type: 'form',
resource: 'getSetView',
ctx: 'edit',
style: {
width: '50%'
},
events: {
init: 'initFn',
submit: '@alert @create'
},
actions: {
initFn() {
setTimeout(() => {
this.data.datetime = 'date:1546278503030';
this.data.testSelect = 'a,b'
this.data.testArraySelect = ['a', 'b'];
}, 1000);
},
alert() {
alert('提交的表单数据是:' + JSON.stringify(this.data));
}
},
operations: {
submit: {
type: 'button',
label: '提交'
}
}
},
viewGetSetView: {
data: {
datetime: 'date:1546278503030',
testSelect: 'a,b',
testArraySelect: ['a', 'b']
},
type: 'form',
resource: 'getSetView',
ctx: 'view',
style: {
width: '50%'
},
events: {
submit: '@create'
}
}
}
}
};
40 changes: 40 additions & 0 deletions docs/zh-CN/.vuepress/components/api/field/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>
Loading

0 comments on commit cbcf015

Please sign in to comment.