@zeedhi/common 1.96.0 → 1.96.1

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.
@@ -2010,7 +2010,10 @@
2010
2010
  */
2011
2011
  updateRules() {
2012
2012
  this.rules = Object.values(this.parsedValidations)
2013
- .map((validation) => () => validation(this.value));
2013
+ .map((validation) => (value) => {
2014
+ const testValue = value !== undefined ? value : this.value;
2015
+ return validation(testValue);
2016
+ });
2014
2017
  }
2015
2018
  /**
2016
2019
  * Input value.
@@ -2063,8 +2066,11 @@
2063
2066
  * Checks the input value are valid to all applied rules.
2064
2067
  * @returns Input is valid
2065
2068
  */
2066
- isValid() {
2067
- return this.rules.every((rule) => typeof rule(this.value) !== 'string');
2069
+ isValid(value) {
2070
+ return this.rules.every((rule) => {
2071
+ const testValue = value !== undefined ? value : this.value;
2072
+ return typeof rule(testValue) !== 'string';
2073
+ });
2068
2074
  }
2069
2075
  /**
2070
2076
  * Triggered when the input value changes.
@@ -2149,6 +2155,19 @@
2149
2155
  }
2150
2156
  }
2151
2157
 
2158
+ class InputFactory {
2159
+ static register(className, inputClass) {
2160
+ if (!this.inputClasses[className])
2161
+ this.inputClasses[className] = inputClass;
2162
+ }
2163
+ static factory(props) {
2164
+ if (!this.inputClasses[props.component])
2165
+ return undefined;
2166
+ return new this.inputClasses[props.component](props);
2167
+ }
2168
+ }
2169
+ InputFactory.inputClasses = {};
2170
+
2152
2171
  /**
2153
2172
  * Base class for Checkbox component.
2154
2173
  */
@@ -2163,7 +2182,8 @@
2163
2182
  this.showHelper = false;
2164
2183
  this.createAccessors();
2165
2184
  }
2166
- }
2185
+ }
2186
+ InputFactory.register('ZdCheckbox', Checkbox);
2167
2187
 
2168
2188
  /**
2169
2189
  * Base class for Checkbox multiple component.
@@ -2216,7 +2236,8 @@
2216
2236
  super.onBeforeDestroy();
2217
2237
  this.datasource.destroy();
2218
2238
  }
2219
- }
2239
+ }
2240
+ InputFactory.register('ZdCheckboxMultiple', CheckboxMultiple);
2220
2241
 
2221
2242
  /**
2222
2243
  * Base class for Chip component.
@@ -2703,10 +2724,15 @@
2703
2724
  * Defines text input value should concat the suffix text.
2704
2725
  */
2705
2726
  this.valueWithSuffix = textInputDefaults.valueWithSuffix;
2727
+ /**
2728
+ * Defines clicks on outer icon should focus the component.
2729
+ */
2730
+ this.focusOnOuterIconClick = true;
2706
2731
  this.formatterFn = core.FormatterParserProvider.getFormatter('ZdTextInput');
2707
2732
  this.parserFn = core.FormatterParserProvider.getParser('ZdTextInput');
2708
2733
  this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, this.appendIcon);
2709
2734
  this.appendOuterIcon = this.getInitValue('appendOuterIcon', props.appendOuterIcon, this.appendOuterIcon);
2735
+ this.focusOnOuterIconClick = this.getInitValue('focusOnOuterIconClick', props.focusOnOuterIconClick, this.focusOnOuterIconClick);
2710
2736
  this.prefix = this.getInitValue('prefix', props.prefix, this.prefix);
2711
2737
  this.prependIcon = this.getInitValue('prependIcon', props.prependIcon, this.prependIcon);
2712
2738
  this.prependOuterIcon = this.getInitValue('prependOuterIcon', props.prependOuterIcon, this.prependOuterIcon);
@@ -2812,7 +2838,8 @@
2812
2838
  formatted = prefixValue + formatted + suffixValue;
2813
2839
  }
2814
2840
  return formatted;
2815
- });
2841
+ });
2842
+ InputFactory.register('ZdTextInput', TextInput);
2816
2843
 
