mario-education 2.4.541-feedback → 2.4.543-feedback

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,4 @@
1
1
  import React from "react";
2
2
  import { IGenerateDashboardChart } from "../configs/types";
3
- declare const _default: React.MemoExoticComponent<({ typeChart, activeColumn, series, months, name, dayOfWeek, colors, textColors, avgQuestionLastMonth, studentCount, studentPercentage, responseStudent, classFontSize, avgContent, print, width, height, titleClassFontSize, min, hiddenKpi, timeOfDay, weeklySeries, weeks, description, skillClass, kpiClassName, lowMetricStudents, studentMetricPercent, noGradient, setOptionDate, stressValue }: IGenerateDashboardChart) => JSX.Element>;
3
+ declare const _default: React.MemoExoticComponent<({ typeChart, activeColumn, series, months, name, dayOfWeek, colors, textColors, avgQuestionLastMonth, studentCount, studentPercentage, responseStudent, classFontSize, avgContent, print, width, height, titleClassFontSize, min, hiddenKpi, timeOfDay, weeklySeries, weeks, description, skillClass, kpiClassName, lowMetricStudents, studentMetricPercent, noGradient, setOptionDate, stressValue, noAvgTotal }: IGenerateDashboardChart) => JSX.Element>;
4
4
  export default _default;
@@ -535,6 +535,7 @@ export interface IGenerateDashboardChart {
535
535
  noGradient?: boolean;
536
536
  setOptionDate?: Function;
537
537
  stressValue?: number[];
538
+ noAvgTotal?: boolean;
538
539
  }
