@zeedhi/common 1.82.0 → 1.83.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.
@@ -4,6 +4,7 @@ import cloneDeep from 'lodash.clonedeep';
4
4
  import debounce from 'lodash.debounce';
5
5
  import isUndefined from 'lodash.isundefined';
6
6
  import set from 'lodash.set';
7
+ import omit from 'lodash.omit';
7
8
  import get from 'lodash.get';
8
9
 
9
10
  /**
@@ -564,7 +565,7 @@ class ApexChart extends ComponentRender {
564
565
  return series;
565
566
  }
566
567
  translateOptions(propOptions = {}) {
567
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
568
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
568
569
  let value;
569
570
  value = this.getPropValue((_c = (_b = (_a = propOptions.annotations) === null || _a === void 0 ? void 0 : _a.yaxis) === null || _b === void 0 ? void 0 : _b.label) === null || _c === void 0 ? void 0 : _c.text);
570
571
  if (value)
@@ -607,6 +608,10 @@ class ApexChart extends ComponentRender {
607
608
  value = this.getPropValue((_y = propOptions.noData) === null || _y === void 0 ? void 0 : _y.text);
608
609
  if (value)
609
610
  propOptions.noData.text = I18n.translate(value);
611
+ value = this.getPropValue((_1 = (_0 = (_z = propOptions.chart) === null || _z === void 0 ? void 0 : _z.toolbar) === null || _0 === void 0 ? void 0 : _0.tools) === null || _1 === void 0 ? void 0 : _1.customIcons);
612
+ if (value && Array.isArray(value)) {
613
+ propOptions.chart.toolbar.tools.customIcons = value.map((item) => (Object.assign(Object.assign({}, item), { title: item.title ? I18n.translate(item.title) : item.title })));
614
+ }
610
615
  return propOptions;
611
616
  }
612
617
  /**
@@ -2852,9 +2857,15 @@ class Number$1 extends TextInput {
2852
2857
  }
2853
2858
  else {
2854
2859
  this.formattedValue = value;
2855
- if (this.autoNumericObj) {
2856
- this.localValue = parseFloat(this.autoNumericObj.rawValue);
2860
+ if (!this.autoNumericObj)
2861
+ return;
2862
+ const parsed = parseFloat(this.autoNumericObj.rawValue);
2863
+ if (window.Number.isNaN(parsed)) {
2864
+ this.localValue = undefined;
2865
+ this.autoNumericObj.clear();
2866
+ return;
2857
2867
  }
2868
+ this.localValue = parsed;
2858
2869
  }
2859
2870
  }
2860
2871
  /**
@@ -4795,7 +4806,7 @@ class FileInput extends TextInput {
4795
4806
  this.selectFileButton = {
4796
4807
  name: 'select-file-button',
4797
4808
  component: 'ZdButton',
4798
- label: 'Select files from computer',
4809
+ label: 'SELECT_FILE',
4799
4810
  color: 'primary',
4800
4811
  small: true,
4801
4812
  cssClass: 'zd-mt-1',
@@ -4836,7 +4847,7 @@ class FileInput extends TextInput {
4836
4847
  if (Array.isArray(this.value) && this.maxFiles && this.value.length > +this.maxFiles) {
4837
4848
  this.value.splice(+this.maxFiles);
4838
4849
  AlertService.show({
4839
- text: `You cannot choose more than ${this.maxFiles} file(s).`,
4850
+ text: I18n.translate('MAX_FILES', { limit: this.maxFiles }),
4840
4851
  name: 'max-files-alert',
4841
4852
  color: 'error',
4842
4853
  });
@@ -5745,9 +5756,11 @@ const toggleableFormatter = ({ value, componentProps }) => {
5745
5756
  const trueDefined = isUndefined(trueValue) ? true : trueValue;
5746
5757
  const falseDefined = isUndefined(falseValue) ? false : falseValue;
5747
5758
  if (value === trueDefined) {
5748
- return trueIcon || trueDisplayValue || trueDefined;
5759
+ const display = trueDisplayValue ? I18n.translate(trueDisplayValue) : trueDisplayValue;
5760
+ return trueIcon || display || trueDefined;
5749
5761
  }
5750
- return falseIcon || falseDisplayValue || falseDefined;
5762
+ const display = falseDisplayValue ? I18n.translate(falseDisplayValue) : falseDisplayValue;
5763
+ return falseIcon || display || falseDefined;
5751
5764
  };
5752
5765
  FormatterParserProvider.registerFormatter('column_ZdCheckbox', toggleableFormatter);
5753
5766
  FormatterParserProvider.registerFormatter('column_ZdSwitch', toggleableFormatter);
@@ -6531,7 +6544,7 @@ class GridEditable extends Grid {
6531
6544
  if (!Utils.isEqual(value, row[columnName])) {
6532
6545
  const newRow = {};
6533
6546
  newRow[key] = Object.assign({}, this.editedRows[key]);
6534
- newRow[key].originalRow = Object.assign({}, row);
6547
+ newRow[key].originalRow = omit(row, 'originalRow');
6535
6548
  newRow[key][columnName] = value;
6536
6549
  newRow[key][`${columnName}_original`] = row[columnName];
6537
6550
  if (component)
@@ -6551,8 +6564,9 @@ class GridEditable extends Grid {
6551
6564
  }
6552
6565
  }
6553
6566
  updateOriginalRow(key, row) {
6554
- if (this.editedRows[key] !== undefined)
6555
- this.editedRows[key].originalRow = row;
6567
+ if (this.editedRows[key] !== undefined) {
6568
+ this.editedRows[key].originalRow = omit(row, 'originalRow');
6569
+ }
6556
6570
  }
6557
6571
  /**
6558
6572
  * Checks if column is edited
@@ -12937,7 +12951,7 @@ class TreeGridEditable extends TreeGrid {
12937
12951
  }
12938
12952
  updateOriginalRow(key, row) {
12939
12953
  if (this.editedRows[key] !== undefined)
12940
- this.editedRows[key].originalRow = row;
12954
+ this.editedRows[key].originalRow = omit(row, 'originalRow');
12941
12955
  }
12942
12956
  checkLookupData(column, row, componentProps) {
12943
12957
  if (row[column.name] && column.lookupData && componentProps.datasource) {
@@ -12964,7 +12978,7 @@ class TreeGridEditable extends TreeGrid {
12964
12978
  if (!Utils.isEqual(value, row[columnName])) {
12965
12979
  const newRow = {};
12966
12980
  newRow[key] = Object.assign({}, this.editedRows[key]);
12967
- newRow[key].originalRow = Object.assign({}, row);
12981
+ newRow[key].originalRow = omit(row, 'originalRow');
12968
12982
  newRow[key][columnName] = value;
12969
12983
  newRow[key][`${columnName}_original`] = row[columnName];
12970
12984
  if (component)
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/core'), require('lodash.merge'), require('lodash.clonedeep'), require('lodash.debounce'), require('lodash.isundefined'), require('lodash.set'), require('lodash.get')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/core', 'lodash.merge', 'lodash.clonedeep', 'lodash.debounce', 'lodash.isundefined', 'lodash.set', 'lodash.get'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/common"] = {}, global.core, global.merge, global.cloneDeep, global.debounce, global.isUndefined, global.set, global.get));
5
- })(this, (function (exports, core, merge, cloneDeep, debounce, isUndefined, set, get) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/core'), require('lodash.merge'), require('lodash.clonedeep'), require('lodash.debounce'), require('lodash.isundefined'), require('lodash.set'), require('lodash.omit'), require('lodash.get')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/core', 'lodash.merge', 'lodash.clonedeep', 'lodash.debounce', 'lodash.isundefined', 'lodash.set', 'lodash.omit', 'lodash.get'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/common"] = {}, global.core, global.merge, global.cloneDeep, global.debounce, global.isUndefined, global.set, global.omit, global.get));
5
+ })(this, (function (exports, core, merge, cloneDeep, debounce, isUndefined, set, omit, get) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -11,6 +11,7 @@
11
11
  var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
12
12
  var isUndefined__default = /*#__PURE__*/_interopDefaultLegacy(isUndefined);
