diff --git a/dist/amd/formatters/translateBooleanFormatter.js b/dist/amd/formatters/translateBooleanFormatter.js index 26d2ae013..b2ad9dab1 100644 --- a/dist/amd/formatters/translateBooleanFormatter.js +++ b/dist/amd/formatters/translateBooleanFormatter.js @@ -1,4 +1,4 @@ -define(["require", "exports", "aurelia-i18n"], function (require, exports, aurelia_i18n_1) { +define(["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** Takes a boolean value, cast it to upperCase string and finally translates (i18n) it */ @@ -6,15 +6,15 @@ define(["require", "exports", "aurelia-i18n"], function (require, exports, aurel var gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; var columnParams = columnDef.params || {}; var gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof aurelia_i18n_1.I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof aurelia_i18n_1.I18N))) { - throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Column Definition params or a Grid Option params.\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); + var i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Grid Options or Column Definition \"params\".\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); } - var translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value.toUpperCase()) : ''; + return value ? i18n.tr(value.toUpperCase()) : ''; }; }); //# sourceMappingURL=translateBooleanFormatter.js.map \ No newline at end of file diff --git a/dist/amd/formatters/translateBooleanFormatter.js.map b/dist/amd/formatters/translateBooleanFormatter.js.map index 838448929..54e74ba3d 100644 --- a/dist/amd/formatters/translateBooleanFormatter.js.map +++ b/dist/amd/formatters/translateBooleanFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":";;;IAGA,0FAA0F;IAC7E,QAAA,yBAAyB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;QACxI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;QAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;QAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7H,MAAM,IAAI,KAAK,CAAC,wNACsE,CAAC,CAAC;QAC1F,CAAC;QAED,IAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;QAEvD,qFAAqF;QACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;YACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;QACrB,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":";;;IAGA,0FAA0F;IAC7E,QAAA,yBAAyB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;QACxI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;QAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;QAC5C,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;QAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,oNACsE,CAAC,CAAC;QAC1F,CAAC;QAED,qFAAqF;QACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;YACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;QACrB,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7D,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/amd/formatters/translateFormatter.js b/dist/amd/formatters/translateFormatter.js index ff92c0a46..0e8e1789a 100644 --- a/dist/amd/formatters/translateFormatter.js +++ b/dist/amd/formatters/translateFormatter.js @@ -1,4 +1,4 @@ -define(["require", "exports", "aurelia-i18n"], function (require, exports, aurelia_i18n_1) { +define(["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** Takes a cell value and translates it (i18n). Requires an instance of the I18N Service:: `params: { i18n: this.i18n } */ @@ -6,15 +6,15 @@ define(["require", "exports", "aurelia-i18n"], function (require, exports, aurel var gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; var columnParams = columnDef.params || {}; var gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof aurelia_i18n_1.I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof aurelia_i18n_1.I18N))) { - throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Column Definition params or a Grid Option params.\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); + var i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Grid Options or Column Definition \"params\".\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); } - var translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value) : ''; + return value ? i18n.tr(value) : ''; }; }); //# sourceMappingURL=translateFormatter.js.map \ No newline at end of file diff --git a/dist/amd/formatters/translateFormatter.js.map b/dist/amd/formatters/translateFormatter.js.map index 82a9815ac..7d87be5e8 100644 --- a/dist/amd/formatters/translateFormatter.js.map +++ b/dist/amd/formatters/translateFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":";;;IAGA,2HAA2H;IAC9G,QAAA,kBAAkB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;QACjI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;QAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;QAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7H,MAAM,IAAI,KAAK,CAAC,wNACsE,CAAC,CAAC;QAC1F,CAAC;QAED,IAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;QAEvD,qFAAqF;QACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;YACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;QACrB,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1C,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":";;;IAEA,2HAA2H;IAC9G,QAAA,kBAAkB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;QACjI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;QAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;QAC5C,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;QAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,oNACsE,CAAC,CAAC;QAC1F,CAAC;QAED,qFAAqF;QACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;YACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;QACrB,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/commonjs/formatters/translateBooleanFormatter.js b/dist/commonjs/formatters/translateBooleanFormatter.js index 9176f9b26..26de5e54b 100644 --- a/dist/commonjs/formatters/translateBooleanFormatter.js +++ b/dist/commonjs/formatters/translateBooleanFormatter.js @@ -1,19 +1,18 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var aurelia_i18n_1 = require("aurelia-i18n"); /** Takes a boolean value, cast it to upperCase string and finally translates (i18n) it */ exports.translateBooleanFormatter = function (row, cell, value, columnDef, dataContext, grid) { var gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; var columnParams = columnDef.params || {}; var gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof aurelia_i18n_1.I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof aurelia_i18n_1.I18N))) { - throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Column Definition params or a Grid Option params.\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); + var i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Grid Options or Column Definition \"params\".\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); } - var translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value.toUpperCase()) : ''; + return value ? i18n.tr(value.toUpperCase()) : ''; }; //# sourceMappingURL=translateBooleanFormatter.js.map \ No newline at end of file diff --git a/dist/commonjs/formatters/translateBooleanFormatter.js.map b/dist/commonjs/formatters/translateBooleanFormatter.js.map index 6ad730084..db1f9128e 100644 --- a/dist/commonjs/formatters/translateBooleanFormatter.js.map +++ b/dist/commonjs/formatters/translateBooleanFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":";;AACA,6CAAoC;AAEpC,0FAA0F;AAC7E,QAAA,yBAAyB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;IACxI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7H,MAAM,IAAI,KAAK,CAAC,wNACsE,CAAC,CAAC;IAC1F,CAAC;IAED,IAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAEvD,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClE,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":";;AAGA,0FAA0F;AAC7E,QAAA,yBAAyB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;IACxI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,oNACsE,CAAC,CAAC;IAC1F,CAAC;IAED,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7D,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/commonjs/formatters/translateFormatter.js b/dist/commonjs/formatters/translateFormatter.js index ce3d78591..25c187c5f 100644 --- a/dist/commonjs/formatters/translateFormatter.js +++ b/dist/commonjs/formatters/translateFormatter.js @@ -1,19 +1,18 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var aurelia_i18n_1 = require("aurelia-i18n"); /** Takes a cell value and translates it (i18n). Requires an instance of the I18N Service:: `params: { i18n: this.i18n } */ exports.translateFormatter = function (row, cell, value, columnDef, dataContext, grid) { var gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; var columnParams = columnDef.params || {}; var gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof aurelia_i18n_1.I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof aurelia_i18n_1.I18N))) { - throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Column Definition params or a Grid Option params.\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); + var i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Grid Options or Column Definition \"params\".\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); } - var translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value) : ''; + return value ? i18n.tr(value) : ''; }; //# sourceMappingURL=translateFormatter.js.map \ No newline at end of file diff --git a/dist/commonjs/formatters/translateFormatter.js.map b/dist/commonjs/formatters/translateFormatter.js.map index 79adf1b7e..bd1d5a240 100644 --- a/dist/commonjs/formatters/translateFormatter.js.map +++ b/dist/commonjs/formatters/translateFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":";;AACA,6CAAoC;AAEpC,2HAA2H;AAC9G,QAAA,kBAAkB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;IACjI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7H,MAAM,IAAI,KAAK,CAAC,wNACsE,CAAC,CAAC;IAC1F,CAAC;IAED,IAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAEvD,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1C,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":";;AAEA,2HAA2H;AAC9G,QAAA,kBAAkB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;IACjI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,oNACsE,CAAC,CAAC;IAC1F,CAAC;IAED,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/es2015/formatters/translateBooleanFormatter.js b/dist/es2015/formatters/translateBooleanFormatter.js index b291a2093..5ea67a6be 100644 --- a/dist/es2015/formatters/translateBooleanFormatter.js +++ b/dist/es2015/formatters/translateBooleanFormatter.js @@ -1,18 +1,17 @@ -import { I18N } from 'aurelia-i18n'; /** Takes a boolean value, cast it to upperCase string and finally translates (i18n) it */ export const translateBooleanFormatter = (row, cell, value, columnDef, dataContext, grid) => { const gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; const columnParams = columnDef.params || {}; const gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof I18N))) { - throw new Error(`The translate formatter requires the "I18N" Service to be provided as a Column Definition params or a Grid Option params. + const i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error(`The translate formatter requires the "I18N" Service to be provided as a Grid Options or Column Definition "params". For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}`); } - const translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value.toUpperCase()) : ''; + return value ? i18n.tr(value.toUpperCase()) : ''; }; //# sourceMappingURL=translateBooleanFormatter.js.map \ No newline at end of file diff --git a/dist/es2015/formatters/translateBooleanFormatter.js.map b/dist/es2015/formatters/translateBooleanFormatter.js.map index 74154ada8..d2be1ec1d 100644 --- a/dist/es2015/formatters/translateBooleanFormatter.js.map +++ b/dist/es2015/formatters/translateBooleanFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,yBAAyB,GAAc,CAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS,EAAE,EAAE;IAC5I,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7H,MAAM,IAAI,KAAK,CAAC;0FACsE,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAEvD,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClE,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":"AAGA,0FAA0F;AAC1F,MAAM,CAAC,MAAM,yBAAyB,GAAc,CAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS,EAAE,EAAE;IAC5I,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC;0FACsE,CAAC,CAAC;IAC1F,CAAC;IAED,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7D,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/es2015/formatters/translateFormatter.js b/dist/es2015/formatters/translateFormatter.js index 6875973b9..fda6884ed 100644 --- a/dist/es2015/formatters/translateFormatter.js +++ b/dist/es2015/formatters/translateFormatter.js @@ -1,18 +1,17 @@ -import { I18N } from 'aurelia-i18n'; /** Takes a cell value and translates it (i18n). Requires an instance of the I18N Service:: `params: { i18n: this.i18n } */ export const translateFormatter = (row, cell, value, columnDef, dataContext, grid) => { const gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; const columnParams = columnDef.params || {}; const gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof I18N))) { - throw new Error(`The translate formatter requires the "I18N" Service to be provided as a Column Definition params or a Grid Option params. + const i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error(`The translate formatter requires the "I18N" Service to be provided as a Grid Options or Column Definition "params". For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}`); } - const translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value) : ''; + return value ? i18n.tr(value) : ''; }; //# sourceMappingURL=translateFormatter.js.map \ No newline at end of file diff --git a/dist/es2015/formatters/translateFormatter.js.map b/dist/es2015/formatters/translateFormatter.js.map index b0d0d3ffd..ee1cb6bb2 100644 --- a/dist/es2015/formatters/translateFormatter.js.map +++ b/dist/es2015/formatters/translateFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,2HAA2H;AAC3H,MAAM,CAAC,MAAM,kBAAkB,GAAc,CAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS,EAAE,EAAE;IACrI,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7H,MAAM,IAAI,KAAK,CAAC;0FACsE,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAEvD,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1C,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":"AAEA,2HAA2H;AAC3H,MAAM,CAAC,MAAM,kBAAkB,GAAc,CAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS,EAAE,EAAE;IACrI,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC;0FACsE,CAAC,CAAC;IAC1F,CAAC;IAED,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/es2017/formatters/translateBooleanFormatter.js b/dist/es2017/formatters/translateBooleanFormatter.js index b291a2093..5ea67a6be 100644 --- a/dist/es2017/formatters/translateBooleanFormatter.js +++ b/dist/es2017/formatters/translateBooleanFormatter.js @@ -1,18 +1,17 @@ -import { I18N } from 'aurelia-i18n'; /** Takes a boolean value, cast it to upperCase string and finally translates (i18n) it */ export const translateBooleanFormatter = (row, cell, value, columnDef, dataContext, grid) => { const gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; const columnParams = columnDef.params || {}; const gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof I18N))) { - throw new Error(`The translate formatter requires the "I18N" Service to be provided as a Column Definition params or a Grid Option params. + const i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error(`The translate formatter requires the "I18N" Service to be provided as a Grid Options or Column Definition "params". For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}`); } - const translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value.toUpperCase()) : ''; + return value ? i18n.tr(value.toUpperCase()) : ''; }; //# sourceMappingURL=translateBooleanFormatter.js.map \ No newline at end of file diff --git a/dist/es2017/formatters/translateBooleanFormatter.js.map b/dist/es2017/formatters/translateBooleanFormatter.js.map index 74154ada8..d2be1ec1d 100644 --- a/dist/es2017/formatters/translateBooleanFormatter.js.map +++ b/dist/es2017/formatters/translateBooleanFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,yBAAyB,GAAc,CAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS,EAAE,EAAE;IAC5I,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7H,MAAM,IAAI,KAAK,CAAC;0FACsE,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAEvD,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClE,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":"AAGA,0FAA0F;AAC1F,MAAM,CAAC,MAAM,yBAAyB,GAAc,CAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS,EAAE,EAAE;IAC5I,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC;0FACsE,CAAC,CAAC;IAC1F,CAAC;IAED,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7D,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/es2017/formatters/translateFormatter.js b/dist/es2017/formatters/translateFormatter.js index 6875973b9..fda6884ed 100644 --- a/dist/es2017/formatters/translateFormatter.js +++ b/dist/es2017/formatters/translateFormatter.js @@ -1,18 +1,17 @@ -import { I18N } from 'aurelia-i18n'; /** Takes a cell value and translates it (i18n). Requires an instance of the I18N Service:: `params: { i18n: this.i18n } */ export const translateFormatter = (row, cell, value, columnDef, dataContext, grid) => { const gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; const columnParams = columnDef.params || {}; const gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof I18N))) { - throw new Error(`The translate formatter requires the "I18N" Service to be provided as a Column Definition params or a Grid Option params. + const i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error(`The translate formatter requires the "I18N" Service to be provided as a Grid Options or Column Definition "params". For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}`); } - const translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value) : ''; + return value ? i18n.tr(value) : ''; }; //# sourceMappingURL=translateFormatter.js.map \ No newline at end of file diff --git a/dist/es2017/formatters/translateFormatter.js.map b/dist/es2017/formatters/translateFormatter.js.map index b0d0d3ffd..ee1cb6bb2 100644 --- a/dist/es2017/formatters/translateFormatter.js.map +++ b/dist/es2017/formatters/translateFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,2HAA2H;AAC3H,MAAM,CAAC,MAAM,kBAAkB,GAAc,CAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS,EAAE,EAAE;IACrI,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7H,MAAM,IAAI,KAAK,CAAC;0FACsE,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAEvD,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1C,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":"AAEA,2HAA2H;AAC3H,MAAM,CAAC,MAAM,kBAAkB,GAAc,CAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS,EAAE,EAAE;IACrI,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC;0FACsE,CAAC,CAAC;IAC1F,CAAC;IAED,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/native-modules/formatters/translateBooleanFormatter.js b/dist/native-modules/formatters/translateBooleanFormatter.js index 882413fc8..1de6d9b89 100644 --- a/dist/native-modules/formatters/translateBooleanFormatter.js +++ b/dist/native-modules/formatters/translateBooleanFormatter.js @@ -1,17 +1,16 @@ -import { I18N } from 'aurelia-i18n'; /** Takes a boolean value, cast it to upperCase string and finally translates (i18n) it */ export var translateBooleanFormatter = function (row, cell, value, columnDef, dataContext, grid) { var gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; var columnParams = columnDef.params || {}; var gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof I18N))) { - throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Column Definition params or a Grid Option params.\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); + var i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Grid Options or Column Definition \"params\".\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); } - var translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value.toUpperCase()) : ''; + return value ? i18n.tr(value.toUpperCase()) : ''; }; //# sourceMappingURL=translateBooleanFormatter.js.map \ No newline at end of file diff --git a/dist/native-modules/formatters/translateBooleanFormatter.js.map b/dist/native-modules/formatters/translateBooleanFormatter.js.map index 7409d4d41..1df4d2388 100644 --- a/dist/native-modules/formatters/translateBooleanFormatter.js.map +++ b/dist/native-modules/formatters/translateBooleanFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,0FAA0F;AAC1F,MAAM,CAAC,IAAM,yBAAyB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;IACxI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7H,MAAM,IAAI,KAAK,CAAC,wNACsE,CAAC,CAAC;IAC1F,CAAC;IAED,IAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAEvD,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClE,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":"AAGA,0FAA0F;AAC1F,MAAM,CAAC,IAAM,yBAAyB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;IACxI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,oNACsE,CAAC,CAAC;IAC1F,CAAC;IAED,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7D,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/native-modules/formatters/translateFormatter.js b/dist/native-modules/formatters/translateFormatter.js index 2cf1485c2..ebe149651 100644 --- a/dist/native-modules/formatters/translateFormatter.js +++ b/dist/native-modules/formatters/translateFormatter.js @@ -1,17 +1,16 @@ -import { I18N } from 'aurelia-i18n'; /** Takes a cell value and translates it (i18n). Requires an instance of the I18N Service:: `params: { i18n: this.i18n } */ export var translateFormatter = function (row, cell, value, columnDef, dataContext, grid) { var gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; var columnParams = columnDef.params || {}; var gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof I18N))) { - throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Column Definition params or a Grid Option params.\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); + var i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Grid Options or Column Definition \"params\".\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); } - var translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value) : ''; + return value ? i18n.tr(value) : ''; }; //# sourceMappingURL=translateFormatter.js.map \ No newline at end of file diff --git a/dist/native-modules/formatters/translateFormatter.js.map b/dist/native-modules/formatters/translateFormatter.js.map index 85143e8c9..71d26186b 100644 --- a/dist/native-modules/formatters/translateFormatter.js.map +++ b/dist/native-modules/formatters/translateFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,2HAA2H;AAC3H,MAAM,CAAC,IAAM,kBAAkB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;IACjI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7H,MAAM,IAAI,KAAK,CAAC,wNACsE,CAAC,CAAC;IAC1F,CAAC;IAED,IAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAEvD,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1C,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":"AAEA,2HAA2H;AAC3H,MAAM,CAAC,IAAM,kBAAkB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;IACjI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;IAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,oNACsE,CAAC,CAAC;IAC1F,CAAC;IAED,qFAAqF;IACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/system/formatters/translateBooleanFormatter.js b/dist/system/formatters/translateBooleanFormatter.js index 64872cf4f..35bcc2df3 100644 --- a/dist/system/formatters/translateBooleanFormatter.js +++ b/dist/system/formatters/translateBooleanFormatter.js @@ -1,28 +1,24 @@ -System.register(["aurelia-i18n"], function (exports_1, context_1) { +System.register([], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; - var aurelia_i18n_1, translateBooleanFormatter; + var translateBooleanFormatter; return { - setters: [ - function (aurelia_i18n_1_1) { - aurelia_i18n_1 = aurelia_i18n_1_1; - } - ], + setters: [], execute: function () { /** Takes a boolean value, cast it to upperCase string and finally translates (i18n) it */ exports_1("translateBooleanFormatter", translateBooleanFormatter = function (row, cell, value, columnDef, dataContext, grid) { var gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; var columnParams = columnDef.params || {}; var gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof aurelia_i18n_1.I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof aurelia_i18n_1.I18N))) { - throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Column Definition params or a Grid Option params.\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); + var i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Grid Options or Column Definition \"params\".\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); } - var translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value.toUpperCase()) : ''; + return value ? i18n.tr(value.toUpperCase()) : ''; }); } }; diff --git a/dist/system/formatters/translateBooleanFormatter.js.map b/dist/system/formatters/translateBooleanFormatter.js.map index 23aacd396..40bd6ee87 100644 --- a/dist/system/formatters/translateBooleanFormatter.js.map +++ b/dist/system/formatters/translateBooleanFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":";;;;;;;;;;;YAGA,0FAA0F;YAC1F,uCAAa,yBAAyB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;gBACxI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;gBAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;gBAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC7H,MAAM,IAAI,KAAK,CAAC,wNACsE,CAAC,CAAC;gBAC1F,CAAC;gBAED,IAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;gBAEvD,qFAAqF;gBACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;oBACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;gBACrB,CAAC;gBACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAClE,CAAC,EAAC;QACF,CAAC"} \ No newline at end of file +{"version":3,"file":"translateBooleanFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateBooleanFormatter.ts"],"names":[],"mappings":";;;;;;;YAGA,0FAA0F;YAC1F,uCAAa,yBAAyB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;gBACxI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;gBAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;gBAC5C,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;gBAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;oBAC3C,MAAM,IAAI,KAAK,CAAC,oNACsE,CAAC,CAAC;gBAC1F,CAAC;gBAED,qFAAqF;gBACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;oBACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;gBACrB,CAAC;gBACD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7D,CAAC,EAAC;QACF,CAAC"} \ No newline at end of file diff --git a/dist/system/formatters/translateFormatter.js b/dist/system/formatters/translateFormatter.js index 6037835fe..66a5a8c0d 100644 --- a/dist/system/formatters/translateFormatter.js +++ b/dist/system/formatters/translateFormatter.js @@ -1,28 +1,24 @@ -System.register(["aurelia-i18n"], function (exports_1, context_1) { +System.register([], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; - var aurelia_i18n_1, translateFormatter; + var translateFormatter; return { - setters: [ - function (aurelia_i18n_1_1) { - aurelia_i18n_1 = aurelia_i18n_1_1; - } - ], + setters: [], execute: function () { /** Takes a cell value and translates it (i18n). Requires an instance of the I18N Service:: `params: { i18n: this.i18n } */ exports_1("translateFormatter", translateFormatter = function (row, cell, value, columnDef, dataContext, grid) { var gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; var columnParams = columnDef.params || {}; var gridParams = gridOptions.params || {}; - if ((!columnParams.i18n || !(columnParams.i18n instanceof aurelia_i18n_1.I18N)) && (!gridParams.i18n || !(gridParams.i18n instanceof aurelia_i18n_1.I18N))) { - throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Column Definition params or a Grid Option params.\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); + var i18n = gridParams.i18n || columnParams.i18n; + if (!i18n || typeof i18n.tr !== 'function') { + throw new Error("The translate formatter requires the \"I18N\" Service to be provided as a Grid Options or Column Definition \"params\".\n For example: this.gridOptions = { enableTranslate: true, params: { i18n: this.i18n }}"); } - var translate = gridParams.i18n || columnParams.i18n; // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && typeof value !== 'string') { value = value + ''; } - return value ? translate.tr(value) : ''; + return value ? i18n.tr(value) : ''; }); } }; diff --git a/dist/system/formatters/translateFormatter.js.map b/dist/system/formatters/translateFormatter.js.map index fce0ffb04..0ed6884a7 100644 --- a/dist/system/formatters/translateFormatter.js.map +++ b/dist/system/formatters/translateFormatter.js.map @@ -1 +1 @@ -{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":";;;;;;;;;;;YAGA,2HAA2H;YAC3H,gCAAa,kBAAkB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;gBACjI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;gBAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;gBAE5C,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,YAAY,mBAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC7H,MAAM,IAAI,KAAK,CAAC,wNACsE,CAAC,CAAC;gBAC1F,CAAC;gBAED,IAAM,SAAS,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;gBAEvD,qFAAqF;gBACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;oBACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;gBACrB,CAAC;gBAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1C,CAAC,EAAC;QACF,CAAC"} \ No newline at end of file +{"version":3,"file":"translateFormatter.js","sourceRoot":"","sources":["../../../aurelia-slickgrid/src/aurelia-slickgrid/formatters/translateFormatter.ts"],"names":[],"mappings":";;;;;;;YAEA,2HAA2H;YAC3H,gCAAa,kBAAkB,GAAc,UAAC,GAAW,EAAE,IAAY,EAAE,KAAU,EAAE,SAAiB,EAAE,WAAgB,EAAE,IAAS;gBACjI,IAAM,WAAW,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7F,IAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;gBAC5C,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;gBAC5C,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC;gBAElD,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC;oBAC3C,MAAM,IAAI,KAAK,CAAC,oNACsE,CAAC,CAAC;gBAC1F,CAAC;gBAED,qFAAqF;gBACrF,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;oBACrD,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC;gBACrB,CAAC;gBAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACrC,CAAC,EAAC;QACF,CAAC"} \ No newline at end of file