eservices-core 1.0.470 → 1.0.471

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.
@@ -122,16 +122,19 @@ export declare function useListState(list: List<any>): {
122
122
  array: any[];
123
123
  };
124
124
  interface IFlexConfig {
125
- config: Readonly<IListCell[]>;
126
125
  list: List;
127
- setConfig: (newConfig: IListCell[]) => void;
128
126
  revertConfig: () => void;
129
127
  defaultConfig: IListCell[];
128
+ config: IListCell[];
130
129
  }
131
130
  /**
132
131
  * Использование гибкого механизма для работы с конфигурацию.
133
132
  * */
134
133
  export declare function useProvideList(list?: List, defaultConfig?: IListCell[]): IFlexConfig;
134
+ /**
135
+ * @description Возвращает реактивный экземпляр конфигурации списка.
136
+ * */
137
+ export declare function useListConfig(list: List): IListCell[];
135
138
  export declare type ListCellType = 'date' | 'dateWithTime' | 'toggle' | 'select';
136
139
  export interface IListCell {
137
140
  title: string;
package/dist/index.d.ts CHANGED
@@ -62,7 +62,7 @@ import useCustomerState from "./hooks/use-customer-state";
62
62
  import { useTableRequest, useTableState } from "./classes/table/Table";
63
63
  import { useCommunication } from "./classes/Communication";
64
64
  import useFormRequest from "./hooks/use-form-request";
65
- import { useProvideList } from "./classes/new/List";
65
+ import { useProvideList, useListConfig } from "./classes/new/List";
66
66
  import { SYMBOL_ROW } from "./classes/table/Table";
67
67
  export {
68
68
  /**
@@ -78,7 +78,7 @@ export { fileService, processWizardService, viewService, authService, dataServic
78
78
  /**
79
79
  * HOOKS
80
80
  * */
81
- export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData, useListFilter, useListOrder, useListState, useCustomerState, useTableState, useTableRequest, useCommunication, useFormRequest, useManagerState, useProvideList };
81
+ export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData, useListFilter, useListOrder, useListState, useCustomerState, useTableState, useTableRequest, useCommunication, useFormRequest, useManagerState, useProvideList, useListConfig };
82
82
  /**
83
83
  * All components binding with VueComponents must have name started with Widget.
84
84
  * */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * eservices-core v1.0.470
2
+ * eservices-core v1.0.471
3
3
  * (c) 2023 ESERVICES
4
4
  */
5
5
  'use strict';
