@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,82 +0,0 @@
1
- import {Component, EventEmitter,Output, ViewEncapsulation} from "@angular/core";
2
-
3
- @Component({
4
- selector: "co-stock-location",
5
- template: `
6
- <div class="stock-location-wrapper">
7
- <div class="buttons-wrapper">
8
- <div class="stock-button-left-group">
9
- <co-button [textContent]="'BACK_TO_STOCK_LINES'" (onClick)="backToStockInformation()"></co-button>
10
- </div>
11
- <div class="dropdown-wrapper">
12
- <co-drop-down-list></co-drop-down-list>
13
- </div>
14
- </div>
15
-
16
- <div class="stock-grid">
17
-
18
- </div>
19
- <div class="button-wrapper">
20
- <div class="button-left">
21
- <co-button (click)="onOkClick()"></co-button>
22
- </div>
23
- <div class="button-right">
24
- <co-button (click)="onCancelClick()"></co-button>
25
- </div>
26
- </div>
27
- </div>
28
-
29
- `,
30
- encapsulation: ViewEncapsulation.None
31
- })
32
- export class StockLocationComponent {
33
-
34
- @Output()
35
- public backToStockLines: EventEmitter<any> = new EventEmitter();
36
-
37
- public readonly MAX_GRID_ROWS: number = 10;
38
-
39
- public stockLocationColumns: any[] = [];
40
-
41
- public stockLocation: Object[] = [
42
- {location: "title 1", batch: "1", serieNo: "1", amountInStock: "1", allocated: "1", amountAvailable: "1"},
43
- {location: "title 2", amountInStock: "2"},
44
- {location: "title 3", amountInStock: "3"},
45
- {location: "title 4", amountInStock: "4"},
46
- {location: "title 5", amountInStock: "5"},
47
- ];
48
-
49
- constructor(
50
- ) {
51
- this.stockLocationColumns.push(
52
- {field: "location", headerText: "WAREHOUSE", editType: "none"},
53
- {field: "batch", headerText: "BATCH"},
54
- {field: "serieNo", headerText: "SERIAL_NO"},
55
- {field: "amountInStock", headerText: "STOCK", textAlign: "Right", editType: "numericEdit"},
56
- {field: "allocated", headerText: "ALLOCATED", textAlign: "Right"},
57
- {field: "amountAvailable", headerText: "AVAILABLE_STOCK", textAlign: "Right"},
58
- {field: "PhysicalStock", headerText: "PHYSICAL_STOCK", textAlign: "Right"},
59
- {field: "Valuta", headerText: "VALUTA", textAlign: "Right"},
60
- {field: "PurchasePrice", headerText: "PURSCHASE_PRICE", textAlign: "Right"},
61
- {field: "SupplierNo", headerText: "SUPPLIER_NO", textAlign: "Right"},
62
- {field: "Transfer", headerText: "TRANSFER"},
63
- {field: "sticker", headerText: "STICKER"},
64
- );
65
- }
66
-
67
- public backToStockInformation(): void {
68
- this.backToStockLines.emit();
69
- }
70
-
71
- public onStickerClick(event): void {
72
- console.log('test');
73
- }
74
-
75
- public onOkClick(): void {
76
-
77
- }
78
-
79
- public onCancelClick(): void {
80
-
81
- }
82
- }
@@ -1,11 +0,0 @@
1
- @import "../../../../../style/mixin";
2
-
3
- @include export-module('co-stock-location-layout') {
4
- .co-stock {
5
- font-family: $tp-stock-font-family;
6
-
7
- .button-wrapper {
8
- display: flex;
9
- }
10
- }
11
- }
@@ -1 +0,0 @@
1
- $tp-stock-font-family: $tp-font-family !default;
@@ -1,18 +0,0 @@
1
- @import "../../../../style/mixin";
2
- @import "./material-definition";
3
-
4
- @include export-module('co-stock-location-theme') {
5
- .co-stock {
6
-
7
- }
8
- .stock-grid {
9
- margin-top: 50px;
10
- }
11
- .buttons-wrapper {
12
- display: flex;
13
- }
14
- .dropdown-wrapper {
15
- float: right;
16
- max-width: 20%;
17
- }
18
- }
@@ -1,4 +0,0 @@
1
- @import "../../../../../style/variables";
2
- @import "./material-definition";
3
- @import "./layout";
4
- @import "./theme";
@@ -1,52 +0,0 @@
1
- import {Component, ViewEncapsulation} from "@angular/core";
2
-
3
- @Component({
4
- selector: "co-stock-transfer",
5
- template: `
6
- <div class="stock-transfer">
7
- <div class="stock-transfer-left-column">
8
- <co-input-text [placeholder]="'Standaard magazijn'">
9
-
10
- </co-input-text>
11
- <co-input-text>
12
-
13
- </co-input-text>
14
- <co-input-text >
15
-
16
- </co-input-text>
17
- <co-input-text >
18
-
19
- </co-input-text>
20
- <co-input-text >
21
-
22
- </co-input-text>
23
- </div>
24
-
25
- <div class="stock-transfer-right-column">
26
- <co-input-text [placeholder]="'Standaard magazijn'">
27
-
28
- </co-input-text>
29
- <co-input-text>
30
-
31
- </co-input-text>
32
- <co-input-text >
33
-
34
- </co-input-text>
35
- <co-input-text >
36
-
37
- </co-input-text>
38
- <co-input-text >
39
-
40
- </co-input-text>
41
- </div>
42
- </div>
43
- `,
44
- encapsulation: ViewEncapsulation.None
45
- })
46
- export class StockTransferComponent {
47
-
48
- constructor(
49
- ) {
50
- }
51
-
52
- }
@@ -1,18 +0,0 @@
1
- @import "../../../../style/mixin";
2
-
3
- @include export-module('co-stock-transfer-layout') {
4
-
5
- .stock-transfer-right-column {
6
- display: flex;
7
- flex-direction: column;
8
- width: 25%;
9
- float: right;
10
- }
11
-
12
- .stock-transfer-left-column {
13
- display: flex;
14
- flex-direction: column;
15
- width: 25%;
16
- float: left;
17
- }
18
- }
@@ -1,6 +0,0 @@
1
- @import "../../../../style/mixin";
2
- @import "./material-definition";
3
-
4
- @include export-module('co-stock-location-theme') {
5
-
6
- }
@@ -1,4 +0,0 @@
1
- @import "../../../../style/variables";
2
- @import "./material-definition";
3
- @import "./layout";
4
- @import "./theme";
@@ -1,56 +0,0 @@
1
- import {Component, HostBinding, Input, ViewChild, ViewEncapsulation} from "@angular/core";
2
- import {StockService} from "../../service/stock.service";
3
-
4
- @Component({
5
- selector: "co-stock",
6
- template: `
7
- <div class="stock-info-container">
8
- <co-stock-information></co-stock-information>
9
- <hr>
10
- <co-stock-information-grid *ngIf="showStockInformationGrid" (transferIconClicked)="handleStockTransferClick($event)"></co-stock-information-grid>
11
- <co-stock-location *ngIf="showStockLocation" (backToStockLines)="backToStockLinesClicked()"></co-stock-location>
12
- <co-stock-transfer *ngIf="showStockTransfer"></co-stock-transfer>
13
- <co-button (click)="handleStockLocationClick()"></co-button>
14
- </div>
15
- `,
16
- encapsulation: ViewEncapsulation.None
17
- })
18
- export class StockComponent {
19
-
20
- @ViewChild(StockComponent)
21
- public stock: StockComponent;
22
-
23
- @Input()
24
- public set options(value: any) {
25
- this._stockService.connectConnector(value);
26
- }
27
-
28
- @HostBinding("class.co-stock")
29
- public showClass() {
30
- return true;
31
- }
32
-
33
- public showStockInformationGrid: boolean = true;
34
- public showStockLocation: boolean = false;
35
- public showStockTransfer: boolean = false;
36
-
37
- constructor(
38
- private _stockService: StockService
39
- ) {
40
- }
41
-
42
- public backToStockLinesClicked(): void {
43
- this.showStockLocation = false;
44
- this.showStockInformationGrid = true;
45
- }
46
-
47
- public handleStockTransferClick(event): void {
48
- this.showStockTransfer = !this.showStockTransfer;
49
- this.showStockInformationGrid = !this.showStockInformationGrid;
50
- }
51
-
52
- public async handleStockLocationClick(): Promise<void> {
53
- await this._stockService.loadStockLocations(10);
54
- }
55
-
56
- }
@@ -1,45 +0,0 @@
1
- import {NgModule} from "@angular/core";
2
- import {StockComponent} from "./stock.component";
3
- import {
4
- ButtonModule,
5
- CoGridModule,
6
- DropDownModule, ImageModule,
7
- InputComboBoxModule,
8
- InputRadioButtonModule, InputTextModule, SimpleGridModule
9
- } from "@colijnit/corecomponents_v12";
10
- import {CommonModule} from "@angular/common";
11
- import {StockInformationComponent} from "./stock-information/stock-information.component";
12
- import {StockInformationGridComponent} from "./stock-information-grid/stock-information-grid.component";
13
- import {StockLocationComponent} from "./stock-location/stock-location.component";
14
- import {StockService} from "../../service/stock.service";
15
- import {IoneConnectorAdapterService} from "../../service/ione-connector-adapter.service";
16
- import {StockTransferComponent} from "./stock-transfer/stock-transfer.component";
17
-
18
- @NgModule({
19
- imports: [
20
- InputComboBoxModule,
21
- CoGridModule,
22
- ButtonModule,
23
- CommonModule,
24
- InputRadioButtonModule,
25
- DropDownModule,
26
- SimpleGridModule,
27
- ImageModule,
28
- InputTextModule
29
- ],
30
- declarations: [
31
- StockComponent,
32
- StockInformationComponent,
33
- StockInformationGridComponent,
34
- StockLocationComponent,
35
- StockTransferComponent
36
- ],
37
- exports: [
38
- StockComponent
39
- ],
40
- providers: [
41
- StockService,
42
- IoneConnectorAdapterService
43
- ]
44
- })
45
- export class StockModule {}
@@ -1,146 +0,0 @@
1
- @import "../../../style/mixin";
2
-
3
- @include export-module('co-stock-layout') {
4
- .co-stock {
5
-
6
- .stock-info-container {
7
- max-width: 90%;
8
- padding: 10px;
9
- }
10
-
11
- .stock-info {
12
- margin-top: 10px;
13
- padding: 0 10px;
14
- display: inline-flex;
15
- }
16
-
17
- .stock-info-row {
18
- display: inline-flex;
19
- }
20
-
21
- .stock-info-row-image {
22
- display: inline-flex;
23
- gap: 10px;
24
- }
25
-
26
- .stock-image {
27
-
28
- }
29
-
30
- .stock-good-info {
31
- display: inline-flex;
32
- }
33
-
34
- .stock-status {
35
- display: grid;
36
- gap: 10px;
37
- }
38
-
39
- .stock-info > div:not(:first-child) {
40
- padding: 0 10px;
41
- border-left: solid 1px lightgray;
42
- }
43
-
44
- .stock-line {
45
- font-weight: bold;
46
- margin: 10px 0 20px 0;
47
- }
48
-
49
- .simple-grid-column-header-wrapper {
50
- font-size: 14px;
51
- display: flex;
52
- flex-direction: row;
53
- }
54
-
55
- .simple-grid-column-header {
56
- display: flex;
57
- flex-direction: row;
58
- padding-right: 5px;
59
- flex-basis: 100%;
60
- }
61
-
62
- .simple-grid-row {
63
- font-size: 12px;
64
- display: flex;
65
- flex-direction: row;
66
- border: 1px solid;
67
- }
68
-
69
- .simple-grid-column-cell {
70
- display: flex;
71
- padding-right: 5px;
72
- flex-basis: 100%;
73
- padding-top: 10px;
74
- padding-bottom: 10px;
75
- }
76
-
77
- .stock-lines-button {
78
- margin-bottom: 5%;
79
- }
80
-
81
- .tab-link {
82
- gap: 10px;
83
- &.hide {
84
- display: none;
85
- }
86
-
87
- &.show {
88
- display: flex;
89
- }
90
- flex-direction: row;
91
- }
92
-
93
- .tab-link > div {
94
- margin: 25px 0;
95
- padding-right: 10px;
96
-
97
- &.inactive {
98
- font-weight: normal;
99
- }
100
- }
101
-
102
- .stock-grid {
103
- }
104
-
105
- .stock-location-group {
106
- margin-bottom: 20px;
107
- display: flex;
108
- }
109
-
110
- .stock-location-left-group {
111
- float: left;
112
- display: flex;
113
- flex: 1;
114
- justify-content: flex-start;
115
- }
116
-
117
- .stock-location-right-group {
118
- float: right;
119
- display: flex;
120
- flex: 1;
121
- justify-content: flex-end;
122
- }
123
-
124
- .stock-button-toolbar {
125
- display: flex;
126
- justify-content: space-between;
127
- margin: 10px;
128
- }
129
-
130
- .stock-button-left-group {
131
- display: flex;
132
- flex: 1;
133
- justify-content: flex-start;
134
-
135
- co-button {
136
- margin-right: 10px;
137
- width: 100px;
138
- }
139
- }
140
- .stock-button-middle-group {
141
- display: flex;
142
- flex: 1;
143
- margin-top: 10px;
144
- }
145
- }
146
- }
@@ -1,120 +0,0 @@
1
- import {ComplexFieldDecorator} from "./decorators/complex-field.decorator";
2
- import {ComplexArrayDecorator} from "./decorators/complex-array.decorator";
3
- import {BooleanTextDecorator} from "./decorators/boolean.decorator";
4
- import {DateFieldFieldDecorator} from "./decorators/date-field.decorator";
5
- import {StringNumberDecorator} from "./decorators/string-number.decorator";
6
- import {isNill} from "../utils/is-nill.function";
7
- import {ArrayUtils} from "../utils/array-utils";
8
- import {BusinessObject} from "../model/business-object";
9
-
10
- // Factory service creates businessobjects, using their decorators in the process.
11
- export class BusinessObjectFactory {
12
- constructor() {
13
- }
14
-
15
- /**
16
- * Creates and returns a new business data object instance of given class, with all given data properties applied to it in a
17
- * complex-aware style. That is, all properties on given class that are decorated with @ComplexField(..) or @ComplexArray(..) decorators
18
- * become strongly typed business objects, with methods that are usable and such.
19
- *
20
- * @param modelClass
21
- * @param {Object} rawData The object with all (possibly raw/flat/not alive) data to be applied to the created model object
22
- */
23
- public makeWithRawBackendData(modelClass: any, rawData: Object): BusinessObject {
24
- if (!modelClass) {
25
- return undefined;
26
- }
27
- if (typeof modelClass !== typeof BusinessObject) {
28
- return undefined;
29
- }
30
-
31
- const model: BusinessObject = new modelClass();
32
- this._copyAllPropertiesDecoratorProcessedFrom(rawData, model);
33
- return model;
34
- }
35
-
36
- // see makeWithRawBackendData, this is a loop-wrapper around that method
37
- public makeBOArrayFromRawBackendDataArray(modelClass: any, arrayOfRawDatas: Object[]): BusinessObject[] {
38
- if (!modelClass) {
39
- return undefined;
40
- }
41
-
42
- const trueClientBos: BusinessObject[] = [];
43
- if (arrayOfRawDatas) {
44
- for (let i: number = 0, len: number = arrayOfRawDatas.length; i < len; i++) {
45
- trueClientBos.push(this.makeWithRawBackendData(modelClass, arrayOfRawDatas[i]));
46
- }
47
- }
48
- return trueClientBos;
49
- }
50
-
51
- public instantiateNewBo(modelClass: any): BusinessObject {
52
- return this.makeWithRawBackendData(modelClass, {});
53
- }
54
-
55
- /**
56
- * Applies all properties of given 'source' object to the given 'destination' businessobject, if destination has that property.
57
- * Works with the @ComplexField(), @ComplexArray, @BooleanText, @CoInject and @DateField annotations of given destination model.
58
- *
59
- * @param sourceData Raw data to copy to destination model
60
- * @param {BusinessObject} destinationModel InOut: The annotated businessobject to apply source properties to
61
- */
62
- private _copyAllPropertiesDecoratorProcessedFrom(sourceData: any, destinationModel: BusinessObject): void {
63
- if (!sourceData || !destinationModel) {
64
- return;
65
- }
66
-
67
- // process all source data into destinationModel
68
- for (const srcPropKey in sourceData) {
69
- if (!sourceData.hasOwnProperty(srcPropKey)) {
70
- continue;
71
- }
72
-
73
- const srcPropVal: any = sourceData[srcPropKey];
74
-
75
- if (ComplexFieldDecorator.IsComplexField(destinationModel, srcPropKey)) {
76
- const classOfField: any = ComplexFieldDecorator.GetComplexFieldType(destinationModel, srcPropKey);
77
- destinationModel[srcPropKey] = this.makeWithRawBackendData(classOfField, srcPropVal);
78
- } else if (ComplexArrayDecorator.IsComplexArray(destinationModel, srcPropKey)) {
79
- const sourceArray: any[] = srcPropVal;
80
- if (!sourceArray) {
81
- continue;
82
- }
83
- const classOfArrayItems: any = ComplexArrayDecorator.GetComplexArrayType(destinationModel, srcPropKey);
84
- const tempArray: any[] = [];
85
- for (let i: number = 0, len: number = sourceArray.length; i < len; i++) {
86
- tempArray.push(this.makeWithRawBackendData(classOfArrayItems, sourceArray[i]));
87
- }
88
- destinationModel[srcPropKey] = tempArray;
89
- } else if (BooleanTextDecorator.IsBooleanTextField(destinationModel, srcPropKey)) {
90
- // logical 'true' and 'false' also allowed as incoming values for @BooleanText() properties: then just copy their value
91
- if (typeof srcPropVal === "boolean") {
92
- destinationModel[srcPropKey] = srcPropVal;
93
- // here, it should be a 'J' or 'N' (or 'T' or 'F'): assign the associated boolean value
94
- } else {
95
- destinationModel[srcPropKey] = BooleanTextDecorator.GetLogicalBooleanValue(srcPropVal);
96
- }
97
- } else if (DateFieldFieldDecorator.IsDateField(destinationModel, srcPropKey)) {
98
- destinationModel[srcPropKey] = DateFieldFieldDecorator.StringAsDate(srcPropVal);
99
- } else if (StringNumberDecorator.IsStringNumber(destinationModel, srcPropKey)) {
100
- destinationModel[srcPropKey] = StringNumberDecorator.StringAsNumber(srcPropVal);
101
- }
102
- // non-decorated prop
103
- else {
104
- if (isNill(srcPropVal)) {
105
- destinationModel[srcPropKey] = undefined;
106
- } else if (Array.isArray(srcPropVal)) {
107
- destinationModel[srcPropKey] = ArrayUtils.CloneArray(srcPropVal);
108
- } else if (typeof srcPropVal === "object") {
109
- if (srcPropVal instanceof Map) { //just copy the value in case of maps
110
- destinationModel[srcPropKey] = srcPropVal;
111
- } else {
112
- destinationModel[srcPropKey] = Object.assign({}, srcPropVal);
113
- }
114
- } else {
115
- destinationModel[srcPropKey] = srcPropVal;
116
- }
117
- }
118
- }
119
- }
120
- }