@neovici/cosmoz-omnitable 14.12.1 → 14.12.2

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 (35) hide show
  1. package/README.md +1 -2
  2. package/cosmoz-omnitable-column-boolean.js +81 -62
  3. package/cosmoz-omnitable-column-list-data.js +57 -49
  4. package/cosmoz-omnitable-column-list-horizontal.js +42 -26
  5. package/cosmoz-omnitable-group-row.js +10 -2
  6. package/cosmoz-omnitable-item-expand-line.js +1 -1
  7. package/grouped-list/cosmoz-grouped-list-row.js +1 -1
  8. package/grouped-list/use-cosmoz-grouped-list.js +12 -11
  9. package/grouped-list/use-selected-items.js +25 -25
  10. package/grouped-list/use-weak-state.js +2 -2
  11. package/grouped-list/utils.js +11 -9
  12. package/lib/compute-layout.js +2 -1
  13. package/lib/cosmoz-omnitable-amount-range-input.js +100 -97
  14. package/lib/cosmoz-omnitable-date-input-mixin.js +23 -13
  15. package/lib/cosmoz-omnitable-date-range-input.js +85 -78
  16. package/lib/cosmoz-omnitable-datetime-range-input.js +85 -78
  17. package/lib/cosmoz-omnitable-number-range-input.js +34 -27
  18. package/lib/cosmoz-omnitable-range-input-mixin.js +7 -10
  19. package/lib/cosmoz-omnitable-time-range-input.js +54 -30
  20. package/lib/layout.js +12 -14
  21. package/lib/polymer-haunted-render-mixin.js +14 -13
  22. package/lib/save-as-csv-action.js +31 -27
  23. package/lib/save-as-xlsx-action.js +13 -11
  24. package/lib/settings/cosmoz-omnitable-sort-group.js +1 -1
  25. package/lib/settings/drivers/context.js +1 -1
  26. package/lib/use-hash-state.js +1 -1
  27. package/lib/use-processed-items.js +20 -20
  28. package/lib/utils-amount.js +17 -26
  29. package/lib/utils-data.js +24 -24
  30. package/lib/utils-date.js +18 -34
  31. package/lib/utils-datetime.js +10 -15
  32. package/lib/utils-number.js +28 -29
  33. package/lib/utils-time.js +21 -24
  34. package/lib/utils.js +1 -1
  35. package/package.json +8 -2
package/lib/utils-time.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { toLocalISOString } from '@neovici/cosmoz-utils/date';
2
2
  import { get } from '@polymer/polymer/lib/utils/path';
3
- import { getAbsoluteISOString, renderValue, toDate as superToDate } from './utils-date';
3
+ import {
4
+ getAbsoluteISOString,
5
+ renderValue,
6
+ toDate as superToDate,
7
+ } from './utils-date';
4
8
  import { toNumber } from './utils-number';
5
9
 
