awing-library 2.1.12 → 2.1.13

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.
@@ -179,6 +179,7 @@ var ViewInfo = function (_a) {
179
179
  options: templateOptions.map(function (template) { return ({
180
180
  value: template.id,
181
181
  text: template.description,
182
+ disabled: template === null || template === void 0 ? void 0 : template.isDeprecated,
182
183
  }); }),
183
184
  },
184
185
  ], oldValue: __assign(__assign({}, viewInfoData), { templateTypeId: 0 }), onUpdate: handleChangeForm }) }));
@@ -85,6 +85,7 @@ export interface Template {
85
85
  templateTypeId: number;
86
86
  validation: string;
87
87
  autoField: string;
88
+ isDeprecated?: boolean;
88
89
  }
89
90
  export interface TemplateParameter {
90
91
  id: string;
@@ -152,7 +152,7 @@ var CreateOrEdit = function () {
152
152
  handleJobActionChange(jobActions.filter(function (x) { return x.name === name; })[0]);
153
153
  handleChange('jobAction', name);
154
154
  }, value: jobModel.jobAction, children: jobActions.map(function (item) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: item.name, children: item.name }, item.name)); }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 8, style: { marginTop: '16px' }, children: (jobModel === null || jobModel === void 0 ? void 0 : jobModel.inputParameters) && ((0, jsx_runtime_1.jsx)(InputParameters_1.default, { inputParameters: jobModel === null || jobModel === void 0 ? void 0 : jobModel.inputParameters, jobActionSelected: jobActionSelected, handleInputParamChange: handleInputParamChange })) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 6, children: (0, jsx_runtime_1.jsxs)(material_1.Grid, { container: true, children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 6, style: { paddingRight: '10px' }, children: (0, jsx_runtime_1.jsx)(BasicInput_1.default, { fullWidth: true, name: "authUsername", required: false, label: t('User.Username'), checkValid: function (value) {
155
- return (0, validation_1.textValidation)(value, 50, false);
155
+ return (0, validation_1.textValidation)(value, 150, false, /^[a-zA-Z0-9\/\-_.@()\[\] ]+$/g, false);
156
156
  }, onChange: handleChange, value: jobModel.authUsername }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 5, style: { paddingRight: '10px' }, children: (0, jsx_runtime_1.jsx)(BasicInput_1.default, { fullWidth: true, autoComplete: "current-password", name: "authPassword", type: "password", required: false, label: t('User.Password'), onChange: handleChange, value: jobModel.authPassword }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 1, children: (0, jsx_runtime_1.jsx)(material_1.Tooltip, { placement: "top", title: t('TaskScheduler.Help.Authen'), arrow: true, children: (0, jsx_runtime_1.jsx)(icons_material_1.HelpOutline, { fontSize: "small", color: "action", style: {
157
157
  marginTop: '20px',
158
158
  marginLeft: '-10px',
@@ -12,6 +12,8 @@ exports.cloneValue = exports.getFormValidation = void 0;
12
12
  var Enums_1 = require("./Enums");
13
13
  var getFormValidation = function (job, jobValid) {
14
14
  var isValid = false;
15
+ if (!Object.values(jobValid).length)
16
+ return true;
15
17
  if (job.jobType === Enums_1.JobTypeEnum.Trigger) {
16
18
  isValid =
17
19
  (Boolean(job.triggerTopic) ||
@@ -7,6 +7,7 @@ interface IChartJsContainer extends ChartProps {
7
7
  optionCustom?: any;
8
8
  chart: any;
9
9
  dataChart: any;
10
+ optionsDefault?: boolean;
10
11
  }
11
12
  declare const BarLineComponent: (props: IChartJsContainer) => import("react/jsx-runtime").JSX.Element;
12
13
  export default BarLineComponent;
@@ -21,8 +21,10 @@ var moment_1 = __importDefault(require("moment"));
21
21
  var react_i18next_1 = require("react-i18next");
22
22
  var Styles_1 = require("./Styles");
23
23
  var Enums_1 = require("./Enums");
24
+ var i18n_1 = __importDefault(require("../../i18n"));
24
25
  var BarLineComponent = function (props) {
25
- var t = (0, react_i18next_1.useTranslation)().t;
26
+ var t = (0, react_i18next_1.useTranslation)(undefined, { i18n: i18n_1.default }).t;
27
+ var optionsDefault = props.optionsDefault;
26
28
  var chart = props.chart, _a = props.width, width = _a === void 0 ? 'auto' : _a, _b = props.height, height = _b === void 0 ? 350 : _b, _c = props.timeline, timeline = _c === void 0 ? Enums_1.TYPE_TIMELINE.DAY : _c, _d = props.optionCustom, optionCustom = _d === void 0 ? {} : _d, dataChart = props.dataChart, type = props.type, _e = props.options, options = _e === void 0 ? {
27
29
  responsive: true,
28
30
  maintainAspectRatio: false,
@@ -90,33 +92,46 @@ var BarLineComponent = function (props) {
90
92
  },
91
93
  },
92
94
  scales: {
93
- x: {
94
- type: 'time',
95
- display: true,
96
- grid: { display: false },
97
- time: {
98
- parser: timeline === Enums_1.TYPE_TIMELINE.DAY
99
- ? 'YYYYMMDD'
100
- : 'YYYYMMDDHH',
101
- unit: timeline === Enums_1.TYPE_TIMELINE.DAY ? 'day' : 'hour',
95
+ x: optionsDefault
96
+ ? {
97
+ type: 'timeseries',
98
+ time: {
99
+ parser: 'YYYYMMDD',
100
+ },
101
+ unit: 'month',
102
102
  displayFormats: {
103
- day: 'DD/MM',
104
- hour: 'HH:mm',
103
+ month: 'DD/MM'
105
104
  },
106
- },
107
- offset: true,
108
- ticks: {
109
- maxTicksLimit: 10,
110
- autoSkipPadding: 16,
111
- maxRotation: 0,
112
- },
113
- title: {
114
- font: {
115
- size: 14,
116
- family: 'Roboto',
105
+ }
106
+ : {
107
+ type: 'time',
108
+ display: true,
109
+ grid: { display: false },
110
+ time: {
111
+ parser: timeline === Enums_1.TYPE_TIMELINE.DAY
112
+ ? 'YYYYMMDD'
113
+ : 'YYYYMMDDHH',
114
+ unit: timeline === Enums_1.TYPE_TIMELINE.DAY
115
+ ? 'day'
116
+ : 'hour',
117
+ displayFormats: {
118
+ day: 'DD/MM',
119
+ hour: 'HH:mm',
120
+ },
121
+ },
122
+ offset: true,
123
+ ticks: {
124
+ maxTicksLimit: 10,
125
+ autoSkipPadding: 16,
126
+ maxRotation: 0,
127
+ },
128
+ title: {
129
+ font: {
130
+ size: 14,
131
+ family: 'Roboto',
132
+ },
117
133
  },
118
134
  },
119
- },
120
135
  y: {
121
136
  type: 'linear',
122
137
  display: true,
@@ -4,8 +4,12 @@ export declare const styledLineFill: (defaultStyle: any, variant: any) => any;
4
4
  export declare const getStyle: (defaultStyle: any, type: any, color: any) => any;
5
5
  export declare const dataSetCommonStyled: {
6
6
  barStyle: {
7
- primary: {};
8
- secondary: {};
7
+ primary: {
8
+ backgroundColor: string;
9
+ };
10
+ secondary: {
11
+ backgroundColor: string;
12
+ };
9
13
  default: {
10
14
  backgroundColor: string;
11
15
  };
@@ -95,8 +95,12 @@ var getStyle = function (defaultStyle, type, color) {
95
95
  exports.getStyle = getStyle;
96
96
  exports.dataSetCommonStyled = {
97
97
  barStyle: {
98
- primary: {},
99
- secondary: {},
98
+ primary: {
99
+ backgroundColor: '#0055b8',
100
+ },
101
+ secondary: {
102
+ backgroundColor: '#dd040c',
103
+ },
100
104
  default: {
101
105
  backgroundColor: '#80b0ff',
102
106
  },
@@ -110,7 +110,7 @@ function DataInput(props) {
110
110
  case 'autocomplete': {
111
111
  return ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, { multiple: fieldDefinition.multiple, options: fieldDefinition.options, getOptionLabel: function (option) { var _a, _b; return (_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.text) !== null && _b !== void 0 ? _b : ''; }, isOptionEqualToValue: function (option, value) {
112
112
  return (option === null || option === void 0 ? void 0 : option.value) === (value === null || value === void 0 ? void 0 : value.value);
113
- }, disableclearable: fieldDefinition.disableClearable, onChange: function (e, value) {
113
+ }, disableclearable: fieldDefinition.disableClearable, getOptionDisabled: function (option) { return option === null || option === void 0 ? void 0 : option.disabled; }, onChange: function (e, value) {
114
114
  var newValue = fieldDefinition.multiple
115
115
  ? value.map(function (x) { return x === null || x === void 0 ? void 0 : x.value; })
116
116
  : value === null || value === void 0 ? void 0 : value.value;
@@ -30,13 +30,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
31
  exports.DataGrid = void 0;
32
32
  var jsx_runtime_1 = require("react/jsx-runtime");
33
+ var react_1 = __importDefault(require("react"));
33
34
  var styles_1 = require("@mui/material/styles");
34
35
  var material_1 = require("@mui/material");
35
36
  var Pagination_1 = __importDefault(require("../Pagination"));
36
37
  var NoData_1 = __importDefault(require("../NoData"));
37
38
  var constants_1 = require("../constants");
38
- var helper_1 = require("../helper");
39
+ var Helpers_1 = require("../../Utils/Helpers");
39
40
  var get_1 = __importDefault(require("../Form/Utils/get"));
41
+ var i18n_1 = __importDefault(require("../../i18n"));
40
42
  var StyledTableRow = (0, styles_1.styled)(material_1.TableRow)({
41
43
  '& .MuiTableCell-root:last-child .MuiButtonBase-root': {
42
44
  visibility: 'hidden',
@@ -72,6 +74,11 @@ var SpanSortIndex = (0, styles_1.styled)('span')({
72
74
  });
73
75
  var DataGrid = function (props) {
74
76
  var columns = props.columns, rows = props.rows, _a = props.hideHeader, hideHeader = _a === void 0 ? false : _a, spanningRows = props.spanningRows, _b = props.spanningRowsPosition, spanningRowsPosition = _b === void 0 ? 'bottom' : _b, getRowId = props.getRowId, onRowClick = props.onRowClick, rowActions = props.rowActions, sortModel = props.sortModel, onSortModelChange = props.onSortModelChange, selected = props.selected, onSelectedChange = props.onSelectedChange, selectionActions = props.selectionActions, _c = props.pageIndex, pageIndex = _c === void 0 ? constants_1.PAGE_INDEX_DEFAULT : _c, _d = props.pageSize, pageSize = _d === void 0 ? constants_1.PAGE_SIZE_DEFAULT : _d, _e = props.totalOfRows, totalOfRows = _e === void 0 ? rows.length : _e, _f = props.rowsPerPageOptions, rowsPerPageOptions = _f === void 0 ? [10, 20, 30] : _f, onPageIndexChange = props.onPageIndexChange, onPageSizeChange = props.onPageSizeChange;
77
+ react_1.default.useEffect(function () {
78
+ var language = localStorage.getItem('i18nextLng');
79
+ i18n_1.default.changeLanguage(language || 'vi');
80
+ // eslint-disable-next-line react-hooks/exhaustive-deps
81
+ }, [localStorage.getItem('i18nextLng')]);
75
82
  var createSortHandler = function (fieldName) { return function (event) {
76
83
  var _a, _b, _c;
77
84
  if (onSortModelChange) {
@@ -168,7 +175,7 @@ var DataGrid = function (props) {
168
175
  }
169
176
  };
170
177
  var calcOrder = function (index) { return pageIndex * pageSize + 1 + index; };
171
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.TableContainer, { component: material_1.Paper, children: [(0, jsx_runtime_1.jsxs)(material_1.Table, { "aria-label": "simple table", style: { tableLayout: 'fixed' }, children: [!hideHeader && ((0, jsx_runtime_1.jsx)(material_1.TableHead, { children: (0, jsx_runtime_1.jsxs)(material_1.TableRow, { children: [selected && onSelectedChange && ((0, jsx_runtime_1.jsx)(material_1.TableCell, { padding: "checkbox", children: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { color: "primary", indeterminate: selected.length > 0 &&
178
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.TableContainer, { component: material_1.Paper, children: [(0, jsx_runtime_1.jsxs)(material_1.Table, { "aria-label": "simple table", style: { tableLayout: 'fixed' }, children: [!hideHeader && ((0, jsx_runtime_1.jsx)(material_1.TableHead, { children: (0, jsx_runtime_1.jsxs)(material_1.TableRow, { children: [selected && onSelectedChange && ((0, jsx_runtime_1.jsx)(material_1.TableCell, { padding: "checkbox", children: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { color: "primary", indeterminate: selected.length > 0 &&
172
179
  selected.length < rows.length, checked: selected.length > 0 &&
173
180
  selected.length === rows.length, onChange: function () { return handleSelectAll(); }, inputProps: {
174
181
  'aria-label': 'select all desserts',
@@ -232,7 +239,7 @@ var DataGrid = function (props) {
232
239
  var displayValue = col.valueGetter
233
240
  ? col.valueGetter(row, idx, calcOrder(idx))
234
241
  : col.type === 'number'
235
- ? (0, helper_1.formatNumber)(row[col.field])
242
+ ? (0, Helpers_1.formatNumber)(row[col.field])
236
243
  : (0, get_1.default)(row, col.field);
237
244
  var dynamicStyle = col.dynamicTableCellProps
238
245
  ? col.dynamicTableCellProps(row)
@@ -256,7 +263,12 @@ var DataGrid = function (props) {
256
263
  : 1,
257
264
  }, sx: __assign(__assign({}, actionDef.sx), { borderRadius: '15%' }), children: typeof actionDef.icon ===
258
265
  'function'
259
- ? actionDef.icon({ id: id, row: row, idx: idx, order: calcOrder(idx) })
266
+ ? actionDef.icon({
267
+ id: id,
268
+ row: row,
269
+ idx: idx,
270
+ order: calcOrder(idx),
271
+ })
260
272
  : actionDef.icon }) }, "".concat(id, "-").concat(actIdx)));
261
273
  }) }))] }), id));
262
274
  }), spanningRowsPosition == 'bottom' && spanningRows] })] }), !rows.length && (0, jsx_runtime_1.jsx)(NoData_1.default, {})] }), onPageIndexChange && onPageSizeChange && ((0, jsx_runtime_1.jsx)(Pagination_1.default, { rowsPerPageOptions: rowsPerPageOptions, colSpan: 3, count: totalOfRows, rowsPerPage: pageSize, page: pageIndex, SelectProps: {
@@ -264,7 +276,7 @@ var DataGrid = function (props) {
264
276
  native: true,
265
277
  }, onPageChange: function (e, page) { return onPageIndexChange(page); }, onRowsPerPageChange: function (e) {
266
278
  return onPageSizeChange(parseInt(e.target.value, 10));
267
- } }))] });
279
+ } }))] }));
268
280
  };
269
281
  exports.DataGrid = DataGrid;
270
282
  exports.default = exports.DataGrid;
@@ -80,7 +80,7 @@ var Drawer = function (props) {
80
80
  snackbar('success');
81
81
  console.log('success');
82
82
  }, 700);
83
- closeDrawer(state || CloseAction.Reload);
83
+ closeDrawer(typeof state === 'string' ? state : CloseAction.Reload);
84
84
  })
85
85
  .catch(function () {
86
86
  snackbar('error');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.12",
3
+ "version": "2.1.13",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",