@colijnit/sharedcomponents 1.0.7 → 1.0.10
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.
- package/bundles/colijnit-sharedcomponents.umd.js +746 -0
- package/bundles/colijnit-sharedcomponents.umd.js.map +1 -0
- package/colijnit-sharedcomponents.d.ts +6 -0
- package/colijnit-sharedcomponents.metadata.json +1 -0
- package/esm2015/colijnit-sharedcomponents.js +7 -0
- package/esm2015/lib/components/docsign/component/signature/signature.component.js +75 -0
- package/esm2015/lib/components/docsign/component/signatures/signatures.component.js +44 -0
- package/esm2015/lib/components/docsign/docsign.component.js +225 -0
- package/esm2015/lib/components/docsign/docsign.module.js +23 -0
- package/esm2015/public-api.js +6 -0
- package/fesm2015/colijnit-sharedcomponents.js +372 -0
- package/fesm2015/colijnit-sharedcomponents.js.map +1 -0
- package/lib/components/docsign/component/signature/signature.component.d.ts +16 -0
- package/{src/lib → lib}/components/docsign/component/signature/style/_layout.scss +0 -0
- package/{src/lib → lib}/components/docsign/component/signature/style/_material-definition.scss +0 -0
- package/{src/lib → lib}/components/docsign/component/signature/style/_theme.scss +0 -0
- package/{src/lib → lib}/components/docsign/component/signature/style/material.scss +0 -0
- package/lib/components/docsign/component/signatures/signatures.component.d.ts +12 -0
- package/{src/lib → lib}/components/docsign/component/signatures/style/_layout.scss +0 -0
- package/{src/lib → lib}/components/docsign/component/signatures/style/_material-definition.scss +0 -0
- package/{src/lib → lib}/components/docsign/component/signatures/style/_theme.scss +0 -0
- package/{src/lib → lib}/components/docsign/component/signatures/style/material.scss +0 -0
- package/lib/components/docsign/docsign.component.d.ts +92 -0
- package/lib/components/docsign/docsign.module.d.ts +2 -0
- package/{src/lib → lib}/components/docsign/style/_layout.scss +0 -0
- package/{src/lib → lib}/components/docsign/style/_material-definition.scss +0 -0
- package/{src/lib → lib}/components/docsign/style/_theme.scss +0 -0
- package/{src/lib → lib}/components/docsign/style/material.scss +0 -0
- package/{src/lib → lib}/style/_mixin.scss +0 -0
- package/{src/lib → lib}/style/_variables.scss +0 -0
- package/package.json +25 -15
- package/public-api.d.ts +2 -0
- package/.browserslistrc +0 -16
- package/colijnit-sharedcomponents-1.0.7.tgz +0 -0
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -17
- package/src/lib/components/docsign/component/signature/signature.component.ts +0 -82
- package/src/lib/components/docsign/component/signatures/signatures.component.ts +0 -50
- package/src/lib/components/docsign/docsign.component.ts +0 -252
- package/src/lib/components/docsign/docsign.module.ts +0 -22
- package/src/lib/components/send-method-dialog/enums/send-option.ts +0 -6
- package/src/lib/components/send-method-dialog/send-method-dialog.component.ts +0 -215
- package/src/lib/components/send-method-dialog/send-method-dialog.module.ts +0 -27
- package/src/lib/components/send-method-dialog/style/_layout.scss +0 -186
- package/src/lib/components/send-method-dialog/style/_material-definition.scss +0 -1
- package/src/lib/components/send-method-dialog/style/_theme.scss +0 -7
- package/src/lib/components/send-method-dialog/style/material.scss +0 -4
- package/src/lib/components/stock/stock-information/stock-information.component.ts +0 -59
- package/src/lib/components/stock/stock-information-grid/stock-information-grid.component.ts +0 -278
- package/src/lib/components/stock/stock-location/stock-location.component.ts +0 -82
- package/src/lib/components/stock/stock-transfer/co-drop-down-list-fields.interface.ts +0 -4
- package/src/lib/components/stock/stock-transfer/stock-transfer.component.ts +0 -111
- package/src/lib/components/stock/stock.component.ts +0 -78
- package/src/lib/components/stock/stock.module.ts +0 -47
- package/src/lib/components/stock/style/_layout.scss +0 -206
- package/src/lib/components/stock/style/_material-definition.scss +0 -20
- package/src/lib/components/stock/style/_theme.scss +0 -8
- package/src/lib/components/stock/style/material.scss +0 -4
- package/src/lib/enum/icon.enum.ts +0 -22
- package/src/lib/factory/business-object-factory.ts +0 -120
- package/src/lib/factory/decorators/boolean.decorator.ts +0 -113
- package/src/lib/factory/decorators/complex-array.decorator.ts +0 -61
- package/src/lib/factory/decorators/complex-field.decorator.ts +0 -63
- package/src/lib/factory/decorators/date-field.decorator.ts +0 -41
- package/src/lib/factory/decorators/string-number.decorator.ts +0 -48
- package/src/lib/model/business-object.ts +0 -85
- package/src/lib/model/icon-svg.ts +0 -22
- package/src/lib/service/icon-cache.service.ts +0 -51
- package/src/lib/service/ione-connector-adapter.service.ts +0 -113
- package/src/lib/service/stock.service.ts +0 -35
- package/src/lib/utils/array-utils.ts +0 -202
- package/src/lib/utils/is-nill.function.ts +0 -4
- package/src/public-api.ts +0 -10
- package/src/test.ts +0 -27
- package/tsconfig.lib.json +0 -18
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {NumberUtils} from "@colijnit/articleapi/build/utils/number-utils";
|
|
2
|
-
|
|
3
|
-
const PROP_META_KEY: string = "stringNumber";
|
|
4
|
-
/**
|
|
5
|
-
* !! just a TAG DECORATOR for now, there is no code that uses this meta data within the ione connector lib itself.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Decorator for properties of businessobjects that are sent to us as strings from the database, but which we want to use as a number in the client.
|
|
10
|
-
*
|
|
11
|
-
* Can be handy for incongruent backend api cases, where id data types are communicated wrongly via strings instead of numbers
|
|
12
|
-
* (e.g. on EmployeeFullObject.district, points to a District which has a number id, but in employee it's a string representation of that number...)
|
|
13
|
-
*
|
|
14
|
-
* Used by business object factory and -serializer.
|
|
15
|
-
*
|
|
16
|
-
* Usage:
|
|
17
|
-
*
|
|
18
|
-
* @StringNumber()
|
|
19
|
-
* public rights: UserRightType
|
|
20
|
-
*/
|
|
21
|
-
export function StringNumber(): PropertyDecorator {
|
|
22
|
-
return function (target: any, propertyKey: string): void {
|
|
23
|
-
if (!target || !propertyKey) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
Reflect.defineMetadata(PROP_META_KEY, undefined, target, propertyKey);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Utility function holder of the @StringNumber() decorator.
|
|
31
|
-
export class StringNumberDecorator {
|
|
32
|
-
|
|
33
|
-
// Returns whether given property (as a string) on given object is decorated with @StringNumber().
|
|
34
|
-
public static IsStringNumber(target: Object, propertyKey: string): boolean {
|
|
35
|
-
if (!target || !propertyKey || typeof target !== "object") {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
return Reflect.hasMetadata(PROP_META_KEY, target, propertyKey);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public static StringAsNumber(str: string): number {
|
|
42
|
-
return NumberUtils.ParseFloatKeepPrecision(str);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public static NumberAsString(nr: number): string {
|
|
46
|
-
return "" + nr;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This type represents the concept of a business object ID type. ID's of business objects can be a primary number, a simple string or a
|
|
3
|
-
* object for a composite key.
|
|
4
|
-
*
|
|
5
|
-
* Simply to prevent type declarations of 'number | string | Object' for BO ID data all over the application.
|
|
6
|
-
*/
|
|
7
|
-
import {MapPropertyDecorator} from "@colijnit/articleapi/build/factory/decorators/map-property.decorator";
|
|
8
|
-
import {BooleanTextDecorator} from "@colijnit/articleapi/build/factory/decorators/boolean.decorator";
|
|
9
|
-
import {JsonFieldFieldDecorator} from "@colijnit/articleapi/build/factory/decorators/json.decorator";
|
|
10
|
-
import {ComplexArrayDecorator} from "@colijnit/articleapi/build/factory/decorators/complex-array.decorator";
|
|
11
|
-
|
|
12
|
-
export type BusinessObjectIDType = number | string | Object;
|
|
13
|
-
|
|
14
|
-
export abstract class BusinessObject {
|
|
15
|
-
// The ID of the model.
|
|
16
|
-
public id: BusinessObjectIDType;
|
|
17
|
-
|
|
18
|
-
// Overridable. Returns the ID of the model. Concrete model classes often override this method to provide their specific ID getter.
|
|
19
|
-
public getId(): BusinessObjectIDType {
|
|
20
|
-
return this.id;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
constructor() {
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
protected setOwnMappedPropsFromRawData(rawData: any = {}): void {
|
|
27
|
-
if (!rawData) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
Object.keys(this).forEach((key) => {
|
|
31
|
-
// check if property needs to be mapped
|
|
32
|
-
if (MapPropertyDecorator.IsMapProperty(this, key)) {
|
|
33
|
-
const mapKeys: string[] = MapPropertyDecorator.GetMapProperty(this, key).split(",");
|
|
34
|
-
const len: number = mapKeys.length;
|
|
35
|
-
for (let i: number = 0; i < len; i++) {
|
|
36
|
-
// eslint-disable-next-line
|
|
37
|
-
const mapKey = mapKeys[i].trim();
|
|
38
|
-
const objProp: any = rawData[mapKey];
|
|
39
|
-
let decorated: boolean = false;
|
|
40
|
-
if (rawData.hasOwnProperty(mapKey)) {
|
|
41
|
-
if (BooleanTextDecorator.IsBooleanTextField(this, key)) {
|
|
42
|
-
this[key] = BooleanTextDecorator.GetLogicalBooleanValue(objProp);
|
|
43
|
-
decorated = true;
|
|
44
|
-
}
|
|
45
|
-
if (JsonFieldFieldDecorator.IsJsonField(this, key)) {
|
|
46
|
-
this[key] = JsonFieldFieldDecorator.StringAsJson(objProp);
|
|
47
|
-
decorated = true;
|
|
48
|
-
}
|
|
49
|
-
if (ComplexArrayDecorator.IsComplexArray(this, key)) {
|
|
50
|
-
const arrayClass: any = ComplexArrayDecorator.GetComplexArrayType(this, key);
|
|
51
|
-
// eslint-disable-next-line
|
|
52
|
-
const origArray = this[key];
|
|
53
|
-
// eslint-disable-next-line
|
|
54
|
-
const newArray = [];
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
56
|
-
for (let j = 0; j < origArray.length; j++) {
|
|
57
|
-
// eslint-disable-next-line
|
|
58
|
-
const item = new arrayClass(origArray[j]);
|
|
59
|
-
newArray.push(item);
|
|
60
|
-
}
|
|
61
|
-
this[key] = newArray;
|
|
62
|
-
} else {
|
|
63
|
-
if (!decorated) {
|
|
64
|
-
this[key] = objProp;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
if (rawData.hasOwnProperty(key)) {
|
|
72
|
-
const objProp: any = rawData[key];
|
|
73
|
-
if (BooleanTextDecorator.IsBooleanTextField(this, key)) {
|
|
74
|
-
this[key] = BooleanTextDecorator.GetLogicalBooleanValue(objProp);
|
|
75
|
-
} else if (JsonFieldFieldDecorator.IsJsonField(this, key)) {
|
|
76
|
-
this[key] = JsonFieldFieldDecorator.StringAsJson(objProp);
|
|
77
|
-
} else {
|
|
78
|
-
this[key] = objProp;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/** AUTO GENERATED FILE. DO NOT CHANGE.. OR YOU WILL SUFFER THE CONSEQUENCES OF YOUR ACTIONS **/
|
|
2
|
-
|
|
3
|
-
export const IconSvg: {[iconName: string]: string} = {
|
|
4
|
-
"arrow_fat_right": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><polygon points=\"37.5 25 25.2 12.7 25.2 20.35 12.5 20.35 12.5 29.66 25.2 29.66 25.2 37.3 37.5 25\" fill=\"#484f60\"/></svg>",
|
|
5
|
-
"arrow_point_down": "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" viewBox=\"-280 371 51 51\" enable-background=\"new -280 371 51 51\" ><path fill=\"#29363E\" d=\"M-248.3,392.2c0.3,0,0.6,0.1,0.8,0.3c0.5,0.5,0.5,1.2,0,1.6l-6.2,6.2c-0.2,0.2-0.5,0.3-0.8,0.3c-0.3,0-0.6-0.1-0.8-0.3l-6.2-6.2c-0.2-0.2-0.3-0.5-0.3-0.8c0-0.3,0.1-0.6,0.3-0.8c0.2-0.2,0.5-0.3,0.8-0.3c0.3,0,0.6,0.1,0.8,0.3l5.4,5.4l5.4-5.4C-248.9,392.4-248.6,392.2-248.3,392.2z\"/></svg>",
|
|
6
|
-
"arrow_point_left": "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" viewBox=\"0 0 51 51\" enable-background=\"new 0 0 51 51\" ><path fill=\"#484F5F\" d=\"M31.9,36.7l-14.7-9.6C17.1,27,17,26.9,17,26.7v-2.4c0-0.2,0.1-0.3,0.2-0.4l14.7-9.6c0.2-0.2,0.5-0.1,0.7,0.1l1.4,2.1c0.2,0.2,0.1,0.5-0.1,0.7l-12,7.8c-0.3,0.2-0.3,0.6,0,0.8l12,7.8c0.2,0.2,0.3,0.5,0.1,0.7l-1.4,2.1C32.4,36.8,32.1,36.8,31.9,36.7z\"/></svg>",
|
|
7
|
-
"arrow_point_right": "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" viewBox=\"0 0 51 51\" enable-background=\"new 0 0 51 51\" ><path fill=\"#484F5F\" d=\"M19.1,14.3l14.7,9.6c0.1,0.1,0.2,0.2,0.2,0.4v2.4c0,0.2-0.1,0.3-0.2,0.4l-14.7,9.6c-0.2,0.2-0.5,0.1-0.7-0.1l-1.4-2.1c-0.2-0.2-0.1-0.5,0.1-0.7l12-7.8c0.3-0.2,0.3-0.6,0-0.8l-12-7.8c-0.2-0.2-0.3-0.5-0.1-0.7l1.4-2.1C18.6,14.2,18.9,14.2,19.1,14.3z\"/></svg>",
|
|
8
|
-
"calendar_day": "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" viewBox=\"0 0 50 50\" enable-background=\"new 0 0 50 50\" ><g><path fill=\"#022D42\" d=\"M35.4,13.7H14.6c-0.6,0-1,0.5-1,1V20h22.9v-5.2C36.4,14.2,36,13.7,35.4,13.7z M19,18.8c-1,0-1.8-0.8-1.8-1.8c0-1,0.8-1.8,1.8-1.8c1,0,1.8,0.8,1.8,1.8C20.8,18,20,18.8,19,18.8z M31,18.8c-1,0-1.8-0.8-1.8-1.8c0-1,0.8-1.8,1.8-1.8s1.8,0.8,1.8,1.8C32.7,18,32,18.8,31,18.8z\"/><path fill=\"#022D42\" d=\"M35.4,22.3v12.6L31.3,39H14.6c0,0,0,0,0,0V22.3H35.4 M36.4,21.3H13.6V39c0,0.6,0.5,1,1,1h17.2l4.7-4.7V21.3L36.4,21.3z\"/><rect x=\"18.2\" y=\"10\" fill=\"#022D42\" width=\"1.6\" height=\"5.2\"/><rect x=\"30.2\" y=\"10\" fill=\"#022D42\" width=\"1.6\" height=\"5.2\"/><rect x=\"18.6\" y=\"30.5\" fill=\"#022D42\" width=\"3.4\" height=\"3.4\"/><rect x=\"19.1\" y=\"24.8\" opacity=\"0.1\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"19.1\" y=\"27.9\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"19.1\" y=\"34.1\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"22.2\" y=\"24.8\" opacity=\"0.1\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"22.2\" y=\"27.9\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"22.2\" y=\"31\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"22.2\" y=\"34.1\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"25.4\" y=\"31\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"25.4\" y=\"24.8\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"25.4\" y=\"27.9\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"25.4\" y=\"34.1\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"31.6\" y=\"31\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"31.6\" y=\"24.8\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"31.6\" y=\"27.9\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"28.5\" y=\"27.9\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"28.5\" y=\"24.8\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"28.5\" y=\"31\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"28.5\" y=\"34.1\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"16\" y=\"24.8\" opacity=\"0.1\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"16\" y=\"27.9\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"16\" y=\"31\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/><rect x=\"16\" y=\"34.1\" opacity=\"0.25\" fill=\"#022D42\" width=\"2.4\" height=\"2.4\"/></g></svg>",
|
|
9
|
-
"cancel": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><polygon points=\"36 35.16 30.45 35.16 14 14.84 19.55 14.84 36 35.16\" fill=\"#484f60\"/><polygon points=\"14 35.16 19.55 35.16 36 14.84 30.45 14.84 14 35.16\" fill=\"#484f60\"/></svg>",
|
|
10
|
-
"delivery_truck": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><rect x=\"15.35\" y=\"16.56\" width=\"15.14\" height=\"10.94\" transform=\"translate(-1.83 2.08) rotate(-5)\" fill=\"#484f60\"/><path d=\"M38.5,18.1l-6.9.61L32.41,28l-7.63.67a3.76,3.76,0,0,1,1.43,2.25l7.25-.63A3.83,3.83,0,0,1,41,29.6l1-.1-.52-6Zm.29,5.84-3.91.34a.51.51,0,0,1-.55-.46L34,20.1a.49.49,0,0,1,.45-.54l2.27-.2a.5.5,0,0,1,.48.25l2,3.59A.5.5,0,0,1,38.79,23.94Z\" fill=\"#484f60\"/><path d=\"M19.66,29.09a3.8,3.8,0,0,0-1,2.46l-.74.07-1.82-.94L16,29.41Z\" fill=\"#484f60\"/><path d=\"M34.56,30.62a2.74,2.74,0,1,0,2.49-3A2.73,2.73,0,0,0,34.56,30.62Z\" fill=\"#484f60\"/><path d=\"M19.74,31.91a2.74,2.74,0,1,0,2.49-3A2.74,2.74,0,0,0,19.74,31.91Z\" fill=\"#484f60\"/><rect x=\"7.96\" y=\"17.63\" width=\"5\" height=\"1\" transform=\"translate(-1.54 0.98) rotate(-5)\" fill=\"#484f60\"/><rect x=\"11.02\" y=\"29.71\" width=\"3\" height=\"1\" transform=\"translate(-2.59 1.21) rotate(-5)\" fill=\"#484f60\"/><rect x=\"9.48\" y=\"23.53\" width=\"4\" height=\"1\" transform=\"matrix(1, -0.09, 0.09, 1, -2.05, 1.09)\" fill=\"#484f60\"/></svg>",
|
|
11
|
-
"edit_pencil": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><polygon points=\"12.54 38.16 12 37.62 14.85 29.64 20.52 35.31 12.54 38.16\" fill=\"#484f60\"/><rect x=\"16.33\" y=\"20.52\" width=\"17.99\" height=\"8.64\" transform=\"translate(-10.15 25.18) rotate(-45)\" fill=\"#484f60\"/><path d=\"M37.54,18.73,36,20.32l-6.11-6.1,1.59-1.59a1.55,1.55,0,0,1,2.2,0l3.91,3.9A1.55,1.55,0,0,1,37.54,18.73Z\" fill=\"#484f60\"/></svg>",
|
|
12
|
-
"email": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M31.79,38.45A17.82,17.82,0,0,1,23.86,40,13.09,13.09,0,0,1,10.41,26.42C10.41,17.63,16.83,10,26.53,10c7.63,0,13.06,5.21,13.06,12.46,0,6.33-3.53,10.3-8.19,10.3a3.42,3.42,0,0,1-3.71-3.32h-.08A6.5,6.5,0,0,1,22,32.76c-2.75,0-4.82-2.11-4.82-5.65a9.85,9.85,0,0,1,10.13-10,12.89,12.89,0,0,1,5.13,1l-1.3,8c-.43,2.54-.13,3.71,1.08,3.75,1.85.09,4.18-2.28,4.18-7.28,0-5.65-3.62-10-10.3-10S13.73,17.76,13.73,26c0,7.25,4.57,11.3,11,11.3A14.81,14.81,0,0,0,31,36ZM28,20.65a5.34,5.34,0,0,0-1.33-.18c-2.85,0-5.09,2.81-5.09,6.12,0,1.64.73,2.68,2.16,2.68,1.59,0,3.27-2,3.66-4.53Z\" fill=\"#484f60\"/></svg>",
|
|
13
|
-
"pdf": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M31.42,40.17H13.88c-2.16,0-2.72-.56-2.72-2.72V12.88c0-2.15.56-2.71,2.72-2.71h11.6l8.66,8.88v3.43H32.8V19.6l-7.88-8.09h-11c-1.38,0-1.38,0-1.38,1.37V37.45c0,1.37,0,1.37,1.38,1.37H31.42c1.38,0,1.38,0,1.38-1.37V35h1.34v2.43C34.14,39.61,33.58,40.17,31.42,40.17Z\" fill=\"#484f60\"/><path d=\"M27.83,26.63v4.24h1a3.57,3.57,0,0,0,.78-.06,1.22,1.22,0,0,0,.52-.26,1.44,1.44,0,0,0,.34-.62,4.13,4.13,0,0,0,.13-1.18,3.79,3.79,0,0,0-.13-1.14,1.51,1.51,0,0,0-.37-.62,1.14,1.14,0,0,0-.6-.3,5.93,5.93,0,0,0-1.06-.06Z\" fill=\"#484f60\"/><path d=\"M21.86,26.63v1.82h.71a3.57,3.57,0,0,0,1-.1A.88.88,0,0,0,24,28a.84.84,0,0,0,.14-.5.8.8,0,0,0-.2-.57.88.88,0,0,0-.52-.29,6.36,6.36,0,0,0-.93,0Z\" fill=\"#484f60\"/><path d=\"M19.14,24.27v9h19.7v-9Zm6.12,4.24a1.68,1.68,0,0,1-.54.63,1.9,1.9,0,0,1-.67.3,6.57,6.57,0,0,1-1.34.1h-.85V32H20.57V25.54h2.07a7.75,7.75,0,0,1,1.54.1,1.73,1.73,0,0,1,.93.63,2,2,0,0,1,.37,1.25A2,2,0,0,1,25.26,28.51Zm6.45,1.66A2.91,2.91,0,0,1,31,31.31a2.28,2.28,0,0,1-.91.51A4,4,0,0,1,29,32H26.54V25.54H28.9a4.21,4.21,0,0,1,1.22.13,2.08,2.08,0,0,1,1,.59,2.79,2.79,0,0,1,.61,1,4.76,4.76,0,0,1,.21,1.52A4.19,4.19,0,0,1,31.71,30.17Zm5.7-3.54h-3.1v1.52H37v1.08H34.31V32H33V25.54h4.39Z\" fill=\"#484f60\"/><path d=\"M25.2,10.84v6.44c0,1.78.27,2,2,2h6.23Z\" fill=\"#484f60\"/></svg>",
|
|
14
|
-
"plus_round": "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" viewBox=\"-288 379 35 35\" enable-background=\"new -288 379 35 35\" ><path fill=\"#29363E\" d=\"M-270.5,381.5c-8.3,0-15,6.7-15,15c0,8.3,6.7,15,15,15s15-6.7,15-15C-255.5,388.2-262.2,381.5-270.5,381.5z M-261.1,397.3c0,0.9-0.7,1.6-1.6,1.6h-5.5v5.5c0,0.9-0.7,1.6-1.6,1.6h-1.6c-0.9,0-1.6-0.7-1.6-1.6v-5.5h-5.5c-0.9,0-1.6-0.7-1.6-1.6v-1.6c0-0.9,0.7-1.6,1.6-1.6h5.5v-5.5c0-0.9,0.7-1.6,1.6-1.6h1.6c0.9,0,1.6,0.7,1.6,1.6v5.5h5.5c0.9,0,1.6,0.7,1.6,1.6V397.3z\"/></svg>",
|
|
15
|
-
"print": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M38,16.5H12a2,2,0,0,0-2,2v9a2,2,0,0,0,2,2h2v-5H36v5h2a2,2,0,0,0,2-2v-9A2,2,0,0,0,38,16.5ZM37,21a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,37,21Z\" fill=\"#484f60\"/><path d=\"M35,11.5v5H15v-5H35m1-1H14v7H36v-7Z\" fill=\"#484f60\"/><path d=\"M35,25.5v13H15v-13H35m1-1H14v15H36v-15Z\" fill=\"#484f60\"/><rect x=\"17\" y=\"28.3\" width=\"16\" height=\"0.8\" fill=\"#484f60\"/><rect x=\"17\" y=\"31.5\" width=\"16\" height=\"0.8\" fill=\"#484f60\"/><rect x=\"17\" y=\"34.7\" width=\"16\" height=\"0.8\" fill=\"#484f60\"/></svg>",
|
|
16
|
-
"signature_field": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M20.1,25.42a1.1,1.1,0,1,1,1.27,1.45l-3.3,9.07A63.13,63.13,0,0,1,28,28.3l1.26-12-8.26-3-6.77,10A62.4,62.4,0,0,1,17,35.54l3.3-9.07A1.12,1.12,0,0,1,20.1,25.42Z\" fill=\"#484f60\"/><rect x=\"21.62\" y=\"11.43\" width=\"8.79\" height=\"2.34\" transform=\"translate(5.88 -8.14) rotate(20)\" fill=\"#484f60\"/><path d=\"M18.11,37.48c1.44,2.65,4.58,2.94,7.23,2.1,1.41-.44,2.2-1.49,3.44-2.06,2.42-1.1,3.13,1.2,5.36,1.37.42,0,2-.65,1.54-.68-2.55-.19-2.93-3.13-5.51-2.65a4.9,4.9,0,0,0-1.64.71c-.77.49-1.31,1.62-2.07,2l-4.61.56A3.38,3.38,0,0,1,20,37c-.22-.41-2,.28-1.85.5Z\" fill=\"#484f60\"/></svg>",
|
|
17
|
-
"tag": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M40,29.15v-.68a5.28,5.28,0,0,0-1.34-3.25L24.78,11.34A5.34,5.34,0,0,0,21.53,10H11.9A1.91,1.91,0,0,0,10,11.9v9.63a5.28,5.28,0,0,0,1.34,3.25L25.22,38.66A5.28,5.28,0,0,0,28.47,40h.68a5.28,5.28,0,0,0,3.24-1.34l6.27-6.27A5.28,5.28,0,0,0,40,29.15ZM13.13,16.72a2.54,2.54,0,1,1,3.59,0A2.55,2.55,0,0,1,13.13,16.72Zm15.9,19L17.84,24.55l1.34-1.34L30.37,34.4Zm2.69-2.69L20.52,21.87l1.35-1.35,11.19,11.2Zm2.68-2.69L23.21,19.18l1.34-1.34L35.75,29Z\" fill=\"#484f60\"/></svg>",
|
|
18
|
-
"thick_lines": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><rect x=\"10\" y=\"12.67\" width=\"30\" height=\"7\" fill=\"#484f60\"/><rect x=\"10\" y=\"21.67\" width=\"30\" height=\"7\" fill=\"#484f60\"/><rect x=\"10\" y=\"30.67\" width=\"30\" height=\"7\" fill=\"#484f60\"/></svg>",
|
|
19
|
-
"thin_lines": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><rect x=\"10\" y=\"14.17\" width=\"30\" height=\"4\" fill=\"#484f60\"/><rect x=\"10\" y=\"20.17\" width=\"30\" height=\"4\" fill=\"#484f60\"/><rect x=\"10\" y=\"26.17\" width=\"30\" height=\"4\" fill=\"#484f60\"/><rect x=\"10\" y=\"32.17\" width=\"30\" height=\"4\" fill=\"#484f60\"/></svg>",
|
|
20
|
-
"txt": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M31.42,40.17H13.87c-2.15,0-2.71-.56-2.71-2.72V12.88c0-2.15.56-2.71,2.71-2.71H25.48l8.66,8.88v3.43H32.8V19.6l-7.88-8.09H13.87c-1.37,0-1.37,0-1.37,1.37V37.45c0,1.37,0,1.37,1.37,1.37H31.42c1.38,0,1.38,0,1.38-1.37V35h1.34v2.43C34.14,39.61,33.58,40.17,31.42,40.17Z\" fill=\"#484f60\"/><path d=\"M25.2,10.84v6.44c0,1.78.27,2,2,2h6.23Z\" fill=\"#484f60\"/><path d=\"M19.14,24.27v9h19.7v-9Zm6.68,2.36h-1.9V32h-1.3V26.63h-1.9V25.54h5.1ZM30.4,32,29,29.74,27.55,32H26l2.19-3.34-2-3.07h1.52L29,27.6l1.26-2.06h1.5l-2,3.12L32,32Zm6.86-5.32h-1.9V32H34.07V26.63H32.16V25.54h5.1Z\" fill=\"#484f60\"/></svg>",
|
|
21
|
-
"xml": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M31.42,40.17H13.87c-2.15,0-2.71-.56-2.71-2.72V12.88c0-2.15.56-2.71,2.71-2.71H25.48l8.66,8.88v3.43H32.8V19.6l-7.88-8.09H13.87c-1.37,0-1.37,0-1.37,1.37V37.45c0,1.37,0,1.37,1.37,1.37H31.42c1.38,0,1.38,0,1.38-1.37V35h1.34v2.43C34.14,39.61,33.58,40.17,31.42,40.17Z\" fill=\"#484f60\"/><path d=\"M25.2,10.84v6.44c0,1.78.27,2,2,2h6.23Z\" fill=\"#484f60\"/><path d=\"M19.14,24.27v9h19.7v-9Zm5.36,7.41-1.3-2-1.3,2H20.48l2-3.06-1.81-2.8h1.38l1.18,1.88,1.15-1.88h1.37l-1.83,2.85,2,3Zm7.67,0h-1.1V27.07l-1.16,4.61H28.77l-1.16-4.61v4.61H26.52V25.82h1.76l1.07,4,1-4h1.77Zm5.33,0H33.38V25.87h1.18v4.82H37.5Z\" fill=\"#484f60\"/></svg>"
|
|
22
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {Injectable} from "@angular/core";
|
|
2
|
-
import {DomSanitizer, SafeHtml} from "@angular/platform-browser";
|
|
3
|
-
import {Icon} from "../enum/icon.enum";
|
|
4
|
-
import {IconSvg} from "../model/icon-svg";
|
|
5
|
-
|
|
6
|
-
@Injectable({
|
|
7
|
-
providedIn: "root"
|
|
8
|
-
})
|
|
9
|
-
export class IconCacheService {
|
|
10
|
-
/**
|
|
11
|
-
* All the icons as a large JSON object, from the all-icons.json file.
|
|
12
|
-
* The object has property keys that are the icon names, and property values with the data string of the actual svg icon.
|
|
13
|
-
*/
|
|
14
|
-
public get iconCache(): { [iconName: string]: SafeHtml } {
|
|
15
|
-
return this._iconCache;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
private _iconCache: { [iconName: string]: SafeHtml } = {};
|
|
19
|
-
|
|
20
|
-
constructor(
|
|
21
|
-
private _sanitizer: DomSanitizer
|
|
22
|
-
) {
|
|
23
|
-
this.setIconCache();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public getIcon(iconName: Icon): SafeHtml {
|
|
27
|
-
if (iconName) {
|
|
28
|
-
return this._iconCache[iconName.toLowerCase()];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public getIconAsBase64(iconName: Icon): SafeHtml {
|
|
33
|
-
const icon: string = IconSvg[iconName];
|
|
34
|
-
const base64Data: string = window.btoa(icon);
|
|
35
|
-
return this._sanitizer.bypassSecurityTrustUrl(`data:image/svg+xml;base64,${base64Data}`);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public getRawIcon(iconName: Icon): string {
|
|
39
|
-
if (iconName) {
|
|
40
|
-
return IconSvg[iconName.toLowerCase()];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public setIconCache(): void {
|
|
45
|
-
for (const key in IconSvg) {
|
|
46
|
-
if (IconSvg.hasOwnProperty(key) && typeof IconSvg[key] !== "function") {
|
|
47
|
-
this._iconCache[key.toLowerCase()] = this._sanitizer.bypassSecurityTrustHtml(IconSvg[key]);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import {Articles} from "@colijnit/articleapi/build/articles";
|
|
2
|
-
import {Sharedapi} from "@colijnit/sharedapi/build/sharedapi";
|
|
3
|
-
import {Printer} from "@colijnit/sharedapi/build/model/printer.bo";
|
|
4
|
-
import {Injectable} from "@angular/core";
|
|
5
|
-
import {ArticleExtended} from "@colijnit/articleapi/build/model/article-extended.bo";
|
|
6
|
-
import {DataServiceResponseData} from "@colijnit/articleapi/build/model/data-service-response-data";
|
|
7
|
-
import {DataServiceResponseData as DataServiceResponse} from "@colijnit/sharedapi/build/model/data-service-response-data";
|
|
8
|
-
import {BusinessObjectFactory} from "../factory/business-object-factory";
|
|
9
|
-
import {PrintStockStickers} from "@colijnit/articleapi/build/model/print-stock-stickers";
|
|
10
|
-
import {ArticleFlat} from "@colijnit/articleapi/build/model/article-flat.bo";
|
|
11
|
-
import {ArticlesPublic} from "@colijnit/articleapi/build/articles-public";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@Injectable({
|
|
15
|
-
providedIn: "root"
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
export class IoneConnectorAdapterService {
|
|
19
|
-
public options: any;
|
|
20
|
-
public connector: Articles;
|
|
21
|
-
public sharedConnector: Sharedapi;
|
|
22
|
-
|
|
23
|
-
private _boFactory: BusinessObjectFactory = new BusinessObjectFactory();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
constructor() {
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public async connect(options: any): Promise<void> {
|
|
30
|
-
if (this.options === undefined) {
|
|
31
|
-
this.options = options;
|
|
32
|
-
this.connector = new Articles(options);
|
|
33
|
-
this.sharedConnector = new Sharedapi(options);
|
|
34
|
-
this.options.session = this.connector.session && this.sharedConnector.session;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public async disconnect(): Promise<void> {
|
|
39
|
-
this.options = undefined;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public async getAllPrinters(showAll: boolean = true): Promise<Printer[]> {
|
|
43
|
-
return new Promise((resolve: Function, reject: Function) => {
|
|
44
|
-
return this.sharedConnector.getAllPrinters(showAll).then((result: DataServiceResponse) => {
|
|
45
|
-
if (result.validationResult && result.validationResult.success) {
|
|
46
|
-
if (result.resultObject) {
|
|
47
|
-
resolve(this._boFactory.makeBOArrayFromRawBackendDataArray(Printer, result.resultObject));
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
reject(result.validationMessagesAsString);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public async getPrintStockStickers(request: PrintStockStickers): Promise<PrintStockStickers> {
|
|
57
|
-
return new Promise((resolve: Function, reject: Function) => {
|
|
58
|
-
return this.sharedConnector.getPrintStockStickers(request).then((result: DataServiceResponse) => {
|
|
59
|
-
if (result.validationResult && result.validationResult.success) {
|
|
60
|
-
if (result.resultObject) {
|
|
61
|
-
resolve(this._boFactory.makeWithRawBackendData(PrintStockStickers, result.resultObject));
|
|
62
|
-
}
|
|
63
|
-
} else {
|
|
64
|
-
reject(result.validationMessagesAsString);
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public async getArticleFullObject(goodId: number): Promise<ArticleExtended> {
|
|
71
|
-
return new Promise((resolve: Function, reject: Function) => {
|
|
72
|
-
return this.connector.getArticleFullObject(goodId).then((result: DataServiceResponseData) => {
|
|
73
|
-
// if (result.validationResult && result.validationResult.success) {
|
|
74
|
-
// if (result.resultObject) {
|
|
75
|
-
// resolve(this._boFactory.makeWithRawBackendData(ArticleExtended, result.resultObject));
|
|
76
|
-
// }
|
|
77
|
-
// } else {
|
|
78
|
-
// reject(result.validationMessagesAsString);
|
|
79
|
-
// }
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
public async getArticleFlatObject(goodId: number): Promise<ArticleFlat> {
|
|
85
|
-
return new Promise((resolve: Function, reject: Function) => {
|
|
86
|
-
return this.connector.getArticleFullObject(goodId).then((result: DataServiceResponseData) => {
|
|
87
|
-
if (result.validationResult && result.validationResult.success) {
|
|
88
|
-
if (result.resultObject) {
|
|
89
|
-
resolve(this._boFactory.makeWithRawBackendData(ArticleFlat, result.resultObject));
|
|
90
|
-
}
|
|
91
|
-
} else {
|
|
92
|
-
reject(result.validationMessagesAsString);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public async getWarehouses(goodId: number): Promise<ArticlesPublic> {
|
|
99
|
-
return new Promise((resolve: Function, reject: Function) => {
|
|
100
|
-
return this.connector.getWarehouses(goodId).then((result: DataServiceResponseData) => {
|
|
101
|
-
if (result.validationResult && result.validationResult.success) {
|
|
102
|
-
if (result.resultObject) {
|
|
103
|
-
resolve(this._boFactory.makeWithRawBackendData(ArticlesPublic, result.resultObject));
|
|
104
|
-
}
|
|
105
|
-
} else {
|
|
106
|
-
reject(result.validationMessagesAsString);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {Injectable} from "@angular/core";
|
|
2
|
-
import {IoneConnectorAdapterService} from "./ione-connector-adapter.service";
|
|
3
|
-
import {PrintStockStickers} from "@colijnit/articleapi/build/model/print-stock-stickers";
|
|
4
|
-
import {ArticleFlat} from "@colijnit/articleapi/build/model/article-flat.bo";
|
|
5
|
-
import {Printer} from "@colijnit/sharedapi/build/model/printer.bo";
|
|
6
|
-
|
|
7
|
-
@Injectable()
|
|
8
|
-
export class StockService {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
public stockStickers: PrintStockStickers;
|
|
12
|
-
|
|
13
|
-
constructor(
|
|
14
|
-
private _connector: IoneConnectorAdapterService,
|
|
15
|
-
) {
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public connectConnector(options: any): void {
|
|
20
|
-
this._connector.connect(options);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public async getPrintStockStickers(data: PrintStockStickers): Promise<void> {
|
|
24
|
-
await this._connector.getPrintStockStickers(data);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public async getAllPrinters(showAll: boolean = true): Promise<Printer[]> {
|
|
28
|
-
return await this._connector.getAllPrinters(showAll);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public async loadStockLocations(goodId: number): Promise<ArticleFlat> {
|
|
32
|
-
return await this._connector.getArticleFlatObject(goodId);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import {ObjectUtils} from "@colijnit/articleapi/build/utils/object-utils";
|
|
2
|
-
import {NumberUtils} from "@colijnit/articleapi/build/utils/number-utils";
|
|
3
|
-
import {isNill} from "@colijnit/articleapi/build/utils/function/is-nill.function";
|
|
4
|
-
import {notNill} from "@colijnit/articleapi/build/utils/function/not-nill.function";
|
|
5
|
-
|
|
6
|
-
export class ArrayUtils {
|
|
7
|
-
/**
|
|
8
|
-
* Returns whether at least one element in given array could be found by given finder function.
|
|
9
|
-
*
|
|
10
|
-
* @param {T[]} array
|
|
11
|
-
* @param {(element: T) => boolean} finder A finder function that takes an element of the array and returns a boolean that represents
|
|
12
|
-
* the 'found status' for that element; whether it should have been found or not.
|
|
13
|
-
*/
|
|
14
|
-
public static ContainsAnElementFoundBy<T>(array: T[], finder: (element: T) => boolean): boolean {
|
|
15
|
-
if (!array || !finder) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return notNill(this.Find<T>(array, finder));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Cross-browser Array.find() function. Returns the first item in given array for which the foundBy function returns true. Returns
|
|
24
|
-
* undefined when none was found.
|
|
25
|
-
*
|
|
26
|
-
* Example usage:
|
|
27
|
-
* const foundItem: BusinessObject = ArrayUtils.Find<BusinessObject>(modelArray, (modelItem: BusinessObject) => <br>
|
|
28
|
-
* (return modelItem.getId() === '1')
|
|
29
|
-
* * });
|
|
30
|
-
*
|
|
31
|
-
* @param array The array with items to search in.
|
|
32
|
-
* @param foundBy The finder function applied on each items of the array, when that returns true, the item is considered found.
|
|
33
|
-
*/
|
|
34
|
-
public static Find<T>(array: T[], foundBy: (item: T) => boolean): T {
|
|
35
|
-
if (!array || !foundBy) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
for (let i: number = 0, len: number = array.length; i < len; i++) {
|
|
40
|
-
const itemCur: T = array[i];
|
|
41
|
-
if (foundBy(itemCur) ) {
|
|
42
|
-
return itemCur;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// @returns empty array when nothing found, otherwise array with found items
|
|
49
|
-
public static FindAll<T>(array: T[], foundBy: (item: T) => boolean): T[] {
|
|
50
|
-
const answer: T[] = [];
|
|
51
|
-
if (!array || !foundBy) {
|
|
52
|
-
return answer;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
for (let i: number = 0, len: number = array.length; i < len; i++) {
|
|
56
|
-
const itemCur: T = array[i];
|
|
57
|
-
if (foundBy(itemCur)) {
|
|
58
|
-
answer.push(itemCur);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return answer;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// returns a simple clone of given array, using array.slice(0)
|
|
65
|
-
public static CloneArray<T>(array: T[]): T[] {
|
|
66
|
-
let answer: T[] = [];
|
|
67
|
-
|
|
68
|
-
if (array) {
|
|
69
|
-
answer = array.slice(0);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return answer;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Returns a 'semi deep clone' of given array. Its first-level members are object-shallow-cloned (optionally with a strongly typed constructor),
|
|
77
|
-
* or just as plain object (see param arrayItemsClass).
|
|
78
|
-
* @param array
|
|
79
|
-
* @param arrayItemsClass If provided, the cloned array's first-level items will be strongly typed to / constructed as this class. Otherwise
|
|
80
|
-
* it'll be a plain object.
|
|
81
|
-
* @param deepClone Set to true if array items contain FUNCTIONS that need to be cloned..
|
|
82
|
-
* @returns {Array} semi-deep clone of given array
|
|
83
|
-
*/
|
|
84
|
-
public static CloneArrayAndItsItems<T>(array: T[], arrayItemsClass?: any, deepClone: boolean = false): T[] {
|
|
85
|
-
const cloneArray: T[] = [];
|
|
86
|
-
|
|
87
|
-
if (array) {
|
|
88
|
-
for (let i: number = 0, len: number = array.length; i < len; i++) {
|
|
89
|
-
if (deepClone) {
|
|
90
|
-
cloneArray.push(ObjectUtils.GetDeepClone(array[i]));
|
|
91
|
-
} else {
|
|
92
|
-
cloneArray.push(ObjectUtils.GetShallowClone(array[i], arrayItemsClass));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
return [];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return cloneArray;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Removes element at given index from given array. Doesn't just set it to null like JavaScripts standard 'delete' does, but really
|
|
104
|
-
* removes the element using splice().
|
|
105
|
-
*
|
|
106
|
-
* @param {number} index
|
|
107
|
-
* @param {any[]} array in-out
|
|
108
|
-
* @returns {boolean} True if and only if the element on given index is succesfully removed from given array.
|
|
109
|
-
*/
|
|
110
|
-
public static RemoveElementAtIndex(index: number, array: any[]): boolean {
|
|
111
|
-
if (NumberUtils.IsNaN(index) || index < 0 || !Array.isArray(array) || array.length === 0) {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (index in array) {
|
|
116
|
-
array.splice(index, 1);
|
|
117
|
-
return true;
|
|
118
|
-
} else {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Removes given element from given array. Doesn't just set it to null like JavaScripts standard 'delete' does, but really removes the
|
|
125
|
-
* element using splice(). Also works on associative arrays.
|
|
126
|
-
*
|
|
127
|
-
* @param {T} element The element to remove.
|
|
128
|
-
* @param {T[]} array The array to remove the element from.
|
|
129
|
-
* @returns {boolean} True iff given element was truly successfully removed from given array.
|
|
130
|
-
*/
|
|
131
|
-
public static RemoveElement<T>(element: T, array: T[]): boolean {
|
|
132
|
-
if (!Array.isArray(array)) {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const index: number = array.indexOf(element);
|
|
137
|
-
return ArrayUtils.RemoveElementAtIndex(index, array);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Checks if given array is defined, and is an array, and has length > 0, and, optionally checks that the first element is of type given clazz.
|
|
141
|
-
public static IsArrayWithElements<T>(arrayToCheck: T[], classItemsMustBeInstanceOf?: any): boolean {
|
|
142
|
-
if (isNill(arrayToCheck)) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (Array.isArray(arrayToCheck) && arrayToCheck.length > 0) {
|
|
147
|
-
if (classItemsMustBeInstanceOf) {
|
|
148
|
-
return arrayToCheck[0] instanceof classItemsMustBeInstanceOf;
|
|
149
|
-
} else {
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
} else {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Removes all elements from given array for which given filter function holds true. Returns true if at least one removed, else false.
|
|
158
|
-
public static RemoveElementsByFilter(array: any[], filterFunction: (item: any) => boolean): boolean {
|
|
159
|
-
if (!ArrayUtils.IsArrayWithElements(array) || !filterFunction) {
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
let atLeastOneRemoved: boolean = false;
|
|
164
|
-
|
|
165
|
-
const len: number = array.length;
|
|
166
|
-
for (let i: number = len - 1; i >= 0; i--) {
|
|
167
|
-
const item: any = array[i];
|
|
168
|
-
if (filterFunction.call(this, item) === true) {
|
|
169
|
-
array.splice(i, 1);
|
|
170
|
-
atLeastOneRemoved = true;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return atLeastOneRemoved;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
public static MoveElement<T>(element: T, toIndex: number, array: T[]): boolean {
|
|
178
|
-
if (!Array.isArray(array) || isNill(toIndex)) {
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const fromIndex: number = array.indexOf(element);
|
|
183
|
-
const toIndexCorrected: number = NumberUtils.GetNearestNumberWithinBounds(toIndex, 0, array.length - 1);
|
|
184
|
-
if (fromIndex === -1 || array[toIndexCorrected] === element) {
|
|
185
|
-
// element did not exist in given array, or already existed on given toIndex
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
array.splice(toIndexCorrected, 0, array.splice(fromIndex, 1)[0]);
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// PRE: elements exists in given array. POST: given elementToPlace has a lower index than given afterThisElement. Array is in-out manipulated.
|
|
193
|
-
public static PlaceElementAfterOther(array: any[], elementToPlace: any, afterThisElement: any): void {
|
|
194
|
-
if (array) {
|
|
195
|
-
const afterThisElIdx: number = array.indexOf(afterThisElement);
|
|
196
|
-
const elToPlaceIdx: number = array.indexOf(elementToPlace);
|
|
197
|
-
if (afterThisElIdx >= elToPlaceIdx) {
|
|
198
|
-
ArrayUtils.MoveElement(elementToPlace, afterThisElIdx + 1, array);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
package/src/public-api.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Public API Surface of sharedcomponents
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export * from './lib/components/docsign/docsign.component';
|
|
6
|
-
export * from './lib/components/docsign/docsign.module';
|
|
7
|
-
export * from './lib/components/stock/stock.component';
|
|
8
|
-
export * from './lib/components/stock/stock.module';
|
|
9
|
-
export * from './lib/components/send-method-dialog/send-method-dialog.component';
|
|
10
|
-
export * from './lib/components/send-method-dialog/send-method-dialog.module';
|
package/src/test.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
-
|
|
3
|
-
import 'zone.js';
|
|
4
|
-
import 'zone.js/testing';
|
|
5
|
-
import { getTestBed } from '@angular/core/testing';
|
|
6
|
-
import {
|
|
7
|
-
BrowserDynamicTestingModule,
|
|
8
|
-
platformBrowserDynamicTesting
|
|
9
|
-
} from '@angular/platform-browser-dynamic/testing';
|
|
10
|
-
|
|
11
|
-
declare const require: {
|
|
12
|
-
context(path: string, deep?: boolean, filter?: RegExp): {
|
|
13
|
-
<T>(id: string): T;
|
|
14
|
-
keys(): string[];
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// First, initialize the Angular testing environment.
|
|
19
|
-
getTestBed().initTestEnvironment(
|
|
20
|
-
BrowserDynamicTestingModule,
|
|
21
|
-
platformBrowserDynamicTesting(),
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
// Then we find all the tests.
|
|
25
|
-
const context = require.context('./', true, /\.spec\.ts$/);
|
|
26
|
-
// And load the modules.
|
|
27
|
-
context.keys().map(context);
|
package/tsconfig.lib.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/lib",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"inlineSources": true,
|
|
9
|
-
"types": []
|
|
10
|
-
},
|
|
11
|
-
"exclude": [
|
|
12
|
-
"src/test.ts",
|
|
13
|
-
"**/*.spec.ts"
|
|
14
|
-
],
|
|
15
|
-
"types": [
|
|
16
|
-
"src/lib/@types"
|
|
17
|
-
]
|
|
18
|
-
}
|
package/tsconfig.lib.prod.json
DELETED