Giter Site home page Giter Site logo

golden-layout / golden-layout Goto Github PK

View Code? Open in Web Editor NEW
6.2K 6.2K 526.0 7.75 MB

A multi window layout manager for webapps

Home Page: https://golden-layout.github.io/golden-layout

License: MIT License

JavaScript 69.83% HTML 8.46% CSS 9.84% TypeScript 10.77% Less 0.77% SCSS 0.32%
drag-and-drop golden-layout javascript layout typescript ui-components

golden-layout's Introduction

Golden Layout

NPM version License

Golden Layout is a Javascript layout manager which enables you to layout components in a web page and re-arrange them with drag and drop. Its features include:

  • Native popup windows
  • Touch support
  • Support for application frameworks such as Angular and Vue
  • Virtual components
  • Comprehensive API
  • Load and save layouts
  • Focus components
  • Completely themeable
  • Works in modern browsers (Firefox, Chrome)
  • Responsive design

Development

Except for simple bug-fixes, commits should go into the dev branch, which will become version 3.0. The dev branch is quite unstable (and not backwards compatible), but should hopefully stabilize soon.

Installation

The library can be installed into an application package with the npm command:
npm i golden-layout

More information

For more information, please refer to the Golden Layout website

golden-layout's People

Contributors

akajes avatar andrew-bx avatar bkrrrr avatar butchmonkey avatar csterritt avatar goranprijic avatar greggbjensen avatar iver56 avatar jcford73 avatar johannwagner avatar lanyizi avatar ldetomi-sopra avatar malled avatar martin31821 avatar mattgodbolt avatar mfrischknecht avatar mwri avatar ndelangen avatar noah79 avatar nopmop avatar ntamas avatar pbklink avatar perbothner avatar slowki avatar steelsojka avatar stephenjelfs avatar trockefeller-pathway avatar twilightowl avatar wolframhempel avatar yasserf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

golden-layout's Issues

Tabs with isClosable = false can be closed

In a project where I use Golden Layout I have three tabs with isClosable = false. As a user I shouldn't be able to get rid of such tabs (because that makes the GUI inconsistent/incomplete).

  1. I can drag one of the tabs to the right or to the bottom so that it becomes a row or a column with one tab. Problem: I can close that row (or column), and that makes the tab go away, even if it has isClosable = false.

  2. I can open one of the tabs in a popup and close that popup. Problem: The tab is now gone.

Documentation Issue (Angular Complex)

Hello,

This isn't really a bug as such but may be useful for others trying to implement this library with angular.

Firstly the angular implemention in the docs is a bit problematic. Generally speaking having a seperate module for each panel isn't ideal as it makes sharing services much harder so the simple fix appears to be to just create a single module and then share services/objects in the normal way.

See:
http://codepen.io/anon/pen/dwLFE

The problem is that this doesn't work as expected. Controllers remain isolated and cannot share data (in the above example both controllers attempt to add data to the shared object but they only see what they've set).

I believe the reason for this is that this code...

angular.bootstrap( element[ 0 ], [ state.module ] );

...will create a fresh instance of the module for every controller/panel.

I'm far from an angular expert so there is probably a better solution out there but here's what I've come up with:

http://codepen.io/anon/pen/rKqxf

So I allow the application to bootstrap automatically via the ng-app directive in the body tag then grab an instance of the injector and run a compile against each of the panels. This seems to make everything work as expected. Controllers can communicate in the usual way via services. The only other thing I had to change was to add the container and state to the new $scope I assign to the panel. This seems like a sane way to do it as state IS specific to the scope not the whole module.

Hope this helps someone.

edit:
Actually there is a bug in my fix. It throws inprogress exceptions when changing tabs. I'll see if I can fix it.

stefan

Memory leaks when open/close tabs

I ran a heap allocation test. I opened and closed many times a tab (empty tab). I can see that the memory is not released.

I use angularJS so each time I create a tab, I bootstrap it. When I perform open/close tabs, I get artifacts of ~300KB for each tab. (when I say artifacts, I mean after garbage collector...)

