From abd19d1290fb3ab8dc6ff13d276fe776f03d9964 Mon Sep 17 00:00:00 2001 From: IRRDC Date: Wed, 24 Jan 2024 10:29:39 +0100 Subject: [PATCH 1/4] Fixing #1733 for non-standard cases A possible fix for #1733 when the data gets returned in a non-standard way. --- src/controls/dynamicForm/DynamicForm.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/controls/dynamicForm/DynamicForm.tsx b/src/controls/dynamicForm/DynamicForm.tsx index b4cffa172..929b51cb3 100644 --- a/src/controls/dynamicForm/DynamicForm.tsx +++ b/src/controls/dynamicForm/DynamicForm.tsx @@ -1192,6 +1192,10 @@ export class DynamicForm extends React.Component< hiddenName = field.HiddenListInternalName; termSetId = field.TermSetId; anchorId = field.AnchorId; + if (item && item[field.InternalName] && item[field.InternalName].hasOwnProperty('__metadata') && item[field.InternalName].hasOwnProperty('results')) { + // Some combinations of included packages cause the returned data to be placed in a 'results' sub-property after compilation. + item[field.InternalName] = item[field.InternalName]['results']; + } if (item && item[field.InternalName]) { item[field.InternalName].forEach((element) => { selectedTags.push({ From 45050da4624a1d7fdcc7f3f4499db15d6b4bd346 Mon Sep 17 00:00:00 2001 From: IRRDC Date: Thu, 8 Feb 2024 09:38:32 +0100 Subject: [PATCH 2/4] Bugfix for issue #1758 Added missing references to webURL to service calls. --- src/controls/dynamicForm/DynamicForm.tsx | 12 +++++++----- src/services/SPService.ts | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/controls/dynamicForm/DynamicForm.tsx b/src/controls/dynamicForm/DynamicForm.tsx index c5a607e60..0ce2a0144 100644 --- a/src/controls/dynamicForm/DynamicForm.tsx +++ b/src/controls/dynamicForm/DynamicForm.tsx @@ -915,11 +915,11 @@ export class DynamicForm extends React.Component< try { // Fetch form rendering information from SharePoint - const listInfo = await this._spService.getListFormRenderInfo(listId); + const listInfo = await this._spService.getListFormRenderInfo(listId, this.webURL); // Fetch additional information about fields from SharePoint // (Number fields for min and max values, and fields with validation) - const additionalInfo = await this._spService.getAdditionalListFormFieldInfo(listId); + const additionalInfo = await this._spService.getAdditionalListFormFieldInfo(listId, this.webURL); const numberFields = additionalInfo.filter((f) => f.TypeAsString === "Number" || f.TypeAsString === "Currency"); // Build a dictionary of validation formulas and messages @@ -1166,7 +1166,8 @@ export class DynamicForm extends React.Component< const response = await this._spService.getSingleManagedMetadataLabel( listId, listItemId, - field.InternalName + field.InternalName, + this.webURL ); if (response) { selectedTags.push({ @@ -1233,7 +1234,7 @@ export class DynamicForm extends React.Component< } dateFormat = field.DateFormat || "DateOnly"; - defaultDayOfWeek = (await this._spService.getRegionalWebSettings()).FirstDayOfWeek; + defaultDayOfWeek = (await this._spService.getRegionalWebSettings(this.webURL)).FirstDayOfWeek; } // Setup Thumbnail, Location and Boolean fields @@ -1322,7 +1323,8 @@ export class DynamicForm extends React.Component< listItemId, file.fileName, buffer, - undefined + undefined, + this.webURL ); } }; diff --git a/src/services/SPService.ts b/src/services/SPService.ts index 7a276ab73..3edcf6f56 100644 --- a/src/services/SPService.ts +++ b/src/services/SPService.ts @@ -654,9 +654,9 @@ export default class SPService implements ISPService { } } - public async getSingleManagedMetadataLabel(listId: string, listItemId: number, fieldName: string): Promise { // eslint-disable-line @typescript-eslint/no-explicit-any + public async getSingleManagedMetadataLabel(listId: string, listItemId: number, fieldName: string, webUrl?: string): Promise { // eslint-disable-line @typescript-eslint/no-explicit-any try { - const webAbsoluteUrl = this._context.pageContext.web.absoluteUrl; + const webAbsoluteUrl = !webUrl ? this._context.pageContext.web.absoluteUrl : webUrl; const apiUrl = `${webAbsoluteUrl}/_api/web/lists(@listId)/RenderListDataAsStream?@listId=guid'${encodeURIComponent(listId)}'`; const data = await this._context.spHttpClient.post(apiUrl, SPHttpClient.configurations.v1, { body: JSON.stringify({ From b01588ecfded20f1c511f74ea452f44a6f3fd21b Mon Sep 17 00:00:00 2001 From: IRRDC Date: Thu, 11 Jul 2024 11:20:25 +0200 Subject: [PATCH 3/4] Bugfix for issue #838 Bugfix for issue #838. When in compact mode the number of items rendered per page must match the number of all items. --- src/controls/gridLayout/GridLayout.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/controls/gridLayout/GridLayout.tsx b/src/controls/gridLayout/GridLayout.tsx index 9a566558d..6600b54a4 100644 --- a/src/controls/gridLayout/GridLayout.tsx +++ b/src/controls/gridLayout/GridLayout.tsx @@ -73,6 +73,7 @@ export class GridLayout extends React.Component { + if (this._isCompact) { + return this.props.items.length * this._rowHeight; + } return this._rowHeight * ROWS_PER_PAGE; } From eb26221d6da197dcf2c7a22ba30ceb58779152dc Mon Sep 17 00:00:00 2001 From: IRRDC Date: Thu, 11 Jul 2024 11:23:38 +0200 Subject: [PATCH 4/4] Removed code from other branch --- src/controls/dynamicForm/DynamicForm.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/controls/dynamicForm/DynamicForm.tsx b/src/controls/dynamicForm/DynamicForm.tsx index 125aea9e8..fa1d162d2 100644 --- a/src/controls/dynamicForm/DynamicForm.tsx +++ b/src/controls/dynamicForm/DynamicForm.tsx @@ -1204,10 +1204,6 @@ export class DynamicForm extends React.Component< hiddenName = field.HiddenListInternalName; termSetId = field.TermSetId; anchorId = field.AnchorId; - if (item && item[field.InternalName] && item[field.InternalName].hasOwnProperty('__metadata') && item[field.InternalName].hasOwnProperty('results')) { - // Some combinations of included packages cause the returned data to be placed in a 'results' sub-property after compilation. - item[field.InternalName] = item[field.InternalName]['results']; - } if (item && item[field.InternalName]) { item[field.InternalName].forEach((element) => { selectedTags.push({