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.
- package/README.md +240 -236
- package/package.json +5 -2
- package/src/main/DatetimeFormatter.js +24 -21
- package/src/main/DatetimeFormatter.tsx +7 -4
- package/src/main/Information.js +13 -15
- package/src/main/Information.tsx +40 -36
- package/src/main/MenuBar.d.ts +0 -1
- package/src/main/MenuBar.js +26 -22
- package/src/main/MenuBar.tsx +41 -37
- package/src/main/Modal.d.ts +1 -0
- package/src/main/Modal.js +5 -5
- package/src/main/Modal.tsx +7 -10
- package/src/main/assets/Asset.d.ts +1 -0
- package/src/main/assets/Asset.js +5 -1
- package/src/main/assets/Asset.tsx +9 -0
- package/src/main/inputs/Input.d.ts +0 -1
- package/src/main/inputs/Input.js +0 -1
- package/src/main/inputs/Input.tsx +0 -1
- package/src/main/inputs/Select.d.ts +0 -1
- package/src/main/inputs/Select.js +3 -3
- package/src/main/inputs/Select.tsx +3 -3
- package/src/main/tsconfig.common.json +2 -1
- package/src/main/tsconfig.json +1 -0
- package/src/sample/App.d.ts +0 -1
- package/src/sample/App.js +1 -1
- package/src/sample/App.tsx +2 -1
- package/src/sample/TestMenuBar.js +24 -4
- package/src/sample/TestMenuBar.tsx +40 -10
- package/src/scss/components/_modal.scss +41 -30
- package/src/scss/elements/_button.scss +1 -3
- package/src/scss/elements/_popover.scss +6 -38
- package/src/scss/foundation/_mixins.scss +0 -2
- package/src/scss/foundation/_typography.scss +0 -4
- package/src/scss/library/_information.scss +68 -0
- package/{dist/scss/library/input.scss → src/scss/library/_input.scss} +0 -2
- package/{dist/scss/library/menubar.scss → src/scss/library/_menubar.scss} +0 -2
- package/{dist/scss/library/select.scss → src/scss/library/_select.scss} +0 -4
- package/src/scss/style.scss +21 -5
- package/dist/assets/Asset.d.ts +0 -14
- package/dist/assets/Asset.js +0 -43
- package/dist/assets/Asset.tsx +0 -66
- package/dist/assets/icons/icon-check-white-sm.svg +0 -3
- package/dist/assets/images/icon-arrowdown-graydark.svg +0 -3
- package/dist/assets/images/icon-arrowleft-graydark.svg +0 -3
- package/dist/assets/images/icon-arrowright-graydark.svg +0 -3
- package/dist/assets/images/icon-arrowup-graydark.svg +0 -3
- package/dist/assets/images/icon-check-graydark.svg +0 -3
- package/dist/cjs/DatetimeFormatter.d.ts +0 -3
- package/dist/cjs/DatetimeFormatter.js +0 -386
- package/dist/cjs/Information.d.ts +0 -10
- package/dist/cjs/Information.js +0 -64
- package/dist/cjs/MenuBar.d.ts +0 -25
- package/dist/cjs/MenuBar.js +0 -534
- package/dist/cjs/Modal.d.ts +0 -32
- package/dist/cjs/Modal.js +0 -32
- package/dist/cjs/assets/Asset.d.ts +0 -14
- package/dist/cjs/assets/Asset.js +0 -28
- package/dist/cjs/constants/Constant.d.ts +0 -15
- package/dist/cjs/constants/Constant.js +0 -35
- package/dist/cjs/index.d.ts +0 -3
- package/dist/cjs/index.js +0 -10
- package/dist/cjs/inputs/Input.d.ts +0 -26
- package/dist/cjs/inputs/Input.js +0 -107
- package/dist/cjs/inputs/InputSelectionHandler.d.ts +0 -3
- package/dist/cjs/inputs/InputSelectionHandler.js +0 -36
- package/dist/cjs/inputs/Select.d.ts +0 -29
- package/dist/cjs/inputs/Select.js +0 -403
- package/dist/esm/DatetimeFormatter.d.ts +0 -3
- package/dist/esm/DatetimeFormatter.js +0 -382
- package/dist/esm/Information.d.ts +0 -10
- package/dist/esm/Information.js +0 -36
- package/dist/esm/MenuBar.d.ts +0 -25
- package/dist/esm/MenuBar.js +0 -529
- package/dist/esm/Modal.d.ts +0 -32
- package/dist/esm/Modal.js +0 -27
- package/dist/esm/assets/Asset.d.ts +0 -14
- package/dist/esm/assets/Asset.js +0 -25
- package/dist/esm/constants/Constant.d.ts +0 -15
- package/dist/esm/constants/Constant.js +0 -32
- package/dist/esm/index.d.ts +0 -3
- package/dist/esm/index.js +0 -3
- package/dist/esm/inputs/Input.d.ts +0 -26
- package/dist/esm/inputs/Input.js +0 -105
- package/dist/esm/inputs/InputSelectionHandler.d.ts +0 -3
- package/dist/esm/inputs/InputSelectionHandler.js +0 -31
- package/dist/esm/inputs/Select.d.ts +0 -29
- package/dist/esm/inputs/Select.js +0 -399
- package/dist/scss/components/_index.scss +0 -1
- package/dist/scss/components/_modal.scss +0 -55
- package/dist/scss/elements/_button.scss +0 -109
- package/dist/scss/elements/_index.scss +0 -2
- package/dist/scss/elements/_popover.scss +0 -40
- package/dist/scss/foundation/_colors.scss +0 -60
- package/dist/scss/foundation/_index.scss +0 -5
- package/dist/scss/foundation/_mixins.scss +0 -43
- package/dist/scss/foundation/_normalize.scss +0 -204
- package/dist/scss/foundation/_settings.scss +0 -36
- package/dist/scss/foundation/_typography.scss +0 -99
- package/dist/scss/library/_index.scss +0 -3
- package/dist/scss/style.scss +0 -8
- package/src/scss/components/_index.scss +0 -1
- package/src/scss/foundation/_index.scss +0 -5
- package/src/scss/library/_index.scss +0 -3
- package/src/scss/library/input.scss +0 -39
- package/src/scss/library/menubar.scss +0 -227
- package/src/scss/library/select.scss +0 -262
@@ -137,6 +137,8 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
137
137
|
newFormat = dayName + ", " + dayDate + " " + monthName + " " + year;
|
138
138
|
break;
|
139
139
|
case "momentsAgo":
|
140
|
+
let diff = 0;
|
141
|
+
let diffMinute = 0;
|
140
142
|
if (todayTS >= dateTS) {
|
141
143
|
//check if 24hours has been passed
|
142
144
|
if (todayTS >= (dateTS + 86400)) {
|
@@ -144,7 +146,7 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
144
146
|
} else {
|
145
147
|
//check if hour has been passed
|
146
148
|
if (todayTS >= dateTS + 3600) {
|
147
|
-
|
149
|
+
diff = todayTS - dateTS;
|
148
150
|
if (diff === 0) {
|
149
151
|
newFormat = "An hour ago";
|
150
152
|
}
|
@@ -154,11 +156,11 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
154
156
|
} else {
|
155
157
|
//check if a minute has been passed
|
156
158
|
if (todayTS >= dateTS + 60) {
|
157
|
-
|
159
|
+
diff = todayTS - dateTS;
|
158
160
|
if (diff === 0) {
|
159
161
|
newFormat = "A minute ago";
|
160
162
|
}
|
161
|
-
|
163
|
+
diffMinute = diff / 60;
|
162
164
|
diffMinute = ~~diffMinute
|
163
165
|
newFormat = diffMinute === 1 ? "A minute ago" : diffMinute + " minutes ago";
|
164
166
|
} else {
|
@@ -177,6 +179,7 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
177
179
|
|
178
180
|
break;
|
179
181
|
case "momentsAgoConvo":
|
182
|
+
let diffHour = 0;
|
180
183
|
if (todayTS >= dateTS) {
|
181
184
|
//check if 24hours has been passed
|
182
185
|
if (todayTS >= (dateTS + 86400)) {
|
@@ -188,7 +191,7 @@ const datetimeFormatter = (timestamp: string | Date | any, format: string = "dat
|
|
188
191
|
if (diff === 0) {
|
189
192
|
newFormat = "An hour ago";
|
190
193
|
}
|
191
|
-
|
194
|
+
diffHour = diff / 3600;
|
192
195
|
diffHour = ~~diffHour
|
193
196
|
newFormat = diffHour === 1 ? "An hour ago" : diffHour + " hours ago";
|
194
197
|
} else {
|
package/src/main/Information.js
CHANGED
@@ -22,16 +22,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
22
|
__setModuleDefault(result, mod);
|
23
23
|
return result;
|
24
24
|
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
26
|
var react_1 = __importStar(require("react"));
|
30
|
-
// @ts-ignore
|
31
|
-
var react_render_html_1 = __importDefault(require("react-render-html"));
|
32
27
|
var Information = function (_a) {
|
33
28
|
var items = _a.items, listRow = _a.listRow, desc = _a.desc, title = _a.title, hide = _a.hide;
|
34
29
|
var _b = (0, react_1.useState)(null), rowAnchorEl = _b[0], setRowAnchorEl = _b[1];
|
30
|
+
var renderHtml = function (html) {
|
31
|
+
return react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: html } });
|
32
|
+
};
|
35
33
|
var showRowDetails = function (e, idx) {
|
36
34
|
e && e.preventDefault();
|
37
35
|
if (rowAnchorEl === idx) {
|
@@ -44,22 +42,22 @@ var Information = function (_a) {
|
|
44
42
|
};
|
45
43
|
var View = function () {
|
46
44
|
return react_1.default.createElement(react_1.default.Fragment, null,
|
47
|
-
react_1.default.createElement("div", { className: "popover
|
48
|
-
react_1.default.createElement("div", { className: "popover-i-title" },
|
45
|
+
react_1.default.createElement("div", { className: "em-popover-i" }, typeof desc != 'undefined' && desc ? (react_1.default.createElement("div", { className: "em-popover-i-content" },
|
46
|
+
react_1.default.createElement("div", { className: "em-popover-i-title" },
|
49
47
|
react_1.default.createElement("h6", null, title),
|
50
|
-
react_1.default.createElement("div", { className: "popover-i-close", onClick: hide })),
|
51
|
-
react_1.default.createElement("div", null, typeof items != 'undefined' && items ? (
|
52
|
-
react_1.default.createElement("div", { className: "popover-i-title" },
|
48
|
+
react_1.default.createElement("div", { className: "em-popover-i-close", onClick: hide })),
|
49
|
+
react_1.default.createElement("div", null, typeof items != 'undefined' && items ? renderHtml(items) : ''))) : (react_1.default.createElement("div", { className: "em-popover-i-content" },
|
50
|
+
react_1.default.createElement("div", { className: "em-popover-i-title" },
|
53
51
|
react_1.default.createElement("h6", null, title),
|
54
|
-
react_1.default.createElement("div", { className: "popover-i-close", onClick: hide })),
|
52
|
+
react_1.default.createElement("div", { className: "em-popover-i-close", onClick: hide })),
|
55
53
|
listRow ? (listRow.length >= 1 ? (listRow.map(function (item, key) { return (react_1.default.createElement(react_1.default.Fragment, { key: key },
|
56
|
-
react_1.default.createElement("div", { className: "popover-i-category", onClick: function (event) { return showRowDetails(event, key); } },
|
54
|
+
react_1.default.createElement("div", { className: "em-popover-i-category", onClick: function (event) { return showRowDetails(event, key); } },
|
57
55
|
react_1.default.createElement("div", null,
|
58
56
|
react_1.default.createElement("h6", null, item)),
|
59
57
|
rowAnchorEl === key ? (react_1.default.createElement("img", { src: "/images/icons/icon-arrowup-gray.svg", alt: "" })) : (react_1.default.createElement("img", { src: "/images/icons/icon-arrowdown-gray.svg", alt: "" }))),
|
60
|
-
rowAnchorEl === key ? (react_1.default.createElement("div", { className: "popover-i-details" }, item === 'COMPANY POLICY' ? (typeof items != 'undefined' && typeof items.companyPolicy != 'undefined' && items.companyPolicy ? (
|
61
|
-
(item === 'SYSTEM POLICY' ? (typeof items != 'undefined' && typeof items.systemPolicy != 'undefined' && items.systemPolicy ? (
|
62
|
-
(typeof items != 'undefined' && typeof items.instruction != 'undefined' && items.instruction ? (
|
58
|
+
rowAnchorEl === key ? (react_1.default.createElement("div", { className: "em-popover-i-details" }, item === 'COMPANY POLICY' ? (typeof items != 'undefined' && typeof items.companyPolicy != 'undefined' && items.companyPolicy ? renderHtml(items.companyPolicy) : '') :
|
59
|
+
(item === 'SYSTEM POLICY' ? (typeof items != 'undefined' && typeof items.systemPolicy != 'undefined' && items.systemPolicy ? renderHtml(items.systemPolicy) : '') :
|
60
|
+
(typeof items != 'undefined' && typeof items.instruction != 'undefined' && items.instruction ? renderHtml(items.instruction) : '')))) : null)); })) : null) : null))));
|
63
61
|
};
|
64
62
|
return View();
|
65
63
|
};
|
package/src/main/Information.tsx
CHANGED
@@ -1,31 +1,35 @@
|
|
1
1
|
|
2
|
-
import React, {useState} from 'react';
|
2
|
+
import React, { useState } from 'react';
|
3
3
|
// @ts-ignore
|
4
|
-
import renderHtml from 'react-render-html';
|
4
|
+
// import renderHtml from 'react-render-html';
|
5
5
|
|
6
6
|
|
7
7
|
interface IInformationProps {
|
8
8
|
items: any,
|
9
|
-
listRow:Array<string | object>,
|
10
|
-
desc:boolean,
|
11
|
-
title?:string
|
12
|
-
hide: (event: React.DOMAttributes<HTMLDivElement> |
|
9
|
+
listRow: Array<string | object>,
|
10
|
+
desc: boolean,
|
11
|
+
title?: string
|
12
|
+
hide: (event: React.DOMAttributes<HTMLDivElement> | React.MouseEventHandler<HTMLDivElement> | undefined | any) => void
|
13
13
|
|
14
14
|
|
15
15
|
}
|
16
16
|
|
17
|
-
const Information: React.FunctionComponent<IInformationProps> = ({items, listRow, desc,title, hide}) => {
|
17
|
+
const Information: React.FunctionComponent<IInformationProps> = ({ items, listRow, desc, title, hide }) => {
|
18
18
|
|
19
|
-
let [rowAnchorEl, setRowAnchorEl] = useState<number|null>(null);
|
19
|
+
let [rowAnchorEl, setRowAnchorEl] = useState<number | null>(null);
|
20
|
+
|
21
|
+
const renderHtml = (html: any) => {
|
22
|
+
|
23
|
+
return <div dangerouslySetInnerHTML={{ __html: html }} />;
|
24
|
+
}
|
20
25
|
|
21
|
-
|
22
26
|
|
23
27
|
|
24
|
-
const
|
28
|
+
const showRowDetails = (e: React.MouseEvent<HTMLDivElement, MouseEvent>, idx: number) => {
|
25
29
|
e && e.preventDefault();
|
26
|
-
|
30
|
+
|
27
31
|
if (rowAnchorEl === idx) {
|
28
|
-
rowAnchorEl =
|
32
|
+
rowAnchorEl = null
|
29
33
|
} else {
|
30
34
|
rowAnchorEl = idx
|
31
35
|
}
|
@@ -33,33 +37,33 @@ const Information: React.FunctionComponent<IInformationProps> = ({items, listRow
|
|
33
37
|
setRowAnchorEl(rowAnchorEl)
|
34
38
|
}
|
35
39
|
|
36
|
-
|
37
|
-
const View = () =>{
|
40
|
+
|
41
|
+
const View = () => {
|
38
42
|
return <React.Fragment>
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
<div className="em-popover-i">
|
44
|
+
|
45
|
+
{
|
46
|
+
typeof desc != 'undefined' && desc ? (
|
47
|
+
<div className="em-popover-i-content">
|
48
|
+
<div className="em-popover-i-title">
|
49
|
+
<h6>{title}</h6>
|
50
|
+
<div className="em-popover-i-close" onClick={hide}></div>
|
51
|
+
</div>
|
52
|
+
<div>{typeof items != 'undefined' && items ? renderHtml(items) : ''}
|
53
|
+
</div>
|
49
54
|
</div>
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
<div className="popover-i-title">
|
55
|
+
) : (
|
56
|
+
<div className="em-popover-i-content">
|
57
|
+
<div className="em-popover-i-title">
|
54
58
|
<h6>{title}</h6>
|
55
|
-
<div className="popover-i-close" onClick={hide}></div>
|
59
|
+
<div className="em-popover-i-close" onClick={hide}></div>
|
56
60
|
</div>
|
57
61
|
{listRow ? (
|
58
62
|
listRow.length >= 1 ? (
|
59
|
-
listRow.map((item:any, key) => (
|
63
|
+
listRow.map((item: any, key) => (
|
60
64
|
|
61
65
|
<React.Fragment key={key}>
|
62
|
-
<div className="popover-i-category" onClick={(event) => showRowDetails(event, key)}>
|
66
|
+
<div className="em-popover-i-category" onClick={(event) => showRowDetails(event, key)}>
|
63
67
|
<div>
|
64
68
|
<h6>{item}</h6>
|
65
69
|
</div>
|
@@ -70,7 +74,7 @@ const Information: React.FunctionComponent<IInformationProps> = ({items, listRow
|
|
70
74
|
</div>
|
71
75
|
{
|
72
76
|
rowAnchorEl === key ? (
|
73
|
-
<div className="popover-i-details">
|
77
|
+
<div className="em-popover-i-details">
|
74
78
|
{item === 'COMPANY POLICY' ? (
|
75
79
|
typeof items != 'undefined' && typeof items.companyPolicy != 'undefined' && items.companyPolicy ? renderHtml(items.companyPolicy) : '') :
|
76
80
|
(item === 'SYSTEM POLICY' ? (typeof items != 'undefined' && typeof items.systemPolicy != 'undefined' && items.systemPolicy ? renderHtml(items.systemPolicy) : '') :
|
@@ -91,13 +95,13 @@ const Information: React.FunctionComponent<IInformationProps> = ({items, listRow
|
|
91
95
|
}
|
92
96
|
</div>
|
93
97
|
)
|
94
|
-
|
95
|
-
|
96
|
-
|
98
|
+
}
|
99
|
+
</div>
|
100
|
+
</React.Fragment>
|
97
101
|
}
|
98
102
|
|
99
103
|
|
100
|
-
|
104
|
+
return View();
|
101
105
|
};
|
102
106
|
|
103
107
|
export default Information;
|
package/src/main/MenuBar.d.ts
CHANGED
package/src/main/MenuBar.js
CHANGED
@@ -50,7 +50,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
/* eslint-disable jsx-a11y/anchor-is-valid */
|
51
51
|
var react_1 = __importStar(require("react"));
|
52
52
|
require("../scss/style.scss");
|
53
|
-
require("../scss/library/menubar.scss");
|
54
53
|
// Imports
|
55
54
|
var Asset_1 = require("./assets/Asset");
|
56
55
|
var Constant_1 = require("./constants/Constant");
|
@@ -82,15 +81,16 @@ var MenuBar = function (_a) {
|
|
82
81
|
var _s = (0, react_1.useState)(undoButton && undoButton.show ? true : false), undoShow = _s[0], setUndoShow = _s[1];
|
83
82
|
var _t = (0, react_1.useState)(false), doneTimer = _t[0], setDoneTimer = _t[1];
|
84
83
|
(0, react_1.useEffect)(function () {
|
84
|
+
var filteredMonthList = [];
|
85
85
|
if (dropdown && dropdown.minMonth) {
|
86
|
-
|
86
|
+
filteredMonthList = __spreadArray([], Constant_1.MONTH_LIST, true).filter(function (item) { return (item.value.toLowerCase() === dropdown.minMonth.toLowerCase()); });
|
87
87
|
if (filteredMonthList.length > 0) {
|
88
88
|
minMonthIdx = Constant_1.MONTH_LIST.indexOf(filteredMonthList[0]);
|
89
89
|
setMinMonthIdx(minMonthIdx);
|
90
90
|
}
|
91
91
|
}
|
92
92
|
if (dropdown && dropdown.maxMonth) {
|
93
|
-
|
93
|
+
filteredMonthList = __spreadArray([], Constant_1.MONTH_LIST, true).filter(function (item) { return (item.value.toLowerCase() === dropdown.maxMonth.toLowerCase()); });
|
94
94
|
if (filteredMonthList.length > 0) {
|
95
95
|
maxMonthIdx = Constant_1.MONTH_LIST.indexOf(filteredMonthList[0]);
|
96
96
|
setMaxMonthIdx(maxMonthIdx);
|
@@ -352,6 +352,11 @@ var MenuBar = function (_a) {
|
|
352
352
|
var dateMonthlyPickerHandler = function (e, action, data) {
|
353
353
|
if (data === void 0) { data = ''; }
|
354
354
|
var _a = __assign({}, dropdown), maxYear = _a.maxYear, minYear = _a.minYear;
|
355
|
+
var newDateValue = null;
|
356
|
+
var standardDate = null;
|
357
|
+
var selectedMonthDate = null;
|
358
|
+
var monthIdx = null;
|
359
|
+
var fullYear = null;
|
355
360
|
if (action === 'next') {
|
356
361
|
if (!maxYear || (maxYear && parseInt(maxYear) >= calendarYear + 1)) {
|
357
362
|
calendarYear += 1;
|
@@ -365,15 +370,14 @@ var MenuBar = function (_a) {
|
|
365
370
|
}
|
366
371
|
}
|
367
372
|
else if (action === 'month-selection') {
|
368
|
-
|
373
|
+
newDateValue = (0, DatetimeFormatter_1.default)(data + ' ' + calendarYear, 'month-year');
|
369
374
|
actionRequestHandler(e, 'dropdown', newDateValue);
|
370
375
|
}
|
371
376
|
else if (action === 'next-month') {
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
var fullYear = selectedMonthDate.getFullYear();
|
377
|
+
standardDate = (0, DatetimeFormatter_1.default)(dropdown.selection.startDate, 'date-standard');
|
378
|
+
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;
|
379
|
+
monthIdx = selectedMonthDate.getMonth();
|
380
|
+
fullYear = selectedMonthDate.getFullYear();
|
377
381
|
if (monthIdx + 1 < 12) {
|
378
382
|
monthIdx = monthIdx + 1;
|
379
383
|
}
|
@@ -382,16 +386,15 @@ var MenuBar = function (_a) {
|
|
382
386
|
fullYear = fullYear + 1;
|
383
387
|
}
|
384
388
|
if ((!maxYear && !maxMonthIdx) || fullYear < parseInt(maxYear) || (fullYear === parseInt(maxYear) && monthIdx <= parseInt(maxMonthIdx))) {
|
385
|
-
|
389
|
+
newDateValue = (0, DatetimeFormatter_1.default)(Constant_1.MONTH_LIST[monthIdx].value + ' ' + fullYear, 'month-year');
|
386
390
|
actionRequestHandler(e, 'dropdown', newDateValue, false);
|
387
391
|
}
|
388
392
|
}
|
389
393
|
else if (action === 'prev-month') {
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
var fullYear = selectedMonthDate.getFullYear();
|
394
|
+
standardDate = (0, DatetimeFormatter_1.default)(dropdown.selection.startDate, 'date-standard');
|
395
|
+
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;
|
396
|
+
monthIdx = selectedMonthDate.getMonth();
|
397
|
+
fullYear = selectedMonthDate.getFullYear();
|
395
398
|
if (monthIdx - 1 >= 0) {
|
396
399
|
monthIdx = monthIdx - 1;
|
397
400
|
}
|
@@ -400,8 +403,8 @@ var MenuBar = function (_a) {
|
|
400
403
|
fullYear = fullYear - 1;
|
401
404
|
}
|
402
405
|
if ((!minYear && !minMonthIdx) || fullYear > parseInt(minYear) || (fullYear === parseInt(minYear) && monthIdx >= parseInt(minMonthIdx))) {
|
403
|
-
var
|
404
|
-
actionRequestHandler(e, 'dropdown',
|
406
|
+
var newDateValue_1 = (0, DatetimeFormatter_1.default)(Constant_1.MONTH_LIST[monthIdx].value + ' ' + fullYear, 'month-year');
|
407
|
+
actionRequestHandler(e, 'dropdown', newDateValue_1, false);
|
405
408
|
}
|
406
409
|
}
|
407
410
|
};
|
@@ -477,11 +480,12 @@ var MenuBar = function (_a) {
|
|
477
480
|
// Title Information Configuration
|
478
481
|
config && config.titleDescription ? (react_1.default.createElement("p", null, config.titleDescription)) : null),
|
479
482
|
// Information Configuration
|
480
|
-
config && config.
|
481
|
-
react_1.default.createElement("
|
482
|
-
react_1.default.createElement("
|
483
|
-
|
484
|
-
react_1.default.createElement(
|
483
|
+
config && config.showInfo.constructor === Boolean && config.showInfo === true ? (react_1.default.createElement(react_1.Fragment, null,
|
484
|
+
react_1.default.createElement("div", { className: "em-belt-info" },
|
485
|
+
react_1.default.createElement("a", { href: "#", onClick: function (event) { return popoverRequestHandler(event, 'info'); }, "data-testid": "menubar-information" },
|
486
|
+
react_1.default.createElement("div", { className: "em-info-icon" }, Asset_1.SVG_INFORMATION)),
|
487
|
+
react_1.default.createElement(Select_1.Popover, { id: "InfoPopOver", open: Boolean(infoPopover), className: Boolean(dropdownPopover) ? 'open-popover' : '', onClick: function (event) { return popoverRequestHandler(event, 'info'); } },
|
488
|
+
react_1.default.createElement(Information_1.default, { 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,
|
485
489
|
// Additional title on the modal
|
486
490
|
config && config.addedTitle ? (react_1.default.createElement("p", null, config.addedTitle)) : null),
|
487
491
|
react_1.default.createElement("div", { className: "em-beltleft-cta" },
|
package/src/main/MenuBar.tsx
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
/* eslint-disable no-useless-concat */
|
2
2
|
/* eslint-disable jsx-a11y/anchor-is-valid */
|
3
3
|
import React, { useState, Fragment, useEffect } from "react";
|
4
|
-
|
5
4
|
import '../scss/style.scss';
|
6
|
-
import '../scss/library/menubar.scss';
|
7
5
|
|
8
6
|
// Imports
|
9
|
-
import { SVG_BACK, SVG_CLOSE_GRAY, SVG_ARROWLEFT, SVG_ARROWRIGHT, SVG_CHECK, SVG_ARROWDOWN } from './assets/Asset';
|
7
|
+
import { SVG_BACK, SVG_CLOSE_GRAY, SVG_ARROWLEFT, SVG_ARROWRIGHT, SVG_CHECK, SVG_ARROWDOWN, SVG_INFORMATION } from './assets/Asset';
|
10
8
|
import { CHECKBOX, MONTH_LIST, INFO_LOADER, PAGE_OPTION } from "./constants/Constant";
|
11
9
|
import Information from './Information';
|
12
10
|
import Input from './inputs/InputSelectionHandler';
|
@@ -65,15 +63,16 @@ const MenuBar: React.FunctionComponent<IMenuBarProps> = ({ config, info, button,
|
|
65
63
|
let [doneTimer, setDoneTimer] = useState<boolean>(false);
|
66
64
|
|
67
65
|
useEffect(() => {
|
66
|
+
let filteredMonthList = []
|
68
67
|
if (dropdown && dropdown.minMonth) {
|
69
|
-
|
68
|
+
filteredMonthList = [...MONTH_LIST].filter(item => (item.value.toLowerCase() === dropdown.minMonth.toLowerCase()));
|
70
69
|
if (filteredMonthList.length > 0) {
|
71
70
|
minMonthIdx = MONTH_LIST.indexOf(filteredMonthList[0]);
|
72
71
|
setMinMonthIdx(minMonthIdx);
|
73
72
|
}
|
74
73
|
}
|
75
74
|
if (dropdown && dropdown.maxMonth) {
|
76
|
-
|
75
|
+
filteredMonthList = [...MONTH_LIST].filter(item => (item.value.toLowerCase() === dropdown.maxMonth.toLowerCase()));
|
77
76
|
if (filteredMonthList.length > 0) {
|
78
77
|
maxMonthIdx = MONTH_LIST.indexOf(filteredMonthList[0]);
|
79
78
|
setMaxMonthIdx(maxMonthIdx);
|
@@ -380,6 +379,11 @@ const MenuBar: React.FunctionComponent<IMenuBarProps> = ({ config, info, button,
|
|
380
379
|
let dateMonthlyPickerHandler = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | React.MouseEvent<HTMLButtonElement, MouseEvent>, action: string, data: string = '') => {
|
381
380
|
type opt = { maxYear: string; minYear: string; }
|
382
381
|
let { maxYear, minYear }: opt = { ...dropdown }
|
382
|
+
let newDateValue = null;
|
383
|
+
let standardDate = null;
|
384
|
+
let selectedMonthDate=null;
|
385
|
+
let monthIdx = null;
|
386
|
+
let fullYear = null;
|
383
387
|
if (action === 'next') {
|
384
388
|
if (!maxYear || (maxYear && parseInt(maxYear) >= calendarYear + 1)) {
|
385
389
|
calendarYear += 1;
|
@@ -391,14 +395,13 @@ const MenuBar: React.FunctionComponent<IMenuBarProps> = ({ config, info, button,
|
|
391
395
|
setCalendarYear(calendarYear)
|
392
396
|
}
|
393
397
|
} else if (action === 'month-selection') {
|
394
|
-
|
398
|
+
newDateValue = datetimeFormatter(data + ' ' + calendarYear, 'month-year');
|
395
399
|
actionRequestHandler(e, 'dropdown', newDateValue);
|
396
400
|
} else if (action === 'next-month') {
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
let fullYear = selectedMonthDate.getFullYear();
|
401
|
+
standardDate = datetimeFormatter(dropdown.selection.startDate, 'date-standard');
|
402
|
+
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;
|
403
|
+
monthIdx = selectedMonthDate.getMonth();
|
404
|
+
fullYear = selectedMonthDate.getFullYear();
|
402
405
|
if (monthIdx + 1 < 12) {
|
403
406
|
monthIdx = monthIdx + 1;
|
404
407
|
} else {
|
@@ -406,16 +409,15 @@ const MenuBar: React.FunctionComponent<IMenuBarProps> = ({ config, info, button,
|
|
406
409
|
fullYear = fullYear + 1;
|
407
410
|
}
|
408
411
|
if ((!maxYear && !maxMonthIdx) || fullYear < parseInt(maxYear) || (fullYear === parseInt(maxYear) && monthIdx <= parseInt(maxMonthIdx))) {
|
409
|
-
|
412
|
+
newDateValue = datetimeFormatter(MONTH_LIST[monthIdx].value + ' ' + fullYear, 'month-year');
|
410
413
|
actionRequestHandler(e, 'dropdown', newDateValue, false);
|
411
414
|
}
|
412
415
|
} else if (action === 'prev-month') {
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
let fullYear = selectedMonthDate.getFullYear();
|
416
|
+
standardDate = datetimeFormatter(dropdown.selection.startDate, 'date-standard');
|
417
|
+
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;
|
418
|
+
|
419
|
+
monthIdx = selectedMonthDate.getMonth();
|
420
|
+
fullYear = selectedMonthDate.getFullYear();
|
419
421
|
if (monthIdx - 1 >= 0) {
|
420
422
|
monthIdx = monthIdx - 1;
|
421
423
|
} else {
|
@@ -565,28 +567,30 @@ const MenuBar: React.FunctionComponent<IMenuBarProps> = ({ config, info, button,
|
|
565
567
|
|
566
568
|
{
|
567
569
|
// Information Configuration
|
568
|
-
config && config.
|
570
|
+
config && config.showInfo.constructor === Boolean && config.showInfo===true ? (
|
569
571
|
<Fragment>
|
570
|
-
<
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
572
|
+
<div className="em-belt-info">
|
573
|
+
<a href="#" onClick={event => popoverRequestHandler(event, 'info')}
|
574
|
+
data-testid="menubar-information">
|
575
|
+
<div className="em-info-icon">{SVG_INFORMATION}</div>
|
576
|
+
</a>
|
577
|
+
<Popover
|
578
|
+
id="InfoPopOver"
|
579
|
+
open={Boolean(infoPopover)}
|
580
|
+
className={Boolean(dropdownPopover) ? 'open-popover' : ''}
|
581
|
+
onClick={event => popoverRequestHandler(event, 'info')}
|
582
|
+
>
|
580
583
|
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
584
|
+
<Information
|
585
|
+
items={info && info.infoDetails ? info.infoDetails : info}
|
586
|
+
listRow={info && info.listRow ? info.listRow : []}
|
587
|
+
desc={info && info.listRow && info.listRow.length > 0 ? false : true}
|
588
|
+
title={config && config.title ? config.title.toUpperCase() : null}
|
589
|
+
hide={event => popoverRequestHandler(event, 'info', true)}
|
590
|
+
/>
|
588
591
|
|
589
|
-
|
592
|
+
</Popover>
|
593
|
+
</div>
|
590
594
|
</Fragment>
|
591
595
|
) : null
|
592
596
|
}
|
package/src/main/Modal.d.ts
CHANGED
package/src/main/Modal.js
CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var react_1 = __importDefault(require("react"));
|
7
7
|
var react_dom_1 = __importDefault(require("react-dom"));
|
8
8
|
var MenuBar_1 = __importDefault(require("./MenuBar"));
|
9
|
+
require("../scss/style.scss");
|
9
10
|
var Modal = function (_a) {
|
10
11
|
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;
|
11
12
|
var sendActions = function (actions, data) {
|
@@ -15,10 +16,9 @@ var Modal = function (_a) {
|
|
15
16
|
if (addedParam === void 0) { addedParam = null; }
|
16
17
|
return getActions ? getActions(action, data, addedParam) : false;
|
17
18
|
};
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
react_1.default.createElement("div", { className: "card-content" }, children))) : react_1.default.createElement("div", { className: "card-content" }, children)))), document.getElementById('root')) : null);
|
19
|
+
return (show ? react_dom_1.default.createPortal(react_1.default.createElement("div", { className: "em-modal " + customClass },
|
20
|
+
react_1.default.createElement("div", { className: "em-modal-container", "data-testid": id ? id : 'default-modal-test' },
|
21
|
+
react_1.default.createElement("div", { className: "em-card card-modal modal-".concat(config.modalSize ? config.modalSize : 'md') }, !hideMenuBar ? (react_1.default.createElement(MenuBar_1.default, { 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); } },
|
22
|
+
react_1.default.createElement("div", { className: "em-card-content" }, children))) : react_1.default.createElement("div", { className: "em-card-content card-content" }, children)))), document.getElementById('root')) : null);
|
23
23
|
};
|
24
24
|
exports.default = Modal;
|
package/src/main/Modal.tsx
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import ReactDOM from "react-dom";
|
3
3
|
import MenuBar from "./MenuBar";
|
4
|
+
import '../scss/style.scss';
|
5
|
+
|
4
6
|
|
5
7
|
interface IModalProps {
|
6
8
|
id?:string,
|
@@ -45,16 +47,11 @@ const Modal: React.FunctionComponent<IModalProps> = ({id, show,hideMenuBar, conf
|
|
45
47
|
return getActions ? getActions(action, data, addedParam) : false;
|
46
48
|
}
|
47
49
|
|
48
|
-
|
49
|
-
console.log(hideMenuBar, 'hideMenuBar')
|
50
|
-
|
51
|
-
|
52
|
-
|
53
50
|
return (
|
54
51
|
show ? ReactDOM.createPortal(
|
55
|
-
<div className="
|
56
|
-
<div className="
|
57
|
-
<div className={`card card-modal modal-${config.modalSize ? config.modalSize : 'md'}`}>
|
52
|
+
<div className={"em-modal "+ customClass }>
|
53
|
+
<div className="em-modal-container" data-testid={id ? id : 'default-modal-test'}>
|
54
|
+
<div className={`em-card card-modal modal-${config.modalSize ? config.modalSize : 'md'}`}>
|
58
55
|
{
|
59
56
|
!hideMenuBar ? (
|
60
57
|
<MenuBar
|
@@ -71,9 +68,9 @@ const Modal: React.FunctionComponent<IModalProps> = ({id, show,hideMenuBar, conf
|
|
71
68
|
info={info}
|
72
69
|
getActions={(actions:any,data:any) => sendActions(actions,data)}
|
73
70
|
>
|
74
|
-
<div className="card-content">{ children }</div>
|
71
|
+
<div className="em-card-content">{ children }</div>
|
75
72
|
</MenuBar>
|
76
|
-
) : <div className="card-content">{ children }</div>
|
73
|
+
) : <div className="em-card-content card-content">{ children }</div>
|
77
74
|
}
|
78
75
|
</div>
|
79
76
|
</div>
|
package/src/main/assets/Asset.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.SVG_ADD = exports.SVG_REQUEST = exports.SVG_ARROWDOWN = exports.SVG_ARROWLEFT = exports.SVG_ARROWRIGHT = exports.SVG_UNDO = exports.SVG_SUBMIT = exports.SVG_CLOSE_GRAY = exports.SVG_CHECK_NEUTRAL = exports.SVG_CHECK_INACTIVE = exports.SVG_CHECK_ACTIVE = exports.SVG_CHECK = exports.SVG_BACK = void 0;
|
6
|
+
exports.SVG_INFORMATION = exports.SVG_ADD = exports.SVG_REQUEST = exports.SVG_ARROWDOWN = exports.SVG_ARROWLEFT = exports.SVG_ARROWRIGHT = exports.SVG_UNDO = exports.SVG_SUBMIT = exports.SVG_CLOSE_GRAY = exports.SVG_CHECK_NEUTRAL = exports.SVG_CHECK_INACTIVE = exports.SVG_CHECK_ACTIVE = exports.SVG_CHECK = exports.SVG_BACK = void 0;
|
7
7
|
var react_1 = __importDefault(require("react"));
|
8
8
|
exports.SVG_BACK = react_1.default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
9
9
|
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.69612 4.29289C8.08664 4.68342 8.08664 5.31658 7.69612 5.70711L3.40323 10L7.69612 14.2929C8.08664 14.6834 8.08664 15.3166 7.69612 15.7071C7.3056 16.0976 6.67243 16.0976 6.28191 15.7071L1.28191 10.7071C0.891382 10.3166 0.891382 9.68342 1.28191 9.29289L6.28191 4.29289C6.67243 3.90237 7.3056 3.90237 7.69612 4.29289Z", fill: "#393F5A" }),
|
@@ -41,3 +41,7 @@ exports.SVG_REQUEST = react_1.default.createElement("svg", { width: "20", height
|
|
41
41
|
exports.SVG_ADD = react_1.default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
42
42
|
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10 2C10.5523 2 11 2.44772 11 3V17C11 17.5523 10.5523 18 10 18C9.44772 18 9 17.5523 9 17V3C9 2.44772 9.44772 2 10 2Z", fill: "#393F5A" }),
|
43
43
|
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2 10C2 9.44772 2.44772 9 3 9L17 9C17.5523 9 18 9.44772 18 10C18 10.5523 17.5523 11 17 11L3 11C2.44772 11 2 10.5523 2 10Z", fill: "#393F5A" }));
|
44
|
+
exports.SVG_INFORMATION = react_1.default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
45
|
+
react_1.default.createElement("rect", { x: "1", y: "1", width: "18", height: "18", rx: "9", stroke: "#9FA5B7", strokeWidth: "2" }),
|
46
|
+
react_1.default.createElement("path", { d: "M10 9V14", stroke: "#9FA5B7", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
47
|
+
react_1.default.createElement("circle", { cx: "10", cy: "6", r: "1", fill: "#9FA5B7" }));
|
@@ -64,3 +64,12 @@ export const SVG_ADD = <svg width="20" height="20" viewBox="0 0 20 20" fill="non
|
|
64
64
|
<path fillRule="evenodd" clipRule="evenodd" d="M10 2C10.5523 2 11 2.44772 11 3V17C11 17.5523 10.5523 18 10 18C9.44772 18 9 17.5523 9 17V3C9 2.44772 9.44772 2 10 2Z" fill="#393F5A"/>
|
65
65
|
<path fillRule="evenodd" clipRule="evenodd" d="M2 10C2 9.44772 2.44772 9 3 9L17 9C17.5523 9 18 9.44772 18 10C18 10.5523 17.5523 11 17 11L3 11C2.44772 11 2 10.5523 2 10Z" fill="#393F5A"/>
|
66
66
|
</svg>
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
export const SVG_INFORMATION = <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
71
|
+
<rect x="1" y="1" width="18" height="18" rx="9" stroke="#9FA5B7" strokeWidth="2"/>
|
72
|
+
<path d="M10 9V14" stroke="#9FA5B7" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
73
|
+
<circle cx="10" cy="6" r="1" fill="#9FA5B7"/>
|
74
|
+
</svg>
|
75
|
+
|