@tuya-miniapp/smart-ui 2.4.1-beta-1 → 2.4.1-beta-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ SmartComponent({
11
11
  confirmText: String,
12
12
  description: String,
13
13
  activeColor: String,
14
+ nativeDisabled: Boolean,
14
15
  round: {
15
16
  type: Boolean,
16
17
  value: true,
@@ -6,6 +6,7 @@
6
6
  round="{{ round }}"
7
7
  z-index="{{ zIndex }}"
8
8
  overlay="{{ overlay }}"
9
+ native-disabled="{{ nativeDisabled }}"
9
10
  custom-class="smart-action-sheet custom-class"
10
11
  safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
11
12
  safe-area-inset-bottom-min="{{ safeAreaInsetBottomMin }}"
@@ -5,6 +5,7 @@ SmartComponent({
5
5
  show: Boolean,
6
6
  title: String,
7
7
  iconColor: String,
8
+ nativeDisabled: Boolean,
8
9
  iconSize: {
9
10
  type: null,
10
11
  value: 24,
@@ -7,6 +7,7 @@
7
7
  z-index="{{ zIndex }}"
8
8
  overlay="{{ overlay }}"
9
9
  custom-class="smart-bottom-sheet custom-class"
10
+ native-disabled="{{ nativeDisabled }}"
10
11
  safe-area-inset-bottom="{{false}}"
11
12
  close-on-click-overlay="{{ closeOnClickOverlay }}"
12
13
  root-portal="{{ rootPortal }}"
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));color:var(--calendar-text-color,#000);display:flex;flex-direction:column;height:auto}.smart-calendar__close-icon{top:11px}.smart-calendar__popup--bottom,.smart-calendar__popup--top{height:848rpx}.smart-calendar__popup--left,.smart-calendar__popup--right{height:100%}.smart-calendar-month{margin-top:0rpx}.smart-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.smart-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.smart-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.smart-calendar__footer+.smart-calendar__footer,.smart-calendar__footer:empty{display:none}.smart-calendar__footer:empty+.smart-calendar__footer{display:block!important}
1
+ @import '../common/index.css';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));color:var(--calendar-text-color,#000);display:flex;flex-direction:column;height:auto}.smart-calendar__close-icon{top:11px}.smart-calendar__popup--bottom,.smart-calendar__popup--top{height:var(--calendar-popup-height,848rpx)}.smart-calendar__popup--left,.smart-calendar__popup--right{height:100%}.smart-calendar-month{margin-top:0rpx}.smart-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.smart-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.smart-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.smart-calendar__footer+.smart-calendar__footer,.smart-calendar__footer:empty{display:none}.smart-calendar__footer:empty+.smart-calendar__footer{display:block!important}
@@ -1 +1 @@
1
- @import '../common/index.wxss';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));color:var(--calendar-text-color,#000);display:flex;flex-direction:column;height:auto}.smart-calendar__close-icon{top:11px}.smart-calendar__popup--bottom,.smart-calendar__popup--top{height:848rpx}.smart-calendar__popup--left,.smart-calendar__popup--right{height:100%}.smart-calendar-month{margin-top:0rpx}.smart-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.smart-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.smart-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.smart-calendar__footer+.smart-calendar__footer,.smart-calendar__footer:empty{display:none}.smart-calendar__footer:empty+.smart-calendar__footer{display:block!important}
1
+ @import '../common/index.wxss';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));color:var(--calendar-text-color,#000);display:flex;flex-direction:column;height:auto}.smart-calendar__close-icon{top:11px}.smart-calendar__popup--bottom,.smart-calendar__popup--top{height:var(--calendar-popup-height,848rpx)}.smart-calendar__popup--left,.smart-calendar__popup--right{height:100%}.smart-calendar-month{margin-top:0rpx}.smart-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.smart-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.smart-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.smart-calendar__footer+.smart-calendar__footer,.smart-calendar__footer:empty{display:none}.smart-calendar__footer:empty+.smart-calendar__footer{display:block!important}
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-switch{background-color:var(--switch-background-color,var(--app-B4-N6,rgba(0,0,0,.2)));border:var(--switch-border,.08em solid rgba(0,0,0,.1));border-color:transparent;border-radius:var(--switch-node-size,.867em);box-sizing:initial;display:inline-block;height:var(--switch-height,.867em);position:relative;transition:background-color var(--switch-transition-duration,.3s);vertical-align:middle;width:var(--switch-width,1.5338em)}.smart-switch__node{background-color:var(--switch-node-background-color,#fff);border-radius:100%;box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));height:var(--switch-node-size,.867em);left:0;position:absolute;top:0;transition:var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);width:var(--switch-node-size,.867em);z-index:var(--switch-node-z-index,1)}.smart-switch__loading{left:50%;position:absolute!important;top:50%;transform:translate(-50%,-50%)}.smart-switch--on{background-color:var(--switch-on-background-color,#1989fa)}.smart-switch--on .smart-switch__node{background-color:var(--switch-node-on-background-color,var(--switch-node-background-color,#fff));transform:translateX(calc(var(--switch-width, 1.5338em) - var(--switch-node-size, .867em)))}.smart-switch--disabled{opacity:var(--switch-disabled-opacity,.4)}
1
+ @import '../common/index.css';.smart-switch{background-color:var(--switch-background-color,var(--app-B4-N6,rgba(0,0,0,.2)));border-radius:var(--switch-node-size,.867em);height:var(--switch-height,.867em);padding:var(--switch-padding,.08em);transition:background-color var(--switch-transition-duration,.3s);vertical-align:middle;width:var(--switch-width,1.5338em)}.smart-switch,.smart-switch__center{box-sizing:initial;display:inline-block}.smart-switch__center{height:100%;position:relative;vertical-align:top;width:100%}.smart-switch__node{background-color:var(--switch-node-background-color,#fff);border-radius:100%;box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));height:var(--switch-node-size,.867em);left:0;position:absolute;top:0;transition:var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);width:var(--switch-node-size,.867em);z-index:var(--switch-node-z-index,1)}.smart-switch__loading{left:50%;position:absolute!important;top:50%;transform:translate(-50%,-50%)}.smart-switch--on{background-color:var(--switch-on-background-color,#1989fa)}.smart-switch--on .smart-switch__node{background-color:var(--switch-node-on-background-color,var(--switch-node-background-color,#fff));transform:translateX(calc(var(--switch-width, 1.5338em) - var(--switch-node-size, .867em)))}.smart-switch--disabled{opacity:var(--switch-disabled-opacity,.4)}
@@ -7,12 +7,14 @@
7
7
  style="{{ computed.rootStyle({ size, checked, activeColor, inactiveColor, activeValue }) }}"
8
8
  catch:tap="onClick"
9
9
  >
10
- <view class="smart-switch__node node-class">
11
- <smart-loading
12
- wx:if="{{ loading }}"
13
- color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
14
- custom-class="smart-switch__loading"
15
- />
10
+ <view class="smart-switch__center">
11
+ <view class="smart-switch__node node-class">
12
+ <smart-loading
13
+ wx:if="{{ loading }}"
14
+ color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
15
+ custom-class="smart-switch__loading"
16
+ />
17
+ </view>
16
18
  </view>
17
19
  </view>
18
20
  </block>
@@ -22,13 +24,15 @@
22
24
  style="{{ computed.rootStyle({ size, checked, activeColor, inactiveColor, activeValue }) }}"
23
25
  bind:tap="onClick"
24
26
  >
25
- <view class="smart-switch__node node-class">
26
- <smart-loading
27
- wx:if="{{ loading }}"
28
- color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
29
- custom-class="smart-switch__loading"
30
- size="{{size}}"
31
- />
27
+ <view class="smart-switch__center">
28
+ <view class="smart-switch__node node-class">
29
+ <smart-loading
30
+ wx:if="{{ loading }}"
31
+ color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
32
+ custom-class="smart-switch__loading"
33
+ size="{{size}}"
34
+ />
35
+ </view>
32
36
  </view>
33
37
  </view>
34
38
  </block>
@@ -7,7 +7,7 @@ function rootStyle(data) {
7
7
 
8
8
  return style({
9
9
  'font-size': addUnit(data.size),
10
- 'background-color': currentColor,
10
+ 'background': currentColor,
11
11
  });
12
12
  }
13
13
 
@@ -1 +1 @@
1
- @import '../common/index.wxss';.smart-switch{background-color:var(--switch-background-color,var(--app-B4-N6,rgba(0,0,0,.2)));border:var(--switch-border,.08em solid rgba(0,0,0,.1));border-color:transparent;border-radius:var(--switch-node-size,.867em);box-sizing:initial;display:inline-block;height:var(--switch-height,.867em);position:relative;transition:background-color var(--switch-transition-duration,.3s);vertical-align:middle;width:var(--switch-width,1.5338em)}.smart-switch__node{background-color:var(--switch-node-background-color,#fff);border-radius:100%;box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));height:var(--switch-node-size,.867em);left:0;position:absolute;top:0;transition:var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);width:var(--switch-node-size,.867em);z-index:var(--switch-node-z-index,1)}.smart-switch__loading{left:50%;position:absolute!important;top:50%;transform:translate(-50%,-50%)}.smart-switch--on{background-color:var(--switch-on-background-color,#1989fa)}.smart-switch--on .smart-switch__node{background-color:var(--switch-node-on-background-color,var(--switch-node-background-color,#fff));transform:translateX(calc(var(--switch-width, 1.5338em) - var(--switch-node-size, .867em)))}.smart-switch--disabled{opacity:var(--switch-disabled-opacity,.4)}
1
+ @import '../common/index.wxss';.smart-switch{background-color:var(--switch-background-color,var(--app-B4-N6,rgba(0,0,0,.2)));border-radius:var(--switch-node-size,.867em);height:var(--switch-height,.867em);padding:var(--switch-padding,.08em);transition:background-color var(--switch-transition-duration,.3s);vertical-align:middle;width:var(--switch-width,1.5338em)}.smart-switch,.smart-switch__center{box-sizing:initial;display:inline-block}.smart-switch__center{height:100%;position:relative;vertical-align:top;width:100%}.smart-switch__node{background-color:var(--switch-node-background-color,#fff);border-radius:100%;box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));height:var(--switch-node-size,.867em);left:0;position:absolute;top:0;transition:var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);width:var(--switch-node-size,.867em);z-index:var(--switch-node-z-index,1)}.smart-switch__loading{left:50%;position:absolute!important;top:50%;transform:translate(-50%,-50%)}.smart-switch--on{background-color:var(--switch-on-background-color,#1989fa)}.smart-switch--on .smart-switch__node{background-color:var(--switch-node-on-background-color,var(--switch-node-background-color,#fff));transform:translateX(calc(var(--switch-width, 1.5338em) - var(--switch-node-size, .867em)))}.smart-switch--disabled{opacity:var(--switch-disabled-opacity,.4)}
@@ -9,6 +9,7 @@ SmartComponent({
9
9
  mask: Boolean,
10
10
  message: String,
11
11
  forbidClick: Boolean,
12
+ nativeDisabled: Boolean,
12
13
  zIndex: {
13
14
  type: Number,
14
15
  value: 1000,
@@ -7,6 +7,7 @@ interface ToastOptions {
7
7
  type?: string;
8
8
  mask?: boolean;
9
9
  zIndex?: number;
10
+ nativeDisabled?: boolean;
10
11
  context?: (() => ToastContext) | ToastContext;
11
12
  position?: string;
12
13
  duration?: number;
@@ -15,8 +16,8 @@ interface ToastOptions {
15
16
  ignoreQueue?: boolean;
16
17
  loadingType?: string;
17
18
  message?: ToastMessage;
18
- onClose?: () => void;
19
19
  width?: number;
20
+ onClose?: () => void;
20
21
  }
21
22
  export declare const contextRef: {
22
23
  value: Record<string, ToastContext | null>;
@@ -4,6 +4,7 @@ import { isObj } from '../common/validator';
4
4
  const defaultOptions = {
5
5
  type: 'text',
6
6
  mask: false,
7
+ nativeDisabled: false,
7
8
  message: '',
8
9
  show: true,
9
10
  zIndex: 1000,
@@ -18,6 +19,9 @@ const defaultOptions = {
18
19
  const queueRef = {
19
20
  value: [],
20
21
  };
22
+ const preDisRef = {
23
+ value: {},
24
+ };
21
25
  // @ts-expect-error
22
26
  let currentOptions = Object.assign({}, defaultOptions);
23
27
  function parseOptions(message) {
@@ -27,6 +31,7 @@ export const contextRef = {
27
31
  value: {},
28
32
  };
29
33
  function Toast(toastOptions) {
34
+ var _a, _b;
30
35
  const options = Object.assign(Object.assign({}, currentOptions), parseOptions(toastOptions));
31
36
  appLog.info('start open Toast');
32
37
  const context = (typeof options.context === 'function' ? options.context() : options.context) ||
@@ -43,13 +48,28 @@ function Toast(toastOptions) {
43
48
  delete options.context;
44
49
  delete options.selector;
45
50
  toast.clear = () => {
51
+ var _a;
46
52
  toast.setData({ show: false });
53
+ if (options.nativeDisabled) {
54
+ // @ts-ignore
55
+ (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, false);
56
+ }
57
+ preDisRef.value[options.selector] = false;
47
58
  if (options.onClose) {
48
59
  options.onClose();
49
60
  }
50
61
  };
51
62
  queueRef.value.push(toast);
52
63
  toast.setData(options);
64
+ if (options.nativeDisabled) {
65
+ // @ts-ignore
66
+ (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, true);
67
+ }
68
+ if (preDisRef.value[options.selector] && !options.nativeDisabled) {
69
+ // @ts-ignore
70
+ (_b = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _b === void 0 ? void 0 : _b.call(ty, false);
71
+ }
72
+ preDisRef.value[options.selector] = options.nativeDisabled || false;
53
73
  clearTimeout(toast.timer);
54
74
  if (options.duration != null && options.duration > 0) {
55
75
  toast.timer = setTimeout(() => {
@@ -16,6 +16,7 @@ var button_1 = require("../mixins/button");
16
16
  confirmText: String,
17
17
  description: String,
18
18
  activeColor: String,
19
+ nativeDisabled: Boolean,
19
20
  round: {
20
21
  type: Boolean,
21
22
  value: true,
@@ -6,6 +6,7 @@
6
6
  round="{{ round }}"
7
7
  z-index="{{ zIndex }}"
8
8
  overlay="{{ overlay }}"
9
+ native-disabled="{{ nativeDisabled }}"
9
10
  custom-class="smart-action-sheet custom-class"
10
11
  safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
11
12
  safe-area-inset-bottom-min="{{ safeAreaInsetBottomMin }}"
@@ -10,6 +10,7 @@ var component_1 = require("../common/component");
10
10
  show: Boolean,
11
11
  title: String,
12
12
  iconColor: String,
13
+ nativeDisabled: Boolean,
13
14
  iconSize: {
14
15
  type: null,
15
16
  value: 24,
@@ -7,6 +7,7 @@
7
7
  z-index="{{ zIndex }}"
8
8
  overlay="{{ overlay }}"
9
9
  custom-class="smart-bottom-sheet custom-class"
10
+ native-disabled="{{ nativeDisabled }}"
10
11
  safe-area-inset-bottom="{{false}}"
11
12
  close-on-click-overlay="{{ closeOnClickOverlay }}"
12
13
  root-portal="{{ rootPortal }}"
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));color:var(--calendar-text-color,#000);display:flex;flex-direction:column;height:auto}.smart-calendar__close-icon{top:11px}.smart-calendar__popup--bottom,.smart-calendar__popup--top{height:848rpx}.smart-calendar__popup--left,.smart-calendar__popup--right{height:100%}.smart-calendar-month{margin-top:0rpx}.smart-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.smart-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.smart-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.smart-calendar__footer+.smart-calendar__footer,.smart-calendar__footer:empty{display:none}.smart-calendar__footer:empty+.smart-calendar__footer{display:block!important}
1
+ @import '../common/index.css';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));color:var(--calendar-text-color,#000);display:flex;flex-direction:column;height:auto}.smart-calendar__close-icon{top:11px}.smart-calendar__popup--bottom,.smart-calendar__popup--top{height:var(--calendar-popup-height,848rpx)}.smart-calendar__popup--left,.smart-calendar__popup--right{height:100%}.smart-calendar-month{margin-top:0rpx}.smart-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.smart-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.smart-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.smart-calendar__footer+.smart-calendar__footer,.smart-calendar__footer:empty{display:none}.smart-calendar__footer:empty+.smart-calendar__footer{display:block!important}
@@ -1 +1 @@
1
- @import '../common/index.wxss';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));color:var(--calendar-text-color,#000);display:flex;flex-direction:column;height:auto}.smart-calendar__close-icon{top:11px}.smart-calendar__popup--bottom,.smart-calendar__popup--top{height:848rpx}.smart-calendar__popup--left,.smart-calendar__popup--right{height:100%}.smart-calendar-month{margin-top:0rpx}.smart-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.smart-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.smart-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.smart-calendar__footer+.smart-calendar__footer,.smart-calendar__footer:empty{display:none}.smart-calendar__footer:empty+.smart-calendar__footer{display:block!important}
1
+ @import '../common/index.wxss';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));color:var(--calendar-text-color,#000);display:flex;flex-direction:column;height:auto}.smart-calendar__close-icon{top:11px}.smart-calendar__popup--bottom,.smart-calendar__popup--top{height:var(--calendar-popup-height,848rpx)}.smart-calendar__popup--left,.smart-calendar__popup--right{height:100%}.smart-calendar-month{margin-top:0rpx}.smart-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.smart-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.smart-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.smart-calendar__footer+.smart-calendar__footer,.smart-calendar__footer:empty{display:none}.smart-calendar__footer:empty+.smart-calendar__footer{display:block!important}
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-switch{background-color:var(--switch-background-color,var(--app-B4-N6,rgba(0,0,0,.2)));border:var(--switch-border,.08em solid rgba(0,0,0,.1));border-color:transparent;border-radius:var(--switch-node-size,.867em);box-sizing:initial;display:inline-block;height:var(--switch-height,.867em);position:relative;transition:background-color var(--switch-transition-duration,.3s);vertical-align:middle;width:var(--switch-width,1.5338em)}.smart-switch__node{background-color:var(--switch-node-background-color,#fff);border-radius:100%;box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));height:var(--switch-node-size,.867em);left:0;position:absolute;top:0;transition:var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);width:var(--switch-node-size,.867em);z-index:var(--switch-node-z-index,1)}.smart-switch__loading{left:50%;position:absolute!important;top:50%;transform:translate(-50%,-50%)}.smart-switch--on{background-color:var(--switch-on-background-color,#1989fa)}.smart-switch--on .smart-switch__node{background-color:var(--switch-node-on-background-color,var(--switch-node-background-color,#fff));transform:translateX(calc(var(--switch-width, 1.5338em) - var(--switch-node-size, .867em)))}.smart-switch--disabled{opacity:var(--switch-disabled-opacity,.4)}
1
+ @import '../common/index.css';.smart-switch{background-color:var(--switch-background-color,var(--app-B4-N6,rgba(0,0,0,.2)));border-radius:var(--switch-node-size,.867em);height:var(--switch-height,.867em);padding:var(--switch-padding,.08em);transition:background-color var(--switch-transition-duration,.3s);vertical-align:middle;width:var(--switch-width,1.5338em)}.smart-switch,.smart-switch__center{box-sizing:initial;display:inline-block}.smart-switch__center{height:100%;position:relative;vertical-align:top;width:100%}.smart-switch__node{background-color:var(--switch-node-background-color,#fff);border-radius:100%;box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));height:var(--switch-node-size,.867em);left:0;position:absolute;top:0;transition:var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);width:var(--switch-node-size,.867em);z-index:var(--switch-node-z-index,1)}.smart-switch__loading{left:50%;position:absolute!important;top:50%;transform:translate(-50%,-50%)}.smart-switch--on{background-color:var(--switch-on-background-color,#1989fa)}.smart-switch--on .smart-switch__node{background-color:var(--switch-node-on-background-color,var(--switch-node-background-color,#fff));transform:translateX(calc(var(--switch-width, 1.5338em) - var(--switch-node-size, .867em)))}.smart-switch--disabled{opacity:var(--switch-disabled-opacity,.4)}
@@ -7,12 +7,14 @@
7
7
  style="{{ computed.rootStyle({ size, checked, activeColor, inactiveColor, activeValue }) }}"
8
8
  catch:tap="onClick"
9
9
  >
10
- <view class="smart-switch__node node-class">
11
- <smart-loading
12
- wx:if="{{ loading }}"
13
- color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
14
- custom-class="smart-switch__loading"
15
- />
10
+ <view class="smart-switch__center">
11
+ <view class="smart-switch__node node-class">
12
+ <smart-loading
13
+ wx:if="{{ loading }}"
14
+ color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
15
+ custom-class="smart-switch__loading"
16
+ />
17
+ </view>
16
18
  </view>
17
19
  </view>
18
20
  </block>
@@ -22,13 +24,15 @@
22
24
  style="{{ computed.rootStyle({ size, checked, activeColor, inactiveColor, activeValue }) }}"
23
25
  bind:tap="onClick"
24
26
  >
25
- <view class="smart-switch__node node-class">
26
- <smart-loading
27
- wx:if="{{ loading }}"
28
- color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
29
- custom-class="smart-switch__loading"
30
- size="{{size}}"
31
- />
27
+ <view class="smart-switch__center">
28
+ <view class="smart-switch__node node-class">
29
+ <smart-loading
30
+ wx:if="{{ loading }}"
31
+ color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
32
+ custom-class="smart-switch__loading"
33
+ size="{{size}}"
34
+ />
35
+ </view>
32
36
  </view>
33
37
  </view>
34
38
  </block>
@@ -7,7 +7,7 @@ function rootStyle(data) {
7
7
 
8
8
  return style({
9
9
  'font-size': addUnit(data.size),
10
- 'background-color': currentColor,
10
+ 'background': currentColor,
11
11
  });
12
12
  }
13
13
 
@@ -1 +1 @@
1
- @import '../common/index.wxss';.smart-switch{background-color:var(--switch-background-color,var(--app-B4-N6,rgba(0,0,0,.2)));border:var(--switch-border,.08em solid rgba(0,0,0,.1));border-color:transparent;border-radius:var(--switch-node-size,.867em);box-sizing:initial;display:inline-block;height:var(--switch-height,.867em);position:relative;transition:background-color var(--switch-transition-duration,.3s);vertical-align:middle;width:var(--switch-width,1.5338em)}.smart-switch__node{background-color:var(--switch-node-background-color,#fff);border-radius:100%;box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));height:var(--switch-node-size,.867em);left:0;position:absolute;top:0;transition:var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);width:var(--switch-node-size,.867em);z-index:var(--switch-node-z-index,1)}.smart-switch__loading{left:50%;position:absolute!important;top:50%;transform:translate(-50%,-50%)}.smart-switch--on{background-color:var(--switch-on-background-color,#1989fa)}.smart-switch--on .smart-switch__node{background-color:var(--switch-node-on-background-color,var(--switch-node-background-color,#fff));transform:translateX(calc(var(--switch-width, 1.5338em) - var(--switch-node-size, .867em)))}.smart-switch--disabled{opacity:var(--switch-disabled-opacity,.4)}
1
+ @import '../common/index.wxss';.smart-switch{background-color:var(--switch-background-color,var(--app-B4-N6,rgba(0,0,0,.2)));border-radius:var(--switch-node-size,.867em);height:var(--switch-height,.867em);padding:var(--switch-padding,.08em);transition:background-color var(--switch-transition-duration,.3s);vertical-align:middle;width:var(--switch-width,1.5338em)}.smart-switch,.smart-switch__center{box-sizing:initial;display:inline-block}.smart-switch__center{height:100%;position:relative;vertical-align:top;width:100%}.smart-switch__node{background-color:var(--switch-node-background-color,#fff);border-radius:100%;box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));height:var(--switch-node-size,.867em);left:0;position:absolute;top:0;transition:var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);width:var(--switch-node-size,.867em);z-index:var(--switch-node-z-index,1)}.smart-switch__loading{left:50%;position:absolute!important;top:50%;transform:translate(-50%,-50%)}.smart-switch--on{background-color:var(--switch-on-background-color,#1989fa)}.smart-switch--on .smart-switch__node{background-color:var(--switch-node-on-background-color,var(--switch-node-background-color,#fff));transform:translateX(calc(var(--switch-width, 1.5338em) - var(--switch-node-size, .867em)))}.smart-switch--disabled{opacity:var(--switch-disabled-opacity,.4)}
@@ -14,6 +14,7 @@ var appLog_1 = __importDefault(require("../common/appLog"));
14
14
  mask: Boolean,
15
15
  message: String,
16
16
  forbidClick: Boolean,
17
+ nativeDisabled: Boolean,
17
18
  zIndex: {
18
19
  type: Number,
19
20
  value: 1000,
@@ -7,6 +7,7 @@ interface ToastOptions {
7
7
  type?: string;
8
8
  mask?: boolean;
9
9
  zIndex?: number;
10
+ nativeDisabled?: boolean;
10
11
  context?: (() => ToastContext) | ToastContext;
11
12
  position?: string;
12
13
  duration?: number;
@@ -15,8 +16,8 @@ interface ToastOptions {
15
16
  ignoreQueue?: boolean;
16
17
  loadingType?: string;
17
18
  message?: ToastMessage;
18
- onClose?: () => void;
19
19
  width?: number;
20
+ onClose?: () => void;
20
21
  }
21
22
  export declare const contextRef: {
22
23
  value: Record<string, ToastContext | null>;
@@ -21,6 +21,7 @@ var validator_1 = require("../common/validator");
21
21
  var defaultOptions = {
22
22
  type: 'text',
23
23
  mask: false,
24
+ nativeDisabled: false,
24
25
  message: '',
25
26
  show: true,
26
27
  zIndex: 1000,
@@ -35,6 +36,9 @@ var defaultOptions = {
35
36
  var queueRef = {
36
37
  value: [],
37
38
  };
39
+ var preDisRef = {
40
+ value: {},
41
+ };
38
42
  // @ts-expect-error
39
43
  var currentOptions = __assign({}, defaultOptions);
40
44
  function parseOptions(message) {
@@ -44,6 +48,7 @@ exports.contextRef = {
44
48
  value: {},
45
49
  };
46
50
  function Toast(toastOptions) {
51
+ var _a, _b;
47
52
  var options = __assign(__assign({}, currentOptions), parseOptions(toastOptions));
48
53
  appLog_1.default.info('start open Toast');
49
54
  var context = (typeof options.context === 'function' ? options.context() : options.context) ||
@@ -60,13 +65,28 @@ function Toast(toastOptions) {
60
65
  delete options.context;
61
66
  delete options.selector;
62
67
  toast.clear = function () {
68
+ var _a;
63
69
  toast.setData({ show: false });
70
+ if (options.nativeDisabled) {
71
+ // @ts-ignore
72
+ (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, false);
73
+ }
74
+ preDisRef.value[options.selector] = false;
64
75
  if (options.onClose) {
65
76
  options.onClose();
66
77
  }
67
78
  };
68
79
  queueRef.value.push(toast);
69
80
  toast.setData(options);
81
+ if (options.nativeDisabled) {
82
+ // @ts-ignore
83
+ (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, true);
84
+ }
85
+ if (preDisRef.value[options.selector] && !options.nativeDisabled) {
86
+ // @ts-ignore
87
+ (_b = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _b === void 0 ? void 0 : _b.call(ty, false);
88
+ }
89
+ preDisRef.value[options.selector] = options.nativeDisabled || false;
70
90
  clearTimeout(toast.timer);
71
91
  if (options.duration != null && options.duration > 0) {
72
92
  toast.timer = setTimeout(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.4.1-beta-1",
3
+ "version": "2.4.1-beta-2",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",