@ev-core/aurelia-v1-resources 1.0.0 → 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,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { IDateTimeValueConverterConfig } from '../interfaces';
|
|
3
|
-
export type datetimeConfigure = (config: IDateTimeValueConverterOptions) => void;
|
|
4
|
-
export declare function configure(cb: datetimeConfigure): void;
|
|
5
|
-
export declare function getDate(date: string | Date, opts?: DateTimeOptions): any;
|
|
6
|
-
export declare function buildOptions(opts?: IDateTimeValueConverterOptions): IDateTimeValueConverterOptions;
|
|
7
|
-
export declare function getDateTimeOptions(opts?: IDateTimeValueConverterOptions): DateTimeOptions;
|
|
8
|
-
export interface IDateTimeValueConverterOptions extends Partial<IDateTimeValueConverterConfig> {
|
|
9
|
-
format?: string;
|
|
10
|
-
type?: 'toFormat' | 'toRelative' | 'relativeToCalendar';
|
|
11
|
-
relativeBase?: string | Date;
|
|
12
|
-
zone?: string | Zone | undefined;
|
|
13
|
-
}
|
|
1
|
+
export { configureDatetime as configure, type DatetimeConfigure as datetimeConfigure, type IDateTimeValueConverterOptions, buildDatetimeOptions as buildOptions, getDate, getDateTimeOptions } from '@ev-core/au-core-resources';
|
|
@@ -1,45 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configure =
|
|
4
|
-
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
defaultFormat: 'dd. LL yyyy'
|
|
10
|
-
};
|
|
11
|
-
function configure(cb) {
|
|
12
|
-
cb(defaultConfig);
|
|
13
|
-
}
|
|
14
|
-
function getDate(date, opts) {
|
|
15
|
-
opts = opts !== null && opts !== void 0 ? opts : {};
|
|
16
|
-
if (!opts.locale) {
|
|
17
|
-
opts.locale = defaultConfig.locale;
|
|
18
|
-
}
|
|
19
|
-
if (!opts.zone) {
|
|
20
|
-
opts.zone = defaultConfig.zone;
|
|
21
|
-
}
|
|
22
|
-
return typeof date === 'string' ?
|
|
23
|
-
luxon_1.DateTime.fromISO(date, opts) :
|
|
24
|
-
luxon_1.DateTime.fromJSDate(date, opts);
|
|
25
|
-
}
|
|
26
|
-
function buildOptions(opts) {
|
|
27
|
-
var _a;
|
|
28
|
-
var options = Object.assign({}, defaultConfig, opts !== null && opts !== void 0 ? opts : {});
|
|
29
|
-
if (!options.format) {
|
|
30
|
-
options.format = (_a = defaultConfig.format) !== null && _a !== void 0 ? _a : defaultConfig.defaultFormat;
|
|
31
|
-
}
|
|
32
|
-
if (!options.defaultFormat) {
|
|
33
|
-
options.format;
|
|
34
|
-
}
|
|
35
|
-
return options;
|
|
36
|
-
}
|
|
37
|
-
function getDateTimeOptions(opts) {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
return {
|
|
40
|
-
locale: (_a = opts === null || opts === void 0 ? void 0 : opts.locale) !== null && _a !== void 0 ? _a : defaultConfig.locale,
|
|
41
|
-
zone: (_b = opts === null || opts === void 0 ? void 0 : opts.zone) !== null && _b !== void 0 ? _b : defaultConfig.zone
|
|
42
|
-
};
|
|
43
|
-
}
|
|
3
|
+
exports.getDateTimeOptions = exports.getDate = exports.buildOptions = exports.configure = void 0;
|
|
4
|
+
var au_core_resources_1 = require("@ev-core/au-core-resources");
|
|
5
|
+
Object.defineProperty(exports, "configure", { enumerable: true, get: function () { return au_core_resources_1.configureDatetime; } });
|
|
6
|
+
Object.defineProperty(exports, "buildOptions", { enumerable: true, get: function () { return au_core_resources_1.buildDatetimeOptions; } });
|
|
7
|
+
Object.defineProperty(exports, "getDate", { enumerable: true, get: function () { return au_core_resources_1.getDate; } });
|
|
8
|
+
Object.defineProperty(exports, "getDateTimeOptions", { enumerable: true, get: function () { return au_core_resources_1.getDateTimeOptions; } });
|
|
44
9
|
|
|
45
10
|
//# sourceMappingURL=datetime-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/datetime-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["converters/datetime-config.ts"],"names":[],"mappings":";;;AAAA,gEAOoC;AANhC,8GAAA,iBAAiB,OAAa;AAG9B,iHAAA,oBAAoB,OAAgB;AACpC,4GAAA,OAAO,OAAA;AACP,uHAAA,kBAAkB,OAAA","file":"datetime-config.js","sourceRoot":"../../../src/"}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type durationConfigure =
|
|
1
|
+
import { convertDuration, configureDuration, type DurationConfigure, type IDurationOptions } from '@ev-core/au-core-resources';
|
|
2
|
+
export type durationConfigure = DurationConfigure;
|
|
3
3
|
export declare class DurationValueConverter {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
private static ctrs;
|
|
8
|
-
toView: typeof DurationValueConverter.convert;
|
|
9
|
-
static configure(cfg?: durationConfigure): void;
|
|
10
|
-
static convert(date: string | Date, opts?: IDurationOptions): string;
|
|
11
|
-
private static verifyConfig;
|
|
12
|
-
}
|
|
13
|
-
export interface IDurationOptions extends FormatOptions {
|
|
14
|
-
locale?: string;
|
|
15
|
-
base?: Date | string;
|
|
4
|
+
toView: typeof convertDuration;
|
|
5
|
+
static configure: typeof configureDuration;
|
|
6
|
+
static convert: typeof convertDuration;
|
|
16
7
|
}
|
|
8
|
+
export type { IDurationOptions };
|
|
@@ -3,66 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DurationValueConverter = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var aurelia_framework_1 = require("aurelia-framework");
|
|
6
|
-
var
|
|
7
|
-
function loadLocale(locale) {
|
|
8
|
-
switch (locale) {
|
|
9
|
-
case 'en':
|
|
10
|
-
return require('javascript-time-ago/locale/en');
|
|
11
|
-
case 'nb':
|
|
12
|
-
return require('javascript-time-ago/locale/nb');
|
|
13
|
-
case 'sv':
|
|
14
|
-
return require('javascript-time-ago/locale/sv');
|
|
15
|
-
default:
|
|
16
|
-
throw new Error("Locale ".concat(locale, " is not supported."));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
var en = loadLocale('en');
|
|
20
|
-
var nb = loadLocale('nb');
|
|
21
|
-
var sv = loadLocale('sv');
|
|
22
|
-
var localesModules = [en, nb, sv];
|
|
23
|
-
javascript_time_ago_1.default.addDefaultLocale(localesModules[0]);
|
|
24
|
-
localesModules.forEach(function (l) { return javascript_time_ago_1.default.addLocale(l); });
|
|
6
|
+
var au_core_resources_1 = require("@ev-core/au-core-resources");
|
|
25
7
|
var DurationValueConverter = (function () {
|
|
26
8
|
function DurationValueConverter() {
|
|
27
9
|
this.toView = DurationValueConverter_1.convert;
|
|
28
10
|
}
|
|
29
11
|
DurationValueConverter_1 = DurationValueConverter;
|
|
30
|
-
DurationValueConverter.configure = function (cfg) {
|
|
31
|
-
var _a;
|
|
32
|
-
var opts = {};
|
|
33
|
-
if (cfg) {
|
|
34
|
-
cfg(opts);
|
|
35
|
-
}
|
|
36
|
-
DurationValueConverter_1.defaultLocale = (_a = opts === null || opts === void 0 ? void 0 : opts.locale) !== null && _a !== void 0 ? _a : 'en';
|
|
37
|
-
DurationValueConverter_1.opts = opts;
|
|
38
|
-
DurationValueConverter_1.ctrs = {};
|
|
39
|
-
localesModules.forEach(function (l) {
|
|
40
|
-
var locale = l.locale;
|
|
41
|
-
DurationValueConverter_1.ctrs[locale] = new javascript_time_ago_1.default(locale);
|
|
42
|
-
});
|
|
43
|
-
this.isConfigured = true;
|
|
44
|
-
};
|
|
45
|
-
;
|
|
46
|
-
DurationValueConverter.convert = function (date, opts) {
|
|
47
|
-
var _a;
|
|
48
|
-
DurationValueConverter_1.verifyConfig(opts);
|
|
49
|
-
try {
|
|
50
|
-
var parsedDate = typeof date === 'string' ? new Date(date) : date;
|
|
51
|
-
var ctr = DurationValueConverter_1.ctrs[(_a = opts === null || opts === void 0 ? void 0 : opts.locale) !== null && _a !== void 0 ? _a : DurationValueConverter_1.defaultLocale];
|
|
52
|
-
return ctr.format(parsedDate, opts);
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
console.error(error);
|
|
56
|
-
return 'error';
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
DurationValueConverter.verifyConfig = function (opts) {
|
|
60
|
-
if (!this.isConfigured) {
|
|
61
|
-
this.configure();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
12
|
var DurationValueConverter_1;
|
|
65
|
-
DurationValueConverter.
|
|
13
|
+
DurationValueConverter.configure = au_core_resources_1.configureDuration;
|
|
14
|
+
DurationValueConverter.convert = au_core_resources_1.convertDuration;
|
|
66
15
|
DurationValueConverter = DurationValueConverter_1 = tslib_1.__decorate([
|
|
67
16
|
(0, aurelia_framework_1.valueConverter)('duration')
|
|
68
17
|
], DurationValueConverter);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/datetime-duration.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"sources":["converters/datetime-duration.ts"],"names":[],"mappings":";;;;AAAA,uDAAmD;AACnD,gEAA+H;AAK/H;IAAA;QACS,WAAM,GAAG,wBAAsB,CAAC,OAAO,CAAC;IAKjD,CAAC;+BANY,sBAAsB;;IAGnB,gCAAS,GAAG,qCAAH,AAAoB,CAAC;IAE9B,8BAAO,GAAG,mCAAH,AAAkB,CAAC;IAL7B,sBAAsB;QADlC,IAAA,kCAAc,EAAC,UAAU,CAAC;OACd,sBAAsB,CAMlC;IAAD,6BAAC;CAND,AAMC,IAAA;AANY,wDAAsB","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
|
}
|
|
@@ -3,38 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DatetimeValueConverter = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var aurelia_framework_1 = require("aurelia-framework");
|
|
6
|
-
var
|
|
6
|
+
var au_core_resources_1 = require("@ev-core/au-core-resources");
|
|
7
7
|
var DatetimeValueConverter = (function () {
|
|
8
8
|
function DatetimeValueConverter() {
|
|
9
9
|
this.toView = DatetimeValueConverter_1.convert;
|
|
10
10
|
}
|
|
11
11
|
DatetimeValueConverter_1 = DatetimeValueConverter;
|
|
12
|
-
DatetimeValueConverter.convert = function (date, options) {
|
|
13
|
-
var _a;
|
|
14
|
-
options = (0, datetime_config_1.buildOptions)(options);
|
|
15
|
-
var dtOptions = (0, datetime_config_1.getDateTimeOptions)(options);
|
|
16
|
-
var dt = (0, datetime_config_1.getDate)(date, dtOptions);
|
|
17
|
-
var type = (_a = options === null || options === void 0 ? void 0 : options.type) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
18
|
-
if (!type || type == 'toformat') {
|
|
19
|
-
return dt.toFormat(options.format);
|
|
20
|
-
}
|
|
21
|
-
if (type == 'torelative') {
|
|
22
|
-
var base = undefined;
|
|
23
|
-
if (options.relativeBase) {
|
|
24
|
-
base = (0, datetime_config_1.getDate)(options.relativeBase, dtOptions);
|
|
25
|
-
}
|
|
26
|
-
return dt.toRelative({ base: base, round: false });
|
|
27
|
-
}
|
|
28
|
-
if (type == 'torelativecalendar') {
|
|
29
|
-
var base = undefined;
|
|
30
|
-
if (options.relativeBase) {
|
|
31
|
-
base = (0, datetime_config_1.getDate)(options.relativeBase, dtOptions);
|
|
32
|
-
}
|
|
33
|
-
return dt.toRelativeCalendar({ base: base });
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
12
|
var DatetimeValueConverter_1;
|
|
37
|
-
DatetimeValueConverter.configure =
|
|
13
|
+
DatetimeValueConverter.configure = au_core_resources_1.configureDatetime;
|
|
14
|
+
DatetimeValueConverter.convert = au_core_resources_1.convertDatetime;
|
|
38
15
|
DatetimeValueConverter = DatetimeValueConverter_1 = tslib_1.__decorate([
|
|
39
16
|
(0, aurelia_framework_1.valueConverter)('datetime')
|
|
40
17
|
], DatetimeValueConverter);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/datetime.ts"],"names":[],"mappings":";;;;AAAA,uDAAmD;
|
|
1
|
+
{"version":3,"sources":["converters/datetime.ts"],"names":[],"mappings":";;;;AAAA,uDAAmD;AACnD,gEAAgF;AAGhF;IAAA;QACE,WAAM,GAAG,wBAAsB,CAAC,OAAO,CAAC;IAK1C,CAAC;+BANY,sBAAsB;;IAGnB,gCAAS,GAAG,qCAAH,AAAoB,CAAC;IAE9B,8BAAO,GAAG,mCAAH,AAAkB,CAAC;IAL7B,sBAAsB;QADlC,IAAA,kCAAc,EAAC,UAAU,CAAC;OACd,sBAAsB,CAMlC;IAAD,6BAAC;CAND,AAMC,IAAA;AANY,wDAAsB","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
|
}
|
|
@@ -3,97 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FilterValueConverter = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var aurelia_framework_1 = require("aurelia-framework");
|
|
6
|
-
var
|
|
7
|
-
return d instanceof Date ? d.getTime() : new Date(d).getTime();
|
|
8
|
-
};
|
|
9
|
-
var FILTER_MODES = {
|
|
10
|
-
'exact': { fn: function (a, b) { return a === b; }, stringify: true },
|
|
11
|
-
'startsWith': { fn: function (a, b) { return a.startsWith(b); }, stringify: true },
|
|
12
|
-
'endsWith': { fn: function (a, b) { return a.endsWith(b); }, stringify: true },
|
|
13
|
-
'contains': { fn: function (a, b) { return a.indexOf(b) >= 0; }, stringify: true },
|
|
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
|
-
'==': { fn: function (a, b) { return a == b; }, stringify: false },
|
|
19
|
-
'===': { fn: function (a, b) { return a == b; }, stringify: false },
|
|
20
|
-
'!=': { fn: function (a, b) { return a != b; }, stringify: false },
|
|
21
|
-
'Array.some': {
|
|
22
|
-
fn: function (a, b) { return (a || []).some(function (x) { return b.includes(x); }); },
|
|
23
|
-
stringify: false,
|
|
24
|
-
isArray: true
|
|
25
|
-
},
|
|
26
|
-
'!Array.some': {
|
|
27
|
-
fn: function (a, b) { return !(a || []).some(function (x) { return b.includes(x); }); },
|
|
28
|
-
stringify: false,
|
|
29
|
-
isArray: true
|
|
30
|
-
},
|
|
31
|
-
'Array.includes': {
|
|
32
|
-
fn: function (a, b) { return (a || []).includes(b); },
|
|
33
|
-
stringify: false,
|
|
34
|
-
isArray: true
|
|
35
|
-
},
|
|
36
|
-
'!Array.includes': {
|
|
37
|
-
fn: function (a, b) { return !(a || []).includes(b); },
|
|
38
|
-
stringify: false,
|
|
39
|
-
isArray: true
|
|
40
|
-
},
|
|
41
|
-
'Date.>=': {
|
|
42
|
-
fn: function (a, b) {
|
|
43
|
-
var t1 = toMillis(a);
|
|
44
|
-
var t2 = toMillis(b);
|
|
45
|
-
return t1 >= t2;
|
|
46
|
-
},
|
|
47
|
-
stringify: false
|
|
48
|
-
},
|
|
49
|
-
'Date.<': {
|
|
50
|
-
fn: function (a, b) {
|
|
51
|
-
var t1 = toMillis(a);
|
|
52
|
-
var t2 = toMillis(b);
|
|
53
|
-
return t1 < t2;
|
|
54
|
-
},
|
|
55
|
-
stringify: false
|
|
56
|
-
}
|
|
57
|
-
};
|
|
6
|
+
var au_core_resources_1 = require("@ev-core/au-core-resources");
|
|
58
7
|
var FilterValueConverter = (function () {
|
|
59
8
|
function FilterValueConverter(parser) {
|
|
60
9
|
this.parser = parser;
|
|
61
10
|
}
|
|
62
11
|
FilterValueConverter.prototype.toView = function (arr, opts) {
|
|
63
12
|
var _this = this;
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var properties = (Array.isArray(opts.props) ? opts.props : [opts.props]);
|
|
74
|
-
var filteredArr;
|
|
75
|
-
var FILTERMODE = FILTER_MODES[mode];
|
|
76
|
-
if (FILTERMODE.isArray) {
|
|
77
|
-
filteredArr = arr.filter(function (entry) {
|
|
78
|
-
return properties.some(function (p) { return FILTERMODE.fn(queries, entry[p]); });
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
var stringify_1 = FILTERMODE.stringify;
|
|
83
|
-
var settingsFn_1 = function (term) { return stringify_1 ? String(term).toLowerCase() : term; };
|
|
84
|
-
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; });
|
|
85
|
-
filteredArr = arr.filter(function (entry) {
|
|
86
|
-
return propExpressions_1.some(function (propExp) {
|
|
87
|
-
var evaluated = propExp.evaluate({ bindingContext: entry, overrideContext: null });
|
|
88
|
-
return terms_1.some(function (t) {
|
|
89
|
-
return FILTERMODE.fn(settingsFn_1(evaluated), t);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
return opts.take && typeof opts.take === 'number' ?
|
|
95
|
-
filteredArr.slice(0, opts.take) :
|
|
96
|
-
filteredArr;
|
|
13
|
+
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);
|
|
14
|
+
var expressions = new Map(properties.map(function (p) { return [p, _this.parser.parse(p)]; }));
|
|
15
|
+
return (0, au_core_resources_1.filterArray)(arr, opts, function (entry, prop) {
|
|
16
|
+
var propExp = expressions.get(prop);
|
|
17
|
+
if (!propExp) {
|
|
18
|
+
return entry[prop];
|
|
19
|
+
}
|
|
20
|
+
return propExp.evaluate({ bindingContext: entry, overrideContext: null });
|
|
21
|
+
});
|
|
97
22
|
};
|
|
98
23
|
FilterValueConverter = tslib_1.__decorate([
|
|
99
24
|
(0, aurelia_framework_1.valueConverter)('filter'),
|
|
@@ -103,14 +28,5 @@ var FilterValueConverter = (function () {
|
|
|
103
28
|
return FilterValueConverter;
|
|
104
29
|
}());
|
|
105
30
|
exports.FilterValueConverter = FilterValueConverter;
|
|
106
|
-
function validate(arr, opts) {
|
|
107
|
-
var minLength = opts.minLength || 0;
|
|
108
|
-
var isInvalid = (opts === null || opts === void 0 ? void 0 : opts.disabled) ||
|
|
109
|
-
!Array.isArray(arr) ||
|
|
110
|
-
!(opts === null || opts === void 0 ? void 0 : opts.q) ||
|
|
111
|
-
((opts.q || '').length < minLength);
|
|
112
|
-
return !isInvalid;
|
|
113
|
-
}
|
|
114
|
-
;
|
|
115
31
|
|
|
116
32
|
//# sourceMappingURL=filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/filter.ts"],"names":[],"mappings":";;;;AAAA,uDAAoF;
|
|
1
|
+
{"version":3,"sources":["converters/filter.ts"],"names":[],"mappings":";;;;AAAA,uDAAoF;AACpF,gEAA8E;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,IAAA,+BAAW,EAAC,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,IAAA,kCAAc,EAAC,QAAQ,CAAC;QACxB,IAAA,0BAAM,EAAC,0BAAM,CAAC;iDAGkB,0BAAM;OAF1B,oBAAoB,CAiBhC;IAAD,2BAAC;CAnBD,AAmBC,IAAA;AAjBY,oDAAoB","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
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NumberFormatValueConverter = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var aurelia_framework_1 = require("aurelia-framework");
|
|
6
|
+
var au_core_resources_1 = require("@ev-core/au-core-resources");
|
|
6
7
|
var NumberFormatValueConverter = (function () {
|
|
7
8
|
function NumberFormatValueConverter() {
|
|
8
9
|
this.toView = NumberFormatValueConverter_1.convert;
|
|
@@ -11,17 +12,9 @@ var NumberFormatValueConverter = (function () {
|
|
|
11
12
|
NumberFormatValueConverter.setConfig = function (cb) {
|
|
12
13
|
cb(this.config);
|
|
13
14
|
};
|
|
14
|
-
NumberFormatValueConverter.convert = function (value, opts) {
|
|
15
|
-
var options = Object.assign({}, NumberFormatValueConverter_1.config, opts !== null && opts !== void 0 ? opts : {});
|
|
16
|
-
var parts = (value || 0).toString().split(".");
|
|
17
|
-
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, options.delimiter);
|
|
18
|
-
return parts.join(",");
|
|
19
|
-
};
|
|
20
15
|
var NumberFormatValueConverter_1;
|
|
21
|
-
NumberFormatValueConverter.config =
|
|
22
|
-
|
|
23
|
-
delimiter: ' '
|
|
24
|
-
};
|
|
16
|
+
NumberFormatValueConverter.config = au_core_resources_1.numberFormatConfig;
|
|
17
|
+
NumberFormatValueConverter.convert = au_core_resources_1.convertNumberFormat;
|
|
25
18
|
NumberFormatValueConverter = NumberFormatValueConverter_1 = tslib_1.__decorate([
|
|
26
19
|
(0, aurelia_framework_1.valueConverter)('numberformat')
|
|
27
20
|
], NumberFormatValueConverter);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/numberformat.ts"],"names":[],"mappings":";;;;AAAA,uDAAmD;
|
|
1
|
+
{"version":3,"sources":["converters/numberformat.ts"],"names":[],"mappings":";;;;AAAA,uDAAmD;AACnD,gEAAgH;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,sCAAzB,AAA2C,CAAC;IAM3D,kCAAO,GAAG,uCAAH,AAAsB,CAAC;IATjC,0BAA0B;QADtC,IAAA,kCAAc,EAAC,cAAc,CAAC;OAClB,0BAA0B,CAUtC;IAAD,iCAAC;CAVD,AAUC,IAAA;AAVY,gEAA0B","file":"numberformat.js","sourceRoot":"../../../src/"}
|
|
@@ -3,54 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NumeralValueConverter = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var aurelia_framework_1 = require("aurelia-framework");
|
|
6
|
-
var
|
|
7
|
-
numeral.register('locale', 'nb', {
|
|
8
|
-
delimiters: {
|
|
9
|
-
thousands: ' ',
|
|
10
|
-
decimal: ','
|
|
11
|
-
},
|
|
12
|
-
abbreviations: {
|
|
13
|
-
thousand: 'k',
|
|
14
|
-
million: 'm',
|
|
15
|
-
billion: 'b',
|
|
16
|
-
trillion: 't'
|
|
17
|
-
},
|
|
18
|
-
ordinal: function (number) {
|
|
19
|
-
return number === 1 ? 'e' : 'er';
|
|
20
|
-
},
|
|
21
|
-
currency: {
|
|
22
|
-
symbol: 'NOK'
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
numeral.register('locale', 'se', {
|
|
26
|
-
delimiters: {
|
|
27
|
-
thousands: ' ',
|
|
28
|
-
decimal: ','
|
|
29
|
-
},
|
|
30
|
-
abbreviations: {
|
|
31
|
-
thousand: 'k',
|
|
32
|
-
million: 'mn',
|
|
33
|
-
billion: 'md',
|
|
34
|
-
trillion: 'bn'
|
|
35
|
-
},
|
|
36
|
-
ordinal: function (number) {
|
|
37
|
-
var a = Math.abs(number) % 10, b = Math.abs(number) % 100;
|
|
38
|
-
if ((a === 1 || a === 2) && (b !== 11 && b !== 12)) {
|
|
39
|
-
return ':a';
|
|
40
|
-
}
|
|
41
|
-
return ':e';
|
|
42
|
-
},
|
|
43
|
-
currency: {
|
|
44
|
-
symbol: 'SEK'
|
|
45
|
-
}
|
|
46
|
-
});
|
|
6
|
+
var au_core_resources_1 = require("@ev-core/au-core-resources");
|
|
47
7
|
var NumeralValueConverter = (function () {
|
|
48
8
|
function NumeralValueConverter() {
|
|
49
9
|
}
|
|
50
10
|
NumeralValueConverter.prototype.toView = function (value, format, locale) {
|
|
51
11
|
if (locale === void 0) { locale = 'nb'; }
|
|
52
|
-
|
|
53
|
-
return numeral(value).format(format);
|
|
12
|
+
return (0, au_core_resources_1.convertNumeral)(value, format, locale);
|
|
54
13
|
};
|
|
55
14
|
NumeralValueConverter = tslib_1.__decorate([
|
|
56
15
|
(0, aurelia_framework_1.valueConverter)('numeral')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/numeral.ts"],"names":[],"mappings":";;;;AAAA,uDAAmD;AACnD,
|
|
1
|
+
{"version":3,"sources":["converters/numeral.ts"],"names":[],"mappings":";;;;AAAA,uDAAmD;AACnD,gEAA4E;AAG5E;IAAA;IAIA,CAAC;IAHC,sCAAM,GAAN,UAAO,KAAK,EAAE,MAAM,EAAE,MAAwB;QAAxB,uBAAA,EAAA,aAAwB;QAC5C,OAAO,IAAA,kCAAc,EAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAHU,qBAAqB;QADjC,IAAA,kCAAc,EAAC,SAAS,CAAC;OACb,qBAAqB,CAIjC;IAAD,4BAAC;CAJD,AAIC,IAAA;AAJY,sDAAqB","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
|
}
|
|
@@ -3,79 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SortValueConverter = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var aurelia_framework_1 = require("aurelia-framework");
|
|
6
|
+
var au_core_resources_1 = require("@ev-core/au-core-resources");
|
|
6
7
|
var SortValueConverter = (function () {
|
|
7
8
|
function SortValueConverter() {
|
|
8
9
|
this.toView = SortValueConverter_1.sort;
|
|
9
10
|
}
|
|
10
11
|
SortValueConverter_1 = SortValueConverter;
|
|
11
|
-
SortValueConverter.sort = function (array, opts) {
|
|
12
|
-
var _a;
|
|
13
|
-
var isValid = validate(array, opts);
|
|
14
|
-
if (!isValid) {
|
|
15
|
-
return array;
|
|
16
|
-
}
|
|
17
|
-
var key = opts.key;
|
|
18
|
-
var factor = opts.asc === true ? 1 : -1;
|
|
19
|
-
var firstValue = (_a = array.find(function (e) { return e[key]; })) === null || _a === void 0 ? void 0 : _a[key];
|
|
20
|
-
if (!firstValue) {
|
|
21
|
-
return array;
|
|
22
|
-
}
|
|
23
|
-
var sorted;
|
|
24
|
-
var sortType = findSortType(firstValue);
|
|
25
|
-
switch (sortType) {
|
|
26
|
-
case SortTypes.Date:
|
|
27
|
-
try {
|
|
28
|
-
sorted = array.sort(function (a, b) { return (a[key].getTime() - b[key].getTime()) * factor; });
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
console.log(e);
|
|
32
|
-
}
|
|
33
|
-
break;
|
|
34
|
-
case SortTypes.String:
|
|
35
|
-
sorted = array.sort(function (a, b) { return ((a[key] || "").localeCompare(b[key])) * factor; });
|
|
36
|
-
break;
|
|
37
|
-
default:
|
|
38
|
-
sorted = array.sort(function (a, b) { return (a[key] - b[key]) * factor; });
|
|
39
|
-
}
|
|
40
|
-
return sorted;
|
|
41
|
-
};
|
|
42
12
|
var SortValueConverter_1;
|
|
13
|
+
SortValueConverter.sort = au_core_resources_1.sortArray;
|
|
43
14
|
SortValueConverter = SortValueConverter_1 = tslib_1.__decorate([
|
|
44
15
|
(0, aurelia_framework_1.valueConverter)('sort')
|
|
45
16
|
], SortValueConverter);
|
|
46
17
|
return SortValueConverter;
|
|
47
18
|
}());
|
|
48
19
|
exports.SortValueConverter = SortValueConverter;
|
|
49
|
-
function validate(array, opts) {
|
|
50
|
-
var isInvalid = !(opts === null || opts === void 0 ? void 0 : opts.key) ||
|
|
51
|
-
!Array.isArray(array) ||
|
|
52
|
-
array.length <= 1 ||
|
|
53
|
-
!localeCompareSupport();
|
|
54
|
-
return !isInvalid;
|
|
55
|
-
}
|
|
56
|
-
function localeCompareSupport() {
|
|
57
|
-
try {
|
|
58
|
-
'a'.localeCompare('b');
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
console.log("nosuppoert", e);
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
function findSortType(obj) {
|
|
67
|
-
if (obj instanceof Date && !Number.isNaN(obj)) {
|
|
68
|
-
return SortTypes.Date;
|
|
69
|
-
}
|
|
70
|
-
if (typeof obj === 'string') {
|
|
71
|
-
return SortTypes.String;
|
|
72
|
-
}
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
var SortTypes;
|
|
76
|
-
(function (SortTypes) {
|
|
77
|
-
SortTypes["Date"] = "date";
|
|
78
|
-
SortTypes["String"] = "string";
|
|
79
|
-
})(SortTypes || (SortTypes = {}));
|
|
80
20
|
|
|
81
21
|
//# sourceMappingURL=sort.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["converters/sort.ts"],"names":[],"mappings":";;;;AAAA,uDAAmD;
|
|
1
|
+
{"version":3,"sources":["converters/sort.ts"],"names":[],"mappings":";;;;AAAA,uDAAmD;AACnD,gEAA0E;AAG1E;IAAA;QACI,WAAM,GAAG,oBAAkB,CAAC,IAAI,CAAC;IAGrC,CAAC;2BAJY,kBAAkB;;IAGb,uBAAI,GAAG,6BAAH,AAAY,CAAC;IAHtB,kBAAkB;QAD9B,IAAA,kCAAc,EAAC,MAAM,CAAC;OACV,kBAAkB,CAI9B;IAAD,yBAAC;CAJD,AAIC,IAAA;AAJY,gDAAkB","file":"sort.js","sourceRoot":"../../../src/"}
|