2817
2844
  /**
2818
2845
  * Base class for Number component
@@ -2922,7 +2949,8 @@
2922
2949
  let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2923
2950
  maskValue = Object.assign(Object.assign({}, core.Config.masks.numberMask), maskValue);
2924
2951
  return value === '' ? null : AutoNumeric.unformat(value, maskValue);
2925
- });
2952
+ });
2953
+ InputFactory.register('ZdNumber', Number$1);
2926
2954
 
2927
2955
  /**
2928
2956
  * Base class for Currency component
@@ -2958,7 +2986,8 @@
2958
2986
  let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2959
2987
  maskValue = Object.assign(Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask), maskValue);
2960
2988
  return value === '' ? null : AutoNumeric.unformat(value, maskValue);
2961
- });
2989
+ });
2990
+ InputFactory.register('ZdCurrency', Currency);
2962
2991
 
2963
2992
  class AlertQueue {
2964
2993
  constructor() {
@@ -4216,7 +4245,8 @@
4216
4245
  return core.dayjs(value, displayFormat).format(dateTimeFormat);
4217
4246
  }
4218
4247
  return value;
4219
- });
4248
+ });
4249
+ InputFactory.register('ZdDate', Date$1);
4220
4250
 
4221
4251
  class DateRange extends TextInput {
4222
4252
  /* istanbul ignore next */
@@ -4680,7 +4710,8 @@
4680
4710
  }
4681
4711
  });
4682
4712
  return formattedValue;
4683
- });
4713
+ });
4714
+ InputFactory.register('ZdDateRange', DateRange);
4684
4715
 
