@things-factory/integration-ui 6.1.112 → 6.1.115

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.
Files changed (34) hide show
  1. package/client/bootstrap.ts +2 -1
  2. package/client/editors/property-editor.ts +20 -1
  3. package/client/editors/things-editor-entity-selector.ts +7 -0
  4. package/client/editors/things-editor-http-body.ts +7 -0
  5. package/client/editors/things-editor-http-headers.ts +7 -0
  6. package/client/editors/things-editor-http-parameters.ts +7 -0
  7. package/client/editors/things-editor-procedure-parameters.ts +332 -0
  8. package/dist-client/bootstrap.js +2 -1
  9. package/dist-client/bootstrap.js.map +1 -1
  10. package/dist-client/editors/property-editor.d.ts +5 -0
  11. package/dist-client/editors/property-editor.js +17 -0
  12. package/dist-client/editors/property-editor.js.map +1 -1
  13. package/dist-client/editors/things-editor-entity-selector.js +7 -0
  14. package/dist-client/editors/things-editor-entity-selector.js.map +1 -1
  15. package/dist-client/editors/things-editor-http-body.js +7 -0
  16. package/dist-client/editors/things-editor-http-body.js.map +1 -1
  17. package/dist-client/editors/things-editor-http-headers.js +7 -0
  18. package/dist-client/editors/things-editor-http-headers.js.map +1 -1
  19. package/dist-client/editors/things-editor-http-parameters.js +7 -0
  20. package/dist-client/editors/things-editor-http-parameters.js.map +1 -1
  21. package/dist-client/editors/things-editor-procedure-output.d.ts +37 -0
  22. package/dist-client/editors/things-editor-procedure-output.js +234 -0
  23. package/dist-client/editors/things-editor-procedure-output.js.map +1 -0
  24. package/dist-client/editors/things-editor-procedure-parameters.d.ts +37 -0
  25. package/dist-client/editors/things-editor-procedure-parameters.js +291 -0
  26. package/dist-client/editors/things-editor-procedure-parameters.js.map +1 -0
  27. package/dist-client/tsconfig.tsbuildinfo +1 -1
  28. package/dist-server/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +5 -5
  30. package/translations/en.json +1 -0
  31. package/translations/ja.json +1 -0
  32. package/translations/ko.json +1 -0
  33. package/translations/ms.json +1 -0
  34. package/translations/zh.json +1 -0
