awing-library 2.1.140-beta → 2.1.142-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.
- package/lib/ACM-AXN/CampaignSchedule/Components/RowAdvance/component.js +1 -1
- package/lib/ACM-AXN/Page/CreateOrEdit/Utils.js +4 -3
- package/lib/ACM-AXN/ViewTemplate/TemplateField/Fields/BasicField/index.js +10 -37
- package/lib/ACM-AXN/ViewTemplate/container.js +15 -22
- package/lib/AWING/Chart/BarLineComponent.js +0 -1
- package/lib/AWING/GroupTable/GroupTable.js +2 -3
- package/lib/Utils/Helpers.d.ts +1 -1
- package/lib/Utils/Helpers.js +3 -2
- package/package.json +1 -1
|
@@ -176,7 +176,7 @@ var RowAdvanceComponent = function (_a) {
|
|
|
176
176
|
? ''
|
|
177
177
|
: totalRate }, item.id));
|
|
178
178
|
case Enum_1.HEAD_CELL_NAMES.TOTAL:
|
|
179
|
-
return ((0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", children: totalView }, item.id));
|
|
179
|
+
return ((0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", children: (0, Helpers_1.formatNumber)(totalView) }, item.id));
|
|
180
180
|
case Enum_1.HEAD_CELL_NAMES.IMPRESSION:
|
|
181
181
|
return ((0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", children: row === null || row === void 0 ? void 0 : row.view }, item.id));
|
|
182
182
|
case Enum_1.HEAD_CELL_NAMES.AUTHENTICATION:
|
|
@@ -86,13 +86,14 @@ var convertValueByType = function (type, val) {
|
|
|
86
86
|
if (typeof val === 'string')
|
|
87
87
|
val = val === 'true';
|
|
88
88
|
}
|
|
89
|
-
else if (type === Enum_1.TYPE_FIELD_TEMPLATE.TEXT_FIELD_NUMBER) {
|
|
90
|
-
val = parseInt(val);
|
|
91
|
-
}
|
|
92
89
|
else if (type === Enum_1.TYPE_FIELD_TEMPLATE.DROPDOWN_LIST) {
|
|
93
90
|
var spl = val.split('\\n');
|
|
94
91
|
val = spl[0].trim();
|
|
95
92
|
}
|
|
93
|
+
// Không parse số, trong trường hợp số có thể float
|
|
94
|
+
// else if (type === TYPE_FIELD_TEMPLATE.TEXT_FIELD_NUMBER) {
|
|
95
|
+
// // val = parseInt(val)
|
|
96
|
+
// }
|
|
96
97
|
return val;
|
|
97
98
|
};
|
|
98
99
|
exports.convertValueByType = convertValueByType;
|
|
@@ -65,6 +65,7 @@ function BasicField(props) {
|
|
|
65
65
|
register = hookControl.register, errors = hookControl.formState.errors, getValues = hookControl.getValues, setFormValue = hookControl.setFormValue;
|
|
66
66
|
(0, react_1.useEffect)(function () {
|
|
67
67
|
var isNotSubField = fieldPath.split('.').length === 3;
|
|
68
|
+
var timeOut;
|
|
68
69
|
if (isNotSubField) {
|
|
69
70
|
if (fieldType === Enum_1.TYPE_FIELD_TEMPLATE.CHECKBOX) {
|
|
70
71
|
if (defaultValue === 'true' &&
|
|
@@ -76,14 +77,19 @@ function BasicField(props) {
|
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
else {
|
|
80
|
+
console.log("fieldValue", { fieldValue: fieldValue });
|
|
79
81
|
if (defaultValue && !fieldValue) {
|
|
80
|
-
setTimeout(function () {
|
|
82
|
+
timeOut = setTimeout(function () {
|
|
81
83
|
setFormValue(fieldPath, defaultValue);
|
|
82
84
|
onChange(fieldPath);
|
|
83
85
|
}, 0);
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
}
|
|
89
|
+
return function () {
|
|
90
|
+
if (timeOut)
|
|
91
|
+
clearTimeout(timeOut);
|
|
92
|
+
};
|
|
87
93
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
94
|
}, []);
|
|
89
95
|
var handleChange = function (newValue) {
|
|
@@ -107,7 +113,6 @@ function BasicField(props) {
|
|
|
107
113
|
}));
|
|
108
114
|
switch (fieldType) {
|
|
109
115
|
case Enum_1.TYPE_FIELD_TEMPLATE.TEXT_FIELD_NUMBER:
|
|
110
|
-
return renderTextField(field, isError);
|
|
111
116
|
case Enum_1.TYPE_FIELD_TEMPLATE.TEXT_FIELD:
|
|
112
117
|
case Enum_1.TYPE_FIELD_TEMPLATE.URL:
|
|
113
118
|
return renderTextField(field, isError);
|
|
@@ -128,43 +133,11 @@ function BasicField(props) {
|
|
|
128
133
|
default:
|
|
129
134
|
return null;
|
|
130
135
|
}
|
|
131
|
-
// return (
|
|
132
|
-
// <Controller
|
|
133
|
-
// name={fieldPath}
|
|
134
|
-
// {...register(fieldPath, { required: isRequired })}
|
|
135
|
-
// ref={null}
|
|
136
|
-
// control={control}
|
|
137
|
-
// render={({ field }) => {
|
|
138
|
-
// switch (fieldType) {
|
|
139
|
-
// case TYPE_FIELD_TEMPLATE.TEXT_FIELD_NUMBER:
|
|
140
|
-
// return renderTextField(field, isError)
|
|
141
|
-
// case TYPE_FIELD_TEMPLATE.TEXT_FIELD:
|
|
142
|
-
// return renderTextField(field, isError)
|
|
143
|
-
// case TYPE_FIELD_TEMPLATE.TEXTAREA:
|
|
144
|
-
// return renderTextField(field, isError)
|
|
145
|
-
// case TYPE_FIELD_TEMPLATE.DROPDOWN_LIST:
|
|
146
|
-
// return renderDropdownListField(field, isError)
|
|
147
|
-
// case TYPE_FIELD_TEMPLATE.CHECKBOX:
|
|
148
|
-
// return renderCheckboxField(field)
|
|
149
|
-
// case TYPE_FIELD_TEMPLATE.COLOR:
|
|
150
|
-
// return renderColorField(field, isError)
|
|
151
|
-
// case TYPE_FIELD_TEMPLATE.IMAGE:
|
|
152
|
-
// return renderImageOrVideoField(isError)
|
|
153
|
-
// case TYPE_FIELD_TEMPLATE.VIDEO:
|
|
154
|
-
// return renderImageOrVideoField(isError)
|
|
155
|
-
// case TYPE_FIELD_TEMPLATE.HTML:
|
|
156
|
-
// return renderHTMLField()
|
|
157
|
-
// default:
|
|
158
|
-
// return null
|
|
159
|
-
// }
|
|
160
|
-
// }}
|
|
161
|
-
// ></Controller>
|
|
162
|
-
// )
|
|
163
136
|
};
|
|
164
137
|
var renderTextField = function (field, isError) {
|
|
165
|
-
return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({}, field, { className: classes.text, required: isRequired, fullWidth: true
|
|
166
|
-
|
|
167
|
-
|
|
138
|
+
return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({}, field, { className: classes.text, required: isRequired, fullWidth: true, inputProps: fieldType === Enum_1.TYPE_FIELD_TEMPLATE.TEXT_FIELD_NUMBER
|
|
139
|
+
? { type: 'number' }
|
|
140
|
+
: {} }, (fieldType === Enum_1.TYPE_FIELD_TEMPLATE.TEXTAREA
|
|
168
141
|
? { multiline: true, rows: 4 }
|
|
169
142
|
: {}), { variant: "standard", label: labelName || fieldName, onChange: function (e) {
|
|
170
143
|
handleChange(e.target.value);
|
|
@@ -60,10 +60,6 @@ function ViewTemplate(_a) {
|
|
|
60
60
|
control: control,
|
|
61
61
|
name: "templateDatas",
|
|
62
62
|
}).fields;
|
|
63
|
-
// const { fields } = useFieldArray({
|
|
64
|
-
// control,
|
|
65
|
-
// name: "templateDatas",
|
|
66
|
-
// });
|
|
67
63
|
(0, react_1.useEffect)(function () {
|
|
68
64
|
var language = localStorage.getItem("i18nextLng");
|
|
69
65
|
i18n_1.default.changeLanguage(language || "vi");
|
|
@@ -117,21 +113,18 @@ var addChilds = function (fields, fieldInfo) {
|
|
|
117
113
|
}
|
|
118
114
|
return result;
|
|
119
115
|
};
|
|
120
|
-
var convertToTreeData = function (data) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
return treeData;
|
|
137
|
-
};
|
|
116
|
+
var convertToTreeData = function (data) { return data
|
|
117
|
+
.map(function (item) { return addChilds(data, item); })
|
|
118
|
+
.filter(function (item) { return !item.fieldName.includes("."); })
|
|
119
|
+
.map(function (item) {
|
|
120
|
+
if ([Enum_1.TYPE_FIELD_TEMPLATE.LIST, Enum_1.TYPE_FIELD_TEMPLATE.OBJECT].includes(item.fieldType)) {
|
|
121
|
+
return __assign(__assign({}, item), { fieldValue: item.fieldValue && (0, common_1.isJSON)(item.fieldValue)
|
|
122
|
+
? JSON.parse(item.fieldValue)
|
|
123
|
+
: item.fieldType === Enum_1.TYPE_FIELD_TEMPLATE.LIST
|
|
124
|
+
? []
|
|
125
|
+
: {} });
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
return item;
|
|
129
|
+
}
|
|
130
|
+
}); };
|
|
@@ -255,7 +255,6 @@ var BarLineComponent = function (props) {
|
|
|
255
255
|
boxSpan.style.height = '15px';
|
|
256
256
|
boxSpan.style.marginRight = '15px';
|
|
257
257
|
boxSpan.style.width = '15px';
|
|
258
|
-
console.log('item', item);
|
|
259
258
|
if ((item === null || item === void 0 ? void 0 : item.lineWidth) && (item === null || item === void 0 ? void 0 : item.pointStyle)) {
|
|
260
259
|
boxSpan.setAttribute("class", classes.point);
|
|
261
260
|
}
|
|
@@ -41,7 +41,7 @@ function GroupTable(props) {
|
|
|
41
41
|
var _b = (0, react_1.useState)(0), groupPageIndex = _b[0], setGroupPageIndex = _b[1];
|
|
42
42
|
var _c = (0, react_1.useState)(constants_1.PAGE_SIZE_DEFAULT), groupPageSize = _c[0], setGroupPageSize = _c[1];
|
|
43
43
|
var _d = (0, react_1.useState)(0), totalCount = _d[0], setTotalCount = _d[1];
|
|
44
|
-
var _e = (0, react_1.useState)(
|
|
44
|
+
var _e = (0, react_1.useState)(true), loading = _e[0], setLoading = _e[1];
|
|
45
45
|
var groupKeys = headCells
|
|
46
46
|
.filter(function (headCell) { return headCell.isGrouping; })
|
|
47
47
|
.map(function (headCell) { return headCell.field; });
|
|
@@ -55,11 +55,10 @@ function GroupTable(props) {
|
|
|
55
55
|
var handleGetGroupData = function () {
|
|
56
56
|
setLoading(true);
|
|
57
57
|
onGetData(filters, groupPageIndex, groupPageSize).then(function (result) {
|
|
58
|
-
setLoading(false);
|
|
59
58
|
!(0, lodash_1.isEqual)(data, result.data) && setData(result.data);
|
|
60
59
|
!(0, lodash_1.isEqual)(totalCount, result.totalCount) &&
|
|
61
60
|
setTotalCount(result.totalCount);
|
|
62
|
-
});
|
|
61
|
+
}).finally(function () { setLoading(false); });
|
|
63
62
|
};
|
|
64
63
|
var handleChangePage = function (newPage) {
|
|
65
64
|
setGroupPageIndex(newPage);
|
package/lib/Utils/Helpers.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare enum TIMELINE_TYPE {
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function getCookie(name: string): string | undefined;
|
|
17
17
|
export declare function dateToString(date: moment.MomentInput): string;
|
|
18
|
-
export declare function formatNumber(num: number | bigint | undefined): string;
|
|
18
|
+
export declare function formatNumber(num: number | bigint | string | undefined): string;
|
|
19
19
|
export declare function getQueryVariable(variable: string): string;
|
|
20
20
|
export declare function displayLongString(str: string, maxLength: number): string;
|
|
21
21
|
export declare function generateUUID(): string;
|
package/lib/Utils/Helpers.js
CHANGED
|
@@ -55,8 +55,9 @@ function dateToString(date) {
|
|
|
55
55
|
}
|
|
56
56
|
exports.dateToString = dateToString;
|
|
57
57
|
function formatNumber(num) {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
var value = Number(Number(num).toFixed(2));
|
|
59
|
+
if (value || value === 0) {
|
|
60
|
+
return new Intl.NumberFormat(i18n_1.default.language === 'vi' ? 'vi-VN' : 'en-US').format(value);
|
|
60
61
|
}
|
|
61
62
|
else
|
|
62
63
|
return '';
|