diff --git a/dist/bootree.css b/dist/bootree.css
new file mode 100644
index 0000000..476c67f
--- /dev/null
+++ b/dist/bootree.css
@@ -0,0 +1,2664 @@
+.bt-button {
+ background-color: #f5f5f5;
+ border: 1px solid #ddd;
+ color: #000;
+ border-radius: 3px;
+ padding: 6px 10px;
+ cursor: pointer;
+}
+
+.bt-unselectable {
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+.bt-row {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+}
+
+.bt-margin-left-5 {
+ margin-left: 5px;
+}
+
+.bt-margin-left-10 {
+ margin-left: 10px;
+}
+
+.bt-width-full {
+ width: 100%;
+}
+
+.bt-cursor-pointer {
+ cursor: pointer;
+}
+
+.bt-text-align-center {
+ text-align: center;
+}
+
+.bt-font-size-16 {
+ font-size: 16px;
+}
+
+.bt-hidden {
+ display: none;
+}
+
+/** Material Design */
+.bt-button-md {
+ background: 0 0;
+ border: none;
+ border-radius: 2px;
+ color: rgba(0, 0, 0, 0.87);
+ position: relative;
+ height: 36px;
+ margin: 0;
+ min-width: 64px;
+ padding: 0 16px;
+ display: inline-block;
+ font-family: "Roboto","Helvetica","Arial",sans-serif;
+ font-size: 1rem;
+ 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;
+ overflow: hidden;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+.bt-button-md:hover {
+ background-color: rgba(158,158,158,.2);
+}
+
+.bt-button-md:disabled {
+ color: rgba(0,0,0,.26);
+ background: 0 0;
+}
+
+.bt-button-md .material-icons,
+.bt-button-md .bt-icon {
+ vertical-align: middle;
+ /*font-size: 1.3rem;
+ margin-right: 4px;*/
+}
+
+.bt-button-md.bt-button-md-icon {
+ width: 24px;
+ height: 31px;
+ min-width: 24px;
+ padding: 0px;
+ display: table;
+}
+
+.bt-button-md.bt-button-md-icon .material-icons,
+.bt-button-md.bt-button-md-icon .bt-icon {
+ display: table-cell;
+ margin-right: 0px;
+ width: 24px;
+ height: 24px;
+}
+
+.bt-button-md.active {
+ background-color: rgba(158,158,158,.4);
+}
+
+.bt-button-md-group {
+ position: relative;
+ display: inline-block;
+ vertical-align: middle;
+}
+
+.bt-textbox-md {
+ border: none;
+ border-bottom: 1px solid rgba(0,0,0,.42);
+ display: block;
+ font-family: "Helvetica","Arial",sans-serif;
+ font-size: 16px;
+ line-height: 16px;
+ padding: 4px 0px;
+ margin: 0;
+ width: 100%;
+ background: 0 0;
+ text-align: left;
+ color: rgba(0,0,0,.87);
+}
+
+.bt-textbox-md:focus,
+.bt-textbox-md:active {
+ border-bottom: 2px solid rgba(0,0,0,.42);
+ outline: none;
+}
+
+.bt-textbox-md::placeholder {
+ color: #8e8e8e;
+}
+
+.bt-textbox-md:-ms-input-placeholder {
+ color: #8e8e8e;
+}
+
+.bt-textbox-md::-ms-input-placeholder {
+ color: #8e8e8e;
+}
+
+.bt-md-spacer-24 {
+ min-width: 24px;
+ width: 24px;
+ display: inline-block;
+}
+
+.bt-md-spacer-32 {
+ min-width: 32px;
+ width: 32px;
+ display: inline-block;
+}
+
+.bt-modal {
+ position: fixed;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ z-index: 2;
+ display: none;
+ overflow: hidden;
+ -webkit-overflow-scrolling: touch;
+ outline: 0;
+ background-color: rgba(0, 0, 0, 0.54118);
+ transition: 200ms ease opacity;
+ will-change: opacity;
+}
+
+/* List */
+ul.bt-list li [data-role="wrapper"] {
+ display: table;
+ width: 100%;
+}
+
+ul.bt-list li [data-role="checkbox"] {
+ display: table-cell;
+ vertical-align:middle;
+ text-align:center;
+}
+
+ul.bt-list li [data-role="image"] {
+ display: table-cell;
+ vertical-align:middle;
+ text-align:center;
+}
+
+ul.bt-list li [data-role="display"] {
+ display: table-cell;
+ vertical-align:middle;
+ cursor: pointer;
+}
+
+ul.bt-list li [data-role="display"]:empty:before {
+ content: "\200b"; /* unicode zero width space character */
+}
+
+/* List - Bootstrap */
+ul.bt-list-bootstrap {
+ padding-left: 0px;
+ margin-bottom: 0px;
+}
+
+ul.bt-list-bootstrap li {
+ padding: 0px;
+}
+
+ul.bt-list-bootstrap li [data-role="wrapper"] {
+ padding: 0px 10px;
+}
+
+ul.bt-list-bootstrap li [data-role="checkbox"] {
+ width: 24px;
+ padding: 3px;
+}
+
+ul.bt-list-bootstrap li [data-role="image"] {
+ width: 24px;
+ height: 24px;
+}
+
+ul.bt-list-bootstrap li [data-role="display"] {
+ padding: 8px 0px 8px 4px;
+}
+
+.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;
+}
+
+/* List - Material Design */
+ul.bt-list-md {
+ padding: 0px;
+ list-style: none;
+ list-style-type: none;
+ line-height: 24px;
+ letter-spacing: 0;
+ color: #616161; /* Gray 700 */
+}
+
+ul.bt-list-md li {
+ display: list-item;
+ list-style-type: none;
+ padding: 0px;
+ min-height: unset;
+ box-sizing: border-box;
+ align-items: center;
+ cursor: default;
+ overflow: hidden;
+
+ font-family: "Roboto","Helvetica","Arial",sans-serif;
+ font-size: 16px;
+ font-weight: 400;
+ letter-spacing: .04em;
+ line-height: 1;
+
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ -webkit-flex-wrap: nowrap;
+ -ms-flex-wrap: nowrap;
+ flex-wrap: nowrap;
+}
+
+ul.bt-list-md li [data-role="checkbox"] {
+ height: 24px;
+ width: 24px;
+}
+
+ul.bt-list-md li [data-role="image"] {
+ height: 24px;
+ width: 24px;
+}
+
+ul.bt-list-md li [data-role="display"] {
+ padding: 8px 0px 8px 5px;
+ order: 0;
+ flex-grow: 2;
+ text-decoration: none;
+ box-sizing: border-box;
+ align-items: center;
+ text-align: left;
+ color: rgba(0,0,0,.87);
+}
+
+ul.bt-list-md li.disabled>[data-role="wrapper"]>[data-role="display"] {
+ color: #9E9E9E; /* Gray 500 */
+}
+
+.bt-list-md-active {
+ /* background: #E8EAF6; */
+ background: rgba(0,0,0,.12);
+ color: #3f51b5;
+}
+
+
+/* Picker */
+.bt-picker {
+ position: absolute;
+ z-index: 1202;
+ background-color: #fff;
+}
+
+.bt-picker .selected {
+ color: #fff;
+}
+
+/* Material Design */
+.bt-picker-md {
+ font-family: "Roboto","Helvetica","Arial",sans-serif;
+ font-size: 16px;
+ font-weight: 400;
+ letter-spacing: .04em;
+ line-height: 1;
+ color: rgba(0,0,0,.87);
+ border: 1px solid #E0E0E0;
+}
+
+.bt-modal .bt-picker-md {
+ border: 0px;
+}
+
+.bt-picker-md [role="header"] {
+ color: rgba(255, 255, 255, 0.54);
+ display: flex;
+ background: #2196f3;
+ align-items: baseline;
+ user-select: none;
+ justify-content: center;
+}
+
+.bt-picker-md [role="footer"] {
+ float: right;
+ padding: 10px;
+}
+
+.bt-picker-md [role="footer"] button.bt-button-md {
+ color: #2196f3;
+ font-weight: bold;
+ font-size: 13px;
+}
+
+/* Bootstrap */
+.bt-picker-bootstrap {
+ border-radius: 4px;
+ border: 1px solid #E0E0E0;
+}
+
+.bt-picker-bootstrap .selected {
+ color: #888;
+}
+
+.bt-picker-bootstrap [role="header"] {
+ background: #eee;
+ color: #AAA;
+}
+@font-face {
+ font-family: 'gijgo-material';
+ src: url('../fonts/gijgo-material.eot?235541');
+ src: url('../fonts/gijgo-material.eot?235541#iefix') format('embedded-opentype'), url('../fonts/gijgo-material.ttf?235541') format('truetype'), url('../fonts/gijgo-material.woff?235541') format('woff'), url('../fonts/gijgo-material.svg?235541#gijgo-material') format('svg');
+ font-weight: normal;
+ font-style: normal;
+}
+
+.bt-icon {
+ /* use !important to prevent issues with browser extensions that change fonts */
+ font-family: 'gijgo-material' !important;
+ font-size: 24px;
+ speak: none;
+ font-style: normal;
+ font-weight: normal;
+ font-variant: normal;
+ text-transform: none;
+ line-height: 1;
+ /* Enable Ligatures ================ */
+ letter-spacing: 0;
+ -webkit-font-feature-settings: "liga";
+ -moz-font-feature-settings: "liga=1";
+ -moz-font-feature-settings: "liga";
+ -ms-font-feature-settings: "liga" 1;
+ font-feature-settings: "liga";
+ -webkit-font-variant-ligatures: discretionary-ligatures;
+ font-variant-ligatures: discretionary-ligatures;
+ /* Better Font Rendering =========== */
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+.bt-icon.undo:before {
+ content: "\e900";
+}
+
+.bt-icon.vertical-align-top:before {
+ content: "\e901";
+}
+
+.bt-icon.vertical-align-center:before {
+ content: "\e902";
+}
+
+.bt-icon.vertical-align-bottom:before {
+ content: "\e903";
+}
+
+.bt-icon.arrow-dropup:before {
+ content: "\e904";
+}
+
+.bt-icon.clock:before {
+ content: "\e905";
+}
+
+.bt-icon.refresh:before {
+ content: "\e906";
+}
+
+.bt-icon.last-page:before {
+ content: "\e907";
+}
+
+.bt-icon.first-page:before {
+ content: "\e908";
+}
+
+.bt-icon.cancel:before {
+ content: "\e909";
+}
+
+.bt-icon.clear:before {
+ content: "\e90a";
+}
+
+.bt-icon.check-circle:before {
+ content: "\e90b";
+}
+
+.bt-icon.delete:before {
+ content: "\e90c";
+}
+
+.bt-icon.arrow-upward:before {
+ content: "\e90d";
+}
+
+.bt-icon.arrow-forward:before {
+ content: "\e90e";
+}
+
+.bt-icon.arrow-downward:before {
+ content: "\e90f";
+}
+
+.bt-icon.arrow-back:before {
+ content: "\e910";
+}
+
+.bt-icon.list-numbered:before {
+ content: "\e911";
+}
+
+.bt-icon.list-bulleted:before {
+ content: "\e912";
+}
+
+.bt-icon.indent-increase:before {
+ content: "\e913";
+}
+
+.bt-icon.indent-decrease:before {
+ content: "\e914";
+}
+
+.bt-icon.redo:before {
+ content: "\e915";
+}
+
+.bt-icon.align-right:before {
+ content: "\e916";
+}
+
+.bt-icon.align-left:before {
+ content: "\e917";
+}
+
+.bt-icon.align-justify:before {
+ content: "\e918";
+}
+
+.bt-icon.align-center:before {
+ content: "\e919";
+}
+
+.bt-icon.strikethrough:before {
+ content: "\e91a";
+}
+
+.bt-icon.italic:before {
+ content: "\e91b";
+}
+
+.bt-icon.underlined:before {
+ content: "\e91c";
+}
+
+.bt-icon.bold:before {
+ content: "\e91d";
+}
+
+.bt-icon.arrow-dropdown:before {
+ content: "\e91e";
+}
+
+.bt-icon.done:before {
+ content: "\e91f";
+}
+
+.bt-icon.pencil:before {
+ content: "\e920";
+}
+
+.bt-icon.minus:before {
+ content: "\e921";
+}
+
+.bt-icon.plus:before {
+ content: "\e922";
+}
+
+.bt-icon.chevron-up:before {
+ content: "\e923";
+}
+
+.bt-icon.chevron-right:before {
+ content: "\e924";
+}
+
+.bt-icon.chevron-down:before {
+ content: "\e925";
+}
+
+.bt-icon.chevron-left:before {
+ content: "\e926";
+}
+
+.bt-icon.event:before {
+ content: "\e927";
+}
+.bt-draggable {
+ cursor: move;
+}
+.bt-resizable-handle {
+ position: absolute;
+ font-size: 0.1px;
+ display: block;
+ -ms-touch-action: none;
+ touch-action: none;
+ z-index: 1203;
+}
+
+.bt-resizable-n {
+ cursor: n-resize;
+ height: 7px;
+ width: 100%;
+ top: -5px;
+ left: 0;
+}
+.bt-resizable-e {
+ cursor: e-resize;
+ width: 7px;
+ right: -5px;
+ top: 0;
+ height: 100%;
+}
+.bt-resizable-s {
+ cursor: s-resize;
+ height: 7px;
+ width: 100%;
+ bottom: -5px;
+ left: 0;
+}
+.bt-resizable-w {
+ cursor: w-resize;
+ width: 7px;
+ left: -5px;
+ top: 0;
+ height: 100%;
+}
+.bt-resizable-se {
+ cursor: se-resize;
+ width: 12px;
+ height: 12px;
+ right: 1px;
+ bottom: 1px;
+}
+.bt-resizable-sw {
+ cursor: sw-resize;
+ width: 9px;
+ height: 9px;
+ left: -5px;
+ bottom: -5px;
+}
+.bt-resizable-nw {
+ cursor: nw-resize;
+ width: 9px;
+ height: 9px;
+ left: -5px;
+ top: -5px;
+}
+.bt-resizable-ne {
+ cursor: ne-resize;
+ width: 9px;
+ height: 9px;
+ right: -5px;
+ top: -5px;
+}
+
+.bt-dialog-footer {
+ position: absolute;
+ bottom: 0px;
+ width: 100%;
+ margin-top: 0px;
+}
+
+.bt-dialog-scrollable [data-role="body"] {
+ overflow-x: hidden;
+ overflow-y: scroll;
+}
+
+/** Bootstrap 3 **/
+.bt-dialog-bootstrap {
+ overflow: hidden;
+ z-index: 1202;
+}
+
+.bt-dialog-bootstrap [data-role="title"] {
+ display: inline;
+}
+.bt-dialog-bootstrap [data-role="close"] {
+ line-height: 1.42857143;
+}
+
+/** Bootstrap 4 **/
+.bt-dialog-bootstrap4 {
+ overflow: hidden;
+ z-index: 1202;
+}
+
+.bt-dialog-bootstrap4 [data-role="title"] {
+ display: inline;
+}
+.bt-dialog-bootstrap4 [data-role="close"] {
+ line-height: 1.5;
+}
+
+/** Material Design **/
+.bt-dialog-md {
+ background-color: #FFF;
+ overflow: hidden;
+ border: none;
+ box-shadow: 0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14), 0 9px 46px 8px rgba(0,0,0,.12);
+ box-sizing: border-box;
+ position: relative;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-orient: vertical;
+ -webkit-box-direction: normal;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -webkit-background-clip: padding-box;
+ background-clip: padding-box;
+ outline: 0;
+ z-index: 1202;
+}
+
+.bt-dialog-md-header {
+ padding: 24px 24px 0px 24px;
+ font-family: "Roboto","Helvetica","Arial",sans-serif;
+}
+
+.bt-dialog-md-title {
+ margin: 0;
+ font-weight: 400;
+ display: inline;
+ line-height: 28px;
+ font-size: 20px;
+}
+
+.bt-dialog-md-close {
+ -webkit-appearance: none;
+ padding: 0;
+ cursor: pointer;
+ background: 0 0;
+ border: 0;
+ float: right;
+ line-height: 28px;
+ font-size: 28px;
+}
+
+.bt-dialog-md-body {
+ padding: 20px 24px 24px 24px;
+ color: rgba(0,0,0,.54);
+ font-family: "Helvetica","Arial",sans-serif;
+ font-size: 14px;
+ font-weight: 400;
+ line-height: 20px;
+}
+
+.bt-dialog-md-footer {
+ padding: 8px 8px 8px 24px;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: row-reverse;
+ -ms-flex-direction: row-reverse;
+ flex-direction: row-reverse;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+
+ box-sizing: border-box;
+}
+
+.bt-dialog-md-footer>*:first-child {
+ margin-right: 0;
+}
+
+.bt-dialog-md-footer>* {
+ margin-right: 8px;
+ height: 36px;
+}
+DIV.bt-grid-wrapper {
+ margin: auto;
+ position: relative;
+ clear:both;
+ z-index: 1;
+}
+
+TABLE.bt-grid {
+ margin: auto;
+ border-collapse: collapse;
+ width: 100%;
+ table-layout: fixed;
+}
+
+TABLE.bt-grid THEAD TH [data-role="selectAll"] {
+ margin: auto;
+}
+
+TABLE.bt-grid THEAD TH [data-role="title"] {
+ display: inline-block;
+}
+
+TABLE.bt-grid THEAD TH [data-role="sorticon"] {
+ display: inline-block;
+}
+
+TABLE.bt-grid THEAD TH {
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+TABLE.bt-grid.autogrow-header-row THEAD TH {
+ overflow: auto;
+ text-overflow: initial;
+ white-space: pre-wrap;
+ -ms-word-break: break-word;
+ word-break: break-word;
+}
+
+TABLE.bt-grid > tbody > tr > td {
+ overflow: hidden;
+ position: relative;
+}
+
+table.bt-grid tbody div[data-role="display"] {
+ vertical-align: middle;
+ text-indent: 0;
+ white-space: pre-wrap;
+ -ms-word-break: break-word;
+ word-break: break-word;
+}
+
+table.bt-grid.fixed-body-rows tbody div[data-role="display"] {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ -ms-word-break: initial;
+ word-break: initial;
+}
+
+table.bt-grid tfoot DIV[data-role="display"] {
+ vertical-align: middle;
+ text-indent: 0;
+ display: flex;
+}
+
+TABLE.bt-grid .fa {
+ padding: 2px;
+}
+
+TABLE.bt-grid > tbody > tr > td > div {
+ padding: 2px;
+ overflow: hidden;
+}
+
+DIV.bt-grid-wrapper DIV.bt-grid-loading-cover
+{
+ background: #BBBBBB;
+ opacity: 0.5;
+ position: absolute;
+ vertical-align: middle;
+}
+
+DIV.bt-grid-wrapper DIV.bt-grid-loading-text
+{
+ position: absolute;
+ font-weight: bold;
+}
+
+/* Bootstrap Theme */
+table.bt-grid-bootstrap thead th {
+ background-color: #f5f5f5;
+ vertical-align:middle;
+}
+
+table.bt-grid-bootstrap thead th [data-role="sorticon"] {
+ margin-left: 5px;
+}
+
+table.bt-grid-bootstrap thead th [data-role="sorticon"] i.bt-icon,
+table.bt-grid-bootstrap thead th [data-role="sorticon"] i.material-icons {
+ position: absolute;
+ font-size: 20px;
+ top: 15px;
+}
+
+table.bt-grid-bootstrap tbody tr td div[data-role="display"] {
+ padding: 0px;
+}
+
+.bt-grid-bootstrap-4 .bt-checkbox-bootstrap {
+ display: inline-block;
+ padding-top: 2px;
+}
+
+/* Material Design Theme */
+.bt-grid-md {
+ position: relative;
+ border: 1px solid rgba(0,0,0,.12);
+ border-collapse: collapse;
+ white-space: nowrap;
+ font-size: 13px;
+ font-family: "Roboto","Helvetica","Arial",sans-serif;
+ background-color: #fff;
+}
+
+.bt-grid-md td:first-of-type, .bt-grid-md th:first-of-type {
+ padding-left: 24px;
+}
+
+.bt-grid-md th {
+ position: relative;
+ vertical-align: bottom;
+ font-weight: 700;
+ line-height: 31px;
+ letter-spacing: 0;
+ height: 56px;
+ font-size: 12px;
+ color: rgba(0,0,0,.54);
+ padding-bottom: 8px;
+ box-sizing: border-box;
+ padding: 12px 18px;
+ text-align: right;
+}
+
+.bt-grid-md td {
+ position: relative;
+ height: 48px;
+ border-top: 1px solid rgba(0,0,0,.12);
+ border-bottom: 1px solid rgba(0,0,0,.12);
+ padding: 12px 18px;
+ box-sizing: border-box;
+ text-align: left;
+ color: rgba(0,0,0,.87);
+}
+
+.bt-grid-md tbody tr {
+ position: relative;
+ height: 48px;
+ transition-duration: .28s;
+ transition-timing-function: cubic-bezier(.4,0,.2,1);
+ transition-property: background-color;
+}
+
+.bt-grid-md tbody tr:hover {
+ background-color: #EEEEEE; /* Gray 200 */
+}
+
+.bt-grid-md tbody tr.bt-grid-md-select {
+ background-color: #F5F5F5; /* Grey 100 */
+}
+
+
+table.bt-grid-md thead th [data-role="sorticon"] {
+ margin-left: 5px;
+}
+
+table.bt-grid-md thead th [data-role="sorticon"] i.bt-icon,
+table.bt-grid-md thead th [data-role="sorticon"] i.material-icons {
+ position: absolute;
+ font-size: 16px;
+ top: 19px;
+}
+
+table.bt-grid-md thead th.bt-grid-select-all {
+ padding-bottom: 3px;
+}
+/* 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.bt-grid-bootstrap th.display-320,
+ TABLE.bt-grid-bootstrap td.display-320 {
+ display: table-cell;
+ }
+}
+/* Show at 480px (30em x 16px) */
+@media screen and (min-width: 30em) {
+ TABLE.bt-grid-bootstrap th.display-480,
+ TABLE.bt-grid-bootstrap td.display-480 {
+ display: table-cell;
+ }
+}
+/* Show at 640px (40em x 16px) */
+@media screen and (min-width: 40em) {
+ TABLE.bt-grid-bootstrap th.display-640,
+ TABLE.bt-grid-bootstrap td.display-640 {
+ display: table-cell;
+ }
+}
+/* Show at 800px (50em x 16px) */
+@media screen and (min-width: 50em) {
+ TABLE.bt-grid-bootstrap th.display-800,
+ TABLE.bt-grid-bootstrap td.display-800 {
+ display: table-cell;
+ }
+}
+/* Show at 960px (60em x 16px) */
+@media screen and (min-width: 60em) {
+ TABLE.bt-grid-bootstrap th.display-960,
+ TABLE.bt-grid-bootstrap td.display-960 {
+ display: table-cell;
+ }
+}
+/* Show at 1,120px (70em x 16px) */
+@media screen and (min-width: 70em) {
+ TABLE.bt-grid-bootstrap th.display-1120,
+ TABLE.bt-grid-bootstrap td.display-1120 {
+ display: table-cell;
+ }
+}
+
+/* Material Design Theme */
+.bt-grid-md tfoot tr th {
+ padding-right: 14px;
+}
+
+.bt-grid-md tfoot tr[data-role="pager"] .bt-grid-mdl-pager-label {
+ padding-left: 5px;
+ padding-right: 5px;
+}
+
+.bt-grid-md tfoot tr[data-role="pager"] .bt-dropdown-md {
+ margin-left: 12px;
+}
+
+.bt-grid-md tfoot tr[data-role="pager"] .bt-dropdown-md [role="presenter"] {
+ font-size: 12px;
+ font-weight: bold;
+ color: rgba(0,0,0,.54);
+}
+
+.bt-grid-md tfoot tr[data-role="pager"] .bt-dropdown-md [role="presenter"] [role="display"] {
+ text-align: right;
+}
+
+.bt-grid-md tfoot tr[data-role="pager"] .bt-grid-md-limit-select {
+ margin-left: 10px;
+ font-size: 12px;
+ font-weight: bold;
+ color: rgba(0,0,0,.54);
+}
+
+/* Bootstrap */
+.bt-grid-bootstrap tfoot tr[data-role="pager"] th {
+ line-height: 30px;
+ background-color: #f5f5f5;
+}
+
+.bt-grid-bootstrap tfoot tr[data-role="pager"] th > div > div {
+ margin-right: 5px;
+}
+
+.bt-grid-bootstrap tfoot tr[data-role="pager"] th > div > button {
+ margin-right: 5px;
+}
+
+.bt-grid-bootstrap-4 tfoot tr[data-role="pager"] th > div button {
+ height: 34px;
+}
+
+.bt-grid-bootstrap-4 tfoot tr[data-role="pager"] th div .bt-dropdown-bootstrap-4 .bt-dropdown-expander-mi .bt-icon {
+ top: 5px;
+}
+
+.bt-grid-bootstrap-3 tfoot tr[data-role="pager"] th > div > input {
+ margin-right: 5px;
+ width: 40px;
+ text-align: right;
+ display: inline-block;
+ font-weight: bold;
+}
+
+.bt-grid-bootstrap-4 tfoot tr[data-role="pager"] th > div > div.input-group {
+ width: 40px;
+}
+
+.bt-grid-bootstrap-4 tfoot tr[data-role="pager"] th > div > div.input-group input {
+ text-align: right;
+ font-weight: bold;
+ height: 34px;
+ padding-top: 2px;
+ padding-bottom: 6px;
+}
+
+.bt-grid-bootstrap tfoot tr[data-role="pager"] th > div > select {
+ display: inline-block;
+ margin-right: 5px;
+ width: 60px;
+}
+
+.bt-grid-bootstrap tfoot tr[data-role="pager"] th .bt-dropdown-bootstrap .bt-list-bootstrap [data-role="display"] {
+ line-height: 14px;
+}
+
+.bt-grid-bootstrap tfoot tr[data-role="pager"] th .bt-dropdown-bootstrap [role="presenter"] [role="display"] {
+ font-weight: bold;
+}
+
+.bt-grid-bootstrap tfoot tr[data-role="pager"] th .bt-dropdown-bootstrap-3 [role="presenter"] {
+ padding: 2px 8px;
+}
+
+.bt-grid-bootstrap tfoot tr[data-role="pager"] th .bt-dropdown-bootstrap-4 [role="presenter"] {
+ padding: 1px 8px;
+}
+.bt-grid thead tr th div.bt-grid-column-resizer-wrapper {
+ position: relative;
+ width: 100%;
+ height: 0px;
+ top: 0px;
+ left: 0px;
+ padding: 0px;
+}
+
+span.bt-grid-column-resizer {
+ position: absolute;
+ right: 0px;
+ width: 10px;
+ top: -100px;
+ height: 300px;
+ z-index: 1202;
+ cursor: e-resize;
+}
+
+.bt-grid-resize-cursor {
+ cursor: e-resize;
+}
+.bt-grid-md tbody tr.bt-grid-top-border td {
+ border-top: 2px solid #777;
+}
+.bt-grid-md tbody tr.bt-grid-bottom-border td {
+ border-bottom: 2px solid #777;
+}
+
+.bt-grid-bootstrap tbody tr.bt-grid-top-border td {
+ border-top: 2px solid #777;
+}
+.bt-grid-bootstrap tbody tr.bt-grid-bottom-border td {
+ border-bottom: 2px solid #777;
+}
+.bt-grid-md thead tr th.bt-grid-left-border,
+.bt-grid-md tbody tr td.bt-grid-left-border
+{
+ border-left: 3px solid #777;
+}
+.bt-grid-md thead tr th.bt-grid-right-border,
+.bt-grid-md tbody tr td.bt-grid-right-border
+{
+ border-right: 3px solid #777;
+}
+
+.bt-grid-bootstrap thead tr th.bt-grid-left-border,
+.bt-grid-bootstrap tbody tr td.bt-grid-left-border
+{
+ border-left: 5px solid #ddd;
+}
+.bt-grid-bootstrap thead tr th.bt-grid-right-border,
+.bt-grid-bootstrap tbody tr td.bt-grid-right-border
+{
+ border-right: 5px solid #ddd;
+}
+.bt-dirty {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ border-style: solid;
+ border-width: 3px;
+ border-color: #f00 transparent transparent #f00;
+ padding: 0;
+ overflow: hidden;
+ vertical-align: top;
+}
+
+/* Material Design */
+.bt-grid-md tbody tr td.bt-grid-management-column {
+ padding: 3px;
+}
+
+.bt-grid-md tbody tr td[data-mode="edit"] {
+ padding: 0px 18px;
+}
+
+.bt-grid-md tbody .bt-dropdown-md [role="presenter"] [role="display"] {
+ padding: 0px;
+}
+
+/* Bootstrap */
+.bt-grid-bootstrap tbody tr td[data-mode="edit"] {
+ padding: 0px;
+}
+
+.bt-grid-bootstrap tbody tr td[data-mode="edit"] [data-role="edit"] {
+ padding: 0px;
+}
+
+/* Bootstrap 3 */
+.bt-grid-bootstrap-3 tbody tr td.bt-grid-management-column {
+ padding: 3px;
+}
+
+.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] {
+ height: 38px;
+}
+
+.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] [data-role="edit"] input[type="text"] {
+ height: 37px;
+ padding: 8px;
+}
+
+.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] .bt-dropdown-bootstrap [role="presenter"] {
+ border: 0px;
+ border-radius: 0px;
+ height: 37px;
+ padding-left: 8px;
+}
+
+.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap {
+ height: 37px;
+}
+
+.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="input"] {
+ height: 37px;
+ border:0px;
+ border-radius: 0px;
+}
+
+.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="right-icon"] {
+ border:0px;
+ border-radius: 0px;
+}
+
+.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] .bt-checkbox-bootstrap {
+ display: inline-block;
+ padding-top: 10px;
+ height: 32px;
+}
+
+/* Bootstrap 4 */
+.bt-grid-bootstrap-4 tbody tr td.bt-grid-management-column {
+ padding: 6px;
+}
+
+.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] [data-role="edit"] input[type="text"] {
+ height: 48px;
+ padding-left: 12px;
+}
+
+.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-dropdown-bootstrap [role="presenter"] {
+ border: 0px;
+ border-radius: 0px;
+ height: 48px;
+ padding-left: 12px;
+ font-family: -apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
+}
+
+.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-dropdown-bootstrap-4 [role="expander"].bt-dropdown-expander-mi .bt-icon,
+.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-dropdown-bootstrap-4 [role="expander"].bt-dropdown-expander-mi .material-icons {
+ top: 13px;
+}
+
+.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap {
+ height: 48px;
+}
+
+.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="input"] {
+ height: 48px;
+ border:0px;
+ border-radius: 0px;
+}
+
+.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="right-icon"] {
+ background-color: #fff;
+}
+
+.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="right-icon"] button {
+ border: 0px;
+ border-radius: 0px;
+ width: 43px;
+ position: relative;
+}
+
+.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="right-icon"] .bt-icon,
+.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="right-icon"] .material-icons {
+ top: 13px;
+ left: 10px;
+ font-size: 24px;
+}
+
+.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-checkbox-bootstrap {
+ display: inline-block;
+ padding-top: 15px;
+ height: 42px;
+}
+.bt-grid-md thead tr[data-role="filter"] th {
+ border-top: 1px solid rgba(0,0,0,.12);
+}
+
+div.bt-grid-wrapper div.bt-grid-bootstrap-toolbar {
+ background-color: #f5f5f5;
+ padding: 8px;
+ font-weight: bold;
+ border: 1px solid #ddd;
+}
+
+div.bt-grid-wrapper div.bt-grid-bootstrap-4-toolbar {
+ background-color: #f5f5f5;
+ padding: 12px;
+ font-weight: bold;
+ border: 1px solid #ddd;
+}
+
+div.bt-grid-wrapper div.bt-grid-md-toolbar {
+ font-weight: bold;
+ font-size: 24px;
+ font-family: "Helvetica","Arial",sans-serif;
+ background-color: rgb(255, 255, 255);
+
+ border-top: 1px solid rgba(0,0,0,.12);
+ border-left: 1px solid rgba(0,0,0,.12);
+ border-right: 1px solid rgba(0,0,0,.12);
+ border-bottom: 0px;
+ border-collapse: collapse;
+
+ padding: 0 18px 0px 18px;
+ line-height: 56px;
+}
+table.bt-grid-scrollable tbody {
+ overflow-y: auto;
+ overflow-x: hidden;
+ display: block;
+}
+
+/* Material Design */
+table.bt-grid-md.bt-grid-scrollable {
+ border-bottom: 0px;
+}
+
+table.bt-grid-md.bt-grid-scrollable tbody {
+ border-right: 1px solid rgba(0,0,0,.12);
+ border-bottom: 1px solid rgba(0,0,0,.12);
+}
+
+table.bt-grid-md.bt-grid-scrollable tfoot {
+ border-bottom: 1px solid rgba(0,0,0,.12);
+}
+
+/* Bootstrap 3 */
+table.bt-grid-bootstrap.bt-grid-scrollable {
+ border-bottom: 0px;
+}
+
+table.bt-grid-bootstrap.bt-grid-scrollable tbody {
+ border-right: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+}
+
+table.bt-grid-bootstrap.bt-grid-scrollable tbody tr[data-role="row"]:first-child td {
+ border-top: 0px;
+}
+
+table.bt-grid-bootstrap.bt-grid-scrollable tbody tr[data-role="row"] td:first-child {
+ border-left: 0px;
+}
+
+table.bt-grid-bootstrap.bt-grid-scrollable tbody tr[data-role="row"] td:last-child {
+ border-right: 0px;
+}
+
+table.bt-grid-bootstrap.bt-grid-scrollable tfoot {
+ border-bottom: 1px solid #ddd;
+}
+
+ul.bt-list li [data-role="spacer"] {
+ display: table-cell;
+}
+
+ul.bt-list li [data-role="expander"] {
+ display: table-cell;
+ vertical-align:middle;
+ text-align:center;
+ cursor: pointer;
+}
+
+[data-type="tree"] ul li [data-role="expander"].bt-tree-material-icons-expander {
+ width: 24px;
+}
+
+[data-type="tree"] ul li [data-role="expander"].bt-tree-font-awesome-expander {
+ width: 24px;
+}
+
+[data-type="tree"] ul li [data-role="expander"].bt-tree-glyphicons-expander {
+ width: 24px;
+}
+
+[data-type="tree"] ul li [data-role="expander"].bt-tree-glyphicons-expander .glyphicon {
+ top: 4px;
+ height: 24px;
+}
+
+/* Bootstrap Theme */
+.bt-tree-bootstrap-3 ul.bt-list-bootstrap li {
+ border: 0px;
+ border-radius: 0px;
+ color: #333;
+}
+
+.bt-tree-bootstrap-3 ul.bt-list-bootstrap li.active {
+ color: #fff;
+}
+
+.bt-tree-bootstrap-3 ul.bt-list-bootstrap li.disabled {
+ color: #777;
+ background-color: #eee;
+}
+
+.bt-tree-bootstrap-4 ul.bt-list-bootstrap li {
+ border: 0px;
+ border-radius: 0px;
+ color: #212529;
+}
+
+.bt-tree-bootstrap-4 ul.bt-list-bootstrap li.active {
+ color: #fff;
+}
+
+.bt-tree-bootstrap-4 ul.bt-list-bootstrap li.disabled {
+ color: #868e96;
+}
+
+.bt-tree-bootstrap-4 ul.bt-list-bootstrap li ul.bt-list-bootstrap {
+ width: 100%;
+}
+
+.bt-tree-bootstrap-border ul.bt-list-bootstrap li {
+ border: 1px solid #ddd;
+}
+
+.bt-tree-bootstrap-border ul.bt-list-bootstrap li ul.bt-list-bootstrap li {
+ border-left: 0px;
+ border-right: 0px;
+}
+
+.bt-tree-bootstrap-border ul.bt-list-bootstrap li:first-child {
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+}
+
+.bt-tree-bootstrap-border ul.bt-list-bootstrap li:last-child {
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+}
+
+.bt-tree-bootstrap-border ul.bt-list-bootstrap li ul.bt-list-bootstrap li:first-child {
+ border-top-left-radius: 0px;
+ border-top-right-radius: 0px;
+}
+
+.bt-tree-bootstrap-border ul.bt-list-bootstrap li ul.bt-list-bootstrap li:last-child {
+ border-bottom: 0px;
+ border-bottom-left-radius: 0px;
+ border-bottom-right-radius: 0px;
+}
+
+ul.bt-list-bootstrap li [data-role="expander"].bt-tree-material-icons-expander {
+ padding-top: 8px;
+ padding-bottom: 4px;
+}
+
+ul.bt-list-bootstrap li [data-role="expander"].bt-tree-material-icons-expander .bt-icon {
+ width: 24px;
+ height: 24px;
+}
+
+/* Material Design Theme */
+ul.bt-list-md li.disabled > [data-role="wrapper"] > [data-role="expander"] {
+ color: #9E9E9E; /* Gray 500 */
+}
+
+.bt-tree-md-border ul.bt-list-md li {
+ border: 1px solid #616161; /* Gray 700 */
+ margin-bottom: -1px;
+}
+
+.bt-tree-md-border ul.bt-list-md li ul.bt-list-md li {
+ border-left: 0px;
+ border-right: 0px;
+}
+
+.bt-tree-md-border ul.bt-list-md li ul.bt-list-md li:last-child {
+ border-bottom: 0px;
+}
+.bt-tree-drop-above {
+ border-top: 1px solid #000;
+}
+
+.bt-tree-drop-below {
+ border-bottom: 1px solid #000;
+}
+
+.bt-tree-bootstrap-3 ul.bt-list-bootstrap li [data-role="wrapper"].drop-above {
+ border-top: 2px solid #000;
+}
+
+.bt-tree-bootstrap-3 ul.bt-list-bootstrap li [data-role="wrapper"].drop-below {
+ border-bottom: 2px solid #000;
+}
+
+.bt-tree-bootstrap-4 ul.bt-list-bootstrap li [data-role="wrapper"].drop-above {
+ border-top: 2px solid #000;
+}
+
+.bt-tree-bootstrap-4 ul.bt-list-bootstrap li [data-role="wrapper"].drop-below {
+ border-bottom: 2px solid #000;
+}
+
+.bt-tree-drag-el {
+ padding: 0px;
+ margin: 0px;
+ z-index: 1203;
+}
+
+.bt-tree-drag-el li {
+ padding: 0px;
+ margin: 0px;
+}
+
+.bt-tree-drag-el [data-role="wrapper"] {
+ cursor: move;
+ display: table;
+}
+
+.bt-tree-drag-el [data-role="indicator"] {
+ width: 14px;
+ padding: 0px 3px;
+ display: table-cell;
+ vertical-align: middle;
+ text-align: center;
+}
+
+.bt-tree-bootstrap-drag-el li.list-group-item {
+ border: 0px;
+ background: unset;
+}
+
+.bt-tree-bootstrap-drag-el [data-role="indicator"] {
+ width: 24px;
+ height: 24px;
+ padding: 0px;
+}
+
+.bt-tree-md-drag-el [data-role="indicator"] {
+ width: 24px;
+ height: 24px;
+ padding: 0px;
+}
+/* Bootstrap */
+.bt-checkbox-bootstrap {
+ min-width: 0;
+ font-size: 0;
+ font-weight: normal;
+ margin: 0px;
+ text-align: center;
+ width: 18px;
+ height: 18px;
+ position: relative;
+ display: inline;
+}
+
+.bt-checkbox-bootstrap input[type="checkbox"] {
+ display: none;
+ margin-bottom: -12px;
+}
+
+.bt-checkbox-bootstrap span {
+ background: #fff;
+ display: block;
+ content: " ";
+ width: 18px;
+ height: 18px;
+ line-height: 11px;
+ font-size: 11px;
+ padding: 2px;
+ color: #555555;
+ border: 1px solid #CCCCCC;
+ border-radius: 3px;
+ transition: box-shadow 0.2s linear, border-color 0.2s linear;
+ cursor: pointer;
+ margin: auto;
+}
+
+.bt-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;
+}
+
+.bt-checkbox-bootstrap input[type="checkbox"][disabled] + span {
+ opacity: 0.6;
+ cursor: not-allowed;
+}
+
+/* Bootstrap 4 */
+.bt-checkbox-bootstrap.bt-checkbox-bootstrap-4 span {
+ line-height: 16px;
+ padding: 0px;
+}
+
+.bt-checkbox-bootstrap-4.bt-checkbox-material-icons input[type="checkbox"]:checked + span:after {
+ font-size: 16px;
+}
+
+.bt-checkbox-bootstrap-4.bt-checkbox-material-icons input[type="checkbox"]:indeterminate + span:after {
+ font-size: 16px;
+}
+
+/* Material Design */
+.bt-checkbox-md {
+ min-width: 0;
+ font-size: 0;
+ font-weight: normal;
+ margin: 0px;
+ text-align: center;
+ width: 16px;
+ height: 16px;
+ position: relative;
+}
+
+.bt-checkbox-md input[type="checkbox"] {
+ display: none;
+ margin-bottom: -12px;
+}
+
+.bt-checkbox-md span {
+ display: inline-block;
+ box-sizing: border-box;
+ width: 16px;
+ height: 16px;
+ margin: 0;
+ cursor: pointer;
+ overflow: hidden;
+ border: 2px solid #616161; /* Gray 700 */
+ border-radius: 2px;
+ z-index: 2;
+}
+
+.bt-checkbox-md input[type="checkbox"]:checked + span {
+ border: 2px solid #536DFE; /* Indigo A200 */
+}
+
+.bt-checkbox-md input[type="checkbox"]:checked + span:after {
+ color: #FFF;
+ background-color: #536DFE; /* Indigo A200 */
+ position: absolute;
+ left: 1px;
+ top: -15px;
+}
+
+.bt-checkbox-md input[type="checkbox"]:indeterminate + span {
+ border: 2px solid #616161; /* Gray 700 */
+}
+
+.bt-checkbox-md input[type="checkbox"]:indeterminate + span:after {
+ color: #616161;/*color: rgba(0, 0, 0, 1);*/
+ position: absolute;
+ left: 1px;
+ top: -15px;
+}
+
+.bt-checkbox-md input[type="checkbox"][disabled] + span {
+ border: 2px solid #9E9E9E;
+}
+
+.bt-checkbox-md input[type="checkbox"][disabled] + span:after {
+ background-color: #9E9E9E;
+}
+
+.bt-checkbox-md input[type="checkbox"][disabled]:indeterminate + span:after {
+ color: #FFFFFF;
+}
+
+/* Material Icons */
+.bt-checkbox-material-icons input[type="checkbox"]:checked + span:after {
+ content: "\e91f";
+ font-size: 14px;
+ font-weight: bold;
+ white-space: pre;
+}
+
+.bt-checkbox-material-icons input[type="checkbox"]:indeterminate + span:after {
+ content: "\e921";
+ font-size: 14px;
+ font-weight: bold;
+ white-space: pre;
+}
+
+/* Glyphicons */
+.bt-checkbox-glyphicons input[type="checkbox"]:checked + span:after {
+ display: inline-block;
+ font-family: 'Glyphicons Halflings';
+ content: "\e013 ";
+}
+
+.bt-checkbox-glyphicons input[type="checkbox"]:indeterminate + span:after {
+ display: inline-block;
+ font-family: 'Glyphicons Halflings';
+ content: "\2212 ";
+ padding-right: 1px;
+}
+
+/* fontawesome */
+.bt-checkbox-fontawesome .fa {
+ font-size: 14px;
+}
+
+.bt-checkbox-fontawesome input[type="checkbox"]:checked + span:before {
+ content: "\f00c ";
+}
+
+.bt-checkbox-fontawesome input[type="checkbox"]:indeterminate + span:before {
+ content: "\f068 ";
+}
+.bt-editor [role="body"] {
+ overflow: auto;
+ outline: 0px solid transparent;
+ box-sizing: border-box;
+}
+
+/* Material Design */
+.bt-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);
+}
+
+.bt-editor-md [role="toolbar"] {
+ margin-bottom: 7px;
+}
+
+.bt-editor-md [role="toolbar"] .bt-button-md {
+ min-width: 54px;
+ margin-right: 5px;
+}
+
+.bt-editor-md [role="toolbar"] .bt-button-md .bt-icon {
+ width: 24px;
+ height: 24px;
+}
+
+.bt-editor-md [role="body"] {
+ border: 1px solid rgba(158,158,158,.2);
+}
+
+.bt-editor-md p {
+ margin: 0;
+ padding: 0;
+}
+
+.bt-editor-md blockquote {
+ font-size: 14px;
+}
+
+/* Bootstrap */
+.bt-editor-bootstrap {
+ padding: 7px;
+ border: 1px solid #eceeef;
+}
+
+.bt-editor-bootstrap [role="toolbar"] {
+ margin-bottom: 7px;
+}
+
+.bt-editor-bootstrap [role="toolbar"] .btn-group {
+ margin-right: 10px;
+}
+
+.bt-editor-bootstrap [role="toolbar"] button {
+ height: 36px;
+}
+
+.bt-editor-bootstrap [role="body"] {
+ border: 1px solid #eceeef;
+}
+
+.bt-editor-bootstrap p {
+ margin: 0;
+ padding: 0;
+}
+
+.bt-editor-bootstrap blockquote {
+ font-size: 14px;
+}
+.bt-dropdown {
+ position: relative;
+ border-collapse: separate;
+}
+
+.bt-dropdown [role="presenter"] {
+ display: table;
+ cursor: pointer;
+ outline: none;
+ position: relative;
+}
+
+.bt-dropdown [role="presenter"] [role="display"] {
+ display: table-cell;
+ text-align: left;
+ width: 100%;
+}
+
+.bt-dropdown [role="presenter"] [role="expander"] {
+ display: table-cell;
+ vertical-align:middle;
+ text-align:center;
+ width: 24px;
+ height: 24px;
+}
+
+/* Material Design */
+.bt-dropdown-md [role="presenter"] {
+ font-family: "Roboto","Helvetica","Arial",sans-serif;
+ font-size: 16px;
+ font-weight: 400;
+ letter-spacing: .04em;
+ line-height: 1;
+ color: rgba(0,0,0,.87);
+ padding: 0px;
+ border: 0px;
+ border-bottom: 1px solid rgba(0,0,0,.42);
+ background: transparent;
+}
+
+.bt-dropdown-md [role="presenter"]:focus,
+.bt-dropdown-md [role="presenter"]:active {
+ border-bottom: 2px solid rgba(0,0,0,.42);
+}
+
+.bt-dropdown-md [role="presenter"] [role="display"] {
+ padding: 4px 0px;
+ line-height: 18px;
+}
+
+.bt-dropdown-md [role="presenter"] [role="display"] .placeholder {
+ color: #8e8e8e;
+}
+
+.bt-dropdown-list-md {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ background-color: #f5f5f5;
+ color: #000;
+ margin: 0px;
+ z-index: 1202;
+}
+
+.bt-dropdown-list-md li:hover, .bt-dropdown-list-md li.active {
+ background-color: #eee;
+}
+
+/* Bootstrap */
+.bt-dropdown-bootstrap [role="presenter"] [role="display"] {
+ padding-right: 5px;
+}
+
+.bt-dropdown-bootstrap [role="presenter"] [role="expander"] {
+ padding-left: 5px;
+}
+
+.bt-dropdown-bootstrap [role="presenter"] [role="expander"].bt-dropdown-expander-mi {
+ width: 24px;
+}
+
+.bt-dropdown-bootstrap-3 [role="presenter"] [role="display"] {
+ line-height: 20px;
+}
+
+.bt-dropdown-bootstrap-3 [role="presenter"] [role="display"] .placeholder {
+ color: #9999b3;
+}
+
+.bt-dropdown-bootstrap-3 [role="presenter"] [role="expander"] {
+ width: 20px;
+ height: 20px;
+}
+
+.bt-dropdown-bootstrap-3 [role="presenter"] [role="expander"].bt-dropdown-expander-mi .bt-icon,
+.bt-dropdown-bootstrap-3 [role="presenter"] [role="expander"].bt-dropdown-expander-mi .material-icons {
+ top: 5px;
+ right: 10px;
+ position: absolute;
+}
+
+.bt-dropdown-bootstrap-4 [role="presenter"] {
+ border: 1px solid #ced4da;
+}
+
+.bt-dropdown-bootstrap-4 [role="presenter"] [role="display"] {
+ line-height: 24px;
+}
+
+.bt-dropdown-bootstrap-4 [role="presenter"] [role="expander"].bt-dropdown-expander-mi .bt-icon,
+.bt-dropdown-bootstrap-4 [role="presenter"] [role="expander"].bt-dropdown-expander-mi .material-icons {
+ top: 7px;
+ right: 10px;
+ position: absolute;
+}
+
+.bt-dropdown-list-bootstrap {
+ position: absolute;
+ top: 32px;
+ left: 0px;
+ margin: 0px;
+ z-index: 1202;
+}
+.bt-datepicker [role="input"]::-ms-clear {
+ display: none;
+}
+
+.bt-datepicker [role="right-icon"] {
+ cursor: pointer;
+}
+
+.bt-picker div[role="navigator"] {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+}
+
+.bt-picker div[role="navigator"] div {
+ cursor: pointer;
+ position: relative;
+ flex-basis: 0;
+ -webkit-box-flex: 1;
+ -ms-flex-positive: 1;
+ flex-grow: 1;
+ max-width: 100%;
+}
+
+.bt-picker div[role="navigator"] div[role="period"] {
+ width: 100%;
+ text-align: center;
+}
+
+/* Material Design */
+.bt-datepicker-md {
+ font-family: "Roboto","Helvetica","Arial",sans-serif;
+ font-size: 16px;
+ font-weight: 400;
+ letter-spacing: .04em;
+ line-height: 1;
+ color: rgba(0,0,0,.87);
+ position: relative;
+}
+
+.bt-datepicker-md [role="right-icon"] {
+ cursor: pointer;
+ position: absolute;
+ right: 0px;
+ top: 0px;
+ font-size: 24px;
+}
+
+.bt-datepicker-md.small .bt-textbox-md {
+ font-size: 14px;
+}
+
+.bt-datepicker-md.small .bt-icon {
+ font-size: 22px;
+}
+
+.bt-datepicker-md.large .bt-textbox-md {
+ font-size: 18px;
+}
+
+.bt-datepicker-md.large .bt-icon {
+ font-size: 28px;
+}
+
+.bt-picker-md.datepicker [role="header"] {
+ padding: 20px 20px;
+ display: block;
+}
+
+.bt-picker-md.datepicker [role="header"] [role="year"] {
+ font-size: 17px;
+ padding-bottom: 5px;
+ cursor: pointer;
+}
+
+.bt-picker-md.datepicker [role="header"] [role="date"] {
+ font-size: 36px;
+ cursor: pointer;
+}
+
+.bt-picker-md div[role="navigator"] {
+ height: 42px;
+ line-height: 42px;
+}
+
+.bt-picker div[role="navigator"] div[role="period"] {
+ font-weight: bold;
+ font-size: 15px;
+}
+
+.bt-picker-md div[role="navigator"] div:first-child {
+ max-width: 42px;
+}
+
+.bt-picker-md div[role="navigator"] div:last-child {
+ max-width: 42px;
+}
+
+.bt-picker-md div[role="navigator"] div i.bt-icon,
+.bt-picker-md div[role="navigator"] div i.material-icons {
+ position: absolute;
+ top: 8px;
+}
+
+.bt-picker-md div[role="navigator"] div:first-child i.bt-icon,
+.bt-picker-md div[role="navigator"] div:first-child i.material-icons {
+ left: 10px;
+}
+
+.bt-picker-md div[role="navigator"] div:last-child i.bt-icon,
+.bt-picker-md div[role="navigator"] div:last-child i.material-icons {
+ right: 11px;
+}
+
+.bt-picker-md table thead {
+ color: #9E9E9E; /* Gray 500 */
+}
+
+.bt-picker-md table tr th div,
+.bt-picker-md table tr td div {
+ display: block;
+ width: 40px;
+ height: 40px;
+ line-height: 40px;
+ font-size: 13px;
+ text-align: center;
+ vertical-align: middle;
+}
+
+[type="year"].bt-picker-md table tr td div,
+[type="decade"].bt-picker-md table tr td div,
+[type="century"].bt-picker-md table tr td div {
+ width: 73px;
+ height: 73px;
+ line-height: 73px;
+ cursor: pointer;
+}
+
+.bt-picker-md table tr td.bt-cursor-pointer div:hover {
+ background: #EEEEEE;
+ border-radius: 50%;
+ color: rgba(0,0,0,.87);
+}
+
+.bt-picker-md table tr td.other-month div,
+.bt-picker-md table tr td.disabled div {
+ color: #BDBDBD; /* Gray 400 */
+}
+
+.bt-picker-md table tr td.focused div {
+ background: #E0E0E0; /* Gray 300 */
+ border-radius: 50%;
+}
+
+.bt-picker-md table tr td.today div {
+ color: #1976D2;
+}
+
+.bt-picker-md table tr td.selected.bt-cursor-pointer div {
+ color: #FFFFFF;
+ background: #1976D2; /* Blue 700 */
+ border-radius: 50%;
+}
+
+.bt-picker-md table tr td.calendar-week div {
+ font-weight: bold;
+}
+
+/* Bootstrap */
+.bt-datepicker-bootstrap :focus,
+.bt-datepicker-bootstrap :active {
+ box-shadow: none;
+}
+
+.bt-picker-bootstrap {
+ border: 1px solid rgba(0,0,0,0.15);
+ border-radius: 4px;
+ padding: 4px;
+}
+
+.bt-modal .bt-picker-bootstrap {
+ padding: 0px;
+}
+
+.bt-picker-bootstrap.datepicker [role="header"] {
+ padding: 10px 20px;
+ display: block;
+}
+
+.bt-picker-bootstrap.datepicker [role="header"] [role="year"] {
+ font-size: 15px;
+ cursor: pointer;
+}
+
+.bt-picker-bootstrap [role="header"] [role="date"] {
+ font-size: 24px;
+ cursor: pointer;
+}
+
+.bt-modal .bt-picker-bootstrap.datepicker [role="body"] {
+ padding: 15px;
+}
+
+.bt-picker-bootstrap div[role="navigator"] {
+ height: 30px;
+ line-height: 30px;
+ text-align: center;
+}
+
+.bt-picker-bootstrap div[role="navigator"] div:first-child {
+ max-width: 30px;
+}
+
+.bt-picker-bootstrap div[role="navigator"] div:last-child {
+ max-width: 30px;
+}
+
+.bt-picker-bootstrap table tr td div,
+.bt-picker-bootstrap table tr th div {
+ display: block;
+ width: 30px;
+ height: 30px;
+ line-height: 30px;
+ text-align: center;
+ vertical-align: middle;
+}
+
+[type="year"].bt-picker-bootstrap table tr td div,
+[type="decade"].bt-picker-bootstrap table tr td div,
+[type="century"].bt-picker-bootstrap table tr td div {
+ width: 53px;
+ height: 53px;
+ line-height: 53px;
+ cursor: pointer;
+}
+
+.bt-picker-bootstrap table tr th div i,
+.bt-picker-bootstrap table tr th div span {
+ line-height: 30px;
+}
+
+.bt-picker-bootstrap div[role="navigator"] .bt-icon,
+.bt-picker-bootstrap div[role="navigator"] .material-icons {
+ margin: 3px;
+}
+
+.bt-picker-bootstrap table tr td.focused div,
+.bt-picker-bootstrap table tr td.bt-cursor-pointer div:hover {
+ background: #EEEEEE;
+ border-radius: 4px;
+ color: #212529;
+}
+
+.bt-picker-bootstrap table tr td.today div {
+ color: #204d74;
+ font-weight: bold;
+}
+
+.bt-picker-bootstrap table tr td.selected.bt-cursor-pointer div {
+ color: #fff;
+ background-color: #204d74;
+ border-color: #122b40;
+ border-radius: 4px;
+}
+
+.bt-picker-bootstrap table tr td.other-month div,
+.bt-picker-bootstrap table tr td.disabled div {
+ color: #777;
+}
+
+/* Bootstrap 3 */
+.bt-datepicker-bootstrap span[role="right-icon"].input-group-addon {
+ border-top-left-radius: 0px;
+ border-bottom-left-radius: 0px;
+ border-top-right-radius: 4px;
+ border-bottom-right-radius: 4px;
+ border-left: 0px;
+ position: relative;
+ /*width: 38px;*/
+}
+
+.bt-datepicker-bootstrap span[role="right-icon"].input-group-addon .bt-icon,
+.bt-datepicker-bootstrap span[role="right-icon"].input-group-addon .material-icons {
+ position: absolute;
+ top: 7px;
+ left: 7px;
+}
+
+/* Bootstrap 4 */
+.bt-datepicker-bootstrap [role="right-icon"] button {
+ width: 38px;
+ position: relative;
+ border: 1px solid #ced4da;
+}
+
+.bt-datepicker-bootstrap [role="right-icon"] button:hover {
+ color: #6c757d;
+ background-color: transparent;
+}
+
+.bt-datepicker-bootstrap.input-group-sm [role="right-icon"] button {
+ width: 30px;
+}
+
+.bt-datepicker-bootstrap.input-group-lg [role="right-icon"] button {
+ width: 48px;
+}
+
+.bt-datepicker-bootstrap [role="right-icon"] button .bt-icon,
+.bt-datepicker-bootstrap [role="right-icon"] button .material-icons {
+ position: absolute;
+ font-size: 21px;
+ top: 9px;
+ left: 9px;
+}
+
+.bt-datepicker-bootstrap.input-group-sm [role="right-icon"] button .bt-icon,
+.bt-datepicker-bootstrap.input-group-sm [role="right-icon"] button .material-icons {
+ top: 6px;
+ left: 6px;
+ font-size: 19px;
+}
+
+.bt-datepicker-bootstrap.input-group-lg [role="right-icon"] button .bt-icon,
+.bt-datepicker-bootstrap.input-group-lg [role="right-icon"] button .material-icons {
+ font-size: 27px;
+ top: 10px;
+ left: 10px;
+}
+.bt-timepicker [role="input"]::-ms-clear {
+ display: none;
+}
+
+.bt-timepicker [role="right-icon"] {
+ cursor: pointer;
+}
+
+.bt-picker.timepicker [role="header"] {
+ font-size: 58px;
+ padding: 20px 0;
+ line-height: 58px;
+
+ display: flex;
+ align-items: baseline;
+ user-select: none;
+ justify-content: center;
+}
+
+.bt-picker.timepicker [role="header"] div {
+ cursor: pointer;
+ width: 66px;
+ text-align: right;
+}
+
+.bt-picker [role="header"] [role="mode"] {
+ position: relative;
+ width: 0px;
+}
+
+.bt-picker [role="header"] [role="mode"] span {
+ position: absolute;
+ left: 7px;
+ line-height: 18px;
+ font-size: 18px;
+}
+
+.bt-picker [role="header"] [role="mode"] span[role="am"] {
+ top: 7px;
+}
+
+.bt-picker [role="header"] [role="mode"] span[role="pm"] {
+ bottom: 7px;
+}
+
+.bt-picker [role="body"] [role="dial"] {
+ width: 256px;
+ color: rgba(0, 0, 0, 0.87);
+ height: 256px;
+ position: relative;
+ background: #eeeeee;
+ border-radius: 50%;
+ margin: 10px;
+}
+
+.bt-picker [role="body"] [role="hour"] {
+ top: calc(50% - 16px);
+ left: calc(50% - 16px);
+ width: 32px;
+ height: 32px;
+ cursor: pointer;
+ position: absolute;
+ font-size: 14px;
+ text-align: center;
+ line-height: 32px;
+ user-select: none;
+ pointer-events: none;
+}
+
+.bt-picker [role="body"] [role="hour"].selected {
+ color: rgba(255, 255, 255, 1);
+}
+
+.bt-picker [role="body"] [role="arrow"] {
+ top: calc(50% - 1px);
+ left: 50%;
+ width: calc(50% - 20px);
+ height: 2px;
+ position: absolute;
+ pointer-events: none;
+ transform-origin: left center;
+ transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
+ width: calc(50% - 52px);
+}
+
+.bt-picker .arrow-begin {
+ top: -3px;
+ left: -4px;
+ width: 8px;
+ height: 8px;
+ position: absolute;
+ border-radius: 50%;
+}
+
+.bt-picker .arrow-end {
+ top: -15px;
+ right: -16px;
+ width: 0;
+ height: 0;
+ position: absolute;
+ box-sizing: content-box;
+ border-width: 16px;
+ border-radius: 50%;
+}
+
+/* Material Design */
+.bt-timepicker-md {
+ font-family: "Roboto","Helvetica","Arial",sans-serif;
+ font-size: 16px;
+ font-weight: 400;
+ letter-spacing: .04em;
+ line-height: 1;
+ color: rgba(0,0,0,.87);
+ position: relative;
+}
+
+.bt-timepicker-md.small .bt-textbox-md {
+ font-size: 14px;
+}
+
+.bt-timepicker-md.small .bt-icon {
+ font-size: 22px;
+}
+
+.bt-timepicker-md.large .bt-textbox-md {
+ font-size: 18px;
+}
+
+.bt-timepicker-md.large .bt-icon {
+ font-size: 28px;
+}
+
+.bt-timepicker-md [role="right-icon"] {
+ cursor: pointer;
+ position: absolute;
+ right: 0px;
+ top: 0px;
+ font-size: 24px;
+}
+
+.bt-picker-md .arrow-begin {
+ background-color: #2196f3;
+}
+.bt-picker-md .arrow-end {
+ border: 16px solid #2196f3;
+}
+
+.bt-picker-md [role="body"] [role="arrow"] {
+ background-color: #2196f3;
+}
+
+/* Bootstrap */
+.bt-timepicker-bootstrap :focus,
+.bt-timepicker-bootstrap :active {
+ box-shadow: none;
+}
+
+.bt-picker-bootstrap [role="body"] [role="arrow"] {
+ background-color: #888;
+}
+
+.bt-picker-bootstrap .arrow-begin {
+ background-color: #888;
+}
+
+.bt-picker-bootstrap .arrow-end {
+ border: 16px solid #888;
+}
+
+/* Bootstrap 3 */
+.bt-timepicker-bootstrap .input-group-addon {
+ border-top-left-radius: 0px;
+ border-bottom-left-radius: 0px;
+ border-top-right-radius: 4px;
+ border-bottom-right-radius: 4px;
+ border-left: 0px;
+ position: relative;
+ width: 38px;
+}
+
+.bt-timepicker-bootstrap.input-group-sm .input-group-addon {
+ width: 30px;
+}
+
+.bt-timepicker-bootstrap.input-group-lg .input-group-addon {
+ width: 46px;
+}
+
+.bt-timepicker-bootstrap .input-group-addon .bt-icon,
+.bt-timepicker-bootstrap .input-group-addon .material-icons {
+ position: absolute;
+ font-size: 21px;
+ top: 6px;
+ left: 8px;
+}
+
+.bt-timepicker-bootstrap.input-group-sm .input-group-addon .bt-icon,
+.bt-timepicker-bootstrap.input-group-sm .input-group-addon .material-icons {
+ font-size: 19px;
+ top: 5px;
+ left: 5px;
+}
+
+.bt-timepicker-bootstrap.input-group-lg .input-group-addon .bt-icon,
+.bt-timepicker-bootstrap.input-group-lg .input-group-addon .material-icons {
+ font-size: 27px;
+ top: 10px;
+ left: 10px;
+}
+
+/* Bootstrap 4 */
+.bt-timepicker-bootstrap [role="right-icon"] button {
+ width: 38px;
+ position: relative;
+}
+
+.bt-timepicker-bootstrap.input-group-sm [role="right-icon"] button {
+ width: 30px;
+}
+
+.bt-timepicker-bootstrap.input-group-lg [role="right-icon"] button {
+ width: 48px;
+}
+
+.bt-timepicker-bootstrap [role="right-icon"] button .bt-icon,
+.bt-timepicker-bootstrap [role="right-icon"] button .material-icons {
+ position: absolute;
+ font-size: 21px;
+ top: 7px;
+ left: 9px;
+}
+
+.bt-timepicker-bootstrap.input-group-sm [role="right-icon"] button .bt-icon,
+.bt-timepicker-bootstrap.input-group-sm [role="right-icon"] button .material-icons {
+ top: 4px;
+ left: 6px;
+ font-size: 19px;
+}
+
+.bt-timepicker-bootstrap.input-group-lg [role="right-icon"] button .bt-icon,
+.bt-timepicker-bootstrap.input-group-lg [role="right-icon"] button .material-icons {
+ font-size: 27px;
+ top: 8px;
+ left: 10px;
+}
+.bt-picker.datetimepicker [role="header"] [role="date"] {
+ padding-bottom: 5px;
+ text-align: center;
+ cursor: pointer;
+}
+
+.bt-picker [role="switch"] {
+ align-items: baseline;
+ user-select: none;
+ position: relative;
+}
+
+.bt-picker [role="switch"] [role="calendarMode"] {
+ cursor: pointer;
+ position: absolute;
+ bottom: 2px;
+ left: 0px;
+}
+
+.bt-picker [role="switch"] [role="time"] {
+ width: 100%;
+ text-align: center;
+}
+
+.bt-picker [role="switch"] [role="time"] div {
+ display: inline;
+ cursor: pointer;
+}
+
+.bt-picker [role="switch"] [role="calendarMode"] {
+ cursor: pointer;
+}
+
+.bt-picker [role="switch"] [role="clockMode"] {
+ position: absolute;
+ right: 0px;
+ bottom: 3px;
+ cursor: pointer;
+}
+
+/* Material Design */
+.bt-picker-md.datetimepicker [role="header"] {
+ font-size: 36px;
+ padding: 10px 20px;
+ display: block;
+}
+
+.bt-picker-md [role="switch"] {
+ color: rgba(255, 255, 255, 0.54);
+ background: #2196f3;
+ font-size: 32px;
+}
+
+/* Bootstrap */
+.bt-picker-bootstrap.datetimepicker [role="header"] {
+ font-size: 36px;
+ padding: 10px 20px;
+ display: block;
+}
+
+.bt-picker-bootstrap.datetimepicker [role="header"] [role="time"] {
+ font-size: 22px;
+}
+
+.bt-slider {
+ position: relative;
+ padding: 8px 6px;
+}
+
+.bt-slider [role="track"] {
+ width: 100%;
+}
+
+.bt-slider [role="progress"] {
+ position: absolute;
+ z-index: 1001;
+}
+
+.bt-slider [role="handle"] {
+ position: absolute;
+}
+
+.bt-slider-md [role="track"] {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-orient: vertical;
+ -webkit-box-direction: normal;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -webkit-box-pack: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+ color: #fff;
+ text-align: center;
+ background-color: #e9ecef;
+ height: 2px;
+ background-color: rgba(0,0,0,.26);
+}
+
+.bt-slider-md [role="progress"] {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-orient: vertical;
+ -webkit-box-direction: normal;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -webkit-box-pack: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+ color: #fff;
+ text-align: center;
+ height: 2px;
+ background-color: #536DFE; /* Indigo A200 */
+ top: 8px;
+ left: 6px;
+}
+
+.bt-slider-md [role="handle"] {
+ top: 3px;
+ left: 0px;
+ width: 12px;
+ height: 12px;
+ background-color: #536DFE; /* Indigo A200 */
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
+ filter: none;
+ -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
+ box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
+ border: 0px solid transparent;
+ border-radius: 50%;
+ cursor: pointer;
+ z-index: 1002;
+}
+
+/* Bootstrap */
+.bt-slider-bootstrap [role="track"] {
+ border-radius: 4px;
+ height: 10px;
+}
+
+.bt-slider-bootstrap [role="progress"] {
+ height: 10px;
+ border-radius: 4px;
+ top: 8px;
+ left: 6px;
+ transition: none;
+}
+
+.bt-slider-bootstrap [role="handle"] {
+ top: 2px;
+ left: 0px;
+ width: 20px;
+ height: 20px;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
+ filter: none;
+ -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
+ box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
+ border: 0px solid transparent;
+ border-radius: 50%;
+ cursor: pointer;
+ z-index: 1002;
+}
+
+.bt-slider-bootstrap-3 [role="handle"] {
+ background-color: #337ab7;
+ background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
+ background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
+ background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
+ background-repeat: repeat-x;
+}
+
+.bt-slider-bootstrap-4 [role="handle"] {
+ background-color: #007bff;
+ background-image: -webkit-linear-gradient(top, #007bff 0%, #2e6da4 100%);
+ background-image: -o-linear-gradient(top, #007bff 0%, #2e6da4 100%);
+ background-image: linear-gradient(to bottom, #007bff 0%, #2e6da4 100%);
+ background-repeat: repeat-x;
+}
\ No newline at end of file
diff --git a/dist/bootree.js b/dist/bootree.js
new file mode 100644
index 0000000..85b427d
--- /dev/null
+++ b/dist/bootree.js
@@ -0,0 +1,16962 @@
+/*
+ * BooTree JavaScript Library v1.9.6
+ * https://jaideepghosh.github.io/BooTree/
+ *
+ */
+var bt = {};
+
+bt.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;
+ };
+};
+
+bt.widget.prototype.init = function (jsConfig, type) {
+ var option, clientConfig, fullConfig;
+
+ this.attr('data-type', type);
+ 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 (bt[type].events.hasOwnProperty(option)) {
+ this.on(option, fullConfig[option]);
+ delete fullConfig[option];
+ }
+ }
+
+ // Initialize all plugins
+ for (plugin in bt[type].plugins) {
+ if (bt[type].plugins.hasOwnProperty(plugin)) {
+ bt[type].plugins[plugin].configure(this, fullConfig, clientConfig);
+ }
+ }
+
+ return this;
+};
+
+bt.widget.prototype.getConfig = function (clientConfig, type) {
+ var config, uiLibrary, iconsLibrary, plugin;
+
+ config = $.extend(true, {}, bt[type].config.base);
+
+ uiLibrary = clientConfig.hasOwnProperty('uiLibrary') ? clientConfig.uiLibrary : config.uiLibrary;
+ if (bt[type].config[uiLibrary]) {
+ $.extend(true, config, bt[type].config[uiLibrary]);
+ }
+
+ iconsLibrary = clientConfig.hasOwnProperty('iconsLibrary') ? clientConfig.iconsLibrary : config.iconsLibrary;
+ if (bt[type].config[iconsLibrary]) {
+ $.extend(true, config, bt[type].config[iconsLibrary]);
+ }
+
+ for (plugin in bt[type].plugins) {
+ if (bt[type].plugins.hasOwnProperty(plugin)) {
+ $.extend(true, config, bt[type].plugins[plugin].config.base);
+ if (bt[type].plugins[plugin].config[uiLibrary]) {
+ $.extend(true, config, bt[type].plugins[plugin].config[uiLibrary]);
+ }
+ if (bt[type].plugins[plugin].config[iconsLibrary]) {
+ $.extend(true, config, bt[type].plugins[plugin].config[iconsLibrary]);
+ }
+ }
+ }
+
+ $.extend(true, config, clientConfig);
+
+ if (!config.guid) {
+ config.guid = this.generateGUID();
+ }
+
+ return config;
+}
+
+bt.widget.prototype.getHTMLConfig = function () {
+ var result = this.data(),
+ attrs = this[0].attributes;
+ if (attrs['width']) {
+ result.width = attrs['width'].value;
+ }
+ if (attrs['height']) {
+ result.height = attrs['height'].value;
+ }
+ if (attrs['value']) {
+ result.value = attrs['value'].value;
+ }
+ if (attrs['align']) {
+ result.align = attrs['align'].value;
+ }
+ if (result && result.source) {
+ result.dataSource = result.source;
+ delete result.source;
+ }
+ return result;
+};
+
+bt.widget.prototype.createDoneHandler = function () {
+ var $widget = this;
+ return function (response) {
+ if (typeof (response) === 'string' && JSON) {
+ response = JSON.parse(response);
+ }
+ bt[$widget.data('type')].methods.render($widget, response);
+ };
+};
+
+bt.widget.prototype.createErrorHandler = function () {
+ var $widget = this;
+ return function (response) {
+ if (response && response.statusText && response.statusText !== 'abort') {
+ alert(response.statusText);
+ }
+ };
+};
+
+bt.widget.prototype.reload = function (params) {
+ var ajaxOptions, result, data = this.data(), type = this.data('type');
+ if (data.dataSource === undefined) {
+ bt[type].methods.useHtmlDataSource(this, data);
+ }
+ $.extend(data.params, params);
+ if ($.isArray(data.dataSource)) {
+ result = bt[type].methods.filter(this);
+ bt[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;
+}
+
+bt.documentManager = {
+ events: {},
+
+ subscribeForEvent: function (eventName, widgetId, callback) {
+ if (!bt.documentManager.events[eventName] || bt.documentManager.events[eventName].length === 0) {
+ bt.documentManager.events[eventName] = [{ widgetId: widgetId, callback: callback }];
+ $(document).on(eventName, bt.documentManager.executeCallbacks);
+ } else if (!bt.documentManager.events[eventName][widgetId]) {
+ bt.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 = bt.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 = bt.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 bt.documentManager.events[eventName];
+ }
+ }
+ }
+ }
+ if (!success) {
+ throw 'The "' + eventName + '" for widget with guid="' + widgetId + '" can\'t be removed.';
+ }
+ }
+};
+
+/**
+ * @widget Core
+ * @plugin Base
+ */
+bt.core = {
+ messages: {
+ 'en-us': {
+ monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ monthShortNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ weekDaysMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
+ weekDaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
+ weekDays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
+ am: 'AM',
+ pm: 'PM',
+ ok: 'Ok',
+ cancel: 'Cancel'
+ }
+ },
+
+ /**
+ * @method
+ * @example String.1
+ *
+ *
+ * @example String.2
+ *
+ *
+ * @example String.dd.mmm.yyyy
+ *
+ *
+ * @example String.dd.mmmm.yyyy
+ *
+ *
+ * @example String.HH:MM
+ *
+ *
+ * @example ASP.NET.JSON.Date
+ *
+ *
+ * @example UNIX.Timestamp
+ *
+ *
+ */
+ parseDate: function (value, format, locale) {
+ var i, year = 0, month = 0, date = 0, hour = 0, minute = 0, dateParts, formatParts, result;
+
+ if (value && typeof value === 'string') {
+ if (/^\d+$/.test(value)) {
+ result = new Date(value);
+ } else if (value.indexOf('/Date(') > -1) {
+ result = new Date(parseInt(value.substr(6), 10));
+ } else if (value) {
+ dateParts = value.split(/[\s,-\.//\:]+/);
+ formatParts = format.split(/[\s,-\.//\:]+/);
+ for (i = 0; i < formatParts.length; i++) {
+ if (['d', 'dd'].indexOf(formatParts[i]) > -1) {
+ date = parseInt(dateParts[i], 10);
+ } else if (['m', 'mm'].indexOf(formatParts[i]) > -1) {
+ month = parseInt(dateParts[i], 10) - 1;
+ } else if ('mmm' === formatParts[i]) {
+ month = bt.core.messages[locale || 'en-us'].monthShortNames.indexOf(dateParts[i]);
+ } else if ('mmmm' === formatParts[i]) {
+ month = bt.core.messages[locale || 'en-us'].monthNames.indexOf(dateParts[i]);
+ } else if (['yy', 'yyyy'].indexOf(formatParts[i]) > -1) {
+ year = parseInt(dateParts[i], 10);
+ if (formatParts[i] === 'yy') {
+ year += 2000;
+ }
+ } else if (['h', 'hh', 'H', 'HH'].indexOf(formatParts[i]) > -1) {
+ hour = parseInt(dateParts[i], 10);
+ } else if (['M', 'MM'].indexOf(formatParts[i]) > -1) {
+ minute = parseInt(dateParts[i], 10);
+ }
+ }
+ result = new Date(year, month, date, hour, minute);
+ }
+ } else if (typeof value === 'number') {
+ result = new Date(value);
+ } else if (value instanceof Date) {
+ result = value;
+ }
+
+ return result;
+ },
+
+ /**
+ * @method
+ * @example Sample.1
+ *
+ *
+ * @example Sample.2
+ *
+ *
+ * @example Sample.dd.mmm.yyyy
+ *
+ *
+ * @example Sample.dd.mmmm.yyyy
+ *
+ *
+ * @example Sample.5
+ *
+ *
+ * @example Sample.6
+ *
+ *
+ * @example Short.WeekDay
+ *
+ *
+ * @example Full.WeekDay
+ *
+ *
+ */
+ formatDate: function (date, format, locale) {
+ var result = '', separator, tmp,
+ formatParts = format.split(/[\s,-\.//\:]+/),
+ separators = format.split(/s+|M+|H+|h+|t+|T+|d+|m+|y+/);
+
+ separators = separators.splice(1, separators.length - 2);
+
+ for (i = 0; i < formatParts.length; i++) {
+ separator = (separators[i] || '');
+ switch (formatParts[i]) {
+ case 's':
+ result += date.getSeconds() + separator;
+ break;
+ case 'ss':
+ result += bt.core.pad(date.getSeconds()) + separator;
+ break;
+ case 'M':
+ result += date.getMinutes() + separator;
+ break;
+ case 'MM':
+ result += bt.core.pad(date.getMinutes()) + separator;
+ break;
+ case 'H':
+ result += date.getHours() + separator;
+ break;
+ case 'HH':
+ result += bt.core.pad(date.getHours()) + separator;
+ break;
+ case 'h':
+ tmp = date.getHours() > 12 ? date.getHours() % 12 : date.getHours();
+ result += tmp + separator;
+ break;
+ case 'hh':
+ tmp = date.getHours() > 12 ? date.getHours() % 12 : date.getHours();
+ result += bt.core.pad(tmp) + separator;
+ break;
+ case 'tt':
+ result += (date.getHours() >= 12 ? 'pm' : 'am') + separator;
+ break;
+ case 'TT':
+ result += (date.getHours() >= 12 ? 'PM' : 'AM') + separator;
+ break;
+ case 'd':
+ result += date.getDate() + separator;
+ break;
+ case 'dd':
+ result += bt.core.pad(date.getDate()) + separator;
+ break;
+ case 'ddd':
+ result += bt.core.messages[locale || 'en-us'].weekDaysShort[date.getDay()] + separator;
+ break;
+ case 'dddd':
+ result += bt.core.messages[locale || 'en-us'].weekDays[date.getDay()] + separator;
+ break;
+ case 'm' :
+ result += (date.getMonth() + 1) + separator;
+ break;
+ case 'mm':
+ result += bt.core.pad(date.getMonth() + 1) + separator;
+ break;
+ case 'mmm':
+ result += bt.core.messages[locale || 'en-us'].monthShortNames[date.getMonth()] + separator;
+ break;
+ case 'mmmm':
+ result += bt.core.messages[locale || 'en-us'].monthNames[date.getMonth()] + separator;
+ break;
+ case 'yy' :
+ result += date.getFullYear().toString().substr(2) + separator;
+ break;
+ case 'yyyy':
+ result += date.getFullYear() + separator;
+ break;
+ }
+ }
+
+ return result;
+ },
+
+ pad: function (val, len) {
+ val = String(val);
+ len = len || 2;
+ while (val.length < len) {
+ val = '0' + val;
+ }
+ return val;
+ },
+
+ center: 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);
+ },
+
+ isIE: function () {
+ return !!navigator.userAgent.match(/Trident/g) || !!navigator.userAgent.match(/MSIE/g);
+ },
+
+ setChildPosition: function (mainEl, childEl) {
+ var mainElRect = mainEl.getBoundingClientRect(),
+ mainElHeight = bt.core.height(mainEl, true),
+ childElHeight = bt.core.height(childEl, true),
+ mainElWidth = bt.core.width(mainEl, true),
+ childElWidth = bt.core.width(childEl, true),
+ scrollY = window.scrollY || window.pageYOffset || 0,
+ scrollX = window.scrollX || window.pageXOffset || 0;
+
+ if ((mainElRect.top + mainElHeight + childElHeight) > window.innerHeight && mainElRect.top > childElHeight) {
+ childEl.style.top = Math.round(mainElRect.top + scrollY - childElHeight - 3) + 'px';
+ } else {
+ childEl.style.top = Math.round(mainElRect.top + scrollY + mainElHeight + 3) + 'px';
+ }
+
+ if (mainElRect.left + childElWidth > document.body.clientWidth) {
+ childEl.style.left = Math.round(mainElRect.left + scrollX + mainElWidth - childElWidth) + 'px';
+ } else {
+ childEl.style.left = Math.round(mainElRect.left + scrollX) + 'px';
+ }
+ },
+
+ height: function (el, margin) {
+ var result, style = window.getComputedStyle(el);
+
+ if (style.boxSizing === 'border-box') { // border-box include padding and border within the height
+ result = parseInt(style.height, 10);
+ } else {
+ result = parseInt(style.height, 10);
+ result += parseInt(style.paddingTop || 0, 10) + parseInt(style.paddingBottom || 0, 10);
+ result += parseInt(style.borderTop || 0, 10) + parseInt(style.borderBottom || 0, 10);
+ }
+
+ if (margin) {
+ result += parseInt(style.marginTop || 0, 10) + parseInt(style.marginBottom || 0, 10);
+ }
+
+ return result;
+ },
+
+ width: function (el, margin) {
+ var result, style = window.getComputedStyle(el);
+
+ if (style.boxSizing === 'border-box') { // border-box include padding and border within the width
+ result = parseInt(style.width, 10);
+ } else {
+ result = parseInt(style.width, 10);
+ result += parseInt(style.paddingLeft || 0, 10) + parseInt(style.paddingRight || 0, 10);
+ result += parseInt(style.borderLeft || 0, 10) + parseInt(style.borderRight || 0, 10);
+ }
+
+ if (margin) {
+ result += parseInt(style.marginLeft || 0, 10) + parseInt(style.marginRight || 0, 10);
+ }
+
+ return result;
+ },
+
+ addClasses: function (el, classes) {
+ var i, arr;
+ if (classes) {
+ arr = classes.split(' ');
+ for (i = 0; i < arr.length; i++) {
+ el.classList.add(arr[i]);
+ }
+ }
+ },
+
+ position: function (elem, padding, margin) {
+ var box = elem.getBoundingClientRect(),
+ body = document.body,
+ bodyStyle = window.getComputedStyle(body),
+ docEl = document.documentElement,
+ scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop,
+ scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft,
+ clientTop = docEl.clientTop || body.clientTop || 0,
+ clientLeft = docEl.clientLeft || body.clientLeft || 0,
+ top = Math.round(box.top + scrollTop - clientTop),
+ left = Math.round(box.left + scrollLeft - clientLeft);
+
+ if (padding) {
+ top += parseInt(bodyStyle.paddingTop || 0, 10);
+ left += parseInt(bodyStyle.paddingLeft || 0, 10);
+ }
+ if (margin) {
+ top += parseInt(bodyStyle.marginTop || 0, 10);
+ left += parseInt(bodyStyle.marginLeft || 0, 10);
+ }
+
+ return { top: top, left: left, bottom: top + bt.core.height(elem), right: left + bt.core.width(elem) };
+ }
+};
+/* global window alert jQuery */
+/**
+ * @widget Dialog
+ * @plugin Base
+ */
+bt.dialog = {
+ plugins: {},
+ messages: {}
+};
+
+bt.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
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ * Open Dialog
+ *
+ */
+ autoOpen: 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...
+ *
+ * Ok
+ * Cancel
+ *
+ *
+ *
+ * @example False
+ *
+ *
Dialog
+ *
Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ * Ok
+ * Cancel
+ *
+ *
+ *
+ */
+ closeButtonInHeader: 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
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ */
+ closeOnEscape: 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 Short.Text
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ * @example Long.Text.Material.Design
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus porttitor quam in magna vulputate, vitae laoreet odio ultrices. Phasellus at efficitur magna. Mauris purus dolor, egestas quis leo et, vulputate dictum mauris. Vivamus maximus lectus sollicitudin lorem blandit tempor. Maecenas eget posuere mi. Suspendisse id hendrerit nibh. Morbi eu odio euismod, venenatis ipsum in, egestas nunc. Mauris dignissim metus ac risus porta eleifend. Aliquam tempus libero orci, id placerat odio vehicula eu. Donec tincidunt justo dolor, sit amet tempus turpis varius sit amet. Suspendisse ut ex blandit, hendrerit enim tristique, iaculis ipsum. Vivamus venenatis dolor justo, eget scelerisque lacus dignissim quis. Duis imperdiet ex at aliquet cursus. Proin non ultricies leo. Fusce quam diam, laoreet quis fringilla vitae, viverra id magna. Nam laoreet sem in volutpat rhoncus.
+ *
+ * @example Long.Text.Bootstrap3
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus porttitor quam in magna vulputate, vitae laoreet odio ultrices. Phasellus at efficitur magna. Mauris purus dolor, egestas quis leo et, vulputate dictum mauris. Vivamus maximus lectus sollicitudin lorem blandit tempor. Maecenas eget posuere mi. Suspendisse id hendrerit nibh. Morbi eu odio euismod, venenatis ipsum in, egestas nunc. Mauris dignissim metus ac risus porta eleifend. Aliquam tempus libero orci, id placerat odio vehicula eu. Donec tincidunt justo dolor, sit amet tempus turpis varius sit amet. Suspendisse ut ex blandit, hendrerit enim tristique, iaculis ipsum. Vivamus venenatis dolor justo, eget scelerisque lacus dignissim quis. Duis imperdiet ex at aliquet cursus. Proin non ultricies leo. Fusce quam diam, laoreet quis fringilla vitae, viverra id magna. Nam laoreet sem in volutpat rhoncus.
+ *
+ * @example Long.Text.Bootstrap4
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus porttitor quam in magna vulputate, vitae laoreet odio ultrices. Phasellus at efficitur magna. Mauris purus dolor, egestas quis leo et, vulputate dictum mauris. Vivamus maximus lectus sollicitudin lorem blandit tempor. Maecenas eget posuere mi. Suspendisse id hendrerit nibh. Morbi eu odio euismod, venenatis ipsum in, egestas nunc. Mauris dignissim metus ac risus porta eleifend. Aliquam tempus libero orci, id placerat odio vehicula eu. Donec tincidunt justo dolor, sit amet tempus turpis varius sit amet. Suspendisse ut ex blandit, hendrerit enim tristique, iaculis ipsum. Vivamus venenatis dolor justo, eget scelerisque lacus dignissim quis. Duis imperdiet ex at aliquet cursus. Proin non ultricies leo. Fusce quam diam, laoreet quis fringilla vitae, viverra id magna. Nam laoreet sem in volutpat rhoncus.
+ *
+ */
+ 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 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 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,
+
+ /** 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 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,
+
+ /** 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.Material.Design
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ * @example True.Bootstrap.4
+ * 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,
+
+ /** If set to true, add vertical scroller to the dialog body.
+ * @type Boolean
+ * @default false
+ * @example Bootstrap.3
+ *
+ *
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus porttitor quam in magna vulputate, vitae laoreet odio ultrices. Phasellus at efficitur magna. Mauris purus dolor, egestas quis leo et, vulputate dictum mauris. Vivamus maximus lectus sollicitudin lorem blandit tempor. Maecenas eget posuere mi. Suspendisse id hendrerit nibh. Morbi eu odio euismod, venenatis ipsum in, egestas nunc. Mauris dignissim metus ac risus porta eleifend. Aliquam tempus libero orci, id placerat odio vehicula eu. Donec tincidunt justo dolor, sit amet tempus turpis varius sit amet. Suspendisse ut ex blandit, hendrerit enim tristique, iaculis ipsum. Vivamus venenatis dolor justo, eget scelerisque lacus dignissim quis. Duis imperdiet ex at aliquet cursus. Proin non ultricies leo. Fusce quam diam, laoreet quis fringilla vitae, viverra id magna. Nam laoreet sem in volutpat rhoncus.
+ *
+ * Cancel
+ * OK
+ *
+ *
+ *
+ * @example Bootstrap.4
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus porttitor quam in magna vulputate, vitae laoreet odio ultrices. Phasellus at efficitur magna. Mauris purus dolor, egestas quis leo et, vulputate dictum mauris. Vivamus maximus lectus sollicitudin lorem blandit tempor. Maecenas eget posuere mi. Suspendisse id hendrerit nibh. Morbi eu odio euismod, venenatis ipsum in, egestas nunc. Mauris dignissim metus ac risus porta eleifend. Aliquam tempus libero orci, id placerat odio vehicula eu. Donec tincidunt justo dolor, sit amet tempus turpis varius sit amet. Suspendisse ut ex blandit, hendrerit enim tristique, iaculis ipsum. Vivamus venenatis dolor justo, eget scelerisque lacus dignissim quis. Duis imperdiet ex at aliquet cursus. Proin non ultricies leo. Fusce quam diam, laoreet quis fringilla vitae, viverra id magna. Nam laoreet sem in volutpat rhoncus.
+ *
+ * @example Material.Design
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus porttitor quam in magna vulputate, vitae laoreet odio ultrices. Phasellus at efficitur magna. Mauris purus dolor, egestas quis leo et, vulputate dictum mauris. Vivamus maximus lectus sollicitudin lorem blandit tempor. Maecenas eget posuere mi. Suspendisse id hendrerit nibh. Morbi eu odio euismod, venenatis ipsum in, egestas nunc. Mauris dignissim metus ac risus porta eleifend. Aliquam tempus libero orci, id placerat odio vehicula eu. Donec tincidunt justo dolor, sit amet tempus turpis varius sit amet. Suspendisse ut ex blandit, hendrerit enim tristique, iaculis ipsum. Vivamus venenatis dolor justo, eget scelerisque lacus dignissim quis. Duis imperdiet ex at aliquet cursus. Proin non ultricies leo. Fusce quam diam, laoreet quis fringilla vitae, viverra id magna. Nam laoreet sem in volutpat rhoncus.
+ *
+ */
+ scrollable: 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 Material Design and Bootstrap.
+ * @additionalinfo The css file for bootstrap should be manually included if you use bootstrap.
+ * @type string (bootstrap|materialdesign)
+ * @default undefined
+ * @example Bootstrap.3
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ * @example Bootstrap.4
+ *
+ *
Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ * Cancel
+ * OK
+ *
+ *
+ *
+ * @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.
+ *
+ *
+ * OK
+ * Cancel
+ *
+ *
+ *
+ */
+ uiLibrary: 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,
+
+ style: {
+ modal: 'bt-modal',
+ content: 'bt-dialog-md',
+ header: 'bt-dialog-md-header bt-unselectable',
+ headerTitle: 'bt-dialog-md-title',
+ headerCloseButton: 'bt-dialog-md-close',
+ body: 'bt-dialog-md-body',
+ footer: 'bt-dialog-footer bt-dialog-md-footer'
+ }
+ },
+
+ bootstrap: {
+ style: {
+ modal: 'modal',
+ content: 'modal-content bt-dialog-bootstrap',
+ header: 'modal-header',
+ headerTitle: 'modal-title',
+ headerCloseButton: 'close',
+ body: 'modal-body',
+ footer: 'bt-dialog-footer modal-footer'
+ }
+ },
+
+ bootstrap4: {
+ style: {
+ modal: 'modal',
+ content: 'modal-content bt-dialog-bootstrap4',
+ header: 'modal-header',
+ headerTitle: 'modal-title',
+ headerCloseButton: 'close',
+ body: 'modal-body',
+ footer: 'bt-dialog-footer modal-footer'
+ }
+ }
+};
+/**
+ * @widget Dialog
+ * @plugin Base
+ */
+bt.dialog.events = {
+ /**
+ * Triggered when the dialog is initialized.
+ *
+ * @event initialized
+ * @param {object} e - event data
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ * Open Dialog
+ *
+ */
+ initialized: function ($dialog) {
+ $dialog.trigger("initialized");
+ },
+
+ /**
+ * Triggered before the dialog is opened.
+ * @event opening
+ * @param {object} e - event data
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ * Open Dialog
+ *
+ */
+ opening: function ($dialog) {
+ $dialog.trigger("opening");
+ },
+
+ /**
+ * Triggered when the dialog is opened.
+ * @event opened
+ * @param {object} e - event data
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ * Open Dialog
+ *
+ */
+ opened: function ($dialog) {
+ $dialog.trigger("opened");
+ },
+
+ /**
+ * Triggered before the dialog is closed.
+ * @event closing
+ * @param {object} e - event data
+ * @example sample
+ * Close the dialog in order to fire closing event.
+ * Open Dialog
+ *
+ */
+ closing: function ($dialog) {
+ $dialog.trigger("closing");
+ },
+
+ /**
+ * Triggered when the dialog is closed.
+ * @event closed
+ * @param {object} e - event data
+ * @example sample
+ * Close the dialog in order to fire closed event.
+ * Open Dialog
+ *
+ */
+ closed: function ($dialog) {
+ $dialog.trigger("closed");
+ },
+
+ /**
+ * Triggered while the dialog is being dragged.
+ * @event drag
+ * @param {object} e - event data
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ *
+ */
+ drag: function ($dialog) {
+ $dialog.trigger("drag");
+ },
+
+ /**
+ * Triggered when the user starts dragging the dialog.
+ * @event dragStart
+ * @param {object} e - event data
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ *
+ */
+ dragStart: function ($dialog) {
+ $dialog.trigger("dragStart");
+ },
+
+ /**
+ * Triggered after the dialog has been dragged.
+ * @event dragStop
+ * @param {object} e - event data
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ *
+ */
+ dragStop: function ($dialog) {
+ $dialog.trigger("dragStop");
+ },
+
+ /**
+ * Triggered while the dialog is being resized.
+ * @event resize
+ * @param {object} e - event data
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ *
+ */
+ resize: function ($dialog) {
+ $dialog.trigger("resize");
+ },
+
+ /**
+ * Triggered when the user starts resizing the dialog.
+ * @event resizeStart
+ * @param {object} e - event data
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ *
+ */
+ resizeStart: function ($dialog) {
+ $dialog.trigger("resizeStart");
+ },
+
+ /**
+ * Triggered after the dialog has been resized.
+ * @event resizeStop
+ * @param {object} e - event data
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ *
+ *
+ */
+ resizeStop: function ($dialog) {
+ $dialog.trigger("resizeStop");
+ }
+};
+
+bt.dialog.methods = {
+
+ init: function (jsConfig) {
+ bt.widget.prototype.init.call(this, jsConfig, 'dialog');
+
+ bt.dialog.methods.localization(this);
+ bt.dialog.methods.initialize(this);
+ bt.dialog.events.initialized(this);
+ return this;
+ },
+
+ localization: function($dialog) {
+ var data = $dialog.data();
+ if (typeof (data.title) === 'undefined') {
+ data.title = bt.dialog.messages[data.locale].DefaultTitle;
+ }
+ },
+
+ getHTMLConfig: function () {
+ var result = bt.widget.prototype.getHTMLConfig.call(this),
+ attrs = this[0].attributes;
+ if (attrs['title']) {
+ result.title = attrs['title'].value;
+ }
+ return result;
+ },
+
+ initialize: function ($dialog) {
+ var data = $dialog.data(),
+ $header, $body, $footer;
+
+ $dialog.addClass(data.style.content);
+
+ bt.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 = bt.dialog.methods.renderHeader($dialog);
+
+ $footer = $dialog.children('div[data-role="footer"]').addClass(data.style.footer);
+
+ $dialog.find('[data-role="close"]').on('click', function () {
+ $dialog.close();
+ });
+
+ if (bt.draggable) {
+ if (data.draggable) {
+ bt.dialog.methods.draggable($dialog, $header);
+ }
+ if (data.resizable) {
+ bt.dialog.methods.resizable($dialog);
+ }
+ }
+
+ if (data.scrollable && data.height) {
+ $dialog.addClass('bt-dialog-scrollable');
+ $dialog.on('opened', function () {
+ var $body = $dialog.children('div[data-role="body"]');
+ $body.css('height', data.height - $header.outerHeight() - ($footer.length ? $footer.outerHeight() : 0));
+ });
+ }
+
+ bt.core.center($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.append($closeButton);
+ } else if ($closeButton.length > 0 && data.closeButtonInHeader === false) {
+ $closeButton.hide();
+ } else {
+ $closeButton.addClass(data.style.headerCloseButton);
+ }
+
+ return $header;
+ },
+
+ draggable: function ($dialog, $header) {
+ $dialog.appendTo('body');
+ $header.addClass('bt-draggable');
+ $dialog.draggable({
+ handle: $header,
+ start: function () {
+ $dialog.addClass('bt-unselectable');
+ bt.dialog.events.dragStart($dialog);
+ },
+ stop: function () {
+ $dialog.removeClass('bt-unselectable');
+ bt.dialog.events.dragStop($dialog);
+ }
+ });
+ },
+
+ resizable: function ($dialog) {
+ var config = {
+ 'drag': bt.dialog.methods.resize,
+ 'start': function () {
+ $dialog.addClass('bt-unselectable');
+ bt.dialog.events.resizeStart($dialog);
+ },
+ 'stop': function () {
+ this.removeAttribute('style');
+ $dialog.removeClass('bt-unselectable');
+ bt.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, newPosition) {
+ var $el, $dialog, position, data, height, width, top, left, result = false;
+
+ $el = $(this);
+ $dialog = $el.parent();
+ position = bt.core.position(this);
+ offset = { top: newPosition.top - position.top, left: newPosition.left - position.left };
+ data = $dialog.data();
+
+ // TODO: Include margins in the calculations
+ if ($el.hasClass('bt-resizable-n')) {
+ height = $dialog.height() - offset.top;
+ top = $dialog.offset().top + offset.top;
+ } else if ($el.hasClass('bt-resizable-e')) {
+ width = $dialog.width() + offset.left;
+ } else if ($el.hasClass('bt-resizable-s')) {
+ height = $dialog.height() + offset.top;
+ } else if ($el.hasClass('bt-resizable-w')) {
+ width = $dialog.width() - offset.left;
+ left = $dialog.offset().left + offset.left;
+ } else if ($el.hasClass('bt-resizable-ne')) {
+ height = $dialog.height() - offset.top;
+ top = $dialog.offset().top + offset.top;
+ width = $dialog.width() + offset.left;
+ } else if ($el.hasClass('bt-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('bt-resizable-se')) {
+ height = $dialog.height() + offset.top;
+ width = $dialog.width() + offset.left;
+ } else if ($el.hasClass('bt-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) {
+ bt.dialog.events.resize($dialog);
+ }
+
+ return result;
+ },
+
+ open: function ($dialog, title) {
+ var $footer;
+ bt.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());
+ }
+ if (title !== undefined) {
+ $dialog.find('[data-role="title"]').html(title);
+ }
+ bt.dialog.events.opened($dialog);
+ return $dialog;
+ },
+
+ close: function ($dialog) {
+ if ($dialog.is(':visible')) {
+ bt.dialog.events.closing($dialog);
+ $dialog.css('display', 'none');
+ $dialog.closest('div[data-role="modal"]').css('display', 'none');
+ bt.dialog.events.closed($dialog);
+ }
+ return $dialog;
+ },
+
+ isOpen: function ($dialog) {
+ return $dialog.is(':visible');
+ },
+
+ content: function ($dialog, html) {
+ var $body = $dialog.children('div[data-role="body"]');
+ if (typeof (html) === "undefined") {
+ return $body.html();
+ } else {
+ return $body.html(html);
+ }
+ },
+
+ 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
+ */
+bt.dialog.widget = function ($element, jsConfig) {
+ var self = this,
+ methods = bt.dialog.methods;
+
+ /**
+ * Opens the dialog.
+ * @method
+ * @param {String} title - The dialog title.
+ * @fires opening, opened
+ * @return dialog
+ * @example Sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ * Open Dialog
+ *
+ * @example Title
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ * Open Dialog
+ *
+ */
+ self.open = function (title) {
+ return methods.open(this, title);
+ }
+
+ /**
+ * Close the dialog.
+ * @method
+ * @fires closing, closed
+ * @return dialog
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ * Open Dialog
+ * Close Dialog
+ *
+ */
+ self.close = function () {
+ return methods.close(this);
+ }
+
+ /**
+ * Check if the dialog is currently open.
+ * @method
+ * @return boolean
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ * Open Dialog
+ * Close Dialog
+ * isOpen
+ *
+ */
+ self.isOpen = function () {
+ return methods.isOpen(this);
+ }
+
+ /**
+ * Gets or set the content of a dialog. Supports chaining when used as a setter.
+ * @method
+ * @param {String} content - The content of the Dialog.
+ * @return String|Dialog
+ * @example sample
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ * Get Content
+ * Set Content
+ *
+ */
+ self.content = function (content) {
+ return methods.content(this, content);
+ }
+
+ /**
+ * 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
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ * Create
+ * Destroy
+ *
+ * @example Remove.HTML.Markup
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit...
+ * Create
+ * Destroy
+ *
+ */
+ 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;
+};
+
+bt.dialog.widget.prototype = new bt.widget();
+bt.dialog.widget.constructor = bt.dialog.widget;
+
+bt.dialog.widget.prototype.getHTMLConfig = bt.dialog.methods.getHTMLConfig;
+
+(function ($) {
+ $.fn.dialog = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.dialog.widget(this, method);
+ } else {
+ $widget = new bt.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);
+bt.dialog.messages['en-us'] = {
+ Close: 'Close',
+ DefaultTitle: 'Dialog'
+};
+/* global window alert jQuery */
+/**
+ * @widget Draggable
+ * @plugin Base
+ */
+bt.draggable = {
+ plugins: {}
+};
+
+bt.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,
+
+ /** Constrains dragging to within the bounds of the specified element.
+ * @type Element
+ * @default undefined
+ * @example sample
+ *
+ *
+ *
+ */
+ containment: undefined
+ }
+};
+
+bt.draggable.methods = {
+ init: function (jsConfig) {
+ var $handleEl, data, $dragEl = this;
+
+ bt.widget.prototype.init.call(this, jsConfig, 'draggable');
+ data = this.data();
+ $dragEl.attr('data-draggable', 'true');
+
+ $handleEl = bt.draggable.methods.getHandleElement($dragEl);
+
+ $handleEl.on('touchstart mousedown', function (e) {
+ var position = bt.core.position($dragEl[0]);
+ $dragEl[0].style.top = position.top + 'px';
+ $dragEl[0].style.left = position.left + 'px';
+ $dragEl[0].style.position = 'fixed';
+
+ $dragEl.attr('draggable-dragging', true);
+ $dragEl.removeAttr('draggable-x').removeAttr('draggable-y');
+ bt.documentManager.subscribeForEvent('touchmove', $dragEl.data('guid'), bt.draggable.methods.createMoveHandler($dragEl, $handleEl, data));
+ bt.documentManager.subscribeForEvent('mousemove', $dragEl.data('guid'), bt.draggable.methods.createMoveHandler($dragEl, $handleEl, data));
+ });
+
+ bt.documentManager.subscribeForEvent('mouseup', $dragEl.data('guid'), bt.draggable.methods.createUpHandler($dragEl));
+ bt.documentManager.subscribeForEvent('touchend', $dragEl.data('guid'), bt.draggable.methods.createUpHandler($dragEl));
+ bt.documentManager.subscribeForEvent('touchcancel', $dragEl.data('guid'), bt.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('draggable-dragging') === 'true') {
+ $dragEl.attr('draggable-dragging', false);
+ bt.documentManager.unsubscribeForEvent('mousemove', $dragEl.data('guid'));
+ bt.documentManager.unsubscribeForEvent('touchmove', $dragEl.data('guid'));
+ bt.draggable.events.stop($dragEl, { x: $dragEl.mouseX(e), y: $dragEl.mouseY(e) });
+ }
+ };
+ },
+
+ createMoveHandler: function ($dragEl, $handleEl, data) {
+ return function (e) {
+ var mouseX, mouseY, offsetX, offsetY, prevX, prevY;
+ if ($dragEl.attr('draggable-dragging') === 'true') {
+ mouseX = Math.round($dragEl.mouseX(e));
+ mouseY = Math.round($dragEl.mouseY(e));
+ prevX = $dragEl.attr('draggable-x');
+ prevY = $dragEl.attr('draggable-y');
+ if (prevX && prevY) {
+ offsetX = data.horizontal ? mouseX - parseInt(prevX, 10) : 0;
+ offsetY = data.vertical ? mouseY - parseInt(prevY, 10) : 0;
+ bt.draggable.methods.move($dragEl[0], data, offsetX, offsetY, mouseX, mouseY);
+ } else {
+ bt.draggable.events.start($dragEl, mouseX, mouseY);
+ }
+ $dragEl.attr('draggable-x', mouseX);
+ $dragEl.attr('draggable-y', mouseY);
+ }
+ }
+ },
+
+ move: function (dragEl, data, offsetX, offsetY, mouseX, mouseY) {
+ var contPosition, maxTop, maxLeft,
+ position = bt.core.position(dragEl),
+ newTop = position.top + offsetY,
+ newLeft = position.left + offsetX;
+
+ if (data.containment) {
+ contPosition = bt.core.position(data.containment);
+ maxTop = contPosition.top + bt.core.height(data.containment) - bt.core.height(dragEl);
+ maxLeft = contPosition.left + bt.core.width(data.containment) - bt.core.width(dragEl);
+ if (newTop > contPosition.top && newTop < maxTop) {
+ if (contPosition.top >= mouseY || contPosition.bottom <= mouseY) {
+ newTop = position.top;
+ }
+ } else {
+ if (newTop <= contPosition.top) {
+ newTop = contPosition.top + 1;
+ } else {
+ newTop = maxTop - 1;
+ }
+ }
+ if (newLeft > contPosition.left && newLeft < maxLeft) {
+ if (contPosition.left >= mouseX || contPosition.right <= mouseX) {
+ newLeft = position.left;
+ }
+ } else {
+ if (newLeft <= contPosition.left) {
+ newLeft = contPosition.left + 1;
+ } else {
+ newLeft = maxLeft - 1;
+ }
+ }
+ }
+
+ if (false !== bt.draggable.events.drag($(dragEl), newTop, newLeft, mouseX, mouseY)) {
+ dragEl.style.top = newTop + 'px';
+ dragEl.style.left = newLeft + 'px';
+ }
+ },
+
+ destroy: function ($dragEl) {
+ if ($dragEl.attr('data-draggable') === 'true') {
+ bt.documentManager.unsubscribeForEvent('mouseup', $dragEl.data('guid'));
+ $dragEl.removeData();
+ $dragEl.removeAttr('data-guid');
+ $dragEl.removeAttr('data-draggable');
+ $dragEl.off('drag').off('start').off('stop');
+ bt.draggable.methods.getHandleElement($dragEl).off('mousedown');
+ }
+ return $dragEl;
+ }
+};
+
+bt.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} newPosition - New position of the draggable element as { top, left } object.
+ * @param {object} mousePosition - Current mouse position as { x, y } object.
+ * @example sample
+ *
+ * drag me
+ *
+ */
+ drag: function ($dragEl, newTop, newLeft, mouseX, mouseY) {
+ return $dragEl.triggerHandler('drag', [{ top: newTop, left: newLeft }, { x: mouseX, y: mouseY }]);
+ },
+
+ /**
+ * Triggered when dragging starts.
+ *
+ * @event start
+ * @param {object} e - event data
+ * @param {object} mousePosition - Current mouse position as { x, y } object.
+ * @example sample
+ *
+ *
+ * drag me
+ *
+ *
+ */
+ start: function ($dragEl, mouseX, mouseY) {
+ $dragEl.triggerHandler('start', [{ x: mouseX, y: mouseY }]);
+ },
+
+ /**
+ * Triggered when dragging stops.
+ *
+ * @event stop
+ * @param {object} e - event data
+ * @param {object} mousePosition - Current mouse position as { x, y } object.
+ * @example sample
+ *
+ *
+ * drag me
+ *
+ *
+ */
+ stop: function ($dragEl, mousePosition) {
+ $dragEl.triggerHandler('stop', [mousePosition]);
+ }
+};
+
+bt.draggable.widget = function ($element, jsConfig) {
+ var self = this,
+ methods = bt.draggable.methods;
+
+ if (!$element.destroy) {
+ /** Remove draggable functionality from the element.
+ * @method
+ * @return jquery element
+ * @example sample
+ *
+ * Destroy
+ * 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;
+};
+
+bt.draggable.widget.prototype = new bt.widget();
+bt.draggable.widget.constructor = bt.draggable.widget;
+
+(function ($) {
+ $.fn.draggable = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.draggable.widget(this, method);
+ } else {
+ $widget = new bt.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
+ */
+bt.droppable = {
+ plugins: {}
+};
+
+bt.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
+};
+
+bt.droppable.methods = {
+ init: function (jsConfig) {
+ var $dropEl = this;
+
+ bt.widget.prototype.init.call(this, jsConfig, 'droppable');
+ $dropEl.attr('data-droppable', 'true');
+
+ bt.documentManager.subscribeForEvent('mousedown', $dropEl.data('guid'), bt.droppable.methods.createMouseDownHandler($dropEl));
+ bt.documentManager.subscribeForEvent('mousemove', $dropEl.data('guid'), bt.droppable.methods.createMouseMoveHandler($dropEl));
+ bt.documentManager.subscribeForEvent('mouseup', $dropEl.data('guid'), bt.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 = {
+ x: $dropEl.mouseX(e),
+ y: $dropEl.mouseY(e)
+ },
+ newIsOver = bt.droppable.methods.isOver($dropEl, mousePosition);
+ if (newIsOver != $dropEl.isOver) {
+ if (newIsOver) {
+ if (hoverClass) {
+ $dropEl.addClass(hoverClass);
+ }
+ bt.droppable.events.over($dropEl, mousePosition);
+ } else {
+ if (hoverClass) {
+ $dropEl.removeClass(hoverClass);
+ }
+ bt.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 (bt.droppable.methods.isOver($dropEl, mousePosition)) {
+ bt.droppable.events.drop($dropEl);
+ }
+ }
+ },
+
+ isOver: function ($dropEl, mousePosition) {
+ var offsetTop = $dropEl.offset().top,
+ offsetLeft = $dropEl.offset().left;
+ return mousePosition.x > offsetLeft && mousePosition.x < (offsetLeft + $dropEl.outerWidth(true))
+ && mousePosition.y > offsetTop && mousePosition.y < (offsetTop + $dropEl.outerHeight(true));
+ },
+
+ destroy: function ($dropEl) {
+ if ($dropEl.attr('data-droppable') === 'true') {
+ bt.documentManager.unsubscribeForEvent('mousedown', $dropEl.data('guid'));
+ bt.documentManager.unsubscribeForEvent('mousemove', $dropEl.data('guid'));
+ bt.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;
+ }
+};
+
+bt.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');
+ }
+};
+
+bt.droppable.widget = function ($element, jsConfig) {
+ var self = this,
+ methods = bt.droppable.methods;
+
+ self.isOver = false;
+ self.isDragging = false;
+
+ /** Removes the droppable functionality.
+ * @method
+ * @return jquery element
+ * @example sample
+ * Create
+ * Destroy
+ *
+ *
+ * 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.call($element, jsConfig);
+ }
+
+ return $element;
+};
+
+bt.droppable.widget.prototype = new bt.widget();
+bt.droppable.widget.constructor = bt.droppable.widget;
+
+(function ($) {
+ $.fn.droppable = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.droppable.widget(this, method);
+ } else {
+ $widget = new bt.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);
+/* global window alert jQuery bt */
+/**
+ * @widget Grid
+ * @plugin Base
+ */
+bt.grid = {
+ plugins: {},
+ messages: {}
+};
+
+bt.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
+ *
+ *
+ *
+ * #
+ * Name
+ * PlaceOfBirth
+ *
+ *
+ *
+ *
+ * @example Local.DataSource
+ *
+ *
+ * @example Html.DataSource
+ *
+ *
+ *
+ * #
+ * Name
+ * Place Of Birth
+ *
+ *
+ *
+ *
+ * 1
+ * Hristo Stoichkov
+ * Plovdiv, Bulgaria
+ *
+ *
+ * 2
+ * Ronaldo Luis Nazario de Lima
+ * Rio de Janeiro, Brazil
+ *
+ *
+ * 3
+ * David Platt
+ * Chadderton, 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
+ *
+ *
+ * @example Local.Custom
+ *
+ *
+ * @example Remote.Bootstrap.3
+ *
+ *
+ * @example Remote.Bootstrap.4.Material.Icons
+ *
+ *
+ * @example Remote.Bootstrap.4.FontAwesome
+ *
+ *
+ */
+ sortable: false,
+
+ /** Indicates the type of the column.
+ * @alias column.type
+ * @type text|checkbox|icon
+ * @default 'text'
+ * @example Bootstrap.3.Icon
+ *
+ *
+ * @example Bootstrap.4.Icon
+ *
+ *
+ * @example Bootstrap.3.Checkbox
+ *
+ *
+ * @example Bootstrap.4.Checkbox
+ *
+ *
+ */
+ type: 'text',
+
+ /** 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 undefined
+ * @example Material.Design
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ align: undefined,
+
+ /** 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
+ *
+ *
+ *
+ * ID
+ * Name
+ * Place Of Birth
+ *
+ *
+ *
+ *
+ *
+ */
+ events: undefined,
+
+ /** Format the date when the type of the column is date.
+ * @additionalinfo d - Day of the month as digits; no leading zero for single-digit days.
+ * dd - Day of the month as digits; leading zero for single-digit days.
+ * m - Month as digits; no leading zero for single-digit months.
+ * mm - Month as digits; leading zero for single-digit months.
+ * yy - Year as last two digits; leading zero for years less than 10.
+ * yyyy - Year represented by four digits.
+ * s - Seconds; no leading zero for single-digit seconds.
+ * ss - Seconds; leading zero for single-digit seconds.
+ * M - Minutes; no leading zero for single-digit minutes. Uppercase MM to avoid conflict with months.
+ * MM - Minutes; leading zero for single-digit minutes. Uppercase MM to avoid conflict with months.
+ * H - Hours; no leading zero for single-digit hours (24-hour clock).
+ * HH - Hours; leading zero for single-digit hours (24-hour clock).
+ * h - Hours; no leading zero for single-digit hours (12-hour clock).
+ * hh - Hours; leading zero for single-digit hours (12-hour clock).
+ * tt - Lowercase, two-character time marker string: am or pm.
+ * TT - Uppercase, two-character time marker string: AM or PM.
+ * @alias column.format
+ * @type string
+ * @default 'mm/dd/yyyy'
+ * @example sample
+ *
+ *
+ */
+ format: 'mm/dd/yyyy',
+
+ /** 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
+ *
+ *
+ * Search
+ *
+ *
+ */
+ 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 Bootstrap 3, Bootstrap 4 and Material Design.
+ * @additionalinfo The css files for Bootstrap or Material Design should be manually included to the page where the grid is in use.
+ * @type (materialdesign|bootstrap|bootstrap4)
+ * @default 'materialdesign'
+ * @example Material.Design.With.Icons
+ *
+ *
+ * @example Material.Design.Without.Icons
+ *
+ *
+ * @example Bootstrap.3
+ *
+ *
+ * @example Bootstrap.4.Font.Awesome
+ *
+ *
+ */
+ uiLibrary: 'materialdesign',
+
+ /** 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 'materialicons'
+ * @example Font.Awesome
+ *
+ *
+ */
+ iconsLibrary: 'materialicons',
+
+ /** 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.Material.Design.Checkbox
+ *
+ *
+ * @example Multiple.Bootstrap.3.Checkbox
+ *
+ *
+ * @example Multiple.Bootstrap.4.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
+ *
+ *
+ * @example localization
+ *
+ *
+ *
+ */
+ notFoundText: undefined,
+
+ /** Width of the grid.
+ * @type number
+ * @default undefined
+ * @example sample
+ *
+ *
+ */
+ width: undefined,
+
+ /** Minimum width of the grid.
+ * @type number
+ * @default undefined
+ */
+ minWidth: undefined,
+
+ /** This configuration option manage the behaviour of the header row height.
+ * Auto scale if set to to 'autogrow'. All body rows are with the same height if set to 'fixed'.
+ * @type ('autogrow'|'fixed')
+ * @default "fixed"
+ * @example AutoGrow
+ *
+ *
+ * @example Fixed
+ *
+ *
+ */
+ headerRowHeight: 'fixed',
+
+ /** This configuration option manage the behaviour of the body row height.
+ * Auto scale if set to to 'autogrow'. All body rows are with the same height if set to 'fixed'.
+ * @type ('autogrow'|'fixed')
+ * @default "autogrow"
+ * @example AutoGrow
+ *
+ *
+ * @example Fixed
+ *
+ *
+ */
+ bodyRowHeight: 'autogrow',
+
+ /** 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 German.Bootstrap.Default
+ *
+ *
+ * @example French.MaterialDesign.Custom
+ *
+ *
+ */
+ locale: 'en-us',
+
+ defaultIconColumnWidth: 70,
+ defaultCheckBoxColumnWidth: 70,
+
+ style: {
+ wrapper: 'bt-grid-wrapper',
+ table: 'bt-grid bt-grid-md',
+ loadingCover: 'bt-grid-loading-cover',
+ loadingText: 'bt-grid-loading-text',
+ header: {
+ cell: undefined,
+ sortable: 'bt-cursor-pointer bt-unselectable'
+ },
+ content: {
+ rowSelected: 'bt-grid-md-select'
+ }
+ },
+
+ icons: {
+ asc: 'â–²',
+ desc: 'â–¼'
+ }
+ },
+
+ bootstrap: {
+ style: {
+ wrapper: 'bt-grid-wrapper',
+ table: 'bt-grid bt-grid-bootstrap bt-grid-bootstrap-3 table table-bordered table-hover',
+ content: {
+ rowSelected: 'active'
+ }
+ },
+
+ iconsLibrary: 'glyphicons',
+
+ defaultIconColumnWidth: 34,
+ defaultCheckBoxColumnWidth: 36
+ },
+
+ bootstrap4: {
+ style: {
+ wrapper: 'bt-grid-wrapper',
+ table: 'bt-grid bt-grid-bootstrap bt-grid-bootstrap-4 table table-bordered table-hover',
+ content: {
+ rowSelected: 'active'
+ }
+ },
+
+ defaultIconColumnWidth: 42,
+ defaultCheckBoxColumnWidth: 44
+ },
+
+ materialicons: {
+ icons: {
+ asc: ' ',
+ desc: ' '
+ }
+ },
+
+ fontawesome: {
+ icons: {
+ asc: ' ',
+ desc: ' '
+ }
+ },
+
+ glyphicons: {
+ icons: {
+ asc: ' ',
+ desc: ' '
+ }
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Base
+ */
+bt.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) {
+ return $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) {
+ return $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) {
+ return $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) {
+ return $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) {
+ return $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) {
+ return $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) {
+ return $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
+ * Remove Row
+ *
+ *
+ */
+ rowRemoving: function ($grid, $row, id, record) {
+ return $grid.triggerHandler('rowRemoving', [$row, id, record]);
+ },
+
+ /**
+ * Event fires when the grid.destroy method is called.
+ *
+ * @event destroying
+ * @param {object} e - event data
+ * @example sample
+ * Destroy
+ *
+ *
+ *
+ */
+ destroying: function ($grid) {
+ return $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) {
+ return $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) {
+ return $grid.triggerHandler('columnShow', [column]);
+ },
+
+ /**
+ * Event fires when grid is initialized.
+ *
+ * @event initialized
+ * @param {object} e - event data
+ * @example sample
+ *
+ *
+ */
+ initialized: function ($grid) {
+ return $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) {
+ return $grid.triggerHandler('dataFiltered', [records]);
+ }
+};
+
+/*global bt $*/
+bt.grid.methods = {
+
+ init: function (jsConfig) {
+ bt.widget.prototype.init.call(this, jsConfig, 'grid');
+
+ bt.grid.methods.initialize(this);
+
+ if (this.data('autoLoad')) {
+ this.reload();
+ }
+ return this;
+ },
+
+ getConfig: function (jsConfig, type) {
+ var config = bt.widget.prototype.getConfig.call(this, jsConfig, type);
+ bt.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 = bt.widget.prototype.getHTMLConfig.call(this);
+ result.columns = [];
+ this.find('thead > tr > th').each(function () {
+ var $el = $(this),
+ title = $el.text(),
+ config = bt.widget.prototype.getHTMLConfig.call($el);
+ config.title = title;
+ if (!config.field) {
+ config.field = title;
+ }
+ if (config.events) {
+ config.events = bt.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"]');
+
+ bt.grid.methods.localization(data);
+
+ 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);
+ }
+ if (data.headerRowHeight === 'autogrow') {
+ $grid.addClass('autogrow-header-row');
+ }
+ if (data.bodyRowHeight === 'fixed') {
+ $grid.addClass('fixed-body-rows');
+ }
+ $grid.addClass(data.style.table);
+ if ('checkbox' === data.selectionMethod) {
+ data.columns.splice(bt.grid.methods.getColumnPositionNotInRole($grid), 0, {
+ title: '',
+ width: data.defaultCheckBoxColumnWidth,
+ align: 'center',
+ type: 'checkbox',
+ role: 'selectRow',
+ events: {
+ click: function (e) {
+ bt.grid.methods.setSelected($grid, e.data.id, $(this).closest('tr'));
+ }
+ },
+ headerCssClass: 'bt-grid-select-all',
+ stopPropagation: true
+ });
+ }
+
+ if ($grid.children('tbody').length === 0) {
+ $grid.append($(' '));
+ }
+
+ bt.grid.methods.renderHeader($grid);
+ bt.grid.methods.appendEmptyRow($grid, ' ');
+ bt.grid.events.initialized($grid);
+ },
+
+ localization: function (data) {
+ if (!data.notFoundText) {
+ data.notFoundText = bt.grid.messages[data.locale].NoRecordsFound;
+ }
+ },
+
+ renderHeader: function ($grid) {
+ var data, columns, style, $thead, $row, $cell, $title, 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 ('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.checkbox({ uiLibrary: data.uiLibrary });
+ }
+ $checkAllBoxes.off('click').on('click', function () {
+ if (this.checked) {
+ $grid.selectAll();
+ } else {
+ $grid.unSelectAll();
+ }
+ });
+ } else {
+ $title = $('
').html(typeof (columns[i].title) === 'undefined' ? columns[i].field : columns[i].title);
+ $cell.append($title);
+ if (columns[i].sortable) {
+ $title.addClass(style.sortable);
+ $title.on('click', bt.grid.methods.createSortHandler($grid, columns[i]));
+ }
+ }
+ if (columns[i].hidden) {
+ $cell.hide();
+ }
+ $row.append($cell);
+ }
+
+ $thead.empty().append($row);
+ },
+
+ createSortHandler: function ($grid, 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, $cellTitle,
+ data = $grid.data(),
+ sortBy = data.params[data.paramNames.sortBy],
+ direction = data.params[data.paramNames.direction];
+
+ $grid.find('thead tr th [data-role="sorticon"]').remove();
+
+ if (sortBy) {
+ position = bt.grid.methods.getColumnPosition($grid.data('columns'), sortBy);
+ if (position > -1) {
+ $cellTitle = $grid.find('thead tr th:eq(' + position + ') div[data-role="title"]');
+ $sortIcon = $('
').append(('desc' === direction) ? data.icons.desc : data.icons.asc);
+ $cellTitle.after($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;
+ bt.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 = $('' + bt.grid.messages[data.locale].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();
+ },
+
+ appendEmptyRow: function ($grid, caption) {
+ var data, $row, $cell, $wrapper;
+ data = $grid.data();
+ $row = $(' ');
+ $cell = $(' ').css({ width: '100%', 'text-align': 'center' });
+ $cell.attr('colspan', bt.grid.methods.countVisibleColumns($grid));
+ $wrapper = $('
').html(caption || data.notFoundText);
+ $cell.append($wrapper);
+ $row.append($cell);
+
+ bt.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 });
+ }
+ bt.grid.methods.setDefaultColumnConfig(data.columns, data.defaultColumnSettings);
+ }
+ bt.grid.methods.renderHeader($grid);
+ },
+
+ loadData: function ($grid) {
+ var data, records, i, recLen, rowCount, $tbody, $rows, $row;
+
+ data = $grid.data();
+ records = $grid.getAll();
+ bt.grid.events.dataBinding($grid, records);
+ recLen = records.length;
+ bt.grid.methods.stopLoading($grid);
+
+ if (data.autoGenerateColumns) {
+ bt.grid.methods.autoGenerateColumns($grid, records);
+ }
+
+ $tbody = $grid.children('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();
+ bt.grid.methods.appendEmptyRow($grid);
+ }
+
+ $rows = $tbody.children('tr');
+
+ rowCount = $rows.length;
+
+ for (i = 0; i < rowCount; i++) {
+ if (i < recLen) {
+ $row = $rows.eq(i);
+ bt.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++) {
+ bt.grid.methods.renderRow($grid, null, records[i], i);
+ }
+ bt.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);
+ } else {
+ mode = 'update';
+ $row.removeClass(data.style.content.rowSelected).removeAttr('data-selected').off('click');
+ }
+ id = bt.grid.methods.getId(record, data.primaryKey, (position + 1));
+ $row.attr('data-position', position + 1);
+ if (data.selectionMethod !== 'checkbox') {
+ $row.on('click', bt.grid.methods.createRowClickHandler($grid, id));
+ }
+ for (i = 0; i < data.columns.length; i++) {
+ if (mode === 'update') {
+ $cell = $row.find('td:eq(' + i + ')');
+ bt.grid.methods.renderCell($grid, $cell, data.columns[i], record, id);
+ } else {
+ $cell = bt.grid.methods.renderCell($grid, null, data.columns[i], record, id);
+ $row.append($cell);
+ }
+ }
+ bt.grid.events.rowDataBound($grid, $row, id, record);
+ },
+
+ renderCell: function ($grid, $cell, column, record, id, mode) {
+ var $displayEl, key;
+
+ if (!$cell || $cell.length === 0) {
+ $cell = $(' ');
+ $displayEl = $('
');
+ column.align && $cell.css('text-align', column.align);
+ column.cssClass && $cell.addClass(column.cssClass);
+ $cell.append($displayEl);
+ mode = 'create';
+ } else {
+ $displayEl = $cell.find('div[data-role="display"]');
+ mode = 'update';
+ }
+
+ bt.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 }, bt.grid.methods.createCellEventHandler(column, column.events[key]));
+ }
+ }
+ }
+ if (column.hidden) {
+ $cell.hide();
+ }
+
+ bt.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 && bt.checkbox) {
+ if ('create' === mode) {
+ $checkbox = $(' ').val(id).prop('checked', (record[column.field] ? true : false));
+ column.role && $checkbox.attr('data-role', column.role);
+ $displayEl.append($checkbox);
+ $checkbox.checkbox({ uiLibrary: $grid.data('uiLibrary') });
+ if (column.role === 'selectRow') {
+ $checkbox.on('click', function () { return false; });
+ } else {
+ $checkbox.prop('disabled', true);
+ }
+ } else {
+ $displayEl.find('input[type="checkbox"]').val(id).prop('checked', (record[column.field] ? true : false));
+ }
+ } else if ('icon' === column.type) {
+ if ('create' === mode) {
+ $displayEl.append($(' ').addClass(column.icon).css({ cursor: 'pointer' }));
+ $grid.data().uiLibrary === 'bootstrap' && $displayEl.children('span').addClass('glyphicon');
+ column.stopPropagation = true;
+ }
+ } else if (column.tmpl) {
+ text = column.tmpl;
+ column.tmpl.replace(/\{(.+?)\}/g, function ($0, $1) {
+ text = text.replace($0, bt.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 {
+ record[column.field] = bt.grid.methods.formatText(record[column.field], column);
+ if (!column.tooltip && record[column.field]) {
+ $displayEl.attr('title', record[column.field]);
+ }
+ $displayEl.html(record[column.field]);
+ }
+ if (column.tooltip && 'create' === mode) {
+ $displayEl.attr('title', column.tooltip);
+ }
+ },
+
+ formatText: function (text, column) {
+ if (text && column.type === 'date') {
+ text = bt.core.formatDate(bt.core.parseDate(text, column.format), column.format);
+ } 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 () {
+ bt.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);
+ }
+ }
+ return bt.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');
+ return bt.grid.events.rowUnselect($grid, $row, id, $grid.getById(id));
+ }
+ },
+
+ setSelected: function ($grid, id, $row) {
+ var data = $grid.data();
+ if (!$row || !$row.length) {
+ $row = bt.grid.methods.getRowById($grid, id);
+ }
+ if ($row) {
+ if ($row.attr('data-selected') === 'true') {
+ bt.grid.methods.unselectRow($grid, data, $row, id);
+ } else {
+ if ('single' === data.selectionType) {
+ $row.siblings('[data-selected="true"]').each(function () {
+ var $row = $(this),
+ id = bt.grid.methods.getId($row, data.primaryKey, $row.data('position'));
+ bt.grid.methods.unselectRow($grid, data, $row, id);
+ });
+ }
+ bt.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),
+ position = $row.data('position'),
+ record = $grid.get(position),
+ id = bt.grid.methods.getId(record, data.primaryKey, position);
+ bt.grid.methods.selectRow($grid, data, $row, id);
+ });
+ $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),
+ position = $row.data('position'),
+ record = $grid.get(position),
+ id = bt.grid.methods.getId(record, data.primaryKey, position);
+ bt.grid.methods.unselectRow($grid, data, $row, id);
+ $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 = bt.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,
+ data = $grid.data(),
+ $selections = bt.grid.methods.getSelectedRows($grid);
+ if (0 < $selections.length) {
+ $selections.each(function () {
+ position = $(this).data('position');
+ record = $grid.get(position);
+ result.push(bt.grid.methods.getId(record, 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.children('tbody').children('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 = bt.grid.methods.getColumnPosition($grid.data('columns'), field);
+ if (position > -1) {
+ $row = bt.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 = bt.grid.methods.getCell($grid, id, field);
+ if ($displayEl) {
+ $displayEl.empty();
+ if (typeof (value) === 'object') {
+ $displayEl.append(value);
+ } else {
+ column = bt.grid.methods.getColumnInfo($grid, field);
+ bt.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 = [];
+ bt.grid.methods.stopLoading($grid);
+ bt.grid.methods.appendEmptyRow($grid, showNotFoundText ? data.notFoundText : ' ');
+ bt.grid.events.dataBound($grid, [], 0);
+ return $grid;
+ },
+
+ render: function ($grid, response) {
+ if (response) {
+ bt.grid.methods.setRecordsData($grid, response);
+ bt.grid.methods.updateHeader($grid);
+ bt.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 = bt.grid.methods.getColumnInfo($grid, data.params[data.paramNames.sortBy]);
+ records.sort(column.sortable.sorter ? column.sortable.sorter(column.direction, column) : bt.grid.methods.createDefaultSorter(column.direction, column.field));
+ }
+
+ for (field in data.params) {
+ if (data.params[field] && !data.paramNames[field]) {
+ column = bt.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);
+ });
+ }
+ }
+
+ bt.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) {
+ bt.grid.events.destroying($grid);
+ bt.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 = bt.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', bt.grid.methods.countVisibleColumns($grid));
+ }
+
+ bt.grid.events.columnShow($grid, data.columns[position]);
+ }
+
+ return $grid;
+ },
+
+ hideColumn: function ($grid, field) {
+ var data = $grid.data(),
+ position = bt.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', bt.grid.methods.countVisibleColumns($grid));
+ }
+
+ bt.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;
+ bt.grid.events.dataBinding($grid, [record]);
+ data.records.push(record);
+ if ($.isArray(data.dataSource)) {
+ data.dataSource.push(record);
+ }
+ if (data.totalRecords === 1) {
+ $grid.children('tbody').empty();
+ }
+ if (bt.grid.methods.isLastRecordVisible($grid)) {
+ bt.grid.methods.renderRow($grid, null, record, $grid.count() - 1);
+ }
+ bt.grid.events.dataBound($grid, [record], data.totalRecords);
+ return $grid;
+ },
+
+ updateRow: function ($grid, id, record) {
+ var $row = bt.grid.methods.getRowById($grid, id),
+ data = $grid.data(), position;
+ data.records[$row.data('position') - 1] = record;
+ if ($.isArray(data.dataSource)) {
+ position = bt.grid.methods.getRecVPosById($grid, id);
+ data.dataSource[position] = record;
+ }
+ bt.grid.methods.renderRow($grid, $row, record, $row.index());
+ return $grid;
+ },
+
+ removeRow: function ($grid, id) {
+ var position,
+ data = $grid.data(),
+ $row = bt.grid.methods.getRowById($grid, id);
+
+ bt.grid.events.rowRemoving($grid, $row, id, $grid.getById(id));
+ if ($.isArray(data.dataSource)) {
+ position = bt.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;
+ },
+
+ getColumnPositionByRole: function ($grid, role) {
+ var i, result, columns = $grid.data('columns');
+ for (i = 0; i < columns.length; i++) {
+ if (columns[i].role === role) {
+ result = i;
+ break;
+ }
+ }
+ return result;
+ },
+
+ getColumnPositionNotInRole: function ($grid) {
+ var i, result = 0, columns = $grid.data('columns');
+ for (i = 0; i < columns.length; i++) {
+ if (!columns[i].role) {
+ result = i;
+ break;
+ }
+ }
+ return result;
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Base
+ */
+bt.grid.widget = function ($grid, jsConfig) {
+ var self = this,
+ methods = bt.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
+ *
+ * Search
+ *
+ *
+ *
+ */
+ self.reload = function (params) {
+ methods.startLoading(this);
+ return bt.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
+ * Clear
+ *
+ *
+ *
+ */
+ 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
+ * Count Visible Records
+ * Count All Records
+ *
+ *
+ *
+ * @example Remote.DataSource
+ * Count Visible Records
+ * Count All Records
+ *
+ *
+ *
+ */
+ 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
+ * Destroy
+ * Create
+ *
+ *
+ *
+ * @example remove.wrapper.and.table
+ * Remove
+ *
+ *
+ *
+ */
+ 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
+ *
+ * Select
+ *
+ *
+ *
+ */
+ 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
+ * Show Selection
+ *
+ *
+ *
+ */
+ self.getSelected = function () {
+ return methods.getSelected(this);
+ };
+
+ /**
+ * Return an array with the ids of the selected record.
+ * @additionalinfo Specify primaryKey if you want to use field from the dataSource as identificator for selection.
+ * @method
+ * @return array
+ * @example With.Primary.Ket
+ * Show Selections
+ *
+ *
+ *
+ * @example Without.Primary.Ket
+ * Show Selections
+ *
+ *
+ *
+ */
+ self.getSelections = function () {
+ return methods.getSelections(this);
+ };
+
+ /**
+ * Select all records from the grid.
+ * @method
+ * @return grid
+ * @example sample
+ * Select All
+ *
+ *
+ *
+ */
+ self.selectAll = function () {
+ return methods.selectAll(this);
+ };
+
+ /**
+ * Unselect all records from the grid.
+ * @method
+ * @return void
+ * @example sample
+ * Select All
+ * UnSelect All
+ *
+ *
+ *
+ */
+ 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
+ * Get Data
+ *
+ *
+ *
+ */
+ 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
+ * Get Data
+ *
+ *
+ *
+ */
+ 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
+ * Get All Visible Records
+ * Get All Records
+ *
+ *
+ *
+ * @example Remote.DataSource
+ * Get All Visible Records
+ * Get All Records
+ *
+ *
+ *
+ */
+ 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
+ * Show Column
+ *
+ *
+ *
+ */
+ 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
+ * Hide Column
+ *
+ *
+ *
+ */
+ 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
+ * Add Row
+ *
+ *
+ *
+ * @example with.pagination
+ * Add Row
+ *
+ *
+ *
+ */
+ 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;
+}
+
+bt.grid.widget.prototype = new bt.widget();
+bt.grid.widget.constructor = bt.grid.widget;
+
+bt.grid.widget.prototype.getConfig = bt.grid.methods.getConfig;
+bt.grid.widget.prototype.getHTMLConfig = bt.grid.methods.getHTMLConfig;
+
+(function ($) {
+ $.fn.grid = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.grid.widget(this, method);
+ } else {
+ $widget = new bt.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 Fixed Header
+ */
+bt.grid.plugins.fixedHeader = {
+ config: {
+ base: {
+
+ /** If set to true, add scroll to the table body
+ * @type boolean
+ * @default object
+ * @example Material.Design.Without.Pager
+ *
+ *
+ * @example Material.Design.With.Pager
+ *
+ *
+ * @example Bootstrap.3.Without.Pager
+ *
+ *
+ * @example Bootstrap.3.With.Pager
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ fixedHeader: false,
+
+ height: 300
+ }
+ },
+
+ private: {
+ init: function ($grid) {
+ var data = $grid.data(),
+ $tbody = $grid.children('tbody'),
+ $thead = $grid.children('thead'),
+ bodyHeight = data.height - $thead.outerHeight() - ($grid.children('tfoot').outerHeight() || 0);
+ $grid.addClass('bt-grid-scrollable');
+ $tbody.css('width', $thead.outerWidth());
+ $tbody.height(bodyHeight);
+ },
+
+ refresh: function ($grid) {
+ var i, width,
+ data = $grid.data(),
+ $tbody = $grid.children('tbody'),
+ $thead = $grid.children('thead'),
+ $tbodyCells = $grid.find('tbody tr[data-role="row"] td'),
+ $theadCells = $grid.find('thead tr[data-role="caption"] th');
+
+ if ($grid.children('tbody').height() < bt.grid.plugins.fixedHeader.private.getRowsHeight($grid)) {
+ $tbody.css('width', $thead.outerWidth() + bt.grid.plugins.fixedHeader.private.getScrollBarWidth() + (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 ? 1 : 0));
+ } else {
+ $tbody.css('width', $thead.outerWidth());
+ }
+
+ for (i = 0; i < $theadCells.length; i++) {
+ width = $($theadCells[i]).outerWidth();
+ if (i === 0 && bt.core.isIE()) {
+ width = width - 1;
+ }
+ $($tbodyCells[i]).attr('width', width);
+ }
+ },
+
+ getRowsHeight: function ($grid) {
+ var total = 0;
+ $grid.find('tbody tr').each(function () {
+ total += $(this).height();
+ });
+ return total;
+ },
+
+ getScrollBarWidth: function () {
+ var inner = document.createElement('p');
+ inner.style.width = "100%";
+ inner.style.height = "200px";
+
+ var outer = document.createElement('div');
+ outer.style.position = "absolute";
+ outer.style.top = "0px";
+ outer.style.left = "0px";
+ outer.style.visibility = "hidden";
+ outer.style.width = "200px";
+ outer.style.height = "150px";
+ outer.style.overflow = "hidden";
+ outer.appendChild(inner);
+
+ document.body.appendChild(outer);
+ var w1 = inner.offsetWidth;
+ outer.style.overflow = 'scroll';
+ var w2 = inner.offsetWidth;
+ if (w1 == w2) w2 = outer.clientWidth;
+
+ document.body.removeChild(outer);
+
+ return (w1 - w2);
+ }
+ },
+
+ public: {
+ },
+
+ events: {
+ },
+
+ configure: function ($grid, fullConfig, clientConfig) {
+ $.extend(true, $grid, bt.grid.plugins.fixedHeader.public);
+ var data = $grid.data();
+ if (clientConfig.fixedHeader) {
+ $grid.on('initialized', function () {
+ bt.grid.plugins.fixedHeader.private.init($grid);
+ });
+ $grid.on('dataBound', function () {
+ bt.grid.plugins.fixedHeader.private.refresh($grid);
+ });
+ $grid.on('resize', function () {
+ bt.grid.plugins.fixedHeader.private.refresh($grid);
+ });
+ }
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Expand Collapse Rows
+ */
+bt.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 Material.Design
+ *
+ *
+ * @example Bootstrap.3
+ *
+ *
+ * @example Bootstrap.4.Font.Awesome
+ *
+ *
+ */
+ 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,
+
+ expandedRows: [],
+
+ icons: {
+ /** Expand row icon definition.
+ * @alias icons.expandRow
+ * @type String
+ * @default ' '
+ * @example Plus.Minus.Icons
+ *
+ *
+ */
+ expandRow: ' ',
+
+ /** Collapse row icon definition.
+ * @alias icons.collapseRow
+ * @type String
+ * @default ' '
+ * @example Plus.Minus.Icons
+ *
+ *
+ */
+ collapseRow: ' '
+ }
+ },
+
+ fontawesome: {
+ icons: {
+ expandRow: ' ',
+ collapseRow: ' '
+ }
+ },
+
+ glyphicons: {
+ icons: {
+ expandRow: ' ',
+ collapseRow: ' '
+ }
+ }
+ },
+
+ 'private': {
+ expandDetail: function ($grid, $cell, id) {
+ var $contentRow = $cell.closest('tr'),
+ $detailsRow = $(' '),
+ $detailsCell = $(' '),
+ $detailsWrapper = $('
'),
+ data = $grid.data(),
+ position = $contentRow.data('position'),
+ record = $grid.get(position),
+ plugin = bt.grid.plugins.expandCollapseRows;
+
+ if (typeof (id) === undefined) {
+ id = bt.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.collapseRow);
+ $grid.updateDetails($contentRow);
+ plugin.private.keepSelection($grid, id);
+ plugin.events.detailExpand($grid, $detailsRow.find('td>div'), id);
+ },
+
+ collapseDetail: function ($grid, $cell, id) {
+ var $contentRow = $cell.closest('tr'),
+ $detailsRow = $contentRow.next('tr[data-role="details"]'),
+ data = $grid.data(),
+ plugin = bt.grid.plugins.expandCollapseRows;
+
+ if (typeof (id) === undefined) {
+ id = bt.grid.methods.getId(record, data.primaryKey, record);
+ }
+ $detailsRow.remove();
+ $cell.children('div[data-role="display"]').empty().append(data.icons.expandRow);
+ plugin.private.removeSelection($grid, id);
+ plugin.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', bt.grid.methods.countVisibleColumns($grid));
+ }
+ }
+ },
+
+ 'public': {
+
+ /**
+ * Collapse all grid rows.
+ * @method
+ * @return jQuery object
+ * @example Sample
+ * Expand All
+ * Collapse All
+ *
+ *
+ *
+ */
+ collapseAll: function () {
+ var $grid = this, data = $grid.data(), position;
+
+
+ if (typeof (data.detailTemplate) !== 'undefined') {
+ position = bt.grid.methods.getColumnPositionByRole($grid, 'expander');
+ $grid.find('tbody tr[data-role="row"]').each(function () {
+ bt.grid.plugins.expandCollapseRows.private.collapseDetail($grid, $(this).find('td:eq(' + position + ')'));
+ });
+ }
+
+ if (typeof (data.grouping) !== 'undefined') {
+ $grid.find('tbody tr[role="group"]').each(function () {
+ bt.grid.plugins.grouping.private.collapseGroup(data, $(this).find('td:eq(0)'));
+ });
+ }
+ return $grid;
+ },
+
+ /**
+ * Expand all grid rows.
+ * @method
+ * @return jQuery object
+ * @example Sample
+ * Expand All
+ * Collapse All
+ *
+ *
+ *
+ */
+ expandAll: function () {
+ var $grid = this, data = $grid.data(), position;
+
+ if (typeof (data.detailTemplate) !== 'undefined') {
+ position = bt.grid.methods.getColumnPositionByRole($grid, 'expander');
+ $grid.find('tbody tr[data-role="row"]').each(function () {
+ bt.grid.plugins.expandCollapseRows.private.expandDetail($grid, $(this).find('td:eq(' + position + ')'));
+ });
+ }
+
+ if (typeof (data.grouping) !== 'undefined') {
+ $grid.find('tbody tr[role="group"]').each(function () {
+ bt.grid.plugins.grouping.private.expandGroup(data, $(this).find('td:eq(0)'));
+ });
+ }
+ return $grid;
+ },
+
+ //TODO: add documentation
+ updateDetails: function ($contentRow) {
+ var $grid = this,
+ $detailWrapper = $contentRow.data('details'),
+ content = $detailWrapper.html(),
+ record = $grid.get($contentRow.data('position'));
+
+ if (record && content) {
+ $detailWrapper.html().replace(/\{(.+?)\}/g, function ($0, $1) {
+ var column = bt.grid.methods.getColumnInfo($grid, $1);
+ content = content.replace($0, bt.grid.methods.formatText(record[$1], column));
+ });
+ $detailWrapper.html(content);
+ }
+ return $grid;
+ }
+ },
+
+ '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, bt.grid.plugins.expandCollapseRows.public);
+
+ if (typeof (data.detailTemplate) !== 'undefined') {
+ column = {
+ title: '',
+ width: data.defaultIconColumnWidth,
+ align: 'center',
+ stopPropagation: true,
+ cssClass: 'bt-cursor-pointer bt-unselectable',
+ tmpl: data.icons.expandRow,
+ role: 'expander',
+ events: {
+ 'click': function (e) {
+ var $cell = $(this), methods = bt.grid.plugins.expandCollapseRows.private;
+ if ($cell.closest('tr').next().attr('data-role') === 'details') {
+ methods.collapseDetail($grid, $cell, e.data.id);
+ } else {
+ methods.expandDetail($grid, $(this), 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) {
+ bt.grid.plugins.expandCollapseRows.private.updateDetailsColSpan($grid);
+ });
+ $grid.on('columnHide', function (e, column) {
+ bt.grid.plugins.expandCollapseRows.private.updateDetailsColSpan($grid);
+ });
+ $grid.on('rowRemoving', function (e, $row, id, record) {
+ bt.grid.plugins.expandCollapseRows.private.collapseDetail($grid, $row.children('td').first(), id);
+ });
+ $grid.on('dataBinding', function () {
+ $grid.collapseAll();
+ });
+ $grid.on('pageChanging', function () {
+ $grid.collapseAll();
+ });
+ $grid.on('dataBound', function () {
+ var i, $cell, $row, position, data = $grid.data();
+ if (data.keepExpandedRows && $.isArray(data.expandedRows)) {
+ for (i = 0; i < data.expandedRows.length; i++) {
+ $row = bt.grid.methods.getRowById($grid, data.expandedRows[i]);
+ if ($row && $row.length) {
+ position = bt.grid.methods.getColumnPositionByRole($grid, 'expander');
+ $cell = $row.children('td:eq(' + position + ')');
+ if ($cell && $cell.length) {
+ bt.grid.plugins.expandCollapseRows.private.expandDetail($grid, $cell);
+ }
+ }
+ }
+ }
+ });
+ }
+ }
+};
+/**
+ * @widget Grid
+ * @plugin Inline Editing
+ */
+bt.grid.plugins.inlineEditing = {
+ renderers: {
+ editManager: function (value, record, $cell, $displayEl, id, $grid) {
+ var data = $grid.data(),
+ $edit = $(data.inlineEditing.editButton).attr('key', id),
+ $delete = $(data.inlineEditing.deleteButton).attr('key', id),
+ $update = $(data.inlineEditing.updateButton).attr('key', id).hide(),
+ $cancel = $(data.inlineEditing.cancelButton).attr('key', id).hide();
+ $edit.on('click', function (e) {
+ $grid.edit($(this).attr('key'));
+ });
+ $delete.on('click', function (e) {
+ $grid.removeRow($(this).attr('key'));
+ });
+ $update.on('click', function (e) {
+ $grid.update($(this).attr('key'));
+ });
+ $cancel.on('click', function (e) {
+ $grid.cancel($(this).attr('key'));
+ });
+ $displayEl.empty().append($edit).append($delete).append($update).append($cancel);
+ }
+ }
+};
+
+bt.grid.plugins.inlineEditing.config = {
+ base: {
+ defaultColumnSettings: {
+ /** Provides a way to set an editing UI for the column.
+ * @alias column.editor
+ * @type function|boolean
+ * @default undefined
+ * @example Material.Design
+ *
+ *
+ * @example Custom.With.Select2
+ *
+ *
+ *
+ *
+ * @example Bootstrap.3
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ editor: undefined,
+
+ /** The name of the field in the grid data where the grid is going to set the new value.
+ * @additionalinfo This is usable when the editor is interface with key/value pairs like dropdowns where the key needs to be updated in a different field..
+ * @alias column.editField
+ * @type String
+ * @default undefined
+ * @example Bootstrap.4
+ *
+ *
+ */
+ editField: undefined,
+
+ /** Provides a way to specify a display mode for the column.
+ * @alias column.mode
+ * @type readEdit|editOnly|readOnly
+ * @default readEdit
+ * @example sample
+ *
+ *
+ */
+ mode: 'readEdit'
+ },
+ 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 Bootstrap.4
+ *
+ *
+ */
+ managementColumn: true,
+
+ managementColumnConfig: { width: 300, role: 'managementColumn', align: 'center', renderer: bt.grid.plugins.inlineEditing.renderers.editManager, cssClass: 'bt-grid-management-column' }
+ }
+ },
+
+ bootstrap: {
+ inlineEditing: {
+ managementColumnConfig: { width: 200, role: 'managementColumn', align: 'center', renderer: bt.grid.plugins.inlineEditing.renderers.editManager, cssClass: 'bt-grid-management-column' }
+ }
+ },
+
+ bootstrap4: {
+ inlineEditing: {
+ managementColumnConfig: { width: 280, role: 'managementColumn', align: 'center', renderer: bt.grid.plugins.inlineEditing.renderers.editManager, cssClass: 'bt-grid-management-column' }
+ }
+ }
+};
+
+bt.grid.plugins.inlineEditing.private = {
+ localization: function (data) {
+ if (data.uiLibrary === 'bootstrap') {
+ data.inlineEditing.editButton = ' ' + bt.grid.messages[data.locale].Edit + ' ';
+ data.inlineEditing.deleteButton = ' ' + bt.grid.messages[data.locale].Delete + ' ';
+ data.inlineEditing.updateButton = ' ' + bt.grid.messages[data.locale].Update + ' ';
+ data.inlineEditing.cancelButton = ' ' + bt.grid.messages[data.locale].Cancel + ' ';
+ } else {
+ data.inlineEditing.editButton = ' ' + bt.grid.messages[data.locale].Edit.toUpperCase() + ' ';
+ data.inlineEditing.deleteButton = ' ' + bt.grid.messages[data.locale].Delete.toUpperCase() + ' ';
+ data.inlineEditing.updateButton = ' ' + bt.grid.messages[data.locale].Update.toUpperCase() + ' ';
+ data.inlineEditing.cancelButton = ' ' +bt.grid.messages[data.locale].Cancel.toUpperCase() + ' ';
+ }
+ },
+
+ editMode: function ($grid, $cell, column, record) {
+ var $displayContainer, $editorContainer, $editorField, value, config, data = $grid.data();
+ if ($cell.attr('data-mode') !== 'edit') {
+ if (column.editor) {
+ bt.grid.plugins.inlineEditing.private.updateOtherCells($grid, column.mode);
+ $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.editField || column.field];
+ $editorField = $editorContainer.find('input, select, textarea').first();
+ if ($editorField.length) {
+ column.type === 'checkbox' ? $editorField.prop('checked', value) : $editorField.val(value);
+ } else {
+ if (typeof (column.editor) === 'function') {
+ column.editor($editorContainer, value, record);
+ $editorField = $editorContainer.find('input, select, textarea').first();
+ } else {
+ config = typeof column.editor === "object" ? column.editor : {};
+ config.uiLibrary = data.uiLibrary;
+ config.iconsLibrary = data.iconsLibrary;
+ config.fontSize = $grid.css('font-size');
+ if ('checkbox' === column.type && bt.checkbox) {
+ $editorField = $(' ').prop('checked', value);
+ $editorContainer.append($editorField);
+ $editorField.checkbox(config);
+ } else if ('date' === column.type && bt.datepicker) {
+ $editorField = $(' ');
+ $editorContainer.append($editorField);
+ if (column.format) {
+ config.format = column.format;
+ }
+ $editorField = $editorField.datepicker(config);
+ if ($editorField.value) {
+ $editorField.value($displayContainer.html());
+ }
+ } else if ('dropdown' === column.type && bt.dropdown) {
+ $editorField = $(' ');
+ $editorContainer.append($editorField);
+ config.dataBound = function (e) {
+ var $dropdown = $(this).dropdown();
+ if (column.editField) {
+ $dropdown.value(record[column.editField]);
+ } else {
+ $dropdown.value(record[column.field]);
+ }
+ };
+ $editorField = $editorField.dropdown(config);
+ } else {
+ $editorField = $(' ');
+ if (data.uiLibrary === 'materialdesign') {
+ $editorField.addClass('bt-textbox-md').css('font-size', $grid.css('font-size'));
+ }
+ $editorContainer.append($editorField);
+ }
+ }
+ if (data.inlineEditing.mode !== 'command' && column.mode !== 'editOnly') {
+ $editorField = $editorContainer.find('input, select, textarea').first();
+ $editorField.on('keyup', function (e) {
+ if (e.keyCode === 13 || e.keyCode === 27) {
+ bt.grid.plugins.inlineEditing.private.displayMode($grid, $cell, column);
+ }
+ });
+ }
+ }
+ if ($editorField.prop('tagName').toUpperCase() === "INPUT" && $editorField.prop('type').toUpperCase() === 'TEXT') {
+ bt.grid.plugins.inlineEditing.private.setCaretAtEnd($editorField[0]);
+ } else {
+ $editorField.focus();
+ }
+ $cell.attr('data-mode', 'edit');
+ } else if (column.role === 'managementColumn') {
+ $cell.find('[role="edit"]').hide();
+ $cell.find('[role="delete"]').hide();
+ $cell.find('[role="update"]').show();
+ $cell.find('[role="cancel"]').show();
+ }
+ }
+ },
+
+ 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, $ele, newValue, newEditFieldValue, record, position, style = '';
+ if (column.mode !== 'editOnly') {
+ if ($cell.attr('data-mode') === 'edit') {
+ $editorContainer = $cell.find('div[data-role="edit"]');
+ $displayContainer = $cell.find('div[data-role="display"]');
+ $ele = $editorContainer.find('input, select, textarea').first();
+ if ($ele[0].tagName.toUpperCase() === "SELECT" && $ele[0].selectedIndex > -1) {
+ newValue = $ele[0].options[$ele[0].selectedIndex].innerHTML;
+ newEditFieldValue = $ele[0].value;
+ } else if ($ele[0].tagName.toUpperCase() === "INPUT" && $ele[0].type.toUpperCase() === "CHECKBOX") {
+ newValue = $ele[0].checked;
+ } else {
+ newValue = $ele.val();
+ }
+ position = $cell.parent().data('position');
+ record = $grid.get(position);
+ if (cancel !== true && newValue !== record[column.field]) {
+ record[column.field] = column.type === 'date' ? bt.core.parseDate(newValue, column.format) : newValue;
+ if (column.editField) {
+ record[column.editField] = newEditFieldValue || newValue;
+ }
+ if (column.mode !== 'editOnly') {
+ bt.grid.methods.renderDisplayElement($grid, $displayContainer, column, record, bt.grid.methods.getId(record, $grid.data('primaryKey'), position), 'update');
+ if ($cell.find('span.bt-dirty').length === 0) {
+ $cell.prepend($(' '));
+ }
+ }
+ bt.grid.plugins.inlineEditing.events.cellDataChanged($grid, $cell, column, record, newValue);
+ bt.grid.plugins.inlineEditing.private.updateChanges($grid, column, record, newValue);
+ }
+ $editorContainer.hide();
+ $displayContainer.show();
+ $cell.attr('data-mode', 'display');
+ }
+ if (column.role === 'managementColumn') {
+ $cell.find('[role="update"]').hide();
+ $cell.find('[role="cancel"]').hide();
+ $cell.find('[role="edit"]').show();
+ $cell.find('[role="delete"]').show();
+ }
+ }
+ },
+
+ updateOtherCells: function($grid, mode) {
+ var data = $grid.data();
+ if (data.inlineEditing.mode !== 'command' && mode !== 'editOnly') {
+ $grid.find('div[data-role="edit"]:visible').parent('td').each(function () {
+ var $cell = $(this),
+ column = data.columns[$cell.index()];
+ bt.grid.plugins.inlineEditing.private.displayMode($grid, $cell, column);
+ });
+ }
+ },
+
+ updateChanges: function ($grid, column, sourceRecord, newValue) {
+ var targetRecords, filterResult, newRecord, data = $grid.data();
+ if (!data.guid) {
+ data.guid = bt.grid.plugins.inlineEditing.private.generateGUID();
+ }
+ if (data.primaryKey) {
+ targetRecords = JSON.parse(sessionStorage.getItem('bt.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('bt.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();
+ }
+};
+
+bt.grid.plugins.inlineEditing.public = {
+ /**
+ * Return array with all changes
+ * @method
+ * @return array
+ * @example sample
+ * Get Changes
+ *
+ *
+ *
+ */
+ getChanges: function () {
+ return JSON.parse(sessionStorage.getItem('bt.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 = bt.grid.methods.getRowById(this, id).children('td'),
+ columns = this.data('columns');
+
+ for (i = 0; i < $cells.length; i++) {
+ bt.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 = bt.grid.methods.getRowById(this, id).children('td'),
+ columns = this.data('columns');
+
+ for (i = 0; i < $cells.length; i++) {
+ bt.grid.plugins.inlineEditing.private.displayMode(this, $($cells[i]), columns[i], false);
+ }
+
+ bt.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 = bt.grid.methods.getRowById(this, id).children('td'),
+ columns = this.data('columns');
+
+ for (i = 0; i < $cells.length; i++) {
+ bt.grid.plugins.inlineEditing.private.displayMode(this, $($cells[i]), columns[i], true);
+ }
+
+ return this;
+ }
+};
+
+bt.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} 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]);
+ }
+};
+
+bt.grid.plugins.inlineEditing.configure = function ($grid, fullConfig, clientConfig) {
+ var data = $grid.data();
+ $.extend(true, $grid, bt.grid.plugins.inlineEditing.public);
+ if (clientConfig.inlineEditing) {
+ $grid.on('dataBound', function () {
+ $grid.find('span.bt-dirty').remove();
+ });
+ $grid.on('rowDataBound', function (e, $row, id, record) {
+ $grid.cancel(id);
+ });
+ }
+ if (data.inlineEditing.mode === 'command') {
+ bt.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) {
+ if (column.mode === 'editOnly') {
+ bt.grid.plugins.inlineEditing.private.editMode($grid, $displayEl.parent(), column, record);
+ } else {
+ $displayEl.parent('td').on(data.inlineEditing.mode === 'dblclick' ? 'dblclick' : 'click', function () {
+ bt.grid.plugins.inlineEditing.private.editMode($grid, $displayEl.parent(), column, record);
+ });
+ }
+ }
+ });
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Optimistic Persistence
+ */
+bt.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('bt.grid.' + data.guid));
+ if (storage && storage.optimisticPersistence) {
+ $.extend(params, storage.optimisticPersistence);
+ }
+ storage = JSON.parse(localStorage.getItem('bt.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('bt.grid.' + data.guid)), storage);
+ sessionStorage.setItem('bt.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('bt.grid.' + data.guid)), storage);
+ localStorage.setItem('bt.grid.' + data.guid, JSON.stringify(storage));
+ }
+ }
+ },
+
+ configure: function ($grid, fullConfig, clientConfig) {
+ if (fullConfig.guid) {
+ if (fullConfig.optimisticPersistence.localStorage || fullConfig.optimisticPersistence.sessionStorage) {
+ bt.grid.plugins.optimisticPersistence.private.applyParams($grid);
+ $grid.on('dataBound', function (e) {
+ bt.grid.plugins.optimisticPersistence.private.saveParams($grid);
+ });
+ }
+ }
+ }
+};
+/**
+ * @widget Grid
+ * @plugin Pagination
+ */
+bt.grid.plugins.pagination = {
+ config: {
+ base: {
+ style: {
+ pager: {
+ panel: '',
+ stateDisabled: '',
+ activeButton: ''
+ }
+ },
+
+ 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 [5, 10, 20, 100]
+ * @example Bootstrap.3
+ *
+ *
+ * @example Bootstrap.4.FontAwesome
+ *
+ *
+ * @example Bootstrap.4.Material.Icons
+ *
+ *
+ * @example Material.Design
+ *
+ *
+ */
+ sizes: [5, 10, 20, 100],
+
+ /** 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
+ }
+ },
+
+ bootstrap: {
+ style: {
+ pager: {
+ panel: '',
+ stateDisabled: ''
+ }
+ }
+ },
+
+ bootstrap4: {
+ style: {
+ pager: {
+ panel: 'btn-toolbar',
+ stateDisabled: ''
+ }
+ }
+ },
+
+ glyphicons: {
+ icons: {
+ first: ' ',
+ previous: ' ',
+ next: ' ',
+ last: ' ',
+ refresh: ' '
+ }
+ },
+
+ materialicons: {
+ icons: {
+ first: ' ',
+ previous: ' ',
+ next: ' ',
+ last: ' ',
+ 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;
+ }
+
+ bt.grid.plugins.pagination.private.localization(data);
+
+ $row = $(' ');
+ $cell = $(' ');
+ $row.append($cell);
+
+ $leftPanel = $('
').addClass(data.style.pager.panel).css({ 'float': 'left' });
+ $rightPanel = $('
').addClass(data.style.pager.panel).css({ 'float': 'right' });
+
+ $cell.append($leftPanel).append($rightPanel);
+
+ $tfoot = $(' ').append($row);
+ $grid.append($tfoot);
+ bt.grid.plugins.pagination.private.updatePagerColSpan($grid);
+
+ leftControls = bt.grid.methods.clone(data.pager.leftControls); //clone array
+ $.each(leftControls, function () {
+ $leftPanel.append(this);
+ });
+
+ rightControls = bt.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++) {
+ bt.grid.plugins.pagination.private.initPagerControl($(controls[i]), $grid);
+ }
+ }
+ },
+
+ localization: function (data) {
+ if (data.uiLibrary === 'bootstrap') {
+ bt.grid.plugins.pagination.private.localizationBootstrap(data);
+ } else if (data.uiLibrary === 'bootstrap4') {
+ bt.grid.plugins.pagination.private.localizationBootstrap4(data);
+ } else {
+ bt.grid.plugins.pagination.private.localizationMaterialDesign(data);
+ }
+ },
+
+ localizationBootstrap: function (data) {
+ var msg = bt.grid.messages[data.locale];
+ if (typeof (data.pager.leftControls) === 'undefined') {
+ data.pager.leftControls = [
+ $('' + (data.icons.first || msg.First) + ' ').attr('title', msg.FirstPageTooltip).attr('data-role', 'page-first'),
+ $('' + (data.icons.previous || msg.Previous) + ' ').attr('title', msg.PreviousPageTooltip).attr('data-role', 'page-previous'),
+ $('' + msg.Page + '
'),
+ $(' '),
+ $('' + msg.Of + '
'),
+ $('0
'),
+ $('' + (data.icons.next || msg.Next) + ' ').attr('title', msg.NextPageTooltip).attr('data-role', 'page-next'),
+ $('' + (data.icons.last || msg.Last) + ' ').attr('title', msg.LastPageTooltip).attr('data-role', 'page-last'),
+ $('' + (data.icons.refresh || msg.Refresh) + ' ').attr('title', msg.Refresh).attr('data-role', 'page-refresh'),
+ $(' ')
+ ];
+ }
+ if (typeof (data.pager.rightControls) === 'undefined') {
+ data.pager.rightControls = [
+ $('' + msg.DisplayingRecords + '
'),
+ $('0
'),
+ $('-
'),
+ $('0
'),
+ $('' + msg.Of + '
'),
+ $('0
')
+ ];
+ }
+ },
+
+ localizationBootstrap4: function (data) {
+ var msg = bt.grid.messages[data.locale];
+ if (typeof (data.pager.leftControls) === 'undefined') {
+ data.pager.leftControls = [
+ $('' + (data.icons.first || msg.First) + ' ').attr('title', msg.FirstPageTooltip).attr('data-role', 'page-first'),
+ $('' + (data.icons.previous || msg.Previous) + ' ').attr('title', msg.PreviousPageTooltip).attr('data-role', 'page-previous'),
+ $('' + msg.Page + '
'),
+ $('
'),
+ $('' + msg.Of + '
'),
+ $('0
'),
+ $('' + (data.icons.next || msg.Next) + ' ').attr('title', msg.NextPageTooltip).attr('data-role', 'page-next'),
+ $('' + (data.icons.last || msg.Last) + ' ').attr('title', msg.LastPageTooltip).attr('data-role', 'page-last'),
+ $('' + (data.icons.refresh || msg.Refresh) + ' ').attr('title', msg.Refresh).attr('data-role', 'page-refresh'),
+ $(' ')
+ ];
+ }
+ if (typeof (data.pager.rightControls) === 'undefined') {
+ data.pager.rightControls = [
+ $('' + msg.DisplayingRecords + '
'),
+ $('0
'),
+ $('-
'),
+ $('0
'),
+ $('' + msg.Of + '
'),
+ $('0
')
+ ];
+ }
+ },
+
+ localizationMaterialDesign: function (data) {
+ var msg = bt.grid.messages[data.locale];
+ if (typeof (data.pager.leftControls) === 'undefined') {
+ data.pager.leftControls = [];
+ }
+ if (typeof (data.pager.rightControls) === 'undefined') {
+ data.pager.rightControls = [
+ $('' + msg.RowsPerPage + ' '),
+ $(' '),
+ $(' '),
+ $('0 '),
+ $('- '),
+ $('0 '),
+ $(''),
+ $('0 '),
+ $(' '),
+ $('' + (data.icons.previous || msg.Previous) + ' ').attr('title', msg.PreviousPageTooltip).attr('data-role', 'page-previous').addClass(data.icons.first ? 'bt-button-md-icon' : ''),
+ $(' '),
+ $('' + (data.icons.next || msg.Next) + ' ').attr('title', msg.NextPageTooltip).attr('data-role', 'page-next').addClass(data.icons.first ? 'bt-button-md-icon' : '')
+ ];
+ }
+ },
+
+ 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($(' ').attr('value', this.toString()).text(this.toString()));
+ });
+ $control.change(function () {
+ var newSize = parseInt(this.value, 10);
+ data.params[data.paramNames.limit] = newSize;
+ bt.grid.plugins.pagination.private.changePage($grid, 1);
+ bt.grid.plugins.pagination.events.pageSizeChange($grid, newSize);
+ });
+ $control.val(data.params[data.paramNames.limit]);
+ if (bt.dropdown) {
+ $control.dropdown({
+ uiLibrary: data.uiLibrary,
+ iconsLibrary: data.iconsLibrary,
+ fontSize: $control.css('font-size'),
+ style: {
+ presenter: 'btn btn-default btn-sm'
+ }
+ });
+ }
+ } else {
+ $control.hide();
+ }
+ break;
+ case 'page-refresh':
+ $control.on('click', function () { $grid.reload(); });
+ break;
+ }
+
+ },
+
+ reloadPager: function ($grid, totalRecords) {
+ var page, limit, lastPage, firstRecord, lastRecord, data, controls, i;
+
+ data = $grid.data();
+
+ if (data.pager) {
+ page = (0 === totalRecords) ? 0 : parseInt(data.params[data.paramNames.page], 10);
+ limit = parseInt(data.params[data.paramNames.limit], 10);
+ lastPage = Math.ceil(totalRecords / limit);
+ firstRecord = (0 === page) ? 0 : (limit * (page - 1)) + 1;
+ lastRecord = (firstRecord + limit) > totalRecords ? totalRecords : (firstRecord + limit) - 1;
+
+ controls = $grid.find('TFOOT [data-role]');
+ for (i = 0; i < controls.length; i++) {
+ bt.grid.plugins.pagination.private.reloadPagerControl($(controls[i]), $grid, page, lastPage, firstRecord, lastRecord, totalRecords);
+ }
+
+ bt.grid.plugins.pagination.private.updatePagerColSpan($grid);
+ }
+ },
+
+ reloadPagerControl: function ($control, $grid, page, lastPage, firstRecord, lastRecord, totalRecords) {
+ var newPage;
+ switch ($control.data('role')) {
+ case 'page-first':
+ bt.grid.plugins.pagination.private.assignPageHandler($grid, $control, 1, page < 2);
+ break;
+ case 'page-previous':
+ bt.grid.plugins.pagination.private.assignPageHandler($grid, $control, page - 1, page < 2);
+ break;
+ case 'page-number':
+ $control.val(page).off('change').on('change', bt.grid.plugins.pagination.private.createChangePageHandler($grid, page));
+ break;
+ case 'page-label-last':
+ $control.text(lastPage);
+ break;
+ case 'page-next':
+ bt.grid.plugins.pagination.private.assignPageHandler($grid, $control, page + 1, lastPage === page);
+ break;
+ case 'page-last':
+ bt.grid.plugins.pagination.private.assignPageHandler($grid, $control, lastPage, lastPage === page);
+ break;
+ case 'page-button-one':
+ newPage = (page === 1) ? 1 : ((page == lastPage) ? (page - 2) : (page - 1));
+ bt.grid.plugins.pagination.private.assignButtonHandler($grid, $control, page, newPage, lastPage);
+ break;
+ case 'page-button-two':
+ newPage = (page === 1) ? 2 : ((page == lastPage) ? lastPage - 1 : page);
+ bt.grid.plugins.pagination.private.assignButtonHandler($grid, $control, page, newPage, lastPage);
+ break;
+ case 'page-button-three':
+ newPage = (page === 1) ? page + 2 : ((page == lastPage) ? page : (page + 1));
+ bt.grid.plugins.pagination.private.assignButtonHandler($grid, $control, page, newPage, lastPage);
+ break;
+ case 'record-first':
+ $control.text(firstRecord);
+ break;
+ case 'record-last':
+ $control.text(lastRecord);
+ break;
+ case 'record-total':
+ $control.text(totalRecords);
+ break;
+ }
+ },
+
+ assignPageHandler: function ($grid, $control, newPage, disabled) {
+ var style = $grid.data().style.pager;
+ if (disabled) {
+ $control.addClass(style.stateDisabled).prop('disabled', true).off('click');
+ } else {
+ $control.removeClass(style.stateDisabled).prop('disabled', false).off('click').on('click', function () {
+ bt.grid.plugins.pagination.private.changePage($grid, newPage);
+ });
+ }
+ },
+
+ assignButtonHandler: function ($grid, $control, page, newPage, lastPage) {
+ var style = $grid.data().style.pager;
+ if (newPage < 1 || newPage > lastPage) {
+ $control.hide();
+ } else {
+ $control.show().off('click').text(newPage);
+ if (newPage === page) {
+ $control.addClass(style.activeButton);
+ } else {
+ $control.removeClass(style.activeButton).on('click', function () {
+ bt.grid.plugins.pagination.private.changePage($grid, newPage);
+ });
+ }
+ }
+ },
+
+ createChangePageHandler: function ($grid, currentPage) {
+ return function () {
+ var data = $grid.data(),
+ newPage = parseInt(this.value, 10);
+ bt.grid.plugins.pagination.private.changePage($grid, newPage);
+ };
+ },
+
+ changePage: function ($grid, newPage) {
+ var data = $grid.data();
+ if (bt.grid.plugins.pagination.events.pageChanging($grid, newPage) !== false && !isNaN(newPage)) {
+ $grid.find('TFOOT [data-role="page-number"]').val(newPage);
+ data.params[data.paramNames.page] = newPage;
+ }
+ $grid.reload();
+ },
+
+ updatePagerColSpan: function ($grid) {
+ var $cell = $grid.find('tfoot > tr[data-role="pager"] > th');
+ if ($cell && $cell.length) {
+ $cell.attr('colspan', bt.grid.methods.countVisibleColumns($grid));
+ }
+ },
+
+ isLastRecordVisible: function ($grid) {
+ var result = true,
+ data = $grid.data(),
+ limit = parseInt(data.params[data.paramNames.limit], 10),
+ page = parseInt(data.params[data.paramNames.page], 10),
+ count = $grid.count();
+ if (limit && page) {
+ result = ((page - 1) * limit) + count === data.totalRecords;
+ }
+ return result;
+ }
+ },
+
+ public: {
+ getAll: function (includeAllRecords) {
+ var limit, page, start, data = this.data();
+ if ($.isArray(data.dataSource)) {
+ if (includeAllRecords) {
+ return data.dataSource;
+ } else if (data.params[data.paramNames.limit] && data.params[data.paramNames.page]) {
+ limit = parseInt(data.params[data.paramNames.limit], 10);
+ page = parseInt(data.params[data.paramNames.page], 10);
+ start = (page - 1) * limit;
+ return data.records.slice(start, start + limit);
+ } else {
+ return data.records;
+ }
+ } else {
+ return data.records;
+ }
+ }
+ },
+
+ events: {
+ /**
+ * Triggered when the page size is changed.
+ *
+ * @event pageSizeChange
+ * @param {object} e - event data
+ * @param {number} newSize - The new page size
+ * @example sample
+ *
+ *
+ */
+ pageSizeChange: function ($grid, newSize) {
+ $grid.triggerHandler('pageSizeChange', [newSize]);
+ },
+
+ /**
+ * Triggered before the change of the page.
+ *
+ * @event pageChanging
+ * @param {object} e - event data
+ * @param {number} newPage - The new page
+ * @example sample
+ *
+ *
+ */
+ pageChanging: function ($grid, newSize) {
+ $grid.triggerHandler('pageChanging', [newSize]);
+ }
+ },
+
+ configure: function ($grid, fullConfig, clientConfig) {
+ $.extend(true, $grid, bt.grid.plugins.pagination.public);
+ var data = $grid.data();
+ if (clientConfig.pager) {
+ bt.grid.methods.isLastRecordVisible = bt.grid.plugins.pagination.private.isLastRecordVisible;
+
+ $grid.on('initialized', function () {
+ bt.grid.plugins.pagination.private.init($grid);
+ });
+ $grid.on('dataBound', function (e, records, totalRecords) {
+ bt.grid.plugins.pagination.private.reloadPager($grid, totalRecords);
+ });
+ $grid.on('columnShow', function () {
+ bt.grid.plugins.pagination.private.updatePagerColSpan($grid);
+ });
+ $grid.on('columnHide', function () {
+ bt.grid.plugins.pagination.private.updatePagerColSpan($grid);
+ });
+ }
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Responsive Design
+ */
+bt.grid.plugins.responsiveDesign = {
+ config: {
+ base: {
+ /** The interval in milliseconds for checking if the grid is resizing.
+ * This setting is in use only if the resizeMonitoring setting is set to true.
+ * @type number
+ * @default 500
+ * @example sample
+ * Change browser window size in order to fire resize event.
+ *
+ *
+ */
+ resizeCheckInterval: 500,
+
+ /** This setting enables responsive behaviour of the grid where some column are invisible when there is not enough space on the screen for them.
+ * The visibility of the columns in this mode is driven by the column minWidth and priority settings.
+ * The columns without priority setting are always visible and can't hide in small screen resolutions.
+ * @type boolean
+ * @default false
+ * @example sample
+ * Resize browser window in order to see his responsive behaviour.
+ *
+ *
+ */
+ responsive: false,
+
+ /** Automatically adds hidden columns to the details section of the row.
+ * This setting works only if the responsive setting is set to true and the detailTemplate is set.
+ * You need to set priority and minWidth on the colums, that needs to be hidden in smaller screens.
+ * @type boolean
+ * @default false
+ * @example Remote.Data.Source
+ *
+ *
+ * @example Local.Data.Source
+ *
+ *
+ */
+ showHiddenColumnsAsDetails: false,
+
+ defaultColumn: {
+ /** The priority of the column compared to other columns in the grid.
+ * The columns are hiding based on the priorities.
+ * This setting is working only when the responsive setting is set to true.
+ * @alias column.priority
+ * @type number
+ * @default undefined
+ * @example sample
+ *
+ *
+ */
+ priority: undefined,
+
+ /** The minimum width of the column.
+ * The column is getting invisible when there is not enough space in the grid for this minimum width.
+ * This setting is working only when the responsive setting is set to true and the column priority setting is set.
+ * @alias column.minWidth
+ * @type number
+ * @default 250
+ * @example sample
+ *
+ *
+ */
+ minWidth: 250
+ },
+ style: {
+ rowDetailItem: ''
+ }
+ },
+
+ bootstrap: {
+ style: {
+ rowDetailItem: 'col-lg-4'
+ }
+ }
+ },
+
+ 'private': {
+
+ orderColumns: function (config) {
+ var result = [];
+ if (config.columns && config.columns.length) {
+ for (i = 0; i < config.columns.length; i++) {
+ result.push({
+ position: i,
+ field: config.columns[i].field,
+ minWidth: config.columns[i].width || config.columns[i].minWidth || config.defaultColumn.minWidth,
+ priority: config.columns[i].priority || 0
+ });
+ }
+ result.sort(function (a, b) {
+ var result = 0;
+ if (a.priority < b.priority) {
+ result = -1;
+ } else if (a.priority > b.priority) {
+ result = 1;
+ }
+ return result;
+ });
+ }
+ return result;
+ },
+
+ updateDetails: function ($grid) {
+ var rows, data, i, j, $row, details, $placeholder, column, tmp;
+ rows = $grid.find('tbody > tr[data-role="row"]');
+ data = $grid.data();
+ for (i = 0; i < rows.length; i++) {
+ $row = $(rows[i]);
+ details = $row.data('details');
+ for (j = 0; j < data.columns.length; j++) {
+ column = data.columns[j];
+ $placeholder = details && details.find('div[data-id="' + column.field + '"]');
+ if (data.columns[j].hidden) {
+ tmp = '' + (column.title || column.field) + ' : {' + column.field + '}';
+ if (!$placeholder || !$placeholder.length) {
+ $placeholder = $('
').html(tmp);
+ $placeholder.addClass(data.style.rowDetailItem);
+ if (!details || !details.length) {
+ details = $('
');
+ }
+ details.append($placeholder);
+ } else {
+ $placeholder.empty().html(tmp);
+ }
+ } else if ($placeholder && $placeholder.length) {
+ $placeholder.remove();
+ }
+ }
+ $grid.updateDetails($row);
+ }
+ }
+ },
+
+ 'public': {
+
+ oldWidth: undefined,
+
+ resizeCheckIntervalId: undefined,
+
+ /**
+ * Make the grid responsive based on the available space.
+ * Show column if the space for the grid is expanding and hide columns when the space for the grid is decreasing.
+ * @method
+ * @return grid object
+ * @example sample
+ * Make Responsive
+ *
+ *
+ *
+ */
+ makeResponsive: function () {
+ var i, $column,
+ extraWidth = 0,
+ config = this.data(),
+ columns = bt.grid.plugins.responsiveDesign.private.orderColumns(config);
+ //calculate extra width
+ for (i = 0; i < columns.length; i++) {
+ $column = this.find('thead>tr>th:eq(' + columns[i].position + ')');
+ if ($column.is(':visible') && columns[i].minWidth < $column.width()) {
+ extraWidth += $column.width() - columns[i].minWidth;
+ }
+ }
+ //show columns
+ if (extraWidth) {
+ for (i = 0; i < columns.length; i++) {
+ $column = this.find('thead>tr>th:eq(' + columns[i].position + ')');
+ if (!$column.is(':visible') && columns[i].minWidth <= extraWidth) {
+ this.showColumn(columns[i].field);
+ extraWidth -= $column.width();
+ }
+ }
+ }
+ //hide columns
+ for (i = (columns.length - 1); i >= 0; i--) {
+ $column = this.find('thead>tr>th:eq(' + columns[i].position + ')');
+ if ($column.is(':visible') && columns[i].priority && columns[i].minWidth > $column.outerWidth()) {
+ this.hideColumn(columns[i].field);
+ }
+ }
+
+ return this;
+ },
+ },
+
+ 'events': {
+ /**
+ * Event fires when the grid width is changed. The "responsive" configuration setting should be set to true in order this event to fire.
+ *
+ * @event resize
+ * @param {object} e - event data
+ * @param {number} newWidth - The new width
+ * @param {number} oldWidth - The old width
+ * @example sample
+ *
+ *
+ */
+ resize: function ($grid, newWidth, oldWidth) {
+ $grid.triggerHandler('resize', [newWidth, oldWidth]);
+ }
+ },
+
+ 'configure': function ($grid, fullConfig, clientConfig) {
+ $.extend(true, $grid, bt.grid.plugins.responsiveDesign.public);
+ if (fullConfig.responsive) {
+ $grid.on('initialized', function () {
+ $grid.makeResponsive();
+ $grid.oldWidth = $grid.width();
+ $grid.resizeCheckIntervalId = setInterval(function () {
+ var newWidth = $grid.width();
+ if (newWidth !== $grid.oldWidth) {
+ bt.grid.plugins.responsiveDesign.events.resize($grid, newWidth, $grid.oldWidth);
+ }
+ $grid.oldWidth = newWidth;
+ }, fullConfig.resizeCheckInterval);
+ });
+ $grid.on('destroy', function () {
+ if ($grid.resizeCheckIntervalId) {
+ clearInterval($grid.resizeCheckIntervalId);
+ }
+ });
+ $grid.on('resize', function () {
+ $grid.makeResponsive();
+ });
+ }
+ if (fullConfig.showHiddenColumnsAsDetails && bt.grid.plugins.expandCollapseRows) {
+ $grid.on('dataBound', function () {
+ bt.grid.plugins.responsiveDesign.private.updateDetails($grid);
+ });
+ $grid.on('columnHide', function () {
+ bt.grid.plugins.responsiveDesign.private.updateDetails($grid);
+ });
+ $grid.on('columnShow', function () {
+ bt.grid.plugins.responsiveDesign.private.updateDetails($grid);
+ });
+ $grid.on('rowDataBound', function () {
+ bt.grid.plugins.responsiveDesign.private.updateDetails($grid);
+ });
+ }
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Toolbar
+ */
+bt.grid.plugins.toolbar = {
+ config: {
+ base: {
+ /** Template for the content in the toolbar. Appears in a separate row on top of the grid.
+ * @type string
+ * @default undefined
+ * @example sample
+ *
+ *
+ */
+ toolbarTemplate: undefined,
+
+ /** The title of the grid. Appears in a separate row on top of the grid.
+ * @type string
+ * @default undefined
+ * @example Material.Design
+ *
+ *
+ * @example Bootstrap.3
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ title: undefined,
+
+ style: {
+ toolbar: 'bt-grid-md-toolbar'
+ }
+ },
+
+ bootstrap: {
+ style: {
+ toolbar: 'bt-grid-bootstrap-toolbar'
+ }
+ },
+
+ bootstrap4: {
+ style: {
+ toolbar: 'bt-grid-bootstrap-4-toolbar'
+ }
+ }
+ },
+
+ private: {
+ init: function ($grid) {
+ var data, $toolbar, $title;
+ data = $grid.data();
+ $toolbar = $grid.prev('div[data-role="toolbar"]');
+ if (typeof (data.toolbarTemplate) !== 'undefined' || typeof (data.title) !== 'undefined' || $toolbar.length > 0) {
+ if ($toolbar.length === 0) {
+ $toolbar = $('
');
+ $grid.before($toolbar);
+ }
+ $toolbar.addClass(data.style.toolbar);
+
+ if ($toolbar.children().length === 0 && data.toolbarTemplate) {
+ $toolbar.append(data.toolbarTemplate);
+ }
+
+ $title = $toolbar.find('[data-role="title"]');
+ if ($title.length === 0) {
+ $title = $('
');
+ $toolbar.prepend($title);
+ }
+ if (data.title) {
+ $title.text(data.title);
+ }
+
+ if (data.minWidth) {
+ $toolbar.css('min-width', data.minWidth);
+ }
+ }
+ }
+ },
+
+ public: {
+ /**
+ * Get or set grid title.
+ * @additionalinfo When you pass value in the text parameter this value with be in use for the new title of the grid and the method will return grid object.
+ * When you don't pass value in the text parameter, then the method will return the text of the current grid title.
+ * You can use this method in a combination with toolbarTemplate only if the title is wrapped in element with data-role attribute that equals to "title".
+ * @method
+ * @param {object} text - The text of the new grid title.
+ * @return string or grid object
+ * @example text
+ * Set New Title
+ * Get Title
+ *
+ *
+ *
+ * @example html.template
+ * Set New Title
+ * Get Title
+ *
+ *
+ *
+ */
+ title: function (text) {
+ var $titleEl = this.parent().find('div[data-role="toolbar"] [data-role="title"]');
+ if (typeof (text) !== 'undefined') {
+ $titleEl.text(text);
+ return this;
+ } else {
+ return $titleEl.text();
+ }
+ }
+ },
+
+ configure: function ($grid) {
+ $.extend(true, $grid, bt.grid.plugins.toolbar.public);
+ $grid.on('initialized', function () {
+ bt.grid.plugins.toolbar.private.init($grid);
+ });
+ $grid.on('destroying', function () {
+ $grid.prev('[data-role="toolbar"]').remove();
+ });
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Resizable Columns
+ */
+bt.grid.plugins.resizableColumns = {
+ config: {
+ base: {
+ /** If set to true, users can resize columns by dragging the edges (resize handles) of their header cells.
+ * @type boolean
+ * @default false
+ * @example Material.Design
+ *
+ *
+ * @example Bootstrap
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ * @example Bootstrap.4.FixedHeader
+ *
+ *
+ */
+ resizableColumns: false
+ }
+ },
+
+ private: {
+ init: function ($grid, config) {
+ var $columns, $column, i, $wrapper, $resizer, marginRight;
+ $columns = $grid.find('thead tr[data-role="caption"] th');
+ if ($columns.length) {
+ for (i = 0; i < $columns.length - 1; i++) {
+ $column = $($columns[i]);
+ $wrapper = $('
');
+ marginRight = parseInt($column.css('padding-right'), 10) + 3;
+ $resizer = $(' ').css('margin-right', '-' + marginRight + 'px');
+ $resizer.draggable({
+ start: function () {
+ $grid.addClass('bt-unselectable');
+ $grid.addClass('bt-grid-resize-cursor');
+ },
+ stop: function () {
+ $grid.removeClass('bt-unselectable');
+ $grid.removeClass('bt-grid-resize-cursor');
+ this.style.removeProperty('top');
+ this.style.removeProperty('left');
+ this.style.removeProperty('position');
+ },
+ drag: bt.grid.plugins.resizableColumns.private.createResizeHandle($grid, $column, config.columns[i])
+ });
+ $column.append($wrapper.append($resizer));
+ }
+ for (i = 0; i < $columns.length; i++) {
+ $column = $($columns[i]);
+ if (!$column.attr('width')) {
+ $column.attr('width', $column.outerWidth());
+ }
+ }
+ }
+ },
+
+ createResizeHandle: function ($grid, $column, column) {
+ var data = $grid.data();
+ return function (e, newPosition) {
+ var i, index, rows, cell, newWidth, nextWidth,
+ currentWidth = parseInt($column.attr('width'), 10),
+ position = bt.core.position(this),
+ offset = { top: newPosition.top - position.top, left: newPosition.left - position.left };
+ if (!currentWidth) {
+ currentWidth = $column.outerWidth();
+ }
+ if (offset.left) {
+ newWidth = currentWidth + offset.left;
+ column.width = newWidth;
+ $column.attr('width', newWidth);
+ index = $column[0].cellIndex;
+ cell = $column[0].parentElement.children[index + 1];
+ nextWidth = parseInt($(cell).attr('width'), 10) - offset.left;
+ cell.setAttribute('width', nextWidth);
+ if (data.resizableColumns) {
+ rows = $grid[0].tBodies[0].children;
+ for (i = 0; i < rows.length; i++) {
+ rows[i].cells[index].setAttribute('width', newWidth);
+ cell = rows[i].cells[index + 1];
+ cell.setAttribute('width', nextWidth);
+ }
+ }
+ }
+ };
+ }
+ },
+
+ public: {
+ },
+
+ configure: function ($grid, fullConfig, clientConfig) {
+ $.extend(true, $grid, bt.grid.plugins.resizableColumns.public);
+ if (fullConfig.resizableColumns && bt.draggable) {
+ $grid.on('initialized', function () {
+ bt.grid.plugins.resizableColumns.private.init($grid, fullConfig);
+ });
+ }
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Row Reorder
+ */
+bt.grid.plugins.rowReorder = {
+ config: {
+ base: {
+ /** If set to true, enable row reordering with drag and drop.
+ * @type boolean
+ * @default false
+ * @example Material.Design
+ * Drag and Drop rows in order to reorder them.
+ *
+ *
+ * @example Bootstrap.3
+ * Drag and Drop rows in order to reorder them.
+ *
+ *
+ * @example Bootstrap.4
+ * Drag and Drop rows in order to reorder them.
+ *
+ *
+ */
+ rowReorder: false,
+
+ /** If set, enable row reordering only when you try to drag cell from the configured column.
+ * Accept only field names of columns.
+ * @type string
+ * @default undefined
+ * @example sample
+ *
+ *
+ */
+ rowReorderColumn: undefined,
+
+ /** If set, update the value in the field for all records. Accept only field names of columns.
+ * @type string
+ * @default undefined
+ * @example Visible.OrderNumber
+ *
+ *
+ * @example Hidden.OrderNumber
+ * Show Data
+ *
+ *
+ */
+ orderNumberField: undefined,
+
+ style: {
+ targetRowIndicatorTop: 'bt-grid-row-reorder-indicator-top',
+ targetRowIndicatorBottom: 'bt-grid-row-reorder-indicator-bottom'
+ }
+ }
+ },
+
+ private: {
+ init: function ($grid) {
+ var i, columnPosition, $row,
+ $rows = $grid.find('tbody tr[data-role="row"]');
+ if ($grid.data('rowReorderColumn')) {
+ columnPosition = bt.grid.methods.getColumnPosition($grid.data('columns'), $grid.data('rowReorderColumn'));
+ }
+ for (i = 0; i < $rows.length; i++) {
+ $row = $($rows[i]);
+ if (typeof (columnPosition) !== 'undefined') {
+ $row.find('td:eq(' + columnPosition + ')').on('mousedown', bt.grid.plugins.rowReorder.private.createRowMouseDownHandler($grid, $row));
+ } else {
+ $row.on('mousedown', bt.grid.plugins.rowReorder.private.createRowMouseDownHandler($grid, $row));
+ }
+ }
+ },
+
+ createRowMouseDownHandler: function ($grid, $trSource) {
+ return function (e) {
+ var $dragEl = $grid.clone(),
+ columns = $grid.data('columns'),
+ i, $cells;
+ $grid.addClass('bt-unselectable');
+ $('body').append($dragEl);
+ $dragEl.attr('data-role', 'draggable-clone').css('cursor', 'move');
+ $dragEl.children('thead').remove().children('tfoot').remove();
+ $dragEl.find('tbody tr:not([data-position="' + $trSource.data('position') + '"])').remove();
+ $cells = $dragEl.find('tbody tr td');
+ for (i = 0; i < $cells.length; i++) {
+ if (columns[i].width) {
+ $cells[i].setAttribute('width', columns[i].width);
+ }
+ }
+ $dragEl.draggable({
+ stop: bt.grid.plugins.rowReorder.private.createDragStopHandler($grid, $trSource)
+ });
+ $dragEl.css({
+ position: 'absolute', top: $trSource.offset().top, left: $trSource.offset().left, width: $trSource.width(), zIndex: 1
+ });
+ if ($trSource.attr('data-droppable') === 'true') {
+ $trSource.droppable('destroy');
+ }
+ $trSource.siblings('tr[data-role="row"]').each(function () {
+ var $dropEl = $(this);
+ if ($dropEl.attr('data-droppable') === 'true') {
+ $dropEl.droppable('destroy');
+ }
+ $dropEl.droppable({
+ over: bt.grid.plugins.rowReorder.private.createDroppableOverHandler($trSource),
+ out: bt.grid.plugins.rowReorder.private.droppableOut
+ });
+ });
+ $dragEl.trigger('mousedown');
+ };
+ },
+
+ createDragStopHandler: function ($grid, $trSource) {
+ return function (e, mousePosition) {
+ $('table[data-role="draggable-clone"]').draggable('destroy').remove();
+ $grid.removeClass('bt-unselectable');
+ $trSource.siblings('tr[data-role="row"]').each(function () {
+ var $trTarget = $(this),
+ targetPosition = $trTarget.data('position'),
+ sourcePosition = $trSource.data('position'),
+ data = $grid.data(),
+ $rows, $row, i, record, id;
+
+ if ($trTarget.droppable('isOver', mousePosition)) {
+ if (targetPosition < sourcePosition) {
+ $trTarget.before($trSource);
+ } else {
+ $trTarget.after($trSource);
+ }
+ data.records.splice(targetPosition - 1, 0, data.records.splice(sourcePosition - 1, 1)[0]);
+ $rows = $trTarget.parent().find('tr[data-role="row"]');
+ for (i = 0; i < $rows.length; i++) {
+ $($rows[i]).attr('data-position', i + 1);
+ }
+ if (data.orderNumberField) {
+ for (i = 0; i < data.records.length; i++) {
+ data.records[i][data.orderNumberField] = i + 1;
+ }
+ for (i = 0; i < $rows.length; i++) {
+ $row = $($rows[i]);
+ id = bt.grid.methods.getId($row, data.primaryKey, $row.attr('data-position'));
+ record = bt.grid.methods.getByPosition($grid, $row.attr('data-position'));
+ $grid.setCellContent(id, data.orderNumberField, record[data.orderNumberField]);
+ }
+ }
+ }
+ $trTarget.removeClass('bt-grid-top-border');
+ $trTarget.removeClass('bt-grid-bottom-border');
+ $trTarget.droppable('destroy');
+ });
+ }
+ },
+
+ createDroppableOverHandler: function ($trSource) {
+ return function (e) {
+ var $trTarget = $(this),
+ targetPosition = $trTarget.data('position'),
+ sourcePosition = $trSource.data('position');
+ if (targetPosition < sourcePosition) {
+ $trTarget.addClass('bt-grid-top-border');
+ } else {
+ $trTarget.addClass('bt-grid-bottom-border');
+ }
+ };
+ },
+
+ droppableOut: function () {
+ $(this).removeClass('bt-grid-top-border');
+ $(this).removeClass('bt-grid-bottom-border');
+ }
+ },
+
+ public: {
+ },
+
+ configure: function ($grid, fullConfig, clientConfig) {
+ $.extend(true, $grid, bt.grid.plugins.rowReorder.public);
+ if (fullConfig.rowReorder && bt.draggable && bt.droppable) {
+ $grid.on('dataBound', function () {
+ bt.grid.plugins.rowReorder.private.init($grid);
+ });
+ }
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Export
+ */
+bt.grid.plugins.export = {
+ config: { base: {} },
+
+ public: {
+ /**
+ * Get grid data in Comma Separated Values (CSV) format.
+ * @method
+ * @param {boolean} includeAllRecords - include records that are not visible when you are using local dataSource.
+ * @return string
+ * @example Local.Data
+ * Get All
+ *
+ *
+ *
+ * @example Remote.Data
+ * Get CSV
+ *
+ *
+ *
+ */
+ getCSV: function (includeAllRecords) {
+ var i, j, line = '', str = '',
+ columns = this.data().columns,
+ records = this.getAll(includeAllRecords);
+
+ if (records.length) {
+
+ for (i = 0; i < columns.length; i++) {
+ if (columns[i].hidden !== true) {
+ line += '"' + (columns[i].title || columns[i].field) + '",';
+ }
+ }
+ str += line.slice(0, line.length - 1) + '\r\n';
+
+ for (i = 0; i < records.length; i++) {
+ line = '';
+
+ for (j = 0; j < columns.length; j++) {
+ if (columns[j].hidden !== true) {
+ line += '"' + records[i][columns[j].field] + '",';
+ }
+ }
+ str += line.slice(0, line.length - 1) + '\r\n';
+ }
+ }
+
+ return str;
+ },
+
+ /**
+ * Download grid data in Comma Separated Values (CSV) format.
+ * @method
+ * @param {string} filename - name of the generated file.
+ * @param {boolean} includeAllRecords - include records that are not visible when you are using local dataSource.
+ * @return grid object
+ * @example Local.Data
+ * Download Only First Page
+ * Download All Data
+ *
+ *
+ *
+ * @example Remote.Data
+ * Download CSV
+ *
+ *
+ *
+ */
+ downloadCSV: function (filename, includeAllRecords) {
+ var link = document.createElement('a');
+ document.body.appendChild(link);
+ link.download = filename || 'griddata.csv';
+ link.href = 'data:text/csv;charset=utf-8,' + escape(this.getCSV(includeAllRecords));
+ link.click();
+ document.body.removeChild(link);
+ return this;
+ }
+ },
+
+ configure: function ($grid) {
+ $.extend(true, $grid, bt.grid.plugins.export.public);
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Column Reorder
+ */
+bt.grid.plugins.columnReorder = {
+ config: {
+ base: {
+ /** If set to true, enable column reordering with drag and drop.
+ * @type boolean
+ * @default false
+ * @example Material.Design
+ * Drag and Drop column headers in order to reorder the columns.
+ *
+ *
+ * @example Bootstrap
+ * Drag and Drop column headers in order to reorder the columns.
+ *
+ *
+ * @example Bootstrap.4
+ * Drag and Drop column headers in order to reorder the columns.
+ *
+ *
+ */
+ columnReorder: false,
+
+ dragReady: false,
+
+ style: {
+ targetRowIndicatorTop: 'bt-grid-row-reorder-indicator-top',
+ targetRowIndicatorBottom: 'bt-grid-row-reorder-indicator-bottom'
+ }
+ }
+ },
+
+ private: {
+ init: function ($grid) {
+ var i, $cell,
+ $cells = $grid.find('thead tr th');
+ for (i = 0; i < $cells.length; i++) {
+ $cell = $($cells[i]);
+ $cell.on('mousedown', bt.grid.plugins.columnReorder.private.createMouseDownHandler($grid, $cell));
+ $cell.on('mousemove', bt.grid.plugins.columnReorder.private.createMouseMoveHandler($grid, $cell));
+ $cell.on('mouseup', bt.grid.plugins.columnReorder.private.createMouseUpHandler($grid, $cell));
+ }
+ },
+
+ createMouseDownHandler: function ($grid) {
+ return function (e) {
+ $grid.timeout = setTimeout(function () {
+ $grid.data('dragReady', true);
+ }, 100);
+ }
+ },
+
+ createMouseUpHandler: function ($grid) {
+ return function (e) {
+ clearTimeout($grid.timeout);
+ $grid.data('dragReady', false);
+ }
+ },
+
+ createMouseMoveHandler: function ($grid, $thSource) {
+ return function (e) {
+ var $dragEl, srcIndex;
+ if ($grid.data('dragReady')) {
+ $grid.data('dragReady', false);
+ $dragEl = $grid.clone();
+ srcIndex = $thSource.index();
+ $grid.addClass('bt-unselectable');
+ $('body').append($dragEl);
+ $dragEl.attr('data-role', 'draggable-clone').css('cursor', 'move');
+ $dragEl.find('thead tr th:eq(' + srcIndex + ')').siblings().remove();
+ $dragEl.find('tbody tr[data-role != "row"]').remove();
+ $dragEl.find('tbody tr td:nth-child(' + (srcIndex + 1) + ')').siblings().remove();
+ $dragEl.find('tfoot').remove();
+ $dragEl.draggable({
+ stop: bt.grid.plugins.columnReorder.private.createDragStopHandler($grid, $thSource)
+ });
+ $dragEl.css({
+ position: 'absolute', top: $thSource.offset().top, left: $thSource.offset().left, width: $thSource.width(), zIndex: 1
+ });
+ if ($thSource.attr('data-droppable') === 'true') {
+ $thSource.droppable('destroy');
+ }
+ $thSource.siblings('th').each(function () {
+ var $dropEl = $(this);
+ if ($dropEl.attr('data-droppable') === 'true') {
+ $dropEl.droppable('destroy');
+ }
+ $dropEl.droppable({
+ over: bt.grid.plugins.columnReorder.private.createDroppableOverHandler($grid, $thSource),
+ out: bt.grid.plugins.columnReorder.private.droppableOut
+ });
+ });
+ $dragEl.trigger('mousedown');
+ }
+ };
+ },
+
+ createDragStopHandler: function ($grid, $thSource) {
+ return function (e, mousePosition) {
+ $('table[data-role="draggable-clone"]').draggable('destroy').remove();
+ $grid.removeClass('bt-unselectable');
+ $thSource.siblings('th').each(function () {
+ var $thTarget = $(this),
+ data = $grid.data(),
+ targetPosition = bt.grid.methods.getColumnPosition(data.columns, $thTarget.data('field')),
+ sourcePosition = bt.grid.methods.getColumnPosition(data.columns, $thSource.data('field'));
+
+ $thTarget.removeClass('bt-grid-left-border').removeClass('bt-grid-right-border');
+ $thTarget.closest('table').find('tbody tr[data-role="row"] td:nth-child(' + ($thTarget.index() + 1) + ')').removeClass('bt-grid-left-border').removeClass('bt-grid-right-border');
+ if ($thTarget.droppable('isOver', mousePosition)) {
+ if (targetPosition < sourcePosition) {
+ $thTarget.before($thSource);
+ } else {
+ $thTarget.after($thSource);
+ }
+ bt.grid.plugins.columnReorder.private.moveRowCells($grid, sourcePosition, targetPosition);
+ data.columns.splice(targetPosition, 0, data.columns.splice(sourcePosition, 1)[0]);
+ }
+ $thTarget.droppable('destroy');
+ });
+ }
+ },
+
+ moveRowCells: function ($grid, sourcePosition, targetPosition) {
+ var i, $row, $rows = $grid.find('tbody tr[data-role="row"]');
+ for (i = 0; i < $rows.length; i++) {
+ $row = $($rows[i]);
+ if (targetPosition < sourcePosition) {
+ $row.find('td:eq(' + targetPosition + ')').before($row.find('td:eq(' + sourcePosition + ')'));
+ } else {
+ $row.find('td:eq(' + targetPosition + ')').after($row.find('td:eq(' + sourcePosition + ')'));
+ }
+ }
+ },
+
+ createDroppableOverHandler: function ($grid, $thSource) {
+ return function (e) {
+ var $thTarget = $(this),
+ data = $grid.data(),
+ targetPosition = bt.grid.methods.getColumnPosition(data.columns, $thTarget.data('field')),
+ sourcePosition = bt.grid.methods.getColumnPosition(data.columns, $thSource.data('field'));
+ if (targetPosition < sourcePosition) {
+ $thTarget.addClass('bt-grid-left-border');
+ $grid.find('tbody tr[data-role="row"] td:nth-child(' + ($thTarget.index() + 1) + ')').addClass('bt-grid-left-border');
+ } else {
+ $thTarget.addClass('bt-grid-right-border');
+ $grid.find('tbody tr[data-role="row"] td:nth-child(' + ($thTarget.index() + 1) + ')').addClass('bt-grid-right-border');
+ }
+ };
+ },
+
+ droppableOut: function () {
+ var $thTarget = $(this);
+ $thTarget.removeClass('bt-grid-left-border').removeClass('bt-grid-right-border');
+ $thTarget.closest('table').find('tbody tr[data-role="row"] td:nth-child(' + ($thTarget.index() + 1) + ')').removeClass('bt-grid-left-border').removeClass('bt-grid-right-border');
+ }
+ },
+
+ public: {
+ },
+
+ configure: function ($grid, fullConfig, clientConfig) {
+ $.extend(true, $grid, bt.grid.plugins.columnReorder.public);
+ if (fullConfig.columnReorder) {
+ $grid.on('initialized', function () {
+ bt.grid.plugins.columnReorder.private.init($grid);
+ });
+ }
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Header Filter
+ */
+bt.grid.plugins.headerFilter = {
+ config: {
+ base: {
+ defaultColumnSettings: {
+ /** Indicates if the column is sortable. If set to false the header filter is hidden.
+ * @alias column.filterable
+ * @type boolean
+ * @default true
+ * @example Material.Design
+ *
+ *
+ * @example Bootstrap.3
+ *
+ *
+ */
+ filterable: true
+ },
+
+ /** If set to true, add filters for each column
+ * @type boolean
+ * @default object
+ * @example Remote.DataSource
+ *
+ *
+ * @example Local.DataSource
+ *
+ *
+ */
+ headerFilter: {
+ /** Type of the header filter
+ * @alias headerFilter.type
+ * @type (onenterkeypress|onchange)
+ * @default 'onenterkeypress'
+ * @example OnEnterKeyPress
+ *
+ *
+ * @example OnChange
+ *
+ *
+ */
+ type: 'onenterkeypress'
+ }
+ }
+ },
+
+ private: {
+ init: function ($grid) {
+ var i, $th, $ctrl, data = $grid.data(),
+ $filterTr = $(' ');
+
+ for (i = 0; i < data.columns.length; i++) {
+ $th = $(' ');
+ if (data.columns[i].filterable) {
+ $ctrl = $(' ');
+ if ('onchange' === data.headerFilter.type) {
+ $ctrl.on('input propertychange', function (e) {
+ bt.grid.plugins.headerFilter.private.reload($grid, $(this));
+ });
+ } else {
+ $ctrl.on('keypress', function (e) {
+ if (e.which == 13) {
+ bt.grid.plugins.headerFilter.private.reload($grid, $(this));
+ }
+ });
+ $ctrl.on('blur', function (e) {
+ bt.grid.plugins.headerFilter.private.reload($grid, $(this));
+ });
+ }
+ $th.append($ctrl);
+ }
+ if (data.columns[i].hidden) {
+ $th.hide();
+ }
+ $filterTr.append($th);
+ }
+
+ $grid.children('thead').append($filterTr);
+ },
+
+ reload: function ($grid, $ctrl) {
+ var params = {};
+ params[$ctrl.data('field')] = $ctrl.val();
+ $grid.reload(params);
+ }
+ },
+
+ public: {
+ },
+
+ events: {
+ },
+
+ configure: function ($grid, fullConfig, clientConfig) {
+ $.extend(true, $grid, bt.grid.plugins.headerFilter.public);
+ var data = $grid.data();
+ if (clientConfig.headerFilter) {
+ $grid.on('initialized', function () {
+ bt.grid.plugins.headerFilter.private.init($grid);
+ });
+ }
+ }
+};
+
+/**
+ * @widget Grid
+ * @plugin Grouping
+ */
+bt.grid.plugins.grouping = {
+ config: {
+ base: {
+ paramNames: {
+ /** The name of the parameter that is going to send the name of the column for grouping.
+ * The grouping should be enabled in order this parameter to be in use.
+ * @alias paramNames.groupBy
+ * @type string
+ * @default "groupBy"
+ */
+ groupBy: 'groupBy',
+
+ /** The name of the parameter that is going to send the direction for grouping.
+ * The grouping should be enabled in order this parameter to be in use.
+ * @alias paramNames.groupByDirection
+ * @type string
+ * @default "groupByDirection"
+ */
+ groupByDirection: 'groupByDirection'
+ },
+
+ grouping: {
+ /** The name of the field that needs to be in use for grouping.
+ * @type string
+ * @alias grouping.groupBy
+ * @default undefined
+ * @example Local.Data
+ *
+ *
+ * @example Remote.Data
+ *
+ *
+ * @example Bootstrap.3
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ groupBy: undefined,
+
+ direction: 'asc'
+ },
+
+ icons: {
+ /** Expand row icon definition.
+ * @alias icons.expandGroup
+ * @type String
+ * @default ' '
+ * @example Right.Down.Icons
+ *
+ *
+ */
+ expandGroup: ' ',
+
+ /** Collapse row icon definition.
+ * @alias icons.collapseGroup
+ * @type String
+ * @default ' '
+ * @example Right.Down.Icons
+ *
+ *
+ */
+ collapseGroup: ' '
+ }
+ },
+
+ fontawesome: {
+ icons: {
+ expandGroup: ' ',
+ collapseGroup: ' '
+ }
+ },
+
+ glyphicons: {
+ icons: {
+ expandGroup: ' ',
+ collapseGroup: ' '
+ }
+ }
+ },
+
+ private: {
+ init: function ($grid) {
+ var previousValue, data = $grid.data();
+
+ previousValue = undefined;
+ $grid.on('rowDataBound', function (e, $row, id, record) {
+ if (previousValue !== record[data.grouping.groupBy] || $row[0].rowIndex === 1) {
+ var colspan = bt.grid.methods.countVisibleColumns($grid) - 1,
+ $groupRow = $(' '),
+ $expandCollapseCell = $(' ');
+
+ $expandCollapseCell.append('' + data.icons.collapseGroup + '
');
+ $expandCollapseCell.on('click', bt.grid.plugins.grouping.private.createExpandCollapseHandler(data));
+ $groupRow.append($expandCollapseCell);
+ $groupRow.append('' + data.grouping.groupBy + ': ' + record[data.grouping.groupBy] + '
');
+ $groupRow.insertBefore($row);
+ previousValue = record[data.grouping.groupBy];
+ }
+ $row.show();
+ });
+
+ data.params[data.paramNames.groupBy] = data.grouping.groupBy;
+ data.params[data.paramNames.groupByDirection] = data.grouping.direction;
+ },
+
+ grouping: function ($grid, records) {
+ var data = $grid.data();
+ records.sort(bt.grid.methods.createDefaultSorter(data.grouping.direction, data.grouping.groupBy));
+ },
+
+ createExpandCollapseHandler: function (data) {
+ return function (e) {
+ var $cell = $(this),
+ methods = bt.grid.plugins.grouping.private;
+ if ($cell.closest('tr').next(':visible').data('role') === 'row') {
+ methods.collapseGroup(data, $cell);
+ } else {
+ methods.expandGroup(data, $cell);
+ }
+ };
+ },
+
+ collapseGroup: function (data, $cell) {
+ var $display = $cell.children('div[data-role="display"]'),
+ $groupRow = $cell.closest('tr');
+
+ $groupRow.nextUntil('[role="group"]').hide();
+ $display.empty().append(data.icons.expandGroup);
+ },
+
+ expandGroup: function (data, $cell) {
+ var $display = $cell.children('div[data-role="display"]'),
+ $groupRow = $cell.closest('tr');
+
+ $groupRow.nextUntil('[role="group"]').show();
+ $display.empty().append(data.icons.collapseGroup);
+ }
+ },
+
+ public: { },
+
+ configure: function ($grid) {
+ var column, data = $grid.data();
+ $.extend(true, $grid, bt.grid.plugins.grouping.public);
+ if (data.grouping && data.grouping.groupBy) {
+ column = {
+ title: '',
+ width: data.defaultIconColumnWidth,
+ align: 'center',
+ stopPropagation: true,
+ cssClass: 'bt-cursor-pointer bt-unselectable'
+ };
+ data.columns = [column].concat(data.columns);
+
+ $grid.on('initialized', function () {
+ bt.grid.plugins.grouping.private.init($grid);
+ });
+
+ $grid.on('dataFiltered', function (e, records) {
+ bt.grid.plugins.grouping.private.grouping($grid, records);
+ });
+ }
+ }
+};
+
+bt.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',
+ RowsPerPage: 'Rows per page:',
+ Edit: 'Edit',
+ Delete: 'Delete',
+ Update: 'Update',
+ Cancel: 'Cancel',
+ NoRecordsFound: 'No records found.',
+ Loading: 'Loading...'
+};
+/* global window alert jQuery bt */
+/**
+ * @widget Tree
+ * @plugin Base
+ */
+bt.tree = {
+ plugins: {}
+};
+
+bt.tree.config = {
+ base: {
+
+ params: {},
+
+ /** When this setting is enabled the content of the tree will be loaded automatically after the creation of the tree.
+ * @type boolean
+ * @default true
+ * @example disabled
+ *
+ *
+ * @example enabled
+ *
+ *
+ */
+ autoLoad: true,
+
+ /** The type of the node selection.
+ * If the type is set to multiple the user will be able to select more then one node in the tree.
+ * @type (single|multiple)
+ * @default single
+ * @example Single.Selection
+ *
+ *
+ * @example Multiple.Selection
+ *
+ *
+ */
+ selectionType: 'single',
+
+ /** This setting enable cascade selection and unselection of children
+ * @type boolean
+ * @default false
+ * @example Sample
+ *
+ *
+ */
+ cascadeSelection: false,
+
+ /** The data source of tree.
+ * @additionalinfo If set to string, then the tree is going to use this string as a url for ajax requests to the server.
+ * If set to object, then the tree is going to use this object as settings for the jquery ajax function.
+ * If set to array, then the tree is going to use the array as data for tree nodes.
+ * @type (string|object|array)
+ * @default undefined
+ * @example Local.DataSource
+ *
+ *
+ * @example Remote.DataSource
+ *
+ *
+ */
+ dataSource: undefined,
+
+ /** Primary key field name.
+ * @type string
+ * @default undefined
+ * @example defined
+ * Select a node to see the key.
+ *
+ *
+ * @example undefined
+ * Select a node to see the key.
+ *
+ *
+ */
+ primaryKey: undefined,
+
+ /** Text field name.
+ * @type string
+ * @default 'text'
+ * @example sample
+ *
+ *
+ */
+ textField: 'text',
+
+ /** Children field name.
+ * @type string
+ * @default 'children'
+ * @example Custom.FieldName
+ *
+ *
+ */
+ childrenField: 'children',
+
+ /** The name of the field that indicates if the node has children. Shows expand icon if the node has children.
+ * @type string
+ * @default 'hasChildren'
+ * @example Custom.FieldName
+ *
+ *
+ */
+ hasChildrenField: 'hasChildren',
+
+ /** Image css class field name.
+ * @type string
+ * @default 'imageCssClass'
+ * @example Default.Name
+ *
+ *
+ * @example Custom.Name
+ *
+ *
+ *
+ */
+ imageCssClassField: 'imageCssClass',
+
+ /** Image url field name.
+ * @type string
+ * @default 'imageUrl'
+ * @example Default.HTML.Field.Name
+ *
+ *
+ * @example Custom.HTML.Field.Name
+ *
+ *
+ */
+ imageUrlField: 'imageUrl',
+
+ /** Image html field name.
+ * @type string
+ * @default 'imageHtml'
+ * @example Default.HTML.Field.Name
+ *
+ *
+ * @example Custom.HTML.Field.Name
+ *
+ *
+ */
+ imageHtmlField: 'imageHtml',
+
+ /** Disabled field name. Assume that the item is not disabled if not set.
+ * @type string
+ * @default 'disabled'
+ * @example Default.Value
+ *
+ *
+ * @example Custom.Value
+ *
+ *
+ * @example Bootstrap
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ disabledField: 'disabled',
+
+ /** Width of the tree.
+ * @type number
+ * @default undefined
+ * @example JS.Config
+ *
+ *
+ * @example HTML.Config
+ *
+ *
+ */
+ width: undefined,
+
+ /** When this setting is enabled the content of the tree will be wrapped by borders.
+ * @type boolean
+ * @default false
+ * @example Material.Design.True
+ *
+ *
+ * @example Material.Design.False
+ *
+ *
+ * @example Bootstrap.3.True
+ *
+ *
+ * @example Bootstrap.3.False
+ *
+ *
+ * @example Bootstrap.4.True
+ *
+ *
+ * @example Bootstrap.4.False
+ *
+ *
+ */
+ border: false,
+
+ /** The name of the UI library that is going to be in use.
+ * @additionalinfo The css file for bootstrap should be manually included if you use bootstrap.
+ * @type (materialdesign|bootstrap|bootstrap4)
+ * @default materialdesign
+ * @example MaterialDesign
+ *
+ *
+ * @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, 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 'materialicons'
+ * @example Base.Theme.Material.Icons
+ *
+ *
+ * @example Bootstrap.4.Font.Awesome
+ *
+ *
+ */
+ iconsLibrary: 'materialicons',
+
+ autoGenId: 1,
+
+ indentation: 24,
+
+ style: {
+ wrapper: 'bt-unselectable',
+ list: 'bt-list bt-list-md',
+ item: undefined,
+ active: 'bt-list-md-active',
+ leafIcon: undefined,
+ border: 'bt-tree-md-border'
+ },
+
+ icons: {
+ /** Expand icon definition.
+ * @alias icons.expand
+ * @type String
+ * @default ' '
+ * @example Plus.Minus.Icons
+ *
+ *
+ */
+ expand: ' ',
+
+ /** Collapse icon definition.
+ * @alias icons.collapse
+ * @type String
+ * @default ' '
+ * @example Plus.Minus.Icons
+ *
+ *
+ */
+ collapse: ' '
+ }
+ },
+
+ bootstrap: {
+ style: {
+ wrapper: 'bt-unselectable bt-tree-bootstrap-3',
+ list: 'bt-list bt-list-bootstrap list-group',
+ item: 'list-group-item',
+ active: 'active',
+ border: 'bt-tree-bootstrap-border'
+ },
+ iconsLibrary: 'glyphicons'
+ },
+
+ bootstrap4: {
+ style: {
+ wrapper: 'bt-unselectable bt-tree-bootstrap-4',
+ list: 'bt-list bt-list-bootstrap',
+ item: 'list-group-item',
+ active: 'active',
+ border: 'bt-tree-bootstrap-border'
+ },
+ icons: {
+ expand: ' ',
+ collapse: ' '
+ }
+ },
+
+ materialicons: {
+ style: {
+ expander: 'bt-tree-material-icons-expander'
+ }
+ },
+
+ fontawesome: {
+ style: {
+ expander: 'bt-tree-font-awesome-expander'
+ },
+ icons: {
+ expand: ' ',
+ collapse: ' '
+ }
+ },
+
+ glyphicons: {
+ style: {
+ expander: 'bt-tree-glyphicons-expander'
+ },
+ icons: {
+ expand: ' ',
+ collapse: ' '
+ }
+ }
+};
+/**
+ * @widget Tree
+ * @plugin Base
+ */
+bt.tree.events = {
+
+ /**
+ * Event fires when the tree is initialized
+ * @event initialized
+ * @param {object} e - event data
+ * @example Event.Sample
+ * Reload
+ *
+ *
+ */
+ initialized: function ($tree) {
+ $tree.triggerHandler('initialized');
+ },
+
+ /**
+ * Event fired before data binding takes place.
+ * @event dataBinding
+ * @param {object} e - event data
+ * @example Event.Sample
+ *
+ *
+ */
+ dataBinding: function ($tree) {
+ $tree.triggerHandler('dataBinding');
+ },
+
+ /**
+ * Event fires after the loading of the data in the tree.
+ * @event dataBound
+ * @param {object} e - event data
+ * @example Event.Sample
+ *
+ *
+ */
+ dataBound: function ($tree) {
+ $tree.triggerHandler('dataBound');
+ },
+
+ /**
+ * Event fires after selection of tree node.
+ * @event select
+ * @param {object} e - event data
+ * @param {object} node - the node as jquery object
+ * @param {string} id - the id of the record
+ * @example Event.Sample
+ * Select tree node in order to fire the event.
+ *
+ *
+ */
+ select: function ($tree, $node, id) {
+ return $tree.triggerHandler('select', [$node, id]);
+ },
+
+ /**
+ * Event fires on un selection of tree node
+ * @event unselect
+ * @param {object} e - event data
+ * @param {object} node - the node as jquery object
+ * @param {string} id - the id of the record
+ * @example Event.Sample
+ * Select/Unselect tree node in order to fire the event.
+ *
+ *
+ */
+ unselect: function ($tree, $node, id) {
+ return $tree.triggerHandler('unselect', [$node, id]);
+ },
+
+ /**
+ * Event fires before node expand.
+ * @event expand
+ * @param {object} e - event data
+ * @param {object} node - the node as jquery object
+ * @param {string} id - the id of the record
+ * @example Event.Sample
+ *
+ *
+ */
+ expand: function ($tree, $node, id) {
+ return $tree.triggerHandler('expand', [$node, id]);
+ },
+
+ /**
+ * Event fires before node collapse.
+ * @event collapse
+ * @param {object} e - event data
+ * @param {object} node - the node as jquery object
+ * @param {string} id - the id of the record
+ * @example Event.Sample
+ *
+ *
+ */
+ collapse: function ($tree, $node, id) {
+ return $tree.triggerHandler('collapse', [$node, id]);
+ },
+
+ /**
+ * Event fires on enable of tree node.
+ * @event enable
+ * @param {object} e - event data
+ * @param {object} node - the node as jquery object
+ * @example Event.Sample
+ * Enable North America
+ * Disable North America
+ *
+ *
+ *
+ */
+ enable: function ($tree, $node) {
+ return $tree.triggerHandler('enable', [$node]);
+ },
+
+ /**
+ * Event fires on disable of tree node.
+ * @event disable
+ * @param {object} e - event data
+ * @param {object} node - the node as jquery object
+ * @example Event.Sample
+ * Enable North America
+ * Disable North America
+ *
+ *
+ *
+ */
+ disable: function ($tree, $node) {
+ return $tree.triggerHandler('disable', [$node]);
+ },
+
+ /**
+ * Event fires before tree destroy
+ * @event destroying
+ * @param {object} e - event data
+ * @example Event.Sample
+ * Destroy
+ *
+ *
+ *
+ */
+ destroying: function ($tree) {
+ return $tree.triggerHandler('destroying');
+ },
+
+ /**
+ * Event fires when the data is bound to node.
+ * @event nodeDataBound
+ * @param {object} e - event data
+ * @param {object} node - the node as jquery object
+ * @param {string} id - the id of the record
+ * @param {object} record - the data of the node record
+ * @example Event.Sample
+ *
+ *
+ */
+ nodeDataBound: function ($tree, $node, id, record) {
+ return $tree.triggerHandler('nodeDataBound', [$node, id, record]);
+ }
+}
+/*global bt $*/
+bt.tree.methods = {
+
+ init: function (jsConfig) {
+ bt.widget.prototype.init.call(this, jsConfig, 'tree');
+
+ bt.tree.methods.initialize.call(this);
+
+ if (this.data('autoLoad')) {
+ this.reload();
+ }
+ return this;
+ },
+
+ initialize: function () {
+ var data = this.data(),
+ $root = $('');
+ this.empty().addClass(data.style.wrapper).append($root);
+ if (data.width) {
+ this.width(data.width);
+ }
+ if (data.border) {
+ this.addClass(data.style.border);
+ }
+ bt.tree.events.initialized(this);
+ },
+
+ useHtmlDataSource: function ($tree, data) {
+ data.dataSource = [];
+ },
+
+ render: function ($tree, response) {
+ if (response) {
+ if (typeof (response) === 'string' && JSON) {
+ response = JSON.parse(response);
+ }
+ $tree.data('records', bt.tree.methods.getRecords($tree, response));
+ bt.tree.methods.loadData($tree);
+ }
+ return $tree;
+ },
+
+ filter: function ($grid) {
+ return $grid.data().dataSource;
+ },
+
+ getRecords: function ($tree, response) {
+ var i, id, nodeData, result = [],
+ data = $tree.data();
+ for (i = 0; i < response.length; i++) {
+ id = data.primaryKey && response[i][data.primaryKey] ? response[i][data.primaryKey] : data.autoGenId++;
+ nodeData = { id: id, data: response[i] };
+ if (response[i][data.childrenField] && response[i][data.childrenField].length) {
+ nodeData.children = bt.tree.methods.getRecords($tree, response[i][data.childrenField]);
+ delete response[i][data.childrenField];
+ } else {
+ nodeData.children = [];
+ }
+ result.push(nodeData);
+ }
+ return result;
+ },
+
+ loadData: function ($tree) {
+ var i,
+ records = $tree.data('records'),
+ $root = $tree.children('ul');
+
+ bt.tree.events.dataBinding($tree);
+ $root.off().empty();
+ for (i = 0; i < records.length; i++) {
+ bt.tree.methods.appendNode($tree, $root, records[i], 1);
+ }
+ bt.tree.events.dataBound($tree);
+ },
+
+ appendNode: function ($tree, $parent, nodeData, level, position) {
+ var i, $node, $newParent, $span, $img,
+ data = $tree.data(),
+ $node = $(' ').addClass(data.style.item),
+ $wrapper = $('
'),
+ $expander = $(' ').addClass(data.style.expander),
+ $display = $('' + nodeData.data[data.textField] + ' '),
+ hasChildren = typeof (nodeData.data[data.hasChildrenField]) !== 'undefined' && nodeData.data[data.hasChildrenField].toString().toLowerCase() === 'true',
+ disabled = typeof (nodeData.data[data.disabledField]) !== 'undefined' && nodeData.data[data.disabledField].toString().toLowerCase() === 'true';
+
+ if (data.indentation) {
+ $wrapper.append(' ');
+ }
+
+ if (disabled) {
+ bt.tree.methods.disableNode($tree, $node);
+ } else {
+ $expander.on('click', bt.tree.methods.expanderClickHandler($tree));
+ $display.on('click', bt.tree.methods.displayClickHandler($tree));
+ }
+ $wrapper.append($expander);
+ $wrapper.append($display);
+ $node.append($wrapper);
+
+ if (position) {
+ $parent.find('li:eq(' + (position - 1) + ')').before($node);
+ } else {
+ $parent.append($node);
+ }
+
+ if (nodeData.children.length || hasChildren) {
+ $expander.empty().append(data.icons.expand);
+ $newParent = $('').addClass(data.style.list).addClass('bt-hidden');
+ $node.append($newParent);
+
+ for (i = 0; i < nodeData.children.length; i++) {
+ bt.tree.methods.appendNode($tree, $newParent, nodeData.children[i], level + 1);
+ }
+ } else {
+ data.style.leafIcon ? $expander.addClass(data.style.leafIcon) : $expander.html(' ');
+ }
+
+ if (data.imageCssClassField && nodeData.data[data.imageCssClassField]) {
+ $(' ').insertBefore($display);
+ } else if (data.imageUrlField && nodeData.data[data.imageUrlField]) {
+ $span = $(' ');
+ $span.insertBefore($display);
+ $img = $(' ');
+ $img.attr('width', $span.width()).attr('height', $span.height());
+ $span.append($img);
+ } else if (data.imageHtmlField && nodeData.data[data.imageHtmlField]) {
+ $span = $('' + nodeData.data[data.imageHtmlField] + ' ');
+ $span.insertBefore($display);
+ }
+
+ bt.tree.events.nodeDataBound($tree, $node, nodeData.id, nodeData.data);
+ },
+
+ expanderClickHandler: function ($tree) {
+ return function (e) {
+ var $expander = $(this),
+ $node = $expander.closest('li');
+ if ($expander.attr('data-mode') === 'close') {
+ $tree.expand($node);
+ } else {
+ $tree.collapse($node);
+ }
+ }
+ },
+
+ expand: function ($tree, $node, cascade) {
+ var $children, i,
+ $expander = $node.find('>[data-role="wrapper"]>[data-role="expander"]'),
+ data = $tree.data(),
+ id = $node.attr('data-id'),
+ $list = $node.children('ul');
+ if (bt.tree.events.expand($tree, $node, id) !== false && $list && $list.length) {
+ $list.show();
+ $expander.attr('data-mode', 'open');
+ $expander.empty().append(data.icons.collapse);
+ if (cascade) {
+ $children = $node.find('ul>li');
+ for (i = 0; i < $children.length; i++) {
+ bt.tree.methods.expand($tree, $($children[i]), cascade);
+ }
+ }
+ }
+ return $tree;
+ },
+
+ collapse: function ($tree, $node, cascade) {
+ var $children, i,
+ $expander = $node.find('>[data-role="wrapper"]>[data-role="expander"]'),
+ data = $tree.data(),
+ id = $node.attr('data-id'),
+ $list = $node.children('ul');
+ if (bt.tree.events.collapse($tree, $node, id) !== false && $list && $list.length) {
+ $list.hide();
+ $expander.attr('data-mode', 'close');
+ $expander.empty().append(data.icons.expand);
+ if (cascade) {
+ $children = $node.find('ul>li');
+ for (i = 0; i < $children.length; i++) {
+ bt.tree.methods.collapse($tree, $($children[i]), cascade);
+ }
+ }
+ }
+ return $tree;
+ },
+
+ expandAll: function ($tree) {
+ var i, $nodes = $tree.find('ul>li');
+ for (i = 0; i < $nodes.length; i++) {
+ bt.tree.methods.expand($tree, $($nodes[i]), true);
+ }
+ return $tree;
+ },
+
+ collapseAll: function ($tree) {
+ var i, $nodes = $tree.find('ul>li');
+ for (i = 0; i < $nodes.length; i++) {
+ bt.tree.methods.collapse($tree, $($nodes[i]), true);
+ }
+ return $tree;
+ },
+
+ displayClickHandler: function ($tree) {
+ return function (e) {
+ var $display = $(this),
+ $node = $display.closest('li'),
+ cascade = $tree.data().cascadeSelection;
+ if ($node.attr('data-selected') === 'true') {
+ bt.tree.methods.unselect($tree, $node, cascade);
+ } else {
+ if ($tree.data('selectionType') === 'single') {
+ bt.tree.methods.unselectAll($tree);
+ }
+ bt.tree.methods.select($tree, $node, cascade);
+ }
+ }
+ },
+
+ selectAll: function ($tree) {
+ var i, $nodes = $tree.find('ul>li');
+ for (i = 0; i < $nodes.length; i++) {
+ bt.tree.methods.select($tree, $($nodes[i]), true);
+ }
+ return $tree;
+ },
+
+ select: function ($tree, $node, cascade) {
+ var i, $children, data = $tree.data();
+ if ($node.attr('data-selected') !== 'true' && bt.tree.events.select($tree, $node, $node.attr('data-id')) !== false) {
+ $node.addClass(data.style.active).attr('data-selected', 'true');
+ if (cascade) {
+ $children = $node.find('ul>li');
+ for (i = 0; i < $children.length; i++) {
+ bt.tree.methods.select($tree, $($children[i]), cascade);
+ }
+ }
+ }
+ },
+
+ unselectAll: function ($tree) {
+ var i, $nodes = $tree.find('ul>li');
+ for (i = 0; i < $nodes.length; i++) {
+ bt.tree.methods.unselect($tree, $($nodes[i]), true);
+ }
+ return $tree;
+ },
+
+ unselect: function ($tree, $node, cascade) {
+ var i, $children, data = $tree.data();
+ if ($node.attr('data-selected') === 'true' && bt.tree.events.unselect($tree, $node, $node.attr('data-id')) !== false) {
+ $node.removeClass($tree.data().style.active).removeAttr('data-selected');
+ if (cascade) {
+ $children = $node.find('ul>li');
+ for (i = 0; i < $children.length; i++) {
+ bt.tree.methods.unselect($tree, $($children[i]), cascade);
+ }
+ }
+ }
+ },
+
+ getSelections: function ($list) {
+ var i, $node, children,
+ result = [],
+ $nodes = $list.children('li');
+ if ($nodes && $nodes.length) {
+ for (i = 0; i < $nodes.length; i++) {
+ $node = $($nodes[i]);
+ if ($node.attr('data-selected') === 'true') {
+ result.push($node.attr('data-id'));
+ } else if ($node.has('ul')) {
+ children = bt.tree.methods.getSelections($node.children('ul'));
+ if (children.length) {
+ result = result.concat(children);
+ }
+ }
+ }
+ }
+
+ return result;
+ },
+
+ getById: function ($tree, id, records) {
+ var i, result = undefined;
+ for (i = 0; i < records.length; i++) {
+ if (id == records[i].id) {
+ result = records[i];
+ break;
+ } else if (records[i].children && records[i].children.length) {
+ result = bt.tree.methods.getById($tree, id, records[i].children);
+ if (result) {
+ break;
+ }
+ }
+ }
+ return result;
+ },
+
+ getDataById: function ($tree, id, records) {
+ var result = bt.tree.methods.getById($tree, id, records);
+ return result ? result.data : result;
+ },
+
+ getDataByText: function ($tree, text, records) {
+ var i, id,
+ result = undefined,
+ data = $tree.data();
+ for (i = 0; i < records.length; i++) {
+ if (text === records[i].data[data.textField]) {
+ result = records[i].data;
+ break;
+ } else if (records[i].children && records[i].children.length) {
+ result = bt.tree.methods.getDataByText($tree, text, records[i].children);
+ if (result) {
+ break;
+ }
+ }
+ }
+ return result;
+ },
+
+ getNodeById: function ($list, id) {
+ var i, $node,
+ $result = undefined,
+ $nodes = $list.children('li');
+ if ($nodes && $nodes.length) {
+ for (i = 0; i < $nodes.length; i++) {
+ $node = $($nodes[i]);
+ if (id == $node.attr('data-id')) {
+ $result = $node;
+ break;
+ } else if ($node.has('ul')) {
+ $result = bt.tree.methods.getNodeById($node.children('ul'), id);
+ if ($result) {
+ break;
+ }
+ }
+ }
+ }
+ return $result;
+ },
+
+ getNodeByText: function ($list, text) {
+ var i, $node,
+ $result = undefined,
+ $nodes = $list.children('li');
+ if ($nodes && $nodes.length) {
+ for (i = 0; i < $nodes.length; i++) {
+ $node = $($nodes[i]);
+ if (text === $node.find('>[data-role="wrapper"]>[data-role="display"]').text()) {
+ $result = $node;
+ break;
+ } else if ($node.has('ul')) {
+ $result = bt.tree.methods.getNodeByText($node.children('ul'), text);
+ if ($result) {
+ break;
+ }
+ }
+ }
+ }
+ return $result;
+ },
+
+ getAll: function ($tree, records) {
+ var i, $node, id, targetRecord,
+ result = [],
+ childrenField = $tree.data('childrenField');
+
+ for (i = 0; i < records.length; i++) {
+ targetRecord = JSON.parse(JSON.stringify(records[i].data));
+ if (records[i].children.length) {
+ targetRecord[childrenField] = bt.tree.methods.getAll($tree, records[i].children);
+ }
+ result.push(targetRecord);
+ }
+ return result;
+ },
+
+ addNode: function ($tree, data, $parent, position) {
+ var level,
+ newNodeData = bt.tree.methods.getRecords($tree, [data])[0];
+
+ if (!$parent || !$parent.length) {
+ $parent = $tree.children('ul');
+ $tree.data('records').push(newNodeData);
+ } else {
+ if ($parent[0].tagName.toLowerCase() === 'li') {
+ if ($parent.children('ul').length === 0) {
+ $parent.find('[data-role="expander"]').empty().append($tree.data().icons.collapse);
+ $parent.append($('').addClass($tree.data().style.list));
+ }
+ $parent = $parent.children('ul');
+ }
+ bt.tree.methods.getById($tree, $parent.parent().data('id'), $tree.data('records')).children.push(newNodeData);
+ }
+ level = $parent.parentsUntil('[data-type="tree"]', 'ul').length + 1;
+
+ bt.tree.methods.appendNode($tree, $parent, newNodeData, level, position);
+
+ return $tree;
+ },
+
+ remove: function ($tree, $node) {
+ bt.tree.methods.removeDataById($tree, $node.attr('data-id'), $tree.data('records'));
+ $node.remove();
+ return $tree;
+ },
+
+ removeDataById: function ($tree, id, records) {
+ var i;
+ for (i = 0; i < records.length; i++) {
+ if (id == records[i].id) {
+ records.splice(i, 1);
+ break;
+ } else if (records[i].children && records[i].children.length) {
+ bt.tree.methods.removeDataById($tree, id, records[i].children);
+ }
+ }
+ },
+
+ update: function ($tree, id, newRecord) {
+ var data = $tree.data(),
+ $node = $tree.getNodeById(id),
+ oldRecord = $tree.getDataById(id);
+ oldRecord = newRecord;
+ $node.find('>[data-role="wrapper"]>[data-role="display"]').html(newRecord[data.textField]);
+ bt.tree.events.nodeDataBound($tree, $node, id, newRecord);
+ return $tree;
+ },
+
+ getChildren: function ($tree, $node, cascade) {
+ var result = [], i, $children,
+ cascade = typeof (cascade) === 'undefined' ? true : cascade;
+
+ if (cascade) {
+ $children = $node.find('ul li');
+ } else {
+ $children = $node.find('>ul>li');
+ }
+
+ for (i = 0; i < $children.length; i++) {
+ result.push($($children[i]).data('id'));
+ }
+
+ return result;
+ },
+
+ enableAll: function ($tree) {
+ var i, $children = $tree.find('ul>li');
+ for (i = 0; i < $children.length; i++) {
+ bt.tree.methods.enableNode($tree, $($children[i]), true);
+ }
+ return $tree;
+ },
+
+ enableNode: function ($tree, $node, cascade) {
+ var i, $children,
+ $expander = $node.find('>[data-role="wrapper"]>[data-role="expander"]'),
+ $display = $node.find('>[data-role="wrapper"]>[data-role="display"]'),
+ cascade = typeof (cascade) === 'undefined' ? true : cascade;
+
+ $node.removeClass('disabled');
+ $expander.on('click', bt.tree.methods.expanderClickHandler($tree));
+ $display.on('click', bt.tree.methods.displayClickHandler($tree));
+ bt.tree.events.enable($tree, $node);
+ if (cascade) {
+ $children = $node.find('ul>li');
+ for (i = 0; i < $children.length; i++) {
+ bt.tree.methods.enableNode($tree, $($children[i]), cascade);
+ }
+ }
+ },
+
+ disableAll: function ($tree) {
+ var i, $children = $tree.find('ul>li');
+ for (i = 0; i < $children.length; i++) {
+ bt.tree.methods.disableNode($tree, $($children[i]), true);
+ }
+ return $tree;
+ },
+
+ disableNode: function ($tree, $node, cascade) {
+ var i, $children,
+ $expander = $node.find('>[data-role="wrapper"]>[data-role="expander"]'),
+ $display = $node.find('>[data-role="wrapper"]>[data-role="display"]'),
+ cascade = typeof (cascade) === 'undefined' ? true : cascade;
+
+ $node.addClass('disabled');
+ $expander.off('click');
+ $display.off('click');
+ bt.tree.events.disable($tree, $node);
+ if (cascade) {
+ $children = $node.find('ul>li');
+ for (i = 0; i < $children.length; i++) {
+ bt.tree.methods.disableNode($tree, $($children[i]), cascade);
+ }
+ }
+ },
+
+ destroy: function ($tree) {
+ var data = $tree.data();
+ if (data) {
+ bt.tree.events.destroying($tree);
+ $tree.xhr && $tree.xhr.abort();
+ $tree.off();
+ $tree.removeData();
+ $tree.removeAttr('data-type');
+ $tree.removeClass().empty();
+ }
+ return $tree;
+ }
+}
+/**
+ * @widget Tree
+ * @plugin Base
+ */
+bt.tree.widget = function ($element, jsConfig) {
+ var self = this,
+ methods = bt.tree.methods;
+
+ /**
+ * Reload the tree.
+ * @method
+ * @param {object} params - Params that needs to be send to the server. Only in use for remote data sources.
+ * @return jQuery object
+ * @example Method.Sample
+ * Click to load
+ *
+ *
+ *
+ * @example Search
+ * Search
+ *
+ *
+ *
+ */
+ self.reload = function (params) {
+ return bt.widget.prototype.reload.call(this, params);
+ };
+
+ /**
+ * Render data in the tree
+ * @method
+ * @param {object} response - An object that contains the data that needs to be loaded in the tree.
+ * @fires dataBinding, dataBound
+ * @return tree
+ * @example sample
+ *
+ *
+ */
+ self.render = function (response) {
+ return methods.render(this, response);
+ };
+
+ /**
+ * Add node to the tree.
+ * @method
+ * @param {object} data - The node data.
+ * @param {object} parentNode - Parent node as jquery object.
+ * @param {Number} position - Position where the new node need to be added.
+ * @return jQuery object
+ * @example Append.ToRoot
+ * Append To Root
+ *
+ *
+ *
+ * @example Append.Parent
+ * Append To Asia
+ *
+ *
+ *
+ * @example Bootstrap
+ * Append To Asia
+ *
+ *
+ *
+ * @example Prepend
+ * Prepend in Asia
+ *
+ *
+ *
+ * @example Position
+ * Append to Asia as second
+ *
+ *
+ *
+ */
+ self.addNode = function (data, $parentNode, position) {
+ return methods.addNode(this, data, $parentNode, position);
+ };
+
+ /**
+ * Remove node from the tree.
+ * @method
+ * @param {object} node - The node as jQuery object
+ * @return jQuery object
+ * @example Method.Sample
+ * Remove USA
+ *
+ *
+ *
+ */
+ self.removeNode = function ($node) {
+ return methods.remove(this, $node);
+ };
+
+ /**
+ * Update node from the tree.
+ * @method
+ * @param {string} id - The id of the node that needs to be updated
+ * @param {object} record - The node as jQuery object
+ * @return jQuery object
+ * @example Method.Sample
+ *
+ * Save
+ *
+ *
+ *
+ */
+ self.updateNode = function (id, record) {
+ return methods.update(this, id, record);
+ };
+
+ /**
+ * Destroy the tree.
+ * @method
+ * @return jQuery object
+ * @example Method.Sample
+ * Destroy
+ *
+ *
+ *
+ */
+ self.destroy = function () {
+ return methods.destroy(this);
+ };
+
+ /**
+ * Expand node from the tree.
+ * @method
+ * @param {object} node - The node as jQuery object
+ * @param {boolean} cascade - Expand all children
+ * @return jQuery object
+ * @example Method.Sample
+ * Expand Asia
+ * Collapse Asia
+ *
+ *
+ *
+ * @example Cascade
+ * Expand North America
+ *
+ *
+ *
+ */
+ self.expand = function ($node, cascade) {
+ return methods.expand(this, $node, cascade);
+ };
+
+ /**
+ * Collapse node from the tree.
+ * @method
+ * @param {object} node - The node as jQuery object
+ * @param {boolean} cascade - Collapse all children
+ * @return jQuery object
+ * @example Method.Sample
+ * Expand Asia
+ * Collapse Asia
+ *
+ *
+ *
+ * @example Cascade
+ * Collapse North America
+ *
+ *
+ *
+ */
+ self.collapse = function ($node, cascade) {
+ return methods.collapse(this, $node, cascade);
+ };
+
+ /**
+ * Expand all tree nodes
+ * @method
+ * @return jQuery object
+ * @example Sample
+ * Expand All
+ * Collapse All
+ *
+ *
+ *
+ */
+ self.expandAll = function () {
+ return methods.expandAll(this);
+ };
+
+ /**
+ * Collapse all tree nodes
+ * @method
+ * @return jQuery object
+ * @example Sample
+ * Expand All
+ * Collapse All
+ *
+ *
+ *
+ */
+ self.collapseAll = function () {
+ return methods.collapseAll(this);
+ };
+
+ /**
+ * Return node data by id of the record.
+ * @method
+ * @param {string|number} id - The id of the record that needs to be returned
+ * @return object
+ * @example sample
+ * Get Data
+ *
+ *
+ *
+ */
+ self.getDataById = function (id) {
+ return methods.getDataById(this, id, this.data('records'));
+ };
+
+ /**
+ * Return node data by text.
+ * @method
+ * @param {string} text - The text of the record that needs to be returned
+ * @return object
+ * @example sample
+ * Get Data
+ *
+ *
+ *
+ */
+ self.getDataByText = function (text) {
+ return methods.getDataByText(this, text, this.data('records'));
+ };
+
+ /**
+ * Return node by id of the record.
+ * @method
+ * @param {string} id - The id of the node that needs to be returned
+ * @return jQuery object
+ * @example sample
+ *
+ *
+ */
+ self.getNodeById = function (id) {
+ return methods.getNodeById(this.children('ul'), id);
+ };
+
+ /**
+ * Return node by text.
+ * @method
+ * @param {string} text - The text in the node that needs to be returned
+ * @return jQuery object
+ * @example sample
+ *
+ *
+ */
+ self.getNodeByText = function (text) {
+ return methods.getNodeByText(this.children('ul'), text);
+ };
+
+ /**
+ * Return an array with all records presented in the tree.
+ * @method
+ * @return Array
+ * @example sample
+ * Get All Data
+ * Add New Node
+ *
+ *
+ *
+ */
+ self.getAll = function () {
+ return methods.getAll(this, this.data('records'));
+ };
+
+ /**
+ * Select node from the tree.
+ * @method
+ * @param {Object} node - The node as jquery object.
+ * @return jQuery Object
+ * @example Select.Method
+ * Select North America
+ * Unselect North America
+ *
+ *
+ *
+ */
+ self.select = function ($node) {
+ return methods.select(this, $node);
+ };
+
+ /**
+ * Unselect node from the tree.
+ * @method
+ * @param {Object} node - The node as jquery object.
+ * @return jQuery Object
+ * @example UnSelect.Method
+ * Select North America
+ * Unselect North America
+ *
+ *
+ *
+ */
+ self.unselect = function ($node) {
+ return methods.unselect(this, $node);
+ };
+
+ /**
+ * Select all tree nodes
+ * @method
+ * @return jQuery object
+ * @example Sample
+ * Select All
+ * Unselect All
+ *
+ *
+ *
+ */
+ self.selectAll = function () {
+ return methods.selectAll(this);
+ };
+
+ /**
+ * Unselect all tree nodes
+ * @method
+ * @return jQuery object
+ * @example Sample
+ * Select All
+ * Unselect All
+ *
+ *
+ *
+ */
+ self.unselectAll = function () {
+ return methods.unselectAll(this);
+ };
+
+ /**
+ * Return an array with the ids of the selected nodes.
+ * @method
+ * @return array
+ * @example Sample
+ * Show Selections
+ *
+ *
+ *
+ */
+ self.getSelections = function () {
+ return methods.getSelections(this.children('ul'));
+ };
+
+ /**
+ * Return an array with the ids of all children.
+ * @method
+ * @param {Object} node - The node as jquery object.
+ * @param {Boolean} cascade - Include all nested children. Set to true by default.
+ * @return array
+ * @example Cascade.True
+ *
+ *
+ * @example Cascade.False
+ *
+ *
+ */
+ self.getChildren = function ($node, cascade) {
+ return methods.getChildren(this, $node, cascade);
+ };
+
+ /**
+ * Enable node from the tree.
+ * @method
+ * @param {Object} node - The node as jquery object.
+ * @param {Boolean} cascade - Enable all children. Set to true by default.
+ * @return jQuery Object
+ * @example Material.Design
+ * Enable North America (Cascade)
+ * Disable North America (Cascade)
+ * Enable North America (Non-Cascade)
+ * Disable North America (Non-Cascade)
+ *
+ *
+ *
+ * @example Bootstrap
+ * Enable North America (Cascade)
+ * Disable North America (Cascade)
+ * Enable North America (Non-Cascade)
+ * Disable North America (Non-Cascade)
+ *
+ *
+ *
+ * @example Bootstrap.4
+ * Enable North America (Cascade)
+ * Disable North America (Cascade)
+ * Enable North America (Non-Cascade)
+ * Disable North America (Non-Cascade)
+ *
+ *
+ *
+ */
+ self.enable = function ($node, cascade) {
+ return methods.enableNode(this, $node, cascade);
+ };
+
+ /**
+ * Enable all nodes from the tree.
+ * @method
+ * @return jQuery Object
+ * @example Sample
+ * Enable All
+ * Disable All
+ *
+ *
+ *
+ */
+ self.enableAll = function () {
+ return methods.enableAll(this);
+ };
+
+ /**
+ * Disable node from the tree.
+ * @method
+ * @param {Object} node - The node as jquery object.
+ * @param {Boolean} cascade - Disable all children. Set to true by default.
+ * @return jQuery Object
+ * @example Sample
+ * Enable North America (Cascade)
+ * Disable North America (Cascade)
+ * Enable North America (Non-Cascade)
+ * Disable North America (Non-Cascade)
+ *
+ *
+ *
+ */
+ self.disable = function ($node, cascade) {
+ return methods.disableNode(this, $node, cascade);
+ };
+
+ /**
+ * Disable all nodes from the tree.
+ * @method
+ * @return jQuery Object
+ * @example Sample
+ * Enable All
+ * Disable All
+ *
+ *
+ *
+ */
+ self.disableAll = function () {
+ return methods.disableAll(this);
+ };
+
+ $.extend($element, self);
+ if ('tree' !== $element.attr('data-type')) {
+ methods.init.call($element, jsConfig);
+ }
+
+ return $element;
+};
+
+bt.tree.widget.prototype = new bt.widget();
+bt.tree.widget.constructor = bt.tree.widget;
+
+(function ($) {
+ $.fn.tree = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.tree.widget(this, method);
+ } else {
+ $widget = new bt.tree.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 Tree
+ * @plugin Checkboxes
+ */
+bt.tree.plugins.checkboxes = {
+ config: {
+ base: {
+ /** Add checkbox for each node, if set to true.
+ * @type Boolean
+ * @default undefined
+ * @example Material.Design
+ *
+ *
+ * @example Bootstrap.3
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ checkboxes: undefined,
+
+ /** Name of the source field, that indicates if the checkbox is checked.
+ * @type string
+ * @default 'checked'
+ * @example Custom.Name
+ *
+ *
+ */
+ checkedField: 'checked',
+
+ /** This setting enable cascade check and uncheck of children
+ * @type boolean
+ * @default true
+ * @example False.Remote.DataSource
+ *
+ *
+ * @example False.Local.DataSource
+ *
+ *
+ * @example True
+ *
+ *
+ */
+ cascadeCheck: true,
+ }
+ },
+
+ private: {
+ dataBound: function ($tree) {
+ var $nodes;
+ if ($tree.data('cascadeCheck')) {
+ $nodes = $tree.find('li[data-role="node"]');
+ $.each($nodes, function () {
+ var $node = $(this),
+ state = $node.find('[data-role="checkbox"] input[type="checkbox"]').checkbox('state');
+ if (state === 'checked') {
+ bt.tree.plugins.checkboxes.private.updateChildrenState($node, state);
+ bt.tree.plugins.checkboxes.private.updateParentState($node, state);
+ }
+ });
+ }
+ },
+
+ nodeDataBound: function ($tree, $node, id, record) {
+ var data = $tree.data(),
+ $expander = $node.find('> [data-role="wrapper"] > [data-role="expander"]'),
+ $checkbox = $(' '),
+ $wrapper = $(' ').append($checkbox),
+ disabled = typeof (record[data.disabledField]) !== 'undefined' && record[data.disabledField].toString().toLowerCase() === 'true';
+ $checkbox = $checkbox.checkbox({
+ uiLibrary: data.uiLibrary,
+ iconsLibrary: data.iconsLibrary,
+ change: function (e, state) {
+ bt.tree.plugins.checkboxes.events.checkboxChange($tree, $node, record, $checkbox.state());
+ }
+ });
+ disabled && $checkbox.prop('disabled', true);
+ record[data.checkedField] && $checkbox.state('checked');
+ $checkbox.on('click', function (e) {
+ var $node = $checkbox.closest('li'),
+ state = $checkbox.state();
+ if (data.cascadeCheck) {
+ bt.tree.plugins.checkboxes.private.updateChildrenState($node, state);
+ bt.tree.plugins.checkboxes.private.updateParentState($node, state);
+ }
+ });
+ $expander.after($wrapper);
+ },
+
+ updateParentState: function ($node, state) {
+ var $parentNode, $parentCheckbox, $siblingCheckboxes, allChecked, allUnchecked, parentState;
+
+ $parentNode = $node.parent('ul').parent('li');
+ if ($parentNode.length === 1) {
+ $parentCheckbox = $node.parent('ul').parent('li').find('> [data-role="wrapper"] > [data-role="checkbox"] input[type="checkbox"]');
+ $siblingCheckboxes = $node.siblings().find('> [data-role="wrapper"] > span[data-role="checkbox"] input[type="checkbox"]');
+ allChecked = (state === 'checked');
+ allUnchecked = (state === 'unchecked');
+ parentState = 'indeterminate';
+ $.each($siblingCheckboxes, function () {
+ var state = $(this).checkbox('state');
+ if (allChecked && state !== 'checked') {
+ allChecked = false;
+ }
+ if (allUnchecked && state !== 'unchecked') {
+ allUnchecked = false;
+ }
+ });
+ if (allChecked && !allUnchecked) {
+ parentState = 'checked';
+ }
+ if (!allChecked && allUnchecked) {
+ parentState = 'unchecked';
+ }
+ $parentCheckbox.checkbox('state', parentState);
+ bt.tree.plugins.checkboxes.private.updateParentState($parentNode, $parentCheckbox.checkbox('state'));
+ }
+ },
+
+ updateChildrenState: function ($node, state) {
+ var $childrenCheckboxes = $node.find('ul li [data-role="wrapper"] [data-role="checkbox"] input[type="checkbox"]');
+ if ($childrenCheckboxes.length > 0) {
+ $.each($childrenCheckboxes, function () {
+ $(this).checkbox('state', state);
+ });
+ }
+ },
+
+ update: function ($tree, $node, state) {
+ var checkbox = $node.find('[data-role="checkbox"] input[type="checkbox"]').first();
+ $(checkbox).checkbox('state', state);
+ if ($tree.data().cascadeCheck) {
+ bt.tree.plugins.checkboxes.private.updateChildrenState($node, state);
+ bt.tree.plugins.checkboxes.private.updateParentState($node, state);
+ }
+ }
+ },
+
+ public: {
+
+ /** Get ids of all checked nodes
+ * @method
+ * @return Array
+ * @example Base.Theme
+ * Get Checked Nodes
+ *
+ *
+ */
+ getCheckedNodes: function () {
+ var result = [],
+ checkboxes = this.find('li [data-role="checkbox"] input[type="checkbox"]');
+ $.each(checkboxes, function () {
+ var checkbox = $(this);
+ if (checkbox.checkbox('state') === 'checked') {
+ result.push(checkbox.closest('li').data('id'));
+ }
+ });
+ return result;
+ },
+
+ /**
+ * Check all tree nodes
+ * @method
+ * @return tree as jQuery object
+ * @example Sample
+ * Check All
+ * Uncheck All
+ *
+ *
+ *
+ */
+ checkAll: function () {
+ var $checkboxes = this.find('li [data-role="checkbox"] input[type="checkbox"]');
+ $.each($checkboxes, function () {
+ $(this).checkbox('state', 'checked');
+ });
+ return this;
+ },
+
+ /**
+ * Uncheck all tree nodes
+ * @method
+ * @return tree as jQuery object
+ * @example Sample
+ * Check All
+ * Uncheck All
+ *
+ *
+ *
+ */
+ uncheckAll: function () {
+ var $checkboxes = this.find('li [data-role="checkbox"] input[type="checkbox"]');
+ $.each($checkboxes, function () {
+ $(this).checkbox('state', 'unchecked');
+ });
+ return this;
+ },
+
+ /**
+ * Check tree node.
+ * @method
+ * @param {object} node - The node as jQuery object
+ * @return tree as jQuery object
+ * @example Sample
+ * Check China
+ *
+ *
+ *
+ */
+ check: function ($node) {
+ bt.tree.plugins.checkboxes.private.update(this, $node, 'checked');
+ return this;
+ },
+
+ /**
+ * Uncheck tree node.
+ * @method
+ * @param {object} node - The node as jQuery object
+ * @return tree as jQuery object
+ * @example Sample
+ * UnCheck China
+ *
+ *
+ *
+ */
+ uncheck: function ($node) {
+ bt.tree.plugins.checkboxes.private.update(this, $node, 'unchecked');
+ return this;
+ }
+ },
+
+ events: {
+ /**
+ * Event fires when the checkbox state is changed.
+ * @event checkboxChange
+ * @param {object} e - event data
+ * @param {object} $node - the node object as jQuery element
+ * @param {object} record - the record data
+ * @param {string} state - the new state of the checkbox
+ * @example Event.Sample
+ *
+ *
+ */
+ checkboxChange: function ($tree, $node, record, state) {
+ return $tree.triggerHandler('checkboxChange', [$node, record, state]);
+ }
+ },
+
+ configure: function ($tree) {
+ if ($tree.data('checkboxes') && bt.checkbox) {
+ $.extend(true, $tree, bt.tree.plugins.checkboxes.public);
+ $tree.on('nodeDataBound', function (e, $node, id, record) {
+ bt.tree.plugins.checkboxes.private.nodeDataBound($tree, $node, id, record);
+ });
+ $tree.on('dataBound', function () {
+ bt.tree.plugins.checkboxes.private.dataBound($tree);
+ });
+ $tree.on('enable', function (e, $node) {
+ $node.find('>[data-role="wrapper"]>[data-role="checkbox"] input[type="checkbox"]').prop('disabled', false);
+ });
+ $tree.on('disable', function (e, $node) {
+ $node.find('>[data-role="wrapper"]>[data-role="checkbox"] input[type="checkbox"]').prop('disabled', true);
+ });
+ }
+ }
+};
+
+/**
+ * @widget Tree
+ * @plugin DragAndDrop
+ */
+bt.tree.plugins.dragAndDrop = {
+ config: {
+ base: {
+ /** Enables drag and drop functionality for each node.
+ * @type Boolean
+ * @default undefined
+ * @example Material.Design
+ * Drag and Drop Tree Nodes
+ *
+ *
+ * @example Bootstrap.3
+ *
+ *
Drag and Drop Tree Nodes
+ *
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
Drag and Drop Tree Nodes
+ *
+ *
+ *
+ */
+ dragAndDrop: undefined,
+
+ style: {
+ dragEl: 'bt-tree-drag-el bt-tree-md-drag-el',
+ dropAsChildIcon: 'bt-cursor-pointer bt-icon plus',
+ dropAbove: 'bt-tree-drop-above',
+ dropBelow: 'bt-tree-drop-below'
+ }
+ },
+
+ bootstrap: {
+ style: {
+ dragEl: 'bt-tree-drag-el bt-tree-bootstrap-drag-el',
+ dropAsChildIcon: 'glyphicon glyphicon-plus',
+ dropAbove: 'drop-above',
+ dropBelow: 'drop-below'
+ }
+ },
+
+ bootstrap4: {
+ style: {
+ dragEl: 'bt-tree-drag-el bt-tree-bootstrap-drag-el',
+ dropAsChildIcon: 'bt-cursor-pointer bt-icon plus',
+ dropAbove: 'drop-above',
+ dropBelow: 'drop-below'
+ }
+ }
+ },
+
+ private: {
+ nodeDataBound: function ($tree, $node) {
+ var $wrapper = $node.children('[data-role="wrapper"]'),
+ $display = $node.find('>[data-role="wrapper"]>[data-role="display"]');
+ if ($wrapper.length && $display.length) {
+ $display.on('mousedown', bt.tree.plugins.dragAndDrop.private.createNodeMouseDownHandler($tree));
+ $display.on('mousemove', bt.tree.plugins.dragAndDrop.private.createNodeMouseMoveHandler($tree, $node, $display));
+ $display.on('mouseup', bt.tree.plugins.dragAndDrop.private.createNodeMouseUpHandler($tree));
+ }
+ },
+
+ createNodeMouseDownHandler: function ($tree) {
+ return function (e) {
+ $tree.data('dragReady', true);
+ }
+ },
+
+ createNodeMouseUpHandler: function ($tree) {
+ return function (e) {
+ $tree.data('dragReady', false);
+ }
+ },
+
+ createNodeMouseMoveHandler: function ($tree, $node, $display) {
+ return function (e) {
+ if ($tree.data('dragReady')) {
+ var data = $tree.data(), $dragEl, $wrapper, offsetTop, offsetLeft;
+
+ $tree.data('dragReady', false);
+ $dragEl = $display.clone().wrap('
').closest('div')
+ .wrap(' ').closest('li')
+ .wrap('').closest('ul');
+ $('body').append($dragEl);
+ $dragEl.attr('data-role', 'draggable-clone').addClass('bt-unselectable').addClass(data.style.dragEl);
+ $dragEl.find('[data-role="wrapper"]').prepend(' ');
+ $dragEl.draggable({
+ drag: bt.tree.plugins.dragAndDrop.private.createDragHandler($tree, $node, $display),
+ stop: bt.tree.plugins.dragAndDrop.private.createDragStopHandler($tree, $node, $display)
+ });
+ $wrapper = $display.parent();
+ offsetTop = $display.offset().top;
+ offsetTop -= parseInt($wrapper.css("border-top-width")) + parseInt($wrapper.css("margin-top")) + parseInt($wrapper.css("padding-top"));
+ offsetLeft = $display.offset().left;
+ offsetLeft -= parseInt($wrapper.css("border-left-width")) + parseInt($wrapper.css("margin-left")) + parseInt($wrapper.css("padding-left"));
+ offsetLeft -= $dragEl.find('[data-role="indicator"]').outerWidth(true);
+ $dragEl.css({
+ position: 'absolute', top: offsetTop, left: offsetLeft, width: $display.outerWidth(true)
+ });
+ if ($display.attr('data-droppable') === 'true') {
+ $display.droppable('destroy');
+ }
+ bt.tree.plugins.dragAndDrop.private.getTargetDisplays($tree, $node, $display).each(function () {
+ var $dropEl = $(this);
+ if ($dropEl.attr('data-droppable') === 'true') {
+ $dropEl.droppable('destroy');
+ }
+ $dropEl.droppable();
+ });
+ bt.tree.plugins.dragAndDrop.private.getTargetDisplays($tree, $node).each(function () {
+ var $dropEl = $(this);
+ if ($dropEl.attr('data-droppable') === 'true') {
+ $dropEl.droppable('destroy');
+ }
+ $dropEl.droppable();
+ });
+ $dragEl.trigger('mousedown');
+ }
+ };
+ },
+
+ getTargetDisplays: function ($tree, $node, $display) {
+ return $tree.find('[data-role="display"]').not($display).not($node.find('[data-role="display"]'));
+ },
+
+ getTargetWrappers: function ($tree, $node) {
+ return $tree.find('[data-role="wrapper"]').not($node.find('[data-role="wrapper"]'));
+ },
+
+ createDragHandler: function ($tree, $node, $display) {
+ var $displays = bt.tree.plugins.dragAndDrop.private.getTargetDisplays($tree, $node, $display),
+ $wrappers = bt.tree.plugins.dragAndDrop.private.getTargetWrappers($tree, $node),
+ data = $tree.data();
+ return function (e, offset, mousePosition) {
+ var $dragEl = $(this), success = false;
+ $displays.each(function () {
+ var $targetDisplay = $(this),
+ $indicator;
+ if ($targetDisplay.droppable('isOver', mousePosition)) {
+ $indicator = $dragEl.find('[data-role="indicator"]');
+ data.style.dropAsChildIcon ? $indicator.addClass(data.style.dropAsChildIcon) : $indicator.text('+');
+ success = true;
+ return false;
+ } else {
+ $dragEl.find('[data-role="indicator"]').removeClass(data.style.dropAsChildIcon).empty();
+ }
+ });
+ $wrappers.each(function () {
+ var $wrapper = $(this),
+ $indicator, middle;
+ if (!success && $wrapper.droppable('isOver', mousePosition)) {
+ middle = $wrapper.position().top + ($wrapper.outerHeight() / 2);
+ if (mousePosition.y < middle) {
+ $wrapper.addClass(data.style.dropAbove).removeClass(data.style.dropBelow);
+ } else {
+ $wrapper.addClass(data.style.dropBelow).removeClass(data.style.dropAbove);
+ }
+ } else {
+ $wrapper.removeClass(data.style.dropAbove).removeClass(data.style.dropBelow);
+ }
+ });
+ };
+ },
+
+ createDragStopHandler: function ($tree, $sourceNode, $sourceDisplay) {
+ var $displays = bt.tree.plugins.dragAndDrop.private.getTargetDisplays($tree, $sourceNode, $sourceDisplay),
+ $wrappers = bt.tree.plugins.dragAndDrop.private.getTargetWrappers($tree, $sourceNode),
+ data = $tree.data();
+ return function (e, mousePosition) {
+ var success = false;
+ $(this).draggable('destroy').remove();
+ $displays.each(function () {
+ var $targetDisplay = $(this), $targetNode, $sourceParentNode, $ul;
+ if ($targetDisplay.droppable('isOver', mousePosition)) {
+ $targetNode = $targetDisplay.closest('li');
+ $sourceParentNode = $sourceNode.parent('ul').parent('li');
+ $ul = $targetNode.children('ul');
+ if ($ul.length === 0) {
+ $ul = $('').addClass(data.style.list);
+ $targetNode.append($ul);
+ }
+ if (bt.tree.plugins.dragAndDrop.events.nodeDrop($tree, $sourceNode.data('id'), $targetNode.data('id'), $ul.children('li').length + 1) !== false) {
+ $ul.append($sourceNode);
+ bt.tree.plugins.dragAndDrop.private.refresh($tree, $sourceNode, $targetNode, $sourceParentNode);
+ }
+ success = true;
+ return false;
+ }
+ $targetDisplay.droppable('destroy');
+ });
+ if (!success) {
+ $wrappers.each(function () {
+ var $targetWrapper = $(this), $targetNode, $sourceParentNode, prepend, orderNumber, sourceNodeId;
+ if ($targetWrapper.droppable('isOver', mousePosition)) {
+ $targetNode = $targetWrapper.closest('li');
+ $sourceParentNode = $sourceNode.parent('ul').parent('li');
+ prepend = mousePosition.top < ($targetWrapper.position().top + ($targetWrapper.outerHeight() / 2));
+ sourceNodeId = $sourceNode.data('id');
+ orderNumber = $targetNode.prevAll('li:not([data-id="' + sourceNodeId + '"])').length + (prepend ? 1 : 2);
+ if (bt.tree.plugins.dragAndDrop.events.nodeDrop($tree, sourceNodeId, $targetNode.parent('ul').parent('li').data('id'), orderNumber) !== false) {
+ if (prepend) {
+ $sourceNode.insertBefore($targetNode);
+ } else {
+ $sourceNode.insertAfter($targetNode);
+ }
+ bt.tree.plugins.dragAndDrop.private.refresh($tree, $sourceNode, $targetNode, $sourceParentNode);
+ }
+ return false;
+ }
+ $targetWrapper.droppable('destroy');
+ });
+ }
+ }
+ },
+
+ refresh: function ($tree, $sourceNode, $targetNode, $sourceParentNode) {
+ var data = $tree.data();
+ bt.tree.plugins.dragAndDrop.private.refreshNode($tree, $targetNode);
+ bt.tree.plugins.dragAndDrop.private.refreshNode($tree, $sourceParentNode);
+ bt.tree.plugins.dragAndDrop.private.refreshNode($tree, $sourceNode);
+ $sourceNode.find('li[data-role="node"]').each(function () {
+ bt.tree.plugins.dragAndDrop.private.refreshNode($tree, $(this));
+ });
+ $targetNode.children('[data-role="wrapper"]').removeClass(data.style.dropAbove).removeClass(data.style.dropBelow);
+ },
+
+ refreshNode: function ($tree, $node) {
+ var $wrapper = $node.children('[data-role="wrapper"]'),
+ $expander = $wrapper.children('[data-role="expander"]'),
+ $spacer = $wrapper.children('[data-role="spacer"]'),
+ $list = $node.children('ul'),
+ data = $tree.data(),
+ level = $node.parentsUntil('[data-type="tree"]', 'ul').length;
+
+ if ($list.length && $list.children().length) {
+ if ($list.is(':visible')) {
+ $expander.empty().append(data.icons.collapse);
+ } else {
+ $expander.empty().append(data.icons.expand);
+ }
+ } else {
+ $expander.empty();
+ }
+ $wrapper.removeClass(data.style.dropAbove).removeClass(data.style.dropBelow);
+
+ $spacer.css('width', (data.indentation * (level - 1)));
+ }
+ },
+
+ public: {
+ },
+
+ events: {
+ /**
+ * Event fires when the node is dropped.
+ * @event nodeDrop
+ * @param {object} e - event data
+ * @param {string} id - the id of the record
+ * @param {object} parentId - the id of the new parend node
+ * @param {object} orderNumber - the new order number
+ * @example Event.Sample
+ *
+ *
+ */
+ nodeDrop: function ($tree, id, parentId, orderNumber) {
+ return $tree.triggerHandler('nodeDrop', [id, parentId, orderNumber]);
+ }
+ },
+
+ configure: function ($tree) {
+ $.extend(true, $tree, bt.tree.plugins.dragAndDrop.public);
+ if ($tree.data('dragAndDrop') && bt.draggable && bt.droppable) {
+ $tree.on('nodeDataBound', function (e, $node) {
+ bt.tree.plugins.dragAndDrop.private.nodeDataBound($tree, $node);
+ });
+ }
+ }
+};
+
+/**
+ * @widget Tree
+ * @plugin Lazy Loading
+ */
+bt.tree.plugins.lazyLoading = {
+ config: {
+ base: {
+
+ paramNames: {
+
+ /** The name of the parameter that is going to send the parent identificator.
+ * Lazy Loading needs to be enabled in order this parameter to be in use.
+ * @alias paramNames.parentId
+ * @type string
+ * @default "parentId"
+ */
+ parentId: 'parentId'
+ },
+
+ /** Enables lazy loading
+ * @type Boolean
+ * @default false
+ * @example Material.Design
+ *
+ *
+ */
+ lazyLoading: false
+ }
+ },
+
+ private: {
+ nodeDataBound: function ($tree, $node, id, record) {
+ var data = $tree.data(),
+ $expander = $node.find('> [data-role="wrapper"] > [data-role="expander"]');
+
+ if (record.hasChildren) {
+ $expander.empty().append(data.icons.expand);
+ }
+ },
+
+ createDoneHandler: function ($tree, $node) {
+ return function (response) {
+ var i, $expander, $list, data = $tree.data();
+ if (typeof (response) === 'string' && JSON) {
+ response = JSON.parse(response);
+ }
+ if (response && response.length) {
+ $list = $('').addClass(data.style.list);
+ $node.append($list);
+ for (i = 0; i < response.length; i++) {
+ $tree.addNode(response[i], $list);
+ }
+ $expander = $node.find('>[data-role="wrapper"]>[data-role="expander"]'),
+ $expander.attr('data-mode', 'open');
+ $expander.empty().append(data.icons.collapse);
+ bt.tree.events.dataBound($tree);
+ }
+ };
+ },
+
+ expand: function ($tree, $node, id) {
+ var ajaxOptions, data = $tree.data(), params = {},
+ $children = $node.find('>ul>li');
+
+ if (!$children || !$children.length) {
+ if (typeof (data.dataSource) === 'string') {
+ params[data.paramNames.parentId] = id;
+ ajaxOptions = { url: data.dataSource, data: params };
+ if ($tree.xhr) {
+ $tree.xhr.abort();
+ }
+ $tree.xhr = $.ajax(ajaxOptions).done(bt.tree.plugins.lazyLoading.private.createDoneHandler($tree, $node)).fail($tree.createErrorHandler());
+ }
+ }
+ }
+ },
+
+ public: {},
+
+ events: {},
+
+ configure: function ($tree, fullConfig, clientConfig) {
+ if (clientConfig.lazyLoading) {
+ $tree.on('nodeDataBound', function (e, $node, id, record) {
+ bt.tree.plugins.lazyLoading.private.nodeDataBound($tree, $node, id, record);
+ });
+ $tree.on('expand', function (e, $node, id) {
+ bt.tree.plugins.lazyLoading.private.expand($tree, $node, id);
+ });
+ }
+ }
+};
+
+/* global window alert jQuery */
+/**
+ * @widget Checkbox
+ * @plugin Base
+ */
+bt.checkbox = {
+ plugins: {}
+};
+
+bt.checkbox.config = {
+ base: {
+ /** 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
+ *
+ * Checked
+ * Unchecked
+ * Indeterminate
+ * Enable
+ * Disable
+ *
+ * @example Bootstrap.3
+ *
+ *
+ * Checked
+ * Unchecked
+ * Indeterminate
+ * Enable
+ * Disable
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ * Checked
+ * Unchecked
+ * Indeterminate
+ * Enable
+ * Disable
+ *
+ *
+ */
+ uiLibrary: 'materialdesign',
+
+ /** 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 'materialicons'
+ * @example Bootstrap.4.FontAwesome
+ *
+ *
+ * Checked
+ * Unchecked
+ * Indeterminate
+ * Enable
+ * Disable
+ *
+ *
+ */
+ iconsLibrary: 'materialicons',
+
+ style: {
+ wrapperCssClass: 'bt-checkbox-md',
+ spanCssClass: undefined
+ }
+
+ },
+
+ bootstrap: {
+ style: {
+ wrapperCssClass: 'bt-checkbox-bootstrap'
+ },
+ iconsLibrary: 'glyphicons'
+ },
+
+ bootstrap4: {
+ style: {
+ wrapperCssClass: 'bt-checkbox-bootstrap bt-checkbox-bootstrap-4'
+ },
+ iconsLibrary: 'materialicons'
+ },
+
+ materialicons: {
+ style: {
+ iconsCssClass: 'bt-checkbox-material-icons',
+ spanCssClass: 'bt-icon'
+ }
+ },
+
+ glyphicons: {
+ style: {
+ iconsCssClass: 'bt-checkbox-glyphicons',
+ spanCssClass: ''
+ }
+ },
+
+ fontawesome: {
+ style: {
+ iconsCssClass: 'bt-checkbox-fontawesome',
+ spanCssClass: 'fa'
+ }
+ }
+};
+
+bt.checkbox.methods = {
+ init: function (jsConfig) {
+ var $chkb = this;
+
+ bt.widget.prototype.init.call(this, jsConfig, 'checkbox');
+ $chkb.attr('data-checkbox', 'true');
+
+ bt.checkbox.methods.initialize($chkb);
+
+ return $chkb;
+ },
+
+ initialize: function ($chkb) {
+ var data = $chkb.data(), $wrapper, $span;
+
+ if (data.style.wrapperCssClass) {
+ $wrapper = $(' ');
+ if ($chkb.attr('id')) {
+ $wrapper.attr('for', $chkb.attr('id'));
+ }
+ $chkb.wrap($wrapper);
+ $span = $(' ');
+ if (data.style.spanCssClass) {
+ $span.addClass(data.style.spanCssClass);
+ }
+ $chkb.parent().append($span);
+ }
+ },
+
+ state: function ($chkb, value) {
+ if (value) {
+ if ('checked' === value) {
+ $chkb.prop('indeterminate', false);
+ $chkb.prop('checked', true);
+ } else if ('unchecked' === value) {
+ $chkb.prop('indeterminate', false);
+ $chkb.prop('checked', false);
+ } else if ('indeterminate' === value) {
+ $chkb.prop('checked', true);
+ $chkb.prop('indeterminate', true);
+ }
+ bt.checkbox.events.change($chkb, value);
+ return $chkb;
+ } else {
+ if ($chkb.prop('indeterminate')) {
+ value = 'indeterminate';
+ } else if ($chkb.prop('checked')) {
+ value = 'checked';
+ } else {
+ value = 'unchecked';
+ }
+ return value;
+ }
+ },
+
+ toggle: function ($chkb) {
+ if ($chkb.state() == 'checked') {
+ $chkb.state('unchecked');
+ } else {
+ $chkb.state('checked');
+ }
+ return $chkb;
+ },
+
+ destroy: function ($chkb) {
+ if ($chkb.attr('data-checkbox') === 'true') {
+ $chkb.removeData();
+ $chkb.removeAttr('data-guid');
+ $chkb.removeAttr('data-checkbox');
+ $chkb.off();
+ $chkb.next('span').remove();
+ $chkb.unwrap();
+ }
+ return $chkb;
+ }
+};
+
+bt.checkbox.events = {
+ /**
+ * Triggered when the state of the checkbox is changed
+ *
+ * @event change
+ * @param {object} e - event data
+ * @param {string} state - the data of the checkbox
+ * @example sample
+ *
+ *
+ */
+ change: function ($chkb, state) {
+ return $chkb.triggerHandler('change', [state]);
+ }
+};
+
+
+bt.checkbox.widget = function ($element, jsConfig) {
+ var self = this,
+ methods = bt.checkbox.methods;
+
+ /** Toogle the state of the checkbox.
+ * @method
+ * @fires change
+ * @return checkbox as jquery object
+ * @example sample
+ * toggle
+ *
+ *
+ *
+ */
+ self.toggle = function () {
+ return methods.toggle(this);
+ };
+
+ /** Return state or set state if you pass parameter.
+ * @method
+ * @fires change
+ * @param {string} value - State of the checkbox. Accept only checked, unchecked or indeterminate as values.
+ * @return checked|unchecked|indeterminate|checkbox as jquery object
+ * @example sample
+ * Set to checked
+ * Set to unchecked
+ * Set to indeterminate
+ * Get state
+ *
+ *
+ *
+ */
+ self.state = function (value) {
+ return methods.state(this, value);
+ };
+
+ /** Remove checkbox functionality from the element.
+ * @method
+ * @return checkbox as jquery object
+ * @example sample
+ * Destroy
+ *
+ *
+ */
+ self.destroy = function () {
+ return methods.destroy(this);
+ };
+
+ $.extend($element, self);
+ if ('true' !== $element.attr('data-checkbox')) {
+ methods.init.call($element, jsConfig);
+ }
+
+ return $element;
+};
+
+bt.checkbox.widget.prototype = new bt.widget();
+bt.checkbox.widget.constructor = bt.checkbox.widget;
+
+(function ($) {
+ $.fn.checkbox = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.checkbox.widget(this, method);
+ } else {
+ $widget = new bt.checkbox.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 Editor
+ * @plugin Base
+ */
+bt.editor = {
+ plugins: {},
+ messages: {}
+};
+
+bt.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 JS
+ *
+ *
+ * @example HTML
+ *
+ *
+ */
+ 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 Bootstrap.4.FontAwesome
+ *
+ *
+ * @example Bootstrap.3.FontAwesome
+ *
+ *
+ */
+ iconsLibrary: 'materialicons',
+
+ /** The language that needs to be in use.
+ * @type string
+ * @default 'en-us'
+ * @example French
+ *
+ * Hover buttons in the toolbar in order to see localized tooltips
+ *
+ * @example German
+ *
+ * Hover buttons in the toolbar in order to see localized tooltips
+ *
+ */
+ locale: 'en-us',
+
+ buttons: undefined,
+
+ style: {
+ wrapper: 'bt-editor bt-editor-md',
+ buttonsGroup: 'bt-button-md-group',
+ button: 'bt-button-md',
+ buttonActive: 'active'
+ }
+ },
+
+ bootstrap: {
+ style: {
+ wrapper: 'bt-editor bt-editor-bootstrap',
+ buttonsGroup: 'btn-group',
+ button: 'btn btn-default bt-cursor-pointer',
+ buttonActive: 'active'
+ }
+ },
+
+ bootstrap4: {
+ style: {
+ wrapper: 'bt-editor bt-editor-bootstrap',
+ buttonsGroup: 'btn-group',
+ button: 'btn btn-outline-secondary bt-cursor-pointer',
+ buttonActive: 'active'
+ }
+ },
+
+ materialicons: {
+ icons: {
+ bold: ' ',
+ italic: ' ',
+ strikethrough: ' ',
+ underline: ' ',
+
+ listBulleted: ' ',
+ listNumbered: ' ',
+ indentDecrease: ' ',
+ indentIncrease: ' ',
+
+ alignLeft: ' ',
+ alignCenter: ' ',
+ alignRight: ' ',
+ alignJustify: ' ',
+
+ undo: ' ',
+ redo: ' '
+ }
+ },
+
+ fontawesome: {
+ icons: {
+ bold: ' ',
+ italic: ' ',
+ strikethrough: ' ',
+ underline: ' ',
+
+ listBulleted: ' ',
+ listNumbered: ' ',
+ indentDecrease: ' ',
+ indentIncrease: ' ',
+
+ alignLeft: ' ',
+ alignCenter: ' ',
+ alignRight: ' ',
+ alignJustify: ' ',
+
+ undo: ' ',
+ redo: ' '
+ }
+ }
+};
+
+bt.editor.methods = {
+ init: function (jsConfig) {
+ bt.widget.prototype.init.call(this, jsConfig, 'editor');
+ this.attr('data-editor', 'true');
+ bt.editor.methods.initialize(this);
+ return this;
+ },
+
+ initialize: function ($editor) {
+ var self = this, data = $editor.data(),
+ $group, $btn, wrapper, $body, $toolbar;
+
+ $editor.hide();
+
+ if ($editor[0].parentElement.attributes.role !== 'wrapper') {
+ wrapper = document.createElement('div');
+ wrapper.setAttribute('role', 'wrapper');
+ $editor[0].parentNode.insertBefore(wrapper, $editor[0]);
+ wrapper.appendChild($editor[0]);
+ }
+
+ bt.editor.methods.localization(data);
+ $(wrapper).addClass(data.style.wrapper);
+ if (data.width) {
+ $(wrapper).width(data.width);
+ }
+
+ $body = $(wrapper).children('div[role="body"]');
+ if ($body.length === 0) {
+ $body = $('
');
+ $(wrapper).append($body);
+ if ($editor[0].innerText) {
+ $body[0].innerHTML = $editor[0].innerText;
+ }
+ }
+ $body.attr('contenteditable', true);
+ $body.on('keydown', function (e) {
+ var key = event.keyCode || event.charCode;
+ if (bt.editor.events.changing($editor) === false && key !== 8 && key !== 46) {
+ e.preventDefault();
+ }
+ });
+ $body.on('mouseup keyup mouseout cut paste', function (e) {
+ self.updateToolbar($editor, $toolbar);
+ bt.editor.events.changed($editor);
+ $editor.html($body.html());
+ });
+
+ $toolbar = $(wrapper).children('div[role="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 () {
+ bt.editor.methods.executeCmd($editor, $body, $toolbar, $(this));
+ });
+ $group.append($btn);
+ }
+ $toolbar.append($group);
+ }
+ }
+
+ $body.height(data.height - bt.core.height($toolbar[0], true));
+ },
+
+ localization: function (data) {
+ var msg = bt.editor.messages[data.locale];
+ if (typeof (data.buttons) === 'undefined') {
+ data.buttons = [
+ [
+ '' + data.icons.bold + ' ',
+ '' + data.icons.italic + ' ',
+ '' + data.icons.strikethrough + ' ',
+ '' + data.icons.underline + ' '
+ ],
+ [
+ '' + data.icons.listBulleted + ' ',
+ '' + data.icons.listNumbered + ' ',
+ '' + data.icons.indentDecrease + ' ',
+ '' + data.icons.indentIncrease + ' '
+ ],
+ [
+ '' + data.icons.alignLeft + ' ',
+ '' + data.icons.alignCenter + ' ',
+ '' + data.icons.alignRight + ' ',
+ '' + data.icons.alignJustify + ' '
+ ],
+ [
+ '' + data.icons.undo + ' ',
+ '' + data.icons.redo + ' '
+ ]
+ ];
+ }
+ },
+
+ updateToolbar: function ($editor, $toolbar) {
+ var data = $editor.data();
+ $buttons = $toolbar.find('[role]').each(function() {
+ var $btn = $(this),
+ cmd = $btn.attr('role');
+
+ if (cmd && document.queryCommandEnabled(cmd) && document.queryCommandValue(cmd) === "true") {
+ $btn.addClass(data.style.buttonActive);
+ } else {
+ $btn.removeClass(data.style.buttonActive);
+ }
+ });
+ },
+
+ executeCmd: function ($editor, $body, $toolbar, $btn) {
+ $body.focus();
+ document.execCommand($btn.attr('role'), false);
+ bt.editor.methods.updateToolbar($editor, $toolbar);
+ },
+
+ content: function ($editor, html) {
+ var $body = $editor.parent().children('div[role="body"]');
+ if (typeof (html) === "undefined") {
+ return $body.html();
+ } else {
+ return $body.html(html);
+ }
+ },
+
+ destroy: function ($editor) {
+ var $wrapper;
+ if ($editor.attr('data-editor') === 'true') {
+ $wrapper = $editor.parent();
+ $wrapper.children('div[role="body"]').remove();
+ $wrapper.children('div[role="toolbar"]').remove();
+ $editor.unwrap();
+ $editor.removeData();
+ $editor.removeAttr('data-guid');
+ $editor.removeAttr('data-editor');
+ $editor.off();
+ $editor.show();
+ }
+ return $editor;
+ }
+};
+
+bt.editor.events = {
+
+ /**
+ * Event fires before change of text in the editor.
+ *
+ * @event changing
+ * @param {object} e - event data
+ * @example MaxLength
+ *
+ *
+ */
+ changing: function ($editor) {
+ return $editor.triggerHandler('changing');
+ },
+
+ /**
+ * Event fires after change of text in the editor.
+ *
+ * @event changed
+ * @param {object} e - event data
+ * @example sample
+ *
+ *
+ */
+ changed: function ($editor) {
+ return $editor.triggerHandler('changed');
+ }
+};
+
+bt.editor.widget = function ($element, jsConfig) {
+ var self = this,
+ methods = bt.editor.methods;
+
+ /** Get or set html content in the body.
+ * @method
+ * @param {string} html - The html content that needs to be set.
+ * @return string | editor
+ * @example Get
+ * Get Content
+ *
+ * My content .
+ *
+ * @example Set
+ * Set Content
+ *
+ *
+ *
+ */
+ self.content = function (html) {
+ return methods.content(this, html);
+ };
+
+ /** Remove editor functionality from the element.
+ * @method
+ * @return jquery element
+ * @example sample
+ * Destroy
+ *
+ *
+ */
+ self.destroy = function () {
+ return methods.destroy(this);
+ };
+
+ $.extend($element, self);
+ if ('true' !== $element.attr('data-editor')) {
+ methods.init.call($element, jsConfig);
+ }
+
+ return $element;
+};
+
+bt.editor.widget.prototype = new bt.widget();
+bt.editor.widget.constructor = bt.editor.widget;
+
+(function ($) {
+ $.fn.editor = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.editor.widget(this, method);
+ } else {
+ $widget = new bt.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);
+bt.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 bt */
+/**
+ * @widget DropDown
+ * @plugin Base
+ */
+bt.dropdown = {
+ plugins: {}
+};
+
+bt.dropdown.config = {
+ base: {
+
+ /** The data source of dropdown.
+ * @additionalinfo If set to string, then the dropdown is going to use this string as a url for ajax requests to the server.
+ * If set to object, then the dropdown is going to use this object as settings for the jquery ajax function.
+ * If set to array, then the dropdown is going to use the array as data for dropdown nodes.
+ * @type (string|object|array)
+ * @default undefined
+ * @example Local.DataSource
+ *
+ *
+ * @example Remote.DataSource
+ *
+ *
+ */
+ dataSource: undefined,
+
+ /** Text field name.
+ * @type string
+ * @default 'text'
+ * @example sample
+ *
+ *
+ */
+ textField: 'text',
+
+ /** Value field name.
+ * @type string
+ * @default 'value'
+ * @example sample
+ *
+ *
+ */
+ valueField: 'value',
+
+ /** Selected field name.
+ * @type string
+ * @default 'selected'
+ * @example sample
+ *
+ *
+ */
+ selectedField: 'selected',
+
+ /** The width of the dropdown.
+ * @type number
+ * @default undefined
+ * @example JS.Config
+ *
+ * One
+ * Two
+ * Three
+ *
+ *
+ * @example HTML.Config
+ *
+ * One
+ * Two
+ * Three
+ *
+ *
+ * @example 100.Percent
+ *
+ *
+ * One
+ * Two
+ * Three
+ *
+ *
+ */
+ width: undefined,
+
+ /** The maximum height of the dropdown list. When set to auto adjust to the screen height.
+ * @type Number|'auto'
+ * @default 'auto'
+ * @example Auto
+ * Note: Minimize the window in order to enable scrolling for the drop down list.
+ *
+ *
+ * @example Fixed
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ maxHeight: 'auto',
+
+ /** Placeholder. This label appear only if the value is not set yet.
+ * @type number
+ * @default undefined
+ * @example JS.Config
+ *
+ *
+ * @example HTML.Config
+ *
+ *
+ *
+ * @example Bootstrap
+ *
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ *
+ */
+ placeholder: undefined,
+
+ fontSize: undefined,
+
+ /** The name of the UI library that is going to be in use.
+ * @additionalinfo The css file for bootstrap should be manually included if you use bootstrap.
+ * @type (materialdesign|bootstrap|bootstrap4)
+ * @default materialdesign
+ * @example MaterialDesign
+ *
+ * One
+ * Two
+ * Three
+ *
+ *
+ * @example Bootstrap.3
+ *
+ * One
+ * Two
+ * Three
+ *
+ *
+ * @example Bootstrap.4
+ *
+ * One
+ * Two
+ * Three
+ *
+ *
+ */
+ uiLibrary: 'materialdesign',
+
+ /** 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 'materialicons'
+ * @example Bootstrap.Material.Icons
+ *
+ *
+ * @example Bootstrap.4.Font.Awesome
+ *
+ *
+ */
+ iconsLibrary: 'materialicons',
+
+ icons: {
+ /** DropDown icon definition.
+ * @alias icons.dropdown
+ * @type String
+ * @default ' '
+ * @example Custom.Material.Icon
+ *
+ *
+ * @example Custom.Glyphicon.Icon
+ *
+ *
+ */
+ dropdown: ' ',
+
+ dropup: ' '
+ },
+
+ style: {
+ wrapper: 'bt-dropdown bt-dropdown-md bt-unselectable',
+ list: 'bt-list bt-list-md bt-dropdown-list-md',
+ active: 'bt-list-md-active'
+ }
+ },
+
+ bootstrap: {
+ style: {
+ wrapper: 'bt-dropdown bt-dropdown-bootstrap bt-dropdown-bootstrap-3 bt-unselectable',
+ presenter: 'btn btn-default',
+ list: 'bt-list bt-list-bootstrap bt-dropdown-list-bootstrap list-group',
+ item: 'list-group-item',
+ active: 'active'
+ },
+ iconsLibrary: 'glyphicons'
+ },
+
+ bootstrap4: {
+ style: {
+ wrapper: 'bt-dropdown bt-dropdown-bootstrap bt-dropdown-bootstrap-4 bt-unselectable',
+ presenter: 'btn btn-outline-secondary',
+ list: 'bt-list bt-list-bootstrap bt-dropdown-list-bootstrap list-group',
+ item: 'list-group-item',
+ active: 'active'
+ }
+ },
+
+ materialicons: {
+ style: {
+ expander: 'bt-dropdown-expander-mi'
+ }
+ },
+
+ fontawesome: {
+ icons: {
+ dropdown: ' ',
+ dropup: ' '
+ },
+ style: {
+ expander: 'bt-dropdown-expander-fa'
+ }
+ },
+
+ glyphicons: {
+ icons: {
+ dropdown: ' ',
+ dropup: ' '
+ },
+ style: {
+ expander: 'bt-dropdown-expander-glyphicons'
+ }
+ }
+};
+
+bt.dropdown.methods = {
+ init: function (jsConfig) {
+ bt.widget.prototype.init.call(this, jsConfig, 'dropdown');
+ this.attr('data-dropdown', 'true');
+ bt.dropdown.methods.initialize(this);
+ return this;
+ },
+
+ getHTMLConfig: function () {
+ var result = bt.widget.prototype.getHTMLConfig.call(this),
+ attrs = this[0].attributes;
+ if (attrs['placeholder']) {
+ result.placeholder = attrs['placeholder'].value;
+ }
+ return result;
+ },
+
+ initialize: function ($dropdown) {
+ var $item,
+ data = $dropdown.data(),
+ $wrapper = $dropdown.parent('div[role="wrapper"]'),
+ $display = $(' '),
+ $expander = $('' + data.icons.dropdown + ' ').addClass(data.style.expander),
+ $presenter = $(' ').addClass(data.style.presenter),
+ $list = $('').attr('guid', $dropdown.attr('data-guid'));
+
+ if ($wrapper.length === 0) {
+ $wrapper = $('
').addClass(data.style.wrapper); // The css class needs to be added before the wrapping, otherwise doesn't work.
+ $dropdown.wrap($wrapper);
+ } else {
+ $wrapper.addClass(data.style.wrapper);
+ }
+
+ if (data.fontSize) {
+ $presenter.css('font-size', data.fontSize);
+ }
+
+ $presenter.on('click', function (e) {
+ if ($list.is(':visible')) {
+ bt.dropdown.methods.close($dropdown, $list);
+ } else {
+ bt.dropdown.methods.open($dropdown, $list);
+ }
+ });
+ $presenter.on('blur', function (e) {
+ setTimeout(function () {
+ bt.dropdown.methods.close($dropdown, $list);
+ }, 500);
+ });
+ $presenter.append($display).append($expander);
+
+ $dropdown.hide();
+ $dropdown.after($presenter);
+ $('body').append($list);
+ $list.hide();
+
+ $dropdown.reload();
+ },
+
+ setListPosition: function (presenter, list, data) {
+ var top, listHeight, presenterHeight, newHeight, listElRect,
+ mainElRect = presenter.getBoundingClientRect(),
+ scrollY = window.scrollY || window.pageYOffset || 0,
+ scrollX = window.scrollX || window.pageXOffset || 0;
+
+ // Reset list size
+ list.style.overflow = '';
+ list.style.overflowX = '';
+ list.style.height = '';
+
+ bt.core.setChildPosition(presenter, list);
+
+ listHeight = bt.core.height(list, true);
+ listElRect = list.getBoundingClientRect();
+ presenterHeight = bt.core.height(presenter, true);
+ if (data.maxHeight === 'auto') {
+ if (mainElRect.top < listElRect.top) { // The list is located below the main element
+ if (mainElRect.top + listHeight + presenterHeight > window.innerHeight) {
+ newHeight = window.innerHeight - mainElRect.top - presenterHeight - 3;
+ }
+ } else { // The list is located above the main element
+ if (mainElRect.top - listHeight - 3 > 0) {
+ list.style.top = Math.round(mainElRect.top + scrollY - listHeight - 3) + 'px';
+ } else {
+ list.style.top = scrollY + 'px';
+ newHeight = mainElRect.top - 3;
+ }
+ }
+ } else if (!isNaN(data.maxHeight) && data.maxHeight < listHeight) {
+ newHeight = data.maxHeight;
+ }
+
+ if (newHeight) {
+ list.style.overflow = 'scroll';
+ list.style.overflowX = 'hidden';
+ list.style.height = newHeight + 'px';
+ }
+ },
+
+ useHtmlDataSource: function ($dropdown, data) {
+ var dataSource = [], i, record,
+ $options = $dropdown.find('option');
+ for (i = 0; i < $options.length; i++) {
+ record = {};
+ record[data.valueField] = $options[i].value;
+ record[data.textField] = $options[i].innerHTML;
+ record[data.selectedField] = $dropdown[0].value === $options[i].value;
+ dataSource.push(record);
+ }
+ data.dataSource = dataSource;
+ },
+
+ filter: function ($dropdown) {
+ var i, record, data = $dropdown.data();
+ if (!data.dataSource)
+ {
+ data.dataSource = [];
+ } else if (typeof data.dataSource[0] === 'string') {
+ for (i = 0; i < data.dataSource.length; i++) {
+ record = {};
+ record[data.valueField] = data.dataSource[i];
+ record[data.textField] = data.dataSource[i];
+ data.dataSource[i] = record;
+ }
+ }
+ return data.dataSource;
+ },
+
+ render: function ($dropdown, response) {
+ var selections = [],
+ data = $dropdown.data(),
+ $parent = $dropdown.parent(),
+ $list = $('body').children('[role="list"][guid="' + $dropdown.attr('data-guid') + '"]'),
+ $presenter = $parent.children('[role="presenter"]'),
+ $expander = $presenter.children('[role="expander"]'),
+ $display = $presenter.children('[role="display"]');
+
+ $dropdown.data('records', response);
+ $dropdown.empty();
+ $list.empty();
+
+ if (response && response.length) {
+ $.each(response, function () {
+ var value = this[data.valueField],
+ text = this[data.textField],
+ selected = this[data.selectedField] && this[data.selectedField].toString().toLowerCase() === 'true',
+ $item, i;
+
+ $item = $('' + text + '
');
+ $item.addClass(data.style.item);
+ $item.on('click', function (e) {
+ bt.dropdown.methods.select($dropdown, value);
+ });
+ $list.append($item);
+
+ $dropdown.append('' + text + ' ');
+
+ if (selected) {
+ selections.push(value);
+ }
+ });
+ if (selections.length === 0) {
+ $dropdown.prepend(' ');
+ if (data.placeholder) {
+ $display[0].innerHTML = '' + data.placeholder + ' ';
+ }
+ } else {
+ for (i = 0; i < selections.length; i++) {
+ bt.dropdown.methods.select($dropdown, selections[i]);
+ }
+ }
+ }
+
+ if (data.width) {
+ $parent.css('width', data.width);
+ $presenter.css('width', data.width);
+ }
+
+ if (data.fontSize) {
+ $list.children('li').css('font-size', data.fontSize);
+ }
+
+ bt.dropdown.events.dataBound($dropdown);
+
+ return $dropdown;
+ },
+
+ open: function ($dropdown, $list) {
+ var data = $dropdown.data(),
+ $expander = $dropdown.parent().find('[role="expander"]'),
+ $presenter = $dropdown.parent().find('[role="presenter"]');
+ $list.css('width', bt.core.width($presenter[0]));
+ $list.show();
+ bt.dropdown.methods.setListPosition($presenter[0], $list[0], data);
+ $expander.html(data.icons.dropup);
+ },
+
+ close: function ($dropdown, $list) {
+ var data = $dropdown.data(),
+ $expander = $dropdown.parent().find('[role="expander"]');
+ $expander.html(data.icons.dropdown);
+ $list.hide();
+ },
+
+ select: function ($dropdown, value) {
+ var data = $dropdown.data(),
+ $list = $('body').children('[role="list"][guid="' + $dropdown.attr('data-guid') + '"]'),
+ $item = $list.children('li[value="' + value + '"]'),
+ record = bt.dropdown.methods.getRecordByValue($dropdown, value);
+ if (record) {
+ $list.children('li').removeClass(data.style.active);
+ $item.addClass(data.style.active);
+ $dropdown[0].value = value;
+ $dropdown.next('[role="presenter"]').find('[role="display"]').html(record[data.textField]);
+ bt.dropdown.events.change($dropdown);
+ }
+ bt.dropdown.methods.close($dropdown, $list);
+ return $dropdown;
+ },
+
+ getRecordByValue: function ($dropdown, value) {
+ var data = $dropdown.data(),
+ i, result = undefined;
+
+ for (i = 0; i < data.records.length; i++) {
+ if (data.records[i][data.valueField] === value) {
+ result = data.records[i];
+ break;
+ }
+ }
+
+ return result;
+ },
+
+ value: function ($dropdown, value) {
+ if (typeof (value) === "undefined") {
+ return $dropdown.val();
+ } else {
+ bt.dropdown.methods.select($dropdown, value);
+ return $dropdown;
+ }
+ },
+
+ destroy: function ($dropdown) {
+ var data = $dropdown.data(),
+ $parent = $dropdown.parent('div[role="wrapper"]');
+ if (data) {
+ $dropdown.xhr && $dropdown.xhr.abort();
+ $dropdown.off();
+ $dropdown.removeData();
+ $dropdown.removeAttr('data-type').removeAttr('data-guid').removeAttr('data-dropdown');
+ $dropdown.removeClass();
+ if ($parent.length > 0) {
+ $parent.children('[role="presenter"]').remove();
+ $parent.children('[role="list"]').remove();
+ $dropdown.unwrap();
+ }
+ $dropdown.show();
+ }
+ return $tree;
+ }
+};
+
+bt.dropdown.events = {
+ /**
+ * Triggered when the dropdown value is changed.
+ *
+ * @event change
+ * @param {object} e - event data
+ * @example sample
+ *
+ * One
+ * Two
+ * Three
+ *
+ *
+ */
+ change: function ($dropdown) {
+ return $dropdown.triggerHandler('change');
+ },
+
+ /**
+ * Event fires after the loading of the data in the dropdown.
+ * @event dataBound
+ * @param {object} e - event data
+ * @example sample
+ *
+ * One
+ * Two
+ * Three
+ *
+ *
+ */
+ dataBound: function ($dropdown) {
+ return $dropdown.triggerHandler('dataBound');
+ }
+};
+
+bt.dropdown.widget = function ($element, jsConfig) {
+ var self = this,
+ methods = bt.dropdown.methods;
+
+ /** Gets or sets the value of the DropDown.
+ * @method
+ * @param {string} value - The value that needs to be selected.
+ * @return string
+ * @example Get
+ * Get Value
+ *
+ *
+ * One
+ * Two
+ * Three
+ *
+ *
+ * @example Set
+ * Set Value
+ *
+ *
+ * One
+ * Two
+ * Three
+ *
+ *
+ */
+ self.value = function (value) {
+ return methods.value(this, value);
+ };
+
+ self.enable = function () {
+ return methods.enable(this);
+ };
+
+ self.disable = function () {
+ return methods.disable(this);
+ };
+
+ /** Remove dropdown functionality from the element.
+ * @method
+ * @return jquery element
+ * @example sample
+ * Destroy
+ *
+ * One
+ * Two
+ * Three
+ *
+ *
+ */
+ self.destroy = function () {
+ return methods.destroy(this);
+ };
+
+ $.extend($element, self);
+ if ('true' !== $element.attr('data-dropdown')) {
+ methods.init.call($element, jsConfig);
+ }
+
+ return $element;
+};
+
+bt.dropdown.widget.prototype = new bt.widget();
+bt.dropdown.widget.constructor = bt.dropdown.widget;
+
+bt.dropdown.widget.prototype.getHTMLConfig = bt.dropdown.methods.getHTMLConfig;
+
+(function ($) {
+ $.fn.dropdown = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.dropdown.widget(this, method);
+ } else {
+ $widget = new bt.dropdown.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 bt */
+/**
+ * @widget DatePicker
+ * @plugin Base
+ */
+bt.datepicker = {
+ plugins: {}
+};
+
+bt.datepicker.config = {
+ base: {
+ /** Whether to display dates in other months at the start or end of the current month.
+ * @additionalinfo Set to true by default for Bootstrap.
+ * @type Boolean
+ * @default false
+ * @example True
+ *
+ *
+ * @example False
+ *
+ *
+ */
+ showOtherMonths: false,
+
+ /** Whether days in other months shown before or after the current month are selectable.
+ * This only applies if the showOtherMonths option is set to true.
+ * @type Boolean
+ * @default true
+ * @example True
+ *
+ *
+ * @example False
+ *
+ *
+ */
+ selectOtherMonths: true,
+
+ /** The width of the datepicker.
+ * @type number
+ * @default undefined
+ * @example JS.Config
+ *
+ *
+ * @example HTML.Config
+ *
+ *
+ */
+ width: undefined,
+
+ /** The minimum selectable date. When not set, there is no minimum.
+ * @additionalinfo If the minDate is set by string, then the date in the string needs to follow the format specified by the 'format' configuration option.
+ * @type Date|String|Function
+ * @default undefined
+ * @example Today
+ *
+ *
+ * @example Yesterday
+ *
+ *
+ * @example Bootstrap
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ minDate: undefined,
+
+ /** The maximum selectable date. When not set, there is no maximum
+ * @type Date|String|Function
+ * @default undefined
+ * @example Today
+ *
+ *
+ * @example Tomorrow
+ *
+ *
+ */
+ maxDate: undefined,
+
+ /** Specifies the format, which is used to format the value of the DatePicker displayed in the input.
+ * @additionalinfo d - Day of the month as digits; no leading zero for single-digit days.
+ * dd - Day of the month as digits; leading zero for single-digit days.
+ * ddd - Day of the week as a three-letter abbreviation.
+ * dddd - Day of the week as its full name.
+ * m - Month as digits; no leading zero for single-digit months.
+ * mm - Month as digits; leading zero for single-digit months.
+ * mmm - Month as a three-letter abbreviation.
+ * mmmm - Month as its full name.
+ * yy - Year as last two digits; leading zero for years less than 10.
+ * yyyy - Year represented by four digits.
+ * @type String
+ * @default 'mm/dd/yyyy'
+ * @example Sample
+ *
+ *
+ * @example Short.Month.Format
+ *
+ *
+ * @example Long.Month.Format
+ *
+ *
+ */
+ format: 'mm/dd/yyyy',
+
+ /** The name of the UI library that is going to be in use.
+ * @additionalinfo The css file for bootstrap should be manually included if you use bootstrap.
+ * @type (materialdesign|bootstrap|bootstrap4)
+ * @default materialdesign
+ * @example MaterialDesign
+ *
+ *
+ * @example Bootstrap.3
+ *
+ *
+ * @example Bootstrap.4.Material.Icons
+ *
+ *
+ * @example Bootstrap.4.FontAwesome
+ *
+ *
+ */
+ uiLibrary: 'materialdesign',
+
+ /** 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 'materialicons'
+ * @example Bootstrap.Font.Awesome
+ *
+ *
+ * @example Bootstrap.4.Font.Awesome
+ *
+ *
+ */
+ iconsLibrary: 'materialicons',
+
+ /** The initial datepicker value.
+ * @type String
+ * @default undefined
+ * @example Javascript
+ *
+ *
+ * @example HTML
+ *
+ *
+ */
+ value: undefined,
+
+ /** Day of the week start. 0 (Sunday) to 6 (Saturday)
+ * @type Number
+ * @default 0
+ * @example Monday
+ *
+ *
+ * @example Saturday
+ *
+ *
+ */
+ weekStartDay: 0,
+
+ /** An array or function that will be used to determine which dates to be disabled for selection by the widget.
+ * @type Array|Function
+ * @default undefined
+ * @example Array
+ *
+ *
+ * @example Function
+ *
+ *
+ */
+ disableDates: undefined,
+
+ /** An array that will be used to determine which days of week to be disabled for selection by the widget.
+ * The array needs to contains only numbers where 0 is Sunday, 1 is Monday and etc.
+ * @type Array
+ * @default undefined
+ * @example Saturday.Sunday
+ *
+ *
+ */
+ disableDaysOfWeek: undefined,
+
+ /** Whether to display week number in year on the left side of the calendar.
+ * @type Boolean
+ * @default false
+ * @example Material.Design
+ *
+ *
+ * @example Bootstrap
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ calendarWeeks: false,
+
+ /** Whether to enable keyboard navigation.
+ * @type Boolean
+ * @default true
+ * @example Material.Design
+ *
+ *
+ * @example Material.Design.Modal
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ keyboardNavigation: true,
+
+ /** The language that needs to be in use.
+ * @type string
+ * @default 'en-us'
+ * @example German
+ *
+ *
+ * @example Bulgarian
+ *
+ *
+ * @example French
+ *
+ *
+ * @example Brazil
+ *
+ *
+ * @example Russian
+ *
+ *
+ * @example Spanish
+ *
+ *
+ * @example Italian
+ *
+ *
+ */
+ locale: 'en-us',
+
+ icons: {
+ /** datepicker icon definition.
+ * @alias icons.rightIcon
+ * @type String
+ * @default ' '
+ * @example Custom.Material.Icon
+ *
+ *
+ * @example Custom.Glyphicon.Icon
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ rightIcon: 'event ',
+
+ previousMonth: ' ',
+ nextMonth: ' '
+ },
+
+ fontSize: undefined,
+
+ /** The size of the datepicker input.
+ * @type 'small'|'default'|'large'
+ * @default 'default'
+ * @example Bootstrap.4
+ * Small Size:
+ * Default Size:
+ * Large Size:
+ *
+ * @example Bootstrap.4.Font.Awesome
+ * Small Size:
+ * Default Size:
+ * Large Size:
+ *
+ * @example Bootstrap.3
+ * Small Size:
+ * Default Size:
+ * Large Size:
+ *
+ * @example Material.Design
+ * Small Size:
+ * Default Size:
+ * Large Size:
+ *
+ */
+ size: 'default',
+
+ /** If set to true, the datepicker will have modal behavior.
+ * @type Boolean
+ * @default false
+ * @example Material.Design
+ *
+ *
+ * @example Bootstrap
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ modal: false,
+
+ /** If set to true, add header to the datepicker.
+ * @type Boolean
+ * @default false
+ * @example True
+ *
+ *
+ * @example False
+ *
+ *
+ */
+ header: false,
+
+ /** If set to true, add footer with ok and cancel buttons to the datepicker.
+ * @type Boolean
+ * @default false
+ * @example True
+ *
+ *
+ * @example False
+ *
+ *
+ */
+ footer: false,
+
+ style: {
+ modal: 'bt-modal',
+ wrapper: 'bt-datepicker bt-datepicker-md bt-unselectable',
+ input: 'bt-textbox-md',
+ calendar: 'bt-picker bt-picker-md datepicker bt-unselectable',
+ footer: '',
+ button: 'bt-button-md'
+ }
+ },
+
+ bootstrap: {
+ style: {
+ wrapper: 'bt-datepicker bt-datepicker-bootstrap bt-unselectable input-group',
+ input: 'form-control',
+ calendar: 'bt-picker bt-picker-bootstrap datepicker bt-unselectable',
+ footer: 'modal-footer',
+ button: 'btn btn-default'
+ },
+ iconsLibrary: 'glyphicons',
+ showOtherMonths: true
+ },
+
+ bootstrap4: {
+ style: {
+ wrapper: 'bt-datepicker bt-datepicker-bootstrap bt-unselectable input-group',
+ input: 'form-control',
+ calendar: 'bt-picker bt-picker-bootstrap datepicker bt-unselectable',
+ footer: 'modal-footer',
+ button: 'btn btn-default'
+ },
+ showOtherMonths: true
+ },
+
+ fontawesome: {
+ icons: {
+ rightIcon: ' ',
+ previousMonth: ' ',
+ nextMonth: ' '
+ }
+ },
+
+ glyphicons: {
+ icons: {
+ rightIcon: ' ',
+ previousMonth: ' ',
+ nextMonth: ' '
+ }
+ }
+};
+
+bt.datepicker.methods = {
+ init: function (jsConfig) {
+ bt.widget.prototype.init.call(this, jsConfig, 'datepicker');
+ this.attr('data-datepicker', 'true');
+ bt.datepicker.methods.initialize(this, this.data());
+ return this;
+ },
+
+ initialize: function ($datepicker, data) {
+ var $calendar, $rightIcon,
+ $wrapper = $datepicker.parent('div[role="wrapper"]');
+
+ if (data.uiLibrary === 'bootstrap') {
+ $rightIcon = $('' + data.icons.rightIcon + ' ');
+ } else if (data.uiLibrary === 'bootstrap4') {
+ $rightIcon = $('' + data.icons.rightIcon + ' ');
+ } else {
+ $rightIcon = $(data.icons.rightIcon);
+ }
+
+ $rightIcon.attr('role', 'right-icon');
+ if ($wrapper.length === 0) {
+ $wrapper = $('
').addClass(data.style.wrapper); // The css class needs to be added before the wrapping, otherwise doesn't work.
+ $datepicker.wrap($wrapper);
+ } else {
+ $wrapper.addClass(data.style.wrapper);
+ }
+ $wrapper = $datepicker.parent('div[role="wrapper"]');
+
+ data.width && $wrapper.css('width', data.width);
+
+ $datepicker.val(data.value).addClass(data.style.input).attr('role', 'input');
+
+ data.fontSize && $datepicker.css('font-size', data.fontSize);
+
+ if (data.uiLibrary === 'bootstrap' || data.uiLibrary === 'bootstrap4') {
+ if (data.size === 'small') {
+ $wrapper.addClass('input-group-sm');
+ $datepicker.addClass('form-control-sm');
+ } else if (data.size === 'large') {
+ $wrapper.addClass('input-group-lg');
+ $datepicker.addClass('form-control-lg');
+ }
+ } else {
+ if (data.size === 'small') {
+ $wrapper.addClass('small');
+ } else if (data.size === 'large') {
+ $wrapper.addClass('large');
+ }
+ }
+
+ $rightIcon.on('click', function (e) {
+ var $calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');
+ if ($calendar.is(':visible')) {
+ bt.datepicker.methods.close($datepicker);
+ } else {
+ bt.datepicker.methods.open($datepicker, data);
+ }
+ });
+ $wrapper.append($rightIcon);
+
+ $calendar = bt.datepicker.methods.createCalendar($datepicker, data);
+
+ if (data.footer !== true) {
+ $datepicker.on('blur', function () {
+ $datepicker.timeout = setTimeout(function () {
+ bt.datepicker.methods.close($datepicker);
+ }, 500);
+ });
+ $calendar.mousedown(function () {
+ clearTimeout($datepicker.timeout);
+ $datepicker.focus();
+ return false;
+ });
+ $calendar.on('click', function () {
+ clearTimeout($datepicker.timeout);
+ $datepicker.focus();
+ });
+ }
+
+ if (data.keyboardNavigation) {
+ $(document).on('keydown', bt.datepicker.methods.createKeyDownHandler($datepicker, $calendar, data));
+ }
+ },
+
+ createCalendar: function ($datepicker, data) {
+ var date, $body, $footer, $btnCancel, $btnOk,
+ $calendar = $('
').addClass(data.style.calendar).attr('guid', $datepicker.attr('data-guid'));
+
+ data.fontSize && $calendar.css('font-size', data.fontSize);
+
+ date = bt.core.parseDate(data.value, data.format, data.locale);
+ if (!date || isNaN(date.getTime())) {
+ date = new Date();
+ } else {
+ $datepicker.attr('day', date.getFullYear() + '-' + date.getMonth() + '-' + date.getDate());
+ }
+
+ $calendar.attr('month', date.getMonth());
+ $calendar.attr('year', date.getFullYear());
+
+ bt.datepicker.methods.renderHeader($datepicker, $calendar, data, date);
+
+ $body = $('
');
+ $calendar.append($body);
+
+ if (data.footer) {
+ $footer = $('');
+
+ $btnCancel = $('' + bt.core.messages[data.locale].cancel + ' ');
+ $btnCancel.on('click', function () { $datepicker.close(); });
+ $footer.append($btnCancel);
+
+ $btnOk = $('' + bt.core.messages[data.locale].ok + ' ');
+ $btnOk.on('click', function () {
+ var date, dayArr, dayStr = $calendar.attr('selectedDay');
+ if (dayStr) {
+ dayArr = dayStr.split('-');
+ date = new Date(dayArr[0], dayArr[1], dayArr[2], $calendar.attr('hour') || 0, $calendar.attr('minute') || 0);
+ bt.datepicker.methods.change($datepicker, $calendar, data, date);
+ } else {
+ $datepicker.close();
+ }
+ });
+ $footer.append($btnOk);
+
+ $calendar.append($footer);
+ }
+
+ $calendar.hide();
+ $('body').append($calendar);
+
+ if (data.modal) {
+ $calendar.wrapAll('
');
+ bt.core.center($calendar);
+ }
+
+ return $calendar;
+ },
+
+ renderHeader: function ($datepicker, $calendar, data, date) {
+ var $header, $date, $year;
+
+ if (data.header) {
+ $header = $('
');
+ $year = $('
').on('click', function () {
+ bt.datepicker.methods.renderDecade($datepicker, $calendar, data);
+ $year.addClass('selected');
+ $date.removeClass('selected');
+ });
+ $year.html(bt.core.formatDate(date, 'yyyy', data.locale));
+ $header.append($year);
+ $date = $('
').on('click', function () {
+ bt.datepicker.methods.renderMonth($datepicker, $calendar, data);
+ $date.addClass('selected');
+ $year.removeClass('selected');
+ });
+ $date.html(bt.core.formatDate(date, 'ddd, mmm dd', data.locale));
+ $header.append($date);
+ $calendar.append($header);
+ }
+ },
+
+ updateHeader: function ($calendar, data, date) {
+ $calendar.find('[role="header"] [role="year"]').removeClass('selected').html(bt.core.formatDate(date, 'yyyy', data.locale));
+ $calendar.find('[role="header"] [role="date"]').addClass('selected').html(bt.core.formatDate(date, 'ddd, mmm dd', data.locale));
+ $calendar.find('[role="header"] [role="hour"]').removeClass('selected').html(bt.core.formatDate(date, 'HH', data.locale));
+ $calendar.find('[role="header"] [role="minute"]').removeClass('selected').html(bt.core.formatDate(date, 'MM', data.locale));
+ },
+
+ createNavigation: function ($datepicker, $body, $table, data) {
+ var $row, $navigator, $thead = $(' ');
+
+ $navigator = $('
');
+ $navigator.append($('' + data.icons.previousMonth + '
').on('click', bt.datepicker.methods.prev($datepicker, data)));
+ $navigator.append($('
').on('click', bt.datepicker.methods.changePeriod($datepicker, data)));
+ $navigator.append($('' + data.icons.nextMonth + '
').on('click', bt.datepicker.methods.next($datepicker, data)));
+ $body.append($navigator);
+
+ $row = $(' ');
+ if (data.calendarWeeks) {
+ $row.append('
');
+ }
+ for (i = data.weekStartDay; i < bt.core.messages[data.locale].weekDaysMin.length; i++) {
+ $row.append('' + bt.core.messages[data.locale].weekDaysMin[i] + '
');
+ }
+ for (i = 0; i < data.weekStartDay; i++) {
+ $row.append('' + bt.core.messages[data.locale].weekDaysMin[i] + '
');
+ }
+ $thead.append($row);
+
+ $table.append($thead);
+ },
+
+ renderMonth: function ($datepicker, $calendar, data) {
+ var weekDay, selectedDay, day, month, year, daysInMonth, total, firstDayPosition, i, now, prevMonth, nextMonth, $cell, $day, date,
+ $body = $calendar.children('[role="body"]'),
+ $table = $(''),
+ $tbody = $(' ');
+
+ $body.off().empty();
+ bt.datepicker.methods.createNavigation($datepicker, $body, $table, data);
+
+ month = parseInt($calendar.attr('month'), 10);
+ year = parseInt($calendar.attr('year'), 10);
+
+ $calendar.attr('type', 'month');
+ $calendar.find('div[role="period"]').text(bt.core.messages[data.locale].monthNames[month] + ' ' + year);
+
+ daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
+ if (year % 4 == 0 && year != 1900) {
+ daysInMonth[1] = 29;
+ }
+ total = daysInMonth[month];
+
+ firstDayPosition = (new Date(year, month, 1).getDay() + 7 - data.weekStartDay) % 7;
+
+ weekDay = 0;
+ $row = $(' ');
+ prevMonth = bt.datepicker.methods.getPrevMonth(month, year);
+ for (i = 1; i <= firstDayPosition; i++) {
+ day = (daysInMonth[prevMonth.month] - firstDayPosition + i);
+ date = new Date(prevMonth.year, prevMonth.month, day);
+ if (data.calendarWeeks && i === 1) {
+ $row.append('' + bt.datepicker.methods.getWeekNumber(date) + '
');
+ }
+ $cell = $(' ');
+ if (data.showOtherMonths) {
+ $day = $('' + day + '
');
+ $cell.append($day);
+ if (data.selectOtherMonths && bt.datepicker.methods.isSelectable(data, date)) {
+ $cell.addClass('bt-cursor-pointer').attr('day', day).attr('month', prevMonth.month).attr('year', prevMonth.year);
+ $day.on('click', bt.datepicker.methods.dayClickHandler($datepicker, $calendar, data, date));
+ $day.on('mousedown', function (e) { e.stopPropagation() });
+ } else {
+ $cell.addClass('disabled');
+ }
+ }
+ $row.append($cell);
+ weekDay++;
+ }
+ if (i > 1) {
+ $tbody.append($row);
+ }
+
+ now = new Date();
+ for (i = 1; i <= total; i++) {
+ date = new Date(year, month, i);
+ if (weekDay == 0) {
+ $row = $('');
+ if (data.calendarWeeks) {
+ $row.append('' + bt.datepicker.methods.getWeekNumber(date) + '
');
+ }
+ }
+ $cell = $(' ');
+ if (year === now.getFullYear() && month === now.getMonth() && i === now.getDate()) {
+ $cell.addClass('today');
+ } else {
+ $cell.addClass('current-month');
+ }
+ $day = $('' + i + '
');
+ if (bt.datepicker.methods.isSelectable(data, date)) {
+ $cell.addClass('bt-cursor-pointer');
+ $day.on('click', bt.datepicker.methods.dayClickHandler($datepicker, $calendar, data, date));
+ $day.on('mousedown', function (e) { e.stopPropagation() });
+ } else {
+ $cell.addClass('disabled');
+ }
+ $cell.append($day);
+ $row.append($cell);
+ weekDay++;
+ if (weekDay == 7) {
+ $tbody.append($row);
+ weekDay = 0;
+ }
+ }
+
+ nextMonth = bt.datepicker.methods.getNextMonth(month, year);
+ for (i = 1; weekDay != 0; i++) {
+ date = new Date(nextMonth.year, nextMonth.month, i);
+ $cell = $(' ');
+ if (data.showOtherMonths) {
+ $day = $('' + i + '
');
+ if (data.selectOtherMonths && bt.datepicker.methods.isSelectable(data, date)) {
+ $cell.addClass('bt-cursor-pointer').attr('day', i).attr('month', nextMonth.month).attr('year', nextMonth.year);
+ $day.on('click', bt.datepicker.methods.dayClickHandler($datepicker, $calendar, data, date));
+ $day.on('mousedown', function (e) { e.stopPropagation() });
+ } else {
+ $cell.addClass('disabled');
+ }
+ $cell.append($day);
+ }
+ $row.append($cell);
+ weekDay++;
+ if (weekDay == 7) {
+ $tbody.append($row);
+ weekDay = 0;
+ }
+ }
+
+ $table.append($tbody);
+ $body.append($table);
+
+ if ($calendar.attr('selectedDay')) {
+ selectedDay = $calendar.attr('selectedDay').split('-');
+ date = new Date(selectedDay[0], selectedDay[1], selectedDay[2], $calendar.attr('hour') || 0, $calendar.attr('minute') || 0);
+ $calendar.find('tbody td[day="' + selectedDay[2] + '"][month="' + selectedDay[1] + '"]').addClass('selected');
+ bt.datepicker.methods.updateHeader($calendar, data, date);
+ }
+ },
+
+ renderYear: function ($datepicker, $calendar, data) {
+ var year, i, m, $month,
+ $table = $calendar.find('>[role="body"]>table'),
+ $tbody = $table.children('tbody');
+
+ $table.children('thead').hide();
+
+ year = parseInt($calendar.attr('year'), 10);
+
+ $calendar.attr('type', 'year');
+ $calendar.find('div[role="period"]').text(year);
+
+ $tbody.empty();
+
+ for (i = 0; i < 3; i++) {
+ $row = $(' ');
+ for (m = (i * 4); m <= (i * 4) + 3; m++) {
+ $month = $('' + bt.core.messages[data.locale].monthShortNames[m] + '
');
+ $month.on('click', bt.datepicker.methods.selectMonth($datepicker, $calendar, data, m));
+ $cell = $(' ').append($month);
+ $row.append($cell);
+ }
+ $tbody.append($row);
+ }
+ },
+
+ renderDecade: function ($datepicker, $calendar, data) {
+ var year, decade, i, y, $year,
+ $table = $calendar.find('>[role="body"]>table'),
+ $tbody = $table.children('tbody');
+
+ $table.children('thead').hide();
+
+ year = parseInt($calendar.attr('year'), 10);
+ decade = year - (year % 10);
+
+ $calendar.attr('type', 'decade');
+ $calendar.find('div[role="period"]').text(decade + ' - ' + (decade + 9));
+
+ $tbody.empty();
+
+ for (i = decade - 1; i <= decade + 10 ; i += 4) {
+ $row = $(' ');
+ for (y = i; y <= i + 3; y++) {
+ $year = $('' + y + '
');
+ $year.on('click', bt.datepicker.methods.selectYear($datepicker, $calendar, data, y));
+ $cell = $(' ').append($year);
+ $row.append($cell);
+ }
+ $tbody.append($row);
+ }
+ },
+
+ renderCentury: function ($datepicker, $calendar, data) {
+ var year, century, i, d, $decade,
+ $table = $calendar.find('>[role="body"]>table'),
+ $tbody = $table.children('tbody');
+
+ $table.children('thead').hide();
+
+ year = parseInt($calendar.attr('year'), 10);
+ century = year - (year % 100);
+
+ $calendar.attr('type', 'century');
+ $calendar.find('div[role="period"]').text(century + ' - ' + (century + 99));
+
+ $tbody.empty();
+
+ for (i = (century - 10); i < century + 100; i += 40) {
+ $row = $(' ');
+ for (d = i; d <= i + 30; d += 10) {
+ $decade = $('' + d + '
');
+ $decade.on('click', bt.datepicker.methods.selectDecade($datepicker, $calendar, data, d));
+ $cell = $(' ').append($decade);
+ $row.append($cell);
+ }
+ $tbody.append($row);
+ }
+ },
+
+ getWeekNumber: function (date) {
+ var d = new Date(date.valueOf());
+ d.setDate(d.getDate() + 6);
+ d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
+ var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
+ var weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
+ return weekNo;
+ },
+
+ getMinDate: function (data) {
+ var minDate;
+ if (data.minDate) {
+ if (typeof (data.minDate) === 'string') {
+ minDate = bt.core.parseDate(data.minDate, data.format, data.locale);
+ } else if (typeof (data.minDate) === 'function') {
+ minDate = data.minDate();
+ if (typeof minDate === 'string') {
+ minDate = bt.core.parseDate(minDate, data.format, data.locale);
+ }
+ } else if (typeof data.minDate.getMonth === 'function') {
+ minDate = data.minDate;
+ }
+ }
+ return minDate;
+ },
+
+ getMaxDate: function (data) {
+ var maxDate;
+ if (data.maxDate) {
+ if (typeof data.maxDate === 'string') {
+ maxDate = bt.core.parseDate(data.maxDate, data.format, data.locale);
+ } else if (typeof data.maxDate === 'function') {
+ maxDate = data.maxDate();
+ if (typeof maxDate === 'string') {
+ maxDate = bt.core.parseDate(maxDate, data.format, data.locale);
+ }
+ } else if (typeof data.maxDate.getMonth === 'function') {
+ maxDate = data.maxDate;
+ }
+ }
+ return maxDate;
+ },
+
+ isSelectable: function (data, date) {
+ var result = true,
+ minDate = bt.datepicker.methods.getMinDate(data),
+ maxDate = bt.datepicker.methods.getMaxDate(data),
+ i;
+
+ if (minDate && date < minDate) {
+ result = false;
+ } else if (maxDate && date > maxDate) {
+ result = false;
+ }
+
+ if (result) {
+ if (data.disableDates) {
+ if ($.isArray(data.disableDates)) {
+ for (i = 0; i < data.disableDates.length; i++) {
+ if (data.disableDates[i] instanceof Date && data.disableDates[i].getTime() === date.getTime()) {
+ result = false;
+ } else if (typeof data.disableDates[i] === 'string' && bt.core.parseDate(data.disableDates[i], data.format, data.locale).getTime() === date.getTime()) {
+ result = false;
+ }
+ }
+ } else if (data.disableDates instanceof Function) {
+ result = data.disableDates(date);
+ }
+ }
+ if ($.isArray(data.disableDaysOfWeek) && data.disableDaysOfWeek.indexOf(date.getDay()) > -1) {
+ result = false;
+ }
+ }
+ return result;
+ },
+
+ getPrevMonth: function (month, year) {
+ date = new Date(year, month, 1);
+ date.setMonth(date.getMonth() - 1);
+ return { month: date.getMonth(), year: date.getFullYear() };
+ },
+
+ getNextMonth: function (month, year) {
+ date = new Date(year, month, 1);
+ date.setMonth(date.getMonth() + 1);
+ return { month: date.getMonth(), year: date.getFullYear() };
+ },
+
+ prev: function ($datepicker, data) {
+ return function () {
+ var date, month, year, decade, century,
+ $calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');
+
+ switch ($calendar.attr('type')) {
+ case 'month':
+ month = parseInt($calendar.attr('month'), 10);
+ year = parseInt($calendar.attr('year'), 10);
+ date = bt.datepicker.methods.getPrevMonth(month, year);
+ $calendar.attr('month', date.month);
+ $calendar.attr('year', date.year);
+ bt.datepicker.methods.renderMonth($datepicker, $calendar, data);
+ break;
+ case 'year':
+ year = parseInt($calendar.attr('year'), 10);
+ $calendar.attr('year', year - 1);
+ bt.datepicker.methods.renderYear($datepicker, $calendar, data);
+ break;
+ case 'decade':
+ year = parseInt($calendar.attr('year'), 10);
+ decade = year - (year % 10);
+ $calendar.attr('year', decade - 10);
+ bt.datepicker.methods.renderDecade($datepicker, $calendar, data);
+ break;
+ case 'century':
+ year = parseInt($calendar.attr('year'), 10);
+ century = year - (year % 100);
+ $calendar.attr('year', century - 100);
+ bt.datepicker.methods.renderCentury($datepicker, $calendar, data);
+ break;
+ }
+ }
+ },
+
+ next: function ($datepicker, data) {
+ return function () {
+ var date, month, year, decade, century,
+ $calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');
+
+ switch ($calendar.attr('type')) {
+ case 'month':
+ month = parseInt($calendar.attr('month'), 10);
+ year = parseInt($calendar.attr('year'), 10);
+ date = bt.datepicker.methods.getNextMonth(month, year);
+ $calendar.attr('month', date.month);
+ $calendar.attr('year', date.year);
+ bt.datepicker.methods.renderMonth($datepicker, $calendar, data);
+ break;
+ case 'year':
+ year = parseInt($calendar.attr('year'), 10);
+ $calendar.attr('year', year + 1);
+ bt.datepicker.methods.renderYear($datepicker, $calendar, data);
+ break;
+ case 'decade':
+ year = parseInt($calendar.attr('year'), 10);
+ decade = year - (year % 10);
+ $calendar.attr('year', decade + 10);
+ bt.datepicker.methods.renderDecade($datepicker, $calendar, data);
+ break;
+ case 'century':
+ year = parseInt($calendar.attr('year'), 10);
+ century = year - (year % 100);
+ $calendar.attr('year', century + 100);
+ bt.datepicker.methods.renderCentury($datepicker, $calendar, data);
+ break;
+ }
+ }
+ },
+
+ changePeriod: function ($datepicker, data) {
+ return function (e) {
+ var $calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');
+
+ switch ($calendar.attr('type')) {
+ case 'month':
+ bt.datepicker.methods.renderYear($datepicker, $calendar, data);
+ break;
+ case 'year':
+ bt.datepicker.methods.renderDecade($datepicker, $calendar, data);
+ break;
+ case 'decade':
+ bt.datepicker.methods.renderCentury($datepicker, $calendar, data);
+ break;
+ }
+ }
+ },
+
+ dayClickHandler: function ($datepicker, $calendar, data, date) {
+ return function (e) {
+ e && e.stopPropagation();
+ bt.datepicker.methods.selectDay($datepicker, $calendar, data, date);
+ if (data.footer !== true && data.autoClose !== false) {
+ bt.datepicker.methods.change($datepicker, $calendar, data, date);
+ }
+ return $datepicker;
+ };
+ },
+
+ change: function ($datepicker, $calendar, data, date) {
+ var day = date.getDate(),
+ month = date.getMonth(),
+ year = date.getFullYear(),
+ value = bt.core.formatDate(date, data.format, data.locale);
+ $calendar.attr('month', month);
+ $calendar.attr('year', year);
+ $datepicker.val(value);
+ bt.datepicker.events.change($datepicker);
+ if (window.getComputedStyle($calendar[0]).display !== 'none') {
+ bt.datepicker.methods.close($datepicker);
+ }
+ },
+
+ selectDay: function ($datepicker, $calendar, data, date) {
+ var day = date.getDate(),
+ month = date.getMonth(),
+ year = date.getFullYear();
+ $calendar.attr('selectedDay', year + '-' + month + '-' + day);
+ $calendar.find('tbody td').removeClass('selected');
+ $calendar.find('tbody td[day="' + day + '"][month="' + month + '"]').addClass('selected');
+ bt.datepicker.methods.updateHeader($calendar, data, date);
+ bt.datepicker.events.select($datepicker, 'day');
+ },
+
+ selectMonth: function ($datepicker, $calendar, data, month) {
+ return function (e) {
+ $calendar.attr('month', month);
+ bt.datepicker.methods.renderMonth($datepicker, $calendar, data);
+ bt.datepicker.events.select($datepicker, 'month');
+ };
+ },
+
+ selectYear: function ($datepicker, $calendar, data, year) {
+ return function (e) {
+ $calendar.attr('year', year);
+ bt.datepicker.methods.renderYear($datepicker, $calendar, data);
+ bt.datepicker.events.select($datepicker, 'year');
+ };
+ },
+
+ selectDecade: function ($datepicker, $calendar, data, year) {
+ return function (e) {
+ $calendar.attr('year', year);
+ bt.datepicker.methods.renderDecade($datepicker, $calendar, data);
+ bt.datepicker.events.select($datepicker, 'decade');
+ };
+ },
+
+ open: function ($datepicker, data) {
+ var $calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');
+
+ if ($datepicker.val()) {
+ $datepicker.value($datepicker.val());
+ }
+
+ switch ($calendar.attr('type')) {
+ case 'month':
+ bt.datepicker.methods.renderMonth($datepicker, $calendar, data);
+ break;
+ case 'year':
+ bt.datepicker.methods.renderYear($datepicker, $calendar, data);
+ break;
+ case 'decade':
+ bt.datepicker.methods.renderDecade($datepicker, $calendar, data);
+ break;
+ case 'century':
+ bt.datepicker.methods.renderCentury($datepicker, $calendar, data);
+ break;
+ }
+
+ $calendar.show();
+ $calendar.closest('div[role="modal"]').show();
+ if (data.modal) {
+ bt.core.center($calendar);
+ } else {
+ bt.core.setChildPosition($datepicker[0], $calendar[0]);
+ $datepicker.focus();
+ }
+ clearTimeout($datepicker.timeout);
+ bt.datepicker.events.open($datepicker);
+ },
+
+ close: function ($datepicker) {
+ var $calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');
+ $calendar.hide();
+ $calendar.closest('div[role="modal"]').hide();
+ bt.datepicker.events.close($datepicker);
+ },
+
+ createKeyDownHandler: function ($datepicker, $calendar, data) {
+ return function (e) {
+ var month, year, day, index, $new, $active, e = e || window.event;
+
+ if (window.getComputedStyle($calendar[0]).display !== 'none')
+ {
+ $active = bt.datepicker.methods.getActiveCell($calendar);
+ if (e.keyCode == '38') { // up
+ index = $active.index();
+ $new = $active.closest('tr').prev('tr').find('td:eq(' + index + ')');
+ if (!$new.is('[day]')) {
+ bt.datepicker.methods.prev($datepicker, data)();
+ $new = $calendar.find('tbody tr').last().find('td:eq(' + index + ')');
+ if ($new.is(':empty')) {
+ $new = $calendar.find('tbody tr').last().prev().find('td:eq(' + index + ')');
+ }
+ }
+ if ($new.is('[day]')) {
+ $new.addClass('focused');
+ $active.removeClass('focused');
+ }
+ } else if (e.keyCode == '40') { // down
+ index = $active.index();
+ $new = $active.closest('tr').next('tr').find('td:eq(' + index + ')');
+ if (!$new.is('[day]')) {
+ bt.datepicker.methods.next($datepicker, data)();
+ $new = $calendar.find('tbody tr').first().find('td:eq(' + index + ')');
+ if (!$new.is('[day]')) {
+ $new = $calendar.find('tbody tr:eq(1)').find('td:eq(' + index + ')');
+ }
+ }
+ if ($new.is('[day]')) {
+ $new.addClass('focused');
+ $active.removeClass('focused');
+ }
+ } else if (e.keyCode == '37') { // left
+ $new = $active.prev('td[day]:not(.disabled)');
+ if ($new.length === 0) {
+ $new = $active.closest('tr').prev('tr').find('td[day]').last();
+ }
+ if ($new.length === 0) {
+ bt.datepicker.methods.prev($datepicker, data)();
+ $new = $calendar.find('tbody tr').last().find('td[day]').last();
+ }
+ if ($new.length > 0) {
+ $new.addClass('focused');
+ $active.removeClass('focused');
+ }
+ } else if (e.keyCode == '39') { // right
+ $new = $active.next('[day]:not(.disabled)');
+ if ($new.length === 0) {
+ $new = $active.closest('tr').next('tr').find('td[day]').first();
+ }
+ if ($new.length === 0) {
+ bt.datepicker.methods.next($datepicker, data)();
+ $new = $calendar.find('tbody tr').first().find('td[day]').first();
+ }
+ if ($new.length > 0) {
+ $new.addClass('focused');
+ $active.removeClass('focused');
+ }
+ } else if (e.keyCode == '13') { // enter
+ day = parseInt($active.attr('day'), 10);
+ month = parseInt($active.attr('month'), 10);
+ year = parseInt($active.attr('year'), 10);
+ bt.datepicker.methods.dayClickHandler($datepicker, $calendar, data, new Date(year, month, day))();
+ } else if (e.keyCode == '27') { // esc
+ $datepicker.close();
+ }
+ }
+ }
+ },
+
+ getActiveCell: function ($calendar) {
+ var $cell = $calendar.find('td[day].focused');
+ if ($cell.length === 0) {
+ $cell = $calendar.find('td[day].selected');
+ if ($cell.length === 0) {
+ $cell = $calendar.find('td[day].today');
+ if ($cell.length === 0) {
+ $cell = $calendar.find('td[day]:not(.disabled)').first();
+ }
+ }
+ }
+ return $cell;
+ },
+
+ value: function ($datepicker, value) {
+ var $calendar, date, data = $datepicker.data();
+ if (typeof (value) === "undefined") {
+ return $datepicker.val();
+ } else {
+ date = bt.core.parseDate(value, data.format, data.locale);
+ if (date) {
+ $calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');
+ bt.datepicker.methods.dayClickHandler($datepicker, $calendar, data, date)();
+ } else {
+ $datepicker.val('');
+ }
+ return $datepicker;
+ }
+ },
+
+ destroy: function ($datepicker) {
+ var data = $datepicker.data(),
+ $parent = $datepicker.parent(),
+ $picker = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');
+ if (data) {
+ $datepicker.off();
+ if ($picker.parent('[role="modal"]').length > 0) {
+ $picker.unwrap();
+ }
+ $picker.remove();
+ $datepicker.removeData();
+ $datepicker.removeAttr('data-type').removeAttr('data-guid').removeAttr('data-datepicker');
+ $datepicker.removeClass();
+ $parent.children('[role="right-icon"]').remove();
+ $datepicker.unwrap();
+ }
+ return $datepicker;
+ }
+};
+
+bt.datepicker.events = {
+ /**
+ * Triggered when the datepicker value is changed.
+ *
+ * @event change
+ * @param {object} e - event data
+ * @example sample
+ *
+ *
+ */
+ change: function ($datepicker) {
+ return $datepicker.triggerHandler('change');
+ },
+
+ /**
+ * Triggered when new value is selected inside the picker.
+ *
+ * @event select
+ * @param {object} e - event data
+ * @param {string} type - The type of the selection. The options are day, month, year or decade.
+ * @example sample
+ *
+ * Click on the month name in order to select another month.
+ *
+ */
+ select: function ($datepicker, type) {
+ return $datepicker.triggerHandler('select', [type]);
+ },
+
+ /**
+ * Event fires when the calendar is opened.
+ * @event open
+ * @param {object} e - event data
+ * @example sample
+ *
+ *
+ */
+ open: function ($datepicker) {
+ return $datepicker.triggerHandler('open');
+ },
+
+ /**
+ * Event fires when the calendar is closed.
+ * @event close
+ * @param {object} e - event data
+ * @example sample
+ *
+ *
+ */
+ close: function ($datepicker) {
+ return $datepicker.triggerHandler('close');
+ }
+};
+
+bt.datepicker.widget = function ($element, jsConfig) {
+ var self = this,
+ methods = bt.datepicker.methods;
+
+ /** Gets or sets the value of the datepicker.
+ * @method
+ * @param {string} value - The value that needs to be selected.
+ * @return string | datepicker object
+ * @example Get
+ * Get Value
+ *
+ *
+ *
+ * @example Set
+ * Set Value
+ *
+ *
+ *
+ */
+ self.value = function (value) {
+ return methods.value(this, value);
+ };
+
+ /** Remove datepicker functionality from the element.
+ * @method
+ * @return jquery element
+ * @example sample
+ * Destroy
+ *
+ *
+ */
+ self.destroy = function () {
+ return methods.destroy(this);
+ };
+
+ /** Open the calendar.
+ * @method
+ * @return datepicker
+ * @example Open.Close
+ * Open
+ * Close
+ *
+ *
+ *
+ */
+ self.open = function () {
+ bt.datepicker.methods.open(this, this.data());
+ };
+
+ /** Close the calendar.
+ * @method
+ * @return datepicker
+ * @example Open.Close
+ * Open
+ * Close
+ *
+ *
+ *
+ */
+ self.close = function () {
+ bt.datepicker.methods.close(this);
+ };
+
+ $.extend($element, self);
+ if ('true' !== $element.attr('data-datepicker')) {
+ methods.init.call($element, jsConfig);
+ }
+
+ return $element;
+};
+
+bt.datepicker.widget.prototype = new bt.widget();
+bt.datepicker.widget.constructor = bt.datepicker.widget;
+
+(function ($) {
+ $.fn.datepicker = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.datepicker.widget(this, method);
+ } else {
+ $widget = new bt.datepicker.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 bt */
+/**
+ * @widget TimePicker
+ * @plugin Base
+ */
+bt.timepicker = {
+ plugins: {}
+};
+
+bt.timepicker.config = {
+ base: {
+
+ /** The width of the timepicker.
+ * @type number
+ * @default undefined
+ * @example JS.Config
+ *
+ *
+ * @example HTML.Config
+ *
+ *
+ */
+ width: undefined,
+
+ /** If set to true, the timepicker will have modal behavior.
+ * @type Boolean
+ * @default true
+ * @example True
+ *
+ *
+ * @example False
+ *
+ *
+ */
+ modal: true,
+
+ /** If set to true, add header to the timepicker.
+ * @type Boolean
+ * @default true
+ * @example True
+ *
+ *
+ * @example False
+ *
+ *
+ */
+ header: true,
+
+ /** If set to true, add footer with ok and cancel buttons to the timepicker.
+ * @type Boolean
+ * @default true
+ * @example True
+ *
+ *
+ * @example False
+ *
+ *
+ */
+ footer: true,
+
+ /** Specifies the format, which is used to format the value of the timepicker displayed in the input.
+ * @additionalinfo M - Minutes; no leading zero for single-digit minutes.
+ * MM - Minutes; leading zero for single-digit minutes.
+ * H - The hour, using a 24-hour clock from 0 to 23; no leading zero for single-digit hours.
+ * HH - The hour, using a 24-hour clock from 0 to 23; leading zero for single-digit hours.
+ * h - The hour, using a 12-hour clock from 1 to 12; no leading zero for single-digit hours.
+ * hh - The hour, using a 12-hour clock from 1 to 12; leading zero for single-digit hours
+ * tt - The AM/PM designator; lowercase.
+ * TT - The AM/PM designator; upercase.
+ * @type String
+ * @default 'MM:HH'
+ * @example Sample
+ *
+ *
+ */
+ format: 'HH:MM',
+
+ /** The name of the UI library that is going to be in use.
+ * @additionalinfo The css file for bootstrap should be manually included if you use bootstrap.
+ * @type (materialdesign|bootstrap|bootstrap4)
+ * @default materialdesign
+ * @example MaterialDesign
+ *
+ *
+ * @example Bootstrap.3
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ uiLibrary: 'materialdesign',
+
+ /** The initial timepicker value.
+ * @type String
+ * @default undefined
+ * @example Javascript
+ *
+ *
+ * @example HTML
+ *
+ *
+ */
+ value: undefined,
+
+ /** The timepicker mode. Tells the component to display the picker in ampm (12hr) format or 24hr format.
+ * @type ampm|24hr
+ * @default 'ampm'
+ * @example ampm
+ *
+ *
+ * @example 24hr
+ *
+ *
+ */
+ mode: 'ampm',
+
+ /** The language that needs to be in use.
+ * @type string
+ * @default 'en-us'
+ * @example German
+ *
+ *
+ * @example Bulgarian
+ *
+ *
+ * @example French
+ *
+ *
+ * @example Brazil
+ *
+ *
+ * @example Russian
+ *
+ *
+ */
+ locale: 'en-us',
+
+ /** The size of the timepicker input.
+ * @type 'small'|'default'|'large'
+ * @default 'default'
+ * @example Bootstrap.4
+ * Small Size:
+ * Default Size:
+ * Large Size:
+ *
+ * @example Bootstrap.3
+ * Small Size:
+ * Default Size:
+ * Large Size:
+ *
+ * @example Material.Design
+ * Small Size:
+ * Default Size:
+ * Large Size:
+ *
+ */
+ size: 'default',
+
+ icons: {
+ rightIcon: ' '
+ },
+
+ style: {
+ modal: 'bt-modal',
+ wrapper: 'bt-timepicker bt-timepicker-md bt-unselectable',
+ input: 'bt-textbox-md',
+ clock: 'bt-picker bt-picker-md timepicker',
+ footer: '',
+ button: 'bt-button-md'
+ }
+ },
+
+ bootstrap: {
+ style: {
+ wrapper: 'bt-timepicker bt-timepicker-bootstrap bt-unselectable input-group',
+ input: 'form-control',
+ clock: 'bt-picker bt-picker-bootstrap timepicker',
+ footer: 'modal-footer',
+ button: 'btn btn-default'
+ },
+ iconsLibrary: 'glyphicons'
+ },
+
+ bootstrap4: {
+ style: {
+ wrapper: 'bt-timepicker bt-timepicker-bootstrap bt-unselectable input-group',
+ input: 'form-control border',
+ clock: 'bt-picker bt-picker-bootstrap timepicker',
+ footer: 'modal-footer',
+ button: 'btn btn-default'
+ }
+ }
+};
+
+bt.timepicker.methods = {
+ init: function (jsConfig) {
+ bt.widget.prototype.init.call(this, jsConfig, 'timepicker');
+ this.attr('data-timepicker', 'true');
+ bt.timepicker.methods.initialize(this, this.data());
+ bt.timepicker.methods.createClock(this);
+ return this;
+ },
+
+ initialize: function ($timepicker, data) {
+ var $calendar, $rightIcon, $wrapper = $timepicker.parent('div[role="wrapper"]');
+
+ if (data.uiLibrary === 'bootstrap') {
+ $rightIcon = $('' + data.icons.rightIcon + ' ');
+ } else if (data.uiLibrary === 'bootstrap4') {
+ $rightIcon = $('' + data.icons.rightIcon + ' ');
+ } else {
+ $rightIcon = $(data.icons.rightIcon);
+ }
+
+ $rightIcon.attr('role', 'right-icon');
+ if ($wrapper.length === 0) {
+ $wrapper = $('
').addClass(data.style.wrapper); // The css class needs to be added before the wrapping, otherwise doesn't work.
+ $timepicker.wrap($wrapper);
+ } else {
+ $wrapper.addClass(data.style.wrapper);
+ }
+ $wrapper = $timepicker.parent('div[role="wrapper"]');
+
+ data.width && $wrapper.css('width', data.width);
+
+ $timepicker.val(data.value).addClass(data.style.input).attr('role', 'input');
+
+ //data.fontSize && $timepicker.css('font-size', data.fontSize);
+
+ if (data.uiLibrary === 'bootstrap' || data.uiLibrary === 'bootstrap4') {
+ if (data.size === 'small') {
+ $wrapper.addClass('input-group-sm');
+ $timepicker.addClass('form-control-sm');
+ } else if (data.size === 'large') {
+ $wrapper.addClass('input-group-lg');
+ $timepicker.addClass('form-control-lg');
+ }
+ } else {
+ if (data.size === 'small') {
+ $wrapper.addClass('small');
+ } else if (data.size === 'large') {
+ $wrapper.addClass('large');
+ }
+ }
+
+ $rightIcon.on('click', function (e) {
+ var $clock = $('body').find('[role="clock"][guid="' + $timepicker.attr('data-guid') + '"]');
+ if ($clock.is(':visible')) {
+ bt.timepicker.methods.close($timepicker);
+ } else {
+ bt.timepicker.methods.open($timepicker);
+ }
+ });
+
+ if (data.footer === false) {
+ $timepicker.on('blur', function () {
+ $timepicker.timeout = setTimeout(function () {
+ if (!$timepicker.mouseMove) {
+ bt.timepicker.methods.close($timepicker);
+ }
+ }, 500);
+ });
+ }
+
+ $wrapper.append($rightIcon);
+ },
+
+ initMouse: function ($body, $input, $picker, data) {
+ $body.off();
+ $body.on('mousedown', bt.timepicker.methods.mouseDownHandler($input, $picker));
+ $body.on('mousemove', bt.timepicker.methods.mouseMoveHandler($input, $picker, data));
+ $body.on('mouseup', bt.timepicker.methods.mouseUpHandler($input, $picker, data));
+ },
+
+ createClock: function ($timepicker) {
+ var date, data = $timepicker.data(),
+ $clock = $('
').addClass(data.style.clock).attr('guid', $timepicker.attr('data-guid')),
+ $hour = $('
'),
+ $minute = $('
'),
+ $header = $('
'),
+ $mode = $('
'),
+ $body = $('
'),
+ $btnOk = $('' + bt.core.messages[data.locale].ok + ' '),
+ $btnCancel = $('' + bt.core.messages[data.locale].cancel + ' '),
+ $footer = $('');
+
+ date = bt.core.parseDate(data.value, data.format, data.locale);
+ if (!date || isNaN(date.getTime())) {
+ date = new Date();
+ } else {
+ $timepicker.attr('hours', date.getHours());
+ }
+
+ bt.timepicker.methods.initMouse($body, $timepicker, $clock, data);
+
+ if (data.header) {
+ $hour.on('click', function () {
+ bt.timepicker.methods.renderHours($timepicker, $clock, data);
+ });
+ $minute.on('click', function () {
+ bt.timepicker.methods.renderMinutes($timepicker, $clock, data);
+ });
+ $header.append($hour).append(':').append($minute);
+ if (data.mode === 'ampm') {
+ $mode.append($('' + bt.core.messages[data.locale].am + ' ').on('click', function () {
+ var hour = bt.timepicker.methods.getHour($clock);
+ $clock.attr('mode', 'am');
+ $(this).addClass('selected');
+ $(this).parent().children('[role="pm"]').removeClass('selected');
+ if (hour >= 12) {
+ $clock.attr('hour', hour - 12);
+ }
+ if (!data.modal) {
+ clearTimeout($timepicker.timeout);
+ $timepicker.focus();
+ }
+ }));
+ $mode.append(' ');
+ $mode.append($('' + bt.core.messages[data.locale].pm + ' ').on('click', function () {
+ var hour = bt.timepicker.methods.getHour($clock);
+ $clock.attr('mode', 'pm');
+ $(this).addClass('selected');
+ $(this).parent().children('[role="am"]').removeClass('selected');
+ if (hour < 12) {
+ $clock.attr('hour', hour + 12);
+ }
+ if (!data.modal) {
+ clearTimeout($timepicker.timeout);
+ $timepicker.focus();
+ }
+ }));
+ $header.append($mode);
+ }
+ $clock.append($header);
+ }
+
+ $clock.append($body);
+
+ if (data.footer) {
+ $btnCancel.on('click', function () { $timepicker.close(); });
+ $footer.append($btnCancel);
+ $btnOk.on('click', bt.timepicker.methods.setTime($timepicker, $clock));
+ $footer.append($btnOk);
+ $clock.append($footer);
+ }
+
+ $clock.hide();
+
+ $('body').append($clock);
+
+ if (data.modal) {
+ $clock.wrapAll('
');
+ bt.core.center($clock);
+ }
+ return $clock;
+ },
+
+ getHour: function ($clock) {
+ return parseInt($clock.attr('hour'), 10) || 0;
+ },
+
+ getMinute: function ($clock) {
+ return parseInt($clock.attr('minute'), 10) || 0;
+ },
+
+ setTime: function ($timepicker, $clock) {
+ return function () {
+ var hour = bt.timepicker.methods.getHour($clock),
+ minute = bt.timepicker.methods.getMinute($clock),
+ mode = $clock.attr('mode'),
+ date = new Date(0, 0, 0, (hour === 12 && mode === 'am' ? 0 : hour), minute),
+ data = $timepicker.data(),
+ value = bt.core.formatDate(date, data.format, data.locale);
+ $timepicker.value(value);
+ $timepicker.close();
+ }
+ },
+
+ getPointerValue: function (x, y, mode) {
+ var value, radius, size = 256,
+ angle = Math.atan2(size / 2 - x, size / 2 - y) / Math.PI * 180;
+
+ if (angle < 0) {
+ angle = 360 + angle;
+ }
+
+ switch (mode) {
+ case 'ampm': {
+ value = 12 - Math.round(angle * 12 / 360);
+ return value === 0 ? 12 : value;
+ }
+ case '24hr': {
+ radius = Math.sqrt(Math.pow(size / 2 - x, 2) + Math.pow(size / 2 - y, 2));
+ value = 12 - Math.round(angle * 12 / 360);
+ if (value === 0) {
+ value = 12;
+ }
+ if (radius < size / 2 - 32) {
+ value = value === 12 ? 0 : value + 12;
+ }
+ return value;
+ }
+ case 'minutes': {
+ value = Math.round(60 - 60 * angle / 360);
+ return value === 60 ? 0 : value;
+ }
+ }
+ },
+
+ updateArrow: function(e, $timepicker, $clock, data) {
+ var rect, value,
+ mouseX = $timepicker.mouseX(e),
+ mouseY = $timepicker.mouseY(e),
+ scrollY = window.scrollY || window.pageYOffset || 0,
+ scrollX = window.scrollX || window.pageXOffset || 0;
+
+ rect = e.target.getBoundingClientRect();
+ if (data.dialMode == 'hours') {
+ value = bt.timepicker.methods.getPointerValue(mouseX - scrollX - rect.left, mouseY - scrollY - rect.top, data.mode);
+ $clock.attr('hour', data.mode === 'ampm' && $clock.attr('mode') === 'pm' && value < 12 ? value + 12 : value);
+ } else if (data.dialMode == 'minutes') {
+ value = bt.timepicker.methods.getPointerValue(mouseX - scrollX - rect.left, mouseY - scrollY - rect.top, 'minutes');
+ $clock.attr('minute', value);
+ }
+
+ bt.timepicker.methods.update($timepicker, $clock, data);
+ },
+
+ update: function ($timepicker, $clock, data) {
+ var hour, minute, $arrow, visualHour, $header, $numbers;
+
+ // update the arrow
+ hour = bt.timepicker.methods.getHour($clock);
+ minute = bt.timepicker.methods.getMinute($clock);
+ $arrow = $clock.find('[role="arrow"]');
+ if (data.dialMode == 'hours' && (hour == 0 || hour > 12) && data.mode === '24hr') {
+ $arrow.css('width', 'calc(50% - 52px)');
+ } else {
+ $arrow.css('width', 'calc(50% - 20px)');
+ }
+
+ if (data.dialMode == 'hours') {
+ $arrow.css('transform', 'rotate(' + ((hour * 30) - 90).toString() + 'deg)');
+ } else {
+ $arrow.css('transform', 'rotate(' + ((minute * 6) - 90).toString() + 'deg)');
+ }
+ $arrow.show();
+
+ // update the numbers
+ visualHour = (data.mode === 'ampm' && hour > 12 ? hour - 12 : (hour == 0 ? 12 : hour));
+ $numbers = $clock.find('[role="body"] span');
+ $numbers.removeClass('selected');
+ $numbers.filter(function (e) {
+ if (data.dialMode == 'hours') {
+ return parseInt($(this).text(), 10) == visualHour;
+ } else {
+ return parseInt($(this).text(), 10) == minute;
+ }
+ }).addClass('selected');
+
+ // update the header
+ if (data.header) {
+ $header = $clock.find('[role="header"]');
+ $header.find('[role="hour"]').text(visualHour);
+ $header.find('[role="minute"]').text(bt.core.pad(minute));
+ if (data.mode === 'ampm') {
+ if (hour >= 12) {
+ $header.find('[role="pm"]').addClass('selected');
+ $header.find('[role="am"]').removeClass('selected');
+ } else {
+ $header.find('[role="am"]').addClass('selected');
+ $header.find('[role="pm"]').removeClass('selected');
+ }
+ }
+ }
+ },
+
+ mouseDownHandler: function ($timepicker, $clock) {
+ return function (e) {
+ $timepicker.mouseMove = true;
+ }
+ },
+
+ mouseMoveHandler: function ($timepicker, $clock, data) {
+ return function (e) {
+ if ($timepicker.mouseMove) {
+ bt.timepicker.methods.updateArrow(e, $timepicker, $clock, data);
+ }
+ }
+ },
+
+ mouseUpHandler: function ($timepicker, $clock, data) {
+ return function (e) {
+ bt.timepicker.methods.updateArrow(e, $timepicker, $clock, data);
+ $timepicker.mouseMove = false;
+ if (!data.modal) {
+ clearTimeout($timepicker.timeout);
+ $timepicker.focus();
+ }
+ if (data.dialMode == 'hours') {
+ setTimeout(function () {
+ bt.timepicker.events.select($timepicker, 'hour');
+ bt.timepicker.methods.renderMinutes($timepicker, $clock, data);
+ }, 1000);
+ } else if (data.dialMode == 'minutes') {
+ if (data.footer !== true && data.autoClose !== false) {
+ bt.timepicker.methods.setTime($timepicker, $clock)();
+ }
+ bt.timepicker.events.select($timepicker, 'minute');
+ }
+ }
+ },
+
+ renderHours: function ($timepicker, $clock, data) {
+ var $dial, $body = $clock.find('[role="body"]');
+
+ clearTimeout($timepicker.timeout);
+ $body.empty();
+ $dial = $('
');
+
+ $dial.append('');
+
+ $dial.append('1 ');
+ $dial.append('2 ');
+ $dial.append('3 ');
+ $dial.append('4 ');
+ $dial.append('5 ');
+ $dial.append('6 ');
+ $dial.append('7 ');
+ $dial.append('8 ');
+ $dial.append('9 ');
+ $dial.append('10 ');
+ $dial.append('11 ');
+ $dial.append('12 ');
+ if (data.mode === '24hr') {
+ $dial.append('13 ');
+ $dial.append('14 ');
+ $dial.append('15 ');
+ $dial.append('16 ');
+ $dial.append('17 ');
+ $dial.append('18 ');
+ $dial.append('19 ');
+ $dial.append('20 ');
+ $dial.append('21 ');
+ $dial.append('22 ');
+ $dial.append('23 ');
+ $dial.append('00 ');
+ }
+ $body.append($dial);
+
+ $clock.find('[role="header"] [role="hour"]').addClass('selected');
+ $clock.find('[role="header"] [role="minute"]').removeClass('selected');
+
+ data.dialMode = 'hours';
+
+ bt.timepicker.methods.update($timepicker, $clock, data);
+ },
+
+ renderMinutes: function ($timepicker, $clock, data) {
+ var $body = $clock.find('[role="body"]');
+
+ clearTimeout($timepicker.timeout);
+ $body.empty();
+ $dial = $('
');
+
+ $dial.append('');
+
+ $dial.append('5 ');
+ $dial.append('10 ');
+ $dial.append('15 ');
+ $dial.append('20 ');
+ $dial.append('25 ');
+ $dial.append('30 ');
+ $dial.append('35 ');
+ $dial.append('40 ');
+ $dial.append('45 ');
+ $dial.append('50 ');
+ $dial.append('55 ');
+ $dial.append('00 ');
+ $body.append($dial);
+
+ $clock.find('[role="header"] [role="hour"]').removeClass('selected');
+ $clock.find('[role="header"] [role="minute"]').addClass('selected');
+
+ data.dialMode = 'minutes';
+
+ bt.timepicker.methods.update($timepicker, $clock, data);
+ },
+
+ open: function ($timepicker) {
+ var time, hour, data = $timepicker.data(),
+ $clock = $('body').find('[role="clock"][guid="' + $timepicker.attr('data-guid') + '"]');
+
+ if ($timepicker.value()) {
+ time = bt.core.parseDate($timepicker.value(), data.format, data.locale);
+ } else {
+ time = new Date();
+ }
+ hour = time.getHours();
+ if (data.mode === 'ampm') {
+ $clock.attr('mode', hour > 12 ? 'pm' : 'am');
+ }
+ $clock.attr('hour', hour);
+ $clock.attr('minute', time.getMinutes());
+
+ bt.timepicker.methods.renderHours($timepicker, $clock, data);
+ $clock.show();
+ $clock.closest('div[role="modal"]').show();
+ if (data.modal) {
+ bt.core.center($clock);
+ } else {
+ bt.core.setChildPosition($timepicker[0], $clock[0]);
+ $timepicker.focus();
+ }
+ bt.timepicker.events.open($timepicker);
+ return $timepicker;
+ },
+
+ close: function ($timepicker) {
+ var $clock = $('body').find('[role="clock"][guid="' + $timepicker.attr('data-guid') + '"]');
+ $clock.hide();
+ $clock.closest('div[role="modal"]').hide();
+ bt.timepicker.events.close($timepicker);
+ return $timepicker;
+ },
+
+ value: function ($timepicker, value) {
+ var $clock, time, data = $timepicker.data();
+ if (typeof (value) === "undefined") {
+ return $timepicker.val();
+ } else {
+ $timepicker.val(value);
+ bt.timepicker.events.change($timepicker);
+ return $timepicker;
+ }
+ },
+
+ destroy: function ($timepicker) {
+ var data = $timepicker.data(),
+ $parent = $timepicker.parent(),
+ $clock = $('body').find('[role="clock"][guid="' + $timepicker.attr('data-guid') + '"]');
+ if (data) {
+ $timepicker.off();
+ if ($clock.parent('[role="modal"]').length > 0) {
+ $clock.unwrap();
+ }
+ $clock.remove();
+ $timepicker.removeData();
+ $timepicker.removeAttr('data-type').removeAttr('data-guid').removeAttr('data-timepicker');
+ $timepicker.removeClass();
+ $parent.children('[role="right-icon"]').remove();
+ $timepicker.unwrap();
+ }
+ return $timepicker;
+ }
+};
+
+bt.timepicker.events = {
+ /**
+ * Triggered when the timepicker value is changed.
+ *
+ * @event change
+ * @param {object} e - event data
+ * @example sample
+ *
+ *
+ */
+ change: function ($timepicker) {
+ return $timepicker.triggerHandler('change');
+ },
+
+ /**
+ * Triggered when new value is selected inside the picker.
+ *
+ * @event select
+ * @param {object} e - event data
+ * @param {string} type - The type of the selection. The options are hour and minute.
+ * @example sample
+ *
+ *
+ */
+ select: function ($timepicker, type) {
+ return $timepicker.triggerHandler('select', [type]);
+ },
+
+ /**
+ * Event fires when the timepicker is opened.
+ * @event open
+ * @param {object} e - event data
+ * @example sample
+ *
+ *
+ */
+ open: function ($timepicker) {
+ return $timepicker.triggerHandler('open');
+ },
+
+ /**
+ * Event fires when the timepicker is closed.
+ * @event close
+ * @param {object} e - event data
+ * @example sample
+ *
+ *
+ */
+ close: function ($timepicker) {
+ return $timepicker.triggerHandler('close');
+ }
+};
+
+bt.timepicker.widget = function ($element, jsConfig) {
+ var self = this,
+ methods = bt.timepicker.methods;
+
+ self.mouseMove = false;
+
+ /** Gets or sets the value of the timepicker.
+ * @method
+ * @param {string} value - The value that needs to be selected.
+ * @return string
+ * @example Get
+ * Get Value
+ *
+ *
+ *
+ * @example Set
+ * Set Value
+ *
+ *
+ *
+ */
+ self.value = function (value) {
+ return methods.value(this, value);
+ };
+
+ /** Remove timepicker functionality from the element.
+ * @method
+ * @return jquery element
+ * @example sample
+ * Destroy
+ *
+ *
+ */
+ self.destroy = function () {
+ return methods.destroy(this);
+ };
+
+ /** Open the clock.
+ * @method
+ * @return timepicker
+ * @example Open.Close
+ * Open
+ * Close
+ *
+ *
+ *
+ */
+ self.open = function () {
+ return bt.timepicker.methods.open(this);
+ };
+
+ /** Close the clock.
+ * @method
+ * @return timepicker
+ * @example Open.Close
+ * Open
+ * Close
+ *
+ *
+ *
+ */
+ self.close = function () {
+ return bt.timepicker.methods.close(this);
+ };
+
+ $.extend($element, self);
+ if ('true' !== $element.attr('data-timepicker')) {
+ methods.init.call($element, jsConfig);
+ }
+
+ return $element;
+};
+
+bt.timepicker.widget.prototype = new bt.widget();
+bt.timepicker.widget.constructor = bt.timepicker.widget;
+
+(function ($) {
+ $.fn.timepicker = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.timepicker.widget(this, method);
+ } else {
+ $widget = new bt.timepicker.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 bt */
+/**
+ * @widget DateTimePicker
+ * @plugin Base
+ */
+bt.datetimepicker = {
+ plugins: {},
+ messages: {
+ 'en-us': {
+ }
+ }
+};
+
+bt.datetimepicker.config = {
+ base: {
+
+ /** The datepicker configuration options. Valid only for datepicker specific configuration options.
+ * @additionalinfo All configuration options that exists on the datetimepicker level are going to override the options at datepicker level.
+ * @type object
+ * @default undefined
+ * @example Sample
+ *
+ *
+ */
+ datepicker: bt.datepicker.config.base,
+
+ timepicker: bt.timepicker.config.base,
+
+ /** The name of the UI library that is going to be in use.
+ * @additionalinfo The css file for bootstrap should be manually included if you use bootstrap.
+ * @type (materialdesign|bootstrap|bootstrap4)
+ * @default materialdesign
+ * @example MaterialDesign
+ *
+ *
+ * @example MaterialDesign.Modal
+ *
+ *
+ * @example Bootstrap.3
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ uiLibrary: 'materialdesign',
+
+ /** The initial datetimepicker value.
+ * @type number
+ * @default undefined
+ * @example Javascript
+ *
+ *
+ * @example HTML
+ *
+ *
+ */
+ value: undefined,
+
+ /** Specifies the format, which is used to format the value of the DatePicker displayed in the input.
+ * @additionalinfo
+ * M - Minutes; no leading zero for single-digit minutes.
+ * MM - Minutes; leading zero for single-digit minutes.
+ * H - The hour, using a 24-hour clock from 0 to 23; no leading zero for single-digit hours.
+ * HH - The hour, using a 24-hour clock from 0 to 23; leading zero for single-digit hours.
+ * h - The hour, using a 12-hour clock from 1 to 12; no leading zero for single-digit hours.
+ * hh - The hour, using a 12-hour clock from 1 to 12; leading zero for single-digit hours
+ * tt - The AM/PM designator; lowercase.
+ * TT - The AM/PM designator; upercase.
+ * d - Day of the month as digits; no leading zero for single-digit days.
+ * dd - Day of the month as digits; leading zero for single-digit days.
+ * ddd - Day of the week as a three-letter abbreviation.
+ * dddd - Day of the week as its full name.
+ * m - Month as digits; no leading zero for single-digit months.
+ * mm - Month as digits; leading zero for single-digit months.
+ * mmm - Month as a three-letter abbreviation.
+ * mmmm - Month as its full name.
+ * yy - Year as last two digits; leading zero for years less than 10.
+ * yyyy - Year represented by four digits.
+ * @type String
+ * @default 'HH:MM mm/dd/yyyy'
+ * @example Sample
+ *
+ *
+ * @example Long.Month.Format
+ *
+ *
+ */
+ format: 'HH:MM mm/dd/yyyy',
+
+ /** The width of the datetimepicker.
+ * @type number
+ * @default undefined
+ * @example JS.Config
+ *
+ *
+ * @example HTML.Config
+ *
+ *
+ */
+ width: undefined,
+
+ /** If set to true, the datetimepicker will have modal behavior.
+ * @type Boolean
+ * @default false
+ * @example Material.Design
+ *
+ *
+ * @example Bootstrap
+ *
+ *
+ * @example Bootstrap.4
+ *
+ *
+ */
+ modal: false,
+
+ /** If set to true, add footer with ok and cancel buttons to the datetimepicker.
+ * @type Boolean
+ * @default false
+ * @example True
+ *
+ *
+ * @example False
+ *
+ *
+ */
+ footer: false,
+
+ /** The size of the datetimepicker input.
+ * @type 'small'|'default'|'large'
+ * @default 'default'
+ * @example Bootstrap.4
+ * Small Size:
+ * Default Size:
+ * Large Size:
+ *
+ * @example Bootstrap.4.Font.Awesome
+ * Small Size:
+ * Default Size:
+ * Large Size:
+ *
+ * @example Bootstrap.3
+ * Small Size:
+ * Default Size:
+ * Large Size:
+ *
+ * @example Material.Design
+ * Small Size:
+ * Default Size:
+ * Large Size:
+ *
+ */
+ size: 'default',
+
+ /** The language that needs to be in use.
+ * @type string
+ * @default 'en-us'
+ * @example German
+ *
+ *
+ * @example Bulgarian
+ *
+ *
+ */
+ locale: 'en-us',
+
+ icons: {},
+
+ style: {
+ calendar: 'bt-picker bt-picker-md datetimepicker bt-unselectable'
+ }
+ },
+
+ bootstrap: {
+ style: {
+ calendar: 'bt-picker bt-picker-bootstrap datetimepicker bt-unselectable'
+ },
+ iconsLibrary: 'glyphicons'
+ },
+
+ bootstrap4: {
+ style: {
+ calendar: 'bt-picker bt-picker-bootstrap datetimepicker bt-unselectable'
+ }
+ }
+};
+
+bt.datetimepicker.methods = {
+ init: function (jsConfig) {
+ bt.widget.prototype.init.call(this, jsConfig, 'datetimepicker');
+ this.attr('data-datetimepicker', 'true');
+ bt.datetimepicker.methods.initialize(this);
+ return this;
+ },
+
+ getConfig: function (clientConfig, type) {
+ var config = bt.widget.prototype.getConfig.call(this, clientConfig, type);
+
+ uiLibrary = clientConfig.hasOwnProperty('uiLibrary') ? clientConfig.uiLibrary : config.uiLibrary;
+ if (bt.datepicker.config[uiLibrary]) {
+ $.extend(true, config.datepicker, bt.datepicker.config[uiLibrary]);
+ }
+ if (bt.timepicker.config[uiLibrary]) {
+ $.extend(true, config.timepicker, bt.timepicker.config[uiLibrary]);
+ }
+
+ iconsLibrary = clientConfig.hasOwnProperty('iconsLibrary') ? clientConfig.iconsLibrary : config.iconsLibrary;
+ if (bt.datepicker.config[iconsLibrary]) {
+ $.extend(true, config.datepicker, bt.datepicker.config[iconsLibrary]);
+ }
+ if (bt.timepicker.config[iconsLibrary]) {
+ $.extend(true, config.timepicker, bt.timepicker.config[iconsLibrary]);
+ }
+
+ return config;
+ },
+
+ initialize: function ($datetimepicker) {
+ var $picker, $header, $date, $time, date,
+ $switch, $calendarMode, $clockMode,
+ data = $datetimepicker.data();
+
+ // Init datepicker
+ data.datepicker.uiLibrary = data.uiLibrary;
+ data.datepicker.iconsLibrary = data.iconsLibrary;
+ data.datepicker.width = data.width;
+ data.datepicker.format = data.format;
+ data.datepicker.locale = data.locale;
+ data.datepicker.modal = data.modal;
+ data.datepicker.footer = data.footer;
+ data.datepicker.style.calendar = data.style.calendar;
+ data.datepicker.value = data.value;
+ data.datepicker.size = data.size;
+ data.datepicker.autoClose = false;
+ bt.datepicker.methods.initialize($datetimepicker, data.datepicker);
+ $datetimepicker.on('select', function (e, type) {
+ var date, value;
+ if (type === 'day') {
+ bt.datetimepicker.methods.createShowHourHandler($datetimepicker, $picker, data)();
+ } else if (type === 'minute') {
+ if ($picker.attr('selectedDay') && data.footer !== true) {
+ selectedDay = $picker.attr('selectedDay').split('-');
+ date = new Date(selectedDay[0], selectedDay[1], selectedDay[2], $picker.attr('hour') || 0, $picker.attr('minute') || 0);
+ value = bt.core.formatDate(date, data.format, data.locale);
+ $datetimepicker.val(value);
+ bt.datetimepicker.events.change($datetimepicker);
+ bt.datetimepicker.methods.close($datetimepicker);
+ }
+ }
+ });
+ $datetimepicker.on('open', function () {
+ var $header = $picker.children('[role="header"]');
+ $header.find('[role="calendarMode"]').addClass("selected");
+ $header.find('[role="clockMode"]').removeClass("selected");
+ });
+
+ $picker = $('body').find('[role="calendar"][guid="' + $datetimepicker.attr('data-guid') + '"]');
+ date = data.value ? bt.core.parseDate(data.value, data.format, data.locale) : new Date();
+ $picker.attr('hour', date.getHours());
+ $picker.attr('minute', date.getMinutes());
+
+ // Init timepicker
+ data.timepicker.uiLibrary = data.uiLibrary;
+ data.timepicker.iconsLibrary = data.iconsLibrary;
+ data.timepicker.format = data.format;
+ data.timepicker.locale = data.locale;
+ data.timepicker.header = true;
+ data.timepicker.footer = data.footer;
+ data.timepicker.size = data.size;
+ data.timepicker.mode = '24hr';
+ data.timepicker.autoClose = false;
+
+ // Init header
+ $header = $('
');
+ $date = $('
');
+ $date.on('click', bt.datetimepicker.methods.createShowDateHandler($datetimepicker, $picker, data));
+ $date.html(bt.core.formatDate(new Date(), 'ddd, mmm dd', data.locale));
+ $header.append($date);
+
+ $switch = $('
');
+
+ $calendarMode = $('event ');
+ $calendarMode.on('click', bt.datetimepicker.methods.createShowDateHandler($datetimepicker, $picker, data));
+ $switch.append($calendarMode);
+
+ $time = $('
');
+ $time.append($('
').on('click', bt.datetimepicker.methods.createShowHourHandler($datetimepicker, $picker, data)).html(bt.core.formatDate(new Date(), 'HH', data.locale)));
+ $time.append(':');
+ $time.append($('
').on('click', bt.datetimepicker.methods.createShowMinuteHandler($datetimepicker, $picker, data)).html(bt.core.formatDate(new Date(), 'MM', data.locale)));
+ $switch.append($time);
+
+ $clockMode = $('clock ');
+ $clockMode.on('click', bt.datetimepicker.methods.createShowHourHandler($datetimepicker, $picker, data));
+ $switch.append($clockMode);
+ $header.append($switch);
+
+ $picker.prepend($header);
+ },
+
+ createShowDateHandler: function ($datetimepicker, $picker, data) {
+ return function (e) {
+ var $header = $picker.children('[role="header"]');
+ $header.find('[role="calendarMode"]').addClass("selected");
+ $header.find('[role="date"]').addClass("selected");
+ $header.find('[role="clockMode"]').removeClass("selected");
+ $header.find('[role="hour"]').removeClass("selected");
+ $header.find('[role="minute"]').removeClass("selected");
+ bt.datepicker.methods.renderMonth($datetimepicker, $picker, data.datepicker);
+ };
+ },
+
+ createShowHourHandler: function ($datetimepicker, $picker, data) {
+ return function () {
+ var $header = $picker.children('[role="header"]');
+ $header.find('[role="calendarMode"]').removeClass("selected");
+ $header.find('[role="date"]').removeClass("selected");
+ $header.find('[role="clockMode"]').addClass("selected");
+ $header.find('[role="hour"]').addClass("selected");
+ $header.find('[role="minute"]').removeClass("selected");
+
+ bt.timepicker.methods.initMouse($picker.children('[role="body"]'), $datetimepicker, $picker, data.timepicker);
+ bt.timepicker.methods.renderHours($datetimepicker, $picker, data.timepicker);
+ };
+ },
+
+ createShowMinuteHandler: function ($datetimepicker, $picker, data) {
+ return function () {
+ var $header = $picker.children('[role="header"]');
+ $header.find('[role="calendarMode"]').removeClass("selected");
+ $header.find('[role="date"]').removeClass("selected");
+ $header.find('[role="clockMode"]').addClass("selected");
+ $header.find('[role="hour"]').removeClass("selected");
+ $header.find('[role="minute"]').addClass("selected");
+ bt.timepicker.methods.initMouse($picker.children('[role="body"]'), $datetimepicker, $picker, data.timepicker);
+ bt.timepicker.methods.renderMinutes($datetimepicker, $picker, data.timepicker);
+ };
+ },
+
+ close: function ($datetimepicker) {
+ var $calendar = $('body').find('[role="calendar"][guid="' + $datetimepicker.attr('data-guid') + '"]');
+ $calendar.hide();
+ $calendar.closest('div[role="modal"]').hide();
+ //bt.datepicker.events.close($datepicker);
+ },
+
+ value: function ($datetimepicker, value) {
+ var $calendar, date, data = $datetimepicker.data();
+ if (typeof (value) === "undefined") {
+ return $datetimepicker.val();
+ } else {
+ date = bt.core.parseDate(value, data.format, data.locale);
+ if (date) {
+ $calendar = $('body').find('[role="calendar"][guid="' + $datetimepicker.attr('data-guid') + '"]');
+ bt.datepicker.methods.dayClickHandler($datetimepicker, $calendar, data, date)();
+ } else {
+ $datetimepicker.val('');
+ }
+ return $datetimepicker;
+ }
+ },
+
+ destroy: function ($datetimepicker) {
+ var data = $datetimepicker.data(),
+ $parent = $datetimepicker.parent(),
+ $picker = $('body').find('[role="calendar"][guid="' + $datetimepicker.attr('data-guid') + '"]');
+ if (data) {
+ $datetimepicker.off();
+ if ($picker.parent('[role="modal"]').length > 0) {
+ $picker.unwrap();
+ }
+ $picker.remove();
+ $datetimepicker.removeData();
+ $datetimepicker.removeAttr('data-type').removeAttr('data-guid').removeAttr('data-datetimepicker');
+ $datetimepicker.removeClass();
+ $parent.children('[role="right-icon"]').remove();
+ $datetimepicker.unwrap();
+ }
+ return $datetimepicker;
+ }
+};
+
+bt.datetimepicker.events = {
+ /**
+ * Fires when the datetimepicker value changes as a result of selecting a new value.
+ *
+ * @event change
+ * @param {object} e - event data
+ * @example sample
+ *
+ *
+ */
+ change: function ($datetimepicker) {
+ return $datetimepicker.triggerHandler('change');
+ }
+};
+
+bt.datetimepicker.widget = function ($element, jsConfig) {
+ var self = this,
+ methods = bt.datetimepicker.methods;
+
+ self.mouseMove = false;
+
+ /** Gets or sets the value of the datetimepicker.
+ * @method
+ * @param {string} value - The value that needs to be selected.
+ * @return string
+ * @example Get
+ * Get Value
+ *
+ *
+ *
+ * @example Set
+ * Set Value
+ *
+ *
+ *
+ */
+ self.value = function (value) {
+ return methods.value(this, value);
+ };
+
+ /** Remove datetimepicker functionality from the element.
+ * @method
+ * @return jquery element
+ * @example sample
+ * Destroy
+ *
+ *
+ */
+ self.destroy = function () {
+ return methods.destroy(this);
+ };
+
+ $.extend($element, self);
+ if ('true' !== $element.attr('data-datetimepicker')) {
+ methods.init.call($element, jsConfig);
+ }
+
+ return $element;
+};
+
+bt.datetimepicker.widget.prototype = new bt.widget();
+bt.datetimepicker.widget.constructor = bt.datetimepicker.widget;
+
+bt.datetimepicker.widget.prototype.getConfig = bt.datetimepicker.methods.getConfig;
+
+(function ($) {
+ $.fn.datetimepicker = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.datetimepicker.widget(this, method);
+ } else {
+ $widget = new bt.datetimepicker.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 bt */
+/**
+ * @widget Slider
+ * @plugin Base
+ */
+bt.slider = {
+ plugins: {},
+ messages: {
+ 'en-us': {
+ }
+ }
+};
+
+bt.slider.config = {
+ base: {
+
+ /** The minimum value of the Slider.
+ * @type number
+ * @default 0
+ * @example JS.Config
+ *
+ * Value:
+ *
+ */
+ min: 0,
+
+ /** The maximum value of the Slider.
+ * @type number
+ * @default 10
+ * @example JS.Config
+ *
+ * Value:
+ *
+ */
+ max: 100,
+
+ /** The orientation of a Slider: "horizontal" or "vertical".
+ * @type (horizontal|vertical)
+ * @default horizontal
+ */
+ // TODO orientation
+
+ /** The name of the UI library that is going to be in use.
+ * @additionalinfo The css file for bootstrap should be manually included if you use bootstrap.
+ * @type (materialdesign|bootstrap|bootstrap4)
+ * @default materialdesign
+ * @example MaterialDesign
+ *
+ * Value:
+ *
+ * @example Bootstrap.3
+ *
+ * Value:
+ *
+ * @example Bootstrap.4
+ *
+ * Value:
+ *
+ */
+ uiLibrary: 'materialdesign',
+
+ /** The initial slider value.
+ * @type number
+ * @default undefined
+ * @example Javascript
+ *
+ * Value:
+ *
+ * @example HTML
+ *
+ * Value:
+ *
+ */
+ value: undefined,
+
+ icons: {},
+
+ style: {
+ wrapper: 'bt-slider bt-slider-md',
+ progress: undefined,
+ track: undefined
+ }
+ },
+
+ bootstrap: {
+ style: {
+ wrapper: 'bt-slider bt-slider-bootstrap bt-slider-bootstrap-3',
+ progress: 'progress-bar',
+ track: 'progress'
+ }
+ },
+
+ bootstrap4: {
+ style: {
+ wrapper: 'bt-slider bt-slider-bootstrap bt-slider-bootstrap-4',
+ progress: 'progress-bar',
+ track: 'progress'
+ }
+ }
+};
+
+bt.slider.methods = {
+ init: function (jsConfig) {
+ bt.widget.prototype.init.call(this, jsConfig, 'slider');
+ this.attr('data-slider', 'true');
+ bt.slider.methods.initialize(this, this.data());
+ return this;
+ },
+
+ initialize: function ($slider, data) {
+ var wrapper, track, handle, progress;
+
+ $slider[0].style.display = 'none';
+
+ if ($slider[0].parentElement.attributes.role !== 'wrapper') {
+ wrapper = document.createElement('div');
+ wrapper.setAttribute('role', 'wrapper');
+ $slider[0].parentNode.insertBefore(wrapper, $slider[0]);
+ wrapper.appendChild($slider[0]);
+ } else {
+ wrapper = $slider[0].parentElement;
+ }
+
+ if (data.width) {
+ wrapper.style.width = data.width + 'px';
+ }
+
+ bt.core.addClasses(wrapper, data.style.wrapper);
+
+ track = $slider[0].querySelector('[role="track"]');
+ if (track == null) {
+ track = document.createElement('div');
+ track.setAttribute('role', 'track');
+ wrapper.appendChild(track);
+ }
+ bt.core.addClasses(track, data.style.track);
+
+ handle = $slider[0].querySelector('[role="handle"]');
+ if (handle == null) {
+ handle = document.createElement('div');
+ handle.setAttribute('role', 'handle');
+ wrapper.appendChild(handle);
+ }
+
+ progress = $slider[0].querySelector('[role="progress"]');
+ if (progress == null) {
+ progress = document.createElement('div');
+ progress.setAttribute('role', 'progress');
+ wrapper.appendChild(progress);
+ }
+ bt.core.addClasses(progress, data.style.progress);
+
+ if (!data.value) {
+ data.value = data.min;
+ }
+ bt.slider.methods.value($slider, data, data.value);
+
+ bt.documentManager.subscribeForEvent('mouseup', $slider.data('guid'), bt.slider.methods.createMouseUpHandler($slider, handle, data));
+ handle.addEventListener('mousedown', bt.slider.methods.createMouseDownHandler(handle, data));
+ bt.documentManager.subscribeForEvent('mousemove', $slider.data('guid'), bt.slider.methods.createMouseMoveHandler($slider, track, handle, progress, data));
+
+ },
+
+ createMouseUpHandler: function ($slider, handle, data) {
+ return function (e) {
+ if (handle.getAttribute('drag') === 'true') {
+ handle.setAttribute('drag', 'false');
+ bt.slider.events.change($slider);
+ }
+ }
+ },
+
+ createMouseDownHandler: function (handle, data) {
+ return function (e) {
+ handle.setAttribute('drag', 'true');
+ }
+ },
+
+ createMouseMoveHandler: function ($slider, track, handle, progress, data) {
+ return function (e) {
+ var sliderPos, x, trackWidth, offset, stepSize, valuePos, newValue;
+ if (handle.getAttribute('drag') === 'true') {
+ sliderPos = bt.core.position($slider[0], true, true);
+ x = new bt.widget().mouseX(e) - sliderPos.left;
+
+ trackWidth = bt.core.width(track);
+ offset = bt.core.width(handle) / 2;
+ stepSize = trackWidth / (data.max - data.min);
+ valuePos = (data.value - data.min) * stepSize;
+
+ if (x >= offset && x <= (trackWidth + offset)) {
+ if (x > valuePos + (stepSize / 2) || x < valuePos - (stepSize / 2)) {
+ newValue = Math.round((x - offset) / stepSize) + data.min;
+ bt.slider.methods.value($slider, data, newValue);
+ }
+ }
+ }
+ }
+ },
+
+ value: function ($slider, data, value) {
+ var stepSize, track, handle, progress;
+ if (typeof (value) === "undefined") {
+ return $slider[0].value;
+ } else {
+ $slider[0].setAttribute('value', value);
+ data.value = value;
+ track = $slider.parent().children('[role="track"]')[0]
+ stepSize = bt.core.width(track) / (data.max - data.min);
+ handle = $slider.parent().children('[role="handle"]')[0];
+ handle.style.left = ((value - data.min) * stepSize) + 'px';
+ progress = $slider.parent().children('[role="progress"]')[0];
+ progress.style.width = ((value - data.min) * stepSize) + 'px';
+ bt.slider.events.slide($slider, value);
+ return $slider;
+ }
+ },
+
+ destroy: function ($slider) {
+ var data = $slider.data(),
+ $wrapper = $slider.parent();
+ if (data) {
+ $wrapper.children('[role="track"]').remove();
+ $wrapper.children('[role="handle"]').remove();
+ $wrapper.children('[role="progress"]').remove();
+ $slider.unwrap();
+ $slider.off();
+ $slider.removeData();
+ $slider.removeAttr('data-type').removeAttr('data-guid').removeAttr('data-slider');
+ $slider.removeClass();
+ $slider.show();
+ }
+ return $slider;
+ }
+};
+
+bt.slider.events = {
+ /**
+ * Fires when the slider value changes as a result of selecting a new value with the drag handle, buttons or keyboard.
+ *
+ * @event change
+ * @param {object} e - event data
+ * @example sample
+ *
+ *
+ */
+ change: function ($slider) {
+ return $slider.triggerHandler('change');
+ },
+
+ /**
+ * Fires when the user drags the drag handle to a new position.
+ * @event slide
+ * @param {object} e - event data
+ * @param {object} value - The value of the slider.
+ * @example sample
+ *
+ * Value:
+ *
+ */
+ slide: function ($slider, value) {
+ return $slider.triggerHandler('slide', [value]);
+ }
+};
+
+bt.slider.widget = function ($element, jsConfig) {
+ var self = this,
+ methods = bt.slider.methods;
+
+ /** Gets or sets the value of the slider.
+ * @method
+ * @param {string} value - The value that needs to be selected.
+ * @return string
+ * @example Get
+ * Get Value
+ *
+ *
+ *
+ * @example Set
+ * Set Value
+ *
+ *
+ *
+ */
+ self.value = function (value) {
+ return methods.value(this, this.data(), value);
+ };
+
+ /** Remove slider functionality from the element.
+ * @method
+ * @return jquery element
+ * @example sample
+ * Destroy
+ *
+ *
+ */
+ self.destroy = function () {
+ return methods.destroy(this);
+ };
+
+ $.extend($element, self);
+ if ('true' !== $element.attr('data-slider')) {
+ methods.init.call($element, jsConfig);
+ }
+
+ return $element;
+};
+
+bt.slider.widget.prototype = new bt.widget();
+bt.slider.widget.constructor = bt.slider.widget;
+
+(function ($) {
+ $.fn.slider = function (method) {
+ var $widget;
+ if (this && this.length) {
+ if (typeof method === 'object' || !method) {
+ return new bt.slider.widget(this, method);
+ } else {
+ $widget = new bt.slider.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);
+
+var _gaq = _gaq || [];
+function loadtracking() {
+ window._gaq.push(['_setAccount', 'UA-117512685-2']);
+ window._gaq.push(['_trackPageview']);
+ (function() {
+ var ga = document.createElement('script');
+ ga.type = 'text/javascript';
+ ga.async = true;
+ ga.src = 'https://www.googletagmanager.com/gtag/js?id=UA-117512685-2';
+ var s = document.getElementsByTagName('script')[0];
+ s.parentNode.insertBefore(ga, s);
+ })();
+}
+loadtracking();
\ No newline at end of file
diff --git a/dist/bootree.min.css b/dist/bootree.min.css
new file mode 100644
index 0000000..d57b459
--- /dev/null
+++ b/dist/bootree.min.css
@@ -0,0 +1 @@
+.bt-button{background-color:#f5f5f5;border:1px solid #ddd;color:#000;border-radius:3px;padding:6px 10px;cursor:pointer}.bt-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.bt-row{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.bt-margin-left-5{margin-left:5px}.bt-margin-left-10{margin-left:10px}.bt-width-full{width:100%}.bt-cursor-pointer{cursor:pointer}.bt-text-align-center{text-align:center}.bt-font-size-16{font-size:16px}.bt-hidden{display:none}.bt-button-md{background:0 0;border:none;border-radius:2px;color:rgba(0,0,0,.87);position:relative;height:36px;margin:0;min-width:64px;padding:0 16px;display:inline-block;font-family:"Roboto","Helvetica","Arial",sans-serif;font-size:1rem;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;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.bt-button-md:hover{background-color:rgba(158,158,158,.2)}.bt-button-md:disabled{color:rgba(0,0,0,.26);background:0 0}.bt-button-md .material-icons,.bt-button-md .bt-icon{vertical-align:middle}.bt-button-md.bt-button-md-icon{width:24px;height:31px;min-width:24px;padding:0;display:table}.bt-button-md.bt-button-md-icon .material-icons,.bt-button-md.bt-button-md-icon .bt-icon{display:table-cell;margin-right:0;width:24px;height:24px}.bt-button-md.active{background-color:rgba(158,158,158,.4)}.bt-button-md-group{position:relative;display:inline-block;vertical-align:middle}.bt-textbox-md{border:none;border-bottom:1px solid rgba(0,0,0,.42);display:block;font-family:"Helvetica","Arial",sans-serif;font-size:16px;line-height:16px;padding:4px 0;margin:0;width:100%;background:0 0;text-align:left;color:rgba(0,0,0,.87)}.bt-textbox-md:focus,.bt-textbox-md:active{border-bottom:2px solid rgba(0,0,0,.42);outline:none}.bt-textbox-md::placeholder{color:#8e8e8e}.bt-textbox-md:-ms-input-placeholder{color:#8e8e8e}.bt-textbox-md::-ms-input-placeholder{color:#8e8e8e}.bt-md-spacer-24{min-width:24px;width:24px;display:inline-block}.bt-md-spacer-32{min-width:32px;width:32px;display:inline-block}.bt-modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0;background-color:rgba(0,0,0,.54118);transition:200ms ease opacity;will-change:opacity}ul.bt-list li [data-role="wrapper"]{display:table;width:100%}ul.bt-list li [data-role="checkbox"]{display:table-cell;vertical-align:middle;text-align:center}ul.bt-list li [data-role="image"]{display:table-cell;vertical-align:middle;text-align:center}ul.bt-list li [data-role="display"]{display:table-cell;vertical-align:middle;cursor:pointer}ul.bt-list li [data-role="display"]:empty:before{content:"\200b"}ul.bt-list-bootstrap{padding-left:0;margin-bottom:0}ul.bt-list-bootstrap li{padding:0}ul.bt-list-bootstrap li [data-role="wrapper"]{padding:0 10px}ul.bt-list-bootstrap li [data-role="checkbox"]{width:24px;padding:3px}ul.bt-list-bootstrap li [data-role="image"]{width:24px;height:24px}ul.bt-list-bootstrap li [data-role="display"]{padding:8px 0 8px 4px}.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.bt-list-md{padding:0;list-style:none;list-style-type:none;line-height:24px;letter-spacing:0;color:#616161}ul.bt-list-md li{display:list-item;list-style-type:none;padding:0;min-height:unset;box-sizing:border-box;align-items:center;cursor:default;overflow:hidden;font-family:"Roboto","Helvetica","Arial",sans-serif;font-size:16px;font-weight:400;letter-spacing:.04em;line-height:1;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap}ul.bt-list-md li [data-role="checkbox"]{height:24px;width:24px}ul.bt-list-md li [data-role="image"]{height:24px;width:24px}ul.bt-list-md li [data-role="display"]{padding:8px 0 8px 5px;order:0;flex-grow:2;text-decoration:none;box-sizing:border-box;align-items:center;text-align:left;color:rgba(0,0,0,.87)}ul.bt-list-md li.disabled>[data-role="wrapper"]>[data-role="display"]{color:#9E9E9E}.bt-list-md-active{background:rgba(0,0,0,.12);color:#3f51b5}.bt-picker{position:absolute;z-index:1202;background-color:#fff}.bt-picker .selected{color:#fff}.bt-picker-md{font-family:"Roboto","Helvetica","Arial",sans-serif;font-size:16px;font-weight:400;letter-spacing:.04em;line-height:1;color:rgba(0,0,0,.87);border:1px solid #E0E0E0}.bt-modal .bt-picker-md{border:0}.bt-picker-md [role="header"]{color:rgba(255,255,255,.54);display:flex;background:#2196f3;align-items:baseline;user-select:none;justify-content:center}.bt-picker-md [role="footer"]{float:right;padding:10px}.bt-picker-md [role="footer"] button.bt-button-md{color:#2196f3;font-weight:700;font-size:13px}.bt-picker-bootstrap{border-radius:4px;border:1px solid #E0E0E0}.bt-picker-bootstrap .selected{color:#888}.bt-picker-bootstrap [role="header"]{background:#eee;color:#AAA}@font-face{font-family:'gijgo-material';src:url(../fonts/gijgo-material.eot?235541);src:url('../fonts/gijgo-material.eot?235541#iefix') format('embedded-opentype'),url(../fonts/gijgo-material.ttf?235541) format('truetype'),url(../fonts/gijgo-material.woff?235541) format('woff'),url('../fonts/gijgo-material.svg?235541#gijgo-material') format('svg');font-weight:400;font-style:normal}.bt-icon{font-family:'gijgo-material'!important;font-size:24px;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;letter-spacing:0;-webkit-font-feature-settings:"liga";-moz-font-feature-settings:"liga=1";-moz-font-feature-settings:"liga";-ms-font-feature-settings:"liga" 1;font-feature-settings:"liga";-webkit-font-variant-ligatures:discretionary-ligatures;font-variant-ligatures:discretionary-ligatures;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.bt-icon.undo:before{content:"\e900"}.bt-icon.vertical-align-top:before{content:"\e901"}.bt-icon.vertical-align-center:before{content:"\e902"}.bt-icon.vertical-align-bottom:before{content:"\e903"}.bt-icon.arrow-dropup:before{content:"\e904"}.bt-icon.clock:before{content:"\e905"}.bt-icon.refresh:before{content:"\e906"}.bt-icon.last-page:before{content:"\e907"}.bt-icon.first-page:before{content:"\e908"}.bt-icon.cancel:before{content:"\e909"}.bt-icon.clear:before{content:"\e90a"}.bt-icon.check-circle:before{content:"\e90b"}.bt-icon.delete:before{content:"\e90c"}.bt-icon.arrow-upward:before{content:"\e90d"}.bt-icon.arrow-forward:before{content:"\e90e"}.bt-icon.arrow-downward:before{content:"\e90f"}.bt-icon.arrow-back:before{content:"\e910"}.bt-icon.list-numbered:before{content:"\e911"}.bt-icon.list-bulleted:before{content:"\e912"}.bt-icon.indent-increase:before{content:"\e913"}.bt-icon.indent-decrease:before{content:"\e914"}.bt-icon.redo:before{content:"\e915"}.bt-icon.align-right:before{content:"\e916"}.bt-icon.align-left:before{content:"\e917"}.bt-icon.align-justify:before{content:"\e918"}.bt-icon.align-center:before{content:"\e919"}.bt-icon.strikethrough:before{content:"\e91a"}.bt-icon.italic:before{content:"\e91b"}.bt-icon.underlined:before{content:"\e91c"}.bt-icon.bold:before{content:"\e91d"}.bt-icon.arrow-dropdown:before{content:"\e91e"}.bt-icon.done:before{content:"\e91f"}.bt-icon.pencil:before{content:"\e920"}.bt-icon.minus:before{content:"\e921"}.bt-icon.plus:before{content:"\e922"}.bt-icon.chevron-up:before{content:"\e923"}.bt-icon.chevron-right:before{content:"\e924"}.bt-icon.chevron-down:before{content:"\e925"}.bt-icon.chevron-left:before{content:"\e926"}.bt-icon.event:before{content:"\e927"}.bt-draggable{cursor:move}.bt-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none;z-index:1203}.bt-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.bt-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.bt-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.bt-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.bt-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.bt-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.bt-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.bt-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.bt-dialog-footer{position:absolute;bottom:0;width:100%;margin-top:0}.bt-dialog-scrollable [data-role="body"]{overflow-x:hidden;overflow-y:scroll}.bt-dialog-bootstrap{overflow:hidden;z-index:1202}.bt-dialog-bootstrap [data-role="title"]{display:inline}.bt-dialog-bootstrap [data-role="close"]{line-height:1.42857143}.bt-dialog-bootstrap4{overflow:hidden;z-index:1202}.bt-dialog-bootstrap4 [data-role="title"]{display:inline}.bt-dialog-bootstrap4 [data-role="close"]{line-height:1.5}.bt-dialog-md{background-color:#FFF;overflow:hidden;border:none;box-shadow:0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12);box-sizing:border-box;position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-background-clip:padding-box;background-clip:padding-box;outline:0;z-index:1202}.bt-dialog-md-header{padding:24px 24px 0 24px;font-family:"Roboto","Helvetica","Arial",sans-serif}.bt-dialog-md-title{margin:0;font-weight:400;display:inline;line-height:28px;font-size:20px}.bt-dialog-md-close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0;float:right;line-height:28px;font-size:28px}.bt-dialog-md-body{padding:20px 24px 24px 24px;color:rgba(0,0,0,.54);font-family:"Helvetica","Arial",sans-serif;font-size:14px;font-weight:400;line-height:20px}.bt-dialog-md-footer{padding:8px 8px 8px 24px;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row-reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;box-sizing:border-box}.bt-dialog-md-footer>*:first-child{margin-right:0}.bt-dialog-md-footer>*{margin-right:8px;height:36px}DIV.bt-grid-wrapper{margin:auto;position:relative;clear:both;z-index:1}TABLE.bt-grid{margin:auto;border-collapse:collapse;width:100%;table-layout:fixed}TABLE.bt-grid THEAD TH [data-role="selectAll"]{margin:auto}TABLE.bt-grid THEAD TH [data-role="title"]{display:inline-block}TABLE.bt-grid THEAD TH [data-role="sorticon"]{display:inline-block}TABLE.bt-grid THEAD TH{overflow:hidden;text-overflow:ellipsis}TABLE.bt-grid.autogrow-header-row THEAD TH{overflow:auto;text-overflow:initial;white-space:pre-wrap;-ms-word-break:break-word;word-break:break-word}TABLE.bt-grid>tbody>tr>td{overflow:hidden;position:relative}table.bt-grid tbody div[data-role="display"]{vertical-align:middle;text-indent:0;white-space:pre-wrap;-ms-word-break:break-word;word-break:break-word}table.bt-grid.fixed-body-rows tbody div[data-role="display"]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-ms-word-break:initial;word-break:initial}table.bt-grid tfoot DIV[data-role="display"]{vertical-align:middle;text-indent:0;display:flex}TABLE.bt-grid .fa{padding:2px}TABLE.bt-grid>tbody>tr>td>div{padding:2px;overflow:hidden}DIV.bt-grid-wrapper DIV.bt-grid-loading-cover{background:#BBB;opacity:.5;position:absolute;vertical-align:middle}DIV.bt-grid-wrapper DIV.bt-grid-loading-text{position:absolute;font-weight:700}table.bt-grid-bootstrap thead th{background-color:#f5f5f5;vertical-align:middle}table.bt-grid-bootstrap thead th [data-role="sorticon"]{margin-left:5px}table.bt-grid-bootstrap thead th [data-role="sorticon"] i.bt-icon,table.bt-grid-bootstrap thead th [data-role="sorticon"] i.material-icons{position:absolute;font-size:20px;top:15px}table.bt-grid-bootstrap tbody tr td div[data-role="display"]{padding:0}.bt-grid-bootstrap-4 .bt-checkbox-bootstrap{display:inline-block;padding-top:2px}.bt-grid-md{position:relative;border:1px solid rgba(0,0,0,.12);border-collapse:collapse;white-space:nowrap;font-size:13px;font-family:"Roboto","Helvetica","Arial",sans-serif;background-color:#fff}.bt-grid-md td:first-of-type,.bt-grid-md th:first-of-type{padding-left:24px}.bt-grid-md th{position:relative;vertical-align:bottom;font-weight:700;line-height:31px;letter-spacing:0;height:56px;font-size:12px;color:rgba(0,0,0,.54);padding-bottom:8px;box-sizing:border-box;padding:12px 18px;text-align:right}.bt-grid-md td{position:relative;height:48px;border-top:1px solid rgba(0,0,0,.12);border-bottom:1px solid rgba(0,0,0,.12);padding:12px 18px;box-sizing:border-box;text-align:left;color:rgba(0,0,0,.87)}.bt-grid-md tbody tr{position:relative;height:48px;transition-duration:.28s;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-property:background-color}.bt-grid-md tbody tr:hover{background-color:#EEE}.bt-grid-md tbody tr.bt-grid-md-select{background-color:#F5F5F5}table.bt-grid-md thead th [data-role="sorticon"]{margin-left:5px}table.bt-grid-md thead th [data-role="sorticon"] i.bt-icon,table.bt-grid-md thead th [data-role="sorticon"] i.material-icons{position:absolute;font-size:16px;top:19px}table.bt-grid-md thead th.bt-grid-select-all{padding-bottom:3px}@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}}@media screen and (min-width:20em){TABLE.bt-grid-bootstrap th.display-320,TABLE.bt-grid-bootstrap td.display-320{display:table-cell}}@media screen and (min-width:30em){TABLE.bt-grid-bootstrap th.display-480,TABLE.bt-grid-bootstrap td.display-480{display:table-cell}}@media screen and (min-width:40em){TABLE.bt-grid-bootstrap th.display-640,TABLE.bt-grid-bootstrap td.display-640{display:table-cell}}@media screen and (min-width:50em){TABLE.bt-grid-bootstrap th.display-800,TABLE.bt-grid-bootstrap td.display-800{display:table-cell}}@media screen and (min-width:60em){TABLE.bt-grid-bootstrap th.display-960,TABLE.bt-grid-bootstrap td.display-960{display:table-cell}}@media screen and (min-width:70em){TABLE.bt-grid-bootstrap th.display-1120,TABLE.bt-grid-bootstrap td.display-1120{display:table-cell}}.bt-grid-md tfoot tr th{padding-right:14px}.bt-grid-md tfoot tr[data-role="pager"] .bt-grid-mdl-pager-label{padding-left:5px;padding-right:5px}.bt-grid-md tfoot tr[data-role="pager"] .bt-dropdown-md{margin-left:12px}.bt-grid-md tfoot tr[data-role="pager"] .bt-dropdown-md [role="presenter"]{font-size:12px;font-weight:700;color:rgba(0,0,0,.54)}.bt-grid-md tfoot tr[data-role="pager"] .bt-dropdown-md [role="presenter"] [role="display"]{text-align:right}.bt-grid-md tfoot tr[data-role="pager"] .bt-grid-md-limit-select{margin-left:10px;font-size:12px;font-weight:700;color:rgba(0,0,0,.54)}.bt-grid-bootstrap tfoot tr[data-role="pager"] th{line-height:30px;background-color:#f5f5f5}.bt-grid-bootstrap tfoot tr[data-role="pager"] th>div>div{margin-right:5px}.bt-grid-bootstrap tfoot tr[data-role="pager"] th>div>button{margin-right:5px}.bt-grid-bootstrap-4 tfoot tr[data-role="pager"] th>div button{height:34px}.bt-grid-bootstrap-4 tfoot tr[data-role="pager"] th div .bt-dropdown-bootstrap-4 .bt-dropdown-expander-mi .bt-icon{top:5px}.bt-grid-bootstrap-3 tfoot tr[data-role="pager"] th>div>input{margin-right:5px;width:40px;text-align:right;display:inline-block;font-weight:700}.bt-grid-bootstrap-4 tfoot tr[data-role="pager"] th>div>div.input-group{width:40px}.bt-grid-bootstrap-4 tfoot tr[data-role="pager"] th>div>div.input-group input{text-align:right;font-weight:700;height:34px;padding-top:2px;padding-bottom:6px}.bt-grid-bootstrap tfoot tr[data-role="pager"] th>div>select{display:inline-block;margin-right:5px;width:60px}.bt-grid-bootstrap tfoot tr[data-role="pager"] th .bt-dropdown-bootstrap .bt-list-bootstrap [data-role="display"]{line-height:14px}.bt-grid-bootstrap tfoot tr[data-role="pager"] th .bt-dropdown-bootstrap [role="presenter"] [role="display"]{font-weight:700}.bt-grid-bootstrap tfoot tr[data-role="pager"] th .bt-dropdown-bootstrap-3 [role="presenter"]{padding:2px 8px}.bt-grid-bootstrap tfoot tr[data-role="pager"] th .bt-dropdown-bootstrap-4 [role="presenter"]{padding:1px 8px}.bt-grid thead tr th div.bt-grid-column-resizer-wrapper{position:relative;width:100%;height:0;top:0;left:0;padding:0}span.bt-grid-column-resizer{position:absolute;right:0;width:10px;top:-100px;height:300px;z-index:1202;cursor:e-resize}.bt-grid-resize-cursor{cursor:e-resize}.bt-grid-md tbody tr.bt-grid-top-border td{border-top:2px solid #777}.bt-grid-md tbody tr.bt-grid-bottom-border td{border-bottom:2px solid #777}.bt-grid-bootstrap tbody tr.bt-grid-top-border td{border-top:2px solid #777}.bt-grid-bootstrap tbody tr.bt-grid-bottom-border td{border-bottom:2px solid #777}.bt-grid-md thead tr th.bt-grid-left-border,.bt-grid-md tbody tr td.bt-grid-left-border{border-left:3px solid #777}.bt-grid-md thead tr th.bt-grid-right-border,.bt-grid-md tbody tr td.bt-grid-right-border{border-right:3px solid #777}.bt-grid-bootstrap thead tr th.bt-grid-left-border,.bt-grid-bootstrap tbody tr td.bt-grid-left-border{border-left:5px solid #ddd}.bt-grid-bootstrap thead tr th.bt-grid-right-border,.bt-grid-bootstrap tbody tr td.bt-grid-right-border{border-right:5px solid #ddd}.bt-dirty{position:absolute;top:0;left:0;border-style:solid;border-width:3px;border-color:red transparent transparent red;padding:0;overflow:hidden;vertical-align:top}.bt-grid-md tbody tr td.bt-grid-management-column{padding:3px}.bt-grid-md tbody tr td[data-mode="edit"]{padding:0 18px}.bt-grid-md tbody .bt-dropdown-md [role="presenter"] [role="display"]{padding:0}.bt-grid-bootstrap tbody tr td[data-mode="edit"]{padding:0}.bt-grid-bootstrap tbody tr td[data-mode="edit"] [data-role="edit"]{padding:0}.bt-grid-bootstrap-3 tbody tr td.bt-grid-management-column{padding:3px}.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"]{height:38px}.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] [data-role="edit"] input[type="text"]{height:37px;padding:8px}.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] .bt-dropdown-bootstrap [role="presenter"]{border:0;border-radius:0;height:37px;padding-left:8px}.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap{height:37px}.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="input"]{height:37px;border:0;border-radius:0}.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="right-icon"]{border:0;border-radius:0}.bt-grid-bootstrap-3 tbody tr td[data-mode="edit"] .bt-checkbox-bootstrap{display:inline-block;padding-top:10px;height:32px}.bt-grid-bootstrap-4 tbody tr td.bt-grid-management-column{padding:6px}.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] [data-role="edit"] input[type="text"]{height:48px;padding-left:12px}.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-dropdown-bootstrap [role="presenter"]{border:0;border-radius:0;height:48px;padding-left:12px;font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-dropdown-bootstrap-4 [role="expander"].bt-dropdown-expander-mi .bt-icon,.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-dropdown-bootstrap-4 [role="expander"].bt-dropdown-expander-mi .material-icons{top:13px}.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap{height:48px}.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="input"]{height:48px;border:0;border-radius:0}.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="right-icon"]{background-color:#fff}.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="right-icon"] button{border:0;border-radius:0;width:43px;position:relative}.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="right-icon"] .bt-icon,.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-datepicker-bootstrap [role="right-icon"] .material-icons{top:13px;left:10px;font-size:24px}.bt-grid-bootstrap-4 tbody tr td[data-mode="edit"] .bt-checkbox-bootstrap{display:inline-block;padding-top:15px;height:42px}.bt-grid-md thead tr[data-role="filter"] th{border-top:1px solid rgba(0,0,0,.12)}div.bt-grid-wrapper div.bt-grid-bootstrap-toolbar{background-color:#f5f5f5;padding:8px;font-weight:700;border:1px solid #ddd}div.bt-grid-wrapper div.bt-grid-bootstrap-4-toolbar{background-color:#f5f5f5;padding:12px;font-weight:700;border:1px solid #ddd}div.bt-grid-wrapper div.bt-grid-md-toolbar{font-weight:700;font-size:24px;font-family:"Helvetica","Arial",sans-serif;background-color:rgb(255,255,255);border-top:1px solid rgba(0,0,0,.12);border-left:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);border-bottom:0;border-collapse:collapse;padding:0 18px 0 18px;line-height:56px}table.bt-grid-scrollable tbody{overflow-y:auto;overflow-x:hidden;display:block}table.bt-grid-md.bt-grid-scrollable{border-bottom:0}table.bt-grid-md.bt-grid-scrollable tbody{border-right:1px solid rgba(0,0,0,.12);border-bottom:1px solid rgba(0,0,0,.12)}table.bt-grid-md.bt-grid-scrollable tfoot{border-bottom:1px solid rgba(0,0,0,.12)}table.bt-grid-bootstrap.bt-grid-scrollable{border-bottom:0}table.bt-grid-bootstrap.bt-grid-scrollable tbody{border-right:1px solid #ddd;border-bottom:1px solid #ddd}table.bt-grid-bootstrap.bt-grid-scrollable tbody tr[data-role="row"]:first-child td{border-top:0}table.bt-grid-bootstrap.bt-grid-scrollable tbody tr[data-role="row"] td:first-child{border-left:0}table.bt-grid-bootstrap.bt-grid-scrollable tbody tr[data-role="row"] td:last-child{border-right:0}table.bt-grid-bootstrap.bt-grid-scrollable tfoot{border-bottom:1px solid #ddd}ul.bt-list li [data-role="spacer"]{display:table-cell}ul.bt-list li [data-role="expander"]{display:table-cell;vertical-align:middle;text-align:center;cursor:pointer}[data-type="tree"] ul li [data-role="expander"].bt-tree-material-icons-expander{width:24px}[data-type="tree"] ul li [data-role="expander"].bt-tree-font-awesome-expander{width:24px}[data-type="tree"] ul li [data-role="expander"].bt-tree-glyphicons-expander{width:24px}[data-type="tree"] ul li [data-role="expander"].bt-tree-glyphicons-expander .glyphicon{top:4px;height:24px}.bt-tree-bootstrap-3 ul.bt-list-bootstrap li{border:0;border-radius:0;color:#333}.bt-tree-bootstrap-3 ul.bt-list-bootstrap li.active{color:#fff}.bt-tree-bootstrap-3 ul.bt-list-bootstrap li.disabled{color:#777;background-color:#eee}.bt-tree-bootstrap-4 ul.bt-list-bootstrap li{border:0;border-radius:0;color:#212529}.bt-tree-bootstrap-4 ul.bt-list-bootstrap li.active{color:#fff}.bt-tree-bootstrap-4 ul.bt-list-bootstrap li.disabled{color:#868e96}.bt-tree-bootstrap-4 ul.bt-list-bootstrap li ul.bt-list-bootstrap{width:100%}.bt-tree-bootstrap-border ul.bt-list-bootstrap li{border:1px solid #ddd}.bt-tree-bootstrap-border ul.bt-list-bootstrap li ul.bt-list-bootstrap li{border-left:0;border-right:0}.bt-tree-bootstrap-border ul.bt-list-bootstrap li:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.bt-tree-bootstrap-border ul.bt-list-bootstrap li:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px}.bt-tree-bootstrap-border ul.bt-list-bootstrap li ul.bt-list-bootstrap li:first-child{border-top-left-radius:0;border-top-right-radius:0}.bt-tree-bootstrap-border ul.bt-list-bootstrap li ul.bt-list-bootstrap li:last-child{border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}ul.bt-list-bootstrap li [data-role="expander"].bt-tree-material-icons-expander{padding-top:8px;padding-bottom:4px}ul.bt-list-bootstrap li [data-role="expander"].bt-tree-material-icons-expander .bt-icon{width:24px;height:24px}ul.bt-list-md li.disabled>[data-role="wrapper"]>[data-role="expander"]{color:#9E9E9E}.bt-tree-md-border ul.bt-list-md li{border:1px solid #616161;margin-bottom:-1px}.bt-tree-md-border ul.bt-list-md li ul.bt-list-md li{border-left:0;border-right:0}.bt-tree-md-border ul.bt-list-md li ul.bt-list-md li:last-child{border-bottom:0}.bt-tree-drop-above{border-top:1px solid #000}.bt-tree-drop-below{border-bottom:1px solid #000}.bt-tree-bootstrap-3 ul.bt-list-bootstrap li [data-role="wrapper"].drop-above{border-top:2px solid #000}.bt-tree-bootstrap-3 ul.bt-list-bootstrap li [data-role="wrapper"].drop-below{border-bottom:2px solid #000}.bt-tree-bootstrap-4 ul.bt-list-bootstrap li [data-role="wrapper"].drop-above{border-top:2px solid #000}.bt-tree-bootstrap-4 ul.bt-list-bootstrap li [data-role="wrapper"].drop-below{border-bottom:2px solid #000}.bt-tree-drag-el{padding:0;margin:0;z-index:1203}.bt-tree-drag-el li{padding:0;margin:0}.bt-tree-drag-el [data-role="wrapper"]{cursor:move;display:table}.bt-tree-drag-el [data-role="indicator"]{width:14px;padding:0 3px;display:table-cell;vertical-align:middle;text-align:center}.bt-tree-bootstrap-drag-el li.list-group-item{border:0;background:unset}.bt-tree-bootstrap-drag-el [data-role="indicator"]{width:24px;height:24px;padding:0}.bt-tree-md-drag-el [data-role="indicator"]{width:24px;height:24px;padding:0}.bt-checkbox-bootstrap{min-width:0;font-size:0;font-weight:400;margin:0;text-align:center;width:18px;height:18px;position:relative;display:inline}.bt-checkbox-bootstrap input[type="checkbox"]{display:none;margin-bottom:-12px}.bt-checkbox-bootstrap span{background:#fff;display:block;content:" ";width:18px;height:18px;line-height:11px;font-size:11px;padding:2px;color:#555;border:1px solid #CCC;border-radius:3px;transition:box-shadow 0.2s linear,border-color 0.2s linear;cursor:pointer;margin:auto}.bt-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}.bt-checkbox-bootstrap input[type="checkbox"][disabled] + span{opacity:.6;cursor:not-allowed}.bt-checkbox-bootstrap.bt-checkbox-bootstrap-4 span{line-height:16px;padding:0}.bt-checkbox-bootstrap-4.bt-checkbox-material-icons input[type="checkbox"]:checked + span:after{font-size:16px}.bt-checkbox-bootstrap-4.bt-checkbox-material-icons input[type="checkbox"]:indeterminate + span:after{font-size:16px}.bt-checkbox-md{min-width:0;font-size:0;font-weight:400;margin:0;text-align:center;width:16px;height:16px;position:relative}.bt-checkbox-md input[type="checkbox"]{display:none;margin-bottom:-12px}.bt-checkbox-md span{display:inline-block;box-sizing:border-box;width:16px;height:16px;margin:0;cursor:pointer;overflow:hidden;border:2px solid #616161;border-radius:2px;z-index:2}.bt-checkbox-md input[type="checkbox"]:checked + span{border:2px solid #536DFE}.bt-checkbox-md input[type="checkbox"]:checked + span:after{color:#FFF;background-color:#536DFE;position:absolute;left:1px;top:-15px}.bt-checkbox-md input[type="checkbox"]:indeterminate + span{border:2px solid #616161}.bt-checkbox-md input[type="checkbox"]:indeterminate + span:after{color:#616161;position:absolute;left:1px;top:-15px}.bt-checkbox-md input[type="checkbox"][disabled] + span{border:2px solid #9E9E9E}.bt-checkbox-md input[type="checkbox"][disabled] + span:after{background-color:#9E9E9E}.bt-checkbox-md input[type="checkbox"][disabled]:indeterminate + span:after{color:#FFF}.bt-checkbox-material-icons input[type="checkbox"]:checked + span:after{content:"\e91f";font-size:14px;font-weight:700;white-space:pre}.bt-checkbox-material-icons input[type="checkbox"]:indeterminate + span:after{content:"\e921";font-size:14px;font-weight:700;white-space:pre}.bt-checkbox-glyphicons input[type="checkbox"]:checked + span:after{display:inline-block;font-family:'Glyphicons Halflings';content:"\e013 "}.bt-checkbox-glyphicons input[type="checkbox"]:indeterminate + span:after{display:inline-block;font-family:'Glyphicons Halflings';content:"\2212 ";padding-right:1px}.bt-checkbox-fontawesome .fa{font-size:14px}.bt-checkbox-fontawesome input[type="checkbox"]:checked + span:before{content:"\f00c "}.bt-checkbox-fontawesome input[type="checkbox"]:indeterminate + span:before{content:"\f068 "}.bt-editor [role="body"]{overflow:auto;outline:0 solid transparent;box-sizing:border-box}.bt-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)}.bt-editor-md [role="toolbar"]{margin-bottom:7px}.bt-editor-md [role="toolbar"] .bt-button-md{min-width:54px;margin-right:5px}.bt-editor-md [role="toolbar"] .bt-button-md .bt-icon{width:24px;height:24px}.bt-editor-md [role="body"]{border:1px solid rgba(158,158,158,.2)}.bt-editor-md p{margin:0;padding:0}.bt-editor-md blockquote{font-size:14px}.bt-editor-bootstrap{padding:7px;border:1px solid #eceeef}.bt-editor-bootstrap [role="toolbar"]{margin-bottom:7px}.bt-editor-bootstrap [role="toolbar"] .btn-group{margin-right:10px}.bt-editor-bootstrap [role="toolbar"] button{height:36px}.bt-editor-bootstrap [role="body"]{border:1px solid #eceeef}.bt-editor-bootstrap p{margin:0;padding:0}.bt-editor-bootstrap blockquote{font-size:14px}.bt-dropdown{position:relative;border-collapse:separate}.bt-dropdown [role="presenter"]{display:table;cursor:pointer;outline:none;position:relative}.bt-dropdown [role="presenter"] [role="display"]{display:table-cell;text-align:left;width:100%}.bt-dropdown [role="presenter"] [role="expander"]{display:table-cell;vertical-align:middle;text-align:center;width:24px;height:24px}.bt-dropdown-md [role="presenter"]{font-family:"Roboto","Helvetica","Arial",sans-serif;font-size:16px;font-weight:400;letter-spacing:.04em;line-height:1;color:rgba(0,0,0,.87);padding:0;border:0;border-bottom:1px solid rgba(0,0,0,.42);background:transparent}.bt-dropdown-md [role="presenter"]:focus,.bt-dropdown-md [role="presenter"]:active{border-bottom:2px solid rgba(0,0,0,.42)}.bt-dropdown-md [role="presenter"] [role="display"]{padding:4px 0;line-height:18px}.bt-dropdown-md [role="presenter"] [role="display"] .placeholder{color:#8e8e8e}.bt-dropdown-list-md{position:absolute;top:0;left:0;background-color:#f5f5f5;color:#000;margin:0;z-index:1202}.bt-dropdown-list-md li:hover,.bt-dropdown-list-md li.active{background-color:#eee}.bt-dropdown-bootstrap [role="presenter"] [role="display"]{padding-right:5px}.bt-dropdown-bootstrap [role="presenter"] [role="expander"]{padding-left:5px}.bt-dropdown-bootstrap [role="presenter"] [role="expander"].bt-dropdown-expander-mi{width:24px}.bt-dropdown-bootstrap-3 [role="presenter"] [role="display"]{line-height:20px}.bt-dropdown-bootstrap-3 [role="presenter"] [role="display"] .placeholder{color:#9999b3}.bt-dropdown-bootstrap-3 [role="presenter"] [role="expander"]{width:20px;height:20px}.bt-dropdown-bootstrap-3 [role="presenter"] [role="expander"].bt-dropdown-expander-mi .bt-icon,.bt-dropdown-bootstrap-3 [role="presenter"] [role="expander"].bt-dropdown-expander-mi .material-icons{top:5px;right:10px;position:absolute}.bt-dropdown-bootstrap-4 [role="presenter"]{border:1px solid #ced4da}.bt-dropdown-bootstrap-4 [role="presenter"] [role="display"]{line-height:24px}.bt-dropdown-bootstrap-4 [role="presenter"] [role="expander"].bt-dropdown-expander-mi .bt-icon,.bt-dropdown-bootstrap-4 [role="presenter"] [role="expander"].bt-dropdown-expander-mi .material-icons{top:7px;right:10px;position:absolute}.bt-dropdown-list-bootstrap{position:absolute;top:32px;left:0;margin:0;z-index:1202}.bt-datepicker [role="input"]::-ms-clear{display:none}.bt-datepicker [role="right-icon"]{cursor:pointer}.bt-picker div[role="navigator"]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.bt-picker div[role="navigator"] div{cursor:pointer;position:relative;flex-basis:0%;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:100%}.bt-picker div[role="navigator"] div[role="period"]{width:100%;text-align:center}.bt-datepicker-md{font-family:"Roboto","Helvetica","Arial",sans-serif;font-size:16px;font-weight:400;letter-spacing:.04em;line-height:1;color:rgba(0,0,0,.87);position:relative}.bt-datepicker-md [role="right-icon"]{cursor:pointer;position:absolute;right:0;top:0;font-size:24px}.bt-datepicker-md.small .bt-textbox-md{font-size:14px}.bt-datepicker-md.small .bt-icon{font-size:22px}.bt-datepicker-md.large .bt-textbox-md{font-size:18px}.bt-datepicker-md.large .bt-icon{font-size:28px}.bt-picker-md.datepicker [role="header"]{padding:20px 20px;display:block}.bt-picker-md.datepicker [role="header"] [role="year"]{font-size:17px;padding-bottom:5px;cursor:pointer}.bt-picker-md.datepicker [role="header"] [role="date"]{font-size:36px;cursor:pointer}.bt-picker-md div[role="navigator"]{height:42px;line-height:42px}.bt-picker div[role="navigator"] div[role="period"]{font-weight:700;font-size:15px}.bt-picker-md div[role="navigator"] div:first-child{max-width:42px}.bt-picker-md div[role="navigator"] div:last-child{max-width:42px}.bt-picker-md div[role="navigator"] div i.bt-icon,.bt-picker-md div[role="navigator"] div i.material-icons{position:absolute;top:8px}.bt-picker-md div[role="navigator"] div:first-child i.bt-icon,.bt-picker-md div[role="navigator"] div:first-child i.material-icons{left:10px}.bt-picker-md div[role="navigator"] div:last-child i.bt-icon,.bt-picker-md div[role="navigator"] div:last-child i.material-icons{right:11px}.bt-picker-md table thead{color:#9E9E9E}.bt-picker-md table tr th div,.bt-picker-md table tr td div{display:block;width:40px;height:40px;line-height:40px;font-size:13px;text-align:center;vertical-align:middle}[type="year"].bt-picker-md table tr td div,[type="decade"].bt-picker-md table tr td div,[type="century"].bt-picker-md table tr td div{width:73px;height:73px;line-height:73px;cursor:pointer}.bt-picker-md table tr td.bt-cursor-pointer div:hover{background:#EEE;border-radius:50%;color:rgba(0,0,0,.87)}.bt-picker-md table tr td.other-month div,.bt-picker-md table tr td.disabled div{color:#BDBDBD}.bt-picker-md table tr td.focused div{background:#E0E0E0;border-radius:50%}.bt-picker-md table tr td.today div{color:#1976D2}.bt-picker-md table tr td.selected.bt-cursor-pointer div{color:#FFF;background:#1976D2;border-radius:50%}.bt-picker-md table tr td.calendar-week div{font-weight:700}.bt-datepicker-bootstrap :focus,.bt-datepicker-bootstrap :active{box-shadow:none}.bt-picker-bootstrap{border:1px solid rgba(0,0,0,.15);border-radius:4px;padding:4px}.bt-modal .bt-picker-bootstrap{padding:0}.bt-picker-bootstrap.datepicker [role="header"]{padding:10px 20px;display:block}.bt-picker-bootstrap.datepicker [role="header"] [role="year"]{font-size:15px;cursor:pointer}.bt-picker-bootstrap [role="header"] [role="date"]{font-size:24px;cursor:pointer}.bt-modal .bt-picker-bootstrap.datepicker [role="body"]{padding:15px}.bt-picker-bootstrap div[role="navigator"]{height:30px;line-height:30px;text-align:center}.bt-picker-bootstrap div[role="navigator"] div:first-child{max-width:30px}.bt-picker-bootstrap div[role="navigator"] div:last-child{max-width:30px}.bt-picker-bootstrap table tr td div,.bt-picker-bootstrap table tr th div{display:block;width:30px;height:30px;line-height:30px;text-align:center;vertical-align:middle}[type="year"].bt-picker-bootstrap table tr td div,[type="decade"].bt-picker-bootstrap table tr td div,[type="century"].bt-picker-bootstrap table tr td div{width:53px;height:53px;line-height:53px;cursor:pointer}.bt-picker-bootstrap table tr th div i,.bt-picker-bootstrap table tr th div span{line-height:30px}.bt-picker-bootstrap div[role="navigator"] .bt-icon,.bt-picker-bootstrap div[role="navigator"] .material-icons{margin:3px}.bt-picker-bootstrap table tr td.focused div,.bt-picker-bootstrap table tr td.bt-cursor-pointer div:hover{background:#EEE;border-radius:4px;color:#212529}.bt-picker-bootstrap table tr td.today div{color:#204d74;font-weight:700}.bt-picker-bootstrap table tr td.selected.bt-cursor-pointer div{color:#fff;background-color:#204d74;border-color:#122b40;border-radius:4px}.bt-picker-bootstrap table tr td.other-month div,.bt-picker-bootstrap table tr td.disabled div{color:#777}.bt-datepicker-bootstrap span[role="right-icon"].input-group-addon{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:4px;border-bottom-right-radius:4px;border-left:0;position:relative}.bt-datepicker-bootstrap span[role="right-icon"].input-group-addon .bt-icon,.bt-datepicker-bootstrap span[role="right-icon"].input-group-addon .material-icons{position:absolute;top:7px;left:7px}.bt-datepicker-bootstrap [role="right-icon"] button{width:38px;position:relative;border:1px solid #ced4da}.bt-datepicker-bootstrap [role="right-icon"] button:hover{color:#6c757d;background-color:transparent}.bt-datepicker-bootstrap.input-group-sm [role="right-icon"] button{width:30px}.bt-datepicker-bootstrap.input-group-lg [role="right-icon"] button{width:48px}.bt-datepicker-bootstrap [role="right-icon"] button .bt-icon,.bt-datepicker-bootstrap [role="right-icon"] button .material-icons{position:absolute;font-size:21px;top:9px;left:9px}.bt-datepicker-bootstrap.input-group-sm [role="right-icon"] button .bt-icon,.bt-datepicker-bootstrap.input-group-sm [role="right-icon"] button .material-icons{top:6px;left:6px;font-size:19px}.bt-datepicker-bootstrap.input-group-lg [role="right-icon"] button .bt-icon,.bt-datepicker-bootstrap.input-group-lg [role="right-icon"] button .material-icons{font-size:27px;top:10px;left:10px}.bt-timepicker [role="input"]::-ms-clear{display:none}.bt-timepicker [role="right-icon"]{cursor:pointer}.bt-picker.timepicker [role="header"]{font-size:58px;padding:20px 0;line-height:58px;display:flex;align-items:baseline;user-select:none;justify-content:center}.bt-picker.timepicker [role="header"] div{cursor:pointer;width:66px;text-align:right}.bt-picker [role="header"] [role="mode"]{position:relative;width:0}.bt-picker [role="header"] [role="mode"] span{position:absolute;left:7px;line-height:18px;font-size:18px}.bt-picker [role="header"] [role="mode"] span[role="am"]{top:7px}.bt-picker [role="header"] [role="mode"] span[role="pm"]{bottom:7px}.bt-picker [role="body"] [role="dial"]{width:256px;color:rgba(0,0,0,.87);height:256px;position:relative;background:#eee;border-radius:50%;margin:10px}.bt-picker [role="body"] [role="hour"]{top:calc(50% - 16px);left:calc(50% - 16px);width:32px;height:32px;cursor:pointer;position:absolute;font-size:14px;text-align:center;line-height:32px;user-select:none;pointer-events:none}.bt-picker [role="body"] [role="hour"].selected{color:rgba(255,255,255,1)}.bt-picker [role="body"] [role="arrow"]{top:calc(50% - 1px);left:50%;width:calc(50% - 20px);height:2px;position:absolute;pointer-events:none;transform-origin:left center;transition:all 250ms cubic-bezier(.4,0,.2,1);width:calc(50% - 52px)}.bt-picker .arrow-begin{top:-3px;left:-4px;width:8px;height:8px;position:absolute;border-radius:50%}.bt-picker .arrow-end{top:-15px;right:-16px;width:0;height:0;position:absolute;box-sizing:content-box;border-width:16px;border-radius:50%}.bt-timepicker-md{font-family:"Roboto","Helvetica","Arial",sans-serif;font-size:16px;font-weight:400;letter-spacing:.04em;line-height:1;color:rgba(0,0,0,.87);position:relative}.bt-timepicker-md.small .bt-textbox-md{font-size:14px}.bt-timepicker-md.small .bt-icon{font-size:22px}.bt-timepicker-md.large .bt-textbox-md{font-size:18px}.bt-timepicker-md.large .bt-icon{font-size:28px}.bt-timepicker-md [role="right-icon"]{cursor:pointer;position:absolute;right:0;top:0;font-size:24px}.bt-picker-md .arrow-begin{background-color:#2196f3}.bt-picker-md .arrow-end{border:16px solid #2196f3}.bt-picker-md [role="body"] [role="arrow"]{background-color:#2196f3}.bt-timepicker-bootstrap :focus,.bt-timepicker-bootstrap :active{box-shadow:none}.bt-picker-bootstrap [role="body"] [role="arrow"]{background-color:#888}.bt-picker-bootstrap .arrow-begin{background-color:#888}.bt-picker-bootstrap .arrow-end{border:16px solid #888}.bt-timepicker-bootstrap .input-group-addon{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:4px;border-bottom-right-radius:4px;border-left:0;position:relative;width:38px}.bt-timepicker-bootstrap.input-group-sm .input-group-addon{width:30px}.bt-timepicker-bootstrap.input-group-lg .input-group-addon{width:46px}.bt-timepicker-bootstrap .input-group-addon .bt-icon,.bt-timepicker-bootstrap .input-group-addon .material-icons{position:absolute;font-size:21px;top:6px;left:8px}.bt-timepicker-bootstrap.input-group-sm .input-group-addon .bt-icon,.bt-timepicker-bootstrap.input-group-sm .input-group-addon .material-icons{font-size:19px;top:5px;left:5px}.bt-timepicker-bootstrap.input-group-lg .input-group-addon .bt-icon,.bt-timepicker-bootstrap.input-group-lg .input-group-addon .material-icons{font-size:27px;top:10px;left:10px}.bt-timepicker-bootstrap [role="right-icon"] button{width:38px;position:relative}.bt-timepicker-bootstrap.input-group-sm [role="right-icon"] button{width:30px}.bt-timepicker-bootstrap.input-group-lg [role="right-icon"] button{width:48px}.bt-timepicker-bootstrap [role="right-icon"] button .bt-icon,.bt-timepicker-bootstrap [role="right-icon"] button .material-icons{position:absolute;font-size:21px;top:7px;left:9px}.bt-timepicker-bootstrap.input-group-sm [role="right-icon"] button .bt-icon,.bt-timepicker-bootstrap.input-group-sm [role="right-icon"] button .material-icons{top:4px;left:6px;font-size:19px}.bt-timepicker-bootstrap.input-group-lg [role="right-icon"] button .bt-icon,.bt-timepicker-bootstrap.input-group-lg [role="right-icon"] button .material-icons{font-size:27px;top:8px;left:10px}.bt-picker.datetimepicker [role="header"] [role="date"]{padding-bottom:5px;text-align:center;cursor:pointer}.bt-picker [role="switch"]{align-items:baseline;user-select:none;position:relative}.bt-picker [role="switch"] [role="calendarMode"]{cursor:pointer;position:absolute;bottom:2px;left:0}.bt-picker [role="switch"] [role="time"]{width:100%;text-align:center}.bt-picker [role="switch"] [role="time"] div{display:inline;cursor:pointer}.bt-picker [role="switch"] [role="calendarMode"]{cursor:pointer}.bt-picker [role="switch"] [role="clockMode"]{position:absolute;right:0;bottom:3px;cursor:pointer}.bt-picker-md.datetimepicker [role="header"]{font-size:36px;padding:10px 20px;display:block}.bt-picker-md [role="switch"]{color:rgba(255,255,255,.54);background:#2196f3;font-size:32px}.bt-picker-bootstrap.datetimepicker [role="header"]{font-size:36px;padding:10px 20px;display:block}.bt-picker-bootstrap.datetimepicker [role="header"] [role="time"]{font-size:22px}.bt-slider{position:relative;padding:8px 6px}.bt-slider [role="track"]{width:100%}.bt-slider [role="progress"]{position:absolute;z-index:1001}.bt-slider [role="handle"]{position:absolute}.bt-slider-md [role="track"]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;color:#fff;text-align:center;background-color:#e9ecef;height:2px;background-color:rgba(0,0,0,.26)}.bt-slider-md [role="progress"]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;color:#fff;text-align:center;height:2px;background-color:#536DFE;top:8px;left:6px}.bt-slider-md [role="handle"]{top:3px;left:0;width:12px;height:12px;background-color:#536DFE;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7',endColorstr='#ff2e6da4',GradientType=0);filter:none;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);border:0 solid transparent;border-radius:50%;cursor:pointer;z-index:1002}.bt-slider-bootstrap [role="track"]{border-radius:4px;height:10px}.bt-slider-bootstrap [role="progress"]{height:10px;border-radius:4px;top:8px;left:6px;transition:none}.bt-slider-bootstrap [role="handle"]{top:2px;left:0;width:20px;height:20px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7',endColorstr='#ff2e6da4',GradientType=0);filter:none;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);border:0 solid transparent;border-radius:50%;cursor:pointer;z-index:1002}.bt-slider-bootstrap-3 [role="handle"]{background-color:#337ab7;background-image:-webkit-linear-gradient(top,#337ab7 0%,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0%,#2e6da4 100%);background-image:linear-gradient(to bottom,#337ab7 0%,#2e6da4 100%);background-repeat:repeat-x}.bt-slider-bootstrap-4 [role="handle"]{background-color:#007bff;background-image:-webkit-linear-gradient(top,#007bff 0%,#2e6da4 100%);background-image:-o-linear-gradient(top,#007bff 0%,#2e6da4 100%);background-image:linear-gradient(to bottom,#007bff 0%,#2e6da4 100%);background-repeat:repeat-x}
\ No newline at end of file
diff --git a/dist/bootree.min.js b/dist/bootree.min.js
new file mode 100644
index 0000000..508927b
--- /dev/null
+++ b/dist/bootree.min.js
@@ -0,0 +1,410 @@
+var bt={};bt.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}};bt.widget.prototype.init=function(jsConfig,type){var option,clientConfig,fullConfig;this.attr('data-type',type);clientConfig=$.extend(!0,{},this.getHTMLConfig()||{});$.extend(!0,clientConfig,jsConfig||{});fullConfig=this.getConfig(clientConfig,type);this.attr('data-guid',fullConfig.guid);this.data(fullConfig);for(option in fullConfig){if(bt[type].events.hasOwnProperty(option)){this.on(option,fullConfig[option]);delete fullConfig[option]}}
+for(plugin in bt[type].plugins){if(bt[type].plugins.hasOwnProperty(plugin)){bt[type].plugins[plugin].configure(this,fullConfig,clientConfig)}}
+return this};bt.widget.prototype.getConfig=function(clientConfig,type){var config,uiLibrary,iconsLibrary,plugin;config=$.extend(!0,{},bt[type].config.base);uiLibrary=clientConfig.hasOwnProperty('uiLibrary')?clientConfig.uiLibrary:config.uiLibrary;if(bt[type].config[uiLibrary]){$.extend(!0,config,bt[type].config[uiLibrary])}
+iconsLibrary=clientConfig.hasOwnProperty('iconsLibrary')?clientConfig.iconsLibrary:config.iconsLibrary;if(bt[type].config[iconsLibrary]){$.extend(!0,config,bt[type].config[iconsLibrary])}
+for(plugin in bt[type].plugins){if(bt[type].plugins.hasOwnProperty(plugin)){$.extend(!0,config,bt[type].plugins[plugin].config.base);if(bt[type].plugins[plugin].config[uiLibrary]){$.extend(!0,config,bt[type].plugins[plugin].config[uiLibrary])}
+if(bt[type].plugins[plugin].config[iconsLibrary]){$.extend(!0,config,bt[type].plugins[plugin].config[iconsLibrary])}}}
+$.extend(!0,config,clientConfig);if(!config.guid){config.guid=this.generateGUID()}
+return config}
+bt.widget.prototype.getHTMLConfig=function(){var result=this.data(),attrs=this[0].attributes;if(attrs.width){result.width=attrs.width.value}
+if(attrs.height){result.height=attrs.height.value}
+if(attrs.value){result.value=attrs.value.value}
+if(attrs.align){result.align=attrs.align.value}
+if(result&&result.source){result.dataSource=result.source;delete result.source}
+return result};bt.widget.prototype.createDoneHandler=function(){var $widget=this;return function(response){if(typeof(response)==='string'&&JSON){response=JSON.parse(response)}
+bt[$widget.data('type')].methods.render($widget,response)}};bt.widget.prototype.createErrorHandler=function(){var $widget=this;return function(response){if(response&&response.statusText&&response.statusText!=='abort'){alert(response.statusText)}}};bt.widget.prototype.reload=function(params){var ajaxOptions,result,data=this.data(),type=this.data('type');if(data.dataSource===undefined){bt[type].methods.useHtmlDataSource(this,data)}
+$.extend(data.params,params);if($.isArray(data.dataSource)){result=bt[type].methods.filter(this);bt[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(!0,{},data.dataSource);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}
+bt.documentManager={events:{},subscribeForEvent:function(eventName,widgetId,callback){if(!bt.documentManager.events[eventName]||bt.documentManager.events[eventName].length===0){bt.documentManager.events[eventName]=[{widgetId:widgetId,callback:callback}];$(document).on(eventName,bt.documentManager.executeCallbacks)}else if(!bt.documentManager.events[eventName][widgetId]){bt.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=bt.documentManager.events[e.type];if(callbacks){for(var i=0;i-1){result=new Date(parseInt(value.substr(6),10))}else if(value){dateParts=value.split(/[\s,-\.//\:]+/);formatParts=format.split(/[\s,-\.//\:]+/);for(i=0;i-1){date=parseInt(dateParts[i],10)}else if(['m','mm'].indexOf(formatParts[i])>-1){month=parseInt(dateParts[i],10)-1}else if('mmm'===formatParts[i]){month=bt.core.messages[locale||'en-us'].monthShortNames.indexOf(dateParts[i])}else if('mmmm'===formatParts[i]){month=bt.core.messages[locale||'en-us'].monthNames.indexOf(dateParts[i])}else if(['yy','yyyy'].indexOf(formatParts[i])>-1){year=parseInt(dateParts[i],10);if(formatParts[i]==='yy'){year+=2000}}else if(['h','hh','H','HH'].indexOf(formatParts[i])>-1){hour=parseInt(dateParts[i],10)}else if(['M','MM'].indexOf(formatParts[i])>-1){minute=parseInt(dateParts[i],10)}}
+result=new Date(year,month,date,hour,minute)}}else if(typeof value==='number'){result=new Date(value)}else if(value instanceof Date){result=value}
+return result},formatDate:function(date,format,locale){var result='',separator,tmp,formatParts=format.split(/[\s,-\.//\:]+/),separators=format.split(/s+|M+|H+|h+|t+|T+|d+|m+|y+/);separators=separators.splice(1,separators.length-2);for(i=0;i12?date.getHours()%12:date.getHours();result+=tmp+separator;break;case 'hh':tmp=date.getHours()>12?date.getHours()%12:date.getHours();result+=bt.core.pad(tmp)+separator;break;case 'tt':result+=(date.getHours()>=12?'pm':'am')+separator;break;case 'TT':result+=(date.getHours()>=12?'PM':'AM')+separator;break;case 'd':result+=date.getDate()+separator;break;case 'dd':result+=bt.core.pad(date.getDate())+separator;break;case 'ddd':result+=bt.core.messages[locale||'en-us'].weekDaysShort[date.getDay()]+separator;break;case 'dddd':result+=bt.core.messages[locale||'en-us'].weekDays[date.getDay()]+separator;break;case 'm':result+=(date.getMonth()+1)+separator;break;case 'mm':result+=bt.core.pad(date.getMonth()+1)+separator;break;case 'mmm':result+=bt.core.messages[locale||'en-us'].monthShortNames[date.getMonth()]+separator;break;case 'mmmm':result+=bt.core.messages[locale||'en-us'].monthNames[date.getMonth()]+separator;break;case 'yy':result+=date.getFullYear().toString().substr(2)+separator;break;case 'yyyy':result+=date.getFullYear()+separator;break}}
+return result},pad:function(val,len){val=String(val);len=len||2;while(val.length0?left:0);$dialog.css('top',top>0?top:0)},isIE:function(){return!!navigator.userAgent.match(/Trident/g)||!!navigator.userAgent.match(/MSIE/g)},setChildPosition:function(mainEl,childEl){var mainElRect=mainEl.getBoundingClientRect(),mainElHeight=bt.core.height(mainEl,!0),childElHeight=bt.core.height(childEl,!0),mainElWidth=bt.core.width(mainEl,!0),childElWidth=bt.core.width(childEl,!0),scrollY=window.scrollY||window.pageYOffset||0,scrollX=window.scrollX||window.pageXOffset||0;if((mainElRect.top+mainElHeight+childElHeight)>window.innerHeight&&mainElRect.top>childElHeight){childEl.style.top=Math.round(mainElRect.top+scrollY-childElHeight-3)+'px'}else{childEl.style.top=Math.round(mainElRect.top+scrollY+mainElHeight+3)+'px'}
+if(mainElRect.left+childElWidth>document.body.clientWidth){childEl.style.left=Math.round(mainElRect.left+scrollX+mainElWidth-childElWidth)+'px'}else{childEl.style.left=Math.round(mainElRect.left+scrollX)+'px'}},height:function(el,margin){var result,style=window.getComputedStyle(el);if(style.boxSizing==='border-box'){result=parseInt(style.height,10)}else{result=parseInt(style.height,10);result+=parseInt(style.paddingTop||0,10)+parseInt(style.paddingBottom||0,10);result+=parseInt(style.borderTop||0,10)+parseInt(style.borderBottom||0,10)}
+if(margin){result+=parseInt(style.marginTop||0,10)+parseInt(style.marginBottom||0,10)}
+return result},width:function(el,margin){var result,style=window.getComputedStyle(el);if(style.boxSizing==='border-box'){result=parseInt(style.width,10)}else{result=parseInt(style.width,10);result+=parseInt(style.paddingLeft||0,10)+parseInt(style.paddingRight||0,10);result+=parseInt(style.borderLeft||0,10)+parseInt(style.borderRight||0,10)}
+if(margin){result+=parseInt(style.marginLeft||0,10)+parseInt(style.marginRight||0,10)}
+return result},addClasses:function(el,classes){var i,arr;if(classes){arr=classes.split(' ');for(i=0;i ').addClass(data.style.body);$dialog.wrapInner($body)}else{$body.addClass(data.style.body)}
+$header=bt.dialog.methods.renderHeader($dialog);$footer=$dialog.children('div[data-role="footer"]').addClass(data.style.footer);$dialog.find('[data-role="close"]').on('click',function(){$dialog.close()});if(bt.draggable){if(data.draggable){bt.dialog.methods.draggable($dialog,$header)}
+if(data.resizable){bt.dialog.methods.resizable($dialog)}}
+if(data.scrollable&&data.height){$dialog.addClass('bt-dialog-scrollable');$dialog.on('opened',function(){var $body=$dialog.children('div[data-role="body"]');$body.css('height',data.height-$header.outerHeight()-($footer.length?$footer.outerHeight():0))})}
+bt.core.center($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.append($closeButton)}else if($closeButton.length>0&&data.closeButtonInHeader===!1){$closeButton.hide()}else{$closeButton.addClass(data.style.headerCloseButton)}
+return $header},draggable:function($dialog,$header){$dialog.appendTo('body');$header.addClass('bt-draggable');$dialog.draggable({handle:$header,start:function(){$dialog.addClass('bt-unselectable');bt.dialog.events.dragStart($dialog)},stop:function(){$dialog.removeClass('bt-unselectable');bt.dialog.events.dragStop($dialog)}})},resizable:function($dialog){var config={'drag':bt.dialog.methods.resize,'start':function(){$dialog.addClass('bt-unselectable');bt.dialog.events.resizeStart($dialog)},'stop':function(){this.removeAttribute('style');$dialog.removeClass('bt-unselectable');bt.dialog.events.resizeStop($dialog)}};$dialog.append($('
').draggable($.extend(!0,{horizontal:!1},config)));$dialog.append($('
').draggable($.extend(!0,{vertical:!1},config)));$dialog.append($('
').draggable($.extend(!0,{horizontal:!1},config)));$dialog.append($('
').draggable($.extend(!0,{vertical:!1},config)));$dialog.append($('
').draggable($.extend(!0,{},config)));$dialog.append($('
').draggable($.extend(!0,{},config)));$dialog.append($('
').draggable($.extend(!0,{},config)));$dialog.append($('
').draggable($.extend(!0,{},config)))},resize:function(e,newPosition){var $el,$dialog,position,data,height,width,top,left,result=!1;$el=$(this);$dialog=$el.parent();position=bt.core.position(this);offset={top:newPosition.top-position.top,left:newPosition.left-position.left};data=$dialog.data();if($el.hasClass('bt-resizable-n')){height=$dialog.height()-offset.top;top=$dialog.offset().top+offset.top}else if($el.hasClass('bt-resizable-e')){width=$dialog.width()+offset.left}else if($el.hasClass('bt-resizable-s')){height=$dialog.height()+offset.top}else if($el.hasClass('bt-resizable-w')){width=$dialog.width()-offset.left;left=$dialog.offset().left+offset.left}else if($el.hasClass('bt-resizable-ne')){height=$dialog.height()-offset.top;top=$dialog.offset().top+offset.top;width=$dialog.width()+offset.left}else if($el.hasClass('bt-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('bt-resizable-se')){height=$dialog.height()+offset.top;width=$dialog.width()+offset.left}else if($el.hasClass('bt-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=!0}
+if(width&&(!data.minWidth||width>=data.minWidth)&&(!data.maxWidth||width<=data.maxWidth)){$dialog.width(width);if(left){$dialog.css('left',left)}
+result=!0}
+if(result){bt.dialog.events.resize($dialog)}
+return result},open:function($dialog,title){var $footer;bt.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())}
+if(title!==undefined){$dialog.find('[data-role="title"]').html(title)}
+bt.dialog.events.opened($dialog);return $dialog},close:function($dialog){if($dialog.is(':visible')){bt.dialog.events.closing($dialog);$dialog.css('display','none');$dialog.closest('div[data-role="modal"]').css('display','none');bt.dialog.events.closed($dialog)}
+return $dialog},isOpen:function($dialog){return $dialog.is(':visible')},content:function($dialog,html){var $body=$dialog.children('div[data-role="body"]');if(typeof(html)==="undefined"){return $body.html()}else{return $body.html(html)}},destroy:function($dialog,keepHtml){var data=$dialog.data();if(data){if(keepHtml===!1){$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}};bt.dialog.widget=function($element,jsConfig){var self=this,methods=bt.dialog.methods;self.open=function(title){return methods.open(this,title)}
+self.close=function(){return methods.close(this)}
+self.isOpen=function(){return methods.isOpen(this)}
+self.content=function(content){return methods.content(this,content)}
+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};bt.dialog.widget.prototype=new bt.widget();bt.dialog.widget.constructor=bt.dialog.widget;bt.dialog.widget.prototype.getHTMLConfig=bt.dialog.methods.getHTMLConfig;(function($){$.fn.dialog=function(method){var $widget;if(this&&this.length){if(typeof method==='object'||!method){return new bt.dialog.widget(this,method)}else{$widget=new bt.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);bt.dialog.messages['en-us']={Close:'Close',DefaultTitle:'Dialog'};bt.draggable={plugins:{}};bt.draggable.config={base:{handle:undefined,vertical:!0,horizontal:!0,containment:undefined}};bt.draggable.methods={init:function(jsConfig){var $handleEl,data,$dragEl=this;bt.widget.prototype.init.call(this,jsConfig,'draggable');data=this.data();$dragEl.attr('data-draggable','true');$handleEl=bt.draggable.methods.getHandleElement($dragEl);$handleEl.on('touchstart mousedown',function(e){var position=bt.core.position($dragEl[0]);$dragEl[0].style.top=position.top+'px';$dragEl[0].style.left=position.left+'px';$dragEl[0].style.position='fixed';$dragEl.attr('draggable-dragging',!0);$dragEl.removeAttr('draggable-x').removeAttr('draggable-y');bt.documentManager.subscribeForEvent('touchmove',$dragEl.data('guid'),bt.draggable.methods.createMoveHandler($dragEl,$handleEl,data));bt.documentManager.subscribeForEvent('mousemove',$dragEl.data('guid'),bt.draggable.methods.createMoveHandler($dragEl,$handleEl,data))});bt.documentManager.subscribeForEvent('mouseup',$dragEl.data('guid'),bt.draggable.methods.createUpHandler($dragEl));bt.documentManager.subscribeForEvent('touchend',$dragEl.data('guid'),bt.draggable.methods.createUpHandler($dragEl));bt.documentManager.subscribeForEvent('touchcancel',$dragEl.data('guid'),bt.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('draggable-dragging')==='true'){$dragEl.attr('draggable-dragging',!1);bt.documentManager.unsubscribeForEvent('mousemove',$dragEl.data('guid'));bt.documentManager.unsubscribeForEvent('touchmove',$dragEl.data('guid'));bt.draggable.events.stop($dragEl,{x:$dragEl.mouseX(e),y:$dragEl.mouseY(e)})}}},createMoveHandler:function($dragEl,$handleEl,data){return function(e){var mouseX,mouseY,offsetX,offsetY,prevX,prevY;if($dragEl.attr('draggable-dragging')==='true'){mouseX=Math.round($dragEl.mouseX(e));mouseY=Math.round($dragEl.mouseY(e));prevX=$dragEl.attr('draggable-x');prevY=$dragEl.attr('draggable-y');if(prevX&&prevY){offsetX=data.horizontal?mouseX-parseInt(prevX,10):0;offsetY=data.vertical?mouseY-parseInt(prevY,10):0;bt.draggable.methods.move($dragEl[0],data,offsetX,offsetY,mouseX,mouseY)}else{bt.draggable.events.start($dragEl,mouseX,mouseY)}
+$dragEl.attr('draggable-x',mouseX);$dragEl.attr('draggable-y',mouseY)}}},move:function(dragEl,data,offsetX,offsetY,mouseX,mouseY){var contPosition,maxTop,maxLeft,position=bt.core.position(dragEl),newTop=position.top+offsetY,newLeft=position.left+offsetX;if(data.containment){contPosition=bt.core.position(data.containment);maxTop=contPosition.top+bt.core.height(data.containment)-bt.core.height(dragEl);maxLeft=contPosition.left+bt.core.width(data.containment)-bt.core.width(dragEl);if(newTop>contPosition.top&&newTop=mouseY||contPosition.bottom<=mouseY){newTop=position.top}}else{if(newTop<=contPosition.top){newTop=contPosition.top+1}else{newTop=maxTop-1}}
+if(newLeft>contPosition.left&&newLeft=mouseX||contPosition.right<=mouseX){newLeft=position.left}}else{if(newLeft<=contPosition.left){newLeft=contPosition.left+1}else{newLeft=maxLeft-1}}}
+if(!1!==bt.draggable.events.drag($(dragEl),newTop,newLeft,mouseX,mouseY)){dragEl.style.top=newTop+'px';dragEl.style.left=newLeft+'px'}},destroy:function($dragEl){if($dragEl.attr('data-draggable')==='true'){bt.documentManager.unsubscribeForEvent('mouseup',$dragEl.data('guid'));$dragEl.removeData();$dragEl.removeAttr('data-guid');$dragEl.removeAttr('data-draggable');$dragEl.off('drag').off('start').off('stop');bt.draggable.methods.getHandleElement($dragEl).off('mousedown')}
+return $dragEl}};bt.draggable.events={drag:function($dragEl,newTop,newLeft,mouseX,mouseY){return $dragEl.triggerHandler('drag',[{top:newTop,left:newLeft},{x:mouseX,y:mouseY}])},start:function($dragEl,mouseX,mouseY){$dragEl.triggerHandler('start',[{x:mouseX,y:mouseY}])},stop:function($dragEl,mousePosition){$dragEl.triggerHandler('stop',[mousePosition])}};bt.draggable.widget=function($element,jsConfig){var self=this,methods=bt.draggable.methods;if(!$element.destroy){self.destroy=function(){return methods.destroy(this)}}
+$.extend($element,self);if('true'!==$element.attr('data-draggable')){methods.init.call($element,jsConfig)}
+return $element};bt.draggable.widget.prototype=new bt.widget();bt.draggable.widget.constructor=bt.draggable.widget;(function($){$.fn.draggable=function(method){var $widget;if(this&&this.length){if(typeof method==='object'||!method){return new bt.draggable.widget(this,method)}else{$widget=new bt.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);bt.droppable={plugins:{}};bt.droppable.config={hoverClass:undefined};bt.droppable.methods={init:function(jsConfig){var $dropEl=this;bt.widget.prototype.init.call(this,jsConfig,'droppable');$dropEl.attr('data-droppable','true');bt.documentManager.subscribeForEvent('mousedown',$dropEl.data('guid'),bt.droppable.methods.createMouseDownHandler($dropEl));bt.documentManager.subscribeForEvent('mousemove',$dropEl.data('guid'),bt.droppable.methods.createMouseMoveHandler($dropEl));bt.documentManager.subscribeForEvent('mouseup',$dropEl.data('guid'),bt.droppable.methods.createMouseUpHandler($dropEl));return $dropEl},createMouseDownHandler:function($dropEl){return function(e){$dropEl.isDragging=!0}},createMouseMoveHandler:function($dropEl){return function(e){if($dropEl.isDragging){var hoverClass=$dropEl.data('hoverClass'),mousePosition={x:$dropEl.mouseX(e),y:$dropEl.mouseY(e)},newIsOver=bt.droppable.methods.isOver($dropEl,mousePosition);if(newIsOver!=$dropEl.isOver){if(newIsOver){if(hoverClass){$dropEl.addClass(hoverClass)}
+bt.droppable.events.over($dropEl,mousePosition)}else{if(hoverClass){$dropEl.removeClass(hoverClass)}
+bt.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=!1;if(bt.droppable.methods.isOver($dropEl,mousePosition)){bt.droppable.events.drop($dropEl)}}},isOver:function($dropEl,mousePosition){var offsetTop=$dropEl.offset().top,offsetLeft=$dropEl.offset().left;return mousePosition.x>offsetLeft&&mousePosition.x<(offsetLeft+$dropEl.outerWidth(!0))&&mousePosition.y>offsetTop&&mousePosition.y<(offsetTop+$dropEl.outerHeight(!0))},destroy:function($dropEl){if($dropEl.attr('data-droppable')==='true'){bt.documentManager.unsubscribeForEvent('mousedown',$dropEl.data('guid'));bt.documentManager.unsubscribeForEvent('mousemove',$dropEl.data('guid'));bt.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}};bt.droppable.events={drop:function($dropEl,offsetX,offsetY){$dropEl.trigger('drop',[{top:offsetY,left:offsetX}])},over:function($dropEl,mousePosition){$dropEl.trigger('over',[mousePosition])},out:function($dropEl){$dropEl.trigger('out')}};bt.droppable.widget=function($element,jsConfig){var self=this,methods=bt.droppable.methods;self.isOver=!1;self.isDragging=!1;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.call($element,jsConfig)}
+return $element};bt.droppable.widget.prototype=new bt.widget();bt.droppable.widget.constructor=bt.droppable.widget;(function($){$.fn.droppable=function(method){var $widget;if(this&&this.length){if(typeof method==='object'||!method){return new bt.droppable.widget(this,method)}else{$widget=new bt.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);bt.grid={plugins:{},messages:{}};bt.grid.config={base:{dataSource:undefined,columns:[],autoGenerateColumns:!1,defaultColumnSettings:{hidden:!1,width:undefined,sortable:!1,type:'text',title:undefined,field:undefined,align:undefined,cssClass:undefined,headerCssClass:undefined,tooltip:undefined,icon:undefined,events:undefined,format:'mm/dd/yyyy',decimalDigits:undefined,tmpl:undefined,stopPropagation:!1,renderer:undefined,filter:undefined},mapping:{dataField:'records',totalRecordsField:'total'},params:{},paramNames:{sortBy:'sortBy',direction:'direction'},uiLibrary:'materialdesign',iconsLibrary:'materialicons',selectionType:'single',selectionMethod:'basic',autoLoad:!0,notFoundText:undefined,width:undefined,minWidth:undefined,headerRowHeight:'fixed',bodyRowHeight:'autogrow',fontSize:undefined,primaryKey:undefined,locale:'en-us',defaultIconColumnWidth:70,defaultCheckBoxColumnWidth:70,style:{wrapper:'bt-grid-wrapper',table:'bt-grid bt-grid-md',loadingCover:'bt-grid-loading-cover',loadingText:'bt-grid-loading-text',header:{cell:undefined,sortable:'bt-cursor-pointer bt-unselectable'},content:{rowSelected:'bt-grid-md-select'}},icons:{asc:'â–²',desc:'â–¼'}},bootstrap:{style:{wrapper:'bt-grid-wrapper',table:'bt-grid bt-grid-bootstrap bt-grid-bootstrap-3 table table-bordered table-hover',content:{rowSelected:'active'}},iconsLibrary:'glyphicons',defaultIconColumnWidth:34,defaultCheckBoxColumnWidth:36},bootstrap4:{style:{wrapper:'bt-grid-wrapper',table:'bt-grid bt-grid-bootstrap bt-grid-bootstrap-4 table table-bordered table-hover',content:{rowSelected:'active'}},defaultIconColumnWidth:42,defaultCheckBoxColumnWidth:44},materialicons:{icons:{asc:' ',desc:' '}},fontawesome:{icons:{asc:' ',desc:' '}},glyphicons:{icons:{asc:' ',desc:' '}}};bt.grid.events={beforeEmptyRowInsert:function($grid,$row){return $grid.triggerHandler('beforeEmptyRowInsert',[$row])},dataBinding:function($grid,records){return $grid.triggerHandler('dataBinding',[records])},dataBound:function($grid,records,totalRecords){return $grid.triggerHandler('dataBound',[records,totalRecords])},rowDataBound:function($grid,$row,id,record){return $grid.triggerHandler('rowDataBound',[$row,id,record])},cellDataBound:function($grid,$displayEl,id,column,record){return $grid.triggerHandler('cellDataBound',[$displayEl,id,column,record])},rowSelect:function($grid,$row,id,record){return $grid.triggerHandler('rowSelect',[$row,id,record])},rowUnselect:function($grid,$row,id,record){return $grid.triggerHandler('rowUnselect',[$row,id,record])},rowRemoving:function($grid,$row,id,record){return $grid.triggerHandler('rowRemoving',[$row,id,record])},destroying:function($grid){return $grid.triggerHandler('destroying')},columnHide:function($grid,column){return $grid.triggerHandler('columnHide',[column])},columnShow:function($grid,column){return $grid.triggerHandler('columnShow',[column])},initialized:function($grid){return $grid.triggerHandler('initialized')},dataFiltered:function($grid,records){return $grid.triggerHandler('dataFiltered',[records])}};bt.grid.methods={init:function(jsConfig){bt.widget.prototype.init.call(this,jsConfig,'grid');bt.grid.methods.initialize(this);if(this.data('autoLoad')){this.reload()}
+return this},getConfig:function(jsConfig,type){var config=bt.widget.prototype.getConfig.call(this,jsConfig,type);bt.grid.methods.setDefaultColumnConfig(config.columns,config.defaultColumnSettings);return config},setDefaultColumnConfig:function(columns,defaultColumnSettings){var column,i;if(columns&&columns.length){for(i=0;i tr > th').each(function(){var $el=$(this),title=$el.text(),config=bt.widget.prototype.getHTMLConfig.call($el);config.title=title;if(!config.field){config.field=title}
+if(config.events){config.events=bt.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;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($grid){var data=$grid.data(),$wrapper=$grid.parent('div[data-role="wrapper"]');bt.grid.methods.localization(data);if($wrapper.length===0){$wrapper=$('
').addClass(data.style.wrapper);$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)}
+if(data.headerRowHeight==='autogrow'){$grid.addClass('autogrow-header-row')}
+if(data.bodyRowHeight==='fixed'){$grid.addClass('fixed-body-rows')}
+$grid.addClass(data.style.table);if('checkbox'===data.selectionMethod){data.columns.splice(bt.grid.methods.getColumnPositionNotInRole($grid),0,{title:'',width:data.defaultCheckBoxColumnWidth,align:'center',type:'checkbox',role:'selectRow',events:{click:function(e){bt.grid.methods.setSelected($grid,e.data.id,$(this).closest('tr'))}},headerCssClass:'bt-grid-select-all',stopPropagation:!0})}
+if($grid.children('tbody').length===0){$grid.append($(' '))}
+bt.grid.methods.renderHeader($grid);bt.grid.methods.appendEmptyRow($grid,' ');bt.grid.events.initialized($grid)},localization:function(data){if(!data.notFoundText){data.notFoundText=bt.grid.messages[data.locale].NoRecordsFound}},renderHeader:function($grid){var data,columns,style,$thead,$row,$cell,$title,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 ');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('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.checkbox({uiLibrary:data.uiLibrary})}
+$checkAllBoxes.off('click').on('click',function(){if(this.checked){$grid.selectAll()}else{$grid.unSelectAll()}})}else{$title=$('
').html(typeof(columns[i].title)==='undefined'?columns[i].field:columns[i].title);$cell.append($title);if(columns[i].sortable){$title.addClass(style.sortable);$title.on('click',bt.grid.methods.createSortHandler($grid,columns[i]))}}
+if(columns[i].hidden){$cell.hide()}
+$row.append($cell)}
+$thead.empty().append($row)},createSortHandler:function($grid,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,$cellTitle,data=$grid.data(),sortBy=data.params[data.paramNames.sortBy],direction=data.params[data.paramNames.direction];$grid.find('thead tr th [data-role="sorticon"]').remove();if(sortBy){position=bt.grid.methods.getColumnPosition($grid.data('columns'),sortBy);if(position>-1){$cellTitle=$grid.find('thead tr th:eq('+position+') div[data-role="title"]');$sortIcon=$('
').append(('desc'===direction)?data.icons.desc:data.icons.asc);$cellTitle.after($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;bt.grid.methods.stopLoading($grid);data=$grid.data();if(0===$grid.outerHeight()){return}
+$tbody=$grid.children('tbody');width=$tbody.outerWidth(!1);height=$tbody.outerHeight(!1);top=Math.abs($grid.parent().offset().top-$tbody.offset().top);$cover=$('
').addClass(data.style.loadingCover).css({width:width,height:height,top:top});$loading=$(''+bt.grid.messages[data.locale].Loading+'
').addClass(data.style.loadingText);$loading.insertAfter($grid);$cover.insertAfter($grid);$loading.css({top:top+(height/2)-($loading.outerHeight(!1)/2),left:(width/2)-($loading.outerWidth(!1)/2)})},stopLoading:function($grid){$grid.parent().find('div[data-role="loading-cover"]').remove();$grid.parent().find('div[data-role="loading-text"]').remove()},appendEmptyRow:function($grid,caption){var data,$row,$cell,$wrapper;data=$grid.data();$row=$(' ');$cell=$(' ').css({width:'100%','text-align':'center'});$cell.attr('colspan',bt.grid.methods.countVisibleColumns($grid));$wrapper=$('
').html(caption||data.notFoundText);$cell.append($wrapper);$row.append($cell);bt.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-1){type='date'}}
+data.columns.push({field:names[i],type:type})}
+bt.grid.methods.setDefaultColumnConfig(data.columns,data.defaultColumnSettings)}
+bt.grid.methods.renderHeader($grid)},loadData:function($grid){var data,records,i,recLen,rowCount,$tbody,$rows,$row;data=$grid.data();records=$grid.getAll();bt.grid.events.dataBinding($grid,records);recLen=records.length;bt.grid.methods.stopLoading($grid);if(data.autoGenerateColumns){bt.grid.methods.autoGenerateColumns($grid,records)}
+$tbody=$grid.children('tbody');if('checkbox'===data.selectionMethod&&'multiple'===data.selectionType){$grid.find('thead input[data-role="selectAll"]').prop('checked',!1)}
+$tbody.children('tr').not('[data-role="row"]').remove();if(0===recLen){$tbody.empty();bt.grid.methods.appendEmptyRow($grid)}
+$rows=$tbody.children('tr');rowCount=$rows.length;for(i=0;i ');$grid.children('tbody').append($row)}else{mode='update';$row.removeClass(data.style.content.rowSelected).removeAttr('data-selected').off('click')}
+id=bt.grid.methods.getId(record,data.primaryKey,(position+1));$row.attr('data-position',position+1);if(data.selectionMethod!=='checkbox'){$row.on('click',bt.grid.methods.createRowClickHandler($grid,id))}
+for(i=0;i ');$displayEl=$('
');column.align&&$cell.css('text-align',column.align);column.cssClass&&$cell.addClass(column.cssClass);$cell.append($displayEl);mode='create'}else{$displayEl=$cell.find('div[data-role="display"]');mode='update'}
+bt.grid.methods.renderDisplayElement($grid,$displayEl,column,record,id,mode);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},bt.grid.methods.createCellEventHandler(column,column.events[key]))}}}
+if(column.hidden){$cell.hide()}
+bt.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&&bt.checkbox){if('create'===mode){$checkbox=$(' ').val(id).prop('checked',(record[column.field]?!0:!1));column.role&&$checkbox.attr('data-role',column.role);$displayEl.append($checkbox);$checkbox.checkbox({uiLibrary:$grid.data('uiLibrary')});if(column.role==='selectRow'){$checkbox.on('click',function(){return!1})}else{$checkbox.prop('disabled',!0)}}else{$displayEl.find('input[type="checkbox"]').val(id).prop('checked',(record[column.field]?!0:!1))}}else if('icon'===column.type){if('create'===mode){$displayEl.append($(' ').addClass(column.icon).css({cursor:'pointer'}));$grid.data().uiLibrary==='bootstrap'&&$displayEl.children('span').addClass('glyphicon');column.stopPropagation=!0}}else if(column.tmpl){text=column.tmpl;column.tmpl.replace(/\{(.+?)\}/g,function($0,$1){text=text.replace($0,bt.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{record[column.field]=bt.grid.methods.formatText(record[column.field],column);if(!column.tooltip&&record[column.field]){$displayEl.attr('title',record[column.field])}
+$displayEl.html(record[column.field])}
+if(column.tooltip&&'create'===mode){$displayEl.attr('title',column.tooltip)}},formatText:function(text,column){if(text&&column.type==='date'){text=bt.core.formatDate(bt.core.parseDate(text,column.format),column.format)}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(){bt.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',!0);if('multiple'===data.selectionType&&$grid.getSelections().length===$grid.count(!1)){$grid.find('thead input[data-role="selectAll"]').prop('checked',!0)}}
+return bt.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',!1);if('multiple'===data.selectionType){$grid.find('thead input[data-role="selectAll"]').prop('checked',!1)}}
+$row.removeAttr('data-selected');return bt.grid.events.rowUnselect($grid,$row,id,$grid.getById(id))}},setSelected:function($grid,id,$row){var data=$grid.data();if(!$row||!$row.length){$row=bt.grid.methods.getRowById($grid,id)}
+if($row){if($row.attr('data-selected')==='true'){bt.grid.methods.unselectRow($grid,data,$row,id)}else{if('single'===data.selectionType){$row.siblings('[data-selected="true"]').each(function(){var $row=$(this),id=bt.grid.methods.getId($row,data.primaryKey,$row.data('position'));bt.grid.methods.unselectRow($grid,data,$row,id)})}
+bt.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),position=$row.data('position'),record=$grid.get(position),id=bt.grid.methods.getId(record,data.primaryKey,position);bt.grid.methods.selectRow($grid,data,$row,id)});$grid.find('thead input[data-role="selectAll"]').prop('checked',!0);return $grid},unSelectAll:function($grid){var data=$grid.data();$grid.find('tbody tr').each(function(){var $row=$(this),position=$row.data('position'),record=$grid.get(position),id=bt.grid.methods.getId(record,data.primaryKey,position);bt.grid.methods.unselectRow($grid,data,$row,id);$row.find('input[type="checkbox"][data-role="selectRow"]').prop('checked',!1)});$grid.find('thead input[data-role="selectAll"]').prop('checked',!1);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=bt.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,data=$grid.data(),$selections=bt.grid.methods.getSelectedRows($grid);if(0<$selections.length){$selections.each(function(){position=$(this).data('position');record=$grid.get(position);result.push(bt.grid.methods.getId(record,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-1){$row=bt.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=bt.grid.methods.getCell($grid,id,field);if($displayEl){$displayEl.empty();if(typeof(value)==='object'){$displayEl.append(value)}else{column=bt.grid.methods.getColumnInfo($grid,field);bt.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-1)})}}
+bt.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){bt.grid.events.destroying($grid);bt.grid.methods.stopLoading($grid);$grid.xhr&&$grid.xhr.abort();$grid.off();if(keepWrapperTag===!1&&$grid.parent('div[data-role="wrapper"]').length>0){$grid.unwrap()}
+$grid.removeData();if(keepTableTag===!1){$grid.remove()}else{$grid.removeClass().empty()}
+$grid.removeAttr('data-type')}
+return $grid},showColumn:function($grid,field){var data=$grid.data(),position=bt.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=!1;$cells=$grid.find('tbody > tr[data-role="empty"] > td');if($cells&&$cells.length){$cells.attr('colspan',bt.grid.methods.countVisibleColumns($grid))}
+bt.grid.events.columnShow($grid,data.columns[position])}
+return $grid},hideColumn:function($grid,field){var data=$grid.data(),position=bt.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=!0;$cells=$grid.find('tbody > tr[data-role="empty"] > td');if($cells&&$cells.length){$cells.attr('colspan',bt.grid.methods.countVisibleColumns($grid))}
+bt.grid.events.columnHide($grid,data.columns[position])}
+return $grid},isLastRecordVisible:function(){return!0},addRow:function($grid,record){var data=$grid.data();data.totalRecords=$grid.data('totalRecords')+1;bt.grid.events.dataBinding($grid,[record]);data.records.push(record);if($.isArray(data.dataSource)){data.dataSource.push(record)}
+if(data.totalRecords===1){$grid.children('tbody').empty()}
+if(bt.grid.methods.isLastRecordVisible($grid)){bt.grid.methods.renderRow($grid,null,record,$grid.count()-1)}
+bt.grid.events.dataBound($grid,[record],data.totalRecords);return $grid},updateRow:function($grid,id,record){var $row=bt.grid.methods.getRowById($grid,id),data=$grid.data(),position;data.records[$row.data('position')-1]=record;if($.isArray(data.dataSource)){position=bt.grid.methods.getRecVPosById($grid,id);data.dataSource[position]=record}
+bt.grid.methods.renderRow($grid,$row,record,$row.index());return $grid},removeRow:function($grid,id){var position,data=$grid.data(),$row=bt.grid.methods.getRowById($grid,id);bt.grid.events.rowRemoving($grid,$row,id,$grid.getById(id));if($.isArray(data.dataSource)){position=bt.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},getColumnPositionByRole:function($grid,role){var i,result,columns=$grid.data('columns');for(i=0;i-1?1:0))}else{$tbody.css('width',$thead.outerWidth())}
+for(i=0;i<$theadCells.length;i++){width=$($theadCells[i]).outerWidth();if(i===0&&bt.core.isIE()){width=width-1}
+$($tbodyCells[i]).attr('width',width)}},getRowsHeight:function($grid){var total=0;$grid.find('tbody tr').each(function(){total+=$(this).height()});return total},getScrollBarWidth:function(){var inner=document.createElement('p');inner.style.width="100%";inner.style.height="200px";var outer=document.createElement('div');outer.style.position="absolute";outer.style.top="0px";outer.style.left="0px";outer.style.visibility="hidden";outer.style.width="200px";outer.style.height="150px";outer.style.overflow="hidden";outer.appendChild(inner);document.body.appendChild(outer);var w1=inner.offsetWidth;outer.style.overflow='scroll';var w2=inner.offsetWidth;if(w1==w2)w2=outer.clientWidth;document.body.removeChild(outer);return(w1-w2)}},public:{},events:{},configure:function($grid,fullConfig,clientConfig){$.extend(!0,$grid,bt.grid.plugins.fixedHeader.public);var data=$grid.data();if(clientConfig.fixedHeader){$grid.on('initialized',function(){bt.grid.plugins.fixedHeader.private.init($grid)});$grid.on('dataBound',function(){bt.grid.plugins.fixedHeader.private.refresh($grid)});$grid.on('resize',function(){bt.grid.plugins.fixedHeader.private.refresh($grid)})}}};bt.grid.plugins.expandCollapseRows={config:{base:{detailTemplate:undefined,keepExpandedRows:!0,expandedRows:[],icons:{expandRow:' ',collapseRow:' '}},fontawesome:{icons:{expandRow:' ',collapseRow:' '}},glyphicons:{icons:{expandRow:' ',collapseRow:' '}}},'private':{expandDetail:function($grid,$cell,id){var $contentRow=$cell.closest('tr'),$detailsRow=$(' '),$detailsCell=$(' '),$detailsWrapper=$('
'),data=$grid.data(),position=$contentRow.data('position'),record=$grid.get(position),plugin=bt.grid.plugins.expandCollapseRows;if(typeof(id)===undefined){id=bt.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.collapseRow);$grid.updateDetails($contentRow);plugin.private.keepSelection($grid,id);plugin.events.detailExpand($grid,$detailsRow.find('td>div'),id)},collapseDetail:function($grid,$cell,id){var $contentRow=$cell.closest('tr'),$detailsRow=$contentRow.next('tr[data-role="details"]'),data=$grid.data(),plugin=bt.grid.plugins.expandCollapseRows;if(typeof(id)===undefined){id=bt.grid.methods.getId(record,data.primaryKey,record)}
+$detailsRow.remove();$cell.children('div[data-role="display"]').empty().append(data.icons.expandRow);plugin.private.removeSelection($grid,id);plugin.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',bt.grid.methods.countVisibleColumns($grid))}}},'public':{collapseAll:function(){var $grid=this,data=$grid.data(),position;if(typeof(data.detailTemplate)!=='undefined'){position=bt.grid.methods.getColumnPositionByRole($grid,'expander');$grid.find('tbody tr[data-role="row"]').each(function(){bt.grid.plugins.expandCollapseRows.private.collapseDetail($grid,$(this).find('td:eq('+position+')'))})}
+if(typeof(data.grouping)!=='undefined'){$grid.find('tbody tr[role="group"]').each(function(){bt.grid.plugins.grouping.private.collapseGroup(data,$(this).find('td:eq(0)'))})}
+return $grid},expandAll:function(){var $grid=this,data=$grid.data(),position;if(typeof(data.detailTemplate)!=='undefined'){position=bt.grid.methods.getColumnPositionByRole($grid,'expander');$grid.find('tbody tr[data-role="row"]').each(function(){bt.grid.plugins.expandCollapseRows.private.expandDetail($grid,$(this).find('td:eq('+position+')'))})}
+if(typeof(data.grouping)!=='undefined'){$grid.find('tbody tr[role="group"]').each(function(){bt.grid.plugins.grouping.private.expandGroup(data,$(this).find('td:eq(0)'))})}
+return $grid},updateDetails:function($contentRow){var $grid=this,$detailWrapper=$contentRow.data('details'),content=$detailWrapper.html(),record=$grid.get($contentRow.data('position'));if(record&&content){$detailWrapper.html().replace(/\{(.+?)\}/g,function($0,$1){var column=bt.grid.methods.getColumnInfo($grid,$1);content=content.replace($0,bt.grid.methods.formatText(record[$1],column))});$detailWrapper.html(content)}
+return $grid}},'events':{detailExpand:function($grid,$detailWrapper,id){$grid.triggerHandler('detailExpand',[$detailWrapper,id])},detailCollapse:function($grid,$detailWrapper,id){$grid.triggerHandler('detailCollapse',[$detailWrapper,id])}},'configure':function($grid){var column,data=$grid.data();$.extend(!0,$grid,bt.grid.plugins.expandCollapseRows.public);if(typeof(data.detailTemplate)!=='undefined'){column={title:'',width:data.defaultIconColumnWidth,align:'center',stopPropagation:!0,cssClass:'bt-cursor-pointer bt-unselectable',tmpl:data.icons.expandRow,role:'expander',events:{'click':function(e){var $cell=$(this),methods=bt.grid.plugins.expandCollapseRows.private;if($cell.closest('tr').next().attr('data-role')==='details'){methods.collapseDetail($grid,$cell,e.data.id)}else{methods.expandDetail($grid,$(this),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){bt.grid.plugins.expandCollapseRows.private.updateDetailsColSpan($grid)});$grid.on('columnHide',function(e,column){bt.grid.plugins.expandCollapseRows.private.updateDetailsColSpan($grid)});$grid.on('rowRemoving',function(e,$row,id,record){bt.grid.plugins.expandCollapseRows.private.collapseDetail($grid,$row.children('td').first(),id)});$grid.on('dataBinding',function(){$grid.collapseAll()});$grid.on('pageChanging',function(){$grid.collapseAll()});$grid.on('dataBound',function(){var i,$cell,$row,position,data=$grid.data();if(data.keepExpandedRows&&$.isArray(data.expandedRows)){for(i=0;i '+bt.grid.messages[data.locale].Edit+'';data.inlineEditing.deleteButton=' '+bt.grid.messages[data.locale].Delete+' ';data.inlineEditing.updateButton=' '+bt.grid.messages[data.locale].Update+' ';data.inlineEditing.cancelButton=' '+bt.grid.messages[data.locale].Cancel+' '}else{data.inlineEditing.editButton=' '+bt.grid.messages[data.locale].Edit.toUpperCase()+' ';data.inlineEditing.deleteButton=' '+bt.grid.messages[data.locale].Delete.toUpperCase()+' ';data.inlineEditing.updateButton=' '+bt.grid.messages[data.locale].Update.toUpperCase()+' ';data.inlineEditing.cancelButton=' '+bt.grid.messages[data.locale].Cancel.toUpperCase()+' '}},editMode:function($grid,$cell,column,record){var $displayContainer,$editorContainer,$editorField,value,config,data=$grid.data();if($cell.attr('data-mode')!=='edit'){if(column.editor){bt.grid.plugins.inlineEditing.private.updateOtherCells($grid,column.mode);$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.editField||column.field];$editorField=$editorContainer.find('input, select, textarea').first();if($editorField.length){column.type==='checkbox'?$editorField.prop('checked',value):$editorField.val(value)}else{if(typeof(column.editor)==='function'){column.editor($editorContainer,value,record);$editorField=$editorContainer.find('input, select, textarea').first()}else{config=typeof column.editor==="object"?column.editor:{};config.uiLibrary=data.uiLibrary;config.iconsLibrary=data.iconsLibrary;config.fontSize=$grid.css('font-size');if('checkbox'===column.type&&bt.checkbox){$editorField=$(' ').prop('checked',value);$editorContainer.append($editorField);$editorField.checkbox(config)}else if('date'===column.type&&bt.datepicker){$editorField=$(' ');$editorContainer.append($editorField);if(column.format){config.format=column.format}
+$editorField=$editorField.datepicker(config);if($editorField.value){$editorField.value($displayContainer.html())}}else if('dropdown'===column.type&&bt.dropdown){$editorField=$(' ');$editorContainer.append($editorField);config.dataBound=function(e){var $dropdown=$(this).dropdown();if(column.editField){$dropdown.value(record[column.editField])}else{$dropdown.value(record[column.field])}};$editorField=$editorField.dropdown(config)}else{$editorField=$(' ');if(data.uiLibrary==='materialdesign'){$editorField.addClass('bt-textbox-md').css('font-size',$grid.css('font-size'))}
+$editorContainer.append($editorField)}}
+if(data.inlineEditing.mode!=='command'&&column.mode!=='editOnly'){$editorField=$editorContainer.find('input, select, textarea').first();$editorField.on('keyup',function(e){if(e.keyCode===13||e.keyCode===27){bt.grid.plugins.inlineEditing.private.displayMode($grid,$cell,column)}})}}
+if($editorField.prop('tagName').toUpperCase()==="INPUT"&&$editorField.prop('type').toUpperCase()==='TEXT'){bt.grid.plugins.inlineEditing.private.setCaretAtEnd($editorField[0])}else{$editorField.focus()}
+$cell.attr('data-mode','edit')}else if(column.role==='managementColumn'){$cell.find('[role="edit"]').hide();$cell.find('[role="delete"]').hide();$cell.find('[role="update"]').show();$cell.find('[role="cancel"]').show()}}},setCaretAtEnd:function(elem){var elemLen;if(elem){elemLen=elem.value.length;if(document.selection){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'){elem.selectionStart=elemLen;elem.selectionEnd=elemLen;elem.focus()}}},displayMode:function($grid,$cell,column,cancel){var $editorContainer,$displayContainer,$ele,newValue,newEditFieldValue,record,position,style='';if(column.mode!=='editOnly'){if($cell.attr('data-mode')==='edit'){$editorContainer=$cell.find('div[data-role="edit"]');$displayContainer=$cell.find('div[data-role="display"]');$ele=$editorContainer.find('input, select, textarea').first();if($ele[0].tagName.toUpperCase()==="SELECT"&&$ele[0].selectedIndex>-1){newValue=$ele[0].options[$ele[0].selectedIndex].innerHTML;newEditFieldValue=$ele[0].value}else if($ele[0].tagName.toUpperCase()==="INPUT"&&$ele[0].type.toUpperCase()==="CHECKBOX"){newValue=$ele[0].checked}else{newValue=$ele.val()}
+position=$cell.parent().data('position');record=$grid.get(position);if(cancel!==!0&&newValue!==record[column.field]){record[column.field]=column.type==='date'?bt.core.parseDate(newValue,column.format):newValue;if(column.editField){record[column.editField]=newEditFieldValue||newValue}
+if(column.mode!=='editOnly'){bt.grid.methods.renderDisplayElement($grid,$displayContainer,column,record,bt.grid.methods.getId(record,$grid.data('primaryKey'),position),'update');if($cell.find('span.bt-dirty').length===0){$cell.prepend($(' '))}}
+bt.grid.plugins.inlineEditing.events.cellDataChanged($grid,$cell,column,record,newValue);bt.grid.plugins.inlineEditing.private.updateChanges($grid,column,record,newValue)}
+$editorContainer.hide();$displayContainer.show();$cell.attr('data-mode','display')}
+if(column.role==='managementColumn'){$cell.find('[role="update"]').hide();$cell.find('[role="cancel"]').hide();$cell.find('[role="edit"]').show();$cell.find('[role="delete"]').show()}}},updateOtherCells:function($grid,mode){var data=$grid.data();if(data.inlineEditing.mode!=='command'&&mode!=='editOnly'){$grid.find('div[data-role="edit"]:visible').parent('td').each(function(){var $cell=$(this),column=data.columns[$cell.index()];bt.grid.plugins.inlineEditing.private.displayMode($grid,$cell,column)})}},updateChanges:function($grid,column,sourceRecord,newValue){var targetRecords,filterResult,newRecord,data=$grid.data();if(!data.guid){data.guid=bt.grid.plugins.inlineEditing.private.generateGUID()}
+if(data.primaryKey){targetRecords=JSON.parse(sessionStorage.getItem('bt.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('bt.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()}};bt.grid.plugins.inlineEditing.public={getChanges:function(){return JSON.parse(sessionStorage.getItem('bt.grid.'+this.data().guid))},edit:function(id){var i,record=this.getById(id),$cells=bt.grid.methods.getRowById(this,id).children('td'),columns=this.data('columns');for(i=0;i<$cells.length;i++){bt.grid.plugins.inlineEditing.private.editMode(this,$($cells[i]),columns[i],record)}
+return this},update:function(id){var i,record=this.getById(id),$cells=bt.grid.methods.getRowById(this,id).children('td'),columns=this.data('columns');for(i=0;i<$cells.length;i++){bt.grid.plugins.inlineEditing.private.displayMode(this,$($cells[i]),columns[i],!1)}
+bt.grid.plugins.inlineEditing.events.rowDataChanged(this,id,record);return this},cancel:function(id){var i,record=this.getById(id),$cells=bt.grid.methods.getRowById(this,id).children('td'),columns=this.data('columns');for(i=0;i<$cells.length;i++){bt.grid.plugins.inlineEditing.private.displayMode(this,$($cells[i]),columns[i],!0)}
+return this}};bt.grid.plugins.inlineEditing.events={cellDataChanged:function($grid,$cell,column,record,oldValue,newValue){$grid.triggerHandler('cellDataChanged',[$cell,column,record,oldValue,newValue])},rowDataChanged:function($grid,id,record){$grid.triggerHandler('rowDataChanged',[id,record])}};bt.grid.plugins.inlineEditing.configure=function($grid,fullConfig,clientConfig){var data=$grid.data();$.extend(!0,$grid,bt.grid.plugins.inlineEditing.public);if(clientConfig.inlineEditing){$grid.on('dataBound',function(){$grid.find('span.bt-dirty').remove()});$grid.on('rowDataBound',function(e,$row,id,record){$grid.cancel(id)})}
+if(data.inlineEditing.mode==='command'){bt.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){if(column.mode==='editOnly'){bt.grid.plugins.inlineEditing.private.editMode($grid,$displayEl.parent(),column,record)}else{$displayEl.parent('td').on(data.inlineEditing.mode==='dblclick'?'dblclick':'click',function(){bt.grid.plugins.inlineEditing.private.editMode($grid,$displayEl.parent(),column,record)})}}})}};bt.grid.plugins.optimisticPersistence={config:{base:{optimisticPersistence:{localStorage:undefined,sessionStorage:undefined}}},private:{applyParams:function($grid){var data=$grid.data(),params={},storage;storage=JSON.parse(sessionStorage.getItem('bt.grid.'+data.guid));if(storage&&storage.optimisticPersistence){$.extend(params,storage.optimisticPersistence)}
+storage=JSON.parse(localStorage.getItem('bt.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',previous:' ',next:' ',last:' ',refresh:' '}},materialicons:{icons:{first:' ',previous:' ',next:' ',last:' ',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}
+bt.grid.plugins.pagination.private.localization(data);$row=$(' ');$cell=$(' ');$row.append($cell);$leftPanel=$('
').addClass(data.style.pager.panel).css({'float':'left'});$rightPanel=$('
').addClass(data.style.pager.panel).css({'float':'right'});$cell.append($leftPanel).append($rightPanel);$tfoot=$(' ').append($row);$grid.append($tfoot);bt.grid.plugins.pagination.private.updatePagerColSpan($grid);leftControls=bt.grid.methods.clone(data.pager.leftControls);$.each(leftControls,function(){$leftPanel.append(this)});rightControls=bt.grid.methods.clone(data.pager.rightControls);$.each(rightControls,function(){$rightPanel.append(this)});controls=$grid.find('tfoot [data-role]');for(i=0;i'+(data.icons.first||msg.First)+'').attr('title',msg.FirstPageTooltip).attr('data-role','page-first'),$(''+(data.icons.previous||msg.Previous)+' ').attr('title',msg.PreviousPageTooltip).attr('data-role','page-previous'),$(''+msg.Page+'
'),$(' '),$(''+msg.Of+'
'),$('0
'),$(''+(data.icons.next||msg.Next)+' ').attr('title',msg.NextPageTooltip).attr('data-role','page-next'),$(''+(data.icons.last||msg.Last)+' ').attr('title',msg.LastPageTooltip).attr('data-role','page-last'),$(''+(data.icons.refresh||msg.Refresh)+' ').attr('title',msg.Refresh).attr('data-role','page-refresh'),$(' ')]}
+if(typeof(data.pager.rightControls)==='undefined'){data.pager.rightControls=[$(''+msg.DisplayingRecords+'
'),$('0
'),$('-
'),$('0
'),$(''+msg.Of+'
'),$('0
')]}},localizationBootstrap4:function(data){var msg=bt.grid.messages[data.locale];if(typeof(data.pager.leftControls)==='undefined'){data.pager.leftControls=[$(''+(data.icons.first||msg.First)+' ').attr('title',msg.FirstPageTooltip).attr('data-role','page-first'),$(''+(data.icons.previous||msg.Previous)+' ').attr('title',msg.PreviousPageTooltip).attr('data-role','page-previous'),$(''+msg.Page+'
'),$('
'),$(''+msg.Of+'
'),$('0
'),$(''+(data.icons.next||msg.Next)+' ').attr('title',msg.NextPageTooltip).attr('data-role','page-next'),$(''+(data.icons.last||msg.Last)+' ').attr('title',msg.LastPageTooltip).attr('data-role','page-last'),$(''+(data.icons.refresh||msg.Refresh)+' ').attr('title',msg.Refresh).attr('data-role','page-refresh'),$(' ')]}
+if(typeof(data.pager.rightControls)==='undefined'){data.pager.rightControls=[$(''+msg.DisplayingRecords+'
'),$('0
'),$('-
'),$('0
'),$(''+msg.Of+'
'),$('0
')]}},localizationMaterialDesign:function(data){var msg=bt.grid.messages[data.locale];if(typeof(data.pager.leftControls)==='undefined'){data.pager.leftControls=[]}
+if(typeof(data.pager.rightControls)==='undefined'){data.pager.rightControls=[$(''+msg.RowsPerPage+' '),$(' '),$(' '),$('0 '),$('- '),$('0 '),$(''),$('0 '),$(' '),$(''+(data.icons.previous||msg.Previous)+' ').attr('title',msg.PreviousPageTooltip).attr('data-role','page-previous').addClass(data.icons.first?'bt-button-md-icon':''),$(' '),$(''+(data.icons.next||msg.Next)+' ').attr('title',msg.NextPageTooltip).attr('data-role','page-next').addClass(data.icons.first?'bt-button-md-icon':'')]}},initPagerControl:function($control,$grid){var data=$grid.data();switch($control.data('role')){case 'page-size':if(data.pager.sizes&&0 ').attr('value',this.toString()).text(this.toString()))});$control.change(function(){var newSize=parseInt(this.value,10);data.params[data.paramNames.limit]=newSize;bt.grid.plugins.pagination.private.changePage($grid,1);bt.grid.plugins.pagination.events.pageSizeChange($grid,newSize)});$control.val(data.params[data.paramNames.limit]);if(bt.dropdown){$control.dropdown({uiLibrary:data.uiLibrary,iconsLibrary:data.iconsLibrary,fontSize:$control.css('font-size'),style:{presenter:'btn btn-default btn-sm'}})}}else{$control.hide()}
+break;case 'page-refresh':$control.on('click',function(){$grid.reload()});break}},reloadPager:function($grid,totalRecords){var page,limit,lastPage,firstRecord,lastRecord,data,controls,i;data=$grid.data();if(data.pager){page=(0===totalRecords)?0:parseInt(data.params[data.paramNames.page],10);limit=parseInt(data.params[data.paramNames.limit],10);lastPage=Math.ceil(totalRecords/limit);firstRecord=(0===page)?0:(limit*(page-1))+1;lastRecord=(firstRecord+limit)>totalRecords?totalRecords:(firstRecord+limit)-1;controls=$grid.find('TFOOT [data-role]');for(i=0;ilastPage){$control.hide()}else{$control.show().off('click').text(newPage);if(newPage===page){$control.addClass(style.activeButton)}else{$control.removeClass(style.activeButton).on('click',function(){bt.grid.plugins.pagination.private.changePage($grid,newPage)})}}},createChangePageHandler:function($grid,currentPage){return function(){var data=$grid.data(),newPage=parseInt(this.value,10);bt.grid.plugins.pagination.private.changePage($grid,newPage)}},changePage:function($grid,newPage){var data=$grid.data();if(bt.grid.plugins.pagination.events.pageChanging($grid,newPage)!==!1&&!isNaN(newPage)){$grid.find('TFOOT [data-role="page-number"]').val(newPage);data.params[data.paramNames.page]=newPage}
+$grid.reload()},updatePagerColSpan:function($grid){var $cell=$grid.find('tfoot > tr[data-role="pager"] > th');if($cell&&$cell.length){$cell.attr('colspan',bt.grid.methods.countVisibleColumns($grid))}},isLastRecordVisible:function($grid){var result=!0,data=$grid.data(),limit=parseInt(data.params[data.paramNames.limit],10),page=parseInt(data.params[data.paramNames.page],10),count=$grid.count();if(limit&&page){result=((page-1)*limit)+count===data.totalRecords}
+return result}},public:{getAll:function(includeAllRecords){var limit,page,start,data=this.data();if($.isArray(data.dataSource)){if(includeAllRecords){return data.dataSource}else if(data.params[data.paramNames.limit]&&data.params[data.paramNames.page]){limit=parseInt(data.params[data.paramNames.limit],10);page=parseInt(data.params[data.paramNames.page],10);start=(page-1)*limit;return data.records.slice(start,start+limit)}else{return data.records}}else{return data.records}}},events:{pageSizeChange:function($grid,newSize){$grid.triggerHandler('pageSizeChange',[newSize])},pageChanging:function($grid,newSize){$grid.triggerHandler('pageChanging',[newSize])}},configure:function($grid,fullConfig,clientConfig){$.extend(!0,$grid,bt.grid.plugins.pagination.public);var data=$grid.data();if(clientConfig.pager){bt.grid.methods.isLastRecordVisible=bt.grid.plugins.pagination.private.isLastRecordVisible;$grid.on('initialized',function(){bt.grid.plugins.pagination.private.init($grid)});$grid.on('dataBound',function(e,records,totalRecords){bt.grid.plugins.pagination.private.reloadPager($grid,totalRecords)});$grid.on('columnShow',function(){bt.grid.plugins.pagination.private.updatePagerColSpan($grid)});$grid.on('columnHide',function(){bt.grid.plugins.pagination.private.updatePagerColSpan($grid)})}}};bt.grid.plugins.responsiveDesign={config:{base:{resizeCheckInterval:500,responsive:!1,showHiddenColumnsAsDetails:!1,defaultColumn:{priority:undefined,minWidth:250},style:{rowDetailItem:''}},bootstrap:{style:{rowDetailItem:'col-lg-4'}}},'private':{orderColumns:function(config){var result=[];if(config.columns&&config.columns.length){for(i=0;ib.priority){result=1}
+return result})}
+return result},updateDetails:function($grid){var rows,data,i,j,$row,details,$placeholder,column,tmp;rows=$grid.find('tbody > tr[data-role="row"]');data=$grid.data();for(i=0;i'+(column.title||column.field)+': {'+column.field+'}';if(!$placeholder||!$placeholder.length){$placeholder=$('
').html(tmp);$placeholder.addClass(data.style.rowDetailItem);if(!details||!details.length){details=$('
')}
+details.append($placeholder)}else{$placeholder.empty().html(tmp)}}else if($placeholder&&$placeholder.length){$placeholder.remove()}}
+$grid.updateDetails($row)}}},'public':{oldWidth:undefined,resizeCheckIntervalId:undefined,makeResponsive:function(){var i,$column,extraWidth=0,config=this.data(),columns=bt.grid.plugins.responsiveDesign.private.orderColumns(config);for(i=0;itr>th:eq('+columns[i].position+')');if($column.is(':visible')&&columns[i].minWidth<$column.width()){extraWidth+=$column.width()-columns[i].minWidth}}
+if(extraWidth){for(i=0;itr>th:eq('+columns[i].position+')');if(!$column.is(':visible')&&columns[i].minWidth<=extraWidth){this.showColumn(columns[i].field);extraWidth-=$column.width()}}}
+for(i=(columns.length-1);i>=0;i--){$column=this.find('thead>tr>th:eq('+columns[i].position+')');if($column.is(':visible')&&columns[i].priority&&columns[i].minWidth>$column.outerWidth()){this.hideColumn(columns[i].field)}}
+return this},},'events':{resize:function($grid,newWidth,oldWidth){$grid.triggerHandler('resize',[newWidth,oldWidth])}},'configure':function($grid,fullConfig,clientConfig){$.extend(!0,$grid,bt.grid.plugins.responsiveDesign.public);if(fullConfig.responsive){$grid.on('initialized',function(){$grid.makeResponsive();$grid.oldWidth=$grid.width();$grid.resizeCheckIntervalId=setInterval(function(){var newWidth=$grid.width();if(newWidth!==$grid.oldWidth){bt.grid.plugins.responsiveDesign.events.resize($grid,newWidth,$grid.oldWidth)}
+$grid.oldWidth=newWidth},fullConfig.resizeCheckInterval)});$grid.on('destroy',function(){if($grid.resizeCheckIntervalId){clearInterval($grid.resizeCheckIntervalId)}});$grid.on('resize',function(){$grid.makeResponsive()})}
+if(fullConfig.showHiddenColumnsAsDetails&&bt.grid.plugins.expandCollapseRows){$grid.on('dataBound',function(){bt.grid.plugins.responsiveDesign.private.updateDetails($grid)});$grid.on('columnHide',function(){bt.grid.plugins.responsiveDesign.private.updateDetails($grid)});$grid.on('columnShow',function(){bt.grid.plugins.responsiveDesign.private.updateDetails($grid)});$grid.on('rowDataBound',function(){bt.grid.plugins.responsiveDesign.private.updateDetails($grid)})}}};bt.grid.plugins.toolbar={config:{base:{toolbarTemplate:undefined,title:undefined,style:{toolbar:'bt-grid-md-toolbar'}},bootstrap:{style:{toolbar:'bt-grid-bootstrap-toolbar'}},bootstrap4:{style:{toolbar:'bt-grid-bootstrap-4-toolbar'}}},private:{init:function($grid){var data,$toolbar,$title;data=$grid.data();$toolbar=$grid.prev('div[data-role="toolbar"]');if(typeof(data.toolbarTemplate)!=='undefined'||typeof(data.title)!=='undefined'||$toolbar.length>0){if($toolbar.length===0){$toolbar=$('
');$grid.before($toolbar)}
+$toolbar.addClass(data.style.toolbar);if($toolbar.children().length===0&&data.toolbarTemplate){$toolbar.append(data.toolbarTemplate)}
+$title=$toolbar.find('[data-role="title"]');if($title.length===0){$title=$('
');$toolbar.prepend($title)}
+if(data.title){$title.text(data.title)}
+if(data.minWidth){$toolbar.css('min-width',data.minWidth)}}}},public:{title:function(text){var $titleEl=this.parent().find('div[data-role="toolbar"] [data-role="title"]');if(typeof(text)!=='undefined'){$titleEl.text(text);return this}else{return $titleEl.text()}}},configure:function($grid){$.extend(!0,$grid,bt.grid.plugins.toolbar.public);$grid.on('initialized',function(){bt.grid.plugins.toolbar.private.init($grid)});$grid.on('destroying',function(){$grid.prev('[data-role="toolbar"]').remove()})}};bt.grid.plugins.resizableColumns={config:{base:{resizableColumns:!1}},private:{init:function($grid,config){var $columns,$column,i,$wrapper,$resizer,marginRight;$columns=$grid.find('thead tr[data-role="caption"] th');if($columns.length){for(i=0;i<$columns.length-1;i++){$column=$($columns[i]);$wrapper=$('
');marginRight=parseInt($column.css('padding-right'),10)+3;$resizer=$(' ').css('margin-right','-'+marginRight+'px');$resizer.draggable({start:function(){$grid.addClass('bt-unselectable');$grid.addClass('bt-grid-resize-cursor')},stop:function(){$grid.removeClass('bt-unselectable');$grid.removeClass('bt-grid-resize-cursor');this.style.removeProperty('top');this.style.removeProperty('left');this.style.removeProperty('position')},drag:bt.grid.plugins.resizableColumns.private.createResizeHandle($grid,$column,config.columns[i])});$column.append($wrapper.append($resizer))}
+for(i=0;i<$columns.length;i++){$column=$($columns[i]);if(!$column.attr('width')){$column.attr('width',$column.outerWidth())}}}},createResizeHandle:function($grid,$column,column){var data=$grid.data();return function(e,newPosition){var i,index,rows,cell,newWidth,nextWidth,currentWidth=parseInt($column.attr('width'),10),position=bt.core.position(this),offset={top:newPosition.top-position.top,left:newPosition.left-position.left};if(!currentWidth){currentWidth=$column.outerWidth()}
+if(offset.left){newWidth=currentWidth+offset.left;column.width=newWidth;$column.attr('width',newWidth);index=$column[0].cellIndex;cell=$column[0].parentElement.children[index+1];nextWidth=parseInt($(cell).attr('width'),10)-offset.left;cell.setAttribute('width',nextWidth);if(data.resizableColumns){rows=$grid[0].tBodies[0].children;for(i=0;i ');for(i=0;i ');if(data.columns[i].filterable){$ctrl=$(' ');if('onchange'===data.headerFilter.type){$ctrl.on('input propertychange',function(e){bt.grid.plugins.headerFilter.private.reload($grid,$(this))})}else{$ctrl.on('keypress',function(e){if(e.which==13){bt.grid.plugins.headerFilter.private.reload($grid,$(this))}});$ctrl.on('blur',function(e){bt.grid.plugins.headerFilter.private.reload($grid,$(this))})}
+$th.append($ctrl)}
+if(data.columns[i].hidden){$th.hide()}
+$filterTr.append($th)}
+$grid.children('thead').append($filterTr)},reload:function($grid,$ctrl){var params={};params[$ctrl.data('field')]=$ctrl.val();$grid.reload(params)}},public:{},events:{},configure:function($grid,fullConfig,clientConfig){$.extend(!0,$grid,bt.grid.plugins.headerFilter.public);var data=$grid.data();if(clientConfig.headerFilter){$grid.on('initialized',function(){bt.grid.plugins.headerFilter.private.init($grid)})}}};bt.grid.plugins.grouping={config:{base:{paramNames:{groupBy:'groupBy',groupByDirection:'groupByDirection'},grouping:{groupBy:undefined,direction:'asc'},icons:{expandGroup:' ',collapseGroup:' '}},fontawesome:{icons:{expandGroup:' ',collapseGroup:' '}},glyphicons:{icons:{expandGroup:' ',collapseGroup:' '}}},private:{init:function($grid){var previousValue,data=$grid.data();previousValue=undefined;$grid.on('rowDataBound',function(e,$row,id,record){if(previousValue!==record[data.grouping.groupBy]||$row[0].rowIndex===1){var colspan=bt.grid.methods.countVisibleColumns($grid)-1,$groupRow=$(' '),$expandCollapseCell=$(' ');$expandCollapseCell.append(''+data.icons.collapseGroup+'
');$expandCollapseCell.on('click',bt.grid.plugins.grouping.private.createExpandCollapseHandler(data));$groupRow.append($expandCollapseCell);$groupRow.append(''+data.grouping.groupBy+': '+record[data.grouping.groupBy]+'
');$groupRow.insertBefore($row);previousValue=record[data.grouping.groupBy]}
+$row.show()});data.params[data.paramNames.groupBy]=data.grouping.groupBy;data.params[data.paramNames.groupByDirection]=data.grouping.direction},grouping:function($grid,records){var data=$grid.data();records.sort(bt.grid.methods.createDefaultSorter(data.grouping.direction,data.grouping.groupBy))},createExpandCollapseHandler:function(data){return function(e){var $cell=$(this),methods=bt.grid.plugins.grouping.private;if($cell.closest('tr').next(':visible').data('role')==='row'){methods.collapseGroup(data,$cell)}else{methods.expandGroup(data,$cell)}}},collapseGroup:function(data,$cell){var $display=$cell.children('div[data-role="display"]'),$groupRow=$cell.closest('tr');$groupRow.nextUntil('[role="group"]').hide();$display.empty().append(data.icons.expandGroup)},expandGroup:function(data,$cell){var $display=$cell.children('div[data-role="display"]'),$groupRow=$cell.closest('tr');$groupRow.nextUntil('[role="group"]').show();$display.empty().append(data.icons.collapseGroup)}},public:{},configure:function($grid){var column,data=$grid.data();$.extend(!0,$grid,bt.grid.plugins.grouping.public);if(data.grouping&&data.grouping.groupBy){column={title:'',width:data.defaultIconColumnWidth,align:'center',stopPropagation:!0,cssClass:'bt-cursor-pointer bt-unselectable'};data.columns=[column].concat(data.columns);$grid.on('initialized',function(){bt.grid.plugins.grouping.private.init($grid)});$grid.on('dataFiltered',function(e,records){bt.grid.plugins.grouping.private.grouping($grid,records)})}}};bt.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',RowsPerPage:'Rows per page:',Edit:'Edit',Delete:'Delete',Update:'Update',Cancel:'Cancel',NoRecordsFound:'No records found.',Loading:'Loading...'};bt.tree={plugins:{}};bt.tree.config={base:{params:{},autoLoad:!0,selectionType:'single',cascadeSelection:!1,dataSource:undefined,primaryKey:undefined,textField:'text',childrenField:'children',hasChildrenField:'hasChildren',imageCssClassField:'imageCssClass',imageUrlField:'imageUrl',imageHtmlField:'imageHtml',disabledField:'disabled',width:undefined,border:!1,uiLibrary:'materialdesign',iconsLibrary:'materialicons',autoGenId:1,indentation:24,style:{wrapper:'bt-unselectable',list:'bt-list bt-list-md',item:undefined,active:'bt-list-md-active',leafIcon:undefined,border:'bt-tree-md-border'},icons:{expand:' ',collapse:' '}},bootstrap:{style:{wrapper:'bt-unselectable bt-tree-bootstrap-3',list:'bt-list bt-list-bootstrap list-group',item:'list-group-item',active:'active',border:'bt-tree-bootstrap-border'},iconsLibrary:'glyphicons'},bootstrap4:{style:{wrapper:'bt-unselectable bt-tree-bootstrap-4',list:'bt-list bt-list-bootstrap',item:'list-group-item',active:'active',border:'bt-tree-bootstrap-border'},icons:{expand:' ',collapse:' '}},materialicons:{style:{expander:'bt-tree-material-icons-expander'}},fontawesome:{style:{expander:'bt-tree-font-awesome-expander'},icons:{expand:' ',collapse:' '}},glyphicons:{style:{expander:'bt-tree-glyphicons-expander'},icons:{expand:' ',collapse:' '}}};bt.tree.events={initialized:function($tree){$tree.triggerHandler('initialized')},dataBinding:function($tree){$tree.triggerHandler('dataBinding')},dataBound:function($tree){$tree.triggerHandler('dataBound')},select:function($tree,$node,id){return $tree.triggerHandler('select',[$node,id])},unselect:function($tree,$node,id){return $tree.triggerHandler('unselect',[$node,id])},expand:function($tree,$node,id){return $tree.triggerHandler('expand',[$node,id])},collapse:function($tree,$node,id){return $tree.triggerHandler('collapse',[$node,id])},enable:function($tree,$node){return $tree.triggerHandler('enable',[$node])},disable:function($tree,$node){return $tree.triggerHandler('disable',[$node])},destroying:function($tree){return $tree.triggerHandler('destroying')},nodeDataBound:function($tree,$node,id,record){return $tree.triggerHandler('nodeDataBound',[$node,id,record])}}
+bt.tree.methods={init:function(jsConfig){bt.widget.prototype.init.call(this,jsConfig,'tree');bt.tree.methods.initialize.call(this);if(this.data('autoLoad')){this.reload()}
+return this},initialize:function(){var data=this.data(),$root=$('');this.empty().addClass(data.style.wrapper).append($root);if(data.width){this.width(data.width)}
+if(data.border){this.addClass(data.style.border)}
+bt.tree.events.initialized(this)},useHtmlDataSource:function($tree,data){data.dataSource=[]},render:function($tree,response){if(response){if(typeof(response)==='string'&&JSON){response=JSON.parse(response)}
+$tree.data('records',bt.tree.methods.getRecords($tree,response));bt.tree.methods.loadData($tree)}
+return $tree},filter:function($grid){return $grid.data().dataSource},getRecords:function($tree,response){var i,id,nodeData,result=[],data=$tree.data();for(i=0;i ').addClass(data.style.item),$wrapper=$('
'),$expander=$(' ').addClass(data.style.expander),$display=$(''+nodeData.data[data.textField]+' '),hasChildren=typeof(nodeData.data[data.hasChildrenField])!=='undefined'&&nodeData.data[data.hasChildrenField].toString().toLowerCase()==='true',disabled=typeof(nodeData.data[data.disabledField])!=='undefined'&&nodeData.data[data.disabledField].toString().toLowerCase()==='true';if(data.indentation){$wrapper.append(' ')}
+if(disabled){bt.tree.methods.disableNode($tree,$node)}else{$expander.on('click',bt.tree.methods.expanderClickHandler($tree));$display.on('click',bt.tree.methods.displayClickHandler($tree))}
+$wrapper.append($expander);$wrapper.append($display);$node.append($wrapper);if(position){$parent.find('li:eq('+(position-1)+')').before($node)}else{$parent.append($node)}
+if(nodeData.children.length||hasChildren){$expander.empty().append(data.icons.expand);$newParent=$('').addClass(data.style.list).addClass('bt-hidden');$node.append($newParent);for(i=0;i ').insertBefore($display)}else if(data.imageUrlField&&nodeData.data[data.imageUrlField]){$span=$(' ');$span.insertBefore($display);$img=$(' ');$img.attr('width',$span.width()).attr('height',$span.height());$span.append($img)}else if(data.imageHtmlField&&nodeData.data[data.imageHtmlField]){$span=$(''+nodeData.data[data.imageHtmlField]+' ');$span.insertBefore($display)}
+bt.tree.events.nodeDataBound($tree,$node,nodeData.id,nodeData.data)},expanderClickHandler:function($tree){return function(e){var $expander=$(this),$node=$expander.closest('li');if($expander.attr('data-mode')==='close'){$tree.expand($node)}else{$tree.collapse($node)}}},expand:function($tree,$node,cascade){var $children,i,$expander=$node.find('>[data-role="wrapper"]>[data-role="expander"]'),data=$tree.data(),id=$node.attr('data-id'),$list=$node.children('ul');if(bt.tree.events.expand($tree,$node,id)!==!1&&$list&&$list.length){$list.show();$expander.attr('data-mode','open');$expander.empty().append(data.icons.collapse);if(cascade){$children=$node.find('ul>li');for(i=0;i<$children.length;i++){bt.tree.methods.expand($tree,$($children[i]),cascade)}}}
+return $tree},collapse:function($tree,$node,cascade){var $children,i,$expander=$node.find('>[data-role="wrapper"]>[data-role="expander"]'),data=$tree.data(),id=$node.attr('data-id'),$list=$node.children('ul');if(bt.tree.events.collapse($tree,$node,id)!==!1&&$list&&$list.length){$list.hide();$expander.attr('data-mode','close');$expander.empty().append(data.icons.expand);if(cascade){$children=$node.find('ul>li');for(i=0;i<$children.length;i++){bt.tree.methods.collapse($tree,$($children[i]),cascade)}}}
+return $tree},expandAll:function($tree){var i,$nodes=$tree.find('ul>li');for(i=0;i<$nodes.length;i++){bt.tree.methods.expand($tree,$($nodes[i]),!0)}
+return $tree},collapseAll:function($tree){var i,$nodes=$tree.find('ul>li');for(i=0;i<$nodes.length;i++){bt.tree.methods.collapse($tree,$($nodes[i]),!0)}
+return $tree},displayClickHandler:function($tree){return function(e){var $display=$(this),$node=$display.closest('li'),cascade=$tree.data().cascadeSelection;if($node.attr('data-selected')==='true'){bt.tree.methods.unselect($tree,$node,cascade)}else{if($tree.data('selectionType')==='single'){bt.tree.methods.unselectAll($tree)}
+bt.tree.methods.select($tree,$node,cascade)}}},selectAll:function($tree){var i,$nodes=$tree.find('ul>li');for(i=0;i<$nodes.length;i++){bt.tree.methods.select($tree,$($nodes[i]),!0)}
+return $tree},select:function($tree,$node,cascade){var i,$children,data=$tree.data();if($node.attr('data-selected')!=='true'&&bt.tree.events.select($tree,$node,$node.attr('data-id'))!==!1){$node.addClass(data.style.active).attr('data-selected','true');if(cascade){$children=$node.find('ul>li');for(i=0;i<$children.length;i++){bt.tree.methods.select($tree,$($children[i]),cascade)}}}},unselectAll:function($tree){var i,$nodes=$tree.find('ul>li');for(i=0;i<$nodes.length;i++){bt.tree.methods.unselect($tree,$($nodes[i]),!0)}
+return $tree},unselect:function($tree,$node,cascade){var i,$children,data=$tree.data();if($node.attr('data-selected')==='true'&&bt.tree.events.unselect($tree,$node,$node.attr('data-id'))!==!1){$node.removeClass($tree.data().style.active).removeAttr('data-selected');if(cascade){$children=$node.find('ul>li');for(i=0;i<$children.length;i++){bt.tree.methods.unselect($tree,$($children[i]),cascade)}}}},getSelections:function($list){var i,$node,children,result=[],$nodes=$list.children('li');if($nodes&&$nodes.length){for(i=0;i<$nodes.length;i++){$node=$($nodes[i]);if($node.attr('data-selected')==='true'){result.push($node.attr('data-id'))}else if($node.has('ul')){children=bt.tree.methods.getSelections($node.children('ul'));if(children.length){result=result.concat(children)}}}}
+return result},getById:function($tree,id,records){var i,result=undefined;for(i=0;i[data-role="wrapper"]>[data-role="display"]').text()){$result=$node;break}else if($node.has('ul')){$result=bt.tree.methods.getNodeByText($node.children('ul'),text);if($result){break}}}}
+return $result},getAll:function($tree,records){var i,$node,id,targetRecord,result=[],childrenField=$tree.data('childrenField');for(i=0;i ').addClass($tree.data().style.list))}
+$parent=$parent.children('ul')}
+bt.tree.methods.getById($tree,$parent.parent().data('id'),$tree.data('records')).children.push(newNodeData)}
+level=$parent.parentsUntil('[data-type="tree"]','ul').length+1;bt.tree.methods.appendNode($tree,$parent,newNodeData,level,position);return $tree},remove:function($tree,$node){bt.tree.methods.removeDataById($tree,$node.attr('data-id'),$tree.data('records'));$node.remove();return $tree},removeDataById:function($tree,id,records){var i;for(i=0;i[data-role="wrapper"]>[data-role="display"]').html(newRecord[data.textField]);bt.tree.events.nodeDataBound($tree,$node,id,newRecord);return $tree},getChildren:function($tree,$node,cascade){var result=[],i,$children,cascade=typeof(cascade)==='undefined'?!0:cascade;if(cascade){$children=$node.find('ul li')}else{$children=$node.find('>ul>li')}
+for(i=0;i<$children.length;i++){result.push($($children[i]).data('id'))}
+return result},enableAll:function($tree){var i,$children=$tree.find('ul>li');for(i=0;i<$children.length;i++){bt.tree.methods.enableNode($tree,$($children[i]),!0)}
+return $tree},enableNode:function($tree,$node,cascade){var i,$children,$expander=$node.find('>[data-role="wrapper"]>[data-role="expander"]'),$display=$node.find('>[data-role="wrapper"]>[data-role="display"]'),cascade=typeof(cascade)==='undefined'?!0:cascade;$node.removeClass('disabled');$expander.on('click',bt.tree.methods.expanderClickHandler($tree));$display.on('click',bt.tree.methods.displayClickHandler($tree));bt.tree.events.enable($tree,$node);if(cascade){$children=$node.find('ul>li');for(i=0;i<$children.length;i++){bt.tree.methods.enableNode($tree,$($children[i]),cascade)}}},disableAll:function($tree){var i,$children=$tree.find('ul>li');for(i=0;i<$children.length;i++){bt.tree.methods.disableNode($tree,$($children[i]),!0)}
+return $tree},disableNode:function($tree,$node,cascade){var i,$children,$expander=$node.find('>[data-role="wrapper"]>[data-role="expander"]'),$display=$node.find('>[data-role="wrapper"]>[data-role="display"]'),cascade=typeof(cascade)==='undefined'?!0:cascade;$node.addClass('disabled');$expander.off('click');$display.off('click');bt.tree.events.disable($tree,$node);if(cascade){$children=$node.find('ul>li');for(i=0;i<$children.length;i++){bt.tree.methods.disableNode($tree,$($children[i]),cascade)}}},destroy:function($tree){var data=$tree.data();if(data){bt.tree.events.destroying($tree);$tree.xhr&&$tree.xhr.abort();$tree.off();$tree.removeData();$tree.removeAttr('data-type');$tree.removeClass().empty()}
+return $tree}}
+bt.tree.widget=function($element,jsConfig){var self=this,methods=bt.tree.methods;self.reload=function(params){return bt.widget.prototype.reload.call(this,params)};self.render=function(response){return methods.render(this,response)};self.addNode=function(data,$parentNode,position){return methods.addNode(this,data,$parentNode,position)};self.removeNode=function($node){return methods.remove(this,$node)};self.updateNode=function(id,record){return methods.update(this,id,record)};self.destroy=function(){return methods.destroy(this)};self.expand=function($node,cascade){return methods.expand(this,$node,cascade)};self.collapse=function($node,cascade){return methods.collapse(this,$node,cascade)};self.expandAll=function(){return methods.expandAll(this)};self.collapseAll=function(){return methods.collapseAll(this)};self.getDataById=function(id){return methods.getDataById(this,id,this.data('records'))};self.getDataByText=function(text){return methods.getDataByText(this,text,this.data('records'))};self.getNodeById=function(id){return methods.getNodeById(this.children('ul'),id)};self.getNodeByText=function(text){return methods.getNodeByText(this.children('ul'),text)};self.getAll=function(){return methods.getAll(this,this.data('records'))};self.select=function($node){return methods.select(this,$node)};self.unselect=function($node){return methods.unselect(this,$node)};self.selectAll=function(){return methods.selectAll(this)};self.unselectAll=function(){return methods.unselectAll(this)};self.getSelections=function(){return methods.getSelections(this.children('ul'))};self.getChildren=function($node,cascade){return methods.getChildren(this,$node,cascade)};self.enable=function($node,cascade){return methods.enableNode(this,$node,cascade)};self.enableAll=function(){return methods.enableAll(this)};self.disable=function($node,cascade){return methods.disableNode(this,$node,cascade)};self.disableAll=function(){return methods.disableAll(this)};$.extend($element,self);if('tree'!==$element.attr('data-type')){methods.init.call($element,jsConfig)}
+return $element};bt.tree.widget.prototype=new bt.widget();bt.tree.widget.constructor=bt.tree.widget;(function($){$.fn.tree=function(method){var $widget;if(this&&this.length){if(typeof method==='object'||!method){return new bt.tree.widget(this,method)}else{$widget=new bt.tree.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);bt.tree.plugins.checkboxes={config:{base:{checkboxes:undefined,checkedField:'checked',cascadeCheck:!0,}},private:{dataBound:function($tree){var $nodes;if($tree.data('cascadeCheck')){$nodes=$tree.find('li[data-role="node"]');$.each($nodes,function(){var $node=$(this),state=$node.find('[data-role="checkbox"] input[type="checkbox"]').checkbox('state');if(state==='checked'){bt.tree.plugins.checkboxes.private.updateChildrenState($node,state);bt.tree.plugins.checkboxes.private.updateParentState($node,state)}})}},nodeDataBound:function($tree,$node,id,record){var data=$tree.data(),$expander=$node.find('> [data-role="wrapper"] > [data-role="expander"]'),$checkbox=$(' '),$wrapper=$(' ').append($checkbox),disabled=typeof(record[data.disabledField])!=='undefined'&&record[data.disabledField].toString().toLowerCase()==='true';$checkbox=$checkbox.checkbox({uiLibrary:data.uiLibrary,iconsLibrary:data.iconsLibrary,change:function(e,state){bt.tree.plugins.checkboxes.events.checkboxChange($tree,$node,record,$checkbox.state())}});disabled&&$checkbox.prop('disabled',!0);record[data.checkedField]&&$checkbox.state('checked');$checkbox.on('click',function(e){var $node=$checkbox.closest('li'),state=$checkbox.state();if(data.cascadeCheck){bt.tree.plugins.checkboxes.private.updateChildrenState($node,state);bt.tree.plugins.checkboxes.private.updateParentState($node,state)}});$expander.after($wrapper)},updateParentState:function($node,state){var $parentNode,$parentCheckbox,$siblingCheckboxes,allChecked,allUnchecked,parentState;$parentNode=$node.parent('ul').parent('li');if($parentNode.length===1){$parentCheckbox=$node.parent('ul').parent('li').find('> [data-role="wrapper"] > [data-role="checkbox"] input[type="checkbox"]');$siblingCheckboxes=$node.siblings().find('> [data-role="wrapper"] > span[data-role="checkbox"] input[type="checkbox"]');allChecked=(state==='checked');allUnchecked=(state==='unchecked');parentState='indeterminate';$.each($siblingCheckboxes,function(){var state=$(this).checkbox('state');if(allChecked&&state!=='checked'){allChecked=!1}
+if(allUnchecked&&state!=='unchecked'){allUnchecked=!1}});if(allChecked&&!allUnchecked){parentState='checked'}
+if(!allChecked&&allUnchecked){parentState='unchecked'}
+$parentCheckbox.checkbox('state',parentState);bt.tree.plugins.checkboxes.private.updateParentState($parentNode,$parentCheckbox.checkbox('state'))}},updateChildrenState:function($node,state){var $childrenCheckboxes=$node.find('ul li [data-role="wrapper"] [data-role="checkbox"] input[type="checkbox"]');if($childrenCheckboxes.length>0){$.each($childrenCheckboxes,function(){$(this).checkbox('state',state)})}},update:function($tree,$node,state){var checkbox=$node.find('[data-role="checkbox"] input[type="checkbox"]').first();$(checkbox).checkbox('state',state);if($tree.data().cascadeCheck){bt.tree.plugins.checkboxes.private.updateChildrenState($node,state);bt.tree.plugins.checkboxes.private.updateParentState($node,state)}}},public:{getCheckedNodes:function(){var result=[],checkboxes=this.find('li [data-role="checkbox"] input[type="checkbox"]');$.each(checkboxes,function(){var checkbox=$(this);if(checkbox.checkbox('state')==='checked'){result.push(checkbox.closest('li').data('id'))}});return result},checkAll:function(){var $checkboxes=this.find('li [data-role="checkbox"] input[type="checkbox"]');$.each($checkboxes,function(){$(this).checkbox('state','checked')});return this},uncheckAll:function(){var $checkboxes=this.find('li [data-role="checkbox"] input[type="checkbox"]');$.each($checkboxes,function(){$(this).checkbox('state','unchecked')});return this},check:function($node){bt.tree.plugins.checkboxes.private.update(this,$node,'checked');return this},uncheck:function($node){bt.tree.plugins.checkboxes.private.update(this,$node,'unchecked');return this}},events:{checkboxChange:function($tree,$node,record,state){return $tree.triggerHandler('checkboxChange',[$node,record,state])}},configure:function($tree){if($tree.data('checkboxes')&&bt.checkbox){$.extend(!0,$tree,bt.tree.plugins.checkboxes.public);$tree.on('nodeDataBound',function(e,$node,id,record){bt.tree.plugins.checkboxes.private.nodeDataBound($tree,$node,id,record)});$tree.on('dataBound',function(){bt.tree.plugins.checkboxes.private.dataBound($tree)});$tree.on('enable',function(e,$node){$node.find('>[data-role="wrapper"]>[data-role="checkbox"] input[type="checkbox"]').prop('disabled',!1)});$tree.on('disable',function(e,$node){$node.find('>[data-role="wrapper"]>[data-role="checkbox"] input[type="checkbox"]').prop('disabled',!0)})}}};bt.tree.plugins.dragAndDrop={config:{base:{dragAndDrop:undefined,style:{dragEl:'bt-tree-drag-el bt-tree-md-drag-el',dropAsChildIcon:'bt-cursor-pointer bt-icon plus',dropAbove:'bt-tree-drop-above',dropBelow:'bt-tree-drop-below'}},bootstrap:{style:{dragEl:'bt-tree-drag-el bt-tree-bootstrap-drag-el',dropAsChildIcon:'glyphicon glyphicon-plus',dropAbove:'drop-above',dropBelow:'drop-below'}},bootstrap4:{style:{dragEl:'bt-tree-drag-el bt-tree-bootstrap-drag-el',dropAsChildIcon:'bt-cursor-pointer bt-icon plus',dropAbove:'drop-above',dropBelow:'drop-below'}}},private:{nodeDataBound:function($tree,$node){var $wrapper=$node.children('[data-role="wrapper"]'),$display=$node.find('>[data-role="wrapper"]>[data-role="display"]');if($wrapper.length&&$display.length){$display.on('mousedown',bt.tree.plugins.dragAndDrop.private.createNodeMouseDownHandler($tree));$display.on('mousemove',bt.tree.plugins.dragAndDrop.private.createNodeMouseMoveHandler($tree,$node,$display));$display.on('mouseup',bt.tree.plugins.dragAndDrop.private.createNodeMouseUpHandler($tree))}},createNodeMouseDownHandler:function($tree){return function(e){$tree.data('dragReady',!0)}},createNodeMouseUpHandler:function($tree){return function(e){$tree.data('dragReady',!1)}},createNodeMouseMoveHandler:function($tree,$node,$display){return function(e){if($tree.data('dragReady')){var data=$tree.data(),$dragEl,$wrapper,offsetTop,offsetLeft;$tree.data('dragReady',!1);$dragEl=$display.clone().wrap('
').closest('div').wrap(' ').closest('li').wrap('').closest('ul');$('body').append($dragEl);$dragEl.attr('data-role','draggable-clone').addClass('bt-unselectable').addClass(data.style.dragEl);$dragEl.find('[data-role="wrapper"]').prepend(' ');$dragEl.draggable({drag:bt.tree.plugins.dragAndDrop.private.createDragHandler($tree,$node,$display),stop:bt.tree.plugins.dragAndDrop.private.createDragStopHandler($tree,$node,$display)});$wrapper=$display.parent();offsetTop=$display.offset().top;offsetTop-=parseInt($wrapper.css("border-top-width"))+parseInt($wrapper.css("margin-top"))+parseInt($wrapper.css("padding-top"));offsetLeft=$display.offset().left;offsetLeft-=parseInt($wrapper.css("border-left-width"))+parseInt($wrapper.css("margin-left"))+parseInt($wrapper.css("padding-left"));offsetLeft-=$dragEl.find('[data-role="indicator"]').outerWidth(!0);$dragEl.css({position:'absolute',top:offsetTop,left:offsetLeft,width:$display.outerWidth(!0)});if($display.attr('data-droppable')==='true'){$display.droppable('destroy')}
+bt.tree.plugins.dragAndDrop.private.getTargetDisplays($tree,$node,$display).each(function(){var $dropEl=$(this);if($dropEl.attr('data-droppable')==='true'){$dropEl.droppable('destroy')}
+$dropEl.droppable()});bt.tree.plugins.dragAndDrop.private.getTargetDisplays($tree,$node).each(function(){var $dropEl=$(this);if($dropEl.attr('data-droppable')==='true'){$dropEl.droppable('destroy')}
+$dropEl.droppable()});$dragEl.trigger('mousedown')}}},getTargetDisplays:function($tree,$node,$display){return $tree.find('[data-role="display"]').not($display).not($node.find('[data-role="display"]'))},getTargetWrappers:function($tree,$node){return $tree.find('[data-role="wrapper"]').not($node.find('[data-role="wrapper"]'))},createDragHandler:function($tree,$node,$display){var $displays=bt.tree.plugins.dragAndDrop.private.getTargetDisplays($tree,$node,$display),$wrappers=bt.tree.plugins.dragAndDrop.private.getTargetWrappers($tree,$node),data=$tree.data();return function(e,offset,mousePosition){var $dragEl=$(this),success=!1;$displays.each(function(){var $targetDisplay=$(this),$indicator;if($targetDisplay.droppable('isOver',mousePosition)){$indicator=$dragEl.find('[data-role="indicator"]');data.style.dropAsChildIcon?$indicator.addClass(data.style.dropAsChildIcon):$indicator.text('+');success=!0;return!1}else{$dragEl.find('[data-role="indicator"]').removeClass(data.style.dropAsChildIcon).empty()}});$wrappers.each(function(){var $wrapper=$(this),$indicator,middle;if(!success&&$wrapper.droppable('isOver',mousePosition)){middle=$wrapper.position().top+($wrapper.outerHeight()/2);if(mousePosition.y ').addClass(data.style.list);$targetNode.append($ul)}
+if(bt.tree.plugins.dragAndDrop.events.nodeDrop($tree,$sourceNode.data('id'),$targetNode.data('id'),$ul.children('li').length+1)!==!1){$ul.append($sourceNode);bt.tree.plugins.dragAndDrop.private.refresh($tree,$sourceNode,$targetNode,$sourceParentNode)}
+success=!0;return!1}
+$targetDisplay.droppable('destroy')});if(!success){$wrappers.each(function(){var $targetWrapper=$(this),$targetNode,$sourceParentNode,prepend,orderNumber,sourceNodeId;if($targetWrapper.droppable('isOver',mousePosition)){$targetNode=$targetWrapper.closest('li');$sourceParentNode=$sourceNode.parent('ul').parent('li');prepend=mousePosition.top<($targetWrapper.position().top+($targetWrapper.outerHeight()/2));sourceNodeId=$sourceNode.data('id');orderNumber=$targetNode.prevAll('li:not([data-id="'+sourceNodeId+'"])').length+(prepend?1:2);if(bt.tree.plugins.dragAndDrop.events.nodeDrop($tree,sourceNodeId,$targetNode.parent('ul').parent('li').data('id'),orderNumber)!==!1){if(prepend){$sourceNode.insertBefore($targetNode)}else{$sourceNode.insertAfter($targetNode)}
+bt.tree.plugins.dragAndDrop.private.refresh($tree,$sourceNode,$targetNode,$sourceParentNode)}
+return!1}
+$targetWrapper.droppable('destroy')})}}},refresh:function($tree,$sourceNode,$targetNode,$sourceParentNode){var data=$tree.data();bt.tree.plugins.dragAndDrop.private.refreshNode($tree,$targetNode);bt.tree.plugins.dragAndDrop.private.refreshNode($tree,$sourceParentNode);bt.tree.plugins.dragAndDrop.private.refreshNode($tree,$sourceNode);$sourceNode.find('li[data-role="node"]').each(function(){bt.tree.plugins.dragAndDrop.private.refreshNode($tree,$(this))});$targetNode.children('[data-role="wrapper"]').removeClass(data.style.dropAbove).removeClass(data.style.dropBelow)},refreshNode:function($tree,$node){var $wrapper=$node.children('[data-role="wrapper"]'),$expander=$wrapper.children('[data-role="expander"]'),$spacer=$wrapper.children('[data-role="spacer"]'),$list=$node.children('ul'),data=$tree.data(),level=$node.parentsUntil('[data-type="tree"]','ul').length;if($list.length&&$list.children().length){if($list.is(':visible')){$expander.empty().append(data.icons.collapse)}else{$expander.empty().append(data.icons.expand)}}else{$expander.empty()}
+$wrapper.removeClass(data.style.dropAbove).removeClass(data.style.dropBelow);$spacer.css('width',(data.indentation*(level-1)))}},public:{},events:{nodeDrop:function($tree,id,parentId,orderNumber){return $tree.triggerHandler('nodeDrop',[id,parentId,orderNumber])}},configure:function($tree){$.extend(!0,$tree,bt.tree.plugins.dragAndDrop.public);if($tree.data('dragAndDrop')&&bt.draggable&&bt.droppable){$tree.on('nodeDataBound',function(e,$node){bt.tree.plugins.dragAndDrop.private.nodeDataBound($tree,$node)})}}};bt.tree.plugins.lazyLoading={config:{base:{paramNames:{parentId:'parentId'},lazyLoading:!1}},private:{nodeDataBound:function($tree,$node,id,record){var data=$tree.data(),$expander=$node.find('> [data-role="wrapper"] > [data-role="expander"]');if(record.hasChildren){$expander.empty().append(data.icons.expand)}},createDoneHandler:function($tree,$node){return function(response){var i,$expander,$list,data=$tree.data();if(typeof(response)==='string'&&JSON){response=JSON.parse(response)}
+if(response&&response.length){$list=$('').addClass(data.style.list);$node.append($list);for(i=0;i[data-role="wrapper"]>[data-role="expander"]'),$expander.attr('data-mode','open');$expander.empty().append(data.icons.collapse);bt.tree.events.dataBound($tree)}}},expand:function($tree,$node,id){var ajaxOptions,data=$tree.data(),params={},$children=$node.find('>ul>li');if(!$children||!$children.length){if(typeof(data.dataSource)==='string'){params[data.paramNames.parentId]=id;ajaxOptions={url:data.dataSource,data:params};if($tree.xhr){$tree.xhr.abort()}
+$tree.xhr=$.ajax(ajaxOptions).done(bt.tree.plugins.lazyLoading.private.createDoneHandler($tree,$node)).fail($tree.createErrorHandler())}}}},public:{},events:{},configure:function($tree,fullConfig,clientConfig){if(clientConfig.lazyLoading){$tree.on('nodeDataBound',function(e,$node,id,record){bt.tree.plugins.lazyLoading.private.nodeDataBound($tree,$node,id,record)});$tree.on('expand',function(e,$node,id){bt.tree.plugins.lazyLoading.private.expand($tree,$node,id)})}}};bt.checkbox={plugins:{}};bt.checkbox.config={base:{uiLibrary:'materialdesign',iconsLibrary:'materialicons',style:{wrapperCssClass:'bt-checkbox-md',spanCssClass:undefined}},bootstrap:{style:{wrapperCssClass:'bt-checkbox-bootstrap'},iconsLibrary:'glyphicons'},bootstrap4:{style:{wrapperCssClass:'bt-checkbox-bootstrap bt-checkbox-bootstrap-4'},iconsLibrary:'materialicons'},materialicons:{style:{iconsCssClass:'bt-checkbox-material-icons',spanCssClass:'bt-icon'}},glyphicons:{style:{iconsCssClass:'bt-checkbox-glyphicons',spanCssClass:''}},fontawesome:{style:{iconsCssClass:'bt-checkbox-fontawesome',spanCssClass:'fa'}}};bt.checkbox.methods={init:function(jsConfig){var $chkb=this;bt.widget.prototype.init.call(this,jsConfig,'checkbox');$chkb.attr('data-checkbox','true');bt.checkbox.methods.initialize($chkb);return $chkb},initialize:function($chkb){var data=$chkb.data(),$wrapper,$span;if(data.style.wrapperCssClass){$wrapper=$(' ');if($chkb.attr('id')){$wrapper.attr('for',$chkb.attr('id'))}
+$chkb.wrap($wrapper);$span=$(' ');if(data.style.spanCssClass){$span.addClass(data.style.spanCssClass)}
+$chkb.parent().append($span)}},state:function($chkb,value){if(value){if('checked'===value){$chkb.prop('indeterminate',!1);$chkb.prop('checked',!0)}else if('unchecked'===value){$chkb.prop('indeterminate',!1);$chkb.prop('checked',!1)}else if('indeterminate'===value){$chkb.prop('checked',!0);$chkb.prop('indeterminate',!0)}
+bt.checkbox.events.change($chkb,value);return $chkb}else{if($chkb.prop('indeterminate')){value='indeterminate'}else if($chkb.prop('checked')){value='checked'}else{value='unchecked'}
+return value}},toggle:function($chkb){if($chkb.state()=='checked'){$chkb.state('unchecked')}else{$chkb.state('checked')}
+return $chkb},destroy:function($chkb){if($chkb.attr('data-checkbox')==='true'){$chkb.removeData();$chkb.removeAttr('data-guid');$chkb.removeAttr('data-checkbox');$chkb.off();$chkb.next('span').remove();$chkb.unwrap()}
+return $chkb}};bt.checkbox.events={change:function($chkb,state){return $chkb.triggerHandler('change',[state])}};bt.checkbox.widget=function($element,jsConfig){var self=this,methods=bt.checkbox.methods;self.toggle=function(){return methods.toggle(this)};self.state=function(value){return methods.state(this,value)};self.destroy=function(){return methods.destroy(this)};$.extend($element,self);if('true'!==$element.attr('data-checkbox')){methods.init.call($element,jsConfig)}
+return $element};bt.checkbox.widget.prototype=new bt.widget();bt.checkbox.widget.constructor=bt.checkbox.widget;(function($){$.fn.checkbox=function(method){var $widget;if(this&&this.length){if(typeof method==='object'||!method){return new bt.checkbox.widget(this,method)}else{$widget=new bt.checkbox.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);bt.editor={plugins:{},messages:{}};bt.editor.config={base:{height:300,width:undefined,uiLibrary:'materialdesign',iconsLibrary:'materialicons',locale:'en-us',buttons:undefined,style:{wrapper:'bt-editor bt-editor-md',buttonsGroup:'bt-button-md-group',button:'bt-button-md',buttonActive:'active'}},bootstrap:{style:{wrapper:'bt-editor bt-editor-bootstrap',buttonsGroup:'btn-group',button:'btn btn-default bt-cursor-pointer',buttonActive:'active'}},bootstrap4:{style:{wrapper:'bt-editor bt-editor-bootstrap',buttonsGroup:'btn-group',button:'btn btn-outline-secondary bt-cursor-pointer',buttonActive:'active'}},materialicons:{icons:{bold:' ',italic:' ',strikethrough:' ',underline:' ',listBulleted:' ',listNumbered:' ',indentDecrease:' ',indentIncrease:' ',alignLeft:' ',alignCenter:' ',alignRight:' ',alignJustify:' ',undo:' ',redo:' '}},fontawesome:{icons:{bold:' ',italic:' ',strikethrough:' ',underline:' ',listBulleted:' ',listNumbered:' ',indentDecrease:' ',indentIncrease:' ',alignLeft:' ',alignCenter:' ',alignRight:' ',alignJustify:' ',undo:' ',redo:' '}}};bt.editor.methods={init:function(jsConfig){bt.widget.prototype.init.call(this,jsConfig,'editor');this.attr('data-editor','true');bt.editor.methods.initialize(this);return this},initialize:function($editor){var self=this,data=$editor.data(),$group,$btn,wrapper,$body,$toolbar;$editor.hide();if($editor[0].parentElement.attributes.role!=='wrapper'){wrapper=document.createElement('div');wrapper.setAttribute('role','wrapper');$editor[0].parentNode.insertBefore(wrapper,$editor[0]);wrapper.appendChild($editor[0])}
+bt.editor.methods.localization(data);$(wrapper).addClass(data.style.wrapper);if(data.width){$(wrapper).width(data.width)}
+$body=$(wrapper).children('div[role="body"]');if($body.length===0){$body=$('
');$(wrapper).append($body);if($editor[0].innerText){$body[0].innerHTML=$editor[0].innerText}}
+$body.attr('contenteditable',!0);$body.on('keydown',function(e){var key=event.keyCode||event.charCode;if(bt.editor.events.changing($editor)===!1&&key!==8&&key!==46){e.preventDefault()}});$body.on('mouseup keyup mouseout cut paste',function(e){self.updateToolbar($editor,$toolbar);bt.editor.events.changed($editor);$editor.html($body.html())});$toolbar=$(wrapper).children('div[role="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(){bt.editor.methods.executeCmd($editor,$body,$toolbar,$(this))});$group.append($btn)}
+$toolbar.append($group)}}
+$body.height(data.height-bt.core.height($toolbar[0],!0))},localization:function(data){var msg=bt.editor.messages[data.locale];if(typeof(data.buttons)==='undefined'){data.buttons=[[''+data.icons.bold+' ',''+data.icons.italic+' ',''+data.icons.strikethrough+' ',''+data.icons.underline+' '],[''+data.icons.listBulleted+' ',''+data.icons.listNumbered+' ',''+data.icons.indentDecrease+' ',''+data.icons.indentIncrease+' '],[''+data.icons.alignLeft+' ',''+data.icons.alignCenter+' ',''+data.icons.alignRight+' ',''+data.icons.alignJustify+' '],[''+data.icons.undo+' ',''+data.icons.redo+' ']]}},updateToolbar:function($editor,$toolbar){var data=$editor.data();$buttons=$toolbar.find('[role]').each(function(){var $btn=$(this),cmd=$btn.attr('role');if(cmd&&document.queryCommandEnabled(cmd)&&document.queryCommandValue(cmd)==="true"){$btn.addClass(data.style.buttonActive)}else{$btn.removeClass(data.style.buttonActive)}})},executeCmd:function($editor,$body,$toolbar,$btn){$body.focus();document.execCommand($btn.attr('role'),!1);bt.editor.methods.updateToolbar($editor,$toolbar)},content:function($editor,html){var $body=$editor.parent().children('div[role="body"]');if(typeof(html)==="undefined"){return $body.html()}else{return $body.html(html)}},destroy:function($editor){var $wrapper;if($editor.attr('data-editor')==='true'){$wrapper=$editor.parent();$wrapper.children('div[role="body"]').remove();$wrapper.children('div[role="toolbar"]').remove();$editor.unwrap();$editor.removeData();$editor.removeAttr('data-guid');$editor.removeAttr('data-editor');$editor.off();$editor.show()}
+return $editor}};bt.editor.events={changing:function($editor){return $editor.triggerHandler('changing')},changed:function($editor){return $editor.triggerHandler('changed')}};bt.editor.widget=function($element,jsConfig){var self=this,methods=bt.editor.methods;self.content=function(html){return methods.content(this,html)};self.destroy=function(){return methods.destroy(this)};$.extend($element,self);if('true'!==$element.attr('data-editor')){methods.init.call($element,jsConfig)}
+return $element};bt.editor.widget.prototype=new bt.widget();bt.editor.widget.constructor=bt.editor.widget;(function($){$.fn.editor=function(method){var $widget;if(this&&this.length){if(typeof method==='object'||!method){return new bt.editor.widget(this,method)}else{$widget=new bt.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);bt.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'};bt.dropdown={plugins:{}};bt.dropdown.config={base:{dataSource:undefined,textField:'text',valueField:'value',selectedField:'selected',width:undefined,maxHeight:'auto',placeholder:undefined,fontSize:undefined,uiLibrary:'materialdesign',iconsLibrary:'materialicons',icons:{dropdown:' ',dropup:' '},style:{wrapper:'bt-dropdown bt-dropdown-md bt-unselectable',list:'bt-list bt-list-md bt-dropdown-list-md',active:'bt-list-md-active'}},bootstrap:{style:{wrapper:'bt-dropdown bt-dropdown-bootstrap bt-dropdown-bootstrap-3 bt-unselectable',presenter:'btn btn-default',list:'bt-list bt-list-bootstrap bt-dropdown-list-bootstrap list-group',item:'list-group-item',active:'active'},iconsLibrary:'glyphicons'},bootstrap4:{style:{wrapper:'bt-dropdown bt-dropdown-bootstrap bt-dropdown-bootstrap-4 bt-unselectable',presenter:'btn btn-outline-secondary',list:'bt-list bt-list-bootstrap bt-dropdown-list-bootstrap list-group',item:'list-group-item',active:'active'}},materialicons:{style:{expander:'bt-dropdown-expander-mi'}},fontawesome:{icons:{dropdown:' ',dropup:' '},style:{expander:'bt-dropdown-expander-fa'}},glyphicons:{icons:{dropdown:' ',dropup:' '},style:{expander:'bt-dropdown-expander-glyphicons'}}};bt.dropdown.methods={init:function(jsConfig){bt.widget.prototype.init.call(this,jsConfig,'dropdown');this.attr('data-dropdown','true');bt.dropdown.methods.initialize(this);return this},getHTMLConfig:function(){var result=bt.widget.prototype.getHTMLConfig.call(this),attrs=this[0].attributes;if(attrs.placeholder){result.placeholder=attrs.placeholder.value}
+return result},initialize:function($dropdown){var $item,data=$dropdown.data(),$wrapper=$dropdown.parent('div[role="wrapper"]'),$display=$(' '),$expander=$(''+data.icons.dropdown+' ').addClass(data.style.expander),$presenter=$(' ').addClass(data.style.presenter),$list=$('').attr('guid',$dropdown.attr('data-guid'));if($wrapper.length===0){$wrapper=$('
').addClass(data.style.wrapper);$dropdown.wrap($wrapper)}else{$wrapper.addClass(data.style.wrapper)}
+if(data.fontSize){$presenter.css('font-size',data.fontSize)}
+$presenter.on('click',function(e){if($list.is(':visible')){bt.dropdown.methods.close($dropdown,$list)}else{bt.dropdown.methods.open($dropdown,$list)}});$presenter.on('blur',function(e){setTimeout(function(){bt.dropdown.methods.close($dropdown,$list)},500)});$presenter.append($display).append($expander);$dropdown.hide();$dropdown.after($presenter);$('body').append($list);$list.hide();$dropdown.reload()},setListPosition:function(presenter,list,data){var top,listHeight,presenterHeight,newHeight,listElRect,mainElRect=presenter.getBoundingClientRect(),scrollY=window.scrollY||window.pageYOffset||0,scrollX=window.scrollX||window.pageXOffset||0;list.style.overflow='';list.style.overflowX='';list.style.height='';bt.core.setChildPosition(presenter,list);listHeight=bt.core.height(list,!0);listElRect=list.getBoundingClientRect();presenterHeight=bt.core.height(presenter,!0);if(data.maxHeight==='auto'){if(mainElRect.topwindow.innerHeight){newHeight=window.innerHeight-mainElRect.top-presenterHeight-3}}else{if(mainElRect.top-listHeight-3>0){list.style.top=Math.round(mainElRect.top+scrollY-listHeight-3)+'px'}else{list.style.top=scrollY+'px';newHeight=mainElRect.top-3}}}else if(!isNaN(data.maxHeight)&&data.maxHeight'+text+'
');$item.addClass(data.style.item);$item.on('click',function(e){bt.dropdown.methods.select($dropdown,value)});$list.append($item);$dropdown.append(''+text+' ');if(selected){selections.push(value)}});if(selections.length===0){$dropdown.prepend(' ');if(data.placeholder){$display[0].innerHTML=''+data.placeholder+' '}}else{for(i=0;i0){$parent.children('[role="presenter"]').remove();$parent.children('[role="list"]').remove();$dropdown.unwrap()}
+$dropdown.show()}
+return $tree}};bt.dropdown.events={change:function($dropdown){return $dropdown.triggerHandler('change')},dataBound:function($dropdown){return $dropdown.triggerHandler('dataBound')}};bt.dropdown.widget=function($element,jsConfig){var self=this,methods=bt.dropdown.methods;self.value=function(value){return methods.value(this,value)};self.enable=function(){return methods.enable(this)};self.disable=function(){return methods.disable(this)};self.destroy=function(){return methods.destroy(this)};$.extend($element,self);if('true'!==$element.attr('data-dropdown')){methods.init.call($element,jsConfig)}
+return $element};bt.dropdown.widget.prototype=new bt.widget();bt.dropdown.widget.constructor=bt.dropdown.widget;bt.dropdown.widget.prototype.getHTMLConfig=bt.dropdown.methods.getHTMLConfig;(function($){$.fn.dropdown=function(method){var $widget;if(this&&this.length){if(typeof method==='object'||!method){return new bt.dropdown.widget(this,method)}else{$widget=new bt.dropdown.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);bt.datepicker={plugins:{}};bt.datepicker.config={base:{showOtherMonths:!1,selectOtherMonths:!0,width:undefined,minDate:undefined,maxDate:undefined,format:'mm/dd/yyyy',uiLibrary:'materialdesign',iconsLibrary:'materialicons',value:undefined,weekStartDay:0,disableDates:undefined,disableDaysOfWeek:undefined,calendarWeeks:!1,keyboardNavigation:!0,locale:'en-us',icons:{rightIcon:'event ',previousMonth:' ',nextMonth:' '},fontSize:undefined,size:'default',modal:!1,header:!1,footer:!1,style:{modal:'bt-modal',wrapper:'bt-datepicker bt-datepicker-md bt-unselectable',input:'bt-textbox-md',calendar:'bt-picker bt-picker-md datepicker bt-unselectable',footer:'',button:'bt-button-md'}},bootstrap:{style:{wrapper:'bt-datepicker bt-datepicker-bootstrap bt-unselectable input-group',input:'form-control',calendar:'bt-picker bt-picker-bootstrap datepicker bt-unselectable',footer:'modal-footer',button:'btn btn-default'},iconsLibrary:'glyphicons',showOtherMonths:!0},bootstrap4:{style:{wrapper:'bt-datepicker bt-datepicker-bootstrap bt-unselectable input-group',input:'form-control',calendar:'bt-picker bt-picker-bootstrap datepicker bt-unselectable',footer:'modal-footer',button:'btn btn-default'},showOtherMonths:!0},fontawesome:{icons:{rightIcon:' ',previousMonth:' ',nextMonth:' '}},glyphicons:{icons:{rightIcon:' ',previousMonth:' ',nextMonth:' '}}};bt.datepicker.methods={init:function(jsConfig){bt.widget.prototype.init.call(this,jsConfig,'datepicker');this.attr('data-datepicker','true');bt.datepicker.methods.initialize(this,this.data());return this},initialize:function($datepicker,data){var $calendar,$rightIcon,$wrapper=$datepicker.parent('div[role="wrapper"]');if(data.uiLibrary==='bootstrap'){$rightIcon=$(''+data.icons.rightIcon+' ')}else if(data.uiLibrary==='bootstrap4'){$rightIcon=$(''+data.icons.rightIcon+' ')}else{$rightIcon=$(data.icons.rightIcon)}
+$rightIcon.attr('role','right-icon');if($wrapper.length===0){$wrapper=$('
').addClass(data.style.wrapper);$datepicker.wrap($wrapper)}else{$wrapper.addClass(data.style.wrapper)}
+$wrapper=$datepicker.parent('div[role="wrapper"]');data.width&&$wrapper.css('width',data.width);$datepicker.val(data.value).addClass(data.style.input).attr('role','input');data.fontSize&&$datepicker.css('font-size',data.fontSize);if(data.uiLibrary==='bootstrap'||data.uiLibrary==='bootstrap4'){if(data.size==='small'){$wrapper.addClass('input-group-sm');$datepicker.addClass('form-control-sm')}else if(data.size==='large'){$wrapper.addClass('input-group-lg');$datepicker.addClass('form-control-lg')}}else{if(data.size==='small'){$wrapper.addClass('small')}else if(data.size==='large'){$wrapper.addClass('large')}}
+$rightIcon.on('click',function(e){var $calendar=$('body').find('[role="calendar"][guid="'+$datepicker.attr('data-guid')+'"]');if($calendar.is(':visible')){bt.datepicker.methods.close($datepicker)}else{bt.datepicker.methods.open($datepicker,data)}});$wrapper.append($rightIcon);$calendar=bt.datepicker.methods.createCalendar($datepicker,data);if(data.footer!==!0){$datepicker.on('blur',function(){$datepicker.timeout=setTimeout(function(){bt.datepicker.methods.close($datepicker)},500)});$calendar.mousedown(function(){clearTimeout($datepicker.timeout);$datepicker.focus();return!1});$calendar.on('click',function(){clearTimeout($datepicker.timeout);$datepicker.focus()})}
+if(data.keyboardNavigation){$(document).on('keydown',bt.datepicker.methods.createKeyDownHandler($datepicker,$calendar,data))}},createCalendar:function($datepicker,data){var date,$body,$footer,$btnCancel,$btnOk,$calendar=$('
').addClass(data.style.calendar).attr('guid',$datepicker.attr('data-guid'));data.fontSize&&$calendar.css('font-size',data.fontSize);date=bt.core.parseDate(data.value,data.format,data.locale);if(!date||isNaN(date.getTime())){date=new Date()}else{$datepicker.attr('day',date.getFullYear()+'-'+date.getMonth()+'-'+date.getDate())}
+$calendar.attr('month',date.getMonth());$calendar.attr('year',date.getFullYear());bt.datepicker.methods.renderHeader($datepicker,$calendar,data,date);$body=$('
');$calendar.append($body);if(data.footer){$footer=$('');$btnCancel=$(''+bt.core.messages[data.locale].cancel+' ');$btnCancel.on('click',function(){$datepicker.close()});$footer.append($btnCancel);$btnOk=$(''+bt.core.messages[data.locale].ok+' ');$btnOk.on('click',function(){var date,dayArr,dayStr=$calendar.attr('selectedDay');if(dayStr){dayArr=dayStr.split('-');date=new Date(dayArr[0],dayArr[1],dayArr[2],$calendar.attr('hour')||0,$calendar.attr('minute')||0);bt.datepicker.methods.change($datepicker,$calendar,data,date)}else{$datepicker.close()}});$footer.append($btnOk);$calendar.append($footer)}
+$calendar.hide();$('body').append($calendar);if(data.modal){$calendar.wrapAll('
');bt.core.center($calendar)}
+return $calendar},renderHeader:function($datepicker,$calendar,data,date){var $header,$date,$year;if(data.header){$header=$('
');$year=$('
').on('click',function(){bt.datepicker.methods.renderDecade($datepicker,$calendar,data);$year.addClass('selected');$date.removeClass('selected')});$year.html(bt.core.formatDate(date,'yyyy',data.locale));$header.append($year);$date=$('
').on('click',function(){bt.datepicker.methods.renderMonth($datepicker,$calendar,data);$date.addClass('selected');$year.removeClass('selected')});$date.html(bt.core.formatDate(date,'ddd, mmm dd',data.locale));$header.append($date);$calendar.append($header)}},updateHeader:function($calendar,data,date){$calendar.find('[role="header"] [role="year"]').removeClass('selected').html(bt.core.formatDate(date,'yyyy',data.locale));$calendar.find('[role="header"] [role="date"]').addClass('selected').html(bt.core.formatDate(date,'ddd, mmm dd',data.locale));$calendar.find('[role="header"] [role="hour"]').removeClass('selected').html(bt.core.formatDate(date,'HH',data.locale));$calendar.find('[role="header"] [role="minute"]').removeClass('selected').html(bt.core.formatDate(date,'MM',data.locale))},createNavigation:function($datepicker,$body,$table,data){var $row,$navigator,$thead=$(' ');$navigator=$('
');$navigator.append($(''+data.icons.previousMonth+'
').on('click',bt.datepicker.methods.prev($datepicker,data)));$navigator.append($('
').on('click',bt.datepicker.methods.changePeriod($datepicker,data)));$navigator.append($(''+data.icons.nextMonth+'
').on('click',bt.datepicker.methods.next($datepicker,data)));$body.append($navigator);$row=$(' ');if(data.calendarWeeks){$row.append('
')}
+for(i=data.weekStartDay;i'+bt.core.messages[data.locale].weekDaysMin[i]+'
')}
+for(i=0;i'+bt.core.messages[data.locale].weekDaysMin[i]+'
')}
+$thead.append($row);$table.append($thead)},renderMonth:function($datepicker,$calendar,data){var weekDay,selectedDay,day,month,year,daysInMonth,total,firstDayPosition,i,now,prevMonth,nextMonth,$cell,$day,date,$body=$calendar.children('[role="body"]'),$table=$(''),$tbody=$(' ');$body.off().empty();bt.datepicker.methods.createNavigation($datepicker,$body,$table,data);month=parseInt($calendar.attr('month'),10);year=parseInt($calendar.attr('year'),10);$calendar.attr('type','month');$calendar.find('div[role="period"]').text(bt.core.messages[data.locale].monthNames[month]+' '+year);daysInMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);if(year%4==0&&year!=1900){daysInMonth[1]=29}
+total=daysInMonth[month];firstDayPosition=(new Date(year,month,1).getDay()+7-data.weekStartDay)%7;weekDay=0;$row=$(' ');prevMonth=bt.datepicker.methods.getPrevMonth(month,year);for(i=1;i<=firstDayPosition;i++){day=(daysInMonth[prevMonth.month]-firstDayPosition+i);date=new Date(prevMonth.year,prevMonth.month,day);if(data.calendarWeeks&&i===1){$row.append(''+bt.datepicker.methods.getWeekNumber(date)+'
')}
+$cell=$(' ');if(data.showOtherMonths){$day=$(''+day+'
');$cell.append($day);if(data.selectOtherMonths&&bt.datepicker.methods.isSelectable(data,date)){$cell.addClass('bt-cursor-pointer').attr('day',day).attr('month',prevMonth.month).attr('year',prevMonth.year);$day.on('click',bt.datepicker.methods.dayClickHandler($datepicker,$calendar,data,date));$day.on('mousedown',function(e){e.stopPropagation()})}else{$cell.addClass('disabled')}}
+$row.append($cell);weekDay++}
+if(i>1){$tbody.append($row)}
+now=new Date();for(i=1;i<=total;i++){date=new Date(year,month,i);if(weekDay==0){$row=$('');if(data.calendarWeeks){$row.append(''+bt.datepicker.methods.getWeekNumber(date)+'
')}}
+$cell=$(' ');if(year===now.getFullYear()&&month===now.getMonth()&&i===now.getDate()){$cell.addClass('today')}else{$cell.addClass('current-month')}
+$day=$(''+i+'
');if(bt.datepicker.methods.isSelectable(data,date)){$cell.addClass('bt-cursor-pointer');$day.on('click',bt.datepicker.methods.dayClickHandler($datepicker,$calendar,data,date));$day.on('mousedown',function(e){e.stopPropagation()})}else{$cell.addClass('disabled')}
+$cell.append($day);$row.append($cell);weekDay++;if(weekDay==7){$tbody.append($row);weekDay=0}}
+nextMonth=bt.datepicker.methods.getNextMonth(month,year);for(i=1;weekDay!=0;i++){date=new Date(nextMonth.year,nextMonth.month,i);$cell=$(' ');if(data.showOtherMonths){$day=$(''+i+'
');if(data.selectOtherMonths&&bt.datepicker.methods.isSelectable(data,date)){$cell.addClass('bt-cursor-pointer').attr('day',i).attr('month',nextMonth.month).attr('year',nextMonth.year);$day.on('click',bt.datepicker.methods.dayClickHandler($datepicker,$calendar,data,date));$day.on('mousedown',function(e){e.stopPropagation()})}else{$cell.addClass('disabled')}
+$cell.append($day)}
+$row.append($cell);weekDay++;if(weekDay==7){$tbody.append($row);weekDay=0}}
+$table.append($tbody);$body.append($table);if($calendar.attr('selectedDay')){selectedDay=$calendar.attr('selectedDay').split('-');date=new Date(selectedDay[0],selectedDay[1],selectedDay[2],$calendar.attr('hour')||0,$calendar.attr('minute')||0);$calendar.find('tbody td[day="'+selectedDay[2]+'"][month="'+selectedDay[1]+'"]').addClass('selected');bt.datepicker.methods.updateHeader($calendar,data,date)}},renderYear:function($datepicker,$calendar,data){var year,i,m,$month,$table=$calendar.find('>[role="body"]>table'),$tbody=$table.children('tbody');$table.children('thead').hide();year=parseInt($calendar.attr('year'),10);$calendar.attr('type','year');$calendar.find('div[role="period"]').text(year);$tbody.empty();for(i=0;i<3;i++){$row=$(' ');for(m=(i*4);m<=(i*4)+3;m++){$month=$(''+bt.core.messages[data.locale].monthShortNames[m]+'
');$month.on('click',bt.datepicker.methods.selectMonth($datepicker,$calendar,data,m));$cell=$(' ').append($month);$row.append($cell)}
+$tbody.append($row)}},renderDecade:function($datepicker,$calendar,data){var year,decade,i,y,$year,$table=$calendar.find('>[role="body"]>table'),$tbody=$table.children('tbody');$table.children('thead').hide();year=parseInt($calendar.attr('year'),10);decade=year-(year%10);$calendar.attr('type','decade');$calendar.find('div[role="period"]').text(decade+' - '+(decade+9));$tbody.empty();for(i=decade-1;i<=decade+10;i+=4){$row=$(' ');for(y=i;y<=i+3;y++){$year=$(''+y+'
');$year.on('click',bt.datepicker.methods.selectYear($datepicker,$calendar,data,y));$cell=$(' ').append($year);$row.append($cell)}
+$tbody.append($row)}},renderCentury:function($datepicker,$calendar,data){var year,century,i,d,$decade,$table=$calendar.find('>[role="body"]>table'),$tbody=$table.children('tbody');$table.children('thead').hide();year=parseInt($calendar.attr('year'),10);century=year-(year%100);$calendar.attr('type','century');$calendar.find('div[role="period"]').text(century+' - '+(century+99));$tbody.empty();for(i=(century-10);i ');for(d=i;d<=i+30;d+=10){$decade=$(''+d+'
');$decade.on('click',bt.datepicker.methods.selectDecade($datepicker,$calendar,data,d));$cell=$(' ').append($decade);$row.append($cell)}
+$tbody.append($row)}},getWeekNumber:function(date){var d=new Date(date.valueOf());d.setDate(d.getDate()+6);d=new Date(Date.UTC(d.getFullYear(),d.getMonth(),d.getDate()));d.setUTCDate(d.getUTCDate()+4-(d.getUTCDay()||7));var yearStart=new Date(Date.UTC(d.getUTCFullYear(),0,1));var weekNo=Math.ceil((((d-yearStart)/86400000)+1)/7);return weekNo},getMinDate:function(data){var minDate;if(data.minDate){if(typeof(data.minDate)==='string'){minDate=bt.core.parseDate(data.minDate,data.format,data.locale)}else if(typeof(data.minDate)==='function'){minDate=data.minDate();if(typeof minDate==='string'){minDate=bt.core.parseDate(minDate,data.format,data.locale)}}else if(typeof data.minDate.getMonth==='function'){minDate=data.minDate}}
+return minDate},getMaxDate:function(data){var maxDate;if(data.maxDate){if(typeof data.maxDate==='string'){maxDate=bt.core.parseDate(data.maxDate,data.format,data.locale)}else if(typeof data.maxDate==='function'){maxDate=data.maxDate();if(typeof maxDate==='string'){maxDate=bt.core.parseDate(maxDate,data.format,data.locale)}}else if(typeof data.maxDate.getMonth==='function'){maxDate=data.maxDate}}
+return maxDate},isSelectable:function(data,date){var result=!0,minDate=bt.datepicker.methods.getMinDate(data),maxDate=bt.datepicker.methods.getMaxDate(data),i;if(minDate&&datemaxDate){result=!1}
+if(result){if(data.disableDates){if($.isArray(data.disableDates)){for(i=0;i-1){result=!1}}
+return result},getPrevMonth:function(month,year){date=new Date(year,month,1);date.setMonth(date.getMonth()-1);return{month:date.getMonth(),year:date.getFullYear()}},getNextMonth:function(month,year){date=new Date(year,month,1);date.setMonth(date.getMonth()+1);return{month:date.getMonth(),year:date.getFullYear()}},prev:function($datepicker,data){return function(){var date,month,year,decade,century,$calendar=$('body').find('[role="calendar"][guid="'+$datepicker.attr('data-guid')+'"]');switch($calendar.attr('type')){case 'month':month=parseInt($calendar.attr('month'),10);year=parseInt($calendar.attr('year'),10);date=bt.datepicker.methods.getPrevMonth(month,year);$calendar.attr('month',date.month);$calendar.attr('year',date.year);bt.datepicker.methods.renderMonth($datepicker,$calendar,data);break;case 'year':year=parseInt($calendar.attr('year'),10);$calendar.attr('year',year-1);bt.datepicker.methods.renderYear($datepicker,$calendar,data);break;case 'decade':year=parseInt($calendar.attr('year'),10);decade=year-(year%10);$calendar.attr('year',decade-10);bt.datepicker.methods.renderDecade($datepicker,$calendar,data);break;case 'century':year=parseInt($calendar.attr('year'),10);century=year-(year%100);$calendar.attr('year',century-100);bt.datepicker.methods.renderCentury($datepicker,$calendar,data);break}}},next:function($datepicker,data){return function(){var date,month,year,decade,century,$calendar=$('body').find('[role="calendar"][guid="'+$datepicker.attr('data-guid')+'"]');switch($calendar.attr('type')){case 'month':month=parseInt($calendar.attr('month'),10);year=parseInt($calendar.attr('year'),10);date=bt.datepicker.methods.getNextMonth(month,year);$calendar.attr('month',date.month);$calendar.attr('year',date.year);bt.datepicker.methods.renderMonth($datepicker,$calendar,data);break;case 'year':year=parseInt($calendar.attr('year'),10);$calendar.attr('year',year+1);bt.datepicker.methods.renderYear($datepicker,$calendar,data);break;case 'decade':year=parseInt($calendar.attr('year'),10);decade=year-(year%10);$calendar.attr('year',decade+10);bt.datepicker.methods.renderDecade($datepicker,$calendar,data);break;case 'century':year=parseInt($calendar.attr('year'),10);century=year-(year%100);$calendar.attr('year',century+100);bt.datepicker.methods.renderCentury($datepicker,$calendar,data);break}}},changePeriod:function($datepicker,data){return function(e){var $calendar=$('body').find('[role="calendar"][guid="'+$datepicker.attr('data-guid')+'"]');switch($calendar.attr('type')){case 'month':bt.datepicker.methods.renderYear($datepicker,$calendar,data);break;case 'year':bt.datepicker.methods.renderDecade($datepicker,$calendar,data);break;case 'decade':bt.datepicker.methods.renderCentury($datepicker,$calendar,data);break}}},dayClickHandler:function($datepicker,$calendar,data,date){return function(e){e&&e.stopPropagation();bt.datepicker.methods.selectDay($datepicker,$calendar,data,date);if(data.footer!==!0&&data.autoClose!==!1){bt.datepicker.methods.change($datepicker,$calendar,data,date)}
+return $datepicker}},change:function($datepicker,$calendar,data,date){var day=date.getDate(),month=date.getMonth(),year=date.getFullYear(),value=bt.core.formatDate(date,data.format,data.locale);$calendar.attr('month',month);$calendar.attr('year',year);$datepicker.val(value);bt.datepicker.events.change($datepicker);if(window.getComputedStyle($calendar[0]).display!=='none'){bt.datepicker.methods.close($datepicker)}},selectDay:function($datepicker,$calendar,data,date){var day=date.getDate(),month=date.getMonth(),year=date.getFullYear();$calendar.attr('selectedDay',year+'-'+month+'-'+day);$calendar.find('tbody td').removeClass('selected');$calendar.find('tbody td[day="'+day+'"][month="'+month+'"]').addClass('selected');bt.datepicker.methods.updateHeader($calendar,data,date);bt.datepicker.events.select($datepicker,'day')},selectMonth:function($datepicker,$calendar,data,month){return function(e){$calendar.attr('month',month);bt.datepicker.methods.renderMonth($datepicker,$calendar,data);bt.datepicker.events.select($datepicker,'month')}},selectYear:function($datepicker,$calendar,data,year){return function(e){$calendar.attr('year',year);bt.datepicker.methods.renderYear($datepicker,$calendar,data);bt.datepicker.events.select($datepicker,'year')}},selectDecade:function($datepicker,$calendar,data,year){return function(e){$calendar.attr('year',year);bt.datepicker.methods.renderDecade($datepicker,$calendar,data);bt.datepicker.events.select($datepicker,'decade')}},open:function($datepicker,data){var $calendar=$('body').find('[role="calendar"][guid="'+$datepicker.attr('data-guid')+'"]');if($datepicker.val()){$datepicker.value($datepicker.val())}
+switch($calendar.attr('type')){case 'month':bt.datepicker.methods.renderMonth($datepicker,$calendar,data);break;case 'year':bt.datepicker.methods.renderYear($datepicker,$calendar,data);break;case 'decade':bt.datepicker.methods.renderDecade($datepicker,$calendar,data);break;case 'century':bt.datepicker.methods.renderCentury($datepicker,$calendar,data);break}
+$calendar.show();$calendar.closest('div[role="modal"]').show();if(data.modal){bt.core.center($calendar)}else{bt.core.setChildPosition($datepicker[0],$calendar[0]);$datepicker.focus()}
+clearTimeout($datepicker.timeout);bt.datepicker.events.open($datepicker)},close:function($datepicker){var $calendar=$('body').find('[role="calendar"][guid="'+$datepicker.attr('data-guid')+'"]');$calendar.hide();$calendar.closest('div[role="modal"]').hide();bt.datepicker.events.close($datepicker)},createKeyDownHandler:function($datepicker,$calendar,data){return function(e){var month,year,day,index,$new,$active,e=e||window.event;if(window.getComputedStyle($calendar[0]).display!=='none')
+{$active=bt.datepicker.methods.getActiveCell($calendar);if(e.keyCode=='38'){index=$active.index();$new=$active.closest('tr').prev('tr').find('td:eq('+index+')');if(!$new.is('[day]')){bt.datepicker.methods.prev($datepicker,data)();$new=$calendar.find('tbody tr').last().find('td:eq('+index+')');if($new.is(':empty')){$new=$calendar.find('tbody tr').last().prev().find('td:eq('+index+')')}}
+if($new.is('[day]')){$new.addClass('focused');$active.removeClass('focused')}}else if(e.keyCode=='40'){index=$active.index();$new=$active.closest('tr').next('tr').find('td:eq('+index+')');if(!$new.is('[day]')){bt.datepicker.methods.next($datepicker,data)();$new=$calendar.find('tbody tr').first().find('td:eq('+index+')');if(!$new.is('[day]')){$new=$calendar.find('tbody tr:eq(1)').find('td:eq('+index+')')}}
+if($new.is('[day]')){$new.addClass('focused');$active.removeClass('focused')}}else if(e.keyCode=='37'){$new=$active.prev('td[day]:not(.disabled)');if($new.length===0){$new=$active.closest('tr').prev('tr').find('td[day]').last()}
+if($new.length===0){bt.datepicker.methods.prev($datepicker,data)();$new=$calendar.find('tbody tr').last().find('td[day]').last()}
+if($new.length>0){$new.addClass('focused');$active.removeClass('focused')}}else if(e.keyCode=='39'){$new=$active.next('[day]:not(.disabled)');if($new.length===0){$new=$active.closest('tr').next('tr').find('td[day]').first()}
+if($new.length===0){bt.datepicker.methods.next($datepicker,data)();$new=$calendar.find('tbody tr').first().find('td[day]').first()}
+if($new.length>0){$new.addClass('focused');$active.removeClass('focused')}}else if(e.keyCode=='13'){day=parseInt($active.attr('day'),10);month=parseInt($active.attr('month'),10);year=parseInt($active.attr('year'),10);bt.datepicker.methods.dayClickHandler($datepicker,$calendar,data,new Date(year,month,day))()}else if(e.keyCode=='27'){$datepicker.close()}}}},getActiveCell:function($calendar){var $cell=$calendar.find('td[day].focused');if($cell.length===0){$cell=$calendar.find('td[day].selected');if($cell.length===0){$cell=$calendar.find('td[day].today');if($cell.length===0){$cell=$calendar.find('td[day]:not(.disabled)').first()}}}
+return $cell},value:function($datepicker,value){var $calendar,date,data=$datepicker.data();if(typeof(value)==="undefined"){return $datepicker.val()}else{date=bt.core.parseDate(value,data.format,data.locale);if(date){$calendar=$('body').find('[role="calendar"][guid="'+$datepicker.attr('data-guid')+'"]');bt.datepicker.methods.dayClickHandler($datepicker,$calendar,data,date)()}else{$datepicker.val('')}
+return $datepicker}},destroy:function($datepicker){var data=$datepicker.data(),$parent=$datepicker.parent(),$picker=$('body').find('[role="calendar"][guid="'+$datepicker.attr('data-guid')+'"]');if(data){$datepicker.off();if($picker.parent('[role="modal"]').length>0){$picker.unwrap()}
+$picker.remove();$datepicker.removeData();$datepicker.removeAttr('data-type').removeAttr('data-guid').removeAttr('data-datepicker');$datepicker.removeClass();$parent.children('[role="right-icon"]').remove();$datepicker.unwrap()}
+return $datepicker}};bt.datepicker.events={change:function($datepicker){return $datepicker.triggerHandler('change')},select:function($datepicker,type){return $datepicker.triggerHandler('select',[type])},open:function($datepicker){return $datepicker.triggerHandler('open')},close:function($datepicker){return $datepicker.triggerHandler('close')}};bt.datepicker.widget=function($element,jsConfig){var self=this,methods=bt.datepicker.methods;self.value=function(value){return methods.value(this,value)};self.destroy=function(){return methods.destroy(this)};self.open=function(){bt.datepicker.methods.open(this,this.data())};self.close=function(){bt.datepicker.methods.close(this)};$.extend($element,self);if('true'!==$element.attr('data-datepicker')){methods.init.call($element,jsConfig)}
+return $element};bt.datepicker.widget.prototype=new bt.widget();bt.datepicker.widget.constructor=bt.datepicker.widget;(function($){$.fn.datepicker=function(method){var $widget;if(this&&this.length){if(typeof method==='object'||!method){return new bt.datepicker.widget(this,method)}else{$widget=new bt.datepicker.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);bt.timepicker={plugins:{}};bt.timepicker.config={base:{width:undefined,modal:!0,header:!0,footer:!0,format:'HH:MM',uiLibrary:'materialdesign',value:undefined,mode:'ampm',locale:'en-us',size:'default',icons:{rightIcon:' '},style:{modal:'bt-modal',wrapper:'bt-timepicker bt-timepicker-md bt-unselectable',input:'bt-textbox-md',clock:'bt-picker bt-picker-md timepicker',footer:'',button:'bt-button-md'}},bootstrap:{style:{wrapper:'bt-timepicker bt-timepicker-bootstrap bt-unselectable input-group',input:'form-control',clock:'bt-picker bt-picker-bootstrap timepicker',footer:'modal-footer',button:'btn btn-default'},iconsLibrary:'glyphicons'},bootstrap4:{style:{wrapper:'bt-timepicker bt-timepicker-bootstrap bt-unselectable input-group',input:'form-control border',clock:'bt-picker bt-picker-bootstrap timepicker',footer:'modal-footer',button:'btn btn-default'}}};bt.timepicker.methods={init:function(jsConfig){bt.widget.prototype.init.call(this,jsConfig,'timepicker');this.attr('data-timepicker','true');bt.timepicker.methods.initialize(this,this.data());bt.timepicker.methods.createClock(this);return this},initialize:function($timepicker,data){var $calendar,$rightIcon,$wrapper=$timepicker.parent('div[role="wrapper"]');if(data.uiLibrary==='bootstrap'){$rightIcon=$(''+data.icons.rightIcon+' ')}else if(data.uiLibrary==='bootstrap4'){$rightIcon=$(''+data.icons.rightIcon+' ')}else{$rightIcon=$(data.icons.rightIcon)}
+$rightIcon.attr('role','right-icon');if($wrapper.length===0){$wrapper=$('
').addClass(data.style.wrapper);$timepicker.wrap($wrapper)}else{$wrapper.addClass(data.style.wrapper)}
+$wrapper=$timepicker.parent('div[role="wrapper"]');data.width&&$wrapper.css('width',data.width);$timepicker.val(data.value).addClass(data.style.input).attr('role','input');if(data.uiLibrary==='bootstrap'||data.uiLibrary==='bootstrap4'){if(data.size==='small'){$wrapper.addClass('input-group-sm');$timepicker.addClass('form-control-sm')}else if(data.size==='large'){$wrapper.addClass('input-group-lg');$timepicker.addClass('form-control-lg')}}else{if(data.size==='small'){$wrapper.addClass('small')}else if(data.size==='large'){$wrapper.addClass('large')}}
+$rightIcon.on('click',function(e){var $clock=$('body').find('[role="clock"][guid="'+$timepicker.attr('data-guid')+'"]');if($clock.is(':visible')){bt.timepicker.methods.close($timepicker)}else{bt.timepicker.methods.open($timepicker)}});if(data.footer===!1){$timepicker.on('blur',function(){$timepicker.timeout=setTimeout(function(){if(!$timepicker.mouseMove){bt.timepicker.methods.close($timepicker)}},500)})}
+$wrapper.append($rightIcon)},initMouse:function($body,$input,$picker,data){$body.off();$body.on('mousedown',bt.timepicker.methods.mouseDownHandler($input,$picker));$body.on('mousemove',bt.timepicker.methods.mouseMoveHandler($input,$picker,data));$body.on('mouseup',bt.timepicker.methods.mouseUpHandler($input,$picker,data))},createClock:function($timepicker){var date,data=$timepicker.data(),$clock=$('
').addClass(data.style.clock).attr('guid',$timepicker.attr('data-guid')),$hour=$('
'),$minute=$('
'),$header=$('
'),$mode=$('
'),$body=$('
'),$btnOk=$(''+bt.core.messages[data.locale].ok+' '),$btnCancel=$(''+bt.core.messages[data.locale].cancel+' '),$footer=$('');date=bt.core.parseDate(data.value,data.format,data.locale);if(!date||isNaN(date.getTime())){date=new Date()}else{$timepicker.attr('hours',date.getHours())}
+bt.timepicker.methods.initMouse($body,$timepicker,$clock,data);if(data.header){$hour.on('click',function(){bt.timepicker.methods.renderHours($timepicker,$clock,data)});$minute.on('click',function(){bt.timepicker.methods.renderMinutes($timepicker,$clock,data)});$header.append($hour).append(':').append($minute);if(data.mode==='ampm'){$mode.append($(''+bt.core.messages[data.locale].am+' ').on('click',function(){var hour=bt.timepicker.methods.getHour($clock);$clock.attr('mode','am');$(this).addClass('selected');$(this).parent().children('[role="pm"]').removeClass('selected');if(hour>=12){$clock.attr('hour',hour-12)}
+if(!data.modal){clearTimeout($timepicker.timeout);$timepicker.focus()}}));$mode.append(' ');$mode.append($(''+bt.core.messages[data.locale].pm+' ').on('click',function(){var hour=bt.timepicker.methods.getHour($clock);$clock.attr('mode','pm');$(this).addClass('selected');$(this).parent().children('[role="am"]').removeClass('selected');if(hour<12){$clock.attr('hour',hour+12)}
+if(!data.modal){clearTimeout($timepicker.timeout);$timepicker.focus()}}));$header.append($mode)}
+$clock.append($header)}
+$clock.append($body);if(data.footer){$btnCancel.on('click',function(){$timepicker.close()});$footer.append($btnCancel);$btnOk.on('click',bt.timepicker.methods.setTime($timepicker,$clock));$footer.append($btnOk);$clock.append($footer)}
+$clock.hide();$('body').append($clock);if(data.modal){$clock.wrapAll('
');bt.core.center($clock)}
+return $clock},getHour:function($clock){return parseInt($clock.attr('hour'),10)||0},getMinute:function($clock){return parseInt($clock.attr('minute'),10)||0},setTime:function($timepicker,$clock){return function(){var hour=bt.timepicker.methods.getHour($clock),minute=bt.timepicker.methods.getMinute($clock),mode=$clock.attr('mode'),date=new Date(0,0,0,(hour===12&&mode==='am'?0:hour),minute),data=$timepicker.data(),value=bt.core.formatDate(date,data.format,data.locale);$timepicker.value(value);$timepicker.close()}},getPointerValue:function(x,y,mode){var value,radius,size=256,angle=Math.atan2(size/2-x,size/2-y)/Math.PI*180;if(angle<0){angle=360+angle}
+switch(mode){case 'ampm':{value=12-Math.round(angle*12/360);return value===0?12:value}
+case '24hr':{radius=Math.sqrt(Math.pow(size/2-x,2)+Math.pow(size/2-y,2));value=12-Math.round(angle*12/360);if(value===0){value=12}
+if(radius12)&&data.mode==='24hr'){$arrow.css('width','calc(50% - 52px)')}else{$arrow.css('width','calc(50% - 20px)')}
+if(data.dialMode=='hours'){$arrow.css('transform','rotate('+((hour*30)-90).toString()+'deg)')}else{$arrow.css('transform','rotate('+((minute*6)-90).toString()+'deg)')}
+$arrow.show();visualHour=(data.mode==='ampm'&&hour>12?hour-12:(hour==0?12:hour));$numbers=$clock.find('[role="body"] span');$numbers.removeClass('selected');$numbers.filter(function(e){if(data.dialMode=='hours'){return parseInt($(this).text(),10)==visualHour}else{return parseInt($(this).text(),10)==minute}}).addClass('selected');if(data.header){$header=$clock.find('[role="header"]');$header.find('[role="hour"]').text(visualHour);$header.find('[role="minute"]').text(bt.core.pad(minute));if(data.mode==='ampm'){if(hour>=12){$header.find('[role="pm"]').addClass('selected');$header.find('[role="am"]').removeClass('selected')}else{$header.find('[role="am"]').addClass('selected');$header.find('[role="pm"]').removeClass('selected')}}}},mouseDownHandler:function($timepicker,$clock){return function(e){$timepicker.mouseMove=!0}},mouseMoveHandler:function($timepicker,$clock,data){return function(e){if($timepicker.mouseMove){bt.timepicker.methods.updateArrow(e,$timepicker,$clock,data)}}},mouseUpHandler:function($timepicker,$clock,data){return function(e){bt.timepicker.methods.updateArrow(e,$timepicker,$clock,data);$timepicker.mouseMove=!1;if(!data.modal){clearTimeout($timepicker.timeout);$timepicker.focus()}
+if(data.dialMode=='hours'){setTimeout(function(){bt.timepicker.events.select($timepicker,'hour');bt.timepicker.methods.renderMinutes($timepicker,$clock,data)},1000)}else if(data.dialMode=='minutes'){if(data.footer!==!0&&data.autoClose!==!1){bt.timepicker.methods.setTime($timepicker,$clock)()}
+bt.timepicker.events.select($timepicker,'minute')}}},renderHours:function($timepicker,$clock,data){var $dial,$body=$clock.find('[role="body"]');clearTimeout($timepicker.timeout);$body.empty();$dial=$('
');$dial.append('');$dial.append('1 ');$dial.append('2 ');$dial.append('3 ');$dial.append('4 ');$dial.append('5 ');$dial.append('6 ');$dial.append('7 ');$dial.append('8 ');$dial.append('9 ');$dial.append('10 ');$dial.append('11 ');$dial.append('12 ');if(data.mode==='24hr'){$dial.append('13 ');$dial.append('14 ');$dial.append('15 ');$dial.append('16 ');$dial.append('17 ');$dial.append('18 ');$dial.append('19 ');$dial.append('20 ');$dial.append('21 ');$dial.append('22 ');$dial.append('23 ');$dial.append('00 ')}
+$body.append($dial);$clock.find('[role="header"] [role="hour"]').addClass('selected');$clock.find('[role="header"] [role="minute"]').removeClass('selected');data.dialMode='hours';bt.timepicker.methods.update($timepicker,$clock,data)},renderMinutes:function($timepicker,$clock,data){var $body=$clock.find('[role="body"]');clearTimeout($timepicker.timeout);$body.empty();$dial=$('
');$dial.append('');$dial.append('5 ');$dial.append('10 ');$dial.append('15 ');$dial.append('20 ');$dial.append('25 ');$dial.append('30 ');$dial.append('35 ');$dial.append('40 ');$dial.append('45 ');$dial.append('50 ');$dial.append('55 ');$dial.append('00 ');$body.append($dial);$clock.find('[role="header"] [role="hour"]').removeClass('selected');$clock.find('[role="header"] [role="minute"]').addClass('selected');data.dialMode='minutes';bt.timepicker.methods.update($timepicker,$clock,data)},open:function($timepicker){var time,hour,data=$timepicker.data(),$clock=$('body').find('[role="clock"][guid="'+$timepicker.attr('data-guid')+'"]');if($timepicker.value()){time=bt.core.parseDate($timepicker.value(),data.format,data.locale)}else{time=new Date()}
+hour=time.getHours();if(data.mode==='ampm'){$clock.attr('mode',hour>12?'pm':'am')}
+$clock.attr('hour',hour);$clock.attr('minute',time.getMinutes());bt.timepicker.methods.renderHours($timepicker,$clock,data);$clock.show();$clock.closest('div[role="modal"]').show();if(data.modal){bt.core.center($clock)}else{bt.core.setChildPosition($timepicker[0],$clock[0]);$timepicker.focus()}
+bt.timepicker.events.open($timepicker);return $timepicker},close:function($timepicker){var $clock=$('body').find('[role="clock"][guid="'+$timepicker.attr('data-guid')+'"]');$clock.hide();$clock.closest('div[role="modal"]').hide();bt.timepicker.events.close($timepicker);return $timepicker},value:function($timepicker,value){var $clock,time,data=$timepicker.data();if(typeof(value)==="undefined"){return $timepicker.val()}else{$timepicker.val(value);bt.timepicker.events.change($timepicker);return $timepicker}},destroy:function($timepicker){var data=$timepicker.data(),$parent=$timepicker.parent(),$clock=$('body').find('[role="clock"][guid="'+$timepicker.attr('data-guid')+'"]');if(data){$timepicker.off();if($clock.parent('[role="modal"]').length>0){$clock.unwrap()}
+$clock.remove();$timepicker.removeData();$timepicker.removeAttr('data-type').removeAttr('data-guid').removeAttr('data-timepicker');$timepicker.removeClass();$parent.children('[role="right-icon"]').remove();$timepicker.unwrap()}
+return $timepicker}};bt.timepicker.events={change:function($timepicker){return $timepicker.triggerHandler('change')},select:function($timepicker,type){return $timepicker.triggerHandler('select',[type])},open:function($timepicker){return $timepicker.triggerHandler('open')},close:function($timepicker){return $timepicker.triggerHandler('close')}};bt.timepicker.widget=function($element,jsConfig){var self=this,methods=bt.timepicker.methods;self.mouseMove=!1;self.value=function(value){return methods.value(this,value)};self.destroy=function(){return methods.destroy(this)};self.open=function(){return bt.timepicker.methods.open(this)};self.close=function(){return bt.timepicker.methods.close(this)};$.extend($element,self);if('true'!==$element.attr('data-timepicker')){methods.init.call($element,jsConfig)}
+return $element};bt.timepicker.widget.prototype=new bt.widget();bt.timepicker.widget.constructor=bt.timepicker.widget;(function($){$.fn.timepicker=function(method){var $widget;if(this&&this.length){if(typeof method==='object'||!method){return new bt.timepicker.widget(this,method)}else{$widget=new bt.timepicker.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);bt.datetimepicker={plugins:{},messages:{'en-us':{}}};bt.datetimepicker.config={base:{datepicker:bt.datepicker.config.base,timepicker:bt.timepicker.config.base,uiLibrary:'materialdesign',value:undefined,format:'HH:MM mm/dd/yyyy',width:undefined,modal:!1,footer:!1,size:'default',locale:'en-us',icons:{},style:{calendar:'bt-picker bt-picker-md datetimepicker bt-unselectable'}},bootstrap:{style:{calendar:'bt-picker bt-picker-bootstrap datetimepicker bt-unselectable'},iconsLibrary:'glyphicons'},bootstrap4:{style:{calendar:'bt-picker bt-picker-bootstrap datetimepicker bt-unselectable'}}};bt.datetimepicker.methods={init:function(jsConfig){bt.widget.prototype.init.call(this,jsConfig,'datetimepicker');this.attr('data-datetimepicker','true');bt.datetimepicker.methods.initialize(this);return this},getConfig:function(clientConfig,type){var config=bt.widget.prototype.getConfig.call(this,clientConfig,type);uiLibrary=clientConfig.hasOwnProperty('uiLibrary')?clientConfig.uiLibrary:config.uiLibrary;if(bt.datepicker.config[uiLibrary]){$.extend(!0,config.datepicker,bt.datepicker.config[uiLibrary])}
+if(bt.timepicker.config[uiLibrary]){$.extend(!0,config.timepicker,bt.timepicker.config[uiLibrary])}
+iconsLibrary=clientConfig.hasOwnProperty('iconsLibrary')?clientConfig.iconsLibrary:config.iconsLibrary;if(bt.datepicker.config[iconsLibrary]){$.extend(!0,config.datepicker,bt.datepicker.config[iconsLibrary])}
+if(bt.timepicker.config[iconsLibrary]){$.extend(!0,config.timepicker,bt.timepicker.config[iconsLibrary])}
+return config},initialize:function($datetimepicker){var $picker,$header,$date,$time,date,$switch,$calendarMode,$clockMode,data=$datetimepicker.data();data.datepicker.uiLibrary=data.uiLibrary;data.datepicker.iconsLibrary=data.iconsLibrary;data.datepicker.width=data.width;data.datepicker.format=data.format;data.datepicker.locale=data.locale;data.datepicker.modal=data.modal;data.datepicker.footer=data.footer;data.datepicker.style.calendar=data.style.calendar;data.datepicker.value=data.value;data.datepicker.size=data.size;data.datepicker.autoClose=!1;bt.datepicker.methods.initialize($datetimepicker,data.datepicker);$datetimepicker.on('select',function(e,type){var date,value;if(type==='day'){bt.datetimepicker.methods.createShowHourHandler($datetimepicker,$picker,data)()}else if(type==='minute'){if($picker.attr('selectedDay')&&data.footer!==!0){selectedDay=$picker.attr('selectedDay').split('-');date=new Date(selectedDay[0],selectedDay[1],selectedDay[2],$picker.attr('hour')||0,$picker.attr('minute')||0);value=bt.core.formatDate(date,data.format,data.locale);$datetimepicker.val(value);bt.datetimepicker.events.change($datetimepicker);bt.datetimepicker.methods.close($datetimepicker)}}});$datetimepicker.on('open',function(){var $header=$picker.children('[role="header"]');$header.find('[role="calendarMode"]').addClass("selected");$header.find('[role="clockMode"]').removeClass("selected")});$picker=$('body').find('[role="calendar"][guid="'+$datetimepicker.attr('data-guid')+'"]');date=data.value?bt.core.parseDate(data.value,data.format,data.locale):new Date();$picker.attr('hour',date.getHours());$picker.attr('minute',date.getMinutes());data.timepicker.uiLibrary=data.uiLibrary;data.timepicker.iconsLibrary=data.iconsLibrary;data.timepicker.format=data.format;data.timepicker.locale=data.locale;data.timepicker.header=!0;data.timepicker.footer=data.footer;data.timepicker.size=data.size;data.timepicker.mode='24hr';data.timepicker.autoClose=!1;$header=$('
');$date=$('
');$date.on('click',bt.datetimepicker.methods.createShowDateHandler($datetimepicker,$picker,data));$date.html(bt.core.formatDate(new Date(),'ddd, mmm dd',data.locale));$header.append($date);$switch=$('
');$calendarMode=$('event ');$calendarMode.on('click',bt.datetimepicker.methods.createShowDateHandler($datetimepicker,$picker,data));$switch.append($calendarMode);$time=$('
');$time.append($('
').on('click',bt.datetimepicker.methods.createShowHourHandler($datetimepicker,$picker,data)).html(bt.core.formatDate(new Date(),'HH',data.locale)));$time.append(':');$time.append($('
').on('click',bt.datetimepicker.methods.createShowMinuteHandler($datetimepicker,$picker,data)).html(bt.core.formatDate(new Date(),'MM',data.locale)));$switch.append($time);$clockMode=$('clock ');$clockMode.on('click',bt.datetimepicker.methods.createShowHourHandler($datetimepicker,$picker,data));$switch.append($clockMode);$header.append($switch);$picker.prepend($header)},createShowDateHandler:function($datetimepicker,$picker,data){return function(e){var $header=$picker.children('[role="header"]');$header.find('[role="calendarMode"]').addClass("selected");$header.find('[role="date"]').addClass("selected");$header.find('[role="clockMode"]').removeClass("selected");$header.find('[role="hour"]').removeClass("selected");$header.find('[role="minute"]').removeClass("selected");bt.datepicker.methods.renderMonth($datetimepicker,$picker,data.datepicker)}},createShowHourHandler:function($datetimepicker,$picker,data){return function(){var $header=$picker.children('[role="header"]');$header.find('[role="calendarMode"]').removeClass("selected");$header.find('[role="date"]').removeClass("selected");$header.find('[role="clockMode"]').addClass("selected");$header.find('[role="hour"]').addClass("selected");$header.find('[role="minute"]').removeClass("selected");bt.timepicker.methods.initMouse($picker.children('[role="body"]'),$datetimepicker,$picker,data.timepicker);bt.timepicker.methods.renderHours($datetimepicker,$picker,data.timepicker)}},createShowMinuteHandler:function($datetimepicker,$picker,data){return function(){var $header=$picker.children('[role="header"]');$header.find('[role="calendarMode"]').removeClass("selected");$header.find('[role="date"]').removeClass("selected");$header.find('[role="clockMode"]').addClass("selected");$header.find('[role="hour"]').removeClass("selected");$header.find('[role="minute"]').addClass("selected");bt.timepicker.methods.initMouse($picker.children('[role="body"]'),$datetimepicker,$picker,data.timepicker);bt.timepicker.methods.renderMinutes($datetimepicker,$picker,data.timepicker)}},close:function($datetimepicker){var $calendar=$('body').find('[role="calendar"][guid="'+$datetimepicker.attr('data-guid')+'"]');$calendar.hide();$calendar.closest('div[role="modal"]').hide()},value:function($datetimepicker,value){var $calendar,date,data=$datetimepicker.data();if(typeof(value)==="undefined"){return $datetimepicker.val()}else{date=bt.core.parseDate(value,data.format,data.locale);if(date){$calendar=$('body').find('[role="calendar"][guid="'+$datetimepicker.attr('data-guid')+'"]');bt.datepicker.methods.dayClickHandler($datetimepicker,$calendar,data,date)()}else{$datetimepicker.val('')}
+return $datetimepicker}},destroy:function($datetimepicker){var data=$datetimepicker.data(),$parent=$datetimepicker.parent(),$picker=$('body').find('[role="calendar"][guid="'+$datetimepicker.attr('data-guid')+'"]');if(data){$datetimepicker.off();if($picker.parent('[role="modal"]').length>0){$picker.unwrap()}
+$picker.remove();$datetimepicker.removeData();$datetimepicker.removeAttr('data-type').removeAttr('data-guid').removeAttr('data-datetimepicker');$datetimepicker.removeClass();$parent.children('[role="right-icon"]').remove();$datetimepicker.unwrap()}
+return $datetimepicker}};bt.datetimepicker.events={change:function($datetimepicker){return $datetimepicker.triggerHandler('change')}};bt.datetimepicker.widget=function($element,jsConfig){var self=this,methods=bt.datetimepicker.methods;self.mouseMove=!1;self.value=function(value){return methods.value(this,value)};self.destroy=function(){return methods.destroy(this)};$.extend($element,self);if('true'!==$element.attr('data-datetimepicker')){methods.init.call($element,jsConfig)}
+return $element};bt.datetimepicker.widget.prototype=new bt.widget();bt.datetimepicker.widget.constructor=bt.datetimepicker.widget;bt.datetimepicker.widget.prototype.getConfig=bt.datetimepicker.methods.getConfig;(function($){$.fn.datetimepicker=function(method){var $widget;if(this&&this.length){if(typeof method==='object'||!method){return new bt.datetimepicker.widget(this,method)}else{$widget=new bt.datetimepicker.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);bt.slider={plugins:{},messages:{'en-us':{}}};bt.slider.config={base:{min:0,max:100,uiLibrary:'materialdesign',value:undefined,icons:{},style:{wrapper:'bt-slider bt-slider-md',progress:undefined,track:undefined}},bootstrap:{style:{wrapper:'bt-slider bt-slider-bootstrap bt-slider-bootstrap-3',progress:'progress-bar',track:'progress'}},bootstrap4:{style:{wrapper:'bt-slider bt-slider-bootstrap bt-slider-bootstrap-4',progress:'progress-bar',track:'progress'}}};bt.slider.methods={init:function(jsConfig){bt.widget.prototype.init.call(this,jsConfig,'slider');this.attr('data-slider','true');bt.slider.methods.initialize(this,this.data());return this},initialize:function($slider,data){var wrapper,track,handle,progress;$slider[0].style.display='none';if($slider[0].parentElement.attributes.role!=='wrapper'){wrapper=document.createElement('div');wrapper.setAttribute('role','wrapper');$slider[0].parentNode.insertBefore(wrapper,$slider[0]);wrapper.appendChild($slider[0])}else{wrapper=$slider[0].parentElement}
+if(data.width){wrapper.style.width=data.width+'px'}
+bt.core.addClasses(wrapper,data.style.wrapper);track=$slider[0].querySelector('[role="track"]');if(track==null){track=document.createElement('div');track.setAttribute('role','track');wrapper.appendChild(track)}
+bt.core.addClasses(track,data.style.track);handle=$slider[0].querySelector('[role="handle"]');if(handle==null){handle=document.createElement('div');handle.setAttribute('role','handle');wrapper.appendChild(handle)}
+progress=$slider[0].querySelector('[role="progress"]');if(progress==null){progress=document.createElement('div');progress.setAttribute('role','progress');wrapper.appendChild(progress)}
+bt.core.addClasses(progress,data.style.progress);if(!data.value){data.value=data.min}
+bt.slider.methods.value($slider,data,data.value);bt.documentManager.subscribeForEvent('mouseup',$slider.data('guid'),bt.slider.methods.createMouseUpHandler($slider,handle,data));handle.addEventListener('mousedown',bt.slider.methods.createMouseDownHandler(handle,data));bt.documentManager.subscribeForEvent('mousemove',$slider.data('guid'),bt.slider.methods.createMouseMoveHandler($slider,track,handle,progress,data))},createMouseUpHandler:function($slider,handle,data){return function(e){if(handle.getAttribute('drag')==='true'){handle.setAttribute('drag','false');bt.slider.events.change($slider)}}},createMouseDownHandler:function(handle,data){return function(e){handle.setAttribute('drag','true')}},createMouseMoveHandler:function($slider,track,handle,progress,data){return function(e){var sliderPos,x,trackWidth,offset,stepSize,valuePos,newValue;if(handle.getAttribute('drag')==='true'){sliderPos=bt.core.position($slider[0],!0,!0);x=new bt.widget().mouseX(e)-sliderPos.left;trackWidth=bt.core.width(track);offset=bt.core.width(handle)/2;stepSize=trackWidth/(data.max-data.min);valuePos=(data.value-data.min)*stepSize;if(x>=offset&&x<=(trackWidth+offset)){if(x>valuePos+(stepSize/2)||x
+
+
+ BooTree - Plugin to Show Check-Box in Treeview with Bootstrap
+
+
+
+
+
+
+
+ Show Checked IDs
+
+
+
+
+
+
+