├── lib ├── styles │ ├── form.css │ ├── form-item.css │ ├── input.css │ ├── notice.css │ ├── button.css │ └── lime-ui.css ├── button.js ├── notice.js ├── input.js ├── button.js.map ├── notice.js.map ├── form-item.js ├── input.js.map ├── form.js └── lime-ui.min.js ├── src ├── locale │ ├── index.js │ └── lang │ │ └── zh-CN.js ├── packages │ ├── input │ │ ├── index.js │ │ └── input.vue │ ├── button │ │ ├── index.js │ │ └── button.vue │ ├── form-item │ │ └── index.js │ ├── form │ │ ├── index.js │ │ ├── form.vue │ │ └── form-item.vue │ └── notice │ │ ├── notice.js │ │ └── notice.vue ├── styles │ ├── form.scss │ ├── index.scss │ ├── message.scss │ ├── mixins │ │ └── mixins.scss │ ├── common │ │ └── var.scss │ ├── form-item.scss │ ├── input.scss │ ├── notice.scss │ └── button.scss ├── utils │ └── assist.js ├── index.js └── mixins │ └── emitter.js ├── docs ├── theme │ └── README.md ├── component │ ├── about.md │ ├── README.md │ ├── guide │ │ ├── introduction.md │ │ └── guide.md │ └── basic │ │ ├── input.md │ │ ├── button.md │ │ ├── notice.md │ │ └── form.md ├── .vuepress │ ├── enhanceApp.js │ └── config.js └── README.md ├── .gitignore ├── assets └── logo.png ├── .npmignore ├── .babelrc ├── test ├── karma.config.js └── specs │ └── button.spec.js ├── LICENSE ├── README.md └── package.json /lib/styles/form.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/locale/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/theme/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 主题定制入门 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | docs/.vuepress/dist -------------------------------------------------------------------------------- /docs/component/about.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar: 关于我们 3 | --- 4 | # 关于 5 | 6 | -------------------------------------------------------------------------------- /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arronKler/lime-ui/HEAD/assets/logo.png -------------------------------------------------------------------------------- /src/packages/input/index.js: -------------------------------------------------------------------------------- 1 | import Input from './input.vue' 2 | export default Input -------------------------------------------------------------------------------- /src/packages/button/index.js: -------------------------------------------------------------------------------- 1 | import Button from './button.vue' 2 | export default Button -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.md 3 | *.yml 4 | build/ 5 | node_modules/ 6 | test/ 7 | docs/ 8 | assets/ 9 | -------------------------------------------------------------------------------- /docs/component/README.md: -------------------------------------------------------------------------------- 1 | # 阅读 2 | 3 | -------------------------------------------------------------------------------- /src/packages/form-item/index.js: -------------------------------------------------------------------------------- 1 | import FormItem from '../form/form-item.vue'; 2 | export default FormItem; -------------------------------------------------------------------------------- /docs/component/guide/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 简介 3 | --- 4 | 5 | # 项目简介 6 | 7 | lime-ui 是又一个轻量级的UI 8 | -------------------------------------------------------------------------------- /lib/styles/form-item.css: -------------------------------------------------------------------------------- 1 | .lime-form-item__label-required:before{content:"*";color:red}.lime-form-item__error{color:red} -------------------------------------------------------------------------------- /src/styles/form.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | @import "common/var"; 3 | @import "mixins/mixins"; 4 | 5 | @include b(form) { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /docs/component/guide/guide.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 安装 3 | --- 4 | # 开发指南 5 | 6 | 输入下列命令可以安装lime-ui 7 | ``` 8 | npm install lime-ui --save 9 | ``` -------------------------------------------------------------------------------- /src/packages/form/index.js: -------------------------------------------------------------------------------- 1 | import Form from './form.vue'; 2 | import FormItem from './form-item.vue'; 3 | 4 | Form.Item = FormItem; 5 | export default Form; -------------------------------------------------------------------------------- /src/styles/index.scss: -------------------------------------------------------------------------------- 1 | 2 | @import "button"; 3 | @import "message"; 4 | @import "form"; 5 | @import "form-item"; 6 | @import "input"; 7 | @import "notice"; -------------------------------------------------------------------------------- /src/styles/message.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | @import "common/var"; 3 | @import "mixins/mixins"; 4 | 5 | @include b(message) { 6 | border: 1px solid gray; 7 | background-color: #fff; 8 | color: #333; 9 | } -------------------------------------------------------------------------------- /docs/.vuepress/enhanceApp.js: -------------------------------------------------------------------------------- 1 | import LimeUI from '../../src/index.js' 2 | import "../../src/styles/index.scss" 3 | 4 | export default ({ 5 | Vue, 6 | options, 7 | router 8 | }) => { 9 | Vue.use(LimeUI) 10 | } -------------------------------------------------------------------------------- /src/styles/mixins/mixins.scss: -------------------------------------------------------------------------------- 1 | $namespace: 'lime'; 2 | 3 | /* BEM 4 | -------------------------- */ 5 | @mixin b($block) { 6 | $B: $namespace+'-'+$block !global; 7 | 8 | .#{$B} { 9 | @content; 10 | } 11 | } -------------------------------------------------------------------------------- /src/utils/assist.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | 3 | export function oneOf(value, validList) { 4 | for (let i = 0; i < validList.length; i++) { 5 | if (value === validList[i]) { 6 | return true; 7 | } 8 | } 9 | return false; 10 | } -------------------------------------------------------------------------------- /lib/styles/input.css: -------------------------------------------------------------------------------- 1 | .lime-input{height:36px;line-height:36px;padding:7px 10px;box-sizing:border-box;border-radius:4px;border:1px solid #999;outline:0;font-size:14px}.lime-input:active,.lime-input:focus{border-color:#555;border-color:#ff6b00;box-shadow:0 0 4px #ff6b00} -------------------------------------------------------------------------------- /src/styles/common/var.scss: -------------------------------------------------------------------------------- 1 | 2 | $--color-primary: #ff6b00 !default; 3 | $--color-white: #FFFFFF !default; 4 | $--color-info: #409EFF !default; 5 | $--color-success: #67C23A !default; 6 | $--color-warning: #E6A23C !default; 7 | $--color-danger: #F56C6C !default; 8 | -------------------------------------------------------------------------------- /lib/styles/notice.css: -------------------------------------------------------------------------------- 1 | .lime-notice{position:fixed;right:20px;top:60px;z-index:1000}.lime-notice__main{min-width:100px;padding:10px 20px;box-shadow:0 0 4px #aaa;margin-bottom:10px;border-radius:4px}.lime-notice__title{font-size:16px}.lime-notice__content{font-size:14px;color:#777} -------------------------------------------------------------------------------- /src/styles/form-item.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | @import "common/var"; 3 | @import "mixins/mixins"; 4 | 5 | @include b(form-item) { 6 | 7 | &__label { 8 | &-required { 9 | &:before { 10 | content: "*"; 11 | color: red; 12 | } 13 | } 14 | } 15 | 16 | &__error { 17 | color: red; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "@babel/preset-env", 5 | { 6 | "loose": false, 7 | "modules": "commonjs", 8 | "spec": true, 9 | "useBuiltIns": "usage", 10 | "corejs": "2.6.9" 11 | } 12 | ] 13 | ], 14 | "plugins": [ 15 | "@babel/plugin-transform-runtime", 16 | ] 17 | } -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | home: true 3 | heroImage: 4 | actionText: 开始使用 → 5 | actionLink: /component/guide/introduction 6 | features: 7 | - title: 基于Vue2.X 8 | details: 享受 Vue + webpack 的开发体验,在 Markdown 中使用 Vue 组件,同时可以使用 Vue 来开发自定义主题。 9 | - title: 轻量级UI 10 | details: 该UI使用了非常轻量级的设计理念,视觉感官更强烈 11 | - title: 高可用性 12 | details: 良好的API接口设计,统一的使用习惯 13 | footer: MIT Licensed | Copyright © 2019-present ArronKler 14 | --- -------------------------------------------------------------------------------- /src/styles/input.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | @import "common/var"; 3 | @import "mixins/mixins"; 4 | 5 | @include b(input) { 6 | height: 36px; 7 | line-height: 36px; 8 | padding: 7px 10px; 9 | box-sizing: border-box; 10 | border-radius: 4px; 11 | border: 1px solid #999; 12 | outline: none; 13 | font-size: 14px; 14 | 15 | &:active, 16 | &:focus { 17 | border-color: #555; 18 | border-color: $--color-primary; 19 | box-shadow: 0 0 4px $--color-primary; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/karma.config.js: -------------------------------------------------------------------------------- 1 | var webpackConfig = require('../build/webpack.test.js') 2 | 3 | module.exports = function (config) { 4 | config.set({ 5 | frameworks: ['mocha', 'sinon-chai'], 6 | 7 | files: ['**/*.spec.js'], 8 | 9 | preprocessors: { 10 | '**/*.spec.js': ['webpack', 'sourcemap'] 11 | }, 12 | 13 | webpack: webpackConfig, 14 | webpackMiddleware: { 15 | noInfo: true, 16 | }, 17 | 18 | reporters: ['spec'], 19 | 20 | browsers: ['ChromeHeadless'] 21 | }) 22 | } -------------------------------------------------------------------------------- /src/styles/notice.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | @import "common/var"; 3 | @import "mixins/mixins"; 4 | 5 | @include b(notice) { 6 | position: fixed; 7 | right: 20px; 8 | top: 60px; 9 | z-index: 1000; 10 | 11 | &__main { 12 | min-width: 100px; 13 | padding: 10px 20px; 14 | box-shadow: 0 0 4px #aaa; 15 | margin-bottom: 10px; 16 | border-radius: 4px; 17 | } 18 | 19 | &__title { 20 | font-size: 16px; 21 | } 22 | &__content { 23 | font-size: 14px; 24 | color: #777; 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /docs/component/basic/input.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Input 3 | --- 4 | 5 | # 输入框 6 | 7 | 16 | 20 | 21 | ```vue 22 | 31 | 35 | ``` -------------------------------------------------------------------------------- /docs/component/basic/button.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Button 3 | --- 4 | 5 | # 按钮 6 | 15 | 16 | 22 | 23 | 24 | ### 使用 25 | ```html 26 | 默认 27 | 主色 28 | 成功 29 | 提示 30 | ``` -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import Button from './packages/button' 2 | import Form from './packages/form' 3 | import FormItem from './packages/form-item' 4 | import Input from './packages/input' 5 | import Notice from './packages/notice/notice.js' 6 | 7 | const components = { 8 | lButton: Button, 9 | lForm: Form, 10 | lFormItem: FormItem, 11 | lInput: Input 12 | } 13 | 14 | 15 | const install = function (Vue, options = {}) { 16 | 17 | Object.keys(components).forEach(key => { 18 | Vue.component(key, components[key]); 19 | }); 20 | 21 | 22 | // Vue.prototype.$message = Message; 23 | Vue.prototype.$notice = Notice; 24 | } 25 | 26 | export default install -------------------------------------------------------------------------------- /test/specs/button.spec.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai' 2 | import { mount } from '@vue/test-utils' 3 | import Button from '../../src/packages/button' 4 | 5 | describe('Button.vue', () => { 6 | it('type primary', done => { 7 | const wrapper = mount(Button, { 8 | propsData: { 9 | type: "primary" 10 | } 11 | }) 12 | 13 | let buttonElm = wrapper.element; 14 | expect(buttonElm.classList.contains('lime-button-primary')).to.be.true; 15 | done() 16 | }) 17 | 18 | it('size large', done => { 19 | const wrapper = mount(Button, { 20 | propsData: { 21 | size: "large" 22 | } 23 | }) 24 | expect(wrapper.props('size')).equal('large'); 25 | done() 26 | }) 27 | }) -------------------------------------------------------------------------------- /src/packages/button/button.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 29 | -------------------------------------------------------------------------------- /src/packages/notice/notice.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Notice from './notice.vue' 3 | 4 | Notice.newInstance = (properties) => { 5 | let props = properties || {} 6 | const Instance = new Vue({ 7 | render(h) { 8 | return h(Notice, { 9 | props 10 | }) 11 | } 12 | }) 13 | 14 | const component = Instance.$mount() 15 | document.body.appendChild(component.$el) 16 | 17 | const notice = component.$children[0] 18 | 19 | return { 20 | add(_notice) { 21 | notice.add(_notice) 22 | }, 23 | remove(id) { 24 | 25 | } 26 | } 27 | } 28 | 29 | let noticeInstance 30 | 31 | 32 | export default (_notice) => { 33 | noticeInstance = noticeInstance || Notice.newInstance() 34 | noticeInstance.add(_notice) 35 | } 36 | -------------------------------------------------------------------------------- /lib/styles/button.css: -------------------------------------------------------------------------------- 1 | .lime-button{min-width:60px;height:36px;font-size:14px;color:#333;background-color:#fff;border-width:1px;border-radius:4px;outline:0;border:1px solid transparent;padding:0 10px}.lime-button:active,.lime-button:focus{outline:0}.lime-button-default{color:#333;border-color:#555}.lime-button-default:active,.lime-button-default:focus,.lime-button-default:hover{background-color:rgba(255,107,0,.3)}.lime-button-primary{color:#fff;background-color:#ff6b00}.lime-button-primary:active,.lime-button-primary:focus,.lime-button-primary:hover{background-color:#e69c66}.lime-button-info{color:#fff;background-color:#409eff}.lime-button-info:active,.lime-button-info:focus,.lime-button-info:hover{background-color:#86b5e6}.lime-button-success{color:#fff;background-color:#67c23a}.lime-button-success:active,.lime-button-success:focus,.lime-button-success:hover{background-color:#9ac783} -------------------------------------------------------------------------------- /docs/.vuepress/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | title: 'LimeUI', 3 | base: '/lime-ui/', 4 | description: 'another lightweight ui toolkit for Vue.js 2.X', 5 | port: 8083, 6 | themeConfig: { 7 | nav: [ 8 | { text: '主页', link: '/' }, 9 | { text: '组件', link: '/component/guide/introduction' }, 10 | { text: '主题', link: '/theme/' }, 11 | // { text: 'External', link: 'https://google.com' }, 12 | ], 13 | sidebar: { 14 | '/component/': [ 15 | { 16 | title: '开发指南', 17 | collapsable: false, 18 | children: [ 19 | 'guide/introduction', 20 | 'guide/guide' 21 | ] 22 | }, 23 | { 24 | title: '基础组件', 25 | collapsable: false, 26 | children: [ 27 | 'basic/button', 28 | 'basic/input', 29 | 'basic/form', 30 | 'basic/notice' 31 | ] 32 | }, 33 | ] 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/packages/notice/notice.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 39 | 40 | -------------------------------------------------------------------------------- /src/mixins/emitter.js: -------------------------------------------------------------------------------- 1 | function broadcast(componentName, eventName, params) { 2 | this.$children.forEach(child => { 3 | const name = child.$options.name; 4 | 5 | if (name === componentName) { 6 | child.$emit.apply(child, [eventName].concat(params)); 7 | } else { 8 | broadcast.apply(child, [componentName, eventName].concat([params])); 9 | } 10 | }); 11 | } 12 | export default { 13 | methods: { 14 | dispatch(componentName, eventName, params) { 15 | let parent = this.$parent || this.$root; 16 | let name = parent.$options.name; 17 | 18 | while (parent && (!name || name !== componentName)) { 19 | parent = parent.$parent; 20 | 21 | if (parent) { 22 | name = parent.$options.name; 23 | } 24 | } 25 | if (parent) { 26 | parent.$emit.apply(parent, [eventName].concat(params)); 27 | } 28 | }, 29 | broadcast(componentName, eventName, params) { 30 | broadcast.call(this, componentName, eventName, params); 31 | } 32 | } 33 | }; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Arron Zou 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/component/basic/notice.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Notice 3 | --- 4 | 5 | # 提示 6 | 7 | 填写提示内容,点击按钮弹出提示 8 | 9 | 27 | 33 | 34 | ```vue 35 | 53 | 59 | ``` -------------------------------------------------------------------------------- /src/styles/button.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | @import "common/var"; 3 | @import "mixins/mixins"; 4 | 5 | @include b(button) { 6 | min-width: 60px; 7 | height: 36px; 8 | font-size: 14px; 9 | color: #333; 10 | background-color: #fff; 11 | border-width: 1px; 12 | border-radius: 4px; 13 | outline: none; 14 | border: 1px solid transparent; 15 | padding: 0 10px; 16 | 17 | &:active, 18 | &:focus { 19 | outline: none; 20 | } 21 | 22 | &-default { 23 | color: #333; 24 | border-color: #555; 25 | 26 | &:active, 27 | &:focus, 28 | &:hover { 29 | background-color: rgba($--color-primary, 0.3); 30 | } 31 | } 32 | &-primary { 33 | color: #fff; 34 | background-color: $--color-primary; 35 | 36 | &:active, 37 | &:focus, 38 | &:hover { 39 | background-color: mix($--color-primary, #ccc); 40 | } 41 | } 42 | 43 | &-info { 44 | color: #fff; 45 | background-color: $--color-info; 46 | 47 | &:active, 48 | &:focus, 49 | &:hover { 50 | background-color: mix($--color-info, #ccc); 51 | } 52 | } 53 | &-success { 54 | color: #fff; 55 | background-color: $--color-success; 56 | 57 | &:active, 58 | &:focus, 59 | &:hover { 60 | background-color: mix($--color-success, #ccc); 61 | } 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /src/packages/input/input.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 62 | -------------------------------------------------------------------------------- /lib/styles/lime-ui.css: -------------------------------------------------------------------------------- 1 | .lime-button{min-width:60px;height:36px;font-size:14px;color:#333;background-color:#fff;border-width:1px;border-radius:4px;outline:0;border:1px solid transparent;padding:0 10px}.lime-button:active,.lime-button:focus{outline:0}.lime-button-default{color:#333;border-color:#555}.lime-button-default:active,.lime-button-default:focus,.lime-button-default:hover{background-color:rgba(255,107,0,.3)}.lime-button-primary{color:#fff;background-color:#ff6b00}.lime-button-primary:active,.lime-button-primary:focus,.lime-button-primary:hover{background-color:#e69c66}.lime-button-info{color:#fff;background-color:#409eff}.lime-button-info:active,.lime-button-info:focus,.lime-button-info:hover{background-color:#86b5e6}.lime-button-success{color:#fff;background-color:#67c23a}.lime-button-success:active,.lime-button-success:focus,.lime-button-success:hover{background-color:#9ac783}.lime-message{border:1px solid gray;background-color:#fff;color:#333}.lime-form-item__label-required:before{content:"*";color:red}.lime-form-item__error{color:red}.lime-input{height:36px;line-height:36px;padding:7px 10px;box-sizing:border-box;border-radius:4px;border:1px solid #999;outline:0;font-size:14px}.lime-input:active,.lime-input:focus{border-color:#555;border-color:#ff6b00;box-shadow:0 0 4px #ff6b00}.lime-notice{position:fixed;right:20px;top:60px;z-index:1000}.lime-notice__main{min-width:100px;padding:10px 20px;box-shadow:0 0 4px #aaa;margin-bottom:10px;border-radius:4px}.lime-notice__title{font-size:16px}.lime-notice__content{font-size:14px;color:#777} -------------------------------------------------------------------------------- /src/packages/form/form.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

6 | 7 |

8 | LimeUI 9 |

A lightweight Vue.js UI toolkit

10 | 11 | 12 | demo: [https://arronkler.github.io/lime-ui/](https://arronkler.github.io/lime-ui/) 13 | 14 | # Install 15 | 16 | Run the command below in your terminal to install limeUI first 17 | ``` 18 | npm install lime-ui --save 19 | ``` 20 | 21 | # Usage 22 | 23 | ## Global Use 24 | Import in your entry script file and register it 25 | ```javascript 26 | import LimeUI from 'lime-ui' 27 | import "lime-ui/lib/styles/lime-ui.css" 28 | 29 | Vue.use(LimeUI) 30 | ``` 31 | 32 | ### Example 33 | 34 | ```html 35 | click 36 | ``` 37 | 38 | ## On-demand Loading 39 | 40 | Firstly, you should install `babel-plugin-component` in your project. 41 | ``` 42 | npm install babel-plugin-component 43 | ``` 44 | 45 | Configure your `.babelrc` file like this 46 | 47 | ```json 48 | { 49 | "plugins": [ 50 | ["component", { 51 | "libraryName": "lime-ui", 52 | "libDir": "lib", 53 | "styleLibrary": { 54 | "name": "styles", 55 | "base": false, // no base.css file 56 | "path": "[module].css" 57 | } 58 | }] 59 | ] 60 | } 61 | ``` 62 | 63 | The you can import component on demand, and you don't need to care about importing styles, the babel plugin will do it automaticly. 64 | 65 | ```javascript 66 | import Vue from 'vue' 67 | import { Button } from 'lime-ui' 68 | 69 | Vue.component('a-button', Button) 70 | ``` 71 | -------------------------------------------------------------------------------- /src/locale/lang/zh-CN.js: -------------------------------------------------------------------------------- 1 | import setLang from '../lang'; 2 | 3 | const lang = { 4 | l: { 5 | locale: 'zh-CN', 6 | select: { 7 | placeholder: '请选择', 8 | noMatch: '无匹配数据', 9 | loading: '加载中' 10 | }, 11 | table: { 12 | noDataText: '暂无数据', 13 | noFilteredDataText: '暂无筛选结果', 14 | confirmFilter: '筛选', 15 | resetFilter: '重置', 16 | clearFilter: '全部' 17 | }, 18 | datepicker: { 19 | selectDate: '选择日期', 20 | selectTime: '选择时间', 21 | startTime: '开始时间', 22 | endTime: '结束时间', 23 | clear: '清空', 24 | ok: '确定', 25 | datePanelLabel: '[yyyy年] [m月]', 26 | month: '月', 27 | month1: '1 月', 28 | month2: '2 月', 29 | month3: '3 月', 30 | month4: '4 月', 31 | month5: '5 月', 32 | month6: '6 月', 33 | month7: '7 月', 34 | month8: '8 月', 35 | month9: '9 月', 36 | month10: '10 月', 37 | month11: '11 月', 38 | month12: '12 月', 39 | year: '年', 40 | weekStartDay: '0', 41 | weeks: { 42 | sun: '日', 43 | mon: '一', 44 | tue: '二', 45 | wed: '三', 46 | thu: '四', 47 | fri: '五', 48 | sat: '六' 49 | }, 50 | months: { 51 | m1: '1月', 52 | m2: '2月', 53 | m3: '3月', 54 | m4: '4月', 55 | m5: '5月', 56 | m6: '6月', 57 | m7: '7月', 58 | m8: '8月', 59 | m9: '9月', 60 | m10: '10月', 61 | m11: '11月', 62 | m12: '12月' 63 | } 64 | }, 65 | transfer: { 66 | titles: { 67 | source: '源列表', 68 | target: '目的列表' 69 | }, 70 | filterPlaceholder: '请输入搜索内容', 71 | notFoundText: '列表为空' 72 | }, 73 | modal: { 74 | okText: '确定', 75 | cancelText: '取消' 76 | }, 77 | poptip: { 78 | okText: '确定', 79 | cancelText: '取消' 80 | }, 81 | page: { 82 | prev: '上一页', 83 | next: '下一页', 84 | total: '共', 85 | item: '条', 86 | items: '条', 87 | prev5: '向前 5 页', 88 | next5: '向后 5 页', 89 | page: '条/页', 90 | goto: '跳至', 91 | p: '页' 92 | }, 93 | rate: { 94 | star: '星', 95 | stars: '星' 96 | }, 97 | time: { 98 | before: '前', 99 | after: '后', 100 | just: '刚刚', 101 | seconds: '秒', 102 | minutes: '分钟', 103 | hours: '小时', 104 | days: '天' 105 | }, 106 | tree: { 107 | emptyText: '暂无数据' 108 | } 109 | } 110 | }; 111 | 112 | export default lang; 113 | -------------------------------------------------------------------------------- /docs/component/basic/form.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Form 3 | --- 4 | # 表单组件 5 | 6 | 7 | ## 表单验证 8 | 9 |
10 | 11 | 43 | 54 | 55 | ```vue 56 | 88 | 99 | ``` 100 | -------------------------------------------------------------------------------- /src/packages/form/form-item.vue: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lime-ui", 3 | "version": "1.0.0", 4 | "description": "another light weight vue.js component library", 5 | "main": "lib/lime-ui.min.js", 6 | "dependencies": { 7 | "async-validator": "^3.0.4", 8 | "core-js": "2.6.9", 9 | "webpack": "^4.39.2", 10 | "webpack-cli": "^3.3.7" 11 | }, 12 | "devDependencies": { 13 | "@babel/core": "^7.5.5", 14 | "@babel/plugin-transform-runtime": "^7.5.5", 15 | "@babel/preset-env": "^7.5.5", 16 | "@vue/test-utils": "^1.0.0-beta.29", 17 | "babel-loader": "^8.0.6", 18 | "chai": "^4.2.0", 19 | "cross-env": "^5.2.0", 20 | "css-loader": "2.1.1", 21 | "file-loader": "^4.2.0", 22 | "gh-pages": "^2.1.1", 23 | "gulp": "^4.0.2", 24 | "gulp-autoprefixer": "^7.0.0", 25 | "gulp-clean-css": "^4.2.0", 26 | "gulp-rename": "^1.4.0", 27 | "gulp-sass": "^4.0.2", 28 | "karma": "^4.2.0", 29 | "karma-chai": "^0.1.0", 30 | "karma-chrome-launcher": "^3.1.0", 31 | "karma-coverage": "^2.0.1", 32 | "karma-mocha": "^1.3.0", 33 | "karma-sinon-chai": "^2.0.2", 34 | "karma-sourcemap-loader": "^0.3.7", 35 | "karma-spec-reporter": "^0.0.32", 36 | "karma-webpack": "^4.0.2", 37 | "less": "^3.10.2", 38 | "less-loader": "^5.0.0", 39 | "mocha": "^6.2.0", 40 | "node-sass": "^4.12.0", 41 | "rimraf": "^3.0.0", 42 | "sass-loader": "^7.3.1", 43 | "sinon": "^7.4.1", 44 | "sinon-chai": "^3.3.0", 45 | "style-loader": "^1.0.0", 46 | "url-loader": "^2.1.0", 47 | "vue-loader": "^15.7.1", 48 | "vue-style-loader": "^4.1.2", 49 | "vuepress": "^1.0.3" 50 | }, 51 | "scripts": { 52 | "docs:dev": "vuepress dev docs", 53 | "docs:build": "vuepress build docs", 54 | "clean": "rimraf lib", 55 | "build:style": "gulp --gulpfile build/gen-style.js", 56 | "build:components": "webpack --config build/webpack.component.js", 57 | "build:prod": "webpack --config build/webpack.prod.js", 58 | "dist": "npm run test && npm run build:style && npm run build:prod && npm run build:components", 59 | "deploy": "gh-pages -d docs/.vuepress/dist", 60 | "deploy:build": "npm run docs:build && npm run deploy", 61 | "test": "karma start test/karma.config.js --single-run" 62 | }, 63 | "repository": { 64 | "type": "git", 65 | "url": "git+https://github.com/arronKler/lime-ui.git" 66 | }, 67 | "keywords": [], 68 | "author": "ArronKler ", 69 | "license": "ISC", 70 | "bugs": { 71 | "url": "https://github.com/arronKler/lime-ui/issues" 72 | }, 73 | "homepage": "https://github.com/arronKler/lime-ui#readme", 74 | "peerDependencies": { 75 | "vue": "^2.5.2" 76 | }, 77 | "engines": { 78 | "node": ">=8.9.1", 79 | "npm": ">=5.5.1", 80 | "yarn": ">=1.3.2" 81 | }, 82 | "browserslist": [ 83 | "last 3 Chrome versions", 84 | "last 3 Firefox versions", 85 | "Safari >= 10", 86 | "Explorer >= 11", 87 | "Edge >= 12", 88 | "iOS >= 10", 89 | "Android >= 6" 90 | ] 91 | } 92 | -------------------------------------------------------------------------------- /lib/button.js: -------------------------------------------------------------------------------- 1 | !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("vue"));else if("function"==typeof define&&define.amd)define(["vue"],t);else{var n="object"==typeof exports?t(require("vue")):t(e.Vue);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/lib/",n(n.s=35)}({0:function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},1:function(e,t,n){"use strict";function r(e,t,n,r,o,u,i,f){var a,s="function"==typeof e?e.options:e;if(t&&(s.render=t,s.staticRenderFns=n,s._compiled=!0),r&&(s.functional=!0),u&&(s._scopeId="data-v-"+u),i?(a=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},s._ssrRegister=a):o&&(a=f?function(){o.call(this,this.$root.$options.shadowRoot)}:o),a)if(s.functional){s._injectStyles=a;var l=s.render;s.render=function(e,t){return a.call(t),l(e,t)}}else{var c=s.beforeCreate;s.beforeCreate=c?[].concat(c,a):[a]}return{exports:e,options:s}}n.d(t,"a",function(){return r})},19:function(e,t,n){"use strict";n.r(t);var r=n(20),o=n.n(r);for(var u in r)"default"!==u&&function(e){n.d(t,e,function(){return r[e]})}(u);t.default=o.a},20:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(27),o={name:"Button",props:{type:{validator:function(e){return(0,r.oneOf)(e,["default","primary","dashed","text","info","success","warning","error"])},type:String,default:"default"},size:{validator:function(e){return(0,r.oneOf)(e,["small","large","default"])},default:"default"}}};t.default=o},27:function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.oneOf=function(e,t){for(var n=0;n\n \n\n\n\n","import Vue from 'vue';\n\nexport function oneOf(value, validList) {\n for (let i = 0; i < validList.length; i++) {\n if (value === validList[i]) {\n return true;\n }\n }\n return false;\n}","var render = function () {\nvar _obj;\nvar _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('button',{staticClass:\"lime-button\",class:( _obj = {}, _obj[(\"lime-button-\" + _vm.type)] = true, _obj ),attrs:{\"type\":\"button\"}},[_vm._t(\"default\")],2)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","export * from \"-!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./button.vue?vue&type=template&id=0576c83e&\"","import Button from './button.vue'\nexport default Button","import { render, staticRenderFns } from \"./button.vue?vue&type=template&id=0576c83e&\"\nimport script from \"./button.vue?vue&type=script&lang=js&\"\nexport * from \"./button.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","module.exports = __WEBPACK_EXTERNAL_MODULE__9__;"],"sourceRoot":""} -------------------------------------------------------------------------------- /lib/notice.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./node_modules/@babel/runtime/helpers/interopRequireDefault.js","webpack:///./node_modules/vue-loader/lib/runtime/componentNormalizer.js","webpack:///./node_modules/@babel/runtime/helpers/newArrowCheck.js","webpack:///./src/packages/notice/notice.vue?a22f","webpack:///src/packages/notice/notice.vue","webpack:///./src/packages/notice/notice.vue?de4f","webpack:///./src/packages/notice/notice.vue?aacd","webpack:///./src/packages/notice/notice.js","webpack:///./src/packages/notice/notice.vue","webpack:///external {\"root\":\"Vue\",\"commonjs\":\"vue\",\"commonjs2\":\"vue\",\"amd\":\"vue\"}"],"names":["root","factory","exports","module","require","define","amd","a","i","window","__WEBPACK_EXTERNAL_MODULE__9__","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","obj","normalizeComponent","scriptExports","render","staticRenderFns","functionalTemplate","injectStyles","scopeId","moduleIdentifier","shadowMode","hook","options","_compiled","functional","_scopeId","context","this","$vnode","ssrContext","parent","__VUE_SSR_CONTEXT__","_registeredComponents","add","_ssrRegister","$root","$options","shadowRoot","_injectStyles","originalRender","h","existing","beforeCreate","concat","innerThis","boundThis","TypeError","data","notices","methods","notice","id","push","setTimeout","remove","splice","_vm","_h","$createElement","_c","_self","staticClass","_l","item","_v","_s","title","content","noticeInstance","Notice","newInstance","properties","props","component","Vue","$mount","document","body","appendChild","$el","$children","_notice"],"mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,aAC7B,GAAqB,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,OAAQJ,OACZ,CACJ,IAAIM,EAAuB,iBAAZL,QAAuBD,EAAQG,QAAQ,QAAUH,EAAQD,EAAU,KAClF,IAAI,IAAIQ,KAAKD,GAAuB,iBAAZL,QAAuBA,QAAUF,GAAMQ,GAAKD,EAAEC,IAPxE,CASGC,OAAQ,SAASC,GACpB,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUX,QAGnC,IAAIC,EAASQ,EAAiBE,GAAY,CACzCL,EAAGK,EACHC,GAAG,EACHZ,QAAS,IAUV,OANAa,EAAQF,GAAUG,KAAKb,EAAOD,QAASC,EAAQA,EAAOD,QAASU,GAG/DT,EAAOW,GAAI,EAGJX,EAAOD,QA0Df,OArDAU,EAAoBK,EAAIF,EAGxBH,EAAoBM,EAAIP,EAGxBC,EAAoBO,EAAI,SAASjB,EAASkB,EAAMC,GAC3CT,EAAoBU,EAAEpB,EAASkB,IAClCG,OAAOC,eAAetB,EAASkB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhET,EAAoBe,EAAI,SAASzB,GACX,oBAAX0B,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAetB,EAAS0B,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAetB,EAAS,aAAc,CAAE4B,OAAO,KAQvDlB,EAAoBmB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQlB,EAAoBkB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFAvB,EAAoBe,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOlB,EAAoBO,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRtB,EAAoB0B,EAAI,SAASnC,GAChC,IAAIkB,EAASlB,GAAUA,EAAO8B,WAC7B,WAAwB,OAAO9B,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAS,EAAoBO,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRT,EAAoBU,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG5B,EAAoB+B,EAAI,QAIjB/B,EAAoBA,EAAoBgC,EAAI,I,kBC5ErDzC,EAAOD,QANP,SAAgC2C,GAC9B,OAAOA,GAAOA,EAAIZ,WAAaY,EAAM,CACnC,QAAWA,K,+BCIA,SAASC,EACtBC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GAGA,IAqBIC,EArBAC,EAAmC,mBAAlBT,EACjBA,EAAcS,QACdT,EAiDJ,GA9CIC,IACFQ,EAAQR,OAASA,EACjBQ,EAAQP,gBAAkBA,EAC1BO,EAAQC,WAAY,GAIlBP,IACFM,EAAQE,YAAa,GAInBN,IACFI,EAAQG,SAAW,UAAYP,GAI7BC,GACFE,EAAO,SAAUK,IAEfA,EACEA,GACCC,KAAKC,QAAUD,KAAKC,OAAOC,YAC3BF,KAAKG,QAAUH,KAAKG,OAAOF,QAAUD,KAAKG,OAAOF,OAAOC,aAEZ,oBAAxBE,sBACrBL,EAAUK,qBAGRd,GACFA,EAAanC,KAAK6C,KAAMD,GAGtBA,GAAWA,EAAQM,uBACrBN,EAAQM,sBAAsBC,IAAId,IAKtCG,EAAQY,aAAeb,GACdJ,IACTI,EAAOD,EACH,WAAcH,EAAanC,KAAK6C,KAAMA,KAAKQ,MAAMC,SAASC,aAC1DpB,GAGFI,EACF,GAAIC,EAAQE,WAAY,CAGtBF,EAAQgB,cAAgBjB,EAExB,IAAIkB,EAAiBjB,EAAQR,OAC7BQ,EAAQR,OAAS,SAAmC0B,EAAGd,GAErD,OADAL,EAAKvC,KAAK4C,GACHa,EAAeC,EAAGd,QAEtB,CAEL,IAAIe,EAAWnB,EAAQoB,aACvBpB,EAAQoB,aAAeD,EACnB,GAAGE,OAAOF,EAAUpB,GACpB,CAACA,GAIT,MAAO,CACLrD,QAAS6C,EACTS,QAASA,GA1Fb,iC,gBCMArD,EAAOD,QANP,SAAwB4E,EAAWC,GACjC,GAAID,IAAcC,EAChB,MAAM,IAAIC,UAAU,0C,gCCFxB,2GAAoM,YAAG,G,6HCUvM,CACEC,KADF,WAEI,MAAO,CACLC,QAAS,KAGbC,QAAS,CACPhB,IADJ,SACA,cACA,YACMiB,EAAOC,GAAKA,EACZxB,KAAKqB,QAAQI,KAAKF,GAElB,IAAN,aACMG,WAAW,YAAjB,qBACQ1B,KAAK2B,OAAOH,IADpB,WAEA,QAEIG,OAXJ,SAWA,GACM,IAAN,kCACQ,GAAI3B,KAAKqB,QAAQ1E,GAAG6E,KAAOA,EAAI,CAC7BxB,KAAKqB,QAAQO,OAAOjF,EAAG,GACvB,U,6CC/BV,IAAIwC,EAAS,WAAa,IAAI0C,EAAI7B,KAAS8B,EAAGD,EAAIE,eAAmBC,EAAGH,EAAII,MAAMD,IAAIF,EAAG,OAAOE,EAAG,MAAM,CAACE,YAAY,eAAeL,EAAIM,GAAIN,EAAW,QAAE,SAASO,GAAM,OAAOJ,EAAG,MAAM,CAACzD,IAAI6D,EAAKZ,GAAGU,YAAY,qBAAqB,CAACF,EAAG,MAAM,CAACE,YAAY,sBAAsB,CAACL,EAAIQ,GAAGR,EAAIS,GAAGF,EAAKG,UAAUV,EAAIQ,GAAG,KAAKL,EAAG,MAAM,CAACE,YAAY,wBAAwB,CAACL,EAAIQ,GAAGR,EAAIS,GAAGF,EAAKI,gBAAgB,IAC5YpD,EAAkB,GCDtB,iE,iHC4BIqD,E,UA5BJ,UACA,WAEAC,UAAOC,YAAc,SAACC,IAAe,uB,GACnC,IAAIC,EAAQD,GAAc,GASpBE,EARW,IAAIC,UAAI,CACvB5D,OADuB,SAChB0B,GACL,OAAOA,EAAE6B,UAAQ,CACfG,aAKqBG,SAC3BC,SAASC,KAAKC,YAAYL,EAAUM,KAEpC,IAAM7B,EAASuB,EAAUO,UAAU,GAEnC,MAAO,CACL/C,IADK,SACDgD,GACF/B,EAAOjB,IAAIgD,IAEb3B,OAJK,SAIEH,OAnBX,a,MA4Be,SAAC8B,IAAY,uB,IAC1Bb,EAAiBA,GAAkBC,UAAOC,eAC3BrC,IAAIgD,I,0DCjCrB,qHAOIR,EAAY,YACd,UACA,IACA,KACA,EACA,KACA,KACA,MAIa,UAAAA,E,yBClBfxG,EAAOD,QAAUQ","file":"notice.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"vue\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"vue\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"vue\")) : factory(root[\"Vue\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function(__WEBPACK_EXTERNAL_MODULE__9__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/lib/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 42);\n","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\n\nmodule.exports = _interopRequireDefault;","/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nexport default function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}\n","function _newArrowCheck(innerThis, boundThis) {\n if (innerThis !== boundThis) {\n throw new TypeError(\"Cannot instantiate an arrow function\");\n }\n}\n\nmodule.exports = _newArrowCheck;","import mod from \"-!../../../node_modules/babel-loader/lib/index.js??ref--1!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./notice.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/babel-loader/lib/index.js??ref--1!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./notice.vue?vue&type=script&lang=js&\"","\n\n\n\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"lime-notice\"},_vm._l((_vm.notices),function(item){return _c('div',{key:item.id,staticClass:\"lime-notice__main\"},[_c('div',{staticClass:\"lime-notice__title\"},[_vm._v(_vm._s(item.title))]),_vm._v(\" \"),_c('div',{staticClass:\"lime-notice__content\"},[_vm._v(_vm._s(item.content))])])}),0)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","export * from \"-!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./notice.vue?vue&type=template&id=25852a67&\"","import Vue from 'vue'\nimport Notice from './notice.vue'\n\nNotice.newInstance = (properties) => {\n let props = properties || {}\n const Instance = new Vue({\n render(h) {\n return h(Notice, {\n props\n })\n }\n })\n\n const component = Instance.$mount()\n document.body.appendChild(component.$el)\n\n const notice = component.$children[0]\n\n return {\n add(_notice) {\n notice.add(_notice)\n }, \n remove(id) {\n\n }\n }\n}\n\nlet noticeInstance\n\n\nexport default (_notice) => {\n noticeInstance = noticeInstance || Notice.newInstance()\n noticeInstance.add(_notice)\n}\n","import { render, staticRenderFns } from \"./notice.vue?vue&type=template&id=25852a67&\"\nimport script from \"./notice.vue?vue&type=script&lang=js&\"\nexport * from \"./notice.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","module.exports = __WEBPACK_EXTERNAL_MODULE__9__;"],"sourceRoot":""} -------------------------------------------------------------------------------- /lib/form-item.js: -------------------------------------------------------------------------------- 1 | !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/lib/",r(r.s=39)}([function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,r){"use strict";function n(e,t,r,n,i,a,o,u){var s,f="function"==typeof e?e.options:e;if(t&&(f.render=t,f.staticRenderFns=r,f._compiled=!0),n&&(f.functional=!0),a&&(f._scopeId="data-v-"+a),o?(s=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},f._ssrRegister=s):i&&(s=u?function(){i.call(this,this.$root.$options.shadowRoot)}:i),s)if(f.functional){f._injectStyles=s;var l=f.render;f.render=function(e,t){return s.call(t),l(e,t)}}else{var c=f.beforeCreate;f.beforeCreate=c?[].concat(c,s):[s]}return{exports:e,options:f}}r.d(t,"a",function(){return n})},function(e,t){e.exports=function(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,r){e.exports=!r(7)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,r){"use strict";r.r(t);var n=r(6),i=r.n(n);for(var a in n)"default"!==a&&function(e){r.d(t,e,function(){return n[e]})}(a);t.default=i.a},function(e,t,r){"use strict";var n=r(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(r(10)),a=n(r(2)),o=n(r(29)),u={name:"lFormItem",inject:["form"],mixins:[n(r(11)).default],props:{label:{type:String,default:""},prop:{type:String}},data:function(){return{isRequired:!1,validateState:"",validateMessage:""}},computed:{filedValue:function(){return this.form.model[this.prop]}},mounted:function(){this.prop&&(this.dispatch("lForm","on-form-item-add",this),this.initialFieldValue=this.fieldValue,this.setRules())},beforeDestroy:function(){this.dispatch("lForm","on-form-item-destroy",this)},methods:{setRules:function(){var e=this,t=this.getCurrentRule();t.length>0&&t.every(function(t){(0,a.default)(this,e),this.isRequired=t.required}.bind(this)),this.$on("on-form-change",this.onFiledChange),this.$on("on-form-blur",this.onFiledBlur)},getCurrentRule:function(){var e=this.form.rules;return e?e[this.prop]:[]},validate:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){(0,a.default)(this,t)}.bind(this),n=this.getCurrentRule();if(0===n.length)return!0;var u=(0,i.default)({},this.prop,n),s=new o.default(u),f=(0,i.default)({},this.prop,this.filedValue);s.validate(f,{firstFields:!0},function(e){(0,a.default)(this,t),this.validateState=e?"error":"success",this.validateMessage=e?e[0].message:"",r(this.validateMessage)}.bind(this))},onFiledChange:function(e){this.validate("change")},onFiledBlur:function(e){this.validate("blur")},resetFiled:function(){this.validateState="",this.validateMessage="",this.form.model[this.prop]=this.initialFieldValue}}};t.default=u},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,r){"use strict";var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",[e.label?r("label",{class:{"lime-form-item__label-required":e.isRequired}},[e._v(e._s(e.label))]):e._e(),e._v(" "),r("div",[e._t("default"),e._v(" "),"error"===e.validateState?r("div",{staticClass:"lime-form-item__error"},[e._v(e._s(e.validateMessage))]):e._e()],2)])},i=[];r.d(t,"a",function(){return n}),r.d(t,"b",function(){return i})},,function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){"use strict";var n=r(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,r(12);var i=n(r(2));var a={methods:{dispatch:function(e,t,r){for(var n=this.$parent||this.$root,i=n.$options.name;n&&(!i||i!==e);)(n=n.$parent)&&(i=n.$options.name);n&&n.$emit.apply(n,[t].concat(r))},broadcast:function(e,t,r){(function e(t,r,n){var a=this;this.$children.forEach(function(o){(0,i.default)(this,a),o.$options.name===t?o.$emit.apply(o,[r].concat(n)):e.apply(o,[t,r].concat([n]))}.bind(this))}).call(this,e,t,r)}}};t.default=a},function(e,t,r){var n=r(13).f,i=Function.prototype,a=/^\s*function ([^ (]*)/;"name"in i||r(4)&&n(i,"name",{configurable:!0,get:function(){try{return(""+this).match(a)[1]}catch(e){return""}}})},function(e,t,r){var n=r(14),i=r(15),a=r(18),o=Object.defineProperty;t.f=r(4)?Object.defineProperty:function(e,t,r){if(n(e),t=a(t,!0),n(r),i)try{return o(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},function(e,t,r){var n=r(3);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,r){e.exports=!r(4)&&!r(7)(function(){return 7!=Object.defineProperty(r(16)("div"),"a",{get:function(){return 7}}).a})},function(e,t,r){var n=r(3),i=r(17).document,a=n(i)&&n(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t){var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(e,t,r){var n=r(3);e.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},,,,,,,,,,function(e,t,r){"use strict";r.r(t);var n=r(8),i=r(5);for(var a in i)"default"!==a&&function(e){r.d(t,e,function(){return i[e]})}(a);var o=r(1),u=Object(o.a)(i.default,n.a,n.b,!1,null,null,null);t.default=u.exports},function(e,t,r){"use strict";r.r(t),function(e){function r(){return(r=Object.assign||function(e){for(var t=1;t=o)return e;switch(e){case"%s":return String(t[i++]);case"%d":return Number(t[i++]);case"%j":try{return JSON.stringify(t[i++])}catch(e){return"[Circular]"}break;default:return e}}),s=t[i];i()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,url:new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},h={integer:function(e){return h.number(e)&&parseInt(e,10)===e},float:function(e){return h.number(e)&&!h.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch(e){return!1}},date:function(e){return"function"==typeof e.getTime&&"function"==typeof e.getMonth&&"function"==typeof e.getYear},number:function(e){return!isNaN(e)&&"number"==typeof e},object:function(e){return"object"==typeof e&&!h.array(e)},method:function(e){return"function"==typeof e},email:function(e){return"string"==typeof e&&!!e.match(p.email)&&e.length<255},url:function(e){return"string"==typeof e&&!!e.match(p.url)},hex:function(e){return"string"==typeof e&&!!e.match(p.hex)}};var y="enum";var v={required:d,whitespace:function(e,t,r,n,i){(/^\s+$/.test(t)||""===t)&&n.push(o(i.messages.whitespace,e.fullField))},type:function(e,t,r,n,i){if(e.required&&void 0===t)d(e,t,r,n,i);else{var a=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(a)>-1?h[a](t)||n.push(o(i.messages.types[a],e.fullField,e.type)):a&&typeof t!==e.type&&n.push(o(i.messages.types[a],e.fullField,e.type))}},range:function(e,t,r,n,i){var a="number"==typeof e.len,u="number"==typeof e.min,s="number"==typeof e.max,f=t,l=null,c="number"==typeof t,d="string"==typeof t,p=Array.isArray(t);if(c?l="number":d?l="string":p&&(l="array"),!l)return!1;p&&(f=t.length),d&&(f=t.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"_").length),a?f!==e.len&&n.push(o(i.messages[l].len,e.fullField,e.len)):u&&!s&&fe.max?n.push(o(i.messages[l].max,e.fullField,e.max)):u&&s&&(fe.max)&&n.push(o(i.messages[l].range,e.fullField,e.min,e.max))},enum:function(e,t,r,n,i){e[y]=Array.isArray(e[y])?e[y]:[],-1===e[y].indexOf(t)&&n.push(o(i.messages[y],e.fullField,e[y].join(", ")))},pattern:function(e,t,r,n,i){if(e.pattern)if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(t)||n.push(o(i.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"==typeof e.pattern){new RegExp(e.pattern).test(t)||n.push(o(i.messages.pattern.mismatch,e.fullField,t,e.pattern))}}};var m="enum";function g(e,t,r,n,i){var a=e.type,o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t,a)&&!e.required)return r();v.required(e,t,n,o,i,a),u(t,a)||v.type(e,t,n,o,i)}r(o)}var b={string:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t,"string")&&!e.required)return r();v.required(e,t,n,a,i,"string"),u(t,"string")||(v.type(e,t,n,a,i),v.range(e,t,n,a,i),v.pattern(e,t,n,a,i),!0===e.whitespace&&v.whitespace(e,t,n,a,i))}r(a)},method:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();v.required(e,t,n,a,i),void 0!==t&&v.type(e,t,n,a,i)}r(a)},number:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(""===t&&(t=void 0),u(t)&&!e.required)return r();v.required(e,t,n,a,i),void 0!==t&&(v.type(e,t,n,a,i),v.range(e,t,n,a,i))}r(a)},boolean:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();v.required(e,t,n,a,i),void 0!==t&&v.type(e,t,n,a,i)}r(a)},regexp:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();v.required(e,t,n,a,i),u(t)||v.type(e,t,n,a,i)}r(a)},integer:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();v.required(e,t,n,a,i),void 0!==t&&(v.type(e,t,n,a,i),v.range(e,t,n,a,i))}r(a)},float:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();v.required(e,t,n,a,i),void 0!==t&&(v.type(e,t,n,a,i),v.range(e,t,n,a,i))}r(a)},array:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t,"array")&&!e.required)return r();v.required(e,t,n,a,i,"array"),u(t,"array")||(v.type(e,t,n,a,i),v.range(e,t,n,a,i))}r(a)},object:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();v.required(e,t,n,a,i),void 0!==t&&v.type(e,t,n,a,i)}r(a)},enum:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();v.required(e,t,n,a,i),void 0!==t&&v[m](e,t,n,a,i)}r(a)},pattern:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t,"string")&&!e.required)return r();v.required(e,t,n,a,i),u(t,"string")||v.pattern(e,t,n,a,i)}r(a)},date:function(e,t,r,n,i){var a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();var o;if(v.required(e,t,n,a,i),!u(t))o="number"==typeof t?new Date(t):t,v.type(e,o,n,a,i),o&&v.range(e,o.getTime(),n,a,i)}r(a)},url:g,hex:g,email:g,required:function(e,t,r,n,i){var a=[],o=Array.isArray(t)?"array":typeof t;v.required(e,t,n,a,i,o),r(a)}};function w(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var q=w();function x(e){this.rules=null,this._messages=q,this.define(e)}x.prototype={messages:function(e){return e&&(this._messages=c(w(),e)),this._messages},define:function(e){if(!e)throw new Error("Cannot configure a schema with no rules");if("object"!=typeof e||Array.isArray(e))throw new Error("Rules must be an object");var t,r;for(t in this.rules={},e)e.hasOwnProperty(t)&&(r=e[t],this.rules[t]=Array.isArray(r)?r:[r])},validate:function(e,t,n){var i=this;void 0===t&&(t={}),void 0===n&&(n=function(){});var u,s,d=e,p=t,h=n;if("function"==typeof p&&(h=p,p={}),!this.rules||0===Object.keys(this.rules).length)return h&&h(),Promise.resolve();if(p.messages){var y=this.messages();y===q&&(y=w()),c(y,p.messages),p.messages=y}else p.messages=this.messages();var v={};(p.keys||Object.keys(this.rules)).forEach(function(t){u=i.rules[t],s=d[t],u.forEach(function(n){var a=n;"function"==typeof a.transform&&(d===e&&(d=r({},d)),s=d[t]=a.transform(s)),(a="function"==typeof a?{validator:a}:r({},a)).validator=i.getValidationMethod(a),a.field=t,a.fullField=a.fullField||t,a.type=i.getType(a),a.validator&&(v[t]=v[t]||[],v[t].push({rule:a,value:s,source:d,field:t}))})});var m={};return f(v,p,function(e,t){var n,i=e.rule,a=!("object"!==i.type&&"array"!==i.type||"object"!=typeof i.fields&&"object"!=typeof i.defaultField);function u(e,t){return r({},t,{fullField:i.fullField+"."+e})}function s(n){void 0===n&&(n=[]);var s=n;if(Array.isArray(s)||(s=[s]),!p.suppressWarning&&s.length&&x.warning("async-validator:",s),s.length&&i.message&&(s=[].concat(i.message)),s=s.map(l(i)),p.first&&s.length)return m[i.field]=1,t(s);if(a){if(i.required&&!e.value)return s=i.message?[].concat(i.message).map(l(i)):p.error?[p.error(i,o(p.messages.required,i.field))]:[],t(s);var f={};if(i.defaultField)for(var c in e.value)e.value.hasOwnProperty(c)&&(f[c]=i.defaultField);for(var d in f=r({},f,{},e.rule.fields))if(f.hasOwnProperty(d)){var h=Array.isArray(f[d])?f[d]:[f[d]];f[d]=h.map(u.bind(null,d))}var y=new x(f);y.messages(p.messages),e.rule.options&&(e.rule.options.messages=p.messages,e.rule.options.error=p.error),y.validate(e.value,e.rule.options||p,function(e){var r=[];s&&s.length&&r.push.apply(r,s),e&&e.length&&r.push.apply(r,e),t(r.length?r:null)})}else t(s)}a=a&&(i.required||!i.required&&e.value),i.field=e.field,i.asyncValidator?n=i.asyncValidator(i,e.value,s,e.source,p):i.validator&&(!0===(n=i.validator(i,e.value,s,e.source,p))?s():!1===n?s(i.message||i.field+" fails"):n instanceof Array?s(n):n instanceof Error&&s(n.message)),n&&n.then&&n.then(function(){return s()},function(e){return s(e)})},function(e){!function(e){var t,r,n,i=[],o={};for(t=0;t1)for(var r=1;r {\n const name = child.$options.name;\n\n if (name === componentName) {\n child.$emit.apply(child, [eventName].concat(params));\n } else {\n broadcast.apply(child, [componentName, eventName].concat([params]));\n }\n });\n}\nexport default {\n methods: {\n dispatch(componentName, eventName, params) {\n let parent = this.$parent || this.$root;\n let name = parent.$options.name;\n\n while (parent && (!name || name !== componentName)) {\n parent = parent.$parent;\n\n if (parent) {\n name = parent.$options.name;\n }\n }\n if (parent) {\n parent.$emit.apply(parent, [eventName].concat(params));\n }\n },\n broadcast(componentName, eventName, params) {\n broadcast.call(this, componentName, eventName, params);\n }\n }\n};","var dP = require('./_object-dp').f;\nvar FProto = Function.prototype;\nvar nameRE = /^\\s*function ([^ (]*)/;\nvar NAME = 'name';\n\n// 19.2.4.2 name\nNAME in FProto || require('./_descriptors') && dP(FProto, NAME, {\n configurable: true,\n get: function () {\n try {\n return ('' + this).match(nameRE)[1];\n } catch (e) {\n return '';\n }\n }\n});\n","var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","import mod from \"-!../../../node_modules/babel-loader/lib/index.js??ref--1!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./input.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/babel-loader/lib/index.js??ref--1!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./input.vue?vue&type=script&lang=js&\"","\n\n\n","import Vue from 'vue';\n\nexport function oneOf(value, validList) {\n for (let i = 0; i < validList.length; i++) {\n if (value === validList[i]) {\n return true;\n }\n }\n return false;\n}","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"lime-input-container\"},[_c('input',{staticClass:\"lime-input\",class:_vm.inputClass,attrs:{\"type\":\"text\"},on:{\"input\":_vm.handleInput,\"blur\":_vm.handleBlur}})])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","export * from \"-!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./input.vue?vue&type=template&id=0a234bf4&\"","import Input from './input.vue'\nexport default Input","import { render, staticRenderFns } from \"./input.vue?vue&type=template&id=0a234bf4&\"\nimport script from \"./input.vue?vue&type=script&lang=js&\"\nexport * from \"./input.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports"],"sourceRoot":""} -------------------------------------------------------------------------------- /lib/form.js: -------------------------------------------------------------------------------- 1 | !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/lib/",r(r.s=37)}([function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,r){"use strict";function n(e,t,r,n,i,o,a,u){var s,f="function"==typeof e?e.options:e;if(t&&(f.render=t,f.staticRenderFns=r,f._compiled=!0),n&&(f.functional=!0),o&&(f._scopeId="data-v-"+o),a?(s=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},f._ssrRegister=s):i&&(s=u?function(){i.call(this,this.$root.$options.shadowRoot)}:i),s)if(f.functional){f._injectStyles=s;var l=f.render;f.render=function(e,t){return s.call(t),l(e,t)}}else{var c=f.beforeCreate;f.beforeCreate=c?[].concat(c,s):[s]}return{exports:e,options:f}}r.d(t,"a",function(){return n})},function(e,t){e.exports=function(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,r){e.exports=!r(7)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,r){"use strict";r.r(t);var n=r(6),i=r.n(n);for(var o in n)"default"!==o&&function(e){r.d(t,e,function(){return n[e]})}(o);t.default=i.a},function(e,t,r){"use strict";var n=r(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(r(10)),o=n(r(2)),a=n(r(29)),u={name:"lFormItem",inject:["form"],mixins:[n(r(11)).default],props:{label:{type:String,default:""},prop:{type:String}},data:function(){return{isRequired:!1,validateState:"",validateMessage:""}},computed:{filedValue:function(){return this.form.model[this.prop]}},mounted:function(){this.prop&&(this.dispatch("lForm","on-form-item-add",this),this.initialFieldValue=this.fieldValue,this.setRules())},beforeDestroy:function(){this.dispatch("lForm","on-form-item-destroy",this)},methods:{setRules:function(){var e=this,t=this.getCurrentRule();t.length>0&&t.every(function(t){(0,o.default)(this,e),this.isRequired=t.required}.bind(this)),this.$on("on-form-change",this.onFiledChange),this.$on("on-form-blur",this.onFiledBlur)},getCurrentRule:function(){var e=this.form.rules;return e?e[this.prop]:[]},validate:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){(0,o.default)(this,t)}.bind(this),n=this.getCurrentRule();if(0===n.length)return!0;var u=(0,i.default)({},this.prop,n),s=new a.default(u),f=(0,i.default)({},this.prop,this.filedValue);s.validate(f,{firstFields:!0},function(e){(0,o.default)(this,t),this.validateState=e?"error":"success",this.validateMessage=e?e[0].message:"",r(this.validateMessage)}.bind(this))},onFiledChange:function(e){this.validate("change")},onFiledBlur:function(e){this.validate("blur")},resetFiled:function(){this.validateState="",this.validateMessage="",this.form.model[this.prop]=this.initialFieldValue}}};t.default=u},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,r){"use strict";var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",[e.label?r("label",{class:{"lime-form-item__label-required":e.isRequired}},[e._v(e._s(e.label))]):e._e(),e._v(" "),r("div",[e._t("default"),e._v(" "),"error"===e.validateState?r("div",{staticClass:"lime-form-item__error"},[e._v(e._s(e.validateMessage))]):e._e()],2)])},i=[];r.d(t,"a",function(){return n}),r.d(t,"b",function(){return i})},,function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){"use strict";var n=r(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,r(12);var i=n(r(2));var o={methods:{dispatch:function(e,t,r){for(var n=this.$parent||this.$root,i=n.$options.name;n&&(!i||i!==e);)(n=n.$parent)&&(i=n.$options.name);n&&n.$emit.apply(n,[t].concat(r))},broadcast:function(e,t,r){(function e(t,r,n){var o=this;this.$children.forEach(function(a){(0,i.default)(this,o),a.$options.name===t?a.$emit.apply(a,[r].concat(n)):e.apply(a,[t,r].concat([n]))}.bind(this))}).call(this,e,t,r)}}};t.default=o},function(e,t,r){var n=r(13).f,i=Function.prototype,o=/^\s*function ([^ (]*)/;"name"in i||r(4)&&n(i,"name",{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(e){return""}}})},function(e,t,r){var n=r(14),i=r(15),o=r(18),a=Object.defineProperty;t.f=r(4)?Object.defineProperty:function(e,t,r){if(n(e),t=o(t,!0),n(r),i)try{return a(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},function(e,t,r){var n=r(3);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,r){e.exports=!r(4)&&!r(7)(function(){return 7!=Object.defineProperty(r(16)("div"),"a",{get:function(){return 7}}).a})},function(e,t,r){var n=r(3),i=r(17).document,o=n(i)&&n(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t){var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(e,t,r){var n=r(3);e.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},,,function(e,t,r){"use strict";r.r(t);var n=r(22),i=r.n(n);for(var o in n)"default"!==o&&function(e){r.d(t,e,function(){return n[e]})}(o);t.default=i.a},function(e,t,r){"use strict";var n=r(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(r(2)),o={name:"lForm",provide:function(){return{form:this}},props:{model:{type:Object},rules:{type:Object}},mounted:function(){var e=this;this.$nextTick(function(){(0,i.default)(this,e),console.log("form name",this.$options.componentName)}.bind(this))},methods:{resetFileds:function(){var e=this;this.fileds.forEach(function(t){(0,i.default)(this,e),field.resetFileds()}.bind(this))},validate:function(e){var t=this,r=!0;this.fileds.forEach(function(n){var o=this;(0,i.default)(this,t),n.validate("",function(t){(0,i.default)(this,o),t&&(r=!1),0,coutner===this.fileds.length&&"function"===callback&&e(r)}.bind(this))}.bind(this))}},data:function(){return{fileds:[]}},created:function(){var e=this;this.$on("on-form-item-add",function(t){(0,i.default)(this,e),console.log("form-item-add"),t&&this.fileds.push(t)}.bind(this)),this.$on("on-form-item-destroy",function(t){(0,i.default)(this,e),console.log("form-item-destroy"),t.prop&&this.fileds.splice(this.fileds.indexOf(t),1)}.bind(this))}};t.default=o},,,,,,function(e,t,r){"use strict";r.r(t);var n=r(8),i=r(5);for(var o in i)"default"!==o&&function(e){r.d(t,e,function(){return i[e]})}(o);var a=r(1),u=Object(a.a)(i.default,n.a,n.b,!1,null,null,null);t.default=u.exports},function(e,t,r){"use strict";r.r(t),function(e){function r(){return(r=Object.assign||function(e){for(var t=1;t=a)return e;switch(e){case"%s":return String(t[i++]);case"%d":return Number(t[i++]);case"%j":try{return JSON.stringify(t[i++])}catch(e){return"[Circular]"}break;default:return e}}),s=t[i];i()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,url:new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},h={integer:function(e){return h.number(e)&&parseInt(e,10)===e},float:function(e){return h.number(e)&&!h.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch(e){return!1}},date:function(e){return"function"==typeof e.getTime&&"function"==typeof e.getMonth&&"function"==typeof e.getYear},number:function(e){return!isNaN(e)&&"number"==typeof e},object:function(e){return"object"==typeof e&&!h.array(e)},method:function(e){return"function"==typeof e},email:function(e){return"string"==typeof e&&!!e.match(p.email)&&e.length<255},url:function(e){return"string"==typeof e&&!!e.match(p.url)},hex:function(e){return"string"==typeof e&&!!e.match(p.hex)}};var v="enum";var y={required:d,whitespace:function(e,t,r,n,i){(/^\s+$/.test(t)||""===t)&&n.push(a(i.messages.whitespace,e.fullField))},type:function(e,t,r,n,i){if(e.required&&void 0===t)d(e,t,r,n,i);else{var o=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(o)>-1?h[o](t)||n.push(a(i.messages.types[o],e.fullField,e.type)):o&&typeof t!==e.type&&n.push(a(i.messages.types[o],e.fullField,e.type))}},range:function(e,t,r,n,i){var o="number"==typeof e.len,u="number"==typeof e.min,s="number"==typeof e.max,f=t,l=null,c="number"==typeof t,d="string"==typeof t,p=Array.isArray(t);if(c?l="number":d?l="string":p&&(l="array"),!l)return!1;p&&(f=t.length),d&&(f=t.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"_").length),o?f!==e.len&&n.push(a(i.messages[l].len,e.fullField,e.len)):u&&!s&&fe.max?n.push(a(i.messages[l].max,e.fullField,e.max)):u&&s&&(fe.max)&&n.push(a(i.messages[l].range,e.fullField,e.min,e.max))},enum:function(e,t,r,n,i){e[v]=Array.isArray(e[v])?e[v]:[],-1===e[v].indexOf(t)&&n.push(a(i.messages[v],e.fullField,e[v].join(", ")))},pattern:function(e,t,r,n,i){if(e.pattern)if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(t)||n.push(a(i.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"==typeof e.pattern){new RegExp(e.pattern).test(t)||n.push(a(i.messages.pattern.mismatch,e.fullField,t,e.pattern))}}};var m="enum";function g(e,t,r,n,i){var o=e.type,a=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t,o)&&!e.required)return r();y.required(e,t,n,a,i,o),u(t,o)||y.type(e,t,n,a,i)}r(a)}var b={string:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t,"string")&&!e.required)return r();y.required(e,t,n,o,i,"string"),u(t,"string")||(y.type(e,t,n,o,i),y.range(e,t,n,o,i),y.pattern(e,t,n,o,i),!0===e.whitespace&&y.whitespace(e,t,n,o,i))}r(o)},method:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();y.required(e,t,n,o,i),void 0!==t&&y.type(e,t,n,o,i)}r(o)},number:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(""===t&&(t=void 0),u(t)&&!e.required)return r();y.required(e,t,n,o,i),void 0!==t&&(y.type(e,t,n,o,i),y.range(e,t,n,o,i))}r(o)},boolean:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();y.required(e,t,n,o,i),void 0!==t&&y.type(e,t,n,o,i)}r(o)},regexp:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();y.required(e,t,n,o,i),u(t)||y.type(e,t,n,o,i)}r(o)},integer:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();y.required(e,t,n,o,i),void 0!==t&&(y.type(e,t,n,o,i),y.range(e,t,n,o,i))}r(o)},float:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();y.required(e,t,n,o,i),void 0!==t&&(y.type(e,t,n,o,i),y.range(e,t,n,o,i))}r(o)},array:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t,"array")&&!e.required)return r();y.required(e,t,n,o,i,"array"),u(t,"array")||(y.type(e,t,n,o,i),y.range(e,t,n,o,i))}r(o)},object:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();y.required(e,t,n,o,i),void 0!==t&&y.type(e,t,n,o,i)}r(o)},enum:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();y.required(e,t,n,o,i),void 0!==t&&y[m](e,t,n,o,i)}r(o)},pattern:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t,"string")&&!e.required)return r();y.required(e,t,n,o,i),u(t,"string")||y.pattern(e,t,n,o,i)}r(o)},date:function(e,t,r,n,i){var o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(u(t)&&!e.required)return r();var a;if(y.required(e,t,n,o,i),!u(t))a="number"==typeof t?new Date(t):t,y.type(e,a,n,o,i),a&&y.range(e,a.getTime(),n,o,i)}r(o)},url:g,hex:g,email:g,required:function(e,t,r,n,i){var o=[],a=Array.isArray(t)?"array":typeof t;y.required(e,t,n,o,i,a),r(o)}};function w(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var q=w();function x(e){this.rules=null,this._messages=q,this.define(e)}x.prototype={messages:function(e){return e&&(this._messages=c(w(),e)),this._messages},define:function(e){if(!e)throw new Error("Cannot configure a schema with no rules");if("object"!=typeof e||Array.isArray(e))throw new Error("Rules must be an object");var t,r;for(t in this.rules={},e)e.hasOwnProperty(t)&&(r=e[t],this.rules[t]=Array.isArray(r)?r:[r])},validate:function(e,t,n){var i=this;void 0===t&&(t={}),void 0===n&&(n=function(){});var u,s,d=e,p=t,h=n;if("function"==typeof p&&(h=p,p={}),!this.rules||0===Object.keys(this.rules).length)return h&&h(),Promise.resolve();if(p.messages){var v=this.messages();v===q&&(v=w()),c(v,p.messages),p.messages=v}else p.messages=this.messages();var y={};(p.keys||Object.keys(this.rules)).forEach(function(t){u=i.rules[t],s=d[t],u.forEach(function(n){var o=n;"function"==typeof o.transform&&(d===e&&(d=r({},d)),s=d[t]=o.transform(s)),(o="function"==typeof o?{validator:o}:r({},o)).validator=i.getValidationMethod(o),o.field=t,o.fullField=o.fullField||t,o.type=i.getType(o),o.validator&&(y[t]=y[t]||[],y[t].push({rule:o,value:s,source:d,field:t}))})});var m={};return f(y,p,function(e,t){var n,i=e.rule,o=!("object"!==i.type&&"array"!==i.type||"object"!=typeof i.fields&&"object"!=typeof i.defaultField);function u(e,t){return r({},t,{fullField:i.fullField+"."+e})}function s(n){void 0===n&&(n=[]);var s=n;if(Array.isArray(s)||(s=[s]),!p.suppressWarning&&s.length&&x.warning("async-validator:",s),s.length&&i.message&&(s=[].concat(i.message)),s=s.map(l(i)),p.first&&s.length)return m[i.field]=1,t(s);if(o){if(i.required&&!e.value)return s=i.message?[].concat(i.message).map(l(i)):p.error?[p.error(i,a(p.messages.required,i.field))]:[],t(s);var f={};if(i.defaultField)for(var c in e.value)e.value.hasOwnProperty(c)&&(f[c]=i.defaultField);for(var d in f=r({},f,{},e.rule.fields))if(f.hasOwnProperty(d)){var h=Array.isArray(f[d])?f[d]:[f[d]];f[d]=h.map(u.bind(null,d))}var v=new x(f);v.messages(p.messages),e.rule.options&&(e.rule.options.messages=p.messages,e.rule.options.error=p.error),v.validate(e.value,e.rule.options||p,function(e){var r=[];s&&s.length&&r.push.apply(r,s),e&&e.length&&r.push.apply(r,e),t(r.length?r:null)})}else t(s)}o=o&&(i.required||!i.required&&e.value),i.field=e.field,i.asyncValidator?n=i.asyncValidator(i,e.value,s,e.source,p):i.validator&&(!0===(n=i.validator(i,e.value,s,e.source,p))?s():!1===n?s(i.message||i.field+" fails"):n instanceof Array?s(n):n instanceof Error&&s(n.message)),n&&n.then&&n.then(function(){return s()},function(e){return s(e)})},function(e){!function(e){var t,r,n,i=[],a={};for(t=0;t1)for(var r=1;r0&&e.every(function(e){(0,o.default)(this,t),this.isRequired=e.required}.bind(this)),this.$on("on-form-change",this.onFiledChange),this.$on("on-form-blur",this.onFiledBlur)},getCurrentRule:function(){var t=this.form.rules;return t?t[this.prop]:[]},validate:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){(0,o.default)(this,e)}.bind(this),r=this.getCurrentRule();if(0===r.length)return!0;var a=(0,i.default)({},this.prop,r),s=new u.default(a),f=(0,i.default)({},this.prop,this.filedValue);s.validate(f,{firstFields:!0},function(t){(0,o.default)(this,e),this.validateState=t?"error":"success",this.validateMessage=t?t[0].message:"",n(this.validateMessage)}.bind(this))},onFiledChange:function(t){this.validate("change")},onFiledBlur:function(t){this.validate("blur")},resetFiled:function(){this.validateState="",this.validateMessage="",this.form.model[this.prop]=this.initialFieldValue}}};e.default=a},function(t,e,n){"use strict";n.r(e);var r=n(18),i=n.n(r);for(var o in r)"default"!==o&&function(t){n.d(e,t,function(){return r[t]})}(o);e.default=i.a},function(t,e,n){"use strict";var r=n(0);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(49)),o=n(46),u={name:"lInput",mixins:[r(n(50)).default],props:{value:{type:String,default:""},size:{validator:function(t){return(0,o.oneOf)(t,["small","large","default"])},default:"default"}},data:function(){return{currentValue:this.value}},watch:{value:function(t){this.currentValue=t}},computed:{inputClass:function(){return(0,i.default)({},"".concat("lime-input","__size-").concat(this.size),!0)}},methods:{handleInput:function(t){var e=t.target.value;this.currentValue=e,this.$emit("input",e),this.dispatch("lFormItem","on-form-change",e)},handleBlur:function(){this.dispatch("lFormItem","on-form-blur",this.currentValue)}}};e.default=u},function(t,e,n){"use strict";n.r(e);var r=n(20),i=n.n(r);for(var o in r)"default"!==o&&function(t){n.d(e,t,function(){return r[t]})}(o);e.default=i.a},function(t,e,n){"use strict";var r=n(0);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(4)),o={data:function(){return{notices:[]}},methods:{add:function(t){var e=this,n=+new Date;t.id=n,this.notices.push(t);var r=t.duration;setTimeout(function(){(0,i.default)(this,e),this.remove(n)}.bind(this),1e3*r)},remove:function(t){for(var e=0;e=t.length?(this._t=void 0,i(1)):i(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(t,e){t.exports=!1},function(t,e,n){var r=n(24),i=n(3).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(3),i=n(7),o=n(5),u=n(9),a=n(60),s=function(t,e,n){var f,c,l,d,p=t&s.F,h=t&s.G,v=t&s.S,y=t&s.P,m=t&s.B,g=h?r:v?r[e]||(r[e]={}):(r[e]||{}).prototype,b=h?i:i[e]||(i[e]={}),_=b.prototype||(b.prototype={});for(f in h&&(n=e),n)l=((c=!p&&g&&void 0!==g[f])?g:n)[f],d=m&&c?a(l,r):y&&"function"==typeof l?a(Function.call,l):l,g&&u(g,f,l,t&s.U),b[f]!=l&&o(b,f,d),y&&_[f]!=l&&(_[f]=l)};r.core=i,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(8).f,i=n(10),o=n(2)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},function(t,e,n){var r=n(40);t.exports=function(t){return Object(r(t))}},function(t,e,n){"use strict";var r=n(0);Object.defineProperty(e,"__esModule",{value:!0}),e.oneOf=function(t,e){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];Object.keys(c).forEach(function(n){(0,i.default)(this,e),t.component(n,c[n])}.bind(this)),t.prototype.$notice=f.default};e.default=l},function(t,e,n){for(var r=n(35),i=n(28),o=n(9),u=n(3),a=n(5),s=n(26),f=n(2),c=f("iterator"),l=f("toStringTag"),d=s.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},h=i(p),v=0;vdocument.F=Object<\/script>"),t.close(),s=t.F;r--;)delete s.prototype[o[r]];return s()};t.exports=Object.create||function(t,e){var n;return null!==t?(a.prototype=r(t),n=new a,a.prototype=null,n[u]=t):n=s(),void 0===e?n:i(n,e)}},function(t,e,n){var r=n(8),i=n(23),o=n(28);t.exports=n(6)?Object.defineProperties:function(t,e){i(t);for(var n,u=o(e),a=u.length,s=0;a>s;)r.f(t,n=u[s++],e[n]);return t}},function(t,e,n){var r=n(10),i=n(27),o=n(66)(!1),u=n(29)("IE_PROTO");t.exports=function(t,e){var n,a=i(t),s=0,f=[];for(n in a)n!=u&&r(a,n)&&f.push(n);for(;e.length>s;)r(a,n=e[s++])&&(~o(f,n)||f.push(n));return f}},function(t,e,n){var r=n(27),i=n(67),o=n(68);t.exports=function(t){return function(e,n,u){var a,s=r(e),f=i(s.length),c=o(u,f);if(t&&n!=n){for(;f>c;)if((a=s[c++])!=a)return!0}else for(;f>c;c++)if((t||c in s)&&s[c]===n)return t||c||0;return!t&&-1}}},function(t,e,n){var r=n(42),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},function(t,e,n){var r=n(42),i=Math.max,o=Math.min;t.exports=function(t,e){return(t=r(t))<0?i(t+e,0):o(t,e)}},function(t,e,n){var r=n(3).document;t.exports=r&&r.documentElement},function(t,e,n){var r=n(10),i=n(45),o=n(29)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,e,n){"use strict";var r=n(72),i={};i[n(2)("toStringTag")]="z",i+""!="[object z]"&&n(9)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(t,e,n){var r=n(39),i=n(2)("toStringTag"),o="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,u;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?n:o?r(e):"Object"==(u=r(e))&&"function"==typeof e.callee?"Arguments":u}},function(t,e,n){var r=n(45),i=n(28);n(74)("keys",function(){return function(t){return i(r(t))}})},function(t,e,n){var r=n(41),i=n(7),o=n(25);t.exports=function(t,e){var n=(i.Object||{})[t]||Object[t],u={};u[t]=e(n),r(r.S+r.F*o(function(){n(1)}),"Object",u)}},function(t,e,n){"use strict";var r=n(0);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(76)).default;e.default=i},function(t,e,n){"use strict";n.r(e);var r=n(30),i=n(11);for(var o in i)"default"!==o&&function(t){n.d(e,t,function(){return i[t]})}(o);var u=n(1),a=Object(u.a)(i.default,r.a,r.b,!1,null,null,null);e.default=a.exports},function(t,e,n){"use strict";var r=n(0);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(78)),o=r(n(48));i.default.Item=o.default;var u=i.default;e.default=u},function(t,e,n){"use strict";n.r(e);var r=n(31),i=n(13);for(var o in i)"default"!==o&&function(t){n.d(e,t,function(){return i[t]})}(o);var u=n(1),a=Object(u.a)(i.default,r.a,r.b,!1,null,null,null);e.default=a.exports},function(t,e,n){"use strict";n.r(e),function(t){function n(){return(n=Object.assign||function(t){for(var e=1;e=u)return t;switch(t){case"%s":return String(e[i++]);case"%d":return Number(e[i++]);case"%j":try{return JSON.stringify(e[i++])}catch(t){return"[Circular]"}break;default:return t}}),s=e[i];i()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,url:new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},h={integer:function(t){return h.number(t)&&parseInt(t,10)===t},float:function(t){return h.number(t)&&!h.integer(t)},array:function(t){return Array.isArray(t)},regexp:function(t){if(t instanceof RegExp)return!0;try{return!!new RegExp(t)}catch(t){return!1}},date:function(t){return"function"==typeof t.getTime&&"function"==typeof t.getMonth&&"function"==typeof t.getYear},number:function(t){return!isNaN(t)&&"number"==typeof t},object:function(t){return"object"==typeof t&&!h.array(t)},method:function(t){return"function"==typeof t},email:function(t){return"string"==typeof t&&!!t.match(p.email)&&t.length<255},url:function(t){return"string"==typeof t&&!!t.match(p.url)},hex:function(t){return"string"==typeof t&&!!t.match(p.hex)}};var v="enum";var y={required:d,whitespace:function(t,e,n,r,i){(/^\s+$/.test(e)||""===e)&&r.push(u(i.messages.whitespace,t.fullField))},type:function(t,e,n,r,i){if(t.required&&void 0===e)d(t,e,n,r,i);else{var o=t.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(o)>-1?h[o](e)||r.push(u(i.messages.types[o],t.fullField,t.type)):o&&typeof e!==t.type&&r.push(u(i.messages.types[o],t.fullField,t.type))}},range:function(t,e,n,r,i){var o="number"==typeof t.len,a="number"==typeof t.min,s="number"==typeof t.max,f=e,c=null,l="number"==typeof e,d="string"==typeof e,p=Array.isArray(e);if(l?c="number":d?c="string":p&&(c="array"),!c)return!1;p&&(f=e.length),d&&(f=e.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"_").length),o?f!==t.len&&r.push(u(i.messages[c].len,t.fullField,t.len)):a&&!s&&ft.max?r.push(u(i.messages[c].max,t.fullField,t.max)):a&&s&&(ft.max)&&r.push(u(i.messages[c].range,t.fullField,t.min,t.max))},enum:function(t,e,n,r,i){t[v]=Array.isArray(t[v])?t[v]:[],-1===t[v].indexOf(e)&&r.push(u(i.messages[v],t.fullField,t[v].join(", ")))},pattern:function(t,e,n,r,i){if(t.pattern)if(t.pattern instanceof RegExp)t.pattern.lastIndex=0,t.pattern.test(e)||r.push(u(i.messages.pattern.mismatch,t.fullField,e,t.pattern));else if("string"==typeof t.pattern){new RegExp(t.pattern).test(e)||r.push(u(i.messages.pattern.mismatch,t.fullField,e,t.pattern))}}};var m="enum";function g(t,e,n,r,i){var o=t.type,u=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e,o)&&!t.required)return n();y.required(t,e,r,u,i,o),a(e,o)||y.type(t,e,r,u,i)}n(u)}var b={string:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e,"string")&&!t.required)return n();y.required(t,e,r,o,i,"string"),a(e,"string")||(y.type(t,e,r,o,i),y.range(t,e,r,o,i),y.pattern(t,e,r,o,i),!0===t.whitespace&&y.whitespace(t,e,r,o,i))}n(o)},method:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e)&&!t.required)return n();y.required(t,e,r,o,i),void 0!==e&&y.type(t,e,r,o,i)}n(o)},number:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(""===e&&(e=void 0),a(e)&&!t.required)return n();y.required(t,e,r,o,i),void 0!==e&&(y.type(t,e,r,o,i),y.range(t,e,r,o,i))}n(o)},boolean:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e)&&!t.required)return n();y.required(t,e,r,o,i),void 0!==e&&y.type(t,e,r,o,i)}n(o)},regexp:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e)&&!t.required)return n();y.required(t,e,r,o,i),a(e)||y.type(t,e,r,o,i)}n(o)},integer:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e)&&!t.required)return n();y.required(t,e,r,o,i),void 0!==e&&(y.type(t,e,r,o,i),y.range(t,e,r,o,i))}n(o)},float:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e)&&!t.required)return n();y.required(t,e,r,o,i),void 0!==e&&(y.type(t,e,r,o,i),y.range(t,e,r,o,i))}n(o)},array:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e,"array")&&!t.required)return n();y.required(t,e,r,o,i,"array"),a(e,"array")||(y.type(t,e,r,o,i),y.range(t,e,r,o,i))}n(o)},object:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e)&&!t.required)return n();y.required(t,e,r,o,i),void 0!==e&&y.type(t,e,r,o,i)}n(o)},enum:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e)&&!t.required)return n();y.required(t,e,r,o,i),void 0!==e&&y[m](t,e,r,o,i)}n(o)},pattern:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e,"string")&&!t.required)return n();y.required(t,e,r,o,i),a(e,"string")||y.pattern(t,e,r,o,i)}n(o)},date:function(t,e,n,r,i){var o=[];if(t.required||!t.required&&r.hasOwnProperty(t.field)){if(a(e)&&!t.required)return n();var u;if(y.required(t,e,r,o,i),!a(e))u="number"==typeof e?new Date(e):e,y.type(t,u,r,o,i),u&&y.range(t,u.getTime(),r,o,i)}n(o)},url:g,hex:g,email:g,required:function(t,e,n,r,i){var o=[],u=Array.isArray(e)?"array":typeof e;y.required(t,e,r,o,i,u),n(o)}};function _(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var t=JSON.parse(JSON.stringify(this));return t.clone=this.clone,t}}}var x=_();function O(t){this.rules=null,this._messages=x,this.define(t)}O.prototype={messages:function(t){return t&&(this._messages=l(_(),t)),this._messages},define:function(t){if(!t)throw new Error("Cannot configure a schema with no rules");if("object"!=typeof t||Array.isArray(t))throw new Error("Rules must be an object");var e,n;for(e in this.rules={},t)t.hasOwnProperty(e)&&(n=t[e],this.rules[e]=Array.isArray(n)?n:[n])},validate:function(t,e,r){var i=this;void 0===e&&(e={}),void 0===r&&(r=function(){});var a,s,d=t,p=e,h=r;if("function"==typeof p&&(h=p,p={}),!this.rules||0===Object.keys(this.rules).length)return h&&h(),Promise.resolve();if(p.messages){var v=this.messages();v===x&&(v=_()),l(v,p.messages),p.messages=v}else p.messages=this.messages();var y={};(p.keys||Object.keys(this.rules)).forEach(function(e){a=i.rules[e],s=d[e],a.forEach(function(r){var o=r;"function"==typeof o.transform&&(d===t&&(d=n({},d)),s=d[e]=o.transform(s)),(o="function"==typeof o?{validator:o}:n({},o)).validator=i.getValidationMethod(o),o.field=e,o.fullField=o.fullField||e,o.type=i.getType(o),o.validator&&(y[e]=y[e]||[],y[e].push({rule:o,value:s,source:d,field:e}))})});var m={};return f(y,p,function(t,e){var r,i=t.rule,o=!("object"!==i.type&&"array"!==i.type||"object"!=typeof i.fields&&"object"!=typeof i.defaultField);function a(t,e){return n({},e,{fullField:i.fullField+"."+t})}function s(r){void 0===r&&(r=[]);var s=r;if(Array.isArray(s)||(s=[s]),!p.suppressWarning&&s.length&&O.warning("async-validator:",s),s.length&&i.message&&(s=[].concat(i.message)),s=s.map(c(i)),p.first&&s.length)return m[i.field]=1,e(s);if(o){if(i.required&&!t.value)return s=i.message?[].concat(i.message).map(c(i)):p.error?[p.error(i,u(p.messages.required,i.field))]:[],e(s);var f={};if(i.defaultField)for(var l in t.value)t.value.hasOwnProperty(l)&&(f[l]=i.defaultField);for(var d in f=n({},f,{},t.rule.fields))if(f.hasOwnProperty(d)){var h=Array.isArray(f[d])?f[d]:[f[d]];f[d]=h.map(a.bind(null,d))}var v=new O(f);v.messages(p.messages),t.rule.options&&(t.rule.options.messages=p.messages,t.rule.options.error=p.error),v.validate(t.value,t.rule.options||p,function(t){var n=[];s&&s.length&&n.push.apply(n,s),t&&t.length&&n.push.apply(n,t),e(n.length?n:null)})}else e(s)}o=o&&(i.required||!i.required&&t.value),i.field=t.field,i.asyncValidator?r=i.asyncValidator(i,t.value,s,t.source,p):i.validator&&(!0===(r=i.validator(i,t.value,s,t.source,p))?s():!1===r?s(i.message||i.field+" fails"):r instanceof Array?s(r):r instanceof Error&&s(r.message)),r&&r.then&&r.then(function(){return s()},function(t){return s(t)})},function(t){!function(t){var e,n,r,i=[],u={};for(e=0;e1)for(var n=1;n