@tuya-miniapp/smart-ui 2.7.2 → 2.7.3-beta-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- @import '../common/index.css';:root{--smart-ui-overlay:rgba(0,0,0,.4);--smart-ui-bottom-sheet-dragger-node-background:rgba(0,0,0,.3);--smart-ui-dialog-background:#fff;--smart-ui-border-image:linear-gradient(90deg,transparent,rgba(0,0,0,.3),transparent)}:root[theme=dark]{--smart-ui-bottom-sheet-dragger-node-background:hsla(0,0%,100%,.3);--smart-ui-overlay:rgba(0,0,0,.7);--smart-ui-dialog-background:#333;--smart-ui-border-image:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3),hsla(0,0%,100%,0))}.smart-manrope{font-family:Manrope,sans-serif}.smart-nav-bar{background-color:var(--nav-bar-background-color,var(--app-B2,#fff));box-sizing:initial;height:var(--nav-bar-height,var(--app-device-navbar-height,46px));line-height:var(--nav-bar-height,var(--app-device-navbar-height,46px));position:relative;text-align:center;-webkit-user-select:none;user-select:none}.smart-nav-bar__content{align-items:center;display:flex;height:100%;position:relative}.smart-nav-bar__text{color:var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7)));display:inline-block;font-size:var(--nav-bar-text-font-size,16px);font-weight:var(--nav-bar-text-font-weight,600);overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.smart-nav-bar .smart-nav-bar__icon--hover,.smart-nav-bar .smart-nav-bar__text--hover{opacity:.3}.smart-nav-bar__arrow{vertical-align:middle}.smart-nav-bar__arrow>view{background:var(--nav-bar-arrow-color,var(--app-B2-N1,#000))}.smart-nav-bar__icon-wrap{align-items:center;display:flex;justify-content:center}.smart-nav-bar__icon>view{background:var(--nav-bar-icon-color,var(--app-B2-N1,#000))}.smart-nav-bar--safe{padding-top:var(--app-device-status-height,20px)}.smart-nav-bar--fixed{left:0;position:fixed;top:0;width:100%}.smart-nav-bar--round{border-radius:var(--nav-bar-round-border-radius,16px 16px 0 0);min-height:var(--nav-bar-round-min-height,56px)}.smart-nav-bar__title{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));flex:1;font-size:var(--nav-bar-title-font-size,17px);font-weight:var(--nav-bar-title-font-weight,600);margin:var(--nav-bar-title-margin,0 16px);text-align:center}.smart-nav-bar__left,.smart-nav-bar__right{align-items:center;display:flex;width:var(--nav-bar-side-width,98px)}.smart-nav-bar__left{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__left--home{max-width:var(--nav-bar-home-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--home .smart-nav-bar__text{color:var(--nav-bar-home-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-home-font-weight,600)}.smart-nav-bar__left--title{max-width:var(--nav-bar-title-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--title .smart-nav-bar__text{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-title-font-weight,600);padding-left:var(--nav-bar-left-title-padding,8px)}.smart-nav-bar__left--text{padding-left:var(--nav-bar-text-padding,16px)}.smart-nav-bar__left--icon{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right{flex-direction:row-reverse;padding-right:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right .smart-nav-bar__text{color:var(--nav-bar-right-text-color,var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7))));text-align:right}.smart-nav-bar__right--text{padding-right:var(--nav-bar-text-padding,16px)}
1
+ @import '../common/index.css';:root{--smart-ui-overlay:rgba(0,0,0,.4);--smart-ui-bottom-sheet-dragger-node-background:rgba(0,0,0,.3);--smart-ui-dialog-background:#fff;--smart-ui-border-image:linear-gradient(90deg,transparent,rgba(0,0,0,.3),transparent)}:root[theme=dark]{--smart-ui-bottom-sheet-dragger-node-background:hsla(0,0%,100%,.3);--smart-ui-overlay:rgba(0,0,0,.7);--smart-ui-dialog-background:#333;--smart-ui-border-image:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3),hsla(0,0%,100%,0))}.smart-manrope{font-family:Manrope,sans-serif}.smart-nav-bar{background-color:var(--nav-bar-background-color,var(--app-B2,#fff));box-sizing:initial;height:var(--nav-bar-height,var(--app-device-navbar-height,46px));line-height:var(--nav-bar-height,var(--app-device-navbar-height,46px));position:relative;text-align:center;-webkit-user-select:none;user-select:none}.smart-nav-bar__content{align-items:center;display:flex;height:100%;position:relative}.smart-nav-bar__text{color:var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7)));display:inline-block;font-size:var(--nav-bar-text-font-size,17px);font-weight:var(--nav-bar-text-font-weight,normal);overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.smart-nav-bar .smart-nav-bar__icon--hover,.smart-nav-bar .smart-nav-bar__text--hover{opacity:.3}.smart-nav-bar__arrow{vertical-align:middle}.smart-nav-bar__arrow>view{background:var(--nav-bar-arrow-color,var(--app-B2-N1,#000))}.smart-nav-bar__icon-wrap{align-items:center;display:flex;justify-content:center}.smart-nav-bar__icon>view{background:var(--nav-bar-icon-color,var(--app-B2-N1,#000))}.smart-nav-bar--safe{padding-top:var(--app-device-status-height,20px)}.smart-nav-bar--fixed{left:0;position:fixed;top:0;width:100%}.smart-nav-bar--round{border-radius:var(--nav-bar-round-border-radius,16px 16px 0 0);min-height:var(--nav-bar-round-min-height,56px)}.smart-nav-bar__title{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));flex:1;font-size:var(--nav-bar-title-font-size,17px);font-weight:var(--nav-bar-title-font-weight,600);margin:var(--nav-bar-title-margin,0 16px);text-align:center}.smart-nav-bar__left,.smart-nav-bar__right{align-items:center;display:flex;width:var(--nav-bar-side-width,80px)}.smart-nav-bar__left--min,.smart-nav-bar__right--min{width:var(--nav-bar-side-width-min,var(--nav-bar-side-width,40px))}.smart-nav-bar__left--max,.smart-nav-bar__right--max{width:var(--nav-bar-side-width-max,var(--nav-bar-side-width,105px))}.smart-nav-bar__left{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__left--home{max-width:var(--nav-bar-home-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--home .smart-nav-bar__text{color:var(--nav-bar-home-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-home-font-weight,600)}.smart-nav-bar__left--title{max-width:var(--nav-bar-title-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--title .smart-nav-bar__text{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-title-font-weight,600);padding-left:var(--nav-bar-left-title-padding,8px)}.smart-nav-bar__left--text{padding-left:var(--nav-bar-text-padding,16px)}.smart-nav-bar__left--icon{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right{flex-direction:row-reverse;padding-right:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right .smart-nav-bar__text{color:var(--nav-bar-right-text-color,var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7))));text-align:right}.smart-nav-bar__right--text{padding-right:var(--nav-bar-text-padding,16px)}
@@ -11,6 +11,10 @@ SmartComponent({
11
11
  ],
12
12
  props: {
13
13
  title: String,
14
+ sideWidth: {
15
+ type: null,
16
+ default: 'mid',
17
+ },
14
18
  fixed: {
15
19
  type: Boolean,
16
20
  observer: 'setHeight',
@@ -8,7 +8,7 @@
8
8
  style="{{ computed.barStyle({ zIndex, statusBarHeight, safeAreaInsetTop, background }) }}; {{ customStyle }}"
9
9
  >
10
10
  <view class="smart-nav-bar__content">
11
- <view class="{{ utils.bem('nav-bar__left', { home: leftTextType === 'home', title: leftTextType === 'title', text: !!leftText, icon: leftArrow || leftIcon }) }}" bind:tap="onClickLeft">
11
+ <view class="{{ computed.leftClass({ sideWidth, leftTextType, leftText, leftArrow, leftIcon }) }}" style="{{ computed.sideStyle({ sideWidth }) }}" bind:tap="onClickLeft">
12
12
  <smart-icon
13
13
  wx:if="{{ leftArrow }}"
14
14
  size="24px"
@@ -43,7 +43,7 @@
43
43
  <block>{{ title }}</block>
44
44
  <slot name="title" />
45
45
  </view>
46
- <view class="{{utils.bem('nav-bar__right', { text: !!rightText })}}" bind:tap="onClickRight">
46
+ <view class="{{ computed.rightClass({ sideWidth, rightText }) }}" style="{{ computed.sideStyle({ sideWidth }) }}" bind:tap="onClickRight">
47
47
  <view
48
48
  wx:if="{{ rightIcon }}"
49
49
  data-type="rightIcon"
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable */
2
2
  var style = require('../wxs/style.wxs');
3
+ var utils = require('../wxs/utils.wxs');
3
4
 
4
5
  function barStyle(data) {
5
6
  return style({
@@ -9,6 +10,51 @@ function barStyle(data) {
9
10
  });
10
11
  }
11
12
 
13
+ function leftClass(data) {
14
+ var classObj = {};
15
+ if (data.sideWidth === 'max') {
16
+ classObj.max = true;
17
+ } else if (data.sideWidth === 'min') {
18
+ classObj.min = true;
19
+ } else {
20
+ classObj.mid = true;
21
+ }
22
+ classObj.home = data.leftTextType === 'home';
23
+ classObj.title = data.leftTextType === 'title';
24
+ classObj.text = !!data.leftText;
25
+ classObj.icon = data.leftArrow || data.leftIcon;
26
+ return utils.bem('nav-bar__left', classObj);
27
+ }
28
+
29
+ function rightClass(data) {
30
+ var classObj = {};
31
+ if (data.sideWidth === 'max') {
32
+ classObj.max = true;
33
+ } else if (data.sideWidth === 'min') {
34
+ classObj.min = true;
35
+ } else {
36
+ classObj.mid = true;
37
+ }
38
+ classObj.text = !!data.rightText;
39
+ return utils.bem('nav-bar__right', classObj);
40
+ }
41
+
42
+ function sideStyle(data) {
43
+ var isDefaultWidth = ['min', 'max', 'mid'].includes(data.sideWidth);
44
+ var width = '';
45
+ if (!isDefaultWidth && data.sideWidth) {
46
+ if (typeof data.sideWidth === 'string' && data.sideWidth.includes('px')) {
47
+ width = data.sideWidth;
48
+ } else {
49
+ width = data.sideWidth + 'px';
50
+ }
51
+ }
52
+ return width ? 'width: ' + width + ';' : '';
53
+ }
54
+
12
55
  module.exports = {
13
56
  barStyle: barStyle,
57
+ leftClass: leftClass,
58
+ rightClass: rightClass,
59
+ sideStyle: sideStyle,
14
60
  };
@@ -1 +1 @@
1
- @import '../common/index.wxss';:root{--smart-ui-overlay:rgba(0,0,0,.4);--smart-ui-bottom-sheet-dragger-node-background:rgba(0,0,0,.3);--smart-ui-dialog-background:#fff;--smart-ui-border-image:linear-gradient(90deg,transparent,rgba(0,0,0,.3),transparent)}:root[theme=dark]{--smart-ui-bottom-sheet-dragger-node-background:hsla(0,0%,100%,.3);--smart-ui-overlay:rgba(0,0,0,.7);--smart-ui-dialog-background:#333;--smart-ui-border-image:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3),hsla(0,0%,100%,0))}.smart-manrope{font-family:Manrope,sans-serif}.smart-nav-bar{background-color:var(--nav-bar-background-color,var(--app-B2,#fff));box-sizing:initial;height:var(--nav-bar-height,var(--app-device-navbar-height,46px));line-height:var(--nav-bar-height,var(--app-device-navbar-height,46px));position:relative;text-align:center;-webkit-user-select:none;user-select:none}.smart-nav-bar__content{align-items:center;display:flex;height:100%;position:relative}.smart-nav-bar__text{color:var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7)));display:inline-block;font-size:var(--nav-bar-text-font-size,16px);font-weight:var(--nav-bar-text-font-weight,600);overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.smart-nav-bar .smart-nav-bar__icon--hover,.smart-nav-bar .smart-nav-bar__text--hover{opacity:.3}.smart-nav-bar__arrow{vertical-align:middle}.smart-nav-bar__arrow>view{background:var(--nav-bar-arrow-color,var(--app-B2-N1,#000))}.smart-nav-bar__icon-wrap{align-items:center;display:flex;justify-content:center}.smart-nav-bar__icon>view{background:var(--nav-bar-icon-color,var(--app-B2-N1,#000))}.smart-nav-bar--safe{padding-top:var(--app-device-status-height,20px)}.smart-nav-bar--fixed{left:0;position:fixed;top:0;width:100%}.smart-nav-bar--round{border-radius:var(--nav-bar-round-border-radius,16px 16px 0 0);min-height:var(--nav-bar-round-min-height,56px)}.smart-nav-bar__title{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));flex:1;font-size:var(--nav-bar-title-font-size,17px);font-weight:var(--nav-bar-title-font-weight,600);margin:var(--nav-bar-title-margin,0 16px);text-align:center}.smart-nav-bar__left,.smart-nav-bar__right{align-items:center;display:flex;width:var(--nav-bar-side-width,98px)}.smart-nav-bar__left{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__left--home{max-width:var(--nav-bar-home-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--home .smart-nav-bar__text{color:var(--nav-bar-home-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-home-font-weight,600)}.smart-nav-bar__left--title{max-width:var(--nav-bar-title-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--title .smart-nav-bar__text{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-title-font-weight,600);padding-left:var(--nav-bar-left-title-padding,8px)}.smart-nav-bar__left--text{padding-left:var(--nav-bar-text-padding,16px)}.smart-nav-bar__left--icon{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right{flex-direction:row-reverse;padding-right:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right .smart-nav-bar__text{color:var(--nav-bar-right-text-color,var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7))));text-align:right}.smart-nav-bar__right--text{padding-right:var(--nav-bar-text-padding,16px)}
1
+ @import '../common/index.wxss';:root{--smart-ui-overlay:rgba(0,0,0,.4);--smart-ui-bottom-sheet-dragger-node-background:rgba(0,0,0,.3);--smart-ui-dialog-background:#fff;--smart-ui-border-image:linear-gradient(90deg,transparent,rgba(0,0,0,.3),transparent)}:root[theme=dark]{--smart-ui-bottom-sheet-dragger-node-background:hsla(0,0%,100%,.3);--smart-ui-overlay:rgba(0,0,0,.7);--smart-ui-dialog-background:#333;--smart-ui-border-image:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3),hsla(0,0%,100%,0))}.smart-manrope{font-family:Manrope,sans-serif}.smart-nav-bar{background-color:var(--nav-bar-background-color,var(--app-B2,#fff));box-sizing:initial;height:var(--nav-bar-height,var(--app-device-navbar-height,46px));line-height:var(--nav-bar-height,var(--app-device-navbar-height,46px));position:relative;text-align:center;-webkit-user-select:none;user-select:none}.smart-nav-bar__content{align-items:center;display:flex;height:100%;position:relative}.smart-nav-bar__text{color:var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7)));display:inline-block;font-size:var(--nav-bar-text-font-size,17px);font-weight:var(--nav-bar-text-font-weight,normal);overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.smart-nav-bar .smart-nav-bar__icon--hover,.smart-nav-bar .smart-nav-bar__text--hover{opacity:.3}.smart-nav-bar__arrow{vertical-align:middle}.smart-nav-bar__arrow>view{background:var(--nav-bar-arrow-color,var(--app-B2-N1,#000))}.smart-nav-bar__icon-wrap{align-items:center;display:flex;justify-content:center}.smart-nav-bar__icon>view{background:var(--nav-bar-icon-color,var(--app-B2-N1,#000))}.smart-nav-bar--safe{padding-top:var(--app-device-status-height,20px)}.smart-nav-bar--fixed{left:0;position:fixed;top:0;width:100%}.smart-nav-bar--round{border-radius:var(--nav-bar-round-border-radius,16px 16px 0 0);min-height:var(--nav-bar-round-min-height,56px)}.smart-nav-bar__title{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));flex:1;font-size:var(--nav-bar-title-font-size,17px);font-weight:var(--nav-bar-title-font-weight,600);margin:var(--nav-bar-title-margin,0 16px);text-align:center}.smart-nav-bar__left,.smart-nav-bar__right{align-items:center;display:flex;width:var(--nav-bar-side-width,80px)}.smart-nav-bar__left--min,.smart-nav-bar__right--min{width:var(--nav-bar-side-width-min,var(--nav-bar-side-width,40px))}.smart-nav-bar__left--max,.smart-nav-bar__right--max{width:var(--nav-bar-side-width-max,var(--nav-bar-side-width,105px))}.smart-nav-bar__left{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__left--home{max-width:var(--nav-bar-home-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--home .smart-nav-bar__text{color:var(--nav-bar-home-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-home-font-weight,600)}.smart-nav-bar__left--title{max-width:var(--nav-bar-title-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--title .smart-nav-bar__text{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-title-font-weight,600);padding-left:var(--nav-bar-left-title-padding,8px)}.smart-nav-bar__left--text{padding-left:var(--nav-bar-text-padding,16px)}.smart-nav-bar__left--icon{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right{flex-direction:row-reverse;padding-right:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right .smart-nav-bar__text{color:var(--nav-bar-right-text-color,var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7))));text-align:right}.smart-nav-bar__right--text{padding-right:var(--nav-bar-text-padding,16px)}
@@ -69,6 +69,7 @@ SmartComponent({
69
69
  currentValue: '',
70
70
  Minus,
71
71
  Plus,
72
+ focus: false,
72
73
  isInit: false,
73
74
  },
74
75
  watch: {
@@ -88,10 +89,10 @@ SmartComponent({
88
89
  },
89
90
  methods: {
90
91
  observeValue() {
91
- const { value, isInit } = this.data;
92
- if (!isInit)
92
+ const { value, isInit, focus } = this.data;
93
+ if (!isInit || `${value}` === `${this.data.currentValue}` || focus)
93
94
  return;
94
- const currentValue = this.format(value, true);
95
+ const currentValue = this.format(value, !this.data.focus);
95
96
  if (currentValue !== value) {
96
97
  this.$emit('change', currentValue);
97
98
  }
@@ -112,6 +113,7 @@ SmartComponent({
112
113
  },
113
114
  onFocus(event) {
114
115
  this.$emit('focus', event.detail);
116
+ this.setData({ focus: true });
115
117
  },
116
118
  onBlur(event) {
117
119
  const value = this.format(event.detail.value, true);
@@ -120,7 +122,7 @@ SmartComponent({
120
122
  const strStepValue = isDef(this.data.decimalLength)
121
123
  ? stepValue.toFixed(this.data.decimalLength)
122
124
  : stepValue.toString();
123
- this.setData({ currentValue: strStepValue });
125
+ this.setData({ currentValue: strStepValue, focus: false });
124
126
  this.emitChange(strStepValue);
125
127
  this.$emit('blur', Object.assign(Object.assign({}, event.detail), { value: strStepValue }));
126
128
  },
@@ -21,7 +21,6 @@
21
21
  class="smart-manrope input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}"
22
22
  style="{{ computed.inputStyle({ buttonSize, inputWidth }) }}"
23
23
  value="{{ currentValue }}"
24
- focus="{{ focus }}"
25
24
  disabled="{{ disabled || disableInput }}"
26
25
  always-embed="{{ alwaysEmbed }}"
27
26
  bindinput="onInput"
@@ -1 +1 @@
1
- @import '../common/index.css';:root{--smart-ui-overlay:rgba(0,0,0,.4);--smart-ui-bottom-sheet-dragger-node-background:rgba(0,0,0,.3);--smart-ui-dialog-background:#fff;--smart-ui-border-image:linear-gradient(90deg,transparent,rgba(0,0,0,.3),transparent)}:root[theme=dark]{--smart-ui-bottom-sheet-dragger-node-background:hsla(0,0%,100%,.3);--smart-ui-overlay:rgba(0,0,0,.7);--smart-ui-dialog-background:#333;--smart-ui-border-image:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3),hsla(0,0%,100%,0))}.smart-manrope{font-family:Manrope,sans-serif}.smart-nav-bar{background-color:var(--nav-bar-background-color,var(--app-B2,#fff));box-sizing:initial;height:var(--nav-bar-height,var(--app-device-navbar-height,46px));line-height:var(--nav-bar-height,var(--app-device-navbar-height,46px));position:relative;text-align:center;-webkit-user-select:none;user-select:none}.smart-nav-bar__content{align-items:center;display:flex;height:100%;position:relative}.smart-nav-bar__text{color:var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7)));display:inline-block;font-size:var(--nav-bar-text-font-size,16px);font-weight:var(--nav-bar-text-font-weight,600);overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.smart-nav-bar .smart-nav-bar__icon--hover,.smart-nav-bar .smart-nav-bar__text--hover{opacity:.3}.smart-nav-bar__arrow{vertical-align:middle}.smart-nav-bar__arrow>view{background:var(--nav-bar-arrow-color,var(--app-B2-N1,#000))}.smart-nav-bar__icon-wrap{align-items:center;display:flex;justify-content:center}.smart-nav-bar__icon>view{background:var(--nav-bar-icon-color,var(--app-B2-N1,#000))}.smart-nav-bar--safe{padding-top:var(--app-device-status-height,20px)}.smart-nav-bar--fixed{left:0;position:fixed;top:0;width:100%}.smart-nav-bar--round{border-radius:var(--nav-bar-round-border-radius,16px 16px 0 0);min-height:var(--nav-bar-round-min-height,56px)}.smart-nav-bar__title{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));flex:1;font-size:var(--nav-bar-title-font-size,17px);font-weight:var(--nav-bar-title-font-weight,600);margin:var(--nav-bar-title-margin,0 16px);text-align:center}.smart-nav-bar__left,.smart-nav-bar__right{align-items:center;display:flex;width:var(--nav-bar-side-width,98px)}.smart-nav-bar__left{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__left--home{max-width:var(--nav-bar-home-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--home .smart-nav-bar__text{color:var(--nav-bar-home-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-home-font-weight,600)}.smart-nav-bar__left--title{max-width:var(--nav-bar-title-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--title .smart-nav-bar__text{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-title-font-weight,600);padding-left:var(--nav-bar-left-title-padding,8px)}.smart-nav-bar__left--text{padding-left:var(--nav-bar-text-padding,16px)}.smart-nav-bar__left--icon{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right{flex-direction:row-reverse;padding-right:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right .smart-nav-bar__text{color:var(--nav-bar-right-text-color,var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7))));text-align:right}.smart-nav-bar__right--text{padding-right:var(--nav-bar-text-padding,16px)}
1
+ @import '../common/index.css';:root{--smart-ui-overlay:rgba(0,0,0,.4);--smart-ui-bottom-sheet-dragger-node-background:rgba(0,0,0,.3);--smart-ui-dialog-background:#fff;--smart-ui-border-image:linear-gradient(90deg,transparent,rgba(0,0,0,.3),transparent)}:root[theme=dark]{--smart-ui-bottom-sheet-dragger-node-background:hsla(0,0%,100%,.3);--smart-ui-overlay:rgba(0,0,0,.7);--smart-ui-dialog-background:#333;--smart-ui-border-image:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3),hsla(0,0%,100%,0))}.smart-manrope{font-family:Manrope,sans-serif}.smart-nav-bar{background-color:var(--nav-bar-background-color,var(--app-B2,#fff));box-sizing:initial;height:var(--nav-bar-height,var(--app-device-navbar-height,46px));line-height:var(--nav-bar-height,var(--app-device-navbar-height,46px));position:relative;text-align:center;-webkit-user-select:none;user-select:none}.smart-nav-bar__content{align-items:center;display:flex;height:100%;position:relative}.smart-nav-bar__text{color:var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7)));display:inline-block;font-size:var(--nav-bar-text-font-size,17px);font-weight:var(--nav-bar-text-font-weight,normal);overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.smart-nav-bar .smart-nav-bar__icon--hover,.smart-nav-bar .smart-nav-bar__text--hover{opacity:.3}.smart-nav-bar__arrow{vertical-align:middle}.smart-nav-bar__arrow>view{background:var(--nav-bar-arrow-color,var(--app-B2-N1,#000))}.smart-nav-bar__icon-wrap{align-items:center;display:flex;justify-content:center}.smart-nav-bar__icon>view{background:var(--nav-bar-icon-color,var(--app-B2-N1,#000))}.smart-nav-bar--safe{padding-top:var(--app-device-status-height,20px)}.smart-nav-bar--fixed{left:0;position:fixed;top:0;width:100%}.smart-nav-bar--round{border-radius:var(--nav-bar-round-border-radius,16px 16px 0 0);min-height:var(--nav-bar-round-min-height,56px)}.smart-nav-bar__title{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));flex:1;font-size:var(--nav-bar-title-font-size,17px);font-weight:var(--nav-bar-title-font-weight,600);margin:var(--nav-bar-title-margin,0 16px);text-align:center}.smart-nav-bar__left,.smart-nav-bar__right{align-items:center;display:flex;width:var(--nav-bar-side-width,80px)}.smart-nav-bar__left--min,.smart-nav-bar__right--min{width:var(--nav-bar-side-width-min,var(--nav-bar-side-width,40px))}.smart-nav-bar__left--max,.smart-nav-bar__right--max{width:var(--nav-bar-side-width-max,var(--nav-bar-side-width,105px))}.smart-nav-bar__left{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__left--home{max-width:var(--nav-bar-home-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--home .smart-nav-bar__text{color:var(--nav-bar-home-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-home-font-weight,600)}.smart-nav-bar__left--title{max-width:var(--nav-bar-title-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--title .smart-nav-bar__text{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-title-font-weight,600);padding-left:var(--nav-bar-left-title-padding,8px)}.smart-nav-bar__left--text{padding-left:var(--nav-bar-text-padding,16px)}.smart-nav-bar__left--icon{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right{flex-direction:row-reverse;padding-right:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right .smart-nav-bar__text{color:var(--nav-bar-right-text-color,var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7))));text-align:right}.smart-nav-bar__right--text{padding-right:var(--nav-bar-text-padding,16px)}
@@ -16,6 +16,10 @@ var utils_1 = require("../common/utils");
16
16
  ],
17
17
  props: {
18
18
  title: String,
19
+ sideWidth: {
20
+ type: null,
21
+ default: 'mid',
22
+ },
19
23
  fixed: {
20
24
  type: Boolean,
21
25
  observer: 'setHeight',
@@ -8,7 +8,7 @@
8
8
  style="{{ computed.barStyle({ zIndex, statusBarHeight, safeAreaInsetTop, background }) }}; {{ customStyle }}"
9
9
  >
10
10
  <view class="smart-nav-bar__content">
11
- <view class="{{ utils.bem('nav-bar__left', { home: leftTextType === 'home', title: leftTextType === 'title', text: !!leftText, icon: leftArrow || leftIcon }) }}" bind:tap="onClickLeft">
11
+ <view class="{{ computed.leftClass({ sideWidth, leftTextType, leftText, leftArrow, leftIcon }) }}" style="{{ computed.sideStyle({ sideWidth }) }}" bind:tap="onClickLeft">
12
12
  <smart-icon
13
13
  wx:if="{{ leftArrow }}"
14
14
  size="24px"
@@ -43,7 +43,7 @@
43
43
  <block>{{ title }}</block>
44
44
  <slot name="title" />
45
45
  </view>
46
- <view class="{{utils.bem('nav-bar__right', { text: !!rightText })}}" bind:tap="onClickRight">
46
+ <view class="{{ computed.rightClass({ sideWidth, rightText }) }}" style="{{ computed.sideStyle({ sideWidth }) }}" bind:tap="onClickRight">
47
47
  <view
48
48
  wx:if="{{ rightIcon }}"
49
49
  data-type="rightIcon"
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable */
2
2
  var style = require('../wxs/style.wxs');
3
+ var utils = require('../wxs/utils.wxs');
3
4
 
4
5
  function barStyle(data) {
5
6
  return style({
@@ -9,6 +10,51 @@ function barStyle(data) {
9
10
  });
10
11
  }
11
12
 
13
+ function leftClass(data) {
14
+ var classObj = {};
15
+ if (data.sideWidth === 'max') {
16
+ classObj.max = true;
17
+ } else if (data.sideWidth === 'min') {
18
+ classObj.min = true;
19
+ } else {
20
+ classObj.mid = true;
21
+ }
22
+ classObj.home = data.leftTextType === 'home';
23
+ classObj.title = data.leftTextType === 'title';
24
+ classObj.text = !!data.leftText;
25
+ classObj.icon = data.leftArrow || data.leftIcon;
26
+ return utils.bem('nav-bar__left', classObj);
27
+ }
28
+
29
+ function rightClass(data) {
30
+ var classObj = {};
31
+ if (data.sideWidth === 'max') {
32
+ classObj.max = true;
33
+ } else if (data.sideWidth === 'min') {
34
+ classObj.min = true;
35
+ } else {
36
+ classObj.mid = true;
37
+ }
38
+ classObj.text = !!data.rightText;
39
+ return utils.bem('nav-bar__right', classObj);
40
+ }
41
+
42
+ function sideStyle(data) {
43
+ var isDefaultWidth = ['min', 'max', 'mid'].includes(data.sideWidth);
44
+ var width = '';
45
+ if (!isDefaultWidth && data.sideWidth) {
46
+ if (typeof data.sideWidth === 'string' && data.sideWidth.includes('px')) {
47
+ width = data.sideWidth;
48
+ } else {
49
+ width = data.sideWidth + 'px';
50
+ }
51
+ }
52
+ return width ? 'width: ' + width + ';' : '';
53
+ }
54
+
12
55
  module.exports = {
13
56
  barStyle: barStyle,
57
+ leftClass: leftClass,
58
+ rightClass: rightClass,
59
+ sideStyle: sideStyle,
14
60
  };
@@ -1 +1 @@
1
- @import '../common/index.wxss';:root{--smart-ui-overlay:rgba(0,0,0,.4);--smart-ui-bottom-sheet-dragger-node-background:rgba(0,0,0,.3);--smart-ui-dialog-background:#fff;--smart-ui-border-image:linear-gradient(90deg,transparent,rgba(0,0,0,.3),transparent)}:root[theme=dark]{--smart-ui-bottom-sheet-dragger-node-background:hsla(0,0%,100%,.3);--smart-ui-overlay:rgba(0,0,0,.7);--smart-ui-dialog-background:#333;--smart-ui-border-image:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3),hsla(0,0%,100%,0))}.smart-manrope{font-family:Manrope,sans-serif}.smart-nav-bar{background-color:var(--nav-bar-background-color,var(--app-B2,#fff));box-sizing:initial;height:var(--nav-bar-height,var(--app-device-navbar-height,46px));line-height:var(--nav-bar-height,var(--app-device-navbar-height,46px));position:relative;text-align:center;-webkit-user-select:none;user-select:none}.smart-nav-bar__content{align-items:center;display:flex;height:100%;position:relative}.smart-nav-bar__text{color:var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7)));display:inline-block;font-size:var(--nav-bar-text-font-size,16px);font-weight:var(--nav-bar-text-font-weight,600);overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.smart-nav-bar .smart-nav-bar__icon--hover,.smart-nav-bar .smart-nav-bar__text--hover{opacity:.3}.smart-nav-bar__arrow{vertical-align:middle}.smart-nav-bar__arrow>view{background:var(--nav-bar-arrow-color,var(--app-B2-N1,#000))}.smart-nav-bar__icon-wrap{align-items:center;display:flex;justify-content:center}.smart-nav-bar__icon>view{background:var(--nav-bar-icon-color,var(--app-B2-N1,#000))}.smart-nav-bar--safe{padding-top:var(--app-device-status-height,20px)}.smart-nav-bar--fixed{left:0;position:fixed;top:0;width:100%}.smart-nav-bar--round{border-radius:var(--nav-bar-round-border-radius,16px 16px 0 0);min-height:var(--nav-bar-round-min-height,56px)}.smart-nav-bar__title{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));flex:1;font-size:var(--nav-bar-title-font-size,17px);font-weight:var(--nav-bar-title-font-weight,600);margin:var(--nav-bar-title-margin,0 16px);text-align:center}.smart-nav-bar__left,.smart-nav-bar__right{align-items:center;display:flex;width:var(--nav-bar-side-width,98px)}.smart-nav-bar__left{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__left--home{max-width:var(--nav-bar-home-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--home .smart-nav-bar__text{color:var(--nav-bar-home-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-home-font-weight,600)}.smart-nav-bar__left--title{max-width:var(--nav-bar-title-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--title .smart-nav-bar__text{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-title-font-weight,600);padding-left:var(--nav-bar-left-title-padding,8px)}.smart-nav-bar__left--text{padding-left:var(--nav-bar-text-padding,16px)}.smart-nav-bar__left--icon{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right{flex-direction:row-reverse;padding-right:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right .smart-nav-bar__text{color:var(--nav-bar-right-text-color,var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7))));text-align:right}.smart-nav-bar__right--text{padding-right:var(--nav-bar-text-padding,16px)}
1
+ @import '../common/index.wxss';:root{--smart-ui-overlay:rgba(0,0,0,.4);--smart-ui-bottom-sheet-dragger-node-background:rgba(0,0,0,.3);--smart-ui-dialog-background:#fff;--smart-ui-border-image:linear-gradient(90deg,transparent,rgba(0,0,0,.3),transparent)}:root[theme=dark]{--smart-ui-bottom-sheet-dragger-node-background:hsla(0,0%,100%,.3);--smart-ui-overlay:rgba(0,0,0,.7);--smart-ui-dialog-background:#333;--smart-ui-border-image:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3),hsla(0,0%,100%,0))}.smart-manrope{font-family:Manrope,sans-serif}.smart-nav-bar{background-color:var(--nav-bar-background-color,var(--app-B2,#fff));box-sizing:initial;height:var(--nav-bar-height,var(--app-device-navbar-height,46px));line-height:var(--nav-bar-height,var(--app-device-navbar-height,46px));position:relative;text-align:center;-webkit-user-select:none;user-select:none}.smart-nav-bar__content{align-items:center;display:flex;height:100%;position:relative}.smart-nav-bar__text{color:var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7)));display:inline-block;font-size:var(--nav-bar-text-font-size,17px);font-weight:var(--nav-bar-text-font-weight,normal);overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.smart-nav-bar .smart-nav-bar__icon--hover,.smart-nav-bar .smart-nav-bar__text--hover{opacity:.3}.smart-nav-bar__arrow{vertical-align:middle}.smart-nav-bar__arrow>view{background:var(--nav-bar-arrow-color,var(--app-B2-N1,#000))}.smart-nav-bar__icon-wrap{align-items:center;display:flex;justify-content:center}.smart-nav-bar__icon>view{background:var(--nav-bar-icon-color,var(--app-B2-N1,#000))}.smart-nav-bar--safe{padding-top:var(--app-device-status-height,20px)}.smart-nav-bar--fixed{left:0;position:fixed;top:0;width:100%}.smart-nav-bar--round{border-radius:var(--nav-bar-round-border-radius,16px 16px 0 0);min-height:var(--nav-bar-round-min-height,56px)}.smart-nav-bar__title{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));flex:1;font-size:var(--nav-bar-title-font-size,17px);font-weight:var(--nav-bar-title-font-weight,600);margin:var(--nav-bar-title-margin,0 16px);text-align:center}.smart-nav-bar__left,.smart-nav-bar__right{align-items:center;display:flex;width:var(--nav-bar-side-width,80px)}.smart-nav-bar__left--min,.smart-nav-bar__right--min{width:var(--nav-bar-side-width-min,var(--nav-bar-side-width,40px))}.smart-nav-bar__left--max,.smart-nav-bar__right--max{width:var(--nav-bar-side-width-max,var(--nav-bar-side-width,105px))}.smart-nav-bar__left{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__left--home{max-width:var(--nav-bar-home-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--home .smart-nav-bar__text{color:var(--nav-bar-home-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-home-font-weight,600)}.smart-nav-bar__left--title{max-width:var(--nav-bar-title-max-width,calc(100% - 114px));width:auto}.smart-nav-bar__left--title .smart-nav-bar__text{color:var(--nav-bar-title-text-color,var(--app-B2-N1,#000));font-size:var(--nav-bar-home-font-size,22px);font-weight:var(--nav-bar-title-font-weight,600);padding-left:var(--nav-bar-left-title-padding,8px)}.smart-nav-bar__left--text{padding-left:var(--nav-bar-text-padding,16px)}.smart-nav-bar__left--icon{padding-left:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right{flex-direction:row-reverse;padding-right:var(--nav-bar-icon-padding,16px)}.smart-nav-bar__right .smart-nav-bar__text{color:var(--nav-bar-right-text-color,var(--nav-bar-text-color,var(--app-B2-N2,rgba(0,0,0,.7))));text-align:right}.smart-nav-bar__right--text{padding-right:var(--nav-bar-text-padding,16px)}
@@ -85,6 +85,7 @@ function equal(value1, value2) {
85
85
  currentValue: '',
86
86
  Minus: Minus_1.default,
87
87
  Plus: Plus_1.default,
88
+ focus: false,
88
89
  isInit: false,
89
90
  },
90
91
  watch: {
@@ -104,10 +105,10 @@ function equal(value1, value2) {
104
105
  },
105
106
  methods: {
106
107
  observeValue: function () {
107
- var _a = this.data, value = _a.value, isInit = _a.isInit;
108
- if (!isInit)
108
+ var _a = this.data, value = _a.value, isInit = _a.isInit, focus = _a.focus;
109
+ if (!isInit || "".concat(value) === "".concat(this.data.currentValue) || focus)
109
110
  return;
110
- var currentValue = this.format(value, true);
111
+ var currentValue = this.format(value, !this.data.focus);
111
112
  if (currentValue !== value) {
112
113
  this.$emit('change', currentValue);
113
114
  }
@@ -128,6 +129,7 @@ function equal(value1, value2) {
128
129
  },
129
130
  onFocus: function (event) {
130
131
  this.$emit('focus', event.detail);
132
+ this.setData({ focus: true });
131
133
  },
132
134
  onBlur: function (event) {
133
135
  var value = this.format(event.detail.value, true);
@@ -136,7 +138,7 @@ function equal(value1, value2) {
136
138
  var strStepValue = (0, validator_1.isDef)(this.data.decimalLength)
137
139
  ? stepValue.toFixed(this.data.decimalLength)
138
140
  : stepValue.toString();
139
- this.setData({ currentValue: strStepValue });
141
+ this.setData({ currentValue: strStepValue, focus: false });
140
142
  this.emitChange(strStepValue);
141
143
  this.$emit('blur', __assign(__assign({}, event.detail), { value: strStepValue }));
142
144
  },
@@ -21,7 +21,6 @@
21
21
  class="smart-manrope input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}"
22
22
  style="{{ computed.inputStyle({ buttonSize, inputWidth }) }}"
23
23
  value="{{ currentValue }}"
24
- focus="{{ focus }}"
25
24
  disabled="{{ disabled || disableInput }}"
26
25
  always-embed="{{ alwaysEmbed }}"
27
26
  bindinput="onInput"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.7.2",
3
+ "version": "2.7.3-beta-1",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",
@@ -87,7 +87,7 @@
87
87
  ],
88
88
  "dependencies": {
89
89
  "@ray-js/components-ty-slider": "^0.3.7",
90
- "@tuya-miniapp/icons": "^2.2.0"
90
+ "@tuya-miniapp/icons": "^2.3.0"
91
91
  },
92
92
  "maintainers": [
93
93
  {