@evergis/react 4.0.65 → 4.0.67

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`!
@@ -10,8 +10,13 @@ export * from './useChartData';
10
10
  export * from './useDashboardHeader';
11
11
  export * from './useDataSources';
12
12
  export * from './useDiffPage';
13
+ export * from './useAfterSave';
14
+ export * from './useBeforeSave';
13
15
  export * from './useExpandableContainers';
14
16
  export * from './useExportPdf';
17
+ export * from './useFeatureSaveHooks';
18
+ export * from './useFeatureSaveHooks.utils';
19
+ export * from './useSavePrototypeBuilder';
15
20
  export * from './useWidgetFilters';
16
21
  export * from './useGetConfigLayer';
17
22
  export * from './useGlobalContext';
@@ -0,0 +1,3 @@
1
+ import { TaskPrototypeDto } from '@evergis/api';
2
+ import { ConfigRelatedResource, SaveHookInput } from '../types';
3
+ export declare const useAfterSave: (hook: ConfigRelatedResource | undefined, buildPrototype: (hook: ConfigRelatedResource, input: SaveHookInput) => TaskPrototypeDto) => (input: SaveHookInput) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ import { TaskPrototypeDto } from '@evergis/api';
2
+ import { ConfigRelatedResource, SaveHookInput } from '../types';
3
+ export declare const useBeforeSave: (hook: ConfigRelatedResource | undefined, buildPrototype: (hook: ConfigRelatedResource, input: SaveHookInput) => TaskPrototypeDto) => (input: SaveHookInput) => Promise<boolean>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Орchestrator-хук для серверных `beforeSave` / `afterSave` python-скриптов,
3
+ * описанных в `layerInfo.configuration.editConfiguration.options` слоя.
4
+ *
5
+ * - `runBeforeSave(input)` — `Promise<boolean>`, resolves `false` если
6
+ * серверная проверка не прошла; сохранение должно быть отменено.
7
+ * - `runAfterSave(input)` — fire-and-forget после успешного save.
8
+ *
9
+ * Активируется только если у потребителя в GlobalProvider переданы
10
+ * `api`, `notification` и `t`, а приложение обёрнуто в
11
+ * `<ServerNotificationsProvider>` (для SignalR-подписки на прогресс).
12
+ */
13
+ export declare const useFeatureSaveHooks: () => {
14
+ readonly runBeforeSave: (input: import('../types').SaveHookInput) => Promise<boolean>;
15
+ readonly runAfterSave: (input: import('../types').SaveHookInput) => Promise<void>;
16
+ };
@@ -0,0 +1,4 @@
1
+ import { ConfigRelatedResource } from '../types';
2
+ export declare const SAVE_HOOK_RESULT_DURATION = 4000;
3
+ export declare const isHookActive: (hook?: ConfigRelatedResource) => hook is ConfigRelatedResource;
4
+ export declare const createSaveNotificationId: () => string;
@@ -0,0 +1,3 @@
1
+ import { TaskPrototypeDto } from '@evergis/api';
2
+ import { ConfigRelatedResource, SaveHookInput } from '../types';
3
+ export declare const useSavePrototypeBuilder: () => (hook: ConfigRelatedResource, input: SaveHookInput) => TaskPrototypeDto;
@@ -59,6 +59,28 @@ export interface ConfigRelatedResource {
59
59
  fileName?: string;
60
60
  methodName?: string;
61
61
  }
62
+ /**
63
+ * Конфигурация `editConfiguration.options` слоя. Описывает серверные
64
+ * python-скрипты, выполняемые до и после сохранения объекта в FeatureCard.
65
+ *
66
+ * - `beforeSave` — синхронная серверная валидация перед сохранением.
67
+ * Save ждёт `Completed`; при `Error` сохранение отменяется.
68
+ * - `afterSave` — fire-and-forget действие после успешного сохранения.
69
+ *
70
+ * Используется хуком `useFeatureSaveHooks`.
71
+ */
72
+ export interface EditConfigurationOptions {
73
+ beforeSave?: ConfigRelatedResource;
74
+ afterSave?: ConfigRelatedResource;
75
+ }
76
+ /**
77
+ * Вход для `runBeforeSave` / `runAfterSave` хуков `useFeatureSaveHooks`.
78
+ * `featureId` равен `null` при создании нового объекта.
79
+ */
80
+ export interface SaveHookInput {
81
+ featureId: number | string | null;
82
+ changedProperties: Record<string, unknown>;
83
+ }
62
84
  export interface ConfigControl extends Pick<ConfigOptions, "relatedDataSource" | "minValue" | "maxValue" | "step" | "label" | "placeholder" | "width" | "variants"> {
63
85
  type: "dropdown" | "checkbox" | "chips" | "string";
64
86
  attributeName?: string;
@@ -1,4 +1,5 @@
1
1
  export * from './constants';
2
2
  export * from './usePythonTask';
3
3
  export * from './usePythonSandbox';
4
+ export * from './useRemoteTask';
4
5
  export * from './types';
@@ -0,0 +1,16 @@
1
+ import { RemoteTaskStatus, TaskPrototypeDto } from '@evergis/api';
2
+ export interface RemoteTaskUpdate {
3
+ status: RemoteTaskStatus;
4
+ log?: string;
5
+ }
6
+ export interface RemoteTaskResult {
7
+ taskId: string;
8
+ status: RemoteTaskStatus.Completed | RemoteTaskStatus.Error;
9
+ log?: string;
10
+ }
11
+ export interface UseRemoteTaskOptions {
12
+ onUpdate?: (update: RemoteTaskUpdate) => void;
13
+ }
14
+ export declare const useRemoteTask: ({ onUpdate }?: UseRemoteTaskOptions) => {
15
+ runTask: (prototype: TaskPrototypeDto) => Promise<RemoteTaskResult>;
16
+ };