@widergy/energy-ui 3.83.0 → 3.84.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [3.84.0](https://github.com/widergy/energy-ui/compare/v3.83.1...v3.84.0) (2025-06-27)
2
+
3
+
4
+ ### Features
5
+
6
+ * smartbill analytics ([#631](https://github.com/widergy/energy-ui/issues/631)) ([ce0a122](https://github.com/widergy/energy-ui/commit/ce0a122089b1d74a1ad30d6d5f8c1aabe3c518c9))
7
+
8
+ ## [3.83.1](https://github.com/widergy/energy-ui/compare/v3.83.0...v3.83.1) (2025-06-23)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * [OAG-1369] date search error ([#621](https://github.com/widergy/energy-ui/issues/621)) ([7133f09](https://github.com/widergy/energy-ui/commit/7133f09385cd3bee092abf55b2b05cd99b64a4db))
14
+
1
15
  # [3.83.0](https://github.com/widergy/energy-ui/compare/v3.82.2...v3.83.0) (2025-06-19)
2
16
 
3
17
 
@@ -11,6 +11,7 @@ var _dayjs = _interopRequireDefault(require("@date-io/dayjs"));
11
11
  var _dayjs2 = _interopRequireDefault(require("dayjs"));
12
12
  var _es = _interopRequireDefault(require("dayjs/locale/es"));
13
13
  var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
14
+ var _isBetween = _interopRequireDefault(require("dayjs/plugin/isBetween"));
14
15
  var _form = require("@widergy/web-utils/lib/form");
15
16
  var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
16
17
  var _UTLabel = _interopRequireDefault(require("../UTLabel"));
@@ -51,6 +52,7 @@ CalendarIcon.defaultProps = {
51
52
  xmlnsXlink: "http://www.w3.org/1999/xlink"
52
53
  };
53
54
  _dayjs2.default.extend(_customParseFormat.default);
55
+ _dayjs2.default.extend(_isBetween.default);
54
56
  class CustomUtils extends _dayjs.default {
55
57
  constructor() {
56
58
  super(...arguments);
@@ -90,20 +92,20 @@ const UTDatePicker = _ref => {
90
92
  const onlyPastMonth = (field === null || field === void 0 || (_field$configuration2 = field.configuration) === null || _field$configuration2 === void 0 || (_field$configuration2 = _field$configuration2.customDateValidations) === null || _field$configuration2 === void 0 || (_field$configuration2 = _field$configuration2.onlyPastMonth) === null || _field$configuration2 === void 0 ? void 0 : _field$configuration2.active) || false;
91
93
  const avoidFutureDates = (field === null || field === void 0 || (_field$configuration3 = field.configuration) === null || _field$configuration3 === void 0 || (_field$configuration3 = _field$configuration3.customDateValidations) === null || _field$configuration3 === void 0 || (_field$configuration3 = _field$configuration3.avoidFutureDates) === null || _field$configuration3 === void 0 ? void 0 : _field$configuration3.active) || false;
92
94
  const {
93
- minDate,
94
- maxDate
95
- } = (onlyPastMonth ? (0, _utils2.getPastMonthDates)() : avoidFutureDates ? (0, _utils2.getMaxDate)() : range) || {};
95
+ maxDate,
96
+ minDate
97
+ } = onlyPastMonth ? (0, _utils2.getPastMonthDates)() : avoidFutureDates ? (0, _utils2.getMaxDate)() : range || pickerProps || {};
96
98
  const [pickedDate, setPickedDate] = (0, _react.useState)(null);
97
99
  const [internalError, setInternalError] = (0, _react.useState)(null);
98
100
  const handleChange = date => {
99
- setPickedDate(date);
100
- const newValue = (0, _dayjs2.default)(date, _constants.OUTPUT_LABEL_MASK, true);
101
- if ((0, _utils2.isValidDate)({
102
- avoidFutureDates,
103
- newValue,
104
- onlyPastMonth,
105
- range
106
- })) input.onChange(newValue.format(configMask));else input.onChange('');
101
+ const finalDate = (0, _utils2.getFinalDate)({
102
+ date,
103
+ maxDate,
104
+ minDate
105
+ });
106
+ setPickedDate(finalDate);
107
+ const newValue = (0, _dayjs2.default)(finalDate, _constants.OUTPUT_LABEL_MASK, true);
108
+ if (newValue.isValid()) input.onChange(newValue.format(configMask));else input.onChange('');
107
109
  };
108
110
  (0, _react.useEffect)(() => {
109
111
  if (!input.value && pickedDate !== null && pickedDate !== void 0 && pickedDate.isValid()) setPickedDate(null);else if ((0, _utils2.dateMatchesFormat)(input.value, configMask)) setPickedDate((0, _dayjs2.default)(input.value, configMask));
@@ -172,10 +174,11 @@ const UTDatePicker = _ref => {
172
174
  PopoverProps: {
173
175
  ...(iconAnchor ? (0, _constants.iconAnchorProps)(operenerIconReference) : {}),
174
176
  ...popoverProps
175
- },
177
+ }
178
+ }, pickerProps, {
176
179
  minDate: minDate,
177
180
  maxDate: maxDate
178
- }, pickerProps))));
181
+ }))));
179
182
  };
