@quandis/qbo4.configuration 4.0.1-CI-20240328-123132
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/license.js +41 -0
- package/package.json +44 -0
- package/readme.md +11 -0
- package/src/Configuration.d.ts +35 -0
- package/src/Configuration.js +105 -0
- package/src/Configuration.js.map +1 -0
- package/src/Configuration.ts +105 -0
- package/src/IConfiguration.d.ts +34 -0
- package/src/IConfiguration.js +38 -0
- package/src/IConfiguration.js.map +1 -0
- package/src/IConfiguration.ts +51 -0
- package/src/Program.d.ts +10 -0
- package/src/Program.js +6 -0
- package/src/Program.js.map +1 -0
- package/src/Program.ts +13 -0
- package/src/Services.d.ts +16 -0
- package/src/Services.js +16 -0
- package/src/Services.js.map +1 -0
- package/src/Services.ts +29 -0
- package/src/qbo-config-editor.d.ts +18 -0
- package/src/qbo-config-editor.js +107 -0
- package/src/qbo-config-editor.js.map +1 -0
- package/src/qbo-config-editor.ts +115 -0
- package/wwwroot/js/qbo4.configuration.js +7413 -0
- package/wwwroot/js/qbo4.configuration.min.js +25 -0
- package/wwwroot/js/qbo4.configuration.min.js.LICENSE.txt +41 -0
- package/wwwroot/js/qbo4.configuration.min.js.map +1 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { LitElement, html, css, } from 'lit';
|
|
11
|
+
import { property } from 'lit/decorators.js';
|
|
12
|
+
import { JsonConfigurationSource } from './Configuration.js';
|
|
13
|
+
export class QboConfigEditor extends LitElement {
|
|
14
|
+
static get formAssociated() {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
// configSource = new JsonConfigurationSource({});
|
|
18
|
+
static { this.styles = css `
|
|
19
|
+
:host {
|
|
20
|
+
display: block;
|
|
21
|
+
padding: 16px;
|
|
22
|
+
}
|
|
23
|
+
.form-group {
|
|
24
|
+
margin-bottom: 10px;
|
|
25
|
+
}
|
|
26
|
+
`; }
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
// @property({ type: Object })
|
|
30
|
+
this.configData = {};
|
|
31
|
+
// Use attachInternals() to get access to form internals
|
|
32
|
+
this._internals = this.attachInternals();
|
|
33
|
+
}
|
|
34
|
+
_handleInput(e) {
|
|
35
|
+
// Update the value on input events
|
|
36
|
+
this.value = e.target.value;
|
|
37
|
+
this._internals.setFormValue(this.value);
|
|
38
|
+
}
|
|
39
|
+
async connectedCallback() {
|
|
40
|
+
super.connectedCallback();
|
|
41
|
+
// check payload
|
|
42
|
+
if (this.value) {
|
|
43
|
+
this.configData = JSON.parse(this.value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
handleInputChange(key, event) {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
const target = event.target;
|
|
49
|
+
this.configData[key] = target.value;
|
|
50
|
+
this.requestUpdate();
|
|
51
|
+
}
|
|
52
|
+
updateConfigData(key, newValue, event, isKey = false) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
if (isKey) {
|
|
55
|
+
const oldValue = this.configData[key];
|
|
56
|
+
delete this.configData[key];
|
|
57
|
+
this.configData[newValue] = oldValue;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.configData[key] = newValue;
|
|
61
|
+
}
|
|
62
|
+
this.requestUpdate();
|
|
63
|
+
}
|
|
64
|
+
addKeyValuePair(event) {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
const newKey = `newKey${Object.keys(this.configData).length}`;
|
|
67
|
+
this.configData[newKey] = 'newValue';
|
|
68
|
+
this.requestUpdate();
|
|
69
|
+
}
|
|
70
|
+
deleteKeyValuePair(key, event) {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
delete this.configData[key];
|
|
73
|
+
this.requestUpdate();
|
|
74
|
+
}
|
|
75
|
+
saveChanges(event) {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
console.log('Saving changes:', this.configData);
|
|
78
|
+
}
|
|
79
|
+
cancelChanges(event) {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
console.log('Cancelling changes');
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
const source = new JsonConfigurationSource(this.configData);
|
|
85
|
+
return html `<slot></slot>
|
|
86
|
+
<form>
|
|
87
|
+
${Array.from(source.getValues()).map(({ key, value }) => html `
|
|
88
|
+
<div class="input-group mb-3">
|
|
89
|
+
<input type="text" class="form-control" .value="${key}" @input="${(e) => this.updateConfigData(key, e.target.value, e, true)}">
|
|
90
|
+
<input type="text" class="form-control" .value="${value}" @input="${(e) => this.updateConfigData(key, e.target.value, e)}">
|
|
91
|
+
<button class="btn btn-outline-danger" @click="${(e) => this.deleteKeyValuePair(key, e)}">Delete</button>
|
|
92
|
+
</div>`)}
|
|
93
|
+
<div>
|
|
94
|
+
<button class="btn btn-outline-primary" @click="${this.addKeyValuePair}">Add Entry</button>
|
|
95
|
+
<button class="btn btn-success" @click="${this.saveChanges}">Save</button>
|
|
96
|
+
<button class="btn btn-secondary" @click="${this.cancelChanges}">Cancel</button>
|
|
97
|
+
</div>
|
|
98
|
+
</form>
|
|
99
|
+
`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
__decorate([
|
|
103
|
+
property({ type: String }),
|
|
104
|
+
__metadata("design:type", Object)
|
|
105
|
+
], QboConfigEditor.prototype, "value", void 0);
|
|
106
|
+
customElements.define('qbo-config-editor', QboConfigEditor);
|
|
107
|
+
//# sourceMappingURL=qbo-config-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qbo-config-editor.js","sourceRoot":"","sources":["qbo-config-editor.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,GAAG,MAAM,KAAK,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAK3C,MAAM,KAAK,cAAc;QACrB,OAAO,IAAI,CAAC;IAChB,CAAC;IAQD,kDAAkD;aAE3C,WAAM,GAAG,GAAG,CAAA;;;;;;;;GAQpB,AARc,CAQb;IAEA;QACI,KAAK,EAAE,CAAC;QAhBZ,8BAA8B;QAC9B,eAAU,GAAW,EAAE,CAAC;QAgBpB,wDAAwD;QACxD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;IAC7C,CAAC;IAED,YAAY,CAAC,CAAC;QACV,mCAAmC;QACnC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,iBAAiB;QACnB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,gBAAgB;QAChB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;IAED,iBAAiB,CAAC,GAAG,E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AE,IAAI,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC;IAED,aAAa,CAAC,KAAK;QACf,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IAED,MAAM;QACF,MAAM,MAAM,GAAG,IAAI,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAA;;UAET,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,IAAI,CAAA;;sDAEf,GAAG,aAAa,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC;sDAC1E,KAAK,aAAa,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;qDACvE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;OACpF,CAAC;;8DAEsD,IAAI,CAAC,eAAe;sDAC5B,IAAI,CAAC,WAAW;wDACd,IAAI,CAAC,aAAa;;;KAGrE,CAAC;IACF,CAAC;;AAhGD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACrB;AAmGV,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { LitElement, html, css, } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { JsonConfigurationSource } from './Configuration.js';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class QboConfigEditor extends LitElement {
|
|
7
|
+
|
|
8
|
+
// private _value: string;
|
|
9
|
+
private _internals: ElementInternals;
|
|
10
|
+
|
|
11
|
+
static get formAssociated(): boolean {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@property({ type: String })
|
|
16
|
+
value;
|
|
17
|
+
|
|
18
|
+
// @property({ type: Object })
|
|
19
|
+
configData: Object = {};
|
|
20
|
+
|
|
21
|
+
// configSource = new JsonConfigurationSource({});
|
|
22
|
+
|
|
23
|
+
static styles = css`
|
|
24
|
+
:host {
|
|
25
|
+
display: block;
|
|
26
|
+
padding: 16px;
|
|
27
|
+
}
|
|
28
|
+
.form-group {
|
|
29
|
+
margin-bottom: 10px;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
// Use attachInternals() to get access to form internals
|
|
36
|
+
this._internals = this.attachInternals();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_handleInput(e) {
|
|
40
|
+
// Update the value on input events
|
|
41
|
+
this.value = e.target.value;
|
|
42
|
+
this._internals.setFormValue(this.value);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async connectedCallback() {
|
|
46
|
+
super.connectedCallback();
|
|
47
|
+
// check payload
|
|
48
|
+
if (this.value) {
|
|
49
|
+
this.configData = JSON.parse(this.value);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
handleInputChange(key, event) {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
const target = event.target as HTMLInputElement;
|
|
56
|
+
this.configData[key] = target.value;
|
|
57
|
+
this.requestUpdate();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
updateConfigData(key, newValue, event, isKey = false) {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
if (isKey) {
|
|
63
|
+
const oldValue = this.configData[key];
|
|
64
|
+
delete this.configData[key];
|
|
65
|
+
this.configData[newValue] = oldValue;
|
|
66
|
+
} else {
|
|
67
|
+
this.configData[key] = newValue;
|
|
68
|
+
}
|
|
69
|
+
this.requestUpdate();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
addKeyValuePair(event) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
const newKey = `newKey${Object.keys(this.configData).length}`;
|
|
75
|
+
this.configData[newKey] = 'newValue';
|
|
76
|
+
this.requestUpdate();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
deleteKeyValuePair(key, event) {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
delete this.configData[key];
|
|
82
|
+
this.requestUpdate();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
saveChanges(event) {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
console.log('Saving changes:', this.configData);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
cancelChanges(event) {
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
console.log('Cancelling changes');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
render() {
|
|
96
|
+
const source = new JsonConfigurationSource(this.configData);
|
|
97
|
+
return html`<slot></slot>
|
|
98
|
+
<form>
|
|
99
|
+
${Array.from(source.getValues()).map(({ key, value }) => html`
|
|
100
|
+
<div class="input-group mb-3">
|
|
101
|
+
<input type="text" class="form-control" .value="${key}" @input="${(e) => this.updateConfigData(key, e.target.value, e, true)}">
|
|
102
|
+
<input type="text" class="form-control" .value="${value}" @input="${(e) => this.updateConfigData(key, e.target.value, e)}">
|
|
103
|
+
<button class="btn btn-outline-danger" @click="${(e) => this.deleteKeyValuePair(key, e)}">Delete</button>
|
|
104
|
+
</div>`)}
|
|
105
|
+
<div>
|
|
106
|
+
<button class="btn btn-outline-primary" @click="${this.addKeyValuePair}">Add Entry</button>
|
|
107
|
+
<button class="btn btn-success" @click="${this.saveChanges}">Save</button>
|
|
108
|
+
<button class="btn btn-secondary" @click="${this.cancelChanges}">Cancel</button>
|
|
109
|
+
</div>
|
|
110
|
+
</form>
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
customElements.define('qbo-config-editor', QboConfigEditor);
|