mdt-client 31.3.43 → 31.3.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdt-client",
3
- "version": "31.3.43",
3
+ "version": "31.3.44",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,83 @@
1
+ import { RecordId } from "mdtScripts/common/Record";
2
+ import { AnyObject, ObjectId, URLString } from "mdtScripts/helpers/types";
3
+ export declare namespace ApiV1 {
4
+ namespace Request {
5
+ interface JobTask {
6
+ ObjectId?: number;
7
+ RecordId?: number;
8
+ RecordIds?: number[];
9
+ Args?: AnyObject;
10
+ /**
11
+ * Тип файла для экспорта результата выполнения задачи (например, "pdf", "docx", "txt").
12
+ * Определяет формат ответа сервера: если свойство указано, результат содержит URL для скачивания файла
13
+ */
14
+ File?: string;
15
+ }
16
+ namespace Job {
17
+ interface ExecProc {
18
+ process: RecordId;
19
+ }
20
+ interface ExecTask {
21
+ taskCode: string;
22
+ }
23
+ interface StopTask {
24
+ taskCode: string;
25
+ }
26
+ interface IsRunning {
27
+ taskCode: string;
28
+ }
29
+ }
30
+ }
31
+ namespace Response {
32
+ namespace Job {
33
+ export type ExecTask = FileExecutionResult | StoredProcExecutionResult | TextExecutionResult | EmptyExecutionResult;
34
+ interface FileExecutionResult {
35
+ Type: "File";
36
+ Url: URLString;
37
+ }
38
+ interface StoredProcExecutionResult {
39
+ Type: "StoredProc";
40
+ ID_ProcedureObject: ObjectId;
41
+ }
42
+ interface TextExecutionResult {
43
+ Type: "Text" | "Error";
44
+ Text: string;
45
+ Header: string;
46
+ }
47
+ interface EmptyExecutionResult {
48
+ Type: "Empty";
49
+ }
50
+ export {};
51
+ }
52
+ }
53
+ }
54
+ export declare namespace ApiV2 {
55
+ namespace Request {
56
+ type ExecProc = ApiV1.Request.Job.ExecProc;
57
+ type ExecTask = ApiV1.Request.Job.ExecTask;
58
+ type StopTask = ApiV1.Request.Job.StopTask;
59
+ type IsRunning = ApiV1.Request.Job.IsRunning;
60
+ }
61
+ namespace Response {
62
+ namespace Job {
63
+ export type ExecTask = FileExecutionResult | StoredProcExecutionResult | TextExecutionResult | EmptyExecutionResult;
64
+ interface FileExecutionResult {
65
+ type: "File";
66
+ url: URLString;
67
+ }
68
+ interface StoredProcExecutionResult {
69
+ type: "StoredProc";
70
+ id_ProcedureObject: ObjectId;
71
+ }
72
+ interface TextExecutionResult {
73
+ type: "Text";
74
+ text: string;
75
+ header: string;
76
+ }
77
+ interface EmptyExecutionResult {
78
+ type: "Empty";
79
+ }
80
+ export {};
81
+ }
82
+ }
83
+ }
@@ -4,5 +4,6 @@ import { IListComponentFacade } from "./IListComponentFacade";
4
4
  export interface IListCellFacade extends IListComponentFacade {
5
5
  col: ILayoutColumnBase & LayoutColumnValued;
6
6
  value(): any;
7
+ /** Заменить содержимое ячейки */
7
8
  setContent(content: ViewElement[]): void;
8
9
  }
