@linagora/linid-im-front-corelib 0.0.71 → 0.0.73

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.
@@ -0,0 +1,13 @@
1
+ import type { RouteLocationNormalizedLoaded, Router } from 'vue-router';
2
+ import { LinidFilter } from '../filters/linidFilter';
3
+ /**
4
+ * Composable that synchronizes a list of LinID filters with the query
5
+ * params of the current URL.
6
+ * @param router - Vue router instance, used to update the URL.
7
+ * @param route - Current normalized route, used to read query params.
8
+ * @returns An object exposing `setFiltersInUrl` and `getFiltersFromUrl`.
9
+ */
10
+ export declare function useLinidFilterUrl(router: Router, route: RouteLocationNormalizedLoaded): {
11
+ setFiltersInUrl: (filters: LinidFilter[], keeps: string[]) => void;
12
+ getFiltersFromUrl: (filters: LinidFilter[]) => LinidFilter[];
13
+ };
@@ -0,0 +1,60 @@
1
+ import { type LinidFilterType } from '../types/linidFilter';
2
+ import { LinidFilterValue } from './linidFilterValue';
3
+ /**
4
+ * Represents a filter that can be applied to a list of entities.
5
+ * The generic parameter `T` allows consumers to define their own options structure
6
+ * for maximum flexibility.
7
+ * @template T - The type of options, defaults to Record<string, unknown>.
8
+ */
9
+ export declare class LinidFilter<T = Record<string, unknown>> {
10
+ /**
11
+ * Auto generated unique identifier of the filter.
12
+ */
13
+ id: string;
14
+ /**
15
+ * Identifier of the filter.
16
+ */
17
+ name: string;
18
+ /**
19
+ * Defines the filter category and expected behavior.
20
+ */
21
+ type: LinidFilterType;
22
+ /**
23
+ * Configuration object of the filter, defined by the consumer.
24
+ */
25
+ options: T;
26
+ /**
27
+ * List of applied filter values.
28
+ */
29
+ values: LinidFilterValue[];
30
+ /**
31
+ * Create a new filter.
32
+ * @param name - Identifier of the filter.
33
+ * @param type - Defines the filter category and expected behavior.
34
+ * @param options - Configuration object of the filter, defined by the consumer.
35
+ * @param values - List of applied filter values.
36
+ */
37
+ constructor(name: string, type: LinidFilterType, options: T, values: LinidFilterValue[]);
38
+ /**
39
+ * Parses a value expression (e.g. `paris|not_lk_lyon`, as produced by
40
+ * {@link LinidFilterValue.toString}) into a new {@link LinidFilter} instance. `input` is the
41
+ * bare value expression only — it never carries the `name=` query parameter prefix produced
42
+ * by {@link LinidFilter.toString}.
43
+ *
44
+ * `type` and `options` are not derivable from `input`, so the returned filter gets a
45
+ * placeholder `'text'` `type` and empty `options`; `id` is auto generated by the constructor,
46
+ * as for any `LinidFilter` instance. Callers that already track a `LinidFilter` definition
47
+ * should only use the parsed `values`.
48
+ * @param name - Identifier of the filter.
49
+ * @param input - The value expression, with values separated by `|`.
50
+ * @returns The parsed filter instance.
51
+ * @template T - The type of options, defaults to Record<string, unknown>.
52
+ */
53
+ static fromString<T = Record<string, unknown>>(name: string, input: string): LinidFilter<T>;
54
+ /**
55
+ * Reconstructs the filter as an HTTP query parameter value, ready to use with
56
+ * APIs powered by `spring-query-filter`.
57
+ * @returns The query parameter string representation of the filter, e.g. `paris|not_lk_lyon`.
58
+ */
59
+ toString(): string;
60
+ }
@@ -0,0 +1,38 @@
1
+ import { type LinidFilterOperator } from '../types/linidFilter';
2
+ /**
3
+ * Represents a single applied value of a `LinidFilter`, converted to a string expression
4
+ * combining an optional negation, a comparison operator and a raw value
5
+ * (e.g. `not_lk_paris`, `gt_18`, `paris`).
6
+ */
7
+ export declare class LinidFilterValue {
8
+ /**
9
+ * Whether the comparison must be negated.
10
+ */
11
+ isNegation: boolean;
12
+ /**
13
+ * The comparison operator applied to the value.
14
+ */
15
+ operator: LinidFilterOperator;
16
+ /**
17
+ * The raw filter value, with the negation marker and operator prefix stripped.
18
+ */
19
+ value: string;
20
+ /**
21
+ * Creates a new filter value.
22
+ * @param isNegation - Whether the comparison must be negated.
23
+ * @param operator - The comparison operator applied to the value.
24
+ * @param value - The raw filter value.
25
+ */
26
+ constructor(isNegation: boolean, operator: LinidFilterOperator, value: string);
27
+ /**
28
+ * Parses a filter value expression (e.g. `not_lk_paris`) into a {@link LinidFilterValue}.
29
+ * @param input - The filter value expression to parse.
30
+ * @returns The parsed filter value.
31
+ */
32
+ static fromString(input: string): LinidFilterValue;
33
+ /**
34
+ * Reconstructs the filter value expression from its negation, operator and value.
35
+ * @returns The filter value expression (e.g. `not_lk_paris`).
36
+ */
37
+ toString(): string;
38
+ }
@@ -11,6 +11,7 @@ export { useQuasarRules } from './composables/useQuasarRules';
11
11
  export { useScopedI18n } from './composables/useScopedI18n';
