@zeedhi/common 1.96.1 → 1.96.3

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.
@@ -2004,7 +2004,8 @@ class Input extends ComponentRender {
2004
2004
  updateRules() {
2005
2005
  this.rules = Object.values(this.parsedValidations)
2006
2006
  .map((validation) => (value) => {
2007
- const testValue = value !== undefined ? value : this.value;
2007
+ const isValueDefined = value !== undefined && value !== '';
2008
+ const testValue = isValueDefined ? value : this.value;
2008
2009
  return validation(testValue);
2009
2010
  });
2010
2011
  }
@@ -4973,11 +4974,12 @@ class FileInput extends TextInput {
4973
4974
  this.rules = Object.keys(this.parsedValidations)
4974
4975
  .map((key) => {
4975
4976
  const validation = this.parsedValidations[key];
4976
- if (key !== 'maxFileSize')
4977
+ if (key !== 'maxFileSize') {
4977
4978
  return (value) => {
4978
4979
  const testValue = value !== undefined ? value : this.value;
4979
4980
  return validation(testValue);
4980
4981
  };
4982
+ }
4981
4983
  return () => {
4982
4984
  if (this.viewGetFileSizes) {
4983
4985
  const fileSizes = this.viewGetFileSizes();
@@ -5780,12 +5782,12 @@ FormatterParserProvider.registerFormatter('column_ZdSelect', ({ column, value, r
5780
5782
  const { dataText, formatterDataText, dataTextSeparator, dataValue, } = componentProps;
5781
5783
  let currentRow = row;
5782
5784
  if (dataValue) {
5785
+ const dataTextColumns = Array.isArray(dataText) ? dataText : [dataText];
5786
+ const columns = Array.isArray(formatterDataText) ? formatterDataText : [formatterDataText];
5783
5787
  if (!formatterDataText) {
5784
5788
  currentRow = column.getLookupData(dataValue, value[dataValue] || value);
5785
5789
  }
5786
- else {
5787
- const columns = Array.isArray(formatterDataText) ? formatterDataText : [formatterDataText];
5788
- const dataTextColumns = Array.isArray(dataText) ? dataText : [dataText];
5790
+ else if (columns.length === dataTextColumns.length) {
5789
5791
  const loopkupRow = {};
5790
5792
  columns.forEach((item, index) => {
5791
5793
  const dataTextValue = dataTextColumns[index];
@@ -6531,6 +6533,7 @@ class GridEditable extends Grid {
6531
6533
  active: true,
6532
6534
  },
6533
6535
  };
6536
+ this.viewEnterEdit = null;
6534
6537
  this.newRowIdentifier = '__added_row';
6535
6538
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
6536
6539
  this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
@@ -6538,6 +6541,9 @@ class GridEditable extends Grid {
6538
6541
  this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
6539
6542
  this.createAccessors();
6540
6543
  }
6544
+ setViewEnterEdit(viewEnterEdit) {
6545
+ this.viewEnterEdit = viewEnterEdit;
6546
+ }
6541
6547
  onMounted(element) {
6542
6548
  super.onMounted(element);
6543
6549
  KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
@@ -6605,6 +6611,8 @@ class GridEditable extends Grid {
6605
6611
  * @param element DOM Element
6606
6612
  */
6607
6613
  inlineEdit(row, column, event, element) {
6614
+ if (this.editing)
6615
+ return;
6608
6616
  this.editing = true;
6609
6617
  this.callEvent('inlineEdit', {
6610
6618
  event, element, row, column, component: this,
@@ -7062,6 +7070,15 @@ class GridEditable extends Grid {
7062
7070
  delete rows[foundRow[uniqueKey]];
7063
7071
  this.editedRows = rows;
7064
7072
  }
7073
+ /**
7074
+ * Makes the cell enter edit mode
7075
+ */
7076
+ enterEdit(rowKey, columnName) {
7077
+ if (!this.viewEnterEdit) {
7078
+ throw new Error('viewEnterEdit method not assigned');
7079
+ }
7080
+ this.viewEnterEdit(rowKey, columnName);
7081
+ }
7065
7082
  }
7066
7083
 
7067
7084
  /**
@@ -9750,6 +9767,18 @@ class Progress extends ComponentRender {
9750
9767
  * The percentage value for current progress
9751
9768
  */
9752
9769
  this.value = 0;
9770
+ /**
9771
+ * Sets the min width for the component
9772
+ */
9773
+ this.minWidth = 'auto';
9774
+ /**
9775
+ * Sets the max width for the component
9776
+ */
9777
+ this.maxWidth = 'auto';
9778
+ /**
9779
+ * Sets the width for the component
9780
+ */
9781
+ this.width = '100%';
9753
9782
  this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
9754
9783
  this.backgroundOpacity = this.getInitValue('backgroundOpacity', props.backgroundOpacity, this.backgroundOpacity);
9755
9784
  this.color = this.getInitValue('color', props.color, this.color);
@@ -9757,6 +9786,9 @@ class Progress extends ComponentRender {
9757
9786
  this.indeterminate = this.getInitValue('indeterminate', props.indeterminate, this.indeterminate);
9758
9787
  this.centerSlot = this.getInitValue('centerSlot', props.centerSlot, this.centerSlot);
9759
9788
  this.value = this.getInitValue('value', props.value, this.value);
9789
+ this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
9790
+ this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
9791
+ this.width = this.getInitValue('width', props.width, this.width);
9760
9792
  this.createAccessors();
9761
9793
  }
9762
9794
  }
@@ -13151,12 +13183,16 @@ class TreeGridEditable extends TreeGrid {
13151
13183
  active: true,
13152
13184
  },
13153
13185
  };
13186
+ this.viewEnterEdit = null;
13154
13187
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
13155
13188
  this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
13156
13189
  this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
13157
13190
  this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
13158
13191
  this.createAccessors();
13159
13192
  }
13193
+ setViewEnterEdit(viewEnterEdit) {
13194
+ this.viewEnterEdit = viewEnterEdit;
13195
+ }
13160
13196
  onMounted(element) {
13161
13197
  super.onMounted(element);
13162
13198
  KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
@@ -13226,6 +13262,8 @@ class TreeGridEditable extends TreeGrid {
13226
13262
  * @param element DOM Element
13227
13263
  */
13228
13264
  inlineEdit(row, column, event, element) {
13265
+ if (this.editing)
13266
+ return;
13229
13267
  this.editing = true;
13230
13268
  this.callEvent('inlineEdit', {
13231
13269
  event, element, row, column, component: this,
@@ -13600,6 +13638,15 @@ class TreeGridEditable extends TreeGrid {
13600
13638
  delete rows[foundRow[uniqueKey]];
13601
13639
  this.editedRows = rows;
13602
13640
  }
13641
+ /**
13642
+ * Makes the cell enter edit mode
13643
+ */
13644
+ enterEdit(rowKey, columnName) {
13645
+ if (!this.viewEnterEdit) {
13646
+ throw new Error('viewEnterEdit method not assigned');
13647
+ }
13648
+ this.viewEnterEdit(rowKey, columnName);
13649
+ }
13603
13650
  }
13604
13651
 
13605
13652
  class Icons {
@@ -2011,7 +2011,8 @@
2011
2011
  updateRules() {
2012
2012
  this.rules = Object.values(this.parsedValidations)
2013
2013
  .map((validation) => (value) => {
2014
- const testValue = value !== undefined ? value : this.value;
2014
+ const isValueDefined = value !== undefined && value !== '';
2015
+ const testValue = isValueDefined ? value : this.value;
2015
2016
  return validation(testValue);
2016
2017
  });
2017
2018
  }
@@ -4980,11 +4981,12 @@
4980
4981
  this.rules = Object.keys(this.parsedValidations)
4981
4982
  .map((key) => {
4982
4983
  const validation = this.parsedValidations[key];
4983
- if (key !== 'maxFileSize')
4984
+ if (key !== 'maxFileSize') {
4984
4985
  return (value) => {
4985
4986
  const testValue = value !== undefined ? value : this.value;
4986
4987
  return validation(testValue);
4987
4988
  };
4989
+ }
4988
4990
  return () => {
4989
4991
  if (this.viewGetFileSizes) {
4990
4992
  const fileSizes = this.viewGetFileSizes();
@@ -5787,12 +5789,12 @@
5787
5789
  const { dataText, formatterDataText, dataTextSeparator, dataValue, } = componentProps;
5788
5790
  let currentRow = row;
5789
5791
  if (dataValue) {
5792
+ const dataTextColumns = Array.isArray(dataText) ? dataText : [dataText];
5793
+ const columns = Array.isArray(formatterDataText) ? formatterDataText : [formatterDataText];
5790
5794
  if (!formatterDataText) {
5791
5795
  currentRow = column.getLookupData(dataValue, value[dataValue] || value);
5792
5796
  }
5793
- else {
5794
- const columns = Array.isArray(formatterDataText) ? formatterDataText : [formatterDataText];
5795
- const dataTextColumns = Array.isArray(dataText) ? dataText : [dataText];
5797
+ else if (columns.length === dataTextColumns.length) {
5796
5798
  const loopkupRow = {};
5797
5799
  columns.forEach((item, index) => {
5798
5800
  const dataTextValue = dataTextColumns[index];
@@ -6538,6 +6540,7 @@
6538
6540
  active: true,
6539
6541
  },
6540
6542
  };
6543
+ this.viewEnterEdit = null;
6541
6544
  this.newRowIdentifier = '__added_row';
6542
6545
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
6543
6546
  this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
@@ -6545,6 +6548,9 @@
6545
6548
  this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
6546
6549
  this.createAccessors();
6547
6550
  }
6551
+ setViewEnterEdit(viewEnterEdit) {
6552
+ this.viewEnterEdit = viewEnterEdit;
6553
+ }
6548
6554
  onMounted(element) {
6549
6555
  super.onMounted(element);
6550
6556
  core.KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
@@ -6612,6 +6618,8 @@
6612
6618
  * @param element DOM Element
6613
6619
  */
6614
6620
  inlineEdit(row, column, event, element) {
6621
+ if (this.editing)
6622
+ return;
6615
6623
  this.editing = true;
6616
6624
  this.callEvent('inlineEdit', {
6617
6625
  event, element, row, column, component: this,
@@ -7069,6 +7077,15 @@
7069
7077
  delete rows[foundRow[uniqueKey]];
7070
7078
  this.editedRows = rows;
7071
7079
  }
7080
+ /**
7081
+ * Makes the cell enter edit mode
7082
+ */
7083
+ enterEdit(rowKey, columnName) {
7084
+ if (!this.viewEnterEdit) {
7085
+ throw new Error('viewEnterEdit method not assigned');
7086
+ }
7087
+ this.viewEnterEdit(rowKey, columnName);
7088
+ }
7072
7089
  }
7073
7090
 
7074
7091
  /**
@@ -9757,6 +9774,18 @@
9757
9774
  * The percentage value for current progress
9758
9775
  */
9759
9776
  this.value = 0;
9777
+ /**
9778
+ * Sets the min width for the component
9779
+ */
9780
+ this.minWidth = 'auto';
9781
+ /**
9782
+ * Sets the max width for the component
9783
+ */
9784
+ this.maxWidth = 'auto';
9785
+ /**
9786
+ * Sets the width for the component
9787
+ */
9788
+ this.width = '100%';
9760
9789
  this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
9761
9790
  this.backgroundOpacity = this.getInitValue('backgroundOpacity', props.backgroundOpacity, this.backgroundOpacity);
9762
9791
  this.color = this.getInitValue('color', props.color, this.color);
@@ -9764,6 +9793,9 @@
9764
9793
  this.indeterminate = this.getInitValue('indeterminate', props.indeterminate, this.indeterminate);
9765
9794
  this.centerSlot = this.getInitValue('centerSlot', props.centerSlot, this.centerSlot);
9766
9795
  this.value = this.getInitValue('value', props.value, this.value);
9796
+ this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
9797
+ this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
9798
+ this.width = this.getInitValue('width', props.width, this.width);
9767
9799
  this.createAccessors();
9768
9800
  }
9769
9801
  }
@@ -13158,12 +13190,16 @@
13158
13190
  active: true,
13159
13191
  },
13160
13192
  };
13193
+ this.viewEnterEdit = null;
13161
13194
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
13162
13195
  this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
13163
13196
  this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
13164
13197
  this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
13165
13198
  this.createAccessors();
13166
13199
  }
13200
+ setViewEnterEdit(viewEnterEdit) {
13201
+ this.viewEnterEdit = viewEnterEdit;
13202
+ }
13167
13203
  onMounted(element) {
13168
13204
  super.onMounted(element);
13169
13205
  core.KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
@@ -13233,6 +13269,8 @@
13233
13269
  * @param element DOM Element
13234
13270
  */
13235
13271
  inlineEdit(row, column, event, element) {
13272
+ if (this.editing)
13273
+ return;
13236
13274
  this.editing = true;
13237
13275
  this.callEvent('inlineEdit', {
13238
13276
  event, element, row, column, component: this,
@@ -13607,6 +13645,15 @@
13607
13645
  delete rows[foundRow[uniqueKey]];
13608
13646
  this.editedRows = rows;
13609
13647
  }
13648
+ /**
13649
+ * Makes the cell enter edit mode
13650
+ */
13651
+ enterEdit(rowKey, columnName) {
13652
+ if (!this.viewEnterEdit) {
13653
+ throw new Error('viewEnterEdit method not assigned');
13654
+ }
13655
+ this.viewEnterEdit(rowKey, columnName);
13656
+ }
13610
13657
  }
13611
13658
 
13612
13659
  class Icons {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.96.1",
3
+ "version": "1.96.3",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -43,5 +43,5 @@
43
43
  "lodash.times": "4.3.*",
44
44
  "mockdate": "3.0.*"
45
45
  },
46
- "gitHead": "5898cc8926fdb11f3fbc71af1e587cd0bb1f53b1"
46
+ "gitHead": "06696a1b9e9ad6b52f88ac58130ecf456ddb1160"
47
47
  }
@@ -45,6 +45,8 @@ export declare class GridEditable extends Grid implements IGridEditable {
45
45
  private invalidComponents;
46
46
  editingNewRows: boolean;
47
47
  protected cancelEditedRowsKeyMapping: IKeyMap;
48
+ protected viewEnterEdit: ((rowKey: string, columnName: string) => void) | null;
49
+ setViewEnterEdit(viewEnterEdit: (rowKey: string, columnName: string) => void): void;
48
50
  constructor(props: IGridEditable);
49
51
  onMounted(element: any): void;
50
52
  onBeforeDestroy(): void;
@@ -209,4 +211,8 @@ export declare class GridEditable extends Grid implements IGridEditable {
209
211
  private changeCell;
210
212
  callCanEditRow(row: IDictionary<any>): any;
211
213
  changeData(data?: IDictionary<any>[]): void;
214
+ /**
215
+ * Makes the cell enter edit mode
216
+ */
217
+ enterEdit(rowKey: string, columnName: string): void;
212
218
  }
@@ -9,4 +9,7 @@ export interface IProgress extends IComponentRender {
9
9
  light?: boolean;
10
10
  centerSlot?: IComponentRender[];
11
11
  value?: number | string;
12
+ minWidth?: number | string;
13
+ maxWidth?: number | string;
14
+ width?: number | string;
12
15
  }
@@ -33,6 +33,18 @@ export declare class Progress extends ComponentRender implements IProgress {
33
33
  * The percentage value for current progress
34
34
  */
35
35
  value: number | string;
36
+ /**
37
+ * Sets the min width for the component
38
+ */
39
+ minWidth: number | string;
40
+ /**
41
+ * Sets the max width for the component
42
+ */
43
+ maxWidth: number | string;
44
+ /**
45
+ * Sets the width for the component
46
+ */
47
+ width: number | string;
36
48
  /**
37
49
  * Create a new Progress
38
50
  * @param props Progress definition
@@ -36,6 +36,8 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
36
36
  */
37
37
  doubleClickEdit: boolean;
38
38
  protected cancelEditedRowsKeyMapping: any;
39
+ protected viewEnterEdit: ((rowKey: string, columnName: string) => void) | null;
40
+ setViewEnterEdit(viewEnterEdit: (rowKey: string, columnName: string) => void): void;
39
41
  constructor(props: ITreeGridEditable);
40
42
  onMounted(element: any): void;
41
43
  onBeforeDestroy(): void;
@@ -190,4 +192,8 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
190
192
  private changeCell;
191
193
  callCanEditRow(row: IDictionary<any>): boolean;
192
194
  changeData(data?: IDictionary<any>[]): void;
195
+ /**
196
+ * Makes the cell enter edit mode
197
+ */
198
+ enterEdit(rowKey: string, columnName: string): void;
193
199
  }
@@ -1,12 +0,0 @@
1
- export interface IJSONObject {
2
- path: string;
3
- }
4
- export declare class JsonCacheService {
5
- /**
6
- * jsons collection
7
- */
8
- static jsonCollection: IJSONObject[];
9
- static saveJSONCache(jsonCollection: IJSONObject[]): Promise<void>;
10
- static getJSONCache(path: string): any;
11
- static clearJSONCache(jsonCollection: IJSONObject[]): void;
12
- }