gd-sprest-bs 10.5.6 → 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.
- package/build/webparts/base/wpSpfx.js +63 -24
- package/build/webparts/list/wpSpfx.js +20 -5
- package/dist/gd-sprest-bs-icons.js +1 -1
- package/dist/gd-sprest-bs-icons.min.js +1 -1
- package/dist/gd-sprest-bs.d.ts +6 -0
- package/dist/gd-sprest-bs.js +1 -1
- package/dist/gd-sprest-bs.min.js +1 -1
- package/package.json +1 -1
- package/src/webparts/base/types.d.ts +3 -0
- package/src/webparts/base/wpSPFx.ts +57 -23
- package/src/webparts/list/types.d.ts +3 -0
- package/src/webparts/list/wpSpfx.ts +24 -6
|
@@ -21,13 +21,17 @@ 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. */
|
|
29
30
|
this._modal = null;
|
|
30
|
-
|
|
31
|
+
/** Is in display mode */
|
|
32
|
+
this._isDisplay = null;
|
|
33
|
+
/** Is in edit mode */
|
|
34
|
+
this._isEdit = null;
|
|
31
35
|
// Save the properties
|
|
32
36
|
this._props = props;
|
|
33
37
|
// Ensure the spfx object was set
|
|
@@ -38,41 +42,56 @@ var _SPFxWebPart = /** @class */ (function () {
|
|
|
38
42
|
}
|
|
39
43
|
// Set the page context
|
|
40
44
|
gd_sprest_1.ContextInfo.setPageContext(this._props.spfx.context.pageContext);
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
this._cfg = JSON.parse(this._props.wpCfg);
|
|
45
|
-
}
|
|
46
|
-
catch (_a) { }
|
|
47
|
-
}
|
|
45
|
+
// Set the configuration
|
|
46
|
+
this.Configuration = this._props.wpCfg;
|
|
48
47
|
// See if this is the workbench
|
|
49
48
|
if (window.location.pathname.indexOf("workbench.aspx") > 0) {
|
|
50
|
-
//
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
this.render();
|
|
49
|
+
// Set both flags to render edit/display
|
|
50
|
+
this._isDisplay = true;
|
|
51
|
+
this._isEdit = true;
|
|
54
52
|
}
|
|
55
53
|
else {
|
|
56
54
|
// See if this is a classic page
|
|
57
55
|
if (gd_sprest_1.Helper.SP.Ribbon.exists) {
|
|
58
56
|
// Set the flag
|
|
59
|
-
|
|
57
|
+
this._isEdit = gd_sprest_1.Helper.WebPart.isEditMode();
|
|
60
58
|
}
|
|
61
59
|
else {
|
|
62
60
|
// Set the flag
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
// Ensure we are in edit mode
|
|
66
|
-
if (isEdit) {
|
|
67
|
-
// Render the configuration button
|
|
68
|
-
this.renderEdit();
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
// Render the webpart
|
|
72
|
-
this.render();
|
|
61
|
+
this._isEdit = this._props.spfx.displayMode == gd_sprest_1.SPTypes.FormDisplayMode.Edit;
|
|
73
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();
|
|
74
75
|
}
|
|
75
76
|
}
|
|
77
|
+
Object.defineProperty(_SPFxWebPart.prototype, "Configuration", {
|
|
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
|
+
},
|
|
91
|
+
enumerable: false,
|
|
92
|
+
configurable: true
|
|
93
|
+
});
|
|
94
|
+
;
|
|
76
95
|
Object.defineProperty(_SPFxWebPart.prototype, "Form", {
|
|
77
96
|
get: function () { return this._form; },
|
|
78
97
|
enumerable: false,
|
|
@@ -83,6 +102,16 @@ var _SPFxWebPart = /** @class */ (function () {
|
|
|
83
102
|
enumerable: false,
|
|
84
103
|
configurable: true
|
|
85
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
|
+
});
|
|
86
115
|
// Method to render the webpart
|
|
87
116
|
_SPFxWebPart.prototype.render = function () {
|
|
88
117
|
// Get the webpart element
|
|
@@ -139,6 +168,8 @@ var _SPFxWebPart = /** @class */ (function () {
|
|
|
139
168
|
onClick: function () {
|
|
140
169
|
// Show the modal
|
|
141
170
|
_this.showEditModal();
|
|
171
|
+
// Close the properties window
|
|
172
|
+
_this._props.spfx.context.propertyPane.close();
|
|
142
173
|
}
|
|
143
174
|
}
|
|
144
175
|
}]
|
|
@@ -201,6 +232,14 @@ var _SPFxWebPart = /** @class */ (function () {
|
|
|
201
232
|
_this._props.spfx.properties.configuration = wpCfg;
|
|
202
233
|
// Call the saved event
|
|
203
234
|
_this._props.onConfigSaved ? _this._props.onConfigSaved(cfg) : null;
|
|
235
|
+
// Close the modal
|
|
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
|
+
}
|
|
204
243
|
}
|
|
205
244
|
}
|
|
206
245
|
}
|
|
@@ -18,7 +18,7 @@ var base_1 = require("../base");
|
|
|
18
18
|
/**
|
|
19
19
|
* SPFx List WebPart
|
|
20
20
|
*/
|
|
21
|
-
var SPFxListWebPart = function (
|
|
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: "
|
|
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
|
+
// The configuration saving event
|
|
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({},
|
|
118
|
+
var wp = (0, base_1.SPFxWebPart)(__assign(__assign({}, wpProps), baseProps));
|
|
104
119
|
return wp;
|
|
105
120
|
};
|
|
106
121
|
exports.SPFxListWebPart = SPFxListWebPart;
|