eservices-core 1.3.0 → 1.3.2

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.
@@ -200,8 +200,8 @@ declare const _default: {
200
200
  [key: string]: any;
201
201
  }>) => void)[] | undefined;
202
202
  class?: unknown;
203
- readonly wait?: boolean | undefined;
204
203
  readonly callback?: ((a: any) => any) | undefined;
204
+ readonly wait?: boolean | undefined;
205
205
  };
206
206
  $attrs: {
207
207
  [x: string]: unknown;
@@ -356,4 +356,5 @@ import { WidgetTable, WidgetIcon } from "./../src/index";
356
356
  import { prettyDate, prettyDateWithTime } from "./../src/index";
357
357
  import type { IListCell } from "./../src/index";
358
358
  import { constants } from "./../src/index";
359
- export { constants, WidgetTable, WidgetIcon, prettyDate, prettyDateWithTime, IListCell };
359
+ import { useListActiveRow } from "./../src/index";
360
+ export { constants, WidgetTable, WidgetIcon, prettyDate, prettyDateWithTime, IListCell, useListActiveRow };
@@ -6,5 +6,5 @@ export default class metadataService {
6
6
  static get(entity: string, criteria?: string, id?: any): Promise<MetadataResponse>;
7
7
  static getById(entity: string, id: any, masterEntities?: MasterEntities): Promise<MetadataResponse>;
8
8
  static getFieldInformation(entity: string, field: string): Promise<ExtendedMetadataField | null>;
9
- static getTreatmentListField(entity: string, field: string): Promise<IListCell>;
9
+ static getTreatmentListField(entity: string, field: string): Promise<IListCell<import("../../src/types/list-type").IPrimitiveListData>>;
10
10
  }
@@ -50,8 +50,8 @@ declare const _default: {
50
50
  [key: string]: any;
51
51
  }>) => void)[] | undefined;
52
52
  class?: unknown;
53
- readonly wait?: boolean | undefined;
54
53
  readonly callback?: ((a: any) => any) | undefined;
54
+ readonly wait?: boolean | undefined;
55
55
  };
56
56
  $attrs: {
57
57
  [x: string]: unknown;
@@ -74,8 +74,8 @@ declare let a: {
74
74
  [key: string]: any;
75
75
  }>) => void)[] | undefined;
76
76
  class?: unknown;
77
- readonly wait?: boolean | undefined;
78
77
  readonly callback?: ((a: any) => any) | undefined;
78
+ readonly wait?: boolean | undefined;
79
79
  };
