@tetacom/ng-components 1.0.35 → 1.0.36
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/component/table/default/default-head-cell/default-head-cell.component.mjs +2 -2
- package/esm2020/util/date-util.mjs +41 -1
- package/fesm2015/tetacom-ng-components.mjs +42 -2
- package/fesm2015/tetacom-ng-components.mjs.map +1 -1
- package/fesm2020/tetacom-ng-components.mjs +42 -2
- package/fesm2020/tetacom-ng-components.mjs.map +1 -1
- package/package.json +1 -1
- package/style/table.scss +0 -1
- package/util/date-util.d.ts +1 -0
|
@@ -695,6 +695,46 @@ class DateUtil {
|
|
|
695
695
|
static isValidDate(date) {
|
|
696
696
|
return date instanceof Date && !isNaN(date.getTime());
|
|
697
697
|
}
|
|
698
|
+
static millisecondToHumanFormat(milliSeconds, maxValue = 5000, showDays = false) {
|
|
699
|
+
const negative = milliSeconds < 0;
|
|
700
|
+
if (negative) {
|
|
701
|
+
milliSeconds = -milliSeconds;
|
|
702
|
+
}
|
|
703
|
+
let d;
|
|
704
|
+
if (showDays) {
|
|
705
|
+
d = Math.trunc(milliSeconds / (60000 * 60 * 24));
|
|
706
|
+
milliSeconds = milliSeconds - 60000 * 60 * 24 * d;
|
|
707
|
+
}
|
|
708
|
+
const h = Math.trunc(milliSeconds / (60000 * 60));
|
|
709
|
+
milliSeconds = milliSeconds - 60000 * 60 * h;
|
|
710
|
+
const m = Math.trunc(milliSeconds / 60000);
|
|
711
|
+
milliSeconds = milliSeconds - 60000 * m;
|
|
712
|
+
const s = Math.trunc(milliSeconds / 1000);
|
|
713
|
+
milliSeconds = milliSeconds - 1000 * s;
|
|
714
|
+
const frac = milliSeconds;
|
|
715
|
+
let result = m ? m + ' м ' : ''; // start with minutes
|
|
716
|
+
if (maxValue < 60000 * 60) {
|
|
717
|
+
if (s) {
|
|
718
|
+
result = result + s + ' с '; // add seconds value
|
|
719
|
+
}
|
|
720
|
+
if (s === 0 && !m) {
|
|
721
|
+
result = result + '0 c';
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
if (maxValue < 5000) {
|
|
725
|
+
result = frac ? result + frac + ' мс ' : result;
|
|
726
|
+
}
|
|
727
|
+
if (h) {
|
|
728
|
+
result = h + ' ч ' + result;
|
|
729
|
+
}
|
|
730
|
+
if (d) {
|
|
731
|
+
result = d + 'д ' + result;
|
|
732
|
+
}
|
|
733
|
+
if (negative) {
|
|
734
|
+
result = '-' + result;
|
|
735
|
+
}
|
|
736
|
+
return result.trim();
|
|
737
|
+
}
|
|
698
738
|
static fillConvertDates(result, input) {
|
|
699
739
|
for (const key in input) {
|
|
700
740
|
if (!input.hasOwnProperty || !input.hasOwnProperty(key)) {
|
|
@@ -7945,10 +7985,10 @@ class DefaultHeadCellComponent extends HeadCellComponentBase {
|
|
|
7945
7985
|
}
|
|
7946
7986
|
}
|
|
7947
7987
|
DefaultHeadCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DefaultHeadCellComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
7948
|
-
DefaultHeadCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: DefaultHeadCellComponent, selector: "teta-default-head-cell", inputs: { column: "column", data: "data" }, usesInheritance: true, ngImport: i0, template: "<div class=\"column column_auto\" [tetaHint]=\"column.hint || column.caption\">\n <div class=\"table-head__cell__text\">\n {{column.caption}}\n </div>\n <div *ngIf=\"column.unit\" class=\"table-head__cell__text\" style=\"overflow: visible;\">\n [{{column.unit}}]\n </div>\n</div>\n", styles: [":host{align-items:center;justify-content:center;display:flex;min-width:0}\n"], directives: [{ type: HintDirective, selector: "[tetaHint]", inputs: ["tetaHint", "align", "verticalAlign", "delay"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7988
|
+
DefaultHeadCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: DefaultHeadCellComponent, selector: "teta-default-head-cell", inputs: { column: "column", data: "data" }, usesInheritance: true, ngImport: i0, template: "<div class=\"column column_auto\" [tetaHint]=\"column.hint || column.caption\">\n <div class=\"table-head__cell__text\">\n {{column.caption}}\n </div>\n <div *ngIf=\"column.unit\" class=\"table-head__cell__text\" style=\"overflow: visible;\">\n [{{column.unit}}]\n </div>\n</div>\n", styles: [":host{align-items:center;justify-content:center;display:flex;min-width:0;padding:6px 8px}\n"], directives: [{ type: HintDirective, selector: "[tetaHint]", inputs: ["tetaHint", "align", "verticalAlign", "delay"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7949
7989
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DefaultHeadCellComponent, decorators: [{
|
|
7950
7990
|
type: Component,
|
|
7951
|
-
args: [{ selector: 'teta-default-head-cell', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"column column_auto\" [tetaHint]=\"column.hint || column.caption\">\n <div class=\"table-head__cell__text\">\n {{column.caption}}\n </div>\n <div *ngIf=\"column.unit\" class=\"table-head__cell__text\" style=\"overflow: visible;\">\n [{{column.unit}}]\n </div>\n</div>\n", styles: [":host{align-items:center;justify-content:center;display:flex;min-width:0}\n"] }]
|
|
7991
|
+
args: [{ selector: 'teta-default-head-cell', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"column column_auto\" [tetaHint]=\"column.hint || column.caption\">\n <div class=\"table-head__cell__text\">\n {{column.caption}}\n </div>\n <div *ngIf=\"column.unit\" class=\"table-head__cell__text\" style=\"overflow: visible;\">\n [{{column.unit}}]\n </div>\n</div>\n", styles: [":host{align-items:center;justify-content:center;display:flex;min-width:0;padding:6px 8px}\n"] }]
|
|
7952
7992
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { column: [{
|
|
7953
7993
|
type: Input
|
|
7954
7994
|
}], data: [{
|