Browse Source

rebuild: flatpickr and dayjs

master
zhangchen 5 years ago
parent
commit
fe26e5cdb7
  1. 7
      gulpfile.js
  2. 1
      package.json
  3. 30
      src/controllers/cellDatePickerCtrl.js
  4. 631
      src/controllers/conditionformat.js
  5. 305
      src/controllers/dropCell.js
  6. 13
      src/controllers/server.js
  7. 3613
      src/function/functionImplementation.js
  8. 530
      src/global/api.js
  9. 9
      src/global/datecontroll.js
  10. 83
      src/global/func_methods.js
  11. 421
      src/plugins/css/daterangepicker.css
  12. 97
      src/plugins/js/moment-msdate.js
  13. 1
      src/plugins/js/moment-timezone-with-data.min.js
  14. 7
      src/plugins/js/moment.min.js

7
gulpfile.js

@ -80,7 +80,7 @@ const paths = {
//plugins src
pluginsCss: ['src/plugins/css/*.css'],
plugins: ['src/plugins/*.css'],
css:['src/css/*.css'],
css:['src/css/*.css','node_modules/flatpickr/dist/themes/light.css'],
pluginsJs:[
'node_modules/jquery/dist/jquery.min.js',
//'src/plugins/js/jquery.min.js',
@ -88,12 +88,9 @@ const paths = {
'src/plugins/js/spectrum.min.js',
'src/plugins/js/jquery-ui.min.js',
'src/plugins/js/jquery.mousewheel.min.js',
'src/plugins/js/moment.min.js',
'src/plugins/js/moment-timezone-with-data.min.js',
'src/plugins/js/moment-msdate.js',
'src/plugins/js/numeral.min.js',
'src/plugins/js/html2canvas.min.js',
//'src/plugins/js/pako.min.js',
'src/plugins/js/pako.min.js',
'src/plugins/js/localforage.min.js',
'src/plugins/js/lodash.min.js',
'src/plugins/js/daterangepicker.js',

1
package.json

@ -30,6 +30,7 @@
"dependencies": {
"@babel/runtime": "^7.12.1",
"dayjs": "^1.9.4",
"flatpickr": "^4.6.6",
"jquery": "^3.5.1",
"jspdf": "^2.1.1",
"pako": "^1.0.11"

30
src/controllers/cellDatePickerCtrl.js

@ -1,6 +1,9 @@
import menuButton from './menuButton';
import formula from '../global/formula';
import Store from '../store';
import flatpickr from 'flatpickr'
import dayjs from "dayjs";
import {Mandarin} from "flatpickr/dist/l10n/zh"
const cellDatePickerCtrl = {
cellFocus: function(r, c, value){
@ -13,7 +16,7 @@ const cellDatePickerCtrl = {
if(!!margeset){
row = margeset.row[1];
row_pre = margeset.row[0];
col = margeset.column[1];
col_pre = margeset.column[0];
}
@ -25,17 +28,24 @@ const cellDatePickerCtrl = {
top: row_pre
})
$("#cellDatePickerBtn").daterangepicker({
singleDatePicker: true,
startDate: moment(value),
endDate: moment(value)
}, function(start) {
$("#luckysheet-rich-text-editor").html(start.format('YYYY-MM-DD'));
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
})
flatpickr('#cellDatePickerBtn',{
locale: Mandarin,
dateFormat: "YYYY-MM-DD",
parseDate: (datestr, format) => {
return dayjs(datestr).toDate();
},
formatDate: (date, format, locale) => {
return dayjs(date).format(format);
},
onChange: function (selectedDates, dateStr, instance) {
console.log(selectedDates, dateStr)
$("#luckysheet-rich-text-editor").html(dateStr);
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
}
});
$("#cellDatePickerBtn").click();
},
}
export default cellDatePickerCtrl;
export default cellDatePickerCtrl;

631
src/controllers/conditionformat.js

File diff suppressed because it is too large

305
src/controllers/dropCell.js

@ -13,6 +13,7 @@ import { getSheetIndex } from '../methods/get';
import { getObjType, replaceHtml } from '../utils/util';
import Store from '../store';
import locale from '../locale/locale';
import dayjs from 'dayjs'
//选区下拉
const luckysheetDropCell = {
@ -72,10 +73,10 @@ const luckysheetDropCell = {
direction: null, //down-往下拖拽,right-往右拖拽,up-往上拖拽,left-往左拖拽
chnNumChar: {"零": 0, "一": 1, "二": 2, "三": 3, "四": 4, "五": 5, "六": 6, "七": 7, "八": 8, "九": 9},
chnNameValue: {
"十": {value: 10, secUnit: false},
"百": {value: 100, secUnit: false},
"千": {value: 1000, secUnit: false},
"万": {value: 10000, secUnit: true},
"十": {value: 10, secUnit: false},
"百": {value: 100, secUnit: false},
"千": {value: 1000, secUnit: false},
"万": {value: 10000, secUnit: true},
"亿": {value: 100000000, secUnit: true}
},
ChineseToNumber: function(chnStr){
@ -92,7 +93,7 @@ const luckysheetDropCell = {
if(typeof num != "undefined"){
number = num;
if(i == str.length - 1){
section += number;
}
@ -100,7 +101,7 @@ const luckysheetDropCell = {
else{
let unit = _this.chnNameValue[str[i]].value;
secUnit = _this.chnNameValue[str[i]].secUnit;
if(secUnit){
section = (section + number) * unit;
rtn += section;
@ -213,7 +214,7 @@ const luckysheetDropCell = {
if(isExtendNumber){
let str = txt.split("");
str.reverse();
let len = 0;
for(let i = 0; i < str.length; i++){
if(!reg.test(str[i])){
@ -222,7 +223,7 @@ const luckysheetDropCell = {
}
}
return [isExtendNumber, txt.substr(0, txt.length - len), txt.substr(txt.length - len, len)];
return [isExtendNumber, txt.substr(0, txt.length - len), txt.substr(txt.length - len, len)];
}
else{
return [isExtendNumber];
@ -230,14 +231,14 @@ const luckysheetDropCell = {
},
isChnWeek1: function(txt){
let _this = this;
let isChnWeek1;
if(txt.length == 1){
if(txt == "日" || _this.ChineseToNumber(txt) < 7){
isChnWeek1 = true;
}
else{
isChnWeek1 = false;
isChnWeek1 = false;
}
}
else{
@ -281,11 +282,11 @@ const luckysheetDropCell = {
createIcon: function(){
let _this = this;
let copy_r = _this.copyRange["row"][1],
let copy_r = _this.copyRange["row"][1],
copy_c = _this.copyRange["column"][1];
let apply_r = _this.applyRange["row"][1],
let apply_r = _this.applyRange["row"][1],
apply_c = _this.applyRange["column"][1];
let row_index, col_index;
if(apply_r >= copy_r && apply_c >= copy_c){
row_index = apply_r;
@ -293,12 +294,12 @@ const luckysheetDropCell = {
}
else{
row_index = copy_r;
col_index = copy_c;
col_index = copy_c;
}
let row = rowLocationByIndex(row_index)[1],
let row = rowLocationByIndex(row_index)[1],
row_pre = rowLocationByIndex(row_index)[0];
let col = colLocationByIndex(col_index)[1],
let col = colLocationByIndex(col_index)[1],
col_pre = colLocationByIndex(col_index)[0];
$("#luckysheet-dropCell-icon").remove();
@ -346,11 +347,11 @@ const luckysheetDropCell = {
if(!typeItemHide[3]){
$("#luckysheet-dropCell-typeList .luckysheet-cols-menuitem[data-type=8]").hide();
}
let left = $(this).offset().left;
let top = $(this).offset().top + 25;
let winH = $(window).height(), winW = $(window).width();
let menuW = $("#luckysheet-dropCell-typeList").width(),
let menuW = $("#luckysheet-dropCell-typeList").width(),
menuH = $("#luckysheet-dropCell-typeList").height();
if (left + menuW > winW) {
@ -369,7 +370,7 @@ const luckysheetDropCell = {
$("#luckysheet-dropCell-icon").mouseleave(function(){ $(this).css("backgroundColor", "#ffe8e8") });
let type = _this.applyType;
$("#luckysheet-dropCell-typeList .luckysheet-cols-menuitem[data-type="+ type +"]").find("span").append('<i class="fa fa-check luckysheet-mousedown-cancel"></i>');
$("#luckysheet-dropCell-typeList .luckysheet-cols-menuitem[data-type="+ type +"]").find("span").append('<i class="fa fa-check luckysheet-mousedown-cancel"></i>');
event.stopPropagation();
});
@ -385,7 +386,7 @@ const luckysheetDropCell = {
$("#luckysheet-dropCell-typeList").hide();
$("#luckysheet-dropCell-icon").css("backgroundColor", "#f1f1f1");
$("#luckysheet-dropCell-icon").mouseleave(function(){ $(this).css("backgroundColor", "#f1f1f1") });
$("#luckysheet-dropCell-icon").mouseleave(function(){ $(this).css("backgroundColor", "#f1f1f1") });
countfunc();
});
@ -397,12 +398,12 @@ const luckysheetDropCell = {
let str_r = copyRange["row"][0], end_r = copyRange["row"][1];
let str_c = copyRange["column"][0], end_c = copyRange["column"][1];
let hasNumber = false,
hasExtendNumber = false,
hasDate = false,
hasChn = false,
hasChnWeek1 = false,
hasChnWeek2 = false,
let hasNumber = false,
hasExtendNumber = false,
hasDate = false,
hasChn = false,
hasChnWeek1 = false,
hasChnWeek2 = false,
hasChnWeek3 = false;
for(let r = str_r; r <= end_r; r++){
@ -438,7 +439,7 @@ const luckysheetDropCell = {
}
return [hasNumber, hasExtendNumber, hasDate, hasChn, hasChnWeek1, hasChnWeek2, hasChnWeek3];
},
},
update: function(){
let _this = this;
@ -452,7 +453,7 @@ const luckysheetDropCell = {
let d = editor.deepCopyFlowData(Store.flowdata);
let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)];
let cfg = $.extend(true, {}, Store.config);
let borderInfoCompute = getBorderInfoCompute();
let dataVerification = $.extend(true, {}, file["dataVerification"]);
@ -465,7 +466,7 @@ const luckysheetDropCell = {
let copy_str_r = copyRange["row"][0], copy_end_r = copyRange["row"][1];
let copy_str_c = copyRange["column"][0], copy_end_c = copyRange["column"][1];
let copyData = _this.getCopyData(d, copy_str_r, copy_end_r, copy_str_c, copy_end_c, direction);
let csLen;
if(direction == "down" || direction == "up"){
csLen = copy_end_r - copy_str_r + 1;
@ -484,9 +485,9 @@ const luckysheetDropCell = {
for(let i = apply_str_c; i <= apply_end_c; i++){
let copyD = copyData[i - apply_str_c];
let applyData = _this.getApplyData(copyD, csLen, asLen);
if(direction == "down"){
for(let j = apply_str_r; j <= apply_end_r; j++){
let cell = applyData[j - apply_str_r];
@ -672,7 +673,7 @@ const luckysheetDropCell = {
for(let i = apply_str_r; i <= apply_end_r; i++){
let copyD = copyData[i - apply_str_r];
let applyData = _this.getApplyData(copyD, csLen, asLen);
if(direction == "right"){
@ -894,15 +895,15 @@ const luckysheetDropCell = {
let a1, a2, b1, b2;
if(direction == "down" || direction == "up"){
a1 = c1;
a2 = c2;
b1 = r1;
a1 = c1;
a2 = c2;
b1 = r1;
b2 = r2;
}
else if(direction == "right" || direction == "left"){
a1 = r1;
a2 = r2;
b1 = c1;
a1 = r1;
a2 = r2;
b1 = c1;
b2 = c2;
}
@ -938,7 +939,7 @@ const luckysheetDropCell = {
}
else if(_this.isExtendNumber(data["m"])[0]){
str = "extendNumber";
if(extendNumberStr == null){
isSameStr = true;
extendNumberStr = _this.isExtendNumber(data["m"])[1];
@ -1046,7 +1047,7 @@ const luckysheetDropCell = {
arrData = [];
arrData.push(data);
arrIndex = [];
arrIndex.push(b - b1 + 1);
arrIndex.push(b - b1 + 1);
}
}
}
@ -1121,7 +1122,7 @@ const luckysheetDropCell = {
arrData = [];
arrData.push(data);
arrIndex = [];
arrIndex.push(b - b1 + 1);
arrIndex.push(b - b1 + 1);
}
}
}
@ -1163,8 +1164,8 @@ const luckysheetDropCell = {
}
let arrIndex = _this.getDataIndex(csLen, asLen, copyD_number[i]["index"]);
applyD_number.push({"data": arrData, "index": arrIndex});
}
applyD_number.push({"data": arrData, "index": arrIndex});
}
}
//扩展数字型(即一串字符最后面的是数字)
@ -1187,8 +1188,8 @@ const luckysheetDropCell = {
}
let arrIndex = _this.getDataIndex(csLen, asLen, copyD_extendNumber[i]["index"]);
applyD_extendNumber.push({"data": arrData, "index": arrIndex});
}
applyD_extendNumber.push({"data": arrData, "index": arrIndex});
}
}
//日期类型
@ -1211,8 +1212,8 @@ const luckysheetDropCell = {
}
let arrIndex = _this.getDataIndex(csLen, asLen, copyD_date[i]["index"]);
applyD_date.push({"data": arrData, "index": arrIndex});
}
applyD_date.push({"data": arrData, "index": arrIndex});
}
}
//中文小写数字 或 一~日
@ -1235,8 +1236,8 @@ const luckysheetDropCell = {
}
let arrIndex = _this.getDataIndex(csLen, asLen, copyD_chnNumber[i]["index"]);
applyD_chnNumber.push({"data": arrData, "index": arrIndex});
}
applyD_chnNumber.push({"data": arrData, "index": arrIndex});
}
}
//周一~周日
@ -1259,8 +1260,8 @@ const luckysheetDropCell = {
}
let arrIndex = _this.getDataIndex(csLen, asLen, copyD_chnWeek2[i]["index"]);
applyD_chnWeek2.push({"data": arrData, "index": arrIndex});
}
applyD_chnWeek2.push({"data": arrData, "index": arrIndex});
}
}
//星期一~星期日
@ -1283,8 +1284,8 @@ const luckysheetDropCell = {
}
let arrIndex = _this.getDataIndex(csLen, asLen, copyD_chnWeek3[i]["index"]);
applyD_chnWeek3.push({"data": arrData, "index": arrIndex});
}
applyD_chnWeek3.push({"data": arrData, "index": arrIndex});
}
}
//其它
@ -1304,10 +1305,10 @@ const luckysheetDropCell = {
}
let arrIndex = _this.getDataIndex(csLen, asLen, copyD_other[i]["index"]);
applyD_other.push({"data": arrData, "index": arrIndex});
}
applyD_other.push({"data": arrData, "index": arrIndex});
}
}
for(let x = 1; x <= asLen; x++){
if(applyD_number.length > 0){
for(let y = 0; y < applyD_number.length; y++){
@ -1373,7 +1374,7 @@ const luckysheetDropCell = {
for(let j = 0; j < indexArr.length; j++){
if(indexArr[j] <= rsd){
s++;
s++;
}
else{
break;
@ -1430,11 +1431,11 @@ const luckysheetDropCell = {
data.reverse();
}
applyData = _this.FillCopy(data, len);
applyData = _this.FillCopy(data, len);
}
else if(type == "1"){ //填充序列
if(dataType == "number"){
//数据类型是 数字
//数据类型是 数字
applyData = _this.FillSeries(data, len, direction);
}
else if(dataType == "extendNumber"){
@ -1474,7 +1475,7 @@ const luckysheetDropCell = {
}
}
}
else if(dataType == "date"){
else if(dataType == "date"){
//数据类型是 日期
if(data.length == 1){
//以一天为step
@ -1496,18 +1497,18 @@ const luckysheetDropCell = {
let judgeDate = _this.judgeDate(data);
if(judgeDate[0] && judgeDate[3]){
//日一样,月差为等差数列,以月差为step
let step = moment(data[1]["m"]).diff(moment(data[0]["m"]), "months");
let step = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "months");
applyData = _this.FillMonths(data, len, step);
}
else if(!judgeDate[0] && judgeDate[2]){
//日不一样,日差为等差数列,以日差为step
let step = moment(data[1]["m"]).diff(moment(data[0]["m"]), "days");
let step = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "days");
applyData = _this.FillDays(data, len, step);
}
else{
//其它,复制数据
applyData = _this.FillCopy(data, len);
}
}
}
}
else if(dataType == "chnNumber"){
@ -1727,7 +1728,7 @@ const luckysheetDropCell = {
data.reverse();
}
let step = moment(data[1]["m"]).diff(moment(data[0]["m"]), "days");
let step = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "days");
applyData = _this.FillDays(data, len, step);
}
else{
@ -1738,12 +1739,12 @@ const luckysheetDropCell = {
let judgeDate = _this.judgeDate(data);
if(judgeDate[0] && judgeDate[3]){
//日一样,且月差为等差数列,以月差为step
let step = moment(data[1]["m"]).diff(moment(data[0]["m"]), "months");
let step = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "months");
applyData = _this.FillMonths(data, len, step);
}
else if(!judgeDate[0] && judgeDate[2]){
//日不一样,且日差为等差数列,以日差为step
let step = moment(data[1]["m"]).diff(moment(data[0]["m"]), "days");
let step = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "days");
applyData = _this.FillDays(data, len, step);
}
else{
@ -1767,12 +1768,12 @@ const luckysheetDropCell = {
for(let i = 1; i <= newLen; i++){
let d = $.extend(true, {}, data[0]);
let day = moment(d["m"]).add(i, "days").day();
let day = dayjs(d["m"]).add(i, "days").day();
if(day == 0 || day == 6){
continue;
}
let date = moment(d["m"]).add(step * i, "days").format("YYYY-MM-DD");
let date = dayjs(d["m"]).add(step * i, "days").format("YYYY-MM-DD");
d["m"] = date;
d["v"] = genarate(date)[2];
applyData.push(d);
@ -1783,30 +1784,30 @@ const luckysheetDropCell = {
}
}
else if(data.length == 2){
if(moment(data[1]["m"]).date() == moment(data[0]["m"]).date() && moment(data[1]["m"]).diff(moment(data[0]["m"]), "months") != 0){
if(dayjs(data[1]["m"]).date() == dayjs(data[0]["m"]).date() && dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "months") != 0){
//日一样,且月差大于一月,以月差为step(若那天为休息日,则向前取最近的工作日)
if(direction == "up" || direction == "left"){
data.reverse();
}
let step = moment(data[1]["m"]).diff(moment(data[0]["m"]), "months");
let step = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "months");
for(let i = 1; i <= len; i++){
let index = (i - 1) % data.length;
let d = $.extend(true, {}, data[index]);
let day = moment(data[data.length - 1]).add(step * i, "months").day(),
let day = dayjs(data[data.length - 1]).add(step * i, "months").day(),
date;
if(day == 0){
date = moment(data[data.length - 1]).add(step * i, "months").subtract(2, "days").format("YYYY-MM-DD");
date = dayjs(data[data.length - 1]).add(step * i, "months").subtract(2, "days").format("YYYY-MM-DD");
}
else if(day == 6){
date = moment(data[data.length - 1]).add(step * i, "months").subtract(1, "days").format("YYYY-MM-DD");
date = dayjs(data[data.length - 1]).add(step * i, "months").subtract(1, "days").format("YYYY-MM-DD");
}
else{
date = moment(data[data.length - 1]).add(step * i, "months").format("YYYY-MM-DD");
date = dayjs(data[data.length - 1]).add(step * i, "months").format("YYYY-MM-DD");
}
d["m"] = date;
d["v"] = genarate(date)[2];
applyData.push(d);
@ -1814,7 +1815,7 @@ const luckysheetDropCell = {
}
else{
//日不一样
if(Math.abs(moment(data[1]["m"]).diff(moment(data[0]["m"]))) > 7){
if(Math.abs(dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]))) > 7){
//若日差大于7天,以一月为step(若那天是休息日,则向前取最近的工作日)
let step_month;
if(direction == "down" || direction == "right"){
@ -1832,19 +1833,19 @@ const luckysheetDropCell = {
let num = Math.ceil(i / data.length);
if(index == 0){
step = moment(d["m"]).add(step_month * num, "months").diff(moment(d["m"]), "days");
step = dayjs(d["m"]).add(step_month * num, "months").diff(dayjs(d["m"]), "days");
}
let day = moment(d["m"]).add(step, "days").day(),
let day = dayjs(d["m"]).add(step, "days").day(),
date;
if(day == 0){
date = moment(d["m"]).add(step, "days").subtract(2, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").subtract(2, "days").format("YYYY-MM-DD");
}
else if(day == 6){
date = moment(d["m"]).add(step, "days").subtract(1, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").subtract(1, "days").format("YYYY-MM-DD");
}
else{
date = moment(d["m"]).add(step, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").format("YYYY-MM-DD");
}
d["m"] = date;
@ -1870,19 +1871,19 @@ const luckysheetDropCell = {
let num = Math.ceil(i / data.length);
if(index == 0){
step = moment(d["m"]).add(step_day * num, "days").diff(moment(d["m"]), "days");
step = dayjs(d["m"]).add(step_day * num, "days").diff(dayjs(d["m"]), "days");
}
let day = moment(d["m"]).add(step, "days").day(),
let day = dayjs(d["m"]).add(step, "days").day(),
date;
if(day == 0){
date = moment(d["m"]).add(step, "days").subtract(2, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").subtract(2, "days").format("YYYY-MM-DD");
}
else if(day == 6){
date = moment(d["m"]).add(step, "days").subtract(1, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").subtract(1, "days").format("YYYY-MM-DD");
}
else{
date = moment(d["m"]).add(step, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").format("YYYY-MM-DD");
}
d["m"] = date;
@ -1900,22 +1901,22 @@ const luckysheetDropCell = {
data.reverse();
}
let step = moment(data[1]["m"]).diff(moment(data[0]["m"]), "months");
let step = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "months");
for(let i = 1; i <= len; i++){
let index = (i - 1) % data.length;
let d = $.extend(true, {}, data[index]);
let day = moment(data[data.length - 1]["m"]).add(step * i, "months").day(),
let day = dayjs(data[data.length - 1]["m"]).add(step * i, "months").day(),
date;
if(day == 0){
date = moment(data[data.length - 1]["m"]).add(step * i, "months").subtract(2, "days").format("YYYY-MM-DD");
date = dayjs(data[data.length - 1]["m"]).add(step * i, "months").subtract(2, "days").format("YYYY-MM-DD");
}
else if(day == 6){
date = moment(data[data.length - 1]["m"]).add(step * i, "months").subtract(1, "days").format("YYYY-MM-DD");
date = dayjs(data[data.length - 1]["m"]).add(step * i, "months").subtract(1, "days").format("YYYY-MM-DD");
}
else{
date = moment(data[data.length - 1]["m"]).add(step * i, "months").format("YYYY-MM-DD");
date = dayjs(data[data.length - 1]["m"]).add(step * i, "months").format("YYYY-MM-DD");
}
d["m"] = date;
@ -1925,7 +1926,7 @@ const luckysheetDropCell = {
}
else if(!judgeDate[0] && judgeDate[2]){
//日不一样,且日差为等差数列
if(Math.abs(moment(data[1]["m"]).diff(moment(data[0]["m"]))) > 7){
if(Math.abs(dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]))) > 7){
//若日差大于7天,以一月为step(若那天是休息日,则向前取最近的工作日)
let step_month
if(direction == "down" || direction == "right"){
@ -1943,19 +1944,19 @@ const luckysheetDropCell = {
let num = Math.ceil(i / data.length);
if(index == 0){
step = moment(d["m"]).add(step_month * num, "months").diff(moment(d["m"]), "days");
step = dayjs(d["m"]).add(step_month * num, "months").diff(dayjs(d["m"]), "days");
}
let day = moment(d["m"]).add(step, "days").day(),
let day = dayjs(d["m"]).add(step, "days").day(),
date;
if(day == 0){
date = moment(d["m"]).add(step, "days").subtract(2, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").subtract(2, "days").format("YYYY-MM-DD");
}
else if(day == 6){
date = moment(d["m"]).add(step, "days").subtract(1, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").subtract(1, "days").format("YYYY-MM-DD");
}
else{
date = moment(d["m"]).add(step, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").format("YYYY-MM-DD");
}
d["m"] = date;
@ -1981,19 +1982,19 @@ const luckysheetDropCell = {
let num = Math.ceil(i / data.length);
if(index == 0){
step = moment(d["m"]).add(step_day * num, "days").diff(moment(d["m"]), "days");
step = dayjs(d["m"]).add(step_day * num, "days").diff(dayjs(d["m"]), "days");
}
let day = moment(d["m"]).add(step, "days").day(),
let day = dayjs(d["m"]).add(step, "days").day(),
date;
if(day == 0){
date = moment(d["m"]).add(step, "days").subtract(2, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").subtract(2, "days").format("YYYY-MM-DD");
}
else if(day == 6){
date = moment(d["m"]).add(step, "days").subtract(1, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").subtract(1, "days").format("YYYY-MM-DD");
}
else{
date = moment(d["m"]).add(step, "days").format("YYYY-MM-DD");
date = dayjs(d["m"]).add(step, "days").format("YYYY-MM-DD");
}
d["m"] = date;
@ -2026,13 +2027,13 @@ const luckysheetDropCell = {
applyData = _this.FillMonths(data, len, step);
}
else if(data.length == 2){
if(moment(data[1]["m"]).date() == moment(data[0]["m"]).date() && moment(data[1]["m"]).diff(moment(data[0]["m"]), "months") != 0){
if(dayjs(data[1]["m"]).date() == dayjs(data[0]["m"]).date() && dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "months") != 0){
//日一样,且月差大于一月,以月差为step
if(direction == "up" || direction == "left"){
data.reverse();
}
let step = moment(data[1]["m"]).diff(moment(data[0]["m"]), "months");
let step = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "months");
applyData = _this.FillMonths(data, len, step);
}
else{
@ -2053,10 +2054,10 @@ const luckysheetDropCell = {
let num = Math.ceil(i / data.length);
if(index == 0){
step = moment(d["m"]).add(step_month * num, "months").diff(moment(d["m"]), "days");
step = dayjs(d["m"]).add(step_month * num, "months").diff(dayjs(d["m"]), "days");
}
let date = moment(d["m"]).add(step, "days").format("YYYY-MM-DD");
let date = dayjs(d["m"]).add(step, "days").format("YYYY-MM-DD");
d["m"] = date;
d["v"] = genarate(date)[2];
applyData.push(d);
@ -2071,7 +2072,7 @@ const luckysheetDropCell = {
data.reverse();
}
let step = moment(data[1]["m"]).diff(moment(data[0]["m"]), "months");
let step = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "months");
applyData = _this.FillMonths(data, len, step);
}
else if(!judgeDate[0] && judgeDate[2]){
@ -2092,10 +2093,10 @@ const luckysheetDropCell = {
let num = Math.ceil(i / data.length);
if(index == 0){
step = moment(d["m"]).add(step_month * num, "months").diff(moment(d["m"]), "days");
step = dayjs(d["m"]).add(step_month * num, "months").diff(dayjs(d["m"]), "days");
}
let date = moment(d["m"]).add(step, "days").format("YYYY-MM-DD");
let date = dayjs(d["m"]).add(step, "days").format("YYYY-MM-DD");
d["m"] = date;
d["v"] = genarate(date)[2];
applyData.push(d);
@ -2125,13 +2126,13 @@ const luckysheetDropCell = {
applyData = _this.FillYears(data, len, step);
}
else if(data.length == 2){
if(moment(data[1]["m"]).date() == moment(data[0]["m"]).date() && moment(data[1]["m"]).month() == moment(data[0]["m"]).month() && moment(data[1]["m"]).diff(moment(data[0]["m"]), "years") != 0){
if(dayjs(data[1]["m"]).date() == dayjs(data[0]["m"]).date() && dayjs(data[1]["m"]).month() == dayjs(data[0]["m"]).month() && dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "years") != 0){
//日月一样,且年差大于一年,以年差为step
if(direction == "up" || direction == "left"){
data.reverse();
}
let step = moment(data[1]["m"]).diff(moment(data[0]["m"]), "years");
let step = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "years");
applyData = _this.FillYears(data, len, step);
}
else{
@ -2152,10 +2153,10 @@ const luckysheetDropCell = {
let num = Math.ceil(i / data.length);
if(index == 0){
step = moment(d["m"]).add(step_year * num, "years").diff(moment(d["m"]), "days");
step = dayjs(d["m"]).add(step_year * num, "years").diff(dayjs(d["m"]), "days");
}
let date = moment(d["m"]).add(step, "days").format("YYYY-MM-DD");
let date = dayjs(d["m"]).add(step, "days").format("YYYY-MM-DD");
d["m"] = date;
d["v"] = genarate(date)[2];
applyData.push(d);
@ -2170,7 +2171,7 @@ const luckysheetDropCell = {
data.reverse();
}
let step = moment(data[1]["m"]).diff(moment(data[0]["m"]), "years");
let step = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "years");
applyData = _this.FillYears(data, len, step);
}
else if((judgeDate[0] && judgeDate[3]) || judgeDate[2]){
@ -2191,10 +2192,10 @@ const luckysheetDropCell = {
let num = Math.ceil(i / data.length);
if(index == 0){
step = moment(d["m"]).add(step_year * num, "years").diff(moment(d["m"]), "days");
step = dayjs(d["m"]).add(step_year * num, "years").diff(dayjs(d["m"]), "days");
}
let date = moment(d["m"]).add(step, "days").format("YYYY-MM-DD");
let date = dayjs(d["m"]).add(step, "days").format("YYYY-MM-DD");
d["m"] = date;
d["v"] = genarate(date)[2];
applyData.push(d);
@ -2243,7 +2244,7 @@ const luckysheetDropCell = {
}
}
}
return applyData;
},
FillCopy: function(data, len){
@ -2254,7 +2255,7 @@ const luckysheetDropCell = {
let d = $.extend(true, {}, data[index]);
applyData.push(d);
}
}
return applyData;
},
@ -2281,7 +2282,7 @@ const luckysheetDropCell = {
else if(direction == "up" || direction == "left"){
num = Number(data[0]["v"]) / Math.pow(Number(data[1]["v"]) / Number(data[0]["v"]), i);
}
d["v"] = num;
d["m"] = update(d["ct"]["fa"], num);
applyData.push(d);
@ -2356,9 +2357,9 @@ const luckysheetDropCell = {
delete d["v"];
applyData.push(d);
}
}
return applyData;
return applyData;
},
FillWithoutFormat: function(dataArr){
let applyData = [];
@ -2387,7 +2388,7 @@ const luckysheetDropCell = {
let d = $.extend(true, {}, data[index]);
let date = update("yyyy-MM-dd", d["v"]);
date = moment(date).add(step * i, "days").format("YYYY-MM-DD");
date = dayjs(date).add(step * i, "days").format("YYYY-MM-DD");
d["v"] = genarate(date)[2];
d["m"] = update(d["ct"]["fa"], d["v"]);
@ -2405,11 +2406,11 @@ const luckysheetDropCell = {
let d = $.extend(true, {}, data[index]);
let date = update("yyyy-MM-dd", d["v"]);
date = moment(date).add(step * i, "months").format("YYYY-MM-DD");
date = dayjs(date).add(step * i, "months").format("YYYY-MM-DD");
d["v"] = genarate(date)[2];
d["m"] = update(d["ct"]["fa"], d["v"]);
applyData.push(d);
}
@ -2423,11 +2424,11 @@ const luckysheetDropCell = {
let d = $.extend(true, {}, data[index]);
let date = update("yyyy-MM-dd", d["v"]);
date = moment(date).add(step * i, "years").format("YYYY-MM-DD");
date = dayjs(date).add(step * i, "years").format("YYYY-MM-DD");
d["v"] = genarate(date)[2];
d["m"] = update(d["ct"]["fa"], d["v"]);
applyData.push(d);
}
@ -2449,7 +2450,7 @@ const luckysheetDropCell = {
else{
num = _this.ChineseToNumber(data[data.length - 1]["m"]) + step * i;
}
if(num < 0){
num = Math.ceil(Math.abs(num) / 7) * 7 + num;
}
@ -2507,7 +2508,7 @@ const luckysheetDropCell = {
let txt = last.substr(last.length - 1, 1);
num = _this.ChineseToNumber(txt) + step * i;
}
if(num < 0){
num = Math.ceil(Math.abs(num) / 7) * 7 + num;
}
@ -2565,7 +2566,7 @@ const luckysheetDropCell = {
let txt = last.substr(last.length - 1, 1);
num = _this.ChineseToNumber(txt) + step * i;
}
if(num < 0){
num = Math.ceil(Math.abs(num) / 7) * 7 + num;
}
@ -2678,7 +2679,7 @@ const luckysheetDropCell = {
let ax = getAverage(xArr); //x数组 平均值
let ay = getAverage(yArr); //y数组 平均值
let sum_d = 0, sum_n = 0;
for(let j = 0; j < xArr.length; j++){
//分母和
@ -2700,40 +2701,40 @@ const luckysheetDropCell = {
return Math.round((a + b * x) * 100000) / 100000;
},
judgeDate: function(data){
let isSameDay = true,
isSameMonth = true,
isEqualDiffDays = true,
isEqualDiffMonths = true,
let isSameDay = true,
isSameMonth = true,
isEqualDiffDays = true,
isEqualDiffMonths = true,
isEqualDiffYears = true;
let sameDay = moment(data[0]["m"]).date(),
sameMonth = moment(data[0]["m"]).month();
let equalDiffDays = moment(data[1]["m"]).diff(moment(data[0]["m"]), "days");
let equalDiffMonths = moment(data[1]["m"]).diff(moment(data[0]["m"]), "months");
let equalDiffYears = moment(data[1]["m"]).diff(moment(data[0]["m"]), "years");
let sameDay = dayjs(data[0]["m"]).date(),
sameMonth = dayjs(data[0]["m"]).month();
let equalDiffDays = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "days");
let equalDiffMonths = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "months");
let equalDiffYears = dayjs(data[1]["m"]).diff(dayjs(data[0]["m"]), "years");
for(let i = 1; i < data.length; i++){
//日是否一样
if(moment(data[i]["m"]).date() != sameDay){
if(dayjs(data[i]["m"]).date() != sameDay){
isSameDay = false;
}
//月是否一样
if(moment(data[i]["m"]).month() != sameMonth){
if(dayjs(data[i]["m"]).month() != sameMonth){
isSameMonth = false;
}
//日差是否是 等差数列
if(moment(data[i]["m"]).diff(moment(data[i - 1]["m"]), "days") != equalDiffDays){
if(dayjs(data[i]["m"]).diff(dayjs(data[i - 1]["m"]), "days") != equalDiffDays){
isEqualDiffDays = false;
}
//月差是否是 等差数列
if(moment(data[i]["m"]).diff(moment(data[i - 1]["m"]), "months") != equalDiffMonths){
if(dayjs(data[i]["m"]).diff(dayjs(data[i - 1]["m"]), "months") != equalDiffMonths){
isEqualDiffMonths = false;
}
//年差是否是 等差数列
if(moment(data[i]["m"]).diff(moment(data[i - 1]["m"]), "years") != equalDiffYears){
if(dayjs(data[i]["m"]).diff(dayjs(data[i - 1]["m"]), "years") != equalDiffYears){
isEqualDiffYears = false;
}
}
if(equalDiffDays == 0){
isEqualDiffDays = false;
}
@ -2748,4 +2749,4 @@ const luckysheetDropCell = {
}
}
export default luckysheetDropCell;
export default luckysheetDropCell;

13
src/controllers/server.js

@ -11,6 +11,7 @@ import { getObjType, replaceHtml, getByteLen } from '../utils/util';
import { getSheetIndex } from '../methods/get';
import Store from '../store';
import locale from '../locale/locale';
import dayjs from "dayjs";
const server = {
gridKey: null,
@ -762,12 +763,12 @@ const server = {
let _this = this;
clearTimeout(_this.requestTimeOut);
//console.log(_this.requestlast, moment(), (_this.requestlast!=null && _this.requestlast.add(10, 'seconds').isBefore(moment()) ) );
if(!_this.requestLock && (_this.requestlast!=null && _this.requestlast.clone().add(1, 'seconds').isBefore(moment()) ) ){
//console.log(_this.requestlast, dayjs(), (_this.requestlast!=null && _this.requestlast.add(10, 'seconds').isBefore(dayjs()) ) );
if(!_this.requestLock && (_this.requestlast!=null && _this.requestlast.clone().add(1, 'seconds').isBefore(dayjs()) ) ){
_this.request();
}
// if(!_this.imageRequestLock && (_this.imageRequestLast==null || _this.imageRequestLast.clone().add(30, 'seconds').isBefore(moment()) ) ){
// if(!_this.imageRequestLock && (_this.imageRequestLast==null || _this.imageRequestLast.clone().add(30, 'seconds').isBefore(dayjs()) ) ){
// }
@ -804,7 +805,7 @@ const server = {
$.post(_this.updateUrl, { compress: iscommpress, gridKey: _this.gridKey, data: params }, function (data) {
let re = eval('('+ data +')')
if(re.status){
$("#luckysheet_info_detail_update").html("最近存档时间:"+ moment().format("M-D H:m:s"));
$("#luckysheet_info_detail_update").html("最近存档时间:"+ dayjs().format("M-D H:m:s"));
$("#luckysheet_info_detail_save").html("同步成功");
_this.clearcachelocaldata();
}
@ -812,7 +813,7 @@ const server = {
$("#luckysheet_info_detail_save").html("<span style='color:#ff2121'>同步失败</span>");
_this.restorecachelocaldata();
}
_this.requestlast = moment();
_this.requestlast = dayjs();
_this.requestLock = false;
});
}
@ -864,7 +865,7 @@ const server = {
$.post(_this.updateImageUrl, { compress: false, gridKey: _this.gridKey, data:data1 }, function (data) {
let re = eval('('+ data +')')
if(re.status){
imageRequestLast = moment();
imageRequestLast = dayjs();
}
else{
$("#luckysheet_info_detail_save").html("<span style='color:#ff2121'>网络不稳定</span>");

3613
src/function/functionImplementation.js

File diff suppressed because it is too large

530
src/global/api.js

File diff suppressed because it is too large

9
src/global/datecontroll.js

@ -1,4 +1,5 @@
import { hasChinaword } from './validate';
import dayjs from 'dayjs'
function isdatetime(s) {
if (s == null || s.toString().length < 5) {
@ -49,7 +50,7 @@ function isdatetime(s) {
}
function diff(now, then) {
return moment(now).diff(moment(then));
return dayjs(now).diff(dayjs(then));
}
function isdatatypemulti(s) {
@ -68,14 +69,14 @@ function isdatatypemulti(s) {
function isdatatype(s) {
let type = "string";
if (isdatetime(s)) {
type = "date";
}
else if (!isNaN(parseFloat(s)) && !hasChinaword(s)) {
type = "num";
}
return type;
}
@ -84,4 +85,4 @@ export {
diff,
isdatatypemulti,
isdatatype,
}
}

83
src/global/func_methods.js

@ -2,6 +2,7 @@ import { getObjType } from '../utils/util';
import { isRealNum, isRealNull, valueIsError } from './validate';
import { update } from './format';
import formula from './formula';
import dayjs from "dayjs";
const error = {
v: "#VALUE!", //错误的参数或运算符
@ -170,7 +171,7 @@ const func_methods = {
}
dataArr.push(arr[i]);
}
}
}
return dataArr;
@ -194,7 +195,7 @@ const func_methods = {
for(let i = 0; i < arr.length; i++){
rowArr.push(arr[i]);
}
}
dataArr.push(rowArr);
}
@ -341,7 +342,7 @@ const func_methods = {
}
if(getObjType(cumulative) == "boolean"){
}
else if(getObjType(cumulative) == "string" && (cumulative.toLowerCase() == "true" || cumulative.toLowerCase() == "false")){
if(cumulative.toLowerCase() == "true"){
@ -455,21 +456,21 @@ const func_methods = {
},
//阶乘
factorial: function(num){
if (num == 0 || num == 1) {
return 1;
}
else {
return (num * this.factorial(num - 1));
}
if (num == 0 || num == 1) {
return 1;
}
else {
return (num * this.factorial(num - 1));
}
},
//双阶乘
factorialDouble: function(num){
if (num <= 0) {
return 1;
}
else {
return (num * this.factorialDouble(num - 2));
}
if (num <= 0) {
return 1;
}
else {
return (num * this.factorialDouble(num - 2));
}
},
//总体方差
variance: function(num_arr){
@ -488,7 +489,7 @@ const func_methods = {
for(let j = 0; j < num_arr.length; j++){
let number = num_arr[j];
sum_variance += (number - avg) * (number - avg);
}
@ -511,7 +512,7 @@ const func_methods = {
for(let j = 0; j < num_arr.length; j++){
let number = num_arr[j];
sum_variance += (number - avg) * (number - avg);
}
@ -534,7 +535,7 @@ const func_methods = {
for(let j = 0; j < num_arr.length; j++){
let number = num_arr[j];
sum_variance += (number - avg) * (number - avg);
}
@ -557,7 +558,7 @@ const func_methods = {
for(let j = 0; j < num_arr.length; j++){
let number = num_arr[j];
sum_variance += (number - avg) * (number - avg);
}
@ -571,22 +572,22 @@ const func_methods = {
feb29Between: function(date1, date2){
let _this = this;
let year1 = moment(date1).year();
let mar1year1 = moment().set({ 'year': year1, 'month': 2, 'date': 1 });
let year1 = dayjs(date1).year();
let mar1year1 = dayjs().set({ 'year': year1, 'month': 2, 'date': 1 });
if (_this.isLeapYear(year1) && moment(date1) < moment(mar1year1) && moment(date2) >= moment(mar1year1)) {
if (_this.isLeapYear(year1) && dayjs(date1) < dayjs(mar1year1) && dayjs(date2) >= dayjs(mar1year1)) {
return true;
}
let year2 = moment(date2).year();
let mar1year2 = moment().set({ 'year': year2, 'month': 2, 'date': 1 });
return (_this.isLeapYear(year2) && moment(date2) >= moment(mar1year2) && moment(date1) < moment(mar1year2));
let year2 = dayjs(date2).year();
let mar1year2 = dayjs().set({ 'year': year2, 'month': 2, 'date': 1 });
return (_this.isLeapYear(year2) && dayjs(date2) >= dayjs(mar1year2) && dayjs(date1) < dayjs(mar1year2));
},
//SQL 查询
findResultIndex: function(database, criterias){
let matches = {};
for (let i = 1; i < database[0].length; ++i) {
matches[i] = true;
}
@ -637,12 +638,12 @@ const func_methods = {
result.push(n - 1);
}
}
return result;
},
findField: function(database, title){
let index = null;
for (let i = 0; i < database.length; i++) {
if (database[i][0] == title) {
index = i;
@ -653,35 +654,35 @@ const func_methods = {
if (index == null) {
return error.v;
}
return index;
},
rest: function(array, idx){
idx = idx || 1;
if (!array || typeof array.slice !== 'function') {
return array;
}
return array.slice(idx);
},
compact: function(array){
if (!array) {
return array;
if (!array) {
return array;
}
let result = [];
for (let i = 0; i < array.length; ++i) {
if (!array[i]) {
continue;
if (!array[i]) {
continue;
}
result.push(array[i]);
}
return result;
}
}
export default func_methods;
export default func_methods;

421
src/plugins/css/daterangepicker.css

@ -1,421 +0,0 @@
.daterangepicker {
display: none;
position: absolute;
color: inherit;
background: #fff;
border-radius: 4px;
width: 278px;
padding: 4px;
margin-top: 1px;
top: 100px;
left: 20px;
padding-bottom: 50px;
font-size: 14px;
border: 1px solid rgba(0,0,0,.15);
}
.daterangepicker table{
border-collapse: collapse;
border-spacing: 0;
}
.daterangepicker table td,.daterangepicker table th{
padding: 5px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.daterangepicker:before, .daterangepicker:after {
position: absolute;
display: inline-block;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker:before {
top: -7px;
border-right: 7px solid transparent;
border-left: 7px solid transparent;
border-bottom: 7px solid #ccc;
}
.daterangepicker:after {
top: -6px;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
}
.daterangepicker.opensleft:before {
right: 9px;
}
.daterangepicker.opensleft:after {
right: 10px;
}
.daterangepicker.openscenter:before {
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
}
.daterangepicker.openscenter:after {
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
}
.daterangepicker.opensright:before {
left: 9px;
}
.daterangepicker.opensright:after {
left: 10px;
}
.daterangepicker.dropup {
margin-top: -5px;
}
.daterangepicker.dropup:before {
top: initial;
bottom: -7px;
border-bottom: initial;
border-top: 7px solid #ccc;
}
.daterangepicker.dropup:after {
top: initial;
bottom: -6px;
border-bottom: initial;
border-top: 6px solid #fff;
}
.daterangepicker.dropdown-menu {
max-width: none;
z-index: 1000000;
}
.daterangepicker.single .ranges, .daterangepicker.single .calendar {
float: none;
}
.daterangepicker.show-calendar .calendar {
display: block;
}
.daterangepicker .calendar {
display: block;
max-width: 270px;
margin: 4px;
margin-top: -30px;
}
.daterangepicker .calendar.single .calendar-table {
border: none;
}
.daterangepicker .calendar th, .daterangepicker .calendar td {
white-space: nowrap;
text-align: center;
min-width: 32px;
}
.daterangepicker .calendar-table {
border: 1px solid #fff;
padding: 4px;
border-radius: 4px;
background: #fff;
}
.daterangepicker table {
width: 100%;
margin: 0;
}
.daterangepicker td, .daterangepicker th {
text-align: center;
width: 20px;
height: 20px;
line-height: 20px;
border-radius: 4px;
border: 1px solid transparent;
white-space: nowrap;
cursor: pointer;
}
.daterangepicker td.available:hover, .daterangepicker th.available:hover {
background: #eee;
}
.daterangepicker td.week, .daterangepicker th.week {
font-size: 80%;
color: #ccc;
}
.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date {
background-color: #fff;
border-color: transparent;
color: #999;
}
.daterangepicker td.in-range {
background-color: #d9e3ff;
border-color: transparent;
color: #000;
border-radius: 0;
}
.daterangepicker td.start-date {
border-radius: 4px 0 0 4px;
}
.daterangepicker td.end-date {
border-radius: 0 4px 4px 0;
}
.daterangepicker td.start-date.end-date {
border-radius: 4px;
}
.daterangepicker td.active, .daterangepicker td.active:hover {
background-color: #477cff;
border-color: transparent;
color: #fff;
}
.daterangepicker th.month {
width: auto;
}
.daterangepicker td.disabled, .daterangepicker option.disabled {
color: #999;
cursor: not-allowed;
text-decoration: line-through;
}
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
font-size: 12px;
padding: 1px;
height: auto;
margin: 0;
cursor: default;
vertical-align: top;
}
.daterangepicker select.monthselect {
margin-right: 2%;
width: 56%;
}
.daterangepicker select.yearselect {
width: 40%;
}
.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect {
width: 50px;
margin-bottom: 0;
}
.daterangepicker .input-mini {
border: 1px solid #ccc;
border-radius: 4px;
color: #555;
height: 30px;
line-height: 30px;
display: block;
vertical-align: middle;
margin: 0 0 5px 0;
padding: 0 6px 0 0px;
width: 100%;
}
.daterangepicker .input-mini.active {
/*border: 1px solid #08c;
border-radius: 4px; */
}
.daterangepicker .daterangepicker_input {
position: relative;
}
.daterangepicker .daterangepicker_input input{
border:0;
color: #477cff;
}
.daterangepicker .daterangepicker_input i {
position: absolute;
left: 8px;
top: 8px;
}
.daterangepicker .calendar-time {
text-align: center;
margin: 5px auto;
line-height: 30px;
position: relative;
padding-left: 28px;
}
.daterangepicker .calendar-time select.disabled {
color: #ccc;
cursor: not-allowed;
}
.ranges {
font-size: 11px;
float: none;
margin: 4px;
text-align: left;
border-right: 1px solid #efeff0;
margin-right: 15px;
}
.ranges ul {
list-style: none;
margin: 0 auto;
padding: 0;
width: 100%;
}
.ranges li {
font-size: 12px;
/*background: #f5f5f5;*/
/*border: 1px solid #f5f5f5;*/
/*border-radius: 4px;*/
color: #72777a;
padding: 3px 12px;
height: 20px;
line-height: 14px;
margin-bottom: 8px;
cursor: pointer;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.ranges li:hover {
/*background: #08c;
border: 1px solid #08c;*/
color: #6072FF;
}
.ranges li.active {
/*background: #08c;*/
border: 1px solid #efeff0;
color: #477cff;
}
@media (min-width: 564px) {
.daterangepicker {
width: auto;
}
.daterangepicker .ranges ul {
width: 120px;
}
.daterangepicker.single .ranges ul {
width: 100%;
}
.daterangepicker.single .calendar.left {
clear: none;
}
.daterangepicker.single .ranges, .daterangepicker.single .calendar {
float: left;
}
.daterangepicker .calendar.left {
clear: left;
margin-right: 0;
}
.daterangepicker .calendar.left .calendar-table {
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.daterangepicker .calendar.right {
margin-left: 0;
}
.daterangepicker .calendar.right .calendar-table {
border-left: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.daterangepicker .left .daterangepicker_input {
padding-right: 12px;
}
.daterangepicker .calendar.left .calendar-table {
padding-right: 12px;
}
.daterangepicker .ranges, .daterangepicker .calendar {
float: left;
}
}
@media (min-width: 730px){
.daterangepicker .ranges {
width: auto;
float: left;
}
.daterangepicker .calendar.left {
clear: none;
}
}
.applyBtn,.cancelBtn{
padding: 0;
width: 60px;
height: 28px !important;
font-size: 12px;
}
.applyBtn{
border-color: #2196f3;
background-color: #2196f3;
color: #fff;
}
.cancelBtn{
background: #ffffff;
color: #666 !important;
border: 1px solid #d9dbdc;
}
.applyBtn:hover{
border-color: #2196f3 !important;
background-color: #2196f3 !important;
color: #fff !important;
}
.cancelBtn:hover{
background: #ffffff !important;
color: #666 !important;
border: 1px solid #d9dbdc !important;
}
.ranges_1 ul {
display: none;
}
.ranges_1 .range_inputs {
position: absolute;
bottom: 0;
margin-bottom: 15px;
right: 60px;
}
.calendar_1 {
position: absolute;
right: 340px;
bottom: 4px;
width: 125px;
}
.calendar_2 {
position: absolute;
right: 238px;
bottom: 4px;
width: 125px;
}
.line_date {
width: 100%;
height: 1px;
border-bottom: 1px solid #efeff0;
position: absolute;
bottom: 53px;
right: 0;
}
.line_date_2 {
width: 7px;
height: 1px;
border-bottom: 1px solid #477cff;
position: absolute;
bottom: 28px;
right: 380px;
}
.daterangepicker .all{
position: absolute;
bottom: 14px;
right: 282px;
width: 188px;
height: 30px;
line-height: 30px;
background-color: #ffffff;
color: #477cff;
display: none;
}
.daterangepicker .prev {
position: relative;
left: 33px;
}
.daterangepicker .next {
position: relative;
right: 33px;
}
.prev_year,.prev_month{
width: 30px;
height:30px;
position: relative;
display: inline-block;
line-height: 30px;
text-align: center;
}
.prev_year:hover,.prev_month:hover{
background: #eeeeee;
cursor: pointer;
}
.prev_year i,.prev_month i{
font-size: 16px;
color: #000;
}
.prev_year{
left: 15px;
top: 36px;
}
.prev_month{
left: 191px;
top: 36px;
}

97
src/plugins/js/moment-msdate.js

@ -1,97 +0,0 @@
'use strict';
(function(root, factory) {
/*global define*/
if (typeof define === 'function' && define.amd) {
define(['moment', 'moment-timezone'], factory); // AMD
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(require('moment'), require('moment-timezone')); // Node
} else {
factory(root.moment, root.moment.tz); // Browser
}
}(this, function(moment, momentTimezone) {
var MINUTE_MILLISECONDS = 60 * 1000;
var DAY_MILLISECONDS = 86400000;
var MS_DAY_OFFSET = 25569;
var momentVersion = moment.version.split('.');
var major = +momentVersion[0];
var minor = +momentVersion[1];
if (major < 2 || (major === 2 && minor < 6)) {
throw new Error('moment-msdate requires Moment.js >= 2.6.0. You are using Moment.js ${moment.version}. See momentjs.com');
}
if (!momentTimezone || !moment.tz) {
throw new Error('moment-msdate requires moment-timezone.js. see momentjs.com/timezone');
}
var oaDateToTicks = function(oaDate) {
return ((oaDate - MS_DAY_OFFSET) * DAY_MILLISECONDS) + (oaDate >= 0.0 ? 0.5 : -0.5);
};
var ticksToOADate = function(ticks) {
return (ticks / DAY_MILLISECONDS) + MS_DAY_OFFSET;
};
/**
* @description takes an oaDate that is not in utc and converts it to a utc moment offset by a number of minutes
*
* @param {double} oaDate
* @param {string} offsetToUtcInMinutes
* @returns moment
*/
var fromOADateOffsetToUtcByMinutes = function(oaDate, offsetToUtcInMinutes) {
var offsetInTicks = offsetToUtcInMinutes * MINUTE_MILLISECONDS;
var ticks = oaDateToTicks(oaDate);
return moment(ticks + offsetInTicks).utc();
};
/**
* @description takes an oaDate that is not in utc and converts it to a utc moment offset by the specified timezone
*
* @param {double} oaDate
* @param {string} timezone
* @returns moment
*/
var fromOADateOffsetToUtcByTimezone = function(oaDate, timezone) {
if (!moment.tz.zone(timezone)) { throw new Error('timezone provided is not available in moment-timezone.js', 'moment-msdate.js', 59); }
var ticks = oaDateToTicks(oaDate);
var offset = moment(ticks).tz(timezone).utcOffset() * MINUTE_MILLISECONDS;
return moment.tz(ticks - offset, timezone).utc();
};
/**
* @description takes an oaDate that is in utc and converts it to a utc moment or takes an oaDate and an offset to utc and converts it to a utc moment. The offset can be an int representing the offset to utc in minutes or a string indicating the timezone of the oaDate.
*
* @param {double} oaDate
* @param {string=} {int=} offset
* @returns moment
*/
moment.fromOADate = function(oaDate, offset) {
if (isNaN(parseInt(oaDate, 10))) { throw new TypeError('fromOADate requires an oaDate that is not null or undefined', 'moment-msdate.js', 72); }
/* no offset */
if (!offset) { return fromOADateOffsetToUtcByMinutes(oaDate, 0); }
/* timezone */
var parsedOffset = parseInt(offset, 10);
if (isNaN(parsedOffset)) { return fromOADateOffsetToUtcByTimezone(oaDate, offset); }
/* minutes */
return fromOADateOffsetToUtcByMinutes(oaDate, parsedOffset);
};
/**
* @description converts a moment to a UTC OLE automation date represented as a double
*
* @returns {double}
*/
moment.fn.toOADate = function() {
var milliseconds = this.valueOf();
return ticksToOADate(milliseconds);
};
return moment;
}));

1
src/plugins/js/moment-timezone-with-data.min.js

File diff suppressed because one or more lines are too long

7
src/plugins/js/moment.min.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save