@ray-js/api 1.4.0-alpha.1 → 1.4.0-alpha.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. package/@types/P2PKit.d.ts +402 -0
  2. package/@types/all-kits.d.ts +1 -0
  3. package/lib/BaseKit-3.3.10.js +85 -83
  4. package/lib/BizKit-3.2.7.js +48 -47
  5. package/lib/DeviceKit-3.3.1.js +194 -193
  6. package/lib/HomeKit-3.1.4.js +2 -1
  7. package/lib/MapKit-3.0.7.js +4 -2
  8. package/lib/MiniKit-3.1.0.js +65 -64
  9. package/lib/P2PKit-2.0.3.d.ts +27 -0
  10. package/lib/P2PKit-2.0.3.js +79 -0
  11. package/lib/PlayNetKit-1.1.3.js +2 -1
  12. package/lib/all-kits.d.ts +1 -0
  13. package/lib/all-kits.js +1 -0
  14. package/lib/cloud/alarm.js +4 -7
  15. package/lib/cloud/core.js +2 -3
  16. package/lib/cloud/device.js +20 -31
  17. package/lib/cloud/interface.d.ts +7 -7
  18. package/lib/cloud/linkage.js +43 -41
  19. package/lib/cloud/statistic.js +21 -33
  20. package/lib/cloud/timer.js +31 -48
  21. package/lib/constants.js +1 -1
  22. package/lib/core/promisify/index.js +5 -9
  23. package/lib/getBoundingClientRect/index.js +16 -17
  24. package/lib/getBoundingClientRect/index.thing.js +16 -17
  25. package/lib/getBoundingClientRect/index.wechat.js +16 -17
  26. package/lib/getCdnUrl/index.d.ts +1 -0
  27. package/lib/getCdnUrl/index.js +4 -0
  28. package/lib/getCdnUrl/index.thing.d.ts +3 -1
  29. package/lib/getCdnUrl/index.thing.js +54 -19
  30. package/lib/getCdnUrl/index.wechat.d.ts +1 -0
  31. package/lib/getCdnUrl/index.wechat.js +4 -0
  32. package/lib/getElementById/index.js +1 -3
  33. package/lib/getElementById/index.thing.js +2 -4
  34. package/lib/getElementById/index.wechat.js +2 -4
  35. package/lib/hideTabBar/index.d.ts +7 -1
  36. package/lib/index.d.ts +1 -1
  37. package/lib/index.js +4 -3
  38. package/lib/lifecycles/offAppEvent/index.js +2 -2
  39. package/lib/lifecycles/offAppHide/index.js +2 -2
  40. package/lib/lifecycles/offAppShow/index.js +2 -2
  41. package/lib/lifecycles/offError/index.js +2 -2
  42. package/lib/lifecycles/offThemeChange/index.js +2 -2
  43. package/lib/lifecycles/offWindowResize/index.js +2 -2
  44. package/lib/lifecycles/onAppEvent/index.js +2 -2
  45. package/lib/lifecycles/onAppHide/index.js +2 -2
  46. package/lib/lifecycles/onAppShow/index.js +2 -2
  47. package/lib/lifecycles/onError/index.js +2 -2
  48. package/lib/lifecycles/onPageNotFound/index.js +2 -2
  49. package/lib/lifecycles/onThemeChange/index.js +2 -2
  50. package/lib/lifecycles/onWindowResize/index.js +2 -2
  51. package/lib/navigateBack/index.js +3 -6
  52. package/lib/navigateTo/index.js +2 -5
  53. package/lib/onNavigationBarBack/index.js +1 -2
  54. package/lib/onNavigationBarBack/index.wechat.js +1 -2
  55. package/lib/panel/devInfo/index.js +84 -121
  56. package/lib/panel/i18n/index.d.ts +1 -1
  57. package/lib/panel/i18n/index.js +180 -262
  58. package/lib/panel/i18n/index.wechat.d.ts +1 -1
  59. package/lib/panel/i18n/index.wechat.js +184 -267
  60. package/lib/panel/normalizeNetwork.d.ts +2 -2
  61. package/lib/panel/normalizeNetwork.js +2 -7
  62. package/lib/panel/publishDps.d.ts +1 -1
  63. package/lib/panel/publishDps.js +13 -18
  64. package/lib/panel/types/devInfo.d.ts +3 -3
  65. package/lib/panel/types/utilities.d.ts +8 -8
  66. package/lib/panel/utils.js +1 -3
  67. package/lib/reLaunch/index.js +2 -5
  68. package/lib/redirectTo/index.js +2 -6
  69. package/lib/requestCloud/index.js +2 -2
  70. package/lib/requestCloud/index.wechat.js +0 -1
  71. package/lib/setNavigationBarBack/index.js +1 -2
  72. package/lib/setNavigationBarBack/index.wechat.js +1 -2
  73. package/lib/setNavigationBarColor/index.js +3 -6
  74. package/lib/setNavigationBarTitle/index.js +5 -6
  75. package/lib/showTabBar/index.d.ts +7 -1
  76. package/lib/switchTab/index.js +2 -5
  77. package/lib/utils.d.ts +1 -1
  78. package/lib/utils.js +5 -14
  79. package/lib/utils.wechat.d.ts +1 -1
  80. package/lib/utils.wechat.js +9 -21
  81. package/lib/viewAPI.js +13 -12
  82. package/package.json +25 -25
