@evergis/react 4.0.76 → 4.0.79

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Everpoint
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Everpoint
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # @evergis/react
2
-
3
- В данном репозитории находятся специфичные (в отличии от `@evergis/uilib-gl`) для `Evergis Online`,
4
- но в целом переиспользуемые на других проектах, построенных на Evergis API, React-компоненты.
5
-
6
- ***ВАЖНО!!!***: Разрабатываемые компоненты не должны иметь зависимостей
7
- от системы поддержки мультиязычности `Evergis Online`!
1
+ # @evergis/react
2
+
3
+ В данном репозитории находятся специфичные (в отличии от `@evergis/uilib-gl`) для `Evergis Online`,
4
+ но в целом переиспользуемые на других проектах, построенных на Evergis API, React-компоненты.
5
+
6
+ ***ВАЖНО!!!***: Разрабатываемые компоненты не должны иметь зависимостей
7
+ от системы поддержки мультиязычности `Evergis Online`!
@@ -18,4 +18,6 @@ export declare const useTreeFilter: (type: WidgetType, filter: ConfigContainerCh
18
18
  onClose: () => void;
19
19
  onToggleSelect: (item: any) => void;
20
20
  onReset: () => void;
21
+ onSave: () => void;
22
+ dirty: boolean;
21
23
  };
@@ -7,5 +7,6 @@ export declare const useTreeFilterData: (type: WidgetType, filterName: string) =
7
7
  loadLevelOne: () => Promise<TreeItemProps[]>;
8
8
  loadChildren: (item: TreeItemProps) => Promise<PartialLoadData<TreeNodeData>>;
9
9
  searchNodes: (query: string) => Promise<TreeItemProps[]>;
10
- loadByIds: (ids: TreeId[]) => Promise<TreeItemProps[]>;
10
+ loadByNames: (names: TreeId[]) => Promise<TreeItemProps[]>;
11
+ loadByValues: (values: TreeId[]) => Promise<TreeItemProps[]>;
11
12
  };
@@ -1,9 +1,9 @@
1
1
  import { TreeId, TreeItemProps } from '@evergis/uilib-gl';
2
2
  type UseTreeFilterSearchParams = {
3
3
  searchNodes: (query: string) => Promise<TreeItemProps[]>;
4
- loadByIds: (ids: TreeId[]) => Promise<TreeItemProps[]>;
4
+ loadByNames: (names: TreeId[]) => Promise<TreeItemProps[]>;
5
5
  };
