Skip to content

Commit

Permalink
impl
Browse files Browse the repository at this point in the history
Issue #510
  • Loading branch information
rsoika committed Jan 30, 2023
1 parent 723cff6 commit 766d4b0
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ var chroniclePreview=true; // indicates if documetns should be shown in the co
var callbackRegistrySaveWorkitem=[];
var isChronicleResizing=false // tangable divider
var sliderPosX; // current position of moving slider
var chronicleElement; // the chronical bar
var formElement; // the chronical bar
var workitemElement;
var workitemFormElement; // the chronical bar


/**
* Init Method for the workitem page
Expand All @@ -32,13 +33,6 @@ $(document).ready(function() {
imixsOfficeMain.imixs_chronicle_comments=true;
imixsOfficeMain.imixs_chronicle_nav=JSON.parse('{ "comment" : true, "files":true, "version":true, "reference":true }');

// read croncicle size form cookie
// chornicleSize=imixsOfficeWorkitem.readCookie('imixs.office.document.chronicle.size');
// if (!chornicleSize || chornicleSize=="") {
// chornicleSize=1;
// }


// read croncicle document preview form cookie
chroniclePreview=imixsOfficeWorkitem.readCookie('imixs.office.document.chronicle.preview');
if (chroniclePreview == "true") {
Expand All @@ -47,32 +41,33 @@ $(document).ready(function() {
chroniclePreview=false;
}


// Init tangible slider
chronicleElement = document.querySelector('.imixs-workitem > .imixs-workitem-chronicle');
formElement=document.querySelector('.imixs-workitem > .imixs-workitem-form');
//formElement.parentElement.style.display = "none";

workitemElement = document.querySelector('.imixs-workitem');
workitemFormElement=document.querySelector('.imixs-workitem > .imixs-workitem-form');
const lastFormWidth=imixsOfficeWorkitem.readCookie('imixs.office.document.workitem.formwidth');

imixsOfficeWorkitem.updateFormWidth(lastFormWidth);

const sliderElement = document.querySelector('.imixs-workitem > .imixs-slider');
sliderElement.addEventListener('mousedown', (e) => {
isChronicleResizing = true;
sliderPosX = e.clientX;
console.log('slider posX = '+ sliderPosX);
});
window.addEventListener('mouseup', (e) => {
isChronicleResizing = false;
});
window.addEventListener('mousemove', (e) => {
if (!isChronicleResizing) return;
let _newWidth=formElement.offsetWidth + (e.clientX - sliderPosX);
let _newWidth=workitemFormElement.offsetWidth + (e.clientX - sliderPosX);
// adjust minwidth....
if (_newWidth<500) {
_newWidth=500;
}
if (_newWidth>workitemElement.offsetWidth-340) {
_newWidth=workitemElement.offsetWidth-340;
}

imixsOfficeWorkitem.updateFormWidth(_newWidth);
sliderPosX = e.clientX;
imixsOfficeWorkitem.setCookie("imixs.office.document.workitem.formwidth",_newWidth,14);

});

$('.document-nav').hide();
Expand All @@ -86,7 +81,6 @@ $(document).ready(function() {
imixsOfficeWorkitem.autoPreviewPDF();

isWorkitemLoading=false;
//formElement.parentElement.style.display = "block";
});

/*
Expand Down Expand Up @@ -298,16 +292,28 @@ IMIXS.org.imixs.workflow.workitem = (function() {
},




/*
* updates the screen size of the form and chronical frame
* updates the workitem form width and update the corresponding cookie
*/
updateFormWidth=function(_newWidth) {
const parent=formElement.parentElement;
formElement.style.width = `${_newWidth}px`;
chronicleElement.style.width = `${parent.offsetWidth-formElement.offsetWidth-40}px`;
workitemFormElement.style.flexBasis = `${_newWidth}px`;
imixsOfficeWorkitem.setCookie("imixs.office.document.workitem.formwidth",_newWidth,14);
},

/*
* reduce the with of the chronicle
*/
expandChronicle= function () {
imixsOfficeWorkitem.updateFormWidth(1000);
},

/*
* increase the with of the chronicle
*/
shrinkChronicle = function () {
imixsOfficeWorkitem.updateFormWidth(workitemElement.offsetWidth-400);
},



/*
Expand Down Expand Up @@ -560,6 +566,8 @@ IMIXS.org.imixs.workflow.workitem = (function() {
printQRCode : printQRCode,
autoPreviewPDF : autoPreviewPDF,
updateFormWidth : updateFormWidth,
expandChronicle : expandChronicle,
shrinkChronicle : shrinkChronicle,
clearDocumentPreview : clearDocumentPreview,
updateAttachmentLinks : updateAttachmentLinks,
showDocument : showDocument,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@
.imixs-workitem {
/* Use flexbox */
display: flex;
flex-wrap: wrap;
xflex-wrap: wrap;
flex-direction: row;
}
}


