@pnp/spfx-controls-react 3.9.0-beta.2572389 → 3.9.0-beta.2597996
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/CHANGELOG.json +4 -2
- package/lib/ContentTypePicker.d.ts +2 -0
- package/lib/ContentTypePicker.d.ts.map +1 -0
- package/lib/ContentTypePicker.js +2 -0
- package/lib/ContentTypePicker.js.map +1 -0
- package/lib/common/SPEntities.d.ts +12 -1
- package/lib/common/SPEntities.d.ts.map +1 -1
- package/lib/common/telemetry/version.js +1 -1
- package/lib/controls/contentTypePicker/ContentTypePicker.d.ts +22 -0
- package/lib/controls/contentTypePicker/ContentTypePicker.d.ts.map +1 -0
- package/lib/controls/contentTypePicker/ContentTypePicker.js +207 -0
- package/lib/controls/contentTypePicker/ContentTypePicker.js.map +1 -0
- package/lib/controls/contentTypePicker/IContentTypePicker.d.ts +91 -0
- package/lib/controls/contentTypePicker/IContentTypePicker.d.ts.map +1 -0
- package/lib/controls/contentTypePicker/IContentTypePicker.js +1 -0
- package/lib/controls/contentTypePicker/IContentTypePicker.js.map +1 -0
- package/lib/controls/contentTypePicker/index.d.ts +3 -0
- package/lib/controls/contentTypePicker/index.d.ts.map +1 -0
- package/lib/controls/contentTypePicker/index.js +3 -0
- package/lib/controls/contentTypePicker/index.js.map +1 -0
- package/lib/controls/dynamicForm/DynamicForm.d.ts +1 -0
- package/lib/controls/dynamicForm/DynamicForm.d.ts.map +1 -1
- package/lib/controls/dynamicForm/DynamicForm.js +28 -14
- package/lib/controls/dynamicForm/DynamicForm.js.map +1 -1
- package/lib/controls/dynamicForm/IDynamicFormProps.d.ts +4 -0
- package/lib/controls/dynamicForm/IDynamicFormProps.d.ts.map +1 -1
- package/lib/services/ISPService.d.ts +18 -1
- package/lib/services/ISPService.d.ts.map +1 -1
- package/lib/services/ISPService.js +5 -0
- package/lib/services/ISPService.js.map +1 -1
- package/lib/services/SPService.d.ts +3 -2
- package/lib/services/SPService.d.ts.map +1 -1
- package/lib/services/SPService.js +95 -47
- package/lib/services/SPService.js.map +1 -1
- package/lib/services/SPServiceMock.d.ts +3 -2
- package/lib/services/SPServiceMock.d.ts.map +1 -1
- package/lib/services/SPServiceMock.js +3 -0
- package/lib/services/SPServiceMock.js.map +1 -1
- package/package.json +1 -1
- package/release/webpack-stats/sp-dev-fx-controls-react.stats.json +24517 -18222
package/CHANGELOG.json
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"enhancements": [
|
|
12
12
|
"`DateTimePicker`: Added button to clear date [#1217](https://github.com/pnp/sp-dev-fx-controls-react/issues/1217)",
|
|
13
13
|
"`Toolbar`: Allow filters on a Toolbar to be controlled externally [#1222](https://github.com/pnp/sp-dev-fx-controls-react/issues/1222)",
|
|
14
|
-
"`PeoplePicker`: add new allowUnvalidated option to allow adding non-tenant users [#1232](https://github.com/pnp/sp-dev-fx-controls-react/pull/1232)"
|
|
14
|
+
"`PeoplePicker`: add new allowUnvalidated option to allow adding non-tenant users [#1232](https://github.com/pnp/sp-dev-fx-controls-react/pull/1232)",
|
|
15
|
+
"`DynamicForm`: Add support for `webAbsoluteUrl` [#1244](https://github.com/pnp/sp-dev-fx-controls-react/pull/1244)"
|
|
15
16
|
],
|
|
16
17
|
"fixes": [
|
|
17
18
|
"`Localization`: Updates to English localizations [#1207](https://github.com/pnp/sp-dev-fx-controls-react/issues/1207)",
|
|
@@ -36,7 +37,8 @@
|
|
|
36
37
|
"[Milan Holemans](https://github.com/milanholemans)",
|
|
37
38
|
"[Morten Andersen](https://github.com/spcph)",
|
|
38
39
|
"[Rico van de Ven](https://github.com/RicoNL)",
|
|
39
|
-
"[ryanexner](https://github.com/ryanexner)"
|
|
40
|
+
"[ryanexner](https://github.com/ryanexner)",
|
|
41
|
+
"[Sergio Villalta](https://github.com/6gal6ler6)"
|
|
40
42
|
]
|
|
41
43
|
},
|
|
42
44
|
{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentTypePicker.d.ts","sourceRoot":"","sources":["../src/ContentTypePicker.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentTypePicker.js","sourceRoot":"","sources":["../src/ContentTypePicker.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC"}
|
|
@@ -9,6 +9,17 @@ export interface ISPContentTypeId {
|
|
|
9
9
|
*/
|
|
10
10
|
export interface ISPListContentType {
|
|
11
11
|
Id: ISPContentTypeId;
|
|
12
|
+
Name?: string;
|
|
13
|
+
Description?: string;
|
|
14
|
+
Group?: string;
|
|
15
|
+
Hidden?: boolean;
|
|
16
|
+
ReadOnly?: boolean;
|
|
17
|
+
StringId?: string;
|
|
18
|
+
DocumentTemplate?: string;
|
|
19
|
+
DocumentTemplateUrl?: string;
|
|
20
|
+
SchemaXml?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ISPContentType extends ISPListContentType {
|
|
12
23
|
}
|
|
13
24
|
/**
|
|
14
25
|
* Represents SP List
|
|
@@ -17,7 +28,7 @@ export interface ISPList {
|
|
|
17
28
|
Id: string;
|
|
18
29
|
Title: string;
|
|
19
30
|
BaseTemplate: string;
|
|
20
|
-
ContentTypes?:
|
|
31
|
+
ContentTypes?: ISPContentType[];
|
|
21
32
|
}
|
|
22
33
|
/**
|
|
23
34
|
* Replica of the returned value from the REST api
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SPEntities.d.ts","sourceRoot":"","sources":["../../src/common/SPEntities.ts"],"names":[],"mappings":"AAAA;;GAEG;AACF,MAAM,WAAW,gBAAgB;IAC9B,WAAW,EAAE,MAAM,CAAC;CACvB;AACD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"SPEntities.d.ts","sourceRoot":"","sources":["../../src/common/SPEntities.ts"],"names":[],"mappings":"AAAA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c,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,MAAM,CAAC;IAChC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,sBAAsB,CAAC;IACvC,YAAY,EAAE,oBAAoB,CAAC;CACtC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var version = "3.9.0-beta.
|
|
1
|
+
export var version = "3.9.0-beta.2597996";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IContentTypePickerProps, IContentTypePickerState } from './IContentTypePicker';
|
|
3
|
+
export declare class ContentTypePicker extends React.Component<IContentTypePickerProps, IContentTypePickerState> {
|
|
4
|
+
private _selectedContentTypes;
|
|
5
|
+
constructor(props: IContentTypePickerProps);
|
|
6
|
+
componentDidMount(): void;
|
|
7
|
+
private loadContentTypes;
|
|
8
|
+
/**
|
|
9
|
+
* Set the currently selected content type(s).
|
|
10
|
+
*/
|
|
11
|
+
private setSelectedContentTypes;
|
|
12
|
+
componentDidUpdate(prevProps: Readonly<IContentTypePickerProps>, prevState: Readonly<IContentTypePickerState>): void;
|
|
13
|
+
/**
|
|
14
|
+
* Fires when an item has been selected from the dropdown.
|
|
15
|
+
* @param event Event that has been fired.
|
|
16
|
+
* @param option The new selection.
|
|
17
|
+
* @param index Index of the selection.
|
|
18
|
+
*/
|
|
19
|
+
private onChange;
|
|
20
|
+
render(): React.ReactElement<IContentTypePickerProps>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ContentTypePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentTypePicker.d.ts","sourceRoot":"","sources":["../../../src/controls/contentTypePicker/ContentTypePicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AASxF,qBAAa,iBAAkB,SAAQ,KAAK,CAAC,SAAS,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;IAEtG,OAAO,CAAC,qBAAqB,CAA2B;gBAE5C,KAAK,EAAE,uBAAuB;IAWnC,iBAAiB,IAAI,IAAI;YAIlB,gBAAgB;IA0C9B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAQxB,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,uBAAuB,CAAC,GAAG,IAAI;IAyB3H;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CA2Bf;IAEM,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,uBAAuB,CAAC;CAyC7D"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
var __assign = (this && this.__assign) || function () {
|
|
15
|
+
__assign = Object.assign || function(t) {
|
|
16
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
+
s = arguments[i];
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
return __assign.apply(this, arguments);
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (_) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
import * as telemetry from '../../common/telemetry';
|
|
62
|
+
import React from 'react';
|
|
63
|
+
import { SPServiceFactory } from '../../services/SPServiceFactory';
|
|
64
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
65
|
+
import { Dropdown } from 'office-ui-fabric-react/lib/Dropdown';
|
|
66
|
+
import { Spinner, SpinnerSize } from 'office-ui-fabric-react/lib/Spinner';
|
|
67
|
+
var EMPTY_CONTENTTYPE_KEY = 'NO_CONTENTTYPE_SELECTED';
|
|
68
|
+
var ContentTypePicker = /** @class */ (function (_super) {
|
|
69
|
+
__extends(ContentTypePicker, _super);
|
|
70
|
+
function ContentTypePicker(props) {
|
|
71
|
+
var _this = _super.call(this, props) || this;
|
|
72
|
+
_this._selectedContentTypes = null;
|
|
73
|
+
/**
|
|
74
|
+
* Fires when an item has been selected from the dropdown.
|
|
75
|
+
* @param event Event that has been fired.
|
|
76
|
+
* @param option The new selection.
|
|
77
|
+
* @param index Index of the selection.
|
|
78
|
+
*/
|
|
79
|
+
_this.onChange = function (event, option, index) {
|
|
80
|
+
var _a = _this.props, multiSelect = _a.multiSelect, onSelectionChanged = _a.onSelectionChanged;
|
|
81
|
+
var contentTypes = _this.state.contentTypes;
|
|
82
|
+
if (multiSelect) {
|
|
83
|
+
var selectedContentTypes = _this._selectedContentTypes ? cloneDeep(_this._selectedContentTypes) : [];
|
|
84
|
+
if (option.selected) {
|
|
85
|
+
selectedContentTypes.push(option.key.toString());
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
selectedContentTypes = selectedContentTypes.filter(function (ct) { return ct !== option.key; });
|
|
89
|
+
}
|
|
90
|
+
_this._selectedContentTypes = selectedContentTypes;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
_this._selectedContentTypes = option.key.toString();
|
|
94
|
+
}
|
|
95
|
+
if (onSelectionChanged) {
|
|
96
|
+
if (multiSelect) {
|
|
97
|
+
onSelectionChanged(cloneDeep(contentTypes.filter(function (ct) { return _this._selectedContentTypes.some(function (sct) { return ct.StringId === sct; }); })));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
onSelectionChanged(cloneDeep(contentTypes.find(function (ct) { return ct.StringId === _this._selectedContentTypes; })));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
telemetry.track('ReactContentTypePicker');
|
|
105
|
+
_this.state = {
|
|
106
|
+
contentTypes: [],
|
|
107
|
+
loading: false,
|
|
108
|
+
};
|
|
109
|
+
return _this;
|
|
110
|
+
}
|
|
111
|
+
ContentTypePicker.prototype.componentDidMount = function () {
|
|
112
|
+
this.loadContentTypes();
|
|
113
|
+
};
|
|
114
|
+
ContentTypePicker.prototype.loadContentTypes = function () {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
116
|
+
var _a, context, listId, includeHidden, includeReadOnly, orderBy, filter, group, webAbsoluteUrl, filterItems, service, results;
|
|
117
|
+
return __generator(this, function (_b) {
|
|
118
|
+
switch (_b.label) {
|
|
119
|
+
case 0:
|
|
120
|
+
_a = this.props, context = _a.context, listId = _a.listId, includeHidden = _a.includeHidden, includeReadOnly = _a.includeReadOnly, orderBy = _a.orderBy, filter = _a.filter, group = _a.group, webAbsoluteUrl = _a.webAbsoluteUrl, filterItems = _a.filterItems;
|
|
121
|
+
// Show the loading indicator and disable the dropdown
|
|
122
|
+
this.setState({ loading: true });
|
|
123
|
+
service = SPServiceFactory.createService(context, true, 5000, webAbsoluteUrl);
|
|
124
|
+
return [4 /*yield*/, service.getContentTypes({
|
|
125
|
+
listId: listId,
|
|
126
|
+
filter: filter,
|
|
127
|
+
includeHidden: includeHidden,
|
|
128
|
+
includeReadOnly: includeReadOnly,
|
|
129
|
+
orderBy: orderBy,
|
|
130
|
+
group: group,
|
|
131
|
+
})];
|
|
132
|
+
case 1:
|
|
133
|
+
results = _b.sent();
|
|
134
|
+
// Check if custom filter is specified
|
|
135
|
+
if (filterItems) {
|
|
136
|
+
results = filterItems(results);
|
|
137
|
+
}
|
|
138
|
+
// Hide the loading indicator and set the dropdown options
|
|
139
|
+
this.setState({
|
|
140
|
+
loading: false,
|
|
141
|
+
contentTypes: results,
|
|
142
|
+
});
|
|
143
|
+
this.setSelectedContentTypes();
|
|
144
|
+
return [2 /*return*/];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Set the currently selected content type(s).
|
|
151
|
+
*/
|
|
152
|
+
ContentTypePicker.prototype.setSelectedContentTypes = function () {
|
|
153
|
+
this._selectedContentTypes = cloneDeep(this.props.selectedContentTypes);
|
|
154
|
+
this.setState({
|
|
155
|
+
selectedContentTypes: this._selectedContentTypes,
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
ContentTypePicker.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
159
|
+
var _a = this.props, includeHidden = _a.includeHidden, includeReadOnly = _a.includeReadOnly, orderBy = _a.orderBy, webAbsoluteUrl = _a.webAbsoluteUrl, selectedContentTypes = _a.selectedContentTypes, listId = _a.listId;
|
|
160
|
+
if (prevProps.includeHidden !== includeHidden ||
|
|
161
|
+
prevProps.includeReadOnly !== includeReadOnly ||
|
|
162
|
+
prevProps.orderBy !== orderBy ||
|
|
163
|
+
prevProps.webAbsoluteUrl !== webAbsoluteUrl ||
|
|
164
|
+
prevProps.listId !== listId) {
|
|
165
|
+
this.loadContentTypes();
|
|
166
|
+
}
|
|
167
|
+
if (prevProps.selectedContentTypes !== selectedContentTypes) {
|
|
168
|
+
this.setSelectedContentTypes();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
ContentTypePicker.prototype.render = function () {
|
|
172
|
+
var _a = this.state, loading = _a.loading, contentTypes = _a.contentTypes, selectedContentTypes = _a.selectedContentTypes;
|
|
173
|
+
var _b = this.props, className = _b.className, disabled = _b.disabled, multiSelect = _b.multiSelect, label = _b.label, placeholder = _b.placeholder, showBlankOption = _b.showBlankOption;
|
|
174
|
+
var options = contentTypes.map(function (f) { return ({
|
|
175
|
+
key: f.StringId,
|
|
176
|
+
text: f.Name,
|
|
177
|
+
}); });
|
|
178
|
+
if (showBlankOption && !multiSelect) {
|
|
179
|
+
// Provide empty option
|
|
180
|
+
options.unshift({
|
|
181
|
+
key: EMPTY_CONTENTTYPE_KEY,
|
|
182
|
+
text: '',
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
var dropdownProps = {
|
|
186
|
+
className: className,
|
|
187
|
+
options: options,
|
|
188
|
+
disabled: loading || disabled,
|
|
189
|
+
label: label,
|
|
190
|
+
placeholder: placeholder,
|
|
191
|
+
onChange: this.onChange,
|
|
192
|
+
};
|
|
193
|
+
if (multiSelect) {
|
|
194
|
+
dropdownProps.multiSelect = true;
|
|
195
|
+
dropdownProps.selectedKeys = selectedContentTypes;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
dropdownProps.selectedKey = selectedContentTypes;
|
|
199
|
+
}
|
|
200
|
+
return (React.createElement(React.Fragment, null,
|
|
201
|
+
loading && React.createElement(Spinner, { size: SpinnerSize.xSmall }),
|
|
202
|
+
React.createElement(Dropdown, __assign({}, dropdownProps))));
|
|
203
|
+
};
|
|
204
|
+
return ContentTypePicker;
|
|
205
|
+
}(React.Component));
|
|
206
|
+
export { ContentTypePicker };
|
|
207
|
+
//# sourceMappingURL=ContentTypePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentTypePicker.js","sourceRoot":"","sources":["../../../src/controls/contentTypePicker/ContentTypePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAmC,M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AC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC;YACxD,GAAG,EAAE,CAAC,CAAC,QAAQ;YACf,IAAI,EAAE,CAAC,CAAC,IAAI;SACb,CAAC,EAHuD,CAGvD,CAAC,CAAC;QAEJ,IAAI,eAAe,IAAI,CAAC,WAAW,EAAE;YACnC,uBAAuB;YACvB,OAAO,CAAC,OAAO,CAAC;gBACd,GAAG,EAAE,qBAAqB;gBAC1B,IAAI,EAAE,EAAE;aACT,CAAC,CAAC;SACJ;QAED,IAAM,aAAa,GAAmB;YACpC,SAAS,WAAA;YACT,OAAO,SAAA;YACP,QAAQ,EAAE,OAAO,IAAI,QAAQ;YAC7B,KAAK,OAAA;YACL,WAAW,aAAA;YACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QAEF,IAAI,WAAW,EAAE;YACf,aAAa,CAAC,WAAW,GAAG,IAAI,CAAC;YACjC,aAAa,CAAC,YAAY,GAAG,oBAAgC,CAAC;SAC/D;aACI;YACH,aAAa,CAAC,WAAW,GAAG,oBAA8B,CAAC;SAC5D;QAED,OAAO,CACL;YACG,OAAO,IAAI,oBAAC,OAAO,IAAC,IAAI,EAAE,WAAW,CAAC,MAAM,GAAI;YACjD,oBAAC,QAAQ,eAAK,aAAa,EAAI,CAC9B,CACJ,CAAC;IACJ,CAAC;IACH,wBAAC;AAAD,CAAC,AA7KD,CAAuC,KAAK,CAAC,SAAS,GA6KrD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { BaseComponentContext } from "@microsoft/sp-component-base";
|
|
2
|
+
import { ContentTypesOrderBy } from "../../services/ISPService";
|
|
3
|
+
import { ISPContentType } from "../../common/SPEntities";
|
|
4
|
+
export interface IContentTypePickerProps {
|
|
5
|
+
/**
|
|
6
|
+
* The web part context
|
|
7
|
+
*/
|
|
8
|
+
context: BaseComponentContext;
|
|
9
|
+
/**
|
|
10
|
+
* The ID of the list or library you wish to select content type from.
|
|
11
|
+
* When not specified, picker will be populated with site content types.
|
|
12
|
+
*/
|
|
13
|
+
listId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* If provided, additional class name to provide on the dropdown element.
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether or not the control is disabled.
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether or not to include hidden content types. Default is true.
|
|
24
|
+
*/
|
|
25
|
+
includeHidden?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether or not to include read-only content types. Default is true.
|
|
28
|
+
*/
|
|
29
|
+
includeReadOnly?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Only show content types of a certain group.
|
|
32
|
+
*/
|
|
33
|
+
group?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Filter content types from OData query (takes the upperhand of `hidden`, `readOnly` and `group` filters).
|
|
36
|
+
*/
|
|
37
|
+
filter?: string;
|
|
38
|
+
/**
|
|
39
|
+
* How to order the content types.
|
|
40
|
+
*/
|
|
41
|
+
orderBy?: ContentTypesOrderBy;
|
|
42
|
+
/**
|
|
43
|
+
* IDs of the selected item(s). If you provide this, you must maintain selection
|
|
44
|
+
* state by observing onSelectionChanged events and passing a new value in when changed.
|
|
45
|
+
*/
|
|
46
|
+
selectedContentTypes?: string | string[];
|
|
47
|
+
/**
|
|
48
|
+
* Indicates if multi-choice selections is allowed. Default to false.
|
|
49
|
+
*/
|
|
50
|
+
multiSelect?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The label to display.
|
|
53
|
+
*/
|
|
54
|
+
label?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Input placeholder text. Displayed until option is selected.
|
|
57
|
+
*/
|
|
58
|
+
placeholder?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Callback issued when the selected option changes.
|
|
61
|
+
*/
|
|
62
|
+
onSelectionChanged?: (newValue: ISPContentType | ISPContentType[]) => void;
|
|
63
|
+
/**
|
|
64
|
+
* This function is invoked after the filtering has been done.
|
|
65
|
+
* This allows you to add additional custom filtering.
|
|
66
|
+
*/
|
|
67
|
+
filterItems?: (contentTypes: ISPContentType[]) => ISPContentType[];
|
|
68
|
+
/**
|
|
69
|
+
* Absolute Web Url of target site (user requires permissions).
|
|
70
|
+
*/
|
|
71
|
+
webAbsoluteUrl?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Whether or not to show a blank option. Default false. Works only when multiSelect is false.
|
|
74
|
+
*/
|
|
75
|
+
showBlankOption?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export interface IContentTypePickerState {
|
|
78
|
+
/**
|
|
79
|
+
* Whether or not the content type picker options are loading.
|
|
80
|
+
*/
|
|
81
|
+
loading: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The content types available to the listPicker.
|
|
84
|
+
*/
|
|
85
|
+
contentTypes: ISPContentType[];
|
|
86
|
+
/**
|
|
87
|
+
* Keys of the currently selected item(s).
|
|
88
|
+
*/
|
|
89
|
+
selectedContentTypes?: string | string[];
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=IContentTypePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IContentTypePicker.d.ts","sourceRoot":"","sources":["../../../src/controls/contentTypePicker/IContentTypePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,GAAG,cAAc,EAAE,KAAK,IAAI,CAAC;IAC3E;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,CAAC;IACnE;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=IContentTypePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IContentTypePicker.js","sourceRoot":"","sources":["../../../src/controls/contentTypePicker/IContentTypePicker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/contentTypePicker/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/controls/contentTypePicker/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { IDynamicFormState } from './IDynamicFormState';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class DynamicForm extends React.Component<IDynamicFormProps, IDynamicFormState> {
|
|
8
8
|
private _spService;
|
|
9
|
+
private webURL;
|
|
9
10
|
constructor(props: IDynamicFormProps);
|
|
10
11
|
/**
|
|
11
12
|
* Lifecycle hook when component is mounted
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicForm.d.ts","sourceRoot":"","sources":["../../../src/controls/dynamicForm/DynamicForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAaxD;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"DynamicForm.d.ts","sourceRoot":"","sources":["../../../src/controls/dynamicForm/DynamicForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAaxD;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAEpF,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,MAAM,CAA0G;gBAE5G,KAAK,EAAE,iBAAiB;IA4BpC;;OAEG;IACI,iBAAiB;IAIxB;;OAEG;IACI,MAAM,IAAI,GAAG,CAAC,OAAO;IA4B5B,OAAO,CAAC,aAAa,CA0JpB;IAGD,OAAO,CAAC,QAAQ,CA4Df;IAGD,OAAO,CAAC,oBAAoB,CA8L3B;IAED,OAAO,CAAC,WAAW,CAiBlB;IAED,OAAO,CAAC,mBAAmB,CAU1B;IAED,OAAO,CAAC,aAAa,CA0BpB;CACF"}
|
|
@@ -76,6 +76,7 @@ var DynamicForm = /** @class */ (function (_super) {
|
|
|
76
76
|
__extends(DynamicForm, _super);
|
|
77
77
|
function DynamicForm(props) {
|
|
78
78
|
var _this = _super.call(this, props) || this;
|
|
79
|
+
_this.webURL = _this.props.webAbsoluteUrl ? _this.props.webAbsoluteUrl : _this.props.context.pageContext.web.absoluteUrl;
|
|
79
80
|
//trigger when the user submits the form.
|
|
80
81
|
_this.onSubmitClick = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
81
82
|
var _a, listId, listItemId, onSubmitted, onBeforeSubmit, onSubmitError, shouldBeReturnBack_1, fields, objects, _loop_1, this_1, i, len, isCancelled, iur, error_1, iar, error_2, error_3;
|
|
@@ -374,7 +375,7 @@ var DynamicForm = /** @class */ (function (_super) {
|
|
|
374
375
|
defaultContentType = _b.sent();
|
|
375
376
|
contentTypeId = defaultContentType[0]["Id"].StringValue;
|
|
376
377
|
_b.label = 6;
|
|
377
|
-
case 6: return [4 /*yield*/, this.getFormFields(listId, contentTypeId,
|
|
378
|
+
case 6: return [4 /*yield*/, this.getFormFields(listId, contentTypeId, this.webURL)];
|
|
378
379
|
case 7:
|
|
379
380
|
listFeilds = _b.sent();
|
|
380
381
|
tempFields = [];
|
|
@@ -419,7 +420,7 @@ var DynamicForm = /** @class */ (function (_super) {
|
|
|
419
420
|
lookupListId = field["LookupList"];
|
|
420
421
|
lookupField = field["LookupField"];
|
|
421
422
|
if (!(item !== null)) return [3 /*break*/, 4];
|
|
422
|
-
return [4 /*yield*/, this_2._spService.getLookupValue(listId, listItemId, field.EntityPropertyName, lookupField,
|
|
423
|
+
return [4 /*yield*/, this_2._spService.getLookupValue(listId, listItemId, field.EntityPropertyName, lookupField, this_2.webURL)];
|
|
423
424
|
case 3:
|
|
424
425
|
defaultValue = _c.sent();
|
|
425
426
|
return [3 /*break*/, 5];
|
|
@@ -432,7 +433,7 @@ var DynamicForm = /** @class */ (function (_super) {
|
|
|
432
433
|
lookupListId = field["LookupList"];
|
|
433
434
|
lookupField = field["LookupField"];
|
|
434
435
|
if (!(item !== null)) return [3 /*break*/, 8];
|
|
435
|
-
return [4 /*yield*/, this_2._spService.getLookupValues(listId, listItemId, field.EntityPropertyName, lookupField,
|
|
436
|
+
return [4 /*yield*/, this_2._spService.getLookupValues(listId, listItemId, field.EntityPropertyName, lookupField, this_2.webURL)];
|
|
436
437
|
case 7:
|
|
437
438
|
defaultValue = _c.sent();
|
|
438
439
|
return [3 /*break*/, 9];
|
|
@@ -442,7 +443,7 @@ var DynamicForm = /** @class */ (function (_super) {
|
|
|
442
443
|
case 9: return [3 /*break*/, 27];
|
|
443
444
|
case 10:
|
|
444
445
|
if (!(fieldType === "TaxonomyFieldTypeMulti")) return [3 /*break*/, 12];
|
|
445
|
-
return [4 /*yield*/, this_2._spService.getTaxonomyFieldInternalName(this_2.props.listId, field.InternalName, this_2.
|
|
446
|
+
return [4 /*yield*/, this_2._spService.getTaxonomyFieldInternalName(this_2.props.listId, field.InternalName, this_2.webURL)];
|
|
446
447
|
case 11:
|
|
447
448
|
response = _c.sent();
|
|
448
449
|
hiddenName = response["value"];
|
|
@@ -501,7 +502,7 @@ var DynamicForm = /** @class */ (function (_super) {
|
|
|
501
502
|
case 17:
|
|
502
503
|
if (!(fieldType === "UserMulti")) return [3 /*break*/, 21];
|
|
503
504
|
if (!(item !== null)) return [3 /*break*/, 19];
|
|
504
|
-
return [4 /*yield*/, this_2._spService.getUsersUPNFromFieldValue(listId, listItemId, field.InternalName,
|
|
505
|
+
return [4 /*yield*/, this_2._spService.getUsersUPNFromFieldValue(listId, listItemId, field.InternalName, this_2.webURL)];
|
|
505
506
|
case 18:
|
|
506
507
|
defaultValue = _c.sent();
|
|
507
508
|
return [3 /*break*/, 20];
|
|
@@ -515,7 +516,7 @@ var DynamicForm = /** @class */ (function (_super) {
|
|
|
515
516
|
case 21:
|
|
516
517
|
if (!(fieldType === "Thumbnail")) return [3 /*break*/, 22];
|
|
517
518
|
if (defaultValue !== null) {
|
|
518
|
-
defaultValue =
|
|
519
|
+
defaultValue = this_2.webURL.split('/sites/')[0] + JSON.parse(defaultValue).serverRelativeUrl;
|
|
519
520
|
}
|
|
520
521
|
return [3 /*break*/, 27];
|
|
521
522
|
case 22:
|
|
@@ -636,7 +637,7 @@ var DynamicForm = /** @class */ (function (_super) {
|
|
|
636
637
|
case 0:
|
|
637
638
|
_a.trys.push([0, 4, , 5]);
|
|
638
639
|
context = this.props.context;
|
|
639
|
-
webAbsoluteUrl = !webUrl ?
|
|
640
|
+
webAbsoluteUrl = !webUrl ? this.webURL : webUrl;
|
|
640
641
|
apiUrl = '';
|
|
641
642
|
if (contentTypeId !== undefined && contentTypeId !== '') {
|
|
642
643
|
apiUrl = webAbsoluteUrl + "/_api/web/lists(@listId)/contenttypes('" + contentTypeId + "')/fields?@listId=guid'" + encodeURIComponent(listId) + "'&$filter=ReadOnlyField eq false and Hidden eq false and (FromBaseType eq false or StaticName eq 'Title')";
|
|
@@ -665,15 +666,27 @@ var DynamicForm = /** @class */ (function (_super) {
|
|
|
665
666
|
});
|
|
666
667
|
}); };
|
|
667
668
|
// Initialize pnp sp
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
669
|
+
if (_this.props.webAbsoluteUrl) {
|
|
670
|
+
sp.setup({
|
|
671
|
+
sp: {
|
|
672
|
+
headers: {
|
|
673
|
+
Accept: "application/json;odata=verbose",
|
|
674
|
+
},
|
|
675
|
+
baseUrl: _this.props.webAbsoluteUrl
|
|
676
|
+
},
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
sp.setup({
|
|
681
|
+
spfxContext: _this.props.context
|
|
682
|
+
});
|
|
683
|
+
}
|
|
671
684
|
// Initialize state
|
|
672
685
|
_this.state = {
|
|
673
686
|
fieldCollection: []
|
|
674
687
|
};
|
|
675
688
|
// Get SPService Factory
|
|
676
|
-
_this._spService = new SPservice(_this.props.context);
|
|
689
|
+
_this._spService = _this.props.webAbsoluteUrl ? new SPservice(_this.props.context, _this.props.webAbsoluteUrl) : new SPservice(_this.props.context);
|
|
677
690
|
return _this;
|
|
678
691
|
}
|
|
679
692
|
/**
|
|
@@ -694,9 +707,10 @@ var DynamicForm = /** @class */ (function (_super) {
|
|
|
694
707
|
fieldCollection.map(function (v, i) {
|
|
695
708
|
return React.createElement(DynamicField, __assign({}, v, { disabled: v.disabled || isSaving }));
|
|
696
709
|
}),
|
|
697
|
-
|
|
698
|
-
React.createElement(
|
|
699
|
-
|
|
710
|
+
!this.props.disabled &&
|
|
711
|
+
React.createElement(Stack, { className: styles.buttons, horizontal: true, tokens: stackTokens },
|
|
712
|
+
React.createElement(PrimaryButton, { disabled: isSaving, text: strings.Save, onClick: function () { return _this.onSubmitClick(); } }),
|
|
713
|
+
React.createElement(DefaultButton, { disabled: isSaving, text: strings.Cancel, onClick: this.props.onCancelled })))));
|
|
700
714
|
};
|
|
701
715
|
return DynamicForm;
|
|
702
716
|
}(React.Component));
|