eservices-core 1.0.297 → 1.0.300

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 { FormControllerInterface, Values, ValuesInterface } from "../types";
2
- import EventEmitter from "./EventEmitter";
2
+ import EventEmitter from "jenesius-event-emitter";
3
3
  interface DisabledElementsInterface {
4
4
  [name: string]: boolean;
5
5
  }
@@ -18,13 +18,17 @@ export interface ListParams extends FormParams {
18
18
  config: ComputedRef<ListCell[]>;
19
19
  }
20
20
  export default class List extends InterfaceForm {
21
+ static EVENT_ORDER: string;
21
22
  config: ComputedRef<ListCell[]>;
22
23
  array: {
23
24
  [name: string]: any;
24
25
  }[];
26
+ orderField: string;
27
+ orderDirection: string;
25
28
  constructor(props: ListParams);
26
29
  cleanArray(): void;
27
30
  setArray(array: List["array"]): void;
31
+ order(fieldName: string, pos: 'asc' | 'desc'): void;
28
32
  /**
29
33
  * @description Статик метод для получения VNode для Строки
30
34
  *
@@ -61,3 +65,11 @@ export default class List extends InterfaceForm {
61
65
  * */
62
66
  static getCellName(cell: ListCell): string | null;
63
67
  }
68
+ export declare function useListState(list: List): {
69
+ state: {
70
+ order: {
71
+ field: string;
72
+ direction: string;
73
+ };
74
+ };
75
+ };
@@ -1,4 +1,4 @@
1
- import EventEmitter from "./EventEmitter";
1
+ import EventEmitter from "jenesius-event-emitter";
2
2
  export default class Metadata extends EventEmitter {
3
3
  state: MetadataState;
4
4
  constructor();
@@ -1,4 +1,3 @@
1
- import EventEmitter from "./EventEmitter";
2
1
  import Form from "./Form";
3
2
  import CoreError from "./CoreError";
4
3
  import ListWorker from "./ListWorker";
@@ -13,7 +12,6 @@ declare const _default: {
13
12
  Errors: typeof CoreError;
14
13
  CoreError: typeof CoreError;
15
14
  Form: typeof Form;
16
- EventEmitter: typeof EventEmitter;
17
15
  ListWorker: typeof ListWorker;
18
16
  ViewForm: typeof ViewForm;
19
17
  Table: typeof Table;
package/dist/index.d.ts CHANGED
@@ -75,7 +75,8 @@ import authService from "./services/AuthService";
75
75
  import dataService from "./services/data-service";
76
76
  import { CommunicationService as communicationService } from "./services/communication-service";
77
77
  import viewService from "./services/view-service";
78
- export { viewService, authService, dataService, communicationService };
78
+ import processWizardService from "./services/process-wizard-service";
79
+ export { processWizardService, viewService, authService, dataService, communicationService };
79
80
  import WidgetBreadcrumbs from "./widgets/breadcrumbs/widget-breadcrumbs.vue";
80
81
  import WidgetCommunication from "./widgets/communication/widget-communication.vue";
81
82
  import WidgetList from "./widgets/tables/WidgetList.vue";
@@ -158,7 +159,6 @@ declare const _default: {
158
159
  Errors: typeof CoreError;
159
160
  CoreError: typeof CoreError;
160
161
  Form: typeof Form;
161
- EventEmitter: typeof import("./classes/EventEmitter").default;
162
162
  ListWorker: typeof import("./classes/ListWorker").default;
163
163
  ViewForm: typeof import("./classes/ViewForm/ViewForm").ViewForm;
164
164
  Table: typeof Table;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * eservices-core v1.0.297
2
+ * eservices-core v1.0.300
3
3
  * (c) 2022 ESERVICES
4
4
  */
5
5
  'use strict';
@@ -1714,115 +1714,6 @@ script$A.render = render$h;
1714
1714
  script$A.__scopeId = "data-v-402f98e3";
1715
1715
  script$A.__file = "core/widgets/containers/ContainerAuthView.vue";
1716
1716
 
1717
- class CoreError extends Error {
1718
- constructor(message, details = null) {
1719
- super();
1720
- this.message = message;
1721
- this.details = details;
1722
- this.id = CoreError.ID++;
1723
- }
1724
- /**
1725
- * ОДИН ИЗ ЭЛЕМЕНТОВ, КОТОРЫЙ ПЫТАЕТСЯ ПОДПИСАТЬСЯ НА ФОРМУ
1726
- * НЕ ИМЕЕТ ПАРАМЕТРА NAME.
1727
- * */
1728
- static UndefinedNameOfCompositeFormController(controller) {
1729
- return new CoreError("Composite object must have name prop.", controller);
1730
- }
1731
- static EntityWithoutName(entity) {
1732
- return new CoreError(`'Entity doesn't has name.`, entity);
1733
- }
1734
- static NotResolvedNameEventEmitter(name) {
1735
- return new CoreError("Event emitter was initialized with array of available names. Bu you provide: " + name);
1736
- }
1737
- static FormIsNotValidated(form) {
1738
- return new CoreError("Validate function return false. Provided form:", form);
1739
- }
1740
- static ListWorkerIsRunningOrEnd(listChunker) {
1741
- return new CoreError("Request for getting list is running or is final.", listChunker);
1742
- }
1743
- static ObjectIdNotNumber(id) {
1744
- return new CoreError(`Provided id value must be a number. Provided:` + id);
1745
- }
1746
- static UndefinedErrorId(id, array) {
1747
- return new CoreError(`Error with id ${id} not founded in ErrorStorageSystem.`, array);
1748
- }
1749
- static ApiError(error) {
1750
- return new CoreError(`Request error.`, error);
1751
- }
1752
- static ApiNotAvailable() {
1753
- return new CoreError(`Sorry, we experience difficulties here.
1754
- Please try again later or submit a feedback if problem doesn't go.`);
1755
- }
1756
- static AuthServiceError(message, errors) {
1757
- return new CoreError(message, errors);
1758
- }
1759
- static ApiResponseParseFailed() {
1760
- return new CoreError(`Response is not validate json`);
1761
- }
1762
- static MissingIdInValuesEntity(values) {
1763
- return new CoreError(`Object must includes id. But provided:`, values);
1764
- }
1765
- static ObjectWithIdNotFound(id, array) {
1766
- return new CoreError(`Can't find object with id: ${id}`, array);
1767
- }
1768
- /**
1769
- * ОШИБКА ДЛЯ ТАБЛИЦЫ, В ТОМ СЛУЧАЕ, ЕСЛИ ОБЪЕКТ НА ОБНОВЛЕНИЕ НЕ СВЯЗАН
1770
- * С СУЩЕСТВУЮЩИМ ОБЪЕКТОМ ПО _tableId
1771
- * */
1772
- static ObjectWithoutConnectToPresentArray(object, array) {
1773
- return new CoreError(`Present object didn't founded.`, {
1774
- object,
1775
- array
1776
- });
1777
- }
1778
- static EntityWithoutId(object) {
1779
- return new CoreError('Entity must has id.', object);
1780
- }
1781
- static NotFoundedTableIndex(tableIndex, table) {
1782
- return new CoreError(`Can't find the element with tableIndex ${tableIndex}`, table);
1783
- }
1784
- /**
1785
- * Использовать в случае, когда тип ошибки не определён или место её
1786
- * появления не понятно
1787
- * */
1788
- static UndefinedError(str) {
1789
- return new CoreError(str);
1790
- }
1791
- static TableArrayAlreadyIncludeProvidedIndexValue(tableIndex, array, table) {
1792
- return new CoreError(`Array already includes the element with value ${tableIndex}`, { array, table });
1793
- }
1794
- }
1795
- CoreError.ID = 0;
1796
-
1797
- class EventEmitter {
1798
- constructor(names = []) {
1799
- this.eventsState = {};
1800
- this.availableNames = null;
1801
- this.setAvailableEventNames(names);
1802
- }
1803
- emit(event, data = null) {
1804
- if (this.availableNames !== null && !this.availableNames.includes(event))
1805
- throw CoreError.NotResolvedNameEventEmitter(event);
1806
- if (!this.eventsState[event])
1807
- return Promise.resolve();
1808
- return Promise.all(this.eventsState[event].map(fn => fn(data)));
1809
- }
1810
- /**
1811
- * @param {String} event
1812
- * @param {Function} callback
1813
- */
1814
- on(event, callback) {
1815
- if (!(event in this.eventsState))
1816
- this.eventsState[event] = [];
1817
- this.eventsState[event].push(callback);
1818
- }
1819
- setAvailableEventNames(names) {
1820
- if (!Array.isArray(names))
1821
- console.warn("Names should be Array. Provided:", names);
1822
- this.availableNames = names;
1823
- }
1824
- }
1825
-
1826
1717
  /**
1827
1718
  * @description Функция вернёт значения поля из объекта. Prop может быть вложеным, указывается через точку
1828
1719
  * @description Функция возвращает значение по имени. Имя может быть составным.
@@ -1924,6 +1815,86 @@ const Journal = new _Journal();
1924
1815
  if (process.env.mode === "development")
1925
1816
  Journal.public = true;
1926
1817
 
1818
+ class CoreError extends Error {
1819
+ constructor(message, details = null) {
1820
+ super();
1821
+ this.message = message;
1822
+ this.details = details;
1823
+ this.id = CoreError.ID++;
1824
+ }
1825
+ /**
1826
+ * ОДИН ИЗ ЭЛЕМЕНТОВ, КОТОРЫЙ ПЫТАЕТСЯ ПОДПИСАТЬСЯ НА ФОРМУ
1827
+ * НЕ ИМЕЕТ ПАРАМЕТРА NAME.
1828
+ * */
1829
+ static UndefinedNameOfCompositeFormController(controller) {
1830
+ return new CoreError("Composite object must have name prop.", controller);
1831
+ }
1832
+ static EntityWithoutName(entity) {
1833
+ return new CoreError(`'Entity doesn't has name.`, entity);
1834
+ }
1835
+ static NotResolvedNameEventEmitter(name) {
1836
+ return new CoreError("Event emitter was initialized with array of available names. Bu you provide: " + name);
1837
+ }
1838
+ static FormIsNotValidated(form) {
1839
+ return new CoreError("Validate function return false. Provided form:", form);
1840
+ }
1841
+ static ListWorkerIsRunningOrEnd(listChunker) {
1842
+ return new CoreError("Request for getting list is running or is final.", listChunker);
1843
+ }
1844
+ static ObjectIdNotNumber(id) {
1845
+ return new CoreError(`Provided id value must be a number. Provided:` + id);
1846
+ }
1847
+ static UndefinedErrorId(id, array) {
1848
+ return new CoreError(`Error with id ${id} not founded in ErrorStorageSystem.`, array);
1849
+ }
1850
+ static ApiError(error) {
1851
+ return new CoreError(`Request error.`, error);
1852
+ }
1853
+ static ApiNotAvailable() {
1854
+ return new CoreError(`Sorry, we experience difficulties here.
1855
+ Please try again later or submit a feedback if problem doesn't go.`);
1856
+ }
1857
+ static AuthServiceError(message, errors) {
1858
+ return new CoreError(message, errors);
1859
+ }
1860
+ static ApiResponseParseFailed() {
1861
+ return new CoreError(`Response is not validate json`);
1862
+ }
1863
+ static MissingIdInValuesEntity(values) {
1864
+ return new CoreError(`Object must includes id. But provided:`, values);
1865
+ }
1866
+ static ObjectWithIdNotFound(id, array) {
1867
+ return new CoreError(`Can't find object with id: ${id}`, array);
1868
+ }
1869
+ /**
1870
+ * ОШИБКА ДЛЯ ТАБЛИЦЫ, В ТОМ СЛУЧАЕ, ЕСЛИ ОБЪЕКТ НА ОБНОВЛЕНИЕ НЕ СВЯЗАН
1871
+ * С СУЩЕСТВУЮЩИМ ОБЪЕКТОМ ПО _tableId
1872
+ * */
1873
+ static ObjectWithoutConnectToPresentArray(object, array) {
1874
+ return new CoreError(`Present object didn't founded.`, {
1875
+ object,
1876
+ array
1877
+ });
1878
+ }
1879
+ static EntityWithoutId(object) {
1880
+ return new CoreError('Entity must has id.', object);
1881
+ }
1882
+ static NotFoundedTableIndex(tableIndex, table) {
1883
+ return new CoreError(`Can't find the element with tableIndex ${tableIndex}`, table);
1884
+ }
1885
+ /**
1886
+ * Использовать в случае, когда тип ошибки не определён или место её
1887
+ * появления не понятно
1888
+ * */
1889
+ static UndefinedError(str) {
1890
+ return new CoreError(str);
1891
+ }
1892
+ static TableArrayAlreadyIncludeProvidedIndexValue(tableIndex, array, table) {
1893
+ return new CoreError(`Array already includes the element with value ${tableIndex}`, { array, table });
1894
+ }
1895
+ }
1896
+ CoreError.ID = 0;
1897
+
1927
1898
  /**
1928
1899
  * @description Функция для запросов, имеет встроенные обработчик для ошибок на самом низком уровне
1929
1900
  * */
@@ -2152,6 +2123,68 @@ function mergeObjects(formValues, newValues, path = []) {
2152
2123
  }
2153
2124
  }
2154
2125
 
2126
+ /*!
2127
+ * jenesius-event-emitter v1.0.2
2128
+ * (c) 2022 Jenesius
2129
+ * @license MIT
2130
+ */
2131
+ const _on = function (name, callback) {
2132
+ if (!(name in this.events))
2133
+ this.events[name] = [];
2134
+ this.events[name].push(callback);
2135
+ return this.off.bind(this, name, callback);
2136
+ };
2137
+ const _emit = function (name, data) {
2138
+ if (!(name in this.events))
2139
+ return;
2140
+ this.events[name].forEach(cl => cl(data));
2141
+ };
2142
+ const _off = function (name, callback) {
2143
+ const arr = this.events[name];
2144
+ if (!arr)
2145
+ return;
2146
+ const index = arr.indexOf(callback);
2147
+ if (index === -1)
2148
+ return;
2149
+ arr.splice(index, 1);
2150
+ };
2151
+ const _cleanEvents = function () {
2152
+ this.events = {};
2153
+ };
2154
+ class EventEmitter {
2155
+ constructor() {
2156
+ this.events = {};
2157
+ }
2158
+ on(name, callback) {
2159
+ return _on.call(this, name, callback);
2160
+ }
2161
+ emit(name, data) {
2162
+ return _emit.call(this, name, data);
2163
+ }
2164
+ off(name, callback) {
2165
+ return _off.call(this, name, callback);
2166
+ }
2167
+ cleanEvents() {
2168
+ _cleanEvents.call(this);
2169
+ }
2170
+ static on(name, callback) {
2171
+ return _on.call(EventEmitter, name, callback);
2172
+ }
2173
+ static emit(name, data) {
2174
+ return _emit.call(EventEmitter, name, data);
2175
+ }
2176
+ static off(name, callback) {
2177
+ return _off.call(EventEmitter, name, callback);
2178
+ }
2179
+ static cleanEvents() {
2180
+ _cleanEvents.call(EventEmitter);
2181
+ }
2182
+ }
2183
+ /**
2184
+ * ONLY FOR GLOBAL USING!
2185
+ * */
2186
+ EventEmitter.events = {};
2187
+
2155
2188
  /**
2156
2189
  * Прафило формы: ИСТИНА находится только форме. Все подконтрольные элементы
2157
2190
  * должны полагаться(А, если нет), то должны уведомлять форму о изменениях.
@@ -2161,7 +2194,7 @@ function mergeObjects(formValues, newValues, path = []) {
2161
2194
  * */
2162
2195
  class InterfaceForm extends EventEmitter {
2163
2196
  constructor(props) {
2164
- super(["read", "update"]);
2197
+ super();
2165
2198
  this._isForm = true;
2166
2199
  /**
2167
2200
  * values - хранилище данных формы
@@ -2728,8 +2761,10 @@ function prettyDate(str, format = 'YYYY/MM/DD') {
2728
2761
  class List extends InterfaceForm {
2729
2762
  constructor(props) {
2730
2763
  super(props);
2731
- this.config = props.config;
2732
2764
  this.array = vue.reactive([]);
2765
+ this.orderField = '';
2766
+ this.orderDirection = '';
2767
+ this.config = props.config;
2733
2768
  }
2734
2769
  cleanArray() {
2735
2770
  this.array.splice(0, this.array.length);
@@ -2738,6 +2773,15 @@ class List extends InterfaceForm {
2738
2773
  this.cleanArray();
2739
2774
  this.array.push(...array);
2740
2775
  }
2776
+ order(fieldName, pos) {
2777
+ this.orderField = fieldName;
2778
+ this.orderDirection = pos;
2779
+ // @ts-ignore
2780
+ this.emit(List.EVENT_ORDER, {
2781
+ field: fieldName,
2782
+ direction: pos
2783
+ });
2784
+ }
2741
2785
  /**
2742
2786
  * @description Статик метод для получения VNode для Строки
2743
2787
  *
@@ -2808,8 +2852,9 @@ class List extends InterfaceForm {
2808
2852
  /**
2809
2853
  * Добавляем иконку к полю
2810
2854
  * */
2811
- if (cell.icon)
2855
+ if (cell.icon) { // @ts-ignore
2812
2856
  cellNodeChildren.push(vue.h(script$V, { name: cell.icon }));
2857
+ }
2813
2858
  if (cell.class)
2814
2859
  cellClasses.push(...(Array.isArray(cell.class) ? cell.class : [cell.class]));
2815
2860
  return [vue.h("td", { class: cellClasses, }, cellNodeChildren)];
@@ -2844,6 +2889,23 @@ class List extends InterfaceForm {
2844
2889
  return cell.name[0];
2845
2890
  return null;
2846
2891
  }
2892
+ }
2893
+ List.EVENT_ORDER = 'order';
2894
+ function useListState(list) {
2895
+ const state = vue.reactive({
2896
+ order: {
2897
+ field: list.orderField,
2898
+ direction: list.orderDirection
2899
+ }
2900
+ });
2901
+ list.on(List.EVENT_ORDER, ({ field, direction }) => {
2902
+ state.order.field = field;
2903
+ state.order.direction = direction;
2904
+ list.read();
2905
+ });
2906
+ vue.onUnmounted(() => {
2907
+ });
2908
+ return { state };
2847
2909
  }
2848
2910
 
2849
2911
  var script$x = {
@@ -2888,7 +2950,7 @@ var script$v = {
2888
2950
  components: { WidgetListHeadSeparator: script$w },
2889
2951
  props: {
2890
2952
  config: Array,
2891
- sort: Object
2953
+ orderConfig: Object
2892
2954
  },
2893
2955
  setup() {
2894
2956
  /**
@@ -2970,10 +3032,8 @@ const _hoisted_1$t = {
2970
3032
  ref: "refHead"
2971
3033
  };
2972
3034
  const _hoisted_2$h = ["onClick"];
2973
- const _hoisted_3$c = { class: "widget-list-head__cell" };
2974
- const _hoisted_4$8 = /*#__PURE__*/vue.createElementVNode("div", { class: "widget-list-head__sort" }, [
2975
- /*#__PURE__*/vue.createElementVNode("div", { class: "widget-list-head__sort-arrow" })
2976
- ], -1 /* HOISTED */);
3035
+ const _hoisted_3$c = { class: "head-cell" };
3036
+ const _hoisted_4$8 = { class: "head-cell-label" };
2977
3037
 
2978
3038
  function render$d(_ctx, _cache, $props, $setup, $data, $options) {
2979
3039
  const _component_widget_list_head_separator = vue.resolveComponent("widget-list-head-separator");
@@ -2982,11 +3042,18 @@ function render$d(_ctx, _cache, $props, $setup, $data, $options) {
2982
3042
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.config, (elem, index) => {
2983
3043
  return (vue.openBlock(), vue.createElementBlock("th", {
2984
3044
  key: index,
2985
- onClick: $event => (_ctx.$emit('sort', elem.name))
3045
+ onClick: $event => (_ctx.$emit('sort', elem.name?.toLowerCase()))
2986
3046
  }, [
2987
3047
  vue.createElementVNode("div", _hoisted_3$c, [
2988
- vue.createElementVNode("p", null, vue.toDisplayString(elem.title), 1 /* TEXT */),
2989
- _hoisted_4$8
3048
+ vue.createElementVNode("p", _hoisted_4$8, vue.toDisplayString(elem.title), 1 /* TEXT */),
3049
+ vue.createElementVNode("div", null, [
3050
+ ($props.orderConfig.field === elem.name?.toLowerCase())
3051
+ ? (vue.openBlock(), vue.createElementBlock("i", {
3052
+ key: 0,
3053
+ class: vue.normalizeClass(["arrow down", { up: $props.orderConfig.direction === 'desc' }])
3054
+ }, null, 2 /* CLASS */))
3055
+ : vue.createCommentVNode("v-if", true)
3056
+ ])
2990
3057
  ]),
2991
3058
  vue.createVNode(_component_widget_list_head_separator, {
2992
3059
  onMousedown: $setup.onScale,
@@ -2997,7 +3064,7 @@ function render$d(_ctx, _cache, $props, $setup, $data, $options) {
2997
3064
  ], 512 /* NEED_PATCH */))
2998
3065
  }
2999
3066
 
3000
- var css_248z$s = "\n.widget-list-head{\r\n border: 1px solid hsla(0,0%,76.9%,.4);\n}\n.widget-list-head th{\r\n position: relative;\n}\n.widget-list-head__cell{\r\n padding: 5px 10px;\n}\n.widget-list-head p {\r\n font-weight: 400;\r\n font-size: 13px;\r\n line-height: 16px;\n}\n.widget-list-head__preload{\r\n position: absolute;\r\n\r\n width: 100%;\r\n height: 100%;\r\n\r\n z-index: -1;\r\n left: 0;\r\n top: 0;\r\n background-color: #f7eee9;\n}\n.separator{\r\n position: absolute;\r\n top: 0;\r\n z-index: 1;\n}\n.widget-list-head__sort{\r\n position: absolute;\r\n right: 15px;\r\n top: 5px;\r\n\r\n transition: 0.1s;\n}\n.widget-list-head__sort>div{\r\n display: flex;\r\n position: relative;\r\n content: \"\";\r\n height: 16px;\r\n width: 1px;\n}\n.widget-list-head__sort-arrow,\r\n .widget-list-head__sort-arrow:after,\r\n .widget-list-head__sort-arrow:before{\r\n background-color: gray;\n}\n.widget-list-head__sort-arrow:after,\r\n .widget-list-head__sort-arrow:before{\r\n content: \"\";\r\n\r\n position: absolute;\r\n top: 2px;\r\n height: 1px;\r\n width: 8px;\n}\n.widget-list-head__sort.sort-desc{\r\n transform: rotate(180deg);\n}\n.widget-list-head__sort-arrow:after{\r\n transform: rotate(45deg) translateX(0) translateY(1px);\n}\n.widget-list-head__sort-arrow:before{\r\n transform: rotate(-45deg) translateX(-5px) translateY(-4px);\n}\r\n";
3067
+ var css_248z$s = "\n.widget-list-head{\r\n border: 1px solid hsla(0,0%,76.9%,.4);\n}\n.widget-list-head th{\r\n position: relative;\n}\n.head-cell{\r\n display: flex;\r\n cursor: pointer;\r\n padding: 5px 10px;\n}\n.head-cell-label{\r\n flex-grow: 1;\n}\n.separator{\r\n position: absolute;\r\n top: 0;\r\n z-index: 1;\n}\ni {\r\n border: solid black;\r\n border-width: 0 2px 2px 0;\r\n display: inline-block;\r\n padding: 3px;\n}\n.down {\r\n transform: rotate(45deg);\r\n -webkit-transform: rotate(45deg);\n}\n.up {\r\n transform: rotate(-135deg);\r\n -webkit-transform: rotate(-135deg);\n}\r\n";
3001
3068
  styleInject(css_248z$s);
3002
3069
 
3003
3070
  script$v.render = render$d;
@@ -3010,19 +3077,37 @@ const _hoisted_1$s = {
3010
3077
  var script$u = /*#__PURE__*/ vue.defineComponent({
3011
3078
  props: {
3012
3079
  filters: { type: null, required: false },
3013
- list: { type: null, required: true },
3014
- listWorker: { type: null, required: false }
3080
+ list: { type: null, required: true }
3015
3081
  },
3016
3082
  setup(__props) {
3017
3083
  const props = __props;
3018
3084
  const config = vue.computed(() => props.list.config.value);
3085
+ const { state } = useListState(props.list);
3086
+ const DEFAULT_ORDER_FIELD = 'id';
3087
+ function onSort(name = DEFAULT_ORDER_FIELD) {
3088
+ name = name.toLowerCase();
3089
+ // Сортировка была по другому полю
3090
+ if (state.order.field !== name)
3091
+ return props.list.order(name, 'asc');
3092
+ if (state.order.field === DEFAULT_ORDER_FIELD) {
3093
+ return props.list.order(name, state.order.direction === 'desc' ? 'asc' : 'desc');
3094
+ }
3095
+ if (state.order.direction === 'asc')
3096
+ return props.list.order(name, 'desc');
3097
+ props.list.order('Id', 'desc');
3098
+ }
3099
+ vue.onMounted(() => { });
3019
3100
  return (_ctx, _cache) => {
3020
3101
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3021
- vue.createCommentVNode("\r\n <widget-list-head-filters :filters = \"filters\"/>\r\n\r\n "),
3102
+ vue.createCommentVNode("\r\n <widget-list-head-filters :filters = \"filters\"/>\r\n "),
3022
3103
  (__props.list)
3023
3104
  ? (vue.openBlock(), vue.createElementBlock("table", _hoisted_1$s, [
3024
3105
  vue.createElementVNode("thead", null, [
3025
- vue.createVNode(script$v, { config: vue.unref(config) }, null, 8 /* PROPS */, ["config"])
3106
+ vue.createVNode(script$v, {
3107
+ config: vue.unref(config),
3108
+ onSort: onSort,
3109
+ "order-config": vue.unref(state).order
3110
+ }, null, 8 /* PROPS */, ["config", "order-config"])
3026
3111
  ]),
3027
3112
  vue.createElementVNode("tbody", null, [
3028
3113
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.list.array, (values, index) => {
@@ -4901,7 +4986,7 @@ function renderFormBody(props, children) {
4901
4986
 
4902
4987
  class Metadata extends EventEmitter {
4903
4988
  constructor() {
4904
- super(['update']);
4989
+ super();
4905
4990
  this.state = vue.reactive({
4906
4991
  ready: false,
4907
4992
  fields: {}
@@ -5100,7 +5185,6 @@ var classes = {
5100
5185
  Errors: CoreError,
5101
5186
  CoreError,
5102
5187
  Form,
5103
- EventEmitter,
5104
5188
  ListWorker,
5105
5189
  //RenderForm,
5106
5190
  ViewForm,
@@ -5240,6 +5324,44 @@ class viewService {
5240
5324
  }
5241
5325
  }
5242
5326
 
5327
+ class processWizardService {
5328
+ static getStartConfig(process, entity) {
5329
+ return __awaiter(this, void 0, void 0, function* () {
5330
+ return Request(`/close-api/views/process-wizard/${process}/${entity}`, {
5331
+ method: 'GET',
5332
+ headers: {
5333
+ 'Content-Type': 'application/json',
5334
+ },
5335
+ });
5336
+ });
5337
+ }
5338
+ static startProcess(process, entity) {
5339
+ return __awaiter(this, void 0, void 0, function* () {
5340
+ return Request(`/close-api/views/process-wizard/${process}/${entity}`, {
5341
+ method: 'POST',
5342
+ headers: {
5343
+ 'Content-Type': 'application/json',
5344
+ },
5345
+ });
5346
+ });
5347
+ }
5348
+ static runStep(process, entity, stepName, token, values) {
5349
+ return __awaiter(this, void 0, void 0, function* () {
5350
+ return Request(`/close-api/views/process-wizard/${process}/${entity}`, {
5351
+ method: 'PUT',
5352
+ headers: {
5353
+ 'Content-Type': 'application/json',
5354
+ },
5355
+ body: JSON.stringify({
5356
+ stepName,
5357
+ token,
5358
+ values
5359
+ })
5360
+ });
5361
+ });
5362
+ }
5363
+ }
5364
+
5243
5365
  const _hoisted_1$7 = { class: "breadcrumb__title" };
5244
5366
  var script$7 = /*#__PURE__*/ vue.defineComponent({
5245
5367
  props: {
@@ -5684,5 +5806,6 @@ exports.authService = authService;
5684
5806
  exports.communicationService = CommunicationService;
5685
5807
  exports.dataService = dataService;
5686
5808
  exports["default"] = index;
5809
+ exports.processWizardService = processWizardService;
5687
5810
  exports.requestHandler = requestHandler;
5688
5811
  exports.viewService = viewService;
@@ -1,5 +1,7 @@
1
1
  export default class processWizardService {
2
2
  static getStartConfig(process: string, entity: string): Promise<IProcessWizard>;
3
+ static startProcess(process: string, entity: string): Promise<any>;
4
+ static runStep(process: string, entity: string, stepName: string, token: string, values: any): Promise<any>;
3
5
  }
4
6
  interface IProcessWizard {
5
7
  processName: string;
@@ -7,22 +7,15 @@ declare const _default: import("vue").DefineComponent<{
7
7
  type: any;
8
8
  required: true;
9
9
  };
10
- listWorker: {
11
- type: any;
12
- required: false;
13
- };
14
10
  }, (_ctx: any, _cache: any) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
15
11
  [key: string]: any;
16
12
  }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
17
13
  filters?: unknown;
18
14
  list?: unknown;
19
- listWorker?: unknown;
20
15
  } & {
21
16
  filters: any;
22
17
  list: any;
23
- listWorker: any;
24
18
  } & {}>, {
25
19
  filters: any;
26
- listWorker: any;
27
20
  }>;
28
21
  export default _default;
@@ -4,7 +4,7 @@ declare const _default: {
4
4
  };
5
5
  props: {
6
6
  config: ArrayConstructor;
7
- sort: ObjectConstructor;
7
+ orderConfig: ObjectConstructor;
8
8
  };
9
9
  setup(): {
10
10
  onScale: (e: MouseEvent) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eservices-core",
3
- "version": "1.0.297",
3
+ "version": "1.0.300",
4
4
  "description": "----",
5
5
  "author": "",
6
6
  "scripts": {
@@ -17,6 +17,7 @@
17
17
  "dependencies": {
18
18
  "@rollup/plugin-commonjs": "^21.0.1",
19
19
  "date-and-time": "^2.0.1",
20
+ "jenesius-event-emitter": "^1.0.4",
20
21
  "rollup-plugin-styles": "^4.0.0",
21
22
  "rollup-plugin-typescript2": "^0.31.1",
22
23
  "socket.io": "^4.4.1",