Browse Source

BI-28806 周相关函数支持BI.StartOfWeek配置

es6
windy 6 years ago
parent
commit
ce8545a369
  1. 50
      dist/_fineui.min.js
  2. 2
      dist/base.js
  3. 10
      dist/bundle.css
  4. 43
      dist/bundle.js
  5. 2
      dist/bundle.min.css
  6. 100
      dist/bundle.min.js
  7. 41
      dist/core.js
  8. 10
      dist/fineui.css
  9. 43
      dist/fineui.js
  10. 2
      dist/fineui.min.css
  11. 50
      dist/fineui.min.js
  12. 10
      dist/resource.css
  13. 17
      dist/utils.js
  14. 4
      dist/utils.min.js
  15. 10
      public/css/font.css
  16. 2
      src/base/layer/layer.popover.js
  17. 3
      src/core/proto/date.i18n.js
  18. 15
      src/core/proto/date.js
  19. 2
      src/core/var.js
  20. 10
      src/css/resource/font.css
  21. 2
      src/less/resource/font.less
  22. 10
      ui/css/font.css

50
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/base.js vendored

@ -15425,7 +15425,7 @@ BI.Popover = BI.inherit(BI.Widget, {
text: o.header, text: o.header,
textAlign: "left" textAlign: "left"
}, },
left: 10, left: 20,
top: 0, top: 0,
right: 0, right: 0,
bottom: 0 bottom: 0

10
dist/bundle.css vendored