@@ -51,6 +51,8 @@ export interface IListControlFacade extends ParentCtrl {
51
51
  /** Изменить значение отображаемое в колонке */
52
52
  setColumnValueHandler(codeOrPath: FieldCode | FieldPath, handler: (value: any, ctx: IColumnValueHandlerCtx) => ViewElement): any;
53
53
  addColumn<Control>(column: ColumnOptions<Control>): void;
54
+ /** Установить контрол для колонок, удовлетворяющих предикату */
55
+ setColumnControl(fn: (col: ILayoutColumnBase) => boolean, control: any): void;
54
56
  /**
55
57
  * Вызывается при отображении элемента списка
56
58
  */
@@ -1,19 +1,17 @@
1
1
  import { ViewControl } from "mdtScripts/helpers/types";
2
2
  import { ImportFormData, ImportUploadCtrlOptions, ImportPreviewCtrlOptions, MappingCtrlOptions, ImportDefaultValuesOptions } from "./importFormCtrl.types";
3
3
  export interface ImportModuleFacade {
4
- "mdt.import": {
5
- ImportForm: ImportFormFacade;
6
- ImportUploadCtrl: ImportUploadCtrlFacade;
7
- ImportPreviewCtrl: ImportPreviewCtrlFacade;
8
- ImportMappingCtrl: ImportMappingCtrlFacade;
9
- ImportDefaultValues: ImportDefaultValuesFacade;
10
- ImportService: ImportServiceFacade;
11
- utils: {
12
- prepareFieldCodes: (record: {
13
- [key: string]: any;
14
- }) => {
15
- [key: string]: any;
16
- };
4
+ ImportForm: ImportFormFacade;
5
+ ImportUploadCtrl: ImportUploadCtrlFacade;
6
+ ImportPreviewCtrl: ImportPreviewCtrlFacade;
7
+ ImportMappingCtrl: ImportMappingCtrlFacade;
8
+ ImportDefaultValues: ImportDefaultValuesFacade;
9
+ ImportService: ImportServiceFacade;
10
+ utils: {
11
+ prepareFieldCodes: (record: {
12
+ [key: string]: any;
13
+ }) => {
14
+ [key: string]: any;
17
15
  };
18
16
  };
19
17
  }
@@ -0,0 +1,24 @@
1
+ /// <reference types="../../../../mithril" />
2
+ import { Field } from "ics-ui-kit/dist/vendors/react-hook-form";
3
+ import { ApiV1, ApiV2 } from "mdtServices/api/ApiAccessor/job/jobApiTypes";
4
+ export interface JobModuleFacade {
5
+ /** Выполняет запрос на выполнение службы */
6
+ request: (taskCode: string, context?: JobContextFacade) => PromiseLike<JobExecutionResult>;
7
+ /**
8
+ * Выполняет запрос на выполнение службы и выполняет стандартную обработку результата в зависимости от типа
9
+ * - "Empty": отображение информационного сообщения
10
+ * - "File": скачивание файла
11
+ * - "StoredProc": выполнение хранимой процедуры
12
+ * - "Text": отображение текстового результата в модальном окне
13
+ * */
14
+ exec: (taskCode: string, context?: JobContextFacade) => PromiseLike<MPromise<JobExecutionResult>>;
15
+ }
16
+ type JobContextFacade = ApiV1.Request.JobTask & {
17
+ formContext?: ParentFormContextFacade;
18
+ };
19
+ type JobExecutionResult = ApiV2.Response.Job.ExecTask;
20
+ interface ParentFormContextFacade<FormType = any, FieldType = Field> {
21
+ parentForm?: FormType;
22
+ parentField?: FieldType;
23
+ }
24
+ export {};
@@ -1,4 +1,5 @@
1
1
  import type { ImportModuleFacade } from "./importModuleFacade";
2
+ import { JobModuleFacade } from "./jobFacade";
2
3
  import { StatusModuleFacade } from "./statusFacade";
3
4
  export interface InternalModulesFacade {
4
5
  /**
@@ -8,4 +9,8 @@ export interface InternalModulesFacade {
8
9
  */
9
10
  get<T extends keyof InternalModulesTypes>(moduleName: T): InternalModulesTypes[T];
10
11
  }
11
- export type InternalModulesTypes = ImportModuleFacade & StatusModuleFacade;
12
+ export type InternalModulesTypes = {
13
+ "mdt.import": ImportModuleFacade;
14
+ "mdt.status": StatusModuleFacade;
15
+ "mdt.job": JobModuleFacade;
16
+ };
@@ -1,9 +1,7 @@
1
1
  import { ObjectCode } from "../../../../helpers/types";
2
2
  import { RecordFacade } from "../record/IRecordFacade";
3
3
  export interface StatusModuleFacade {
4
- "mdt.status": {
5
- statusChangeHandler: (status: StatusCode, handler: ChangeStatusHandler) => void;
6
- };
4
+ statusChangeHandler: (status: StatusCode, handler: ChangeStatusHandler) => void;
7
5
  }
8
6
  export type ChangeStatusHandler = ({ record, object }: StatusChangeHandlerContext) => void | Promise<void>;
9
7
  export type StatusCode = string;
@@ -37,6 +37,7 @@ import * as tabs from "ics-ui-kit/dist/components/tabs";
37
37
  import * as tag from "ics-ui-kit/dist/components/tag";
38
38
  import * as textarea from "ics-ui-kit/dist/components/textarea";
39
39
  import * as toast from "ics-ui-kit/dist/components/toast";
40
+ import * as toggle from "ics-ui-kit/dist/components/toggle";
40
41
  import * as toggleGroup from "ics-ui-kit/dist/components/toggle-group";
41
42
  import * as toolbar from "ics-ui-kit/dist/components/toolbar";
42
43
  import * as tooltip from "ics-ui-kit/dist/components/tooltip";
@@ -93,6 +94,7 @@ export declare class UiKitFacade {
93
94
  readonly tag: typeof tag;
94
95
  readonly textarea: typeof textarea;
95
96
  readonly toast: typeof toast;
97
+ readonly toggle: typeof toggle;
96
98
  readonly "toggle-group": typeof toggleGroup;
97
99
  readonly tooltip: typeof tooltip;
98
100
  readonly toolbar: typeof toolbar;