Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wobba committed May 30, 2023
1 parent 52d2435 commit 416c1ad
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 15 deletions.
42 changes: 27 additions & 15 deletions search-parts/src/layouts/results/detailsList/DetailListLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class DetailsListLayout extends BaseLayout<IDetailsListLayoutProperties>
* Dynamically loaded components for property pane
*/
private _propertyFieldCollectionData: any = null;
private _propertyPaneWebPartInformation: any = null;
private _customCollectionFieldType: any = null;

public async onInit(): Promise<void> {
Expand Down Expand Up @@ -105,8 +106,16 @@ export class DetailsListLayout extends BaseLayout<IDetailsListLayoutProperties>
/* webpackChunkName: 'pnp-modern-search-results-detailslist-layout' */
'@pnp/spfx-property-controls/lib/PropertyFieldCollectionData'
);

this._propertyFieldCollectionData = PropertyFieldCollectionData;

if (this.properties.enableGrouping) {
const { PropertyPaneWebPartInformation } = await import(
/* webpackChunkName: 'pnp-modern-search-property-pane' */
'@pnp/spfx-property-controls/lib/PropertyPaneWebPartInformation'
);
this._propertyPaneWebPartInformation = PropertyPaneWebPartInformation;
}

this._customCollectionFieldType = CustomCollectionFieldType;
}