@ -5468,16 +5468,6 @@ textarea::-webkit-scrollbar-thumb:hover {
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;
} }
.trigger-triangle-font:hover .b-font:before,
.trigger-triangle-font.hover .b-font:before {
content: "\e64e";
color: #999999;
}
.trigger-triangle-font:active .b-font:before,
.trigger-triangle-font.active .b-font:before {
content: "\e64e";
color: #3685f2;
}
.trigger-triangle-font.disabled .b-font:before { .trigger-triangle-font.disabled .b-font:before {
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;

43
dist/bundle.js vendored

@ -9390,13 +9390,24 @@ jQuery.fn.offset = function( options ) {
// If we don't have gBCR, just use 0,0 rather than error // If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone) // BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== core_strundefined ) { // if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect(); // box = elem.getBoundingClientRect();
} // }
// 解决transform下的offset问题
var el = elem,
offsetLeft = 0,
offsetTop = 0;
do{
offsetLeft += el.offsetLeft;
offsetTop += el.offsetTop;
el = el.offsetParent;
} while( el );
win = getWindow( doc ); win = getWindow( doc );
return { return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), top: offsetTop + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) left: offsetLeft + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
}; };
}; };
@ -29530,6 +29541,9 @@ $(function () {
/** Adds the number of days array to the Date object. */ /** Adds the number of days array to the Date object. */
Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以
Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];
}); });
/** Constants used for time computations */ /** Constants used for time computations */
Date.SECOND = 1000; Date.SECOND = 1000;
@ -29578,18 +29592,17 @@ Date.prototype.getDayOfYear = function () {
/** Returns the number of the week in year, as defined in ISO 8601. */ /** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = BI.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = BI.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
// 周一是一周第一天 var week = d.getDay();
var week = d.getDay() === 0 ? 7 : d.getDay(); var startOfWeek = BI.StartOfWeek % 7;
// var week = d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
d.setDate(this.getDate() - (week - 1)); d.setDate(this.getDate() - (week < startOfWeek ? (7 + week - startOfWeek) : (week - startOfWeek)));
var ms = d.valueOf(); // GMT var ms = d.valueOf(); // GMT
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() !== 1) { if (d.getDay() !== startOfWeek) {
offset++; offset++;
} }
return offset; return offset;
@ -29660,12 +29673,14 @@ Date.prototype.getOffsetMonth = function (n) {
// 获得本周的起始日期 // 获得本周的起始日期
Date.prototype.getWeekStartDate = function () { Date.prototype.getWeekStartDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(w === 0 ? -6 : 1 - w); var startOfWeek = BI.StartOfWeek % 7;
return this.getOffsetDate(Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)]);
}; };
// 得到本周的结束日期 // 得到本周的结束日期
Date.prototype.getWeekEndDate = function () { Date.prototype.getWeekEndDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(w === 0 ? 0 : 7 - w); var startOfWeek = BI.StartOfWeek % 7;
return this.getOffsetDate(Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)] + 6);
}; };
/** Checks date and time equality */ /** Checks date and time equality */
@ -30684,7 +30699,7 @@ _.extend(BI, {
Bottom: "bottom", Bottom: "bottom",
Stretch: "stretch" Stretch: "stretch"
}, },
StartOfWeek: 0 StartOfWeek: 1
});BI.version = "2.0";/** });BI.version = "2.0";/**
* absolute实现的居中布局 * absolute实现的居中布局
* @class BI.AbsoluteCenterLayout * @class BI.AbsoluteCenterLayout
@ -51342,7 +51357,7 @@ BI.Popover = BI.inherit(BI.Widget, {
text: o.header, text: o.header,
textAlign: "left" textAlign: "left"
}, },
left: 10, left: 20,
top: 0, top: 0,
right: 0, right: 0,
bottom: 0 bottom: 0

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

100
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

41
dist/core.js vendored

@ -9390,13 +9390,24 @@ jQuery.fn.offset = function( options ) {
// If we don't have gBCR, just use 0,0 rather than error // If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone) // BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== core_strundefined ) { // if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect(); // box = elem.getBoundingClientRect();
} // }
// 解决transform下的offset问题
var el = elem,
offsetLeft = 0,
offsetTop = 0;
do{
offsetLeft += el.offsetLeft;
offsetTop += el.offsetTop;
el = el.offsetParent;
} while( el );
win = getWindow( doc ); win = getWindow( doc );
return { return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), top: offsetTop + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) left: offsetLeft + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
}; };
}; };
@ -29530,6 +29541,9 @@ $(function () {
/** Adds the number of days array to the Date object. */ /** Adds the number of days array to the Date object. */
Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以
Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];
}); });
/** Constants used for time computations */ /** Constants used for time computations */
Date.SECOND = 1000; Date.SECOND = 1000;
@ -29578,18 +29592,17 @@ Date.prototype.getDayOfYear = function () {
/** Returns the number of the week in year, as defined in ISO 8601. */ /** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = BI.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = BI.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
// 周一是一周第一天 var week = d.getDay();
var week = d.getDay() === 0 ? 7 : d.getDay(); var startOfWeek = BI.StartOfWeek % 7;
// var week = d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
d.setDate(this.getDate() - (week - 1)); d.setDate(this.getDate() - (week < startOfWeek ? (7 + week - startOfWeek) : (week - startOfWeek)));
var ms = d.valueOf(); // GMT var ms = d.valueOf(); // GMT
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() !== 1) { if (d.getDay() !== startOfWeek) {
offset++; offset++;
} }
return offset; return offset;
@ -29660,12 +29673,14 @@ Date.prototype.getOffsetMonth = function (n) {
// 获得本周的起始日期 // 获得本周的起始日期
Date.prototype.getWeekStartDate = function () { Date.prototype.getWeekStartDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(w === 0 ? -6 : 1 - w); var startOfWeek = BI.StartOfWeek % 7;
return this.getOffsetDate(Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)]);
}; };
// 得到本周的结束日期 // 得到本周的结束日期
Date.prototype.getWeekEndDate = function () { Date.prototype.getWeekEndDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(w === 0 ? 0 : 7 - w); var startOfWeek = BI.StartOfWeek % 7;
return this.getOffsetDate(Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)] + 6);
}; };
/** Checks date and time equality */ /** Checks date and time equality */
@ -30684,7 +30699,7 @@ _.extend(BI, {
Bottom: "bottom", Bottom: "bottom",
Stretch: "stretch" Stretch: "stretch"
}, },
StartOfWeek: 0 StartOfWeek: 1
});BI.version = "2.0";/** });BI.version = "2.0";/**
* absolute实现的居中布局 * absolute实现的居中布局
* @class BI.AbsoluteCenterLayout * @class BI.AbsoluteCenterLayout

10
dist/fineui.css vendored

@ -5468,16 +5468,6 @@ textarea::-webkit-scrollbar-thumb:hover {
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;
} }
.trigger-triangle-font:hover .b-font:before,
.trigger-triangle-font.hover .b-font:before {
content: "\e64e";
color: #999999;
}
.trigger-triangle-font:active .b-font:before,
.trigger-triangle-font.active .b-font:before {
content: "\e64e";
color: #3685f2;
}
.trigger-triangle-font.disabled .b-font:before { .trigger-triangle-font.disabled .b-font:before {
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;

43
dist/fineui.js vendored

@ -9639,13 +9639,24 @@ jQuery.fn.offset = function( options ) {
// If we don't have gBCR, just use 0,0 rather than error // If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone) // BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== core_strundefined ) { // if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect(); // box = elem.getBoundingClientRect();
} // }
// 解决transform下的offset问题
var el = elem,
offsetLeft = 0,
offsetTop = 0;
do{
offsetLeft += el.offsetLeft;
offsetTop += el.offsetTop;
el = el.offsetParent;
} while( el );
win = getWindow( doc ); win = getWindow( doc );
return { return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), top: offsetTop + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) left: offsetLeft + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
}; };
}; };
@ -29779,6 +29790,9 @@ $(function () {
/** Adds the number of days array to the Date object. */ /** Adds the number of days array to the Date object. */
Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以
Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];
}); });
/** Constants used for time computations */ /** Constants used for time computations */
Date.SECOND = 1000; Date.SECOND = 1000;
@ -29827,18 +29841,17 @@ Date.prototype.getDayOfYear = function () {
/** Returns the number of the week in year, as defined in ISO 8601. */ /** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = BI.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = BI.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
// 周一是一周第一天 var week = d.getDay();
var week = d.getDay() === 0 ? 7 : d.getDay(); var startOfWeek = BI.StartOfWeek % 7;
// var week = d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
d.setDate(this.getDate() - (week - 1)); d.setDate(this.getDate() - (week < startOfWeek ? (7 + week - startOfWeek) : (week - startOfWeek)));
var ms = d.valueOf(); // GMT var ms = d.valueOf(); // GMT
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() !== 1) { if (d.getDay() !== startOfWeek) {
offset++; offset++;
} }
return offset; return offset;
@ -29909,12 +29922,14 @@ Date.prototype.getOffsetMonth = function (n) {
// 获得本周的起始日期 // 获得本周的起始日期
Date.prototype.getWeekStartDate = function () { Date.prototype.getWeekStartDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(w === 0 ? -6 : 1 - w); var startOfWeek = BI.StartOfWeek % 7;
return this.getOffsetDate(Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)]);
}; };
// 得到本周的结束日期 // 得到本周的结束日期
Date.prototype.getWeekEndDate = function () { Date.prototype.getWeekEndDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(w === 0 ? 0 : 7 - w); var startOfWeek = BI.StartOfWeek % 7;
return this.getOffsetDate(Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)] + 6);
}; };
/** Checks date and time equality */ /** Checks date and time equality */
@ -30933,7 +30948,7 @@ _.extend(BI, {
Bottom: "bottom", Bottom: "bottom",
Stretch: "stretch" Stretch: "stretch"
}, },
StartOfWeek: 0 StartOfWeek: 1
});BI.version = "2.0";/** });BI.version = "2.0";/**
* absolute实现的居中布局 * absolute实现的居中布局
* @class BI.AbsoluteCenterLayout * @class BI.AbsoluteCenterLayout
@ -51591,7 +51606,7 @@ BI.Popover = BI.inherit(BI.Widget, {
text: o.header, text: o.header,
textAlign: "left" textAlign: "left"
}, },
left: 10, left: 20,
top: 0, top: 0,
right: 0, right: 0,
bottom: 0 bottom: 0

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

50
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

10
dist/resource.css vendored

@ -906,16 +906,6 @@ textarea::-webkit-scrollbar-thumb:hover {
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;
} }
.trigger-triangle-font:hover .b-font:before,
.trigger-triangle-font.hover .b-font:before {
content: "\e64e";
color: #999999;
}
.trigger-triangle-font:active .b-font:before,
.trigger-triangle-font.active .b-font:before {
content: "\e64e";
color: #3685f2;
}
.trigger-triangle-font.disabled .b-font:before { .trigger-triangle-font.disabled .b-font:before {
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;

17
dist/utils.js vendored

@ -10144,7 +10144,7 @@ _.extend(BI, {
Bottom: "bottom", Bottom: "bottom",
Stretch: "stretch" Stretch: "stretch"
}, },
StartOfWeek: 0 StartOfWeek: 1
});/** });/**
* 对数组对象的扩展 * 对数组对象的扩展
* @class Array * @class Array
@ -10640,18 +10640,17 @@ Date.prototype.getDayOfYear = function () {
/** Returns the number of the week in year, as defined in ISO 8601. */ /** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = BI.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = BI.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
// 周一是一周第一天 var week = d.getDay();
var week = d.getDay() === 0 ? 7 : d.getDay(); var startOfWeek = BI.StartOfWeek % 7;
// var week = d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
d.setDate(this.getDate() - (week - 1)); d.setDate(this.getDate() - (week < startOfWeek ? (7 + week - startOfWeek) : (week - startOfWeek)));
var ms = d.valueOf(); // GMT var ms = d.valueOf(); // GMT
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() !== 1) { if (d.getDay() !== startOfWeek) {
offset++; offset++;
} }
return offset; return offset;
@ -10722,12 +10721,14 @@ Date.prototype.getOffsetMonth = function (n) {
// 获得本周的起始日期 // 获得本周的起始日期
Date.prototype.getWeekStartDate = function () { Date.prototype.getWeekStartDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(w === 0 ? -6 : 1 - w); var startOfWeek = BI.StartOfWeek % 7;
return this.getOffsetDate(Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)]);
}; };
// 得到本周的结束日期 // 得到本周的结束日期
Date.prototype.getWeekEndDate = function () { Date.prototype.getWeekEndDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(w === 0 ? 0 : 7 - w); var startOfWeek = BI.StartOfWeek % 7;
return this.getOffsetDate(Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)] + 6);
}; };
/** Checks date and time equality */ /** Checks date and time equality */