.imixs-workitem-form {
xwidth: 66.666%;
flex-basis: 1000px;
}
.imixs-workitem-chronicle {
height: 100%;
display: flex;
flex-wrap: nowrap;
flex-direction: column;
justify-content: space-between;

position: fixed;
right: 40px;
bottom: 0;
padding: 120px 20px 0px 10px;

padding: 0px 20px 0px 10px;



flex-basis: 0;
flex-grow: 1;
}


Expand Down Expand Up @@ -106,7 +107,7 @@


.imixs-slider {
width: 16px;
flex-basis: 16px;
padding: 0;
cursor: col-resize;
}
Expand All @@ -128,6 +129,7 @@
color:#ababab;
font-size:16px;
line-height: 1.7em;
cursor: default;
}

.imixs-slider .typcn:hover {
Expand All @@ -136,7 +138,6 @@


.imixs-workitem-form {
xxwidth: calc(66.6666% - 0px);
margin-bottom: 40px;
}

Expand Down
23 changes: 23 additions & 0 deletions imixs-office-workflow-app/src/main/webapp/layout/test/test.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

.imixs-workitem {
display: flex; /* or inline-flex */
flex-direction: row ;
}


.imixs-workitem-form {
flex-basis: 600px;
}
.imixs-slider {
xwidth:60px;
xmin-width: 60px;
background: #ccc;
flex-basis: 60px;
}

.imixs-workitem-chronicle {
flex-basis: 0;
flex-grow: 1;
xmin-width:0;
xoverflow: hidden;
}
42 changes: 42 additions & 0 deletions imixs-office-workflow-app/src/main/webapp/layout/test/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link href="test.css" charset="UTF-8" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="test.js"></script>

</head>
<body>

<header>
<h1>Flex Demo</h1>
</header>

<div class="imixs-workitem">


<div class="imixs-workitem-form">
<h2>The Form</h2>
<p>Note that that browser support for these values is nuanced.
For example, space-between never got support from some versions of
Edge, and start/end/left/right aren’t in Chrome yet. MDN has
detailed charts. The safest values are flex-start, flex-end, and
center. There are also two additional keywords you can pair with
these values: safe and unsafe. Using safe ensures that however you
do this type of positioning, you can’t push an element such that it
renders off-screen (e.g. off the top) in such a way the content
can’t be scrolled too (called “data loss”).</p>
</div>
<div class="imixs-slider"></div>
<div class="imixs-workitem-chronicle">
<h2>The Chronicle</h2>
<p>
nowrap top.


start/end/left/right aren’t in Chrome yet. MDN has detailed charts. The safest values are flex-start, flex-end, and center. There are also two additional keywords you can pair with these values: safe and unsafe. Using safe ensures that however you do this type of positioning, you can’t push an element such that it</p>
</div>
</div>
</body>
</html>
45 changes: 45 additions & 0 deletions imixs-office-workflow-app/src/main/webapp/layout/test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

let sliderPosX;
let isChronicleResizing;
let chronicleElement;
let formElement;

window.onload = function () {

console.log('Dokument geladen');
chronicleElement = document.querySelector('.imixs-workitem > .imixs-workitem-chronicle');
formElement=document.querySelector('.imixs-workitem > .imixs-workitem-form');

const sliderElement = document.querySelector('.imixs-workitem > .imixs-slider');
sliderElement.addEventListener('mousedown', (e) => {
isChronicleResizing = true;
sliderPosX = e.clientX;
console.log('slider posX = '+ sliderPosX);
});
window.addEventListener('mouseup', (e) => {
isChronicleResizing = false;
});
window.addEventListener('mousemove', (e) => {
if (!isChronicleResizing) return;

const parent=formElement.parentElement;
console.log('parent width = '+ parent.offsetWidth);
console.log('slider posX = '+ sliderPosX);
console.log('current width='+formElement.offsetWidth);
let _newWidth=formElement.offsetWidth + (e.clientX - sliderPosX);
console.log('new width='+_newWidth);


formElement.style.width = `${_newWidth}px`;
// formElement.setAttribute('style', `${_newWidth}px`);
formElement.style.flexBasis = `${_newWidth}px`;

// chronicleElement.style.width = `${parent.offsetWidth-formElement.offsetWidth-60}px`;


sliderPosX = e.clientX;

});

}

0 comments on commit 766d4b0

Please sign in to comment.