eservices-core 1.0.402 → 1.0.403

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,3 +1,4 @@
1
+ import { ListCell } from "../index";
1
2
  import { TableRowController, Values, ValuesInterface } from "../types";
2
3
  import EventEmitter from "jenesius-event-emitter";
3
4
  export default class List extends EventEmitter {
@@ -15,6 +16,18 @@ export default class List extends EventEmitter {
15
16
  * @description Function get all names from Config.
16
17
  * */
17
18
  static GetFieldNames(config: IListCell[]): string[];
19
+ /**
20
+ * @description Получение стандартной информации из ячейки и значений. {name, value}
21
+ * @example
22
+ * cell: { name: ['title', 'id'], value: (x) => `${x}_${x}` }
23
+ * values: {id: 1, title: "GG"}
24
+ * Output: { name: 'title', value: 'GG_GG'}
25
+ */
26
+ static getCellInfo(cell: ListCell, rowValues: any): {
27
+ name: string;
28
+ value: Values;
29
+ };
30
+ static getCellName(cell: ListCell): string | null;
18
31
  }
19
32
  export declare function useListState(list: List): {
20
33
  array: any[];
@@ -35,14 +48,16 @@ export declare function useListFilter(defaultFilter: {
35
48
  export interface IListConfig {
36
49
  name: string;
37
50
  }
51
+ export declare type ListCellType = "date" | "dateWithTime" | 'toggle' | 'select';
38
52
  export interface IListCell {
39
53
  title?: string;
40
54
  name?: string | string[];
41
55
  value?: (x: Values, obj: ValuesInterface) => Values;
42
56
  link?: (x: Values, obj: ValuesInterface) => any;
43
- type?: "date" | "dateWithTime" | 'toggle' | 'select';
57
+ type?: ListCellType;
44
58
  class?: string | string[];
45
59
  onClick?: (x: Values, obj: TableRowController) => void;
60
+ href?: (x: Values, obj: ValuesInterface) => string;
46
61
  }
47
62
  export interface IReadParams {
48
63
  fields?: string[];
@@ -11,6 +11,9 @@ interface ValuesTableCellInterface extends ValuesInterface {
11
11
  }
12
12
  export interface TableParams extends ListParams {
13
13
  }
14
+ /**
15
+ * @deprecated
16
+ */
14
17
  export default class Table extends List {
15
18
  save: any;
16
19
  read: any;
@@ -0,0 +1,69 @@
1
+ import List, { IListCell, IListConfig } from "../List";
2
+ export declare const SYMBOL_ROW: unique symbol;
3
+ interface ITableChanges {
4
+ edit: {
5
+ [rowIndex: number]: ITableRow;
6
+ };
7
+ new: {
8
+ [rowIndex: number]: ITableRow;
9
+ };
10
+ remove: number[];
11
+ }
12
+ interface ITableConfig extends IListConfig {
13
+ }
14
+ export interface ITableRow {
15
+ [key: string]: any;
16
+ [SYMBOL_ROW]: number;
17
+ }
18
+ export interface ITableViewController {
19
+ activate: (rowIndex: number) => void;
20
+ deactivate: () => void;
21
+ removeRow: (a: number | null) => void;
22
+ }
23
+ export interface ITableCell extends IListCell {
24
+ icon?: string;
25
+ type?: 'edit' | 'remove';
26
+ }
27
+ export default class Table extends List {
28
+ static PROVIDE_NAME: string;
29
+ /**
30
+ * @description Используется для индексации номера строки. 0 - зарезервирован. Используется для Form:New
31
+ */
32
+ rowIndex: number;
33
+ changes: ITableChanges;
34
+ changed: boolean;
35
+ save: () => any;
36
+ constructor(params: ITableConfig);
37
+ /**
38
+ * @description Создание новой записи.
39
+ */
40
+ create(data: any): void;
41
+ cleanChanges(): void;
42
+ /**
43
+ * @description Edit row of table.
44
+ * @param {Number} rowIndex number of uniq row.
45
+ * @param data Values
46
+ */
47
+ edit(rowIndex: number, data: any): void;
48
+ remove(rowIndex: number): void;
49
+ wrapData(data: any, rawIndex?: number): ITableRow;
50
+ emitChanges(): void;
51
+ /**
52
+ * @override
53
+ * */
54
+ set array(data: any[]);
55
+ get array(): any[];
56
+ log(msg: string): void;
57
+ }
58
+ export declare function useActiveRowGenerator(fn: (a: null | number) => void): (rowIndex: number | null) => {
59
+ activate(): void;
60
+ deactivate(): void;
61
+ };
62
+ export declare function useTableState(table: Table): {
63
+ activeRow: import("vue").Ref<number>;
64
+ array: import("vue").ComputedRef<any[]>;
65
+ };
66
+ export declare function useTableRequest(table: Table, options?: {
67
+ fields: string | string[];
68
+ }): void;
69
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ITableCell, ITableRow, ITableViewController } from "./Table";
2
+ import { VNode } from "vue";
3
+ /**
4
+ * @description Получение ОДНОЙ строки таблицы.
5
+ */
6
+ export default function getTableRow(config: ITableCell[], values: ITableRow, rowController: ITableViewController): VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
+ [key: string]: any;
8
+ }>;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as _utils from "./utils";
2
2
  import * as mixins from "./mixins";
3
3
  import config from "./config";
4
4
  import * as types from "./types";
5
- import Table from "./classes/Table";
5
+ import Table from "./classes/table/Table";
6
6
  import "./../styles/index.css";
7
7
  import StylesInterface from "./styles/types";
8
8
  import { Values } from "./types";
@@ -14,9 +14,8 @@ import WidgetBreadcrumbs from "./widgets/breadcrumbs/widget-breadcrumbs.vue";
14
14
  import WidgetCommunication from "./widgets/communication/widget-communication.vue";
15
15
  import WidgetList from "./widgets/list/widget-list.vue";
16
16
  import WidgetSection from "./widgets/section/widget-section.vue";
17
- import WidgetTableController from "./widgets/tables/table-with-form/widget-table-controller.vue";
18
17
  import WidgetSpinner from "./widgets/spinner/WidgetSpinner.vue";
19
- import WidgetTable from './widgets/tables/table-with-form/widget-table.vue';
18
+ import WidgetTable from './widgets/tables/widget-table.vue';
20
19
  import WidgetForm from "./widgets/forms/naomi/WidgetForm.vue";
21
20
  import ModalValidation from "./widgets/modals/modal-validation/modal-validation.vue";
22
21
  import WidgetNotificationSystem from "./widgets/errorSystem/default/WidgetNotificationSystem.vue";
@@ -52,6 +51,7 @@ import useFormLabel from "./hooks/use-form-label";
52
51
  import useFormRequestData from "./hooks/use-form-request-data";
53
52
  import { useListFilter, useListOrder, useListState } from "./classes/List";
54
53
  import useCustomerState from "./hooks/use-customer-state";
54
+ import { useTableRequest, useTableState } from "./classes/table/Table";
55
55
  export {
56
56
  /**
57
57
  * @deprecated
@@ -66,11 +66,11 @@ export { fileService, processWizardService, viewService, authService, dataServic
66
66
  /**
67
67
  * HOOKS
68
68
  * */
69
- export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData, useListFilter, useListOrder, useListState, useCustomerState };
69
+ export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData, useListFilter, useListOrder, useListState, useCustomerState, useTableState, useTableRequest };
70
70
  /**
71
71
  * All components binding with VueComponents must have name started with Widget.
72
72
  * */
73
- export { WidgetNotificationSystem, WidgetForm, ModalValidation, WidgetTable, WidgetTableController, WidgetSpinner, WidgetBreadcrumbs, WidgetCommunication, WidgetList, WidgetSection, WidgetImage, WidgetButton, WidgetNotFound, Icon as WidgetIcon, WidgetCard, WidgetWizard, WidgetMultiButton, WidgetShadowForm };
73
+ export { WidgetNotificationSystem, WidgetForm, ModalValidation, WidgetTable, WidgetSpinner, WidgetBreadcrumbs, WidgetCommunication, WidgetList, WidgetSection, WidgetImage, WidgetButton, WidgetNotFound, Icon as WidgetIcon, WidgetCard, WidgetWizard, WidgetMultiButton, WidgetShadowForm };
74
74
  declare const utils: {
75
75
  clickOutside: typeof _utils.clickOutside;
76
76
  requestHandler: typeof _utils.requestHandler;
@@ -133,11 +133,6 @@ declare const _default: {
133
133
  icons: {
134
134
  Icon: import("vue").DefineComponent<{}, {}, any, Record<string, import("vue").ComputedGetter<any> | import("vue").WritableComputedOptions<any>>, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
135
135
  };
136
- tables: {
137
- WidgetList: import("vue").DefineComponent<{}, {}, any, Record<string, import("vue").ComputedGetter<any> | import("vue").WritableComputedOptions<any>>, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
138
- WidgetTable: import("vue").DefineComponent<{}, {}, any, Record<string, import("vue").ComputedGetter<any> | import("vue").WritableComputedOptions<any>>, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
139
- WidgetTableController: import("vue").DefineComponent<{}, {}, any, Record<string, import("vue").ComputedGetter<any> | import("vue").WritableComputedOptions<any>>, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
140
- };
141
136
  errorSystem: {
142
137
  default: import("vue").DefineComponent<{}, {}, any, Record<string, import("vue").ComputedGetter<any> | import("vue").WritableComputedOptions<any>>, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
143
138
  };
@@ -153,7 +148,7 @@ declare const _default: {
153
148
  Form: typeof import("./classes/Form").default;
154
149
  ListWorker: typeof import("./classes/ListWorker").default;
155
150
  ViewForm: typeof import("./classes/ViewForm/ViewForm").ViewForm;
156
- Table: typeof Table;
151
+ Table: typeof import("./classes/Table").default;
157
152
  ErrorStorageSystem: typeof import("./classes/ErrorStorageSystem").default;
158
153
  form: {
159
154
  render: typeof import("./classes/ViewForm/render").default;