@zeedhi/common 1.111.1 → 1.112.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.
@@ -5447,6 +5447,8 @@ class Column extends Component {
5447
5447
  this.defaultData = [];
5448
5448
  /* Column search mode */
5449
5449
  this.searchMode = 'any';
5450
+ /* Column can be used to search */
5451
+ this.searchable = true;
5450
5452
  this.lookup = debounce((lookupColumn) => {
5451
5453
  this.loading = true;
5452
5454
  const dataToLookup = Array.from(new Set(this.dataToLookup)); // remove duplicates
@@ -5478,7 +5480,9 @@ class Column extends Component {
5478
5480
  this.xlsType = this.getInitValue('xlsType', props.xlsType, this.xlsType);
5479
5481
  this.conditions = this.getInitValue('conditions', props.conditions, this.conditions);
5480
5482
  this.searchMode = this.getInitValue('searchMode', props.searchMode, this.searchMode);
5483
+ this.searchable = this.getInitValue('searchable', props.searchable, this.searchable);
5481
5484
  this.helperText = this.getInitValue('', props.helperText, this.helperText);
5485
+ this.valueIn = this.getInitValue('valueIn', props.valueIn, this.name);
5482
5486
  this.createConditions();
5483
5487
  this.createActionConditions();
5484
5488
  if (this.componentProps.datasource) {
@@ -5510,7 +5514,7 @@ class Column extends Component {
5510
5514
  throw new MethodNotAssignedError('viewGetWidth');
5511
5515
  }
5512
5516
  formatterByRow(row, cellProps) {
5513
- const value = row[this.name];
5517
+ const value = row[this.valueIn];
5514
5518
  const formatterFn = FormatterParserProvider.getFormatter(`column_${this.componentProps.component}`);
5515
5519
  if (formatterFn) {
5516
5520
  return formatterFn({
@@ -5845,7 +5849,9 @@ class Iterable extends ComponentRender {
5845
5849
  });
5846
5850
  }
5847
5851
  isColumnSearchable(column) {
5848
- return (!this.searchVisibleOnly || column.isVisible) && (this.searchIn === undefined || this.searchIn === column.name);
5852
+ return column.searchable
5853
+ && (!this.searchVisibleOnly || column.isVisible)
5854
+ && (this.searchIn === undefined || this.searchIn === column.name);
5849
5855
  }
5850
5856
  }
5851
5857
 
@@ -7048,10 +7054,10 @@ class GridEditable extends Grid {
7048
7054
  }
7049
7055
  getVisibleValue(row, column) {
7050
7056
  const key = row[this.datasource.uniqueKey];
7051
- if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
7052
- return this.editedRows[key][column.name];
7057
+ if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.valueIn)) {
7058
+ return this.editedRows[key][column.valueIn];
7053
7059
  }
7054
- return row[column.name];
7060
+ return row[column.valueIn];
7055
7061
  }
7056
7062
  /**
7057
7063
  * Returns editable component properties based on the column definition
@@ -7110,13 +7116,13 @@ class GridEditable extends Grid {
7110
7116
  * If the row[column.name] has a selected value, pushes it
7111
7117
  */
7112
7118
  checkLookupData(column, row, componentProps) {
7113
- if (!row[column.name] || !column.lookupData || !componentProps.datasource)
7119
+ if (!row[column.valueIn] || !column.lookupData || !componentProps.datasource)
7114
7120
  return;
7115
7121
  componentProps.datasource.data = componentProps.datasource.data || [];
7116
7122
  // prevent pushing lookup values when using accessor in data
7117
7123
  if (!Array.isArray(componentProps.datasource.data))
7118
7124
  return;
7119
- const colValue = row[column.name];
7125
+ const colValue = row[column.valueIn];
7120
7126
  if (Array.isArray(colValue)) {
7121
7127
  colValue.forEach((item) => {
7122
7128
  const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
@@ -7153,7 +7159,7 @@ class GridEditable extends Grid {
7153
7159
  */
7154
7160
  changeEditableComponent(column, row, value, component) {
7155
7161
  const key = row[this.datasource.uniqueKey];
7156
- const columnName = column.name;
7162
+ const columnName = column.valueIn;
7157
7163
  if (!Utils.isEqual(value, row[columnName])) {
7158
7164
  const newRow = {};
7159
7165
  newRow[key] = Object.assign({}, this.editedRows[key]);
@@ -7200,7 +7206,7 @@ class GridEditable extends Grid {
7200
7206
  isEdited(column, row) {
7201
7207
  const key = row[this.datasource.uniqueKey];
7202
7208
  return this.editedRows[key]
7203
- && this.editedRows[key][column.name] !== this.editedRows[key][`${column.name}_original`];
7209
+ && this.editedRows[key][column.valueIn] !== this.editedRows[key][`${column.valueIn}_original`];
7204
7210
  }
7205
7211
  /**
7206
7212
  * Checks if row is an added row
@@ -7384,7 +7390,7 @@ class GridEditable extends Grid {
7384
7390
  const key = row[this.datasource.uniqueKey];
7385
7391
  editableColumns.forEach((column) => {
7386
7392
  const instance = componentInstances[column.name];
7387
- if (!instance.isValid(row[column.name])) {
7393
+ if (!instance.isValid(row[column.valueIn])) {
7388
7394
  invalidCompNames.push(this.getCompName(key, column.name));
7389
7395
  }
7390
7396
  });
@@ -7477,7 +7483,7 @@ class GridEditable extends Grid {
7477
7483
  throw new RowNotFoundError(newRow[uniqueKey], this.name);
7478
7484
  }
7479
7485
  this.columns.forEach((column) => {
7480
- const columnName = column.name;
7486
+ const columnName = column.valueIn;
7481
7487
  this.changeCell(newRow[uniqueKey], rowIdx, column, newRow[columnName]);
7482
7488
  });
7483
7489
  }
@@ -7894,27 +7900,45 @@ class Increment extends Number$1 {
7894
7900
  super.change(event, element);
7895
7901
  }
7896
7902
  /**
7897
- * Method to increment the value
7903
+ * Increases the component's value by the step amount.
7898
7904
  */
7899
7905
  increment() {
7900
- this.value = this.value ? Number(this.value) : this.value;
7901
- if ((this.value === null || Number.isNaN(this.value)) && this.minValue) {
7902
- this.value = this.minValue;
7906
+ const currentValue = Number(this.value);
7907
+ const isValueInvalid = this.value === null || this.value === '' || Number.isNaN(currentValue);
7908
+ // First, handle the case where the input is empty or not a number.
7909
+ if (isValueInvalid) {
7910
+ // Determine the starting value. Default to `minValue` if it's positive, otherwise start from `step`.
7911
+ const startValue = (this.minValue !== undefined && this.minValue > 0) ? this.minValue : this.step;
7912
+ // Set the value, but clamp it to the maximum limit if one exists.
7913
+ this.value = (this.maxValue !== undefined) ? Math.min(startValue, this.maxValue) : startValue;
7914
+ return;
7903
7915
  }
7904
- else if (this.value !== this.maxValue) {
7905
- this.value += this.step;
7916
+ // If the input is a valid number, calculate the next value.
7917
+ const nextValue = currentValue + this.step;
7918
+ // Only update if the new value does not exceed the maximum boundary.
7919
+ if (this.maxValue === undefined || nextValue <= this.maxValue) {
7920
+ this.value = nextValue;
7906
7921
  }
7907
7922
  }
7908
7923
  /**
7909
- * Method to decrement the value
7924
+ * Decreases the component's value by the step amount.
7910
7925
  */
7911
7926
  decrement() {
7912
- this.value = this.value ? Number(this.value) : this.value;
7913
- if ((this.value === null || Number.isNaN(this.value)) && this.maxValue) {
7914
- this.value = this.maxValue;
7927
+ const currentValue = Number(this.value);
7928
+ const isValueInvalid = this.value === null || this.value === '' || Number.isNaN(currentValue);
7929
+ // First, handle the case where the input is empty or not a number.
7930
+ if (isValueInvalid) {
7931
+ // Determine the starting value. Handles the edge case where the max value is negative.
7932
+ const startValue = (this.maxValue !== undefined && this.maxValue < 0) ? this.maxValue : -this.step;
7933
+ // Set the value, but clamp it to the minimum limit if one exists.
7934
+ this.value = (this.minValue !== undefined) ? Math.max(startValue, this.minValue) : startValue;
7935
+ return;
7915
7936
  }
7916
- else if (this.value !== this.minValue) {
7917
- this.value -= this.step;
7937
+ // If the input is a valid number, calculate the next value.
7938
+ const nextValue = currentValue - this.step;
7939
+ // Only update if the new value does not go below the minimum boundary.
7940
+ if (this.minValue === undefined || nextValue >= this.minValue) {
7941
+ this.value = nextValue;
7918
7942
  }
7919
7943
  }
7920
7944
  }
@@ -10432,7 +10456,7 @@ class Select extends TextInput {
10432
10456
  component: 'ZdGrid',
10433
10457
  cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
10434
10458
  columns: this.modalSelectionColumns,
10435
- datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
10459
+ datasource: Object.assign(Object.assign({}, this.datasource.clone()), { limit: this.defaultDatasource.limit, lazyLoad: false, searchIn: undefined }),
10436
10460
  toolbarSlot: [
10437
10461
  {
10438
10462
  name: `${this.name}-modal-selection-title`,
@@ -10705,6 +10729,10 @@ class Search extends TextInput {
10705
10729
  constructor(props) {
10706
10730
  super(props);
10707
10731
  this.lazyAttach = false;
10732
+ /**
10733
+ * * hide the option to select search field
10734
+ */
10735
+ this.hideSearchField = false;
10708
10736
  this.debounceSetSearch = debounce(this.setSearch, 500);
10709
10737
  this.iterableComponentName = this.getInitValue('iterableComponentName', props.iterableComponentName, this.iterableComponent);
10710
10738
  this.showHelper = this.getInitValue('showHelper', props.showHelper, false);
@@ -10713,6 +10741,7 @@ class Search extends TextInput {
10713
10741
  this.placeholder = this.getInitValue('placeholder', props.placeholder, 'SEARCH');
10714
10742
  this.cssClass = this.getInitValue('cssClass', props.cssClass, 'zd-float-right');
10715
10743
  this.lazyAttach = this.getInitValue('lazyAttach', props.lazyAttach, this.lazyAttach);
10744
+ this.hideSearchField = this.getInitValue('hideSearchField', props.hideSearchField, this.hideSearchField);
10716
10745
  this.debounceSetSearch = this.debounceSetSearch.bind(this);
10717
10746
  if (!this.lazyAttach)
10718
10747
  this.setIterableComponent();
@@ -15560,10 +15589,10 @@ class TreeGridEditable extends TreeGrid {
15560
15589
  }
15561
15590
  getVisibleValue(row, column) {
15562
15591
  const key = row[this.datasource.uniqueKey];
15563
- if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
15564
- return this.editedRows[key][column.name];
15592
+ if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.valueIn)) {
15593
+ return this.editedRows[key][column.valueIn];
15565
15594
  }
15566
- return row[column.name];
15595
+ return row[column.valueIn];
15567
15596
  }
15568
15597
  /**
15569
15598
  * Returns editable component properties based on the column definition
@@ -15617,13 +15646,13 @@ class TreeGridEditable extends TreeGrid {
15617
15646
  * If the row[column.name] has a selected value, pushes it
15618
15647
  */
15619
15648
  checkLookupData(column, row, componentProps) {
15620
- if (!row[column.name] || !column.lookupData || !componentProps.datasource)
15649
+ if (!row[column.valueIn] || !column.lookupData || !componentProps.datasource)
15621
15650
  return;
15622
15651
  componentProps.datasource.data = componentProps.datasource.data || [];
15623
15652
  // prevent pushing lookup values when using accessor in data
15624
15653
  if (!Array.isArray(componentProps.datasource.data))
15625
15654
  return;
15626
- const colValue = row[column.name];
15655
+ const colValue = row[column.valueIn];
15627
15656
  if (Array.isArray(colValue)) {
15628
15657
  colValue.forEach((item) => {
15629
15658
  const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
@@ -15660,7 +15689,7 @@ class TreeGridEditable extends TreeGrid {
15660
15689
  */
15661
15690
  changeEditableComponent(column, row, value, component) {
15662
15691
  const key = row[this.datasource.uniqueKey];
15663
- const columnName = column.name;
15692
+ const columnName = column.valueIn;
15664
15693
  if (!Utils.isEqual(value, row[columnName])) {
15665
15694
  const newRow = {};
15666
15695
  newRow[key] = Object.assign({}, this.editedRows[key]);
@@ -15695,7 +15724,7 @@ class TreeGridEditable extends TreeGrid {
15695
15724
  isEdited(column, row) {
15696
15725
  const key = row[this.datasource.uniqueKey];
15697
15726
  return this.editedRows[key]
15698
- && this.editedRows[key][column.name] !== this.editedRows[key][`${column.name}_original`];
15727
+ && this.editedRows[key][column.valueIn] !== this.editedRows[key][`${column.valueIn}_original`];
15699
15728
  }
15700
15729
  /**
15701
15730
  * Checks if column is valid
@@ -15832,7 +15861,7 @@ class TreeGridEditable extends TreeGrid {
15832
15861
  throw new RowNotFoundError(newRow[uniqueKey], this.name);
15833
15862
  }
15834
15863
  this.columns.forEach((column) => {
15835
- const columnName = column.name;
15864
+ const columnName = column.valueIn;
15836
15865
  this.changeCell(newRow[uniqueKey], rowIdx, column, newRow[columnName]);
15837
15866
  });
15838
15867
  }
@@ -15917,7 +15946,7 @@ const getForeignLookupRow = (column, row, dataValue, dataTextColumns, foreignCol
15917
15946
  const dataTextName = typeof item === 'string' ? item : item.name;
15918
15947
  lookupRow[dataTextName] = row[foreignColumns[dataTextName] || dataTextName];
15919
15948
  });
15920
- lookupRow[dataValue] = row[column.name];
15949
+ lookupRow[dataValue] = row[column.valueIn];
15921
15950
  return lookupRow;
15922
15951
  };
15923
15952
  const getFormatterLookupRow = (column, row, dataValue, formatterDataTextColumns, dataTextColumns) => {
@@ -15928,7 +15957,7 @@ const getFormatterLookupRow = (column, row, dataValue, formatterDataTextColumns,
15928
15957
  const formatterDataTextColumn = typeof item === 'string' ? item : item.name;
15929
15958
  lookupRow[dataTextName] = row[formatterDataTextColumn];
15930
15959
  });
15931
- lookupRow[dataValue] = row[column.name];
15960
+ lookupRow[dataValue] = row[column.valueIn];
15932
15961
  return lookupRow;
15933
15962
  };
15934
15963
  /**
@@ -15942,7 +15971,7 @@ const storeOrRetrieveLookup = (column, row, value, dataValue, componentProps) =>
15942
15971
  const dataTextColumns = asArray(dataText);
15943
15972
  // when using foreignColumns, should store foreign keys information in lookupData
15944
15973
  if (foreignColumns) {
15945
- column.lookupData[row[column.name]] = getForeignLookupRow(column, row, dataValue, dataTextColumns, foreignColumns);
15974
+ column.lookupData[row[column.valueIn]] = getForeignLookupRow(column, row, dataValue, dataTextColumns, foreignColumns);
15946
15975
  return row;
15947
15976
  }
15948
15977
  // when not using formatterDataText, should fetch data from datasource to be able to format this cell
@@ -15952,7 +15981,7 @@ const storeOrRetrieveLookup = (column, row, value, dataValue, componentProps) =>
15952
15981
  const formatterDataTextColumns = asArray(formatterDataText);
15953
15982
  // when using formatterDataText, should store dataText information in lookupData
15954
15983
  if (formatterDataTextColumns.length === dataTextColumns.length) {
15955
- const rowColumn = row[column.name];
15984
+ const rowColumn = row[column.valueIn];
15956
15985
  column.lookupData[rowColumn] = getFormatterLookupRow(column, row, dataValue, formatterDataTextColumns, dataTextColumns);
15957
15986
  return row;
15958
15987
  }
@@ -5454,6 +5454,8 @@
5454
5454
  this.defaultData = [];
5455
5455
  /* Column search mode */
5456
5456
  this.searchMode = 'any';
5457
+ /* Column can be used to search */
5458
+ this.searchable = true;
5457
5459
  this.lookup = debounce__default["default"]((lookupColumn) => {
5458
5460
  this.loading = true;
5459
5461
  const dataToLookup = Array.from(new Set(this.dataToLookup)); // remove duplicates
@@ -5485,7 +5487,9 @@
5485
5487
  this.xlsType = this.getInitValue('xlsType', props.xlsType, this.xlsType);
5486
5488
  this.conditions = this.getInitValue('conditions', props.conditions, this.conditions);
5487
5489
  this.searchMode = this.getInitValue('searchMode', props.searchMode, this.searchMode);
5490
+ this.searchable = this.getInitValue('searchable', props.searchable, this.searchable);
5488
5491
  this.helperText = this.getInitValue('', props.helperText, this.helperText);
5492
+ this.valueIn = this.getInitValue('valueIn', props.valueIn, this.name);
5489
5493
  this.createConditions();
5490
5494
  this.createActionConditions();
5491
5495
  if (this.componentProps.datasource) {
@@ -5517,7 +5521,7 @@
5517
5521
  throw new core.MethodNotAssignedError('viewGetWidth');
5518
5522
  }
5519
5523
  formatterByRow(row, cellProps) {
5520
- const value = row[this.name];
5524
+ const value = row[this.valueIn];
5521
5525
  const formatterFn = core.FormatterParserProvider.getFormatter(`column_${this.componentProps.component}`);
5522
5526
  if (formatterFn) {
5523
5527
  return formatterFn({
@@ -5852,7 +5856,9 @@
5852
5856
  });
5853
5857
  }
5854
5858
  isColumnSearchable(column) {
5855
- return (!this.searchVisibleOnly || column.isVisible) && (this.searchIn === undefined || this.searchIn === column.name);
5859
+ return column.searchable
5860
+ && (!this.searchVisibleOnly || column.isVisible)
5861
+ && (this.searchIn === undefined || this.searchIn === column.name);
5856
5862
  }
5857
5863
  }
5858
5864
 
@@ -7055,10 +7061,10 @@
7055
7061
  }
7056
7062
  getVisibleValue(row, column) {
7057
7063
  const key = row[this.datasource.uniqueKey];
7058
- if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
7059
- return this.editedRows[key][column.name];
7064
+ if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.valueIn)) {
7065
+ return this.editedRows[key][column.valueIn];
7060
7066
  }
7061
- return row[column.name];
7067
+ return row[column.valueIn];
7062
7068
  }
7063
7069
  /**
7064
7070
  * Returns editable component properties based on the column definition
@@ -7117,13 +7123,13 @@
7117
7123
  * If the row[column.name] has a selected value, pushes it
7118
7124
  */
7119
7125
  checkLookupData(column, row, componentProps) {
7120
- if (!row[column.name] || !column.lookupData || !componentProps.datasource)
7126
+ if (!row[column.valueIn] || !column.lookupData || !componentProps.datasource)
7121
7127
  return;
7122
7128
  componentProps.datasource.data = componentProps.datasource.data || [];
7123
7129
  // prevent pushing lookup values when using accessor in data
7124
7130
  if (!Array.isArray(componentProps.datasource.data))
7125
7131
  return;
7126
- const colValue = row[column.name];
7132
+ const colValue = row[column.valueIn];
7127
7133
  if (Array.isArray(colValue)) {
7128
7134
  colValue.forEach((item) => {
7129
7135
  const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
@@ -7160,7 +7166,7 @@
7160
7166
  */
7161
7167
  changeEditableComponent(column, row, value, component) {
7162
7168
  const key = row[this.datasource.uniqueKey];
7163
- const columnName = column.name;
7169
+ const columnName = column.valueIn;
7164
7170
  if (!core.Utils.isEqual(value, row[columnName])) {
7165
7171
  const newRow = {};
7166
7172
  newRow[key] = Object.assign({}, this.editedRows[key]);
@@ -7207,7 +7213,7 @@
7207
7213
  isEdited(column, row) {
7208
7214
  const key = row[this.datasource.uniqueKey];
7209
7215
  return this.editedRows[key]
7210
- && this.editedRows[key][column.name] !== this.editedRows[key][`${column.name}_original`];
7216
+ && this.editedRows[key][column.valueIn] !== this.editedRows[key][`${column.valueIn}_original`];
7211
7217
  }
7212
7218
  /**
7213
7219
  * Checks if row is an added row
@@ -7391,7 +7397,7 @@
7391
7397
  const key = row[this.datasource.uniqueKey];
7392
7398
  editableColumns.forEach((column) => {
7393
7399
  const instance = componentInstances[column.name];
7394
- if (!instance.isValid(row[column.name])) {
7400
+ if (!instance.isValid(row[column.valueIn])) {
7395
7401
  invalidCompNames.push(this.getCompName(key, column.name));
7396
7402
  }
7397
7403
  });
@@ -7484,7 +7490,7 @@
7484
7490
  throw new RowNotFoundError(newRow[uniqueKey], this.name);
7485
7491
  }
7486
7492
  this.columns.forEach((column) => {
7487
- const columnName = column.name;
7493
+ const columnName = column.valueIn;
7488
7494
  this.changeCell(newRow[uniqueKey], rowIdx, column, newRow[columnName]);
7489
7495
  });
7490
7496
  }
@@ -7901,27 +7907,45 @@
7901
7907
  super.change(event, element);
7902
7908
  }
7903
7909
  /**
7904
- * Method to increment the value
7910
+ * Increases the component's value by the step amount.
7905
7911
  */
7906
7912
  increment() {
7907
- this.value = this.value ? Number(this.value) : this.value;
7908
- if ((this.value === null || Number.isNaN(this.value)) && this.minValue) {
7909
- this.value = this.minValue;
7913
+ const currentValue = Number(this.value);
7914
+ const isValueInvalid = this.value === null || this.value === '' || Number.isNaN(currentValue);
7915
+ // First, handle the case where the input is empty or not a number.
7916
+ if (isValueInvalid) {
7917
+ // Determine the starting value. Default to `minValue` if it's positive, otherwise start from `step`.
7918
+ const startValue = (this.minValue !== undefined && this.minValue > 0) ? this.minValue : this.step;
7919
+ // Set the value, but clamp it to the maximum limit if one exists.
7920
+ this.value = (this.maxValue !== undefined) ? Math.min(startValue, this.maxValue) : startValue;
7921
+ return;
7910
7922
  }
7911
- else if (this.value !== this.maxValue) {
7912
- this.value += this.step;
7923
+ // If the input is a valid number, calculate the next value.
7924
+ const nextValue = currentValue + this.step;
7925
+ // Only update if the new value does not exceed the maximum boundary.
7926
+ if (this.maxValue === undefined || nextValue <= this.maxValue) {
7927
+ this.value = nextValue;
7913
7928
  }
7914
7929
  }
7915
7930
  /**
7916
- * Method to decrement the value
7931
+ * Decreases the component's value by the step amount.
7917
7932
  */
7918
7933
  decrement() {
7919
- this.value = this.value ? Number(this.value) : this.value;
7920
- if ((this.value === null || Number.isNaN(this.value)) && this.maxValue) {
7921
- this.value = this.maxValue;
7934
+ const currentValue = Number(this.value);
7935
+ const isValueInvalid = this.value === null || this.value === '' || Number.isNaN(currentValue);
7936
+ // First, handle the case where the input is empty or not a number.
7937
+ if (isValueInvalid) {
7938
+ // Determine the starting value. Handles the edge case where the max value is negative.
7939
+ const startValue = (this.maxValue !== undefined && this.maxValue < 0) ? this.maxValue : -this.step;
7940
+ // Set the value, but clamp it to the minimum limit if one exists.
7941
+ this.value = (this.minValue !== undefined) ? Math.max(startValue, this.minValue) : startValue;
7942
+ return;
7922
7943
  }
7923
- else if (this.value !== this.minValue) {
7924
- this.value -= this.step;
7944
+ // If the input is a valid number, calculate the next value.
7945
+ const nextValue = currentValue - this.step;
7946
+ // Only update if the new value does not go below the minimum boundary.
7947
+ if (this.minValue === undefined || nextValue >= this.minValue) {
7948
+ this.value = nextValue;
7925
7949
  }
7926
7950
  }
7927
7951
  }
@@ -10439,7 +10463,7 @@
10439
10463
  component: 'ZdGrid',
10440
10464
  cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
10441
10465
  columns: this.modalSelectionColumns,
10442
- datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
10466
+ datasource: Object.assign(Object.assign({}, this.datasource.clone()), { limit: this.defaultDatasource.limit, lazyLoad: false, searchIn: undefined }),
10443
10467
  toolbarSlot: [
10444
10468
  {
10445
10469
  name: `${this.name}-modal-selection-title`,
@@ -10712,6 +10736,10 @@
10712
10736
  constructor(props) {
10713
10737
  super(props);
10714
10738
  this.lazyAttach = false;
10739
+ /**
10740
+ * * hide the option to select search field
10741
+ */
10742
+ this.hideSearchField = false;
10715
10743
  this.debounceSetSearch = debounce__default["default"](this.setSearch, 500);
10716
10744
  this.iterableComponentName = this.getInitValue('iterableComponentName', props.iterableComponentName, this.iterableComponent);
10717
10745
  this.showHelper = this.getInitValue('showHelper', props.showHelper, false);
@@ -10720,6 +10748,7 @@
10720
10748
  this.placeholder = this.getInitValue('placeholder', props.placeholder, 'SEARCH');
10721
10749
  this.cssClass = this.getInitValue('cssClass', props.cssClass, 'zd-float-right');
10722
10750
  this.lazyAttach = this.getInitValue('lazyAttach', props.lazyAttach, this.lazyAttach);
10751
+ this.hideSearchField = this.getInitValue('hideSearchField', props.hideSearchField, this.hideSearchField);
10723
10752
  this.debounceSetSearch = this.debounceSetSearch.bind(this);
10724
10753
  if (!this.lazyAttach)
10725
10754
  this.setIterableComponent();
@@ -15567,10 +15596,10 @@
15567
15596
  }
15568
15597
  getVisibleValue(row, column) {
15569
15598
  const key = row[this.datasource.uniqueKey];
15570
- if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
15571
- return this.editedRows[key][column.name];
15599
+ if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.valueIn)) {
15600
+ return this.editedRows[key][column.valueIn];
15572
15601
  }
15573
- return row[column.name];
15602
+ return row[column.valueIn];
15574
15603
  }
15575
15604
  /**
15576
15605
  * Returns editable component properties based on the column definition
@@ -15624,13 +15653,13 @@
15624
15653
  * If the row[column.name] has a selected value, pushes it
15625
15654
  */
15626
15655
  checkLookupData(column, row, componentProps) {
15627
- if (!row[column.name] || !column.lookupData || !componentProps.datasource)
15656
+ if (!row[column.valueIn] || !column.lookupData || !componentProps.datasource)
15628
15657
  return;
15629
15658
  componentProps.datasource.data = componentProps.datasource.data || [];
15630
15659
  // prevent pushing lookup values when using accessor in data
15631
15660
  if (!Array.isArray(componentProps.datasource.data))
15632
15661
  return;
15633
- const colValue = row[column.name];
15662
+ const colValue = row[column.valueIn];
15634
15663
  if (Array.isArray(colValue)) {
15635
15664
  colValue.forEach((item) => {
15636
15665
  const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
@@ -15667,7 +15696,7 @@
15667
15696
  */
15668
15697
  changeEditableComponent(column, row, value, component) {
15669
15698
  const key = row[this.datasource.uniqueKey];
15670
- const columnName = column.name;
15699
+ const columnName = column.valueIn;
15671
15700
  if (!core.Utils.isEqual(value, row[columnName])) {
15672
15701
  const newRow = {};
15673
15702
  newRow[key] = Object.assign({}, this.editedRows[key]);
@@ -15702,7 +15731,7 @@
15702
15731
  isEdited(column, row) {
15703
15732
  const key = row[this.datasource.uniqueKey];
15704
15733
  return this.editedRows[key]
15705
- && this.editedRows[key][column.name] !== this.editedRows[key][`${column.name}_original`];
15734
+ && this.editedRows[key][column.valueIn] !== this.editedRows[key][`${column.valueIn}_original`];
15706
15735
  }
15707
15736
  /**
15708
15737
  * Checks if column is valid
@@ -15839,7 +15868,7 @@
15839
15868
  throw new RowNotFoundError(newRow[uniqueKey], this.name);
15840
15869
  }
15841
15870
  this.columns.forEach((column) => {
15842
- const columnName = column.name;
15871
+ const columnName = column.valueIn;
15843
15872
  this.changeCell(newRow[uniqueKey], rowIdx, column, newRow[columnName]);
15844
15873
  });
15845
15874
  }
@@ -15924,7 +15953,7 @@
15924
15953
  const dataTextName = typeof item === 'string' ? item : item.name;
15925
15954
  lookupRow[dataTextName] = row[foreignColumns[dataTextName] || dataTextName];
15926
15955
  });
15927
- lookupRow[dataValue] = row[column.name];
15956
+ lookupRow[dataValue] = row[column.valueIn];
15928
15957
  return lookupRow;
15929
15958
  };
15930
15959
  const getFormatterLookupRow = (column, row, dataValue, formatterDataTextColumns, dataTextColumns) => {
@@ -15935,7 +15964,7 @@
15935
15964
  const formatterDataTextColumn = typeof item === 'string' ? item : item.name;
15936
15965
  lookupRow[dataTextName] = row[formatterDataTextColumn];
15937
15966
  });
15938
- lookupRow[dataValue] = row[column.name];
15967
+ lookupRow[dataValue] = row[column.valueIn];
15939
15968
  return lookupRow;
15940
15969
  };
15941
15970
  /**
@@ -15949,7 +15978,7 @@
15949
15978
  const dataTextColumns = asArray(dataText);
15950
15979
  // when using foreignColumns, should store foreign keys information in lookupData
15951
15980
  if (foreignColumns) {
15952
- column.lookupData[row[column.name]] = getForeignLookupRow(column, row, dataValue, dataTextColumns, foreignColumns);
15981
+ column.lookupData[row[column.valueIn]] = getForeignLookupRow(column, row, dataValue, dataTextColumns, foreignColumns);
15953
15982
  return row;
15954
15983
  }
15955
15984
  // when not using formatterDataText, should fetch data from datasource to be able to format this cell
@@ -15959,7 +15988,7 @@
15959
15988
  const formatterDataTextColumns = asArray(formatterDataText);
15960
15989
  // when using formatterDataText, should store dataText information in lookupData
15961
15990
  if (formatterDataTextColumns.length === dataTextColumns.length) {
15962
- const rowColumn = row[column.name];
15991
+ const rowColumn = row[column.valueIn];
15963
15992
  column.lookupData[rowColumn] = getFormatterLookupRow(column, row, dataValue, formatterDataTextColumns, dataTextColumns);
15964
15993
  return row;
15965
15994
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.111.1",
3
+ "version": "1.112.0",
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": "f51dc8f1f97a36c8ce1ff53b37c57157ecfc0e0e"
46
+ "gitHead": "bcf25802928f8264bc7810b19a903364f3e371c9"
47
47
  }
@@ -119,7 +119,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
119
119
  * @param element DOM Element
120
120
  */
121
121
  selectAllClick(isSelected: boolean, event: Event, element: any): void;
122
- getVisibleValue(row: IDictionary, column: IGridColumnEditable): any;
122
+ getVisibleValue(row: IDictionary, column: GridColumnEditable): any;
123
123
  /**
124
124
  * Returns editable component properties based on the column definition
125
125
  * @param column Column definition
@@ -127,10 +127,10 @@ export declare class GridEditable extends Grid implements IGridEditable {
127
127
  * @param cellProps Column conditional props
128
128
  * @param events Component events
129
129
  */
130
- getEditableComponent(column: IGridColumnEditable, row: IDictionary<any>, cellProps: IDictionary<any> | null, events: any): {
130
+ getEditableComponent(column: GridColumnEditable, row: IDictionary<any>, cellProps: IDictionary<any> | null, events: any): {
131
131
  name: string;
132
132
  parent: GridEditable;
133
- align: "left" | "center" | "right" | undefined;
133
+ align: import("..").ColumnAlign;
134
134
  showLabel: boolean;
135
135
  showHelper: boolean;
136
136
  dense: boolean;
@@ -150,14 +150,14 @@ export declare class GridEditable extends Grid implements IGridEditable {
150
150
  /**
151
151
  * change event of editable components
152
152
  */
153
- protected changeEditableComponent(column: IGridColumnEditable, row: IDictionary<any>, value: any, component?: Input): void;
153
+ protected changeEditableComponent(column: GridColumnEditable, row: IDictionary<any>, value: any, component?: Input): void;
154
154
  private updateOriginalRow;
155
155
  /**
156
156
  * Checks if column is edited
157
157
  * @param column Column
158
158
  * @param row Row
159
159
  */
160
- isEdited(column: IGridColumnEditable, row: IDictionary): boolean;
160
+ isEdited(column: GridColumnEditable, row: IDictionary): boolean;
161
161
  /**
162
162
  * Checks if row is an added row
163
163
  * @param row Row
@@ -43,11 +43,11 @@ export declare class Increment extends ZdNumber implements IIncrement {
43
43
  */
44
44
  plusClick(event: Event, element: any): void;
45
45
  /**
46
- * Method to increment the value
46
+ * Increases the component's value by the step amount.
47
47
  */
48
48
  increment(): void;
49
49
  /**
50
- * Method to decrement the value
50
+ * Decreases the component's value by the step amount.
51
51
  */
52
52
  decrement(): void;
53
53
  }
@@ -43,6 +43,8 @@ export declare class Column extends Component implements IColumn {
43
43
  helperText: string;
44
44
  protected defaultData: IDictionary[];
45
45
  searchMode: ColumnSearchMode;
46
+ searchable: boolean;
47
+ valueIn: string;
46
48
  /**
47
49
  * Creates a new Column.
48
50
  * @param props Column properties
@@ -28,6 +28,8 @@ export interface IColumn extends IComponent {
28
28
  events?: IIterableEvents;
29
29
  xlsType?: string;
30
30
  searchMode?: ColumnSearchMode;
31
+ searchable?: boolean;
32
+ valueIn?: string;
31
33
  }
32
34
  export interface IIterable extends IComponentRender {
33
35
  columns?: IColumn[];
@@ -65,6 +67,7 @@ export interface ISearch extends ITextInput {
65
67
  showHelper?: boolean;
66
68
  appendIcon?: string;
67
69
  lazyAttach?: boolean;
70
+ hideSearchField?: boolean;
68
71
  }
69
72
  export interface IIterableColumnsButton extends IButton {
70
73
  iterableComponentName?: string;
@@ -14,6 +14,10 @@ export declare class Search extends TextInput implements ISearch {
14
14
  */
15
15
  iterableComponent: Iterable;
16
16
  lazyAttach: boolean;
17
+ /**
18
+ * * hide the option to select search field
19
+ */
20
+ hideSearchField: boolean;
17
21
  /**
18
22
  * Creates a new Iterable Page component.
19
23
  * @param props Iterable page component properties
@@ -91,7 +91,7 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
91
91
  * @param element DOM Element
92
92
  */
93
93
  selectAllClick(isSelected: boolean, event?: Event, element?: any): void;
94
- getVisibleValue(row: IDictionary, column: IGridColumnEditable): any;
94
+ getVisibleValue(row: IDictionary, column: GridColumnEditable): any;
95
95
  /**
96
96
  * Returns editable component properties based on the column definition
97
97
  * @param column Column definition
@@ -99,10 +99,10 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
99
99
  * @param cellProps Column conditional props
100
100
  * @param events Component events
101
101
  */
102
- getEditableComponent(column: IGridColumnEditable, row: IDictionary<any>, cellProps: IDictionary<any>, events: any): {
102
+ getEditableComponent(column: GridColumnEditable, row: IDictionary<any>, cellProps: IDictionary<any>, events: any): {
103
103
  name: string;
104
104
  parent: TreeGridEditable;
105
- align: "left" | "center" | "right" | undefined;
105
+ align: import("..").ColumnAlign;
106
106
  showLabel: boolean;
107
107
  showHelper: boolean;
108
108
  dense: boolean;
@@ -128,7 +128,7 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
128
128
  * @param column Column
129
129
  * @param row Row
130
130
  */
131
- isEdited(column: IGridColumnEditable, row: IDictionary): boolean;
131
+ isEdited(column: GridColumnEditable, row: IDictionary): boolean;
132
132
  /**
133
133
  * Checks if column is valid
134
134
  * @param column Column
@@ -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
- }