@exmg/exm-form-drawer 1.1.27 → 1.1.29

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.
@@ -20,6 +20,14 @@ export declare class ExmFormDrawerBase extends ExmgElement {
20
20
  * @type {String}
21
21
  */
22
22
  cancelBtn: string;
23
+ /**
24
+ * Hide cancel button
25
+ */
26
+ hideCancelButton: boolean;
27
+ /**
28
+ * Show reset button
29
+ */
30
+ showResetButton: boolean;
23
31
  /**
24
32
  * Whether or not to keep the form drawer opened on submit success
25
33
  * @type {Boolean}
@@ -30,6 +38,11 @@ export declare class ExmFormDrawerBase extends ExmgElement {
30
38
  * @type {Boolean}
31
39
  */
32
40
  noCancelOnOutsideClick: boolean;
41
+ /**
42
+ * No reset on close
43
+ * @type {Boolean}
44
+ */
45
+ noResetOnClose: boolean;
33
46
  /**
34
47
  * Internall used to show button spinner.
35
48
  */
@@ -60,6 +73,6 @@ export declare class ExmFormDrawerBase extends ExmgElement {
60
73
  * Method should be overriden to render form content
61
74
  */
62
75
  protected renderFormContent(): import("lit-html").TemplateResult<1> | undefined;
63
- protected handleDrawerOpenedChanged(e: CustomEvent): void;
76
+ protected handleDrawerOpenedChanged(event: CustomEvent): void;
64
77
  protected render(): import("lit-html").TemplateResult<1>;
65
78
  }
@@ -23,7 +23,15 @@ export class ExmFormDrawerBase extends ExmgElement {
23
23
  * Title of the cancel button
24
24
  * @type {String}
25
25
  */
26
- this.cancelBtn = 'Reset';
26
+ this.cancelBtn = 'Cancel';
27
+ /**
28
+ * Hide cancel button
29
+ */
30
+ this.hideCancelButton = false;
31
+ /**
32
+ * Show reset button
33
+ */
34
+ this.showResetButton = false;
27
35
  /**
28
36
  * Whether or not to keep the form drawer opened on submit success
29
37
  * @type {Boolean}
@@ -34,6 +42,11 @@ export class ExmFormDrawerBase extends ExmgElement {
34
42
  * @type {Boolean}
35
43
  */
36
44
  this.noCancelOnOutsideClick = false;
45
+ /**
46
+ * No reset on close
47
+ * @type {Boolean}
48
+ */
49
+ this.noResetOnClose = false;
37
50
  /**
38
51
  * Internall used to show button spinner.
39
52
  */
@@ -91,14 +104,20 @@ export class ExmFormDrawerBase extends ExmgElement {
91
104
  var _a;
92
105
  return (_a = this.exmForm) === null || _a === void 0 ? void 0 : _a.renderFormContent();
93
106
  }
94
- handleDrawerOpenedChanged(e) {
95
- this.opened = e.detail.value;
107
+ handleDrawerOpenedChanged(event) {
108
+ const opened = event.detail.value;
96
109
  if (!this.exmForm) {
97
110
  return;
98
111
  }
99
- if (this.opened) {
112
+ if (opened) {
113
+ this.exmForm.takeFormDataSnapshot();
100
114
  this.exmForm.checkFormValidity();
101
115
  }
116
+ else if (!this.noResetOnClose) {
117
+ // NOTE: Reset form data when closing the drawer
118
+ this.reset();
119
+ }
120
+ this.opened = opened;
102
121
  }
103
122
  render() {
104
123
  return html `
@@ -123,8 +142,10 @@ export class ExmFormDrawerBase extends ExmgElement {
123
142
  .errorMessage=${this.errorMessage}
124
143
  class="form-elements"
125
144
  @form-submit-finished=${this.handleSubmitFinished}
126
- @form-cancel=${this.reset}
145
+ @form-cancel=${this.close}
127
146
  doAction=${ifDefined(this.doAction)}
147
+ ?hide-cancel-button=${this.hideCancelButton}
148
+ ?show-reset-button=${this.showResetButton}
128
149
  >
129
150
  ${this.renderFormContent()}
130
151
  </exm-form>
@@ -142,12 +163,21 @@ __decorate([
142
163
  __decorate([
143
164
  property({ type: String, attribute: 'cancel-btn-title' })
144
165
  ], ExmFormDrawerBase.prototype, "cancelBtn", void 0);
166
+ __decorate([
167
+ property({ type: Boolean, attribute: 'hide-cancel-button' })
168
+ ], ExmFormDrawerBase.prototype, "hideCancelButton", void 0);
169
+ __decorate([
170
+ property({ type: Boolean, attribute: 'show-reset-button' })
171
+ ], ExmFormDrawerBase.prototype, "showResetButton", void 0);
145
172
  __decorate([
146
173
  property({ type: Boolean, attribute: 'keep-opened-on-submit-success' })
147
174
  ], ExmFormDrawerBase.prototype, "keepOpenedOnSubmitSuccess", void 0);
148
175
  __decorate([
149
176
  property({ type: Boolean, attribute: 'no-cancel-on-outside-click' })
150
177
  ], ExmFormDrawerBase.prototype, "noCancelOnOutsideClick", void 0);
178
+ __decorate([
179
+ property({ type: Boolean, attribute: 'no-reset-on-close' })
180
+ ], ExmFormDrawerBase.prototype, "noResetOnClose", void 0);
151
181
  __decorate([
152
182
  property({ type: Boolean })
153
183
  ], ExmFormDrawerBase.prototype, "submitting", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exmg/exm-form-drawer",
3
- "version": "1.1.27",
3
+ "version": "1.1.29",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,8 +31,8 @@
31
31
  },
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@exmg/exm-drawer": "^1.1.27",
35
- "@exmg/exm-form": "^1.1.27"
34
+ "@exmg/exm-drawer": "^1.1.29",
35
+ "@exmg/exm-form": "^1.1.29"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "lit": "^3.2.1",
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "4e9a663fa89175607c2cdffaf3611cc2125939f8"
45
+ "gitHead": "4f87060160e9545bc7190a0f5e1e47a311933e9c"
46
46
  }