@theseam/ui-common 0.2.14 → 0.2.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/bundles/theseam-ui-common-datatable.umd.js +3 -8
  2. package/bundles/theseam-ui-common-datatable.umd.js.map +1 -1
  3. package/bundles/theseam-ui-common-table-cell-types.umd.js +89 -4
  4. package/bundles/theseam-ui-common-table-cell-types.umd.js.map +1 -1
  5. package/bundles/theseam-ui-common-testing.umd.js.map +1 -1
  6. package/bundles/theseam-ui-common-utils.umd.js.map +1 -1
  7. package/datatable/datatable-column-preferences/datatable-column-preferences.component.d.ts +0 -1
  8. package/datatable/theseam-ui-common-datatable.metadata.json +1 -1
  9. package/esm2015/datatable/datatable-column-preferences/datatable-column-preferences.component.js +4 -10
  10. package/esm2015/datatable/datatable-export-button/datatable-export-button.component.js +4 -2
  11. package/esm2015/datatable/models/columns-alteration.js +1 -1
  12. package/esm2015/datatable/models/columns-alterations/hide-column.columns-alteration.js +1 -1
  13. package/esm2015/datatable/models/columns-alterations/sort.columns-alteration.js +1 -1
  14. package/esm2015/datatable/models/columns-alterations/width.columns-alteration.js +1 -1
  15. package/esm2015/datatable/models/internal-column-props.js +1 -1
  16. package/esm2015/datatable/services/columns-alterations-manager.service.js +1 -1
  17. package/esm2015/datatable/utils/map-columns-alterations-states.js +1 -1
  18. package/esm2015/graphql/models/gql-datatable-accessor.js +1 -1
  19. package/esm2015/table-cell-types/table-cell-type-currency/table-cell-type-currency-config.js +1 -1
  20. package/esm2015/table-cell-types/table-cell-type-currency/table-cell-type-currency.component.js +17 -2
  21. package/esm2015/table-cell-types/table-cell-type-decimal/table-cell-type-decimal-config.js +1 -1
  22. package/esm2015/table-cell-types/table-cell-type-decimal/table-cell-type-decimal.component.js +16 -2
  23. package/esm2015/table-cell-types/table-cell-type-integer/table-cell-type-integer-config.js +1 -1
  24. package/esm2015/table-cell-types/table-cell-type-integer/table-cell-type-integer.component.js +16 -2
  25. package/esm2015/table-cell-types/table-cell-type-string/table-cell-type-string-config.js +1 -1
  26. package/esm2015/table-cell-types/table-cell-type-string/table-cell-type-string.component.js +32 -4
  27. package/esm2015/testing/current-tick-time.js +1 -1
  28. package/esm2015/utils/array-move.js +1 -1
  29. package/esm2015/utils/router/is-empty-url-route.js +1 -1
  30. package/fesm2015/theseam-ui-common-datatable.js +3 -8
  31. package/fesm2015/theseam-ui-common-datatable.js.map +1 -1
  32. package/fesm2015/theseam-ui-common-table-cell-types.js +74 -5
  33. package/fesm2015/theseam-ui-common-table-cell-types.js.map +1 -1
  34. package/fesm2015/theseam-ui-common-testing.js.map +1 -1
  35. package/fesm2015/theseam-ui-common-utils.js.map +1 -1
  36. package/package.json +1 -1
  37. package/table-cell-types/table-cell-type-currency/table-cell-type-currency-config.d.ts +5 -0
  38. package/table-cell-types/table-cell-type-decimal/table-cell-type-decimal-config.d.ts +5 -0
  39. package/table-cell-types/table-cell-type-integer/table-cell-type-integer-config.d.ts +5 -0
  40. package/table-cell-types/table-cell-type-string/table-cell-type-string-config.d.ts +8 -0
  41. package/table-cell-types/table-cell-type-string/table-cell-type-string.component.d.ts +9 -0
  42. package/table-cell-types/theseam-ui-common-table-cell-types.metadata.json +1 -1