4685
4716
  /**
4686
4717
  * Base class for Divider component.
@@ -4950,7 +4981,10 @@
4950
4981
  .map((key) => {
4951
4982
  const validation = this.parsedValidations[key];
4952
4983
  if (key !== 'maxFileSize')
4953
- return () => validation(this.value);
4984
+ return (value) => {
4985
+ const testValue = value !== undefined ? value : this.value;
4986
+ return validation(testValue);
4987
+ };
4954
4988
  return () => {
4955
4989
  if (this.viewGetFileSizes) {
4956
4990
  const fileSizes = this.viewGetFileSizes();
@@ -4972,7 +5006,8 @@
4972
5006
  });
4973
5007
  const message = core.I18n.translate((config.message || 'VALIDATION_FILE_SIZE'), { fileError });
4974
5008
  return (fileError === '') || message;
4975
- });
5009
+ });
5010
+ InputFactory.register('ZdFileInput', FileInput);
4976
5011
 
4977
5012
  /**
4978
5013
  * Base class for Footer component.
@@ -6015,7 +6050,7 @@
6015
6050
  },
6016
6051
  tab: {
6017
6052
  event: this.navigateRight.bind(this),
6018
- prevent: true,
6053
+ prevent: false,
6019
6054
  active: true,
6020
6055
  index: 99,
6021
6056
  input: true,
@@ -6023,7 +6058,7 @@
6023
6058
  },
6024
6059
  'shift+tab': {
6025
6060
  event: this.navigateLeft.bind(this),
6026
- prevent: true,
6061
+ prevent: false,
6027
6062
  active: true,
6028
6063
  index: 99,
6029
6064
  input: true,
@@ -6274,51 +6309,58 @@
6274
6309
  arrSelection.splice(index, 1);
6275
6310
  }
6276
6311
  }
6277
- navigateLeft() {
6312
+ navigateLeft({ event }) {
6278
6313
  if (!this.viewNavigate)
6279
6314
  return;
6280
- this.viewNavigate('left');
6315
+ this.viewNavigate('left', event);
6281
6316
  }
6282
- navigateRight() {
6317
+ navigateRight({ event }) {
6283
6318
  if (!this.viewNavigate)
6284
6319
  return;
6285
- this.viewNavigate('right');
6320
+ this.viewNavigate('right', event);
6286
6321
  }
6287
6322
  navigateUp() {
6288
- if (this.cellSelection && this.viewNavigate) {
6289
- this.viewNavigate('up');
6290
- return;
6291
- }
6292
- const { uniqueKey, currentRow } = this.datasource;
6293
- const rowIndex = this.datasource.data.findIndex((row) => row[uniqueKey] === currentRow[uniqueKey]);
6294
- if (rowIndex === -1) {
6295
- this.datasource.currentRow = this.datasource.data[this.datasource.data.length - 1];
6296
- [this.currentColumn] = this.columns;
6297
- return;
6298
- }
6299
- if (rowIndex === 0) {
6300
- this.navigatePageDown();
6323
+ if (!this.viewNavigate)
6301
6324
  return;
6302
- }
6303
- this.datasource.currentRow = this.datasource.data[rowIndex - 1];
6325
+ this.viewNavigate('up');
6304
6326
  }
6305
6327
  navigateDown() {
6306
- if (this.cellSelection && this.viewNavigate) {
6307
- this.viewNavigate('down');
6328
+ if (!this.viewNavigate)
6308
6329
  return;
6309
- }
6330
+ this.viewNavigate('down');
6331
+ }
6332
+ navigateDatasource(up) {
6310
6333
  const { uniqueKey, currentRow } = this.datasource;
6311
6334
  const rowIndex = this.datasource.data.findIndex((row) => row[uniqueKey] === currentRow[uniqueKey]);
6312
6335
  if (rowIndex === -1) {
6313
- [this.datasource.currentRow] = this.datasource.data;
6314
- [this.currentColumn] = this.columns;
6315
- return;
6336
+ return this.navigateInitial(up);
6316
6337
  }
6317
- if (rowIndex === this.datasource.data.length - 1) {
6318
- this.navigatePageUp();
6338
+ if (up && rowIndex === 0) {
6339
+ return this.navigatePageDown();
6340
+ }
6341
+ if (!up && rowIndex === this.datasource.data.length - 1) {
6342
+ return this.navigatePageUp();
6343
+ }
6344
+ return this.navigateCurrentRow(up, rowIndex);
6345
+ }
6346
+ navigateCurrentRow(up, rowIndex) {
6347
+ const addIndex = up ? -1 : 1;
6348
+ this.datasource.currentRow = this.datasource.data[rowIndex + addIndex];
6349
+ }
6350
+ navigateInitial(up) {
6351
+ if (up) {
6352
+ this.navigateLast();
6319
6353
  return;
6320
6354
  }
6321
- this.datasource.currentRow = this.datasource.data[rowIndex + 1];
6355
+ this.navigateFirst();
6356
+ }
6357
+ navigateFirst() {
6358
+ [this.datasource.currentRow] = this.datasource.data;
6359
+ [this.currentColumn] = this.columns;
6360
+ }
6361
+ navigateLast() {
6362
+ this.datasource.currentRow = this.datasource.data[this.datasource.data.length - 1];
6363
+ [this.currentColumn] = this.columns;
6322
6364
  }
6323
6365
  navigatePageUp() {
6324
6366
  if (this.datasource.page < Math.ceil(this.datasource.total / this.datasource.limit)) {
@@ -6853,6 +6895,9 @@
6853
6895
  if (!revalidate) {
6854
6896
  return Object.keys(this.invalidComponents).length === 0;
6855
6897
  }
6898
+ if (!this.editing) {
6899
+ return this.isViewGridValid();
6900
+ }
6856
6901
  let allValid = true;
6857
6902
  this.datasource.data.forEach((row) => this.columns.forEach((column) => {
6858
6903
  if (!column.isVisible || !column.editable)
@@ -6862,6 +6907,38 @@
6862
6907
  }));
6863
6908
  return allValid;
6864
6909
  }
6910
+ /**
6911
+ * Checks whether the grid is valid while not in editing mode
6912
+ */
6913
+ isViewGridValid(forceEditing = true) {
6914
+ const invalidCompNames = [];
6915
+ const componentInstances = {};
6916
+ const editableColumns = this.columns.filter((column) => column.editable && column.isVisible);
6917
+ editableColumns.forEach((column) => {
6918
+ const compName = this.getCompName('temp', column.name);
6919
+ const componentProps = Object.assign(Object.assign({}, column.componentProps), { name: compName });
6920
+ componentInstances[column.name] = InputFactory.factory(componentProps);
6921
+ });
6922
+ this.datasource.data.forEach((row) => {
6923
+ const key = row[this.datasource.uniqueKey];
6924
+ editableColumns.forEach((column) => {
6925
+ const instance = componentInstances[column.name];
6926
+ if (!instance.isValid(row[column.name])) {
6927
+ invalidCompNames.push(this.getCompName(key, column.name));
6928
+ }
6929
+ });
6930
+ });
6931
+ if (invalidCompNames.length > 0 && forceEditing) {
6932
+ this.editing = true;
6933
+ core.ViewService.nextTick(() => {
6934
+ invalidCompNames.forEach((compName) => {
6935
+ const invalidComponent = core.Metadata.getInstance(compName);
6936
+ invalidComponent.validate();
6937
+ });
6938
+ });
6939
+ }
6940
+ return invalidCompNames.length === 0;
6941
+ }
6865
6942
  /**
6866
6943
  * Adds new row to the datasource data and pushes it to the editedRows
6867
6944
  * @param row Row
@@ -7347,7 +7424,8 @@
7347
7424
  this.value -= this.step;
7348
7425
  }
7349
7426
  }
7350
- }
7427
+ }
7428
+ InputFactory.register('ZdIncrement', Increment);
7351
7429
 
7352
7430
  class IterableColumnsButtonController {
7353
7431
  constructor(iterableComponent) {
@@ -8032,7 +8110,8 @@
8032
8110
  }
8033
8111
  return result;
8034
8112
  }, '');
8035
- });
8113
+ });
8114
+ InputFactory.register('ZdSelect', Select);
8036
8115
 
8037
8116
  /**
8038
8117
  * Base class for Iterable Page Size component
@@ -8199,7 +8278,8 @@
8199
8278
  yield this.iterableComponent.setSearch(search);
8200
8279
  });
8201
8280
  }
8202
- }
8281
+ }
8282
+ InputFactory.register('ZdSearch', Search);
8203
8283
 
8204
8284
  /**
8205
8285
  * Base class for IterableComponentRender component.
@@ -9457,12 +9537,14 @@
9457
9537
  */
