mdt-client 1.0.21 → 1.0.24

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.
Files changed (34) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +2 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/tsconfig.tsbuildinfo +1228 -396
  5. package/package.json +1 -1
  6. package/types/common/Field.d.ts +2 -0
  7. package/types/common/Record.d.ts +1 -0
  8. package/types/common/Table.d.ts +2 -0
  9. package/types/components/icon/iconOptions.d.ts +16 -0
  10. package/types/components/popover/IPopoverBase.d.ts +14 -0
  11. package/types/components/tooltip/controllers/tooltipAttributes.d.ts +2 -0
  12. package/types/helpers/formatOptions.d.ts +1 -0
  13. package/types/helpers/formattedText.d.ts +8 -0
  14. package/types/helpers/types.d.ts +20 -0
  15. package/types/services/IFilter.d.ts +1 -5
  16. package/types/services/api/ApiRequestOptions.d.ts +1 -0
  17. package/types/services/api/Query.d.ts +1 -0
  18. package/types/services/customModules/facades/Form/IFieldControlManagerFacade.d.ts +1 -1
  19. package/types/services/customModules/facades/Form/IFormControlFacade.d.ts +4 -0
  20. package/types/services/customModules/facades/Form/IFormFacade.d.ts +1 -1
  21. package/types/services/customModules/facades/IAuthFacade.d.ts +2 -1
  22. package/types/services/customModules/facades/List/IListCellFacade.d.ts +6 -1
  23. package/types/services/customModules/facades/List/IListComponentFacade.d.ts +10 -0
  24. package/types/services/customModules/facades/List/IListControlFacade.d.ts +4 -0
  25. package/types/services/customModules/facades/List/IListRowFacade.d.ts +2 -12
  26. package/types/services/customModules/facades/utils/IUiComponentsFacade.d.ts +4 -0
  27. package/types/services/customModules/facades/utils/IUiFacade.d.ts +5 -2
  28. package/types/services/customModules/facades/utils/IUtilsFacade.d.ts +1 -1
  29. package/types/services/dropdown/IDropDownManager.d.ts +5 -0
  30. package/types/services/dropdown/IDropDownMenu.d.ts +22 -0
  31. package/types/views/controls/Control.d.ts +1 -2
  32. package/types/views/form/controls/monacoEditor/jsonSchemas/Button.schema.d.ts +5 -4
  33. package/types/views/list/IListView.d.ts +14 -9
  34. package/types/views/list/schema/ListPageOptions.schema.d.ts +23 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdt-client",
