@zeedhi/common 1.62.0 → 1.63.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.
@@ -69,6 +69,10 @@ class Component {
69
69
  * Return if component has focus
70
70
  */
71
71
  this.isFocused = false;
72
+ /**
73
+ * Return if component can receive focus using tab
74
+ */
75
+ this.tabStop = true;
72
76
  this.accessorManager = new AccessorManager();
73
77
  this.parent = props.parent;
74
78
  this.name = props.name;
@@ -79,6 +83,7 @@ class Component {
79
83
  this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
80
84
  this.dark = this.getInitValue('dark', props.dark, this.dark);
81
85
  this.light = this.getInitValue('light', props.light, this.light);
86
+ this.tabStop = this.getInitValue('tabStop', props.tabStop, this.tabStop);
82
87
  this.children = Array.isArray(props.children) ? props.children : this.children;
83
88
  this.keyMap = KeyMap.factory(props.keyMap || this.keyMap);
84
89
  this.createAccessors();
@@ -2405,8 +2410,24 @@ class TextInput extends Input {
2405
2410
  this.type = props.type || this.type;
2406
2411
  this.valueWithPrefix = this.getInitValue('valueWithPrefix', props.valueWithPrefix, this.valueWithPrefix);
2407
2412
  this.valueWithSuffix = this.getInitValue('valueWithSuffix', props.valueWithSuffix, this.valueWithSuffix);
2413
+ this.addKeyMap();
2408
2414
  this.createAccessors();
2409
2415
  }
2416
+ addKeyMap() {
2417
+ this.keyMap = Object.assign(Object.assign({}, this.keyMap), { 'ctrl+space': {
2418
+ event: this.callSingleIconEvent.bind(this),
2419
+ stop: true,
2420
+ active: true,
2421
+ input: true,
2422
+ } });
2423
+ }
2424
+ callSingleIconEvent({ event, element }) {
2425
+ const iconsProps = ['prependIcon', 'prependOuterIcon', 'appendIcon', 'appendOuterIcon'];
2426
+ const icons = iconsProps.filter((prop) => !!this[prop]);
2427
+ if (icons.length === 1) {
2428
+ this.callEvent(`${icons[0]}Click`, { event, element, component: this });
2429
+ }
2430
+ }
2410
2431
  /**
2411
2432
  * Retrieves a formatted value without valueSuffix and with mask.
2412
2433
  * @param value Text value
@@ -4702,6 +4723,13 @@ class Column extends Component {
4702
4723
  setViewGetWidth(viewGetWidth) {
4703
4724
  this.viewGetWidth = viewGetWidth;
4704
4725
  }
4726
+ /**
4727
+ * Sets a filter to lookupData.
4728
+ */
4729
+ setLookupDataFilter(filter) {
4730
+ var _a;
4731
+ (_a = this.lookupDatasource) === null || _a === void 0 ? void 0 : _a.setFilter(filter);
4732
+ }
4705
4733
  /**
4706
4734
  * Gets the column width.
4707
4735
  */
@@ -5319,6 +5347,7 @@ class Grid extends Iterable {
5319
5347
  this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
5320
5348
  this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
5321
5349
  this.loadingText = this.getInitValue('loadingText', props.loadingText, this.loadingText);
5350
+ this.rowStyleConditions = this.getInitValue('rowStyleConditions', props.rowStyleConditions, this.rowStyleConditions);
5322
5351
  this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
5323
5352
  this.footerSlot = props.footerSlot || this.footerSlot;
5324
5353
  this.noDataSlot = props.noDataSlot || this.noDataSlot;
@@ -5546,6 +5575,12 @@ class Grid extends Iterable {
5546
5575
  return !!this.disableSelection && typeof this.disableSelection === 'function'
5547
5576
  && this.disableSelection({ row, component: this });
5548
5577
  }
5578
+ getRowStyleConditions(row) {
5579
+ if (typeof this.rowStyleConditions === 'function') {
5580
+ return this.rowStyleConditions(row);
5581
+ }
5582
+ return {};
5583
+ }
5549
5584
  }
5550
5585
 
5551
5586
  /**
@@ -76,6 +76,10 @@
76
76
  * Return if component has focus
77
77
  */
78
78
  this.isFocused = false;
79
+ /**
80
+ * Return if component can receive focus using tab
81
+ */
82
+ this.tabStop = true;
79
83
  this.accessorManager = new core.AccessorManager();
80
84
  this.parent = props.parent;
81
85
  this.name = props.name;
@@ -86,6 +90,7 @@
86
90
  this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
87
91
  this.dark = this.getInitValue('dark', props.dark, this.dark);
88
92
  this.light = this.getInitValue('light', props.light, this.light);
93
+ this.tabStop = this.getInitValue('tabStop', props.tabStop, this.tabStop);
89
94
  this.children = Array.isArray(props.children) ? props.children : this.children;
90
95
  this.keyMap = core.KeyMap.factory(props.keyMap || this.keyMap);
91
96
  this.createAccessors();
@@ -2412,8 +2417,24 @@
2412
2417
  this.type = props.type || this.type;
2413
2418
  this.valueWithPrefix = this.getInitValue('valueWithPrefix', props.valueWithPrefix, this.valueWithPrefix);
2414
2419
  this.valueWithSuffix = this.getInitValue('valueWithSuffix', props.valueWithSuffix, this.valueWithSuffix);
2420
+ this.addKeyMap();
2415
2421
  this.createAccessors();
2416
2422
  }
2423
+ addKeyMap() {
2424
+ this.keyMap = Object.assign(Object.assign({}, this.keyMap), { 'ctrl+space': {
2425
+ event: this.callSingleIconEvent.bind(this),
2426
+ stop: true,
2427
+ active: true,
2428
+ input: true,
2429
+ } });
2430
+ }
2431
+ callSingleIconEvent({ event, element }) {
2432
+ const iconsProps = ['prependIcon', 'prependOuterIcon', 'appendIcon', 'appendOuterIcon'];
2433
+ const icons = iconsProps.filter((prop) => !!this[prop]);
2434
+ if (icons.length === 1) {
2435
+ this.callEvent(`${icons[0]}Click`, { event, element, component: this });
2436
+ }
2437
+ }
2417
2438
  /**
2418
2439
  * Retrieves a formatted value without valueSuffix and with mask.
2419
2440
  * @param value Text value
@@ -4709,6 +4730,13 @@
4709
4730
  setViewGetWidth(viewGetWidth) {
4710
4731
  this.viewGetWidth = viewGetWidth;
4711
4732
  }
4733
+ /**
4734
+ * Sets a filter to lookupData.
4735
+ */
4736
+ setLookupDataFilter(filter) {
4737
+ var _a;
4738
+ (_a = this.lookupDatasource) === null || _a === void 0 ? void 0 : _a.setFilter(filter);
4739
+ }
4712
4740
  /**
4713
4741
  * Gets the column width.
4714
4742
  */
@@ -5326,6 +5354,7 @@
5326
5354
  this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
5327
5355
  this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
5328
5356
  this.loadingText = this.getInitValue('loadingText', props.loadingText, this.loadingText);
5357
+ this.rowStyleConditions = this.getInitValue('rowStyleConditions', props.rowStyleConditions, this.rowStyleConditions);
5329
5358
  this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
5330
5359
  this.footerSlot = props.footerSlot || this.footerSlot;
5331
5360
  this.noDataSlot = props.noDataSlot || this.noDataSlot;
@@ -5553,6 +5582,12 @@
5553
5582
  return !!this.disableSelection && typeof this.disableSelection === 'function'
5554
5583
  && this.disableSelection({ row, component: this });
5555
5584
  }
