diff --git a/dist/tinper-neoui-grid.css b/dist/tinper-neoui-grid.css deleted file mode 100644 index 4416e49..0000000 --- a/dist/tinper-neoui-grid.css +++ /dev/null @@ -1,888 +0,0 @@ -.u-grid { - display: block; - position: relative; - color: #333; - background-color: #F9F9F9; - zoom: 1; - font-family: 'Helvetica Neue', Helvetica, 'Hiragino Sans GB', 'Segoe UI', 'Microsoft Yahei', Tahoma, Arial, STHeiti, sans-serif; - font-weight: normal; - font-size: 16px; - text-align: left; - border-width: 1px; - border-bottom-width: 0px; - border-style: solid; - border-color: #cecece; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-shadow: none; - -webkit-box-shadow: none; - overflow:hidden; -} -.u-grid li { - font-size: 16px; -} -.u-grid-top { - display: none; - position: fixed; - width: 100%; - height: 100%; - left: 0px; - top: 0px; - z-index: 99999; - background-color: #fff ; - filter: alpha(opacity=10); - -moz-opacity: 0.1; - -khtml-opacity: 0.1; - opacity: .1; - user-select: none; - -o-user-select: none; - -ms-user-select: none; - -moz-user-select: -moz-none; - -webkit-user-select: none; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); - -webkit-user-drag: none; - cursor: default; -} -.u-grid table { - width: 100%; - margin: 0; - max-width: none; - border-collapse: separate; - border-spacing: 0; - empty-cells: show; - border-width: 0; - outline: 0; - table-layout: fixed; - background: #fff; - margin: 0px !important; -} -/* -header区域css begin -*/ -.u-grid-header { - border-style: solid; - border-width: 0 0 1px 0; - border-color: #cecece; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - background-image: none; - background-position: 50% 50%; - background-repeat: repeat; - position: relative; -} -.u-grid-header-wrap { - position: relative; - width: 100%; - overflow: hidden; - zoom: 1; -} -.u-grid-header-left { - position: absolute; - z-index: 11; - background-color: #eeeff1; - height: 100%; -} -.u-grid-header-multi-select { - padding: 0 0 0 1.25em; - margin: 0px; - position: relative; - float: left; - border-style: solid; - border-color: #cecece; - border-width: 0px; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - height: 2.75em; - line-height: 2.75em; -} -.u-grid-header-num { - position: relative; - float: left; - height: 2.125em; - border-style: solid; - border-color: #cecece; - border-width: 0px; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - height: 100%; -} -.u-grid-header-th { - vertical-align: bottom; - height: 2.75em; - font-weight: normal; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - text-align: left; - border-style: solid; - border-color: #cecece; - border-width: 0px; - padding:0px !important; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - //background-image: none; - background-position: 50% 50%; - user-select: none; - -o-user-select: none; - -ms-user-select: none; - -moz-user-select: -moz-none; - -webkit-user-select: none; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); - -webkit-user-drag: none; - cursor: default; - background: #eeeff1; -} - -.u-grid-header-th>div:hover{ - background:#d7d7d7; -} - -.u-grid-header-level-div{ - z-index: 1; - border-style: solid; - border-color: #cecece; - border-width: 0px 1px 0px 0px; -} - -.u-grid-header-th-first { - border-left-width: 0; -} -.u-grid-header-link { - display: block; - padding-left: 0.714285714285em; - padding-right: 0.714285714285em; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - color: #333; - font-size: 0.875em; - height: 3.14285714em; - line-height: 3.14285714em; -} - -.u-grid-hide-title-icon .uf-fontselectioneditor { - display: none -} -.u-gird-parent { - position: absolute; - top: 0px; - text-align: center; - /*background-color: #F9F9F9;*/ - background-color: #eeeff1; - z-index: 1; - border-style: solid; - border-color: #cecece; - border-width: 1px; - margin-left: -1px; - box-sizing: content-box; - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; -} - -.grid-no-left-border{ - border-left-width: 0px; - margin: 0px; -} - -.grid-max-level-div{ - border-top: 0px; -} -.u-grid-header-link:hover { - //color: #a8a8a8; -} -.u-grid-header-link:visited { - //color: #a8a8a8; -} - - -.u-grid-header-columnmenu { - position: absolute; - padding: 0 .4em 0 .6em; - font-size: 0.75em !important; - top: 0px; - right: 0px; - color: #a8a8a8; - height: 3.6666667em; - line-height: 3.6666667em; - z-index: 999; -} -/*拖动*/ -.u-grid-header-resize-handle { - position: absolute; - cursor: col-resize; - z-index: 12; - width: .6em; - height: 2.125em; - display: block; - bottom: 0px; -} -/*交换*/ -.u-grid-header-drag-clue { - overflow: hidden; - border-radius: 2px; - background-color: #3f51b5; - position: absolute; - z-index: 13; - border-style: solid; - border-width: 1px; - font-size: 0.75em; - white-space: nowrap; - cursor: default; - color: #fff; -} -.u-grid-header-drag-status { - width: 1em; - height: 1em; -} -.u-grid-header-swap-tip-span { - height: 5px; - position: absolute; - z-index: 13; - cursor: default; - display: none; - line-height: 0px !important; -} -/*排序*/ -/*.u-grid-header-sort-span { - width: 1em; - text-align: center; - line-height: 2.125em !important; - position: absolute; - top: 0px; - right: 2.9em; -}*/ -.u-grid-header-sort-span { - width: 1.3em; - text-align: center; - font-size: 12px; - position: absolute; - height: inherit; - line-height: inherit; - color: #666; -} -/*排序优先级*/ -.u-grid-header-sort-priority { - display: inline-block; - position: absolute; - top: 1em; - right: -0.5em; - line-height: 2.125em; - font-size: 0.5em; -} -/* -header区域css end -*/ -/* -content区域css begin -*/ -.u-grid td { - border-style: solid ; - border-color: #cecece ; - border-width: 0 0 1px 0 ; - box-sizing: border-box; - padding:0px !important; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - vertical-align: middle; - white-space: nowrap; - text-overflow: ellipsis; - /*height: 2.6875em; - line-height: 2.6875em;*/ - height: 43px; - line-height: 43px; - /*height: 2.68em \9; - line-height: 2.68em \9;*/ - font-size: 16px !important; - overflow: hidden; -} - -.u-grid .grid_edit_form_td{ - overflow: visible; -} - -.u-grid tbody tr:last-child td{ - border-bottom-width: 0px; -} - -.u-grid-content-left>div:last-child{ - border-bottom-width: 0px; -} - -.u-grid-content-left.u-grid-content-left-sum>div:last-child{ - border-bottom-width: 1px; -} - -.u-grid-content tr{ - border-top:0px !important; -} -.u-grid-content-td-div { - height: inherit; - margin: 0 2em 0 0.833333333em; - font-size: 0.75em !important; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - position: relative; - line-height: inherit; -} -.u-grid-edit-div .u-grid-content-td-div { - margin: 0 1em 0 1em; - line-height: 3.5em; - font-size: 12px; - overflow: visible; - white-space: nowrap; - text-overflow: ellipsis; - height: 100%; -} -.u-grid-content-td-div-over::after{ - content:"..."; - font-weight:bold; - position:absolute; - bottom:15px; - right: -5px; -} - - -.u-grid-content-td-div > input{ - height:100%; -} -.u-grid-content-td-div > .right-span{ - position: absolute; - right: 0px; - line-height: 3.5em; - width: 2rem; - text-align: center; -} - -/*checkbox样式*/ - -.u-grid-content-td-div .u-checkbox-outline,.u-grid-content-td-div .u-checkbox-focus-helper { - top: -10px; -} - -.u-grid-content { - border-style: solid; - border-color: #cecece; - border-width: 0px; - border-bottom-width: 1px; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - position: relative; - zoom: 1; - background-color: #fff ; - overflow: hidden; -} -.u-grid-content-div { - position: relative; - overflow-x: auto; - overflow-y: auto; -} -.u-grid-content-left { - position: absolute; -} -.u-grid-content-left-sum-bottom { - position: absolute; - bottom: 16px; - left: 0px; - height: 2.125em; - z-index: 11; - background-color: #FFF; -} -.u-grid-content-left-bottom { - position: absolute; - bottom: 0px; - left: 0px; - height: 16px; - z-index: 11; - background-color: #FFF; -} -.u-grid-content-left-row { - position: relative; - height: 2.125em; -} -.u-grid-content-multiSelect { - padding: 0 0 0 1.25em; - position: relative; - float: left; - height: 2.75em; - line-height: 2.75em; - border-style: solid; - border-color: #cecece; - border-width: 0px; - border-bottom-width: 1px; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - margin: 0px !important; - font-size: 16px !important; -} -.u-grid-multi-input { - margin: 0px !important; - height: 100%; -} -.u-grid-content-num { - border-style: solid; - border-color: #cecece; - border-width: 0px; - border-bottom-width: 1px; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - height: 2.75em; - line-height: 2.75em; - position: relative; - float: left; - text-align: center; - padding: 0px; -} -.u-gird-centent-sum-div { - float: left; - font-size: 0.75em; - font-size: inherit \9; - height: inherit; - line-height: inherit; - margin-left: 0.666667em; - margin-left: 0px \9; -} -.u-grid-content-sel-row { - background-color: #e9f7fc !important; - //color: #FFF !important; -} - -.u-grid-content-sel-row a{ - //color: #0377c1 !important; -} - -.u-grid-content-focus-row { - background-color: #e9f7fc !important; - //color: #FFF !important; -} -.u-grid-content-tree-span { - width: 1.25em; - height: 1.25em; - color: #007ae3; - font-size: 14px !important; -} - - -/*行拖拽*/ -td.u-grid-drag-icon:before { - content: "\e6d1"; - font-family: "uf" !important; - font-size: 12px; - position: absolute; - z-index: 100; -} -/* -content区域css end -*/ -/* -content edit menu区域css begin -*/ -.u-grid-content-edit-menu { - display: none; - overflow: hidden; - position: absolute; - z-index: 13; - background: #fff; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; - width: 100%; - height: 28px; -} -/*.u-grid-content-edit-menu-button{ - height: 2em; - margin:.2em .2em; -} tiaoxq修改 .u-grid-content-edit-menu-button-ok .u-grid-content-edit-menu-button-cancel*/ -.u-grid-content-edit-menu-button { - position: absolute; - right: 50px; - display: inline-block; - margin-bottom: 0; - font-weight: 400; - text-align: center; - vertical-align: middle; - touch-action: manipulation; - cursor: pointer; - background-image: none; - border: 1px solid transparent; - white-space: nowrap; - font-size: 13px; - line-height: 1.5; - border-radius: 3px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - -o-user-select: none; - user-select: none; - height: 28px; - width: 80px; - background-color: white; - border-color: #bfbfbf; - outline: none; -} -.u-grid-content-edit-menu-button-ok { - color: #01a3f6; - margin-left: 10px; -} -.u-grid-content-edit-menu-button-cancel { - color: #e50011; - right: 150px; -} -.u-grid-edit-form { - position: relative; - z-index: 12; - font-size: 12px; - float: left; -} -.u-grid-edit-whole-div { - position: relative; - width: 350px; - float: left; - height: 30px; - margin-bottom: 10px; -} -.u-grid-edit-label { - width: 84px; - float: left; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - text-align: right; - line-height: 28px; -} -.u-grid-edit-div { - width: 175px; - margin-left: 10px; - float: left; -} -.u-grid-edit-div input[type=text] { - width: 100%; - line-height: 28px; - height: 28px; - border: 1px solid #c9c9c9; - border-radius: 3px; - -webkit-box-shadow: none; - box-shadow: none; - -webkit-transition: none; - transition: none; - outline: none; - box-sizing:border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - -} -.u-grid-edit-div input[type=checkbox] { - height: 13px; - width: 13px; -} -.u-grid-edit-div input[type=radio] { - height: 13px; - width: 13px; -} -.u-grid-edit-div .input-group input { - border-right: none; - padding-right: 0px; -} -/* -content edit menu区域css end -*/ -/* -content no row区域css begin -*/ -.u-grid-noRowsDiv { - position: relative; - top: 0px; - left: 0px; - width: 100%; - font-size: 0.75em; - height: 2.125em; - line-height: 2.125em; - color: #a8a8a8; - text-align: center; - display: none; -} -.u-grid-noRowsShowDiv { - position: absolute; - top: 0px; - left: 0px; - width: 100%; - font-size: 0.75em; - height: 2.125em; - line-height: 2.125em; - color: #a8a8a8; - text-align: center; - display: none; -} -/* -content no row区域css end -*/ -/* -columnMenu区域css begin -*/ -.u-grid-column-menu { - width: 160px; - display: none; - overflow: hidden; - position: fixed; - z-index: 13; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} -.u-grid-column-menu-ul { - background-color: #fff; - font-weight: 500; - background-image: none; - padding: 0px; - margin: 0px; - background-position: 50% 50%; - border-width: 0px 0px 1px 0px; - border-style: solid; - border-color: #cecece; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; -} -.u-grid-column-menu-li { - display: block; - height: 2.125em; - border-width: 1px 1px 0px 1px; - border-style: solid; - border-color: #cecece; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - cursor: pointer; -} -.u-grid-column-menu-div1 { - display: block; - padding: 0 .8em 0 .8em; - line-height: 2.83em; - font-size: 0.75em; - position: relative; - height: 100%; -} -.u-grid-column-menu-span { - position: absolute; - width: 120px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -.u-grid-column-menu-div3 { - right: 2em; - position: absolute; - font-size: 0.75em !important; - filter: alpha(opacity=70); - -moz-opacity: 0.7; - -khtml-opacity: 0.7; - opacity: .7; - line-height: 2.83em !important; -} -/* -columnMenu区域css end -*/ -/* -columnMenu columns区域css begin -*/ -.u-grid-column-menu-columns { - width: 160px; - display: block; - overflow-y: auto; - overflow-x: hidden; - position: relative; - z-index: 13; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} -.u-grid-column-menu-columns-ul { - border-width: 1px 0px 0px 0px; - border-style: solid; - border-color: #cecece; - background-color: #fff; - font-weight: 500; - background-image: none; - padding: 0px; - background-position: 50% 50%; - margin: 0px; -} -.u-grid-column-menu-columns-li { - display: block; - height: 2.125em; - border-width: 0px 1px 0px 1px; - border-style: solid; - border-color: #cecece; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - cursor: pointer; -} -.u-grid-column-menu-columns-div1 { - display: block; - padding: 0 .8em 0 .8em; - line-height: 2.83em; - font-size: 0.75em; - position: relative; - height: 100%; -} -.u-grid-column-menu-columns-div2 { - position: absolute; - filter: alpha(opacity=70); - -moz-opacity: 0.7; - -khtml-opacity: 0.7; - opacity: .7; -} -.u-grid-column-menu-columns-span { - position: absolute; - width: 120px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - left: 35px; -} -/* -columnMenu columns区域css end -*/ -/* -form展示区域css begin -*/ -.u-grid-form { - width: 100%; - height: 100%; - overflow-x: hidden; - overflow-y: scroll; -} -.u-grid-content-td-div .input-group-addon { - padding: 3px 12px; -} -.u-grid-content-td-div .grid-combox { - height: 28px; -} -.u-grid-content-td-div .eType-input { - position: relative; - width: 90%; - height: 90%; - margin: 0px; - // margin-left: 5%; - min-height: 20px; - font-size: 12px; - color: #333; -} -.u-grid-content-td-div .eType-input > input { - width: 100%; - height: 100%; - line-height: normal; -} -.u-grid-content-td-div .eType-input > .right-span{ - position: absolute; - line-height: 3.5em; - cursor: pointer; - right: 0px; - width: 2rem; - text-align: center; -} - -.u-grid-content-td-div .checkbox label { - top: -2px; -} -.u-grid-content-td-div input[type=checkbox] { - position: relative; - top: 0px; - cursor: pointer; -} -/* -form展示区域css end -*/ - - -/* -特殊css处理 begin -*/ -.u-grid .u-text{ - padding:0px; -} - -.u-grid-err-td{ - background-color: #1baede; -} - -.u-grid-err-td *{ - background-color: #1baede; -} - -/*鼠标滑过begin*/ - -.u-grid-move-bg{ - background: #f4f8fb !important;; - color:#333; -} -.u-grid .u-grid-move-bg a{ - color: #0377c1; -} -.u-grid-move-bg a:hover{ - text-decoration: underline; - cursor: pointer; -} -.u-grid a{ - color:#333; - text-decoration: none; -} -/*鼠标滑过end*/ - -/*复选框begin*/ -.u-grid-checkbox-outline{ - position: absolute; - box-sizing: border-box; - width: 14px; - height: 14px; - margin: 0; - cursor: pointer; - overflow: hidden; - border: 1px solid rgb(191,191,191); - border-radius: 2px; - display: none; - top: 15px; -} - -.u-grid-checkbox-tick-outline{ - position: absolute; - top: 0; - left: 0; - height: 100%; - width: 100%; - -webkit-mask: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmVyc2lvbj0iMS4xIgogICB2aWV3Qm94PSIwIDAgMSAxIgogICBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij4KICA8cGF0aAogICAgIGQ9Ik0gMC4wNDAzODA1OSwwLjYyNjc3NjcgMC4xNDY0NDY2MSwwLjUyMDcxMDY4IDAuNDI5Mjg5MzIsMC44MDM1NTMzOSAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IE0gMC4yMTcxNTcyOSwwLjgwMzU1MzM5IDAuODUzNTUzMzksMC4xNjcxNTcyOSAwLjk1OTYxOTQxLDAuMjczMjIzMyAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IgogICAgIGlkPSJyZWN0Mzc4MCIKICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lIiAvPgo8L3N2Zz4K); - mask: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmVyc2lvbj0iMS4xIgogICB2aWV3Qm94PSIwIDAgMSAxIgogICBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij4KICA8cGF0aAogICAgIGQ9Ik0gMC4wNDAzODA1OSwwLjYyNjc3NjcgMC4xNDY0NDY2MSwwLjUyMDcxMDY4IDAuNDI5Mjg5MzIsMC44MDM1NTMzOSAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IE0gMC4yMTcxNTcyOSwwLjgwMzU1MzM5IDAuODUzNTUzMzksMC4xNjcxNTcyOSAwLjk1OTYxOTQxLDAuMjczMjIzMyAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IgogICAgIGlkPSJyZWN0Mzc4MCIKICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lIiAvPgo8L3N2Zz4K); - background: transparent; - transition-duration: 0.28s; - transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - transition-property: background; -} - -.u-grid-checkbox-outline.is-checked{ - border: 1px solid #1baede; - display: inline-block; -} - -.u-grid-move-bg .u-grid-checkbox-outline{ - display: inline-block; -} - -.u-grid-header-multi-select .u-grid-checkbox-outline{ - display: inline-block; -} - -.u-grid-checkbox-outline.is-checked .u-grid-checkbox-tick-outline{ - -webkit-mask: none; - mask: none; - background: #1baede url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmVyc2lvbj0iMS4xIgogICB2aWV3Qm94PSIwIDAgMSAxIgogICBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij4KICA8cGF0aAogICAgIGQ9Ik0gMC4wNDAzODA1OSwwLjYyNjc3NjcgMC4xNDY0NDY2MSwwLjUyMDcxMDY4IDAuNDI5Mjg5MzIsMC44MDM1NTMzOSAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IE0gMC4yMTcxNTcyOSwwLjgwMzU1MzM5IDAuODUzNTUzMzksMC4xNjcxNTcyOSAwLjk1OTYxOTQxLDAuMjczMjIzMyAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IgogICAgIGlkPSJyZWN0Mzc4MCIKICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lIiAvPgo8L3N2Zz4K); -} -/*复选框end*/ diff --git a/dist/tinper-neoui-grid.js b/dist/tinper-neoui-grid.js deleted file mode 100644 index 45c02de..0000000 --- a/dist/tinper-neoui-grid.js +++ /dev/null @@ -1,6921 +0,0 @@ -/** - * tinper-neoui-grid v3.1.28 - * grid - * author : yonyou FED - * homepage : https://github.com/iuap-design/tinper-neoui-grid#readme - * bugs : https://github.com/iuap-design/tinper-neoui-grid/issues - **/ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _dataSource = __webpack_require__(1); - - var _column = __webpack_require__(7); - - var _gridComp = __webpack_require__(9); - - var old = $.fn.grid; - // 方法扩展 - /* - * 对象所支持的属性及默认值 - */ - - $.fn.grid = function (options) { - var grid = $(this).data('gridComp'); - if (!grid) $(this).data('gridComp', grid = new _gridComp.gridComp(this, options)); - return grid; - }; - $.fn.grid.gridComp = _gridComp.gridComp; - $.fn.grid.gridCompColumn = _column.column; - $.fn.grid.dataSource = _dataSource.dataSource; - - $.fn.grid.noConflict = function () { - $.fn.grid = old; - return this; - }; - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.dataSource = undefined; - - var _dataSourceInit = __webpack_require__(2); - - var _re_gridCompSort = __webpack_require__(3); - - var _re_gridCompTree = __webpack_require__(6); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var dataSource = function dataSource(options, gridComp) { - _classCallCheck(this, dataSource); - - this.init(options, gridComp); - this.sortRows(); - }; - - ; - - var dataSourceProto = dataSource.prototype; - Object.assign(dataSourceProto, _dataSourceInit.initFunObj); - - dataSourceProto.basicSortRows = _re_gridCompSort.sortFunObj.re_basicSortRows; - - /* - * tree - */ - - - dataSourceProto.treeSortRows = _re_gridCompTree.treeFunObj.re_treeSortRows; - dataSourceProto.pushChildRows = _re_gridCompTree.treeFunObj.pushChildRows; - - exports.dataSource = dataSource; - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /* - * 处理参数 - */ - var init = function init(options, gridComp) { - this.defaults = {}; - this.gridComp = gridComp; - this.options = $.extend({}, this.defaults, options); - this.rows = new Array(); // 存储数据行 - this.hasParentRows = new Array(); // 存在父项 - this.nothasParentRows = new Array(); // 不存在父项 - }; - /* - * 将values转化为rows并进行排序 - */ - var sortRows = function sortRows(field, sortType) { - if (this.gridComp.options.showTree) { - this.treeSortRows(field, sortType); - } else { - this.basicSortRows(field, sortType); - } - this.gridComp.eidtRowIndex = -1; - }; - /* - * 将values转化为rows并进行排序(标准) - */ - var basicSortRows = function basicSortRows(field, sortType) { - var oThis = this, - dataType = ""; - if (field) { - dataType = this.gridComp.getColumnByField(field).options.dataType; - } - this.rows = new Array(); - if (this.options.values) { - $.each(this.options.values, function (i) { - var rowObj = {}; - rowObj.value = this; - rowObj.valueIndex = i; - oThis.rows.push(rowObj); - }); - } - }; - var treeSortRows = function treeSortRows(field, sortType) { - this.basicSortRows(field, sortType); - }; - /* - * 获取合计值 - */ - var getSumValue = function getSumValue(field, gridCompColumn, gridComp) { - var sumValue = null; - if (gridCompColumn.options.sumCol) { - $.each(this.rows, function (i) { - var v = $(this.value).attr(field); - if (gridCompColumn.options.dataType == 'Int') { - v = gridComp.getInt(v, 0); - sumValue += parseInt(v); - } else { - v = gridComp.getFloat(v, 0); - sumValue = gridComp.accAdd(sumValue, parseFloat(v)); - } - }); - } - // 处理精度 - if (gridCompColumn.options.dataType == 'Float' && gridCompColumn.options.precision) { - var o = {}; - o.value = sumValue; - o.precision = gridCompColumn.options.precision; - sumValue = gridComp.DicimalFormater(o); - } - if (sumValue != null && sumValue != undefined && sumValue != 'null' && sumValue != 'undefined') { - return sumValue + ''; - } else { - return ''; - } - }; - var initFunObj = exports.initFunObj = { - init: init, - sortRows: sortRows, - basicSortRows: basicSortRows, - treeSortRows: treeSortRows, - getSumValue: getSumValue - }; - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.sortFunObj = undefined; - - var _gridCompEvent = __webpack_require__(4); - - var sort_initEventFun = function sort_initEventFun() { - // 扩展方法 - var oThis = this; - $('#' + this.options.id).on('mouseup', function (e) { - if ($(e.target).closest('#' + oThis.options.id + '_header').length > 0) { - // 点击的是header区域 - oThis.mouseUpX = e.clientX; - oThis.mouseUpY = e.clientY; - //点击过程中鼠标没有移动 - if (oThis.mouseDownX == oThis.mouseUpX && oThis.mouseDownY == oThis.mouseUpY) { - //或者移动距离小于5px(由于移动之后会显示屏幕div,暂时不做处理) - oThis.columnClickX = e.clientX; - oThis.columnClickY = e.clientY; - var eleTh = $(e.target).closest('th')[0]; - if ($(e.target).hasClass('u-grid-header-columnmenu')) {} else { - // 执行click操作,进行排序 - oThis.canSortable(e, eleTh); - } - } - } else if ($(e.target).closest('#' + oThis.options.id + '_content').length > 0) { - // 点击的是数据区域 - - } - }); - }; - var sort_initGridEventFun = function sort_initGridEventFun() { - // 扩展方法 - var oThis = this; - }; - /* - * 处理排序 - */ - var canSortable = function canSortable(e, ele) { - var oThis = this, - $ele = $(ele), - field = $ele.attr('field'), - sortable = this.getColumnAttr('sortable', field); - if (sortable) { - if (e.ctrlKey) { - // 构建排序信息的数据结构 - var prioArray = []; - $('.u-grid-header-sort-priority').each(function (index, domEle) { - var $el = $(domEle); - var p = parseInt($el.text()); - var f = $el.closest('th').attr('field'); - var st; - if ($el.parent().hasClass("uf-arrow-up")) { - st = 'asc'; - } else if ($el.parent().hasClass("uf-arrow-down")) { - st = 'desc'; - } - prioArray[p - 1] = { - field: f, - sortType: st - }; - }); - // 页面调整 - /*修改ue将caret调整为caret*/ - var $caret; - if (($caret = $ele.find('.uf-arrow-up')).length > 0) { - var p = parseInt($caret.find('.u-grid-header-sort-priority').text()); - prioArray[p - 1].sortType = 'desc'; - $caret.removeClass('uf-arrow-up').addClass('uf-arrow-down'); - } else if (($caret = $ele.find('.uf-arrow-down')).length > 0) { - var p = parseInt($caret.find('.u-grid-header-sort-priority').text()); - for (var i = p; i < prioArray.length; i++) { - var $flag = $('[field=' + prioArray[i].field + ']').find('.u-grid-header-sort-priority'); - $flag.text(parseInt($flag.text()) - 1); - } - prioArray.splice(p - 1, 1); - $caret.remove(); - } else { - prioArray.push({ - field: field, - sortType: 'asc' - }); - // $ele.first().append(''+prioArray.length+'') - $ele.first().first().append(''); - } - // 执行排序逻辑 - this.dataSourceObj.sortRowsByPrio(prioArray); - } else { - if ($(".uf-arrow-up").parent().parent().parent()[0] == ele) { - //原来为升序,本次为降序 - $(".uf-arrow-up").remove(); - //$(ele.firstChild)[0].insertAdjacentHTML('beforeEnd','1'); - $(ele.firstChild.firstChild)[0].insertAdjacentHTML('beforeEnd', ''); - if (typeof this.options.onSortFun == 'function') { - this.options.onSortFun(field, 'asc'); - } else { - this.dataSourceObj.sortRows(field, "asc"); - } - } else if ($(".uf-arrow-down").parent().parent().parent()[0] == ele) { - //原来为降序,本次为不排序 - $(".uf-arrow-down").remove(); - if (typeof this.options.onSortFun == 'function') { - this.options.onSortFun(); - } else { - this.dataSourceObj.sortRows(); - } - } else { - //本次为升序 - $(".uf-arrow-up").remove(); - $(".uf-arrow-down").remove(); - // $(ele.firstChild)[0].insertAdjacentHTML('beforeEnd','1'); - $(ele.firstChild.firstChild)[0].insertAdjacentHTML('beforeEnd', ''); - if (typeof this.options.onSortFun == 'function') { - this.options.onSortFun(field, "desc"); - } else { - this.dataSourceObj.sortRows(field, "desc"); - } - } - } - - oThis.repairContent(); - oThis.afterGridDivsCreate(); - } - }; - var re_deleteOneRowTree = function re_deleteOneRowTree() { - if (this.options.showTree) { - this.dataSourceObj.sortRows(); - } - }; - /* - * 根据排序的优先级的排序 - * prioArray = [{field:'f2', sortType:'asc'}, {field:'f3', sortType:'desc'}, {field:'f1', sortType:'asc'}] - */ - var sortRowsByPrio = function sortRowsByPrio(prioArray, cancelSort) { - var oThis = this; - if (cancelSort) { - this.rows = new Array(); - if (this.options.values) { - $.each(this.options.values, function (i) { - var rowObj = {}; - rowObj.value = this; - rowObj.valueIndex = i; - oThis.rows.push(rowObj); - }); - } - } - - var evalStr = function evalStr(i) { - if (i == prioArray.length - 1) { - return 'by(prioArray[' + i + '].field, prioArray[' + i + '].sortType)'; - } else { - return 'by(prioArray[' + i + '].field, prioArray[' + i + '].sortType,' + evalStr(i + 1) + ')'; - } - }; - - var by = function by(field, sortType, eqCall) { - var callee = arguments.callee; - return function (a, b) { - var v1 = $(a.value).attr(field); - var v2 = $(b.value).attr(field); - var dataType = oThis.gridComp.getColumnByField(field).options.dataType; - if (dataType == 'Float') { - v1 = parseFloat(v1); - v2 = parseFloat(v2); - if (isNaN(v1)) { - return 1; - } - if (isNaN(v2)) { - return -1; - } - if (v1 == v2 && eqCall) { - return eqCall(); - } - return sortType == 'asc' ? v1 - v2 : v2 - v1; - } else if (dataType == 'Int') { - v1 = parseInt(v1); - v2 = parseInt(v2); - if (isNaN(v1)) { - return 1; - } - if (isNaN(v2)) { - return -1; - } - if (v1 == v2 && eqCall) { - return eqCall(); - } - return sortType == 'asc' ? v1 - v2 : v2 - v1; - } else { - v1 = oThis.gridComp.getString(v1, ''); - v2 = oThis.gridComp.getString(v2, ''); - try { - var rsl = v1.localeCompare(v2); - if (rsl === 0 && eqCall) { - return eqCall(); - } - if (rsl === 0) { - return 0; - } - return sortType == 'asc' ? rsl : -rsl; - } catch (e) { - return 0; - } - } - }; - }; - - this.rows.sort(eval(evalStr(0))); - }; - /* - * 将values转化为rows并进行排序(标准) - */ - var re_basicSortRows = function re_basicSortRows(field, sortType) { - var oThis = this; - var dataType = ""; - if (field) { - dataType = this.gridComp.getColumnByField(field).options.dataType; - } - if (sortType == "asc") { - this.rows.sort(function (a, b) { - var v1 = $(b.value).attr(field); - var v2 = $(a.value).attr(field); - if (dataType == 'Float') { - v1 = parseFloat(v1); - v2 = parseFloat(v2); - if (isNaN(v1)) { - return 1; - } - if (isNaN(v2)) { - return -1; - } - return v1 - v2; - } else if (dataType == 'Int') { - v1 = parseInt(v1); - v2 = parseInt(v2); - if (isNaN(v1)) { - return 1; - } - if (isNaN(v2)) { - return -1; - } - return v1 - v2; - } else { - v1 = oThis.gridComp.getString(v1, ''); - v2 = oThis.gridComp.getString(v2, ''); - try { - return v1.localeCompare(v2); - } catch (e) { - return 0; - } - } - }); - } else if (sortType == "desc") { - this.rows.sort(function (a, b) { - var v1 = $(a.value).attr(field); - var v2 = $(b.value).attr(field); - if (dataType == 'Float') { - v1 = parseFloat(v1); - v2 = parseFloat(v2); - if (isNaN(v1)) { - return 1; - } - if (isNaN(v2)) { - return -1; - } - return v1 - v2; - } else if (dataType == 'Int') { - v1 = parseInt(v1); - v2 = parseInt(v2); - if (isNaN(v1)) { - return 1; - } - if (isNaN(v2)) { - return -1; - } - return v1 - v2; - } else { - v1 = oThis.gridComp.getString(v1, ''); - v2 = oThis.gridComp.getString(v2, ''); - try { - return v1.localeCompare(v2); - } catch (e) { - return 0; - } - } - }); - } else { - this.rows = new Array(); - if (this.options.values) { - $.each(this.options.values, function (i) { - var rowObj = {}; - rowObj.value = this; - rowObj.valueIndex = i; - oThis.rows.push(rowObj); - }); - } - } - }; - var sortFunObj = exports.sortFunObj = { - sort_initEventFun: sort_initEventFun, - sort_initGridEventFun: sort_initGridEventFun, - re_basicSortRows: re_basicSortRows, - canSortable: canSortable, - deleteOneRowTree: re_deleteOneRowTree, - sortRowsByPrio: sortRowsByPrio - }; - -/***/ }, -/* 4 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.eventFunObj = undefined; - - var _gridBrowser = __webpack_require__(5); - - /* - * 创建完成之后顶层div添加监听 - */ - var initEventFun = function initEventFun() { - var oThis = this; - $('#' + this.options.id).on('mousedown', function (e) { - if ($(e.target).closest('#' + oThis.options.id + '_header').length > 0) { - // 点击的是header区域 - oThis.mouseDownX = e.clientX; - oThis.mouseDownY = e.clientY; - } else if ($(e.target).closest('#' + oThis.options.id + '_content').length > 0) { - // 点击的是数据区域 - } - }); - }; - /* - * 创建完成之后grid层 div添加监听 - */ - var initGridEventFun = function initGridEventFun() { - var oThis = this; - // 拖动 - this.initContentDivEventFun(); - // 全选 - $('#' + this.options.id + '_header_multi_input').on('click', function (e) { - if (this.hasChecked) { - oThis.setAllRowUnSelect(); - this.hasChecked = false; - } else { - oThis.setAllRowSelect(); - this.hasChecked = true; - } - }); - }; - /* - * 内容区 div添加监听 - */ - var initContentDivEventFun = function initContentDivEventFun() { - var oThis = this; - // 通过复选框设置选中行 - $('#' + oThis.options.id + '_content .u-grid-content-left').on('click', function (e) { - var $input = $(e.target).closest('.u-grid-checkbox-outline'); - if ($input.length > 0) { - var $div = $($input.parent()); - var index = $('.u-grid-content-multiSelect', $div.parent()).index($div); - if ($input.hasClass('is-checked')) { - oThis.setRowUnselect(index); - } else { - oThis.setRowSelect(index); - } - } - }); - // 同步滚动条 - $('#' + this.options.id + '_content_div').on('scroll', function (e) { - oThis.scrollLeft = this.scrollLeft; - oThis.scrollTop = this.scrollTop; - if (oThis.options.fixedFloat == 'right') { - $('#' + oThis.options.id + '_header_table').css('left', oThis.leftW - oThis.scrollLeft + "px"); - } else { - $('#' + oThis.options.id + '_header_table').css('left', oThis.leftW - oThis.scrollLeft + oThis.fixedWidth + "px"); - } - $('#' + oThis.options.id + '_noRowsShow').css('left', oThis.scrollLeft + "px"); - $('#' + oThis.options.id + '_edit_form').css('left', oThis.scrollLeft + "px"); - $('#' + oThis.options.id + '_content_multiSelect').css('top', -oThis.scrollTop + "px"); - $('#' + oThis.options.id + '_content_numCol').css('top', -oThis.scrollTop + "px"); - $('#' + oThis.options.id + '_content_fixed_div').css('top', -oThis.scrollTop + "px"); - if (_gridBrowser.gridBrowser.isIE10 || _gridBrowser.gridBrowser.isIPAD) { - //ie10下示例系统中的档案节点新增数据之后前两次无法输入,因为此处会关闭输入控件 - } else { - oThis.editClose(); - } - }); - // 数据行相关事件 - $('#' + this.options.id + '_content_tbody').on('click', function (e) { - // 双击处理 - if (typeof oThis.options.onDblClickFun == 'function') { - oThis.isDblEvent('tbodyClick', oThis.dblClickFun, e, oThis.clickFun, e); - } else { - oThis.clickFun(e); - } - }); - $('#' + this.options.id + '_content_fixed_tbody').on('click', function (e) { - // 双击处理 - if (typeof oThis.options.onDblClickFun == 'function') { - oThis.isDblEvent('tbodyClick', oThis.dblClickFun, e, oThis.clickFun, e); - } else { - oThis.clickFun(e); - } - }); - $('#' + this.options.id + '_content').on('mousemove', function (e) { - var $tr = $(e.target).closest('tr'), - $div = $(e.target).closest('div'), - mousemoveIndex = -1; - // 首先清除所有的背景 - if ($tr.length > 0) { - mousemoveIndex = $('tr', $tr.parent()).index($tr); - } else if ($div.length > 0 && ($div.hasClass('u-grid-content-multiSelect') || $div.hasClass('u-grid-content-num'))) { - //左侧复选及数字列 - mousemoveIndex = $('div', $div.parent()).index($div); - } - - oThis.trHoverFun(mousemoveIndex); - }); - $('#' + this.options.id + '_content').on('mouseout', function (e) { - $('#' + oThis.options.id + '_content_tbody').find('tr').removeClass('u-grid-move-bg'); - $('#' + oThis.options.id + '_content_fixed_tbody').find('tr').removeClass('u-grid-move-bg'); - if (oThis.options.multiSelect) $('#' + oThis.options.id + '_content_multiSelect').find('div').removeClass('u-grid-move-bg'); - if (oThis.options.showNumCol) $('#' + oThis.options.id + '_content_numCol').find('div').removeClass('u-grid-move-bg'); - if (typeof oThis.options.onContentOut == 'function') { - var obj = {}; - obj.gridObj = oThis; - var $tr = $(e.target).closest('tr'); - if ($tr.length > 0 && !$tr.is('.u-grid-content-sum-row')) { - var mouseoutIndex = $('tr[role="row"]', $tr.parent()).index($tr); - obj.rowObj = oThis.dataSourceObj.rows[mouseoutIndex]; - obj.rowIndex = mouseoutIndex; - } - oThis.options.onContentOut(obj); - } - }); - }; - - var eventFunObj = exports.eventFunObj = { - initEventFun: initEventFun, - initGridEventFun: initGridEventFun, - initContentDivEventFun: initContentDivEventFun - }; - -/***/ }, -/* 5 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var gridBrowser = {}, - userAgent = navigator.userAgent, - ua = userAgent.toLowerCase(), - s; - if (s = ua.match(/msie ([\d.]+)/)) { - gridBrowser.isIE = true; - } - if (gridBrowser.isIE) { - var mode = document.documentMode; - if (mode == null) {} else { - if (mode == 8) { - gridBrowser.isIE8 = true; - } else if (mode == 9) { - gridBrowser.isIE9 = true; - } else if (mode == 10) { - gridBrowser.isIE10 = true; - } - } - } - - if (ua.indexOf('Android') > -1 || ua.indexOf('android') > -1 || ua.indexOf('Adr') > -1 || ua.indexOf('adr') > -1) { - gridBrowser.isAndroid = true; - } - - if (gridBrowser.isAndroid) { - if (window.screen.width >= 768 && window.screen.width < 1024) { - gridBrowser.isAndroidPAD = true; - } - if (window.screen.width <= 768) { - gridBrowser.isAndroidPhone = true; - } - } - - if (ua.match(/iphone/i)) { - gridBrowser.isIOS = true; - gridBrowser.isIphone = true; - } - - if (ua.match(/ipad/i)) { - gridBrowser.isIOS = true; - gridBrowser.isIPAD = true; - } - - if (gridBrowser.isIphone || gridBrowser.isAndroidPhone) { - gridBrowser.isMobile = true; - } - - exports.gridBrowser = gridBrowser; - -/***/ }, -/* 6 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var re_initTree = function re_initTree(options, gridOptions) { - if (gridOptions.showTree) { - options.sortable = false; - } - return options; - }; - var re_initOptionsTree = function re_initOptionsTree() { - if (this.options.showTree) { - this.options.showNumCol = false; - } - }; - var re_clickFunTree = function re_clickFunTree(e) { - var oThis = this, - $target = $(e.target), - $td = $target.closest('td'); - - if ($td.length > 0) { - var $tr = $td.parent(); - var index = this.getTrIndex($tr); - var row = oThis.dataSourceObj.rows[index]; - if (row) { - var rowChildIndex = oThis.getChildRowIndex(row); - if ($target.hasClass('uf-reduce-s-o') || $target.hasClass('uf-add-s-o')) { - var minus = $td.find('.uf-reduce-s-o'); - var plus = $td.find('.uf-add-s-o'); - if (minus.length > 0) { - // 合上 需要将所有的都合上 - minus.removeClass('uf-reduce-s-o').addClass('uf-add-s-o'); - if (rowChildIndex.length > 0) { - var allChildRowIndex = oThis.getAllChildRowIndex(row); - $.each(allChildRowIndex, function () { - var $tr1 = $('tr[role="row"]:eq(' + parseInt(this) + ')', $tr.parent()); - $tr1.css('display', 'none'); - // 左侧复选区隐藏 - $('#' + oThis.options.id + '_content_multiSelect >div:nth-child(' + (parseInt(this) + 1) + ')').css('display', 'none'); - $('.uf-reduce-s-o', $tr1).removeClass('uf-reduce-s-o').addClass('uf-add-s-o'); - }); - } - if (this.options.editType == 'form') { - $('#' + this.options.id + '_multiSelect_edit').remove(null, true); - $('#' + this.options.id + '_numCol_edit').remove(null, true); - $('#' + this.options.id + '_edit_tr').remove(null, true); - $('#' + this.options.id + '_edit_tr1').remove(null, true); - } - } else if (plus.length > 0) { - // 展开 - plus.removeClass('uf-add-s-o').addClass('uf-reduce-s-o'); - if (rowChildIndex.length > 0) { - $.each(rowChildIndex, function () { - var $tr1 = $('tr[role="row"]:eq(' + parseInt(this) + ')', $tr.parent()); - $tr1.css('display', ''); - var ss = $('#' + oThis.options.id + '_content_multiSelect >div:nth-child(' + (parseInt(this) + 1) + ')')[0]; - $('#' + oThis.options.id + '_content_multiSelect >div:nth-child(' + (parseInt(this) + 1) + ')').css('display', ''); - }); - } - } - this.resetLeftHeight(); - } - } - } - }; - var re_addOneRowTree = function re_addOneRowTree(row, index, rowObj) { - var oThis = this, - l = this.dataSourceObj.rows.length, - displayFlag; - // 存在树结构 - if (this.options.showTree) { - this.hasParent = false; - this.hasChildF = false; - var keyField = this.options.keyField; - var parentKeyField = this.options.parentKeyField; - var keyValue = this.getString($(row).attr(keyField), ''); - rowObj.keyValue = keyValue; - var parentKeyValue = this.getString($(row).attr(parentKeyField), ''); - rowObj.parentKeyValue = parentKeyValue; - var parentChildLength; - /* 判断是否存在父项/子项 */ - $.each(this.dataSourceObj.rows, function (i) { - var value = this.value; - var nowKeyValue = oThis.getString($(value).attr(keyField), ''); - var nowParentKeyValue = oThis.getString($(value).attr(parentKeyField), ''); - if (nowKeyValue == parentKeyValue) { - /* 取父项的index和父项的子index*/ - oThis.hasParent = true; - oThis.addRowParentIndex = i; - parentChildLength = oThis.getAllChildRow(this).length; - var parentLevel = this.level; - rowObj.level = parentLevel + 1; - // 由于不止需要计算最后一个子节点,同时需要计算子节点的子节点。所以现在添加到父节点的下面一个 - index = oThis.addRowParentIndex + parentChildLength + 1; - if (!oThis.options.needTreeSort) return false; - } - if (nowParentKeyValue == keyValue) { - oThis.hasChildF = true; - } - if (oThis.hasParent && oThis.hasChildF) return false; - }); - if (!this.hasParent) { - rowObj.level = 0; - if (index != l) { - // 如果没有父项则插入到最后,因为index有可能插入到其他节点的子节点之中,计算复杂 - index = l; - } - } - if (this.hasParent) { - var $pTr = $('#' + this.options.id + '_content_div').find('tbody').find('tr[role="row"]').eq(oThis.addRowParentIndex); - if (parentChildLength > 0) { - // 如果存在父项并且父项存在子项则需要判断父项是否展开 - var openDiv = $('.uf-add-s-o', $pTr); - if (!(openDiv.length > 0)) { - displayFlag = 'block'; - } - } else { - // 如果存在父项并且父项原来没有子项则需要添加图标 - if (this.options.autoExpand) { - displayFlag = 'block'; - } - - var d = $("div:eq(0)", $pTr); - var openDiv = $('.uf-add-s-o', $pTr); - var closeDiv = $('.uf-reduce-s-o', $pTr); - if (this.options.autoExpand) { - var spanHtml = ''; - } else { - var spanHtml = ''; - } - if (d.length > 0 && openDiv.length == 0 && closeDiv.length == 0) { - d[0].insertAdjacentHTML('afterBegin', spanHtml); - var oldLeft = parseInt(d[0].style.left); - l = oldLeft - 16; - if (l > 0 || l == 0) { - d[0].style.left = l + "px"; - } - } - if (openDiv.length > 0) { - openDiv.removeClass('uf-add-s-o').addClass('uf-reduce-s-o'); - } - } - } - } - - return { - index: index, - displayFlag: displayFlag - }; - }; - var re_addOneRowTreeHasChildF = function re_addOneRowTreeHasChildF(rowObj) { - if (this.hasChildF) { - //如果存在子项则重新渲染整个区域 - this.dataSourceObj.sortRows(); - this.repairContent(); - } else { - // 修改rowObj 和parent的变量 - if (this.hasParent) { - var parentRowObj = this.dataSourceObj.rows[this.addRowParentIndex]; - parentRowObj.hasChild = true; - parentRowObj.childRow.push(rowObj); - parentRowObj.childRowIndex.push(rowObj.valueIndex); - rowObj.parentRow = parentRowObj; - rowObj.parentRowIndex = this.addRowParentIndex; - } - rowObj.hasChild = false; - rowObj.childRow = new Array(); - rowObj.childRowIndex = new Array(); - } - }; - var re_updateValueAtTree = function re_updateValueAtTree(rowIndex, field, value, force) { - var oThis = this; - var keyField = this.options.keyField; - var parentKeyField = this.options.parentKeyField; - if (this.options.showTree && (field == keyField || field == parentKeyField)) { - // 目前已经不适用grid源生的编辑设置了,因为树表时关闭edit - var hasParent = false; - var hasChildF = false; - - $.each(this.dataSourceObj.rows, function (i) { - var vv = this.value; - var nowKeyValue = oThis.getString($(vv).attr(keyField), ''); - var nowParentKeyValue = oThis.getString($(vv).attr(parentKeyField), ''); - if (field == keyField && value == nowParentKeyValue) { - //修改的是keyfield,判断是否存在子项 - hasChildF = true; - } - if (field == parentKeyField && value == nowKeyValue) { - //修改的是parentKeyField,判断是否存在父项 - hasParent = true; - } - }); - if (hasChildF || hasParent) { - //删除当前行之后重新插入当前行由addonerow来进行树结构处理 - var rowValue = $(this.dataSourceObj.rows[rowIndex].value); - this.deleteOneRow(rowIndex); - this.addOneRow(rowValue[0]); - } - } - if (this.options.showTree && (field == keyField || field == parentKeyField) && (hasChildF || hasParent)) { - rowIndex = this.getRowIndexByValue(field, value); - } - return rowIndex; - }; - /* - * 获取数据行下所有子元素 - */ - var getAllChildRow = function getAllChildRow(row) { - // if(row.allChildRow && row.allChildRow.length > 0){ - // return row.allChildRow; - // } - row.allChildRow = new Array(); - this.getAllChildRowFun(row, row.allChildRow); - return row.allChildRow; - }; - var re_getChildRowIndex = function re_getChildRowIndex(row) { - var result = []; - if (row.childRow && row.childRow.length > 0) { - $.each(row.childRow, function () { - result.push(this.valueIndex); - }); - } - return result; - }; - /* - * 获取数据行下所有子元素的index - */ - var getAllChildRowIndex = function getAllChildRowIndex(row) { - // if(row.allChildRowIndex && row.allChildRowIndex.length > 0){ - // return row.allChildRowIndex; - // } - row.allChildRowIndex = new Array(); - this.getAllChildRowIndexFun(row, row.allChildRowIndex); - return row.allChildRowIndex; - }; - var getAllChildRowFun = function getAllChildRowFun(row, rowArry) { - var oThis = this; - if (row.childRow.length > 0) { - Array.prototype.push.apply(rowArry, row.childRow); - $.each(row.childRow, function () { - oThis.getAllChildRowFun(this, rowArry); - }); - } - }; - var getAllChildRowIndexFun = function getAllChildRowIndexFun(row, rowArry) { - var oThis = this; - if (row.childRow.length > 0) { - Array.prototype.push.apply(rowArry, this.getChildRowIndex(row)); - $.each(row.childRow, function () { - oThis.getAllChildRowIndexFun(this, rowArry); - }); - } - }; - /* 展开某个节点 */ - var expandNode = function expandNode(keyValue) { - var rowIndex = this.getRowIndexByValue(this.options.keyField, keyValue); - this.expandNodeByIndex(rowIndex); - }; - var expandNodeByIndex = function expandNodeByIndex(rowIndex) { - var row = this.getRowByIndex(rowIndex); - var parentExpand = false, - parentIndex, - needExpanedParent = new Array(); - var whileRow = row; - while (!parentExpand) { - if (whileRow.parentKeyValue == '') { - parentExpand = true; - break; - } else { - parentIndex = whileRow.parentRowIndex; - whileRow = whileRow.parentRow; - var $pTr = $('#' + this.options.id + '_content_div').find('tbody').find('tr[role="row"]').eq(parentIndex); - var openDiv = $('.uf-add-s-o', $pTr); - if (openDiv.length > 0) { - //合着 - needExpanedParent.push(parentIndex); - } else { - parentExpand = true; - break; - } - } - } - if (needExpanedParent.length > 0) { - for (var i = needExpanedParent.length - 1; i > -1; i--) { - var index = needExpanedParent[i]; - var $pTr = $('#' + this.options.id + '_content_div').find('tbody').find('tr[role="row"]').eq(index); - var openDiv = $('.uf-add-s-o', $pTr); - openDiv.click(); - } - } - - var $Tr = $('#' + this.options.id + '_content_div').find('tbody').find('tr[role="row"]').eq(rowIndex); - var openDiv = $('.uf-add-s-o', $Tr); - var firstDiv = $('.u-grid-content-td-div', $Tr); - if (openDiv.length > 0) openDiv.click();else firstDiv.click(); - }; - /* - * 将values转化为rows并进行排序(数表) - */ - var re_treeSortRows = function re_treeSortRows(field, sortType) { - var oThis = this; - var spliceHasParentRows = new Array(); - this.rows = new Array(); - this.hasParentRows = new Array(); - this.nothasParentRows = new Array(); - if (this.options.values) { - $.each(this.options.values, function (i) { - var rowObj = {}; - var $this = $(this); - var keyField = oThis.gridComp.options.keyField; - var parentKeyField = oThis.gridComp.options.parentKeyField; - var keyValue = oThis.gridComp.getString($this.attr(keyField), ''); - var parentKeyValue = oThis.gridComp.getString($this.attr(parentKeyField), ''); - rowObj.valueIndex = i; - rowObj.value = this; - rowObj.keyValue = keyValue; - rowObj.parentKeyValue = parentKeyValue; - if (parentKeyValue == '') { - oThis.nothasParentRows.push(rowObj); - } else { - oThis.hasParentRows.push(rowObj); - } - oThis.rows.push(rowObj); - }); - // 判断存在父项的数据的父项是否真正存在 - $.each(this.hasParentRows, function (i) { - var parentKeyValue = this.parentKeyValue; - var hasParent = false; - $.each(oThis.rows, function () { - if (this.keyValue == parentKeyValue) { - hasParent = true; - } - }); - if (!hasParent) { - spliceHasParentRows.push(this); - oThis.nothasParentRows.push(this); - } - }); - $.each(spliceHasParentRows, function () { - var index = oThis.hasParentRows.indexOf(this); - oThis.hasParentRows.splice(index, 1); - }); - oThis.rows = new Array(); - var level = 0; - // 遍历nothasParentRows,将子项加入rows - $.each(this.nothasParentRows, function (i) { - this.level = level; - oThis.rows.push(this); - oThis.pushChildRows(this, level); - }); - } - }; - /* - * 将当前行子项插入rows数组 - */ - var pushChildRows = function pushChildRows(row, level) { - var keyValue = row.keyValue; - var oThis = this; - var nowLevel = parseInt(level) + 1; - var hasChild = false; - var childRowArray = new Array(); - var childRowIndexArray = new Array(); - var spliceHasParentRows = new Array(); - $.each(this.hasParentRows, function (i) { - if (this && this.parentKeyValue == keyValue) { - hasChild = true; - this.level = nowLevel; - oThis.rows.push(this); - childRowArray.push(this); - var index = parseInt(oThis.rows.length - 1); - childRowIndexArray.push(index); - spliceHasParentRows.push(this); - oThis.pushChildRows(this, nowLevel); - } - }); - $.each(spliceHasParentRows, function () { - var index = oThis.hasParentRows.indexOf(this); - oThis.hasParentRows.splice(index, 1); - }); - row.hasChild = hasChild; - row.childRow = childRowArray; - row.childRowIndex = childRowIndexArray; - }; - var treeFunObj = exports.treeFunObj = { - initOptionsTree: re_initOptionsTree, - clickFunTree: re_clickFunTree, - addOneRowTree: re_addOneRowTree, - addOneRowTreeHasChildF: re_addOneRowTreeHasChildF, - updateValueAtTree: re_updateValueAtTree, - getAllChildRow: getAllChildRow, - getChildRowIndex: re_getChildRowIndex, - getAllChildRowIndex: getAllChildRowIndex, - getAllChildRowFun: getAllChildRowFun, - getAllChildRowIndexFun: getAllChildRowIndexFun, - expandNode: expandNode, - expandNodeByIndex: expandNodeByIndex, - re_treeSortRows: re_treeSortRows, - pushChildRows: pushChildRows, - re_initTree: re_initTree - }; - -/***/ }, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.column = undefined; - - var _columnInit = __webpack_require__(8); - - var _re_gridCompTree = __webpack_require__(6); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var column = function column(options, gridComp) { - _classCallCheck(this, column); - - this.init(options, gridComp); - }; - - ; - var gridCompColumnProto = column.prototype; - Object.assign(gridCompColumnProto, _columnInit.initFunObj); - - /* - * tree - */ - - - gridCompColumnProto.initTree = _re_gridCompTree.treeFunObj.re_initTree; - - exports.column = column; - -/***/ }, -/* 8 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /* - * 处理参数 - */ - var init = function init(options, gridComp) { - // this.gridComp = gridComp; // 在处理前端缓存将column转为string的时候会因为此属性出现死循环 - var gridOptions = gridComp.options; - this.gridGetBoolean = gridComp.getBoolean; - this.defaults = { - width: '200', // 默认宽度为200 - sortable: true, // 是否可以排序 - canDrag: true, // 是否可以拖动 - fixed: false, // 是否固定列 - visible: true, // 是否显示 - canVisible: true, // 是否可以隐藏 - sumCol: false, // 是否计算合计 - editable: true, // 是否可修改 - editFormShow: true, // 是否可修改 - autoExpand: false, // 是否自动扩展列 - editType: 'text', // 编辑类型,支持传入function扩展 - dataType: 'String', // 数据类型,String, Date, Datetime, Int, Float - //precision: //精度 - format: 'YYYY-MM-DD hh:mm:ss', - //renderType:'', 渲染类型 - //headerColor - headerLevel: 1, // header层级 - hiddenLevel: 1 }; - // 从grid继承的属性 - var gridDefault = { - sortable: gridOptions.sortable, - canDrag: gridOptions.canDrag, - width: gridOptions.columnWidth - }; - if (options.dataType == 'Date') { - this.defaults.format = 'YYYY-MM-DD'; - } - // 树表暂时不支持排序 - options = this.initTree(options, gridOptions); - this.options = $.extend({}, this.defaults, gridDefault, options); - this.getBooleanOptions(); - try { - if (typeof this.options.renderType == 'string') this.options.renderType = eval(this.options.renderType); - } catch (e) {} - try { - if (typeof this.options.editType == 'string') this.options.editType = eval(this.options.editType); - } catch (e) {} - - this.options.width = this.options.width; - this.firstColumn = false; - }; - var initTree = function initTree(options) { - return options; - }; - var getBooleanOptions = function getBooleanOptions() { - this.options.sortable = this.gridGetBoolean(this.options.sortable); - this.options.canDrag = this.gridGetBoolean(this.options.canDrag); - this.options.fixed = this.gridGetBoolean(this.options.fixed); - this.options.visible = this.gridGetBoolean(this.options.visible); - this.options.canVisible = this.gridGetBoolean(this.options.canVisible); - this.options.sumCol = this.gridGetBoolean(this.options.sumCol); - this.options.editable = this.gridGetBoolean(this.options.editable); - this.options.editFormShow = this.gridGetBoolean(this.options.editFormShow); - this.options.autoExpand = this.gridGetBoolean(this.options.autoExpand); - }; - - var initFunObj = exports.initFunObj = { - init: init, - initTree: initTree, - getBooleanOptions: getBooleanOptions - }; - -/***/ }, -/* 9 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.gridComp = undefined; - - var _gridCompCreate = __webpack_require__(10); - - var _gridCompCreateCal = __webpack_require__(11); - - var _gridCompEvent = __webpack_require__(4); - - var _gridCompGet = __webpack_require__(12); - - var _gridCompInit = __webpack_require__(13); - - var _gridCompOperateRow = __webpack_require__(15); - - var _gridCompRenderType = __webpack_require__(16); - - var _gridCompSet = __webpack_require__(17); - - var _gridCompWDChange = __webpack_require__(18); - - var _gridCompClick = __webpack_require__(19); - - var _gridCompOther = __webpack_require__(20); - - var _ut_utility = __webpack_require__(21); - - var _re_gridCompColMenu = __webpack_require__(22); - - var _re_gridCompDrag = __webpack_require__(23); - - var _re_gridCompEdit = __webpack_require__(14); - - var _re_gridCompEditForm = __webpack_require__(24); - - var _re_gridCompFixed = __webpack_require__(25); - - var _re_gridCompFormShow = __webpack_require__(26); - - var _re_gridCompHeaderLevel = __webpack_require__(27); - - var _re_gridCompLocalStorage = __webpack_require__(28); - - var _re_gridCompOverWidthHidden = __webpack_require__(29); - - var _re_gridCompSort = __webpack_require__(3); - - var _re_gridCompSumRow = __webpack_require__(30); - - var _re_gridCompSwap = __webpack_require__(31); - - var _re_gridCompRowDrag = __webpack_require__(32); - - var _re_gridCompTree = __webpack_require__(6); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var gridComp = function gridComp(ele, options) { - _classCallCheck(this, gridComp); - - this.init(ele, options); - this.initGrid(); - }; - - ; - var gridCompProto = gridComp.prototype; - Object.assign(gridCompProto, _gridCompCreate.createFunObj); - Object.assign(gridCompProto, _gridCompCreateCal.createCalFunOjb); - Object.assign(gridCompProto, _gridCompEvent.eventFunObj); - Object.assign(gridCompProto, _gridCompGet.getFunObj); - Object.assign(gridCompProto, _gridCompInit.initFunObj); - Object.assign(gridCompProto, _gridCompOperateRow.operateRowFunObj); - Object.assign(gridCompProto, _gridCompRenderType.renderTypeFunObj); - Object.assign(gridCompProto, _gridCompSet.setFunObj); - Object.assign(gridCompProto, _gridCompWDChange.wdChangeFunObj); - Object.assign(gridCompProto, _gridCompClick.clickFunObj); - Object.assign(gridCompProto, _gridCompOther.otherFunObj); - Object.assign(gridCompProto, _ut_utility.utilFunOjb); - - /* - * colmuenu - */ - var oldInitGridCompColumn = gridCompProto.initGridCompColumn, - oldInitEventFun = gridCompProto.initEventFun, - oldInitGridEventFun = gridCompProto.initGridEventFun; - - gridCompProto.initGridCompColumnColumnMenuFun = _re_gridCompColMenu.re_initGridCompColumnColumnMenuFun; - gridCompProto.initGridCompColumn = function () { - // 执行原有方法 - oldInitGridCompColumn.apply(this, arguments); - _re_gridCompColMenu.colMenu_initGridCompColumn.apply(this, arguments); - }; - gridCompProto.createColumnMenu = _re_gridCompColMenu.re_createColumnMenu; - gridCompProto.initEventFun = function () { - // 执行原有方法 - oldInitEventFun.apply(this, arguments); - _re_gridCompColMenu.colMenu_initEventFun.apply(this, arguments); - }; - gridCompProto.initGridEventFun = function () { - // 执行原有方法 - oldInitGridEventFun.apply(this, arguments); - _re_gridCompColMenu.colMenu_initGridEventFun.apply(this, arguments); - }; - - if (typeof gridCompProto.saveGridCompColumnArrToLocal == 'undefined') { - gridCompProto.saveGridCompColumnArrToLocal = function () {}; - } - if (typeof gridCompProto.clearLocalData == 'undefined') { - gridCompProto.clearLocalData = function () {}; - } - - /* - * grag - */ - var oldInitEventFun_grag = gridCompProto.initEventFun; - var oldInitGridEventFun_grag = gridCompProto.initGridEventFun; - - Object.assign(gridCompProto, _re_gridCompDrag.dragFunObj); - gridCompProto.initEventFun = function () { - // 执行原有方法 - oldInitEventFun_grag.apply(this, arguments); - _re_gridCompDrag.dragFunObj.drag_initEventFun.apply(this, arguments); - }; - gridCompProto.initGridEventFun = function () { - // 执行原有方法 - oldInitGridEventFun_grag.apply(this, arguments); - _re_gridCompDrag.dragFunObj.drag_initGridEventFun.apply(this, arguments); - }; - if (typeof gridCompProto.saveGridCompColumnArrToLocal == 'undefined') { - gridCompProto.saveGridCompColumnArrToLocal = function () {}; - } - - /* - * edit - */ - var oldInitEventFun_edit = gridCompProto.initEventFun; - - Object.assign(gridCompProto, _re_gridCompEdit.eidtFunObj); - - if (typeof gridCompProto.formEditCell == 'undefined') { - gridCompProto.formEditCell = function () {}; - }; - - gridCompProto.initEventFun = function () { - // 执行原有方法 - oldInitEventFun_edit.apply(this, arguments); - _re_gridCompEdit.eidtFunObj.edit_initEventFun.apply(this, arguments); - }; - - /* - * editForm - */ - var oldInitDefault = gridCompProto.initDefault, - oldSetRequired = gridCompProto.setRequired; - - Object.assign(gridCompProto, _re_gridCompEditForm.editFromFunObj); - gridCompProto.initDefault = function () { - // 执行原有方法 - oldInitDefault.apply(this, arguments); - _re_gridCompEditForm.editFromFunObj.editForm_initDefault.apply(this, arguments); - }; - gridCompProto.setRequired = function () { - // 执行原有方法 - oldSetRequired.apply(this, arguments); - _re_gridCompEditForm.editFromFunObj.editForm_setRequired.apply(this, arguments); - }; - - /* - * fixed - */ - var oldColumnsVisibleFun = gridCompProto.columnsVisibleFun; - - Object.assign(gridCompProto, _re_gridCompFixed.fixFunObj); - gridCompProto.columnsVisibleFun = function () { - // 执行原有方法 - oldColumnsVisibleFun.apply(this, arguments); - _re_gridCompFixed.fixFunObj.fixed_columnsVisibleFun.apply(this, arguments); - }; - - /* - * formShow - */ - - Object.assign(gridCompProto, _re_gridCompFormShow.formShowFunOjb); - - /* - * headerLevel - */ - - Object.assign(gridCompProto, _re_gridCompHeaderLevel.headerLevelFunObj); - - /* - * localStorage - */ - - Object.assign(gridCompProto, _re_gridCompLocalStorage.localStorageFunObj); - - /* - * overWidthColumn - */ - - Object.assign(gridCompProto, _re_gridCompOverWidthHidden.overWidthHiddenFunObj); - - /* - * sort - */ - var oldInitEventFun_sort = gridCompProto.initEventFun; - var oldInitGridEventFun_sort = gridCompProto.initGridEventFun; - - Object.assign(gridCompProto, _re_gridCompSort.sortFunObj); - gridCompProto.initEventFun = function () { - // 执行原有方法 - oldInitEventFun_sort.apply(this, arguments); - _re_gridCompSort.sortFunObj.sort_initEventFun.apply(this, arguments); - }; - gridCompProto.initGridEventFun = function () { - // 执行原有方法 - oldInitGridEventFun_sort.apply(this, arguments); - _re_gridCompSort.sortFunObj.sort_initGridEventFun.apply(this, arguments); - }; - - /* - * sumRow - */ - - Object.assign(gridCompProto, _re_gridCompSumRow.sumRowFunObj); - - /* - * swap - */ - var oldInitEventFun_swap = gridCompProto.initEventFun; - var oldInitGridEventFun_swap = gridCompProto.initGridEventFun; - - Object.assign(gridCompProto, _re_gridCompSwap.swapFunObj); - - gridCompProto.initEventFun = function () { - // 执行原有方法 - oldInitEventFun_swap.apply(this, arguments); - _re_gridCompSwap.swapFunObj.swap_initEventFun.apply(this, arguments); - }; - gridCompProto.initGridEventFun = function () { - // 执行原有方法 - oldInitGridEventFun_swap.apply(this, arguments); - _re_gridCompSwap.swapFunObj.swap_initGridEventFun.apply(this, arguments); - }; - - /* - * rowDrag - */ - - // var oldInitEventFun_rowDrag= gridCompProto.initEventFun; - var oldInitGridEventFun_rowDrag = gridCompProto.initGridEventFun; - - Object.assign(gridCompProto, _re_gridCompTree.treeFunObj); - - gridCompProto.initGridEventFun = function () { - // 执行原有方法 - oldInitGridEventFun_rowDrag.apply(this, arguments); - _re_gridCompRowDrag.rowDragFunObj.rowDrag_initGridEventFun.apply(this, arguments); - }; - - /* - * tree - */ - - - Object.assign(gridCompProto, _re_gridCompTree.treeFunObj); - - exports.gridComp = gridComp; - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.createFunObj = undefined; - - var _gridBrowser = __webpack_require__(5); - - /* - * 创建顶层div以及_top div层 - * 添加顶层div相关监听 - */ - var createDivs = function createDivs() { - var oThis = this, - styleStr = '', - str = '', - mobileClass = ''; - this.ele.innerHTML = ''; - if (this.options.width) { - str += 'width:' + this.options.width + ';'; - } else { - str += 'width:auto;'; - } - if (this.options.height) { - str += 'height:' + this.options.height + ';'; - } else { - str += 'height:auto;'; - } - if (str != '') { - styleStr = 'style="' + str + '"'; - } - if (_gridBrowser.gridBrowser.isMobile) { - mobileClass = 'u-grid-mobile'; - } - var htmlStr = '
'; - htmlStr += '
'; - this.ele.insertAdjacentHTML('afterBegin', htmlStr); - // 创建屏幕div,用于拖动等操作 - var htmlStr = '
'; - // this.ele.insertAdjacentHTML('afterBegin', htmlStr); - document.body.appendChild($(htmlStr)[0]); - this.initEventFun(); //创建完成之后顶层div添加监听 - this.widthChangeFun(); // 根据整体宽度创建grid或form展示区域 - }; - /* - * 创建div区域 - */ - var repaintDivs = function repaintDivs() { - // 后期可以考虑form展示 - this.repaintGridDivs(); - this.realtimeTableRows = null; - }; - /* - * 创建grid形式下div区域 - */ - var createGridDivs = function createGridDivs() { - if (this.createGridFlag) { - return; - } - // 为避免重复渲染,在开始清空里面内容 - if ($('#' + this.options.id)[0]) $('#' + this.options.id)[0].innerHTML = ''; - var htmlStr = '
'; - // htmlStr += this.createColumnMenu(); - htmlStr += this.createHeader(); - htmlStr += this.createContent(); - htmlStr += '
'; - if ($('#' + this.options.id)[0]) $('#' + this.options.id).html(htmlStr); - $('#' + this.options.id + '_column_menu').remove(); - $(document.body).append(this.createColumnMenu()); - this.initGridEventFun(); - this.headerFirstClassFun(); - this.showType = 'grid'; - this.afterGridDivsCreate(); - this.createGridFlag = true; - this.realtimeTableRows = null; - }; - /* - * 重画grid - */ - var repaintGridDivs = function repaintGridDivs() { - $('#' + this.options.id + '_grid').remove(null, true); - this.showType = ''; - this.wholeWidth = 0; - this.createGridFlag = false; - this.columnsVisibleFun(); - this.widthChangeFun(); - this.realtimeTableRows = null; - }; - /* - * 创建columnMenu区域 - */ - var createColumnMenu = function createColumnMenu() { - return ''; - }; - /* - * 创建header区域 - */ - var createHeader = function createHeader() { - var wrapStr = '', - headerShowStr = ''; - if (!this.options.showHeader) headerShowStr = 'style="display:none;"'; - var htmlStr = '
'; - if (this.options.columnMenu) { - htmlStr += '
'; - } - if (this.options.multiSelect || this.options.showNumCol) { - htmlStr += '
'; - if (this.options.multiSelect) { - if (_gridBrowser.gridBrowser.isIE8) { - //htmlStr += '
' - htmlStr += '
'; - } else { - //htmlStr += '
' - htmlStr += '
'; - } - } - if (this.options.showNumCol) { - htmlStr += '
'; - } - htmlStr += '
'; - } - htmlStr += this.createHeaderTableFixed(); - htmlStr += this.createHeaderTable(); - htmlStr += '
'; - htmlStr += this.createHeaderDrag();; - htmlStr += '
'; - return htmlStr; - }; - /* - * 创建header区域table - */ - var createHeaderTable = function createHeaderTable(createFlag) { - var leftW, positionStr, idStr; - if (createFlag == 'fixed') { - leftW = parseInt(this.leftW); - positionStr = 'absolute;width:' + this.fixedWidth + 'px;z-index:11;background:#F9F9F9;'; - idStr = 'fixed_'; - } else { - if (this.options.fixedFloat == 'right') { - leftW = parseInt(this.leftW); - } else { - leftW = parseInt(this.leftW) + parseInt(this.fixedWidth); - } - positionStr = 'relative;'; - idStr = ''; - if (this.contentMinWidth > 0) { - positionStr += 'width:' + this.contentMinWidth + 'px;'; - } - } - if (createFlag == 'fixed' && this.options.fixedFloat == 'right') { - var htmlStr = ''; - } else { - var htmlStr = '
'; - } - htmlStr += this.createColgroup(createFlag); - htmlStr += ''; - htmlStr += this.createThead(createFlag); - htmlStr += '
'; - return htmlStr; - }; - var createHeaderTableFixed = function createHeaderTableFixed() { - return ''; - }; - var createHeaderDrag = function createHeaderDrag() { - return ''; - }; - /* - * 创建colgroup - */ - var createColgroup = function createColgroup(createFlag) { - var oThis = this, - htmlStr = '', - gridCompColumnArr; - if (createFlag == 'fixed') { - gridCompColumnArr = this.gridCompColumnFixedArr; - } else { - gridCompColumnArr = this.gridCompColumnArr; - } - $.each(gridCompColumnArr, function () { - if (this.options.visible) { - htmlStr += ' 1) { - trStyle = 'style="height:' + (this.headerHeight - 1) + 'px;"'; - thLevelClass = ' u-grid-header-level-div '; - } - var htmlStr = ''; - if (createFlag == 'fixed') { - gridCompColumnArr = this.gridCompColumnFixedArr; - } else { - gridCompColumnArr = this.gridCompColumnArr; - } - $.each(gridCompColumnArr, function (i) { - var vi = visibleIndex, - displayStyle = ''; - if (this.options.visible == false) { - vi = -1; - displayStyle = 'style="display:none;"'; - } else { - visibleIndex++; - } - - // 低版本浏览器不支持th position为relative,因此加入空div - htmlStr += '
'; - var colorStype = ''; - if (this.options.headerColor) { - colorStype = 'style="color:' + this.options.headerColor + '"'; - } - htmlStr += ''; - /*if(oThis.options.columnMenu && createFlag != 'fixed'){ - // 创建右侧按钮图标 - htmlStr += ''; - }*/ - htmlStr += '
'; - }); - - htmlStr += ''; - return htmlStr; - }; - /* - * 创建内容区域 - */ - var createContent = function createContent() { - var h = '', - displayStr = '', - bottonStr = '', - lbw = 0; - if (this.countContentHeight) { - var wh = $('#' + this.options.id)[0].offsetHeight; - this.wholeHeight = wh; - if (wh > 0) { - this.contentHeight = parseInt(wh) - this.exceptContentHeight - 1 > 0 ? parseInt(wh) - this.exceptContentHeight - 1 : 0; - if (this.contentHeight > 0) { - h = 'style="height:' + this.contentHeight + 'px;"'; - } - } - } - var htmlStr = '
'; - if (this.options.showNumCol || this.options.multiSelect) { - htmlStr += this.createContentLeft(); - if (!(this.contentWidth > this.contentMinWidth)) { - displayStr = 'display:none;'; - bottonStr = 'bottom:0px;'; - } - htmlStr += this.createContentSumRow(bottonStr); - if (u.isIOS) { - displayStr += 'width:0px;'; - } - if (this.options.fixedFloat == 'right') { - lbw = this.leftW; - } else { - lbw = this.leftW + this.fixedWidth; - } - htmlStr += '
'; - htmlStr += '
'; - } - htmlStr += this.createContentTableFixed(); - htmlStr += this.createContentTable(); - htmlStr += '
'; - return htmlStr; - }; - var createContentSumRow = function createContentSumRow() { - return ''; - }; - /* - * 创建内容区左侧区域 - */ - var createContentLeft = function createContentLeft() { - var oThis = this, - htmlStr = "", - left = 0, - hStr, - sumRowClass = ''; - // 高度可伸缩,暂时去掉内部的高度设置 - // if(this.countContentHeight && parseInt(this.contentHeight) > 0){ - // hStr = 'max-height:' + this.contentHeight + 'px;overflow:hidden;'; - // }else{ - // hStr = ''; - // } - if (this.options.showSumRow) { - sumRowClass = 'u-grid-content-left-sum'; - } - if (this.options.multiSelect) { - htmlStr += '
'; - // 遍历生成所有行 - if (this.dataSourceObj.rows) { - $.each(this.dataSourceObj.rows, function (i) { - htmlStr += oThis.createContentLeftMultiSelectRow(this); - }); - } - htmlStr += '
'; - left += this.multiSelectWidth; - } - if (this.options.showNumCol) { - htmlStr += '
'; - // 遍历生成所有行 - if (this.dataSourceObj.rows) { - $.each(this.dataSourceObj.rows, function (i, row) { - htmlStr += oThis.createContentLeftNumColRow(i, row.value); - }); - } - htmlStr += '
'; - } - return htmlStr; - }; - /* - * 创建内容区左侧区域复选区(一行) - */ - var createContentLeftMultiSelectRow = function createContentLeftMultiSelectRow(row, displayFlag) { - var displayStr = ''; - if (!this.options.autoExpand && row.level > 0 && displayFlag != 'block') { - displayStr = 'display:none;'; - } - var tmpcheck = row.value["$_#_@_id"]; - if (!tmpcheck) { - tmpcheck = setTimeout(function () {}); - } - - var rootObj = row.value; - var objAry = this.selectRows; - var re = objCompare(rootObj, objAry); - - if (_gridBrowser.gridBrowser.isIE8) { - //var htmlStr = '
' - var htmlStr = '
'; - } else { - if (re) { - var htmlStr = '
'; - } else { - var htmlStr = '
'; - } - //var htmlStr = '
' - } - return htmlStr; - }; - /* - * 创建内容区左侧区域数字列(一行) - */ - var createContentLeftNumColRow = function createContentLeftNumColRow(index) { - var row = this.dataSourceObj.rows[index]; - var rootObj = row.value; - var objAry = this.selectRows; - var re = objCompare(rootObj, objAry); - var htmlStr; - if (re) { - htmlStr = '
' + (index + 1) + '
'; - } else { - htmlStr = '
' + (index + 1) + '
'; - } - return htmlStr; - }; - /* - * 创建内容区table - */ - var createContentTable = function createContentTable(createFlag) { - var leftW, idStr, styleStr, hStr, cssStr, tableStyleStr; - if (this.countContentHeight && parseInt(this.contentHeight) > 0) { - hStr = 'height:' + this.contentHeight + 'px;'; - } else { - hStr = ""; - } - - if (createFlag == 'fixed') { - leftW = parseInt(this.leftW); - idStr = 'fixed_'; - cssStr = 'fixed-'; - if (this.options.fixedFloat == 'right') { - styleStr = 'style="position:absolute;width:' + this.fixedWidth + 'px;right:0px;' + hStr + '"'; - } else { - styleStr = 'style="position:absolute;width:' + this.fixedWidth + 'px;left:' + leftW + 'px;' + hStr + '"'; - } - tableStyleStr = 'style="width:' + this.fixedWidth + 'px;"'; - } else { - if (this.options.fixedFloat == 'right') { - leftW = parseInt(this.leftW); - } else { - leftW = parseInt(this.leftW) + parseInt(this.fixedWidth, 0); - } - idStr = ''; - cssStr = ''; - styleStr = 'style="position:relative;left:' + leftW + 'px;' + hStr; - if (this.contentMinWidth > 0) { - styleStr += 'width:' + this.contentMinWidth + 'px;'; - } - // 因为添加overflow-x之后会导致纵向也显示不全,后续出现问题通过修改宽度来实现,不再通过overflow来实现 - if (this.options.noScroll) { - styleStr += 'overflow-x:hidden;'; - } - styleStr += '"'; - tableStyleStr = ''; - if (this.contentMinWidth > 0) { - if (this.contentWidth > 0) { - tableStyleStr = 'style="min-width:' + this.contentMinWidth + 'px;width:' + this.contentWidth + 'px;"'; - } else { - tableStyleStr = 'style="min-width:' + this.contentMinWidth + 'px;"'; - } - } - } - - var htmlStr = '
'; - htmlStr += '
'; - htmlStr += this.createColgroup(createFlag); - htmlStr += ''; - htmlStr += this.createThead(createFlag); - htmlStr += ''; - htmlStr += this.createContentRows(createFlag); - htmlStr += '
'; - if (createFlag != 'fixed') { - htmlStr += this.createNoRowsDiv(); - } - htmlStr += '
'; - return htmlStr; - }; - var createContentTableFixed = function createContentTableFixed() { - return ''; - }; - /* - * 创建无数据区域 - */ - var createNoRowsDiv = function createNoRowsDiv() { - var styleStr = '', - styleStr1 = ''; - if (this.contentMinWidth > 0) { - styleStr += 'style="width:' + this.contentMinWidth + 'px;"'; - } - if (this.contentWidth > 0) { - styleStr1 += 'style="width:' + this.contentWidth + 'px;"'; - } - var htmlStr = '
'; - htmlStr += '
' + this.transMap.ml_no_rows + '
'; - return htmlStr; - }; - /* - * 创建内容区域所有行 - */ - var createContentRows = function createContentRows(createFlag) { - var oThis = this, - htmlStr = "", - idStr; - if (createFlag == 'fixed') { - idStr = 'fixed_'; - } else { - idStr = ''; - } - // 遍历生成所有行 - if (this.dataSourceObj.rows) { - htmlStr += ''; - $.each(this.dataSourceObj.rows, function (i) { - htmlStr += oThis.createContentOneRow(this, createFlag); - }); - htmlStr += this.createContentRowsSumRow(createFlag); - htmlStr += ''; - } - return htmlStr; - }; - var createContentRowsSumRow = function createContentRowsSumRow() { - return ''; - }; - /* - * 创建内容区域数据行 - */ - var createContentOneRow = function createContentOneRow(row, createFlag, displayFlag) { - var styleStr = ''; - if (!this.options.autoExpand && row.level > 0 && displayFlag != 'block') { - styleStr = 'style="display:none"'; - } - - var rootObj = row.value; - var objAry = this.selectRows; - var re = objCompare(rootObj, objAry); - var htmlStr = ''; - if (re) { - htmlStr = ''; - } else { - htmlStr = ''; - } - htmlStr += this.createContentOneRowTd(row, createFlag); - htmlStr += ''; - return htmlStr; - }; - /* - * 创建内容区域数据行,针对IE - */ - var createContentOneRowForIE = function createContentOneRowForIE(table, index, rowObj, createFlag, displayFlag) { - var row = table.insertRow(index + 1); - row.setAttribute("role", "row"); - if (!this.options.autoExpand && row.level > 0 && displayFlag != 'block') { - row.style.display = 'none'; - } - this.createContentOneRowTdForIE(row, rowObj, createFlag); - }; - - /* - * 数据更新重画当前行 - */ - var repaintRow = function repaintRow(rowIndex) { - var tr = $('#' + this.options.id + '_content_tbody').find('tr[role="row"]')[rowIndex], - fixedtr = $('#' + this.options.id + '_content_fixed_tbody').find('tr[role="row"]')[rowIndex], - row = this.dataSourceObj.rows[rowIndex], - $tr = $(tr), - index = this.getTrIndex($tr); - if (_gridBrowser.gridBrowser.isIE8 || _gridBrowser.gridBrowser.isIE9) { - var table = $('#' + this.options.id + '_content_table')[0], - fixedtable = $('#' + this.options.id + '_content_fixed_table')[0]; - var className = tr.className; - var fixclassName = fixedtr.className; - table.deleteRow(rowIndex + 1); - fixedtable.deleteRow(rowIndex + 1); - var tr = table.insertRow(rowIndex + 1); - u.addClass(tr, className); - var fixedtr = fixedtable.insertRow(rowIndex + 1); - u.addClass(fixedtr, fixclassName); - this.createContentOneRowTdForIE(tr, row); - this.createContentOneRowTdForIE(fixedtr, row, 'fixed'); - } else { - tr.innerHTML = this.createContentOneRowTd(row); - if (fixedtr) fixedtr.innerHTML = this.createContentOneRowTd(row, 'fixed'); - } - var obj = {}; - obj.begin = index; - obj.length = 1; - this.renderTypeFun(obj); - }; - /* - * 创建行td对应的html - */ - var createContentOneRowTd = function createContentOneRowTd(row, createFlag) { - var oThis = this, - htmlStr = '', - gridCompColumnArr, - value = row.value; - if (createFlag == 'fixed') { - gridCompColumnArr = this.gridCompColumnFixedArr; - } else { - gridCompColumnArr = this.gridCompColumnArr; - } - $.each(gridCompColumnArr, function () { - var f = this.options.field, - v = $(value).attr(f); - v = oThis.getString(v, ''); - if ($.type(v) == 'object') { - v = v.showValue; - } - var renderType = this.options.renderType; - var treeStyle = ''; - var spanStr = ''; - var iconStr = ''; - var vStr = ''; - var tdStyle = ''; - if (oThis.options.showTree && this.firstColumn) { - var l = parseInt(oThis.treeLeft) * parseInt(row.level); - treeStyle = 'style="position:relative;'; - if (row.hasChild) { - if (oThis.options.autoExpand) { - spanStr = ''; - } else { - spanStr = ''; - } - } else { - l += 16; - } - treeStyle += 'left:' + l + 'px;"'; - } - if (!this.options.visible) { - tdStyle = 'style="display:none;"'; - } - if (this.options.icon) { - iconStr = ''; - } - // title="' + v + '" 创建td的时候不在设置title,在renderType中设置,处理现实xml的情况 - htmlStr += '
' + spanStr + iconStr + '' + v.replace(/\/g, '>') + '
'; - }); - return htmlStr; - }; - /* - * 创建行td,针对IE - */ - var createContentOneRowTdForIE = function createContentOneRowTdForIE(row, rowObj, createFlag) { - var oThis = this, - gridCompColumnArr, - value = rowObj.value; - if (createFlag == 'fixed') { - gridCompColumnArr = this.gridCompColumnFixedArr; - } else { - gridCompColumnArr = this.gridCompColumnArr; - } - $.each(gridCompColumnArr, function () { - var f = this.options.field, - v = $(value).attr(f), - v = oThis.getString(v, ''); - if ($.type(v) == 'object') { - v = v.showValue; - } - var renderType = this.options.renderType, - treeStyle = '', - spanStr = '', - iconStr = '', - vStr = '', - htmlStr = '', - newCell = row.insertCell(); - newCell.setAttribute("role", "rowcell"); - // newCell.title = v.replace(/\/g,'\>'); - if (oThis.options.showTree && this.firstColumn) { - var l = parseInt(oThis.treeLeft) * parseInt(rowObj.level); - treeStyle = 'style="position:relative;'; - if (rowObj.hasChild) { - if (oThis.options.autoExpand) { - spanStr = ''; - } else { - spanStr = ''; - } - } else { - l += 18; - } - treeStyle += 'left:' + l + 'px;"'; - } - if (!this.options.visible) { - newCell.style.display = "none"; - } - if (this.options.icon) { - iconStr = ''; - } - htmlStr += '
' + spanStr + iconStr + '' + v.replace(/\/g, '>') + '
'; - newCell.insertAdjacentHTML('afterBegin', htmlStr); - }); - }; - /* - * 重画内容区域 - */ - var repairContent = function repairContent() { - var $pDiv = $('#' + this.options.id + '_content').parent(); - $('#' + this.options.id + '_content').remove(null, true); - if ($pDiv[0]) { - var htmlStr = this.createContent(); - $pDiv[0].insertAdjacentHTML('beforeEnd', htmlStr); - this.renderTypeFun(); - this.initContentDivEventFun(); - if ($('#' + this.options.id + '_content_div')[0]) { - $('#' + this.options.id + '_content_div')[0].scrollLeft = this.scrollLeft; - } - $('#' + this.options.id + '_content_edit_menu').css('display', 'none'); - } - this.realtimeTableRows = null; - }; - - /** - * Object Compare with Array Object - */ - var objCompare = function objCompare(rootObj, objAry) { - var aryLen = objAry.length; - // var rootStr = JSON.stringify(rootObj); - var matchNum = 0; - for (var i = 0; i < aryLen; i++) { - // var compareStr = JSON.stringify(objAry[i]); - var compareObj = objAry[i]; - matchNum += rootObj == compareObj ? 1 : 0; - } - return matchNum > 0 ? true : false; - }; - - var createFunObj = exports.createFunObj = { - createDivs: createDivs, - repaintDivs: repaintDivs, - createGridDivs: createGridDivs, - repaintGridDivs: repaintGridDivs, - createColumnMenu: createColumnMenu, - createHeader: createHeader, - createHeaderTable: createHeaderTable, - createHeaderTableFixed: createHeaderTableFixed, - createHeaderDrag: createHeaderDrag, - createColgroup: createColgroup, - createThead: createThead, - createContent: createContent, - createContentSumRow: createContentSumRow, - createContentLeft: createContentLeft, - createContentLeftMultiSelectRow: createContentLeftMultiSelectRow, - createContentLeftNumColRow: createContentLeftNumColRow, - createContentTable: createContentTable, - createContentTableFixed: createContentTableFixed, - createNoRowsDiv: createNoRowsDiv, - createContentRows: createContentRows, - createContentRowsSumRow: createContentRowsSumRow, - createContentOneRow: createContentOneRow, - createContentOneRowForIE: createContentOneRowForIE, - repaintRow: repaintRow, - createContentOneRowTd: createContentOneRowTd, - createContentOneRowTdForIE: createContentOneRowTdForIE, - repairContent: repairContent - }; - -/***/ }, -/* 11 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var trHoverFun = function trHoverFun(index) { - var oThis = this; - $('#' + oThis.options.id + '_content_tbody').find('tr').removeClass('u-grid-move-bg'); - $('#' + oThis.options.id + '_content_fixed_tbody').find('tr').removeClass('u-grid-move-bg'); - if (oThis.options.multiSelect) $('#' + oThis.options.id + '_content_multiSelect').find('div').removeClass('u-grid-move-bg'); - if (oThis.options.showNumCol) $('#' + oThis.options.id + '_content_numCol').find('div').removeClass('u-grid-move-bg'); - if (index > -1) { - var $tr = $('#' + oThis.options.id + '_content_tbody').find('tr').eq(index); - if ($tr[0].id && $tr[0].id == oThis.options.id + '_edit_tr') { - return; - } - $('#' + oThis.options.id + '_content_tbody').find('tr').eq(index).addClass('u-grid-move-bg'); - $('#' + oThis.options.id + '_content_fixed_tbody').find('tr').eq(index).addClass('u-grid-move-bg'); - if (oThis.options.multiSelect) $('#' + oThis.options.id + '_content_multiSelect').find('div').eq(index).addClass('u-grid-move-bg'); - if (oThis.options.showNumCol) $('#' + oThis.options.id + '_content_numCol').find('div').eq(index).addClass('u-grid-move-bg'); - if (typeof oThis.options.onRowHover == 'function' && !$tr.is('.u-grid-content-sum-row')) { - var obj = {}; - obj.gridObj = oThis; - obj.rowObj = oThis.dataSourceObj.rows[index]; - obj.rowIndex = index; - oThis.options.onRowHover(obj); - } - } - }; - /* - * 定时器处理 - */ - var setIntervalFun = function setIntervalFun(e) { - this.widthChangeFun(); - this.heightChangeFun(); - this.editorRowChangeFun(); - }; - var editorRowChangeFun = function editorRowChangeFun() {}; - /* - * grid区域创建完成之后处理 - * 1、数据列显示处理 - * 2、取行高 - */ - var afterGridDivsCreate = function afterGridDivsCreate() { - if (this.showType != 'grid') return; - this.columnsVisibleFun(); - this.resetThVariable(); - this.countRowHeight(); - this.noRowsShowFun(); - this.renderTypeFun(); - this.resetScrollLeft(); - this.hideEditMenu(); - this.resetLeftHeight(); - this.isCheckedHeaderRow(); - if (typeof this.options.afterCreate == 'function') { - this.options.afterCreate.call(this); - } - }; - /* - * 取行高 - */ - var countRowHeight = function countRowHeight() { - if ($('#' + this.options.id + '_content_tbody tr')[0]) { - this.rowHeight = $('#' + this.options.id + '_content_tbody tr')[0].offsetHeight; - } - }; - - /** - * 根据内容区的高度调整左侧区域的高度 - */ - var resetLeftHeight = function resetLeftHeight() { - var self = this; - if (this.resetLeftHeightSetTimeout) clearTimeout(this.resetLeftHeightSetTimeout); - this.resetLeftHeightSetTimeout = setTimeout(function () { - resetLeftHeightFun.call(self); - }, 100); - }; - - var resetLeftHeightFun = function resetLeftHeightFun() { - if (this.options.showNumCol || this.options.multiSelect) { - var $trs = $('#' + this.options.id + '_content_tbody tr'); - var $leftNums = $('#' + this.options.id + '_content_numCol div'); - var $leftSelects = $('#' + this.options.id + '_content_multiSelect > div'); - for (var i = 0; i < $trs.length; i++) { - var nowRowHeight = $trs[i].offsetHeight; - if ($leftNums[i]) $leftNums[i].style.height = nowRowHeight + 'px'; - if ($leftSelects[i]) $leftSelects[i].style.height = nowRowHeight + 'px'; - } - } - }; - /* - * 处理是否显示无数据行 - */ - var noRowsShowFun = function noRowsShowFun() { - if (this.dataSourceObj.rows && this.dataSourceObj.rows.length > 0) { - $('#' + this.options.id + '_noRowsShow').css('display', 'none'); - $('#' + this.options.id + '_noRows').css('display', 'none'); - } else { - $('#' + this.options.id + '_noRowsShow').css('display', 'block'); - $('#' + this.options.id + '_noRows').css('display', 'block'); - } - }; - - /* - * grid区域重画完成之后处理,已经执行过afterGridDivsCreate - * 1、设置横向滚动条 - * 2、隐藏编辑按钮 - */ - var afterRepaintGrid = function afterRepaintGrid() { - this.resetScrollLeft(); - this.hideEditMenu(); - }; - /* - * 设置横向滚动条 - */ - var resetScrollLeft = function resetScrollLeft() { - if ($('#' + this.options.id + '_content_div')[0]) { - try { - $('#' + this.options.id + '_content_div')[0].scrollLeft = this.scrollLeft; - } catch (e) {} - } - }; - /* - * 隐藏编辑按钮 - */ - var hideEditMenu = function hideEditMenu() {}; - - var createCalFunOjb = exports.createCalFunOjb = { - trHoverFun: trHoverFun, - setIntervalFun: setIntervalFun, - editorRowChangeFun: editorRowChangeFun, - afterGridDivsCreate: afterGridDivsCreate, - countRowHeight: countRowHeight, - noRowsShowFun: noRowsShowFun, - afterRepaintGrid: afterRepaintGrid, - resetScrollLeft: resetScrollLeft, - hideEditMenu: hideEditMenu, - resetLeftHeight: resetLeftHeight - }; - -/***/ }, -/* 12 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /* - * 获取某列对应属性 - */ - var getColumnAttr = function getColumnAttr(attr, field) { - for (var i = 0; i < this.gridCompColumnArr.length; i++) { - if (this.gridCompColumnArr[i].options.field == field) { - return $(this.gridCompColumnArr[i].options).attr(attr); - } - } - return ""; - }; - /* - * 根据field获取gridcompColumn对象 - */ - var getColumnByField = function getColumnByField(field) { - for (var i = 0; i < this.gridCompColumnArr.length; i++) { - if (this.gridCompColumnArr[i].options.field == field) { - return this.gridCompColumnArr[i]; - } - } - return null; - }; - /* - * 获取column属于第几列 - */ - var getIndexOfColumn = function getIndexOfColumn(column) { - var index = -1; - for (var i = 0; i < this.gridCompColumnArr.length; i++) { - if (this.gridCompColumnArr[i] == column) { - index = i; - break; - } - } - return index; - }; - /* - * 获取column属于当前显示第几列 - */ - var getVisibleIndexOfColumn = function getVisibleIndexOfColumn(column) { - var index = -1; - var j = 0; - for (var i = 0; i < this.gridCompColumnArr.length; i++) { - if (this.gridCompColumnArr[i] == column) { - if (!($('#' + this.options.id + '_header').find('th').eq(i).css('display') == 'none')) { - index = j; - } - break; - } - if (!($('#' + this.options.id + '_header').find('th').eq(i).css('display') == 'none')) { - j++; - } - } - return index; - }; - /* - * 获取column后面第一个显示列所在第几列 - */ - var getNextVisibleInidexOfColumn = function getNextVisibleInidexOfColumn(column) { - var index = -1, - flag = false, - j = 0; - for (var i = 0; i < this.gridCompColumnArr.length; i++) { - if (this.gridCompColumnArr[i] == column) { - if (!($('#' + this.options.id + '_header').find('th').eq(i).css('display') == 'none')) { - - j++; - } - flag = true; - } - if (flag == true && !($('#' + this.options.id + '_header').find('th').eq(i).css('display') == 'none')) { - index = j; - break; - } - if (!($('#' + this.options.id + '_header').find('th').eq(i).css('display') == 'none')) { - - j++; - } - } - return index; - }; - - /* - * 获取选中行 - */ - var getSelectRows = function getSelectRows() { - return this.selectRows; - }; - /* - * 获取选中行对应行号 - */ - var getSelectRowsIndex = function getSelectRowsIndex() { - return this.selectRowsIndex; - }; - - /* - * 获取focus行 - */ - var getFocusRow = function getFocusRow() { - return this.focusRow; - }; - /* - * 获取focus行对应行号 - */ - var getFocusRowIndex = function getFocusRowIndex() { - return this.focusRowIndex; - }; - /* - * 获取所有行 - */ - var getAllRows = function getAllRows() { - var oThis = this; - this.allRows = new Array(); - if (this.dataSourceObj.rows) { - $.each(this.dataSourceObj.rows, function () { - oThis.allRows.push(this.value); - }); - } - return this.allRows; - }; - /* - * 根据行号获取row - */ - var getRowByIndex = function getRowByIndex(index) { - return this.dataSourceObj.rows[index]; - }; - /* - * 根据某个字段值获取rowIndex - */ - var getRowIndexByValue = function getRowIndexByValue(field, value) { - var index = -1; - $.each(this.dataSourceObj.rows, function (i) { - var v = $(this.value).attr(field); - if (v == value) { - index = i; - } - }); - return index; - }; - - var getChildRowIndex = function getChildRowIndex(row) { - var result = []; - $.each(row.childRow, function () { - result.push(this.valueIndex); - }); - return result; - }; - - var getColumnByVisibleIndex = function getColumnByVisibleIndex(index) { - var nowIndex = -1; - for (var i = 0; i < this.gridCompColumnArr.length; i++) { - var column = this.gridCompColumnArr[i]; - if (!($('#' + this.options.id + '_header').find('th').eq(i).css('display') == 'none')) { - nowIndex++; - } - if (nowIndex == index) { - return column; - } - } - return null; - }; - - var getFunObj = exports.getFunObj = { - getColumnAttr: getColumnAttr, - getColumnByField: getColumnByField, - getIndexOfColumn: getIndexOfColumn, - getVisibleIndexOfColumn: getVisibleIndexOfColumn, - getNextVisibleInidexOfColumn: getNextVisibleInidexOfColumn, - getSelectRows: getSelectRows, - getSelectRowsIndex: getSelectRowsIndex, - getFocusRow: getFocusRow, - getFocusRowIndex: getFocusRowIndex, - getAllRows: getAllRows, - getRowByIndex: getRowByIndex, - getRowIndexByValue: getRowIndexByValue, - getChildRowIndex: getChildRowIndex, - getColumnByVisibleIndex: getColumnByVisibleIndex - }; - -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.initFunObj = undefined; - - var _gridBrowser = __webpack_require__(5); - - var _dataSource = __webpack_require__(1); - - var _column = __webpack_require__(7); - - var _re_gridCompEdit = __webpack_require__(14); - - /* - * 处理参数 - */ - var init = function init(ele, options) { - this.dataSource = _dataSource.dataSource; - this.gridCompColumn = _column.column; - this.ele = ele[0]; - this.$ele = ele; - this.initDefault(); - this.options = $.extend({}, this.defaults, options); - this.getBooleanOptions(); - this.transDefault = { - ml_show_column: '显示/隐藏列', - ml_clear_set: '清除设置', - ml_no_rows: '无数据', - ml_sum: '合计:', - ml_close: '关闭' - }; - this.transMap = $.extend({}, this.transDefault, options.transMap); - this.gridCompColumnFixedArr = new Array(); - this.gridCompColumnArr = new Array(); // 存储设置默认值之后的columns对象 - // this.headerHeight = 45; // header区域高度 - this.countContentHeight = true; // 是否计算内容区的高度(是否为流式) - this.minColumnWidth = 80; // 最小列宽 - this.scrollBarHeight = 16; // 滚动条高度 - this.numWidth = this.options.numWidth || 40; // 数字列宽度 - this.multiSelectWidth = this.options.multiSelectWidth || 40; // 复选框列宽度 - - this.basicGridCompColumnArr = new Array(); // 存储基本的columns对象,用于清除设置 - this.columnMenuWidth = 160; // column menu的宽度 - this.columnMenuHeight = 33; // column menu的高度 - this.gridCompColumnFixedArr = new Array(); // 存储设置默认值之后的固定列columns对象 - this.gridCompLevelColumn = new Array(); // 存储多级表头时的多级 - this.baseHeaderHeight = 44; - this.headerHeight = this.baseHeaderHeight * parseInt(this.options.maxHeaderLevel) + 1; - this.gridCompHiddenLevelColumnArr = new Array(); // 存储自动隐藏时隐藏优先级排序后的column - this.treeLeft = 10; // 树表时每一级之间的差值 - this.overWidthVisibleColumnArr = new Array(); // 超出定义宽度的column集合 - }; - var getBooleanOptions = function getBooleanOptions() { - this.options.cancelFocus = this.getBoolean(this.options.cancelFocus); - this.options.showHeader = this.getBoolean(this.options.showHeader); - this.options.showNumCol = this.getBoolean(this.options.showNumCol); - this.options.multiSelect = this.getBoolean(this.options.multiSelect); - this.options.columnMenu = this.getBoolean(this.options.columnMenu); - this.options.canDrag = this.getBoolean(this.options.canDrag); - this.options.overWidthHiddenColumn = this.getBoolean(this.options.overWidthHiddenColumn); - this.options.sortable = this.getBoolean(this.options.sortable); - this.options.showSumRow = this.getBoolean(this.options.showSumRow); - this.options.canSwap = this.getBoolean(this.options.canSwap); - this.options.showTree = this.getBoolean(this.options.showTree); - this.options.autoExpand = this.getBoolean(this.options.autoExpand); - this.options.needTreeSort = this.getBoolean(this.options.needTreeSort); - this.options.needLocalStorage = this.getBoolean(this.options.needLocalStorage); - this.options.noScroll = this.getBoolean(this.options.noScroll); - this.options.cancelSelect = this.getBoolean(this.options.cancelSelect); - this.options.contentSelect = this.getBoolean(this.options.contentSelect); - this.options.contentFocus = this.getBoolean(this.options.contentFocus); - }; - /* - * 初始化默认参数 - */ - var initDefault = function initDefault() { - this.defaults = { - id: new Date().valueOf(), - editType: 'default', - cancelFocus: true, // 第二次点击是否取消focus - cancelSelect: true, // 第二次点击是否取消select - showHeader: true, // 是否显示表头 - showNumCol: false, // 是否显示数字列 - multiSelect: false, // 是否显示复选框 - columnMenu: true, // 是否存在列头操作按钮 - canDrag: true, // 是否可以拖动 - // formMaxWidth: 300, // 整体宽度小于某一值之后以form展示 - formMaxWidth: 0, - maxHeaderLevel: 1, // header的最高层级,用于计算header区域的高度 - overWidthHiddenColumn: false, // 宽度不足时是否自动隐藏column - sortable: true, // 是否可以排序 - showSumRow: false, // 是否显示合计行 - canSwap: true, // 是否可以交换列位置 - showTree: false, // 是否显示树表 - autoExpand: true, // 是否默认展开 - needTreeSort: false, // 是否需要对传入数据进行排序,此设置为优化性能,如果传入数据是无序的则设置为true,如果可以保证先传入父节点后传入子节点则设置为false提高性能 - needLocalStorage: false, // 是否使用前端缓存 - noScroll: false, // 是否显示滚动条,宽度设置百分比的话不显示滚动条 - contentSelect: true, // 点击内容区是否执行选中逻辑 - showEditIcon: false, // 是否显示编辑图标 - contentFocus: true, // 点击内容区是否执行focus逻辑 - fixedFloat: 'left' - }; - }; - /* - * 创建grid - */ - var initGrid = function initGrid() { - if (!this.options.columns || this.options.columns.length == 0) { - return; - } - var oThis = this; - this.initOptions(); - this.initVariable(); - this.initWidthVariable(); - this.initGridCompColumn(); - this.initDataSource(); - this.createDivs(); - // UAP-NC 轻量化项目:切换tab时添加form会消失问题 - this.inte = setInterval(function () { - oThis.setIntervalFun.call(oThis); - }, 300); - }; - /* - * 销毁自身 - */ - var destroySelf = function destroySelf() { - clearInterval(this.inte); - this.$ele.data('gridComp', null); - this.ele.innerHTML = ''; - this.showTree = ''; - this.showType = ''; - }; - /* - * 对传入参数进行格式化处理 - * 宽度、高度处理 - * 左侧区域宽度计算 - * 除去内容区域的高度 - */ - var initOptions = function initOptions() { - this.options.width = this.formatWidth(this.options.width); - this.options.height = this.formatWidth(this.options.height); - if (this.options.height == '100%' || !this.options.height) { - this.countContentHeight = false; - } - this.initOptionsTree(); - this.leftW = 0; // 左侧区域宽度(数字列复选框等) - if (this.options.showNumCol) { - this.leftW += this.numWidth; - } - if (this.options.multiSelect) { - this.leftW += this.multiSelectWidth; - } - this.exceptContentHeight = 0; // 内容区域之外的高度 - if (this.options.showHeader) { - this.exceptContentHeight += this.headerHeight; - } - this.fixedWidth = 0; - if (this.options.maxHeaderLevel > 1) { - this.options.canSwap = false; - } - // 获取缓存id - var url = window.location.href; - var index = url.indexOf('?'); - if (index > 0) { - url = url.substring(0, index); - } - this.localStorageId = this.options.id + url; - }; - var initOptionsTree = function initOptionsTree() {}; - /* - * 初始化变量 - */ - var initVariable = function initVariable() { - this.initDataSourceVariable(); - // 鼠标点击移动时位置记录 - this.mouseUpX = 'mouseUpX'; - this.mouseUpY = 'mouseUpY'; - this.mouseDownX = 'mouseDownX'; - this.mouseDownY = 'mouseDownY'; - this.mouseMoveX = 'mouseMoveX'; - this.mouseMoveY = 'mouseMoveY'; - this.scrollLeft = 0; // 记录横向滚动条 - this.scrollTop = 0; // 记录纵向滚动条 - this.showType = ''; // 记录grid显示方式,form和grid - this.createGridFlag = false; // 是否已经创建grid展示 - this.columnClickX = 0; // 点击处的X坐标 - this.columnClickY = 0; // 点击处的Y坐标 - this.columnMenuMove = false; // 是否在column menu区域移动 - this.firstColumn = true; // 用于记录是否已经存在第一列,true表示还没有,false表示已经存在 - this.lastVisibleColumn = null; - this.lastVisibleColumnWidth = 0; - this.columnMenuMove = false; // 是否在column menu区域移动 - this.createColumnMenuFlag = false; // 是否已经创建column menu 区域 - this.menuColumnsHeight = 0; - this.createFormFlag = false; // 是否已经创建form展示 - this.$sd_storageData = null; // 本地缓存内容为object - }; - /* - * 初始化datasource相关变量 - */ - var initDataSourceVariable = function initDataSourceVariable() { - this.selectRows = new Array(); - this.selectRowsObj = new Array(); - this.selectRowsIndex = new Array(); - this.allRows = new Array(); - this.eidtRowIndex = -1; // 当前修改行 - }; - - // 初始化宽度相关变量 - var initWidthVariable = function initWidthVariable() { - // 计算用变量 - this.wholeWidth = 0; // 整体宽度 - this.wholeHeight = 0; // 整体高度 - this.rowHeight = 0; // 数据行高度 - this.contentRealWidth = 0; // 内容区真实宽度,严格按照设置的width计算的宽度 - this.contentWidth = 0; // 内容区宽度,自动扩展之后的宽度 - this.contentMinWidth = 0; // 内容区最小宽度,即可视宽度 - this.contentHeight = 0; //内容区高度 - this.fixedRealWidth = 0; // 固定区域真实宽度 - this.fixedWidth = 0; // 固定区域宽度 - }; - /* - * 创建gridCompColumn对象方便后续处理 - */ - var initGridCompColumn = function initGridCompColumn() { - var oThis = this; - this.initGridCompColumnVar(); - if (this.options.columns) { - $.each(this.options.columns, function (i) { - oThis.initGridCompColumnFun(this); - }); - } - this.initGridCompColumnLoacl(); - this.initGridHiddenLevelColumn(); - this.initGridCompFixedColumn(); - this.columnsVisibleFun(); - }; - var initGridCompColumnVar = function initGridCompColumnVar() { - this.gridCompColumnArr = new Array(); - this.basicGridCompColumnArr = new Array(); - this.gridCompColumnFixedArr = new Array(); - this.gridCompLevelColumn = new Array(); - this.gridCompHiddenLevelColumnArr = new Array(); - }; - var initGridCompColumnFun = function initGridCompColumnFun(columnOptions) { - var column = new _column.column(columnOptions, this); - // 如果可编辑增加修改图标 - this.editHeadTitleIcon(column); - var widthStr = column.options.width + ''; - if (widthStr.indexOf("%") > 0) { - this.options.noScroll = 'true'; - } else { - column.options.width = parseInt(column.options.width); - } - column.options.optionsWidth = column.options.width; - column.options.realWidth = column.options.width; - this.gridCompColumnArr.push(column); - this.initGridCompColumnColumnMenuFun(columnOptions); - this.initGridCompColumnHeaderLevelFun(columnOptions); - }; - var initGridCompColumnColumnMenuFun = function initGridCompColumnColumnMenuFun(columnOptions) {}; - var initGridCompColumnHeaderLevelFun = function initGridCompColumnHeaderLevelFun(columnOptions) {}; - var initGridCompColumnLoacl = function initGridCompColumnLoacl(columnOptions) {}; - var initGridHiddenLevelColumn = function initGridHiddenLevelColumn() {}; - var initGridCompFixedColumn = function initGridCompFixedColumn() {}; - /* - * 设置某列是否必输 - */ - var setRequired = function setRequired(field, value) {}; - /* - * 创建dataSource对象方便后续处理 - */ - var initDataSource = function initDataSource() { - var oThis = this; - this.dataSourceObj = new _dataSource.dataSource(this.options.dataSource, this); - }; - var initFunObj = exports.initFunObj = { - init: init, - getBooleanOptions: getBooleanOptions, - initDefault: initDefault, - initGrid: initGrid, - destroySelf: destroySelf, - initOptions: initOptions, - initOptionsTree: initOptionsTree, - initVariable: initVariable, - initDataSourceVariable: initDataSourceVariable, - initWidthVariable: initWidthVariable, - initGridCompColumn: initGridCompColumn, - initGridCompColumnVar: initGridCompColumnVar, - initGridCompColumnFun: initGridCompColumnFun, - initGridCompColumnColumnMenuFun: initGridCompColumnColumnMenuFun, - initGridCompColumnHeaderLevelFun: initGridCompColumnHeaderLevelFun, - initGridCompColumnLoacl: initGridCompColumnLoacl, - initGridHiddenLevelColumn: initGridHiddenLevelColumn, - initGridCompFixedColumn: initGridCompFixedColumn, - setRequired: setRequired, - initDataSource: initDataSource - }; - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.eidtFunObj = undefined; - - var _gridCompEvent = __webpack_require__(4); - - var _gridBrowser = __webpack_require__(5); - - var re_hideEditMenu = function re_hideEditMenu() { - $('#' + this.options.id + '_content_edit_menu').css('display', 'none'); - }; - - var re_clickFunEdit = function re_clickFunEdit(e, index) { - var $tr = $(e.target).closest('tr'); - var $td = $(e.target).closest('td'); - var colIndex = $td.index(); - if (this.options.editable && (this.eidtRowIndex != index || this.options.editType == 'default' && this.editColIndex != colIndex)) { - this.editClose(); - this.editRowFun($tr, colIndex); - } - }; - - var editRowFun = function editRowFun($tr, colIndex) { - var index = this.getTrIndex($tr); - if (typeof this.options.onBeforeEditFun == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[index]; - obj.rowIndex = index; - obj.colIndex = colIndex; - obj.$tr = $tr; - if (!this.options.onBeforeEditFun(obj)) { - if (this.eidtRowIndex != -1) { - this.editClose(); - } - return; - } - } - if (this.eidtRowIndex != -1) { - this.editClose(); - } - var index = typeof $tr === 'number' ? $tr : this.getTrIndex($tr); - this.eidtRowIndex = index; - this.editColIndex = colIndex; - this.editRow($tr, colIndex); - return true; - }; - var editRowIndexFun = function editRowIndexFun(i) { - if (this.eidtRowIndex != -1) { - this.editClose(); - } - this.eidtRowIndex = i; - this.editColIndex = 0; - this.editRow(); - }; - /* - * 创建编辑行 - */ - var editRow = function editRow($tr, colIndex) { - if (colIndex < 0) return; - var oThis = this; - var isFixedCol = false; - if ($tr && $tr.parents('table').attr('id').indexOf('_fixed_') > -1) isFixedCol = true; - $tr = $tr || $('#' + this.options.id + '_content_tbody tr[role="row"]:eq(' + this.eidtRowIndex + ')'); - colIndex = colIndex || 0; - var row = this.dataSourceObj.rows[this.eidtRowIndex].value; - this.editRowObj = this.cloneObj(row); - if (this.options.editType == 'default') { - var column = isFixedCol ? this.gridCompColumnFixedArr[colIndex] : this.gridCompColumnArr[colIndex]; - if (column.options.editable) { - var td = $('td:eq(' + colIndex + ')', $tr)[0]; - var field = column.options.field; - var value = $(row).attr(field); - value = oThis.getString(value, ''); - var obj = {}; - obj.td = td; - obj.value = value; - obj.field = field; - obj.editType = column.options.editType; - obj.rowObj = oThis.editRowObj; - obj.$tr = $tr; - obj.colIndex = colIndex; - oThis.editCell(obj); - } - $('#' + this.options.id + '_content_edit_menu').css('display', 'block'); - $('#' + this.options.id + '_content_edit_menu_cancel').css('marginLeft', '10px'); // 与form形式相比偏左 - var topIndex = $('tr:visible', $tr.parent()).index($tr); - this.rowHeight = $tr.height(); // tianxq - var t = this.rowHeight * (topIndex + 1) + this.headerHeight + 1; - } else if (this.options.editType == 'form') { - if (typeof this.options.formEditRenderFun == 'function') { - if (this.fixedWidth > 0) { - var table = $('#' + this.options.id + '_content_fixed_table')[0]; - } else { - var table = $('#' + this.options.id + '_content_table')[0]; - } - - var tr = table.insertRow(this.eidtRowIndex + 2); - tr.id = this.options.id + '_edit_tr'; - $(tr).addClass('grid_edit_form_tr'); - var cell = tr.insertCell(); - cell.id = this.options.id + '_edit_td'; - $(cell).addClass('grid_edit_form_td'); - cell.style.borderBottom = '0px'; - cell.style.background = '#fff'; - var cWidth = parseInt(this.contentMinWidth) + parseInt(this.fixedWidth); - var htmlStr = '
'; - htmlStr += '
'; - cell.innerHTML = htmlStr; - var obj = {}; - obj.grid = gridObj; - obj.element = $('#' + this.options.id + '_edit_form')[0]; - obj.editRowObj = this.editRowObj; - this.options.formEditRenderFun.call(this, obj); - var htmlStr = '
'; - $('#' + this.options.id + '_edit_form')[0].insertAdjacentHTML('beforeEnd', htmlStr); - var h = $('#' + this.options.id + '_edit_td')[0].offsetHeight; - var color = $('#' + this.options.id + '_edit_form').css('background-color'); - if (this.options.multiSelect) { - var $div = $('#' + this.options.id + '_content_multiSelect > div').eq(this.eidtRowIndex); - var htmlStr = '
'; - $div[0].insertAdjacentHTML('afterEnd', htmlStr); - } - if (this.options.showNumCol) { - var $div = $('#' + this.options.id + '_content_numCol > .u-grid-content-num').eq(this.eidtRowIndex); - var htmlStr = '
'; - $div[0].insertAdjacentHTML('afterEnd', htmlStr); - } - $('#' + this.options.id + '_content_edit_menu').css('display', 'block'); - - if (this.fixedWidth > 0) { - var table1 = $('#' + this.options.id + '_content_table')[0]; - var tr1 = table1.insertRow(this.eidtRowIndex + 2); - tr1.id = this.options.id + '_edit_tr1'; - } - } else { - if (this.fixedWidth > 0) { - var table = $('#' + this.options.id + '_content_fixed_table')[0]; - } else { - var table = $('#' + this.options.id + '_content_table')[0]; - } - - var tr = table.insertRow(this.eidtRowIndex + 2); - tr.id = this.options.id + '_edit_tr'; - $(tr).addClass('grid_edit_form_tr'); - var cell = tr.insertCell(); - cell.id = this.options.id + '_edit_td'; - $(cell).addClass('grid_edit_form_td'); - cell.style.borderBottom = '0px'; - var cWidth = parseInt(this.contentMinWidth) + parseInt(this.fixedWidth); - var htmlStr = '
'; - $.each(this.gridCompColumnFixedArr, function (i) { - var show = false; - if (this.options.editFormShow && (this.options.editable || !this.options.editable && oThis.options.noneEditableFormShow)) { - show = true; - } - - if (show) { - var field = this.options.field; - var value = $(row).attr(field); - value = oThis.getString(value, ''); - var title = this.options.title; - var headerColor = this.options.headerColor; - htmlStr += oThis.formEditCell(value, field, title, this.options.required, headerColor); - } - }); - - $.each(this.gridCompColumnArr, function (i) { - var show = false; - if (this.options.editFormShow && (this.options.editable || !this.options.editable && oThis.options.noneEditableFormShow)) { - show = true; - } - - if (show) { - var field = this.options.field; - var value = $(row).attr(field); - value = oThis.getString(value, ''); - var title = this.options.title; - var headerColor = this.options.headerColor; - htmlStr += oThis.formEditCell(value, field, title, this.options.required, headerColor); - } - }); - htmlStr += '
'; - cell.innerHTML = htmlStr; - - $.each(this.gridCompColumnFixedArr, function (i) { - var show = false; - if (this.options.editFormShow && (this.options.editable || !this.options.editable && oThis.options.noneEditableFormShow)) { - show = true; - } - - if (show) { - var field = this.options.field; - var td = $('#' + oThis.options.id + '_edit_' + field)[0]; - var value = $(row).attr(field); - var title = this.options.title; - value = oThis.getString(value, ''); - var obj = {}; - obj.td = td; - td.innerHTML = '
'; - obj.value = value; - obj.field = field; - obj.editType = this.options.editType; - obj.rowObj = oThis.editRowObj; - obj.$tr = $tr; - obj.colIndex = colIndex; - htmlStr += oThis.editCell(obj); - } - }); - - $.each(this.gridCompColumnArr, function (i) { - var show = false; - if (this.options.editFormShow && (this.options.editable || !this.options.editable && oThis.options.noneEditableFormShow)) { - show = true; - } - - if (show) { - var field = this.options.field; - var td = $('#' + oThis.options.id + '_edit_' + field)[0]; - var value = $(row).attr(field); - var title = this.options.title; - value = oThis.getString(value, ''); - var obj = {}; - obj.td = td; - td.innerHTML = '
'; - obj.value = value; - obj.field = field; - obj.editType = this.options.editType; - obj.rowObj = oThis.editRowObj; - obj.$tr = $tr; - obj.colIndex = colIndex; - htmlStr += oThis.editCell(obj); - } - }); - - if (typeof this.options.renderEditMemu == "function") { - - this.options.renderEditMemu.apply(this, [$('#' + this.options.id + '_edit_form')[0], this.eidtRowIndex, this.dataSourceObj.rows.length]); - } else { - var htmlStr = '
'; - - $('#' + this.options.id + '_edit_form')[0].insertAdjacentHTML('beforeEnd', htmlStr); - $('#' + this.options.id + '_content_edit_menu_close').on('click', function (e) { - oThis.editClose(); - }); - } - // 处理左侧区域位置 - var h = $('#' + this.options.id + '_edit_td')[0].offsetHeight; - var color = $('#' + this.options.id + '_edit_form').css('background-color'); - if (this.options.multiSelect) { - var $div = $('#' + this.options.id + '_content_multiSelect > div').eq(this.eidtRowIndex); - var htmlStr = '
'; - $div[0].insertAdjacentHTML('afterEnd', htmlStr); - } - if (this.options.showNumCol) { - var $div = $('#' + this.options.id + '_content_numCol > .u-grid-content-num').eq(this.eidtRowIndex); - var htmlStr = '
'; - $div[0].insertAdjacentHTML('afterEnd', htmlStr); - } - $('#' + this.options.id + '_content_edit_menu').css('display', 'block'); - - if (this.fixedWidth > 0) { - var table1 = $('#' + this.options.id + '_content_table')[0]; - var tr1 = table1.insertRow(this.eidtRowIndex + 2); - tr1.id = this.options.id + '_edit_tr1'; - } - } - } - }; - /* - * 行编辑关闭 - */ - var re_editClose = function re_editClose() { - var dohideFlag = true; //标记是否执行过hide、blur事件 - if (this.eidtRowIndex < 0) return; - var row = this.dataSourceObj.rows[this.eidtRowIndex]; - var inputDom = null; - //在chrome下 - // if (dohideFlag && this.editComp && this.editComp.hide) { - // this.editComp.hide(); - // dohideFlag = false; - // } - - // try { - // var inputDom = this.editComp.element.parentNode.querySelector('input'); - // } catch (e) {} - - // if (dohideFlag && inputDom) { - // inputDom.blur(); - // dohideFlag = false; - // } - - // if (dohideFlag && this.editComp && this.editComp.comp && this.editComp.comp.hide) { - // this.editComp.comp.hide(); - // dohideFlag = false; - // } - // 按理说应该是使用dohideFlag做为标志,调用hide方法就不走blur(即上面注释那段)。但是为了兼容ie在第一行输入‘32424’,点击第二行,在回到一行就不可输入了 - if (this.editComp && this.editComp.hide) { - this.editComp.hide(); - dohideFlag = false; - } - - try { - var inputDom = this.editComp.element.parentNode.querySelector('input'); - } catch (e) {} - - if (inputDom) { - inputDom.blur(); - dohideFlag = false; - } - - if (this.editComp && this.editComp.comp && this.editComp.comp.hide) { - this.editComp.comp.hide(); - dohideFlag = false; - } - try { - $('#' + this.options.id + '_placeholder_div').remove(); - } catch (e) {} - - if (!row) return; - if (this.options.editType != 'form') { - //this.repaintRow(this.eidtRowIndex); - var obj = {}; - obj.begin = this.eidtRowIndex; - obj.length = 1; - this.renderTypeFun(obj); - } - - $('#' + this.options.id + '_content_edit_menu').css('display', 'none'); - this.repairSumRow(); - this.noRowsShowFun(); - this.updateLastRowFlag(); - this.eidtRowIndex = -1; - // form形式删除对应区域,存在切换编辑形式的情况,所以一直删除 - // if(this.options.editType == 'form'){ - $('#' + this.options.id + '_multiSelect_edit').remove(null, true); - $('#' + this.options.id + '_numCol_edit').remove(null, true); - $('#' + this.options.id + '_edit_tr').remove(null, true); - $('#' + this.options.id + '_edit_tr1').remove(null, true); - // } - }; - /* - * 编辑单元格 - */ - var editCell = function editCell(obj) { - var td = obj.td; - var value = obj.value; - var field = obj.field; - var editType = obj.editType; - var rowObj = obj.rowObj; - var $tr = obj.$tr; - var colIndex = obj.colIndex; - var oThis = this; - if (obj.colIndex == 0) { - try { - this.iconSpan = ''; - this.iconSpan = $(td).find('.uf')[0].outerHTML; - } catch (e) {} - } else { - this.iconSpan = ''; - } - - var obj = {}; - obj.td = td; - obj.field = field; - obj.$tr = $tr; - obj.colIndex = colIndex; - oThis.newEditObj = obj; - - if (editType == 'text') { - if (this.options.editType == 'default') { - td.innerHTML = '
'; - } else { - td.innerHTML = '
'; - } - $('input', $(td)).on('blur', function () { - oThis.editValueChange(field, this.value); - }); - } else if (typeof editType == 'function') { - var obj = {}; - var $Div = $('.u-grid-content-td-div', $(td)); - $Div.removeClass('u-grid-content-td-div-over'); - obj.gridObj = this; - obj.element = $Div[0]; - if (this.options.editType == 'default') { - // 对于高度被撑开的情况需要放一个 div来把整体撑开 - var nowHeight = obj.element.offsetHeight; - var editDivHtml = '
'; - $Div[0].innerHTML = editDivHtml; - obj.element = $('#' + this.options.id + '_placeholder_div')[0]; - } - obj.value = value; - obj.field = field; - obj.rowObj = rowObj; - editType.call(this, obj); - } - // input输入blur时显示下一个编辑控件 - $('input', $(td)).off('keydown'); - $('input', $(td)).on('keydown', function (e) { - if (oThis.options.editType == 'form') {} else { - var keyCode = e.keyCode; - if (e.keyCode == 13 || e.keyCode == 9) { - // 回车 - this.blur(); //首先触发blur来将修改值反应到datatable中 - // IE11会导致先触发nextEditShow后触发blur的处理 - setTimeout(function () { - oThis.nextEditShow(); - }, 100); - u.stopEvent(e); - } - } - }); - if (this.options.editType == 'default') $('input:first', $(td)).focus(); - }; - /* - * 触发下一个编辑单元格 - */ - var nextEditShow = function nextEditShow() { - var obj = this.newEditObj; - var td = obj.td; - var $tr = obj.$tr; - var colIndex = parseInt(obj.colIndex) + 1; - // 如果是最后一列则换行 - if ($(td).next('td').length == 0) { - var $nextTr = $tr.next('tr'); - if ($nextTr.length > 0) { - $tr = $nextTr; - colIndex = 0; - $tr.click(); //触发下一行的焦点 - } else { - return; - } - } - - colIndex = _getNextEditColIndex(this, colIndex, $tr); - this.editRowFun($tr, colIndex); - }; - - var _getNextEditColIndex = function _getNextEditColIndex(gridObj, nowIndex, $tr) { - // 如果下一列为隐藏/不可修改/复选框则跳到下一个 - var colIndex = -1; - var column = gridObj.gridCompColumnArr[nowIndex]; - var beforeFlag = true; - var index = gridObj.getTrIndex($tr); - if (typeof gridObj.options.onBeforeEditFun == 'function') { - var obj = {}; - obj.gridObj = gridObj; - obj.rowObj = gridObj.dataSourceObj.rows[index]; - obj.rowIndex = index; - obj.colIndex = nowIndex; - obj.$tr = $tr; - if (!gridObj.options.onBeforeEditFun(obj)) { - beforeFlag = false; - } - } - if (!column.options.visible || !column.options.editable || !beforeFlag) { - colIndex = _getNextEditColIndex(gridObj, nowIndex + 1, $tr); - } else { - colIndex = nowIndex; - } - return colIndex; - }; - var editValueChange = function editValueChange(field, value) { - // 设置row的值为新值 - if (this.eidtRowIndex > -1 && this.eidtRowIndex < this.dataSourceObj.rows.length) { - this.updateValueAt(this.eidtRowIndex, field, value); - } - }; - var re_updateEditRowIndex = function re_updateEditRowIndex(opType, opIndex, num) { - if (this.eidtRowIndex < 0) return; - if (opType == '-') { - if (opIndex < this.eidtRowIndex) { - this.eidtRowIndex--; - } else if (opIndex == this.eidtRowIndex) { - this.eidtRowIndex = -1; - } - } else if (opType == '+') { - num === undefined && (num = 1); - if (opIndex <= this.eidtRowIndex) { - this.eidtRowIndex += num; - } - } - }; - var re_updateValueAtEdit = function re_updateValueAtEdit(rowIndex, field, value, force) { - if (this.eidtRowIndex == rowIndex) { - if (this.options.editType == 'form') {} else { - if (this.gridCompColumnArr[this.editColIndex].options.field == field) this.eidtRowIndex = -1; //下拉选中之后eidtRowIndex依然为原来的值,后续需要判断修改列 - } - - if ($('#' + this.options.id + "_edit_field_" + field).length > 0) { - if ($('#' + this.options.id + "_edit_field_" + field)[0].type == 'checkbox') { - if (value == 'Y' || value == 'true' || value === true) { - $('#' + this.options.id + "_edit_field_" + field)[0].checked = true; - } else { - $('#' + this.options.id + "_edit_field_" + field)[0].checked = false; - } - } else { - $('#' + this.options.id + "_edit_field_" + field)[0].value = value; - } - } - } - }; - /* - * 根据filed设置editType - */ - var setEditType = function setEditType(field, editType) { - var gridCompColumn = this.getColumnByField(field); - gridCompColumn.options.editType = editType; - }; - /* - * 设置是否可修改 - */ - var setEditable = function setEditable(editable) { - this.options.editable = editable; - this.setColumnEdit(); - this.editClose(); - }; - - var setColumnEdit = function setColumnEdit() { - var i; - for (i = 0; i < this.gridCompColumnArr.length; i++) { - - this.editFieldIcon(this.gridCompColumnArr[i]); - } - - for (i = 0; i < this.gridCompColumnFixedArr.length; i++) { - - this.editFieldIcon(this.gridCompColumnFixedArr[i]); - } - }; - - var editFieldIcon = function editFieldIcon(column) { - var fieldDom = $('.u-grid-header-link[field=' + column.options.field + ']'); - var fieldEditIconDom = fieldDom.find('.uf-fontselectioneditor'); - if (this.options.showEditIcon && this.options.editable && column.options.editable) { - - if (!fieldEditIconDom) { - fieldDom.append(''); - } - fieldDom.removeClass('u-grid-hide-title-icon'); - } else { - fieldDom.addClass('u-grid-hide-title-icon'); - } - }; - - var edit_initEventFun = function edit_initEventFun() { - var oThis = this; - $(document).on('click', function (e) { - if (oThis.options.editable && oThis.options.editType == 'default') { - var $e = $(e.target); - var flag = true; - flag = $(e.target).closest('.u-grid-content-td-div').length > 0 ? false : flag; - var cusStr = oThis.options.customEditPanelClass; - if (cusStr) { - var cArr = cusStr.split(','); - $.each(cArr, function () { - flag = $e.closest('.' + this).length > 0 ? false : flag; - }); - } - if ($e.attr('role') == 'grid-for-edit') { - flag = false; - } - if (flag) { - oThis.editClose(); - } - } - }); - - u.on(document, 'scroll', function () { - if (oThis.options.editType == 'default') { - if (_gridBrowser.gridBrowser.isIE10 || _gridBrowser.gridBrowser.isIPAD) {} else { - oThis.editClose(); - } - } - }); - // 为所有div添加监听,滚动时执行editClose - $('div').on('scroll', function () { - if (oThis.options.editType == 'default') { - if (_gridBrowser.gridBrowser.isIE10 || _gridBrowser.gridBrowser.isIPAD) {} else { - oThis.editClose(); - } - } - }); - }; - var setGridEditType = function setGridEditType(newEditType) { - this.options.editType = newEditType; - }; - var setGridEditTypeAndEditRow = function setGridEditTypeAndEditRow(newEditType, rowIndex, colIndex) { - this.options.editType = newEditType; - var $contentBody = $('#' + this.options.id + '_content_tbody'); - var $tr = $('tr:eq(' + rowIndex + ')', $contentBody); - this.editRowFun($tr, colIndex); - }; - - // 如果可编辑增加修改图标 - var editHeadTitleIcon = function editHeadTitleIcon(column) { - - if (this.options.showEditIcon && this.options.editable && column.options.editable) { - column.options.title += ''; - } - }; - - var eidtFunObj = exports.eidtFunObj = { - hideEditMenu: re_hideEditMenu, - clickFunEdit: re_clickFunEdit, - editRowFun: editRowFun, - editRowIndexFun: editRowIndexFun, - editRow: editRow, - editClose: re_editClose, - editCell: editCell, - nextEditShow: nextEditShow, - editValueChange: editValueChange, - updateEditRowIndex: re_updateEditRowIndex, - updateValueAtEdit: re_updateValueAtEdit, - setEditType: setEditType, - setEditable: setEditable, - setColumnEdit: setColumnEdit, - editFieldIcon: editFieldIcon, - setGridEditType: setGridEditType, - setGridEditTypeAndEditRow: setGridEditTypeAndEditRow, - editHeadTitleIcon: editHeadTitleIcon, - edit_initEventFun: edit_initEventFun - }; - -/***/ }, -/* 15 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /* - 重新结算是否选中header第一行 - */ - - var isCheckedHeaderRow = function isCheckedHeaderRow() { - if (this.selectRows.length !== 0 && this.selectRows.length == this.dataSourceObj.rows.length) { - //修改全选标记为false - $('#' + this.options.id + '_header_multi_input').addClass('is-checked'); - } else { - $('#' + this.options.id + '_header_multi_input').removeClass('is-checked'); - } - }; - /* - * 添加一行 - */ - var addOneRow = function addOneRow(row, index) { - var oThis = this, - displayFlag = 'none', - rowObj = {}, - parentIndex, - parentChildLength = 0, - l = this.dataSourceObj.rows.length, - endFlag = false; - rowObj.value = row, displayFlag; - - var treeObj = this.addOneRowTree(row, index, rowObj); - index = treeObj.index; - displayFlag = treeObj.displayFlag; - if (index != 0) { - if (index && index > 0) { - if (l < index) index = l; - } else { - index = 0; - } - } - if (l == index) { - endFlag = true; - } - rowObj.valueIndex = index; - rowObj.value = row; - this.dataSourceObj.rows.splice(index, 0, rowObj); - // 如果是在中间插入需要将后续的valueIndex + 1; - if (this.dataSourceObj.rows.length > index + 1) { - $.each(this.dataSourceObj.rows, function (i) { - if (i > index) { - this.valueIndex = this.valueIndex + 1; - } - }); - } - - // 需要重新排序重置变量 - var l = 0; - if (this.options.showTree) { - if (this.dataSourceObj.options.values) { - l = this.dataSourceObj.options.values.length; - } else { - this.dataSourceObj.options.values = new Array(); - } - this.dataSourceObj.options.values.splice(index, 0, row); - this.addOneRowTreeHasChildF(rowObj); - } else { - if (this.dataSourceObj.options.values) {} else { - this.dataSourceObj.options.values = new Array(); - } - this.dataSourceObj.options.values.splice(index, 0, row); - } - - if (this.showType == 'grid') { - //只有grid展示的时候才处理div,针对隐藏情况下还要添加数据 - this.editClose(); - - this.updateEditRowIndex('+', index); - try { - var htmlStr = this.createContentOneRow(rowObj, 'normal', displayFlag); - if (endFlag) { - $('#' + this.options.id + '_content_tbody')[0].insertAdjacentHTML('beforeEnd', htmlStr); - } else { - var $$tr = $('#' + this.options.id + '_content_tbody').find('tr[role="row"]')[index]; - var $$tbody = $('#' + this.options.id + '_content_tbody')[0]; - if ($$tr) $$tr.insertAdjacentHTML('beforeBegin', htmlStr);else if ($$tbody) $$tbody.insertAdjacentHTML('afterBegin', htmlStr); - } - if ($('#' + this.options.id + '_content_fixed_div').length > 0) { - var htmlStr = this.createContentOneRow(rowObj, 'fixed', displayFlag); - if (endFlag) { - $('#' + this.options.id + '_content_fixed_tbody')[0].insertAdjacentHTML('beforeEnd', htmlStr); - } else { - var $$tr = $('#' + this.options.id + '_content_fixed_tbody').find('tr[role="row"]')[index]; - if ($$tr) $$tr.insertAdjacentHTML('beforeBegin', htmlStr);else if ($('#' + this.options.id + '_content_fixed_tbody')[0]) $('#' + this.options.id + '_content_fixed_tbody')[0].insertAdjacentHTML('afterBegin', htmlStr); - } - } - } catch (e) { - //IE情况下 - var table = $('#' + this.options.id + '_content_div table')[0]; - if (table) this.createContentOneRowForIE(table, index, rowObj, 'normal', displayFlag); - var fixedTable = $('#' + this.options.id + '_content_fixed_div table')[0]; - if (fixedTable) this.createContentOneRowForIE(fixedTable, index, rowObj, 'fixed', displayFlag); - } - if (this.options.multiSelect) { - var htmlStr = this.createContentLeftMultiSelectRow(rowObj, displayFlag); - if (endFlag) { - $('#' + this.options.id + '_content_multiSelect')[0].insertAdjacentHTML('beforeEnd', htmlStr); - } else { - var $$div = $('#' + this.options.id + '_content_multiSelect').find('div')[index]; - if ($$div) $$div.insertAdjacentHTML('beforeBegin', htmlStr);else $('#' + this.options.id + '_content_multiSelect')[0].insertAdjacentHTML('afterBegin', htmlStr); - } - } - if (this.options.showNumCol) { - var htmlStr = this.createContentLeftNumColRow(l, row); - if (endFlag) { - $('#' + this.options.id + '_content_numCol')[0].insertAdjacentHTML('beforeEnd', htmlStr); - } else { - var $$div = $('#' + this.options.id + '_content_numCol').find('div')[index]; - if ($$div) $$div.insertAdjacentHTML('beforeBegin', htmlStr);else $('#' + this.options.id + '_content_numCol')[0].insertAdjacentHTML('afterBegin', htmlStr); - } - this.resetNumCol(); - this.updateNumColLastRowFlag(); - } - this.repairSumRow(); - this.noRowsShowFun(); - this.updateLastRowFlag(); - var obj = {}; - obj.begin = index; - obj.length = 1; - this.renderTypeFun(obj); - } - }; - var addOneRowTree = function addOneRowTree(row, index) { - return index; - }; - var addOneRowTreeHasChildF = function addOneRowTreeHasChildF() {}; - var editClose = function editClose() {}; - /* - * 添加多行 - */ - var addRows = function addRows(rows, index) { - if (!(this.$ele.data('gridComp') == this)) return; - if (this.options.showTree) { - // 树表待优化 - var l = rows.length; - for (var i = 0; i < l; i++) { - this.addOneRow(rows[i], l); - } - return; - } - this.editClose(); - var htmlStr = '', - htmlStrmultiSelect = '', - htmlStrNumCol = '', - htmlStrFixed = '', - oThis = this, - l = this.dataSourceObj.rows.length, - endFlag = false; - if (index != 0) { - if (index && index > 0) { - if (l < index) index = l; - } else { - index = 0; - } - } - if (l == index) { - endFlag = true; - } - var rowObjArr = new Array(); - $.each(rows, function (i) { - var rowObj = {}; - rowObj.value = this; - rowObj.valueIndex = index + i; - rowObjArr.push(rowObj); - oThis.dataSourceObj.rows.splice(index + i, 0, rowObj); - oThis.updateEditRowIndex('+', index + i); - }); - - if (this.dataSourceObj.options.values) {} else { - this.dataSourceObj.options.values = new Array(); - } - $.each(rows, function (i) { - oThis.dataSourceObj.options.values.splice(index + i, 0, this); - }); - - // 如果是在中间插入需要将后续的valueIndex + 1; - if (this.dataSourceObj.rows.length > index + rows.length) { - $.each(this.dataSourceObj.rows, function (i) { - if (i > index + rows.length - 1) { - this.valueIndex = this.valueIndex + rows.length; - } - }); - } - if (this.showType == 'grid' && $('#' + this.options.id + '_content_div tbody')[0]) { - //只有grid展示的时候才处理div,针对隐藏情况下还要添加数据 //lyk--需要完善隐藏之后再显示同事添加数据操作 - $.each(rowObjArr, function (i, row) { - htmlStr += oThis.createContentOneRow(this); - htmlStrFixed += oThis.createContentOneRowFixed(this); - if (oThis.options.multiSelect) { - htmlStrmultiSelect += oThis.createContentLeftMultiSelectRow(this); - } - if (oThis.options.showNumCol) { - htmlStrNumCol += oThis.createContentLeftNumColRow(l + i, row.value); - } - }); - try { - if (endFlag) { - $('#' + this.options.id + '_content_div tbody')[0].insertAdjacentHTML('beforeEnd', htmlStr); - } else { - if ($('#' + this.options.id + '_content_div').find('tbody').find('tr[role="row"]')[index]) $('#' + this.options.id + '_content_div').find('tbody').find('tr[role="row"]')[index].insertAdjacentHTML('beforeBegin', htmlStr);else if ($('#' + this.options.id + '_content_div tbody')[0]) $('#' + this.options.id + '_content_div tbody')[0].insertAdjacentHTML('afterBegin', htmlStr); - } - if (endFlag) { - $('#' + this.options.id + '_content_fixed_div tbody')[0].insertAdjacentHTML('beforeEnd', htmlStrFixed); - } else { - if ($('#' + this.options.id + '_content_fixed_div').find('tbody').find('tr[role="row"]')[index]) $('#' + this.options.id + '_content_fixed_div').find('tbody').find('tr[role="row"]')[index].insertAdjacentHTML('beforeBegin', htmlStrFixed);else if ($('#' + this.options.id + '_content_fixed_div tbody')[0]) $('#' + this.options.id + '_content_fixed_div tbody')[0].insertAdjacentHTML('afterBegin', htmlStrFixed); - } - } catch (e) { - //IE情况下 - var table = $('#' + this.options.id + '_content_div table')[0]; - var fixedTable = $('#' + this.options.id + '_content_fixed_div table')[0]; - if (table && fixedTable) { - $.each(rowObjArr, function (i) { - oThis.createContentOneRowForIE(table, index + i, this); - oThis.createContentOneRowForIE(fixedTable, index + i, this, 'fixed'); - }); - } - } - if (this.options.multiSelect) { - if (endFlag) { - $('#' + this.options.id + '_content_multiSelect')[0].insertAdjacentHTML('beforeEnd', htmlStrmultiSelect); - } else { - var _content_multiSelect = $('#' + this.options.id + '_content_multiSelect').find('div')[index]; - if (_content_multiSelect) _content_multiSelect.insertAdjacentHTML('beforeBegin', htmlStrmultiSelect);else $('#' + this.options.id + '_content_multiSelect')[0].insertAdjacentHTML('afterBegin', htmlStrmultiSelect); - } - } - if (this.options.showNumCol) { - if (endFlag) { - $('#' + this.options.id + '_content_numCol')[0].insertAdjacentHTML('beforeEnd', htmlStrNumCol); - } else { - var _content_multiSelect = $('#' + this.options.id + '_content_numCol').find('div')[index]; - if (_content_multiSelect) _content_multiSelect.insertAdjacentHTML('beforeBegin', htmlStrNumCol);else $('#' + this.options.id + '_content_numCol')[0].insertAdjacentHTML('afterBegin', htmlStrNumCol); - } - this.resetNumCol(); - this.updateNumColLastRowFlag(); - } - this.repairSumRow(); - this.noRowsShowFun(); - var obj = {}; - obj.begin = index; - obj.length = rows.length; - this.renderTypeFun(obj); - } - - this.updateLastRowFlag(); - this.isCheckedHeaderRow(); - }; - var createContentOneRowFixed = function createContentOneRowFixed(rowObj) { - return ''; - }; - var updateEditRowIndex = function updateEditRowIndex(opType, opIndex, num) {}; - /* - * 删除一行 - */ - var deleteOneRow = function deleteOneRow(index) { - var oThis = this; - index = parseInt(index); - var row = this.dataSourceObj.rows[index]; - if (!row) return; - var rowValue = row.value; - if (this.showType == 'grid') { - //只有grid展示的时候才处理div,针对隐藏情况下还要添加数据 - this.editClose(); - } - this.dataSourceObj.rows.splice(index, 1); - this.updateEditRowIndex('-', index); - if (this.dataSourceObj.options.values) { - var i = this.dataSourceObj.options.values.indexOf(rowValue); - this.dataSourceObj.options.values.splice(i, 1); - } - // 如果是在中间插入需要将后续的valueIndex - 1; - if (this.dataSourceObj.rows.length > index + 1) { - $.each(this.dataSourceObj.rows, function (i) { - if (i >= index) { - this.valueIndex = this.valueIndex - 1; - } - }); - } - if (this.selectRows) { - $.each(this.selectRows, function (i) { - if (this == rowValue) { - oThis.selectRows.splice(i, 1); - oThis.selectRowsObj.splice(i, 1); - oThis.selectRowsIndex.splice(i, 1); - } else if (oThis.selectRowsIndex[i] > index) { - oThis.selectRowsIndex[i] = oThis.selectRowsIndex[i] - 1; - } - }); - } - if (this.focusRow) { - if (this.focusRow == rowValue) { - this.focusRow = null; - this.focusRowObj = null; - this.focusRowIndex = null; - } else if (this.focusRowIndex > index) { - this.focusRowIndex = this.focusRowIndex - 1; - } - } - if (this.showType == 'grid') { - //只有grid展示的时候才处理div,针对隐藏情况下还要添加数据 - $('#' + this.options.id + '_content_div tbody tr:eq(' + index + ')').remove(); - $('#' + this.options.id + '_content_fixed_div tbody tr:eq(' + index + ')').remove(); - $('#' + this.options.id + '_content_multiSelect >div:eq(' + index + ')').remove(); - $('#' + this.options.id + '_content_numCol >.u-grid-content-num:eq(' + index + ')').remove(); - this.resetNumCol(); - this.repairSumRow(); - this.noRowsShowFun(); - this.updateNumColLastRowFlag(); - } - - this.deleteOneRowTree(); - if (typeof this.options.onRowDelete == 'function') { - var obj = {}; - obj.gridObj = this; - obj.index = index; - obj.row = row; - if (!this.options.onRowDelete(obj)) { - return; - } - } - this.isCheckedHeaderRow(); - }; - var repairSumRow = function repairSumRow() {}; - var deleteOneRowTree = function deleteOneRowTree() {}; - /* - * 删除多行 - */ - var deleteRows = function deleteRows(indexs) { - var oThis = this, - indexss = new Array(); - $.each(indexs, function (i) { - indexss.push(indexs[i]); - }); - indexss.sort(function (a, b) { - return b - a; - }); - - $.each(indexss, function (i) { - oThis.deleteOneRow(this); - }); - this.isCheckedHeaderRow(); - }; - /* - * 修改某一行 - */ - var updateRow = function updateRow(index, row) { - if (index > -1 && index < this.dataSourceObj.rows.length) { - this.dataSourceObj.rows[index].value = row; - this.dataSourceObj.options.values[this.dataSourceObj.rows[index].valueIndex] = row; - if (this.showType == 'grid') { - var obj = {}; - obj.begin = index; - obj.length = 1; - this.renderTypeFun(obj); - this.repairSumRow(); - } - } - }; - /* - * 修改某个cell的值 - */ - var updateValueAt = function updateValueAt(rowIndex, field, value, force) { - if (rowIndex > -1 && rowIndex < this.dataSourceObj.rows.length) { - var oThis = this, - oldValue = $(this.dataSourceObj.rows[rowIndex].value).attr(field), - treeRowIndex = rowIndex; - if (typeof value == 'undefined') value = ''; - if (oldValue != value || force) { - if (typeof this.options.onBeforeValueChange == 'function') { - var obj = {}; - obj.gridObj = this; - //因为树表更新时候可能改变rowIndex的顺序 - obj.rowIndex = treeRowIndex; - obj.field = field; - obj.oldValue = oldValue; - obj.newValue = value; - var flag = this.options.onBeforeValueChange(obj); - if (!flag) return; - } - $(this.dataSourceObj.rows[rowIndex].value).attr(field, value); - $(this.dataSourceObj.options.values[this.dataSourceObj.rows[rowIndex].valueIndex]).attr(field, value); - if (this.showType == 'grid') { - var obj = {}; - obj.field = field; - obj.begin = rowIndex; - obj.length = 1; - this.renderTypeFun(obj); - // this.editColIndex = undefined; - // 如果编辑行为修改行则同时需要修改编辑行的显示 - treeRowIndex = this.updateValueAtTree(rowIndex, field, value, force); - this.updateValueAtEdit(rowIndex, field, value, force); - this.repairSumRow(); - } - if (typeof this.options.onValueChange == 'function') { - var obj = {}; - obj.gridObj = this; - //因为树表更新时候可能改变rowIndex的顺序 - obj.rowIndex = treeRowIndex; - obj.field = field; - obj.oldValue = oldValue; - obj.newValue = value; - this.options.onValueChange(obj); - } - this.resetLeftHeight(); - } - } - }; - var updateValueAtTree = function updateValueAtTree(rowIndex, field, value, force) { - return rowIndex; - }; - var updateValueAtEdit = function updateValueAtEdit(rowIndex, field, value, force) {}; - /* - * 选中一行 - * slice 设置全选时,slice为true,不做渲染,在setAllRowSelect中统一渲染 - */ - var setRowSelect = function setRowSelect(rowIndex, doms) { - var selectDiv, rowTr, fixedRowTr, numColDiv; - if (!this.dataSourceObj.rows[rowIndex]) return true; - //已经选中退出 - if (this.showType == 'grid') { - if (doms && doms['contentTrs']) rowTr = doms['contentTrs'][rowIndex];else rowTr = this.$ele.find('#' + this.options.id + '_content_tbody tr[role="row"]')[rowIndex]; - } - if (this.dataSourceObj.rows[rowIndex].checked && u.hasClass(rowTr, "u-grid-content-sel-row")) return true; - if (doms && doms['multiSelectDivs']) selectDiv = doms['multiSelectDivs'][rowIndex];else selectDiv = this.$ele.find('#' + this.options.id + '_content_multiSelect').children()[rowIndex]; - if (typeof this.options.onBeforeRowSelected == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[rowIndex]; - obj.rowIndex = rowIndex; - if (!this.options.onBeforeRowSelected(obj)) { - if (this.options.multiSelect) { - var _input = selectDiv.children[0]; - _input.checked = false; - } - return false; - } - } - if (!this.options.multiSelect) { - if (this.selectRowsObj && this.selectRowsObj.length > 0) { - $.each(this.selectRowsObj, function () { - this.checked = false; - }); - } - this.selectRows = new Array(); - this.selectRowsObj = new Array(); - this.selectRowsIndex = new Array(); - if (this.showType == 'grid') { - $('#' + this.options.id + '_content_tbody tr').removeClass("u-grid-content-sel-row"); - $('#' + this.options.id + '_content_tbody tr a').removeClass("u-grid-content-sel-row"); - $('#' + this.options.id + '_content_fixed_tbody tr').removeClass("u-grid-content-sel-row"); - $('#' + this.options.id + '_content_fixed_tbody tr a').removeClass("u-grid-content-sel-row"); - if (this.options.multiSelect) { - $('#' + this.options.id + '_content_multiSelect div').removeClass("u-grid-content-sel-row"); - } - if (this.options.showNumCol) { - $('#' + this.options.id + '_content_numCol div').removeClass("u-grid-content-sel-row"); - } - } - } else { - if (this.showType == 'grid') { - var _input = selectDiv.children[0]; - // _input.checked = true; - $(_input).addClass('is-checked'); - } - } - if (this.showType == 'grid') { - $(rowTr).addClass("u-grid-content-sel-row"); - - if (doms && doms['fixContentTrs']) fixedRowTr = doms['fixContentTrs'][rowIndex];else fixedRowTr = this.$ele.find('#' + this.options.id + '_content_fixed_tbody tr[role="row"]')[rowIndex]; - $(fixedRowTr).addClass("u-grid-content-sel-row"); - var ini = rowIndex; - if (this.eidtRowIndex > -1 && this.eidtRowIndex < rowIndex && this.options.editType == 'form') { - ini++; - } - if (this.options.multiSelect) { - if (ini != rowIndex) selectDiv = this.$ele.find('#' + this.options.id + '_content_multiSelect').children()[ini]; - $(selectDiv).addClass('u-grid-content-sel-row'); - } - if (this.options.showNumCol) { - if (doms && doms['numColDivs']) numColDiv = doms['numColDivs'][ini];else numColDiv = this.$ele.find('#' + this.options.id + '_content_numCol').children()[ini]; - $(numColDiv).addClass('u-grid-content-sel-row'); - } - } - this.selectRows.push(this.dataSourceObj.rows[rowIndex].value); - this.selectRowsObj.push(this.dataSourceObj.rows[rowIndex]); - this.selectRowsIndex.push(rowIndex); - this.dataSourceObj.rows[rowIndex].checked = true; - // if(this.selectRows.length == this.dataSourceObj.rows.length){ - // //修改全选标记为false - // $('#' + this.options.id + '_header_multi_input').addClass('is-checked') - // } - this.isCheckedHeaderRow(); - if (typeof this.defaultOnRowSelected == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[rowIndex]; - obj.rowIndex = rowIndex; - this.defaultOnRowSelected(obj); - } - - if (typeof this.options.onRowSelected == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[rowIndex]; - obj.rowIndex = rowIndex; - this.options.onRowSelected(obj); - } - return true; - }; - /* - * 反选一行 - */ - var setRowUnselect = function setRowUnselect(rowIndex) { - var oThis = this; - if (!this.dataSourceObj.rows[rowIndex]) return true; - //已经选中退出 - if (!this.dataSourceObj.rows[rowIndex].checked) return true; - if (typeof this.options.onBeforeRowUnSelected == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[rowIndex]; - obj.rowIndex = rowIndex; - if (!this.options.onBeforeRowUnSelected(obj)) { - if (this.options.multiSelect) { - $('#' + this.options.id + '_content_multiSelect input:eq(' + rowIndex + ')')[0].checked = true; - } - return false; - } - } - if (this.options.multiSelect) { - // $('#' + this.options.id + '_content_multiSelect input:eq(' + rowIndex+ ')')[0].checked = false; - $('#' + this.options.id + '_content_multiSelect .u-grid-checkbox-outline:eq(' + rowIndex + ')').removeClass('is-checked'); - } - var ini = rowIndex; - if (this.eidtRowIndex > -1 && this.eidtRowIndex < rowIndex && this.options.editType == 'form') { - ini++; - } - $('#' + this.options.id + '_content_tbody tr:eq(' + ini + ')').removeClass("u-grid-content-sel-row"); - $('#' + this.options.id + '_content_tbody tr:eq(' + ini + ') a').removeClass("u-grid-content-sel-row"); - $('#' + this.options.id + '_content_fixed_tbody tr:eq(' + ini + ')').removeClass("u-grid-content-sel-row"); - $('#' + this.options.id + '_content_fixed_tbody tr:eq(' + ini + ') a').removeClass("u-grid-content-sel-row"); - if (this.options.multiSelect) { - $('#' + this.options.id + '_content_multiSelect >div:eq(' + ini + ')').removeClass("u-grid-content-sel-row"); - } - if (this.options.showNumCol) { - $('#' + this.options.id + '_content_numCol >div:eq(' + ini + ')').removeClass("u-grid-content-sel-row"); - } - $.each(this.selectRows, function (i) { - if (this == oThis.dataSourceObj.rows[rowIndex].value) { - oThis.selectRows.splice(i, 1); - oThis.selectRowsObj.splice(i, 1); - oThis.selectRowsIndex.splice(i, 1); - } - }); - this.dataSourceObj.rows[rowIndex].checked = false; - - //修改全选标记为false - $('#' + this.options.id + '_header_multi_input').removeClass('is-checked'); - - if (typeof this.options.onRowUnSelected == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[rowIndex]; - obj.rowIndex = rowIndex; - this.options.onRowUnSelected(obj); - } - oThis.isCheckedHeaderRow(); - return true; - }; - /* - * 选中所有行 - */ - var setAllRowSelect = function setAllRowSelect() { - // $('#' + this.options.id + '_header_multi_input').prop('checked', true) - $('#' + this.options.id + '_header_multi_input').addClass('is-checked'); - if (typeof this.options.onBeforeAllRowSelected == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObjs = this.dataSourceObj.rows; - if (!this.options.onBeforeAllRowSelected(obj)) { - return; - } - } - // 把需要的dom在循环外获取出来 - var multiSelectDivs = this.$ele.find('#' + this.options.id + '_content_multiSelect').children(), - numColDivs = this.$ele.find('#' + this.options.id + '_content_numCol').children(), - contentTrs = this.$ele.find('#' + this.options.id + '_content_tbody tr[role="row"]'), - fixContentTrs = this.$ele.find('#' + this.options.id + '_content_fixed_tbody tr[role="row"]'); - this.$ele.find('#' + this.options.id + '_content_tbody tr[role="row"]'); - for (var i = 0; i < this.dataSourceObj.rows.length; i++) { - this.setRowSelect(i, { - multiSelectDivs: multiSelectDivs, - numColDivs: numColDivs, - contentTrs: contentTrs, - fixContentTrs: fixContentTrs - }); - } - if (typeof this.options.onAllRowSelected == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObjs = this.dataSourceObj.rows; - this.options.onAllRowSelected(obj); - } - }; - /* - * 反选所有行 - */ - var setAllRowUnSelect = function setAllRowUnSelect() { - // $('#' + this.options.id + '_header_multi_input').attr('checked', false) - $('#' + this.options.id + '_header_multi_input').removeClass('is-checked'); - if (typeof this.options.onBeforeAllRowUnSelected == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObjs = this.dataSourceObj.rows; - if (!this.options.onBeforeAllRowUnSelected(obj)) { - return; - } - } - for (var i = 0; i < this.dataSourceObj.rows.length; i++) { - this.setRowUnselect(i); - } - if (typeof this.options.onAllRowUnSelected == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObjs = this.dataSourceObj.rows; - this.options.onAllRowUnSelected(obj); - } - }; - - /* - * focus一行 - */ - var setRowFocus = function setRowFocus(rowIndex) { - //已经选中退出 - if (this.dataSourceObj.rows[rowIndex].focus) return true; - if (!this.dataSourceObj.rows[rowIndex]) return true; - if (typeof this.options.onBeforeRowFocus == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[rowIndex]; - obj.rowIndex = rowIndex; - if (!this.options.onBeforeRowFocus(obj)) { - return false; - } - } - $('#' + this.options.id + '_content_tbody tr').removeClass("u-grid-content-focus-row"); - $('#' + this.options.id + '_content_tbody tr a').removeClass("u-grid-content-focus-row"); - $('#' + this.options.id + '_content_fixed_tbody tr').removeClass("u-grid-content-focus-row"); - $('#' + this.options.id + '_content_fixed_tbody tr a').removeClass("u-grid-content-focus-row"); - if (this.options.multiSelect) { - $('#' + this.options.id + '_content_multiSelect').find('div').removeClass("u-grid-content-focus-row"); - } - if (this.options.showNumCol) { - $('#' + this.options.id + '_content_numCol').find('div').removeClass("u-grid-content-focus-row"); - } - if (this.focusRowObj) { - this.focusRowObj.focus = false; - } - $('#' + this.options.id + '_content_tbody tr[role="row"]:eq(' + rowIndex + ')').addClass("u-grid-content-focus-row"); - $('#' + this.options.id + '_content_tbody tr[role="row"]:eq(' + rowIndex + ') a').addClass("u-grid-content-focus-row"); - $('#' + this.options.id + '_content_fixed_tbody tr[role="row"]:eq(' + rowIndex + ')').addClass("u-grid-content-focus-row"); - $('#' + this.options.id + '_content_fixed_tbody tr[role="row"]:eq(' + rowIndex + ') a').addClass("u-grid-content-focus-row"); - var ini = rowIndex; - if (this.eidtRowIndex > -1 && this.eidtRowIndex < rowIndex && this.options.editType == 'form') { - ini++; - } - if (this.options.multiSelect) { - $('#' + this.options.id + '_content_multiSelect >div:eq(' + ini + ')').addClass("u-grid-content-focus-row"); - } - if (this.options.showNumCol) { - $('#' + this.options.id + '_content_numCol >div:eq(' + ini + ')').addClass("u-grid-content-focus-row"); - } - this.focusRow = this.dataSourceObj.rows[rowIndex].value; - this.focusRowObj = this.dataSourceObj.rows[rowIndex]; - this.focusRowIndex = rowIndex; - this.dataSourceObj.rows[rowIndex].focus = true; - if (typeof this.options.onRowFocus == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[rowIndex]; - obj.rowIndex = rowIndex; - this.options.onRowFocus(obj); - } - /*if(!this.options.multiSelect){ - this.setRowSelect(rowIndex); - }*/ - return true; - }; - /* - * 反focus一行 - */ - var setRowUnFocus = function setRowUnFocus(rowIndex) { - var oThis = this; - if (!this.dataSourceObj.rows[rowIndex]) return true; - if (typeof this.options.onBeforeRowUnFocus == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[rowIndex]; - obj.rowIndex = rowIndex; - if (!this.options.onBeforeRowUnFocus(obj)) { - return false; - } - } - //已经选中退出 - if (!this.dataSourceObj.rows[rowIndex].focus) return true; - var ini = rowIndex; - if (this.eidtRowIndex > -1 && this.eidtRowIndex < rowIndex && this.options.editType == 'form') { - ini++; - } - $('#' + this.options.id + '_content_tbody tr:eq(' + ini + ')').removeClass("u-grid-content-focus-row"); - $('#' + this.options.id + '_content_tbody tr:eq(' + ini + ') a').removeClass("u-grid-content-focus-row"); - $('#' + this.options.id + '_content_fixed_tbody tr:eq(' + ini + ')').removeClass("u-grid-content-focus-row"); - $('#' + this.options.id + '_content_fixed_tbody tr:eq(' + ini + ') a').removeClass("u-grid-content-focus-row"); - if (this.options.multiSelect) { - $('#' + this.options.id + '_content_multiSelect >div:eq(' + ini + ')').removeClass("u-grid-content-focus-row"); - } - if (this.options.showNumCol) { - $('#' + this.options.id + '_content_numCol >div:eq(' + ini + ')').removeClass("u-grid-content-focus-row"); - } - this.dataSourceObj.rows[rowIndex].focus = false; - this.focusRow = null; - this.focusRowObj = null; - this.focusRowIndex = null; - if (typeof this.options.onRowUnFocus == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[rowIndex]; - obj.rowIndex = rowIndex; - this.options.onRowUnFocus(obj); - } - if (!this.options.multiSelect) { - this.setRowUnselect(rowIndex); - } - return true; - }; - /* - * 增加删除时重置数字列 - */ - var resetNumCol = function resetNumCol() { - var numCols = $('#' + this.options.id + '_content_numCol >.u-grid-content-num'); - $.each(numCols, function (i) { - this.innerHTML = i + 1 + ""; - }); - }; - var operateRowFunObj = exports.operateRowFunObj = { - isCheckedHeaderRow: isCheckedHeaderRow, - addOneRow: addOneRow, - addOneRowTree: addOneRowTree, - addOneRowTreeHasChildF: addOneRowTreeHasChildF, - editClose: editClose, - addRows: addRows, - createContentOneRowFixed: createContentOneRowFixed, - updateEditRowIndex: updateEditRowIndex, - deleteOneRow: deleteOneRow, - repairSumRow: repairSumRow, - deleteOneRowTree: deleteOneRowTree, - deleteRows: deleteRows, - updateRow: updateRow, - updateValueAt: updateValueAt, - updateValueAtTree: updateValueAtTree, - updateValueAtEdit: updateValueAtEdit, - setRowSelect: setRowSelect, - setRowUnselect: setRowUnselect, - setAllRowSelect: setAllRowSelect, - setAllRowUnSelect: setAllRowUnSelect, - setRowFocus: setRowFocus, - setRowUnFocus: setRowUnFocus, - resetNumCol: resetNumCol - }; - -/***/ }, -/* 16 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /* - * 处理renderType - * begin为起始行,length为行数(增加行数时使用) - */ - var renderTypeFun = function renderTypeFun(obj) { - if (!this.isGridShow()) return; - if (typeof obj == 'undefined') { - var begin = null, - length = null, - field = ''; - } else { - var begin = typeof obj.begin == 'undefined' ? null : obj.begin, - length = typeof obj.length == 'undefined' ? null : obj.length, - field = typeof obj.field == 'undefined' ? '' : obj.field; - } - var oThis = this, - begin = parseInt(begin), - length = parseInt(length), - end = begin; - if (length > 0) { - end = parseInt(begin + length - 1); - } - if (field == '') { - if (this.gridCompColumnFixedArr) $.each(this.gridCompColumnFixedArr, function (i) { - oThis.renderTypeByColumn(this, i, begin, length, true); - }); - $.each(this.gridCompColumnArr, function (i) { - oThis.renderTypeByColumn(this, i, begin, length, false); - }); - } else { - var rendered = false; - if (this.gridCompColumnFixedArr) $.each(this.gridCompColumnFixedArr, function (i) { - if (this.options.field == field) { - oThis.renderTypeByColumn(this, i, begin, length, true); - rendered = true; - return; - } - }); - if (!rendered) $.each(this.gridCompColumnArr, function (i) { - if (this.options.field == field) { - oThis.renderTypeByColumn(this, i, begin, length, false); - return; - } - }); - } - }; - /* - * 处理renderType - * gridCompColumn对象,index为第几列 - * begin为起始行,length为行数(增加行数时使用) - */ - var renderTypeByColumn = function renderTypeByColumn(gridCompColumn, i, begin, length, isFixedColumn) { - var oThis = this, - renderType = gridCompColumn.options.renderType, - sumCol = gridCompColumn.options.sumCol, - sumRenderType = gridCompColumn.options.sumRenderType, - dataType = gridCompColumn.options.dataType, - precision = gridCompColumn.options.precision, - format = gridCompColumn.options.format, - field = gridCompColumn.options.field, - end = begin, - idSuffix = isFixedColumn === true ? '_content_fixed_tbody' : '_content_tbody', - idStr = isFixedColumn === true ? 'fixed_' : '', - visibleColIndex = this.getVisibleIndexOfColumn(gridCompColumn); - - if (length > 0) { - end = parseInt(begin + length - 1); - } - this.realtimeTableRows = document.getElementById(oThis.options.id + idSuffix).children; - // 记录role不是row的行 - var notRowIndex = -1; - for (var k = 0; k < oThis.realtimeTableRows.length; k++) { - if (oThis.realtimeTableRows[k].getAttribute("role") != "row") { - notRowIndex = k; - } - } - $.each(oThis.dataSourceObj.rows, function (j) { - if (begin >= 0 && j >= begin && j <= end || isNaN(begin)) { - //如果当前修改此列则将变量重置 - if (oThis.editColIndex == visibleColIndex && oThis.eidtRowIndex == j && oThis.options.editType == 'default') { - oThis.editColIndex = -1; - oThis.eidtRowIndex = -1; - } - var trIndex = j; - if (notRowIndex != -1 && j >= notRowIndex) { - trIndex++; - } - var tr = oThis.realtimeTableRows[trIndex], - td = tr.children[i]; - if (oThis.iconSpan) { - var iconSpan = oThis.iconSpan; - } - - if (td) { - if (td.children[0].innerHTML.indexOf('u-grid-content-tree-span') != -1) { - var span = td.children[0].children[1]; - } else { - // td.innerHTML = '
'; //如果是树表的话第一列显示会有问题,等出现其他问题之后再修改此处 - var span = td.children[0]; - } - if (span) { - var v = $(this.value).attr(field); - if (typeof renderType == 'function' || dataType == 'Date' || dataType == 'Datetime' || dataType == 'Int' || dataType == 'Float') { - span.innerHTML = ''; - if (typeof renderType == 'function') { - v = oThis.getString(v, ''); - var obj = {}; - obj.value = v; - obj.element = span; - obj.gridObj = oThis; - obj.row = this; - obj.gridCompColumn = gridCompColumn; - obj.rowIndex = j; - renderType.call(oThis, obj); - } else if (dataType == 'Date' || dataType == 'Datetime') { - if (v == null || v == undefined || v == 'null' || v == 'undefined' || v == "") { - v = ""; - } - if (dataType == 'Date') { - v = u.dateRender(v); - } else { - v = u.dateTimeRender(v); - } - span.innerHTML = v; - span.title = v; - } else if (dataType == 'Int') { - v = parseInt(v); - if (v) { - span.innerHTML = v; - span.title = v; - } else { - span.innerHTML = ""; - span.title = ""; - } - } else if (dataType == 'Float') { - if (precision) { - var o = {}; - o.value = v; - o.precision = precision; - v = oThis.DicimalFormater(o); - } else { - v = parseFloat(v); - } - if (v) { - span.innerHTML = v; - span.title = v; - } else { - span.innerHTML = ""; - span.title = ""; - } - } else { - //此处逻辑放到渲染处,减少render执行次数。 - v = oThis.getString(v, ''); - var v1 = v.replace(/\/g, '\>'); - span.title = v; - v = v.replace(/\/g, '>'); - span.innerHTML = v; - } - } else { - v = oThis.getString(v, ''); - var v1 = v.replace(/\/g, '\>'); - span.title = v; - v = v.replace(/\/g, '>'); - if (i == 0 && iconSpan) { - v = iconSpan += v; - } - span.innerHTML = v; - } - - /* 增加处理判断是否需要显示... */ - var obj = { - span: span, - column: gridCompColumn - }; - var colum_maxlength = gridCompColumn.options.maxLength, - overFlag = false; - if (colum_maxlength && colum_maxlength > 0) { - //控制表格列显示... - overFlag = span.innerHTML.length > colum_maxlength ? true : false; - } else { - overFlag = oThis.getRenderOverFlag(obj); - } - if (overFlag) { - $(span).addClass('u-grid-content-td-div-over'); - } - } - } - } - }); - this.renderTypeSumRow(gridCompColumn, i, begin, length, isFixedColumn); - }; - - var getRenderOverFlag = function getRenderOverFlag(obj) { - var span = obj.span; - var nowHeight = span.offsetHeight; - var nowWidth = span.offsetWidth; - var newSpan = $(span).clone()[0]; - var overFlag = false; - obj.span.parentNode.appendChild(newSpan); - var oldDisplay = span.style.display; - span.style.display = 'none'; - newSpan.style.height = ''; - newSpan.style.maxHeight = '999999px'; - var newHeight = newSpan.offsetHeight; - if (newHeight > nowHeight) { - overFlag = true; - } - obj.span.parentNode.removeChild(newSpan); - span.style.display = oldDisplay; - return overFlag; - }; - - var renderTypeSumRow = function renderTypeSumRow(gridCompColumn, i, begin, length, isFixedColumn) {}; - var renderTypeFunObj = exports.renderTypeFunObj = { - renderTypeFun: renderTypeFun, - renderTypeByColumn: renderTypeByColumn, - renderTypeSumRow: renderTypeSumRow, - getRenderOverFlag: getRenderOverFlag - }; - -/***/ }, -/* 17 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /* - * 设置某列是否显示(传入column) - */ - var setColumnVisibleByColumn = function setColumnVisibleByColumn(column, visible) { - var index = this.getIndexOfColumn(column); - this.setColumnVisibleByIndex(index, visible); - }; - /* - * 设置某列是否显示(传入index为gridCompColumnArr中的数据) - */ - var setColumnVisibleByIndex = function setColumnVisibleByIndex(index, visible) { - if (index >= 0) { - var column = this.gridCompColumnArr[index], - visibleIndex = this.getVisibleIndexOfColumn(column); - // 显示处理 - if (column.options.visible == false && visible) { - var htmlStr = ' this.minColumnWidth || newWidth == this.minColumnWidth) { - var nowVisibleThIndex = this.getVisibleIndexOfColumn(column), - oldWidth = column.options.width, - changeWidth = newWidth - oldWidth, - cWidth = this.contentWidth + changeWidth; - this.contentWidth = this.contentWidthChange(cWidth); - $('#' + this.options.id + '_header_table col:eq(' + nowVisibleThIndex + ')').css('width', newWidth + "px"); - $('#' + this.options.id + '_content_table col:eq(' + nowVisibleThIndex + ')').css('width', newWidth + "px"); - - column.options.width = newWidth; - column.options.realWidth = newWidth; - - this.resetThVariable(); - this.saveGridCompColumnArrToLocal(); - } - this.columnsVisibleFun(); - // } - }; - /* - * 设置数据源 - */ - var setDataSource = function setDataSource(dataSource) { - if (!(this.$ele.data('gridComp') == this)) return; - this.initDataSourceVariable(); - this.options.dataSource = dataSource; - this.initDataSource(); - this.repairContent(); - this.afterGridDivsCreate(); - }; - /* - * 设置数据源 格式为: - * { - fields:['column1','column2','column3','column4','column5','column6'], - values:[["cl1","1","cl3","cl4","cl5","cl6"] - ,["cl12","2","cl32","cl42","cl52","cl62"] - ,["cl13","3","cl33","cl43","cl53","cl63"] - ,["cl14","4","cl34","cl44","cl54","cl64"] - ,["cl15","5","cl35","cl45","cl55","cl65"] - ,["cl16","6","cl36","cl46","cl56","cl66"] - ] - - } - */ - var setDataSourceFun1 = function setDataSourceFun1(dataSource) { - var dataSourceObj = {}; - if (dataSource.values) { - var valuesArr = new Array(); - $.each(dataSource.values, function () { - if (dataSource.fields) { - var valueObj = {}, - value = this; - $.each(dataSource.fields, function (j) { - $(valueObj).attr(this, value[j]); - }); - valuesArr.push(valueObj); - } - }); - } - $(dataSourceObj).attr('values', valuesArr); - this.setDataSource(dataSourceObj); - }; - var setFunObj = exports.setFunObj = { - setColumnVisibleByColumn: setColumnVisibleByColumn, - setColumnVisibleByIndex: setColumnVisibleByIndex, - setCoulmnWidthByField: setCoulmnWidthByField, - setColumnWidth: setColumnWidth, - setDataSource: setDataSource, - setDataSourceFun1: setDataSourceFun1 - }; - -/***/ }, -/* 18 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /* - * 整体宽度改变处理 - */ - var widthChangeFun = function widthChangeFun() { - var oThis = this; - if ($('#' + this.options.id)[0]) { - // 获取整体区域宽度 - //var w = $('#' + this.options.id).width() //[0].offsetWidth; - // jquery获取方式有问题,修改为offsetWidth - var w = $('#' + this.options.id)[0].offsetWidth; - // w!=0的判断是为了处理页签中的grid在切换的过程中会重绘 - if (this.wholeWidth != w && this.$ele.data('gridComp') == this && w != 0) { - this.wholeWidth = w; - - // 树展开/合上的时候会导致页面出现滚动条导致宽度改变,没有&&之后会重新刷新页面导致无法收起 - if (w > this.options.formMaxWidth && (this.showType == 'form' || this.showType == '' || !$('#' + this.options.id + '_content_div tbody')[0]) || this.options.overWidthHiddenColumn || this.options.noScroll) { - //lyk--需要完善隐藏之后再显示同事添加数据操作 - oThis.widthChangeGridFun(); - } else if (w > 0 && w < this.options.formMaxWidth && (this.showType == 'grid' || this.showType == '')) {} - if (w > this.options.formMaxWidth) { - this.contentMinWidth = parseInt(this.wholeWidth) - parseInt(this.leftW) - parseInt(this.fixedWidth); - if (this.contentMinWidth < 0) this.contentMinWidth = 0; - setTimeout(function () { - $('#' + oThis.options.id + '_header_wrap').css('max-width', oThis.wholeWidth + 'px'); - $('#' + oThis.options.id + '_content_div').css('width', oThis.contentMinWidth + 'px'); - $('#' + oThis.options.id + '_content_table').css('min-width', oThis.contentMinWidth + 'px'); - $('#' + oThis.options.id + '_content_table').css('width', oThis.contentMinWidth + 'px'); - $('#' + oThis.options.id + '_header_table').css('min-width', oThis.contentMinWidth + 'px'); - $('#' + oThis.options.id + '_header_table').css('width', oThis.contentMinWidth + 'px'); - $('#' + oThis.options.id + '_noRowsShow').css('width', oThis.contentMinWidth + 'px'); - //滚动条可能发生变化导致grid内部列的宽度发生变化 - oThis.columnsVisibleFun(); - if (oThis.contentRealWidth < oThis.contentMinWidth) { - oThis.contentWidth = oThis.contentMinWidth; - } else { - oThis.contentWidth = oThis.contentRealWidth; - } - $('#' + oThis.options.id + '_noRows').css('width', oThis.contentWidth + 'px'); - if (typeof oThis.options.afterCreate == 'function') { - oThis.options.afterCreate.call(oThis); - } - }, 300); - } - $('#' + oThis.options.id + '_header_table').css('width', oThis.contentMinWidth + 'px'); - $('#' + oThis.options.id + '_edit_form').css('width', oThis.contentMinWidth + 'px'); - - this.preWholeWidth = w; - this.resetLeftHeight(); - } - } - }; - /* - * 整体宽度改变处理(grid形式) - */ - var widthChangeGridFun = function widthChangeGridFun() { - var oThis = this, - halfWholeWidth = parseInt(this.wholeWidth / 2); - this.noScrollWidthReset(); - this.widthChangeGridFunFixed(halfWholeWidth); - /* 如果宽度不足处理自动隐藏*/ - this.widthChangeGridFunOverWidthHidden(); - // 内容区域宽度自动扩展 - this.contentMinWidth = parseInt(this.wholeWidth) - parseInt(this.leftW) - parseInt(this.fixedWidth); - if (this.contentMinWidth < 0) this.contentMinWidth = 0; - if (this.contentRealWidth < this.contentMinWidth) { - this.contentWidth = this.contentMinWidth; - var oldWidth = this.lastVisibleColumn.options.width; - this.lastVisibleColumnWidth = oldWidth + (this.contentMinWidth - this.contentRealWidth); - // modfied by tianxq1 最后一列自动扩展 - this.lastVisibleColumn.options.width = this.lastVisibleColumnWidth; - } else { - this.contentWidth = this.contentRealWidth; - } - this.createGridFlag = false; - this.createGridDivs(); - $('#' + this.options.id + '_form').css('display', 'none'); - $('#' + this.options.id + '_grid').css('display', 'block'); - }; - - /** - * 不显示滚动条的情况下需要重置每列的宽度 - */ - var noScrollWidthReset = function noScrollWidthReset() { - if (this.options.noScroll) { - //云采不支持拖动,后续再完善拖动之后的情况 - /*if (this.hasNoScrollRest) { - var nowW = 0; - for (var i = 0; i < this.gridCompColumnArr.length; i++) { - var column = this.gridCompColumnArr[i]; - var nowWidth = column.options.width; - var pre = this.preWholeWidth - this.leftW; - var whole = this.wholeWidth - this.leftW; - var newWidth = parseInt(nowWidth / pre * whole); - if(column.options.visible){ - nowW += newWidth; - } - this.setColumnWidth(column, newWidth); - } - } else {*/ - //先按100%来处理 - var nowW = 0; - for (var i = 0; i < this.gridCompColumnArr.length; i++) { - var column = this.gridCompColumnArr[i]; - // var nowWidth = column.options.width + ''; - var nowWidth = column.options.optionsWidth + ''; - var whole = this.wholeWidth - this.leftW; - - if (nowWidth.indexOf('%') > 0) { - var newWidth = parseInt(nowWidth.replace('%', '') * whole / 100); - } else { - var newWidth = nowWidth; - } - if (newWidth < this.minColumnWidth) { - newWidth = this.minColumnWidth; - } - if (column.options.visible) { - nowW += newWidth; - } - this.setColumnWidth(column, newWidth); - } - /*}*/ - this.hasNoScrollRest = true; - } - if (nowW > whole) { - var lastVisibleColumn = this.lastVisibleColumn; - var lastWidth = lastVisibleColumn.options.width; - var newLastWidth = lastWidth - (nowW - whole); - this.setColumnWidth(lastVisibleColumn, newLastWidth); - } - }; - var widthChangeGridFunFixed = function widthChangeGridFunFixed(halfWholeWidth) {}; - var widthChangeGridFunOverWidthHidden = function widthChangeGridFunOverWidthHidden() {}; - /* - * 整体高度改变处理 - */ - var heightChangeFun = function heightChangeFun() { - if (this.countContentHeight) { - var oldH = this.wholeHeight, - h = $('#' + this.options.id)[0].offsetHeight; - this.wholeHeight = h; - if (oldH != h && h > 0) { - var contentH = h - 1 - this.exceptContentHeight > 0 ? h - 1 - this.exceptContentHeight : 0; - $('#' + this.options.id + '_content').css('height', contentH + 'px'); - $('#' + this.options.id + '_content_div').css('height', contentH + 'px'); - } - } - }; - /* - * 内容区宽度改变 - */ - var contentWidthChange = function contentWidthChange(newContentWidth) { - if (newContentWidth < this.contentMinWidth) { - var oldW = parseInt(this.lastVisibleColumn.options.width); - this.lastVisibleColumnWidth = oldW + (this.contentMinWidth - newContentWidth); - $('#' + this.options.id + '_header_table col:last').css('width', this.lastVisibleColumnWidth + "px"); - $('#' + this.options.id + '_content_table col:last').css('width', this.lastVisibleColumnWidth + "px"); - newContentWidth = this.contentMinWidth; - } - - if (newContentWidth > this.contentMinWidth) { - // 首先处理扩展列的宽度为原有宽度,然后再扩展最后一列 - var l = this.overWidthVisibleColumnArr.length; - if (l > 0) { - for (var i = 0; i < l; i++) { - var overWidthColumn = this.overWidthVisibleColumnArr[i]; - var nowVisibleIndex = this.getVisibleIndexOfColumn(overWidthColumn); - var w = parseInt(overWidthColumn.options.width); - var realW = overWidthColumn.options.realWidth; - $('#' + this.options.id + '_header_table col:eq(' + nowVisibleIndex + ')').css('width', realW + "px"); - $('#' + this.options.id + '_content_table col:eq(' + nowVisibleIndex + ')').css('width', realW + "px"); - newContentWidth = newContentWidth - (w - realW); - overWidthColumn.options.width = overWidthColumn.options.realWidth; - } - if (newContentWidth < this.contentMinWidth) { - var oldW = parseInt(this.lastVisibleColumn.options.width); - this.lastVisibleColumnWidth = oldW + (this.contentMinWidth - newContentWidth); - $('#' + this.options.id + '_header_table col:last').css('width', this.lastVisibleColumnWidth + "px"); - $('#' + this.options.id + '_content_table col:last').css('width', this.lastVisibleColumnWidth + "px"); - this.lastVisibleColumn.options.width = this.lastVisibleColumnWidth; - newContentWidth = this.contentMinWidth; - } - } - if (newContentWidth > this.contentMinWidth) { - $('#' + this.options.id + '_content_left_bottom').css('display', 'block'); - $('#' + this.options.id + '_content_left_sum_bottom').css('bottom', 16); - } else { - $('#' + this.options.id + '_content_left_bottom').css('display', 'none'); - $('#' + this.options.id + '_content_left_sum_bottom').css('bottom', 0); - } - } else { - $('#' + this.options.id + '_content_left_bottom').css('display', 'none'); - $('#' + this.options.id + '_content_left_sum_bottom').css('bottom', 0); - } - if (!this.options.noScroll) { - $('#' + this.options.id + '_content_table').css('width', newContentWidth + "px"); - $('#' + this.options.id + '_noRows').css('width', newContentWidth + "px"); - } - - return newContentWidth; - }; - var wdChangeFunObj = exports.wdChangeFunObj = { - widthChangeFun: widthChangeFun, - widthChangeGridFun: widthChangeGridFun, - widthChangeGridFunFixed: widthChangeGridFunFixed, - widthChangeGridFunOverWidthHidden: widthChangeGridFunOverWidthHidden, - heightChangeFun: heightChangeFun, - contentWidthChange: contentWidthChange, - noScrollWidthReset: noScrollWidthReset - }; - -/***/ }, -/* 19 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /* - * 双击/单击处理 - */ - var isDblEvent = function isDblEvent(eventname, dbFun, dbArg, Fun, Arg) { - if (this.currentEventName != null && this.currentEventName == eventname) { - dbFun.call(this, dbArg); - this.currentEventName = null; - if (this.cleanCurrEventName) clearTimeout(this.cleanCurrEventName); - } else { - var oThis = this; - if (this.cleanCurrEventName) clearTimeout(this.cleanCurrEventName); - this.currentEventName = eventname; - this.cleanCurrEventName = setTimeout(function () { - oThis.currentEventName = null; - Fun.call(oThis, Arg); - }, 250); - } - }; - /* - * 双击处理 - */ - var dblClickFun = function dblClickFun(e) { - if (typeof this.options.onDblClickFun == 'function') { - var $tr = $(e.target).closest('tr'); - if ($tr[0].id == this.options.id + '_edit_tr') { - return; - } - var index = 0; - if ($tr.length > 0) { - index = this.getTrIndex($tr); - } - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[index]; - obj.rowIndex = index; - this.options.onDblClickFun(obj); - } - }; - /* - * 单击处理 - */ - var clickFun = function clickFun(e) { - var oThis = this; - - // 处理focus事件 - var $tr = $(e.target).closest('tr'); - if ($tr.length > 0 && $tr[0].id == this.options.id + '_edit_tr') { - return; - } - var index = this.getTrIndex($tr); - if (typeof this.options.onBeforeClickFun == 'function') { - var obj = {}; - obj.gridObj = this; - obj.rowObj = this.dataSourceObj.rows[index]; - obj.rowIndex = index; - obj.e = e; - if (!this.options.onBeforeClickFun(obj)) { - return; - } - } - // 处理树表展开/合上 - this.clickFunTree(e); - if ($tr.length > 0) { - - var row = oThis.dataSourceObj.rows[index]; - if (row) { - if (oThis.options.rowClickBan) { - return; - } - this.clickFunEdit(e, index); - var rowChildIndex = oThis.getChildRowIndex(row); - if (oThis.options.contentFocus || !oThis.options.multiSelect) { - if (oThis.dataSourceObj.rows[index].focus && oThis.options.cancelFocus) { - oThis.setRowUnFocus(index); - } else { - if (!oThis.dataSourceObj.rows[index].focus) { - oThis.setRowFocus(index); - } - } - } - if (oThis.options.contentSelect || !oThis.options.multiSelect) { - if (oThis.dataSourceObj.rows[index].checked && oThis.options.cancelSelect) { - oThis.setRowUnselect(index); - } else { - if (!oThis.dataSourceObj.rows[index].checked) { - oThis.setRowSelect(index); - } - } - } - } - } - }; - var clickFunTree = function clickFunTree(e) {}; - var clickFunEdit = function clickFunEdit(e) {}; - - var clickFunObj = exports.clickFunObj = { - isDblEvent: isDblEvent, - dblClickFun: dblClickFun, - clickFun: clickFun, - clickFunTree: clickFunTree, - clickFunEdit: clickFunEdit - }; - -/***/ }, -/* 20 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /* - * 更新最后数据行标识 - */ - var updateLastRowFlag = function updateLastRowFlag() { - // 共享服务加的,没有对应的css暂时去掉 - return; - var rows = $('#' + this.options.id + '_content_tbody').find('tr[role=row]'); - for (var i = 0, count = rows.length; i < count; i++) { - if (i == count - 1) $(rows[i]).addClass('last-row');else $(rows[i]).removeClass('last-row'); - } - }; - var updateNumColLastRowFlag = function updateNumColLastRowFlag() { - // 共享服务加的,没有对应的css暂时去掉 - return; - var numCols = $('#' + this.options.id + '_content_numCol').find('.u-grid-content-num'); - for (var i = 0, count = numCols.length; i < count; i++) { - if (i == count - 1) $(numCols[i]).addClass('last-row');else $(numCols[i]).removeClass('last-row'); - } - }; - - /* - * column是否显示处理,只在初始化gridCompColumn对象时调用,其他时候不再调用 - * 计算固定区域及内容区域的真实宽度 - * 计算第一列 - * 计算内容区域最后一列显示列 - */ - var columnsVisibleFun = function columnsVisibleFun() { - var oThis = this, - w = 0; - this.firstColumn = true; - this.overWidthVisibleColumnArr = new Array(); - $.each(this.gridCompColumnArr, function () { - if (this.options.visible) { - w += parseInt(this.options.width); - if (this.options.width > this.options.realWidth) { - oThis.overWidthVisibleColumnArr.push(this); - } - this.firstColumn = oThis.firstColumn; - oThis.firstColumn = false; - oThis.lastVisibleColumn = this; - oThis.lastVisibleColumnWidth = this.options.width; - } - }); - this.contentRealWidth = w; - }; - /* - * 创建完成之后处理变量 - */ - var resetThVariable = function resetThVariable() { - if (this.showType != 'grid') return; - var oThis = this; - this.contentWidth = 0; - - // 记录每列宽度及当前宽度之和 - $('#' + this.options.id + '_header_table th', this.$ele).each(function (i) { - //会出现th多于列的情况,发现问题之后再看下为什么 - var gridCompColumn = oThis.gridCompColumnArr[i]; - var w = 0; - if (gridCompColumn.options.visible) { - w = parseInt(gridCompColumn.options.width); - } - this.attrLeftTotalWidth = oThis.contentWidth; - oThis.contentWidth += w; - oThis.resetThVariableDrag(this, gridCompColumn, w); - this.gridCompColumn = gridCompColumn; - this.attrWidth = w; - this.attrRightTotalWidth = oThis.contentWidth; - }); - oThis.resetThVariableHeaderLevel(); - }; - var resetThVariableDrag = function resetThVariableDrag(nowTh, gridCompColumn) {}; - var resetThVariableHeaderLevel = function resetThVariableHeaderLevel() {}; - - /* - * 修改第一列的css - */ - var headerFirstClassFun = function headerFirstClassFun() { - $('#' + this.options.id + '_grid .u-grid-header-th-first').removeClass('u-grid-header-th-first'); - $('#' + this.options.id + '_grid').find('th').eq(0).addClass('u-grid-header-th-first'); - }; - - /* - * 根据filed设置renderType - */ - var setRenderType = function setRenderType(field, renderType) { - var gridCompColumn = this.getColumnByField(field); - gridCompColumn.options.renderType = renderType; - var index = this.getIndexOfColumn(gridCompColumn); - this.renderTypeByColumn(gridCompColumn, index); - }; - /* - * 设置是否显示header - */ - var setShowHeader = function setShowHeader(showHeader) { - this.options.showHeader = showHeader; - if (showHeader) { - $('#' + this.options.id + '_header').css('display', "block"); - } else { - $('#' + this.options.id + '_header').css('display', "none"); - } - }; - var setColumnPrecision = function setColumnPrecision(field, precision) { - var gridColumn = this.getColumnByField(field); - gridColumn.options.precision = precision; - this.renderTypeFun(); - if (this.options.showSumRow) { - this.repairSumRow(); - } - }; - var setMultiSelect = function setMultiSelect(multiSelect) { - var oldMultiSelect = this.options.multiSelect; - if (oldMultiSelect != multiSelect) { - this.options.multiSelect = multiSelect; - this.initGrid(); - } - }; - var setShowNumCol = function setShowNumCol(showNumCol) { - var oldShowNumCol = this.options.showNumCol; - if (oldShowNumCol != showNumCol) { - this.options.showNumCol = showNumCol; - this.initGrid(); - } - }; - var isGridShow = function isGridShow() { - if (this.showType == 'grid') return true; - return false; - }; - var getBoolean = function getBoolean(value) { - if (value === 'true' || value === true) return true; - return false; - }; - var otherFunObj = exports.otherFunObj = { - updateLastRowFlag: updateLastRowFlag, - updateNumColLastRowFlag: updateNumColLastRowFlag, - columnsVisibleFun: columnsVisibleFun, - resetThVariable: resetThVariable, - resetThVariableDrag: resetThVariableDrag, - resetThVariableHeaderLevel: resetThVariableHeaderLevel, - headerFirstClassFun: headerFirstClassFun, - setRenderType: setRenderType, - setShowHeader: setShowHeader, - setColumnPrecision: setColumnPrecision, - setMultiSelect: setMultiSelect, - setShowNumCol: setShowNumCol, - isGridShow: isGridShow, - getBoolean: getBoolean - }; - -/***/ }, -/* 21 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.utilFunOjb = undefined; - - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - - var _gridBrowser = __webpack_require__(5); - - /* - * 对宽度和高度进行处理 - */ - var formatWidth = function formatWidth(w) { - // 获得宽度 - if (w) { - return (w + "").indexOf("%") > 0 ? w : parseInt(w) + "px"; - } else { - return ''; - } - }; - /* - * 两个元素交换位置,要求传入参数e1在e2之前 - */ - var swapEle = function swapEle(e1, e2) { - var n = e1.next(), - p = e2.prev(); - e2.insertBefore(n); - e1.insertAfter(p); - }; - var getString = function getString(value, defaultValue) { - if (value === null || value === undefined || value === 'null' || value === 'undefined' || value === "") { - value = defaultValue; - } - if (_gridBrowser.gridBrowser.isIE8) { - return [value].join(""); - } else { - return value + ""; - } - }; - var getInt = function getInt(value, defaultValue) { - if (value === null || value === undefined || value === 'null' || value === 'undefined' || value === "" || isNaN(value)) { - value = defaultValue; - } - return value; - }; - var getFloat = function getFloat(value, defaultValue) { - if (value === null || value === undefined || value === 'null' || value === 'undefined' || value === "" || isNaN(value)) { - value = defaultValue; - } - return value; - }; - /* - * 克隆对象 - */ - var cloneObj = function cloneObj(obj) { - var o; - if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) == "object") { - if (obj === null) { - o = null; - } else { - if (obj instanceof Array) { - o = []; - for (var i = 0, len = obj.length; i < len; i++) { - o.push(this.cloneObj(obj[i])); - } - } else { - o = {}; - for (var k in obj) { - o[k] = this.cloneObj(obj[k]); - } - } - } - } else { - o = obj; - } - return o; - }; - /* - * 处理精度 - */ - var DicimalFormater = function DicimalFormater(obj) { - var value = obj.value + '', - precision = obj.precision; - for (var i = 0; i < value.length; i++) { - if ("-0123456789.".indexOf(value.charAt(i)) == -1) return ""; - } - return checkDicimalInvalid(value, precision); - }; - var checkDicimalInvalid = function checkDicimalInvalid(value, precision) { - if (value == null || isNaN(value)) return ""; - // 浮点数总位数不能超过10位 - var digit = parseFloat(value); - var result = (digit * Math.pow(10, precision) / Math.pow(10, precision)).toFixed(precision); - if (result == "NaN") return ""; - return result; - }; - var accAdd = function accAdd(v1, v2) { - var r1, r2, m; - try { - r1 = v1.toString().split('.')[1].length; - } catch (e) { - r1 = 0; - } - try { - r2 = v2.toString().split('.')[1].length; - } catch (e) { - r2 = 0; - } - m = Math.pow(10, Math.max(r1, r2)); - return (v1 * m + v2 * m) / m; - }; - var getTrIndex = function getTrIndex($tr) { - return $('tr[id!="' + this.options.id + '_edit_tr"]', $tr.parent()).index($tr); - }; - - var getDataTableRowIdByRow = function getDataTableRowIdByRow(row) { - return row.value['$_#_@_id']; - }; - - /** - * 按字节数截取字符串 例:"e我是d".nLen(4)将返回"e我" - */ - String.prototype.substrCH = function (nLen) { - var i = 0; - var j = 0; - while (i < nLen && j < this.length) { - // 循环检查制定的结束字符串位置是否存在中文字符 - var charCode = this.charCodeAt(j); - if (charCode > 256 && i == nLen - 1) { - break; - } - // else if(charCode >= 0x800 && charCode <= 0x10000){ - // i = i + 3; - // } - else if (charCode > 256) { - // 返回指定下标字符编码,大于265表示是中文字符 - i = i + 2; - } //是中文字符,那计数增加2 - else { - i = i + 1; - } //是英文字符,那计数增加1 - j = j + 1; - }; - return this.substr(0, j); - }; - - var utilFunOjb = exports.utilFunOjb = { - formatWidth: formatWidth, - swapEle: swapEle, - getString: getString, - getInt: getInt, - getFloat: getFloat, - cloneObj: cloneObj, - DicimalFormater: DicimalFormater, - accAdd: accAdd, - getTrIndex: getTrIndex, - getDataTableRowIdByRow: getDataTableRowIdByRow - }; - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.colMenu_initGridEventFun = exports.colMenu_initEventFun = exports.re_createColumnMenu = exports.colMenu_initGridCompColumn = exports.re_initGridCompColumnColumnMenuFun = undefined; - - var _gridCompEvent = __webpack_require__(4); - - var _gridCompInit = __webpack_require__(13); - - var re_initGridCompColumnColumnMenuFun = function re_initGridCompColumnColumnMenuFun(columnOptions) { - var column1 = new this.gridCompColumn(columnOptions, this); - column1.options.realWidth = column1.options.width; - this.basicGridCompColumnArr.push(column1); - }; - - var colMenu_initGridCompColumn = function colMenu_initGridCompColumn() { - // 扩展方法 - this.menuColumnsHeight = this.gridCompColumnArr.length * this.columnMenuHeight; - }; - - var re_createColumnMenu = function re_createColumnMenu() { - var oThis = this; - var htmlStr = '
'; - htmlStr += '
'; - - // 创建数据列区域 - - return htmlStr; - }; - - var colMenu_initEventFun = function colMenu_initEventFun() { - // 扩展方法 - var oThis = this; - $('#' + this.options.id).on('mouseup', function (e) { - if ($(e.target).closest('#' + oThis.options.id + '_header').length > 0) { - // 点击的是header区域 - oThis.mouseUpX = e.clientX; - oThis.mouseUpY = e.clientY; - //点击过程中鼠标没有移动 - if (oThis.mouseDownX == oThis.mouseUpX && oThis.mouseDownY == oThis.mouseUpY) { - //或者移动距离小于5px(由于移动之后会显示屏幕div,暂时不做处理) - oThis.columnClickX = e.clientX; - oThis.columnClickY = e.clientY; - var eleTh = $(e.target).closest('th')[0]; - if ($(e.target).hasClass('u-grid-header-columnmenu')) { - //点击的是columnmenu - $('#' + oThis.options.id + '_column_menu').css('display', 'block'); - - // 根据点击位置来显示column menu区域 - var left = e.clientX - 160; - if (left < 0) left = 0; - var top = e.clientY + 10; - $('#' + oThis.options.id + '_column_menu').css('left', left); - $('#' + oThis.options.id + '_column_menu').css('top', top); - /*数据列多的情况下处理显示的高度*/ - - var sX = $(window).width(); - var sH = $(window).height(); - - // 如果数据列高度高于屏幕高度则数据列高度设置为屏幕高度-10; - var columnsHeight = oThis.menuColumnsHeight; - if (oThis.menuColumnsHeight + top + 34 > sH) { - columnsHeight = sH - top - 34; - $('#' + oThis.options.id + '_column_menu_columns').css('height', columnsHeight + 'px'); - } else { - $('#' + oThis.options.id + '_column_menu_columns').css('height', ''); - } - oThis.ele.createColumnMenuFlag = true; - } else {} - } - } else if ($(e.target).closest('#' + oThis.options.id + '_content').length > 0) { - // 点击的是数据区域 - - } - }); - - $(document).on('click', function () { - if (oThis.columnMenuMove == false && oThis.ele.createColumnMenuFlag == false) { - if (oThis.ele.offsetWidth > 0) $('#' + oThis.options.id + '_column_menu').css('display', 'none'); - } - oThis.ele.createColumnMenuFlag = false; - }); - $(document).on('scroll', function () { - if (oThis.columnMenuMove == false && oThis.ele.createColumnMenuFlag == false) { - if (oThis.ele.offsetWidth > 0) $('#' + oThis.options.id + '_column_menu').css('display', 'none'); - } - oThis.ele.createColumnMenuFlag = false; - }); - }; - - var colMenu_initGridEventFun = function colMenu_initGridEventFun() { - // 扩展方法 - var oThis = this; - - /*header 按钮处理开始*/ - // column按钮 - $('#' + this.options.id + '_column_menu_ul').off('mousemove'); - $('#' + this.options.id + '_column_menu_ul').on('mousemove', function (e) { - oThis.columnMenuMove = true; - }); - $('#' + this.options.id + '_column_menu_ul').off('mouseout'); - $('#' + this.options.id + '_column_menu_ul').on('mouseout', function (e) { - oThis.columnMenuMove = false; - }); - - // 清除设置按钮 - $('#' + this.options.id + '_clearSet').off('click'); - $('#' + this.options.id + '_clearSet').on('click', function (e) { - oThis.clearLocalData(); - oThis.initGridCompColumn(); - oThis.hasNoScrollRest = false; - oThis.noScrollWidthReset(); - // 清除排序 - oThis.dataSourceObj.sortRows(); - oThis.repaintGridDivs(); - if (typeof oThis.options.onClearSetFun == 'function') { - oThis.options.onClearSetFun(oThis); - } - }); - // 显示/隐藏列 对应所有列的点击处理 - $('#' + this.options.id + '_column_menu_columns_ul li input').off('click'); - $('#' + this.options.id + '_column_menu_columns_ul li input').on('click', function (e) { - //待完善 优化与li的click的代码整合 - var index = $(this).closest('li').attr('index'); - - if (oThis.gridCompColumnArr[index].options.visible) { - $(this)[0].checked = false; - var ll = $('input:checked', $('#' + oThis.options.id + '_column_menu_columns_ul')).length; - if (ll == 0) { - $(this)[0].checked = true; - return; - } - - if (document.documentMode == 8) { - var oldScrollTop = $('#' + oThis.options.id + '_column_menu_columns')[0].scrollTop; - var oldTop = $('#' + oThis.options.id + '_column_menu')[0].style.top; - var oldLeft = $('#' + oThis.options.id + '_column_menu')[0].style.left; - oThis.gridCompColumnArr[index].options.visible = false; - oThis.repaintGridDivs(); - $('#' + oThis.options.id + '_column_menu').css('display', 'block'); - $('#' + oThis.options.id + '_column_menu').css('left', oldLeft); - $('#' + oThis.options.id + '_column_menu').css('top', oldTop); - $('#' + oThis.options.id + '_column_menu_columns')[0].scrollTop = oldScrollTop; - } else { - oThis.setColumnVisibleByIndex(index, false); - oThis.gridCompColumnArr[index].options.visible = false; - } - } else { - $(this)[0].checked = true; - - if (document.documentMode == 8) { - var oldScrollTop = $('#' + oThis.options.id + '_column_menu')[0].scrollTop; - var oldTop = $('#' + oThis.options.id + '_column_menu')[0].style.top; - var oldLeft = $('#' + oThis.options.id + '_column_menu')[0].style.left; - oThis.gridCompColumnArr[index].options.visible = true; - oThis.repaintGridDivs(); - $('#' + oThis.options.id + '_column_menu').css('display', 'block'); - $('#' + oThis.options.id + '_column_menu').css('left', oldLeft); - $('#' + oThis.options.id + '_column_menu').css('top', oldTop); - $('#' + oThis.options.id + '_column_menu_columns')[0].scrollTop = oldScrollTop; - } else { - oThis.setColumnVisibleByIndex(index, true); - oThis.gridCompColumnArr[index].options.visible = true; - } - } - oThis.saveGridCompColumnArrToLocal(); - e.stopPropagation(); - }); - $('#' + this.options.id + '_column_menu_columns_ul li').off('click'); - $('#' + this.options.id + '_column_menu_columns_ul li').on('click', function (e) { - var inputDom = $(this).find('input'); - inputDom.click(); - }); - /*header 按钮处理结束*/ - }; - - exports.re_initGridCompColumnColumnMenuFun = re_initGridCompColumnColumnMenuFun; - exports.colMenu_initGridCompColumn = colMenu_initGridCompColumn; - exports.re_createColumnMenu = re_createColumnMenu; - exports.colMenu_initEventFun = colMenu_initEventFun; - exports.colMenu_initGridEventFun = colMenu_initGridEventFun; - -/***/ }, -/* 23 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.dragFunObj = undefined; - - var _gridCompEvent = __webpack_require__(4); - - var re_createHeaderDrag = function re_createHeaderDrag() { - return '
'; - }; - - var drag_initEventFun = function drag_initEventFun() { - // 扩展方法 - var oThis = this; - - $('#' + this.options.id).on('mousemove', function (e) { - if ($(e.target).closest('#' + oThis.options.id + '_header').length > 0) { - // 在header区域移动 - var eleTh = $(e.target).closest('th')[0]; - // 将其他列的操作按钮隐藏,显示当前列的 - oThis.headerThDrag(e, eleTh); - } - - oThis.dragFun(e); - e.stopPropagation(); - }); - $('#' + this.options.id + '_top').on('mousemove', function (e) { - oThis.dragFun(e); - e.stopPropagation(); - }); - - $('#' + this.options.id).on('mouseup', function (e) { - oThis.dragEnd(e); - }); - - $('#' + this.options.id + '_top').on('mouseup', function (e) { - oThis.dragEnd(e); - }); - }; - - var drag_initGridEventFun = function drag_initGridEventFun() { - // 扩展方法 - var oThis = this; - $('#' + this.options.id + '_resize_handle').on('mousedown', function (e) { - oThis.dragStart(e); - return false; - }); - }; - /* - * 拖动开始 - */ - var dragStart = function dragStart(e) { - this.dragFlag = true; - this.dragW = null; - this.dragStartX = e.clientX; - }; - /* - * 改变列宽度处理 - */ - var dragFun = function dragFun(e) { - if (this.dragFlag) { - var nowTh = $('#' + this.options.id + '_resize_handle')[0].nowTh, - $nowTh = $(nowTh), - nowThIndex = $nowTh.attr('index'), - column = this.gridCompColumnArr[nowThIndex], - nowVisibleThIndex = this.getVisibleIndexOfColumn(column); - if (nowTh && column != this.lastVisibleColumn) { - this.dragEndX = e.clientX; - var changeWidth = parseInt(this.dragEndX) - parseInt(this.dragStartX), - newWidth = parseInt(nowTh.attrWidth) + parseInt(changeWidth), - cWidth = parseInt(this.contentWidth) + parseInt(changeWidth); - if (newWidth > this.minColumnWidth) { - if (this.options.noScroll) { - // 不显示滚动条的情况下,当前列的该变量对后面一列产生影响 - var nextVisibleThIndex = this.getNextVisibleInidexOfColumn(column); - if (nextVisibleThIndex > -1) { - var nextColumn = this.getColumnByVisibleIndex(nextVisibleThIndex); - if (!this.dragNextClomunWidth || this.dragNextClomunWidth < 0) this.dragNextClomunWidth = nextColumn.options.width; - } - var nextNewWidth = parseInt(this.dragNextClomunWidth) - parseInt(changeWidth); - if (!(nextNewWidth > this.minColumnWidth)) { - $('#' + this.options.id + '_top').css('display', 'block'); - return; - } - } - if (!this.options.noScroll) { - this.dragW = this.contentWidthChange(cWidth); - } - $('#' + this.options.id + '_header_table col:eq(' + nowVisibleThIndex + ')').css('width', newWidth + "px"); - $('#' + this.options.id + '_content_table col:eq(' + nowVisibleThIndex + ')').css('width', newWidth + "px"); - - column.options.width = newWidth; - column.options.realWidth = newWidth; - if (this.options.noScroll) { - $('#' + this.options.id + '_header_table col:eq(' + nextVisibleThIndex + ')').css('width', nextNewWidth + "px"); - $('#' + this.options.id + '_content_table col:eq(' + nextVisibleThIndex + ')').css('width', nextNewWidth + "px"); - nextColumn.options.width = nextNewWidth; - nextColumn.options.realWidth = nextNewWidth; - } - } - } - $('#' + this.options.id + '_top').css('display', 'block'); - } - }; - /* - * 拖动结束 - */ - var dragEnd = function dragEnd(e) { - if (this.dragFlag) { - this.resetThVariable(); - this.saveGridCompColumnArrToLocal(); - } - this.dragNextClomunWidth = -1; - this.lastVisibleColumn.options.width = this.lastVisibleColumnWidth; - if (this.dragW) this.contentWidth = this.dragW; - $('#' + this.options.id + '_resize_handle')[0].nowTh = null; - this.dragFlag = false; - $('#' + this.options.id + '_top').css('display', 'none'); - }; - - /* - * 计算拖动div所在位置 - */ - var headerThDrag = function headerThDrag(e, ele) { - if (!this.dragFlag && !this.swapColumnFlag && ele && ele.gridCompColumn && ele.gridCompColumn.options.canDrag && $('#' + this.options.id + '_resize_handle')[0].nowTh != ele) { - var $ele = $(ele); - $('#' + this.options.id + '_resize_handle').css('left', ele.attrRightTotalWidth - this.scrollLeft - 4 + this.leftW + this.fixedWidth); - $('#' + this.options.id + '_resize_handle')[0].nowTh = ele; - } - }; - var re_resetThVariableDrag = function re_resetThVariableDrag(nowTh, gridCompColumn, width) { - if (!$('#' + this.options.id + '_resize_handle')[0].nowTh && gridCompColumn.options.canDrag) { - $('#' + this.options.id + '_resize_handle').css('left', width - 4 + this.leftW); - $('#' + this.options.id + '_resize_handle')[0].nowTh = nowTh; - } - }; - var dragFunObj = exports.dragFunObj = { - createHeaderDrag: re_createHeaderDrag, - dragStart: dragStart, - dragFun: dragFun, - dragEnd: dragEnd, - headerThDrag: headerThDrag, - resetThVariableDrag: re_resetThVariableDrag, - drag_initEventFun: drag_initEventFun, - drag_initGridEventFun: drag_initGridEventFun - }; - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.editFromFunObj = undefined; - - var _gridCompInit = __webpack_require__(13); - - var editForm_initDefault = function editForm_initDefault() { - // 扩展方法 - this.defaults = $.extend(true, {}, this.defaults, { - noneEditableFormShow: true }); - }; - - var editForm_setRequired = function editForm_setRequired(field, value) { - // 扩展方法 - var oThis = this; - $.each(this.gridCompColumnArr, function (i) { - if (this.options.field == field) { - this.options.required = value; - if (!value) { - $('#' + oThis.options.id + '_edit_' + this.options.field).parent().find('.u-grid-edit-mustFlag').hide(); - } else { - $('#' + oThis.options.id + '_edit_' + this.options.field).parent().find('.u-grid-edit-mustFlag').show(); - } - } - }); - }; - - var re_editorRowChangeFun = function re_editorRowChangeFun() { - if ($('#' + this.options.id + '_edit_form').length > 0) { - var h = $('#' + this.options.id + '_edit_form')[0].offsetHeight; - $('#' + this.options.id + '_numCol_edit').css('height', h); - $('#' + this.options.id + '_multiSelect_edit').css('height', h); - } - }; - /* - * form形式下编辑单元格 - */ - var formEditCell = function formEditCell(value, field, title, required, headerColor) { - // 创建lable - var st = title + ''; - if (st.lengthb() > 28) { - st = st.substrCH(26) + '...'; - } - var htmlStr = '
' + st + '*
'; // 创建编辑区域 - htmlStr += '
'; - htmlStr += '
'; - return htmlStr; - }; - var editFromFunObj = exports.editFromFunObj = { - editForm_initDefault: editForm_initDefault, - editForm_setRequired: editForm_setRequired, - editorRowChangeFun: re_editorRowChangeFun, - formEditCell: formEditCell - }; - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.fixFunObj = undefined; - - var _gridCompOther = __webpack_require__(20); - - /* - * 将固定列放入gridCompColumnFixedArr - */ - var re_initGridCompFixedColumn = function re_initGridCompFixedColumn() { - var oThis = this; - var w = 0; - $.each(this.gridCompColumnArr, function (i) { - if (this.options.fixed == true) { - oThis.gridCompColumnFixedArr.push(this); - } - }); - $.each(this.gridCompColumnFixedArr, function (i) { - for (var i = oThis.gridCompColumnArr.length; i > -1; i--) { - if (oThis.gridCompColumnArr[i] == this) { - oThis.gridCompColumnArr.splice(i, 1); - break; - } - } - }); - }; - - var fixed_columnsVisibleFun = function fixed_columnsVisibleFun() { - // 扩展方法 - var oThis = this, - fixW = 0; - $.each(this.gridCompColumnFixedArr, function () { - if (this.options.visible) { - fixW += parseInt(this.options.width); - this.firstColumn = oThis.firstColumn; - oThis.firstColumn = false; - } - }); - this.fixedRealWidth = fixW; - }; - - var re_createHeaderTableFixed = function re_createHeaderTableFixed() { - return this.createHeaderTable('fixed'); - }; - - var re_createContentTableFixed = function re_createContentTableFixed() { - return this.createContentTable('fixed'); - }; - var re_createContentOneRowFixed = function re_createContentOneRowFixed(rowObj) { - return this.createContentOneRow(rowObj, 'fixed'); - }; - var re_widthChangeGridFunFixed = function re_widthChangeGridFunFixed(halfWholeWidth) { - // 固定区域宽度不大于整体宽度的一半 - if (this.fixedRealWidth > halfWholeWidth) { - this.fixedWidth = halfWholeWidth; - } else { - this.fixedWidth = this.fixedRealWidth; - } - }; - var fixFunObj = exports.fixFunObj = { - initGridCompFixedColumn: re_initGridCompFixedColumn, - fixed_columnsVisibleFun: fixed_columnsVisibleFun, - createHeaderTableFixed: re_createHeaderTableFixed, - createContentTableFixed: re_createContentTableFixed, - createContentOneRowFixed: re_createContentOneRowFixed, - widthChangeGridFunFixed: re_widthChangeGridFunFixed - }; - -/***/ }, -/* 26 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /* - * 创建form形式下div - */ - var createFromDivs = function createFromDivs() { - if (this.createFormFlag) { - return; - } - var htmlStr = '
'; - htmlStr += this.createFromContent(); - $('#' + this.options.id)[0].insertAdjacentHTML('afterBegin', htmlStr); - this.createFormFlag = true; - }; - - /* - * 创建form形式下内容区域 - */ - var createFromContent = function createFromContent() { - var htmlStr = '
'; - htmlStr += ''; - htmlStr += this.createFormContentRows(); - htmlStr += '
'; - return htmlStr; - }; - - /* - * 创建form形式下内容区域所有行 - */ - var createFormContentRows = function createFormContentRows() { - var oThis = this, - htmlStr = ""; - // 遍历生成所有行 - if (this.dataSourceObj.rows) { - htmlStr += ''; - $.each(this.dataSourceObj.rows, function () { - htmlStr += ''; - var value = this.value; - $.each(oThis.gridCompColumnArr, function () { - var f = this.options.field, - t = this.options.title, - v = $(value).attr(f); - htmlStr += '
' + t + ':
'; - htmlStr += '
' + v + '
'; - }); - htmlStr += ''; - }); - htmlStr += ''; - } - return htmlStr; - }; - - /* - * 整体宽度改变处理(form形式) - */ - var widthChangeFormFun = function widthChangeFormFun() { - this.createFromDivs(); - $('#' + this.options.id + '_grid').css('display', 'none'); - $('#' + this.options.id + '_form').css('display', 'block'); - this.showType = 'form'; - if (typeof this.options.afterCreate == 'function') { - this.options.afterCreate.call(this); - } - }; - var formShowFunOjb = exports.formShowFunOjb = { - createFromDivs: createFromDivs, - createFromContent: createFromContent, - createFormContentRows: createFormContentRows, - widthChangeFormFun: widthChangeFormFun - }; - -/***/ }, -/* 27 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var re_resetThVariableHeaderLevel = function re_resetThVariableHeaderLevel() { - var oThis = this, - oldParentHeaderStr = '', - parentWidth = 0, - maxHeaderLevel = this.options.maxHeaderLevel, - columnWidthArr = []; - // 遍历所有已经创建的th创建对象记录column的width - $('#' + this.options.id + '_header_table th', this.$ele).each(function (i) { - var gridCompColumn = oThis.gridCompColumnArr[i]; - var field = gridCompColumn.options.field; - var w = 0; - if (gridCompColumn.options.visible) { - w = parseInt(gridCompColumn.options.width); - } - var obj = { - field: field, - width: w - }; - columnWidthArr.push(obj); - }); - // 遍历所有headerLevel > 1的column,创建div并设置top及width值 - var firstColumnField = this.getColumnByVisibleIndex(0).options.field; - for (var i = 0; i < this.gridCompLevelColumn.length; i++) { - var column = this.gridCompLevelColumn[i]; - var field = column.field; - var title = column.title; - var startField = column.startField; - var endField = column.endField; - var startTh = $('th[field=' + startField + ']', this.$ele.find('#' + this.options.id + '_header_thead')); - var styleStr = ' style="'; - var classStr = ''; - var headerLevel = column.headerLevel; - var top = (parseInt(maxHeaderLevel) - parseInt(headerLevel)) * this.baseHeaderHeight; - styleStr += 'top:' + top + 'px;z-index:' + headerLevel + ';'; - var width = 0; - var startFlag = false; - for (var j = 0; j < columnWidthArr.length; j++) { - var nowColumn = columnWidthArr[j]; - var nowField = nowColumn.field; - if (nowField == startField || startFlag) { - startFlag = true; - width += nowColumn.width; - if (nowField == endField) { - break; - } - } - } - styleStr += 'width:' + width + 'px;'; - styleStr += '" '; - if (firstColumnField == startField) { - classStr += ' grid-no-left-border '; - } - if (maxHeaderLevel == headerLevel) { - classStr += ' grid-max-level-div '; - } - var htmlStr = '
'; - startTh[0].insertAdjacentHTML('afterBegin', htmlStr); - } - }; - - var re_initGridCompColumnHeaderLevelFun = function re_initGridCompColumnHeaderLevelFun(columnOptions) { - // 扩展方法 - if (columnOptions.headerLevel > 1) { - this.gridCompLevelColumn.push(columnOptions); - var oldLength = this.gridCompColumnArr.length; - this.gridCompColumnArr.length = oldLength - 1; - if (this.basicGridCompColumnArr && this.basicGridCompColumnArr.length > 0) { - this.basicGridCompColumnArr.length = oldLength - 1; - } - } - }; - /* - * 按照hiddenLevel对column进行排序 - */ - var initGridHiddenLevelColumn = function initGridHiddenLevelColumn() { - if (!this.options.overWidthHiddenColumn) return; - var oThis = this; - var w = 0; - - this.gridCompHiddenLevelColumnArr = this.gridCompColumnArr.slice(0); - - this.gridCompHiddenLevelColumnArr.sort(function (a, b) { - var hiddenLevel1 = a.options.hiddenLevel; - var hiddenLevel2 = b.options.hiddenLevel; - if (hiddenLevel1 > hiddenLevel2) { - return -1; - } else { - return 1; - } - }); - }; - - var getLevelTitleByField = function getLevelTitleByField(field) { - for (var i = 0; i < this.gridCompLevelColumn.length; i++) { - var columnField = this.gridCompLevelColumn[i].field; - if (columnField == field) { - return this.gridCompLevelColumn[i].title; - } - } - return ''; - }; - var headerLevelFunObj = exports.headerLevelFunObj = { - resetThVariableHeaderLevel: re_resetThVariableHeaderLevel, - initGridCompColumnHeaderLevelFun: re_initGridCompColumnHeaderLevelFun, - // initGridHiddenLevelColumn : initGridHiddenLevelColumn, - getLevelTitleByField: getLevelTitleByField - }; - -/***/ }, -/* 28 */ -/***/ function(module, exports) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var re_initGridCompColumnLoacl = function re_initGridCompColumnLoacl() { - var oThis = this, - localGridCompColumnArr = this.getGridCompColumnArrFromLocal(); - // 获取本地缓存中的数据 - if (localGridCompColumnArr != null) { - this.gridCompColumnArr = localGridCompColumnArr; - $.each(this.gridCompColumnArr, function () { - var field = this.options.field; - for (var i = 0; i < oThis.options.columns.length; i++) { - var c = oThis.options.columns[i]; - if (c.field == field) { - var options = $.extend({}, c, this.options); - this.options = options; - this.options.realWidth = this.options.width; - break; - } - } - }); - } - }; - /* - * 获取本地个性化存储的设置 - */ - var getLocalData = function getLocalData() { - if (!this.options.needLocalStorage) return null; - if (window.localStorage == null) return null; - if (this.$sd_storageData != null) return this.$sd_storageData;else { - if (window.localStorage.getItem(this.localStorageId) == null) { - try { - window.localStorage.setItem(this.localStorageId, "{}"); - } catch (e) { - return null; - } - } - var storageDataStr = window.localStorage.getItem(this.localStorageId); - if (typeof JSON == "undefined") this.$sd_storageData = eval("(" + storageDataStr + ")");else this.$sd_storageData = JSON.parse(storageDataStr); - return this.$sd_storageData; - } - }; - /* - * 保存本地个性化存储的设置 - */ - var saveLocalData = function saveLocalData() { - if (!this.options.needLocalStorage) return null; - var oThis = this; - if (this.saveSettimeout) { - clearTimeout(this.saveSettimeout); - } - this.saveSettimeout = setTimeout(function () { - if (oThis.$sd_storageData == null || window.localStorage == null) return; - var strogeDataStr = JSON.stringify(oThis.$sd_storageData); - try { - window.localStorage.setItem(oThis.localStorageId, strogeDataStr); - } catch (e) {} - }, 200); - }; - /* - * 清除本地个性化存储的设置 - */ - var clearLocalData = function clearLocalData() { - if (!this.options.needLocalStorage) return null; - if (this.saveSettimeout) { - clearTimeout(this.saveSettimeout); - } - window.localStorage.setItem(this.localStorageId, "{}"); - this.$sd_storageData = {}; - }; - /* - * 将数据列顺序保存至本地个性化存储 - */ - var saveGridCompColumnArrToLocal = function saveGridCompColumnArrToLocal() { - if (!this.options.needLocalStorage) return null; - var defData = this.getLocalData(); - defData["gridCompColumnArr"] = this.gridCompColumnArr.concat(this.gridCompColumnFixedArr); - this.saveLocalData(); - }; - /* - * 从本地个性化存储中取出数据列顺序 - */ - var getGridCompColumnArrFromLocal = function getGridCompColumnArrFromLocal() { - if (!this.options.needLocalStorage) return null; - var defData = this.getLocalData(); - if (defData == null) return null; - if (defData["gridCompColumnArr"] == null) return null; - return defData["gridCompColumnArr"]; - }; - var localStorageFunObj = exports.localStorageFunObj = { - initGridCompColumnLoacl: re_initGridCompColumnLoacl, - getLocalData: getLocalData, - saveLocalData: saveLocalData, - clearLocalData: clearLocalData, - saveGridCompColumnArrToLocal: saveGridCompColumnArrToLocal, - getGridCompColumnArrFromLocal: getGridCompColumnArrFromLocal - }; - -/***/ }, -/* 29 */ -/***/ function(module, exports) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var re_initGridHiddenLevelColumn = function re_initGridHiddenLevelColumn() { - if (!this.options.overWidthHiddenColumn) return; - var oThis = this; - var w = 0; - - this.gridCompHiddenLevelColumnArr = this.gridCompColumnArr.slice(0); - - this.gridCompHiddenLevelColumnArr.sort(function (a, b) { - var hiddenLevel1 = a.options.hiddenLevel; - var hiddenLevel2 = b.options.hiddenLevel; - if (hiddenLevel1 > hiddenLevel2) { - return -1; - } else { - return 1; - } - }); - }; - var re_widthChangeGridFunOverWidthHidden = function re_widthChangeGridFunOverWidthHidden() { - if (this.options.overWidthHiddenColumn) { - this.lastVisibleColumn.options.width = this.lastVisibleColumn.options.realWidth; - var wholeWidth = parseInt(this.wholeWidth) - parseInt(this.leftW); - var columnWholeWidth = parseInt(this.fixedWidth) + parseInt(this.contentRealWidth); - if (columnWholeWidth > wholeWidth) { - for (var i = 0; i < this.gridCompHiddenLevelColumnArr.length; i++) { - var column = this.gridCompHiddenLevelColumnArr[i]; - if (column.options.visible) { - column.options.visible = false; - columnWholeWidth = parseInt(columnWholeWidth) - parseInt(column.options.width); - } - if (!(columnWholeWidth > wholeWidth)) { - break; - } - } - this.columnsVisibleFun(); - } else { - for (var i = this.gridCompHiddenLevelColumnArr.length - 1; i > -1; i--) { - var column = this.gridCompHiddenLevelColumnArr[i]; - if (!column.options.visible) { - columnWholeWidth = parseInt(columnWholeWidth) + parseInt(column.options.width); - if (columnWholeWidth > wholeWidth) { - break; - } - column.options.visible = true; - } - } - this.columnsVisibleFun(); - } - } - }; - var overWidthHiddenFunObj = exports.overWidthHiddenFunObj = { - initGridHiddenLevelColumn: re_initGridHiddenLevelColumn, - widthChangeGridFunOverWidthHidden: re_widthChangeGridFunOverWidthHidden - }; - -/***/ }, -/* 30 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var re_createContentRowsSumRow = function re_createContentRowsSumRow(createFlag) { - var htmlStr = ''; - if (this.options.showSumRow && this.dataSourceObj.rows && this.dataSourceObj.rows.length > 0) { - htmlStr += this.createSumRow(createFlag); - } - return htmlStr; - }; - var re_createContentSumRow = function re_createContentSumRow(bottonStr) { - var htmlStr = ''; - // if(this.options.showSumRow){ - // htmlStr += '
'; - // htmlStr += '
'; - // } - return htmlStr; - }; - /* - * 创建合计行 - */ - var createSumRow = function createSumRow(createFlag) { - if (this.options.showSumRow) { - var oThis = this, - idStr, - gridCompColumnArr; - if (createFlag == 'fixed') { - idStr = 'fixed_'; - gridCompColumnArr = this.gridCompColumnFixedArr; - } else { - idStr = ''; - gridCompColumnArr = this.gridCompColumnArr; - } - var t = parseInt(this.wholeHeight) - this.exceptContentHeight - 48 - this.scrollBarHeight; - t = t > 0 ? t : 0; - var htmlStr = ''; - $.each(gridCompColumnArr, function () { - var f = this.options.field; - var precision = this.options.precision; - var dataType = this.options.dataType; - var sumValue = oThis.dataSourceObj.getSumValue(f, this, oThis); - if (dataType == 'float') { - var o = {}; - o.value = sumValue; - o.precision = precision ? precision : 2; - sumValue = oThis.DicimalFormater(o); - } - var tdStyle = ''; - if (!this.options.visible) { - tdStyle = 'style="display:none;"'; - } - htmlStr += ''; - if (this.firstColumn) { - htmlStr += '
' + oThis.transMap.ml_sum + '
'; - } - var contentStyle = ''; - if (this.options.dataType == 'integer' || this.options.dataType == 'float') { - contentStyle = 'style="text-align: right;"'; - } - htmlStr += '
' + sumValue + '
'; - }); - htmlStr += ''; - return htmlStr; - } - }; - - /* - * 创建合计行 for ie - */ - var createSumRowForIE = function createSumRowForIE(table, createFlag) { - if (this.options.showSumRow) { - var oThis = this, - idStr, - gridCompColumnArr; - if (createFlag == 'fixed') { - idStr = 'fixed_'; - gridCompColumnArr = this.gridCompColumnFixedArr; - } else { - idStr = ''; - gridCompColumnArr = this.gridCompColumnArr; - } - var t = parseInt(this.wholeHeight) - this.exceptContentHeight - 48 - this.scrollBarHeight; - t = t > 0 ? t : 0; - var row = table.insertRow(); - row.row = 'row'; - row.className = 'u-grid-content-sum-row'; - row.id = this.options.id + '_content_' + idStr + 'sum_row'; - row.style.top = t + 'px'; - $.each(gridCompColumnArr, function () { - var f = this.options.field; - var precision = this.options.precision; - var dataType = this.options.dataType; - var sumValue = oThis.dataSourceObj.getSumValue(f, this, oThis); - if (dataType == 'float') { - var o = {}; - o.value = sumValue; - o.precision = precision ? precision : 2; - sumValue = oThis.DicimalFormater(o); - } - var newCell = row.insertCell(); - newCell.role = 'rowcell'; - newCell.title = sumValue; - var contentStyle = ''; - if (this.options.dataType == 'integer' || this.options.dataType == 'float') { - contentStyle = 'style="text-align: right;"'; - } - - var htmlStr = '
'; - if (this.firstColumn) { - htmlStr += '
' + oThis.transMap.ml_sum + '
'; - } - htmlStr += '' + sumValue + '
'; - newCell.insertAdjacentHTML('afterBegin', htmlStr); - }); - } - }; - /* - * 重画合计行 - */ - var re_repairSumRow = function re_repairSumRow() { - var self = this; - if (this.re_repairSumRowSetTimeout) clearTimeout(this.re_repairSumRowSetTimeout); - this.re_repairSumRowSetTimeout = setTimeout(function () { - re_repairSumRowFun.call(self); - }, 100); - }; - - var re_repairSumRowFun = function re_repairSumRowFun() { - if (this.options.showSumRow) { - $('#' + this.options.id + '_content_div tbody .u-grid-content-sum-row').remove(); - $('#' + this.options.id + '_content_fixed_div tbody .u-grid-content-sum-row').remove(); - try { - if (this.dataSourceObj.rows && this.dataSourceObj.rows.length > 0) { - var htmlStr = this.createSumRow(); - $('#' + this.options.id + '_content_div tbody')[0].insertAdjacentHTML('beforeEnd', htmlStr); - var htmlStr = this.createSumRow('fixed'); - if ($('#' + this.options.id + '_content_fixed_div tbody')[0]) $('#' + this.options.id + '_content_fixed_div tbody')[0].insertAdjacentHTML('beforeEnd', htmlStr); - } - } catch (e) { - var table = $('#' + this.options.id + '_content_div table')[0]; - var fixedTable = $('#' + this.options.id + '_content_fixed_div table')[0]; - this.createSumRowForIE(table); - this.createSumRowForIE(table, 'fixed'); - } - this.renderSumRow(); - } - }; - - var renderSumRow = function renderSumRow() { - var oThis = this; - $.each(this.gridCompColumnFixedArr, function (i) { - var sumCol = this.options.sumCol; - var sumRenderType = this.options.sumRenderType; - var idStr = 'fixed_'; - if (sumCol) { - var sumSpans = $('#' + oThis.options.id + '_content_' + idStr + 'sum_row').find('td').eq(i).find('span'); - var sumSpan = sumSpans[sumSpans.length - 1]; - if (sumSpan) { - if (typeof sumRenderType == 'function') { - var sumV = $(sumSpan).attr('value'); - var obj = {}; - obj.value = sumV; - obj.element = sumSpan; - obj.gridObj = oThis; - obj.gridCompColumn = this; - sumRenderType.call(oThis, obj); - } else if (dataType == 'integer' || dataType == 'float') { - sumSpan.style.textAlign = 'right'; - } - } - } - }); - $.each(this.gridCompColumnArr, function (i) { - var sumCol = this.options.sumCol; - var dataType = this.options.dataType; - var sumRenderType = this.options.sumRenderType; - var idStr = ''; - if (sumCol) { - var sumSpans = $('#' + oThis.options.id + '_content_' + idStr + 'sum_row').find('td').eq(i).find('span'); - var sumSpan = sumSpans[sumSpans.length - 1]; - if (sumSpan) { - if (typeof sumRenderType == 'function') { - var sumV = $(sumSpan).attr('value'); - var obj = {}; - obj.value = sumV; - obj.element = sumSpan; - obj.gridObj = oThis; - obj.gridCompColumn = this; - sumRenderType.call(oThis, obj); - } else if (dataType == 'integer' || dataType == 'float') { - sumSpan.style.textAlign = 'right'; - } - } - } - }); - }; - - var re_renderTypeSumRow = function re_renderTypeSumRow(gridCompColumn, i, begin, length, isFixedColumn) { - var oThis = this; - var sumCol = gridCompColumn.options.sumCol; - var sumRenderType = gridCompColumn.options.sumRenderType; - var dataType = gridCompColumn.options.dataType; - var idStr = isFixedColumn === true ? 'fixed_' : ''; - if (sumCol) { - var sumSpans = $('#' + this.options.id + '_content_' + idStr + 'sum_row').find('td').eq(i).find('span'); - var sumSpan = sumSpans[sumSpans.length - 1]; - if (sumSpan) { - if (typeof sumRenderType == 'function') { - var sumV = $(sumSpan).attr('value'); - var obj = {}; - obj.value = sumV; - obj.element = sumSpan; - obj.gridObj = oThis; - obj.gridCompColumn = gridCompColumn; - sumRenderType.call(oThis, obj); - } else if (dataType == 'integer' || dataType == 'float') { - sumSpan.style.textAlign = 'right'; - } - } - } - }; - - // 增加预制render - window.maxSumRender = function maxSumRender(opt) { - var gridComp = opt.gridObj; - var gridCompColumn = opt.gridCompColumn; - var field = gridCompColumn.options.field; - var element = opt.element; - var nowMax; - $.each(gridComp.dataSourceObj.rows, function (i) { - var v = $(this.value).attr(field); - if (gridCompColumn.options.dataType == 'Int') { - v = gridComp.getInt(v, 0); - } else { - v = gridComp.getFloat(v, 0); - } - if (typeof nowMax == 'undefined') { - nowMax = v; - } else { - if (v > nowMax) nowMax = v; - } - }); - - // 处理精度 - if (gridCompColumn.options.dataType == 'Float' && gridCompColumn.options.precision) { - var o = {}; - o.value = nowMax; - o.precision = gridCompColumn.options.precision; - nowMax = gridComp.DicimalFormater(o); - } - - element.innerHTML = nowMax + ''; - }; - window.minSumRender = function minSumRender(opt) { - var gridComp = opt.gridObj; - var gridCompColumn = opt.gridCompColumn; - var field = gridCompColumn.options.field; - var element = opt.element; - var nowMax; - $.each(gridComp.dataSourceObj.rows, function (i) { - var v = $(this.value).attr(field); - if (gridCompColumn.options.dataType == 'Int') { - v = gridComp.getInt(v, 0); - } else { - v = gridComp.getFloat(v, 0); - } - if (typeof nowMax == 'undefined') { - nowMax = v; - } else { - if (v < nowMax) nowMax = v; - } - }); - - // 处理精度 - if (gridCompColumn.options.dataType == 'Float' && gridCompColumn.options.precision) { - var o = {}; - o.value = nowMax; - o.precision = gridCompColumn.options.precision; - nowMax = gridComp.DicimalFormater(o); - } - element.innerHTML = nowMax + ''; - }; - window.avgSumRender = function avgSumRender(opt) { - var sumValue = opt.value; - var gridComp = opt.gridObj; - var gridCompColumn = opt.gridCompColumn; - var element = opt.element; - var l = gridComp.dataSourceObj.rows.length; - var avgValue = sumValue / l; - - // 处理精度 - if (gridCompColumn.options.dataType == 'Float' && gridCompColumn.options.precision) { - var o = {}; - o.value = avgValue; - o.precision = gridCompColumn.options.precision; - avgValue = gridComp.DicimalFormater(o); - } - element.innerHTML = avgValue + ''; - }; - - var sumRowFunObj = exports.sumRowFunObj = { - createContentRowsSumRow: re_createContentRowsSumRow, - createContentSumRow: re_createContentSumRow, - createSumRow: createSumRow, - createSumRowForIE: createSumRowForIE, - repairSumRow: re_repairSumRow, - renderSumRow: renderSumRow, - renderTypeSumRow: re_renderTypeSumRow - }; - -/***/ }, -/* 31 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.swapFunObj = undefined; - - var _gridCompEvent = __webpack_require__(4); - - var swap_initEventFun = function swap_initEventFun() { - // 扩展方法 - var oThis = this; - $('#' + this.options.id).on('mousedown', function (e) { - if ($(e.target).closest('#' + oThis.options.id + '_header').length > 0) { - // 点击的是header区域 - var eleTh = $(e.target).closest('th')[0]; - if (oThis.options.canSwap) { - oThis.swapColumnStart(e, eleTh); - } - e.preventDefault(); - } else if ($(e.target).closest('#' + oThis.options.id + '_content').length > 0) { - // 点击的是数据区域 - } - }); - - $('#' + this.options.id).on('mousemove', function (e) { - oThis.mouseMoveX = e.clientX; - oThis.mouseMoveY = e.clientY; - if ((oThis.mouseMoveX != oThis.mouseDownX || oThis.mouseDownY != oThis.mouseMoveY) && oThis.mouseDownX != 'mouseDownX' && oThis.options.canSwap) { - // 鼠标按下之后移动了 - oThis.swapColumnFlag = true; - } - oThis.swapColumnFun(e); - e.stopPropagation(); - }); - - $('#' + this.options.id + '_top').on('mousemove', function (e) { - oThis.mouseMoveX = e.clientX; - oThis.mouseMoveY = e.clientY; - if ((oThis.mouseMoveX != oThis.mouseDownX || oThis.mouseDownY != oThis.mouseMoveY) && oThis.mouseDownX != 'mouseDownX' && oThis.options.canSwap) { - // 鼠标按下之后移动了 - oThis.swapColumnFlag = true; - } - oThis.swapColumnFun(e); - e.stopPropagation(); - }); - - $('#' + this.options.id).on('mouseup', function (e) { - oThis.mouseUpX = e.clientX; - oThis.mouseUpY = e.clientY; - oThis.swapColumnEnd(e); - oThis.mouseUpX = 'mouseUpX'; - oThis.mouseUpY = 'mouseUpY'; - oThis.mouseDownX = 'mouseDownX'; - oThis.mouseDownY = 'mouseDownY'; - oThis.mouseMoveX = 'mouseMoveX'; - oThis.mouseMoveY = 'mouseMoveY'; - }); - - $('#' + this.options.id + '_top').on('mouseup', function (e) { - oThis.mouseUpX = e.clientX; - oThis.mouseUpY = e.clientY; - oThis.swapColumnEnd(e); - oThis.mouseUpX = 'mouseUpX'; - oThis.mouseUpY = 'mouseUpY'; - oThis.mouseDownX = 'mouseDownX'; - oThis.mouseDownY = 'mouseDownY'; - oThis.mouseMoveX = 'mouseMoveX'; - oThis.mouseMoveY = 'mouseMoveY'; - }); - }; - - var swap_initGridEventFun = function swap_initGridEventFun() { - // 扩展方法 - var oThis = this; - }; - - /* - * 交换列位置开始,并不修改swapColumnFlag,当移动的时候才修改swapColumnFlag - */ - var swapColumnStart = function swapColumnStart(e, ele) { - if (!this.options.canSwap) { - return; - } - this.swapColumnEle = ele; - this.swapColumnStartX = e.clientX; - this.swapColumnStartY = e.clientY; - }; - /* - * 交换位置 - */ - var swapColumnFun = function swapColumnFun(e) { - if (!this.options.canSwap) { - return; - } - var oThis = this; - if (this.swapColumnFlag) { - var nowTh = this.swapColumnEle; - if (!nowTh) { - return; - } - var $nowTh = $(nowTh); - if (!nowTh.gridCompColumn) { - return; - } - var nowGridCompColumn = nowTh.gridCompColumn; - //创建拖动区域 - if ($('#' + this.options.id + '_clue').length == 0) { - var $d = $('
').css({ - width: nowTh.scrollWidth + "px", - left: nowTh.attrLeftTotalWidth - oThis.scrollLeft + oThis.leftW + oThis.fixedWidth + "px", - top: "0px", - paddingLeft: $nowTh.css("paddingLeft"), - paddingRight: $nowTh.css("paddingRight"), - lineHeight: $nowTh.height() + "px", - paddingTop: $nowTh.css("paddingTop"), - paddingBottom: $nowTh.css("paddingBottom") - }).html(nowGridCompColumn.options.title || nowGridCompColumn.options.field).prepend(''); - try { - $('#' + this.options.id)[0].insertAdjacentElement('afterBegin', $d[0]); - } catch (e) { - $('#' + this.options.id)[0].insertBefore($d[0], $('#' + this.options.id)[0].firstChild); - } - $d.on('mousemove', function () { - e.stopPropagation(); - }); - } - this.swapColumnEndX = e.clientX; - this.swapColumnEndY = e.clientY; - var changeX = this.swapColumnEndX - this.swapColumnStartX, - changeY = this.swapColumnEndY - this.swapColumnStartY; - $('#' + this.options.id + '_clue').css({ - left: nowTh.attrLeftTotalWidth + changeX - oThis.scrollLeft + oThis.leftW + oThis.fixedWidth + "px", - top: changeY + "px" - }); - - // 创建提示div - if ($('#' + this.options.id + '_swap_top').length == 0) { - var $d = $(''); - $d.css({ - top: $nowTh.height() - 6 + 'px' - }); - var $d1 = $(''); - $d1.css({ - top: '6px' - }); - try { - $('#' + this.options.id)[0].insertAdjacentElement('afterBegin', $d[0]); - $('#' + this.options.id)[0].insertAdjacentElement('afterBegin', $d1[0]); - } catch (e) { - $('#' + this.options.id)[0].insertBefore($d[0], $('#' + this.options.id)[0].firstChild); - $('#' + this.options.id)[0].insertBefore($d1[0], $('#' + this.options.id)[0].firstChild); - } - } - this.canSwap = false; - $('#' + this.options.id + '_header_table th').each(function (i) { - var left = $(this).offset().left, - right = left + parseInt(this.attrWidth); - if (i == 0 && e.clientX < left) { - // 移动到最左边 - if (oThis.swapColumnEle != this) { - oThis.swapToColumnEle = 'LeftEle'; - $('#' + oThis.options.id + '_swap_top').css({ - left: -oThis.scrollLeft - 3 + oThis.leftW + oThis.fixedWidth + 'px', - display: 'block' - }); - $('#' + oThis.options.id + '_swap_down').css({ - left: -oThis.scrollLeft - 3 + oThis.leftW + oThis.fixedWidth + 'px', - display: 'block' - }); - } - oThis.canSwap = true; - } else if (left < e.clientX && e.clientX < right) { - if (oThis.swapColumnEle != this && parseInt($(this).attr('index')) + 1 != parseInt($(oThis.swapColumnEle).attr('index'))) { - if (oThis.swapToColumnEle != this) { - oThis.swapToColumnEle = this; - $('#' + oThis.options.id + '_swap_top').css({ - left: this.attrRightTotalWidth - oThis.scrollLeft - 3 + oThis.leftW + oThis.fixedWidth + 'px', - display: 'block' - }); - $('#' + oThis.options.id + '_swap_down').css({ - left: this.attrRightTotalWidth - oThis.scrollLeft - 3 + oThis.leftW + oThis.fixedWidth + 'px', - display: 'block' - }); - } - oThis.canSwap = true; - return false; - } - } - }); - if (this.canSwap) { - $('.u-grid-header-drag-status').removeClass('uf-bancirclesymbol').addClass('uf-plussigninablackcircle'); - } else { - $('#' + this.options.id + '_swap_top').css('display', 'none'); - $('#' + this.options.id + '_swap_down').css('display', 'none'); - $('.u-grid-header-drag-status').removeClass('uf-plussigninablackcircle').addClass('uf-bancirclesymbol'); - this.swapToColumnEle = null; - } - $('#' + this.options.id + '_top').css('display', 'block'); - } - }; - /* - * 交换位置结束 - */ - var swapColumnEnd = function swapColumnEnd(e) { - if (!this.options.canSwap) { - return; - } - var oThis = this; - if (this.swapColumnFlag) { - if (this.swapToColumnEle) { - var swapColumnEle = this.swapColumnEle, - swapToColumnEle = this.swapToColumnEle, - swapColumnIndex = $(swapColumnEle).attr('index'), - swapToColumnIndex = $(swapToColumnEle).attr('index'), - swapGridCompColumn = this.gridCompColumnArr[swapColumnIndex]; - this.gridCompColumnArr.splice(parseInt(swapToColumnIndex) + 1, 0, swapGridCompColumn); - if (parseInt(swapColumnIndex) < parseInt(swapToColumnIndex)) this.gridCompColumnArr.splice(parseInt(swapColumnIndex), 1);else this.gridCompColumnArr.splice(parseInt(swapColumnIndex) + 1, 1); - this.saveGridCompColumnArrToLocal(); - this.repaintGridDivs(); - } - $('#' + this.options.id + '_clue').remove(); - $('#' + this.options.id + '_swap_top').css('display', 'none'); - $('#' + this.options.id + '_swap_down').css('display', 'none'); - } - this.swapColumnFlag = false; - $('#' + this.options.id + '_top').css('display', 'none'); - }; - var swapFunObj = exports.swapFunObj = { - swap_initEventFun: swap_initEventFun, - swap_initGridEventFun: swap_initGridEventFun, - swapColumnStart: swapColumnStart, - swapColumnFun: swapColumnFun, - swapColumnEnd: swapColumnEnd - }; - -/***/ }, -/* 32 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.rowDragFunObj = undefined; - - var _gridCompEvent = __webpack_require__(4); - - var rowDrag_initGridEventFun = function rowDrag_initGridEventFun() { - - var oThis = this; - - // 判断是否操作在内容行上 - // 根据某个字段判断是否可拖拽,如果可编辑调用rowDragStart - $('#' + this.options.id + '_content_tbody').on('mousedown', function (e) { - var $tarTr = $(e.target).closest("tr"); - var isEditTr = $(e.target).closest("tr").hasClass('grid_edit_form_tr'); - if ($tarTr.length > 0 && !isEditTr) { - var eleTr = $(e.target).closest("tr")[0]; - if (oThis.options.canRowDrag) { - oThis.rowDragStart(e, eleTr); - } - e.preventDefault(); - } - }); - - // move事件 - $('#' + this.options.id + '_content_tbody').on('mousemove', function (e) { - oThis.mouseMoveX = e.clientX; - oThis.mouseMoveY = e.clientY; - if (oThis.rowDragEle && (oThis.mouseMoveX != oThis.rowDragStartX || oThis.mouseMoveY != oThis.rowDragStartY) && oThis.options.canRowDrag) { - oThis.rowDragFlag = true; - // 鼠标按下之后移动了 - oThis.rowDragFun(e); - } - - e.stopPropagation(); - }); - - $('#' + this.options.id + '_content_tbody').on('mouseup', function (e) { - oThis.mouseUpX = e.clientX; - oThis.mouseUpY = e.clientY; - oThis.rowDragEnd(e); - }); - }; - - // const rowDrag_initGridEventFun = function(){ - // // 扩展方法 - // var oThis = this; - // }; - // 行拖拽开始之前 - var rowDragStart = function rowDragStart(e, ele) { - var oThis = this; - // 保存element, - // 记录之前clientx,clienty - // 记录当前行的序号 - if (!this.options.canRowDrag) { - return; - } - this.rowDragStartX = e.clientX; - this.rowDragStartY = e.clientY; - this.rowDragEle = ele; - // 查询rowDragEle是第几个tr元素 - $('#' + this.options.id + '_content_tbody').find('tr').each(function (i) { - if ($(this).is(oThis.rowDragEle)) { - oThis.rowDragStartIndex = i; - return false; - } - }); - }; - - // 行拖拽 - var rowDragFun = function rowDragFun(e) { - var oThis = this; - // 拖拽时动态生成图标 - if (!oThis.options.canRowDrag) { - return; - } - - if (this.rowDragFlag) { - this.rowDragEndX = e.clientX; - this.rowDragEndY = e.clientY; - var changeX = this.rowDragEndX - this.rowDragStartX, - changeY = this.rowDragEndY - this.rowDragStartY; - var rowHeight = this.rowDragEle.clientHeight; - - var rowCounts = parseInt(changeY / rowHeight); - - if (rowCounts < 0) { - this.dragdirection = -1; - } else { - this.dragdirection = 1; - } - - this.rowDragEndIndex = this.rowDragStartIndex + rowCounts; - - if (this.rowDragEndIndex < 0) { - this.rowDragEndIndex = 0; - } - - if (this.rowDragEndIndex != this.rowDragStartIndex) { - // var $flagIconDom = $(''); - //先删除相关的标记元素 - $('#' + this.options.id + '_content_tbody').find('tr td').removeClass('u-grid-drag-icon'); - //添加标记元素 - $('#' + this.options.id + '_content_tbody').find('tr').eq(this.rowDragEndIndex).find('td').first().addClass('u-grid-drag-icon'); - } - } - }; - - // 行拖拽结束 - var rowDragEnd = function rowDragEnd(e) { - var tempdata; - if (!this.options.canRowDrag) { - return; - } - if (this.rowDragFlag && this.rowDragEndIndex != this.rowDragStartIndex) { - //保存下临时数据 - tempdata = this.dataSourceObj.rows[this.rowDragStartIndex]; - - $('#' + this.options.id + '_content_tbody').find('tr td').removeClass('u-grid-drag-icon'); - - if (this.dragdirection < 0) { - - //dom元素操作 - $('#' + this.options.id + '_content_tbody').find('tr').eq(this.rowDragEndIndex).before(this.rowDragEle); - - // 删除起始位置 - this.dataSourceObj.rows.splice(this.rowDragStartIndex, 1); - - this.dataSourceObj.rows.splice(this.rowDragEndIndex, 0, tempdata); - } else { - - // 数据操作 - this.dataSourceObj.rows.splice(this.rowDragStartIndex, 1); - // dom元素操作 - if (this.rowDragEndIndex >= this.dataSourceObj.rows.length) { - $('#' + this.options.id + '_content_tbody').append(this.rowDragEle); - this.dataSourceObj.rows.splice(this.rowDragEndIndex + 1, 0, tempdata); - } else { - $('#' + this.options.id + '_content_tbody').find('tr').eq(this.rowDragEndIndex + 1).before(this.rowDragEle); - this.dataSourceObj.rows.splice(this.rowDragEndIndex, 0, tempdata); - } - } - } - // 删除之前行,插入新行 - - this.rowDragFlag = false; - this.rowDragEle = undefined; - }; - - var setRowDrag = function setRowDrag(isDrag) { - this.options.canRowDrag = isDrag; - }; - var rowDragFunObj = exports.rowDragFunObj = { - rowDrag_initGridEventFun: rowDrag_initGridEventFun, - rowDragStart: rowDragStart, - rowDragFun: rowDragFun, - rowDragEnd: rowDragEnd, - setRowDrag: setRowDrag - }; - -/***/ } -/******/ ]); \ No newline at end of file diff --git a/dist/tinper-neoui-grid.min.css b/dist/tinper-neoui-grid.min.css deleted file mode 100644 index f1dc28d..0000000 --- a/dist/tinper-neoui-grid.min.css +++ /dev/null @@ -1 +0,0 @@ -.u-grid,.u-grid li{font-size:16px}.u-grid,.u-grid-header{border-style:solid;border-color:#cecece}.u-grid,.u-grid-header-th{font-weight:400;text-align:left}.u-grid-header-th,.u-grid-top{-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;cursor:default}.u-grid-header-link,.u-grid-header-th{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.u-grid{display:block;position:relative;color:#333;background-color:#F9F9F9;zoom:1;font-family:'Helvetica Neue',Helvetica,'Hiragino Sans GB','Segoe UI','Microsoft Yahei',Tahoma,Arial,STHeiti,sans-serif;border-width:1px 1px 0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-shadow:none;-webkit-box-shadow:none;overflow:hidden}.u-grid-top{display:none;position:fixed;width:100%;height:100%;left:0;top:0;z-index:99999;background-color:#fff;filter:alpha(opacity=10);-moz-opacity:.1;-khtml-opacity:.1;opacity:.1;user-select:none;-o-user-select:none;-ms-user-select:none;-moz-user-select:-moz-none;-webkit-user-select:none}.u-grid table{width:100%;max-width:none;border-collapse:separate;border-spacing:0;empty-cells:show;border-width:0;outline:0;table-layout:fixed;background:#fff;margin:0!important}.u-grid-header{border-width:0 0 1px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;background-image:none;background-position:50% 50%;background-repeat:repeat;position:relative}.u-grid-header-wrap{position:relative;width:100%;overflow:hidden;zoom:1}.u-grid-header-left{position:absolute;z-index:11;background-color:#eeeff1;height:100%}.u-grid-header-multi-select,.u-grid-header-num{position:relative;float:left;box-sizing:border-box;border-width:0}.u-gird-parent,.u-grid-header-level-div{z-index:1;border-style:solid;border-color:#cecece}.u-grid-header-multi-select{padding:0 0 0 1.25em;margin:0;border-style:solid;border-color:#cecece;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;height:2.75em;line-height:2.75em}.u-grid-header-num{border-style:solid;border-color:#cecece;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;height:100%}.u-grid-header-th{vertical-align:bottom;height:2.75em;border-style:solid;border-color:#cecece;border-width:0;padding:0!important;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;//background-image:none;user-select:none;-o-user-select:none;-ms-user-select:none;-moz-user-select:-moz-none;-webkit-user-select:none;background:#eeeff1}.u-grid-header-th>div:hover{background:#d7d7d7}.u-grid-header-level-div{border-width:0 1px 0 0}.u-grid-header-th-first{border-left-width:0}.u-grid-header-link{display:block;padding-left:.714285714285em;padding-right:.714285714285em;color:#333;font-size:.875em;height:3.14285714em;line-height:3.14285714em}.u-grid-hide-title-icon .uf-fontselectioneditor{display:none}.u-gird-parent{position:absolute;top:0;text-align:center;background-color:#eeeff1;border-width:1px;margin-left:-1px;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box}.grid-no-left-border{border-left-width:0;margin:0}.grid-max-level-div{border-top:0}.u-grid td,.u-grid-header-drag-clue{border-style:solid;overflow:hidden;white-space:nowrap}.u-grid-header-link:hover,.u-grid-header-link:visited{//color:#a8a8a8}.u-grid-header-columnmenu{position:absolute;padding:0 .4em 0 .6em;font-size:.75em!important;top:0;right:0;color:#a8a8a8;height:3.6666667em;line-height:3.6666667em;z-index:999}.u-grid-header-resize-handle{position:absolute;cursor:col-resize;z-index:12;width:.6em;height:2.125em;display:block;bottom:0}.u-grid-header-drag-clue{border-radius:2px;background-color:#3f51b5;position:absolute;z-index:13;border-width:1px;font-size:.75em;cursor:default;color:#fff}.u-grid-header-drag-status{width:1em;height:1em}.u-grid-header-swap-tip-span{height:5px;position:absolute;z-index:13;cursor:default;display:none;line-height:0!important}.u-grid-header-sort-span{width:1.3em;text-align:center;font-size:12px;position:absolute;height:inherit;line-height:inherit;color:#666}.u-grid-header-sort-priority{display:inline-block;position:absolute;top:1em;right:-.5em;line-height:2.125em;font-size:.5em}.u-grid td{border-color:#cecece;border-width:0 0 1px;box-sizing:border-box;padding:0!important;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;vertical-align:middle;text-overflow:ellipsis;height:43px;line-height:43px;font-size:16px!important}.u-grid .grid_edit_form_td{overflow:visible}.u-grid tbody tr:last-child td,.u-grid-content-left>div:last-child{border-bottom-width:0}.u-grid-content-left.u-grid-content-left-sum>div:last-child{border-bottom-width:1px}.u-grid-content tr{border-top:0!important}.u-grid-content-td-div{height:inherit;margin:0 2em 0 .833333333em;font-size:.75em!important;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;position:relative;line-height:inherit}.u-grid-edit-div .u-grid-content-td-div{margin:0 1em;line-height:3.5em;font-size:12px;overflow:visible;white-space:nowrap;text-overflow:ellipsis;height:100%}.u-grid-content-td-div-over::after{content:"...";font-weight:700;position:absolute;bottom:15px;right:-5px}.u-grid-content-td-div>input{height:100%}.u-grid-content-td-div>.right-span{position:absolute;right:0;line-height:3.5em;width:2rem;text-align:center}.u-grid-content-multiSelect,.u-grid-content-num{border-width:0 0 1px;line-height:2.75em;float:left}.u-grid-content-td-div .u-checkbox-focus-helper,.u-grid-content-td-div .u-checkbox-outline{top:-10px}.u-grid-content{border-style:solid;border-color:#cecece;border-width:0 0 1px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;zoom:1;background-color:#fff;overflow:hidden}.u-grid-content-div{position:relative;overflow-x:auto;overflow-y:auto}.u-grid-content-left{position:absolute}.u-grid-content-left-sum-bottom{position:absolute;bottom:16px;left:0;height:2.125em;z-index:11;background-color:#FFF}.u-grid-content-left-bottom{position:absolute;bottom:0;left:0;height:16px;z-index:11;background-color:#FFF}.u-grid-content-left-row{position:relative;height:2.125em}.u-grid-content-multiSelect{padding:0 0 0 1.25em;position:relative;height:2.75em;border-style:solid;border-color:#cecece;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;margin:0!important;font-size:16px!important}.u-grid-column-menu-ul,.u-grid-content-num{padding:0;border-style:solid;border-color:#cecece}.u-grid-multi-input{margin:0!important;height:100%}.u-grid-content-num{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;height:2.75em;position:relative;text-align:center}.u-gird-centent-sum-div{float:left;font-size:.75em;font-size:inherit\9;height:inherit;line-height:inherit;margin-left:.666667em;margin-left:0\9}.u-grid-content-sel-row{background-color:#e9f7fc!important;//color:#FFF!important}.u-grid-content-sel-row a{//color:#0377c1!important}.u-grid-content-focus-row{background-color:#e9f7fc!important;//color:#FFF!important}.u-grid-content-tree-span{width:1.25em;height:1.25em;color:#007ae3;font-size:14px!important}td.u-grid-drag-icon:before{content:"\e6d1";font-family:uf!important;font-size:12px;position:absolute;z-index:100}.u-grid-content-edit-menu{display:none;overflow:hidden;position:absolute;z-index:13;background:#fff;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;width:100%;height:28px}.u-grid-content-edit-menu-button{position:absolute;right:50px;display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid #bfbfbf;white-space:nowrap;font-size:13px;line-height:1.5;border-radius:3px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;height:28px;width:80px;background-color:#fff;outline:0}.u-grid-edit-form,.u-grid-noRowsDiv{position:relative}.u-grid-column-menu-columns-ul,.u-grid-column-menu-ul{background-color:#fff;font-weight:500;background-image:none;background-position:50% 50%}.u-grid-content-edit-menu-button-ok{color:#01a3f6;margin-left:10px}.u-grid-content-edit-menu-button-cancel{color:#e50011;right:150px}.u-grid-edit-form{z-index:12;font-size:12px;float:left}.u-grid-edit-whole-div{position:relative;width:350px;float:left;height:30px;margin-bottom:10px}.u-grid-edit-label{width:84px;float:left;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:right;line-height:28px}.u-grid-edit-div{width:175px;margin-left:10px;float:left}.u-grid-edit-div input[type=text]{width:100%;line-height:28px;height:28px;border:1px solid #c9c9c9;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:none;transition:none;outline:0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.u-grid-edit-div input[type=checkbox],.u-grid-edit-div input[type=radio]{height:13px;width:13px}.u-grid-noRowsDiv,.u-grid-noRowsShowDiv{top:0;left:0;width:100%;line-height:2.125em;color:#a8a8a8;display:none;height:2.125em;font-size:.75em;text-align:center}.u-grid-edit-div .input-group input{border-right:none;padding-right:0}.u-grid-noRowsShowDiv{position:absolute}.u-grid-column-menu{width:160px;display:none;overflow:hidden;position:fixed;z-index:13;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.u-grid-column-menu-ul{margin:0;border-width:0 0 1px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.u-grid-column-menu-columns-li,.u-grid-column-menu-li{border-style:solid;border-color:#cecece;box-sizing:border-box;display:block;cursor:pointer}.u-grid-column-menu-li{height:2.125em;border-width:1px 1px 0;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.u-grid-column-menu-div1{display:block;padding:0 .8em;line-height:2.83em;font-size:.75em;position:relative;height:100%}.u-grid-column-menu-span{position:absolute;width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.u-grid-column-menu-div3{right:2em;position:absolute;font-size:.75em!important;filter:alpha(opacity=70);-moz-opacity:.7;-khtml-opacity:.7;opacity:.7;line-height:2.83em!important}.u-grid-column-menu-columns{width:160px;display:block;overflow-y:auto;overflow-x:hidden;position:relative;z-index:13;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.u-grid-column-menu-columns-ul{border-width:1px 0 0;border-style:solid;border-color:#cecece;padding:0;margin:0}.u-grid-column-menu-columns-li{height:2.125em;border-width:0 1px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.u-grid-column-menu-columns-div1{display:block;padding:0 .8em;line-height:2.83em;font-size:.75em;position:relative;height:100%}.u-grid-column-menu-columns-div2{position:absolute;filter:alpha(opacity=70);-moz-opacity:.7;-khtml-opacity:.7;opacity:.7}.u-grid-column-menu-columns-span{position:absolute;width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;left:35px}.u-grid-form{width:100%;height:100%;overflow-x:hidden;overflow-y:scroll}.u-grid-content-td-div .input-group-addon{padding:3px 12px}.u-grid-content-td-div .grid-combox{height:28px}.u-grid-content-td-div .eType-input{position:relative;width:90%;height:90%;margin:0;// margin-left:5%;min-height:20px;font-size:12px;color:#333}.u-grid-content-td-div .eType-input>input{width:100%;height:100%;line-height:normal}.u-grid-content-td-div .eType-input>.right-span{position:absolute;line-height:3.5em;cursor:pointer;right:0;width:2rem;text-align:center}.u-grid-content-td-div .checkbox label{top:-2px}.u-grid-content-td-div input[type=checkbox]{position:relative;top:0;cursor:pointer}.u-grid .u-text{padding:0}.u-grid-err-td,.u-grid-err-td *{background-color:#1baede}.u-grid-move-bg{background:#f4f8fb!important;color:#333}.u-grid .u-grid-move-bg a{color:#0377c1}.u-grid-move-bg a:hover{text-decoration:underline;cursor:pointer}.u-grid a{color:#333;text-decoration:none}.u-grid-checkbox-outline{position:absolute;box-sizing:border-box;width:14px;height:14px;margin:0;cursor:pointer;overflow:hidden;border:1px solid #bfbfbf;border-radius:2px;display:none;top:15px}.u-grid-checkbox-tick-outline{position:absolute;top:0;left:0;height:100%;width:100%;-webkit-mask:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmVyc2lvbj0iMS4xIgogICB2aWV3Qm94PSIwIDAgMSAxIgogICBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij4KICA8cGF0aAogICAgIGQ9Ik0gMC4wNDAzODA1OSwwLjYyNjc3NjcgMC4xNDY0NDY2MSwwLjUyMDcxMDY4IDAuNDI5Mjg5MzIsMC44MDM1NTMzOSAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IE0gMC4yMTcxNTcyOSwwLjgwMzU1MzM5IDAuODUzNTUzMzksMC4xNjcxNTcyOSAwLjk1OTYxOTQxLDAuMjczMjIzMyAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IgogICAgIGlkPSJyZWN0Mzc4MCIKICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lIiAvPgo8L3N2Zz4K);mask:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmVyc2lvbj0iMS4xIgogICB2aWV3Qm94PSIwIDAgMSAxIgogICBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij4KICA8cGF0aAogICAgIGQ9Ik0gMC4wNDAzODA1OSwwLjYyNjc3NjcgMC4xNDY0NDY2MSwwLjUyMDcxMDY4IDAuNDI5Mjg5MzIsMC44MDM1NTMzOSAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IE0gMC4yMTcxNTcyOSwwLjgwMzU1MzM5IDAuODUzNTUzMzksMC4xNjcxNTcyOSAwLjk1OTYxOTQxLDAuMjczMjIzMyAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IgogICAgIGlkPSJyZWN0Mzc4MCIKICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lIiAvPgo8L3N2Zz4K);background:0 0;transition-duration:.28s;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-property:background}.u-grid-checkbox-outline.is-checked{border:1px solid #1baede;display:inline-block}.u-grid-header-multi-select .u-grid-checkbox-outline,.u-grid-move-bg .u-grid-checkbox-outline{display:inline-block}.u-grid-checkbox-outline.is-checked .u-grid-checkbox-tick-outline{-webkit-mask:none;mask:none;background:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmVyc2lvbj0iMS4xIgogICB2aWV3Qm94PSIwIDAgMSAxIgogICBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij4KICA8cGF0aAogICAgIGQ9Ik0gMC4wNDAzODA1OSwwLjYyNjc3NjcgMC4xNDY0NDY2MSwwLjUyMDcxMDY4IDAuNDI5Mjg5MzIsMC44MDM1NTMzOSAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IE0gMC4yMTcxNTcyOSwwLjgwMzU1MzM5IDAuODUzNTUzMzksMC4xNjcxNTcyOSAwLjk1OTYxOTQxLDAuMjczMjIzMyAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IgogICAgIGlkPSJyZWN0Mzc4MCIKICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lIiAvPgo8L3N2Zz4K) #1baede} \ No newline at end of file diff --git a/dist/tinper-neoui-grid.min.js b/dist/tinper-neoui-grid.min.js deleted file mode 100644 index 4ea559f..0000000 --- a/dist/tinper-neoui-grid.min.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * tinper-neoui-grid v3.1.28 - * grid - * author : yonyou FED - * homepage : https://github.com/iuap-design/tinper-neoui-grid#readme - * bugs : https://github.com/iuap-design/tinper-neoui-grid/issues - **/ -!function(t){function i(o){if(e[o])return e[o].exports;var n=e[o]={exports:{},id:o,loaded:!1};return t[o].call(n.exports,n,n.exports,i),n.loaded=!0,n.exports}var e={};return i.m=t,i.c=e,i.p="",i(0)}([function(t,i,e){"use strict";var o=e(1),n=e(7),s=e(9),r=$.fn.grid;$.fn.grid=function(t){var i=$(this).data("gridComp");return i||$(this).data("gridComp",i=new s.gridComp(this,t)),i},$.fn.grid.gridComp=s.gridComp,$.fn.grid.gridCompColumn=n.column,$.fn.grid.dataSource=o.dataSource,$.fn.grid.noConflict=function(){return $.fn.grid=r,this}},function(t,i,e){"use strict";function o(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0}),i.dataSource=void 0;var n=e(2),s=e(3),r=e(6),d=function t(i,e){o(this,t),this.init(i,e),this.sortRows()},a=d.prototype;Object.assign(a,n.initFunObj),a.basicSortRows=s.sortFunObj.re_basicSortRows,a.treeSortRows=r.treeFunObj.re_treeSortRows,a.pushChildRows=r.treeFunObj.pushChildRows,i.dataSource=d},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(t,i){this.defaults={},this.gridComp=i,this.options=$.extend({},this.defaults,t),this.rows=new Array,this.hasParentRows=new Array,this.nothasParentRows=new Array},o=function(t,i){this.gridComp.options.showTree?this.treeSortRows(t,i):this.basicSortRows(t,i),this.gridComp.eidtRowIndex=-1},n=function(t,i){var e=this,o="";t&&(o=this.gridComp.getColumnByField(t).options.dataType),this.rows=new Array,this.options.values&&$.each(this.options.values,function(t){var i={};i.value=this,i.valueIndex=t,e.rows.push(i)})},s=function(t,i){this.basicSortRows(t,i)},r=function(t,i,e){var o=null;if(i.options.sumCol&&$.each(this.rows,function(n){var s=$(this.value).attr(t);"Int"==i.options.dataType?(s=e.getInt(s,0),o+=parseInt(s)):(s=e.getFloat(s,0),o=e.accAdd(o,parseFloat(s)))}),"Float"==i.options.dataType&&i.options.precision){var n={};n.value=o,n.precision=i.options.precision,o=e.DicimalFormater(n)}return null!=o&&void 0!=o&&"null"!=o&&"undefined"!=o?o+"":""};i.initFunObj={init:e,sortRows:o,basicSortRows:n,treeSortRows:s,getSumValue:r}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sortFunObj=void 0;var _gridCompEvent=__webpack_require__(4),sort_initEventFun=function(){var t=this;$("#"+this.options.id).on("mouseup",function(i){if($(i.target).closest("#"+t.options.id+"_header").length>0){if(t.mouseUpX=i.clientX,t.mouseUpY=i.clientY,t.mouseDownX==t.mouseUpX&&t.mouseDownY==t.mouseUpY){t.columnClickX=i.clientX,t.columnClickY=i.clientY;var e=$(i.target).closest("th")[0];$(i.target).hasClass("u-grid-header-columnmenu")||t.canSortable(i,e)}}else $(i.target).closest("#"+t.options.id+"_content").length>0})},sort_initGridEventFun=function(){},canSortable=function(t,i){var e=this,o=$(i),n=o.attr("field"),s=this.getColumnAttr("sortable",n);if(s){if(t.ctrlKey){var r=[];$(".u-grid-header-sort-priority").each(function(t,i){var e,o=$(i),n=parseInt(o.text()),s=o.closest("th").attr("field");o.parent().hasClass("uf-arrow-up")?e="asc":o.parent().hasClass("uf-arrow-down")&&(e="desc"),r[n-1]={field:s,sortType:e}});var d;if((d=o.find(".uf-arrow-up")).length>0){var a=parseInt(d.find(".u-grid-header-sort-priority").text());r[a-1].sortType="desc",d.removeClass("uf-arrow-up").addClass("uf-arrow-down")}else if((d=o.find(".uf-arrow-down")).length>0){for(var a=parseInt(d.find(".u-grid-header-sort-priority").text()),l=a;l');this.dataSourceObj.sortRowsByPrio(r)}else $(".uf-arrow-up").parent().parent().parent()[0]==i?($(".uf-arrow-up").remove(),$(i.firstChild.firstChild)[0].insertAdjacentHTML("beforeEnd",''),"function"==typeof this.options.onSortFun?this.options.onSortFun(n,"asc"):this.dataSourceObj.sortRows(n,"asc")):$(".uf-arrow-down").parent().parent().parent()[0]==i?($(".uf-arrow-down").remove(),"function"==typeof this.options.onSortFun?this.options.onSortFun():this.dataSourceObj.sortRows()):($(".uf-arrow-up").remove(),$(".uf-arrow-down").remove(),$(i.firstChild.firstChild)[0].insertAdjacentHTML("beforeEnd",''),"function"==typeof this.options.onSortFun?this.options.onSortFun(n,"desc"):this.dataSourceObj.sortRows(n,"desc"));e.repairContent(),e.afterGridDivsCreate()}},re_deleteOneRowTree=function(){this.options.showTree&&this.dataSourceObj.sortRows()},sortRowsByPrio=function sortRowsByPrio(prioArray,cancelSort){var oThis=this;cancelSort&&(this.rows=new Array,this.options.values&&$.each(this.options.values,function(t){var i={};i.value=this,i.valueIndex=t,oThis.rows.push(i)}));var evalStr=function t(i){return i==prioArray.length-1?"by(prioArray["+i+"].field, prioArray["+i+"].sortType)":"by(prioArray["+i+"].field, prioArray["+i+"].sortType,"+t(i+1)+")"},by=function(t,i,e){arguments.callee;return function(o,n){var s=$(o.value).attr(t),r=$(n.value).attr(t),d=oThis.gridComp.getColumnByField(t).options.dataType;if("Float"==d)return s=parseFloat(s),r=parseFloat(r),isNaN(s)?1:isNaN(r)?-1:s==r&&e?e():"asc"==i?s-r:r-s;if("Int"==d)return s=parseInt(s),r=parseInt(r),isNaN(s)?1:isNaN(r)?-1:s==r&&e?e():"asc"==i?s-r:r-s;s=oThis.gridComp.getString(s,""),r=oThis.gridComp.getString(r,"");try{var a=s.localeCompare(r);return 0===a&&e?e():0===a?0:"asc"==i?a:-a}catch(t){return 0}}};this.rows.sort(eval(evalStr(0)))},re_basicSortRows=function(t,i){var e=this,o="";t&&(o=this.gridComp.getColumnByField(t).options.dataType),"asc"==i?this.rows.sort(function(i,n){var s=$(n.value).attr(t),r=$(i.value).attr(t);if("Float"==o)return s=parseFloat(s),r=parseFloat(r),isNaN(s)?1:isNaN(r)?-1:s-r;if("Int"==o)return s=parseInt(s),r=parseInt(r),isNaN(s)?1:isNaN(r)?-1:s-r;s=e.gridComp.getString(s,""),r=e.gridComp.getString(r,"");try{return s.localeCompare(r)}catch(t){return 0}}):"desc"==i?this.rows.sort(function(i,n){var s=$(i.value).attr(t),r=$(n.value).attr(t);if("Float"==o)return s=parseFloat(s),r=parseFloat(r),isNaN(s)?1:isNaN(r)?-1:s-r;if("Int"==o)return s=parseInt(s),r=parseInt(r),isNaN(s)?1:isNaN(r)?-1:s-r;s=e.gridComp.getString(s,""),r=e.gridComp.getString(r,"");try{return s.localeCompare(r)}catch(t){return 0}}):(this.rows=new Array,this.options.values&&$.each(this.options.values,function(t){var i={};i.value=this,i.valueIndex=t,e.rows.push(i)}))},sortFunObj=exports.sortFunObj={sort_initEventFun:sort_initEventFun,sort_initGridEventFun:sort_initGridEventFun,re_basicSortRows:re_basicSortRows,canSortable:canSortable,deleteOneRowTree:re_deleteOneRowTree,sortRowsByPrio:sortRowsByPrio}},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.eventFunObj=void 0;var o=e(5),n=function(){var t=this;$("#"+this.options.id).on("mousedown",function(i){$(i.target).closest("#"+t.options.id+"_header").length>0?(t.mouseDownX=i.clientX,t.mouseDownY=i.clientY):$(i.target).closest("#"+t.options.id+"_content").length>0})},s=function(){var t=this;this.initContentDivEventFun(),$("#"+this.options.id+"_header_multi_input").on("click",function(i){this.hasChecked?(t.setAllRowUnSelect(),this.hasChecked=!1):(t.setAllRowSelect(),this.hasChecked=!0)})},r=function(){var t=this;$("#"+t.options.id+"_content .u-grid-content-left").on("click",function(i){var e=$(i.target).closest(".u-grid-checkbox-outline");if(e.length>0){var o=$(e.parent()),n=$(".u-grid-content-multiSelect",o.parent()).index(o);e.hasClass("is-checked")?t.setRowUnselect(n):t.setRowSelect(n)}}),$("#"+this.options.id+"_content_div").on("scroll",function(i){t.scrollLeft=this.scrollLeft,t.scrollTop=this.scrollTop,"right"==t.options.fixedFloat?$("#"+t.options.id+"_header_table").css("left",t.leftW-t.scrollLeft+"px"):$("#"+t.options.id+"_header_table").css("left",t.leftW-t.scrollLeft+t.fixedWidth+"px"),$("#"+t.options.id+"_noRowsShow").css("left",t.scrollLeft+"px"),$("#"+t.options.id+"_edit_form").css("left",t.scrollLeft+"px"),$("#"+t.options.id+"_content_multiSelect").css("top",-t.scrollTop+"px"),$("#"+t.options.id+"_content_numCol").css("top",-t.scrollTop+"px"),$("#"+t.options.id+"_content_fixed_div").css("top",-t.scrollTop+"px"),o.gridBrowser.isIE10||o.gridBrowser.isIPAD||t.editClose()}),$("#"+this.options.id+"_content_tbody").on("click",function(i){"function"==typeof t.options.onDblClickFun?t.isDblEvent("tbodyClick",t.dblClickFun,i,t.clickFun,i):t.clickFun(i)}),$("#"+this.options.id+"_content_fixed_tbody").on("click",function(i){"function"==typeof t.options.onDblClickFun?t.isDblEvent("tbodyClick",t.dblClickFun,i,t.clickFun,i):t.clickFun(i)}),$("#"+this.options.id+"_content").on("mousemove",function(i){var e=$(i.target).closest("tr"),o=$(i.target).closest("div"),n=-1;e.length>0?n=$("tr",e.parent()).index(e):o.length>0&&(o.hasClass("u-grid-content-multiSelect")||o.hasClass("u-grid-content-num"))&&(n=$("div",o.parent()).index(o)),t.trHoverFun(n)}),$("#"+this.options.id+"_content").on("mouseout",function(i){if($("#"+t.options.id+"_content_tbody").find("tr").removeClass("u-grid-move-bg"),$("#"+t.options.id+"_content_fixed_tbody").find("tr").removeClass("u-grid-move-bg"),t.options.multiSelect&&$("#"+t.options.id+"_content_multiSelect").find("div").removeClass("u-grid-move-bg"),t.options.showNumCol&&$("#"+t.options.id+"_content_numCol").find("div").removeClass("u-grid-move-bg"),"function"==typeof t.options.onContentOut){var e={};e.gridObj=t;var o=$(i.target).closest("tr");if(o.length>0&&!o.is(".u-grid-content-sum-row")){var n=$('tr[role="row"]',o.parent()).index(o);e.rowObj=t.dataSourceObj.rows[n],e.rowIndex=n}t.options.onContentOut(e)}})};i.eventFunObj={initEventFun:n,initGridEventFun:s,initContentDivEventFun:r}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e,o={},n=navigator.userAgent,s=n.toLowerCase();if((e=s.match(/msie ([\d.]+)/))&&(o.isIE=!0),o.isIE){var r=document.documentMode;null==r||(8==r?o.isIE8=!0:9==r?o.isIE9=!0:10==r&&(o.isIE10=!0))}(s.indexOf("Android")>-1||s.indexOf("android")>-1||s.indexOf("Adr")>-1||s.indexOf("adr")>-1)&&(o.isAndroid=!0),o.isAndroid&&(window.screen.width>=768&&window.screen.width<1024&&(o.isAndroidPAD=!0),window.screen.width<=768&&(o.isAndroidPhone=!0)),s.match(/iphone/i)&&(o.isIOS=!0,o.isIphone=!0),s.match(/ipad/i)&&(o.isIOS=!0,o.isIPAD=!0),(o.isIphone||o.isAndroidPhone)&&(o.isMobile=!0),i.gridBrowser=o},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(t,i){return i.showTree&&(t.sortable=!1),t},o=function(){this.options.showTree&&(this.options.showNumCol=!1)},n=function(t){var i=this,e=$(t.target),o=e.closest("td");if(o.length>0){var n=o.parent(),s=this.getTrIndex(n),r=i.dataSourceObj.rows[s];if(r){var d=i.getChildRowIndex(r);if(e.hasClass("uf-reduce-s-o")||e.hasClass("uf-add-s-o")){var a=o.find(".uf-reduce-s-o"),l=o.find(".uf-add-s-o");if(a.length>0){if(a.removeClass("uf-reduce-s-o").addClass("uf-add-s-o"),d.length>0){var h=i.getAllChildRowIndex(r);$.each(h,function(){var t=$('tr[role="row"]:eq('+parseInt(this)+")",n.parent());t.css("display","none"),$("#"+i.options.id+"_content_multiSelect >div:nth-child("+(parseInt(this)+1)+")").css("display","none"),$(".uf-reduce-s-o",t).removeClass("uf-reduce-s-o").addClass("uf-add-s-o")})}"form"==this.options.editType&&($("#"+this.options.id+"_multiSelect_edit").remove(null,!0),$("#"+this.options.id+"_numCol_edit").remove(null,!0),$("#"+this.options.id+"_edit_tr").remove(null,!0),$("#"+this.options.id+"_edit_tr1").remove(null,!0))}else l.length>0&&(l.removeClass("uf-add-s-o").addClass("uf-reduce-s-o"),d.length>0&&$.each(d,function(){var t=$('tr[role="row"]:eq('+parseInt(this)+")",n.parent());t.css("display","");$("#"+i.options.id+"_content_multiSelect >div:nth-child("+(parseInt(this)+1)+")")[0];$("#"+i.options.id+"_content_multiSelect >div:nth-child("+(parseInt(this)+1)+")").css("display","")}));this.resetLeftHeight()}}}},s=function(t,i,e){var o,n=this,s=this.dataSourceObj.rows.length;if(this.options.showTree){this.hasParent=!1,this.hasChildF=!1;var r=this.options.keyField,d=this.options.parentKeyField,a=this.getString($(t).attr(r),"");e.keyValue=a;var l=this.getString($(t).attr(d),"");e.parentKeyValue=l;var h;if($.each(this.dataSourceObj.rows,function(t){var o=this.value,s=n.getString($(o).attr(r),""),u=n.getString($(o).attr(d),"");if(s==l){n.hasParent=!0,n.addRowParentIndex=t,h=n.getAllChildRow(this).length;var c=this.level;if(e.level=c+1,i=n.addRowParentIndex+h+1,!n.options.needTreeSort)return!1}if(u==a&&(n.hasChildF=!0),n.hasParent&&n.hasChildF)return!1}),this.hasParent||(e.level=0,i!=s&&(i=s)),this.hasParent){var u=$("#"+this.options.id+"_content_div").find("tbody").find('tr[role="row"]').eq(n.addRowParentIndex);if(h>0){var c=$(".uf-add-s-o",u);c.length>0||(o="block")}else{this.options.autoExpand&&(o="block");var p=$("div:eq(0)",u),c=$(".uf-add-s-o",u),f=$(".uf-reduce-s-o",u);if(this.options.autoExpand)var m='';else var m='';if(p.length>0&&0==c.length&&0==f.length){p[0].insertAdjacentHTML("afterBegin",m);var v=parseInt(p[0].style.left);s=v-16,(s>0||0==s)&&(p[0].style.left=s+"px")}c.length>0&&c.removeClass("uf-add-s-o").addClass("uf-reduce-s-o")}}}return{index:i,displayFlag:o}},r=function(t){if(this.hasChildF)this.dataSourceObj.sortRows(),this.repairContent();else{if(this.hasParent){var i=this.dataSourceObj.rows[this.addRowParentIndex];i.hasChild=!0,i.childRow.push(t),i.childRowIndex.push(t.valueIndex),t.parentRow=i,t.parentRowIndex=this.addRowParentIndex}t.hasChild=!1,t.childRow=new Array,t.childRowIndex=new Array}},d=function(t,i,e,o){var n=this,s=this.options.keyField,r=this.options.parentKeyField;if(this.options.showTree&&(i==s||i==r)){var d=!1,a=!1;if($.each(this.dataSourceObj.rows,function(t){var o=this.value,l=n.getString($(o).attr(s),""),h=n.getString($(o).attr(r),"");i==s&&e==h&&(a=!0),i==r&&e==l&&(d=!0)}),a||d){var l=$(this.dataSourceObj.rows[t].value);this.deleteOneRow(t),this.addOneRow(l[0])}}return!this.options.showTree||i!=s&&i!=r||!a&&!d||(t=this.getRowIndexByValue(i,e)),t},a=function(t){return t.allChildRow=new Array,this.getAllChildRowFun(t,t.allChildRow),t.allChildRow},l=function(t){var i=[];return t.childRow&&t.childRow.length>0&&$.each(t.childRow,function(){i.push(this.valueIndex)}),i},h=function(t){return t.allChildRowIndex=new Array,this.getAllChildRowIndexFun(t,t.allChildRowIndex),t.allChildRowIndex},u=function(t,i){var e=this;t.childRow.length>0&&(Array.prototype.push.apply(i,t.childRow),$.each(t.childRow,function(){e.getAllChildRowFun(this,i)}))},c=function(t,i){var e=this;t.childRow.length>0&&(Array.prototype.push.apply(i,this.getChildRowIndex(t)),$.each(t.childRow,function(){e.getAllChildRowIndexFun(this,i)}))},p=function(t){var i=this.getRowIndexByValue(this.options.keyField,t);this.expandNodeByIndex(i)},f=function(t){for(var i,e=this.getRowByIndex(t),o=!1,n=new Array,s=e;!o;){if(""==s.parentKeyValue){o=!0;break}i=s.parentRowIndex,s=s.parentRow;var r=$("#"+this.options.id+"_content_div").find("tbody").find('tr[role="row"]').eq(i),d=$(".uf-add-s-o",r);if(!(d.length>0)){o=!0;break}n.push(i)}if(n.length>0)for(var a=n.length-1;a>-1;a--){var l=n[a],r=$("#"+this.options.id+"_content_div").find("tbody").find('tr[role="row"]').eq(l),d=$(".uf-add-s-o",r);d.click()}var h=$("#"+this.options.id+"_content_div").find("tbody").find('tr[role="row"]').eq(t),d=$(".uf-add-s-o",h),u=$(".u-grid-content-td-div",h);d.length>0?d.click():u.click()},m=function(t,i){var e=this,o=new Array;if(this.rows=new Array,this.hasParentRows=new Array,this.nothasParentRows=new Array,this.options.values){$.each(this.options.values,function(t){var i={},o=$(this),n=e.gridComp.options.keyField,s=e.gridComp.options.parentKeyField,r=e.gridComp.getString(o.attr(n),""),d=e.gridComp.getString(o.attr(s),"");i.valueIndex=t,i.value=this,i.keyValue=r,i.parentKeyValue=d,""==d?e.nothasParentRows.push(i):e.hasParentRows.push(i),e.rows.push(i)}),$.each(this.hasParentRows,function(t){var i=this.parentKeyValue,n=!1;$.each(e.rows,function(){this.keyValue==i&&(n=!0)}),n||(o.push(this),e.nothasParentRows.push(this))}),$.each(o,function(){var t=e.hasParentRows.indexOf(this);e.hasParentRows.splice(t,1)}),e.rows=new Array;var n=0;$.each(this.nothasParentRows,function(t){this.level=n,e.rows.push(this),e.pushChildRows(this,n)})}},v=function(t,i){var e=t.keyValue,o=this,n=parseInt(i)+1,s=!1,r=new Array,d=new Array,a=new Array;$.each(this.hasParentRows,function(t){if(this&&this.parentKeyValue==e){s=!0,this.level=n,o.rows.push(this),r.push(this);var i=parseInt(o.rows.length-1);d.push(i),a.push(this),o.pushChildRows(this,n)}}),$.each(a,function(){var t=o.hasParentRows.indexOf(this);o.hasParentRows.splice(t,1)}),t.hasChild=s,t.childRow=r,t.childRowIndex=d};i.treeFunObj={initOptionsTree:o,clickFunTree:n,addOneRowTree:s,addOneRowTreeHasChildF:r,updateValueAtTree:d,getAllChildRow:a,getChildRowIndex:l,getAllChildRowIndex:h,getAllChildRowFun:u,getAllChildRowIndexFun:c,expandNode:p,expandNodeByIndex:f,re_treeSortRows:m,pushChildRows:v,re_initTree:e}},function(t,i,e){"use strict";function o(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0}),i.column=void 0;var n=e(8),s=e(6),r=function t(i,e){o(this,t),this.init(i,e)},d=r.prototype;Object.assign(d,n.initFunObj),d.initTree=s.treeFunObj.re_initTree,i.column=r},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var init=function init(options,gridComp){var gridOptions=gridComp.options;this.gridGetBoolean=gridComp.getBoolean,this.defaults={width:"200",sortable:!0,canDrag:!0,fixed:!1,visible:!0,canVisible:!0,sumCol:!1,editable:!0,editFormShow:!0,autoExpand:!1,editType:"text",dataType:"String",format:"YYYY-MM-DD hh:mm:ss",headerLevel:1,hiddenLevel:1};var gridDefault={sortable:gridOptions.sortable,canDrag:gridOptions.canDrag,width:gridOptions.columnWidth};"Date"==options.dataType&&(this.defaults.format="YYYY-MM-DD"),options=this.initTree(options,gridOptions),this.options=$.extend({},this.defaults,gridDefault,options),this.getBooleanOptions();try{"string"==typeof this.options.renderType&&(this.options.renderType=eval(this.options.renderType))}catch(t){}try{"string"==typeof this.options.editType&&(this.options.editType=eval(this.options.editType))}catch(t){}this.options.width=this.options.width,this.firstColumn=!1},initTree=function(t){return t},getBooleanOptions=function(){this.options.sortable=this.gridGetBoolean(this.options.sortable),this.options.canDrag=this.gridGetBoolean(this.options.canDrag),this.options.fixed=this.gridGetBoolean(this.options.fixed),this.options.visible=this.gridGetBoolean(this.options.visible),this.options.canVisible=this.gridGetBoolean(this.options.canVisible),this.options.sumCol=this.gridGetBoolean(this.options.sumCol),this.options.editable=this.gridGetBoolean(this.options.editable),this.options.editFormShow=this.gridGetBoolean(this.options.editFormShow),this.options.autoExpand=this.gridGetBoolean(this.options.autoExpand)},initFunObj=exports.initFunObj={init:init,initTree:initTree,getBooleanOptions:getBooleanOptions}},function(t,i,e){"use strict";function o(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0}),i.gridComp=void 0;var n=e(10),s=e(11),r=e(4),d=e(12),a=e(13),l=e(15),h=e(16),u=e(17),c=e(18),p=e(19),f=e(20),m=e(21),v=e(22),w=e(23),g=e(14),_=e(24),C=e(25),b=e(26),y=e(27),$=e(28),x=e(29),S=e(3),F=e(30),R=e(31),O=e(32),j=e(6),T=function t(i,e){o(this,t),this.init(i,e),this.initGrid()},I=T.prototype;Object.assign(I,n.createFunObj),Object.assign(I,s.createCalFunOjb),Object.assign(I,r.eventFunObj),Object.assign(I,d.getFunObj),Object.assign(I,a.initFunObj),Object.assign(I,l.operateRowFunObj),Object.assign(I,h.renderTypeFunObj),Object.assign(I,u.setFunObj),Object.assign(I,c.wdChangeFunObj),Object.assign(I,p.clickFunObj),Object.assign(I,f.otherFunObj),Object.assign(I,m.utilFunOjb);var A=I.initGridCompColumn,W=I.initEventFun,M=I.initGridEventFun;I.initGridCompColumnColumnMenuFun=v.re_initGridCompColumnColumnMenuFun,I.initGridCompColumn=function(){A.apply(this,arguments),v.colMenu_initGridCompColumn.apply(this,arguments)},I.createColumnMenu=v.re_createColumnMenu,I.initEventFun=function(){W.apply(this,arguments),v.colMenu_initEventFun.apply(this,arguments)},I.initGridEventFun=function(){M.apply(this,arguments),v.colMenu_initGridEventFun.apply(this,arguments)},"undefined"==typeof I.saveGridCompColumnArrToLocal&&(I.saveGridCompColumnArrToLocal=function(){}),"undefined"==typeof I.clearLocalData&&(I.clearLocalData=function(){});var E=I.initEventFun,D=I.initGridEventFun;Object.assign(I,w.dragFunObj),I.initEventFun=function(){E.apply(this,arguments),w.dragFunObj.drag_initEventFun.apply(this,arguments)},I.initGridEventFun=function(){D.apply(this,arguments),w.dragFunObj.drag_initGridEventFun.apply(this,arguments)},"undefined"==typeof I.saveGridCompColumnArrToLocal&&(I.saveGridCompColumnArrToLocal=function(){});var L=I.initEventFun;Object.assign(I,g.eidtFunObj),"undefined"==typeof I.formEditCell&&(I.formEditCell=function(){}),I.initEventFun=function(){L.apply(this,arguments),g.eidtFunObj.edit_initEventFun.apply(this,arguments)};var H=I.initDefault,k=I.setRequired;Object.assign(I,_.editFromFunObj),I.initDefault=function(){H.apply(this,arguments),_.editFromFunObj.editForm_initDefault.apply(this,arguments)},I.setRequired=function(){k.apply(this,arguments),_.editFromFunObj.editForm_setRequired.apply(this,arguments)};var B=I.columnsVisibleFun;Object.assign(I,C.fixFunObj),I.columnsVisibleFun=function(){B.apply(this,arguments),C.fixFunObj.fixed_columnsVisibleFun.apply(this,arguments)},Object.assign(I,b.formShowFunOjb),Object.assign(I,y.headerLevelFunObj),Object.assign(I,$.localStorageFunObj),Object.assign(I,x.overWidthHiddenFunObj);var G=I.initEventFun,V=I.initGridEventFun;Object.assign(I,S.sortFunObj),I.initEventFun=function(){G.apply(this,arguments),S.sortFunObj.sort_initEventFun.apply(this,arguments)},I.initGridEventFun=function(){V.apply(this,arguments),S.sortFunObj.sort_initGridEventFun.apply(this,arguments)},Object.assign(I,F.sumRowFunObj);var N=I.initEventFun,q=I.initGridEventFun;Object.assign(I,R.swapFunObj),I.initEventFun=function(){N.apply(this,arguments),R.swapFunObj.swap_initEventFun.apply(this,arguments)},I.initGridEventFun=function(){q.apply(this,arguments),R.swapFunObj.swap_initGridEventFun.apply(this,arguments)};var P=I.initGridEventFun;Object.assign(I,j.treeFunObj),I.initGridEventFun=function(){P.apply(this,arguments),O.rowDragFunObj.rowDrag_initGridEventFun.apply(this,arguments)},Object.assign(I,j.treeFunObj),i.gridComp=T},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.createFunObj=void 0;var o=e(5),n=function(){var t="",i="",e="";this.ele.innerHTML="",i+=this.options.width?"width:"+this.options.width+";":"width:auto;",i+=this.options.height?"height:"+this.options.height+";":"height:auto;",""!=i&&(t='style="'+i+'"'),o.gridBrowser.isMobile&&(e="u-grid-mobile");var n='
";n+="
",this.ele.insertAdjacentHTML("afterBegin",n);var n='
';document.body.appendChild($(n)[0]),this.initEventFun(),this.widthChangeFun()},s=function(){this.repaintGridDivs(),this.realtimeTableRows=null},r=function(){if(!this.createGridFlag){$("#"+this.options.id)[0]&&($("#"+this.options.id)[0].innerHTML="");var t='
';t+=this.createHeader(),t+=this.createContent(),t+="
",$("#"+this.options.id)[0]&&$("#"+this.options.id).html(t),$("#"+this.options.id+"_column_menu").remove(),$(document.body).append(this.createColumnMenu()),this.initGridEventFun(),this.headerFirstClassFun(),this.showType="grid",this.afterGridDivsCreate(),this.createGridFlag=!0,this.realtimeTableRows=null}},d=function(){$("#"+this.options.id+"_grid").remove(null,!0),this.showType="",this.wholeWidth=0,this.createGridFlag=!1,this.columnsVisibleFun(),this.widthChangeFun(),this.realtimeTableRows=null},a=function(){return""},l=function(){var t="",i="";this.options.showHeader||(i='style="display:none;"');var e='
";return this.options.columnMenu&&(e+='
'),(this.options.multiSelect||this.options.showNumCol)&&(e+='
',this.options.multiSelect&&(e+=o.gridBrowser.isIE8?'
':'
'),this.options.showNumCol&&(e+='
'),e+="
"),e+=this.createHeaderTableFixed(),e+=this.createHeaderTable(),e+="
",e+=this.createHeaderDrag(),e+="
"},h=function(t){var i,e,o;if("fixed"==t?(i=parseInt(this.leftW),e="absolute;width:"+this.fixedWidth+"px;z-index:11;background:#F9F9F9;",o="fixed_"):(i="right"==this.options.fixedFloat?parseInt(this.leftW):parseInt(this.leftW)+parseInt(this.fixedWidth),e="relative;",o="",this.contentMinWidth>0&&(e+="width:"+this.contentMinWidth+"px;")),"fixed"==t&&"right"==this.options.fixedFloat)var n='';else var n='
';return n+=this.createColgroup(t),n+='',n+=this.createThead(t),n+="
"},c=function(){return""},p=function(){return""},f=function(t){var i,e=this,o="";return i="fixed"==t?this.gridCompColumnFixedArr:this.gridCompColumnArr,$.each(i,function(){this.options.visible&&(o+="1&&(o='style="height:'+(this.headerHeight-1)+'px;"',n=" u-grid-header-level-div ");var s='";return i="fixed"==t?this.gridCompColumnFixedArr:this.gridCompColumnArr,$.each(i,function(t){var i=e,o="";0==this.options.visible?(i=-1,o='style="display:none;"'):e++,s+='
';var r="";this.options.headerColor&&(r='style="color:'+this.options.headerColor+'"'),s+='",s+="
"}),s+=""},v=function(){var t="",i="",e="",o=0;if(this.countContentHeight){var n=$("#"+this.options.id)[0].offsetHeight;this.wholeHeight=n,n>0&&(this.contentHeight=parseInt(n)-this.exceptContentHeight-1>0?parseInt(n)-this.exceptContentHeight-1:0,this.contentHeight>0&&(t='style="height:'+this.contentHeight+'px;"'))}var s='
";return(this.options.showNumCol||this.options.multiSelect)&&(s+=this.createContentLeft(),this.contentWidth>this.contentMinWidth||(i="display:none;",e="bottom:0px;"),s+=this.createContentSumRow(e),u.isIOS&&(i+="width:0px;"),o="right"==this.options.fixedFloat?this.leftW:this.leftW+this.fixedWidth,s+='
',s+="
"),s+=this.createContentTableFixed(),s+=this.createContentTable(),s+="
"},w=function(){return""},g=function(){var t,i=this,e="",o=0,n="";return this.options.showSumRow&&(n="u-grid-content-left-sum"),this.options.multiSelect&&(e+='
',this.dataSourceObj.rows&&$.each(this.dataSourceObj.rows,function(t){e+=i.createContentLeftMultiSelectRow(this)}),e+="
",o+=this.multiSelectWidth),this.options.showNumCol&&(e+='
',this.dataSourceObj.rows&&$.each(this.dataSourceObj.rows,function(t,o){e+=i.createContentLeftNumColRow(t,o.value)}),e+="
"),e},_=function(t,i){var e="";!this.options.autoExpand&&t.level>0&&"block"!=i&&(e="display:none;");var n=t.value["$_#_@_id"];n||(n=setTimeout(function(){}));var s=t.value,r=this.selectRows,d=W(s,r);if(o.gridBrowser.isIE8)var a='
';else if(d)var a='
';else var a='
';return a},C=function(t){var i,e=this.dataSourceObj.rows[t],o=e.value,n=this.selectRows,s=W(o,n);return i=s?'
'+(t+1)+"
":'
'+(t+1)+"
"},b=function(t){var i,e,o,n,s,r;n=this.countContentHeight&&parseInt(this.contentHeight)>0?"height:"+this.contentHeight+"px;":"","fixed"==t?(i=parseInt(this.leftW),e="fixed_",s="fixed-",o="right"==this.options.fixedFloat?'style="position:absolute;width:'+this.fixedWidth+"px;right:0px;"+n+'"':'style="position:absolute;width:'+this.fixedWidth+"px;left:"+i+"px;"+n+'"',r='style="width:'+this.fixedWidth+'px;"'):(i="right"==this.options.fixedFloat?parseInt(this.leftW):parseInt(this.leftW)+parseInt(this.fixedWidth,0),e="",s="",o='style="position:relative;left:'+i+"px;"+n,this.contentMinWidth>0&&(o+="width:"+this.contentMinWidth+"px;"),this.options.noScroll&&(o+="overflow-x:hidden;"),o+='"',r="",this.contentMinWidth>0&&(r=this.contentWidth>0?'style="min-width:'+this.contentMinWidth+"px;width:"+this.contentWidth+'px;"':'style="min-width:'+this.contentMinWidth+'px;"'));var d='
";return d+='
",d+=this.createColgroup(t),d+='',d+=this.createThead(t),d+="",d+=this.createContentRows(t),d+="
","fixed"!=t&&(d+=this.createNoRowsDiv()),d+="
"},y=function(){return""},x=function(){var t="",i="";this.contentMinWidth>0&&(t+='style="width:'+this.contentMinWidth+'px;"'), -this.contentWidth>0&&(i+='style="width:'+this.contentWidth+'px;"');var e='
';return e+='
'+this.transMap.ml_no_rows+"
"},S=function(t){var i,e=this,o="";return i="fixed"==t?"fixed_":"",this.dataSourceObj.rows&&(o+='',$.each(this.dataSourceObj.rows,function(i){o+=e.createContentOneRow(this,t)}),o+=this.createContentRowsSumRow(t),o+=""),o},F=function(){return""},R=function(t,i,e){var o="";!this.options.autoExpand&&t.level>0&&"block"!=e&&(o='style="display:none"');var n=t.value,s=this.selectRows,r=W(n,s),d="";return d=r?'":'",d+=this.createContentOneRowTd(t,i),d+=""},O=function(t,i,e,o,n){var s=t.insertRow(i+1);s.setAttribute("role","row"),!this.options.autoExpand&&s.level>0&&"block"!=n&&(s.style.display="none"),this.createContentOneRowTdForIE(s,e,o)},j=function(t){var i=$("#"+this.options.id+"_content_tbody").find('tr[role="row"]')[t],e=$("#"+this.options.id+"_content_fixed_tbody").find('tr[role="row"]')[t],n=this.dataSourceObj.rows[t],s=$(i),r=this.getTrIndex(s);if(o.gridBrowser.isIE8||o.gridBrowser.isIE9){var d=$("#"+this.options.id+"_content_table")[0],a=$("#"+this.options.id+"_content_fixed_table")[0],l=i.className,h=e.className;d.deleteRow(t+1),a.deleteRow(t+1);var i=d.insertRow(t+1);u.addClass(i,l);var e=a.insertRow(t+1);u.addClass(e,h),this.createContentOneRowTdForIE(i,n),this.createContentOneRowTdForIE(e,n,"fixed")}else i.innerHTML=this.createContentOneRowTd(n),e&&(e.innerHTML=this.createContentOneRowTd(n,"fixed"));var c={};c.begin=r,c.length=1,this.renderTypeFun(c)},T=function(t,i){var e,o=this,n="",s=t.value;return e="fixed"==i?this.gridCompColumnFixedArr:this.gridCompColumnArr,$.each(e,function(){var i=this.options.field,e=$(s).attr(i);e=o.getString(e,""),"object"==$.type(e)&&(e=e.showValue);var r=(this.options.renderType,""),d="",a="",l="";if(o.options.showTree&&this.firstColumn){var h=parseInt(o.treeLeft)*parseInt(t.level);r='style="position:relative;',t.hasChild?d=o.options.autoExpand?'':'':h+=16,r+="left:"+h+'px;"'}this.options.visible||(l='style="display:none;"'),this.options.icon&&(a=''),n+='
"+d+a+""+e.replace(/\/g,">")+"
"}),n},I=function(t,i,e){var o,n=this,s=i.value;o="fixed"==e?this.gridCompColumnFixedArr:this.gridCompColumnArr,$.each(o,function(){var e=this.options.field,o=$(s).attr(e),o=n.getString(o,"");"object"==$.type(o)&&(o=o.showValue);var r=(this.options.renderType,""),d="",a="",l="",h=t.insertCell();if(h.setAttribute("role","rowcell"),n.options.showTree&&this.firstColumn){var u=parseInt(n.treeLeft)*parseInt(i.level);r='style="position:relative;',i.hasChild?d=n.options.autoExpand?'':'':u+=18,r+="left:"+u+'px;"'}this.options.visible||(h.style.display="none"),this.options.icon&&(a=''),l+='
"+d+a+""+o.replace(/\/g,">")+"
",h.insertAdjacentHTML("afterBegin",l)})},A=function(){var t=$("#"+this.options.id+"_content").parent();if($("#"+this.options.id+"_content").remove(null,!0),t[0]){var i=this.createContent();t[0].insertAdjacentHTML("beforeEnd",i),this.renderTypeFun(),this.initContentDivEventFun(),$("#"+this.options.id+"_content_div")[0]&&($("#"+this.options.id+"_content_div")[0].scrollLeft=this.scrollLeft),$("#"+this.options.id+"_content_edit_menu").css("display","none")}this.realtimeTableRows=null},W=function(t,i){for(var e=i.length,o=0,n=0;n0};i.createFunObj={createDivs:n,repaintDivs:s,createGridDivs:r,repaintGridDivs:d,createColumnMenu:a,createHeader:l,createHeaderTable:h,createHeaderTableFixed:c,createHeaderDrag:p,createColgroup:f,createThead:m,createContent:v,createContentSumRow:w,createContentLeft:g,createContentLeftMultiSelectRow:_,createContentLeftNumColRow:C,createContentTable:b,createContentTableFixed:y,createNoRowsDiv:x,createContentRows:S,createContentRowsSumRow:F,createContentOneRow:R,createContentOneRowForIE:O,repaintRow:j,createContentOneRowTd:T,createContentOneRowTdForIE:I,repairContent:A}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(t){var i=this;if($("#"+i.options.id+"_content_tbody").find("tr").removeClass("u-grid-move-bg"),$("#"+i.options.id+"_content_fixed_tbody").find("tr").removeClass("u-grid-move-bg"),i.options.multiSelect&&$("#"+i.options.id+"_content_multiSelect").find("div").removeClass("u-grid-move-bg"),i.options.showNumCol&&$("#"+i.options.id+"_content_numCol").find("div").removeClass("u-grid-move-bg"),t>-1){var e=$("#"+i.options.id+"_content_tbody").find("tr").eq(t);if(e[0].id&&e[0].id==i.options.id+"_edit_tr")return;if($("#"+i.options.id+"_content_tbody").find("tr").eq(t).addClass("u-grid-move-bg"),$("#"+i.options.id+"_content_fixed_tbody").find("tr").eq(t).addClass("u-grid-move-bg"),i.options.multiSelect&&$("#"+i.options.id+"_content_multiSelect").find("div").eq(t).addClass("u-grid-move-bg"),i.options.showNumCol&&$("#"+i.options.id+"_content_numCol").find("div").eq(t).addClass("u-grid-move-bg"),"function"==typeof i.options.onRowHover&&!e.is(".u-grid-content-sum-row")){var o={};o.gridObj=i,o.rowObj=i.dataSourceObj.rows[t],o.rowIndex=t,i.options.onRowHover(o)}}},o=function(t){this.widthChangeFun(),this.heightChangeFun(),this.editorRowChangeFun()},n=function(){},s=function(){"grid"==this.showType&&(this.columnsVisibleFun(),this.resetThVariable(),this.countRowHeight(),this.noRowsShowFun(),this.renderTypeFun(),this.resetScrollLeft(),this.hideEditMenu(),this.resetLeftHeight(),this.isCheckedHeaderRow(),"function"==typeof this.options.afterCreate&&this.options.afterCreate.call(this))},r=function(){$("#"+this.options.id+"_content_tbody tr")[0]&&(this.rowHeight=$("#"+this.options.id+"_content_tbody tr")[0].offsetHeight)},d=function(){var t=this;this.resetLeftHeightSetTimeout&&clearTimeout(this.resetLeftHeightSetTimeout),this.resetLeftHeightSetTimeout=setTimeout(function(){a.call(t)},100)},a=function(){if(this.options.showNumCol||this.options.multiSelect)for(var t=$("#"+this.options.id+"_content_tbody tr"),i=$("#"+this.options.id+"_content_numCol div"),e=$("#"+this.options.id+"_content_multiSelect > div"),o=0;o0?($("#"+this.options.id+"_noRowsShow").css("display","none"),$("#"+this.options.id+"_noRows").css("display","none")):($("#"+this.options.id+"_noRowsShow").css("display","block"),$("#"+this.options.id+"_noRows").css("display","block"))},h=function(){this.resetScrollLeft(),this.hideEditMenu()},u=function(){if($("#"+this.options.id+"_content_div")[0])try{$("#"+this.options.id+"_content_div")[0].scrollLeft=this.scrollLeft}catch(t){}},c=function(){};i.createCalFunOjb={trHoverFun:e,setIntervalFun:o,editorRowChangeFun:n,afterGridDivsCreate:s,countRowHeight:r,noRowsShowFun:l,afterRepaintGrid:h,resetScrollLeft:u,hideEditMenu:c,resetLeftHeight:d}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(t,i){for(var e=0;e1&&(this.options.canSwap=!1);var t=window.location.href,i=t.indexOf("?");i>0&&(t=t.substring(0,i)),this.localStorageId=this.options.id+t},u=function(){},c=function(){this.initDataSourceVariable(),this.mouseUpX="mouseUpX",this.mouseUpY="mouseUpY",this.mouseDownX="mouseDownX",this.mouseDownY="mouseDownY",this.mouseMoveX="mouseMoveX",this.mouseMoveY="mouseMoveY",this.scrollLeft=0,this.scrollTop=0,this.showType="",this.createGridFlag=!1,this.columnClickX=0,this.columnClickY=0,this.columnMenuMove=!1,this.firstColumn=!0,this.lastVisibleColumn=null,this.lastVisibleColumnWidth=0,this.columnMenuMove=!1,this.createColumnMenuFlag=!1,this.menuColumnsHeight=0,this.createFormFlag=!1,this.$sd_storageData=null},p=function(){this.selectRows=new Array,this.selectRowsObj=new Array,this.selectRowsIndex=new Array,this.allRows=new Array,this.eidtRowIndex=-1},f=function(){this.wholeWidth=0,this.wholeHeight=0,this.rowHeight=0,this.contentRealWidth=0,this.contentWidth=0,this.contentMinWidth=0,this.contentHeight=0,this.fixedRealWidth=0,this.fixedWidth=0},m=function(){var t=this;this.initGridCompColumnVar(),this.options.columns&&$.each(this.options.columns,function(i){t.initGridCompColumnFun(this)}),this.initGridCompColumnLoacl(),this.initGridHiddenLevelColumn(),this.initGridCompFixedColumn(),this.columnsVisibleFun()},v=function(){this.gridCompColumnArr=new Array,this.basicGridCompColumnArr=new Array,this.gridCompColumnFixedArr=new Array,this.gridCompLevelColumn=new Array,this.gridCompHiddenLevelColumnArr=new Array},w=function(t){var i=new n.column(t,this);this.editHeadTitleIcon(i);var e=i.options.width+"";e.indexOf("%")>0?this.options.noScroll="true":i.options.width=parseInt(i.options.width),i.options.optionsWidth=i.options.width,i.options.realWidth=i.options.width,this.gridCompColumnArr.push(i),this.initGridCompColumnColumnMenuFun(t),this.initGridCompColumnHeaderLevelFun(t)},g=function(t){},_=function(t){},C=function(t){},b=function(){},y=function(){},x=function(t,i){},S=function(){this.dataSourceObj=new o.dataSource(this.options.dataSource,this)};i.initFunObj={init:s,getBooleanOptions:r,initDefault:d,initGrid:a,destroySelf:l,initOptions:h,initOptionsTree:u,initVariable:c,initDataSourceVariable:p,initWidthVariable:f,initGridCompColumn:m,initGridCompColumnVar:v,initGridCompColumnFun:w,initGridCompColumnColumnMenuFun:g,initGridCompColumnHeaderLevelFun:_,initGridCompColumnLoacl:C,initGridHiddenLevelColumn:b,initGridCompFixedColumn:y,setRequired:x,initDataSource:S}},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.eidtFunObj=void 0;var o=(e(4),e(5)),n=function(){$("#"+this.options.id+"_content_edit_menu").css("display","none")},s=function(t,i){var e=$(t.target).closest("tr"),o=$(t.target).closest("td"),n=o.index();this.options.editable&&(this.eidtRowIndex!=i||"default"==this.options.editType&&this.editColIndex!=n)&&(this.editClose(),this.editRowFun(e,n))},r=function(t,i){var e=this.getTrIndex(t);if("function"==typeof this.options.onBeforeEditFun){var o={};if(o.gridObj=this,o.rowObj=this.dataSourceObj.rows[e],o.rowIndex=e,o.colIndex=i,o.$tr=t,!this.options.onBeforeEditFun(o))return void(this.eidtRowIndex!=-1&&this.editClose())}this.eidtRowIndex!=-1&&this.editClose();var e="number"==typeof t?t:this.getTrIndex(t);return this.eidtRowIndex=e,this.editColIndex=i,this.editRow(t,i),!0},d=function(t){this.eidtRowIndex!=-1&&this.editClose(),this.eidtRowIndex=t,this.editColIndex=0,this.editRow()},a=function(t,i){if(!(i<0)){var e=this,o=!1;t&&t.parents("table").attr("id").indexOf("_fixed_")>-1&&(o=!0),t=t||$("#"+this.options.id+'_content_tbody tr[role="row"]:eq('+this.eidtRowIndex+")"),i=i||0;var n=this.dataSourceObj.rows[this.eidtRowIndex].value;if(this.editRowObj=this.cloneObj(n),"default"==this.options.editType){var s=o?this.gridCompColumnFixedArr[i]:this.gridCompColumnArr[i];if(s.options.editable){var r=$("td:eq("+i+")",t)[0],d=s.options.field,a=$(n).attr(d);a=e.getString(a,"");var l={};l.td=r,l.value=a,l.field=d,l.editType=s.options.editType,l.rowObj=e.editRowObj,l.$tr=t,l.colIndex=i,e.editCell(l)}$("#"+this.options.id+"_content_edit_menu").css("display","block"),$("#"+this.options.id+"_content_edit_menu_cancel").css("marginLeft","10px");var h=$("tr:visible",t.parent()).index(t);this.rowHeight=t.height();this.rowHeight*(h+1)+this.headerHeight+1}else if("form"==this.options.editType)if("function"==typeof this.options.formEditRenderFun){if(this.fixedWidth>0)var u=$("#"+this.options.id+"_content_fixed_table")[0];else var u=$("#"+this.options.id+"_content_table")[0];var c=u.insertRow(this.eidtRowIndex+2);c.id=this.options.id+"_edit_tr",$(c).addClass("grid_edit_form_tr");var p=c.insertCell();p.id=this.options.id+"_edit_td",$(p).addClass("grid_edit_form_td"),p.style.borderBottom="0px",p.style.background="#fff";var f=parseInt(this.contentMinWidth)+parseInt(this.fixedWidth),m='
';m+="
",p.innerHTML=m;var l={};l.grid=gridObj,l.element=$("#"+this.options.id+"_edit_form")[0],l.editRowObj=this.editRowObj,this.options.formEditRenderFun.call(this,l);var m='
';$("#"+this.options.id+"_edit_form")[0].insertAdjacentHTML("beforeEnd",m);var v=$("#"+this.options.id+"_edit_td")[0].offsetHeight,w=$("#"+this.options.id+"_edit_form").css("background-color");if(this.options.multiSelect){var g=$("#"+this.options.id+"_content_multiSelect > div").eq(this.eidtRowIndex),m='
';g[0].insertAdjacentHTML("afterEnd",m)}if(this.options.showNumCol){var g=$("#"+this.options.id+"_content_numCol > .u-grid-content-num").eq(this.eidtRowIndex),m='
';g[0].insertAdjacentHTML("afterEnd",m)}if($("#"+this.options.id+"_content_edit_menu").css("display","block"),this.fixedWidth>0){var _=$("#"+this.options.id+"_content_table")[0],C=_.insertRow(this.eidtRowIndex+2);C.id=this.options.id+"_edit_tr1"}}else{if(this.fixedWidth>0)var u=$("#"+this.options.id+"_content_fixed_table")[0];else var u=$("#"+this.options.id+"_content_table")[0];var c=u.insertRow(this.eidtRowIndex+2);c.id=this.options.id+"_edit_tr",$(c).addClass("grid_edit_form_tr");var p=c.insertCell();p.id=this.options.id+"_edit_td",$(p).addClass("grid_edit_form_td"),p.style.borderBottom="0px";var f=parseInt(this.contentMinWidth)+parseInt(this.fixedWidth),m='
';if($.each(this.gridCompColumnFixedArr,function(t){var i=!1;if(this.options.editFormShow&&(this.options.editable||!this.options.editable&&e.options.noneEditableFormShow)&&(i=!0),i){var o=this.options.field,s=$(n).attr(o);s=e.getString(s,"");var r=this.options.title,d=this.options.headerColor;m+=e.formEditCell(s,o,r,this.options.required,d)}}),$.each(this.gridCompColumnArr,function(t){var i=!1;if(this.options.editFormShow&&(this.options.editable||!this.options.editable&&e.options.noneEditableFormShow)&&(i=!0),i){var o=this.options.field,s=$(n).attr(o);s=e.getString(s,"");var r=this.options.title,d=this.options.headerColor;m+=e.formEditCell(s,o,r,this.options.required,d)}}),m+="
",p.innerHTML=m,$.each(this.gridCompColumnFixedArr,function(o){var s=!1;if(this.options.editFormShow&&(this.options.editable||!this.options.editable&&e.options.noneEditableFormShow)&&(s=!0),s){var r=this.options.field,d=$("#"+e.options.id+"_edit_"+r)[0],a=$(n).attr(r);this.options.title;a=e.getString(a,"");var l={};l.td=d,d.innerHTML='
',l.value=a,l.field=r,l.editType=this.options.editType,l.rowObj=e.editRowObj,l.$tr=t,l.colIndex=i,m+=e.editCell(l)}}),$.each(this.gridCompColumnArr,function(o){var s=!1;if(this.options.editFormShow&&(this.options.editable||!this.options.editable&&e.options.noneEditableFormShow)&&(s=!0),s){var r=this.options.field,d=$("#"+e.options.id+"_edit_"+r)[0],a=$(n).attr(r);this.options.title;a=e.getString(a,"");var l={};l.td=d,d.innerHTML='
',l.value=a,l.field=r,l.editType=this.options.editType,l.rowObj=e.editRowObj,l.$tr=t,l.colIndex=i,m+=e.editCell(l)}}),"function"==typeof this.options.renderEditMemu)this.options.renderEditMemu.apply(this,[$("#"+this.options.id+"_edit_form")[0],this.eidtRowIndex,this.dataSourceObj.rows.length]);else{var m='
";$("#"+this.options.id+"_edit_form")[0].insertAdjacentHTML("beforeEnd",m),$("#"+this.options.id+"_content_edit_menu_close").on("click",function(t){e.editClose()})}var v=$("#"+this.options.id+"_edit_td")[0].offsetHeight,w=$("#"+this.options.id+"_edit_form").css("background-color");if(this.options.multiSelect){var g=$("#"+this.options.id+"_content_multiSelect > div").eq(this.eidtRowIndex),m='
';g[0].insertAdjacentHTML("afterEnd",m)}if(this.options.showNumCol){var g=$("#"+this.options.id+"_content_numCol > .u-grid-content-num").eq(this.eidtRowIndex),m='
';g[0].insertAdjacentHTML("afterEnd",m)}if($("#"+this.options.id+"_content_edit_menu").css("display","block"),this.fixedWidth>0){var _=$("#"+this.options.id+"_content_table")[0],C=_.insertRow(this.eidtRowIndex+2);C.id=this.options.id+"_edit_tr1"}}}},l=function(){var t=!0;if(!(this.eidtRowIndex<0)){var i=this.dataSourceObj.rows[this.eidtRowIndex],e=null;this.editComp&&this.editComp.hide&&(this.editComp.hide(),t=!1);try{var e=this.editComp.element.parentNode.querySelector("input")}catch(t){}e&&(e.blur(),t=!1),this.editComp&&this.editComp.comp&&this.editComp.comp.hide&&(this.editComp.comp.hide(),t=!1);try{$("#"+this.options.id+"_placeholder_div").remove()}catch(t){}if(i){if("form"!=this.options.editType){var o={};o.begin=this.eidtRowIndex,o.length=1,this.renderTypeFun(o)}$("#"+this.options.id+"_content_edit_menu").css("display","none"),this.repairSumRow(),this.noRowsShowFun(),this.updateLastRowFlag(),this.eidtRowIndex=-1,$("#"+this.options.id+"_multiSelect_edit").remove(null,!0),$("#"+this.options.id+"_numCol_edit").remove(null,!0),$("#"+this.options.id+"_edit_tr").remove(null,!0),$("#"+this.options.id+"_edit_tr1").remove(null,!0)}}},h=function(t){var i=t.td,e=t.value,o=t.field,n=t.editType,s=t.rowObj,r=t.$tr,d=t.colIndex,a=this;if(0==t.colIndex)try{this.iconSpan="",this.iconSpan=$(i).find(".uf")[0].outerHTML}catch(t){}else this.iconSpan="";var t={};if(t.td=i,t.field=o,t.$tr=r,t.colIndex=d,a.newEditObj=t,"text"==n)"default"==this.options.editType?i.innerHTML='
':i.innerHTML='
',$("input",$(i)).on("blur",function(){a.editValueChange(o,this.value)});else if("function"==typeof n){var t={},l=$(".u-grid-content-td-div",$(i));if(l.removeClass("u-grid-content-td-div-over"),t.gridObj=this,t.element=l[0],"default"==this.options.editType){var h=t.element.offsetHeight,c='
';l[0].innerHTML=c,t.element=$("#"+this.options.id+"_placeholder_div")[0]}t.value=e,t.field=o,t.rowObj=s,n.call(this,t)}$("input",$(i)).off("keydown"),$("input",$(i)).on("keydown",function(t){if("form"==a.options.editType);else{t.keyCode;13!=t.keyCode&&9!=t.keyCode||(this.blur(),setTimeout(function(){a.nextEditShow()},100),u.stopEvent(t))}}),"default"==this.options.editType&&$("input:first",$(i)).focus()},c=function(){var t=this.newEditObj,i=t.td,e=t.$tr,o=parseInt(t.colIndex)+1;if(0==$(i).next("td").length){var n=e.next("tr");if(!(n.length>0))return;e=n,o=0,e.click()}o=p(this,o,e),this.editRowFun(e,o)},p=function t(i,e,o){var n=-1,s=i.gridCompColumnArr[e],r=!0,d=i.getTrIndex(o);if("function"==typeof i.options.onBeforeEditFun){var a={};a.gridObj=i,a.rowObj=i.dataSourceObj.rows[d],a.rowIndex=d,a.colIndex=e,a.$tr=o,i.options.onBeforeEditFun(a)||(r=!1)}return n=s.options.visible&&s.options.editable&&r?e:t(i,e+1,o)},f=function(t,i){this.eidtRowIndex>-1&&this.eidtRowIndex0&&("checkbox"==$("#"+this.options.id+"_edit_field_"+i)[0].type?"Y"==e||"true"==e||e===!0?$("#"+this.options.id+"_edit_field_"+i)[0].checked=!0:$("#"+this.options.id+"_edit_field_"+i)[0].checked=!1:$("#"+this.options.id+"_edit_field_"+i)[0].value=e))},w=function(t,i){var e=this.getColumnByField(t);e.options.editType=i},g=function(t){this.options.editable=t,this.setColumnEdit(),this.editClose()},_=function(){var t;for(t=0;t'),i.removeClass("u-grid-hide-title-icon")):i.addClass("u-grid-hide-title-icon")},b=function(){var t=this;$(document).on("click",function(i){if(t.options.editable&&"default"==t.options.editType){var e=$(i.target),o=!0;o=!($(i.target).closest(".u-grid-content-td-div").length>0)&&o;var n=t.options.customEditPanelClass;if(n){var s=n.split(",");$.each(s,function(){o=!(e.closest("."+this).length>0)&&o})}"grid-for-edit"==e.attr("role")&&(o=!1),o&&t.editClose()}}),u.on(document,"scroll",function(){"default"==t.options.editType&&(o.gridBrowser.isIE10||o.gridBrowser.isIPAD||t.editClose())}),$("div").on("scroll",function(){"default"==t.options.editType&&(o.gridBrowser.isIE10||o.gridBrowser.isIPAD||t.editClose())})},y=function(t){this.options.editType=t},x=function(t,i,e){this.options.editType=t;var o=$("#"+this.options.id+"_content_tbody"),n=$("tr:eq("+i+")",o);this.editRowFun(n,e)},S=function(t){this.options.showEditIcon&&this.options.editable&&t.options.editable&&(t.options.title+='')};i.eidtFunObj={hideEditMenu:n,clickFunEdit:s,editRowFun:r,editRowIndexFun:d,editRow:a,editClose:l,editCell:h,nextEditShow:c,editValueChange:f,updateEditRowIndex:m,updateValueAtEdit:v,setEditType:w,setEditable:g,setColumnEdit:_,editFieldIcon:C,setGridEditType:y,setGridEditTypeAndEditRow:x,editHeadTitleIcon:S,edit_initEventFun:b}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(){0!==this.selectRows.length&&this.selectRows.length==this.dataSourceObj.rows.length?$("#"+this.options.id+"_header_multi_input").addClass("is-checked"):$("#"+this.options.id+"_header_multi_input").removeClass("is-checked")},o=function(t,i){var e="none",o={},n=this.dataSourceObj.rows.length,s=!1;o.value=t,e;var r=this.addOneRowTree(t,i,o);i=r.index,e=r.displayFlag,0!=i&&(i&&i>0?ni+1&&$.each(this.dataSourceObj.rows,function(t){t>i&&(this.valueIndex=this.valueIndex+1)});var n=0;if(this.options.showTree?(this.dataSourceObj.options.values?n=this.dataSourceObj.options.values.length:this.dataSourceObj.options.values=new Array,this.dataSourceObj.options.values.splice(i,0,t),this.addOneRowTreeHasChildF(o)):(this.dataSourceObj.options.values||(this.dataSourceObj.options.values=new Array),this.dataSourceObj.options.values.splice(i,0,t)),"grid"==this.showType){this.editClose(),this.updateEditRowIndex("+",i);try{var d=this.createContentOneRow(o,"normal",e);if(s)$("#"+this.options.id+"_content_tbody")[0].insertAdjacentHTML("beforeEnd",d);else{var a=$("#"+this.options.id+"_content_tbody").find('tr[role="row"]')[i],l=$("#"+this.options.id+"_content_tbody")[0];a?a.insertAdjacentHTML("beforeBegin",d):l&&l.insertAdjacentHTML("afterBegin",d)}if($("#"+this.options.id+"_content_fixed_div").length>0){var d=this.createContentOneRow(o,"fixed",e);if(s)$("#"+this.options.id+"_content_fixed_tbody")[0].insertAdjacentHTML("beforeEnd",d);else{var a=$("#"+this.options.id+"_content_fixed_tbody").find('tr[role="row"]')[i];a?a.insertAdjacentHTML("beforeBegin",d):$("#"+this.options.id+"_content_fixed_tbody")[0]&&$("#"+this.options.id+"_content_fixed_tbody")[0].insertAdjacentHTML("afterBegin",d)}}}catch(t){var h=$("#"+this.options.id+"_content_div table")[0];h&&this.createContentOneRowForIE(h,i,o,"normal",e);var u=$("#"+this.options.id+"_content_fixed_div table")[0];u&&this.createContentOneRowForIE(u,i,o,"fixed",e)}if(this.options.multiSelect){var d=this.createContentLeftMultiSelectRow(o,e);if(s)$("#"+this.options.id+"_content_multiSelect")[0].insertAdjacentHTML("beforeEnd",d);else{var c=$("#"+this.options.id+"_content_multiSelect").find("div")[i];c?c.insertAdjacentHTML("beforeBegin",d):$("#"+this.options.id+"_content_multiSelect")[0].insertAdjacentHTML("afterBegin",d)}}if(this.options.showNumCol){var d=this.createContentLeftNumColRow(n,t);if(s)$("#"+this.options.id+"_content_numCol")[0].insertAdjacentHTML("beforeEnd",d);else{var c=$("#"+this.options.id+"_content_numCol").find("div")[i]; -c?c.insertAdjacentHTML("beforeBegin",d):$("#"+this.options.id+"_content_numCol")[0].insertAdjacentHTML("afterBegin",d)}this.resetNumCol(),this.updateNumColLastRowFlag()}this.repairSumRow(),this.noRowsShowFun(),this.updateLastRowFlag();var p={};p.begin=i,p.length=1,this.renderTypeFun(p)}},n=function(t,i){return i},s=function(){},r=function(){},d=function(t,i){if(this.$ele.data("gridComp")==this)if(this.options.showTree)for(var e=t.length,o=0;o0?ei+t.length&&$.each(this.dataSourceObj.rows,function(e){e>i+t.length-1&&(this.valueIndex=this.valueIndex+t.length)}),"grid"==this.showType&&$("#"+this.options.id+"_content_div tbody")[0]){$.each(h,function(t,i){n+=a.createContentOneRow(this),d+=a.createContentOneRowFixed(this),a.options.multiSelect&&(s+=a.createContentLeftMultiSelectRow(this)),a.options.showNumCol&&(r+=a.createContentLeftNumColRow(e+t,i.value))});try{l?$("#"+this.options.id+"_content_div tbody")[0].insertAdjacentHTML("beforeEnd",n):$("#"+this.options.id+"_content_div").find("tbody").find('tr[role="row"]')[i]?$("#"+this.options.id+"_content_div").find("tbody").find('tr[role="row"]')[i].insertAdjacentHTML("beforeBegin",n):$("#"+this.options.id+"_content_div tbody")[0]&&$("#"+this.options.id+"_content_div tbody")[0].insertAdjacentHTML("afterBegin",n),l?$("#"+this.options.id+"_content_fixed_div tbody")[0].insertAdjacentHTML("beforeEnd",d):$("#"+this.options.id+"_content_fixed_div").find("tbody").find('tr[role="row"]')[i]?$("#"+this.options.id+"_content_fixed_div").find("tbody").find('tr[role="row"]')[i].insertAdjacentHTML("beforeBegin",d):$("#"+this.options.id+"_content_fixed_div tbody")[0]&&$("#"+this.options.id+"_content_fixed_div tbody")[0].insertAdjacentHTML("afterBegin",d)}catch(t){var u=$("#"+this.options.id+"_content_div table")[0],c=$("#"+this.options.id+"_content_fixed_div table")[0];u&&c&&$.each(h,function(t){a.createContentOneRowForIE(u,i+t,this),a.createContentOneRowForIE(c,i+t,this,"fixed")})}if(this.options.multiSelect)if(l)$("#"+this.options.id+"_content_multiSelect")[0].insertAdjacentHTML("beforeEnd",s);else{var p=$("#"+this.options.id+"_content_multiSelect").find("div")[i];p?p.insertAdjacentHTML("beforeBegin",s):$("#"+this.options.id+"_content_multiSelect")[0].insertAdjacentHTML("afterBegin",s)}if(this.options.showNumCol){if(l)$("#"+this.options.id+"_content_numCol")[0].insertAdjacentHTML("beforeEnd",r);else{var p=$("#"+this.options.id+"_content_numCol").find("div")[i];p?p.insertAdjacentHTML("beforeBegin",r):$("#"+this.options.id+"_content_numCol")[0].insertAdjacentHTML("afterBegin",r)}this.resetNumCol(),this.updateNumColLastRowFlag()}this.repairSumRow(),this.noRowsShowFun();var f={};f.begin=i,f.length=t.length,this.renderTypeFun(f)}this.updateLastRowFlag(),this.isCheckedHeaderRow()}},a=function(t){return""},l=function(t,i,e){},h=function(t){var i=this;t=parseInt(t);var e=this.dataSourceObj.rows[t];if(e){var o=e.value;if("grid"==this.showType&&this.editClose(),this.dataSourceObj.rows.splice(t,1),this.updateEditRowIndex("-",t),this.dataSourceObj.options.values){var n=this.dataSourceObj.options.values.indexOf(o);this.dataSourceObj.options.values.splice(n,1)}if(this.dataSourceObj.rows.length>t+1&&$.each(this.dataSourceObj.rows,function(i){i>=t&&(this.valueIndex=this.valueIndex-1)}),this.selectRows&&$.each(this.selectRows,function(e){this==o?(i.selectRows.splice(e,1),i.selectRowsObj.splice(e,1),i.selectRowsIndex.splice(e,1)):i.selectRowsIndex[e]>t&&(i.selectRowsIndex[e]=i.selectRowsIndex[e]-1)}),this.focusRow&&(this.focusRow==o?(this.focusRow=null,this.focusRowObj=null,this.focusRowIndex=null):this.focusRowIndex>t&&(this.focusRowIndex=this.focusRowIndex-1)),"grid"==this.showType&&($("#"+this.options.id+"_content_div tbody tr:eq("+t+")").remove(),$("#"+this.options.id+"_content_fixed_div tbody tr:eq("+t+")").remove(),$("#"+this.options.id+"_content_multiSelect >div:eq("+t+")").remove(),$("#"+this.options.id+"_content_numCol >.u-grid-content-num:eq("+t+")").remove(),this.resetNumCol(),this.repairSumRow(),this.noRowsShowFun(),this.updateNumColLastRowFlag()),this.deleteOneRowTree(),"function"==typeof this.options.onRowDelete){var s={};if(s.gridObj=this,s.index=t,s.row=e,!this.options.onRowDelete(s))return}this.isCheckedHeaderRow()}},c=function(){},p=function(){},f=function(t){var i=this,e=new Array;$.each(t,function(i){e.push(t[i])}),e.sort(function(t,i){return i-t}),$.each(e,function(t){i.deleteOneRow(this)}),this.isCheckedHeaderRow()},m=function(t,i){if(t>-1&&t-1&&t0&&$.each(this.selectRowsObj,function(){this.checked=!1}),this.selectRows=new Array,this.selectRowsObj=new Array,this.selectRowsIndex=new Array,"grid"==this.showType&&($("#"+this.options.id+"_content_tbody tr").removeClass("u-grid-content-sel-row"),$("#"+this.options.id+"_content_tbody tr a").removeClass("u-grid-content-sel-row"),$("#"+this.options.id+"_content_fixed_tbody tr").removeClass("u-grid-content-sel-row"),$("#"+this.options.id+"_content_fixed_tbody tr a").removeClass("u-grid-content-sel-row"),this.options.multiSelect&&$("#"+this.options.id+"_content_multiSelect div").removeClass("u-grid-content-sel-row"),this.options.showNumCol&&$("#"+this.options.id+"_content_numCol div").removeClass("u-grid-content-sel-row"));if("grid"==this.showType){$(o).addClass("u-grid-content-sel-row"),n=i&&i.fixContentTrs?i.fixContentTrs[t]:this.$ele.find("#"+this.options.id+'_content_fixed_tbody tr[role="row"]')[t],$(n).addClass("u-grid-content-sel-row");var a=t;this.eidtRowIndex>-1&&this.eidtRowIndex-1&&this.eidtRowIndexdiv:eq("+o+")").removeClass("u-grid-content-sel-row"),this.options.showNumCol&&$("#"+this.options.id+"_content_numCol >div:eq("+o+")").removeClass("u-grid-content-sel-row"),$.each(this.selectRows,function(e){this==i.dataSourceObj.rows[t].value&&(i.selectRows.splice(e,1),i.selectRowsObj.splice(e,1),i.selectRowsIndex.splice(e,1))}),this.dataSourceObj.rows[t].checked=!1,$("#"+this.options.id+"_header_multi_input").removeClass("is-checked"),"function"==typeof this.options.onRowUnSelected){var e={};e.gridObj=this,e.rowObj=this.dataSourceObj.rows[t],e.rowIndex=t,this.options.onRowUnSelected(e)}return i.isCheckedHeaderRow(),!0},b=function(){if($("#"+this.options.id+"_header_multi_input").addClass("is-checked"),"function"==typeof this.options.onBeforeAllRowSelected){var t={};if(t.gridObj=this,t.rowObjs=this.dataSourceObj.rows,!this.options.onBeforeAllRowSelected(t))return}var i=this.$ele.find("#"+this.options.id+"_content_multiSelect").children(),e=this.$ele.find("#"+this.options.id+"_content_numCol").children(),o=this.$ele.find("#"+this.options.id+'_content_tbody tr[role="row"]'),n=this.$ele.find("#"+this.options.id+'_content_fixed_tbody tr[role="row"]');this.$ele.find("#"+this.options.id+'_content_tbody tr[role="row"]');for(var s=0;s-1&&this.eidtRowIndexdiv:eq("+e+")").addClass("u-grid-content-focus-row"),this.options.showNumCol&&$("#"+this.options.id+"_content_numCol >div:eq("+e+")").addClass("u-grid-content-focus-row"),this.focusRow=this.dataSourceObj.rows[t].value,this.focusRowObj=this.dataSourceObj.rows[t],this.focusRowIndex=t,this.dataSourceObj.rows[t].focus=!0,"function"==typeof this.options.onRowFocus){var i={};i.gridObj=this,i.rowObj=this.dataSourceObj.rows[t],i.rowIndex=t,this.options.onRowFocus(i)}return!0},S=function(t){if(!this.dataSourceObj.rows[t])return!0;if("function"==typeof this.options.onBeforeRowUnFocus){var i={};if(i.gridObj=this,i.rowObj=this.dataSourceObj.rows[t],i.rowIndex=t,!this.options.onBeforeRowUnFocus(i))return!1}if(!this.dataSourceObj.rows[t].focus)return!0;var e=t;if(this.eidtRowIndex>-1&&this.eidtRowIndexdiv:eq("+e+")").removeClass("u-grid-content-focus-row"),this.options.showNumCol&&$("#"+this.options.id+"_content_numCol >div:eq("+e+")").removeClass("u-grid-content-focus-row"),this.dataSourceObj.rows[t].focus=!1,this.focusRow=null,this.focusRowObj=null,this.focusRowIndex=null,"function"==typeof this.options.onRowUnFocus){var i={};i.gridObj=this,i.rowObj=this.dataSourceObj.rows[t],i.rowIndex=t,this.options.onRowUnFocus(i)}return this.options.multiSelect||this.setRowUnselect(t),!0},F=function(){var t=$("#"+this.options.id+"_content_numCol >.u-grid-content-num");$.each(t,function(t){this.innerHTML=t+1+""})};i.operateRowFunObj={isCheckedHeaderRow:e,addOneRow:o,addOneRowTree:n,addOneRowTreeHasChildF:s,editClose:r,addRows:d,createContentOneRowFixed:a,updateEditRowIndex:l,deleteOneRow:h,repairSumRow:c,deleteOneRowTree:p,deleteRows:f,updateRow:m,updateValueAt:v,updateValueAtTree:w,updateValueAtEdit:g,setRowSelect:_,setRowUnselect:C,setAllRowSelect:b,setAllRowUnSelect:y,setRowFocus:x,setRowUnFocus:S,resetNumCol:F}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(t){if(this.isGridShow()){if("undefined"==typeof t)var i=null,e=null,o="";else var i="undefined"==typeof t.begin?null:t.begin,e="undefined"==typeof t.length?null:t.length,o="undefined"==typeof t.field?"":t.field;var n=this,i=parseInt(i),e=parseInt(e),s=i;if(e>0&&(s=parseInt(i+e-1)),""==o)this.gridCompColumnFixedArr&&$.each(this.gridCompColumnFixedArr,function(t){n.renderTypeByColumn(this,t,i,e,!0)}),$.each(this.gridCompColumnArr,function(t){n.renderTypeByColumn(this,t,i,e,!1)});else{var r=!1;this.gridCompColumnFixedArr&&$.each(this.gridCompColumnFixedArr,function(t){if(this.options.field==o)return n.renderTypeByColumn(this,t,i,e,!0),void(r=!0)}),r||$.each(this.gridCompColumnArr,function(t){if(this.options.field==o)return void n.renderTypeByColumn(this,t,i,e,!1)})}}},o=function(t,i,e,o,n){var s=this,r=t.options.renderType,d=(t.options.sumCol,t.options.sumRenderType,t.options.dataType),a=t.options.precision,l=(t.options.format,t.options.field),h=e,c=n===!0?"_content_fixed_tbody":"_content_tbody",p=this.getVisibleIndexOfColumn(t);o>0&&(h=parseInt(e+o-1)),this.realtimeTableRows=document.getElementById(s.options.id+c).children;for(var f=-1,m=0;m=0&&o>=e&&o<=h||isNaN(e)){s.editColIndex==p&&s.eidtRowIndex==o&&"default"==s.options.editType&&(s.editColIndex=-1,s.eidtRowIndex=-1);var n=o;f!=-1&&o>=f&&n++;var c=s.realtimeTableRows[n],m=c.children[i];if(s.iconSpan)var v=s.iconSpan;if(m){if(m.children[0].innerHTML.indexOf("u-grid-content-tree-span")!=-1)var w=m.children[0].children[1];else var w=m.children[0];if(w){var g=$(this.value).attr(l);if("function"==typeof r||"Date"==d||"Datetime"==d||"Int"==d||"Float"==d)if(w.innerHTML="","function"==typeof r){g=s.getString(g,"");var _={};_.value=g,_.element=w,_.gridObj=s,_.row=this,_.gridCompColumn=t,_.rowIndex=o,r.call(s,_)}else if("Date"==d||"Datetime"==d)null!=g&&void 0!=g&&"null"!=g&&"undefined"!=g&&""!=g||(g=""),g="Date"==d?u.dateRender(g):u.dateTimeRender(g),w.innerHTML=g,w.title=g;else if("Int"==d)g=parseInt(g),g?(w.innerHTML=g,w.title=g):(w.innerHTML="",w.title="");else if("Float"==d){if(a){var C={};C.value=g,C.precision=a,g=s.DicimalFormater(C)}else g=parseFloat(g);g?(w.innerHTML=g,w.title=g):(w.innerHTML="",w.title="")}else{g=s.getString(g,"");var b=g.replace(/\/g,">"),w.title=g,g=g.replace(/\/g,">"),w.innerHTML=g}else{g=s.getString(g,"");var b=g.replace(/\/g,">"),w.title=g,g=g.replace(/\/g,">"),0==i&&v&&(g=v+=g),w.innerHTML=g}var _={span:w,column:t},y=t.options.maxLength,x=!1;x=y&&y>0?w.innerHTML.length>y:s.getRenderOverFlag(_),x&&$(w).addClass("u-grid-content-td-div-over")}}}}),this.renderTypeSumRow(t,i,e,o,n)},n=function(t){var i=t.span,e=i.offsetHeight,o=(i.offsetWidth,$(i).clone()[0]),n=!1;t.span.parentNode.appendChild(o);var s=i.style.display;i.style.display="none",o.style.height="",o.style.maxHeight="999999px";var r=o.offsetHeight;return r>e&&(n=!0),t.span.parentNode.removeChild(o),i.style.display=s,n},s=function(t,i,e,o,n){};i.renderTypeFunObj={renderTypeFun:e,renderTypeByColumn:o,renderTypeSumRow:s,getRenderOverFlag:n}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(t,i){var e=this.getIndexOfColumn(t);this.setColumnVisibleByIndex(e,i)},o=function(t,i){if(t>=0){var e=this.gridCompColumnArr[t],o=this.getVisibleIndexOfColumn(e);if(0==e.options.visible&&i){var n="this.minColumnWidth||i==this.minColumnWidth){var e=this.getVisibleIndexOfColumn(t),o=t.options.width,n=i-o,s=this.contentWidth+n;this.contentWidth=this.contentWidthChange(s),$("#"+this.options.id+"_header_table col:eq("+e+")").css("width",i+"px"),$("#"+this.options.id+"_content_table col:eq("+e+")").css("width",i+"px"),t.options.width=i,t.options.realWidth=i,this.resetThVariable(),this.saveGridCompColumnArrToLocal()}this.columnsVisibleFun()},r=function(t){this.$ele.data("gridComp")==this&&(this.initDataSourceVariable(),this.options.dataSource=t,this.initDataSource(),this.repairContent(),this.afterGridDivsCreate())},d=function(t){var i={};if(t.values){var e=new Array;$.each(t.values,function(){if(t.fields){var i={},o=this;$.each(t.fields,function(t){$(i).attr(this,o[t])}),e.push(i)}})}$(i).attr("values",e),this.setDataSource(i)};i.setFunObj={setColumnVisibleByColumn:e,setColumnVisibleByIndex:o,setCoulmnWidthByField:n,setColumnWidth:s,setDataSource:r,setDataSourceFun1:d}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(){var t=this;if($("#"+this.options.id)[0]){var i=$("#"+this.options.id)[0].offsetWidth;this.wholeWidth!=i&&this.$ele.data("gridComp")==this&&0!=i&&(this.wholeWidth=i,i>this.options.formMaxWidth&&("form"==this.showType||""==this.showType||!$("#"+this.options.id+"_content_div tbody")[0])||this.options.overWidthHiddenColumn||this.options.noScroll?t.widthChangeGridFun():i>0&&ithis.options.formMaxWidth&&(this.contentMinWidth=parseInt(this.wholeWidth)-parseInt(this.leftW)-parseInt(this.fixedWidth),this.contentMinWidth<0&&(this.contentMinWidth=0),setTimeout(function(){$("#"+t.options.id+"_header_wrap").css("max-width",t.wholeWidth+"px"),$("#"+t.options.id+"_content_div").css("width",t.contentMinWidth+"px"),$("#"+t.options.id+"_content_table").css("min-width",t.contentMinWidth+"px"),$("#"+t.options.id+"_content_table").css("width",t.contentMinWidth+"px"),$("#"+t.options.id+"_header_table").css("min-width",t.contentMinWidth+"px"),$("#"+t.options.id+"_header_table").css("width",t.contentMinWidth+"px"),$("#"+t.options.id+"_noRowsShow").css("width",t.contentMinWidth+"px"),t.columnsVisibleFun(),t.contentRealWidth0)var s=parseInt(o.replace("%","")*n/100);else var s=o;sn){var r=this.lastVisibleColumn,d=r.options.width,a=d-(t-n);this.setColumnWidth(r,a)}},s=function(t){},r=function(){},d=function(){if(this.countContentHeight){var t=this.wholeHeight,i=$("#"+this.options.id)[0].offsetHeight;if(this.wholeHeight=i,t!=i&&i>0){var e=i-1-this.exceptContentHeight>0?i-1-this.exceptContentHeight:0;$("#"+this.options.id+"_content").css("height",e+"px"),$("#"+this.options.id+"_content_div").css("height",e+"px")}}},a=function(t){if(tthis.contentMinWidth){var e=this.overWidthVisibleColumnArr.length;if(e>0){for(var o=0;othis.contentMinWidth?($("#"+this.options.id+"_content_left_bottom").css("display","block"),$("#"+this.options.id+"_content_left_sum_bottom").css("bottom",16)):($("#"+this.options.id+"_content_left_bottom").css("display","none"),$("#"+this.options.id+"_content_left_sum_bottom").css("bottom",0))}else $("#"+this.options.id+"_content_left_bottom").css("display","none"),$("#"+this.options.id+"_content_left_sum_bottom").css("bottom",0);return this.options.noScroll||($("#"+this.options.id+"_content_table").css("width",t+"px"),$("#"+this.options.id+"_noRows").css("width",t+"px")),t};i.wdChangeFunObj={widthChangeFun:e,widthChangeGridFun:o,widthChangeGridFunFixed:s,widthChangeGridFunOverWidthHidden:r,heightChangeFun:d,contentWidthChange:a,noScrollWidthReset:n}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(t,i,e,o,n){if(null!=this.currentEventName&&this.currentEventName==t)i.call(this,e),this.currentEventName=null,this.cleanCurrEventName&&clearTimeout(this.cleanCurrEventName);else{var s=this;this.cleanCurrEventName&&clearTimeout(this.cleanCurrEventName),this.currentEventName=t,this.cleanCurrEventName=setTimeout(function(){s.currentEventName=null,o.call(s,n)},250)}},o=function(t){if("function"==typeof this.options.onDblClickFun){var i=$(t.target).closest("tr");if(i[0].id==this.options.id+"_edit_tr")return;var e=0;i.length>0&&(e=this.getTrIndex(i));var o={};o.gridObj=this,o.rowObj=this.dataSourceObj.rows[e],o.rowIndex=e,this.options.onDblClickFun(o)}},n=function(t){var i=this,e=$(t.target).closest("tr");if(!(e.length>0&&e[0].id==this.options.id+"_edit_tr")){var o=this.getTrIndex(e);if("function"==typeof this.options.onBeforeClickFun){var n={};if(n.gridObj=this,n.rowObj=this.dataSourceObj.rows[o],n.rowIndex=o,n.e=t,!this.options.onBeforeClickFun(n))return}if(this.clickFunTree(t),e.length>0){var s=i.dataSourceObj.rows[o];if(s){if(i.options.rowClickBan)return;this.clickFunEdit(t,o);i.getChildRowIndex(s);!i.options.contentFocus&&i.options.multiSelect||(i.dataSourceObj.rows[o].focus&&i.options.cancelFocus?i.setRowUnFocus(o):i.dataSourceObj.rows[o].focus||i.setRowFocus(o)),!i.options.contentSelect&&i.options.multiSelect||(i.dataSourceObj.rows[o].checked&&i.options.cancelSelect?i.setRowUnselect(o):i.dataSourceObj.rows[o].checked||i.setRowSelect(o))}}}},s=function(t){},r=function(t){};i.clickFunObj={isDblEvent:e,dblClickFun:o,clickFun:n,clickFunTree:s,clickFunEdit:r}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(){return},o=function(){return},n=function(){var t=this,i=0;this.firstColumn=!0,this.overWidthVisibleColumnArr=new Array,$.each(this.gridCompColumnArr,function(){this.options.visible&&(i+=parseInt(this.options.width),this.options.width>this.options.realWidth&&t.overWidthVisibleColumnArr.push(this),this.firstColumn=t.firstColumn,t.firstColumn=!1,t.lastVisibleColumn=this,t.lastVisibleColumnWidth=this.options.width)}),this.contentRealWidth=i},s=function(){if("grid"==this.showType){var t=this;this.contentWidth=0,$("#"+this.options.id+"_header_table th",this.$ele).each(function(i){var e=t.gridCompColumnArr[i],o=0;e.options.visible&&(o=parseInt(e.options.width)),this.attrLeftTotalWidth=t.contentWidth,t.contentWidth+=o,t.resetThVariableDrag(this,e,o),this.gridCompColumn=e,this.attrWidth=o,this.attrRightTotalWidth=t.contentWidth}),t.resetThVariableHeaderLevel()}},r=function(t,i){},d=function(){},a=function(){$("#"+this.options.id+"_grid .u-grid-header-th-first").removeClass("u-grid-header-th-first"),$("#"+this.options.id+"_grid").find("th").eq(0).addClass("u-grid-header-th-first")},l=function(t,i){var e=this.getColumnByField(t);e.options.renderType=i;var o=this.getIndexOfColumn(e);this.renderTypeByColumn(e,o)},h=function(t){this.options.showHeader=t,t?$("#"+this.options.id+"_header").css("display","block"):$("#"+this.options.id+"_header").css("display","none")},u=function(t,i){var e=this.getColumnByField(t);e.options.precision=i,this.renderTypeFun(),this.options.showSumRow&&this.repairSumRow()},c=function(t){var i=this.options.multiSelect;i!=t&&(this.options.multiSelect=t,this.initGrid())},p=function(t){var i=this.options.showNumCol;i!=t&&(this.options.showNumCol=t,this.initGrid())},f=function(){return"grid"==this.showType},m=function(t){return"true"===t||t===!0};i.otherFunObj={updateLastRowFlag:e,updateNumColLastRowFlag:o,columnsVisibleFun:n,resetThVariable:s,resetThVariableDrag:r,resetThVariableHeaderLevel:d,headerFirstClassFun:a,setRenderType:l,setShowHeader:h,setColumnPrecision:u,setMultiSelect:c,setShowNumCol:p,isGridShow:f,getBoolean:m}},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.utilFunOjb=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=e(5),s=function(t){return t?(t+"").indexOf("%")>0?t:parseInt(t)+"px":""},r=function(t,i){var e=t.next(),o=i.prev();i.insertBefore(e),t.insertAfter(o)},d=function(t,i){return null!==t&&void 0!==t&&"null"!==t&&"undefined"!==t&&""!==t||(t=i),n.gridBrowser.isIE8?[t].join(""):t+""},a=function(t,i){return(null===t||void 0===t||"null"===t||"undefined"===t||""===t||isNaN(t))&&(t=i),t},l=function(t,i){return(null===t||void 0===t||"null"===t||"undefined"===t||""===t||isNaN(t))&&(t=i),t},h=function(t){var i;if("object"==("undefined"==typeof t?"undefined":o(t)))if(null===t)i=null;else if(t instanceof Array){i=[];for(var e=0,n=t.length;e256&&i==t-1)break;i+=o>256?2:1,e+=1}return this.substr(0,e)};i.utilFunOjb={formatWidth:s,swapEle:r,getString:d,getInt:a,getFloat:l,cloneObj:h,DicimalFormater:u,accAdd:p,getTrIndex:f,getDataTableRowIdByRow:m}},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.colMenu_initGridEventFun=i.colMenu_initEventFun=i.re_createColumnMenu=i.colMenu_initGridCompColumn=i.re_initGridCompColumnColumnMenuFun=void 0;var o=(e(4),e(13),function(t){var i=new this.gridCompColumn(t,this);i.options.realWidth=i.options.width,this.basicGridCompColumnArr.push(i)}),n=function(){this.menuColumnsHeight=this.gridCompColumnArr.length*this.columnMenuHeight},s=function(){var t=this,i='
';return i+='
"},r=function(){var t=this;$("#"+this.options.id).on("mouseup",function(i){if($(i.target).closest("#"+t.options.id+"_header").length>0){if(t.mouseUpX=i.clientX,t.mouseUpY=i.clientY,t.mouseDownX==t.mouseUpX&&t.mouseDownY==t.mouseUpY){t.columnClickX=i.clientX,t.columnClickY=i.clientY;$(i.target).closest("th")[0];if($(i.target).hasClass("u-grid-header-columnmenu")){$("#"+t.options.id+"_column_menu").css("display","block");var e=i.clientX-160;e<0&&(e=0);var o=i.clientY+10;$("#"+t.options.id+"_column_menu").css("left",e),$("#"+t.options.id+"_column_menu").css("top",o);var n=($(window).width(),$(window).height()),s=t.menuColumnsHeight;t.menuColumnsHeight+o+34>n?(s=n-o-34,$("#"+t.options.id+"_column_menu_columns").css("height",s+"px")):$("#"+t.options.id+"_column_menu_columns").css("height",""),t.ele.createColumnMenuFlag=!0}}}else $(i.target).closest("#"+t.options.id+"_content").length>0}),$(document).on("click",function(){0==t.columnMenuMove&&0==t.ele.createColumnMenuFlag&&t.ele.offsetWidth>0&&$("#"+t.options.id+"_column_menu").css("display","none"),t.ele.createColumnMenuFlag=!1}),$(document).on("scroll",function(){0==t.columnMenuMove&&0==t.ele.createColumnMenuFlag&&t.ele.offsetWidth>0&&$("#"+t.options.id+"_column_menu").css("display","none"),t.ele.createColumnMenuFlag=!1})},d=function(){var t=this;$("#"+this.options.id+"_column_menu_ul").off("mousemove"),$("#"+this.options.id+"_column_menu_ul").on("mousemove",function(i){t.columnMenuMove=!0}),$("#"+this.options.id+"_column_menu_ul").off("mouseout"),$("#"+this.options.id+"_column_menu_ul").on("mouseout",function(i){t.columnMenuMove=!1}),$("#"+this.options.id+"_clearSet").off("click"),$("#"+this.options.id+"_clearSet").on("click",function(i){t.clearLocalData(),t.initGridCompColumn(),t.hasNoScrollRest=!1,t.noScrollWidthReset(),t.dataSourceObj.sortRows(),t.repaintGridDivs(),"function"==typeof t.options.onClearSetFun&&t.options.onClearSetFun(t)}),$("#"+this.options.id+"_column_menu_columns_ul li input").off("click"),$("#"+this.options.id+"_column_menu_columns_ul li input").on("click",function(i){var e=$(this).closest("li").attr("index");if(t.gridCompColumnArr[e].options.visible){$(this)[0].checked=!1;var o=$("input:checked",$("#"+t.options.id+"_column_menu_columns_ul")).length;if(0==o)return void($(this)[0].checked=!0);if(8==document.documentMode){var n=$("#"+t.options.id+"_column_menu_columns")[0].scrollTop,s=$("#"+t.options.id+"_column_menu")[0].style.top,r=$("#"+t.options.id+"_column_menu")[0].style.left;t.gridCompColumnArr[e].options.visible=!1,t.repaintGridDivs(),$("#"+t.options.id+"_column_menu").css("display","block"),$("#"+t.options.id+"_column_menu").css("left",r),$("#"+t.options.id+"_column_menu").css("top",s),$("#"+t.options.id+"_column_menu_columns")[0].scrollTop=n}else t.setColumnVisibleByIndex(e,!1),t.gridCompColumnArr[e].options.visible=!1}else if($(this)[0].checked=!0,8==document.documentMode){var n=$("#"+t.options.id+"_column_menu")[0].scrollTop,s=$("#"+t.options.id+"_column_menu")[0].style.top,r=$("#"+t.options.id+"_column_menu")[0].style.left;t.gridCompColumnArr[e].options.visible=!0,t.repaintGridDivs(),$("#"+t.options.id+"_column_menu").css("display","block"),$("#"+t.options.id+"_column_menu").css("left",r),$("#"+t.options.id+"_column_menu").css("top",s),$("#"+t.options.id+"_column_menu_columns")[0].scrollTop=n}else t.setColumnVisibleByIndex(e,!0),t.gridCompColumnArr[e].options.visible=!0;t.saveGridCompColumnArrToLocal(),i.stopPropagation()}),$("#"+this.options.id+"_column_menu_columns_ul li").off("click"),$("#"+this.options.id+"_column_menu_columns_ul li").on("click",function(t){var i=$(this).find("input");i.click()})};i.re_initGridCompColumnColumnMenuFun=o,i.colMenu_initGridCompColumn=n,i.re_createColumnMenu=s,i.colMenu_initEventFun=r,i.colMenu_initGridEventFun=d},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.dragFunObj=void 0;var o=(e(4),function(){return'
'}),n=function(){var t=this;$("#"+this.options.id).on("mousemove",function(i){if($(i.target).closest("#"+t.options.id+"_header").length>0){var e=$(i.target).closest("th")[0];t.headerThDrag(i,e)}t.dragFun(i),i.stopPropagation()}),$("#"+this.options.id+"_top").on("mousemove",function(i){t.dragFun(i),i.stopPropagation()}),$("#"+this.options.id).on("mouseup",function(i){t.dragEnd(i)}),$("#"+this.options.id+"_top").on("mouseup",function(i){t.dragEnd(i)})},s=function(){var t=this;$("#"+this.options.id+"_resize_handle").on("mousedown",function(i){return t.dragStart(i),!1})},r=function(t){this.dragFlag=!0,this.dragW=null,this.dragStartX=t.clientX},d=function(t){if(this.dragFlag){var i=$("#"+this.options.id+"_resize_handle")[0].nowTh,e=$(i),o=e.attr("index"),n=this.gridCompColumnArr[o],s=this.getVisibleIndexOfColumn(n);if(i&&n!=this.lastVisibleColumn){this.dragEndX=t.clientX;var r=parseInt(this.dragEndX)-parseInt(this.dragStartX),d=parseInt(i.attrWidth)+parseInt(r),a=parseInt(this.contentWidth)+parseInt(r);if(d>this.minColumnWidth){if(this.options.noScroll){var l=this.getNextVisibleInidexOfColumn(n);if(l>-1){var h=this.getColumnByVisibleIndex(l);(!this.dragNextClomunWidth||this.dragNextClomunWidth<0)&&(this.dragNextClomunWidth=h.options.width)}var u=parseInt(this.dragNextClomunWidth)-parseInt(r);if(!(u>this.minColumnWidth))return void $("#"+this.options.id+"_top").css("display","block")}this.options.noScroll||(this.dragW=this.contentWidthChange(a)),$("#"+this.options.id+"_header_table col:eq("+s+")").css("width",d+"px"),$("#"+this.options.id+"_content_table col:eq("+s+")").css("width",d+"px"),n.options.width=d,n.options.realWidth=d,this.options.noScroll&&($("#"+this.options.id+"_header_table col:eq("+l+")").css("width",u+"px"),$("#"+this.options.id+"_content_table col:eq("+l+")").css("width",u+"px"),h.options.width=u,h.options.realWidth=u)}}$("#"+this.options.id+"_top").css("display","block")}},a=function(t){this.dragFlag&&(this.resetThVariable(),this.saveGridCompColumnArrToLocal()),this.dragNextClomunWidth=-1,this.lastVisibleColumn.options.width=this.lastVisibleColumnWidth,this.dragW&&(this.contentWidth=this.dragW),$("#"+this.options.id+"_resize_handle")[0].nowTh=null,this.dragFlag=!1,$("#"+this.options.id+"_top").css("display","none")},l=function(t,i){if(!this.dragFlag&&!this.swapColumnFlag&&i&&i.gridCompColumn&&i.gridCompColumn.options.canDrag&&$("#"+this.options.id+"_resize_handle")[0].nowTh!=i){$(i);$("#"+this.options.id+"_resize_handle").css("left",i.attrRightTotalWidth-this.scrollLeft-4+this.leftW+this.fixedWidth),$("#"+this.options.id+"_resize_handle")[0].nowTh=i}},h=function(t,i,e){!$("#"+this.options.id+"_resize_handle")[0].nowTh&&i.options.canDrag&&($("#"+this.options.id+"_resize_handle").css("left",e-4+this.leftW),$("#"+this.options.id+"_resize_handle")[0].nowTh=t)};i.dragFunObj={createHeaderDrag:o,dragStart:r,dragFun:d,dragEnd:a,headerThDrag:l,resetThVariableDrag:h,drag_initEventFun:n,drag_initGridEventFun:s}},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.editFromFunObj=void 0;var o=(e(13),function(){this.defaults=$.extend(!0,{},this.defaults,{noneEditableFormShow:!0})}),n=function(t,i){var e=this;$.each(this.gridCompColumnArr,function(o){this.options.field==t&&(this.options.required=i,i?$("#"+e.options.id+"_edit_"+this.options.field).parent().find(".u-grid-edit-mustFlag").show():$("#"+e.options.id+"_edit_"+this.options.field).parent().find(".u-grid-edit-mustFlag").hide())})},s=function(){if($("#"+this.options.id+"_edit_form").length>0){var t=$("#"+this.options.id+"_edit_form")[0].offsetHeight;$("#"+this.options.id+"_numCol_edit").css("height",t),$("#"+this.options.id+"_multiSelect_edit").css("height",t)}},r=function(t,i,e,o,n){var s=e+"";s.lengthb()>28&&(s=s.substrCH(26)+"...");var r='
'+s+'*
';return r+='
',r+="
"};i.editFromFunObj={editForm_initDefault:o,editForm_setRequired:n,editorRowChangeFun:s,formEditCell:r}},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.fixFunObj=void 0;var o=(e(20),function(){var t=this;$.each(this.gridCompColumnArr,function(i){1==this.options.fixed&&t.gridCompColumnFixedArr.push(this)}),$.each(this.gridCompColumnFixedArr,function(i){for(var i=t.gridCompColumnArr.length;i>-1;i--)if(t.gridCompColumnArr[i]==this){t.gridCompColumnArr.splice(i,1);break}})}),n=function(){var t=this,i=0;$.each(this.gridCompColumnFixedArr,function(){this.options.visible&&(i+=parseInt(this.options.width),this.firstColumn=t.firstColumn,t.firstColumn=!1)}),this.fixedRealWidth=i},s=function(){return this.createHeaderTable("fixed")},r=function(){return this.createContentTable("fixed")},d=function(t){return this.createContentOneRow(t,"fixed")},a=function(t){this.fixedRealWidth>t?this.fixedWidth=t:this.fixedWidth=this.fixedRealWidth};i.fixFunObj={initGridCompFixedColumn:o,fixed_columnsVisibleFun:n,createHeaderTableFixed:s,createContentTableFixed:r,createContentOneRowFixed:d,widthChangeGridFunFixed:a}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(){if(!this.createFormFlag){var t='
';t+=this.createFromContent(),$("#"+this.options.id)[0].insertAdjacentHTML("afterBegin",t),this.createFormFlag=!0}},o=function(){var t='
';return t+='',t+=this.createFormContentRows(),t+="
"},n=function(){var t=this,i="";return this.dataSourceObj.rows&&(i+='',$.each(this.dataSourceObj.rows,function(){i+='';var e=this.value;$.each(t.gridCompColumnArr,function(){var t=this.options.field,o=this.options.title,n=$(e).attr(t);i+="
"+o+":
",i+="
"+n+"
"}),i+=""}),i+=""),i},s=function(){this.createFromDivs(),$("#"+this.options.id+"_grid").css("display","none"),$("#"+this.options.id+"_form").css("display","block"),this.showType="form","function"==typeof this.options.afterCreate&&this.options.afterCreate.call(this)};i.formShowFunOjb={createFromDivs:e,createFromContent:o,createFormContentRows:n,widthChangeFormFun:s}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(){var t=this,i=this.options.maxHeaderLevel,e=[];$("#"+this.options.id+"_header_table th",this.$ele).each(function(i){var o=t.gridCompColumnArr[i],n=o.options.field,s=0;o.options.visible&&(s=parseInt(o.options.width));var r={field:n,width:s};e.push(r)});for(var o=this.getColumnByVisibleIndex(0).options.field,n=0;n
";h[0].insertAdjacentHTML("afterBegin",C)}},o=function(t){if(t.headerLevel>1){this.gridCompLevelColumn.push(t);var i=this.gridCompColumnArr.length;this.gridCompColumnArr.length=i-1,this.basicGridCompColumnArr&&this.basicGridCompColumnArr.length>0&&(this.basicGridCompColumnArr.length=i-1)}},n=function(t){for(var i=0;io?-1:1})}},o=function(){if(this.options.overWidthHiddenColumn){this.lastVisibleColumn.options.width=this.lastVisibleColumn.options.realWidth;var t=parseInt(this.wholeWidth)-parseInt(this.leftW),i=parseInt(this.fixedWidth)+parseInt(this.contentRealWidth);if(i>t){for(var e=0;et))break}this.columnsVisibleFun()}else{for(var e=this.gridCompHiddenLevelColumnArr.length-1;e>-1;e--){var o=this.gridCompHiddenLevelColumnArr[e];if(!o.options.visible){if(i=parseInt(i)+parseInt(o.options.width),i>t)break;o.options.visible=!0}}this.columnsVisibleFun()}}};i.overWidthHiddenFunObj={initGridHiddenLevelColumn:e,widthChangeGridFunOverWidthHidden:o}},function(t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var e=function(t){var i="";return this.options.showSumRow&&this.dataSourceObj.rows&&this.dataSourceObj.rows.length>0&&(i+=this.createSumRow(t)),i},o=function(t){var i="";return i},n=function(t){if(this.options.showSumRow){var i,e,o=this;"fixed"==t?(i="fixed_",e=this.gridCompColumnFixedArr):(i="",e=this.gridCompColumnArr);var n=parseInt(this.wholeHeight)-this.exceptContentHeight-48-this.scrollBarHeight;n=n>0?n:0;var s='';return $.each(e,function(){var t=this.options.field,i=this.options.precision,e=this.options.dataType,n=o.dataSourceObj.getSumValue(t,this,o);if("float"==e){var r={};r.value=n,r.precision=i?i:2,n=o.DicimalFormater(r)}var d="";this.options.visible||(d='style="display:none;"'),s+='",this.firstColumn&&(s+='
'+o.transMap.ml_sum+"
");var a="";"integer"!=this.options.dataType&&"float"!=this.options.dataType||(a='style="text-align: right;"'),s+='
'+n+"
"}),s+=""}},s=function(t,i){if(this.options.showSumRow){var e,o,n=this;"fixed"==i?(e="fixed_",o=this.gridCompColumnFixedArr):(e="",o=this.gridCompColumnArr);var s=parseInt(this.wholeHeight)-this.exceptContentHeight-48-this.scrollBarHeight;s=s>0?s:0;var r=t.insertRow();r.row="row",r.className="u-grid-content-sum-row",r.id=this.options.id+"_content_"+e+"sum_row",r.style.top=s+"px",$.each(o,function(){var t=this.options.field,i=this.options.precision,e=this.options.dataType,o=n.dataSourceObj.getSumValue(t,this,n);if("float"==e){var s={};s.value=o,s.precision=i?i:2,o=n.DicimalFormater(s)}var d=r.insertCell();d.role="rowcell",d.title=o;var a="";"integer"!=this.options.dataType&&"float"!=this.options.dataType||(a='style="text-align: right;"');var l='
";this.firstColumn&&(l+='
'+n.transMap.ml_sum+"
"),l+=''+o+"
",d.insertAdjacentHTML("afterBegin",l)})}},r=function(){var t=this;this.re_repairSumRowSetTimeout&&clearTimeout(this.re_repairSumRowSetTimeout),this.re_repairSumRowSetTimeout=setTimeout(function(){d.call(t)},100)},d=function(){if(this.options.showSumRow){$("#"+this.options.id+"_content_div tbody .u-grid-content-sum-row").remove(),$("#"+this.options.id+"_content_fixed_div tbody .u-grid-content-sum-row").remove();try{if(this.dataSourceObj.rows&&this.dataSourceObj.rows.length>0){var t=this.createSumRow();$("#"+this.options.id+"_content_div tbody")[0].insertAdjacentHTML("beforeEnd",t);var t=this.createSumRow("fixed");$("#"+this.options.id+"_content_fixed_div tbody")[0]&&$("#"+this.options.id+"_content_fixed_div tbody")[0].insertAdjacentHTML("beforeEnd",t)}}catch(t){var i=$("#"+this.options.id+"_content_div table")[0];$("#"+this.options.id+"_content_fixed_div table")[0];this.createSumRowForIE(i),this.createSumRowForIE(i,"fixed")}this.renderSumRow()}},a=function(){var t=this;$.each(this.gridCompColumnFixedArr,function(i){var e=this.options.sumCol,o=this.options.sumRenderType,n="fixed_";if(e){var s=$("#"+t.options.id+"_content_"+n+"sum_row").find("td").eq(i).find("span"),r=s[s.length-1];if(r)if("function"==typeof o){var d=$(r).attr("value"),a={};a.value=d,a.element=r,a.gridObj=t,a.gridCompColumn=this,o.call(t,a)}else"integer"!=dataType&&"float"!=dataType||(r.style.textAlign="right")}}),$.each(this.gridCompColumnArr,function(i){var e=this.options.sumCol,o=this.options.dataType,n=this.options.sumRenderType,s="";if(e){var r=$("#"+t.options.id+"_content_"+s+"sum_row").find("td").eq(i).find("span"),d=r[r.length-1];if(d)if("function"==typeof n){var a=$(d).attr("value"),l={};l.value=a,l.element=d,l.gridObj=t,l.gridCompColumn=this,n.call(t,l)}else"integer"!=o&&"float"!=o||(d.style.textAlign="right")}})},l=function(t,i,e,o,n){var s=this,r=t.options.sumCol,d=t.options.sumRenderType,a=t.options.dataType,l=n===!0?"fixed_":"";if(r){var h=$("#"+this.options.id+"_content_"+l+"sum_row").find("td").eq(i).find("span"),u=h[h.length-1];if(u)if("function"==typeof d){var c=$(u).attr("value"),p={};p.value=c,p.element=u,p.gridObj=s,p.gridCompColumn=t,d.call(s,p)}else"integer"!=a&&"float"!=a||(u.style.textAlign="right")}};window.maxSumRender=function(t){var i,e=t.gridObj,o=t.gridCompColumn,n=o.options.field,s=t.element;if($.each(e.dataSourceObj.rows,function(t){var s=$(this.value).attr(n);s="Int"==o.options.dataType?e.getInt(s,0):e.getFloat(s,0),"undefined"==typeof i?i=s:s>i&&(i=s)}),"Float"==o.options.dataType&&o.options.precision){var r={};r.value=i,r.precision=o.options.precision,i=e.DicimalFormater(r)}s.innerHTML=i+""},window.minSumRender=function(t){var i,e=t.gridObj,o=t.gridCompColumn,n=o.options.field,s=t.element;if($.each(e.dataSourceObj.rows,function(t){var s=$(this.value).attr(n);s="Int"==o.options.dataType?e.getInt(s,0):e.getFloat(s,0),"undefined"==typeof i?i=s:s0){var e=$(i.target).closest("th")[0];t.options.canSwap&&t.swapColumnStart(i,e),i.preventDefault()}else $(i.target).closest("#"+t.options.id+"_content").length>0}),$("#"+this.options.id).on("mousemove",function(i){t.mouseMoveX=i.clientX,t.mouseMoveY=i.clientY,t.mouseMoveX==t.mouseDownX&&t.mouseDownY==t.mouseMoveY||"mouseDownX"==t.mouseDownX||!t.options.canSwap||(t.swapColumnFlag=!0),t.swapColumnFun(i),i.stopPropagation()}),$("#"+this.options.id+"_top").on("mousemove",function(i){t.mouseMoveX=i.clientX,t.mouseMoveY=i.clientY,t.mouseMoveX==t.mouseDownX&&t.mouseDownY==t.mouseMoveY||"mouseDownX"==t.mouseDownX||!t.options.canSwap||(t.swapColumnFlag=!0),t.swapColumnFun(i),i.stopPropagation()}),$("#"+this.options.id).on("mouseup",function(i){t.mouseUpX=i.clientX,t.mouseUpY=i.clientY,t.swapColumnEnd(i),t.mouseUpX="mouseUpX",t.mouseUpY="mouseUpY",t.mouseDownX="mouseDownX",t.mouseDownY="mouseDownY",t.mouseMoveX="mouseMoveX",t.mouseMoveY="mouseMoveY"}),$("#"+this.options.id+"_top").on("mouseup",function(i){t.mouseUpX=i.clientX,t.mouseUpY=i.clientY,t.swapColumnEnd(i),t.mouseUpX="mouseUpX",t.mouseUpY="mouseUpY",t.mouseDownX="mouseDownX",t.mouseDownY="mouseDownY",t.mouseMoveX="mouseMoveX",t.mouseMoveY="mouseMoveY"})}),n=function(){},s=function(t,i){this.options.canSwap&&(this.swapColumnEle=i,this.swapColumnStartX=t.clientX,this.swapColumnStartY=t.clientY)},r=function(t){if(this.options.canSwap){var i=this;if(this.swapColumnFlag){var e=this.swapColumnEle;if(!e)return;var o=$(e);if(!e.gridCompColumn)return;var n=e.gridCompColumn;if(0==$("#"+this.options.id+"_clue").length){var s=$('
').css({width:e.scrollWidth+"px",left:e.attrLeftTotalWidth-i.scrollLeft+i.leftW+i.fixedWidth+"px",top:"0px",paddingLeft:o.css("paddingLeft"),paddingRight:o.css("paddingRight"),lineHeight:o.height()+"px",paddingTop:o.css("paddingTop"),paddingBottom:o.css("paddingBottom")}).html(n.options.title||n.options.field).prepend('');try{$("#"+this.options.id)[0].insertAdjacentElement("afterBegin",s[0])}catch(t){$("#"+this.options.id)[0].insertBefore(s[0],$("#"+this.options.id)[0].firstChild)}s.on("mousemove",function(){t.stopPropagation()})}this.swapColumnEndX=t.clientX,this.swapColumnEndY=t.clientY;var r=this.swapColumnEndX-this.swapColumnStartX,d=this.swapColumnEndY-this.swapColumnStartY;if($("#"+this.options.id+"_clue").css({left:e.attrLeftTotalWidth+r-i.scrollLeft+i.leftW+i.fixedWidth+"px",top:d+"px"}),0==$("#"+this.options.id+"_swap_top").length){var s=$('');s.css({top:o.height()-6+"px"});var a=$('');a.css({top:"6px"});try{$("#"+this.options.id)[0].insertAdjacentElement("afterBegin",s[0]),$("#"+this.options.id)[0].insertAdjacentElement("afterBegin",a[0])}catch(t){$("#"+this.options.id)[0].insertBefore(s[0],$("#"+this.options.id)[0].firstChild),$("#"+this.options.id)[0].insertBefore(a[0],$("#"+this.options.id)[0].firstChild)}}this.canSwap=!1,$("#"+this.options.id+"_header_table th").each(function(e){var o=$(this).offset().left,n=o+parseInt(this.attrWidth);if(0==e&&t.clientX0&&!o){var n=$(i.target).closest("tr")[0];t.options.canRowDrag&&t.rowDragStart(i,n),i.preventDefault()}}),$("#"+this.options.id+"_content_tbody").on("mousemove",function(i){t.mouseMoveX=i.clientX,t.mouseMoveY=i.clientY,t.rowDragEle&&(t.mouseMoveX!=t.rowDragStartX||t.mouseMoveY!=t.rowDragStartY)&&t.options.canRowDrag&&(t.rowDragFlag=!0,t.rowDragFun(i)),i.stopPropagation()}),$("#"+this.options.id+"_content_tbody").on("mouseup",function(i){t.mouseUpX=i.clientX,t.mouseUpY=i.clientY,t.rowDragEnd(i)})}),n=function(t,i){var e=this;this.options.canRowDrag&&(this.rowDragStartX=t.clientX,this.rowDragStartY=t.clientY,this.rowDragEle=i,$("#"+this.options.id+"_content_tbody").find("tr").each(function(t){if($(this).is(e.rowDragEle))return e.rowDragStartIndex=t,!1}))},s=function(t){var i=this;if(i.options.canRowDrag&&this.rowDragFlag){this.rowDragEndX=t.clientX,this.rowDragEndY=t.clientY;var e=(this.rowDragEndX-this.rowDragStartX,this.rowDragEndY-this.rowDragStartY),o=this.rowDragEle.clientHeight,n=parseInt(e/o);n<0?this.dragdirection=-1:this.dragdirection=1,this.rowDragEndIndex=this.rowDragStartIndex+n,this.rowDragEndIndex<0&&(this.rowDragEndIndex=0),this.rowDragEndIndex!=this.rowDragStartIndex&&($("#"+this.options.id+"_content_tbody").find("tr td").removeClass("u-grid-drag-icon"),$("#"+this.options.id+"_content_tbody").find("tr").eq(this.rowDragEndIndex).find("td").first().addClass("u-grid-drag-icon"))}},r=function(t){var i;this.options.canRowDrag&&(this.rowDragFlag&&this.rowDragEndIndex!=this.rowDragStartIndex&&(i=this.dataSourceObj.rows[this.rowDragStartIndex],$("#"+this.options.id+"_content_tbody").find("tr td").removeClass("u-grid-drag-icon"),this.dragdirection<0?($("#"+this.options.id+"_content_tbody").find("tr").eq(this.rowDragEndIndex).before(this.rowDragEle),this.dataSourceObj.rows.splice(this.rowDragStartIndex,1),this.dataSourceObj.rows.splice(this.rowDragEndIndex,0,i)):(this.dataSourceObj.rows.splice(this.rowDragStartIndex,1),this.rowDragEndIndex>=this.dataSourceObj.rows.length?($("#"+this.options.id+"_content_tbody").append(this.rowDragEle),this.dataSourceObj.rows.splice(this.rowDragEndIndex+1,0,i)):($("#"+this.options.id+"_content_tbody").find("tr").eq(this.rowDragEndIndex+1).before(this.rowDragEle),this.dataSourceObj.rows.splice(this.rowDragEndIndex,0,i)))),this.rowDragFlag=!1,this.rowDragEle=void 0); -},d=function(t){this.options.canRowDrag=t};i.rowDragFunObj={rowDrag_initGridEventFun:o,rowDragStart:n,rowDragFun:s,rowDragEnd:r,setRowDrag:d}}]); \ No newline at end of file diff --git a/package.json b/package.json index 4d875e4..769e300 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "babel-plugin-transform-es2015-modules-commonjs": "^6.11.5", "babel-plugin-transform-es3-member-expression-literals": "^6.8.0", "babel-plugin-transform-es3-property-literals": "^6.8.0", - "babel-plugin-transform-es2015-modules-umd": "^6.23.0" + "babel-plugin-transform-es2015-modules-umd": "^6.23.0", "babel-preset-es2015": "^6.9.0", "babel-preset-es2015-loose": "^8.0.0", "babel-preset-stage-0": "^6.5.0",