eservices-core 1.0.391 → 1.0.392

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.
@@ -1,75 +1,61 @@
1
- import { ComputedRef, VNode } from "vue";
2
- import { FormParams } from "./Form";
3
- import { ListRowValues, TableRowController, Values, ValuesInterface } from "../types";
1
+ import { TableRowController, Values, ValuesInterface } from "../types";
4
2
  import EventEmitter from "jenesius-event-emitter";
5
- export interface ListCell {
3
+ export default class List extends EventEmitter {
4
+ #private;
5
+ static EVENT_DATA: string;
6
+ /**
7
+ * Entity Name
8
+ * */
9
+ name: string;
10
+ constructor(config: IListConfig);
11
+ read(ReadParams: IReadParams): Promise<any>;
12
+ set array(data: any[]);
13
+ get array(): any[];
14
+ /**
15
+ * @description Function get all names from Config.
16
+ * */
17
+ static GetFieldNames(config: IListCell[]): string[];
18
+ }
19
+ export declare function useListState(list: List): {
20
+ array: any[];
21
+ };
22
+ export declare function useListOrder(defaultOrder: ISortConfig, onSort: any): {
23
+ order: import("vue").Ref<{
24
+ name: string;
25
+ duration: "desc" | "asc";
26
+ }>;
27
+ };
28
+ export declare function useListFilter(defaultFilter: {
29
+ [name: string]: any;
30
+ }, onFilter: any): {
31
+ filters: import("vue").Ref<{
32
+ [name: string]: any;
33
+ }>;
34
+ };
35
+ export interface IListConfig {
36
+ name: string;
37
+ }
38
+ export interface IListCell {
6
39
  title?: string;
7
40
  name?: string | string[];
8
41
  value?: (x: Values, obj: ValuesInterface) => Values;
9
42
  link?: (x: Values, obj: ValuesInterface) => any;
10
43
  type?: "date" | "dateWithTime" | 'toggle' | 'select';
11
- icon?: string;
12
44
  class?: string | string[];
13
45
  onClick?: (x: Values, obj: TableRowController) => void;
14
- edit?: boolean;
15
- delete?: boolean;
16
46
  }
17
- export interface ListParams extends FormParams {
18
- config: ComputedRef<ListCell[]>;
47
+ export interface IReadParams {
48
+ fields?: string[];
49
+ order?: ISortConfig;
50
+ filter?: string;
19
51
  }
20
- export default class List extends EventEmitter {
21
- static EVENT_ORDER: string;
22
- config: ComputedRef<ListCell[]>;
23
- array: {
24
- [name: string]: any;
25
- }[];
26
- orderField: string;
27
- orderDirection: string;
28
- constructor(props: ListParams);
29
- cleanArray(): void;
30
- setArray(array: List["array"]): void;
31
- order(fieldName: string, pos: 'asc' | 'desc'): void;
32
- /**
33
- * @description Статик метод для получения VNode для Строки
34
- *
35
- * @param {ListCell[]} config - конфигурация списка
36
- * @param {ListRowValues} rowValues - значения для одной строки
37
- * */
38
- static getRow(config: ListCell[], rowValues: ListRowValues, list?: List): VNode | VNode[];
39
- /**
40
- * @return { {name: string, value: any} } CellInfo
41
- * */
42
- static getCellInfo(cell: ListCell, rowValues: ListRowValues): {
43
- name: string;
44
- value: Values;
45
- };
46
- /**
47
- * @description Статик метод для получения VNode для Ячейки
48
- *
49
- * @param {ListCell} cellConfig - конфигурация Ячейки
50
- * @param {ListRowValues} rowValues - значения Строки
51
- * @param {string} cellName - имя Ячейки
52
- * @param {values} cellValue - значение ячейки
53
- * */
54
- static getCell(cellConfig: ListCell, rowValues: ListRowValues, cellName: string | null, cellValue: Values, list?: List): VNode[];
55
- /**
56
- * @description Принимает конфигурацию списка
57
- * @return <String>Array Возвращает массив, содержащий все имена полей из ко
58
- * нфигурации
59
- * */
60
- static getNamesFromConfig(config: ListCell[]): string[];
61
- /**
62
- * @description Вернёт название ячеки, учитывая все значения поля name
63
- * Если значением поля name выступает массив, то вернёт первый элемент масси
64
- * ва
65
- * */
66
- static getCellName(cell: ListCell): string | null;
52
+ export interface ISortConfig {
53
+ name: string;
54
+ duration: 'desc' | 'asc';
55
+ }
56
+ export interface IFilterConfig {
57
+ title: string;
58
+ name: string;
59
+ type: "enum";
60
+ options: any;
67
61
  }
68
- export declare function useListState(list: List): {
69
- state: {
70
- order: {
71
- field: string;
72
- direction: string;
73
- };
74
- };
75
- };
@@ -1,6 +1,6 @@
1
1
  import { ListRowValues, TableController, Values, ValuesInterface } from "../types";
2
2
  import { VNode } from "vue";
3
- import List, { ListCell, ListParams } from "./List";
3
+ import List, { ListCell, ListParams } from "./_List";
4
4
  interface TableChanges {
5
5
  update: ValuesInterface[];
6
6
  new: ValuesInterface[];
@@ -0,0 +1,78 @@
1
+ import { ComputedRef, VNode } from "vue";
2
+ import { FormParams } from "./Form";
3
+ import { ListRowValues, TableRowController, Values, ValuesInterface } from "../types";
4
+ import EventEmitter from "jenesius-event-emitter";
5
+ export interface ListCell {
6
+ title?: string;
7
+ name?: string | string[];
8
+ value?: (x: Values, obj: ValuesInterface) => Values;
9
+ link?: (x: Values, obj: ValuesInterface) => any;
10
+ type?: "date" | "dateWithTime" | 'toggle' | 'select';
11
+ icon?: string;
12
+ class?: string | string[];
13
+ onClick?: (x: Values, obj: TableRowController) => void;
14
+ edit?: boolean;
15
+ delete?: boolean;
16
+ }
17
+ export interface ListParams extends FormParams {
18
+ config: ComputedRef<ListCell[]>;
19
+ }
20
+ /**
21
+ * @deprecated
22
+ * */
23
+ export default class List extends EventEmitter {
24
+ static EVENT_ORDER: string;
25
+ config: ComputedRef<ListCell[]>;
26
+ array: {
27
+ [name: string]: any;
28
+ }[];
29
+ orderField: string;
30
+ orderDirection: string;
31
+ constructor(props: ListParams);
32
+ cleanArray(): void;
33
+ setArray(array: List["array"]): void;
34
+ order(fieldName: string, pos: 'asc' | 'desc'): void;
35
+ /**
36
+ * @description Статик метод для получения VNode для Строки
37
+ *
38
+ * @param {ListCell[]} config - конфигурация списка
39
+ * @param {ListRowValues} rowValues - значения для одной строки
40
+ * */
41
+ static getRow(config: ListCell[], rowValues: ListRowValues, list?: List): VNode | VNode[];
42
+ /**
43
+ * @return { {name: string, value: any} } CellInfo
44
+ * */
45
+ static getCellInfo(cell: ListCell, rowValues: ListRowValues): {
46
+ name: string;
47
+ value: Values;
48
+ };
49
+ /**
50
+ * @description Статик метод для получения VNode для Ячейки
51
+ *
52
+ * @param {ListCell} cellConfig - конфигурация Ячейки
53
+ * @param {ListRowValues} rowValues - значения Строки
54
+ * @param {string} cellName - имя Ячейки
55
+ * @param {values} cellValue - значение ячейки
56
+ * */
57
+ static getCell(cellConfig: ListCell, rowValues: ListRowValues, cellName: string | null, cellValue: Values, list?: List): VNode[];
58
+ /**
59
+ * @description Принимает конфигурацию списка
60
+ * @return <String>Array Возвращает массив, содержащий все имена полей из ко
61
+ * нфигурации
62
+ * */
63
+ static getNamesFromConfig(config: ListCell[]): string[];
64
+ /**
65
+ * @description Вернёт название ячеки, учитывая все значения поля name
66
+ * Если значением поля name выступает массив, то вернёт первый элемент масси
67
+ * ва
68
+ * */
69
+ static getCellName(cell: ListCell): string | null;
70
+ }
71
+ export declare function useListState(list: List): {
72
+ state: {
73
+ order: {
74
+ field: string;
75
+ direction: string;
76
+ };
77
+ };
78
+ };
package/dist/index.d.ts CHANGED
@@ -7,10 +7,12 @@ import "./../styles/index.css";
7
7
  import StylesInterface from "./styles/types";
8
8
  import { Values } from "./types";
9
9
  import Icon from "./widgets/icons/Icon.vue";
10
+ import { IListCell, IListConfig, IFilterConfig, ISortConfig } from "./classes/List";
10
11
  import { setupSocket, useSocket } from "./socket/use-socket";
11
12
  import WidgetBreadcrumbs from "./widgets/breadcrumbs/widget-breadcrumbs.vue";
12
13
  import WidgetCommunication from "./widgets/communication/widget-communication.vue";
13
- import WidgetList from "./widgets/tables/WidgetList.vue";
14
+ import WidgetOldList from "./widgets/tables/WidgetList.vue";
15
+ import WidgetList from "./widgets/list/widget-list.vue";
14
16
  import WidgetSection from "./widgets/section/widget-section.vue";
15
17
  import WidgetTableController from "./widgets/tables/table-with-form/widget-table-controller.vue";
16
18
  import WidgetSpinner from "./widgets/spinner/WidgetSpinner.vue";
@@ -35,56 +37,20 @@ import metadataService from "./services/metadata-service";
35
37
  import fileService from "./services/FileService";
36
38
  import invitationService from "./services/invitation-service";
37
39
  import CoreError from "./classes/CoreError";
38
- import List, { ListCell } from "./classes/List";
40
+ import OldList, { ListCell } from "./classes/_List";
39
41
  import ProcessWrap from "./classes/ProcessWrap";
40
42
  import ApplicationManager from "./classes/ApplicationManager";
41
43
  import NotificationSystem from "./classes/NotificationSystem";
44
+ import List from "./classes/List";
42
45
  import { clickOutside, requestHandler } from "./utils";
43
46
  import valuesToUpperCase from "./utils/values-to-upper-case";
44
47
  import { prettyDate, prettyDateWithTime } from "./utils/prettyDate";
48
+ import Filter from "./utils/Filter";
45
49
  import useFormMetadata from "./hooks/use-form-metadata";
46
50
  import useFormAction from "./hooks/use-form-action";
47
51
  import useFormLabel from "./hooks/use-form-label";
48
52
  import useFormRequestData from "./hooks/use-form-request-data";
49
- export { StylesInterface };
50
- export interface NavigationRecordRow {
51
- title: string;
52
- icon?: string;
53
- link?: string;
54
- activeMatch?: string;
55
- children: NavigationRecordRow[];
56
- }
57
- export interface InterfaceBreadcrumb {
58
- link: any;
59
- title: string;
60
- }
61
- export interface InterfaceUserPopupRecordRow {
62
- title: string;
63
- icon: string;
64
- link?: any;
65
- }
66
- export interface LabelForm {
67
- title: string;
68
- icon?: string;
69
- type?: 'error' | 'warning' | 'correct' | 'inactive';
70
- }
71
- export interface CodeEntity {
72
- code: string;
73
- name: string;
74
- }
75
- export interface ValuesInterface {
76
- [name: string]: Values;
77
- }
78
- export interface TableController {
79
- save: (v: ValuesInterface) => void;
80
- create: (v: ValuesInterface) => void;
81
- hide: () => void;
82
- delete: (v: number) => void;
83
- }
84
- export interface ButtonRow {
85
- title: string;
86
- callback: () => any;
87
- }
53
+ import { useListFilter, useListOrder, useListState } from "./classes/List";
88
54
  export {
89
55
  /**
90
56
  * @deprecated
@@ -94,16 +60,16 @@ clickOutside,
94
60
  * @deprecated
95
61
  * */
96
62
  requestHandler, useSocket, setupSocket };
97
- export { ApplicationManager, NotificationSystem, Table, CoreError, List, ProcessWrap, ListCell };
63
+ export { ApplicationManager, NotificationSystem, Table, CoreError, List, OldList, ProcessWrap, ListCell };
98
64
  export { fileService, processWizardService, viewService, authService, dataService, communicationService, metadataService, invitationService };
99
65
  /**
100
66
  * HOOKS
101
67
  * */
102
- export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData };
68
+ export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData, useListFilter, useListOrder, useListState };
103
69
  /**
104
70
  * All components binding with VueComponents must have name started with Widget.
105
71
  * */
106
- export { WidgetNotificationSystem, WidgetForm, ModalValidation, WidgetTable, WidgetTableController, WidgetSpinner, WidgetBreadcrumbs, WidgetCommunication, WidgetList, WidgetSection, WidgetImage, WidgetButton, WidgetNotFound, InterfaceContainer as WidgetInterfaceContainer,
72
+ export { WidgetNotificationSystem, WidgetForm, ModalValidation, WidgetTable, WidgetTableController, WidgetSpinner, WidgetBreadcrumbs, WidgetCommunication, WidgetList, WidgetOldList, WidgetSection, WidgetImage, WidgetButton, WidgetNotFound, InterfaceContainer as WidgetInterfaceContainer,
107
73
  /**
108
74
  * @deprecated We must use own WidgetIcon in custom project. Rewrite WidgetIcon to CoreIcon and use only inside Core
109
75
  * components.
@@ -115,8 +81,13 @@ declare const utils: {
115
81
  valuesToUpperCase: typeof valuesToUpperCase;
116
82
  prettyDate: typeof prettyDate;
117
83
  prettyDateWithTime: typeof prettyDateWithTime;
84
+ Filter: typeof Filter;
118
85
  };
119
86
  export { utils };
87
+ /**
88
+ * Interfaces
89
+ * */
90
+ export { IListCell, IListConfig, IFilterConfig, ISortConfig };
120
91
  declare const _default: {
121
92
  services: {
122
93
  authService: typeof authService;
@@ -206,3 +177,42 @@ declare const _default: {
206
177
  types: typeof types;
207
178
  };
208
179
  export default _default;
180
+ export { StylesInterface, };
181
+ export interface NavigationRecordRow {
182
+ title: string;
183
+ icon?: string;
184
+ link?: string;
185
+ activeMatch?: string;
186
+ children: NavigationRecordRow[];
187
+ }
188
+ export interface InterfaceBreadcrumb {
189
+ link: any;
190
+ title: string;
191
+ }
192
+ export interface InterfaceUserPopupRecordRow {
193
+ title: string;
194
+ icon: string;
195
+ link?: any;
196
+ }
197
+ export interface LabelForm {
198
+ title: string;
199
+ icon?: string;
200
+ type?: 'error' | 'warning' | 'correct' | 'inactive';
201
+ }
202
+ export interface CodeEntity {
203
+ code: string;
204
+ name: string;
205
+ }
206
+ export interface ValuesInterface {
207
+ [name: string]: Values;
208
+ }
209
+ export interface TableController {
210
+ save: (v: ValuesInterface) => void;
211
+ create: (v: ValuesInterface) => void;
212
+ hide: () => void;
213
+ delete: (v: number) => void;
214
+ }
215
+ export interface ButtonRow {
216
+ title: string;
217
+ callback: () => any;
218
+ }