9458
9538
  show() {
9459
9539
  this.isVisible = true;
9540
+ core.ViewService.nextTick(() => this.callEvent('onShow', { component: this }));
9460
9541
  }
9461
9542
  /**
9462
9543
  * Closes modal
9463
9544
  */
9464
9545
  hide() {
9465
9546
  this.isVisible = false;
9547
+ core.ViewService.nextTick(() => this.callEvent('onHide', { component: this }));
9466
9548
  }
9467
9549
  }
9468
9550
 
@@ -9633,7 +9715,8 @@
9633
9715
  }
9634
9716
  }
9635
9717
  }
9636
- core.FormatterParserProvider.registerFormatter('ZdPassword', (value) => (value || '').replace(/./g, '*'));
9718
+ core.FormatterParserProvider.registerFormatter('ZdPassword', (value) => (value || '').replace(/./g, '*'));
9719
+ InputFactory.register('ZdPassword', Password);
9637
9720
 
9638
9721
  /**
9639
9722
  * Base class for Progress component
@@ -9728,7 +9811,8 @@
9728
9811
  super.onBeforeDestroy();
9729
9812
  this.datasource.destroy();
9730
9813
  }
9731
- }
9814
+ }
9815
+ InputFactory.register('ZdRadio', Radio);
9732
9816
 
9733
9817
  /**
9734
9818
  * Base class for Range Slider component
@@ -9825,7 +9909,8 @@
9825
9909
  set value(value) {
9826
9910
  this.rangeSliderValue = value;
9827
9911
  }
9828
- }
9912
+ }
9913
+ InputFactory.register('ZdRangeSlider', RangeSlider);
9829
9914
 
9830
9915
  /**
9831
9916
  * Base class for Row component.
@@ -10252,11 +10337,12 @@
10252
10337
  */
10253
10338
  updateRules() {
10254
10339
  this.rules = Object.keys(this.parsedValidations)
10255
- .map((key) => () => {
10340
+ .map((key) => (value) => {
10341
+ const testValue = value !== undefined ? value : this.value;
10256
10342
  const validation = this.parsedValidations[key];
10257
10343
  if (key !== 'required')
10258
- return validation(this.value);
10259
- return validation((this.checkboxAll && 'all') || this.value);
10344
+ return validation(testValue);
10345
+ return validation((this.checkboxAll && 'all') || testValue);
10260
10346
  });
10261
10347
  }
10262
10348
  }
@@ -11086,7 +11172,8 @@
11086
11172
  this.setValue(filteredNode.id);
11087
11173
  }
