@ray-js/api 1.7.53 → 1.7.54
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/lib/cloud/alarm.js +2 -2
- package/lib/cloud/core.js +1 -1
- package/lib/cloud/device.js +8 -7
- package/lib/cloud/deviceFile.js +5 -5
- package/lib/cloud/doorlock/auth.js +8 -8
- package/lib/cloud/doorlock/device.js +13 -13
- package/lib/cloud/doorlock/fittings.js +4 -4
- package/lib/cloud/doorlock/log.js +7 -7
- package/lib/cloud/doorlock/member-opmode.js +6 -6
- package/lib/cloud/doorlock/member.js +13 -13
- package/lib/cloud/doorlock/offline-pwd.js +4 -4
- package/lib/cloud/doorlock/sence.js +3 -3
- package/lib/cloud/doorlock/service.js +1 -1
- package/lib/cloud/doorlock/setting.js +11 -11
- package/lib/cloud/doorlock/temp-pwd.js +7 -7
- package/lib/cloud/doorlock/unlock-method.js +3 -3
- package/lib/cloud/doorlock/unlock.js +3 -3
- package/lib/cloud/electrician/tariffService.js +2 -2
- package/lib/cloud/highlights.js +8 -7
- package/lib/cloud/linkage.js +17 -17
- package/lib/cloud/outdoor.js +9 -9
- package/lib/cloud/recipe/basket.js +11 -10
- package/lib/cloud/recipe/category-list.js +2 -2
- package/lib/cloud/recipe/custom.js +5 -4
- package/lib/cloud/recipe/menu.js +6 -5
- package/lib/cloud/recipe/query.js +4 -3
- package/lib/cloud/recipe/record.js +3 -3
- package/lib/cloud/recipe/score.js +4 -3
- package/lib/cloud/recipe/star.js +6 -5
- package/lib/cloud/remoteGroup.js +2 -2
- package/lib/cloud/statistic.js +9 -9
- package/lib/cloud/timer.js +14 -14
- package/lib/getBoundingClientRect/index.thing.js +1 -0
- package/lib/getBoundingClientRect/index.wechat.js +1 -0
- package/lib/getCdnUrl/index.thing.js +20 -18
- package/lib/getCdnUrl/index.wechat.js +5 -5
- package/lib/getElementById/index.thing.js +1 -1
- package/lib/getElementById/index.wechat.js +1 -1
- package/lib/panel/i18n/index.js +16 -12
- package/lib/panel/i18n/index.wechat.js +16 -12
- package/lib/panel/publishDps.js +1 -1
- package/lib/redirectTo/index.js +2 -0
- package/lib/utils.js +9 -9
- package/lib/utils.wechat.js +6 -5
- package/package.json +5 -5
package/lib/panel/i18n/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "core-js/modules/es.regexp.constructor.js";
|
|
2
|
+
import "core-js/modules/es.regexp.dot-all.js";
|
|
3
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
4
|
+
import "core-js/modules/es.string.replace.js";
|
|
1
5
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
6
|
import "core-js/modules/esnext.iterator.map.js";
|
|
3
7
|
import { requestCloud, getSystemInfoSync, THING } from '../..';
|
|
@@ -27,7 +31,7 @@ export default class I18N {
|
|
|
27
31
|
}
|
|
28
32
|
forceUpdateNetworkLang(productId) {
|
|
29
33
|
requestCloud({
|
|
30
|
-
api:
|
|
34
|
+
api: "".concat(THING, ".m.i18n.get"),
|
|
31
35
|
version: '1.0',
|
|
32
36
|
data: {
|
|
33
37
|
productId,
|
|
@@ -118,14 +122,14 @@ export default class I18N {
|
|
|
118
122
|
formatString(str) {
|
|
119
123
|
let res = str;
|
|
120
124
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
|
121
|
-
res = this._replaceAll(
|
|
125
|
+
res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
|
122
126
|
}
|
|
123
127
|
return res;
|
|
124
128
|
}
|
|
125
129
|
formatValue(key) {
|
|
126
130
|
let res = this.getLang(key);
|
|
127
131
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
|
128
|
-
res = this._replaceAll(
|
|
132
|
+
res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
|
129
133
|
}
|
|
130
134
|
return res;
|
|
131
135
|
}
|
|
@@ -138,17 +142,17 @@ export default class I18N {
|
|
|
138
142
|
getDpLang(code, value) {
|
|
139
143
|
let key;
|
|
140
144
|
if (typeof value === 'undefined') {
|
|
141
|
-
key =
|
|
145
|
+
key = "dp_".concat(code).toLowerCase();
|
|
142
146
|
} else if (typeof value === 'boolean') {
|
|
143
147
|
const valStr = value ? 'on' : 'off';
|
|
144
|
-
key =
|
|
148
|
+
key = "dp_".concat(code, "_").concat(valStr).toLowerCase();
|
|
145
149
|
} else {
|
|
146
|
-
key =
|
|
150
|
+
key = "dp_".concat(code, "_").concat(value).toLowerCase();
|
|
147
151
|
}
|
|
148
152
|
return hasKey(key) ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
|
149
153
|
}
|
|
150
154
|
getDpName(code, defaultName) {
|
|
151
|
-
const key =
|
|
155
|
+
const key = "dp_".concat(code).toLowerCase();
|
|
152
156
|
return hasKey(key) ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : defaultName;
|
|
153
157
|
}
|
|
154
158
|
getDpsLang(key) {
|
|
@@ -180,7 +184,7 @@ export default class I18N {
|
|
|
180
184
|
if (typeof schema === 'undefined') return result;
|
|
181
185
|
const lists = schema.range;
|
|
182
186
|
lists.map(v => {
|
|
183
|
-
const key =
|
|
187
|
+
const key = "dp_".concat(dpCode, "_").concat(v).toLowerCase();
|
|
184
188
|
result[v] = hasKey(key) ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
|
185
189
|
return null;
|
|
186
190
|
});
|
|
@@ -194,12 +198,12 @@ export default class I18N {
|
|
|
194
198
|
* @param {*} power 设备当前的开关状态 (如果当前设备为开启状态, 则倒计时显示为关闭)
|
|
195
199
|
*/
|
|
196
200
|
parseCountdown(t, power) {
|
|
197
|
-
const h = parseFloat(
|
|
198
|
-
const m = parseFloat(
|
|
201
|
+
const h = parseFloat("".concat(t / 3600));
|
|
202
|
+
const m = parseFloat("".concat(t / 60 - h * 60));
|
|
199
203
|
const tHour = hasKey('t_hour') ? I18n.t('t_hour') : typeof this.t_hour !== 'undefined' ? this.t_hour : I18n.t('t_hour');
|
|
200
204
|
const tMinute = hasKey('t_minute') ? I18n.t('t_minute') : typeof this.t_minute !== 'undefined' ? this.t_minute : I18n.t('t_minute');
|
|
201
|
-
const time = h >= 1.0 ?
|
|
202
|
-
const key =
|
|
205
|
+
const time = h >= 1.0 ? "".concat(Math.round(h)).concat(tHour) : "".concat(Math.round(m)).concat(tMinute);
|
|
206
|
+
const key = "countdown_".concat(power ? 'on' : 'off');
|
|
203
207
|
const str = hasKey(key) ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
|
204
208
|
return this.formatString(str, time);
|
|
205
209
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "core-js/modules/es.regexp.constructor.js";
|
|
2
|
+
import "core-js/modules/es.regexp.dot-all.js";
|
|
3
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
4
|
+
import "core-js/modules/es.string.replace.js";
|
|
1
5
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
6
|
import "core-js/modules/esnext.iterator.map.js";
|
|
3
7
|
import { requestCloud, getSystemInfoSync, THING } from '../..';
|
|
@@ -17,7 +21,7 @@ export default class I18N {
|
|
|
17
21
|
}
|
|
18
22
|
forceUpdateNetworkLang(productId) {
|
|
19
23
|
requestCloud({
|
|
20
|
-
api:
|
|
24
|
+
api: "".concat(THING, ".m.i18n.get"),
|
|
21
25
|
version: '1.0',
|
|
22
26
|
data: {
|
|
23
27
|
productId,
|
|
@@ -108,14 +112,14 @@ export default class I18N {
|
|
|
108
112
|
formatString(str) {
|
|
109
113
|
let res = str;
|
|
110
114
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
|
111
|
-
res = this._replaceAll(
|
|
115
|
+
res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
|
112
116
|
}
|
|
113
117
|
return res;
|
|
114
118
|
}
|
|
115
119
|
formatValue(key) {
|
|
116
120
|
let res = typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
|
117
121
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
|
118
|
-
res = this._replaceAll(
|
|
122
|
+
res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
|
119
123
|
}
|
|
120
124
|
return res;
|
|
121
125
|
}
|
|
@@ -128,17 +132,17 @@ export default class I18N {
|
|
|
128
132
|
getDpLang(code, value) {
|
|
129
133
|
let key;
|
|
130
134
|
if (typeof value === 'undefined') {
|
|
131
|
-
key =
|
|
135
|
+
key = "dp_".concat(code).toLowerCase();
|
|
132
136
|
} else if (typeof value === 'boolean') {
|
|
133
137
|
const valStr = value ? 'on' : 'off';
|
|
134
|
-
key =
|
|
138
|
+
key = "dp_".concat(code, "_").concat(valStr).toLowerCase();
|
|
135
139
|
} else {
|
|
136
|
-
key =
|
|
140
|
+
key = "dp_".concat(code, "_").concat(value).toLowerCase();
|
|
137
141
|
}
|
|
138
142
|
return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
|
139
143
|
}
|
|
140
144
|
getDpName(code, defaultName) {
|
|
141
|
-
const key =
|
|
145
|
+
const key = "dp_".concat(code).toLowerCase();
|
|
142
146
|
return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : defaultName;
|
|
143
147
|
}
|
|
144
148
|
getDpsLang(key) {
|
|
@@ -170,7 +174,7 @@ export default class I18N {
|
|
|
170
174
|
if (typeof schema === 'undefined') return result;
|
|
171
175
|
const lists = schema.range;
|
|
172
176
|
lists.map(v => {
|
|
173
|
-
const key =
|
|
177
|
+
const key = "dp_".concat(dpCode, "_").concat(v).toLowerCase();
|
|
174
178
|
result[v] = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
|
175
179
|
return null;
|
|
176
180
|
});
|
|
@@ -184,12 +188,12 @@ export default class I18N {
|
|
|
184
188
|
* @param {*} power 设备当前的开关状态 (如果当前设备为开启状态, 则倒计时显示为关闭)
|
|
185
189
|
*/
|
|
186
190
|
parseCountdown(t, power) {
|
|
187
|
-
const h = parseFloat(
|
|
188
|
-
const m = parseFloat(
|
|
191
|
+
const h = parseFloat("".concat(t / 3600));
|
|
192
|
+
const m = parseFloat("".concat(t / 60 - h * 60));
|
|
189
193
|
const tHour = I18n.t('t_hour') !== 't_hour' ? I18n.t('t_hour') : typeof this.t_hour !== 'undefined' ? this.t_hour : I18n.t('t_hour');
|
|
190
194
|
const tMinute = I18n.t('t_minute') !== 't_minute' ? I18n.t('t_minute') : typeof this.t_minute !== 'undefined' ? this.t_minute : I18n.t('t_minute');
|
|
191
|
-
const time = h >= 1.0 ?
|
|
192
|
-
const key =
|
|
195
|
+
const time = h >= 1.0 ? "".concat(Math.round(h)).concat(tHour) : "".concat(Math.round(m)).concat(tMinute);
|
|
196
|
+
const key = "countdown_".concat(power ? 'on' : 'off');
|
|
193
197
|
const str = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
|
194
198
|
return this.formatString(str, time);
|
|
195
199
|
}
|
package/lib/panel/publishDps.js
CHANGED
|
@@ -29,7 +29,7 @@ export function sendDps(data) {
|
|
|
29
29
|
const codeIds = (devInfo === null || devInfo === void 0 ? void 0 : devInfo.codeIds) || {};
|
|
30
30
|
Object.keys(data).forEach(code => {
|
|
31
31
|
if (codeIds[code] !== undefined) {
|
|
32
|
-
dps[
|
|
32
|
+
dps["".concat(codeIds[code])] = data[code];
|
|
33
33
|
} else {
|
|
34
34
|
dps[code] = data[code];
|
|
35
35
|
}
|
package/lib/redirectTo/index.js
CHANGED
package/lib/utils.js
CHANGED
|
@@ -4,15 +4,15 @@ export function createFactory(kitName) {
|
|
|
4
4
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5
5
|
return function () {
|
|
6
6
|
var _inst$opts$namespace;
|
|
7
|
-
const methodName =
|
|
7
|
+
const methodName = "ty.".concat(opts.namespace ? opts.namespace + '.' : '').concat(name);
|
|
8
8
|
if (opts.deprecated) {
|
|
9
|
-
console.warn(
|
|
9
|
+
console.warn("\"".concat(methodName, "\" method has been deprecated."));
|
|
10
10
|
}
|
|
11
11
|
const inst = typeof ty === 'undefined' ? {} : ty;
|
|
12
12
|
const method = opts.namespace ? ((_inst$opts$namespace = inst[opts.namespace]) !== null && _inst$opts$namespace !== void 0 ? _inst$opts$namespace : {})[name] : inst[name];
|
|
13
13
|
if (!method) {
|
|
14
|
-
console.warn('tips:',
|
|
15
|
-
console.warn('tips:',
|
|
14
|
+
console.warn('tips:', "\"".concat(methodName, "\" method not exits."));
|
|
15
|
+
console.warn('tips:', "Please check kit \"".concat(kitName, "\" dependency is enabled."));
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
// eslint-disable-next-line prefer-rest-params
|
|
@@ -24,14 +24,14 @@ export function factory(name) {
|
|
|
24
24
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25
25
|
return function () {
|
|
26
26
|
var _inst$opts$namespace2;
|
|
27
|
-
const methodName =
|
|
27
|
+
const methodName = "ty.".concat(opts.namespace ? opts.namespace + '.' : '').concat(name);
|
|
28
28
|
if (opts.deprecated) {
|
|
29
|
-
console.warn(
|
|
29
|
+
console.warn("\"".concat(methodName, "\" method has been deprecated."));
|
|
30
30
|
}
|
|
31
31
|
const inst = typeof ty === 'undefined' ? {} : ty;
|
|
32
32
|
const method = opts.namespace ? ((_inst$opts$namespace2 = inst[opts.namespace]) !== null && _inst$opts$namespace2 !== void 0 ? _inst$opts$namespace2 : {})[name] : inst[name];
|
|
33
33
|
if (!method) {
|
|
34
|
-
console.warn('tips:',
|
|
34
|
+
console.warn('tips:', "\"".concat(methodName, "\" method not exits."));
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
// eslint-disable-next-line prefer-rest-params
|
|
@@ -41,11 +41,11 @@ export function factory(name) {
|
|
|
41
41
|
export function factoryConstants(name) {
|
|
42
42
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
43
43
|
if (opts.deprecated) {
|
|
44
|
-
console.warn(
|
|
44
|
+
console.warn("\"ty.".concat(name, "\" constant has been deprecated."));
|
|
45
45
|
}
|
|
46
46
|
const inst = typeof ty === 'undefined' ? {} : ty;
|
|
47
47
|
if (!inst[name]) {
|
|
48
|
-
console.warn('tips',
|
|
48
|
+
console.warn('tips', "\"ty.".concat(name, "\" constant not exits."));
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
return inst[name];
|
package/lib/utils.wechat.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
1
2
|
// @ts-ignore
|
|
2
3
|
import * as tyWx from '@ray-js/wechat';
|
|
3
4
|
import { stringifyUrl as _stringifyUrl, parseUrl as _parseUrl } from 'query-string';
|
|
@@ -13,7 +14,7 @@ export function factory(name) {
|
|
|
13
14
|
if (/(set|get|remove|clear)+Storage(Sync)?$/.test(name)) {
|
|
14
15
|
return function (option) {
|
|
15
16
|
if (opts.deprecated) {
|
|
16
|
-
console.warn(
|
|
17
|
+
console.warn("The method ".concat(name, " is deprecated"));
|
|
17
18
|
}
|
|
18
19
|
// eslint-disable-next-line prefer-rest-params
|
|
19
20
|
return wx[name].call(this, option.key, option.data);
|
|
@@ -21,10 +22,10 @@ export function factory(name) {
|
|
|
21
22
|
}
|
|
22
23
|
return function () {
|
|
23
24
|
if (opts.deprecated) {
|
|
24
|
-
console.warn(
|
|
25
|
+
console.warn("The method ".concat(name, " is deprecated"));
|
|
25
26
|
}
|
|
26
27
|
if (!tyWx[name] && !wx[name]) {
|
|
27
|
-
console.warn(
|
|
28
|
+
console.warn("The method ".concat(name, " is not implemented yet"));
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
31
|
// 优先取得 TTT 能力的方法
|
|
@@ -38,11 +39,11 @@ export function factory(name) {
|
|
|
38
39
|
export function factoryConstants(name) {
|
|
39
40
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
40
41
|
if (opts.deprecated) {
|
|
41
|
-
console.warn(
|
|
42
|
+
console.warn("The constant ".concat(name, " is deprecated"));
|
|
42
43
|
}
|
|
43
44
|
const inst = typeof wx === 'undefined' ? {} : wx;
|
|
44
45
|
if (!inst[name]) {
|
|
45
|
-
console.warn(
|
|
46
|
+
console.warn("The constant ".concat(name, " is not implemented yet"));
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
49
|
return inst[name];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/api",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.54",
|
|
4
4
|
"description": "Ray universal api",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ray"
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"watch": "ray start --type=component"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ray-js/framework": "1.7.
|
|
33
|
-
"@ray-js/router": "1.7.
|
|
32
|
+
"@ray-js/framework": "1.7.54",
|
|
33
|
+
"@ray-js/router": "1.7.54",
|
|
34
34
|
"base64-browser": "^1.0.1",
|
|
35
35
|
"query-string": "^7.1.3"
|
|
36
36
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@ray-js/wechat": "^0.3.13"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@ray-js/cli": "1.7.
|
|
41
|
+
"@ray-js/cli": "1.7.54",
|
|
42
42
|
"art-template": "^4.13.4",
|
|
43
43
|
"fs-extra": "^10.1.0",
|
|
44
44
|
"miniprogram-api-typings": "^3.12.3",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"access": "public",
|
|
49
49
|
"registry": "https://registry.npmjs.org"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "5116e3b87db4744a118a9fe97f88a8c708b44a93"
|
|
52
52
|
}
|