@tuya-miniapp/smart-ui 1.3.1-beta-1 → 1.3.1-beta-3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/dist/calendar/calendar.wxml +13 -8
  2. package/dist/calendar/components/header/index.js +6 -2
  3. package/dist/calendar/components/header/index.wxml +1 -1
  4. package/dist/calendar/components/month/index.css +1 -1
  5. package/dist/calendar/components/month/index.wxss +1 -1
  6. package/dist/calendar/components/month-list/index.css +1 -1
  7. package/dist/calendar/components/month-list/index.js +24 -26
  8. package/dist/calendar/components/month-list/index.wxml +13 -9
  9. package/dist/calendar/components/month-list/index.wxss +1 -1
  10. package/dist/calendar/components/year-list/index.css +1 -1
  11. package/dist/calendar/components/year-list/index.js +15 -2
  12. package/dist/calendar/components/year-list/index.wxml +7 -1
  13. package/dist/calendar/components/year-list/index.wxss +1 -1
  14. package/dist/calendar/index.js +25 -27
  15. package/dist/calendar/index.wxs +1 -1
  16. package/dist/calendar/utils.d.ts +4 -0
  17. package/dist/calendar/utils.js +28 -0
  18. package/dist/notice-bar/index.css +1 -1
  19. package/dist/notice-bar/index.wxss +1 -1
  20. package/dist/search/index.css +1 -1
  21. package/dist/search/index.js +1 -5
  22. package/dist/search/index.wxml +1 -1
  23. package/dist/search/index.wxss +1 -1
  24. package/dist/tabs/index.css +1 -1
  25. package/dist/tabs/index.wxss +1 -1
  26. package/dist/toast/toast.js +2 -0
  27. package/dist/wxs/style.wxs +0 -7
  28. package/lib/calendar/calendar.wxml +13 -8
  29. package/lib/calendar/components/header/index.js +6 -2
  30. package/lib/calendar/components/header/index.wxml +1 -1
  31. package/lib/calendar/components/month/index.css +1 -1
  32. package/lib/calendar/components/month/index.wxss +1 -1
  33. package/lib/calendar/components/month-list/index.css +1 -1
  34. package/lib/calendar/components/month-list/index.js +24 -26
  35. package/lib/calendar/components/month-list/index.wxml +13 -9
  36. package/lib/calendar/components/month-list/index.wxss +1 -1
  37. package/lib/calendar/components/year-list/index.css +1 -1
  38. package/lib/calendar/components/year-list/index.js +15 -2
  39. package/lib/calendar/components/year-list/index.wxml +7 -1
  40. package/lib/calendar/components/year-list/index.wxss +1 -1
  41. package/lib/calendar/index.js +24 -26
  42. package/lib/calendar/index.wxs +1 -1
  43. package/lib/calendar/utils.d.ts +4 -0
  44. package/lib/calendar/utils.js +30 -1
  45. package/lib/notice-bar/index.css +1 -1
  46. package/lib/notice-bar/index.wxss +1 -1
  47. package/lib/search/index.css +1 -1
  48. package/lib/search/index.js +1 -5
  49. package/lib/search/index.wxml +1 -1
  50. package/lib/search/index.wxss +1 -1
  51. package/lib/tabs/index.css +1 -1
  52. package/lib/tabs/index.wxss +1 -1
  53. package/lib/toast/toast.js +2 -0
  54. package/lib/wxs/style.wxs +0 -7
  55. package/package.json +17 -4
@@ -13,6 +13,7 @@ const defaultOptions = {
13
13
  width: '100%',
14
14
  };
15
15
  let queue = [];
16
+ // @ts-expect-error
16
17
  let currentOptions = Object.assign({}, defaultOptions);
