Skip to content

Commit

Permalink
feat: Allow to show Month in long and short version. Fix: Dynamic hei…
Browse files Browse the repository at this point in the history
…ght calculated correctly when not visible by default
  • Loading branch information
dave007700 committed Oct 25, 2022
1 parent c73080b commit 080152c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ build/*.js
jbe-build-wrapper.xml
node_modules/
resouces/jazzUtilities/modules/build/*.js
.classpath
31 changes: 28 additions & 3 deletions resources/jazzUtilities/modules/src/PrintableWorkItemDraw.es6
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ define(["dojo/_base/declare",

dynamicVariableCounter: [],

toggleApplyHideSet: null,

_pageSizeOptimize: null,

_months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],

/**
* @static final
*
Expand Down Expand Up @@ -84,6 +88,8 @@ define(["dojo/_base/declare",

this.globalChildCheckingDone = false;

this.toggleApplyHideSet = new Set();

this.predefinedAttributes = !_predefinedAttributes ? [] : _predefinedAttributes;

if (!skipWebKeysIfNotEmpty || (skipWebKeysIfNotEmpty && this.keyValueMap.length === 0)) {
Expand Down Expand Up @@ -135,10 +141,13 @@ define(["dojo/_base/declare",

this._applyDynamicHeights(updateTitle, configuration);

} else if (updateTitle) {
} else {

this.parentWidget._updateTitle();
if (updateTitle) {
this.parentWidget._updateTitle();
}

this.onFinishedDrawing();
}

}
Expand Down Expand Up @@ -1315,7 +1324,7 @@ define(["dojo/_base/declare",
if (hidden) {
previousValue.toggle.split(',').forEach((id) => {
if (Number(id) != NaN) {
self._setRegionVisibilityByID(id, false);
self.toggleApplyHideSet.add(id);
}
});
}
Expand Down Expand Up @@ -1456,13 +1465,21 @@ define(["dojo/_base/declare",
returnValue = returnValue.replace(/dd/gm, `${dateValue.getDate() < 10 ? "0" : ""}${dateValue.getDate()}`);
returnValue = returnValue.replace(/d/gm, dateValue.getDate());

// Temporary replace to not replace chars in the string of the month
returnValue = returnValue.replace(/mmmm/gm, '%____%');
returnValue = returnValue.replace(/mmm/gm, '%___%');

// IMPORTANT: MONTH IN JAVASCRIPT START WITH ZERO AS JANUARY !!!!!!!
returnValue = returnValue.replace(/mm/gm, `${dateValue.getMonth() < 9 ? "0" : ""}${dateValue.getMonth() + 1}`);
returnValue = returnValue.replace(/m/gm, dateValue.getMonth() + 1);

returnValue = returnValue.replace(/yyyy/gm, `${dateValue.getFullYear()}`);
returnValue = returnValue.replace(/yy/gm, `${String(dateValue.getFullYear()).slice(2)}`);

// Finally replace the temporary placeholder with the accrual value
returnValue = returnValue.replace(/%____%/gm, this._months[dateValue.getMonth()]);
returnValue = returnValue.replace(/%___%/gm, this._months[dateValue.getMonth()].substr(0, 3));

return returnValue;
},

Expand Down Expand Up @@ -2009,6 +2026,14 @@ define(["dojo/_base/declare",

},

/**
* Called when everything has finished drawing
*/
onFinishedDrawing: function () {
// Resolve all the toggle Regions which are hidden by default
this.toggleApplyHideSet.forEach(toggleID => this._setRegionVisibilityByID(toggleID, false));
},

});

});

0 comments on commit 080152c

Please sign in to comment.