gd-sprest-bs 10.5.3 → 10.5.5

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.
@@ -37,10 +37,6 @@ var _SPFxWebPart = /** @class */ (function () {
37
37
  console.error("[gd-sprest-bs] The spfx property wasn't set.");
38
38
  return;
39
39
  }
40
- // Clear the webpart
41
- while (this._props.spfx.domElement.firstChild) {
42
- this._props.spfx.domElement.removeChild(this._props.spfx.domElement.firstChild);
43
- }
44
40
  // Set the page context
45
41
  gd_sprest_1.ContextInfo.setPageContext(this._props.spfx.context.pageContext);
46
42
  // Try to parse the configuration
@@ -70,8 +66,8 @@ var _SPFxWebPart = /** @class */ (function () {
70
66
  properties: {
71
67
  text: "Configuration",
72
68
  onClick: function () {
73
- // Call the click event
74
- _this.editButtonClick();
69
+ // Show the modal
70
+ _this.showEditModal();
75
71
  }
76
72
  }
77
73
  }]
@@ -119,33 +115,56 @@ var _SPFxWebPart = /** @class */ (function () {
119
115
  enumerable: false,
120
116
  configurable: true
121
117
  });
122
- // The click event for the button
123
- _SPFxWebPart.prototype.editButtonClick = function () {
124
- // Display the modal
125
- this._modal.show();
126
- // Hide the property pane
127
- this._props.spfx.context.propertyPane.close();
128
- };
129
118
  // Method to render the webpart
130
119
  _SPFxWebPart.prototype.render = function () {
120
+ // Get the webpart element
121
+ var elWP = this._props.spfx.domElement.querySelector(".webpart");
122
+ if (elWP == null) {
123
+ // Create the element
124
+ elWP = document.createElement("div");
125
+ elWP.classList.add("webpart");
126
+ this._props.spfx.domElement.appendChild(elWP);
127
+ }
128
+ else {
129
+ // Clear the element
130
+ while (elWP.firstChild) {
131
+ elWP.removeChild(elWP.firstChild);
132
+ }
133
+ }
131
134
  // Call the render event
132
- this._props.render ? this._props.render(this._props.spfx.domElement) : null;
135
+ this._props.render ? this._props.render(elWP) : null;
133
136
  };
134
137
  // Method to render the edit interface
135
138
  _SPFxWebPart.prototype.renderEdit = function () {
136
139
  var _this = this;
140
+ // Get the webpart element
141
+ var elWPConfig = this._props.spfx.domElement.querySelector(".webpart-cfg");
142
+ if (elWPConfig == null) {
143
+ // Create the element
144
+ elWPConfig = document.createElement("div");
145
+ elWPConfig.classList.add("webpart-cfg");
146
+ this._props.spfx.domElement.appendChild(elWPConfig);
147
+ }
148
+ else {
149
+ // Do nothing
150
+ return;
151
+ }
137
152
  // Render the edit button
138
153
  gd_bs_1.Components.Button({
139
- el: this._props.spfx.domElement,
154
+ el: elWPConfig,
140
155
  text: "Edit",
141
156
  onClick: function () {
142
- // Call the click event
143
- _this.editButtonClick();
157
+ // Show the edit modal
158
+ _this.showEditModal();
144
159
  }
145
160
  });
146
161
  // Create the modal props
147
162
  var modalProps = {
148
- el: this._props.spfx.domElement,
163
+ el: elWPConfig,
164
+ onClose: function () {
165
+ // Hide the property pane
166
+ _this._props.spfx.context.propertyPane.close();
167
+ },
149
168
  onRenderBody: function (el) {
150
169
  // Create the form properties
151
170
  var formProps = { el: el, value: _this._cfg };