17
18
  function parseOptions(message) {
18
19
  return isObj(message) ? message : { message };
@@ -65,6 +66,7 @@ Toast.setDefaultOptions = (options) => {
65
66
  Object.assign(currentOptions, options);
66
67
  };
67
68
  Toast.resetDefaultOptions = () => {
69
+ // @ts-expect-error
68
70
  currentOptions = Object.assign({}, defaultOptions);
69
71
  };
70
72
  export default Toast;
@@ -1,10 +1,3 @@
1
- /*
2
- * @Author: mjh
3
- * @Date: 2024-08-02 11:38:15
4
- * @LastEditors: mjh
5
- * @LastEditTime: 2024-10-31 15:52:59
6
- * @Description:
7
- */
8
1
  /* eslint-disable */
9
2
  var object = require('./object.wxs');
10
3
  var array = require('./array.wxs');
@@ -4,7 +4,7 @@
4
4
  <header
5
5
  title="{{ title }}"
6
6
  showTitle="{{ showTitle }}"
7
- subtitle="{{ mode === 'year' ? '' : mode === 'month' ? computed.formatYearTitle(currentDate, visibleIndex, locale.yearFormatter) : computed.formatMonthTitle(months[visibleIndex], subFormatter) }}"
7
+ subtitle="{{ type === 'year' ? '' : type === 'month' ? computed.formatYearTitle(currentDate, visibleIndex, locale.yearFormatter) : computed.formatMonthTitle(months[visibleIndex], subFormatter) }}"
8
8
  subFormatter="{{locale.subFormatter || 'YYYY-MM'}}"
9
9
  showSubtitle="{{ showSubtitle }}"
10
10
  firstDayOfWeek="{{ firstDayOfWeek }}"
@@ -13,12 +13,14 @@
13
13
  bind:click-prev="onPrev"
14
14
  bind:click-next="onNext"
15
15
  bind:click-save="onConfirm"
16
- hideWeek="{{ mode !== 'day' }}"
16
+ hideWeek="{{ type === 'year' || type === 'month' }}"
17
+ right-text="{{confirmText}}"
18
+ showConfirm="{{showConfirm}}"
17
19
  >
18
20
  <slot name="title" slot="title"></slot>
19
21
  </header>
20
22
 
21
- <block wx:if="{{mode === 'day'}}">
23
+ <block wx:if="{{ type !== 'year' && type !== 'month' }}">
22
24
  <view class="smart-calendar-month_wrap" wx:for="{{ months }}" wx:key="index">
23
25
  <month
24
26
  id="month{{ index }}"
@@ -47,25 +49,28 @@
47
49
  </view>
48
50
  </block>
49
51
 
50
- <block wx:if="{{mode === 'month'}}">
52
+ <block wx:if="{{type === 'month'}}">
51
53
  <month-list
52
54
  minDate="{{ minDate }}"
53
55
  maxDate="{{ maxDate }}"
54
56
  monthsFormatter="{{ locale.monthsFormatter }}"
55
57
  bind:click="onClickDate"
56
- date="{{defaultDate}}"
57
- visibleIndex="{{visibleIndex}}"
58
+ date="{{currentDate}}"
59
+ color="{{color}}"
60
+ readonly="{{readonly}}"
58
61
  />
59
62
  </block>
60
63
 
61
- <block wx:if="{{mode === 'year'}}">
64
+ <block wx:if="{{type === 'year'}}">
62
65
  <year-list
63
66
  minDate="{{ minDate }}"
64
67
  maxDate="{{ maxDate }}"
65
68
  yearFormatter="{{ locale.yearFormatter }}"
66
69
  bind:click="onClickDate"
67
- date="{{defaultDate}}"
70
+ date="{{currentDate}}"
68
71
  visibleIndex="{{visibleIndex}}"
72
+ color="{{color}}"
73
+ readonly="{{readonly}}"
69
74
  />
70
75
  </block>
71
76
 
@@ -19,17 +19,21 @@ var Right_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Right"));
19
19
  props: {
20
20
  title: {
21
21
  type: String,
22
- value: '日期选择',
22
+ value: 'Select Date',
23
23
  },
24
24
  rightText: {
25
25
  type: String,
26
- value: '保存',
26
+ value: 'Save',
27
27
  },
28
28
  subtitle: String,
29
29
  showTitle: Boolean,
30
30
  showSubtitle: Boolean,
31
31
  defaultWeeks: Array,
32
32
  hideWeek: Boolean,
33
+ showConfirm: {
34
+ type: Boolean,
35
+ value: true,
36
+ },
33
37
  firstDayOfWeek: {
34
38
  type: Number,
35
39
  observer: 'initWeekDay',
@@ -3,7 +3,7 @@
3
3
  <view class="smart-calendar__header-title"><slot name="title"></slot></view>
4
4
  <view class="smart-calendar__header-title">
5
5
  {{ title }}
6
- <view class="smart-calendar__header-title-save" bind:tap=="onSave">{{ rightText }}</view>
6
+ <view class="smart-calendar__header-title-save" bind:tap=="onSave" wx:if="{{showConfirm}}">{{ rightText }}</view>
7
7
  </view>
8
8
  </block>
9
9
 
@@ -1 +1 @@
1
- @import '../../../common/index.css';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));display:flex;flex-direction:column;height:100%}.smart-calendar__month-title{font-size:var(--calendar-month-title-font-size,14px);font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.smart-calendar__days{display:flex;flex-wrap:wrap;position:relative;-webkit-user-select:none;user-select:none}.smart-calendar__month-mark{color:var(--calendar-month-mark-color,hsla(210,6%,87%,.6));font-size:var(--calendar-month-mark-font-size,160px);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:0}.smart-calendar__day,.smart-calendar__selected-day{align-items:center;display:flex;justify-content:center;text-align:center}.smart-calendar__day{font-size:var(--calendar-day-font-size,15px);font-weight:500;height:var(--calendar-day-height,100rpx);position:relative;width:14.285%}.smart-calendar__day--end,.smart-calendar__day--multiple-middle,.smart-calendar__day--multiple-selected,.smart-calendar__day--start,.smart-calendar__day--start-end{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-edge-color,#fff)}.smart-calendar__day--start{border-bottom-left-radius:34rpx;border-top-left-radius:34rpx}.smart-calendar__day--end{border-bottom-right-radius:34rpx;border-top-right-radius:34rpx}.smart-calendar__day--multiple-selected,.smart-calendar__day--start-end{border-radius:4px}.smart-calendar__day--middle{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-middle-color,var(--app-B3,#fff))}.smart-calendar__day--disabled{color:var(--calendar-day-disabled-color,#c8c9cc);cursor:default}.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:var(--calendar-info-font-size,10px);left:0;line-height:var(--calendar-info-line-height,14px);position:absolute;right:0}@media (max-width:350px){.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:9px}}.smart-calendar__top-info{top:6px}.smart-calendar__bottom-info{bottom:6px}.smart-calendar__selected-day{background-color:var(--calendar-selected-day-background-color,#3678e3);border-radius:50%;color:var(--calendar-selected-day-color,#fff);height:var(--calendar-selected-day-size,34px);width:var(--calendar-selected-day-size,34px)}
1
+ @import '../../../common/index.css';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));display:flex;flex-direction:column;height:100%}.smart-calendar__month-title{font-size:var(--calendar-month-title-font-size,14px);font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.smart-calendar__days{display:flex;flex-wrap:wrap;position:relative;-webkit-user-select:none;user-select:none}.smart-calendar__month-mark{color:var(--calendar-month-mark-color,hsla(210,6%,87%,.6));font-size:var(--calendar-month-mark-font-size,160px);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:0}.smart-calendar__day,.smart-calendar__selected-day{align-items:center;display:flex;justify-content:center;text-align:center}.smart-calendar__day{font-size:var(--calendar-day-font-size,15px);font-weight:var(--calendar-day-font-weight,500);height:var(--calendar-day-height,100rpx);position:relative;width:14.285%}.smart-calendar__day--end,.smart-calendar__day--multiple-middle,.smart-calendar__day--multiple-selected,.smart-calendar__day--start,.smart-calendar__day--start-end{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-edge-color,#fff)}.smart-calendar__day--start{border-bottom-left-radius:var(--calendar-day-select-border-radius,34rpx);border-top-left-radius:var(--calendar-day-select-border-radius,34rpx)}.smart-calendar__day--end{border-bottom-right-radius:var(--calendar-day-select-border-radius,34rpx);border-top-right-radius:var(--calendar-day-select-border-radius,34rpx)}.smart-calendar__day--multiple-selected,.smart-calendar__day--start-end{border-radius:4px}.smart-calendar__day--middle{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-middle-color,var(--app-B3,#fff))}.smart-calendar__day--disabled{color:var(--calendar-day-disabled-color,#c8c9cc);cursor:default}.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:var(--calendar-info-font-size,10px);left:0;line-height:var(--calendar-info-line-height,14px);position:absolute;right:0}@media (max-width:350px){.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:9px}}.smart-calendar__top-info{top:6px}.smart-calendar__bottom-info{bottom:6px}.smart-calendar__selected-day{background-color:var(--calendar-selected-day-background-color,#3678e3);border-radius:50%;color:var(--calendar-selected-day-color,#fff);height:var(--calendar-selected-day-size,34px);width:var(--calendar-selected-day-size,34px)}
@@ -1 +1 @@
1
- @import '../../../common/index.wxss';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));display:flex;flex-direction:column;height:100%}.smart-calendar__month-title{font-size:var(--calendar-month-title-font-size,14px);font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.smart-calendar__days{display:flex;flex-wrap:wrap;position:relative;-webkit-user-select:none;user-select:none}.smart-calendar__month-mark{color:var(--calendar-month-mark-color,hsla(210,6%,87%,.6));font-size:var(--calendar-month-mark-font-size,160px);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:0}.smart-calendar__day,.smart-calendar__selected-day{align-items:center;display:flex;justify-content:center;text-align:center}.smart-calendar__day{font-size:var(--calendar-day-font-size,15px);font-weight:500;height:var(--calendar-day-height,100rpx);position:relative;width:14.285%}.smart-calendar__day--end,.smart-calendar__day--multiple-middle,.smart-calendar__day--multiple-selected,.smart-calendar__day--start,.smart-calendar__day--start-end{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-edge-color,#fff)}.smart-calendar__day--start{border-bottom-left-radius:34rpx;border-top-left-radius:34rpx}.smart-calendar__day--end{border-bottom-right-radius:34rpx;border-top-right-radius:34rpx}.smart-calendar__day--multiple-selected,.smart-calendar__day--start-end{border-radius:4px}.smart-calendar__day--middle{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-middle-color,var(--app-B3,#fff))}.smart-calendar__day--disabled{color:var(--calendar-day-disabled-color,#c8c9cc);cursor:default}.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:var(--calendar-info-font-size,10px);left:0;line-height:var(--calendar-info-line-height,14px);position:absolute;right:0}@media (max-width:350px){.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:9px}}.smart-calendar__top-info{top:6px}.smart-calendar__bottom-info{bottom:6px}.smart-calendar__selected-day{background-color:var(--calendar-selected-day-background-color,#3678e3);border-radius:50%;color:var(--calendar-selected-day-color,#fff);height:var(--calendar-selected-day-size,34px);width:var(--calendar-selected-day-size,34px)}
1
+ @import '../../../common/index.wxss';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));display:flex;flex-direction:column;height:100%}.smart-calendar__month-title{font-size:var(--calendar-month-title-font-size,14px);font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.smart-calendar__days{display:flex;flex-wrap:wrap;position:relative;-webkit-user-select:none;user-select:none}.smart-calendar__month-mark{color:var(--calendar-month-mark-color,hsla(210,6%,87%,.6));font-size:var(--calendar-month-mark-font-size,160px);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:0}.smart-calendar__day,.smart-calendar__selected-day{align-items:center;display:flex;justify-content:center;text-align:center}.smart-calendar__day{font-size:var(--calendar-day-font-size,15px);font-weight:var(--calendar-day-font-weight,500);height:var(--calendar-day-height,100rpx);position:relative;width:14.285%}.smart-calendar__day--end,.smart-calendar__day--multiple-middle,.smart-calendar__day--multiple-selected,.smart-calendar__day--start,.smart-calendar__day--start-end{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-edge-color,#fff)}.smart-calendar__day--start{border-bottom-left-radius:var(--calendar-day-select-border-radius,34rpx);border-top-left-radius:var(--calendar-day-select-border-radius,34rpx)}.smart-calendar__day--end{border-bottom-right-radius:var(--calendar-day-select-border-radius,34rpx);border-top-right-radius:var(--calendar-day-select-border-radius,34rpx)}.smart-calendar__day--multiple-selected,.smart-calendar__day--start-end{border-radius:4px}.smart-calendar__day--middle{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-middle-color,var(--app-B3,#fff))}.smart-calendar__day--disabled{color:var(--calendar-day-disabled-color,#c8c9cc);cursor:default}.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:var(--calendar-info-font-size,10px);left:0;line-height:var(--calendar-info-line-height,14px);position:absolute;right:0}@media (max-width:350px){.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:9px}}.smart-calendar__top-info{top:6px}.smart-calendar__bottom-info{bottom:6px}.smart-calendar__selected-day{background-color:var(--calendar-selected-day-background-color,#3678e3);border-radius:50%;color:var(--calendar-selected-day-color,#fff);height:var(--calendar-selected-day-size,34px);width:var(--calendar-selected-day-size,34px)}
@@ -1 +1 @@
1
- @import '../../../common/index.css';.item{border-radius:50%;color:rgba(0,0,0,.9);font-size:15px;font-weight:500;line-height:104rpx;text-align:center}.item,.item_active{height:104rpx;width:104rpx}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}
1
+ @import '../../../common/index.css';.item{border-radius:50%;color:rgba(0,0,0,.9);font-size:15px;font-weight:500;height:104rpx;line-height:104rpx;text-align:center;width:104rpx}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  // components/month-list.js
4
4
  var utils_1 = require("../../utils");
5
5
  var component_1 = require("../../../common/component");
6
+ var currentYear = new Date().getFullYear();
7
+ var minMonthDate = new Date(currentYear - 10, 1, 1).getTime();
8
+ var maxMonthDate = new Date(currentYear + 10, 12, 31).getTime();
6
9
  (0, component_1.SmartComponent)({
7
10
  /**
8
11
  * 组件的属性列表
@@ -12,30 +15,25 @@ var component_1 = require("../../../common/component");
12
15
  type: null,
13
16
  observer: function (newVal, oldVal) {
14
17
  if (newVal !== oldVal) {
15
- this.calcMonth();
18
+ this.getMonthList();
16
19
  }
17
20
  },
18
21
  },
22
+ color: {
23
+ type: String,
24
+ value: '#3678e3'
25
+ },
19
26
  minDate: {
20
27
  type: null,
21
- value: new Date(new Date().getFullYear(), 0, 1).getTime(),
28
+ value: minMonthDate,
22
29
  },
23
30
  maxDate: {
24
31
  type: null,
25
- value: new Date(new Date().getFullYear(), 11, 31).getTime(),
32
+ value: maxMonthDate,
26
33
  },
27
- currentYear: {
28
- type: null,
29
- value: new Date().getFullYear(),
30
- },
31
- visibleIndex: {
32
- type: Number,
33
- value: 0,
34
- observer: function (newVal, oldVal) {
35
- if (newVal !== oldVal) {
36
- this.getMonthList();
37
- }
38
- },
34
+ readonly: {
35
+ type: Boolean,
36
+ value: false
39
37
  },
40
38
  monthsFormatter: {
41
39
  type: null,
@@ -64,22 +62,16 @@ var component_1 = require("../../../common/component");
64
62
  },
65
63
  created: function () {
66
64
  this.getMonthList();
67
- this.calcMonth();
68
65
  },
69
66
  /**
70
67
  * 组件的方法列表
71
68
  */
72
69
  methods: {
73
- calcMonth: function () {
74
- var date = new Date(this.data.date);
75
- var cur = date.getMonth();
76
- this.setData({
77
- currentMonth: cur,
78
- });
79
- },
80
70
  getMonthList: function () {
81
- var _a = this.data, minDate = _a.minDate, maxDate = _a.maxDate, visibleIndex = _a.visibleIndex, _b = _a.monthsFormatter, monthsFormatter = _b === void 0 ? [] : _b;
82
- var cur = new Date().getFullYear() + visibleIndex;
71
+ var _a = this.data, minDate = _a.minDate, maxDate = _a.maxDate, _b = _a.monthsFormatter, monthsFormatter = _b === void 0 ? [] : _b;
72
+ var curDate = new Date(this.data.date);
73
+ var cur = curDate.getFullYear();
74
+ var curMonthDate = new Date(curDate.getFullYear(), curDate.getMonth(), 1);
83
75
  var start = new Date(cur, 0, 1).getTime();
84
76
  var end = new Date(cur, 11, 31).getTime();
85
77
  var minDateTime = new Date(minDate).getTime();
@@ -88,7 +80,10 @@ var component_1 = require("../../../common/component");
88
80
  var monthlist = months.map(function (date) {
89
81
  var monthVal = new Date(date).getMonth();
90
82
  var time = new Date(date).getTime();
91
- var isDisabled = time < minDateTime || time > maxDateTime;
83
+ var isDisabled = false;
84
+ if (minDate && maxDate) {
85
+ isDisabled = time < minDateTime || time > maxDateTime;
86
+ }
92
87
  return {
93
88
  value: date,
94
89
  month: monthVal,
@@ -98,9 +93,12 @@ var component_1 = require("../../../common/component");
98
93
  });
99
94
  this.setData({
100
95
  months: monthlist,
96
+ currentMonth: curMonthDate.getTime(),
101
97
  });
102
98
  },
103
99
  onClick: function (event) {
100
+ if (this.data.readonly)
101
+ return;
104
102
  var index = event.currentTarget.dataset.index;
105
103
  var item = this.data.months[index];
106
104
  if (item.type !== 'disabled') {
@@ -1,9 +1,13 @@
1
- <view class="contain">
2
- <smart-row>
3
- <smart-col wx:for="{{months}}" span="6">
4
- <view class="item {{ currentMonth === item.month ? 'item_active' : '' }} {{ item.type === 'disabled' ? 'item_disabled' : '' }}" data-index="{{index}}" bindtap="onClick">
5
- {{item.text}}
6
- </view>
7
- </smart-col>
8
- </smart-row>
9
- </view>
1
+ <smart-row>
2
+ <smart-col wx:for="{{months}}" span="6">
3
+ <view wx:if="{{item.type === 'disabled'}}" class="item item_disabled" data-index="{{index}}">
4
+ {{item.text}}
5
+ </view>
6
+ <view wx:elif="{{currentMonth === item.value}}" class="item item_active" data-index="{{index}}" bindtap="onClick" style="background: {{ color }};">
7
+ {{item.text}}
8
+ </view>
9
+ <view wx:else class="item" data-index="{{index}}" bindtap="onClick">
10
+ {{item.text}}
11
+ </view>
12
+ </smart-col>
13
+ </smart-row>
@@ -1 +1 @@
1
- @import '../../../common/index.wxss';.item{border-radius:50%;color:rgba(0,0,0,.9);font-size:15px;font-weight:500;line-height:104rpx;text-align:center}.item,.item_active{height:104rpx;width:104rpx}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}
1
+ @import '../../../common/index.wxss';.item{border-radius:50%;color:rgba(0,0,0,.9);font-size:15px;font-weight:500;height:104rpx;line-height:104rpx;text-align:center;width:104rpx}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}
@@ -1 +1 @@
1
- @import '../../../common/index.css';.contain{margin:24rpx 0}.item{border-radius:50%;color:rgba(0,0,0,.9);font-size:15px;font-weight:500;line-height:104rpx;text-align:center}.item,.item_active{height:104rpx;width:104rpx}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}
1
+ @import '../../../common/index.css';.contain{margin:24rpx 0}.item{border-radius:50%;color:rgba(0,0,0,.9);font-size:15px;font-weight:500;height:104rpx;line-height:104rpx;text-align:center;width:104rpx}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}
@@ -16,6 +16,10 @@ var component_1 = require("../../../common/component");
16
16
  }
17
17
  },
18
18
  },
