@zeedhi/common 1.106.0 → 1.107.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.
@@ -1900,7 +1900,9 @@ class Input extends ComponentRender {
1900
1900
  /**
1901
1901
  * Input validations.
1902
1902
  */
1903
- this.validations = {};
1903
+ this.validations = {
1904
+ required: false,
1905
+ };
1904
1906
  /**
1905
1907
  * Defines if the input should be automatically registered in the closest parent Form
1906
1908
  */
@@ -1983,7 +1985,10 @@ class Input extends ComponentRender {
1983
1985
  * @param validations Field validations
1984
1986
  */
1985
1987
  parseValidations(validations) {
1986
- Object.keys(validations).forEach((name) => this.addValidation(name, validations[name]));
1988
+ Object.keys(validations).forEach((name) => {
1989
+ if (validations[name])
1990
+ this.addValidation(name, validations[name]);
1991
+ });
1987
1992
  }
1988
1993
  /**
1989
1994
  * Adds input validation.
@@ -9011,6 +9016,16 @@ class GroupedPDFFormatter {
9011
9016
  }
9012
9017
  }
9013
9018
 
9019
+ /**
9020
+ * Empty data error
9021
+ */
9022
+ class EmptyDataError extends Error {
9023
+ constructor() {
9024
+ super('Can\'t get report when datasource is empty');
9025
+ this.name = 'EmptyDataError';
9026
+ }
9027
+ }
9028
+
9014
9029
  class Report {
9015
9030
  constructor(iterable, title) {
9016
9031
  this.endPoint = Config.reportsEndPoint;
@@ -9059,6 +9074,9 @@ class Report {
9059
9074
  var _a;
9060
9075
  return __awaiter(this, void 0, void 0, function* () {
9061
9076
  const data = (_a = this.data) !== null && _a !== void 0 ? _a : yield this.getData();
9077
+ if (!data || data.length === 0) {
9078
+ throw new EmptyDataError();
9079
+ }
9062
9080
  const origin = {
9063
9081
  containerLabel: this.title,
9064
9082
  widgetLabel: this.title,
@@ -9664,7 +9682,7 @@ class Select extends TextInput {
9664
9682
  /* Defines if should open modal with grid to make the selection */
9665
9683
  this.modalSelection = false;
9666
9684
  /* Defines fields to show on modal */
9667
- this.modalSelectionFields = [];
9685
+ this.modalSelectionColumns = [];
9668
9686
  this.dsSearch = {
9669
9687
  SEARCH: (value, searchIn) => ({
9670
9688
  searchIn: [searchIn],
@@ -9720,7 +9738,7 @@ class Select extends TextInput {
9720
9738
  this.dataValueOutFormName = this.getInitValue('dataValueOutFormName', props.dataValueOutFormName, this.dataValueOutFormName);
9721
9739
  this.closeOnScroll = this.getInitValue('closeOnScroll', props.closeOnScroll, this.closeOnScroll);
9722
9740
  this.modalSelection = this.getInitValue('modalSelection', props.modalSelection, this.modalSelection);
9723
- this.modalSelectionFields = this.getInitValue('modalSelectionFields', props.modalSelectionFields, this.modalSelectionFields);
9741
+ this.modalSelectionColumns = this.getInitValue('modalSelectionColumns', props.modalSelectionColumns, this.modalSelectionColumns);
9724
9742
  if (((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.type) === 'simple') {
9725
9743
  this.dataValue = 'value';
9726
9744
  this.dataText = this.dataText || this.dataValue;
@@ -9758,7 +9776,7 @@ class Select extends TextInput {
9758
9776
  }
9759
9777
  onMounted(element) {
9760
9778
  super.onMounted(element);
9761
- if (this.modalSelection && this.modalSelectionFields.length) {
9779
+ if (this.modalSelection && this.modalSelectionColumns.length) {
9762
9780
  KeyMap.bind({
9763
9781
  'shift+enter': {
9764
9782
  active: true,
@@ -9773,12 +9791,14 @@ class Select extends TextInput {
9773
9791
  onBeforeDestroy() {
9774
9792
  super.onBeforeDestroy();
9775
9793
  this.datasource.destroy();
9776
- if (this.modalSelection && this.modalSelectionFields.length) {
9794
+ if (this.modalSelection && this.modalSelectionColumns.length) {
9777
9795
  KeyMap.unbind({
9778
9796
  'shift+enter': {
9779
9797
  event: this.openModalSelection.bind(this),
9780
9798
  },
9781
9799
  }, this);
9800
+ if (this.modalSelectionObj)
9801
+ this.modalSelectionObj.destroy();
9782
9802
  }
9783
9803
  }
9784
9804
  /**
@@ -10174,10 +10194,11 @@ class Select extends TextInput {
10174
10194
  this.viewCloseMenu();
10175
10195
  }, 200);
10176
10196
  }
10177
- openModalSelection() {
10197
+ getModalSelectionDef() {
10178
10198
  const modalSelectionDef = {
10179
10199
  name: `${this.name}-modal-selection`,
10180
10200
  persistent: true,
10201
+ escKeydownStop: false,
10181
10202
  children: [
10182
10203
  {
10183
10204
  name: `${this.name}-modal-selection-content-container`,
@@ -10189,8 +10210,8 @@ class Select extends TextInput {
10189
10210
  name: `${this.name}-modal-selection-grid`,
10190
10211
  component: 'ZdGrid',
10191
10212
  cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
10192
- columns: this.modalSelectionFields,
10193
- datasource: Object.assign(Object.assign({}, this.defaultDatasource), { lazyLoad: false, searchIn: undefined }),
10213
+ columns: this.modalSelectionColumns,
10214
+ datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
10194
10215
  toolbarSlot: [
10195
10216
  {
10196
10217
  name: `${this.name}-modal-selection-title`,
@@ -10257,9 +10278,16 @@ class Select extends TextInput {
10257
10278
  },
10258
10279
  },
10259
10280
  };
10260
- if (!this.modalSelectionObj)
10281
+ return modalSelectionDef;
10282
+ }
10283
+ openModalSelection() {
10284
+ const modalSelectionDef = this.getModalSelectionDef();
10285
+ if (this.modalSelectionObj)
10286
+ this.modalSelectionObj.destroy();
10287
+ ViewService.nextTick(() => {
10261
10288
  this.modalSelectionObj = ModalService.create(modalSelectionDef);
10262
- this.modalSelectionObj.show();
10289
+ this.modalSelectionObj.show();
10290
+ });
10263
10291
  }
10264
10292
  }
10265
10293
  FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
@@ -10606,7 +10634,8 @@ class IterableComponentRender extends Iterable {
10606
10634
  * Returns the iterable component metadata based on row data
10607
10635
  */
10608
10636
  getComponentMetadata(row) {
10609
- const exp = new RegExp(`<<${this.rowPropName}\\.([A-z_.]+?)>>|"<<${this.rowPropName}.(.[A-z_.]+?)>>"`, 'g');
10637
+ const pattern = `${this.rowPropName}\\.([A-Za-z0-9_.]+?)`;
10638
+ const exp = new RegExp(`<<${pattern}>>|"<<${pattern}>>"`, 'g');
10610
10639
  const rowExp = new RegExp(`"<<${this.rowPropName}>>"`, 'g');
10611
10640
  const metadata = JSON.stringify(this.componentMetadata)
10612
10641
  .replace(rowExp, JSON.stringify(row))
@@ -10618,6 +10647,8 @@ class IterableComponentRender extends Iterable {
10618
10647
  return `"${value}"`;
10619
10648
  return value;
10620
10649
  }
10650
+ if (value === undefined)
10651
+ return '""';
10621
10652
  return value;
10622
10653
  });
10623
10654
  return JSON.parse(metadata);
@@ -12582,6 +12613,109 @@ class SelectMultiple extends Select {
12582
12613
  return validation((this.checkboxAll && 'all') || testValue);
12583
12614
  });
12584
12615
  }
12616
+ confirmModalSelection() {
12617
+ const grid = Metadata.getInstance(`${this.name}-modal-selection-grid`);
12618
+ this.setValue(grid.selectedRows);
12619
+ this.hideModalSelection();
12620
+ setTimeout(() => {
12621
+ if (this.viewCloseMenu)
12622
+ this.viewCloseMenu();
12623
+ }, 200);
12624
+ }
12625
+ getModalSelectionDef() {
12626
+ const modalSelectionDef = {
12627
+ name: `${this.name}-modal-selection`,
12628
+ persistent: true,
12629
+ escKeydownStop: false,
12630
+ children: [
12631
+ {
12632
+ name: `${this.name}-modal-selection-content-container`,
12633
+ component: 'ZdContainer',
12634
+ scrollView: true,
12635
+ cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-content-container',
12636
+ children: [
12637
+ {
12638
+ name: `${this.name}-modal-selection-grid`,
12639
+ component: 'ZdGrid',
12640
+ selectable: true,
12641
+ cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
12642
+ columns: this.modalSelectionColumns,
12643
+ datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
12644
+ toolbarSlot: [
12645
+ {
12646
+ name: `${this.name}-modal-selection-title`,
12647
+ component: 'ZdText',
12648
+ cssStyle: `color: ${'var(--v-primary-base);'}`,
12649
+ text: this.label,
12650
+ tag: 'h3',
12651
+ },
12652
+ {
12653
+ name: `${this.name}-modal-selection-spacer`,
12654
+ component: 'VSpacer',
12655
+ },
12656
+ {
12657
+ name: `${this.name}-modal-selection_gridSearch`,
12658
+ component: 'ZdSearch',
12659
+ cssClass: 'zd-grid-search',
12660
+ autofocus: true,
12661
+ },
12662
+ ],
12663
+ },
12664
+ ],
12665
+ },
12666
+ {
12667
+ name: `${this.name}-modal-selection-footer-container`,
12668
+ component: 'ZdContainer',
12669
+ cssClass: 'zd-pa-0',
12670
+ children: [
12671
+ {
12672
+ name: `${this.name}-modal-selection-footer`,
12673
+ component: 'ZdFooter',
12674
+ color: 'transparent',
12675
+ padless: true,
12676
+ rightSlot: [
12677
+ {
12678
+ name: `${this.name}-modal-selection-cancelButton`,
12679
+ component: 'ZdButton',
12680
+ label: 'CANCEL',
12681
+ keyMap: {
12682
+ esc: {
12683
+ event: this.hideModalSelection.bind(this),
12684
+ focus: true,
12685
+ visible: true,
12686
+ input: true,
12687
+ stop: true,
12688
+ },
12689
+ },
12690
+ outline: true,
12691
+ events: {
12692
+ click: this.hideModalSelection.bind(this),
12693
+ },
12694
+ },
12695
+ {
12696
+ name: `${this.name}-modal-selection-confirmButton`,
12697
+ component: 'ZdButton',
12698
+ label: 'OK',
12699
+ outline: false,
12700
+ events: {
12701
+ click: this.confirmModalSelection.bind(this),
12702
+ },
12703
+ },
12704
+ ],
12705
+ },
12706
+ ],
12707
+ },
12708
+ ],
12709
+ events: {
12710
+ onShow: () => {
12711
+ const grid = Metadata.getInstance(`${this.name}-modal-selection-grid`);
12712
+ grid.selectedRows = this.selectedValue;
12713
+ grid.datasource.currentRow = {};
12714
+ },
12715
+ },
12716
+ };
12717
+ return modalSelectionDef;
12718
+ }
12585
12719
  }
12586
12720
 
12587
12721
  /**
@@ -15494,4 +15628,4 @@ const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
15494
15628
  const packageContent = require('../package.json');
15495
15629
  VersionService.addPackageVersion(packageContent.name, packageContent.version);
15496
15630
 
15497
- export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, Container, Currency, Dashboard, DataValueOutHelper, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, GroupedPDFFormatter, Header, Icon, Icons, Image, Increment, Input, InputFactory, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterableComponentRender, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SelectableList, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
15631
+ export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, Container, Currency, Dashboard, DataValueOutHelper, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, EmptyDataError, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, GroupedPDFFormatter, Header, Icon, Icons, Image, Increment, Input, InputFactory, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterableComponentRender, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SelectableList, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
@@ -1907,7 +1907,9 @@
1907
1907
  /**
1908
1908
  * Input validations.
1909
1909
  */
1910
- this.validations = {};
1910
+ this.validations = {
1911
+ required: false,
1912
+ };
1911
1913
  /**
1912
1914
  * Defines if the input should be automatically registered in the closest parent Form
1913
1915
  */
@@ -1990,7 +1992,10 @@
1990
1992
  * @param validations Field validations
1991
1993
  */
1992
1994
  parseValidations(validations) {
1993
- Object.keys(validations).forEach((name) => this.addValidation(name, validations[name]));
1995
+ Object.keys(validations).forEach((name) => {
1996
+ if (validations[name])
1997
+ this.addValidation(name, validations[name]);
1998
+ });
1994
1999
  }
1995
2000
  /**
1996
2001
  * Adds input validation.
@@ -9018,6 +9023,16 @@
9018
9023
  }
9019
9024
  }
9020
9025
 
9026
+ /**
9027
+ * Empty data error
9028
+ */
9029
+ class EmptyDataError extends Error {
9030
+ constructor() {
9031
+ super('Can\'t get report when datasource is empty');
9032
+ this.name = 'EmptyDataError';
9033
+ }
9034
+ }
9035
+
9021
9036
  class Report {
9022
9037
  constructor(iterable, title) {
9023
9038
  this.endPoint = core.Config.reportsEndPoint;
@@ -9066,6 +9081,9 @@
9066
9081
  var _a;
9067
9082
  return __awaiter(this, void 0, void 0, function* () {
9068
9083
  const data = (_a = this.data) !== null && _a !== void 0 ? _a : yield this.getData();
9084
+ if (!data || data.length === 0) {
9085
+ throw new EmptyDataError();
9086
+ }
9069
9087
  const origin = {
9070
9088
  containerLabel: this.title,
9071
9089
  widgetLabel: this.title,
@@ -9671,7 +9689,7 @@
9671
9689
  /* Defines if should open modal with grid to make the selection */
9672
9690
  this.modalSelection = false;
9673
9691
  /* Defines fields to show on modal */
9674
- this.modalSelectionFields = [];
9692
+ this.modalSelectionColumns = [];
9675
9693
  this.dsSearch = {
9676
9694
  SEARCH: (value, searchIn) => ({
9677
9695
  searchIn: [searchIn],
@@ -9727,7 +9745,7 @@
9727
9745
  this.dataValueOutFormName = this.getInitValue('dataValueOutFormName', props.dataValueOutFormName, this.dataValueOutFormName);
9728
9746
  this.closeOnScroll = this.getInitValue('closeOnScroll', props.closeOnScroll, this.closeOnScroll);
9729
9747
  this.modalSelection = this.getInitValue('modalSelection', props.modalSelection, this.modalSelection);
9730
- this.modalSelectionFields = this.getInitValue('modalSelectionFields', props.modalSelectionFields, this.modalSelectionFields);
9748
+ this.modalSelectionColumns = this.getInitValue('modalSelectionColumns', props.modalSelectionColumns, this.modalSelectionColumns);
9731
9749
  if (((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.type) === 'simple') {
9732
9750
  this.dataValue = 'value';
9733
9751
  this.dataText = this.dataText || this.dataValue;
@@ -9765,7 +9783,7 @@
9765
9783
  }
9766
9784
  onMounted(element) {
9767
9785
  super.onMounted(element);
9768
- if (this.modalSelection && this.modalSelectionFields.length) {
9786
+ if (this.modalSelection && this.modalSelectionColumns.length) {
9769
9787
  core.KeyMap.bind({
9770
9788
  'shift+enter': {
9771
9789
  active: true,
@@ -9780,12 +9798,14 @@
9780
9798
  onBeforeDestroy() {
9781
9799
  super.onBeforeDestroy();
9782
9800
  this.datasource.destroy();
9783
- if (this.modalSelection && this.modalSelectionFields.length) {
9801
+ if (this.modalSelection && this.modalSelectionColumns.length) {
9784
9802
  core.KeyMap.unbind({
9785
9803
  'shift+enter': {
9786
9804
  event: this.openModalSelection.bind(this),
9787
9805
  },
9788
9806
  }, this);
9807
+ if (this.modalSelectionObj)
9808
+ this.modalSelectionObj.destroy();
9789
9809
  }
9790
9810
  }
9791
9811
  /**
@@ -10181,10 +10201,11 @@
10181
10201
  this.viewCloseMenu();
10182
10202
  }, 200);
10183
10203
  }
10184
- openModalSelection() {
10204
+ getModalSelectionDef() {
10185
10205
  const modalSelectionDef = {
10186
10206
  name: `${this.name}-modal-selection`,
10187
10207
  persistent: true,
10208
+ escKeydownStop: false,
10188
10209
  children: [
10189
10210
  {
10190
10211
  name: `${this.name}-modal-selection-content-container`,
@@ -10196,8 +10217,8 @@
10196
10217
  name: `${this.name}-modal-selection-grid`,
10197
10218
  component: 'ZdGrid',
10198
10219
  cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
10199
- columns: this.modalSelectionFields,
10200
- datasource: Object.assign(Object.assign({}, this.defaultDatasource), { lazyLoad: false, searchIn: undefined }),
10220
+ columns: this.modalSelectionColumns,
10221
+ datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
10201
10222
  toolbarSlot: [
10202
10223
  {
10203
10224
  name: `${this.name}-modal-selection-title`,
@@ -10264,9 +10285,16 @@
10264
10285
  },
10265
10286
  },
10266
10287
  };
10267
- if (!this.modalSelectionObj)
10288
+ return modalSelectionDef;
10289
+ }
10290
+ openModalSelection() {
10291
+ const modalSelectionDef = this.getModalSelectionDef();
10292
+ if (this.modalSelectionObj)
10293
+ this.modalSelectionObj.destroy();
10294
+ core.ViewService.nextTick(() => {
10268
10295
  this.modalSelectionObj = ModalService.create(modalSelectionDef);
10269
- this.modalSelectionObj.show();
10296
+ this.modalSelectionObj.show();
10297
+ });
10270
10298
  }
10271
10299
  }
10272
10300
  core.FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
@@ -10613,7 +10641,8 @@
10613
10641
  * Returns the iterable component metadata based on row data
10614
10642
  */
10615
10643
  getComponentMetadata(row) {
10616
- const exp = new RegExp(`<<${this.rowPropName}\\.([A-z_.]+?)>>|"<<${this.rowPropName}.(.[A-z_.]+?)>>"`, 'g');
10644
+ const pattern = `${this.rowPropName}\\.([A-Za-z0-9_.]+?)`;
10645
+ const exp = new RegExp(`<<${pattern}>>|"<<${pattern}>>"`, 'g');
10617
10646
  const rowExp = new RegExp(`"<<${this.rowPropName}>>"`, 'g');
10618
10647
  const metadata = JSON.stringify(this.componentMetadata)
10619
10648
  .replace(rowExp, JSON.stringify(row))
@@ -10625,6 +10654,8 @@
10625
10654
  return `"${value}"`;
10626
10655
  return value;
10627
10656
  }
10657
+ if (value === undefined)
10658
+ return '""';
10628
10659
  return value;
10629
10660
  });
10630
10661
  return JSON.parse(metadata);
@@ -12589,6 +12620,109 @@
12589
12620
  return validation((this.checkboxAll && 'all') || testValue);
12590
12621
  });
12591
12622
  }
12623
+ confirmModalSelection() {
12624
+ const grid = core.Metadata.getInstance(`${this.name}-modal-selection-grid`);
12625
+ this.setValue(grid.selectedRows);
12626
+ this.hideModalSelection();
12627
+ setTimeout(() => {
12628
+ if (this.viewCloseMenu)
12629
+ this.viewCloseMenu();
12630
+ }, 200);
12631
+ }
12632
+ getModalSelectionDef() {
12633
+ const modalSelectionDef = {
12634
+ name: `${this.name}-modal-selection`,
12635
+ persistent: true,
12636
+ escKeydownStop: false,
12637
+ children: [
12638
+ {
12639
+ name: `${this.name}-modal-selection-content-container`,
12640
+ component: 'ZdContainer',
12641
+ scrollView: true,
12642
+ cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-content-container',
12643
+ children: [
12644
+ {
12645
+ name: `${this.name}-modal-selection-grid`,
12646
+ component: 'ZdGrid',
12647
+ selectable: true,
12648
+ cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
12649
+ columns: this.modalSelectionColumns,
12650
+ datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
12651
+ toolbarSlot: [
12652
+ {
12653
+ name: `${this.name}-modal-selection-title`,
12654
+ component: 'ZdText',
12655
+ cssStyle: `color: ${'var(--v-primary-base);'}`,
12656
+ text: this.label,
12657
+ tag: 'h3',
12658
+ },
12659
+ {
12660
+ name: `${this.name}-modal-selection-spacer`,
12661
+ component: 'VSpacer',
12662
+ },
12663
+ {
12664
+ name: `${this.name}-modal-selection_gridSearch`,
12665
+ component: 'ZdSearch',
12666
+ cssClass: 'zd-grid-search',
12667
+ autofocus: true,
12668
+ },
12669
+ ],
12670
+ },
12671
+ ],
12672
+ },
12673
+ {
12674
+ name: `${this.name}-modal-selection-footer-container`,
12675
+ component: 'ZdContainer',
12676
+ cssClass: 'zd-pa-0',
12677
+ children: [
12678
+ {
12679
+ name: `${this.name}-modal-selection-footer`,
12680
+ component: 'ZdFooter',
12681
+ color: 'transparent',
12682
+ padless: true,
12683
+ rightSlot: [
12684
+ {
12685
+ name: `${this.name}-modal-selection-cancelButton`,
12686
+ component: 'ZdButton',
12687
+ label: 'CANCEL',
12688
+ keyMap: {
12689
+ esc: {
12690
+ event: this.hideModalSelection.bind(this),
12691
+ focus: true,
12692
+ visible: true,
12693
+ input: true,
12694
+ stop: true,
12695
+ },
12696
+ },
12697
+ outline: true,
12698
+ events: {
12699
+ click: this.hideModalSelection.bind(this),
12700
+ },
12701
+ },
12702
+ {
12703
+ name: `${this.name}-modal-selection-confirmButton`,
12704
+ component: 'ZdButton',
12705
+ label: 'OK',
12706
+ outline: false,
12707
+ events: {
12708
+ click: this.confirmModalSelection.bind(this),
12709
+ },
12710
+ },
12711
+ ],
12712
+ },
12713
+ ],
12714
+ },
12715
+ ],
12716
+ events: {
12717
+ onShow: () => {
12718
+ const grid = core.Metadata.getInstance(`${this.name}-modal-selection-grid`);
12719
+ grid.selectedRows = this.selectedValue;
12720
+ grid.datasource.currentRow = {};
12721
+ },
12722
+ },
12723
+ };
12724
+ return modalSelectionDef;
12725
+ }
12592
12726
  }
12593
12727
 
12594
12728
  /**
@@ -15533,6 +15667,7 @@
15533
15667
  exports.DialogService = DialogService;
15534
15668
  exports.Divider = Divider;
15535
15669
  exports.Dropdown = Dropdown;
15670
+ exports.EmptyDataError = EmptyDataError;
15536
15671
  exports.FileInput = FileInput;
15537
15672
  exports.Footer = Footer;
15538
15673
  exports.Form = Form;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.106.0",
3
+ "version": "1.107.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": "58e22407f4dc955b797447dafc639d59358e0e16"
46
+ "gitHead": "de37eeff43ce90aa7d0fb08ca85c6706aced0927"
47
47
  }
@@ -98,7 +98,7 @@ export declare class Input extends ComponentRender implements IInput {
98
98
  /**
99
99
  * Input validations.
100
100
  */
101
- validations: IDictionary<IDictionary<string | number>>;
101
+ validations: IDictionary<IDictionary<string | number> | boolean>;
102
102
  /**
103
103
  * Defines if the input should be automatically registered in the closest parent Form
104
104
  */
@@ -33,7 +33,7 @@ export interface IInput extends IComponentRender {
33
33
  showHelper?: boolean;
34
34
  showLabel?: boolean;
35
35
  storePath?: string;
36
- validations?: IDictionary<IDictionary<string | number>>;
36
+ validations?: IDictionary<IDictionary<string | number> | boolean>;
37
37
  value?: any;
38
38
  autoRegister?: boolean;
39
39
  }
@@ -25,5 +25,5 @@ export interface ISelect extends ITextInput, ISelectDataValueOut {
25
25
  searchParam?: string;
26
26
  closeOnScroll?: boolean;
27
27
  modalSelection?: boolean;
28
- modalSelectionFields?: IColumn[];
28
+ modalSelectionColumns?: IColumn[];
29
29
  }
@@ -4,6 +4,7 @@ import { ISelect, SearchParam } from './interfaces';
4
4
  import { TextInput } from '../zd-text-input/text-input';
5
5
  import { ISelectDataValueOutItem } from '../../utils';
6
6
  import { IColumn } from '../zd-iterable/interfaces';
7
+ import { IModal } from '../zd-modal/interfaces';
7
8
  /**
8
9
  * Base class for Select component.
9
10
  */
@@ -94,7 +95,7 @@ export declare class Select extends TextInput implements ISelect {
94
95
  dataValueOutFormName: string;
95
96
  closeOnScroll: boolean;
96
97
  modalSelection?: boolean | undefined;
97
- modalSelectionFields: IColumn[];
98
+ modalSelectionColumns: IColumn[];
98
99
  protected dsSearch: {
99
100
  SEARCH: (value: any, searchIn: string) => {
100
101
  searchIn: string[];
@@ -240,7 +241,8 @@ export declare class Select extends TextInput implements ISelect {
240
241
  indexOf(search: IDictionary | string | number): number;
241
242
  protected isFilledObj(obj: any): number | false;
242
243
  private modalSelectionObj?;
243
- private hideModalSelection;
244
+ protected hideModalSelection(): void;
244
245
  private modalSelectionGridClick;
246
+ protected getModalSelectionDef(): IModal;
245
247
  openModalSelection(): void;
246
248
  }
@@ -1,6 +1,7 @@
1
1
  import { IDictionary } from '@zeedhi/core';
2
2
  import { ISelectMultiple } from './interfaces';
3
3
  import { Select } from '../zd-select/select';
4
+ import { IModal } from '../zd-modal/interfaces';
4
5
  export declare class SelectMultiple extends Select implements ISelectMultiple {
5
6
  private selectedValue;
6
7
  /**
@@ -112,4 +113,6 @@ export declare class SelectMultiple extends Select implements ISelectMultiple {
112
113
  * Updates input rules.
113
114
  */
114
115
  protected updateRules(): void;
116
+ private confirmModalSelection;
117
+ protected getModalSelectionDef(): IModal;
115
118
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Empty data error
3
+ */
4
+ export declare class EmptyDataError extends Error {
5
+ constructor();
6
+ }
@@ -7,3 +7,4 @@ export * from './report-type/xls2-report';
7
7
  export * from './report-type/xls3-report';
8
8
  export * from './report-type/interfaces';
9
9
  export * from './dataset-formatters';
10
+ export * from './errors/empty-data-error';