6
- export const
7
-
8
- _fixedDate = '1970-01-01',
9
-
10
+ export const _fixedDate = '1970-01-01',
10
11
  /**
11
12
  * Converts time to date optionaly limiting it.
12
13
  *
@@ -19,14 +20,14 @@ export const
19
20
  // Most browsers use local timezone when no timezone is specified
20
21
  // but Safari uses UTC, so we set it implicitly
21
22
  // TODO: Consider removing this when/if Safari handles local timezone correctly
22
- const date = typeof value === 'string' && value.length > 3 && value.length <= 9
23
- ? getAbsoluteISOString(_fixedDate + 'T' + value)
24
- : value;
23
+ const date =
24
+ typeof value === 'string' && value.length > 3 && value.length <= 9
25
+ ? getAbsoluteISOString(_fixedDate + 'T' + value)
26
+ : value;
25
27
  return superToDate(date, limit, limitFunc);
26
28
  },
27
-
28
29
  formatters = {},
29
- getFormatter = locale => {
30
+ getFormatter = (locale) => {
30
31
  const key = locale || '';
31
32
 
32
33
  if (formatters[key]) {
@@ -36,9 +37,12 @@ export const
36
37
  const timeFormatOption = {
37
38
  hour: 'numeric',
38
39
  minute: 'numeric',
39
- second: 'numeric'
40
+ second: 'numeric',
40
41
  };
41
- formatters[key] = new Intl.DateTimeFormat(locale || undefined, timeFormatOption);
42
+ formatters[key] = new Intl.DateTimeFormat(
43
+ locale || undefined,
44
+ timeFormatOption,
45
+ );
42
46
 
43
47
  return formatters[key];
44
48
  },
@@ -52,21 +56,19 @@ export const
52
56
  }
53
57
  return renderValue(value, getFormatter(locale));
54
58
  },
55
-
56
59
  toXlsxValue = (column, item) => {
57
60
  if (!column.valuePath) {
58
61
  return '';
59
62
  }
60
63
  return getString(column, item);
61
64
  },
62
- toInputString = value => {
65
+ toInputString = (value) => {
63
66
  const date = toDate(value);
64
67
  if (date == null) {
65
68
  return null;
66
69
  }
67
70
  return toLocalISOString(date).slice(11, 19);
68
71
  },
69
-
70
72
  getComparableValue = ({ valuePath }, item) => {
71
73
  if (item == null) {
72
74
  return;
@@ -81,22 +83,19 @@ export const
81
83
  }
82
84
  return toNumber(value.getTime());
83
85
  },
84
-
85
- applySingleFilter = (column, filter) => item => {
86
+ applySingleFilter = (column, filter) => (item) => {
86
87
  const value = getComparableValue(column, item);
87
88
 
88
89
  if (value == null) {
89
90
  return false;
90
91
  }
91
92
 
92
- const
93
- min = getComparableValue({ ...column, valuePath: 'min' }, filter),
93
+ const min = getComparableValue({ ...column, valuePath: 'min' }, filter),
94
94
  max = getComparableValue({ ...column, valuePath: 'max' }, filter);
95
95
 
96
96
  return !(value < min || value > max);
97
97
  },
98
-
99
- toHashString = value => {
98
+ toHashString = (value) => {
100
99
  const date = toDate(value);
101
100
  if (date == null) {
102
101
  return '';
@@ -104,12 +103,10 @@ export const
104
103
  //Use utc in hash
105
104
  return date.toISOString().slice(11, 19).replace(/:/gu, '.');
106
105
  },
107
-
108
- fromHashString = value => {
106
+ fromHashString = (value) => {
109
107
  if (value == null || value === '') {
110
108
  return;
111
109
  }
112
110
  //Parse utc from hash string
113
111
  return toDate(value.replace(/\./gu, ':') + 'Z');
114
112
  };
115
-
package/lib/utils.js CHANGED
@@ -14,4 +14,4 @@ export const findLastIndex = (array, predicate) => {
14
14
  }
15
15
 
16
16
  return -1;
17
- };
17
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-omnitable",
3
- "version": "14.12.1",
3
+ "version": "14.12.2",
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"
@@ -30,6 +30,10 @@
30
30
  "start": "wds",
31
31
  "test": "wtr --coverage",
32
32
  "test:watch": "wtr --watch",
33
+ "storybook:start": "storybook dev -p 8000",
34
+ "storybook:build": "storybook build",
35
+ "storybook:deploy": "storybook-to-ghpages",
36
+ "storybook:preview": "npm run storybook:build && web-dev-server --root-dir ./storybook-static/ --open",
33
37
  "prepare": "husky"
34
38
  },
35
39
  "release": {
@@ -92,8 +96,10 @@
92
96
  "@polymer/paper-toggle-button": "^3.0.0",
93
97
  "@semantic-release/changelog": "^6.0.0",
94
98
  "@semantic-release/git": "^10.0.0",
99
+ "@storybook/web-components-vite": "^9.1.3",
95
100
  "husky": "^9.0.0",
96
101
  "semantic-release": "^24.0.0",
97
- "sinon": "^20.0.0"
102
+ "sinon": "^20.0.0",
103
+ "storybook": "^9.1.3"
98
104
  }
99
105
  }