eservices-core 1.0.475 → 1.0.476

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.
@@ -132,6 +132,16 @@ export declare function useProvideList(list?: List, defaultConfig?: Partial<ILis
132
132
  * @description Возвращает реактивный экземпляр конфигурации списка.
133
133
  * */
134
134
  export declare function useListConfig(list: List): Partial<IListCell>[];
135
+ /**
136
+ * @description Hook для сохранения / получение информации из локального хранилища
137
+ * */
138
+ export declare function useListSettings(list: List, id: string): {
139
+ getSettings: () => IListSettings;
140
+ };
141
+ interface IListSettings {
142
+ date: string;
143
+ config: Partial<IListCell>[];
144
+ }
135
145
  export declare type ListCellType = 'date' | 'dateWithTime' | 'toggle' | 'select';
136
146
  export interface IDefaultListData {
137
147
  [LIST_ROW_KEY]: number;
package/dist/index.d.ts CHANGED
@@ -63,7 +63,7 @@ import useCustomerState from "./hooks/use-customer-state";
63
63
  import { useTableRequest, useTableState } from "./classes/table/Table";
64
64
  import { useCommunication } from "./classes/Communication";
65
65
  import useFormRequest from "./hooks/use-form-request";
66
- import { useProvideList, useListConfig } from "./classes/new/List";
66
+ import { useProvideList, useListConfig, useListSettings } from "./classes/new/List";
67
67
  import { SYMBOL_ROW } from "./classes/table/Table";
68
68
  export {
69
69
  /**
@@ -79,7 +79,7 @@ export { fileService, processWizardService, viewService, authService, dataServic
79
79
  /**
80
80
  * HOOKS
81
81
  * */
82
- export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData, useListFilter, useListOrder, useListState, useCustomerState, useTableState, useTableRequest, useCommunication, useFormRequest, useManagerState, useProvideList, useListConfig };
82
+ export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData, useListFilter, useListOrder, useListState, useCustomerState, useTableState, useTableRequest, useCommunication, useFormRequest, useManagerState, useProvideList, useListConfig, useListSettings };
83
83
  /**
84
84
  * All components binding with VueComponents must have name started with Widget.
85
85
  * */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * eservices-core v1.0.475
2
+ * eservices-core v1.0.476
3
3
  * (c) 2023 ESERVICES
4
4
  */
5
5
  'use strict';
@@ -3073,6 +3073,35 @@ function useListConfig(list) {
3073
3073
  const config = vue.reactive([...list.config]);
3074
3074
  list.on(List$1.EVENT_CONFIG_UPDATE, v => config.splice(0, config.length, ...v));
3075
3075
  return config;
3076
+ }
3077
+ /**
3078
+ * @description Hook для сохранения / получение информации из локального хранилища
3079
+ * */
3080
+ function useListSettings(list, id) {
3081
+ const STORAGE_LABEL = `list-settings-${id}`;
3082
+ function getSettings() {
3083
+ const strListSettings = localStorage.getItem(STORAGE_LABEL);
3084
+ const settings = strListSettings ? JSON.parse(strListSettings) : null;
3085
+ return settings;
3086
+ }
3087
+ function saveSettings({ config }) {
3088
+ const settings = getSettings() || {
3089
+ date: (new Date()).toISOString(),
3090
+ config
3091
+ };
3092
+ settings.config = config;
3093
+ localStorage.setItem(STORAGE_LABEL, JSON.stringify(settings));
3094
+ }
3095
+ const settings = getSettings();
3096
+ if (settings) {
3097
+ list.config = settings.config;
3098
+ }
3099
+ list.on(List$1.EVENT_CONFIG_UPDATE, config => {
3100
+ saveSettings({ config });
3101
+ });
3102
+ return {
3103
+ getSettings
3104
+ };
3076
3105
  }
3077
3106
 
3078
3107
  class Table extends List$1 {
@@ -5575,6 +5604,7 @@ exports.useFormRequestData = useFormRequestData;
5575
5604
  exports.useListConfig = useListConfig;
5576
5605
  exports.useListFilter = useListFilter;
5577
5606
  exports.useListOrder = useListOrder;
5607
+ exports.useListSettings = useListSettings;
5578
5608
  exports.useListState = useListState$1;
5579
5609
  exports.useManagerState = useManagerState;
5580
5610
  exports.useProvideList = useProvideList;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eservices-core",
3
- "version": "1.0.475",
3
+ "version": "1.0.476",
4
4
  "description": "Core library",
5
5
  "author": "",
6
6
  "scripts": {