mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 00:45:55 +08:00
智慧宿舍系统小程序
This commit is contained in:
151
wechat/miniprogram/miniprogram_npm/@vant/weapp/field/index.js
Normal file
151
wechat/miniprogram/miniprogram_npm/@vant/weapp/field/index.js
Normal file
@@ -0,0 +1,151 @@
|
||||
'use strict';
|
||||
var __assign =
|
||||
(this && this.__assign) ||
|
||||
function () {
|
||||
__assign =
|
||||
Object.assign ||
|
||||
function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s)
|
||||
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
var utils_1 = require('../common/utils');
|
||||
var component_1 = require('../common/component');
|
||||
var props_1 = require('./props');
|
||||
component_1.VantComponent({
|
||||
field: true,
|
||||
classes: ['input-class', 'right-icon-class', 'label-class'],
|
||||
props: __assign(
|
||||
__assign(
|
||||
__assign(__assign({}, props_1.commonProps), props_1.inputProps),
|
||||
props_1.textareaProps
|
||||
),
|
||||
{
|
||||
size: String,
|
||||
icon: String,
|
||||
label: String,
|
||||
error: Boolean,
|
||||
center: Boolean,
|
||||
isLink: Boolean,
|
||||
leftIcon: String,
|
||||
rightIcon: String,
|
||||
autosize: null,
|
||||
required: Boolean,
|
||||
iconClass: String,
|
||||
clickable: Boolean,
|
||||
inputAlign: String,
|
||||
customStyle: String,
|
||||
errorMessage: String,
|
||||
arrowDirection: String,
|
||||
showWordLimit: Boolean,
|
||||
errorMessageAlign: String,
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
observer: 'setShowClear',
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
observer: 'setShowClear',
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
titleWidth: {
|
||||
type: String,
|
||||
value: '6.2em',
|
||||
},
|
||||
}
|
||||
),
|
||||
data: {
|
||||
focused: false,
|
||||
innerValue: '',
|
||||
showClear: false,
|
||||
},
|
||||
created: function () {
|
||||
this.value = this.data.value;
|
||||
this.setData({ innerValue: this.value });
|
||||
},
|
||||
methods: {
|
||||
onInput: function (event) {
|
||||
var _a = (event.detail || {}).value,
|
||||
value = _a === void 0 ? '' : _a;
|
||||
this.value = value;
|
||||
this.setShowClear();
|
||||
this.emitChange();
|
||||
},
|
||||
onFocus: function (event) {
|
||||
this.focused = true;
|
||||
this.setShowClear();
|
||||
this.$emit('focus', event.detail);
|
||||
},
|
||||
onBlur: function (event) {
|
||||
this.focused = false;
|
||||
this.setShowClear();
|
||||
this.$emit('blur', event.detail);
|
||||
},
|
||||
onClickIcon: function () {
|
||||
this.$emit('click-icon');
|
||||
},
|
||||
onClickInput: function (event) {
|
||||
this.$emit('click-input', event.detail);
|
||||
},
|
||||
onClear: function () {
|
||||
var _this = this;
|
||||
this.setData({ innerValue: '' });
|
||||
this.value = '';
|
||||
this.setShowClear();
|
||||
utils_1.nextTick(function () {
|
||||
_this.emitChange();
|
||||
_this.$emit('clear', '');
|
||||
});
|
||||
},
|
||||
onConfirm: function (event) {
|
||||
var _a = (event.detail || {}).value,
|
||||
value = _a === void 0 ? '' : _a;
|
||||
this.value = value;
|
||||
this.setShowClear();
|
||||
this.$emit('confirm', value);
|
||||
},
|
||||
setValue: function (value) {
|
||||
this.value = value;
|
||||
this.setShowClear();
|
||||
if (value === '') {
|
||||
this.setData({ innerValue: '' });
|
||||
}
|
||||
this.emitChange();
|
||||
},
|
||||
onLineChange: function (event) {
|
||||
this.$emit('linechange', event.detail);
|
||||
},
|
||||
onKeyboardHeightChange: function (event) {
|
||||
this.$emit('keyboardheightchange', event.detail);
|
||||
},
|
||||
emitChange: function () {
|
||||
var _this = this;
|
||||
this.setData({ value: this.value });
|
||||
utils_1.nextTick(function () {
|
||||
_this.$emit('input', _this.value);
|
||||
_this.$emit('change', _this.value);
|
||||
});
|
||||
},
|
||||
setShowClear: function () {
|
||||
var _a = this.data,
|
||||
clearable = _a.clearable,
|
||||
readonly = _a.readonly;
|
||||
var _b = this,
|
||||
focused = _b.focused,
|
||||
value = _b.value;
|
||||
this.setData({
|
||||
showClear: !!clearable && !!focused && !!value && !readonly,
|
||||
});
|
||||
},
|
||||
noop: function () {},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-cell": "../cell/index",
|
||||
"van-icon": "../icon/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<van-cell
|
||||
size="{{ size }}"
|
||||
icon="{{ leftIcon }}"
|
||||
center="{{ center }}"
|
||||
border="{{ border }}"
|
||||
is-link="{{ isLink }}"
|
||||
required="{{ required }}"
|
||||
clickable="{{ clickable }}"
|
||||
title-width="{{ titleWidth }}"
|
||||
title-style="margin-right: 12px;"
|
||||
custom-style="{{ customStyle }}"
|
||||
arrow-direction="{{ arrowDirection }}"
|
||||
custom-class="van-field"
|
||||
>
|
||||
<slot name="left-icon" slot="icon" />
|
||||
<view wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title">
|
||||
{{ label }}
|
||||
</view>
|
||||
<slot wx:else name="label" slot="title" />
|
||||
<view class="{{ utils.bem('field__body', [type]) }}">
|
||||
<view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
|
||||
<slot name="input" />
|
||||
</view>
|
||||
<include wx:if="{{ type === 'textarea' }}" src="textarea.wxml" />
|
||||
<include wx:else src="input.wxml" />
|
||||
|
||||
<van-icon
|
||||
wx:if="{{ showClear }}"
|
||||
name="clear"
|
||||
class="van-field__clear-root van-field__icon-root"
|
||||
catch:touchstart="onClear"
|
||||
/>
|
||||
<view class="van-field__icon-container" bind:tap="onClickIcon">
|
||||
<van-icon
|
||||
wx:if="{{ rightIcon || icon }}"
|
||||
name="{{ rightIcon || icon }}"
|
||||
class="van-field__icon-root {{ iconClass }}"
|
||||
custom-class="right-icon-class"
|
||||
/>
|
||||
<slot name="right-icon" />
|
||||
<slot name="icon" />
|
||||
</view>
|
||||
<view class="van-field__button">
|
||||
<slot name="button" />
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit">
|
||||
<view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }}
|
||||
</view>
|
||||
<view wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
|
||||
{{ errorMessage }}
|
||||
</view>
|
||||
</van-cell>
|
||||
@@ -0,0 +1,18 @@
|
||||
/* eslint-disable */
|
||||
var style = require('../wxs/style.wxs');
|
||||
var addUnit = require('../wxs/add-unit.wxs');
|
||||
|
||||
function inputStyle(autosize) {
|
||||
if (autosize && autosize.constructor === 'Object') {
|
||||
return style({
|
||||
'min-height': addUnit(autosize.minHeight),
|
||||
'max-height': addUnit(autosize.maxHeight),
|
||||
});
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
inputStyle: inputStyle,
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';.van-field{--cell-icon-size:16px;--cell-icon-size:var(--field-icon-size,16px)}.van-field__label{color:#646566;color:var(--field-label-color,#646566)}.van-field__label--disabled{color:#c8c9cc;color:var(--field-disabled-text-color,#c8c9cc)}.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{box-sizing:border-box;padding:3.6px 0;line-height:1.2em;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__control:empty+.van-field__control{display:block}.van-field__control{position:relative;display:none;box-sizing:border-box;width:100%;margin:0;padding:0;line-height:inherit;text-align:left;background-color:initial;border:0;resize:none;color:#323233;color:var(--field-input-text-color,#323233);height:24px;height:var(--cell-line-height,24px);min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__control:empty{display:none}.van-field__control--textarea{height:18px;height:var(--field-text-area-min-height,18px);min-height:18px;min-height:var(--field-text-area-min-height,18px)}.van-field__control--error{color:#ee0a24;color:var(--field-input-error-text-color,#ee0a24)}.van-field__control--disabled{background-color:initial;opacity:1;color:#c8c9cc;color:var(--field-input-disabled-text-color,#c8c9cc)}.van-field__control--center{text-align:center}.van-field__control--right{text-align:right}.van-field__control--custom{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__placeholder{position:absolute;top:0;right:0;left:0;pointer-events:none;color:#c8c9cc;color:var(--field-placeholder-text-color,#c8c9cc)}.van-field__placeholder--error{color:#ee0a24;color:var(--field-error-message-color,#ee0a24)}.van-field__icon-root{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__clear-root,.van-field__icon-container{line-height:inherit;vertical-align:middle;padding:0 8px;padding:0 var(--padding-xs,8px);margin-right:-8px;margin-right:-var(--padding-xs,8px)}.van-field__button,.van-field__clear-root,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear-root{font-size:16px;font-size:var(--field-clear-icon-size,16px);color:#c8c9cc;color:var(--field-clear-icon-color,#c8c9cc)}.van-field__icon-container{font-size:16px;font-size:var(--field-icon-size,16px);color:#969799;color:var(--field-icon-container-color,#969799)}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:8px;padding-left:var(--padding-xs,8px)}.van-field__button:empty{display:none}.van-field__error-message{text-align:left;font-size:12px;font-size:var(--field-error-message-text-font-size,12px);color:#ee0a24;color:var(--field-error-message-color,#ee0a24)}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{text-align:right;margin-top:4px;margin-top:var(--padding-base,4px);color:#646566;color:var(--field-word-limit-color,#646566);font-size:12px;font-size:var(--field-word-limit-font-size,12px);line-height:16px;line-height:var(--field-word-limit-line-height,16px)}.van-field__word-num{display:inline}.van-field__word-num--full{color:#ee0a24;color:var(--field-word-num-full-color,#ee0a24)}
|
||||
@@ -0,0 +1,27 @@
|
||||
<input
|
||||
class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class"
|
||||
type="{{ type }}"
|
||||
focus="{{ focus }}"
|
||||
cursor="{{ cursor }}"
|
||||
value="{{ innerValue }}"
|
||||
auto-focus="{{ autoFocus }}"
|
||||
disabled="{{ disabled || readonly }}"
|
||||
maxlength="{{ maxlength }}"
|
||||
placeholder="{{ placeholder }}"
|
||||
placeholder-style="{{ placeholderStyle }}"
|
||||
placeholder-class="{{ utils.bem('field__placeholder', { error }) }}"
|
||||
confirm-type="{{ confirmType }}"
|
||||
confirm-hold="{{ confirmHold }}"
|
||||
hold-keyboard="{{ holdKeyboard }}"
|
||||
cursor-spacing="{{ cursorSpacing }}"
|
||||
adjust-position="{{ adjustPosition }}"
|
||||
selection-end="{{ selectionEnd }}"
|
||||
selection-start="{{ selectionStart }}"
|
||||
password="{{ password || type === 'password' }}"
|
||||
bindinput="onInput"
|
||||
bindtap="onClickInput"
|
||||
bindblur="onBlur"
|
||||
bindfocus="onFocus"
|
||||
bindconfirm="onConfirm"
|
||||
bindkeyboardheightchange="onKeyboardHeightChange"
|
||||
/>
|
||||
@@ -0,0 +1,66 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.textareaProps = exports.inputProps = exports.commonProps = void 0;
|
||||
exports.commonProps = {
|
||||
value: {
|
||||
type: String,
|
||||
observer: function (value) {
|
||||
if (value !== this.value) {
|
||||
this.setData({ innerValue: value });
|
||||
this.value = value;
|
||||
}
|
||||
},
|
||||
},
|
||||
placeholder: String,
|
||||
placeholderStyle: String,
|
||||
placeholderClass: String,
|
||||
disabled: Boolean,
|
||||
maxlength: {
|
||||
type: Number,
|
||||
value: -1,
|
||||
},
|
||||
cursorSpacing: {
|
||||
type: Number,
|
||||
value: 50,
|
||||
},
|
||||
autoFocus: Boolean,
|
||||
focus: Boolean,
|
||||
cursor: {
|
||||
type: Number,
|
||||
value: -1,
|
||||
},
|
||||
selectionStart: {
|
||||
type: Number,
|
||||
value: -1,
|
||||
},
|
||||
selectionEnd: {
|
||||
type: Number,
|
||||
value: -1,
|
||||
},
|
||||
adjustPosition: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
holdKeyboard: Boolean,
|
||||
};
|
||||
exports.inputProps = {
|
||||
type: {
|
||||
type: String,
|
||||
value: 'text',
|
||||
},
|
||||
password: Boolean,
|
||||
confirmType: String,
|
||||
confirmHold: Boolean,
|
||||
};
|
||||
exports.textareaProps = {
|
||||
autoHeight: Boolean,
|
||||
fixed: Boolean,
|
||||
showConfirmBar: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
disableDefaultPadding: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<textarea
|
||||
class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class"
|
||||
fixed="{{ fixed }}"
|
||||
focus="{{ focus }}"
|
||||
cursor="{{ cursor }}"
|
||||
value="{{ innerValue }}"
|
||||
auto-focus="{{ autoFocus }}"
|
||||
disabled="{{ disabled || readonly }}"
|
||||
maxlength="{{ maxlength }}"
|
||||
placeholder="{{ placeholder }}"
|
||||
placeholder-style="{{ placeholderStyle }}"
|
||||
placeholder-class="{{ utils.bem('field__placeholder', { error, disabled }) }}"
|
||||
auto-height="{{ !!autosize }}"
|
||||
style="{{ computed.inputStyle(autosize) }}"
|
||||
cursor-spacing="{{ cursorSpacing }}"
|
||||
adjust-position="{{ adjustPosition }}"
|
||||
show-confirm-bar="{{ showConfirmBar }}"
|
||||
hold-keyboard="{{ holdKeyboard }}"
|
||||
selection-end="{{ selectionEnd }}"
|
||||
selection-start="{{ selectionStart }}"
|
||||
disable-default-padding="{{ disableDefaultPadding }}"
|
||||
bindinput="onInput"
|
||||
bindtap="onClickInput"
|
||||
bindblur="onBlur"
|
||||
bindfocus="onFocus"
|
||||
bindconfirm="onConfirm"
|
||||
bindlinechange="onLineChange"
|
||||
bindkeyboardheightchange="onKeyboardHeightChange"
|
||||
/>
|
||||
Reference in New Issue
Block a user