empower-container 0.1.11 → 0.1.12
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.
- package/{src/main → dist}/assets/Asset.d.ts +0 -0
- package/{src/main → dist}/assets/Asset.js +0 -0
- package/{src/main → dist}/assets/Asset.tsx +0 -0
- package/{src/main → dist}/assets/icons/icon-check-white-sm.svg +0 -0
- package/{src/main → dist}/assets/images/icon-arrowdown-graydark.svg +0 -0
- package/{src/main → dist}/assets/images/icon-arrowleft-graydark.svg +0 -0
- package/{src/main → dist}/assets/images/icon-arrowright-graydark.svg +0 -0
- package/{src/main → dist}/assets/images/icon-arrowup-graydark.svg +0 -0
- package/{src/main → dist}/assets/images/icon-check-graydark.svg +0 -0
- package/{src/main → dist/cjs}/DatetimeFormatter.d.ts +0 -0
- package/{src/main → dist/cjs}/DatetimeFormatter.js +0 -0
- package/{src/main → dist/cjs}/Information.d.ts +0 -0
- package/dist/cjs/Information.js +63 -0
- package/{src/main → dist/cjs}/MenuBar.d.ts +0 -0
- package/dist/cjs/MenuBar.js +537 -0
- package/{src/main → dist/cjs}/Modal.d.ts +0 -0
- package/dist/cjs/Modal.js +32 -0
- package/dist/cjs/assets/Asset.d.ts +16 -0
- package/dist/cjs/assets/Asset.js +30 -0
- package/{src/main → dist/cjs}/constants/Constant.d.ts +0 -0
- package/dist/cjs/constants/Constant.js +35 -0
- package/{src/main → dist/cjs}/index.d.ts +0 -0
- package/{src/main → dist/cjs}/index.js +0 -0
- package/{src/main → dist/cjs}/inputs/Input.d.ts +0 -0
- package/{src/main → dist/cjs}/inputs/Input.js +7 -36
- package/{src/main → dist/cjs}/inputs/InputSelectionHandler.d.ts +0 -0
- package/{src/main → dist/cjs}/inputs/InputSelectionHandler.js +3 -3
- package/{src/main → dist/cjs}/inputs/Select.d.ts +0 -0
- package/{src/main → dist/cjs}/inputs/Select.js +11 -64
- package/dist/esm/DatetimeFormatter.d.ts +3 -0
- package/{src/main/DatetimeFormatter.tsx → dist/esm/DatetimeFormatter.js} +132 -139
- package/dist/esm/Information.d.ts +10 -0
- package/dist/esm/Information.js +38 -0
- package/dist/esm/MenuBar.d.ts +24 -0
- package/dist/esm/MenuBar.js +532 -0
- package/dist/esm/Modal.d.ts +33 -0
- package/dist/esm/Modal.js +27 -0
- package/dist/esm/assets/Asset.d.ts +16 -0
- package/dist/esm/assets/Asset.js +27 -0
- package/dist/esm/constants/Constant.d.ts +15 -0
- package/{src/main → dist/esm}/constants/Constant.js +9 -21
- package/{src/main/index.tsx → dist/esm/index.d.ts} +1 -3
- package/dist/esm/index.js +3 -0
- package/dist/esm/inputs/Input.d.ts +25 -0
- package/dist/esm/inputs/Input.js +104 -0
- package/dist/esm/inputs/InputSelectionHandler.d.ts +3 -0
- package/dist/esm/inputs/InputSelectionHandler.js +31 -0
- package/dist/esm/inputs/Select.d.ts +28 -0
- package/dist/esm/inputs/Select.js +399 -0
- package/{src → dist}/scss/components/_modal.scss +0 -0
- package/{src → dist}/scss/elements/_button.scss +0 -0
- package/{src → dist}/scss/elements/_index.scss +0 -0
- package/{src → dist}/scss/elements/_popover.scss +0 -0
- package/{src → dist}/scss/foundation/_colors.scss +0 -0
- package/{src → dist}/scss/foundation/_mixins.scss +0 -0
- package/{src → dist}/scss/foundation/_normalize.scss +0 -0
- package/{src → dist}/scss/foundation/_settings.scss +0 -0
- package/{src → dist}/scss/foundation/_typography.scss +0 -0
- package/{src → dist}/scss/library/_information.scss +0 -0
- package/{src → dist}/scss/library/_input.scss +0 -0
- package/{src → dist}/scss/library/_menubar.scss +0 -0
- package/{src → dist}/scss/library/_select.scss +0 -0
- package/{src → dist}/scss/style.scss +0 -0
- package/package.json +1 -1
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/src/index.tsx +0 -15
- package/src/main/Information.js +0 -65
- package/src/main/Information.tsx +0 -112
- package/src/main/MenuBar.js +0 -651
- package/src/main/MenuBar.tsx +0 -1074
- package/src/main/Modal.js +0 -24
- package/src/main/Modal.tsx +0 -83
- package/src/main/inputs/Input.tsx +0 -193
- package/src/main/inputs/InputSelectionHandler.tsx +0 -21
- package/src/main/inputs/Select.tsx +0 -654
- package/src/main/tsconfig.common.json +0 -34
- package/src/main/tsconfig.json +0 -35
- package/src/sample/App.css +0 -38
- package/src/sample/App.d.ts +0 -3
- package/src/sample/App.js +0 -13
- package/src/sample/App.test.d.ts +0 -1
- package/src/sample/App.test.js +0 -13
- package/src/sample/App.test.tsx +0 -9
- package/src/sample/App.tsx +0 -15
- package/src/sample/TestMenuBar.d.ts +0 -3
- package/src/sample/TestMenuBar.js +0 -527
- package/src/sample/TestMenuBar.tsx +0 -377
- package/src/sample/react-app-env.d.ts +0 -1
- package/src/sample/reportWebVitals.d.ts +0 -3
- package/src/sample/reportWebVitals.js +0 -38
- package/src/sample/reportWebVitals.ts +0 -15
- package/src/sample/setupTests.d.ts +0 -1
- package/src/sample/setupTests.js +0 -7
- package/src/sample/setupTests.ts +0 -5
- package/src/sample/tsconfig.json +0 -36
@@ -1,128 +1,122 @@
|
|
1
1
|
/* eslint-disable no-useless-concat */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
var daysWeekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
3
|
+
var daysWeekNamesFull = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Sat'];
|
4
|
+
var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
5
|
+
var monthNamesFull = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
6
|
+
var addZero = function (i) {
|
7
|
+
var num;
|
8
8
|
if (i < 10) {
|
9
|
-
|
10
9
|
num = "0" + i;
|
11
10
|
}
|
12
11
|
return num;
|
13
|
-
}
|
14
|
-
|
15
|
-
export const getUTCFullTime = (d: any) => {
|
12
|
+
};
|
13
|
+
export var getUTCFullTime = function (d) {
|
16
14
|
if (Object.prototype.toString.call(d) === '[object Date]') {
|
17
15
|
var h = addZero(d.getUTCHours());
|
18
16
|
var m = addZero(d.getUTCMinutes());
|
19
17
|
var s = addZero(d.getUTCSeconds());
|
20
18
|
return h + ":" + m + ":" + s;
|
21
|
-
}
|
19
|
+
}
|
20
|
+
else {
|
22
21
|
return '';
|
23
22
|
}
|
24
|
-
}
|
25
|
-
|
26
|
-
|
23
|
+
};
|
24
|
+
var datetimeFormatter = function (timestamp, format, todayServer, type, getServerTime, dateOnly) {
|
25
|
+
if (format === void 0) { format = "datetime"; }
|
26
|
+
if (todayServer === void 0) { todayServer = null; }
|
27
|
+
if (type === void 0) { type = null; }
|
28
|
+
if (getServerTime === void 0) { getServerTime = false; }
|
29
|
+
if (dateOnly === void 0) { dateOnly = false; }
|
27
30
|
try {
|
28
|
-
|
31
|
+
var iosDate = void 0;
|
29
32
|
if (timestamp && (timestamp.constructor === String || timestamp.constructor === Date || (timestamp.constructor === Object && timestamp.dateTimeStamp))) {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
todayServer = todayServer && todayServer.constructor === String ? todayServer.replace('+00', '') : null
|
34
|
-
|
33
|
+
var date = null;
|
34
|
+
var arrayDate = [];
|
35
|
+
todayServer = todayServer && todayServer.constructor === String ? todayServer.replace('+00', '') : null;
|
35
36
|
if (type === 'time') {
|
36
|
-
timestamp = '2021-01-01 ' + timestamp //add date when the passed timestamp is time only and the desired format is time (use to fix NaN return)
|
37
|
+
timestamp = '2021-01-01 ' + timestamp; //add date when the passed timestamp is time only and the desired format is time (use to fix NaN return)
|
37
38
|
}
|
38
|
-
|
39
39
|
if (timestamp === "today") {
|
40
40
|
date = new Date();
|
41
|
-
}
|
42
|
-
|
43
|
-
|
41
|
+
}
|
42
|
+
else {
|
44
43
|
if (timestamp && timestamp.constructor === String) {
|
45
44
|
timestamp = timestamp.replace('+00', ''); //removing unnecessary gmt from backend as the time is already in ph
|
46
45
|
arrayDate = timestamp.split(/[- :.]/);
|
47
|
-
}
|
46
|
+
}
|
47
|
+
else if (timestamp.constructor === Object && timestamp.dateTimeStamp && timestamp.source && timestamp.source === "v3") {
|
48
48
|
// this will be used if the datetime from api is set to UTC already
|
49
49
|
timestamp = timestamp.dateTimeStamp; //removing unnecessary gmt from backend as the time is already in ph
|
50
50
|
arrayDate = timestamp.split(/[- :.]/);
|
51
51
|
}
|
52
|
-
|
53
52
|
if (arrayDate.length === 3) {
|
54
53
|
iosDate = new Date(arrayDate[0], arrayDate[1] - 1, arrayDate[2], arrayDate[3]);
|
55
|
-
}
|
54
|
+
}
|
55
|
+
else if (arrayDate.length >= 5 && arrayDate.length <= 8) {
|
56
56
|
iosDate = new Date(arrayDate[0], arrayDate[1] - 1, arrayDate[2], arrayDate[3], arrayDate[4], arrayDate[5]);
|
57
|
-
}
|
57
|
+
}
|
58
|
+
else if (arrayDate.length >= 9) {
|
58
59
|
// new implementation for safari and for the node datetime
|
59
60
|
iosDate = new Date(arrayDate[0] + " " + arrayDate[1] + " " + arrayDate[2] + " " + arrayDate[3] + " " + arrayDate[4] + ":" + arrayDate[5] + ":" + arrayDate[6] + " GMT");
|
60
|
-
}
|
61
|
+
}
|
62
|
+
else {
|
61
63
|
iosDate = new Date(timestamp);
|
62
64
|
}
|
63
|
-
|
64
|
-
|
65
65
|
//checking if the function used the getServerTime
|
66
66
|
if (getServerTime) {
|
67
67
|
date = new Date(timestamp);
|
68
|
-
}
|
68
|
+
}
|
69
|
+
else {
|
69
70
|
if (dateOnly) {
|
70
71
|
date = new Date(timestamp).toLocaleString('en-US', { timeZone: 'GMT' }); //making the date picked as the default gmt so that the new date wont adjust by timezone
|
71
72
|
date = new Date(date);
|
72
|
-
}
|
73
|
-
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
var currentTz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
74
76
|
date = new Date(timestamp).toLocaleString('en-US', { timeZone: currentTz }); //making the date picked as the default gmt so that the new date wont adjust by timezone
|
75
77
|
date = new Date(date);
|
76
78
|
}
|
77
79
|
}
|
78
|
-
|
79
80
|
// for firefox
|
80
|
-
|
81
81
|
if (date) {
|
82
|
-
|
82
|
+
var splitTimeStampBySpace = timestamp.split(' ');
|
83
83
|
if (splitTimeStampBySpace.length === 2) {
|
84
84
|
if (isNaN(parseInt(splitTimeStampBySpace[0])) && splitTimeStampBySpace[1]) {
|
85
|
-
date = new Date(
|
85
|
+
date = new Date("".concat(splitTimeStampBySpace[0], " 01, ").concat(splitTimeStampBySpace[1]));
|
86
86
|
}
|
87
87
|
}
|
88
88
|
}
|
89
89
|
}
|
90
|
-
|
91
90
|
if ((date && date.toString() !== 'Invalid Date') || (iosDate && iosDate.toString() !== 'Invalid Date')) {
|
92
|
-
|
93
91
|
//get DATE
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
92
|
+
var dayName = daysWeekNames[isNaN(date.getDay()) ? iosDate.getDay() : date.getDay()];
|
93
|
+
var dayNameFull = daysWeekNamesFull[isNaN(date.getDay()) ? iosDate.getDay() : date.getDay()];
|
94
|
+
var dayDate = ("0" + (isNaN(date.getDate()) ? iosDate.getDate() : date.getDate())).slice(-2);
|
95
|
+
var monthName = monthNames[isNaN(date.getMonth()) ? iosDate.getMonth() : date.getMonth()];
|
96
|
+
var monthNameFull = monthNamesFull[isNaN(date.getMonth()) ? iosDate.getMonth() : date.getMonth()];
|
97
|
+
var year = isNaN(date.getFullYear()) ? iosDate.getFullYear() : date.getFullYear();
|
98
|
+
var MonthNumeric = ("0" + (isNaN(date.getMonth()) ? (iosDate.getMonth() + 1) : (date.getMonth() + 1))).slice(-2);
|
99
|
+
var firstDay = new Date(year, isNaN(date.getMonth()) ? iosDate.getMonth() : date.getMonth(), 1);
|
100
|
+
var lastDay = new Date(year, (isNaN(date.getMonth()) ? iosDate.getMonth() : date.getMonth()) + 1, 0);
|
101
|
+
var monthFirstDay = ("0" + firstDay.getDate()).slice(-2);
|
102
|
+
var monthLastDay = ("0" + lastDay.getDate()).slice(-2);
|
106
103
|
//get TIME
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
104
|
+
var hours = isNaN(date.getHours()) ? iosDate.getHours() : date.getHours();
|
105
|
+
var minutes = isNaN(date.getMinutes()) ? iosDate.getMinutes() : date.getMinutes();
|
106
|
+
var seconds = isNaN(date.getSeconds()) ? iosDate.getSeconds() : date.getSeconds();
|
107
|
+
var ampm = hours >= 12 ? 'PM' : 'AM';
|
111
108
|
hours = hours % 12;
|
112
109
|
hours = hours ? hours : 12; // the hour '0' should be '12'
|
113
110
|
minutes = minutes < 10 ? '0' + minutes : minutes;
|
114
111
|
seconds = seconds < 10 ? '0' + seconds : seconds;
|
115
|
-
|
116
|
-
|
117
|
-
|
112
|
+
var strTime = hours + ':' + minutes + ' ' + ampm;
|
113
|
+
var today = new Date();
|
118
114
|
if (todayServer !== null) {
|
119
115
|
today = new Date(todayServer);
|
120
116
|
}
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
let newFormat = null;
|
125
|
-
|
117
|
+
var todayTS = Math.round((today).getTime() / 1000);
|
118
|
+
var dateTS = Math.round((date).getTime() / 1000);
|
119
|
+
var newFormat = null;
|
126
120
|
switch (format) {
|
127
121
|
case "datetime":
|
128
122
|
// Mon, 01 Jan 2020 at 12:00PM
|
@@ -137,23 +131,25 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
137
131
|
newFormat = dayName + ", " + dayDate + " " + monthName + " " + year;
|
138
132
|
break;
|
139
133
|
case "momentsAgo":
|
140
|
-
|
141
|
-
|
134
|
+
var diff = 0;
|
135
|
+
var diffMinute = 0;
|
142
136
|
if (todayTS >= dateTS) {
|
143
137
|
//check if 24hours has been passed
|
144
138
|
if (todayTS >= (dateTS + 86400)) {
|
145
139
|
newFormat = dayName + ", " + dayDate + " " + monthName + " " + year + " at " + strTime;
|
146
|
-
}
|
140
|
+
}
|
141
|
+
else {
|
147
142
|
//check if hour has been passed
|
148
143
|
if (todayTS >= dateTS + 3600) {
|
149
144
|
diff = todayTS - dateTS;
|
150
145
|
if (diff === 0) {
|
151
146
|
newFormat = "An hour ago";
|
152
147
|
}
|
153
|
-
|
154
|
-
|
155
|
-
newFormat =
|
156
|
-
}
|
148
|
+
var diffHour_1 = diff / 3600;
|
149
|
+
diffHour_1 = ~~diffHour_1;
|
150
|
+
newFormat = diffHour_1 === 1 ? "An hour ago" : diffHour_1 + " hours ago";
|
151
|
+
}
|
152
|
+
else {
|
157
153
|
//check if a minute has been passed
|
158
154
|
if (todayTS >= dateTS + 60) {
|
159
155
|
diff = todayTS - dateTS;
|
@@ -161,60 +157,67 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
161
157
|
newFormat = "A minute ago";
|
162
158
|
}
|
163
159
|
diffMinute = diff / 60;
|
164
|
-
diffMinute = ~~diffMinute
|
160
|
+
diffMinute = ~~diffMinute;
|
165
161
|
newFormat = diffMinute === 1 ? "A minute ago" : diffMinute + " minutes ago";
|
166
|
-
}
|
167
|
-
|
168
|
-
|
162
|
+
}
|
163
|
+
else {
|
164
|
+
var diff_1 = todayTS - dateTS;
|
165
|
+
if (diff_1 === 0 || diff_1 <= 10) {
|
169
166
|
newFormat = "Few seconds ago";
|
170
|
-
}
|
167
|
+
}
|
168
|
+
else {
|
171
169
|
newFormat = "Few seconds ago";
|
172
170
|
}
|
173
171
|
}
|
174
172
|
}
|
175
173
|
}
|
176
|
-
}
|
174
|
+
}
|
175
|
+
else {
|
177
176
|
newFormat = dayName + ", " + dayDate + " " + monthName + " " + year + " at " + strTime;
|
178
177
|
}
|
179
|
-
|
180
178
|
break;
|
181
179
|
case "momentsAgoConvo":
|
182
|
-
|
180
|
+
var diffHour = 0;
|
183
181
|
if (todayTS >= dateTS) {
|
184
182
|
//check if 24hours has been passed
|
185
183
|
if (todayTS >= (dateTS + 86400)) {
|
186
184
|
newFormat = dayName + ", " + dayDate + " " + monthName + " " + year + " at " + strTime + " (PH)";
|
187
|
-
}
|
185
|
+
}
|
186
|
+
else {
|
188
187
|
//check if hour has been passed
|
189
188
|
if (todayTS >= dateTS + 3600) {
|
190
|
-
|
191
|
-
if (
|
189
|
+
var diff_2 = todayTS - dateTS;
|
190
|
+
if (diff_2 === 0) {
|
192
191
|
newFormat = "An hour ago";
|
193
192
|
}
|
194
|
-
diffHour =
|
195
|
-
diffHour = ~~diffHour
|
193
|
+
diffHour = diff_2 / 3600;
|
194
|
+
diffHour = ~~diffHour;
|
196
195
|
newFormat = diffHour === 1 ? "An hour ago" : diffHour + " hours ago";
|
197
|
-
}
|
196
|
+
}
|
197
|
+
else {
|
198
198
|
//check if a minute has been passed
|
199
199
|
if (todayTS >= dateTS + 60) {
|
200
|
-
|
201
|
-
if (
|
200
|
+
var diff_3 = todayTS - dateTS;
|
201
|
+
if (diff_3 === 0) {
|
202
202
|
newFormat = "A minute ago";
|
203
203
|
}
|
204
|
-
|
205
|
-
|
206
|
-
newFormat =
|
207
|
-
}
|
208
|
-
|
209
|
-
|
204
|
+
var diffMinute_1 = diff_3 / 60;
|
205
|
+
diffMinute_1 = ~~diffMinute_1;
|
206
|
+
newFormat = diffMinute_1 === 1 ? "A minute ago" : diffMinute_1 + " minutes ago";
|
207
|
+
}
|
208
|
+
else {
|
209
|
+
var diff_4 = todayTS - dateTS;
|
210
|
+
if (diff_4 === 0 || diff_4 <= 10) {
|
210
211
|
newFormat = "Few moments ago";
|
211
|
-
}
|
212
|
+
}
|
213
|
+
else {
|
212
214
|
newFormat = "Few seconds ago";
|
213
215
|
}
|
214
216
|
}
|
215
217
|
}
|
216
218
|
}
|
217
|
-
}
|
219
|
+
}
|
220
|
+
else {
|
218
221
|
//Mon, 01 Jan 2020 (PH)
|
219
222
|
newFormat = dayName + ", " + dayDate + " " + monthName + " " + year + " at " + strTime + " (PH)";
|
220
223
|
}
|
@@ -223,17 +226,19 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
223
226
|
if (todayTS >= dateTS) {
|
224
227
|
//check if 24hours has been passed
|
225
228
|
if (todayTS >= (dateTS + 86400)) {
|
226
|
-
|
227
|
-
if (
|
229
|
+
var diff_5 = todayTS - dateTS;
|
230
|
+
if (diff_5 === 0) {
|
228
231
|
newFormat = "1 day";
|
229
232
|
}
|
230
|
-
|
231
|
-
diffDay = ~~diffDay
|
233
|
+
var diffDay = diff_5 / 86400;
|
234
|
+
diffDay = ~~diffDay;
|
232
235
|
newFormat = diffDay === 1 ? "1 day" : diffDay + " days";
|
233
|
-
}
|
236
|
+
}
|
237
|
+
else {
|
234
238
|
newFormat = "0 day";
|
235
239
|
}
|
236
|
-
}
|
240
|
+
}
|
241
|
+
else {
|
237
242
|
newFormat = "0 day";
|
238
243
|
}
|
239
244
|
break;
|
@@ -251,28 +256,22 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
251
256
|
break;
|
252
257
|
case "start-of-Week":
|
253
258
|
//calculating the first day of the week
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
let startWeekDayDate = ("0" + startWeekDayNewDate.getDate()).slice(-2);
|
261
|
-
let startWeekYear = startWeekDayNewDate.getFullYear();
|
262
|
-
|
259
|
+
var startWeekD = new Date(date);
|
260
|
+
var startWeekDay = startWeekD.getDay(), startWeekDiff = startWeekD.getDate() - startWeekDay;
|
261
|
+
var startWeekDayNewDate = new Date(startWeekD.setDate(startWeekDiff));
|
262
|
+
var startWeekMonthName = monthNames[startWeekDayNewDate.getMonth()];
|
263
|
+
var startWeekDayDate = ("0" + startWeekDayNewDate.getDate()).slice(-2);
|
264
|
+
var startWeekYear = startWeekDayNewDate.getFullYear();
|
263
265
|
newFormat = startWeekMonthName + " " + startWeekDayDate + ", " + startWeekYear;
|
264
266
|
//Feb 07, 2021
|
265
267
|
break;
|
266
268
|
case "end-of-Week":
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
let endWeekDayDate = ("0" + endWeekDayNewDate.getDate()).slice(-2);
|
274
|
-
let endWeekYear = endWeekDayNewDate.getFullYear();
|
275
|
-
|
269
|
+
var endWeekD = new Date(date);
|
270
|
+
var endWeekDay = endWeekD.getDay(), endWeekDiff = endWeekD.getDate() - endWeekDay + 6;
|
271
|
+
var endWeekDayNewDate = new Date(endWeekD.setDate(endWeekDiff));
|
272
|
+
var endWeekMonthName = monthNames[endWeekDayNewDate.getMonth()];
|
273
|
+
var endWeekDayDate = ("0" + endWeekDayNewDate.getDate()).slice(-2);
|
274
|
+
var endWeekYear = endWeekDayNewDate.getFullYear();
|
276
275
|
newFormat = endWeekMonthName + " " + endWeekDayDate + ", " + endWeekYear;
|
277
276
|
//Feb 13, 2021
|
278
277
|
break;
|
@@ -293,7 +292,7 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
293
292
|
//February 2021
|
294
293
|
break;
|
295
294
|
case "datetime-format-forPosting":
|
296
|
-
|
295
|
+
var forPostingDay = String(date.getUTCDate());
|
297
296
|
if (forPostingDay.length === 1) {
|
298
297
|
forPostingDay = "0" + forPostingDay;
|
299
298
|
}
|
@@ -343,8 +342,8 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
343
342
|
newFormat = dayName + ", " + monthName + " " + dayDate;
|
344
343
|
break;
|
345
344
|
case "time-standard":
|
346
|
-
|
347
|
-
|
345
|
+
var h = isNaN(date.getHours()) ? iosDate.getHours() : date.getHours();
|
346
|
+
var hour = h < 10 ? '0' + h : h;
|
348
347
|
newFormat = hour + ':' + minutes;
|
349
348
|
// 15:30
|
350
349
|
break;
|
@@ -355,38 +354,32 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
355
354
|
case 'year-month':
|
356
355
|
newFormat = year + "-" + MonthNumeric;
|
357
356
|
break;
|
358
|
-
|
359
357
|
case "datetime-utc":
|
360
|
-
newFormat = year + "-" + MonthNumeric + "-" + dayDate + ' 00:00:00+00'
|
358
|
+
newFormat = year + "-" + MonthNumeric + "-" + dayDate + ' 00:00:00+00';
|
361
359
|
//2021-02-10 00:00:00+00
|
362
360
|
break;
|
363
|
-
|
364
|
-
|
365
361
|
case 'datetime-file-format':
|
366
362
|
hours = isNaN(date.getHours()) ? iosDate.getHours() : date.getHours();
|
367
363
|
hours = hours < 10 ? '0' + hours : hours;
|
368
|
-
newFormat = year + "-" +
|
369
|
-
|
364
|
+
newFormat = year + "-" + "".concat(MonthNumeric) + "".concat(date.getUTCDate()) + "".concat(hours) + "".concat(minutes) + "".concat(seconds) + "".concat('1');
|
370
365
|
break;
|
371
|
-
|
372
366
|
default:
|
373
367
|
newFormat = "";
|
374
368
|
break;
|
375
369
|
}
|
376
370
|
return newFormat;
|
377
|
-
}
|
371
|
+
}
|
372
|
+
else {
|
378
373
|
return "";
|
379
374
|
}
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
} else {
|
375
|
+
}
|
376
|
+
else {
|
384
377
|
return "";
|
385
378
|
}
|
386
|
-
}
|
379
|
+
}
|
380
|
+
catch (error) {
|
387
381
|
console.error(error, 'Invalid input. Please check helpers (datetimeFormatter).');
|
388
382
|
return "";
|
389
383
|
}
|
390
|
-
}
|
391
|
-
|
392
|
-
export default datetimeFormatter;
|
384
|
+
};
|
385
|
+
export default datetimeFormatter;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
interface IInformationProps {
|
3
|
+
items: any;
|
4
|
+
listRow: Array<string | object>;
|
5
|
+
desc: boolean;
|
6
|
+
title?: string;
|
7
|
+
hide: (event: React.DOMAttributes<HTMLDivElement> | React.MouseEventHandler<HTMLDivElement> | undefined | any) => void;
|
8
|
+
}
|
9
|
+
declare const Information: React.FunctionComponent<IInformationProps>;
|
10
|
+
export default Information;
|
@@ -0,0 +1,38 @@
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
13
|
+
import React, { useState } from 'react';
|
14
|
+
import { SVG_ARROWDOWN, SVG_ARROW_UP } from './assets/Asset';
|
15
|
+
var Information = function (_a) {
|
16
|
+
var items = _a.items, listRow = _a.listRow, desc = _a.desc, title = _a.title, hide = _a.hide;
|
17
|
+
var _b = useState(null), rowAnchorEl = _b[0], setRowAnchorEl = _b[1];
|
18
|
+
var renderHtml = function (html) {
|
19
|
+
return _jsx("div", { dangerouslySetInnerHTML: { __html: html } });
|
20
|
+
};
|
21
|
+
var showRowDetails = function (e, idx) {
|
22
|
+
e && e.preventDefault();
|
23
|
+
if (rowAnchorEl === idx) {
|
24
|
+
rowAnchorEl = null;
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
rowAnchorEl = idx;
|
28
|
+
}
|
29
|
+
setRowAnchorEl(rowAnchorEl);
|
30
|
+
};
|
31
|
+
var View = function () {
|
32
|
+
return _jsx(React.Fragment, { children: _jsx("div", __assign({ className: "em-popover-i" }, { children: typeof desc != 'undefined' && desc ? (_jsxs("div", __assign({ className: "em-popover-i-content" }, { children: [_jsxs("div", __assign({ className: "em-popover-i-title" }, { children: [_jsx("h6", { children: title }), _jsx("div", { className: "em-popover-i-close", onClick: hide })] })), _jsx("div", { children: typeof items != 'undefined' && items ? renderHtml(items) : '' })] }))) : (_jsxs("div", __assign({ className: "em-popover-i-content" }, { children: [_jsxs("div", __assign({ className: "em-popover-i-title" }, { children: [_jsx("h6", { children: title }), _jsx("div", { className: "em-popover-i-close", onClick: hide })] })), listRow ? (listRow.length >= 1 ? (listRow.map(function (item, key) { return (_jsxs(React.Fragment, { children: [_jsxs("div", __assign({ className: "em-popover-i-category", onClick: function (event) { return showRowDetails(event, key); } }, { children: [_jsx("div", { children: _jsx("h6", { children: item }) }), rowAnchorEl === key ? (SVG_ARROW_UP) : (SVG_ARROWDOWN)] })), rowAnchorEl === key ? (_jsx("div", __assign({ className: "em-popover-i-details" }, { children: item === 'COMPANY POLICY' ? (typeof items != 'undefined' && typeof items.companyPolicy != 'undefined' && items.companyPolicy ? renderHtml(items.companyPolicy) : '') :
|
33
|
+
(item === 'SYSTEM POLICY' ? (typeof items != 'undefined' && typeof items.systemPolicy != 'undefined' && items.systemPolicy ? renderHtml(items.systemPolicy) : '') :
|
34
|
+
(typeof items != 'undefined' && typeof items.instruction != 'undefined' && items.instruction ? renderHtml(items.instruction) : '')) }))) : null] }, key)); })) : null) : null] }))) })) });
|
35
|
+
};
|
36
|
+
return View();
|
37
|
+
};
|
38
|
+
export default Information;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import '../scss/style.scss';
|
3
|
+
interface IMenuBarProps {
|
4
|
+
config?: any;
|
5
|
+
info?: any;
|
6
|
+
button?: {
|
7
|
+
show: boolean;
|
8
|
+
actions?: Array<object>;
|
9
|
+
};
|
10
|
+
dropdown?: any;
|
11
|
+
search?: any;
|
12
|
+
pagination?: any;
|
13
|
+
pivot?: any;
|
14
|
+
check?: any;
|
15
|
+
toggle?: any;
|
16
|
+
mainButton?: any;
|
17
|
+
buttonFooter?: any;
|
18
|
+
undoButton?: any;
|
19
|
+
customClass?: string;
|
20
|
+
children: any;
|
21
|
+
getActions: any;
|
22
|
+
}
|
23
|
+
declare const MenuBar: React.FunctionComponent<IMenuBarProps>;
|
24
|
+
export default MenuBar;
|