4
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

10
public/css/font.css

@ -570,16 +570,6 @@
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;
} }
.trigger-triangle-font:hover .b-font:before,
.trigger-triangle-font.hover .b-font:before {
content: "\e64e";
color: #999999;
}
.trigger-triangle-font:active .b-font:before,
.trigger-triangle-font.active .b-font:before {
content: "\e64e";
color: #3685f2;
}
.trigger-triangle-font.disabled .b-font:before { .trigger-triangle-font.disabled .b-font:before {
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;

2
src/base/layer/layer.popover.js

@ -64,7 +64,7 @@ BI.Popover = BI.inherit(BI.Widget, {
text: o.header, text: o.header,
textAlign: "left" textAlign: "left"
}, },
left: 10, left: 20,
top: 0, top: 0,
right: 0, right: 0,
bottom: 0 bottom: 0

3
src/core/proto/date.i18n.js

@ -59,4 +59,7 @@ $(function () {
/** Adds the number of days array to the Date object. */ /** Adds the number of days array to the Date object. */
Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以
Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];
}); });

15
src/core/proto/date.js

@ -46,18 +46,17 @@ Date.prototype.getDayOfYear = function () {
/** Returns the number of the week in year, as defined in ISO 8601. */ /** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = BI.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = BI.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
// 周一是一周第一天 var week = d.getDay();
var week = d.getDay() === 0 ? 7 : d.getDay(); var startOfWeek = BI.StartOfWeek % 7;
// var week = d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
d.setDate(this.getDate() - (week - 1)); d.setDate(this.getDate() - (week < startOfWeek ? (7 + week - startOfWeek) : (week - startOfWeek)));
var ms = d.valueOf(); // GMT var ms = d.valueOf(); // GMT
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() !== 1) { if (d.getDay() !== startOfWeek) {
offset++; offset++;
} }
return offset; return offset;
@ -128,12 +127,14 @@ Date.prototype.getOffsetMonth = function (n) {
// 获得本周的起始日期 // 获得本周的起始日期
Date.prototype.getWeekStartDate = function () { Date.prototype.getWeekStartDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(w === 0 ? -6 : 1 - w); var startOfWeek = BI.StartOfWeek % 7;
return this.getOffsetDate(Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)]);
}; };
// 得到本周的结束日期 // 得到本周的结束日期
Date.prototype.getWeekEndDate = function () { Date.prototype.getWeekEndDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(w === 0 ? 0 : 7 - w); var startOfWeek = BI.StartOfWeek % 7;
return this.getOffsetDate(Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)] + 6);
}; };
/** Checks date and time equality */ /** Checks date and time equality */

2
src/core/var.js

@ -133,5 +133,5 @@ _.extend(BI, {
Bottom: "bottom", Bottom: "bottom",
Stretch: "stretch" Stretch: "stretch"
}, },
StartOfWeek: 0 StartOfWeek: 1
}); });