19
+ readonly: {
20
+ type: Boolean,
21
+ value: false
22
+ },
19
23
  minDate: {
20
24
  type: null,
21
25
  value: new Date(new Date().getFullYear() - 30, 0, 1).getTime(),
@@ -24,6 +28,10 @@ var component_1 = require("../../../common/component");
24
28
  type: null,
25
29
  value: new Date(new Date().getFullYear() + 30, 11, 31).getTime(),
26
30
  },
31
+ color: {
32
+ type: String,
33
+ value: '#3678e3',
34
+ },
27
35
  currentYear: {
28
36
  type: null,
29
37
  value: new Date().getFullYear(),
@@ -76,12 +84,15 @@ var component_1 = require("../../../common/component");
76
84
  var yearlist = years.map(function (date) {
77
85
  var yearVal = new Date(date).getFullYear();
78
86
  var curTime = new Date(date).getTime();
79
- var disabled = curTime <= minStart || curTime >= maxStart;
87
+ var isDisabled = false;
88
+ if (minDate && maxDate) {
89
+ isDisabled = curTime <= minStart || curTime >= maxStart;
90
+ }
80
91
  return {
81
92
  value: date,
82
93
  year: yearVal,
83
94
  text: yearFormatter.replace('YYYY', yearVal),
84
- type: disabled ? 'disabled' : '',
95
+ type: isDisabled ? 'disabled' : '',
85
96
  };
86
97
  });
87
98
  this.setData({
@@ -89,6 +100,8 @@ var component_1 = require("../../../common/component");
89
100
  });
90
101
  },
