@tuya-miniapp/smart-ui 2.1.10 → 2.1.11-beta-2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/dist/action-sheet/index.css +1 -1
  2. package/dist/action-sheet/index.js +0 -8
  3. package/dist/action-sheet/index.wxml +1 -1
  4. package/dist/action-sheet/index.wxss +1 -1
  5. package/dist/cell/index.js +10 -4
  6. package/dist/common/utils.d.ts +1 -0
  7. package/dist/common/utils.js +6 -0
  8. package/dist/datetime-picker/demo/index.js +20 -0
  9. package/dist/datetime-picker/index.js +92 -14
  10. package/dist/datetime-picker/index.wxml +1 -0
  11. package/dist/field/index.js +1 -1
  12. package/dist/icon/index.wxs +3 -1
  13. package/dist/notice-bar/index.js +1 -1
  14. package/dist/picker/demo/index.js +1 -0
  15. package/dist/picker/index.wxml +2 -1
  16. package/dist/picker/shared.d.ts +4 -0
  17. package/dist/picker/shared.js +4 -0
  18. package/dist/picker-column/index.css +1 -1
  19. package/dist/picker-column/index.js +154 -44
  20. package/dist/picker-column/index.wxml +22 -11
  21. package/dist/picker-column/index.wxs +22 -5
  22. package/dist/picker-column/index.wxss +1 -1
  23. package/dist/stepper/index.js +2 -0
  24. package/dist/tag/index.js +1 -1
  25. package/lib/action-sheet/index.css +1 -1
  26. package/lib/action-sheet/index.js +0 -8
  27. package/lib/action-sheet/index.wxml +1 -1
  28. package/lib/action-sheet/index.wxss +1 -1
  29. package/lib/cell/index.js +15 -9
  30. package/lib/common/utils.d.ts +1 -0
  31. package/lib/common/utils.js +8 -1
  32. package/lib/datetime-picker/demo/index.js +20 -0
  33. package/lib/datetime-picker/index.js +97 -18
  34. package/lib/datetime-picker/index.wxml +1 -0
  35. package/lib/field/index.js +2 -2
  36. package/lib/icon/index.wxs +3 -1
  37. package/lib/notice-bar/index.js +2 -2
  38. package/lib/picker/demo/index.js +1 -0
  39. package/lib/picker/index.wxml +2 -1
  40. package/lib/picker/shared.d.ts +4 -0
  41. package/lib/picker/shared.js +4 -0
  42. package/lib/picker-column/index.css +1 -1
  43. package/lib/picker-column/index.js +192 -44
  44. package/lib/picker-column/index.wxml +22 -11
  45. package/lib/picker-column/index.wxs +22 -5
  46. package/lib/picker-column/index.wxss +1 -1
  47. package/lib/stepper/index.js +2 -0
  48. package/lib/tag/index.js +2 -2
  49. package/package.json +3 -3