3
- "version": "1.0.21",
3
+ "version": "1.0.24",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,6 +23,8 @@ export interface Field extends Record {
23
23
  hasDefault?: boolean;
24
24
  extended?: boolean;
25
25
  isFixedLength?: boolean;
26
+ defaultValue?: string | number | boolean | Date;
27
+ formatMask?: string;
26
28
  refTable?: Table;
27
29
  readonly?: boolean;
28
30
  multiple?: boolean;
@@ -8,4 +8,5 @@ export interface Record {
8
8
  $dirty?: boolean;
9
9
  $destroy?: boolean;
10
10
  $params?: any;
11
+ [field: string]: any;
11
12
  }
@@ -29,4 +29,6 @@ export interface Table extends Record {
29
29
  hierarchyParentField?: string;
30
30
  hierarchyIDField?: string;
31
31
  flagHierarchy?: boolean;
32
+ $original?: Table;
33
+ $system?: boolean;
32
34
  }
@@ -0,0 +1,16 @@
1
+ /// <reference types="mithril" />
2
+ import { FormattedText } from "../../helpers/formattedText";
3
+ export interface IconOptions {
4
+ size?: "2xs" | "xs" | "sm" | "lg" | "xl" | "2xl" | "1x" | "2x" | "3x" | "4x" | "5x" | "6x" | "7x" | "8x" | "9x" | "10x";
5
+ fixedWidth?: boolean;
6
+ rotate?: "90" | "180" | "270";
7
+ flip?: "horizontal" | "vertical" | "both";
8
+ animate?: "spin" | "beat" | "fade" | "flash";
9
+ /** @deprecated */
10
+ attrs?: _mithril.MithrilAttributes;
11
+ title?: string;
12
+ tooltip?: FormattedText;
13
+ className?: string;
14
+ onmousedown?: () => void;
15
+ onclick?: (e?: MouseEvent) => void;
16
+ }
@@ -0,0 +1,14 @@
1
+ /// <reference types="mithril" />
2
+ import { Placement } from "@floating-ui/core";
3
+ export declare class IPopoverBase {
4
+ constructor(options?: PopoverBaseOptions);
5
+ target: HTMLElement;
6
+ bind(el: HTMLElement, ctx: any): void;
7
+ show(): void;
8
+ close(): void;
9
+ }
10
+ export interface PopoverBaseOptions {
11
+ onunload: () => void;
12
+ contentView?: () => _mithril.MithrilVirtualElement;
13
+ placement?: Placement;
14
+ }
@@ -0,0 +1,2 @@
1
+ export declare const DATA_TOOLTIP_ATTR = "data-tooltip";
2
+ export declare const DATA_TOOLTIP_MARKDOWN_ATTR = "data-tooltip-md";
@@ -2,4 +2,5 @@ export interface FormatOptions {
2
2
  type?: string;
3
3
  title?: string;
4
4
  empty?: string;
5
+ mask?: string;
5
6
  }
@@ -0,0 +1,8 @@
1
+ declare type FormattedTextType = "text" | "markdown";
2
+ export declare type FormattedText = string | {
3
+ text: string;
4
+ type: FormattedTextType;
5
+ };
6
+ export declare function getTooltipAttributeByType(text: FormattedText): "data-tooltip" | "data-tooltip-md";
7
+ export declare function getTextContent(text: FormattedText): string;
8
+ export {};
@@ -0,0 +1,20 @@
1
+ /// <reference types="mithril" />
2
+ export interface AnyObject {
3
+ [key: string]: any;
4
+ }
5
+ export declare type MithrilStyleAttribute = {
6
+ width?: CSSSizeUnit;
7
+ } & AnyObject;
8
+ declare type CSSSizeUnit = string;
9
+ export declare type NotifierType = "log" | "error" | "warn" | "info" | "success";
10
+ export interface NotifierOptions {
11
+ type?: NotifierType;
12
+ msg?: string;
13
+ icon?: string;
14
+ }
15
+ export interface Notifier {
16
+ notify(title: string, options?: NotifierOptions): void;
17
+ }
18
+ export declare type ViewElement = _mithril.MithrilVirtualElement | _mithril.MithrilVirtualElement[] | string;
19
+ export declare type CommandEvent = Event | _mithril.MithrilEvent;
20
+ export {};
@@ -73,9 +73,5 @@ export declare class Filter {
73
73
  static in(p1: any, ar: any): IFilterIn;
74
74
  static queryIn(field: any, table: any, subField: any, filter: any, args?: any): IFilterIn;
75
75
  static cast(filter: any, cast: any): IFilter;
76
- static equalTemplate(p1: any, p2: any): {
77
- op: string;
78
- p1: any;
79
- p2: any;
80
- };
76
+ static equalTemplate(p1: any, p2: any): IFilter;
81
77
  }
@@ -4,6 +4,7 @@ export interface ApiRequest {
4
4
  export interface ApiRequestOptions {
5
5
  req?: (x?: any) => ApiRequest;
6
6
  onerror?: (e: any) => boolean | void;
7
+ onRequestError?: () => void;
7
8
  camel?: boolean;
8
9
  multi?: boolean;
9
10
  method?: string;
@@ -25,6 +25,7 @@ export interface Query extends BaseQuery {
25
25
  parent?: Query;
26
26
  groups?: GroupQuery;
27
27
  disableDefaultSorting?: boolean;
28
+ pure?: boolean;
28
29
  audit?: string;
29
30
  workflow?: string;
30
31
  tag?: string;
@@ -2,7 +2,7 @@ import { IFieldControlFacade } from "./IFieldControlFacade";
2
2
  export interface MountContext<V> {
3
3
  /** Родительский DOM-элемент контрола */
4
4
  el: HTMLElement;
5
- /** Поле, к которому привязан контрол */
5
+ /** Поле, к которому привязан контрол */
6
6
  field: IFieldControlFacade<V>;
7
7
  /** Опции контрола */
8
8
  options: any;
@@ -40,4 +40,8 @@ export interface IFormControlFacade extends ParentCtrl {
40
40
  setControlOptions(findControl: (col: any) => boolean, controlOptions: any): any;
41
41
  /** Изменить свойства существующей кнопки */
42
42
  updateCommand(findCondition: () => boolean, command: Partial<ButtonFacade>): void;
43
+ /** Сохранить форму */
44
+ save(): void;
45
+ /** Открыть конструктор формы */
46
+ openDesigner(): void;
43
47
  }
@@ -3,7 +3,7 @@ import { IButton } from "../../../../views/form/controls/monacoEditor/jsonSchema
3
3
  import { RecordId } from "../utils/IApiFacade";
4
4
  import { IFormControlFacade } from "./IFormControlFacade";
5
5
  export declare type ActionButton = IButton & {
6
- /** Вспылвающая подсказка */
6
+ /** Всплывающая подсказка */
7
7
  description?: string | {
8
8
  (): string;
9
9
  };
@@ -1,5 +1,6 @@
1
- import { MithrilControl } from "./utils/IUiFacade";
1
+ import { IType, MithrilControl } from "./utils/IUiFacade";
2
2
  export interface IAuthFacade {
3
3
  disableFormsProvider(): void;
4
+ disableProvider(control: IType<MithrilControl>): void;
4
5
  registerControl(control: MithrilControl): void;
5
6
  }
@@ -1,3 +1,8 @@
1
- import { IListComponentFacade } from "./IListRowFacade";
1
+ import { ViewElement } from "../../../../helpers/types";
2
+ import { ILayoutColumnBase } from "../../../../views/list/IListView";
3
+ import { IListComponentFacade } from "./IListComponentFacade";
2
4
  export interface IListCellFacade extends IListComponentFacade {
5
+ col: ILayoutColumnBase;
6
+ value(): any;
7
+ setContent(content: ViewElement[]): void;
3
8
  }
@@ -0,0 +1,10 @@
1
+ import { IListControlFacade } from "./IListControlFacade";
2
+ export interface IListComponentFacade {
3
+ record: any;
4
+ list: IListControlFacade;
5
+ addClass(className: string): void;
6
+ hasClass(className: string): boolean;
7
+ removeClass(className: string): void;
8
+ addStyle(prop: string, value: string): void;
9
+ config(config: Function, before?: boolean): void;
10
+ }
@@ -34,4 +34,8 @@ export interface IListControlFacade extends ParentCtrl {
34
34
  setExtOptions(extOptions: any): void;
35
35
  /** Изменить свойства существующей кнопки */
36
36
  updateCommand(findCondition: () => boolean, command: Partial<ButtonFacade>): void;
37
+ /** Открыть форму добавления записи */
38
+ openNewRecordForm(): void;
39
+ /** Удалить выделенные строки */
40
+ removeSelectedRows(): void;
37
41
  }
@@ -1,12 +1,2 @@
1
- import { IListControlFacade } from "./IListControlFacade";
2
- export interface IListComponentFacade {
3
- record: any;
4
- list: IListControlFacade;
5
- addClass(className: string): void;
6
- hasClass(className: string): boolean;
7
- removeClass(className: string): void;
8
- addStyle(prop: string, value: string): void;
9
- config(config: Function, before?: boolean): void;
10
- }
11
- export interface IListRowFacade extends IListComponentFacade {
12
- }
1
+ import { IListComponentFacade } from "./IListComponentFacade";
2
+ export declare type IListRowFacade = IListComponentFacade;
@@ -1,5 +1,9 @@
1
1
  /// <reference types="mithril" />
2
+ import { IconOptions } from "../../../../components/icon/iconOptions";
3
+ import { IDropdownManagerClass } from "../../../../services/dropdown/IDropDownManager";
2
4
  import { ButtonFacade } from "../Form/IFormFacade";
3
5
  export interface IUiComponentsFacade {
4
6
  button(button: ButtonFacade, translate?: boolean): _mithril.MithrilVirtualElement;
7
+ icon(code: string, options: IconOptions): _mithril.MithrilVirtualElement;
8
+ DropdownManager: IDropdownManagerClass;
5
9
  }
@@ -2,6 +2,9 @@
2
2
  import { ButtonFacade } from "../Form/IFormFacade";
3
3
  export declare type onModalResizeCallback = (data: IModalSizingState) => void;
4
4
  export declare type MithrilControl = ViewControl | ContentControl;
5
+ export interface IType<T> {
6
+ new (...args: any[]): T;
7
+ }
5
8
  interface ViewControl {
6
9
  $view(): _mithril.MithrilVirtualElement | string;
7
10
  }
@@ -29,7 +32,7 @@ export interface IUiFacade {
29
32
  /** Вызвать модальное окно */
30
33
  showModal(ctrl: MithrilControl | ParentCtrl, options?: IModalOptions): any;
31
34
  /** Вызвать боковую панель */
32
- showSidebar(ctrl: MithrilControl | ParentCtrl, options?: ISideBarOptions): any;
35
+ showSidebar(ctrl: MithrilControl | ParentCtrl, options?: IPanelOptions): any;
33
36
  }
34
37
  export declare type ModalTypes = "info" | "success" | "warning" | "danger" | "primary" | "fatal";
35
38
  export interface IModalOptions {
@@ -52,7 +55,7 @@ export interface IModalOptions {
52
55
  /** Тип модального окна */
53
56
  type?: ModalTypes;
54
57
  }
55
- export interface ISideBarOptions {
58
+ export interface IPanelOptions {
56
59
  /** Отображать боковую панель в расширенном на весь экран виде */
57
60
  maximized?: boolean;
58
61
  }
@@ -1,4 +1,4 @@
1
- import { FormatOptions } from "../../../../helpers/FormatOptions";
1
+ import { FormatOptions } from "../../../../helpers/formatOptions";
2
2
  export interface IUtilsFacade {
3
3
  getText(textCode: string, args?: any): string;
4
4
  format(value: any, options?: FormatOptions): any;
@@ -0,0 +1,5 @@
1
+ import { DropdownOptions, IDropdownMenu } from "./IDropDownMenu";
2
+ export declare class IDropdownManagerClass {
3
+ getDropdownMenu<I>(items: I[], uid: string, options?: DropdownOptions<I>): IDropdownMenu<I>;
4
+ deleteDropdownMenu(uid: string): void;
5
+ }
@@ -0,0 +1,22 @@
1
+ /// <reference types="mithril" />
2
+ import { IPopoverBase } from "../../components/popover/IPopoverBase";
3
+ export declare class IDropdownMenu<I> {
4
+ constructor(items: I[], uid: string, options?: DropdownOptions<I>);
5
+ bind(el: HTMLElement, ctx: any): void;
6
+ show(): void;
7
+ close(): void;
8
+ updateItems(items: I[]): void;
9
+ }
10
+ export interface DropdownOptions<I> {
11
+ onSelect: (item: I) => void;
12
+ itemView: (item: I) => _mithril.MithrilVirtualElement;
13
+ }
14
+ export interface DropdownMenuViewOptions<I> {
15
+ target: HTMLElement;
16
+ items: I[];
17
+ popover: IPopoverBase;
18
+ close: () => void;
19
+ show: () => void;
20
+ itemView: (item: I) => _mithril.MithrilVirtualElement;
21
+ onSelect: (item: I) => void;
22
+ }
@@ -1,5 +1,4 @@
1
- export interface Control {
2
- }
1
+ export declare type Control = {};
3
2
  export declare enum ControlSize {
4
3
  ExtraSmall = 1,
5
4
  Small = 2,
@@ -1,5 +1,6 @@
1
+ import { FormattedText } from "mdtScripts/helpers/formattedText";
1
2
  import { ControlSize } from "mdtScripts/views/controls/Control";
2
- export declare type ButtonTypes = "default" | "primary" | "success" | "info" | "warning" | "danger" | "link" | "group-title" | "extended";
3
+ export declare type ButtonTypes = "default" | "primary" | "success" | "info" | "warning" | "danger" | "link" | "group-title" | "extended" | "fatal";
3
4
  export interface IButton {
4
5
  /**
5
6
  * Тип кнопки
@@ -60,9 +61,9 @@ export interface IButton {
60
61
  }
61
62
  export interface Button extends IButton {
62
63
  /**
63
- * Вспылвающая подсказка
64
+ * Всплывающая подсказка
64
65
  */
65
- tooltip?: string | {
66
- (): string;
66
+ tooltip?: FormattedText | {
67
+ (): FormattedText;
67
68
  };
68
69
  }
@@ -1,9 +1,8 @@
1
1
  /// <reference types="mithril" />
2
- import { Field } from "mdtScripts/common/Field";
3
- import { IListControlFacade } from "mdtServices/customModules/facades/List/IListControlFacade";
2
+ import { Field } from "../../common/Field";
3
+ import { IListControlFacade } from "../../services/customModules/facades/List/IListControlFacade";
4
4
  export interface ICellTransformerCtx {
5
5
  row: any;
6
- col: LayoutColumn;
7
6
  td: _mithril.MithrilVirtualElement;
8
7
  tr: _mithril.MithrilVirtualElement;
9
8
  isHead?: boolean;
@@ -11,6 +10,7 @@ export interface ICellTransformerCtx {
11
10
  }
12
11
  export interface CellTransformerContext extends ICellTransformerCtx {
13
12
  list: IListControlFacade;
13
+ col: LayoutColumn;
14
14
  }
15
15
  export interface IRowTransformerContext {
16
16
  row: any;
@@ -20,30 +20,35 @@ export interface IRowTransformerContext {
20
20
  export interface RowTransformerContext extends IRowTransformerContext {
21
21
  list: IListControlFacade;
22
22
  }
23
- export interface ILayoutColumn {
23
+ export interface ILayoutColumnBase {
24
24
  id?: number;
25
25
  code?: string;
26
26
  fieldPath?: string;
27
27
  title?: string;
28
- control?: any;
28
+ description?: string;
29
29
  width?: number;
30
+ type?: string;
31
+ position?: number;
32
+ flagIconOnly?: boolean;
33
+ id_FilterFunction?: number;
34
+ }
35
+ export interface ILayoutColumn extends ILayoutColumnBase {
36
+ control?: any;
37
+ transformer?: any;
30
38
  $field?: Field;
31
39
  $pathFields?: Field[];
32
40
  $pathFieldsFull?: Field[];
33
41
  $refFields?: Field[];
34
42
  $type?: any;
35
- type?: string;
36
- transformer?: any;
37
43
  $column?: any;
38
44
  $valuePath?: string;
39
45
  $valuePathFull?: string;
40
46
  $lastRefField?: Field;
41
47
  $refIdPath?: string;
42
48
  $system?: boolean;
49
+ $new?: boolean;
43
50
  $title?: string;
44
51
  $destroy?: boolean;
45
- position?: number;
46
- flagIconOnly?: boolean;
47
52
  }
48
53
  export interface LayoutColumn extends ILayoutColumn {
49
54
  $valueView?: (value: any, ctx: CellTransformerContext, args?: O2MValueViewArgs) => any;
@@ -1,6 +1,7 @@
1
1
  import { BaseQuery } from "../../../services/api/BaseQuery";
2
2
  import { QuerySorting } from "../../../services/api/Query";
3
3
  import { IFilter } from "../../../services/IFilter";
4
+ declare type WhiteSpaceType = "normal" | "nowrap" | "pre" | "pre-line" | "pre-wrap" | "inherit";
4
5
  export interface ListPageOptions {
5
6
  /** Настройки получения данных */
6
7
  paging?: {
@@ -17,12 +18,16 @@ export interface ListPageOptions {
17
18
  background?: boolean;
18
19
  /** Код макет списка */
19
20
  layout?: string;
21
+ /** Контейнер для дочерних пользовательских интерфейсов */
22
+ container?: "modal" | "sidebar";
20
23
  /** Высота списка */
21
24
  maxHeight?: number;
22
25
  /** Фильтр по-умолчанию на таблицу */
23
26
  filter?: IFilter | (() => IFilter);
24
27
  /** Скрыть индикатор загрузки */
25
28
  hideLoading?: boolean;
29
+ /** Скрыть полосу загрузки */
30
+ hideProgressBar?: boolean;
26
31
  /** Показывать ссылки на внешние таблицы в виде сылок */
27
32
  fkLinks?: boolean;
28
33
  /** Разрешить редактирование форм, открытых по нажатию на ссылки на внешние таблицы */
@@ -50,5 +55,22 @@ export interface ListPageOptions {
50
55
  *
51
56
  * inherit - наследует значение родителя
52
57
  * */
53
- whiteSpace?: "normal" | "nowrap" | "pre" | "pre-line" | "pre-wrap" | "inherit";
58
+ whiteSpace?: WhiteSpaceType;
59
+ /**
60
+ * Определяет как будут отображаться пробелы в заголовке:
61
+ *
62
+ * normal - текст в окне браузера выводится как обычно, переносы строк устанавливаются автоматически
63
+ *
64
+ * nowrap - пробелы не учитываются, переносы строк игнорируются, весь заголовок отображается одной строкой
65
+ *
66
+ * pre - заголовок показывается с учетом всех пробелов и переносов
67
+ *
68
+ * pre-line - в заголовке пробелы не учитываются, текст автоматически переносится на следующую строку, если он не помещается в заданную область
69
+ *
70
+ * pre-wrap - в заголовке сохраняются все пробелы и переносы, однако если строка по ширине не помещается в заданную область, то текст автоматически будет перенесен на следующую строку.
71
+ *
72
+ * inherit - наследует значение родителя
73
+ * */
74
+ whiteSpaceHeader?: WhiteSpaceType;
54
75
  }
76
+ export {};