6
- export declare const useTreeFilterSearch: ({ searchNodes, loadByIds }: UseTreeFilterSearchParams) => {
6
+ export declare const useTreeFilterSearch: ({ searchNodes, loadByNames }: UseTreeFilterSearchParams) => {
7
7
  searchValue: string;
8
8
  isSearchActive: boolean;
9
9
  searching: boolean;
@@ -4,6 +4,8 @@ export declare const useTreeFilterSelection: (type: WidgetType, filterName: stri
4
4
  selected: Map<TreeId, number>;
5
5
  selectedIds: Set<TreeId>;
6
6
  selectedLabel: string;
7
+ dirty: boolean;
7
8
  onToggleSelect: (item: TreeItemProps, multiSelect?: boolean) => void;
8
9
  onReset: () => void;
10
+ onSave: () => void;
9
11
  };
@@ -2,9 +2,10 @@ import { TreeId, TreeItemProps } from '@evergis/uilib-gl';
2
2
  type UseTreeFilterTreeParams = {
3
3
  selected: Map<TreeId, number>;
4
4
  loadLevelOne: () => Promise<TreeItemProps[]>;
5
- loadByIds: (ids: TreeId[]) => Promise<TreeItemProps[]>;
5
+ loadByValues: (values: TreeId[]) => Promise<TreeItemProps[]>;
6
+ loadByNames: (names: TreeId[]) => Promise<TreeItemProps[]>;
6
7
  };
7
- export declare const useTreeFilterTree: ({ selected, loadLevelOne, loadByIds }: UseTreeFilterTreeParams) => {
8
+ export declare const useTreeFilterTree: ({ selected, loadLevelOne, loadByValues, loadByNames }: UseTreeFilterTreeParams) => {
8
9
  treeData: TreeItemProps[];
9
10
  setTreeData: import('react').Dispatch<import('react').SetStateAction<TreeItemProps[]>>;
10
11
  treeExpanded: TreeId[];
@@ -6,9 +6,14 @@ export type FilterOption = {
6
6
  min: string | number;
7
7
  max: string | number;
8
8
  };
9
- /** Доменные данные узла иерархического фильтра "tree", хранятся в `TreeItemProps.data`. */
9
+ /**
10
+ * Доменные данные узла иерархического фильтра "tree", хранятся в `TreeItemProps.data`.
11
+ * `name`/`parentName` — служебная связь дерева (по `attributeName`/`attributeParentName`);
12
+ * идентичность/значение узла лежит в `TreeItemProps.id` (по `attributeValue`).
13
+ */
10
14
  export type TreeNodeData = {
11
- parentId: TreeId | null;
15
+ name: TreeId;
16
+ parentName: TreeId | null;
12
17
  level: number;
13
18
  };
14
19
  export type WidgetFilterProps = {
@@ -1,9 +1,12 @@
1
1
  import { TreeId, TreeItemProps } from '@evergis/uilib-gl';
2
2
  import { TreeFilterValue } from '../../../types';
3
3
  export declare const buildLevelOneCondition: (attributeLevel: string) => string;
4
- export declare const buildChildrenCondition: (attributeParentValue: string, parentId: TreeId) => string;
4
+ export declare const buildChildrenCondition: (attributeParentName: string, parentName: TreeId) => string;
5
5
  export declare const buildSearchCondition: (attributeAlias: string, query: string) => string;
6
- export declare const buildIdsCondition: (attributeValue: string, ids: Array<string | number>) => string;
6
+ /** Запрос пачки записей по их именам (`attributeName`) для достройки предков. */
7
+ export declare const buildNamesCondition: (attributeName: string, names: Array<string | number>) => string;
8
+ /** Запрос пачки записей по их значениям (`attributeValue`) — для восстановления `defaultValue`. */
9
+ export declare const buildValuesCondition: (attributeValue: string, values: Array<string | number>) => string;
7
10
  /** Группирует выбранные id по уровню в объектное значение фильтра `{ l{N}: [ids] }`. */
8
11
  export declare const buildFilterValue: (selected: Map<TreeId, number>) => TreeFilterValue;
9
12
  /** Разбирает объектное значение фильтра в карту `id → level`. */
@@ -11,13 +14,15 @@ export declare const parseFilterValue: (value?: TreeFilterValue) => Map<TreeId,
11
14
  /** Стабильная сериализация выбора для сравнения (порядок не важен). */
12
15
  export declare const serializeSelection: (selected: Map<TreeId, number>) => string;
13
16
  /**
14
- * Дозапрашивает цепочку предков вверх по `parentId` уровень за уровнем (батч `id in (...)`),
15
- * пока не достигнет уровня 1. Возвращает исходные узлы вместе с предками.
17
+ * Дозапрашивает цепочку предков вверх по `parentName` уровень за уровнем (батч `attributeName in
18
+ * (...)`), пока не достигнет уровня 1. Связь идёт по именам (`name`/`parentName`), т.к. `node.id`
19
+ * хранит значение (`attributeValue`). Возвращает исходные узлы вместе с предками.
16
20
  */
17
- export declare const collectAncestors: (nodes: TreeItemProps[], loadByIds: (ids: TreeId[]) => Promise<TreeItemProps[]>) => Promise<TreeItemProps[]>;
21
+ export declare const collectAncestors: (nodes: TreeItemProps[], loadByNames: (names: TreeId[]) => Promise<TreeItemProps[]>) => Promise<TreeItemProps[]>;
18
22
  /**
19
- * Собирает плоский набор узлов в дерево по `parentId`. Узлы с подгруженными потомками
20
- * раскрываются; листья-папки без потомков получают `children = null` (ленивая подгрузка).
23
+ * Собирает плоский набор узлов в дерево по связи `parentName` ↔ `name`. Узлы с подгруженными
24
+ * потомками раскрываются (`expanded` хранит `node.id` = значение); листья-папки без потомков
25
+ * получают `children = null` (ленивая подгрузка).
21
26
  */
22
27
  export declare const assembleTree: (nodes: TreeItemProps[]) => {
23
28
  roots: TreeItemProps[];
@@ -326,11 +326,18 @@ export interface ConfigFilter {
326
326
  relatedDataSource?: string;
327
327
  defaultValue?: SelectedFilter["value"];
328
328
  attributeAlias?: string;
329
+ /**
330
+ * Атрибут хранимого значения фильтра — то, что фильтр отдаёт потребителям (плейсхолдеры
331
+ * `%name`, для "tree" — `%name.lN`). Для "tree" служит ещё и идентичностью узла дерева
332
+ * (`TreeItemProps.id`). Если не задан — фолбэк на {@link ConfigFilter.attributeName}.
333
+ */
329
334
  attributeValue?: string;
330
335
  attributeMin?: string;
331
336
  attributeMax?: string;
332
- /** Атрибут id родителя для иерархического фильтра "tree". */
333
- attributeParentValue?: string;
337
+ /** Атрибут-имя записислужебная связь дерева (`child.attributeParentName == parent.attributeName`); для "tree". */
338
+ attributeName?: string;
339
+ /** Атрибут-имя родителя — служебная связь дерева; для "tree". */
340
+ attributeParentName?: string;
334
341
  /** Атрибут числового уровня (корень = 1) — для "tree". */
335
342
  attributeLevel?: string;
336
343
  /** Атрибут-флаг наличия детей (показ шеврона) — для "tree". */