@tuya-miniapp/smart-ui 2.0.2-beta-6 → 2.0.2-beta-8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,60 @@
1
+ <wxs src="../wxs/utils.wxs" module="utils" />
2
+ <wxs src="./index.wxs" module="computed" />
3
+
4
+ <smart-cell
5
+ size="{{ size }}"
6
+ icon="{{ leftIcon }}"
7
+ center="{{ center }}"
8
+ border="{{ border }}"
9
+ is-link="{{ isLink }}"
10
+ clickable="{{ clickable }}"
11
+ title-width="{{ titleWidth }}"
12
+ title-style="margin-right: 12px;"
13
+ custom-style="{{ customStyle }}"
14
+ arrow-direction="{{ arrowDirection }}"
15
+ custom-class="custom-class smart-field"
16
+ >
17
+ <view class="{{ utils.bem('field__left__body', { disabled, card: cardMode }) }}">
18
+ <view class="smart-field__left__icon">
19
+ <slot name="left-icon" slot="icon" />
20
+ </view>
21
+ <view class="smart-field__label" >
22
+ <text wx:if="{{ required }}" class="smart-field__label--required">*</text>
23
+ <label for="{{ name }}" class="label-class" wx:if="{{ label }}" slot="title">
24
+ {{ label }}
25
+ </label>
26
+ <slot wx:else name="label" slot="title" />
27
+ <view wx:if="{{ subLabel && cardMode }}" class="{{ utils.bem('field__label__card__subtitle', { error: errorMessage }) }}">{{ errorMessage || subLabel }}</view>
28
+ </view>
29
+ </view>
30
+ <view class="{{ utils.bem('field__body__box', { disabled }) }}">
31
+ <view class="{{ utils.bem('field__body', [type]) }}">
32
+ <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
33
+ <slot name="input" />
34
+ </view>
35
+ <include src="./input.wxml" />
36
+ <smart-icon
37
+ wx:if="{{ showClear }}"
38
+ name="{{ clearIcon }}"
39
+ class="smart-field__clear-root smart-field__icon-root"
40
+ catch:touchstart="onClear"
41
+ />
42
+ <view class="smart-field__icon-container" bind:tap="onClickIcon">
43
+ <smart-icon
44
+ wx:if="{{ rightIcon || icon }}"
45
+ name="{{ rightIcon || icon }}"
46
+ class="smart-field__icon-root {{ iconClass }}"
47
+ custom-class="right-icon-class"
48
+ />
49
+ <slot name="right-icon" />
50
+ <slot name="icon" />
51
+ </view>
52
+ <view class="smart-field__button">
53
+ <slot name="button" />
54
+ </view>
55
+ </view>
56
+ <label wx:if="{{ errorMessage && !interError && !cardMode }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
57
+ {{ errorMessage }}
58
+ </label>
59
+ </view>
60
+ </smart-cell>
@@ -0,0 +1,28 @@
1
+ <wxs src="../wxs/utils.wxs" module="utils" />
2
+ <wxs src="./index.wxs" module="computed" />
3
+ <view class="smart-field smart-field--textarea">
4
+ <view class="{{ utils.bem('field__left__body', { disabled, card: cardMode }) }}">
5
+ <view class="smart-field__left__icon">
6
+ <slot name="left-icon" slot="icon" />
7
+ </view>
8
+ <view class="smart-field__label" >
9
+ <text wx:if="{{ required }}" class="smart-field__label--required">*</text>
10
+ <label for="{{ name }}" class="label-class" wx:if="{{ label }}" slot="title">
11
+ {{ label }}
12
+ </label>
13
+ <slot wx:else name="label" slot="title" />
14
+ <view wx:if="{{ subLabel && cardMode }}" class="{{ utils.bem('field__label__card__subtitle', { error: errorMessage }) }}">{{ errorMessage || subLabel }}</view>
15
+ </view>
16
+ </view>
17
+ <view class="{{ utils.bem('field__body__box', { disabled }) }}">
18
+ <view class="{{ utils.bem('field__body', [type]) }}">
19
+ <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
20
+ <slot name="input" />
21
+ </view>
22
+ <include src="./textarea.wxml" />
23
+ </view>
24
+ <label wx:if="{{ showWordLimit && maxlength }}" class="smart-field__word-limit">
25
+ <view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }}
26
+ </label>
27
+ </view>
28
+ </view>
@@ -1,14 +1,13 @@
1
1
  import { SmartComponent } from '../../common/component';