5585
+ getRowStyleConditions(row) {
5586
+ if (typeof this.rowStyleConditions === 'function') {
5587
+ return this.rowStyleConditions(row);
5588
+ }
5589
+ return {};
5590
+ }
5556
5591
  }
5557
5592
 
5558
5593
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.62.0",
3
+ "version": "1.63.1",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -39,5 +39,5 @@
39
39
  "lodash.times": "^4.3.2",
40
40
  "mockdate": "^3.0.2"
41
41
  },
42
- "gitHead": "ac9406efae2559cdcba913d4a1545906927b0b62"
42
+ "gitHead": "40d3771db8e7e77c1c30b3f9b1d6a68006d3242e"
43
43
  }
@@ -63,6 +63,10 @@ export declare class Component implements IComponent {
63
63
  * Return if component has focus
64
64
  */
65
65
  isFocused: boolean;
66
+ /**
67
+ * Return if component can receive focus using tab
68
+ */
69
+ tabStop: boolean;
66
70
  /**
67
71
  * Properties accessors to controller.
68
72
  */
@@ -19,6 +19,7 @@ export interface IComponent {
19
19
  keyMap?: IKeyMap;
20
20
  name: string;
21
21
  parent?: Component;
22
+ tabStop?: boolean;
22
23
  [key: string]: any;
23
24
  }
24
25
  export interface IComponentRender extends IComponent {
@@ -82,6 +82,7 @@ export declare class Form extends ComponentRender implements IForm {
82
82
  keyMap?: import("@zeedhi/core").IKeyMap<import("@zeedhi/core").IEventParam<any>> | undefined;
83
83
  name: string;
84
84
  parent?: import("..").Component | undefined;
85
+ tabStop?: boolean | undefined;
85
86
  }[];
86
87
  /**
87
88
  * Grid system for each child.
@@ -32,6 +32,7 @@ export declare class GridColumn extends Column implements IGridColumn {
32
32
  * @param props Grid column properties
33
33
  */
34
34
  parent?: import("..").Component | undefined;
35
+ tabStop?: boolean | undefined;
35
36
  }[];
36
37
  /**
37
38
  * Get the Column without the conditions object
@@ -105,6 +105,11 @@ export declare class Grid extends Iterable implements IGrid {
105
105
  * @public
106
106
  */
107
107
  resizeColumns: boolean;
108
+ /**
109
+ * Enables column resizing
110
+ * @public
111
+ */
112
+ rowStyleConditions?: (row: IDictionary) => IDictionary;
108
113
  /**
109
114
  * Disable selection of specific rows using controller
110
115
  * @public
@@ -178,4 +183,5 @@ export declare class Grid extends Iterable implements IGrid {
178
183
  getActionComponent(actionComponent: IComponent, column: GridColumn, row: IDictionary, parentPath?: string): IComponent;
179
184
  protected changeDefaultSlotNames(slot: IComponentRender[]): any;
180
185
  callDisableSelection(row: IDictionary<any>): boolean;
186
+ getRowStyleConditions(row: IDictionary<any>): IDictionary<any>;
181
187
  }
@@ -41,6 +41,7 @@ export interface IGrid extends IIterable {
41
41
  loadingText?: string;
42
42
  noDataText?: string;
43
43
  noResultsText?: string;
44
+ rowStyleConditions?: (row: IDictionary) => IDictionary;
44
45
  disableSelection?: (args: {
45
46
  row: IDictionary<any>;
46
47
  component: Grid;
@@ -48,6 +48,10 @@ export declare class Column extends Component implements IColumn {
48
48
  * Sets view getWidth method.
49
49
  */
50
50
  setViewGetWidth(viewGetWidth: () => number): void;
51
+ /**
52
+ * Sets a filter to lookupData.
53
+ */
54
+ setLookupDataFilter(filter: IDictionary): void;
51
55
  /**
52
56
  * Gets the column width.
53
57
  */
@@ -51,6 +51,8 @@ export declare class TextInput extends Input implements ITextInput {
51
51
  * @param props TextInput properties
52
52
  */
53
53
  constructor(props: ITextInput);
54
+ private addKeyMap;
55
+ private callSingleIconEvent;
54
56
  /**
55
57
  * Retrieves a formatted value without valueSuffix and with mask.
56
58
  * @param value Text value