@record-evolution/widget-form 1.0.4 → 1.0.6
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/dist/src/widget-form.d.ts +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/widget-form.js +18 -20
- package/dist/widget-form.js.map +1 -1
- package/package.json +1 -1
- package/src/widget-form.ts +14 -17
package/package.json
CHANGED
package/src/widget-form.ts
CHANGED
|
@@ -10,9 +10,9 @@ import '@material/web/dialog/dialog.js'
|
|
|
10
10
|
import '@material/web/button/text-button.js'
|
|
11
11
|
import '@material/web/button/outlined-button.js'
|
|
12
12
|
import '@material/web/button/filled-button.js'
|
|
13
|
-
import '@material/web/textfield/
|
|
13
|
+
import '@material/web/textfield/outlined-text-field.js'
|
|
14
14
|
import '@material/web/checkbox/checkbox.js'
|
|
15
|
-
import '@material/web/select/
|
|
15
|
+
import '@material/web/select/outlined-select.js'
|
|
16
16
|
import '@material/web/select/select-option.js'
|
|
17
17
|
// import 'lit-flatpickr'
|
|
18
18
|
|
|
@@ -72,9 +72,6 @@ export class WidgetForm extends LitElement {
|
|
|
72
72
|
const formData = new FormData(form)
|
|
73
73
|
const data = Object.fromEntries((formData as any).entries())
|
|
74
74
|
|
|
75
|
-
for (const field of this.inputData?.formFields ?? []) {
|
|
76
|
-
}
|
|
77
|
-
|
|
78
75
|
const submitData = this.inputData?.formFields?.map((field, i) => {
|
|
79
76
|
return {
|
|
80
77
|
swarm_app_databackend_key: field.targetColumn?.swarm_app_databackend_key,
|
|
@@ -87,7 +84,7 @@ export class WidgetForm extends LitElement {
|
|
|
87
84
|
}
|
|
88
85
|
})
|
|
89
86
|
this.dispatchEvent(
|
|
90
|
-
new CustomEvent('
|
|
87
|
+
new CustomEvent('data-submit', {
|
|
91
88
|
detail: submitData,
|
|
92
89
|
bubbles: false,
|
|
93
90
|
composed: false
|
|
@@ -110,7 +107,7 @@ export class WidgetForm extends LitElement {
|
|
|
110
107
|
|
|
111
108
|
renderTextField(field: Column, i: number) {
|
|
112
109
|
return html`
|
|
113
|
-
<md-
|
|
110
|
+
<md-outlined-text-field
|
|
114
111
|
.name="column-${i}"
|
|
115
112
|
.label="${field.label ?? ''}"
|
|
116
113
|
.type="${field.type === 'numberfield' ? 'number' : 'text'}"
|
|
@@ -119,13 +116,13 @@ export class WidgetForm extends LitElement {
|
|
|
119
116
|
supporting-text=${field.description ?? ''}
|
|
120
117
|
validation-message="${field.validationMessage ?? 'Invalid input'}"
|
|
121
118
|
?required=${field.required && !field.defaultValue}
|
|
122
|
-
></md-
|
|
119
|
+
></md-outlined-text-field>
|
|
123
120
|
`
|
|
124
121
|
}
|
|
125
122
|
|
|
126
123
|
renderNumberField(field: Column, i: number) {
|
|
127
124
|
return html`
|
|
128
|
-
<md-
|
|
125
|
+
<md-outlined-text-field
|
|
129
126
|
.name="column-${i}"
|
|
130
127
|
.label="${field.label ?? ''}"
|
|
131
128
|
style="width: 200px;"
|
|
@@ -136,7 +133,7 @@ export class WidgetForm extends LitElement {
|
|
|
136
133
|
max=${field.max ?? ''}
|
|
137
134
|
supporting-text=${field.description ?? ''}
|
|
138
135
|
?required=${field.required && !field.defaultValue}
|
|
139
|
-
></md-
|
|
136
|
+
></md-outlined-text-field>
|
|
140
137
|
`
|
|
141
138
|
}
|
|
142
139
|
|
|
@@ -157,7 +154,7 @@ export class WidgetForm extends LitElement {
|
|
|
157
154
|
|
|
158
155
|
renderTextArea(field: Column, i: number) {
|
|
159
156
|
return html`
|
|
160
|
-
<md-
|
|
157
|
+
<md-outlined-text-field
|
|
161
158
|
.name="column-${i}"
|
|
162
159
|
.label="${field.label ?? ''}"
|
|
163
160
|
type="textarea"
|
|
@@ -165,7 +162,7 @@ export class WidgetForm extends LitElement {
|
|
|
165
162
|
rows="3"
|
|
166
163
|
?required=${field.required && !field.defaultValue}
|
|
167
164
|
supporting-text=${field.description ?? ''}
|
|
168
|
-
></md-
|
|
165
|
+
></md-outlined-text-field>
|
|
169
166
|
`
|
|
170
167
|
}
|
|
171
168
|
|
|
@@ -173,7 +170,7 @@ export class WidgetForm extends LitElement {
|
|
|
173
170
|
return html`
|
|
174
171
|
<label class="label">
|
|
175
172
|
${field.label}
|
|
176
|
-
<md-
|
|
173
|
+
<md-outlined-select
|
|
177
174
|
name="column-${i}"
|
|
178
175
|
supporting-text=${field.description ?? ''}
|
|
179
176
|
?required=${field.required && !field.defaultValue}
|
|
@@ -192,7 +189,7 @@ export class WidgetForm extends LitElement {
|
|
|
192
189
|
`
|
|
193
190
|
}
|
|
194
191
|
)}
|
|
195
|
-
</md-
|
|
192
|
+
</md-outlined-select>
|
|
196
193
|
</label>
|
|
197
194
|
`
|
|
198
195
|
}
|
|
@@ -218,7 +215,7 @@ export class WidgetForm extends LitElement {
|
|
|
218
215
|
// `
|
|
219
216
|
|
|
220
217
|
return html`
|
|
221
|
-
<md-
|
|
218
|
+
<md-outlined-text-field
|
|
222
219
|
.name="column-${i}"
|
|
223
220
|
style="width: 200px;"
|
|
224
221
|
.label="${field.label ?? ''}"
|
|
@@ -226,7 +223,7 @@ export class WidgetForm extends LitElement {
|
|
|
226
223
|
.value="${field.defaultValue ?? ''}"
|
|
227
224
|
supporting-text=${field.description ?? ''}
|
|
228
225
|
?required=${field.required && !field.defaultValue}
|
|
229
|
-
></md-
|
|
226
|
+
></md-outlined-text-field>
|
|
230
227
|
`
|
|
231
228
|
}
|
|
232
229
|
|
|
@@ -333,7 +330,7 @@ export class WidgetForm extends LitElement {
|
|
|
333
330
|
flex-direction: column;
|
|
334
331
|
}
|
|
335
332
|
|
|
336
|
-
md-
|
|
333
|
+
md-outlined-select {
|
|
337
334
|
flex: 1;
|
|
338
335
|
}
|
|
339
336
|
|