@fluxhub/fluxhub-lib 10.0.8 → 10.0.10
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/fluxhub-fluxhub-lib.umd.js +157 -11
- package/bundles/fluxhub-fluxhub-lib.umd.js.map +1 -1
- package/bundles/fluxhub-fluxhub-lib.umd.min.js +2 -2
- package/bundles/fluxhub-fluxhub-lib.umd.min.js.map +1 -1
- package/esm2015/lib/controls/fhtimepicker.js +110 -13
- package/esm2015/lib/services/utility.service.js +9 -6
- package/esm2015/obj_diff.js +127 -0
- package/fesm2015/fluxhub-fluxhub-lib.js +243 -17
- package/fesm2015/fluxhub-fluxhub-lib.js.map +1 -1
- package/fluxhub-fluxhub-lib.metadata.json +1 -1
- package/lib/controls/fhtimepicker.d.ts +7 -3
- package/obj_diff.d.ts +39 -0
- package/package.json +1 -2
|
@@ -623,6 +623,137 @@
|
|
|
623
623
|
return value;
|
|
624
624
|
}
|
|
625
625
|
|
|
626
|
+
var obj_diff = /** @class */ (function () {
|
|
627
|
+
function obj_diff() {
|
|
628
|
+
this.checkType = {
|
|
629
|
+
NUMBER: function (x) { return typeof x === 'number'; },
|
|
630
|
+
BOOLEAN: function (x) { return typeof x === 'boolean'; },
|
|
631
|
+
STRING: function (x) { return typeof x === 'string'; },
|
|
632
|
+
DATE: function (x) { return x instanceof Date; },
|
|
633
|
+
UNDEFINED: function (x) { return typeof x === 'undefined'; },
|
|
634
|
+
NULL: function (x) { return x === null; },
|
|
635
|
+
ARRAY: function (x) { return x instanceof Array; },
|
|
636
|
+
MAP: function (x) { return x instanceof Map; },
|
|
637
|
+
SET: function (x) { return x instanceof Set; },
|
|
638
|
+
ITERABLE_OBJECT: function (x) {
|
|
639
|
+
var type = Object.prototype.toString.call(x);
|
|
640
|
+
return type === '[object Object]';
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
this.types = {
|
|
644
|
+
NUMBER: 'NUMBER',
|
|
645
|
+
BOOLEAN: 'BOOLEAN',
|
|
646
|
+
STRING: 'STRING',
|
|
647
|
+
NULL: 'NULL',
|
|
648
|
+
UNDEFINED: 'UNDEFINED',
|
|
649
|
+
DATE: 'DATE',
|
|
650
|
+
ARRAY: 'ARRAY',
|
|
651
|
+
MAP: 'MAP',
|
|
652
|
+
SET: 'SET',
|
|
653
|
+
ITERABLE_OBJECT: 'ITERABLE_OBJECT',
|
|
654
|
+
DEFAULT: 'OBJECT',
|
|
655
|
+
};
|
|
656
|
+
this.iterableTypes = 'ITERABLE_OBJECT__MAP__ARRAY__SET';
|
|
657
|
+
this.noop = function () { };
|
|
658
|
+
this.checkEqualityForComplexTypes = {
|
|
659
|
+
'DATE': function (dt1, dt2) { return dt1.getTime() === dt2.getTime(); },
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
obj_diff.prototype.getType = function (x) {
|
|
663
|
+
var keys = Object.keys(this.checkType);
|
|
664
|
+
var type = this.types.DEFAULT;
|
|
665
|
+
for (var i = 0; i < keys.length; i += 1) {
|
|
666
|
+
if (this.checkType[keys[i]](x)) {
|
|
667
|
+
type = keys[i];
|
|
668
|
+
break;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
return type;
|
|
672
|
+
};
|
|
673
|
+
obj_diff.prototype.isTraversalNeeded = function (type1, type2) {
|
|
674
|
+
return type1 === type2 && this.iterableTypes.indexOf(type1) >= 0;
|
|
675
|
+
};
|
|
676
|
+
obj_diff.prototype.areEqual = function (x, y, type1, type2) {
|
|
677
|
+
if (type1 !== type2) {
|
|
678
|
+
return false;
|
|
679
|
+
}
|
|
680
|
+
return this.checkEqualityForComplexTypes[type1] ? this.checkEqualityForComplexTypes[type1](x, y) : x === y;
|
|
681
|
+
};
|
|
682
|
+
obj_diff.prototype.computeOp = function (x, y, type1, type2) {
|
|
683
|
+
// console.log('type1 ',type1,'type2 ',type2);
|
|
684
|
+
var op = null;
|
|
685
|
+
if (type1 === this.types.UNDEFINED && type2 !== this.types.UNDEFINED) {
|
|
686
|
+
op = 'add';
|
|
687
|
+
}
|
|
688
|
+
else if (type1 !== this.types.UNDEFINED && type2 === this.types.UNDEFINED) {
|
|
689
|
+
op = 'delete';
|
|
690
|
+
}
|
|
691
|
+
else if (!(this.areEqual(x, y, type1, type2))) {
|
|
692
|
+
op = 'update';
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
this.noop();
|
|
696
|
+
}
|
|
697
|
+
return op;
|
|
698
|
+
};
|
|
699
|
+
obj_diff.prototype.getKeys = function (x, y, type) {
|
|
700
|
+
var keys;
|
|
701
|
+
if (type === this.types.ITERABLE_OBJECT) {
|
|
702
|
+
keys = new Set(Object.keys(x).concat(Object.keys(y)));
|
|
703
|
+
}
|
|
704
|
+
else if (type === this.types.ARRAY) {
|
|
705
|
+
keys = x.length > y.length ? new Array(x.length) : new Array(y.length);
|
|
706
|
+
keys = keys.fill(0, 0);
|
|
707
|
+
keys = keys.map(function (el, i) { return i; });
|
|
708
|
+
keys = new Set(keys);
|
|
709
|
+
}
|
|
710
|
+
return keys;
|
|
711
|
+
};
|
|
712
|
+
obj_diff.prototype.makeDiff = function (x, y, op, path, keepOldVal) {
|
|
713
|
+
var diffOb = {
|
|
714
|
+
op: op,
|
|
715
|
+
path: path,
|
|
716
|
+
val: '',
|
|
717
|
+
oldVal: ''
|
|
718
|
+
};
|
|
719
|
+
if (op === 'add' || op === 'update') {
|
|
720
|
+
diffOb.val = y;
|
|
721
|
+
}
|
|
722
|
+
if (keepOldVal && op !== 'add') {
|
|
723
|
+
diffOb.oldVal = x;
|
|
724
|
+
}
|
|
725
|
+
return diffOb;
|
|
726
|
+
};
|
|
727
|
+
obj_diff.prototype.get_diff = function (x, y, keepOldVal, path, diff) {
|
|
728
|
+
if (keepOldVal === void 0) { keepOldVal = false; }
|
|
729
|
+
if (path === void 0) { path = []; }
|
|
730
|
+
if (diff === void 0) { diff = []; }
|
|
731
|
+
var type1 = this.getType(x);
|
|
732
|
+
var type2 = this.getType(y);
|
|
733
|
+
var currPath = path || [];
|
|
734
|
+
var currDiff = diff || [];
|
|
735
|
+
if (this.isTraversalNeeded(type1, type2)) {
|
|
736
|
+
var iterator = this.getKeys(x, y, type1).values();
|
|
737
|
+
var key = iterator.next().value;
|
|
738
|
+
while (key != null) {
|
|
739
|
+
this.get_diff(x[key], y[key], keepOldVal, currPath.concat(key), currDiff);
|
|
740
|
+
key = iterator.next().value;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
else {
|
|
744
|
+
var op = this.computeOp(x, y, type1, type2);
|
|
745
|
+
// console.log('op ',op);
|
|
746
|
+
if (op != null) {
|
|
747
|
+
// console.log()
|
|
748
|
+
currDiff.push(this.makeDiff(x, y, op, path, keepOldVal));
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
// console.log('currDiff ',currDiff);
|
|
752
|
+
return currDiff;
|
|
753
|
+
};
|
|
754
|
+
return obj_diff;
|
|
755
|
+
}());
|
|
756
|
+
|
|
626
757
|
//import { getDiff} from 'recursive-diff';
|
|
627
758
|
var UtilityService = /** @class */ (function () {
|
|
628
759
|
function UtilityService(app_s) {
|
|
@@ -976,12 +1107,14 @@
|
|
|
976
1107
|
if (old_doc === void 0) { old_doc = null; }
|
|
977
1108
|
if (new_doc === void 0) { new_doc = null; }
|
|
978
1109
|
var diff1 = [];
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1110
|
+
if (old_doc == null && new_doc == null)
|
|
1111
|
+
return diff1;
|
|
1112
|
+
var ax = new obj_diff();
|
|
1113
|
+
var diff = ax.get_diff(old_doc, new_doc, true);
|
|
1114
|
+
for (var index = 0; index < diff.length; index++) {
|
|
1115
|
+
if (diff[index].path + "" != "uiid" && diff[index].path + "" != "id")
|
|
1116
|
+
diff1.push(diff[index]);
|
|
1117
|
+
}
|
|
985
1118
|
return diff1;
|
|
986
1119
|
};
|
|
987
1120
|
UtilityService.prototype.insert_log = function (dt, app, k, descri, operazione, link, old_doc, new_doc) {
|
|
@@ -3235,9 +3368,6 @@
|
|
|
3235
3368
|
multi: true,
|
|
3236
3369
|
};
|
|
3237
3370
|
var FHTimePickerComponent = /** @class */ (function () {
|
|
3238
|
-
/**
|
|
3239
|
-
*
|
|
3240
|
-
*/
|
|
3241
3371
|
function FHTimePickerComponent(_dataService, dialog, m_appService, toastr, uti_s) {
|
|
3242
3372
|
this._dataService = _dataService;
|
|
3243
3373
|
this.dialog = dialog;
|
|
@@ -3247,6 +3377,11 @@
|
|
|
3247
3377
|
this.maxore = 23;
|
|
3248
3378
|
this.label = "";
|
|
3249
3379
|
this.enabled = true;
|
|
3380
|
+
this.vertical = false;
|
|
3381
|
+
this.label_hh = "";
|
|
3382
|
+
this.label_mm = "";
|
|
3383
|
+
this.arr_hh = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
|
|
3384
|
+
this.arr_mm = ['0', '10', '15', '30', '45'];
|
|
3250
3385
|
this.show_picker = false;
|
|
3251
3386
|
this.selchange = new i0.EventEmitter(); // it's preferable to use standart output: '(change)'
|
|
3252
3387
|
this.ngChange = new i0.EventEmitter();
|
|
@@ -3256,6 +3391,12 @@
|
|
|
3256
3391
|
this.onChange = function (_) { };
|
|
3257
3392
|
this.onTouched = function () { };
|
|
3258
3393
|
}
|
|
3394
|
+
FHTimePickerComponent.prototype.setta_h = function (o) {
|
|
3395
|
+
this.h = parseInt(o);
|
|
3396
|
+
};
|
|
3397
|
+
FHTimePickerComponent.prototype.setta_m = function (o) {
|
|
3398
|
+
this.m = parseInt(o);
|
|
3399
|
+
};
|
|
3259
3400
|
FHTimePickerComponent.prototype.uph = function () {
|
|
3260
3401
|
if (this.h < this.maxore) {
|
|
3261
3402
|
this.h++;
|
|
@@ -3429,8 +3570,8 @@
|
|
|
3429
3570
|
{ type: i0.Component, args: [{
|
|
3430
3571
|
selector: "FHTimePicker",
|
|
3431
3572
|
providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$2],
|
|
3432
|
-
template: "\n <div fxLayout=\"row\" fxLayoutAlign=\"center center\">\n <b>{{ label }}</b\n > \n <div fxLayout=\"column\" fxLayoutAlign=\"center center\">\n <div *ngIf=\"enabled\"
|
|
3433
|
-
styles: ["\n .hhh {\n height: 63px;\n width: 100px;\n background-color: rgba(255, 0, 0, 0.1);\n }\n\n .
|
|
3573
|
+
template: "\n <div fxLayout=\"row\" fxLayoutAlign=\"center center\" [hidden]=\"vertical && enabled\">\n <b>{{ label }}</b\n > \n <div fxLayout=\"column\" fxLayoutAlign=\"center center\">\n <div *ngIf=\"enabled\" >\n <mat-icon (click)=\"uph()\">keyboard_arrow_up</mat-icon>\n </div>\n\n <input\n style=\"width:40px;text-align:center;\"\n (keydown)=\"onKeyDown($event)\"\n (focusout)=\"onFu()\"\n [disabled]=\"!enabled\"\n [(ngModel)]=\"h\"\n />\n <div *ngIf=\"enabled\">\n <mat-icon (click)=\"doh()\"\n >keyboard_arrow_down</mat-icon\n >\n </div>\n </div>\n\n <b style=\"font-size:28px\">:</b> \n\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\">\n <div *ngIf=\"enabled\">\n <mat-icon (click)=\"upm()\"\n >keyboard_arrow_up</mat-icon\n >\n </div>\n\n <input\n style=\"width:40px;text-align:center;\"\n (keydown)=\"onKeyDown1($event)\"\n (focusout)=\"onMi()\"\n [disabled]=\"!enabled\"\n [(ngModel)]=\"m\"\n />\n <div *ngIf=\"enabled\" style=\"pointer_mouse\">\n <mat-icon (click)=\"dom()\"\n style=\"pointer_mouse\" >keyboard_arrow_down</mat-icon\n >\n </div>\n </div>\n </div>\n\n\n <div fxLayout=\"column\" [hidden]=\"!vertical || !enabled\">\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <b style=\"min-width:70px\">{{ label_hh }}</b>\n <div fxLayout=\"column\" fxLayoutAlign=\"start center\" fxLayoutGap=\"0px\">\n\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\"> \n <div fxLayout=\"column\" fxLayoutAlign=\"start center\" fxLayoutGap=\"0px\">\n <div *ngIf=\"enabled\" >\n <mat-icon (click)=\"uph()\">keyboard_arrow_up</mat-icon>\n </div>\n\n <input\n style=\"width:40px;text-align:center;\"\n (keydown)=\"onKeyDown($event)\"\n (focusout)=\"onFu()\"\n [disabled]=\"!enabled\"\n [(ngModel)]=\"h\"\n />\n <div *ngIf=\"enabled\" style=\"pointer_mouse\">\n <mat-icon (click)=\"doh()\"\n style=\"pointer_mouse\">keyboard_arrow_down</mat-icon\n >\n </div>\n </div>\n \n <div *ngFor=\"let u of arr_hh\" [hidden]=\"!enabled\">\n <button mat-raised-button color=\"primary\" (click)=\"setta_h(u)\" class=\"pad_b\">\n {{u}}\n </button> \n </div>\n </div>\n\n </div>\n </div>\n\n\n\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <b style=\"min-width:70px\">{{ label_mm }}</b>\n <div fxLayout=\"column\" fxLayoutAlign=\"start center\" fxLayoutGap=\"0px\">\n\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\"> \n <div fxLayout=\"column\" fxLayoutAlign=\"start center\" fxLayoutGap=\"0px\">\n <div *ngIf=\"enabled\" style=\"pointer_mouse\">\n <mat-icon (click)=\"upm()\" style=\"pointer_mouse\">keyboard_arrow_up</mat-icon>\n </div>\n\n <input\n style=\"width:40px;text-align:center;\"\n (keydown)=\"onKeyDown1($event)\"\n (focusout)=\"onMi()\"\n [disabled]=\"!enabled\"\n [(ngModel)]=\"m\"\n />\n <div *ngIf=\"enabled\" style=\"pointer_mouse\">\n <mat-icon (click)=\"dom()\" style=\"pointer_mouse\"\n >keyboard_arrow_down</mat-icon\n >\n </div>\n </div>\n \n <div *ngFor=\"let u of arr_mm\" [hidden]=\"!enabled\">\n <button mat-raised-button color=\"primary\" (click)=\"setta_m(u)\" class=\"pad_b\">\n {{u}}\n </button> \n </div>\n </div>\n\n </div>\n </div>\n </div>\n\n ",
|
|
3574
|
+
styles: ["\n.pad_b {\n padding-left: 5px !important;\n padding-right: 5px !important;\n padding-top: 0px !important;\n padding-bottom: 0px !important;\n min-width: 30px !important;\n min-height: 8px !important;\n font-size:14px !important;\n}\n\n .hhh {\n height: 63px;\n width: 100px;\n background-color: rgba(255, 0, 0, 0.1);\n }\n\n .pointer_mouse {\n cursor: pointer;\n user-select: none;\n }\n "]
|
|
3434
3575
|
},] }
|
|
3435
3576
|
];
|
|
3436
3577
|
FHTimePickerComponent.ctorParameters = function () { return [
|
|
@@ -3444,6 +3585,11 @@
|
|
|
3444
3585
|
maxore: [{ type: i0.Input }],
|
|
3445
3586
|
label: [{ type: i0.Input }],
|
|
3446
3587
|
enabled: [{ type: i0.Input }],
|
|
3588
|
+
vertical: [{ type: i0.Input }],
|
|
3589
|
+
label_hh: [{ type: i0.Input }],
|
|
3590
|
+
label_mm: [{ type: i0.Input }],
|
|
3591
|
+
arr_hh: [{ type: i0.Input }],
|
|
3592
|
+
arr_mm: [{ type: i0.Input }],
|
|
3447
3593
|
selchange: [{ type: i0.Output }],
|
|
3448
3594
|
ngChange: [{ type: i0.Output, args: ["change",] }]
|
|
3449
3595
|
};
|