@firestitch/common 12.4.0 → 12.4.1

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.
@@ -1,7 +1,7 @@
1
1
  import { PipeTransform } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class FsFormatBytesPipe implements PipeTransform {
4
- transform(value: number): string;
4
+ transform(value: number, decimals?: any, unit?: 'KB' | 'MB' | 'GB' | 'TB' | 'PB'): string;
5
5
  static ɵfac: i0.ɵɵFactoryDeclaration<FsFormatBytesPipe, never>;
6
6
  static ɵpipe: i0.ɵɵPipeDeclaration<FsFormatBytesPipe, "fsFormatBytes">;
7
7
  }
@@ -3,7 +3,7 @@ import * as i0 from "@angular/core";
3
3
  export declare class FsFormatCurrencyPipe implements PipeTransform {
4
4
  locale: string;
5
5
  constructor(locale: string);
6
- transform(amount: any, precision?: any, currencyCode?: any): string;
6
+ transform(amount: any, precision?: number, currencyCode?: any): string;
7
7
  static ɵfac: i0.ɵɵFactoryDeclaration<FsFormatCurrencyPipe, never>;
8
8
  static ɵpipe: i0.ɵɵPipeDeclaration<FsFormatCurrencyPipe, "fsFormatCurrency">;
9
9
  }
@@ -0,0 +1,2 @@
1
+ export * from './util.pipe';
2
+ export * from './bytes.pipe';
@@ -689,6 +689,7 @@
689
689
  this.locale = locale;
690
690
  }
691
691
  FsFormatCurrencyPipe.prototype.transform = function (amount, precision, currencyCode) {
692
+ if (precision === void 0) { precision = 2; }
692
693
  return currency(amount, precision, currencyCode);
693
694
  };
694
695
  return FsFormatCurrencyPipe;
@@ -739,35 +740,6 @@
739
740
  }]
740
741
  }], ctorParameters: function () { return []; } });
741
742
 
742
- function bytes(bytes) {
743
- if (!bytes) {
744
- return '0.00 B';
745
- }
746
- var e = Math.floor(Math.log(bytes) / Math.log(1024));
747
- var decimals = (bytes / 1024) > 1000 ? 2 : 0;
748
- console.log(bytes, (bytes / 1024), decimals);
749
- return ("" + (bytes / Math.pow(1024, e)).toFixed(decimals)).replace(/\.00/, '')
750
- + ' '
751
- + (e ? ' KMGTP'.charAt(e) : '') + 'B';
752
- }
753
-
754
- var FsFormatBytesPipe = /** @class */ (function () {
755
- function FsFormatBytesPipe() {
756
- }
757
- FsFormatBytesPipe.prototype.transform = function (value) {
758
- return bytes(value);
759
- };
760
- return FsFormatBytesPipe;
761
- }());
762
- FsFormatBytesPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
763
- FsFormatBytesPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, name: "fsFormatBytes" });
764
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, decorators: [{
765
- type: i0.Pipe,
766
- args: [{
767
- name: 'fsFormatBytes',
768
- }]
769
- }] });
770
-
771
743
  var FsStopPropagationDirective = /** @class */ (function () {
772
744
  function FsStopPropagationDirective() {
773
745
  }
@@ -1173,86 +1145,6 @@
1173
1145
  }]
1174
1146
  }] });
1175
1147
 
