1.2.3 • Published 2 years ago

ninja-splitter v1.2.3

Weekly downloads
115
License
MIT
Repository
github
Last release
2 years ago

ninja-splitter

Splitter component for Angular 9+

Inspired by https://github.com/wannabegeek/ng2-split-pane. (Can be used up to Angular 8)

There are 2 types of split panes: horizontal-ninja and vertical-ninja

Install


You can either download the whole project or install it via NPM:

$ npm install ninja-splitter

The following configuration properties are available to client code:

KeyRangeDoes
primary-minsizevalue in pixelsMinimal allowed size for primary pane
secondary-minsizevalue in pixelsMinimal allowed size for secondary pane
separator-width-pxvalue in pixels (5 by default)The thickness of the separator between the primary and secondary components
primary-component-toggleboolean true or false (false by default)Hide the primary component and the separator
secondary-component-toggleboolean true or false (false by default)Hide the secondary component and the separator
primary-component-initialratioinitial value in a ratio of primary/secondary (range 0-1)The initial size to create the primary pane (secondary will fill the remaining), this value will be over-ridden if a value is found in the local storage.
local-storage-keystring value used as the local storage key keyIf this value is present the current splitter position will be stored in local storage

Styling


You can define the following css variables to override default styling:

CSS-variableResponsible forDefault
--ninja-separator-background-colorBackground color of the separator HTML element#fff
--ninja-separator-hover-background-colorHover background color of the separator HTML element#fafafa
--ninja-separator-hcursorHorizontal separator cursorns-resize
--ninja-separator-vcursorVertical separator cursorew-resize

Example


<horizontal-ninja
    primary-minsize="50"
    secondary-minsize="100"
    [primary-component-toggle]="false"
    [secondary-component-toggle]="condition"
    local-storage-key="ninja"
    primary-component-initialratio="0.8">

    <div class="ninja-content-primary">
        <span>
            Upper pane
        </span>
    </div>

    <div class="ninja-content-secondary">
        <span>
            Lower pane
        </span>
    </div>

</horizontal-ninja>

Import

// Please note the module is not in the root
import { NinjaSplitterModule } from 'ninja-splitter';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        NinjaSplitterModule
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }

Events

(on-change) - emitted on resizing

(on-begin-resizing) - emitted when the user begins dragging the separator

(on-ended-resizing) - emitted when the user releases the separator after dragging

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

3 years ago

1.1.13

3 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago