Skip to content

Commit

Permalink
build npm 1.2.8 & update ext
Browse files Browse the repository at this point in the history
  • Loading branch information
mehaotian committed Nov 19, 2020
1 parent 89220d5 commit 9c830cf
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 52 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ uniCard|[卡片](https://ext.dcloud.net.cn/plugin?id=22)
uniCollapse|[折叠面板](https://ext.dcloud.net.cn/plugin?id=23)
uniCombox|[组合框](https://ext.dcloud.net.cn/plugin?id=1261)
uniCountdown|[倒计时](https://ext.dcloud.net.cn/plugin?id=25)
uniDataCheckbox|[数据选择器](https://ext.dcloud.net.cn/plugin?id=9999)
uniDataCheckbox|[数据选择器](https://ext.dcloud.net.cn/plugin?id=3456)
uniDateformat|[日期格式化](https://ext.dcloud.net.cn/plugin?id=3279)
uniDrawer|[抽屉](https://ext.dcloud.net.cn/plugin?id=26)
uniEasyinput|[增强输入框](https://ext.dcloud.net.cn/plugin?id=9999)
uniEasyinput|[增强输入框](https://ext.dcloud.net.cn/plugin?id=3455)
uniFab|[悬浮按钮](https://ext.dcloud.net.cn/plugin?id=144)
uniFav|[收藏按钮](https://ext.dcloud.net.cn/plugin?id=864)
uniField|[输入框](https://ext.dcloud.net.cn/plugin?id=21001)
Expand Down
7 changes: 7 additions & 0 deletions packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,17 @@ uniCard|[卡片](https://ext.dcloud.net.cn/plugin?id=22)
uniCollapse|[折叠面板](https://ext.dcloud.net.cn/plugin?id=23)
uniCombox|[组合框](https://ext.dcloud.net.cn/plugin?id=1261)
uniCountdown|[倒计时](https://ext.dcloud.net.cn/plugin?id=25)
uniDataCheckbox|[数据选择器](https://ext.dcloud.net.cn/plugin?id=9999)
uniDateformat|[日期格式化](https://ext.dcloud.net.cn/plugin?id=3279)
uniDrawer|[抽屉](https://ext.dcloud.net.cn/plugin?id=26)
uniEasyinput|[增强输入框](https://ext.dcloud.net.cn/plugin?id=9999)
uniFab|[悬浮按钮](https://ext.dcloud.net.cn/plugin?id=144)
uniFav|[收藏按钮](https://ext.dcloud.net.cn/plugin?id=864)
uniField|[输入框](https://ext.dcloud.net.cn/plugin?id=21001)
uniForms|[表单](https://ext.dcloud.net.cn/plugin?id=2773)
uniGoodsNav|[商品导航](https://ext.dcloud.net.cn/plugin?id=865)
uniGrid|[宫格](https://ext.dcloud.net.cn/plugin?id=27)
uniGroup|[分组](https://ext.dcloud.net.cn/plugin?id=21002)
uniIcons|[图标](https://ext.dcloud.net.cn/plugin?id=28)
uniIndexedList|[索引列表](https://ext.dcloud.net.cn/plugin?id=375)
uniLink|[超链接](https://ext.dcloud.net.cn/plugin?id=1182)
Expand All @@ -141,6 +147,7 @@ uniSegmentedControl|[分段器](https://ext.dcloud.net.cn/plugin?id=54)
uniSteps|[步骤条](https://ext.dcloud.net.cn/plugin?id=34)
uniSwipeAction|[滑动操作](https://ext.dcloud.net.cn/plugin?id=181)
uniSwiperDot|[轮播图指示点](https://ext.dcloud.net.cn/plugin?id=284)
uniTable|[表格](https://ext.dcloud.net.cn/plugin?id=3270)
uniTag|[标签](https://ext.dcloud.net.cn/plugin?id=35)
uniTitle|[章节标题](https://ext.dcloud.net.cn/plugin?id=1066)
uniTransition|[过渡动画](https://ext.dcloud.net.cn/plugin?id=985)
Expand Down
7 changes: 2 additions & 5 deletions packages/lib/uni-data-checkbox/clientdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,11 @@ export default {
let db = null;
let dbCmd = null;

try {
if(this.collection){
this.db = uniCloud.database();
this.dbCmd = db.command;
} catch (err) {
this.db = null
this.dbCmd = null
}

this._isEnded = false

this.$watch(() => {
Expand Down
13 changes: 11 additions & 2 deletions packages/lib/uni-data-checkbox/uni-data-checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,18 @@
}
};
},
created() {
created() {
this.form = this.getForm('uniForms')
this.formItem = this.getForm('uniFormsItem')
this.formItem && this.formItem.setValue(this.value)
this.formItem && this.formItem.setValue(this.value)
if (this.formItem) {
if(this.formItem.name){
this.rename = this.formItem.name
this.form.inputChildrens.push(this)
}
}
if (this.localdata && this.localdata.length !== 0) {
this.range = this.localdata
this.dataList = this.getDataList(this.getSelectedValue(this.range))
Expand Down
29 changes: 22 additions & 7 deletions packages/lib/uni-easyinput/uni-easyinput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<uni-icons v-if="prefixIcon" class="content-clear-icon" :type="prefixIcon" color="#c0c4cc"></uni-icons>
<textarea v-if="type === 'textarea'" class="uni-easyinput__content-textarea" :class="{'input-padding':inputBorder}"
:name="name" :value="val" :placeholder="placeholder" :placeholderStyle="placeholderStyle" :disabled="disabled"
:maxlength="inputMaxlength" :focus="focus" :autoHeight="autoHeight" @input="onInput" @blur="onBlur" @focus="onFocus"
:maxlength="inputMaxlength" :focus="focused" :autoHeight="autoHeight" @input="onInput" @blur="onBlur" @focus="onFocus"
@confirm="onConfirm"></textarea>
<input v-else :type="type === 'password'?'text':type" class="uni-easyinput__content-input"
:style="{
Expand All @@ -13,7 +13,7 @@
'color':msg?'#dd524d':''
}"
:name="name" :value="val" :password="!showPassword && type === 'password'" :placeholder="placeholder"
:placeholderStyle="placeholderStyle" :disabled="disabled" :maxlength="inputMaxlength" :focus="focus" @focus="onFocus"
:placeholderStyle="placeholderStyle" :disabled="disabled" :maxlength="inputMaxlength" :focus="focused" @focus="onFocus"
@blur="onBlur" @input="onInput" @confirm="onConfirm" />
<template v-if="type === 'password'">
<uni-icons v-if="val != '' " class="content-clear-icon" :class="{'is-textarea-icon':type==='textarea'}" :type="showPassword?'eye-slash-filled':'eye-filled'"
Expand Down Expand Up @@ -77,11 +77,14 @@
},
autoHeight: {
type: Boolean,
default: true
default: false
},
placeholder: String,
placeholderStyle: String,
focus: Boolean,
focus: {
type:Boolean,
default:false
},
disabled: {
type: Boolean,
default: false
Expand Down Expand Up @@ -145,6 +148,12 @@
if (this.formItem) {
this.formItem.setValue(newVal)
}
},
focus(newVal){
console.log(newVal);
this.$nextTick(()=>{
this.focused = this.focus
})
}
},
created() {
Expand All @@ -156,7 +165,13 @@
this.rename = this.formItem.name
this.form.inputChildrens.push(this)
}
}
}
},
mounted() {
this.$nextTick(()=>{
this.focused = this.focus
})
},
methods: {
/**
Expand Down Expand Up @@ -284,9 +299,9 @@
// padding-right: 10px;
padding-top: 6px;
padding-bottom: 10px;
box-sizing: border-box;
// box-sizing: border-box;
min-height: 80px;
// height: 80px;
height: 80px;
}
.input-padding {
Expand Down
1 change: 1 addition & 0 deletions packages/lib/uni-forms-item/uni-forms-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@
color: #333;
font-size: 14px;
margin-bottom: 22px;
background-color: #fff;
}
.uni-forms-item__inner {
Expand Down
85 changes: 49 additions & 36 deletions packages/lib/uni-forms/uni-forms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,20 @@
* @event {Function} submit 提交时触发
*/
import Vue from 'vue'
Vue.prototype.binddata = function(name, value, formName) {
Vue.prototype.binddata = function(name, value, formName) {
if (formName) {
this.$refs[formName].setValue(name, value)
} else {
let refName = null
let formVm
for (let i in this.$refs) {
if (this.$refs[i] && this.$refs[i].$options.name === 'uniForms') {
refName = i
const vm = this.$refs[i]
if (vm && vm.$options && vm.$options.name === 'uniForms') {
formVm = vm
break
}
}
if (!refName) return console.error('当前 uni-froms 组件缺少 ref 属性')
this.$refs[refName].setValue(name, value)
if (!formVm) return console.error('当前 uni-froms 组件缺少 ref 属性')
formVm.setValue(name, value)
}
}
Expand Down Expand Up @@ -107,14 +108,14 @@
this.formTrigger = trigger
},
value: {
handler(newVal) {
handler(newVal) {
if (this.isChildEdit) {
this.isChildEdit = false
return
}
}
this.childrens.forEach((item) => {
if (item.name) {
const formDataValue = newVal.hasOwnProperty(item.name) ? newVal[item.name] : null
if (item.name) {
const formDataValue = newVal.hasOwnProperty(item.name) ? newVal[item.name] : null
this.formData[item.name] = this._getValue(item, formDataValue)
}
})
Expand All @@ -124,8 +125,9 @@
},
created() {
let _this = this
this.childrens = []
this.inputChildrens = []
this.childrens = []
this.inputChildrens = []
this.checkboxChildrens = []
this.formRules = []
this.init(this.rules)
},
Expand Down Expand Up @@ -159,7 +161,7 @@
let example = this.childrens.find(child => child.name === name)
if (!example) return null
this.isChildEdit = true
value = this._getValue(example, value)
value = this._getValue(example, value)
this.formData[name] = value
example.val = value
this.$emit('input', Object.assign({}, this.value, this.formData))
Expand All @@ -180,9 +182,12 @@
*/
resetForm(event) {
this.childrens.forEach(item => {
item.errMsg = ''
item.val = ''
item.$emit('input', '')
item.errMsg = ''
const inputComp = this.inputChildrens.find(child => child.rename === item.name)
if (inputComp) {
inputComp.errMsg = ''
inputComp.$emit('input', inputComp.multiple?[]:'')
}
})
this.isChildEdit = true
Expand All @@ -200,7 +205,7 @@
* 触发表单校验,通过 @validate 获取
* @param {Object} validate
*/
validateCheck(validate) {
validateCheck(validate) {
if (validate === null) validate = null
this.$emit('validate', validate)
},
Expand Down Expand Up @@ -259,11 +264,11 @@
[i]: fieldsValue[i]
}, this.formData)
if (resultData) {
example = this.childrens.find(child => child.name === resultData.key)
const inputComp = this.inputChildrens.find(child=>child.rename === example.name)
if(inputComp){
inputComp.errMsg = resultData.errorMessage
}
example = this.childrens.find(child => child.name === resultData.key)
const inputComp = this.inputChildrens.find(child => child.rename === example.name)
if (inputComp) {
inputComp.errMsg = resultData.errorMessage
}
result.push(resultData)
if (this.errShowType === 'undertext') {
if (example) example.errMsg = resultData.errorMessage
Expand Down Expand Up @@ -304,8 +309,8 @@
callback && typeof callback === 'function' && callback(result, invalidFields)
if (promise && callback) {
return promise
}else{
return null
} else {
return null
}
},
Expand All @@ -314,7 +319,7 @@
* 手动提交校验表单
* 对整个表单进行校验的方法,参数为一个回调函数。
*/
submit(callback) {
submit(callback) {
// Object.assign(this.formData,formData)
return this.validateAll(this.formData, 'submit', callback)
},
Expand Down Expand Up @@ -360,15 +365,22 @@
* 移除表单项的校验结果。传入待移除的表单项的 prop 属性或者 prop 组成的数组,如不传则移除整个表单的校验结果
*/
clearValidate(props) {
props = [].concat(props||[]);
props = [].concat(props);
this.childrens.forEach(item => {
// if (props.length === 0) {
// item.errMsg = ''
// } else {
const inputComp = this.inputChildrens.find(child => child.rename === item.name)
if (props.length === 0) {
item.errMsg = ''
if (inputComp) {
inputComp.errMsg = ''
}
} else {
if (props.indexOf(item.name) !== -1) {
item.errMsg = ''
if (inputComp) {
inputComp.errMsg = ''
}
}
// }
}
})
},
// 把 value 转换成指定的类型
Expand All @@ -394,13 +406,14 @@
}
</script>

<style lang="scss" scoped>
.uni-forms {
overflow: hidden;
// padding: 10px 15px;
// background-color: #fff;
<style lang="scss" scoped>
.uni-forms {
overflow: hidden;
// padding: 10px 15px;
// background-color: #fff;
}
.uni-forms--top {
.uni-forms--top {
padding: 10px 15px;
// padding-top: 22px;
}
Expand Down

0 comments on commit 9c830cf

Please sign in to comment.