empower-container 0.1.2 → 0.1.5

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 (106) hide show
  1. package/README.md +240 -236
  2. package/package.json +5 -2
  3. package/src/main/DatetimeFormatter.js +24 -21
  4. package/src/main/DatetimeFormatter.tsx +7 -4
  5. package/src/main/Information.js +13 -15
  6. package/src/main/Information.tsx +40 -36
  7. package/src/main/MenuBar.d.ts +0 -1
  8. package/src/main/MenuBar.js +26 -22
  9. package/src/main/MenuBar.tsx +41 -37
  10. package/src/main/Modal.d.ts +1 -0
  11. package/src/main/Modal.js +5 -5
  12. package/src/main/Modal.tsx +7 -10
  13. package/src/main/assets/Asset.d.ts +1 -0
  14. package/src/main/assets/Asset.js +5 -1
  15. package/src/main/assets/Asset.tsx +9 -0
  16. package/src/main/inputs/Input.d.ts +0 -1
  17. package/src/main/inputs/Input.js +0 -1
  18. package/src/main/inputs/Input.tsx +0 -1
  19. package/src/main/inputs/Select.d.ts +0 -1
  20. package/src/main/inputs/Select.js +3 -3
  21. package/src/main/inputs/Select.tsx +3 -3
  22. package/src/main/tsconfig.common.json +2 -1
  23. package/src/main/tsconfig.json +1 -0
  24. package/src/sample/App.d.ts +0 -1
  25. package/src/sample/App.js +1 -1
  26. package/src/sample/App.tsx +2 -1
  27. package/src/sample/TestMenuBar.js +24 -4
  28. package/src/sample/TestMenuBar.tsx +40 -10
  29. package/src/scss/components/_modal.scss +41 -30
  30. package/src/scss/elements/_button.scss +1 -3
  31. package/src/scss/elements/_popover.scss +6 -38
  32. package/src/scss/foundation/_mixins.scss +0 -2
  33. package/src/scss/foundation/_typography.scss +0 -4
  34. package/src/scss/library/_information.scss +68 -0
  35. package/{dist/scss/library/input.scss → src/scss/library/_input.scss} +0 -2
  36. package/{dist/scss/library/menubar.scss → src/scss/library/_menubar.scss} +0 -2
  37. package/{dist/scss/library/select.scss → src/scss/library/_select.scss} +0 -4
  38. package/src/scss/style.scss +21 -5
  39. package/dist/assets/Asset.d.ts +0 -14
  40. package/dist/assets/Asset.js +0 -43
  41. package/dist/assets/Asset.tsx +0 -66
  42. package/dist/assets/icons/icon-check-white-sm.svg +0 -3
  43. package/dist/assets/images/icon-arrowdown-graydark.svg +0 -3
  44. package/dist/assets/images/icon-arrowleft-graydark.svg +0 -3
  45. package/dist/assets/images/icon-arrowright-graydark.svg +0 -3
  46. package/dist/assets/images/icon-arrowup-graydark.svg +0 -3
  47. package/dist/assets/images/icon-check-graydark.svg +0 -3
  48. package/dist/cjs/DatetimeFormatter.d.ts +0 -3
  49. package/dist/cjs/DatetimeFormatter.js +0 -386
  50. package/dist/cjs/Information.d.ts +0 -10
  51. package/dist/cjs/Information.js +0 -64
  52. package/dist/cjs/MenuBar.d.ts +0 -25
  53. package/dist/cjs/MenuBar.js +0 -534
  54. package/dist/cjs/Modal.d.ts +0 -32
  55. package/dist/cjs/Modal.js +0 -32
  56. package/dist/cjs/assets/Asset.d.ts +0 -14
  57. package/dist/cjs/assets/Asset.js +0 -28
  58. package/dist/cjs/constants/Constant.d.ts +0 -15
  59. package/dist/cjs/constants/Constant.js +0 -35
  60. package/dist/cjs/index.d.ts +0 -3
  61. package/dist/cjs/index.js +0 -10
  62. package/dist/cjs/inputs/Input.d.ts +0 -26
  63. package/dist/cjs/inputs/Input.js +0 -107
  64. package/dist/cjs/inputs/InputSelectionHandler.d.ts +0 -3
  65. package/dist/cjs/inputs/InputSelectionHandler.js +0 -36
  66. package/dist/cjs/inputs/Select.d.ts +0 -29
  67. package/dist/cjs/inputs/Select.js +0 -403
  68. package/dist/esm/DatetimeFormatter.d.ts +0 -3
  69. package/dist/esm/DatetimeFormatter.js +0 -382
  70. package/dist/esm/Information.d.ts +0 -10
  71. package/dist/esm/Information.js +0 -36
  72. package/dist/esm/MenuBar.d.ts +0 -25
  73. package/dist/esm/MenuBar.js +0 -529
  74. package/dist/esm/Modal.d.ts +0 -32
  75. package/dist/esm/Modal.js +0 -27
  76. package/dist/esm/assets/Asset.d.ts +0 -14
  77. package/dist/esm/assets/Asset.js +0 -25
  78. package/dist/esm/constants/Constant.d.ts +0 -15
  79. package/dist/esm/constants/Constant.js +0 -32
  80. package/dist/esm/index.d.ts +0 -3
  81. package/dist/esm/index.js +0 -3
  82. package/dist/esm/inputs/Input.d.ts +0 -26
  83. package/dist/esm/inputs/Input.js +0 -105
  84. package/dist/esm/inputs/InputSelectionHandler.d.ts +0 -3
  85. package/dist/esm/inputs/InputSelectionHandler.js +0 -31
  86. package/dist/esm/inputs/Select.d.ts +0 -29
  87. package/dist/esm/inputs/Select.js +0 -399
  88. package/dist/scss/components/_index.scss +0 -1
  89. package/dist/scss/components/_modal.scss +0 -55
  90. package/dist/scss/elements/_button.scss +0 -109
  91. package/dist/scss/elements/_index.scss +0 -2
  92. package/dist/scss/elements/_popover.scss +0 -40
  93. package/dist/scss/foundation/_colors.scss +0 -60
  94. package/dist/scss/foundation/_index.scss +0 -5
  95. package/dist/scss/foundation/_mixins.scss +0 -43
  96. package/dist/scss/foundation/_normalize.scss +0 -204
  97. package/dist/scss/foundation/_settings.scss +0 -36
  98. package/dist/scss/foundation/_typography.scss +0 -99
  99. package/dist/scss/library/_index.scss +0 -3
  100. package/dist/scss/style.scss +0 -8
  101. package/src/scss/components/_index.scss +0 -1
  102. package/src/scss/foundation/_index.scss +0 -5
  103. package/src/scss/library/_index.scss +0 -3
  104. package/src/scss/library/input.scss +0 -39
  105. package/src/scss/library/menubar.scss +0 -227
  106. package/src/scss/library/select.scss +0 -262