1176
- var FsCommonModule = /** @class */ (function () {
1177
- function FsCommonModule() {
1178
- }
1179
- FsCommonModule.forRoot = function () {
1180
- return {
1181
- ngModule: FsCommonModule,
1182
- providers: [
1183
- FsArray,
1184
- FsMath,
1185
- FsUtil,
1186
- FsValidate
1187
- ]
1188
- };
1189
- };
1190
- return FsCommonModule;
1191
- }());
1192
- FsCommonModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsCommonModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1193
- FsCommonModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsCommonModule, declarations: [FsStopPropagationDirective,
1194
- FsPreventDefaultDirective,
1195
- FsAutofocusDirective,
1196
- FsUtilGuidPipe,
1197
- FsUtilIsEmptyPipe,
1198
- FsUtilIsNotEmptyPipe,
1199
- FsUtilStringifyPipe,
1200
- FsFormatNumberPipe,
1201
- FsFormatCurrencyPipe,
1202
- FsFormatTruncatePipe,
1203
- FsFormatBytesPipe,
1204
- FsFormatOrdinalNumberPipe], imports: [common.CommonModule], exports: [FsStopPropagationDirective,
1205
- FsPreventDefaultDirective,
1206
- FsAutofocusDirective,
1207
- FsUtilGuidPipe,
1208
- FsUtilStringifyPipe,
1209
- FsFormatNumberPipe,
1210
- FsFormatCurrencyPipe,
1211
- FsFormatTruncatePipe,
1212
- FsUtilIsEmptyPipe,
1213
- FsUtilIsNotEmptyPipe,
1214
- FsFormatBytesPipe,
1215
- FsFormatOrdinalNumberPipe] });
1216
- FsCommonModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsCommonModule, imports: [[
1217
- common.CommonModule,
1218
- ]] });
1219
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsCommonModule, decorators: [{
1220
- type: i0.NgModule,
1221
- args: [{
1222
- imports: [
1223
- common.CommonModule,
1224
- ],
1225
- exports: [
1226
- FsStopPropagationDirective,
1227
- FsPreventDefaultDirective,
1228
- FsAutofocusDirective,
1229
- FsUtilGuidPipe,
1230
- FsUtilStringifyPipe,
1231
- FsFormatNumberPipe,
1232
- FsFormatCurrencyPipe,
1233
- FsFormatTruncatePipe,
1234
- FsUtilIsEmptyPipe,
1235
- FsUtilIsNotEmptyPipe,
1236
- FsFormatBytesPipe,
1237
- FsFormatOrdinalNumberPipe,
1238
- ],
1239
- declarations: [
1240
- FsStopPropagationDirective,
1241
- FsPreventDefaultDirective,
1242
- FsAutofocusDirective,
1243
- FsUtilGuidPipe,
1244
- FsUtilIsEmptyPipe,
1245
- FsUtilIsNotEmptyPipe,
1246
- FsUtilStringifyPipe,
1247
- FsFormatNumberPipe,
1248
- FsFormatCurrencyPipe,
1249
- FsFormatTruncatePipe,
1250
- FsFormatBytesPipe,
1251
- FsFormatOrdinalNumberPipe,
1252
- ],
1253
- }]
1254
- }] });
1255
-
1256
1148
  function email(value) {
1257
1149
  return !!String(value).match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
1258
1150
  }
@@ -2001,6 +1893,120 @@
2001
1893
  }
2002
1894
  };
2003
1895
 
