merge confict

This commit is contained in:
scarqin 2022-07-14 18:40:35 +08:00
commit b9b7423c93
7 changed files with 404 additions and 80 deletions

View File

@ -1,8 +1,5 @@
<<<<<<< HEAD
<!-- Build app with a hardened runtime -->
<!-- see => https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/ -->
=======
>>>>>>> main
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

View File

@ -1,4 +1,3 @@
<<<<<<< HEAD
/**
* Use electron-notarize to notarize app
*
@ -9,8 +8,6 @@
* @link https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
*/
=======
>>>>>>> main
exports.default = function notarizing(context) {
return context;
};

View File

@ -73,4 +73,4 @@
"node-module-alias": {
"eo": "./out"
}
}
}

View File

@ -1,5 +1,5 @@
<div class="flex eo-api-script">
<div class="w-[240px] h-[322px] overflow-auto">
<div class="w-[340px] h-[322px] overflow-auto">
<div class="flex justify-between p-3">
<div i18n>Snippets</div>
<div>
@ -11,26 +11,31 @@
<nz-tree-node *nzTreeNodeDef="let node" nzTreeNodePadding>
<nz-tree-node-toggle nzTreeNodeNoopToggle></nz-tree-node-toggle>
<nz-tree-node-option [nzDisabled]="node.disabled" [nzSelected]="false" (nzClick)="insertCode(node)">
<span class="text-blue-400"> {{ node.name }}</span>
<span class="text-sm text-blue-400"> {{ node.name }}</span>
<ng-container *ngIf="node.note">
<span [nzTooltipTitle]="titleTemplate" [nzTooltipPlacement]="['topLeft', 'leftTop']" class="text-blue-400"
nzTooltipColor="black" nz-tooltip>
<span
[nzTooltipTitle]="titleTemplate"
[nzTooltipPlacement]="['topLeft', 'leftTop']"
class="text-blue-400"
nzTooltipColor="black"
nz-tooltip
>
[?]
</span>
<ng-template #titleTemplate let-thing>
<p style="color:#99c6da" *ngIf="node.note.code">{{ node.note.code }}</p>
<p *ngIf="node.note.desc">{{node.note.desc}}</p>
<p style="color: #99c6da" *ngIf="node.note.code">{{ node.note.code }}</p>
<p *ngIf="node.note.desc">{{ node.note.desc }}</p>
<ng-container *ngIf="node.note.input">
<br />
<p style="color:#999" i18n>---input---</p>
<p style="color: #999" i18n>---input---</p>
<p *ngFor="let item of node.note.input">
<span style="color:#ff9800">{{item.key}}</span>{{item.value}}
<span style="color: #ff9800">{{ item.key }}</span>{{ item.value }}
</p>
</ng-container>
<ng-container *ngIf="node.note.output">
<br />
<p style="color:#999" i18n>---return---</p>
<p>{{node.note.output}}</p>
<p style="color: #999" i18n>---return---</p>
<p>{{ node.note.output }}</p>
</ng-container>
</ng-template>
</ng-container>
@ -47,9 +52,13 @@
</nz-tree-node>
</nz-tree-view>
</div>
<div class="flex-1 ">
<eo-editor [(code)]="code" editorType="javascript" [eventList]="[ 'format', 'copy', 'search', 'replace']"
(codeChange)="handleChange($event)">
<div class="flex-1">
<eo-editor
[(code)]="code"
editorType="javascript"
[eventList]="['format', 'copy', 'search', 'replace']"
(codeChange)="handleChange($event)"
>
</eo-editor>
</div>
</div>

View File

