@tuya-miniapp/smart-ui 2.1.11-beta-2 → 2.1.11-beta-3
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.
- package/dist/datetime-picker/index.js +12 -12
- package/dist/picker/index.wxml +1 -1
- package/dist/picker/index.wxs +1 -0
- package/dist/wxs/style.wxs +5 -4
- package/lib/datetime-picker/index.js +12 -12
- package/lib/picker/index.wxml +1 -1
- package/lib/picker/index.wxs +1 -0
- package/lib/wxs/style.wxs +5 -4
- package/package.json +1 -1
@@ -112,22 +112,22 @@ SmartComponent({
|
|
112
112
|
}
|
113
113
|
return this.picker;
|
114
114
|
},
|
115
|
-
formatterFunc(type, value) {
|
116
|
-
var _a;
|
117
|
-
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;
|
118
118
|
const mapDetail = formatterMap === null || formatterMap === void 0 ? void 0 : formatterMap[type];
|
119
119
|
if (typeof mapDetail === 'string') {
|
120
120
|
return replacePlaceholders(mapDetail, { [type]: value });
|
121
121
|
}
|
122
122
|
if (typeof mapDetail === 'object') {
|
123
|
-
return (
|
123
|
+
return (_b = mapDetail[value]) !== null && _b !== void 0 ? _b : formatter(type, value);
|
124
124
|
}
|
125
125
|
return formatter(type, value);
|
126
126
|
},
|
127
127
|
updateColumns() {
|
128
128
|
const { locale } = this.data;
|
129
129
|
const results = this.getOriginColumns().map(column => ({
|
130
|
-
values: column.values.map(value => this.formatterFunc(column.type, value)),
|
130
|
+
values: column.values.map(value => this.formatterFunc(column.type, value, this.data)),
|
131
131
|
order: column.order,
|
132
132
|
unit: locale === null || locale === void 0 ? void 0 : locale[column.type],
|
133
133
|
}));
|
@@ -340,25 +340,25 @@ SmartComponent({
|
|
340
340
|
});
|
341
341
|
values = [
|
342
342
|
part,
|
343
|
-
formatter('hour', part ? (!hour ? 12 : hour - 12) : hour),
|
344
|
-
formatter('minute', minute),
|
343
|
+
formatter('hour', part ? (!hour ? 12 : hour - 12) : hour, this.data),
|
344
|
+
formatter('minute', minute, this.data),
|
345
345
|
];
|
346
346
|
}
|
347
347
|
else if (type === 'time') {
|
348
348
|
const pair = value.split(':');
|
349
|
-
values = [formatter('hour', pair[0]), formatter('minute', pair[1])];
|
349
|
+
values = [formatter('hour', pair[0], this.data), formatter('minute', pair[1], this.data)];
|
350
350
|
}
|
351
351
|
else {
|
352
352
|
const date = new Date(value);
|
353
353
|
values = [
|
354
|
-
formatter('year', `${date.getFullYear()}
|
355
|
-
formatter('month', padZero(date.getMonth() + 1)),
|
354
|
+
formatter('year', `${date.getFullYear()}`, this.data),
|
355
|
+
formatter('month', padZero(date.getMonth() + 1), this.data),
|
356
356
|
];
|
357
357
|
if (type === 'date') {
|
358
|
-
values.push(formatter('day', padZero(date.getDate())));
|
358
|
+
values.push(formatter('day', padZero(date.getDate()), this.data));
|
359
359
|
}
|
360
360
|
if (type === 'datetime') {
|
361
|
-
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));
|
362
362
|
}
|
363
363
|
}
|
364
364
|
return this.set({ innerValue: value })
|
package/dist/picker/index.wxml
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
data-index="{{ index }}"
|
20
20
|
custom-class="column-class"
|
21
21
|
value-key="{{ valueKey }}"
|
22
|
-
style="order: {{ item.order }}; {{ 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 }}"
|
package/dist/picker/index.wxs
CHANGED
package/dist/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
|
}
|
@@ -143,16 +143,16 @@ var defaultFormatter = function (type, value) {
|
|
143
143
|
}
|
144
144
|
return this.picker;
|
145
145
|
},
|
146
|
-
formatterFunc: function (type, value) {
|
146
|
+
formatterFunc: function (type, value, data) {
|
147
147
|
var _a;
|
148
|
-
var _b;
|
149
|
-
var
|
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;
|
150
150
|
var mapDetail = formatterMap === null || formatterMap === void 0 ? void 0 : formatterMap[type];
|
151
151
|
if (typeof mapDetail === 'string') {
|
152
152
|
return (0, utils_1.replacePlaceholders)(mapDetail, (_a = {}, _a[type] = value, _a));
|
153
153
|
}
|
154
154
|
if (typeof mapDetail === 'object') {
|
155
|
-
return (
|
155
|
+
return (_c = mapDetail[value]) !== null && _c !== void 0 ? _c : formatter(type, value);
|
156
156
|
}
|
157
157
|
return formatter(type, value);
|
158
158
|
},
|
@@ -160,7 +160,7 @@ var defaultFormatter = function (type, value) {
|
|
160
160
|
var _this = this;
|
161
161
|
var locale = this.data.locale;
|
162
162
|
var results = this.getOriginColumns().map(function (column) { return ({
|
163
|
-
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
164
|
order: column.order,
|
165
165
|
unit: locale === null || locale === void 0 ? void 0 : locale[column.type],
|
166
166
|
}); });
|
@@ -376,25 +376,25 @@ var defaultFormatter = function (type, value) {
|
|
376
376
|
});
|
377
377
|
values = [
|
378
378
|
part,
|
379
|
-
formatter('hour', part ? (!hour ? 12 : hour - 12) : hour),
|
380
|
-
formatter('minute', minute),
|
379
|
+
formatter('hour', part ? (!hour ? 12 : hour - 12) : hour, this.data),
|
380
|
+
formatter('minute', minute, this.data),
|
381
381
|
];
|
382
382
|
}
|
383
383
|
else if (type === 'time') {
|
384
384
|
var pair = value.split(':');
|
385
|
-
values = [formatter('hour', pair[0]), formatter('minute', pair[1])];
|
385
|
+
values = [formatter('hour', pair[0], this.data), formatter('minute', pair[1], this.data)];
|
386
386
|
}
|
387
387
|
else {
|
388
388
|
var date = new Date(value);
|
389
389
|
values = [
|
390
|
-
formatter('year', "".concat(date.getFullYear())),
|
391
|
-
formatter('month', padZero(date.getMonth() + 1)),
|
390
|
+
formatter('year', "".concat(date.getFullYear()), this.data),
|
391
|
+
formatter('month', padZero(date.getMonth() + 1), this.data),
|
392
392
|
];
|
393
393
|
if (type === 'date') {
|
394
|
-
values.push(formatter('day', padZero(date.getDate())));
|
394
|
+
values.push(formatter('day', padZero(date.getDate()), this.data));
|
395
395
|
}
|
396
396
|
if (type === 'datetime') {
|
397
|
-
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));
|
398
398
|
}
|
399
399
|
}
|
400
400
|
return this.set({ innerValue: value })
|
package/lib/picker/index.wxml
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
data-index="{{ index }}"
|
20
20
|
custom-class="column-class"
|
21
21
|
value-key="{{ valueKey }}"
|
22
|
-
style="order: {{ item.order }}; {{ 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 }}"
|
package/lib/picker/index.wxs
CHANGED
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
|
}
|