@digital-realty/ix-notifications 1.0.21 → 1.0.22

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.
Files changed (33) hide show
  1. package/dist/IxNotifications.js +90 -48
  2. package/dist/IxNotifications.js.map +1 -1
  3. package/dist/assets/iconset.d.ts +6 -0
  4. package/dist/assets/iconset.js +8 -0
  5. package/dist/assets/iconset.js.map +1 -0
  6. package/dist/components/notifications/date-filters.js +20 -20
  7. package/dist/components/notifications/date-filters.js.map +1 -1
  8. package/dist/components/notifications/group-filters.js +28 -22
  9. package/dist/components/notifications/group-filters.js.map +1 -1
  10. package/dist/components/notifications/grouped-item.d.ts +1 -1
  11. package/dist/components/notifications/grouped-item.js +10 -5
  12. package/dist/components/notifications/grouped-item.js.map +1 -1
  13. package/dist/components/notifications/notification-item.d.ts +3 -2
  14. package/dist/components/notifications/notification-item.js +74 -42
  15. package/dist/components/notifications/notification-item.js.map +1 -1
  16. package/dist/components/notifications/notification-tooltip.d.ts +9 -0
  17. package/dist/components/notifications/notification-tooltip.js +53 -0
  18. package/dist/components/notifications/notification-tooltip.js.map +1 -0
  19. package/dist/components/notifications/view-item-dialog.d.ts +1 -1
  20. package/dist/components/notifications/view-item-dialog.js +15 -20
  21. package/dist/components/notifications/view-item-dialog.js.map +1 -1
  22. package/dist/constants/notifications.d.ts +1 -1
  23. package/dist/constants/notifications.js +1 -1
  24. package/dist/constants/notifications.js.map +1 -1
  25. package/dist/helper/common.js +3 -4
  26. package/dist/helper/common.js.map +1 -1
  27. package/dist/ix-notifications.min.js +1 -1
  28. package/dist/models/notification.js.map +1 -1
  29. package/dist/state/NotificationState.js +14 -14
  30. package/dist/state/NotificationState.js.map +1 -1
  31. package/dist/styles/notifications-style.js +49 -6
  32. package/dist/styles/notifications-style.js.map +1 -1
  33. package/package.json +3 -2
@@ -3,6 +3,7 @@ import { html, nothing } from 'lit';
3
3
  import { property, query, state } from 'lit/decorators.js';
4
4
  import { MobxLitElement } from '@adobe/lit-mobx';
5
5
  import { differenceInDays, differenceInHours } from 'date-fns';
6
+ import { plannedMaintenance, viewList, dcim, sortCheck, } from './assets/iconset.js';
6
7
  import { TWStyles } from './tw.js';
7
8
  import '@digital-realty/ix-button/ix-button.js';
8
9
  import '@digital-realty/ix-drawer/ix-drawer.js';
@@ -16,6 +17,7 @@ import './components/notifications/group-filters.js';
16
17
  import './components/notifications/date-filters.js';
17
18
  import './components/notifications/confirmation-dialog.js';
18
19
  import { NotificationsStyle } from './styles/notifications-style.js';