@@ -0,0 +1,291 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate, __metadata } from "tslib";
5
+ import '@material/mwc-icon';
6
+ import { css, html } from 'lit';
7
+ import { customElement, property, queryAll } from 'lit/decorators.js';
8
+ import { OxFormField } from '@operato/input';
9
+ /**
10
+ input component for procedure-parameters
11
+
12
+ Example:
13
+
14
+ <things-editor-procedure-parameters
15
+ value=${map}
16
+ </things-editor-procedure-parameters>
17
+ */
18
+ let ThingsEditorProcedureParameters = class ThingsEditorProcedureParameters extends OxFormField {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.value = [];
22
+ this._changingNow = false;
23
+ }
24
+ firstUpdated() {
25
+ this.renderRoot.addEventListener('change', this._onChange.bind(this));
26
+ }
27
+ render() {
28
+ const value = !this.value || !Array.isArray(this.value) ? [] : this.value;
29
+ return html `
30
+ ${value.map(item => html `
31
+ <div data-record>
32
+ <input type="text" data-name placeholder="name" .value=${item.name} />
33
+ <select data-dir placeholder="dir" .value=${item.dir}>
34
+ <option value="" ?selected=${item.dir == ''}>&nbsp;</option>
35
+ <option value="In" ?selected=${item.dir == 'In'}>In</option>
36
+ <option value="Inout" ?selected=${item.dir == 'Inout'}>Inout</option>
37
+ <option value="Out" ?selected=${item.dir == 'Out'}>Out</option>
38
+ </select>
39
+ <select data-type placeholder="type" .value=${item.type}>
40
+ <option value="" ?selected=${item.type == ''}>&nbsp;</option>
41
+ <option value="String" ?selected=${item.type == 'String'}>String</option>
42
+ <option value="Number" ?selected=${item.type == 'Number'}>Number</option>
43
+ <option value="Date" ?selected=${item.type == 'Date'}>Date</option>
44
+ <!--
45
+ <option value="Buffer" ?selected=${item.type == 'Buffer'}>Buffer</option>
46
+ <option value="Blob" ?selected=${item.type == 'Blob'}>Blob</option>
47
+ <option value="Clob" ?selected=${item.type == 'Clob'}>Clob</option>
48
+ -->
49
+ <option value="Cursor" ?selected=${item.type == 'Cursor'}>Cursor</option>
50
+ </select>
51
+ <input type="text" data-val placeholder="val" .value=${item.val} />
52
+ <input type="number" data-max-size placeholder="max-size" .value=${String(item.maxSize)} />
53
+
54
+ <button class="record-action" @click=${(e) => this._delete(e)} tabindex="-1">
55
+ <mwc-icon>remove</mwc-icon>
56
+ </button>
57
+ <button class="record-action" @click=${(e) => this._up(e)} tabindex="-1">
58
+ <mwc-icon>arrow_upward</mwc-icon>
59
+ </button>
60
+ <button class="record-action" @click=${(e) => this._down(e)} tabindex="-1">
61
+ <mwc-icon>arrow_downward</mwc-icon>
62
+ </button>
63
+ </div>
64
+ `)}
65
+
66
+ <div data-record-new>
67
+ <input type="text" data-name placeholder="name" value="" />
68
+ <select data-dir placeholder="dir">
69
+ <option value="" selected>&nbsp;</option>
70
+ <option value="In">In</option>
71
+ <option value="Inout">Inout</option>
72
+ <option value="Out">Out</option>
73
+ </select>
74
+ <select data-type placeholder="type" value="">
75
+ <option value="" selected>&nbsp;</option>
76
+ <option value="String">String</option>
77
+ <option value="Number">Number</option>
78
+ <option value="Date">Date</option>
79
+ <!--
80
+ <option value="Buffer">Buffer</option>
81
+ <option value="Blob">Blob</option>
82
+ <option value="Clob">Clob</option>
83
+ -->
84
+ <option value="Cursor">Cursor</option>
85
+ </select>
86
+ <input type="text" data-val placeholder="val" value="" />
87
+ <input type="number" data-max-size placeholder="max-size" value="" />
88
+
89
+ <button class="record-action" @click=${(e) => this._add()} tabindex="-1">
90
+ <mwc-icon>add</mwc-icon>
91
+ </button>
92
+ <button class="hidden"><mwc-icon>add</mwc-icon></button>
93
+ <button class="hidden"><mwc-icon>add</mwc-icon></button>
94
+ </div>
95
+ `;
96
+ }
97
+ _onChange(e) {
98
+ if (this._changingNow) {
99
+ return;
100
+ }
101
+ this._changingNow = true;
102
+ const input = e.target;
103
+ const record = e.target.closest('[data-record],[data-record-new]');
104
+ if (record.hasAttribute('data-record')) {
105
+ this._build();
106
+ }
107
+ else if (record.hasAttribute('data-record-new') && input.hasAttribute('data-type')) {
108
+ this._add();
109
+ }
110
+ this._changingNow = false;
111
+ }
112
+ _adjust({ name, type, dir, maxSize, val }) {
113
+ const entry = {
114
+ name,
115
+ type,
116
+ dir
117
+ };
118
+ if (dir != 'In' &&
119
+ (type == 'String' || type == 'Buffer') &&
120
+ maxSize !== null &&
121
+ maxSize !== undefined &&
122
+ !isNaN(maxSize)) {
123
+ entry.maxSize = maxSize;
124
+ }
125
+ if (dir != 'Out' && val !== null && val !== undefined && val != '') {
126
+ entry.val = val;
127
+ }
128
+ return entry;
129
+ }
130
+ _build(includeNewRecord) {
131
+ if (includeNewRecord) {
132
+ var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]');
133
+ }
134
+ else {
135
+ var records = this.renderRoot.querySelectorAll('[data-record]');
136
+ }
137
+ var newmap = [];
138
+ for (var i = 0; i < records.length; i++) {
139
+ var record = records[i];
140
+ const name = record.querySelector('[data-name]').value;
141
+ const type = record.querySelector('[data-type]').value;
142
+ const dir = record.querySelector('[data-dir]').value;
143
+ const val = record.querySelector('[data-val]').value;
144
+ const maxSize = record.querySelector('[data-max-size]').valueAsNumber;
145
+ const inputs = record.querySelectorAll('[data-type]:not([style*="display: none"])');
146
+ if (!inputs || inputs.length == 0) {
147
+ continue;
148
+ }
149
+ if (name) {
150
+ newmap.push(this._adjust({ name, type, dir, val, maxSize }));
151
+ }
152
+ }
153
+ this.value = newmap;
154
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
155
+ }
156
+ _add() {
157
+ this._build(true);
158
+ const inputs = this.renderRoot.querySelectorAll('[data-record-new] input:not([style*="display: none"])');
159
+ for (var i = 0; i < inputs.length; i++) {
160
+ let input = inputs[i];
161
+ input.value = '';
162
+ }
163
+ inputs[0].focus();
164
+ }
165
+ _delete(e) {
166
+ const record = e.target.closest('[data-record]');
167
+ record.querySelector('[data-name]').value = '';
168
+ this._build();
169
+ }
170
+ _up(e) {
171
+ const record = e.target.closest('[data-record]');
172
+ const array = Array.from(this.records);
173
+ const index = array.indexOf(record) - 1;
174
+ if (index < 0) {
175
+ return;
176
+ }
177
+ const deleted = array.splice(index, 1);
178
+ array.splice(index + 1, 0, ...deleted);
179
+ this.value = array.map(record => {
180
+ const name = record.querySelector('[data-name]').value;
181
+ const dir = record.querySelector('[data-dir]').value;
182
+ const type = record.querySelector('[data-type]').value;
183
+ const val = record.querySelector('[data-val]').value;
184
+ const maxSize = record.querySelector('[data-max-size]').valueAsNumber;
185
+ return this._adjust({ name, dir, type, val, maxSize });
186
+ });
187
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
188
+ }
189
+ _down(e) {
190
+ const record = e.target.closest('[data-record]');
191
+ const array = Array.from(this.records);
192
+ const index = array.indexOf(record);
193
+ if (index > array.length) {
194
+ return;
195
+ }
196
+ array.splice(index, 1);
197
+ array.splice(index + 1, 0, record);
198
+ this.value = array.map(record => {
199
+ const name = record.querySelector('[data-name]').value;
200
+ const dir = record.querySelector('[data-dir]').value;
201
+ const type = record.querySelector('[data-type]').value;
202
+ const val = record.querySelector('[data-val]').value;
203
+ const maxSize = record.querySelector('[data-max-size]').valueAsNumber;
204
+ return this._adjust({ name, dir, type, val, maxSize });
205
+ });
206
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
207
+ }
208
+ };
209
+ ThingsEditorProcedureParameters.styles = [
210
+ css `
211
+ :host {
212
+ display: flex;
213
+ flex-direction: column;
214
+ overflow: hidden;
215
+ margin-bottom: var(--margin-wide);
216
+ }
217
+
218
+ div {
219
+ display: flex;
220
+ flex-flow: row nowrap;
221
+ gap: var(--margin-default);
222
+ margin-bottom: var(--margin-narrow);
223
+ }
224
+
225
+ button {
226
+ border: var(--button-border);
227
+ border-radius: var(--border-radius);
228
+ background-color: var(--button-background-color);
229
+ padding: var(--padding-narrow) var(--padding-default);
230
+ line-height: 0.8;
231
+ color: var(--button-color);
232
+ cursor: pointer;
233
+ }
234
+
235
+ button + button {
236
+ margin-left: -5px;
237
+ }
238
+
239
+ button mwc-icon {
240
+ font-size: var(--fontsize-default);
241
+ }
242
+
243
+ button:focus,
244
+ button:hover,
245
+ button:active {
246
+ border: var(--button-activ-border);
247
+ background-color: var(--button-background-focus-color);
248
+ color: var(--theme-white-color);
249
+ }
250
+
251
+ input {
252
+ flex: 1;
253
+ border: 0;
254
+ border-bottom: var(--border-dark-color);
255
+ padding: var(--input-padding);
256
+ font: var(--input-font);
257
+ color: var(--primary-text-color);
258
+ min-width: 50px;
259
+ }
260
+
261
+ input:focus {
262
+ outline: none;
263
+ border-bottom: 1px solid var(--primary-color);
264
+ }
265
+
266
+ button.hidden {
267
+ opacity: 0;
268
+ cursor: default;
269
+ }
270
+
271
+ select,
272
+ ox-select,
273
+ input:not([type='checkbox']) {
274
+ border: 1px solid rgba(0, 0, 0, 0.2);
275
+ border-radius: 4px;
276
+ }
277
+ `
278
+ ];
279
+ __decorate([
280
+ property({ type: Array }),
281
+ __metadata("design:type", Array)
282
+ ], ThingsEditorProcedureParameters.prototype, "value", void 0);
283
+ __decorate([
284
+ queryAll('[data-record]'),
285
+ __metadata("design:type", Object)
286
+ ], ThingsEditorProcedureParameters.prototype, "records", void 0);
287
+ ThingsEditorProcedureParameters = __decorate([
288
+ customElement('things-editor-procedure-parameters')
289
+ ], ThingsEditorProcedureParameters);
290
+ export { ThingsEditorProcedureParameters };
291
+ //# sourceMappingURL=things-editor-procedure-parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"things-editor-procedure-parameters.js","sourceRoot":"","sources":["../../client/editors/things-editor-procedure-parameters.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;A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AAI,EAAE,KAAK,EAAE,CAAC;;8DAAqC;AAyL/D;IAAC,QAAQ,CAAC,eAAe,CAAC;;gEAAkC;AAjQjD,+BAA+B;IAD3C,aAAa,CAAC,oCAAoC,CAAC;GACvC,+BAA+B,CAoT3C;SApTY,+BAA+B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/mwc-icon'\n\nimport { css, html } from 'lit'\nimport { customElement, property, queryAll } from 'lit/decorators.js'\n\nimport { OxFormField } from '@operato/input'\n\ntype ProcedureParameterType = { name: string; dir: string; type: string; val?: any; maxSize?: number }\n\n/**\n input component for procedure-parameters\n \n Example:\n \n <things-editor-procedure-parameters \n value=${map}\n </things-editor-procedure-parameters>\n */\n@customElement('things-editor-procedure-parameters')\nexport class ThingsEditorProcedureParameters extends OxFormField {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n margin-bottom: var(--margin-wide);\n }\n\n div {\n display: flex;\n flex-flow: row nowrap;\n gap: var(--margin-default);\n margin-bottom: var(--margin-narrow);\n }\n\n button {\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n padding: var(--padding-narrow) var(--padding-default);\n line-height: 0.8;\n color: var(--button-color);\n cursor: pointer;\n }\n\n button + button {\n margin-left: -5px;\n }\n\n button mwc-icon {\n font-size: var(--fontsize-default);\n }\n\n button:focus,\n button:hover,\n button:active {\n border: var(--button-activ-border);\n background-color: var(--button-background-focus-color);\n color: var(--theme-white-color);\n }\n\n input {\n flex: 1;\n border: 0;\n border-bottom: var(--border-dark-color);\n padding: var(--input-padding);\n font: var(--input-font);\n color: var(--primary-text-color);\n min-width: 50px;\n }\n\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--primary-color);\n }\n\n button.hidden {\n opacity: 0;\n cursor: default;\n }\n\n select,\n ox-select,\n input:not([type='checkbox']) {\n border: 1px solid rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n }\n `\n ]\n\n @property({ type: Array }) value: ProcedureParameterType[] = []\n\n private _changingNow: boolean = false\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n render() {\n const value = !this.value || !Array.isArray(this.value) ? [] : this.value\n\n return html`\n ${value.map(\n item => html`\n <div data-record>\n <input type=\"text\" data-name placeholder=\"name\" .value=${item.name} />\n <select data-dir placeholder=\"dir\" .value=${item.dir}>\n <option value=\"\" ?selected=${item.dir == ''}>&nbsp;</option>\n <option value=\"In\" ?selected=${item.dir == 'In'}>In</option>\n <option value=\"Inout\" ?selected=${item.dir == 'Inout'}>Inout</option>\n <option value=\"Out\" ?selected=${item.dir == 'Out'}>Out</option>\n </select>\n <select data-type placeholder=\"type\" .value=${item.type}>\n <option value=\"\" ?selected=${item.type == ''}>&nbsp;</option>\n <option value=\"String\" ?selected=${item.type == 'String'}>String</option>\n <option value=\"Number\" ?selected=${item.type == 'Number'}>Number</option>\n <option value=\"Date\" ?selected=${item.type == 'Date'}>Date</option>\n <!-- \n <option value=\"Buffer\" ?selected=${item.type == 'Buffer'}>Buffer</option>\n <option value=\"Blob\" ?selected=${item.type == 'Blob'}>Blob</option>\n <option value=\"Clob\" ?selected=${item.type == 'Clob'}>Clob</option>\n -->\n <option value=\"Cursor\" ?selected=${item.type == 'Cursor'}>Cursor</option>\n </select>\n <input type=\"text\" data-val placeholder=\"val\" .value=${item.val} />\n <input type=\"number\" data-max-size placeholder=\"max-size\" .value=${String(item.maxSize)} />\n\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._delete(e)} tabindex=\"-1\">\n <mwc-icon>remove</mwc-icon>\n </button>\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._up(e)} tabindex=\"-1\">\n <mwc-icon>arrow_upward</mwc-icon>\n </button>\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._down(e)} tabindex=\"-1\">\n <mwc-icon>arrow_downward</mwc-icon>\n </button>\n </div>\n `\n )}\n\n <div data-record-new>\n <input type=\"text\" data-name placeholder=\"name\" value=\"\" />\n <select data-dir placeholder=\"dir\">\n <option value=\"\" selected>&nbsp;</option>\n <option value=\"In\">In</option>\n <option value=\"Inout\">Inout</option>\n <option value=\"Out\">Out</option>\n </select>\n <select data-type placeholder=\"type\" value=\"\">\n <option value=\"\" selected>&nbsp;</option>\n <option value=\"String\">String</option>\n <option value=\"Number\">Number</option>\n <option value=\"Date\">Date</option>\n <!--\n <option value=\"Buffer\">Buffer</option>\n <option value=\"Blob\">Blob</option>\n <option value=\"Clob\">Clob</option>\n -->\n <option value=\"Cursor\">Cursor</option>\n </select>\n <input type=\"text\" data-val placeholder=\"val\" value=\"\" />\n <input type=\"number\" data-max-size placeholder=\"max-size\" value=\"\" />\n\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._add()} tabindex=\"-1\">\n <mwc-icon>add</mwc-icon>\n </button>\n <button class=\"hidden\"><mwc-icon>add</mwc-icon></button>\n <button class=\"hidden\"><mwc-icon>add</mwc-icon></button>\n </div>\n `\n }\n\n _onChange(e: Event) {\n if (this._changingNow) {\n return\n }\n\n this._changingNow = true\n\n const input = e.target as HTMLInputElement\n\n const record = (e.target as Element).closest('[data-record],[data-record-new]') as HTMLElement\n\n if (record.hasAttribute('data-record')) {\n this._build()\n } else if (record.hasAttribute('data-record-new') && input.hasAttribute('data-type')) {\n this._add()\n }\n\n this._changingNow = false\n }\n\n _adjust({ name, type, dir, maxSize, val }: ProcedureParameterType): ProcedureParameterType {\n const entry = {\n name,\n type,\n dir\n } as ProcedureParameterType\n\n if (\n dir != 'In' &&\n (type == 'String' || type == 'Buffer') &&\n maxSize !== null &&\n maxSize !== undefined &&\n !isNaN(maxSize)\n ) {\n entry.maxSize = maxSize\n }\n\n if (dir != 'Out' && val !== null && val !== undefined && val != '') {\n entry.val = val\n }\n\n return entry\n }\n\n _build(includeNewRecord?: boolean) {\n if (includeNewRecord) {\n var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]') as NodeListOf<HTMLElement>\n } else {\n var records = this.renderRoot.querySelectorAll('[data-record]') as NodeListOf<HTMLElement>\n }\n\n var newmap: ProcedureParameterType[] = []\n\n for (var i = 0; i < records.length; i++) {\n var record = records[i]\n\n const name = (record.querySelector('[data-name]') as HTMLInputElement).value\n const type = (record.querySelector('[data-type]') as HTMLInputElement).value\n const dir = (record.querySelector('[data-dir]') as HTMLInputElement).value\n const val = (record.querySelector('[data-val]') as HTMLInputElement).value\n const maxSize = (record.querySelector('[data-max-size]') as HTMLInputElement).valueAsNumber\n\n const inputs = record.querySelectorAll(\n '[data-type]:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement>\n\n if (!inputs || inputs.length == 0) {\n continue\n }\n\n if (name) {\n newmap.push(this._adjust({ name, type, dir, val, maxSize }))\n }\n }\n\n this.value = newmap\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n\n _add() {\n this._build(true)\n\n const inputs = this.renderRoot.querySelectorAll(\n '[data-record-new] input:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement & { value: any }>\n\n for (var i = 0; i < inputs.length; i++) {\n let input = inputs[i]\n\n input.value = ''\n }\n\n inputs[0].focus()\n }\n\n _delete(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n\n ;(record!.querySelector('[data-name]') as HTMLInputElement)!.value = ''\n\n this._build()\n }\n\n @queryAll('[data-record]') records!: NodeListOf<HTMLElement>\n\n _up(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record) - 1\n\n if (index < 0) {\n return\n }\n\n const deleted = array.splice(index, 1)\n array.splice(index + 1, 0, ...deleted)\n\n this.value = array.map(record => {\n const name = (record.querySelector('[data-name]') as HTMLInputElement).value\n const dir = (record.querySelector('[data-dir]') as HTMLInputElement).value\n const type = (record.querySelector('[data-type]') as HTMLInputElement).value\n const val = (record.querySelector('[data-val]') as HTMLInputElement).value\n const maxSize = (record.querySelector('[data-max-size]') as HTMLInputElement).valueAsNumber\n\n return this._adjust({ name, dir, type, val, maxSize })\n })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n\n _down(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record)\n\n if (index > array.length) {\n return\n }\n\n array.splice(index, 1)\n array.splice(index + 1, 0, record)\n\n this.value = array.map(record => {\n const name = (record.querySelector('[data-name]') as HTMLInputElement).value\n const dir = (record.querySelector('[data-dir]') as HTMLInputElement).value\n const type = (record.querySelector('[data-type]') as HTMLInputElement).value\n const val = (record.querySelector('[data-val]') as HTMLInputElement).value\n const maxSize = (record.querySelector('[data-max-size]') as HTMLInputElement).valueAsNumber\n\n return this._adjust({ name, dir, type, val, maxSize })\n })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n}\n"]}