diff --git a/backend/i18n/frontend_en.json b/backend/i18n/frontend_en.json
index 1eea7677e..4aac7c528 100644
--- a/backend/i18n/frontend_en.json
+++ b/backend/i18n/frontend_en.json
@@ -913,6 +913,8 @@
"schemas.fieldTypes.references.countMin": "Min Items",
"schemas.fieldTypes.references.description": "Links to other content items.",
"schemas.fieldTypes.references.mustBePublished": "Only take published references into account when validating.",
+ "schemas.fieldTypes.references.query": "Initial Query",
+ "schemas.fieldTypes.references.queryHint": "The initial query that is used in the UI to narrow down the results for the user. In Odata notation.",
"schemas.fieldTypes.references.resolve": "Resolve references",
"schemas.fieldTypes.references.resolveHint": "Show the name of the referenced item in content list when MaxItems is set to 1.",
"schemas.fieldTypes.string.characters": "Characters",
diff --git a/backend/i18n/frontend_fr.json b/backend/i18n/frontend_fr.json
index 94066370e..e3157ea0b 100644
--- a/backend/i18n/frontend_fr.json
+++ b/backend/i18n/frontend_fr.json
@@ -913,6 +913,8 @@
"schemas.fieldTypes.references.countMin": "Articles minimum",
"schemas.fieldTypes.references.description": "Liens vers d'autres éléments de contenu.",
"schemas.fieldTypes.references.mustBePublished": "Ne tenez compte que des références publiées lors de la validation.",
+ "schemas.fieldTypes.references.query": "Initial Query",
+ "schemas.fieldTypes.references.queryHint": "The initial query that is used in the UI to narrow down the results for the user. In Odata notation.",
"schemas.fieldTypes.references.resolve": "Résoudre les références",
"schemas.fieldTypes.references.resolveHint": "Afficher le nom de l'élément référencé dans la liste de contenu lorsque MaxItems est défini sur 1.",
"schemas.fieldTypes.string.characters": "Personnages",
diff --git a/backend/i18n/frontend_it.json b/backend/i18n/frontend_it.json
index fc054cebb..85bc51a75 100644
--- a/backend/i18n/frontend_it.json
+++ b/backend/i18n/frontend_it.json
@@ -913,6 +913,8 @@
"schemas.fieldTypes.references.countMin": "Numero Min Elementi",
"schemas.fieldTypes.references.description": "Link ad altri elementi del contenuto.",
"schemas.fieldTypes.references.mustBePublished": "I contenuti collegati devono essere pubblicati",
+ "schemas.fieldTypes.references.query": "Initial Query",
+ "schemas.fieldTypes.references.queryHint": "The initial query that is used in the UI to narrow down the results for the user. In Odata notation.",
"schemas.fieldTypes.references.resolve": "Resolve references",
"schemas.fieldTypes.references.resolveHint": "Mostra il nome dell'elemento collegato (riferimento) nella lista dei contenuti quando il numero massimo di elementi è impostato a 1.",
"schemas.fieldTypes.string.characters": "Caratteri",
diff --git a/backend/i18n/frontend_nl.json b/backend/i18n/frontend_nl.json
index 14a8d8749..cc0de5df4 100644
--- a/backend/i18n/frontend_nl.json
+++ b/backend/i18n/frontend_nl.json
@@ -913,6 +913,8 @@
"schemas.fieldTypes.references.countMin": "Min. items",
"schemas.fieldTypes.references.description": "Links naar andere inhoudsitems.",
"schemas.fieldTypes.references.mustBePublished": "Referenties moeten worden gepubliceerd",
+ "schemas.fieldTypes.references.query": "Initial Query",
+ "schemas.fieldTypes.references.queryHint": "The initial query that is used in the UI to narrow down the results for the user. In Odata notation.",
"schemas.fieldTypes.references.resolve": "Referenties tonen",
"schemas.fieldTypes.references.resolveHint": "Toon de naam van het item waarnaar wordt verwezen in de inhoudslijst wanneer MaxItems is ingesteld op 1.",
"schemas.fieldTypes.string.characters": "Karakters",
diff --git a/backend/i18n/frontend_pt.json b/backend/i18n/frontend_pt.json
index 288d6efb1..a64267211 100644
--- a/backend/i18n/frontend_pt.json
+++ b/backend/i18n/frontend_pt.json
@@ -913,6 +913,8 @@
"schemas.fieldTypes.references.countMin": "Min Itens",
"schemas.fieldTypes.references.description": "Links para outros itens de conteúdo.",
"schemas.fieldTypes.references.mustBePublished": "Só ter em conta as referências publicadas ao validar.",
+ "schemas.fieldTypes.references.query": "Initial Query",
+ "schemas.fieldTypes.references.queryHint": "The initial query that is used in the UI to narrow down the results for the user. In Odata notation.",
"schemas.fieldTypes.references.resolve": "Resolver referências",
"schemas.fieldTypes.references.resolveHint": "Mostre o nome do item referenciado na lista de conteúdos quando maxItems estiver definido para 1.",
"schemas.fieldTypes.string.characters": "Personagens",
diff --git a/backend/i18n/frontend_zh.json b/backend/i18n/frontend_zh.json
index 1949dfa56..46f2e076a 100644
--- a/backend/i18n/frontend_zh.json
+++ b/backend/i18n/frontend_zh.json
@@ -913,6 +913,8 @@
"schemas.fieldTypes.references.countMin": "最小项目",
"schemas.fieldTypes.references.description": "链接到其他内容项。",
"schemas.fieldTypes.references.mustBePublished": "必须发布参考文献",
+ "schemas.fieldTypes.references.query": "Initial Query",
+ "schemas.fieldTypes.references.queryHint": "The initial query that is used in the UI to narrow down the results for the user. In Odata notation.",
"schemas.fieldTypes.references.resolve": "Resolve references",
"schemas.fieldTypes.references.resolveHint": "当 MaxItems 设置为 1 时,在内容列表中显示引用项的名称。",
"schemas.fieldTypes.string.characters": "字符",
diff --git a/backend/i18n/source/frontend_en.json b/backend/i18n/source/frontend_en.json
index 1eea7677e..4aac7c528 100644
--- a/backend/i18n/source/frontend_en.json
+++ b/backend/i18n/source/frontend_en.json
@@ -913,6 +913,8 @@
"schemas.fieldTypes.references.countMin": "Min Items",
"schemas.fieldTypes.references.description": "Links to other content items.",
"schemas.fieldTypes.references.mustBePublished": "Only take published references into account when validating.",
+ "schemas.fieldTypes.references.query": "Initial Query",
+ "schemas.fieldTypes.references.queryHint": "The initial query that is used in the UI to narrow down the results for the user. In Odata notation.",
"schemas.fieldTypes.references.resolve": "Resolve references",
"schemas.fieldTypes.references.resolveHint": "Show the name of the referenced item in content list when MaxItems is set to 1.",
"schemas.fieldTypes.string.characters": "Characters",
diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ReferencesFieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ReferencesFieldProperties.cs
index d0f72af6a..c38fbf9db 100644
--- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ReferencesFieldProperties.cs
+++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ReferencesFieldProperties.cs
@@ -26,6 +26,8 @@ public sealed record ReferencesFieldProperties : FieldProperties
public bool MustBePublished { get; init; }
+ public string? Query { get; init;}
+
public ReferencesFieldEditor Editor { get; init; }
public DomainId SchemaId
diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ReferencesFieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ReferencesFieldPropertiesDto.cs
index 8e54fe870..1fc6d02a7 100644
--- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ReferencesFieldPropertiesDto.cs
+++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/Fields/ReferencesFieldPropertiesDto.cs
@@ -51,6 +51,11 @@ public sealed class ReferencesFieldPropertiesDto : FieldPropertiesDto
///
public bool MustBePublished { get; set; }
+ ///
+ /// The initial query that is applied in the UI.
+ ///
+ public string? Query { get; init; }
+
///
/// The editor that is used to manage this field.
///
diff --git a/backend/src/Squidex/wwwroot/scripts/editor-sdk.d.ts b/backend/src/Squidex/wwwroot/scripts/editor-sdk.d.ts
index 51e76a843..0fdf0c11c 100644
--- a/backend/src/Squidex/wwwroot/scripts/editor-sdk.d.ts
+++ b/backend/src/Squidex/wwwroot/scripts/editor-sdk.d.ts
@@ -12,14 +12,14 @@ declare class EditorPlugin {
/**
* Register an function that is called when the sidebar is initialized.
*
- * @param {Function} callback: The callback to invoke.
+ * @param {function} callback: The callback to invoke.
*/
onInit(callback: () => void): void;
/**
* Register an function that is called whenever the value of the content has changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Content value (any).
+ * @param {function} callback: The callback to invoke. Argument 1: Content value (any).
*/
onContentChanged(callback: (content: any) => void): void;
@@ -133,62 +133,63 @@ declare class SquidexFormField {
*
* @param {string} schemas: The list of schema names.
* @param {function} callback The callback to invoke when the dialog is completed or closed.
+ * @param {string} query: The initial query that is used in the UI.
*/
- pickContents(schemas: string[], callback: (assets: any[]) => void): void;
+ pickContents(schemas: string[], callback: (assets: any[]) => void, query?: string): void;
/**
* Register an function that is called when the field is initialized.
*
- * @param {Function} callback: The callback to invoke.
+ * @param {function} callback: The callback to invoke.
*/
onInit(callback: () => void): void;
/**
* Register an function that is called when the field is moved.
*
- * @param {Function} callback: The callback to invoke. Argument 1: New position (number).
+ * @param {function} callback: The callback to invoke. Argument 1: New position (number).
*/
onMoved(callback: (index: number) => void): void;
/**
* Register an function that is called whenever the field is disabled or enabled.
*
- * @param {Function} callback: The callback to invoke. Argument 1: New disabled state (boolean, disabled = true, enabled = false).
+ * @param {function} callback: The callback to invoke. Argument 1: New disabled state (boolean, disabled = true, enabled = false).
*/
onDisabled(callback: (isDisabled: boolean) => void): void;
/**
* Register an function that is called whenever the field language is changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Language code (string).
+ * @param {function} callback: The callback to invoke. Argument 1: Language code (string).
*/
onLanguageChanged(callback: (language: string) => void): void;
/**
* Register an function that is called whenever the value of the field has changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Field value (any).
+ * @param {function} callback: The callback to invoke. Argument 1: Field value (any).
*/
onValueChanged(callback: (value: any) => void): void;
/**
* Register an function that is called whenever the value of the content has changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Content value (any).
+ * @param {function} callback: The callback to invoke. Argument 1: Content value (any).
*/
onFormValueChanged(callback: (value: any) => void): void;
/**
* Register an function that is called whenever the fullscreen mode has changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Fullscreen state (boolean, fullscreen on = true, fullscreen off = false).
+ * @param {function} callback: The callback to invoke. Argument 1: Fullscreen state (boolean, fullscreen on = true, fullscreen off = false).
*/
onFullscreen(callback: (isFullscreen: boolean) => void): void;
/**
* Register an function that is called whenever the expanded mode has changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Expanded state (boolean, expanded on = true, expanded off = false).
+ * @param {function} callback: The callback to invoke. Argument 1: Expanded state (boolean, expanded on = true, expanded off = false).
*/
onExpanded(callback: (isExpanded: boolean) => void): void;
diff --git a/backend/src/Squidex/wwwroot/scripts/editor-sdk.js b/backend/src/Squidex/wwwroot/scripts/editor-sdk.js
index e0d131830..4c45b22e5 100644
--- a/backend/src/Squidex/wwwroot/scripts/editor-sdk.js
+++ b/backend/src/Squidex/wwwroot/scripts/editor-sdk.js
@@ -114,7 +114,7 @@ function SquidexPlugin() {
/**
* Register an function that is called when the sidebar is initialized.
*
- * @param {Function} callback: The callback to invoke.
+ * @param {function} callback: The callback to invoke.
*/
onInit: function (callback) {
if (!isFunction(callback)) {
@@ -129,7 +129,7 @@ function SquidexPlugin() {
/**
* Register an function that is called whenever the value of the content has changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Content value (any).
+ * @param {function} callback: The callback to invoke. Argument 1: Content value (any).
*/
onContentChanged: function (callback) {
if (!isFunction(callback)) {
@@ -491,8 +491,9 @@ function SquidexFormField() {
*
* @param {string} schemas: The list of schema names.
* @param {function} callback The callback to invoke when the dialog is completed or closed.
+ * @param {string} query: The initial filter that is used in the UI.
*/
- pickContents: function (schemas, callback) {
+ pickContents: function (schemas, callback, query) {
if (!isFunction(callback) || !isArrayOfStrings(schemas)) {
return;
}
@@ -501,18 +502,18 @@ function SquidexFormField() {
currentPickContents = {
correlationId: correlationId,
- callback: callback
+ callback: callback,
};
if (window.parent) {
- window.parent.postMessage({ type: 'pickContents', correlationId: correlationId, schemas: schemas }, '*');
+ window.parent.postMessage({ type: 'pickContents', correlationId: correlationId, schemas: schemas, query: query }, '*');
}
},
/**
* Register an function that is called when the field is initialized.
*
- * @param {Function} callback: The callback to invoke.
+ * @param {function} callback: The callback to invoke.
*/
onInit: function (callback) {
if (!isFunction(callback)) {
@@ -527,7 +528,7 @@ function SquidexFormField() {
/**
* Register an function that is called when the field is moved.
*
- * @param {Function} callback: The callback to invoke. Argument 1: New position (number).
+ * @param {function} callback: The callback to invoke. Argument 1: New position (number).
*/
onMoved: function (callback) {
if (!isFunction(callback)) {
@@ -542,7 +543,7 @@ function SquidexFormField() {
/**
* Register an function that is called whenever the field is disabled or enabled.
*
- * @param {Function} callback: The callback to invoke. Argument 1: New disabled state (boolean, disabled = true, enabled = false).
+ * @param {function} callback: The callback to invoke. Argument 1: New disabled state (boolean, disabled = true, enabled = false).
*/
onDisabled: function (callback) {
if (!isFunction(callback)) {
@@ -557,7 +558,7 @@ function SquidexFormField() {
/**
* Register an function that is called whenever the field language is changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Language code (string).
+ * @param {function} callback: The callback to invoke. Argument 1: Language code (string).
*/
onLanguageChanged: function (callback) {
if (!isFunction(callback)) {
@@ -572,7 +573,7 @@ function SquidexFormField() {
/**
* Register an function that is called whenever the value of the field has changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Field value (any).
+ * @param {function} callback: The callback to invoke. Argument 1: Field value (any).
*/
onValueChanged: function (callback) {
if (!isFunction(callback)) {
@@ -587,7 +588,7 @@ function SquidexFormField() {
/**
* Register an function that is called whenever the value of the content has changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Content value (any).
+ * @param {function} callback: The callback to invoke. Argument 1: Content value (any).
*/
onFormValueChanged: function (callback) {
if (!isFunction(callback)) {
@@ -602,7 +603,7 @@ function SquidexFormField() {
/**
* Register an function that is called whenever the fullscreen mode has changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Fullscreen state (boolean, fullscreen on = true, fullscreen off = false).
+ * @param {function} callback: The callback to invoke. Argument 1: Fullscreen state (boolean, fullscreen on = true, fullscreen off = false).
*/
onFullscreen: function (callback) {
if (!isFunction(callback)) {
@@ -617,7 +618,7 @@ function SquidexFormField() {
/**
* Register an function that is called whenever the expanded mode has changed.
*
- * @param {Function} callback: The callback to invoke. Argument 1: Expanded state (boolean, expanded on = true, expanded off = false).
+ * @param {function} callback: The callback to invoke. Argument 1: Expanded state (boolean, expanded on = true, expanded off = false).
*/
onExpanded: function (callback) {
if (!isFunction(callback)) {
diff --git a/frontend/src/app/features/content/shared/forms/field-editor.component.html b/frontend/src/app/features/content/shared/forms/field-editor.component.html
index 2dde0a018..c6031418d 100644
--- a/frontend/src/app/features/content/shared/forms/field-editor.component.html
+++ b/frontend/src/app/features/content/shared/forms/field-editor.component.html
@@ -137,6 +137,7 @@
[isExpanded]="isExpanded"
[language]="language"
[languages]="languages"
+ [query]="field.rawProperties.query"
[schemaIds]="field.rawProperties.schemaIds">
@@ -152,9 +153,10 @@
diff --git a/frontend/src/app/features/content/shared/forms/iframe-editor.component.html b/frontend/src/app/features/content/shared/forms/iframe-editor.component.html
index c40501411..5b04e60cb 100644
--- a/frontend/src/app/features/content/shared/forms/iframe-editor.component.html
+++ b/frontend/src/app/features/content/shared/forms/iframe-editor.component.html
@@ -10,6 +10,7 @@
diff --git a/frontend/src/app/features/content/shared/forms/iframe-editor.component.ts b/frontend/src/app/features/content/shared/forms/iframe-editor.component.ts
index e800ddf0d..3ad605c3d 100644
--- a/frontend/src/app/features/content/shared/forms/iframe-editor.component.ts
+++ b/frontend/src/app/features/content/shared/forms/iframe-editor.component.ts
@@ -78,6 +78,7 @@ export class IFrameEditorComponent extends StatefulComponent implements
public assetsCorrelationId: any;
public assetsDialog = new DialogModel();
+ public contentsQuery?: string = undefined;
public contentsCorrelationId: any;
public contentsSchemas?: string[];
public contentsDialog = new DialogModel();
@@ -207,9 +208,10 @@ export class IFrameEditorComponent extends StatefulComponent implements
this.assetsDialog.show();
}
} else if (type === 'pickContents') {
- const { correlationId, schemas } = event.data;
+ const { correlationId, schemas, query } = event.data;
if (correlationId) {
+ this.contentsQuery = query;
this.contentsCorrelationId = correlationId;
this.contentsSchemas = schemas;
this.contentsDialog.show();
diff --git a/frontend/src/app/features/content/shared/references/content-creator.component.html b/frontend/src/app/features/content/shared/references/content-creator.component.html
index 29ef52ece..978366d2b 100644
--- a/frontend/src/app/features/content/shared/references/content-creator.component.html
+++ b/frontend/src/app/features/content/shared/references/content-creator.component.html
@@ -1,10 +1,14 @@
-
+-
-
diff --git a/frontend/src/app/features/content/shared/references/references-editor.component.html b/frontend/src/app/features/content/shared/references/references-editor.component.html
index 559b73ef8..945667dda 100644
--- a/frontend/src/app/features/content/shared/references/references-editor.component.html
+++ b/frontend/src/app/features/content/shared/references/references-editor.component.html
@@ -52,5 +52,6 @@
[alreadySelected]="snapshot.contentItems"
[language]="language"
[languages]="languages"
+ [query]="query"
[schemaIds]="schemaIds">
\ No newline at end of file
diff --git a/frontend/src/app/features/content/shared/references/references-editor.component.ts b/frontend/src/app/features/content/shared/references/references-editor.component.ts
index 590ae40bf..31a1b902d 100644
--- a/frontend/src/app/features/content/shared/references/references-editor.component.ts
+++ b/frontend/src/app/features/content/shared/references/references-editor.component.ts
@@ -35,6 +35,9 @@ export class ReferencesEditorComponent extends StatefulControlComponent;
+ @Input({ required: true })
+ public query?: string;
+
@Input({ required: true })
public language!: AppLanguageDto;
diff --git a/frontend/src/app/features/schemas/pages/schema/fields/types/references-ui.component.html b/frontend/src/app/features/schemas/pages/schema/fields/types/references-ui.component.html
index 3361b2c2d..a69fad61c 100644
--- a/frontend/src/app/features/schemas/pages/schema/fields/types/references-ui.component.html
+++ b/frontend/src/app/features/schemas/pages/schema/fields/types/references-ui.component.html
@@ -27,4 +27,16 @@
+
+