@things-factory/integration-ui 6.1.66 → 6.1.69
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/client/editors/{entity-editor.js → entity-editor.ts} +2 -2
- package/client/editors/{entity-selector.js → entity-selector.ts} +45 -57
- package/client/editors/{property-editor.js → property-editor.ts} +1 -0
- package/client/editors/{things-editor-entity-selector.js → things-editor-entity-selector.ts} +27 -31
- package/client/editors/{things-editor-http-body.js → things-editor-http-body.ts} +43 -48
- package/client/editors/{things-editor-http-headers.js → things-editor-http-headers.ts} +48 -58
- package/client/editors/{things-editor-http-parameters.js → things-editor-http-parameters.ts} +48 -58
- package/client/grist/{connection-selector.js → connection-selector.ts} +2 -2
- package/client/grist/{connector-selector.js → connector-selector.ts} +2 -2
- package/client/grist/{dynamic-selector.js → dynamic-selector.ts} +9 -7
- package/client/grist/{task-type-selector.js → task-type-selector.ts} +4 -2
- package/client/index.ts +2 -0
- package/client/pages/{connection.js → connection.ts} +38 -44
- package/client/pages/{integration-monitor.js → integration-monitor.ts} +54 -56
- package/client/pages/{scenario-detail.js → scenario-detail.ts} +41 -47
- package/client/pages/scenario-importer.ts +107 -0
- package/client/pages/{scenario.js → scenario.ts} +14 -20
- package/client/viewparts/{connections-monitor.js → connections-monitor.ts} +76 -82
- package/client/viewparts/{monitoring-summary.js → monitoring-summary.ts} +55 -61
- package/client/viewparts/{pending-q-monitor.js → pending-q-monitor.ts} +110 -114
- package/client/viewparts/{scenario-instance-log-view.js → scenario-instance-log-view.ts} +31 -35
- package/client/viewparts/{scenario-instance-monitor.js → scenario-instance-monitor.ts} +67 -73
- package/client/viewparts/{scenario-instance-view.js → scenario-instance-view.ts} +100 -104
- package/client/viewparts/{scenario-monitor.js → scenario-monitor.ts} +143 -149
- package/client/viewparts/scenarios-monitor.ts +147 -0
- package/dist-client/bootstrap.d.ts +4 -0
- package/dist-client/bootstrap.js +29 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/editors/entity-editor.d.ts +10 -0
- package/dist-client/editors/entity-editor.js +47 -0
- package/dist-client/editors/entity-editor.js.map +1 -0
- package/dist-client/editors/entity-selector.d.ts +34 -0
- package/dist-client/editors/entity-selector.js +305 -0
- package/dist-client/editors/entity-selector.js.map +1 -0
- package/dist-client/editors/property-editor.d.ts +20 -0
- package/dist-client/editors/property-editor.js +61 -0
- package/dist-client/editors/property-editor.js.map +1 -0
- package/dist-client/editors/things-editor-entity-selector.d.ts +15 -0
- package/dist-client/editors/things-editor-entity-selector.js +87 -0
- package/dist-client/editors/things-editor-entity-selector.js.map +1 -0
- package/dist-client/editors/things-editor-http-body.d.ts +22 -0
- package/dist-client/editors/things-editor-http-body.js +130 -0
- package/dist-client/editors/things-editor-http-body.js.map +1 -0
- package/dist-client/editors/things-editor-http-headers.d.ts +29 -0
- package/dist-client/editors/things-editor-http-headers.js +160 -0
- package/dist-client/editors/things-editor-http-headers.js.map +1 -0
- package/dist-client/editors/things-editor-http-parameters.d.ts +29 -0
- package/dist-client/editors/things-editor-http-parameters.js +160 -0
- package/dist-client/editors/things-editor-http-parameters.js.map +1 -0
- package/dist-client/grist/connection-selector.d.ts +5 -0
- package/dist-client/grist/connection-selector.js +31 -0
- package/dist-client/grist/connection-selector.js.map +1 -0
- package/dist-client/grist/connector-selector.d.ts +5 -0
- package/dist-client/grist/connector-selector.js +31 -0
- package/dist-client/grist/connector-selector.js.map +1 -0
- package/dist-client/grist/dynamic-selector.d.ts +8 -0
- package/dist-client/grist/dynamic-selector.js +33 -0
- package/dist-client/grist/dynamic-selector.js.map +1 -0
- package/dist-client/grist/task-type-selector.d.ts +7 -0
- package/dist-client/grist/task-type-selector.js +58 -0
- package/dist-client/grist/task-type-selector.js.map +1 -0
- package/dist-client/index.d.ts +2 -0
- package/dist-client/index.js +3 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/connection.d.ts +53 -0
- package/dist-client/pages/connection.js +428 -0
- package/dist-client/pages/connection.js.map +1 -0
- package/dist-client/pages/integration-monitor.d.ts +28 -0
- package/dist-client/pages/integration-monitor.js +340 -0
- package/dist-client/pages/integration-monitor.js.map +1 -0
- package/dist-client/pages/scenario-detail.d.ts +1 -0
- package/dist-client/pages/scenario-detail.js +303 -0
- package/dist-client/pages/scenario-detail.js.map +1 -0
- package/dist-client/pages/scenario-importer.d.ts +9 -0
- package/dist-client/pages/scenario-importer.js +116 -0
- package/dist-client/pages/scenario-importer.js.map +1 -0
- package/dist-client/pages/scenario.d.ts +68 -0
- package/dist-client/pages/scenario.js +581 -0
- package/dist-client/pages/scenario.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +14 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/viewparts/connections-monitor.d.ts +10 -0
- package/dist-client/viewparts/connections-monitor.js +169 -0
- package/dist-client/viewparts/connections-monitor.js.map +1 -0
- package/dist-client/viewparts/monitoring-summary.d.ts +12 -0
- package/dist-client/viewparts/monitoring-summary.js +135 -0
- package/dist-client/viewparts/monitoring-summary.js.map +1 -0
- package/dist-client/viewparts/pending-q-monitor.d.ts +17 -0
- package/dist-client/viewparts/pending-q-monitor.js +247 -0
- package/dist-client/viewparts/pending-q-monitor.js.map +1 -0
- package/dist-client/viewparts/scenario-instance-log-view.d.ts +21 -0
- package/dist-client/viewparts/scenario-instance-log-view.js +105 -0
- package/dist-client/viewparts/scenario-instance-log-view.js.map +1 -0
- package/dist-client/viewparts/scenario-instance-monitor.d.ts +15 -0
- package/dist-client/viewparts/scenario-instance-monitor.js +171 -0
- package/dist-client/viewparts/scenario-instance-monitor.js.map +1 -0
- package/dist-client/viewparts/scenario-instance-view.d.ts +29 -0
- package/dist-client/viewparts/scenario-instance-view.js +263 -0
- package/dist-client/viewparts/scenario-instance-view.js.map +1 -0
- package/dist-client/viewparts/scenario-monitor.d.ts +16 -0
- package/dist-client/viewparts/scenario-monitor.js +288 -0
- package/dist-client/viewparts/scenario-monitor.js.map +1 -0
- package/dist-client/viewparts/scenarios-monitor.d.ts +16 -0
- package/dist-client/viewparts/scenarios-monitor.js +167 -0
- package/dist-client/viewparts/scenarios-monitor.js.map +1 -0
- package/package.json +10 -7
- package/client/index.js +0 -0
- package/client/pages/scenario-importer.js +0 -118
- package/client/viewparts/scenarios-monitor.js +0 -153
- /package/client/{bootstrap.js → bootstrap.ts} +0 -0
- /package/client/{route.js → route.ts} +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import './things-editor-http-headers';
|
|
5
|
+
import './things-editor-http-parameters';
|
|
6
|
+
import './things-editor-http-body';
|
|
7
|
+
import { html } from 'lit';
|
|
8
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
|
9
|
+
export class PropertyEditorScenarioStepInput extends OxPropertyEditor {
|
|
10
|
+
static get styles() {
|
|
11
|
+
return [...OxPropertyEditor.styles];
|
|
12
|
+
}
|
|
13
|
+
editorTemplate(value, spec) {
|
|
14
|
+
/* context must be a datagrid(grist) instance, and host must be a record */
|
|
15
|
+
const { context: grid, host: record } = spec;
|
|
16
|
+
const steps = (grid === null || grid === void 0 ? void 0 : grid.dirtyData.records.filter(rec => rec.name !== record.name).map(rec => rec.name)) || [];
|
|
17
|
+
return html `
|
|
18
|
+
<input id="editor" .value=${value || ''} list="step-list" />
|
|
19
|
+
<datalist id="step-list">${steps.map(id => html ` <option value=${id}></option> `)}</datalist>
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
customElements.define('property-editor-scenario-step-input', PropertyEditorScenarioStepInput);
|
|
24
|
+
export class PropertyEditorHttpHeaders extends OxPropertyEditor {
|
|
25
|
+
static get styles() {
|
|
26
|
+
return [...OxPropertyEditor.styles];
|
|
27
|
+
}
|
|
28
|
+
editorTemplate(value, spec) {
|
|
29
|
+
return html `
|
|
30
|
+
<things-editor-http-headers id="editor" .value=${value} .properties=${spec.property}></things-editor-http-headers>
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
customElements.define('property-editor-http-headers', PropertyEditorHttpHeaders);
|
|
35
|
+
export class PropertyEditorHttpParameters extends OxPropertyEditor {
|
|
36
|
+
static get styles() {
|
|
37
|
+
return [...OxPropertyEditor.styles];
|
|
38
|
+
}
|
|
39
|
+
editorTemplate(value, spec) {
|
|
40
|
+
return html `
|
|
41
|
+
<things-editor-http-parameters
|
|
42
|
+
id="editor"
|
|
43
|
+
.value=${value}
|
|
44
|
+
.properties=${spec.property}
|
|
45
|
+
></things-editor-http-parameters>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
customElements.define('property-editor-http-parameters', PropertyEditorHttpParameters);
|
|
50
|
+
export class PropertyEditorHttpBody extends OxPropertyEditor {
|
|
51
|
+
static get styles() {
|
|
52
|
+
return [...OxPropertyEditor.styles];
|
|
53
|
+
}
|
|
54
|
+
editorTemplate(value, spec) {
|
|
55
|
+
return html `
|
|
56
|
+
<things-editor-http-body id="editor" .value=${value} .properties=${spec.property}></things-editor-http-body>
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
customElements.define('property-editor-http-body', PropertyEditorHttpBody);
|
|
61
|
+
//# sourceMappingURL=property-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-editor.js","sourceRoot":"","sources":["../../client/editors/property-editor.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,8BAA8B,CAAA;AACrC,OAAO,iCAAiC,CAAA;AACxC,OAAO,2BAA2B,CAAA;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D,MAAM,OAAO,+BAAgC,SAAQ,gBAAgB;IACnE,MAAM,KAAK,MAAM;QACf,OAA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I,CAAC,QAAQ;;KAE9B,CAAA;IACH,CAAC;CACF;AAED,cAAc,CAAC,MAAM,CAAC,iCAAiC,EAAE,4BAA4B,CAAC,CAAA;AAEtF,MAAM,OAAO,sBAAuB,SAAQ,gBAAgB;IAC1D,MAAM,KAAK,MAAM;QACf,OAAO,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC;IAED,cAAc,CAAC,KAAK,EAAE,IAAI;QACxB,OAAO,IAAI,CAAA;oDACqC,KAAK,gBAAgB,IAAI,CAAC,QAAQ;KACjF,CAAA;IACH,CAAC;CACF;AAED,cAAc,CAAC,MAAM,CAAC,2BAA2B,EAAE,sBAAsB,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport './things-editor-http-headers'\nimport './things-editor-http-parameters'\nimport './things-editor-http-body'\n\nimport { html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from '@operato/property-editor'\n\nexport class PropertyEditorScenarioStepInput extends OxPropertyEditor {\n static get styles() {\n return [...OxPropertyEditor.styles]\n }\n\n editorTemplate(value, spec) {\n /* context must be a datagrid(grist) instance, and host must be a record */\n const { context: grid, host: record } = spec\n const steps = grid?.dirtyData.records.filter(rec => rec.name !== record.name).map(rec => rec.name) || []\n\n return html`\n <input id=\"editor\" .value=${value || ''} list=\"step-list\" />\n <datalist id=\"step-list\">${steps.map(id => html` <option value=${id}></option> `)}</datalist>\n `\n }\n}\n\ncustomElements.define('property-editor-scenario-step-input', PropertyEditorScenarioStepInput)\n\nexport class PropertyEditorHttpHeaders extends OxPropertyEditor {\n static get styles() {\n return [...OxPropertyEditor.styles]\n }\n\n editorTemplate(value, spec) {\n return html`\n <things-editor-http-headers id=\"editor\" .value=${value} .properties=${spec.property}></things-editor-http-headers>\n `\n }\n}\n\ncustomElements.define('property-editor-http-headers', PropertyEditorHttpHeaders)\n\nexport class PropertyEditorHttpParameters extends OxPropertyEditor {\n static get styles() {\n return [...OxPropertyEditor.styles]\n }\n\n editorTemplate(value, spec) {\n return html`\n <things-editor-http-parameters\n id=\"editor\"\n .value=${value}\n .properties=${spec.property}\n ></things-editor-http-parameters>\n `\n }\n}\n\ncustomElements.define('property-editor-http-parameters', PropertyEditorHttpParameters)\n\nexport class PropertyEditorHttpBody extends OxPropertyEditor {\n static get styles() {\n return [...OxPropertyEditor.styles]\n }\n\n editorTemplate(value, spec) {\n return html`\n <things-editor-http-body id=\"editor\" .value=${value} .properties=${spec.property}></things-editor-http-body>\n `\n }\n}\n\ncustomElements.define('property-editor-http-body', PropertyEditorHttpBody)\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import '@material/mwc-icon';
|
|
5
|
+
import './entity-selector';
|
|
6
|
+
import { LitElement } from 'lit';
|
|
7
|
+
export default class ThingsEditorEntitySelector extends LitElement {
|
|
8
|
+
static styles: import("lit").CSSResult[];
|
|
9
|
+
value?: string;
|
|
10
|
+
properties: any;
|
|
11
|
+
popup: any;
|
|
12
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
13
|
+
_onInputChanged(e: any): void;
|
|
14
|
+
openSelector(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate, __metadata } from "tslib";
|
|
5
|
+
import '@material/mwc-icon';
|
|
6
|
+
import './entity-selector';
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
+
import { i18next } from '@operato/i18n';
|
|
10
|
+
import { openPopup } from '@operato/layout';
|
|
11
|
+
let ThingsEditorEntitySelector = class ThingsEditorEntitySelector extends LitElement {
|
|
12
|
+
render() {
|
|
13
|
+
return html `
|
|
14
|
+
<input id="text" type="text" .value=${this.value || ''} @change=${e => this._onInputChanged(e)} />
|
|
15
|
+
|
|
16
|
+
<mwc-icon @click=${e => this.openSelector()}>dashboard</mwc-icon>
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
_onInputChanged(e) {
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
this.value = e.target.value;
|
|
22
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
23
|
+
bubbles: true,
|
|
24
|
+
composed: true
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
openSelector() {
|
|
28
|
+
if (this.popup) {
|
|
29
|
+
delete this.popup;
|
|
30
|
+
}
|
|
31
|
+
var template = html `
|
|
32
|
+
<entity-selector
|
|
33
|
+
.creatable=${true}
|
|
34
|
+
.queryName=${this.properties.queryName}
|
|
35
|
+
.value=${this.value}
|
|
36
|
+
@entity-selected=${e => {
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
var entity = e.detail.entity;
|
|
39
|
+
this.value = entity[this.properties.valueKey || 'id'];
|
|
40
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
41
|
+
bubbles: true,
|
|
42
|
+
composed: true
|
|
43
|
+
}));
|
|
44
|
+
this.popup && this.popup.close();
|
|
45
|
+
}}
|
|
46
|
+
></entity-selector>
|
|
47
|
+
`;
|
|
48
|
+
this.popup = openPopup(template, {
|
|
49
|
+
backdrop: true,
|
|
50
|
+
size: 'large',
|
|
51
|
+
title: i18next.t('title.select entity')
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
ThingsEditorEntitySelector.styles = [
|
|
56
|
+
css `
|
|
57
|
+
:host {
|
|
58
|
+
position: relative;
|
|
59
|
+
display: inline-block;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
input[type='text'] {
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
width: 100%;
|
|
65
|
+
height: 100%;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
mwc-icon {
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: 0;
|
|
71
|
+
right: 0;
|
|
72
|
+
}
|
|
73
|
+
`
|
|
74
|
+
];
|
|
75
|
+
__decorate([
|
|
76
|
+
property({ type: String }),
|
|
77
|
+
__metadata("design:type", String)
|
|
78
|
+
], ThingsEditorEntitySelector.prototype, "value", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
property({ type: Object }),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], ThingsEditorEntitySelector.prototype, "properties", void 0);
|
|
83
|
+
ThingsEditorEntitySelector = __decorate([
|
|
84
|
+
customElement('things-editor-entity-selector')
|
|
85
|
+
], ThingsEditorEntitySelector);
|
|
86
|
+
export default ThingsEditorEntitySelector;
|
|
87
|
+
//# sourceMappingURL=things-editor-entity-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"things-editor-entity-selector.js","sourceRoot":"","sources":["../../client/editors/things-editor-entity-selector.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,oBAAoB,CAAA;AAC3B,OAAO,mBAAmB,CAAA;AAE1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAG5B,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,UAAU;IA2BhE,MAAM;QACJ,OAAO,IAAI,CAAA;4CAC6B,IAAI,CAAC,KAAK,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;;yBAE3E,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE;KAC5C,CAAA;IACH,CAAC;IAED,eAAe,CAAC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DAAe;AAC1C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DAAgB;AAvBxB,0BAA0B;IAD9C,aAAa,CAAC,+BAA+B,CAAC;GAC1B,0BAA0B,CAiF9C;eAjFoB,0BAA0B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/mwc-icon'\nimport './entity-selector'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\n\n@customElement('things-editor-entity-selector')\nexport default class ThingsEditorEntitySelector extends LitElement {\n static styles = [\n css`\n :host {\n position: relative;\n display: inline-block;\n }\n\n input[type='text'] {\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n }\n\n mwc-icon {\n position: absolute;\n top: 0;\n right: 0;\n }\n `\n ]\n\n @property({ type: String }) value?: string\n @property({ type: Object }) properties: any\n\n popup: any\n\n render() {\n return html`\n <input id=\"text\" type=\"text\" .value=${this.value || ''} @change=${e => this._onInputChanged(e)} />\n\n <mwc-icon @click=${e => this.openSelector()}>dashboard</mwc-icon>\n `\n }\n\n _onInputChanged(e) {\n e.stopPropagation()\n\n this.value = e.target.value\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true\n })\n )\n }\n\n openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n var template = html`\n <entity-selector\n .creatable=${true}\n .queryName=${this.properties.queryName}\n .value=${this.value}\n @entity-selected=${e => {\n e.stopPropagation()\n\n var entity = e.detail.entity\n this.value = entity[this.properties.valueKey || 'id']\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true\n })\n )\n\n this.popup && this.popup.close()\n }}\n ></entity-selector>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.select entity')\n })\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { LitElement } from 'lit';
|
|
5
|
+
/**
|
|
6
|
+
http body editor element
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
|
|
10
|
+
<things-editor-http-body value=${map}>
|
|
11
|
+
</things-editor-http-body>
|
|
12
|
+
*/
|
|
13
|
+
export default class ThingsEditorHttpBody extends LitElement {
|
|
14
|
+
static styles: import("lit").CSSResult[];
|
|
15
|
+
value: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
};
|
|
18
|
+
firstUpdated(): void;
|
|
19
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
20
|
+
renderContentType(contentType: any): import("lit-html").TemplateResult<1>;
|
|
21
|
+
_onChange(e: any): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate, __metadata } from "tslib";
|
|
5
|
+
import { css, html, LitElement } from 'lit';
|
|
6
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
7
|
+
/**
|
|
8
|
+
http body editor element
|
|
9
|
+
|
|
10
|
+
Example:
|
|
11
|
+
|
|
12
|
+
<things-editor-http-body value=${map}>
|
|
13
|
+
</things-editor-http-body>
|
|
14
|
+
*/
|
|
15
|
+
let ThingsEditorHttpBody = class ThingsEditorHttpBody extends LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.value = {};
|
|
19
|
+
}
|
|
20
|
+
firstUpdated() {
|
|
21
|
+
this.renderRoot.addEventListener('change', this._onChange.bind(this));
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
var { kind = 'none', accessor = '', contentType } = this.value || {};
|
|
25
|
+
return html `
|
|
26
|
+
<div kind>
|
|
27
|
+
<input type="radio" id="none" name="kind" .checked=${kind == 'none'} value="none" />
|
|
28
|
+
<label for="none">none</label>
|
|
29
|
+
|
|
30
|
+
<input type="radio" id="form-data" name="kind" .checked=${kind == 'form-data'} value="form-data" disabled />
|
|
31
|
+
<label for="form-data">form-data</label>
|
|
32
|
+
|
|
33
|
+
<input
|
|
34
|
+
type="radio"
|
|
35
|
+
id="x-www-form-urlencoded"
|
|
36
|
+
name="kind"
|
|
37
|
+
.checked=${kind == 'x-www-form-urlencoded'}
|
|
38
|
+
value="x-www-form-urlencoded"
|
|
39
|
+
/>
|
|
40
|
+
<label for="x-www-form-urlencoded">x-www-form-urlencoded</label>
|
|
41
|
+
|
|
42
|
+
<input type="radio" id="raw" name="kind" .checked=${kind == 'raw'} value="raw" />
|
|
43
|
+
<label for="raw">raw</label>
|
|
44
|
+
|
|
45
|
+
<input type="radio" id="binary" name="kind" .checked=${kind == 'binary'} value="binary" disabled />
|
|
46
|
+
<label for="binary">binary</label>
|
|
47
|
+
|
|
48
|
+
<input type="radio" id="GraphQL" name="kind" .checked=${kind == 'GraphQL'} value="GraphQL" disabled />
|
|
49
|
+
<label for="GraphQL">GraphQL</label>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
${kind !== 'none'
|
|
53
|
+
? html `
|
|
54
|
+
${kind == 'raw' ? this.renderContentType(contentType) : html ``}
|
|
55
|
+
<div accessor>
|
|
56
|
+
<label for="accessor">accessor</label>
|
|
57
|
+
<input type="text" id="accessor" name="accessor" placeholder="accessor" .value=${accessor} />
|
|
58
|
+
</div>
|
|
59
|
+
`
|
|
60
|
+
: html ``}
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
renderContentType(contentType) {
|
|
64
|
+
return html `
|
|
65
|
+
<div>
|
|
66
|
+
<label>content-type</label>
|
|
67
|
+
<div>
|
|
68
|
+
<input type="radio" id="text" name="contentType" .checked=${contentType == 'text'} value="text" />
|
|
69
|
+
<label for="text">Text</label>
|
|
70
|
+
|
|
71
|
+
<input type="radio" id="json" name="contentType" .checked=${contentType == 'json'} value="json" disabled />
|
|
72
|
+
<label for="json">Json</label>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
|
+
_onChange(e) {
|
|
78
|
+
var input = e.target;
|
|
79
|
+
this.value = Object.assign(Object.assign({}, this.value), { [input.name]: input.value });
|
|
80
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
ThingsEditorHttpBody.styles = [
|
|
84
|
+
css `
|
|
85
|
+
:host {
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
align-content: center;
|
|
89
|
+
|
|
90
|
+
width: 100%;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
border: 1px solid #ccc;
|
|
93
|
+
margin: 5px 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
div {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-flow: row nowrap;
|
|
99
|
+
align-items: center;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
div[kind] {
|
|
103
|
+
border-bottom: 1px solid #aaa;
|
|
104
|
+
background-color: #ddd;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
div[accessor] {
|
|
108
|
+
background-color: #eee;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
label {
|
|
112
|
+
margin: 0 12px 0 3px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
#accessor {
|
|
116
|
+
flex: 1;
|
|
117
|
+
min-height: 20px;
|
|
118
|
+
margin: 2px;
|
|
119
|
+
}
|
|
120
|
+
`
|
|
121
|
+
];
|
|
122
|
+
__decorate([
|
|
123
|
+
property({ type: Object }),
|
|
124
|
+
__metadata("design:type", Object)
|
|
125
|
+
], ThingsEditorHttpBody.prototype, "value", void 0);
|
|
126
|
+
ThingsEditorHttpBody = __decorate([
|
|
127
|
+
customElement('things-editor-http-body')
|
|
128
|
+
], ThingsEditorHttpBody);
|
|
129
|
+
export default ThingsEditorHttpBody;
|
|
130
|
+
//# sourceMappingURL=things-editor-http-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"things-editor-http-body.js","sourceRoot":"","sources":["../../client/editors/things-editor-http-body.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAElE;;;;;;;EAOE;AAGa,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,UAAU;IAA7C;;QAyCe,UAAK,GAA8B,EAAE,CAAA;IAyEnE,CAAC;IAvEC,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACvE,CAAC;IAED,MAAM;QACJ,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAA;QAEpE,OAAO,IAAI,CAAA;;6DAE8C,IAAI,IAAI,MAAM;;;kEAGT,IAAI,IAAI,WAAW;;;;;;;qBAOhE,IAAI,IAAI,uBAAuB;;;;;4DAKQ,IAAI,IAAI,KAAK;;;+DAGV,IAAI,IAAI,QAAQ;;;gEAGf,IAAI,IAAI,SAAS;;;;QAIzE,IAAI,KAAK,MAAM;YACf,CAAC,CAAC,IAAI,CAAA;cACA,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA,EAAE;;;+FAGqB,QAAQ;;WAE5F;YACH,CAAC,CAAC,IAAI,CAAA,EAAE;KACX,CAAA;IACH,CAAC;IAED,iBAAiB,CAAC,WAAW;QAC3B,OAAO,IAAI,CAAA;;;;sEAIuD,WAAW,IAAI,MAAM;;;sEAGrB,WAAW,IAAI,MAAM;;;;KAItF,CAAA;IACH,CAAC;IAED,SAAS,CAAC,CAAC;QACT,IAAI,KAAK,GAAG,CAAC,CAAC,MAAM,CAAA;QAEpB,IAAI,CAAC,KAAK,mCACL,IAAI,CAAC,KAAK,KACb,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,KAAK,GAC1B,CAAA;QAED,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAClF,CAAC;;AAhHM,2BAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoCF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAsC;AAzC9C,oBAAoB;IADxC,aAAa,CAAC,yBAAyB,CAAC;GACpB,oBAAoB,CAkHxC;eAlHoB,oBAAoB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\n/**\nhttp body editor element\n\nExample:\n\n <things-editor-http-body value=${map}>\n </things-editor-http-body>\n*/\n\n@customElement('things-editor-http-body')\nexport default class ThingsEditorHttpBody extends LitElement {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n align-content: center;\n\n width: 100%;\n overflow: hidden;\n border: 1px solid #ccc;\n margin: 5px 0;\n }\n\n div {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n }\n\n div[kind] {\n border-bottom: 1px solid #aaa;\n background-color: #ddd;\n }\n\n div[accessor] {\n background-color: #eee;\n }\n\n label {\n margin: 0 12px 0 3px;\n }\n\n #accessor {\n flex: 1;\n min-height: 20px;\n margin: 2px;\n }\n `\n ]\n\n @property({ type: Object }) value: { [key: string]: string } = {}\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n render() {\n var { kind = 'none', accessor = '', contentType } = this.value || {}\n\n return html`\n <div kind>\n <input type=\"radio\" id=\"none\" name=\"kind\" .checked=${kind == 'none'} value=\"none\" />\n <label for=\"none\">none</label>\n\n <input type=\"radio\" id=\"form-data\" name=\"kind\" .checked=${kind == 'form-data'} value=\"form-data\" disabled />\n <label for=\"form-data\">form-data</label>\n\n <input\n type=\"radio\"\n id=\"x-www-form-urlencoded\"\n name=\"kind\"\n .checked=${kind == 'x-www-form-urlencoded'}\n value=\"x-www-form-urlencoded\"\n />\n <label for=\"x-www-form-urlencoded\">x-www-form-urlencoded</label>\n\n <input type=\"radio\" id=\"raw\" name=\"kind\" .checked=${kind == 'raw'} value=\"raw\" />\n <label for=\"raw\">raw</label>\n\n <input type=\"radio\" id=\"binary\" name=\"kind\" .checked=${kind == 'binary'} value=\"binary\" disabled />\n <label for=\"binary\">binary</label>\n\n <input type=\"radio\" id=\"GraphQL\" name=\"kind\" .checked=${kind == 'GraphQL'} value=\"GraphQL\" disabled />\n <label for=\"GraphQL\">GraphQL</label>\n </div>\n\n ${kind !== 'none'\n ? html`\n ${kind == 'raw' ? this.renderContentType(contentType) : html``}\n <div accessor>\n <label for=\"accessor\">accessor</label>\n <input type=\"text\" id=\"accessor\" name=\"accessor\" placeholder=\"accessor\" .value=${accessor} />\n </div>\n `\n : html``}\n `\n }\n\n renderContentType(contentType) {\n return html`\n <div>\n <label>content-type</label>\n <div>\n <input type=\"radio\" id=\"text\" name=\"contentType\" .checked=${contentType == 'text'} value=\"text\" />\n <label for=\"text\">Text</label>\n\n <input type=\"radio\" id=\"json\" name=\"contentType\" .checked=${contentType == 'json'} value=\"json\" disabled />\n <label for=\"json\">Json</label>\n </div>\n </div>\n `\n }\n\n _onChange(e) {\n var input = e.target\n\n this.value = {\n ...this.value,\n [input.name]: input.value\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { LitElement } from 'lit';
|
|
5
|
+
/**
|
|
6
|
+
http headers editor element
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
|
|
10
|
+
<things-editor-http-headers value=${map}>
|
|
11
|
+
</things-editor-http-headers>
|
|
12
|
+
*/
|
|
13
|
+
export default class ThingsEditorHttpHeaders extends LitElement {
|
|
14
|
+
static styles: import("lit").CSSResult[];
|
|
15
|
+
value: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
};
|
|
18
|
+
_changingNow: boolean;
|
|
19
|
+
firstUpdated(): void;
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
_onChange(e: any): void;
|
|
22
|
+
_build(includeNewRecord?: any): void;
|
|
23
|
+
_toArray(map: any): {
|
|
24
|
+
key: any;
|
|
25
|
+
value: any;
|
|
26
|
+
}[];
|
|
27
|
+
_add(): void;
|
|
28
|
+
_delete(e: any): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate, __metadata } from "tslib";
|
|
5
|
+
import { css, html, LitElement } from 'lit';
|
|
6
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
7
|
+
/**
|
|
8
|
+
http headers editor element
|
|
9
|
+
|
|
10
|
+
Example:
|
|
11
|
+
|
|
12
|
+
<things-editor-http-headers value=${map}>
|
|
13
|
+
</things-editor-http-headers>
|
|
14
|
+
*/
|
|
15
|
+
let ThingsEditorHttpHeaders = class ThingsEditorHttpHeaders extends LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.value = {};
|
|
19
|
+
this._changingNow = false;
|
|
20
|
+
}
|
|
21
|
+
firstUpdated() {
|
|
22
|
+
this.renderRoot.addEventListener('change', this._onChange.bind(this));
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html `
|
|
26
|
+
${this._toArray(this.value).map(item => html `
|
|
27
|
+
<div data-record>
|
|
28
|
+
<input type="text" data-key placeholder="key" .value=${item.key} />
|
|
29
|
+
<input type="text" data-value placeholder="value" .value=${item.value} />
|
|
30
|
+
<button class="record-action" @click=${e => this._delete(e)} tabindex="-1">x</button>
|
|
31
|
+
</div>
|
|
32
|
+
`)}
|
|
33
|
+
|
|
34
|
+
<div data-record-new>
|
|
35
|
+
<input type="text" data-key placeholder="key" value="" />
|
|
36
|
+
<input type="text" data-value placeholder="value" value="" />
|
|
37
|
+
<button class="record-action" @click=${e => this._add()} tabindex="-1">+</button>
|
|
38
|
+
</div>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
_onChange(e) {
|
|
42
|
+
if (this._changingNow) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this._changingNow = true;
|
|
46
|
+
var input = e.target;
|
|
47
|
+
var value = input.value;
|
|
48
|
+
var div = input.parentElement;
|
|
49
|
+
if (div.hasAttribute('data-record')) {
|
|
50
|
+
var dataList = div.querySelectorAll('[data-value]:not([hidden])');
|
|
51
|
+
for (var i = 0; i < dataList.length; i++) {
|
|
52
|
+
if (dataList[i] !== input) {
|
|
53
|
+
dataList[i].value = value || '';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (div.hasAttribute('data-record')) {
|
|
58
|
+
this._build();
|
|
59
|
+
}
|
|
60
|
+
else if (div.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {
|
|
61
|
+
this._add();
|
|
62
|
+
}
|
|
63
|
+
this._changingNow = false;
|
|
64
|
+
}
|
|
65
|
+
_build(includeNewRecord) {
|
|
66
|
+
if (includeNewRecord)
|
|
67
|
+
var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]');
|
|
68
|
+
else
|
|
69
|
+
var records = this.renderRoot.querySelectorAll('[data-record]');
|
|
70
|
+
var newmap = {};
|
|
71
|
+
for (var i = 0; i < records.length; i++) {
|
|
72
|
+
var record = records[i];
|
|
73
|
+
var key = record.querySelector('[data-key]').value;
|
|
74
|
+
var inputs = record.querySelectorAll('[data-value]:not([style*="display: none"])');
|
|
75
|
+
if (!inputs || inputs.length == 0)
|
|
76
|
+
continue;
|
|
77
|
+
var input = inputs[inputs.length - 1];
|
|
78
|
+
var value = input.value;
|
|
79
|
+
if (key)
|
|
80
|
+
newmap[key] = value || '';
|
|
81
|
+
}
|
|
82
|
+
this.value = newmap;
|
|
83
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
|
84
|
+
}
|
|
85
|
+
/* map아이템들을 template(dom-repeat)용 배열로 변환하는 함수 */
|
|
86
|
+
_toArray(map) {
|
|
87
|
+
var array = [];
|
|
88
|
+
for (var key in map) {
|
|
89
|
+
array.push({
|
|
90
|
+
key: key,
|
|
91
|
+
value: map[key]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return array;
|
|
95
|
+
}
|
|
96
|
+
_add() {
|
|
97
|
+
this._build(true);
|
|
98
|
+
var inputs = this.renderRoot.querySelectorAll('[data-record-new] input:not([style*="display: none"])');
|
|
99
|
+
for (var i = 0; i < inputs.length; i++) {
|
|
100
|
+
let input = inputs[i];
|
|
101
|
+
input.value = '';
|
|
102
|
+
}
|
|
103
|
+
;
|
|
104
|
+
inputs[0].focus();
|
|
105
|
+
}
|
|
106
|
+
_delete(e) {
|
|
107
|
+
var record = e.target.parentElement;
|
|
108
|
+
record.querySelector('[data-key]').value = '';
|
|
109
|
+
this._build();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
ThingsEditorHttpHeaders.styles = [
|
|
113
|
+
css `
|
|
114
|
+
:host {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: column;
|
|
117
|
+
align-content: center;
|
|
118
|
+
|
|
119
|
+
width: 100%;
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
border: 1px solid #ccc;
|
|
122
|
+
margin: 5px 0;
|
|
123
|
+
|
|
124
|
+
background-color: #ddd;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
div {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-flow: row nowrap;
|
|
130
|
+
align-items: center;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
div > * {
|
|
134
|
+
min-width: 0px;
|
|
135
|
+
min-height: 20px;
|
|
136
|
+
margin: 2px;
|
|
137
|
+
padding: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
button {
|
|
141
|
+
width: 20px;
|
|
142
|
+
text-align: center;
|
|
143
|
+
border-radius: 50%;
|
|
144
|
+
font-size: 1em;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
input {
|
|
148
|
+
flex: 1;
|
|
149
|
+
}
|
|
150
|
+
`
|
|
151
|
+
];
|
|
152
|
+
__decorate([
|
|
153
|
+
property({ type: Object }),
|
|
154
|
+
__metadata("design:type", Object)
|
|
155
|
+
], ThingsEditorHttpHeaders.prototype, "value", void 0);
|
|
156
|
+
ThingsEditorHttpHeaders = __decorate([
|
|
157
|
+
customElement('things-editor-http-headers')
|
|
158
|
+
], ThingsEditorHttpHeaders);
|
|
159
|
+
export default ThingsEditorHttpHeaders;
|
|
160
|
+
//# sourceMappingURL=things-editor-http-headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"things-editor-http-headers.js","sourceRoot":"","sources":["../../client/editors/things-editor-http-headers.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAElE;;;;;;;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C,aAAa,CAAC,4BAA4B,CAAC;GACvB,uBAAuB,CA4J3C;eA5JoB,uBAAuB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\n/**\nhttp headers editor element\n\nExample:\n\n <things-editor-http-headers value=${map}>\n </things-editor-http-headers>\n*/\n@customElement('things-editor-http-headers')\nexport default class ThingsEditorHttpHeaders extends LitElement {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n align-content: center;\n\n width: 100%;\n overflow: hidden;\n border: 1px solid #ccc;\n margin: 5px 0;\n\n background-color: #ddd;\n }\n\n div {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n }\n\n div > * {\n min-width: 0px;\n min-height: 20px;\n margin: 2px;\n padding: 0;\n }\n\n button {\n width: 20px;\n text-align: center;\n border-radius: 50%;\n font-size: 1em;\n }\n\n input {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) value: { [key: string]: string } = {}\n\n _changingNow: boolean = false\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n render() {\n return html`\n ${this._toArray(this.value).map(\n item => html`\n <div data-record>\n <input type=\"text\" data-key placeholder=\"key\" .value=${item.key} />\n <input type=\"text\" data-value placeholder=\"value\" .value=${item.value} />\n <button class=\"record-action\" @click=${e => this._delete(e)} tabindex=\"-1\">x</button>\n </div>\n `\n )}\n\n <div data-record-new>\n <input type=\"text\" data-key placeholder=\"key\" value=\"\" />\n <input type=\"text\" data-value placeholder=\"value\" value=\"\" />\n <button class=\"record-action\" @click=${e => this._add()} tabindex=\"-1\">+</button>\n </div>\n `\n }\n\n _onChange(e) {\n if (this._changingNow) {\n return\n }\n\n this._changingNow = true\n\n var input = e.target\n var value = input.value\n\n var div = input.parentElement\n\n if (div.hasAttribute('data-record')) {\n var dataList = div.querySelectorAll('[data-value]:not([hidden])')\n for (var i = 0; i < dataList.length; i++) {\n if (dataList[i] !== input) {\n dataList[i].value = value || ''\n }\n }\n }\n\n if (div.hasAttribute('data-record')) {\n this._build()\n } else if (div.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {\n this._add()\n }\n\n this._changingNow = false\n }\n\n _build(includeNewRecord?) {\n if (includeNewRecord) var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]')\n else var records = this.renderRoot.querySelectorAll('[data-record]')\n\n var newmap = {}\n\n for (var i = 0; i < records.length; i++) {\n var record = records[i]\n\n var key = (record.querySelector('[data-key]') as HTMLInputElement).value\n var inputs = record.querySelectorAll('[data-value]:not([style*=\"display: none\"])')\n if (!inputs || inputs.length == 0) continue\n\n var input = inputs[inputs.length - 1] as HTMLInputElement\n\n var value = input.value\n\n if (key) newmap[key] = value || ''\n }\n\n this.value = newmap\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n /* map아이템들을 template(dom-repeat)용 배열로 변환하는 함수 */\n _toArray(map) {\n var array: { key: any; value: any }[] = []\n\n for (var key in map) {\n array.push({\n key: key,\n value: map[key]\n })\n }\n\n return array\n }\n\n _add() {\n this._build(true)\n\n var inputs = this.renderRoot.querySelectorAll('[data-record-new] input:not([style*=\"display: none\"])')\n\n for (var i = 0; i < inputs.length; i++) {\n let input = inputs[i] as HTMLInputElement\n input.value = ''\n }\n\n ;(inputs[0] as HTMLInputElement).focus()\n }\n\n _delete(e) {\n var record = e.target.parentElement\n record.querySelector('[data-key]').value = ''\n this._build()\n }\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { LitElement } from 'lit';
|
|
5
|
+
/**
|
|
6
|
+
http parameters editor element
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
|
|
10
|
+
<things-editor-http-parameters value=${map}>
|
|
11
|
+
</things-editor-http-parameters>
|
|
12
|
+
*/
|
|
13
|
+
export default class ThingsEditorHttpParameters extends LitElement {
|
|
14
|
+
static styles: import("lit").CSSResult[];
|
|
15
|
+
value: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
};
|
|
18
|
+
_changingNow: boolean;
|
|
19
|
+
firstUpdated(): void;
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
_onChange(e: any): void;
|
|
22
|
+
_build(includeNewRecord?: any): void;
|
|
23
|
+
_toArray(map: any): {
|
|
24
|
+
key: any;
|
|
25
|
+
value: any;
|
|
26
|
+
}[];
|
|
27
|
+
_add(): void;
|
|
28
|
+
_delete(e: any): void;
|
|
29
|
+
}
|