@zeedhi/common 1.106.0 → 1.106.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.
@@ -9011,6 +9011,16 @@ class GroupedPDFFormatter {
9011
9011
  }
9012
9012
  }
9013
9013
 
9014
+ /**
9015
+ * Empty data error
9016
+ */
9017
+ class EmptyDataError extends Error {
9018
+ constructor() {
9019
+ super('Can\'t get report when datasource is empty');
9020
+ this.name = 'EmptyDataError';
9021
+ }
9022
+ }
9023
+
9014
9024
  class Report {
9015
9025
  constructor(iterable, title) {
9016
9026
  this.endPoint = Config.reportsEndPoint;
@@ -9059,6 +9069,9 @@ class Report {
9059
9069
  var _a;
9060
9070
  return __awaiter(this, void 0, void 0, function* () {
9061
9071
  const data = (_a = this.data) !== null && _a !== void 0 ? _a : yield this.getData();
9072
+ if (!data || data.length === 0) {
9073
+ throw new EmptyDataError();
9074
+ }
9062
9075
  const origin = {
9063
9076
  containerLabel: this.title,
9064
9077
  widgetLabel: this.title,
@@ -10178,6 +10191,7 @@ class Select extends TextInput {
10178
10191
  const modalSelectionDef = {
10179
10192
  name: `${this.name}-modal-selection`,
10180
10193
  persistent: true,
10194
+ escKeydownStop: false,
10181
10195
  children: [
10182
10196
  {
10183
10197
  name: `${this.name}-modal-selection-content-container`,
@@ -10190,7 +10204,7 @@ class Select extends TextInput {
10190
10204
  component: 'ZdGrid',
10191
10205
  cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
10192
10206
  columns: this.modalSelectionFields,
10193
- datasource: Object.assign(Object.assign({}, this.defaultDatasource), { lazyLoad: false, searchIn: undefined }),
10207
+ datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
10194
10208
  toolbarSlot: [
10195
10209
  {
10196
10210
  name: `${this.name}-modal-selection-title`,
@@ -10257,9 +10271,12 @@ class Select extends TextInput {
10257
10271
  },
10258
10272
  },
10259
10273
  };
10260
- if (!this.modalSelectionObj)
10274
+ if (this.modalSelectionObj)
10275
+ this.modalSelectionObj.destroy();
10276
+ ViewService.nextTick(() => {
10261
10277
  this.modalSelectionObj = ModalService.create(modalSelectionDef);
10262
- this.modalSelectionObj.show();
10278
+ this.modalSelectionObj.show();
10279
+ });
10263
10280
  }
10264
10281
  }
10265
10282
  FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
@@ -15494,4 +15511,4 @@ const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
15494
15511
  const packageContent = require('../package.json');
15495
15512
  VersionService.addPackageVersion(packageContent.name, packageContent.version);
15496
15513
 
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 };
15514
+ 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 };
@@ -9018,6 +9018,16 @@
9018
9018
  }
9019
9019
  }
9020
9020
 
9021
+ /**
9022
+ * Empty data error
9023
+ */
9024
+ class EmptyDataError extends Error {
9025
+ constructor() {
9026
+ super('Can\'t get report when datasource is empty');
9027
+ this.name = 'EmptyDataError';
9028
+ }
9029
+ }
9030
+
9021
9031
  class Report {
9022
9032
  constructor(iterable, title) {
9023
9033
  this.endPoint = core.Config.reportsEndPoint;
@@ -9066,6 +9076,9 @@
9066
9076
  var _a;
9067
9077
  return __awaiter(this, void 0, void 0, function* () {
9068
9078
  const data = (_a = this.data) !== null && _a !== void 0 ? _a : yield this.getData();
9079
+ if (!data || data.length === 0) {
9080
+ throw new EmptyDataError();
9081
+ }
9069
9082
  const origin = {
9070
9083
  containerLabel: this.title,
9071
9084
  widgetLabel: this.title,
@@ -10185,6 +10198,7 @@
10185
10198
  const modalSelectionDef = {
10186
10199
  name: `${this.name}-modal-selection`,
10187
10200
  persistent: true,
10201
+ escKeydownStop: false,
10188
10202
  children: [
10189
10203
  {
10190
10204
  name: `${this.name}-modal-selection-content-container`,
@@ -10197,7 +10211,7 @@
10197
10211
  component: 'ZdGrid',
10198
10212
  cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
10199
10213
  columns: this.modalSelectionFields,
10200
- datasource: Object.assign(Object.assign({}, this.defaultDatasource), { lazyLoad: false, searchIn: undefined }),
10214
+ datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
10201
10215
  toolbarSlot: [
10202
10216
  {
10203
10217
  name: `${this.name}-modal-selection-title`,
@@ -10264,9 +10278,12 @@
10264
10278
  },
10265
10279
  },
10266
10280
  };
10267
- if (!this.modalSelectionObj)
10281
+ if (this.modalSelectionObj)
10282
+ this.modalSelectionObj.destroy();
10283
+ core.ViewService.nextTick(() => {
10268
10284
  this.modalSelectionObj = ModalService.create(modalSelectionDef);
10269
- this.modalSelectionObj.show();
10285
+ this.modalSelectionObj.show();
10286
+ });
10270
10287
  }
10271
10288
  }
10272
10289
  core.FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
@@ -15533,6 +15550,7 @@
15533
15550
  exports.DialogService = DialogService;
15534
15551
  exports.Divider = Divider;
15535
15552
  exports.Dropdown = Dropdown;
15553
+ exports.EmptyDataError = EmptyDataError;
15536
15554
  exports.FileInput = FileInput;
15537
15555
  exports.Footer = Footer;
15538
15556
  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.106.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": "58e22407f4dc955b797447dafc639d59358e0e16"
46
+ "gitHead": "466f25f5bf00183a2c22ef94eecb47d997ac4bab"
47
47
  }
@@ -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';