@record-evolution/widget-form 1.0.2 → 1.0.4
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 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/widget-form.js +50 -38
- package/dist/widget-form.js.map +1 -1
- package/package.json +1 -1
- package/src/widget-form.ts +35 -21
package/package.json
CHANGED
package/src/widget-form.ts
CHANGED
|
@@ -24,7 +24,7 @@ type Theme = {
|
|
|
24
24
|
theme_object: any
|
|
25
25
|
}
|
|
26
26
|
@customElement('widget-form-versionplaceholder')
|
|
27
|
-
export class
|
|
27
|
+
export class WidgetForm extends LitElement {
|
|
28
28
|
@property({ type: Object })
|
|
29
29
|
inputData?: InputData
|
|
30
30
|
|
|
@@ -230,6 +230,10 @@ export class WidgetTableEdit extends LitElement {
|
|
|
230
230
|
`
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
cancelEdit(event: Event) {
|
|
234
|
+
this.dialogOpen = false
|
|
235
|
+
}
|
|
236
|
+
|
|
233
237
|
static styles = css`
|
|
234
238
|
:host {
|
|
235
239
|
display: flex;
|
|
@@ -340,21 +344,43 @@ export class WidgetTableEdit extends LitElement {
|
|
|
340
344
|
lit-flatpickr {
|
|
341
345
|
z-index: 1000;
|
|
342
346
|
}
|
|
347
|
+
|
|
348
|
+
.header {
|
|
349
|
+
display: flex;
|
|
350
|
+
align-items: center;
|
|
351
|
+
--md-fab-icon-color: white;
|
|
352
|
+
--md-fab-container-color: #007bff;
|
|
353
|
+
--md-fab-label-text-color: white;
|
|
354
|
+
}
|
|
343
355
|
`
|
|
344
356
|
|
|
345
357
|
render() {
|
|
346
358
|
return html`
|
|
347
|
-
<header>
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
359
|
+
<div class="header">
|
|
360
|
+
${this.inputData?.formButton
|
|
361
|
+
? html`
|
|
362
|
+
<md-fab
|
|
363
|
+
aria-label="Add"
|
|
364
|
+
style="margin-left: 16px; --md-fab-container-color: ${this.theme?.theme_object
|
|
365
|
+
?.color[0] ?? '#9064f7'}"
|
|
366
|
+
@click=${this.openFormDialog}
|
|
367
|
+
>
|
|
368
|
+
<md-icon slot="icon">add</md-icon>
|
|
369
|
+
</md-fab>
|
|
370
|
+
`
|
|
371
|
+
: nothing}
|
|
372
|
+
<header>
|
|
373
|
+
<h3 class="paging" ?active=${this.inputData?.title}>${this.inputData?.title}</h3>
|
|
374
|
+
<p class="paging" ?active=${this.inputData?.subTitle}>${this.inputData?.subTitle}</p>
|
|
375
|
+
</header>
|
|
376
|
+
</div>
|
|
351
377
|
${!this.inputData?.formButton
|
|
352
378
|
? html`
|
|
353
379
|
<div class="wrapper">
|
|
354
380
|
${this.renderForm()}
|
|
355
381
|
<div class="form-actions">
|
|
356
|
-
<md-outlined-button form="form" value="cancel" type="
|
|
357
|
-
>
|
|
382
|
+
<md-outlined-button form="form" value="cancel" type="reset"
|
|
383
|
+
>Reset</md-outlined-button
|
|
358
384
|
>
|
|
359
385
|
<md-filled-button form="form" value="submit" type="submit" autofocus
|
|
360
386
|
>Submit</md-filled-button
|
|
@@ -363,15 +389,6 @@ export class WidgetTableEdit extends LitElement {
|
|
|
363
389
|
</div>
|
|
364
390
|
`
|
|
365
391
|
: html`
|
|
366
|
-
<md-fab
|
|
367
|
-
aria-label="Add"
|
|
368
|
-
class="edit-fab"
|
|
369
|
-
style="--md-fab-container-color: ${this.theme?.theme_object?.color[0] ?? '#9064f7'}"
|
|
370
|
-
@click=${this.openFormDialog}
|
|
371
|
-
>
|
|
372
|
-
<md-icon slot="icon">add</md-icon>
|
|
373
|
-
</md-fab>
|
|
374
|
-
|
|
375
392
|
<md-dialog
|
|
376
393
|
aria-label="${this.inputData?.title ?? 'Data Entry'}"
|
|
377
394
|
class="form"
|
|
@@ -388,11 +405,7 @@ export class WidgetTableEdit extends LitElement {
|
|
|
388
405
|
<div slot="headline">${this.inputData?.title ?? 'Data Entry'}</div>
|
|
389
406
|
${this.renderForm()}
|
|
390
407
|
<div slot="actions">
|
|
391
|
-
<md-outlined-button
|
|
392
|
-
form="form"
|
|
393
|
-
value="cancel"
|
|
394
|
-
type="button"
|
|
395
|
-
@click=${() => this.dialog?.close()}
|
|
408
|
+
<md-outlined-button form="form" value="cancel" type="reset"
|
|
396
409
|
>Cancel</md-outlined-button
|
|
397
410
|
>
|
|
398
411
|
<md-filled-button form="form" value="submit" type="submit" autofocus
|
|
@@ -412,6 +425,7 @@ export class WidgetTableEdit extends LitElement {
|
|
|
412
425
|
method="dialog"
|
|
413
426
|
class="form-content"
|
|
414
427
|
@submit=${this.handleFormSubmit}
|
|
428
|
+
@reset=${this.cancelEdit}
|
|
415
429
|
>
|
|
416
430
|
${repeat(
|
|
417
431
|
this.inputData?.formFields?.filter((field) => !field.hiddenField) ?? [],
|