empower-container 0.1.3 → 0.1.6
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/dist/cjs/DatetimeFormatter.js +24 -21
- package/dist/cjs/Information.js +6 -8
- package/dist/cjs/MenuBar.d.ts +0 -1
- package/dist/cjs/MenuBar.js +21 -18
- package/dist/cjs/Modal.d.ts +1 -0
- package/dist/cjs/Modal.js +2 -2
- package/dist/cjs/assets/Asset.d.ts +1 -0
- package/dist/cjs/assets/Asset.js +2 -1
- package/dist/cjs/inputs/Input.d.ts +0 -1
- package/dist/cjs/inputs/Input.js +0 -1
- package/dist/cjs/inputs/InputSelectionHandler.d.ts +1 -1
- package/dist/cjs/inputs/Select.d.ts +0 -1
- package/dist/cjs/inputs/Select.js +3 -3
- package/dist/esm/DatetimeFormatter.js +24 -21
- package/dist/esm/Information.js +4 -3
- package/dist/esm/MenuBar.d.ts +0 -1
- package/dist/esm/MenuBar.js +22 -19
- package/dist/esm/Modal.d.ts +1 -0
- package/dist/esm/Modal.js +2 -2
- package/dist/esm/assets/Asset.d.ts +1 -0
- package/dist/esm/assets/Asset.js +1 -0
- package/dist/esm/inputs/Input.d.ts +0 -1
- package/dist/esm/inputs/Input.js +0 -1
- package/dist/esm/inputs/Select.d.ts +0 -1
- package/dist/esm/inputs/Select.js +3 -3
- package/dist/scss/components/_modal.scss +41 -30
- package/dist/scss/elements/_button.scss +1 -3
- package/dist/scss/elements/_popover.scss +6 -38
- package/dist/scss/foundation/_mixins.scss +0 -2
- package/dist/scss/foundation/_typography.scss +0 -4
- package/dist/scss/library/_information.scss +68 -0
- package/dist/scss/library/{input.scss → _input.scss} +0 -2
- package/dist/scss/library/{menubar.scss → _menubar.scss} +0 -2
- package/{src/scss/library/select.scss → dist/scss/library/_select.scss} +0 -4
- package/dist/scss/style.scss +21 -5
- package/package.json +6 -3
- 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/src/scss/library/{input.scss → _input.scss} +0 -2
- package/src/scss/library/{menubar.scss → _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/scss/components/_index.scss +0 -1
- package/dist/scss/foundation/_index.scss +0 -5
- package/dist/scss/library/_index.scss +0 -3
- 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/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
|
+
|
package/src/main/inputs/Input.js
CHANGED
@@ -36,7 +36,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
37
37
|
var react_1 = __importStar(require("react"));
|
38
38
|
require("../../scss/style.scss");
|
39
|
-
require("../../scss/library/input.scss");
|
40
39
|
var sanitizeValue = function (txt, props) {
|
41
40
|
var pattern = null;
|
42
41
|
var newTxt = txt;
|
@@ -46,7 +46,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
46
|
exports.Popover = void 0;
|
47
47
|
var react_1 = __importStar(require("react"));
|
48
48
|
require("../../scss/style.scss");
|
49
|
-
require("../../scss/library/select.scss");
|
50
49
|
// Imports
|
51
50
|
var Asset_1 = require("../assets/Asset");
|
52
51
|
var Popover = function (_a) {
|
@@ -223,9 +222,10 @@ var Dropdown = function (_a) {
|
|
223
222
|
* @param {*} values - selected values of multi-select
|
224
223
|
*/
|
225
224
|
function filterOptions(search, values) {
|
225
|
+
var selectedOptionsVariable = null;
|
226
226
|
if (type === 'multi-select') {
|
227
227
|
if (optionsArray && optionsArray.constructor === Array) {
|
228
|
-
|
228
|
+
selectedOptionsVariable = selectedOptions(values);
|
229
229
|
if (options && options.constructor === Array && options.length > 0) {
|
230
230
|
optionsArray = options.filter(function (item) {
|
231
231
|
return values.indexOf(item.value) < 0 && item.label.toLowerCase().search(search.toLowerCase()) > -1;
|
@@ -238,7 +238,7 @@ var Dropdown = function (_a) {
|
|
238
238
|
}
|
239
239
|
else if (optionsArray && optionsArray.constructor === Object) {
|
240
240
|
var optionsArrayCopy_1 = {};
|
241
|
-
|
241
|
+
selectedOptionsVariable = selectedOptions(values);
|
242
242
|
if (selectedOptionsVariable.length > 0) {
|
243
243
|
selectedOptionsVariable = selectedOptionsVariable.filter(function (item) {
|
244
244
|
return item.label.toLowerCase().search(search.toLowerCase()) > -1;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import React, { useState, Fragment } from "react";
|
2
2
|
import '../../scss/style.scss';
|
3
|
-
import '../../scss/library/select.scss';
|
4
3
|
|
5
4
|
// Imports
|
6
5
|
import { SVG_BACK, SVG_CLOSE_GRAY, SVG_ARROWLEFT, SVG_ARROWRIGHT, SVG_CHECK, SVG_ARROWDOWN } from '../assets/Asset';
|
@@ -253,9 +252,10 @@ const Dropdown: React.FC<IPropsDropDown> = ({ config, customClass, onChanged, is
|
|
253
252
|
* @param {*} values - selected values of multi-select
|
254
253
|
*/
|
255
254
|
function filterOptions(search: string, values: any) {
|
255
|
+
let selectedOptionsVariable = null;
|
256
256
|
if (type === 'multi-select') {
|
257
257
|
if (optionsArray && optionsArray.constructor === Array) {
|
258
|
-
|
258
|
+
selectedOptionsVariable = selectedOptions(values);
|
259
259
|
if (options && options.constructor===Array && options.length > 0) {
|
260
260
|
optionsArray = options.filter((item:any) => {
|
261
261
|
return values.indexOf(item.value) < 0 && item.label.toLowerCase().search(search.toLowerCase()) > -1;
|
@@ -268,7 +268,7 @@ const Dropdown: React.FC<IPropsDropDown> = ({ config, customClass, onChanged, is
|
|
268
268
|
setOptionsArray([...values, ...optionsArray]);
|
269
269
|
} else if (optionsArray && optionsArray.constructor === Object) {
|
270
270
|
let optionsArrayCopy:{[index: string]:any} = {};
|
271
|
-
|
271
|
+
selectedOptionsVariable = selectedOptions(values);
|
272
272
|
if (selectedOptionsVariable.length > 0) {
|
273
273
|
selectedOptionsVariable = selectedOptionsVariable.filter((item:any) => {
|
274
274
|
return item.label.toLowerCase().search(search.toLowerCase()) > -1;
|
@@ -12,7 +12,7 @@
|
|
12
12
|
"skipLibCheck": true,
|
13
13
|
"esModuleInterop": true,
|
14
14
|
"allowSyntheticDefaultImports": true,
|
15
|
-
"strict":
|
15
|
+
"strict": false,
|
16
16
|
"forceConsistentCasingInFileNames": true,
|
17
17
|
"noFallthroughCasesInSwitch": true,
|
18
18
|
"declaration": true,
|
@@ -21,6 +21,7 @@
|
|
21
21
|
"suppressImplicitAnyIndexErrors": true,
|
22
22
|
"jsx": "react-jsx",
|
23
23
|
"outDir": "../../dist/cjs",
|
24
|
+
|
24
25
|
|
25
26
|
|
26
27
|
|