ngx-techlify-core 11.4.7 → 11.4.8
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/ngx-techlify-core.umd.js +163 -1
- package/bundles/ngx-techlify-core.umd.js.map +1 -1
- package/bundles/ngx-techlify-core.umd.min.js +1 -16
- package/bundles/ngx-techlify-core.umd.min.js.map +1 -1
- package/esm2015/lib/base-model/index.js +4 -0
- package/esm2015/lib/base-model/techlify-form-component.class.js +51 -0
- package/esm2015/lib/base-model/techlify-listing-component.class.js +41 -0
- package/esm2015/lib/base-model/techlify-service.class.js +64 -0
- package/esm2015/lib/entity-files/entity-files-view-all.component.js +2 -2
- package/esm2015/public-api.js +2 -1
- package/fesm2015/ngx-techlify-core.js +158 -2
- package/fesm2015/ngx-techlify-core.js.map +1 -1
- package/lib/base-model/index.d.ts +3 -0
- package/lib/base-model/techlify-form-component.class.d.ts +43 -0
- package/lib/base-model/techlify-listing-component.class.d.ts +47 -0
- package/lib/base-model/techlify-service.class.d.ts +52 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -62,6 +62,165 @@
|
|
|
62
62
|
{ type: ActionPopup, decorators: [{ type: i0.Inject, args: [dialog.MAT_DIALOG_DATA,] }] }
|
|
63
63
|
]; };
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Interface used to ensure we have a consistent structure across our form components
|
|
67
|
+
*
|
|
68
|
+
* It also provides some abstraction of repeated code to reduce our codebase size
|
|
69
|
+
*
|
|
70
|
+
* @todo This should be moved to ngx-techlify-core
|
|
71
|
+
*
|
|
72
|
+
* Advantages of this abstract class
|
|
73
|
+
* - Less code, less maintenance, less bugs
|
|
74
|
+
* - more consistent code
|
|
75
|
+
* - comments on more code
|
|
76
|
+
* - save time, save energy
|
|
77
|
+
*/
|
|
78
|
+
var TechlifyFormComponentInterface = /** @class */ (function () {
|
|
79
|
+
function TechlifyFormComponentInterface(formValidatorService) {
|
|
80
|
+
this.formValidatorService = formValidatorService;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Resets the value of a field in the HTML form
|
|
84
|
+
*
|
|
85
|
+
* @param event
|
|
86
|
+
* @param field
|
|
87
|
+
*/
|
|
88
|
+
TechlifyFormComponentInterface.prototype.resetFieldValue = function (event, field) {
|
|
89
|
+
var _a, _b;
|
|
90
|
+
(_b = (_a = this.form) === null || _a === void 0 ? void 0 : _a.get(field)) === null || _b === void 0 ? void 0 : _b.setValue('');
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Retrieves the value of a field from the HTML form
|
|
94
|
+
*
|
|
95
|
+
* @param field
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
TechlifyFormComponentInterface.prototype.getFieldValue = function (field) {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
return (_b = (_a = this.form) === null || _a === void 0 ? void 0 : _a.get(field)) === null || _b === void 0 ? void 0 : _b.value;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Method to evaluate form fields
|
|
104
|
+
* */
|
|
105
|
+
TechlifyFormComponentInterface.prototype.isFieldValid = function (field) {
|
|
106
|
+
return this.formValidatorService.isFieldValid(field, this.form, true);
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Method to find error in form fields
|
|
110
|
+
* */
|
|
111
|
+
TechlifyFormComponentInterface.prototype.getErrorMessage = function (field) {
|
|
112
|
+
return this.formValidatorService.getErrorMessage(field, this.form, this.errorMessages);
|
|
113
|
+
};
|
|
114
|
+
return TechlifyFormComponentInterface;
|
|
115
|
+
}());
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Interface used to ensure we have a consistent structure across our listing pages
|
|
119
|
+
*
|
|
120
|
+
* @todo This should be moved to ngx-techlify-core
|
|
121
|
+
*
|
|
122
|
+
* Advantages of this abstract class
|
|
123
|
+
* - Less code, less maintenance, less bugs
|
|
124
|
+
* - more consistent code
|
|
125
|
+
* - comments on more code
|
|
126
|
+
* - save time, save energy
|
|
127
|
+
*/
|
|
128
|
+
var TechlifyListingControllerInterface = /** @class */ (function () {
|
|
129
|
+
function TechlifyListingControllerInterface() {
|
|
130
|
+
this.models = [];
|
|
131
|
+
this.page = 1;
|
|
132
|
+
this.perPage = 25;
|
|
133
|
+
this.lastPage = 500;
|
|
134
|
+
this.isWorking = false;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Reload all data from page 1
|
|
138
|
+
*/
|
|
139
|
+
TechlifyListingControllerInterface.prototype.reload = function () {
|
|
140
|
+
this.models = [];
|
|
141
|
+
this.page = 1;
|
|
142
|
+
if (!this.isWorking) {
|
|
143
|
+
this.loadData();
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Can be called when the user is scrolling,
|
|
148
|
+
* to trigger loading a new page of data
|
|
149
|
+
*/
|
|
150
|
+
TechlifyListingControllerInterface.prototype.onScroll = function () {
|
|
151
|
+
if (!this.isWorking && this.page < this.lastPage) {
|
|
152
|
+
this.page += 1;
|
|
153
|
+
this.loadData();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
return TechlifyListingControllerInterface;
|
|
157
|
+
}());
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Interface used to ensure we have a consistent structure across our listing pages
|
|
161
|
+
*
|
|
162
|
+
* @todo This should be moved to ngx-techlify-core
|
|
163
|
+
*
|
|
164
|
+
* Advantages of this abstract class
|
|
165
|
+
* - Less code, less maintenance, less bugs
|
|
166
|
+
* - more consistent code
|
|
167
|
+
* - comments on more code
|
|
168
|
+
* - save time, save energy
|
|
169
|
+
*/
|
|
170
|
+
var TechlifyServiceBaseClass = /** @class */ (function () {
|
|
171
|
+
function TechlifyServiceBaseClass(http, baseUrl) {
|
|
172
|
+
this.http = http;
|
|
173
|
+
this.baseUrl = "you-forgot-to-set-a-base-url";
|
|
174
|
+
this.baseUrl = baseUrl;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Loads a set of the model this service is for
|
|
178
|
+
*
|
|
179
|
+
* @param filters Restrictors to filter the set of models
|
|
180
|
+
* @returns
|
|
181
|
+
*/
|
|
182
|
+
TechlifyServiceBaseClass.prototype.index = function (filters) {
|
|
183
|
+
return this.http.get("api/" + this.baseUrl, { params: Object.assign({}, filters) }).toPromise();
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Add a new record to the database
|
|
187
|
+
*
|
|
188
|
+
* @param model The data of the model to add
|
|
189
|
+
* @returns
|
|
190
|
+
*/
|
|
191
|
+
TechlifyServiceBaseClass.prototype.store = function (model) {
|
|
192
|
+
return this.http.post("api/" + this.baseUrl, model).toPromise();
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Load a single model record, often with all relations and related data
|
|
196
|
+
*
|
|
197
|
+
* @param modelId ID of the model to load
|
|
198
|
+
* @returns
|
|
199
|
+
*/
|
|
200
|
+
TechlifyServiceBaseClass.prototype.show = function (modelId) {
|
|
201
|
+
return this.http.get("api/" + this.baseUrl + "/" + modelId).toPromise();
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Update fields of a single existing model
|
|
205
|
+
*
|
|
206
|
+
* @param model Model to update
|
|
207
|
+
* @returns
|
|
208
|
+
*/
|
|
209
|
+
TechlifyServiceBaseClass.prototype.update = function (model) {
|
|
210
|
+
return this.http.put("api/" + this.baseUrl + "/" + model.id, model).toPromise();
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Delete a single model
|
|
214
|
+
*
|
|
215
|
+
* @param model Model to delete
|
|
216
|
+
* @returns
|
|
217
|
+
*/
|
|
218
|
+
TechlifyServiceBaseClass.prototype.delete = function (model) {
|
|
219
|
+
return this.http.delete("api/" + this.baseUrl + "/" + model.id).toPromise();
|
|
220
|
+
};
|
|
221
|
+
return TechlifyServiceBaseClass;
|
|
222
|
+
}());
|
|
223
|
+
|
|
65
224
|
/*! *****************************************************************************
|
|
66
225
|
Copyright (c) Microsoft Corporation.
|
|
67
226
|
|
|
@@ -1800,6 +1959,7 @@
|
|
|
1800
1959
|
})];
|
|
1801
1960
|
case 1:
|
|
1802
1961
|
result = _a.sent();
|
|
1962
|
+
this.reload();
|
|
1803
1963
|
return [2 /*return*/];
|
|
1804
1964
|
}
|
|
1805
1965
|
});
|
|
@@ -1808,7 +1968,6 @@
|
|
|
1808
1968
|
_a.sent();
|
|
1809
1969
|
this.fileList = [];
|
|
1810
1970
|
this.alertService.addAlert('Successfull uploaded', 'success');
|
|
1811
|
-
this.reload();
|
|
1812
1971
|
_a.label = 2;
|
|
1813
1972
|
case 2: return [2 /*return*/];
|
|
1814
1973
|
}
|
|
@@ -8094,6 +8253,9 @@
|
|
|
8094
8253
|
exports.TechlifyFeatureEnabledDirective = TechlifyFeatureEnabledDirective;
|
|
8095
8254
|
exports.TechlifyFeatureModule = TechlifyFeatureModule;
|
|
8096
8255
|
exports.TechlifyFeatureRoutes = TechlifyFeatureRoutes;
|
|
8256
|
+
exports.TechlifyFormComponentInterface = TechlifyFormComponentInterface;
|
|
8257
|
+
exports.TechlifyListingControllerInterface = TechlifyListingControllerInterface;
|
|
8258
|
+
exports.TechlifyServiceBaseClass = TechlifyServiceBaseClass;
|
|
8097
8259
|
exports.TechlifyTaggerTagFormConfigModel = TechlifyTaggerTagFormConfigModel;
|
|
8098
8260
|
exports.TechlifyTaggerTagFormFieldModule = TechlifyTaggerTagFormFieldModule;
|
|
8099
8261
|
exports.TechlifyTaggerTagSelectorModule = TechlifyTaggerTagSelectorModule;
|