origam 2.32.2 → 2.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,22 @@ This project follows [Semantic Versioning](https://semver.org).
|
|
|
18
18
|
|
|
19
19
|
## [Unreleased]
|
|
20
20
|
|
|
21
|
+
## [2.34.0] - 2026-10-19
|
|
22
|
+
|
|
23
|
+
### Added — `OrigamCommandPalette` : prop `filter` pour afficher des résultats classés en externe (#1184)
|
|
24
|
+
|
|
25
|
+
- Nouvelle prop `filter` : `true` (défaut, comportement inchangé : correspondance floue intégrée et tri par score), `false` (les `commands` sont affichées telles quelles, dans l'ordre fourni) ou une fonction `(commands, query) => commands` dont le résultat est affiché dans son ordre.
|
|
26
|
+
- Destinée à la recherche serveur ou plein texte alimentée par l'événement `query` : un résultat trouvé dans le corps d'un document n'est plus masqué parce que la requête n'est pas une sous-séquence de son libellé, et le classement du moteur est conservé.
|
|
27
|
+
- Avec `filter=false` ou une fonction, une liste `commands` vide reste vide : elle ne retombe plus sur le registre `useCommand()` (le repli est conservé avec `filter=true`).
|
|
28
|
+
|
|
29
|
+
## [2.33.0] - 2026-10-18
|
|
30
|
+
|
|
31
|
+
### Added — `OrigamCommandPalette` : icônes de recherche et de chargement personnalisables (#1183)
|
|
32
|
+
|
|
33
|
+
- Nouvelles props `searchIcon` et `loadingIcon`, typées `TIcon` (id mdi, chemin SVG ou composant). Défauts inchangés : `mdi:mdi-magnify` et `mdi:mdi-loading`.
|
|
34
|
+
- Nouveaux slots `search-icon` et `loading`, prioritaires sur les props.
|
|
35
|
+
- Une application qui fournit un SVG n'a plus besoin de la police `@mdi/font` pour ces deux glyphes : aucun élément `.mdi-magnify` / `.mdi-loading` n'est rendu (prouvé par `packages/tests/e2e/command-palette.spec.ts`).
|
|
36
|
+
|
|
21
37
|
## [2.32.2] - 2026-10-17
|
|
22
38
|
|
|
23
39
|
### Fixed — `OrigamBtn` : libellé collé en haut au lieu d'être centré (#1168)
|
|
@@ -25,12 +25,14 @@
|
|
|
25
25
|
tabindex="-1"
|
|
26
26
|
>
|
|
27
27
|
<div class="origam-command-palette__search">
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
<slot name="search-icon">
|
|
29
|
+
<origam-icon
|
|
30
|
+
:icon="searchIcon"
|
|
31
|
+
:size="20"
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
class="origam-command-palette__search-icon"
|
|
34
|
+
/>
|
|
35
|
+
</slot>
|
|
34
36
|
<input
|
|
35
37
|
:id="inputId"
|
|
36
38
|
ref="inputRef"
|
|
@@ -65,11 +67,13 @@
|
|
|
65
67
|
v-if="loading"
|
|
66
68
|
class="origam-command-palette__loading"
|
|
67
69
|
>
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
<slot name="loading">
|
|
71
|
+
<origam-icon
|
|
72
|
+
:icon="loadingIcon"
|
|
73
|
+
:size="20"
|
|
74
|
+
class="origam-command-palette__loading-icon"
|
|
75
|
+
/>
|
|
76
|
+
</slot>
|
|
73
77
|
</div>
|
|
74
78
|
|
|
75
79
|
<template
|
|
@@ -180,7 +184,6 @@ import { useTypography } from "../../composables/Commons/typography.composable";
|
|
|
180
184
|
import { useVModel } from "../../composables/Commons/vModel.composable";
|
|
181
185
|
import { COMMAND_PALETTE_DEFAULT_HOTKEY, COMMAND_PALETTE_DEFAULT_MAX_HEIGHT, COMMAND_PALETTE_DEFAULT_WIDTH } from "../../consts/CommandPalette/command-palette.const";
|
|
182
186
|
import { IN_BROWSER } from "../../consts/Commons/commons.const";
|
|
183
|
-
import { MDI_ICONS } from "../../enums/Commons/mdi.enum";
|
|
184
187
|
import { getUid } from "../../utils/Commons/getCurrentInstance.util";
|
|
185
188
|
import { fuzzyMatch } from "../../utils/CommandPalette/fuzzy-match.util";
|
|
186
189
|
defineOptions({ inheritAttrs: false });
|
|
@@ -188,11 +191,14 @@ const props = defineProps({
|
|
|
188
191
|
modelValue: { type: Boolean, required: false, default: false },
|
|
189
192
|
hotkey: { type: [Array, null], required: false, default: () => COMMAND_PALETTE_DEFAULT_HOTKEY },
|
|
190
193
|
commands: { type: Array, required: false },
|
|
194
|
+
filter: { type: [Boolean, Function], required: false, default: true },
|
|
191
195
|
placeholder: { type: String, required: false, default: "origam.command_palette.placeholder" },
|
|
192
196
|
emptyText: { type: String, required: false, default: "origam.command_palette.empty_text" },
|
|
193
197
|
maxHeight: { type: [Number, String], required: false, default: COMMAND_PALETTE_DEFAULT_MAX_HEIGHT },
|
|
194
198
|
width: { type: [Number, String], required: false, default: COMMAND_PALETTE_DEFAULT_WIDTH },
|
|
195
199
|
loading: { type: Boolean, required: false, default: false },
|
|
200
|
+
searchIcon: { type: null, required: false, default: "mdi:mdi-magnify" },
|
|
201
|
+
loadingIcon: { type: null, required: false, default: "mdi:mdi-loading" },
|
|
196
202
|
closeOnSelect: { type: Boolean, required: false, default: true },
|
|
197
203
|
closeOnEscape: { type: Boolean, required: false, default: true },
|
|
198
204
|
closeOnBackdrop: { type: Boolean, required: false, default: true },
|
|
@@ -255,11 +261,17 @@ if (IN_BROWSER) {
|
|
|
255
261
|
}, { immediate: true });
|
|
256
262
|
}
|
|
257
263
|
const sourceCommands = computed(() => {
|
|
258
|
-
if (props.commands && props.commands.length > 0) return props.commands;
|
|
264
|
+
if (props.commands && (props.commands.length > 0 || props.filter !== true)) return props.commands;
|
|
259
265
|
return registryCommands.value;
|
|
260
266
|
});
|
|
261
267
|
const query = ref("");
|
|
262
268
|
const filtered = computed(() => {
|
|
269
|
+
if (typeof props.filter === "function") {
|
|
270
|
+
return props.filter(sourceCommands.value, query.value).map((item) => ({ item, score: 0 }));
|
|
271
|
+
}
|
|
272
|
+
if (props.filter === false) {
|
|
273
|
+
return sourceCommands.value.map((item) => ({ item, score: 0 }));
|
|
274
|
+
}
|
|
263
275
|
return fuzzyMatch(sourceCommands.value, query.value, (cmd) => ({
|
|
264
276
|
label: cmd.label,
|
|
265
277
|
haystack: [
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ICommand } from './command.interface';
|
|
2
|
+
import type { TCommandPaletteFilter } from '../../types/CommandPalette/command-palette.type';
|
|
2
3
|
import type { IAttachProps } from '../Commons/attach.interface';
|
|
3
4
|
import type { ICommonsComponentProps } from '../Commons/commons.interface';
|
|
4
5
|
import type { ITypographyProps } from '../Commons/typography.interface';
|
|
6
|
+
import type { TIcon } from '../../types/Icon/icon.type';
|
|
5
7
|
/**
|
|
6
8
|
* A hotkey is either a single combination (`['meta', 'k']`) or an
|
|
7
9
|
* array of alternatives — every entry being a list of normalised key
|
|
@@ -26,6 +28,17 @@ export interface ICommandPaletteProps extends ICommonsComponentProps, Pick<ITypo
|
|
|
26
28
|
* registered via the `useCommand()` global registry instead.
|
|
27
29
|
*/
|
|
28
30
|
commands?: ReadonlyArray<ICommand>;
|
|
31
|
+
/*********************************************************
|
|
32
|
+
* filter (#1184)
|
|
33
|
+
*
|
|
34
|
+
* @description
|
|
35
|
+
* Comment `commands` est filtré selon la requête. `true` (défaut) : fuzzy match intégré, qui garde les sous-séquences et re-trie par score.
|
|
36
|
+
* @description
|
|
37
|
+
* `false` : `commands` affichées telles quelles, dans l'ordre fourni (liste déjà filtrée/classée par un serveur ou un moteur plein-texte, alimentée via l'event `query`).
|
|
38
|
+
* @description
|
|
39
|
+
* Fonction `(commands, query) => commands` : affiche ce qu'elle renvoie, dans son ordre. Dans les deux modes non défaut, la liste est plate (sans en-tête de groupe) tant que la requête est non vide, aucun match n'est surligné, et `commands` est honorée même vide (pas de repli sur le registre `useCommand()`).
|
|
40
|
+
********************************************************/
|
|
41
|
+
filter?: TCommandPaletteFilter;
|
|
29
42
|
/** Placeholder of the search input (already-translated string). */
|
|
30
43
|
placeholder?: string;
|
|
31
44
|
/** Empty-state message when no command matches the query. */
|
|
@@ -36,6 +49,8 @@ export interface ICommandPaletteProps extends ICommonsComponentProps, Pick<ITypo
|
|
|
36
49
|
width?: number | string;
|
|
37
50
|
/** Display a loader inside the result list (use during async fetches). */
|
|
38
51
|
loading?: boolean;
|
|
52
|
+
searchIcon?: TIcon;
|
|
53
|
+
loadingIcon?: TIcon;
|
|
39
54
|
/** Close the palette automatically when a command is selected. */
|
|
40
55
|
closeOnSelect?: boolean;
|
|
41
56
|
/** Close when the user presses Escape. */
|
|
@@ -55,5 +70,7 @@ export interface ICommandPaletteSlotProps {
|
|
|
55
70
|
export interface ICommandPaletteSlots {
|
|
56
71
|
item?: (props: ICommandPaletteSlotProps) => any;
|
|
57
72
|
empty?: () => any;
|
|
73
|
+
'search-icon'?: () => any;
|
|
74
|
+
loading?: () => any;
|
|
58
75
|
footer?: () => any;
|
|
59
76
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ICommand } from '../../interfaces/CommandPalette/command.interface';
|
|
1
2
|
import OrigamCommandPalette from '../../components/CommandPalette/OrigamCommandPalette.vue';
|
|
2
3
|
export type TOrigamCommandPalette = InstanceType<typeof OrigamCommandPalette>;
|
|
3
4
|
/**
|
|
@@ -5,3 +6,13 @@ export type TOrigamCommandPalette = InstanceType<typeof OrigamCommandPalette>;
|
|
|
5
6
|
* accepted by `useHotkey` (e.g. `['meta', 'k']`).
|
|
6
7
|
*/
|
|
7
8
|
export type TCommandPaletteHotkeyCombination = ReadonlyArray<string>;
|
|
9
|
+
/*********************************************************
|
|
10
|
+
* Filter de OrigamCommandPalette (#1184)
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* `TCommandPaletteFilterFn` : reçoit les commandes et la requête brute (non trimée), renvoie les commandes à afficher, dans l'ordre d'affichage.
|
|
14
|
+
* @description
|
|
15
|
+
* `TCommandPaletteFilter` (prop `filter`) : `true` = fuzzy match intégré (filtre par sous-séquence + tri par score), `false` = `commands` affichées telles quelles et dans l'ordre fourni, fonction = son résultat est affiché dans son ordre.
|
|
16
|
+
********************************************************/
|
|
17
|
+
export type TCommandPaletteFilterFn = (commands: ReadonlyArray<ICommand>, query: string) => ReadonlyArray<ICommand>;
|
|
18
|
+
export type TCommandPaletteFilter = boolean | TCommandPaletteFilterFn;
|