Merge pull request #1521 from sharepointknight/master
This commit is contained in:
commit
48854f5480
|
@ -61,7 +61,7 @@ The web part use PnPjs library, Office-ui-fabric-react components
|
||||||
|
|
||||||
Solution|Author(s)
|
Solution|Author(s)
|
||||||
--------|---------
|
--------|---------
|
||||||
Directory Web Part|João Mendes
|
Directory Web Part| João Mendes
|
||||||
Directory Web Part| Peter Paul Kirschner ([@petkir_at](https://twitter.com/petkir_at))
|
Directory Web Part| Peter Paul Kirschner ([@petkir_at](https://twitter.com/petkir_at))
|
||||||
Directory Web Part| Sudharsan K ([@sudharsank](https://twitter.com/sudharsank))
|
Directory Web Part| Sudharsan K ([@sudharsank](https://twitter.com/sudharsank))
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ Version|Date|Comments
|
||||||
-------|----|--------
|
-------|----|--------
|
||||||
1.0.0|July 29, 2019|Initial release
|
1.0.0|July 29, 2019|Initial release
|
||||||
1.0.1|July 19, 2020|Bugfix and mock-service for workbench (```LivePersonaCard``` not supported in workbench)
|
1.0.1|July 19, 2020|Bugfix and mock-service for workbench (```LivePersonaCard``` not supported in workbench)
|
||||||
2.0.0.0|Sep 18 2020|React hooks, paging, dynamic search props, result alignment using office ui fabric stack.
|
2.0.0|Sep 18 2020|React hooks, paging, dynamic search props, result alignment using office ui fabric stack.
|
||||||
|
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "react-directory",
|
"name": "react-directory",
|
||||||
"version": "1.0.1",
|
"version": "2.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "react-directory",
|
"name": "react-directory",
|
||||||
"version": "1.0.1",
|
"version": "2.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "react-form-webpart",
|
"name": "react-form-webpart",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
|
@ -45,4 +45,4 @@
|
||||||
"gulp": "~3.9.1",
|
"gulp": "~3.9.1",
|
||||||
"tslint-microsoft-contrib": "5.0.0"
|
"tslint-microsoft-contrib": "5.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -154,13 +154,14 @@ export class ListFormService implements IListFormService {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const formValues = this.GetFormValues(fieldsSchema, data, originalData);
|
const formValues = this.GetFormValues(fieldsSchema, data, originalData);
|
||||||
let createAttachmetns = this.GetAttachmentsCreate(data);
|
let createAttachments = this.GetAttachmentsCreate(data);
|
||||||
let deleteAttachmetns = this.GetAttachmentsDelete(data, originalData);
|
let deleteAttachments = this.GetAttachmentsDelete(data, originalData);
|
||||||
httpClientOptions.body = JSON.stringify({
|
httpClientOptions.body = JSON.stringify({
|
||||||
bNewDocumentUpdate: false,
|
bNewDocumentUpdate: false,
|
||||||
checkInComment: null,
|
checkInComment: null,
|
||||||
formValues,
|
formValues,
|
||||||
});
|
});
|
||||||
|
|
||||||
const endpoint = `${webUrl}/_api/web/GetList(@listUrl)/items(@itemId)/ValidateUpdateListItem()`
|
const endpoint = `${webUrl}/_api/web/GetList(@listUrl)/items(@itemId)/ValidateUpdateListItem()`
|
||||||
+ `?@listUrl=${encodeURIComponent('\'' + listUrl + '\'')}&@itemId=%27${itemId}%27`;
|
+ `?@listUrl=${encodeURIComponent('\'' + listUrl + '\'')}&@itemId=%27${itemId}%27`;
|
||||||
try {
|
try {
|
||||||
|
@ -170,12 +171,12 @@ export class ListFormService implements IListFormService {
|
||||||
}
|
}
|
||||||
let responseData = await response.json();
|
let responseData = await response.json();
|
||||||
responseData.AttachmentResponse = [];
|
responseData.AttachmentResponse = [];
|
||||||
if (deleteAttachmetns.length > 0) {
|
if (deleteAttachments.length > 0) {
|
||||||
let deleteResponse = await this.deleteAttachments(webUrl, listUrl, itemId, deleteAttachmetns);
|
let deleteResponse = await this.deleteAttachments(webUrl, listUrl, itemId, deleteAttachments);
|
||||||
responseData.AttachmentResponse.push(deleteResponse);
|
responseData.AttachmentResponse.push(deleteResponse);
|
||||||
}
|
}
|
||||||
if (createAttachmetns.length > 0) {
|
if (createAttachments.length > 0) {
|
||||||
let createResponse = await this.uploadAttachments(webUrl, listUrl, itemId, createAttachmetns);
|
let createResponse = await this.uploadAttachments(webUrl, listUrl, itemId, createAttachments);
|
||||||
responseData.AttachmentResponse.push(createResponse);
|
responseData.AttachmentResponse.push(createResponse);
|
||||||
}
|
}
|
||||||
return responseData.d.ValidateUpdateListItem.results;
|
return responseData.d.ValidateUpdateListItem.results;
|
||||||
|
@ -323,6 +324,15 @@ export class ListFormService implements IListFormService {
|
||||||
HasException: false,
|
HasException: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if (field.FieldType === "DateTime") {
|
||||||
|
let dateValue = data[field.InternalName].split('').map((c) => { return (c.charCodeAt(0) < 127) ? c : ''; }).join('');
|
||||||
|
return {
|
||||||
|
ErrorMessage: null,
|
||||||
|
FieldName: field.InternalName,
|
||||||
|
FieldValue: dateValue,
|
||||||
|
HasException: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return {
|
return {
|
||||||
ErrorMessage: null,
|
ErrorMessage: null,
|
||||||
|
|
|
@ -34,6 +34,29 @@ export default class ListFormWebPart extends BaseClientSideWebPart<IListFormWebP
|
||||||
protected onInit(): Promise<void> {
|
protected onInit(): Promise<void> {
|
||||||
return super.onInit().then((_) => {
|
return super.onInit().then((_) => {
|
||||||
this.listService = new ListService(this.context.spHttpClient);
|
this.listService = new ListService(this.context.spHttpClient);
|
||||||
|
//Polyfill array find
|
||||||
|
if (!Array.prototype["find"]) {
|
||||||
|
Array.prototype["find"] = function (predicate) {
|
||||||
|
if (this == null) {
|
||||||
|
throw new TypeError('Array.prototype.find called on null or undefined');
|
||||||
|
}
|
||||||
|
if (typeof predicate !== 'function') {
|
||||||
|
throw new TypeError('predicate must be a function');
|
||||||
|
}
|
||||||
|
var list = Object(this);
|
||||||
|
var length = list.length >>> 0;
|
||||||
|
var thisArg = arguments[1];
|
||||||
|
var value;
|
||||||
|
|
||||||
|
for (var i = 0; i < length; i++) {
|
||||||
|
value = list[i];
|
||||||
|
if (predicate.call(thisArg, value, i, list)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ export default class DateFormField extends React.Component<IDateFormFieldProps,
|
||||||
public componentDidUpdate(prevProps: IDateFormFieldProps, prevState: IDateFormFieldState) {
|
public componentDidUpdate(prevProps: IDateFormFieldProps, prevState: IDateFormFieldState) {
|
||||||
//Component Value property got updated from List State
|
//Component Value property got updated from List State
|
||||||
if (this.props.value && prevProps.value != this.props.value) {
|
if (this.props.value && prevProps.value != this.props.value) {
|
||||||
let momentDate = moment(this.props.value);
|
let momentDate = moment(this.props.value, moment.localeData(this.props.locale).longDateFormat('L'));
|
||||||
this.setState({
|
this.setState({
|
||||||
hours: momentDate.hour(),
|
hours: momentDate.hour(),
|
||||||
minutes: momentDate.minute(),
|
minutes: momentDate.minute(),
|
||||||
|
|
Loading…
Reference in New Issue