@@ -43,11 +43,24 @@
43
43
  TableCellTypeCurrencyComponent.prototype._formatCurrency = function (currentValue, tableData) {
44
44
  var _a;
45
45
  var config = (_a = tableData === null || tableData === void 0 ? void 0 : tableData.colData) === null || _a === void 0 ? void 0 : _a.cellTypeConfig;
46
+ var defaultToEmpty = utils.notNullOrUndefined(config === null || config === void 0 ? void 0 : config.defaultToEmpty) ?
47
+ this._parseConfigValue(coercion.coerceBooleanProperty(config === null || config === void 0 ? void 0 : config.defaultToEmpty), tableData) : true;
48
+ var valueIsNumeric = utils.isNumeric(currentValue);
49
+ if (!valueIsNumeric) {
50
+ if (defaultToEmpty) {
51
+ // return empty string instead of $0 when currentValue is empty or unparseable
52
+ return '';
53
+ }
54
+ else {
55
+ // set non-numeric value to 0 so it can be formatted the same as other numbers
56
+ currentValue = 0;
57
+ }
58
+ }
46
59
  var locale = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.locale, tableData) || 'en-US';
47
60
  var currency = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.currency, tableData) || '$';
48
61
  var currencyCode = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.currencyCode, tableData) || 'USD';
49
62
  var minIntegerDigits = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.minIntegerDigits, tableData) || 1;
50
- var minFractionDigits = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.minFractionDigits, tableData) || 0;
63
+ var minFractionDigits = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.minFractionDigits, tableData) || 2;
51
64
  var maxFractionDigits = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.maxFractionDigits, tableData) || 2;
52
65
  var format = minIntegerDigits + "." + minFractionDigits + "-" + maxFractionDigits;
53
66
  return common.formatCurrency(currentValue, locale, currency, currencyCode, format);
@@ -165,8 +178,22 @@
165
178
  TableCellTypeDecimalComponent.prototype._formatDecimal = function (currentValue, tableData) {
166
179
  var _a;
167
180
  var config = (_a = tableData === null || tableData === void 0 ? void 0 : tableData.colData) === null || _a === void 0 ? void 0 : _a.cellTypeConfig;
181
+ var defaultToEmpty = utils.notNullOrUndefined(config === null || config === void 0 ? void 0 : config.defaultToEmpty) ?
182
+ this._parseConfigValue(coercion.coerceBooleanProperty(config === null || config === void 0 ? void 0 : config.defaultToEmpty), tableData) : true;
168
183
  var formatDecimal = utils.notNullOrUndefined(config === null || config === void 0 ? void 0 : config.formatNumber) ?
169
184
  this._parseConfigValue(coercion.coerceBooleanProperty(config === null || config === void 0 ? void 0 : config.formatNumber), tableData) : true;
185
+ var valueIsNumeric = utils.isNumeric(currentValue);
186
+ // unparseable values are OK to return as long as we're not trying to format them
187
+ if (!valueIsNumeric && formatDecimal) {
188
+ if (defaultToEmpty) {
189
+ // return empty string instead of 0 when currentValue is empty or unparseable
190
+ return '';
191
+ }
192
+ else {
193
+ // set non-numeric value to 0 so it can be formatted the same as other numbers
194
+ currentValue = 0;
195
+ }
196
+ }
170
197
  var locale = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.locale, tableData) || 'en-US';
171
198
  var minIntegerDigits = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.minIntegerDigits, tableData) || 1;
172
199
  var minFractionDigits = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.minFractionDigits, tableData) || 0;
@@ -405,8 +432,22 @@
405
432
  TableCellTypeIntegerComponent.prototype._formatInteger = function (currentValue, tableData) {
406
433
  var _a;
407
434
  var config = (_a = tableData === null || tableData === void 0 ? void 0 : tableData.colData) === null || _a === void 0 ? void 0 : _a.cellTypeConfig;
435
+ var defaultToEmpty = utils.notNullOrUndefined(config === null || config === void 0 ? void 0 : config.defaultToEmpty) ?
436
+ this._parseConfigValue(coercion.coerceBooleanProperty(config === null || config === void 0 ? void 0 : config.defaultToEmpty), tableData) : true;
408
437
  var formatInteger = utils.notNullOrUndefined(config === null || config === void 0 ? void 0 : config.formatNumber) ?
409
438
  this._parseConfigValue(coercion.coerceBooleanProperty(config === null || config === void 0 ? void 0 : config.formatNumber), tableData) : true;
439
+ var valueIsNumeric = utils.isNumeric(currentValue);
440
+ // unparseable values are OK to return as long as we're not trying to format them
441
+ if (!valueIsNumeric && formatInteger) {
442
+ if (defaultToEmpty) {
443
+ // return empty string instead of 0 when currentValue is empty or unparseable
444
+ return '';
445
+ }
446
+ else {
447
+ // set non-numeric value to 0 so it can be formatted the same as other numbers
448
+ currentValue = 0;
449
+ }
450
+ }
410
451
  var locale = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.locale, tableData) || 'en-US';
