@aiot-toolkit/shared-utils 2.0.3-beta.13 → 2.0.3-beta.14
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.
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { StyleMessage } from '../ColorConsole';
|
|
2
|
+
/**
|
|
3
|
+
* 文档帮助
|
|
4
|
+
*/
|
|
5
|
+
export default interface IDocHelp {
|
|
6
|
+
/**
|
|
7
|
+
* 获取组件的文档地址
|
|
8
|
+
* @param option
|
|
9
|
+
*/
|
|
10
|
+
getWidgetsUrl(option: {
|
|
11
|
+
/**
|
|
12
|
+
* 组件名称
|
|
13
|
+
*/
|
|
14
|
+
componentName: string;
|
|
15
|
+
/**
|
|
16
|
+
* 组件章节
|
|
17
|
+
*/
|
|
18
|
+
chapter?: QuickAppDocWidgetType;
|
|
19
|
+
}): string;
|
|
20
|
+
/**
|
|
21
|
+
* 创建组件文档地址的提示信息
|
|
22
|
+
* @param tag 组件名称
|
|
23
|
+
* @param type 章节类型
|
|
24
|
+
*/
|
|
25
|
+
createWidgetReferenceMessage(option: {
|
|
26
|
+
/**
|
|
27
|
+
* 组件名称
|
|
28
|
+
*/
|
|
29
|
+
componentName: string;
|
|
30
|
+
/**
|
|
31
|
+
* 组件章节
|
|
32
|
+
*/
|
|
33
|
+
chapter?: QuickAppDocWidgetType;
|
|
34
|
+
}): StyleMessage;
|
|
35
|
+
}
|
|
36
|
+
export declare class QuickAppDocHelper implements IDocHelp {
|
|
37
|
+
private HOST;
|
|
38
|
+
getWidgetsUrl(option: {
|
|
39
|
+
componentName: string;
|
|
40
|
+
chapter?: QuickAppDocWidgetType;
|
|
41
|
+
}): string;
|
|
42
|
+
createWidgetReferenceMessage(option: {
|
|
43
|
+
componentName: string;
|
|
44
|
+
chapter?: QuickAppDocWidgetType;
|
|
45
|
+
}): StyleMessage;
|
|
46
|
+
}
|
|
47
|
+
export declare class VelaAppDocHelp implements IDocHelp {
|
|
48
|
+
private HOST;
|
|
49
|
+
private categoryDic;
|
|
50
|
+
private findCategoryName;
|
|
51
|
+
getWidgetsUrl(option: {
|
|
52
|
+
componentName: string;
|
|
53
|
+
chapter?: QuickAppDocWidgetType;
|
|
54
|
+
}): string;
|
|
55
|
+
createWidgetReferenceMessage(option: {
|
|
56
|
+
componentName: string;
|
|
57
|
+
chapter?: QuickAppDocWidgetType;
|
|
58
|
+
}): StyleMessage;
|
|
59
|
+
}
|
|
60
|
+
export declare enum QuickAppDocWidgetType {
|
|
61
|
+
ATTRIBUTE = "\u5C5E\u6027",
|
|
62
|
+
STYLE = "\u6837\u5F0F",
|
|
63
|
+
EVENT = "\u4E8B\u4EF6"
|
|
64
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VelaAppDocHelp = exports.QuickAppDocWidgetType = exports.QuickAppDocHelper = void 0;
|
|
7
|
+
var _ColorConsole = _interopRequireDefault(require("../ColorConsole"));
|
|
8
|
+
var _ILog = require("../interface/ILog");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/**
|
|
11
|
+
* 文档帮助
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
class QuickAppDocHelper {
|
|
15
|
+
HOST = 'https://doc.quickapp.cn';
|
|
16
|
+
getWidgetsUrl(option) {
|
|
17
|
+
const {
|
|
18
|
+
componentName,
|
|
19
|
+
chapter
|
|
20
|
+
} = option;
|
|
21
|
+
return `${this.HOST}/widgets/${componentName}.html${chapter ? `#${chapter}` : ''}`;
|
|
22
|
+
}
|
|
23
|
+
createWidgetReferenceMessage(option) {
|
|
24
|
+
return {
|
|
25
|
+
word: `(Reference: ${this.getWidgetsUrl(option)})`,
|
|
26
|
+
style: {
|
|
27
|
+
..._ColorConsole.default.getStyle(_ILog.Loglevel.INFO),
|
|
28
|
+
italic: true,
|
|
29
|
+
bold: true
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.QuickAppDocHelper = QuickAppDocHelper;
|
|
35
|
+
class VelaAppDocHelp {
|
|
36
|
+
HOST = 'https://iot.mi.com/vela/quickapp';
|
|
37
|
+
categoryDic = {
|
|
38
|
+
container: ['div', 'list', 'list-item', 'scroll', 'stack', 'swiper'],
|
|
39
|
+
basic: ['text', 'span', 'a', 'image', 'image-animator', 'progress', 'marquee', 'chart', 'qrcode', 'barcode'],
|
|
40
|
+
form: ['input', 'picker', 'switch', 'slider']
|
|
41
|
+
};
|
|
42
|
+
findCategoryName(componentName) {
|
|
43
|
+
for (let key in this.categoryDic) {
|
|
44
|
+
if (this.categoryDic[key].includes(componentName)) {
|
|
45
|
+
return key;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
getWidgetsUrl(option) {
|
|
51
|
+
const {
|
|
52
|
+
componentName,
|
|
53
|
+
chapter
|
|
54
|
+
} = option;
|
|
55
|
+
const componentCategory = this.findCategoryName(componentName);
|
|
56
|
+
return `${this.HOST}/zh/components/${componentCategory}/${componentName}.html${chapter ? `#${chapter}` : ''}`;
|
|
57
|
+
}
|
|
58
|
+
createWidgetReferenceMessage(option) {
|
|
59
|
+
return {
|
|
60
|
+
word: `(Reference: ${this.getWidgetsUrl(option)})`,
|
|
61
|
+
style: {
|
|
62
|
+
..._ColorConsole.default.getStyle(_ILog.Loglevel.INFO),
|
|
63
|
+
italic: true,
|
|
64
|
+
bold: true
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.VelaAppDocHelp = VelaAppDocHelp;
|
|
70
|
+
let QuickAppDocWidgetType = exports.QuickAppDocWidgetType = /*#__PURE__*/function (QuickAppDocWidgetType) {
|
|
71
|
+
QuickAppDocWidgetType["ATTRIBUTE"] = "\u5C5E\u6027";
|
|
72
|
+
QuickAppDocWidgetType["STYLE"] = "\u6837\u5F0F";
|
|
73
|
+
QuickAppDocWidgetType["EVENT"] = "\u4E8B\u4EF6";
|
|
74
|
+
return QuickAppDocWidgetType;
|
|
75
|
+
}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/shared-utils",
|
|
3
|
-
"version": "2.0.3-beta.
|
|
3
|
+
"version": "2.0.3-beta.14",
|
|
4
4
|
"description": "The common method functions of the aiot-toolkit.",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@types/minimatch": "^5.1.2",
|
|
43
43
|
"@types/qrcode": "^1.5.5"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "5279c4e8b9ee65f5d578a1d656b852163f3efb4d"
|
|
46
46
|
}
|