91
102
  onClick: function (event) {
103
+ if (this.data.readonly)
104
+ return;
92
105
  var index = event.currentTarget.dataset.index;
93
106
  var item = this.data.years[index];
94
107
  if (item.type !== 'disabled') {
@@ -1,7 +1,13 @@
1
1
  <view class="contain">
2
2
  <smart-row>
3
3
  <smart-col wx:for="{{years}}" span="6">
4
- <view class="item {{ currentYear === item.year ? 'item_active' : '' }} {{ item.type === 'disabled' ? 'item_disabled' : '' }}" data-index="{{index}}" bindtap="onClick">
4
+ <view wx:if="{{item.type === 'disabled'}}" class="item item_disabled" data-index="{{index}}">
5
+ {{item.text}}
6
+ </view>
7
+ <view wx:elif="{{currentYear === item.year}}" class="item item_active" data-index="{{index}}" bindtap="onClick" style="background: {{ color }};">
8
+ {{item.text}}
9
+ </view>
10
+ <view wx:else class="item" data-index="{{index}}" bindtap="onClick">
5
11
  {{item.text}}
6
12
  </view>
7
13
  </smart-col>
@@ -1 +1 @@
1
- @import '../../../common/index.wxss';.contain{margin:24rpx 0}.item{border-radius:50%;color:rgba(0,0,0,.9);font-size:15px;font-weight:500;line-height:104rpx;text-align:center}.item,.item_active{height:104rpx;width:104rpx}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}
1
+ @import '../../../common/index.wxss';.contain{margin:24rpx 0}.item{border-radius:50%;color:rgba(0,0,0,.9);font-size:15px;font-weight:500;height:104rpx;line-height:104rpx;text-align:center;width:104rpx}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}
@@ -15,11 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  var component_1 = require("../common/component");
16
16
  var utils_1 = require("./utils");
