@neovici/cosmoz-omnitable 14.17.0 → 14.19.0

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.
Files changed (141) hide show
  1. package/dist/cosmoz-omnitable-column-amount.js +29 -27
  2. package/dist/cosmoz-omnitable-column-autocomplete.d.ts +1 -1
  3. package/dist/cosmoz-omnitable-column-autocomplete.d.ts.map +1 -1
  4. package/dist/cosmoz-omnitable-column-autocomplete.js +28 -24
  5. package/dist/cosmoz-omnitable-column-boolean.d.ts +4 -1
  6. package/dist/cosmoz-omnitable-column-boolean.d.ts.map +1 -1
  7. package/dist/cosmoz-omnitable-column-boolean.js +25 -17
  8. package/dist/cosmoz-omnitable-column-date.js +28 -26
  9. package/dist/cosmoz-omnitable-column-datetime.js +28 -26
  10. package/dist/cosmoz-omnitable-column-list-data.js +8 -6
  11. package/dist/cosmoz-omnitable-column-list-horizontal.js +17 -15
  12. package/dist/cosmoz-omnitable-column-list-mixin.d.ts +6 -6
  13. package/dist/cosmoz-omnitable-column-list-mixin.d.ts.map +1 -1
  14. package/dist/cosmoz-omnitable-column-list-mixin.js +28 -15
  15. package/dist/cosmoz-omnitable-column-list.js +21 -19
  16. package/dist/cosmoz-omnitable-column-mixin.js +12 -8
  17. package/dist/cosmoz-omnitable-column-number.js +29 -27
  18. package/dist/cosmoz-omnitable-column-time.js +26 -24
  19. package/dist/cosmoz-omnitable-column.js +13 -11
  20. package/dist/cosmoz-omnitable-columns.js +11 -9
  21. package/dist/cosmoz-omnitable-group-row.js +6 -4
  22. package/dist/cosmoz-omnitable-header-row.js +17 -15
  23. package/dist/cosmoz-omnitable-item-expand-line.js +7 -5
  24. package/dist/cosmoz-omnitable-item-expand.js +8 -6
  25. package/dist/cosmoz-omnitable-item-row.js +7 -5
  26. package/dist/cosmoz-omnitable-skeleton.js +8 -6
  27. package/dist/cosmoz-omnitable-styles.js +7 -4
  28. package/dist/cosmoz-omnitable.d.ts +1 -1
  29. package/dist/cosmoz-omnitable.d.ts.map +1 -1
  30. package/dist/cosmoz-omnitable.js +37 -31
  31. package/dist/grouped-list/cosmoz-grouped-list-row.js +4 -2
  32. package/dist/grouped-list/cosmoz-grouped-list.js +6 -4
  33. package/dist/grouped-list/index.js +3 -1
  34. package/dist/grouped-list/use-collapsible-items.d.ts +4 -4
  35. package/dist/grouped-list/use-collapsible-items.js +12 -8
  36. package/dist/grouped-list/use-cosmoz-grouped-list.d.ts +1 -1
  37. package/dist/grouped-list/use-cosmoz-grouped-list.js +23 -19
  38. package/dist/grouped-list/use-selected-items.d.ts +10 -10
  39. package/dist/grouped-list/use-selected-items.js +19 -15
  40. package/dist/grouped-list/use-weak-state.d.ts +3 -3
  41. package/dist/grouped-list/use-weak-state.js +10 -6
  42. package/dist/grouped-list/utils.js +11 -1
  43. package/dist/lib/compute-layout.js +10 -6
  44. package/dist/lib/cosmoz-omnitable-amount-range-input.js +16 -14
  45. package/dist/lib/cosmoz-omnitable-date-input-mixin.js +9 -5
  46. package/dist/lib/cosmoz-omnitable-date-range-input.js +14 -12
  47. package/dist/lib/cosmoz-omnitable-datetime-range-input.js +15 -13
  48. package/dist/lib/cosmoz-omnitable-number-range-input.js +14 -12
  49. package/dist/lib/cosmoz-omnitable-range-input-mixin.js +12 -8
  50. package/dist/lib/cosmoz-omnitable-resize-nub.js +7 -5
  51. package/dist/lib/cosmoz-omnitable-time-range-input.js +14 -12
  52. package/dist/lib/generic-sorter.js +5 -1
  53. package/dist/lib/icons.d.ts +4 -4
  54. package/dist/lib/icons.d.ts.map +1 -1
  55. package/dist/lib/icons.js +8 -5
  56. package/dist/lib/layout.js +5 -2
  57. package/dist/lib/polymer-haunted-render-mixin.js +10 -6
  58. package/dist/lib/render-footer.d.ts +1 -1
  59. package/dist/lib/render-footer.d.ts.map +1 -1
  60. package/dist/lib/render-footer.js +16 -12
  61. package/dist/lib/render-header.d.ts +1 -1
  62. package/dist/lib/render-header.d.ts.map +1 -1
  63. package/dist/lib/render-header.js +9 -5
  64. package/dist/lib/render-list.d.ts +1 -1
  65. package/dist/lib/render-list.d.ts.map +1 -1
  66. package/dist/lib/render-list.js +18 -14
  67. package/dist/lib/save-as-csv-action.js +7 -3
  68. package/dist/lib/save-as-xlsx-action.js +9 -5
  69. package/dist/lib/settings/cosmoz-omnitable-settings.js +71 -33
  70. package/dist/lib/settings/cosmoz-omnitable-sort-group.d.ts +3 -3
  71. package/dist/lib/settings/cosmoz-omnitable-sort-group.d.ts.map +1 -1
  72. package/dist/lib/settings/cosmoz-omnitable-sort-group.js +19 -12
  73. package/dist/lib/settings/drivers/context.d.ts +2 -10
  74. package/dist/lib/settings/drivers/context.d.ts.map +1 -1
  75. package/dist/lib/settings/drivers/context.js +13 -6
  76. package/dist/lib/settings/drivers/index.js +25 -3
  77. package/dist/lib/settings/drivers/local.js +3 -1
  78. package/dist/lib/settings/drivers/remote.js +3 -1
  79. package/dist/lib/settings/index.js +9 -2
  80. package/dist/lib/settings/normalize.js +15 -10
  81. package/dist/lib/settings/style.css.js +8 -5
  82. package/dist/lib/settings/use-saved-settings.d.ts +2 -2
  83. package/dist/lib/settings/use-saved-settings.js +11 -9
  84. package/dist/lib/settings/use-settings-ui.js +14 -12
  85. package/dist/lib/settings/use-settings.d.ts +6 -12
  86. package/dist/lib/settings/use-settings.d.ts.map +1 -1
  87. package/dist/lib/settings/use-settings.js +46 -8
  88. package/dist/lib/types.d.ts +23 -0
  89. package/dist/lib/types.d.ts.map +1 -0
  90. package/dist/lib/types.js +3 -0
  91. package/dist/lib/use-canvas-width.js +9 -5
  92. package/dist/lib/use-dom-columns.d.ts +1 -1
  93. package/dist/lib/use-dom-columns.d.ts.map +1 -1
  94. package/dist/lib/use-dom-columns.js +11 -7
  95. package/dist/lib/use-fast-layout.d.ts +1 -1
  96. package/dist/lib/use-fast-layout.js +22 -18
  97. package/dist/lib/use-footer.js +5 -1
  98. package/dist/lib/use-hash-state.js +15 -11
  99. package/dist/lib/use-header.js +9 -5
  100. package/dist/lib/use-layout.js +8 -4
  101. package/dist/lib/use-list.d.ts +2 -10
  102. package/dist/lib/use-list.d.ts.map +1 -1
  103. package/dist/lib/use-list.js +25 -21
  104. package/dist/lib/use-mini.d.ts +1 -1
  105. package/dist/lib/use-mini.js +9 -5
  106. package/dist/lib/use-omnitable.d.ts +2 -10
  107. package/dist/lib/use-omnitable.d.ts.map +1 -1
  108. package/dist/lib/use-omnitable.js +22 -18
  109. package/dist/lib/use-processed-items.d.ts +3 -5
  110. package/dist/lib/use-processed-items.d.ts.map +1 -1
  111. package/dist/lib/use-processed-items.js +27 -23
  112. package/dist/lib/use-public-interface.js +20 -16
  113. package/dist/lib/use-resizable-columns.js +8 -4
  114. package/dist/lib/use-sort-and-group-options.d.ts +2 -25
  115. package/dist/lib/use-sort-and-group-options.d.ts.map +1 -1
  116. package/dist/lib/use-sort-and-group-options.js +16 -12
  117. package/dist/lib/use-track-size.d.ts +1 -1
  118. package/dist/lib/use-track-size.d.ts.map +1 -1
  119. package/dist/lib/use-track-size.js +6 -2
  120. package/dist/lib/use-tween-array.d.ts +1 -1
  121. package/dist/lib/use-tween-array.d.ts.map +1 -1
  122. package/dist/lib/use-tween-array.js +14 -10
  123. package/dist/lib/utils-amount.d.ts +1 -1
  124. package/dist/lib/utils-amount.d.ts.map +1 -1
  125. package/dist/lib/utils-amount.js +25 -29
  126. package/dist/lib/utils-data.js +12 -8
  127. package/dist/lib/utils-date.d.ts +15 -24
  128. package/dist/lib/utils-date.d.ts.map +1 -1
  129. package/dist/lib/utils-date.js +82 -66
  130. package/dist/lib/utils-datetime.d.ts +9 -15
  131. package/dist/lib/utils-datetime.d.ts.map +1 -1
  132. package/dist/lib/utils-datetime.js +42 -21
  133. package/dist/lib/utils-number.d.ts +11 -18
  134. package/dist/lib/utils-number.d.ts.map +1 -1
  135. package/dist/lib/utils-number.js +44 -36
  136. package/dist/lib/utils-time.d.ts +12 -16
  137. package/dist/lib/utils-time.d.ts.map +1 -1
  138. package/dist/lib/utils-time.js +61 -42
  139. package/dist/lib/utils.js +6 -2
  140. package/dist/ui-helpers/cosmoz-clear-button.js +7 -5
  141. package/package.json +1 -1