Expand Down Expand Up @@ -198,25 +207,25 @@ export class DetailsListLayout extends BaseLayout<IDetailsListLayoutProperties>
title: strings.Layouts.DetailsList.SortableColumnLabel,
type: this._customCollectionFieldType.boolean,
defaultValue: false,
required: false
required: false
},
{
id: 'valueSorting',
title: strings.Layouts.DetailsList.ValueSortingColumnLabel,
type: this._customCollectionFieldType.custom,
onCustomRender: (field, _value, onUpdate, item, itemId, onCustomFieldValidation) => {
return React.createElement("div", { key: `${field.id}-${itemId}` },
React.createElement(AsyncCombo, {
allowFreeform: false,
availableOptions: sortableFields,
placeholder: !item.valueSorting && sortableFields.length > 0 ? strings.Layouts.DetailsList.ValueSortingColumnLabel : strings.Layouts.DetailsList.ValueSortingColumnNoFieldsLabel,
textDisplayValue: item[field.id] ? item[field.id] : '',
defaultSelectedKey: item[field.id] ? item[field.id] : '',
disabled: !item.enableSorting,
onUpdate: (filterValue: IComboBoxOption) => {
onUpdate(field.id, filterValue.key);
}
} as IAsyncComboProps));
React.createElement(AsyncCombo, {
allowFreeform: false,
availableOptions: sortableFields,
placeholder: !item.valueSorting && sortableFields.length > 0 ? strings.Layouts.DetailsList.ValueSortingColumnLabel : strings.Layouts.DetailsList.ValueSortingColumnNoFieldsLabel,
textDisplayValue: item[field.id] ? item[field.id] : '',
defaultSelectedKey: item[field.id] ? item[field.id] : '',
disabled: !item.enableSorting,
onUpdate: (filterValue: IComboBoxOption) => {
onUpdate(field.id, filterValue.key);
}
} as IAsyncComboProps));
}
},
{
Expand Down Expand Up @@ -277,12 +286,15 @@ export class DetailsListLayout extends BaseLayout<IDetailsListLayoutProperties>

// Grouping options
if (this.properties.enableGrouping) {

propertyPaneFields.push(
PropertyPaneDropdown('layoutProperties.groupByField', {
label: strings.Layouts.DetailsList.GroupByFieldLabel,
options: availableOptions,
selectedKey: this.properties.groupByField
selectedKey: this.properties.groupByField,
}),
this._propertyPaneWebPartInformation({
description: `<small>${strings.Layouts.DetailsList.GroupingDescription}</small>`,
key: 'queryText'
}),
PropertyPaneToggle('layoutProperties.groupsCollapsed', {
label: strings.Layouts.DetailsList.CollapsedGroupsByDefault,
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/commonStrings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ declare interface ICommonStrings {
ValueSortingColumnNoFieldsLabel: string;
FileExtensionFieldLabel: string;
GroupByFieldLabel: string;
GroupingDescription: string;
EnableGrouping: string;
CollapsedGroupsByDefault: string;
ResetFieldsBtnLabel: string;
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/da-dk.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ define([], function() {
FileExtensionFieldLabel: "Felt til brug af file extension",
GroupByFieldLabel: "Gruppér efter felt",
EnableGrouping: "Aktivér gruppering",
GroupingDescription: "Sørg for, at du har data vist i resultatwebdelen for at få vist en liste over egenskaber.",
CollapsedGroupsByDefault: "Vis collapsed",
ResetFieldsBtnLabel: "Nulstil felter til standardværdier"
},
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/de-de.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ define([], function() {
FileExtensionFieldLabel: "Zu verwendendes Feld für die Dateierweiterung",
GroupByFieldLabel: "Gruppierung nach Feld",
EnableGrouping: "Gruppierung aktivieren",
GroupingDescription: "Stellen Sie sicher, dass im Ergebnis-Webpart Daten angezeigt werden, damit eine Liste der anzuzeigenden Eigenschaften angezeigt wird.",
CollapsedGroupsByDefault: "Eingeklappt anzeigen",
ResetFieldsBtnLabel: "Felder auf Standardwerte zurücksetzen"
},
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/en-us.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ define([], function() {
FileExtensionFieldLabel: "Field to use for file extension",
GroupByFieldLabel: "Group by field",
EnableGrouping: "Enable grouping",
GroupingDescription: "Ensure you have data showing in the result web part for a list of properties to show.",
CollapsedGroupsByDefault: "Show collapsed",
ResetFieldsBtnLabel: "Reset fields to default values"
},
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/es-es.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ define([], function() {
FileExtensionFieldLabel: "Campo a utilizar para la extensión del archivo",
GroupByFieldLabel: "Agrupar por campo",
EnableGrouping: "Activar la agrupación",
GroupingDescription: "Asegúrese de tener datos que se muestren en el elemento web de resultados para que se muestre una lista de propiedades.",
CollapsedGroupsByDefault: "Mostrar colapsado",
ResetFieldsBtnLabel: "Restablecer los valores por defecto de los campos"
},
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/fi-fi.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ define([], function() {
FileExtensionFieldLabel: "Kenttä tiedostotyypin määrittämiseen",
GroupByFieldLabel: "Ryhmittele kentän mukaan",
EnableGrouping: "Salli ryhmittely",
GroupingDescription: "Varmista, että tulosten verkko-osassa on tietoja, jotta voit näyttää ominaisuusluettelon.",
CollapsedGroupsByDefault: "Näytä ryhmät tiivistettynä",
ResetFieldsBtnLabel: "Palauta kentät templaatin oletusarvoihin"
},
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/fr-fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ define([], function() {
FileExtensionFieldLabel: "Champ à utiliser pour l’extension de fichier",
GroupByFieldLabel: "Regrouper par champ",
EnableGrouping: "Permettre le regroupement",
GroupingDescription: "Assurez-vous que les données s'affichent dans le composant WebPart de résultat pour obtenir une liste des propriétés à afficher.",
CollapsedGroupsByDefault: "Afficher les groupes réduits",
ResetFieldsBtnLabel: "Rétablir la valeur par défaut dans les champs"
},
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/nb-no.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ define([], function () {
FileExtensionFieldLabel: "Felt för filendelse",
GroupByFieldLabel: "Grupper etter felt",
EnableGrouping: "Aktiver gruppering",
GroupingDescription: "Sørg for at du har data som vises i resultatwebdelen for å vise en liste over egenskaper.",
CollapsedGroupsByDefault: "Vis kollapsede",
ResetFieldsBtnLabel: "Bruk standardverdiene"
},
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/nl-nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ define([], function() {
FileExtensionFieldLabel: "Te gebruiken veld voor bestandsextensie",
GroupByFieldLabel: "Groepeer op veld",
EnableGrouping: "Groeperen inschakelen",
GroupingDescription: "Zorg ervoor dat er gegevens worden weergegeven in het resultaatwebonderdeel voor een lijst met eigenschappen die moeten worden weergegeven.",
CollapsedGroupsByDefault: "Toon ingeklapt",
ResetFieldsBtnLabel: "Reset velden naar standaard waarden"
},
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/pl-pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ define([], function() {
FileExtensionFieldLabel: "Pole używane dla rozszerzenia pliku",
GroupByFieldLabel: "Grupuj po polu",
EnableGrouping: "Grupowanie włączone",
GroupingDescription: "Upewnij się, że dane są wyświetlane w wynikowym składniku Web Part, aby wyświetlić listę właściwości.",
CollapsedGroupsByDefault: "Pokaż zapadnięte",
ResetFieldsBtnLabel: "Resetuj pola do wartości domyślnych"
},
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/pt-br.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ define([], function() {
FileExtensionFieldLabel: "Campo usado para a extensão do arquivo",
GroupByFieldLabel: "Agrupar pelo campo",
EnableGrouping: "Ativar agrupamento",
GroupingDescription: "Certifique-se de que os dados sejam exibidos na Web Part de resultado para uma lista de propriedades a serem exibidas.",
CollapsedGroupsByDefault: "Mostrar recolhido",
ResetFieldsBtnLabel: "Redefinir campos para os valores padrão"
},
Expand Down
1 change: 1 addition & 0 deletions search-parts/src/loc/sv-SE.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ define([], function () {
FileExtensionFieldLabel: "Fält för användning av filtillägg",
GroupByFieldLabel: "Gruppera efter fält",
EnableGrouping: "Aktivera gruppering",
GroupingDescription: "Se till att du har data som visas i resultatwebbdelen för en lista över egenskaper att visa.",
CollapsedGroupsByDefault: "Visa kollapsade",
ResetFieldsBtnLabel: "Återställ fält till standardvärden"
},
Expand Down

0 comments on commit 416c1ad

Please sign in to comment.