diff --git a/adminforth/commands/createCustomComponent/main.js b/adminforth/commands/createCustomComponent/main.js index e9236bf2..33954693 100644 --- a/adminforth/commands/createCustomComponent/main.js +++ b/adminforth/commands/createCustomComponent/main.js @@ -50,6 +50,7 @@ async function handleFieldComponentCreation(config, resources) { { name: '📃 show', value: 'show' }, { name: '✏️ edit', value: 'edit' }, { name: '➕ create', value: 'create' }, + { name: '🔍 filter', value: 'filter'}, new Separator(), { name: '🔙 BACK', value: '__BACK__' }, ] diff --git a/adminforth/commands/createCustomComponent/templates/customFields/filter.vue.hbs b/adminforth/commands/createCustomComponent/templates/customFields/filter.vue.hbs new file mode 100644 index 00000000..9a2876be --- /dev/null +++ b/adminforth/commands/createCustomComponent/templates/customFields/filter.vue.hbs @@ -0,0 +1,34 @@ + + + \ No newline at end of file diff --git a/adminforth/documentation/docs/tutorial/03-Customization/02-customFieldRendering.md b/adminforth/documentation/docs/tutorial/03-Customization/02-customFieldRendering.md index 96d04a6b..222aa99c 100644 --- a/adminforth/documentation/docs/tutorial/03-Customization/02-customFieldRendering.md +++ b/adminforth/documentation/docs/tutorial/03-Customization/02-customFieldRendering.md @@ -481,4 +481,119 @@ list: '@/renderers/ZeroStylesRichText.vue', //diff-add ``` -`ZeroStyleRichText` fits well for tasks like email templates preview fields. \ No newline at end of file +`ZeroStyleRichText` fits well for tasks like email templates preview fields. + + +### Custom filter component for square meters + + +Sometimes standard filters are not enough, and you want to make a convenient UI for selecting a range of apartment areas. For example, buttons with options for “Small (<25 m²)”, “Medium (25–90 m²)” and “Large (>90 m²)”. + +```ts title='./custom/SquareMetersFilter.vue' + + + +``` + +```ts title='./resources/apartments.ts' + columns: [ + ... + { + name: 'square_meter', + label: 'Square', + //diff-add + components: { + //diff-add + filter: '@@/SquareMetersFilter.vue' + //diff-add + } + }, + ... +] \ No newline at end of file diff --git a/adminforth/spa/src/components/Filters.vue b/adminforth/spa/src/components/Filters.vue index e6442f1a..7eb43541 100644 --- a/adminforth/spa/src/components/Filters.vue +++ b/adminforth/spa/src/components/Filters.vue @@ -21,9 +21,25 @@