1896
+ function bytes(bytes, decimals, unit) {
1897
+ if (!bytes) {
1898
+ return '0 MB';
1899
+ }
1900
+ var e = typeof unit === 'string' ?
1901
+ 'KMGTP'.indexOf(unit.replace('B', '')) + 1 :
1902
+ Math.floor(Math.log(bytes) / Math.log(1024));
1903
+ if (!isNumeric(decimals)) {
1904
+ decimals = (bytes / 1024) > 1000 ? 2 : 0;
1905
+ }
1906
+ return ("" + (bytes / Math.pow(1024, e))
1907
+ .toFixed(decimals))
1908
+ .replace(/\.00/, '')
1909
+ + ' '
1910
+ + (e ? ' KMGTP'.charAt(e) : '') + 'B';
1911
+ }
1912
+
1913
+ var FsFormatBytesPipe = /** @class */ (function () {
1914
+ function FsFormatBytesPipe() {
1915
+ }
1916
+ FsFormatBytesPipe.prototype.transform = function (value, decimals, unit) {
1917
+ return bytes(value, decimals, unit);
1918
+ };
1919
+ return FsFormatBytesPipe;
1920
+ }());
1921
+ FsFormatBytesPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1922
+ FsFormatBytesPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, name: "fsFormatBytes" });
1923
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, decorators: [{
1924
+ type: i0.Pipe,
1925
+ args: [{
1926
+ name: 'fsFormatBytes',
1927
+ }]
1928
+ }] });
1929
+
1930
+ var FsCommonModule = /** @class */ (function () {
1931
+ function FsCommonModule() {
1932
+ }
1933
+ FsCommonModule.forRoot = function () {
1934
+ return {
1935
+ ngModule: FsCommonModule,
1936
+ providers: [
1937
+ FsArray,
1938
+ FsMath,
1939
+ FsUtil,
1940
+ FsValidate
1941
+ ]
1942
+ };
1943
+ };
1944
+ return FsCommonModule;
1945
+ }());
1946
+ FsCommonModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsCommonModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1947
+ FsCommonModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsCommonModule, declarations: [FsStopPropagationDirective,
1948
+ FsPreventDefaultDirective,
1949
+ FsAutofocusDirective,
1950
+ FsUtilGuidPipe,
1951
+ FsUtilIsEmptyPipe,
1952
+ FsUtilIsNotEmptyPipe,
1953
+ FsUtilStringifyPipe,
1954
+ FsFormatNumberPipe,
1955
+ FsFormatCurrencyPipe,
1956
+ FsFormatTruncatePipe,
1957
+ FsFormatBytesPipe,
1958
+ FsFormatOrdinalNumberPipe], imports: [common.CommonModule], exports: [FsStopPropagationDirective,
1959
+ FsPreventDefaultDirective,
1960
+ FsAutofocusDirective,
1961
+ FsUtilGuidPipe,
1962
+ FsUtilStringifyPipe,
1963
+ FsFormatNumberPipe,
1964
+ FsFormatCurrencyPipe,
1965
+ FsFormatTruncatePipe,
1966
+ FsUtilIsEmptyPipe,
1967
+ FsUtilIsNotEmptyPipe,
1968
+ FsFormatBytesPipe,
1969
+ FsFormatOrdinalNumberPipe] });
1970
+ FsCommonModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsCommonModule, imports: [[
1971
+ common.CommonModule,
1972
+ ]] });
1973
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsCommonModule, decorators: [{
1974
+ type: i0.NgModule,
1975
+ args: [{
1976
+ imports: [
1977
+ common.CommonModule,
1978
+ ],
1979
+ exports: [
1980
+ FsStopPropagationDirective,
1981
+ FsPreventDefaultDirective,
1982
+ FsAutofocusDirective,
1983
+ FsUtilGuidPipe,
1984
+ FsUtilStringifyPipe,
1985
+ FsFormatNumberPipe,
1986
+ FsFormatCurrencyPipe,
1987
+ FsFormatTruncatePipe,
1988
+ FsUtilIsEmptyPipe,
1989
+ FsUtilIsNotEmptyPipe,
1990
+ FsFormatBytesPipe,
1991
+ FsFormatOrdinalNumberPipe,
1992
+ ],
1993
+ declarations: [
1994
+ FsStopPropagationDirective,
1995
+ FsPreventDefaultDirective,
1996
+ FsAutofocusDirective,
1997
+ FsUtilGuidPipe,
1998
+ FsUtilIsEmptyPipe,
1999
+ FsUtilIsNotEmptyPipe,
2000
+ FsUtilStringifyPipe,
2001
+ FsFormatNumberPipe,
2002
+ FsFormatCurrencyPipe,
2003
+ FsFormatTruncatePipe,
2004
+ FsFormatBytesPipe,
2005
+ FsFormatOrdinalNumberPipe,
2006
+ ],
2007
+ }]
2008
+ }] });
2009
+
2004
2010
  var keyboardShortcut = function (shortcut) {
2005
2011
  // Observables for all keydown and keyup events
2006
2012
  var keyDown$ = rxjs.fromEvent(document, 'keydown');