I also tried without bootstrapping and I get artifacts of 10KB each time I open/close.

So is it normal to get the 10KB for an open/close? If yes, what should I do with angular to eliminate these 300KB?

PS I get even bigger artifacts when my tab is not empty

HTML in title of popup

Let's say that I have a tab with HTML to show an icon in it. HTML:

<span class="glyphicon glyphicon-bell"></span> Alarms

Problem 1) When I open that tab in a popup, the title becomes the following:

&lt;span class="glyphicon glyphicon-bell"&gt;&lt;/span&gt; Alarms

I rather want it to be just "Alarms" in this case.

Problem 2) When I "pop in" the popup, the text of the tab becomes the following:

<span class="glyphicon glyphicon-bell"></span> Alarms

i.e. the HTML isn't rendered, so I cannot see the icon, which I expect to see

Touch Support

Any plans for touch support. I was not able to move tabs on a touch device.

Drag proxy doesn't respect headerHeight?

If I set headerHeight to for example 30 in the dimensions config, then normal headers are rendered as expected, but drag proxies seem to still use 20 pixels for the height of the header (the tab). Am I doing something wrong, or is this a bug in Golden Layout? Is it a feature (by design)?

How to render a directive inside a pane.

Hi,

I am using 3 panes on the pages and in the middle pane I am rendering the canvas with some additional functions related to the canvas, but when I use the directive inside a template, all I get is HTML markup for the directive and not the canvas element. If I put the directive outside of the template then it works fine.

<template id="stageCanvasArea">
<div id="stageArea" style="padding: 0px !important; ">
<stage stage="stage" height="600"></stage>
</div>
</template>

Now the register component for the golden layout renders this:

<div id="stageArea" style="padding: 0px !important; ">
<stage stage="stage" height="600"></stage>
</div>

How can I render the directive inside the pane?

Thanks

Bower package file contains wrong version

  "name": "golden-layout",
  "version": "1.0.2",
  "homepage": "https://golden-layout.com",

The version actually installed by bower is: 1.0.8:

$ bower install --save golden-layout
bower golden-layout#*           cached git://github.com/hoxton-one/golden-layout.git#1.0.8
bower golden-layout#*         validate 1.0.8 against git://github.com/hoxton-one/golden-layout.git#*
bower jquery#*                  cached git://github.com/jquery/jquery.git#2.1.3
bower jquery#*                validate 2.1.3 against git://github.com/jquery/jquery.git#*
bower golden-layout#~1.0.8     install golden-layout#1.0.8
bower jquery#*                 install jquery#2.1.3

golden-layout#1.0.8 bower_components/golden-layout
└── jquery#2.1.3

jquery#2.1.3 bower_components/jquery

Scrollbar?

Is there any reason why the themes have overflow: hidden? I would think that it would be integral to the layout to have a scrollbar appear. What about a Javascript scrollbar?

Add robust error handling to event emitters

It would be helpful to throw a useful error message if the event is not specified. I had a call which looked like this:

        this._container.on( 'open', this.renderView, this );

Which would trigger the lm.utils.EventEmitter function to emit the event. However, the event this.renderView was removed and instead of knowing what failed, I just got an error that fn was undefined in the emit method:

