@colijnit/sharedcomponents 1.0.2 → 1.0.5

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.
Files changed (140) hide show
  1. package/README.md +8 -11
  2. package/bundles/colijnit-sharedcomponents.umd.js +1901 -0
  3. package/bundles/colijnit-sharedcomponents.umd.js.map +1 -0
  4. package/colijnit-sharedcomponents-1.0.5.tgz +0 -0
  5. package/colijnit-sharedcomponents.d.ts +12 -0
  6. package/colijnit-sharedcomponents.metadata.json +1 -0
  7. package/esm2015/colijnit-sharedcomponents.js +13 -0
  8. package/esm2015/lib/components/docsign/component/signature/signature.component.js +75 -0
  9. package/esm2015/lib/components/docsign/component/signatures/signatures.component.js +44 -0
  10. package/esm2015/lib/components/docsign/docsign.component.js +225 -0
  11. package/esm2015/lib/components/docsign/docsign.module.js +23 -0
  12. package/esm2015/lib/components/stock/stock-information/stock-information.component.js +60 -0
  13. package/esm2015/lib/components/stock/stock-information-grid/stock-information-grid.component.js +255 -0
  14. package/esm2015/lib/components/stock/stock-location/stock-location.component.js +62 -0
  15. package/esm2015/lib/components/stock/stock-transfer/co-drop-down-list-fields.interface.js +2 -0
  16. package/esm2015/lib/components/stock/stock-transfer/stock-transfer.component.js +98 -0
  17. package/esm2015/lib/components/stock/stock.component.js +74 -0
  18. package/esm2015/lib/components/stock/stock.module.js +42 -0
  19. package/esm2015/lib/factory/business-object-factory.js +120 -0
  20. package/esm2015/lib/factory/decorators/boolean.decorator.js +102 -0
  21. package/esm2015/lib/factory/decorators/complex-array.decorator.js +55 -0
  22. package/esm2015/lib/factory/decorators/complex-field.decorator.js +57 -0
  23. package/esm2015/lib/factory/decorators/date-field.decorator.js +36 -0
  24. package/esm2015/lib/factory/decorators/string-number.decorator.js +43 -0
  25. package/esm2015/lib/model/business-object.js +81 -0
  26. package/esm2015/lib/service/ione-connector-adapter.service.js +98 -0
  27. package/esm2015/lib/service/stock.service.js +28 -0
  28. package/esm2015/lib/utils/array-utils.js +183 -0
  29. package/esm2015/lib/utils/is-nill.function.js +5 -0
  30. package/esm2015/public-api.js +8 -0
  31. package/fesm2015/colijnit-sharedcomponents.js +1731 -0
  32. package/fesm2015/colijnit-sharedcomponents.js.map +1 -0
  33. package/lib/components/docsign/component/signature/signature.component.d.ts +16 -0
  34. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signature/style/_layout.scss +0 -0
  35. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signature/style/_material-definition.scss +0 -0
  36. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signature/style/_theme.scss +0 -0
  37. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signature/style/material.scss +0 -0
  38. package/lib/components/docsign/component/signatures/signatures.component.d.ts +12 -0
  39. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signatures/style/_layout.scss +0 -0
  40. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signatures/style/_material-definition.scss +0 -0
  41. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signatures/style/_theme.scss +0 -0
  42. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signatures/style/material.scss +0 -0
  43. package/lib/components/docsign/docsign.component.d.ts +92 -0
  44. package/lib/components/docsign/docsign.module.d.ts +2 -0
  45. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/style/_layout.scss +0 -0
  46. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/style/_material-definition.scss +0 -0
  47. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/style/_theme.scss +0 -0
  48. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/style/material.scss +0 -0
  49. package/lib/components/stock/stock-information/stock-information.component.d.ts +10 -0
  50. package/lib/components/stock/stock-information-grid/stock-information-grid.component.d.ts +43 -0
  51. package/lib/components/stock/stock-location/stock-location.component.d.ts +12 -0
  52. package/lib/components/stock/stock-transfer/co-drop-down-list-fields.interface.d.ts +4 -0
  53. package/lib/components/stock/stock-transfer/stock-transfer.component.d.ts +19 -0
  54. package/lib/components/stock/stock.component.d.ts +20 -0
  55. package/lib/components/stock/stock.module.d.ts +2 -0
  56. package/lib/components/stock/style/_layout.scss +206 -0
  57. package/lib/components/stock/style/_material-definition.scss +20 -0
  58. package/{projects/sharedcomponents/src/lib → lib}/components/stock/style/_theme.scss +0 -0
  59. package/{projects/sharedcomponents/src/lib → lib}/components/stock/style/material.scss +0 -0
  60. package/lib/factory/business-object-factory.d.ts +23 -0
  61. package/lib/factory/decorators/boolean.decorator.d.ts +43 -0
  62. package/lib/factory/decorators/complex-array.decorator.d.ts +25 -0
  63. package/lib/factory/decorators/complex-field.decorator.d.ts +25 -0
  64. package/lib/factory/decorators/date-field.decorator.d.ts +17 -0
  65. package/lib/factory/decorators/string-number.decorator.d.ts +22 -0
  66. package/lib/model/business-object.d.ts +7 -0
  67. package/lib/service/ione-connector-adapter.service.d.ts +17 -0
  68. package/lib/service/stock.service.d.ts +11 -0
  69. package/{projects/sharedcomponents/src/lib → lib}/style/_mixin.scss +0 -0
  70. package/{projects/sharedcomponents/src/lib → lib}/style/_variables.scss +0 -0
  71. package/lib/utils/array-utils.d.ts +57 -0
  72. package/lib/utils/is-nill.function.d.ts +1 -0
  73. package/package.json +25 -66
  74. package/{projects/sharedcomponents/src/public-api.ts → public-api.d.ts} +2 -4
  75. package/.browserslistrc +0 -16
  76. package/.editorconfig +0 -16
  77. package/.vscode/extensions.json +0 -4
  78. package/.vscode/launch.json +0 -20
  79. package/.vscode/tasks.json +0 -42
  80. package/Sharedcomponents.iml +0 -11
  81. package/angular.json +0 -133
  82. package/colijnit-sharedcomponents-1.0.2.tgz +0 -0
  83. package/karma.conf.js +0 -44
  84. package/move-assets.js +0 -14
  85. package/projects/sharedcomponents/.browserslistrc +0 -16
  86. package/projects/sharedcomponents/README.md +0 -24
  87. package/projects/sharedcomponents/karma.conf.js +0 -44
  88. package/projects/sharedcomponents/ng-package.json +0 -17
  89. package/projects/sharedcomponents/package.json +0 -15
  90. package/projects/sharedcomponents/src/lib/components/docsign/component/signature/signature.component.ts +0 -82
  91. package/projects/sharedcomponents/src/lib/components/docsign/component/signatures/signatures.component.ts +0 -50
  92. package/projects/sharedcomponents/src/lib/components/docsign/docsign.component.ts +0 -252
  93. package/projects/sharedcomponents/src/lib/components/docsign/docsign.module.ts +0 -22
  94. package/projects/sharedcomponents/src/lib/components/stock/stock-information/stock-information.component.ts +0 -56
  95. package/projects/sharedcomponents/src/lib/components/stock/stock-information-grid/stock-information-grid.component.ts +0 -279
  96. package/projects/sharedcomponents/src/lib/components/stock/stock-location/stock-location.component.ts +0 -82
  97. package/projects/sharedcomponents/src/lib/components/stock/stock-location/style/_layout.scss +0 -11
  98. package/projects/sharedcomponents/src/lib/components/stock/stock-location/style/_material-definition.scss +0 -1
  99. package/projects/sharedcomponents/src/lib/components/stock/stock-location/style/_theme.scss +0 -18
  100. package/projects/sharedcomponents/src/lib/components/stock/stock-location/style/material.scss +0 -4
  101. package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/stock-transfer.component.ts +0 -52
  102. package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/style/_layout.scss +0 -18
  103. package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/style/_material-definition.scss +0 -1
  104. package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/style/_theme.scss +0 -6
  105. package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/style/material.scss +0 -4
  106. package/projects/sharedcomponents/src/lib/components/stock/stock.component.ts +0 -56
  107. package/projects/sharedcomponents/src/lib/components/stock/stock.module.ts +0 -45
  108. package/projects/sharedcomponents/src/lib/components/stock/style/_layout.scss +0 -146
  109. package/projects/sharedcomponents/src/lib/components/stock/style/_material-definition.scss +0 -1
  110. package/projects/sharedcomponents/src/lib/factory/business-object-factory.ts +0 -120
  111. package/projects/sharedcomponents/src/lib/factory/decorators/boolean.decorator.ts +0 -113
  112. package/projects/sharedcomponents/src/lib/factory/decorators/complex-array.decorator.ts +0 -61
  113. package/projects/sharedcomponents/src/lib/factory/decorators/complex-field.decorator.ts +0 -63
  114. package/projects/sharedcomponents/src/lib/factory/decorators/date-field.decorator.ts +0 -41
  115. package/projects/sharedcomponents/src/lib/factory/decorators/string-number.decorator.ts +0 -48
  116. package/projects/sharedcomponents/src/lib/model/business-object.ts +0 -85
  117. package/projects/sharedcomponents/src/lib/service/ione-connector-adapter.service.ts +0 -49
  118. package/projects/sharedcomponents/src/lib/service/stock.service.ts +0 -40
  119. package/projects/sharedcomponents/src/lib/utils/array-utils.ts +0 -202
  120. package/projects/sharedcomponents/src/lib/utils/is-nill.function.ts +0 -4
  121. package/projects/sharedcomponents/src/test.ts +0 -27
  122. package/projects/sharedcomponents/tsconfig.lib.json +0 -18
  123. package/projects/sharedcomponents/tsconfig.lib.prod.json +0 -10
  124. package/projects/sharedcomponents/tsconfig.spec.json +0 -17
  125. package/src/app/app.component.scss +0 -8
  126. package/src/app/app.component.spec.ts +0 -31
  127. package/src/app/app.component.ts +0 -75
  128. package/src/app/app.module.ts +0 -22
  129. package/src/assets/.gitkeep +0 -0
  130. package/src/environments/environment.prod.ts +0 -3
  131. package/src/environments/environment.ts +0 -16
  132. package/src/favicon.ico +0 -0
  133. package/src/index.html +0 -13
  134. package/src/main.ts +0 -12
  135. package/src/polyfills.ts +0 -53
  136. package/src/styles.scss +0 -24
  137. package/src/test.ts +0 -26
  138. package/tsconfig.app.json +0 -15
  139. package/tsconfig.json +0 -65
  140. package/tsconfig.spec.json +0 -18