539
540
  export interface IResponseStudentQuestion {
540
541
  sessionId: number;
package/dist/index.js CHANGED
@@ -35011,7 +35011,7 @@ var useDashboard = function useDashboard() {
35011
35011
  setDayOfWeekOneToOne = _useState38[1];
35012
35012
 
35013
35013
  var handleSetDataChartOneToOne = function handleSetDataChartOneToOne(data) {
35014
- var _data$overviewQuestio, _data$questionChoiceW;
35014
+ var _data$overviewQuestio, _data$questionChoiceW, _stressDataQuestion$;
35015
35015
 
35016
35016
  var questions = convertDataToDataChart(data === null || data === void 0 ? void 0 : data.overviewQuestionChoice);
35017
35017
  var months = (data === null || data === void 0 ? void 0 : (_data$overviewQuestio = data.overviewQuestionChoice) === null || _data$overviewQuestio === void 0 ? void 0 : _data$overviewQuestio.map(function (i) {
@@ -35072,7 +35072,7 @@ var useDashboard = function useDashboard() {
35072
35072
  var stressDataQuestion = newSeriesOneToOne.filter(function (r) {
35073
35073
  return r.name.toLocaleLowerCase() == STRESS_QUESTION;
35074
35074
  });
35075
- setStressValue(stressDataQuestion[0].data);
35075
+ setStressValue((_stressDataQuestion$ = stressDataQuestion[0]) === null || _stressDataQuestion$ === void 0 ? void 0 : _stressDataQuestion$.data);
35076
35076
  setDayOfWeekOneToOne(dayOfWeeks);
35077
35077
  setMonthsOneToOne(months);
35078
35078
  setWeeksOneToOne(weeks);
@@ -35246,7 +35246,7 @@ var useDashboard = function useDashboard() {
35246
35246
 
35247
35247
  var _temp10 = _catch(function () {
35248
35248
  return Promise.resolve(apiCaller(studentUserId, filter.academicYearId)).then(function (res) {
35249
- res && setData(res.data);
35249
+ res && setData(res === null || res === void 0 ? void 0 : res.data);
35250
35250
  });
35251
35251
  }, function (err) {
35252
35252
  var _err$response3, _err$response3$data;
@@ -35296,7 +35296,7 @@ var useDashboard = function useDashboard() {
35296
35296
  try {
35297
35297
  var _temp14 = _catch(function () {
35298
35298
  return Promise.resolve(checkHasSummarizeQuestionApi()).then(function (res) {
35299
- if (res && res.data) {
35299
+ if (res && res !== null && res !== void 0 && res.data) {
35300
35300
  setIsExistQuestion(true);
35301
35301
  }
35302
35302
  });
@@ -35318,7 +35318,7 @@ var useDashboard = function useDashboard() {
35318
35318
 
35319
35319
  var _temp18 = _catch(function () {
35320
35320
  return Promise.resolve(getSummarizeReport(_extends({}, filter, questionFilters))).then(function (res) {
35321
- if (res.data) {
35321
+ if (res !== null && res !== void 0 && res.data) {
35322
35322
  setSummarizeQuestions(res.data);
35323
35323
  }
35324
35324
  });
@@ -35414,7 +35414,7 @@ var useDashboard = function useDashboard() {
35414
35414
  try {
35415
35415
  var _temp20 = _catch(function () {
35416
35416
  return Promise.resolve(getStudentQuestionSkillApi(filter.studentId, filter.startDate, filter.endDate, filter.grade || [], roles, filter.academicYearId, filter.optionDate, filter.teacherId)).then(function (res) {
35417
- setStudentSkillQuestion(res.data);
35417
+ setStudentSkillQuestion(res === null || res === void 0 ? void 0 : res.data);
35418
35418
  });
35419
35419
  }, function (err) {
35420
35420
  dispatch(marioCore.setAlert({
@@ -37700,6 +37700,7 @@ var AreaChart = function AreaChart(_ref) {
37700
37700
  className: "" + styles$4["block-label-y"]
37701
37701
  }, labelYChart$1.map(function (r) {
37702
37702
  return React__default.createElement("p", {
37703
+ key: r,
37703
37704
  className: "" + styles$4["label"]
37704
37705
  }, r, "%");
37705
37706
  })), React__default.createElement("div", {
@@ -38114,7 +38115,7 @@ var GraphTrend = function GraphTrend(_ref) {
38114
38115
  backgroundColor: bgColor
38115
38116
  },
38116
38117
  className: "" + styles$2["graph-label"]
38117
- }, label + " | " + ((_Math$abs = Math.abs(valueData || 0)) === null || _Math$abs === void 0 ? void 0 : _Math$abs.toFixed(2))), timeOfDay && React__default.createElement("img", {
38118
+ }, label + " | " + ((_Math$abs = Math.abs(valueData || 0)) === null || _Math$abs === void 0 ? void 0 : _Math$abs.toFixed(2)) + "%"), timeOfDay && React__default.createElement("img", {
38118
38119
  src: "/images/" + (value < 0 ? "trend-down.png" : "trend-up.png"),
38119
38120
  alt: "Graph Trend Icon"
38120
38121
  }));
@@ -38205,6 +38206,7 @@ var BarChart = function BarChart(_ref) {
38205
38206
  setOpen(!open);
38206
38207
  };
38207
38208
 
38209
+ var selectedBarRef = React.useRef(null);
38208
38210
  var options = React.useMemo(function () {
38209
38211
  var opts = optionColumnChartAndPercents(min != null ? min : 0, months, activeColumn, false, colors, maxSeries, dayOfWeek, isCountSeries, undefined, undefined, print);
38210
38212
  opts.chart = {
@@ -38212,13 +38214,35 @@ var BarChart = function BarChart(_ref) {
38212
38214
  events: {
38213
38215
  dataPointSelection: function dataPointSelection(_event, _chartContext, config) {
38214
38216
  var dataPointIndex = config.dataPointIndex;
38215
- var currentTooltip = tooltipDataRef.current;
38216
-
38217
- if ((currentTooltip === null || currentTooltip === void 0 ? void 0 : currentTooltip.dataPointIndex) === dataPointIndex && currentTooltip !== null && currentTooltip !== void 0 && currentTooltip.isSelect) {
38217
+ var chartEl = document.querySelector("#apexchartsmy-bar-chart");
38218
+ if (!chartEl) return;
38219
+ var barEls = chartEl.querySelectorAll(".apexcharts-bar-series path");
38220
+ if (!barEls.length) return;
38221
+
38222
+ if (selectedBarRef.current === dataPointIndex) {
38223
+ selectedBarRef.current = null;
38224
+ barEls[dataPointIndex].setAttribute("fill", "#C4D4F3");
38218
38225
  setTooltipData(null);
38219
- } else {
38220
- showTooltipAtIndex(dataPointIndex, true);
38226
+ return;
38227
+ }
38228
+
38229
+ if (selectedBarRef.current !== null) {
38230
+ var prevIndex = selectedBarRef.current;
38231
+ var prevBar = barEls[prevIndex];
38232
+
38233
+ if (prevBar) {
38234
+ prevBar.setAttribute("fill", "#C4D4F3");
38235
+ }
38236
+ }
38237
+
38238
+ var newBar = barEls[dataPointIndex];
38239
+
38240
+ if (newBar) {
38241
+ newBar.setAttribute("fill", "#316CD9");
38221
38242
  }
38243
+
38244
+ selectedBarRef.current = dataPointIndex;
38245
+ showTooltipAtIndex(dataPointIndex, true);
38222
38246
  },
38223
38247
  dataPointMouseEnter: function dataPointMouseEnter(_event, _chartContext, config) {
38224
38248
  var dataPointIndex = config === null || config === void 0 ? void 0 : config.dataPointIndex;
@@ -38327,6 +38351,28 @@ var BarChart = function BarChart(_ref) {
38327
38351
  React.useEffect(function () {
38328
38352
  tooltipDataRef.current = tooltipData;
38329
38353
  }, [tooltipData]);
38354
+ React.useEffect(function () {
38355
+ var handleClickOutside = function handleClickOutside(e) {
38356
+ var chartEl = document.querySelector("#apexchartsmy-bar-chart");
38357
+ if (!chartEl) return;
38358
+
38359
+ if (!chartEl.contains(e.target)) {
38360
+ var barEls = chartEl.querySelectorAll(".apexcharts-bar-series path");
38361
+ var selectedIndex = selectedBarRef.current;
38362
+
38363
+ if (selectedIndex !== null && barEls[selectedIndex]) {
38364
+ barEls[selectedIndex].setAttribute("fill", "#C4D4F3");
38365
+ selectedBarRef.current = null;
38366
+ setTooltipData(null);
38367
+ }
38368
+ }
38369
+ };
38370
+
38371
+ document.addEventListener("click", handleClickOutside);
38372
+ return function () {
38373
+ document.removeEventListener("click", handleClickOutside);
38374
+ };
38375
+ }, []);
38330
38376
  return React__default.createElement("div", null, React__default.createElement("div", {
38331
38377
  ref: chartWrapperRef,
38332
38378
  style: {
@@ -38546,7 +38592,8 @@ var GeneratePlpChart = function GeneratePlpChart(_ref) {
38546
38592
  studentMetricPercent = _ref.studentMetricPercent,
38547
38593
  noGradient = _ref.noGradient,
38548
38594
  setOptionDate = _ref.setOptionDate,
38549
- stressValue = _ref.stressValue;
38595
+ stressValue = _ref.stressValue,
38596
+ noAvgTotal = _ref.noAvgTotal;
38550
38597
 
38551
38598
  var _useTranslation = marioCore.useTranslation(),
38552
38599
  t = _useTranslation.t;
@@ -38618,7 +38665,7 @@ var GeneratePlpChart = function GeneratePlpChart(_ref) {
38618
38665
  className: "" + styles$2["header-chart-generate"]
38619
38666
  }, React__default.createElement(core$1.Typography, {
38620
38667
  className: "" + (titleClassFontSize || styles$2["title-chart"])
38621
- }, t(name)), (dataSeries === null || dataSeries === void 0 ? void 0 : (_dataSeries$ = dataSeries[0]) === null || _dataSeries$ === void 0 ? void 0 : (_dataSeries$$descript = _dataSeries$.description) === null || _dataSeries$$descript === void 0 ? void 0 : _dataSeries$$descript.length) > 0 && name !== lowMetricName && React__default.createElement(GraphTrend, {
38668
+ }, t(name)), !noAvgTotal && (dataSeries === null || dataSeries === void 0 ? void 0 : (_dataSeries$ = dataSeries[0]) === null || _dataSeries$ === void 0 ? void 0 : (_dataSeries$$descript = _dataSeries$.description) === null || _dataSeries$$descript === void 0 ? void 0 : _dataSeries$$descript.length) > 0 && name !== lowMetricName && React__default.createElement(GraphTrend, {
38622
38669
  label: getDescriptionFromPercent((averageStressName === name ? stressValue === null || stressValue === void 0 ? void 0 : stressValue[0] : dataSeries[0].data[0]) || 0, dataSeries[0].description, name === averageStressName),
38623
38670
  valueData: (averageStressName === name ? stressValue === null || stressValue === void 0 ? void 0 : stressValue[0] : dataSeries[0].data[0]) || 0,
38624
38671
  value: avgs[0] || 0,
@@ -38933,10 +38980,11 @@ var GenerateTrendQuestion = function GenerateTrendQuestion(_ref) {
38933
38980
  return sum / element.data.length;
38934
38981
  });
38935
38982
  }, [series, avgQuestionLastMonth]);
38936
- console.log('series', series);
38937
38983
  return React__default.createElement(core$1.Grid, {
38938
38984
  className: "" + styles$2["trend-question-list"]
38939
38985
  }, series.map(function (item, index) {
38986
+ var _item$data, _item$data2;
38987
+
38940
38988
  return React__default.createElement(core$1.Grid, {
38941
38989
  key: item.name,
38942
38990
  className: "" + styles$2["trend-question-item"]
@@ -38949,8 +38997,9 @@ var GenerateTrendQuestion = function GenerateTrendQuestion(_ref) {
38949
38997
  src: "/images/" + icons[index],
38950
38998
  alt: ""
38951
38999
  })), React__default.createElement(GraphTrend, {
38952
- label: getDescriptionFromPercent(avgs[index] || 0, item.description) || "",
38953
- value: avgs[index] || 0
39000
+ label: getDescriptionFromPercent((item === null || item === void 0 ? void 0 : (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data[0]) || 0, item.description) || "",
39001
+ value: avgs[index] || 0,
39002
+ valueData: (item === null || item === void 0 ? void 0 : (_item$data2 = item.data) === null || _item$data2 === void 0 ? void 0 : _item$data2[0]) || 0
38954
39003
  }));
38955
39004
  }));
38956
39005
  };
@@ -39049,7 +39098,6 @@ var ReadinessToLearnTab = function ReadinessToLearnTab(_ref) {
39049
39098
  var sortedData = [].concat(dataReadinessOfChart).sort(function (a, b) {
39050
39099
  return preferredOrder.indexOf(removeHTMLTags(a.questionText)) - preferredOrder.indexOf(removeHTMLTags(b.questionText));
39051
39100
  });
39052
- console.log('dataOverallReadyToLearn.resultQuestion', dataOverallReadyToLearn.resultQuestion);
39053
39101
  return React__default.createElement(core$1.Grid, null, React__default.createElement(core$1.Grid, {
39054
39102
  className: "" + styles$2["explain"]
39055
39103
  }, React__default.createElement("img", {
@@ -39099,7 +39147,8 @@ var ReadinessToLearnTab = function ReadinessToLearnTab(_ref) {
39099
39147
  weeks: weeksOneToOne,
39100
39148
  weeklySeries: preparednessWeeklyData,
39101
39149
  noGradient: true,
39102
- setOptionDate: setOptionDate
39150
+ setOptionDate: setOptionDate,
39151
+ noAvgTotal: true
39103
39152
  }))), React__default.createElement(core$1.Grid, {
39104
39153
  className: styles$2["plp-box-chart"] + " " + styles$2["distribution-chart"]
39105
39154
  }, React__default.createElement(BubbleChartCustom$1, {
@@ -39154,7 +39203,8 @@ var SuccessIndicatorTab = function SuccessIndicatorTab(_ref) {
39154
39203
  classFontSize: classFontSize,
39155
39204
  handleHoverTooltip: handleHoverTooltip,
39156
39205
  weeks: weeksOneToOne,
39157
- noGradient: true
39206
+ noGradient: true,
39207
+ noAvgTotal: true
39158
39208
  }));
39159
39209
  };
39160
39210