@elderbyte/ngx-starter 14.4.0-beta.19 → 14.4.0-beta.21
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/common/data/entity-set-patch.mjs +76 -3
- package/esm2020/lib/common/json-map.mjs +3 -3
- package/esm2020/lib/components/forms/directives/elder-form-field-label.directive.mjs +31 -18
- package/fesm2015/elderbyte-ngx-starter.mjs +122 -36
- package/fesm2015/elderbyte-ngx-starter.mjs.map +1 -1
- package/fesm2020/elderbyte-ngx-starter.mjs +122 -36
- package/fesm2020/elderbyte-ngx-starter.mjs.map +1 -1
- package/lib/common/data/entity-set-patch.d.ts +32 -1
- package/lib/common/json-map.d.ts +1 -1
- package/lib/components/forms/directives/elder-form-field-label.directive.d.ts +19 -6
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@ import { FlexLayoutModule, FlexModule } from '@angular/flex-layout';
|
|
|
37
37
|
import * as i5 from '@angular/material/button';
|
|
38
38
|
import { MatButtonModule } from '@angular/material/button';
|
|
39
39
|
import * as i5$1 from '@angular/material/input';
|
|
40
|
-
import { MatInputModule
|
|
40
|
+
import { MatInputModule } from '@angular/material/input';
|
|
41
41
|
import * as i1$5 from '@angular/material/autocomplete';
|
|
42
42
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
43
43
|
import * as i6 from '@angular/material/core';
|
|
@@ -2549,6 +2549,24 @@ class Pageable {
|
|
|
2549
2549
|
}
|
|
2550
2550
|
}
|
|
2551
2551
|
|
|
2552
|
+
class JsonMapUtil {
|
|
2553
|
+
static toJsonMap(esMap) {
|
|
2554
|
+
const entries = Array.from(esMap.entries());
|
|
2555
|
+
const jsonMap = {};
|
|
2556
|
+
entries.reduce((o, [key, value]) => {
|
|
2557
|
+
o[key] = value;
|
|
2558
|
+
return o;
|
|
2559
|
+
}, jsonMap);
|
|
2560
|
+
return jsonMap;
|
|
2561
|
+
}
|
|
2562
|
+
static toMap(jsonMap, toIdFn = key => key) {
|
|
2563
|
+
const map = new Map();
|
|
2564
|
+
Object.keys(jsonMap)
|
|
2565
|
+
.forEach(k => map.set(toIdFn(k), jsonMap[k]));
|
|
2566
|
+
return map;
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2552
2570
|
class EntitySetPatch {
|
|
2553
2571
|
/***************************************************************************
|
|
2554
2572
|
* *
|
|
@@ -2583,7 +2601,75 @@ class EntitySetPatch {
|
|
|
2583
2601
|
}
|
|
2584
2602
|
/***************************************************************************
|
|
2585
2603
|
* *
|
|
2586
|
-
*
|
|
2604
|
+
* Query *
|
|
2605
|
+
* *
|
|
2606
|
+
**************************************************************************/
|
|
2607
|
+
getUpsertsById() {
|
|
2608
|
+
return JsonMapUtil.toMap(this.upsertsById);
|
|
2609
|
+
}
|
|
2610
|
+
getUpdatesById() {
|
|
2611
|
+
return JsonMapUtil.toMap(this.updatesById);
|
|
2612
|
+
}
|
|
2613
|
+
getUpsertOnes() {
|
|
2614
|
+
return [...this.upsertOnes];
|
|
2615
|
+
}
|
|
2616
|
+
getUpdateOnes() {
|
|
2617
|
+
return [...this.updateOnes];
|
|
2618
|
+
}
|
|
2619
|
+
/**
|
|
2620
|
+
* Gets all ids which should be deleted.
|
|
2621
|
+
* Also consider isDeleteOther, which means
|
|
2622
|
+
* everything gets deleted.
|
|
2623
|
+
*/
|
|
2624
|
+
collectDeletions() {
|
|
2625
|
+
return [
|
|
2626
|
+
...Array.from(this.getUpsertsById().entries())
|
|
2627
|
+
.filter(([id, update]) => !update)
|
|
2628
|
+
.map(([id, update]) => id),
|
|
2629
|
+
...Array.from(this.getUpdatesById().entries())
|
|
2630
|
+
.filter(([id, update]) => !update)
|
|
2631
|
+
.map(([id, update]) => id),
|
|
2632
|
+
];
|
|
2633
|
+
}
|
|
2634
|
+
/**
|
|
2635
|
+
* Delete all entities which are not
|
|
2636
|
+
* explicitly defined in this update.
|
|
2637
|
+
* "Replace with" semantics.
|
|
2638
|
+
*/
|
|
2639
|
+
get isDeleteOther() {
|
|
2640
|
+
return this.deleteOther;
|
|
2641
|
+
}
|
|
2642
|
+
/**
|
|
2643
|
+
* Collects all upserts. (Updates are ignored)
|
|
2644
|
+
*/
|
|
2645
|
+
collectUpserts() {
|
|
2646
|
+
return [
|
|
2647
|
+
...Array.from(this.getUpsertsById().entries())
|
|
2648
|
+
.filter(([id, update]) => !!update)
|
|
2649
|
+
.map(([id, update]) => update),
|
|
2650
|
+
...this.upsertOnes
|
|
2651
|
+
];
|
|
2652
|
+
}
|
|
2653
|
+
/**
|
|
2654
|
+
* Collects all updates. (Upserts are ignored)
|
|
2655
|
+
*/
|
|
2656
|
+
collectUpdates() {
|
|
2657
|
+
return [
|
|
2658
|
+
...Array.from(this.getUpdatesById().entries())
|
|
2659
|
+
.filter(([id, update]) => !!update)
|
|
2660
|
+
.map(([id, update]) => update),
|
|
2661
|
+
...this.updateOnes
|
|
2662
|
+
];
|
|
2663
|
+
}
|
|
2664
|
+
collectUpdatesAndUpserts() {
|
|
2665
|
+
return [
|
|
2666
|
+
...this.collectUpserts(),
|
|
2667
|
+
...this.collectUpdates()
|
|
2668
|
+
];
|
|
2669
|
+
}
|
|
2670
|
+
/***************************************************************************
|
|
2671
|
+
* *
|
|
2672
|
+
* Builder API *
|
|
2587
2673
|
* *
|
|
2588
2674
|
**************************************************************************/
|
|
2589
2675
|
update(updateOne) {
|
|
@@ -2631,11 +2717,15 @@ class EntitySetPatch {
|
|
|
2631
2717
|
return this;
|
|
2632
2718
|
}
|
|
2633
2719
|
deleteAll() {
|
|
2720
|
+
this.clear();
|
|
2721
|
+
this.deleteAllOther();
|
|
2722
|
+
return this;
|
|
2723
|
+
}
|
|
2724
|
+
clear() {
|
|
2634
2725
|
this.upsertOnes = [];
|
|
2635
2726
|
this.upsertsById = {};
|
|
2636
2727
|
this.updateOnes = [];
|
|
2637
2728
|
this.updatesById = {};
|
|
2638
|
-
this.deleteAllOther();
|
|
2639
2729
|
return this;
|
|
2640
2730
|
}
|
|
2641
2731
|
}
|
|
@@ -7984,24 +8074,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
|
|
|
7984
8074
|
}]
|
|
7985
8075
|
}], ctorParameters: function () { return [{ type: i1$3.Router }, { type: i1$3.ActivatedRoute }]; } });
|
|
7986
8076
|
|
|
7987
|
-
class JsonMapUtil {
|
|
7988
|
-
static toJsonMap(esMap) {
|
|
7989
|
-
const entries = Array.from(esMap.entries());
|
|
7990
|
-
const jsonMap = {};
|
|
7991
|
-
entries.reduce((o, [key, value]) => {
|
|
7992
|
-
o[key] = value;
|
|
7993
|
-
return o;
|
|
7994
|
-
}, jsonMap);
|
|
7995
|
-
return jsonMap;
|
|
7996
|
-
}
|
|
7997
|
-
static toMap(jsonMap) {
|
|
7998
|
-
const map = new Map();
|
|
7999
|
-
Object.keys(jsonMap)
|
|
8000
|
-
.forEach(k => map.set(k, jsonMap[k]));
|
|
8001
|
-
return map;
|
|
8002
|
-
}
|
|
8003
|
-
}
|
|
8004
|
-
|
|
8005
8077
|
class Sets {
|
|
8006
8078
|
/**
|
|
8007
8079
|
* Compares the content of two sets for equality in O(n).
|
|
@@ -13635,9 +13707,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
|
|
|
13635
13707
|
*
|
|
13636
13708
|
* Example Usage:
|
|
13637
13709
|
*
|
|
13638
|
-
*
|
|
13639
|
-
*
|
|
13640
|
-
*
|
|
13710
|
+
* <mat-form-field elderFormFieldLabel>
|
|
13711
|
+
* <input matInput placeholder="Readonly Input" readonly="true" value="Some Value">
|
|
13712
|
+
* </mat-form-field>
|
|
13641
13713
|
*
|
|
13642
13714
|
*/
|
|
13643
13715
|
class ElderFormFieldLabelDirective {
|
|
@@ -13649,6 +13721,20 @@ class ElderFormFieldLabelDirective {
|
|
|
13649
13721
|
constructor(_matFormField) {
|
|
13650
13722
|
this._matFormField = _matFormField;
|
|
13651
13723
|
}
|
|
13724
|
+
/***************************************************************************
|
|
13725
|
+
* *
|
|
13726
|
+
* Host Bindings *
|
|
13727
|
+
* *
|
|
13728
|
+
**************************************************************************/
|
|
13729
|
+
get getFormFieldLabelStyle() {
|
|
13730
|
+
return this.isLabelMode();
|
|
13731
|
+
}
|
|
13732
|
+
/***************************************************************************
|
|
13733
|
+
* *
|
|
13734
|
+
* Properties *
|
|
13735
|
+
* *
|
|
13736
|
+
**************************************************************************/
|
|
13737
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
13652
13738
|
set enabled(enabled) {
|
|
13653
13739
|
this._enabled = coerceBooleanProperty(enabled);
|
|
13654
13740
|
}
|
|
@@ -13660,12 +13746,12 @@ class ElderFormFieldLabelDirective {
|
|
|
13660
13746
|
* Public API *
|
|
13661
13747
|
* *
|
|
13662
13748
|
**************************************************************************/
|
|
13663
|
-
|
|
13749
|
+
isControlReadonly() {
|
|
13664
13750
|
const ctrl = this._matFormField._control;
|
|
13665
|
-
|
|
13666
|
-
|
|
13667
|
-
|
|
13668
|
-
return
|
|
13751
|
+
return ctrl?.readonly;
|
|
13752
|
+
}
|
|
13753
|
+
isLabelMode() {
|
|
13754
|
+
return this.enabled && this.isControlReadonly();
|
|
13669
13755
|
}
|
|
13670
13756
|
/***************************************************************************
|
|
13671
13757
|
* *
|
|
@@ -13673,22 +13759,22 @@ class ElderFormFieldLabelDirective {
|
|
|
13673
13759
|
* *
|
|
13674
13760
|
**************************************************************************/
|
|
13675
13761
|
ngAfterViewInit() {
|
|
13676
|
-
if (this.
|
|
13762
|
+
if (this.isLabelMode()) {
|
|
13677
13763
|
this._matFormField.floatLabel = 'always';
|
|
13678
13764
|
}
|
|
13679
13765
|
}
|
|
13680
13766
|
}
|
|
13681
13767
|
ElderFormFieldLabelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: ElderFormFieldLabelDirective, deps: [{ token: i4$1.MatFormField }], target: i0.ɵɵFactoryTarget.Directive });
|
|
13682
|
-
ElderFormFieldLabelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.6", type: ElderFormFieldLabelDirective, selector: "mat-form-field[elderFormFieldLabel]", inputs: { enabled: ["elderFormFieldLabel", "enabled"] }, host: { properties: { "class.elder-form-field-label": "
|
|
13768
|
+
ElderFormFieldLabelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.6", type: ElderFormFieldLabelDirective, selector: "mat-form-field[elderFormFieldLabel]", inputs: { enabled: ["elderFormFieldLabel", "enabled"] }, host: { properties: { "class.elder-form-field-label": "this.getFormFieldLabelStyle" } }, ngImport: i0 });
|
|
13683
13769
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: ElderFormFieldLabelDirective, decorators: [{
|
|
13684
13770
|
type: Directive,
|
|
13685
13771
|
args: [{
|
|
13686
|
-
selector: 'mat-form-field[elderFormFieldLabel]'
|
|
13687
|
-
host: {
|
|
13688
|
-
'[class.elder-form-field-label]': 'enabled && isReadonlyInput()'
|
|
13689
|
-
}
|
|
13772
|
+
selector: 'mat-form-field[elderFormFieldLabel]'
|
|
13690
13773
|
}]
|
|
13691
|
-
}], ctorParameters: function () { return [{ type: i4$1.MatFormField }]; }, propDecorators: {
|
|
13774
|
+
}], ctorParameters: function () { return [{ type: i4$1.MatFormField }]; }, propDecorators: { getFormFieldLabelStyle: [{
|
|
13775
|
+
type: HostBinding,
|
|
13776
|
+
args: ['class.elder-form-field-label']
|
|
13777
|
+
}], enabled: [{
|
|
13692
13778
|
type: Input,
|
|
13693
13779
|
args: ['elderFormFieldLabel']
|
|
13694
13780
|
}] } });
|