eservices-core 1.0.458 → 1.0.460
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.
|
@@ -22,6 +22,7 @@ declare class ApplicationManager extends EventEmitter {
|
|
|
22
22
|
* @description Current customer id. If Application state is not ready - undefined.
|
|
23
23
|
*/
|
|
24
24
|
contextId?: number;
|
|
25
|
+
get contextType(): 'person' | 'organization' | undefined;
|
|
25
26
|
set type(type: ApplicationType);
|
|
26
27
|
get type(): ApplicationType;
|
|
27
28
|
get isBack(): boolean;
|
|
@@ -64,3 +65,7 @@ declare class ApplicationManager extends EventEmitter {
|
|
|
64
65
|
}
|
|
65
66
|
declare const Manager: ApplicationManager;
|
|
66
67
|
export { ApplicationManager, Manager };
|
|
68
|
+
export declare function useManagerState(): {
|
|
69
|
+
contextType: "person" | "organization";
|
|
70
|
+
contextId: number;
|
|
71
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ import ruleValidationService from "./services/rule-validation-service";
|
|
|
41
41
|
import openService from "./services/open-service";
|
|
42
42
|
import CoreError from "./classes/CoreError";
|
|
43
43
|
import ProcessWrap from "./classes/ProcessWrap";
|
|
44
|
-
import { ApplicationManager, Manager } from "./classes/ApplicationManager";
|
|
44
|
+
import { ApplicationManager, Manager, useManagerState } from "./classes/ApplicationManager";
|
|
45
45
|
import NotificationSystem from "./classes/NotificationSystem";
|
|
46
46
|
import List from "./classes/List";
|
|
47
47
|
import Communication from "./classes/Communication";
|
|
@@ -76,7 +76,7 @@ export { fileService, processWizardService, viewService, authService, dataServic
|
|
|
76
76
|
/**
|
|
77
77
|
* HOOKS
|
|
78
78
|
* */
|
|
79
|
-
export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData, useListFilter, useListOrder, useListState, useCustomerState, useTableState, useTableRequest, useCommunication, useFormRequest };
|
|
79
|
+
export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData, useListFilter, useListOrder, useListState, useCustomerState, useTableState, useTableRequest, useCommunication, useFormRequest, useManagerState };
|
|
80
80
|
/**
|
|
81
81
|
* All components binding with VueComponents must have name started with Widget.
|
|
82
82
|
* */
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* eservices-core v1.0.
|
|
2
|
+
* eservices-core v1.0.460
|
|
3
3
|
* (c) 2022 ESERVICES
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
@@ -4795,6 +4795,14 @@ class ApplicationManager extends EventEmitter {
|
|
|
4795
4795
|
*/
|
|
4796
4796
|
_ready.set(this, false);
|
|
4797
4797
|
}
|
|
4798
|
+
get contextType() {
|
|
4799
|
+
var _a;
|
|
4800
|
+
if (!this.contextId)
|
|
4801
|
+
return undefined;
|
|
4802
|
+
if (((_a = this.person) === null || _a === void 0 ? void 0 : _a.id) === this.contextId)
|
|
4803
|
+
return 'person';
|
|
4804
|
+
return 'organization';
|
|
4805
|
+
}
|
|
4798
4806
|
set type(type) {
|
|
4799
4807
|
__classPrivateFieldSet(this, _type, type);
|
|
4800
4808
|
}
|
|
@@ -4886,7 +4894,18 @@ ApplicationManager.EVENT_DATA_UPDATE = 'event:data-update';
|
|
|
4886
4894
|
* @description Key for localStorage, saving current context ID. using after user login to system
|
|
4887
4895
|
* */
|
|
4888
4896
|
ApplicationManager.CURRENT_CONTEXT_KEY = 'CurrentContext';
|
|
4889
|
-
const Manager = new ApplicationManager();
|
|
4897
|
+
const Manager = new ApplicationManager();
|
|
4898
|
+
function useManagerState() {
|
|
4899
|
+
const state = vue.reactive({
|
|
4900
|
+
contextType: Manager.contextType,
|
|
4901
|
+
contextId: Manager.contextId
|
|
4902
|
+
});
|
|
4903
|
+
Manager.onupdateContext(() => {
|
|
4904
|
+
state.contextType = Manager.contextType;
|
|
4905
|
+
state.contextId = Manager.contextId;
|
|
4906
|
+
});
|
|
4907
|
+
return state;
|
|
4908
|
+
}
|
|
4890
4909
|
|
|
4891
4910
|
class Communication extends EventEmitter {
|
|
4892
4911
|
constructor(talkId) {
|
|
@@ -4941,6 +4960,23 @@ function instanceOfDate(value) {
|
|
|
4941
4960
|
}
|
|
4942
4961
|
/**
|
|
4943
4962
|
* @description Generate filter's string by provided input data.
|
|
4963
|
+
* Eq,
|
|
4964
|
+
* Nq,
|
|
4965
|
+
* Gt,
|
|
4966
|
+
* Ge,
|
|
4967
|
+
* Lt,
|
|
4968
|
+
* Le,
|
|
4969
|
+
* And,
|
|
4970
|
+
* Or,
|
|
4971
|
+
* Is,
|
|
4972
|
+
* Null,
|
|
4973
|
+
* Not,
|
|
4974
|
+
* In,
|
|
4975
|
+
* Between,
|
|
4976
|
+
* Contains,
|
|
4977
|
+
* Like,
|
|
4978
|
+
* BeginWith,
|
|
4979
|
+
* EndWith
|
|
4944
4980
|
* */
|
|
4945
4981
|
function Filter(filters) {
|
|
4946
4982
|
return Object.keys(filters).reduce((arrayFilter, name) => {
|
|
@@ -4980,7 +5016,25 @@ function Filter(filters) {
|
|
|
4980
5016
|
}
|
|
4981
5017
|
return arrayFilter;
|
|
4982
5018
|
}, []).join(" and ");
|
|
4983
|
-
}
|
|
5019
|
+
}
|
|
5020
|
+
function wrapString(str) {
|
|
5021
|
+
return typeof str === 'string' ? `${str}'` : `${str}`;
|
|
5022
|
+
}
|
|
5023
|
+
Filter.notEq = function notEqual(name, values) {
|
|
5024
|
+
return `@${name} nq ${wrapString(values)}`;
|
|
5025
|
+
};
|
|
5026
|
+
Filter.eq = function equal(name, values) {
|
|
5027
|
+
if (Array.isArray(values))
|
|
5028
|
+
return Filter.in(name, values);
|
|
5029
|
+
return `@${name} eq ${wrapString(values)}`;
|
|
5030
|
+
};
|
|
5031
|
+
Filter.in = function include(name, values) {
|
|
5032
|
+
const parsedValues = values.map(wrapString).join(', ');
|
|
5033
|
+
return `@${name} in (${parsedValues})`;
|
|
5034
|
+
};
|
|
5035
|
+
Filter.and = function and(...expressions) {
|
|
5036
|
+
return expressions.join(' and ');
|
|
5037
|
+
};
|
|
4984
5038
|
|
|
4985
5039
|
/**
|
|
4986
5040
|
* @description Current method return link to static file.
|
|
@@ -5227,6 +5281,9 @@ function useFormRequestData(form, options) {
|
|
|
5227
5281
|
/**
|
|
5228
5282
|
* Return dynamic customer state: contextId, currentContext, person, organizations
|
|
5229
5283
|
* */
|
|
5284
|
+
/**
|
|
5285
|
+
* @deprecated Please try use useManagerState
|
|
5286
|
+
* */
|
|
5230
5287
|
function useCustomerState() {
|
|
5231
5288
|
/**
|
|
5232
5289
|
* @description Computed data of current context. Person or Organization
|
|
@@ -5404,6 +5461,7 @@ exports.useFormRequestData = useFormRequestData;
|
|
|
5404
5461
|
exports.useListFilter = useListFilter;
|
|
5405
5462
|
exports.useListOrder = useListOrder;
|
|
5406
5463
|
exports.useListState = useListState$1;
|
|
5464
|
+
exports.useManagerState = useManagerState;
|
|
5407
5465
|
exports.useSocket = useSocket;
|
|
5408
5466
|
exports.useTableRequest = useTableRequest;
|
|
5409
5467
|
exports.useTableState = useTableState;
|
package/dist/utils/Filter.d.ts
CHANGED
|
@@ -3,12 +3,37 @@ interface IFilters {
|
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
5
|
* @description Generate filter's string by provided input data.
|
|
6
|
+
* Eq,
|
|
7
|
+
* Nq,
|
|
8
|
+
* Gt,
|
|
9
|
+
* Ge,
|
|
10
|
+
* Lt,
|
|
11
|
+
* Le,
|
|
12
|
+
* And,
|
|
13
|
+
* Or,
|
|
14
|
+
* Is,
|
|
15
|
+
* Null,
|
|
16
|
+
* Not,
|
|
17
|
+
* In,
|
|
18
|
+
* Between,
|
|
19
|
+
* Contains,
|
|
20
|
+
* Like,
|
|
21
|
+
* BeginWith,
|
|
22
|
+
* EndWith
|
|
6
23
|
* */
|
|
7
|
-
|
|
24
|
+
declare function Filter(filters: IFilters): string;
|
|
25
|
+
declare namespace Filter {
|
|
26
|
+
export var notEq: (name: string, values: string | number) => string;
|
|
27
|
+
export var eq: (name: string, values: string | number | IFilterEnum) => string;
|
|
28
|
+
var _a: (name: string, values: IFilterEnum) => string;
|
|
29
|
+
export var and: (...expressions: string[]) => string;
|
|
30
|
+
export { _a as in };
|
|
31
|
+
}
|
|
32
|
+
export default Filter;
|
|
33
|
+
export declare type IFilterNumber = number;
|
|
8
34
|
export declare type IFilterString = string;
|
|
9
35
|
export declare type IFilterEnum = Array<number | string>;
|
|
10
36
|
export declare type IFilterDate = {
|
|
11
37
|
start?: string;
|
|
12
38
|
end?: string;
|
|
13
39
|
};
|
|
14
|
-
export {};
|