12
12
  export { useTree } from './composables/useTree';
13
13
  export { useUiDesign } from './composables/useUiDesign';
14
+ export { useLinidFilterUrl } from './composables/useLinidFilterUrl';
14
15
  export { useLinidConfigurationStore } from './stores/linidConfigurationStore';
15
16
  export { useLinidUiStore } from './stores/linidUiStore';
16
17
  export { useLinidUserStore } from './stores/linidUserStore';
@@ -27,6 +28,9 @@ export { deepEqual, deepEqualUnordered, fromDot, isObject, merge, renameKeys, }
27
28
  export { getPiniaStore, setPiniaStore } from './services/piniaStoreService';
28
29
  export { getUiDesign, setUiDesign } from './services/uiDesignService';
29
30
  export { uiEventSubject } from './services/uiEventService';
31
+ export { LinidFilter } from './filters/linidFilter';
32
+ export { LinidFilterValue } from './filters/linidFilterValue';
33
+ export { LINID_FILTER_NEGATION_PREFIX, LINID_FILTER_OR_SEPARATOR, } from './types/linidFilter';
30
34
  export type { LinidZoneEntry } from './types/linidZone';
31
35
  export type { LinidRoute, LinidRoutes } from './types/linidRoute';
32
36
  export type { Page, Pagination, QTableRequestEvent, QuasarPagination, QueryFilter, } from './types/page';
@@ -44,3 +48,4 @@ export type { DialogEvent } from './types/dialogType';
44
48
  export type { LinidUser } from './types/linidUser';
45
49
  export type { TreeNode, TreeNodeType } from './types/linidTree';
46
50
  export type { DropdownClickPayload, MenuItem } from './types/dropdownButton';
51
+ export type { LinidFilterOperator, LinidFilterType } from './types/linidFilter';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Separator used between OR'd value expressions in a filter's string representation.
3
+ */
4
+ export declare const LINID_FILTER_OR_SEPARATOR = "|";
5
+ /**
6
+ * Prefix used to mark a filter value as negated.
7
+ */
8
+ export declare const LINID_FILTER_NEGATION_PREFIX = "not_";
9
+ /**
10
+ * Supported filter categories. Defines the filter behavior and the UI input used to edit it.
11
+ */
12
+ export type LinidFilterType = 'date' | 'text' | 'number' | 'list' | 'tree';
13
+ /**
14
+ * Supported comparison operators for a filter value.
15
+ * - `lk_` matches a "like / contains" comparison.
16
+ * - `` (empty string) matches a strict equality comparison.
17
+ * - `gt_` matches a "greater than" comparison.
18
+ * - `lt_` matches a "lower than" comparison.
19
+ */
20
+ export type LinidFilterOperator = 'lk_' | '' | 'gt_' | 'lt_';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linagora/linid-im-front-corelib",
3
- "version": "0.0.71",
3
+ "version": "0.0.73",
4
4
  "description": "Core library of the LinID Identity Manager project. Provides shared types, services, components, and utilities for front-end and plugin, enabling consistent integration across the LinID ecosystem.",
5
5
  "type": "module",
6
6
  "files": [
@@ -55,6 +55,7 @@
55
55
  "rxjs": "7.8.2",
56
56
  "vue": "3.5.30",
57
57
  "vue-i18n": "11.3.0",
58
+ "vue-router": "5.0.3",
58
59
  "interactjs": "1.10.27"
59
60
  },
60
61
  "devDependencies": {