@@ -1,113 +0,0 @@
1
- import {GetYesNoDbBooleanValue} from "@colijnit/articleapi/build/enum/yes-no-db-type.enum";
2
- import {GetTrueFalseDbBooleanValue} from "@colijnit/articleapi/build/enum/true-false-db-type.enum";
3
- import {GetOneZeroDbBooleanValue} from "@colijnit/articleapi/build/enum/one-zero-bool-db-type.enum";
4
- import {DbBooleanValueType, GetLogicalBooleanValue} from "@colijnit/articleapi/build/enum/db-boolean-value-type.enum";
5
-
6
- const PROP_META_KEY_JN: string = "booleanTextJN";
7
- const PROP_META_KEY_TF: string = "booleanTextTF";
8
- const PROP_META_KEY_10: string = "booleanText10";
9
-
10
- /**
11
- * There are 'J', 'T', 'N', 'F', 0 and 1 'boolean values' in the database. These should be translated to true and false boolean values in
12
- * our client application.
13
- *
14
- * The values 'J' and 'N' seem to be most commonly used. This is the default setting when using this decorator.
15
- * You can pass 'T' or 1 for the other variants as follows:
16
- *
17
- * Usage:
18
- *
19
- * @BooleanText() or @BooleanText("J") (the default, uses YesNoDbType char values)
20
- * public foo: boolean // 'J' and 'N' become true and false after BusinessObjectFactoryService and -SerializerService processing
21
- *
22
- * @BooleanText('T') (uses TrueFalseDbType char values)
23
- * public bar: boolean // 'T' and 'F' become true and false after BusinessObjectFactoryService and -SerializerService processing
24
- *
25
- * @BooleanText(1)
26
- * public baz: boolean // 1 and 0 become true and false after BusinessObjectFactoryService and -SerializerService processing
27
- */
28
- export function BooleanText(type?: "J" | "T" | 1): PropertyDecorator {
29
- return function (target: any, propertyKey: string): void {
30
- if (!target || !propertyKey) {
31
- return;
32
- }
33
- // by default, it's a J N boolean text
34
- if (!type || type === "J") {
35
- Reflect.defineMetadata(PROP_META_KEY_JN, true, target, propertyKey);
36
- } else if (type === "T") {
37
- Reflect.defineMetadata(PROP_META_KEY_TF, true, target, propertyKey);
38
- } else if (type === 1) {
39
- Reflect.defineMetadata(PROP_META_KEY_10, true, target, propertyKey);
40
- }
41
- };
42
- }
43
-
44
- // Utility function holder of the BooleanTextDecorator decorator.
45
- export class BooleanTextDecorator {
46
-
47
- /**
48
- * Returns whether given property (as a string) on given object is a boolean text field. That is, it's a field that is decorated
49
- * with the @BooleanText decorator.
50
- */
51
- public static IsBooleanTextField(target: Object, propertyKey: string): boolean {
52
- if (!target || !propertyKey || typeof target !== "object") {
53
- return false;
54
- }
55
- return (
56
- Reflect.getMetadata(PROP_META_KEY_JN, target, propertyKey) === true
57
- ||
58
- Reflect.getMetadata(PROP_META_KEY_TF, target, propertyKey) === true
59
- ||
60
- Reflect.getMetadata(PROP_META_KEY_10, target, propertyKey) === true
61
- );
62
- }
63
-
64
- /**
65
- * Returns the logical true or false value of given character ('J', 'N', 'T' or 'F') or number (0 or 1).
66
- * Returns UNDEFINED if given boolChar was not recognised as a boolean text.
67
- */
68
- public static GetLogicalBooleanValue(dbBoolChar: DbBooleanValueType | string): boolean {
69
- return GetLogicalBooleanValue(dbBoolChar);
70
- }
71
-
72
- /**
73
- * Returns the boolean character / number of given logical bool property on target object. Uses its @BooleanText() annotation to decide
74
- * what character / number to return.
75
- * Used in BusinessObjectSerializerServiceService to convert logical bools to their original boolean character.
76
- * @returns {string|number} The original, reverse-engineered boolean character (or number) of given object property, or undefined.
77
- */
78
- public static GetDbBooleanValue(target: Object, propertyKey: string): DbBooleanValueType {
79
- if (!target || !propertyKey || typeof target !== "object") {
80
- return undefined;
81
- }
82
-
83
- let dbBoolVal: any = undefined;
84
-
85
- const curBoolVal: boolean = target[propertyKey];
86
-
87
- if (BooleanTextDecorator._IsJaNeeProp(target, propertyKey)) {
88
- dbBoolVal = GetYesNoDbBooleanValue(curBoolVal);
89
- } else if (BooleanTextDecorator._IsTrueFalseProp(target, propertyKey)) {
90
- dbBoolVal = GetTrueFalseDbBooleanValue(curBoolVal);
91
- } else if (BooleanTextDecorator._IsZeroOneProp(target, propertyKey)) {
92
- dbBoolVal = GetOneZeroDbBooleanValue(curBoolVal);
93
- }
94
-
95
- return dbBoolVal as any as DbBooleanValueType;
96
- }
97
-
98
- private static _IsJaNeeProp(target: Object, propertyKey: string): boolean {
99
- return BooleanTextDecorator._IsProp(PROP_META_KEY_JN, target, propertyKey);
100
- }
101
-
102
- private static _IsTrueFalseProp(target: Object, propertyKey: string): boolean {
103
- return BooleanTextDecorator._IsProp(PROP_META_KEY_TF, target, propertyKey);
104
- }
105
-
106
- private static _IsZeroOneProp(target: Object, propertyKey: string): boolean {
107
- return BooleanTextDecorator._IsProp(PROP_META_KEY_10, target, propertyKey);
108
- }
109
-
110
- private static _IsProp(prop: string, target: Object, propertyKey: string): boolean {
111
- return !!target && !!propertyKey && typeof target === "object" && Reflect.hasMetadata(prop, target, propertyKey);
112
- }
113
- }
@@ -1,61 +0,0 @@
1
- import {notNill} from "@colijnit/articleapi/build/utils/function/not-nill.function";
2
- import {ObjectUtils} from "@colijnit/articleapi/build/utils/object-utils";
3
-
4
- const PROP_META_KEY: string = "complexArray";
5
-
6
- /**
7
- * !! just a TAG DECORATOR for now, there is no code that uses this meta data within the ione connector lib itself.
8
- */
9
-
10
- /**
11
- * Property decorator for properties of businessobject classes that are an array of other strongly typed businessobjects.
12
- * Ensures that the BusinessObjectFactoryService makes properly typed objects from incoming raw persistence data. Otherwise we couldn't add methods
13
- * to our own businessobjects and use them, since all fields would be flat data without methods after BusinessObjectFactoryService creation.
14
- *
15
- * Usage:
16
- *
17
- * @ComplexArray(TransactionLine)
18
- * public transactionLines: TransactionLine[]
19
- */
20
- export function ComplexArray(type: any): PropertyDecorator {
21
- return function (target: any, propertyKey: string): void {
22
- if (!target || !propertyKey || typeof target !== "object") {
23
- return;
24
- }
25
- // warn the programmer if given type was undefined; it's probably an import order glitch that caused this, because decorators seem
26
- // to be immediately processed when a class is first imported
27
- if (!type) {
28
- console.warn(`@ComplexArray(type): type was UNDEFINED. Called on prop (${ObjectUtils.GetClassName(target)}, ${propertyKey}). ` +
29
- `Class will not properly serialize and deserialize now. We've always been able to fix this by CHANGING IMPORT ORDERS ` +
30
- `where both classes and their dependencies are used, e.g. factory, repository or models..`);
31
- return;
32
- }
33
- Reflect.defineMetadata(PROP_META_KEY, type, target, propertyKey);
34
- };
35
- }
36
-
37
- // Utility function holder of the ComplexArrayDecorator decorator.
38
- export class ComplexArrayDecorator {
39
- /**
40
- * Returns whether given property (as a string) on given object is a complex array. A complex array is an array field that is decorated
41
- * with the @ComplexArray decorator.
42
- */
43
- public static IsComplexArray(target: Object, propertyKey: string): boolean {
44
- if (!target || !propertyKey || typeof target !== "object") {
45
- return false;
46
- }
47
-
48
- return (notNill(Reflect.getMetadata(PROP_META_KEY, target, propertyKey)));
49
- }
50
-
51
- /**
52
- * Returns the VALUE of the @ComplexArray(VALUE) property decorator on the given propertyKey on the given modelobject.
53
- */
54
- public static GetComplexArrayType(target: Object, propertyKey: string): any {
55
- if (!target || !propertyKey || typeof target !== "object") {
56
- return undefined;
57
- }
58
-
59
- return Reflect.getMetadata(PROP_META_KEY, target, propertyKey);
60
- }
61
- }
@@ -1,63 +0,0 @@
1
- import {notNill} from "@colijnit/articleapi/build/utils/function/not-nill.function";
2
- import {ObjectUtils} from "@colijnit/articleapi/build/utils/object-utils";
3
-
4
- const PROP_META_KEY: string = "complexField";
5
-
6
- /**
7
- * !! just a TAG DECORATOR for now, there is no code that uses this meta data within the ione connector lib itself.
8
- */
9
-
10
- /**
11
- * Property decorator for properties of businessobject classes that are other strongly typed businessobjects.
12
- * Ensures that the BusinessObjectFactoryService makes properly typed objects from incoming raw persistence data. Otherwise we couldn't add methods
13
- * to our own businessobjects and use them, since all fields would be flat data without methods after BusinessObjectFactoryService creation.
14
- *
15
- * Usage:
16
- *
17
- * @ComplexField(Transaction)
18
- * public transaction: Transaction
19
- *
20
- * Also keeps track of a "complexFieldProps" metadata on the class-level, as a reflect-metadata workaround to be able to
21
- * retrieve all properties that have the @ComplexField(..) decorator (impossible with current Reflect API).
22
- */
23
- export function ComplexField(type: any): PropertyDecorator {
24
- return function (target: any, propertyKey: string): void {
25
- if (!target || !propertyKey) {
26
- return;
27
- }
28
-
29
- // warn the programmer if given type was undefined; it's probably an import order glitch that caused this, because decorators seem
30
- // to be immediately processed when a class is first imported
31
- if (!type) {
32
- // eslint-disable-next-line no-console
33
- console.warn(`@ComplexField(type): type was UNDEFINED. Called on prop (${ObjectUtils.GetClassName(target)}, ${propertyKey}). ` +
34
- `Class will not properly serialize and deserialize now. We've always been able to fix this by CHANGING IMPORT ORDERS ` +
35
- `where both classes and their dependencies are used, e.g. factory, repository or models..`);
36
- return;
37
- }
38
- Reflect.defineMetadata(PROP_META_KEY, type, target, propertyKey);
39
- };
40
- }
41
-
42
- // Utility function holder of the ComplexFieldDecorator decorator.
43
- export class ComplexFieldDecorator {
44
-
45
- /**
46
- * Returns whether given property (as a string) on given object is a complex field. A complex field is a field that is decorated
47
- * with the @ComplexField decorator.
48
- */
49
- public static IsComplexField(target: Object, propertyKey: string): boolean {
50
- if (!target || !propertyKey || typeof target !== "object") {
51
- return false;
52
- }
53
- return (notNill(Reflect.getMetadata(PROP_META_KEY, target, propertyKey)));
54
- }
55
-
56
- // Returns the VALUE of the @ComplexField(VALUE) property decorator on the given propertyKey on the given modelObject.
57
- public static GetComplexFieldType(target: Object, propertyKey: string): any {
58
- if (!target || !propertyKey || typeof target !== "object") {
59
- return undefined;
60
- }
61
- return Reflect.getMetadata(PROP_META_KEY, target, propertyKey);
62
- }
63
- }
@@ -1,41 +0,0 @@
1
- import {DateUtils} from "@colijnit/articleapi/build/utils/date-utils";
2
-
3
- const PROP_META_KEY: string = "dateField";
4
-
5
- /**
6
- * !! just a TAG DECORATOR for now, there is no code that uses this meta data within the ione connector lib itself.
7
- */
8
-
9
- /**
10
- * Property decorator for properties of businessobject classes that are of type Date, but are sent to us as strings.
11
- * Ensures that the BusinessObjectFactory makes proper JavaScript Date objects from incoming strings for @DateField() decorated properties.
12
- *
13
- * Usage:
14
- *
15
- * @DateField()
16
- * public expectedDeliveryDate: Date
17
- */
18
- export function DateField(): PropertyDecorator {
19
- return function (target: any, propertyKey: string): void {
20
- if (!target || !propertyKey) {
21
- return;
22
- }
23
- Reflect.defineMetadata(PROP_META_KEY, undefined, target, propertyKey);
24
- };
25
- }
26
-
27
- // Utility function holder of the @DateField() decorator.
28
- export class DateFieldFieldDecorator {
29
-
30
- // Returns whether given property (as a string) on given object is decorated with @DateField().
31
- public static IsDateField(target: Object, propertyKey: string): boolean {
32
- if (!target || !propertyKey || typeof target !== "object") {
33
- return false;
34
- }
35
- return Reflect.hasMetadata(PROP_META_KEY, target, propertyKey);
36
- }
37
-
38
- public static StringAsDate(str: string): Date {
39
- return DateUtils.StringAsDate(str);
40
- }
41
- }
@@ -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,49 +0,0 @@
1
- import {Articles} from "@colijnit/articleapi/build/articles";
2
- import {Injectable} from "@angular/core";
3
- import {ArticleExtended} from "@colijnit/articleapi/build/model/article-extended.bo";
4
- import {DataServiceResponseData} from "@colijnit/articleapi/build/model/data-service-response-data";
5
- import {BusinessObjectFactory} from "../factory/business-object-factory";
6
-
7
-
8
- @Injectable({
9
- providedIn: "root"
10
- })
11
-
12
- export class IoneConnectorAdapterService {
13
- public options: any;
14
- public connector: Articles
15
-
16
- private _boFactory: BusinessObjectFactory = new BusinessObjectFactory();
17
-
18
-
19
- constructor() {
20
- }
21
-
22
- public async connect(options: any): Promise<void> {
23
- if (this.options === undefined) {
24
- this.options = options;
25
- this.connector = new Articles(options);
26
- this.options.session = this.connector.session;
27
- }
28
- }
29
-
30
- public async disconnect(): Promise<void> {
31
- this.options = undefined;
32
- }
33
-
34
- public async getArticleFullObject(goodId: number): Promise<ArticleExtended> {
35
- return new Promise((resolve: Function, reject: Function) => {
36
- return this.connector.getArticleFullObject(goodId).then((result: DataServiceResponseData) => {
37
- if (result.validationResult && result.validationResult.success) {
38
- if (result.resultObject) {
39
- resolve(this._boFactory.makeWithRawBackendData(ArticleExtended, result.resultObject));
40
- }
41
- } else {
42
- reject(result.validationMessagesAsString);
43
- }
44
- });
45
- });
46
- }
47
-
48
-
49
- }
@@ -1,40 +0,0 @@
1
- import {Injectable} from "@angular/core";
2
- import {IoneConnectorAdapterService} from "./ione-connector-adapter.service";
3
-
4
- @Injectable()
5
- export class StockService {
6
-
7
-
8
- constructor(
9
- private _connector: IoneConnectorAdapterService,
10
- ) {
11
-
12
- }
13
-
14
- public connectConnector(options: any): void {
15
- this._connector.connect(options);
16
- }
17
-
18
- // public async getStock(goodId: number): Promise<ArticleFullObject> {
19
- // return await this._connector.getArticleFullObject(goodId);
20
- // }
21
-
22
- // public async getStockHistory(): Promise<GetStockHistoryRequest> {
23
- //
24
- // }
25
-
26
- // public async getStockWarehouses(goodId: number): Promise<getWarehouses>
27
-
28
- public async loadStockLocations(goodId: number): Promise<void> {
29
- // await this._connector.getArticleFullObject(goodId);
30
- }
31
-
32
- private async _loadInOrders(): Promise<void> {
33
- //this.inOrderInformation = await ...
34
- }
35
-
36
- private async _loadStockOrders(): Promise<void> {
37
- // this.orderInformation = await ...
38
- }
39
-
40
- }