@ev-core/aurelia-v1-resources 0.6.5 → 2.0.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/commonjs/converters/datetime-config.d.ts +1 -13
- package/dist/commonjs/converters/datetime-config.js +6 -41
- package/dist/commonjs/converters/datetime-config.js.map +1 -1
- package/dist/commonjs/converters/datetime-duration.d.ts +6 -14
- package/dist/commonjs/converters/datetime-duration.js +3 -54
- package/dist/commonjs/converters/datetime-duration.js.map +1 -1
- package/dist/commonjs/converters/datetime.d.ts +4 -4
- package/dist/commonjs/converters/datetime.js +3 -26
- package/dist/commonjs/converters/datetime.js.map +1 -1
- package/dist/commonjs/converters/filter.d.ts +2 -2
- package/dist/commonjs/converters/filter.js +10 -94
- package/dist/commonjs/converters/filter.js.map +1 -1
- package/dist/commonjs/converters/numberformat.d.ts +3 -3
- package/dist/commonjs/converters/numberformat.js +3 -10
- package/dist/commonjs/converters/numberformat.js.map +1 -1
- package/dist/commonjs/converters/numeral.d.ts +1 -2
- package/dist/commonjs/converters/numeral.js +2 -43
- package/dist/commonjs/converters/numeral.js.map +1 -1
- package/dist/commonjs/converters/sort.d.ts +3 -3
- package/dist/commonjs/converters/sort.js +2 -62
- package/dist/commonjs/converters/sort.js.map +1 -1
- package/dist/commonjs/converters/sum.d.ts +1 -1
- package/dist/commonjs/converters/sum.js +7 -19
- package/dist/commonjs/converters/sum.js.map +1 -1
- package/dist/commonjs/converters/take.d.ts +2 -2
- package/dist/commonjs/converters/take.js +2 -16
- package/dist/commonjs/converters/take.js.map +1 -1
- package/dist/commonjs/interfaces.d.ts +1 -28
- package/dist/commonjs/utils/geolocator.d.ts +1 -8
- package/dist/commonjs/utils/geolocator.js +2 -26
- package/dist/commonjs/utils/geolocator.js.map +1 -1
- package/dist/commonjs/utils/media-device.d.ts +1 -5
- package/dist/commonjs/utils/media-device.js +2 -27
- package/dist/commonjs/utils/media-device.js.map +1 -1
- package/dist/commonjs/utils/notificator.d.ts +1 -5
- package/dist/commonjs/utils/notificator.js +2 -35
- package/dist/commonjs/utils/notificator.js.map +1 -1
- package/dist/commonjs/utils/speech-generator.d.ts +1 -19
- package/dist/commonjs/utils/speech-generator.js +2 -35
- package/dist/commonjs/utils/speech-generator.js.map +1 -1
- package/dist/commonjs/utils/timeout-intervaller.d.ts +1 -28
- package/dist/commonjs/utils/timeout-intervaller.js +6 -131
- package/dist/commonjs/utils/timeout-intervaller.js.map +1 -1
- package/dist/native-modules/converters/datetime-config.d.ts +1 -13
- package/dist/native-modules/converters/datetime-config.js +1 -37
- package/dist/native-modules/converters/datetime-config.js.map +1 -1
- package/dist/native-modules/converters/datetime-duration.d.ts +6 -14
- package/dist/native-modules/converters/datetime-duration.js +3 -54
- package/dist/native-modules/converters/datetime-duration.js.map +1 -1
- package/dist/native-modules/converters/datetime.d.ts +4 -4
- package/dist/native-modules/converters/datetime.js +3 -26
- package/dist/native-modules/converters/datetime.js.map +1 -1
- package/dist/native-modules/converters/filter.d.ts +2 -2
- package/dist/native-modules/converters/filter.js +10 -94
- package/dist/native-modules/converters/filter.js.map +1 -1
- package/dist/native-modules/converters/numberformat.d.ts +3 -3
- package/dist/native-modules/converters/numberformat.js +3 -10
- package/dist/native-modules/converters/numberformat.js.map +1 -1
- package/dist/native-modules/converters/numeral.d.ts +1 -2
- package/dist/native-modules/converters/numeral.js +2 -43
- package/dist/native-modules/converters/numeral.js.map +1 -1
- package/dist/native-modules/converters/sort.d.ts +3 -3
- package/dist/native-modules/converters/sort.js +2 -62
- package/dist/native-modules/converters/sort.js.map +1 -1
- package/dist/native-modules/converters/sum.d.ts +1 -1
- package/dist/native-modules/converters/sum.js +7 -19
- package/dist/native-modules/converters/sum.js.map +1 -1
- package/dist/native-modules/converters/take.d.ts +2 -2
- package/dist/native-modules/converters/take.js +2 -16
- package/dist/native-modules/converters/take.js.map +1 -1
- package/dist/native-modules/interfaces.d.ts +1 -28
- package/dist/native-modules/utils/geolocator.d.ts +1 -8
- package/dist/native-modules/utils/geolocator.js +1 -26
- package/dist/native-modules/utils/geolocator.js.map +1 -1
- package/dist/native-modules/utils/media-device.d.ts +1 -5
- package/dist/native-modules/utils/media-device.js +1 -27
- package/dist/native-modules/utils/media-device.js.map +1 -1
- package/dist/native-modules/utils/notificator.d.ts +1 -5
- package/dist/native-modules/utils/notificator.js +1 -35
- package/dist/native-modules/utils/notificator.js.map +1 -1
- package/dist/native-modules/utils/speech-generator.d.ts +1 -19
- package/dist/native-modules/utils/speech-generator.js +1 -35
- package/dist/native-modules/utils/speech-generator.js.map +1 -1
- package/dist/native-modules/utils/timeout-intervaller.d.ts +1 -28
- package/dist/native-modules/utils/timeout-intervaller.js +1 -131
- package/dist/native-modules/utils/timeout-intervaller.js.map +1 -1
- package/package.json +9 -8
|
@@ -1,65 +1,14 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { valueConverter } from 'aurelia-framework';
|
|
3
|
-
import
|
|
4
|
-
function loadLocale(locale) {
|
|
5
|
-
switch (locale) {
|
|
6
|
-
case 'en':
|
|
7
|
-
return require('javascript-time-ago/locale/en');
|
|
8
|
-
case 'nb':
|
|
9
|
-
return require('javascript-time-ago/locale/nb');
|
|
10
|
-
case 'sv':
|
|
11
|
-
return require('javascript-time-ago/locale/sv');
|
|
12
|
-
default:
|
|
13
|
-
throw new Error("Locale ".concat(locale, " is not supported."));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
var en = loadLocale('en');
|
|
17
|
-
var nb = loadLocale('nb');
|
|
18
|
-
var sv = loadLocale('sv');
|
|
19
|
-
var localesModules = [en, nb, sv];
|
|
20
|
-
TimeAgo.addDefaultLocale(localesModules[0]);
|
|
21
|
-
localesModules.forEach(function (l) { return TimeAgo.addLocale(l); });
|
|
3
|
+
import { convertDuration, configureDuration } from '@ev-core/au-core-resources';
|
|
22
4
|
var DurationValueConverter = (function () {
|
|
23
5
|
function DurationValueConverter() {
|
|
24
6
|
this.toView = DurationValueConverter_1.convert;
|
|
25
7
|
}
|
|
26
8
|
DurationValueConverter_1 = DurationValueConverter;
|
|
27
|
-
DurationValueConverter.configure = function (cfg) {
|
|
28
|
-
var _a;
|
|
29
|
-
var opts = {};
|
|
30
|
-
if (cfg) {
|
|
31
|
-
cfg(opts);
|
|
32
|
-
}
|
|
33
|
-
DurationValueConverter_1.defaultLocale = (_a = opts === null || opts === void 0 ? void 0 : opts.locale) !== null && _a !== void 0 ? _a : 'en';
|
|
34
|
-
DurationValueConverter_1.opts = opts;
|
|
35
|
-
DurationValueConverter_1.ctrs = {};
|
|
36
|
-
localesModules.forEach(function (l) {
|
|
37
|
-
var locale = l.locale;
|
|
38
|
-
DurationValueConverter_1.ctrs[locale] = new TimeAgo(locale);
|
|
39
|
-
});
|
|
40
|
-
this.isConfigured = true;
|
|
41
|
-
};
|
|
42
|
-
;
|
|
43
|
-
DurationValueConverter.convert = function (date, opts) {
|
|
44
|
-
var _a;
|
|
45
|
-
DurationValueConverter_1.verifyConfig(opts);
|
|
46
|
-
try {
|
|
47
|
-
var parsedDate = typeof date === 'string' ? new Date(date) : date;
|
|
48
|
-
var ctr = DurationValueConverter_1.ctrs[(_a = opts === null || opts === void 0 ? void 0 : opts.locale) !== null && _a !== void 0 ? _a : DurationValueConverter_1.defaultLocale];
|
|
49
|
-
return ctr.format(parsedDate, opts);
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
console.error(error);
|
|
53
|
-
return 'error';
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
DurationValueConverter.verifyConfig = function (opts) {
|
|
57
|
-
if (!this.isConfigured) {
|
|
58
|
-
this.configure();
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
9
|
var DurationValueConverter_1;
|
|
62
|
-
DurationValueConverter.
|
|
10
|
+
DurationValueConverter.configure = configureDuration;
|
|
11
|
+
DurationValueConverter.convert = convertDuration;
|
|
63
12
|
DurationValueConverter = DurationValueConverter_1 = __decorate([
|
|
64
13
|
valueConverter('duration')
|
|
65
14
|
], DurationValueConverter);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/datetime-duration.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["converters/datetime-duration.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAiD,MAAM,4BAA4B,CAAC;AAK/H;IAAA;QACS,WAAM,GAAG,wBAAsB,CAAC,OAAO,CAAC;IAKjD,CAAC;+BANY,sBAAsB;;IAGnB,gCAAS,GAAG,iBAAH,AAAoB,CAAC;IAE9B,8BAAO,GAAG,eAAH,AAAkB,CAAC;IAL7B,sBAAsB;QADlC,cAAc,CAAC,UAAU,CAAC;OACd,sBAAsB,CAMlC;IAAD,6BAAC;CAND,AAMC,IAAA;SANY,sBAAsB","file":"datetime-duration.js","sourceRoot":"../../../src/"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { convertDatetime, configureDatetime } from '@ev-core/au-core-resources';
|
|
2
2
|
export declare class DatetimeValueConverter {
|
|
3
|
-
toView: typeof
|
|
4
|
-
static configure: typeof
|
|
5
|
-
static convert
|
|
3
|
+
toView: typeof convertDatetime;
|
|
4
|
+
static configure: typeof configureDatetime;
|
|
5
|
+
static convert: typeof convertDatetime;
|
|
6
6
|
}
|
|
@@ -1,37 +1,14 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { valueConverter } from 'aurelia-framework';
|
|
3
|
-
import {
|
|
3
|
+
import { convertDatetime, configureDatetime } from '@ev-core/au-core-resources';
|
|
4
4
|
var DatetimeValueConverter = (function () {
|
|
5
5
|
function DatetimeValueConverter() {
|
|
6
6
|
this.toView = DatetimeValueConverter_1.convert;
|
|
7
7
|
}
|
|
8
8
|
DatetimeValueConverter_1 = DatetimeValueConverter;
|
|
9
|
-
DatetimeValueConverter.convert = function (date, options) {
|
|
10
|
-
var _a;
|
|
11
|
-
options = buildOptions(options);
|
|
12
|
-
var dtOptions = getDateTimeOptions(options);
|
|
13
|
-
var dt = getDate(date, dtOptions);
|
|
14
|
-
var type = (_a = options === null || options === void 0 ? void 0 : options.type) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
15
|
-
if (!type || type == 'toformat') {
|
|
16
|
-
return dt.toFormat(options.format);
|
|
17
|
-
}
|
|
18
|
-
if (type == 'torelative') {
|
|
19
|
-
var base = undefined;
|
|
20
|
-
if (options.relativeBase) {
|
|
21
|
-
base = getDate(options.relativeBase, dtOptions);
|
|
22
|
-
}
|
|
23
|
-
return dt.toRelative({ base: base, round: false });
|
|
24
|
-
}
|
|
25
|
-
if (type == 'torelativecalendar') {
|
|
26
|
-
var base = undefined;
|
|
27
|
-
if (options.relativeBase) {
|
|
28
|
-
base = getDate(options.relativeBase, dtOptions);
|
|
29
|
-
}
|
|
30
|
-
return dt.toRelativeCalendar({ base: base });
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
9
|
var DatetimeValueConverter_1;
|
|
34
|
-
DatetimeValueConverter.configure =
|
|
10
|
+
DatetimeValueConverter.configure = configureDatetime;
|
|
11
|
+
DatetimeValueConverter.convert = convertDatetime;
|
|
35
12
|
DatetimeValueConverter = DatetimeValueConverter_1 = __decorate([
|
|
36
13
|
valueConverter('datetime')
|
|
37
14
|
], DatetimeValueConverter);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/datetime.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"sources":["converters/datetime.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGhF;IAAA;QACE,WAAM,GAAG,wBAAsB,CAAC,OAAO,CAAC;IAK1C,CAAC;+BANY,sBAAsB;;IAGnB,gCAAS,GAAG,iBAAH,AAAoB,CAAC;IAE9B,8BAAO,GAAG,eAAH,AAAkB,CAAC;IAL7B,sBAAsB;QADlC,cAAc,CAAC,UAAU,CAAC;OACd,sBAAsB,CAMlC;IAAD,6BAAC;CAND,AAMC,IAAA;SANY,sBAAsB","file":"datetime.js","sourceRoot":"../../../src/"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Parser } from 'aurelia-framework';
|
|
2
|
-
import { IFilterOptions } from '
|
|
2
|
+
import { type IFilterOptions } from '@ev-core/au-core-resources';
|
|
3
3
|
export declare class FilterValueConverter {
|
|
4
4
|
private readonly parser;
|
|
5
5
|
constructor(parser: Parser);
|
|
6
|
-
toView(arr: any, opts: IFilterOptions):
|
|
6
|
+
toView(arr: any, opts: IFilterOptions): unknown;
|
|
7
7
|
}
|
|
@@ -1,96 +1,21 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { inject, Parser, valueConverter } from 'aurelia-framework';
|
|
3
|
-
|
|
4
|
-
return d instanceof Date ? d.getTime() : new Date(d).getTime();
|
|
5
|
-
};
|
|
6
|
-
var FILTER_MODES = {
|
|
7
|
-
'exact': { fn: function (a, b) { return a === b; }, stringify: true },
|
|
8
|
-
'startsWith': { fn: function (a, b) { return a.startsWith(b); }, stringify: true },
|
|
9
|
-
'endsWith': { fn: function (a, b) { return a.endsWith(b); }, stringify: true },
|
|
10
|
-
'contains': { fn: function (a, b) { return a.indexOf(b) >= 0; }, stringify: true },
|
|
11
|
-
'>=': { fn: function (a, b) { return a >= b; }, stringify: false },
|
|
12
|
-
'>': { fn: function (a, b) { return a > b; }, stringify: false },
|
|
13
|
-
'<=': { fn: function (a, b) { return a <= b; }, stringify: false },
|
|
14
|
-
'<': { fn: function (a, b) { return a < b; }, stringify: false },
|
|
15
|
-
'==': { fn: function (a, b) { return a == b; }, stringify: false },
|
|
16
|
-
'===': { fn: function (a, b) { return a == b; }, stringify: false },
|
|
17
|
-
'!=': { fn: function (a, b) { return a != b; }, stringify: false },
|
|
18
|
-
'Array.some': {
|
|
19
|
-
fn: function (a, b) { return (a || []).some(function (x) { return b.includes(x); }); },
|
|
20
|
-
stringify: false,
|
|
21
|
-
isArray: true
|
|
22
|
-
},
|
|
23
|
-
'!Array.some': {
|
|
24
|
-
fn: function (a, b) { return !(a || []).some(function (x) { return b.includes(x); }); },
|
|
25
|
-
stringify: false,
|
|
26
|
-
isArray: true
|
|
27
|
-
},
|
|
28
|
-
'Array.includes': {
|
|
29
|
-
fn: function (a, b) { return (a || []).includes(b); },
|
|
30
|
-
stringify: false,
|
|
31
|
-
isArray: true
|
|
32
|
-
},
|
|
33
|
-
'!Array.includes': {
|
|
34
|
-
fn: function (a, b) { return !(a || []).includes(b); },
|
|
35
|
-
stringify: false,
|
|
36
|
-
isArray: true
|
|
37
|
-
},
|
|
38
|
-
'Date.>=': {
|
|
39
|
-
fn: function (a, b) {
|
|
40
|
-
var t1 = toMillis(a);
|
|
41
|
-
var t2 = toMillis(b);
|
|
42
|
-
return t1 >= t2;
|
|
43
|
-
},
|
|
44
|
-
stringify: false
|
|
45
|
-
},
|
|
46
|
-
'Date.<': {
|
|
47
|
-
fn: function (a, b) {
|
|
48
|
-
var t1 = toMillis(a);
|
|
49
|
-
var t2 = toMillis(b);
|
|
50
|
-
return t1 < t2;
|
|
51
|
-
},
|
|
52
|
-
stringify: false
|
|
53
|
-
}
|
|
54
|
-
};
|
|
3
|
+
import { filterArray } from '@ev-core/au-core-resources';
|
|
55
4
|
var FilterValueConverter = (function () {
|
|
56
5
|
function FilterValueConverter(parser) {
|
|
57
6
|
this.parser = parser;
|
|
58
7
|
}
|
|
59
8
|
FilterValueConverter.prototype.toView = function (arr, opts) {
|
|
60
9
|
var _this = this;
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var properties = (Array.isArray(opts.props) ? opts.props : [opts.props]);
|
|
71
|
-
var filteredArr;
|
|
72
|
-
var FILTERMODE = FILTER_MODES[mode];
|
|
73
|
-
if (FILTERMODE.isArray) {
|
|
74
|
-
filteredArr = arr.filter(function (entry) {
|
|
75
|
-
return properties.some(function (p) { return FILTERMODE.fn(queries, entry[p]); });
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
var stringify_1 = FILTERMODE.stringify;
|
|
80
|
-
var settingsFn_1 = function (term) { return stringify_1 ? String(term).toLowerCase() : term; };
|
|
81
|
-
var propExpressions_1 = (Array.isArray(opts.props) ? opts.props : [opts.props]).map(function (p) { return _this.parser.parse(p); }), terms_1 = queries.map(function (query) { return stringify_1 ? String(query).toLowerCase() : query; });
|
|
82
|
-
filteredArr = arr.filter(function (entry) {
|
|
83
|
-
return propExpressions_1.some(function (propExp) {
|
|
84
|
-
var evaluated = propExp.evaluate({ bindingContext: entry, overrideContext: null });
|
|
85
|
-
return terms_1.some(function (t) {
|
|
86
|
-
return FILTERMODE.fn(settingsFn_1(evaluated), t);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return opts.take && typeof opts.take === 'number' ?
|
|
92
|
-
filteredArr.slice(0, opts.take) :
|
|
93
|
-
filteredArr;
|
|
10
|
+
var properties = (Array.isArray(opts === null || opts === void 0 ? void 0 : opts.props) ? opts.props : [opts === null || opts === void 0 ? void 0 : opts.props]).filter(Boolean);
|
|
11
|
+
var expressions = new Map(properties.map(function (p) { return [p, _this.parser.parse(p)]; }));
|
|
12
|
+
return filterArray(arr, opts, function (entry, prop) {
|
|
13
|
+
var propExp = expressions.get(prop);
|
|
14
|
+
if (!propExp) {
|
|
15
|
+
return entry[prop];
|
|
16
|
+
}
|
|
17
|
+
return propExp.evaluate({ bindingContext: entry, overrideContext: null });
|
|
18
|
+
});
|
|
94
19
|
};
|
|
95
20
|
FilterValueConverter = __decorate([
|
|
96
21
|
valueConverter('filter'),
|
|
@@ -100,14 +25,5 @@ var FilterValueConverter = (function () {
|
|
|
100
25
|
return FilterValueConverter;
|
|
101
26
|
}());
|
|
102
27
|
export { FilterValueConverter };
|
|
103
|
-
function validate(arr, opts) {
|
|
104
|
-
var minLength = opts.minLength || 0;
|
|
105
|
-
var isInvalid = (opts === null || opts === void 0 ? void 0 : opts.disabled) ||
|
|
106
|
-
!Array.isArray(arr) ||
|
|
107
|
-
!(opts === null || opts === void 0 ? void 0 : opts.q) ||
|
|
108
|
-
((opts.q || '').length < minLength);
|
|
109
|
-
return !isInvalid;
|
|
110
|
-
}
|
|
111
|
-
;
|
|
112
28
|
|
|
113
29
|
//# sourceMappingURL=filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/filter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAmB,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"sources":["converters/filter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAmB,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,WAAW,EAAuB,MAAM,4BAA4B,CAAC;AAI9E;IACI,8BACqB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAC/B,CAAC;IAEL,qCAAM,GAAN,UAAO,GAAQ,EAAE,IAAoB;QAArC,iBAWC;QAVG,IAAM,UAAU,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7F,IAAM,WAAW,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,EAAE,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAzB,CAAyB,CAAC,CAAC,CAAC;QAE5E,OAAO,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,UAAC,KAAK,EAAE,IAAI;YACtC,IAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACtC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACX,OAAQ,KAAiC,CAAC,IAAI,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,OAAO,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe,EAAE,IAAkC,EAAE,CAAC,CAAC;QAC5G,CAAC,CAAC,CAAC;IACP,CAAC;IAhBQ,oBAAoB;QAFhC,cAAc,CAAC,QAAQ,CAAC;QACxB,MAAM,CAAC,MAAM,CAAC;yCAGkB,MAAM;OAF1B,oBAAoB,CAiBhC;IAAD,2BAAC;CAnBD,AAmBC,IAAA;SAjBY,oBAAoB","file":"filter.js","sourceRoot":"../../../src/"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { INumberFormatOptions } from '
|
|
1
|
+
import { convertNumberFormat, type INumberFormatOptions } from '@ev-core/au-core-resources';
|
|
2
2
|
export declare class NumberFormatValueConverter {
|
|
3
|
-
toView: typeof
|
|
3
|
+
toView: typeof convertNumberFormat;
|
|
4
4
|
static readonly config: INumberFormatOptions;
|
|
5
5
|
static setConfig(cb: (config: INumberFormatOptions) => void): void;
|
|
6
|
-
static convert
|
|
6
|
+
static convert: typeof convertNumberFormat;
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { valueConverter } from 'aurelia-framework';
|
|
3
|
+
import { convertNumberFormat, numberFormatConfig } from '@ev-core/au-core-resources';
|
|
3
4
|
var NumberFormatValueConverter = (function () {
|
|
4
5
|
function NumberFormatValueConverter() {
|
|
5
6
|
this.toView = NumberFormatValueConverter_1.convert;
|
|
@@ -8,17 +9,9 @@ var NumberFormatValueConverter = (function () {
|
|
|
8
9
|
NumberFormatValueConverter.setConfig = function (cb) {
|
|
9
10
|
cb(this.config);
|
|
10
11
|
};
|
|
11
|
-
NumberFormatValueConverter.convert = function (value, opts) {
|
|
12
|
-
var options = Object.assign({}, NumberFormatValueConverter_1.config, opts !== null && opts !== void 0 ? opts : {});
|
|
13
|
-
var parts = (value || 0).toString().split(".");
|
|
14
|
-
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, options.delimiter);
|
|
15
|
-
return parts.join(",");
|
|
16
|
-
};
|
|
17
12
|
var NumberFormatValueConverter_1;
|
|
18
|
-
NumberFormatValueConverter.config =
|
|
19
|
-
|
|
20
|
-
delimiter: ' '
|
|
21
|
-
};
|
|
13
|
+
NumberFormatValueConverter.config = numberFormatConfig;
|
|
14
|
+
NumberFormatValueConverter.convert = convertNumberFormat;
|
|
22
15
|
NumberFormatValueConverter = NumberFormatValueConverter_1 = __decorate([
|
|
23
16
|
valueConverter('numberformat')
|
|
24
17
|
], NumberFormatValueConverter);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/numberformat.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"sources":["converters/numberformat.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAA6B,MAAM,4BAA4B,CAAC;AAGhH;IAAA;QACE,WAAM,GAAG,4BAA0B,CAAC,OAAO,CAAC;IAS9C,CAAC;mCAVY,0BAA0B;IAKvB,oCAAS,GAAvB,UAAwB,EAA0C;QAChE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;;IAJsB,iCAAM,GAAyB,kBAAzB,AAA2C,CAAC;IAM3D,kCAAO,GAAG,mBAAH,AAAsB,CAAC;IATjC,0BAA0B;QADtC,cAAc,CAAC,cAAc,CAAC;OAClB,0BAA0B,CAUtC;IAAD,iCAAC;CAVD,AAUC,IAAA;SAVY,0BAA0B","file":"numberformat.js","sourceRoot":"../../../src/"}
|
|
@@ -1,53 +1,12 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { valueConverter } from 'aurelia-framework';
|
|
3
|
-
import
|
|
4
|
-
numeral.register('locale', 'nb', {
|
|
5
|
-
delimiters: {
|
|
6
|
-
thousands: ' ',
|
|
7
|
-
decimal: ','
|
|
8
|
-
},
|
|
9
|
-
abbreviations: {
|
|
10
|
-
thousand: 'k',
|
|
11
|
-
million: 'm',
|
|
12
|
-
billion: 'b',
|
|
13
|
-
trillion: 't'
|
|
14
|
-
},
|
|
15
|
-
ordinal: function (number) {
|
|
16
|
-
return number === 1 ? 'e' : 'er';
|
|
17
|
-
},
|
|
18
|
-
currency: {
|
|
19
|
-
symbol: 'NOK'
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
numeral.register('locale', 'se', {
|
|
23
|
-
delimiters: {
|
|
24
|
-
thousands: ' ',
|
|
25
|
-
decimal: ','
|
|
26
|
-
},
|
|
27
|
-
abbreviations: {
|
|
28
|
-
thousand: 'k',
|
|
29
|
-
million: 'mn',
|
|
30
|
-
billion: 'md',
|
|
31
|
-
trillion: 'bn'
|
|
32
|
-
},
|
|
33
|
-
ordinal: function (number) {
|
|
34
|
-
var a = Math.abs(number) % 10, b = Math.abs(number) % 100;
|
|
35
|
-
if ((a === 1 || a === 2) && (b !== 11 && b !== 12)) {
|
|
36
|
-
return ':a';
|
|
37
|
-
}
|
|
38
|
-
return ':e';
|
|
39
|
-
},
|
|
40
|
-
currency: {
|
|
41
|
-
symbol: 'SEK'
|
|
42
|
-
}
|
|
43
|
-
});
|
|
3
|
+
import { convertNumeral } from '@ev-core/au-core-resources';
|
|
44
4
|
var NumeralValueConverter = (function () {
|
|
45
5
|
function NumeralValueConverter() {
|
|
46
6
|
}
|
|
47
7
|
NumeralValueConverter.prototype.toView = function (value, format, locale) {
|
|
48
8
|
if (locale === void 0) { locale = 'nb'; }
|
|
49
|
-
|
|
50
|
-
return numeral(value).format(format);
|
|
9
|
+
return convertNumeral(value, format, locale);
|
|
51
10
|
};
|
|
52
11
|
NumeralValueConverter = __decorate([
|
|
53
12
|
valueConverter('numeral')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/numeral.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"sources":["converters/numeral.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAkB,MAAM,4BAA4B,CAAC;AAG5E;IAAA;IAIA,CAAC;IAHC,sCAAM,GAAN,UAAO,KAAK,EAAE,MAAM,EAAE,MAAwB;QAAxB,uBAAA,EAAA,aAAwB;QAC5C,OAAO,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAHU,qBAAqB;QADjC,cAAc,CAAC,SAAS,CAAC;OACb,qBAAqB,CAIjC;IAAD,4BAAC;CAJD,AAIC,IAAA;SAJY,qBAAqB","file":"numeral.js","sourceRoot":"../../../src/"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sortArray } from '@ev-core/au-core-resources';
|
|
2
2
|
export declare class SortValueConverter {
|
|
3
|
-
toView: typeof
|
|
4
|
-
static sort
|
|
3
|
+
toView: typeof sortArray;
|
|
4
|
+
static sort: typeof sortArray;
|
|
5
5
|
}
|
|
@@ -1,78 +1,18 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { valueConverter } from 'aurelia-framework';
|
|
3
|
+
import { sortArray } from '@ev-core/au-core-resources';
|
|
3
4
|
var SortValueConverter = (function () {
|
|
4
5
|
function SortValueConverter() {
|
|
5
6
|
this.toView = SortValueConverter_1.sort;
|
|
6
7
|
}
|
|
7
8
|
SortValueConverter_1 = SortValueConverter;
|
|
8
|
-
SortValueConverter.sort = function (array, opts) {
|
|
9
|
-
var _a;
|
|
10
|
-
var isValid = validate(array, opts);
|
|
11
|
-
if (!isValid) {
|
|
12
|
-
return array;
|
|
13
|
-
}
|
|
14
|
-
var key = opts.key;
|
|
15
|
-
var factor = opts.asc === true ? 1 : -1;
|
|
16
|
-
var firstValue = (_a = array.find(function (e) { return e[key]; })) === null || _a === void 0 ? void 0 : _a[key];
|
|
17
|
-
if (!firstValue) {
|
|
18
|
-
return array;
|
|
19
|
-
}
|
|
20
|
-
var sorted;
|
|
21
|
-
var sortType = findSortType(firstValue);
|
|
22
|
-
switch (sortType) {
|
|
23
|
-
case SortTypes.Date:
|
|
24
|
-
try {
|
|
25
|
-
sorted = array.sort(function (a, b) { return (a[key].getTime() - b[key].getTime()) * factor; });
|
|
26
|
-
}
|
|
27
|
-
catch (e) {
|
|
28
|
-
console.log(e);
|
|
29
|
-
}
|
|
30
|
-
break;
|
|
31
|
-
case SortTypes.String:
|
|
32
|
-
sorted = array.sort(function (a, b) { return ((a[key] || "").localeCompare(b[key])) * factor; });
|
|
33
|
-
break;
|
|
34
|
-
default:
|
|
35
|
-
sorted = array.sort(function (a, b) { return (a[key] - b[key]) * factor; });
|
|
36
|
-
}
|
|
37
|
-
return sorted;
|
|
38
|
-
};
|
|
39
9
|
var SortValueConverter_1;
|
|
10
|
+
SortValueConverter.sort = sortArray;
|
|
40
11
|
SortValueConverter = SortValueConverter_1 = __decorate([
|
|
41
12
|
valueConverter('sort')
|
|
42
13
|
], SortValueConverter);
|
|
43
14
|
return SortValueConverter;
|
|
44
15
|
}());
|
|
45
16
|
export { SortValueConverter };
|
|
46
|
-
function validate(array, opts) {
|
|
47
|
-
var isInvalid = !(opts === null || opts === void 0 ? void 0 : opts.key) ||
|
|
48
|
-
!Array.isArray(array) ||
|
|
49
|
-
array.length <= 1 ||
|
|
50
|
-
!localeCompareSupport();
|
|
51
|
-
return !isInvalid;
|
|
52
|
-
}
|
|
53
|
-
function localeCompareSupport() {
|
|
54
|
-
try {
|
|
55
|
-
'a'.localeCompare('b');
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
console.log("nosuppoert", e);
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
function findSortType(obj) {
|
|
64
|
-
if (obj instanceof Date && !Number.isNaN(obj)) {
|
|
65
|
-
return SortTypes.Date;
|
|
66
|
-
}
|
|
67
|
-
if (typeof obj === 'string') {
|
|
68
|
-
return SortTypes.String;
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
var SortTypes;
|
|
73
|
-
(function (SortTypes) {
|
|
74
|
-
SortTypes["Date"] = "date";
|
|
75
|
-
SortTypes["String"] = "string";
|
|
76
|
-
})(SortTypes || (SortTypes = {}));
|
|
77
17
|
|
|
78
18
|
//# sourceMappingURL=sort.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/sort.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"sources":["converters/sort.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAqB,MAAM,4BAA4B,CAAC;AAG1E;IAAA;QACI,WAAM,GAAG,oBAAkB,CAAC,IAAI,CAAC;IAGrC,CAAC;2BAJY,kBAAkB;;IAGb,uBAAI,GAAG,SAAH,AAAY,CAAC;IAHtB,kBAAkB;QAD9B,cAAc,CAAC,MAAM,CAAC;OACV,kBAAkB,CAI9B;IAAD,yBAAC;CAJD,AAIC,IAAA;SAJY,kBAAkB","file":"sort.js","sourceRoot":"../../../src/"}
|
|
@@ -1,30 +1,18 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { inject, Parser, valueConverter } from 'aurelia-framework';
|
|
3
|
+
import { sumArray } from '@ev-core/au-core-resources';
|
|
3
4
|
var SumValueConverter = (function () {
|
|
4
5
|
function SumValueConverter(parser) {
|
|
5
6
|
this.parser = parser;
|
|
6
7
|
}
|
|
7
8
|
SumValueConverter.prototype.toView = function (arr, key) {
|
|
8
|
-
if (!
|
|
9
|
-
return
|
|
9
|
+
if (!key) {
|
|
10
|
+
return sumArray(arr);
|
|
10
11
|
}
|
|
11
|
-
var property;
|
|
12
|
-
|
|
13
|
-
property
|
|
14
|
-
}
|
|
15
|
-
return arr.reduce(function (sum, current) {
|
|
16
|
-
var currentValue = property ?
|
|
17
|
-
property.evaluate({ bindingContext: current, overrideContext: undefined }) :
|
|
18
|
-
current;
|
|
19
|
-
if (currentValue == null) {
|
|
20
|
-
currentValue = 0;
|
|
21
|
-
}
|
|
22
|
-
if (typeof currentValue === 'string') {
|
|
23
|
-
var useValue = Number.parseInt(currentValue);
|
|
24
|
-
currentValue = Number.isNaN(useValue) ? 0 : useValue;
|
|
25
|
-
}
|
|
26
|
-
return sum + currentValue;
|
|
27
|
-
}, 0);
|
|
12
|
+
var property = this.parser.parse(key);
|
|
13
|
+
return sumArray(arr, function (current) {
|
|
14
|
+
return property.evaluate({ bindingContext: current, overrideContext: undefined });
|
|
15
|
+
});
|
|
28
16
|
};
|
|
29
17
|
SumValueConverter = __decorate([
|
|
30
18
|
valueConverter('sum'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/sum.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"sources":["converters/sum.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAItD;IACI,2BAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAI,CAAC;IAEvC,kCAAM,GAAN,UAAO,GAAU,EAAE,GAAY;QAC3B,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QAED,IAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,QAAQ,CAAC,GAAG,EAAE,UAAA,OAAO;YACxB,OAAA,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;QAA1E,CAA0E,CAAC,CAAC;IACpF,CAAC;IAXQ,iBAAiB;QAF7B,cAAc,CAAC,KAAK,CAAC;QACrB,MAAM,CAAC,MAAM,CAAC;yCAEiB,MAAM;OADzB,iBAAiB,CAY7B;IAAD,wBAAC;CAdD,AAcC,IAAA;SAZY,iBAAiB","file":"sum.js","sourceRoot":"../../../src/"}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { valueConverter } from 'aurelia-framework';
|
|
3
|
+
import { takeArray } from '@ev-core/au-core-resources';
|
|
3
4
|
var TakeValueConverter = (function () {
|
|
4
5
|
function TakeValueConverter() {
|
|
5
6
|
}
|
|
6
7
|
TakeValueConverter.prototype.toView = function (array, opts) {
|
|
7
|
-
|
|
8
|
-
var valid = validate(array, opts);
|
|
9
|
-
if (!valid) {
|
|
10
|
-
return array;
|
|
11
|
-
}
|
|
12
|
-
var take = opts.take;
|
|
13
|
-
var skip = opts.page >= 0 ? (opts.page * opts.take) : (_a = opts.skip) !== null && _a !== void 0 ? _a : 0;
|
|
14
|
-
return array.slice(skip, skip + take);
|
|
8
|
+
return takeArray(array, opts);
|
|
15
9
|
};
|
|
16
10
|
TakeValueConverter = __decorate([
|
|
17
11
|
valueConverter('take')
|
|
@@ -19,13 +13,5 @@ var TakeValueConverter = (function () {
|
|
|
19
13
|
return TakeValueConverter;
|
|
20
14
|
}());
|
|
21
15
|
export { TakeValueConverter };
|
|
22
|
-
function validate(array, opts) {
|
|
23
|
-
var invalid = (opts === null || opts === void 0 ? void 0 : opts.disabled) ||
|
|
24
|
-
!Array.isArray(array) ||
|
|
25
|
-
!((opts === null || opts === void 0 ? void 0 : opts.take) >= 0) ||
|
|
26
|
-
!((opts === null || opts === void 0 ? void 0 : opts.page) >= 0 || (opts === null || opts === void 0 ? void 0 : opts.skip) >= 0);
|
|
27
|
-
return !invalid;
|
|
28
|
-
}
|
|
29
|
-
;
|
|
30
16
|
|
|
31
17
|
//# sourceMappingURL=take.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/take.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"sources":["converters/take.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAqB,MAAM,4BAA4B,CAAC;AAG1E;IAAA;IAIA,CAAC;IAHG,mCAAM,GAAN,UAAO,KAAY,EAAE,IAAkB;QACnC,OAAO,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAHQ,kBAAkB;QAD9B,cAAc,CAAC,MAAM,CAAC;OACV,kBAAkB,CAI9B;IAAD,yBAAC;CAJD,AAIC,IAAA;SAJY,kBAAkB","file":"take.js","sourceRoot":"../../../src/"}
|