@pnp/spfx-property-controls 3.17.0-beta.8148201 → 3.17.0-beta.8725901
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.md +10 -0
- package/fast-serve/config.json +6 -0
- package/fast-serve/webpack.extend.js +31 -0
- package/lib/PropertyFieldContentTypePicker.d.ts +3 -0
- package/lib/PropertyFieldContentTypePicker.d.ts.map +1 -0
- package/lib/PropertyFieldContentTypePicker.js +3 -0
- package/lib/PropertyFieldContentTypePicker.js.map +1 -0
- package/lib/common/telemetry/version.js +1 -1
- package/lib/propertyFields/contentTypePicker/IPropertyFieldContentTypePicker.d.ts +113 -0
- package/lib/propertyFields/contentTypePicker/IPropertyFieldContentTypePicker.d.ts.map +1 -0
- package/lib/propertyFields/contentTypePicker/IPropertyFieldContentTypePicker.js +9 -0
- package/lib/propertyFields/contentTypePicker/IPropertyFieldContentTypePicker.js.map +1 -0
- package/lib/propertyFields/contentTypePicker/IPropertyFieldContentTypePickerHost.d.ts +17 -0
- package/lib/propertyFields/contentTypePicker/IPropertyFieldContentTypePickerHost.d.ts.map +1 -0
- package/lib/propertyFields/contentTypePicker/IPropertyFieldContentTypePickerHost.js +2 -0
- package/lib/propertyFields/contentTypePicker/IPropertyFieldContentTypePickerHost.js.map +1 -0
- package/lib/propertyFields/contentTypePicker/ISPContentType.d.ts +7 -0
- package/lib/propertyFields/contentTypePicker/ISPContentType.d.ts.map +1 -0
- package/lib/propertyFields/contentTypePicker/ISPContentType.js +2 -0
- package/lib/propertyFields/contentTypePicker/ISPContentType.js.map +1 -0
- package/lib/propertyFields/contentTypePicker/ISPContentTypes.d.ts +8 -0
- package/lib/propertyFields/contentTypePicker/ISPContentTypes.d.ts.map +1 -0
- package/lib/propertyFields/contentTypePicker/ISPContentTypes.js +2 -0
- package/lib/propertyFields/contentTypePicker/ISPContentTypes.js.map +1 -0
- package/lib/propertyFields/contentTypePicker/PropertyFieldContentTypePicker.d.ts +9 -0
- package/lib/propertyFields/contentTypePicker/PropertyFieldContentTypePicker.d.ts.map +1 -0
- package/lib/propertyFields/contentTypePicker/PropertyFieldContentTypePicker.js +111 -0
- package/lib/propertyFields/contentTypePicker/PropertyFieldContentTypePicker.js.map +1 -0
- package/lib/propertyFields/contentTypePicker/PropertyFieldContentTypePickerHost.d.ts +43 -0
- package/lib/propertyFields/contentTypePicker/PropertyFieldContentTypePickerHost.d.ts.map +1 -0
- package/lib/propertyFields/contentTypePicker/PropertyFieldContentTypePickerHost.js +198 -0
- package/lib/propertyFields/contentTypePicker/PropertyFieldContentTypePickerHost.js.map +1 -0
- package/lib/propertyFields/contentTypePicker/index.d.ts +7 -0
- package/lib/propertyFields/contentTypePicker/index.d.ts.map +1 -0
- package/lib/propertyFields/contentTypePicker/index.js +7 -0
- package/lib/propertyFields/contentTypePicker/index.js.map +1 -0
- package/lib/services/ISPContentTypePickerService.d.ts +5 -0
- package/lib/services/ISPContentTypePickerService.d.ts.map +1 -0
- package/lib/services/ISPContentTypePickerService.js +2 -0
- package/lib/services/ISPContentTypePickerService.js.map +1 -0
- package/lib/services/SPContentTypePickerService.d.ts +24 -0
- package/lib/services/SPContentTypePickerService.d.ts.map +1 -0
- package/lib/services/SPContentTypePickerService.js +117 -0
- package/lib/services/SPContentTypePickerService.js.map +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## 3.17.0
|
|
4
|
+
|
|
5
|
+
### Enhancements
|
|
6
|
+
|
|
7
|
+
- `fast-serve`: ast-serve update to match the most recent changes. [#606](https://github.com/pnp/sp-dev-fx-property-controls/pull/606)
|
|
8
|
+
|
|
9
|
+
### Contributors
|
|
10
|
+
|
|
11
|
+
Special thanks to our contributor: [Sergei Sergeev](https://github.com/s-KaiNet).
|
|
12
|
+
|
|
3
13
|
## 3.16.0
|
|
4
14
|
|
|
5
15
|
### Enhancements
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* User webpack settings file. You can add your own settings here.
|
|
3
|
+
* Changes from this file will be merged into the base webpack configuration file.
|
|
4
|
+
* This file will not be overwritten by the subsequent spfx-fast-serve calls.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* you can add your project related webpack configuration here, it will be merged using webpack-merge module
|
|
9
|
+
* i.e. plugins: [new webpack.Plugin()]
|
|
10
|
+
*/
|
|
11
|
+
const webpackConfig = {
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* For even more fine-grained control, you can apply custom webpack settings using below function
|
|
17
|
+
* @param {object} initialWebpackConfig - initial webpack config object
|
|
18
|
+
* @param {object} webpack - webpack object, used by SPFx pipeline
|
|
19
|
+
* @returns webpack config object
|
|
20
|
+
*/
|
|
21
|
+
const transformConfig = function (initialWebpackConfig, webpack) {
|
|
22
|
+
// transform the initial webpack config here, i.e.
|
|
23
|
+
// initialWebpackConfig.plugins.push(new webpack.Plugin()); etc.
|
|
24
|
+
|
|
25
|
+
return initialWebpackConfig;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = {
|
|
29
|
+
webpackConfig,
|
|
30
|
+
transformConfig
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyFieldContentTypePicker.d.ts","sourceRoot":"","sources":["../src/PropertyFieldContentTypePicker.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyFieldContentTypePicker.js","sourceRoot":"","sources":["../src/PropertyFieldContentTypePicker.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var version = "3.17.0-beta.
|
|
1
|
+
export var version = "3.17.0-beta.8725901";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { IPropertyPaneCustomFieldProps } from '@microsoft/sp-property-pane';
|
|
2
|
+
import { BaseComponentContext } from '@microsoft/sp-component-base';
|
|
3
|
+
import { ISPContentType } from './ISPContentType';
|
|
4
|
+
/**
|
|
5
|
+
* Enum for specifying how the ContentTypes should be sorted
|
|
6
|
+
*/
|
|
7
|
+
export declare enum PropertyFieldContentTypeOrderBy {
|
|
8
|
+
Id = 1,
|
|
9
|
+
Name = 2
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Public properties of the PropertyFieldContentTypePicker custom field
|
|
13
|
+
*/
|
|
14
|
+
export interface IPropertyFieldContentTypePickerProps {
|
|
15
|
+
/**
|
|
16
|
+
* Context of the current web part
|
|
17
|
+
*/
|
|
18
|
+
context: BaseComponentContext;
|
|
19
|
+
/**
|
|
20
|
+
* Custom Field will start to validate after users stop typing for `deferredValidationTime` milliseconds.
|
|
21
|
+
* Default value is 200.
|
|
22
|
+
*/
|
|
23
|
+
deferredValidationTime?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the property pane field is enabled or not.
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Filter ContentTypes from Odata query
|
|
30
|
+
*/
|
|
31
|
+
filter?: string;
|
|
32
|
+
/**
|
|
33
|
+
* An UNIQUE key indicates the identity of this control
|
|
34
|
+
*/
|
|
35
|
+
key?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Property field label displayed on top
|
|
38
|
+
*/
|
|
39
|
+
label: string;
|
|
40
|
+
/**
|
|
41
|
+
* The List Id of the list where you want to get the ContentTypes
|
|
42
|
+
*/
|
|
43
|
+
listId?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Specify the property on which you want to order the retrieve set of ContentTypes.
|
|
46
|
+
*/
|
|
47
|
+
orderBy?: PropertyFieldContentTypeOrderBy;
|
|
48
|
+
/**
|
|
49
|
+
* Parent Web Part properties
|
|
50
|
+
*/
|
|
51
|
+
properties: any;
|
|
52
|
+
/**
|
|
53
|
+
* Initial selected ContentType of the control
|
|
54
|
+
*/
|
|
55
|
+
selectedContentType?: string | string[];
|
|
56
|
+
/**
|
|
57
|
+
* Defines ContentType titles which should be excluded from the ContentType picker control
|
|
58
|
+
*/
|
|
59
|
+
contentTypesToExclude?: string[];
|
|
60
|
+
/**
|
|
61
|
+
* Absolute Web Url of target site (user requires permissions)
|
|
62
|
+
*/
|
|
63
|
+
webAbsoluteUrl?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The method is used to get the validation error message and determine whether the input value is valid or not.
|
|
66
|
+
*
|
|
67
|
+
* When it returns string:
|
|
68
|
+
* - If valid, it returns empty string.
|
|
69
|
+
* - If invalid, it returns the error message string and the text field will
|
|
70
|
+
* show a red border and show an error message below the text field.
|
|
71
|
+
*
|
|
72
|
+
* When it returns Promise<string>:
|
|
73
|
+
* - The resolved value is display as error message.
|
|
74
|
+
* - The rejected, the value is thrown away.
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
onGetErrorMessage?: (value: string) => string | Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Defines a onPropertyChange function to raise when the selected value changed.
|
|
80
|
+
* Normally this function must be always defined with the 'this.onPropertyChange'
|
|
81
|
+
* method of the web part object.
|
|
82
|
+
*/
|
|
83
|
+
onPropertyChange(propertyPath: string, oldValue: any, newValue: any): void;
|
|
84
|
+
/**
|
|
85
|
+
* Callback that is called before the dropdown is populated
|
|
86
|
+
*/
|
|
87
|
+
onContentTypesRetrieved?: (contentTypes: ISPContentType[]) => PromiseLike<ISPContentType[]> | ISPContentType[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Private properties of the PropertyFieldContentTypePicker custom field.
|
|
91
|
+
* We separate public & private properties to include onRender & onDispose method waited
|
|
92
|
+
* by the PropertyFieldCustom, without asking to the developer to add it when he's using
|
|
93
|
+
* the PropertyFieldContentTypePicker.
|
|
94
|
+
*/
|
|
95
|
+
export interface IPropertyFieldContentTypePickerPropsInternal extends IPropertyFieldContentTypePickerProps, IPropertyPaneCustomFieldProps {
|
|
96
|
+
context: BaseComponentContext;
|
|
97
|
+
deferredValidationTime?: number;
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
filter?: string;
|
|
100
|
+
orderBy?: PropertyFieldContentTypeOrderBy;
|
|
101
|
+
key: string;
|
|
102
|
+
label: string;
|
|
103
|
+
listId?: string;
|
|
104
|
+
properties: any;
|
|
105
|
+
selectedContentType?: string;
|
|
106
|
+
targetProperty: string;
|
|
107
|
+
contentTypesToExclude?: string[];
|
|
108
|
+
webAbsoluteUrl?: string;
|
|
109
|
+
onGetErrorMessage?: (value: string | string[]) => string | Promise<string>;
|
|
110
|
+
onPropertyChange(propertyPath: string, oldValue: any, newValue: any): void;
|
|
111
|
+
onContentTypesRetrieved?: (contentTypes: ISPContentType[]) => PromiseLike<ISPContentType[]> | ISPContentType[];
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=IPropertyFieldContentTypePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPropertyFieldContentTypePicker.d.ts","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/IPropertyFieldContentTypePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;GAEG;AACH,oBAAY,+BAA+B;IACzC,EAAE,IAAI;IACN,IAAI,IAAA;CACL;AAED;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD;;OAEG;IACH,OAAO,EAAE,oBAAoB,CAAC;IAE9B;;;OAGG;IACH,sBAAsB,CAAC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AAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,GAAG,CAAC;IAChB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3E,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,IAAI,CAAC;IAC3E,uBAAuB,CAAC,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,KAAK,WAAW,CAAC,cAAc,EAAE,CAAC,GAAG,cAAc,EAAE,CAAC;CAChH"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum for specifying how the ContentTypes should be sorted
|
|
3
|
+
*/
|
|
4
|
+
export var PropertyFieldContentTypeOrderBy;
|
|
5
|
+
(function (PropertyFieldContentTypeOrderBy) {
|
|
6
|
+
PropertyFieldContentTypeOrderBy[PropertyFieldContentTypeOrderBy["Id"] = 1] = "Id";
|
|
7
|
+
PropertyFieldContentTypeOrderBy[PropertyFieldContentTypeOrderBy["Name"] = 2] = "Name";
|
|
8
|
+
})(PropertyFieldContentTypeOrderBy || (PropertyFieldContentTypeOrderBy = {}));
|
|
9
|
+
//# sourceMappingURL=IPropertyFieldContentTypePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPropertyFieldContentTypePicker.js","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/IPropertyFieldContentTypePicker.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,CAAN,IAAY,+BAGX;AAHD,WAAY,+BAA+B;IACzC,iFAAM,CAAA;IACN,qFAAI,CAAA;AACN,CAAC,EAHW,+BAA+B,KAA/B,+BAA+B,QAG1C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IPropertyFieldContentTypePickerPropsInternal } from './IPropertyFieldContentTypePicker';
|
|
2
|
+
import { IDropdownOption } from '@fluentui/react/lib/Dropdown';
|
|
3
|
+
/**
|
|
4
|
+
* PropertyFieldContentTypePickerHost properties interface
|
|
5
|
+
*/
|
|
6
|
+
export interface IPropertyFieldContentTypePickerHostProps extends IPropertyFieldContentTypePickerPropsInternal {
|
|
7
|
+
onChange: (targetProperty?: string, newValue?: any) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* PropertyFieldContentTypePickerHost state interface
|
|
11
|
+
*/
|
|
12
|
+
export interface IPropertyFieldContentTypePickerHostState {
|
|
13
|
+
results: IDropdownOption[];
|
|
14
|
+
selectedKey?: string;
|
|
15
|
+
errorMessage?: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=IPropertyFieldContentTypePickerHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPropertyFieldContentTypePickerHost.d.ts","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/IPropertyFieldContentTypePickerHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4CAA4C,EAAE,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,wCAAyC,SAAQ,4CAA4C;IAC5G,QAAQ,EAAE,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,wCAAwC;IAEvD,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPropertyFieldContentTypePickerHost.js","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/IPropertyFieldContentTypePickerHost.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISPContentType.d.ts","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/ISPContentType.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE;QACF,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISPContentType.js","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/ISPContentType.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISPContentTypes.d.ts","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/ISPContentTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,eAAe;IAE9B,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISPContentTypes.js","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/ISPContentTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IPropertyPaneField } from '@microsoft/sp-property-pane';
|
|
2
|
+
import { IPropertyFieldContentTypePickerProps, IPropertyFieldContentTypePickerPropsInternal } from './IPropertyFieldContentTypePicker';
|
|
3
|
+
/**
|
|
4
|
+
* Helper method to create a SPContentType Picker on the PropertyPane.
|
|
5
|
+
* @param targetProperty - Target property the SharePoint ContentType picker is associated to.
|
|
6
|
+
* @param properties - Strongly typed SPContentType Picker properties.
|
|
7
|
+
*/
|
|
8
|
+
export declare function PropertyFieldContentTypePicker(targetProperty: string, properties: IPropertyFieldContentTypePickerProps): IPropertyPaneField<IPropertyFieldContentTypePickerPropsInternal>;
|
|
9
|
+
//# sourceMappingURL=PropertyFieldContentTypePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyFieldContentTypePicker.d.ts","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/PropertyFieldContentTypePicker.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAEnB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAAmC,oCAAoC,EAAE,4CAA4C,EAAE,MAAM,mCAAmC,CAAC;AAyGxK;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,oCAAoC,GAAG,kBAAkB,CAAC,4CAA4C,CAAC,CAyBzL"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ReactDom from 'react-dom';
|
|
3
|
+
import { PropertyPaneFieldType } from '@microsoft/sp-property-pane';
|
|
4
|
+
import PropertyFieldContentTypePickerHost from './PropertyFieldContentTypePickerHost';
|
|
5
|
+
/**
|
|
6
|
+
* Represents a PropertyFieldContentTypePicker object
|
|
7
|
+
*/
|
|
8
|
+
var PropertyFieldContentTypePickerBuilder = /** @class */ (function () {
|
|
9
|
+
/**
|
|
10
|
+
* Constructor method
|
|
11
|
+
*/
|
|
12
|
+
function PropertyFieldContentTypePickerBuilder(_targetProperty, _properties) {
|
|
13
|
+
this.type = PropertyPaneFieldType.Custom;
|
|
14
|
+
this.deferredValidationTime = 200;
|
|
15
|
+
this.disabled = false;
|
|
16
|
+
this.disableReactivePropertyChanges = false;
|
|
17
|
+
this.render = this.render.bind(this);
|
|
18
|
+
this.targetProperty = _targetProperty;
|
|
19
|
+
this.properties = _properties;
|
|
20
|
+
this.properties.onDispose = this.dispose;
|
|
21
|
+
this.properties.onRender = this.render;
|
|
22
|
+
this.label = _properties.label;
|
|
23
|
+
this.context = _properties.context;
|
|
24
|
+
this.webAbsoluteUrl = _properties.webAbsoluteUrl;
|
|
25
|
+
this.listId = _properties.listId;
|
|
26
|
+
this.selectedContentType = _properties.selectedContentType;
|
|
27
|
+
this.onPropertyChange = _properties.onPropertyChange;
|
|
28
|
+
this.customProperties = _properties.properties;
|
|
29
|
+
this.key = _properties.key;
|
|
30
|
+
this.orderBy = _properties.orderBy;
|
|
31
|
+
this.contentTypesToExclude = _properties.contentTypesToExclude;
|
|
32
|
+
this.filter = _properties.filter;
|
|
33
|
+
this.onGetErrorMessage = _properties.onGetErrorMessage;
|
|
34
|
+
this.onContentTypesRetrieved = _properties.onContentTypesRetrieved;
|
|
35
|
+
if (_properties.disabled === true) {
|
|
36
|
+
this.disabled = _properties.disabled;
|
|
37
|
+
}
|
|
38
|
+
if (_properties.deferredValidationTime) {
|
|
39
|
+
this.deferredValidationTime = _properties.deferredValidationTime;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
PropertyFieldContentTypePickerBuilder.prototype.onPropertyChange = function (propertyPath, oldValue, newValue) { }; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
43
|
+
/**
|
|
44
|
+
* Renders the SPContentTypePicker field content
|
|
45
|
+
*/
|
|
46
|
+
PropertyFieldContentTypePickerBuilder.prototype.render = function (elem, ctx, changeCallback) {
|
|
47
|
+
var componentProps = {
|
|
48
|
+
label: this.label,
|
|
49
|
+
targetProperty: this.targetProperty,
|
|
50
|
+
context: this.context,
|
|
51
|
+
webAbsoluteUrl: this.webAbsoluteUrl,
|
|
52
|
+
listId: this.listId,
|
|
53
|
+
orderBy: this.orderBy,
|
|
54
|
+
onDispose: this.dispose,
|
|
55
|
+
onRender: this.render,
|
|
56
|
+
onChange: changeCallback,
|
|
57
|
+
onPropertyChange: this.onPropertyChange,
|
|
58
|
+
properties: this.customProperties,
|
|
59
|
+
key: this.key,
|
|
60
|
+
disabled: this.disabled,
|
|
61
|
+
onGetErrorMessage: this.onGetErrorMessage,
|
|
62
|
+
deferredValidationTime: this.deferredValidationTime,
|
|
63
|
+
contentTypesToExclude: this.contentTypesToExclude,
|
|
64
|
+
filter: this.filter,
|
|
65
|
+
onContentTypesRetrieved: this.onContentTypesRetrieved
|
|
66
|
+
};
|
|
67
|
+
// Single selector
|
|
68
|
+
componentProps.selectedContentType = this.selectedContentType;
|
|
69
|
+
var element = React.createElement(PropertyFieldContentTypePickerHost, componentProps);
|
|
70
|
+
// Calls the REACT content generator
|
|
71
|
+
ReactDom.render(element, elem);
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Disposes the current object
|
|
75
|
+
*/
|
|
76
|
+
PropertyFieldContentTypePickerBuilder.prototype.dispose = function (_elem) {
|
|
77
|
+
// no-op;
|
|
78
|
+
};
|
|
79
|
+
return PropertyFieldContentTypePickerBuilder;
|
|
80
|
+
}());
|
|
81
|
+
/**
|
|
82
|
+
* Helper method to create a SPContentType Picker on the PropertyPane.
|
|
83
|
+
* @param targetProperty - Target property the SharePoint ContentType picker is associated to.
|
|
84
|
+
* @param properties - Strongly typed SPContentType Picker properties.
|
|
85
|
+
*/
|
|
86
|
+
export function PropertyFieldContentTypePicker(targetProperty, properties) {
|
|
87
|
+
//Create an internal properties object from the given properties
|
|
88
|
+
var newProperties = {
|
|
89
|
+
label: properties.label,
|
|
90
|
+
targetProperty: targetProperty,
|
|
91
|
+
context: properties.context,
|
|
92
|
+
listId: properties.listId,
|
|
93
|
+
selectedContentType: typeof properties.selectedContentType === 'string' ? properties.selectedContentType : null,
|
|
94
|
+
onPropertyChange: properties.onPropertyChange,
|
|
95
|
+
properties: properties.properties,
|
|
96
|
+
onDispose: null,
|
|
97
|
+
onRender: null,
|
|
98
|
+
key: properties.key,
|
|
99
|
+
disabled: properties.disabled,
|
|
100
|
+
contentTypesToExclude: properties.contentTypesToExclude,
|
|
101
|
+
webAbsoluteUrl: properties.webAbsoluteUrl,
|
|
102
|
+
filter: properties.filter,
|
|
103
|
+
onGetErrorMessage: properties.onGetErrorMessage,
|
|
104
|
+
deferredValidationTime: properties.deferredValidationTime,
|
|
105
|
+
onContentTypesRetrieved: properties.onContentTypesRetrieved
|
|
106
|
+
};
|
|
107
|
+
//Calls the PropertyFieldContentTypePicker builder object
|
|
108
|
+
//This object will simulate a PropertyFieldCustom to manage his rendering process
|
|
109
|
+
return new PropertyFieldContentTypePickerBuilder(targetProperty, newProperties);
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=PropertyFieldContentTypePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyFieldContentTypePicker.js","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/PropertyFieldContentTypePicker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAEL,qBAAqB,EACtB,MAAM,6BAA6B,CAAC;AAErC,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AAKtF;;GAEG;AACH;IA2BE;;OAEG;IACH,+CAAmB,eAAuB,EAAE,WAAyD;QAzB9F,SAAI,GAA0B,qBAAqB,CAAC,MAAM,CAAC;QAW1D,2BAAsB,GAAW,GAAG,CAAC;QACrC,aAAQ,GAAY,KAAK,CAAC;QAC1B,mCAA8B,GAAY,KAAK,CAAC;QAatD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,eAAe,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC;QAC9B,IAAI,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC;QACzC,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,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C,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI;QAC/G,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;QAC7C,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,UAAU,CAAC,GAAG;QACnB,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,qBAAqB,EAAE,UAAU,CAAC,qBAAqB;QACvD,cAAc,EAAE,UAAU,CAAC,cAAc;QACzC,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;QAC/C,sBAAsB,EAAE,UAAU,CAAC,sBAAsB;QACzD,uBAAuB,EAAE,UAAU,CAAC,uBAAuB;KAC5D,CAAC;IACF,yDAAyD;IACzD,iFAAiF;IACjF,OAAO,IAAI,qCAAqC,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { IPropertyFieldContentTypePickerHostProps, IPropertyFieldContentTypePickerHostState } from './IPropertyFieldContentTypePickerHost';
|
|
3
|
+
/**
|
|
4
|
+
* Renders the controls for PropertyFieldContentTypePicker component
|
|
5
|
+
*/
|
|
6
|
+
export default class PropertyFieldContentTypePickerHost extends React.Component<IPropertyFieldContentTypePickerHostProps, IPropertyFieldContentTypePickerHostState> {
|
|
7
|
+
private options;
|
|
8
|
+
private selectedKey;
|
|
9
|
+
private latestValidateValue;
|
|
10
|
+
private async;
|
|
11
|
+
private delayedValidate;
|
|
12
|
+
/**
|
|
13
|
+
* Constructor method
|
|
14
|
+
*/
|
|
15
|
+
constructor(props: IPropertyFieldContentTypePickerHostProps);
|
|
16
|
+
componentDidMount(): void;
|
|
17
|
+
componentDidUpdate(prevProps: IPropertyFieldContentTypePickerHostProps, _prevState: IPropertyFieldContentTypePickerHostState): void;
|
|
18
|
+
/**
|
|
19
|
+
* Loads the loadContentTypes from a selected SharePoint list or SharePoint site
|
|
20
|
+
*/
|
|
21
|
+
private loadContentTypes;
|
|
22
|
+
/**
|
|
23
|
+
* Raises when a contentType has been selected
|
|
24
|
+
*/
|
|
25
|
+
private onChanged;
|
|
26
|
+
/**
|
|
27
|
+
* Validates the new custom field value
|
|
28
|
+
*/
|
|
29
|
+
private validate;
|
|
30
|
+
/**
|
|
31
|
+
* Notifies the parent Web Part of a property value change
|
|
32
|
+
*/
|
|
33
|
+
private notifyAfterValidate;
|
|
34
|
+
/**
|
|
35
|
+
* Called when the component will unmount
|
|
36
|
+
*/
|
|
37
|
+
componentWillUnmount(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Renders the SPContentTypePicker controls with Office UI Fabric
|
|
40
|
+
*/
|
|
41
|
+
render(): JSX.Element;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=PropertyFieldContentTypePickerHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyFieldContentTypePickerHost.d.ts","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/PropertyFieldContentTypePickerHost.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,wCAAwC,EAAE,wCAAwC,EAAE,MAAM,uCAAuC,CAAC;AAW3I;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,kCAAmC,SAAQ,KAAK,CAAC,SAAS,CAAC,wCAAwC,EAAE,wCAAwC,CAAC;IACjK,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,eAAe,CAA0B;IAEjD;;OAEG;gBACS,KAAK,EAAE,wCAAwC;IAmBpD,iBAAiB,IAAI,IAAI;IAKzB,kBAAkB,CAAC,SAAS,EAAE,wCAAwC,EAAE,UAAU,EAAE,wCAAwC,GAAG,IAAI;IAM1I;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA0CxB;;OAEG;IAEH,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAoChB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAiC3B;;OAEG;IACI,oBAAoB,IAAI,IAAI;IAMnC;;OAEG;IACI,MAAM,IAAI,GAAG,CAAC,OAAO;CAiB7B"}
|
|
@@ -0,0 +1,198 @@
|
|
|
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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
import { Dropdown } from '@fluentui/react/lib/Dropdown';
|
|
18
|
+
import { Async } from '@fluentui/react/lib/Utilities';
|
|
19
|
+
import { Label } from '@fluentui/react/lib/Label';
|
|
20
|
+
import { SPContentTypePickerService } from '../../services/SPContentTypePickerService';
|
|
21
|
+
import FieldErrorMessage from '../errorMessage/FieldErrorMessage';
|
|
22
|
+
import * as telemetry from '../../common/telemetry';
|
|
23
|
+
import { setPropertyValue } from '../../helpers/GeneralHelper';
|
|
24
|
+
// Empty contentType value
|
|
25
|
+
var EMPTY_CONTENT_TYPE_KEY = 'NO_CONTENT_TYPE_SELECTED';
|
|
26
|
+
/**
|
|
27
|
+
* Renders the controls for PropertyFieldContentTypePicker component
|
|
28
|
+
*/
|
|
29
|
+
var PropertyFieldContentTypePickerHost = /** @class */ (function (_super) {
|
|
30
|
+
__extends(PropertyFieldContentTypePickerHost, _super);
|
|
31
|
+
/**
|
|
32
|
+
* Constructor method
|
|
33
|
+
*/
|
|
34
|
+
function PropertyFieldContentTypePickerHost(props) {
|
|
35
|
+
var _this = _super.call(this, props) || this;
|
|
36
|
+
_this.options = [];
|
|
37
|
+
telemetry.track('PropertyFieldContentTypePicker', {
|
|
38
|
+
disabled: props.disabled
|
|
39
|
+
});
|
|
40
|
+
_this.state = {
|
|
41
|
+
results: _this.options,
|
|
42
|
+
errorMessage: ''
|
|
43
|
+
};
|
|
44
|
+
_this.async = new Async(_this);
|
|
45
|
+
_this.validate = _this.validate.bind(_this);
|
|
46
|
+
_this.onChanged = _this.onChanged.bind(_this);
|
|
47
|
+
_this.notifyAfterValidate = _this.notifyAfterValidate.bind(_this);
|
|
48
|
+
_this.delayedValidate = _this.async.debounce(_this.validate, _this.props.deferredValidationTime);
|
|
49
|
+
return _this;
|
|
50
|
+
}
|
|
51
|
+
PropertyFieldContentTypePickerHost.prototype.componentDidMount = function () {
|
|
52
|
+
// Start retrieving the content types
|
|
53
|
+
this.loadContentTypes();
|
|
54
|
+
};
|
|
55
|
+
PropertyFieldContentTypePickerHost.prototype.componentDidUpdate = function (prevProps, _prevState) {
|
|
56
|
+
if (this.props.listId !== prevProps.listId || this.props.webAbsoluteUrl !== prevProps.webAbsoluteUrl) {
|
|
57
|
+
this.loadContentTypes();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Loads the loadContentTypes from a selected SharePoint list or SharePoint site
|
|
62
|
+
*/
|
|
63
|
+
PropertyFieldContentTypePickerHost.prototype.loadContentTypes = function () {
|
|
64
|
+
var _this = this;
|
|
65
|
+
var contentTypeService = new SPContentTypePickerService(this.props, this.props.context);
|
|
66
|
+
var contentTypesToExclude = this.props.contentTypesToExclude || [];
|
|
67
|
+
this.options = [];
|
|
68
|
+
contentTypeService.getContentTypes().then(function (response) {
|
|
69
|
+
console.log(response);
|
|
70
|
+
// Start mapping the contentTypes that are selected
|
|
71
|
+
response.value.forEach(function (contentType) {
|
|
72
|
+
if (_this.props.selectedContentType === contentType.Id.StringValue) {
|
|
73
|
+
_this.selectedKey = contentType.Id.StringValue;
|
|
74
|
+
}
|
|
75
|
+
// Make sure that the current contentType is NOT in the 'contentTypesToExclude' array
|
|
76
|
+
if (contentTypesToExclude.indexOf(contentType.Name) === -1 && contentTypesToExclude.indexOf(contentType.Id.StringValue) === -1) {
|
|
77
|
+
_this.options.push({
|
|
78
|
+
key: contentType.Id.StringValue,
|
|
79
|
+
text: contentType.Name
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
// Option to unselect the contentType
|
|
84
|
+
_this.options.unshift({
|
|
85
|
+
key: EMPTY_CONTENT_TYPE_KEY,
|
|
86
|
+
text: ''
|
|
87
|
+
});
|
|
88
|
+
// Update the current component state
|
|
89
|
+
_this.setState({
|
|
90
|
+
results: _this.options,
|
|
91
|
+
selectedKey: _this.selectedKey
|
|
92
|
+
});
|
|
93
|
+
}).catch(function (error) {
|
|
94
|
+
console.error('Error loading content types:', error);
|
|
95
|
+
// Handle the error appropriately, e.g., display an error message to the user
|
|
96
|
+
_this.setState({
|
|
97
|
+
errorMessage: 'Error : List does not exist.\n\nThe page you selected contains a list that does not exist. It may have been deleted by another user.'
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Raises when a contentType has been selected
|
|
103
|
+
*/
|
|
104
|
+
PropertyFieldContentTypePickerHost.prototype.onChanged = function (element, option, index) {
|
|
105
|
+
var newValue = option.key;
|
|
106
|
+
this.delayedValidate(newValue);
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Validates the new custom field value
|
|
110
|
+
*/
|
|
111
|
+
PropertyFieldContentTypePickerHost.prototype.validate = function (value) {
|
|
112
|
+
var _this = this;
|
|
113
|
+
if (this.props.onGetErrorMessage === null || this.props.onGetErrorMessage === undefined) {
|
|
114
|
+
this.notifyAfterValidate(this.props.selectedContentType, value);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (this.latestValidateValue === value) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this.latestValidateValue = value;
|
|
121
|
+
var errResult = this.props.onGetErrorMessage(value || '');
|
|
122
|
+
if (typeof errResult !== 'undefined') {
|
|
123
|
+
if (typeof errResult === 'string') {
|
|
124
|
+
if (errResult === '') {
|
|
125
|
+
this.notifyAfterValidate(this.props.selectedContentType, value);
|
|
126
|
+
}
|
|
127
|
+
this.setState({
|
|
128
|
+
errorMessage: errResult
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
errResult.then(function (errorMessage) {
|
|
133
|
+
if (!errorMessage) {
|
|
134
|
+
_this.notifyAfterValidate(_this.props.selectedContentType, value);
|
|
135
|
+
}
|
|
136
|
+
_this.setState({
|
|
137
|
+
errorMessage: errorMessage
|
|
138
|
+
});
|
|
139
|
+
}).catch(function () { });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
this.notifyAfterValidate(this.props.selectedContentType, value);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Notifies the parent Web Part of a property value change
|
|
148
|
+
*/
|
|
149
|
+
PropertyFieldContentTypePickerHost.prototype.notifyAfterValidate = function (oldValue, newValue) {
|
|
150
|
+
// Check if the user wanted to unselect the contentType
|
|
151
|
+
var propValue = newValue === EMPTY_CONTENT_TYPE_KEY ? '' : newValue;
|
|
152
|
+
// Deselect all options
|
|
153
|
+
this.options = this.state.results.map(function (option) {
|
|
154
|
+
if (option.selected) {
|
|
155
|
+
option.selected = false;
|
|
156
|
+
}
|
|
157
|
+
return option;
|
|
158
|
+
});
|
|
159
|
+
// Set the current selected key
|
|
160
|
+
this.selectedKey = newValue;
|
|
161
|
+
// Update the state
|
|
162
|
+
this.setState({
|
|
163
|
+
selectedKey: this.selectedKey,
|
|
164
|
+
results: this.options
|
|
165
|
+
});
|
|
166
|
+
if (this.props.onPropertyChange && propValue !== null) {
|
|
167
|
+
// Store the new property value
|
|
168
|
+
setPropertyValue(this.props.properties, this.props.targetProperty, propValue);
|
|
169
|
+
// Trigger the default onPropertyChange event
|
|
170
|
+
this.props.onPropertyChange(this.props.targetProperty, oldValue, propValue);
|
|
171
|
+
// Trigger the apply button
|
|
172
|
+
if (typeof this.props.onChange !== 'undefined' && this.props.onChange !== null) {
|
|
173
|
+
this.props.onChange(this.props.targetProperty, propValue);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Called when the component will unmount
|
|
179
|
+
*/
|
|
180
|
+
PropertyFieldContentTypePickerHost.prototype.componentWillUnmount = function () {
|
|
181
|
+
if (typeof this.async !== 'undefined') {
|
|
182
|
+
this.async.dispose();
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Renders the SPContentTypePicker controls with Office UI Fabric
|
|
187
|
+
*/
|
|
188
|
+
PropertyFieldContentTypePickerHost.prototype.render = function () {
|
|
189
|
+
// Renders content
|
|
190
|
+
return (React.createElement("div", null,
|
|
191
|
+
this.props.label && React.createElement(Label, null, this.props.label),
|
|
192
|
+
React.createElement(Dropdown, { disabled: this.props.disabled, label: '', onChange: this.onChanged, options: this.state.results, selectedKey: this.state.selectedKey }),
|
|
193
|
+
React.createElement(FieldErrorMessage, { errorMessage: this.state.errorMessage })));
|
|
194
|
+
};
|
|
195
|
+
return PropertyFieldContentTypePickerHost;
|
|
196
|
+
}(React.Component));
|
|
197
|
+
export default PropertyFieldContentTypePickerHost;
|
|
198
|
+
//# sourceMappingURL=PropertyFieldContentTypePickerHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyFieldContentTypePickerHost.js","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/PropertyFieldContentTypePickerHost.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAmB,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAGlE,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,0BAA0B;AAC1B,IAAM,sBAAsB,GAAG,0BAA0B,CAAC;AAE1D;;GAEG;AACH;IAAgE,sDAAmG;IAOjK;;OAEG;IACH,4CAAY,KAA+C;QAA3D,YACE,kBAAM,KAAK,CAAC,SAgBb;QA1BO,aAAO,GAAsB,EAAE,CAAC;QAYtC,SAAS,CAAC,KAAK,CAAC,gCAAgC,EAAE;YAChD,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACzB,CAAC,CAAC;QAEH,KAAI,CAAC,KAAK,GAAG;YACX,OAAO,EAAE,KAAI,CAAC,OAAO;YACrB,YAAY,EAAE,EAAE;SACjB,CAAC;QAEF,KAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,KAAI,CAAC,CAAC;QAC7B,KAAI,CAAC,QAAQ,GAAG,KAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;QACzC,KAAI,CAAC,SAAS,GAAG,KAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;QAC3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AAI,oBAAC,KAAK,QAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAS;YACtD,oBAAC,QAAQ,IACP,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,KAAK,EAAC,EAAE,EACR,QAAQ,EAAE,IAAI,CAAC,SAAS,EACxB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,GACnC;YAEF,oBAAC,iBAAiB,IAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,GAAI,CACxD,CACP,CAAC;IACJ,CAAC;IACH,yCAAC;AAAD,CAAC,AArMD,CAAgE,KAAK,CAAC,SAAS,GAqM9E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './PropertyFieldContentTypePicker';
|
|
2
|
+
export * from './IPropertyFieldContentTypePicker';
|
|
3
|
+
export * from './PropertyFieldContentTypePickerHost';
|
|
4
|
+
export * from './IPropertyFieldContentTypePickerHost';
|
|
5
|
+
export * from './ISPContentType';
|
|
6
|
+
export * from './ISPContentTypes';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './PropertyFieldContentTypePicker';
|
|
2
|
+
export * from './IPropertyFieldContentTypePicker';
|
|
3
|
+
export * from './PropertyFieldContentTypePickerHost';
|
|
4
|
+
export * from './IPropertyFieldContentTypePickerHost';
|
|
5
|
+
export * from './ISPContentType';
|
|
6
|
+
export * from './ISPContentTypes';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/propertyFields/contentTypePicker/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISPContentTypePickerService.d.ts","sourceRoot":"","sources":["../../src/services/ISPContentTypePickerService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,MAAM,WAAW,2BAA2B;IAC1C,eAAe,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISPContentTypePickerService.js","sourceRoot":"","sources":["../../src/services/ISPContentTypePickerService.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseComponentContext } from '@microsoft/sp-component-base';
|
|
2
|
+
import { IPropertyFieldContentTypePickerHostProps } from '../propertyFields/contentTypePicker';
|
|
3
|
+
import { ISPContentTypePickerService } from './ISPContentTypePickerService';
|
|
4
|
+
import { ISPContentTypes } from '../propertyFields/contentTypePicker';
|
|
5
|
+
/**
|
|
6
|
+
* Service implementation to get Content Types from SharePoint site or selected SharePoint List
|
|
7
|
+
*/
|
|
8
|
+
export declare class SPContentTypePickerService implements ISPContentTypePickerService {
|
|
9
|
+
private context;
|
|
10
|
+
private props;
|
|
11
|
+
/**
|
|
12
|
+
* Service constructor
|
|
13
|
+
*/
|
|
14
|
+
constructor(_props: IPropertyFieldContentTypePickerHostProps, pageContext: BaseComponentContext);
|
|
15
|
+
/**
|
|
16
|
+
* Gets the collection of ContentTypes from SharePoint site or selected SharePoint List
|
|
17
|
+
*/
|
|
18
|
+
getContentTypes(): Promise<ISPContentTypes>;
|
|
19
|
+
/**
|
|
20
|
+
* Returns an empty contentType for when no selection is done
|
|
21
|
+
*/
|
|
22
|
+
private getEmptycontentTypes;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=SPContentTypePickerService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SPContentTypePickerService.d.ts","sourceRoot":"","sources":["../../src/services/SPContentTypePickerService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAkB,wCAAwC,EAAmC,MAAM,qCAAqC,CAAC;AAChJ,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE;;GAEG;AACH,qBAAa,0BAA2B,YAAW,2BAA2B;IAC5E,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,KAAK,CAA2C;IAExD;;OAEG;gBACS,MAAM,EAAE,wCAAwC,EAAE,WAAW,EAAE,oBAAoB;IAK/F;;OAEG;IACU,eAAe,IAAI,OAAO,CAAC,eAAe,CAAC;IAkDxD;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAU7B"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { SPHttpClient } from '@microsoft/sp-http';
|
|
38
|
+
import { PropertyFieldContentTypeOrderBy } from '../propertyFields/contentTypePicker';
|
|
39
|
+
/**
|
|
40
|
+
* Service implementation to get Content Types from SharePoint site or selected SharePoint List
|
|
41
|
+
*/
|
|
42
|
+
var SPContentTypePickerService = /** @class */ (function () {
|
|
43
|
+
/**
|
|
44
|
+
* Service constructor
|
|
45
|
+
*/
|
|
46
|
+
function SPContentTypePickerService(_props, pageContext) {
|
|
47
|
+
this.props = _props;
|
|
48
|
+
this.context = pageContext;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gets the collection of ContentTypes from SharePoint site or selected SharePoint List
|
|
52
|
+
*/
|
|
53
|
+
SPContentTypePickerService.prototype.getContentTypes = function () {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
+
var webAbsoluteUrl, queryUrl, response, views, lr, output;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0:
|
|
59
|
+
if (this.context.pageContext.web.absoluteUrl === undefined || this.context.pageContext.web.absoluteUrl === "") {
|
|
60
|
+
return [2 /*return*/, this.getEmptycontentTypes()];
|
|
61
|
+
}
|
|
62
|
+
webAbsoluteUrl = this.props.webAbsoluteUrl ? this.props.webAbsoluteUrl : this.context.pageContext.web.absoluteUrl;
|
|
63
|
+
queryUrl = this.props.listId ? "".concat(webAbsoluteUrl, "/_api/lists(guid'").concat(this.props.listId, "')/ContentTypes?$select=Name,Id") : "".concat(webAbsoluteUrl, "/_api/web/ContentTypes?$select=Name,Id");
|
|
64
|
+
if (!(this.props.orderBy !== null || this.props.orderBy !== undefined)) return [3 /*break*/, 7];
|
|
65
|
+
queryUrl += '&$orderby=';
|
|
66
|
+
switch (this.props.orderBy) {
|
|
67
|
+
case PropertyFieldContentTypeOrderBy.Id:
|
|
68
|
+
queryUrl += 'Id';
|
|
69
|
+
break;
|
|
70
|
+
case PropertyFieldContentTypeOrderBy.Name:
|
|
71
|
+
queryUrl += 'Name';
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
// Adds an OData Filter to the list
|
|
75
|
+
if (this.props.filter) {
|
|
76
|
+
queryUrl += "&$filter=".concat(encodeURIComponent(this.props.filter));
|
|
77
|
+
}
|
|
78
|
+
return [4 /*yield*/, this.context.spHttpClient.get(queryUrl, SPHttpClient.configurations.v1)];
|
|
79
|
+
case 1:
|
|
80
|
+
response = _a.sent();
|
|
81
|
+
return [4 /*yield*/, response.json()];
|
|
82
|
+
case 2:
|
|
83
|
+
views = (_a.sent());
|
|
84
|
+
if (!this.props.onContentTypesRetrieved) return [3 /*break*/, 6];
|
|
85
|
+
lr = this.props.onContentTypesRetrieved(views.value);
|
|
86
|
+
output = void 0;
|
|
87
|
+
if (!(lr instanceof Array)) return [3 /*break*/, 3];
|
|
88
|
+
output = lr;
|
|
89
|
+
return [3 /*break*/, 5];
|
|
90
|
+
case 3: return [4 /*yield*/, lr];
|
|
91
|
+
case 4:
|
|
92
|
+
output = _a.sent();
|
|
93
|
+
_a.label = 5;
|
|
94
|
+
case 5:
|
|
95
|
+
views.value = output;
|
|
96
|
+
_a.label = 6;
|
|
97
|
+
case 6: return [2 /*return*/, views];
|
|
98
|
+
case 7: return [2 /*return*/];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Returns an empty contentType for when no selection is done
|
|
105
|
+
*/
|
|
106
|
+
SPContentTypePickerService.prototype.getEmptycontentTypes = function () {
|
|
107
|
+
return new Promise(function (resolve) {
|
|
108
|
+
var listData = {
|
|
109
|
+
value: []
|
|
110
|
+
};
|
|
111
|
+
resolve(listData);
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
return SPContentTypePickerService;
|
|
115
|
+
}());
|
|
116
|
+
export { SPContentTypePickerService };
|
|
117
|
+
//# sourceMappingURL=SPContentTypePickerService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SPContentTypePickerService.js","sourceRoot":"","sources":["../../src/services/SPContentTypePickerService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAA4D,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AAIhJ;;GAEG;AACH;IAIE;;OAEG;IACH,oCAAY,MAAgD,EAAE,WAAiC;QAC7F,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC;IAC7B,CAAC;IAED;;OAEG;IACU,oDAAe,GAA5B;;;;;;wBACE,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,EAAE;4BAC7G,sBAAO,IAAI,CAAC,oBAAoB,EAAE,EAAC;yBACpC;wBAEK,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC;wBAGpH,QAAQ,GAAW,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,UAAG,cAAc,8BAAoB,IAAI,CAAC,KAAK,CAAC,MAAM,oCAAiC,CAAC,CAAC,CAAC,UAAG,cAAc,2CAAwC,CAAC;6BAG3L,CAAA,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAA,EAA/D,wBAA+D;wBACjE,QAAQ,IAAI,YAAY,CAAC;w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ACH,iCAAC;AAAD,CAAC,AA9ED,IA8EC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnp/spfx-property-controls",
|
|
3
3
|
"description": "Reusable property pane controls for SharePoint Framework solutions",
|
|
4
|
-
"version": "3.17.0-beta.
|
|
4
|
+
"version": "3.17.0-beta.8725901",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.13.0 <17.0.0 || >=18.17.1 <19.0.0"
|
|
7
7
|
},
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"build": "gulp build",
|
|
10
10
|
"clean": "gulp clean",
|
|
11
11
|
"test": "gulp test",
|
|
12
|
-
"serve": "fast-serve",
|
|
12
|
+
"serve": "gulp bundle --custom-serve --max_old_space_size=4096 && fast-serve",
|
|
13
13
|
"versionUpdater": "gulp versionUpdater",
|
|
14
14
|
"prepublishOnly": "gulp",
|
|
15
15
|
"changelog": "node scripts/create-changelog.js && node scripts/sync-changelogs.js && gulp versionUpdater",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"husky": "^6.0.0",
|
|
70
70
|
"request-promise": "4.2.6",
|
|
71
71
|
"sonarqube-scanner": "2.8.2",
|
|
72
|
-
"spfx-fast-serve-helpers": "1.18.
|
|
72
|
+
"spfx-fast-serve-helpers": "~1.18.0",
|
|
73
73
|
"typescript": "4.7.4",
|
|
74
74
|
"uuid": "^9.0.1"
|
|
75
75
|
},
|