10
src/css/resource/font.css

@ -570,16 +570,6 @@
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;
} }
.trigger-triangle-font:hover .b-font:before,
.trigger-triangle-font.hover .b-font:before {
content: "\e64e";
color: #999999;
}
.trigger-triangle-font:active .b-font:before,
.trigger-triangle-font.active .b-font:before {
content: "\e64e";
color: #3685f2;
}
.trigger-triangle-font.disabled .b-font:before { .trigger-triangle-font.disabled .b-font:before {
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;

2
src/less/resource/font.less

@ -75,7 +75,7 @@
.font-hover(solid-triangle-bottom-font, @font-solid-bottom); .font-hover(solid-triangle-bottom-font, @font-solid-bottom);
//下拉框小小三角 //下拉框小小三角
.font-hover-active(trigger-triangle-font, @font-no-sort-no-filter, @color-bi-text-gray, @color-bi-text-gray, @color-bi-text-highlight); .font(trigger-triangle-font, @font-no-sort-no-filter, @color-bi-text-gray);
//单选下拉框 //单选下拉框
//向下展开子菜单 //向下展开子菜单

10
ui/css/font.css

@ -570,16 +570,6 @@
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;
} }
.trigger-triangle-font:hover .b-font:before,
.trigger-triangle-font.hover .b-font:before {
content: "\e64e";
color: #999999;
}
.trigger-triangle-font:active .b-font:before,
.trigger-triangle-font.active .b-font:before {
content: "\e64e";
color: #3685f2;
}
.trigger-triangle-font.disabled .b-font:before { .trigger-triangle-font.disabled .b-font:before {
content: "\e64e"; content: "\e64e";
color: #999999; color: #999999;

Loading…
Cancel
Save