From 5ac822cad8600f6d24b29ceae4bc0bd421913084 Mon Sep 17 00:00:00 2001 From: Atanas Atanasov Date: Sun, 30 Apr 2017 14:44:03 +0300 Subject: [PATCH] added editor widget --- Gijgo.GitHub.csproj | 4 + Gruntfile.js | 21 +- dist/combined/css/gijgo.css | 97 + dist/combined/css/gijgo.min.css | 2 +- dist/combined/js/gijgo.js | 396 +- dist/combined/js/gijgo.min.js | 2 +- dist/gijgo/1.3.1-pre-release/css/gijgo.css | 970 -- .../gijgo/1.3.1-pre-release/css/gijgo.min.css | 1 - dist/gijgo/1.3.1-pre-release/js/gijgo.js | 9983 ----------------- dist/gijgo/1.3.1-pre-release/js/gijgo.min.js | 4 - .../js/messages/messages.bg-bg.js | 23 - .../js/messages/messages.de-de.js | 23 - .../js/messages/messages.fr-fr.js | 23 - .../js/messages/messages.pt-br.js | 23 - dist/gijgo/package.json | 47 - dist/modular/checkbox/css/checkbox.css | 42 + dist/modular/checkbox/js/checkbox.js | 6 +- dist/modular/dialog/css/dialog.css | 42 + dist/modular/dialog/css/dialog.min.css | 2 +- dist/modular/editor/css/editor.css | 150 + dist/modular/editor/js/editor.js | 636 ++ dist/modular/grid/css/grid.css | 42 + dist/modular/grid/css/grid.min.css | 2 +- dist/modular/tree/css/tree.css | 42 + dist/modular/tree/css/tree.min.css | 2 +- .../editor/Editor.Base.change.sample.html | 21 + examples/editor/Editor.Base.content.Get.html | 19 + examples/editor/Editor.Base.content.Set.html | 19 + .../editor/Editor.Base.destroy.sample.html | 18 + .../editor/Editor.Base.height.sample.html | 19 + ...consLibrary.Base.Theme.Material.Icons.html | 22 + .../Editor.Base.uiLibrary.Bootstrap.3.html | 21 + .../Editor.Base.uiLibrary.Bootstrap.4.html | 20 + ...Editor.Base.uiLibrary.Material.Design.html | 17 + examples/editor/Editor.Base.width.sample.html | 19 + examples/editor/index.html | 12 + index.html | 1 + src/checkbox/js/checkbox.base.js | 6 +- src/editor/css/editor.base.css | 54 + src/editor/js/editor.base.js | 367 + src/editor/js/header.txt | 7 + src/editor/js/messages/messages.en-us.js | 23 + src/widget.css | 42 + 43 files changed, 2178 insertions(+), 11114 deletions(-) delete mode 100644 dist/gijgo/1.3.1-pre-release/css/gijgo.css delete mode 100644 dist/gijgo/1.3.1-pre-release/css/gijgo.min.css delete mode 100644 dist/gijgo/1.3.1-pre-release/js/gijgo.js delete mode 100644 dist/gijgo/1.3.1-pre-release/js/gijgo.min.js delete mode 100644 dist/gijgo/1.3.1-pre-release/js/messages/messages.bg-bg.js delete mode 100644 dist/gijgo/1.3.1-pre-release/js/messages/messages.de-de.js delete mode 100644 dist/gijgo/1.3.1-pre-release/js/messages/messages.fr-fr.js delete mode 100644 dist/gijgo/1.3.1-pre-release/js/messages/messages.pt-br.js delete mode 100644 dist/gijgo/package.json create mode 100644 dist/modular/editor/css/editor.css create mode 100644 dist/modular/editor/js/editor.js create mode 100644 examples/editor/Editor.Base.change.sample.html create mode 100644 examples/editor/Editor.Base.content.Get.html create mode 100644 examples/editor/Editor.Base.content.Set.html create mode 100644 examples/editor/Editor.Base.destroy.sample.html create mode 100644 examples/editor/Editor.Base.height.sample.html create mode 100644 examples/editor/Editor.Base.iconsLibrary.Base.Theme.Material.Icons.html create mode 100644 examples/editor/Editor.Base.uiLibrary.Bootstrap.3.html create mode 100644 examples/editor/Editor.Base.uiLibrary.Bootstrap.4.html create mode 100644 examples/editor/Editor.Base.uiLibrary.Material.Design.html create mode 100644 examples/editor/Editor.Base.width.sample.html create mode 100644 examples/editor/index.html create mode 100644 src/editor/css/editor.base.css create mode 100644 src/editor/js/editor.base.js create mode 100644 src/editor/js/header.txt create mode 100644 src/editor/js/messages/messages.en-us.js diff --git a/Gijgo.GitHub.csproj b/Gijgo.GitHub.csproj index 5899cab6..909cbea8 100644 --- a/Gijgo.GitHub.csproj +++ b/Gijgo.GitHub.csproj @@ -79,6 +79,10 @@ + + + + diff --git a/Gruntfile.js b/Gruntfile.js index 83efd745..0db0ef7a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -22,7 +22,8 @@ { src: ['src/droppable/js/*.js'], dest: 'examples/droppable/' }, { src: ['src/grid/js/*.js'], dest: 'examples/grid/' }, { src: ['src/tree/js/*.js'], dest: 'examples/tree/' }, - { src: ['src/checkbox/js/*.js'], dest: 'examples/checkbox/' } + { src: ['src/checkbox/js/*.js'], dest: 'examples/checkbox/' }, + { src: ['src/editor/js/*.js'], dest: 'examples/editor/' } ] } }, @@ -66,6 +67,12 @@ 'dist/modular/checkbox/css/checkbox.code.css': ['src/checkbox/css/checkbox.base.css'] } }, + editor: { + files: { + 'dist/modular/editor/js/editor.code.js': ['src/editor/js/messages/messages.en-us.js', 'src/editor/js/editor.base.js'], + 'dist/modular/editor/css/editor.code.css': ['src/editor/css/editor.base.css'] + } + }, final: { files: { 'dist/modular/draggable/js/draggable.js': ['src/draggable/js/header.txt', 'src/widget.js', 'dist/modular/draggable/js/draggable.code.js'], @@ -78,9 +85,11 @@ 'dist/modular/tree/css/tree.css': ['src/widget.css', 'dist/modular/tree/css/tree.code.css'], 'dist/modular/checkbox/js/checkbox.js': ['src/checkbox/js/header.txt', 'src/widget.js', 'dist/modular/checkbox/js/checkbox.code.js'], 'dist/modular/checkbox/css/checkbox.css': ['src/widget.css', 'dist/modular/checkbox/css/checkbox.code.css'], + 'dist/modular/editor/js/editor.js': ['src/editor/js/header.txt', 'src/widget.js', 'dist/modular/editor/js/editor.code.js'], + 'dist/modular/editor/css/editor.css': ['src/widget.css', 'dist/modular/editor/css/editor.code.css'], - 'dist/combined/js/gijgo.js': ['src/header.txt', 'src/widget.js', 'dist/modular/dialog/js/dialog.code.js', 'dist/modular/draggable/js/draggable.code.js', 'dist/modular/droppable/js/droppable.code.js', 'dist/modular/grid/js/grid.code.js', 'dist/modular/tree/js/tree.code.js', 'dist/modular/checkbox/js/checkbox.code.js'], - 'dist/combined/css/gijgo.css': ['src/widget.css', 'dist/modular/dialog/css/dialog.code.css', 'dist/modular/grid/css/grid.code.css', 'dist/modular/tree/css/tree.code.css', 'dist/modular/checkbox/css/checkbox.code.css'], + 'dist/combined/js/gijgo.js': ['src/header.txt', 'src/widget.js', 'dist/modular/dialog/js/dialog.code.js', 'dist/modular/draggable/js/draggable.code.js', 'dist/modular/droppable/js/droppable.code.js', 'dist/modular/grid/js/grid.code.js', 'dist/modular/tree/js/tree.code.js', 'dist/modular/checkbox/js/checkbox.code.js', 'dist/modular/editor/js/editor.code.js'], + 'dist/combined/css/gijgo.css': ['src/widget.css', 'dist/modular/dialog/css/dialog.code.css', 'dist/modular/grid/css/grid.code.css', 'dist/modular/tree/css/tree.code.css', 'dist/modular/checkbox/css/checkbox.code.css', 'dist/modular/editor/css/editor.code.css'], 'dist/combined/js/messages/messages.bg-bg.js': ['src/dialog/js/messages/messages.bg-bg.js', 'src/grid/js/messages/messages.bg-bg.js'], 'dist/combined/js/messages/messages.fr-fr.js': ['src/dialog/js/messages/messages.fr-fr.js', 'src/grid/js/messages/messages.fr-fr.js'], 'dist/combined/js/messages/messages.de-de.js': ['src/dialog/js/messages/messages.de-de.js', 'src/grid/js/messages/messages.de-de.js'], @@ -328,6 +337,9 @@ var writer = { case 'checkbox': result += ' \r\n'; break; + case 'editor': + result += ' \r\n'; + break; } } for (i = 0; i < names.length; i++) { @@ -351,6 +363,9 @@ var writer = { case 'checkbox': result += ' \r\n'; break; + case 'editor': + result += ' \r\n'; + break; } } } diff --git a/dist/combined/css/gijgo.css b/dist/combined/css/gijgo.css index b2b60f2a..9744a44e 100644 --- a/dist/combined/css/gijgo.css +++ b/dist/combined/css/gijgo.css @@ -52,6 +52,48 @@ content: "\E15B"; } +/** Material Design */ +.gj-md-button:hover { + background-color: rgba(158,158,158,.2); +} + +.gj-md-button { + background: 0 0; + border: none; + border-radius: 2px; + color: #000; + position: relative; + height: 36px; + margin: 0; + min-width: 64px; + padding: 0 16px; + display: inline-block; + font-family: "Roboto","Helvetica","Arial",sans-serif; + font-size: 14px; + font-weight: 500; + text-transform: uppercase; + letter-spacing: 0; + overflow: hidden; + will-change: box-shadow; + transition: box-shadow .2s cubic-bezier(.4,0,1,1),background-color .2s cubic-bezier(.4,0,.2,1),color .2s cubic-bezier(.4,0,.2,1); + outline: none; + cursor: pointer; + text-decoration: none; + text-align: center; + line-height: 36px; + vertical-align: middle; +} + +.gj-md-button-active { + background-color: rgba(158,158,158,.4); +} + +.gj-md-button-group { + position: relative; + display: inline-block; + vertical-align: middle; +} + .gj-draggable { cursor: move; } @@ -1000,3 +1042,58 @@ li.gj-tree-mdl-item [data-role="image"] { background-color: rgba(0,0,0,.54); } + +/* Material Design */ + +.gj-editor-md { + padding: 7px; + font-family: "Roboto","Helvetica","Arial",sans-serif; + font-size: 14px; + font-weight: 500; + letter-spacing: 0; + border: 1px solid rgba(158,158,158,.2); +} + +.gj-editor-md [data-role="toolbar"] { + margin-bottom: 7px; +} + +.gj-editor-md div[data-role="body"] { + border: 1px solid rgba(158,158,158,.2); +} + +.gj-editor-md p { + margin: 0; + padding: 0; +} + +.gj-editor-md blockquote { + font-size: 14px; +} + +/* Bootstrap */ +.gj-editor-bootstrap { + padding: 7px; + border: 1px solid #eceeef; +} + +.gj-editor-bootstrap [data-role="toolbar"] { + margin-bottom: 7px; +} + +.gj-editor-bootstrap [data-role="toolbar"] .btn-group { + margin-right: 10px; +} + +.gj-editor-bootstrap div[data-role="body"] { + border: 1px solid #eceeef; +} + +.gj-editor-bootstrap p { + margin: 0; + padding: 0; +} + +.gj-editor-bootstrap blockquote { + font-size: 14px; +} \ No newline at end of file diff --git a/dist/combined/css/gijgo.min.css b/dist/combined/css/gijgo.min.css index 35c74d23..116baa3d 100644 --- a/dist/combined/css/gijgo.min.css +++ b/dist/combined/css/gijgo.min.css @@ -1 +1 @@ -.gj-button,.gj-cursor-pointer{cursor:pointer}.gj-button{background-color:#f5f5f5;border:1px solid #ddd;color:#000;border-radius:3px;padding:6px 10px}.gj-footer,.gj-header{min-height:16.43px;padding:15px}.gj-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.gj-margin-left-5{margin-left:5px}.gj-margin-left-10{margin-left:10px}.gj-width-full{width:100%}.gj-text-align-center{text-align:center}.gj-font-size-16{font-size:16px}.gj-hidden{display:none}.gj-mdl-icon-plus::after{content:"\E145"}.gj-mdl-icon-minus::after{content:"\E15B"}.gj-draggable{cursor:move}.gj-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none;z-index:90}.gj-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.gj-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.gj-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.gj-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.gj-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.gj-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.gj-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.gj-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.gj-dialog-footer{position:absolute;bottom:0;width:100%;margin-top:0}.gj-modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.gj-dirty,TABLE.gj-grid-table>tbody>tr>td,TABLE.gj-grid-table>thead>tr>th{overflow:hidden}.gj-header{border-bottom:1px solid #e5e5e5}.gj-footer{border-top:1px solid #e5e5e5;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.gj-close,.gj-dialog-mdl-close{-webkit-appearance:none;background:0 0;border:0;float:right;cursor:pointer}.gj-title{margin:2px}.gj-close{padding:0;font-size:21px;color:#000}.gj-body{position:relative;padding:15px}div.gj-dialog-ui-header{padding:10px;border-left:0;border-right:0;border-top:0}button.gj-dialog-ui-close{float:right;width:24px;height:24px;text-decoration:none;padding:0}h4.gj-dialog-ui-title{margin:0;line-height:24px}div.gj-dialog-ui-body{padding:10px}.gj-dialog-mdl-close{padding:0;font-size:2.5em;margin:24px 24px 0}.gj-dialog-mdl-content{background-color:#FFF}DIV.gj-grid-wrapper{margin:auto;position:relative;clear:both}TABLE.gj-grid-table{margin:auto;border-collapse:collapse;width:100%;table-layout:fixed}TABLE.gj-grid-table THEAD TH [data-role=selectAll]{margin:auto}TABLE.gj-grid-table THEAD TH [data-role=title],TABLE.gj-grid-table THEAD TH [data-role=sorticon]{display:inline-block}TABLE.gj-grid-table DIV[data-role=display],TABLE.gj-grid-table DIV[data-role=display] DIV{vertical-align:middle;text-indent:0;display:inline-block;white-space:pre-wrap;-ms-word-break:break-word;word-break:break-word}TABLE.gj-grid-table .fa{padding:2px}DIV.gj-grid-wrapper DIV.gj-grid-loading-cover{background:#BBB;opacity:.5;position:absolute;vertical-align:middle}.gj-grid-base-active,.gj-grid-base-table tbody tr:hover,.gj-grid-base-table thead tr th{background-color:#f5f5f5}DIV.gj-grid-wrapper DIV.gj-grid-loading-text{position:absolute;font-weight:700}.gj-dirty{position:absolute;width:0;height:0;border-style:solid;border-width:3px;border-color:red transparent transparent red;padding:0;vertical-align:top}TABLE.gj-grid-table .gj-grid-icon{margin:0 2px;cursor:pointer;overflow:visible;width:16px;height:16px}table.gj-grid-bootstrap-table thead th [data-role=sorticon],table.mdl-data-table thead th [data-role=sorticon]{margin-left:5px}.gj-grid-base-table{border:1px solid #ddd;font-family:Helvetica,Arial,sans-serif;font-size:14px}.gj-grid-base-table thead tr th{border:1px solid #ddd;padding:2px 1px}.gj-grid-base-table tbody tr td{border:1px solid #ddd}.gj-grid-base-table tbody tr td div[data-role=display],.gj-grid-base-table thead tr th div{padding:3px}div.gj-grid-wrapper div.gj-grid-base-toolbar{background-color:#f5f5f5;padding:5px;font-weight:700;border:1px solid #ddd}.gj-content{border:1px solid #999;background-color:#fff;border-radius:6px;outline:0}div.gj-grid-wrapper div.gj-grid-bootstrap-toolbar{background-color:#f5f5f5;padding:8px;font-weight:700;border:1px solid #ddd}table.gj-grid-bootstrap-table thead th{background-color:#f5f5f5;vertical-align:middle}table.gj-grid-bootstrap-table tbody tr td div[data-role=display]{padding:0}div.gj-grid-wrapper div.gj-grid-ui-toolbar{border-top:1px solid menutext;border-left:1px solid menutext;border-right:1px solid menutext;border-bottom:0;padding:2px;font:11px Verdana}TABLE.gj-grid-ui-table{font:11px Verdana;border-left:1px solid;border-top:0;border-right:1px solid;border-bottom:0;padding:0;border-spacing:0}table.gj-grid-ui-table thead tr th.gj-grid-ui-thead-th{height:20px;padding:0;white-space:normal;vertical-align:middle;border:1px solid menutext;border-spacing:0;border-collapse:collapse;text-align:center;-moz-user-select:none;-khtml-user-select:none}table.gj-grid-ui-table thead tr th:first-child{border-left:0}table.gj-grid-ui-table thead tr th div{padding:2px;vertical-align:middle;display:inline-block}table.gj-grid-ui-table thead tr th span.gj-grid-ui-thead-th-sort-icon{vertical-align:middle;display:inline-block}table.gj-grid-ui-table tbody tr.ui-state-hover{border:0}TABLE.gj-grid-ui-table>tbody>tr>td{padding:0;border-left:1px solid;border-top:0;border-right:0;border-bottom:1px solid;border-color:menutext}TABLE.gj-grid-ui-table>tbody>tr>td:first-child{border-left:0}TABLE.gj-grid-table>tbody>tr>td>div{padding:2px;overflow:hidden}table.mdl-data-table thead th [data-role=sorticon] i.material-icons{position:absolute;font-size:18px;top:16px}.gj-grid-table .gj-grid-mdl-limit-select{text-align:right;display:inline-block;width:50px;padding:0 5px;margin-left:10px;font-size:13px}.gj-grid-table .gj-grid-mdl-page{text-align:right;display:inline-block;width:32px;padding:0;font-size:13px}.gj-grid-table .gj-grid-mdl-pager-label{padding:0 5px;font-size:13px}table.mdl-data-table tr td{text-align:left}@media only all{td.display-1120,td.display-320,td.display-480,td.display-640,td.display-800,td.display-960,th.display-1120,th.display-320,th.display-480,th.display-640,th.display-800,th.display-960{display:none}}@media screen and (min-width:20em){TABLE.gj-grid-table td.display-320,TABLE.gj-grid-table th.display-320{display:table-cell}}@media screen and (min-width:30em){TABLE.gj-grid-table td.display-480,TABLE.gj-grid-table th.display-480{display:table-cell}}@media screen and (min-width:40em){TABLE.gj-grid-table td.display-640,TABLE.gj-grid-table th.display-640{display:table-cell}}@media screen and (min-width:50em){TABLE.gj-grid-table td.display-800,TABLE.gj-grid-table th.display-800{display:table-cell}}@media screen and (min-width:60em){TABLE.gj-grid-table td.display-960,TABLE.gj-grid-table th.display-960{display:table-cell}}@media screen and (min-width:70em){TABLE.gj-grid-table td.display-1120,TABLE.gj-grid-table th.display-1120{display:table-cell}}.gj-grid-base-table tfoot th{background-color:#f5f5f5;border:1px solid #ddd;padding:3px;font-weight:400;line-height:29px}.gj-grid-base-table tfoot th button{margin:0 3px;background-color:#f5f5f5;border-radius:4px;text-decoration:none;padding:6px 12px;border:1px solid #ddd;color:#337ab7;width:34px;outline:0}.gj-grid-base-table tfoot th button.gj-grid-base-active{background-color:#fff}.gj-grid-base-table tfoot th input{margin:0 5px;width:26px;text-align:right}TABLE.gj-grid-table TFOOT TH.ui-grid-pager-cell{height:20px;padding:0;cursor:default;border:1px solid menutext;-moz-user-select:none;-khtml-user-select:none;user-select:none}TABLE.gj-grid-table TFOOT DIV.ui-grid-pager{overflow:hidden}TABLE.gj-grid-table TFOOT INPUT.ui-grid-pager{padding:1px;width:26px;height:17px;font:700 11px Verdana;margin:0 5px;text-align:right}TABLE.gj-grid-table TFOOT SELECT.ui-grid-page-sizer{padding:0;height:17px;font:700 11px Verdana;margin:0 5px;text-align:right;width:50px}TABLE.gj-grid-table tfoot tr th.gj-grid-bootstrap-tfoot-cell{line-height:30px;background-color:#f5f5f5}.gj-grid-table thead tr th div.gj-grid-column-resizer-wrapper{position:relative;width:100%;height:0;top:0;left:0;padding:0}span.gj-grid-column-resizer{position:absolute;right:0;width:5px;top:-100px;height:300px;z-index:100;cursor:e-resize}.gj-grid-resize-cursor{cursor:e-resize}.gj-grid-table tbody tr.gj-grid-base-top-border td{border-top:2px solid #777}.gj-grid-table tbody tr.gj-grid-base-bottom-border td{border-bottom:2px solid #777}.gj-grid-base-table tbody tr td.gj-grid-base-left-border,.gj-grid-base-table thead tr th.gj-grid-base-left-border{border-left:2px solid #777}.gj-grid-base-table tbody tr td.gj-grid-base-right-border,.gj-grid-base-table thead tr th.gj-grid-base-right-border{border-right:2px solid #777}ul.gj-tree-list{list-style:none;padding:0;margin:0}li.gj-tree-item{padding:0}li.gj-tree-item div[data-role=wrapper]{display:table;width:100%}li.gj-tree-item [data-role=spacer]{display:table-cell}[data-type=tree] ul li [data-role=expander]{display:table-cell;vertical-align:middle;text-align:center;cursor:pointer;width:10px}li.gj-tree-item [data-role=checkbox]{display:table-cell;vertical-align:middle;text-align:center;width:20px}li.gj-tree-item [data-role=image]{display:table-cell;vertical-align:middle;text-align:center;width:22px}li.gj-tree-item [data-role=display]{display:table-cell;vertical-align:middle;cursor:pointer;padding:2px 4px}.gj-tree-base-active span[data-role=display]{background-color:#ddd}ul.gj-tree-bootstrap-list{padding-left:0;margin-bottom:0}li ul.gj-tree-bootstrap-list{padding-left:0;width:100%}ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item{border-left:0;border-right:0}ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item:first-child{border-top-left-radius:0;border-top-right-radius:0}ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item:last-child{border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}ul.gj-tree-bootstrap-list li [data-role=wrapper]{padding:0 10px}ul.gj-tree-bootstrap-list li [data-role=checkbox]{width:24px;padding-top:4px}ul.gj-tree-bootstrap-list li [data-role=image]{width:24px}.gj-tree-bootstrap-3 ul.gj-tree-bootstrap-list li [data-role=display]{padding:12px 0 8px 5px}.gj-tree-bootstrap-4 ul.gj-tree-bootstrap-list li [data-role=display]{padding:8px 0 8px 5px}.gj-tree-mdl-item,.gj-tree-mdl-list{list-style-type:none;padding:0}.list-group-item.active ul li,.list-group-item.active:focus ul li,.list-group-item.active:hover ul li{text-shadow:none;color:initial}ul.gj-tree-bootstrap-list li.gj-tree-item{border:0}.gj-tree-bootstrap-border ul.gj-tree-bootstrap-list li.gj-tree-item{border:1px solid #ddd}.gj-tree-mdl-item{display:list-item;min-height:unset}li.gj-tree-item.gj-tree-mdl-item [data-role=display]{padding:8px 0 8px 5px}.gj-tree-mdl-border .gj-tree-mdl-item{border:1px solid rgba(0,0,0,.87);margin-bottom:-1px}.gj-tree-mdl-border ul.gj-tree-mdl-list li.gj-tree-item ul li.gj-tree-item{border-left:0;border-right:0}.gj-tree-mdl-border ul.gj-tree-mdl-list li.gj-tree-item ul li.gj-tree-item:last-child{border-bottom:0}li.gj-tree-mdl-item [data-role=checkbox],li.gj-tree-mdl-item [data-role=image]{height:24px;width:24px}.gj-tree-mdl-active{background:#b3d4fc}[data-type=tree] ul li [data-role=expander].gj-tree-material-icons-expander{height:24px;width:24px}[data-type=tree] ul li [data-role=expander].gj-tree-font-awesome-expander,[data-type=tree] ul li [data-role=expander].gj-tree-glyphicons-expander{width:24px}.gj-tree-drop-above{border-top:1px solid #000}.gj-tree-drop-below{border-bottom:1px solid #000}.gj-tree-drag-el,.gj-tree-drag-el li{padding:0;margin:0}.gj-tree-drag-el [data-role=wrapper]{cursor:move;display:table}.gj-tree-drag-el [data-role=indicator]{width:14px;padding:0 3px;display:table-cell;vertical-align:middle;text-align:center}.gj-tree-bootstrap-drag-el [data-role=indicator],.gj-tree-mdl-drag-el [data-role=indicator]{width:24px;height:24px;padding:0}.gj-checkbox-bootstrap{min-width:0;font-size:0;font-weight:400;margin:0;text-align:center;width:18px;height:18px}.gj-checkbox-bootstrap input[type=checkbox]{display:none;margin-bottom:-12px}.gj-checkbox-bootstrap span{background:#fff;display:block;content:" ";width:18px;height:18px;line-height:11px;font-size:11px;padding:2px;margin-right:4px;color:#555;border:1px solid #ccc;border-radius:3px;transition:box-shadow .2s linear,border-color .2s linear;cursor:pointer}.gj-checkbox-bootstrap input[type=checkbox]:focus+span:before{outline:0;box-shadow:0 0 0 0 #66afe9,0 0 6px rgba(102,175,233,.6);border-color:#66afe9}.gj-checkbox-bootstrap input[type=checkbox]:checked+span:before{display:inline-block;font-family:'Glyphicons Halflings';content:"\e013 "}.gj-checkbox-bootstrap input[type=checkbox]:indeterminate+span:before{display:inline-block;font-family:'Glyphicons Halflings';content:"\2212 "}.gj-checkbox-bootstrap input[type=checkbox][disabled]+span{opacity:.6;cursor:not-allowed}.gj-checkbox-bootstrap input[type=checkbox][disabled]+span:before{background:#eee;border:1px solid #ccc;color:#888}.gj-checkbox-md{min-width:0;font-size:0;font-weight:400;margin:0;text-align:center;width:16px;height:16px;position:relative}.gj-checkbox-md input[type=checkbox]{display:none;margin-bottom:-12px}.gj-checkbox-md span{display:inline-block;box-sizing:border-box;width:16px;height:16px;margin:0;cursor:pointer;overflow:hidden;border:2px solid rgba(0,0,0,.54);border-radius:2px;z-index:2}.gj-checkbox-md input[type=checkbox]:checked+span,.gj-checkbox-md input[type=checkbox]:indeterminate+span{border:2px solid #3f51b5}.gj-checkbox-md input[type=checkbox]:checked+span::after{content:"\E876";font-size:14px;background-color:#3f51b5;font-weight:700;color:#FFF;white-space:pre;position:absolute;left:1px;top:-15px}.gj-checkbox-md input[type=checkbox]:indeterminate+span:after{content:"\E15B";font-size:14px;background-color:#3f51b5;font-weight:700;color:#FFF;white-space:pre;position:absolute;left:1px;top:-15px}.gj-checkbox-md input[type=checkbox][disabled]+span{background-color:rgba(0,0,0,.54);border:2px solid rgba(0,0,0,.54)}.gj-checkbox-md input[type=checkbox][disabled]+span:after{background-color:rgba(0,0,0,.54)} \ No newline at end of file +.gj-md-button,.gj-modal{overflow:hidden;outline:0}.gj-button,.gj-cursor-pointer,.gj-md-button{cursor:pointer}.gj-md-button,.gj-text-align-center{text-align:center}.gj-button{background-color:#f5f5f5;border:1px solid #ddd;color:#000;border-radius:3px;padding:6px 10px}.gj-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.gj-margin-left-5{margin-left:5px}.gj-margin-left-10{margin-left:10px}.gj-width-full{width:100%}.gj-font-size-16{font-size:16px}.gj-hidden{display:none}.gj-md-button,.gj-md-button-group{position:relative;display:inline-block;vertical-align:middle}.gj-mdl-icon-plus::after{content:"\E145"}.gj-mdl-icon-minus::after{content:"\E15B"}.gj-md-button:hover{background-color:rgba(158,158,158,.2)}.gj-md-button{background:0 0;border:none;border-radius:2px;color:#000;height:36px;margin:0;min-width:64px;padding:0 16px;font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;font-weight:500;text-transform:uppercase;letter-spacing:0;will-change:box-shadow;transition:box-shadow .2s cubic-bezier(.4,0,1,1),background-color .2s cubic-bezier(.4,0,.2,1),color .2s cubic-bezier(.4,0,.2,1);text-decoration:none;line-height:36px}.gj-footer,.gj-header{min-height:16.43px;padding:15px}.gj-md-button-active{background-color:rgba(158,158,158,.4)}.gj-draggable{cursor:move}.gj-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none;z-index:90}.gj-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.gj-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.gj-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.gj-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.gj-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.gj-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.gj-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.gj-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.gj-dialog-footer{position:absolute;bottom:0;width:100%;margin-top:0}.gj-modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;display:none;-webkit-overflow-scrolling:touch}.gj-dirty,TABLE.gj-grid-table>tbody>tr>td,TABLE.gj-grid-table>thead>tr>th{overflow:hidden}.gj-header{border-bottom:1px solid #e5e5e5}.gj-footer{border-top:1px solid #e5e5e5;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.gj-close,.gj-dialog-mdl-close{-webkit-appearance:none;background:0 0;border:0;float:right;cursor:pointer}.gj-title{margin:2px}.gj-close{padding:0;font-size:21px;color:#000}.gj-body{position:relative;padding:15px}div.gj-dialog-ui-header{padding:10px;border-left:0;border-right:0;border-top:0}button.gj-dialog-ui-close{float:right;width:24px;height:24px;text-decoration:none;padding:0}h4.gj-dialog-ui-title{margin:0;line-height:24px}div.gj-dialog-ui-body{padding:10px}.gj-dialog-mdl-close{padding:0;font-size:2.5em;margin:24px 24px 0}.gj-dialog-mdl-content{background-color:#FFF}DIV.gj-grid-wrapper{margin:auto;position:relative;clear:both}TABLE.gj-grid-table{margin:auto;border-collapse:collapse;width:100%;table-layout:fixed}TABLE.gj-grid-table THEAD TH [data-role=selectAll]{margin:auto}TABLE.gj-grid-table THEAD TH [data-role=title],TABLE.gj-grid-table THEAD TH [data-role=sorticon]{display:inline-block}TABLE.gj-grid-table DIV[data-role=display],TABLE.gj-grid-table DIV[data-role=display] DIV{vertical-align:middle;text-indent:0;display:inline-block;white-space:pre-wrap;-ms-word-break:break-word;word-break:break-word}TABLE.gj-grid-table .fa{padding:2px}DIV.gj-grid-wrapper DIV.gj-grid-loading-cover{background:#BBB;opacity:.5;position:absolute;vertical-align:middle}.gj-grid-base-active,.gj-grid-base-table tbody tr:hover,.gj-grid-base-table thead tr th{background-color:#f5f5f5}DIV.gj-grid-wrapper DIV.gj-grid-loading-text{position:absolute;font-weight:700}.gj-dirty{position:absolute;width:0;height:0;border-style:solid;border-width:3px;border-color:red transparent transparent red;padding:0;vertical-align:top}TABLE.gj-grid-table .gj-grid-icon{margin:0 2px;cursor:pointer;overflow:visible;width:16px;height:16px}table.gj-grid-bootstrap-table thead th [data-role=sorticon],table.mdl-data-table thead th [data-role=sorticon]{margin-left:5px}.gj-grid-base-table{border:1px solid #ddd;font-family:Helvetica,Arial,sans-serif;font-size:14px}.gj-grid-base-table thead tr th{border:1px solid #ddd;padding:2px 1px}.gj-grid-base-table tbody tr td{border:1px solid #ddd}.gj-grid-base-table tbody tr td div[data-role=display],.gj-grid-base-table thead tr th div{padding:3px}div.gj-grid-wrapper div.gj-grid-base-toolbar{background-color:#f5f5f5;padding:5px;font-weight:700;border:1px solid #ddd}.gj-content{border:1px solid #999;background-color:#fff;border-radius:6px;outline:0}div.gj-grid-wrapper div.gj-grid-bootstrap-toolbar{background-color:#f5f5f5;padding:8px;font-weight:700;border:1px solid #ddd}table.gj-grid-bootstrap-table thead th{background-color:#f5f5f5;vertical-align:middle}table.gj-grid-bootstrap-table tbody tr td div[data-role=display]{padding:0}div.gj-grid-wrapper div.gj-grid-ui-toolbar{border-top:1px solid menutext;border-left:1px solid menutext;border-right:1px solid menutext;border-bottom:0;padding:2px;font:11px Verdana}TABLE.gj-grid-ui-table{font:11px Verdana;border-left:1px solid;border-top:0;border-right:1px solid;border-bottom:0;padding:0;border-spacing:0}table.gj-grid-ui-table thead tr th.gj-grid-ui-thead-th{height:20px;padding:0;white-space:normal;vertical-align:middle;border:1px solid menutext;border-spacing:0;border-collapse:collapse;text-align:center;-moz-user-select:none;-khtml-user-select:none}table.gj-grid-ui-table thead tr th:first-child{border-left:0}table.gj-grid-ui-table thead tr th div{padding:2px;vertical-align:middle;display:inline-block}table.gj-grid-ui-table thead tr th span.gj-grid-ui-thead-th-sort-icon{vertical-align:middle;display:inline-block}table.gj-grid-ui-table tbody tr.ui-state-hover{border:0}TABLE.gj-grid-ui-table>tbody>tr>td{padding:0;border-left:1px solid;border-top:0;border-right:0;border-bottom:1px solid;border-color:menutext}TABLE.gj-grid-ui-table>tbody>tr>td:first-child{border-left:0}TABLE.gj-grid-table>tbody>tr>td>div{padding:2px;overflow:hidden}table.mdl-data-table thead th [data-role=sorticon] i.material-icons{position:absolute;font-size:18px;top:16px}.gj-grid-table .gj-grid-mdl-limit-select{text-align:right;display:inline-block;width:50px;padding:0 5px;margin-left:10px;font-size:13px}.gj-grid-table .gj-grid-mdl-page{text-align:right;display:inline-block;width:32px;padding:0;font-size:13px}.gj-grid-table .gj-grid-mdl-pager-label{padding:0 5px;font-size:13px}table.mdl-data-table tr td{text-align:left}@media only all{td.display-1120,td.display-320,td.display-480,td.display-640,td.display-800,td.display-960,th.display-1120,th.display-320,th.display-480,th.display-640,th.display-800,th.display-960{display:none}}@media screen and (min-width:20em){TABLE.gj-grid-table td.display-320,TABLE.gj-grid-table th.display-320{display:table-cell}}@media screen and (min-width:30em){TABLE.gj-grid-table td.display-480,TABLE.gj-grid-table th.display-480{display:table-cell}}@media screen and (min-width:40em){TABLE.gj-grid-table td.display-640,TABLE.gj-grid-table th.display-640{display:table-cell}}@media screen and (min-width:50em){TABLE.gj-grid-table td.display-800,TABLE.gj-grid-table th.display-800{display:table-cell}}@media screen and (min-width:60em){TABLE.gj-grid-table td.display-960,TABLE.gj-grid-table th.display-960{display:table-cell}}@media screen and (min-width:70em){TABLE.gj-grid-table td.display-1120,TABLE.gj-grid-table th.display-1120{display:table-cell}}.gj-grid-base-table tfoot th{background-color:#f5f5f5;border:1px solid #ddd;padding:3px;font-weight:400;line-height:29px}.gj-grid-base-table tfoot th button{margin:0 3px;background-color:#f5f5f5;border-radius:4px;text-decoration:none;padding:6px 12px;border:1px solid #ddd;color:#337ab7;width:34px;outline:0}.gj-grid-base-table tfoot th button.gj-grid-base-active{background-color:#fff}.gj-grid-base-table tfoot th input{margin:0 5px;width:26px;text-align:right}TABLE.gj-grid-table TFOOT TH.ui-grid-pager-cell{height:20px;padding:0;cursor:default;border:1px solid menutext;-moz-user-select:none;-khtml-user-select:none;user-select:none}TABLE.gj-grid-table TFOOT DIV.ui-grid-pager{overflow:hidden}TABLE.gj-grid-table TFOOT INPUT.ui-grid-pager{padding:1px;width:26px;height:17px;font:700 11px Verdana;margin:0 5px;text-align:right}TABLE.gj-grid-table TFOOT SELECT.ui-grid-page-sizer{padding:0;height:17px;font:700 11px Verdana;margin:0 5px;text-align:right;width:50px}TABLE.gj-grid-table tfoot tr th.gj-grid-bootstrap-tfoot-cell{line-height:30px;background-color:#f5f5f5}.gj-grid-table thead tr th div.gj-grid-column-resizer-wrapper{position:relative;width:100%;height:0;top:0;left:0;padding:0}span.gj-grid-column-resizer{position:absolute;right:0;width:5px;top:-100px;height:300px;z-index:100;cursor:e-resize}.gj-grid-resize-cursor{cursor:e-resize}.gj-grid-table tbody tr.gj-grid-base-top-border td{border-top:2px solid #777}.gj-grid-table tbody tr.gj-grid-base-bottom-border td{border-bottom:2px solid #777}.gj-grid-base-table tbody tr td.gj-grid-base-left-border,.gj-grid-base-table thead tr th.gj-grid-base-left-border{border-left:2px solid #777}.gj-grid-base-table tbody tr td.gj-grid-base-right-border,.gj-grid-base-table thead tr th.gj-grid-base-right-border{border-right:2px solid #777}ul.gj-tree-list{list-style:none;padding:0;margin:0}li.gj-tree-item{padding:0}li.gj-tree-item div[data-role=wrapper]{display:table;width:100%}li.gj-tree-item [data-role=spacer]{display:table-cell}[data-type=tree] ul li [data-role=expander]{display:table-cell;vertical-align:middle;text-align:center;cursor:pointer;width:10px}li.gj-tree-item [data-role=checkbox]{display:table-cell;vertical-align:middle;text-align:center;width:20px}li.gj-tree-item [data-role=image]{display:table-cell;vertical-align:middle;text-align:center;width:22px}li.gj-tree-item [data-role=display]{display:table-cell;vertical-align:middle;cursor:pointer;padding:2px 4px}.gj-tree-base-active span[data-role=display]{background-color:#ddd}ul.gj-tree-bootstrap-list{padding-left:0;margin-bottom:0}li ul.gj-tree-bootstrap-list{padding-left:0;width:100%}ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item{border-left:0;border-right:0}ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item:first-child{border-top-left-radius:0;border-top-right-radius:0}ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item:last-child{border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}ul.gj-tree-bootstrap-list li [data-role=wrapper]{padding:0 10px}ul.gj-tree-bootstrap-list li [data-role=checkbox]{width:24px;padding-top:4px}ul.gj-tree-bootstrap-list li [data-role=image]{width:24px}.gj-tree-bootstrap-3 ul.gj-tree-bootstrap-list li [data-role=display]{padding:12px 0 8px 5px}.gj-tree-bootstrap-4 ul.gj-tree-bootstrap-list li [data-role=display]{padding:8px 0 8px 5px}.gj-tree-mdl-item,.gj-tree-mdl-list{list-style-type:none;padding:0}.list-group-item.active ul li,.list-group-item.active:focus ul li,.list-group-item.active:hover ul li{text-shadow:none;color:initial}ul.gj-tree-bootstrap-list li.gj-tree-item{border:0}.gj-tree-bootstrap-border ul.gj-tree-bootstrap-list li.gj-tree-item{border:1px solid #ddd}.gj-tree-mdl-item{display:list-item;min-height:unset}li.gj-tree-item.gj-tree-mdl-item [data-role=display]{padding:8px 0 8px 5px}.gj-tree-mdl-border .gj-tree-mdl-item{border:1px solid rgba(0,0,0,.87);margin-bottom:-1px}.gj-tree-mdl-border ul.gj-tree-mdl-list li.gj-tree-item ul li.gj-tree-item{border-left:0;border-right:0}.gj-tree-mdl-border ul.gj-tree-mdl-list li.gj-tree-item ul li.gj-tree-item:last-child{border-bottom:0}li.gj-tree-mdl-item [data-role=checkbox],li.gj-tree-mdl-item [data-role=image]{height:24px;width:24px}.gj-tree-mdl-active{background:#b3d4fc}[data-type=tree] ul li [data-role=expander].gj-tree-material-icons-expander{height:24px;width:24px}[data-type=tree] ul li [data-role=expander].gj-tree-font-awesome-expander,[data-type=tree] ul li [data-role=expander].gj-tree-glyphicons-expander{width:24px}.gj-tree-drop-above{border-top:1px solid #000}.gj-tree-drop-below{border-bottom:1px solid #000}.gj-tree-drag-el,.gj-tree-drag-el li{padding:0;margin:0}.gj-tree-drag-el [data-role=wrapper]{cursor:move;display:table}.gj-tree-drag-el [data-role=indicator]{width:14px;padding:0 3px;display:table-cell;vertical-align:middle;text-align:center}.gj-tree-bootstrap-drag-el [data-role=indicator],.gj-tree-mdl-drag-el [data-role=indicator]{width:24px;height:24px;padding:0}.gj-checkbox-bootstrap{min-width:0;font-size:0;font-weight:400;margin:0;text-align:center;width:18px;height:18px}.gj-checkbox-bootstrap input[type=checkbox]{display:none;margin-bottom:-12px}.gj-checkbox-bootstrap span{background:#fff;display:block;content:" ";width:18px;height:18px;line-height:11px;font-size:11px;padding:2px;margin-right:4px;color:#555;border:1px solid #ccc;border-radius:3px;transition:box-shadow .2s linear,border-color .2s linear;cursor:pointer}.gj-checkbox-bootstrap input[type=checkbox]:focus+span:before{outline:0;box-shadow:0 0 0 0 #66afe9,0 0 6px rgba(102,175,233,.6);border-color:#66afe9}.gj-checkbox-bootstrap input[type=checkbox]:checked+span:before{display:inline-block;font-family:'Glyphicons Halflings';content:"\e013 "}.gj-checkbox-bootstrap input[type=checkbox]:indeterminate+span:before{display:inline-block;font-family:'Glyphicons Halflings';content:"\2212 "}.gj-checkbox-bootstrap input[type=checkbox][disabled]+span{opacity:.6;cursor:not-allowed}.gj-checkbox-bootstrap input[type=checkbox][disabled]+span:before{background:#eee;border:1px solid #ccc;color:#888}.gj-checkbox-md{min-width:0;font-size:0;font-weight:400;margin:0;text-align:center;width:16px;height:16px;position:relative}.gj-checkbox-md input[type=checkbox]{display:none;margin-bottom:-12px}.gj-checkbox-md span{display:inline-block;box-sizing:border-box;width:16px;height:16px;margin:0;cursor:pointer;overflow:hidden;border:2px solid rgba(0,0,0,.54);border-radius:2px;z-index:2}.gj-checkbox-md input[type=checkbox]:checked+span,.gj-checkbox-md input[type=checkbox]:indeterminate+span{border:2px solid #3f51b5}.gj-checkbox-md input[type=checkbox]:checked+span::after{content:"\E876";font-size:14px;background-color:#3f51b5;font-weight:700;color:#FFF;white-space:pre;position:absolute;left:1px;top:-15px}.gj-checkbox-md input[type=checkbox]:indeterminate+span:after{content:"\E15B";font-size:14px;background-color:#3f51b5;font-weight:700;color:#FFF;white-space:pre;position:absolute;left:1px;top:-15px}.gj-checkbox-md input[type=checkbox][disabled]+span{background-color:rgba(0,0,0,.54);border:2px solid rgba(0,0,0,.54)}.gj-editor-md,.gj-editor-md div[data-role=body]{border:1px solid rgba(158,158,158,.2)}.gj-checkbox-md input[type=checkbox][disabled]+span:after{background-color:rgba(0,0,0,.54)}.gj-editor-md{padding:7px;font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;font-weight:500;letter-spacing:0}.gj-editor-md [data-role=toolbar]{margin-bottom:7px}.gj-editor-bootstrap,.gj-editor-bootstrap div[data-role=body]{border:1px solid #eceeef}.gj-editor-md p{margin:0;padding:0}.gj-editor-md blockquote{font-size:14px}.gj-editor-bootstrap{padding:7px}.gj-editor-bootstrap [data-role=toolbar]{margin-bottom:7px}.gj-editor-bootstrap [data-role=toolbar] .btn-group{margin-right:10px}.gj-editor-bootstrap p{margin:0;padding:0}.gj-editor-bootstrap blockquote{font-size:14px} \ No newline at end of file diff --git a/dist/combined/js/gijgo.js b/dist/combined/js/gijgo.js index 69d55b8d..bf7ad4e2 100644 --- a/dist/combined/js/gijgo.js +++ b/dist/combined/js/gijgo.js @@ -9796,8 +9796,8 @@ if (typeof (gj.checkbox) === 'undefined') { gj.checkbox.config = { base: { - /** The name of the UI library that is going to be in use. Currently we support only Material Design Lite and Bootstrap. - * @additionalinfo The css files for Material Design Lite or Bootstrap should be manually included to the page where the checkbox is in use. + /** The name of the UI library that is going to be in use. Currently we support only Material Design and Bootstrap. + * @additionalinfo The css files for Bootstrap should be manually included to the page if you use bootstrap as uiLibrary. * @type string (bootstrap|materialdesign) * @default undefined * @example Bootstrap @@ -9942,7 +9942,7 @@ gj.checkbox.events = { /** * Triggered when the state of the checkbox is changed * - * @event drag + * @event stateChange * @param {object} e - event data * @param {object} state - The new state of the checkbox. * @example sample @@ -10042,4 +10042,394 @@ gj.checkbox.widget.constructor = gj.checkbox.widget; } } }; +})(jQuery); +if (typeof (gj.editor) === 'undefined') { + gj.editor = { + plugins: {}, + messages: [] + }; +} + +gj.editor.messages['en-us'] = { + bold: 'Bold', + italic: 'Italic', + strikethrough: 'Strikethrough', + underline: 'Underline', + listBulleted: 'List Bulleted', + listNumbered: 'List Numbered', + indentDecrease: 'Indent Decrease', + indentIncrease: 'Indent Increase', + alignLeft: 'Align Left', + alignCenter: 'Align Center', + alignRight: 'Align Right', + alignJustify: 'Align Justify', + undo: 'Undo', + redo: 'Redo' +}; +/* global window alert jQuery */ +/** + * @widget Editor + * @plugin Base + */ +gj.editor.config = { + base: { + + /** The height of the editor. Numeric values are treated as pixels. + * @type number|string + * @default 300 + * @example sample + *
+ * + */ + height: 300, + + /** The width of the editor. Numeric values are treated as pixels. + * @type number|string + * @default undefined + * @example sample + *
+ * + */ + width: undefined, + + /** The name of the UI library that is going to be in use. Currently we support only Material Design and Bootstrap. + * @additionalinfo The css files for Bootstrap should be manually included to the page if you use bootstrap as uiLibrary. + * @type string (materialdesign|bootstrap|bootstrap4) + * @default 'materialdesign' + * @example Material.Design + *
+ * + * @example Bootstrap.3 + *
+ * + * @example Bootstrap.4 + *
+ * + */ + uiLibrary: 'materialdesign', + + /** The name of the icons library that is going to be in use. Currently we support Material Icons and Font Awesome. + * @additionalinfo If you use Bootstrap as uiLibrary, then the iconsLibrary is set to font awesome by default.
+ * If you use Material Design as uiLibrary, then the iconsLibrary is set to Material Icons by default.
+ * The css files for Material Icons or Font Awesome should be manually included to the page where the grid is in use. + * @type (materialicons|fontawesome) + * @default 'materialicons' + * @example Base.Theme.Material.Icons + *
+ * + */ + iconsLibrary: 'materialicons', + + locale: 'en-us', + + buttons: undefined, + + style: { + wrapper: 'gj-editor-md', + buttonsGroup: 'gj-md-button-group', + button: 'gj-md-button', + buttonActive: 'gj-md-button-active' + } + }, + + bootstrap: { + style: { + wrapper: 'gj-editor-bootstrap', + buttonsGroup: 'btn-group', + button: 'btn btn-default gj-cursor-pointer', + buttonActive: 'active' + }, + iconsLibrary: 'fontawesome' + }, + + bootstrap4: { + style: { + wrapper: 'gj-editor-bootstrap', + buttonsGroup: 'btn-group', + button: 'btn btn-secondary gj-cursor-pointer', + buttonActive: 'active' + }, + iconsLibrary: 'fontawesome' + }, + + materialicons: { + icons: { + bold: 'format_bold', + italic: 'format_italic', + strikethrough: 'strikethrough_s', + underline: 'format_underlined', + + listBulleted: 'format_list_bulleted', + listNumbered: 'format_list_numbered', + indentDecrease: 'format_indent_decrease', + indentIncrease: 'format_indent_increase', + + alignLeft: 'format_align_left', + alignCenter: 'format_align_center', + alignRight: 'format_align_right', + alignJustify: 'format_align_justify', + + undo: 'undo', + redo: 'redo' + } + }, + + fontawesome: { + icons: { + bold: '', + italic: '', + strikethrough: '', + underline: '', + + listBulleted: '', + listNumbered: '', + indentDecrease: '', + indentIncrease: '', + + alignLeft: '', + alignCenter: '', + alignRight: '', + alignJustify: '', + + undo: '', + redo: '' + } + } +}; + +gj.editor.methods = { + init: function (jsConfig) { + gj.widget.prototype.init.call(this, jsConfig, 'editor'); + this.attr('data-editor', 'true'); + gj.editor.methods.initialize(this); + return this; + }, + + initialize: function ($editor) { + var self = this, data = $editor.data(), $group, $btn, + $body = $editor.children('div[data-role="body"]'), + $toolbar = $editor.children('div[data-role="toolbar"]'); + + gj.editor.methods.localization(data); + + $editor.addClass(data.style.wrapper); + if (data.width) { + $editor.width(data.width); + } + + if ($body.length === 0) { + $body = $('
'); + $editor.append($body); + } + + $body.attr('contenteditable', true); + $body.height(data.height - $toolbar.outerHeight()); + + $body.on('mouseup keyup mouseout', function () { + self.updateToolbar($editor, $toolbar); + }); + + if ($toolbar.length === 0) { + $toolbar = $('
'); + $body.before($toolbar); + + for (var group in data.buttons) { + $group = $('
').addClass(data.style.buttonsGroup); + for (var btn in data.buttons[group]) { + $btn = $(data.buttons[group][btn]); + $btn.on('click', function () { + gj.editor.methods.executeCmd($editor, $body, $toolbar, $(this)); + }); + $group.append($btn); + } + $toolbar.append($group); + } + } + }, + + localization: function (data) { + var msg = gj.editor.messages[data.locale]; + if (typeof (data.buttons) === 'undefined') { + data.buttons = [ + [ + '', + '', + '', + '' + ], + [ + '', + '', + '', + '' + ], + [ + '', + '', + '', + '' + ], + [ + '', + '' + ] + ]; + } + }, + + updateToolbar: function ($editor, $toolbar) { + var data = $editor.data(); + $buttons = $toolbar.find('[data-role]').each(function() { + var $btn = $(this), + cmd = $btn.attr('data-role'); + + if (cmd && document.queryCommandEnabled(cmd) && document.queryCommandValue(cmd) === "true") { + $btn.addClass(data.style.buttonActive); + } else { + $btn.removeClass(data.style.buttonActive); + } + }); + gj.editor.events.change($editor); + }, + + executeCmd: function ($editor, $body, $toolbar, $btn) { + $body.focus(); + document.execCommand($btn.attr('data-role'), false); + gj.editor.methods.updateToolbar($editor, $toolbar); + }, + + content: function ($editor, html) { + var $body = $editor.children('div[data-role="body"]'); + if (typeof (html) === "undefined") { + return $body.html(); + } else { + return $body.html(html); + } + }, + + destroy: function ($editor) { + if ($editor.attr('data-editor') === 'true') { + $editor.removeClass($editor.data().style.wrapper); + $editor.removeData(); + $editor.removeAttr('data-guid'); + $editor.removeAttr('data-editor'); + $editor.off(); + $editor.empty(); + } + return $editor; + } +}; + +gj.editor.events = { + /** + * Triggered when the editor text is changed. + * + * @event change + * @param {object} e - event data + * @example sample + *
+ * + */ + change: function ($editor) { + return $editor.triggerHandler('change'); + } +}; + + +gj.editor.widget = function ($element, jsConfig) { + var self = this, + methods = gj.editor.methods; + + /** Get or set html content in the body. + * @method + * @return string + * @example Get + * + *
+ *
+ * + * @example Set + * + *
+ *
+ * + */ + self.content = function (html) { + return methods.content(this, html); + }; + + /** Remove editor functionality from the element. + * @method + * @return jquery element + * @example sample + * + *
+ * + */ + self.destroy = function () { + return methods.destroy(this); + }; + + $.extend($element, self); + if ('true' !== $element.attr('data-editor')) { + methods.init.call($element, jsConfig); + } + + return $element; +}; + +gj.editor.widget.prototype = new gj.widget(); +gj.editor.widget.constructor = gj.editor.widget; + +(function ($) { + $.fn.editor = function (method) { + var $widget; + if (this && this.length) { + if (typeof method === 'object' || !method) { + return new gj.editor.widget(this, method); + } else { + $widget = new gj.editor.widget(this, null); + if ($widget[method]) { + return $widget[method].apply(this, Array.prototype.slice.call(arguments, 1)); + } else { + throw 'Method ' + method + ' does not exist.'; + } + } + } + }; })(jQuery); \ No newline at end of file diff --git a/dist/combined/js/gijgo.min.js b/dist/combined/js/gijgo.min.js index 6a465bf8..f9947596 100644 --- a/dist/combined/js/gijgo.min.js +++ b/dist/combined/js/gijgo.min.js @@ -1,4 +1,4 @@ "undefined"==typeof gj&&(gj={}),gj.widget=function(){var a=this;a.xhr=null,a.generateGUID=function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()},a.mouseX=function(a){if(a){if(a.pageX)return a.pageX;if(a.clientX)return a.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);if(a.touches&&a.touches.length)return a.touches[0].pageX;if(a.changedTouches&&a.changedTouches.length)return a.changedTouches[0].pageX;if(a.originalEvent&&a.originalEvent.touches&&a.originalEvent.touches.length)return a.originalEvent.touches[0].pageX;if(a.originalEvent&&a.originalEvent.changedTouches&&a.originalEvent.changedTouches.length)return a.originalEvent.touches[0].pageX}return null},a.mouseY=function(a){if(a){if(a.pageY)return a.pageY;if(a.clientY)return a.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);if(a.touches&&a.touches.length)return a.touches[0].pageY;if(a.changedTouches&&a.changedTouches.length)return a.changedTouches[0].pageY;if(a.originalEvent&&a.originalEvent.touches&&a.originalEvent.touches.length)return a.originalEvent.touches[0].pageY;if(a.originalEvent&&a.originalEvent.changedTouches&&a.originalEvent.changedTouches.length)return a.originalEvent.touches[0].pageY}return null}},gj.widget.prototype.init=function(a,b){var c,d,e;d=$.extend(!0,{},this.getHTMLConfig()||{}),$.extend(!0,d,a||{}),e=this.getConfig(d,b),this.attr("data-guid",e.guid),this.data(e);for(c in e)gj[b].events.hasOwnProperty(c)&&(this.on(c,e[c]),delete e[c]);for(plugin in gj[b].plugins)gj[b].plugins.hasOwnProperty(plugin)&&gj[b].plugins[plugin].configure(this,e,d);return this},gj.widget.prototype.getConfig=function(a,b){var c,d,e,f;c=$.extend(!0,{},gj[b].config.base),d=a.hasOwnProperty("uiLibrary")?a.uiLibrary:c.uiLibrary,gj[b].config[d]&&$.extend(!0,c,gj[b].config[d]),e=a.hasOwnProperty("iconsLibrary")?a.iconsLibrary:c.iconsLibrary,gj[b].config[e]&&$.extend(!0,c,gj[b].config[e]);for(f in gj[b].plugins)gj[b].plugins.hasOwnProperty(f)&&($.extend(!0,c,gj[b].plugins[f].config.base),gj[b].plugins[f].config[d]&&$.extend(!0,c,gj[b].plugins[f].config[d]),gj[b].plugins[f].config[e]&&$.extend(!0,c,gj[b].plugins[f].config[e]));return $.extend(!0,c,a),c.guid||(c.guid=this.generateGUID()),c},gj.widget.prototype.getHTMLConfig=function(){var a=this.data(),b=this[0].attributes;return b.width&&(a.width=b.width.nodeValue),b.height&&(a.height=b.height.nodeValue),b.align&&(a.align=b.align.nodeValue),a&&a.source&&(a.dataSource=a.source,delete a.source),a},gj.widget.prototype.createDoneHandler=function(){var a=this;return function(b){"string"==typeof b&&JSON&&(b=JSON.parse(b)),gj[a.data("type")].methods.render(a,b)}},gj.widget.prototype.createErrorHandler=function(){return function(a){a&&a.statusText&&"abort"!==a.statusText&&alert(a.statusText)}},gj.widget.prototype.reload=function(a){var b,c,d=this.data(),e=this.data("type");return void 0===d.dataSource&&gj[e].methods.useHtmlDataSource(this,d),$.extend(d.params,a),$.isArray(d.dataSource)?(c=gj[e].methods.filter(this),gj[e].methods.render(this,c)):"string"==typeof d.dataSource?(b={url:d.dataSource,data:d.params},this.xhr&&this.xhr.abort(),this.xhr=$.ajax(b).done(this.createDoneHandler()).fail(this.createErrorHandler())):"object"==typeof d.dataSource&&(d.dataSource.data||(d.dataSource.data={}),$.extend(d.dataSource.data,d.params),b=$.extend(!0,{},d.dataSource),"json"===b.dataType&&"object"==typeof b.data&&(b.data=JSON.stringify(b.data)),b.success||(b.success=this.createDoneHandler()),b.error||(b.error=this.createErrorHandler()),this.xhr&&this.xhr.abort(),this.xhr=$.ajax(b)),this},gj.documentManager={events:{},subscribeForEvent:function(a,b,c){if(gj.documentManager.events[a]&&0!==gj.documentManager.events[a].length){if(gj.documentManager.events[a][b])throw"Event "+a+" for widget with guid='"+b+"' is already attached.";gj.documentManager.events[a].push({widgetId:b,callback:c})}else gj.documentManager.events[a]=[{widgetId:b,callback:c}],$(document).on(a,gj.documentManager.executeCallbacks)},executeCallbacks:function(a){var b=gj.documentManager.events[a.type];if(b)for(var c=0;c').addClass(d.style.body),a.wrapInner(c)):c.addClass(d.style.body),b=gj.dialog.methods.renderHeader(a),a.children('div[data-role="footer"]').addClass(d.style.footer),a.find('[data-role="close"]').on("click",function(){a.close()}),d.draggable&&$.fn.draggable&&gj.dialog.methods.draggable(a,b),d.resizable&&$.fn.draggable&&gj.dialog.methods.resizable(a),gj.dialog.methods.setPosition(a),d.modal&&a.wrapAll('
'),d.autoOpen&&a.open()},setSize:function(a){var b=a.data();b.width&&a.css("width",b.width),b.height&&a.css("height",b.height)},renderHeader:function(a){var b,c,d,e=a.data();return b=a.children('div[data-role="header"]'),0===b.length&&(b=$('
'),a.prepend(b)),b.addClass(e.style.header),c=b.find('[data-role="title"]'),0===c.length&&(c=$('

'+e.title+"

"),b.append(c)),c.addClass(e.style.headerTitle),d=b.find('[data-role="close"]'),0===d.length&&e.closeButtonInHeader?(d=$(''),d.addClass(e.style.headerCloseButton),b.prepend(d)):d.length>0&&e.closeButtonInHeader===!1?d.hide():d.addClass(e.style.headerCloseButton),b},setPosition:function(a){var b=$(window).width()/2-a.width()/2,c=$(window).height()/2-a.height()/2;a.css("position","absolute"),a.css("left",b>0?b:0),a.css("top",c>0?c:0)},draggable:function(a,b){a.appendTo("body"),b.addClass("gj-draggable"),a.draggable({handle:b,start:function(){a.addClass("gj-unselectable"),gj.dialog.events.dragStart(a)},stop:function(){a.removeClass("gj-unselectable"),gj.dialog.events.dragStop(a)}})},resizable:function(a){var b={drag:gj.dialog.methods.resize,start:function(){a.addClass("gj-unselectable"),gj.dialog.events.resizeStart(a)},stop:function(){this.removeAttribute("style"),a.removeClass("gj-unselectable"),gj.dialog.events.resizeStop(a)}};a.append($('
').draggable($.extend(!0,{horizontal:!1},b))),a.append($('
').draggable($.extend(!0,{vertical:!1},b))),a.append($('
').draggable($.extend(!0,{horizontal:!1},b))),a.append($('
').draggable($.extend(!0,{vertical:!1},b))),a.append($('
').draggable($.extend(!0,{},b))),a.append($('
').draggable($.extend(!0,{},b))),a.append($('
').draggable($.extend(!0,{},b))),a.append($('
').draggable($.extend(!0,{},b)))},resize:function(a,b){var c,d,e,f,g,h,i,j=!1;return c=$(this),d=c.parent(),e=d.data(),c.hasClass("gj-resizable-n")?(f=d.height()-b.top,h=d.offset().top+b.top):c.hasClass("gj-resizable-e")?g=d.width()+b.left:c.hasClass("gj-resizable-s")?f=d.height()+b.top:c.hasClass("gj-resizable-w")?(g=d.width()-b.left,i=d.offset().left+b.left):c.hasClass("gj-resizable-ne")?(f=d.height()-b.top,h=d.offset().top+b.top,g=d.width()+b.left):c.hasClass("gj-resizable-nw")?(f=d.height()-b.top,h=d.offset().top+b.top,g=d.width()-b.left,i=d.offset().left+b.left):c.hasClass("gj-resizable-se")?(f=d.height()+b.top,g=d.width()+b.left):c.hasClass("gj-resizable-sw")&&(f=d.height()+b.top,g=d.width()-b.left,i=d.offset().left+b.left),f&&(!e.minHeight||f>=e.minHeight)&&(!e.maxHeight||f<=e.maxHeight)&&(d.height(f),h&&d.css("top",h),j=!0),g&&(!e.minWidth||g>=e.minWidth)&&(!e.maxWidth||g<=e.maxWidth)&&(d.width(g),i&&d.css("left",i),j=!0),j&&gj.dialog.events.resize(d),j},open:function(a){var b;return gj.dialog.events.opening(a),a.css("display","block"),a.closest('div[data-role="modal"]').css("display","block"),b=a.children('div[data-role="footer"]'),b.length&&b.outerHeight()&&a.children('div[data-role="body"]').css("margin-bottom",b.outerHeight()),gj.dialog.events.opened(a),a},close:function(a){return a.is(":visible")&&(gj.dialog.events.closing(a),a.css("display","none"),a.closest('div[data-role="modal"]').css("display","none"),gj.dialog.events.closed(a)),a},isOpen:function(a){return a.is(":visible")},destroy:function(a,b){var c=a.data();return c&&(b===!1?a.remove():(a.close(),a.off(),a.removeData(),a.removeAttr("data-type"),a.removeClass(c.style.content),a.find('[data-role="header"]').removeClass(c.style.header),a.find('[data-role="title"]').removeClass(c.style.headerTitle),a.find('[data-role="close"]').remove(),a.find('[data-role="body"]').removeClass(c.style.body),a.find('[data-role="footer"]').removeClass(c.style.footer))),a}},gj.dialog.widget=function(a,b){var c=this,d=gj.dialog.methods;return c.open=function(){return d.open(this)},c.close=function(){return d.close(this)},c.isOpen=function(){return d.isOpen(this)},c.destroy=function(a){return d.destroy(this,a)},$.extend(a,c),"dialog"!==a.attr("data-type")&&d.init.call(a,b),a},gj.dialog.widget.prototype=new gj.widget,gj.dialog.widget.constructor=gj.dialog.widget,gj.dialog.widget.prototype.getHTMLConfig=gj.dialog.methods.getHTMLConfig,function(a){a.fn.dialog=function(a){var b;if(this&&this.length){if("object"!=typeof a&&a){if(b=new gj.dialog.widget(this,null),b[a])return b[a].apply(this,Array.prototype.slice.call(arguments,1));throw"Method "+a+" does not exist."}return new gj.dialog.widget(this,a)}}}(jQuery),"undefined"==typeof gj.draggable&&(gj.draggable={}),gj.draggable.config={base:{handle:void 0,vertical:!0,horizontal:!0}},gj.draggable.methods={init:function(a){var b,c=this;return gj.widget.prototype.init.call(this,a,"draggable"),c.attr("data-draggable","true"),b=gj.draggable.methods.getHandleElement(c),b.on("touchstart mousedown",function(a){c.attr("data-draggable-dragging",!0),c.removeAttr("data-draggable-x").removeAttr("data-draggable-y"),c.css("position","absolute"),gj.documentManager.subscribeForEvent("touchmove",c.data("guid"),gj.draggable.methods.createMoveHandler(c)),gj.documentManager.subscribeForEvent("mousemove",c.data("guid"),gj.draggable.methods.createMoveHandler(c))}),gj.documentManager.subscribeForEvent("mouseup",c.data("guid"),gj.draggable.methods.createUpHandler(c)),gj.documentManager.subscribeForEvent("touchend",c.data("guid"),gj.draggable.methods.createUpHandler(c)),gj.documentManager.subscribeForEvent("touchcancel",c.data("guid"),gj.draggable.methods.createUpHandler(c)),c},getHandleElement:function(a){var b=a.data("handle");return b&&b.length?b:a},createUpHandler:function(a){return function(b){"true"===a.attr("data-draggable-dragging")&&(a.attr("data-draggable-dragging",!1),gj.documentManager.unsubscribeForEvent("mousemove",a.data("guid")),gj.documentManager.unsubscribeForEvent("touchmove",a.data("guid")),gj.draggable.events.stop(a,{left:a.mouseX(b),top:a.mouseY(b)}))}},createMoveHandler:function(a){return function(b){var c,d,e,f,g,h;"true"===a.attr("data-draggable-dragging")&&(c=a.mouseX(b),d=a.mouseY(b),g=a.attr("data-draggable-x"),h=a.attr("data-draggable-y"),g&&h?(e=a.data("horizontal")?c-parseInt(g,10):0,f=a.data("vertical")?d-parseInt(h,10):0,!1!==gj.draggable.events.drag(a,e,f,c,d)&&gj.draggable.methods.move(a,e,f)):gj.draggable.events.start(a,c,d),a.attr("data-draggable-x",c),a.attr("data-draggable-y",d))}},move:function(a,b,c){var d=a.get(0),e=d.style.top?parseInt(d.style.top):a.position().top,f=d.style.left?parseInt(d.style.left):a.position().left;d.style.top=e+c+"px",d.style.left=f+b+"px"},destroy:function(a){return"true"===a.attr("data-draggable")&&(gj.documentManager.unsubscribeForEvent("mouseup",a.data("guid")),a.removeData(),a.removeAttr("data-guid"),a.removeAttr("data-draggable"),a.off("drag").off("start").off("stop"),gj.draggable.methods.getHandleElement(a).off("mousedown")),a}},gj.draggable.events={drag:function(a,b,c,d,e){return a.triggerHandler("drag",[{top:c,left:b},{top:e,left:d}])},start:function(a,b,c){a.triggerHandler("start",[{top:c,left:b}])},stop:function(a,b){a.triggerHandler("stop",[b])}},gj.draggable.widget=function(a,b){var c=this,d=gj.draggable.methods;return a.destroy||(c.destroy=function(){return d.destroy(this)}),$.extend(a,c),"true"!==a.attr("data-draggable")&&d.init.call(a,b),a},gj.draggable.widget.prototype=new gj.widget,gj.draggable.widget.constructor=gj.draggable.widget,function(a){a.fn.draggable=function(a){var b;if(this&&this.length){if("object"!=typeof a&&a){if(b=new gj.draggable.widget(this,null),b[a])return b[a].apply(this,Array.prototype.slice.call(arguments,1));throw"Method "+a+" does not exist."}return new gj.draggable.widget(this,a)}}}(jQuery),"undefined"==typeof gj.droppable&&(gj.droppable={}),gj.droppable.config={hoverClass:void 0},gj.droppable.methods={init:function(a){var b=this;return gj.widget.prototype.init.call(this,a,"droppable"),b.attr("data-droppable","true"),gj.documentManager.subscribeForEvent("mousedown",b.data("guid"),gj.droppable.methods.createMouseDownHandler(b)),gj.documentManager.subscribeForEvent("mousemove",b.data("guid"),gj.droppable.methods.createMouseMoveHandler(b)),gj.documentManager.subscribeForEvent("mouseup",b.data("guid"),gj.droppable.methods.createMouseUpHandler(b)),b},createMouseDownHandler:function(a){return function(b){a.isDragging=!0}},createMouseMoveHandler:function(a){return function(b){if(a.isDragging){var c=a.data("hoverClass"),d={left:a.mouseX(b),top:a.mouseY(b)},e=gj.droppable.methods.isOver(a,d);e!=a.isOver&&(e?(c&&a.addClass(c),gj.droppable.events.over(a,d)):(c&&a.removeClass(c),gj.droppable.events.out(a))),a.isOver=e}}},createMouseUpHandler:function(a){return function(b){var c={left:a.mouseX(b),top:a.mouseY(b)};a.isDragging=!1,gj.droppable.methods.isOver(a,c)&&gj.droppable.events.drop(a)}},isOver:function(a,b){var c=a.offset().top;return offsetLeft=a.offset().left,b.left>offsetLeft&&b.leftc&&b.toparrow_upward',desc:'arrow_downward',expand:'add',collapse:'remove'}},fontawesome:{icons:{asc:'',desc:'',expand:'',collapse:''}},glyphicons:{icons:{asc:'',desc:'',expand:'',collapse:''}}},gj.grid.events={beforeEmptyRowInsert:function(a,b){a.triggerHandler("beforeEmptyRowInsert",[b])},dataBinding:function(a,b){a.triggerHandler("dataBinding",[b])},dataBound:function(a,b,c){a.triggerHandler("dataBound",[b,c])},rowDataBound:function(a,b,c,d){a.triggerHandler("rowDataBound",[b,c,d])},cellDataBound:function(a,b,c,d,e){a.triggerHandler("cellDataBound",[b,c,d,e])},rowSelect:function(a,b,c,d){a.triggerHandler("rowSelect",[b,c,d])},rowUnselect:function(a,b,c,d){a.triggerHandler("rowUnselect",[b,c,d])},rowRemoving:function(a,b,c,d){a.triggerHandler("rowRemoving",[b,c,d])},destroying:function(a){a.triggerHandler("destroying")},columnHide:function(a,b){a.triggerHandler("columnHide",[b])},columnShow:function(a,b){a.triggerHandler("columnShow",[b])},initialized:function(a){a.triggerHandler("initialized")},dataFiltered:function(a,b){a.triggerHandler("dataFiltered",[b])}},gj.grid.methods={init:function(a){return this.attr("data-type","grid"),gj.widget.prototype.init.call(this,a,"grid"),gj.grid.methods.initialize(this),this.data("autoLoad")&&this.reload(),this},getConfig:function(a,b){var c=gj.widget.prototype.getConfig.call(this,a,b);return gj.grid.methods.setDefaultColumnConfig(c.columns,c.defaultColumnSettings),c},setDefaultColumnConfig:function(a,b){var c,d;if(a&&a.length)for(d=0;d tr > th").each(function(){var b=$(this),c=b.text(),d=gj.widget.prototype.getHTMLConfig.call(b);d.title=c,d.field||(d.field=c),d.events&&(d.events=gj.grid.methods.eventsParser(d.events)),a.columns.push(d)}),a},eventsParser:function(events){var result={},list,i,key,func,position;for(list=events.split(","),i=0;i0&&(key=$.trim(list[i].substr(0,position)),func=$.trim(list[i].substr(position+1,list[i].length)),result[key]=eval("window."+func));return result},initialize:function(a){var b=a.data(),c=a.parent('div[data-role="wrapper"]');0===c.length?(c=$('
').addClass(b.style.wrapper),a.wrap(c)):c.addClass(b.style.wrapper),b.width&&a.parent().css("width",b.width),b.minWidth&&a.css("min-width",b.minWidth),b.fontSize&&a.css("font-size",b.fontSize),a.addClass(b.style.table),"checkbox"===b.selectionMethod&&(b.columns=[{title:"",field:b.primaryKey||"",width:b.defaultIconColumnWidth,align:"center",type:"checkbox",role:"selectRow",events:{click:function(b){gj.grid.methods.setSelected(a,b.data.id,$(this).closest("tr"))}}}].concat(b.columns)),a.append($("")),gj.grid.methods.renderHeader(a),gj.grid.methods.appendEmptyRow(a," "),gj.grid.events.initialized(a)},renderHeader:function(a){var b,c,d,e,f,g,h,i;for(b=a.data(),c=b.columns,d=b.style.header,e=a.children("thead"),0===e.length&&(e=$(""),a.prepend(e)),f=$(''),h=0;h'),c[h].width?g.attr("width",c[h].width):"checkbox"===c[h].type&&g.attr("width",b.defaultIconColumnWidth),g.addClass(d.cell),c[h].headerCssClass&&g.addClass(c[h].headerCssClass),g.css("text-align",c[h].align||"left"),c[h].sortable&&(g.addClass(d.sortable),g.on("click",gj.grid.methods.createSortHandler(a,g,c[h]))),"checkbox"===b.selectionMethod&&"multiple"===b.selectionType&&"checkbox"===c[h].type&&"selectRow"===c[h].role?(i=g.find('input[data-role="selectAll"]'),0===i.length&&(i=$(''),g.append(i)),i.off("click").on("click",function(){this.checked?a.selectAll():a.unSelectAll()})):g.append($('
').html("undefined"==typeof c[h].title?c[h].field:c[h].title)),c[h].hidden&&g.hide(),f.append(g);e.empty().append(f)},createSortHandler:function(a,b,c){return function(){var b,d={};a.count()>0&&(b=a.data(),d[b.paramNames.sortBy]=c.field,c.direction="asc"===c.direction?"desc":"asc",d[b.paramNames.direction]=c.direction,a.reload(d))}},updateHeader:function(a){var b,c=a.data(),d=(c.style.header,c.params[c.paramNames.sortBy]),e=c.params[c.paramNames.direction];a.find('thead tr th [data-role="sorticon"]').remove(),d&&(position=gj.grid.methods.getColumnPosition(a.data("columns"),d),$cell=a.find("thead tr th:eq("+position+")"),b=$('
').append("desc"===e?c.icons.desc:c.icons.asc),$cell.append(b))},useHtmlDataSource:function(a,b){var c,d,e,f,g=[],h=a.find('tbody tr[data-role != "empty"]');for(c=0;c').addClass(h.style.loadingCover).css({width:e,height:f,top:g}),d=$('
Loading...
').addClass(h.style.loadingText),d.insertAfter(a),c.insertAfter(a),d.css({top:g+f/2-d.outerHeight(!1)/2,left:e/2-d.outerWidth(!1)/2}))},stopLoading:function(a){a.parent().find('div[data-role="loading-cover"]').remove(),a.parent().find('div[data-role="loading-text"]').remove()},createAddRowHoverHandler:function(a,b){return function(){a.addClass(b)}},createRemoveRowHoverHandler:function(a,b){return function(){a.removeClass(b)}},appendEmptyRow:function(a,b){var c,d,e,f;c=a.data(),d=$(''),e=$("").css({width:"100%","text-align":"center"}),e.attr("colspan",gj.grid.methods.countVisibleColumns(a)),f=$("
").html(b||c.notFoundText),e.append(f),d.append(e),gj.grid.events.beforeEmptyRowInsert(a,d),a.append(d)},autoGenerateColumns:function(a,b){var c,d,e,f,g=a.data();if(g.columns=[],b.length>0){for(c=Object.getOwnPropertyNames(b[0]),f=0;f-1&&(e="date")),g.columns.push({field:c[f],type:e});gj.grid.methods.setDefaultColumnConfig(g.columns,g.defaultColumnSettings)}gj.grid.methods.renderHeader(a)},loadData:function(a){var b,c,d,e,f,g,h,i;for(b=a.data(),c=a.getAll(),gj.grid.events.dataBinding(a,c),e=c.length,gj.grid.methods.stopLoading(a),b.autoGenerateColumns&&gj.grid.methods.autoGenerateColumns(a,c),g=a.find("tbody"),"checkbox"===b.selectionMethod&&"multiple"===b.selectionType&&a.find('thead input[data-role="selectAll"]').prop("checked",!1),g.children("tr").not('[data-role="row"]').remove(),0===e&&(g.empty(),gj.grid.methods.appendEmptyRow(a)),h=g.children("tr"),f=h.length,d=0;f>d;d++){if(!(e>d)){g.find('tr[data-role="row"]:gt('+(d-1)+")").remove();break}i=h.eq(d),gj.grid.methods.renderRow(a,i,c[d],d)}for(d=f;e>d;d++)gj.grid.methods.renderRow(a,null,c[d],d);gj.grid.events.dataBound(a,c,b.totalRecords)},getId:function(a,b,c){return b&&a[b]?a[b]:c},renderRow:function(a,b,c,d){var e,f,g,h,i;for(h=a.data(),b&&0!==b.length?(i="update",b.removeClass(h.style.content.rowSelected).removeAttr("data-selected").off("click")):(i="create",b=$(''),a.children("tbody").append(b),b.on("mouseenter",gj.grid.methods.createAddRowHoverHandler(b,h.style.content.rowHover)),b.on("mouseleave",gj.grid.methods.createRemoveRowHoverHandler(b,h.style.content.rowHover))),e=gj.grid.methods.getId(c,h.primaryKey,d+1),b.attr("data-position",d+1),"checkbox"!==h.selectionMethod&&b.on("click",gj.grid.methods.createRowClickHandler(a,e)),g=0;g").css("text-align",c.align||"left"),g=$('
'),c.cssClass&&b.addClass(c.cssClass),b.append(g),f="create"),gj.grid.methods.renderDisplayElement(a,g,c,d,e,f),"update"===f&&(b.off(),g.off()),c.events)for(h in c.events)c.events.hasOwnProperty(h)&&b.on(h,{id:e,field:c.field,record:d},gj.grid.methods.createCellEventHandler(c,c.events[h]));return c.hidden&&b.hide(),gj.grid.events.cellDataBound(a,g,e,c,d),b},createCellEventHandler:function(a,b){return function(c){a.stopPropagation&&c.stopPropagation(),b.call(this,c)}},renderDisplayElement:function(a,b,c,d,e,f){var g,h;"checkbox"===c.type?"create"===f?(h=$("").attr("type","checkbox").val(e),c.role&&h.attr("data-role",c.role),b.append(h)):b.find('input[type="checkbox"]').val(e).prop("checked",!1):"icon"===c.type?"create"===f&&(b.append($("").addClass("bootstrap"===a.data().uiLibrary?"glyphicon":"ui-icon").addClass(c.icon).css({cursor:"pointer"})),c.stopPropagation=!0):c.tmpl?(g=c.tmpl,c.tmpl.replace(/\{(.+?)\}/g,function(a,b){g=g.replace(a,gj.grid.methods.formatText(d[b],c))}),b.html(g)):c.renderer&&"function"==typeof c.renderer?(g=c.renderer(d[c.field],d,b.parent(),b,e,a),g&&b.html(g)):(g=gj.grid.methods.formatText(d[c.field],c),!c.tooltip&&g&&b.attr("title",g),b.text(g)),c.tooltip&&"create"===f&&b.attr("title",c.tooltip)},formatText:function(a,b){var c,d,e,f;if(a&&b.type)switch(b.type){case"date":a.indexOf("/Date(")>-1?c=new Date(parseInt(a.substr(6),10)):(f=a.match(/(\d+)/g),c=new Date(f[0],f[1]-1,f[2],f[3],f[4],f[5])),c.format&&b.format?a=c.format(b.format):(d=2===c.getDate().toString().length?c.getDate():"0"+c.getDate(),e=(c.getMonth()+1).toString(),e=2===e.length?e:"0"+e,a=e+"/"+d+"/"+c.getFullYear())}else a="undefined"==typeof a||null===a?"":a.toString();return b.decimalDigits&&a&&(a=parseFloat(a).toFixed(b.decimalDigits)),a},setRecordsData:function(a,b){var c=[],d=0,e=a.data();return $.isArray(b)?(c=b,d=b.length):e&&e.mapping&&$.isArray(b[e.mapping.dataField])&&(c=b[e.mapping.dataField],d=b[e.mapping.totalRecordsField],(!d||isNaN(d))&&(d=0)),a.data("records",c),a.data("totalRecords",d),c},createRowClickHandler:function(a,b){return function(){gj.grid.methods.setSelected(a,b,$(this))}},selectRow:function(a,b,c,d){var e;c.addClass(b.style.content.rowSelected),c.attr("data-selected","true"),"checkbox"===b.selectionMethod&&(e=c.find('input[type="checkbox"][data-role="selectRow"]'),e.length&&!e.prop("checked")&&e.prop("checked",!0),"multiple"===b.selectionType&&a.getSelections().length===a.count(!1)&&a.find('thead input[data-role="selectAll"]').prop("checked",!0)),gj.grid.events.rowSelect(a,c,d,a.getById(d))},unselectRow:function(a,b,c,d){var e;"true"===c.attr("data-selected")&&(c.removeClass(b.style.content.rowSelected),"checkbox"===b.selectionMethod&&(e=c.find('td input[type="checkbox"][data-role="selectRow"]'), e.length&&e.prop("checked")&&e.prop("checked",!1),"multiple"===b.selectionType&&a.find('thead input[data-role="selectAll"]').prop("checked",!1)),c.removeAttr("data-selected"),gj.grid.events.rowUnselect(a,c,d,a.getById(d)))},setSelected:function(a,b,c){var d=a.data();return c&&c.length||(c=gj.grid.methods.getRowById(a,b)),c&&("true"===c.attr("data-selected")?gj.grid.methods.unselectRow(a,d,c,b):("single"===d.selectionType&&c.siblings('[data-selected="true"]').each(function(){var b=$(this),c=gj.grid.methods.getId(b,d.primaryKey,b.data("position"));gj.grid.methods.unselectRow(a,d,b,c)}),gj.grid.methods.selectRow(a,d,c,b))),a},selectAll:function(a){var b=a.data();return a.find('tbody tr[data-role="row"]').each(function(){var c=$(this);gj.grid.methods.selectRow(a,b,c,a.get(c.data("position")))}),a.find('thead input[data-role="selectAll"]').prop("checked",!0),a},unSelectAll:function(a){var b=a.data();return a.find("tbody tr").each(function(){var c=$(this);gj.grid.methods.unselectRow(a,b,c,a.get(c.data("position"))),c.find('input[type="checkbox"][data-role="selectRow"]').prop("checked",!1)}),a.find('thead input[data-role="selectAll"]').prop("checked",!1),a},getSelected:function(a){var b,c,d,e=null;return b=a.find('tbody>tr[data-selected="true"]'),b.length>0&&(d=$(b[0]).data("position"),c=a.get(d),e=gj.grid.methods.getId(c,a.data().primaryKey,d)),e},getSelectedRows:function(a){a.data();return a.find('tbody>tr[data-selected="true"]')},getSelections:function(a){var b,c,d=[],e=gj.grid.methods.getSelectedRows(a);return 0 tr[data-position="'+c+'"]')),g},getByPosition:function(a,b){return a.getAll(!1)[b-1]},getColumnPosition:function(a,b){var c,d=-1;for(c=0;c-1&&(e=gj.grid.methods.getRowById(a,b),f=e.find("td:eq("+d+') div[data-role="display"]')),f},setCellContent:function(a,b,c,d){var e,f=gj.grid.methods.getCell(a,b,c);f&&(f.empty(),"object"==typeof d?f.append(d):(e=gj.grid.methods.getColumnInfo(a,c),gj.grid.methods.renderDisplayElement(a,f,e,a.getById(b),b,"update")))},clone:function(a){var b=[];return $.each(a,function(){b.push(this.clone())}),b},getAll:function(a){return a.data("records")},countVisibleColumns:function(a){var b,c,d;for(b=a.data().columns,c=0,d=0;d-1}));return gj.grid.events.dataFiltered(a,e),e},createDefaultSorter:function(a,b){return function(c,d){var e=(c[b]||"").toString(),f=(d[b]||"").toString();return"asc"===a?e.localeCompare(f):f.localeCompare(e)}},destroy:function(a,b,c){var d=a.data();return d&&(gj.grid.events.destroying(a),gj.grid.methods.stopLoading(a),a.xhr&&a.xhr.abort(),a.off(),c===!1&&a.parent('div[data-role="wrapper"]').length>0&&a.unwrap(),a.removeData(),b===!1?a.remove():a.removeClass().empty(),a.removeAttr("data-type")),a},showColumn:function(a,b){var c,d=a.data(),e=gj.grid.methods.getColumnPosition(d.columns,b);return e>-1&&(a.find("thead>tr").each(function(){$(this).children("th").eq(e).show()}),$.each(a.find("tbody>tr"),function(){$(this).children("td").eq(e).show()}),d.columns[e].hidden=!1,c=a.find('tbody > tr[data-role="empty"] > td'),c&&c.length&&c.attr("colspan",gj.grid.methods.countVisibleColumns(a)),gj.grid.events.columnShow(a,d.columns[e])),a},hideColumn:function(a,b){var c,d=a.data(),e=gj.grid.methods.getColumnPosition(d.columns,b);return e>-1&&(a.find("thead>tr").each(function(){$(this).children("th").eq(e).hide()}),$.each(a.find("tbody>tr"),function(){$(this).children("td").eq(e).hide()}),d.columns[e].hidden=!0,c=a.find('tbody > tr[data-role="empty"] > td'),c&&c.length&&c.attr("colspan",gj.grid.methods.countVisibleColumns(a)),gj.grid.events.columnHide(a,d.columns[e])),a},isLastRecordVisible:function(){return!0},addRow:function(a,b){var c=a.data();return c.totalRecords=a.data("totalRecords")+1,gj.grid.events.dataBinding(a,[b]),c.records.push(b),$.isArray(c.dataSource)&&c.dataSource.push(b),gj.grid.methods.isLastRecordVisible(a)&&gj.grid.methods.renderRow(a,null,b,a.count()-1),gj.grid.events.dataBound(a,[b],c.totalRecords),a},updateRow:function(a,b,c){var d,e=gj.grid.methods.getRowById(a,b),f=a.data();return f.records[e.data("position")-1]=c,$.isArray(f.dataSource)&&(d=gj.grid.methods.getRecVPosById(a,b),f.dataSource[d]=c),gj.grid.methods.renderRow(a,e,c,e.index()),a},removeRow:function(a,b){var c,d=a.data(),e=gj.grid.methods.getRowById(a,b);return gj.grid.events.rowRemoving(a,e,b,a.getById(b)),$.isArray(d.dataSource)&&(c=gj.grid.methods.getRecVPosById(a,b),d.dataSource.splice(c,1)),a.reload(),a},count:function(a,b){return b?a.data().totalRecords:a.getAll().length}},gj.grid.widget=function(a,b){var c=this,d=gj.grid.methods;return c.reload=function(a){return d.startLoading(this),gj.widget.prototype.reload.call(this,a)},c.clear=function(a){return d.clear(this,a)},c.count=function(a){return d.count(this,a)},c.render=function(b){return d.render(a,b)},c.destroy=function(a,b){return d.destroy(this,a,b)},c.setSelected=function(a){return d.setSelected(this,a)},c.getSelected=function(){return d.getSelected(this)},c.getSelections=function(){return d.getSelections(this)},c.selectAll=function(){return d.selectAll(this)},c.unSelectAll=function(){return d.unSelectAll(this)},c.getById=function(a){return d.getById(this,a)},c.get=function(a){return d.getByPosition(this,a)},c.getAll=function(a){return d.getAll(this,a)},c.showColumn=function(a){return d.showColumn(this,a)},c.hideColumn=function(a){return d.hideColumn(this,a)},c.addRow=function(a){return d.addRow(this,a)},c.updateRow=function(a,b){return d.updateRow(this,a,b)},c.setCellContent=function(a,b,c){d.setCellContent(this,a,b,c)},c.removeRow=function(a){return d.removeRow(this,a)},$.extend(a,c),"grid"!==a.attr("data-type")&&d.init.call(a,b),a},gj.grid.widget.prototype=new gj.widget,gj.grid.widget.constructor=gj.grid.widget,gj.grid.widget.prototype.getConfig=gj.grid.methods.getConfig,gj.grid.widget.prototype.getHTMLConfig=gj.grid.methods.getHTMLConfig,function(a){a.fn.grid=function(a){var b;if(this&&this.length){if("object"!=typeof a&&a){if(b=new gj.grid.widget(this,null),b[a])return b[a].apply(this,Array.prototype.slice.call(arguments,1));throw"Method "+a+" does not exist."}return new gj.grid.widget(this,a)}}}(jQuery),gj.grid.plugins.expandCollapseRows={config:{base:{detailTemplate:void 0,keepExpandedRows:!0}},"private":{detailExpand:function(a,b){var c=b.closest("tr"),d=$(''),e=$(''),f=$('
'),g=a.data(),h=c.data("position"),i=a.get(h),j=gj.grid.methods.getId(i,g.primaryKey,i);d.append(e.append(f.append(c.data("details")))),d.insertAfter(c),b.children('div[data-role="display"]').empty().append(g.icons.collapse),a.updateDetails(c),gj.grid.plugins.expandCollapseRows.events.detailExpand(a,d.find("td>div"),j)},detailCollapse:function(a,b){var c=b.closest("tr"),d=c.next('tr[data-role="details"]'),e=a.data(),f=gj.grid.methods.getId(c,e.primaryKey,c.data("position"));d.remove(),b.children('div[data-role="display"]').empty().append(e.icons.expand),gj.grid.plugins.expandCollapseRows.events.detailCollapse(a,d.find("td>div"),f)},keepSelection:function(a,b){var c=a.data();c.keepExpandedRows&&($.isArray(c.expandedRows)?-1==c.expandedRows.indexOf(b)&&c.expandedRows.push(b):c.expandedRows=[b])},removeSelection:function(a,b){var c=a.data();c.keepExpandedRows&&$.isArray(c.expandedRows)&&c.expandedRows.indexOf(b)>-1&&c.expandedRows.splice(c.expandedRows.indexOf(b),1)},updateDetailsColSpan:function(a){var b=a.find('tbody > tr[data-role="details"] > td');b&&b.length&&b.attr("colspan",gj.grid.methods.countVisibleColumns(a))}},"public":{collapseAll:function(){var a=this;a.find('tbody tr[data-role="row"]').each(function(){gj.grid.plugins.expandCollapseRows["private"].detailCollapse(a,$(this).find("td").first())})},expandAll:function(){var a=this;a.find('tbody tr[data-role="row"]').each(function(){gj.grid.plugins.expandCollapseRows["private"].detailExpand(a,$(this).find("td").first())})},updateDetails:function(a){var b=this,c=a.data("details"),d=c.html(),e=b.get(a.data("position"));c.html().replace(/\{(.+?)\}/g,function(a,c){var f=gj.grid.methods.getColumnInfo(b,c);d=d.replace(a,gj.grid.methods.formatText(e[c],f))}),c.html(d)}},events:{detailExpand:function(a,b,c){a.triggerHandler("detailExpand",[b,c])},detailCollapse:function(a,b,c){a.triggerHandler("detailCollapse",[b,c])}},configure:function(a){var b,c=a.data();$.extend(!0,a,gj.grid.plugins.expandCollapseRows["public"]),"undefined"!=typeof c.detailTemplate&&(b={title:"",field:c.primaryKey,width:c.defaultIconColumnWidth,align:"center",stopPropagation:!0,cssClass:"gj-cursor-pointer gj-unselectable",tmpl:c.icons.expand,events:{click:function(b){var c=$(this),d=gj.grid.plugins.expandCollapseRows["private"];"details"===c.closest("tr").next().attr("data-role")?(d.detailCollapse(a,c),d.removeSelection(a,b.data.id)):(d.detailExpand(a,$(this)),d.keepSelection(a,b.data.id))}}},c.columns=[b].concat(c.columns),a.on("rowDataBound",function(a,b,d,e){b.data("details",$(c.detailTemplate))}),a.on("columnShow",function(b,c){gj.grid.plugins.expandCollapseRows["private"].updateDetailsColSpan(a)}),a.on("columnHide",function(b,c){gj.grid.plugins.expandCollapseRows["private"].updateDetailsColSpan(a)}),a.on("rowRemoving",function(b,c,d,e){gj.grid.plugins.expandCollapseRows["private"].detailCollapse(a,c.children("td").first())}),a.on("dataBinding",function(){a.collapseAll()}),a.on("pageChanging",function(){a.collapseAll()}),a.on("dataBound",function(){var b,c,d,e=a.data();if(e.keepExpandedRows&&$.isArray(e.expandedRows))for(b=0;b Edit',deleteButton:'',updateButton:'',cancelButton:'',managementColumnConfig:{width:200,align:"center",renderer:gj.grid.plugins.inlineEditing.renderers.editManager}}},materialdesign:{inlineEditing:{managementColumnConfig:{width:300,align:"center",renderer:gj.grid.plugins.inlineEditing.renderers.editManager}}}},gj.grid.plugins.inlineEditing["private"]={localization:function(a){"bootstrap"===a.uiLibrary?(a.inlineEditing.editButton='",a.inlineEditing.deleteButton='",a.inlineEditing.updateButton='",a.inlineEditing.cancelButton='"):"materialdesign"===a.uiLibrary?(a.inlineEditing.editButton='",a.inlineEditing.deleteButton='",a.inlineEditing.updateButton='",a.inlineEditing.cancelButton='"):(a.inlineEditing.editButton=''+gj.grid.messages[a.locale].Edit.toLowerCase()+"",a.inlineEditing.deleteButton=''+gj.grid.messages[a.locale].Delete.toLowerCase()+"",a.inlineEditing.updateButton=''+gj.grid.messages[a.locale].Update.toLowerCase()+"",a.inlineEditing.cancelButton=''+gj.grid.messages[a.locale].Cancel.toLowerCase()+"")},editMode:function(a,b,c,d){var e,f,g,h,i=a.data();"edit"!==b.attr("data-mode")&&c.editor&&("command"!==i.inlineEditing.mode&&$('div[data-role="edit"]:visible').parent("td").each(function(){$(this).find("input, select, textarea").triggerHandler("blur")}),e=b.find('div[data-role="display"]').hide(),f=b.find('div[data-role="edit"]').show(),0===f.length&&(f=$('
'),b.append(f)),h=d[c.field]||e.html(),g=f.find("input, select, textarea").first(),g.length?g.val(h):("function"==typeof c.editor?c.editor(f,h,d):"boolean"==typeof c.editor&&f.append(''),g=f.find("input, select, textarea").first(),"command"!==i.inlineEditing.mode&&(g.on("blur",function(d){gj.grid.plugins.inlineEditing["private"].displayMode(a,b,c)}),g.on("keypress",function(d){13===d.which&&gj.grid.plugins.inlineEditing["private"].displayMode(a,b,c)}))),"INPUT"===g.prop("tagName").toUpperCase()&&"TEXT"===g.prop("type").toUpperCase()?gj.grid.plugins.inlineEditing["private"].setCaretAtEnd(g[0]):g.focus(),b.attr("data-mode","edit"))},setCaretAtEnd:function(a){var b;if(a)if(b=a.value.length,document.selection){a.focus();var c=document.selection.createRange();c.moveStart("character",-b),c.moveStart("character",b),c.moveEnd("character",0),c.select()}else(a.selectionStart||"0"==a.selectionStart)&&(a.selectionStart=b,a.selectionEnd=b,a.focus())},displayMode:function(a,b,c,d){var e,f,g,h,i,j,k="";"edit"===b.attr("data-mode")&&(e=b.find('div[data-role="edit"]'),f=b.find('div[data-role="display"]'),g=e.find("input, select, textarea").first().val(),j=b.parent().data("position"),i=a.get(j),h=i[c.field],d!==!0&&g!==h&&(i[c.field]=g,gj.grid.methods.renderDisplayElement(a,f,c,i,gj.grid.methods.getId(i,a.data("primaryKey"),j),"update"),0===b.find("span.gj-dirty").length&&("0px"!==b.css("padding-top")&&(k+="margin-top: -"+b.css("padding-top")+";"),"0px"!==b.css("padding-left")&&(k+="margin-left: -"+b.css("padding-left")+";"),k=k?' style="'+k+'"':"",b.prepend($('"))),gj.grid.plugins.inlineEditing.events.cellDataChanged(a,b,c,i,h,g),gj.grid.plugins.inlineEditing["private"].updateChanges(a,c,i,g)),e.hide(),f.show(),b.attr("data-mode","display"))},updateChanges:function(a,b,c,d){var e,f,g,h=a.data();h.guid||(h.guid=gj.grid.plugins.inlineEditing["private"].generateGUID()),h.primaryKey&&(e=JSON.parse(sessionStorage.getItem("gj.grid."+h.guid)),e?f=e.filter(function(a){return a[h.primaryKey]===c[h.primaryKey]}):e=[],f&&1===f.length?f[0][b.field]=d:(g={},g[h.primaryKey]=c[h.primaryKey],h.primaryKey!==b.field&&(g[b.field]=d),e.push(g)),sessionStorage.setItem("gj.grid."+h.guid,JSON.stringify(e)))},generateGUID:function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}},gj.grid.plugins.inlineEditing["public"]={getChanges:function(){return JSON.parse(sessionStorage.getItem("gj.grid."+this.data().guid))},edit:function(a){var b,c=this.getById(a),d=gj.grid.methods.getRowById(this,a).find("td"),e=this.data("columns");for(b=0;b
'),$('
'),$("
Page
"),$("
").append($('')),$("
of 
"),$('
0
'),$('
'),$('
'),$('
'),$("
").append($(''))],rightControls:[$("
Displaying records 
"),$('
0
'),$("
 - 
"),$('
0
'),$("
 of 
"),$('
0
').css({"margin-right":"5px"})]}},bootstrap:{style:{pager:{cell:"gj-grid-bootstrap-tfoot-cell",stateDisabled:""}}},bootstrap4:{style:{pager:{cell:"gj-grid-bootstrap-tfoot-cell",stateDisabled:""}}},materialdesign:{style:{pager:{cell:"",stateDisabled:""}}},glyphicons:{icons:{first:'',previous:'',next:'',last:'',refresh:''}},materialicons:{icons:{first:'first_page',previous:'chevron_left',next:'chevron_right',last:'last_page',refresh:'refresh'}},fontawesome:{icons:{first:'',previous:'',next:'',last:'',refresh:''}}},"private":{init:function(a){var b,c,d,e,f,g,h,i,j,k;if(d=a.data(),d.pager)for(d.params[d.paramNames.page]||(d.params[d.paramNames.page]=1),d.params[d.paramNames.limit]||(d.params[d.paramNames.limit]=d.pager.limit),gj.grid.plugins.pagination["private"].localization(d),b=$(''),c=$("").addClass(d.style.pager.cell),b.append(c),f=$('
').css({"float":"left"}),g=$('
').css({"float":"right"}),/msie/.test(navigator.userAgent.toLowerCase())&&g.css({"padding-top":"3px"}),c.append(f).append(g),h=$("").append(b),a.append(h),gj.grid.plugins.pagination["private"].updatePagerColSpan(a),i=gj.grid.methods.clone(d.pager.leftControls),$.each(i,function(){f.append(this)}),j=gj.grid.methods.clone(d.pager.rightControls),$.each(j,function(){g.append(this)}),e=a.find("tfoot [data-role]"),k=0;k'+(a.icons.first||b.First)+"").attr("title",b.FirstPageTooltip).attr("data-role","page-first"),$("
 
"),$('").attr("title",b.PreviousPageTooltip).attr("data-role","page-previous"),$("
 
"),$("
"+b.Page+"
"),$("
 
"),$("
").append($('')),$("
 
"),$("
"+b.Of+" 
"),$('
0
'),$("
 
"),$('").attr("title",b.NextPageTooltip).attr("data-role","page-next"),$("
 
"),$('").attr("title",b.LastPageTooltip).attr("data-role","page-last"),$("
 
"),$('").attr("title",b.Refresh).attr("data-role","page-refresh"),$("
 
"),$("
").append($('
'))]),"undefined"==typeof a.pager.rightControls&&(a.pager.rightControls=[$("
"+b.DisplayingRecords+" 
"),$('
0
'),$("
 - 
"),$('
0
'),$("
 "+b.Of+" 
"),$('
0
').css({"margin-right":"5px"})])},localizationBootstrap4:function(a){var b=gj.grid.messages[a.locale];"undefined"==typeof a.pager.leftControls&&(a.pager.leftControls=[$('").attr("title",b.FirstPageTooltip).attr("data-role","page-first"),$("
 
"),$('").attr("title",b.PreviousPageTooltip).attr("data-role","page-previous"),$("
 
"),$("
"+b.Page+"
"),$("
 
"),$("
").append($('')),$("
 
"),$("
"+b.Of+" 
"),$('
0
'),$("
 
"),$('").attr("title",b.NextPageTooltip).attr("data-role","page-next"),$("
 
"),$('").attr("title",b.LastPageTooltip).attr("data-role","page-last"),$("
 
"),$('").attr("title",b.Refresh).attr("data-role","page-refresh"),$("
 
"),$("
").append($('
'))]),"undefined"==typeof a.pager.rightControls&&(a.pager.rightControls=[$("
"+b.DisplayingRecords+" 
"),$('
0
'),$("
 - 
"),$('
0
'),$("
 "+b.Of+" 
"),$('
0
').css({"margin-right":"5px"})])},localizationMaterialDesign:function(a){var b=gj.grid.messages[a.locale];"undefined"==typeof a.pager.leftControls&&(a.pager.leftControls=[$('").attr("title",b.FirstPageTooltip).attr("data-role","page-first").addClass(a.icons.first?"mdl-button--icon":""),$('").attr("title",b.PreviousPageTooltip).attr("data-role","page-previous").addClass(a.icons.previous?"mdl-button--icon":""),$(''+b.Page+""),$(''),$(''+b.Of+""),$('0'),$('").attr("title",b.NextPageTooltip).attr("data-role","page-next").addClass(a.icons.next?"mdl-button--icon":""),$('").attr("title",b.LastPageTooltip).attr("data-role","page-last").addClass(a.icons.last?"mdl-button--icon":""),$('").attr("title",b.Refresh).attr("data-role","page-refresh").addClass(a.icons.refresh?"mdl-button--icon":""),$('
')]),"undefined"==typeof a.pager.rightControls&&(a.pager.rightControls=[$(''+b.DisplayingRecords+""),$('0'),$('-'),$('0'),$(''+b.Of+""),$('0')])},localizationBaseTheme:function(a){var b=gj.grid.messages[a.locale];"undefined"==typeof a.pager.leftControls&&(a.pager.leftControls=[$(''),$(''),$(''),$(''),$('  ')]),"undefined"==typeof a.pager.rightControls&&(a.pager.rightControls=[$("
"+b.DisplayingRecords+" 
"),$('
0
'),$("
 - 
"),$('
0
'),$("
 "+b.Of+" 
"),$('
0
').css({ "margin-right":"5px"})])},initPagerControl:function(a,b){var c=b.data();switch(a.data("role")){case"page-size":c.pager.sizes&&0").attr("value",this.toString()).text(this.toString()))}),a.change(function(){var a=parseInt(this.value,10);c.params[c.paramNames.limit]=a,gj.grid.plugins.pagination["private"].changePage(b,1),gj.grid.plugins.pagination.events.pageSizeChange(b,a)}),a.val(c.params[c.paramNames.limit])):a.hide();break;case"page-refresh":a.on("click",function(){b.reload()})}},reloadPager:function(a,b){var c,d,e,f,g,h,i,j;if(h=a.data(),h.pager){for(c=0===b?0:parseInt(h.params[h.paramNames.page],10),d=parseInt(h.params[h.paramNames.limit],10),e=Math.ceil(b/d),f=0===c?0:d*(c-1)+1,g=f+d>b?b:f+d-1,i=a.find("TFOOT [data-role]"),j=0;jc);break;case"page-previous":gj.grid.plugins.pagination["private"].assignPageHandler(b,a,c-1,2>c);break;case"page-number":a.val(c).off("change").on("change",gj.grid.plugins.pagination["private"].createChangePageHandler(b,c,d));break;case"page-label-last":a.text(d);break;case"page-next":gj.grid.plugins.pagination["private"].assignPageHandler(b,a,c+1,d===c);break;case"page-last":gj.grid.plugins.pagination["private"].assignPageHandler(b,a,d,d===c);break;case"page-button-one":h=1===c?1:c==d?c-2:c-1,gj.grid.plugins.pagination["private"].assignButtonHandler(b,a,c,h,d);break;case"page-button-two":h=1===c?2:c==d?d-1:c,gj.grid.plugins.pagination["private"].assignButtonHandler(b,a,c,h,d);break;case"page-button-three":h=1===c?c+2:c==d?c:c+1,gj.grid.plugins.pagination["private"].assignButtonHandler(b,a,c,h,d);break;case"record-first":a.text(e);break;case"record-last":a.text(f);break;case"record-total":a.text(g)}},assignPageHandler:function(a,b,c,d){var e=a.data().style.pager;d?b.addClass(e.stateDisabled).prop("disabled",!0).off("click"):b.removeClass(e.stateDisabled).prop("disabled",!1).off("click").on("click",function(){gj.grid.plugins.pagination["private"].changePage(a,c)})},assignButtonHandler:function(a,b,c,d,e){var f=a.data().style.pager;1>d||d>e?b.hide():(b.show().off("click").text(d),d===c?b.addClass(f.activeButton):b.removeClass(f.activeButton).on("click",function(){gj.grid.plugins.pagination["private"].changePage(a,d)}))},createChangePageHandler:function(a,b,c){return function(){var d=(a.data(),parseInt(this.value,10));d&&!isNaN(d)&&c>=d?gj.grid.plugins.pagination["private"].changePage(a,d):(this.value=b,alert("Please enter a valid number."))}},changePage:function(a,b){var c=a.data();a.find('TFOOT [data-role="page-number"]').val(b),c.params[c.paramNames.page]=b,gj.grid.plugins.pagination.events.pageChanging(a,b),a.reload()},updatePagerColSpan:function(a){var b=a.find('tfoot > tr[data-role="pager"] > th');b&&b.length&&b.attr("colspan",gj.grid.methods.countVisibleColumns(a))},isLastRecordVisible:function(a){var b=!0,c=a.data(),d=parseInt(c.params[c.paramNames.limit],10),e=parseInt(c.params[c.paramNames.page],10),f=a.count();return d&&e&&(b=(e-1)*d+f===c.totalRecords),b}},"public":{getAll:function(a){var b,c,d,e=this.data();return!a&&$.isArray(e.dataSource)&&e.params[e.paramNames.limit]&&e.params[e.paramNames.page]?(b=parseInt(e.params[e.paramNames.limit],10),c=parseInt(e.params[e.paramNames.page],10),d=(c-1)*b,e.records.slice(d,d+b)):e.records}},events:{pageSizeChange:function(a,b){a.triggerHandler("pageSizeChange",[b])},pageChanging:function(a,b){a.triggerHandler("pageChanging",[b])}},configure:function(a,b,c){$.extend(!0,a,gj.grid.plugins.pagination["public"]);a.data();c.pager&&(gj.grid.methods.isLastRecordVisible=gj.grid.plugins.pagination["private"].isLastRecordVisible,a.on("initialized",function(){gj.grid.plugins.pagination["private"].init(a)}),a.on("dataBound",function(b,c,d){gj.grid.plugins.pagination["private"].reloadPager(a,d)}),a.on("columnShow",function(){gj.grid.plugins.pagination["private"].updatePagerColSpan(a)}),a.on("columnHide",function(){gj.grid.plugins.pagination["private"].updatePagerColSpan(a)}))}},gj.grid.plugins.responsiveDesign={config:{base:{resizeCheckInterval:500,responsive:!1,showHiddenColumnsAsDetails:!1,defaultColumn:{priority:void 0,minWidth:150},style:{rowDetailItem:""}},bootstrap:{style:{rowDetailItem:"col-lg-4"}},jqueryui:{style:{rowDetailItem:""}}},"private":{orderColumns:function(a){var b=[];if(a.columns&&a.columns.length){for(i=0;ib.priority&&(c=1),c})}return b},updateDetails:function(a){var b,c,d,e,f,g,h,i,j;for(b=a.find('tbody > tr[data-role="row"]'),c=a.data(),d=0;d"+(i.title||i.field)+": {"+i.field+"}",h&&h.length?h.empty().html(j):(h=$('
').html(j),h.addClass(c.style.rowDetailItem),g&&g.length||(g=$('
')),g.append(h))):h&&h.length&&h.remove();a.updateDetails(f)}}},"public":{oldWidth:void 0,resizeCheckIntervalId:void 0,makeResponsive:function(){var a,b,c=0,d=this.data(),e=gj.grid.plugins.responsiveDesign["private"].orderColumns(d);for(a=0;atr>th:eq("+e[a].position+")"),b.is(":visible")&&e[a].minWidthtr>th:eq("+e[a].position+")"),!b.is(":visible")&&e[a].minWidth<=c&&(this.showColumn(e[a].field),c-=b.width());for(a=e.length-1;a>=0;a--)b=this.find("thead>tr>th:eq("+e[a].position+")"),b.is(":visible")&&e[a].priority&&e[a].minWidth>b.outerWidth()&&this.hideColumn(e[a].field)}},events:{resize:function(a,b,c){a.triggerHandler("resize",[b,c])}},configure:function(a,b,c){$.extend(!0,a,gj.grid.plugins.responsiveDesign["public"]),b.responsive&&(a.on("initialized",function(){a.makeResponsive(),a.oldWidth=a.width(),a.resizeCheckIntervalId=setInterval(function(){var b=a.width();b!==a.oldWidth&&gj.grid.plugins.responsiveDesign.events.resize(a,b,a.oldWidth),a.oldWidth=b},b.resizeCheckInterval)}),a.on("destroy",function(){a.resizeCheckIntervalId&&clearInterval(a.resizeCheckIntervalId)}),a.on("resize",function(){a.makeResponsive()})),b.showHiddenColumnsAsDetails&&gj.grid.plugins.expandCollapseRows&&(a.on("dataBound",function(){gj.grid.plugins.responsiveDesign["private"].updateDetails(a)}),a.on("columnHide",function(){gj.grid.plugins.responsiveDesign["private"].updateDetails(a)}),a.on("columnShow",function(){gj.grid.plugins.responsiveDesign["private"].updateDetails(a)}),a.on("rowDataBound",function(){gj.grid.plugins.responsiveDesign["private"].updateDetails(a)}))}},gj.grid.plugins.toolbar={config:{base:{toolbarTemplate:void 0,title:void 0,style:{toolbar:"gj-grid-base-toolbar"}},jqueryui:{style:{toolbar:"ui-widget-header ui-state-default gj-grid-ui-toolbar"}},bootstrap:{style:{toolbar:"gj-grid-bootstrap-toolbar"}}},"private":{init:function(a){var b,c,d;b=a.data(),c=a.prev('div[data-role="toolbar"]'),("undefined"!=typeof b.toolbarTemplate||"undefined"!=typeof b.title||c.length>0)&&(0===c.length&&(c=$('
'),a.before(c)),c.addClass(b.style.toolbar),0===c.children().length&&b.toolbarTemplate&&c.append(b.toolbarTemplate),d=c.find('[data-role="title"]'),0===d.length&&(d=$('
'),c.prepend(d)),b.title&&d.text(b.title),b.minWidth&&c.css("min-width",b.minWidth))}},"public":{title:function(a){var b=this.parent().find('div[data-role="toolbar"] [data-role="title"]');return"undefined"!=typeof a?(b.text(a),this):b.text()}},configure:function(a){$.extend(!0,a,gj.grid.plugins.toolbar["public"]),a.on("initialized",function(){gj.grid.plugins.toolbar["private"].init(a)})}},gj.grid.plugins.resizableColumns={config:{base:{resizableColumns:!1}},"private":{init:function(a,b){var c,d,e,f,g,h;if(c=a.find('thead tr[data-role="caption"] th'),c.length)for(e=0;e'),h=parseInt(d.css("padding-right"),10)+3,g=$('').css("margin-right","-"+h+"px"),$.fn.draggable&&g.draggable({start:function(){a.addClass("gj-unselectable"),a.addClass("gj-grid-resize-cursor")},stop:function(){a.removeClass("gj-unselectable"),a.removeClass("gj-grid-resize-cursor"),this.style.removeProperty("top"),this.style.removeProperty("left"),this.style.removeProperty("position")},drag:gj.grid.plugins.resizableColumns["private"].createResizeHandle(a,d,b.columns[e])}),d.append(f.append(g))},createResizeHandle:function(a,b,c){return function(a,d){var e,f=parseInt(b.attr("width"),10);f||(f=b.outerWidth()),d&&d.left&&(e=f+d.left,c.width=e,b.attr("width",e))}}},"public":{},configure:function(a,b,c){$.extend(!0,a,gj.grid.plugins.resizableColumns["public"]),b.resizableColumns&&a.on("initialized",function(){gj.grid.plugins.resizableColumns["private"].init(a,b)})}},gj.grid.plugins.rowReorder={config:{base:{rowReorder:!1,rowReorderColumn:void 0,orderNumberField:void 0,style:{targetRowIndicatorTop:"gj-grid-row-reorder-indicator-top",targetRowIndicatorBottom:"gj-grid-row-reorder-indicator-bottom"}}},"private":{init:function(a){var b,c,d,e=a.find('tbody tr[data-role="row"]');for(a.data("rowReorderColumn")&&(c=gj.grid.methods.getColumnPosition(a.data("columns"),a.data("rowReorderColumn"))),b=0;bj?i.before(b):i.after(b),l.records.splice(j-1,0,l.records.splice(k-1,1)[0]),c=i.parent().find('tr[data-role="row"]'),f=0;fd?c.addClass("gj-grid-base-top-border"):c.addClass("gj-grid-base-bottom-border")}},droppableOut:function(){$(this).removeClass("gj-grid-base-top-border"),$(this).removeClass("gj-grid-base-bottom-border")}},"public":{},configure:function(a,b,c){$.extend(!0,a,gj.grid.plugins.rowReorder["public"]),b.rowReorder&&$.fn.draggable&&$.fn.droppable&&a.on("dataBound",function(){gj.grid.plugins.rowReorder["private"].init(a)})}},gj.grid.plugins.columnReorder={config:{base:{columnReorder:!1,style:{targetRowIndicatorTop:"gj-grid-row-reorder-indicator-top",targetRowIndicatorBottom:"gj-grid-row-reorder-indicator-bottom"}}},"private":{init:function(a){var b,c,d=a.find("thead tr th");for(b=0;bf?c.before(b):c.after(b),gj.grid.plugins.columnReorder["private"].moveRowCells(a,g,f),e.columns.splice(f,0,e.columns.splice(g,1)[0])),c.droppable("destroy")})}},moveRowCells:function(a,b,c){var d,e,f=a.find('tbody tr[data-role="row"]');for(d=0;dc?e.find("td:eq("+c+")").before(e.find("td:eq("+b+")")):e.find("td:eq("+c+")").after(e.find("td:eq("+b+")"))},createDroppableOverHandler:function(a,b){return function(c){var d=$(this),e=a.data(),f=gj.grid.methods.getColumnPosition(e.columns,d.data("field")),g=gj.grid.methods.getColumnPosition(e.columns,b.data("field"));g>f?(d.addClass("gj-grid-base-left-border"),a.find('tbody tr[data-role="row"] td:nth-child('+(d.index()+1)+")").addClass("gj-grid-base-left-border")):(d.addClass("gj-grid-base-right-border"),a.find('tbody tr[data-role="row"] td:nth-child('+(d.index()+1)+")").addClass("gj-grid-base-right-border"))}},droppableOut:function(){var a=$(this);a.removeClass("gj-grid-base-left-border").removeClass("gj-grid-base-right-border"),a.closest("table").find('tbody tr[data-role="row"] td:nth-child('+(a.index()+1)+")").removeClass("gj-grid-base-left-border").removeClass("gj-grid-base-right-border")}},"public":{},configure:function(a,b,c){$.extend(!0,a,gj.grid.plugins.columnReorder["public"]),b.columnReorder&&a.on("initialized",function(){gj.grid.plugins.columnReorder["private"].init(a)})}},gj.grid.plugins.headerFilter={config:{base:{defaultColumnSettings:{filterable:!0},headerFilter:{type:"onenterkeypress"}}},"private":{init:function(a){var b,c,d,e=a.data(),f=$('');for(b=0;b"),e.columns[b].filterable&&(d=$(''),"onchange"===e.headerFilter.type?d.on("input propertychange",function(b){gj.grid.plugins.headerFilter["private"].reload(a,$(this))}):(d.on("keypress",function(b){13==b.which&&gj.grid.plugins.headerFilter["private"].reload(a,$(this))}),d.on("blur",function(b){gj.grid.plugins.headerFilter["private"].reload(a,$(this))})),c.append(d)),e.columns[b].hidden&&c.hide(),f.append(c);a.children("thead").append(f)},reload:function(a,b){var c={};c[b.data("field")]=b.val(),a.reload(c)}},"public":{},events:{},configure:function(a,b,c){$.extend(!0,a,gj.grid.plugins.headerFilter["public"]);a.data();c.headerFilter&&a.on("initialized",function(){gj.grid.plugins.headerFilter["private"].init(a)})}},gj.grid.plugins.grouping={config:{base:{paramNames:{groupBy:"groupBy",groupByDirection:"groupByDirection"},grouping:{groupBy:void 0,direction:"asc"}}},"private":{init:function(a){var b,c=a.data();b=void 0,a.on("rowDataBound",function(d,e,f,g){if(b!==g[c.grouping.groupBy]){var h=gj.grid.methods.countVisibleColumns(a)-1,i=$(''),j=$('');j.append('
'+c.icons.collapse+"
"),j.on("click",gj.grid.plugins.grouping["private"].createExpandCollapseHandler(c)),i.append(j),i.append('
'+c.grouping.groupBy+": "+g[c.grouping.groupBy]+"
"),i.insertBefore(e),b=g[c.grouping.groupBy]}e.show()}),c.params[c.paramNames.groupBy]=c.grouping.groupBy,c.params[c.paramNames.groupByDirection]=c.grouping.direction},grouping:function(a,b){var c=a.data();b.sort(gj.grid.methods.createDefaultSorter(c.grouping.direction,c.grouping.groupBy))},createExpandCollapseHandler:function(a){return function(b){var c=$(this),d=c.children('div[data-role="display"]'),e=c.closest("tr");"row"===e.next(":visible").data("role")?(e.nextUntil('[data-role="group"]').hide(),d.empty().append(a.icons.expand)):(e.nextUntil('[data-role="group"]').show(),d.empty().append(a.icons.collapse))}}},"public":{},configure:function(a){var b,c=a.data();$.extend(!0,a,gj.grid.plugins.grouping["public"]),c.grouping&&c.grouping.groupBy&&(b={title:"",field:"",width:c.defaultIconColumnWidth,align:"center",stopPropagation:!0,cssClass:"gj-cursor-pointer gj-unselectable"},c.columns=[b].concat(c.columns),a.on("initialized",function(){gj.grid.plugins.grouping["private"].init(a)}),a.on("dataFiltered",function(b,c){gj.grid.plugins.grouping["private"].grouping(a,c)}))}},"undefined"==typeof gj.tree&&(gj.tree={plugins:{}}),gj.tree.config={base:{autoLoad:!0,selectionType:"single",cascadeSelection:!1,dataSource:void 0,primaryKey:void 0,textField:"text",childrenField:"children",imageCssClassField:"imageCssClass",imageUrlField:"imageUrl",imageHtmlField:"imageHtml",width:void 0,border:!1,uiLibrary:"base",iconsLibrary:void 0,autoGenId:1,indentation:16,style:{wrapper:"gj-unselectable",list:"gj-tree-list",item:"gj-tree-item",active:"gj-tree-base-active",display:void 0,leafIcon:void 0},icons:{expand:"+",collapse:"-"}},bootstrap:{indentation:24,style:{wrapper:"gj-unselectable gj-tree-bootstrap-3",list:"gj-tree-bootstrap-list list-group",item:"gj-tree-item list-group-item",active:"active",border:"gj-tree-bootstrap-border"},iconsLibrary:"glyphicons"},bootstrap4:{indentation:24,style:{wrapper:"gj-unselectable gj-tree-bootstrap-4",list:"gj-tree-bootstrap-list list-group",item:"gj-tree-item list-group-item",active:"active",border:"gj-tree-bootstrap-border"}},materialdesign:{indentation:24,style:{wrapper:"gj-unselectable",list:"gj-tree-mdl-list mdl-list",item:"gj-tree-item gj-tree-mdl-item mdl-list__item",active:"gj-tree-mdl-active",display:"mdl-list__item-primary-content",leafIcon:void 0,border:"gj-tree-mdl-border"},iconsLibrary:"materialicons"},materialicons:{indentation:24,style:{expander:"gj-tree-material-icons-expander"},icons:{expand:'add',collapse:'remove'}},fontawesome:{style:{expander:"gj-tree-font-awesome-expander"},icons:{expand:'',collapse:''}},glyphicons:{style:{expander:"gj-tree-glyphicons-expander"},icons:{expand:'',collapse:''}}},gj.tree.events={initialized:function(a){a.triggerHandler("initialized")},dataBinding:function(a){a.triggerHandler("dataBinding")},dataBound:function(a){a.triggerHandler("dataBound")},select:function(a,b,c){return a.triggerHandler("select",[b,c])},unselect:function(a,b,c){return a.triggerHandler("unselect",[b,c])},expand:function(a,b,c){return a.triggerHandler("expand",[b,c])},collapse:function(a,b,c){return a.triggerHandler("collapse",[b,c])},destroying:function(a){return a.triggerHandler("destroying")},nodeDataBound:function(a,b,c,d){return a.triggerHandler("nodeDataBound",[b,c,d])}},gj.tree.methods={init:function(a){return this.attr("data-type","tree"),gj.widget.prototype.init.call(this,a,"tree"),gj.tree.methods.initialize.call(this),this.data("autoLoad")&&this.reload(),this},initialize:function(){var a=this.data(),b=$('
    ');this.empty().addClass(a.style.wrapper).append(b),a.width&&this.width(a.width),a.border&&this.addClass(a.style.border),gj.tree.events.initialized(this)},useHtmlDataSource:function(a,b){b.dataSource=[]},render:function(a,b){return b&&("string"==typeof b&&JSON&&(b=JSON.parse(b)),a.data("records",gj.tree.methods.getRecords(a,b)),gj.tree.methods.loadData(a)),a},filter:function(a){return a.data().dataSource},getRecords:function(a,b){var c,d,e,f=[],g=a.data();for(c=0;c').addClass(k.style.item),l=$('
    '),m=$('').addClass(k.style.expander),n=$(''+c.data[k.textField]+"");if(k.indentation&&l.append(''),m.on("click",gj.tree.methods.expanderClickHandler(a)),l.append(m),n.addClass(k.style.display).on("click",gj.tree.methods.displayClickHandler(a)),l.append(n),g.append(l),e?b.find("li:eq("+(e-1)+")").before(g):b.append(g),c.children&&c.children.length)for(m.empty().append(k.icons.expand),h=$("
      ").addClass(k.style.list).addClass("gj-hidden"),g.append(h),f=0;f').insertBefore(n):k.imageUrlField&&c.data[k.imageUrlField]?(i=$(''),i.insertBefore(n),j=$(''),j.attr("width",i.width()).attr("height",i.height()),i.append(j)):k.imageHtmlField&&c.data[k.imageHtmlField]&&(j=$(c.data[k.imageHtmlField]),j.attr("data-role","image"),j.insertBefore(n)),gj.tree.events.nodeDataBound(a,g,c.id,c.data)},expanderClickHandler:function(a){return function(b){var c=$(this),d=c.closest("li");"close"===c.attr("data-mode")?a.expand(d):a.collapse(d)}},expand:function(a,b,c){var d,e,f=b.find('>[data-role="wrapper"]>[data-role="expander"]'),g=a.data(),h=b.attr("data-id"),i=b.children("ul");if(i&&i.length&&gj.tree.events.expand(a,b,h)!==!1&&(i.show(),f.attr("data-mode","open"),f.empty().append(g.icons.collapse),c))for(d=b.find("ul>li"),e=0;e[data-role="wrapper"]>[data-role="expander"]'),g=a.data(),h=b.attr("data-id"),i=b.children("ul");if(i&&i.length&&gj.tree.events.collapse(a,b,h)!==!1&&(i.hide(),f.attr("data-mode","close"),f.empty().append(g.icons.expand),c))for(d=b.find("ul>li"),e=0;eli");for(b=0;bli");for(b=0;bli");for(b=0;bli"),d=0;dli");for(b=0;bli"),d=0;d[data-role="wrapper"]>[data-role="display"]').text()){e=d;break}if(d.has("ul")&&(e=gj.tree.methods.getNodeByText(d.children("ul"),b)))break}return e},addNode:function(a,b,c,d){var e=gj.tree.methods.getRecords(a,[b]),f=c.parentsUntil('[data-type="tree"]',"ul").length+1;return c&&c.length||(c=a.children("ul")),gj.tree.methods.appendNode(a,c,e[0],f,d),a},remove:function(a,b){return gj.tree.methods.removeDataById(a,b.attr("data-id"),a.data("records")),b.remove(),a},removeDataById:function(a,b,c){var d;for(d=0;d [data-role="wrapper"] > [data-role="expander"]'),g=$(''),h=$('').append(g);g=g.checkbox({uiLibrary:e.uiLibrary}),d[e.checkedField]&&g.state("checked"),g.on("click",function(a){var b=g.closest("li"),c=g.state();gj.tree.plugins.checkboxes["private"].updateChildrenState(b,c),gj.tree.plugins.checkboxes["private"].updateParentState(b,c)}),f.after(h)},updateParentState:function(a,b){var c,d,e,f,g,h;c=a.parent("ul").parent("li"),1===c.length&&(d=a.parent("ul").parent("li").find('> [data-role="wrapper"] > [data-role="checkbox"] input[type="checkbox"]'),e=a.siblings().find('> [data-role="wrapper"] > span[data-role="checkbox"] input[type="checkbox"]'),f="checked"===b,g="unchecked"===b,h="indeterminate",$.each(e,function(){var a=$(this).checkbox("state");f&&"checked"!==a&&(f=!1),g&&"unchecked"!==a&&(g=!1)}),f&&!g&&(h="checked"),!f&&g&&(h="unchecked"),d.checkbox("state",h),gj.tree.plugins.checkboxes["private"].updateParentState(c,d.checkbox("state")))},updateChildrenState:function(a,b){var c=a.find('ul li [data-role="wrapper"] [data-role="checkbox"] input[type="checkbox"]');c.length>1&&$.each(c,function(){$(this).checkbox("state",b)})}},"public":{getCheckedNodes:function(){var a=[],b=this.find('li [data-role="checkbox"] input[type="checkbox"]');return $.each(b,function(){var b=$(this);"checked"===b.checkbox("state")&&a.push(b.closest("li").data("id"))}),a}},configure:function(a){$.extend(!0,a,gj.tree.plugins.checkboxes["public"]),a.data("checkboxes")&&(a.on("nodeDataBound",function(b,c,d,e){gj.tree.plugins.checkboxes["private"].nodeDataBound(a,c,d,e)}),a.on("dataBound",function(){$nodes=a.find('li[data-role="node"]'),$.each($nodes,function(){var a=$(this),b=a.find('[data-role="checkbox"] input[type="checkbox"]').checkbox("state");"checked"===b&&(gj.tree.plugins.checkboxes["private"].updateChildrenState(a,b),gj.tree.plugins.checkboxes["private"].updateParentState(a,b))})}))}},gj.tree.plugins.dragAndDrop={config:{base:{dragAndDrop:void 0,style:{dragEl:"gj-tree-drag-el",dropAsChildIcon:void 0,dropAbove:"gj-tree-drop-above",dropBelow:"gj-tree-drop-below"}},bootstrap:{style:{dragEl:"gj-tree-drag-el gj-tree-bootstrap-drag-el",dropAsChildIcon:"glyphicon glyphicon-plus",dropAbove:"gj-tree-drop-above",dropBelow:"gj-tree-drop-below"}},materialdesign:{style:{dragEl:"gj-tree-drag-el gj-tree-mdl-drag-el",dropAsChildIcon:"material-icons gj-cursor-pointer gj-mdl-icon-plus",dropAbove:"gj-tree-drop-above",dropBelow:"gj-tree-drop-below"}}},"private":{nodeDataBound:function(a,b){var c=b.children('[data-role="wrapper"]'),d=b.find('>[data-role="wrapper"]>[data-role="display"]');c.length&&d.length&&d.on("mousedown",gj.tree.plugins.dragAndDrop["private"].createNodeMouseDownHandler(a,b,d))},createNodeMouseDownHandler:function(a,b,c){return function(d){var e,f,g,h,i=a.data();e=c.clone().wrap('
      ').closest("div").wrap('
    • ').closest("li").wrap('
        ').closest("ul"), -$("body").append(e),e.attr("data-role","draggable-clone").addClass("gj-unselectable").addClass(i.style.dragEl),e.find('[data-role="wrapper"]').prepend(''),e.draggable({drag:gj.tree.plugins.dragAndDrop["private"].createDragHandler(a,b,c),stop:gj.tree.plugins.dragAndDrop["private"].createDragStopHandler(a,b,c)}),f=c.parent(),g=c.offset().top,g-=parseInt(f.css("border-top-width"))+parseInt(f.css("margin-top"))+parseInt(f.css("padding-top")),h=c.offset().left,h-=parseInt(f.css("border-left-width"))+parseInt(f.css("margin-left"))+parseInt(f.css("padding-left")),h-=e.find('[data-role="indicator"]').outerWidth(!0),e.css({position:"absolute",top:g,left:h,width:c.outerWidth(!0)}),"true"===c.attr("data-droppable")&&c.droppable("destroy"),gj.tree.plugins.dragAndDrop["private"].getTargetDisplays(a,b,c).each(function(){var a=$(this);"true"===a.attr("data-droppable")&&a.droppable("destroy"),a.droppable()}),gj.tree.plugins.dragAndDrop["private"].getTargetDisplays(a,b).each(function(){var a=$(this);"true"===a.attr("data-droppable")&&a.droppable("destroy"),a.droppable()}),e.trigger("mousedown")}},getTargetDisplays:function(a,b,c){return a.find('[data-role="display"]').not(c).not(b.find('[data-role="display"]'))},getTargetWrappers:function(a,b){return a.find('[data-role="wrapper"]').not(b.find('[data-role="wrapper"]'))},createDragHandler:function(a,b,c){var d=gj.tree.plugins.dragAndDrop["private"].getTargetDisplays(a,b,c),e=gj.tree.plugins.dragAndDrop["private"].getTargetWrappers(a,b),f=a.data();return function(a,b,c){var g=$(this),h=!1;d.each(function(){var a,b=$(this);return b.droppable("isOver",c)?(a=g.find('[data-role="indicator"]'),f.style.dropAsChildIcon?a.addClass(f.style.dropAsChildIcon):a.text("+"),h=!0,!1):void g.find('[data-role="indicator"]').removeClass(f.style.dropAsChildIcon).empty()}),e.each(function(){var a,b=$(this);!h&&b.droppable("isOver",c)?(a=b.position().top+b.outerHeight()/2,c.top").addClass(f.style.list),c.append(e)),gj.tree.plugins.dragAndDrop.events.nodeDrop(a,b.data("id"),c.data("id"),e.children("li").length+1)!==!1&&(e.append(b),gj.tree.plugins.dragAndDrop["private"].refresh(a,b,c,d)),h=!0,!1):void i.droppable("destroy")}),h||e.each(function(){var c,d,e,f,h=$(this);return h.droppable("isOver",g)?(c=h.closest("li"),d=b.parent("ul").parent("li"),e=g.top'),a.attr("id")&&b.attr("for",a.attr("id")),a.wrap(b),c=$(""),d.style.spanCssClass&&c.addClass(d.style.spanCssClass),a.parent().append(c))},state:function(a,b){return b?("checked"===b?(a.prop("indeterminate",!1),a.prop("checked",!0)):"unchecked"===b?(a.prop("indeterminate",!1),a.prop("checked",!1)):"indeterminate"===b&&(a.prop("checked",!0),a.prop("indeterminate",!0)),gj.checkbox.events.stateChange(a,b),a):b=a.prop("indeterminate")?"indeterminate":a.prop("checked")?"checked":"unchecked"},toggle:function(a){return"checked"==a.data("state")?a.state("unchecked"):a.state("checked"),a},destroy:function(a){return"true"===a.attr("data-checkbox")&&(a.removeData(),a.removeAttr("data-guid"),a.removeAttr("data-checkbox"),a.off()),a}},gj.checkbox.events={stateChange:function(a,b){return a.triggerHandler("stateChange",[b])}},gj.checkbox.widget=function(a,b){var c=this,d=gj.checkbox.methods;return c.toggle=function(){return d.toggle(this)},c.state=function(a){return d.state(this,a)},c.destroy=function(){return d.destroy(this)},$.extend(a,c),"true"!==a.attr("data-checkbox")&&d.init.call(a,b),a},gj.checkbox.widget.prototype=new gj.widget,gj.checkbox.widget.constructor=gj.checkbox.widget,function(a){a.fn.checkbox=function(a){var b;if(this&&this.length){if("object"!=typeof a&&a){if(b=new gj.checkbox.widget(this,null),b[a])return b[a].apply(this,Array.prototype.slice.call(arguments,1));throw"Method "+a+" does not exist."}return new gj.checkbox.widget(this,a)}}}(jQuery); \ No newline at end of file +$("body").append(e),e.attr("data-role","draggable-clone").addClass("gj-unselectable").addClass(i.style.dragEl),e.find('[data-role="wrapper"]').prepend(''),e.draggable({drag:gj.tree.plugins.dragAndDrop["private"].createDragHandler(a,b,c),stop:gj.tree.plugins.dragAndDrop["private"].createDragStopHandler(a,b,c)}),f=c.parent(),g=c.offset().top,g-=parseInt(f.css("border-top-width"))+parseInt(f.css("margin-top"))+parseInt(f.css("padding-top")),h=c.offset().left,h-=parseInt(f.css("border-left-width"))+parseInt(f.css("margin-left"))+parseInt(f.css("padding-left")),h-=e.find('[data-role="indicator"]').outerWidth(!0),e.css({position:"absolute",top:g,left:h,width:c.outerWidth(!0)}),"true"===c.attr("data-droppable")&&c.droppable("destroy"),gj.tree.plugins.dragAndDrop["private"].getTargetDisplays(a,b,c).each(function(){var a=$(this);"true"===a.attr("data-droppable")&&a.droppable("destroy"),a.droppable()}),gj.tree.plugins.dragAndDrop["private"].getTargetDisplays(a,b).each(function(){var a=$(this);"true"===a.attr("data-droppable")&&a.droppable("destroy"),a.droppable()}),e.trigger("mousedown")}},getTargetDisplays:function(a,b,c){return a.find('[data-role="display"]').not(c).not(b.find('[data-role="display"]'))},getTargetWrappers:function(a,b){return a.find('[data-role="wrapper"]').not(b.find('[data-role="wrapper"]'))},createDragHandler:function(a,b,c){var d=gj.tree.plugins.dragAndDrop["private"].getTargetDisplays(a,b,c),e=gj.tree.plugins.dragAndDrop["private"].getTargetWrappers(a,b),f=a.data();return function(a,b,c){var g=$(this),h=!1;d.each(function(){var a,b=$(this);return b.droppable("isOver",c)?(a=g.find('[data-role="indicator"]'),f.style.dropAsChildIcon?a.addClass(f.style.dropAsChildIcon):a.text("+"),h=!0,!1):void g.find('[data-role="indicator"]').removeClass(f.style.dropAsChildIcon).empty()}),e.each(function(){var a,b=$(this);!h&&b.droppable("isOver",c)?(a=b.position().top+b.outerHeight()/2,c.top").addClass(f.style.list),c.append(e)),gj.tree.plugins.dragAndDrop.events.nodeDrop(a,b.data("id"),c.data("id"),e.children("li").length+1)!==!1&&(e.append(b),gj.tree.plugins.dragAndDrop["private"].refresh(a,b,c,d)),h=!0,!1):void i.droppable("destroy")}),h||e.each(function(){var c,d,e,f,h=$(this);return h.droppable("isOver",g)?(c=h.closest("li"),d=b.parent("ul").parent("li"),e=g.top'),a.attr("id")&&b.attr("for",a.attr("id")),a.wrap(b),c=$(""),d.style.spanCssClass&&c.addClass(d.style.spanCssClass),a.parent().append(c))},state:function(a,b){return b?("checked"===b?(a.prop("indeterminate",!1),a.prop("checked",!0)):"unchecked"===b?(a.prop("indeterminate",!1),a.prop("checked",!1)):"indeterminate"===b&&(a.prop("checked",!0),a.prop("indeterminate",!0)),gj.checkbox.events.stateChange(a,b),a):b=a.prop("indeterminate")?"indeterminate":a.prop("checked")?"checked":"unchecked"},toggle:function(a){return"checked"==a.data("state")?a.state("unchecked"):a.state("checked"),a},destroy:function(a){return"true"===a.attr("data-checkbox")&&(a.removeData(),a.removeAttr("data-guid"),a.removeAttr("data-checkbox"),a.off()),a}},gj.checkbox.events={stateChange:function(a,b){return a.triggerHandler("stateChange",[b])}},gj.checkbox.widget=function(a,b){var c=this,d=gj.checkbox.methods;return c.toggle=function(){return d.toggle(this)},c.state=function(a){return d.state(this,a)},c.destroy=function(){return d.destroy(this)},$.extend(a,c),"true"!==a.attr("data-checkbox")&&d.init.call(a,b),a},gj.checkbox.widget.prototype=new gj.widget,gj.checkbox.widget.constructor=gj.checkbox.widget,function(a){a.fn.checkbox=function(a){var b;if(this&&this.length){if("object"!=typeof a&&a){if(b=new gj.checkbox.widget(this,null),b[a])return b[a].apply(this,Array.prototype.slice.call(arguments,1));throw"Method "+a+" does not exist."}return new gj.checkbox.widget(this,a)}}}(jQuery),"undefined"==typeof gj.editor&&(gj.editor={plugins:{},messages:[]}),gj.editor.messages["en-us"]={bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",listBulleted:"List Bulleted",listNumbered:"List Numbered",indentDecrease:"Indent Decrease",indentIncrease:"Indent Increase",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",undo:"Undo",redo:"Redo"},gj.editor.config={base:{height:300,width:void 0,uiLibrary:"materialdesign",iconsLibrary:"materialicons",locale:"en-us",buttons:void 0,style:{wrapper:"gj-editor-md",buttonsGroup:"gj-md-button-group",button:"gj-md-button",buttonActive:"gj-md-button-active"}},bootstrap:{style:{wrapper:"gj-editor-bootstrap",buttonsGroup:"btn-group",button:"btn btn-default gj-cursor-pointer",buttonActive:"active"},iconsLibrary:"fontawesome"},bootstrap4:{style:{wrapper:"gj-editor-bootstrap",buttonsGroup:"btn-group",button:"btn btn-secondary gj-cursor-pointer",buttonActive:"active"},iconsLibrary:"fontawesome"},materialicons:{icons:{bold:'format_bold',italic:'format_italic',strikethrough:'strikethrough_s',underline:'format_underlined',listBulleted:'format_list_bulleted',listNumbered:'format_list_numbered',indentDecrease:'format_indent_decrease',indentIncrease:'format_indent_increase',alignLeft:'format_align_left',alignCenter:'format_align_center',alignRight:'format_align_right',alignJustify:'format_align_justify',undo:'undo',redo:'redo'}},fontawesome:{icons:{bold:'',italic:'',strikethrough:'',underline:'',listBulleted:'',listNumbered:'',indentDecrease:'',indentIncrease:'',alignLeft:'',alignCenter:'',alignRight:'',alignJustify:'',undo:'',redo:''}}},gj.editor.methods={init:function(a){return gj.widget.prototype.init.call(this,a,"editor"),this.attr("data-editor","true"),gj.editor.methods.initialize(this),this},initialize:function(a){var b,c,d=this,e=a.data(),f=a.children('div[data-role="body"]'),g=a.children('div[data-role="toolbar"]');if(gj.editor.methods.localization(e),a.addClass(e.style.wrapper),e.width&&a.width(e.width),0===f.length&&(f=$('
        '),a.append(f)),f.attr("contenteditable",!0),f.height(e.height-g.outerHeight()),f.on("mouseup keyup mouseout",function(){d.updateToolbar(a,g)}),0===g.length){g=$('
        '),f.before(g);for(var h in e.buttons){b=$("
        ").addClass(e.style.buttonsGroup);for(var i in e.buttons[h])c=$(e.buttons[h][i]),c.on("click",function(){gj.editor.methods.executeCmd(a,f,g,$(this))}),b.append(c);g.append(b)}}},localization:function(a){var b=gj.editor.messages[a.locale];"undefined"==typeof a.buttons&&(a.buttons=[['",'",'",'"],['",'",'",'"],['",'",'",'"],['",'"]])},updateToolbar:function(a,b){var c=a.data();$buttons=b.find("[data-role]").each(function(){var a=$(this),b=a.attr("data-role");b&&document.queryCommandEnabled(b)&&"true"===document.queryCommandValue(b)?a.addClass(c.style.buttonActive):a.removeClass(c.style.buttonActive)}),gj.editor.events.change(a)},executeCmd:function(a,b,c,d){b.focus(),document.execCommand(d.attr("data-role"),!1),gj.editor.methods.updateToolbar(a,c)},content:function(a,b){var c=a.children('div[data-role="body"]');return"undefined"==typeof b?c.html():c.html(b)},destroy:function(a){return"true"===a.attr("data-editor")&&(a.removeClass(a.data().style.wrapper),a.removeData(),a.removeAttr("data-guid"),a.removeAttr("data-editor"),a.off(),a.empty()),a}},gj.editor.events={change:function(a){return a.triggerHandler("change")}},gj.editor.widget=function(a,b){var c=this,d=gj.editor.methods;return c.content=function(a){return d.content(this,a)},c.destroy=function(){return d.destroy(this)},$.extend(a,c),"true"!==a.attr("data-editor")&&d.init.call(a,b),a},gj.editor.widget.prototype=new gj.widget,gj.editor.widget.constructor=gj.editor.widget,function(a){a.fn.editor=function(a){var b;if(this&&this.length){if("object"!=typeof a&&a){if(b=new gj.editor.widget(this,null),b[a])return b[a].apply(this,Array.prototype.slice.call(arguments,1));throw"Method "+a+" does not exist."}return new gj.editor.widget(this,a)}}}(jQuery); \ No newline at end of file diff --git a/dist/gijgo/1.3.1-pre-release/css/gijgo.css b/dist/gijgo/1.3.1-pre-release/css/gijgo.css deleted file mode 100644 index e5752428..00000000 --- a/dist/gijgo/1.3.1-pre-release/css/gijgo.css +++ /dev/null @@ -1,970 +0,0 @@ -.gj-button { - background-color: #f5f5f5; - border: 1px solid #ddd; - color: #000; - border-radius: 3px; - padding: 6px 10px; - cursor: pointer; -} - -.gj-unselectable { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.gj-margin-left-5 { - margin-left: 5px; -} - -.gj-margin-left-10 { - margin-left: 10px; -} - -.gj-width-full { - width: 100%; -} - -.gj-cursor-pointer { - cursor: pointer; -} - -.gj-text-align-center { - text-align: center; -} - -.gj-font-size-16 { - font-size: 16px; -} - -.gj-hidden { - display: none; -} - -.gj-mdl-icon-plus::after { - content: "\E145"; -} - -.gj-mdl-icon-minus::after { - content: "\E15B"; -} - -.gj-draggable { - cursor: move; -} -.gj-resizable-handle { - position: absolute; - font-size: 0.1px; - display: block; - -ms-touch-action: none; - touch-action: none; - z-index: 90; -} - -.gj-resizable-n { - cursor: n-resize; - height: 7px; - width: 100%; - top: -5px; - left: 0; -} -.gj-resizable-e { - cursor: e-resize; - width: 7px; - right: -5px; - top: 0; - height: 100%; -} -.gj-resizable-s { - cursor: s-resize; - height: 7px; - width: 100%; - bottom: -5px; - left: 0; -} -.gj-resizable-w { - cursor: w-resize; - width: 7px; - left: -5px; - top: 0; - height: 100%; -} -.gj-resizable-se { - cursor: se-resize; - width: 12px; - height: 12px; - right: 1px; - bottom: 1px; -} -.gj-resizable-sw { - cursor: sw-resize; - width: 9px; - height: 9px; - left: -5px; - bottom: -5px; -} -.gj-resizable-nw { - cursor: nw-resize; - width: 9px; - height: 9px; - left: -5px; - top: -5px; -} -.gj-resizable-ne { - cursor: ne-resize; - width: 9px; - height: 9px; - right: -5px; - top: -5px; -} - -.gj-dialog-footer { - position: absolute; - bottom: 0px; - width: 100%; - margin-top: 0px; -} - -.gj-modal { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1040; - display: none; - overflow: hidden; - -webkit-overflow-scrolling: touch; - outline: 0; -} - -.gj-content { - border: 1px solid #999; - background-color: #fff; - border-radius: 6px; - outline: 0; -} - -.gj-header { - min-height: 16.43px; - padding: 15px; - border-bottom: 1px solid #e5e5e5; -} - -.gj-footer { - min-height: 16.43px; - padding: 15px; - border-top: 1px solid #e5e5e5; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -.gj-title { - margin: 2px; -} - -.gj-close { - -webkit-appearance: none; - padding: 0; - cursor: pointer; - background: 0 0; - border: 0; - float: right; - font-size: 21px; - color: #000; -} - -.gj-body { - position: relative; - padding: 15px; -} - -/** jQueryUI **/ -div.gj-dialog-ui-header { - padding: 10px; - border-left: 0px; - border-right: 0px; - border-top: 0px; -} -button.gj-dialog-ui-close { - float: right; - width: 24px; - height: 24px; - text-decoration: none; - padding: 0px; -} -h4.gj-dialog-ui-title { - margin: 0; - line-height: 24px; -} -div.gj-dialog-ui-body { - padding: 10px; -} - -/** Material Design **/ -.gj-dialog-mdl-close { - -webkit-appearance: none; - padding: 0; - cursor: pointer; - background: 0 0; - border: 0; - float: right; - font-size: 2.5em; - margin: 24px 24px 0; -} - -.gj-dialog-mdl-content { - background-color: #FFF; -} -DIV.gj-grid-wrapper { - margin: auto; - position: relative; - clear:both; -} - -TABLE.gj-grid-table { - margin: auto; - border-collapse: collapse; - width: 100%; - table-layout: fixed; -} - -TABLE.gj-grid-table THEAD TH [data-role="selectAll"] { - margin: auto; -} - -TABLE.gj-grid-table THEAD TH [data-role="title"] { - display: inline-block; -} - -TABLE.gj-grid-table THEAD TH [data-role="sorticon"] { - display: inline-block; -} - -TABLE.gj-grid-table > thead > tr > th, -TABLE.gj-grid-table > tbody > tr > td { - overflow: hidden; -} - -TABLE.gj-grid-table DIV[data-role="display"], -TABLE.gj-grid-table DIV[data-role="display"] DIV -{ - vertical-align: middle; - text-indent: 0; - display: inline-block; - white-space: pre-wrap; - -ms-word-break: break-word; - word-break: break-word; -} - -TABLE.gj-grid-table .fa { - padding: 2px; -} - -DIV.gj-grid-wrapper DIV.gj-grid-loading-cover -{ - background: #BBBBBB; - opacity: 0.5; - position: absolute; - vertical-align: middle; -} - -DIV.gj-grid-wrapper DIV.gj-grid-loading-text -{ - position: absolute; - font-weight: bold; -} - -.gj-dirty { - position: absolute; - width: 0; - height: 0; - border-style: solid; - border-width: 3px; - border-color: #f00 transparent transparent #f00; - padding: 0; - overflow: hidden; - vertical-align: top; -} - -TABLE.gj-grid-table .gj-grid-icon -{ - margin: 0 2px; - cursor: pointer; - overflow: visible; - width: 16px; - height: 16px; -} - -/* Base Theme */ -.gj-grid-base-table { - border: 1px solid #ddd; - font-family: Helvetica,Arial,sans-serif; - font-size: 14px; -} - -.gj-grid-base-table thead tr th { - background-color: #f5f5f5; - border: 1px solid #ddd; - padding: 2px 1px 2px 1px; -} - -.gj-grid-base-table tbody tr:hover { - background-color: #f5f5f5; -} - -.gj-grid-base-table tbody tr td { - border: 1px solid #ddd; -} - -.gj-grid-base-table tbody tr td div[data-role="display"] { - padding: 3px; -} - -.gj-grid-base-table thead tr th div { - padding: 3px; -} - -div.gj-grid-wrapper div.gj-grid-base-toolbar { - background-color: #f5f5f5; - padding: 5px; - font-weight: bold; - border: 1px solid #ddd; -} - -.gj-grid-base-active { - background-color: #f5f5f5; -} - -.gj-content { - border: 1px solid #999; - background-color: #fff; - border-radius: 6px; - outline: 0; -} - -/* Bootstrap Theme */ -div.gj-grid-wrapper div.gj-grid-bootstrap-toolbar { - background-color: #f5f5f5; - padding: 8px; - font-weight: bold; - border: 1px solid #ddd; -} - -table.gj-grid-bootstrap-table thead th { - background-color: #f5f5f5; - vertical-align:middle; -} - -table.gj-grid-bootstrap-table thead th [data-role="sorticon"] { - margin-left: 5px; -} - -table.gj-grid-bootstrap-table tbody tr td div[data-role="display"] { - padding: 0px; -} - -/* jQuery UI Theme */ -div.gj-grid-wrapper div.gj-grid-ui-toolbar { - border-top: 1px solid menutext; - border-left: 1px solid menutext; - border-right: 1px solid menutext; - border-bottom: 0px; - padding: 2px; - font: 11px Verdana; -} - -TABLE.gj-grid-ui-table { - font: 11px Verdana; - border-left: 1px solid; - border-top: 0px; - border-right: 1px solid; - border-bottom: 0px; - padding: 0px; - border-spacing: 0px; -} - -table.gj-grid-ui-table thead tr th.gj-grid-ui-thead-th { - height: 20px; - padding: 0px; - /*cursor: default;*/ - white-space: normal; - vertical-align: middle; - border: 1px solid; - border-spacing: 0px; - border-collapse: collapse; - border-color: menutext; - text-align: center; - -moz-user-select: none; - -khtml-user-select: none; -} - -table.gj-grid-ui-table thead tr th:first-child { - border-left: 0px; -} - -table.gj-grid-ui-table thead tr th div -{ - padding: 2px; - vertical-align: middle; - display: inline-block; -} - -table.gj-grid-ui-table thead tr th span.gj-grid-ui-thead-th-sort-icon -{ - vertical-align: middle; - display: inline-block; -} - -table.gj-grid-ui-table tbody tr.ui-state-hover -{ - border: 0px; -} - -TABLE.gj-grid-ui-table > tbody > tr > td -{ - padding: 0px; - border-left: 1px solid; - border-top: 0px; - border-right: 0px; - border-bottom: 1px solid; - border-color: menutext; -} - -TABLE.gj-grid-ui-table > tbody > tr > td:first-child -{ - border-left: 0px; -} - -TABLE.gj-grid-table > tbody > tr > td > div -{ - padding: 2px; - overflow: hidden; -} - - -/* Material Design Theme */ -table.mdl-data-table thead th [data-role="sorticon"] { - margin-left: 5px; -} - -table.mdl-data-table thead th [data-role="sorticon"] i.material-icons { - position: absolute; - font-size: 18px; - top: 16px; -} - -.gj-grid-table .gj-grid-mdl-limit-select { - text-align: right; - display: inline-block; - width: 50px; - padding: 0px 5px; - margin-left: 10px; - font-size: 13px; -} - -.gj-grid-table .gj-grid-mdl-page { - text-align: right; - display: inline-block; - width: 32px; - padding: 0px; - font-size: 13px; -} - -.gj-grid-table .gj-grid-mdl-pager-label { - padding: 0px 5px; - font-size: 13px; -} - -table.mdl-data-table tr td { - text-align: left; -} -/* Hide all prioritized columns by default */ -@media only all { - th.display-1120, - td.display-1120, - th.display-960, - td.display-960, - th.display-800, - td.display-800, - th.display-640, - td.display-640, - th.display-480, - td.display-480, - th.display-320, - td.display-320 { - display: none; - } -} - -/* Show at 320px (20em x 16px) */ -@media screen and (min-width: 20em) { - TABLE.gj-grid-table th.display-320, - TABLE.gj-grid-table td.display-320 { - display: table-cell; - } -} -/* Show at 480px (30em x 16px) */ -@media screen and (min-width: 30em) { - TABLE.gj-grid-table th.display-480, - TABLE.gj-grid-table td.display-480 { - display: table-cell; - } -} -/* Show at 640px (40em x 16px) */ -@media screen and (min-width: 40em) { - TABLE.gj-grid-table th.display-640, - TABLE.gj-grid-table td.display-640 { - display: table-cell; - } -} -/* Show at 800px (50em x 16px) */ -@media screen and (min-width: 50em) { - TABLE.gj-grid-table th.display-800, - TABLE.gj-grid-table td.display-800 { - display: table-cell; - } -} -/* Show at 960px (60em x 16px) */ -@media screen and (min-width: 60em) { - TABLE.gj-grid-table th.display-960, - TABLE.gj-grid-table td.display-960 { - display: table-cell; - } -} -/* Show at 1,120px (70em x 16px) */ -@media screen and (min-width: 70em) { - TABLE.gj-grid-table th.display-1120, - TABLE.gj-grid-table td.display-1120 { - display: table-cell; - } -} - -/* Base Theme */ -.gj-grid-base-table tfoot th { - background-color: #f5f5f5; - border: 1px solid #ddd; - padding: 3px; - font-weight: normal; - line-height: 29px; -} - -.gj-grid-base-table tfoot th button { - margin: 0 3px 0 3px; - background-color: #f5f5f5; - border-radius: 4px; - text-decoration: none; - padding: 6px 12px; - border: 1px solid #ddd; - color: #337ab7; - width: 34px; - outline:0; -} - -.gj-grid-base-table tfoot th button.gj-grid-base-active { - background-color: #fff; -} - -.gj-grid-base-table tfoot th input { - margin: 0 5px 0 5px; - width: 26px; - text-align: right; -} - -/* jQuery UI */ -TABLE.gj-grid-table TFOOT TH.ui-grid-pager-cell -{ - height: 20px; - padding: 0px; - cursor: default; - border: 1px solid menutext; - -moz-user-select: none; - -khtml-user-select: none; - user-select: none; -} - -TABLE.gj-grid-table TFOOT DIV.ui-grid-pager -{ - overflow: hidden; -} - -TABLE.gj-grid-table TFOOT INPUT.ui-grid-pager -{ - padding: 1px; - width: 26px; - height: 17px; - font: bold 11px Verdana; - margin: 0 5px; - text-align: right; -} - -TABLE.gj-grid-table TFOOT SELECT.ui-grid-page-sizer -{ - padding: 0px; - height: 17px; - font: bold 11px Verdana; - margin: 0 5px; - text-align: right; - width: 50px; -} - -/* Bootstrap */ -TABLE.gj-grid-table tfoot tr th.gj-grid-bootstrap-tfoot-cell { - line-height: 30px; - background-color: #f5f5f5; -} -.gj-grid-table thead tr th div.gj-grid-column-resizer-wrapper { - position: relative; - width: 100%; - height: 0px; - top: 0px; - left: 0px; - padding: 0px; -} - -span.gj-grid-column-resizer { - position: absolute; - right: 0px; - width: 5px; - top: -100px; - height: 300px; - z-index: 100; - cursor: e-resize; -} - -.gj-grid-resize-cursor { - cursor: e-resize; -} -.gj-grid-table tbody tr.gj-grid-base-top-border td { - border-top: 2px solid #777; -} -.gj-grid-table tbody tr.gj-grid-base-bottom-border td { - border-bottom: 2px solid #777; -} -.gj-grid-base-table thead tr th.gj-grid-base-left-border, -.gj-grid-base-table tbody tr td.gj-grid-base-left-border -{ - border-left: 2px solid #777; -} -.gj-grid-base-table thead tr th.gj-grid-base-right-border, -.gj-grid-base-table tbody tr td.gj-grid-base-right-border -{ - border-right: 2px solid #777; -} -ul.gj-tree-list { - list-style: none; - padding: 0px; - margin: 0px; -} - -li.gj-tree-item { - padding: 0px; -} - -li.gj-tree-item div[data-role="wrapper"] { - display: table; - width: 100%; -} - -li.gj-tree-item [data-role="spacer"] { - display: table-cell; -} - -[data-type="tree"] ul li [data-role="expander"] { - display: table-cell; - vertical-align:middle; - text-align:center; - cursor: pointer; - width: 10px; -} - -li.gj-tree-item [data-role="checkbox"] { - display: table-cell; - vertical-align:middle; - text-align:center; - width: 20px; -} - -li.gj-tree-item [data-role="image"] { - display: table-cell; - vertical-align:middle; - text-align:center; - width: 22px; -} - -li.gj-tree-item [data-role="display"] { - display: table-cell; - vertical-align:middle; - cursor: pointer; - padding: 2px 4px; -} - -.gj-tree-base-active span[data-role="display"] { - background-color: #ddd; -} - -/* Bootstrap Theme */ -ul.gj-tree-bootstrap-list { - padding-left: 0px; - margin-bottom: 0px; -} - -li ul.gj-tree-bootstrap-list { - padding-left: 0px; - width: 100%; -} - -ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item { - border-left: 0px; - border-right: 0px; -} - -ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item:first-child { - border-top-left-radius: 0px; - border-top-right-radius: 0px; -} - -ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item:last-child { - border-bottom: 0px; - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; -} - - -ul.gj-tree-bootstrap-list li [data-role="wrapper"] { - padding: 0px 10px; -} - -ul.gj-tree-bootstrap-list li [data-role="checkbox"] { - width: 24px; - padding-top: 4px; -} - -ul.gj-tree-bootstrap-list li [data-role="image"] { - width: 24px; -} - -ul.gj-tree-bootstrap-list li [data-role="display"] { - padding: 12px 0px 8px 5px; -} -.list-group-item.active ul li, .list-group-item.active:focus ul li, .list-group-item.active:hover ul li { - text-shadow: none; - color:initial; -} - -/* Material Design Theme */ -.gj-tree-mdl-list { - padding: 0px; - list-style-type: none; -} - -.gj-tree-mdl-item { - display: list-item; - list-style-type: none; - padding: 4px 0px 4px 0px; - min-height: unset; -} - -li.gj-tree-mdl-item [data-role="checkbox"] { - height: 24px; - width: 24px; -} - -li.gj-tree-mdl-item [data-role="image"] { - height: 24px; - width: 24px; -} - -.gj-tree-mdl-active { - background: #b3d4fc; -} - -[data-type="tree"] ul li [data-role="expander"].gj-tree-material-icons-expander { - height: 24px; - width: 24px; -} - -[data-type="tree"] ul li [data-role="expander"].gj-tree-font-awesome-expander { - width: 24px; -} - -[data-type="tree"] ul li [data-role="expander"].gj-tree-glyphicons-expander { - width: 24px; -} -.gj-tree-drop-above { - border-top: 1px solid #000; -} - -.gj-tree-drop-below { - border-bottom: 1px solid #000; -} - -.gj-tree-drag-el { - padding: 0px; - margin: 0px; -} - -.gj-tree-drag-el li { - padding: 0px; - margin: 0px; -} - -.gj-tree-drag-el [data-role="wrapper"] { - cursor: move; - display: table; -} - -.gj-tree-drag-el [data-role="indicator"] { - width: 14px; - padding: 0px 3px; - display: table-cell; - vertical-align: middle; - text-align: center; -} - -.gj-tree-bootstrap-drag-el [data-role="indicator"] { - width: 24px; - height: 24px; - padding: 0px; -} - -.gj-tree-mdl-drag-el [data-role="indicator"] { - width: 24px; - height: 24px; - padding: 0px; -} -.gj-checkbox-bootstrap { - min-width: 0; - font-size: 0; - font-weight: normal; - margin: 0px; - text-align: center; - width: 18px; - height: 18px; -} - -.gj-checkbox-bootstrap input[type="checkbox"] { - display: none; - margin-bottom: -12px; -} - -.gj-checkbox-bootstrap span { - background: #fff; - display: block; - content: " "; - width: 18px; - height: 18px; - line-height: 11px; - font-size: 11px; - padding: 2px; - margin-right: 4px; - color: #555555; - border: 1px solid #cccccc; - border-radius: 3px; - transition: box-shadow 0.2s linear, border-color 0.2s linear; - cursor: pointer; -} - -.gj-checkbox-bootstrap input[type="checkbox"]:focus + span:before { - outline: 0; - box-shadow: 0 0 0 0 #66afe9, 0 0 6px rgba(102, 175, 233, .6); - border-color: #66afe9; -} - -.gj-checkbox-bootstrap input[type="checkbox"]:checked + span:before { - display: inline-block; - font-family: 'Glyphicons Halflings'; - content: "\e013 "; -} - -.gj-checkbox-bootstrap input[type="checkbox"]:indeterminate + span:before { - display: inline-block; - font-family: 'Glyphicons Halflings'; - content: "\2212 "; -} - -.gj-checkbox-bootstrap input[type="checkbox"][disabled] + span { - opacity: 0.6; - cursor: not-allowed; -} - -.gj-checkbox-bootstrap input[type="checkbox"][disabled] + span:before { - background: #eee; - border: 1px solid #ccc; - color: #888; -} - -.gj-checkbox-md { - min-width: 0; - font-size: 0; - font-weight: normal; - margin: 0px; - text-align: center; - width: 16px; - height: 16px; - position: relative; -} - -.gj-checkbox-md input[type="checkbox"] { - display: none; - margin-bottom: -12px; -} - -.gj-checkbox-md span { - display: inline-block; - box-sizing: border-box; - width: 16px; - height: 16px; - margin: 0; - cursor: pointer; - overflow: hidden; - border: 2px solid rgba(0,0,0,.54); - border-radius: 2px; - z-index: 2; -} - -.gj-checkbox-md input[type="checkbox"]:checked + span { - border: 2px solid rgb(63,81,181); -} - -.gj-checkbox-md input[type="checkbox"]:checked + span::after { - content: "\E876"; - font-size: 14px; - background-color: rgb(63,81,181); - font-weight: bold; - color: #FFF; - white-space: pre; - position: absolute; - left: 1px; - top: -15px; -} - -.gj-checkbox-md input[type="checkbox"]:indeterminate + span { - border: 2px solid rgb(63,81,181); -} - -.gj-checkbox-md input[type="checkbox"]:indeterminate + span:after { - content: "\E15B"; - font-size: 14px; - background-color: rgb(63,81,181); - font-weight: bold; - color: #FFF; - white-space: pre; - position: absolute; - left: 1px; - top: -15px; -} - -.gj-checkbox-md input[type="checkbox"][disabled] + span { - background-color: rgba(0,0,0,.54); - border: 2px solid rgba(0,0,0,.54); -} - -.gj-checkbox-md input[type="checkbox"][disabled] + span:after { - background-color: rgba(0,0,0,.54); -} - diff --git a/dist/gijgo/1.3.1-pre-release/css/gijgo.min.css b/dist/gijgo/1.3.1-pre-release/css/gijgo.min.css deleted file mode 100644 index eaa76f70..00000000 --- a/dist/gijgo/1.3.1-pre-release/css/gijgo.min.css +++ /dev/null @@ -1 +0,0 @@ -.gj-button,.gj-cursor-pointer{cursor:pointer}.gj-button{background-color:#f5f5f5;border:1px solid #ddd;color:#000;border-radius:3px;padding:6px 10px}.gj-footer,.gj-header{min-height:16.43px;padding:15px}.gj-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.gj-margin-left-5{margin-left:5px}.gj-margin-left-10{margin-left:10px}.gj-width-full{width:100%}.gj-text-align-center{text-align:center}.gj-font-size-16{font-size:16px}.gj-hidden{display:none}.gj-mdl-icon-plus::after{content:"\E145"}.gj-mdl-icon-minus::after{content:"\E15B"}.gj-draggable{cursor:move}.gj-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none;z-index:90}.gj-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.gj-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.gj-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.gj-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.gj-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.gj-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.gj-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.gj-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.gj-dialog-footer{position:absolute;bottom:0;width:100%;margin-top:0}.gj-modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.gj-dirty,TABLE.gj-grid-table>tbody>tr>td,TABLE.gj-grid-table>thead>tr>th{overflow:hidden}.gj-header{border-bottom:1px solid #e5e5e5}.gj-footer{border-top:1px solid #e5e5e5;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.gj-close,.gj-dialog-mdl-close{-webkit-appearance:none;background:0 0;border:0;float:right;cursor:pointer}.gj-title{margin:2px}.gj-close{padding:0;font-size:21px;color:#000}.gj-body{position:relative;padding:15px}div.gj-dialog-ui-header{padding:10px;border-left:0;border-right:0;border-top:0}button.gj-dialog-ui-close{float:right;width:24px;height:24px;text-decoration:none;padding:0}h4.gj-dialog-ui-title{margin:0;line-height:24px}div.gj-dialog-ui-body{padding:10px}.gj-dialog-mdl-close{padding:0;font-size:2.5em;margin:24px 24px 0}.gj-dialog-mdl-content{background-color:#FFF}DIV.gj-grid-wrapper{margin:auto;position:relative;clear:both}TABLE.gj-grid-table{margin:auto;border-collapse:collapse;width:100%;table-layout:fixed}TABLE.gj-grid-table THEAD TH [data-role=selectAll]{margin:auto}TABLE.gj-grid-table THEAD TH [data-role=title],TABLE.gj-grid-table THEAD TH [data-role=sorticon]{display:inline-block}TABLE.gj-grid-table DIV[data-role=display],TABLE.gj-grid-table DIV[data-role=display] DIV{vertical-align:middle;text-indent:0;display:inline-block;white-space:pre-wrap;-ms-word-break:break-word;word-break:break-word}TABLE.gj-grid-table .fa{padding:2px}DIV.gj-grid-wrapper DIV.gj-grid-loading-cover{background:#BBB;opacity:.5;position:absolute;vertical-align:middle}.gj-grid-base-active,.gj-grid-base-table tbody tr:hover,.gj-grid-base-table thead tr th{background-color:#f5f5f5}DIV.gj-grid-wrapper DIV.gj-grid-loading-text{position:absolute;font-weight:700}.gj-dirty{position:absolute;width:0;height:0;border-style:solid;border-width:3px;border-color:red transparent transparent red;padding:0;vertical-align:top}TABLE.gj-grid-table .gj-grid-icon{margin:0 2px;cursor:pointer;overflow:visible;width:16px;height:16px}table.gj-grid-bootstrap-table thead th [data-role=sorticon],table.mdl-data-table thead th [data-role=sorticon]{margin-left:5px}.gj-grid-base-table{border:1px solid #ddd;font-family:Helvetica,Arial,sans-serif;font-size:14px}.gj-grid-base-table thead tr th{border:1px solid #ddd;padding:2px 1px}.gj-grid-base-table tbody tr td{border:1px solid #ddd}.gj-grid-base-table tbody tr td div[data-role=display],.gj-grid-base-table thead tr th div{padding:3px}div.gj-grid-wrapper div.gj-grid-base-toolbar{background-color:#f5f5f5;padding:5px;font-weight:700;border:1px solid #ddd}.gj-content{border:1px solid #999;background-color:#fff;border-radius:6px;outline:0}div.gj-grid-wrapper div.gj-grid-bootstrap-toolbar{background-color:#f5f5f5;padding:8px;font-weight:700;border:1px solid #ddd}table.gj-grid-bootstrap-table thead th{background-color:#f5f5f5;vertical-align:middle}table.gj-grid-bootstrap-table tbody tr td div[data-role=display]{padding:0}div.gj-grid-wrapper div.gj-grid-ui-toolbar{border-top:1px solid menutext;border-left:1px solid menutext;border-right:1px solid menutext;border-bottom:0;padding:2px;font:11px Verdana}TABLE.gj-grid-ui-table{font:11px Verdana;border-left:1px solid;border-top:0;border-right:1px solid;border-bottom:0;padding:0;border-spacing:0}table.gj-grid-ui-table thead tr th.gj-grid-ui-thead-th{height:20px;padding:0;white-space:normal;vertical-align:middle;border:1px solid menutext;border-spacing:0;border-collapse:collapse;text-align:center;-moz-user-select:none;-khtml-user-select:none}table.gj-grid-ui-table thead tr th:first-child{border-left:0}table.gj-grid-ui-table thead tr th div{padding:2px;vertical-align:middle;display:inline-block}table.gj-grid-ui-table thead tr th span.gj-grid-ui-thead-th-sort-icon{vertical-align:middle;display:inline-block}table.gj-grid-ui-table tbody tr.ui-state-hover{border:0}TABLE.gj-grid-ui-table>tbody>tr>td{padding:0;border-left:1px solid;border-top:0;border-right:0;border-bottom:1px solid;border-color:menutext}TABLE.gj-grid-ui-table>tbody>tr>td:first-child{border-left:0}TABLE.gj-grid-table>tbody>tr>td>div{padding:2px;overflow:hidden}table.mdl-data-table thead th [data-role=sorticon] i.material-icons{position:absolute;font-size:18px;top:16px}.gj-grid-table .gj-grid-mdl-limit-select{text-align:right;display:inline-block;width:50px;padding:0 5px;margin-left:10px;font-size:13px}.gj-grid-table .gj-grid-mdl-page{text-align:right;display:inline-block;width:32px;padding:0;font-size:13px}.gj-grid-table .gj-grid-mdl-pager-label{padding:0 5px;font-size:13px}table.mdl-data-table tr td{text-align:left}@media only all{td.display-1120,td.display-320,td.display-480,td.display-640,td.display-800,td.display-960,th.display-1120,th.display-320,th.display-480,th.display-640,th.display-800,th.display-960{display:none}}@media screen and (min-width:20em){TABLE.gj-grid-table td.display-320,TABLE.gj-grid-table th.display-320{display:table-cell}}@media screen and (min-width:30em){TABLE.gj-grid-table td.display-480,TABLE.gj-grid-table th.display-480{display:table-cell}}@media screen and (min-width:40em){TABLE.gj-grid-table td.display-640,TABLE.gj-grid-table th.display-640{display:table-cell}}@media screen and (min-width:50em){TABLE.gj-grid-table td.display-800,TABLE.gj-grid-table th.display-800{display:table-cell}}@media screen and (min-width:60em){TABLE.gj-grid-table td.display-960,TABLE.gj-grid-table th.display-960{display:table-cell}}@media screen and (min-width:70em){TABLE.gj-grid-table td.display-1120,TABLE.gj-grid-table th.display-1120{display:table-cell}}.gj-grid-base-table tfoot th{background-color:#f5f5f5;border:1px solid #ddd;padding:3px;font-weight:400;line-height:29px}.gj-grid-base-table tfoot th button{margin:0 3px;background-color:#f5f5f5;border-radius:4px;text-decoration:none;padding:6px 12px;border:1px solid #ddd;color:#337ab7;width:34px;outline:0}.gj-grid-base-table tfoot th button.gj-grid-base-active{background-color:#fff}.gj-grid-base-table tfoot th input{margin:0 5px;width:26px;text-align:right}TABLE.gj-grid-table TFOOT TH.ui-grid-pager-cell{height:20px;padding:0;cursor:default;border:1px solid menutext;-moz-user-select:none;-khtml-user-select:none;user-select:none}TABLE.gj-grid-table TFOOT DIV.ui-grid-pager{overflow:hidden}TABLE.gj-grid-table TFOOT INPUT.ui-grid-pager{padding:1px;width:26px;height:17px;font:700 11px Verdana;margin:0 5px;text-align:right}TABLE.gj-grid-table TFOOT SELECT.ui-grid-page-sizer{padding:0;height:17px;font:700 11px Verdana;margin:0 5px;text-align:right;width:50px}TABLE.gj-grid-table tfoot tr th.gj-grid-bootstrap-tfoot-cell{line-height:30px;background-color:#f5f5f5}.gj-grid-table thead tr th div.gj-grid-column-resizer-wrapper{position:relative;width:100%;height:0;top:0;left:0;padding:0}span.gj-grid-column-resizer{position:absolute;right:0;width:5px;top:-100px;height:300px;z-index:100;cursor:e-resize}.gj-grid-resize-cursor{cursor:e-resize}.gj-grid-table tbody tr.gj-grid-base-top-border td{border-top:2px solid #777}.gj-grid-table tbody tr.gj-grid-base-bottom-border td{border-bottom:2px solid #777}.gj-grid-base-table tbody tr td.gj-grid-base-left-border,.gj-grid-base-table thead tr th.gj-grid-base-left-border{border-left:2px solid #777}.gj-grid-base-table tbody tr td.gj-grid-base-right-border,.gj-grid-base-table thead tr th.gj-grid-base-right-border{border-right:2px solid #777}ul.gj-tree-list{list-style:none;padding:0;margin:0}li.gj-tree-item{padding:0}li.gj-tree-item div[data-role=wrapper]{display:table;width:100%}li.gj-tree-item [data-role=spacer]{display:table-cell}[data-type=tree] ul li [data-role=expander]{display:table-cell;vertical-align:middle;text-align:center;cursor:pointer;width:10px}li.gj-tree-item [data-role=checkbox]{display:table-cell;vertical-align:middle;text-align:center;width:20px}li.gj-tree-item [data-role=image]{display:table-cell;vertical-align:middle;text-align:center;width:22px}li.gj-tree-item [data-role=display]{display:table-cell;vertical-align:middle;cursor:pointer;padding:2px 4px}.gj-tree-base-active span[data-role=display]{background-color:#ddd}ul.gj-tree-bootstrap-list{padding-left:0;margin-bottom:0}li ul.gj-tree-bootstrap-list{padding-left:0;width:100%}ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item{border-left:0;border-right:0}ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item:first-child{border-top-left-radius:0;border-top-right-radius:0}ul.gj-tree-bootstrap-list li.gj-tree-item ul li.gj-tree-item:last-child{border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}ul.gj-tree-bootstrap-list li [data-role=wrapper]{padding:0 10px}ul.gj-tree-bootstrap-list li [data-role=checkbox]{width:24px;padding-top:4px}ul.gj-tree-bootstrap-list li [data-role=image]{width:24px}ul.gj-tree-bootstrap-list li [data-role=display]{padding:12px 0 8px 5px}.list-group-item.active ul li,.list-group-item.active:focus ul li,.list-group-item.active:hover ul li{text-shadow:none;color:initial}.gj-tree-mdl-list{padding:0;list-style-type:none}.gj-tree-mdl-item{display:list-item;list-style-type:none;padding:4px 0;min-height:unset}li.gj-tree-mdl-item [data-role=checkbox],li.gj-tree-mdl-item [data-role=image]{height:24px;width:24px}.gj-tree-mdl-active{background:#b3d4fc}[data-type=tree] ul li [data-role=expander].gj-tree-material-icons-expander{height:24px;width:24px}[data-type=tree] ul li [data-role=expander].gj-tree-font-awesome-expander,[data-type=tree] ul li [data-role=expander].gj-tree-glyphicons-expander{width:24px}.gj-tree-drop-above{border-top:1px solid #000}.gj-tree-drop-below{border-bottom:1px solid #000}.gj-tree-drag-el,.gj-tree-drag-el li{padding:0;margin:0}.gj-tree-drag-el [data-role=wrapper]{cursor:move;display:table}.gj-tree-drag-el [data-role=indicator]{width:14px;padding:0 3px;display:table-cell;vertical-align:middle;text-align:center}.gj-tree-bootstrap-drag-el [data-role=indicator],.gj-tree-mdl-drag-el [data-role=indicator]{width:24px;height:24px;padding:0}.gj-checkbox-bootstrap{min-width:0;font-size:0;font-weight:400;margin:0;text-align:center;width:18px;height:18px}.gj-checkbox-bootstrap input[type=checkbox]{display:none;margin-bottom:-12px}.gj-checkbox-bootstrap span{background:#fff;display:block;content:" ";width:18px;height:18px;line-height:11px;font-size:11px;padding:2px;margin-right:4px;color:#555;border:1px solid #ccc;border-radius:3px;transition:box-shadow .2s linear,border-color .2s linear;cursor:pointer}.gj-checkbox-bootstrap input[type=checkbox]:focus+span:before{outline:0;box-shadow:0 0 0 0 #66afe9,0 0 6px rgba(102,175,233,.6);border-color:#66afe9}.gj-checkbox-bootstrap input[type=checkbox]:checked+span:before{display:inline-block;font-family:'Glyphicons Halflings';content:"\e013 "}.gj-checkbox-bootstrap input[type=checkbox]:indeterminate+span:before{display:inline-block;font-family:'Glyphicons Halflings';content:"\2212 "}.gj-checkbox-bootstrap input[type=checkbox][disabled]+span{opacity:.6;cursor:not-allowed}.gj-checkbox-bootstrap input[type=checkbox][disabled]+span:before{background:#eee;border:1px solid #ccc;color:#888}.gj-checkbox-md{min-width:0;font-size:0;font-weight:400;margin:0;text-align:center;width:16px;height:16px;position:relative}.gj-checkbox-md input[type=checkbox]{display:none;margin-bottom:-12px}.gj-checkbox-md span{display:inline-block;box-sizing:border-box;width:16px;height:16px;margin:0;cursor:pointer;overflow:hidden;border:2px solid rgba(0,0,0,.54);border-radius:2px;z-index:2}.gj-checkbox-md input[type=checkbox]:checked+span,.gj-checkbox-md input[type=checkbox]:indeterminate+span{border:2px solid #3f51b5}.gj-checkbox-md input[type=checkbox]:checked+span::after{content:"\E876";font-size:14px;background-color:#3f51b5;font-weight:700;color:#FFF;white-space:pre;position:absolute;left:1px;top:-15px}.gj-checkbox-md input[type=checkbox]:indeterminate+span:after{content:"\E15B";font-size:14px;background-color:#3f51b5;font-weight:700;color:#FFF;white-space:pre;position:absolute;left:1px;top:-15px}.gj-checkbox-md input[type=checkbox][disabled]+span{background-color:rgba(0,0,0,.54);border:2px solid rgba(0,0,0,.54)}.gj-checkbox-md input[type=checkbox][disabled]+span:after{background-color:rgba(0,0,0,.54)} \ No newline at end of file diff --git a/dist/gijgo/1.3.1-pre-release/js/gijgo.js b/dist/gijgo/1.3.1-pre-release/js/gijgo.js deleted file mode 100644 index 452835e6..00000000 --- a/dist/gijgo/1.3.1-pre-release/js/gijgo.js +++ /dev/null @@ -1,9983 +0,0 @@ -/* - * Gijgo JavaScript Library v1.3.1 - * http://gijgo.com/ - * - * Copyright 2014, 2017 gijgo.com - * Released under the MIT license - */ -if (typeof (gj) === 'undefined') { - gj = {}; -} - -gj.widget = function () { - var self = this; - - self.xhr = null; - - self.generateGUID = function () { - function s4() { - return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - } - return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); - }; - - self.mouseX = function (e) { - if (e) { - if (e.pageX) { - return e.pageX; - } else if (e.clientX) { - return e.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); - } else if (e.touches && e.touches.length) { - return e.touches[0].pageX; - } else if (e.changedTouches && e.changedTouches.length) { - return e.changedTouches[0].pageX; - } else if (e.originalEvent && e.originalEvent.touches && e.originalEvent.touches.length) { - return e.originalEvent.touches[0].pageX; - } else if (e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches.length) { - return e.originalEvent.touches[0].pageX; - } - } - return null; - }; - - self.mouseY = function (e) { - if (e) { - if (e.pageY) { - return e.pageY; - } else if (e.clientY) { - return e.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); - } else if (e.touches && e.touches.length) { - return e.touches[0].pageY; - } else if (e.changedTouches && e.changedTouches.length) { - return e.changedTouches[0].pageY; - } else if (e.originalEvent && e.originalEvent.touches && e.originalEvent.touches.length) { - return e.originalEvent.touches[0].pageY; - } else if (e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches.length) { - return e.originalEvent.touches[0].pageY; - } - } - return null; - }; -}; - -gj.widget.prototype.init = function (jsConfig, type) { - var option, clientConfig, fullConfig; - - clientConfig = $.extend(true, {}, this.getHTMLConfig() || {}); - $.extend(true, clientConfig, jsConfig || {}); - fullConfig = this.getConfig(clientConfig, type); - - this.attr('data-guid', fullConfig.guid); - - this.data(fullConfig); - - // Initialize events configured as options - for (option in fullConfig) { - if (gj[type].events.hasOwnProperty(option)) { - this.on(option, fullConfig[option]); - delete fullConfig[option]; - } - } - - // Initialize all plugins - for (plugin in gj[type].plugins) { - if (gj[type].plugins.hasOwnProperty(plugin)) { - gj[type].plugins[plugin].configure(this, fullConfig, clientConfig); - } - } - - return this; -}; - -gj.widget.prototype.getConfig = function (clientConfig, type) { - var config, uiLibrary, iconsLibrary, plugin; - - config = $.extend(true, {}, gj[type].config.base); - - uiLibrary = clientConfig.hasOwnProperty('uiLibrary') ? clientConfig.uiLibrary : config.uiLibrary; - if (gj[type].config[uiLibrary]) { - $.extend(true, config, gj[type].config[uiLibrary]); - } - - iconsLibrary = clientConfig.hasOwnProperty('iconsLibrary') ? clientConfig.iconsLibrary : config.iconsLibrary; - if (gj[type].config[iconsLibrary]) { - $.extend(true, config, gj[type].config[iconsLibrary]); - } - - for (plugin in gj[type].plugins) { - if (gj[type].plugins.hasOwnProperty(plugin)) { - $.extend(true, config, gj[type].plugins[plugin].config.base); - if (gj[type].plugins[plugin].config[uiLibrary]) { - $.extend(true, config, gj[type].plugins[plugin].config[uiLibrary]); - } - if (gj[type].plugins[plugin].config[iconsLibrary]) { - $.extend(true, config, gj[type].plugins[plugin].config[iconsLibrary]); - } - } - } - - $.extend(true, config, clientConfig); - - if (!config.guid) { - config.guid = this.generateGUID(); - } - - return config; -} - -gj.widget.prototype.getHTMLConfig = function () { - var result = this.data(), - attrs = this[0].attributes; - if (attrs['width']) { - result.width = attrs['width'].nodeValue; - } - if (attrs['height']) { - result.height = attrs['height'].nodeValue; - } - if (attrs['align']) { - result.align = attrs['align'].nodeValue; - } - if (result && result.source) { - result.dataSource = result.source; - delete result.source; - } - return result; -}; - -gj.widget.prototype.createDoneHandler = function () { - var $widget = this; - return function (response) { - if (typeof (response) === 'string' && JSON) { - response = JSON.parse(response); - } - gj[$widget.data('type')].methods.render($widget, response); - }; -}; - -gj.widget.prototype.createErrorHandler = function () { - var $widget = this; - return function (response) { - if (response && response.statusText && response.statusText !== 'abort') { - alert(response.statusText); - } - }; -}; - -gj.widget.prototype.reload = function (params) { - var ajaxOptions, result, data = this.data(), type = this.data('type'); - if (data.dataSource === undefined) { - gj[type].methods.useHtmlDataSource(this, data); - } - $.extend(data.params, params); - if ($.isArray(data.dataSource)) { - result = gj[type].methods.filter(this); - gj[type].methods.render(this, result); - } else if (typeof(data.dataSource) === 'string') { - ajaxOptions = { url: data.dataSource, data: data.params }; - if (this.xhr) { - this.xhr.abort(); - } - this.xhr = $.ajax(ajaxOptions).done(this.createDoneHandler()).fail(this.createErrorHandler()); - } else if (typeof (data.dataSource) === 'object') { - if (!data.dataSource.data) { - data.dataSource.data = {}; - } - $.extend(data.dataSource.data, data.params); - ajaxOptions = $.extend(true, {}, data.dataSource); //clone dataSource object - if (ajaxOptions.dataType === 'json' && typeof(ajaxOptions.data) === 'object') { - ajaxOptions.data = JSON.stringify(ajaxOptions.data); - } - if (!ajaxOptions.success) { - ajaxOptions.success = this.createDoneHandler(); - } - if (!ajaxOptions.error) { - ajaxOptions.error = this.createErrorHandler(); - } - if (this.xhr) { - this.xhr.abort(); - } - this.xhr = $.ajax(ajaxOptions); - } - return this; -} - -gj.documentManager = { - events: {}, - - subscribeForEvent: function (eventName, widgetId, callback) { - if (!gj.documentManager.events[eventName] || gj.documentManager.events[eventName].length === 0) { - gj.documentManager.events[eventName] = [{ widgetId: widgetId, callback: callback }]; - $(document).on(eventName, gj.documentManager.executeCallbacks); - } else if (!gj.documentManager.events[eventName][widgetId]) { - gj.documentManager.events[eventName].push({ widgetId: widgetId, callback: callback }); - } else { - throw "Event " + eventName + " for widget with guid='" + widgetId + "' is already attached."; - } - }, - - executeCallbacks: function (e) { - var callbacks = gj.documentManager.events[e.type]; - if (callbacks) { - for (var i = 0; i < callbacks.length; i++) { - callbacks[i].callback(e); - } - } - }, - - unsubscribeForEvent: function (eventName, widgetId) { - var success = false, - events = gj.documentManager.events[eventName]; - if (events) { - for (var i = 0; i < events.length; i++) { - if (events[i].widgetId === widgetId) { - events.splice(i, 1); - success = true; - if (events.length === 0) { - $(document).off(eventName); - delete gj.documentManager.events[eventName]; - } - } - } - } - if (!success) { - throw 'The "' + eventName + '" for widget with guid="' + widgetId + '" can\'t be removed.'; - } - } -}; -if (typeof (gj.dialog) === 'undefined') { - gj.dialog = { - plugins: {}, - messages: [] - }; -} - -gj.dialog.messages['en-us'] = { - Close: 'Close', - DefaultTitle: 'Dialog' -}; -/* global window alert jQuery */ -/** - * @widget Dialog - * @plugin Base - */ -gj.dialog.config = { - base: { - /** If set to true, the dialog will automatically open upon initialization. - * If false, the dialog will stay hidden until the open() method is called. - * @type boolean - * @default true - * @example True - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - * @example False - * - * - * - */ - autoOpen: true, - - /** Specifies whether the dialog should close when it has focus and the user presses the escape (ESC) key. - * @type boolean - * @default true - * @example True - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - * @example False - * - * - * - */ - closeOnEscape: true, - - /** Specifies whether the dialog should have a close button in right part of dialog header. - * @type boolean - * @default true - * @example True - *
        - *

        Dialog

        - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - *
        - * - * - *
        - *
        - * - * @example False - *
        - *

        Dialog

        - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - *
        - *
        - * - * - *
        - *
        - *
        - * - */ - closeButtonInHeader: true, - - /** If set to true, the dialog will be draggable by the title bar. - * @type boolean - * @default true - * @example True - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - * @example False - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - */ - draggable: true, - - /** The height of the dialog. - * @additionalinfo Support string and number values. The number value sets the height in pixels. - * The only supported string value is "auto" which will allow the dialog height to adjust based on its content. - * @type (number|string) - * @default "auto" - * @example sample - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - */ - height: 'auto', - - /** The language that needs to be in use. - * @type string - * @default 'en-us' - * @example French.Default - * - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - * @example French.Custom - * - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - */ - locale: 'en-us', - - /** The minimum height in pixels to which the dialog can be resized. - * @type number - * @default undefined - * @example sample - *
        The minimum height of this dialog is set to 200 px. Try to resize it for testing.
        - * - */ - minHeight: undefined, - - /** The maximum height in pixels to which the dialog can be resized. - * @type number - * @default undefined - * @example sample - *
        The maximum height of this dialog is set to 300 px. Try to resize it for testing.
        - * - */ - maxHeight: undefined, - - /** The width of the dialog. - * @type number - * @default 300 - * @example Fixed.Width - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - * @example Auto.Width - *
        - * - *
        - * - */ - width: 300, - - /** The minimum width in pixels to which the dialog can be resized. - * @type number - * @default undefined - * @example sample - *
        The minimum width of this dialog is set to 200 px. Try to resize it for testing.
        - * - */ - minWidth: undefined, - - /** The maximum width in pixels to which the dialog can be resized. - * @type number - * @default undefined - * @example sample - *
        The maximum width of this dialog is set to 400 px. Try to resize it for testing.
        - * - */ - maxWidth: undefined, - - /** If set to true, the dialog will have modal behavior. - * Modal dialogs create an overlay below the dialog, but above other page elements and you can't interact with them. - * @type boolean - * @default false - * @example True - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - * @example False - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - */ - modal: false, - - /** If set to true, the dialog will be resizable. - * @type boolean - * @default false - * @example True - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - * @example False - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - */ - resizable: false, - - /** The title of the dialog. Can be also set through the title attribute of the html element. - * @type string - * @default "Dialog" - * @example Js.Config - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - * @example Html.Config - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - */ - title: undefined, - - /** The name of the UI library that is going to be in use. Currently we support only jQuery UI, Foundation, Material Design Lite and Bootstrap. - * @additionalinfo The css files for jQuery UI, Foundation, Material Design Lite or Bootstrap should be manually included to the page where the dialog is in use. - * @type string (jqueryui|bootstrap|materialdesign) - * @default undefined - * @example jQueryUI - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - * @example jQueryUI.Theme - * - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - * @example Bootstrap - *
        Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        - * - * @example Material.Design - *
        - *
        - * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - * Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - *
        - *
        - *
        - * - * - *
        - *
        - *
        - * - */ - uiLibrary: undefined, - - style: { - modal: 'gj-modal', - content: 'gj-content', - header: 'gj-header', - headerTitle: 'gj-title gj-unselectable', - headerCloseButton: 'gj-close', - body: 'gj-body', - footer: 'gj-dialog-footer gj-footer' - } - }, - - bootstrap: { - style: { - modal: 'modal', - content: 'modal-content', - header: 'modal-header', - headerTitle: 'modal-title', - headerCloseButton: 'close', - body: 'modal-body', - footer: 'gj-dialog-footer modal-footer' - } - }, - - jqueryui: { - style: { - modal: 'gj-modal', - content: 'ui-widget ui-widget-content gj-dialog-content', - header: 'gj-dialog-ui-header ui-widget-header', - headerTitle: 'gj-dialog-ui-title', - headerCloseButton: 'gj-dialog-ui-close ui-button ui-widget ui-state-default ui-corner-all', - body: 'gj-dialog-ui-body', - footer: 'gj-dialog-footer' - } - }, - - materialdesign: { - style: { - modal: 'gj-modal', - content: 'mdl-dialog gj-dialog-mdl-content', - header: '', - headerTitle: 'mdl-dialog__title gj-unselectable', - headerCloseButton: 'gj-dialog-mdl-close', - body: 'mdl-dialog__content', - footer: 'gj-dialog-footer' - } - } -}; -/** - * @widget Dialog - * @plugin Base - */ -gj.dialog.events = { - /** - * Triggered when the dialog is initialized. - * - * @event initialized - * @param {object} e - event data - * @example sample - * - * - * - */ - initialized: function ($dialog) { - $dialog.trigger("initialized"); - }, - - /** - * Triggered before the dialog is opened. - * @event opening - * @param {object} e - event data - * @example sample - * - * - * - */ - opening: function ($dialog) { - $dialog.trigger("opening"); - }, - - /** - * Triggered when the dialog is opened. - * @event opened - * @param {object} e - event data - * @example sample - * - * - * - */ - opened: function ($dialog) { - $dialog.trigger("opened"); - }, - - /** - * Triggered before the dialog is closed. - * @event closing - * @param {object} e - event data - * @example sample - * - * - * - */ - closing: function ($dialog) { - $dialog.trigger("closing"); - }, - - /** - * Triggered when the dialog is closed. - * @event closed - * @param {object} e - event data - * @example sample - * - * - * - */ - closed: function ($dialog) { - $dialog.trigger("closed"); - }, - - /** - * Triggered while the dialog is being dragged. - * @event drag - * @param {object} e - event data - * @example sample - * - *
        - * - */ - drag: function ($dialog) { - $dialog.trigger("drag"); - }, - - /** - * Triggered when the user starts dragging the dialog. - * @event dragStart - * @param {object} e - event data - * @example sample - * - *
        - * - */ - dragStart: function ($dialog) { - $dialog.trigger("dragStart"); - }, - - /** - * Triggered after the dialog has been dragged. - * @event dragStop - * @param {object} e - event data - * @example sample - * - *
        - * - */ - dragStop: function ($dialog) { - $dialog.trigger("dragStop"); - }, - - /** - * Triggered while the dialog is being resized. - * @event resize - * @param {object} e - event data - * @example sample - * - *
        - * - */ - resize: function ($dialog) { - $dialog.trigger("resize"); - }, - - /** - * Triggered when the user starts resizing the dialog. - * @event resizeStart - * @param {object} e - event data - * @example sample - * - *
        - * - */ - resizeStart: function ($dialog) { - $dialog.trigger("resizeStart"); - }, - - /** - * Triggered after the dialog has been resized. - * @event resizeStop - * @param {object} e - event data - * @example sample - * - *
        - * - */ - resizeStop: function ($dialog) { - $dialog.trigger("resizeStop"); - } -}; - -gj.dialog.methods = { - - init: function (jsConfig) { - this.attr('data-type', 'dialog'); - gj.widget.prototype.init.call(this, jsConfig, 'dialog'); - - gj.dialog.methods.localization(this); - gj.dialog.methods.initialize(this); - gj.dialog.events.initialized(this); - return this; - }, - - localization: function($dialog) { - var data = $dialog.data(); - if (typeof (data.title) === 'undefined') { - data.title = gj.dialog.messages[data.locale].DefaultTitle; - } - }, - - getHTMLConfig: function () { - var result = gj.widget.prototype.getHTMLConfig.call(this), - attrs = this[0].attributes; - if (attrs['title']) { - result.title = attrs['title'].nodeValue; - } - return result; - }, - - initialize: function ($dialog) { - var data = $dialog.data(), - $header, $body; - - $dialog.addClass(data.style.content); - - gj.dialog.methods.setSize($dialog); - - if (data.closeOnEscape) { - $(document).keyup(function (e) { - if (e.keyCode === 27) { - $dialog.close(); - } - }); - } - - $body = $dialog.children('div[data-role="body"]'); - if ($body.length === 0) { - $body = $('
        ').addClass(data.style.body); - $dialog.wrapInner($body); - } else { - $body.addClass(data.style.body); - } - - $header = gj.dialog.methods.renderHeader($dialog); - - $dialog.children('div[data-role="footer"]').addClass(data.style.footer); - - $dialog.find('[data-role="close"]').on('click', function () { - $dialog.close(); - }); - - if (data.draggable && $.fn.draggable) { - gj.dialog.methods.draggable($dialog, $header); - } - - if (data.resizable && $.fn.draggable) { - gj.dialog.methods.resizable($dialog); - } - - gj.dialog.methods.setPosition($dialog); - - if (data.modal) { - $dialog.wrapAll('
        '); - } - - if (data.autoOpen) { - $dialog.open(); - } - }, - - setSize: function ($dialog) { - var data = $dialog.data(); - if (data.width) { - $dialog.css("width", data.width); - } - if (data.height) { - $dialog.css("height", data.height); - } - }, - - renderHeader: function ($dialog) { - var $header, $title, $closeButton, data = $dialog.data(); - $header = $dialog.children('div[data-role="header"]'); - if ($header.length === 0) { - $header = $('
        '); - $dialog.prepend($header); - } - $header.addClass(data.style.header); - - $title = $header.find('[data-role="title"]'); - if ($title.length === 0) { - $title = $('

        ' + data.title + '

        '); - $header.append($title); - } - $title.addClass(data.style.headerTitle); - - $closeButton = $header.find('[data-role="close"]'); - if ($closeButton.length === 0 && data.closeButtonInHeader) { - $closeButton = $(''); - $closeButton.addClass(data.style.headerCloseButton); - $header.prepend($closeButton); - } else if ($closeButton.length > 0 && data.closeButtonInHeader === false) { - $closeButton.hide(); - } else { - $closeButton.addClass(data.style.headerCloseButton); - } - - return $header; - }, - - setPosition: function ($dialog) { - var left = ($(window).width() / 2) - ($dialog.width() / 2), - top = ($(window).height() / 2) - ($dialog.height() / 2); - $dialog.css('position', 'absolute'); - $dialog.css('left', left > 0 ? left : 0); - $dialog.css('top', top > 0 ? top : 0); - }, - - draggable: function ($dialog, $header) { - $dialog.appendTo('body'); - $header.addClass('gj-draggable'); - $dialog.draggable({ - handle: $header, - start: function () { - $dialog.addClass('gj-unselectable'); - gj.dialog.events.dragStart($dialog); - }, - stop: function () { - $dialog.removeClass('gj-unselectable'); - gj.dialog.events.dragStop($dialog); - } - }); - }, - - resizable: function ($dialog) { - var config = { - 'drag': gj.dialog.methods.resize, - 'start': function () { - $dialog.addClass('gj-unselectable'); - gj.dialog.events.resizeStart($dialog); - }, - 'stop': function () { - this.removeAttribute('style'); - $dialog.removeClass('gj-unselectable'); - gj.dialog.events.resizeStop($dialog); - } - }; - $dialog.append($('
        ').draggable($.extend(true, { horizontal: false }, config))); - $dialog.append($('
        ').draggable($.extend(true, { vertical: false }, config))); - $dialog.append($('
        ').draggable($.extend(true, { horizontal: false }, config))); - $dialog.append($('
        ').draggable($.extend(true, { vertical: false }, config))); - $dialog.append($('
        ').draggable($.extend(true, {}, config))); - $dialog.append($('
        ').draggable($.extend(true, {}, config))); - $dialog.append($('
        ').draggable($.extend(true, {}, config))); - $dialog.append($('
        ').draggable($.extend(true, {}, config))); - }, - - resize: function (e, offset) { - var $el, $dialog, data, height, width, top, left, result = false; - - $el = $(this); - $dialog = $el.parent(); - data = $dialog.data(); - - //TODO: Include margins in the calculations - if ($el.hasClass('gj-resizable-n')) { - height = $dialog.height() - offset.top; - top = $dialog.offset().top + offset.top; - } else if ($el.hasClass('gj-resizable-e')) { - width = $dialog.width() + offset.left; - } else if ($el.hasClass('gj-resizable-s')) { - height = $dialog.height() + offset.top; - } else if ($el.hasClass('gj-resizable-w')) { - width = $dialog.width() - offset.left; - left = $dialog.offset().left + offset.left; - } else if ($el.hasClass('gj-resizable-ne')) { - height = $dialog.height() - offset.top; - top = $dialog.offset().top + offset.top; - width = $dialog.width() + offset.left; - } else if ($el.hasClass('gj-resizable-nw')) { - height = $dialog.height() - offset.top; - top = $dialog.offset().top + offset.top; - width = $dialog.width() - offset.left; - left = $dialog.offset().left + offset.left; - } else if ($el.hasClass('gj-resizable-se')) { - height = $dialog.height() + offset.top; - width = $dialog.width() + offset.left; - } else if ($el.hasClass('gj-resizable-sw')) { - height = $dialog.height() + offset.top; - width = $dialog.width() - offset.left; - left = $dialog.offset().left + offset.left; - } - - if (height && (!data.minHeight || height >= data.minHeight) && (!data.maxHeight || height <= data.maxHeight)) { - $dialog.height(height); - if (top) { - $dialog.css('top', top); - } - result = true; - } - - if (width && (!data.minWidth || width >= data.minWidth) && (!data.maxWidth || width <= data.maxWidth)) { - $dialog.width(width); - if (left) { - $dialog.css('left', left); - } - result = true; - } - - if (result) { - gj.dialog.events.resize($dialog); - } - - return result; - }, - - open: function ($dialog) { - var $footer; - gj.dialog.events.opening($dialog); - $dialog.css('display', 'block'); - $dialog.closest('div[data-role="modal"]').css('display', 'block'); - $footer = $dialog.children('div[data-role="footer"]'); - if ($footer.length && $footer.outerHeight()) { - $dialog.children('div[data-role="body"]').css('margin-bottom', $footer.outerHeight()); - } - gj.dialog.events.opened($dialog); - return $dialog; - }, - - close: function ($dialog) { - if ($dialog.is(':visible')) { - gj.dialog.events.closing($dialog); - $dialog.css('display', 'none'); - $dialog.closest('div[data-role="modal"]').css('display', 'none'); - gj.dialog.events.closed($dialog); - } - return $dialog; - }, - - isOpen: function ($dialog) { - return $dialog.is(':visible'); - }, - - destroy: function ($dialog, keepHtml) { - var data = $dialog.data(); - if (data) { - if (keepHtml === false) { - $dialog.remove(); - } else { - $dialog.close(); - $dialog.off(); - $dialog.removeData(); - $dialog.removeAttr('data-type'); - $dialog.removeClass(data.style.content); - $dialog.find('[data-role="header"]').removeClass(data.style.header); - $dialog.find('[data-role="title"]').removeClass(data.style.headerTitle); - $dialog.find('[data-role="close"]').remove(); - $dialog.find('[data-role="body"]').removeClass(data.style.body); - $dialog.find('[data-role="footer"]').removeClass(data.style.footer); - } - - } - return $dialog; - } -}; -/** - * @widget Dialog - * @plugin Base - */ -gj.dialog.widget = function ($element, jsConfig) { - var self = this, - methods = gj.dialog.methods; - - /** - * Opens the dialog. - * @method - * @fires opening, opened - * @return dialog - * @example sample - * - * - * - */ - self.open = function () { - return methods.open(this); - } - - /** - * Close the dialog. - * @method - * @fires closinging, closed - * @return dialog - * @example sample - * - * - * - * - */ - self.close = function () { - return methods.close(this); - } - - /** - * Check if the dialog is currently open. - * @method - * @return boolean - * @example sample - * - * - * - * - * - */ - self.isOpen = function () { - return methods.isOpen(this); - } - - /** - * Destroy the dialog. - * @method - * @param {boolean} keepHtml - If this flag is set to false, the dialog html markup will be removed from the HTML dom tree. - * @return void - * @example Keep.HTML.Markup - * - * - * - * - * @example Remove.HTML.Markup - * - * - * - * - */ - self.destroy = function (keepHtml) { - return methods.destroy(this, keepHtml); - } - - $.extend($element, self); - if ('dialog' !== $element.attr('data-type')) { - methods.init.call($element, jsConfig); - } - - return $element; -}; - -gj.dialog.widget.prototype = new gj.widget(); -gj.dialog.widget.constructor = gj.dialog.widget; - -gj.dialog.widget.prototype.getHTMLConfig = gj.dialog.methods.getHTMLConfig; - -(function ($) { - $.fn.dialog = function (method) { - var $widget; - if (this && this.length) { - if (typeof method === 'object' || !method) { - return new gj.dialog.widget(this, method); - } else { - $widget = new gj.dialog.widget(this, null); - if ($widget[method]) { - return $widget[method].apply(this, Array.prototype.slice.call(arguments, 1)); - } else { - throw 'Method ' + method + ' does not exist.'; - } - } - } - }; -})(jQuery); -/* global window alert jQuery */ -/** - * @widget Draggable - * @plugin Base - */ -if (typeof (gj.draggable) === 'undefined') { - gj.draggable = {}; -} - -gj.draggable.config = { - base: { - /** If specified, restricts dragging from starting unless the mousedown occurs on the specified element. - * Only elements that descend from the draggable element are permitted. - * @type jquery element - * @default undefined - * @example sample - * - *
        - *
        Handle for dragging
        - *
        - * - */ - handle: undefined, - - /** If set to false, restricts dragging on vertical direction. - * @type Boolean - * @default true - * @example sample - * - *
        - * drag me
        - * (dragging on vertical direction is disabled) - *
        - * - */ - vertical: true, - - /** If set to false, restricts dragging on horizontal direction. - * @type Boolean - * @default true - * @example sample - * - *
        - * drag me
        - * (dragging on horizontal direction is disabled) - *
        - * - */ - horizontal: true - } -}; - -gj.draggable.methods = { - init: function (jsConfig) { - var $handleEl, $dragEl = this; - - gj.widget.prototype.init.call(this, jsConfig, 'draggable'); - $dragEl.attr('data-draggable', 'true'); - - $handleEl = gj.draggable.methods.getHandleElement($dragEl); - - $handleEl.on('touchstart mousedown', function (e) { - $dragEl.attr('data-draggable-dragging', true); - $dragEl.removeAttr('data-draggable-x').removeAttr('data-draggable-y'); - $dragEl.css('position', 'absolute'); - gj.documentManager.subscribeForEvent('touchmove', $dragEl.data('guid'), gj.draggable.methods.createMoveHandler($dragEl)); - gj.documentManager.subscribeForEvent('mousemove', $dragEl.data('guid'), gj.draggable.methods.createMoveHandler($dragEl)); - }); - - gj.documentManager.subscribeForEvent('mouseup', $dragEl.data('guid'), gj.draggable.methods.createUpHandler($dragEl)); - gj.documentManager.subscribeForEvent('touchend', $dragEl.data('guid'), gj.draggable.methods.createUpHandler($dragEl)); - gj.documentManager.subscribeForEvent('touchcancel', $dragEl.data('guid'), gj.draggable.methods.createUpHandler($dragEl)); - - return $dragEl; - }, - - getHandleElement: function ($dragEl) { - var $handle = $dragEl.data('handle'); - return ($handle && $handle.length) ? $handle : $dragEl; - }, - - createUpHandler: function ($dragEl) { - return function (e) { - if ($dragEl.attr('data-draggable-dragging') === 'true') { - $dragEl.attr('data-draggable-dragging', false); - gj.documentManager.unsubscribeForEvent('mousemove', $dragEl.data('guid')); - gj.documentManager.unsubscribeForEvent('touchmove', $dragEl.data('guid')); - gj.draggable.events.stop($dragEl, { left: $dragEl.mouseX(e), top: $dragEl.mouseY(e) }); - } - }; - }, - - createMoveHandler: function ($dragEl) { - return function (e) { - var x, y, offsetX, offsetY, prevX, prevY; - if ($dragEl.attr('data-draggable-dragging') === 'true') { - x = $dragEl.mouseX(e); - y = $dragEl.mouseY(e); - prevX = $dragEl.attr('data-draggable-x'); - prevY = $dragEl.attr('data-draggable-y'); - if (prevX && prevY) { - offsetX = $dragEl.data('horizontal') ? x - parseInt(prevX, 10) : 0; - offsetY = $dragEl.data('vertical') ? y - parseInt(prevY, 10) : 0; - if (false !== gj.draggable.events.drag($dragEl, offsetX, offsetY, x, y)) { - gj.draggable.methods.move($dragEl, offsetX, offsetY); - } - } else { - gj.draggable.events.start($dragEl, x, y); - } - $dragEl.attr('data-draggable-x', x); - $dragEl.attr('data-draggable-y', y); - } - } - }, - - move: function ($dragEl, offsetX, offsetY) { - var target = $dragEl.get(0), - top = target.style.top ? parseInt(target.style.top) : $dragEl.position().top, - left = target.style.left ? parseInt(target.style.left) : $dragEl.position().left; - target.style.top = (top + offsetY) + 'px'; - target.style.left = (left + offsetX) + 'px'; - }, - - destroy: function ($dragEl) { - if ($dragEl.attr('data-draggable') === 'true') { - gj.documentManager.unsubscribeForEvent('mouseup', $dragEl.data('guid')); - $dragEl.removeData(); - $dragEl.removeAttr('data-guid'); - $dragEl.removeAttr('data-draggable'); - $dragEl.off('drag').off('start').off('stop'); - gj.draggable.methods.getHandleElement($dragEl).off('mousedown'); - } - return $dragEl; - } -}; - -gj.draggable.events = { - /** - * Triggered while the mouse is moved during the dragging, immediately before the current move happens. - * - * @event drag - * @param {object} e - event data - * @param {object} offset - Current offset position as { top, left } object. - * @param {object} mousePosition - Current mouse position as { top, left } object. - * @example sample - * - *
        drag me
        - * - */ - drag: function ($dragEl, offsetX, offsetY, mouseX, mouseY) { - return $dragEl.triggerHandler('drag', [{ top: offsetY, left: offsetX }, { top: mouseY, left: mouseX }]); - }, - - /** - * Triggered when dragging starts. - * - * @event start - * @param {object} e - event data - * @example sample - * - *
        - * drag me - *
        - * - */ - start: function ($dragEl, mouseX, mouseY) { - $dragEl.triggerHandler('start', [{ top: mouseY, left: mouseX }]); - }, - - /** - * Triggered when dragging stops. - * - * @event stop - * @param {object} e - event data - * @param {object} mousePosition - Current mouse position as { top, left } object. - * @example sample - * - *
        - * drag me - *
        - * - */ - stop: function ($dragEl, mousePosition) { - $dragEl.triggerHandler('stop', [mousePosition]); - } -}; - -gj.draggable.widget = function ($element, jsConfig) { - var self = this, - methods = gj.draggable.methods; - - if (!$element.destroy) { - /** Remove draggable functionality from the element. - * @method - * @return jquery element - * @example sample - * - * - *
        Drag Me
        - * - */ - self.destroy = function () { - return methods.destroy(this); - }; - } - - $.extend($element, self); - if ('true' !== $element.attr('data-draggable')) { - methods.init.call($element, jsConfig); - } - - return $element; -}; - -gj.draggable.widget.prototype = new gj.widget(); -gj.draggable.widget.constructor = gj.draggable.widget; - -(function ($) { - $.fn.draggable = function (method) { - var $widget; - if (this && this.length) { - if (typeof method === 'object' || !method) { - return new gj.draggable.widget(this, method); - } else { - $widget = new gj.draggable.widget(this, null); - if ($widget[method]) { - return $widget[method].apply(this, Array.prototype.slice.call(arguments, 1)); - } else { - throw 'Method ' + method + ' does not exist.'; - } - } - } - }; -})(jQuery); -/* global window alert jQuery */ -/** - * @widget Droppable - * @plugin Base - */ -if (typeof (gj.droppable) === 'undefined') { - gj.droppable = {}; -} - -gj.droppable.config = { - /** If specified, the class will be added to the droppable while draggable is being hovered over the droppable. - * @type string - * @default undefined - * @example sample - * - *
        Drop Here
        - *
        Drag Me
        - * - */ - hoverClass: undefined -}; - -gj.droppable.methods = { - init: function (jsConfig) { - var $dropEl = this; - - gj.widget.prototype.init.call(this, jsConfig, 'droppable'); - $dropEl.attr('data-droppable', 'true'); - - gj.documentManager.subscribeForEvent('mousedown', $dropEl.data('guid'), gj.droppable.methods.createMouseDownHandler($dropEl)); - gj.documentManager.subscribeForEvent('mousemove', $dropEl.data('guid'), gj.droppable.methods.createMouseMoveHandler($dropEl)); - gj.documentManager.subscribeForEvent('mouseup', $dropEl.data('guid'), gj.droppable.methods.createMouseUpHandler($dropEl)); - - return $dropEl; - }, - - createMouseDownHandler: function ($dropEl) { - return function (e) { - $dropEl.isDragging = true; - } - }, - - createMouseMoveHandler: function ($dropEl) { - return function (e) { - if ($dropEl.isDragging) { - var hoverClass = $dropEl.data('hoverClass'), - mousePosition = { - left: $dropEl.mouseX(e), - top: $dropEl.mouseY(e) - }, - newIsOver = gj.droppable.methods.isOver($dropEl, mousePosition); - if (newIsOver != $dropEl.isOver) { - if (newIsOver) { - if (hoverClass) { - $dropEl.addClass(hoverClass); - } - gj.droppable.events.over($dropEl, mousePosition); - } else { - if (hoverClass) { - $dropEl.removeClass(hoverClass); - } - gj.droppable.events.out($dropEl); - } - } - $dropEl.isOver = newIsOver; - } - } - }, - - createMouseUpHandler: function ($dropEl) { - return function (e) { - var mousePosition = { - left: $dropEl.mouseX(e), - top: $dropEl.mouseY(e) - }; - $dropEl.isDragging = false; - if (gj.droppable.methods.isOver($dropEl, mousePosition)) { - gj.droppable.events.drop($dropEl); - } - } - }, - - isOver: function ($dropEl, mousePosition) { - var offsetTop = $dropEl.offset().top;// + parseInt($dropEl.css("border-top-width")) + parseInt($dropEl.css("margin-top")) + parseInt($dropEl.css("padding-top")), - offsetLeft = $dropEl.offset().left;// + parseInt($dropEl.css("border-left-width")) + parseInt($dropEl.css("margin-left")) + parseInt($dropEl.css("padding-left")); - return mousePosition.left > offsetLeft && mousePosition.left < (offsetLeft + $dropEl.outerWidth(true)) - && mousePosition.top > offsetTop && mousePosition.top < (offsetTop + $dropEl.outerHeight(true)); - }, - - destroy: function ($dropEl) { - if ($dropEl.attr('data-droppable') === 'true') { - gj.documentManager.unsubscribeForEvent('mousedown', $dropEl.data('guid')); - gj.documentManager.unsubscribeForEvent('mousemove', $dropEl.data('guid')); - gj.documentManager.unsubscribeForEvent('mouseup', $dropEl.data('guid')); - $dropEl.removeData(); - $dropEl.removeAttr('data-guid'); - $dropEl.removeAttr('data-droppable'); - $dropEl.off('drop').off('over').off('out'); - } - return $dropEl; - } -}; - -gj.droppable.events = { - /** Triggered when a draggable element is dropped. - * @event drop - * @param {object} e - event data - * @example sample - * - *
        Drop Here
        - *
        Drag Me
        - * - */ - drop: function ($dropEl, offsetX, offsetY) { - $dropEl.trigger('drop', [{ top: offsetY, left: offsetX }]); - }, - - /** Triggered when a draggable element is dragged over the droppable. - * @event over - * @param {object} e - event data - * @param {object} mousePosition - Current mouse position as { top, left } object. - * @example sample - * - *
        Drop Here
        - *
        Drag Me
        - * - */ - over: function ($dropEl, mousePosition) { - $dropEl.trigger('over', [mousePosition]); - }, - - /** Triggered when a draggable element is dragged out of the droppable. - * @event out - * @param {object} e - event data - * @example sample - * - *
        Drop Here
        - *
        Drag Me
        - * - */ - out: function ($dropEl) { - $dropEl.trigger('out'); - } -}; - -gj.droppable.widget = function ($element, jsConfig) { - var self = this, - methods = gj.droppable.methods; - - self.isOver = false; - self.isDragging = false; - - /** Removes the droppable functionality. - * @method - * @return jquery element - * @example sample - * - * - *

        - * - *
        Drop Here
        - *
        Drag Me
        - * - */ - self.destroy = function () { - return methods.destroy(this); - } - - self.isOver = function (mousePosition) { - return methods.isOver(this, mousePosition); - } - - $.extend($element, self); - if ('true' !== $element.attr('data-droppable')) { - methods.init.apply($element, jsConfig); - } - - return $element; -}; - -gj.droppable.widget.prototype = new gj.widget(); -gj.droppable.widget.constructor = gj.droppable.widget; - -(function ($) { - $.fn.droppable = function (method) { - var $widget; - if (this && this.length) { - if (typeof method === 'object' || !method) { - return new gj.droppable.widget(this, method); - } else { - $widget = new gj.droppable.widget(this, null); - if ($widget[method]) { - return $widget[method].apply(this, Array.prototype.slice.call(arguments, 1)); - } else { - throw 'Method ' + method + ' does not exist.'; - } - } - } - }; -})(jQuery); -if (typeof (gj.grid) === 'undefined') { - gj.grid = { - plugins: {}, - messages: [] - }; -} - -gj.grid.messages['en-us'] = { - First: 'First', - Previous: 'Previous', - Next: 'Next', - Last: 'Last', - Page: 'Page', - FirstPageTooltip: 'First Page', - PreviousPageTooltip: 'Previous Page', - NextPageTooltip: 'Next Page', - LastPageTooltip: 'Last Page', - Refresh: 'Refresh', - Of: 'of', - DisplayingRecords: 'Displaying records', - Edit: 'Edit', - Delete: 'Delete', - Update: 'Update', - Cancel: 'Cancel', - NoRecordsFound: 'No records found.' -}; -/* global window alert jQuery gj */ -/** - * @widget Grid - * @plugin Base - */ -gj.grid.config = { - base: { - /** The data source for the grid. - * @additionalinfo If set to string, then the grid is going to use this string as a url for ajax requests to the server.
        - * If set to object, then the grid is going to use this object as settings for the jquery ajax function.
        - * If set to array, then the grid is going to use the array as data for rows. - * @type (string|object|array) - * @default undefined - * @example Remote.JS.Configuration - *
        - * - * @example Remote.Html.Configuration - * - * - * - * - * - * - * - * - *
        #NamePlaceOfBirth
        - * - * @example Local.DataSource - *
        - * - * @example Html.DataSource - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
        #NamePlace Of Birth
        1Hristo StoichkovPlovdiv, Bulgaria
        2Ronaldo Luis Nazario de LimaRio de Janeiro, Brazil
        3David PlattChadderton, Lancashire, England
        - * - * @example Remote.Custom.Render - *
        - * - * @example Remote.Custom.Error - *
        - * - */ - dataSource: undefined, - - /** An array that holds the configurations of each column from the grid. - * @type array - * @example JS.Configuration - *
        - * - */ - columns: [], - - /** Auto generate column for each field in the datasource when set to true. - * @type array - * @example sample - *
        - * - */ - autoGenerateColumns: false, - - /** An object that holds the default configuration settings of each column from the grid. - * @type object - * @example sample - *
        - * - */ - defaultColumnSettings: { - - /** If set to true the column will not be displayed in the grid. By default all columns are displayed. - * @alias column.hidden - * @type boolean - * @default false - * @example sample - *
        - * - */ - hidden: false, - - /** The width of the column. Numeric values are treated as pixels. - * If the width is undefined the width of the column is not set and depends on the with of the table(grid). - * @alias column.width - * @type number|string - * @default undefined - * @example sample - *
        - * - */ - width: undefined, - - /** Indicates if the column is sortable. - * If set to true the user can click the column header and sort the grid by the column source field. - * @alias column.sortable - * @type boolean|object - * @default false - * @example Remote.Base.Theme - *
        - * - * @example Local.Custom - *
        - * - * @example Remote.Bootstrap.3 - *
        - * - * @example Remote.Bootstrap.4.FontAwesome - *
        - * - * @example Remote.Material.Design - *
        - * - */ - sortable: false, - - /** Indicates the type of the column. - * @alias column.type - * @type checkbox|icon - * @default undefined - * @example sample - *
        - * - */ - type: undefined, - - /** The caption that is going to be displayed in the header of the grid. - * @alias column.title - * @type string - * @default undefined - * @example sample - *
        - * - */ - title: undefined, - - /** The field name to which the column is bound. - * If the column.title is not defined this value is used as column.title. - * @alias column.field - * @type string - * @default undefined - * @example sample - *
        - * - */ - field: undefined, - - /** This setting control the alignment of the text in the cell. - * @alias column.align - * @type left|right|center|justify|initial|inherit - * @default "left" - * @example sample - *
        - * - */ - align: 'left', - - /** The name(s) of css class(es) that are going to be applied to all cells inside that column, except the header cell. - * @alias column.cssClass - * @type string - * @default undefined - * @example sample - *
        - * - * - */ - cssClass: undefined, - - /** The name(s) of css class(es) that are going to be applied to the header cell of that column. - * @alias column.headerCssClass - * @type string - * @default undefined - * @example sample - *
        - * - * - */ - headerCssClass: undefined, - - /** The text for the cell tooltip. - * @alias column.tooltip - * @type string - * @default undefined - * @example sample - *
        - * - */ - tooltip: undefined, - - /** Css class for icon that is going to be in use for the cell. - * This setting can be in use only with combination of type icon. - * @alias column.icon - * @type string - * @default undefined - * @example sample - *
        - * - */ - icon: undefined, - - /** Configuration object with event names as keys and functions as values that are going to be bind to each cell from the column. - * Each function is going to receive event information as a parameter with info in the "data" field for id, field name and record data. - * @alias column.events - * @type object - * @default undefined - * @example javascript.configuration - *
        - * - * @example html.configuration - * - * - * - * - * - * - * - * - * - *
        IDNamePlace Of Birth
        - * - */ - events: undefined, - - /** Format the date when the type of the column is date. - * This configuration setting is going to work only if you have implementation of format method for the Date object. - * You can use external libraries like http://blog.stevenlevithan.com/archives/date-time-format for that. - * @alias column.format - * @type string - * @default undefined - * @example sample - *
        - * - * - * - */ - format: undefined, - - /** Number of decimal digits after the decimal point. - * @alias column.decimalDigits - * @type number - * @default undefined - */ - decimalDigits: undefined, - - /** Template for the content in the column. - * Use curly brackets "{}" to wrap the names of data source columns from server response. - * @alias column.tmpl - * @type string - * @default undefined - * @example sample - *
        - * - */ - tmpl: undefined, - - /** If set to true stop event propagation when event occur. - * @alias column.stopPropagation - * @type boolean - * @default false - * @example sample - *
        - * - */ - stopPropagation: false, - - /** A renderer is an 'interceptor' function which can be used to transform data (value, appearance, etc.) before it is rendered. - * @additionalinfo If the renderer function return a value, then this value is going to be automatically set as value of the cell.
        - * If the renderer function doesn't return a value, then you have to set the content of the cell manually. - * @alias column.renderer - * @type function - * @default undefined - * @param {string} value - the record field value - * @param {object} record - the data of the row record - * @param {object} $cell - the current table cell presented as jquery object - * @param {object} $displayEl - inner div element for display of the cell value presented as jquery object - * @param {string} id - the id of the record - * @example sample - *
        - * - */ - renderer: undefined, - - /** Function which can be used to customize filtering with local data (javascript sourced data). - * @additionalinfo The default filtering is not case sensitive. The filtering with remote data sources needs to be handled on the server. - * @alias column.filter - * @type function - * @default undefined - * @param {string} value - the record field value - * @param {string} searchStr - the search string - * @example example - *   - *   - *

        - *
        - * - */ - filter: undefined - }, - - mapping: { - /** The name of the object in the server response, that contains array with records, that needs to be display in the grid. - * @alias mapping.dataField - * @type string - * @default "records" - */ - dataField: 'records', - - /** The name of the object in the server response, that contains the number of all records on the server. - * @alias mapping.totalRecordsField - * @type string - * @default "total" - */ - totalRecordsField: 'total' - }, - - params: {}, - - paramNames: { - - /** The name of the parameter that is going to send the name of the column for sorting. - * The "sortable" setting for at least one column should be enabled in order this parameter to be in use. - * @alias paramNames.sortBy - * @type string - * @default "sortBy" - */ - sortBy: 'sortBy', - - /** The name of the parameter that is going to send the direction for sorting. - * The "sortable" setting for at least one column should be enabled in order this parameter to be in use. - * @alias paramNames.direction - * @type string - * @default "direction" - */ - direction: 'direction' - }, - - /** The name of the UI library that is going to be in use. Currently we support jQuery UI, Bootstrap and Material Design. - * @additionalinfo The css files for jQuery UI, Bootstrap or Material Design should be manually included to the page where the grid is in use. - * @type (base|jqueryui|bootstrap|bootstrap4|materialdesign) - * @default "base" - * @example base.theme - *
        - * - * @example jqueryui - *
        - * - * @example Bootstrap - *
        - * - * @example Material.Design.With.Icons - *
        - * - * @example Material.Design.Without.Icons - *
        - * - * @example Bootstrap.4.Font.Awesome - *
        - * - */ - uiLibrary: 'base', - - /** The name of the icons library that is going to be in use. Currently we support Material Icons, Font Awesome and Glyphicons. - * @additionalinfo If you use Bootstrap 3 as uiLibrary, then the iconsLibrary is set to Glyphicons by default.
        - * If you use Material Design as uiLibrary, then the iconsLibrary is set to Material Icons by default.
        - * The css files for Material Icons, Font Awesome or Glyphicons should be manually included to the page where the grid is in use. - * @type (materialicons|fontawesome|glyphicons) - * @default undefined - * @example base.theme - *
        - * - */ - iconsLibrary: undefined, - - /** The type of the row selection.
        - * If the type is set to multiple the user will be able to select more then one row from the grid. - * @type (single|multiple) - * @default "single" - * @example Multiple.Checkbox - *
        - * - * @example Single.Checkbox - *
        - * - */ - selectionType: 'single', - - /** The type of the row selection mechanism. - * @additionalinfo If this setting is set to "basic" when the user select a row, then this row will be highlighted.
        - * If this setting is set to "checkbox" a column with checkboxes will appear as first row of the grid and when the user select a row, then this row will be highlighted and the checkbox selected. - * @type (basic|checkbox) - * @default "basic" - * @example sample - *
        - * - */ - selectionMethod: 'basic', - - /** When this setting is enabled the content of the grid will be loaded automatically after the creation of the grid. - * @type boolean - * @default true - * @example disabled - *
        - * - * @example enabled - *
        - * - */ - autoLoad: true, - - /** The text that is going to be displayed if the grid is empty. - * @type string - * @default "No records found." - * @example sample - *
        - * - */ - notFoundText: 'No records found.', - - /** Width of the grid. - * @type number - * @default undefined - * @example sample - *
        - * - */ - width: undefined, - - /** Minimum width of the grid. - * @type number - * @default undefined - */ - minWidth: undefined, - - /** The size of the font in the grid. - * @type string - * @default undefined - * @example sample - *
        - * - */ - fontSize: undefined, - - /** Name of column that contains the record id. - * @additionalinfo If you set primary key, we assume that this number is unique for each records presented in the grid.
        - * For example this should contains the column with primary key from your relation db table.
        - * If the primaryKey is undefined, we autogenerate id for each record in the table by starting from 1. - * @type string - * @default undefined - * @example defined - *
        - * - * @example undefined - *
        - * - */ - primaryKey: undefined, - - /** The language that needs to be in use. - * @type string - * @default 'en-us' - * @example French.Bootstrap.Default - * - *
        - * - * @example French.MaterialDesign.Custom - * - *
        - * - */ - locale: 'en-us', - - defaultIconColumnWidth: 30, - - style: { - wrapper: 'gj-grid-wrapper', - table: 'gj-grid-table gj-grid-base-table', - loadingCover: 'gj-grid-loading-cover', - loadingText: 'gj-grid-loading-text', - header: { - cell: undefined, - sortable: 'gj-cursor-pointer' - }, - content: { - rowHover: undefined, - rowSelected: 'gj-grid-base-active' - } - }, - - icons: { - asc: '▲', - desc: '▼', - expand: '+', - collapse: '-' - } - }, - - jqueryui: { - defaultIconColumnWidth: 24, - style: { - table: 'gj-grid-table ui-widget-content gj-grid-ui-table', - header: { - cell: 'ui-widget-header ui-state-default gj-grid-ui-thead-th', - sortable: 'gj-cursor-pointer', - sortAscIcon: 'gj-grid-ui-thead-th-sort-icon ui-icon ui-icon-arrowthick-1-s', - sortDescIcon: 'gj-grid-ui-thead-th-sort-icon ui-icon ui-icon-arrowthick-1-n' - }, - content: { - rowHover: 'ui-state-hover', - rowSelected: 'ui-state-active' - } - } - }, - - bootstrap: { - style: { - wrapper: 'gj-grid-wrapper', - table: 'gj-grid-table gj-grid-bootstrap-table table table-bordered table-hover', - content: { - rowHover: '', - rowSelected: 'active' - } - }, - - iconsLibrary: 'glyphicons', - - defaultIconColumnWidth: 34 - }, - - bootstrap4: { - style: { - wrapper: 'gj-grid-wrapper', - table: 'gj-grid-table gj-grid-bootstrap-table table table-bordered table-hover', - content: { - rowHover: '', - rowSelected: 'active' - } - }, - - defaultIconColumnWidth: 42 - }, - - materialdesign: { - defaultIconColumnWidth: 70, - style: { - wrapper: 'gj-grid-wrapper', - table: 'gj-grid-table mdl-data-table mdl-js-data-table mdl-shadow--2dp', - content: { - rowHover: '', - rowSelected: 'is-selected' - } - }, - iconsLibrary: 'materialicons' - }, - - materialicons: { - icons: { - asc: 'arrow_upward', - desc: 'arrow_downward', - expand: 'add', - collapse: 'remove' - } - }, - - fontawesome: { - icons: { - asc: '', - desc: '', - expand: '', - collapse: '' - } - }, - - glyphicons: { - icons: { - asc: '', - desc: '', - expand: '', - collapse: '' - } - } -}; - -/** - * @widget Grid - * @plugin Base - */ -gj.grid.events = { - /** - * Event fires before addition of an empty row to the grid. - * @event beforeEmptyRowInsert - * @param {object} e - event data - * @param {object} $row - The empty row as jquery object - * @example sample - *
        - * - */ - beforeEmptyRowInsert: function ($grid, $row) { - $grid.triggerHandler('beforeEmptyRowInsert', [$row]); - }, - - /** - * Event fired before data binding takes place. - * - * @event dataBinding - * @param {object} e - event data - * @param {array} records - the list of records - * @example sample - *
        - * - */ - dataBinding: function ($grid, records) { - $grid.triggerHandler('dataBinding', [records]); - }, - - /** - * Event fires after the loading of the data in the grid. - * - * @event dataBound - * @param {object} e - event data - * @param {array} records - the list of records - * @param {number} totalRecords - the number of the all records that can be presented in the grid - * @example sample - *
        - * - */ - dataBound: function ($grid, records, totalRecords) { - $grid.triggerHandler('dataBound', [records, totalRecords]); - }, - - /** - * Event fires after insert of a row in the grid during the loading of the data. - * @event rowDataBound - * @param {object} e - event data - * @param {object} $row - the row presented as jquery object - * @param {string} id - the id of the record - * @param {object} record - the data of the row record - * @example sample - *
        - * - */ - rowDataBound: function ($grid, $row, id, record) { - $grid.triggerHandler('rowDataBound', [$row, id, record]); - }, - - /** - * Event fires after insert of a cell in the grid during the loading of the data - * - * @event cellDataBound - * @param {object} e - event data - * @param {object} $displayEl - inner div element for display of the cell value presented as jquery object - * @param {string} id - the id of the record - * @param {object} column - the column configuration data - * @param {object} record - the data of the row record - * @example sample - *
        - * - */ - cellDataBound: function ($grid, $displayEl, id, column, record) { - $grid.triggerHandler('cellDataBound', [$displayEl, id, column, record]); - }, - - /** - * Event fires on selection of row - * - * @event rowSelect - * @param {object} e - event data - * @param {object} $row - the row presented as jquery object - * @param {string} id - the id of the record - * @param {object} record - the data of the row record - * @example sample - *
        - * - */ - rowSelect: function ($grid, $row, id, record) { - $grid.triggerHandler('rowSelect', [$row, id, record]); - }, - - /** - * Event fires on un selection of row - * - * @event rowUnselect - * @param {object} e - event data - * @param {object} $row - the row presented as jquery object - * @param {string} id - the id of the record - * @param {object} record - the data of the row record - * @example sample - *
        - * - */ - rowUnselect: function ($grid, $row, id, record) { - $grid.triggerHandler('rowUnselect', [$row, id, record]); - }, - - /** - * Event fires before deletion of row in the grid. - * @event rowRemoving - * @param {object} e - event data - * @param {object} $row - the row presented as jquery object - * @param {string} id - the id of the record - * @param {object} record - the data of the row record - * @example sample - *
        - *
        - * - */ - rowRemoving: function ($grid, $row, id, record) { - $grid.triggerHandler('rowRemoving', [$row, id, record]); - }, - - /** - * Event fires when the grid.destroy method is called. - * - * @event destroying - * @param {object} e - event data - * @example sample - * - *

        - *
        - * - */ - destroying: function ($grid) { - $grid.triggerHandler('destroying'); - }, - - /** - * Event fires when column is hidding - * - * @event columnHide - * @param {object} e - event data - * @param {object} column - The data about the column that is hidding - * @example sample - *
        - * - */ - columnHide: function ($grid, column) { - $grid.triggerHandler('columnHide', [column]); - }, - - /** - * Event fires when column is showing - * - * @event columnShow - * @param {object} e - event data - * @param {object} column - The data about the column that is showing - * @example sample - *
        - * - */ - columnShow: function ($grid, column) { - $grid.triggerHandler('columnShow', [column]); - }, - - /** - * Event fires when grid is initialized. - * - * @event initialized - * @param {object} e - event data - * @example sample - *
        - * - */ - initialized: function ($grid) { - $grid.triggerHandler('initialized'); - }, - - /** - * Event fires when the grid data is filtered. - * - * @additionalinfo This event is firing only when you use local dataSource, because the filtering with remote dataSource needs to be done on the server side. - * @event dataFiltered - * @param {object} e - event data - * @param {object} records - The records after the filtering. - * @example sample - *
        - * - */ - dataFiltered: function ($grid, records) { - $grid.triggerHandler('dataFiltered', [records]); - } -}; - -/*global gj $*/ -gj.grid.methods = { - - init: function (jsConfig) { - this.attr('data-type', 'grid'); - gj.widget.prototype.init.call(this, jsConfig, 'grid'); - - gj.grid.methods.initialize(this); - - if (this.data('autoLoad')) { - this.reload(); - } - return this; - }, - - getConfig: function (jsConfig, type) { - var config = gj.widget.prototype.getConfig.call(this, jsConfig, type); - gj.grid.methods.setDefaultColumnConfig(config.columns, config.defaultColumnSettings); - return config; - }, - - setDefaultColumnConfig: function (columns, defaultColumnSettings) { - var column, i; - if (columns && columns.length) { - for (i = 0; i < columns.length; i++) { - column = $.extend(true, {}, defaultColumnSettings); - $.extend(true, column, columns[i]); - columns[i] = column; - } - } - }, - - getHTMLConfig: function () { - var result = gj.widget.prototype.getHTMLConfig.call(this); - result.columns = []; - this.find('thead > tr > th').each(function () { - var $el = $(this), - title = $el.text(), - config = gj.widget.prototype.getHTMLConfig.call($el); - config.title = title; - if (!config.field) { - config.field = title; - } - if (config.events) { - config.events = gj.grid.methods.eventsParser(config.events); - } - result.columns.push(config); - }); - return result; - }, - - eventsParser: function (events) { - var result = {}, list, i, key, func, position; - list = events.split(','); - for (i = 0; i < list.length; i++) { - position = list[i].indexOf(':'); - if (position > 0) { - key = $.trim(list[i].substr(0, position)); - func = $.trim(list[i].substr(position + 1, list[i].length)); - result[key] = eval('window.' + func); //window[func]; //TODO: eveluate functions from string - } - } - return result; - }, - - initialize: function ($grid) { - var data = $grid.data(), - $wrapper = $grid.parent('div[data-role="wrapper"]'); - - if ($wrapper.length === 0) { - $wrapper = $('
        ').addClass(data.style.wrapper); //The css class needs to be added before the wrapping, otherwise doesn't work. - $grid.wrap($wrapper); - } else { - $wrapper.addClass(data.style.wrapper); - } - - if (data.width) { - $grid.parent().css('width', data.width); - } - if (data.minWidth) { - $grid.css('min-width', data.minWidth); - } - if (data.fontSize) { - $grid.css('font-size', data.fontSize); - } - $grid.addClass(data.style.table); - if ('checkbox' === data.selectionMethod) { - data.columns = [{ - title: '', - field: data.primaryKey || '', - width: data.defaultIconColumnWidth, - align: 'center', - type: 'checkbox', - role: 'selectRow', - events: { - click: function (e) { - gj.grid.methods.setSelected($grid, e.data.id, $(this).closest('tr')); - } - } - }].concat(data.columns); - } - $grid.append($('')); - - gj.grid.methods.renderHeader($grid); - gj.grid.methods.appendEmptyRow($grid, ' '); - gj.grid.events.initialized($grid); - }, - - renderHeader: function ($grid) { - var data, columns, style, $thead, $row, $cell, i, $checkAllBoxes; - - data = $grid.data(); - columns = data.columns; - style = data.style.header; - - $thead = $grid.children('thead'); - if ($thead.length === 0) { - $thead = $(''); - $grid.prepend($thead); - } - - $row = $(''); - for (i = 0; i < columns.length; i += 1) { - $cell = $(''); - if (columns[i].width) { - $cell.attr('width', columns[i].width); - } else if (columns[i].type === 'checkbox') { - $cell.attr('width', data.defaultIconColumnWidth); - } - $cell.addClass(style.cell); - if (columns[i].headerCssClass) { - $cell.addClass(columns[i].headerCssClass); - } - $cell.css('text-align', columns[i].align || 'left'); - if (columns[i].sortable) { - $cell.addClass(style.sortable); - $cell.on('click', gj.grid.methods.createSortHandler($grid, $cell, columns[i])); - } - if ('checkbox' === data.selectionMethod && 'multiple' === data.selectionType && - 'checkbox' === columns[i].type && 'selectRow' === columns[i].role) { - $checkAllBoxes = $cell.find('input[data-role="selectAll"]'); - if ($checkAllBoxes.length === 0) { - $checkAllBoxes = $(''); - $cell.append($checkAllBoxes); - } - $checkAllBoxes.off('click').on('click', function () { - if (this.checked) { - $grid.selectAll(); - } else { - $grid.unSelectAll(); - } - }); - } else { - $cell.append($('
        ').html(typeof (columns[i].title) === 'undefined' ? columns[i].field : columns[i].title)); - } - if (columns[i].hidden) { - $cell.hide(); - } - $row.append($cell); - } - - $thead.empty().append($row); - }, - - createSortHandler: function ($grid, $cell, column) { - return function () { - var data, params = {}; - if ($grid.count() > 0) { - data = $grid.data(); - params[data.paramNames.sortBy] = column.field; - column.direction = (column.direction === 'asc' ? 'desc' : 'asc'); - params[data.paramNames.direction] = column.direction; - $grid.reload(params); - } - }; - }, - - updateHeader: function ($grid) { - var $sortIcon, - data = $grid.data(), - style = data.style.header, - sortBy = data.params[data.paramNames.sortBy], - direction = data.params[data.paramNames.direction]; - - $grid.find('thead tr th [data-role="sorticon"]').remove(); - - if (sortBy) { - position = gj.grid.methods.getColumnPosition($grid.data('columns'), sortBy); - $cell = $grid.find('thead tr th:eq(' + position + ')'); - $sortIcon = $('
        ').append(('desc' === direction) ? data.icons.desc : data.icons.asc); - $cell.append($sortIcon); - } - }, - - useHtmlDataSource: function ($grid, data) { - var dataSource = [], i, j, $cells, record, - $rows = $grid.find('tbody tr[data-role != "empty"]'); - for (i = 0; i < $rows.length; i++) { - $cells = $($rows[i]).find('td'); - record = {}; - for (j = 0; j < $cells.length; j++) { - record[data.columns[j].field] = $($cells[j]).html(); - } - dataSource.push(record); - } - data.dataSource = dataSource; - }, - - startLoading: function ($grid) { - var $tbody, $cover, $loading, width, height, top, data; - gj.grid.methods.stopLoading($grid); - data = $grid.data(); - if (0 === $grid.outerHeight()) { - return; - } - $tbody = $grid.children('tbody'); - width = $tbody.outerWidth(false); - height = $tbody.outerHeight(false); - top = Math.abs($grid.parent().offset().top - $tbody.offset().top); - $cover = $('
        ').addClass(data.style.loadingCover).css({ - width: width, - height: height, - top: top - }); - $loading = $('
        Loading...
        ').addClass(data.style.loadingText); - $loading.insertAfter($grid); - $cover.insertAfter($grid); - $loading.css({ - top: top + (height / 2) - ($loading.outerHeight(false) / 2), - left: (width / 2) - ($loading.outerWidth(false) / 2) - }); - }, - - stopLoading: function ($grid) { - $grid.parent().find('div[data-role="loading-cover"]').remove(); - $grid.parent().find('div[data-role="loading-text"]').remove(); - }, - - createAddRowHoverHandler: function ($row, cssClass) { - return function () { - $row.addClass(cssClass); - }; - }, - - createRemoveRowHoverHandler: function ($row, cssClass) { - return function () { - $row.removeClass(cssClass); - }; - }, - - appendEmptyRow: function ($grid, caption) { - var data, $row, $cell, $wrapper; - data = $grid.data(); - $row = $(''); - $cell = $('').css({ width: '100%', 'text-align': 'center' }); - $cell.attr('colspan', gj.grid.methods.countVisibleColumns($grid)); - $wrapper = $('
        ').html(caption || data.notFoundText); - $cell.append($wrapper); - $row.append($cell); - - gj.grid.events.beforeEmptyRowInsert($grid, $row); - - $grid.append($row); - }, - - autoGenerateColumns: function ($grid, records) { - var names, value, type, i, data = $grid.data(); - data.columns = []; - if (records.length > 0) { - names = Object.getOwnPropertyNames(records[0]); - for (i = 0; i < names.length; i++) { - value = records[0][names[i]]; - type = 'text'; - if (value) { - if (typeof value === 'number') { - type = 'number'; - } else if (value.indexOf('/Date(') > -1) { - type = 'date'; - } - } - data.columns.push({ field: names[i], type: type }); - } - gj.grid.methods.setDefaultColumnConfig(data.columns, data.defaultColumnSettings); - } - gj.grid.methods.renderHeader($grid); - }, - - loadData: function ($grid) { - var data, records, i, recLen, rowCount, $tbody, $rows, $row; - - data = $grid.data(); - records = $grid.getAll(); - gj.grid.events.dataBinding($grid, records); - recLen = records.length; - gj.grid.methods.stopLoading($grid); - - if (data.autoGenerateColumns) { - gj.grid.methods.autoGenerateColumns($grid, records); - } - - $tbody = $grid.find('tbody'); - if ('checkbox' === data.selectionMethod && 'multiple' === data.selectionType) { - $grid.find('thead input[data-role="selectAll"]').prop('checked', false); - } - $tbody.children('tr').not('[data-role="row"]').remove(); - if (0 === recLen) { - $tbody.empty(); - gj.grid.methods.appendEmptyRow($grid); - } - - $rows = $tbody.children('tr'); - - rowCount = $rows.length; - - for (i = 0; i < rowCount; i++) { - if (i < recLen) { - $row = $rows.eq(i); - gj.grid.methods.renderRow($grid, $row, records[i], i); - } else { - $tbody.find('tr[data-role="row"]:gt(' + (i - 1) + ')').remove(); - break; - } - } - - for (i = rowCount; i < recLen; i++) { - gj.grid.methods.renderRow($grid, null, records[i], i); - } - gj.grid.events.dataBound($grid, records, data.totalRecords); - }, - - getId: function (record, primaryKey, position) { - return (primaryKey && record[primaryKey]) ? record[primaryKey] : position; - }, - - renderRow: function ($grid, $row, record, position) { - var id, $cell, i, data, mode; - data = $grid.data(); - if (!$row || $row.length === 0) { - mode = 'create'; - $row = $(''); - $grid.children('tbody').append($row); - $row.on('mouseenter', gj.grid.methods.createAddRowHoverHandler($row, data.style.content.rowHover)); - $row.on('mouseleave', gj.grid.methods.createRemoveRowHoverHandler($row, data.style.content.rowHover)); - } else { - mode = 'update'; - $row.removeClass(data.style.content.rowSelected).removeAttr('data-selected').off('click'); - } - id = gj.grid.methods.getId(record, data.primaryKey, (position + 1)); - $row.attr('data-position', position + 1); - if (data.selectionMethod !== 'checkbox') { - $row.on('click', gj.grid.methods.createRowClickHandler($grid, id)); - } - for (i = 0; i < data.columns.length; i++) { - if (mode === 'update') { - $cell = $row.find('td:eq(' + i + ')'); - gj.grid.methods.renderCell($grid, $cell, data.columns[i], record, id); - } else { - $cell = gj.grid.methods.renderCell($grid, null, data.columns[i], record, id); - $row.append($cell); - } - } - gj.grid.events.rowDataBound($grid, $row, id, record); - }, - - renderCell: function ($grid, $cell, column, record, id, mode) { - var $displayEl, key; - - if (!$cell || $cell.length === 0) { - $cell = $('').css('text-align', column.align || 'left'); - $displayEl = $('
        '); - if (column.cssClass) { - $cell.addClass(column.cssClass); - } - $cell.append($displayEl); - mode = 'create'; - } else { - $displayEl = $cell.find('div[data-role="display"]'); - mode = 'update'; - } - - gj.grid.methods.renderDisplayElement($grid, $displayEl, column, record, id, mode); - - //remove all event handlers - if ('update' === mode) { - $cell.off(); - $displayEl.off(); - } - if (column.events) { - for (key in column.events) { - if (column.events.hasOwnProperty(key)) { - $cell.on(key, { id: id, field: column.field, record: record }, gj.grid.methods.createCellEventHandler(column, column.events[key])); - } - } - } - if (column.hidden) { - $cell.hide(); - } - - gj.grid.events.cellDataBound($grid, $displayEl, id, column, record); - - return $cell; - }, - - createCellEventHandler: function (column, func) { - return function (e) { - if (column.stopPropagation) { - e.stopPropagation(); - } - func.call(this, e); - }; - }, - - renderDisplayElement: function ($grid, $displayEl, column, record, id, mode) { - var text, $checkbox; - - if ('checkbox' === column.type) { - if ('create' === mode) { - $checkbox = $('').attr('type', 'checkbox').val(id); - column.role && $checkbox.attr('data-role', column.role); - $displayEl.append($checkbox); - } else { - $displayEl.find('input[type="checkbox"]').val(id).prop('checked', false); - } - } else if ('icon' === column.type) { - if ('create' === mode) { - $displayEl.append($('') - .addClass($grid.data().uiLibrary === 'bootstrap' ? 'glyphicon' : 'ui-icon') - .addClass(column.icon).css({ cursor: 'pointer' })); - column.stopPropagation = true; - } - } else if (column.tmpl) { - text = column.tmpl; - column.tmpl.replace(/\{(.+?)\}/g, function ($0, $1) { - text = text.replace($0, gj.grid.methods.formatText(record[$1], column)); - }); - $displayEl.html(text); - } else if (column.renderer && typeof (column.renderer) === 'function') { - text = column.renderer(record[column.field], record, $displayEl.parent(), $displayEl, id, $grid); - if (text) { - $displayEl.html(text); - } - } else { - text = gj.grid.methods.formatText(record[column.field], column); - if (!column.tooltip && text) { - $displayEl.attr('title', text); - } - $displayEl.text(text); - } - if (column.tooltip && 'create' === mode) { - $displayEl.attr('title', column.tooltip); - } - }, - - formatText: function (text, column) { - var dt, day, month, parts; - if (text && column.type) { - switch (column.type) { - case 'date': - if (text.indexOf('/Date(') > -1) { - dt = new Date(parseInt(text.substr(6), 10)); - } else { - parts = text.match(/(\d+)/g); - // new Date(year, month, date, hours, minutes, seconds); - dt = new Date(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]); // months are 0-based - } - - if (dt.format && column.format) { - text = dt.format(column.format); //using 3rd party plugin "Date Format 1.2.3 by (c) 2007-2009 Steven Levithan " - } else { - day = dt.getDate().toString().length === 2 ? dt.getDate() : '0' + dt.getDate(); - month = (dt.getMonth() + 1).toString(); - month = month.length === 2 ? month : '0' + month; - text = month + '/' + day + '/' + dt.getFullYear(); - } - break; - } - } else { - text = (typeof (text) === 'undefined' || text === null) ? '' : text.toString(); - } - if (column.decimalDigits && text) { - text = parseFloat(text).toFixed(column.decimalDigits); - } - return text; - }, - - setRecordsData: function ($grid, response) { - var records = [], - totalRecords = 0, - data = $grid.data(); - if ($.isArray(response)) { - records = response; - totalRecords = response.length; - } else if (data && data.mapping && $.isArray(response[data.mapping.dataField])) { - records = response[data.mapping.dataField]; - totalRecords = response[data.mapping.totalRecordsField]; - if (!totalRecords || isNaN(totalRecords)) { - totalRecords = 0; - } - } - $grid.data('records', records); - $grid.data('totalRecords', totalRecords); - return records; - }, - - createRowClickHandler: function ($grid, id) { - return function () { - gj.grid.methods.setSelected($grid, id, $(this)); - }; - }, - - selectRow: function ($grid, data, $row, id) { - var $checkbox; - $row.addClass(data.style.content.rowSelected); - $row.attr('data-selected', 'true'); - if ('checkbox' === data.selectionMethod) { - $checkbox = $row.find('input[type="checkbox"][data-role="selectRow"]'); - $checkbox.length && !$checkbox.prop('checked') && $checkbox.prop('checked', true); - if ('multiple' === data.selectionType && $grid.getSelections().length === $grid.count(false)) { - $grid.find('thead input[data-role="selectAll"]').prop('checked', true); - } - } - gj.grid.events.rowSelect($grid, $row, id, $grid.getById(id)); - }, - - unselectRow: function ($grid, data, $row, id) { - var $checkbox; - if ($row.attr('data-selected') === 'true') { - $row.removeClass(data.style.content.rowSelected); - if ('checkbox' === data.selectionMethod) { - $checkbox = $row.find('td input[type="checkbox"][data-role="selectRow"]'); - $checkbox.length && $checkbox.prop('checked') && $checkbox.prop('checked', false); - if ('multiple' === data.selectionType) { - $grid.find('thead input[data-role="selectAll"]').prop('checked', false); - } - } - $row.removeAttr('data-selected'); - gj.grid.events.rowUnselect($grid, $row, id, $grid.getById(id)); - } - }, - - setSelected: function ($grid, id, $row) { - var data = $grid.data(); - if (!$row || !$row.length) { - $row = gj.grid.methods.getRowById($grid, id); - } - if ($row) { - if ($row.attr('data-selected') === 'true') { - gj.grid.methods.unselectRow($grid, data, $row, id); - } else { - if ('single' === data.selectionType) { - $row.siblings('[data-selected="true"]').each(function () { - var $row = $(this), - id = gj.grid.methods.getId($row, data.primaryKey, $row.data('position')); - gj.grid.methods.unselectRow($grid, data, $row, id); - }); - } - gj.grid.methods.selectRow($grid, data, $row, id); - } - } - return $grid; - }, - - selectAll: function ($grid) { - var data = $grid.data(); - $grid.find('tbody tr[data-role="row"]').each(function () { - var $row = $(this); - gj.grid.methods.selectRow($grid, data, $row, $grid.get($row.data('position'))); - }); - $grid.find('thead input[data-role="selectAll"]').prop('checked', true); - return $grid; - }, - - unSelectAll: function ($grid) { - var data = $grid.data(); - $grid.find('tbody tr').each(function () { - var $row = $(this); - gj.grid.methods.unselectRow($grid, data, $row, $grid.get($row.data('position'))); - $row.find('input[type="checkbox"][data-role="selectRow"]').prop('checked', false); - }); - $grid.find('thead input[data-role="selectAll"]').prop('checked', false); - return $grid; - }, - - getSelected: function ($grid) { - var result = null, selections, record, position; - selections = $grid.find('tbody>tr[data-selected="true"]'); - if (selections.length > 0) { - position = $(selections[0]).data('position'); - record = $grid.get(position); - result = gj.grid.methods.getId(record, $grid.data().primaryKey, position); - } - return result; - }, - - getSelectedRows: function ($grid) { - var data = $grid.data(); - return $grid.find('tbody>tr[data-selected="true"]'); - }, - - getSelections: function ($grid) { - var result = [], position, record, $selections = gj.grid.methods.getSelectedRows($grid); - if (0 < $selections.length) { - $selections.each(function () { - position = $(this).data('position'); - record = $grid.get(position); - result.push(gj.grid.methods.getId(record, $grid.data().primaryKey, position)); - }); - } - return result; - }, - - getById: function ($grid, id) { - var result = null, i, primaryKey = $grid.data('primaryKey'), records = $grid.data('records'); - if (primaryKey) { - for (i = 0; i < records.length; i++) { - if (records[i][primaryKey] == id) { - result = records[i]; - break; - } - } - } else { - result = $grid.get(id); - } - return result; - }, - - getRecVPosById: function ($grid, id) { - var result = id, i, data = $grid.data(); - if (data.primaryKey) { - for (i = 0; i < data.dataSource.length; i++) { - if (data.dataSource[i][data.primaryKey] == id) { - result = i; - break; - } - } - } - return result; - }, - - getRowById: function ($grid, id) { - var records = $grid.getAll(false), - primaryKey = $grid.data('primaryKey'), - $result = undefined, - position, - i; - if (primaryKey) { - for (i = 0; i < records.length; i++) { - if (records[i][primaryKey] == id) { - position = i + 1; - break; - } - } - } else { - position = id; - } - if (position) { - $result = $grid.find('tbody > tr[data-position="' + position + '"]'); - } - return $result; - }, - - getByPosition: function ($grid, position) { - return $grid.getAll(false)[position - 1]; - }, - - getColumnPosition: function (columns, field) { - var position = -1, i; - for (i = 0; i < columns.length; i++) { - if (columns[i].field === field) { - position = i; - break; - } - } - return position; - }, - - getColumnInfo: function ($grid, field) { - var i, result = {}, data = $grid.data(); - for (i = 0; i < data.columns.length; i += 1) { - if (data.columns[i].field === field) { - result = data.columns[i]; - break; - } - } - return result; - }, - - getCell: function ($grid, id, field) { - var position, $row, $result = null; - position = gj.grid.methods.getColumnPosition($grid.data('columns'), field); - if (position > -1) { - $row = gj.grid.methods.getRowById($grid, id); - $result = $row.find('td:eq(' + position + ') div[data-role="display"]'); - } - return $result; - }, - - setCellContent: function ($grid, id, field, value) { - var column, $displayEl = gj.grid.methods.getCell($grid, id, field); - if ($displayEl) { - $displayEl.empty(); - if (typeof (value) === 'object') { - $displayEl.append(value); - } else { - column = gj.grid.methods.getColumnInfo($grid, field); - gj.grid.methods.renderDisplayElement($grid, $displayEl, column, $grid.getById(id), id, 'update'); - } - } - }, - - clone: function (source) { - var target = []; - $.each(source, function () { - target.push(this.clone()); - }); - return target; - }, - - getAll: function ($grid) { - return $grid.data('records'); - }, - - countVisibleColumns: function ($grid) { - var columns, count, i; - columns = $grid.data().columns; - count = 0; - for (i = 0; i < columns.length; i++) { - if (columns[i].hidden !== true) { - count++; - } - } - return count; - }, - - clear: function ($grid, showNotFoundText) { - var data = $grid.data(); - $grid.xhr && $grid.xhr.abort(); - $grid.children('tbody').empty(); - data.records = []; - gj.grid.methods.stopLoading($grid); - gj.grid.methods.appendEmptyRow($grid, showNotFoundText ? data.notFoundText : ' '); - gj.grid.events.dataBound($grid, [], 0); - return $grid; - }, - - render: function ($grid, response) { - if (response) { - gj.grid.methods.setRecordsData($grid, response); - gj.grid.methods.updateHeader($grid); - gj.grid.methods.loadData($grid); - } - return $grid; - }, - - filter: function ($grid) { - var field, column, - data = $grid.data(), - records = data.dataSource.slice(); - - if (data.params[data.paramNames.sortBy]) { - column = gj.grid.methods.getColumnInfo($grid, data.params[data.paramNames.sortBy]); - records.sort(column.sortable.sorter ? column.sortable.sorter(column.direction, column) : gj.grid.methods.createDefaultSorter(column.direction, column.field)); - } - - for (field in data.params) { - if (data.params[field] && !data.paramNames[field]) { - column = gj.grid.methods.getColumnInfo($grid, field); - records = $.grep(records, function (record) { - var value = record[field] || '', - searchStr = data.params[field] || ''; - return column && typeof (column.filter) === 'function' ? column.filter(value, searchStr) : (value.toUpperCase().indexOf(searchStr.toUpperCase()) > -1); - }); - } - } - - gj.grid.events.dataFiltered($grid, records); - - return records; - }, - - createDefaultSorter: function (direction, field) { - return function (recordA, recordB) { - var a = (recordA[field] || '').toString(), - b = (recordB[field] || '').toString(); - return (direction === 'asc') ? a.localeCompare(b) : b.localeCompare(a); - }; - }, - - destroy: function ($grid, keepTableTag, keepWrapperTag) { - var data = $grid.data(); - if (data) { - gj.grid.events.destroying($grid); - gj.grid.methods.stopLoading($grid); - $grid.xhr && $grid.xhr.abort(); - $grid.off(); - if (keepWrapperTag === false && $grid.parent('div[data-role="wrapper"]').length > 0) { - $grid.unwrap(); - } - $grid.removeData(); - if (keepTableTag === false) { - $grid.remove(); - } else { - $grid.removeClass().empty(); - } - $grid.removeAttr('data-type'); - } - return $grid; - }, - - showColumn: function ($grid, field) { - var data = $grid.data(), - position = gj.grid.methods.getColumnPosition(data.columns, field), - $cells; - - if (position > -1) { - $grid.find('thead>tr').each(function() { - $(this).children('th').eq(position).show(); - }); - $.each($grid.find('tbody>tr'), function () { - $(this).children('td').eq(position).show(); - }); - data.columns[position].hidden = false; - - $cells = $grid.find('tbody > tr[data-role="empty"] > td'); - if ($cells && $cells.length) { - $cells.attr('colspan', gj.grid.methods.countVisibleColumns($grid)); - } - - gj.grid.events.columnShow($grid, data.columns[position]); - } - - return $grid; - }, - - hideColumn: function ($grid, field) { - var data = $grid.data(), - position = gj.grid.methods.getColumnPosition(data.columns, field), - $cells; - - if (position > -1) { - $grid.find('thead>tr').each(function () { - $(this).children('th').eq(position).hide(); - }); - $.each($grid.find('tbody>tr'), function () { - $(this).children('td').eq(position).hide(); - }); - data.columns[position].hidden = true; - - $cells = $grid.find('tbody > tr[data-role="empty"] > td'); - if ($cells && $cells.length) { - $cells.attr('colspan', gj.grid.methods.countVisibleColumns($grid)); - } - - gj.grid.events.columnHide($grid, data.columns[position]); - } - - return $grid; - }, - - isLastRecordVisible: function () { - return true; - }, - - addRow: function ($grid, record) { - var data = $grid.data(); - data.totalRecords = $grid.data('totalRecords') + 1; - gj.grid.events.dataBinding($grid, [record]); - data.records.push(record); - if ($.isArray(data.dataSource)) { - data.dataSource.push(record); - } - if (gj.grid.methods.isLastRecordVisible($grid)) { - gj.grid.methods.renderRow($grid, null, record, $grid.count() - 1); - } - gj.grid.events.dataBound($grid, [record], data.totalRecords); - return $grid; - }, - - updateRow: function ($grid, id, record) { - var $row = gj.grid.methods.getRowById($grid, id), - data = $grid.data(), position; - data.records[$row.data('position') - 1] = record; - if ($.isArray(data.dataSource)) { - position = gj.grid.methods.getRecVPosById($grid, id); - data.dataSource[position] = record; - } - gj.grid.methods.renderRow($grid, $row, record, $row.index()); - return $grid; - }, - - removeRow: function ($grid, id) { - var position, - data = $grid.data(), - $row = gj.grid.methods.getRowById($grid, id); - - gj.grid.events.rowRemoving($grid, $row, id, $grid.getById(id)); - if ($.isArray(data.dataSource)) { - position = gj.grid.methods.getRecVPosById($grid, id); - data.dataSource.splice(position, 1); - } - $grid.reload(); - return $grid; - }, - - count: function ($grid, includeAllRecords) { - return includeAllRecords ? $grid.data().totalRecords : $grid.getAll().length; - } -}; - -/** - * @widget Grid - * @plugin Base - */ -gj.grid.widget = function ($grid, jsConfig) { - var self = this, - methods = gj.grid.methods; - - /** - * Reload the data in the grid from a data source. - * @method - * @param {object} params - An object that contains a list with parameters that are going to be send to the server. - * @fires beforeEmptyRowInsert, dataBinding, dataBound, cellDataBound - * @return grid - * @example sample - * - * - *

        - *
        - * - */ - self.reload = function (params) { - methods.startLoading(this); - return gj.widget.prototype.reload.call(this, params); - }; - - /** - * Clear the content in the grid. - * @method - * @param {boolean} showNotFoundText - Indicates if the "Not Found" text is going to show after the clearing of the grid. - * @return grid - * @example sample - * - *

        - *
        - * - */ - self.clear = function (showNotFoundText) { - return methods.clear(this, showNotFoundText); - }; - - /** - * Return the number of records in the grid. By default return only the records that are visible in the grid. - * @method - * @param {boolean} includeAllRecords - include records that are not visible when you are using local dataSource. - * @return number - * @example Local.DataSource - * - * - *

        - *
        - * - * @example Remote.DataSource - * - * - *

        - *
        - * - */ - self.count = function (includeAllRecords) { - return methods.count(this, includeAllRecords); - }; - - /** - * Render data in the grid - * @method - * @param {object} response - An object that contains the data that needs to be loaded in the grid. - * @fires beforeEmptyRowInsert, dataBinding, dataBound, cellDataBound - * @return grid - * @example sample - *
        - * - */ - self.render = function (response) { - return methods.render($grid, response); - }; - - /** - * Destroy the grid. This method remove all data from the grid and all events attached to the grid. - * @additionalinfo The grid table tag and wrapper tag are kept by default after the execution of destroy method, - * but you can remove them if you pass false to the keepTableTag and keepWrapperTag parameters. - * @method - * @param {boolean} keepTableTag - If this flag is set to false, the table tag will be removed from the HTML dom tree. - * @param {boolean} keepWrapperTag - If this flag is set to false, the table wrapper tag will be removed from the HTML dom tree. - * @fires destroying - * @return void - * @example keep.wrapper.and.table - * - * - *

        - *
        - * - * @example remove.wrapper.and.table - * - *

        - *
        - * - */ - self.destroy = function (keepTableTag, keepWrapperTag) { - return methods.destroy(this, keepTableTag, keepWrapperTag); - }; - - /** - * Select a row from the grid based on id parameter. - * @method - * @param {string} id - The id of the row that needs to be selected - * @return grid - * @example sample - * - * - *

        - *
        - * - */ - self.setSelected = function (id) { - return methods.setSelected(this, id); - }; - - /** - * Return the id of the selected record. - * If the multiple selection method is one this method is going to return only the id of the first selected record. - * @method - * @return string - * @example sample - * - *

        - *
        - * - */ - self.getSelected = function () { - return methods.getSelected(this); - }; - - /** - * Return an array with the ids of the selected record. - * @method - * @return array - * @example sample - * - *

        - *
        - * - */ - self.getSelections = function () { - return methods.getSelections(this); - }; - - /** - * Select all records from the grid. - * @method - * @return grid - * @example sample - * - *

        - *
        - * - */ - self.selectAll = function () { - return methods.selectAll(this); - }; - - /** - * Unselect all records from the grid. - * @method - * @return void - * @example sample - * - * - *

        - *
        - * - */ - self.unSelectAll = function () { - return methods.unSelectAll(this); - }; - - /** - * Return record by id of the record. - * @method - * @param {string} id - The id of the row that needs to be returned. - * @return object - * @example sample - * - *

        - *
        - * - */ - self.getById = function (id) { - return methods.getById(this, id); - }; - - /** - * Return record from the grid based on position. - * @method - * @param {number} position - The position of the row that needs to be return. - * @return object - * @example sample - * - *

        - *
        - * - */ - self.get = function (position) { - return methods.getByPosition(this, position); - }; - - /** - * Return an array with all records presented in the grid. - * @method - * @param {boolean} includeAllRecords - include records that are not visible when you are using local dataSource. - * @return number - * @example Local.DataSource - * - * - *

        - *
        - * - * @example Remote.DataSource - * - * - *

        - *
        - * - */ - self.getAll = function (includeAllRecords) { - return methods.getAll(this, includeAllRecords); - }; - - /** - * Show hidden column. - * @method - * @param {string} field - The name of the field bound to the column. - * @return grid - * @example sample - * - *

        - *
        - * - */ - self.showColumn = function (field) { - return methods.showColumn(this, field); - }; - - /** - * Hide column from the grid. - * @method - * @param {string} field - The name of the field bound to the column. - * @return grid - * @example sample - * - *

        - *
        - * - */ - self.hideColumn = function (field) { - return methods.hideColumn(this, field); - }; - - /** - * Add new row to the grid. - * @method - * @param {object} record - Object with data for the new record. - * @return grid - * @example without.pagination - * - *

        - *
        - * - * @example with.pagination - * - *

        - *
        - * - */ - self.addRow = function (record) { - return methods.addRow(this, record); - }; - - /** - * Update row data. - * @method - * @param {string} id - The id of the row that needs to be updated - * @param {object} record - Object with data for the new record. - * @return grid - * @example sample - *
        - * - */ - self.updateRow = function (id, record) { - return methods.updateRow(this, id, record); - }; - - //TODO: needs to be removed - self.setCellContent = function (id, index, value) { - methods.setCellContent(this, id, index, value); - }; - - /** - * Remove row from the grid - * @additionalinfo This method is design to work only with local datasources. If you use remote datasource, you need to send a request to the server to remove the row and then reload the data in the grid. - * @method - * @param {string} id - Id of the record that needs to be removed. - * @return grid - * @example Without.Pagination - *
        - * - * @example With.Pagination - *
        - * - */ - self.removeRow = function (id) { - return methods.removeRow(this, id); - }; - - $.extend($grid, self); - if ('grid' !== $grid.attr('data-type')) { - methods.init.call($grid, jsConfig); - } - - return $grid; -} - -gj.grid.widget.prototype = new gj.widget(); -gj.grid.widget.constructor = gj.grid.widget; - -gj.grid.widget.prototype.getConfig = gj.grid.methods.getConfig; -gj.grid.widget.prototype.getHTMLConfig = gj.grid.methods.getHTMLConfig; - -(function ($) { - $.fn.grid = function (method) { - var $widget; - if (this && this.length) { - if (typeof method === 'object' || !method) { - return new gj.grid.widget(this, method); - } else { - $widget = new gj.grid.widget(this, null); - if ($widget[method]) { - return $widget[method].apply(this, Array.prototype.slice.call(arguments, 1)); - } else { - throw 'Method ' + method + ' does not exist.'; - } - } - } - }; -})(jQuery); - -/** - * @widget Grid - * @plugin Expand Collapse Rows - */ -gj.grid.plugins.expandCollapseRows = { - config: { - base: { - /** Template for the content in the detail section of the row. - * Automatically add expand collapse column as a first column in the grid during initialization. - * @type string - * @default undefined - * @example Base.Theme - *
        - * - * @example Bootstrap.3 - *
        - * - * @example Bootstrap.4.Font.Awesome - *
        - * - * @example Material.Design - *
        - * - */ - detailTemplate: undefined, - - /** If set try to persist the state of expanded rows. - * You need to specify primaryKey on the initialization of the grid in order to enable this feature. - * @default true - * @example True - *
        - *
        - *
        - *

        Expand row, then change the page and return back to the page with expanded row in order to see that the expansion is kept.

        - *
        - *
        - *
        - *
        - * - */ - keepExpandedRows: true - } - }, - - 'private': { - detailExpand: function ($grid, $cell) { - var $contentRow = $cell.closest('tr'), - $detailsRow = $(''), - $detailsCell = $(''), - $detailsWrapper = $('
        '), - data = $grid.data(), - position = $contentRow.data('position'), - record = $grid.get(position), - id = gj.grid.methods.getId(record, data.primaryKey, record); - - $detailsRow.append($detailsCell.append($detailsWrapper.append($contentRow.data('details')))); - $detailsRow.insertAfter($contentRow); - $cell.children('div[data-role="display"]').empty().append(data.icons.collapse); - $grid.updateDetails($contentRow); - gj.grid.plugins.expandCollapseRows.events.detailExpand($grid, $detailsRow.find('td>div'), id); - }, - - detailCollapse: function ($grid, $cell) { - var $contentRow = $cell.closest('tr'), - $detailsRow = $contentRow.next('tr[data-role="details"]'), - data = $grid.data(), - id = gj.grid.methods.getId($contentRow, data.primaryKey, $contentRow.data('position')); - $detailsRow.remove(); - $cell.children('div[data-role="display"]').empty().append(data.icons.expand); - gj.grid.plugins.expandCollapseRows.events.detailCollapse($grid, $detailsRow.find('td>div'), id); - }, - - keepSelection: function($grid, id) { - var data = $grid.data(); - if (data.keepExpandedRows) { - if ($.isArray(data.expandedRows)) { - if (data.expandedRows.indexOf(id) == -1) { - data.expandedRows.push(id) - } - } else { - data.expandedRows = [id]; - } - } - }, - - removeSelection: function ($grid, id) { - var data = $grid.data(); - if (data.keepExpandedRows && $.isArray(data.expandedRows) && data.expandedRows.indexOf(id) > -1) { - data.expandedRows.splice(data.expandedRows.indexOf(id), 1); - } - }, - - updateDetailsColSpan: function ($grid) { - var $cells = $grid.find('tbody > tr[data-role="details"] > td'); - if ($cells && $cells.length) { - $cells.attr('colspan', gj.grid.methods.countVisibleColumns($grid)); - } - } - }, - - 'public': { - //TODO: add documentation - collapseAll: function () { - var $grid = this; - $grid.find('tbody tr[data-role="row"]').each(function () { - gj.grid.plugins.expandCollapseRows.private.detailCollapse($grid, $(this).find('td').first()); - }); - }, - - //TODO: add documentation - expandAll: function () { - var $grid = this; - $grid.find('tbody tr[data-role="row"]').each(function () { - gj.grid.plugins.expandCollapseRows.private.detailExpand($grid, $(this).find('td').first()); - }); - }, - - //TODO: add documentation - updateDetails: function ($contentRow) { - var $grid = this, - $detailWrapper = $contentRow.data('details'), - content = $detailWrapper.html(), - record = $grid.get($contentRow.data('position')); - - $detailWrapper.html().replace(/\{(.+?)\}/g, function ($0, $1) { - var column = gj.grid.methods.getColumnInfo($grid, $1); - content = content.replace($0, gj.grid.methods.formatText(record[$1], column)); - }); - $detailWrapper.html(content); - } - }, - - 'events': { - /** - * Event fires when detail row is showing - * - * @event detailExpand - * @param {object} e - event data - * @param {object} detailWrapper - the detail wrapper as jQuery object - * @param {string} id - the id of the record - * @example sample - *
        - * - */ - detailExpand: function ($grid, $detailWrapper, id) { - $grid.triggerHandler('detailExpand', [$detailWrapper, id]); - }, - - /** - * Event fires when detail row is hiding - * - * @event detailCollapse - * @param {object} e - event data - * @param {object} detailWrapper - the detail wrapper as jQuery object - * @param {string} id - the id of the record - * @example sample - *
        - * - */ - detailCollapse: function ($grid, $detailWrapper, id) { - $grid.triggerHandler('detailCollapse', [$detailWrapper, id]); - } - }, - - 'configure': function ($grid) { - var column, data = $grid.data(); - - $.extend(true, $grid, gj.grid.plugins.expandCollapseRows.public); - - if (typeof (data.detailTemplate) !== 'undefined') { - column = { - title: '', - field: data.primaryKey, - width: data.defaultIconColumnWidth, - align: 'center', - stopPropagation: true, - cssClass: 'gj-cursor-pointer gj-unselectable', - tmpl: data.icons.expand, - events: { - 'click': function (e) { - var $cell = $(this), methods = gj.grid.plugins.expandCollapseRows.private; - if ($cell.closest('tr').next().attr('data-role') === 'details') { - methods.detailCollapse($grid, $cell); - methods.removeSelection($grid, e.data.id); - } else { - methods.detailExpand($grid, $(this)); - methods.keepSelection($grid, e.data.id); - } - } - } - }; - data.columns = [column].concat(data.columns); - - $grid.on('rowDataBound', function (e, $row, id, record) { - $row.data('details', $(data.detailTemplate)); - }); - $grid.on('columnShow', function (e, column) { - gj.grid.plugins.expandCollapseRows.private.updateDetailsColSpan($grid); - }); - $grid.on('columnHide', function (e, column) { - gj.grid.plugins.expandCollapseRows.private.updateDetailsColSpan($grid); - }); - $grid.on('rowRemoving', function (e, $row, id, record) { - gj.grid.plugins.expandCollapseRows.private.detailCollapse($grid, $row.children('td').first()); - }); - $grid.on('dataBinding', function () { - $grid.collapseAll(); - }); - $grid.on('pageChanging', function () { - $grid.collapseAll(); - }); - $grid.on('dataBound', function () { - var i, $cell, $row, data = $grid.data(); - if (data.keepExpandedRows && $.isArray(data.expandedRows)) { - for (i = 0; i < data.expandedRows.length; i++) { - $row = gj.grid.methods.getRowById($grid, data.expandedRows[i]); - if ($row && $row.length) { - $cell = $row.children('td').first(); //TODO: use data-role for selection - if ($cell && $cell.length) { - gj.grid.plugins.expandCollapseRows.private.detailExpand($grid, $cell); - } - } - } - } - }); - } - } -}; -/** - * @widget Grid - * @plugin Inline Editing - */ -gj.grid.plugins.inlineEditing = { - renderers: { - editManager: function (value, record, $cell, $displayEl, id, $grid) { - var data = $grid.data(), - $edit = $(data.inlineEditing.editButton).attr('data-key', id), - $delete = $(data.inlineEditing.deleteButton).attr('data-key', id), - $update = $(data.inlineEditing.updateButton).attr('data-key', id).hide(), - $cancel = $(data.inlineEditing.cancelButton).attr('data-key', id).hide(); - $edit.on('click', function (e) { - $grid.edit($(this).data('key')); - $edit.hide(); - $delete.hide(); - $update.show(); - $cancel.show(); - }); - $delete.on('click', function (e) { - $grid.removeRow($(this).data('key')); - }); - $update.on('click', function (e) { - $grid.update($(this).data('key')); - $edit.show(); - $delete.show(); - $update.hide(); - $cancel.hide(); - }); - $cancel.on('click', function (e) { - $grid.cancel($(this).data('key')); - $edit.show(); - $delete.show(); - $update.hide(); - $cancel.hide(); - }); - $displayEl.empty().append($edit).append($delete).append($update).append($cancel); - } - } -}; - -gj.grid.plugins.inlineEditing.config = { - base: { - defaultColumnSettings: { - /** Provides a way to specify a custom editing UI for the column. - * @alias column.editor - * @type function|boolean - * @default undefined - * @example sample - *
        - * - */ - editor: undefined, - - /** Provides a way to specify a display mode for the column. - * @alias column.mode - * @type display|edit - * @default display - * @example sample - *
        - * - */ - mode: 'display' - }, - inlineEditing: { - - /** Inline editing mode. - * @alias inlineEditing.mode - * @type click|dblclick|command - * @default 'click' - * @example Double.Click - *
        - * - * @example Command - *
        - * - */ - mode: 'click', - - /** If set to true, add column with buttons for edit, delete, update and cancel at the end of the grid. - * @alias inlineEditing.managementColumn - * @type Boolean - * @default true - * @example True - *
        - * - * @example False - *
        - * - * @example Bootstrap - *
        - * - * @example jQueryUI - *
        - * - * @example Material.Design - *
        - * - */ - managementColumn: true, - - managementColumnConfig: { width: 100, align: 'center', renderer: gj.grid.plugins.inlineEditing.renderers.editManager } - } - }, - - bootstrap: { - inlineEditing: { - managementColumnConfig: { width: 200, align: 'center', renderer: gj.grid.plugins.inlineEditing.renderers.editManager } - } - }, - - jqueryui: { - inlineEditing: { - editButton: '', - deleteButton: '', - updateButton: '', - cancelButton: '', - managementColumnConfig: { width: 200, align: 'center', renderer: gj.grid.plugins.inlineEditing.renderers.editManager } - } - }, - - materialdesign: { - inlineEditing: { - managementColumnConfig: { width: 300, align: 'center', renderer: gj.grid.plugins.inlineEditing.renderers.editManager } - } - } -}; - -gj.grid.plugins.inlineEditing.private = { - localization: function (data) { - if (data.uiLibrary === 'bootstrap') { - data.inlineEditing.editButton = ''; - data.inlineEditing.deleteButton = ''; - data.inlineEditing.updateButton = ''; - data.inlineEditing.cancelButton = ''; - } else if (data.uiLibrary === 'materialdesign') { - data.inlineEditing.editButton = ''; - data.inlineEditing.deleteButton = ''; - data.inlineEditing.updateButton = ''; - data.inlineEditing.cancelButton = ''; - } else { - data.inlineEditing.editButton = '' + gj.grid.messages[data.locale].Edit.toLowerCase() + ''; - data.inlineEditing.deleteButton = '' + gj.grid.messages[data.locale].Delete.toLowerCase() + ''; - data.inlineEditing.updateButton = '' + gj.grid.messages[data.locale].Update.toLowerCase() + ''; - data.inlineEditing.cancelButton = '' + gj.grid.messages[data.locale].Cancel.toLowerCase() + ''; - } - }, - - editMode: function ($grid, $cell, column, record) { - var $displayContainer, $editorContainer, $editorField, value, data = $grid.data(); - if ($cell.attr('data-mode') !== 'edit' && column.editor) { - if (data.inlineEditing.mode !== 'command') { - $('div[data-role="edit"]:visible').parent('td').each(function () { - $(this).find('input, select, textarea').triggerHandler('blur'); - }); - } - $displayContainer = $cell.find('div[data-role="display"]').hide(); - $editorContainer = $cell.find('div[data-role="edit"]').show(); - if ($editorContainer.length === 0) { - $editorContainer = $('
        '); - $cell.append($editorContainer); - } - value = record[column.field] || $displayContainer.html(); - $editorField = $editorContainer.find('input, select, textarea').first(); - if ($editorField.length) { - $editorField.val(value); - } else { - if (typeof (column.editor) === 'function') { - column.editor($editorContainer, value, record); - } else if (typeof (column.editor) === 'boolean') { - $editorContainer.append(''); - } - $editorField = $editorContainer.find('input, select, textarea').first(); - if (data.inlineEditing.mode !== 'command') { - $editorField.on('blur', function (e) { - gj.grid.plugins.inlineEditing.private.displayMode($grid, $cell, column); - }); - $editorField.on('keypress', function (e) { - if (e.which === 13) { - gj.grid.plugins.inlineEditing.private.displayMode($grid, $cell, column); - } - }); - } - } - if ($editorField.prop('tagName').toUpperCase() === "INPUT" && $editorField.prop('type').toUpperCase() === 'TEXT') { - gj.grid.plugins.inlineEditing.private.setCaretAtEnd($editorField[0]); - } else { - $editorField.focus(); - } - $cell.attr('data-mode', 'edit'); - } - }, - - setCaretAtEnd: function (elem) { - var elemLen; - if (elem) { - elemLen = elem.value.length; - if (document.selection) { // For IE Only - elem.focus(); - var oSel = document.selection.createRange(); - oSel.moveStart('character', -elemLen); - oSel.moveStart('character', elemLen); - oSel.moveEnd('character', 0); - oSel.select(); - } else if (elem.selectionStart || elem.selectionStart == '0') { // Firefox/Chrome - elem.selectionStart = elemLen; - elem.selectionEnd = elemLen; - elem.focus(); - } - } - }, - - displayMode: function ($grid, $cell, column, cancel) { - var $editorContainer, $displayContainer, newValue, oldValue, record, position, style = ''; - if ($cell.attr('data-mode') === 'edit') { - $editorContainer = $cell.find('div[data-role="edit"]'); - $displayContainer = $cell.find('div[data-role="display"]'); - newValue = $editorContainer.find('input, select, textarea').first().val(); - position = $cell.parent().data('position'); - record = $grid.get(position); - oldValue = record[column.field]; - if (cancel !== true && newValue !== oldValue) { - record[column.field] = newValue; - gj.grid.methods.renderDisplayElement($grid, $displayContainer, column, record, gj.grid.methods.getId(record, $grid.data('primaryKey'), position), 'update'); - if ($cell.find('span.gj-dirty').length === 0) { - if ($cell.css('padding-top') !== '0px') { - style += 'margin-top: -' + $cell.css('padding-top') + ';'; - } - if ($cell.css('padding-left') !== '0px') { - style += 'margin-left: -' + $cell.css('padding-left') + ';'; - } - style = style ? ' style="' + style + '"' : ''; - $cell.prepend($('')); - } - gj.grid.plugins.inlineEditing.events.cellDataChanged($grid, $cell, column, record, oldValue, newValue); - gj.grid.plugins.inlineEditing.private.updateChanges($grid, column, record, newValue); - } - $editorContainer.hide(); - $displayContainer.show(); - $cell.attr('data-mode', 'display'); - } - }, - - updateChanges: function ($grid, column, sourceRecord, newValue) { - var targetRecords, filterResult, newRecord, data = $grid.data(); - if (!data.guid) { - data.guid = gj.grid.plugins.inlineEditing.private.generateGUID(); - } - if (data.primaryKey) { - targetRecords = JSON.parse(sessionStorage.getItem('gj.grid.' + data.guid)); - if (targetRecords) { - filterResult = targetRecords.filter(function (record) { - return record[data.primaryKey] === sourceRecord[data.primaryKey]; - }); - } else { - targetRecords = []; - } - if (filterResult && filterResult.length === 1) { - filterResult[0][column.field] = newValue; - } else { - newRecord = {}; - newRecord[data.primaryKey] = sourceRecord[data.primaryKey]; - if (data.primaryKey !== column.field) { - newRecord[column.field] = newValue; - } - targetRecords.push(newRecord); - } - sessionStorage.setItem('gj.grid.' + data.guid, JSON.stringify(targetRecords)); - } - }, - - generateGUID: function () { - function s4() { - return Math.floor((1 + Math.random()) * 0x10000) - .toString(16) - .substring(1); - } - return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); - } -}; - -gj.grid.plugins.inlineEditing.public = { - /** - * Return array with all changes - * @method - * @return array - * @example sample - * - *

        - *
        - * - */ - getChanges: function () { - return JSON.parse(sessionStorage.getItem('gj.grid.' + this.data().guid)); - }, - - /** - * Enable edit mode for all editable cells within a row. - * @method - * @param {string} id - The id of the row that needs to be edited - * @return grid - * @example Edit.Row - * - *
        - * - */ - edit: function (id) { - var i, record = this.getById(id), - $cells = gj.grid.methods.getRowById(this, id).find('td'), - columns = this.data('columns'); - - for (i = 0; i < $cells.length; i++) { - gj.grid.plugins.inlineEditing.private.editMode(this, $($cells[i]), columns[i], record); - } - - return this; - }, - - /** - * Update all editable cells within a row, when the row is in edit mode. - * @method - * @param {string} id - The id of the row that needs to be updated - * @return grid - * @fires rowDataChanged - * @example Update.Row - * - *
        - * - */ - update: function (id) { - var i, record = this.getById(id), - $cells = gj.grid.methods.getRowById(this, id).find('td'), - columns = this.data('columns'); - - for (i = 0; i < $cells.length; i++) { - gj.grid.plugins.inlineEditing.private.displayMode(this, $($cells[i]), columns[i], false); - } - - gj.grid.plugins.inlineEditing.events.rowDataChanged(this, id, record); - - return this; - }, - - /** - * Cancel the edition of all editable cells, when the row is in edit mode. - * @method - * @param {string} id - The id of the row where you need to undo all changes - * @return grid - * @example Cancel.Row - * - *
        - * - */ - cancel: function (id) { - var i, record = this.getById(id), - $cells = gj.grid.methods.getRowById(this, id).find('td'), - columns = this.data('columns'); - - for (i = 0; i < $cells.length; i++) { - gj.grid.plugins.inlineEditing.private.displayMode(this, $($cells[i]), columns[i], true); - } - - return this; - } -}; - -gj.grid.plugins.inlineEditing.events = { - /** - * Event fires after inline edit of a cell in the grid. - * - * @event cellDataChanged - * @param {object} e - event data - * @param {object} $cell - the cell presented as jquery object - * @param {object} column - the column configuration data - * @param {object} record - the data of the row record - * @param {object} oldValue - the old cell value - * @param {object} newValue - the new cell value - * @example sample - *
        - * - */ - cellDataChanged: function ($grid, $cell, column, record, oldValue, newValue) { - $grid.triggerHandler('cellDataChanged', [$cell, column, record, oldValue, newValue]); - }, - - /** - * Event fires after inline edit of a row in the grid. - * - * @event rowDataChanged - * @param {object} e - event data - * @param {object} id - the id of the record - * @param {object} record - the data of the row record - * @example sample - *
        - * - */ - rowDataChanged: function ($grid, id, record) { - $grid.triggerHandler('rowDataChanged', [id, record]); - } -}; - -gj.grid.plugins.inlineEditing.configure = function ($grid, fullConfig, clientConfig) { - var data = $grid.data(); - $.extend(true, $grid, gj.grid.plugins.inlineEditing.public); - if (clientConfig.inlineEditing) { - $grid.on('dataBound', function () { - $grid.find('span.gj-dirty').remove(); - }); - } - if (data.inlineEditing.mode === 'command') { - gj.grid.plugins.inlineEditing.private.localization(data); - if (fullConfig.inlineEditing.managementColumn) { - data.columns.push(fullConfig.inlineEditing.managementColumnConfig); - } - } else { - $grid.on('cellDataBound', function (e, $displayEl, id, column, record) { - if (column.editor) { - $displayEl.parent('td').on(data.inlineEditing.mode === 'dblclick' ? 'dblclick' : 'click', function () { - gj.grid.plugins.inlineEditing.private.editMode($grid, $displayEl.parent(), column, record); - }); - if (column.mode === 'edit') { - gj.grid.plugins.inlineEditing.private.editMode($grid, $displayEl.parent(), column, record); - } - } - }); - } -}; - -/** - * @widget Grid - * @plugin Optimistic Persistence - */ -gj.grid.plugins.optimisticPersistence = { - - config: { - base: { - optimisticPersistence: { - /** Array that contains a list with param names that needs to be saved in the localStorage. You need to specify guid on the initialization of the grid in order to enable this feature. - * @additionalinfo This feature is using HTML5 localStorage to store params and values. - * You can clear the data saved in localStorage when you clear your browser cache. - * @alias optimisticPersistence.localStorage - * @type array - * @default undefined - * @example sample - *

        Change the page and/or page size and then refresh the grid.

        - *
        - * - */ - localStorage: undefined, - - /** Array that contains a list with param names that needs to be saved in the sessionStorage. You need to specify guid on the initialization of the grid in order to enable this feature. - * @additionalinfo This feature is using HTML5 sessionStorage to store params and values. - * You can clear the data saved in sessionStorage when you open and close the browser. - * @alias optimisticPersistence.sessionStorage - * @type array - * @default undefined - * @example sample - *

        Change the page and/or page size and then refresh the grid.

        - *
        - * - */ - sessionStorage: undefined - } - } - }, - - private: { - applyParams: function ($grid) { - var data = $grid.data(), - params = {}, storage; - storage = JSON.parse(sessionStorage.getItem('gj.grid.' + data.guid)); - if (storage && storage.optimisticPersistence) { - $.extend(params, storage.optimisticPersistence); - } - storage = JSON.parse(localStorage.getItem('gj.grid.' + data.guid)); - if (storage && storage.optimisticPersistence) { - $.extend(params, storage.optimisticPersistence); - } - $.extend(data.params, params); - }, - - saveParams: function ($grid) { - var i, param, - data = $grid.data(), - storage = { optimisticPersistence: {} }; - - if (data.optimisticPersistence.sessionStorage) { - for (i = 0; i < data.optimisticPersistence.sessionStorage.length; i++) { - param = data.optimisticPersistence.sessionStorage[i]; - storage.optimisticPersistence[param] = data.params[param]; - } - storage = $.extend(true, JSON.parse(sessionStorage.getItem('gj.grid.' + data.guid)), storage); - sessionStorage.setItem('gj.grid.' + data.guid, JSON.stringify(storage)); - } - - if (data.optimisticPersistence.localStorage) { - storage = { optimisticPersistence: {} }; - for (i = 0; i < data.optimisticPersistence.localStorage.length; i++) { - param = data.optimisticPersistence.localStorage[i]; - storage.optimisticPersistence[param] = data.params[param]; - } - storage = $.extend(true, JSON.parse(localStorage.getItem('gj.grid.' + data.guid)), storage); - localStorage.setItem('gj.grid.' + data.guid, JSON.stringify(storage)); - } - } - }, - - configure: function ($grid, fullConfig, clientConfig) { - if (fullConfig.guid) { - if (fullConfig.optimisticPersistence.localStorage || fullConfig.optimisticPersistence.sessionStorage) { - gj.grid.plugins.optimisticPersistence.private.applyParams($grid); - $grid.on('dataBound', function (e) { - gj.grid.plugins.optimisticPersistence.private.saveParams($grid); - }); - } - } - } -}; -/** - * @widget Grid - * @plugin Pagination - */ -gj.grid.plugins.pagination = { - config: { - base: { - style: { - pager: { - cell: '', - stateDisabled: '', - activeButton: 'gj-grid-base-active' - } - }, - - paramNames: { - /** The name of the parameter that is going to send the number of the page. - * The pager should be enabled in order this parameter to be in use. - * @alias paramNames.page - * @type string - * @default "page" - */ - page: 'page', - - /** The name of the parameter that is going to send the maximum number of records per page. - * The pager should be enabled in order this parameter to be in use. - * @alias paramNames.limit - * @type string - * @default "limit" - */ - limit: 'limit' - }, - - pager: { - /** The maximum number of records that can be show by page. - * @alias pager.limit - * @type number - * @default 10 - * @example local.data - *
        - * - * @example remote.data - *
        - * - */ - limit: 10, - - /** Array that contains the possible page sizes of the grid. - * When this setting is set, then a drop down with the options for each page size is visualized in the pager. - * @alias pager.sizes - * @type array - * @default undefined - * @example Bootstrap.3 - *
        - *
        - *
        - * - * @example Material.Design - *
        - *
        - *
        - * - */ - sizes: undefined, - - /** Array that contains a list with jquery objects that are going to be used on the left side of the pager. - * @alias pager.leftControls - * @type array - * @default array - * @example Font.Awesome - * - *
        - * - */ - leftControls: undefined, - - /** Array that contains a list with jquery objects that are going to be used on the right side of the pager. - * @alias pager.rightControls - * @type array - * @default array - */ - rightControls: undefined - } - }, - jqueryui: { - style: { - pager: { - cell: 'ui-widget-header ui-state-default ui-grid-pager-cell', - stateDisabled: 'ui-state-disabled' - } - }, - pager: { - leftControls: [ - $('
        '), - $('
        '), - $('
        Page
        '), - $('
        ').append($('')), - $('
        of 
        '), - $('
        0
        '), - $('
        '), - $('
        '), - $('
        '), - $('
        ').append($('')) - ], - - rightControls: [ - $('
        Displaying records 
        '), - $('
        0
        '), - $('
         - 
        '), - $('
        0
        '), - $('
         of 
        '), - $('
        0
        ').css({ "margin-right": "5px" }) - ] - } - }, - - bootstrap: { - style: { - pager: { - cell: 'gj-grid-bootstrap-tfoot-cell', - stateDisabled: '' - } - } - }, - - bootstrap4: { - style: { - pager: { - cell: 'gj-grid-bootstrap-tfoot-cell', - stateDisabled: '' - } - } - }, - - materialdesign: { - style: { - pager: { - cell: '', - stateDisabled: '' - } - } - }, - - glyphicons: { - icons: { - first: '', - previous: '', - next: '', - last: '', - refresh: '' - } - }, - - materialicons: { - icons: { - first: 'first_page', - previous: 'chevron_left', - next: 'chevron_right', - last: 'last_page', - refresh: 'refresh' - } - }, - - fontawesome: { - icons: { - first: '', - previous: '', - next: '', - last: '', - refresh: '' - } - } - }, - - private: { - init: function ($grid) { - var $row, $cell, data, controls, $leftPanel, $rightPanel, $tfoot, leftControls, rightControls, i; - - data = $grid.data(); - - if (data.pager) { - if (!data.params[data.paramNames.page]) { - data.params[data.paramNames.page] = 1; - } - if (!data.params[data.paramNames.limit]) { - data.params[data.paramNames.limit] = data.pager.limit; - } - - gj.grid.plugins.pagination.private.localization(data); - - $row = $(''); - $cell = $('').addClass(data.style.pager.cell); - $row.append($cell); - - $leftPanel = $('
        ').css({ 'float': 'left' }); - $rightPanel = $('
        ').css({ 'float': 'right' }); - if (/msie/.test(navigator.userAgent.toLowerCase())) { - $rightPanel.css({ 'padding-top': '3px' }); - } - - $cell.append($leftPanel).append($rightPanel); - - $tfoot = $('').append($row); - $grid.append($tfoot); - gj.grid.plugins.pagination.private.updatePagerColSpan($grid); - - leftControls = gj.grid.methods.clone(data.pager.leftControls); //clone array - $.each(leftControls, function () { - $leftPanel.append(this); - }); - - rightControls = gj.grid.methods.clone(data.pager.rightControls); //clone array - $.each(rightControls, function () { - $rightPanel.append(this); - }); - - controls = $grid.find('tfoot [data-role]'); - for (i = 0; i < controls.length; i++) { - gj.grid.plugins.pagination.private.initPagerControl($(controls[i]), $grid); - } - } - }, - - localization: function (data) { - if (data.uiLibrary === 'bootstrap') { - gj.grid.plugins.pagination.private.localizationBootstrap(data); - } else if (data.uiLibrary === 'bootstrap4') { - gj.grid.plugins.pagination.private.localizationBootstrap4(data); - } else if (data.uiLibrary === 'materialdesign') { - gj.grid.plugins.pagination.private.localizationMaterialDesign(data); - } else { - gj.grid.plugins.pagination.private.localizationBaseTheme(data); - } - }, - - localizationBootstrap: function (data) { - var msg = gj.grid.messages[data.locale]; - if (typeof (data.pager.leftControls) === 'undefined') { - data.pager.leftControls = [ - $('').attr('title', msg.FirstPageTooltip).attr('data-role', 'page-first'), - $('
         
        '), - $('').attr('title', msg.PreviousPageTooltip).attr('data-role', 'page-previous'), - $('
         
        '), - $('
        ' + msg.Page + '
        '), - $('
         
        '), - $('
        ').append($('')), - $('
         
        '), - $('
        ' + msg.Of + ' 
        '), - $('
        0
        '), - $('
         
        '), - $('').attr('title', msg.NextPageTooltip).attr('data-role', 'page-next'), - $('
         
        '), - $('').attr('title', msg.LastPageTooltip).attr('data-role', 'page-last'), - $('
         
        '), - $('').attr('title', msg.Refresh).attr('data-role', 'page-refresh'), - $('
         
        '), - $('
        ').append($('
        ')) - ]; - } - if (typeof (data.pager.rightControls) === 'undefined') { - data.pager.rightControls = [ - $('
        ' + msg.DisplayingRecords + ' 
        '), - $('
        0
        '), - $('
         - 
        '), - $('
        0
        '), - $('
         ' + msg.Of + ' 
        '), - $('
        0
        ').css({ "margin-right": "5px" }) - ]; - } - }, - - localizationBootstrap4: function (data) { - var msg = gj.grid.messages[data.locale]; - if (typeof (data.pager.leftControls) === 'undefined') { - data.pager.leftControls = [ - $('').attr('title', msg.FirstPageTooltip).attr('data-role', 'page-first'), - $('
         
        '), - $('').attr('title', msg.PreviousPageTooltip).attr('data-role', 'page-previous'), - $('
         
        '), - $('
        ' + msg.Page + '
        '), - $('
         
        '), - $('
        ').append($('')), - $('
         
        '), - $('
        ' + msg.Of + ' 
        '), - $('
        0
        '), - $('
         
        '), - $('').attr('title', msg.NextPageTooltip).attr('data-role', 'page-next'), - $('
         
        '), - $('').attr('title', msg.LastPageTooltip).attr('data-role', 'page-last'), - $('
         
        '), - $('').attr('title', msg.Refresh).attr('data-role', 'page-refresh'), - $('
         
        '), - $('
        ').append($('
        ')) - ]; - } - if (typeof (data.pager.rightControls) === 'undefined') { - data.pager.rightControls = [ - $('
        ' + msg.DisplayingRecords + ' 
        '), - $('
        0
        '), - $('
         - 
        '), - $('
        0
        '), - $('
         ' + msg.Of + ' 
        '), - $('
        0
        ').css({ "margin-right": "5px" }) - ]; - } - }, - - localizationMaterialDesign: function (data) { - var msg = gj.grid.messages[data.locale]; - if (typeof (data.pager.leftControls) === 'undefined') { - data.pager.leftControls = [ - $('').attr('title', msg.FirstPageTooltip).attr('data-role', 'page-first').addClass(data.icons.first ? 'mdl-button--icon' : ''), - $('').attr('title', msg.PreviousPageTooltip).attr('data-role', 'page-previous').addClass(data.icons.previous ? 'mdl-button--icon' : ''), - $('' + msg.Page + ''), - $(''), - $('' + msg.Of + ''), - $('0'), - $('').attr('title', msg.NextPageTooltip).attr('data-role', 'page-next').addClass(data.icons.next ? 'mdl-button--icon' : ''), - $('').attr('title', msg.LastPageTooltip).attr('data-role', 'page-last').addClass(data.icons.last ? 'mdl-button--icon' : ''), - $('').attr('title', msg.Refresh).attr('data-role', 'page-refresh').addClass(data.icons.refresh ? 'mdl-button--icon' : ''), - $('
        ') - ]; - } - if (typeof (data.pager.rightControls) === 'undefined') { - data.pager.rightControls = [ - $('' + msg.DisplayingRecords + ''), - $('0'), - $('-'), - $('0'), - $('' + msg.Of + ''), - $('0') - ]; - } - }, - - localizationBaseTheme: function (data) { - var msg = gj.grid.messages[data.locale]; - if (typeof (data.pager.leftControls) === 'undefined') { - data.pager.leftControls = [ - $(''), - $(''), - $(''), - $(''), - $('  ') - ]; - } - if (typeof (data.pager.rightControls) === 'undefined') { - data.pager.rightControls = [ - $('
        ' + msg.DisplayingRecords + ' 
        '), - $('
        0
        '), - $('
         - 
        '), - $('
        0
        '), - $('
         ' + msg.Of + ' 
        '), - $('
        0
        ').css({ "margin-right": "5px" }) - ]; - } - }, - - initPagerControl: function ($control, $grid) { - var data = $grid.data(); - switch ($control.data('role')) { - case 'page-size': - if (data.pager.sizes && 0 < data.pager.sizes.length) { - $control.show(); - $.each(data.pager.sizes, function () { - $control.append($('