@zeedhi/common 1.111.1 → 1.113.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.
@@ -2838,7 +2838,7 @@
2838
2838
  return mask;
2839
2839
  }
2840
2840
  }
2841
- core.FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPrefix = textInputDefaults.valueWithPrefix, prefix = textInputDefaults.prefix, valueWithSuffix = textInputDefaults.valueWithSuffix, suffix = textInputDefaults.suffix, mask = textInputDefaults.mask, } = {}) => {
2841
+ core.FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPrefix = textInputDefaults.valueWithPrefix, prefix = textInputDefaults.prefix, valueWithSuffix = textInputDefaults.valueWithSuffix, suffix = textInputDefaults.suffix, mask = textInputDefaults.mask, eagerMask, } = {}) => {
2842
2842
  let formatted = value;
2843
2843
  if (formatted) {
2844
2844
  formatted = valueWithPrefix ? formatted.substring(prefix.length) : formatted;
@@ -2849,7 +2849,10 @@
2849
2849
  maskDef = core.Loader.getInstance(controller)[accessor];
2850
2850
  }
2851
2851
  const maskValue = typeof (maskDef) === 'function' ? maskDef(core.Mask.getValueWithoutMask(formatted)) : maskDef;
2852
- formatted = maskValue ? core.Mask.getValueWithMask(core.Mask.getValueWithoutMask(formatted), maskValue) : formatted;
2852
+ if (maskValue) {
2853
+ const valueWithoutMask = core.Mask.getValueWithoutMask(formatted);
2854
+ formatted = core.Mask.getValueWithMask(valueWithoutMask, maskValue, false, eagerMask);
2855
+ }
2853
2856
  }
2854
2857
  return formatted;
2855
2858
  });
@@ -3145,8 +3148,10 @@
3145
3148
  * Hides alert by index. Default index is 0
3146
3149
  */
3147
3150
  static hide(index = 0) {
3148
- this.alertsManager.visibleInstances[index].hide();
3149
- this.remove(index);
3151
+ if (this.alertsManager.visibleInstances[index]) {
3152
+ this.alertsManager.visibleInstances[index].hide();
3153
+ this.remove(index);
3154
+ }
3150
3155
  }
3151
3156
  /**
3152
3157
  * Hides alert by alert id (returned by the `show` method)
@@ -5454,6 +5459,8 @@
5454
5459
  this.defaultData = [];
5455
5460
  /* Column search mode */
5456
5461
  this.searchMode = 'any';
5462
+ /* Column can be used to search */
5463
+ this.searchable = true;
5457
5464
  this.lookup = debounce__default["default"]((lookupColumn) => {
5458
5465
  this.loading = true;
5459
5466
  const dataToLookup = Array.from(new Set(this.dataToLookup)); // remove duplicates
@@ -5485,7 +5492,9 @@
5485
5492
  this.xlsType = this.getInitValue('xlsType', props.xlsType, this.xlsType);
5486
5493
  this.conditions = this.getInitValue('conditions', props.conditions, this.conditions);
5487
5494
  this.searchMode = this.getInitValue('searchMode', props.searchMode, this.searchMode);
5495
+ this.searchable = this.getInitValue('searchable', props.searchable, this.searchable);
5488
5496
  this.helperText = this.getInitValue('', props.helperText, this.helperText);
5497
+ this.valueIn = this.getInitValue('valueIn', props.valueIn, this.name);
5489
5498
  this.createConditions();
5490
5499
  this.createActionConditions();
5491
5500
  if (this.componentProps.datasource) {
@@ -5517,7 +5526,7 @@
5517
5526
  throw new core.MethodNotAssignedError('viewGetWidth');
5518
5527
  }
5519
5528
  formatterByRow(row, cellProps) {
5520
- const value = row[this.name];
5529
+ const value = row[this.valueIn];
5521
5530
  const formatterFn = core.FormatterParserProvider.getFormatter(`column_${this.componentProps.component}`);
5522
5531
  if (formatterFn) {
5523
5532
  return formatterFn({
@@ -5852,7 +5861,9 @@
5852
5861
  });
5853
5862
  }
5854
5863
  isColumnSearchable(column) {
5855
- return (!this.searchVisibleOnly || column.isVisible) && (this.searchIn === undefined || this.searchIn === column.name);
5864
+ return column.searchable
5865
+ && (!this.searchVisibleOnly || column.isVisible)
5866
+ && (this.searchIn === undefined || this.searchIn === column.name);
5856
5867
  }
5857
5868
  }
5858
5869
 
@@ -7055,10 +7066,10 @@
7055
7066
  }
7056
7067
  getVisibleValue(row, column) {
7057
7068
  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];
7069
+ if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.valueIn)) {
7070
+ return this.editedRows[key][column.valueIn];
7060
7071
  }