@@ -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({
@@ -19,3 +19,4 @@ export declare const clamp: (num: any, min: any, max: any) => number;
19
19
  export declare function getCurrentPage<T>(): T & WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> & WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> & WechatMiniprogram.IAnyObject;
20
20
  export declare const isPC: boolean;
21
21
  export declare const isWxWork: boolean;
22
+ export declare function replacePlaceholders(template: any, values: any): any;
@@ -84,3 +84,9 @@ export function getCurrentPage() {
84
84
  export const isPC = ['mac', 'windows'].includes(getSystemInfoSync().platform);
85
85
  // 是否企业微信
86
86
  export const isWxWork = getSystemInfoSync().environment === 'wxwork';
87
+ export function replacePlaceholders(template, values) {
88
+ // 使用正则表达式匹配占位符
89
+ return template.replace(/{{(.*?)}}/g, (match, key) => {
90
+ return values[key] || match; // 如果在values中找到key对应的值,则替换;否则保留原样
91
+ });
92
+ }
@@ -4,13 +4,33 @@ 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,
16
+ formatterMap: {
17
+ year: '{{year}}年',
18
+ month: {
19
+ '01': 'January',
20
+ '02': 'February',
21
+ '03': 'March',
22
+ '04': 'April',
23
+ '05': 'May',
24
+ '06': 'June',
25
+ '07': 'July',
26
+ '08': 'August',
27
+ '09': 'September',
28
+ '10': 'October',
29
+ '11': 'November',
30
+ '12': 'December',
31
+ },
32
+ day: '{{day}}日'
33
+ },
14
34
  formatter(type, value) {
15
35
  if (type === 'year') {
16
36
  return `${value}${I18n.t('year')}`;
@@ -1,13 +1,11 @@
1
1
  import { SmartComponent } from '../common/component';
2
2
  import { isDef } from '../common/validator';
3
3
  import { pickerProps } from '../picker/shared';
4
+ import { range, replacePlaceholders } from '../common/utils';
4
5
  const currentYear = new Date().getFullYear();
5
6
  function isValidDate(date) {
6
7
  return isDef(date) && !isNaN(new Date(date).getTime());
7
8
  }
8
- function range(num, min, max) {
9
- return Math.min(Math.max(num, min), max);
10
- }
11
9
  function padZero(val) {
12
10
  return `00${val}`.slice(-2);
13
11
  }
@@ -49,6 +47,18 @@ SmartComponent({
49
47
  }, formatter: {
50
48
  type: null,
51
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,
52
62
  }, minDate: {
53
63
  type: Number,
54
64
  value: new Date(currentYear - 10, 0, 1).getTime(),
@@ -73,8 +83,12 @@ SmartComponent({
73
83
  type: Number,
74
84
  value: 59,
75
85
  observer: 'updateValue',
86
+ }, formatterMap: {
87
+ type: Object,
88
+ value: undefined,
76
89
  } }),
77
90
  data: {
91
+ part: 0,
78
92
  innerValue: Date.now(),
79
93
  columns: [],
80
94
  },
@@ -98,17 +112,31 @@ SmartComponent({
98
112
  }
99
113
  return this.picker;
100
114
  },
115
+ formatterFunc(type, value) {
116
+ var _a;
117
+ const { formatterMap, formatter = defaultFormatter } = this.data;
118
+ const mapDetail = formatterMap === null || formatterMap === void 0 ? void 0 : formatterMap[type];
119
+ if (typeof mapDetail === 'string') {
120
+ return replacePlaceholders(mapDetail, { [type]: value });
121
+ }
122
+ if (typeof mapDetail === 'object') {
123
+ return (_a = mapDetail[value]) !== null && _a !== void 0 ? _a : formatter(type, value);
124
+ }
125
+ return formatter(type, value);
126
+ },
101
127
  updateColumns() {
102
- const { formatter = defaultFormatter, locale } = this.data;
128
+ const { locale } = this.data;
103
129
  const results = this.getOriginColumns().map(column => ({
104
- values: column.values.map(value => formatter(column.type, value)),
130
+ values: column.values.map(value => this.formatterFunc(column.type, value)),
131
+ order: column.order,
105
132
  unit: locale === null || locale === void 0 ? void 0 : locale[column.type],
106
133
  }));
107
134
  return this.set({ columns: results });
108
135
  },
109
136
  getOriginColumns() {
110
- const { filter } = this.data;
111
- 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];
112
140
  let values = times(range[1] - range[0] + 1, index => {
113
141
  const value = range[0] + index;
114
142
  return type === 'year' ? `${value}` : padZero(value);
@@ -116,12 +144,38 @@ SmartComponent({
116
144
  if (filter) {
117
145
  values = filter(type, values);
118
146
  }
119
- return { type, values };
147
+ return { type, values, order };
120
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
+ }
121
159
  return results;
122
160
  },
123
161
  getRanges() {
124
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
+ }
125
179
  if (data.type === 'time') {
126
180
  return [
127
181
  {
@@ -231,12 +285,24 @@ SmartComponent({
231
285
  const { data } = this;
232
286
  let value;
233
287
  const picker = this.getPicker();
234
- const originColumns = this.getOriginColumns();
235
- if (data.type === 'time') {
236
- 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();
237
302
  value = `${+originColumns[0].values[indexes[0]]}:${+originColumns[1].values[indexes[1]]}`;
238
303
  }
239
304
  else {
305
+ const originColumns = this.getOriginColumns();
240
306
  const indexes = picker.getIndexes();
241
307
  const values = indexes.map((value, index) => originColumns[index].values[value]);
242
308
  const year = getTrueValue(values[0]);
@@ -263,10 +329,22 @@ SmartComponent({
263
329
  },
264
330
  updateColumnValue(value) {
265
331
  let values = [];
266
- const { type } = this.data;
267
- const formatter = this.data.formatter || defaultFormatter;
332
+ const { type, is12HoursTime } = this.data;
333
+ const formatter = this.formatterFunc;
268
334
  const picker = this.getPicker();
269
- 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),
344
+ formatter('minute', minute),
345
+ ];
346
+ }
347
+ else if (type === 'time') {
270
348
  const pair = value.split(':');
271
349
  values = [formatter('hour', pair[0]), formatter('minute', pair[1])];
272
350
  }
@@ -10,6 +10,7 @@
10
10
  visible-item-count="{{ visibleItemCount }}"
11
11
  confirm-button-text="{{ confirmButtonText }}"
12
12
  cancel-button-text="{{ cancelButtonText }}"
13
+ change-animation="{{ changeAnimation }}"
13
14
  bind:change="onChange"
14
15
  bind:confirm="onConfirm"
15
16
  bind:cancel="onCancel"
@@ -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'],
@@ -14,7 +14,7 @@ function rootClass(data) {
14
14
  var classes = ['custom-class'];
15
15
 
16
16
  if (data.classPrefix !== 'smart-icon') {
17
- classes.push('smart-icon--custom')
17
+ classes.push('smart-icon--custom');
18
18
  }
19
19
 
20
20
  if (data.classPrefix != null) {
@@ -54,6 +54,8 @@ function svgStyle(data) {
54
54
  {
55
55
  '-webkit-mask-image': imageBase64Src,
56
56
  '-webkit-mask-size': 'contain',
57
+ '-webkit-mask-repeat': 'no-repeat',
58
+ '-webkit-mask-position': 'center',
57
59
  'mask-image': imageBase64Src,
58
60
  'mask-size': 'contain',
59
61
  width: data.size,
@@ -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: {
@@ -45,6 +45,7 @@ SmartComponent({
45
45
  methods: {
46
46
  onChange1(event) {
47
47
  const { value, index } = event.detail;
48
+ console.log(`Value: ${value}, Index:${index}`);
48
49
  Toast({
49
50
  context: this,
50
51
  message: `Value: ${value}, Index:${index}`,
@@ -19,10 +19,11 @@
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 }}; {{ item.style }}"
23
23
  active-style="{{ activeStyle }}"
24
24
  options="{{ item.values }}"
25
25
  unit="{{ item.unit || unit }}"
26
+ changeAnimation="{{ changeAnimation }}"
26
27
  default-index="{{ item.defaultIndex || defaultIndex }}"
27
28
  active-index="{{ item.activeIndex || activeIndex }}"
28
29
  item-height="{{ itemHeight }}"
@@ -18,4 +18,8 @@ export declare const pickerProps: {
18
18
  type: NumberConstructor;
19
19
  value: number;
20
20
  };
21
+ changeAnimation: {
22
+ type: BooleanConstructor;
23
+ value: boolean;
24
+ };
21
25
  };
@@ -18,4 +18,8 @@ export const pickerProps = {
18
18
  type: Number,
19
19
  value: 44,
20
20
  },
21
+ changeAnimation: {
22
+ type: Boolean,
23
+ value: true,
24
+ },
21
25
  };
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-picker-column{color:var(--picker-option-selected-text-color,var(--app-B6-N1,#000));font-size:var(--picker-option-font-size,16px);font-weight:var(--font-weight-bold,500);position:relative;text-align:center}.smart-picker-column__item{padding:0 5px}.smart-picker-column__item--selected{color:var(--picker-option-selected-text-color,var(--app-B6-N1,#000));font-weight:var(--font-weight-bold,500)}.smart-picker-column__item--disabled{opacity:var(--picker-option-disabled-opacity,.3)}.smart-picker-column__unit{align-items:center;display:flex;justify-content:center;position:absolute;top:50%;transform:translateY(-50%);width:100%}.smart-picker-column__unit_text{color:var(--picker-option-unit-text-color,var(--app-B6-N4,rgba(0,0,0,.4)));font-size:var(--picker-option-unit-font-size,12px)}.smart-picker-column__unit_hidden{opacity:0}.smart-picker-column__max-text{font-weight:var(--font-weight-bold,500);opacity:0}
1
+ @import '../common/index.css';.smart-picker-column{color:var(--picker-option-selected-text-color,var(--app-B6-N1,#000));font-size:var(--picker-option-font-size,16px);font-weight:var(--font-weight-bold,500);text-align:center}.smart-picker-column,.smart-picker-column__offset{position:relative;width:100%}.smart-picker-column__visual{position:absolute;top:0;width:100%}.smart-picker-column__item{pointer-events:none}.smart-picker-column__item--selected{color:var(--picker-option-selected-text-color,var(--app-B6-N1,#000));font-weight:var(--font-weight-bold,500)}.smart-picker-column__item--disabled{opacity:var(--picker-option-disabled-opacity,.3)}.smart-picker-column__mask{background:transparent;display:flex;flex-direction:column;height:100%;position:absolute;top:0;width:100%;z-index:10}.smart-picker-column__mask__item{flex:1}.smart-picker-column__unit{align-items:center;display:flex;justify-content:center;position:absolute;top:50%;transform:translateY(-50%);width:100%}.smart-picker-column__unit_text{color:var(--picker-option-unit-text-color,var(--app-B6-N4,rgba(0,0,0,.4)));font-size:var(--picker-option-unit-font-size,12px)}.smart-picker-column__unit_hidden{opacity:0}.smart-picker-column__max-text{font-weight:var(--font-weight-bold,500);opacity:0}