@@ -1,289 +1,207 @@
1
- import _typeof from "@babel/runtime/helpers/esm/typeof";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import "core-js/modules/es.object.keys.js";
5
- import "core-js/modules/es.object.assign.js";
6
- import "core-js/modules/es.array.map.js";
7
- import "core-js/modules/es.regexp.exec.js";
8
- import "core-js/modules/es.regexp.test.js";
9
- import "core-js/modules/es.array.last-index-of.js";
10
1
  import "core-js/modules/es.string.replace.js";
11
- import "core-js/modules/es.regexp.constructor.js";
12
- import "core-js/modules/es.regexp.dot-all.js";
13
- import "core-js/modules/es.regexp.sticky.js";
14
- import "core-js/modules/es.regexp.to-string.js";
15
- import "core-js/modules/es.array.concat.js";
16
- import "core-js/modules/es.parse-float.js";
17
2
  import { requestCloud, getSystemInfoSync, THING } from '../..';
18
3
  import { getBitValue } from '../utils';
19
-
20
- var I18N = /*#__PURE__*/function () {
21
- function I18N(props) {
22
- _classCallCheck(this, I18N);
23
-
4
+ export default class I18N {
5
+ constructor(props) {
24
6
  this.strings = this.mergeLanguage(props, {});
25
7
  this.defaultLang = this.strings.en ? 'en' : Object.keys(this.strings)[0];
26
8
  this.setLanguage(this.defaultLang);
27
- var langKey = getSystemInfoSync().language;
9
+ const langKey = getSystemInfoSync().language;
28
10
  this.setLanguage(langKey);
29
11
  }
30
-
31
- _createClass(I18N, [{
32
- key: "forceUpdateNetworkLang",
33
- value: function forceUpdateNetworkLang(productId) {
34
- var _this = this;
35
-
36
- requestCloud({
37
- api: "".concat(THING, ".m.i18n.get"),
38
- version: '1.0',
39
- data: {
40
- productId: productId,
41
- moduleName: 'h5',
42
- endId: 2,
43
- osId: 0
44
- },
45
- // @ts-ignore
46
- success: function success(data) {
47
- if (data) {
48
- _this.strings = _this.mergeLanguage(_this.strings, data);
49
-
50
- _this.buildLanguage(_this.__language);
51
- }
12
+ forceUpdateNetworkLang(productId) {
13
+ requestCloud({
14
+ api: "".concat(THING, ".m.i18n.get"),
15
+ version: '1.0',
16
+ data: {
17
+ productId,
18
+ moduleName: 'h5',
19
+ endId: 2,
20
+ osId: 0
21
+ },
22
+ // @ts-ignore
23
+ success: data => {
24
+ if (data) {
25
+ this.strings = this.mergeLanguage(this.strings, data);
26
+ this.buildLanguage(this.__language);
52
27
  }
53
- });
54
- }
55
- }, {
56
- key: "mergeLanguage",
57
- value: function mergeLanguage(L1, L2) {
58
- if (typeof L1 === 'undefined' && typeof L2 === 'undefined') return {};
59
- if (typeof L1 === 'undefined') return L2;
60
- if (typeof L2 === 'undefined') return L1;
61
- var L0 = Object.assign({}, L1);
62
- Object.keys(L2).map(function (k) {
63
- if (typeof L0[k] !== 'undefined') {
64
- Object.assign(L0[k], L2[k]);
65
- } else {
66
- L0[k] = Object.assign({}, L2[k]);
67
- }
68
-
69
- return null;
70
- });
71
- return L0;
72
- }
73
- }, {
74
- key: "isZh",
75
- value: function isZh(language) {
76
- /**
77
- * ios 的中文简体固定为 zh-Hans,
78
- * 但安卓的中文简体可能有一大堆排列组件 = =,如 zh_CN、zh_cn、zh_Hans_CH、zh_hans_cn 等等;
79
- */
80
-
81
- /**
82
- * 如果匹配到位中文简体地区,
83
- * 则将中文 zh 相关的 values 都写入到 this.strings 下,保证兜底本地 zh 相关的能取到,
84
- * 再将当前地区 key 相关的 values 都写入到 this.strings 下,优先级最高;
85
- */
86
- if (typeof language === 'string' && /^zh-hans$|^zh_hans$|^zh_cn$|^zh-cn$|^zh_hans_\w+|^zh-hans-\w+/.test(language.toLowerCase())) {
87
- return true;
88
28
  }
89
-
90
- return false;
91
- }
92
- }, {
93
- key: "setLanguage",
94
- value: function setLanguage(language) {
95
- this.__language = language;
96
-
97
- if (this.isZh(language)) {
98
- this.buildLanguage('zh');
99
- this.buildLanguage(language);
29
+ });
30
+ }
31
+ mergeLanguage(L1, L2) {
32
+ if (typeof L1 === 'undefined' && typeof L2 === 'undefined') return {};
33
+ if (typeof L1 === 'undefined') return L2;
34
+ if (typeof L2 === 'undefined') return L1;
35
+ const L0 = Object.assign({}, L1);
36
+ Object.keys(L2).map(k => {
37
+ if (typeof L0[k] !== 'undefined') {
38
+ Object.assign(L0[k], L2[k]);
100
39
  } else {
101
- this.buildLanguage(this.__language);
102
- }
103
- }
104
- }, {
105
- key: "buildLanguage",
106
- value: function buildLanguage(language) {
107
- var _this2 = this;
108
-
109
- if (this.strings[language]) {
110
- var localizedStrings = this.strings[language];
111
- Object.keys(localizedStrings).map(function (key) {
112
- // eslint-disable-next-line no-prototype-builtins
113
- if (localizedStrings.hasOwnProperty(key)) {
114
- _this2[key] = localizedStrings[key];
115
- }
116
-
117
- return null;
118
- });
119
- }
120
- }
121
- }, {
122
- key: "_getBestMatchingLanguage",
123
- value: function _getBestMatchingLanguage(language, props) {
124
- if (props[language]) return language;
125
- var idx = language.lastIndexOf('-');
126
-
127
- if (idx >= 0) {
128
- var lang = language.substring(0, idx);
129
- return this._getBestMatchingLanguage(lang, props);
130
- }
131
-
132
- var underlineIdx = language.lastIndexOf('_');
133
-
134
- if (underlineIdx >= 0) {
135
- var _lang = language.substring(0, underlineIdx);
136
-
137
- return this._getBestMatchingLanguage(_lang, props);
138
- }
139
-
140
- return this.defaultLang;
141
- } // Format the passed string replacing the numbered placeholders
142
- // i.e. I'd like some {0} and {1}, or just {0}
143
- // Use example:
144
- // strings.formatString(strings.question, strings.bread, strings.butter)
145
-
146
- }, {
147
- key: "formatString",
148
- value: function formatString(str) {
149
- var res = str;
150
-
151
- for (var i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
152
- res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
40
+ L0[k] = Object.assign({}, L2[k]);
153
41
  }
42
+ return null;
43
+ });
44
+ return L0;
45
+ }
46
+ isZh(language) {
47
+ /**
48
+ * ios 的中文简体固定为 zh-Hans,
49
+ * 但安卓的中文简体可能有一大堆排列组件 = =,如 zh_CN、zh_cn、zh_Hans_CH、zh_hans_cn 等等;
50
+ */
154
51
 
155
- return res;
52
+ /**
53
+ * 如果匹配到位中文简体地区,
54
+ * 则将中文 zh 相关的 values 都写入到 this.strings 下,保证兜底本地 zh 相关的能取到,
55
+ * 再将当前地区 key 相关的 values 都写入到 this.strings 下,优先级最高;
56
+ */
57
+ if (typeof language === 'string' && /^zh-hans$|^zh_hans$|^zh_cn$|^zh-cn$|^zh_hans_\w+|^zh-hans-\w+/.test(language.toLowerCase())) {
58
+ return true;
156
59
  }
157
- }, {
158
- key: "formatValue",
159
- value: function formatValue(key) {
160
- var res = typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
161
-
162
- for (var i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
163
- res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
164
- }
165
-
166
- return res;
60
+ return false;
61
+ }
62
+ setLanguage(language) {
63
+ this.__language = language;
64
+ if (this.isZh(language)) {
65
+ this.buildLanguage('zh');
66
+ this.buildLanguage(language);
67
+ } else {
68
+ this.buildLanguage(this.__language);
167
69
  }
168
- }, {
169
- key: "_replaceAll",
170
- value: function _replaceAll(find, replace, str) {
171
- // eslint-disable-next-line no-useless-escape, no-param-reassign
172
- find = find.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
173
- if (!str) return '';
174
- return str.replace(new RegExp(find, 'g'), replace);
70
+ }
71
+ buildLanguage(language) {
72
+ if (this.strings[language]) {
73
+ const localizedStrings = this.strings[language];
74
+ Object.keys(localizedStrings).map(key => {
75
+ // eslint-disable-next-line no-prototype-builtins
76
+ if (localizedStrings.hasOwnProperty(key)) {
77
+ this[key] = localizedStrings[key];
78
+ }
79
+ return null;
80
+ });
175
81
  }
176
- }, {
177
- key: "getDpLang",
178
- value: function getDpLang(code, value) {
179
- var key;
180
-
181
- if (typeof value === 'undefined') {
182
- key = "dp_".concat(code).toLowerCase();
183
- } else if (typeof value === 'boolean') {
184
- var valStr = value ? 'on' : 'off';
185
- key = "dp_".concat(code, "_").concat(valStr).toLowerCase();
186
- } else {
187
- key = "dp_".concat(code, "_").concat(value).toLowerCase();
188
- }
189
-
190
- return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
82
+ }
83
+ _getBestMatchingLanguage(language, props) {
84
+ if (props[language]) return language;
85
+ const idx = language.lastIndexOf('-');
86
+ if (idx >= 0) {
87
+ const lang = language.substring(0, idx);
88
+ return this._getBestMatchingLanguage(lang, props);
191
89
  }
192
- }, {
193
- key: "getDpName",
194
- value: function getDpName(code, defaultName) {
195
- var key = "dp_".concat(code).toLowerCase();
196
- return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : defaultName;
90
+ const underlineIdx = language.lastIndexOf('_');
91
+ if (underlineIdx >= 0) {
92
+ const lang = language.substring(0, underlineIdx);
93
+ return this._getBestMatchingLanguage(lang, props);
197
94
  }
198
- }, {
199
- key: "getDpsLang",
200
- value: function getDpsLang(key) {
201
- var _this3 = this;
202
-
203
- var strs = {};
204
-
205
- if (_typeof(key) === 'object') {
206
- if (typeof key.strKey === 'string') {
207
- strs = I18n.t(key.strKey) !== key.strKey ? I18n.t(key.strKey) : typeof this[key.strKey] !== 'undefined' ? this[key.strKey] : I18n.t(key.strKey);
208
- } else {
209
- Object.keys(key).map(function (i) {
210
- strs[key[i]] = I18n.t(key[i]) !== key[i] ? I18n.t(key[i]) : typeof _this3[key[i]] !== 'undefined' ? _this3[key[i]] : I18n.t(key[i]);
211
- return null;
212
- });
213
- }
214
- } else {
215
- strs = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
216
- }
95
+ return this.defaultLang;
96
+ }
217
97
 
218
- return strs;
98
+ // Format the passed string replacing the numbered placeholders
99
+ // i.e. I'd like some {0} and {1}, or just {0}
100
+ // Use example:
101
+ // strings.formatString(strings.question, strings.bread, strings.butter)
102
+ formatString(str) {
103
+ let res = str;
104
+ for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
105
+ res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
219
106
  }
220
- }, {
221
- key: "getLang",
222
- value: function getLang(key, defaultString) {
223
- return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : typeof defaultString !== 'undefined' ? defaultString : I18n.t(key);
107
+ return res;
108
+ }
109
+ formatValue(key) {
110
+ let res = typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
111
+ for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
112
+ res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
224
113
  }
225
- /**
226
- * 获取picker标题
227
- * @param {*} dpCode
228
- */
229
-
230
- }, {
231
- key: "getRangeStrings",
232
- value: function getRangeStrings(dpCode, schema) {
233
- var _this4 = this;
234
-
235
- var result = {};
236
- if (typeof schema === 'undefined') return result;
237
- var lists = schema.range;
238
- lists.map(function (v) {
239
- var key = "dp_".concat(dpCode, "_").concat(v).toLowerCase();
240
- result[v] = I18n.t(key) !== key ? I18n.t(key) : typeof _this4[key] !== 'undefined' ? _this4[key] : I18n.t(key);
241
- return null;
242
- });
243
- return result;
114
+ return res;
115
+ }
116
+ _replaceAll(find, replace, str) {
117
+ // eslint-disable-next-line no-useless-escape, no-param-reassign
118
+ find = find.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
119
+ if (!str) return '';
120
+ return str.replace(new RegExp(find, 'g'), replace);
121
+ }
122
+ getDpLang(code, value) {
123
+ let key;
124
+ if (typeof value === 'undefined') {
125
+ key = "dp_".concat(code).toLowerCase();
126
+ } else if (typeof value === 'boolean') {
127
+ const valStr = value ? 'on' : 'off';
128
+ key = "dp_".concat(code, "_").concat(valStr).toLowerCase();
129
+ } else {
130
+ key = "dp_".concat(code, "_").concat(value).toLowerCase();
244
131
  }
245
- /**
246
- * 开关倒计时转换为文案 time => 设备将在xxx后 关闭/开启
247
- * 精确到分钟
248
- * @param {*} t 倒计时剩余()
249
- * @param {*} power 设备当前的开关状态 (如果当前设备为开启状态, 则倒计时显示为关闭)
250
- */
251
-
252
- }, {
253
- key: "parseCountdown",
254
- value: function parseCountdown(t, power) {
255
- var h = parseFloat("".concat(t / 3600));
256
- var m = parseFloat("".concat(t / 60 - h * 60));
257
- var tHour = I18n.t('t_hour') !== 't_hour' ? I18n.t('t_hour') : typeof this.t_hour !== 'undefined' ? this.t_hour : I18n.t('t_hour');
258
- var tMinute = I18n.t('t_minute') !== 't_minute' ? I18n.t('t_minute') : typeof this.t_minute !== 'undefined' ? this.t_minute : I18n.t('t_minute');
259
- var time = h >= 1.0 ? "".concat(Math.round(h)).concat(tHour) : "".concat(Math.round(m)).concat(tMinute);
260
- var key = "countdown_".concat(power ? 'on' : 'off');
261
- var str = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
262
- return this.formatString(str, time);
132
+ return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
133
+ }
134
+ getDpName(code, defaultName) {
135
+ const key = "dp_".concat(code).toLowerCase();
136
+ return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : defaultName;
137
+ }
138
+ getDpsLang(key) {
139
+ let strs = {};
140
+ if (typeof key === 'object') {
141
+ if (typeof key.strKey === 'string') {
142
+ strs = I18n.t(key.strKey) !== key.strKey ? I18n.t(key.strKey) : typeof this[key.strKey] !== 'undefined' ? this[key.strKey] : I18n.t(key.strKey);
143
+ } else {
144
+ Object.keys(key).map(i => {
145
+ strs[key[i]] = I18n.t(key[i]) !== key[i] ? I18n.t(key[i]) : typeof this[key[i]] !== 'undefined' ? this[key[i]] : I18n.t(key[i]);
146
+ return null;
147
+ });
148
+ }
149
+ } else {
150
+ strs = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
263
151
  }
264
- }, {
265
- key: "getFaultStrings",
266
- value: function getFaultStrings(schema, faultCode, faultValue) {
267
- var onlyPrior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
268
- if (!faultValue) return '';
269
- var label = schema.label;
270
- var labels = [];
152
+ return strs;
153
+ }
154
+ getLang(key, defaultString) {
155
+ return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : typeof defaultString !== 'undefined' ? defaultString : I18n.t(key);
156
+ }
271
157
 
272
- for (var i = 0; i < label.length; i++) {
273
- var value = label[i];
274
- var isExist = getBitValue(faultValue, i);
158
+ /**
159
+ * 获取picker标题
160
+ * @param {*} dpCode
161
+ */
162
+ getRangeStrings(dpCode, schema) {
163
+ const result = {};
164
+ if (typeof schema === 'undefined') return result;
165
+ const lists = schema.range;
166
+ lists.map(v => {
167
+ const key = "dp_".concat(dpCode, "_").concat(v).toLowerCase();
168
+ result[v] = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
169
+ return null;
170
+ });
171
+ return result;
172
+ }
275
173
 
276
- if (isExist) {
277
- labels.push(this.getDpLang(faultCode, value));
278
- if (onlyPrior) break;
279
- }
174
+ /**
175
+ * 开关倒计时转换为文案 time => 设备将在xxx后 关闭/开启
176
+ * 精确到分钟
177
+ * @param {*} t 倒计时剩余(秒)
178
+ * @param {*} power 设备当前的开关状态 (如果当前设备为开启状态, 则倒计时显示为关闭)
179
+ */
180
+ parseCountdown(t, power) {
181
+ const h = parseFloat("".concat(t / 3600));
182
+ const m = parseFloat("".concat(t / 60 - h * 60));
183
+ const tHour = I18n.t('t_hour') !== 't_hour' ? I18n.t('t_hour') : typeof this.t_hour !== 'undefined' ? this.t_hour : I18n.t('t_hour');
184
+ const tMinute = I18n.t('t_minute') !== 't_minute' ? I18n.t('t_minute') : typeof this.t_minute !== 'undefined' ? this.t_minute : I18n.t('t_minute');
185
+ const time = h >= 1.0 ? "".concat(Math.round(h)).concat(tHour) : "".concat(Math.round(m)).concat(tMinute);
186
+ const key = "countdown_".concat(power ? 'on' : 'off');
187
+ const str = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
188
+ return this.formatString(str, time);
189
+ }
190
+ getFaultStrings(schema, faultCode, faultValue) {
191
+ let onlyPrior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
192
+ if (!faultValue) return '';
193
+ const {
194
+ label
195
+ } = schema;
196
+ const labels = [];
197
+ for (let i = 0; i < label.length; i++) {
198
+ const value = label[i];
199
+ const isExist = getBitValue(faultValue, i);
200
+ if (isExist) {
201
+ labels.push(this.getDpLang(faultCode, value));
202
+ if (onlyPrior) break;
280
203
  }
281
-
282
- return onlyPrior ? labels[0] : labels.join(', ');
283
204
  }
284
- }]);
285
-
286
- return I18N;
287
- }();
288
-
289
- export { I18N as default };
205
+ return onlyPrior ? labels[0] : labels.join(', ');
206
+ }
207
+ }
@@ -1,4 +1,4 @@
1
- declare type LanguageMap = {
1
+ type LanguageMap = {
2
2
  [key: string]: Record<string, string>;
3
3
  };
4
4
  export default class I18N {