ngx-techlify-core 14.2.0 → 14.3.0
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/esm2020/lib/base-model/techlify-service.class.mjs +20 -19
- package/esm2020/lib/request-helper/request-helper.service.mjs +2 -3
- package/fesm2015/ngx-techlify-core.mjs +33 -34
- package/fesm2015/ngx-techlify-core.mjs.map +1 -1
- package/fesm2020/ngx-techlify-core.mjs +33 -34
- package/fesm2020/ngx-techlify-core.mjs.map +1 -1
- package/lib/base-model/techlify-service.class.d.ts +16 -14
- package/lib/base-model/techlify-service.class.d.ts.map +1 -1
- package/lib/request-helper/request-helper.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -55,7 +55,7 @@ import * as i11 from '@angular/material/progress-spinner';
|
|
|
55
55
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
56
56
|
import * as i1$5 from '@angular/material/select';
|
|
57
57
|
import { MatSelectModule } from '@angular/material/select';
|
|
58
|
-
import moment
|
|
58
|
+
import moment from 'moment';
|
|
59
59
|
import * as i9$1 from '@angular/material/datepicker';
|
|
60
60
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
61
61
|
import * as i1$6 from '@angular/router';
|
|
@@ -74,7 +74,6 @@ import * as i3$2 from '@angular/platform-browser';
|
|
|
74
74
|
import * as jsondiffpatch from 'jsondiffpatch';
|
|
75
75
|
import * as i2$1 from '@angular/material/slide-toggle';
|
|
76
76
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
77
|
-
import * as moment from 'moment/moment';
|
|
78
77
|
|
|
79
78
|
class ActionPopup {
|
|
80
79
|
}
|
|
@@ -199,8 +198,6 @@ class TechlifyListingControllerInterface {
|
|
|
199
198
|
/**
|
|
200
199
|
* Interface used to ensure we have a consistent structure across our listing pages
|
|
201
200
|
*
|
|
202
|
-
* @todo This should be moved to ngx-techlify-core
|
|
203
|
-
*
|
|
204
201
|
* Advantages of this abstract class
|
|
205
202
|
* - Less code, less maintenance, less bugs
|
|
206
203
|
* - more consistent code
|
|
@@ -210,53 +207,56 @@ class TechlifyListingControllerInterface {
|
|
|
210
207
|
class TechlifyServiceBaseClass {
|
|
211
208
|
constructor(http, baseUrl) {
|
|
212
209
|
this.http = http;
|
|
213
|
-
this.baseUrl =
|
|
210
|
+
this.baseUrl = 'you-forgot-to-set-a-base-url';
|
|
214
211
|
this.baseUrl = baseUrl;
|
|
215
212
|
}
|
|
216
213
|
/**
|
|
217
214
|
* Loads a set of the model this service is for
|
|
218
215
|
*
|
|
219
|
-
* @param
|
|
220
|
-
* @
|
|
216
|
+
* @param params Query parameters
|
|
217
|
+
* @return Observable<any>
|
|
221
218
|
*/
|
|
222
|
-
index(
|
|
223
|
-
return this.http.get(`api/${this.baseUrl}`, { params
|
|
219
|
+
index(params) {
|
|
220
|
+
return this.http.get(`api/${this.baseUrl}`, { params });
|
|
224
221
|
}
|
|
225
222
|
/**
|
|
226
223
|
* Add a new record to the database
|
|
227
224
|
*
|
|
228
225
|
* @param model The data of the model to add
|
|
229
|
-
* @
|
|
226
|
+
* @param params Query parameters
|
|
227
|
+
* @return Observable<any>
|
|
230
228
|
*/
|
|
231
|
-
store(model) {
|
|
232
|
-
return this.http.post(`api/${this.baseUrl}`, model)
|
|
229
|
+
store(model, params) {
|
|
230
|
+
return this.http.post(`api/${this.baseUrl}`, model, { params });
|
|
233
231
|
}
|
|
234
232
|
/**
|
|
235
233
|
* Load a single model record, often with all relations and related data
|
|
236
234
|
*
|
|
237
235
|
* @param modelId ID of the model to load
|
|
238
|
-
* @
|
|
236
|
+
* @param params Query parameters
|
|
237
|
+
* @return Observable<any>
|
|
239
238
|
*/
|
|
240
|
-
show(modelId) {
|
|
241
|
-
return this.http.get(`api/${this.baseUrl}/${modelId}
|
|
239
|
+
show(modelId, params) {
|
|
240
|
+
return this.http.get(`api/${this.baseUrl}/${modelId}`, { params });
|
|
242
241
|
}
|
|
243
242
|
/**
|
|
244
243
|
* Update fields of a single existing model
|
|
245
244
|
*
|
|
246
245
|
* @param model Model to update
|
|
247
|
-
* @
|
|
246
|
+
* @param params Query parameters
|
|
247
|
+
* @return Observable<any>
|
|
248
248
|
*/
|
|
249
|
-
update(model) {
|
|
250
|
-
return this.http.put(`api/${this.baseUrl}/${model.id}`, model)
|
|
249
|
+
update(model, params) {
|
|
250
|
+
return this.http.put(`api/${this.baseUrl}/${model.id}`, model, { params });
|
|
251
251
|
}
|
|
252
252
|
/**
|
|
253
253
|
* Delete a single model
|
|
254
254
|
*
|
|
255
255
|
* @param model Model to delete
|
|
256
|
-
* @
|
|
256
|
+
* @return Observable<any>
|
|
257
257
|
*/
|
|
258
258
|
delete(model) {
|
|
259
|
-
return this.http.delete(`api/${this.baseUrl}/${model.id}`)
|
|
259
|
+
return this.http.delete(`api/${this.baseUrl}/${model.id}`);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
|
|
@@ -2982,79 +2982,79 @@ function calculateTimeline(value) {
|
|
|
2982
2982
|
break;
|
|
2983
2983
|
}
|
|
2984
2984
|
case Timeline.TODAY: { // Today
|
|
2985
|
-
const now = moment
|
|
2985
|
+
const now = moment();
|
|
2986
2986
|
data.date_from = now.startOf('day').toISOString();
|
|
2987
2987
|
data.date_to = now.endOf('day').toISOString();
|
|
2988
2988
|
break;
|
|
2989
2989
|
}
|
|
2990
2990
|
case Timeline.YESTERDAY: { // Yesterday
|
|
2991
|
-
const now = moment
|
|
2991
|
+
const now = moment().subtract(1, 'day');
|
|
2992
2992
|
data.date_from = now.startOf('day').toISOString();
|
|
2993
2993
|
data.date_to = now.endOf('day').toISOString();
|
|
2994
2994
|
break;
|
|
2995
2995
|
}
|
|
2996
2996
|
case Timeline.THIS_WEEK: { // This Week
|
|
2997
|
-
const now = moment
|
|
2997
|
+
const now = moment();
|
|
2998
2998
|
data.date_from = now.startOf('isoWeek').toISOString();
|
|
2999
2999
|
data.date_to = now.endOf('isoWeek').toISOString();
|
|
3000
3000
|
break;
|
|
3001
3001
|
}
|
|
3002
3002
|
case Timeline.LAST_WEEK: { // Last Week
|
|
3003
|
-
const now = moment
|
|
3003
|
+
const now = moment().subtract(1, 'week');
|
|
3004
3004
|
data.date_from = now.startOf('isoWeek').toISOString();
|
|
3005
3005
|
data.date_to = now.endOf('isoWeek').toISOString();
|
|
3006
3006
|
break;
|
|
3007
3007
|
}
|
|
3008
3008
|
case Timeline.THIS_MONTH: { // This Month
|
|
3009
|
-
const now = moment
|
|
3009
|
+
const now = moment();
|
|
3010
3010
|
data.date_from = now.startOf('month').toISOString();
|
|
3011
3011
|
data.date_to = now.endOf('month').toISOString();
|
|
3012
3012
|
break;
|
|
3013
3013
|
}
|
|
3014
3014
|
case Timeline.LAST_MONTH: { // Last Month
|
|
3015
|
-
const now = moment
|
|
3015
|
+
const now = moment().subtract(1, 'month');
|
|
3016
3016
|
data.date_from = now.startOf('month').toISOString();
|
|
3017
3017
|
data.date_to = now.endOf('month').toISOString();
|
|
3018
3018
|
break;
|
|
3019
3019
|
}
|
|
3020
3020
|
case Timeline.THIS_QUARTER: { // This Quarter
|
|
3021
|
-
const now = moment
|
|
3021
|
+
const now = moment();
|
|
3022
3022
|
data.date_from = now.startOf('quarter').toISOString();
|
|
3023
3023
|
data.date_to = now.endOf('quarter').toISOString();
|
|
3024
3024
|
break;
|
|
3025
3025
|
}
|
|
3026
3026
|
case Timeline.LAST_QUARTER: { // Last Quarter
|
|
3027
|
-
const now = moment
|
|
3027
|
+
const now = moment().subtract(1, 'quarter');
|
|
3028
3028
|
data.date_from = now.startOf('quarter').toISOString();
|
|
3029
3029
|
data.date_to = now.endOf('quarter').toISOString();
|
|
3030
3030
|
break;
|
|
3031
3031
|
}
|
|
3032
3032
|
case Timeline.THIS_YEAR: { // This Year
|
|
3033
|
-
const now = moment
|
|
3033
|
+
const now = moment();
|
|
3034
3034
|
data.date_from = now.startOf('year').toISOString();
|
|
3035
3035
|
data.date_to = now.endOf('year').toISOString();
|
|
3036
3036
|
break;
|
|
3037
3037
|
}
|
|
3038
3038
|
case Timeline.LAST_YEAR: { // Last Year
|
|
3039
|
-
const now = moment
|
|
3039
|
+
const now = moment().subtract(1, 'year');
|
|
3040
3040
|
data.date_from = now.startOf('year').toISOString();
|
|
3041
3041
|
data.date_to = now.endOf('year').toISOString();
|
|
3042
3042
|
break;
|
|
3043
3043
|
}
|
|
3044
3044
|
case Timeline.TOMMOROW: {
|
|
3045
|
-
const now = moment
|
|
3045
|
+
const now = moment().add(1, 'day');
|
|
3046
3046
|
data.date_from = now.startOf('day').toISOString();
|
|
3047
3047
|
data.date_to = now.endOf('day').toISOString();
|
|
3048
3048
|
break;
|
|
3049
3049
|
}
|
|
3050
3050
|
case Timeline.NEXT_WEEK: {
|
|
3051
|
-
const now = moment
|
|
3051
|
+
const now = moment().add(1, 'week');
|
|
3052
3052
|
data.date_from = now.startOf('isoWeek').toISOString();
|
|
3053
3053
|
data.date_to = now.endOf('isoWeek').toISOString();
|
|
3054
3054
|
break;
|
|
3055
3055
|
}
|
|
3056
3056
|
case Timeline.NEXT_MONTH: {
|
|
3057
|
-
const now = moment
|
|
3057
|
+
const now = moment().add(1, 'month');
|
|
3058
3058
|
data.date_from = now.startOf('month').toISOString();
|
|
3059
3059
|
data.date_to = now.endOf('month').toISOString();
|
|
3060
3060
|
break;
|
|
@@ -7682,7 +7682,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImpor
|
|
|
7682
7682
|
}] });
|
|
7683
7683
|
|
|
7684
7684
|
/* tslint:disable:radix */
|
|
7685
|
-
// import {isNumeric} from 'rxjs/internal-compatibility';
|
|
7686
7685
|
class RequestHelperService {
|
|
7687
7686
|
constructor(router, activatedRoute) {
|
|
7688
7687
|
this.router = router;
|