180
183
  UTDatePicker.propTypes = {
181
184
  actions: (0, _propTypes.arrayOf)(_buttonTypes.buttonTypes),
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isValidDate = exports.isSelected = exports.getPastMonthDates = exports.getMaxDate = exports.dateMatchesFormat = void 0;
6
+ exports.isSelected = exports.getPastMonthDates = exports.getMaxDate = exports.getFinalDate = exports.dateMatchesFormat = void 0;
7
7
  var _dayjs = _interopRequireDefault(require("dayjs"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  const isSelected = (date, selectedDate) => selectedDate && date.isSame(selectedDate, 'day');
@@ -27,24 +27,15 @@ const getMaxDate = () => {
27
27
  };
28
28
  };
29
29
  exports.getMaxDate = getMaxDate;
30
- const avoidFutureDatesValidation = date => !(0, _dayjs.default)().isBefore(date);
31
- const rangeValidation = (date, range) => {
32
- const {
33
- minDate,
34
- maxDate
35
- } = range;
36
- return date.isBetween(minDate, maxDate, null, '[]');
37
- };
38
- const isValidDate = _ref => {
30
+ const getFinalDate = _ref => {
39
31
  let {
40
- avoidFutureDates,
41
- newValue,
42
- onlyPastMonth,
43
- range
32
+ date,
33
+ maxDate,
34
+ minDate
44
35
  } = _ref;
45
- if (avoidFutureDates && !avoidFutureDatesValidation(newValue)) return false;
46
- if (onlyPastMonth && !rangeValidation(newValue, getPastMonthDates())) return false;
47
- if (range && !rangeValidation(newValue, range)) return false;
48
- return newValue.isValid();
36
+ const formattedDate = (0, _dayjs.default)(date);
37
+ if (maxDate && formattedDate !== null && formattedDate !== void 0 && formattedDate.isAfter(maxDate)) return (0, _dayjs.default)(maxDate);
38
+ if (minDate && formattedDate !== null && formattedDate !== void 0 && formattedDate.isBefore(minDate)) return (0, _dayjs.default)(minDate);
39
+ return formattedDate;
49
40
  };
50
- exports.isValidDate = isValidDate;
41
+ exports.getFinalDate = getFinalDate;
@@ -25,6 +25,7 @@ const UTDocumentWizard = _ref => {
25
25
  var _tabsOptions$;
26
26
  let {
27
27
  classNames,
28
+ handlers = {},
28
29
  labels,
29
30
  pages = [],
30
31
  scaleConfig,
@@ -40,6 +41,9 @@ const UTDocumentWizard = _ref => {
40
41
  const [isChangingTab, setIsChangingTab] = (0, _react.useState)(false);
41
42
  const [clickedSection, setClickedSection] = (0, _react.useState)(null);
42
43
  const sectionSelected = sections.find(section => "".concat(section.id) === clickedSection);
44
+ const {
45
+ trackClickGlossarySection = () => {}
46
+ } = handlers;
43
47
  const onChangeTab = newTab => {
44
48
  if (isChangingTab) return;
45
49
  if (changeTimeoutRef.current) {
@@ -110,6 +114,9 @@ const UTDocumentWizard = _ref => {
110
114
  chevronsManagerTitle,
111
115
  sectionDetails
112
116
  } = labels;
117
+ (0, _react.useEffect)(() => {
118
+ if (sectionSelected) trackClickGlossarySection(sectionSelected === null || sectionSelected === void 0 ? void 0 : sectionSelected.title);
119
+ }, [sectionSelected]);
113
120
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
114
121
  className: "".concat(_stylesModule.default.container, " ").concat(classNames === null || classNames === void 0 ? void 0 : classNames.container)
115
122
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -170,6 +177,7 @@ const UTDocumentWizard = _ref => {
170
177
  };
171
178
  UTDocumentWizard.propTypes = {
172
179
  classNames: _propTypes.object,
180
+ handlers: _propTypes.object,
173
181
  labels: _propTypes.object,
174
182
  pages: (0, _propTypes.arrayOf)({}),
175
183
  scaleConfig: _propTypes.object,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.83.0",
3
+ "version": "3.84.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",