@smallpearl/ngx-helper 0.33.49 → 20.0.2
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/core/index.d.ts +3 -1
- package/entities/index.d.ts +313 -2
- package/entity-field/index.d.ts +101 -2
- package/fesm2022/smallpearl-ngx-helper-entities.mjs +18 -18
- package/fesm2022/smallpearl-ngx-helper-entities.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs +5 -4
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-forms.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs +6 -6
- package/fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-locale.mjs +6 -6
- package/fesm2022/smallpearl-ngx-helper-locale.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs +57 -31
- package/fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs +15 -15
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs +347 -359
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs +152 -146
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs +5 -5
- package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs +19 -19
- package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs +25 -26
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-infinite-scroll.mjs +7 -7
- package/fesm2022/smallpearl-ngx-helper-mat-select-infinite-scroll.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs +24 -24
- package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs +8 -9
- package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-sideload.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs +35 -35
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs.map +1 -1
- package/forms/index.d.ts +55 -1
- package/hover-dropdown/index.d.ts +44 -1
- package/index.d.ts +4 -5
- package/locale/index.d.ts +55 -5
- package/mat-busy-wheel/index.d.ts +165 -4
- package/mat-context-menu/index.d.ts +65 -1
- package/mat-entity-crud/index.d.ts +1075 -6
- package/mat-entity-list/index.d.ts +394 -3
- package/mat-file-input/index.d.ts +61 -1
- package/mat-form-error/index.d.ts +184 -6
- package/mat-select-entity/index.d.ts +194 -1
- package/mat-select-infinite-scroll/index.d.ts +45 -2
- package/mat-side-menu-layout/index.d.ts +180 -6
- package/mat-tel-input/index.d.ts +169 -2
- package/package.json +14 -14
- package/sideload/index.d.ts +20 -1
- package/stationary-with-line-items/index.d.ts +78 -1
- package/core/src/version.d.ts +0 -1
- package/entities/src/paged-loader.d.ts +0 -219
- package/entities/src/paginator.d.ts +0 -87
- package/entity-field/src/entity-field.d.ts +0 -70
- package/entity-field/src/provider.d.ts +0 -27
- package/forms/src/validation-error-handler.d.ts +0 -52
- package/hover-dropdown/src/hover-dropdown.directive.d.ts +0 -41
- package/locale/src/currency.pipe.d.ts +0 -14
- package/locale/src/date.pipe.d.ts +0 -14
- package/locale/src/format-currency.d.ts +0 -1
- package/locale/src/format-date.d.ts +0 -2
- package/locale/src/is-empty.d.ts +0 -1
- package/locale/src/providers.d.ts +0 -20
- package/mat-busy-wheel/src/busy-wheel-op.d.ts +0 -65
- package/mat-busy-wheel/src/busy-wheel.component.d.ts +0 -12
- package/mat-busy-wheel/src/busy-wheel.service.d.ts +0 -42
- package/mat-busy-wheel/src/host-busy-wheel.directive.d.ts +0 -35
- package/mat-context-menu/src/mat-context-menu.component.d.ts +0 -61
- package/mat-entity-crud/src/convert-context-input-to-http-context.d.ts +0 -11
- package/mat-entity-crud/src/default-config.d.ts +0 -9
- package/mat-entity-crud/src/form-view-host.component.d.ts +0 -43
- package/mat-entity-crud/src/mat-entity-crud-form-base.d.ts +0 -277
- package/mat-entity-crud/src/mat-entity-crud-internal-types.d.ts +0 -138
- package/mat-entity-crud/src/mat-entity-crud-item-action.d.ts +0 -68
- package/mat-entity-crud/src/mat-entity-crud-types.d.ts +0 -158
- package/mat-entity-crud/src/mat-entity-crud.component.d.ts +0 -367
- package/mat-entity-crud/src/preview-host.component.d.ts +0 -21
- package/mat-entity-crud/src/preview-pane.component.d.ts +0 -31
- package/mat-entity-crud/src/providers.d.ts +0 -3
- package/mat-entity-list/src/config.d.ts +0 -6
- package/mat-entity-list/src/mat-entity-list-types.d.ts +0 -128
- package/mat-entity-list/src/mat-entity-list.component.d.ts +0 -259
- package/mat-entity-list/src/providers.d.ts +0 -3
- package/mat-file-input/src/mat-file-input.component.d.ts +0 -58
- package/mat-form-error/src/locales/en.d.ts +0 -4
- package/mat-form-error/src/locales/hu.d.ts +0 -4
- package/mat-form-error/src/locales/index.d.ts +0 -5
- package/mat-form-error/src/locales/pt-br.d.ts +0 -4
- package/mat-form-error/src/locales/zh-hans.d.ts +0 -4
- package/mat-form-error/src/locales/zh-hant.d.ts +0 -4
- package/mat-form-error/src/ngx-error-list.component.d.ts +0 -9
- package/mat-form-error/src/ngx-mat-error-control.d.ts +0 -17
- package/mat-form-error/src/ngx-mat-error-def.directive.d.ts +0 -30
- package/mat-form-error/src/ngx-mat-errors-for-date-range-picker.directive.d.ts +0 -8
- package/mat-form-error/src/ngx-mat-errors.component.d.ts +0 -44
- package/mat-form-error/src/types.d.ts +0 -68
- package/mat-form-error/src/utils/coerce-to-observable.d.ts +0 -3
- package/mat-form-error/src/utils/distinct-until-error-changed.d.ts +0 -2
- package/mat-form-error/src/utils/find-error-for-control.d.ts +0 -9
- package/mat-form-error/src/utils/get-abstract-controls.d.ts +0 -3
- package/mat-form-error/src/utils/get-control-with-error.d.ts +0 -3
- package/mat-select-entity/src/mat-select-entity.component.d.ts +0 -190
- package/mat-select-infinite-scroll/src/mat-select-infinite-scroll.directive.d.ts +0 -19
- package/mat-select-infinite-scroll/src/mat-select-infinite-scroll.service.d.ts +0 -25
- package/mat-side-menu-layout/src/layout.service.d.ts +0 -23
- package/mat-side-menu-layout/src/mat-menu-layout.component.d.ts +0 -39
- package/mat-side-menu-layout/src/mat-menu-layout.module.d.ts +0 -18
- package/mat-side-menu-layout/src/mat-menu-list-item.component.d.ts +0 -36
- package/mat-side-menu-layout/src/mat-menu-pane.component.d.ts +0 -66
- package/mat-side-menu-layout/src/nav-item.d.ts +0 -10
- package/mat-tel-input/src/country-codes.d.ts +0 -5
- package/mat-tel-input/src/mat-telephone.component.d.ts +0 -129
- package/mat-tel-input/src/providers.d.ts +0 -38
- package/ngx-helper.d.ts +0 -2
- package/public-api.d.ts +0 -1
- package/sideload/src/sideload.d.ts +0 -18
- package/stationary-with-line-items/src/stationary-with-line-items.component.d.ts +0 -74
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i1 from '@angular/common';
|
|
2
2
|
import { AsyncPipe, CommonModule, UpperCasePipe } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { input, computed,
|
|
4
|
+
import { input, computed, ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
|
5
5
|
import { SP_ENTITY_FIELD_CONFIG, SPEntityField } from '@smallpearl/ngx-helper/entity-field';
|
|
6
|
-
import {
|
|
6
|
+
import { of, Observable } from 'rxjs';
|
|
7
7
|
|
|
8
8
|
// @Component({
|
|
9
9
|
// standalone: true,
|
|
@@ -46,9 +46,9 @@ import { Observable, of } from 'rxjs';
|
|
|
46
46
|
// }
|
|
47
47
|
class FieldsRendererComponent {
|
|
48
48
|
cdr;
|
|
49
|
-
entity = input.required();
|
|
50
|
-
fields = input.required();
|
|
51
|
-
isString = computed(() => typeof this.fields() === 'string');
|
|
49
|
+
entity = input.required(...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
50
|
+
fields = input.required(...(ngDevMode ? [{ debugName: "fields" }] : []));
|
|
51
|
+
isString = computed(() => typeof this.fields() === 'string', ...(ngDevMode ? [{ debugName: "isString" }] : []));
|
|
52
52
|
// If the field is a single string, looks up entity's properties
|
|
53
53
|
// for matching field name as the string and if it doesn't exist returns
|
|
54
54
|
// the string itself as the value.
|
|
@@ -58,13 +58,13 @@ class FieldsRendererComponent {
|
|
|
58
58
|
return this.entity()[fields] ?? fields;
|
|
59
59
|
}
|
|
60
60
|
return '';
|
|
61
|
-
});
|
|
61
|
+
}, ...(ngDevMode ? [{ debugName: "stringValue" }] : []));
|
|
62
62
|
constructor(cdr) {
|
|
63
63
|
this.cdr = cdr;
|
|
64
64
|
}
|
|
65
65
|
ngOnInit() { }
|
|
66
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
67
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
66
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FieldsRendererComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
67
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: FieldsRendererComponent, isStandalone: true, selector: "sp-fields-renderer", inputs: { entity: { classPropertyName: "entity", publicName: "entity", isSignal: true, isRequired: true, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
68
68
|
@if (isString()) {
|
|
69
69
|
{{ stringValue() }}
|
|
70
70
|
} @else {
|
|
@@ -83,7 +83,7 @@ class FieldsRendererComponent {
|
|
|
83
83
|
}
|
|
84
84
|
`, isInline: true, styles: [".field-values{padding:.2em 0;text-align:end}tr td:first-of-type{padding-right:1em}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
85
85
|
}
|
|
86
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
86
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FieldsRendererComponent, decorators: [{
|
|
87
87
|
type: Component,
|
|
88
88
|
args: [{ imports: [AsyncPipe], selector: 'sp-fields-renderer', template: `
|
|
89
89
|
@if (isString()) {
|
|
@@ -103,7 +103,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
103
103
|
</div>
|
|
104
104
|
}
|
|
105
105
|
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".field-values{padding:.2em 0;text-align:end}tr td:first-of-type{padding-right:1em}\n"] }]
|
|
106
|
-
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
106
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { entity: [{ type: i0.Input, args: [{ isSignal: true, alias: "entity", required: true }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: true }] }] } });
|
|
107
107
|
/**
|
|
108
108
|
* A component that renders a stationary with line items, such as invoice,
|
|
109
109
|
* payment receipt, bill, bill payment record, journal entry, etc. All these
|
|
@@ -120,26 +120,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
120
120
|
* This is the first towards that long path ahead.
|
|
121
121
|
*/
|
|
122
122
|
class StationaryWithLineItemsComponent {
|
|
123
|
-
entity = input.required();
|
|
124
|
-
title = input.required();
|
|
125
|
-
number = input();
|
|
126
|
-
leftHeader = input();
|
|
127
|
-
_leftHeaderFields = computed(() => this.getSPEntityFields(this.leftHeader()));
|
|
128
|
-
leftHeaderTemplate = input();
|
|
129
|
-
rightHeader = input();
|
|
130
|
-
_rightHeaderFields = computed(() => this.getSPEntityFields(this.rightHeader()));
|
|
131
|
-
rightHeaderTemplate = input();
|
|
132
|
-
items = input();
|
|
133
|
-
leftFooter = input();
|
|
134
|
-
_leftFooterFields = computed(() => this.getSPEntityFields(this.leftFooter()));
|
|
135
|
-
leftFooterTemplate = input();
|
|
136
|
-
rightFooter = input();
|
|
137
|
-
_rightFooterFields = computed(() => this.getSPEntityFields(this.rightFooter()));
|
|
138
|
-
rightFooterTemplate = input();
|
|
139
|
-
itemFieldName = input('items');
|
|
140
|
-
itemColumnFields = input();
|
|
141
|
-
_itemColumnFields = computed(() => this.getSPEntityFields(this.itemColumnFields()));
|
|
142
|
-
_items = computed(() => this.entity()[this.itemFieldName()]);
|
|
123
|
+
entity = input.required(...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
124
|
+
title = input.required(...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
125
|
+
number = input(...(ngDevMode ? [undefined, { debugName: "number" }] : []));
|
|
126
|
+
leftHeader = input(...(ngDevMode ? [undefined, { debugName: "leftHeader" }] : []));
|
|
127
|
+
_leftHeaderFields = computed(() => this.getSPEntityFields(this.leftHeader()), ...(ngDevMode ? [{ debugName: "_leftHeaderFields" }] : []));
|
|
128
|
+
leftHeaderTemplate = input(...(ngDevMode ? [undefined, { debugName: "leftHeaderTemplate" }] : []));
|
|
129
|
+
rightHeader = input(...(ngDevMode ? [undefined, { debugName: "rightHeader" }] : []));
|
|
130
|
+
_rightHeaderFields = computed(() => this.getSPEntityFields(this.rightHeader()), ...(ngDevMode ? [{ debugName: "_rightHeaderFields" }] : []));
|
|
131
|
+
rightHeaderTemplate = input(...(ngDevMode ? [undefined, { debugName: "rightHeaderTemplate" }] : []));
|
|
132
|
+
items = input(...(ngDevMode ? [undefined, { debugName: "items" }] : []));
|
|
133
|
+
leftFooter = input(...(ngDevMode ? [undefined, { debugName: "leftFooter" }] : []));
|
|
134
|
+
_leftFooterFields = computed(() => this.getSPEntityFields(this.leftFooter()), ...(ngDevMode ? [{ debugName: "_leftFooterFields" }] : []));
|
|
135
|
+
leftFooterTemplate = input(...(ngDevMode ? [undefined, { debugName: "leftFooterTemplate" }] : []));
|
|
136
|
+
rightFooter = input(...(ngDevMode ? [undefined, { debugName: "rightFooter" }] : []));
|
|
137
|
+
_rightFooterFields = computed(() => this.getSPEntityFields(this.rightFooter()), ...(ngDevMode ? [{ debugName: "_rightFooterFields" }] : []));
|
|
138
|
+
rightFooterTemplate = input(...(ngDevMode ? [undefined, { debugName: "rightFooterTemplate" }] : []));
|
|
139
|
+
itemFieldName = input('items', ...(ngDevMode ? [{ debugName: "itemFieldName" }] : []));
|
|
140
|
+
itemColumnFields = input(...(ngDevMode ? [undefined, { debugName: "itemColumnFields" }] : []));
|
|
141
|
+
_itemColumnFields = computed(() => this.getSPEntityFields(this.itemColumnFields()), ...(ngDevMode ? [{ debugName: "_itemColumnFields" }] : []));
|
|
142
|
+
_items = computed(() => this.entity()[this.itemFieldName()], ...(ngDevMode ? [{ debugName: "_items" }] : []));
|
|
143
143
|
ngxEntityFieldConfig = inject(SP_ENTITY_FIELD_CONFIG, { optional: true });
|
|
144
144
|
constructor() { }
|
|
145
145
|
ngOnInit() { }
|
|
@@ -165,8 +165,8 @@ class StationaryWithLineItemsComponent {
|
|
|
165
165
|
}
|
|
166
166
|
return of('');
|
|
167
167
|
}
|
|
168
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
169
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
168
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: StationaryWithLineItemsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
169
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: StationaryWithLineItemsComponent, isStandalone: true, selector: "sp-stationary-with-line-items", inputs: { entity: { classPropertyName: "entity", publicName: "entity", isSignal: true, isRequired: true, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, number: { classPropertyName: "number", publicName: "number", isSignal: true, isRequired: false, transformFunction: null }, leftHeader: { classPropertyName: "leftHeader", publicName: "leftHeader", isSignal: true, isRequired: false, transformFunction: null }, leftHeaderTemplate: { classPropertyName: "leftHeaderTemplate", publicName: "leftHeaderTemplate", isSignal: true, isRequired: false, transformFunction: null }, rightHeader: { classPropertyName: "rightHeader", publicName: "rightHeader", isSignal: true, isRequired: false, transformFunction: null }, rightHeaderTemplate: { classPropertyName: "rightHeaderTemplate", publicName: "rightHeaderTemplate", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, leftFooter: { classPropertyName: "leftFooter", publicName: "leftFooter", isSignal: true, isRequired: false, transformFunction: null }, leftFooterTemplate: { classPropertyName: "leftFooterTemplate", publicName: "leftFooterTemplate", isSignal: true, isRequired: false, transformFunction: null }, rightFooter: { classPropertyName: "rightFooter", publicName: "rightFooter", isSignal: true, isRequired: false, transformFunction: null }, rightFooterTemplate: { classPropertyName: "rightFooterTemplate", publicName: "rightFooterTemplate", isSignal: true, isRequired: false, transformFunction: null }, itemFieldName: { classPropertyName: "itemFieldName", publicName: "itemFieldName", isSignal: true, isRequired: false, transformFunction: null }, itemColumnFields: { classPropertyName: "itemColumnFields", publicName: "itemColumnFields", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
170
170
|
<div class="stationary-wrapper mat-body">
|
|
171
171
|
<div class="title">{{ title() }}</div>
|
|
172
172
|
@if (number()) {
|
|
@@ -268,9 +268,9 @@ class StationaryWithLineItemsComponent {
|
|
|
268
268
|
</div>
|
|
269
269
|
</div>
|
|
270
270
|
</div>
|
|
271
|
-
`, isInline: true, styles: [".stationary-wrapper{padding:2em 1em}.title{font-size:1.6em;font-weight:600;text-align:end;margin-bottom:.5em}.number{font-size:1.1em;font-weight:500;text-align:end;margin-bottom:.5em}.header,.footer{display:flex;flex-direction:row;margin-top:1em}.left-header,.left-footer{display:flex;align-items:bottom;text-align:start;padding-right:1em;min-width:50%;overflow-wrap:break-word;text-wrap:wrap}.right-header,.right-footer{display:flex;justify-content:flex-end;min-width:50%;overflow:clip}.items{margin:2em 0}.items table{width:100%;border:0px solid lightgray}.items table thead{background-color:#000;color:#fff}.items table thead th{padding:.4em}.items table td{padding:.8em .4em;border-bottom:1px solid lightgray;border-right:0px solid lightgray}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "
|
|
271
|
+
`, isInline: true, styles: [".stationary-wrapper{padding:2em 1em}.title{font-size:1.6em;font-weight:600;text-align:end;margin-bottom:.5em}.number{font-size:1.1em;font-weight:500;text-align:end;margin-bottom:.5em}.header,.footer{display:flex;flex-direction:row;margin-top:1em}.left-header,.left-footer{display:flex;align-items:bottom;text-align:start;padding-right:1em;min-width:50%;overflow-wrap:break-word;text-wrap:wrap}.right-header,.right-footer{display:flex;justify-content:flex-end;min-width:50%;overflow:clip}.items{margin:2em 0}.items table{width:100%;border:0px solid lightgray}.items table thead{background-color:#000;color:#fff}.items table thead th{padding:.4em}.items table td{padding:.8em .4em;border-bottom:1px solid lightgray;border-right:0px solid lightgray}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FieldsRendererComponent, selector: "sp-fields-renderer", inputs: ["entity", "fields"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
272
272
|
}
|
|
273
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: StationaryWithLineItemsComponent, decorators: [{
|
|
274
274
|
type: Component,
|
|
275
275
|
args: [{ imports: [
|
|
276
276
|
CommonModule,
|
|
@@ -379,7 +379,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
379
379
|
</div>
|
|
380
380
|
</div>
|
|
381
381
|
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".stationary-wrapper{padding:2em 1em}.title{font-size:1.6em;font-weight:600;text-align:end;margin-bottom:.5em}.number{font-size:1.1em;font-weight:500;text-align:end;margin-bottom:.5em}.header,.footer{display:flex;flex-direction:row;margin-top:1em}.left-header,.left-footer{display:flex;align-items:bottom;text-align:start;padding-right:1em;min-width:50%;overflow-wrap:break-word;text-wrap:wrap}.right-header,.right-footer{display:flex;justify-content:flex-end;min-width:50%;overflow:clip}.items{margin:2em 0}.items table{width:100%;border:0px solid lightgray}.items table thead{background-color:#000;color:#fff}.items table thead th{padding:.4em}.items table td{padding:.8em .4em;border-bottom:1px solid lightgray;border-right:0px solid lightgray}\n"] }]
|
|
382
|
-
}], ctorParameters: () => [] });
|
|
382
|
+
}], ctorParameters: () => [], propDecorators: { entity: [{ type: i0.Input, args: [{ isSignal: true, alias: "entity", required: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], number: [{ type: i0.Input, args: [{ isSignal: true, alias: "number", required: false }] }], leftHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "leftHeader", required: false }] }], leftHeaderTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "leftHeaderTemplate", required: false }] }], rightHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "rightHeader", required: false }] }], rightHeaderTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "rightHeaderTemplate", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], leftFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "leftFooter", required: false }] }], leftFooterTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "leftFooterTemplate", required: false }] }], rightFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "rightFooter", required: false }] }], rightFooterTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "rightFooterTemplate", required: false }] }], itemFieldName: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemFieldName", required: false }] }], itemColumnFields: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemColumnFields", required: false }] }] } });
|
|
383
383
|
|
|
384
384
|
/**
|
|
385
385
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smallpearl-ngx-helper-stationary-with-line-items.mjs","sources":["../../../../projects/smallpearl/ngx-helper/stationary-with-line-items/src/stationary-with-line-items.component.ts","../../../../projects/smallpearl/ngx-helper/stationary-with-line-items/smallpearl-ngx-helper-stationary-with-line-items.ts"],"sourcesContent":["import { AsyncPipe, CommonModule, UpperCasePipe } from '@angular/common';\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, computed, inject, input, OnInit, TemplateRef } from '@angular/core';\nimport { SP_ENTITY_FIELD_CONFIG, SPEntityField, SPEntityFieldSpec } from '@smallpearl/ngx-helper/entity-field';\nimport { Observable, of } from 'rxjs';\n\n\n// @Component({\n// standalone: true,\n// imports: [],\n// selector: 'sp-string-or-object-renderer',\n// template: `\n// @if (isString()) {\n// {{ value() }}\n// } @else {\n// <table>\n// @for (row of objectAsArray(); track $index) {\n// <tr>\n// @for (col of row; track $index) {\n// <td [style]=\"'text-align: ' + valueAlignment()\">{{ col }}</td>\n// }\n// </tr>\n// }\n// </table>\n// }\n// `,\n// changeDetection: ChangeDetectionStrategy.OnPush\n// })\n// export class StringOrObjectRendererComponent implements OnInit {\n// value = input.required<any>();\n// valueAlignment = input<string>()\n// isString = computed(() => typeof this.value() === 'string');\n// objectAsArray = computed(() => {\n// const arrayValues = [];\n// const value = this.value();\n// if (typeof value !== 'string') {\n// for (const key in this.value()) {\n// const keyValue = this.value()[key];\n// arrayValues.push([key, keyValue]);\n// }\n// }\n// return arrayValues;\n// });\n\n// constructor() { }\n\n// ngOnInit() { }\n// }\n\n@Component({\n imports: [AsyncPipe],\n selector: 'sp-fields-renderer',\n template: `\n @if (isString()) {\n {{ stringValue() }}\n } @else {\n <div class=\"\">\n <table>\n <tbody>\n @for (field of fields(); track $index) {\n <tr>\n <td [class]=\"field.class\">{{ field.label() | async }}:</td>\n <td [class]=\"field.class\">{{ field.value(entity()) }}</td>\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n `,\n styles: `\n .field-values {\n padding: 0.2em 0;\n text-align: end;\n }\n tr td:first-of-type {\n padding-right: 1em;\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FieldsRendererComponent<TEntity extends { [P in IdKey]: PropertyKey }, IdKey extends string = 'id'> implements OnInit {\n entity = input.required<TEntity>();\n fields = input.required<SPEntityField<TEntity, IdKey>[]>();\n\n isString = computed(() => typeof this.fields() === 'string');\n // If the field is a single string, looks up entity's properties\n // for matching field name as the string and if it doesn't exist returns\n // the string itself as the value.\n stringValue = computed(() => {\n const fields = this.fields();\n if (typeof fields === 'string') {\n return (this.entity() as any)[fields] ?? fields;\n }\n return '';\n });\n\n constructor(public cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n}\n\n/**\n * A component that renders a stationary with line items, such as invoice,\n * payment receipt, bill, bill payment record, journal entry, etc. All these\n * documents have a uniform format and this component abstracts out the\n * information displayed in this type of document as properties that the client\n * can provide while it takes care of the rendering.\n *\n * Ideally we would declare this as a wrapper class with the actual rendering\n * to be performed by an inner replaceable component. This way the app will be\n * able to support multiple stationary designs, which eventually can be\n * chosen by the user. Perhaps even providing them a feature to design the\n * stationary.\n *\n * This is the first towards that long path ahead.\n */\n@Component({\n imports: [\n CommonModule,\n UpperCasePipe,\n FieldsRendererComponent\n ],\n selector: 'sp-stationary-with-line-items',\n template: `\n <div class=\"stationary-wrapper mat-body\">\n <div class=\"title\">{{ title() }}</div>\n @if (number()) {\n <div class=\"number\">#{{ number() }}</div>\n }\n <div class=\"header\">\n <div class=\"left-header\">\n @if (leftHeaderTemplate()) {\n <ng-container *ngTemplateOutlet=\"leftHeaderTemplate() ?? null\"></ng-container>\n } @else {\n @if (leftHeader()) {\n @if (isString(leftHeader())) {\n {{ leftHeader() }}\n } @else {\n <sp-fields-renderer\n [entity]=\"entity()\"\n [fields]=\"_leftHeaderFields()\"\n ></sp-fields-renderer>\n }\n }\n }\n </div>\n <div class=\"right-header\">\n @if (rightHeaderTemplate()) {\n <ng-container *ngTemplateOutlet=\"rightHeaderTemplate() ?? null\"></ng-container>\n } @else {\n @if (rightHeader()) {\n @if (isString(rightHeader())) {\n {{ rightHeader() }}\n } @else {\n <sp-fields-renderer\n [entity]=\"entity()\"\n [fields]=\"_rightHeaderFields()\"\n ></sp-fields-renderer>\n }\n }\n }\n </div>\n </div> <!-- end <div class=\"header\"> -->\n\n <!-- items -->\n @if (itemColumnFields()) {\n <div class=\"items\">\n <table>\n <thead>\n @for (field of _itemColumnFields(); track $index) {\n <th [class]=\"field.class\" [style.text-align]=\"field.spec.valueOptions?.alignment\">{{ (fieldLabel(field) | async) | uppercase }}</th>\n }\n </thead>\n <tbody>\n <!-- enumerate each element of the 'items' array and render the\n specified columns for each. -->\n @for (row of _items(); track $index) {\n <tr>\n @for (field of _itemColumnFields(); track $index) {\n <td [class]=\"field.class\" [style.text-align]=\"field.spec.valueOptions?.alignment\" [innerHtml]=\"field.value(row)\"></td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n <!-- end items -->\n\n <!-- footer -->\n <div class=\"footer\">\n <div class=\"left-footer\">\n @if (leftFooterTemplate()) {\n <ng-container *ngTemplateOutlet=\"leftFooterTemplate() ?? null\"></ng-container>\n } @else {\n @if (leftFooter()) {\n @if (isString(leftFooter())) {\n {{ leftFooter() }}\n } @else {\n <sp-fields-renderer\n [entity]=\"entity()\"\n [fields]=\"_leftFooterFields()\"\n ></sp-fields-renderer>\n }\n }\n }\n </div>\n <div class=\"right-footer\">\n @if (rightFooterTemplate()) {\n <ng-container *ngTemplateOutlet=\"rightFooterTemplate() ?? null\"></ng-container>\n } @else {\n @if (rightFooter()) {\n @if (isString(rightFooter())) {\n {{ rightFooter() }}\n } @else {\n <sp-fields-renderer\n [entity]=\"entity()\"\n [fields]=\"_rightFooterFields()\"\n ></sp-fields-renderer>\n }\n }\n }\n </div>\n </div>\n </div>\n `,\n styles: `\n .stationary-wrapper {\n padding: 2em 1em;\n }\n .title {\n font-size: 1.6em;\n font-weight: 600;\n text-align: end;\n margin-bottom: 0.5em;\n }\n .number {\n font-size: 1.1em;\n font-weight: 500;\n text-align: end;\n margin-bottom: 0.5em;\n }\n .header, .footer {\n display: flex;\n flex-direction: row;\n margin-top: 1em;\n }\n .left-header, .left-footer {\n display: flex;\n align-items: bottom;\n text-align: start;\n padding-right: 1em;\n min-width: 50%;\n overflow-wrap: break-word;\n text-wrap: wrap;\n }\n .right-header, .right-footer {\n display: flex;\n justify-content: flex-end;\n min-width: 50%;\n overflow: clip;\n }\n .items {\n margin: 2em 0;\n }\n .items table {\n width: 100%;\n border: 0px solid lightgray;\n }\n .items table thead {\n background-color: black;\n color: white;\n & th {\n padding: 0.4em;\n }\n }\n .items table td {\n padding: 0.8em 0.4em;\n border-bottom: 1px solid lightgray;\n border-right: 0px solid lightgray\n }\n .footer {\n\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class StationaryWithLineItemsComponent<TEntity extends { [P in IdKey]: PropertyKey }, TEntityLineItem extends { [P in IdKey]: PropertyKey }, IdKey extends string = 'id'> implements OnInit {\n entity = input.required<TEntity>();\n title = input.required<string>();\n number = input<string|number>();\n\n leftHeader = input<Array<SPEntityFieldSpec<TEntity, IdKey> | string>|string>();\n _leftHeaderFields = computed(() => this.getSPEntityFields(this.leftHeader()));\n leftHeaderTemplate = input<TemplateRef<any>>();\n\n rightHeader = input<Array<SPEntityFieldSpec<TEntity, IdKey> | string>|string>();\n _rightHeaderFields = computed(() => this.getSPEntityFields(this.rightHeader()));\n rightHeaderTemplate = input<TemplateRef<any>>();\n\n items = input<{[key: string]: string}[]>();\n\n leftFooter = input<Array<SPEntityFieldSpec<TEntity, IdKey> | string>|string>();\n _leftFooterFields = computed(() => this.getSPEntityFields(this.leftFooter()));\n leftFooterTemplate = input<TemplateRef<any>>();\n\n rightFooter = input<Array<SPEntityFieldSpec<TEntity, IdKey> | string>|string>();\n _rightFooterFields = computed(() => this.getSPEntityFields(this.rightFooter()));\n rightFooterTemplate = input<TemplateRef<any>>();\n\n itemFieldName = input<string>('items');\n itemColumnFields = input<Array<SPEntityFieldSpec<TEntity, IdKey> | string>>();\n _itemColumnFields = computed(() => this.getSPEntityFields(this.itemColumnFields()));\n\n _items = computed(() => (this.entity() as any)[this.itemFieldName()]);\n\n ngxEntityFieldConfig = inject(SP_ENTITY_FIELD_CONFIG, { optional: true })!;\n\n constructor() {}\n\n ngOnInit() {}\n\n isString(value: any) {\n return typeof value === 'string';\n }\n\n /**\n * Make the method a generic as we'll be using it for both TEntity and its\n * child TEntityLineItem objects.\n * @param fieldSpecs\n * @returns\n */\n getSPEntityFields<T>(fieldSpecs: Array<SPEntityFieldSpec<TEntity, IdKey> | string>|string|undefined): Array<SPEntityField<TEntity, IdKey>> {\n if (fieldSpecs && typeof fieldSpecs !== 'string') {\n return fieldSpecs.map(spec => new SPEntityField<TEntity, IdKey>(spec, this.ngxEntityFieldConfig));\n }\n return [];\n }\n\n fieldLabel(field: SPEntityField<TEntity, IdKey>): Observable<string> {\n const label = field.label()\n if (label) {\n return label instanceof Observable ? label : of(label as string);\n }\n return of('');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;MAkCa,uBAAuB,CAAA;AAgBf,IAAA,GAAA;AAfnB,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAW;AAClC,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAmC;AAE1D,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,OAAO,IAAI,CAAC,MAAM,EAAE,KAAK,QAAQ,CAAC;;;;AAI5D,IAAA,WAAW,GAAG,QAAQ,CAAC,MAAK;AAC1B,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE;AAC5B,QAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAC9B,OAAQ,IAAI,CAAC,MAAM,EAAU,CAAC,MAAM,CAAC,IAAI,MAAM;;AAEjD,QAAA,OAAO,EAAE;AACX,KAAC,CAAC;AAEF,IAAA,WAAA,CAAmB,GAAsB,EAAA;QAAtB,IAAG,CAAA,GAAA,GAAH,GAAG;;AAEtB,IAAA,QAAQ;0HAlBG,uBAAuB,EAAA,IAAA,EAAA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A,EACS,+BAA+B,EAC/B,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGX,EA4DkB,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,8uBAAA,CAAA,EAAA;;;AC7RnD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"smallpearl-ngx-helper-stationary-with-line-items.mjs","sources":["../../../../projects/smallpearl/ngx-helper/stationary-with-line-items/src/stationary-with-line-items.component.ts","../../../../projects/smallpearl/ngx-helper/stationary-with-line-items/smallpearl-ngx-helper-stationary-with-line-items.ts"],"sourcesContent":["import { AsyncPipe, CommonModule, UpperCasePipe } from '@angular/common';\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, computed, inject, input, OnInit, TemplateRef } from '@angular/core';\nimport { SP_ENTITY_FIELD_CONFIG, SPEntityField, SPEntityFieldSpec } from '@smallpearl/ngx-helper/entity-field';\nimport { Observable, of } from 'rxjs';\n\n\n// @Component({\n// standalone: true,\n// imports: [],\n// selector: 'sp-string-or-object-renderer',\n// template: `\n// @if (isString()) {\n// {{ value() }}\n// } @else {\n// <table>\n// @for (row of objectAsArray(); track $index) {\n// <tr>\n// @for (col of row; track $index) {\n// <td [style]=\"'text-align: ' + valueAlignment()\">{{ col }}</td>\n// }\n// </tr>\n// }\n// </table>\n// }\n// `,\n// changeDetection: ChangeDetectionStrategy.OnPush\n// })\n// export class StringOrObjectRendererComponent implements OnInit {\n// value = input.required<any>();\n// valueAlignment = input<string>()\n// isString = computed(() => typeof this.value() === 'string');\n// objectAsArray = computed(() => {\n// const arrayValues = [];\n// const value = this.value();\n// if (typeof value !== 'string') {\n// for (const key in this.value()) {\n// const keyValue = this.value()[key];\n// arrayValues.push([key, keyValue]);\n// }\n// }\n// return arrayValues;\n// });\n\n// constructor() { }\n\n// ngOnInit() { }\n// }\n\n@Component({\n imports: [AsyncPipe],\n selector: 'sp-fields-renderer',\n template: `\n @if (isString()) {\n {{ stringValue() }}\n } @else {\n <div class=\"\">\n <table>\n <tbody>\n @for (field of fields(); track $index) {\n <tr>\n <td [class]=\"field.class\">{{ field.label() | async }}:</td>\n <td [class]=\"field.class\">{{ field.value(entity()) }}</td>\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n `,\n styles: `\n .field-values {\n padding: 0.2em 0;\n text-align: end;\n }\n tr td:first-of-type {\n padding-right: 1em;\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FieldsRendererComponent<TEntity extends { [P in IdKey]: PropertyKey }, IdKey extends string = 'id'> implements OnInit {\n entity = input.required<TEntity>();\n fields = input.required<SPEntityField<TEntity, IdKey>[]>();\n\n isString = computed(() => typeof this.fields() === 'string');\n // If the field is a single string, looks up entity's properties\n // for matching field name as the string and if it doesn't exist returns\n // the string itself as the value.\n stringValue = computed(() => {\n const fields = this.fields();\n if (typeof fields === 'string') {\n return (this.entity() as any)[fields] ?? fields;\n }\n return '';\n });\n\n constructor(public cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n}\n\n/**\n * A component that renders a stationary with line items, such as invoice,\n * payment receipt, bill, bill payment record, journal entry, etc. All these\n * documents have a uniform format and this component abstracts out the\n * information displayed in this type of document as properties that the client\n * can provide while it takes care of the rendering.\n *\n * Ideally we would declare this as a wrapper class with the actual rendering\n * to be performed by an inner replaceable component. This way the app will be\n * able to support multiple stationary designs, which eventually can be\n * chosen by the user. Perhaps even providing them a feature to design the\n * stationary.\n *\n * This is the first towards that long path ahead.\n */\n@Component({\n imports: [\n CommonModule,\n UpperCasePipe,\n FieldsRendererComponent\n ],\n selector: 'sp-stationary-with-line-items',\n template: `\n <div class=\"stationary-wrapper mat-body\">\n <div class=\"title\">{{ title() }}</div>\n @if (number()) {\n <div class=\"number\">#{{ number() }}</div>\n }\n <div class=\"header\">\n <div class=\"left-header\">\n @if (leftHeaderTemplate()) {\n <ng-container *ngTemplateOutlet=\"leftHeaderTemplate() ?? null\"></ng-container>\n } @else {\n @if (leftHeader()) {\n @if (isString(leftHeader())) {\n {{ leftHeader() }}\n } @else {\n <sp-fields-renderer\n [entity]=\"entity()\"\n [fields]=\"_leftHeaderFields()\"\n ></sp-fields-renderer>\n }\n }\n }\n </div>\n <div class=\"right-header\">\n @if (rightHeaderTemplate()) {\n <ng-container *ngTemplateOutlet=\"rightHeaderTemplate() ?? null\"></ng-container>\n } @else {\n @if (rightHeader()) {\n @if (isString(rightHeader())) {\n {{ rightHeader() }}\n } @else {\n <sp-fields-renderer\n [entity]=\"entity()\"\n [fields]=\"_rightHeaderFields()\"\n ></sp-fields-renderer>\n }\n }\n }\n </div>\n </div> <!-- end <div class=\"header\"> -->\n\n <!-- items -->\n @if (itemColumnFields()) {\n <div class=\"items\">\n <table>\n <thead>\n @for (field of _itemColumnFields(); track $index) {\n <th [class]=\"field.class\" [style.text-align]=\"field.spec.valueOptions?.alignment\">{{ (fieldLabel(field) | async) | uppercase }}</th>\n }\n </thead>\n <tbody>\n <!-- enumerate each element of the 'items' array and render the\n specified columns for each. -->\n @for (row of _items(); track $index) {\n <tr>\n @for (field of _itemColumnFields(); track $index) {\n <td [class]=\"field.class\" [style.text-align]=\"field.spec.valueOptions?.alignment\" [innerHtml]=\"field.value(row)\"></td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n <!-- end items -->\n\n <!-- footer -->\n <div class=\"footer\">\n <div class=\"left-footer\">\n @if (leftFooterTemplate()) {\n <ng-container *ngTemplateOutlet=\"leftFooterTemplate() ?? null\"></ng-container>\n } @else {\n @if (leftFooter()) {\n @if (isString(leftFooter())) {\n {{ leftFooter() }}\n } @else {\n <sp-fields-renderer\n [entity]=\"entity()\"\n [fields]=\"_leftFooterFields()\"\n ></sp-fields-renderer>\n }\n }\n }\n </div>\n <div class=\"right-footer\">\n @if (rightFooterTemplate()) {\n <ng-container *ngTemplateOutlet=\"rightFooterTemplate() ?? null\"></ng-container>\n } @else {\n @if (rightFooter()) {\n @if (isString(rightFooter())) {\n {{ rightFooter() }}\n } @else {\n <sp-fields-renderer\n [entity]=\"entity()\"\n [fields]=\"_rightFooterFields()\"\n ></sp-fields-renderer>\n }\n }\n }\n </div>\n </div>\n </div>\n `,\n styles: `\n .stationary-wrapper {\n padding: 2em 1em;\n }\n .title {\n font-size: 1.6em;\n font-weight: 600;\n text-align: end;\n margin-bottom: 0.5em;\n }\n .number {\n font-size: 1.1em;\n font-weight: 500;\n text-align: end;\n margin-bottom: 0.5em;\n }\n .header, .footer {\n display: flex;\n flex-direction: row;\n margin-top: 1em;\n }\n .left-header, .left-footer {\n display: flex;\n align-items: bottom;\n text-align: start;\n padding-right: 1em;\n min-width: 50%;\n overflow-wrap: break-word;\n text-wrap: wrap;\n }\n .right-header, .right-footer {\n display: flex;\n justify-content: flex-end;\n min-width: 50%;\n overflow: clip;\n }\n .items {\n margin: 2em 0;\n }\n .items table {\n width: 100%;\n border: 0px solid lightgray;\n }\n .items table thead {\n background-color: black;\n color: white;\n & th {\n padding: 0.4em;\n }\n }\n .items table td {\n padding: 0.8em 0.4em;\n border-bottom: 1px solid lightgray;\n border-right: 0px solid lightgray\n }\n .footer {\n\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class StationaryWithLineItemsComponent<TEntity extends { [P in IdKey]: PropertyKey }, TEntityLineItem extends { [P in IdKey]: PropertyKey }, IdKey extends string = 'id'> implements OnInit {\n entity = input.required<TEntity>();\n title = input.required<string>();\n number = input<string|number>();\n\n leftHeader = input<Array<SPEntityFieldSpec<TEntity, IdKey> | string>|string>();\n _leftHeaderFields = computed(() => this.getSPEntityFields(this.leftHeader()));\n leftHeaderTemplate = input<TemplateRef<any>>();\n\n rightHeader = input<Array<SPEntityFieldSpec<TEntity, IdKey> | string>|string>();\n _rightHeaderFields = computed(() => this.getSPEntityFields(this.rightHeader()));\n rightHeaderTemplate = input<TemplateRef<any>>();\n\n items = input<{[key: string]: string}[]>();\n\n leftFooter = input<Array<SPEntityFieldSpec<TEntity, IdKey> | string>|string>();\n _leftFooterFields = computed(() => this.getSPEntityFields(this.leftFooter()));\n leftFooterTemplate = input<TemplateRef<any>>();\n\n rightFooter = input<Array<SPEntityFieldSpec<TEntity, IdKey> | string>|string>();\n _rightFooterFields = computed(() => this.getSPEntityFields(this.rightFooter()));\n rightFooterTemplate = input<TemplateRef<any>>();\n\n itemFieldName = input<string>('items');\n itemColumnFields = input<Array<SPEntityFieldSpec<TEntity, IdKey> | string>>();\n _itemColumnFields = computed(() => this.getSPEntityFields(this.itemColumnFields()));\n\n _items = computed(() => (this.entity() as any)[this.itemFieldName()]);\n\n ngxEntityFieldConfig = inject(SP_ENTITY_FIELD_CONFIG, { optional: true })!;\n\n constructor() {}\n\n ngOnInit() {}\n\n isString(value: any) {\n return typeof value === 'string';\n }\n\n /**\n * Make the method a generic as we'll be using it for both TEntity and its\n * child TEntityLineItem objects.\n * @param fieldSpecs\n * @returns\n */\n getSPEntityFields<T>(fieldSpecs: Array<SPEntityFieldSpec<TEntity, IdKey> | string>|string|undefined): Array<SPEntityField<TEntity, IdKey>> {\n if (fieldSpecs && typeof fieldSpecs !== 'string') {\n return fieldSpecs.map(spec => new SPEntityField<TEntity, IdKey>(spec, this.ngxEntityFieldConfig));\n }\n return [];\n }\n\n fieldLabel(field: SPEntityField<TEntity, IdKey>): Observable<string> {\n const label = field.label()\n if (label) {\n return label instanceof Observable ? label : of(label as string);\n }\n return of('');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;MAkCa,uBAAuB,CAAA;AAg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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGX,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,8uBAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EA3GK,YAAY,sMAtCP,uBAAuB,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,QAAA,EAAA,QAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,OAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,EAAA,CAAA,aAAA,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FA+MvB,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBA3K5C,SAAS;AACG,YAAA,IAAA,EAAA,CAAA,EAAA,OAAA,EAAA;wBACL,YAAY;wBACZ,aAAa;wBACb;AACH,qBAAA,EAAA,QAAA,EACS,+BAA+B,EAAA,QAAA,EAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGX,EAAA,eAAA,EA4DkB,uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,8uBAAA,CAAA,EAAA;;;AC7RnD;;AAEG;;;;"}
|
package/forms/index.d.ts
CHANGED
|
@@ -1 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
2
|
+
import { ChangeDetectorRef } from '@angular/core';
|
|
3
|
+
import { UntypedFormGroup } from '@angular/forms';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Handle's form validation errors sent from the server by setting the returned
|
|
8
|
+
* error code in the respective control. Errors not associated with any control
|
|
9
|
+
* in the form are attached to the form itself.
|
|
10
|
+
*
|
|
11
|
+
* These errors can then be rendered using error-tailor. All that needs to be
|
|
12
|
+
* done is to import errorTailorImports in the respective page's module and set
|
|
13
|
+
* the 'errorTailor' directive on the <form..> element.
|
|
14
|
+
*
|
|
15
|
+
* @param form FormGroup instance
|
|
16
|
+
* @param error error object
|
|
17
|
+
*/
|
|
18
|
+
declare function handleValidationErrors(form: UntypedFormGroup, error: HttpErrorResponse, cdr?: ChangeDetectorRef): Observable<any>;
|
|
19
|
+
/**
|
|
20
|
+
* Returns an rxjs operator that would track an http request's error
|
|
21
|
+
* state and if the return code is 400, would enumerate the error codes
|
|
22
|
+
* set in the response body and set the error state of corresponding
|
|
23
|
+
* form controls.
|
|
24
|
+
*
|
|
25
|
+
* Use it like below:
|
|
26
|
+
*
|
|
27
|
+
* this.http.get<User>('https://google.com/..').pipe(
|
|
28
|
+
* setServerErrorsAsFormErrors(form),
|
|
29
|
+
* tap(user => {
|
|
30
|
+
* if (user) { // if user = null, it means there was a server validation
|
|
31
|
+
* // error.
|
|
32
|
+
* this.user = user;
|
|
33
|
+
* }
|
|
34
|
+
* })
|
|
35
|
+
* ).subscribe();
|
|
36
|
+
*
|
|
37
|
+
* Note that setServerErrorsAsFormErrors() is the last operator in
|
|
38
|
+
* the operators list. This is important because if a server validation
|
|
39
|
+
* error is encountered, setServerErrorsAsFormErrors(), would place
|
|
40
|
+
* the error on the respective form control and in the end would
|
|
41
|
+
* return Observable<null>. Any subsequent opeators that are added
|
|
42
|
+
* to the list after this should check for this null value in its
|
|
43
|
+
* handler.
|
|
44
|
+
*
|
|
45
|
+
* @param form The FormGroup instance where the controls corresponding
|
|
46
|
+
* to the errors are looked up and its control.error is set to the
|
|
47
|
+
* returned error code.
|
|
48
|
+
* @param cdr ChangeDetectorRef instance. If provided, it would be
|
|
49
|
+
* used to detect changes after the error codes are set on the form
|
|
50
|
+
* controls.
|
|
51
|
+
* @returns An rxjs op that can be added to the pipe() arg list.
|
|
52
|
+
*/
|
|
53
|
+
declare function setServerErrorsAsFormErrors(form: UntypedFormGroup, cdr?: ChangeDetectorRef): <T>(source: Observable<T>) => Observable<T>;
|
|
54
|
+
|
|
55
|
+
export { handleValidationErrors, setServerErrorsAsFormErrors };
|
|
@@ -1 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnInit, ElementRef } from '@angular/core';
|
|
3
|
+
import { MatMenuTrigger } from '@angular/material/menu';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A directive to make a button triggered mat-menu open during mouse hover.
|
|
7
|
+
* Use it like this:
|
|
8
|
+
|
|
9
|
+
<button #menuTrigger="matMenuTrigger"
|
|
10
|
+
mat-icon-button
|
|
11
|
+
[matMenuTriggerFor]="children"
|
|
12
|
+
hoverDropDown
|
|
13
|
+
[menu]="children"
|
|
14
|
+
[hoverTrigger]="menuTrigger">
|
|
15
|
+
<mat-icon>menu</mat-icon>
|
|
16
|
+
</button>
|
|
17
|
+
<mat-menu #children="matMenu" hasBackdrop="false">
|
|
18
|
+
<button mat-menu-item (click)="onEdit()">Edit</button>
|
|
19
|
+
<button mat-menu-item (click)="onDelete()">Delete</button>
|
|
20
|
+
</mat-menu>
|
|
21
|
+
|
|
22
|
+
Note how hoverDropDown and [hoverTrigger] are used to wire up the button
|
|
23
|
+
and the associated mat-menu to the directive. Once setup like this, the
|
|
24
|
+
mat-menu will be opened whenever the mouse cursor hovers over the menu
|
|
25
|
+
trigger button.
|
|
26
|
+
|
|
27
|
+
Copied from:
|
|
28
|
+
https://stackoverflow.com/questions/54301126/how-to-show-the-angular-material-drop-down-on-mouse-over
|
|
29
|
+
*/
|
|
30
|
+
declare class HoverDropDownDirective implements OnInit {
|
|
31
|
+
private el;
|
|
32
|
+
static _menuClicked: boolean;
|
|
33
|
+
isInHoverBlock: boolean;
|
|
34
|
+
constructor(el: ElementRef);
|
|
35
|
+
hoverTrigger: _angular_core.InputSignal<MatMenuTrigger | null | undefined>;
|
|
36
|
+
menu: _angular_core.InputSignal<any>;
|
|
37
|
+
ngOnInit(): void;
|
|
38
|
+
private setHoverState;
|
|
39
|
+
private checkHover;
|
|
40
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HoverDropDownDirective, never>;
|
|
41
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HoverDropDownDirective, "[hoverDropDown]", never, { "hoverTrigger": { "alias": "hoverTrigger"; "required": false; "isSignal": true; }; "menu": { "alias": "menu"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { HoverDropDownDirective };
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export * from './public-api';
|
|
1
|
+
/** Version of the ngx-helper library */
|
|
2
|
+
declare const VERSION = "0.1.0";
|
|
3
|
+
|
|
4
|
+
export { VERSION };
|
package/locale/index.d.ts
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { PipeTransform } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
type SPIntlDateFormat = 'short' | 'medium' | 'long' | 'full' | 'shortDate' | 'mediumDate' | 'longDate' | 'fullDate' | 'shortTime' | 'mediumTime' | 'longTime' | 'fullTime';
|
|
5
|
+
interface SPNgxI18nConfig {
|
|
6
|
+
locale: string;
|
|
7
|
+
currency: string;
|
|
8
|
+
timezone: string;
|
|
9
|
+
datetimeFormat: SPIntlDateFormat;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The object that will hold the mini library config.
|
|
13
|
+
*/
|
|
14
|
+
declare let _config: SPNgxI18nConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Call this function update the _config dynamically as the need arises.
|
|
17
|
+
* @param config
|
|
18
|
+
*/
|
|
19
|
+
declare function setSPLocaleConfig(config: Partial<SPNgxI18nConfig>): void;
|
|
20
|
+
/**
|
|
21
|
+
* @returns Current config object.
|
|
22
|
+
*/
|
|
23
|
+
declare function getSPLocaleConfig(): SPNgxI18nConfig;
|
|
24
|
+
|
|
25
|
+
declare function spFormatDate(value: Date | number | string, format?: SPIntlDateFormat, timeZone?: string): string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* An alternative to the Angular built-in `DatePipe` based on the native `Intl.DateTimeFormat` API.
|
|
29
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
|
|
30
|
+
* https://angular.io/api/common/DatePipe
|
|
31
|
+
*/
|
|
32
|
+
declare class SPDatePipe implements PipeTransform {
|
|
33
|
+
#private;
|
|
34
|
+
transform(value: Date | number | string, format?: SPIntlDateFormat, timeZone?: string): string | null;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SPDatePipe, never>;
|
|
36
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<SPDatePipe, "spDate", true>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* This is a replacement for Angular's native currency pipe. This uses
|
|
41
|
+
* web standardized Intl.NumberFormat() API to format currency. The advantage
|
|
42
|
+
* of this over Angular's version is that this pipe allows the locale and
|
|
43
|
+
* currency parameters to be dynamically changed during runtime.
|
|
44
|
+
*/
|
|
45
|
+
declare class SPCurrencyPipe implements PipeTransform {
|
|
46
|
+
constructor();
|
|
47
|
+
transform(value: number | bigint | string, currency?: string): string | null;
|
|
48
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SPCurrencyPipe, never>;
|
|
49
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<SPCurrencyPipe, "spCurrency", true>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare function spFormatCurrency(value: number | bigint | string, currency?: string): string | null;
|
|
53
|
+
|
|
54
|
+
export { SPCurrencyPipe, SPDatePipe, _config, getSPLocaleConfig, setSPLocaleConfig, spFormatCurrency, spFormatDate };
|
|
55
|
+
export type { SPIntlDateFormat, SPNgxI18nConfig };
|
|
@@ -1,4 +1,165 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { OnInit, OnDestroy, ElementRef, ViewContainerRef, Renderer2 } from '@angular/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns an rxjs operator that would track an http request status
|
|
7
|
+
* and would use the request status to hide the global busy wheel. The wheel
|
|
8
|
+
* would be hidden when the request completes or errors.
|
|
9
|
+
*
|
|
10
|
+
* Use it like below:
|
|
11
|
+
*
|
|
12
|
+
* this.http.get<User>('https://google.com/..').pipe(
|
|
13
|
+
* trackBusyWheelStatus(),
|
|
14
|
+
* tap(user => this.user = user)
|
|
15
|
+
* ).subscribe();
|
|
16
|
+
*
|
|
17
|
+
* Note that the function internally uses a timer to delay showing the busy
|
|
18
|
+
* wheel. This helps avoid needless screen flicker that can occur when quickly
|
|
19
|
+
* showing & hiding the wheel when the network connection and server response
|
|
20
|
+
* are so good that it can exceed natural user reaction time. We set this
|
|
21
|
+
* delay to 150 milliseconds for now.
|
|
22
|
+
*
|
|
23
|
+
* @param id A string value that uniquely identities the the busy wheel host
|
|
24
|
+
* container within the page. This allows multiple busy wheels to be hosted
|
|
25
|
+
* within a page, each for a distinct network (or time-consuming) operation.
|
|
26
|
+
* This is optional and if not specified, will create a busy wheel that
|
|
27
|
+
* covers the entire app viewport.
|
|
28
|
+
* @param show A boolean value that says whether to show the wheel as
|
|
29
|
+
* part of the operator setup. If set to false, the caller is expected
|
|
30
|
+
* to have displayed the busy wheel explicitly.
|
|
31
|
+
* @param showImmediate A boolean value that decides whether to show the
|
|
32
|
+
* busy wheel immediately. If set to false (default), the busy wheel will
|
|
33
|
+
* only be shown when the HTTP request has not completed within 200ms.
|
|
34
|
+
* @param hideOnNthEmit Number of emits upon which the busy wheel is to
|
|
35
|
+
* be hidden. A value of 0 for this means the wheel is hidden only when
|
|
36
|
+
* the observable completes (errorneously or otherwise).
|
|
37
|
+
* @returns An rxjs op that can be added to the pipe() arg list.
|
|
38
|
+
*/
|
|
39
|
+
declare function trackBusyWheelStatus(id?: string, show?: boolean, showImmediate?: boolean, hideOnNthEmit?: number): <T>(source: Observable<T>) => Observable<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Show a busy wheel until the observable is complete. Busy wheel is shown is either viewport global
|
|
42
|
+
* or localized to the element with the the given id.
|
|
43
|
+
*
|
|
44
|
+
* An example use case for this operator are HTTP requests which will complete no matter
|
|
45
|
+
* what. Either successfully or with an error. Either case will mark the observer as completed.
|
|
46
|
+
*
|
|
47
|
+
* See trackBusyWheelStatus() for explanations on arguments
|
|
48
|
+
*
|
|
49
|
+
* @param id
|
|
50
|
+
* @param showImmediate
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
declare function showBusyWheelUntilComplete(id?: string, showImmediate?: boolean): <T>(source: Observable<T>) => Observable<T>;
|
|
54
|
+
/**
|
|
55
|
+
* Show a busy wheel until the observable emits n number of values. Busy wheel is shown is
|
|
56
|
+
* either viewport global or localized to the element with the the given id.
|
|
57
|
+
*
|
|
58
|
+
* An example use case for this operator are observables that emit but which do not necessarily
|
|
59
|
+
* complete.
|
|
60
|
+
*
|
|
61
|
+
* See trackBusyWheelStatus() for explanations on arguments
|
|
62
|
+
*
|
|
63
|
+
* @param numEmits
|
|
64
|
+
* @param id
|
|
65
|
+
* @param showImmediate
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
declare function showBusyWheelUntilEmits(numEmits: number, id?: string, showImmediate?: boolean): <T>(source: Observable<T>) => Observable<T>;
|
|
69
|
+
|
|
70
|
+
declare class SPMatBusyWheelComponent implements OnInit, OnDestroy {
|
|
71
|
+
elRef: ElementRef;
|
|
72
|
+
wheelId: i0.InputSignal<string>;
|
|
73
|
+
viewport: i0.InputSignal<boolean>;
|
|
74
|
+
constructor(elRef: ElementRef);
|
|
75
|
+
ngOnInit(): void;
|
|
76
|
+
ngOnDestroy(): void;
|
|
77
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SPMatBusyWheelComponent, never>;
|
|
78
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SPMatBusyWheelComponent, "sp-mat-busy-wheel", never, { "wheelId": { "alias": "wheelId"; "required": false; "isSignal": true; }; "viewport": { "alias": "viewport"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare abstract class SPMatHostBusyWheelDirectiveBase {
|
|
82
|
+
abstract getBusyWheelId(): string | undefined;
|
|
83
|
+
abstract getViewContainerRef(): ViewContainerRef;
|
|
84
|
+
abstract getRenderer2(): Renderer2;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare class BusyWheelService {
|
|
88
|
+
private defaultBusyWheelDir;
|
|
89
|
+
private namedBusyWheelDirs;
|
|
90
|
+
private wheelComponents;
|
|
91
|
+
static s_instance: BusyWheelService;
|
|
92
|
+
constructor();
|
|
93
|
+
static getInstance(): BusyWheelService;
|
|
94
|
+
show(id?: string): void;
|
|
95
|
+
hide(id?: string): void;
|
|
96
|
+
registerBusyWheelHost(busyWheelDir: SPMatHostBusyWheelDirectiveBase): void;
|
|
97
|
+
deregisterBusyWheelHost(busyWheelDir: SPMatHostBusyWheelDirectiveBase): void;
|
|
98
|
+
/**
|
|
99
|
+
* Creates a div fragment that hosts the busy wheel. The fragment has the following
|
|
100
|
+
* structure:
|
|
101
|
+
*
|
|
102
|
+
* <div id="id_busy-wheel_{id}">
|
|
103
|
+
* <div class="{containerClass}">
|
|
104
|
+
* <!-- <div class="busy-wheel"></div> -->
|
|
105
|
+
* <mat-spinner></mat-spinner>
|
|
106
|
+
* </div>
|
|
107
|
+
* </div>
|
|
108
|
+
* @param containerClass
|
|
109
|
+
* @param id
|
|
110
|
+
* @returns
|
|
111
|
+
*/
|
|
112
|
+
private createViewportBusyWheel;
|
|
113
|
+
/**
|
|
114
|
+
* Creates a backdrop overlay, of the same size as the container that it
|
|
115
|
+
* covers, on which the busy wheel will be positioned.
|
|
116
|
+
* @returns
|
|
117
|
+
*/
|
|
118
|
+
private createBackdrop;
|
|
119
|
+
private removeViewportBusyWheel;
|
|
120
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BusyWheelService, never>;
|
|
121
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BusyWheelService>;
|
|
122
|
+
}
|
|
123
|
+
declare function registerBusyWheelHost(busyWheelDir: SPMatHostBusyWheelDirectiveBase): void;
|
|
124
|
+
declare function deregisterBusyWheelHost(busyWheelDir: SPMatHostBusyWheelDirectiveBase): void;
|
|
125
|
+
declare function showBusyWheel(id?: string): void;
|
|
126
|
+
declare function hideBusyWheel(id?: string): void;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Use this directive with a unique value assigned to it to display a busy
|
|
130
|
+
* wheel over it. This can be used as:-
|
|
131
|
+
*
|
|
132
|
+
* import {showBusyWheelUntilComplete} from '@smallpearl/ngx-helper/mat-busy-wheel';
|
|
133
|
+
*
|
|
134
|
+
* <div spHostBusyWheel='myDivBusyWheel'>
|
|
135
|
+
* ..content
|
|
136
|
+
* </div>
|
|
137
|
+
*
|
|
138
|
+
* Then in your code:
|
|
139
|
+
*
|
|
140
|
+
* obs.pipe(
|
|
141
|
+
* showBusyWheelUntilComplete('myDivBusyWheel'),
|
|
142
|
+
* tap((resp) => {
|
|
143
|
+
* ...
|
|
144
|
+
* })
|
|
145
|
+
* ).subscribe();
|
|
146
|
+
*
|
|
147
|
+
* This will cover the 'div' above when the obs is waiting to be completed.
|
|
148
|
+
* (or error). Note that you can also use the trackBusyWheelStatus() function
|
|
149
|
+
* if you want more control over the busy wheel.
|
|
150
|
+
*/
|
|
151
|
+
declare class SPMatHostBusyWheelDirective extends SPMatHostBusyWheelDirectiveBase implements OnInit, OnDestroy {
|
|
152
|
+
viewContainerRef: ViewContainerRef;
|
|
153
|
+
renderer2: Renderer2;
|
|
154
|
+
spHostBusyWheel: i0.InputSignal<string | undefined>;
|
|
155
|
+
constructor(viewContainerRef: ViewContainerRef, renderer2: Renderer2);
|
|
156
|
+
ngOnInit(): void;
|
|
157
|
+
ngOnDestroy(): void;
|
|
158
|
+
getBusyWheelId(): string | undefined;
|
|
159
|
+
getViewContainerRef(): ViewContainerRef;
|
|
160
|
+
getRenderer2(): Renderer2;
|
|
161
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SPMatHostBusyWheelDirective, never>;
|
|
162
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SPMatHostBusyWheelDirective, "[spHostBusyWheel]", never, { "spHostBusyWheel": { "alias": "spHostBusyWheel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { BusyWheelService, SPMatBusyWheelComponent, SPMatHostBusyWheelDirective, deregisterBusyWheelHost, hideBusyWheel, registerBusyWheelHost, showBusyWheel, showBusyWheelUntilComplete, showBusyWheelUntilEmits, trackBusyWheelStatus };
|