turbogui-angular 15.2.0 → 15.2.1
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/esm2022/main/controller/dialog.service.mjs +3 -3
- package/esm2022/main/controller/turbo-api-caller.service.mjs +11 -3
- package/esm2022/main/controller/views.service.mjs +20 -17
- package/esm2022/main/model/classes/View.mjs +2 -2
- package/fesm2022/turbogui-angular.mjs +32 -21
- package/fesm2022/turbogui-angular.mjs.map +1 -1
- package/main/controller/dialog.service.d.ts +2 -2
- package/main/controller/turbo-api-caller.service.d.ts +10 -2
- package/main/controller/turbo-api-caller.service.d.ts.map +1 -1
- package/main/controller/views.service.d.ts +11 -10
- package/main/controller/views.service.d.ts.map +1 -1
- package/main/model/classes/View.d.ts +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
10
|
* Defines an application view.
|
|
11
|
-
* Our View components must extend this class so they can be manipulated via ViewsService and be correctly linked to a
|
|
11
|
+
* Our View components must extend this class so they can be manipulated via ViewsService and be correctly linked to a views-container.
|
|
12
12
|
*/
|
|
13
13
|
export class View {
|
|
14
14
|
/**
|
|
@@ -21,4 +21,4 @@ export class View {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVmlldy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3R1cmJvZ3VpLWFuZ3VsYXIvc3JjL21haW4vbW9kZWwvY2xhc3Nlcy9WaWV3LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7O0dBT0c7QUFNSDs7O0dBR0c7QUFDSCxNQUFNLE9BQWdCLElBQUk7SUFHekI7OztPQUdHO0lBQ0gsWUFBWSxnQkFBa0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bmQgYmUgY29ycmVjdGx5IGxpbmtlZCB0byBhIHZpZXdzLWNvbnRhaW5lci5cclxuICovXHJcbmV4cG9ydCBhYnN0cmFjdCBjbGFzcyBWaWV3IHtcclxuXHJcblxyXG5cdC8qKlxyXG5cdCAqIFRoaXMgY29uc3RydWN0b3IgaXMgc3BlY2lmaWNhbGx5IGRlc2lnbmVkIHRvIGZvcmNlIHRoZSB2aWV3IHRvIHNldCB0aGUgdmlld0NvbnRhaW5lclJlZiB3aGljaCB3aWxsIGJlIGF1dG9tYXRpY2FsbHkgYXNzaWduZWRcclxuXHQgKiB0byB0aGUgcmVzcGVjdGl2ZSB2aWV3IHNlcnZpY2UuIElmIHRoZSB2aWV3IGhhcyBubyBzZXJ2aWNlLCB3ZSBjYW4gc2V0IGl0IHRvIG51bGwuXHJcblx0ICovXHJcblx0Y29uc3RydWN0b3Iodmlld0NvbnRhaW5lclJlZjogVmlld0NvbnRhaW5lclJlZiwgdmlld1NlcnZpY2U6Vmlld1NlcnZpY2V8bnVsbCkge1xyXG5cdFxyXG5cdFx0aWYodmlld1NlcnZpY2UgIT09IG51bGwpe1xyXG5cdFx0XHRcclxuXHRcdFx0dmlld1NlcnZpY2Uudmlld0NvbnRhaW5lclJlZiA9IHZpZXdDb250YWluZXJSZWY7XHJcblx0XHR9XHRcclxuXHR9XHJcbn1cclxuIl19
|
|
@@ -811,8 +811,8 @@ class DialogService extends SingletoneStrictClass {
|
|
|
811
811
|
* - viewContainerRef: This is important if we want to propagate providers from a parent component to this dialog. We must specify
|
|
812
812
|
* this reference to make sure the same services injected on the parent are available too at the child dialog
|
|
813
813
|
*
|
|
814
|
-
* @param callback A function that will be called after the dialog is closed
|
|
815
|
-
* the
|
|
814
|
+
* @param callback A function that will be called after the dialog is closed. It will receive a selection object with two properties: index and value. Those
|
|
815
|
+
* will contain the index and value from the options array that's selected by the user. if no option selected, index will be -1 and value null
|
|
816
816
|
*/
|
|
817
817
|
addDialog(dialogComponentClass, properties, callback = null) {
|
|
818
818
|
if (!this._isEnabled) {
|
|
@@ -1135,6 +1135,8 @@ class TurboApiCallerService extends SingletoneStrictClass {
|
|
|
1135
1135
|
this.browserService = browserService;
|
|
1136
1136
|
/**
|
|
1137
1137
|
* URI Path to the web service that performs the user login
|
|
1138
|
+
* TODO - crear una clase apipaths amb les constants de totes les rutes i moure aquestes 3 alla
|
|
1139
|
+
* aquesta classe haura de ser extesa a la nostra app amb les altres que es fagin servir
|
|
1138
1140
|
*/
|
|
1139
1141
|
this.loginServiceURI = 'users/login';
|
|
1140
1142
|
/**
|
|
@@ -1147,6 +1149,8 @@ class TurboApiCallerService extends SingletoneStrictClass {
|
|
|
1147
1149
|
this.mailVerifyServiceURI = 'users/user-mail-verify';
|
|
1148
1150
|
/**
|
|
1149
1151
|
* The username that is currently defined and will be used by the login methods
|
|
1152
|
+
* TODO - We must use a setter and a getter of user and psw. If any of the values change
|
|
1153
|
+
* we must clear the logged state and the token.
|
|
1150
1154
|
*/
|
|
1151
1155
|
this.userName = '';
|
|
1152
1156
|
/**
|
|
@@ -1252,10 +1256,13 @@ class TurboApiCallerService extends SingletoneStrictClass {
|
|
|
1252
1256
|
;
|
|
1253
1257
|
}
|
|
1254
1258
|
/**
|
|
1255
|
-
* Authenticates the
|
|
1259
|
+
* Authenticates the userName and password that are currently defined at the respective properties of this service.
|
|
1256
1260
|
* Returns a promise that resolves with the server's response or rejects with an error if the login fails.
|
|
1257
1261
|
* Path to the login service must be correctly defined at this.loginWebService
|
|
1258
1262
|
*
|
|
1263
|
+
* The authentication process is performed by sending an encoded credentials request to the login web service using the
|
|
1264
|
+
* currently defined user name and psw.
|
|
1265
|
+
*
|
|
1259
1266
|
* Here's an example of a call:
|
|
1260
1267
|
*
|
|
1261
1268
|
* login().then(response => {
|
|
@@ -1306,7 +1313,8 @@ class TurboApiCallerService extends SingletoneStrictClass {
|
|
|
1306
1313
|
return !StringUtils.isEmpty(this.userName) && !StringUtils.isEmpty(this.password);
|
|
1307
1314
|
}
|
|
1308
1315
|
/**
|
|
1309
|
-
* Tells if
|
|
1316
|
+
* Tells if the user name and psw that are specified on this service are currently logged or not. This means
|
|
1317
|
+
* also a token is active.
|
|
1310
1318
|
*/
|
|
1311
1319
|
get isLogged() {
|
|
1312
1320
|
return this._isLogged;
|
|
@@ -1529,6 +1537,10 @@ class ViewsService extends SingletoneStrictClass {
|
|
|
1529
1537
|
* Contains the reference to the currently loaded view component
|
|
1530
1538
|
*/
|
|
1531
1539
|
this._currentComponentRef = null;
|
|
1540
|
+
/**
|
|
1541
|
+
* Flag that stores if any view is in the process of being loaded
|
|
1542
|
+
*/
|
|
1543
|
+
this._isLoadingView = false;
|
|
1532
1544
|
}
|
|
1533
1545
|
/**
|
|
1534
1546
|
* Tells if there's any view currently loaded on the application views container
|
|
@@ -1550,20 +1562,25 @@ class ViewsService extends SingletoneStrictClass {
|
|
|
1550
1562
|
}
|
|
1551
1563
|
/**
|
|
1552
1564
|
* Create a new view instance with the specified type and add it to the current application views container. Any currently loaded
|
|
1553
|
-
* view will be removed
|
|
1565
|
+
* view will be removed.
|
|
1554
1566
|
*
|
|
1555
|
-
*
|
|
1567
|
+
* If we push a view while another one is in the process of being loaded, the new push will be ignored.
|
|
1556
1568
|
*
|
|
1557
|
-
*
|
|
1569
|
+
* Make sure this method is called when all the visual components of the application have been created (ngAfterViewInit)
|
|
1558
1570
|
*
|
|
1559
|
-
* @
|
|
1571
|
+
* @param view The classname for the view that we want to create (must extend View base class). A new angular object
|
|
1572
|
+
* will be instantiated and loaded into the views container.
|
|
1560
1573
|
*/
|
|
1561
1574
|
async pushView(view) {
|
|
1562
|
-
this.verifyViewsContainerExist();
|
|
1563
1575
|
// If the loaded view is the same as the specified one, we will do nothing
|
|
1564
1576
|
if (this._loadedViewClass === view) {
|
|
1565
|
-
return
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
// If a view is already being loaded, nothing to do
|
|
1580
|
+
if (this._isLoadingView) {
|
|
1581
|
+
return;
|
|
1566
1582
|
}
|
|
1583
|
+
this._isLoadingView = true;
|
|
1567
1584
|
// If a view is already loaded, we will unload it first
|
|
1568
1585
|
if (this._loadedViewClass !== null) {
|
|
1569
1586
|
await this.removeCurrentView();
|
|
@@ -1582,18 +1599,17 @@ class ViewsService extends SingletoneStrictClass {
|
|
|
1582
1599
|
fadeInPlayer.onDone(() => {
|
|
1583
1600
|
this._currentComponentRef = newComponentRef;
|
|
1584
1601
|
this._loadedViewClass = view;
|
|
1602
|
+
this._isLoadingView = false;
|
|
1585
1603
|
resolve();
|
|
1586
1604
|
});
|
|
1587
1605
|
fadeInPlayer.play();
|
|
1588
1606
|
});
|
|
1589
|
-
return this._currentComponentRef;
|
|
1590
1607
|
}
|
|
1591
1608
|
/**
|
|
1592
1609
|
* Delete the currently loaded view from the views container, and leave it empty.
|
|
1593
1610
|
* If no view is currently loaded, this method will do nothing
|
|
1594
1611
|
*/
|
|
1595
1612
|
async popView() {
|
|
1596
|
-
this.verifyViewsContainerExist();
|
|
1597
1613
|
if (this._loadedViewClass !== null && this._currentComponentRef) {
|
|
1598
1614
|
await this.removeCurrentView();
|
|
1599
1615
|
}
|
|
@@ -1602,6 +1618,9 @@ class ViewsService extends SingletoneStrictClass {
|
|
|
1602
1618
|
* Aux method to remove the currently loaded view from the views container using a promise
|
|
1603
1619
|
*/
|
|
1604
1620
|
removeCurrentView() {
|
|
1621
|
+
if (this._viewContainerRef === null) {
|
|
1622
|
+
throw new Error('Views container not defined. Please declare a <views-container> element in your application');
|
|
1623
|
+
}
|
|
1605
1624
|
return new Promise((resolve) => {
|
|
1606
1625
|
if (this._currentComponentRef) {
|
|
1607
1626
|
const element = this._currentComponentRef.location.nativeElement;
|
|
@@ -1624,14 +1643,6 @@ class ViewsService extends SingletoneStrictClass {
|
|
|
1624
1643
|
}
|
|
1625
1644
|
});
|
|
1626
1645
|
}
|
|
1627
|
-
/**
|
|
1628
|
-
* Auxiliary method to test if the views container instance is available on the application
|
|
1629
|
-
*/
|
|
1630
|
-
verifyViewsContainerExist() {
|
|
1631
|
-
if (this._viewContainerRef === null) {
|
|
1632
|
-
throw new Error('Views container not defined. Please declare a <views-container> element in your application');
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
1646
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: ViewsService, deps: [{ token: i1$2.AnimationBuilder }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1636
1647
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: ViewsService, providedIn: 'root' }); }
|
|
1637
1648
|
}
|
|
@@ -2281,7 +2292,7 @@ class GUINotification {
|
|
|
2281
2292
|
*/
|
|
2282
2293
|
/**
|
|
2283
2294
|
* Defines an application view.
|
|
2284
|
-
* Our View components must extend this class so they can be manipulated via ViewsService and be correctly linked to a
|
|
2295
|
+
* Our View components must extend this class so they can be manipulated via ViewsService and be correctly linked to a views-container.
|
|
2285
2296
|
*/
|
|
2286
2297
|
class View {
|
|
2287
2298
|
/**
|