@tuya-miniapp/smart-ui 2.3.9-beta-1 → 2.3.9
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.
@@ -76,5 +76,8 @@
|
|
76
76
|
readonly="{{readonly}}"
|
77
77
|
/>
|
78
78
|
</block>
|
79
|
-
<smart-toast wx:if="{{
|
79
|
+
<smart-toast wx:if="{{showRangePrompt}}" show="{{showToast}}">
|
80
|
+
<text wx:if="{{rangePrompt}}" style="text-align:center;">{{ rangePrompt }}</text>
|
81
|
+
<text style="text-align:center;" wx:else>Days selected over {{maxRange}} days</text>
|
82
|
+
</smart-toast>
|
80
83
|
</view>
|
package/dist/calendar/index.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { SmartComponent } from '../common/component';
|
2
2
|
import { ROW_HEIGHT, getPrevDay, getNextDay, getToday, compareDay, copyDates, calcDateNum, getMonths, getDayByOffset, getCurrentIndex, getWeekStartAndEnd, getInitEdgeDate, } from '../calendar-utils/utils';
|
3
|
-
import Toast from '../toast/toast';
|
4
3
|
const dateEdge = getInitEdgeDate('year');
|
5
4
|
const getTime = (date) => (date instanceof Date ? date.getTime() : date);
|
6
5
|
SmartComponent({
|
@@ -143,10 +142,6 @@ SmartComponent({
|
|
143
142
|
dayClassMap: {
|
144
143
|
type: null,
|
145
144
|
},
|
146
|
-
toastId: {
|
147
|
-
type: String,
|
148
|
-
value: 'smart-toast-calendar',
|
149
|
-
},
|
150
145
|
},
|
151
146
|
data: {
|
152
147
|
subtitle: '',
|
@@ -155,6 +150,7 @@ SmartComponent({
|
|
155
150
|
scrollIntoView: '',
|
156
151
|
visibleIndex: 0,
|
157
152
|
months: [],
|
153
|
+
showToast: false,
|
158
154
|
},
|
159
155
|
watch: {
|
160
156
|
minDate() {
|
@@ -416,14 +412,17 @@ SmartComponent({
|
|
416
412
|
this.$emit('select', copyDates(date));
|
417
413
|
},
|
418
414
|
checkRange(date) {
|
419
|
-
const { maxRange,
|
415
|
+
const { maxRange, showRangePrompt } = this.data;
|
420
416
|
if (maxRange && calcDateNum(date) > maxRange) {
|
421
417
|
if (showRangePrompt) {
|
422
|
-
|
423
|
-
|
424
|
-
context: this,
|
425
|
-
message: rangePrompt || `选择天数不能超过 ${maxRange} 天`,
|
418
|
+
this.setData({
|
419
|
+
showToast: true,
|
426
420
|
});
|
421
|
+
setTimeout(() => {
|
422
|
+
this.setData({
|
423
|
+
showToast: false,
|
424
|
+
});
|
425
|
+
}, 2000);
|
427
426
|
}
|
428
427
|
this.$emit('over-range');
|
429
428
|
return false;
|
package/dist/picker/shared.js
CHANGED
@@ -76,5 +76,8 @@
|
|
76
76
|
readonly="{{readonly}}"
|
77
77
|
/>
|
78
78
|
</block>
|
79
|
-
<smart-toast wx:if="{{
|
79
|
+
<smart-toast wx:if="{{showRangePrompt}}" show="{{showToast}}">
|
80
|
+
<text wx:if="{{rangePrompt}}" style="text-align:center;">{{ rangePrompt }}</text>
|
81
|
+
<text style="text-align:center;" wx:else>Days selected over {{maxRange}} days</text>
|
82
|
+
</smart-toast>
|
80
83
|
</view>
|
package/lib/calendar/index.js
CHANGED
@@ -8,13 +8,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
8
8
|
}
|
9
9
|
return to.concat(ar || Array.prototype.slice.call(from));
|
10
10
|
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
12
|
var component_1 = require("../common/component");
|
16
13
|
var utils_1 = require("../calendar-utils/utils");
|
17
|
-
var toast_1 = __importDefault(require("../toast/toast"));
|
18
14
|
var dateEdge = (0, utils_1.getInitEdgeDate)('year');
|
19
15
|
var getTime = function (date) { return (date instanceof Date ? date.getTime() : date); };
|
20
16
|
(0, component_1.SmartComponent)({
|
@@ -157,10 +153,6 @@ var getTime = function (date) { return (date instanceof Date ? date.getTime() :
|
|
157
153
|
dayClassMap: {
|
158
154
|
type: null,
|
159
155
|
},
|
160
|
-
toastId: {
|
161
|
-
type: String,
|
162
|
-
value: 'smart-toast-calendar',
|
163
|
-
},
|
164
156
|
},
|
165
157
|
data: {
|
166
158
|
subtitle: '',
|
@@ -169,6 +161,7 @@ var getTime = function (date) { return (date instanceof Date ? date.getTime() :
|
|
169
161
|
scrollIntoView: '',
|
170
162
|
visibleIndex: 0,
|
171
163
|
months: [],
|
164
|
+
showToast: false,
|
172
165
|
},
|
173
166
|
watch: {
|
174
167
|
minDate: function () {
|
@@ -434,14 +427,18 @@ var getTime = function (date) { return (date instanceof Date ? date.getTime() :
|
|
434
427
|
this.$emit('select', (0, utils_1.copyDates)(date));
|
435
428
|
},
|
436
429
|
checkRange: function (date) {
|
437
|
-
var
|
430
|
+
var _this = this;
|
431
|
+
var _a = this.data, maxRange = _a.maxRange, showRangePrompt = _a.showRangePrompt;
|
438
432
|
if (maxRange && (0, utils_1.calcDateNum)(date) > maxRange) {
|
439
433
|
if (showRangePrompt) {
|
440
|
-
|
441
|
-
|
442
|
-
context: this,
|
443
|
-
message: rangePrompt || "\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 ".concat(maxRange, " \u5929"),
|
434
|
+
this.setData({
|
435
|
+
showToast: true,
|
444
436
|
});
|
437
|
+
setTimeout(function () {
|
438
|
+
_this.setData({
|
439
|
+
showToast: false,
|
440
|
+
});
|
441
|
+
}, 2000);
|
445
442
|
}
|
446
443
|
this.$emit('over-range');
|
447
444
|
return false;
|
package/lib/picker/shared.js
CHANGED