80
80
  $attrs: {
81
81
  [x: string]: unknown;
@@ -55,7 +55,7 @@ declare const _default: import("vue").DefineComponent<{
55
55
  }>> & {
56
56
  onSave?: ((v: any) => any) | undefined;
57
57
  "onUpdate:activeRow"?: ((v: number | null) => any) | undefined;
58
- onRead?: (() => any) | undefined;
59
58
  "onUpdate:selectRows"?: ((v: number[]) => any) | undefined;
59
+ onRead?: (() => any) | undefined;
60
60
  }, {}, {}>;
61
61
  export default _default;
@@ -1,3 +1,3 @@
1
1
  export declare const constants: {
2
- TABLE_ACTIVE_NEW: string;
2
+ LIST_ACTIVE_NEW: string;
3
3
  };
@@ -0,0 +1,8 @@
1
+ import { IListActiveRow } from '../types/list-type';
2
+ /**
3
+ * @description Hook используется для работы с активной строкой в списке.
4
+ */
5
+ export default function useListActiveRow(): {
6
+ activeRow: import("vue").Ref<IListActiveRow>;
7
+ activateRow: (activeValue: IListActiveRow) => void;
8
+ };
@@ -19,3 +19,8 @@ METHODS
19
19
  ******/
20
20
  import { prettyDate, prettyDateWithTime } from './methods/pretty-date';
21
21
  export { prettyDate, prettyDateWithTime };
22
+ /****
23
+ HOOKS
24
+ ****/
25
+ import useListActiveRow from './hooks/use-list-active-row';
26
+ export { useListActiveRow };
@@ -1,4 +1,6 @@
1
- export interface IListCell {
1
+ import { constants } from '../constants';
2
+ import { RouteLocationRaw } from "vue-router";
3
+ export interface IListCell<T extends IPrimitiveListData = IPrimitiveListData> {
2
4
  /**
3
5
  * @description Текстовая метка колонки
4
6
  */
@@ -10,7 +12,7 @@ export interface IListCell {
10
12
  /**
11
13
  * @description Функция для изменения значения ячейки.
12
14
  */
13
- value: (cellValue: any, rowValues: IPrimitiveListData) => string | number;
15
+ value: (cellValue: unknown, rowValues: T) => string | number;
14
16
  /**
15
17
  * @description Тип ячейки. Добавляет дополнительные обработчики для ячейки.
16
18
  */
@@ -18,19 +20,19 @@ export interface IListCell {
18
20
  /**
19
21
  * @description Используется для добавления классов к ячейке. Принимает строку, массив или функцию
20
22
  */
21
- class: string | string[] | ((rowValues: IPrimitiveListData) => string);
23
+ class: string | string[] | ((rowValues: T) => string);
22
24
  /**
23
25
  * @description Обработчик клика на ячейку
24
26
  */
25
- onClick: (rowValues: IPrimitiveListData) => void;
27
+ onClick: (rowValues: T) => void;
26
28
  /**
27
29
  * @description Используется для установки ссылки <a href = "$"/>
28
30
  */
29
- href: (rowValues: IPrimitiveListData) => string;
31
+ href: (rowValues: T) => string;
30
32
  /**
31
33
  * @description Используется для установки <router-link to = "$"/>
32
34
  */
33
- link: (rowValues: IPrimitiveListData) => any;
35
+ link: (rowValues: T) => RouteLocationRaw | null;
34
36
  /**
35
37
  * @description Название иконки, которая будет добавлена через <widget-icon/>
36
38
  */
@@ -38,17 +40,18 @@ export interface IListCell {
38
40
  /**
39
41
  * @description Скрывает текущее значение ячейки
40
42
  */
41
- hide: (rowValues: IPrimitiveListData) => boolean;
43
+ hide: (rowValues: T) => boolean;
42
44
  /**
43
45
  * @description Ширина текущей ячейки, которую нужно установить.
44
46
  * */
45
47
  width?: string | number;
46
48
  }
47
49
  export declare type IPrimitiveListData = Record<string, unknown>;
48
- declare type ListCellType = 'date' | 'dateWithTime' | 'dateTime' | 'toggle' | 'select' | 'number' | 'multi-select';
50
+ declare type ListCellType = 'date' | 'dateWithTime' | 'dateTime' | 'select' | 'multi-select' | 'number';
49
51
  export interface IRowProps {
50
52
  config: IListCell[];
51
53
  values: IPrimitiveListData;
52
54
  selected: boolean;
53
55
  }
56
+ export declare type IListActiveRow = IPrimitiveListData | null | typeof constants.LIST_ACTIVE_NEW;
54
57
  export {};
@@ -1,12 +1,12 @@
1
1
  import { IListCell } from '../../types/list-type';
2
2
  declare const _default: import("vue").DefineComponent<{
3
3
  config: {
4
- type: import("vue").PropType<IListCell[]>;
4
+ type: import("vue").PropType<IListCell<import('../../types/list-type').IPrimitiveListData>[]>;
5
5
  required: true;
6
6
  };
7
7
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
8
8
  config: {
9
- type: import("vue").PropType<IListCell[]>;
9
+ type: import("vue").PropType<IListCell<import('../../types/list-type').IPrimitiveListData>[]>;
10
10
  required: true;
11
11
  };
12
12
  }>>, {}, {}>;
@@ -1,7 +1,7 @@
1
- import { IListCell, IPrimitiveListData } from '../../types/list-type';
1
+ import { IListActiveRow, IListCell, IPrimitiveListData } from '../../types/list-type';
2
2
  declare const _default: import("vue").DefineComponent<{
3
3
  config: {
4
- type: import("vue").PropType<IListCell[]>;
4
+ type: import("vue").PropType<IListCell<IPrimitiveListData>[]>;
5
5
  required: true;
6
6
  };
7
7
  array: {
@@ -9,27 +9,23 @@ declare const _default: import("vue").DefineComponent<{
9
9
  required: true;
10
10
  };
11
11
  activeRow: {
12
- type: import("vue").PropType<string | IPrimitiveListData | null>;
12
+ type: import("vue").PropType<IListActiveRow>;
13
13
  default: null;
14
14
  };
15
15
  selectedRows: {
16
16
  type: import("vue").PropType<IPrimitiveListData[]>;
17
17
  default: () => never[];
18
18
  };
19
- wait: {
20
- type: import("vue").PropType<boolean>;
21
- };
22
19
  classCallback: {
23
20
  type: import("vue").PropType<(value: IPrimitiveListData) => string | string[]>;
24
21
  };
25
22
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
- "update:activeRow": (row: IPrimitiveListData | null) => void;
23
+ "update:activeRow": (row: IListActiveRow) => void;
27
24
  "update:selectedRows": (v: IPrimitiveListData[]) => void;
28
- save: (v: any) => void;
29
- read: () => void;
25
+ save: (v: unknown) => void;
30
26
  }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
31
27
  config: {
32
- type: import("vue").PropType<IListCell[]>;
28
+ type: import("vue").PropType<IListCell<IPrimitiveListData>[]>;
33
29
  required: true;
34
30
  };
35
31
  array: {
@@ -37,26 +33,22 @@ declare const _default: import("vue").DefineComponent<{
37
33
  required: true;
38
34
  };
39
35
  activeRow: {
40
- type: import("vue").PropType<string | IPrimitiveListData | null>;
36
+ type: import("vue").PropType<IListActiveRow>;
41
37
  default: null;
42
38
  };
43
39
  selectedRows: {
44
40
  type: import("vue").PropType<IPrimitiveListData[]>;
45
41
  default: () => never[];
46
42
  };
47
- wait: {
48
- type: import("vue").PropType<boolean>;
49
- };
50
43
  classCallback: {
51
44
  type: import("vue").PropType<(value: IPrimitiveListData) => string | string[]>;
52
45
  };
53
46
  }>> & {
54
- onSave?: ((v: any) => any) | undefined;
47
+ onSave?: ((v: unknown) => any) | undefined;
55
48
  "onUpdate:selectedRows"?: ((v: IPrimitiveListData[]) => any) | undefined;
56
- "onUpdate:activeRow"?: ((row: IPrimitiveListData | null) => any) | undefined;
57
- onRead?: (() => any) | undefined;
49
+ "onUpdate:activeRow"?: ((row: IListActiveRow) => any) | undefined;
58
50
  }, {
59
- activeRow: string | IPrimitiveListData | null;
51
+ activeRow: IListActiveRow;
60
52
  selectedRows: IPrimitiveListData[];
61
53
  }, {}>;
62
54
  export default _default;
@@ -0,0 +1 @@
1
+ export default function wait(n?: number): Promise<unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eservices-core",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Core library",
5
5
  "author": "",
6
6
  "scripts": {
@@ -34,6 +34,7 @@
34
34
  "@vue/test-utils": "^2.0.0-rc.18",
35
35
  "@vue/vue3-jest": "29.2.2",
36
36
  "fantasticon": "1.2.3",
37
+ "jest-environment-jsdom": "^29.7.0",
37
38
  "postcss-import": "^14.0.2",
38
39
  "ts-jest": "29.0.5",
39
40
  "tslib": "^2.3.1",