corrade-nucleus-nucleons

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 19  →  ?path2? @ 20
/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/docs/dist/extensions/click-edit-row/bootstrap-table-click-edit-row.css
@@ -0,0 +1,21 @@
#tooling{
float: right;
}
.clear{
display: block;
width: 13px;
height: 13px;
position: absolute;
opacity: 0.6;
z-index: 100;
top: 50%;
right: 26px;
margin-top: -10px;
cursor: pointer;
}
.clear > i{
font-size: 1.5em;
}
.clear > i:hover{
color: hsl(0, 0%, 75%);
}
/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/docs/dist/extensions/click-edit-row/bootstrap-table-click-edit-row.js
@@ -0,0 +1,142 @@
/**
* @author horken wong <horken.wong@gmail.com>
* @version: v1.0.0
* https://github.com/horkenw/bootstrap-table
* Click to edit row for bootstrap-table
*/
 
(function ($) {
'use strict';
 
$.extend($.fn.bootstrapTable.defaults, {
clickEdit: false
});
 
function setDivision(node, options){
var $option = $('<option />');
if(options){
$(options).each(function(i, v){
$option.clone().text(v.idxNum + ' ' +v.name).val(v.idxNum).appendTo(node);
})
}
else{
console.log('Please setup options first!!')
}
}
 
function clikcToEdit(evt, tarNode){
var txt = [], table = evt,
submit = '<button type="button" class="btn btn-primary btn-sm editable-submit"><i class="glyphicon glyphicon-ok"></i></button>',
cancel = '<button type="button" class="btn btn-default btn-sm editable-cancel"><i class="glyphicon glyphicon-remove"></i></button>';
 
var replaceData = function(){
txt = [];
tarNode.find('td').find('input[type="text"]').each(function(i, td){
txt.push($(td).eq(0).val());
});
tarNode.find('select').each(function(i, td){
txt.push($('#'+td.id+' option:selected').val());
});
$('#table').bootstrapTable('updateRow', {
index: table.$data.thId,
row: {
noOld: txt[0],
area: tarNode.find('select').eq(0).children(':selected').text(),
town: tarNode.find('select').eq(1).children(':selected').text(),
address: txt[1]
}
});
$('#tooling').remove();
table.editing = true;
// updateToServerSide(table.$data.itemid, txt);
return false;
};
 
var recoveryData = function(){
$('#table').bootstrapTable('updateRow', {
index: table.$data.thId,
row: {},
});
$('#tooling').remove();
table.editing = true;
return false;
};
 
if(table.editing){
var rootid = 0;
table.editing = false;
table.columns.forEach(function(column, i){
if (!column.editable) return;
 
switch(column.editable){
case 'input':
var div=$('<div class="editable-input col-md-12 col-sm-12 col-xs-12" style="position: relative;"/>');
txt.push(tarNode.find('td').eq(column.fieldIndex).text());
div.append($('<input type="text" class="form-control input-sm"/>'));
div.append($('<span class="clear"><i class="fa fa-times-circle-o" aria-hidden="true"></i></span>'));
tarNode.find('td').eq(column.fieldIndex).text('').append(div);
break;
case 'select':
var select=$('<select id="'+column.field+'">'), options = $.selectArray[column.field];
tarNode.find('td').eq(column.fieldIndex).text('').append(select);
setDivision($('#'+column.field), options);
break;
case 'textarea':
break;
default:
console.log(column.fieldIndex+' '+column.editable);
}
 
}, evt);
for(var i=0, l=txt.length; i<l; i++){
tarNode.find('input[type="text"]').eq(i).val(txt[i]);
}
tarNode.find('td').last().append('<div id="tooling" class="editable-buttons"/>');
$('.clear').on('click', function(){ $(this).parent().find('input').val('');});
$(submit).on('click', replaceData).appendTo('#tooling');
$(cancel).on('click', recoveryData).appendTo('#tooling');
}
}
 
function updateToServerSide(item, data){
var itemid = $(item).find('a').attr('href').match(/\d+/g)[0];
var datas = {'treeId': itemid, 'oldTreeSerialNo': data[0], 'adminDivision': data[2], 'adminUnit': data[3], 'treeAddr': data[1]}; //傳送至伺服器端的Data產生處,需手動修改對應表格
store( 'data/update', datas)
}
 
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initTable = BootstrapTable.prototype.initTable,
_initBody = BootstrapTable.prototype.initBody;
 
BootstrapTable.prototype.initTable = function(){
var that = this;
this.$data = {};
_initTable.apply(this, Array.prototype.slice.apply(arguments));
 
if (!this.options.clickEdit) {
return;
}
 
};
 
BootstrapTable.prototype.initBody = function () {
var that = this;
_initBody.apply(this, Array.prototype.slice.apply(arguments));
 
if (!this.options.clickEdit) {
return;
}
 
var table = this.$tableBody.find('table');
that.editing=true;
 
table.on('click-row.bs.table', function (e, row, $element, field) {
if(field ==='no') return; //|| field ==='noOld'
this.$data.thId = $element.data().index;
this.$data.itemid = $element.data().uniqueid;
this.$data.divi = parseInt(row.area);
this.$data.town=parseInt(row.town);
clikcToEdit(this, $element);
}.bind(this));
};
})(jQuery);
/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/docs/dist/extensions/click-edit-row/bootstrap-table-click-edit-row.min.js
@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.11.1 - 2017-02-22
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2017 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";function b(b,c){var d=a("<option />");c?a(c).each(function(a,c){d.clone().text(c.idxNum+" "+c.name).val(c.idxNum).appendTo(b)}):console.log("Please setup options first!!")}function c(c,d){var e=[],f=c,g='<button type="button" class="btn btn-primary btn-sm editable-submit"><i class="glyphicon glyphicon-ok"></i></button>',h='<button type="button" class="btn btn-default btn-sm editable-cancel"><i class="glyphicon glyphicon-remove"></i></button>',i=function(){return e=[],d.find("td").find('input[type="text"]').each(function(b,c){e.push(a(c).eq(0).val())}),d.find("select").each(function(b,c){e.push(a("#"+c.id+" option:selected").val())}),a("#table").bootstrapTable("updateRow",{index:f.$data.thId,row:{noOld:e[0],area:d.find("select").eq(0).children(":selected").text(),town:d.find("select").eq(1).children(":selected").text(),address:e[1]}}),a("#tooling").remove(),f.editing=!0,!1},j=function(){return a("#table").bootstrapTable("updateRow",{index:f.$data.thId,row:{}}),a("#tooling").remove(),f.editing=!0,!1};if(f.editing){f.editing=!1,f.columns.forEach(function(c){if(c.editable)switch(c.editable){case"input":var f=a('<div class="editable-input col-md-12 col-sm-12 col-xs-12" style="position: relative;"/>');e.push(d.find("td").eq(c.fieldIndex).text()),f.append(a('<input type="text" class="form-control input-sm"/>')),f.append(a('<span class="clear"><i class="fa fa-times-circle-o" aria-hidden="true"></i></span>')),d.find("td").eq(c.fieldIndex).text("").append(f);break;case"select":var g=a('<select id="'+c.field+'">'),h=a.selectArray[c.field];d.find("td").eq(c.fieldIndex).text("").append(g),b(a("#"+c.field),h);break;case"textarea":break;default:console.log(c.fieldIndex+" "+c.editable)}},c);for(var k=0,l=e.length;l>k;k++)d.find('input[type="text"]').eq(k).val(e[k]);d.find("td").last().append('<div id="tooling" class="editable-buttons"/>'),a(".clear").on("click",function(){a(this).parent().find("input").val("")}),a(g).on("click",i).appendTo("#tooling"),a(h).on("click",j).appendTo("#tooling")}}a.extend(a.fn.bootstrapTable.defaults,{clickEdit:!1});var d=a.fn.bootstrapTable.Constructor,e=d.prototype.initTable,f=d.prototype.initBody;d.prototype.initTable=function(){this.$data={},e.apply(this,Array.prototype.slice.apply(arguments)),!this.options.clickEdit},d.prototype.initBody=function(){var a=this;if(f.apply(this,Array.prototype.slice.apply(arguments)),this.options.clickEdit){var b=this.$tableBody.find("table");a.editing=!0,b.on("click-row.bs.table",function(a,b,d,e){"no"!==e&&(this.$data.thId=d.data().index,this.$data.itemid=d.data().uniqueid,this.$data.divi=parseInt(b.area),this.$data.town=parseInt(b.town),c(this,d))}.bind(this))}}}(jQuery);