diff --git a/core/market/browser/package-lock.json b/core/market/browser/package-lock.json index 92abaf704..be706a0fc 100644 --- a/core/market/browser/package-lock.json +++ b/core/market/browser/package-lock.json @@ -1919,6 +1919,29 @@ "webpack-merge": "^5.7.3", "webpack-virtual-modules": "^0.4.2", "whatwg-fetch": "^3.6.2" + }, + "dependencies": { + "@vue/vue-loader-v15": { + "version": "npm:vue-loader@15.9.8", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.8.tgz", + "integrity": "sha512-GwSkxPrihfLR69/dSV3+5CdMQ0D+jXg8Ma1S4nQXKJAznYFX14vHdc/NetQc34Dw+rBbIJyP7JOuVb9Fhprvog==", + "dev": true, + "requires": { + "@vue/component-compiler-utils": "^3.1.0", + "hash-sum": "^1.0.2", + "loader-utils": "^1.1.0", + "vue-hot-reload-api": "^2.3.0", + "vue-style-loader": "^4.1.0" + }, + "dependencies": { + "hash-sum": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz", + "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=", + "dev": true + } + } + } } }, "@vue/cli-shared-utils": { @@ -2182,27 +2205,6 @@ "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.31.tgz", "integrity": "sha512-ymN2pj6zEjiKJZbrf98UM2pfDd6F2H7ksKw7NDt/ZZ1fh5Ei39X5tABugtT03ZRlWd9imccoK0hE8hpjpU7irQ==" }, - "@vue/vue-loader-v15": { - "version": "npm:vue-loader@15.9.8", - "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.8.tgz", - "integrity": "sha512-GwSkxPrihfLR69/dSV3+5CdMQ0D+jXg8Ma1S4nQXKJAznYFX14vHdc/NetQc34Dw+rBbIJyP7JOuVb9Fhprvog==", - "dev": true, - "requires": { - "@vue/component-compiler-utils": "^3.1.0", - "hash-sum": "^1.0.2", - "loader-utils": "^1.1.0", - "vue-hot-reload-api": "^2.3.0", - "vue-style-loader": "^4.1.0" - }, - "dependencies": { - "hash-sum": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz", - "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=", - "dev": true - } - } - }, "@vue/web-component-wrapper": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@vue/web-component-wrapper/-/web-component-wrapper-1.3.0.tgz", diff --git a/src/app/pages/api/edit/header/api-edit-header.component.html b/src/app/pages/api/edit/header/api-edit-header.component.html deleted file mode 100644 index 64a378036..000000000 --- a/src/app/pages/api/edit/header/api-edit-header.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
- -
- diff --git a/src/app/pages/api/edit/query/api-edit-query.component.html b/src/app/pages/api/edit/query/api-edit-query.component.html deleted file mode 100644 index 28cb1b4c4..000000000 --- a/src/app/pages/api/edit/query/api-edit-query.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
- -
- diff --git a/src/app/pages/api/test/header/api-test-header.component.html b/src/app/pages/api/test/header/api-test-header.component.html deleted file mode 100644 index 64a378036..000000000 --- a/src/app/pages/api/test/header/api-test-header.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
- -
- diff --git a/src/app/pages/api/test/query/api-test-query.component.html b/src/app/pages/api/test/query/api-test-query.component.html deleted file mode 100644 index 28cb1b4c4..000000000 --- a/src/app/pages/api/test/query/api-test-query.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
- -
- diff --git a/src/app/shared/components/params-import/params-import.component.html b/src/app/shared/components/params-import/params-import.component.html deleted file mode 100644 index 118006402..000000000 --- a/src/app/shared/components/params-import/params-import.component.html +++ /dev/null @@ -1,37 +0,0 @@ - - - 导入 - - - - - -
- -
-
- - - - -
-
diff --git a/src/app/shared/components/params-import/params-import.component.ts b/src/app/shared/components/params-import/params-import.component.ts deleted file mode 100644 index 8125bf982..000000000 --- a/src/app/shared/components/params-import/params-import.component.ts +++ /dev/null @@ -1,133 +0,0 @@ -import { Component, Input, Output, EventEmitter } from '@angular/core'; -import { NzMessageService } from 'ng-zorro-antd/message'; -import { whatType } from '../../../utils'; -import { flatData } from '../../../utils/tree/tree.utils'; -import * as qs from 'qs'; -import { form2json, parseTree, xml2UiData, isXML } from '../../../utils/data-transfer/data-transfer.utils'; -@Component({ - selector: 'params-import', - templateUrl: './params-import.component.html', - styleUrls: ['./params-import.component.scss'], -}) -export class ParamsImportComponent { - @Input() rootType: 'array' | string | 'object' = 'object'; - @Input() contentType = 'json'; - @Input() baseData: object[] = []; - @Input() modalTitle: string = ''; - @Output() baseDataChange = new EventEmitter(); - isVisible = false; - paramCode = ''; - constructor(private message: NzMessageService) {} - - get contentTypeTitle() { - switch (this.contentType) { - case 'xml': - return 'XML'; - case 'json': - return 'JSON'; - case 'formData': - return '表单'; - default: - return ''; - } - } - - get contenTypeEditor() { - switch (this.contentType) { - case 'formData': - case 'query': - return 'text'; - default: - return this.contentType; - } - } - - showModal(type): void { - this.isVisible = true; - } - - handleImport(type: string): void { - if (this.paramCode === '') { - this.handleCancel(); - return; - } - let paramCode = null; - if (this.contentType === 'json') { - try { - paramCode = JSON.parse(this.paramCode); - } catch (error) { - this.message.error('JSON格式不合法'); - return; - } - } - if (this.contentType === 'formData') { - const json = {}; - form2json(this.paramCode).forEach((it) => { - const { key, value } = it; - json[key] = value; - }); - paramCode = JSON.parse(JSON.stringify(json)); - } - if (this.contentType === 'xml') { - const status = isXML(this.paramCode); - if (!status) { - this.message.error('XML格式不合法'); - return; - } - paramCode = JSON.parse(JSON.stringify(xml2UiData(this.paramCode))); - // console.log('-->', paramCode); - } - if (this.contentType === 'query') { - paramCode = qs.parse(this.paramCode.split('?')[1]); - // console.log('-->', paramCode); - } - if (this.contentType === 'raw') { - paramCode = this.paramCode; - } - - const tailData = this.baseData.slice(-1); - let resultData = JSON.parse(JSON.stringify(this.baseData.reverse().slice(1).reverse())); - if (this.rootType !== whatType(paramCode)) { - // TODO Perhaps should be handled about format compatibility later. - console.warn('The code that you input is no-equal to the root type.'); - } - // if (whatType(paramCode) === 'object') { - // * transform to array of table format. - // } - if (this.rootType === 'array' && whatType(paramCode) === 'array') { - // * only select first data - const [data] = paramCode; - paramCode = data || {}; - } - // * tree to array for table render - const cacheData = flatData(Object.keys(paramCode).map((it) => parseTree(it, paramCode[it]))); - - // TODO delete useless attribute in cacheData - switch (type) { - case 'mixin': { - const nameList = resultData.map((it) => it.name); - const data = cacheData.filter((it) => !nameList.includes(it.name)); - resultData = resultData.concat(data); - break; - } - case 'overwrite': { - resultData = cacheData; - break; - } - case 'append': { - resultData = resultData.concat(cacheData); - break; - } - default: - break; - } - - this.baseDataChange.emit(resultData.concat(tailData)); - this.handleCancel(); - } - - handleCancel(): void { - this.paramCode = ''; - this.isVisible = false; - } -} diff --git a/tsconfig.json b/tsconfig.json index 9c4078e70..55825d5c4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,11 @@ "module": "commonjs", "target": "es5", "types": ["node"], - "lib": ["es2017", "es2016", "es2015", "dom"] + "lib": ["es2017", "es2016", "es2015", "dom"], + "baseUrl": "./", + "paths": { + "@utils/*": ["core/api-manager/browser/src/app/utils/*"] + } }, "include": ["**/**.ts"], "exclude": ["node_modules", "**/*.spec.ts", "**/browser/**/*.ts"],