@@ -1,529 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
- if (ar || !(i in from)) {
15
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
- ar[i] = from[i];
17
- }
18
- }
19
- return to.concat(ar || Array.prototype.slice.call(from));
20
- };
21
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
- /* eslint-disable no-useless-concat */
23
- /* eslint-disable jsx-a11y/anchor-is-valid */
24
- import { useState, Fragment, useEffect } from "react";
25
- import '../scss/style.scss';
26
- import '../scss/library/menubar.scss';
27
- // Imports
28
- import { SVG_BACK, SVG_CLOSE_GRAY, SVG_ARROWLEFT, SVG_ARROWRIGHT, SVG_CHECK, SVG_ARROWDOWN } from './assets/Asset';
29
- import { CHECKBOX, MONTH_LIST, INFO_LOADER, PAGE_OPTION } from "./constants/Constant";
30
- import Information from './Information';
31
- import Input from './inputs/InputSelectionHandler';
32
- import datetimeFormatter from './DatetimeFormatter';
33
- import { Popover } from './inputs/Select';
34
- // Package
35
- import { Calendar } from 'react-date-range';
36
- var MenuBar = function (_a) {
37
- var config = _a.config, info = _a.info, button = _a.button, getActions = _a.getActions, dropdown = _a.dropdown, search = _a.search, pagination = _a.pagination, pivot = _a.pivot, check = _a.check, toggle = _a.toggle, mainButton = _a.mainButton, buttonFooter = _a.buttonFooter, undoButton = _a.undoButton, customClass = _a.customClass, children = _a.children;
38
- // React Hooks Popover
39
- var _b = useState(null), infoPopover = _b[0], setInfoPopover = _b[1];
40
- var _c = useState(null), mainButtonPopover = _c[0], setMainButtonPopover = _c[1];
41
- var _d = useState(null), dropdownPopover = _d[0], setDropdownPopover = _d[1];
42
- var _e = useState(null), paginationSummaryPopover = _e[0], setPaginationSummaryPopover = _e[1];
43
- var _f = useState(null), pivotPopover = _f[0], setPivotPopover = _f[1];
44
- var _g = useState(null), filterPopover = _g[0], setFilterPopover = _g[1];
45
- var _h = useState(""), calendarYear = _h[0], setCalendarYear = _h[1];
46
- var _j = useState(null), minMonthIdx = _j[0], setMinMonthIdx = _j[1];
47
- var _k = useState(null), maxMonthIdx = _k[0], setMaxMonthIdx = _k[1];
48
- // React Hooks Variables
49
- var _l = useState(''), searchTemporaryValue = _l[0], setSearchTemporaryValue = _l[1];
50
- var _m = useState(1), goToPage = _m[0], setGoToPage = _m[1];
51
- var _o = useState(""), perPageTemporaryValue = _o[0], setPerPageTemporaryValue = _o[1];
52
- var _p = useState([]), paginationSummaryFormError = _p[0], setPaginationSummaryFormError = _p[1];
53
- var _q = useState(false), loaded = _q[0], setLoaded = _q[1];
54
- var _r = useState(0), seconds = _r[0], setSeconds = _r[1];
55
- var _s = useState(undoButton && undoButton.show ? true : false), undoShow = _s[0], setUndoShow = _s[1];
56
- var _t = useState(false), doneTimer = _t[0], setDoneTimer = _t[1];
57
- useEffect(function () {
58
- if (dropdown && dropdown.minMonth) {
59
- var filteredMonthList = __spreadArray([], MONTH_LIST, true).filter(function (item) { return (item.value.toLowerCase() === dropdown.minMonth.toLowerCase()); });
60
- if (filteredMonthList.length > 0) {
61
- minMonthIdx = MONTH_LIST.indexOf(filteredMonthList[0]);
62
- setMinMonthIdx(minMonthIdx);
63
- }
64
- }
65
- if (dropdown && dropdown.maxMonth) {
66
- var filteredMonthList = __spreadArray([], MONTH_LIST, true).filter(function (item) { return (item.value.toLowerCase() === dropdown.maxMonth.toLowerCase()); });
67
- if (filteredMonthList.length > 0) {
68
- maxMonthIdx = MONTH_LIST.indexOf(filteredMonthList[0]);
69
- setMaxMonthIdx(maxMonthIdx);
70
- }
71
- }
72
- if (search && search.value && loaded === false) {
73
- setSearchTemporaryValue(search.value);
74
- setLoaded(true);
75
- }
76
- if (undoButton && undoButton.show) {
77
- var buttonWithTimer_1 = undoButton.actions && undoButton.actions.constructor === Array && undoButton.actions.length > 0 ? (undoButton.actions.filter(function (item) { return (item.hasOwnProperty('timer') && item.timer !== undefined && item.timer.constructor === Number); })) : [];
78
- if (buttonWithTimer_1.length > 0) {
79
- if (undoShow !== undoButton.show) {
80
- if (buttonWithTimer_1[0] && buttonWithTimer_1[0].hasOwnProperty('timer')) {
81
- buttonWithTimer_1[0].timer && setSeconds(buttonWithTimer_1[0].timer);
82
- }
83
- setDoneTimer(false);
84
- setUndoShow(undoButton.show ? true : false);
85
- }
86
- var myInterval_1 = setInterval(function () {
87
- if (seconds > 0) {
88
- setSeconds(seconds - 1);
89
- }
90
- else {
91
- if (!doneTimer) {
92
- clearInterval(myInterval_1);
93
- setDoneTimer(true);
94
- returnValues('button', buttonWithTimer_1[0].action, null);
95
- }
96
- }
97
- }, 1000);
98
- return function () {
99
- clearInterval(myInterval_1);
100
- };
101
- }
102
- }
103
- else {
104
- setUndoShow(false);
105
- }
106
- });
107
- // Belt Configuration Variables
108
- info = info ? (info.constructor === Object && info.infoDetails ? (info) : info.constructor === String ? (info) : INFO_LOADER) : INFO_LOADER;
109
- var dropdownTitle = dropdown && (dropdown.type === 'list' || dropdown.type === 'button') ? (dropdown.title ? dropdown.title : "") : dropdown && dropdown.type === 'date-picker-weekly' ? (dropdown.selection && dropdown.selection.startDate && dropdown.selection.endDate ? (dropdown.selection.startDate + ' to ' + dropdown.selection.endDate) : "") : dropdown && dropdown.type === 'date-picker-monthly' ? dropdown.selection.startDate : "";
110
- /**
111
- * popoverRequestHandler
112
- * hide and show the popover of specific action
113
- * @param {*} e - event of the click item
114
- * @param {*} popover - popover type
115
- */
116
- var popoverRequestHandler = function (e, popover, hide) {
117
- if (hide === void 0) { hide = false; }
118
- switch (popover) {
119
- case 'info':
120
- var currentTarget_1 = e.currentTarget;
121
- if (hide === false && info.constructor === String && info === INFO_LOADER) {
122
- actionRequestHandler(e, 'icon', 'info');
123
- setInfoPopover(e.currentTarget);
124
- setTimeout(function () {
125
- setInfoPopover(null);
126
- setInfoPopover(currentTarget_1);
127
- }, 2000);
128
- }
129
- else {
130
- infoPopover ? setInfoPopover(null) : setInfoPopover(e.currentTarget);
131
- }
132
- break;
133
- case 'dropdown':
134
- if (dropdown.type === 'date-picker-monthly' && !dropdownPopover) {
135
- dropdown.selection && dropdown.selection.startDate ? setCalendarYear(datetimeFormatter(dropdown.selection.startDate, 'full-year')) : setCalendarYear(new Date());
136
- }
137
- else if (dropdown.type === 'date-picker-cutoff' && !dropdownPopover) {
138
- setCalendarYear(dropdown.currentYear); //need to improve on this one
139
- }
140
- dropdownPopover ? setDropdownPopover(null) : setDropdownPopover(e.currentTarget);
141
- break;
142
- case 'pagination-summary':
143
- if (!Boolean(paginationSummaryPopover)) {
144
- pagination && pagination.page ? setGoToPage(pagination.page) : setGoToPage(1);
145
- setPerPageTemporaryValue(pagination.perPage ? pagination.perPage.toString() : '');
146
- }
147
- paginationSummaryPopover ? setPaginationSummaryPopover(null) : setPaginationSummaryPopover(e.currentTarget);
148
- break;
149
- case 'pivot':
150
- pivotPopover ? setPivotPopover(null) : setPivotPopover(e.currentTarget);
151
- break;
152
- case 'filter':
153
- filterPopover ? setFilterPopover(null) : setFilterPopover(e.currentTarget);
154
- break;
155
- case 'main-button':
156
- if (hide) {
157
- setMainButtonPopover(null);
158
- }
159
- else {
160
- mainButtonPopover ? setMainButtonPopover(null) : setMainButtonPopover(e.currentTarget);
161
- }
162
- break;
163
- default:
164
- break;
165
- }
166
- };
167
- /**
168
- * actionRequestHandler
169
- * manipulate the action and data of each action
170
- * @param {*} e - event
171
- * @param {*} type - action type / can be the action itself
172
- * @param {*} action - it can be action type / data depends on the used actions
173
- */
174
- var actionRequestHandler = function (e, type, action, hidePopover) {
175
- if (hidePopover === void 0) { hidePopover = true; }
176
- if (e.preventDefault) {
177
- e.preventDefault();
178
- }
179
- var data = null;
180
- var addedParam = null;
181
- if (type === 'search') {
182
- data = searchTemporaryValue;
183
- }
184
- else if (type === 'pagination' || type === 'pagination-summary') {
185
- data = pagination;
186
- }
187
- else if (type === 'dropdown' || type === 'pivot' || type === 'main-button' || type === 'button' || type === 'icon' || type === 'check' || type === 'tab' || type === 'toggle') {
188
- data = action;
189
- action = type;
190
- if (dropdown && dropdown.type === 'date-picker-cutoff') {
191
- addedParam = calendarYear;
192
- }
193
- }
194
- else if (type === 'undo-button') {
195
- data = action;
196
- action = type;
197
- }
198
- if (hidePopover) {
199
- popoverRequestHandler(e, type, true);
200
- }
201
- setTimeout(function () {
202
- returnValues(action, data, addedParam);
203
- }, 200);
204
- };
205
- /**
206
- * handleChangeFormValue
207
- * manipulate the inputs temporary values
208
- * @param {*} e - event
209
- * @param {*} type - type of the input that has been changed
210
- */
211
- var handleChangeFormValue = function (e, type) {
212
- switch (type) {
213
- case 'search':
214
- e.target.value ? setSearchTemporaryValue(e.target.value) : setSearchTemporaryValue("");
215
- break;
216
- case 'show-per-page':
217
- setPerPageTemporaryValue(e.target.value.toString());
218
- setGoToPage(1);
219
- if (paginationSummaryFormError.indexOf('perPageTemporaryValue') >= 0 && (e !== "")) {
220
- paginationSummaryFormError = paginationSummaryFormError.filter(function (item) { return item !== 'perPageTemporaryValue'; });
221
- setPaginationSummaryFormError(paginationSummaryFormError);
222
- }
223
- break;
224
- case 'go-to-page':
225
- setGoToPage(e.target.value);
226
- if (paginationSummaryFormError.indexOf('goToPage') >= 0 && (e.currentTarget.value !== "" || e.currentTarget.value > 1)) {
227
- paginationSummaryFormError = paginationSummaryFormError.filter(function (item) { return item !== 'goToPage'; });
228
- setPaginationSummaryFormError(paginationSummaryFormError);
229
- }
230
- break;
231
- case 'advanced-filter':
232
- returnValues(type, e);
233
- break;
234
- default:
235
- break;
236
- }
237
- };
238
- /**
239
- * paginationRequestHandler
240
- * manipulate the paginations value depend on the action
241
- * @param {*} e - event
242
- * @param {*} action - action that the user do
243
- */
244
- var paginationRequestHandler = function (e, action) {
245
- e.preventDefault();
246
- var paginationCopy = __assign({}, pagination);
247
- switch (action) {
248
- case 'check-pagination-required':
249
- var formError = [];
250
- if (goToPage === "" || goToPage < 1) {
251
- formError.push('goToPage');
252
- }
253
- if (perPageTemporaryValue === "") {
254
- formError.push('perPageTemporaryValue');
255
- }
256
- return formError;
257
- case 'submit':
258
- var errorFields = paginationRequestHandler(e, 'check-pagination-required');
259
- if (errorFields.length > 0) {
260
- setPaginationSummaryFormError(errorFields);
261
- }
262
- else {
263
- pagination.perPage = perPageTemporaryValue ? parseInt(perPageTemporaryValue) : pagination.perPage;
264
- pagination.page = goToPage ? ((pagination.perPage * goToPage) > pagination.total ? (Math.floor(pagination.total / pagination.perPage) + 1) : parseInt(goToPage)) : 1;
265
- pagination.counter = (pagination.page * pagination.perPage) > pagination.total ? pagination.total : (pagination.page * pagination.perPage);
266
- // if (paginationCopy.perPage !== pagination.perPage || paginationCopy.page !== pagination.page || paginationCopy.counter !== pagination.counter) {
267
- actionRequestHandler(e, 'pagination-summary', 'pagination');
268
- // }
269
- }
270
- break;
271
- case 'next':
272
- pagination.page = ((pagination.page++) * pagination.perPage) > pagination.total ? (Math.floor(pagination.total / pagination.perPage) + 1) : pagination.page++;
273
- pagination.counter = (pagination.page * pagination.perPage) > pagination.total ? pagination.total : (pagination.page * pagination.perPage);
274
- if (paginationCopy.page !== pagination.page || paginationCopy.counter !== pagination.counter) {
275
- actionRequestHandler(e, 'pagination', 'pagination');
276
- }
277
- break;
278
- case 'prev':
279
- pagination.page = pagination.page > 1 ? pagination.page -= 1 : pagination.page;
280
- pagination.counter = pagination.page * pagination.perPage;
281
- if (paginationCopy.page !== pagination.page || paginationCopy.counter !== pagination.counter) {
282
- actionRequestHandler(e, 'pagination', 'pagination');
283
- }
284
- break;
285
- default:
286
- break;
287
- }
288
- };
289
- /**
290
- * checkboxRequestHandler
291
- * select all / unselect all items
292
- * @param {*} e - event
293
- * @param {*} action - action of the checkbox
294
- */
295
- var checkboxRequestHandler = function (e, action) {
296
- // e.preventDefault();
297
- if (check.disabled !== true) {
298
- if (action === 'all') {
299
- actionRequestHandler(e, 'check', 'all');
300
- }
301
- else {
302
- actionRequestHandler(e, 'check', 'none');
303
- }
304
- }
305
- };
306
- /**
307
- * onDatePickerChange
308
- * change the datepicker value
309
- * @param {*} e - event
310
- * @param {*} type - action type
311
- */
312
- var onDatePickerChange = function (e, type) {
313
- if (dropdown.type === 'date-picker-weekly') {
314
- dropdown.selection.startDate = datetimeFormatter(e, 'start-of-Week');
315
- dropdown.selection.endDate = datetimeFormatter(e, 'end-of-Week');
316
- }
317
- actionRequestHandler(e, type, dropdown.selection);
318
- };
319
- /**
320
- * dateMonthlyPickerHandler
321
- * selection of month on a calendar and changing of year
322
- * @param {*} e - event
323
- * @param {*} action - action type
324
- */
325
- var dateMonthlyPickerHandler = function (e, action, data) {
326
- if (data === void 0) { data = ''; }
327
- var _a = __assign({}, dropdown), maxYear = _a.maxYear, minYear = _a.minYear;
328
- if (action === 'next') {
329
- if (!maxYear || (maxYear && parseInt(maxYear) >= calendarYear + 1)) {
330
- calendarYear += 1;
331
- setCalendarYear(calendarYear);
332
- }
333
- }
334
- else if (action === 'prev') {
335
- if (!minYear || (minYear && parseInt(minYear) <= calendarYear - 1)) {
336
- calendarYear -= 1;
337
- setCalendarYear(calendarYear);
338
- }
339
- }
340
- else if (action === 'month-selection') {
341
- var newDateValue = datetimeFormatter(data + ' ' + calendarYear, 'month-year');
342
- actionRequestHandler(e, 'dropdown', newDateValue);
343
- }
344
- else if (action === 'next-month') {
345
- var standardDate = datetimeFormatter(dropdown.selection.startDate, 'date-standard');
346
- var selectedMonthDate = new Date(new Date(standardDate).toLocaleString('en-US', { timeZone: 'Asia/Manila' })); //making the date picked as the default gmt so that the new date wont adjust by timezone;
347
- // selectedMonthDate = new Date(selectedMonthDate);
348
- var monthIdx = selectedMonthDate.getMonth();
349
- var fullYear = selectedMonthDate.getFullYear();
350
- if (monthIdx + 1 < 12) {
351
- monthIdx = monthIdx + 1;
352
- }
353
- else {
354
- monthIdx = 0;
355
- fullYear = fullYear + 1;
356
- }
357
- if ((!maxYear && !maxMonthIdx) || fullYear < parseInt(maxYear) || (fullYear === parseInt(maxYear) && monthIdx <= parseInt(maxMonthIdx))) {
358
- var newDateValue = datetimeFormatter(MONTH_LIST[monthIdx].value + ' ' + fullYear, 'month-year');
359
- actionRequestHandler(e, 'dropdown', newDateValue, false);
360
- }
361
- }
362
- else if (action === 'prev-month') {
363
- var standardDate = datetimeFormatter(dropdown.selection.startDate, 'date-standard');
364
- var selectedMonthDate = new Date(new Date(standardDate).toLocaleString('en-US', { timeZone: 'Asia/Manila' })); //making the date picked as the default gmt so that the new date wont adjust by timezone;
365
- // selectedMonthDate = new Date(selectedMonthDate);
366
- var monthIdx = selectedMonthDate.getMonth();
367
- var fullYear = selectedMonthDate.getFullYear();
368
- if (monthIdx - 1 >= 0) {
369
- monthIdx = monthIdx - 1;
370
- }
371
- else {
372
- monthIdx = 11;
373
- fullYear = fullYear - 1;
374
- }
375
- if ((!minYear && !minMonthIdx) || fullYear > parseInt(minYear) || (fullYear === parseInt(minYear) && monthIdx >= parseInt(minMonthIdx))) {
376
- var newDateValue = datetimeFormatter(MONTH_LIST[monthIdx].value + ' ' + fullYear, 'month-year');
377
- actionRequestHandler(e, 'dropdown', newDateValue, false);
378
- }
379
- }
380
- };
381
- var dateCutoffPickerHandler = function (e, label, value) {
382
- var cutOffVal = {
383
- "label": label,
384
- "value": value,
385
- };
386
- actionRequestHandler(e, 'dropdown', cutOffVal);
387
- };
388
- /**
389
- * returnValues
390
- * return manipulated value from beltConfig to the parent component
391
- * @param {*} action - done action on beltConfig
392
- * @param {*} data - manipulated data from the action
393
- */
394
- var returnValues = function (action, data, addedParam) {
395
- if (addedParam === void 0) { addedParam = null; }
396
- return getActions ? getActions(action, data, addedParam) : false;
397
- };
398
- /**
399
- * dateMonthlyPickerIsSelected
400
- * determine if month is selected
401
- * @param {*} month - month value
402
- */
403
- var dateMonthlyPickerIsSelected = function (month) {
404
- var isSelected = false;
405
- if (dropdown && dropdown.selection && dropdown.selection.startDate && calendarYear) {
406
- var monthYear = month + ' ' + calendarYear;
407
- isSelected = datetimeFormatter(dropdown.selection.startDate.toString(), 'month-year') === datetimeFormatter(monthYear, 'month-year') ? true : false;
408
- }
409
- return isSelected;
410
- };
411
- var isDisabledDropdownPagination = function (action) {
412
- var _a = __assign({}, dropdown), maxYear = _a.maxYear, minYear = _a.minYear, selection = _a.selection;
413
- var selectedMonthDate = new Date(selection.startDate);
414
- var monthIdx = selectedMonthDate.getMonth();
415
- var fullYear = selectedMonthDate.getFullYear();
416
- if (action === 'prev') {
417
- if (minYear && minMonthIdx && fullYear === parseInt(minYear) && monthIdx === parseInt(minMonthIdx)) {
418
- return ' is-disabled';
419
- }
420
- else {
421
- return '';
422
- }
423
- }
424
- else if (action === 'next') {
425
- if (maxYear && maxMonthIdx && fullYear === parseInt(maxYear) && monthIdx === parseInt(maxMonthIdx)) {
426
- return ' is-disabled';
427
- }
428
- else {
429
- return '';
430
- }
431
- }
432
- };
433
- var toggleSelectionHandler = function (event, value) {
434
- event.preventDefault();
435
- actionRequestHandler(event, 'toggle', value, false);
436
- };
437
- return (_jsxs("div", __assign({ className: customClass && customClass.constructor === String ? customClass : 'custom-card' }, { children: [_jsxs("div", __assign({ className: "em-card-belt" }, { children: [_jsxs("div", __assign({ className: "em-belt-left" }, { children: [_jsxs("div", __assign({ className: "em-beltleft-container" }, { children: [
438
- // Back Icon Configuration
439
- config && config.iconType && ((config.iconType.constructor === Array && config.iconType.length > 0 && config.iconType.indexOf("back") >= 0) || (config.iconType === 'back')) ? (_jsx("a", __assign({ className: "belt-icon icon-back", href: "#", onClick: function (event) { return actionRequestHandler(event, 'icon', 'back'); }, "data-testid": "menubar-back" }, { children: SVG_BACK }))) : null,
440
- // Check Icon Configuration
441
- config && config.iconType && ((config.iconType.constructor === Array && config.iconType.length > 0 && config.iconType.indexOf("check") >= 0) || (config.iconType === 'check')) ? (_jsx("div", __assign({ className: "belt-icon-check", "data-testid": "menubar-checkbox" }, { children: check ? (check.selected === 0 ? (_jsx("div", __assign({ onClick: function (event) { return checkboxRequestHandler(event, 'all'); } }, { children: CHECKBOX.NONE }))) : check.selected > 0 && check.selected < check.total ? (_jsx("div", __assign({ onClick: function (event) { return checkboxRequestHandler(event, 'all'); } }, { children: CHECKBOX.FEW }))) : check.selected === check.total ? (_jsx("div", __assign({ onClick: function (event) { return checkboxRequestHandler(event, 'none'); } }, { children: CHECKBOX.ALL }))) : _jsx("div", { children: CHECKBOX.NONE })) : _jsx("div", { children: CHECKBOX.NONE }) }))) : null,
442
- // Standard Icon Configuration
443
- config && config.iconType && ((config.iconType.constructor === Array && config.iconType.length > 0 && config.iconType.indexOf("standard") >= 0) || (config.iconType === 'standard')) ? (_jsx("div", __assign({ className: "belt-icon", "data-testid": "menubar-standard-icon" }, { children: config.icon }))) : null, _jsxs("div", __assign({ className: "belt-title" }, { children: [
444
- // Title Configuration
445
- check && check.selected && check.selected > 0 && check.selected < check.total ? (_jsx("h6", { children: "".concat(check.selected, " ").concat(check.selected === 1 ? 'item selected' : 'items selected') })) : check && check.selected && check.selected === check.total ? (_jsx("h6", { children: "All item(s) selected" })) : config && config.title && (config.title.constructor === String || config.title.constructor === Object) ? (_jsx("h6", __assign({ className: "config-title", "data-testid": "menubar-title" }, { children: config.title }))) : null,
446
- // Title Information Configuration
447
- config && config.titleDescription ? (_jsx("p", { children: config.titleDescription })) : null] })),
448
- // Information Configuration
449
- config && config.nativePopover === undefined && config.showInfo && config.showInfo.constructor === Boolean ? (_jsxs(Fragment, { children: [_jsx("a", __assign({ href: "#", className: "belt-info", onClick: function (event) { return popoverRequestHandler(event, 'info'); }, "data-testid": "menubar-information" }, { children: _jsx("i", { className: "belt-icon" }) })), _jsx(Popover, __assign({ id: "InfoPopOver", open: Boolean(infoPopover), className: Boolean(dropdownPopover) ? 'open-popover' : '', onClick: function (event) { return popoverRequestHandler(event, 'info'); } }, { children: _jsx(Information, { items: info && info.infoDetails ? info.infoDetails : info, listRow: info && info.listRow ? info.listRow : [], desc: info && info.listRow && info.listRow.length > 0 ? false : true, title: config && config.title ? config.title.toUpperCase() : null, hide: function (event) { return popoverRequestHandler(event, 'info', true); } }) }))] })) : null,
450
- // Additional title on the modal
451
- config && config.addedTitle ? (_jsx("p", { children: config.addedTitle })) : null] })), _jsxs("div", __assign({ className: "em-beltleft-cta" }, { children: [mainButton && mainButton.show ? (mainButton.actions && mainButton.actions.constructor === Array && mainButton.actions.length > 1 ? (_jsxs(Fragment, { children: [_jsxs("a", __assign({ className: "belt-action-main", id: "main-button", href: "#", onClick: function (event) { return popoverRequestHandler(event, 'main-button'); } }, { children: [_jsx("div", __assign({ className: "belt-icon" }, { children: mainButton.icon ? mainButton.icon : '' })), _jsx("span", { children: mainButton.label ? mainButton.label : 'File a Request' })] })), _jsx(Popover, __assign({ id: "mainButtonPopover", open: Boolean(mainButtonPopover), onClick: function (event) { return popoverRequestHandler(event, 'main-button'); }, className: Boolean(dropdownPopover) ? 'open-popover' : '' }, { children: _jsx("div", __assign({ className: "popover em-popover-list" }, { children: mainButton.actions.map(function (btn, idx) {
452
- return _jsx("a", __assign({ href: "#", onClick: function (event) { return actionRequestHandler(event, 'main-button', btn.action); } }, { children: btn.label }), idx);
453
- }) })) }))] })) : mainButton.actions && mainButton.actions.constructor === Array && mainButton.actions.length === 1 ? (mainButton.actions.map(function (btn, idx) {
454
- return (_jsxs("a", __assign({ className: btn.class ? 'belt-action ' + btn.class : 'belt-action', href: "#", onClick: function (event) { return actionRequestHandler(event, 'main-button', btn.action); } }, { children: [_jsx("div", __assign({ className: "belt-icon " }, { children: btn.icon ? btn.icon : '' })), _jsx("span", { children: btn.label ? btn.label : '' })] }), idx));
455
- })) : null) : null,
456
- // Button Actions Configuration
457
- button && button.show && button.show.constructor === Boolean &&
458
- button.actions && button.actions.constructor === Array && button.actions.length > 0 ? (button.actions.map(function (btn, idx) {
459
- return (_jsxs("a", __assign({ className: btn.class ? btn.class : 'belt-action' + ' ' + (idx === 0 ? 'is-primary' : ''), href: "#", onClick: function (event) { return actionRequestHandler(event, 'button', btn.action); }, "data-testid": "menubar-button" }, { children: [_jsx("div", __assign({ className: "belt-icon belt-buttons" }, { children: btn.icon ? btn.icon : '' })), _jsx("span", __assign({ "data-testid": 'button-action-' + btn.action }, { children: btn.label ? btn.label : '' }))] }), idx));
460
- })) : null,
461
- // UndoButton Actions Configuration
462
- undoButton && undoButton.show && !undoButton.isFooter &&
463
- undoButton.actions && undoButton.actions.constructor === Array && undoButton.actions.length > 0 ? (undoButton.actions.map(function (btn, idx) {
464
- return seconds > 0 || (btn.timer !== undefined) ? (_jsxs("a", __assign({ className: btn.class ? btn.class : 'belt-action' + ' ' + (idx === 0 ? 'is-primary' : '') + (btn.disabled === true ? ' is-disabled' : ' button outline button-undo'), href: "#", "data-testid": "undo-button-".concat(btn.action) }, (btn.disabled === true ? { onClick: function (event) { event.preventDefault(); } } : { onClick: function (event) { return actionRequestHandler(event, 'undo-button', btn.action); } }), { children: [_jsx("div", __assign({ className: "belt-icon" }, { children: btn.icon ? btn.icon : '' })), _jsx("span", __assign({ "data-testid": "undo-button-text" }, { children: btn.label ? ("".concat(btn.label, " ").concat(btn.timer !== undefined && btn.timer.constructor === Number && seconds > 0 ? ("in ".concat(seconds, "s")) : '')) : '' }))] }), idx)) : null;
465
- })) : null] }))] })), _jsxs("div", __assign({ className: "em-belt-right" }, { children: [
466
- // Dropdown Actions Configuration
467
- dropdown && dropdown.show && dropdown.show.constructor === Boolean ? (_jsx(Fragment, { children: _jsxs("div", __assign({ className: "em-dropdown" }, { children: [dropdown.type === 'list' ? (_jsxs("a", __assign({ className: "belt-dropdown", id: "add", href: "#", onClick: function (event) { return popoverRequestHandler(event, 'dropdown'); } }, { children: [_jsx("div", __assign({ className: "icon-add" }, { children: dropdown.icon ? dropdown.icon : '' })), _jsx("span", { children: dropdownTitle })] }))) : dropdown.type === 'date-picker-weekly' ? (_jsxs("a", __assign({ id: "months", className: "belt-dropdown ".concat(Boolean(dropdownPopover) ? 'is-active' : ''), href: "#", onClick: function (event) { return popoverRequestHandler(event, 'dropdown'); } }, { children: [_jsx("span", { children: dropdownTitle }), _jsx("div", __assign({ className: "icon-arrowdown" }, { children: SVG_ARROWDOWN }))] }))) : dropdown.type === 'date-picker-monthly' ? (_jsxs(Fragment, { children: [_jsxs("a", __assign({ id: "months", className: "belt-dropdown ".concat(Boolean(dropdownPopover) ? 'is-active' : ''), href: "#", onClick: function (event) { return popoverRequestHandler(event, 'dropdown'); } }, { children: [_jsx("span", { children: dropdownTitle }), _jsx("div", __assign({ className: "icon-arrowdown" }, { children: SVG_ARROWDOWN }))] })), dropdown.showPagination ? (_jsxs(Fragment, { children: [_jsx("a", __assign({ className: 'belt-prev' + isDisabledDropdownPagination('prev'), href: "#", onClick: function (event) { return dateMonthlyPickerHandler(event, 'prev-month'); } }, { children: _jsx("div", __assign({ className: "belt-icon" }, { children: SVG_ARROWLEFT })) })), _jsx("a", __assign({ className: 'belt-next' + isDisabledDropdownPagination('next'), href: "#", onClick: function (event) { return dateMonthlyPickerHandler(event, 'next-month'); } }, { children: _jsx("div", __assign({ className: "belt-icon" }, { children: SVG_ARROWRIGHT })) }))] })) : null] })) : dropdown.type === 'date-picker-cutoff' ? ((_jsx("a", __assign({ className: "belt-dropdown", id: "add", href: "#", onClick: function (event) { return popoverRequestHandler(event, 'dropdown'); } }, { children: _jsx("span", { children: dropdown.cutoffValue && dropdown.cutoffValue.label ? dropdown.cutoffValue.label : '' }) })))) : dropdown.type === 'button' ? (_jsxs("a", __assign({ className: "belt-dropdown", id: "add", href: "#", onClick: function (event) { return actionRequestHandler(event, 'button', dropdown.action); } }, { children: [_jsx("div", __assign({ className: "belt-icon" }, { children: dropdown.icon ? dropdown.icon : '' })), _jsx("span", { children: dropdownTitle })] }))) : (_jsx("a", __assign({ className: "belt-dropdown", id: "add", href: "#", onClick: function (event) { return popoverRequestHandler(event, 'dropdown'); } }, { children: _jsx("span", { children: dropdownTitle }) }))), _jsx(Popover, __assign({ id: "dropdownPopover", className: Boolean(dropdownPopover) ? 'open-popover' : '', open: Boolean(dropdownPopover), onClick: function (event) { return popoverRequestHandler(event, 'dropdown'); } }, { children: dropdown.type === 'list' ? (dropdown.actions && dropdown.actions.constructor === Array && dropdown.actions.length > 0 ? (_jsx("div", __assign({ className: "popover em-popover-list" }, { children: dropdown.actions.map(function (drpdwn, idx) {
468
- return _jsx("a", __assign({ href: "#", onClick: function (event) { return actionRequestHandler(event, 'dropdown', drpdwn.value); } }, { children: drpdwn.label }), idx);
469
- }) }))) : null) : dropdown.type === 'date-picker-weekly' ? (_jsx("div", __assign({ className: "popover" }, { children: _jsx(Calendar, { className: "dateRangePickerInput", onChange: function (event) { return onDatePickerChange(event, 'dropdown'); } }) }))) : dropdown.type === 'date-picker-monthly' ? (_jsxs("div", __assign({ className: "popover em-popover-months" }, { children: [_jsxs("div", __assign({ className: "list-years" }, { children: [_jsx("button", __assign({ onClick: function (event) { return dateMonthlyPickerHandler(event, 'prev'); } }, { children: SVG_ARROWLEFT })), _jsx("div", { children: calendarYear }), _jsx("button", __assign({ onClick: function (event) { return dateMonthlyPickerHandler(event, 'next'); } }, { children: SVG_ARROWRIGHT }))] })), _jsx("div", __assign({ className: "list-months" }, { children: MONTH_LIST.map(function (action, idx) {
470
- return dropdown.minYear && dropdown.minYear.toString() === calendarYear.toString() && minMonthIdx && minMonthIdx > idx ? (_jsx("a", __assign({ href: "#", className: 'is-disabled', onClick: function (event) { event.preventDefault(); } }, { children: action.label }), idx)) : dropdown.maxYear && dropdown.maxYear.toString() === calendarYear.toString() && maxMonthIdx && maxMonthIdx < idx ? (_jsx("a", __assign({ href: "#", className: 'is-disabled', onClick: function (event) { event.preventDefault(); } }, { children: action.label }), idx)) : (_jsx("a", __assign({ className: dateMonthlyPickerIsSelected(action.label) ? 'is-selected' : '', href: "#", onClick: function (event) { return dateMonthlyPickerHandler(event, 'month-selection', action.value); } }, { children: action.label }), idx));
471
- }) }))] }))) : dropdown.type === 'date-picker-cutoff' ? (_jsxs("div", __assign({ className: "popover em-popover-months" }, { children: [_jsxs("div", __assign({ className: "list-years" }, { children: [_jsx("button", __assign({ onClick: function (event) { return dateMonthlyPickerHandler(event, 'prev'); } }, { children: _jsx("img", { src: "/images/icons/icon-arrowleft-white.svg", alt: "" }) })), _jsx("div", { children: calendarYear }), _jsx("button", __assign({ onClick: function (event) { return dateMonthlyPickerHandler(event, 'next'); } }, { children: _jsx("img", { src: "/images/icons/icon-arrowright-white.svg", alt: "" }) }))] })), _jsx("div", __assign({ className: "list-months" }, { children: dropdown.cutoffDates !== null && dropdown.cutoffDates.length > 0 ? (dropdown.cutoffDates.map(function (action, idx) {
472
- var classSelect;
473
- if (JSON.stringify(action.label) === JSON.stringify(dropdown.cutoffValue.label)) {
474
- if (dropdown.currentYear === calendarYear) {
475
- classSelect = 'is-selected';
476
- }
477
- else {
478
- classSelect = '';
479
- }
480
- // classSelect = 'is-selected';
481
- }
482
- else {
483
- classSelect = '';
484
- }
485
- return _jsx("a", __assign({ className: classSelect, href: "#", onClick: function (event) { return dateCutoffPickerHandler(event, action.label, action.value); } }, { children: action.label }), idx);
486
- })) : null }))] }))) : null }))] })) })) : null, pagination && pagination.show && pagination.show.constructor === Boolean ? (_jsxs(Fragment, { children: [!pagination.hideSummary || pagination.hideSummary === false ? (_jsx(Fragment, { children: _jsxs("div", __assign({ className: "em-dropdown" }, { children: [_jsxs("a", __assign({ className: "pagination-summary", href: "#", id: "pagination", onClick: function (event) { return popoverRequestHandler(event, 'pagination-summary'); }, "data-testid": "menubar-pagination" }, { children: [(pagination.counter > 0 ? (((pagination.page - 1) * pagination.perPage) + 1) : 0)
487
- + ' - ' +
488
- (pagination.page * pagination.perPage > pagination.total ?
489
- (pagination.total ? pagination.total : pagination.counter) :
490
- pagination.page * pagination.perPage), " of ", pagination.total ? pagination.total : 0] })), _jsx(Popover, __assign({ id: "paginationSummaryPopover", className: Boolean(dropdownPopover) ? 'open-popover' : '', open: Boolean(paginationSummaryPopover), onClick: function (event) { return popoverRequestHandler(event, 'pagination-summary'); } }, { children: _jsxs("div", __assign({ className: "popover em-popover-input" }, { children: [_jsxs("div", __assign({ className: 'e-field field field-input' + (paginationSummaryFormError.indexOf('perPageTemporaryValue') >= 0 ? ' is-invalid' : '') }, { children: [_jsx("label", __assign({ className: 'e-input-label' }, { children: "SHOW" })), _jsx(Input, { config: {
491
- id: 'paginationPerPage',
492
- type: 'select',
493
- placeholder: '-',
494
- value: perPageTemporaryValue,
495
- options: PAGE_OPTION
496
- }, onChanged: function (event) { return handleChangeFormValue(event, 'show-per-page'); } })] })), _jsxs("div", __assign({ className: 'e-field field field-input' + (paginationSummaryFormError.indexOf('goToPage') >= 0 ? ' is-invalid' : '') }, { children: [_jsx("label", __assign({ className: 'e-input-label' }, { children: "GO TO PAGE" })), _jsx("div", __assign({ className: "e-input" }, { children: _jsx(Input, { config: {
497
- id: 'goToPage',
498
- type: 'number',
499
- value: goToPage,
500
- placeholder: '-',
501
- maxLength: 5,
502
- min: '1',
503
- }, onChanged: function (event) { return handleChangeFormValue(event, 'go-to-page'); } }) }))] })), _jsx("button", __assign({ className: "button-check", onClick: function (event) { return paginationRequestHandler(event, 'submit'); } }, { children: SVG_CHECK }))] })) }))] })) })) : null, _jsx("a", __assign({ className: (pagination.page * pagination.perPage) > pagination.perPage ? 'belt-prev' : 'belt-prev is-disabled', href: "#" }, (((pagination.page * pagination.perPage) > pagination.perPage) ? { onClick: function (event) { return paginationRequestHandler(event, 'prev'); } } : { onClick: function (event) { event.preventDefault(); } }), { children: _jsx("div", __assign({ className: "belt-icon" }, { children: SVG_ARROWLEFT })) })), _jsx("a", __assign({ className: pagination.total <= (pagination.page * pagination.perPage) ? 'belt-next is-disabled' : 'belt-next', href: "#" }, ((pagination.total <= (pagination.page * pagination.perPage)) ? { onClick: function (event) { event.preventDefault(); } } : { onClick: function (event) { return paginationRequestHandler(event, 'next'); } }), { children: _jsx("div", __assign({ className: "belt-icon" }, { children: SVG_ARROWRIGHT })) }))] })) : null,
504
- // Pivot Configuration
505
- pivot && pivot.show ? (_jsx(Fragment, { children: _jsxs("div", __assign({ className: "em-dropdown" }, { children: [_jsxs("a", __assign({ id: "months", className: "belt-dropdown ", href: "#", onClick: function (event) { return popoverRequestHandler(event, 'pivot'); }, "data-testid": "menubar-pivot" }, { children: [_jsx("span", { children: pivot.selected && pivot.actions &&
506
- pivot.actions.constructor === Array && pivot.actions.length > 0 ? (pivot.actions.filter(function (item) { return (item.value === pivot.selected); }).length > 0 ? (pivot.actions.filter(function (item) { return (item.value === pivot.selected); })[0].label) : 'None') : 'None' }), _jsx("div", __assign({ className: "icon-arrowdown" }, { children: SVG_ARROWDOWN }))] })), _jsx(Popover, __assign({ id: "pivotPopover", className: Boolean(dropdownPopover) ? 'open-popover' : '', open: Boolean(pivotPopover), onClick: function (event) { return popoverRequestHandler(event, 'pivot'); } }, { children: pivot.actions && pivot.actions.constructor === Array && pivot.actions.length > 0 ? (_jsx("div", __assign({ className: "popover em-popover-list" }, { children: pivot.actions.map(function (pvt, idx) {
507
- return _jsx("a", __assign({ href: "#", onClick: function (event) { return actionRequestHandler(event, 'pivot', pvt.value); } }, { children: pvt.label }), idx);
508
- }) }))) : null }))] })) })) : null,
509
- // Close Icon Configuration
510
- config && config.iconType && ((config.iconType.constructor === Array && config.iconType.length > 0 && config.iconType.indexOf("close") >= 0) || (config.iconType === 'close')) ? (_jsx("a", __assign({ className: "modal-close", href: "#", onClick: function (event) { return actionRequestHandler(event, 'icon', 'close'); }, "date-testid": "menubar-close" }, { children: SVG_CLOSE_GRAY }))) : null, toggle && toggle.show && toggle.buttons && toggle.buttons.constructor === Array ? (_jsx(Fragment, { children: _jsx("div", __assign({ className: "belt-toggle" }, { children: toggle.buttons.map(function (item, idx) { return (_jsx("a", __assign({ className: "belt-icon icon-calendar " + (item.value === toggle.value ? ' is-active' : ''), href: "#", onClick: function (event) { return toggleSelectionHandler(event, item.value); } }, { children: item.value === toggle.value ? item.selectedIconDisplay : item.icon }), 'toggle-' + idx)); }) })) })) : null] }))] })),
511
- // Search Configuration
512
- search && search.show && search.show.constructor === Boolean ? (_jsx("div", __assign({ className: "field em-card-search" }, { children: _jsx("div", __assign({ className: "e-input" }, { children: _jsx(Input, { config: {
513
- id: 'search',
514
- type: 'text',
515
- placeholder: search.placeholder ? search.placeholder : 'Search',
516
- maxLength: 30,
517
- readOnly: false,
518
- disabled: false,
519
- value: searchTemporaryValue ? searchTemporaryValue : ''
520
- }, onChanged: function (event) { return handleChangeFormValue(event, 'search'); }, keyPressed: function (event) { return actionRequestHandler(event, 'search', 'search'); } }) })) }))) : null, children, _jsxs("div", __assign({ className: "em-card-footer" }, { children: [buttonFooter && buttonFooter.show && buttonFooter.actions.length > 0 &&
521
- _jsx("div", __assign({ className: buttonFooter.className }, { children: buttonFooter.actions.map(function (btn, idx) { return (btn.show &&
522
- _jsxs("a", __assign({ className: 'button ' + btn.className, href: "#" }, (btn.disabled === true ? { onClick: function (event) { event.preventDefault(); } } : { onClick: function (event) { return actionRequestHandler(event, 'button', btn.action); } }), { "data-testid": btn.id && btn.id.constructor === String ? btn.id : 'default-button-footer' }, { children: [_jsx("div", __assign({ className: "icon" }, { children: btn.icon ? btn.icon : '' })), _jsx("span", __assign({ "data-testid": 'button-action-' + btn.action }, { children: btn.label ? btn.label : '' }))] }), idx)); }) })),
523
- // UndoButton Actions Configuration
524
- undoButton && undoButton.show && undoButton.isFooter &&
525
- undoButton.actions && undoButton.actions.constructor === Array && undoButton.actions.length > 0 ? (undoButton.actions.map(function (btn, idx) {
526
- return seconds > 0 || (btn.timer !== undefined) ? (_jsxs("a", __assign({ className: btn.class ? btn.class : 'button ' + ' ' + (idx === 0 ? 'disabled' : 'outline button-undo') + (btn.disabled === true ? ' is-disabled button-undo' : ''), href: "#", "data-testid": "undo-button-".concat(btn.action) }, (btn.disabled === true ? { onClick: function (event) { event.preventDefault(); } } : { onClick: function (event) { return actionRequestHandler(event, 'undo-button', btn.action); } }), { children: [_jsx("div", __assign({ className: "belt-icon" }, { children: btn.icon ? btn.icon : '' })), _jsx("span", __assign({ "data-testid": "undo-button-text" }, { children: btn.label ? ("".concat(btn.label, " ").concat(btn.timer !== undefined && btn.timer.constructor === Number && seconds > 0 ? ("in ".concat(seconds, "s")) : '')) : '' }))] }), idx)) : null;
527
- })) : null] }))] })));
528
- };
529
- export default MenuBar;
@@ -1,32 +0,0 @@
1
- import React from "react";
2
- interface IModalProps {
3
- id?: string;
4
- show: boolean;
5
- hideMenuBar?: boolean;
6
- config: {
7
- title: string;
8
- icon: any;
9
- showInfo: boolean;
10
- iconType: Array<string>;
11
- modalSize: string;
12
- };
13
- getActions: any;
14
- children?: any;
15
- button?: {
16
- show: boolean;
17
- actions?: Array<object>;
18
- };
19
- dropdown?: any;
20
- search?: any;
21
- pagination?: any;
22
- pivot?: any;
23
- check?: any;
24
- toggle?: any;
25
- mainButton?: any;
26
- buttonFooter?: any;
27
- undoButton?: any;
28
- info?: any;
29
- customClass?: string;
30
- }
31
- declare const Modal: React.FunctionComponent<IModalProps>;
32
- export default Modal;
package/dist/esm/Modal.js DELETED
@@ -1,27 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import ReactDOM from "react-dom";
14
- import MenuBar from "./MenuBar";
15
- var Modal = function (_a) {
16
- var id = _a.id, show = _a.show, hideMenuBar = _a.hideMenuBar, config = _a.config, getActions = _a.getActions, children = _a.children, button = _a.button, dropdown = _a.dropdown, search = _a.search, pagination = _a.pagination, pivot = _a.pivot, check = _a.check, toggle = _a.toggle, undoButton = _a.undoButton, mainButton = _a.mainButton, buttonFooter = _a.buttonFooter, info = _a.info, customClass = _a.customClass;
17
- var sendActions = function (actions, data) {
18
- returnValues(actions, data);
19
- };
20
- var returnValues = function (action, data, addedParam) {
21
- if (addedParam === void 0) { addedParam = null; }
22
- return getActions ? getActions(action, data, addedParam) : false;
23
- };
24
- console.log(hideMenuBar, 'hideMenuBar');
25
- return (show ? ReactDOM.createPortal(_jsx("div", __assign({ className: "e-modal" }, { children: _jsx("div", __assign({ className: "e-modal-container", "data-testid": id ? id : 'default-modal-test' }, { children: _jsx("div", __assign({ className: "card card-modal modal-".concat(config.modalSize ? config.modalSize : 'md') }, { children: !hideMenuBar ? (_jsx(MenuBar, __assign({ config: config, button: button, pagination: pagination, pivot: pivot, dropdown: dropdown, search: search, toggle: toggle, undoButton: undoButton, buttonFooter: buttonFooter, check: check, info: info, getActions: function (actions, data) { return sendActions(actions, data); } }, { children: _jsx("div", __assign({ className: "card-content" }, { children: children })) }))) : _jsx("div", __assign({ className: "card-content" }, { children: children })) })) })) })), document.getElementById('root')) : null);
26
- };
27
- export default Modal;
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const SVG_BACK: JSX.Element;
3
- export declare const SVG_CHECK: JSX.Element;
4
- export declare const SVG_CHECK_ACTIVE: JSX.Element;
5
- export declare const SVG_CHECK_INACTIVE: JSX.Element;
6
- export declare const SVG_CHECK_NEUTRAL: JSX.Element;
7
- export declare const SVG_CLOSE_GRAY: JSX.Element;
8
- export declare const SVG_SUBMIT: JSX.Element;
9
- export declare const SVG_UNDO: JSX.Element;
10
- export declare const SVG_ARROWRIGHT: JSX.Element;
11
- export declare const SVG_ARROWLEFT: JSX.Element;
12
- export declare const SVG_ARROWDOWN: JSX.Element;
13
- export declare const SVG_REQUEST: JSX.Element;
14
- export declare const SVG_ADD: JSX.Element;