@@ -1,19 +1,12 @@
1
- export function toNumber(value: any, limit: any, limitFunc: any): any;
2
- export function toInputString(value: any): any;
3
- export function getInputString({ valuePath }: {
4
- valuePath: any;
5
- }, item: any): any;
6
- export function toHashString(value: any): any;
7
- export function getComparableValue({ valuePath, maximumFractionDigits }: {
8
- valuePath: any;
9
- maximumFractionDigits: any;
10
- }, item: any): any;
11
- export const makeFormatter: any;
12
- export function getString({ valuePath, locale, minimumFractionDigits, maximumFractionDigits }: {
13
- valuePath: any;
14
- locale: any;
15
- minimumFractionDigits: any;
16
- maximumFractionDigits: any;
17
- }, item: any): any;
18
- export function applySingleFilter(column: any, filter: any): (item: any) => boolean;
1
+ import { LimitFunction, GetPath, Item, NumberColumn, AmountLimit } from './types.js';
2
+ export declare const toNumber: (value?: unknown, limit?: unknown, limitFunc?: LimitFunction) => number | undefined;
3
+ export declare const toInputString: (value?: unknown) => string | null;
4
+ export declare const getInputString: ({ valuePath }: {
5
+ valuePath?: GetPath;
6
+ }, item: Item) => string | null;
7
+ export declare const toHashString: (value: unknown) => string;
8
+ export declare const getComparableValue: <T extends NumberColumn>({ valuePath, maximumFractionDigits }: T, item?: Item) => number | undefined;
9
+ export declare const makeFormatter: (locale?: string | undefined, minimumFractionDigits?: number | null | undefined, maximumFractionDigits?: number | null | undefined) => Intl.NumberFormat;
10
+ export declare const getString: <T extends NumberColumn>({ valuePath, locale, minimumFractionDigits, maximumFractionDigits }: T, item: Item) => string | undefined;
11
+ export declare const applySingleFilter: (column: NumberColumn, filter: AmountLimit) => (item: Item) => boolean;
19
12
  //# sourceMappingURL=utils-number.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-number.d.ts","sourceRoot":"","sources":["../../src/lib/utils-number.js"],"names":[],"mappings":"AAGO,sEA2GL;AA3GK,+CA2GL;AA3GK;;mBA2GL;AA3GK,8CA2GL;AA3GK;;;mBA2GL;AA9CD,gCAaC;AA1EK;;;;;mBA2GL;AA3GK,8DAgGmC,SAAI,aAW5C"}
