@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.
- package/dist/cosmoz-omnitable-column-amount.js +29 -27
- package/dist/cosmoz-omnitable-column-autocomplete.d.ts +1 -1
- package/dist/cosmoz-omnitable-column-autocomplete.d.ts.map +1 -1
- package/dist/cosmoz-omnitable-column-autocomplete.js +28 -24
- package/dist/cosmoz-omnitable-column-boolean.d.ts +4 -1
- package/dist/cosmoz-omnitable-column-boolean.d.ts.map +1 -1
- package/dist/cosmoz-omnitable-column-boolean.js +25 -17
- package/dist/cosmoz-omnitable-column-date.js +28 -26
- package/dist/cosmoz-omnitable-column-datetime.js +28 -26
- package/dist/cosmoz-omnitable-column-list-data.js +8 -6
- package/dist/cosmoz-omnitable-column-list-horizontal.js +17 -15
- package/dist/cosmoz-omnitable-column-list-mixin.d.ts +6 -6
- package/dist/cosmoz-omnitable-column-list-mixin.d.ts.map +1 -1
- package/dist/cosmoz-omnitable-column-list-mixin.js +28 -15
- package/dist/cosmoz-omnitable-column-list.js +21 -19
- package/dist/cosmoz-omnitable-column-mixin.js +12 -8
- package/dist/cosmoz-omnitable-column-number.js +29 -27
- package/dist/cosmoz-omnitable-column-time.js +26 -24
- package/dist/cosmoz-omnitable-column.js +13 -11
- package/dist/cosmoz-omnitable-columns.js +11 -9
- package/dist/cosmoz-omnitable-group-row.js +6 -4
- package/dist/cosmoz-omnitable-header-row.js +17 -15
- package/dist/cosmoz-omnitable-item-expand-line.js +7 -5
- package/dist/cosmoz-omnitable-item-expand.js +8 -6
- package/dist/cosmoz-omnitable-item-row.js +7 -5
- package/dist/cosmoz-omnitable-skeleton.js +8 -6
- package/dist/cosmoz-omnitable-styles.js +7 -4
- package/dist/cosmoz-omnitable.d.ts +1 -1
- package/dist/cosmoz-omnitable.d.ts.map +1 -1
- package/dist/cosmoz-omnitable.js +37 -31
- package/dist/grouped-list/cosmoz-grouped-list-row.js +4 -2
- package/dist/grouped-list/cosmoz-grouped-list.js +6 -4
- package/dist/grouped-list/index.js +3 -1
- package/dist/grouped-list/use-collapsible-items.d.ts +4 -4
- package/dist/grouped-list/use-collapsible-items.js +12 -8
- package/dist/grouped-list/use-cosmoz-grouped-list.d.ts +1 -1
- package/dist/grouped-list/use-cosmoz-grouped-list.js +23 -19
- package/dist/grouped-list/use-selected-items.d.ts +10 -10
- package/dist/grouped-list/use-selected-items.js +19 -15
- package/dist/grouped-list/use-weak-state.d.ts +3 -3
- package/dist/grouped-list/use-weak-state.js +10 -6
- package/dist/grouped-list/utils.js +11 -1
- package/dist/lib/compute-layout.js +10 -6
- package/dist/lib/cosmoz-omnitable-amount-range-input.js +16 -14
- package/dist/lib/cosmoz-omnitable-date-input-mixin.js +9 -5
- package/dist/lib/cosmoz-omnitable-date-range-input.js +14 -12
- package/dist/lib/cosmoz-omnitable-datetime-range-input.js +15 -13
- package/dist/lib/cosmoz-omnitable-number-range-input.js +14 -12
- package/dist/lib/cosmoz-omnitable-range-input-mixin.js +12 -8
- package/dist/lib/cosmoz-omnitable-resize-nub.js +7 -5
- package/dist/lib/cosmoz-omnitable-time-range-input.js +14 -12
- package/dist/lib/generic-sorter.js +5 -1
- package/dist/lib/icons.d.ts +4 -4
- package/dist/lib/icons.d.ts.map +1 -1
- package/dist/lib/icons.js +8 -5
- package/dist/lib/layout.js +5 -2
- package/dist/lib/polymer-haunted-render-mixin.js +10 -6
- package/dist/lib/render-footer.d.ts +1 -1
- package/dist/lib/render-footer.d.ts.map +1 -1
- package/dist/lib/render-footer.js +16 -12
- package/dist/lib/render-header.d.ts +1 -1
- package/dist/lib/render-header.d.ts.map +1 -1
- package/dist/lib/render-header.js +9 -5
- package/dist/lib/render-list.d.ts +1 -1
- package/dist/lib/render-list.d.ts.map +1 -1
- package/dist/lib/render-list.js +18 -14
- package/dist/lib/save-as-csv-action.js +7 -3
- package/dist/lib/save-as-xlsx-action.js +9 -5
- package/dist/lib/settings/cosmoz-omnitable-settings.js +71 -33
- package/dist/lib/settings/cosmoz-omnitable-sort-group.d.ts +3 -3
- package/dist/lib/settings/cosmoz-omnitable-sort-group.d.ts.map +1 -1
- package/dist/lib/settings/cosmoz-omnitable-sort-group.js +19 -12
- package/dist/lib/settings/drivers/context.d.ts +2 -10
- package/dist/lib/settings/drivers/context.d.ts.map +1 -1
- package/dist/lib/settings/drivers/context.js +13 -6
- package/dist/lib/settings/drivers/index.js +25 -3
- package/dist/lib/settings/drivers/local.js +3 -1
- package/dist/lib/settings/drivers/remote.js +3 -1
- package/dist/lib/settings/index.js +9 -2
- package/dist/lib/settings/normalize.js +15 -10
- package/dist/lib/settings/style.css.js +8 -5
- package/dist/lib/settings/use-saved-settings.d.ts +2 -2
- package/dist/lib/settings/use-saved-settings.js +11 -9
- package/dist/lib/settings/use-settings-ui.js +14 -12
- package/dist/lib/settings/use-settings.d.ts +6 -12
- package/dist/lib/settings/use-settings.d.ts.map +1 -1
- package/dist/lib/settings/use-settings.js +46 -8
- package/dist/lib/types.d.ts +23 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +3 -0
- package/dist/lib/use-canvas-width.js +9 -5
- package/dist/lib/use-dom-columns.d.ts +1 -1
- package/dist/lib/use-dom-columns.d.ts.map +1 -1
- package/dist/lib/use-dom-columns.js +11 -7
- package/dist/lib/use-fast-layout.d.ts +1 -1
- package/dist/lib/use-fast-layout.js +22 -18
- package/dist/lib/use-footer.js +5 -1
- package/dist/lib/use-hash-state.js +15 -11
- package/dist/lib/use-header.js +9 -5
- package/dist/lib/use-layout.js +8 -4
- package/dist/lib/use-list.d.ts +2 -10
- package/dist/lib/use-list.d.ts.map +1 -1
- package/dist/lib/use-list.js +25 -21
- package/dist/lib/use-mini.d.ts +1 -1
- package/dist/lib/use-mini.js +9 -5
- package/dist/lib/use-omnitable.d.ts +2 -10
- package/dist/lib/use-omnitable.d.ts.map +1 -1
- package/dist/lib/use-omnitable.js +22 -18
- package/dist/lib/use-processed-items.d.ts +3 -5
- package/dist/lib/use-processed-items.d.ts.map +1 -1
- package/dist/lib/use-processed-items.js +27 -23
- package/dist/lib/use-public-interface.js +20 -16
- package/dist/lib/use-resizable-columns.js +8 -4
- package/dist/lib/use-sort-and-group-options.d.ts +2 -25
- package/dist/lib/use-sort-and-group-options.d.ts.map +1 -1
- package/dist/lib/use-sort-and-group-options.js +16 -12
- package/dist/lib/use-track-size.d.ts +1 -1
- package/dist/lib/use-track-size.d.ts.map +1 -1
- package/dist/lib/use-track-size.js +6 -2
- package/dist/lib/use-tween-array.d.ts +1 -1
- package/dist/lib/use-tween-array.d.ts.map +1 -1
- package/dist/lib/use-tween-array.js +14 -10
- package/dist/lib/utils-amount.d.ts +1 -1
- package/dist/lib/utils-amount.d.ts.map +1 -1
- package/dist/lib/utils-amount.js +25 -29
- package/dist/lib/utils-data.js +12 -8
- package/dist/lib/utils-date.d.ts +15 -24
- package/dist/lib/utils-date.d.ts.map +1 -1
- package/dist/lib/utils-date.js +82 -66
- package/dist/lib/utils-datetime.d.ts +9 -15
- package/dist/lib/utils-datetime.d.ts.map +1 -1
- package/dist/lib/utils-datetime.js +42 -21
- package/dist/lib/utils-number.d.ts +11 -18
- package/dist/lib/utils-number.d.ts.map +1 -1
- package/dist/lib/utils-number.js +44 -36
- package/dist/lib/utils-time.d.ts +12 -16
- package/dist/lib/utils-time.d.ts.map +1 -1
- package/dist/lib/utils-time.js +61 -42
- package/dist/lib/utils.js +6 -2
- package/dist/ui-helpers/cosmoz-clear-button.js +7 -5
- package/package.json +1 -1
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}, item:
|
|
11
|
-
export const
|
|
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.
|
|
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"}
|
package/dist/lib/utils-number.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
}
|
|
27
|
-
|
|
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
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
}
|
|
43
|
+
};
|
|
44
|
+
exports.toHashString = toHashString;
|
|
45
|
+
const getComparableValue = ({ valuePath, maximumFractionDigits }, item) => {
|
|
42
46
|
if (item == null) {
|
|
43
47
|
return;
|
|
44
48
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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(
|
|
55
|
+
return (0, exports.toNumber)(numValue.toFixed(maximumFractionDigits));
|
|
55
56
|
}
|
|
56
|
-
return
|
|
57
|
-
}
|
|
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
|
-
})
|
|
69
|
-
|
|
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
|
-
}
|
|
80
|
-
|
|
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 =
|
|
85
|
-
|
|
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
|
package/dist/lib/utils-time.d.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export const
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
|
|
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.
|
|
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"}
|
package/dist/lib/utils-time.js
CHANGED
|
@@ -1,88 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
22
|
-
}
|
|
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
|
-
}
|
|
35
|
-
|
|
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
|
-
}
|
|
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
|
-
}
|
|
49
|
-
|
|
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
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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
|
-
|
|
63
|
-
if (
|
|
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(
|
|
67
|
-
}
|
|
68
|
-
|
|
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
|
-
}
|
|
75
|
-
|
|
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
|
-
}
|
|
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
|
|
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
|
-
|
|
3
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
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.
|
|
3
|
+
"version": "14.19.0",
|
|
4
4
|
"description": "[](https://travis-ci.org/Neovici/cosmoz-omnitable)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components"
|