17
17
  var toast_1 = __importDefault(require("../toast/toast"));
18
- var initialMinDate = (0, utils_1.getToday)().getTime();
19
- var initialMaxDate = (function () {
20
- var now = (0, utils_1.getToday)();
21
- return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate()).getTime();
22
- })();
18
+ var dateEdge = (0, utils_1.getInitEdgeDate)('year');
23
19
  var getTime = function (date) {
24
20
  return date instanceof Date ? date.getTime() : date;
25
21
  };
@@ -27,7 +23,7 @@ var getTime = function (date) {
27
23
  props: {
28
24
  title: {
29
25
  type: String,
30
- value: '日期选择',
26
+ value: 'Select Date',
31
27
  },
32
28
  color: String,
33
29
  show: {
@@ -63,18 +59,13 @@ var getTime = function (date) {
63
59
  rangeEnd: 'End',
64
60
  },
65
61
  },
66
- formatter: null,
67
62
  confirmText: {
68
63
  type: String,
69
- value: '确定',
64
+ value: 'Confirm',
70
65
  },
71
66
  confirmDisabledText: {
72
67
  type: String,
73
- value: '确定',
74
- },
75
- mode: {
76
- type: String,
77
- value: 'day',
68
+ value: 'Confirm',
78
69
  },
79
70
  rangePrompt: String,
80
71
  showRangePrompt: {
@@ -97,11 +88,11 @@ var getTime = function (date) {
97
88
  },
98
89
  minDate: {
99
90
  type: Number,
100
- value: initialMinDate,
91
+ value: dateEdge.min
101
92
  },
102
93
  maxDate: {
103
94
  type: Number,
104
- value: initialMaxDate,
95
+ value: dateEdge.max
105
96
  },
106
97
  position: {
107
98
  type: String,
@@ -117,7 +108,7 @@ var getTime = function (date) {
117
108
  },
118
109
  poppable: {
119
110
  type: Boolean,
120
- value: true,
111
+ value: false,
121
112
  },
122
113
  showMark: {
123
114
  type: Boolean,
@@ -189,15 +180,19 @@ var getTime = function (date) {
189
180
  methods: {
190
181
  onPrev: function () {
191
182
  var visibleIndex = this.data.visibleIndex - 1;
192
- if (this.data.mode === 'year') {
183
+ if (this.data.type === 'year') {
193
184
  this.setData({
194
185
  visibleIndex: visibleIndex,
195
186
  });
196
187
  return;
197
188
  }
198
- if (this.data.mode === 'month') {
189
+ if (this.data.type === 'month') {
190
+ var nextDate = new Date(this.data.currentDate);
191
+ nextDate.setFullYear(nextDate.getFullYear() - 1);
192
+ this.select(nextDate, true);
199
193
  this.setData({
200
194
  visibleIndex: visibleIndex,
195
+ currentDate: nextDate,
201
196
  });
202
197
  return;
203
198
  }
@@ -209,15 +204,19 @@ var getTime = function (date) {
209
204
  },
210
205
  onNext: function () {
211
206
  var visibleIndex = this.data.visibleIndex + 1;
212
- if (this.data.mode === 'year') {
207
+ if (this.data.type === 'year') {
213
208
  this.setData({
214
209
  visibleIndex: visibleIndex,
215
210
  });
216
211
  return;
217
212
  }
218
- if (this.data.mode === 'month') {
213
+ if (this.data.type === 'month') {
214
+ var nextDate = new Date(this.data.currentDate);
215
+ nextDate.setFullYear(nextDate.getFullYear() + 1);
216
+ this.select(nextDate, true);
219
217
  this.setData({
220
218
  visibleIndex: visibleIndex,
219
+ currentDate: nextDate,
221
220
  });
222
221
  return;
223
222
  }
@@ -231,16 +230,14 @@ var getTime = function (date) {
231
230
  this.setData({ currentDate: this.getInitialDate(this.data.defaultDate) });
232
231
  this.scrollIntoView();
233
232
  },
234
- initYearIdx: function (currentDate) {
235
- },
236
233
  initData: function () {
237
234
  var currentDate = this.getInitialDate(this.data.defaultDate);
238
235
  var months = (0, utils_1.getMonths)(this.data.minDate, this.data.maxDate);
239
236
  var visibleIndex = this.data.defaultDate
240
237
  ? (0, utils_1.getCurrentIndex)(currentDate, months)
241
238
  : months.length - 1;
242
- var isYear = this.data.mode === 'year';
243
- var isMonth = this.data.mode === 'month';
239
+ var isYear = this.data.type === 'year';
240
+ var isMonth = this.data.type === 'month';
244
241
  var data = {
245
242
  currentDate: currentDate,
246
243
  months: months,
@@ -260,8 +257,9 @@ var getTime = function (date) {
260
257
  limitDateRange: function (date, minDate, maxDate) {
261
258
  if (minDate === void 0) { minDate = null; }
262
259
  if (maxDate === void 0) { maxDate = null; }
263
- minDate = minDate || this.data.minDate;
264
- maxDate = maxDate || this.data.maxDate;
260
+ var _a = (0, utils_1.getInitEdgeDate)(this.data.type), min = _a.min, max = _a.max;
261
+ minDate = minDate || this.data.minDate || min;
262
+ maxDate = maxDate || this.data.maxDate || max;
265
263
  if ((0, utils_1.compareDay)(date, minDate) === -1) {
266
264
  return minDate;
267
265
  }
@@ -47,7 +47,7 @@ function formatMonthTitle(date, formatter = 'YYYY-MM') {
47
47
 
48
48
  function formatYearTitle(date, offset, formatter = 'YYYY') {
49
49
  date = getDate(date);
50
- const year = date.getFullYear() + offset;
50
+ const year = date.getFullYear();
51
51
  return formatter.replace('YYYY', year + '');
52
52
  }
53
53
 
@@ -16,3 +16,7 @@ export declare function getWeekStartAndEnd(date: Date): {
16
16
  weekStart: Date;
17
17
  weekEnd: Date;
18
18
  };
19
+ export declare const getInitEdgeDate: (type: string) => {
20
+ min: number;
21
+ max: number;
22
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getWeekStartAndEnd = exports.getCurrentIndex = exports.getYears = exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getToday = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0;
3
+ exports.getInitEdgeDate = exports.getWeekStartAndEnd = exports.getCurrentIndex = exports.getYears = exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getToday = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0;
4
4
  exports.ROW_HEIGHT = 34;
5
5
  function formatMonthTitle(date, formatter) {
6
6
  if (formatter === void 0) { formatter = 'YYYY-MM'; }
@@ -147,3 +147,32 @@ function getWeekStartAndEnd(date) {
147
147
  };
148
148
  }
149
149
  exports.getWeekStartAndEnd = getWeekStartAndEnd;
150
+ var getInitEdgeDate = function (type) {
151
+ var currentYear = new Date().getFullYear();
152
+ if (type === 'month') {
153
+ var minMonthDate = new Date(currentYear - 1, 1, 1).getTime();
154
+ var maxMonthDate = new Date(currentYear + 1, 12, 31).getTime();
155
+ return {
156
+ min: minMonthDate,
157
+ max: maxMonthDate,
158
+ };
159
+ }
160
+ if (type === 'year') {
161
+ var minMonthDate = new Date(currentYear - 10, 1, 1).getTime();
162
+ var maxMonthDate = new Date(currentYear + 10, 12, 31).getTime();
163
+ return {
164
+ min: minMonthDate,
165
+ max: maxMonthDate,
166
+ };
167
+ }
168
+ var initialMinDate = getToday().getTime();
169
+ var initialMaxDate = (function () {
170
+ var now = getToday();
171
+ return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate()).getTime();
172
+ })();
173
+ return {
174
+ min: initialMinDate,
175
+ max: initialMaxDate,
176
+ };
177
+ };
178
+ exports.getInitEdgeDate = getInitEdgeDate;
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-notice-bar{--notice-bar-info-color:#1989fa;--notice-bar-warning-color:#ffa000;--notice-bar-error-color:#f04c4c;--notice-bar-right-icon-color:rgba(0,0,0,.2);align-items:center;background-color:var(--notice-bar-background-color,rgba(25,137,250,.1));color:var(--notice-bar-text-color,var(--app-B6-N3,rgba(0,0,0,.5)));display:flex;font-size:var(--notice-bar-font-size,12px);height:var(--notice-bar-height,40px);line-height:var(--notice-bar-line-height,14px);padding:var(--notice-bar-padding,0 16px)}.smart-notice-bar--warning{background-color:var(--notice-bar-background-warning-color,rgba(255,160,0,.1))}.smart-notice-bar--error{background-color:var(--notice-bar-background-error-color,rgba(240,76,76,.1))}.smart-notice-bar--hover{opacity:.6}.smart-notice-bar--wrapable{height:auto;padding:var(--notice-bar-wrapable-padding,8px 16px)}.smart-notice-bar--wrapable .smart-notice-bar__wrap{height:auto}.smart-notice-bar--wrapable .smart-notice-bar__content{position:relative;white-space:normal}.smart-notice-bar__left-icon{align-items:center;display:flex;font-size:var(--notice-bar-icon-size,16px);margin-right:var(--notice-bar-left-icon-margin-right,8px);vertical-align:middle}.smart-notice-bar__right-icon{font-size:var(--notice-bar-icon-size,16px);margin-left:var(--notice-bar-right-icon-margin-left,8px)}.smart-notice-bar__wrap{flex:1;height:var(--notice-bar-line-height,14px);overflow:hidden;position:relative}.smart-notice-bar__content{position:absolute;white-space:nowrap}.smart-notice-bar__content.smart-ellipsis{max-width:100%}.smart-notice-bar__content__btn{color:#1989fa;display:inline-block}
1
+ @import '../common/index.css';.smart-notice-bar{--notice-bar-info-color:#1989fa;--notice-bar-warning-color:#ffa000;--notice-bar-error-color:#f04c4c;--notice-bar-right-icon-color:rgba(0,0,0,.2);align-items:center;background-color:var(--notice-bar-background-color,rgba(25,137,250,.1));color:var(--notice-bar-text-color,var(--app-B6-N3,rgba(0,0,0,.5)));display:flex;font-size:var(--notice-bar-font-size,12px);height:var(--notice-bar-height,40px);line-height:var(--notice-bar-line-height,14px);padding:var(--notice-bar-padding,0 16px)}.smart-notice-bar--warning{background-color:var(--notice-bar-background-warning-color,rgba(255,160,0,.1))}.smart-notice-bar--error{background-color:var(--notice-bar-background-error-color,rgba(240,76,76,.1))}.smart-notice-bar--hover{opacity:.6}.smart-notice-bar--wrapable{height:auto;padding:var(--notice-bar-wrapable-padding,8px 16px)}.smart-notice-bar--wrapable .smart-notice-bar__wrap{height:auto}.smart-notice-bar--wrapable .smart-notice-bar__content{position:relative;white-space:normal}.smart-notice-bar__left-icon{align-items:center;display:flex;font-size:var(--notice-bar-icon-size,16px);margin-right:var(--notice-bar-left-icon-margin-right,8px);vertical-align:middle}.smart-notice-bar__right-icon{font-size:var(--notice-bar-icon-size,16px);margin-left:var(--notice-bar-right-icon-margin-left,8px)}.smart-notice-bar__wrap{flex:1;height:var(--notice-bar-line-height,14px);overflow:hidden;position:relative}.smart-notice-bar__content{position:absolute;white-space:nowrap}.smart-notice-bar__content.smart-ellipsis{max-width:100%}.smart-notice-bar__content__btn{color:var(--notice-bar-btn-color,var(--app-M4,#1989fa));display:inline-block}
@@ -1 +1 @@
1
- @import '../common/index.wxss';.smart-notice-bar{--notice-bar-info-color:#1989fa;--notice-bar-warning-color:#ffa000;--notice-bar-error-color:#f04c4c;--notice-bar-right-icon-color:rgba(0,0,0,.2);align-items:center;background-color:var(--notice-bar-background-color,rgba(25,137,250,.1));color:var(--notice-bar-text-color,var(--app-B6-N3,rgba(0,0,0,.5)));display:flex;font-size:var(--notice-bar-font-size,12px);height:var(--notice-bar-height,40px);line-height:var(--notice-bar-line-height,14px);padding:var(--notice-bar-padding,0 16px)}.smart-notice-bar--warning{background-color:var(--notice-bar-background-warning-color,rgba(255,160,0,.1))}.smart-notice-bar--error{background-color:var(--notice-bar-background-error-color,rgba(240,76,76,.1))}.smart-notice-bar--hover{opacity:.6}.smart-notice-bar--wrapable{height:auto;padding:var(--notice-bar-wrapable-padding,8px 16px)}.smart-notice-bar--wrapable .smart-notice-bar__wrap{height:auto}.smart-notice-bar--wrapable .smart-notice-bar__content{position:relative;white-space:normal}.smart-notice-bar__left-icon{align-items:center;display:flex;font-size:var(--notice-bar-icon-size,16px);margin-right:var(--notice-bar-left-icon-margin-right,8px);vertical-align:middle}.smart-notice-bar__right-icon{font-size:var(--notice-bar-icon-size,16px);margin-left:var(--notice-bar-right-icon-margin-left,8px)}.smart-notice-bar__wrap{flex:1;height:var(--notice-bar-line-height,14px);overflow:hidden;position:relative}.smart-notice-bar__content{position:absolute;white-space:nowrap}.smart-notice-bar__content.smart-ellipsis{max-width:100%}.smart-notice-bar__content__btn{color:#1989fa;display:inline-block}
1
+ @import '../common/index.wxss';.smart-notice-bar{--notice-bar-info-color:#1989fa;--notice-bar-warning-color:#ffa000;--notice-bar-error-color:#f04c4c;--notice-bar-right-icon-color:rgba(0,0,0,.2);align-items:center;background-color:var(--notice-bar-background-color,rgba(25,137,250,.1));color:var(--notice-bar-text-color,var(--app-B6-N3,rgba(0,0,0,.5)));display:flex;font-size:var(--notice-bar-font-size,12px);height:var(--notice-bar-height,40px);line-height:var(--notice-bar-line-height,14px);padding:var(--notice-bar-padding,0 16px)}.smart-notice-bar--warning{background-color:var(--notice-bar-background-warning-color,rgba(255,160,0,.1))}.smart-notice-bar--error{background-color:var(--notice-bar-background-error-color,rgba(240,76,76,.1))}.smart-notice-bar--hover{opacity:.6}.smart-notice-bar--wrapable{height:auto;padding:var(--notice-bar-wrapable-padding,8px 16px)}.smart-notice-bar--wrapable .smart-notice-bar__wrap{height:auto}.smart-notice-bar--wrapable .smart-notice-bar__content{position:relative;white-space:normal}.smart-notice-bar__left-icon{align-items:center;display:flex;font-size:var(--notice-bar-icon-size,16px);margin-right:var(--notice-bar-left-icon-margin-right,8px);vertical-align:middle}.smart-notice-bar__right-icon{font-size:var(--notice-bar-icon-size,16px);margin-left:var(--notice-bar-right-icon-margin-left,8px)}.smart-notice-bar__wrap{flex:1;height:var(--notice-bar-line-height,14px);overflow:hidden;position:relative}.smart-notice-bar__content{position:absolute;white-space:nowrap}.smart-notice-bar__content.smart-ellipsis{max-width:100%}.smart-notice-bar__content__btn{color:var(--notice-bar-btn-color,var(--app-M4,#1989fa));display:inline-block}
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-search{align-items:center;background-color:var(--search-background-color,var(--app-B3,#fff));box-sizing:border-box;display:flex;padding:var(--search-padding,12px 16px)}.smart-search__content{align-items:center;background-color:var(--search-body-background-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:flex;flex:1;flex-direction:row;padding:12px 16px}.smart-search__content--round{border-radius:999px}.smart-search__label{color:var(--search-label-color,var(--app-B4-N1,#000));font-size:var(--search-label-font-size,14px);line-height:var(--search-input-height,24px);padding:var(--search-label-padding,0 5px)}.smart-search__field{flex:1}.smart-search__field__left-icon{--icon-color:var(--search-left-icon-color,var(--app-B4-N4,rgba(0,0,0,.4)));margin-left:2px}.smart-search__input{font-size:var(--search-value-font-size,14px)}.smart-search--withaction{padding-right:0}.smart-search__action{color:var(--search-action-text-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--search-action-font-size,14px);line-height:var(--search-input-height,24px)}.smart-search__action--hover{background-color:var(--app-B4-N9,rgba(0,0,0,.05));opacity:.4}.smart-search__action-button{padding:var(--search-action-padding,0 16px 0 12px)}.smart-search__hover{background-color:var(--app-B4-N9,rgba(0,0,0,.05));opacity:.4}.smart-search__submit{align-items:center;color:var(--search-submit-color,var(--app-M1,#3678e3));display:flex;flex-direction:row;font-size:var(--search-submit-font-size,14px)}.smart-search__submit:before{background-color:var(--search-submit-color,var(--app-M1,#3678e3));content:"";display:block;height:12px;margin-right:12px;width:1px}
1
+ @import '../common/index.css';.smart-search{align-items:center;background-color:var(--search-background-color,var(--app-B3,#fff));box-sizing:border-box;display:flex;padding:var(--search-padding,12px 16px)}.smart-search__content{align-items:center;background-color:var(--search-body-background-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:flex;flex:1;flex-direction:row;padding:12px 16px}.smart-search__content--round{border-radius:999px}.smart-search__label{color:var(--search-label-color,var(--app-B4-N1,#000));font-size:var(--search-label-font-size,14px);line-height:var(--search-input-height,24px);padding:var(--search-label-padding,0 5px)}.smart-search__field{flex:1}.smart-search__field__left-icon{--icon-color:var(--search-left-icon-color,var(--app-B4-N4,rgba(0,0,0,.4)));margin-left:2px}.smart-search__input{font-size:var(--search-value-font-size,14px)}.smart-search--withaction{padding-right:0}.smart-search__action{color:var(--search-action-text-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--search-action-font-size,14px);line-height:var(--search-input-height,24px)}.smart-search__action--hover{background-color:var(--app-B4-N9,rgba(0,0,0,.05));opacity:var(--search-btn-hover-opacity,.4)}.smart-search__action-button{padding:var(--search-action-padding,0 16px 0 12px)}.smart-search__hover{background-color:var(--app-B4-N9,rgba(0,0,0,.05));opacity:var(--search-btn-hover-opacity,.4)}.smart-search__submit{align-items:center;color:var(--search-submit-color,var(--app-M1,#3678e3));display:flex;flex-direction:row;font-size:var(--search-submit-font-size,14px)}.smart-search__submit:before{background-color:var(--search-submit-color,var(--app-M1,#3678e3));content:"";display:block;height:var(--search-submit-line-height,12px);margin-right:12px;width:var(--search-submit-line-width,1px)}
@@ -32,11 +32,7 @@ var Close_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Close"));
32
32
  rightIcon: String,
33
33
  placeholder: String,
34
34
  placeholderStyle: String,
35
- searchText: {
36
- type: String,
37
- value: 'Search',
38
- },
39
- showSearchButton: Boolean,
35
+ searchText: String,
40
36
  background: String,
41
37
  actionText: {
42
38
  type: String,
@@ -40,7 +40,7 @@
40
40
  <smart-icon wx:if="{{ !useLeftIconSlot && leftIcon }}" size="18" name="{{ leftIcon }}" custom-class="smart-search__field__left-icon" slot="left-icon" />
41
41
  <slot wx:if="{{ useLeftIconSlot }}" name="left-icon" slot="left-icon" />
42
42
  <slot wx:if="{{ useRightIconSlot }}" name="right-icon" slot="right-icon" />
43
- <view wx:if="{{ showSearchButton && searchText }}" hover-class="smart-search__hover" bind:tap="goSearch" class="smart-search__submit" slot="button" >{{ searchText }}</view>
43
+ <view wx:if="{{ searchText }}" hover-class="smart-search__hover" bind:tap="goSearch" class="smart-search__submit" slot="button" >{{ searchText }}</view>
44
44
  <slot name="search-button" slot="button" />
45
45
  </smart-field>
46
46
  </view>
@@ -1 +1 @@
1
- @import '../common/index.wxss';.smart-search{align-items:center;background-color:var(--search-background-color,var(--app-B3,#fff));box-sizing:border-box;display:flex;padding:var(--search-padding,12px 16px)}.smart-search__content{align-items:center;background-color:var(--search-body-background-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:flex;flex:1;flex-direction:row;padding:12px 16px}.smart-search__content--round{border-radius:999px}.smart-search__label{color:var(--search-label-color,var(--app-B4-N1,#000));font-size:var(--search-label-font-size,14px);line-height:var(--search-input-height,24px);padding:var(--search-label-padding,0 5px)}.smart-search__field{flex:1}.smart-search__field__left-icon{--icon-color:var(--search-left-icon-color,var(--app-B4-N4,rgba(0,0,0,.4)));margin-left:2px}.smart-search__input{font-size:var(--search-value-font-size,14px)}.smart-search--withaction{padding-right:0}.smart-search__action{color:var(--search-action-text-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--search-action-font-size,14px);line-height:var(--search-input-height,24px)}.smart-search__action--hover{background-color:var(--app-B4-N9,rgba(0,0,0,.05));opacity:.4}.smart-search__action-button{padding:var(--search-action-padding,0 16px 0 12px)}.smart-search__hover{background-color:var(--app-B4-N9,rgba(0,0,0,.05));opacity:.4}.smart-search__submit{align-items:center;color:var(--search-submit-color,var(--app-M1,#3678e3));display:flex;flex-direction:row;font-size:var(--search-submit-font-size,14px)}.smart-search__submit:before{background-color:var(--search-submit-color,var(--app-M1,#3678e3));content:"";display:block;height:12px;margin-right:12px;width:1px}
1
+ @import '../common/index.wxss';.smart-search{align-items:center;background-color:var(--search-background-color,var(--app-B3,#fff));box-sizing:border-box;display:flex;padding:var(--search-padding,12px 16px)}.smart-search__content{align-items:center;background-color:var(--search-body-background-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:flex;flex:1;flex-direction:row;padding:12px 16px}.smart-search__content--round{border-radius:999px}.smart-search__label{color:var(--search-label-color,var(--app-B4-N1,#000));font-size:var(--search-label-font-size,14px);line-height:var(--search-input-height,24px);padding:var(--search-label-padding,0 5px)}.smart-search__field{flex:1}.smart-search__field__left-icon{--icon-color:var(--search-left-icon-color,var(--app-B4-N4,rgba(0,0,0,.4)));margin-left:2px}.smart-search__input{font-size:var(--search-value-font-size,14px)}.smart-search--withaction{padding-right:0}.smart-search__action{color:var(--search-action-text-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--search-action-font-size,14px);line-height:var(--search-input-height,24px)}.smart-search__action--hover{background-color:var(--app-B4-N9,rgba(0,0,0,.05));opacity:var(--search-btn-hover-opacity,.4)}.smart-search__action-button{padding:var(--search-action-padding,0 16px 0 12px)}.smart-search__hover{background-color:var(--app-B4-N9,rgba(0,0,0,.05));opacity:var(--search-btn-hover-opacity,.4)}.smart-search__submit{align-items:center;color:var(--search-submit-color,var(--app-M1,#3678e3));display:flex;flex-direction:row;font-size:var(--search-submit-font-size,14px)}.smart-search__submit:before{background-color:var(--search-submit-color,var(--app-M1,#3678e3));content:"";display:block;height:var(--search-submit-line-height,12px);margin-right:12px;width:var(--search-submit-line-width,1px)}