@zeedhi/common 1.41.0 → 1.42.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.
@@ -5963,11 +5963,12 @@ class Select extends TextInput {
5963
5963
  overrideGet() {
5964
5964
  const oldGet = this.datasource.get;
5965
5965
  this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
5966
- yield oldGet.call(this.datasource);
5967
- if (this.indexOf(this.value) !== -1 || this.datasource.search || this.isFocused)
5968
- return;
5969
- yield this.setValue(this.value, false);
5970
- this.removePushedValue();
5966
+ const response = yield oldGet.call(this.datasource);
5967
+ if (this.indexOf(this.value) === -1 && !this.datasource.search && !this.isFocused) {
5968
+ yield this.setValue(this.value, false);
5969
+ this.removePushedValue();
5970
+ }
5971
+ return response;
5971
5972
  });
5972
5973
  }
5973
5974
  get search() {
@@ -8926,6 +8927,40 @@ class SelectTreeMultiple extends SelectTree {
8926
8927
  }
8927
8928
  }
8928
8929
 
8930
+ /**
8931
+ * Base class for SelectableList component.
8932
+ */
8933
+ class SelectableList extends List {
8934
+ constructor(props) {
8935
+ super(props);
8936
+ /**
8937
+ * Specifies whether at least one element must be selected
8938
+ */
8939
+ this.mandatory = false;
8940
+ /**
8941
+ * Defines the maximum number of elements the list has
8942
+ */
8943
+ this.max = undefined;
8944
+ /**
8945
+ * Defines how many elements of the list can be selected at the same time
8946
+ */
8947
+ this.multiple = undefined;
8948
+ /**
8949
+ * Sets the active list-item inside the list-group
8950
+ */
8951
+ this.value = undefined;
8952
+ this.activeClass = this.getInitValue('activeClass', props.activeClass, this.activeClass);
8953
+ this.mandatory = this.getInitValue('mandatory', props.mandatory, this.mandatory);
8954
+ this.max = this.getInitValue('max', props.max, this.max);
8955
+ this.multiple = this.getInitValue('multiple', props.multiple, this.multiple);
8956
+ this.value = this.getInitValue('value', props.value, this.value);
8957
+ this.createAccessors();
8958
+ }
8959
+ change(event, element) {
8960
+ this.callEvent('change', { event, element, component: this });
8961
+ }
8962
+ }
8963
+
8929
8964
  /**
8930
8965
  * Base class for SpeedDial component.
8931
8966
  */
@@ -9283,6 +9318,31 @@ class Tabs extends ComponentRender {
9283
9318
  }
9284
9319
  return tab;
9285
9320
  }
9321
+ /**
9322
+ * Method for navigating to the next tab
9323
+ * @param loop Defines if want a loop navigation
9324
+ */
9325
+ nextTab(loop = false) {
9326
+ if (loop) {
9327
+ this.activeTab = (this.activeTab + 1) % this.tabs.length;
9328
+ }
9329
+ else if (this.activeTab < this.tabs.length - 1) {
9330
+ this.activeTab += 1;
9331
+ }
9332
+ }
9333
+ /**
9334
+ * Method for navigating to the previous tab
9335
+ * @param loop Defines if want a loop navigation
9336
+ */
9337
+ previousTab(loop = false) {
9338
+ if (loop) {
9339
+ const newTabIndex = (this.activeTab - 1) % this.tabs.length;
9340
+ this.activeTab = newTabIndex >= 0 ? newTabIndex : newTabIndex + this.tabs.length;
9341
+ }
9342
+ else if (this.activeTab > 0) {
9343
+ this.activeTab -= 1;
9344
+ }
9345
+ }
9286
9346
  /**
9287
9347
  * Triggered before tab is change.
9288
9348
  * @param event DOM event
@@ -11691,4 +11751,4 @@ class Report {
11691
11751
 
11692
11752
  const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
11693
11753
 
11694
- export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, 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, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
11754
+ export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, 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 };
@@ -5970,11 +5970,12 @@
5970
5970
  overrideGet() {
5971
5971
  const oldGet = this.datasource.get;
5972
5972
  this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
5973
- yield oldGet.call(this.datasource);
5974
- if (this.indexOf(this.value) !== -1 || this.datasource.search || this.isFocused)
5975
- return;
5976
- yield this.setValue(this.value, false);
5977
- this.removePushedValue();
5973
+ const response = yield oldGet.call(this.datasource);
5974
+ if (this.indexOf(this.value) === -1 && !this.datasource.search && !this.isFocused) {
5975
+ yield this.setValue(this.value, false);
5976
+ this.removePushedValue();
5977
+ }
5978
+ return response;
5978
5979
  });
5979
5980
  }
5980
5981
  get search() {
@@ -8933,6 +8934,40 @@
8933
8934
  }
8934
8935
  }
8935
8936
 
8937
+ /**
8938
+ * Base class for SelectableList component.
8939
+ */
8940
+ class SelectableList extends List {
8941
+ constructor(props) {
8942
+ super(props);
8943
+ /**
8944
+ * Specifies whether at least one element must be selected
8945
+ */
8946
+ this.mandatory = false;
8947
+ /**
8948
+ * Defines the maximum number of elements the list has
8949
+ */
8950
+ this.max = undefined;
8951
+ /**
8952
+ * Defines how many elements of the list can be selected at the same time
8953
+ */
8954
+ this.multiple = undefined;
8955
+ /**
8956
+ * Sets the active list-item inside the list-group
8957
+ */
8958
+ this.value = undefined;
8959
+ this.activeClass = this.getInitValue('activeClass', props.activeClass, this.activeClass);
8960
+ this.mandatory = this.getInitValue('mandatory', props.mandatory, this.mandatory);
8961
+ this.max = this.getInitValue('max', props.max, this.max);
8962
+ this.multiple = this.getInitValue('multiple', props.multiple, this.multiple);
8963
+ this.value = this.getInitValue('value', props.value, this.value);
8964
+ this.createAccessors();
8965
+ }
8966
+ change(event, element) {
8967
+ this.callEvent('change', { event, element, component: this });
8968
+ }
8969
+ }
8970
+
8936
8971
  /**
8937
8972
  * Base class for SpeedDial component.
8938
8973
  */
