gd-sprest-bs 10.5.7 → 10.5.8

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.
@@ -28,7 +28,10 @@ var _SPFxWebPart = /** @class */ (function () {
28
28
  this._form = null;
29
29
  /** The configuration modal. */
30
30
  this._modal = null;
31
- var isEdit = false;
31
+ /** Is in display mode */
32
+ this._isDisplay = null;
33
+ /** Is in edit mode */
34
+ this._isEdit = null;
32
35
  // Save the properties
33
36
  this._props = props;
34
37
  // Ensure the spfx object was set
@@ -39,43 +42,52 @@ var _SPFxWebPart = /** @class */ (function () {
39
42
  }
40
43
  // Set the page context
41
44
  gd_sprest_1.ContextInfo.setPageContext(this._props.spfx.context.pageContext);
42
- // Try to parse the configuration
43
- if (this._props.wpCfg) {
44
- try {
45
- this._cfg = JSON.parse(this._props.wpCfg);
46
- }
47
- catch (_a) { }
48
- }
45
+ // Set the configuration
46
+ this.Configuration = this._props.wpCfg;
49
47
  // See if this is the workbench
50
48
  if (window.location.pathname.indexOf("workbench.aspx") > 0) {
51
- // Render the configuration button
52
- this.renderEdit();
53
- // Render the solution
54
- this.render();
49
+ // Set both flags to render edit/display
50
+ this._isDisplay = true;
51
+ this._isEdit = true;
55
52
  }
56
53
  else {
57
54
  // See if this is a classic page
58
55
  if (gd_sprest_1.Helper.SP.Ribbon.exists) {
59
56
  // Set the flag
60
- isEdit = gd_sprest_1.Helper.WebPart.isEditMode();
57
+ this._isEdit = gd_sprest_1.Helper.WebPart.isEditMode();
61
58
  }
62
59
  else {
63
60
  // Set the flag
64
- isEdit = this._props.spfx.displayMode == gd_sprest_1.SPTypes.FormDisplayMode.Edit;
65
- }
66
- // Ensure we are in edit mode
67
- if (isEdit) {
68
- // Render the configuration button
69
- this.renderEdit();
70
- }
71
- else {
72
- // Render the webpart
73
- this.render();
61
+ this._isEdit = this._props.spfx.displayMode == gd_sprest_1.SPTypes.FormDisplayMode.Edit;
74
62
  }
63
+ // Set the flag
64
+ this._isDisplay = !this._isEdit;
65
+ }
66
+ // See if we are in edit mode
67
+ if (this._isEdit) {
68
+ // Render the configuration button
69
+ this.renderEdit();
70
+ }
71
+ // See if we are in display mode
72
+ if (this.IsDisplay) {
73
+ // Render the webpart
74
+ this.render();
75
75
  }
76
76
  }
77
77
  Object.defineProperty(_SPFxWebPart.prototype, "Configuration", {
78
78
  get: function () { return this._cfg; },
79
+ set: function (value) {
80
+ // Clear the value
81
+ this._cfg = {};
82
+ // Ensure a value exists
83
+ if (value) {
84
+ // Try to parse the value
85
+ try {
86
+ this._cfg = JSON.parse(value);
87
+ }
88
+ catch (_a) { }
89
+ }
90
+ },
79
91
  enumerable: false,
80
92
  configurable: true
81
93
  });
@@ -90,6 +102,16 @@ var _SPFxWebPart = /** @class */ (function () {
90
102
  enumerable: false,
91
103
  configurable: true
92
104
  });
105
+ Object.defineProperty(_SPFxWebPart.prototype, "IsDisplay", {
106
+ get: function () { return this._isDisplay; },
107
+ enumerable: false,
108
+ configurable: true
109
+ });
110
+ Object.defineProperty(_SPFxWebPart.prototype, "IsEdit", {
111
+ get: function () { return this._isEdit; },
112
+ enumerable: false,
113
+ configurable: true
114
+ });
93
115
  // Method to render the webpart
94
116
  _SPFxWebPart.prototype.render = function () {
95
117
  // Get the webpart element
@@ -146,6 +168,8 @@ var _SPFxWebPart = /** @class */ (function () {
146
168
  onClick: function () {
147
169
  // Show the modal
148
170
  _this.showEditModal();
171
+ // Close the properties window
172
+ _this._props.spfx.context.propertyPane.close();
149
173
  }
150
174
  }
151
175
  }]
@@ -210,6 +234,12 @@ var _SPFxWebPart = /** @class */ (function () {
210
234
  _this._props.onConfigSaved ? _this._props.onConfigSaved(cfg) : null;
211
235
  // Close the modal
212
236
  _this._modal.hide();
237
+ // See if we are in display mode
238
+ if (_this.IsDisplay) {
239
+ // Render the display webpart
240
+ // Do we need to do this?
241
+ //this.render();
242
+ }
213
243
  }
214
244
  }
215
245
  }
@@ -101,7 +101,7 @@ var SPFxListWebPart = function (wpProps) {
101
101
  loadLists();
102
102
  }
103
103
  },
104
- //
104
+ // The configuration saving event
105
105
  onConfigSaving: function (cfg) {
106
106
  // Get the form values
107
107
  var values = wp.Form.getValues();