gd-sprest-bs 10.5.6 → 10.5.7

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,8 +21,9 @@ var _SPFxWebPart = /** @class */ (function () {
21
21
  /** The configuration modal. */
22
22
  // Constructor
23
23
  function _SPFxWebPart(props) {
24
- this._cfg = null;
25
24
  this._props = null;
25
+ /** The webpart configuration */
26
+ this._cfg = null;
26
27
  /** The configuration form. */
27
28
  this._form = null;
28
29
  /** The configuration modal. */
@@ -73,6 +74,12 @@ var _SPFxWebPart = /** @class */ (function () {
73
74
  }
74
75
  }
75
76
  }
77
+ Object.defineProperty(_SPFxWebPart.prototype, "Configuration", {
78
+ get: function () { return this._cfg; },
79
+ enumerable: false,
80
+ configurable: true
81
+ });
82
+ ;
76
83
  Object.defineProperty(_SPFxWebPart.prototype, "Form", {
77
84
  get: function () { return this._form; },
78
85
  enumerable: false,
@@ -201,6 +208,8 @@ var _SPFxWebPart = /** @class */ (function () {
201
208
  _this._props.spfx.properties.configuration = wpCfg;
202
209
  // Call the saved event
203
210
  _this._props.onConfigSaved ? _this._props.onConfigSaved(cfg) : null;
211
+ // Close the modal
212
+ _this._modal.hide();
204
213
  }
205
214
  }
206
215
  }
@@ -18,7 +18,7 @@ var base_1 = require("../base");
18
18
  /**
19
19
  * SPFx List WebPart
20
20
  */
21
- var SPFxListWebPart = function (props) {
21
+ var SPFxListWebPart = function (wpProps) {
22
22
  var _ddl = null;
23
23
  var _loadFl = false;
24
24
  // Load the lists
@@ -41,7 +41,8 @@ var SPFxListWebPart = function (props) {
41
41
  lists.push({
42
42
  data: list,
43
43
  text: list.Title,
44
- value: list.Id
44
+ value: list.Id,
45
+ isSelected: wp.Configuration ? wp.Configuration.ListId == list.Id : false
45
46
  });
46
47
  }
47
48
  // Set the dropdown
@@ -60,13 +61,15 @@ var SPFxListWebPart = function (props) {
60
61
  name: "WebUrl",
61
62
  label: "Web Url",
62
63
  type: gd_bs_1.Components.FormControlTypes.TextField,
63
- description: "The relative url to the site containing the target list."
64
+ description: "The relative url to the site containing the target list.",
65
+ value: wp.Configuration ? wp.Configuration.WebUrl : null
64
66
  },
65
67
  {
66
- name: "ListId",
68
+ name: "List",
67
69
  label: "List",
68
70
  type: gd_bs_1.Components.FormControlTypes.Dropdown,
69
71
  required: true,
72
+ value: wp.Configuration ? wp.Configuration.ListId : null,
70
73
  onControlRendered: function (ctrl) {
71
74
  // Set the dropdown
72
75
  _ddl = ctrl.dropdown;
@@ -97,10 +100,22 @@ var SPFxListWebPart = function (props) {
97
100
  // Load the lists
98
101
  loadLists();
99
102
  }
103
+ },
104
+ //
105
+ onConfigSaving: function (cfg) {
106
+ // Get the form values
107
+ var values = wp.Form.getValues();
108
+ // Set the configuration
109
+ var listItem = values["List"];
110
+ cfg.ListId = listItem ? listItem.value : null;
111
+ cfg.ListName = listItem ? listItem.text : null;
112
+ cfg.WebUrl = values["WebUrl"];
113
+ // Return the configuration
114
+ return cfg;
100
115
  }
101
116
  };
102
117
  // Return the webpart
103
- var wp = (0, base_1.SPFxWebPart)(__assign(__assign({}, props), baseProps));
118
+ var wp = (0, base_1.SPFxWebPart)(__assign(__assign({}, wpProps), baseProps));
104
119
  return wp;
105
120
  };
106
121
  exports.SPFxListWebPart = SPFxListWebPart;