11088
11174
  }
11089
- }
11175
+ }
11176
+ InputFactory.register('ZdSelectTree', SelectTree);
11090
11177
 
11091
11178
  /**
11092
11179
  * Base class for Select Tree Multiple component.
@@ -11536,7 +11623,8 @@
11536
11623
  this.inset = this.getInitValue('inset', props.inset, this.inset);
11537
11624
  this.createAccessors();
11538
11625
  }
11539
- }
11626
+ }
11627
+ InputFactory.register('ZdSwitch', Switch);
11540
11628
 
11541
11629
  /**
11542
11630
  * Base class for Table component.
@@ -11874,7 +11962,8 @@
11874
11962
  this.addValidation('maxLength', { limit: parseInt(this.counter.toString(), 10) });
11875
11963
  }
11876
11964
  }
11877
- }
11965
+ }
11966
+ InputFactory.register('ZdTextarea', Textarea);
11878
11967
 
11879
11968
  /**
11880
11969
  * Selects the time format by the rule:
@@ -12262,7 +12351,8 @@
12262
12351
  }
12263
12352
  }
12264
12353
  return value;
12265
- });
12354
+ });
12355
+ InputFactory.register('ZdTime', Time);
12266
12356
 
12267
12357
  /**
12268
12358
  * Base class for Tooltip component.
@@ -12907,45 +12997,28 @@
12907
12997
  navigateToggle(collapse) {
12908
12998
  this.treeDataStructure.navigateToggle(collapse);
12909
12999
  }
12910
- /**
12911
- * Navigate upwards
12912
- */
12913
- navigateUp() {
12914
- if (this.cellSelection && this.viewNavigate) {
12915
- this.viewNavigate('up');
12916
- return;
12917
- }
13000
+ navigateDatasource(up) {
12918
13001
  const { uniqueKey, currentRow } = this.datasource;
12919
13002
  const rowIndex = this.treeDataStructure.findDataIndex(this.datasource.data, currentRow[uniqueKey]);
12920
- if (rowIndex === -1) {
12921
- const lastOpenedRowIdx = this.treeDataStructure.previousOpenedRow(this.datasource.data.length);
12922
- this.datasource.currentRow = this.datasource.data[lastOpenedRowIdx];
12923
- }
12924
- else {
13003
+ if (up) {
13004
+ if (rowIndex === -1) {
13005
+ const lastOpenedRowIdx = this.treeDataStructure.previousOpenedRow(this.datasource.data.length);
13006
+ this.datasource.currentRow = this.datasource.data[lastOpenedRowIdx];
13007
+ return;
13008
+ }
12925
13009
  const previousRowIdx = this.treeDataStructure.previousOpenedRow(rowIndex);
12926
13010
  if (previousRowIdx > -1) {
12927
13011
  this.datasource.currentRow = this.datasource.data[previousRowIdx];
12928
13012
  }
12929
- }
12930
- }
12931
- /**
12932
- * Navigate downwards
12933
- */
12934
- navigateDown() {
12935
- if (this.cellSelection && this.viewNavigate) {
12936
- this.viewNavigate('down');
12937
13013
  return;
12938
13014
  }
12939
- const { uniqueKey, currentRow } = this.datasource;
12940
- const rowIndex = this.treeDataStructure.findDataIndex(this.datasource.data, currentRow[uniqueKey]);
12941
13015
  if (rowIndex === -1) {
12942
13016
  [this.datasource.currentRow] = this.datasource.data;
13017
+ return;
12943
13018
  }
12944
- else {
12945
- const nextRowIdx = this.treeDataStructure.nextOpenedRow(rowIndex);
12946
- if (nextRowIdx > -1) {
12947
- this.datasource.currentRow = this.datasource.data[nextRowIdx];
12948
- }
13019
+ const nextRowIdx = this.treeDataStructure.nextOpenedRow(rowIndex);
13020
+ if (nextRowIdx > -1) {
13021
+ this.datasource.currentRow = this.datasource.data[nextRowIdx];
12949
13022
  }
12950
13023
  }
12951
13024
  removeDuplicates(arr, key) {
@@ -14672,6 +14745,52 @@
14672
14745
  }
14673
14746
  }
14674
14747
 
14748
+ /**
14749
+ * Class used to format grouped data into the ZhReports format
14750
+ */
14751
+ class GroupedPDFFormatter {
14752
+ format(data) {
14753
+ return data.map((item) => {
14754
+ if (this.isGroupHeader(item)) {
14755
+ return {
14756
+ __group: item.group,
14757
+ __groupHeader: item.groupHeader,
14758
+ __groupFooter: false,
14759
+ __groupIndex: item.groupIndex,
14760
+ __groupLabel: item.groupLabel,
14761
+ __groupValue: item.groupValue,
14762
+ __groupOpened: item.groupOpened,
14763
+ };
14764
+ }
14765
+ if (this.isGroupFooter(item)) {
14766
+ const groupKeys = ['groupFooter', 'groupIndex', 'groupHeaders', 'groupLabel', 'groupValue', 'groupSummary'];
14767
+ const totalColumnNames = Object.keys(item).filter((key) => !groupKeys.includes(key));
14768
+ const result = {
14769
+ __group: true,
14770
+ __groupFooter: item.groupFooter,
14771
+ __groupIndex: item.groupIndex,
14772
+ __groupLabel: item.groupLabel,
14773
+ __groupValue: item.groupValue,
14774
+ __groupSummary: !!item.groupSummary,
14775
+ };
14776
+ totalColumnNames.forEach((name) => {
14777
+ result[name] = item[name];
14778
+ });
14779
+ return result;
14780
+ }
14781
+ const dataItem = Object.assign({}, item);
14782
+ delete dataItem.groupHeaders;
14783
+ return dataItem;
14784
+ });
14785
+ }
14786
+ isGroupHeader(entry) {
14787
+ return entry.groupHeader === true;
14788
+ }
14789
+ isGroupFooter(entry) {
14790
+ return entry.groupFooter === true;
14791
+ }
14792
+ }
14793
+
14675
14794
  class Report {
14676
14795
  constructor(iterable, title) {
14677
14796
  this.endPoint = core.Config.reportsEndPoint;
@@ -14728,7 +14847,7 @@
14728
14847
  const { route } = reportType;
14729
14848
  const { name, columns, datasource } = this.iterable;
14730
14849
  const { groupedData } = Object.assign({}, this.iterable);
14731
- const formattedColumns = this.removeColumns(columns);
14850
+ const formattedColumns = this.filterColumns(columns);
14732
14851
  const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
14733
14852
  let dataset;
14734
14853
  if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
@@ -14736,6 +14855,11 @@
14736
14855
  const metadataObjClone = merge__default["default"](rowMetadata, JSON.parse(metadataObj));
14737
14856
  dataset = reportType.buildDataset(groupedData, metadataObjClone);
14738
14857
  }
14858
+ else if (reportType instanceof PDFReport && groupedData && groupedData.length > 0) {
14859
+ const formatter = new GroupedPDFFormatter();
14860
+ const pdfGroupedData = formatter.format(groupedData);
14861
+ dataset = reportType.buildDataset(pdfGroupedData);
14862
+ }
14739
14863
  else {
14740
14864
  dataset = reportType.buildDataset(data, formattedColumns);
14741
14865
  }
@@ -14766,7 +14890,7 @@
14766
14890
  return new URL(reportFile, this.fileEndPoint).href;
14767
14891
  });
14768
14892
  }
