@zeedhi/common 1.94.3 → 1.95.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.
@@ -83,6 +83,7 @@ class Component {
83
83
  * Return if component can receive focus using tab
84
84
  */
85
85
  this.tabStop = true;
86
+ this.userProperties = {};
86
87
  this.accessorManager = new AccessorManager();
87
88
  this.parent = props.parent;
88
89
  this.name = props.name;
@@ -96,6 +97,7 @@ class Component {
96
97
  this.dark = this.getInitValue('dark', props.dark, this.dark);
97
98
  this.light = this.getInitValue('light', props.light, this.light);
98
99
  this.tabStop = this.getInitValue('tabStop', props.tabStop, this.tabStop);
100
+ this.userProperties = this.getInitValue('userProperties', props.userProperties, this.userProperties);
99
101
  this.children = Array.isArray(props.children) ? props.children : this.children;
100
102
  this.keyMap = KeyMap.factory(props.keyMap || this.keyMap);
101
103
  this.createAccessors();
@@ -7210,6 +7212,10 @@ class Image extends ComponentRender {
7210
7212
  this.validImage = true;
7211
7213
  this.srcValue = src;
7212
7214
  }
7215
+ load(event, element) {
7216
+ this.loadImage();
7217
+ this.callEvent('load', { event, element, component: this });
7218
+ }
7213
7219
  }
7214
7220
 
7215
7221
  /**
@@ -8907,6 +8913,8 @@ class Menu extends ComponentRender {
8907
8913
  /** Store the current item focused */
8908
8914
  this.currentItem = null;
8909
8915
  this.cache = false;
8916
+ /** Disable watcher that close menu when route changes */
8917
+ this.disableRouteWatcher = false;
8910
8918
  this.app = this.getInitValue('app', props.app, this.app);
8911
8919
  this.absolute = this.getInitValue('absolute', props.absolute, this.absolute);
8912
8920
  this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
@@ -8926,8 +8934,9 @@ class Menu extends ComponentRender {
8926
8934
  this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
8927
8935
  this.width = this.getInitValue('width', props.width, this.width);
8928
8936
  this.cache = this.getInitValue('cache', props.cache, this.cache);
8937
+ this.disableRouteWatcher = this.getInitValue('disableRouteWatcher', props.disableRouteWatcher, this.disableRouteWatcher);
8929
8938
  this.mobileBreakpoint = this.getInitValue('mobileBreakpoint', props.mobileBreakpoint, this.mobileBreakpoint);
8930
- this.drawer = window.innerWidth > this.mobileBreakpoint;
8939
+ this.drawer = window.innerWidth > parseInt(this.mobileBreakpoint.toString(), 10);
8931
8940
  this.openedInitialValue = this.getInitValue('opened', props.opened, this.opened);
8932
8941
  if (this.openedInitialValue !== undefined) {
8933
8942
  this.opened = this.openedInitialValue;
@@ -9008,7 +9017,7 @@ class Menu extends ComponentRender {
9008
9017
  * Toggle menu
9009
9018
  */
9010
9019
  toggleMenu() {
9011
- const isMobile = window.innerWidth <= this.mobileBreakpoint;
9020
+ const isMobile = window.innerWidth <= parseInt(this.mobileBreakpoint.toString(), 10);
9012
9021
  if (this.closeToMini && !isMobile) {
9013
9022
  this.miniState = !this.miniState;
9014
9023
  if (this.miniState) {
@@ -90,6 +90,7 @@
90
90
  * Return if component can receive focus using tab
91
91
  */
92
92
  this.tabStop = true;
93
+ this.userProperties = {};
93
94
  this.accessorManager = new core.AccessorManager();
94
95
  this.parent = props.parent;
95
96
  this.name = props.name;
@@ -103,6 +104,7 @@
103
104
  this.dark = this.getInitValue('dark', props.dark, this.dark);
104
105
  this.light = this.getInitValue('light', props.light, this.light);
105
106
  this.tabStop = this.getInitValue('tabStop', props.tabStop, this.tabStop);
107
+ this.userProperties = this.getInitValue('userProperties', props.userProperties, this.userProperties);
106
108
  this.children = Array.isArray(props.children) ? props.children : this.children;
107
109
  this.keyMap = core.KeyMap.factory(props.keyMap || this.keyMap);
108
110
  this.createAccessors();
@@ -7217,6 +7219,10 @@
7217
7219
  this.validImage = true;
7218
7220
  this.srcValue = src;
7219
7221
  }
7222
+ load(event, element) {
7223
+ this.loadImage();
7224
+ this.callEvent('load', { event, element, component: this });
7225
+ }
7220
7226
  }
7221
7227
 
7222
7228
  /**
@@ -8914,6 +8920,8 @@
8914
8920
  /** Store the current item focused */
8915
8921
  this.currentItem = null;
8916
8922
  this.cache = false;
8923
+ /** Disable watcher that close menu when route changes */
8924
+ this.disableRouteWatcher = false;
8917
8925
  this.app = this.getInitValue('app', props.app, this.app);
8918
8926
  this.absolute = this.getInitValue('absolute', props.absolute, this.absolute);
8919
8927
  this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
@@ -8933,8 +8941,9 @@
8933
8941
  this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
8934
8942
  this.width = this.getInitValue('width', props.width, this.width);
8935
8943
  this.cache = this.getInitValue('cache', props.cache, this.cache);
8944
+ this.disableRouteWatcher = this.getInitValue('disableRouteWatcher', props.disableRouteWatcher, this.disableRouteWatcher);
8936
8945
  this.mobileBreakpoint = this.getInitValue('mobileBreakpoint', props.mobileBreakpoint, this.mobileBreakpoint);
8937
- this.drawer = window.innerWidth > this.mobileBreakpoint;
8946
+ this.drawer = window.innerWidth > parseInt(this.mobileBreakpoint.toString(), 10);
8938
8947
  this.openedInitialValue = this.getInitValue('opened', props.opened, this.opened);
8939
8948
  if (this.openedInitialValue !== undefined) {
8940
8949
  this.opened = this.openedInitialValue;
@@ -9015,7 +9024,7 @@
9015
9024
  * Toggle menu
9016
9025
  */
9017
9026
  toggleMenu() {
9018
- const isMobile = window.innerWidth <= this.mobileBreakpoint;
9027
+ const isMobile = window.innerWidth <= parseInt(this.mobileBreakpoint.toString(), 10);
9019
9028
  if (this.closeToMini && !isMobile) {
9020
9029
  this.miniState = !this.miniState;
9021
9030
  if (this.miniState) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.94.3",
3
+ "version": "1.95.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": "753118fca0f43c2904aba5e10d22c518a1a67339"
46
+ "gitHead": "61b544362928fc5b8e27258a628420d31345e6f3"
47
47
  }
@@ -1,4 +1,4 @@
1
- import { IKeyMap } from '@zeedhi/core';
1
+ import { IKeyMap, IDictionary } from '@zeedhi/core';
2
2
  import { IComponent, IComponentDirectives, IComponentEvents } from './interfaces';
3
3
  /**
4
4
  * Base class for all Zeedhi components.
@@ -75,6 +75,7 @@ export declare class Component implements IComponent {
75
75
  * Return if component can receive focus using tab
76
76
  */
77
77
  tabStop: boolean;
78
+ userProperties: IDictionary<any>;
78
79
  /**
79
80
  * Properties accessors to controller.
80
81
  */
@@ -1,4 +1,4 @@
1
- import { IEvent, IEvents, IEventParam, IKeyMap } from '@zeedhi/core';
1
+ import { IEvent, IEvents, IEventParam, IKeyMap, IDictionary } from '@zeedhi/core';
2
2
  import { Component } from './component';
3
3
  export interface IPropAccessor {
4
4
  [key: string]: {
@@ -22,6 +22,7 @@ export interface IComponent {
22
22
  name: string;
23
23
  parent?: Component;
24
24
  tabStop?: boolean;
25
+ userProperties?: IDictionary;
25
26
  [key: string]: any;
26
27
  }
27
28
  export interface IComponentRender extends IComponent {
@@ -115,6 +115,7 @@ export declare class Form extends ComponentRender implements IForm {
115
115
  name: string;
116
116
  parent?: import("..").Component | undefined;
117
117
  tabStop?: boolean | undefined;
118
+ userProperties?: IDictionary<any> | undefined;
118
119
  }[];
119
120
  /**
120
121
  * Grid system for each child.
@@ -32,6 +32,7 @@ export declare class GridColumn extends Column implements IGridColumn {
32
32
  name: string;
33
33
  parent?: import("..").Component | undefined;
34
34
  tabStop?: boolean | undefined;
35
+ userProperties?: IDictionary<any> | undefined;
35
36
  }[];
36
37
  /**
37
38
  * Get the Column without the conditions object
@@ -1,4 +1,4 @@
1
- import { IImage } from './interfaces';
1
+ import { IImage, IImageEvents } from './interfaces';
2
2
  import { ComponentRender } from '../zd-component/component-render';
3
3
  /**
4
4
  * The Image component <code>zd-image</code> is used to show images.
@@ -62,6 +62,10 @@ export declare class Image extends ComponentRender implements IImage {
62
62
  */
63
63
  private srcValue;
64
64
  validImage: any;
65
+ /**
66
+ * Defines image events.
67
+ */
68
+ events: IImageEvents;
65
69
  /**
66
70
  * Creates a new Image.
67
71
  * @param props Image properties
@@ -77,4 +81,5 @@ export declare class Image extends ComponentRender implements IImage {
77
81
  errorImage(): void;
78
82
  get src(): string;
79
83
  set src(src: string);
84
+ load(event?: Event, element?: HTMLElement): void;
80
85
  }
@@ -1,7 +1,10 @@
1
1
  import { IEventParam } from '@zeedhi/core';
2
2
  import { Image } from './image';
3
- import { IComponentRender } from '../zd-component/interfaces';
3
+ import { EventDef, IComponentEvents, IComponentRender } from '../zd-component/interfaces';
4
4
  export declare type IImageEvent = IEventParam<Image>;
5
+ export interface IImageEvents<T = IEventParam<any>> extends IComponentEvents<T> {
6
+ load?: EventDef<T>;
7
+ }
5
8
  export interface IImage extends IComponentRender {
6
9
  alt?: string;
7
10
  errorImagePath?: string;
@@ -15,4 +18,5 @@ export interface IImage extends IComponentRender {
15
18
  width?: number | string;
16
19
  maxWidth?: number | string;
17
20
  minWidth?: number | string;
21
+ events?: IImageEvents;
18
22
  }
@@ -27,6 +27,7 @@ export interface IMenu extends IComponentRender {
27
27
  width?: number | string;
28
28
  mobileBreakpoint?: number | string;
29
29
  cache?: boolean;
30
+ disableRouteWatcher?: boolean;
30
31
  }
31
32
  /**
32
33
  * Interface for menu itens
@@ -118,6 +118,8 @@ export declare class Menu extends ComponentRender implements IMenu {
118
118
  /** Store the current item focused */
119
119
  currentItem: IMenuItem | null;
120
120
  cache?: boolean;
121
+ /** Disable watcher that close menu when route changes */
122
+ disableRouteWatcher?: boolean;
121
123
  /**
122
124
  * Creates a new Menu.
123
125
  * @param props Menu properties
@@ -0,0 +1,12 @@
1
+ export interface IJSONObject {
2
+ path: string;
3
+ }
4
+ export declare class JsonCacheService {
5
+ /**
6
+ * jsons collection
7
+ */
8
+ static jsonCollection: IJSONObject[];
9
+ static saveJSONCache(jsonCollection: IJSONObject[]): Promise<void>;
10
+ static getJSONCache(path: string): any;
11
+ static clearJSONCache(jsonCollection: IJSONObject[]): void;
12
+ }