13
13
  var set__default = /*#__PURE__*/_interopDefaultLegacy(set);
14
+ var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
14
15
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
15
16
 
16
17
  /**
@@ -571,7 +572,7 @@
571
572
  return series;
572
573
  }
573
574
  translateOptions(propOptions = {}) {
574
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
575
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
575
576
  let value;
576
577
  value = this.getPropValue((_c = (_b = (_a = propOptions.annotations) === null || _a === void 0 ? void 0 : _a.yaxis) === null || _b === void 0 ? void 0 : _b.label) === null || _c === void 0 ? void 0 : _c.text);
577
578
  if (value)
@@ -614,6 +615,10 @@
614
615
  value = this.getPropValue((_y = propOptions.noData) === null || _y === void 0 ? void 0 : _y.text);
615
616
  if (value)
616
617
  propOptions.noData.text = core.I18n.translate(value);
618
+ value = this.getPropValue((_1 = (_0 = (_z = propOptions.chart) === null || _z === void 0 ? void 0 : _z.toolbar) === null || _0 === void 0 ? void 0 : _0.tools) === null || _1 === void 0 ? void 0 : _1.customIcons);
619
+ if (value && Array.isArray(value)) {
620
+ propOptions.chart.toolbar.tools.customIcons = value.map((item) => (Object.assign(Object.assign({}, item), { title: item.title ? core.I18n.translate(item.title) : item.title })));
621
+ }
617
622
  return propOptions;
618
623
  }
619
624
  /**
@@ -2859,9 +2864,15 @@
2859
2864
  }
2860
2865
  else {
2861
2866
  this.formattedValue = value;
2862
- if (this.autoNumericObj) {
2863
- this.localValue = parseFloat(this.autoNumericObj.rawValue);
2867
+ if (!this.autoNumericObj)
2868
+ return;
2869
+ const parsed = parseFloat(this.autoNumericObj.rawValue);
2870
+ if (window.Number.isNaN(parsed)) {
2871
+ this.localValue = undefined;
2872
+ this.autoNumericObj.clear();
2873
+ return;
2864
2874
  }
2875
+ this.localValue = parsed;
2865
2876
  }
2866
2877
  }
2867
2878
  /**
@@ -4802,7 +4813,7 @@
4802
4813
  this.selectFileButton = {
4803
4814
  name: 'select-file-button',
4804
4815
  component: 'ZdButton',
4805
- label: 'Select files from computer',
4816
+ label: 'SELECT_FILE',
4806
4817
  color: 'primary',
4807
4818
  small: true,
4808
4819
  cssClass: 'zd-mt-1',
@@ -4843,7 +4854,7 @@
4843
4854
  if (Array.isArray(this.value) && this.maxFiles && this.value.length > +this.maxFiles) {
4844
4855
  this.value.splice(+this.maxFiles);
4845
4856
  AlertService.show({
4846
- text: `You cannot choose more than ${this.maxFiles} file(s).`,
4857
+ text: core.I18n.translate('MAX_FILES', { limit: this.maxFiles }),
4847
4858
  name: 'max-files-alert',
4848
4859
  color: 'error',
4849
4860
  });
@@ -5752,9 +5763,11 @@
5752
5763
  const trueDefined = isUndefined__default["default"](trueValue) ? true : trueValue;
5753
5764
  const falseDefined = isUndefined__default["default"](falseValue) ? false : falseValue;
5754
5765
  if (value === trueDefined) {
5755
- return trueIcon || trueDisplayValue || trueDefined;
5766
+ const display = trueDisplayValue ? core.I18n.translate(trueDisplayValue) : trueDisplayValue;
5767
+ return trueIcon || display || trueDefined;
5756
5768
  }
5757
- return falseIcon || falseDisplayValue || falseDefined;
5769
+ const display = falseDisplayValue ? core.I18n.translate(falseDisplayValue) : falseDisplayValue;
5770
+ return falseIcon || display || falseDefined;
5758
5771
  };
5759
5772
  core.FormatterParserProvider.registerFormatter('column_ZdCheckbox', toggleableFormatter);
5760
5773
  core.FormatterParserProvider.registerFormatter('column_ZdSwitch', toggleableFormatter);
@@ -6538,7 +6551,7 @@
6538
6551
  if (!core.Utils.isEqual(value, row[columnName])) {
6539
6552
  const newRow = {};
6540
6553
  newRow[key] = Object.assign({}, this.editedRows[key]);
6541
- newRow[key].originalRow = Object.assign({}, row);
6554
+ newRow[key].originalRow = omit__default["default"](row, 'originalRow');
6542
6555
  newRow[key][columnName] = value;
6543
6556
  newRow[key][`${columnName}_original`] = row[columnName];
6544
6557
  if (component)
@@ -6558,8 +6571,9 @@
6558
6571
  }
6559
6572
  }
6560
6573
  updateOriginalRow(key, row) {
6561
- if (this.editedRows[key] !== undefined)
6562
- this.editedRows[key].originalRow = row;
6574
+ if (this.editedRows[key] !== undefined) {
6575
+ this.editedRows[key].originalRow = omit__default["default"](row, 'originalRow');
6576
+ }
6563
6577
  }
6564
6578
  /**
6565
6579
  * Checks if column is edited
@@ -12944,7 +12958,7 @@
12944
12958
  }
12945
12959
  updateOriginalRow(key, row) {
12946
12960
  if (this.editedRows[key] !== undefined)
12947
- this.editedRows[key].originalRow = row;
12961
+ this.editedRows[key].originalRow = omit__default["default"](row, 'originalRow');
12948
12962
  }
12949
12963
  checkLookupData(column, row, componentProps) {
12950
12964
  if (row[column.name] && column.lookupData && componentProps.datasource) {
@@ -12971,7 +12985,7 @@
12971
12985
  if (!core.Utils.isEqual(value, row[columnName])) {
12972
12986
  const newRow = {};
12973
12987
  newRow[key] = Object.assign({}, this.editedRows[key]);
12974
- newRow[key].originalRow = Object.assign({}, row);
12988
+ newRow[key].originalRow = omit__default["default"](row, 'originalRow');
12975
12989
  newRow[key][columnName] = value;
12976
12990
  newRow[key][`${columnName}_original`] = row[columnName];
12977
12991
  if (component)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.82.0",
3
+ "version": "1.83.0",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -26,6 +26,7 @@
26
26
  "lodash.get": "4.4.*",
27
27
  "lodash.isundefined": "3.0.*",
28
28
  "lodash.merge": "4.6.*",
29
+ "lodash.omit": "^4.5.*",
29
30
  "lodash.set": "4.3.*"
30
31
  },
31
32
  "peerDependencies": {
@@ -36,10 +37,11 @@
36
37
  "@types/lodash.get": "4.4.*",
37
38
  "@types/lodash.isundefined": "3.0.*",
38
39
  "@types/lodash.merge": "4.6.*",
40
+ "@types/lodash.omit": "^4.5.*",
39
41
  "@types/lodash.set": "4.3.*",
40
42
  "@types/lodash.times": "4.3.*",
41
43
  "lodash.times": "4.3.*",
42
44
  "mockdate": "3.0.*"
43
45
  },
44
- "gitHead": "d0af176b021f44fcab43a0616bb82110c2cf1337"
46
+ "gitHead": "40cb1a2c5fe9d6ebb8d5ceb0add7e08f26cf5659"
45
47
  }
@@ -26,6 +26,10 @@ export declare class GridColumn extends Column implements IGridColumn {
26
26
  events?: import("..").IComponentEvents<import("@zeedhi/core").IEventParam<any>> | undefined;
27
27
  directives?: import("..").IComponentDirectives | undefined;
28
28
  isVisible?: string | boolean | undefined;
29
+ /**
30
+ * Creates a new Grid Column.
31
+ * @param props Grid column properties
32
+ */
29
33
  dark?: boolean | undefined;
30
34
  light?: boolean | undefined;
31
35
  keyMap?: import("@zeedhi/core").IKeyMap<import("@zeedhi/core").IEventParam<any>> | undefined;