14769
- removeColumns(columns) {
14893
+ filterColumns(columns) {
14770
14894
  return columns.filter((item) => (item.type !== 'action' && item.isVisible));
14771
14895
  }
14772
14896
  }
@@ -14815,12 +14939,14 @@
14815
14939
  exports.GridColumn = GridColumn;
14816
14940
  exports.GridColumnEditable = GridColumnEditable;
14817
14941
  exports.GridEditable = GridEditable;
14942
+ exports.GroupedPDFFormatter = GroupedPDFFormatter;
14818
14943
  exports.Header = Header;
14819
14944
  exports.Icon = Icon;
14820
14945
  exports.Icons = Icons;
14821
14946
  exports.Image = Image;
14822
14947
  exports.Increment = Increment;
14823
14948
  exports.Input = Input;
14949
+ exports.InputFactory = InputFactory;
14824
14950
  exports.Iterable = Iterable;
14825
14951
  exports.IterableColumnsButton = IterableColumnsButton;
14826
14952
  exports.IterableColumnsButtonController = IterableColumnsButtonController;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.96.0",
3
+ "version": "1.96.1",
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": "4df47f4fde302b75598f5744945c86fb3aad4b6a"
46
+ "gitHead": "5898cc8926fdb11f3fbc71af1e587cd0bb1f53b1"
47
47
  }
