@exmg/exm-form 1.1.8 → 1.1.10-alpha.19

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.
@@ -1,9 +1,8 @@
1
1
  import '@exmg/exm-button/exm-text-button.js';
2
- import '@material/web/button/text-button.js';
2
+ import '@material/web/button/outlined-button.js';
3
+ import '@material/web/button/filled-button.js';
3
4
  import '@material/web/divider/divider.js';
4
5
  import { ExmgElement } from '@exmg/lit-base';
5
- export declare const CLOSE_ACTION = "close";
6
- export declare const serializeForm: (form: any) => {};
7
6
  declare const ExmFormBase_base: import("./exm-form-validate-mixin.js").Constructor<import("./exm-form-validate-mixin.js").FormValidateMixinInterface> & typeof ExmgElement;
8
7
  export declare class ExmFormBase extends ExmFormBase_base {
9
8
  /**
@@ -20,7 +19,8 @@ export declare class ExmFormBase extends ExmFormBase_base {
20
19
  submitting: boolean;
21
20
  boundHandleBlur?: (e: Event) => void;
22
21
  boundHandleKeyup?: (e: Event) => void;
23
- hasAsideContent: boolean;
22
+ hasDescription: boolean;
23
+ hasHeader: boolean;
24
24
  errorMessage?: string | null;
25
25
  reset(): void;
26
26
  submit(): void;
@@ -31,13 +31,14 @@ export declare class ExmFormBase extends ExmFormBase_base {
31
31
  doAction?(formData: unknown): Promise<void> | void;
32
32
  protected handleSubmit(): Promise<void>;
33
33
  showError(message: string): void;
34
+ slotHasContent(slot: HTMLSlotElement): boolean;
35
+ handleDescriptionSlotChange(event: CustomEvent): void;
36
+ handleHeaderSlotChange(event: CustomEvent): void;
34
37
  protected renderToolbar(): import("lit-html").TemplateResult<1>;
35
- protected renderFormContent(): import("lit-html").TemplateResult<1>;
36
- protected renderAside(): import("lit-html").TemplateResult<1>;
37
- handleAsideSlotChange(e: CustomEvent): void;
38
+ renderFormContent(): import("lit-html").TemplateResult<1>;
39
+ protected renderDescription(): import("lit-html").TemplateResult<1>;
38
40
  protected renderError(): import("lit-html").TemplateResult<1>;
39
41
  protected renderActions(): import("lit-html").TemplateResult<1>;
40
- protected renderContainer(): import("lit-html").TemplateResult<1>;
41
42
  protected render(): import("lit-html").TemplateResult<1>;
42
43
  }
43
44
  export {};
@@ -1,78 +1,14 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { html, nothing } from 'lit';
3
- import { property } from 'lit/decorators.js';
3
+ import { property, state } from 'lit/decorators.js';
4
4
  import '@exmg/exm-button/exm-text-button.js';
5
- import '@material/web/button/text-button.js';
5
+ import '@material/web/button/outlined-button.js';
6
+ import '@material/web/button/filled-button.js';
6
7
  import '@material/web/divider/divider.js';
7
8
  import { ExmgElement } from '@exmg/lit-base';
8
9
  import { classMap } from 'lit/directives/class-map.js';
9
10
  import { ExmFormValidateMixin } from './exm-form-validate-mixin.js';
10
- export const CLOSE_ACTION = 'close';
11
- export const serializeForm = (form) => {
12
- const obj = {};
13
- const formElements = form === null || form === void 0 ? void 0 : form.elements;
14
- const formElementsArray = Array.from(formElements);
15
- /**
16
- * Create list of checkbox elements. If no value is set the return value of the checkbox for 'on' will be a boolean
17
- */
18
- const checkboxNames = formElementsArray
19
- .filter((input) => {
20
- return input.value === 'on' && (input.type === 'checkbox' || input.tagName.toLowerCase().includes('checkbox'));
21
- })
22
- .map((input) => input.name);
23
- /* Same for the radio items */
24
- const radioNames = formElementsArray
25
- .filter((input) => {
26
- return input.type === 'radio' || input.tagName.toLowerCase().includes('radio');
27
- })
28
- .map((input) => input.name);
29
- const numberNames = formElementsArray
30
- .filter((input) => {
31
- return input.type === 'number';
32
- })
33
- .map((input) => input.name);
34
- const formData = new FormData(form);
35
- for (const pair of formData.entries()) {
36
- const key = pair[0];
37
- const val = pair[1];
38
- if (Object.hasOwnProperty.call(obj, key)) {
39
- if (!Array.isArray(obj[key])) {
40
- obj[key] = [obj[key]];
41
- }
42
- obj[key].push(val);
43
- continue;
44
- }
45
- if (numberNames.includes(key)) {
46
- obj[key] = val ? parseFloat(`${val}`) : undefined;
47
- continue;
48
- }
49
- // When set to on convert to boolean return value
50
- // @ts-ignore
51
- if (checkboxNames.includes(key)) {
52
- obj[key] = val === 'on';
53
- continue;
54
- }
55
- // Check for a default value of on for radio items to set to true, if not, set to the value
56
- if (radioNames.includes(key)) {
57
- if (val === 'on') {
58
- obj[key] = val === 'on';
59
- }
60
- else {
61
- obj[key] = val;
62
- }
63
- continue;
64
- }
65
- obj[key] = formData.get(key);
66
- }
67
- // All checkboxes that are not checked will not be included in the form data and need to return false
68
- for (const name of checkboxNames) {
69
- // check for
70
- if (!Object.hasOwnProperty.call(obj, name)) {
71
- obj[name] = false;
72
- }
73
- }
74
- return obj;
75
- };
11
+ import { serializeFormData } from './utils/serializeFormData.js';
76
12
  export class ExmFormBase extends ExmFormValidateMixin(ExmgElement) {
77
13
  constructor() {
78
14
  super(...arguments);
@@ -88,7 +24,8 @@ export class ExmFormBase extends ExmFormValidateMixin(ExmgElement) {
88
24
  * Internall used to show button spinner.
89
25
  */
90
26
  this.submitting = false;
91
- this.hasAsideContent = false;
27
+ this.hasDescription = false;
28
+ this.hasHeader = false;
92
29
  }
93
30
  reset() {
94
31
  const form = this.getForm();
@@ -107,11 +44,12 @@ export class ExmFormBase extends ExmFormValidateMixin(ExmgElement) {
107
44
  return;
108
45
  }
109
46
  // Serialize form data
110
- const data = serializeForm(form);
47
+ const data = serializeFormData(form);
111
48
  if (this.doAction) {
112
49
  try {
113
50
  this.submitting = true;
114
51
  await this.doAction(data);
52
+ this.fire('form-success', null, true);
115
53
  }
116
54
  catch (error) {
117
55
  this.showError(error instanceof Error ? error.message : 'Unknown error');
@@ -119,6 +57,7 @@ export class ExmFormBase extends ExmFormValidateMixin(ExmgElement) {
119
57
  }
120
58
  finally {
121
59
  this.submitting = false;
60
+ this.fire('form-submit-finished', { success: !this.errorMessage });
122
61
  }
123
62
  }
124
63
  else {
@@ -128,51 +67,72 @@ export class ExmFormBase extends ExmFormValidateMixin(ExmgElement) {
128
67
  showError(message) {
129
68
  this.errorMessage = message;
130
69
  }
70
+ slotHasContent(slot) {
71
+ const nodes = slot.assignedNodes({ flatten: true });
72
+ return nodes.length > 0;
73
+ }
74
+ handleDescriptionSlotChange(event) {
75
+ this.hasDescription = this.slotHasContent(event.target);
76
+ }
77
+ handleHeaderSlotChange(event) {
78
+ this.hasHeader = this.slotHasContent(event.target);
79
+ }
131
80
  renderToolbar() {
132
- return html `<div class="toolbar-container"><slot name="toolbar"></slot></div>`;
81
+ return html `
82
+ <header class="toolbar-container">
83
+ <slot name="toolbar" @slotchange="${this.handleHeaderSlotChange}"></slot>
84
+ </header>
85
+ `;
133
86
  }
134
87
  renderFormContent() {
135
- return html `<slot></slot>`;
136
- }
137
- renderAside() {
138
- return html `<slot name="aside" @slotchange="${this.handleAsideSlotChange}"></slot>`;
88
+ return html `
89
+ <section class="content">
90
+ <slot></slot>
91
+ </section>
92
+ `;
139
93
  }
140
- handleAsideSlotChange(e) {
141
- const slot = e.target;
142
- // @ts-ignore
143
- const nodes = slot.assignedNodes({ flatten: true });
144
- this.hasAsideContent = nodes.length > 0;
94
+ renderDescription() {
95
+ return html `
96
+ <section class="description">
97
+ <slot name="description" @slotchange="${this.handleDescriptionSlotChange}"></slot>
98
+ </section>
99
+ `;
145
100
  }
146
101
  renderError() {
147
- return html `<div class="form-error"><div>${this.errorMessage}</div></div>`;
102
+ return html `
103
+ <div class="form-error">
104
+ <div>${this.errorMessage}</div>
105
+ </div>
106
+ `;
148
107
  }
149
108
  renderActions() {
150
109
  return html `
151
- <div class="actions">
152
- <md-text-button slot="footer" dialogFocus @click=${() => this.fire('form-cancel')}
153
- >${this.cancelBtn}</md-text-button
154
- >
155
- <exm-text-button
156
- slot="footer"
110
+ <footer class="actions">
111
+ <md-outlined-button dialogFocus @click=${() => this.fire('form-cancel')}>
112
+ ${this.cancelBtn}
113
+ </md-outlined-button>
114
+ <md-filled-button
115
+ type="button"
157
116
  @click=${this.handleSubmit}
158
117
  ?disabled=${this.submitting || !this.formValid}
159
118
  ?loading=${this.submitting}
160
- >${this.submitBtn}</exm-text-button
161
119
  >
162
- </div>
120
+ ${this.submitBtn}
121
+ </md-filled-button>
122
+ </footer>
163
123
  `;
164
124
  }
165
- renderContainer() {
166
- return html ` <div class="container">
167
- <div class="content">${this.renderFormContent()}</div>
168
- <div class="aside ${classMap({ empty: !this.hasAsideContent })}">${this.renderAside()}</div>
169
- </div>`;
170
- }
171
125
  render() {
126
+ const classNames = {
127
+ 'has-description': this.hasDescription,
128
+ 'has-header': this.hasHeader,
129
+ 'has-error': !!this.errorMessage,
130
+ };
172
131
  return html `
173
- ${this.renderToolbar()} ${this.errorMessage ? this.renderError() : nothing} ${this.renderContainer()}
174
- <div class="divider"><md-divider></md-divider></div>
175
- ${this.renderActions()}
132
+ <article class="form-container ${classMap(classNames)}">
133
+ ${this.renderToolbar()} ${this.renderDescription()} ${this.errorMessage ? this.renderError() : nothing}
134
+ ${this.renderFormContent()} ${this.renderActions()}
135
+ </article>
176
136
  `;
177
137
  }
178
138
  }
@@ -186,8 +146,11 @@ __decorate([
186
146
  property({ type: Boolean })
187
147
  ], ExmFormBase.prototype, "submitting", void 0);
188
148
  __decorate([
189
- property({ type: Boolean })
190
- ], ExmFormBase.prototype, "hasAsideContent", void 0);
149
+ state()
150
+ ], ExmFormBase.prototype, "hasDescription", void 0);
151
+ __decorate([
152
+ state()
153
+ ], ExmFormBase.prototype, "hasHeader", void 0);
191
154
  __decorate([
192
155
  property({ type: String })
193
156
  ], ExmFormBase.prototype, "errorMessage", void 0);
@@ -1,6 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
  export type Constructor<T> = new (...args: any[]) => T;
3
- export declare abstract class FormValidateMixinClass extends LitElement {
3
+ export declare class FormValidateMixinClass extends LitElement {
4
4
  }
5
5
  export declare class FormValidateMixinInterface {
6
6
  formValid: boolean;
@@ -11,10 +11,13 @@ export const ExmFormValidateMixin = (superClass) => {
11
11
  this.formValid = false;
12
12
  }
13
13
  getForm() {
14
- return this.shadowRoot.querySelector('form');
14
+ return this === null || this === void 0 ? void 0 : this.shadowRoot.querySelector('form');
15
15
  }
16
16
  checkFormValidity() {
17
17
  const form = this.getForm();
18
+ if (!form) {
19
+ return;
20
+ }
18
21
  const formElements = form === null || form === void 0 ? void 0 : form.elements;
19
22
  let allValid = true;
20
23
  for (const el of formElements || []) {
@@ -33,19 +36,22 @@ export const ExmFormValidateMixin = (superClass) => {
33
36
  _handleInputChange(e) {
34
37
  const target = e.target;
35
38
  // Only check validation every 200ms max
36
- this._debouncer = debounce.Debouncer.debounce(this._debouncer, async.timeOut.after(200), () => {
39
+ this.debouncer = debounce.Debouncer.debounce(this.debouncer, async.timeOut.after(200), () => {
37
40
  // @ts-ignore
38
41
  typeof target.reportValidity === 'function' && target.reportValidity();
39
42
  this.checkFormValidity();
40
43
  });
41
44
  }
42
- firstUpdated() {
45
+ async firstUpdated() {
43
46
  const form = this.getForm();
47
+ if (!form) {
48
+ return;
49
+ }
44
50
  this.boundHandleChange = this._handleInputChange.bind(this);
45
51
  form.addEventListener('keyup', this.boundHandleChange, true);
46
52
  form.addEventListener('input', this.boundHandleChange, true);
47
53
  }
48
- disconnectedCallback() {
54
+ async disconnectedCallback() {
49
55
  const form = this.getForm();
50
56
  this.boundHandleChange && form.addEventListener('keyup', this.boundHandleChange, true);
51
57
  this.boundHandleChange && form.addEventListener('input', this.boundHandleChange, true);
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { ExmForm } from './exm-form.js';
2
2
  export { ExmFormValidateMixin, Constructor } from './exm-form-validate-mixin.js';
3
- export { ExmFormBase, serializeForm } from './exm-form-base.js';
3
+ export { ExmFormBase } from './exm-form-base.js';
4
+ export { serializeFormData } from './utils/serializeFormData.js';
4
5
  export { style as formStyles } from './styles/exm-form-css.js';
5
6
  export { style as formBaseStyles } from './styles/exm-form-base-css.js';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { ExmForm } from './exm-form.js';
2
2
  export { ExmFormValidateMixin } from './exm-form-validate-mixin.js';
3
- export { ExmFormBase, serializeForm } from './exm-form-base.js';
3
+ export { ExmFormBase } from './exm-form-base.js';
4
+ export { serializeFormData } from './utils/serializeFormData.js';
4
5
  export { style as formStyles } from './styles/exm-form-css.js';
5
6
  export { style as formBaseStyles } from './styles/exm-form-base-css.js';
6
7
  //# sourceMappingURL=index.js.map
@@ -15,67 +15,77 @@ export const style = css `
15
15
  --_exm-form-aside-min-width: var(--exm-form-aside-min-width, 180px);
16
16
  }
17
17
 
18
- .aside {
19
- line-height: var(--_exm-form-aside-line-height);
20
- font-size: var(--_exm-form-aside-font-size);
21
- letter-spacing: var(--_exm-form-aside-letter-spacing);
22
- font-weight: var(--_exm-form-aside-font-weight);
23
- color: var(--_exm-form-aside-color, var(--md-sys-color-on-surface));
24
- border-left: 1px solid var(--md-sys-color-outline-variant);
25
- box-sizing: border-box;
26
- margin-left: var(--_exm-form-aside-margin-left);
27
- margin-right: var(--_exm-form-aside-margin-right);
28
- min-height: 2rem;
29
- padding-left: 1rem;
30
- vertical-align: top;
18
+ .form-container {
19
+ display: grid;
20
+ grid-template-rows: auto auto auto 1fr auto;
31
21
  height: 100%;
32
- min-width: var(--_exm-form-aside-min-width);
33
- flex: 0;
34
22
  }
35
23
 
36
- .aside.empty {
24
+ ::slotted(.toolbar) {
25
+ grid-area: 1/1/2/2;
37
26
  display: none;
27
+ align-items: center;
28
+ padding: 0.5rem 1rem;
29
+ min-height: 3.5rem;
30
+ box-sizing: border-box;
38
31
  }
39
32
 
40
- .content,
41
- .container {
42
- display: flex;
43
- }
44
-
45
- .content {
46
- flex: 1;
47
- }
48
-
49
- .container {
50
- margin-top: var(--_exm-form-container-margin-top);
51
- margin-bottom: var(--_exm-form-container-margin-bottom);
33
+ ::slotted(.toolbar) .title {
34
+ line-height: 1.5rem;
35
+ font-size: 1rem;
36
+ letter-spacing: 0.00625em;
37
+ font-weight: 500;
38
+ color: var(--md-sys-color-on-surface);
39
+ box-sizing: border-box;
40
+ overflow-wrap: break-word;
52
41
  }
53
42
 
54
- .actions {
43
+ .has-header ::slotted(.toolbar) {
55
44
  display: flex;
56
- padding: 8px 4px;
57
- justify-content: flex-end;
58
45
  }
59
46
 
60
- .actions > * {
61
- margin-right: 8px;
47
+ .description {
48
+ grid-area: 2/1/3/2;
49
+ display: none;
50
+ padding: 0.5rem 1rem;
51
+ line-height: var(--_exm-form-aside-line-height);
52
+ font-size: var(--_exm-form-aside-font-size);
53
+ letter-spacing: var(--_exm-form-aside-letter-spacing);
54
+ font-weight: var(--_exm-form-aside-font-weight);
55
+ color: var(--_exm-form-aside-color, var(--md-sys-color-on-surface));
56
+ height: 100%;
62
57
  }
63
58
 
64
- .divider {
65
- margin-top: var(--_exm-form-divider-margin-top);
59
+ .has-description .description {
60
+ display: initial;
66
61
  }
67
62
 
68
63
  .content {
69
- margin-left: var(--_exm-form-content-margin-left);
64
+ grid-area: 4/1/5/2;
65
+ padding: 0.5rem 1rem;
66
+ overflow: scroll;
67
+ }
68
+
69
+ .actions {
70
+ grid-area: 5/1/6/2;
71
+ display: flex;
72
+ padding: 1rem;
73
+ margin-top: 1rem;
74
+ gap: 0.5rem;
75
+ justify-content: flex-end;
76
+ border-top: 1px solid var(--md-sys-color-outline-variant);
70
77
  }
71
78
 
72
79
  .form-error {
73
- background-color: var(--_exm-form-error-background, var(--md-sys-color-error-container, red));
74
- color: var(--_exm-form-error-color, var(--md-sys-color-on-error-container, white));
80
+ grid-area: 3/1/4/2;
81
+ padding: 0.5rem 1rem;
75
82
  }
76
83
 
77
84
  .form-error > div {
78
85
  padding: 1rem;
86
+ border-radius: 1rem;
87
+ background-color: var(--_exm-form-error-background, var(--md-sys-color-error-container, red));
88
+ color: var(--_exm-form-error-color, var(--md-sys-color-on-error-container, white));
79
89
  }
80
90
  `;
81
91
  //# sourceMappingURL=exm-form-base-css.js.map
@@ -9,41 +9,20 @@ export const style = css `
9
9
  padding-bottom: 8px;
10
10
  }
11
11
 
12
- .aside {
13
- --_exm-form-aside-font-size: var(--exm-form-aside-font-size, 0.875rem);
14
- --_exm-form-aside-line-height: var(--exm-form-aside-line-height, 1.25rem);
15
- --_exm-form-aside-letter-spacing: var(--exm-form-aside-letter-spacing, 0.0142857143em);
16
- --_exm-form-aside-font-weight: var(--exm-form-aside-font-weight, 400);
17
- --_exm-form-aside-margin-left: var(--exm-form-aside-margin-left, 1rem);
18
- --_exm-form-aside-margin-right: var(--exm-form-aside-margin-right, 5rem);
19
- --_exm-form-aside-min-width: var(--exm-form-aside-min-width, 180px);
20
- line-height: var(--_exm-form-aside-line-height);
21
- font-size: var(--_exm-form-aside-font-size);
22
- letter-spacing: var(--_exm-form-aside-letter-spacing);
23
- font-weight: var(--_exm-form-aside-font-weight);
24
- color: var(--md-sys-color-on-surface);
25
- border-left: 1px solid var(--md-sys-color-outline-variant);
26
- box-sizing: border-box;
27
- margin-left: var(--_exm-form-aside-margin-left);
28
- margin-right: var(--_exm-form-aside-margin-right);
29
- min-height: 2rem;
30
- padding-left: 1rem;
31
- vertical-align: top;
32
- height: 100%;
33
- min-width: var(--_exm-form-aside-min-width);
34
- flex: 0;
35
- }
36
-
37
12
  form {
38
- margin: 0 1rem;
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: 0.75rem;
39
16
  width: 100%;
40
17
  }
41
18
 
19
+ form > * {
20
+ display: contents;
21
+ }
22
+
42
23
  form .row {
43
24
  display: flex;
44
- gap: 6px;
45
- height: 76px;
46
- align-items: flex-start;
25
+ gap: 0.75rem;
47
26
  }
48
27
 
49
28
  form .row > * {
@@ -51,21 +30,6 @@ export const style = css `
51
30
  height: fit-content;
52
31
  }
53
32
 
54
- form {
55
- display: flex;
56
- flex-direction: column;
57
- gap: 12px;
58
- margin-top: 0.5rem;
59
- }
60
-
61
- form > * {
62
- display: contents;
63
- }
64
-
65
- .actions > * {
66
- margin-right: 8px;
67
- }
68
-
69
33
  .no-flex {
70
34
  display: block;
71
35
  }
@@ -88,24 +52,6 @@ export const style = css `
88
52
  margin-right: 1rem;
89
53
  }
90
54
 
91
- .toolbar {
92
- display: flex;
93
- align-items: center;
94
- padding: 8px 4px 8px 16px;
95
- height: 56px;
96
- box-sizing: border-box;
97
- }
98
-
99
- .toolbar .title {
100
- line-height: 1.5rem;
101
- font-size: 1rem;
102
- letter-spacing: 0.00625em;
103
- font-weight: 500;
104
- color: var(--md-sys-color-on-surface);
105
- box-sizing: border-box;
106
- overflow-wrap: break-word;
107
- }
108
-
109
55
  a {
110
56
  color: var(--md-sys-color-primary);
111
57
  }
@@ -0,0 +1 @@
1
+ export declare const serializeFormData: (form: HTMLFormElement) => {};
@@ -0,0 +1,64 @@
1
+ export const serializeFormData = (form) => {
2
+ const obj = {};
3
+ const formElements = form === null || form === void 0 ? void 0 : form.elements;
4
+ const formElementsArray = Array.from(formElements);
5
+ /**
6
+ * Create list of checkbox elements. If no value is set the return value of the checkbox for 'on' will be a boolean
7
+ */
8
+ const checkboxNames = formElementsArray
9
+ .filter((input) => {
10
+ return input.value === 'on' && (input.type === 'checkbox' || input.tagName.toLowerCase().includes('checkbox'));
11
+ })
12
+ .map((input) => input.name);
13
+ /* Same for the radio items */
14
+ const radioNames = formElementsArray
15
+ .filter((input) => {
16
+ return input.type === 'radio' || input.tagName.toLowerCase().includes('radio');
17
+ })
18
+ .map((input) => input.name);
19
+ const numberNames = formElementsArray
20
+ .filter((input) => {
21
+ return input.type === 'number';
22
+ })
23
+ .map((input) => input.name);
24
+ const formData = new FormData(form);
25
+ for (const [key, value] of formData.entries()) {
26
+ if (Object.hasOwnProperty.call(obj, key)) {
27
+ if (!Array.isArray(obj[key])) {
28
+ obj[key] = [obj[key]];
29
+ }
30
+ obj[key].push(value);
31
+ continue;
32
+ }
33
+ if (numberNames.includes(key)) {
34
+ obj[key] = value ? parseFloat(`${value}`) : undefined;
35
+ continue;
36
+ }
37
+ // When set to on convert to boolean return value
38
+ // @ts-ignore
39
+ if (checkboxNames.includes(key)) {
40
+ obj[key] = value === 'on';
41
+ continue;
42
+ }
43
+ // Check for a default value of on for radio items to set to true, if not, set to the value
44
+ if (radioNames.includes(key)) {
45
+ if (value === 'on') {
46
+ obj[key] = value === 'on';
47
+ }
48
+ else {
49
+ obj[key] = value;
50
+ }
51
+ continue;
52
+ }
53
+ obj[key] = formData.get(key);
54
+ }
55
+ // All checkboxes that are not checked will not be included in the form data and need to return false
56
+ for (const name of checkboxNames) {
57
+ // check for
58
+ if (!Object.hasOwnProperty.call(obj, name)) {
59
+ obj[name] = false;
60
+ }
61
+ }
62
+ return obj;
63
+ };
64
+ //# sourceMappingURL=serializeFormData.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exmg/exm-form",
3
- "version": "1.1.8",
3
+ "version": "1.1.10-alpha.19+20be399",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,17 +31,15 @@
31
31
  },
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@exmg/exm-button": "^1.1.8",
35
- "@material/typography": "^14.0.0",
36
- "lit": "^3.0.0",
37
- "tslib": "^2.6.2"
34
+ "@exmg/exm-button": "^1.1.10-alpha.19+20be399"
38
35
  },
39
- "devDependencies": {
40
- "@exmg/lit-cli": "1.1.13"
36
+ "peerDependencies": {
37
+ "lit": "^3.2.1",
38
+ "tslib": "^2.6.2"
41
39
  },
42
40
  "scripts": {},
43
41
  "publishConfig": {
44
42
  "access": "public"
45
43
  },
46
- "gitHead": "e9c6e6e7b81658423344b640be549700e95be7c0"
44
+ "gitHead": "20be399892ecc54f71f080f17a677a370d9f2b9c"
47
45
  }