diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..021c2576 --- /dev/null +++ b/.babelrc @@ -0,0 +1,12 @@ +{ + "presets": [ + "stage-0", + [ + "env", + { + "loose": true, + "exclude": ["transform-es2015-typeof-symbol"] + } + ] + ] +} diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..02f75fc9 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +dist +example/dist +node_modules diff --git a/.eslintrc b/.eslintrc index 4d5b1e7d..9e65cafc 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,44 +1,17 @@ { - "extends": "airbnb", - "globals": { - "getApp": false, - "getCurrentPages": false, - "Page": false, - "Component": false, - "App": false, - "wx": false, - "Behavior": false - }, - "parser": "babel-eslint", - "rules": { - "no-extend-native": 0, - "no-shadow": 0, - "no-loop-func": 0, - "no-console": 0, - "no-var": 0, - "vars-on-top": 0, - "new-cap": 0, - "no-used-var": 0, - "semi": [2, "always"], - "camelcase": 1, - "prefer-template": 0, - "eqeqeq": 0, - "max-len": 0, - "react/prefer-stateless-function": 0, - "comma-dangle": 0, - "func-names": 0, - "prefer-const": 0, - "arrow-body-style": 0, - "no-param-reassign": 0, - "no-return-assign": 0, - "consistent-return": 0, - "no-unused-expressions": 0, - "no-underscore-dangle": 0, - "no-use-before-define": 0, - "no-new": 0, - "no-multi-assign": 0, - "class-methods-use-this": 0, - "no-plusplus": 0, - "prefer-promise-reject-errors": 0 - } + "root": true, + "globals": { + "getApp": false, + "getCurrentPages": false, + "Page": false, + "Component": false, + "App": false, + "wx": false, + "Behavior": false + }, + "extends": ["plugin:vue-libs/recommended"], + "rules": { + "semi": ["error", "always"], + "space-before-function-paren": ["error", "never"] + } } diff --git a/.gitignore b/.gitignore index 5fe7b059..e77dd828 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ assets/icons/build assets/icons/svg example/dist website/dist +docs/dist \ No newline at end of file diff --git a/README.md b/README.md index dabb37a6..761db85d 100644 --- a/README.md +++ b/README.md @@ -1,127 +1,115 @@

-有赞logo -

-

- 项目logo + logo +

-

高颜值、好用、易扩展的小程序 UI 库

+

+ logo +

+

轻量、可靠的小程序 UI 组件库

