Browse Source

BI-5304

es6
guy 8 years ago
parent
commit
ce809e81cc
  1. 20
      bi/core.js
  2. 20
      docs/core.js
  3. 19
      src/core/func/dom.js
  4. 1
      src/core/func/function.js

20
bi/core.js

@ -16027,7 +16027,7 @@ BI.extend(jQuery.fn, {
if (!BI.isKey(keyword)) { if (!BI.isKey(keyword)) {
return this.text((text + "").replaceAll(" ", " ")); return this.text((text + "").replaceAll(" ", " "));
} }
keyword = keyword + ""; keyword = BI.makeFirstPY(keyword + "");
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
var textLeft = (text || "") + ""; var textLeft = (text || "") + "";
py = (py || BI.makeFirstPY(text)) + ""; py = (py || BI.makeFirstPY(text)) + "";
@ -16272,7 +16272,8 @@ BI.extend(jQuery, {
getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var top, adaptHeight; var top, adaptHeight;
if ($.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { if ($.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + extraHeight; top = comboOffset.top + extraHeight;
@ -16320,7 +16321,8 @@ BI.extend(jQuery, {
getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var top, adaptHeight; var top, adaptHeight;
if ($.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { if ($.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight;
@ -16346,7 +16348,8 @@ BI.extend(jQuery, {
getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
if ($.isBottomSpaceEnough(combo, popup, extraHeight)) { if ($.isBottomSpaceEnough(combo, popup, extraHeight)) {
return $.getBottomPosition(combo, popup, extraHeight); return $.getBottomPosition(combo, popup, extraHeight);
} }
@ -16369,7 +16372,8 @@ BI.extend(jQuery, {
getCenterAdaptPosition: function (combo, popup) { getCenterAdaptPosition: function (combo, popup) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var left; var left;
if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) { if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) {
left = windowBounds.width - popupBounds.width; left = windowBounds.width - popupBounds.width;
@ -16386,7 +16390,8 @@ BI.extend(jQuery, {
getMiddleAdaptPosition: function (combo, popup) { getMiddleAdaptPosition: function (combo, popup) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var top; var top;
if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) { if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) {
top = windowBounds.height - popupBounds.height; top = windowBounds.height - popupBounds.height;
@ -16582,7 +16587,7 @@ BI.extend(jQuery, {
} }
break; break;
} }
if(needAdaptHeight === true) { if (needAdaptHeight === true) {
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight));
} }
return position; return position;
@ -16613,6 +16618,7 @@ $(function () {
}; };
} }
var t, text, py; var t, text, py;
keyword = BI.makeFirstPY(keyword);
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
var matched = isArray ? [] : {}, finded = isArray ? [] : {}; var matched = isArray ? [] : {}, finded = isArray ? [] : {};
BI.each(items, function (i, item) { BI.each(items, function (i, item) {

20
docs/core.js

@ -22050,7 +22050,7 @@ BI.extend(jQuery.fn, {
if (!BI.isKey(keyword)) { if (!BI.isKey(keyword)) {
return this.text((text + "").replaceAll(" ", " ")); return this.text((text + "").replaceAll(" ", " "));
} }
keyword = keyword + ""; keyword = BI.makeFirstPY(keyword + "");
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
var textLeft = (text || "") + ""; var textLeft = (text || "") + "";
py = (py || BI.makeFirstPY(text)) + ""; py = (py || BI.makeFirstPY(text)) + "";
@ -22295,7 +22295,8 @@ BI.extend(jQuery, {
getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var top, adaptHeight; var top, adaptHeight;
if ($.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { if ($.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + extraHeight; top = comboOffset.top + extraHeight;
@ -22343,7 +22344,8 @@ BI.extend(jQuery, {
getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var top, adaptHeight; var top, adaptHeight;
if ($.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { if ($.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight;
@ -22369,7 +22371,8 @@ BI.extend(jQuery, {
getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
if ($.isBottomSpaceEnough(combo, popup, extraHeight)) { if ($.isBottomSpaceEnough(combo, popup, extraHeight)) {
return $.getBottomPosition(combo, popup, extraHeight); return $.getBottomPosition(combo, popup, extraHeight);
} }
@ -22392,7 +22395,8 @@ BI.extend(jQuery, {
getCenterAdaptPosition: function (combo, popup) { getCenterAdaptPosition: function (combo, popup) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var left; var left;
if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) { if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) {
left = windowBounds.width - popupBounds.width; left = windowBounds.width - popupBounds.width;
@ -22409,7 +22413,8 @@ BI.extend(jQuery, {
getMiddleAdaptPosition: function (combo, popup) { getMiddleAdaptPosition: function (combo, popup) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var top; var top;
if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) { if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) {
top = windowBounds.height - popupBounds.height; top = windowBounds.height - popupBounds.height;
@ -22605,7 +22610,7 @@ BI.extend(jQuery, {
} }
break; break;
} }
if(needAdaptHeight === true) { if (needAdaptHeight === true) {
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight));
} }
return position; return position;
@ -22636,6 +22641,7 @@ $(function () {
}; };
} }
var t, text, py; var t, text, py;
keyword = BI.makeFirstPY(keyword);
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
var matched = isArray ? [] : {}, finded = isArray ? [] : {}; var matched = isArray ? [] : {}, finded = isArray ? [] : {};
BI.each(items, function (i, item) { BI.each(items, function (i, item) {

19
src/core/func/dom.js

@ -22,7 +22,7 @@ BI.extend(jQuery.fn, {
if (!BI.isKey(keyword)) { if (!BI.isKey(keyword)) {
return this.text((text + "").replaceAll(" ", " ")); return this.text((text + "").replaceAll(" ", " "));
} }
keyword = keyword + ""; keyword = BI.makeFirstPY(keyword + "");
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
var textLeft = (text || "") + ""; var textLeft = (text || "") + "";
py = (py || BI.makeFirstPY(text)) + ""; py = (py || BI.makeFirstPY(text)) + "";
@ -267,7 +267,8 @@ BI.extend(jQuery, {
getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var top, adaptHeight; var top, adaptHeight;
if ($.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { if ($.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + extraHeight; top = comboOffset.top + extraHeight;
@ -315,7 +316,8 @@ BI.extend(jQuery, {
getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var top, adaptHeight; var top, adaptHeight;
if ($.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { if ($.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight;
@ -341,7 +343,8 @@ BI.extend(jQuery, {
getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
if ($.isBottomSpaceEnough(combo, popup, extraHeight)) { if ($.isBottomSpaceEnough(combo, popup, extraHeight)) {
return $.getBottomPosition(combo, popup, extraHeight); return $.getBottomPosition(combo, popup, extraHeight);
} }
@ -364,7 +367,8 @@ BI.extend(jQuery, {
getCenterAdaptPosition: function (combo, popup) { getCenterAdaptPosition: function (combo, popup) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var left; var left;
if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) { if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) {
left = windowBounds.width - popupBounds.width; left = windowBounds.width - popupBounds.width;
@ -381,7 +385,8 @@ BI.extend(jQuery, {
getMiddleAdaptPosition: function (combo, popup) { getMiddleAdaptPosition: function (combo, popup) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = $("body").bounds();
var top; var top;
if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) { if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) {
top = windowBounds.height - popupBounds.height; top = windowBounds.height - popupBounds.height;
@ -577,7 +582,7 @@ BI.extend(jQuery, {
} }
break; break;
} }
if(needAdaptHeight === true) { if (needAdaptHeight === true) {
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight));
} }
return position; return position;

1
src/core/func/function.js

@ -24,6 +24,7 @@ $(function () {
}; };
} }
var t, text, py; var t, text, py;
keyword = BI.makeFirstPY(keyword);
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
var matched = isArray ? [] : {}, finded = isArray ? [] : {}; var matched = isArray ? [] : {}, finded = isArray ? [] : {};
BI.each(items, function (i, item) { BI.each(items, function (i, item) {

Loading…
Cancel
Save