gd-sprest-bs 10.5.7 → 10.5.9

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.
@@ -21,6 +21,7 @@ var _SPFxWebPart = /** @class */ (function () {
21
21
  /** The configuration modal. */
22
22
  // Constructor
23
23
  function _SPFxWebPart(props) {
24
+ var _this = this;
24
25
  this._props = null;
25
26
  /** The webpart configuration */
26
27
  this._cfg = null;
@@ -28,7 +29,10 @@ var _SPFxWebPart = /** @class */ (function () {
28
29
  this._form = null;
29
30
  /** The configuration modal. */
30
31
  this._modal = null;
31
- var isEdit = false;
32
+ /** Is in display mode */
33
+ this._isDisplay = null;
34
+ /** Is in edit mode */
35
+ this._isEdit = null;
32
36
  // Save the properties
33
37
  this._props = props;
34
38
  // Ensure the spfx object was set
@@ -39,43 +43,55 @@ var _SPFxWebPart = /** @class */ (function () {
39
43
  }
40
44
  // Set the page context
41
45
  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
- }
46
+ // Set the configuration
47
+ this.Configuration = this._props.wpCfg;
49
48
  // See if this is the workbench
50
49
  if (window.location.pathname.indexOf("workbench.aspx") > 0) {
51
- // Render the configuration button
52
- this.renderEdit();
53
- // Render the solution
54
- this.render();
50
+ // Set both flags to render edit/display
51
+ this._isDisplay = true;
52
+ this._isEdit = true;
55
53
  }
56
54
  else {
57
55
  // See if this is a classic page
58
56
  if (gd_sprest_1.Helper.SP.Ribbon.exists) {
59
57
  // Set the flag
60
- isEdit = gd_sprest_1.Helper.WebPart.isEditMode();
58
+ this._isEdit = gd_sprest_1.Helper.WebPart.isEditMode();
61
59
  }
62
60
  else {
63
61
  // Set the flag
64
- isEdit = this._props.spfx.displayMode == gd_sprest_1.SPTypes.FormDisplayMode.Edit;
62
+ this._isEdit = this._props.spfx.displayMode == gd_sprest_1.SPTypes.FormDisplayMode.Edit;
65
63
  }
66
- // Ensure we are in edit mode
67
- if (isEdit) {
64
+ // Set the flag
65
+ this._isDisplay = !this._isEdit;
66
+ }
67
+ // Run the render method in another thread
68
+ setTimeout(function () {
69
+ // See if we are in edit mode
70
+ if (_this._isEdit) {
68
71
  // Render the configuration button
69
- this.renderEdit();
72
+ _this.renderEdit();
70
73
  }
71
- else {
74
+ // See if we are in display mode
75
+ if (_this.IsDisplay) {
72
76
  // Render the webpart
73
- this.render();
77
+ _this.render();
74
78
  }
75
- }
79
+ }, 10);
76
80
  }
77
81
  Object.defineProperty(_SPFxWebPart.prototype, "Configuration", {
78
82
  get: function () { return this._cfg; },
83
+ set: function (value) {
84
+ // Clear the value
85
+ this._cfg = {};
86
+ // Ensure a value exists
87
+ if (value) {
88
+ // Try to parse the value
89
+ try {
90
+ this._cfg = JSON.parse(value);
91
+ }
92
+ catch (_a) { }
93
+ }
94
+ },
79
95
  enumerable: false,
80
96
  configurable: true
81
97
  });
@@ -90,6 +106,16 @@ var _SPFxWebPart = /** @class */ (function () {
90
106
  enumerable: false,
91
107
  configurable: true
92
108
  });
109
+ Object.defineProperty(_SPFxWebPart.prototype, "IsDisplay", {
110
+ get: function () { return this._isDisplay; },
111
+ enumerable: false,
112
+ configurable: true
113
+ });
114
+ Object.defineProperty(_SPFxWebPart.prototype, "IsEdit", {
115
+ get: function () { return this._isEdit; },
116
+ enumerable: false,
117
+ configurable: true
118
+ });
93
119
  // Method to render the webpart
94
120
  _SPFxWebPart.prototype.render = function () {
95
121
  // Get the webpart element
@@ -146,6 +172,8 @@ var _SPFxWebPart = /** @class */ (function () {
146
172
  onClick: function () {
147
173
  // Show the modal
148
174
  _this.showEditModal();
175
+ // Close the properties window
176
+ _this._props.spfx.context.propertyPane.close();
149
177
  }
150
178
  }
151
179
  }]
@@ -210,6 +238,12 @@ var _SPFxWebPart = /** @class */ (function () {
210
238
  _this._props.onConfigSaved ? _this._props.onConfigSaved(cfg) : null;
211
239
  // Close the modal
212
240
  _this._modal.hide();
241
+ // See if we are in display mode
242
+ if (_this.IsDisplay) {
243
+ // Render the display webpart
244
+ // Do we need to do this?
245
+ //this.render();
246
+ }
213
247
  }
214
248
  }
215
249
  }
@@ -22,7 +22,7 @@ var SPFxListWebPart = function (wpProps) {
22
22
  var _ddl = null;
23
23
  var _loadFl = false;
24
24
  // Load the lists
25
- var loadLists = function () {
25
+ var loadLists = function (listId) {
26
26
  // Disable the dropdown
27
27
  _ddl.disable();
28
28
  // Get the web url
@@ -42,7 +42,7 @@ var SPFxListWebPart = function (wpProps) {
42
42
  data: list,
43
43
  text: list.Title,
44
44
  value: list.Id,
45
- isSelected: wp.Configuration ? wp.Configuration.ListId == list.Id : false
45
+ isSelected: listId == list.Id
46
46
  });
47
47
  }
48
48
  // Set the dropdown
@@ -87,7 +87,7 @@ var SPFxListWebPart = function (wpProps) {
87
87
  btnProps: {
88
88
  text: "Load Lists",
89
89
  type: gd_bs_1.Components.ButtonTypes.OutlinePrimary,
90
- onClick: loadLists
90
+ onClick: function () { loadLists(); }
91
91
  }
92
92
  });
93
93
  // Return the properties
@@ -98,10 +98,10 @@ var SPFxListWebPart = function (wpProps) {
98
98
  // See if the lists haven't been loaded
99
99
  if (_loadFl == false) {
100
100
  // Load the lists
101
- loadLists();
101
+ loadLists(wp.Configuration ? wp.Configuration.ListId : null);
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();