+--- ## 概述 -[ZanUI-WeApp](https://youzan.github.io/zanui-weapp)是有赞移动 Web UI 规范 `ZanUI` 的小程序现实版本,结合了微信的视觉规范,为用户提供更加统一的使用感受。 -现已包含 badge、btn、card、cell、dialog、icon、label、noticebar、panel、popup、switch、tab、toast、toptips 等组件或元素。具体可以扫描下方小程序二维码,体验组件库示例 Demo - -![ZanUI-WeApp 演示](https://img.yzcdn.cn/public_files/2017/10/30/554dd940eb1a269d4ac9133e78ae321f.jpg?imageView2/2/w/300/h/300) - -更多背景介绍,请移步 [我们写的介绍文章](http://tech.youzan.com/zanui-weapp/)。 - -## 下载 -``` bash -git clone https://github.com/youzan/zanui-weapp.git -``` +[Vant Weapp](https://youzan.github.io/vant-weapp) 是有赞移动端组件库 [Vant](https://github.com/youzan/vant) 的小程序版本,两者基于相同的视觉规范,提供一致的 API 接口,助力开发者快速搭建小程序应用。 ## 预览 -1. 在 zanui-weapp 根目录下运行 -``` bash + +扫描下方小程序二维码,体验组件库示例: + + + +## 文档 + +[https://youzan.github.io/vant-weapp](https://youzan.github.io/vant-weapp) + +## 迁移指南 + +Vant Weapp 是基于有赞 Zanui 组件库进行的品牌升级,对于仍在使用 Zanui 的用户,建议逐渐使用 Vant Weapp 替换原有的组件。 + +Zanui 后续会进入维护状态,仓库地址为:[https://github.com/youzan/zanui-weapp](https://github.com/youzan/zanui-weapp) + +## 使用之前 + +使用 Vant Weapp 前,请确保你已经学习过微信官方的 [小程序简易教程](https://mp.weixin.qq.com/debug/wxadoc/dev/) 和 [自定义组件介绍](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/)。 + +## 安装 + +### 方式一. 通过 npm 安装 (推荐) + +小程序已经支持使用 npm 安装第三方包,详见 [npm 支持](https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html?search-key=npm) + +```bash +# npm +npm i vant-weapp -S --production + +# yarn +yarn add vant-weapp --production +``` + +### 方式二. 下载代码 + +直接通过 git 下载 Vant Weapp 源代码,并将`dist`目录拷贝到自己的项目中 +```bash +git clone https://github.com/youzan/vant-weapp.git +``` + +## 使用组件 + +以按钮组件为例,只需要在 json 文件中引入按钮对应的自定义组件即可 + +```json +{ + "usingComponents": { + "van-button": "/path/to/vant-weapp/dist/button/index" + } +} +``` + +接着就可以在 wxml 中直接使用组件 + +```xml +按钮 +``` + +## 在开发者工具中预览 + +```bash # 安装项目依赖 npm install + # 执行组件编译 npm run dev ``` -2. 打开[微信web开发者工具](https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html),'本地小程序项目 - 添加项目',把 zanui-weapp/example 目录添加进去就可以预览示例demo了。 -![](https://img.yzcdn.cn/public_files/2017/02/08/a5e6445075826183659742cc6946c477.png) +打开[微信开发者工具](https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html),把`vant-weapp/example`目录添加进去就可以预览示例了。 -## 使用 +## 链接 -1. 使用 [ZanUI-WeApp] 前请确保已经学习过微信官方的 [小程序简易教程] 和 [小程序框架介绍]。 -2. 然后用 [Bower] 将 [ZanUI-WeApp] 添加到你的项目中使用。 -3. 你也可以 fork 出一份你自己的 [ZanUI-WeApp],这样可以获得更稳定的代码和更方便的进行个性定制。 - -我们推荐在你的`app.wxss`直接引入`zanui-weapp/dist/index.wxss`。 - -详细使用文档,请参考 [快速上手](https://youzan.github.io/zanui-weapp) - -### 组件分类介绍 -根据功能的不同,可以将组件大致的分为2类: - -#### 1. 正常引用 - -如按钮组件,只需要在页面中引入按钮自定义组件即可 -```json -{ - "usingComponents": { - "zan-button": "/path/to/zanui-weapp/dist/btn/index" - } -} -``` -```html - - -按钮 -``` - -![](https://img.yzcdn.cn/public_files/2017/02/08/1b1e39ed3dc6b63519a68ba1e2650cfc.png) - - -#### 2. API类组件 - -如 Toast 组件,需要先在页面上引入自定义组件。之后在逻辑运行时,直接调用方法即可展示 -```json -{ - "usingComponents": { - "zan-toast": "/path/to/zanui-weapp/dist/toast/index" - } -} -``` -```html - -``` - -将对应的 Toast 的函数引入页面,就可以直接调用来展示 Toast 了 - -```js -// example/toast/index.js - -const Toast = require('/path/to/zanui-weapp/dist/toast/toast'); - -Page({ - showToast() { - Toast({ - selector: '#zan-toast-test', - message: 'toast内容' - }); - } -}); - -``` - -![](https://img.yzcdn.cn/public_files/2017/02/08/ada80798c88df08060ce96964384e88e.png) - -更多示例可以在项目的`example`目录中查看 - -## 旧版组件库 -组件库现在已经全部升级至自定义组件,如果项目暂时无法切换到自定义组件的形式,可以将使用的版本号设置为低于 3.0.0。同时,旧的代码会在分支 old_code 上保留一段时间。 - -建议新使用的用户,直接以自定义组件形式接入 +* [意见反馈](https://github.com/youzan/vant-weapp/issues) +* [加入我们](https://job.youzan.com) +* [更新日志](#/changelog) +* [Vue 组件库](https://github.com/youzan/vant) +* [React 组件库](https://www.youzanyun.com/zanui/zent) ## 微信讨论群 -欢迎大家在微信上联系我们,添加下方微信并注明『交流 ZanUI-WeApp』即可 +欢迎大家在微信上联系我们,添加下方微信并注明『交流 vant-weapp』即可 ## 开源协议 + 本项目基于 [MIT](https://zh.wikipedia.org/wiki/MIT%E8%A8%B1%E5%8F%AF%E8%AD%89)协议,请自由地享受和参与开源。 ## 贡献 -如果你有好的意见或建议,欢迎给我们提 [issue] 或 [PR],为优化 [ZanUI-Weapp] 贡献力量 +如果你有好的意见或建议,欢迎给我们提 [issue] 或 [PR],为优化 [vant-weapp] 贡献力量 -[ZanUI-WeApp]: https://github.com/youzan/zanui-weapp -[issue]: https://github.com/youzan/zanui-weapp/issues/new -[PR]: https://github.com/youzan/zanui-weapp/compare +[vant-weapp]: https://github.com/youzan/vant-weapp +[issue]: https://github.com/youzan/vant-weapp/issues/new +[PR]: https://github.com/youzan/vant-weapp/compare [MIT]: http://opensource.org/licenses/MIT [小程序简易教程]: https://mp.weixin.qq.com/debug/wxadoc/dev/ [小程序框架介绍]: https://mp.weixin.qq.com/debug/wxadoc/dev/framework/MINA.html +[微信开发者工具]: https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html diff --git a/assets/icons/icons.sketch b/assets/icons/icons.sketch deleted file mode 100644 index 22a5a81d..00000000 Binary files a/assets/icons/icons.sketch and /dev/null differ diff --git a/bower.json b/bower.json deleted file mode 100644 index 53a5ba89..00000000 --- a/bower.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "zanui-weapp", - "authors": [ - "Nino ", - "Pangxie " - ], - "directory": "zanui-weapp", - "description": "A UI Library for Weapp", - "main": "zan", - "license": "MIT", - "homepage": "", - "ignore": [ - "**/.*", - ".github", - "assets", - "example", - "node_modules", - "packages", - "scripts", - "website", - "postcss.config.js", - "package.json", - "*.md", - "*.log" - ] -} diff --git a/scripts/build-components.js b/build/build-components.js similarity index 74% rename from scripts/build-components.js rename to build/build-components.js index 7e0fd05e..7dbcf8ed 100644 --- a/scripts/build-components.js +++ b/build/build-components.js @@ -1,5 +1,5 @@ const path = require('path'); -const extracter = require('./utils/extracter'); +const extracter = require('./extracter'); extracter({ src: path.resolve(__dirname, '../packages'), diff --git a/scripts/utils/build.js b/build/build.js similarity index 53% rename from scripts/utils/build.js rename to build/build.js index 628bc525..6817070b 100644 --- a/scripts/utils/build.js +++ b/build/build.js @@ -1,3 +1,4 @@ +const path = require('path'); const gulp = require('gulp'); const postcss = require('gulp-postcss'); const cssmin = require('gulp-clean-css'); @@ -10,30 +11,31 @@ const options = gutil.env; const isProduction = process.env.NODE_ENV === 'production'; gulp.task('compile-css', () => { - return gulp.src(['../../packages/**/*.pcss', '!../../packages/**/_*.pcss']) + return gulp + .src(['../packages/**/*.pcss', '!../packages/**/_*.pcss']) .pipe(postcss()) .pipe(cssmin()) - .pipe(rename((path) => { - path.extname = '.wxss'; - })) + .pipe( + rename(path => { + path.extname = '.wxss'; + }) + ) .pipe(gulp.dest(options.dist)); }); gulp.task('compile-js', () => { - return gulp.src(['../../packages/**/*.js']) - .pipe(removeLogging({ - methods: isProduction ? ['log', 'info'] : [] - })) - .pipe(babel({ - plugins: [['transform-object-rest-spread', { useBuiltIns: true }]], - presets: [ - ['env', { - loose: true, - useBuiltIns: true, - exclude: ['transform-es2015-typeof-symbol'] - }] - ] - })) + return gulp + .src(['../packages/**/*.js']) + .pipe( + removeLogging({ + methods: isProduction ? ['log', 'info'] : [] + }) + ) + .pipe( + babel({ + extends: path.join(__dirname, '../.babelrc') + }) + ) .pipe(gulp.dest(options.dist)); }); diff --git a/build/dev.js b/build/dev.js new file mode 100644 index 00000000..6439829e --- /dev/null +++ b/build/dev.js @@ -0,0 +1,42 @@ +const fs = require('fs-extra'); +const glob = require('fast-glob'); +const path = require('path'); +const tips = '// This file is auto gererated by build/build-entry.js'; +const root = path.join(__dirname, '../'); +const join = dir => path.join(root, dir); +const serve = require('webpack-serve'); +const config = require('./webpack.dev'); +const extracter = require('./extracter'); + +// generate webpack entry file for markdown docs +function buildDocsEntry() { + const output = join('docs/src/docs-entry.js'); + const getName = fullPath => fullPath.replace(/(\/README)|(\.md)/g, '').split('/').pop(); + const docs = glob + .sync([ + join('docs/**/*.md'), + join('packages/**/*.md'), + '!**/node_modules/**' + ]) + .map(fullPath => { + const name = getName(fullPath); + return `'${name}': () => import('${path.relative(join('docs/src'), fullPath)}')`; + }); + + const content = `${tips} +export default { + ${docs.join(',\n ')} +}; +`; + fs.writeFileSync(output, content); +} + +buildDocsEntry(); + +serve({}, { config }); + +extracter({ + src: path.resolve(__dirname, '../packages'), + dist: path.resolve(__dirname, '../example/dist'), + watch: true +}); diff --git a/scripts/utils/extracter.js b/build/extracter.js similarity index 75% rename from scripts/utils/extracter.js rename to build/extracter.js index 33ec0c2e..90e18b08 100644 --- a/scripts/utils/extracter.js +++ b/build/extracter.js @@ -2,9 +2,9 @@ const path = require('path'); const fs = require('fs-extra'); const nodeWatch = require('node-watch'); const debounce = require('lodash/debounce'); -require('shelljs/global'); +const shelljs = require('shelljs'); -module.exports = function (config = {}) { +module.exports = function(config = {}) { // 清空 dist 目录 fs.emptyDirSync(config.dist); @@ -15,7 +15,7 @@ module.exports = function (config = {}) { } }; -const debouncedFunc = debounce(config => extracter(config), 500); +const debouncedFunc = debounce(config => extracter(config), 100); function extracter(config = {}) { // 复制 src @@ -27,5 +27,5 @@ function extracter(config = {}) { }); // 编译 js wxss 文件 - exec(`gulp build --gulpfile scripts/utils/build.js --dist ${config.dist} --color`); + shelljs.exec(`gulp build --gulpfile build/build.js --dist ${config.dist} --color`); } diff --git a/scripts/release.sh b/build/release.sh similarity index 89% rename from scripts/release.sh rename to build/release.sh index 56ad5cfe..e1fa7520 100644 --- a/scripts/release.sh +++ b/build/release.sh @@ -13,11 +13,10 @@ then echo "Releasing $VERSION ..." # build - npm run components + npm run build:lib # commit build - git add -A - git commit -m "[build] $VERSION" + git commit -am "[build] $VERSION" # commit npm version $VERSION --message "[release] $VERSION" diff --git a/build/webpack.dev.js b/build/webpack.dev.js new file mode 100644 index 00000000..02c5d964 --- /dev/null +++ b/build/webpack.dev.js @@ -0,0 +1,94 @@ +const path = require('path'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const ProgressBarPlugin = require('progress-bar-webpack-plugin'); +const { VueLoaderPlugin } = require('vue-loader'); + +module.exports = { + mode: 'development', + entry: { + 'vant-docs': './docs/src/index.js', + 'vant-preview': './docs/src/preview.js' + }, + output: { + path: path.join(__dirname, '../docs/dist'), + publicPath: '/', + chunkFilename: 'async_[name].js' + }, + stats: { + modules: false, + children: false + }, + serve: { + open: true, + host: '0.0.0.0', + devMiddleware: { + logLevel: 'warn' + }, + hotClient: { + logLevel: 'warn' + } + }, + resolve: { + extensions: ['.js', '.vue', '.css'], + alias: { + packages: path.join(__dirname, '../packages') + } + }, + module: { + rules: [ + { + test: /\.vue$/, + use: [ + { + loader: 'vue-loader', + options: { + compilerOptions: { + preserveWhitespace: false + } + } + } + ] + }, + { + test: /\.js$/, + exclude: /node_modules/, + use: 'babel-loader' + }, + { + test: /\.(css|postcss)$/, + use: [ + 'style-loader', + 'css-loader', + 'postcss-loader' + ] + }, + { + test: /\.md$/, + use: [ + 'vue-loader', + 'fast-vue-md-loader' + ] + }, + { + test: /\.(ttf|svg)$/, + loader: 'url-loader' + } + ] + }, + plugins: [ + new VueLoaderPlugin(), + new ProgressBarPlugin(), + new HtmlWebpackPlugin({ + chunks: ['vant-docs'], + template: 'docs/src/index.tpl', + filename: 'index.html', + inject: true + }), + new HtmlWebpackPlugin({ + chunks: ['vant-preview'], + template: 'docs/src/index.tpl', + filename: 'preview.html', + inject: true + }) + ] +}; diff --git a/build/webpack.doc.js b/build/webpack.doc.js new file mode 100644 index 00000000..3146723c --- /dev/null +++ b/build/webpack.doc.js @@ -0,0 +1,14 @@ +const path = require('path'); +const config = require('./webpack.dev.js'); + +delete config.serve; + +module.exports = Object.assign(config, { + mode: 'production', + output: { + path: path.join(__dirname, '../docs/dist'), + publicPath: 'https://youzan.github.io/vant/', + filename: '[name].[hash:8].js', + chunkFilename: 'async_[name].[chunkhash:8].js' + } +}); diff --git a/changelog.md b/changelog.md deleted file mode 100644 index b59a6a5e..00000000 --- a/changelog.md +++ /dev/null @@ -1,339 +0,0 @@ -`ZanUI-WeApp` 严格遵循 [Semantic Versioning 2.0.0](http://semver.org/lang/zh-CN/) 语义化版本规范。 - -## [v3.1.0](https://github.com/youzan/zanui-weapp/tree/v3.1.0) (2018-07-31) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v3.0.10...v3.1.0) - -**Breaking changes** - -- 修复 Field 组件错误的事件参数 [\#391](https://github.com/youzan/zanui-weapp/pull/391) ([pangxie1991](https://github.com/pangxie1991)) - -**Improvements** - -- 示例小程序增加 tree-select DEMO [\#392](https://github.com/youzan/zanui-weapp/pull/392) ([pangxie1991](https://github.com/pangxie1991)) -- 文档增加 timeout 的单位标注 [\#389](https://github.com/youzan/zanui-weapp/pull/389) ([upupming](https://github.com/upupming)) -- 修复文档 Card 示例页 title 错误标注为 CAPSULE 的问题 [\#385](https://github.com/youzan/zanui-weapp/pull/385) ([Fyerl](https://github.com/Fyerl)) - - -## [v3.0.10](https://github.com/youzan/zanui-weapp/tree/v3.0.10) (2018-07-27) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v3.0.9...v3.0.10) - -**new feature** - -- cell-group 组件支持显示上下边框 [\#380](https://github.com/youzan/zanui-weapp/pull/380) ([rex-zsd](https://github.com/rex-zsd)) - -**Improvements** - -- Cell 组件去掉 title 区域的最小宽度 [\#376](https://github.com/youzan/zanui-weapp/pull/376) ([ylethe](https://github.com/ylethe)) - - -## [v3.0.9](https://github.com/youzan/zanui-weapp/tree/v3.0.9) (2018-07-17) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v3.0.8...v3.0.9) - -**new feature** -- Cell 组件新增 no-border 属性 [\#369](https://github.com/youzan/zanui-weapp/pull/369) ([realywithoutname](https://github.com/realywithoutname)) -- 新增 Radio 组件 [\#354](https://github.com/youzan/zanui-weapp/pull/354) ([jerryni](https://github.com/jerryni)) - -**Improvements** - -- 优化 Dialog 弹窗组件对 open 信息的处理 [\#366](https://github.com/youzan/zanui-weapp/pull/366) ([pangxie1991](https://github.com/pangxie1991)) -- 优化 Cell 组件默认 slot 展示效果,添加 title 区域自定义 class [\#360](https://github.com/youzan/zanui-weapp/pull/360) ([ylethe](https://github.com/ylethe)) -- 优化 LoadMore 组件表现及展示效果 [\#337](https://github.com/youzan/zanui-weapp/pull/337) ([zgrong](https://github.com/zgrong)) - -**Bug Fixes** - -- 修复文档错误 [\#370](https://github.com/youzan/zanui-weapp/pull/370) ([jerryni](https://github.com/jerryni)) - - -## [v3.0.8](https://github.com/youzan/zanui-weapp/tree/v3.0.8) (2018-07-12) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v3.0.7...v3.0.8) - -**Bug Fixes** - -- 修复 Toast 组件未传入 timeout 时不会自动关闭的问题 [\#361](https://github.com/youzan/zanui-weapp/pull/361) ([pangxie1991](https://github.com/pangxie1991)) -- 修复 DateTime 组件接收非标准 iso 格式时间初始时间错误的问题 [\#355](https://github.com/youzan/zanui-weapp/pull/355) ([realywithoutname](https://github.com/realywithoutname)) - -## [v3.0.7](https://github.com/youzan/zanui-weapp/tree/v3.0.7) (2018-07-10) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v3.0.6...v3.0.7) - -**new feature** -- \[new feature\] 新增 checkbox 组件 [\#341](https://github.com/youzan/zanui-weapp/pull/341) ([jerryni](https://github.com/jerryni)) - -**Improvements** - -- Tab 组件支持选中项自动滑动到中间位置 [\#347](https://github.com/youzan/zanui-weapp/pull/347) ([rex-zsd](https://github.com/rex-zsd)) -- 增加部分组件自定义样式类,方便自定义样式 [\#352](https://github.com/youzan/zanui-weapp/pull/352) ([pangxie1991](https://github.com/pangxie1991)) - -**Bug Fixes** - -- 修复 Toptips 组件在示例小程序上的问题 [\#351](https://github.com/youzan/zanui-weapp/pull/351) ([pangxie1991](https://github.com/pangxie1991)) -- 修复 DateTime 组件设置初始时间时报错的问题 [\#350](https://github.com/youzan/zanui-weapp/pull/350) ([realywithoutname](https://github.com/realywithoutname)) - -## [v3.0.6](https://github.com/youzan/zanui-weapp/tree/v3.0.6) (2018-07-08) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v3.0.5...v3.0.6) - -**new feature** -- 新增搜索组件 [\#321](https://github.com/youzan/zanui-weapp/pull/321) ([jerryni](https://github.com/jerryni)) -- 新增分类选择组件 [\#346](https://github.com/youzan/zanui-weapp/pull/346) ([pangxie1991](https://github.com/pangxie1991)) - -**Improvements** - -- 优化 Tab 组件宽度样式 [\#336](https://github.com/youzan/zanui-weapp/pull/336) ([pangxie1991](https://github.com/pangxie1991)) - -**Bug Fixes** - -- 修复由于 autoprefixer 移除旧浏览器代码导致的兼容性问题 [\#335](https://github.com/youzan/zanui-weapp/pull/335) ([realywithoutname](https://github.com/realywithoutname)) -- 修复 select、popup 组件文档错误,改善部分组件文档一致性 [\#334](https://github.com/youzan/zanui-weapp/pull/334) ([rex-zsd](https://github.com/rex-zsd)) -- 修复 Toast 组件的 timeout 不支持小于0的问题 [\#340](https://github.com/youzan/zanui-weapp/pull/340) ([rex-zsd](https://github.com/rex-zsd)) - - -## [v3.0.5](https://github.com/youzan/zanui-weapp/tree/v3.0.5) (2018-06-29) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v3.0.4...v3.0.5) - -**Improvements** - -- 优化 popup 遮罩层相关文档 [\#324](https://github.com/youzan/zanui-weapp/pull/324) ([jerryni](https://github.com/jerryni)) -- 优化 Button,支持 disabled 属性 [\#323](https://github.com/youzan/zanui-weapp/pull/323) ([jerryni](https://github.com/jerryni)) -- Steps 组件扩展自定义class [\#311](https://github.com/youzan/zanui-weapp/pull/311) ([jerryni](https://github.com/jerryni)) -- Stepper 组件 size 属性支持 small middle large [\#306](https://github.com/youzan/zanui-weapp/pull/306) ([jerryni](https://github.com/jerryni)) -- 优化 Field 组件在列表中输入框表现 [\#296](https://github.com/youzan/zanui-weapp/pull/296) ([pangxie1991](https://github.com/pangxie1991)) -- datepicker 使用原生 picker-view 重写 [\#294](https://github.com/youzan/zanui-weapp/pull/294) ([realywithoutname](https://github.com/realywithoutname)) -- Noticebar 组件支持动态更新text [\#314](https://github.com/youzan/zanui-weapp/pull/314) ([rex-zsd](https://github.com/rex-zsd)) -- datetime-picker 组件在 demo 中增加 datetime 示例入口 [\#313](https://github.com/youzan/zanui-weapp/pull/313) ([rex-zsd](https://github.com/rex-zsd)) - - -**Bug Fixes** - -- 修复 Toptips 在自定义组件中引入报错的问题,backgroundColor不生效的问题 [\#318](https://github.com/youzan/zanui-weapp/pull/318) ([Yuliang-Lee](https://github.com/Yuliang-Lee)) -- Dialog 组件修复取消按钮只生效一次的问题 [\#312](https://github.com/youzan/zanui-weapp/pull/312) ([rex-zsd](https://github.com/rex-zsd)) -- 修复使用 dialog 组件的页面切换路由时会报错的问题 \(\#289\) [\#310](https://github.com/youzan/zanui-weapp/pull/310) ([rex-zsd](https://github.com/rex-zsd)) -- 修复按钮点击态时没有任何变化的问题 [\#287](https://github.com/youzan/zanui-weapp/pull/287) ([jerryni](https://github.com/jerryni)) -- Stepper 组件增加在数字越界前进行校验的操作 [\#283](https://github.com/youzan/zanui-weapp/pull/283) ([icarusion](https://github.com/icarusion)) - - -## [v3.0.4](https://github.com/youzan/zanui-weapp/tree/v3.0.4) (2018-05-29) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v3.0.3...v3.0.4) - -**Improvements** - -- 使用 babel 简单编译 dist 里面的文件 [\#285](https://github.com/youzan/zanui-weapp/pull/285) ([pangxie1991](https://github.com/pangxie1991)) -- Cell 组件增加默认白色背景色 [\#270](https://github.com/youzan/zanui-weapp/pull/270) ([pangxie1991](https://github.com/pangxie1991)) -- Stepper 文档添加size属性说明 [\#260](https://github.com/youzan/zanui-weapp/pull/260) ([jerryni](https://github.com/jerryni)) - -**Bug Fixes** - -- 修复 Switch 组件示例名称错误 [\#281](https://github.com/youzan/zanui-weapp/pull/281) ([dlhandsome](https://github.com/dlhandsome)) -- 修复 Steps 2步样式 && 优化文档 [\#274](https://github.com/youzan/zanui-weapp/pull/274) ([jerryni](https://github.com/jerryni)) -- 修复 Stepper 组件不传 max 情况下,默认置灰的问题 [\#269](https://github.com/youzan/zanui-weapp/pull/269) ([pangxie1991](https://github.com/pangxie1991)) - - -## [v3.0.3](https://github.com/youzan/zanui-weapp/tree/v3.0.3) (2018-05-21) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v3.0.2...v3.0.3) - -**Bug Fixes** -- 修复 cell 组件点击事情触发两次的问题 [\#259](https://github.com/youzan/zanui-weapp/pull/259) ([pangxie1991](https://github.com/pangxie1991)) -- 修复 Cell 组件文档错误 [\#254](https://github.com/youzan/zanui-weapp/pull/254) ([pangxie1991](https://github.com/pangxie1991)) - -**Improvements** -- Dialog 组件中的按钮支持 open-type 属性 [\#247](https://github.com/youzan/zanui-weapp/pull/247) ([artecher](https://github.com/artecher)) - -## [v3.0.2](https://github.com/youzan/zanui-weapp/tree/v3.0.2) (2018-05-13) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v3.0.1...v3.0.2) - -**new feature** -- 新增时间选择组件 [\#164](https://github.com/youzan/zanui-weapp/pull/164) ([realywithoutname](https://github.com/realywithoutname)) - -**Improvements** -- Icon 中增加减号图标 [\#235](https://github.com/youzan/zanui-weapp/pull/235) ([pangxie1991](https://github.com/pangxie1991)) -- Toast 组件新增默认配置设置 [\#229](https://github.com/youzan/zanui-weapp/pull/229) ([pangxie1991](https://github.com/pangxie1991)) -- Btn 组件和 Field 组件支持原生属性 [\#219](https://github.com/youzan/zanui-weapp/pull/219) ([pangxie1991](https://github.com/pangxie1991)) - -**Bug Fixes** -- 修复部分情况下 cell 边框不出现的问题 [\#237](https://github.com/youzan/zanui-weapp/pull/237) ([pangxie1991](https://github.com/pangxie1991))) -- 修复 Badge 组件在页面数据改变了以后,组件中的数字不变的问题 [\#225](https://github.com/youzan/zanui-weapp/pull/225) ([pangxie1991](https://github.com/pangxie1991)) -- 修复 Stepper 组件文档错误 [\#222](https://github.com/youzan/zanui-weapp/pull/222) ([jerryni](https://github.com/jerryni)) -- 修复部分文档错误 [\#239](https://github.com/youzan/zanui-weapp/pull/239) ([pangxie1991](https://github.com/pangxie1991)) - - -## [v3.0.1](https://github.com/youzan/zanui-weapp/tree/v3.0.1) (2018-04-30) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v3.0.0...v3.0.1) - -**Bug Fixes** -- 修复 gulp 插件引起的组件编译后代码异常的问题 [\#209](https://github.com/youzan/zanui-weapp/pull/209) ([pangxie1991](https://github.com/pangxie1991)) - -## [v3.0.0](https://github.com/youzan/zanui-weapp/tree/v3.0.0) (2018-04-28) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.4.7...v3.0.0) - -**Breaking changes** -- 升级组件库至自定义组件 [\#199](https://github.com/youzan/zanui-weapp/pull/199) ([pangxie1991](https://github.com/pangxie1991)) - -**Improvements** -- Field 组件新增 maxlength 属性 [\#203](https://github.com/youzan/zanui-weapp/pull/203) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.4.7](https://github.com/youzan/zanui-weapp/tree/v2.4.7) (2018-03-25) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.4.6...v2.4.7) - -**Improvements** - -- Field 组件新增 disabled 属性支持 [\#150](https://github.com/youzan/zanui-weapp/pull/150) ([pangxie1991](https://github.com/pangxie1991)) -- 移除多余的日志信息 [\#144](https://github.com/youzan/zanui-weapp/pull/144) ([pangxie1991](https://github.com/pangxie1991)) -- 新增小程序文档网页 [\#142](https://github.com/youzan/zanui-weapp/pull/142) ([realywithoutname](https://github.com/realywithoutname)) - -**Bug Fixes** - -- 修复弹窗被输入框文本覆盖的问题 [\#149](https://github.com/youzan/zanui-weapp/pull/149) ([pangxie1991](https://github.com/pangxie1991)) -- 修复 NoticeBar 组件动画播放异常的问题 [\#155](https://github.com/youzan/zanui-weapp/pull/155) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.4.6](https://github.com/youzan/zanui-weapp/tree/v2.4.6) (2018-02-27) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.4.5...v2.4.6) - -**new feature** - -- 新增 Field 组件 focus 自动聚焦属性 [\#135](https://github.com/youzan/zanui-weapp/pull/135) ([pangxie1991](https://github.com/pangxie1991)) -- 新增文档网站 [\#126](https://github.com/youzan/zanui-weapp/pull/126) ([realywithoutname](https://github.com/realywithoutname)) - -**Bug Fixes** - -- 修复 Field 组件圆角输入框,边框显示问题 [\#134](https://github.com/youzan/zanui-weapp/pull/134) ([pangxie1991](https://github.com/pangxie1991)) -- 修复 Noticebar 组件元素查询返回空,导致报错的问题 [\#130](https://github.com/youzan/zanui-weapp/pull/130) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.4.5](https://github.com/youzan/zanui-weapp/tree/v2.4.5) (2018-02-07) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.4.4...v2.4.5) - -**Improvements** - -- Toast 新增支持图标展示 [\#121](https://github.com/youzan/zanui-weapp/pull/121) ([pangxie1991](https://github.com/pangxie1991)) -- 新增 Actionsheet 文档 [\#118](https://github.com/youzan/zanui-weapp/pull/118) ([pangxie1991](https://github.com/pangxie1991)) -- 修复 Toptips 组件未显示时,下拉页面展示问题 [\#116](https://github.com/youzan/zanui-weapp/pull/116) ([pangxie1991](https://github.com/pangxie1991)) -- Field 使用示例中增加 picker-view 使用 [\#115](https://github.com/youzan/zanui-weapp/pull/115) ([pangxie1991](https://github.com/pangxie1991)) -- 修复 Toptips 组件在控制台里的报错 [\#114](https://github.com/youzan/zanui-weapp/pull/114) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.4.4](https://github.com/youzan/zanui-weapp/tree/v2.4.4) (2018-01-12) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.4.3...v2.4.4) - -**Improvements** - -- Actionsheet 组件新增 open-type 支持 [\#106](https://github.com/youzan/zanui-weapp/pull/106) ([pangxie1991](https://github.com/pangxie1991)) -- Select 组件新增支持 form 中 submit 使用 [\#104](https://github.com/youzan/zanui-weapp/pull/104) ([pangxie1991](https://github.com/pangxie1991)) -- 新增 Actionsheet 行动按钮组件 [\#97](https://github.com/youzan/zanui-weapp/pull/97) ([pangxie1991](https://github.com/pangxie1991)) - -**Bug Fixes** -- 修复 actionsheet 隐藏时阻挡页面元素点击 [\#99](https://github.com/youzan/zanui-weapp/pull/99) ([yun77op](https://github.com/yun77op)) -- 修复 Badge 组件纵向对齐问题 [\#96](https://github.com/youzan/zanui-weapp/pull/96) ([pangxie1991](https://github.com/pangxie1991)) -- 修复合并生命周期extend函数并修改tab文档 [\#93](https://github.com/youzan/zanui-weapp/pull/93) ([Tinysymphony](https://github.com/Tinysymphony)) - -## [v2.4.3](https://github.com/youzan/zanui-weapp/tree/v2.4.3) (2017-12-28) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.4.2...v2.4.3) - -**Improvements** - -- 增加无边框的panel样式 [\#92](https://github.com/youzan/zanui-weapp/pull/92) ([w91](https://github.com/w91)) -- 增加支持合并page生命周期的extend函数 [\#90](https://github.com/youzan/zanui-weapp/pull/90) ([w91](https://github.com/w91)) - -## [v2.4.2](https://github.com/youzan/zanui-weapp/tree/v2.4.2) (2017-12-25) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.4.1...v2.4.2) - -**Bug Fixes** - -- 修复 Popup 组件弹出的 container 遮挡主页事件bug [\#83](https://github.com/youzan/zanui-weapp/pull/83) ([shoung6](https://github.com/shoung6)) -- 修复 Tab 组件不滚动情况下,文字过长显示问题 [\#81](https://github.com/youzan/zanui-weapp/pull/81) ([pangxie1991](https://github.com/pangxie1991)) - -**Improvements** - -- 新增使用文档 [\#88](https://github.com/youzan/zanui-weapp/pull/88) ([pangxie1991](https://github.com/pangxie1991)) -- 部分组件边框实现修改 [\#87](https://github.com/youzan/zanui-weapp/pull/87) ([pangxie1991](https://github.com/pangxie1991)) - - -## [v2.4.1](https://github.com/youzan/zanui-weapp/tree/v2.4.1) (2017-12-13) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.4.0...v2.4.1) - -**Bug Fixes** - -- 修复 Tag 展现问题 [\#77](https://github.com/youzan/zanui-weapp/pull/77) ([pangxie1991](https://github.com/pangxie1991)) - -**Improvements** - -- 新增 tag 组件文档 [\#76](https://github.com/youzan/zanui-weapp/pull/76) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.4.0](https://github.com/youzan/zanui-weapp/tree/v2.4.0) (2017-12-09) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.3.5...v2.4.0) - -**Improvements** - -- 新增 Field 组件对于 Form 的支持 [\#75](https://github.com/youzan/zanui-weapp/pull/75) ([pangxie1991](https://github.com/pangxie1991)) -- 新增 Field 组件文档 [\#73](https://github.com/youzan/zanui-weapp/pull/73) ([pangxie1991](https://github.com/pangxie1991)) -- 修复 Dialog 组件自定义按钮时按钮点击回调的问题 [\#72](https://github.com/youzan/zanui-weapp/pull/72) ([pangxie1991](https://github.com/pangxie1991)) -- Quantity 组件更名为 Stepper [\#70](https://github.com/youzan/zanui-weapp/pull/70) ([pangxie1991](https://github.com/pangxie1991)) -- Dialog 组件和 Popup 组件重构 [\#69](https://github.com/youzan/zanui-weapp/pull/69) ([pangxie1991](https://github.com/pangxie1991)) -- 修正部分文档错误 [\#68](https://github.com/youzan/zanui-weapp/pull/68) ([0x01f7](https://github.com/0x01f7)) -- Label组件重命名为 Tag 并整理样式 [\#55](https://github.com/youzan/zanui-weapp/pull/55) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.3.5](https://github.com/youzan/zanui-weapp/tree/v2.3.5) (2017-11-27) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.3.4...v2.3.5) - -**Improvements** - -- 修复 zan-icon-new 展示 [\#66](https://github.com/youzan/zanui-weapp/pull/66) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.3.4](https://github.com/youzan/zanui-weapp/tree/v2.3.4) (2017-11-24) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.3.3...v2.3.4) - -**Improvements** - -- 增加新的 Icon [\#65](https://github.com/youzan/zanui-weapp/pull/65) ([pangxie1991](https://github.com/pangxie1991)) -- 加回 cart 图标 [\#64](https://github.com/youzan/zanui-weapp/pull/64) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.3.3](https://github.com/youzan/zanui-weapp/tree/v2.3.3) (2017-11-20) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.3.2...v2.3.3) - -**Improvements** - -- 新增部分 icon [\#63](https://github.com/youzan/zanui-weapp/pull/63) ([pangxie1991](https://github.com/pangxie1991)) -- Field 增加 value 传入支持 [\#60](https://github.com/youzan/zanui-weapp/pull/60) ([pangxie1991](https://github.com/pangxie1991)) -- 修复 capsule 样式问题 [\#51](https://github.com/youzan/zanui-weapp/pull/51) ([everywill](https://github.com/everywill)) -- 增加组件使用文档 [\#50](https://github.com/youzan/zanui-weapp/pull/50) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.3.2](https://github.com/youzan/zanui-weapp/tree/v2.3.2) (2017-11-02) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.3.1...v2.3.2) - -**Improvements** - -- 更新 Icon 中 shop 图标 [\#45](https://github.com/youzan/zanui-weapp/pull/45) ([pangxie1991](https://github.com/pangxie1991)) -- 新增 layout 组件 [\#43](https://github.com/youzan/zanui-weapp/pull/43) ([pangxie1991](https://github.com/pangxie1991)) -- Field 组件中 Input 事件支持升级 [\#42](https://github.com/youzan/zanui-weapp/pull/42) ([pangxie1991](https://github.com/pangxie1991)) -- 增加 css 编译,方便组件书写 [\#40](https://github.com/youzan/zanui-weapp/pull/40) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.3.1](https://github.com/youzan/zanui-weapp/tree/v2.3.1) (2017-10-27) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.3.0...v2.3.1) - -**Bug Fixes** - -- 修复 Field 组件多行展示样式问题 [\#39](https://github.com/youzan/zanui-weapp/pull/39) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.3.0](https://github.com/youzan/zanui-weapp/tree/v2.3.0) (2017-10-26) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.2.0...v2.3.0) - -**Breaking Change** - -- icon 整理 & 新增 [\#38](https://github.com/youzan/zanui-weapp/pull/38) ([pangxie1991](https://github.com/pangxie1991)) -- 新增 Field 组件, 代替原有 Form 组件 [\#37](https://github.com/youzan/zanui-weapp/pull/37) ([pangxie1991](https://github.com/pangxie1991)) -- 新增 Select 组件,代替原有 Check_label 组件 [\#36](https://github.com/youzan/zanui-weapp/pull/36) ([pangxie1991](https://github.com/pangxie1991)) - -## [v2.2.0](https://github.com/youzan/zanui-weapp/tree/v2.2.0) (2017-10-15) -[Full Changelog](https://github.com/youzan/zanui-weapp/compare/v2.1.1...v2.2.0) - -**Bug Fixes** - -- 多页面情况下,TopTips 无法自动清除 [\#20](https://github.com/youzan/zanui-weapp/issues/20) - -**Improvements** - -- \[new feature\] 增加发布脚本 [\#35](https://github.com/youzan/zanui-weapp/pull/35) ([pangxie1991](https://github.com/pangxie1991)) -- \[new feature\] 增加Capsule, Noticebar, Popup;修正Dialog在非最外层情况下引入的样式问题;更新readme。 [\#32](https://github.com/youzan/zanui-weapp/pull/32) ([everywill](https://github.com/everywill)) -- \[new feature\] 增加单选 和一个验证码的样式 [\#30](https://github.com/youzan/zanui-weapp/pull/30) ([muzea](https://github.com/muzea)) -- \[new feature\] Docs: 文档更新 [\#29](https://github.com/youzan/zanui-weapp/pull/29) ([pangxie1991](https://github.com/pangxie1991)) - -## 2.1.0 - -**Improvements** - -- 新增`switch`组件 diff --git a/dist/actionsheet/index.js b/dist/actionsheet/index.js index 46056ed7..65d2d8b3 100644 --- a/dist/actionsheet/index.js +++ b/dist/actionsheet/index.js @@ -1,42 +1,38 @@ 'use strict'; Component({ - externalClasses: ['mask-class', 'container-class'], properties: { + show: Boolean, + title: String, + cancelText: String, actions: { type: Array, value: [] }, - show: { - type: Boolean, - value: false - }, - cancelWithMask: { + overlay: { type: Boolean, value: true }, - cancelText: { - type: String, - value: '' + closeOnClickOverlay: { + type: Boolean, + value: true } }, + methods: { - onMaskClick: function onMaskClick() { - if (this.data.cancelWithMask) { - this.cancelClick(); + onSelect: function onSelect(event) { + var index = event.currentTarget.dataset.index; + + var item = this.data.actions[index]; + if (item && !item.disabled && !item.loading) { + this.triggerEvent('select', item); } }, - cancelClick: function cancelClick() { + onCancel: function onCancel() { this.triggerEvent('cancel'); }, - handleBtnClick: function handleBtnClick(_ref) { - var _ref$currentTarget = _ref.currentTarget, - currentTarget = _ref$currentTarget === undefined ? {} : _ref$currentTarget; - - var dataset = currentTarget.dataset || {}; - var index = dataset.index; - - this.triggerEvent('actionclick', { index: index }); + onClose: function onClose() { + this.triggerEvent('close'); } } }); \ No newline at end of file diff --git a/dist/actionsheet/index.json b/dist/actionsheet/index.json index 9d70aaf4..19bf9891 100644 --- a/dist/actionsheet/index.json +++ b/dist/actionsheet/index.json @@ -1,6 +1,8 @@ { "component": true, "usingComponents": { - "zan-btn": "../btn/index" + "van-icon": "../icon/index", + "van-popup": "../popup/index", + "van-loading": "../loading/index" } } diff --git a/dist/actionsheet/index.wxml b/dist/actionsheet/index.wxml index de6b80d0..a4dbfed8 100644 --- a/dist/actionsheet/index.wxml +++ b/dist/actionsheet/index.wxml @@ -1,39 +1,38 @@ - - - - - - - - {{ item.name }} - - {{ item.subname }} - - - - - + + + {{ title }} + + + - {{ cancelText }} + + {{ item.name }} + {{ item.subname }} + + - + + {{ cancelText }} + + + + + diff --git a/dist/actionsheet/index.wxss b/dist/actionsheet/index.wxss index d580e64c..509b0874 100644 --- a/dist/actionsheet/index.wxss +++ b/dist/actionsheet/index.wxss @@ -1 +1 @@ -.zan-actionsheet{background-color:#f8f8f8}.zan-actionsheet__mask{position:fixed;top:0;left:0;right:0;bottom:0;z-index:10;background:rgba(0,0,0,.7);display:none}.zan-actionsheet__container{position:fixed;left:0;right:0;bottom:0;background:#f8f8f8;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);-webkit-transform-origin:center;transform-origin:center;-webkit-transition:all .2s ease;transition:all .2s ease;z-index:11;opacity:0;visibility:hidden}.zan-actionsheet__btn{margin-bottom:0!important}.zan-actionsheet__footer .zan-actionsheet__btn{background:#fff}.zan-actionsheet__btn-content{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-pack:center;justify-content:center}.zan-actionsheet__subname{color:#999}.zan-actionsheet__name,.zan-actionsheet__subname{height:45px;line-height:45px}.zan-actionsheet__btn.zan-btn:last-child::after{border-bottom-width:0}.zan-actionsheet__subname{margin-left:2px;font-size:12px}.zan-actionsheet__footer{margin-top:10px}.zan-actionsheet__btn--loading .zan-actionsheet__subname{color:transparent}.zan-actionsheet--show .zan-actionsheet__container{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);visibility:visible}.zan-actionsheet--show .zan-actionsheet__mask{display:block} \ No newline at end of file +.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-actionsheet{color:#333;max-height:90%;overflow-y:auto;-webkit-overflow-scrolling:touch;background-color:#f8f8f8}.van-actionsheet--withtitle{background-color:#fff}.van-actionsheet__cancel,.van-actionsheet__item{height:50px;line-height:50px;font-size:16px;text-align:center;background-color:#fff}.van-actionsheet__cancel:active,.van-actionsheet__item:active{background-color:#e8e8e8}.van-actionsheet__item--disabled{color:#c9c9c9}.van-actionsheet__item--disabled:active{background-color:#fff}.van-actionsheet__subname{font-size:12px;color:#666;margin-left:5px}.van-actionsheet__loading{display:inline-block}.van-actionsheet__cancel{margin-top:10px}.van-actionsheet__header{font-size:16px;line-height:44px;text-align:center}.van-actionsheet__close{top:0;right:0;padding:0 15px;font-size:18px;color:#999;position:absolute;line-height:inherit} \ No newline at end of file diff --git a/dist/badge-group/index.js b/dist/badge-group/index.js new file mode 100644 index 00000000..eafd75bc --- /dev/null +++ b/dist/badge-group/index.js @@ -0,0 +1,66 @@ +'use strict'; + +var _relations; + +var BADGE_PATH = '../badge/index'; + +Component({ + externalClasses: ['custom-class'], + + relations: (_relations = {}, _relations[BADGE_PATH] = { + type: 'descendant', + + linked: function linked(target) { + this.data.badges.push(target); + this.setActive(); + }, + unlinked: function unlinked(target) { + this.data.badges = this.data.badges.filter(function (item) { + return item !== target; + }); + this.setActive(); + } + }, _relations), + + properties: { + active: { + type: Number, + value: 0, + observer: function observer() { + this.setActive(); + } + } + }, + + data: { + badges: [] + }, + + attached: function attached() { + this.currentActive = -1; + }, + + + methods: { + setActive: function setActive(badge) { + var active = this.data.active; + + if (badge) { + active = this.data.badges.indexOf(badge); + } + + if (active === this.currentActive) { + return; + } + + if (this.currentActive !== -1) { + this.triggerEvent('change', active); + } + + this.currentActive = active; + this.data.badges.forEach(function (badge, index) { + badge.setActive(index === active); + }); + } + } +}); \ No newline at end of file diff --git a/dist/btn-group/index.json b/dist/badge-group/index.json similarity index 100% rename from dist/btn-group/index.json rename to dist/badge-group/index.json diff --git a/dist/badge-group/index.wxml b/dist/badge-group/index.wxml new file mode 100644 index 00000000..04a0c8f3 --- /dev/null +++ b/dist/badge-group/index.wxml @@ -0,0 +1,3 @@ + + + diff --git a/dist/badge-group/index.wxss b/dist/badge-group/index.wxss new file mode 100644 index 00000000..3ed133e7 --- /dev/null +++ b/dist/badge-group/index.wxss @@ -0,0 +1 @@ +.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-badge-group{width:85px} \ No newline at end of file diff --git a/dist/badge/index.js b/dist/badge/index.js index 7672b940..173780da 100644 --- a/dist/badge/index.js +++ b/dist/badge/index.js @@ -1,27 +1,30 @@ 'use strict'; -var DEFAULT_COLOR = '#fff'; -var DEFAULT_BACKGROUND_COLOR = '#f44'; -var DEFAULT_FONT_SIZE = 10; -var DEFAULT_BOX_SHADOW = '0 0 0 2px #fff'; +var _relations; + +var BADGE_GROUP_PATH = '../badge-group/index'; Component({ + externalClasses: ['custom-class'], + + relations: (_relations = {}, _relations[BADGE_GROUP_PATH] = { + type: 'ancestor' + }, _relations), + properties: { - color: { - type: String, - value: DEFAULT_COLOR + info: Number, + title: String + }, + + methods: { + onTap: function onTap() { + var group = this.getRelationNodes(BADGE_GROUP_PATH)[0]; + if (group) { + group.setActive(this); + } }, - backgroundColor: { - type: String, - value: DEFAULT_BACKGROUND_COLOR - }, - fontSize: { - type: Number, - value: DEFAULT_FONT_SIZE - }, - boxShadow: { - type: String, - value: DEFAULT_BOX_SHADOW + setActive: function setActive(active) { + this.setData({ active: active }); } } }); \ No newline at end of file diff --git a/dist/badge/index.wxml b/dist/badge/index.wxml index 322f1ba7..2630776c 100644 --- a/dist/badge/index.wxml +++ b/dist/badge/index.wxml @@ -1,8 +1,4 @@ - - - - + + {{ info }} + {{ title }} diff --git a/dist/badge/index.wxss b/dist/badge/index.wxss index 4e52bf72..6b90d9ad 100644 --- a/dist/badge/index.wxss +++ b/dist/badge/index.wxss @@ -1 +1 @@ -.zan-badge{position:relative}.zan-badge__text{position:absolute;top:-.8em;right:0;height:1.6em;min-width:1.6em;line-height:1.6;padding:0 .4em;font-size:20px;border-radius:.8em;background:#f44;color:#fff;text-align:center;white-space:nowrap;-webkit-transform:translateX(50%) scale(.5);transform:translateX(50%) scale(.5);-webkit-transform-origin:center;transform-origin:center;z-index:10;box-shadow:0 0 0 2px #fff;box-sizing:border-box} \ No newline at end of file +.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-badge{display:block;overflow:hidden;font-size:14px;line-height:1.4;-webkit-user-select:none;user-select:none;color:#666;word-break:break-all;box-sizing:border-box;padding:20px 12px 20px 9px;background-color:#f8f8f8;border-left:3px solid transparent}.van-badge:active{background-color:#e8e8e8}.van-badge::after{border-bottom-width:1px}.van-badge--active{font-weight:700;color:#333;border-color:#f44}.van-badge--active::after{border-right-width:1px}.van-badge--active,.van-badge--active:active{background-color:#fff}.van-badge__info{position:absolute;top:2px;right:2px;color:#fff;font-size:10px;font-weight:400;-webkit-transform:scale(.8);transform:scale(.8);text-align:center;box-sizing:border-box;padding:0 6px;min-width:18px;line-height:18px;border-radius:9px;background-color:#f44} \ No newline at end of file diff --git a/dist/btn-group/index.js b/dist/btn-group/index.js deleted file mode 100644 index 18a7de24..00000000 --- a/dist/btn-group/index.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -Component({ - relations: { - '../btn/index': { - type: 'child', - linked: function linked() { - updateBtnChild.call(this); - }, - linkChange: function linkChange() { - updateBtnChild.call(this); - }, - unlinked: function unlinked() { - updateBtnChild.call(this); - } - } - } -}); - -function updateBtnChild() { - var btns = this.getRelationNodes('../btn/index'); - - if (btns.length > 0) { - var lastIndex = btns.length - 1; - - btns.forEach(function (btn, index) { - btn.switchLastButtonStatus(index === lastIndex); - }); - } -} \ No newline at end of file diff --git a/dist/btn-group/index.wxml b/dist/btn-group/index.wxml deleted file mode 100644 index aa76fe4d..00000000 --- a/dist/btn-group/index.wxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/dist/btn-group/index.wxss b/dist/btn-group/index.wxss deleted file mode 100644 index 88223f09..00000000 --- a/dist/btn-group/index.wxss +++ /dev/null @@ -1,3 +0,0 @@ -.btn-group { - margin: 15px; -} diff --git a/dist/btn/index.js b/dist/btn/index.js deleted file mode 100644 index 1ec7783a..00000000 --- a/dist/btn/index.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -var nativeButtonBehavior = require('./native-button-behaviors'); - -Component({ - externalClasses: ['custom-class', 'theme-class'], - behaviors: [nativeButtonBehavior], - relations: { - '../btn-group/index': { - type: 'parent', - linked: function linked() { - this.setData({ inGroup: true }); - }, - unlinked: function unlinked() { - this.setData({ inGroup: false }); - } - } - }, - properties: { - type: { - type: String, - value: '' - }, - size: { - type: String, - value: '' - }, - plain: { - type: Boolean, - value: false - }, - disabled: { - type: Boolean, - value: false - }, - loading: { - type: Boolean, - value: false - } - }, - - data: { - inGroup: false, - isLast: false - }, - - methods: { - handleTap: function handleTap() { - if (this.data.disabled) { - this.triggerEvent('disabledclick'); - return; - } - this.triggerEvent('btnclick'); - }, - switchLastButtonStatus: function switchLastButtonStatus() { - var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - this.setData({ isLast: isLast }); - } - } -}); \ No newline at end of file diff --git a/dist/btn/index.wxss b/dist/btn/index.wxss deleted file mode 100644 index 84d50b9e..00000000 --- a/dist/btn/index.wxss +++ /dev/null @@ -1 +0,0 @@ -.zan-btn{position:relative;color:#333;background-color:#fff;padding-left:15px;padding-right:15px;border-radius:2px;font-size:16px;line-height:45px;height:45px;box-sizing:border-box;text-decoration:none;text-align:center;vertical-align:middle;overflow:visible}.zan-btn--group{margin-bottom:10px}.zan-btn::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5;border-width:1px;border-radius:4px}.zan-btn--primary{color:#fff;background-color:#4b0}.zan-btn--primary::after{border-color:#0a0}.zan-btn--warn{color:#fff;background-color:#f85}.zan-btn--warn::after{border-color:#f85}.zan-btn--danger{color:#fff;background-color:#f44}.zan-btn--danger::after{border-color:#e33}.zan-btn--small{display:inline-block;height:30px;line-height:30px;font-size:12px}.zan-btn--small.zan-btn--group{margin-bottom:0;margin-right:5px}.zan-btn--mini{display:inline-block;line-height:21px;height:22px;font-size:10px;padding-left:5px;padding-right:5px}.zan-btn--mini.zan-btn--group{margin-bottom:0;margin-right:5px}.zan-btn--large{border-radius:0;border:none;line-height:50px;height:50px}.zan-btn--large.zan-btn--group{margin-bottom:0}.zan-btn--plain.zan-btn{background-color:transparent}.zan-btn--plain.zan-btn--primary{color:#06bf04}.zan-btn--plain.zan-btn--warn{color:#f60}.zan-btn--plain.zan-btn--danger{color:#f44}.button-hover{opacity:.9}.zan-btn--loading{color:transparent;opacity:1}.zan-btn--loading::before{position:absolute;left:50%;top:50%;content:' ';width:16px;height:16px;margin-left:-8px;margin-top:-8px;border:3px solid #e5e5e5;border-color:#666 #e5e5e5 #e5e5e5 #e5e5e5;border-radius:8px;box-sizing:border-box;-webkit-animation:btn-spin .6s linear;animation:btn-spin .6s linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.zan-btn--danger.zan-btn--loading::before,.zan-btn--primary.zan-btn--loading::before,.zan-btn--warn.zan-btn--loading::before{border-color:#fff rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.1)}@-webkit-keyframes btn-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes btn-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.zan-btn.zan-btn--disabled{color:#999!important;background:#f8f8f8!important;border-color:#e5e5e5!important;cursor:not-allowed!important;opacity:1!important}.zan-btn.zan-btn--disabled::after{border-color:#e5e5e5!important}.zan-btn--group.zan-btn--last{margin-bottom:0;margin-right:0} \ No newline at end of file diff --git a/dist/btn/native-button-behaviors.js b/dist/btn/native-button-behaviors.js deleted file mode 100644 index 3bd240d8..00000000 --- a/dist/btn/native-button-behaviors.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict'; - -module.exports = Behavior({ - properties: { - loading: Boolean, - // 在自定义组件中,无法与外界的 form 组件联动,暂时不开放 - // formType: String, - openType: String, - appParameter: String, - // 暂时不开放,直接传入无法设置样式 - // hoverClass: { - // type: String, - // value: 'button-hover' - // }, - hoverStopPropagation: Boolean, - hoverStartTime: { - type: Number, - value: 20 - }, - hoverStayTime: { - type: Number, - value: 70 - }, - lang: { - type: String, - value: 'en' - }, - sessionFrom: { - type: String, - value: '' - }, - sendMessageTitle: String, - sendMessagePath: String, - sendMessageImg: String, - showMessageCard: String - }, - methods: { - bindgetuserinfo: function bindgetuserinfo() { - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref$detail = _ref.detail, - detail = _ref$detail === undefined ? {} : _ref$detail; - - this.triggerEvent('getuserinfo', detail); - }, - bindcontact: function bindcontact() { - var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref2$detail = _ref2.detail, - detail = _ref2$detail === undefined ? {} : _ref2$detail; - - this.triggerEvent('contact', detail); - }, - bindgetphonenumber: function bindgetphonenumber() { - var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref3$detail = _ref3.detail, - detail = _ref3$detail === undefined ? {} : _ref3$detail; - - this.triggerEvent('getphonenumber', detail); - }, - bindopensetting: function bindopensetting() { - var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref4$detail = _ref4.detail, - detail = _ref4$detail === undefined ? {} : _ref4$detail; - - this.triggerEvent('opensetting', detail); - }, - binderror: function binderror() { - var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref5$detail = _ref5.detail, - detail = _ref5$detail === undefined ? {} : _ref5$detail; - - this.triggerEvent('error', detail); - } - } -}); \ No newline at end of file diff --git a/dist/button/behaviors.js b/dist/button/behaviors.js new file mode 100644 index 00000000..b0e8bf3b --- /dev/null +++ b/dist/button/behaviors.js @@ -0,0 +1,65 @@ +'use strict'; + +module.exports = Behavior({ + properties: { + loading: Boolean, + // 在自定义组件中,无法与外界的 form 组件联动,暂时不开放 + // formType: String, + openType: String, + appParameter: String, + // 暂时不开放,直接传入无法设置样式 + // hoverClass: { + // type: String, + // value: 'button-hover' + // }, + hoverStopPropagation: Boolean, + hoverStartTime: { + type: Number, + value: 20 + }, + hoverStayTime: { + type: Number, + value: 70 + }, + lang: { + type: String, + value: 'en' + }, + sessionFrom: { + type: String, + value: '' + }, + sendMessageTitle: String, + sendMessagePath: String, + sendMessageImg: String, + showMessageCard: String + }, + + methods: { + bindgetuserinfo: function bindgetuserinfo() { + var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + this.triggerEvent('getuserinfo', event.detail || {}); + }, + bindcontact: function bindcontact() { + var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + this.triggerEvent('contact', event.detail || {}); + }, + bindgetphonenumber: function bindgetphonenumber() { + var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + this.triggerEvent('getphonenumber', event.detail || {}); + }, + bindopensetting: function bindopensetting() { + var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + this.triggerEvent('opensetting', event.detail || {}); + }, + binderror: function binderror() { + var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + this.triggerEvent('error', event.detail || {}); + } + } +}); \ No newline at end of file diff --git a/dist/button/index.js b/dist/button/index.js new file mode 100644 index 00000000..eaae6602 --- /dev/null +++ b/dist/button/index.js @@ -0,0 +1,79 @@ +'use strict'; + +var nativeBehaviors = require('./behaviors'); +var classnames = require('../common/classnames'); + +var observer = function observer() { + this.setClasses(); +}; + +Component({ + externalClasses: ['custom-class', 'loading-class'], + + behaviors: [nativeBehaviors], + + properties: { + type: { + type: String, + value: 'default', + observer: observer + }, + size: { + type: String, + value: 'normal', + observer: observer + }, + plain: { + type: Boolean, + value: false, + observer: observer + }, + disabled: { + type: Boolean, + value: false, + observer: observer + }, + loading: { + type: Boolean, + value: false, + observer: observer + }, + block: { + type: Boolean, + value: false, + observer: observer + } + }, + + attached: function attached() { + this.setClasses(); + }, + + + methods: { + onTap: function onTap(event) { + if (!this.data.disabled && !this.data.loading) { + this.triggerEvent('tap', event); + } + }, + setClasses: function setClasses() { + var _data = this.data, + type = _data.type, + size = _data.size, + plain = _data.plain, + disabled = _data.disabled, + loading = _data.loading, + block = _data.block; + + this.setData({ + classes: classnames('van-button--' + type, 'van-button--' + size, { + 'van-button--block': block, + 'van-button--plain': plain, + 'van-button--loading': loading, + 'van-button--disabled': disabled, + 'van-button--untapable': disabled || loading + }) + }); + } + } +}); \ No newline at end of file diff --git a/packages/checkbox/index.json b/dist/button/index.json similarity index 56% rename from packages/checkbox/index.json rename to dist/button/index.json index fc0d0bf9..cae21702 100644 --- a/packages/checkbox/index.json +++ b/dist/button/index.json @@ -1,6 +1,6 @@ { "component": true, "usingComponents": { - "zan-icon": "../icon/index" + "van-loading": "../loading/index" } -} +} \ No newline at end of file diff --git a/packages/btn/index.wxml b/dist/button/index.wxml similarity index 65% rename from packages/btn/index.wxml rename to dist/button/index.wxml index 13d69d79..f49a8004 100644 --- a/packages/btn/index.wxml +++ b/dist/button/index.wxml @@ -1,5 +1,5 @@ diff --git a/dist/button/index.wxss b/dist/button/index.wxss new file mode 100644 index 00000000..cb30c3d5 --- /dev/null +++ b/dist/button/index.wxss @@ -0,0 +1 @@ +.van-button{position:relative;padding:0;display:inline-block;height:44px;line-height:42px;border-radius:3px;box-sizing:border-box;font-size:16px;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%}.van-button::after{content:" ";position:absolute;top:50%;left:50%;opacity:0;width:100%;height:100%;border:inherit;border-color:#000;background-color:#000;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-button:active::after{opacity:.3}.van-button--untapable::after{display:none}.van-button--default{color:#333;background-color:#fff;border:1px solid #e5e5e5}.van-button--primary{color:#fff;background-color:#4b0;border:1px solid #4b0}.van-button--danger{color:#fff;background-color:#f44;border:1px solid #f44}.van-button--warning{color:#fff;background-color:#f85;border:1px solid #f85}.van-button--plain{background-color:#fff}.van-button--plain.van-button--primary{color:#4b0}.van-button--plain.van-button--danger{color:#f44}.van-button--plain.van-button--warning{color:#f85}.van-button--large{width:100%;height:50px;line-height:48px}.van-button--normal{padding:0 15px;font-size:14px}.van-button--small{height:30px;padding:0 8px;min-width:60px;font-size:12px;line-height:28px}.van-button--loading .van-loading{display:inline-block}.van-button--loading .van-button__text{display:none}.van-button--mini{display:inline-block;width:50px;height:22px;line-height:20px;font-size:10px}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{width:100%;display:block}.van-button--disabled{color:#999;background-color:#e8e8e8;border:1px solid #e5e5e5} \ No newline at end of file diff --git a/dist/capsule/index.js b/dist/capsule/index.js deleted file mode 100644 index 7b8452cc..00000000 --- a/dist/capsule/index.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -Component({ - externalClasses: ['custom-class'], - /** - * 组件的属性列表 - * 用于组件自定义设置 - */ - properties: { - // 颜色状态 - type: { - type: String, - value: '' - }, - // 自定义颜色 - color: { - type: String, - value: '' - }, - // 左侧内容 - leftText: { - type: String, - value: '' - }, - // 右侧内容 - rightText: { - type: String, - value: '' - } - } -}); \ No newline at end of file diff --git a/dist/capsule/index.wxml b/dist/capsule/index.wxml deleted file mode 100644 index 68f3c1c3..00000000 --- a/dist/capsule/index.wxml +++ /dev/null @@ -1,17 +0,0 @@ - - - {{ leftText }} - {{ rightText }} - - - {{ leftText }} - {{ rightText }} - - - diff --git a/dist/capsule/index.wxss b/dist/capsule/index.wxss deleted file mode 100644 index c9e10642..00000000 --- a/dist/capsule/index.wxss +++ /dev/null @@ -1 +0,0 @@ -.zan-capsule{display:inline-block;font-size:12px;vertical-align:middle;line-height:19px;-webkit-transform:scale(.83);transform:scale(.83)}.zan-capsule__left,.zan-capsule__right{display:inline-block;line-height:17px;height:19px;vertical-align:middle;box-sizing:border-box}.zan-capsule__left{padding:0 2px;color:#fff;background:#999;border-radius:2px 0 0 2px;border:1rpx solid #999}.zan-capsule__right{padding:0 5px;color:#999;border-radius:0 2px 2px 0;border:1rpx solid #999}.zan-capsule--danger .zan-capsule__left{color:#fff;background:#f24544;border-color:#f24544}.zan-capsule--danger .zan-capsule__right{color:#f24544;border-color:#f24544} \ No newline at end of file diff --git a/dist/card/index.js b/dist/card/index.js index fbc3c037..432e131f 100644 --- a/dist/card/index.js +++ b/dist/card/index.js @@ -5,22 +5,18 @@ Component({ multipleSlots: true }, - externalClasses: ['card-class', 'thumb-class'], + externalClasses: ['custom-class', 'thumb-class', 'title-class', 'price-class', 'desc-class', 'num-class'], properties: { - useThumbSlot: { - type: Boolean, - value: false - }, - useDetailSlot: { - type: Boolean, - value: false - }, - thumb: String, - price: String, - title: String, - num: Number, + num: String, desc: String, - status: String + thumb: String, + title: String, + price: String, + centered: Boolean, + currency: { + type: String, + default: '¥' + } } }); \ No newline at end of file diff --git a/dist/card/index.wxml b/dist/card/index.wxml index 4ebc401f..019c7f23 100644 --- a/dist/card/index.wxml +++ b/dist/card/index.wxml @@ -1,33 +1,22 @@ - - - - - + + + + - - - - - - ¥ {{ price }} - - {{ title }} - - - - - x {{ num }} - - {{ desc }} - - - - - {{ status }} - - + + + {{ title }} + {{ currency }} {{ price }} + + + + {{ desc }} + x {{ num }} + + + + + + diff --git a/dist/card/index.wxss b/dist/card/index.wxss index 4874ec36..0d9d8c20 100644 --- a/dist/card/index.wxss +++ b/dist/card/index.wxss @@ -1 +1 @@ -.zan-c-red{color:#f44!important}.zan-c-gray{color:#c9c9c9!important}.zan-c-gray-dark{color:#999!important}.zan-c-gray-darker{color:#666!important}.zan-c-black{color:#333!important}.zan-c-blue{color:#38f!important}.zan-c-green{color:#06bf04!important}.zan-pull-left{float:left}.zan-pull-right{float:right}.zan-center{text-align:center}.zan-right{text-align:right}.zan-text-deleted{text-decoration:line-through}.zan-font-8{font-size:8px}.zan-font-10{font-size:10px}.zan-font-12{font-size:12px}.zan-font-14{font-size:14px}.zan-font-16{font-size:16px}.zan-font-18{font-size:18px}.zan-font-20{font-size:20px}.zan-font-22{font-size:22px}.zan-font-24{font-size:24px}.zan-font-26{font-size:26px}.zan-font-30{font-size:30px}.zan-font-bold{font-weight:700}.zan-arrow{position:absolute;right:15px;top:50%;display:inline-block;height:6px;width:6px;border-width:2px 2px 0 0;border-color:#c8c8c8;border-style:solid;-webkit-transform:translateY(-50%) matrix(.71,.71,-.71,.71,0,0);transform:translateY(-50%) matrix(.71,.71,-.71,.71,0,0)}.zan-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap:normal}.zan-ellipsis--l2{max-height:40px;line-height:20px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.zan-ellipsis--l3{max-height:60px;line-height:20px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.zan-clearfix{zoom:1}.zan-clearfix::after{content:'';display:table;clear:both}.zan-c-red{color:#f44}.zan-c-black{color:#000}.zan-c-green{color:#06bf04}.zan-c-blue{color:#38f}.zan-c-gray{color:#c9c9c9}.zan-c-gray-dark{color:#999}.zan-c-gray-darker{color:#666}.zan-hairline,.zan-hairline--bottom,.zan-hairline--left,.zan-hairline--right,.zan-hairline--surround,.zan-hairline--top,.zan-hairline--top-bottom{position:relative}.zan-hairline--bottom::after,.zan-hairline--left::after,.zan-hairline--right::after,.zan-hairline--surround::after,.zan-hairline--top-bottom::after,.zan-hairline--top::after,.zan-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.zan-hairline--top::after{border-top-width:1px}.zan-hairline--left::after{border-left-width:1px}.zan-hairline--right::after{border-right-width:1px}.zan-hairline--bottom::after{border-bottom-width:1px}.zan-hairline--top-bottom::after{border-width:1px 0}.zan-hairline--surround::after{border-width:1px}.zan-card{display:-webkit-box;display:flex;margin-left:0;padding:5px 15px;overflow:hidden;position:relative;font-size:14px}.zan-card__thumb{width:90px;height:90px;position:relative;margin-left:auto;margin-right:auto;overflow:hidden;background-size:cover}.zan-card__img{position:absolute;top:0;left:0;right:0;bottom:0;width:auto;height:auto;max-width:100%;max-height:100%}.zan-card__detail{-webkit-box-flex:1;flex:1;margin-left:10px;position:relative}.zan-card__detail-row{overflow:hidden;line-height:20px;min-height:20px;margin-bottom:3px}.zan-card__right-col{float:right}.zan-card__left-col{margin-right:80px} \ No newline at end of file +.van-card{color:#333;height:100px;font-size:16px;background:#fafafa;position:relative;box-sizing:border-box;padding:5px 15px 5px 115px}.van-card--center,.van-card__thumb{-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{top:5px;left:15px;width:90px;height:90px;position:absolute}.van-card__img{border:none;max-width:100%;max-height:100%}.van-card,.van-card__row,.van-card__thumb{display:-webkit-box;display:-webkit-flex;display:flex}.van-card__content{width:100%}.van-card__content--center{height:90px;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.van-card__desc,.van-card__title{line-height:20px;word-break:break-all}.van-card__title{max-height:40px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-card__desc{color:#666;font-size:12px;max-height:20px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-card__num,.van-card__price{-webkit-box-flex:1;-webkit-flex:1;flex:1;min-width:80px;line-height:20px;text-align:right}.van-card__price{font-size:14px}.van-card__num{color:#666;font-size:12px}.van-card__footer{right:15px;bottom:5px;position:absolute}.van-card__footer .van-button{margin-left:5px} \ No newline at end of file diff --git a/dist/cell-group/index.js b/dist/cell-group/index.js index 14aa1674..d182271e 100644 --- a/dist/cell-group/index.js +++ b/dist/cell-group/index.js @@ -1,75 +1,12 @@ 'use strict'; -var _relations; - -var CELL_PATH = '../cell/index'; -var FIELD_PATH = '../field/index'; - Component({ + externalClasses: ['custom-class'], + properties: { - titleWidth: { - type: Number, - value: null - }, border: { type: Boolean, - value: false - } - }, - relations: (_relations = {}, _relations[CELL_PATH] = { - type: 'child', - linked: function linked() { - this._updateIsLastElement(CELL_PATH); - }, - linkChanged: function linkChanged() { - this._updateIsLastElement(CELL_PATH); - }, - unlinked: function unlinked() { - this._updateIsLastElement(CELL_PATH); - } - }, _relations[FIELD_PATH] = { - type: 'child', - linked: function linked() { - this._updateIsLastElement(FIELD_PATH); - }, - linkChanged: function linkChanged() { - this._updateIsLastElement(FIELD_PATH); - }, - unlinked: function unlinked() { - this._updateIsLastElement(FIELD_PATH); - } - }, _relations), - - data: { - elementUpdateTimeout: 0 - }, - - methods: { - _updateIsLastElement: function _updateIsLastElement(childPath) { - var _this = this; - - // 用 setTimeout 减少计算次数 - if (this.data.elementUpdateTimeout > 0) { - return; - } - - var elementUpdateTimeout = setTimeout(function () { - _this.setData({ elementUpdateTimeout: 0 }); - var elements = _this.getRelationNodes(childPath); - var titleWidth = _this.properties.titleWidth; - - - if (elements.length > 0) { - var lastIndex = elements.length - 1; - - elements.forEach(function (cell, index) { - titleWidth && cell.setTitleWidth(titleWidth); - cell.updateIsLastElement(index === lastIndex); - }); - } - }); - - this.setData({ elementUpdateTimeout: elementUpdateTimeout }); + value: true } } }); \ No newline at end of file diff --git a/dist/cell-group/index.wxml b/dist/cell-group/index.wxml index f84d06f4..4ed34ace 100644 --- a/dist/cell-group/index.wxml +++ b/dist/cell-group/index.wxml @@ -1,3 +1,3 @@ - - + + diff --git a/dist/cell-group/index.wxss b/dist/cell-group/index.wxss index aec96ef3..9f445b65 100644 --- a/dist/cell-group/index.wxss +++ b/dist/cell-group/index.wxss @@ -1 +1 @@ -.cell-group{position:relative;background-color:#fff;overflow:hidden}.cell-group--with-border::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5;border-top-width:1px;border-bottom-width:1px} \ No newline at end of file +.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px} \ No newline at end of file diff --git a/dist/cell/index.js b/dist/cell/index.js index 13ebdf5e..e4fdd313 100644 --- a/dist/cell/index.js +++ b/dist/cell/index.js @@ -1,109 +1,42 @@ 'use strict'; -var warn = function warn(msg, getValue) { - console.warn(msg); -}; - Component({ - externalClasses: ['cell-class', 'title-class'], + externalClasses: ['custom-class', 'title-class', 'label-class', 'value-class', 'left-icon-class', 'right-icon-class'], + options: { multipleSlots: true }, - relations: { - '../cell-group/index': { - type: 'parent' - } - }, + properties: { - title: { - type: String, - description: '左侧标题' - }, - label: { - type: String, - description: '标题下方的描述信息' - }, - value: { - type: String, - description: '右侧内容' - }, - onlyTapFooter: { - type: Boolean, - description: '只有点击 footer 区域才触发 tab 事件' - }, - isLink: { - type: null, - value: '', - description: '是否展示右侧箭头并开启尝试以 url 跳转' - }, + title: null, + value: null, + url: String, + icon: String, + label: String, + center: Boolean, + isLink: Boolean, + required: Boolean, + tapable: Boolean, + titleWidth: String, + customStyle: String, + arrowDirection: String, linkType: { type: String, - value: 'navigateTo', - description: '链接类型,可选值为 navigateTo,redirectTo,switchTab,reLaunch' + value: 'navigateTo' }, - url: { - type: String, - value: '' - }, - noBorder: Boolean - }, - data: { - isLastCell: true, - titleWidth: 'auto' + border: { + type: Boolean, + value: true + } }, + methods: { - footerTap: function footerTap() { - // 如果并没有设置只点击 footer 生效,那就不需要额外处理。cell 上有事件会自动处理 - if (!this.data.onlyTapFooter) { - return; + onTap: function onTap() { + var url = this.data.url; + + if (url) { + wx[this.data.linkType]({ url: url }); } - - this.triggerEvent('tap', {}); - doNavigate.call(this); - }, - cellTap: function cellTap() { - // 如果只点击 footer 生效,那就不需要在 cell 根节点上处理 - if (this.data.onlyTapFooter) { - return; - } - - this.triggerEvent('tap', {}); - doNavigate.call(this); - }, - - - // 用于被 cell-group 更新,标志是否是最后一个 cell - updateIsLastElement: function updateIsLastElement(isLastCell) { - this.setData({ isLastCell: isLastCell }); - }, - - - // 设置统一的title区域宽度 - setTitleWidth: function setTitleWidth(titleWidth) { - this.setData({ - titleWidth: titleWidth + 'px' - }); } } -}); - -// 处理跳转 -function doNavigate() { - var _data$url = this.data.url, - url = _data$url === undefined ? '' : _data$url; - - var type = typeof this.data.isLink; - - if (!this.data.isLink || !url || url === 'true' || url === 'false') return; - - if (type !== 'boolean' && type !== 'string') { - warn('isLink 属性值必须是一个字符串或布尔值', this.data.isLink); - return; - } - - if (['navigateTo', 'redirectTo', 'switchTab', 'reLaunch'].indexOf(this.data.linkType) === -1) { - warn('linkType 属性可选值为 navigateTo,redirectTo,switchTab,reLaunch', this.data.linkType); - return; - } - wx[this.data.linkType].call(wx, { url: url }); -} \ No newline at end of file +}); \ No newline at end of file diff --git a/dist/cell/index.json b/dist/cell/index.json index 32640e0d..a9ab393a 100644 --- a/dist/cell/index.json +++ b/dist/cell/index.json @@ -1,3 +1,6 @@ { - "component": true + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } } \ No newline at end of file diff --git a/dist/cell/index.wxml b/dist/cell/index.wxml index dd7bc431..05dfa33f 100644 --- a/dist/cell/index.wxml +++ b/dist/cell/index.wxml @@ -1,25 +1,28 @@ - + + - - + + {{ title }} + {{ label }} + + + + + {{ value }} + - - {{ title }} - {{ label }} - + + - - - - - - {{ value }} - - - - - \ No newline at end of file + + diff --git a/dist/cell/index.wxss b/dist/cell/index.wxss index 565933b8..0edd9071 100644 --- a/dist/cell/index.wxss +++ b/dist/cell/index.wxss @@ -1 +1 @@ -.zan-cell{position:relative;padding:12px 15px;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;line-height:1.4;background-color:#fff;font-size:14px}.zan-cell::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5;border-bottom-width:1px;left:15px;right:0}.zan-cell__icon{margin-right:5px}.zan-cell__icon:empty{display:none}.zan-cell__title{padding-right:10px}.zan-cell__title:empty{display:none}.zan-cell__bd{-webkit-box-flex:1;flex:1}.zan-cell__text{line-height:24px;font-size:14px}.zan-cell__desc{line-height:1.2;font-size:12px;color:#666}.zan-cell__ft{position:relative;text-align:right;color:#666}.zan-cell__no-pading{padding:0}.zan-cell__no-pading .zan-cell__bd_padding{padding:12px 0 12px 15px}.zan-cell__no-pading .zan-cell__bd_padding .zan-form__input{height:26px}.zan-cell__no-pading .zan-cell__ft_padding{padding:12px 15px 12px 0}.zan-cell.last-cell::after,.zan-cell.no-border::after{display:none}.zan-cell--access .zan-cell__ft{padding-right:13px}.zan-cell--access .zan-cell__ft::after{position:absolute;top:50%;right:2px;content:" ";display:inline-block;height:6px;width:6px;border-width:2px 2px 0 0;border-color:#c8c8c8;border-style:solid;-webkit-transform:translateY(-50%) matrix(.71,.71,-.71,.71,0,0);transform:translateY(-50%) matrix(.71,.71,-.71,.71,0,0)}.zan-cell--switch{padding-top:6px;padding-bottom:6px} \ No newline at end of file +.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-cell{width:100%;display:-webkit-box;display:-webkit-flex;display:flex;padding:10px 15px;box-sizing:border-box;line-height:24px;position:relative;background-color:#fff;color:#333;font-size:14px}.van-cell::after{left:15px;right:0;width:auto;-webkit-transform:scale(1,.5);transform:scale(1,.5);border-bottom-width:1px}.van-cell-group{background-color:#fff}.van-cell__label{font-size:12px;line-height:1.2;color:#666}.van-cell__title,.van-cell__value{-webkit-box-flex:1;-webkit-flex:1;flex:1}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle}.van-cell__left-icon{font-size:16px;line-height:24px;margin-right:5px;vertical-align:middle}.van-cell__right-icon{color:#999;font-size:12px;line-height:24px;margin-left:5px}.van-cell__right-icon--left::before{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.van-cell__right-icon--up::before{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.van-cell__right-icon--down::before{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.van-cell--tapable:active{background-color:#e8e8e8}.van-cell--required{overflow:visible}.van-cell--required::before{content:'*';position:absolute;left:7px;font-size:14px;color:#f44}.van-cell--center{-webkit-box-align:center;-webkit-align-items:center;align-items:center} \ No newline at end of file diff --git a/dist/checkbox-group/index.js b/dist/checkbox-group/index.js deleted file mode 100644 index 09058960..00000000 --- a/dist/checkbox-group/index.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -var _relations; - -var CHECKBOX_PATH = '../checkbox/index'; - -Component({ - relations: (_relations = {}, _relations[CHECKBOX_PATH] = { - type: 'child', - linked: function linked() { - this.updateChildren(CHECKBOX_PATH); - } - }, _relations), - - data: { - elementUpdateTimeout: 0 - }, - - methods: { - updateChildren: function updateChildren(childPath) { - // 把checkbox标记为在group中,设置不同样式 - var elements = this.getRelationNodes(childPath); - - elements.forEach(function (checkbox, index) { - checkbox.updateData({ isInGroup: true }); - }); - } - } -}); \ No newline at end of file diff --git a/dist/checkbox-group/index.json b/dist/checkbox-group/index.json deleted file mode 100644 index 32640e0d..00000000 --- a/dist/checkbox-group/index.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "component": true -} \ No newline at end of file diff --git a/dist/checkbox-group/index.wxml b/dist/checkbox-group/index.wxml deleted file mode 100644 index a6ef51f8..00000000 --- a/dist/checkbox-group/index.wxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/dist/checkbox-group/index.wxss b/dist/checkbox-group/index.wxss deleted file mode 100644 index d2278289..00000000 --- a/dist/checkbox-group/index.wxss +++ /dev/null @@ -1 +0,0 @@ -.checkbox-group{padding-bottom:10px;background-color:#fff}.checkbox-group .zan-checkbox{margin-top:10px} \ No newline at end of file diff --git a/dist/checkbox/index.js b/dist/checkbox/index.js deleted file mode 100644 index 62160c07..00000000 --- a/dist/checkbox/index.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -var _relations; - -var CHECKBOX_GROUP_PATH = '../checkbox-group/index'; - -Component({ - externalClasses: ['checkbox-class'], - relations: (_relations = {}, _relations[CHECKBOX_GROUP_PATH] = { - type: 'parent' - }, _relations), - - properties: { - checked: Boolean, - disabled: Boolean, - isInGroup: Boolean, - labelDisabled: Boolean, - type: String - }, - - data: function data() { - return { - isInGroup: false, - isInCell: false - }; - }, - - - methods: { - handleClick: function handleClick() { - if (this.data.disabled) { - return; - } - - var checked = !this.data.checked; - - this.triggerEvent('change', checked); - this.setData({ checked: checked }); - }, - updateData: function updateData(data) { - this.setData(data); - } - } -}); \ No newline at end of file diff --git a/dist/checkbox/index.json b/dist/checkbox/index.json deleted file mode 100644 index fc0d0bf9..00000000 --- a/dist/checkbox/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "zan-icon": "../icon/index" - } -} diff --git a/dist/checkbox/index.wxml b/dist/checkbox/index.wxml deleted file mode 100644 index bba78662..00000000 --- a/dist/checkbox/index.wxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/dist/checkbox/index.wxss b/dist/checkbox/index.wxss deleted file mode 100644 index 7d4d0d79..00000000 --- a/dist/checkbox/index.wxss +++ /dev/null @@ -1 +0,0 @@ -.zan-checkbox{display:inline-block;padding:0 10px;font-size:14px}.zan-checkbox__item{display:block;margin-top:10px}.zan-checkbox__list-item{display:block;padding:10px 10px 10px 0;margin-left:10px;border-bottom:1px solid #e5e5e5}.zan-checkbox__list-item .zan-checkbox__icon{float:right}.zan-checkbox__icon{display:-webkit-inline-box;display:inline-flex;-webkit-box-align:center;align-items:center;color:#aaa}.zan-checkbox__icon.zan-checkbox--checked{color:#06bf04}.zan-checkbox__icon.zan-checkbox--disabled{color:#e5e5e5}.zan-checkbox__label{display:inline-block;margin-left:10px} \ No newline at end of file diff --git a/dist/col/index.js b/dist/col/index.js index f3633672..9df33fa9 100644 --- a/dist/col/index.js +++ b/dist/col/index.js @@ -1,22 +1,26 @@ 'use strict'; -Component({ - externalClasses: ['col-class'], +var _relations; - relations: { - '../row/index': { - type: 'parent' - } - }, +var ROW_PATH = '../row/index'; + +Component({ + externalClasses: ['custom-class'], + + relations: (_relations = {}, _relations[ROW_PATH] = { + type: 'ancestor' + }, _relations), properties: { - col: { - value: 0, - type: Number - }, - offset: { - value: 0, - type: Number + span: Number, + offset: Number + }, + + methods: { + setGutter: function setGutter(gutter) { + var padding = gutter / 2 + 'px'; + var style = gutter ? 'padding-left: ' + padding + '; padding-right: ' + padding + ';' : ''; + this.setData({ style: style }); } } }); \ No newline at end of file diff --git a/dist/col/index.wxml b/dist/col/index.wxml index 2be191c3..30baf92a 100644 --- a/dist/col/index.wxml +++ b/dist/col/index.wxml @@ -1 +1,6 @@ - + + + diff --git a/dist/col/index.wxss b/dist/col/index.wxss index 7d8806c0..b33e9238 100644 --- a/dist/col/index.wxss +++ b/dist/col/index.wxss @@ -1 +1 @@ -.zan-col{float:left;box-sizing:border-box;width:0}.zan-col-1{width:4.16667%}.zan-col-offset-1{margin-left:4.16667%}.zan-col-2{width:8.33333%}.zan-col-offset-2{margin-left:8.33333%}.zan-col-3{width:12.5%}.zan-col-offset-3{margin-left:12.5%}.zan-col-4{width:16.66667%}.zan-col-offset-4{margin-left:16.66667%}.zan-col-5{width:20.83333%}.zan-col-offset-5{margin-left:20.83333%}.zan-col-6{width:25%}.zan-col-offset-6{margin-left:25%}.zan-col-7{width:29.16667%}.zan-col-offset-7{margin-left:29.16667%}.zan-col-8{width:33.33333%}.zan-col-offset-8{margin-left:33.33333%}.zan-col-9{width:37.5%}.zan-col-offset-9{margin-left:37.5%}.zan-col-10{width:41.66667%}.zan-col-offset-10{margin-left:41.66667%}.zan-col-11{width:45.83333%}.zan-col-offset-11{margin-left:45.83333%}.zan-col-12{width:50%}.zan-col-offset-12{margin-left:50%}.zan-col-13{width:54.16667%}.zan-col-offset-13{margin-left:54.16667%}.zan-col-14{width:58.33333%}.zan-col-offset-14{margin-left:58.33333%}.zan-col-15{width:62.5%}.zan-col-offset-15{margin-left:62.5%}.zan-col-16{width:66.66667%}.zan-col-offset-16{margin-left:66.66667%}.zan-col-17{width:70.83333%}.zan-col-offset-17{margin-left:70.83333%}.zan-col-18{width:75%}.zan-col-offset-18{margin-left:75%}.zan-col-19{width:79.16667%}.zan-col-offset-19{margin-left:79.16667%}.zan-col-20{width:83.33333%}.zan-col-offset-20{margin-left:83.33333%}.zan-col-21{width:87.5%}.zan-col-offset-21{margin-left:87.5%}.zan-col-22{width:91.66667%}.zan-col-offset-22{margin-left:91.66667%}.zan-col-23{width:95.83333%}.zan-col-offset-23{margin-left:95.83333%}.zan-col-24{width:100%}.zan-col-offset-24{margin-left:100%} \ No newline at end of file +.van-col{float:left;box-sizing:border-box}.van-col--1{width:4.16667%}.van-col--offset-1{margin-left:4.16667%}.van-col--2{width:8.33333%}.van-col--offset-2{margin-left:8.33333%}.van-col--3{width:12.5%}.van-col--offset-3{margin-left:12.5%}.van-col--4{width:16.66667%}.van-col--offset-4{margin-left:16.66667%}.van-col--5{width:20.83333%}.van-col--offset-5{margin-left:20.83333%}.van-col--6{width:25%}.van-col--offset-6{margin-left:25%}.van-col--7{width:29.16667%}.van-col--offset-7{margin-left:29.16667%}.van-col--8{width:33.33333%}.van-col--offset-8{margin-left:33.33333%}.van-col--9{width:37.5%}.van-col--offset-9{margin-left:37.5%}.van-col--10{width:41.66667%}.van-col--offset-10{margin-left:41.66667%}.van-col--11{width:45.83333%}.van-col--offset-11{margin-left:45.83333%}.van-col--12{width:50%}.van-col--offset-12{margin-left:50%}.van-col--13{width:54.16667%}.van-col--offset-13{margin-left:54.16667%}.van-col--14{width:58.33333%}.van-col--offset-14{margin-left:58.33333%}.van-col--15{width:62.5%}.van-col--offset-15{margin-left:62.5%}.van-col--16{width:66.66667%}.van-col--offset-16{margin-left:66.66667%}.van-col--17{width:70.83333%}.van-col--offset-17{margin-left:70.83333%}.van-col--18{width:75%}.van-col--offset-18{margin-left:75%}.van-col--19{width:79.16667%}.van-col--offset-19{margin-left:79.16667%}.van-col--20{width:83.33333%}.van-col--offset-20{margin-left:83.33333%}.van-col--21{width:87.5%}.van-col--offset-21{margin-left:87.5%}.van-col--22{width:91.66667%}.van-col--offset-22{margin-left:91.66667%}.van-col--23{width:95.83333%}.van-col--offset-23{margin-left:95.83333%}.van-col--24{width:100%}.van-col--offset-24{margin-left:100%} \ No newline at end of file diff --git a/dist/color/index.wxss b/dist/color/index.wxss deleted file mode 100644 index fef3d368..00000000 --- a/dist/color/index.wxss +++ /dev/null @@ -1 +0,0 @@ -.zan-c-red{color:#f44!important}.zan-c-gray{color:#c9c9c9!important}.zan-c-gray-dark{color:#999!important}.zan-c-gray-darker{color:#666!important}.zan-c-black{color:#333!important}.zan-c-blue{color:#38f!important}.zan-c-green{color:#06bf04!important} \ No newline at end of file diff --git a/dist/common/classnames.js b/dist/common/classnames.js new file mode 100644 index 00000000..44f930c5 --- /dev/null +++ b/dist/common/classnames.js @@ -0,0 +1,31 @@ +'use strict'; + +var hasOwn = {}.hasOwnProperty; + +module.exports = function classNames() { + var classes = []; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + if (!arg) continue; + + var argType = typeof arg; + + if (argType === 'string' || argType === 'number') { + classes.push(arg); + } else if (Array.isArray(arg) && arg.length) { + var inner = classNames.apply(null, arg); + if (inner) { + classes.push(inner); + } + } else if (argType === 'object') { + for (var key in arg) { + if (hasOwn.call(arg, key) && arg[key]) { + classes.push(key); + } + } + } + } + + return classes.join(' '); +}; \ No newline at end of file diff --git a/dist/common/helper.js b/dist/common/helper.js deleted file mode 100644 index e995325d..00000000 --- a/dist/common/helper.js +++ /dev/null @@ -1,102 +0,0 @@ -'use strict'; - -// 从事件对象中解析得到 componentId -// 需要在元素上声明 data-component-id -function extractComponentId() { - var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - var _ref = event.currentTarget || {}, - componentId = _ref.dataset.componentId; - - return componentId; -} - -/* - 注:默认合并所有生命周期函数 - 配置合并指定的生命周期 or 忽略指定字段 - const extend = extendCreator({ - life: ['onLoad', 'onPullDownRefresh'], - exclude: ['binder'] - }); - - Page(extend({}, { - onLoad() {}, - ... - })); -*/ - -var LIFE_CYCLE = ['onLoad', 'onReady', 'onShow', 'onHide', 'onUnload', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll']; - -var extendCreator = function extendCreator() { - var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var _config$life = config.life, - life = _config$life === undefined ? LIFE_CYCLE : _config$life, - _config$exclude = config.exclude, - exclude = _config$exclude === undefined ? [] : _config$exclude; - - - var excludeList = exclude.concat(LIFE_CYCLE.map(getFuncArrayName)); - - if (!Array.isArray(life) || !Array.isArray(exclude)) throw new Error('Invalid Extend Config'); - var lifeCycleList = life.filter(function (item) { - return LIFE_CYCLE.indexOf(item) >= 0; - }); - return function extend(target) { - for (var _len = arguments.length, objList = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - objList[_key - 1] = arguments[_key]; - } - - objList.forEach(function (source) { - if (source) { - var keys = Object.keys(source); - keys.forEach(function (key) { - var value = source[key]; - if (excludeList.indexOf(key) >= 0) return; - if (lifeCycleList.indexOf(key) >= 0 && typeof value === 'function') { - var funcArrayName = getFuncArrayName(key); - if (!target[funcArrayName]) { - target[funcArrayName] = []; - if (target[key]) { - target[funcArrayName].push(target[key]); - } - target[key] = function () { - var _this = this; - - for (var _len2 = arguments.length, rest = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - rest[_key2] = arguments[_key2]; - } - - target[funcArrayName].forEach(function (func) { - return func.apply(_this, rest); - }); - }; - } - - if (source[funcArrayName]) { - var _target$funcArrayName; - - // 经过生命周期合并的组件直接整合函数列表 - (_target$funcArrayName = target[funcArrayName]).push.apply(_target$funcArrayName, source[funcArrayName]); - } else { - // 添加生命周期函数进入函数列表 - target[funcArrayName].push(value); - } - } else { - target[key] = value; - } - }); - } - }); - return target; - }; -}; - -var getFuncArrayName = function getFuncArrayName(name) { - return '__$' + name; -}; - -module.exports = { - extractComponentId: extractComponentId, - extend: Object.assign, - extendCreator: extendCreator -}; \ No newline at end of file diff --git a/dist/common/index.wxss b/dist/common/index.wxss new file mode 100644 index 00000000..dc05cccb --- /dev/null +++ b/dist/common/index.wxss @@ -0,0 +1 @@ +.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-clearfix::after{content:'';display:table;clear:both}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px} \ No newline at end of file diff --git a/dist/common/style/clearfix.wxss b/dist/common/style/clearfix.wxss new file mode 100644 index 00000000..df65a0a4 --- /dev/null +++ b/dist/common/style/clearfix.wxss @@ -0,0 +1 @@ +.van-clearfix::after{content:'';display:table;clear:both} \ No newline at end of file diff --git a/dist/common/style/ellipsis.wxss b/dist/common/style/ellipsis.wxss new file mode 100644 index 00000000..79dd7869 --- /dev/null +++ b/dist/common/style/ellipsis.wxss @@ -0,0 +1 @@ +.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis} \ No newline at end of file diff --git a/dist/common/style/hairline.wxss b/dist/common/style/hairline.wxss new file mode 100644 index 00000000..9f445b65 --- /dev/null +++ b/dist/common/style/hairline.wxss @@ -0,0 +1 @@ +.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px} \ No newline at end of file diff --git a/dist/common/style/mixins/border-retina.wxss b/dist/common/style/mixins/border-retina.wxss new file mode 100644 index 00000000..e69de29b diff --git a/dist/common/style/mixins/clearfix.wxss b/dist/common/style/mixins/clearfix.wxss new file mode 100644 index 00000000..e69de29b diff --git a/dist/common/style/mixins/ellipsis.wxss b/dist/common/style/mixins/ellipsis.wxss new file mode 100644 index 00000000..e69de29b diff --git a/dist/common/style/var.wxss b/dist/common/style/var.wxss new file mode 100644 index 00000000..e69de29b diff --git a/dist/datetime-picker/date-picker-view.wxml b/dist/datetime-picker/date-picker-view.wxml deleted file mode 100644 index 0a69f841..00000000 --- a/dist/datetime-picker/date-picker-view.wxml +++ /dev/null @@ -1,35 +0,0 @@ - - -