@@ -2750,60 +2750,6 @@ function useTableRequest(table, options) {
2750
2750
  var css_248z$j = "*{\r\n --extra-fast :0.1s;\r\n --fast :0.2s;\r\n --medium :0.3s;\r\n\r\n box-sizing: border-box;\r\n --primary: #3949ab\r\n}\r\nhtml, body, #app{\r\n height: 100%;\r\n}\r\nbody{\r\n margin: 0;\r\n}\r\nul{\r\n text-align: left;\r\n}\r\n.flex{\r\n display: flex;\r\n}\r\n.flex_column{\r\n display: flex;\r\n flex-direction: column;\r\n}\r\n.flex_center{\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.flex_full{\r\n flex-grow: 1;\r\n}\r\n.grid{\r\n display: grid;\r\n}\r\n.link{\r\n text-decoration: var(--link-decoration);\r\n color: var(--link-color);\r\n}\r\n.link_hover-underline:hover,\r\n.link_hover_underline:hover{\r\n text-decoration: underline;\r\n}\r\n.link_full{\r\n position: absolute;\r\n height: 100%;\r\n width: 100%;\r\n left: 0;\r\n top:0;\r\n}\r\n.text_sm{\r\n font-weight: 400;\r\n font-size: 12px;\r\n line-height: 16px;\r\n}\r\n.text_md{\r\n font-size: 14px;\r\n line-height: 20px;\r\n}\r\n.text_lg{\r\n font-size: 16px;\r\n line-height: 24px;\r\n}\r\n.text_size_xxl{\r\n font-size: 18px;\r\n line-height: 25px;\r\n}\r\n.text_center{\r\n text-align: center;\r\n}\r\n.text_bold{\r\n font-weight: 600;\r\n}\r\n.text_nowrap{\r\n white-space: nowrap;\r\n}\r\n.text_right{\r\n text-align: right;\r\n}\r\n.text_center{\r\n text-align: center;\r\n}\r\n.text_size_sm{\r\n font-size: 12px;\r\n line-height: 130%;\r\n}\r\n.text_size_md{\r\n font-size: 14px;\r\n line-height: 140%;\r\n}\r\n.text_error{\r\n color: red;\r\n}\r\n.title_sm{\r\n font-weight: 600;\r\n font-size: 16px;\r\n line-height: 24px;\r\n}\r\n.title_md{\r\n font-weight: 600;\r\n font-size: 24px;\r\n line-height: 32px;\r\n}\r\n.title_lg{\r\n font-weight: bold;\r\n font-size: 32px;\r\n line-height: 48px;\r\n}\r\n.title_xxl{\r\n font-weight: bold;\r\n font-size: 48px;\r\n line-height: 64px;\r\n}\r\n.cursor_pointer{\r\n cursor: pointer;\r\n}\r\n.cursor_default{\r\n cursor: default;\r\n}\r\nbutton{\r\n outline: none;\r\n user-select: none;\r\n\r\n transition: background-color 0.2s;\r\n}\r\n.button{\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n\r\n outline: none;\r\n}\r\n.button_main{\r\n background-color: var(--button-background);\r\n color: var(--button-color);\r\n}\r\n.button_main:focus{\r\n background-color: var(--button-background-active);\r\n}\r\n.button_main:active{\r\n background-color: var(--button-background-active);\r\n}\r\n.button_white{\r\n background-color: var(--white);\r\n color: var(--main);\r\n}\r\n.button_sm{\r\n height: 30px;\r\n width: 130px;\r\n}\r\n.button_shadow{\r\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);\r\n}\r\n.button_lg{\r\n font-weight: 600;\r\n font-size: 16px;\r\n line-height: 24px;\r\n\r\n padding: 12px 0;\r\n height: 50px;\r\n width: 200px;\r\n}\r\n.button_disabled{\r\n background-color: var(--gray-1);\r\n}\r\n.button_resolve{\r\n background-color: var(--main);\r\n color: var(--white);\r\n border-radius: 2px;\r\n}\r\n.button_reject{\r\n border: 1px solid var(--color-dark);\r\n border-radius: 2px;\r\n}\r\n.button_md{\r\n height: 30px;\r\n padding: 0 10px;\r\n\r\n min-width: 80px;\r\n}\r\n.button_disabled{\r\n background-color: var(--button-disabled-background-color);\r\n cursor: pointer !important;\r\n}\r\n*{\r\n\r\n\r\n\r\n}\r\n.color_main,\r\n.color__text_main{\r\n color: var(--main);\r\n}\r\n.color__text_black{\r\n color: var(--black-1);\r\n}\r\n.color__text_gray{\r\n color: var(--text-gray);\r\n}\r\n.color__text_red,\r\n.color_red{\r\n color: var(--red);\r\n}\r\n.color__text_white{\r\n color: var(--white);\r\n}\r\n.background_orange{\r\n background-color: var(--orange)\r\n}\r\n.background_red{\r\n background-color: var(--red)\r\n}\r\n.color_dark{\r\n color: var(--dark);\r\n}\r\n.color_light{\r\n color: var(--light);\r\n}\r\n.move-vertical-enter-active,\r\n.move-vertical-leave-active {\r\n transition: transform 0.5s ease;\r\n}\r\n.move-vertical-enter-from,\r\n.move-vertical-leave-to {\r\n transform: translateY(-10px);\r\n}\r\n.move-horizontal-enter-active,\r\n.move-horizontal-leave-active {\r\n transition: transform 0.5s;\r\n}\r\n.move-horizontal-enter-from,\r\n.move-horizontal-leave-to {\r\n transform: translateX(-40px);\r\n}\r\n.modal-vertical-enter-active , .modal-vertical-leave-active, .modal-default {\r\n transition: transform var(--medium);\r\n}\r\n.modal-vertical-enter-active .modal-default, .modal-vertical-leave-active .modal-default{\r\n transform: translateY(-100px);\r\n}\r\n.move-vertical-fast-enter-active,\r\n.move-vertical-fast-leave-active {\r\n transition: transform var(--fast) ease;\r\n}\r\n.move-vertical-fast-enter-from,\r\n.move-vertical-fast-leave-to {\r\n transform: translateY(-20px);\r\n}\r\n.slide-up-enter-active,\r\n.slide-up-leave-active {\r\n transition: transform var(--fast) ease, opacity var(--fast);\r\n\r\n}\r\n.slide-up-enter-from,\r\n.slide-up-leave-to {\r\n transform: translateY(20px);\r\n opacity: 0;\r\n}\r\n.opacity-enter-active,\r\n.opacity-leave-active {\r\n transition: opacity var(--fast) ease;\r\n}\r\n.opacity-enter-from,\r\n.opacity-leave-to {\r\n opacity: 0;\r\n}\r\n.modal-default{\r\n background-color: var(--white);\r\n position: relative;\r\n z-index: 1;\r\n\r\n width: auto;\r\n\r\n background: var(--white);\r\n border-radius: var(--border-radius);\r\n\r\n\r\n}\r\n.modal-default__head{\r\n background-color: var(--black-1);\r\n text-align: center;\r\n padding: 5px 0;\r\n border-radius: 6px 6px 0 0;\r\n}\r\n.modal-default__body{\r\n gap: 20px;\r\n padding: 0 15px;\r\n}\r\n.modal-default__foot{\r\n padding: 30px 0;\r\n display: flex;\r\n justify-content: center;\r\n}\r\n.tooltip-help-elem{}\r\n.hint-tooltip{\r\n display: block;\r\n\r\n z-index: 222;\r\n margin: auto;\r\n pointer-events: none;\r\n\r\n box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);\r\n}\r\n.tooltip-help-circle-in,\r\n.tooltip-help-circle-out{\r\n border-radius: 50%;\r\n}\r\n.tooltip-help-undefined{\r\n border-radius: 50px;\r\n}\r\n.tooltip-card{\r\n position: fixed;\r\n z-index: 315;\r\n\r\n display: flex;\r\n flex-direction: column;\r\n\r\n width: 480px;\r\n height: fit-content;\r\n\r\n margin: auto;\r\n\r\n border-radius: 10px;\r\n background-color: var(--hint-background);\r\n\r\n cursor: default;\r\n}\r\n.tooltip-card__foot{\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n\r\n background-color: var(--hint-background-navigation);\r\n border-radius: 10px;\r\n\r\n padding: 20px ;\r\n}\r\n.tooltip-card__foot-current{\r\n font-weight: 600;\r\n font-size: 20px;\r\n line-height: 24px;\r\n\r\n color: var(--white);\r\n}\r\n.tooltip-card__body{\r\n position: relative;\r\n display: flex;\r\n flex-direction: column;\r\n\r\n gap: 8px;\r\n\r\n padding: 20px 20px 10px 20px;\r\n}\r\n.tooltip-card__body-title{\r\n font-weight: bold;\r\n font-size: 20px;\r\n line-height: 24px;\r\n\r\n color: var(--white);\r\n}\r\n.tooltip-card__body-text{\r\n font-size: 16px;\r\n line-height: 24px;\r\n\r\n color: var(--white);\r\n}\r\n.tooltip-card__foot-button_back{\r\n background-color: var(--main-1);\r\n}\r\n.tooltip-card__foot-button_next{\r\n background-color: var(--hint);\r\n}\r\n.tooltip-card__body-close{\r\n position: absolute;\r\n right: 22px;\r\n top: 12px;\r\n width: 20px;\r\n height: 16px;\r\n opacity: 0.3;\r\n\r\n cursor: pointer;\r\n}\r\n.tooltip-card__body-close:hover {\r\n opacity: 1;\r\n}\r\n.tooltip-card__body-close:before,\r\n.tooltip-card__body-close:after {\r\n position: absolute;\r\n left: 15px;\r\n content: ' ';\r\n height: 21px;\r\n width: 2px;\r\n background-color: white;\r\n}\r\n.tooltip-card__body-close:before {\r\n transform: rotate(45deg);\r\n}\r\n.tooltip-card__body-close:after {\r\n transform: rotate(-45deg);\r\n}\r\n.tooltip-card-container-wrap{\r\n pointer-events: none;\r\n position: absolute;\r\n left: 0;\r\n top:0;\r\n\r\n z-index: 123132;\r\n\r\n height: 100%;\r\n width: 100%;\r\n}\r\n.tooltip-card-container-wrap>div{\r\n\r\n height: 100%;\r\n width: 100%;\r\n\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n}\r\n.tester-box-tooltip{\r\n pointer-events: all;\r\n}\r\n.position_relative{\r\n position: relative;\r\n}\r\n.position_absolute{\r\n position: absolute;\r\n}\r\n.gap_5{\r\n gap: 5px;\r\n}\r\n.gap_10{\r\n gap: 10px;\r\n}\r\n.gap_20{\r\n gap: 20px;\r\n}\r\n.margin-0{\r\n margin: 0;\r\n}\r\n.widget-input{\r\n\tbackground-color: var(--input-background);\r\n\tborder: var(--input-border);\r\n\tborder-radius: var(--input-border-radius);\r\n\tcolor: var(--input-color);\r\n}\r\n.widget-input:disabled{\r\n\tbackground-color: var(--input-background-disabled);\r\n\tborder: var(--input-border-disabled);\r\n}\r\n.widget-input[error=\"true\"] {\r\n\tborder: var(--input-border-error);\r\n}\r\n.widget-input::placeholder{\r\n\tcolor: var(--input-placeholder-color);\r\n}\r\n.widget-input:disabled::placeholder{\r\n\tcolor: var(--input-placeholder-color-disabled);\r\n}\r\n.input_error{\r\n\tborder: 1px solid red !important;\r\n}\r\n.input_size_md{\r\n\theight: var(--input-height);\r\n}\r\n.input-title{\r\n\tfont-size: 12px;\r\n\tline-height: 16px;\r\n\tcolor: #667085;\r\n\r\n\tmargin: 4px 0;\r\n}\r\n.widget-table{\r\n border-collapse: collapse;\r\n}\r\n.widget-table_mini{\r\n\r\n}\r\n.widget-table_mini p{\r\n margin: 0;\r\n}\r\n.widget-table_mini{\r\n\r\n}\r\n.list-cell-link>a{\r\n position: absolute;\r\n left: 0;\r\n top:0;\r\n z-index: 1;\r\n height: 100%;\r\n width: 100%;\r\n\r\n cursor: pointer;\r\n}\r\n.list-cell-link>p{\r\n font-weight: 500;\r\n}\r\n.widget-table__cell{\r\n padding: 0 20px;\r\n font-weight: 400;\r\n font-size: 14px;\r\n line-height: 19px;\r\n\r\n color: #4F4F4F;\r\n}\r\n.widget-table-cell_use{\r\n cursor: pointer;\r\n}\r\n.widget-table-cell_select{\r\n width: min-content ;\r\n}\r\n.table-cell-toggle{\r\n --border-color: black;\r\n position: relative;\r\n display: grid;\r\n place-content: center;\r\n border: 1px solid var(--border-color);\r\n height: 15px;\r\n aspect-ratio: 1 / 1;\r\n border-radius: 50%;\r\n}\r\n.table-cell-toggle_active:after {\r\n content: \"\";\r\n border-radius: 50%;\r\n background-color: var(--border-color);\r\n height: 9px;\r\n aspect-ratio: 1/1;\r\n}\r\n.widget-list-cell-text {\r\n white-space: nowrap;\r\n}\r\n";
2751
2751
  styleInject(css_248z$j);
2752
2752
 
2753
- /**
2754
- * @description Используется для работы с конфигурацией списка. При работе делает копию, после чего её можно будет установить
2755
- * как конфигурацию по умолчанию
2756
- * */
2757
- class ListConfig extends EventEmitter {
2758
- constructor(array = []) {
2759
- super();
2760
- this.array = vue.reactive([]);
2761
- /**
2762
- * @description Является дефолтной конфигурацией, используется для возвращению
2763
- * */
2764
- this.defaultArray = [];
2765
- this.setDefault(array);
2766
- }
2767
- emitUpdate() {
2768
- this.emit(ListConfig.EVENT_DATA, this.array);
2769
- }
2770
- setDefault(array) {
2771
- const copy = JSON.parse(JSON.stringify(array));
2772
- this.defaultArray = copy;
2773
- this.set(copy);
2774
- }
2775
- revert() {
2776
- this.set(this.defaultArray);
2777
- }
2778
- set(array) {
2779
- this.array.splice(0, this.array.length, ...array);
2780
- this.emitUpdate();
2781
- }
2782
- append(data) {
2783
- this.array.push(data);
2784
- this.emitUpdate();
2785
- }
2786
- /**
2787
- * @description Перемещает элемент с позиции I, на позицию J
2788
- * */
2789
- moveTo(i, j) {
2790
- if (this.isOutOfRange(i) || this.isOutOfRange(j))
2791
- throw new Error(`Provided position is out of range: ${i}, ${j}`);
2792
- const item = this.array[i];
2793
- this.array.splice(i, 1);
2794
- this.array.splice(j, 0, item);
2795
- this.emitUpdate();
2796
- }
2797
- remove(i) {
2798
- this.array.splice(i, 1);
2799
- this.emitUpdate();
2800
- }
2801
- isOutOfRange(position) {
2802
- return !(position >= 0 && position < this.array.length);
2803
- }
2804
- }
2805
- ListConfig.EVENT_DATA = 'list-config:update';
2806
-
2807
2753
  var _primaryKeys, _config, _wait, _readData, _saveData;
2808
2754
  const LIST_ROW_KEY = '_______LIST_______ROW_______INDEX________NAME_______';
2809
2755
  class List$1 extends EventEmitter {
@@ -3103,25 +3049,30 @@ function useProvideList(list, defaultConfig) {
3103
3049
  return data;
3104
3050
  if (!list || !defaultConfig)
3105
3051
  throw new Error(`Hook useProvideList has two required params: list and defaultConfig`);
3106
- const reactiveConfig = vue.reactive(defaultConfig);
3107
- const listConfigurator = new ListConfig(defaultConfig);
3108
- listConfigurator.on(ListConfig.EVENT_DATA, (a) => reactiveConfig.splice(0, reactiveConfig.length, ...a));
3109
- function setConfig(newConfig) {
3110
- reactiveConfig.splice(0, reactiveConfig.length, ...newConfig);
3111
- }
3052
+ const config = useListConfig(list);
3112
3053
  function revertConfig() {
3113
3054
  if (!defaultConfig)
3114
3055
  throw new Error('DefaultConfig was not provided.');
3115
- setConfig(defaultConfig);
3056
+ if (!list)
3057
+ throw new Error(`List was not provided.`);
3058
+ list.config = (defaultConfig);
3116
3059
  }
3117
3060
  const returnedValues = {
3118
- config: vue.readonly(reactiveConfig), list,
3119
- setConfig,
3061
+ list,
3120
3062
  revertConfig,
3063
+ config,
3121
3064
  defaultConfig
3122
3065
  };
3123
3066
  vue.provide(PROVIDE_NAME, returnedValues);
3124
3067
  return returnedValues;
3068
+ }
3069
+ /**
3070
+ * @description Возвращает реактивный экземпляр конфигурации списка.
3071
+ * */
3072
+ function useListConfig(list) {
3073
+ const config = vue.reactive([...list.config]);
3074
+ list.on(List$1.EVENT_CONFIG_UPDATE, v => config.splice(0, config.length, ...v));
3075
+ return config;
3125
3076
  }
3126
3077
 
3127
3078
  class Table extends List$1 {
@@ -5020,6 +4971,60 @@ function useManagerState() {
5020
4971
  return state;
5021
4972
  }
5022
4973
 
4974
+ /**
4975
+ * @description Используется для работы с конфигурацией списка. При работе делает копию, после чего её можно будет установить
4976
+ * как конфигурацию по умолчанию
4977
+ * */
4978
+ class ListConfig extends EventEmitter {
4979
+ constructor(array = []) {
4980
+ super();
4981
+ this.array = vue.reactive([]);
4982
+ /**
4983
+ * @description Является дефолтной конфигурацией, используется для возвращению
4984
+ * */
4985
+ this.defaultArray = [];
4986
+ this.setDefault(array);
4987
+ }
4988
+ emitUpdate() {
4989
+ this.emit(ListConfig.EVENT_DATA, this.array);
4990
+ }
4991
+ setDefault(array) {
4992
+ const copy = JSON.parse(JSON.stringify(array));
4993
+ this.defaultArray = copy;
4994
+ this.set(copy);
4995
+ }
4996
+ revert() {
4997
+ this.set(this.defaultArray);
4998
+ }
4999
+ set(array) {
5000
+ this.array.splice(0, this.array.length, ...array);
5001
+ this.emitUpdate();
5002
+ }
5003
+ append(data) {
5004
+ this.array.push(data);
5005
+ this.emitUpdate();
5006
+ }
5007
+ /**
5008
+ * @description Перемещает элемент с позиции I, на позицию J
5009
+ * */
5010
+ moveTo(i, j) {
5011
+ if (this.isOutOfRange(i) || this.isOutOfRange(j))
5012
+ throw new Error(`Provided position is out of range: ${i}, ${j}`);
5013
+ const item = this.array[i];
5014
+ this.array.splice(i, 1);
5015
+ this.array.splice(j, 0, item);
5016
+ this.emitUpdate();
5017
+ }
5018
+ remove(i) {
5019
+ this.array.splice(i, 1);
5020
+ this.emitUpdate();
5021
+ }
5022
+ isOutOfRange(position) {
5023
+ return !(position >= 0 && position < this.array.length);
5024
+ }
5025
+ }
5026
+ ListConfig.EVENT_DATA = 'list-config:update';
5027
+
5023
5028
  class Communication extends EventEmitter {
5024
5029
  constructor(talkId) {
5025
5030
  super();
@@ -5567,6 +5572,7 @@ exports.useFormLabel = useFormLabel;
5567
5572
  exports.useFormMetadata = useFormMetadata;
5568
5573
  exports.useFormRequest = useFormRequest;
5569
5574
  exports.useFormRequestData = useFormRequestData;
5575
+ exports.useListConfig = useListConfig;
5570
5576
  exports.useListFilter = useListFilter;
5571
5577
  exports.useListOrder = useListOrder;
5572
5578
  exports.useListState = useListState$1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eservices-core",
3
- "version": "1.0.470",
3
+ "version": "1.0.471",
4
4
  "description": "Core library",
5
5
  "author": "",
6
6
  "scripts": {