awing-library 2.1.129 → 2.1.130
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/lib/ACM-AXN/CampaignSchedule/Components/EnhancedPagination/index.js +3 -2
- package/lib/AWING/DateRangePicker/component.js +14 -8
- package/lib/AWING/DateRangePicker/configDate.d.ts +1 -2
- package/lib/AWING/DateRangePicker/configDate.js +12 -12
- package/lib/AWING/PageManagement/PageManagement.js +2 -1
- package/lib/AWING/Pagination/index.js +5 -4
- package/lib/i18n.js +2 -2
- package/package.json +1 -1
|
@@ -7,16 +7,17 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
var material_1 = require("@mui/material");
|
|
8
8
|
var react_i18next_1 = require("react-i18next");
|
|
9
9
|
var Pagination_1 = __importDefault(require("./Pagination"));
|
|
10
|
+
var i18n_1 = __importDefault(require("../../../../i18n"));
|
|
10
11
|
var EnhancedPagination = function (_a) {
|
|
11
12
|
var total = _a.total, children = _a.children, pageSize = _a.pageSize, pageIndex = _a.pageIndex, classes = _a.classes, className = _a.className, colSpan = _a.colSpan, handleChangePage = _a.handleChangePage, handleChangeRowsPerPage = _a.handleChangeRowsPerPage;
|
|
12
13
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [children, (0, jsx_runtime_1.jsx)(material_1.TableRow, { children: (0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", padding: "none", colSpan: colSpan, children: (0, jsx_runtime_1.jsx)(material_1.TablePagination, { className: "".concat(classes === null || classes === void 0 ? void 0 : classes.root, " ").concat(className), rowsPerPageOptions: [10, 20, 30], component: "div", count: total, rowsPerPage: pageSize, page: pageIndex, ActionsComponent: Pagination_1.default, labelRowsPerPage: t('Paging.RowPerPage'), onPageChange: function (e, newPage) {
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [children, (0, jsx_runtime_1.jsx)(material_1.TableRow, { children: (0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", padding: "none", colSpan: colSpan, children: (0, jsx_runtime_1.jsx)(material_1.TablePagination, { className: "".concat(classes === null || classes === void 0 ? void 0 : classes.root, " ").concat(className), rowsPerPageOptions: [10, 20, 30], component: "div", count: total, rowsPerPage: pageSize, page: pageIndex, ActionsComponent: Pagination_1.default, labelRowsPerPage: i18n_1.default.t('Paging.RowPerPage'), onPageChange: function (e, newPage) {
|
|
14
15
|
handleChangePage(newPage);
|
|
15
16
|
}, onRowsPerPageChange: function (e) {
|
|
16
17
|
return handleChangeRowsPerPage(e);
|
|
17
18
|
}, SelectProps: {
|
|
18
19
|
inputProps: {
|
|
19
|
-
'aria-label': t('Paging.RowPerPage'),
|
|
20
|
+
'aria-label': i18n_1.default.t('Paging.RowPerPage'),
|
|
20
21
|
},
|
|
21
22
|
native: true,
|
|
22
23
|
} }) }) })] }));
|
|
@@ -50,6 +50,11 @@ var icons_material_1 = require("@mui/icons-material");
|
|
|
50
50
|
var react_input_mask_1 = __importDefault(require("react-input-mask"));
|
|
51
51
|
var styles_1 = require("@mui/styles");
|
|
52
52
|
var configDate_1 = __importDefault(require("./configDate"));
|
|
53
|
+
var i18n_1 = __importDefault(require("../../i18n"));
|
|
54
|
+
var languageMap = {
|
|
55
|
+
"tha": "th",
|
|
56
|
+
"jpn": "ja",
|
|
57
|
+
};
|
|
53
58
|
var moment = require('moment');
|
|
54
59
|
require('moment/locale/vi');
|
|
55
60
|
var omit = require('lodash/omit');
|
|
@@ -157,7 +162,7 @@ var DateRangePickerWrapper = function (props) {
|
|
|
157
162
|
var _q = (0, react_1.useState)(initialEndDate), endDate = _q[0], setEndDate = _q[1];
|
|
158
163
|
var _r = (0, react_1.useState)(true), isValid = _r[0], setIsValid = _r[1];
|
|
159
164
|
var _s = (0, react_1.useState)("".concat(moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate).format('DD/MM/YYYY'), " - ").concat(moment(value ? value === null || value === void 0 ? void 0 : value.endDate : endDate).format('DD/MM/YYYY'))), inputValue = _s[0], setInputValue = _s[1];
|
|
160
|
-
var _t = (0, react_i18next_1.useTranslation)(), i18n = _t.i18n, t = _t.t;
|
|
165
|
+
var _t = (0, react_i18next_1.useTranslation)(undefined, { i18n: i18n_1.default }), i18n = _t.i18n, t = _t.t;
|
|
161
166
|
var momentLanguage = (0, react_1.useMemo)(function () { var _a, _b; return ((_b = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.language) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[0]) || 'en'; }, [i18n.language]);
|
|
162
167
|
(0, react_1.useEffect)(function () {
|
|
163
168
|
if (value !== undefined) {
|
|
@@ -177,10 +182,11 @@ var DateRangePickerWrapper = function (props) {
|
|
|
177
182
|
}
|
|
178
183
|
}, [value]);
|
|
179
184
|
(0, react_1.useEffect)(function () {
|
|
180
|
-
|
|
185
|
+
var lang = languageMap[momentLanguage] || momentLanguage;
|
|
186
|
+
if (lang !== 'en') {
|
|
181
187
|
try {
|
|
182
|
-
Promise.resolve("".concat("moment/locale/".concat(
|
|
183
|
-
moment.locale(
|
|
188
|
+
Promise.resolve("".concat("moment/locale/".concat(lang))).then(function (s) { return __importStar(require(s)); }).then(function () {
|
|
189
|
+
moment.locale(lang);
|
|
184
190
|
})
|
|
185
191
|
.catch(function (error) {
|
|
186
192
|
console.warn(error);
|
|
@@ -191,12 +197,12 @@ var DateRangePickerWrapper = function (props) {
|
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
else {
|
|
194
|
-
moment.locale(
|
|
200
|
+
moment.locale(lang);
|
|
195
201
|
}
|
|
196
202
|
if ((value ? value === null || value === void 0 ? void 0 : value.startDate : startDate) !== null &&
|
|
197
203
|
moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate).locale() !==
|
|
198
|
-
|
|
199
|
-
setStartDate(moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate).locale(
|
|
204
|
+
lang) {
|
|
205
|
+
setStartDate(moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate).locale(lang));
|
|
200
206
|
}
|
|
201
207
|
}, [momentLanguage, i18n.language, value ? value === null || value === void 0 ? void 0 : value.startDate : startDate]);
|
|
202
208
|
(0, react_1.useEffect)(function () {
|
|
@@ -288,7 +294,7 @@ var DateRangePickerWrapper = function (props) {
|
|
|
288
294
|
setIsValid(false);
|
|
289
295
|
};
|
|
290
296
|
var nextProps = __assign({}, props);
|
|
291
|
-
var presets = (0, configDate_1.default)(t,
|
|
297
|
+
var presets = (0, configDate_1.default)(isFutureDate).map(function (item) { return (item.text = i18n.t(item.text), item); });
|
|
292
298
|
var renderDatePresets = function () {
|
|
293
299
|
return ((0, jsx_runtime_1.jsx)("div", { className: classes.CustomDateRangePicker_panel, children: presets.map(function (_a) {
|
|
294
300
|
var text = _a.text, start = _a.start, end = _a.end;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { TFunction } from 'i18next';
|
|
2
1
|
import moment from 'moment';
|
|
3
|
-
declare const configInitialDate: (
|
|
2
|
+
declare const configInitialDate: (isFutureDate: boolean) => {
|
|
4
3
|
text: string;
|
|
5
4
|
start: moment.Moment;
|
|
6
5
|
end: moment.Moment;
|
|
@@ -4,63 +4,63 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var moment_1 = __importDefault(require("moment"));
|
|
7
|
-
var configInitialDate = function (
|
|
7
|
+
var configInitialDate = function (isFutureDate) {
|
|
8
8
|
var today = (0, moment_1.default)();
|
|
9
9
|
var initDatePast = [
|
|
10
10
|
{
|
|
11
|
-
text:
|
|
11
|
+
text: 'DatePicker.ToDay',
|
|
12
12
|
start: today,
|
|
13
13
|
end: today,
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
text:
|
|
16
|
+
text: 'DatePicker.Yesterday',
|
|
17
17
|
start: (0, moment_1.default)().subtract(1, 'days'),
|
|
18
18
|
end: (0, moment_1.default)().subtract(1, 'days'),
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
text:
|
|
21
|
+
text: 'DatePicker.LastSevenDay',
|
|
22
22
|
start: (0, moment_1.default)().subtract(6, 'days'),
|
|
23
23
|
end: today,
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
text:
|
|
26
|
+
text: 'DatePicker.LastThirtyDay',
|
|
27
27
|
start: (0, moment_1.default)().subtract(29, 'days'),
|
|
28
28
|
end: today,
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
text:
|
|
31
|
+
text: 'DatePicker.ThisMonth',
|
|
32
32
|
start: (0, moment_1.default)().startOf('month'),
|
|
33
33
|
end: (0, moment_1.default)().endOf('month'),
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
text:
|
|
36
|
+
text: 'DatePicker.LastMonth',
|
|
37
37
|
start: (0, moment_1.default)().subtract(1, 'month').startOf('month'),
|
|
38
38
|
end: (0, moment_1.default)().subtract(1, 'month').endOf('month'),
|
|
39
39
|
},
|
|
40
40
|
];
|
|
41
41
|
var initDateFuture = [
|
|
42
42
|
{
|
|
43
|
-
text:
|
|
43
|
+
text: 'DatePicker.ToDay',
|
|
44
44
|
start: today,
|
|
45
45
|
end: today,
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
text:
|
|
48
|
+
text: 'DatePicker.Tomorrow',
|
|
49
49
|
start: (0, moment_1.default)(),
|
|
50
50
|
end: (0, moment_1.default)().add(1, 'days'),
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
text:
|
|
53
|
+
text: 'DatePicker.NextSevenDay',
|
|
54
54
|
start: today,
|
|
55
55
|
end: (0, moment_1.default)().add(6, 'days'),
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
|
-
text:
|
|
58
|
+
text: 'DatePicker.NextThirtyDay',
|
|
59
59
|
start: today,
|
|
60
60
|
end: (0, moment_1.default)().add(29, 'days'),
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
|
-
text:
|
|
63
|
+
text: 'DatePicker.NextMonth',
|
|
64
64
|
start: (0, moment_1.default)().add(1, 'month').startOf('month'),
|
|
65
65
|
end: (0, moment_1.default)().add(1, 'month').endOf('month'),
|
|
66
66
|
},
|
|
@@ -35,8 +35,9 @@ var icons_material_1 = require("@mui/icons-material");
|
|
|
35
35
|
var lodash_1 = require("lodash");
|
|
36
36
|
var ClassicDrawer_1 = require("../../Commons/Components/ClassicDrawer");
|
|
37
37
|
var react_router_dom_1 = require("react-router-dom");
|
|
38
|
+
var i18n_1 = __importDefault(require("../../i18n"));
|
|
38
39
|
var PageManagement = function (props) {
|
|
39
|
-
var t = (0, react_i18next_1.useTranslation)().t;
|
|
40
|
+
var t = (0, react_i18next_1.useTranslation)(undefined, { i18n: i18n_1.default }).t;
|
|
40
41
|
// const params = useParams<"*">();
|
|
41
42
|
var location = (0, react_router_dom_1.useLocation)();
|
|
42
43
|
var title = props.title, columns = props.columns, rows = props.rows, _a = props.totalOfRows, totalOfRows = _a === void 0 ? rows.length : _a, getRowId = props.getRowId, checkboxSelection = props.checkboxSelection, onDeleteSelected = props.onDeleteSelected, advancedSearchFields = props.advancedSearchFields, onlyNumberSearch = props.onlyNumberSearch, _b = props.disableSearch, disableSearch = _b === void 0 ? false : _b, includeSearchById = props.includeSearchById, _c = props.disablePagination, disablePagination = _c === void 0 ? false : _c, onChangeQueryInput = props.onChangeQueryInput, _d = props.loading, loading = _d === void 0 ? true : _d, onCreateButtonClick = props.onCreateButtonClick, onRowClick = props.onRowClick, onCreateFolderButtonClick = props.onCreateFolderButtonClick, onDelete = props.onDelete, inputSearchPlaceholder = props.inputSearchPlaceholder, rowActions = props.rowActions, showNotificationSuccess = props.showNotificationSuccess, confirmDelete = props.confirmDelete, customActions = props.customActions, variantPaperSearch = props.variantPaperSearch;
|
|
@@ -23,6 +23,7 @@ var FirstPage_1 = __importDefault(require("@mui/icons-material/FirstPage"));
|
|
|
23
23
|
var KeyboardArrowLeft_1 = __importDefault(require("@mui/icons-material/KeyboardArrowLeft"));
|
|
24
24
|
var KeyboardArrowRight_1 = __importDefault(require("@mui/icons-material/KeyboardArrowRight"));
|
|
25
25
|
var LastPage_1 = __importDefault(require("@mui/icons-material/LastPage"));
|
|
26
|
+
var i18n_1 = __importDefault(require("../../i18n"));
|
|
26
27
|
var react_i18next_1 = require("react-i18next");
|
|
27
28
|
function TablePaginationActions(props) {
|
|
28
29
|
var theme = (0, styles_1.useTheme)();
|
|
@@ -43,13 +44,13 @@ function TablePaginationActions(props) {
|
|
|
43
44
|
}
|
|
44
45
|
exports.TablePaginationActions = TablePaginationActions;
|
|
45
46
|
var Pagination = function (props) {
|
|
46
|
-
var t = (0, react_i18next_1.useTranslation)().t;
|
|
47
|
+
var t = (0, react_i18next_1.useTranslation)(undefined, { i18n: i18n_1.default }).t;
|
|
47
48
|
return ((0, jsx_runtime_1.jsx)("table", { style: { float: "right" }, children: (0, jsx_runtime_1.jsx)("tbody", { children: (0, jsx_runtime_1.jsx)("tr", { children: (0, jsx_runtime_1.jsx)(TablePagination_1.default, __assign({ style: { border: 0 }, colSpan: 3, labelDisplayedRows: function (_a) {
|
|
48
49
|
var from = _a.from, to = _a.to, count = _a.count;
|
|
49
|
-
return "".concat(from, "-").concat(to, " ").concat(t('Paging.DisplayedRow'), " ").concat(count);
|
|
50
|
-
}, labelRowsPerPage: t('Paging.RowPerPage'), slotProps: {
|
|
50
|
+
return "".concat(from, "-").concat(to, " ").concat(i18n_1.default.t('Paging.DisplayedRow'), " ").concat(count);
|
|
51
|
+
}, labelRowsPerPage: i18n_1.default.t('Paging.RowPerPage'), slotProps: {
|
|
51
52
|
select: {
|
|
52
|
-
inputProps: { 'aria-label': t('Paging.RowPerPage') },
|
|
53
|
+
inputProps: { 'aria-label': i18n_1.default.t('Paging.RowPerPage') },
|
|
53
54
|
native: true,
|
|
54
55
|
}
|
|
55
56
|
}, ActionsComponent: TablePaginationActions }, props)) }) }) }));
|
package/lib/i18n.js
CHANGED