2
+ import { Sun } from '@tuya-miniapp/icons';
2
3
  SmartComponent({
3
4
  data: {
4
- sms: '',
5
5
  value: '',
6
6
  password: '',
7
- username: '',
8
- username2: '',
9
- username3: '',
7
+ num: 2000,
8
+ value2: '123',
10
9
  message: '',
11
- phone: '1365577',
10
+ sunIcon: Sun
12
11
  },
13
12
  methods: {
14
13
  onClickIcon() {
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-field{--cell-icon-size:var(--field-icon-size,16px)}.smart-field__label{color:var(--field-label-color,var(--app-B6-N1,#000))}.smart-field__label--disabled{color:var(--field-disabled-text-color,#c8c9cc)}.smart-field__body{align-items:center;display:flex}.smart-field__body--textarea{box-sizing:border-box;line-height:1.2em;min-height:var(--cell-line-height,24px);padding:3.6px 0}.smart-field__body--search{flex:1}.smart-field__control:empty+.smart-field__control{display:block}.smart-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,var(--app-B6-N1,#000));display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:left;width:100%}.smart-field__control:empty{display:none}.smart-field__control--textarea{height:var(--field-text-area-min-height,18px);min-height:var(--field-text-area-min-height,18px)}.smart-field__control--error{color:var(--field-input-error-text-color,#ee0a24)}.smart-field__control--disabled{background-color:initial;color:var(--field-input-disabled-text-color,#c8c9cc);opacity:1}.smart-field__control--center{text-align:center}.smart-field__control--right{text-align:right}.smart-field__control--custom{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__placeholder{color:var(--field-placeholder-text-color,#c8c9cc);left:0;pointer-events:none;position:absolute;right:0;top:0}.smart-field__placeholder--error{color:var(--field-error-message-color,#ee0a24)}.smart-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__clear-root,.smart-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.smart-field__button,.smart-field__clear-root,.smart-field__icon-container{flex-shrink:0}.smart-field__clear-root{--icon-color:var(--field-clear-icon-color,var(--app-B4-N4,rgba(0,0,0,.4)));font-size:var(--field-clear-icon-size,16px)}.smart-field__icon-container{color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.smart-field__icon-container:empty{display:none}.smart-field__button{padding-left:var(--padding-xs,8px)}.smart-field__button:empty{display:none}.smart-field__error-message{color:var(--field-error-message-color,#ee0a24);display:block;font-size:var(--field-error-message-text-font-size,12px);margin-left:4px;text-align:left;white-space:nowrap}.smart-field__error-message--center{text-align:center}.smart-field__error-message--right{text-align:right}.smart-field__word-limit{color:var(--field-word-limit-color,#646566);font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);text-align:right}.smart-field__word-num{display:inline}.smart-field__word-num--full{color:var(--field-word-num-full-color,#ee0a24)}
1
+ @import '../common/index.css';.smart-field{--cell-icon-size:var(--field-icon-size,16px)}.smart-field__left__body{align-items:center;display:flex;text-align:left;width:var(--field-left-width,50%)}.smart-field__left__body--card{width:var(--field-left-card-width,100%)}.smart-field__left__body--disabled{opacity:var(--field-disabled-opacity,.5)}.smart-field__label{color:var(--field-label-color,var(--app-B6-N1,#000));font-size:var(--field-label-font-size,16px);line-height:var(--field-label-line-height,18px);text-align:left}.smart-field__label--required{color:var(--field-input-error-text-color,var(--app-M2,#f04c4c))}.smart-field__left__icon{display:flex;margin-right:10px}.smart-field__left__icon:empty{display:none}.smart-field__label__card__subtitle{color:var(--field-subtitle-text-color,var(--app-B6-N3,rgba(0,0,0,.5)));font-size:var(--field-sub-label-font-size,14px);line-height:var(--field-sub-label-line-height,16px);margin-top:4px}.smart-field__label__card__subtitle--error{color:var(--field-error-message-color,var(--app-M2,#f04c4c))}.smart-field__body__box{width:var(--field-left-card-width,100%)}.smart-field__body__box--disabled{opacity:var(--field-disabled-opacity,.5)}.smart-field__body{align-items:center;display:flex;justify-content:flex-end}.smart-field__control:empty+.smart-field__control{display:block}.smart-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,var(--app-B6-N5,rgba(0,0,0,.3)));display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:right;width:100%}.smart-field__control:empty{display:none}.smart-field__control--textarea{background-color:var(--field-textarea-background,var(--app-B3,#fff));border-radius:var(--field-textarea-border-radius,8px);height:var(--field-text-area-min-height,130px);min-height:var(--field-text-area-min-height,130px);padding:var(--field-textarea-padding,12px 8px);text-align:left}.smart-field__control--card{background:var(--field-card-background,var(--app-B6-N7,rgba(0,0,0,.1)));border-radius:var(--field-card-border-radius,8px);height:var(--field-card-height,38px);padding:var(--field-card-padding,0 10px);text-align:center;width:var(--field-card-width,105px)}.smart-field__control--limit{padding-bottom:var(--field-textarea-limit-padding-bottom,22px)}.smart-field__control--center{text-align:center}.smart-field__control--right{text-align:right}.smart-field__control--left{text-align:left}.smart-field__control--custom,.smart-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__clear-root,.smart-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.smart-field__button,.smart-field__clear-root,.smart-field__icon-container{flex-shrink:0}.smart-field__clear-root{--icon-color:var(--field-clear-icon-color,var(--app-B6-N4,rgba(0,0,0,.4)));font-size:var(--field-clear-icon-size,16px)}.smart-field__icon-container{--icon-color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.smart-field__icon-container:empty{display:none}.smart-field__button{padding-left:var(--padding-xs,8px)}.smart-field__button:empty{display:none}.smart-field__error-message{color:var(--field-error-message-color,var(--app-M2,#f04c4c));display:block;font-size:var(--field-error-message-text-font-size,14px);font-weight:400;line-height:var(--field-error-message-text-line-height,18px);text-align:right;white-space:nowrap}.smart-field__error-message--center{text-align:center}.smart-field__error-message--right{text-align:right}.smart-field--textarea{padding:0 16px}.smart-field--textarea .smart-field__left__body{margin-bottom:8px;width:100%}.smart-field--textarea .smart-field__body__box{position:relative}.smart-field__word-limit{bottom:8px;color:var(--field-word-limit-color,var(--app-B6-N4,rgba(0,0,0,.4)));font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);position:absolute;right:8px;text-align:right}.smart-field__word-num{display:inline}.smart-field__word-num--full{color:var(--field-word-num-full-color,var(--app-M2,#f04c4c))}
@@ -1,10 +1,13 @@
1
1
  import { nextTick } from '../common/utils';
2
2
  import { SmartComponent } from '../common/component';
3
3
  import { commonProps, inputProps, textareaProps } from './props';
4
+ import { Xmark } from '@tuya-miniapp/icons';
4
5
  SmartComponent({
5
6
  field: true,
6
7
  classes: ['input-class', 'right-icon-class', 'label-class'],
7
- props: Object.assign(Object.assign(Object.assign(Object.assign({}, commonProps), inputProps), 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: {
8
+ props: Object.assign(Object.assign(Object.assign(Object.assign({}, commonProps), inputProps), textareaProps), { size: String, icon: String, label: String, error: Boolean, center: Boolean, isLink: Boolean, leftIcon: String, rightIcon: String, autosize: null, required: Boolean, interError: Boolean, inputAlign: {
9
+ type: String,
10
+ }, subLabel: String, cardMode: Boolean, iconClass: String, clickable: Boolean, customStyle: String, errorMessage: String, arrowDirection: String, showWordLimit: Boolean, errorMessageAlign: String, readonly: {
8
11
  type: Boolean,
9
12
  observer: 'setShowClear',
10
13
  }, clearable: {
@@ -15,13 +18,13 @@ SmartComponent({
15
18
  value: 'focus',
16
19
  }, border: {
17
20
  type: Boolean,
18
- value: true,
21
+ value: false,
19
22
  }, titleWidth: {
20
23
  type: String,
21
24
  value: '6.2em',
22
25
  }, clearIcon: {
23
26
  type: String,
24
- value: 'clear',
27
+ value: Xmark,
25
28
  }, extraEventParams: {
26
29
  type: Boolean,
27
30
  value: false,
@@ -1,56 +1,4 @@
1
1
  <wxs src="../wxs/utils.wxs" module="utils" />
2
2
  <wxs src="./index.wxs" module="computed" />
3
-
4
- <smart-cell
5
- size="{{ size }}"
6
- icon="{{ leftIcon }}"
7
- center="{{ center }}"
8
- border="{{ border }}"
9
- is-link="{{ isLink }}"
10
- required="{{ required }}"
11
- clickable="{{ clickable }}"
12
- title-width="{{ titleWidth }}"
13
- title-style="margin-right: 12px;"
14
- custom-style="{{ customStyle }}"
15
- arrow-direction="{{ arrowDirection }}"
16
- custom-class="custom-class smart-field"
17
- >
18
- <slot name="left-icon" slot="icon" />
19
- <label for="{{ name }}" wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title">
20
- {{ label }}
21
- </label>
22
- <slot wx:else name="label" slot="title" />
23
- <view class="{{ utils.bem('field__body', [type]) }}">
24
- <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
25
- <slot name="input" />
26
- </view>
27
- <include wx:if="{{ type === 'textarea' }}" src="./textarea.wxml" />
28
- <include wx:else src="./input.wxml" />
29
-
30
- <smart-icon
31
- wx:if="{{ showClear }}"
32
- name="{{ clearIcon }}"
33
- class="smart-field__clear-root smart-field__icon-root"
34
- catch:touchstart="onClear"
35
- />
36
- <view class="smart-field__icon-container" bind:tap="onClickIcon">
37
- <smart-icon
38
- wx:if="{{ rightIcon || icon }}"
39
- name="{{ rightIcon || icon }}"
40
- class="smart-field__icon-root {{ iconClass }}"
41
- custom-class="right-icon-class"
42
- />
43
- <slot name="right-icon" />
44
- <slot name="icon" />
45
- </view>
46
- <view class="smart-field__button">
47
- <slot name="button" />
48
- </view>
49
- </view>
50
- <label for="{{ name }}" wx:if="{{ showWordLimit && maxlength }}" class="smart-field__word-limit">
51
- <view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }}
52
- </label>
53
- <label for="{{ name }}" wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
54
- {{ errorMessage }}
55
- </label>
56
- </smart-cell>
3
+ <include wx:if="{{ type === 'textarea' }}" src="./cell-textarea.wxml" />
4
+ <include wx:else src="./cell-input.wxml" />
@@ -1 +1 @@
1
- @import '../common/index.wxss';.smart-field{--cell-icon-size:var(--field-icon-size,16px)}.smart-field__label{color:var(--field-label-color,var(--app-B6-N1,#000))}.smart-field__label--disabled{color:var(--field-disabled-text-color,#c8c9cc)}.smart-field__body{align-items:center;display:flex}.smart-field__body--textarea{box-sizing:border-box;line-height:1.2em;min-height:var(--cell-line-height,24px);padding:3.6px 0}.smart-field__body--search{flex:1}.smart-field__control:empty+.smart-field__control{display:block}.smart-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,var(--app-B6-N1,#000));display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:left;width:100%}.smart-field__control:empty{display:none}.smart-field__control--textarea{height:var(--field-text-area-min-height,18px);min-height:var(--field-text-area-min-height,18px)}.smart-field__control--error{color:var(--field-input-error-text-color,#ee0a24)}.smart-field__control--disabled{background-color:initial;color:var(--field-input-disabled-text-color,#c8c9cc);opacity:1}.smart-field__control--center{text-align:center}.smart-field__control--right{text-align:right}.smart-field__control--custom{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__placeholder{color:var(--field-placeholder-text-color,#c8c9cc);left:0;pointer-events:none;position:absolute;right:0;top:0}.smart-field__placeholder--error{color:var(--field-error-message-color,#ee0a24)}.smart-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__clear-root,.smart-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.smart-field__button,.smart-field__clear-root,.smart-field__icon-container{flex-shrink:0}.smart-field__clear-root{--icon-color:var(--field-clear-icon-color,var(--app-B4-N4,rgba(0,0,0,.4)));font-size:var(--field-clear-icon-size,16px)}.smart-field__icon-container{color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.smart-field__icon-container:empty{display:none}.smart-field__button{padding-left:var(--padding-xs,8px)}.smart-field__button:empty{display:none}.smart-field__error-message{color:var(--field-error-message-color,#ee0a24);display:block;font-size:var(--field-error-message-text-font-size,12px);margin-left:4px;text-align:left;white-space:nowrap}.smart-field__error-message--center{text-align:center}.smart-field__error-message--right{text-align:right}.smart-field__word-limit{color:var(--field-word-limit-color,#646566);font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);text-align:right}.smart-field__word-num{display:inline}.smart-field__word-num--full{color:var(--field-word-num-full-color,#ee0a24)}
1
+ @import '../common/index.wxss';.smart-field{--cell-icon-size:var(--field-icon-size,16px)}.smart-field__left__body{align-items:center;display:flex;text-align:left;width:var(--field-left-width,50%)}.smart-field__left__body--card{width:var(--field-left-card-width,100%)}.smart-field__left__body--disabled{opacity:var(--field-disabled-opacity,.5)}.smart-field__label{color:var(--field-label-color,var(--app-B6-N1,#000));font-size:var(--field-label-font-size,16px);line-height:var(--field-label-line-height,18px);text-align:left}.smart-field__label--required{color:var(--field-input-error-text-color,var(--app-M2,#f04c4c))}.smart-field__left__icon{display:flex;margin-right:10px}.smart-field__left__icon:empty{display:none}.smart-field__label__card__subtitle{color:var(--field-subtitle-text-color,var(--app-B6-N3,rgba(0,0,0,.5)));font-size:var(--field-sub-label-font-size,14px);line-height:var(--field-sub-label-line-height,16px);margin-top:4px}.smart-field__label__card__subtitle--error{color:var(--field-error-message-color,var(--app-M2,#f04c4c))}.smart-field__body__box{width:var(--field-left-card-width,100%)}.smart-field__body__box--disabled{opacity:var(--field-disabled-opacity,.5)}.smart-field__body{align-items:center;display:flex;justify-content:flex-end}.smart-field__control:empty+.smart-field__control{display:block}.smart-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,var(--app-B6-N5,rgba(0,0,0,.3)));display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:right;width:100%}.smart-field__control:empty{display:none}.smart-field__control--textarea{background-color:var(--field-textarea-background,var(--app-B3,#fff));border-radius:var(--field-textarea-border-radius,8px);height:var(--field-text-area-min-height,130px);min-height:var(--field-text-area-min-height,130px);padding:var(--field-textarea-padding,12px 8px);text-align:left}.smart-field__control--card{background:var(--field-card-background,var(--app-B6-N7,rgba(0,0,0,.1)));border-radius:var(--field-card-border-radius,8px);height:var(--field-card-height,38px);padding:var(--field-card-padding,0 10px);text-align:center;width:var(--field-card-width,105px)}.smart-field__control--limit{padding-bottom:var(--field-textarea-limit-padding-bottom,22px)}.smart-field__control--center{text-align:center}.smart-field__control--right{text-align:right}.smart-field__control--left{text-align:left}.smart-field__control--custom,.smart-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__clear-root,.smart-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.smart-field__button,.smart-field__clear-root,.smart-field__icon-container{flex-shrink:0}.smart-field__clear-root{--icon-color:var(--field-clear-icon-color,var(--app-B6-N4,rgba(0,0,0,.4)));font-size:var(--field-clear-icon-size,16px)}.smart-field__icon-container{--icon-color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.smart-field__icon-container:empty{display:none}.smart-field__button{padding-left:var(--padding-xs,8px)}.smart-field__button:empty{display:none}.smart-field__error-message{color:var(--field-error-message-color,var(--app-M2,#f04c4c));display:block;font-size:var(--field-error-message-text-font-size,14px);font-weight:400;line-height:var(--field-error-message-text-line-height,18px);text-align:right;white-space:nowrap}.smart-field__error-message--center{text-align:center}.smart-field__error-message--right{text-align:right}.smart-field--textarea{padding:0 16px}.smart-field--textarea .smart-field__left__body{margin-bottom:8px;width:100%}.smart-field--textarea .smart-field__body__box{position:relative}.smart-field__word-limit{bottom:8px;color:var(--field-word-limit-color,var(--app-B6-N4,rgba(0,0,0,.4)));font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);position:absolute;right:8px;text-align:right}.smart-field__word-num{display:inline}.smart-field__word-num--full{color:var(--field-word-num-full-color,var(--app-M2,#f04c4c))}
@@ -1,7 +1,7 @@
1
1
  <wxs src="../wxs/utils.wxs" module="utils" />
2
2
  <input
3
3
  id="{{ name }}"
4
- class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class"
4
+ class="{{ utils.bem('field__control', [inputAlign, type, { card: cardMode }]) }} input-class"
5
5
  type="{{ type }}"
6
6
  focus="{{ focus }}"
7
7
  cursor="{{ cursor }}"
@@ -9,9 +9,8 @@
9
9
  auto-focus="{{ autoFocus }}"
10
10
  disabled="{{ disabled || readonly }}"
11
11
  maxlength="{{ maxlength }}"
12
- placeholder="{{ placeholder }}"
13
- placeholder-style="{{ placeholderStyle }}"
14
- placeholder-class="{{ utils.bem('field__placeholder', { error }) }}"
12
+ placeholder="{{ !interError ? placeholder : errorMessage || placeholder }}"
13
+ placeholder-style="{{ interError ? 'color: var(--field-input-error-text-color, var(--app-M2, #f04c4c));' : 'color: var(--field-placeholder-text-color, var(--app-B6-N4, rgba(0, 0, 0, 0.4));'}}{{ placeholderStyle }}"
15
14
  confirm-type="{{ confirmType }}"
16
15
  confirm-hold="{{ confirmHold }}"
17
16
  hold-keyboard="{{ holdKeyboard }}"
@@ -1,8 +1,9 @@
1
1
  <wxs src="../wxs/utils.wxs" module="utils" />
2
2
  <wxs src="./index.wxs" module="computed" />
3
+
3
4
  <textarea
4
5
  id="{{ name }}"
5
- class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class"
6
+ class="{{ utils.bem('field__control', [inputAlign, type, { textarea: true, limit: showWordLimit && maxlength }]) }} input-class"
6
7
  fixed="{{ fixed }}"
7
8
  focus="{{ focus }}"
8
9
  cursor="{{ cursor }}"
@@ -10,9 +11,8 @@
10
11
  auto-focus="{{ autoFocus }}"
11
12
  disabled="{{ disabled || readonly }}"
12
13
  maxlength="{{ maxlength }}"
13
- placeholder="{{ placeholder }}"
14
- placeholder-style="{{ placeholderStyle }}"
15
- placeholder-class="{{ utils.bem('field__placeholder', { error, disabled }) }}"
14
+ placeholder="{{ !interError ? placeholder : errorMessage || placeholder }}"
15
+ placeholder-style="{{ interError ? 'color: var(--field-input-error-text-color, var(--app-M2, #f04c4c));' : 'color: var(--field-placeholder-text-color, var(--app-B6-N4, rgba(0, 0, 0, 0.4));'}}{{ placeholderStyle }}"
16
16
  auto-height="{{ !!autosize }}"
17
17
  style="{{ computed.inputStyle(autosize) }}"
18
18
  cursor-spacing="{{ cursorSpacing }}"
@@ -148,12 +148,16 @@ SmartComponent({
148
148
  return;
149
149
  }
150
150
  groupSetData(this, () => {
151
+ const task = [];
151
152
  children.forEach((item, index) => {
152
153
  const active = index === currentIndex;
153
154
  if (active !== item.data.active || !item.inited) {
154
- item.updateRender(active, this);
155
+ active
156
+ ? task.push(() => item.updateRender(active, this))
157
+ : task.unshift(() => item.updateRender(active, this));
155
158
  }
156
159
  });
160
+ task.forEach(fun => fun());
157
161
  });
158
162
  if (currentIndex === data.currentIndex) {
159
163
  if (!data.inited) {
@@ -0,0 +1,60 @@
1
+ <wxs src="../wxs/utils.wxs" module="utils" />
2
+ <wxs src="./index.wxs" module="computed" />
3
+
4
+ <smart-cell
5
+ size="{{ size }}"
6
+ icon="{{ leftIcon }}"
7
+ center="{{ center }}"
8
+ border="{{ border }}"
9
+ is-link="{{ isLink }}"
10
+ clickable="{{ clickable }}"
11
+ title-width="{{ titleWidth }}"
12
+ title-style="margin-right: 12px;"
13
+ custom-style="{{ customStyle }}"
14
+ arrow-direction="{{ arrowDirection }}"
15
+ custom-class="custom-class smart-field"
16
+ >
17
+ <view class="{{ utils.bem('field__left__body', { disabled, card: cardMode }) }}">
18
+ <view class="smart-field__left__icon">
19
+ <slot name="left-icon" slot="icon" />
20
+ </view>
21
+ <view class="smart-field__label" >
22
+ <text wx:if="{{ required }}" class="smart-field__label--required">*</text>
23
+ <label for="{{ name }}" class="label-class" wx:if="{{ label }}" slot="title">
24
+ {{ label }}
25
+ </label>
26
+ <slot wx:else name="label" slot="title" />
27
+ <view wx:if="{{ subLabel && cardMode }}" class="{{ utils.bem('field__label__card__subtitle', { error: errorMessage }) }}">{{ errorMessage || subLabel }}</view>
28
+ </view>
29
+ </view>
30
+ <view class="{{ utils.bem('field__body__box', { disabled }) }}">
31
+ <view class="{{ utils.bem('field__body', [type]) }}">
32
+ <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
33
+ <slot name="input" />
34
+ </view>
35
+ <include src="./input.wxml" />
36
+ <smart-icon
37
+ wx:if="{{ showClear }}"
38
+ name="{{ clearIcon }}"
39
+ class="smart-field__clear-root smart-field__icon-root"
40
+ catch:touchstart="onClear"
41
+ />
42
+ <view class="smart-field__icon-container" bind:tap="onClickIcon">
43
+ <smart-icon
44
+ wx:if="{{ rightIcon || icon }}"
45
+ name="{{ rightIcon || icon }}"
46
+ class="smart-field__icon-root {{ iconClass }}"
47
+ custom-class="right-icon-class"
48
+ />
49
+ <slot name="right-icon" />
50
+ <slot name="icon" />
51
+ </view>
52
+ <view class="smart-field__button">
53
+ <slot name="button" />
54
+ </view>
55
+ </view>
56
+ <label wx:if="{{ errorMessage && !interError && !cardMode }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
57
+ {{ errorMessage }}
58
+ </label>
59
+ </view>
60
+ </smart-cell>
@@ -0,0 +1,28 @@
1
+ <wxs src="../wxs/utils.wxs" module="utils" />
2
+ <wxs src="./index.wxs" module="computed" />
3
+ <view class="smart-field smart-field--textarea">
4
+ <view class="{{ utils.bem('field__left__body', { disabled, card: cardMode }) }}">
5
+ <view class="smart-field__left__icon">
6
+ <slot name="left-icon" slot="icon" />
7
+ </view>
8
+ <view class="smart-field__label" >
9
+ <text wx:if="{{ required }}" class="smart-field__label--required">*</text>
10
+ <label for="{{ name }}" class="label-class" wx:if="{{ label }}" slot="title">
11
+ {{ label }}
12
+ </label>
13
+ <slot wx:else name="label" slot="title" />
14
+ <view wx:if="{{ subLabel && cardMode }}" class="{{ utils.bem('field__label__card__subtitle', { error: errorMessage }) }}">{{ errorMessage || subLabel }}</view>
15
+ </view>
16
+ </view>
17
+ <view class="{{ utils.bem('field__body__box', { disabled }) }}">
18
+ <view class="{{ utils.bem('field__body', [type]) }}">
19
+ <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
20
+ <slot name="input" />
21
+ </view>
22
+ <include src="./textarea.wxml" />
23
+ </view>
24
+ <label wx:if="{{ showWordLimit && maxlength }}" class="smart-field__word-limit">
25
+ <view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }}
26
+ </label>
27
+ </view>
28
+ </view>
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var component_1 = require("../../common/component");
4
+ var icons_1 = require("@tuya-miniapp/icons");
4
5
  (0, component_1.SmartComponent)({
5
6
  data: {
6
- sms: '',
7
7
  value: '',
8
8
  password: '',
9
- username: '',
10
- username2: '',
11
- username3: '',
9
+ num: 2000,
10
+ value2: '123',
12
11
  message: '',
13
- phone: '1365577',
12
+ sunIcon: icons_1.Sun
14
13
  },
15
14
  methods: {
16
15
  onClickIcon: function () {
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-field{--cell-icon-size:var(--field-icon-size,16px)}.smart-field__label{color:var(--field-label-color,var(--app-B6-N1,#000))}.smart-field__label--disabled{color:var(--field-disabled-text-color,#c8c9cc)}.smart-field__body{align-items:center;display:flex}.smart-field__body--textarea{box-sizing:border-box;line-height:1.2em;min-height:var(--cell-line-height,24px);padding:3.6px 0}.smart-field__body--search{flex:1}.smart-field__control:empty+.smart-field__control{display:block}.smart-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,var(--app-B6-N1,#000));display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:left;width:100%}.smart-field__control:empty{display:none}.smart-field__control--textarea{height:var(--field-text-area-min-height,18px);min-height:var(--field-text-area-min-height,18px)}.smart-field__control--error{color:var(--field-input-error-text-color,#ee0a24)}.smart-field__control--disabled{background-color:initial;color:var(--field-input-disabled-text-color,#c8c9cc);opacity:1}.smart-field__control--center{text-align:center}.smart-field__control--right{text-align:right}.smart-field__control--custom{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__placeholder{color:var(--field-placeholder-text-color,#c8c9cc);left:0;pointer-events:none;position:absolute;right:0;top:0}.smart-field__placeholder--error{color:var(--field-error-message-color,#ee0a24)}.smart-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__clear-root,.smart-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.smart-field__button,.smart-field__clear-root,.smart-field__icon-container{flex-shrink:0}.smart-field__clear-root{--icon-color:var(--field-clear-icon-color,var(--app-B4-N4,rgba(0,0,0,.4)));font-size:var(--field-clear-icon-size,16px)}.smart-field__icon-container{color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.smart-field__icon-container:empty{display:none}.smart-field__button{padding-left:var(--padding-xs,8px)}.smart-field__button:empty{display:none}.smart-field__error-message{color:var(--field-error-message-color,#ee0a24);display:block;font-size:var(--field-error-message-text-font-size,12px);margin-left:4px;text-align:left;white-space:nowrap}.smart-field__error-message--center{text-align:center}.smart-field__error-message--right{text-align:right}.smart-field__word-limit{color:var(--field-word-limit-color,#646566);font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);text-align:right}.smart-field__word-num{display:inline}.smart-field__word-num--full{color:var(--field-word-num-full-color,#ee0a24)}
1
+ @import '../common/index.css';.smart-field{--cell-icon-size:var(--field-icon-size,16px)}.smart-field__left__body{align-items:center;display:flex;text-align:left;width:var(--field-left-width,50%)}.smart-field__left__body--card{width:var(--field-left-card-width,100%)}.smart-field__left__body--disabled{opacity:var(--field-disabled-opacity,.5)}.smart-field__label{color:var(--field-label-color,var(--app-B6-N1,#000));font-size:var(--field-label-font-size,16px);line-height:var(--field-label-line-height,18px);text-align:left}.smart-field__label--required{color:var(--field-input-error-text-color,var(--app-M2,#f04c4c))}.smart-field__left__icon{display:flex;margin-right:10px}.smart-field__left__icon:empty{display:none}.smart-field__label__card__subtitle{color:var(--field-subtitle-text-color,var(--app-B6-N3,rgba(0,0,0,.5)));font-size:var(--field-sub-label-font-size,14px);line-height:var(--field-sub-label-line-height,16px);margin-top:4px}.smart-field__label__card__subtitle--error{color:var(--field-error-message-color,var(--app-M2,#f04c4c))}.smart-field__body__box{width:var(--field-left-card-width,100%)}.smart-field__body__box--disabled{opacity:var(--field-disabled-opacity,.5)}.smart-field__body{align-items:center;display:flex;justify-content:flex-end}.smart-field__control:empty+.smart-field__control{display:block}.smart-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,var(--app-B6-N5,rgba(0,0,0,.3)));display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:right;width:100%}.smart-field__control:empty{display:none}.smart-field__control--textarea{background-color:var(--field-textarea-background,var(--app-B3,#fff));border-radius:var(--field-textarea-border-radius,8px);height:var(--field-text-area-min-height,130px);min-height:var(--field-text-area-min-height,130px);padding:var(--field-textarea-padding,12px 8px);text-align:left}.smart-field__control--card{background:var(--field-card-background,var(--app-B6-N7,rgba(0,0,0,.1)));border-radius:var(--field-card-border-radius,8px);height:var(--field-card-height,38px);padding:var(--field-card-padding,0 10px);text-align:center;width:var(--field-card-width,105px)}.smart-field__control--limit{padding-bottom:var(--field-textarea-limit-padding-bottom,22px)}.smart-field__control--center{text-align:center}.smart-field__control--right{text-align:right}.smart-field__control--left{text-align:left}.smart-field__control--custom,.smart-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__clear-root,.smart-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.smart-field__button,.smart-field__clear-root,.smart-field__icon-container{flex-shrink:0}.smart-field__clear-root{--icon-color:var(--field-clear-icon-color,var(--app-B6-N4,rgba(0,0,0,.4)));font-size:var(--field-clear-icon-size,16px)}.smart-field__icon-container{--icon-color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.smart-field__icon-container:empty{display:none}.smart-field__button{padding-left:var(--padding-xs,8px)}.smart-field__button:empty{display:none}.smart-field__error-message{color:var(--field-error-message-color,var(--app-M2,#f04c4c));display:block;font-size:var(--field-error-message-text-font-size,14px);font-weight:400;line-height:var(--field-error-message-text-line-height,18px);text-align:right;white-space:nowrap}.smart-field__error-message--center{text-align:center}.smart-field__error-message--right{text-align:right}.smart-field--textarea{padding:0 16px}.smart-field--textarea .smart-field__left__body{margin-bottom:8px;width:100%}.smart-field--textarea .smart-field__body__box{position:relative}.smart-field__word-limit{bottom:8px;color:var(--field-word-limit-color,var(--app-B6-N4,rgba(0,0,0,.4)));font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);position:absolute;right:8px;text-align:right}.smart-field__word-num{display:inline}.smart-field__word-num--full{color:var(--field-word-num-full-color,var(--app-M2,#f04c4c))}
@@ -14,10 +14,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  var utils_1 = require("../common/utils");
15
15
  var component_1 = require("../common/component");
16
16
  var props_1 = require("./props");
17
+ var icons_1 = require("@tuya-miniapp/icons");
17
18
  (0, component_1.SmartComponent)({
18
19
  field: true,
19
20
  classes: ['input-class', 'right-icon-class', 'label-class'],
20
- 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: {
21
+ 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, interError: Boolean, inputAlign: {
22
+ type: String,
23
+ }, subLabel: String, cardMode: Boolean, iconClass: String, clickable: Boolean, customStyle: String, errorMessage: String, arrowDirection: String, showWordLimit: Boolean, errorMessageAlign: String, readonly: {
21
24
  type: Boolean,
22
25
  observer: 'setShowClear',
23
26
  }, clearable: {
@@ -28,13 +31,13 @@ var props_1 = require("./props");
28
31
  value: 'focus',
29
32
  }, border: {
30
33
  type: Boolean,
31
- value: true,
34
+ value: false,
32
35
  }, titleWidth: {
33
36
  type: String,
34
37
  value: '6.2em',
35
38
  }, clearIcon: {
36
39
  type: String,
37
- value: 'clear',
40
+ value: icons_1.Xmark,
38
41
  }, extraEventParams: {
39
42
  type: Boolean,
40
43
  value: false,
@@ -1,56 +1,4 @@
1
1
  <wxs src="../wxs/utils.wxs" module="utils" />
2
2
  <wxs src="./index.wxs" module="computed" />
3
-
4
- <smart-cell
5
- size="{{ size }}"
6
- icon="{{ leftIcon }}"
7
- center="{{ center }}"
8
- border="{{ border }}"
9
- is-link="{{ isLink }}"
10
- required="{{ required }}"
11
- clickable="{{ clickable }}"
12
- title-width="{{ titleWidth }}"
13
- title-style="margin-right: 12px;"
14
- custom-style="{{ customStyle }}"
15
- arrow-direction="{{ arrowDirection }}"
16
- custom-class="custom-class smart-field"
17
- >
18
- <slot name="left-icon" slot="icon" />
19
- <label for="{{ name }}" wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title">
20
- {{ label }}
21
- </label>
22
- <slot wx:else name="label" slot="title" />
23
- <view class="{{ utils.bem('field__body', [type]) }}">
24
- <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
25
- <slot name="input" />
26
- </view>
27
- <include wx:if="{{ type === 'textarea' }}" src="./textarea.wxml" />
28
- <include wx:else src="./input.wxml" />
29
-
30
- <smart-icon
31
- wx:if="{{ showClear }}"
32
- name="{{ clearIcon }}"
33
- class="smart-field__clear-root smart-field__icon-root"
34
- catch:touchstart="onClear"
35
- />
36
- <view class="smart-field__icon-container" bind:tap="onClickIcon">
37
- <smart-icon
38
- wx:if="{{ rightIcon || icon }}"
39
- name="{{ rightIcon || icon }}"
40
- class="smart-field__icon-root {{ iconClass }}"
41
- custom-class="right-icon-class"
42
- />
43
- <slot name="right-icon" />
44
- <slot name="icon" />
45
- </view>
46
- <view class="smart-field__button">
47
- <slot name="button" />
48
- </view>
49
- </view>
50
- <label for="{{ name }}" wx:if="{{ showWordLimit && maxlength }}" class="smart-field__word-limit">
51
- <view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }}
52
- </label>
53
- <label for="{{ name }}" wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
54
- {{ errorMessage }}
55
- </label>
56
- </smart-cell>
3
+ <include wx:if="{{ type === 'textarea' }}" src="./cell-textarea.wxml" />
4
+ <include wx:else src="./cell-input.wxml" />
@@ -1 +1 @@
1
- @import '../common/index.wxss';.smart-field{--cell-icon-size:var(--field-icon-size,16px)}.smart-field__label{color:var(--field-label-color,var(--app-B6-N1,#000))}.smart-field__label--disabled{color:var(--field-disabled-text-color,#c8c9cc)}.smart-field__body{align-items:center;display:flex}.smart-field__body--textarea{box-sizing:border-box;line-height:1.2em;min-height:var(--cell-line-height,24px);padding:3.6px 0}.smart-field__body--search{flex:1}.smart-field__control:empty+.smart-field__control{display:block}.smart-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,var(--app-B6-N1,#000));display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:left;width:100%}.smart-field__control:empty{display:none}.smart-field__control--textarea{height:var(--field-text-area-min-height,18px);min-height:var(--field-text-area-min-height,18px)}.smart-field__control--error{color:var(--field-input-error-text-color,#ee0a24)}.smart-field__control--disabled{background-color:initial;color:var(--field-input-disabled-text-color,#c8c9cc);opacity:1}.smart-field__control--center{text-align:center}.smart-field__control--right{text-align:right}.smart-field__control--custom{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__placeholder{color:var(--field-placeholder-text-color,#c8c9cc);left:0;pointer-events:none;position:absolute;right:0;top:0}.smart-field__placeholder--error{color:var(--field-error-message-color,#ee0a24)}.smart-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__clear-root,.smart-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.smart-field__button,.smart-field__clear-root,.smart-field__icon-container{flex-shrink:0}.smart-field__clear-root{--icon-color:var(--field-clear-icon-color,var(--app-B4-N4,rgba(0,0,0,.4)));font-size:var(--field-clear-icon-size,16px)}.smart-field__icon-container{color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.smart-field__icon-container:empty{display:none}.smart-field__button{padding-left:var(--padding-xs,8px)}.smart-field__button:empty{display:none}.smart-field__error-message{color:var(--field-error-message-color,#ee0a24);display:block;font-size:var(--field-error-message-text-font-size,12px);margin-left:4px;text-align:left;white-space:nowrap}.smart-field__error-message--center{text-align:center}.smart-field__error-message--right{text-align:right}.smart-field__word-limit{color:var(--field-word-limit-color,#646566);font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);text-align:right}.smart-field__word-num{display:inline}.smart-field__word-num--full{color:var(--field-word-num-full-color,#ee0a24)}
1
+ @import '../common/index.wxss';.smart-field{--cell-icon-size:var(--field-icon-size,16px)}.smart-field__left__body{align-items:center;display:flex;text-align:left;width:var(--field-left-width,50%)}.smart-field__left__body--card{width:var(--field-left-card-width,100%)}.smart-field__left__body--disabled{opacity:var(--field-disabled-opacity,.5)}.smart-field__label{color:var(--field-label-color,var(--app-B6-N1,#000));font-size:var(--field-label-font-size,16px);line-height:var(--field-label-line-height,18px);text-align:left}.smart-field__label--required{color:var(--field-input-error-text-color,var(--app-M2,#f04c4c))}.smart-field__left__icon{display:flex;margin-right:10px}.smart-field__left__icon:empty{display:none}.smart-field__label__card__subtitle{color:var(--field-subtitle-text-color,var(--app-B6-N3,rgba(0,0,0,.5)));font-size:var(--field-sub-label-font-size,14px);line-height:var(--field-sub-label-line-height,16px);margin-top:4px}.smart-field__label__card__subtitle--error{color:var(--field-error-message-color,var(--app-M2,#f04c4c))}.smart-field__body__box{width:var(--field-left-card-width,100%)}.smart-field__body__box--disabled{opacity:var(--field-disabled-opacity,.5)}.smart-field__body{align-items:center;display:flex;justify-content:flex-end}.smart-field__control:empty+.smart-field__control{display:block}.smart-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,var(--app-B6-N5,rgba(0,0,0,.3)));display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:right;width:100%}.smart-field__control:empty{display:none}.smart-field__control--textarea{background-color:var(--field-textarea-background,var(--app-B3,#fff));border-radius:var(--field-textarea-border-radius,8px);height:var(--field-text-area-min-height,130px);min-height:var(--field-text-area-min-height,130px);padding:var(--field-textarea-padding,12px 8px);text-align:left}.smart-field__control--card{background:var(--field-card-background,var(--app-B6-N7,rgba(0,0,0,.1)));border-radius:var(--field-card-border-radius,8px);height:var(--field-card-height,38px);padding:var(--field-card-padding,0 10px);text-align:center;width:var(--field-card-width,105px)}.smart-field__control--limit{padding-bottom:var(--field-textarea-limit-padding-bottom,22px)}.smart-field__control--center{text-align:center}.smart-field__control--right{text-align:right}.smart-field__control--left{text-align:left}.smart-field__control--custom,.smart-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.smart-field__clear-root,.smart-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.smart-field__button,.smart-field__clear-root,.smart-field__icon-container{flex-shrink:0}.smart-field__clear-root{--icon-color:var(--field-clear-icon-color,var(--app-B6-N4,rgba(0,0,0,.4)));font-size:var(--field-clear-icon-size,16px)}.smart-field__icon-container{--icon-color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.smart-field__icon-container:empty{display:none}.smart-field__button{padding-left:var(--padding-xs,8px)}.smart-field__button:empty{display:none}.smart-field__error-message{color:var(--field-error-message-color,var(--app-M2,#f04c4c));display:block;font-size:var(--field-error-message-text-font-size,14px);font-weight:400;line-height:var(--field-error-message-text-line-height,18px);text-align:right;white-space:nowrap}.smart-field__error-message--center{text-align:center}.smart-field__error-message--right{text-align:right}.smart-field--textarea{padding:0 16px}.smart-field--textarea .smart-field__left__body{margin-bottom:8px;width:100%}.smart-field--textarea .smart-field__body__box{position:relative}.smart-field__word-limit{bottom:8px;color:var(--field-word-limit-color,var(--app-B6-N4,rgba(0,0,0,.4)));font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);position:absolute;right:8px;text-align:right}.smart-field__word-num{display:inline}.smart-field__word-num--full{color:var(--field-word-num-full-color,var(--app-M2,#f04c4c))}
@@ -1,7 +1,7 @@
1
1
  <wxs src="../wxs/utils.wxs" module="utils" />
2
2
  <input
3
3
  id="{{ name }}"
4
- class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class"
4
+ class="{{ utils.bem('field__control', [inputAlign, type, { card: cardMode }]) }} input-class"
5
5
  type="{{ type }}"
6
6
  focus="{{ focus }}"
7
7
  cursor="{{ cursor }}"
@@ -9,9 +9,8 @@
9
9
  auto-focus="{{ autoFocus }}"
10
10
  disabled="{{ disabled || readonly }}"
11
11
  maxlength="{{ maxlength }}"
12
- placeholder="{{ placeholder }}"
13
- placeholder-style="{{ placeholderStyle }}"
14
- placeholder-class="{{ utils.bem('field__placeholder', { error }) }}"
12
+ placeholder="{{ !interError ? placeholder : errorMessage || placeholder }}"
13
+ placeholder-style="{{ interError ? 'color: var(--field-input-error-text-color, var(--app-M2, #f04c4c));' : 'color: var(--field-placeholder-text-color, var(--app-B6-N4, rgba(0, 0, 0, 0.4));'}}{{ placeholderStyle }}"
15
14
  confirm-type="{{ confirmType }}"
16
15
  confirm-hold="{{ confirmHold }}"
17
16
  hold-keyboard="{{ holdKeyboard }}"
@@ -1,8 +1,9 @@
1
1
  <wxs src="../wxs/utils.wxs" module="utils" />
2
2
  <wxs src="./index.wxs" module="computed" />
3
+
3
4
  <textarea
4
5
  id="{{ name }}"
5
- class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class"
6
+ class="{{ utils.bem('field__control', [inputAlign, type, { textarea: true, limit: showWordLimit && maxlength }]) }} input-class"
6
7
  fixed="{{ fixed }}"
7
8
  focus="{{ focus }}"
8
9
  cursor="{{ cursor }}"
@@ -10,9 +11,8 @@
10
11
  auto-focus="{{ autoFocus }}"
11
12
  disabled="{{ disabled || readonly }}"
12
13
  maxlength="{{ maxlength }}"
13
- placeholder="{{ placeholder }}"
14
- placeholder-style="{{ placeholderStyle }}"
15
- placeholder-class="{{ utils.bem('field__placeholder', { error, disabled }) }}"
14
+ placeholder="{{ !interError ? placeholder : errorMessage || placeholder }}"
15
+ placeholder-style="{{ interError ? 'color: var(--field-input-error-text-color, var(--app-M2, #f04c4c));' : 'color: var(--field-placeholder-text-color, var(--app-B6-N4, rgba(0, 0, 0, 0.4));'}}{{ placeholderStyle }}"
16
16
  auto-height="{{ !!autosize }}"
17
17
  style="{{ computed.inputStyle(autosize) }}"
18
18
  cursor-spacing="{{ cursorSpacing }}"
package/lib/tabs/index.js CHANGED
@@ -167,12 +167,16 @@ var relation_1 = require("../common/relation");
167
167
  return;
168
168
  }
169
169
  (0, utils_1.groupSetData)(this, function () {
170
+ var task = [];
170
171
  children.forEach(function (item, index) {
171
172
  var active = index === currentIndex;
172
173
  if (active !== item.data.active || !item.inited) {
173
- item.updateRender(active, _this);
174
+ active
175
+ ? task.push(function () { return item.updateRender(active, _this); })
176
+ : task.unshift(function () { return item.updateRender(active, _this); });
174
177
  }
175
178
  });
179
+ task.forEach(function (fun) { return fun(); });
176
180
  });
177
181
  if (currentIndex === data.currentIndex) {
178
182
  if (!data.inited) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.0.2-beta-6",
3
+ "version": "2.0.2-beta-8",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",