@record-evolution/widget-form 1.0.2 → 1.0.3
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 +51 -38
- package/dist/widget-form.js.map +1 -1
- package/package.json +1 -1
- package/src/widget-form.ts +36 -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,44 @@ 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
|
+
padding: 16px;
|
|
352
|
+
--md-fab-icon-color: white;
|
|
353
|
+
--md-fab-container-color: #007bff;
|
|
354
|
+
--md-fab-label-text-color: white;
|
|
355
|
+
}
|
|
343
356
|
`
|
|
344
357
|
|
|
345
358
|
render() {
|
|
346
359
|
return html`
|
|
347
|
-
<header>
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
360
|
+
<div class="header">
|
|
361
|
+
${this.inputData?.formButton
|
|
362
|
+
? html`
|
|
363
|
+
<md-fab
|
|
364
|
+
aria-label="Add"
|
|
365
|
+
style="--md-fab-container-color: ${this.theme?.theme_object?.color[0] ??
|
|
366
|
+
'#9064f7'}"
|
|
367
|
+
@click=${this.openFormDialog}
|
|
368
|
+
>
|
|
369
|
+
<md-icon slot="icon">add</md-icon>
|
|
370
|
+
</md-fab>
|
|
371
|
+
`
|
|
372
|
+
: nothing}
|
|
373
|
+
<header>
|
|
374
|
+
<h3 class="paging" ?active=${this.inputData?.title}>${this.inputData?.title}</h3>
|
|
375
|
+
<p class="paging" ?active=${this.inputData?.subTitle}>${this.inputData?.subTitle}</p>
|
|
376
|
+
</header>
|
|
377
|
+
</div>
|
|
351
378
|
${!this.inputData?.formButton
|
|
352
379
|
? html`
|
|
353
380
|
<div class="wrapper">
|
|
354
381
|
${this.renderForm()}
|
|
355
382
|
<div class="form-actions">
|
|
356
|
-
<md-outlined-button form="form" value="cancel" type="
|
|
357
|
-
>
|
|
383
|
+
<md-outlined-button form="form" value="cancel" type="reset"
|
|
384
|
+
>Reset</md-outlined-button
|
|
358
385
|
>
|
|
359
386
|
<md-filled-button form="form" value="submit" type="submit" autofocus
|
|
360
387
|
>Submit</md-filled-button
|
|
@@ -363,15 +390,6 @@ export class WidgetTableEdit extends LitElement {
|
|
|
363
390
|
</div>
|
|
364
391
|
`
|
|
365
392
|
: 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
393
|
<md-dialog
|
|
376
394
|
aria-label="${this.inputData?.title ?? 'Data Entry'}"
|
|
377
395
|
class="form"
|
|
@@ -388,11 +406,7 @@ export class WidgetTableEdit extends LitElement {
|
|
|
388
406
|
<div slot="headline">${this.inputData?.title ?? 'Data Entry'}</div>
|
|
389
407
|
${this.renderForm()}
|
|
390
408
|
<div slot="actions">
|
|
391
|
-
<md-outlined-button
|
|
392
|
-
form="form"
|
|
393
|
-
value="cancel"
|
|
394
|
-
type="button"
|
|
395
|
-
@click=${() => this.dialog?.close()}
|
|
409
|
+
<md-outlined-button form="form" value="cancel" type="reset"
|
|
396
410
|
>Cancel</md-outlined-button
|
|
397
411
|
>
|
|
398
412
|
<md-filled-button form="form" value="submit" type="submit" autofocus
|
|
@@ -412,6 +426,7 @@ export class WidgetTableEdit extends LitElement {
|
|
|
412
426
|
method="dialog"
|
|
413
427
|
class="form-content"
|
|
414
428
|
@submit=${this.handleFormSubmit}
|
|
429
|
+
@reset=${this.cancelEdit}
|
|
415
430
|
>
|
|
416
431
|
${repeat(
|
|
417
432
|
this.inputData?.formFields?.filter((field) => !field.hiddenField) ?? [],
|