@ -7,7 +7,7 @@ import { EoEditorComponent } from 'eo/workbench/browser/src/app/eoui/editor/eo-e
import { NzTreeFlatDataSource, NzTreeFlattener } from 'ng-zorro-antd/tree-view';
import type { TreeNode, FlatNode } from './constant';
import { TREE_DATA } from './constant';
import { BEFORE_DATA } from './constant';
@Component({
selector: 'eo-api-script',
templateUrl: './api-script.component.html',
@ -43,7 +43,7 @@ export class ApiScriptComponent implements OnInit {
dataSource = new NzTreeFlatDataSource(this.treeControl, this.treeFlattener);
constructor() {
this.dataSource.setData(TREE_DATA);
this.dataSource.setData(BEFORE_DATA);
this.treeControl.expandAll();
}

View File

@ -22,7 +22,331 @@ export interface FlatNode extends TreeNode {
export type Completion = { caption: string; value: string };
export const TREE_DATA: TreeNode[] = [
const COMMON_DATA: TreeNode[] = [
{
name: $localize`Encode & Decode`, // 编解码
children: [
{
name: $localize`JSON Encode`, // JSON 编码
caption: 'eo.json.encode',
value: 'eo.json.encode(json_object)',
note: {
code: 'eo.json.encode(json_object)',
desc: $localize`JSON Encode`, // JSON 编码
input: [{ key: 'json_object', value: $localize`JSON object` }], // 待 JSON 序列化处理的对象
output: $localize`JSON string`, // JSON字符串
},
},
{
name: $localize`JSON Decode`, // JSON 解码
caption: 'json.decode',
value: 'json.decode(json)',
note: {
code: 'json.decode(json)',
desc: $localize`JSON Decode`, // JSON 解码
input: [{ key: 'json', value: $localize`JSON string` }], // JSON 字符串
output: $localize`JSON object`, // JSON 反序列化处理后的对象
},
},
{
name: $localize`XML Encode`, // XML 编码
caption: 'xml.encode',
value: 'xml.encode(xml_object)',
note: {
code: 'xml.encode(xml_object)',
desc: $localize`XML code`, // XML 编码
input: [{ key: 'xml_object', value: $localize`XML code` }], // 待XML序列化处理的对象
output: $localize`XML string`, // XML 字符串
},
},
{
name: $localize`XML Decode`, // XML 解码
caption: 'xml.decode',
value: 'xml.decode(xml)',
note: {
code: 'xml.decode(xml)',
desc: $localize`XML code`, // XML 解码
input: [{ key: 'xml', value: $localize`XML string` }], // XML字符串
output: $localize`XML code`, // XML反序列化处理后的对象
},
},
{
name: $localize`Base64 Encode`, // Base64 编码
caption: 'base64.encode',
value: 'base64.encode(data)',
note: {
code: 'base64.encode(data)',
desc: $localize`Base64 Encode`, // Base64 编码
input: [{ key: 'data', value: $localize`string of wait for encode` }], // 待编码字符串
output: $localize`string after encode`, // 编码后字符串
},
},
{
name: $localize`Base64 Decode`, // Base64 解码
caption: 'base64.decode',
value: 'base64.decode(data)',
note: {
code: 'base64.decode(data)',
desc: $localize`Base64 Decode`, // Base64 解码
input: [{ key: 'data', value: $localize`string of wait for decode` }], // 待解码字符串
output: $localize`string after decode`, // 解码后字符串
},
},
{
name: $localize`UrlEncode Encode`, // UrlEncode 编码
caption: 'eo.urlEncode',
value: 'eo.urlEncode(data)',
note: {
code: 'eo.urlEncode(data)',
desc: $localize`UrlEncode Encode`, // UrlEncode 编码
input: [{ key: 'data', value: $localize`string of wait for encode` }], // 待编码字符串
output: $localize`string after encode`, // 编码后字符串
},
},
{
name: $localize`UrlEncode Decode`, // UrlEncode 解码
caption: 'eo.urlDecode',
value: 'eo.urlDecode(data)',
note: {
code: 'eo.urlDecode(data)',
desc: $localize`UrlEncode Decode`, // UrlEncode 解码
input: [{ key: 'data', value: $localize`string of wait for decode` }], // 待解码字符串
output: $localize`string after decode`, // 解码后字符串
},
},
{
name: $localize`Gzip zip`, // gzip 压缩
caption: 'eo.gzip.zip',
value: 'eo.gzip.zip(data)',
note: {
code: 'eo.gzip.zip(data)',
desc: $localize`Gzip zip`, // gzip 压缩
input: [{ key: 'data', value: $localize`string of wait for zip` }], // 待压缩字符串
output: $localize`string after zip`, // 压缩后字符串
},
},
{
name: $localize`Gzip unzip`, // gzip 解压
caption: 'eo.gzip.unzip',
value: 'eo.gzip.unzip(data)',
note: {
code: 'eo.gzip.unzip(data)',
desc: $localize`Gzip unzip`, // gzip 解压缩
input: [{ key: 'data', value: $localize`string of wait for unzip` }], // 待解压字符串
output: $localize`string after unzip`, // 解压后字符串
},
},
{
name: $localize`Deflate zip`, // deflate 压缩
caption: 'eo.deflate.zip',
value: 'eo.deflate.zip(data)',
note: {
code: 'eo.deflate.zip(data)',
desc: $localize`Deflate zip`, // deflate 压缩
input: [{ key: 'data', value: $localize`string of wait for zip` }], // 待压缩字符串
output: $localize`string after zip`, // 压缩后字符串
},
},
{
name: $localize`Deflate unzip`, // deflate 解压
caption: 'eo.deflate.unzip',
value: 'eo.deflate.unzip(data)',
note: {
code: 'eo.deflate.unzip(data)',
desc: $localize`Deflate unzip`, // deflate 解压缩
input: [{ key: 'data', value: $localize`string of wait for unzip` }], // 待解压字符串
output: $localize`string after unzip`, // 解压后字符串
},
},
],
},
];
export const BEFORE_DATA: TreeNode[] = [
...COMMON_DATA,
{
name: $localize`HTTP API request`,
children: [
{
name: $localize`Set Request URL`, // 设置请求地址
caption: 'eo.http.url.set',
value: 'eo.http.url.set("new_url")',
note: {
code: 'eo.http.url.set("new_url")',
desc: $localize`Set HTTP API request path`, // 设置 HTTP API 的请求路径
input: [{ key: 'new_url', value: $localize`new url` }], // 新的请求路径
},
},
{
name: $localize`Set Header`, // 设置 Header 参数
caption: 'eo.http.header.set',
value: 'eo.http.header.set("param_key","param_value")',
note: {
code: 'eo.http.header.set("param_key","param_value")',
desc: $localize`Set HTTP API request header params`, // 设置 HTTP API 的请求头部参数
input: [
{ key: 'param_key', value: $localize`params name` }, // 参数名
{ key: 'param_value', value: $localize`params value` }, // 参数值
],
},
},
{
name: $localize`Request body variable[Form-data/JSON/XML]`, //请求体变量[对象:表单/JSON/XML]
caption: 'eo.http.bodyParseParam',
value: 'eo.http.bodyParseParam',
},
{
name: $localize`Request body variable[Raw]`, //请求体变量[文本Raw]
caption: 'eo.http.bodyParam',
value: 'eo.http.bodyParam',
},
{
name: $localize`Set REST params`, //设置 REST 参数
caption: 'eo.http.rest.set',
value: 'eo.http.rest.set("param_key","param_value")',
note: {
code: 'eo.http.rest.set("param_key","param_value")',
desc: $localize`Set HTTP API REST params`, // 设置 HTTP API 的 REST 参数
input: [
{ key: 'param_key', value: $localize`params name` }, //参数名
{ key: 'param_value', value: $localize`params value` }, // 参数值
],
},
},
{
name: $localize`Set Query params`, // 设置 Query 参数
caption: 'eo.http.query.set',
value: 'eo.http.query.set("param_key","param_value")',
note: {
code: 'eo.http.query.set("param_key","param_value")',
desc: $localize`Set HTTP API Query params`, //设置 HTTP API 的 Query 参数
input: [
{ key: 'param_key', value: $localize`params name` }, //参数名
{ key: 'param_value', value: $localize`params value` }, // 参数值
],
},
},
{
name: $localize`Insert new API test[Form-data]`, //插入新 API 测试[Form-data]
caption: '',
value: `//定义需要测试的API
var formdata_api_demo_1 = {
"url": "https://api.eolink.com", //[必填][string]请求地址,若不存在请求协议默认http
"name": "FORM-DATA API Demo", //[选填][string]API名称方便检索不填则默认为系统生成API编号
"method": "POST", //[选填][string],请求方式,可能值有[GET/POST/PUT/PATCH/DELETE/HEAD/OPTION],兼容大小写,默认为GET
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
}, //[选填][object],请求头部
"bodyType": "form-data", //[选填][string],请求体类型
"body": { //[选填][object],请求参数
"param_1": "value_1",
"param_2": "value_2"
},
"timelimit": 1000 //[选填],超时限制,单位为ms,超过时间则判断为请求失败默认为1000ms
};
//执行请求,返回格式为{time:"请求时间",code:"HTTP状态码",response:"返回结果",header:"返回头部"}
var formdata_api_demo_1_result = eo.execute(formdata_api_demo_1);
//判断返回结果
if (formdata_api_demo_1_result.response !== "") {
eo.info("info_1"); //输出信息
} else {
eo.info("info_2"); //输出信息
}`,
},
{
name: $localize`Insert new API test[JSON]`, // 插入新 API 测试[JSON]
caption: '',
value: `//定义需要测试的API
var json_api_demo_1 = {
"url": "https://api.eolink.com", //[必填][string]请求地址,若不存在请求协议默认http
"name": "JSON API Demo", //[选填][string]API名称方便检索不填则默认为系统生成API编号
"method": "POST", //[选填][string],请求方式,可能值有[GET/POST/PUT/PATCH/DELETE/HEAD/OPTION],兼容大小写,默认为GET
"headers": {
"Content-Type": "application/json"
}, //[选填][object],请求头部
"bodyType": "json", //[选填][string],请求体类型
"body": { //[选填][object],请求参数
"param_1": "value_1",
"param_2": "value_2"
},
"timelimit": 1000 //[选填],超时限制,单位为ms,超过时间则判断为请求失败默认为1000ms
};
//执行请求,返回格式为{time:"请求时间",code:"HTTP状态码",response:"返回结果",header:"返回头部"}
var json_api_demo_1_result = eo.execute(json_api_demo_1);
//判断返回结果
if (json_api_demo_1_result.response !== "") {
eo.info("info_1"); //输出信息
} else {
eo.info("info_2"); //输出信息
}`,
},
{
name: $localize`Insert new API test[XML]`, //插入新 API 测试[XML]
caption: '',
value: `//定义需要测试的API
var xml_api_demo_1 = {
"url": "https://api.eolink.com", //[必填][string]请求地址,若不存在请求协议默认http
"name": "XML API Demo", //[选填][string]API名称方便检索不填则默认为系统生成API编号
"method": "POST", //[选填][string],请求方式,可能值有[GET/POST/PUT/PATCH/DELETE/HEAD/OPTION],兼容大小写,默认为GET
"headers": {
"Content-Type": "application/xml"
}, //[选填][object],请求头部
"bodyType": "xml", //[选填][string],请求体类型
"body": { //[选填][object],请求参数
"root": {
"book":[
{
"name":"eolinker_book_1"
},
{
"name":"eolinker_book_2"
}
]
}
},
"timelimit": 1000 //[选填],超时限制,单位为ms,超过时间则判断为请求失败默认为1000ms
};
//执行请求,返回格式为{time:"请求时间",code:"HTTP状态码",response:"返回结果",header:"返回头部"}
var xml_api_demo_1_result = eo.execute(xml_api_demo_1);
//判断返回结果
if (xml_api_demo_1_result.response !== "") {
eo.info("info_1"); //输出信息
} else {
eo.info("info_2"); //输出信息
}`,
},
{
name: $localize`Insert new API test[Raw]`, //插入新 API 测试[Raw]
caption: '',
value: `//定义需要测试的API
var raw_api_demo_1 = {
"url": "https://api.eolink.com", //[必填][string]请求地址,若不存在请求协议默认http
"name": "RAW API Demo", //[选填][string]API名称方便检索不填则默认为系统生成API编号
"method": "POST", //[选填][string],请求方式,可能值有[GET/POST/PUT/PATCH/DELETE/HEAD/OPTION],兼容大小写,默认为GET
"headers": {
"Content-Type": "text/plain"
}, //[选填][object],请求头部
"bodyType": "raw", //[选填][string],请求体类型
"body": "hello world",
"timelimit": 1000 //[选填],超时限制,单位为ms,超过时间则判断为请求失败默认为1000ms
};
//执行请求,返回格式为{time:"请求时间",code:"HTTP状态码",response:"返回结果",header:"返回头部"}
var raw_api_demo_1_result = eo.execute(raw_api_demo_1);
//判断返回结果
if (raw_api_demo_1_result.response !== "") {
eo.info("info_1"); //输出信息
} else {
eo.info("info_2"); //输出信息
}`,
},
],
},
];
export const AFTER_DATA: TreeNode[] = [
...COMMON_DATA,
{
name: $localize`HTTP API request`,
children: [
@ -42,7 +366,7 @@ export const TREE_DATA: TreeNode[] = [
note: {
code: 'eo.http.response.set("response_value")',
desc: $localize`Set the response result of the HTTP API`,
input: [{ key: 'response_value', value: $localize`response result` }],
input: [{ key: 'response_value', value: $localize`response result` }],
},
},
],
@ -100,7 +424,7 @@ export const TREE_DATA: TreeNode[] = [
},
];
export const completions: Completion[] = TREE_DATA.flatMap((n) => n.children).reduce((prev, curr) => {
export const completions: Completion[] = AFTER_DATA.flatMap((n) => n.children).reduce((prev, curr) => {
const { caption, value } = curr;
if (caption) {
prev.push({ caption, value });

View File

@ -1,62 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Eoapi</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_12799_19.ba5ba4245a69248024047f0b7ba96bbb.js"></script>
<link rel="icon" type="image/x-icon" href="assets/icons/icon.ico" />
</head>
<!-- Angular Cli need for node modules -->
<script>
var global = global || window;
var Buffer = Buffer || [];
var process = process || {
env: { DEBUG: undefined },
version: [],
};
</script>
<head>
<meta charset="utf-8" />
<title>Eoapi</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script
src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_12799_18.e98aaa4d03d4378a3a2c18bfd1670872.js"></script>
<link rel="icon" type="image/x-icon" href="assets/icons/icon.ico" />
</head>
<!-- Angular Cli need for node modules -->
<script>
var global = global || window;
var Buffer = Buffer || [];
var process = process || {
env: { DEBUG: undefined },
version: [],
};
</script>
<body eo-drop-root>
<eo-root>
<div class="loading_container f_column">
<img src="assets/images/logo.svg" />
<div class="mt10 ant-spin ant-spin-spinning ant-spin-lg">
<span class="ant-spin-dot ant-spin-dot-spin ng-star-inserted">
<i class="ant-spin-dot-item"></i>
<i class="ant-spin-dot-item"></i>
<i class="ant-spin-dot-item"></i>
<i class="ant-spin-dot-item"></i>
</span>
<body eo-drop-root>
<eo-root>
<div class="loading_container f_column">
<img src="assets/images/logo.svg" />
<div class="mt10 ant-spin ant-spin-spinning ant-spin-lg">
<span class="ant-spin-dot ant-spin-dot-spin ng-star-inserted">
<i class="ant-spin-dot-item"></i>
<i class="ant-spin-dot-item"></i>
<i class="ant-spin-dot-item"></i>
<i class="ant-spin-dot-item"></i>
</span>
</div>
</div>
</div>
</eo-root>
<div id="mask"></div>
</body>
<style>
#mask {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 99999;
display: none;
}
</eo-root>
<div id="mask"></div>
</body>
<style>
#mask {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 99999;
display: none;
}
.loading_container {
position: absolute;
top: 40%;
left: 50%;
transform: translateX(-50%);
}
.loading_container img {
width: 200px;
}
</style>
.loading_container {
position: absolute;
top: 40%;
left: 50%;
transform: translateX(-50%);
}
.loading_container img {
width: 200px;
}
</style>
</html>