this.emit = function( sEvent )
    {
        var i, ctx, args;

        args = Array.prototype.slice.call( arguments, 1 );

        if( this._mSubscriptions[ sEvent ] ) {
            for( i = 0; i < this._mSubscriptions[ sEvent ].length; i++ )
            {
                ctx = this._mSubscriptions[ sEvent ][ i ].ctx || {};
                this._mSubscriptions[ sEvent ][ i ].fn.apply( ctx, args );   // <-- This line
            }
        }

If fn is undefined, this just blows up so I would suggest doing something like:

     if (this._mSubscriptions[sEvent][i].fn) {        // <-- This instead
          this._mSubscriptions[ sEvent ][ i ].fn.apply( ctx, args );
     } else {
          throw new Error('Missing event handler function for event "' + sEvent + '" in component ...!');
     }

Just a suggestion.

iframe reloads after moving tabs

I've put an iframe inside a tab and each time I move the tab, it reloads my iframe!

In addition, the drag doesn't work when the mouse goes over the iframe.

I created a plunker. For the first problem, just go to 'more information' and then move the tab. For the second problem, try to move the tab over the iframe.

http://plnkr.co/edit/tN94U03VaTDa64gSG8v0?p=preview

BTW, I also noticed that the proxy is not an image and if you go fast with the mouse on the bottom/right, you can manipulate the proxy (click on links or scroll). Wouldn't it be optimal to use an image of the page instead of the page itself?

Angular ng-templates in Golden Layout

I see that you have support for template tags, but what about using script tag with the text/ng-template type? I didn't know where else to ask this. I have something that should work, but doesn't seem to. I rewrote the Angular component so that it uses directives to render components:

var AngularModuleComponent = function( container, state ) {
    // Get the Angular and module injectors, the latter is required so
    // that the $compile method can find the Angular components in those modules.
    var $injector = angular.injector(['ng', 'MyApp']),
        $compile = $injector.get('$compile'),
        $rootScope = $injector.get('$rootScope');

    // The template is super-simple... it just invokes the directive.
    var html = "<" + state.directive + "></" + state.directive + ">",
        element = container.getElement();

    // Compile the DOM to initialize the directive. The Golden Layout container
    // and state are passed on the scope into the directive.
    var scope = $rootScope.$new();
    scope.container = container;
    scope.state = state;
    element.html($compile(html)(scope));
};

Then, in the controller's code, I have something like:

angular.module('MyApp')
        .directive('tradeTab', function() {
            return {
                restrict: 'E',
                templateUrl: 'tradeTemplate.html',
                controller: TradeController,
                link: function(scope, el, attrs, controller, tFn) {
                }
            }
        })

However, when I try to use a template from Angular's template cache, this doesn't seem to work. Any ideas?

Resizing a dashboard with a maximized pane will resize the pane incorrectly.

When you maximize a pane in a dashboard with more than 1 pane, then resize the containing dashboard, the maximized pane will constrain to the size of its initial (minimized) size.

Steps to Reproduce:

  • Create a dashboard with two panes open.
  • Maximize one of the panes.
  • Resize your window and run {GoldenLayout}.updateSize().

If done this would cause the maximized window to resize to the dimensions of its initial container not the entire dimensions of the container.

Opening windows with large configurations results in a 404

Currently you appear to be passing the entire configuration for a pop-out via the URL. When a configuration/componentState is especially large, the result is a 404. I have a suggestion to make this work, and not completely compromise the platform for XSS style attacks.

Instead of sending the entire configuration, send a configuration Id of some sort. Then, when the window initializes it would use cross-window messaging to "request" its configuration. I haven't tried this yet, but intend to... Unless you feel this could be a quick fix.

filterXxs shouldn't really be doing these type of 'black-list' transformations

I was looking at your tests and noticed https://github.com/hoxton-one/golden-layout/blob/aece036424acf3460d58b06ba1f9fd2108484351/test/xss_tests.js#L2 which uses filterXss form https://github.com/hoxton-one/golden-layout/blob/aece036424acf3460d58b06ba1f9fd2108484351/src/js/utils/utils.js#L153

For example a playload flie onmouseover=alert(42) will pass that filter (and there are tons of other xss corner cases, see https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet for a nice list)

In case it help, here is a good XSS reference: https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet

Header bug on adding the first element to the screen

Hello,

First, really impressed with Golden Layout -- I showed to one of our stakeholders, and his response was, "This is much better than what I hoped we'd have!". So it looks like you'll have a sale soon :-)

Alas, I seem to have found a bug.

If you visit the "Examples" page on your site, and click the "By drag" example under "ADDING ITEMS", then close the two windows already open in the layout ("component 1" and "component 2"). Then, drag an item such as "You've added me!" to the layout, and you wind up with a "double header" window:

bug

Everything works, and the second window you add to the layout behaves properly.

This shows up under Safari and Chrome on OS X, and under Firefox on Linux.

Can't accept an empty dashboard.

Should be able to handle an empty dashboard.

Steps to Reproduce:
Build a dashboard with an empty array as content.

You are given an error: "Top level content can't contain more then one element." Fix this to:

if( config.content.length > 1 ) {

Implementing golden layout with angularjs routing throws already bootsrapped error.

I am using angular js in my project. I have some views and an index.html file. I am using $routeProvider for navigating between different views. Currently I have two views, projects.html and floor-mapping.html. I want the golden layout on my floorMap.html page. The default view is projects.html
I have created two modules. The first module "myModule" takes care of routing. And second is for golden layout "goldenModule". I am defining my modules something like this

'use strict';
var app = angular.module('myModule', []);

app.config(['$routeProvider',function ($routeProvider) {
    // Route Provider
    $routeProvider.when('/', {
      templateUrl: '/views/projects.html',
      controller: 'projectCtrl'
    }).when('/floorplan/:id', {
      templateUrl: '/views/floor-mapping.html',
      controller: 'kineticCtrl'
    }).otherwise({
      redirectTo: '/'
    });   
  }
]);

For goldenModule I am injecting myModule cause goldenModule has some dependencies on it and doing following:
var goldenModule = angular.module('goldenModule', ['myModule']);

My controllers for the panes of golden layout are

goldenModule.controller('BrokenLegController', function ($scope) {
  $scope.brokenLeg = 'This is broken leg.';  
  $scope.jakob = {};
    $scope.jakob.firstName = "Jakob";
    $scope.jakob.lastName  = "Jenkov";
});

goldenModule.controller('BalloonController', function ($scope) {
  $scope.balloon = 'This is balloon.';
   $scope.john = {};
    $scope.john.firstName = "John";
    $scope.john.lastName  = "Doe";
});

Directive for the goldenModule:

goldenModule.directive('userinfo', function() {
    var directive = {};
    directive.restrict = 'E';
    directive.template = "<p style='color:#fff;'>User : {{user.firstName}} {{user.lastName}}</p>";
    directive.scope = {
        user : "=user"
    };
    return directive;
});

My main.html something looks like this.

<body ng-app="myModule">
      <div class="col-md-9">
        <div ng-view></div>
      </div>
</body>

My floor-mapping.html is:

<div id="goldenLayoutContainer" style="width:800px; height:500px;">
  <template type="text/html" id="brokenLeg">
    <div ng-controller="BrokenLegController">
      <p style="color:#fff;">{{brokenLeg}}</p>
      <userinfo user="jakob"></userinfo>
      <img style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border-width: 0px;" border="0" src="http://www.menucool.com/slider/prod/image-slider-3.jpg">
    </div>
  </template>
  <template type="text/html" id="balloon">
    <div ng-controller="BalloonController">
      <p style="color:#fff;">{{balloon}}</p>
      <userinfo user="john"></userinfo>
      <img style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border-width: 0px; height:174px;" border="0" src="http://www.menucool.com/slider/jsImgSlider/images/image-slider-2.jpg">
    </div>
  </template>
</div>

The controller in which I am initialising golden layout and bootstrapping the goldenModule is kineticCtrl which is:

myModule.controller('kineticCtrl',function($scope){
  var myLayout = new GoldenLayout({
    settings: {
      hasHeaders: false
    },
    content: [{
      type: 'row',
      content: [{
        type: 'component',
        componentName: 'myPane',
        componentState: {
          templateId: 'brokenLeg',
          color: '#1D84BD'
        }
  }, {
        type: 'component',
        componentName: 'myPane',
        componentState: {
          templateId: 'balloon',
          color: '#F15C25'
        }
  }]
 }]
  }, angular.element('#goldenLayoutContainer')[0]);

  var setComponent = function (container, state) {
    var temp = angular.element('#' + state.templateId);
    var templateHtml = temp.html();
    container.getElement().html(templateHtml);
  };
  myLayout.registerComponent('myPane', function (container, state) {
    setComponent(container, state);
  });
  myLayout.on('initialised', function () {
//this throws already boostrapped error.
    angular.bootstrap(angular.element('#goldenLayoutContainer')[0], ['goldenModule']);
  });
  myLayout.init();
});

Statement

angular.bootstrap(angular.element('#goldenLayoutContainer')[0], ['goldenModule']);
throws already bootstrapped error. If I comment it. No module is bootstrapped and all the controller and directive don't work. Please help me. I don't know why it is coming. Pardon me for my english. Thanks in advance.

NPM Package Broken

In the Latest v1.0.8, the package.json main's property points to an invalid path:

  ...
  "description": "The ultimate JavaScript layout manager \r https://golden-layout.com",
  "main": "dist/js/goldenlayout.min.js",
  "directories": {
    "test": "test"
  },
  ...

However, the directory tree of the package is as follows:

$ tree node_modules/golden-layout/dist/
node_modules/golden-layout/dist/
├── goldenlayout.js
└── goldenlayout.min.js

0 directories, 2 files
```javascript

There is no **js** directory although it's used in the "main" directory.

Unable to unbind an emiter

To avoid any memory leak, I need to unbind my listeners. I define it as follow:

layout.eventHub.on('listener', function(arg1) {
// whatever function
});

I set up a button to unbind it as follow:

layout.eventHub.unbind('listener');

Although my eventhub._mSubscriptions has an array called listener, I get the following message: Nothing to unbind for listener

What's wrong with that?

Close tab using middle click

In web browsers, you can close a tab by clicking anywhere on the tab with the middle mouse button. Some users (including me) might expect this to be possible in GL as well.

Stacks not loading correctly from configuration saved in localstorage

Going through the tutorials on the site (https://golden-layout.com/tutorials/saving-state.html), I attempted to save and reload layout state from LocalStorage. It works - however, if I drag a tab to a container (creating a stack) and reload, that tab disappears. In my example, I dragged component C to stack on top of component B.

At the moment, it looks like the state is saving correctly, as the JSON in localstorage seems to reflect all components. However, upon reloading the page, the last active component in the stack appears - but the tab for the inactive component doesn't.

Here's the JSON from my localstorage:

 {
     "settings": {
         "hasHeaders": true,
         "constrainDragToContainer": true,
         "reorderEnabled": true,
         "selectionEnabled": false,
         "popoutWholeStack": false,
         "blockedPopoutsThrowError": true,
         "closePopoutsOnUnload": true,
         "showPopoutIcon": true,
         "showMaximiseIcon": true,
         "showCloseIcon": true
     },
     "dimensions": {
         "borderWidth": 5,
         "minItemHeight": 10,
         "minItemWidth": 10,
         "headerHeight": 20,
         "dragProxyWidth": 300,
         "dragProxyHeight": 200
     },
     "labels": {
         "close": "close",
         "maximise": "maximise",
         "minimise": "minimise",
         "popout": "open in new window",
         "popin": "pop in"
     },
     "content": [{
         "type": "row",
         "isClosable": true,
         "title": "",
         "content": [{
             "type": "stack",
             "isClosable": true,
             "width": 50,
             "height": 100,
             "title": "",
             "activeItemIndex": 0,
             "content": [{
                 "type": "component",
                 "componentName": "testComponent",
                 "componentState": {
                     "label": "A"
                 },
                 "isClosable": true,
                 "title": "testComponent"
             }, {
                 "type": "component",
                 "componentName": "testComponent",
                 "componentState": {
                     "label": "C"
                 },
                 "isClosable": true,
                 "title": "testComponent"
             }]
         }, {
             "type": "stack",
             "isClosable": true,
             "width": 50,
             "height": 100,
             "title": "",
             "activeItemIndex": 0,
             "content": [{
                 "type": "component",
                 "componentName": "testComponent",
                 "componentState": {
                     "label": "B"
                 },
                 "isClosable": true,
                 "title": "testComponent"
             }]
         }]
     }],
     "isClosable": true,
     "title": "",
     "openPopouts": [],
     "maximisedItemId": null
 }

As a note, I'm testing this in Chrome 38.0.2125.101.

I've created a gist here.

https://gist.github.com/jedd-ahyoung/5f76affd2075d797a3de

Use GoldenLayout in Only One Section of Angular Web Page

Hello -

This isn't an issue as much as a question. We have an existing Angular Web app and a "tabs" section where we dynamically create tabs and allow the user to close them. However, our tab section is very limited and we'd like to expand its capabilities.

We came across golden-layout and very much like it, but it would take considerable effort to re-factor our entire webpage/application to use golden-layout as the central layout manager.

Is it possible to just apply GoldenLayout to one section, e.g. one HTML element, like a <div> on a page and have it do all its magic and work within that section and that element's corresponding Angular controller?

We are also thinking about trying to wrap a directive around GoldenLayout and possibly isolate it from the rest of the application.

But before we go down any time-intensive paths/tasks, some idea or assessment of the feasibility of this approach by the GoldenLayout team would be much appreciated.

HTML in title attribute

I want to have an icon in a tab, like this:
image

I did it by putting HTML in the config object for my component, like this:

{
  type: 'component',
  componentName: 'template',
  title: '<span class="glyphicon glyphicon-bell"></span> Alarms',
  componentState: { template: 'alarms.html' },
  isClosable: false
}

This will show a tab with icon and text. That's fine. However, there is a problem: The title attribute of the tab is also set to that whole string, with HTML and all, so that we end up with HTML with double quotes inside an attribute. Not good. The grey line in the following screenshot contains the invalid HTML:

image

apply is undefined

Hi ! great job !

Got a bug here:

http://codepen.io/franck34/pen/GopKk

Just drag item "test1" completely at the left of the screen, with js console opened, and you will see "apply is not defined", and the tab is not dropped

image

Strange thing: after this, take "test2" tab and do the same thing. "test1" tab will appear

Exception when using empty stack container

If you create a container of type stack with an empty content array then try and re-position a different container it will generate an error.

http://codepen.io/anon/pen/lCGvy

TypeError: this._activeContentItem is null

If there is at least one item in the stack it will work fine. I think empty stacks should work because the contents may be based on user selection which would mean they would start empty.

IsMoveable item

Hi

Should be great if we can decide that an item is moveable or not, like isCloseable.

Cheers !

Properties to hide default controls?

The demos look great. Have a few questions on functionality.

  1. Was wondering if there's APIs (ideally a simple property setting to enable/disable) to allow for not showing the following controls:
    Popout window
    Maximize / minimize
    Close window
  2. Are there APIs (again ideally a simple property setting to enable/disable) to allow certain windows and/or tab not allow closing and not allow docking to them or undocking them?
  3. Support to show certain pane with tabs on bottom (and bonus to left and right)? And each docked tab to automatically be laid out as the existing pane's tab that gets user docked there?
  4. Is there touch support enabled?

DragListener captures mouse click, focus, ...

I extended tab to contain button. When clicked, it shows inline form with input and button elements (to name preset & save current tab settings).
The problem is, I cannot focus input element, since DragListener captures mousedown event.
See: https://github.com/hoxton-one/golden-layout/blob/master/src/js/utils/DragListener.js#L45

I see no reason to prevent default action on this event. After disabling .preventDefault() call, GL continues to work as expected. Also, it does not prevent other inner elements from receiving events.

Is it really necessary to have this prevent, or not?
Let's discuss.

Twitter bootstrap comptability

First of all,
I'd like to thank you for this great component, it's awesome

Just one question, Can it be compatible with twitter bootstrap themes ?
As you know, twitter bootstrap is largely used and it'll be great if your component can be compatible with it (e.g: bootswatch themes)
I think it's a necessity for UI consistency.

Is there an event that I can subscribe to when an Item is added to the DOM?

I am currently using a plugin that accesses items that are currently on the DOM through document.getElementByID. Searching though the code, it looks like function that adds components to the layout happens before the ContentItem is actually added to the DOM. This is causing problems in the plugin. I gave the item added event a shot but that seems to fire before the item is added. The one event that kind of worked was to subscribe to the 'open' event of the container, but that only fires once when the container is first loaded and has been added to the DOM. We are currently using Backbone as a framework and what i am trying to achieve is to call render() on my view after the contentitem has been added to the DOM. Got any ideas? Any help would be appreciated, I can provide examples if need be.

Thanks!

Fixed width component

Currently I'm trying something where if the component is resized outside a certain size, it will go back to the previous size. This however seems a bit buggy, and it would be nice if we could specify a width or height in absolute pixel values and prevent it from being resized.

Also, it seems when you regroup components without a specified width that are next to another component with a specified width, that specified width is changed.

GL throws error when popouts popped back in

I am experiencing an issue at line 4490 of goldenlayout.js. When I pop a window out, then pop it back in, the code at that line is assuming that childGl will be a GL instance.

if( childGl !== this._childEventSource ) {
    childGl.eventHub._$onEventFromParent( args );
}

If, as in my case, it's not, it throws an error because because undefined !== null and then it tries to call the eventHub property of childGl. I modified it like so:

if( childGl && childGl !== this._childEventSource ) {
    childGl.eventHub._$onEventFromParent( args );
}

While this solved the bug when popped back in, it created a new issue which is happening if I try to pop-out any of the other windows. I'm getting what appears to be a recursive stack overflow when the myLayout.toConfig() code is called. Almost as if it's just firing a stateChanged event internally:

myLayout.on( 'stateChanged', function(){
    var state = JSON.stringify( myLayout.toConfig() );
    localStorage.setItem( 'savedState', state );
});

Any ideas?

Incorporate with reveal.js?

Hi,
I tried to incorporate golden-layout with reveal.js but it seems that there is some css issues. I don't think it is directly related to golden layout but I am not sure where to ask.
Here is the codepen of my try: http://codepen.io/zippeurfou/full/JoPLXW
It would be awesome to be able to use it with reveal.js.
I have noticed that the display is bad if I don't tweak the div where I put golden layout with < 'div id="Glayout" style="min-width: 400px; height: 400px; margin: 0 auto; zoom: 150%;">.
I believe the fact that I do this tweak, make the bugs you can see for the headers and the drag and drop area.
As a side note (which is not important), when I want to include a dygraph graph inside, it is not shown unless I show the chrome inspector or use the dirty solution I implemented. I believe it has to do with the fact that dygraph is trying to draw the graph when golden layout is not yet initialized.
Note that, the dygraph graph works fine if it is not "inside" the golden layout (http://codepen.io/zippeurfou/full/MYgQMN).
Any suggestion?
Best,

Extra, unneeded tab

Would it be possible to have an option which hides the tab in the header if there is only one tab? I have an instance where I have a column, which contains a stack with a single column in it which also contains a stack. So I'm getting something like:

  _________ ____________ ____________
/  Trade  /  Charting  /  WatchList  |
 _______________
/ angularModule |
|                +-----------------------------------

Having that "angularModule" tab is really ugly. I ended up hacking it by doing:

myLayout.on('componentCreated', function(col) {
        if (col.config.componentState && col.config.componentState.id === 'tradeTop') {
            col.parent.header.element.hide();
        }
    });

Ideally, I'd be able to set an option for that column's first content item to not display the tab in this case. The configuration for it starts like this (the one in question is the first component of type angularModule):

{
  type: 'column',
  content: [{
    type: 'stack',
    content: [
      {
        type: 'column',
        title: 'Trade',
        content: [
          {
            type: 'component',
            componentName: 'angularModule',
            height: 18,
            hideIfOnlyTab: true,   // <--- Maybe something like this?
            componentState: {
              id: 'tradeTop',
              directive: 'trade-tab',
              symbol: 'AAPL'
            }
          },
          {
            type: 'stack',
            content: [
              {
                type: 'component',
                title: 'Chart',
                componentName: 'dummy',
                componentState: {
                  label: 'Charting'
                }
              },
              {
                type: 'component',
                title: 'Research',
                componentName: 'dummy',
                componentState: {
                  label: 'Research'
                }
              },
              {
                type: 'component',
                title: 'News',
                componentName: 'dummy',
                componentState: {
                  label: 'News'
                }
              },
              {
                type: 'component',
                title: 'Option Chain',
                componentName: 'dummy',
                componentState: {
                  label: 'Options'
                }
              },
              {
                type: 'component',
                title: 'Market Depth',
                componentName: 'dummy',
                componentState: {
                  label: 'Market Depth'
                }
              }
            ]
          }
        ]
      }

"data:image/png..." for every tab?

Each time I mouse over a tab in GL, the "x" icon is reloaded in the "Network" panel on the web debugger in Chrome. The requests are only 1ms long and they come from cache, but something is causing that image to "load" over and over just mousing over tabs.

tabs height

Hi

What's the best way to customize tabs height ?

GL 1.0.10 Performance Issue

So we've been using GL 1.0.8 for a long time and just recently upgraded to 1.0.10.

We are now seeing multiple second delay when switching between tabs in our UI.

I downgraded to 1.0.9 and 1.0.8 and both worked flawlessly. Both versions are using jquery 2.1.4.

Here is a Chrome profile of switching tabs using 1.0.10:
image

Here is a Chrome profile of switching tabs using 1.0.9:
image

Integration with Node-Webkit?

Has there been an integration of Golden-Layout with Node-WebKit, if so is there a recommended way of doing it?

I'm thinking of using Golden-Layout to add multi-tab support to the NWR - Node-Webkit-REPL project I'm working on.

Quick question on the licensing of Golden-Layout, its current GPL license means that It can be used by projects that are licensed under Apache 2.0 (like mine), right?

Unable to drag a drag source back out of a layout.

When you drag a drag source into a layout, then you drag it out of a layout without dropping, the component will still build inside the layout.

Expected Behavior:
Dragging a drag source or a pane outside the layout will remove it from the layout.

Bootstrap modal inside content

I'm using Twitter Bootstrap and when using modal, it opens and fill the whole window instead of the tab.

There should be a way to limit the modal to the tab and not to the entire window...

hack: closing unclosable panel & layout glitches

I can "hack" golden-layout to close an unclosable panel. I've initialized a "row" that is marked as not closable, it has 1 "main" child that is also not closable:

var myLayout = new GoldenLayout({
                settings: {
                    showPopoutIcon : false
                },
                content: [{
                    type: 'row',
                    isClosable: false,
                    content: [{
                        type: 'component',
                        title: '<div id="DocTitle"></div>',
                        componentName: 'template',
                        componentState: { templateId: 'ng/stage/stage.html' },
                        isClosable: false
                    }]
                }]
            });

I'm adding a new panel in response to some user interaction, with this code:

var newItemConfig = {
                    title: 'Products',
                    type: 'component',
                    componentName: 'template',
                    componentState: { templateId: 'ng/products/productsPartial.html' }
                };
                myLayout.root.contentItems[ 0 ].addChild( newItemConfig );

At this point it looks like this:
selection_111

I then click on the left hand "tab" & drag it into the right hand "area":

selection_112

At this point I consider the layout "broken". I would expect the stacked "Area" to consume 100% width, but instead it only consumes 50% width. From this state my user can "resize" the panel up to 99.99% width but it does not behave properly as if it is 100% width.

You'll also notice the "unclosable" panel is now contained inside a stacked element that is closable. I can click on the "x" on the right most edge. I'm left with a 100% totally blank page, no more layout elements left. I'll omit the screenshot, its just a blank page (depending on page's bg color, etc.)

The way it should work instead is if I drag an "unclosable" panel into a group, the "x" for that group is disabled until I drag any & all "unclosable" panels out of that group, at which point the "x" for that group is re-enabled. Also if I drag all children of a row into one group, that group should occupy 100% of the width of the parent row.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.