@zeedhi/common 1.62.0 → 1.63.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.
@@ -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();
@@ -253,6 +258,20 @@ class Component {
253
258
  this.isFocused = false;
254
259
  this.callEvent('blur', { event, element, component: this });
255
260
  }
261
+ mouseenter(event, element) {
262
+ this.callEvent('mouseenter', {
263
+ event: (event || new MouseEvent('mouseenter')),
264
+ element: (element || this.element),
265
+ component: this,
266
+ });
267
+ }
268
+ mouseleave(event, element) {
269
+ this.callEvent('mouseleave', {
270
+ event: (event || new MouseEvent('mouseleave')),
271
+ element: (element || this.element),
272
+ component: this,
273
+ });
274
+ }
256
275
  }
257
276
 
258
277
  /**
@@ -2405,8 +2424,24 @@ class TextInput extends Input {
2405
2424
  this.type = props.type || this.type;
2406
2425
  this.valueWithPrefix = this.getInitValue('valueWithPrefix', props.valueWithPrefix, this.valueWithPrefix);
2407
2426
  this.valueWithSuffix = this.getInitValue('valueWithSuffix', props.valueWithSuffix, this.valueWithSuffix);
2427
+ this.addKeyMap();
2408
2428
  this.createAccessors();
2409
2429
  }
2430
+ addKeyMap() {
2431
+ this.keyMap = Object.assign(Object.assign({}, this.keyMap), { 'ctrl+space': {
2432
+ event: this.callSingleIconEvent.bind(this),
2433
+ stop: true,
2434
+ active: true,
2435
+ input: true,
2436
+ } });
2437
+ }
2438
+ callSingleIconEvent({ event, element }) {
2439
+ const iconsProps = ['prependIcon', 'prependOuterIcon', 'appendIcon', 'appendOuterIcon'];
2440
+ const icons = iconsProps.filter((prop) => !!this[prop]);
2441
+ if (icons.length === 1) {
2442
+ this.callEvent(`${icons[0]}Click`, { event, element, component: this });
2443
+ }
2444
+ }
2410
2445
  /**
2411
2446
  * Retrieves a formatted value without valueSuffix and with mask.
2412
2447
  * @param value Text value
@@ -4702,6 +4737,13 @@ class Column extends Component {
4702
4737
  setViewGetWidth(viewGetWidth) {
4703
4738
  this.viewGetWidth = viewGetWidth;
4704
4739
  }
4740
+ /**
4741
+ * Sets a filter to lookupData.
4742
+ */
4743
+ setLookupDataFilter(filter) {
4744
+ var _a;
4745
+ (_a = this.lookupDatasource) === null || _a === void 0 ? void 0 : _a.setFilter(filter);
4746
+ }
4705
4747
  /**
4706
4748
  * Gets the column width.
4707
4749
  */
@@ -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();
@@ -260,6 +265,20 @@
260
265
  this.isFocused = false;
261
266
  this.callEvent('blur', { event, element, component: this });
262
267
  }
268
+ mouseenter(event, element) {
269
+ this.callEvent('mouseenter', {
270
+ event: (event || new MouseEvent('mouseenter')),
271
+ element: (element || this.element),
272
+ component: this,
273
+ });
274
+ }
275
+ mouseleave(event, element) {
276
+ this.callEvent('mouseleave', {
277
+ event: (event || new MouseEvent('mouseleave')),
278
+ element: (element || this.element),
279
+ component: this,
280
+ });
281
+ }
263
282
  }
264
283
 
265
284
  /**
@@ -2412,8 +2431,24 @@
2412
2431
  this.type = props.type || this.type;
2413
2432
  this.valueWithPrefix = this.getInitValue('valueWithPrefix', props.valueWithPrefix, this.valueWithPrefix);
2414
2433
  this.valueWithSuffix = this.getInitValue('valueWithSuffix', props.valueWithSuffix, this.valueWithSuffix);
2434
+ this.addKeyMap();
2415
2435
  this.createAccessors();
2416
2436
  }
2437
+ addKeyMap() {
2438
+ this.keyMap = Object.assign(Object.assign({}, this.keyMap), { 'ctrl+space': {
2439
+ event: this.callSingleIconEvent.bind(this),
2440
+ stop: true,
2441
+ active: true,
2442
+ input: true,
2443
+ } });
2444
+ }
2445
+ callSingleIconEvent({ event, element }) {
2446
+ const iconsProps = ['prependIcon', 'prependOuterIcon', 'appendIcon', 'appendOuterIcon'];
2447
+ const icons = iconsProps.filter((prop) => !!this[prop]);
2448
+ if (icons.length === 1) {
2449
+ this.callEvent(`${icons[0]}Click`, { event, element, component: this });
2450
+ }
2451
+ }
2417
2452
  /**
2418
2453
  * Retrieves a formatted value without valueSuffix and with mask.
2419
2454
  * @param value Text value
@@ -4709,6 +4744,13 @@
4709
4744
  setViewGetWidth(viewGetWidth) {
4710
4745
  this.viewGetWidth = viewGetWidth;
4711
4746
  }
4747
+ /**
4748
+ * Sets a filter to lookupData.
4749
+ */
4750
+ setLookupDataFilter(filter) {
4751
+ var _a;
4752
+ (_a = this.lookupDatasource) === null || _a === void 0 ? void 0 : _a.setFilter(filter);
4753
+ }
4712
4754
  /**
4713
4755
  * Gets the column width.
4714
4756
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.62.0",
3
+ "version": "1.63.0",
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": "eff6f0d11f1e8d865cd5a8d2553ef238a3d4a580"
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
  */
@@ -160,4 +164,6 @@ export declare class Component implements IComponent {
160
164
  * @param element Element that lost the focus
161
165
  */
162
166
  blur(event: Event, element: any): void;
167
+ mouseenter(event?: Event, element?: any): void;
168
+ mouseleave(event?: Event, element?: any): void;
163
169
  }
@@ -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
@@ -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