@@ -9290,6 +9325,31 @@
9290
9325
  }
9291
9326
  return tab;
9292
9327
  }
9328
+ /**
9329
+ * Method for navigating to the next tab
9330
+ * @param loop Defines if want a loop navigation
9331
+ */
9332
+ nextTab(loop = false) {
9333
+ if (loop) {
9334
+ this.activeTab = (this.activeTab + 1) % this.tabs.length;
9335
+ }
9336
+ else if (this.activeTab < this.tabs.length - 1) {
9337
+ this.activeTab += 1;
9338
+ }
9339
+ }
9340
+ /**
9341
+ * Method for navigating to the previous tab
9342
+ * @param loop Defines if want a loop navigation
9343
+ */
9344
+ previousTab(loop = false) {
9345
+ if (loop) {
9346
+ const newTabIndex = (this.activeTab - 1) % this.tabs.length;
9347
+ this.activeTab = newTabIndex >= 0 ? newTabIndex : newTabIndex + this.tabs.length;
9348
+ }
9349
+ else if (this.activeTab > 0) {
9350
+ this.activeTab -= 1;
9351
+ }
9352
+ }
9293
9353
  /**
9294
9354
  * Triggered before tab is change.
9295
9355
  * @param event DOM event
@@ -11780,6 +11840,7 @@
11780
11840
  exports.SelectMultiple = SelectMultiple;
11781
11841
  exports.SelectTree = SelectTree;
11782
11842
  exports.SelectTreeMultiple = SelectTreeMultiple;
11843
+ exports.SelectableList = SelectableList;
11783
11844
  exports.SpeedDial = SpeedDial;
11784
11845
  exports.Steppers = Steppers;
11785
11846
  exports.SvgMap = SvgMap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.41.0",
3
+ "version": "1.42.0",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -37,5 +37,5 @@
37
37
  "lodash.times": "^4.3.2",
38
38
  "mockdate": "^3.0.2"
39
39
  },
40
- "gitHead": "8ca8a393eef096d9012bb2730f60588db71db828"
40
+ "gitHead": "1b3927e4fa74176f8c1dcfa909db8d89d39711e5"
41
41
  }
@@ -121,6 +121,8 @@ export * from './zd-select-tree/select-tree';
121
121
  export * from './zd-select-tree/interfaces';
122
122
  export * from './zd-select-tree-multiple/select-tree-multiple';
123
123
  export * from './zd-select-tree-multiple/interfaces';
124
+ export * from './zd-selectable-list/selectable-list';
125
+ export * from './zd-selectable-list/interfaces';
124
126
  export * from './zd-speed-dial/speed-dial';
125
127
  export * from './zd-speed-dial/interfaces';
126
128
  export * from './zd-steppers/steppers';
@@ -4,4 +4,5 @@ export interface ISelectableList extends IList {
4
4
  mandatory?: boolean;
5
5
  max?: number;
6
6
  multiple?: boolean;
7
+ value?: any;
7
8
  }
@@ -16,14 +16,14 @@ export declare class SelectableList extends List implements ISelectableList {
16
16
  * Defines the maximum number of elements the list has
17
17
  */
18
18
  max?: number;
19
- /**
20
- * Defines the maximum number of elements the list has
21
- */
22
- value?: string;
23
19
  /**
24
20
  * Defines how many elements of the list can be selected at the same time
25
21
  */
26
22
  multiple?: boolean;
23
+ /**
24
+ * Sets the active list-item inside the list-group
25
+ */
26
+ value?: any;
27
27
  constructor(props: ISelectableList);
28
28
  change(event?: Event, element?: HTMLElement): void;
29
29
  }
@@ -15,6 +15,16 @@ export declare class Tabs extends ComponentRender implements ITabs {
15
15
  constructor(props: ITabs);
16
16
  private getTabs;
17
17
  getTab(name: string): Tab;
18
+ /**
19
+ * Method for navigating to the next tab
20
+ * @param loop Defines if want a loop navigation
21
+ */
22
+ nextTab(loop?: boolean): void;
23
+ /**
24
+ * Method for navigating to the previous tab
25
+ * @param loop Defines if want a loop navigation
26
+ */
27
+ previousTab(loop?: boolean): void;
18
28
  /**
19
29
  * Triggered before tab is change.
20
30
  * @param event DOM event