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

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-action-sheet{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px))!important;color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000));left:var(--action-sheet-left,16px)!important;margin:var(--action-sheet-margin,0 0 16px);max-height:var(--action-sheet-max-height,90%)!important;width:var(--action-sheet-width,calc(100% - 32px))!important}.smart-action-sheet__list{max-height:325px;overflow-y:scroll}.smart-action-sheet__icon{font-size:var(--action-sheet-item-icon-size,28px);margin:var(--action-sheet-item-icon-margin,16px 16px 0 0);position:absolute;right:0;top:0}.smart-action-sheet__item{border-radius:var(--action-sheet-item-border-radius,0);color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000))}.smart-action-sheet__item:not(:last-child){border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)))}.smart-action-sheet__cancel,.smart-action-sheet__confirm,.smart-action-sheet__item{background-color:var(--action-sheet-item-background,var(--app-B4,#fff));font-size:var(--action-sheet-item-font-size,16px);font-weight:var(--action-sheet-item-font-weight,normal);line-height:var(--action-sheet-item-line-height,24px);padding:16px;text-align:center;width:100%}.smart-action-sheet__cancel--hover,.smart-action-sheet__confirm--hover,.smart-action-sheet__item--hover{background-color:var(--action-sheet-active-color,var(--app-B1,#f6f7fb))}.smart-action-sheet__cancel:after,.smart-action-sheet__confirm:after,.smart-action-sheet__item:after{border-width:0}.smart-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,var(--app-B4-N3,rgba(0,0,0,.5)))}.smart-action-sheet__confirm{color:var(--action-sheet-confirm-text-color,var(--app-B4-N1,#000));font-weight:var(--action-sheet-confirm-font-weight,500)}.smart-action-sheet__gap{background-color:var(--action-sheet-footer-padding-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:block;height:var(--action-sheet-footer-padding-top,8px)}.smart-action-sheet__item--disabled{opacity:var(--action-sheet-item-disabled-opacity,.3)}.smart-action-sheet__item--disabled.smart-action-sheet__item--hover{background-color:var(--action-sheet-item-background,var(--app-B4,#fff))}.smart-action-sheet__subname{color:var(--action-sheet-subname-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.smart-action-sheet__header{border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)));color:var(--action-sheet-header-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--action-sheet-header-font-weight,normal);line-height:var(--action-sheet-header-height,56px);text-align:center}.smart-action-sheet__description{color:var(--action-sheet-description-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.smart-action-sheet__loading{color:inherit!important;display:flex!important}.smart-action-sheet__footer{align-items:center;background-color:var(--action-sheet-item-background,var(--app-B4,#fff));display:flex;font-size:var(--action-sheet-item-font-size,16px);justify-content:space-around;line-height:var(--action-sheet-item-line-height,22px);text-align:center}
1
+ @import '../common/index.css';.smart-action-sheet{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px))!important;color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000));left:var(--action-sheet-left,16px)!important;margin:var(--action-sheet-margin,0 0 16px);max-height:var(--action-sheet-max-height,90%)!important;width:var(--action-sheet-width,calc(100% - 32px))!important}.smart-action-sheet__list{max-height:325px;overflow-y:scroll}.smart-action-sheet__icon{--icon-color:var(--action-sheet-active-icon-color,var(--app-M1,#3678e3));font-size:var(--action-sheet-item-icon-size,28px);margin:var(--action-sheet-item-icon-margin,16px 16px 0 0);position:absolute;right:0;top:0}.smart-action-sheet__item{border-radius:var(--action-sheet-item-border-radius,0);color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000))}.smart-action-sheet__item:not(:last-child){border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)))}.smart-action-sheet__cancel,.smart-action-sheet__confirm,.smart-action-sheet__item{background-color:var(--action-sheet-item-background,var(--app-B4,#fff));font-size:var(--action-sheet-item-font-size,16px);font-weight:var(--action-sheet-item-font-weight,normal);line-height:var(--action-sheet-item-line-height,24px);padding:16px;text-align:center;width:100%}.smart-action-sheet__cancel--hover,.smart-action-sheet__confirm--hover,.smart-action-sheet__item--hover{background-color:var(--action-sheet-active-color,var(--app-B1,#f6f7fb))}.smart-action-sheet__cancel:after,.smart-action-sheet__confirm:after,.smart-action-sheet__item:after{border-width:0}.smart-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,var(--app-B4-N3,rgba(0,0,0,.5)))}.smart-action-sheet__confirm{color:var(--action-sheet-confirm-text-color,var(--app-B4-N1,#000));font-weight:var(--action-sheet-confirm-font-weight,500)}.smart-action-sheet__gap{background-color:var(--action-sheet-footer-padding-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:block;height:var(--action-sheet-footer-padding-top,8px)}.smart-action-sheet__item--disabled{opacity:var(--action-sheet-item-disabled-opacity,.3)}.smart-action-sheet__item--disabled.smart-action-sheet__item--hover{background-color:var(--action-sheet-item-background,var(--app-B4,#fff))}.smart-action-sheet__subname{color:var(--action-sheet-subname-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.smart-action-sheet__header{border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)));color:var(--action-sheet-header-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--action-sheet-header-font-weight,normal);line-height:var(--action-sheet-header-height,56px);text-align:center}.smart-action-sheet__description{color:var(--action-sheet-description-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.smart-action-sheet__loading{color:inherit!important;display:flex!important}.smart-action-sheet__footer{align-items:center;background-color:var(--action-sheet-item-background,var(--app-B4,#fff));display:flex;font-size:var(--action-sheet-item-font-size,16px);justify-content:space-around;line-height:var(--action-sheet-item-line-height,22px);text-align:center}
@@ -50,14 +50,6 @@ SmartComponent({
50
50
  },
51
51
  data: {
52
52
  checkMarkIcon,
53
- checkMarkIconColor: '#3678E3',
54
- },
55
- mounted() {
56
- var _a;
57
- // @ts-ignore
58
- const themeInfo = (_a = ty === null || ty === void 0 ? void 0 : ty.getThemeInfo()) !== null && _a !== void 0 ? _a : {};
59
- const checkMarkIconColor = this.data.activeColor || themeInfo['--app-M1'] || '#3678E3';
60
- this.setData({ checkMarkIconColor });
61
53
  },
62
54
  methods: {
63
55
  onSelect(event) {
@@ -53,7 +53,7 @@
53
53
  <block wx:if="{{ !item.loading }}">
54
54
  {{ item.name }}
55
55
  <view wx:if="{{ item.subname }}" class="smart-action-sheet__subname" >{{ item.subname }}</view>
56
- <smart-icon wx:if="{{ item.checked }}" name="{{ checkMarkIcon }}" class="smart-action-sheet__icon" color="{{ checkMarkIconColor }}" />
56
+ <smart-icon wx:if="{{ item.checked }}" name="{{ checkMarkIcon }}" class="smart-action-sheet__icon" color="{{ activeColor }}" />
57
57
  </block>
58
58
  <smart-loading wx:else custom-class="smart-action-sheet__loading" size="22px" />
59
59
  </button>
@@ -1 +1 @@
1
- @import '../common/index.wxss';.smart-action-sheet{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px))!important;color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000));left:var(--action-sheet-left,16px)!important;margin:var(--action-sheet-margin,0 0 16px);max-height:var(--action-sheet-max-height,90%)!important;width:var(--action-sheet-width,calc(100% - 32px))!important}.smart-action-sheet__list{max-height:325px;overflow-y:scroll}.smart-action-sheet__icon{font-size:var(--action-sheet-item-icon-size,28px);margin:var(--action-sheet-item-icon-margin,16px 16px 0 0);position:absolute;right:0;top:0}.smart-action-sheet__item{border-radius:var(--action-sheet-item-border-radius,0);color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000))}.smart-action-sheet__item:not(:last-child){border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)))}.smart-action-sheet__cancel,.smart-action-sheet__confirm,.smart-action-sheet__item{background-color:var(--action-sheet-item-background,var(--app-B4,#fff));font-size:var(--action-sheet-item-font-size,16px);font-weight:var(--action-sheet-item-font-weight,normal);line-height:var(--action-sheet-item-line-height,24px);padding:16px;text-align:center;width:100%}.smart-action-sheet__cancel--hover,.smart-action-sheet__confirm--hover,.smart-action-sheet__item--hover{background-color:var(--action-sheet-active-color,var(--app-B1,#f6f7fb))}.smart-action-sheet__cancel:after,.smart-action-sheet__confirm:after,.smart-action-sheet__item:after{border-width:0}.smart-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,var(--app-B4-N3,rgba(0,0,0,.5)))}.smart-action-sheet__confirm{color:var(--action-sheet-confirm-text-color,var(--app-B4-N1,#000));font-weight:var(--action-sheet-confirm-font-weight,500)}.smart-action-sheet__gap{background-color:var(--action-sheet-footer-padding-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:block;height:var(--action-sheet-footer-padding-top,8px)}.smart-action-sheet__item--disabled{opacity:var(--action-sheet-item-disabled-opacity,.3)}.smart-action-sheet__item--disabled.smart-action-sheet__item--hover{background-color:var(--action-sheet-item-background,var(--app-B4,#fff))}.smart-action-sheet__subname{color:var(--action-sheet-subname-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.smart-action-sheet__header{border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)));color:var(--action-sheet-header-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--action-sheet-header-font-weight,normal);line-height:var(--action-sheet-header-height,56px);text-align:center}.smart-action-sheet__description{color:var(--action-sheet-description-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.smart-action-sheet__loading{color:inherit!important;display:flex!important}.smart-action-sheet__footer{align-items:center;background-color:var(--action-sheet-item-background,var(--app-B4,#fff));display:flex;font-size:var(--action-sheet-item-font-size,16px);justify-content:space-around;line-height:var(--action-sheet-item-line-height,22px);text-align:center}
1
+ @import '../common/index.wxss';.smart-action-sheet{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px))!important;color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000));left:var(--action-sheet-left,16px)!important;margin:var(--action-sheet-margin,0 0 16px);max-height:var(--action-sheet-max-height,90%)!important;width:var(--action-sheet-width,calc(100% - 32px))!important}.smart-action-sheet__list{max-height:325px;overflow-y:scroll}.smart-action-sheet__icon{--icon-color:var(--action-sheet-active-icon-color,var(--app-M1,#3678e3));font-size:var(--action-sheet-item-icon-size,28px);margin:var(--action-sheet-item-icon-margin,16px 16px 0 0);position:absolute;right:0;top:0}.smart-action-sheet__item{border-radius:var(--action-sheet-item-border-radius,0);color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000))}.smart-action-sheet__item:not(:last-child){border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)))}.smart-action-sheet__cancel,.smart-action-sheet__confirm,.smart-action-sheet__item{background-color:var(--action-sheet-item-background,var(--app-B4,#fff));font-size:var(--action-sheet-item-font-size,16px);font-weight:var(--action-sheet-item-font-weight,normal);line-height:var(--action-sheet-item-line-height,24px);padding:16px;text-align:center;width:100%}.smart-action-sheet__cancel--hover,.smart-action-sheet__confirm--hover,.smart-action-sheet__item--hover{background-color:var(--action-sheet-active-color,var(--app-B1,#f6f7fb))}.smart-action-sheet__cancel:after,.smart-action-sheet__confirm:after,.smart-action-sheet__item:after{border-width:0}.smart-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,var(--app-B4-N3,rgba(0,0,0,.5)))}.smart-action-sheet__confirm{color:var(--action-sheet-confirm-text-color,var(--app-B4-N1,#000));font-weight:var(--action-sheet-confirm-font-weight,500)}.smart-action-sheet__gap{background-color:var(--action-sheet-footer-padding-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:block;height:var(--action-sheet-footer-padding-top,8px)}.smart-action-sheet__item--disabled{opacity:var(--action-sheet-item-disabled-opacity,.3)}.smart-action-sheet__item--disabled.smart-action-sheet__item--hover{background-color:var(--action-sheet-item-background,var(--app-B4,#fff))}.smart-action-sheet__subname{color:var(--action-sheet-subname-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.smart-action-sheet__header{border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)));color:var(--action-sheet-header-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--action-sheet-header-font-weight,normal);line-height:var(--action-sheet-header-height,56px);text-align:center}.smart-action-sheet__description{color:var(--action-sheet-description-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.smart-action-sheet__loading{color:inherit!important;display:flex!important}.smart-action-sheet__footer{align-items:center;background-color:var(--action-sheet-item-background,var(--app-B4,#fff));display:flex;font-size:var(--action-sheet-item-font-size,16px);justify-content:space-around;line-height:var(--action-sheet-item-line-height,22px);text-align:center}
@@ -1,7 +1,13 @@
1
- import upIcon from '@tuya-miniapp/icons/dist/svg/Up';
2
- import downIcon from '@tuya-miniapp/icons/dist/svg/Down';
3
- import leftIcon from '@tuya-miniapp/icons/dist/svg/Left';
4
- import rightIcon from '@tuya-miniapp/icons/dist/svg/Right';
1
+ import upIcon from '@tuya-miniapp/icons/dist/svg/Up.js';
2
+ import downIcon from '@tuya-miniapp/icons/dist/svg/Down.js';
3
+ import leftIcon from '@tuya-miniapp/icons/dist/svg/Left.js';
4
+ import rightIcon from '@tuya-miniapp/icons/dist/svg/Right.js';
5
+ // import {
6
+ // Right as rightIcon,
7
+ // Left as leftIcon,
8
+ // Down as downIcon,
9
+ // Up as upIcon,
10
+ // } from '@tuya-miniapp/icons';
5
11
  import { link } from '../mixins/link';
6
12
  import { SmartComponent } from '../common/component';
7
13
  SmartComponent({
@@ -4,12 +4,14 @@ SmartComponent({
4
4
  data: {
5
5
  minHour: 10,
6
6
  maxHour: 20,
7
+ columnsOrder: [2, 1, 1],
7
8
  minDate: new Date(2018, 0, 1).getTime(),
8
9
  maxDate: new Date(2019, 10, 1).getTime(),
9
10
  currentDate1: new Date(2018, 2, 31).getTime(),
10
11
  currentDate2: null,
11
12
  currentDate3: new Date(2018, 0, 1),
12
13
  currentDate4: '12:00',
14
+ currentDate5: '11:00',
13
15
  loading: false,
14
16
  formatterMap: {
15
17
  year: '{{year}}年',
@@ -47,6 +47,18 @@ SmartComponent({
47
47
  }, formatter: {
48
48
  type: null,
49
49
  value: defaultFormatter,
50
+ }, AMText: {
51
+ type: String,
52
+ value: 'AM',
53
+ }, PMText: {
54
+ type: String,
55
+ value: 'PM',
56
+ }, columnsOrder: {
57
+ type: Array,
58
+ value: [],
59
+ }, is12HoursTime: {
60
+ type: Boolean,
61
+ value: false,
50
62
  }, minDate: {
51
63
  type: Number,
52
64
  value: new Date(currentYear - 10, 0, 1).getTime(),
@@ -76,6 +88,7 @@ SmartComponent({
76
88
  value: undefined,
77
89
  } }),
78
90
  data: {
91
+ part: 0,
79
92
  innerValue: Date.now(),
80
93
  columns: [],
81
94
  },
@@ -99,29 +112,31 @@ SmartComponent({
99
112
  }
100
113
  return this.picker;
101
114
  },
102
- formatterFunc(type, value) {
103
- var _a;
104
- const { formatterMap, formatter = defaultFormatter } = this.data;
115
+ formatterFunc(type, value, data) {
116
+ var _a, _b;
117
+ const { formatterMap, formatter = defaultFormatter } = (_a = this === null || this === void 0 ? void 0 : this.data) !== null && _a !== void 0 ? _a : data;
105
118
  const mapDetail = formatterMap === null || formatterMap === void 0 ? void 0 : formatterMap[type];
106
119
  if (typeof mapDetail === 'string') {
107
120
  return replacePlaceholders(mapDetail, { [type]: value });
108
121
  }
109
122
  if (typeof mapDetail === 'object') {
110
- return (_a = mapDetail[value]) !== null && _a !== void 0 ? _a : formatter(type, value);
123
+ return (_b = mapDetail[value]) !== null && _b !== void 0 ? _b : formatter(type, value);
111
124
  }
112
125
  return formatter(type, value);
113
126
  },
114
127
  updateColumns() {
115
128
  const { locale } = this.data;
116
129
  const results = this.getOriginColumns().map(column => ({
117
- values: column.values.map(value => this.formatterFunc(column.type, value)),
130
+ values: column.values.map(value => this.formatterFunc(column.type, value, this.data)),
131
+ order: column.order,
118
132
  unit: locale === null || locale === void 0 ? void 0 : locale[column.type],
119
133
  }));
120
134
  return this.set({ columns: results });
121
135
  },
122
136
  getOriginColumns() {
123
- const { filter } = this.data;
124
- const results = this.getRanges().map(({ type, range }) => {
137
+ const { filter, is12HoursTime, type, AMText, PMText, columnsOrder } = this.data;
138
+ const results = this.getRanges().map(({ type, range }, index) => {
139
+ const order = columnsOrder[index];
125
140
  let values = times(range[1] - range[0] + 1, index => {
126
141
  const value = range[0] + index;
127
142
  return type === 'year' ? `${value}` : padZero(value);
@@ -129,12 +144,38 @@ SmartComponent({
129
144
  if (filter) {
130
145
  values = filter(type, values);
131
146
  }
132
- return { type, values };
147
+ return { type, values, order };
133
148
  });
149
+ if (is12HoursTime && type === 'time') {
150
+ return [
151
+ {
152
+ type: '12hours',
153
+ values: [AMText, PMText],
154
+ order: columnsOrder[0],
155
+ },
156
+ ...results.map((item, index) => (Object.assign(Object.assign({}, item), { order: columnsOrder[index + 1] }))),
157
+ ].filter(Boolean);
158
+ }
134
159
  return results;
135
160
  },
136
161
  getRanges() {
137
162
  const { data } = this;
163
+ if (data.type === 'time' && data.is12HoursTime) {
164
+ const { part } = data;
165
+ return [
166
+ {
167
+ type: 'hour',
168
+ range: [
169
+ Math.max(part ? 13 : 1, data.minHour) - (part ? 12 : 0),
170
+ Math.min(part ? 24 : 12, data.maxHour) - (part ? 12 : 0),
171
+ ],
172
+ },
173
+ {
174
+ type: 'minute',
175
+ range: [data.minMinute, data.maxMinute],
176
+ },
177
+ ];
178
+ }
138
179
  if (data.type === 'time') {
139
180
  return [
140
181
  {
@@ -244,12 +285,24 @@ SmartComponent({
244
285
  const { data } = this;
245
286
  let value;
246
287
  const picker = this.getPicker();
247
- const originColumns = this.getOriginColumns();
248
- if (data.type === 'time') {
249
- const indexes = picker.getIndexes();
288
+ const indexes = picker.getIndexes();
289
+ if (data.type === 'time' && data.is12HoursTime) {
290
+ const [part, hour, minute] = indexes;
291
+ this.setData({
292
+ part,
293
+ });
294
+ const originColumns = this.getOriginColumns();
295
+ value = `${(part ? 12 : 0) +
296
+ Number(originColumns[1].values[hour > originColumns[1].values.length - 1 ? originColumns[1].values.length - 1 : hour])}:${Number(originColumns[2].values[minute > originColumns[2].values.length - 1
297
+ ? originColumns[2].values.length - 1
298
+ : minute])}`;
299
+ }
300
+ else if (data.type === 'time') {
301
+ const originColumns = this.getOriginColumns();
250
302
  value = `${+originColumns[0].values[indexes[0]]}:${+originColumns[1].values[indexes[1]]}`;
251
303
  }
252
304
  else {
305
+ const originColumns = this.getOriginColumns();
253
306
  const indexes = picker.getIndexes();
254
307
  const values = indexes.map((value, index) => originColumns[index].values[value]);
255
308
  const year = getTrueValue(values[0]);
@@ -276,24 +329,36 @@ SmartComponent({
276
329
  },
277
330
  updateColumnValue(value) {
278
331
  let values = [];
279
- const { type } = this.data;
332
+ const { type, is12HoursTime } = this.data;
280
333
  const formatter = this.formatterFunc;
281
334
  const picker = this.getPicker();
282
- if (type === 'time') {
335
+ if (type === 'time' && is12HoursTime) {
336
+ const [hour, minute] = value.split(':');
337
+ const part = Number(hour) > 0 && Number(hour) < 13 ? 0 : 1;
338
+ this.setData({
339
+ part,
340
+ });
341
+ values = [
342
+ part,
343
+ formatter('hour', part ? (!hour ? 12 : hour - 12) : hour, this.data),
344
+ formatter('minute', minute, this.data),
345
+ ];
346
+ }
347
+ else if (type === 'time') {
283
348
  const pair = value.split(':');
284
- values = [formatter('hour', pair[0]), formatter('minute', pair[1])];
349
+ values = [formatter('hour', pair[0], this.data), formatter('minute', pair[1], this.data)];
285
350
  }
286
351
  else {
287
352
  const date = new Date(value);
288
353
  values = [
289
- formatter('year', `${date.getFullYear()}`),
290
- formatter('month', padZero(date.getMonth() + 1)),
354
+ formatter('year', `${date.getFullYear()}`, this.data),
355
+ formatter('month', padZero(date.getMonth() + 1), this.data),
291
356
  ];
292
357
  if (type === 'date') {
293
- values.push(formatter('day', padZero(date.getDate())));
358
+ values.push(formatter('day', padZero(date.getDate()), this.data));
294
359
  }
295
360
  if (type === 'datetime') {
296
- values.push(formatter('day', padZero(date.getDate())), formatter('hour', padZero(date.getHours())), formatter('minute', padZero(date.getMinutes())));
361
+ values.push(formatter('day', padZero(date.getDate()), this.data), formatter('hour', padZero(date.getHours()), this.data), formatter('minute', padZero(date.getMinutes()), this.data));
297
362
  }
298
363
  }
299
364
  return this.set({ innerValue: value })
@@ -1,7 +1,7 @@
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/dist/svg/Xmark';
4
+ import Xmark from '@tuya-miniapp/icons/dist/svg/Xmark.js';
5
5
  SmartComponent({
6
6
  field: true,
7
7
  classes: ['input-class', 'right-icon-class', 'label-class'],
@@ -1,6 +1,6 @@
1
1
  import { SmartComponent } from '../common/component';
2
2
  import { getRect, requestAnimationFrame } from '../common/utils';
3
- import Xmark from '@tuya-miniapp/icons/dist/svg/Xmark';
3
+ import Xmark from '@tuya-miniapp/icons/dist/svg/Xmark.js';
4
4
  import Right from '@tuya-miniapp/icons/dist/svg/Right';
5
5
  SmartComponent({
6
6
  props: {
@@ -19,7 +19,7 @@
19
19
  data-index="{{ index }}"
20
20
  custom-class="column-class"
21
21
  value-key="{{ valueKey }}"
22
- style="{{ item.style }}"
22
+ style="order: {{ item.order }}; {{ computed.style(item.style) }}"
23
23
  active-style="{{ activeStyle }}"
24
24
  options="{{ item.values }}"
25
25
  unit="{{ item.unit || unit }}"
@@ -39,4 +39,5 @@ module.exports = {
39
39
  frameStyle: frameStyle,
40
40
  maskStyle: maskStyle,
41
41
  columns: columns,
42
+ style: style
42
43
  };
@@ -147,6 +147,8 @@ SmartComponent({
147
147
  const value = this.format(add(+this.data.currentValue, diff));
148
148
  this.emitChange(value);
149
149
  this.$emit(type);
150
+ // @ts-ignore
151
+ ty.vibrateShort({ type: 'light' });
150
152
  },
151
153
  longPressStep() {
152
154
  this.longPressTimer = setTimeout(() => {
package/dist/tag/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import Xmark from '@tuya-miniapp/icons/dist/svg/Xmark';
1
+ import Xmark from '@tuya-miniapp/icons/dist/svg/Xmark.js';
2
2
  import { SmartComponent } from '../common/component';
3
3
  SmartComponent({
4
4
  props: {
@@ -13,6 +13,10 @@ function kebabCase(word) {
13
13
  }
14
14
 
15
15
  function style(styles) {
16
+ if (typeof styles === 'string') {
17
+ return styles
18
+ }
19
+
16
20
  if (array.isArray(styles)) {
17
21
  return styles
18
22
  .filter(function (item) {
@@ -24,7 +28,7 @@ function style(styles) {
24
28
  .join(';');
25
29
  }
26
30
 
27
- if ('Object' === styles.constructor) {
31
+ if (typeof styles === 'object' && 'Object' === styles.constructor) {
28
32
  return object
29
33
  .keys(styles)
30
34
  .filter(function (key) {
@@ -35,9 +39,6 @@ function style(styles) {
35
39
  })
36
40
  .join(';');
37
41
  }
38
- if (typeof styles === 'string') {
39
- return styles
40
- }
41
42
 
42
43
  return styles || '';
43
44
  }
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-action-sheet{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px))!important;color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000));left:var(--action-sheet-left,16px)!important;margin:var(--action-sheet-margin,0 0 16px);max-height:var(--action-sheet-max-height,90%)!important;width:var(--action-sheet-width,calc(100% - 32px))!important}.smart-action-sheet__list{max-height:325px;overflow-y:scroll}.smart-action-sheet__icon{font-size:var(--action-sheet-item-icon-size,28px);margin:var(--action-sheet-item-icon-margin,16px 16px 0 0);position:absolute;right:0;top:0}.smart-action-sheet__item{border-radius:var(--action-sheet-item-border-radius,0);color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000))}.smart-action-sheet__item:not(:last-child){border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)))}.smart-action-sheet__cancel,.smart-action-sheet__confirm,.smart-action-sheet__item{background-color:var(--action-sheet-item-background,var(--app-B4,#fff));font-size:var(--action-sheet-item-font-size,16px);font-weight:var(--action-sheet-item-font-weight,normal);line-height:var(--action-sheet-item-line-height,24px);padding:16px;text-align:center;width:100%}.smart-action-sheet__cancel--hover,.smart-action-sheet__confirm--hover,.smart-action-sheet__item--hover{background-color:var(--action-sheet-active-color,var(--app-B1,#f6f7fb))}.smart-action-sheet__cancel:after,.smart-action-sheet__confirm:after,.smart-action-sheet__item:after{border-width:0}.smart-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,var(--app-B4-N3,rgba(0,0,0,.5)))}.smart-action-sheet__confirm{color:var(--action-sheet-confirm-text-color,var(--app-B4-N1,#000));font-weight:var(--action-sheet-confirm-font-weight,500)}.smart-action-sheet__gap{background-color:var(--action-sheet-footer-padding-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:block;height:var(--action-sheet-footer-padding-top,8px)}.smart-action-sheet__item--disabled{opacity:var(--action-sheet-item-disabled-opacity,.3)}.smart-action-sheet__item--disabled.smart-action-sheet__item--hover{background-color:var(--action-sheet-item-background,var(--app-B4,#fff))}.smart-action-sheet__subname{color:var(--action-sheet-subname-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.smart-action-sheet__header{border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)));color:var(--action-sheet-header-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--action-sheet-header-font-weight,normal);line-height:var(--action-sheet-header-height,56px);text-align:center}.smart-action-sheet__description{color:var(--action-sheet-description-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.smart-action-sheet__loading{color:inherit!important;display:flex!important}.smart-action-sheet__footer{align-items:center;background-color:var(--action-sheet-item-background,var(--app-B4,#fff));display:flex;font-size:var(--action-sheet-item-font-size,16px);justify-content:space-around;line-height:var(--action-sheet-item-line-height,22px);text-align:center}
1
+ @import '../common/index.css';.smart-action-sheet{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px))!important;color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000));left:var(--action-sheet-left,16px)!important;margin:var(--action-sheet-margin,0 0 16px);max-height:var(--action-sheet-max-height,90%)!important;width:var(--action-sheet-width,calc(100% - 32px))!important}.smart-action-sheet__list{max-height:325px;overflow-y:scroll}.smart-action-sheet__icon{--icon-color:var(--action-sheet-active-icon-color,var(--app-M1,#3678e3));font-size:var(--action-sheet-item-icon-size,28px);margin:var(--action-sheet-item-icon-margin,16px 16px 0 0);position:absolute;right:0;top:0}.smart-action-sheet__item{border-radius:var(--action-sheet-item-border-radius,0);color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000))}.smart-action-sheet__item:not(:last-child){border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)))}.smart-action-sheet__cancel,.smart-action-sheet__confirm,.smart-action-sheet__item{background-color:var(--action-sheet-item-background,var(--app-B4,#fff));font-size:var(--action-sheet-item-font-size,16px);font-weight:var(--action-sheet-item-font-weight,normal);line-height:var(--action-sheet-item-line-height,24px);padding:16px;text-align:center;width:100%}.smart-action-sheet__cancel--hover,.smart-action-sheet__confirm--hover,.smart-action-sheet__item--hover{background-color:var(--action-sheet-active-color,var(--app-B1,#f6f7fb))}.smart-action-sheet__cancel:after,.smart-action-sheet__confirm:after,.smart-action-sheet__item:after{border-width:0}.smart-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,var(--app-B4-N3,rgba(0,0,0,.5)))}.smart-action-sheet__confirm{color:var(--action-sheet-confirm-text-color,var(--app-B4-N1,#000));font-weight:var(--action-sheet-confirm-font-weight,500)}.smart-action-sheet__gap{background-color:var(--action-sheet-footer-padding-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:block;height:var(--action-sheet-footer-padding-top,8px)}.smart-action-sheet__item--disabled{opacity:var(--action-sheet-item-disabled-opacity,.3)}.smart-action-sheet__item--disabled.smart-action-sheet__item--hover{background-color:var(--action-sheet-item-background,var(--app-B4,#fff))}.smart-action-sheet__subname{color:var(--action-sheet-subname-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.smart-action-sheet__header{border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)));color:var(--action-sheet-header-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--action-sheet-header-font-weight,normal);line-height:var(--action-sheet-header-height,56px);text-align:center}.smart-action-sheet__description{color:var(--action-sheet-description-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.smart-action-sheet__loading{color:inherit!important;display:flex!important}.smart-action-sheet__footer{align-items:center;background-color:var(--action-sheet-item-background,var(--app-B4,#fff));display:flex;font-size:var(--action-sheet-item-font-size,16px);justify-content:space-around;line-height:var(--action-sheet-item-line-height,22px);text-align:center}
@@ -55,14 +55,6 @@ var button_1 = require("../mixins/button");
55
55
  },
56
56
  data: {
57
57
  checkMarkIcon: Check_1.default,
58
- checkMarkIconColor: '#3678E3',
59
- },
60
- mounted: function () {
61
- var _a;
62
- // @ts-ignore
63
- var themeInfo = (_a = ty === null || ty === void 0 ? void 0 : ty.getThemeInfo()) !== null && _a !== void 0 ? _a : {};
64
- var checkMarkIconColor = this.data.activeColor || themeInfo['--app-M1'] || '#3678E3';
65
- this.setData({ checkMarkIconColor: checkMarkIconColor });
66
58
  },
67
59
  methods: {
68
60
  onSelect: function (event) {
@@ -53,7 +53,7 @@
53
53
  <block wx:if="{{ !item.loading }}">
54
54
  {{ item.name }}
55
55
  <view wx:if="{{ item.subname }}" class="smart-action-sheet__subname" >{{ item.subname }}</view>
56
- <smart-icon wx:if="{{ item.checked }}" name="{{ checkMarkIcon }}" class="smart-action-sheet__icon" color="{{ checkMarkIconColor }}" />
56
+ <smart-icon wx:if="{{ item.checked }}" name="{{ checkMarkIcon }}" class="smart-action-sheet__icon" color="{{ activeColor }}" />
57
57
  </block>
58
58
  <smart-loading wx:else custom-class="smart-action-sheet__loading" size="22px" />
59
59
  </button>
@@ -1 +1 @@
1
- @import '../common/index.wxss';.smart-action-sheet{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px))!important;color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000));left:var(--action-sheet-left,16px)!important;margin:var(--action-sheet-margin,0 0 16px);max-height:var(--action-sheet-max-height,90%)!important;width:var(--action-sheet-width,calc(100% - 32px))!important}.smart-action-sheet__list{max-height:325px;overflow-y:scroll}.smart-action-sheet__icon{font-size:var(--action-sheet-item-icon-size,28px);margin:var(--action-sheet-item-icon-margin,16px 16px 0 0);position:absolute;right:0;top:0}.smart-action-sheet__item{border-radius:var(--action-sheet-item-border-radius,0);color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000))}.smart-action-sheet__item:not(:last-child){border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)))}.smart-action-sheet__cancel,.smart-action-sheet__confirm,.smart-action-sheet__item{background-color:var(--action-sheet-item-background,var(--app-B4,#fff));font-size:var(--action-sheet-item-font-size,16px);font-weight:var(--action-sheet-item-font-weight,normal);line-height:var(--action-sheet-item-line-height,24px);padding:16px;text-align:center;width:100%}.smart-action-sheet__cancel--hover,.smart-action-sheet__confirm--hover,.smart-action-sheet__item--hover{background-color:var(--action-sheet-active-color,var(--app-B1,#f6f7fb))}.smart-action-sheet__cancel:after,.smart-action-sheet__confirm:after,.smart-action-sheet__item:after{border-width:0}.smart-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,var(--app-B4-N3,rgba(0,0,0,.5)))}.smart-action-sheet__confirm{color:var(--action-sheet-confirm-text-color,var(--app-B4-N1,#000));font-weight:var(--action-sheet-confirm-font-weight,500)}.smart-action-sheet__gap{background-color:var(--action-sheet-footer-padding-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:block;height:var(--action-sheet-footer-padding-top,8px)}.smart-action-sheet__item--disabled{opacity:var(--action-sheet-item-disabled-opacity,.3)}.smart-action-sheet__item--disabled.smart-action-sheet__item--hover{background-color:var(--action-sheet-item-background,var(--app-B4,#fff))}.smart-action-sheet__subname{color:var(--action-sheet-subname-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.smart-action-sheet__header{border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)));color:var(--action-sheet-header-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--action-sheet-header-font-weight,normal);line-height:var(--action-sheet-header-height,56px);text-align:center}.smart-action-sheet__description{color:var(--action-sheet-description-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.smart-action-sheet__loading{color:inherit!important;display:flex!important}.smart-action-sheet__footer{align-items:center;background-color:var(--action-sheet-item-background,var(--app-B4,#fff));display:flex;font-size:var(--action-sheet-item-font-size,16px);justify-content:space-around;line-height:var(--action-sheet-item-line-height,22px);text-align:center}
1
+ @import '../common/index.wxss';.smart-action-sheet{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px))!important;color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000));left:var(--action-sheet-left,16px)!important;margin:var(--action-sheet-margin,0 0 16px);max-height:var(--action-sheet-max-height,90%)!important;width:var(--action-sheet-width,calc(100% - 32px))!important}.smart-action-sheet__list{max-height:325px;overflow-y:scroll}.smart-action-sheet__icon{--icon-color:var(--action-sheet-active-icon-color,var(--app-M1,#3678e3));font-size:var(--action-sheet-item-icon-size,28px);margin:var(--action-sheet-item-icon-margin,16px 16px 0 0);position:absolute;right:0;top:0}.smart-action-sheet__item{border-radius:var(--action-sheet-item-border-radius,0);color:var(--action-sheet-item-text-color,var(--app-B4-N1,#000))}.smart-action-sheet__item:not(:last-child){border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)))}.smart-action-sheet__cancel,.smart-action-sheet__confirm,.smart-action-sheet__item{background-color:var(--action-sheet-item-background,var(--app-B4,#fff));font-size:var(--action-sheet-item-font-size,16px);font-weight:var(--action-sheet-item-font-weight,normal);line-height:var(--action-sheet-item-line-height,24px);padding:16px;text-align:center;width:100%}.smart-action-sheet__cancel--hover,.smart-action-sheet__confirm--hover,.smart-action-sheet__item--hover{background-color:var(--action-sheet-active-color,var(--app-B1,#f6f7fb))}.smart-action-sheet__cancel:after,.smart-action-sheet__confirm:after,.smart-action-sheet__item:after{border-width:0}.smart-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,var(--app-B4-N3,rgba(0,0,0,.5)))}.smart-action-sheet__confirm{color:var(--action-sheet-confirm-text-color,var(--app-B4-N1,#000));font-weight:var(--action-sheet-confirm-font-weight,500)}.smart-action-sheet__gap{background-color:var(--action-sheet-footer-padding-color,var(--app-B4-N9,rgba(0,0,0,.05)));display:block;height:var(--action-sheet-footer-padding-top,8px)}.smart-action-sheet__item--disabled{opacity:var(--action-sheet-item-disabled-opacity,.3)}.smart-action-sheet__item--disabled.smart-action-sheet__item--hover{background-color:var(--action-sheet-item-background,var(--app-B4,#fff))}.smart-action-sheet__subname{color:var(--action-sheet-subname-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.smart-action-sheet__header{border-bottom:1px solid var(--action-sheet-header-border-color,var(--app-B4-N7,rgba(0,0,0,.1)));color:var(--action-sheet-header-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--action-sheet-header-font-weight,normal);line-height:var(--action-sheet-header-height,56px);text-align:center}.smart-action-sheet__description{color:var(--action-sheet-description-color,var(--app-B4-N3,rgba(0,0,0,.5)));font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.smart-action-sheet__loading{color:inherit!important;display:flex!important}.smart-action-sheet__footer{align-items:center;background-color:var(--action-sheet-item-background,var(--app-B4,#fff));display:flex;font-size:var(--action-sheet-item-font-size,16px);justify-content:space-around;line-height:var(--action-sheet-item-line-height,22px);text-align:center}
package/lib/cell/index.js CHANGED
@@ -3,10 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var Up_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Up"));
7
- var Down_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Down"));
8
- var Left_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Left"));
9
- var Right_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Right"));
6
+ var Up_js_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Up.js"));
7
+ var Down_js_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Down.js"));
8
+ var Left_js_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Left.js"));
9
+ var Right_js_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Right.js"));
10
+ // import {
11
+ // Right as rightIcon,
12
+ // Left as leftIcon,
13
+ // Down as downIcon,
14
+ // Up as upIcon,
15
+ // } from '@tuya-miniapp/icons';
10
16
  var link_1 = require("../mixins/link");
11
17
  var component_1 = require("../common/component");
12
18
  (0, component_1.SmartComponent)({
@@ -32,12 +38,12 @@ var component_1 = require("../common/component");
32
38
  },
33
39
  data: {
34
40
  arrowIcons: {
35
- up: Up_1.default,
36
- down: Down_1.default,
37
- left: Left_1.default,
38
- right: Right_1.default,
41
+ up: Up_js_1.default,
42
+ down: Down_js_1.default,
43
+ left: Left_js_1.default,
44
+ right: Right_js_1.default,
39
45
  },
40
- arrowIcon: Right_1.default,
46
+ arrowIcon: Right_js_1.default,
41
47
  },
42
48
  methods: {
43
49
  onClick: function (event) {
@@ -9,12 +9,14 @@ var toast_1 = __importDefault(require("../../toast/toast"));
9
9
  data: {
10
10
  minHour: 10,
11
11
  maxHour: 20,
12
+ columnsOrder: [2, 1, 1],
12
13
  minDate: new Date(2018, 0, 1).getTime(),
13
14
  maxDate: new Date(2019, 10, 1).getTime(),
14
15
  currentDate1: new Date(2018, 2, 31).getTime(),
15
16
  currentDate2: null,
16
17
  currentDate3: new Date(2018, 0, 1),
17
18
  currentDate4: '12:00',
19
+ currentDate5: '11:00',
18
20
  loading: false,
19
21
  formatterMap: {
20
22
  year: '{{year}}年',
@@ -71,6 +71,18 @@ var defaultFormatter = function (type, value) {
71
71
  }, formatter: {
72
72
  type: null,
73
73
  value: defaultFormatter,
74
+ }, AMText: {
75
+ type: String,
76
+ value: 'AM',
77
+ }, PMText: {
78
+ type: String,
79
+ value: 'PM',
80
+ }, columnsOrder: {
81
+ type: Array,
82
+ value: [],
83
+ }, is12HoursTime: {
84
+ type: Boolean,
85
+ value: false,
74
86
  }, minDate: {
75
87
  type: Number,
76
88
  value: new Date(currentYear - 10, 0, 1).getTime(),
@@ -100,6 +112,7 @@ var defaultFormatter = function (type, value) {
100
112
  value: undefined,
101
113
  } }),
102
114
  data: {
115
+ part: 0,
103
116
  innerValue: Date.now(),
104
117
  columns: [],
105
118
  },
@@ -130,16 +143,16 @@ var defaultFormatter = function (type, value) {
130
143
  }
131
144
  return this.picker;
132
145
  },
133
- formatterFunc: function (type, value) {
146
+ formatterFunc: function (type, value, data) {
134
147
  var _a;
135
- var _b;
136
- var _c = this.data, formatterMap = _c.formatterMap, _d = _c.formatter, formatter = _d === void 0 ? defaultFormatter : _d;
148
+ var _b, _c;
149
+ var _d = (_b = this === null || this === void 0 ? void 0 : this.data) !== null && _b !== void 0 ? _b : data, formatterMap = _d.formatterMap, _e = _d.formatter, formatter = _e === void 0 ? defaultFormatter : _e;
137
150
  var mapDetail = formatterMap === null || formatterMap === void 0 ? void 0 : formatterMap[type];
138
151
  if (typeof mapDetail === 'string') {
139
152
  return (0, utils_1.replacePlaceholders)(mapDetail, (_a = {}, _a[type] = value, _a));
140
153
  }
141
154
  if (typeof mapDetail === 'object') {
142
- return (_b = mapDetail[value]) !== null && _b !== void 0 ? _b : formatter(type, value);
155
+ return (_c = mapDetail[value]) !== null && _c !== void 0 ? _c : formatter(type, value);
143
156
  }
144
157
  return formatter(type, value);
145
158
  },
@@ -147,15 +160,17 @@ var defaultFormatter = function (type, value) {
147
160
  var _this = this;
148
161
  var locale = this.data.locale;
149
162
  var results = this.getOriginColumns().map(function (column) { return ({
150
- values: column.values.map(function (value) { return _this.formatterFunc(column.type, value); }),
163
+ values: column.values.map(function (value) { return _this.formatterFunc(column.type, value, _this.data); }),
164
+ order: column.order,
151
165
  unit: locale === null || locale === void 0 ? void 0 : locale[column.type],
152
166
  }); });
153
167
  return this.set({ columns: results });
154
168
  },
155
169
  getOriginColumns: function () {
156
- var filter = this.data.filter;
157
- var results = this.getRanges().map(function (_a) {
170
+ var _a = this.data, filter = _a.filter, is12HoursTime = _a.is12HoursTime, type = _a.type, AMText = _a.AMText, PMText = _a.PMText, columnsOrder = _a.columnsOrder;
171
+ var results = this.getRanges().map(function (_a, index) {
158
172
  var type = _a.type, range = _a.range;
173
+ var order = columnsOrder[index];
159
174
  var values = times(range[1] - range[0] + 1, function (index) {
160
175
  var value = range[0] + index;
161
176
  return type === 'year' ? "".concat(value) : padZero(value);
@@ -163,12 +178,37 @@ var defaultFormatter = function (type, value) {
163
178
  if (filter) {
164
179
  values = filter(type, values);
165
180
  }
166
- return { type: type, values: values };
181
+ return { type: type, values: values, order: order };
167
182
  });
183
+ if (is12HoursTime && type === 'time') {
184
+ return __spreadArray([
185
+ {
186
+ type: '12hours',
187
+ values: [AMText, PMText],
188
+ order: columnsOrder[0],
189
+ }
190
+ ], results.map(function (item, index) { return (__assign(__assign({}, item), { order: columnsOrder[index + 1] })); }), true).filter(Boolean);
191
+ }
168
192
  return results;
169
193
  },
170
194
  getRanges: function () {
171
195
  var data = this.data;
196
+ if (data.type === 'time' && data.is12HoursTime) {
197
+ var part = data.part;
198
+ return [
199
+ {
200
+ type: 'hour',
201
+ range: [
202
+ Math.max(part ? 13 : 1, data.minHour) - (part ? 12 : 0),
203
+ Math.min(part ? 24 : 12, data.maxHour) - (part ? 12 : 0),
204
+ ],
205
+ },
206
+ {
207
+ type: 'minute',
208
+ range: [data.minMinute, data.maxMinute],
209
+ },
210
+ ];
211
+ }
172
212
  if (data.type === 'time') {
173
213
  return [
174
214
  {
@@ -280,14 +320,26 @@ var defaultFormatter = function (type, value) {
280
320
  var data = this.data;
281
321
  var value;
282
322
  var picker = this.getPicker();
283
- var originColumns = this.getOriginColumns();
284
- if (data.type === 'time') {
285
- var indexes = picker.getIndexes();
323
+ var indexes = picker.getIndexes();
324
+ if (data.type === 'time' && data.is12HoursTime) {
325
+ var part = indexes[0], hour = indexes[1], minute = indexes[2];
326
+ this.setData({
327
+ part: part,
328
+ });
329
+ var originColumns = this.getOriginColumns();
330
+ value = "".concat((part ? 12 : 0) +
331
+ Number(originColumns[1].values[hour > originColumns[1].values.length - 1 ? originColumns[1].values.length - 1 : hour]), ":").concat(Number(originColumns[2].values[minute > originColumns[2].values.length - 1
332
+ ? originColumns[2].values.length - 1
333
+ : minute]));
334
+ }
335
+ else if (data.type === 'time') {
336
+ var originColumns = this.getOriginColumns();
286
337
  value = "".concat(+originColumns[0].values[indexes[0]], ":").concat(+originColumns[1].values[indexes[1]]);
287
338
  }
288
339
  else {
289
- var indexes = picker.getIndexes();
290
- var values = indexes.map(function (value, index) { return originColumns[index].values[value]; });
340
+ var originColumns_1 = this.getOriginColumns();
341
+ var indexes_1 = picker.getIndexes();
342
+ var values = indexes_1.map(function (value, index) { return originColumns_1[index].values[value]; });
291
343
  var year = getTrueValue(values[0]);
292
344
  var month = getTrueValue(values[1]);
293
345
  var maxDate = getMonthEndDay(year, month);
@@ -313,24 +365,36 @@ var defaultFormatter = function (type, value) {
313
365
  updateColumnValue: function (value) {
314
366
  var _this = this;
315
367
  var values = [];
316
- var type = this.data.type;
368
+ var _a = this.data, type = _a.type, is12HoursTime = _a.is12HoursTime;
317
369
  var formatter = this.formatterFunc;
318
370
  var picker = this.getPicker();
319
- if (type === 'time') {
371
+ if (type === 'time' && is12HoursTime) {
372
+ var _b = value.split(':'), hour = _b[0], minute = _b[1];
373
+ var part = Number(hour) > 0 && Number(hour) < 13 ? 0 : 1;
374
+ this.setData({
375
+ part: part,
376
+ });
377
+ values = [
378
+ part,
379
+ formatter('hour', part ? (!hour ? 12 : hour - 12) : hour, this.data),
380
+ formatter('minute', minute, this.data),
381
+ ];
382
+ }
383
+ else if (type === 'time') {
320
384
  var pair = value.split(':');
321
- values = [formatter('hour', pair[0]), formatter('minute', pair[1])];
385
+ values = [formatter('hour', pair[0], this.data), formatter('minute', pair[1], this.data)];
322
386
  }
323
387
  else {
324
388
  var date = new Date(value);
325
389
  values = [
326
- formatter('year', "".concat(date.getFullYear())),
327
- formatter('month', padZero(date.getMonth() + 1)),
390
+ formatter('year', "".concat(date.getFullYear()), this.data),
391
+ formatter('month', padZero(date.getMonth() + 1), this.data),
328
392
  ];
329
393
  if (type === 'date') {
330
- values.push(formatter('day', padZero(date.getDate())));
394
+ values.push(formatter('day', padZero(date.getDate()), this.data));
331
395
  }
332
396
  if (type === 'datetime') {
333
- values.push(formatter('day', padZero(date.getDate())), formatter('hour', padZero(date.getHours())), formatter('minute', padZero(date.getMinutes())));
397
+ values.push(formatter('day', padZero(date.getDate()), this.data), formatter('hour', padZero(date.getHours()), this.data), formatter('minute', padZero(date.getMinutes()), this.data));
334
398
  }
335
399
  }
336
400
  return this.set({ innerValue: value })
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var utils_1 = require("../common/utils");
18
18
  var component_1 = require("../common/component");
19
19
  var props_1 = require("./props");
20
- var Xmark_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Xmark"));
20
+ var Xmark_js_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Xmark.js"));
21
21
  (0, component_1.SmartComponent)({
22
22
  field: true,
23
23
  classes: ['input-class', 'right-icon-class', 'label-class'],
@@ -40,7 +40,7 @@ var Xmark_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Xmark"));
40
40
  value: '6.2em',
41
41
  }, clearIcon: {
42
42
  type: String,
43
- value: Xmark_1.default,
43
+ value: Xmark_js_1.default,
44
44
  }, extraEventParams: {
45
45
  type: Boolean,
46
46
  value: false,
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var component_1 = require("../common/component");
7
7
  var utils_1 = require("../common/utils");
8
- var Xmark_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Xmark"));
8
+ var Xmark_js_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Xmark.js"));
9
9
  var Right_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Right"));
10
10
  (0, component_1.SmartComponent)({
11
11
  props: {
@@ -83,7 +83,7 @@ var Right_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Right"));
83
83
  wrapable: Boolean,
84
84
  },
85
85
  data: {
86
- Xmark: Xmark_1.default,
86
+ Xmark: Xmark_js_1.default,
87
87
  Right: Right_1.default,
88
88
  show: true,
89
89
  },
@@ -19,7 +19,7 @@
19
19
  data-index="{{ index }}"
20
20
  custom-class="column-class"
21
21
  value-key="{{ valueKey }}"
22
- style="{{ item.style }}"
22
+ style="order: {{ item.order }}; {{ computed.style(item.style) }}"
23
23
  active-style="{{ activeStyle }}"
24
24
  options="{{ item.values }}"
25
25
  unit="{{ item.unit || unit }}"
@@ -39,4 +39,5 @@ module.exports = {
39
39
  frameStyle: frameStyle,
40
40
  maskStyle: maskStyle,
41
41
  columns: columns,
42
+ style: style
42
43
  };
@@ -160,6 +160,8 @@ function equal(value1, value2) {
160
160
  var value = this.format(add(+this.data.currentValue, diff));
161
161
  this.emitChange(value);
162
162
  this.$emit(type);
163
+ // @ts-ignore
164
+ ty.vibrateShort({ type: 'light' });
163
165
  },
164
166
  longPressStep: function () {
165
167
  var _this = this;
package/lib/tag/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var Xmark_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Xmark"));
6
+ var Xmark_js_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Xmark.js"));
7
7
  var component_1 = require("../common/component");
8
8
  (0, component_1.SmartComponent)({
9
9
  props: {
@@ -23,7 +23,7 @@ var component_1 = require("../common/component");
23
23
  closeable: Boolean,
24
24
  },
25
25
  data: {
26
- crossIcon: Xmark_1.default,
26
+ crossIcon: Xmark_js_1.default,
27
27
  closeColor: '#fff',
28
28
  },
29
29
  methods: {
package/lib/wxs/style.wxs CHANGED
@@ -13,6 +13,10 @@ function kebabCase(word) {
13
13
  }
14
14
 
15
15
  function style(styles) {
16
+ if (typeof styles === 'string') {
17
+ return styles
18
+ }
19
+
16
20
  if (array.isArray(styles)) {
17
21
  return styles
18
22
  .filter(function (item) {
@@ -24,7 +28,7 @@ function style(styles) {
24
28
  .join(';');
25
29
  }
26
30
 
27
- if ('Object' === styles.constructor) {
31
+ if (typeof styles === 'object' && 'Object' === styles.constructor) {
28
32
  return object
29
33
  .keys(styles)
30
34
  .filter(function (key) {
@@ -35,9 +39,6 @@ function style(styles) {
35
39
  })
36
40
  .join(';');
37
41
  }
38
- if (typeof styles === 'string') {
39
- return styles
40
- }
41
42
 
42
43
  return styles || '';
43
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.1.11-beta-1",
3
+ "version": "2.1.11-beta-3",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",