gd-sprest-bs 10.5.5 → 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,9 +21,9 @@ var _SPFxWebPart = /** @class */ (function () {
21
21
  /** The configuration modal. */
22
22
  // Constructor
23
23
  function _SPFxWebPart(props) {
24
- var _this = this;
25
- this._cfg = null;
26
24
  this._props = null;
25
+ /** The webpart configuration */
26
+ this._cfg = null;
27
27
  /** The configuration form. */
28
28
  this._form = null;
29
29
  /** The configuration modal. */
@@ -46,37 +46,6 @@ var _SPFxWebPart = /** @class */ (function () {
46
46
  }
47
47
  catch (_a) { }
48
48
  }
49
- // Set the webpart properties pane to trigger the modal from displaying
50
- var propertyPageConfig = this._props.spfx.getPropertyPaneConfiguration;
51
- this._props.spfx.getPropertyPaneConfiguration = function () {
52
- // Get the original configuration
53
- var config = propertyPageConfig ? propertyPageConfig() : null;
54
- // Update the configuration w/ a button
55
- config = config || {};
56
- config.pages = config.pages || [];
57
- config.pages.push({
58
- header: {
59
- description: "Configuration"
60
- },
61
- groups: [
62
- {
63
- groupFields: [{
64
- targetProperty: "configuration",
65
- type: gd_sprest_1.SPTypes.PropertyPaneType.Button,
66
- properties: {
67
- text: "Configuration",
68
- onClick: function () {
69
- // Show the modal
70
- _this.showEditModal();
71
- }
72
- }
73
- }]
74
- }
75
- ]
76
- });
77
- // Call the configuration
78
- return config;
79
- };
80
49
  // See if this is the workbench
81
50
  if (window.location.pathname.indexOf("workbench.aspx") > 0) {
82
51
  // Render the configuration button
@@ -105,6 +74,12 @@ var _SPFxWebPart = /** @class */ (function () {
105
74
  }
106
75
  }
107
76
  }
77
+ Object.defineProperty(_SPFxWebPart.prototype, "Configuration", {
78
+ get: function () { return this._cfg; },
79
+ enumerable: false,
80
+ configurable: true
81
+ });
82
+ ;
108
83
  Object.defineProperty(_SPFxWebPart.prototype, "Form", {
109
84
  get: function () { return this._form; },
110
85
  enumerable: false,
@@ -149,6 +124,37 @@ var _SPFxWebPart = /** @class */ (function () {
149
124
  // Do nothing
150
125
  return;
151
126
  }
127
+ // Set the webpart properties pane to trigger the modal from displaying
128
+ var propertyPageConfig = this._props.spfx.getPropertyPaneConfiguration;
129
+ this._props.spfx.getPropertyPaneConfiguration = function () {
130
+ // Get the original configuration
131
+ var config = propertyPageConfig ? propertyPageConfig() : null;
132
+ // Update the configuration w/ a button
133
+ config = config || {};
134
+ config.pages = config.pages || [];
135
+ config.pages.push({
136
+ header: {
137
+ description: "Configuration"
138
+ },
139
+ groups: [
140
+ {
141
+ groupFields: [{
142
+ targetProperty: "configuration",
143
+ type: gd_sprest_1.SPTypes.PropertyPaneType.Button,
144
+ properties: {
145
+ text: "Configuration",
146
+ onClick: function () {
147
+ // Show the modal
148
+ _this.showEditModal();
149
+ }
150
+ }
151
+ }]
152
+ }
153
+ ]
154
+ });
155
+ // Call the configuration
156
+ return config;
157
+ };
152
158
  // Render the edit button
153
159
  gd_bs_1.Components.Button({
154
160
  el: elWPConfig,
@@ -202,6 +208,8 @@ var _SPFxWebPart = /** @class */ (function () {
202
208
  _this._props.spfx.properties.configuration = wpCfg;
203
209
  // Call the saved event
204
210
  _this._props.onConfigSaved ? _this._props.onConfigSaved(cfg) : null;
211
+ // Close the modal
212
+ _this._modal.hide();
205
213
  }
206
214
  }
207
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;