@stemy/ngx-utils 12.0.2 → 12.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.
- package/bundles/stemy-ngx-utils.umd.js +22 -10
- package/bundles/stemy-ngx-utils.umd.js.map +1 -1
- package/esm2015/ngx-utils/common-types.js +2 -1
- package/esm2015/ngx-utils/directives/async-method.directive.js +7 -3
- package/esm2015/ngx-utils/directives/global-template.directive.js +8 -8
- package/esm2015/ngx-utils/ngx-utils.module.js +6 -2
- package/esm2015/ngx-utils/pipes/global-template.pipe.js +7 -5
- package/esm2015/ngx-utils/services/global-template.service.js +2 -2
- package/esm2015/public_api.js +2 -2
- package/fesm2015/stemy-ngx-utils.js +22 -11
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/ngx-utils/common-types.d.ts +10 -0
- package/ngx-utils/directives/async-method.directive.d.ts +1 -1
- package/ngx-utils/directives/global-template.directive.d.ts +3 -3
- package/ngx-utils/pipes/global-template.pipe.d.ts +3 -3
- package/ngx-utils/services/global-template.service.d.ts +2 -2
- package/package.json +1 -1
- package/public_api.d.ts +1 -1
- package/stemy-ngx-utils.metadata.json +1 -1
|
@@ -792,6 +792,7 @@
|
|
|
792
792
|
var SCRIPT_PARAMS = new core.InjectionToken("script-params");
|
|
793
793
|
var ROOT_ELEMENT = new core.InjectionToken("app-root-element");
|
|
794
794
|
var ERROR_HANDLER = new core.InjectionToken("error-handler-callback");
|
|
795
|
+
var GLOBAL_TEMPLATES = new core.InjectionToken("global-templates");
|
|
795
796
|
// --- Valued promise ---
|
|
796
797
|
var ValuedPromise = /** @class */ (function (_super) {
|
|
797
798
|
__extends(ValuedPromise, _super);
|
|
@@ -3462,7 +3463,7 @@
|
|
|
3462
3463
|
GlobalTemplateService.prototype.get = function (id, component) {
|
|
3463
3464
|
var template = this.globalTemplates[id];
|
|
3464
3465
|
if (!template)
|
|
3465
|
-
return
|
|
3466
|
+
return undefined;
|
|
3466
3467
|
var modifier = this.componentModifiers[id];
|
|
3467
3468
|
if (ObjectUtils.isFunction(modifier) && component) {
|
|
3468
3469
|
modifier(component);
|
|
@@ -4380,7 +4381,9 @@
|
|
|
4380
4381
|
this.templatesUpdated.unsubscribe();
|
|
4381
4382
|
};
|
|
4382
4383
|
GlobalTemplatePipe.prototype.transform = function (templateId, component) {
|
|
4383
|
-
if (
|
|
4384
|
+
if (!templateId)
|
|
4385
|
+
return null;
|
|
4386
|
+
if (this.cachedTemplate === null || this.cachedTemplateId !== templateId) {
|
|
4384
4387
|
this.cachedTemplateId = templateId;
|
|
4385
4388
|
this.cachedTemplate = this.globalTemplates.get(templateId, component);
|
|
4386
4389
|
}
|
|
@@ -4395,7 +4398,7 @@
|
|
|
4395
4398
|
},] }
|
|
4396
4399
|
];
|
|
4397
4400
|
GlobalTemplatePipe.ctorParameters = function () { return [
|
|
4398
|
-
{ type:
|
|
4401
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [GLOBAL_TEMPLATES,] }] }
|
|
4399
4402
|
]; };
|
|
4400
4403
|
|
|
4401
4404
|
var GroupByPipe = /** @class */ (function () {
|
|
@@ -4830,9 +4833,12 @@
|
|
|
4830
4833
|
AsyncMethodDirective.prototype.callMethod = function () {
|
|
4831
4834
|
var _this = this;
|
|
4832
4835
|
if (this.loading)
|
|
4833
|
-
return;
|
|
4836
|
+
return true;
|
|
4837
|
+
var result = !this.method ? null : this.method(this.context);
|
|
4838
|
+
if (!(result instanceof Promise))
|
|
4839
|
+
return false;
|
|
4834
4840
|
this.loading = true;
|
|
4835
|
-
|
|
4841
|
+
result.then(function (result) {
|
|
4836
4842
|
_this.loading = false;
|
|
4837
4843
|
if (result) {
|
|
4838
4844
|
_this.onSuccess.emit(result);
|
|
@@ -4845,6 +4851,7 @@
|
|
|
4845
4851
|
_this.onError.emit(reason);
|
|
4846
4852
|
_this.toaster.error(reason.message, reason.context);
|
|
4847
4853
|
});
|
|
4854
|
+
return true;
|
|
4848
4855
|
};
|
|
4849
4856
|
return AsyncMethodDirective;
|
|
4850
4857
|
}());
|
|
@@ -4937,15 +4944,15 @@
|
|
|
4937
4944
|
};
|
|
4938
4945
|
|
|
4939
4946
|
var GlobalTemplateDirective = /** @class */ (function () {
|
|
4940
|
-
function GlobalTemplateDirective(
|
|
4941
|
-
this.
|
|
4947
|
+
function GlobalTemplateDirective(globalTemplates, template) {
|
|
4948
|
+
this.globalTemplates = globalTemplates;
|
|
4942
4949
|
this.template = template;
|
|
4943
4950
|
}
|
|
4944
4951
|
GlobalTemplateDirective.prototype.ngOnInit = function () {
|
|
4945
|
-
this.
|
|
4952
|
+
this.globalTemplates.add(this.id, this.template);
|
|
4946
4953
|
};
|
|
4947
4954
|
GlobalTemplateDirective.prototype.ngOnDestroy = function () {
|
|
4948
|
-
this.
|
|
4955
|
+
this.globalTemplates.remove(this.id);
|
|
4949
4956
|
};
|
|
4950
4957
|
return GlobalTemplateDirective;
|
|
4951
4958
|
}());
|
|
@@ -4955,7 +4962,7 @@
|
|
|
4955
4962
|
},] }
|
|
4956
4963
|
];
|
|
4957
4964
|
GlobalTemplateDirective.ctorParameters = function () { return [
|
|
4958
|
-
{ type:
|
|
4965
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [GLOBAL_TEMPLATES,] }] },
|
|
4959
4966
|
{ type: core.TemplateRef }
|
|
4960
4967
|
]; };
|
|
4961
4968
|
GlobalTemplateDirective.propDecorators = {
|
|
@@ -5925,6 +5932,10 @@
|
|
|
5925
5932
|
provide: CONFIG_SERVICE,
|
|
5926
5933
|
useExisting: (!config ? null : config.configService) || ConfigService
|
|
5927
5934
|
},
|
|
5935
|
+
{
|
|
5936
|
+
provide: GLOBAL_TEMPLATES,
|
|
5937
|
+
useExisting: (!config ? null : config.globalTemplates) || GlobalTemplateService
|
|
5938
|
+
},
|
|
5928
5939
|
{
|
|
5929
5940
|
provide: ROOT_ELEMENT,
|
|
5930
5941
|
useValue: null
|
|
@@ -5992,6 +6003,7 @@
|
|
|
5992
6003
|
exports.FindPipe = FindPipe;
|
|
5993
6004
|
exports.FormatNumberPipe = FormatNumberPipe;
|
|
5994
6005
|
exports.FormatterService = FormatterService;
|
|
6006
|
+
exports.GLOBAL_TEMPLATES = GLOBAL_TEMPLATES;
|
|
5995
6007
|
exports.GenericValue = GenericValue;
|
|
5996
6008
|
exports.GetOffsetPipe = GetOffsetPipe;
|
|
5997
6009
|
exports.GetTypePipe = GetTypePipe;
|