1
+ {"version":3,"file":"utils-number.d.ts","sourceRoot":"","sources":["../../src/lib/utils-number.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,aAAa,EACb,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,QAAQ,GACpB,QAAQ,OAAO,EACf,QAAQ,OAAO,EACf,YAAY,aAAa,KACvB,MAAM,GAAG,SAsBX,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,OAAO,KAAG,MAAM,GAAG,IAQxD,CAAC;AAEF,eAAO,MAAM,cAAc,GAC1B,eAAe;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,EACtC,MAAM,IAAI,KACR,MAAM,GAAG,IAIX,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,MAQ7C,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,YAAY,EACxD,sCAAsC,CAAC,EACvC,OAAO,IAAI,KACT,MAAM,GAAG,SAiBX,CAAC;AAEF,eAAO,MAAM,aAAa,0JAoBzB,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,YAAY,EAC/C,qEAAqE,CAAC,EACtE,MAAM,IAAI,KACR,MAAM,GAAG,SAoBX,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,YAAY,EAAE,QAAQ,WAAW,MACzC,MAAM,IAAI,KAAG,OAWb,CAAC"}
@@ -1,13 +1,9 @@
1
- import { get } from '@polymer/polymer/lib/utils/path';
2
- import { memoooize } from '@neovici/cosmoz-utils/memoize';
3
- export const /**
4
- * Converts a value to number optionaly limiting it.
5
- *
6
- * @param {Number|*} value The value to convert to number
7
- * @param {Number|*} limit The value used to limit the number
8
- * @param {Function} limitFunc The function used to limit the number (Math.min|Math.max)
9
- * @returns {Number|void} Value converted to Number or void
10
- */ toNumber = (value, limit, limitFunc) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applySingleFilter = exports.getString = exports.makeFormatter = exports.getComparableValue = exports.toHashString = exports.getInputString = exports.toInputString = exports.toNumber = void 0;
4
+ const path_1 = require("@polymer/polymer/lib/utils/path");
5
+ const memoize_1 = require("@neovici/cosmoz-utils/memoize");
6
+ const toNumber = (value, limit, limitFunc) => {
11
7
  if (value == null || value === '') {
12
8
  return;
13
9
  }
@@ -18,43 +14,50 @@ export const /**
18
14
  if (limitFunc == null || limit == null) {
19
15
  return number;
20
16
  }
21
- const lNumber = toNumber(limit);
17
+ const lNumber = (0, exports.toNumber)(limit);
22
18
  if (lNumber == null) {
23
19
  return number;
24
20
  }
25
21
  return limitFunc(number, lNumber);
26
- }, toInputString = (value) => {
27
- const val = toNumber(value);
22
+ };
23
+ exports.toNumber = toNumber;
24
+ const toInputString = (value) => {
25
+ const val = (0, exports.toNumber)(value);
28
26
  if (val == null) {
29
27
  return null;
30
28
  }
31
29
  return val.toString();
32
- }, getInputString = ({ valuePath }, item) => {
33
- const value = toNumber(get(item, valuePath));
34
- return toInputString(value);
35
- }, toHashString = (value) => {
36
- const string = toInputString(value);
30
+ };
31
+ exports.toInputString = toInputString;
32
+ const getInputString = ({ valuePath }, item) => {
33
+ const value = (0, exports.toNumber)(valuePath ? (0, path_1.get)(item, valuePath) : item);
34
+ return (0, exports.toInputString)(value);
35
+ };
36
+ exports.getInputString = getInputString;
37
+ const toHashString = (value) => {
38
+ const string = (0, exports.toInputString)(value);
37
39
  if (string == null) {
38
40
  return '';
39
41
  }
40
42
  return string;
41
- }, getComparableValue = ({ valuePath, maximumFractionDigits }, item) => {
43
+ };
44
+ exports.toHashString = toHashString;
45
+ const getComparableValue = ({ valuePath, maximumFractionDigits }, item) => {
42
46
  if (item == null) {
43
47
  return;
44
48
  }
45
- let value = item;
46
- if (valuePath != null) {
47
- value = get(item, valuePath);
48
- }
49
- value = toNumber(value);
50
- if (value == null) {
49
+ const value = valuePath ? (0, path_1.get)(item, valuePath) : item;
50
+ const numValue = (0, exports.toNumber)(value);
51
+ if (numValue == null) {
51
52
  return;
52
53
  }
53
54
  if (maximumFractionDigits !== null) {
54
- return toNumber(value.toFixed(maximumFractionDigits));
55
+ return (0, exports.toNumber)(numValue.toFixed(maximumFractionDigits));
55
56
  }
56
- return value;
57
- }, makeFormatter = memoooize((locale, minimumFractionDigits, maximumFractionDigits) => {
57
+ return numValue;
58
+ };
59
+ exports.getComparableValue = getComparableValue;
60
+ exports.makeFormatter = (0, memoize_1.memoooize)((locale, minimumFractionDigits, maximumFractionDigits) => {
58
61
  const options = {
59
62
  localeMatcher: 'best fit', // chrome expects this when using custom options
60
63
  };
@@ -65,23 +68,28 @@ export const /**
65
68
  options.maximumFractionDigits = maximumFractionDigits;
66
69
  }
67
70
  return new Intl.NumberFormat(locale || undefined, options);
68
- }), getString = ({ valuePath, locale, minimumFractionDigits, maximumFractionDigits }, item) => {
69
- const value = get(item, valuePath);
71
+ });
72
+ const getString = ({ valuePath, locale, minimumFractionDigits, maximumFractionDigits }, item) => {
73
+ const value = valuePath ? (0, path_1.get)(item, valuePath) : item;
70
74
  if (value == null) {
71
75
  return '';
72
76
  }
73
- const number = toNumber(value);
77
+ const number = (0, exports.toNumber)(value);
74
78
  if (number == null) {
75
79
  return;
76
80
  }
77
- const formatter = makeFormatter(locale, minimumFractionDigits, maximumFractionDigits);
81
+ const formatter = (0, exports.makeFormatter)(locale, minimumFractionDigits, maximumFractionDigits);
78
82
  return formatter.format(number);
79
- }, applySingleFilter = (column, filter) => (item) => {
80
- const value = getComparableValue(column, item);
83
+ };
84
+ exports.getString = getString;
85
+ const applySingleFilter = (column, filter) => (item) => {
86
+ const value = (0, exports.getComparableValue)(column, item);
81
87
  if (value == null) {
82
88
  return false;
83
89
  }
84
- const min = getComparableValue({ ...column, valuePath: 'min' }, filter), max = getComparableValue({ ...column, valuePath: 'max' }, filter);
85
- return !(value < min || value > max);
90
+ const min = (0, exports.getComparableValue)({ ...column, valuePath: 'min' }, filter);
91
+ const max = (0, exports.getComparableValue)({ ...column, valuePath: 'max' }, filter);
92
+ return !(value < (min ?? -Infinity) || value > (max ?? Infinity));
86
93
  };
94
+ exports.applySingleFilter = applySingleFilter;
87
95
  //# sourceMappingURL=utils-number.js.map
@@ -1,17 +1,13 @@
1
- export const _fixedDate: "1970-01-01";
2
- export function toDate(value: any, limit: any, limitFunc: any): any;
3
- export const formatters: {};
4
- export function getFormatter(locale: any): any;
5
- export function getString({ valuePath, locale }: {
6
- valuePath: any;
7
- locale: any;
8
- }, item: any): any;
9
- export function toXlsxValue(column: any, item: any): any;
10
- export function toInputString(value: any): any;
11
- export function getComparableValue({ valuePath }: {
12
- valuePath: any;
13
- }, item: any): any;
14
- export function applySingleFilter(column: any, filter: any): (item: any) => boolean;
15
- export function toHashString(value: any): any;
16
- export function fromHashString(value: any): any;
1
+ import { Limit, LimitFunction, DateColumn, Item } from './types';
2
+ export declare const _fixedDate: "1970-01-01";
3
+ export declare const toDate: (value: unknown, limit?: Limit<unknown>, limitFunc?: LimitFunction) => Date | null;
4
+ export declare const formatters: Record<string, Intl.DateTimeFormat>;
5
+ export declare const getFormatter: (locale?: string) => Intl.DateTimeFormat;
6
+ export declare const getString: <T extends DateColumn>({ valuePath, locale }: T, item: Item) => string | undefined;
7
+ export declare const toXlsxValue: (column: DateColumn, item: Item) => string | undefined;
8
+ export declare const toInputString: (value: unknown) => string | null;
9
+ export declare const getComparableValue: <T extends DateColumn>({ valuePath }: T, item: Item) => number | null | undefined;
10
+ export declare const applySingleFilter: (column: DateColumn, filter: Limit<Date>) => (item: Item) => boolean;
11
+ export declare const toHashString: (value: unknown) => string;
12
+ export declare const fromHashString: (value: unknown) => Date | null | undefined;
17
13
  //# sourceMappingURL=utils-time.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-time.d.ts","sourceRoot":"","sources":["../../src/lib/utils-time.js"],"names":[],"mappings":"AASa,yBAAa,YAAY,CAAA;AAA/B,oEAsGL;AAnFD,4BAAe;AAnBT,+CAsGL;AAtGK;;;mBAsGL;AAtGK,yDAsGL;AAtGK,+CAsGL;AAtGK;;mBAsGL;AAtGK,8DA4EmC,SAAI,aA0B5C;AAtGK,8CAsGL;AAtGK,gDAsGL"}
1
+ {"version":3,"file":"utils-time.d.ts","sourceRoot":"","sources":["../../src/lib/utils-time.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEjE,eAAO,MAAM,UAAU,EAAG,YAAqB,CAAC;AAEhD,eAAO,MAAM,MAAM,GAClB,OAAO,OAAO,EACd,QAAQ,KAAK,CAAC,OAAO,CAAC,EACtB,YAAY,aAAa,gBAUzB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAM,CAAC;AAElE,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,KAAG,IAAI,CAAC,cAmBnD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,UAAU,EAC7C,uBAAuB,CAAC,EACxB,MAAM,IAAI,uBAUV,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,QAAQ,UAAU,EAAE,MAAM,IAAI,uBAKzD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,kBAU3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,UAAU,EACtD,eAAe,CAAC,EAChB,MAAM,IAAI,8BAmBV,CAAC;AACF,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,UAAU,EAAE,QAAQ,KAAK,CAAC,IAAI,CAAC,MAAM,MAAM,IAAI,YAevD,CAAC;AAEH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,WAS1C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,4BAQ5C,CAAC"}
@@ -1,88 +1,107 @@
1
- import { toLocalISOString } from '@neovici/cosmoz-utils/date';
2
- import { get } from '@polymer/polymer/lib/utils/path';
3
- import { getAbsoluteISOString, renderValue, toDate as superToDate, } from './utils-date';
4
- import { toNumber } from './utils-number';
5
- export const _fixedDate = '1970-01-01',
6
- /**
7
- * Converts time to date optionaly limiting it.
8
- *
9
- * @param {Date|Number} value Date or Timestamp ( miliseconds since property _fixedDate ) to be converted
10
- * @param {Date|Number} limit Optional value to limit the date.
11
- * @param {Function} limitFunc Function used to limit the date (Math.min|Math.max)
12
- * @returns {Date|void} Value converted to date optionaly limitated
13
- */
14
- toDate = (value, limit, limitFunc) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fromHashString = exports.toHashString = exports.applySingleFilter = exports.getComparableValue = exports.toInputString = exports.toXlsxValue = exports.getString = exports.getFormatter = exports.formatters = exports.toDate = exports._fixedDate = void 0;
4
+ const date_1 = require("@neovici/cosmoz-utils/date");
5
+ const path_1 = require("@polymer/polymer/lib/utils/path");
6
+ const utils_date_1 = require("./utils-date");
7
+ const utils_number_1 = require("./utils-number");
8
+ exports._fixedDate = '1970-01-01';
9
+ const toDate = (value, limit, limitFunc) => {
15
10
  // Most browsers use local timezone when no timezone is specified
16
11
  // but Safari uses UTC, so we set it implicitly
17
12
  // TODO: Consider removing this when/if Safari handles local timezone correctly
18
13
  const date = typeof value === 'string' && value.length > 3 && value.length <= 9
19
- ? getAbsoluteISOString(_fixedDate + 'T' + value)
14
+ ? (0, utils_date_1.getAbsoluteISOString)(exports._fixedDate + 'T' + value)
20
15
  : value;
21
- return superToDate(date, limit, limitFunc);
22
- }, formatters = {}, getFormatter = (locale) => {
16
+ return (0, utils_date_1.toDate)(date, limit, limitFunc);
17
+ };
18
+ exports.toDate = toDate;
19
+ exports.formatters = {};
20
+ const getFormatter = (locale) => {
23
21
  const key = locale || '';
24
- if (formatters[key]) {
25
- return formatters[key];
22
+ if (exports.formatters[key]) {
23
+ return exports.formatters[key];
26
24
  }
27
25
  const timeFormatOption = {
28
26
  hour: 'numeric',
29
27
  minute: 'numeric',
30
28
  second: 'numeric',
31
29
  };
32
- formatters[key] = new Intl.DateTimeFormat(locale || undefined, timeFormatOption);
33
- return formatters[key];
34
- }, getString = ({ valuePath, locale }, item) => {
35
- const value = toDate(get(item, valuePath));
30
+ exports.formatters[key] = new Intl.DateTimeFormat(locale || undefined, timeFormatOption);
31
+ return exports.formatters[key];
32
+ };
33
+ exports.getFormatter = getFormatter;
34
+ const getString = ({ valuePath, locale }, item) => {
35
+ const value = (0, exports.toDate)((0, path_1.get)(item, valuePath || ''));
36
36
  if (value === undefined) {
37
37
  return '';
38
38
  }
39
39
  if (value === null) {
40
40
  return 'Invalid Date';
41
41
  }
42
- return renderValue(value, getFormatter(locale));
43
- }, toXlsxValue = (column, item) => {
42
+ return (0, utils_date_1.renderValue)(value, (0, exports.getFormatter)(locale));
43
+ };
44
+ exports.getString = getString;
45
+ const toXlsxValue = (column, item) => {
44
46
  if (!column.valuePath) {
45
47
  return '';
46
48
  }
47
- return getString(column, item);
48
- }, toInputString = (value) => {
49
- const date = toDate(value);
49
+ return (0, exports.getString)(column, item);
50
+ };
51
+ exports.toXlsxValue = toXlsxValue;
52
+ const toInputString = (value) => {
53
+ const date = (0, exports.toDate)(value);
50
54
  if (date == null) {
51
55
  return null;
52
56
  }
53
- return toLocalISOString(date).slice(11, 19);
54
- }, getComparableValue = ({ valuePath }, item) => {
57
+ const localISOString = (0, date_1.toLocalISOString)(date);
58
+ return localISOString ? localISOString.slice(11, 19) : localISOString;
59
+ };
60
+ exports.toInputString = toInputString;
61
+ const getComparableValue = ({ valuePath }, item) => {
55
62
  if (item == null) {
56
63
  return;
57
64
  }
58
- let value = toInputString(valuePath == null ? item : get(item, valuePath));
65
+ const value = (0, exports.toInputString)(valuePath == null ? item : (0, path_1.get)(item, valuePath));
59
66
  if (value == null) {
60
67
  return;
61
68
  }
62
- value = toDate(getAbsoluteISOString(_fixedDate + 'T' + value));
63
- if (value == null) {
64
- return;
69
+ const dateValue = (0, exports.toDate)((0, utils_date_1.getAbsoluteISOString)(exports._fixedDate + 'T' + value));
70
+ if (dateValue == null) {
71
+ return dateValue;
65
72
  }
66
- return toNumber(value.getTime());
67
- }, applySingleFilter = (column, filter) => (item) => {
68
- const value = getComparableValue(column, item);
73
+ return (0, utils_number_1.toNumber)(dateValue.getTime());
74
+ };
75
+ exports.getComparableValue = getComparableValue;
76
+ const applySingleFilter = (column, filter) => (item) => {
77
+ const value = (0, exports.getComparableValue)(column, item);
69
78
  if (value == null) {
70
79
  return false;
71
80
  }
72
- const min = getComparableValue({ ...column, valuePath: 'min' }, filter), max = getComparableValue({ ...column, valuePath: 'max' }, filter);
81
+ const min = (0, exports.getComparableValue)({ ...column, valuePath: 'min' }, filter), max = (0, exports.getComparableValue)({ ...column, valuePath: 'max' }, filter);
82
+ if (min == null || max == null) {
83
+ return false;
84
+ }
73
85
  return !(value < min || value > max);
74
- }, toHashString = (value) => {
75
- const date = toDate(value);
86
+ };
87
+ exports.applySingleFilter = applySingleFilter;
88
+ const toHashString = (value) => {
89
+ const date = (0, exports.toDate)(value);
76
90
  if (date == null) {
77
91
  return '';
78
92
  }
79
93
  //Use utc in hash
80
94
  return date.toISOString().slice(11, 19).replace(/:/gu, '.');
81
- }, fromHashString = (value) => {
95
+ };
96
+ exports.toHashString = toHashString;
97
+ const fromHashString = (value) => {
82
98
  if (value == null || value === '') {
83
99
  return;
84
100
  }
85
101
  //Parse utc from hash string
86
- return toDate(value.replace(/\./gu, ':') + 'Z');
102
+ return typeof value === 'string'
103
+ ? (0, exports.toDate)(value.replace(/\./gu, ':') + 'Z')
104
+ : (0, exports.toDate)(value);
87
105
  };
106
+ exports.fromHashString = fromHashString;
88
107
  //# sourceMappingURL=utils-time.js.map
package/dist/lib/utils.js CHANGED
@@ -1,6 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findLastIndex = exports.indexSymbol = void 0;
1
4
  const indexSymbol = Symbol('index');
2
- export { indexSymbol };
3
- export const findLastIndex = (array, predicate) => {
5
+ exports.indexSymbol = indexSymbol;
6
+ const findLastIndex = (array, predicate) => {
4
7
  if (Array.prototype.findLastIndex) {
5
8
  return array.findLastIndex(predicate);
6
9
  }
@@ -11,4 +14,5 @@ export const findLastIndex = (array, predicate) => {
11
14
  }
12
15
  return -1;
13
16
  };
17
+ exports.findLastIndex = findLastIndex;
14
18
  //# sourceMappingURL=utils.js.map
@@ -1,6 +1,8 @@
1
- import { tagged as css } from '@neovici/cosmoz-utils';
2
- import { html, component } from '@pionjs/pion';
3
- const styles = css `
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cosmoz_utils_1 = require("@neovici/cosmoz-utils");
4
+ const pion_1 = require("@pionjs/pion");
5
+ const styles = (0, cosmoz_utils_1.tagged) `
4
6
  :host {
5
7
  display: flex;
6
8
  }
@@ -46,7 +48,7 @@ const styles = css `
46
48
  color: #dfdfdf;
47
49
  }
48
50
  `;
49
- const Clear = () => html `
51
+ const Clear = () => (0, pion_1.html) `
50
52
  <style>
51
53
  ${styles}
52
54
  </style>
@@ -63,5 +65,5 @@ const Clear = () => html `
63
65
  </g>
64
66
  </svg>
65
67
  `;
66
- customElements.define('cosmoz-clear-button', component(Clear));
68
+ customElements.define('cosmoz-clear-button', (0, pion_1.component)(Clear));
67
69
  //# sourceMappingURL=cosmoz-clear-button.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-omnitable",
3
- "version": "14.17.0",
3
+ "version": "14.19.0",
4
4
  "description": "[![Build Status](https://travis-ci.org/Neovici/cosmoz-omnitable.svg?branch=master)](https://travis-ci.org/Neovici/cosmoz-omnitable)",
5
5
  "keywords": [
6
6
  "web-components"