@zeedhi/common 1.59.0 → 1.60.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.
@@ -3106,34 +3106,38 @@ class Dashboard extends ComponentRender {
3106
3106
  };
3107
3107
  /* ----- end modal functions ----- */
3108
3108
  /* Edit header */
3109
- this.headerLeftSlot = [
3110
- {
3111
- name: `addDashboard${this.name}`,
3112
- component: 'ZdButton',
3113
- label: 'ADD',
3114
- iconName: 'plus',
3115
- color: 'white',
3116
- small: true,
3117
- cssClass: 'zd-my-2',
3118
- outline: true,
3119
- events: {
3120
- click: this.openModalAddCard.bind(this),
3109
+ this.editHeader = {
3110
+ component: 'ZdHeader',
3111
+ name: `edit-header-${this.name}`,
3112
+ leftSlot: [
3113
+ {
3114
+ name: `addDashboard${this.name}`,
3115
+ component: 'ZdButton',
3116
+ label: 'ADD',
3117
+ iconName: 'plus',
3118
+ color: 'white',
3119
+ small: true,
3120
+ cssClass: 'zd-my-2',
3121
+ outline: true,
3122
+ events: {
3123
+ click: this.openModalAddCard.bind(this),
3124
+ },
3121
3125
  },
3122
- },
3123
- {
3124
- name: `saveDashboard${this.name}`,
3125
- component: 'ZdButton',
3126
- label: 'SAVE',
3127
- iconName: 'complete',
3128
- color: 'white',
3129
- small: true,
3130
- cssClass: 'zd-my-2',
3131
- outline: true,
3132
- events: {
3133
- click: this.onSave.bind(this),
3126
+ {
3127
+ name: `saveDashboard${this.name}`,
3128
+ component: 'ZdButton',
3129
+ label: 'SAVE',
3130
+ iconName: 'complete',
3131
+ color: 'white',
3132
+ small: true,
3133
+ cssClass: 'zd-my-2',
3134
+ outline: true,
3135
+ events: {
3136
+ click: this.onSave.bind(this),
3137
+ },
3134
3138
  },
3135
- },
3136
- ];
3139
+ ],
3140
+ };
3137
3141
  this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
3138
3142
  this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
3139
3143
  this.cards = this.getInitValue('cards', props.cards, this.cards);
@@ -3142,6 +3146,7 @@ class Dashboard extends ComponentRender {
3142
3146
  this.height = this.getInitValue('height', props.height, this.height);
3143
3147
  this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
3144
3148
  this.cardFooterSlot = this.getInitValue('cardFooterSlot', props.cardFooterSlot, this.cardFooterSlot);
3149
+ this.editHeader = this.getInitValue('editHeader', props.editHeader, this.editHeader);
3145
3150
  this.createAccessors();
3146
3151
  }
3147
3152
  onMounted(element) {
@@ -3320,7 +3325,7 @@ class Dashboard extends ComponentRender {
3320
3325
  }
3321
3326
  /* Generate unique ids */
3322
3327
  getCardId() {
3323
- return Math.random().toString(36).substr(2, 9);
3328
+ return Math.random().toString(36).substring(2, 9);
3324
3329
  }
3325
3330
  selectCard(cardId) {
3326
3331
  this.currentCardId = cardId;
@@ -5118,7 +5123,7 @@ FormatterParserProvider.registerFormatter('column_ZdSelect', ({ column, value, r
5118
5123
  return value;
5119
5124
  });
5120
5125
  FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', ({ column, value, row, componentProps, }) => {
5121
- if (!value || value.length === 0)
5126
+ if (!value || !Array.isArray(value) || value.length === 0)
5122
5127
  return '';
5123
5128
  const { formatterDataText } = componentProps;
5124
5129
  const formatterFn = FormatterParserProvider.getFormatter('column_ZdSelect');
@@ -3113,34 +3113,38 @@
3113
3113
  };
3114
3114
  /* ----- end modal functions ----- */
3115
3115
  /* Edit header */
3116
- this.headerLeftSlot = [
3117
- {
3118
- name: `addDashboard${this.name}`,
3119
- component: 'ZdButton',
3120
- label: 'ADD',
3121
- iconName: 'plus',
3122
- color: 'white',
3123
- small: true,
3124
- cssClass: 'zd-my-2',
3125
- outline: true,
3126
- events: {
3127
- click: this.openModalAddCard.bind(this),
3116
+ this.editHeader = {
3117
+ component: 'ZdHeader',
3118
+ name: `edit-header-${this.name}`,
3119
+ leftSlot: [
3120
+ {
3121
+ name: `addDashboard${this.name}`,
3122
+ component: 'ZdButton',
3123
+ label: 'ADD',
3124
+ iconName: 'plus',
3125
+ color: 'white',
3126
+ small: true,
3127
+ cssClass: 'zd-my-2',
3128
+ outline: true,
3129
+ events: {
3130
+ click: this.openModalAddCard.bind(this),
3131
+ },
3128
3132
  },
3129
- },
3130
- {
3131
- name: `saveDashboard${this.name}`,
3132
- component: 'ZdButton',
3133
- label: 'SAVE',
3134
- iconName: 'complete',
3135
- color: 'white',
3136
- small: true,
3137
- cssClass: 'zd-my-2',
3138
- outline: true,
3139
- events: {
3140
- click: this.onSave.bind(this),
3133
+ {
3134
+ name: `saveDashboard${this.name}`,
3135
+ component: 'ZdButton',
3136
+ label: 'SAVE',
3137
+ iconName: 'complete',
3138
+ color: 'white',
3139
+ small: true,
3140
+ cssClass: 'zd-my-2',
3141
+ outline: true,
3142
+ events: {
3143
+ click: this.onSave.bind(this),
3144
+ },
3141
3145
  },
3142
- },
3143
- ];
3146
+ ],
3147
+ };
3144
3148
  this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
3145
3149
  this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
3146
3150
  this.cards = this.getInitValue('cards', props.cards, this.cards);
@@ -3149,6 +3153,7 @@
3149
3153
  this.height = this.getInitValue('height', props.height, this.height);
3150
3154
  this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
3151
3155
  this.cardFooterSlot = this.getInitValue('cardFooterSlot', props.cardFooterSlot, this.cardFooterSlot);
3156
+ this.editHeader = this.getInitValue('editHeader', props.editHeader, this.editHeader);
3152
3157
  this.createAccessors();
3153
3158
  }
3154
3159
  onMounted(element) {
@@ -3327,7 +3332,7 @@
3327
3332
  }
3328
3333
  /* Generate unique ids */
3329
3334
  getCardId() {
3330
- return Math.random().toString(36).substr(2, 9);
3335
+ return Math.random().toString(36).substring(2, 9);
3331
3336
  }
3332
3337
  selectCard(cardId) {
3333
3338
  this.currentCardId = cardId;
@@ -5125,7 +5130,7 @@
5125
5130
  return value;
5126
5131
  });
5127
5132
  core.FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', ({ column, value, row, componentProps, }) => {
5128
- if (!value || value.length === 0)
5133
+ if (!value || !Array.isArray(value) || value.length === 0)
5129
5134
  return '';
5130
5135
  const { formatterDataText } = componentProps;
5131
5136
  const formatterFn = core.FormatterParserProvider.getFormatter('column_ZdSelect');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.59.0",
3
+ "version": "1.60.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": "1994ad253bafc3190adf1dd0db028b2825a2f16e"
42
+ "gitHead": "70326c57b4ab9d895495ee1a05045060a09cc41a"
43
43
  }
@@ -1,9 +1,9 @@
1
1
  import { IDashboard, IDashboardEvents, IDashboardCard } from './interfaces';
2
2
  import { ComponentRender } from '../zd-component/component-render';
3
- import { IButton } from '../zd-button/interfaces';
4
3
  import { Modal } from '../zd-modal/modal';
5
4
  import { IModal } from '../zd-modal/interfaces';
6
5
  import { IComponentRender } from '../zd-component/interfaces';
6
+ import { IHeader } from '../zd-header/interfaces';
7
7
  /**
8
8
  * Base class for Dashboard component.
9
9
  */
@@ -38,7 +38,7 @@ export declare class Dashboard extends ComponentRender implements IDashboard {
38
38
  openModalAddCard(): void;
39
39
  modalCancelClick(): void;
40
40
  openModalEditCard(cardId: string): void;
41
- headerLeftSlot: IButton[];
41
+ editHeader: IHeader;
42
42
  onSave(): void;
43
43
  getFrameProps(cardId: string): {
44
44
  name?: undefined;
@@ -1,8 +1,8 @@
1
1
  import { IEventParam } from '@zeedhi/core';
2
2
  import { Dashboard } from './dashboard';
3
3
  import { IComponentRender, IComponentEvents } from '../zd-component/interfaces';
4
- import { IButton } from '../zd-button/interfaces';
5
4
  import { ICard } from '../zd-card/interfaces';
5
+ import { IHeader } from '../zd-header/interfaces';
6
6
  export declare type IDashboardEventParam = IEventParam<Dashboard>;
7
7
  export declare type IDashboardLoadEvent<T> = (event: T) => Promise<any>;
8
8
  export interface IDashboardEvents<T = IEventParam<any>> extends IComponentEvents<T> {
@@ -14,7 +14,7 @@ export interface IDashboard extends IComponentRender {
14
14
  cards?: IDashboardCard[];
15
15
  editingMode?: boolean;
16
16
  moveMode?: boolean;
17
- headerLeftSlot?: IButton[];
17
+ editHeader?: IHeader;
18
18
  removePadding?: boolean;
19
19
  height?: string | number;
20
20
  heightAdjust?: string | number;