...
 
Commits (5)
......@@ -35,10 +35,12 @@
grid-template-areas:
"ls ts rs"
"ls header rs"
"ls toolbars rs"
"ls inner rs"
"ls buttonbars rs"
"ls bs rs";
grid-template-rows: min-content min-content minmax(0, 1fr) min-content;
grid-template-rows: min-content min-content min-content minmax(0, 1fr) min-content min-content;
grid-template-columns: min-content 1fr min-content;
flex-grow: 1;
......@@ -65,12 +67,17 @@
flex-direction: column;
align-items: flex-start;
}
.itasks-panel > .itasks-buttonbar {
grid-area: buttonbars;
}
.itasks-panel > .itasks-toolbar {
grid-area: toolbars;
}
.itasks-panel.itasks-scroll-content {
flex-basis: 0;
overflow: auto;
}
.itasks-panel.itasks-scroll-content > .itasks-inner {
flex-basis: 0;
overflow: auto;
}
......@@ -103,6 +110,12 @@
background-color: var(--select-base-color);
}
.itasks-window {
/* Default minimum sizes */
min-width: 300px;
min-height: 150px;
}
.itasks-window > .itasks-header {
font-weight: bold;
font-size: 11px;
......@@ -139,11 +152,7 @@
flex-basis: auto;
align-items: flex-start;
overflow: auto;
/* Default minimum sizes */
min-width: 300px;
min-height: 100px;
}
.itasks-window.itasks-scroll-content > .itasks-inner {
flex-basis: 0;
......
......@@ -208,14 +208,24 @@ scrollContent = addCSSClass "itasks-scroll-content"
toWindow :: UIWindowType UIVAlign UIHAlign -> LayoutRule
toWindow windowType vpos hpos = sequenceLayouts
[wrapUI UIWindow
//Move title and class attributes to window
,copySubUIAttributes (SelectKeys ["title"]) [0] []
,layoutSubUIs (SelectByPath [0]) (delUIAttributes (SelectKeys ["title"]))
//Set window specific attributes
,setUIAttributes ('DM'.unions [windowTypeAttr windowType,vposAttr vpos, hposAttr hpos])
[layoutSubUIs (SelectAND (SelectByPath []) (SelectByClass "step-actions")) convertStep
//General case, only if the previous rule did not apply
,layoutSubUIs (SelectAND (SelectByPath []) (SelectNOT (SelectByType UIWindow))) wrapInWindow
]
where
convertStep = sequenceLayouts
[setUIType UIWindow
,setUIAttributes ('DM'.unions [windowTypeAttr windowType,vposAttr vpos, hposAttr hpos])
]
wrapInWindow = sequenceLayouts
[wrapUI UIWindow
//Move title and class attributes to window
,copySubUIAttributes (SelectKeys ["title"]) [0] []
,layoutSubUIs (SelectByPath [0]) (delUIAttributes (SelectKeys ["title"]))
//Set window specific attributes
,setUIAttributes ('DM'.unions [windowTypeAttr windowType,vposAttr vpos, hposAttr hpos])
]
insertToolBar :: [String] -> LayoutRule
insertToolBar actions = sequenceLayouts
[insertChildUI 0 (ui UIToolBar)
......
......@@ -115,6 +115,43 @@ itasks.Panel = {
return el;
},
renderChildren: function() {
var me = this;
me.children.forEach(function(child) {
if(child.domEl) {
if(child.domEl.classList.contains("itasks-buttonbar") || child.domEl.classList.contains("itasks-toolbar")) {
me.domEl.appendChild(child.domEl);
} else {
me.containerEl.appendChild(child.domEl);
}
}
});
},
addChildToDOM: function(child, idx) {
var me = this;
var is_bar = child.domEl.classList.contains("itasks-buttonbar") || child.domEl.classList.contains("itasks-toolbar") ;
var container = is_bar ? me.domEl : me.containerEl;
var insert_before_idx = idx + 1; //The child is already part of the collection, so search from the next element
var insert_before_element = null
while(insert_before_element == null && insert_before_idx < me.children.length) {
var sibling = me.children[insert_before_idx].domEl;
var sibling_is_bar = sibling.classList.contains("itasks-buttonbar") || sibling.classList.contains("itasks-toolbar") ;
if ((is_bar && sibling_is_bar) || (!is_bar && !sibling_is_bar)) {
insert_before_element = sibling;
} else {
insert_before_idx++;
}
}
if(insert_before_element == null) {
container.appendChild(child.domEl);
} else {
container.insertBefore(child.domEl, insert_before_element);
}
},
setTitle(title) {
var me = this;
if(me.headerEl != null) {
......@@ -324,7 +361,7 @@ itasks.TabSet = {
}
}
itasks.Window = {
itasks.Window = Object.assign(Object.assign({}, itasks.Panel),{
cssCls: 'window',
attributes: {
movable: true,
......@@ -422,7 +459,8 @@ itasks.Window = {
window.removeEventListener('mousemove', me.onDragging_);
window.removeEventListener('mouseup', me.onStopDrag_);
}
};
});
itasks.ToolBar = {
cssCls: 'toolbar'
};
......
......@@ -91,7 +91,11 @@ itasks.Component = {
me.initDOMEl();
//Size the element if explicit sizes are given
me.initDOMElSize();
//Add the the child renderings
//Render the child elements
me.renderChildren();
},
renderChildren: function() {
var me = this;
me.children.forEach(function(child) {
if(child.domEl) {
me.containerEl.appendChild(child.domEl);
......@@ -208,20 +212,26 @@ itasks.Component = {
return child.init().then(function(){
//Add the child to the dom
if(child.domEl) {
if(isLast) {
me.containerEl.appendChild(child.domEl);
} else {
me.containerEl.insertBefore(child.domEl,me.containerEl.childNodes[idx]);
}
me.addChildToDOM(child,idx);
child.onShow();
}
finish_up();
});
} else {
finish_up();
}
},
//Separate method for inserting the child in the DOM.
//This enables subclasses to put some nodes in a different place than in `containerEl`
addChildToDOM: function(child, idx) {
var me = this,
isLast = (idx == me.children.length);
if(isLast) {
me.containerEl.appendChild(child.domEl);
} else {
me.containerEl.insertBefore(child.domEl,me.containerEl.childNodes[idx]);
}
},
beforeChildInsert: function(idx,spec) {},
afterChildInsert: function(idx,child) {},
removeChild: function(idx = 0) {
......@@ -231,7 +241,7 @@ itasks.Component = {
me.beforeChildRemove(idx,child);
if(me.initialized && child.domEl) {
me.containerEl.removeChild(child.domEl);
child.domEl.parentNode.removeChild(child.domEl);
}
me.children.splice(idx,1);
me.afterChildRemove(idx);
......
......@@ -29,9 +29,11 @@ Start world
//Figure out input and output dirs
# (argv,world) = getCommandLine world
| length argv <> 5 = world //Fail
# (content,world) = readFile (argv !! 2) world //When called by the IDE or cpm the second argument will be the 'linkopts' file
# linkopts_file = argv !! 2 //When called by the IDE or cpm the second argument will be the 'linkopts' file
# linkerrs_file = argv !! 4 //When called by the IDE or cpm the second argument will be the 'linkerrs' file
# (content,world) = readFile linkopts_file world
| isError content
= abort ("Error opening " +++ argv !! 2 +++ ": " +++ toString (fromError content) +++ "\n")
= writeErrorFile linkerrs_file ("Error opening " +++ linkopts_file +++ ": " +++ toString (fromError content) +++ "\n") world
# content = fromOk content
# outDir = exePathToOutputDir (lookupExePath content)
# inDirs = objectPathsToInputDirs (lookupObjectPaths content)
......@@ -41,16 +43,22 @@ Start world
//Create output dir and 'css' dir in it
# (mbErr,world) = createDirectory outDir world
| not (mbErr =: (Ok _) || mbErr =: (Error (FILE_EXISTS,_))) //Ignore 'File exists' errors
= abort ("Error creating directory " +++ outDir +++ ": " +++ toString (fromError mbErr) +++ "\n")
= writeErrorFile linkerrs_file ("Error creating directory " +++ outDir +++ ": " +++ toString (fromError mbErr) +++ "\n") world
# (mbErr,world) = createDirectory (outDir </> "css") world
| not (mbErr =: (Ok _) || mbErr =: (Error (FILE_EXISTS,_))) //Ignore 'File exists' errors
= abort ("Error creating directory " +++ outDir </> "css" +++ ": " +++ toString (fromError mbErr) +++ "\n")
= writeErrorFile linkerrs_file ("Error creating directory " +++ outDir </> "css" +++ ": " +++ toString (fromError mbErr) +++ "\n") world
//Create the aggregated css file
# (mbErr,world) = writeFile cssFile "" world
# world = foldr (\f w -> aggregateCSS f cssFile w) world cssParts
//Copy the contents of the input dirs if they exist
# world = foldr (\d w -> copyWebResources d outDir w) world inDirs
= world
//Write an empty error file when
= writeErrorFile linkerrs_file "" world
writeErrorFile errorfile message world
# (mbErr,world) = writeFile errorfile message world
| mbErr =: (Ok _) = world
| otherwise = abort (toString (fromError mbErr)) world
//Print a debug message
print msg world
......