20
+ import { handleMouseOver, handleMouseOut, } from './components/notifications/notification-tooltip.js';
19
21
  export class IxNotifications extends MobxLitElement {
20
22
  constructor() {
21
23
  super(...arguments);
@@ -43,7 +45,8 @@ export class IxNotifications extends MobxLitElement {
43
45
  window.removeEventListener('beforeunload', this.handleOnbeforeunload);
44
46
  super.disconnectedCallback();
45
47
  }
46
- //Handle browser refresh event
48
+ // Handle browser refresh event
49
+ // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
47
50
  handleOnbeforeunload(event) {
48
51
  NotificationsState.clearStoredNotificationsData();
49
52
  }
@@ -73,7 +76,9 @@ export class IxNotifications extends MobxLitElement {
73
76
  </div>`;
74
77
  }
75
78
  markAllread() {
76
- this.showMarkAllReadConfirmation = true;
79
+ if (NotificationsState.unreadNotificationCount > 0) {
80
+ this.showMarkAllReadConfirmation = true;
81
+ }
77
82
  }
78
83
  confirmedMarkAllRead(e) {
79
84
  // Mark All read if Confirmed True
@@ -88,8 +93,13 @@ export class IxNotifications extends MobxLitElement {
88
93
  allResultSuccesful = result;
89
94
  });
90
95
  });
91
- const apiResult = { State: allResultSuccesful === true ? ApiCallState.SUCCESS : ApiCallState.ERROR,
92
- Message: allResultSuccesful === true ? "Successfully marked all the notifications as read" : "Error occurred while marking the notifications as read, Please try again"
96
+ const apiResult = {
97
+ State: allResultSuccesful === true
98
+ ? ApiCallState.SUCCESS
99
+ : ApiCallState.ERROR,
100
+ Message: allResultSuccesful === true
101
+ ? 'Successfully marked all the notificaions as read'
102
+ : 'Error while marking the notifications read, Please try again',
93
103
  };
94
104
  this.showResultMessage(apiResult, unreadItems[0].id);
95
105
  this.renderUnReadCountText();
@@ -98,20 +108,26 @@ export class IxNotifications extends MobxLitElement {
98
108
  }
99
109
  this.showMarkAllReadConfirmation = false;
100
110
  }
111
+ // eslint-disable-next-line class-methods-use-this
101
112
  showResultMessage(result, id) {
102
- window.dispatchEvent(new CustomEvent("add-toast", { detail: {
113
+ window.dispatchEvent(new CustomEvent('add-toast', {
114
+ detail: {
103
115
  id,
104
- content: html `
105
- <ix-message-toast toastId=${id} .TMessageToast=${result.State.toLowerCase()} forceClose>
106
- ${result.Message}
107
- </ix-message-toast>`,
116
+ content: html ` <ix-message-toast
117
+ toastId=${id}
118
+ .TMessageToast=${result.State.toLowerCase()}
119
+ forceClose
120
+ >
121
+ ${result.Message}
122
+ </ix-message-toast>`,
108
123
  autoClose: 3000,
109
124
  durationOut: 3000,
110
125
  vertical: 'bottom',
111
126
  horizontal: 'center',
112
127
  animated: true,
113
128
  above: false,
114
- } }));
129
+ },
130
+ }));
115
131
  }
116
132
  toggleGroupView() {
117
133
  this.showGroupedView = !this.showGroupedView;
@@ -122,24 +138,29 @@ export class IxNotifications extends MobxLitElement {
122
138
  /* eslint-disable-next-line */
123
139
  applyNotificationFilters() {
124
140
  var _a;
125
- const filterredNotifications = (_a = NotificationsState.notifications) === null || _a === void 0 ? void 0 : _a.filter((x) => (x.resourceType === NotificationGroups.PLANNED_MAINTENANCE &&
141
+ const filteredNotifications = (_a = NotificationsState.notifications) === null || _a === void 0 ? void 0 : _a.filter((notification) => (notification.resourceType === NotificationGroups.PLANNED_MAINTENANCE &&
126
142
  NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE ===
127
143
  true) ||
128
- (x.resourceType === NotificationGroups.SERVICE_TICKETS &&
144
+ (notification.resourceType === NotificationGroups.SERVICE_TICKETS &&
129
145
  NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS ===
130
146
  true) ||
131
- (x.resourceType === NotificationGroups.DCIM_ALERTS &&
147
+ (notification.resourceType === NotificationGroups.DCIM_ALERTS &&
132
148
  NotificationsState.notificationFilters.SHOW_DCIM_ALERTS === true) ||
133
- x.resourceType === NotificationGroups.INCIDENTS); // Always display incidents
134
- if (NotificationsState.dateFilters.FROM_DATE === undefined &&
149
+ notification.resourceType === NotificationGroups.INCIDENTS); // Always display incidents
150
+ // both dates are defined, search within the window
151
+ if (NotificationsState.dateFilters.FROM_DATE !== undefined &&
152
+ NotificationsState.dateFilters.TO_DATE !== undefined)
153
+ return filteredNotifications.filter(notification => differenceInHours(new Date(notification.createdAt), NotificationsState.dateFilters.FROM_DATE) >= 0 &&
154
+ differenceInDays(new Date(notification.createdAt), NotificationsState.dateFilters.TO_DATE) <= 0);
155
+ // FROM_DATE is defined, TO_DATE is undefined, return notifications after FROM_DATE
156
+ if (NotificationsState.dateFilters.FROM_DATE !== undefined &&
135
157
  NotificationsState.dateFilters.TO_DATE === undefined)
136
- return filterredNotifications;
137
- if (NotificationsState.dateFilters.FROM_DATE === undefined)
138
- return filterredNotifications.filter(x => differenceInDays(new Date(x.createdAt), NotificationsState.dateFilters.TO_DATE) <= 0);
139
- if (NotificationsState.dateFilters.TO_DATE === undefined)
140
- return filterredNotifications.filter(x => differenceInHours(new Date(x.createdAt), NotificationsState.dateFilters.FROM_DATE) >= 0);
141
- return filterredNotifications.filter(x => differenceInHours(new Date(x.createdAt), NotificationsState.dateFilters.FROM_DATE) >= 0 &&
142
- differenceInDays(new Date(x.createdAt), NotificationsState.dateFilters.TO_DATE) <= 0);
158
+ return filteredNotifications.filter(notification => differenceInHours(new Date(notification.createdAt), NotificationsState.dateFilters.FROM_DATE) >= 0);
159
+ // TO_DATE is defined, FROM_DATE is undefined, return notifications before TO_DATE
160
+ if (NotificationsState.dateFilters.FROM_DATE === undefined &&
161
+ NotificationsState.dateFilters.TO_DATE !== undefined)
162
+ return filteredNotifications.filter(notification => differenceInDays(new Date(notification.createdAt), NotificationsState.dateFilters.TO_DATE) <= 0);
163
+ return filteredNotifications;
143
164
  }
144
165
  displayDateFilters() {
145
166
  this.showDateFilters = !this.showDateFilters;
@@ -148,37 +169,37 @@ export class IxNotifications extends MobxLitElement {
148
169
  const filteredNotifications = this.applyNotificationFilters();
149
170
  return html `<div style="margin:0px">
150
171
  <grouped-item
151
- groupTitle=${NotificationGroups.PLANNED_MAINTENANCE}
152
- iconName="lab_profile"
172
+ groupTitle="Planned Site Maintenance"
173
+ groupIcon="${plannedMaintenance.strings[0]}"
153
174
  .childItems=${filteredNotifications === null || filteredNotifications === void 0 ? void 0 : filteredNotifications.filter(item => item.resourceType === NotificationGroups.PLANNED_MAINTENANCE)}
154
175
  ></grouped-item>
155
176
  <grouped-item
156
- groupTitle=${NotificationGroups.INCIDENTS}
157
- iconName="emergency_home"
177
+ groupTitle="Emergency Repairs"
178
+ groupIcon="report"
158
179
  .childItems=${filteredNotifications === null || filteredNotifications === void 0 ? void 0 : filteredNotifications.filter(item => item.resourceType === NotificationGroups.INCIDENTS)}
159
180
  ></grouped-item>
160
181
  <grouped-item
161
- groupTitle=${NotificationGroups.SERVICE_TICKETS}
162
- iconName="dvr"
182
+ groupTitle="Service Ticket Updates"
183
+ groupIcon="sync_saved_locally"
163
184
  .childItems=${filteredNotifications === null || filteredNotifications === void 0 ? void 0 : filteredNotifications.filter(item => item.resourceType === NotificationGroups.SERVICE_TICKETS)}
164
185
  ></grouped-item>
165
186
  <grouped-item
166
187
  groupTitle=${NotificationGroups.DCIM_ALERTS}
167
- iconName="public"
188
+ groupIcon="${dcim.strings[0]}"
168
189
  .childItems=${filteredNotifications === null || filteredNotifications === void 0 ? void 0 : filteredNotifications.filter(item => item.resourceType === NotificationGroups.DCIM_ALERTS)}
169
- ></grouped-item>
190
+ ></grouped-item>
170
191
  </div>`;
171
192
  }
172
193
  renderDefaultView() {
173
194
  const filterNotification = this.applyNotificationFilters();
174
- const filterTodayItems = filterNotification.filter(x => differenceInDays(x.createdAt, new Date()) === 0);
175
- const filterEarlierItems = filterNotification.filter(x => differenceInDays(x.createdAt, new Date()) !== 0);
195
+ const filterTodayItems = filterNotification.filter(notification => differenceInDays(notification.createdAt, new Date()) === 0);
196
+ const filterEarlierItems = filterNotification.filter(notification => differenceInDays(notification.createdAt, new Date()) !== 0);
176
197
  if ((filterNotification === null || filterNotification === void 0 ? void 0 : filterNotification.length) > 0) {
177
- return html ` <h3 class="grow">Latest</h3>
198
+ return html ` <h3 class="grow">Today</h3>
178
199
  <div class="m-0 p-0">
179
200
  ${filterTodayItems.length > 0
180
201
  ? filterTodayItems === null || filterTodayItems === void 0 ? void 0 : filterTodayItems.map(item => html `<notification-item
181
- .notificaiton=${item}
202
+ .notification=${item}
182
203
  ?disabled=${item.resourceType ===
183
204
  NotificationGroups.INCIDENTS}
184
205
  >
@@ -189,7 +210,7 @@ export class IxNotifications extends MobxLitElement {
189
210
  <div>
190
211
  ${filterEarlierItems.length > 0
191
212
  ? filterEarlierItems === null || filterEarlierItems === void 0 ? void 0 : filterEarlierItems.map(item => html `<notification-item
192
- .notificaiton=${item}
213
+ .notification=${item}
193
214
  ?disabled=${item.resourceType ===
194
215
  NotificationGroups.INCIDENTS}
195
216
  >
@@ -197,11 +218,11 @@ export class IxNotifications extends MobxLitElement {
197
218
  : this.renderNoResult()}
198
219
  </div>`;
199
220
  }
200
- return html `<p class="empty">No notifications yet.</p>`;
221
+ return html `<p class="empty"><strong>No notifications yet.</strong></p>`;
201
222
  }
202
223
  /* eslint-disable-next-line */
203
224
  renderNoResult() {
204
- return html `<p class="empty">No notifications yet.</p>`;
225
+ return html `<p class="empty"><strong>No notifications yet.</strong></p>`;
205
226
  }
206
227
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
207
228
  handleCloseClick(_e) {
@@ -231,8 +252,9 @@ export class IxNotifications extends MobxLitElement {
231
252
  }
232
253
  render() {
233
254
  return html `
255
+ <notification-tooltip></notification-tooltip>
234
256
  <div class="relative">
235
- <ix-icon-button class="blue-icon" @click=${() => this.toggleDrawer()}>
257
+ <ix-icon-button class="active-icon" @click=${() => this.toggleDrawer()}>
236
258
  <slot name="icon" slot="default"></slot>
237
259
  </ix-icon-button>
238
260
  ${this.renderUnReadCountText()}
@@ -259,20 +281,36 @@ export class IxNotifications extends MobxLitElement {
259
281
  <div class="flex flex-row justify-end grow items-center options">
260
282
  <ix-icon-button
261
283
  @click=${this.markAllread}
284
+ @mouseover=${(e) => handleMouseOver(e, 'Mark All Read')}
285
+ @mouseout=${handleMouseOut}
262
286
  icon="markunread_mailbox"
263
- class="blue-icon"
287
+ class="${NotificationsState.unreadNotificationCount <= 0
288
+ ? 'inactive-icon'
289
+ : 'active-icon'}"
290
+ .disabled="${NotificationsState.unreadNotificationCount <= 0}"
291
+ filledIcon="true"
264
292
  ></ix-icon-button>
265
293
  <ix-icon-button
266
294
  @click=${this.toggleGroupView}
267
- icon="sort"
268
- class="blue-icon"
269
- ></ix-icon-button>
295
+ @mouseover=${(e) => handleMouseOver(e, 'Sort by Type')}
296
+ @mouseout=${handleMouseOut}
297
+ class="active-icon"
298
+ label="Sort by Type"
299
+ >
300
+ <ix-icon slot="default"
301
+ >${this.showGroupedView ? sortCheck : 'sort'}</ix-icon
302
+ >
303
+ </ix-icon-button>
270
304
  <ix-icon-button
271
305
  @click=${this.displayFilters}
272
- icon="list"
273
- class="blue-icon"
306
+ @mouseover=${(e) => handleMouseOver(e, 'Filter by Type')}
307
+ @mouseout=${handleMouseOut}
308
+ class="active-icon"
274
309
  id="group-filter-button"
275
- ></ix-icon-button>
310
+ label="Filter by Type"
311
+ >
312
+ <ix-icon slot="default"> ${viewList} </ix-icon>
313
+ </ix-icon-button>
276
314
  <div
277
315
  class="filter-dropdown-content ${this.showFilters
278
316
  ? 'active z-50'
@@ -282,9 +320,13 @@ export class IxNotifications extends MobxLitElement {
282
320
  </div>
283
321
  <ix-icon-button
284
322
  @click=${this.displayDateFilters}
285
- icon="calendar_month"
286
- class="blue-icon"
323
+ @mouseover=${(e) => handleMouseOver(e, 'Filter by Date')}
324
+ @mouseout=${handleMouseOut}
325
+ icon="date_range"
326
+ class="active-icon"
327
+ filledIcon="true"
287
328
  id="date-filters-button"
329
+ label="Filter by Date"
288
330
  ></ix-icon-button>
289
331
  <div
290
332
  class="datefilter-dropdown-content ${this.showDateFilters
@@ -300,7 +342,7 @@ export class IxNotifications extends MobxLitElement {
300
342
  ${this.showGroupedView
301
343
  ? this.renderGroupedView()
302
344
  : this.renderDefaultView()}
303
- </div>
345
+ </div>
304
346
  </ix-drawer>
305
347
  `;
306
348
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IxNotifications.js","sourceRoot":"","sources":["../src/IxNotifications.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,wCAAwC,CAAC;AAChD,OAAO,wCAAwC,CAAC;AAChD,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAMlE,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,iDAAiD,CAAC;AACzD,OAAO,4CAA4C,CAAC;AACpD,OAAO,6CAA6C,CAAC;AACrD,OAAO,4CAA4C,CAAC;AACpD,OAAO,mDAAmD,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,OAAO,eAAgB,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e;YACvD,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,EAAE;8BACU,IAAI,CAAC,gBAAgB;;;;;;;YAOvC,IAAI,CAAC,eAAe;YACpB,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE;YAC1B,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE;;;KAGjC,CAAC;IACJ,CAAC;;AArYM,sBAAM,GAAG,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AAEvB;IAAvB,KAAK,CAAC,eAAe,CAAC;qDAA4B;AAEN;IAA5C,KAAK,CAAC,oCAAoC,CAAC;2DAAkC;AAEvD;IAAtB,KAAK,CAAC,cAAc,CAAC;oDAA2B;AAEJ;IAA5C,KAAK,CAAC,oCAAoC,CAAC;0DAAiC;AAEpE;IAAR,KAAK,EAAE;mDAA4B;AAE3B;IAAR,KAAK,EAAE;wDAAiC;AAEhC;IAAR,KAAK,EAAE;oDAA6B;AAE5B;IAAR,KAAK,EAAE;wDAAiC;AAEhC;IAAR,KAAK,EAAE;oEAA6C;AAEzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAiB;AAEhB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAsB","sourcesContent":["import { html, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { differenceInDays, differenceInHours } from 'date-fns';\nimport { TWStyles } from './tw.js';\nimport '@digital-realty/ix-button/ix-button.js';\nimport '@digital-realty/ix-drawer/ix-drawer.js';\nimport '@digital-realty/ix-icon';\nimport '@material/web/icon/icon.js';\nimport { NotificationsState } from './state/NotificationState.js';\nimport { ApiCallResult, Notification } from './models/notification.js';\nimport {\n ConfirmationDialogEventDetail,\n FilterDialogEventDetail,\n} from './constants/notification-types.js';\nimport {\n ApiCallState,\n NotificationGroups,\n NotificationStatus,\n} from './constants/notifications.js';\nimport './components/notifications/notification-item.js';\nimport './components/notifications/grouped-item.js';\nimport './components/notifications/group-filters.js';\nimport './components/notifications/date-filters.js';\nimport './components/notifications/confirmation-dialog.js';\nimport { NotificationsStyle } from './styles/notifications-style.js';\n\nexport class IxNotifications extends MobxLitElement {\n static styles = [TWStyles, NotificationsStyle];\n\n @query('group-filters') groupFilters!: HTMLElement;\n\n @query('ix-icon-button#group-filter-button') groupFiltersButton!: HTMLElement;\n\n @query('date-filters') dateFilters!: HTMLElement;\n\n @query('ix-icon-button#date-filters-button') dateFiltersButton!: HTMLElement;\n\n @state() private showDrawer = false;\n\n @state() private showGroupedView = false;\n\n @state() private showFilters = false;\n\n @state() private showDateFilters = false;\n\n @state() private showMarkAllReadConfirmation = false;\n\n @property({ type: String }) baseApiUrl = '';\n\n @property({ type: String }) localStorageKey = '';\n\n async firstUpdated() { \n // Construct ApiClient form baseApiUrl and localStorageKey\n NotificationsState.baseApiUrl = this.baseApiUrl;\n NotificationsState.localStorageKey = this.localStorageKey;\n NotificationsState.ConstructApiClient();\n }\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\n 'account-switched',\n NotificationsState.NewApiClient\n );\n window.addEventListener('beforeunload', this.handleOnbeforeunload);\n }\n\n disconnectedCallback() {\n window.removeEventListener(\n 'account-switched',\n NotificationsState.NewApiClient\n );\n window.removeEventListener('beforeunload', this.handleOnbeforeunload);\n super.disconnectedCallback();\n }\n\n //Handle browser refresh event\n handleOnbeforeunload(event : any){ \n NotificationsState.clearStoredNotificationsData();\n }\n\n toggleDrawer() {\n this.showDrawer = !this.showDrawer;\n if (!this.showDrawer) {\n this.showFilters = false;\n this.showDateFilters = false;\n }\n }\n\n /* eslint-disable-next-line */\n renderUnReadCountText() {\n if (NotificationsState.unreadNotificationCount <= 0) {\n return html`${nothing}`;\n }\n\n let unreadCountText = '';\n if (NotificationsState.unreadNotificationCount > 99) {\n unreadCountText = '99+';\n } else {\n unreadCountText = NotificationsState.unreadNotificationCount.toString();\n }\n\n return html` <div\n class=\"unread rounded-full text-center text-white text-sm absolute icon-position -start-0\"\n >\n ${unreadCountText}\n </div>`;\n }\n\n markAllread() {\n this.showMarkAllReadConfirmation = true;\n }\n\n private confirmedMarkAllRead(e: CustomEvent<ConfirmationDialogEventDetail>) {\n // Mark All read if Confirmed True\n if (e.detail.returnValue) {\n const filterNotification = this.applyNotificationFilters();\n const unreadItems = filterNotification?.filter(item => item.status === NotificationStatus.UNREAD);\n\n if(unreadItems.length > 0) {\n let allResultSuccesful = true;\n\n filterNotification?.forEach(item => {\n NotificationsState.setNotificationReadStatus(item.id).then((result : any) => \n { \n if(allResultSuccesful)\n allResultSuccesful = result;\n });\n });\n\n const apiResult = { State : allResultSuccesful === true? ApiCallState.SUCCESS : ApiCallState.ERROR,\n Message : allResultSuccesful === true? \"Successfully marked all the notifications as read\" : \"Error occurred while marking the notifications as read, Please try again\"\n } as ApiCallResult;\n\n this.showResultMessage(apiResult,unreadItems[0].id);\n\n this.renderUnReadCountText();\n\n this.requestUpdate();\n }\n }\n\n this.showMarkAllReadConfirmation = false;\n }\n\n private showResultMessage(result: ApiCallResult, id: string )\n { \n window.dispatchEvent(\n new CustomEvent(\"add-toast\", { detail: {\n id,\n content: html`\n <ix-message-toast toastId=${id} .TMessageToast=${result.State.toLowerCase()} forceClose> \n ${result.Message}\n </ix-message-toast>`,\n autoClose: 3000,\n durationOut: 3000,\n vertical: 'bottom',\n horizontal: 'center',\n animated: true, \n above: false,\n } })\n );\n }\n\n toggleGroupView() {\n this.showGroupedView = !this.showGroupedView;\n }\n\n displayFilters() {\n this.showFilters = !this.showFilters;\n }\n\n /* eslint-disable-next-line */\n applyNotificationFilters() {\n const filterredNotifications = NotificationsState.notifications?.filter(\n (x: Notification) =>\n (x.resourceType === NotificationGroups.PLANNED_MAINTENANCE &&\n NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE ===\n true) ||\n (x.resourceType === NotificationGroups.SERVICE_TICKETS &&\n NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS ===\n true) ||\n (x.resourceType === NotificationGroups.DCIM_ALERTS &&\n NotificationsState.notificationFilters.SHOW_DCIM_ALERTS === true) ||\n x.resourceType === NotificationGroups.INCIDENTS\n ); // Always display incidents\n\n if (\n NotificationsState.dateFilters.FROM_DATE === undefined &&\n NotificationsState.dateFilters.TO_DATE === undefined\n )\n return filterredNotifications;\n\n if ( NotificationsState.dateFilters.FROM_DATE === undefined)\n return filterredNotifications.filter(\n x => differenceInDays(\n new Date(x.createdAt),\n NotificationsState.dateFilters.TO_DATE!\n ) <= 0\n );\n \n if ( NotificationsState.dateFilters.TO_DATE === undefined)\n return filterredNotifications.filter(\n x =>\n differenceInHours(\n new Date(x.createdAt),\n NotificationsState.dateFilters.FROM_DATE!\n ) >= 0); \n\n return filterredNotifications.filter(\n x =>\n differenceInHours(\n new Date(x.createdAt),\n NotificationsState.dateFilters.FROM_DATE!\n ) >= 0 &&\n differenceInDays(\n new Date(x.createdAt),\n NotificationsState.dateFilters.TO_DATE!\n ) <= 0\n );\n }\n\n displayDateFilters() {\n this.showDateFilters = !this.showDateFilters;\n }\n\n renderGroupedView() {\n const filteredNotifications = this.applyNotificationFilters();\n\n return html`<div style=\"margin:0px\">\n <grouped-item\n groupTitle=${NotificationGroups.PLANNED_MAINTENANCE}\n iconName=\"lab_profile\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.PLANNED_MAINTENANCE\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.INCIDENTS}\n iconName=\"emergency_home\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.INCIDENTS\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.SERVICE_TICKETS}\n iconName=\"dvr\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.SERVICE_TICKETS\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.DCIM_ALERTS}\n iconName=\"public\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.DCIM_ALERTS\n )}\n ></grouped-item> \n </div>`;\n }\n\n renderDefaultView() {\n const filterNotification = this.applyNotificationFilters();\n const filterTodayItems = filterNotification.filter(\n x => differenceInDays(x.createdAt, new Date()) === 0\n );\n const filterEarlierItems = filterNotification.filter(\n x => differenceInDays(x.createdAt, new Date()) !== 0\n );\n\n if (filterNotification?.length! > 0) {\n return html` <h3 class=\"grow\">Latest</h3>\n <div class=\"m-0 p-0\">\n ${filterTodayItems.length > 0\n ? filterTodayItems?.map(\n item => html`<notification-item\n .notificaiton=${item}\n ?disabled=${item.resourceType ===\n NotificationGroups.INCIDENTS}\n >\n </notification-item> `\n )\n : this.renderNoResult()}\n </div>\n <h3 class=\"grow\">Earlier</h3>\n <div>\n ${filterEarlierItems.length > 0\n ? filterEarlierItems?.map(\n item => html`<notification-item\n .notificaiton=${item}\n ?disabled=${item.resourceType ===\n NotificationGroups.INCIDENTS}\n >\n </notification-item> `\n )\n : this.renderNoResult()}\n </div>`;\n }\n\n return html`<p class=\"empty\">No notifications yet.</p>`;\n }\n\n /* eslint-disable-next-line */\n renderNoResult() {\n return html`<p class=\"empty\">No notifications yet.</p>`;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n handleCloseClick(_e: CustomEvent<FilterDialogEventDetail>) {\n this.showDateFilters = false;\n this.showFilters = false;\n }\n\n // eslint-disable-next-line\n handleContentScroll(e: CustomEvent) {\n // when scrollbar at the end, retrieve next page\n if (\n e !== null &&\n e.detail.scrollTop + e.detail.clientHeight >= e.detail.scrollHeight\n ) {\n NotificationsState.getNotifications();\n }\n }\n\n manageFilterVisibility(e: Event) {\n const path = e.composedPath();\n if (\n this.showFilters &&\n !path.includes(this.groupFilters) &&\n !path.includes(this.groupFiltersButton)\n ) {\n this.showFilters = false;\n }\n if (\n this.showDateFilters &&\n !path.includes(this.dateFilters) &&\n !path.includes(this.dateFiltersButton)\n ) {\n this.showDateFilters = false;\n }\n }\n\n render() {\n return html`\n <div class=\"relative\">\n <ix-icon-button class=\"blue-icon\" @click=${() => this.toggleDrawer()}>\n <slot name=\"icon\" slot=\"default\"></slot>\n </ix-icon-button>\n ${this.renderUnReadCountText()}\n </div>\n <confirmation-dialog\n ?open=${this.showMarkAllReadConfirmation}\n @confirm-dialog-closed=${() => {\n this.showMarkAllReadConfirmation = false;\n }}\n @on-confirm-selection=${this.confirmedMarkAllRead}\n textMessage=\"Are you sure you want to mark all notifications as read?\"\n >\n </confirmation-dialog>\n <ix-drawer\n ?isVisible=${this.showDrawer}\n .onClosed=${() => this.toggleDrawer()}\n animate-vertical\n hide-close\n @on-content-scroll=${this.handleContentScroll}\n @click=${this.manageFilterVisibility}\n >\n <div class=\"flex flex-row justify-between grow py-2\" slot=\"header\">\n <h2 class=\"grow items-center notification-header\">Notifications</h2>\n <div class=\"flex flex-row justify-end grow items-center options\">\n <ix-icon-button\n @click=${this.markAllread}\n icon=\"markunread_mailbox\"\n class=\"blue-icon\"\n ></ix-icon-button>\n <ix-icon-button\n @click=${this.toggleGroupView}\n icon=\"sort\"\n class=\"blue-icon\"\n ></ix-icon-button>\n <ix-icon-button\n @click=${this.displayFilters}\n icon=\"list\"\n class=\"blue-icon\"\n id=\"group-filter-button\"\n ></ix-icon-button>\n <div\n class=\"filter-dropdown-content ${this.showFilters\n ? 'active z-50'\n : ''}\"\n >\n <group-filters></group-filters>\n </div>\n <ix-icon-button\n @click=${this.displayDateFilters}\n icon=\"calendar_month\"\n class=\"blue-icon\"\n id=\"date-filters-button\"\n ></ix-icon-button>\n <div\n class=\"datefilter-dropdown-content ${this.showDateFilters\n ? 'active z-50'\n : ''}\"\n @on-selection=${this.handleCloseClick}\n >\n <date-filters></date-filters>\n </div>\n </div>\n </div>\n <div slot=\"content\">\n ${this.showGroupedView\n ? this.renderGroupedView()\n : this.renderDefaultView()}\n </div> \n </ix-drawer>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"IxNotifications.js","sourceRoot":"","sources":["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;AAEhB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAsB","sourcesContent":["import { html, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { differenceInDays, differenceInHours } from 'date-fns';\nimport {\n plannedMaintenance,\n viewList,\n dcim,\n sortCheck,\n} from './assets/iconset.js';\nimport { TWStyles } from './tw.js';\nimport '@digital-realty/ix-button/ix-button.js';\nimport '@digital-realty/ix-drawer/ix-drawer.js';\nimport '@digital-realty/ix-icon';\nimport '@material/web/icon/icon.js';\nimport { NotificationsState } from './state/NotificationState.js';\nimport { ApiCallResult, Notification } from './models/notification.js';\nimport {\n ConfirmationDialogEventDetail,\n FilterDialogEventDetail,\n} from './constants/notification-types.js';\nimport {\n ApiCallState,\n NotificationGroups,\n NotificationStatus,\n} from './constants/notifications.js';\nimport './components/notifications/notification-item.js';\nimport './components/notifications/grouped-item.js';\nimport './components/notifications/group-filters.js';\nimport './components/notifications/date-filters.js';\nimport './components/notifications/confirmation-dialog.js';\nimport { NotificationsStyle } from './styles/notifications-style.js';\nimport {\n handleMouseOver,\n handleMouseOut,\n} from './components/notifications/notification-tooltip.js';\n\nexport class IxNotifications extends MobxLitElement {\n static styles = [TWStyles, NotificationsStyle];\n\n @query('group-filters') groupFilters!: HTMLElement;\n\n @query('ix-icon-button#group-filter-button') groupFiltersButton!: HTMLElement;\n\n @query('date-filters') dateFilters!: HTMLElement;\n\n @query('ix-icon-button#date-filters-button') dateFiltersButton!: HTMLElement;\n\n @state() private showDrawer = false;\n\n @state() private showGroupedView = false;\n\n @state() private showFilters = false;\n\n @state() private showDateFilters = false;\n\n @state() private showMarkAllReadConfirmation = false;\n\n @property({ type: String }) baseApiUrl = '';\n\n @property({ type: String }) localStorageKey = '';\n\n async firstUpdated() {\n // Construct ApiClient form baseApiUrl and localStorageKey\n NotificationsState.baseApiUrl = this.baseApiUrl;\n NotificationsState.localStorageKey = this.localStorageKey;\n NotificationsState.ConstructApiClient();\n }\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\n 'account-switched',\n NotificationsState.NewApiClient\n );\n window.addEventListener('beforeunload', this.handleOnbeforeunload);\n }\n\n disconnectedCallback() {\n window.removeEventListener(\n 'account-switched',\n NotificationsState.NewApiClient\n );\n window.removeEventListener('beforeunload', this.handleOnbeforeunload);\n super.disconnectedCallback();\n }\n\n // Handle browser refresh event\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n handleOnbeforeunload(event: any) {\n NotificationsState.clearStoredNotificationsData();\n }\n\n toggleDrawer() {\n this.showDrawer = !this.showDrawer;\n if (!this.showDrawer) {\n this.showFilters = false;\n this.showDateFilters = false;\n }\n }\n\n /* eslint-disable-next-line */\n renderUnReadCountText() {\n if (NotificationsState.unreadNotificationCount <= 0) {\n return html`${nothing}`;\n }\n\n let unreadCountText = '';\n if (NotificationsState.unreadNotificationCount > 99) {\n unreadCountText = '99+';\n } else {\n unreadCountText = NotificationsState.unreadNotificationCount.toString();\n }\n\n return html` <div\n class=\"unread rounded-full text-center text-white text-sm absolute icon-position -start-0\"\n >\n ${unreadCountText}\n </div>`;\n }\n\n markAllread() {\n if (NotificationsState.unreadNotificationCount > 0) {\n this.showMarkAllReadConfirmation = true;\n }\n }\n\n private confirmedMarkAllRead(e: CustomEvent<ConfirmationDialogEventDetail>) {\n // Mark All read if Confirmed True\n if (e.detail.returnValue) {\n const filterNotification = this.applyNotificationFilters();\n const unreadItems = filterNotification?.filter(\n item => item.status === NotificationStatus.UNREAD\n );\n\n if (unreadItems.length > 0) {\n let allResultSuccesful = true;\n\n filterNotification?.forEach(item => {\n NotificationsState.setNotificationReadStatus(item.id).then(\n (result: any) => {\n if (allResultSuccesful) allResultSuccesful = result;\n }\n );\n });\n\n const apiResult = {\n State:\n allResultSuccesful === true\n ? ApiCallState.SUCCESS\n : ApiCallState.ERROR,\n Message:\n allResultSuccesful === true\n ? 'Successfully marked all the notificaions as read'\n : 'Error while marking the notifications read, Please try again',\n } as ApiCallResult;\n\n this.showResultMessage(apiResult, unreadItems[0].id);\n\n this.renderUnReadCountText();\n\n this.requestUpdate();\n }\n }\n\n this.showMarkAllReadConfirmation = false;\n }\n\n // eslint-disable-next-line class-methods-use-this\n private showResultMessage(result: ApiCallResult, id: string) {\n window.dispatchEvent(\n new CustomEvent('add-toast', {\n detail: {\n id,\n content: html` <ix-message-toast\n toastId=${id}\n .TMessageToast=${result.State.toLowerCase()}\n forceClose\n >\n ${result.Message}\n </ix-message-toast>`,\n autoClose: 3000,\n durationOut: 3000,\n vertical: 'bottom',\n horizontal: 'center',\n animated: true,\n above: false,\n },\n })\n );\n }\n\n toggleGroupView() {\n this.showGroupedView = !this.showGroupedView;\n }\n\n displayFilters() {\n this.showFilters = !this.showFilters;\n }\n\n /* eslint-disable-next-line */\n applyNotificationFilters() {\n const filteredNotifications = NotificationsState.notifications?.filter(\n (notification: Notification) =>\n (notification.resourceType === NotificationGroups.PLANNED_MAINTENANCE &&\n NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE ===\n true) ||\n (notification.resourceType === NotificationGroups.SERVICE_TICKETS &&\n NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS ===\n true) ||\n (notification.resourceType === NotificationGroups.DCIM_ALERTS &&\n NotificationsState.notificationFilters.SHOW_DCIM_ALERTS === true) ||\n notification.resourceType === NotificationGroups.INCIDENTS\n ); // Always display incidents\n\n // both dates are defined, search within the window\n if (\n NotificationsState.dateFilters.FROM_DATE !== undefined &&\n NotificationsState.dateFilters.TO_DATE !== undefined\n )\n return filteredNotifications.filter(\n notification =>\n differenceInHours(\n new Date(notification.createdAt),\n NotificationsState.dateFilters.FROM_DATE!\n ) >= 0 &&\n differenceInDays(\n new Date(notification.createdAt),\n NotificationsState.dateFilters.TO_DATE!\n ) <= 0\n );\n\n // FROM_DATE is defined, TO_DATE is undefined, return notifications after FROM_DATE\n if (\n NotificationsState.dateFilters.FROM_DATE !== undefined &&\n NotificationsState.dateFilters.TO_DATE === undefined\n )\n return filteredNotifications.filter(\n notification =>\n differenceInHours(\n new Date(notification.createdAt),\n NotificationsState.dateFilters.FROM_DATE!\n ) >= 0\n );\n\n // TO_DATE is defined, FROM_DATE is undefined, return notifications before TO_DATE\n if (\n NotificationsState.dateFilters.FROM_DATE === undefined &&\n NotificationsState.dateFilters.TO_DATE !== undefined\n )\n return filteredNotifications.filter(\n notification =>\n differenceInDays(\n new Date(notification.createdAt),\n NotificationsState.dateFilters.TO_DATE!\n ) <= 0\n );\n\n return filteredNotifications;\n }\n\n displayDateFilters() {\n this.showDateFilters = !this.showDateFilters;\n }\n\n renderGroupedView() {\n const filteredNotifications = this.applyNotificationFilters();\n return html`<div style=\"margin:0px\">\n <grouped-item\n groupTitle=\"Planned Site Maintenance\"\n groupIcon=\"${plannedMaintenance.strings[0]}\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.PLANNED_MAINTENANCE\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=\"Emergency Repairs\"\n groupIcon=\"report\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.INCIDENTS\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=\"Service Ticket Updates\"\n groupIcon=\"sync_saved_locally\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.SERVICE_TICKETS\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.DCIM_ALERTS}\n groupIcon=\"${dcim.strings[0]}\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.DCIM_ALERTS\n )}\n ></grouped-item>\n </div>`;\n }\n\n renderDefaultView() {\n const filterNotification = this.applyNotificationFilters();\n\n const filterTodayItems = filterNotification.filter(\n notification => differenceInDays(notification.createdAt, new Date()) === 0\n );\n\n const filterEarlierItems = filterNotification.filter(\n notification => differenceInDays(notification.createdAt, new Date()) !== 0\n );\n\n if (filterNotification?.length! > 0) {\n return html` <h3 class=\"grow\">Today</h3>\n <div class=\"m-0 p-0\">\n ${filterTodayItems.length > 0\n ? filterTodayItems?.map(\n item => html`<notification-item\n .notification=${item}\n ?disabled=${item.resourceType ===\n NotificationGroups.INCIDENTS}\n >\n </notification-item> `\n )\n : this.renderNoResult()}\n </div>\n <h3 class=\"grow\">Earlier</h3>\n <div>\n ${filterEarlierItems.length > 0\n ? filterEarlierItems?.map(\n item => html`<notification-item\n .notification=${item}\n ?disabled=${item.resourceType ===\n NotificationGroups.INCIDENTS}\n >\n </notification-item> `\n )\n : this.renderNoResult()}\n </div>`;\n }\n\n return html`<p class=\"empty\"><strong>No notifications yet.</strong></p>`;\n }\n\n /* eslint-disable-next-line */\n renderNoResult() {\n return html`<p class=\"empty\"><strong>No notifications yet.</strong></p>`;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n handleCloseClick(_e: CustomEvent<FilterDialogEventDetail>) {\n this.showDateFilters = false;\n this.showFilters = false;\n }\n\n // eslint-disable-next-line\n handleContentScroll(e: CustomEvent) {\n // when scrollbar at the end, retrieve next page\n if (\n e !== null &&\n e.detail.scrollTop + e.detail.clientHeight >= e.detail.scrollHeight\n ) {\n NotificationsState.getNotifications();\n }\n }\n\n manageFilterVisibility(e: Event) {\n const path = e.composedPath();\n if (\n this.showFilters &&\n !path.includes(this.groupFilters) &&\n !path.includes(this.groupFiltersButton)\n ) {\n this.showFilters = false;\n }\n if (\n this.showDateFilters &&\n !path.includes(this.dateFilters) &&\n !path.includes(this.dateFiltersButton)\n ) {\n this.showDateFilters = false;\n }\n }\n\n render() {\n return html`\n <notification-tooltip></notification-tooltip>\n <div class=\"relative\">\n <ix-icon-button class=\"active-icon\" @click=${() => this.toggleDrawer()}>\n <slot name=\"icon\" slot=\"default\"></slot>\n </ix-icon-button>\n ${this.renderUnReadCountText()}\n </div>\n <confirmation-dialog\n ?open=${this.showMarkAllReadConfirmation}\n @confirm-dialog-closed=${() => {\n this.showMarkAllReadConfirmation = false;\n }}\n @on-confirm-selection=${this.confirmedMarkAllRead}\n textMessage=\"Are you sure you want to mark all notifications as read?\"\n >\n </confirmation-dialog>\n <ix-drawer\n ?isVisible=${this.showDrawer}\n .onClosed=${() => this.toggleDrawer()}\n animate-vertical\n hide-close\n @on-content-scroll=${this.handleContentScroll}\n @click=${this.manageFilterVisibility}\n >\n <div class=\"flex flex-row justify-between grow py-2\" slot=\"header\">\n <h2 class=\"grow items-center notification-header\">Notifications</h2>\n <div class=\"flex flex-row justify-end grow items-center options\">\n <ix-icon-button\n @click=${this.markAllread}\n @mouseover=${(e: any) => handleMouseOver(e, 'Mark All Read')}\n @mouseout=${handleMouseOut}\n icon=\"markunread_mailbox\"\n class=\"${NotificationsState.unreadNotificationCount <= 0\n ? 'inactive-icon'\n : 'active-icon'}\"\n .disabled=\"${NotificationsState.unreadNotificationCount <= 0}\"\n filledIcon=\"true\"\n ></ix-icon-button>\n <ix-icon-button\n @click=${this.toggleGroupView}\n @mouseover=${(e: any) => handleMouseOver(e, 'Sort by Type')}\n @mouseout=${handleMouseOut}\n class=\"active-icon\"\n label=\"Sort by Type\"\n >\n <ix-icon slot=\"default\"\n >${this.showGroupedView ? sortCheck : 'sort'}</ix-icon\n >\n </ix-icon-button>\n <ix-icon-button\n @click=${this.displayFilters}\n @mouseover=${(e: any) => handleMouseOver(e, 'Filter by Type')}\n @mouseout=${handleMouseOut}\n class=\"active-icon\"\n id=\"group-filter-button\"\n label=\"Filter by Type\"\n >\n <ix-icon slot=\"default\"> ${viewList} </ix-icon>\n </ix-icon-button>\n <div\n class=\"filter-dropdown-content ${this.showFilters\n ? 'active z-50'\n : ''}\"\n >\n <group-filters></group-filters>\n </div>\n <ix-icon-button\n @click=${this.displayDateFilters}\n @mouseover=${(e: any) => handleMouseOver(e, 'Filter by Date')}\n @mouseout=${handleMouseOut}\n icon=\"date_range\"\n class=\"active-icon\"\n filledIcon=\"true\"\n id=\"date-filters-button\"\n label=\"Filter by Date\"\n ></ix-icon-button>\n <div\n class=\"datefilter-dropdown-content ${this.showDateFilters\n ? 'active z-50'\n : ''}\"\n @on-selection=${this.handleCloseClick}\n >\n <date-filters></date-filters>\n </div>\n </div>\n </div>\n <div slot=\"content\">\n ${this.showGroupedView\n ? this.renderGroupedView()\n : this.renderDefaultView()}\n </div>\n </ix-drawer>\n `;\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ export declare const viewList: import("lit").TemplateResult<2>;
2
+ export declare const dcim: import("lit").TemplateResult<2>;
3
+ export declare const plannedMaintenance: import("lit").TemplateResult<2>;
4
+ export declare const trash: import("lit").TemplateResult<2>;
5
+ export declare const crossConnect: import("lit").TemplateResult<2>;
6
+ export declare const sortCheck: import("lit").TemplateResult<2>;
@@ -0,0 +1,8 @@
1
+ import { svg } from 'lit';
2
+ export const viewList = svg `<svg viewBox="0 0 24 24"><path d="M3 9H7V5H3V9ZM7 14H3V10H7V14ZM7 19H3V15H7V19ZM20 14H8V10H20V14ZM8 19H20V15H8V19ZM8 9V5H20V9H8Z"/></svg>`;
3
+ export const dcim = svg `<svg viewBox="0 0 24 24"><path d="M20 0C17.791 0 16 1.791 16 4C16 6.857 20 11 20 11C20 11 24 6.857 24 4C24 1.791 22.209 0 20 0ZM12 2C6.486 2 2 6.486 2 12C2 17.514 6.486 22 12 22C17.514 22 22 17.514 22 12C22 11.93 21.9912 11.862 21.9902 11.793C21.7532 12.059 21.5575 12.2677 21.4395 12.3887L19.6504 14.3047C19.4484 14.9657 19.1695 15.5919 18.8145 16.1699C18.4985 15.4819 17.806 15 17 15H16V13C16 12.447 15.552 12 15 12H9V10H10C10.552 10 11 9.553 11 9V7.02344L13.0156 7.00781C13.5986 7.00381 14.1175 6.74289 14.4805 6.33789C14.3145 5.89389 14.1875 5.445 14.1035 5L9.99219 5.03125C9.44319 5.03525 9 5.48225 9 6.03125V8H8C7.448 8 7 8.447 7 9V10.1855L4.98047 8.16797C6.34047 5.68697 8.977 4 12 4H14C14 3.397 14.0908 2.81658 14.2578 2.26758C13.5308 2.09858 12.777 2 12 2ZM20 2.57031C20.789 2.57031 21.4297 3.211 21.4297 4C21.4297 4.789 20.789 5.42969 20 5.42969C19.211 5.42969 18.5703 4.789 18.5703 4C18.5703 3.211 19.211 2.57031 20 2.57031ZM4.20703 10.2207L9 15.0137V16C9 17.103 9.897 18 11 18V19.9316C7.06 19.4366 4 16.072 4 12C4 11.388 4.07603 10.7947 4.20703 10.2207ZM10.7793 14H14V16C14 16.553 14.448 17 15 17H17V18.2344C15.875 19.1384 14.502 19.7417 13 19.9297V17C13 16.447 12.552 16 12 16H11V14.5996C11 14.3776 10.9123 14.174 10.7793 14Z"/></svg>`;
4
+ export const plannedMaintenance = svg `<svg viewBox="0 0 24 24"><path d="M6 2C4.90575 2 4 2.90575 4 4V20C4 21.0943 4.90575 22 6 22H11V20H6V4H13V9H18V13H20V8L14 2H6ZM12 11V14H15C15 12.343 13.641 11.031 12 11ZM11 12C9.343 12 8 13.343 8 15C8 16.657 9.343 18 11 18C12.657 18 13.969 16.641 14 15H11V12ZM16 15V21H13C13 22.654 14.346 24 16 24H21C22.645 24 24 22.645 24 21V15H16ZM18 17H22V21C22 21.565 21.565 22 21 22C20.449 22 20 21.552 20 21H18V17Z"/></svg>`;
5
+ export const trash = svg `<svg viewBox="0 0 24 24"><path d="M15.5 4H19V6H5V4H8.5L9.5 3H14.5L15.5 4ZM8 21C6.9 21 6 20.1 6 19V7H18V19C18 20.1 17.1 21 16 21H8Z" /></svg>`;
6
+ export const crossConnect = svg `<svg viewBox="0 0 24 24"><path d="M11 12C13.21 12 15 10.21 15 8C15 5.79 13.21 4 11 4C8.79 4 7 5.79 7 8C7 10.21 8.79 12 11 12ZM9 17L12 14.06C11.61 14.02 11.32 14 11 14C8.33 14 3 15.34 3 18V20H12L9 17ZM12 17L15.47 20.5L22 13.91L20.6 12.5L15.47 17.67L13.4 15.59L12 17Z"/></svg>`;
7
+ export const sortCheck = svg `<svg viewbox="0 0 24 24"><path d="M 3,6 V 8 H 21 V 6 Z M 3,18 H 9 V 16 H 3 Z M 15,13 H 3 v -2 h 12 z" /><rect x="8" y="0.5" width="16" height="16" rx="8" /><path d="M 14.5,10.585 12.415,8.50001 11.705,9.20501 14.5,12 l 6,-5.99999 -0.705,-0.705 z" style="fill:#ffffff" /></svg>`;
8
+ //# sourceMappingURL=iconset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iconset.js","sourceRoot":"","sources":["../../src/assets/iconset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAA,2IAA2I,CAAC;AAEvK,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAA,iuCAAiuC,CAAC;AAEzvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAA,8ZAA8Z,CAAC;AAEpc,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,8IAA8I,CAAC;AAEvK,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA,oRAAoR,CAAC;AAEpT,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA,sRAAsR,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport const viewList = svg`<svg viewBox=\"0 0 24 24\"><path d=\"M3 9H7V5H3V9ZM7 14H3V10H7V14ZM7 19H3V15H7V19ZM20 14H8V10H20V14ZM8 19H20V15H8V19ZM8 9V5H20V9H8Z\"/></svg>`;\n\nexport const dcim = svg`<svg viewBox=\"0 0 24 24\"><path d=\"M20 0C17.791 0 16 1.791 16 4C16 6.857 20 11 20 11C20 11 24 6.857 24 4C24 1.791 22.209 0 20 0ZM12 2C6.486 2 2 6.486 2 12C2 17.514 6.486 22 12 22C17.514 22 22 17.514 22 12C22 11.93 21.9912 11.862 21.9902 11.793C21.7532 12.059 21.5575 12.2677 21.4395 12.3887L19.6504 14.3047C19.4484 14.9657 19.1695 15.5919 18.8145 16.1699C18.4985 15.4819 17.806 15 17 15H16V13C16 12.447 15.552 12 15 12H9V10H10C10.552 10 11 9.553 11 9V7.02344L13.0156 7.00781C13.5986 7.00381 14.1175 6.74289 14.4805 6.33789C14.3145 5.89389 14.1875 5.445 14.1035 5L9.99219 5.03125C9.44319 5.03525 9 5.48225 9 6.03125V8H8C7.448 8 7 8.447 7 9V10.1855L4.98047 8.16797C6.34047 5.68697 8.977 4 12 4H14C14 3.397 14.0908 2.81658 14.2578 2.26758C13.5308 2.09858 12.777 2 12 2ZM20 2.57031C20.789 2.57031 21.4297 3.211 21.4297 4C21.4297 4.789 20.789 5.42969 20 5.42969C19.211 5.42969 18.5703 4.789 18.5703 4C18.5703 3.211 19.211 2.57031 20 2.57031ZM4.20703 10.2207L9 15.0137V16C9 17.103 9.897 18 11 18V19.9316C7.06 19.4366 4 16.072 4 12C4 11.388 4.07603 10.7947 4.20703 10.2207ZM10.7793 14H14V16C14 16.553 14.448 17 15 17H17V18.2344C15.875 19.1384 14.502 19.7417 13 19.9297V17C13 16.447 12.552 16 12 16H11V14.5996C11 14.3776 10.9123 14.174 10.7793 14Z\"/></svg>`;\n\nexport const plannedMaintenance = svg`<svg viewBox=\"0 0 24 24\"><path d=\"M6 2C4.90575 2 4 2.90575 4 4V20C4 21.0943 4.90575 22 6 22H11V20H6V4H13V9H18V13H20V8L14 2H6ZM12 11V14H15C15 12.343 13.641 11.031 12 11ZM11 12C9.343 12 8 13.343 8 15C8 16.657 9.343 18 11 18C12.657 18 13.969 16.641 14 15H11V12ZM16 15V21H13C13 22.654 14.346 24 16 24H21C22.645 24 24 22.645 24 21V15H16ZM18 17H22V21C22 21.565 21.565 22 21 22C20.449 22 20 21.552 20 21H18V17Z\"/></svg>`;\n\nexport const trash = svg`<svg viewBox=\"0 0 24 24\"><path d=\"M15.5 4H19V6H5V4H8.5L9.5 3H14.5L15.5 4ZM8 21C6.9 21 6 20.1 6 19V7H18V19C18 20.1 17.1 21 16 21H8Z\" /></svg>`;\n\nexport const crossConnect = svg`<svg viewBox=\"0 0 24 24\"><path d=\"M11 12C13.21 12 15 10.21 15 8C15 5.79 13.21 4 11 4C8.79 4 7 5.79 7 8C7 10.21 8.79 12 11 12ZM9 17L12 14.06C11.61 14.02 11.32 14 11 14C8.33 14 3 15.34 3 18V20H12L9 17ZM12 17L15.47 20.5L22 13.91L20.6 12.5L15.47 17.67L13.4 15.59L12 17Z\"/></svg>`;\n\nexport const sortCheck = svg`<svg viewbox=\"0 0 24 24\"><path d=\"M 3,6 V 8 H 21 V 6 Z M 3,18 H 9 V 16 H 3 Z M 15,13 H 3 v -2 h 12 z\" /><rect x=\"8\" y=\"0.5\" width=\"16\" height=\"16\" rx=\"8\" /><path d=\"M 14.5,10.585 12.415,8.50001 11.705,9.20501 14.5,12 l 6,-5.99999 -0.705,-0.705 z\" style=\"fill:#ffffff\" /></svg>`;\n"]}
@@ -17,10 +17,12 @@ import { isNullOrUndefinedOrEmpty } from '../../helper/common.js';
17
17
  let DateFilters = class DateFilters extends MobxLitElement {
18
18
  constructor() {
19
19
  super(...arguments);
20
- this.fromDate = !isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.FROM_DATE) ?
21
- format(NotificationsState.dateFilters.FROM_DATE, DefaultDateFormat) : undefined;
22
- this.toDate = !isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.TO_DATE) ?
23
- format(NotificationsState.dateFilters.TO_DATE, DefaultDateFormat) : undefined;
20
+ this.fromDate = !isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.FROM_DATE)
21
+ ? format(NotificationsState.dateFilters.FROM_DATE, DefaultDateFormat)
22
+ : undefined;
23
+ this.toDate = !isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.TO_DATE)
24
+ ? format(NotificationsState.dateFilters.TO_DATE, DefaultDateFormat)
25
+ : undefined;
24
26
  this.maxDate = format(new Date(), DefaultDateFormat);
25
27
  this.fromDateErrorText = '';
26
28
  this.toDateErrorText = '';
@@ -29,23 +31,23 @@ let DateFilters = class DateFilters extends MobxLitElement {
29
31
  return [NotificationsStyle, baseTheme, elementTheme, TWStyles];
30
32
  }
31
33
  onFromDateChange(fromDate) {
32
- //handling of clear date event of calender
33
- if (fromDate === null || fromDate === "")
34
+ // handling of clear date event of calendar
35
+ if (fromDate === null || fromDate === '')
34
36
  this.fromDate = undefined;
35
37
  else {
36
38
  this.fromDate = fromDate;
37
- //clear error message
39
+ // clear error message
38
40
  if (this.fromDate !== undefined)
39
41
  this.fromDateErrorText = undefined;
40
42
  }
41
43
  }
42
44
  onToDateChange(toDate) {
43
- //handling of clear date event of calender
44
- if (toDate === null || toDate === "")
45
+ // handling of clear date event of calendar
46
+ if (toDate === null || toDate === '')
45
47
  this.toDate = undefined;
46
48
  else {
47
49
  this.toDate = toDate;
48
- //clear error message
50
+ // clear error message
49
51
  if (this.toDate !== undefined)
50
52
  this.toDateErrorText = undefined;
51
53
  }
@@ -53,11 +55,11 @@ let DateFilters = class DateFilters extends MobxLitElement {
53
55
  onApplyDateFilter(selectedvalue) {
54
56
  if (selectedvalue) {
55
57
  if (this.toDate === undefined && this.fromDate !== undefined) {
56
- this.toDateErrorText = "Please select to date";
58
+ this.toDateErrorText = 'Please select to date';
57
59
  return;
58
60
  }
59
61
  if (this.fromDate === undefined && this.toDate !== undefined) {
60
- this.fromDateErrorText = "Please select from date";
62
+ this.fromDateErrorText = 'Please select from date';
61
63
  return;
62
64
  }
63
65
  if (this.fromDate > this.toDate) {
@@ -65,19 +67,17 @@ let DateFilters = class DateFilters extends MobxLitElement {
65
67
  this.fromDate = undefined;
66
68
  return;
67
69
  }
68
- else {
69
- this.fromDateErrorText = undefined;
70
- }
70
+ this.fromDateErrorText = undefined;
71
71
  if (this.toDate < this.fromDate) {
72
72
  this.toDateErrorText = 'To date cannot be earlier than From date.';
73
73
  this.toDate = undefined;
74
74
  return;
75
75
  }
76
- else {
77
- this.toDateErrorText = undefined;
78
- }
76
+ this.toDateErrorText = undefined;
79
77
  }
80
- const datesChanged = selectedvalue && this.toDateErrorText === undefined && this.fromDateErrorText === undefined;
78
+ const datesChanged = selectedvalue &&
79
+ this.toDateErrorText === undefined &&
80
+ this.fromDateErrorText === undefined;
81
81
  if (datesChanged) {
82
82
  NotificationsState.setNotificationDateFilter(this.fromDate, this.toDate);
83
83
  this.requestUpdate();
@@ -112,7 +112,7 @@ let DateFilters = class DateFilters extends MobxLitElement {
112
112
  <ix-icon-button
113
113
  appearance="default"
114
114
  icon="domain_verification_off"
115
- class="blue-icon"
115
+ class="active-icon"
116
116
  ></ix-icon-button>
117
117
  </div>
118
118
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"date-filters.js","sourceRoot":"","sources":["../../../src/components/notifications/date-filters.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,0CAA0C,CAAC;AAClD,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,cAAc;IAAxC;;QAKY,aAAQ,GAAI,CAAC,wBAAwB,CAAC,kBAAkB,CA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H,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IACnC,CAAC;IAED,0DAA0D;IAC1D,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;mBAOI,IAAI,CAAC,gBAAgB;;;;;;;;;;;;;;;;;;qBAkBnB,IAAI,CAAC,QAAQ;kBAChB,IAAI,CAAC,OAAO;;;yBAGL,IAAI,CAAC,iBAAiB;yBACtB,CAAC,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;;;;;;qBAMxC,IAAI,CAAC,MAAM;kBACd,IAAI,CAAC,OAAO;;;yBAGL,IAAI,CAAC,eAAe;yBACpB,CAAC,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;;;;;;;;;oBASvC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;;;;;;;oBAOnC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;;;;WAI3C,CAAC;IACV,CAAC;CACF,CAAA;AA7JU;IAAR,KAAK,EAAE;6CAC0E;AAEzE;IAAR,KAAK,EAAE;2CACwE;AAEvE;IAAR,KAAK,EAAE;4CAAyD;AAExD;IAAR,KAAK,EAAE;sDAAiC;AAEhC;IAAR,KAAK,EAAE;oDAA+B;AAf5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAkKvB;SAlKY,WAAW","sourcesContent":["import { html } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement, state } from 'lit/decorators.js';\nimport { baseTheme, elementTheme } from '@digital-realty/theme';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-date/ix-date.js';\nimport '@digital-realty/ix-divider/ix-divider.js';\nimport '@digital-realty/ix-icon';\nimport '@material/web/icon/icon.js';\nimport { format } from 'date-fns';\nimport { TWStyles } from '../../tw.js';\nimport { NotificationsState } from '../../state/NotificationState.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\nimport { DefaultDateFormat } from '../../constants/notifications.js';\nimport { FilterDialogEventDetail } from '../../constants/notification-types.js';\nimport { isNullOrUndefinedOrEmpty } from '../../helper/common.js';\n\n@customElement('date-filters')\nexport class DateFilters extends MobxLitElement {\n static get styles() {\n return [NotificationsStyle, baseTheme, elementTheme, TWStyles];\n }\n\n @state() private fromDate? = !isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.FROM_DATE) ?\n format(NotificationsState.dateFilters.FROM_DATE!, DefaultDateFormat) :undefined;\n\n @state() private toDate? = !isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.TO_DATE) ?\n format(NotificationsState.dateFilters.TO_DATE!, DefaultDateFormat) :undefined;\n\n @state() private maxDate = format(new Date(), DefaultDateFormat);\n\n @state() private fromDateErrorText? = '';\n\n @state() private toDateErrorText? = '';\n\n onFromDateChange(fromDate: string) {\n \n //handling of clear date event of calender\n if(fromDate === null || fromDate === \"\")\n this.fromDate = undefined;\n else\n {\n this.fromDate = fromDate; \n //clear error message \n if(this.fromDate !== undefined)\n this.fromDateErrorText = undefined;\n }\n \n }\n\n onToDateChange(toDate: string) {\n \n //handling of clear date event of calender\n if(toDate === null || toDate === \"\")\n this.toDate = undefined;\n else\n {\n this.toDate = toDate;\n //clear error message \n if(this.toDate !== undefined)\n this.toDateErrorText = undefined;\n }\n }\n\n onApplyDateFilter(selectedvalue: Boolean) { \n if(selectedvalue)\n {\n if (this.toDate === undefined && this.fromDate !== undefined) {\n this.toDateErrorText = \"Please select to date\";\n return;\n }\n\n if (this.fromDate === undefined && this.toDate !== undefined) {\n this.fromDateErrorText = \"Please select from date\";\n return;\n }\n\n if (this.fromDate! > this.toDate!) {\n this.fromDateErrorText = 'From date cannot be later than To date.';\n this.fromDate = undefined;\n return;\n } else {\n this.fromDateErrorText = undefined;\n }\n \n if (this.toDate! < this.fromDate!) {\n this.toDateErrorText = 'To date cannot be earlier than From date.';\n this.toDate = undefined;\n return;\n } else {\n this.toDateErrorText = undefined;\n }\n }\n\n const datesChanged = selectedvalue && this.toDateErrorText === undefined && this.fromDateErrorText === undefined; \n if (datesChanged) {\n NotificationsState.setNotificationDateFilter(this.fromDate, this.toDate);\n this.requestUpdate();\n }\n\n const event = new CustomEvent<FilterDialogEventDetail>('on-selection', {\n detail: { returnValue: datesChanged },\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(event);\n }\n\n clearDateFilters() {\n this.fromDate = undefined;\n this.toDate = undefined;\n this.fromDateErrorText = undefined;\n this.toDateErrorText = undefined;\n }\n\n /* eslint-disable lit-a11y/click-events-have-key-events */\n render() {\n return html` <div class=\"flex flex-col p-2\">\n <div class=\"flex flex-row text-justify\">\n <div class=\"grow items-center text-xl font-bold text-left p-2\">\n Filter by Date\n </div>\n <div\n class=\"flex flex-row items-center p-2\"\n @click=${this.clearDateFilters}\n >\n <label class=\"grow text-sm text-right pr-1 cursor-pointer\"\n >Clear Filter</label\n >\n <ix-icon-button\n appearance=\"default\"\n icon=\"domain_verification_off\"\n class=\"blue-icon\"\n ></ix-icon-button>\n </div>\n </div>\n <ix-divider class=\"px-2\"></ix-divider>\n <div\n class=\"flex xl:flex-row lg:flex-col md:flex-col sm:flex-col justify-between item-center p-2\"\n >\n <div class=\"p-2\">\n <ix-date\n .value=${this.fromDate}\n max=${this.maxDate}\n label=\"From\"\n name=\"FromDate\"\n .errorText=${this.fromDateErrorText}\n .onChanged=${(e: any) => this.onFromDateChange(e)}\n >\n </ix-date>\n </div>\n <div class=\"p-2\">\n <ix-date\n .value=${this.toDate}\n max=${this.maxDate}\n label=\"To\"\n name=\"ToDate\"\n .errorText=${this.toDateErrorText}\n .onChanged=${(e: any) => this.onToDateChange(e)}\n ></ix-date>\n </div>\n </div>\n <div class=\"flex flex-row justify-between p-2\">\n <ix-button\n type=\"\"\n target=\"\"\n appearance=\"text\"\n @click=\"${() => this.onApplyDateFilter(false)}\"\n >Cancel</ix-button\n >\n <ix-button\n type=\"\"\n target=\"\"\n appearance=\"text\"\n @click=\"${() => this.onApplyDateFilter(true)}\"\n >Filter List</ix-button\n >\n </div>\n </div>`;\n }\n}\n"]}
1
+ {"version":3,"file":"date-filters.js","sourceRoot":"","sources":["../../../src/components/notifications/date-filters.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,0CAA0C,CAAC;AAClD,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,cAAc;IAAxC;;QAKY,aAAQ,GAAI,CAAC,wBAAwB,CACpD,kBAAkB,CAAC,WAAW,CAAC,SAAS,CACzC;YACC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAA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SAAS,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IACnC,CAAC;IAED,0DAA0D;IAC1D,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;mBAOI,IAAI,CAAC,gBAAgB;;;;;;;;;;;;;;;;;;qBAkBnB,IAAI,CAAC,QAAQ;kBAChB,IAAI,CAAC,OAAO;;;yBAGL,IAAI,CAAC,iBAAiB;yBACtB,CAAC,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;;;;;;qBAMxC,IAAI,CAAC,MAAM;kBACd,IAAI,CAAC,OAAO;;;yBAGL,IAAI,CAAC,eAAe;yBACpB,CAAC,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;;;;;;;;;oBASvC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;;;;;;;oBAOnC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;;;;WAI3C,CAAC;IACV,CAAC;CACF,CAAA;AA9JU;IAAR,KAAK,EAAE;6CAIM;AAEL;IAAR,KAAK,EAAE;2CAIM;AAEL;IAAR,KAAK,EAAE;4CAAyD;AAExD;IAAR,KAAK,EAAE;sDAAiC;AAEhC;IAAR,KAAK,EAAE;oDAA+B;AArB5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAmKvB;SAnKY,WAAW","sourcesContent":["import { html } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement, state } from 'lit/decorators.js';\nimport { baseTheme, elementTheme } from '@digital-realty/theme';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-date/ix-date.js';\nimport '@digital-realty/ix-divider/ix-divider.js';\nimport '@digital-realty/ix-icon';\nimport '@material/web/icon/icon.js';\nimport { format } from 'date-fns';\nimport { TWStyles } from '../../tw.js';\nimport { NotificationsState } from '../../state/NotificationState.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\nimport { DefaultDateFormat } from '../../constants/notifications.js';\nimport { FilterDialogEventDetail } from '../../constants/notification-types.js';\nimport { isNullOrUndefinedOrEmpty } from '../../helper/common.js';\n\n@customElement('date-filters')\nexport class DateFilters extends MobxLitElement {\n static get styles() {\n return [NotificationsStyle, baseTheme, elementTheme, TWStyles];\n }\n\n @state() private fromDate? = !isNullOrUndefinedOrEmpty(\n NotificationsState.dateFilters.FROM_DATE\n )\n ? format(NotificationsState.dateFilters.FROM_DATE!, DefaultDateFormat)\n : undefined;\n\n @state() private toDate? = !isNullOrUndefinedOrEmpty(\n NotificationsState.dateFilters.TO_DATE\n )\n ? format(NotificationsState.dateFilters.TO_DATE!, DefaultDateFormat)\n : undefined;\n\n @state() private maxDate = format(new Date(), DefaultDateFormat);\n\n @state() private fromDateErrorText? = '';\n\n @state() private toDateErrorText? = '';\n\n onFromDateChange(fromDate: string) {\n // handling of clear date event of calendar\n if (fromDate === null || fromDate === '') this.fromDate = undefined;\n else {\n this.fromDate = fromDate;\n // clear error message\n if (this.fromDate !== undefined) this.fromDateErrorText = undefined;\n }\n }\n\n onToDateChange(toDate: string) {\n // handling of clear date event of calendar\n if (toDate === null || toDate === '') this.toDate = undefined;\n else {\n this.toDate = toDate;\n // clear error message\n if (this.toDate !== undefined) this.toDateErrorText = undefined;\n }\n }\n\n onApplyDateFilter(selectedvalue: Boolean) {\n if (selectedvalue) {\n if (this.toDate === undefined && this.fromDate !== undefined) {\n this.toDateErrorText = 'Please select to date';\n return;\n }\n\n if (this.fromDate === undefined && this.toDate !== undefined) {\n this.fromDateErrorText = 'Please select from date';\n return;\n }\n\n if (this.fromDate! > this.toDate!) {\n this.fromDateErrorText = 'From date cannot be later than To date.';\n this.fromDate = undefined;\n return;\n }\n\n this.fromDateErrorText = undefined;\n\n if (this.toDate! < this.fromDate!) {\n this.toDateErrorText = 'To date cannot be earlier than From date.';\n this.toDate = undefined;\n return;\n }\n\n this.toDateErrorText = undefined;\n }\n\n const datesChanged =\n selectedvalue &&\n this.toDateErrorText === undefined &&\n this.fromDateErrorText === undefined;\n\n if (datesChanged) {\n NotificationsState.setNotificationDateFilter(this.fromDate, this.toDate);\n this.requestUpdate();\n }\n\n const event = new CustomEvent<FilterDialogEventDetail>('on-selection', {\n detail: { returnValue: datesChanged },\n bubbles: true,\n composed: true,\n });\n\n this.dispatchEvent(event);\n }\n\n clearDateFilters() {\n this.fromDate = undefined;\n this.toDate = undefined;\n this.fromDateErrorText = undefined;\n this.toDateErrorText = undefined;\n }\n\n /* eslint-disable lit-a11y/click-events-have-key-events */\n render() {\n return html` <div class=\"flex flex-col p-2\">\n <div class=\"flex flex-row text-justify\">\n <div class=\"grow items-center text-xl font-bold text-left p-2\">\n Filter by Date\n </div>\n <div\n class=\"flex flex-row items-center p-2\"\n @click=${this.clearDateFilters}\n >\n <label class=\"grow text-sm text-right pr-1 cursor-pointer\"\n >Clear Filter</label\n >\n <ix-icon-button\n appearance=\"default\"\n icon=\"domain_verification_off\"\n class=\"active-icon\"\n ></ix-icon-button>\n </div>\n </div>\n <ix-divider class=\"px-2\"></ix-divider>\n <div\n class=\"flex xl:flex-row lg:flex-col md:flex-col sm:flex-col justify-between item-center p-2\"\n >\n <div class=\"p-2\">\n <ix-date\n .value=${this.fromDate}\n max=${this.maxDate}\n label=\"From\"\n name=\"FromDate\"\n .errorText=${this.fromDateErrorText}\n .onChanged=${(e: any) => this.onFromDateChange(e)}\n >\n </ix-date>\n </div>\n <div class=\"p-2\">\n <ix-date\n .value=${this.toDate}\n max=${this.maxDate}\n label=\"To\"\n name=\"ToDate\"\n .errorText=${this.toDateErrorText}\n .onChanged=${(e: any) => this.onToDateChange(e)}\n ></ix-date>\n </div>\n </div>\n <div class=\"flex flex-row justify-between p-2\">\n <ix-button\n type=\"\"\n target=\"\"\n appearance=\"text\"\n @click=\"${() => this.onApplyDateFilter(false)}\"\n >Cancel</ix-button\n >\n <ix-button\n type=\"\"\n target=\"\"\n appearance=\"text\"\n @click=\"${() => this.onApplyDateFilter(true)}\"\n >Filter List</ix-button\n >\n </div>\n </div>`;\n }\n}\n"]}