7061
- return row[column.name];
7072
+ return row[column.valueIn];
7062
7073
  }
7063
7074
  /**
7064
7075
  * Returns editable component properties based on the column definition
@@ -7117,13 +7128,13 @@
7117
7128
  * If the row[column.name] has a selected value, pushes it
7118
7129
  */
7119
7130
  checkLookupData(column, row, componentProps) {
7120
- if (!row[column.name] || !column.lookupData || !componentProps.datasource)
7131
+ if (!row[column.valueIn] || !column.lookupData || !componentProps.datasource)
7121
7132
  return;
7122
7133
  componentProps.datasource.data = componentProps.datasource.data || [];
7123
7134
  // prevent pushing lookup values when using accessor in data
7124
7135
  if (!Array.isArray(componentProps.datasource.data))
7125
7136
  return;
7126
- const colValue = row[column.name];
7137
+ const colValue = row[column.valueIn];
7127
7138
  if (Array.isArray(colValue)) {
7128
7139
  colValue.forEach((item) => {
7129
7140
  const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
@@ -7160,7 +7171,7 @@
7160
7171
  */
7161
7172
  changeEditableComponent(column, row, value, component) {
7162
7173
  const key = row[this.datasource.uniqueKey];
7163
- const columnName = column.name;
7174
+ const columnName = column.valueIn;
7164
7175
  if (!core.Utils.isEqual(value, row[columnName])) {
7165
7176
  const newRow = {};
7166
7177
  newRow[key] = Object.assign({}, this.editedRows[key]);
@@ -7207,7 +7218,7 @@
7207
7218
  isEdited(column, row) {
7208
7219
  const key = row[this.datasource.uniqueKey];
7209
7220
  return this.editedRows[key]
7210
- && this.editedRows[key][column.name] !== this.editedRows[key][`${column.name}_original`];
7221
+ && this.editedRows[key][column.valueIn] !== this.editedRows[key][`${column.valueIn}_original`];
7211
7222
  }
7212
7223
  /**
7213
7224
  * Checks if row is an added row
@@ -7391,7 +7402,7 @@
7391
7402
  const key = row[this.datasource.uniqueKey];
7392
7403
  editableColumns.forEach((column) => {
7393
7404
  const instance = componentInstances[column.name];
7394
- if (!instance.isValid(row[column.name])) {
7405
+ if (!instance.isValid(row[column.valueIn])) {
7395
7406
  invalidCompNames.push(this.getCompName(key, column.name));
7396
7407
  }
7397
7408
  });
@@ -7484,7 +7495,7 @@
7484
7495
  throw new RowNotFoundError(newRow[uniqueKey], this.name);
7485
7496
  }
7486
7497
  this.columns.forEach((column) => {
7487
- const columnName = column.name;
7498
+ const columnName = column.valueIn;
7488
7499
  this.changeCell(newRow[uniqueKey], rowIdx, column, newRow[columnName]);
7489
7500
  });
7490
7501
  }
@@ -7901,27 +7912,45 @@
7901
7912
  super.change(event, element);
7902
7913
  }
7903
7914
  /**
7904
- * Method to increment the value
7915
+ * Increases the component's value by the step amount.
7905
7916
  */
7906
7917
  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;
7918
+ const currentValue = Number(this.value);
7919
+ const isValueInvalid = this.value === null || this.value === '' || Number.isNaN(currentValue);
7920
+ // First, handle the case where the input is empty or not a number.
7921
+ if (isValueInvalid) {
7922
+ // Determine the starting value. Default to `minValue` if it's positive, otherwise start from `step`.
7923
+ const startValue = (this.minValue !== undefined && this.minValue > 0) ? this.minValue : this.step;
7924
+ // Set the value, but clamp it to the maximum limit if one exists.
7925
+ this.value = (this.maxValue !== undefined) ? Math.min(startValue, this.maxValue) : startValue;
7926
+ return;
7910
7927
  }
7911
- else if (this.value !== this.maxValue) {
7912
- this.value += this.step;
7928
+ // If the input is a valid number, calculate the next value.
7929
+ const nextValue = currentValue + this.step;
7930
+ // Only update if the new value does not exceed the maximum boundary.
7931
+ if (this.maxValue === undefined || nextValue <= this.maxValue) {
7932
+ this.value = nextValue;
7913
7933
  }
7914
7934
  }
7915
7935
  /**
7916
- * Method to decrement the value
7936
+ * Decreases the component's value by the step amount.
7917
7937
  */
7918
7938
  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;
7939
+ const currentValue = Number(this.value);
7940
+ const isValueInvalid = this.value === null || this.value === '' || Number.isNaN(currentValue);
7941
+ // First, handle the case where the input is empty or not a number.
7942
+ if (isValueInvalid) {
7943
+ // Determine the starting value. Handles the edge case where the max value is negative.
7944
+ const startValue = (this.maxValue !== undefined && this.maxValue < 0) ? this.maxValue : -this.step;
7945
+ // Set the value, but clamp it to the minimum limit if one exists.
7946
+ this.value = (this.minValue !== undefined) ? Math.max(startValue, this.minValue) : startValue;
7947
+ return;
7922
7948
  }
7923
- else if (this.value !== this.minValue) {
7924
- this.value -= this.step;
7949
+ // If the input is a valid number, calculate the next value.
7950
+ const nextValue = currentValue - this.step;
7951
+ // Only update if the new value does not go below the minimum boundary.
7952
+ if (this.minValue === undefined || nextValue >= this.minValue) {
7953
+ this.value = nextValue;
7925
7954
  }
7926
7955
  }
7927
7956
  }
@@ -8510,18 +8539,26 @@
8510
8539
  SUM: 'SUM',
8511
8540
  };
8512
8541
  this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
8542
+ this.labelFormatter = labelFormatter;
8513
8543
  this.reportColumnTransformer = this.getReportColumnTransformer(labelFormatter);
8514
8544
  }
8515
8545
  getReportColumnTransformer(labelFormatter) {
8516
8546
  return new ReportColumnTransformer({ labelFormatter, fileType: this.getFileType() });
8517
8547
  }
8548
+ getColumnLabel(key, column) {
8549
+ if (!column)
8550
+ return key;
8551
+ if (!this.labelFormatter)
8552
+ return column.label || key;
8553
+ return this.labelFormatter({ column, fileType: this.getFileType() });
8554
+ }
8518
8555
  buildFilter(filter, columns) {
8519
8556
  return Object.keys(filter).map((key) => {
8520
- var _a;
8521
- return ({
8522
- label: ((_a = columns.find((col) => col.name === key)) === null || _a === void 0 ? void 0 : _a.label) || key,
8557
+ const column = columns.find((col) => col.name === key);
8558
+ return {
8559
+ label: this.getColumnLabel(key, column),
8523
8560
  value: core.I18n.translate('IS_EQUAL', { value: filter[key] }),
8524
- });
8561
+ };
8525
8562
  });
8526
8563
  }
8527
8564
  formatLangCode(lang) {
@@ -8530,6 +8567,12 @@
8530
8567
  }
8531
8568
  return lang.toLowerCase().replace('-', '_');
8532
8569
  }
8570
+ filterColumns(columns) {
8571
+ return columns.filter((item) => (item.type !== 'action' && item.isVisible !== false));
8572
+ }
8573
+ buildCols(columns) {
8574
+ return this.reportColumnTransformer.transform(this.filterColumns(columns));
8575
+ }
8533
8576
  }
8534
8577
 
8535
8578
  class CSVReport extends BaseReport {
@@ -8540,8 +8583,9 @@
8540
8583
  getFileType() {
8541
8584
  return 'csv';
8542
8585
  }
8543
- buildDataset(data, columns) {
8544
- const columnNames = columns.map((col) => col.name);
8586
+ buildDataset({ data, columns }) {
8587
+ const filteredColumns = this.filterColumns(columns);
8588
+ const columnNames = filteredColumns.map((col) => col.name);
8545
8589
  const result = data.reduce((reduced, row) => {
8546
8590
  const values = columnNames.map((col) => row[col] || '');
8547
8591
  return [...reduced, values];
@@ -8549,7 +8593,7 @@
8549
8593
  return JSON.stringify(result);
8550
8594
  }
8551
8595
  buildMetadata(name, title, columns, filter) {
8552
- const builtCols = this.reportColumnTransformer.transform(columns);
8596
+ const builtCols = this.buildCols(columns);
8553
8597
  const builtFilters = this.buildFilter(filter || {}, columns);
8554
8598
  const lang = this.formatLangCode(core.I18n.instance.language);
8555
8599
  const clientLogo = '';
@@ -8593,7 +8637,7 @@
8593
8637
  const fileType = this.getFileType();
8594
8638
  return new ReportColumnTransformer({ getFormatFn, labelFormatter, fileType });
8595
8639
  }
8596
- buildDataset(data) {
8640
+ buildDataset({ data }) {
8597
8641
  return JSON.stringify(data);
8598
8642
  }
8599
8643
  getFormatOfColumn(column) {
@@ -8643,7 +8687,7 @@
8643
8687
  }
8644
8688
  buildMetadata(name, title, columns, filter, portrait = true) {
8645
8689
  return __awaiter(this, void 0, void 0, function* () {
8646
- const builtCols = this.reportColumnTransformer.transform(columns);
8690
+ const builtCols = this.buildCols(columns);
8647
8691
  const builtFilters = this.buildFilter(filter || {}, columns);
8648
8692
  const lang = this.formatLangCode(core.I18n.instance.language);
8649
8693
  let clientLogo = '';
@@ -8731,8 +8775,8 @@
8731
8775
  getFileType() {
8732
8776
  return 'xls';
8733
8777
  }
8734
- buildDataset(data, columns) {
8735
- const result = this.formatRawDataSet(data, columns);
8778
+ buildDataset({ data, columns }) {
8779
+ const result = this.formatRawDataSet(data, this.filterColumns(columns));
8736
8780
  return JSON.stringify(result);
8737
8781
  }
8738
8782
  // formata o dataset para o formato "cru" xls
@@ -8745,7 +8789,7 @@
8745
8789
  return result;
8746
8790
  }
8747
8791
  buildMetadata(name, title, columns, filter) {
8748
- const builtCols = this.reportColumnTransformer.transform(columns);
8792
+ const builtCols = this.buildCols(columns);
8749
8793
  const builtFilters = this.buildFilter(filter || {}, columns);
8750
8794
  const lang = this.formatLangCode(core.I18n.instance.language);
8751
8795
  const clientLogo = '';
@@ -8788,12 +8832,12 @@
8788
8832
  getFileType() {
8789
8833
  return 'xls';
8790
8834
  }
8791
- buildDataset(data, metadata) {
8835
+ buildDataset({ data, metadata }) {
8792
8836
  const result = this.formatDataSet(metadata, data);
8793
8837
  return JSON.stringify(result);
8794
8838
  }
8795
8839
  buildMetadata(name, title, columns, filter) {
8796
- const builtCols = this.reportColumnTransformer.transform(columns);
8840
+ const builtCols = this.buildCols(columns);
8797
8841
  const builtFilters = this.buildFilter(filter || {}, columns);
8798
8842
  const lang = this.formatLangCode(core.I18n.instance.language);
8799
8843
  const clientLogo = '';
@@ -8988,12 +9032,12 @@
8988
9032
  getFileType() {
8989
9033
  return 'xls';
8990
9034
  }
8991
- buildDataset(data, metadata) {
9035
+ buildDataset({ data, metadata }) {
8992
9036
  const result = this.formatDataSet(metadata, data);
8993
9037
  return JSON.stringify(result);
8994
9038
  }
8995
9039
  buildMetadata(name, title, columns, filter) {
8996
- const builtCols = this.reportColumnTransformer.transform(columns);
9040
+ const builtCols = this.buildCols(columns);
8997
9041
  const builtFilters = this.buildFilter(filter || {}, columns);
8998
9042
  const lang = this.formatLangCode(core.I18n.instance.language);
8999
9043
  const clientLogo = '';
@@ -9313,21 +9357,20 @@
9313
9357
  const { route } = reportType;
9314
9358
  const { name, columns, datasource } = this.iterable;
9315
9359
  const { groupedData } = Object.assign({}, this.iterable);
9316
- const formattedColumns = this.filterColumns(columns);
9317
- const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
9360
+ const metadataObj = yield reportType.buildMetadata(name, this.title, columns, datasource.filter, portrait);
9318
9361
  let dataset;
9319
9362
  if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
9320
9363
  const rowMetadata = rowObj.metaData;
9321
9364
  const metadataObjClone = merge__default["default"](rowMetadata, JSON.parse(metadataObj));
9322
- dataset = reportType.buildDataset(groupedData, metadataObjClone);
9365
+ dataset = reportType.buildDataset({ data: groupedData, metadata: metadataObjClone });
9323
9366
  }
9324
9367
  else if (reportType instanceof PDFReport && groupedData && groupedData.length > 0) {
9325
9368
  const formatter = new GroupedPDFFormatter();
9326
9369
  const pdfGroupedData = formatter.format(groupedData);
9327
- dataset = reportType.buildDataset(pdfGroupedData);
9370
+ dataset = reportType.buildDataset({ data: pdfGroupedData });
9328
9371
  }
9329
9372
  else {
9330
- dataset = reportType.buildDataset(data, formattedColumns);
9373
+ dataset = reportType.buildDataset({ data, metadata: metadataObj, columns });
9331
9374
  }
9332
9375
  const filter = '[]';
9333
9376
  let row = {
@@ -9356,9 +9399,6 @@
9356
9399
  return new URL(reportFile, this.fileEndPoint).href;
9357
9400
  });
9358
9401
  }
9359
- filterColumns(columns) {
9360
- return columns.filter((item) => (item.type !== 'action' && item.isVisible));
9361
- }
9362
9402
  }
9363
9403
 
9364
9404
  class TreeDataStructure {
@@ -10439,7 +10479,7 @@
10439
10479
  component: 'ZdGrid',
10440
10480
  cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
10441
10481
  columns: this.modalSelectionColumns,
10442
- datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
10482
+ datasource: Object.assign(Object.assign({}, this.datasource.clone()), { limit: this.defaultDatasource.limit, lazyLoad: false, searchIn: undefined }),
10443
10483
  toolbarSlot: [
10444
10484
  {
10445
10485
  name: `${this.name}-modal-selection-title`,
@@ -10518,7 +10558,7 @@
10518
10558
  });
10519
10559
  }
10520
10560
  }
10521
- core.FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
10561
+ core.FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', eagerMask, }) => {
10522
10562
  if (value === null || value === undefined) {
10523
10563
  return null;
10524
10564
  }
@@ -10550,7 +10590,7 @@
10550
10590
  let masked = value[column];
10551
10591
  if (masks[index]) {
10552
10592
  const maskValue = typeof masks[index] === 'function' ? masks[index](value[column]) : masks[index];
10553
- masked = core.Mask.getValueWithMask(value[column], maskValue);
10593
+ masked = core.Mask.getValueWithMask(value[column], maskValue, false, eagerMask);
10554
10594
  }
10555
10595
  return result + separator + masked;
10556
10596
  }
@@ -10712,6 +10752,10 @@
10712
10752
  constructor(props) {
10713
10753
  super(props);
10714
10754
  this.lazyAttach = false;
10755
+ /**
10756
+ * * hide the option to select search field
10757
+ */
10758
+ this.hideSearchField = false;
10715
10759
  this.debounceSetSearch = debounce__default["default"](this.setSearch, 500);
10716
10760
  this.iterableComponentName = this.getInitValue('iterableComponentName', props.iterableComponentName, this.iterableComponent);
10717
10761
  this.showHelper = this.getInitValue('showHelper', props.showHelper, false);
@@ -10720,6 +10764,7 @@
10720
10764
  this.placeholder = this.getInitValue('placeholder', props.placeholder, 'SEARCH');
10721
10765
  this.cssClass = this.getInitValue('cssClass', props.cssClass, 'zd-float-right');
10722
10766
  this.lazyAttach = this.getInitValue('lazyAttach', props.lazyAttach, this.lazyAttach);
10767
+ this.hideSearchField = this.getInitValue('hideSearchField', props.hideSearchField, this.hideSearchField);
10723
10768
  this.debounceSetSearch = this.debounceSetSearch.bind(this);
10724
10769
  if (!this.lazyAttach)
10725
10770
  this.setIterableComponent();
@@ -12156,7 +12201,8 @@
12156
12201
  }
12157
12202
  }
12158
12203
  return value;
12159
- });
12204
+ });
12205
+ InputFactory.register('ZdMonth', Month);
12160
12206
 
12161
12207
  /**
12162
12208
  * Base class for Password component.
@@ -12946,7 +12992,8 @@
12946
12992
  return formattedRow;
12947
12993
  });
12948
12994
  return formattedValue;
12949
- });
12995
+ });
12996
+ InputFactory.register('ZdSelectMultiple', SelectMultiple);
12950
12997
 
12951
12998
  /**
12952
12999
  * Base class for Select Tree component.
@@ -13540,7 +13587,8 @@
13540
13587
  }
13541
13588
  }
13542
13589
  const selectFormatterFn = core.FormatterParserProvider.getFormatter('ZdSelectMultiple');
13543
- core.FormatterParserProvider.registerFormatter('ZdSelectTreeMultiple', selectFormatterFn);
13590
+ core.FormatterParserProvider.registerFormatter('ZdSelectTreeMultiple', selectFormatterFn);
13591
+ InputFactory.register('ZdSelectTreeMultiple', SelectTreeMultiple);
13544
13592
 
13545
13593
  /**
13546
13594
  * Base class for SelectableList component.
@@ -15567,10 +15615,10 @@
15567
15615
  }
15568
15616
  getVisibleValue(row, column) {
15569
15617
  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];
15618
+ if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.valueIn)) {
15619
+ return this.editedRows[key][column.valueIn];
15572
15620
  }
15573
- return row[column.name];
15621
+ return row[column.valueIn];
15574
15622
  }
15575
15623
  /**
15576
15624
  * Returns editable component properties based on the column definition
@@ -15624,13 +15672,13 @@
15624
15672
  * If the row[column.name] has a selected value, pushes it
15625
15673
  */
15626
15674
  checkLookupData(column, row, componentProps) {
15627
- if (!row[column.name] || !column.lookupData || !componentProps.datasource)
15675
+ if (!row[column.valueIn] || !column.lookupData || !componentProps.datasource)
15628
15676
  return;
15629
15677
  componentProps.datasource.data = componentProps.datasource.data || [];
15630
15678
  // prevent pushing lookup values when using accessor in data
15631
15679
  if (!Array.isArray(componentProps.datasource.data))
15632
15680
  return;
15633
- const colValue = row[column.name];
15681
+ const colValue = row[column.valueIn];
15634
15682
  if (Array.isArray(colValue)) {
15635
15683
  colValue.forEach((item) => {
15636
15684
  const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
@@ -15667,7 +15715,7 @@
15667
15715
  */
15668
15716
  changeEditableComponent(column, row, value, component) {
15669
15717
  const key = row[this.datasource.uniqueKey];
15670
- const columnName = column.name;
15718
+ const columnName = column.valueIn;
15671
15719
  if (!core.Utils.isEqual(value, row[columnName])) {
15672
15720
  const newRow = {};
15673
15721
  newRow[key] = Object.assign({}, this.editedRows[key]);
@@ -15702,7 +15750,7 @@
15702
15750
  isEdited(column, row) {
15703
15751
  const key = row[this.datasource.uniqueKey];
15704
15752
  return this.editedRows[key]
15705
- && this.editedRows[key][column.name] !== this.editedRows[key][`${column.name}_original`];
15753
+ && this.editedRows[key][column.valueIn] !== this.editedRows[key][`${column.valueIn}_original`];
15706
15754
  }
15707
15755
  /**
15708
15756
  * Checks if column is valid
@@ -15839,7 +15887,7 @@
15839
15887
  throw new RowNotFoundError(newRow[uniqueKey], this.name);
15840
15888
  }
15841
15889
  this.columns.forEach((column) => {
15842
- const columnName = column.name;
15890
+ const columnName = column.valueIn;
15843
15891
  this.changeCell(newRow[uniqueKey], rowIdx, column, newRow[columnName]);
15844
15892
  });
15845
15893
  }
@@ -15924,7 +15972,7 @@
15924
15972
  const dataTextName = typeof item === 'string' ? item : item.name;
15925
15973
  lookupRow[dataTextName] = row[foreignColumns[dataTextName] || dataTextName];
15926
15974
  });
15927
- lookupRow[dataValue] = row[column.name];
15975
+ lookupRow[dataValue] = row[column.valueIn];
15928
15976
  return lookupRow;
15929
15977
  };
15930
15978
  const getFormatterLookupRow = (column, row, dataValue, formatterDataTextColumns, dataTextColumns) => {
@@ -15935,7 +15983,7 @@
15935
15983
  const formatterDataTextColumn = typeof item === 'string' ? item : item.name;
15936
15984
  lookupRow[dataTextName] = row[formatterDataTextColumn];
15937
15985
  });
15938
- lookupRow[dataValue] = row[column.name];
15986
+ lookupRow[dataValue] = row[column.valueIn];
15939
15987
  return lookupRow;
15940
15988
  };
15941
15989
  /**
@@ -15949,7 +15997,7 @@
15949
15997
  const dataTextColumns = asArray(dataText);
15950
15998
  // when using foreignColumns, should store foreign keys information in lookupData
15951
15999
  if (foreignColumns) {
15952
- column.lookupData[row[column.name]] = getForeignLookupRow(column, row, dataValue, dataTextColumns, foreignColumns);
16000
+ column.lookupData[row[column.valueIn]] = getForeignLookupRow(column, row, dataValue, dataTextColumns, foreignColumns);
15953
16001
  return row;
15954
16002
  }
15955
16003
  // when not using formatterDataText, should fetch data from datasource to be able to format this cell
@@ -15959,13 +16007,13 @@
15959
16007
  const formatterDataTextColumns = asArray(formatterDataText);
15960
16008
  // when using formatterDataText, should store dataText information in lookupData
15961
16009
  if (formatterDataTextColumns.length === dataTextColumns.length) {
15962
- const rowColumn = row[column.name];
16010
+ const rowColumn = row[column.valueIn];
15963
16011
  column.lookupData[rowColumn] = getFormatterLookupRow(column, row, dataValue, formatterDataTextColumns, dataTextColumns);
15964
16012
  return row;
15965
16013
  }
15966
16014
  return row;
15967
16015
  };
15968
- const formatter$1 = ({ column, value, row, componentProps, }) => {
16016
+ const formatter$2 = ({ column, value, row, componentProps, }) => {
15969
16017
  if (value === null || value === undefined)
15970
16018
  return '';
15971
16019
  const { dataText, formatterDataText, dataTextSeparator, dataValue, dataTextDiscrete, foreignColumns, } = componentProps;
@@ -15996,12 +16044,12 @@
15996
16044
  return currentRow[textColumn] || value;
15997
16045
  }
15998
16046
  const formatterFn = core.FormatterParserProvider.getFormatter('ZdSelect');
15999
- return formatterFn(currentRow, { dataText: textColumn, dataTextSeparator });
16047
+ return formatterFn(currentRow, { dataText: textColumn, dataTextSeparator, eagerMask: false });
16000
16048
  };
16001
- core.FormatterParserProvider.registerFormatter('column_ZdSelect', formatter$1);
16002
- core.FormatterParserProvider.registerFormatter('column_ZdSelectTree', formatter$1);
16049
+ core.FormatterParserProvider.registerFormatter('column_ZdSelect', formatter$2);
16050
+ core.FormatterParserProvider.registerFormatter('column_ZdSelectTree', formatter$2);
16003
16051
 
16004
- const formatter = ({ column, value, row, componentProps, }) => {
16052
+ const formatter$1 = ({ column, value, row, componentProps, }) => {
16005
16053
  if (!value || !Array.isArray(value) || value.length === 0)
16006
16054
  return '';
16007
16055
  const { formatterDataText, foreignColumns, dataText } = componentProps;
@@ -16039,8 +16087,12 @@
16039
16087
  });
16040
16088
  return result.join(', ');
16041
16089
  };
16042
- core.FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', formatter);
16043
- core.FormatterParserProvider.registerFormatter('column_ZdSelectTreeMultiple', formatter);
16090
+ core.FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', formatter$1);
16091
+ core.FormatterParserProvider.registerFormatter('column_ZdSelectTreeMultiple', formatter$1);
16092
+
16093
+ const defaultFormatter = core.FormatterParserProvider.getFormatter('ZdTextInput');
16094
+ const formatter = ({ value, componentProps, }) => defaultFormatter(value, Object.assign(Object.assign({}, componentProps), { eagerMask: false }));
16095
+ core.FormatterParserProvider.registerFormatter('column_ZdTextInput', formatter);
16044
16096
 
16045
16097
  const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
16046
16098
  const packageContent = require('../package.json');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.111.1",
3
+ "version": "1.113.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": "09c421e9201842e6426485730c44dc9a817b9698"
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
  }
@@ -132,7 +132,7 @@ export declare class Input extends ComponentRender implements IInput {
132
132
  /**
133
133
  * Sets view validation method.
134
134
  */
135
- setViewValidate(viewValidate: () => boolean | string): void;
135
+ setViewValidate(viewValidate: (force: boolean) => boolean | string): void;
136
136
  /**
137
137
  * Sets view reset validation method.
138
138
  */
@@ -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