eservices-core 1.0.466 → 1.0.468

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,5 +1,5 @@
1
1
  import EventEmitter from "jenesius-event-emitter";
2
- import { IReadParams, ListCell } from "../List";
2
+ import { IReadParams } from "../List";
3
3
  declare const LIST_ROW_KEY = "_______LIST_______ROW_______INDEX________NAME_______";
4
4
  export declare class List<T = {}> extends EventEmitter {
5
5
  #private;
@@ -86,7 +86,7 @@ export declare class List<T = {}> extends EventEmitter {
86
86
  /**
87
87
  * @description Methods using for get name from cell config.
88
88
  * */
89
- static getCellName<T extends Pick<ListCell, 'name'>>(cell: T): string;
89
+ static getCellName<T extends Pick<IListCell, 'name'>>(cell: T): string;
90
90
  /**
91
91
  * @description Получение стандартной информации из ячейки и значений. {name, value}
92
92
  * @example
@@ -94,7 +94,7 @@ export declare class List<T = {}> extends EventEmitter {
94
94
  * values: {id: 1, title: "GG"}
95
95
  * Output: { name: 'title', value: 'GG_GG'}
96
96
  */
97
- static getCellInfo<T extends Pick<ListCell, 'name' | 'value'>>(cell: T, rowValues: any): {
97
+ static getCellInfo<T extends Pick<IListCell, 'name' | 'value'>>(cell: T, rowValues: any): {
98
98
  name: string;
99
99
  value: import("../../types").Values;
100
100
  };
@@ -124,7 +124,7 @@ interface IFlexConfig {
124
124
  /**
125
125
  * Использование гибкого механизма для работы с конфигурацию.
126
126
  * */
127
- export declare function useProvideList(list?: List, defaultConfig?: ListCell[]): IFlexConfig;
127
+ export declare function useProvideList(list?: List, defaultConfig?: IListCell[]): IFlexConfig;
128
128
  export declare type ListCellType = 'date' | 'dateWithTime' | 'toggle' | 'select';
129
129
  export interface IListCell {
130
130
  title: string;
@@ -1,25 +1,26 @@
1
1
  import EventEmitter from "jenesius-event-emitter";
2
- import { ListCell } from "../List";
2
+ import { IListCell } from "./List";
3
3
  /**
4
4
  * @description Используется для работы с конфигурацией списка. При работе делает копию, после чего её можно будет установить
5
5
  * как конфигурацию по умолчанию
6
6
  * */
7
7
  export default class ListConfig extends EventEmitter {
8
8
  static readonly EVENT_DATA = "list-config:update";
9
- array: ListCell[];
9
+ array: IListCell[];
10
10
  /**
11
11
  * @description Является дефолтной конфигурацией, используется для возвращению
12
12
  * */
13
13
  private defaultArray;
14
14
  private emitUpdate;
15
- constructor(array?: ListCell[]);
16
- setDefault(array: ListCell[]): void;
15
+ constructor(array?: IListCell[]);
16
+ setDefault(array: IListCell[]): void;
17
17
  revert(): void;
18
- set(array: ListCell[]): void;
19
- append(data: ListCell): void;
18
+ set(array: IListCell[]): void;
19
+ append(data: IListCell): void;
20
20
  /**
21
21
  * @description Перемещает элемент с позиции I, на позицию J
22
22
  * */
23
23
  moveTo(i: number, j: number): void;
24
+ remove(i: number): void;
24
25
  isOutOfRange(position: number): boolean;
25
26
  }
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * eservices-core v1.0.466
2
+ * eservices-core v1.0.468
3
3
  * (c) 2023 ESERVICES
4
4
  */
5
5
  'use strict';
@@ -2757,7 +2757,7 @@ styleInject(css_248z$j);
2757
2757
  class ListConfig extends EventEmitter {
2758
2758
  constructor(array = []) {
2759
2759
  super();
2760
- this.array = [];
2760
+ this.array = vue.reactive([]);
2761
2761
  /**
2762
2762
  * @description Является дефолтной конфигурацией, используется для возвращению
2763
2763
  * */
@@ -2776,7 +2776,7 @@ class ListConfig extends EventEmitter {
2776
2776
  this.set(this.defaultArray);
2777
2777
  }
2778
2778
  set(array) {
2779
- this.array = array;
2779
+ this.array.splice(0, this.array.length, ...array);
2780
2780
  this.emitUpdate();
2781
2781
  }
2782
2782
  append(data) {
@@ -2794,6 +2794,10 @@ class ListConfig extends EventEmitter {
2794
2794
  this.array.splice(j, 0, item);
2795
2795
  this.emitUpdate();
2796
2796
  }
2797
+ remove(i) {
2798
+ this.array.splice(i, 1);
2799
+ this.emitUpdate();
2800
+ }
2797
2801
  isOutOfRange(position) {
2798
2802
  return !(position >= 0 && position < this.array.length);
2799
2803
  }
@@ -3082,7 +3086,7 @@ function useProvideList(list, defaultConfig) {
3082
3086
  return data;
3083
3087
  if (!list || !defaultConfig)
3084
3088
  throw new Error(`Hook useProvideList has two required params: list and defaultConfig`);
3085
- const reactiveConfig = vue.reactive([]);
3089
+ const reactiveConfig = vue.reactive(defaultConfig);
3086
3090
  const listConfigurator = new ListConfig(defaultConfig);
3087
3091
  listConfigurator.on(ListConfig.EVENT_DATA, (a) => reactiveConfig.splice(0, reactiveConfig.length, ...a));
3088
3092
  function setConfig(newConfig) {
@@ -3092,6 +3096,7 @@ function useProvideList(list, defaultConfig) {
3092
3096
  config: vue.readonly(reactiveConfig), list,
3093
3097
  setConfig
3094
3098
  };
3099
+ vue.provide(PROVIDE_NAME, returnedValues);
3095
3100
  return returnedValues;
3096
3101
  }
3097
3102
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eservices-core",
3
- "version": "1.0.466",
3
+ "version": "1.0.468",
4
4
  "description": "Core library",
5
5
  "author": "",
6
6
  "scripts": {