@@ -70,6 +70,7 @@ export * from './zd-increment/increment';
70
70
  export * from './zd-increment/interfaces';
71
71
  export * from './zd-input/input';
72
72
  export * from './zd-input/interfaces';
73
+ export * from './zd-input/input-factory';
73
74
  export * from './zd-iterable/column';
74
75
  export * from './zd-iterable/iterable';
75
76
  export * from './zd-iterable/column-not-found';
@@ -11,6 +11,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
11
11
  * Editable columns
12
12
  */
13
13
  columns: GridColumnEditable[];
14
+ currentColumn: GridColumnEditable;
14
15
  /**
15
16
  * Editing rows
16
17
  */
@@ -160,6 +161,10 @@ export declare class GridEditable extends Grid implements IGridEditable {
160
161
  * @param revalidate Defines if the fields should be revalidated
161
162
  */
162
163
  isGridValid(revalidate?: boolean): boolean;
164
+ /**
165
+ * Checks whether the grid is valid while not in editing mode
166
+ */
167
+ private isViewGridValid;
163
168
  /**
164
169
  * Adds new row to the datasource data and pushes it to the editedRows
165
170
  * @param row Row
@@ -1,4 +1,4 @@
1
- import { IDictionary, IKeyMap } from '@zeedhi/core';
1
+ import { IDictionary, IEventParam, IKeyMap } from '@zeedhi/core';
2
2
  import { Component } from '../zd-component/component';
3
3
  import { IComponent, IComponentRender } from '../zd-component/interfaces';
4
4
  import { Iterable } from '../zd-iterable/iterable';
@@ -143,8 +143,8 @@ export declare class Grid extends Iterable implements IGrid {
143
143
  };
144
144
  cellSelection: boolean;
145
145
  currentColumn: Column | null;
146
- protected viewNavigate: ((direction: 'up' | 'down' | 'left' | 'right') => void) | null;
147
- setViewNavigate(viewNavigate: (up: 'up' | 'down' | 'left' | 'right') => void): void;
146
+ protected viewNavigate: ((direction: 'up' | 'down' | 'left' | 'right', event?: Event) => void) | null;
147
+ setViewNavigate(viewNavigate: (up: 'up' | 'down' | 'left' | 'right', event?: Event) => void): void;
148
148
  /**
149
149
  * Creates a new Grid.
150
150
  * @param props Grid properties
@@ -208,10 +208,15 @@ export declare class Grid extends Iterable implements IGrid {
208
208
  selectAll(isSelected: boolean): void;
209
209
  toggleRow(row: IDictionary): void;
210
210
  selectRow(row: IDictionary, select: boolean): void;
211
- navigateLeft(): void;
212
- navigateRight(): void;
211
+ navigateLeft({ event }: IEventParam<any>): void;
212
+ navigateRight({ event }: IEventParam<any>): void;
213
213
  navigateUp(): void;
214
214
  navigateDown(): void;
215
+ navigateDatasource(up: boolean): void;
216
+ navigateCurrentRow(up: boolean, rowIndex: number): void;
217
+ navigateInitial(up: boolean): void;
218
+ navigateFirst(): void;
219
+ navigateLast(): void;
215
220
  navigatePageUp(): void;
216
221
  navigatePageDown(): void;
217
222
  deleteRows(): Promise<any[]>;
@@ -0,0 +1,6 @@
1
+ import { IDictionary, INewable } from '@zeedhi/core';
2
+ export declare class InputFactory {
3
+ private static inputClasses;
4
+ static register(className: string, inputClass: INewable<any>): void;
5
+ static factory(props: IDictionary<any>): any;
6
+ }