awing-library 2.1.65-beta → 2.1.67-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.
@@ -16,15 +16,6 @@ var useStyles = (0, styles_1.makeStyles)(function () { return ({
16
16
  borderBottom: '1px solid #a3a3a345',
17
17
  },
18
18
  highlight: {},
19
- // theme.palette.type === 'light'
20
- // ? {
21
- // color: theme.palette.secondary.main,
22
- // backgroundColor: lighten(theme.palette.secondary.light, 0.85),
23
- // }
24
- // : {
25
- // color: theme.palette.text.primary,
26
- // backgroundColor: theme.palette.secondary.dark,
27
- // },
28
19
  title: {
29
20
  flex: '1 1 100%',
30
21
  },
@@ -28,7 +28,6 @@ var icons_material_1 = require("@mui/icons-material");
28
28
  var GetApp_1 = __importDefault(require("@mui/icons-material/GetApp"));
29
29
  var material_1 = require("@mui/material");
30
30
  var styles_1 = require("@mui/styles");
31
- var moment_1 = __importDefault(require("moment"));
32
31
  var react_1 = require("react");
33
32
  var react_i18next_1 = require("react-i18next");
34
33
  var AWING_1 = require("../../AWING");
@@ -94,7 +93,7 @@ function ControlPanel(_a) {
94
93
  var handleElementInput = function (initialFilters) {
95
94
  var updatedElementInputs = [];
96
95
  initialFilters.map(function (item, idx) {
97
- var _a, _b;
96
+ var _a, _b, _c, _d;
98
97
  switch (item === null || item === void 0 ? void 0 : item.type) {
99
98
  case Enums_1.TYPE_FILTERS.VIEW_BY: {
100
99
  var element = __assign({ component: ((0, jsx_runtime_1.jsx)(material_1.TextField, { select: true, fullWidth: true, label: t('Common.ViewBy'), size: "small", onChange: function (e) {
@@ -125,11 +124,7 @@ function ControlPanel(_a) {
125
124
  break;
126
125
  }
127
126
  case Enums_1.TYPE_FILTERS.DATE_RANGE_PICKER: {
128
- var element = __assign({ component: ((0, jsx_runtime_1.jsx)(AWING_1.DateRangePicker, __assign({ isShowCalendarInfo: true, label: "".concat(t('Common.StartDate'), " - ").concat(t('Common.EndDate')), initialStartDate: (item === null || item === void 0 ? void 0 : item.isPassTime)
129
- ? (0, moment_1.default)()
130
- : (0, moment_1.default)().subtract(7, 'days'), initialEndDate: (item === null || item === void 0 ? void 0 : item.isPassTime)
131
- ? (0, moment_1.default)().add(7, 'days')
132
- : (0, moment_1.default)(), variant: "outlined", textFieldProps: {
127
+ var element = __assign({ component: ((0, jsx_runtime_1.jsx)(AWING_1.DateRangePicker, __assign({ isShowCalendarInfo: true, label: "".concat(t('Common.StartDate'), " - ").concat(t('Common.EndDate')), initialStartDate: (_a = item === null || item === void 0 ? void 0 : item.defaultValue) === null || _a === void 0 ? void 0 : _a.startDate, initialEndDate: (_b = item === null || item === void 0 ? void 0 : item.defaultValue) === null || _b === void 0 ? void 0 : _b.endDate, variant: "outlined", textFieldProps: {
133
128
  fullWidth: true,
134
129
  className: classes.outlinedInput,
135
130
  }, callback: handleChangeDateRange }, ((item === null || item === void 0 ? void 0 : item.isDayBlocked) && {
@@ -172,7 +167,7 @@ function ControlPanel(_a) {
172
167
  break;
173
168
  }
174
169
  case Enums_1.TYPE_FILTERS.NETWORK: {
175
- var element = __assign({ component: ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { color: "primary", defaultChecked: (_a = queryInput === null || queryInput === void 0 ? void 0 : queryInput.isCampaignNetwork) !== null && _a !== void 0 ? _a : true }), label: t('Statistic.Network.Title'), labelPlacement: "start", onChange: function (e) {
170
+ var element = __assign({ component: ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { color: "primary", defaultChecked: (_c = queryInput === null || queryInput === void 0 ? void 0 : queryInput.isCampaignNetwork) !== null && _c !== void 0 ? _c : true }), label: t('Statistic.Network.Title'), labelPlacement: "start", onChange: function (e) {
176
171
  handleChangeQueryInput(item === null || item === void 0 ? void 0 : item.name, e.target.checked);
177
172
  } }, idx)), isEnhanced: (item === null || item === void 0 ? void 0 : item.isEnhanced) ? item === null || item === void 0 ? void 0 : item.isEnhanced : false, name: 'isCampaignNetwork' }, item);
178
173
  updatedElementInputs.push(element);
@@ -186,7 +181,7 @@ function ControlPanel(_a) {
186
181
  break;
187
182
  }
188
183
  case Enums_1.TYPE_FILTERS.INCLUDE_RESERVED: {
189
- var element = __assign({ component: ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { color: "primary", defaultChecked: (_b = queryInput === null || queryInput === void 0 ? void 0 : queryInput.includeReserved) !== null && _b !== void 0 ? _b : true }), label: t('StatisticSchedulePlan.IncludeCampaignReserved'), labelPlacement: "start", onChange: function (e) {
184
+ var element = __assign({ component: ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { color: "primary", defaultChecked: (_d = queryInput === null || queryInput === void 0 ? void 0 : queryInput.includeReserved) !== null && _d !== void 0 ? _d : true }), label: t('StatisticSchedulePlan.IncludeCampaignReserved'), labelPlacement: "start", onChange: function (e) {
190
185
  handleChangeQueryInput(item === null || item === void 0 ? void 0 : item.name, e.target.checked);
191
186
  } }, idx)), isEnhanced: (item === null || item === void 0 ? void 0 : item.isEnhanced) ? item === null || item === void 0 ? void 0 : item.isEnhanced : false, name: 'includeReserved' }, item);
192
187
  updatedElementInputs.push(element);
@@ -59,7 +59,7 @@ var PageManagement = function (props) {
59
59
  // }, [queryInput, onChangeQueryInput, window.location.pathname]);
60
60
  (0, react_1.useEffect)(function () {
61
61
  var _a;
62
- if (((_a = location.state) === null || _a === void 0 ? void 0 : _a.action) === ClassicDrawer_1.CloseAction.Reload ||
62
+ if (((_a = location.state) === null || _a === void 0 ? void 0 : _a.pageAction) === ClassicDrawer_1.CloseAction.Reload ||
63
63
  !(0, lodash_1.isEqual)(queryInput, cachedQueryInput.current)) {
64
64
  handleChangeQueryInput(queryInput);
65
65
  cachedQueryInput.current = (0, lodash_1.cloneDeep)(queryInput);
@@ -23,7 +23,7 @@ export declare function logicExpressionValid(value: string | null | undefined):
23
23
  * @param invertRegex - The inverted regular expression pattern to match against the text string. Default is undefined.
24
24
  * @returns An object containing the validation result and a message describing any validation errors.
25
25
  */
26
- export declare const textValidation: (str: string, length?: number, required?: boolean, pattern?: RegExp, invertRegex?: RegExp) => {
26
+ export declare const textValidation: (str: string, length?: number, required?: boolean, pattern?: RegExp, invertRegex?: RegExp | false) => {
27
27
  valid: boolean;
28
28
  message: string;
29
29
  };
@@ -113,10 +113,12 @@ var textValidation = function (str, length, required, pattern, invertRegex) {
113
113
  .replace(/[\u0300-\u036f]/g, '')
114
114
  .replace(/đ/g, 'd')
115
115
  .trim();
116
- var invertedRegex = invertRegex || new RegExp("[^".concat(pattern.source.replace(/[*+?^${}|]/g, ''), "]").replace(/\[\[|\]\]/g, ']'), 'g');
117
116
  if (textTransform && pattern && !pattern.test(textTransform)) {
118
117
  validRes.valid = false;
119
- validRes.message.push("".concat(i18n_1.default.t('Common.InvalidChars'), ": ").concat(Array.from(new Set(textTransform.match(invertedRegex))).join(' ')));
118
+ if (invertRegex !== false) {
119
+ var invertedRegex = invertRegex || new RegExp("[^".concat(pattern.source.replace(/[*+?^${}|]/g, ''), "]").replace(/\[\[|\]\]/g, ']'), 'g');
120
+ validRes.message.push("".concat(i18n_1.default.t('Common.InvalidChars'), ": ").concat(Array.from(new Set(textTransform.match(invertedRegex))).join(' ')));
121
+ }
120
122
  }
121
123
  var byteSize = new Blob([str]).size;
122
124
  if (byteSize > length) {
@@ -67,7 +67,7 @@ var Drawer = function (props) {
67
67
  var _a;
68
68
  ((_a = location.state) === null || _a === void 0 ? void 0 : _a.type) === 'history'
69
69
  ? navigate(-1)
70
- : navigate('..', { state: __assign(__assign({}, location.state), { action: action }) });
70
+ : navigate('..', { state: __assign(__assign({}, location.state), { pageAction: action }) });
71
71
  }, 100);
72
72
  };
73
73
  var doPromise = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.65-beta",
3
+ "version": "2.1.67-beta",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",