awing-library 2.1.11-beta → 2.1.13-beta

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.
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -49,7 +60,6 @@ var Constant_1 = __importDefault(require("../Constant"));
49
60
  var react_router_dom_1 = require("react-router-dom");
50
61
  var Context_1 = __importDefault(require("../../../Context"));
51
62
  var react_i18next_1 = require("react-i18next");
52
- var uniq = require('lodash/uniq');
53
63
  function MenuDirectory() {
54
64
  var _this = this;
55
65
  var _a = (0, react_1.useContext)(Context_1.default), service = _a.service, i18next = _a.i18next;
@@ -61,13 +71,16 @@ function MenuDirectory() {
61
71
  handleFetchData();
62
72
  }, []);
63
73
  var handleConvertedData = function () { return __awaiter(_this, void 0, void 0, function () {
64
- var res, convertedData;
74
+ var res, temp, convertedData;
65
75
  return __generator(this, function (_a) {
66
76
  switch (_a.label) {
67
77
  case 0: return [4 /*yield*/, service.menusGetAll()];
68
78
  case 1:
69
79
  res = _a.sent();
70
- convertedData = (0, function_1.convertMenuData)(res);
80
+ temp = res.map(function (item) {
81
+ return __assign(__assign({}, item), { name: t("Menu.MenuName.Menu_".concat(item.menuId)) });
82
+ });
83
+ convertedData = (0, function_1.convertMenuData)(temp);
71
84
  return [2 /*return*/, convertedData[0]];
72
85
  }
73
86
  });
@@ -63,6 +63,14 @@ function ControlPanel(_a) {
63
63
  var _c = (0, react_1.useState)(), queryInput = _c[0], setQueryInput = _c[1];
64
64
  var _d = (0, react_1.useState)([]), elementInputs = _d[0], setElementInputs = _d[1];
65
65
  var _e = (0, react_1.useState)(false), isShowFilterEnhanced = _e[0], setIsHideFieldAdvanced = _e[1];
66
+ var _f = (0, react_1.useState)(0), flagView = _f[0], setFlagView = _f[1];
67
+ var getView = function () {
68
+ onChangeQueryInput(queryInput);
69
+ setFlagView(flagView + 1);
70
+ };
71
+ var disabledViewBy = (queryInput === null || queryInput === void 0 ? void 0 : queryInput.campaignIds) &&
72
+ (queryInput === null || queryInput === void 0 ? void 0 : queryInput.campaignIds.length) > 0 &&
73
+ flagView > 0;
66
74
  var handleInitialFilter = function (initialFilters) {
67
75
  var initValue = initialFilters === null || initialFilters === void 0 ? void 0 : initialFilters.reduce(function (acc, curr) {
68
76
  if ((curr === null || curr === void 0 ? void 0 : curr.type) === Enums_1.TYPE_FILTERS.DATE_RANGE_PICKER) {
@@ -93,7 +101,7 @@ function ControlPanel(_a) {
93
101
  return item === null || item === void 0 ? void 0 : item.onChange(Number(e.target.value));
94
102
  }, SelectProps: {
95
103
  native: true,
96
- }, variant: "outlined", style: { minWidth: 160 }, disabled: isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.chartLoading, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("option", { value: Number(item === null || item === void 0 ? void 0 : item.initialData[0].value), children: item === null || item === void 0 ? void 0 : item.initialData[0].label }), (0, jsx_runtime_1.jsx)("option", { value: Number(item === null || item === void 0 ? void 0 : item.initialData[1].value), children: item === null || item === void 0 ? void 0 : item.initialData[1].label })] }) }, idx)), isEnhanced: (item === null || item === void 0 ? void 0 : item.isEnhanced) ? item === null || item === void 0 ? void 0 : item.isEnhanced : false, name: 'viewBy' }, item);
104
+ }, variant: "outlined", style: { minWidth: 160 }, disabled: (isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.chartLoading) || !disabledViewBy, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("option", { value: Number(item === null || item === void 0 ? void 0 : item.initialData[0].value), children: item === null || item === void 0 ? void 0 : item.initialData[0].label }), (0, jsx_runtime_1.jsx)("option", { value: Number(item === null || item === void 0 ? void 0 : item.initialData[1].value), children: item === null || item === void 0 ? void 0 : item.initialData[1].label })] }) }, idx)), isEnhanced: (item === null || item === void 0 ? void 0 : item.isEnhanced) ? item === null || item === void 0 ? void 0 : item.isEnhanced : false, name: 'viewBy' }, item);
97
105
  updatedElementInputs.push(element);
98
106
  break;
99
107
  }
@@ -217,9 +225,7 @@ function ControlPanel(_a) {
217
225
  paddingTop: '24px',
218
226
  display: 'flex',
219
227
  flex: 'none',
220
- }, justifyContent: "flex-end", children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", onClick: function () {
221
- onChangeQueryInput(queryInput);
222
- }, style: { height: '40px' }, disabled: (_b = isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.chartLoading) !== null && _b !== void 0 ? _b : false, children: t('Common.View') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", title: t('Common.Download'), onClick: function () { return onChangeExportInput(queryInput); }, color: "inherit", disabled: isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.exportLoading, style: {
228
+ }, justifyContent: "flex-end", children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", onClick: getView, style: { height: '40px' }, disabled: (_b = isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.chartLoading) !== null && _b !== void 0 ? _b : false, children: t('Common.View') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", title: t('Common.Download'), onClick: function () { return onChangeExportInput(queryInput); }, color: "inherit", disabled: isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.exportLoading, style: {
223
229
  marginLeft: '16px',
224
230
  height: '40px',
225
231
  }, children: (isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.exportLoading) ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, { styleWrap: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.11-beta",
3
+ "version": "2.1.13-beta",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",