411
452
  var minIntegerDigits = this._parseConfigValue(config === null || config === void 0 ? void 0 : config.minIntegerDigits, tableData) || 1;
412
453
  var format = minIntegerDigits + ".0-0";
@@ -776,7 +817,7 @@
776
817
  set: function (value) {
777
818
  this._config = value;
778
819
  if (value) {
779
- this.setAction(value.action);
820
+ this.setConfig(value);
780
821
  }
781
822
  },
782
823
  enumerable: false,
@@ -784,7 +825,7 @@
784
825
  });
785
826
  Object.defineProperty(TableCellTypeStringComponent.prototype, "title", {
786
827
  get: function () { return this._title; },
787
- set: function (value) { this.title = value; },
828
+ set: function (value) { this._title = value; },
788
829
  enumerable: false,
789
830
  configurable: true
790
831
  });
@@ -793,6 +834,28 @@
793
834
  enumerable: false,
794
835
  configurable: true
795
836
  });
837
+ Object.defineProperty(TableCellTypeStringComponent.prototype, "style", {
838
+ get: function () { return this._style; },
839
+ set: function (value) { this._style = value; },
840
+ enumerable: false,
841
+ configurable: true
842
+ });
843
+ Object.defineProperty(TableCellTypeStringComponent.prototype, "_styleAttr", {
844
+ get: function () { return this.style; },
845
+ enumerable: false,
846
+ configurable: true
847
+ });
848
+ Object.defineProperty(TableCellTypeStringComponent.prototype, "classAttr", {
849
+ get: function () { return this._class; },
850
+ set: function (value) { this._class = value; },
851
+ enumerable: false,
852
+ configurable: true
853
+ });
854
+ Object.defineProperty(TableCellTypeStringComponent.prototype, "_classAttr", {
855
+ get: function () { return this.classAttr; },
856
+ enumerable: false,
857
+ configurable: true
858
+ });
796
859
  TableCellTypeStringComponent.prototype.ngOnInit = function () {
797
860
  var _this = this;
798
861
  var _data = this._tableData;
@@ -854,6 +917,24 @@
854
917
  this._detectMimeContent = detectMimeContent;
855
918
  this._queryParams = queryParams;
856
919
  };
920
+ TableCellTypeStringComponent.prototype.setConfig = function (config) {
921
+ if (!config) {
922
+ return;
923
+ }
924
+ var title = this._parseConfigValue(config.titleAttr);
925
+ if (title) {
926
+ this.title = title;
927
+ }
928
+ var style = this._parseConfigValue(config.styleAttr);
929
+ if (style) {
930
+ this.style = style;
931
+ }
932
+ var classAttr = this._parseConfigValue(config.classAttr);
933
+ if (classAttr) {
934
+ this.classAttr = classAttr;
935
+ }
936
+ this.setAction(config.action);
937
+ };
857
938
  TableCellTypeStringComponent.prototype._parseConfigValue = function (val) {
858
939
  var _this = this;
859
940
  var contextFn = function () { return _this._tableCellTypeHelpers.getValueContext(val, _this._tableCellData); };
@@ -897,7 +978,11 @@
897
978
  value: [{ type: core.Input }],
898
979
  config: [{ type: core.Input }],
899
980
  title: [{ type: core.Input }],
900
- _titleAttr: [{ type: core.HostBinding, args: ['attr.title',] }]
981
+ _titleAttr: [{ type: core.HostBinding, args: ['attr.title',] }],
982
+ style: [{ type: core.Input }],
983
+ _styleAttr: [{ type: core.HostBinding, args: ['attr.style',] }],
984
+ classAttr: [{ type: core.Input }],
985
+ _classAttr: [{ type: core.HostBinding, args: ['class',] }]
901
986
  };
902
987
 
903
988
  var ɵ0 = {