sdy-gantt 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ (function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["sdy-gantt"]=t():e["sdy-gantt"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s="fb15")}({"24fb":function(e,t,r){"use strict";function n(e,t){var r=e[1]||"",n=e[3];if(!n)return r;if(t&&"function"===typeof btoa){var s=a(n),i=n.sources.map((function(e){return"/*# sourceURL=".concat(n.sourceRoot||"").concat(e," */")}));return[r].concat(i).concat([s]).join("\n")}return[r].join("\n")}function a(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(t);return"/*# ".concat(r," */")}e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=n(t,e);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"===typeof e&&(e=[[null,e,""]]);var a={};if(n)for(var s=0;s<this.length;s++){var i=this[s][0];null!=i&&(a[i]=!0)}for(var o=0;o<e.length;o++){var c=[].concat(e[o]);n&&a[c[0]]||(r&&(c[2]?c[2]="".concat(r," and ").concat(c[2]):c[2]=r),t.push(c))}},t}},"2c63":function(e,t,r){var n=r("7636");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);var a=r("499e").default;a("3e5a16fe",n,!0,{sourceMap:!1,shadowMode:!1})},"499e":function(e,t,r){"use strict";function n(e,t){for(var r=[],n={},a=0;a<t.length;a++){var s=t[a],i=s[0],o=s[1],c=s[2],d=s[3],l={id:e+":"+a,css:o,media:c,sourceMap:d};n[i]?n[i].parts.push(l):r.push(n[i]={id:i,parts:[l]})}return r}r.r(t),r.d(t,"default",(function(){return p}));var a="undefined"!==typeof document;if("undefined"!==typeof DEBUG&&DEBUG&&!a)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var s={},i=a&&(document.head||document.getElementsByTagName("head")[0]),o=null,c=0,d=!1,l=function(){},u=null,f="data-vue-ssr-id",h="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function p(e,t,r,a){d=r,u=a||{};var i=n(e,t);return v(i),function(t){for(var r=[],a=0;a<i.length;a++){var o=i[a],c=s[o.id];c.refs--,r.push(c)}t?(i=n(e,t),v(i)):i=[];for(a=0;a<r.length;a++){c=r[a];if(0===c.refs){for(var d=0;d<c.parts.length;d++)c.parts[d]();delete s[c.id]}}}}function v(e){for(var t=0;t<e.length;t++){var r=e[t],n=s[r.id];if(n){n.refs++;for(var a=0;a<n.parts.length;a++)n.parts[a](r.parts[a]);for(;a<r.parts.length;a++)n.parts.push(g(r.parts[a]));n.parts.length>r.parts.length&&(n.parts.length=r.parts.length)}else{var i=[];for(a=0;a<r.parts.length;a++)i.push(g(r.parts[a]));s[r.id]={id:r.id,refs:1,parts:i}}}}function b(){var e=document.createElement("style");return e.type="text/css",i.appendChild(e),e}function g(e){var t,r,n=document.querySelector("style["+f+'~="'+e.id+'"]');if(n){if(d)return l;n.parentNode.removeChild(n)}if(h){var a=c++;n=o||(o=b()),t=x.bind(null,n,a,!1),r=x.bind(null,n,a,!0)}else n=b(),t=m.bind(null,n),r=function(){n.parentNode.removeChild(n)};return t(e),function(n){if(n){if(n.css===e.css&&n.media===e.media&&n.sourceMap===e.sourceMap)return;t(e=n)}else r()}}var y=function(){var e=[];return function(t,r){return e[t]=r,e.filter(Boolean).join("\n")}}();function x(e,t,r,n){var a=r?"":n.css;if(e.styleSheet)e.styleSheet.cssText=y(t,a);else{var s=document.createTextNode(a),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(s,i[t]):e.appendChild(s)}}function m(e,t){var r=t.css,n=t.media,a=t.sourceMap;if(n&&e.setAttribute("media",n),u.ssrId&&e.setAttribute(f,t.id),a&&(r+="\n/*# sourceURL="+a.sources[0]+" */",r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),e.styleSheet)e.styleSheet.cssText=r;else{while(e.firstChild)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}},"5a0c":function(e,t,r){!function(t,r){e.exports=r()}(0,(function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",a="second",s="minute",i="hour",o="day",c="week",d="month",l="quarter",u="year",f="date",h="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}},g=function(e,t,r){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(r)+e},y={s:g,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),a=r%60;return(t<=0?"+":"-")+g(n,2,"0")+":"+g(a,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var n=12*(r.year()-t.year())+(r.month()-t.month()),a=t.clone().add(n,d),s=r-a<0,i=t.clone().add(n+(s?-1:1),d);return+(-(n+(r-a)/(s?a-i:i-a))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:d,y:u,w:c,d:o,D:f,h:i,m:s,s:a,ms:n,Q:l}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},x="en",m={};m[x]=b;var w="$isDayjsObject",$=function(e){return e instanceof M||!(!e||!e[w])},k=function e(t,r,n){var a;if(!t)return x;if("string"==typeof t){var s=t.toLowerCase();m[s]&&(a=s),r&&(m[s]=r,a=s);var i=t.split("-");if(!a&&i.length>1)return e(i[0])}else{var o=t.name;m[o]=t,a=o}return!n&&a&&(x=a),a||!n&&x},D=function(e,t){if($(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new M(r)},S=y;S.l=k,S.i=$,S.w=function(e,t){return D(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var M=function(){function b(e){this.$L=k(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[w]=!0}var g=b.prototype;return g.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(S.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(p);if(n){var a=n[2]-1||0,s=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],a,n[3]||1,n[4]||0,n[5]||0,n[6]||0,s)):new Date(n[1],a,n[3]||1,n[4]||0,n[5]||0,n[6]||0,s)}}return new Date(t)}(e),this.init()},g.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},g.$utils=function(){return S},g.isValid=function(){return!(this.$d.toString()===h)},g.isSame=function(e,t){var r=D(e);return this.startOf(t)<=r&&r<=this.endOf(t)},g.isAfter=function(e,t){return D(e)<this.startOf(t)},g.isBefore=function(e,t){return this.endOf(t)<D(e)},g.$g=function(e,t,r){return S.u(e)?this[t]:this.set(r,e)},g.unix=function(){return Math.floor(this.valueOf()/1e3)},g.valueOf=function(){return this.$d.getTime()},g.startOf=function(e,t){var r=this,n=!!S.u(t)||t,l=S.p(e),h=function(e,t){var a=S.w(r.$u?Date.UTC(r.$y,t,e):new Date(r.$y,t,e),r);return n?a:a.endOf(o)},p=function(e,t){return S.w(r.toDate()[e].apply(r.toDate("s"),(n?[0,0,0,0]:[23,59,59,999]).slice(t)),r)},v=this.$W,b=this.$M,g=this.$D,y="set"+(this.$u?"UTC":"");switch(l){case u:return n?h(1,0):h(31,11);case d:return n?h(1,b):h(0,b+1);case c:var x=this.$locale().weekStart||0,m=(v<x?v+7:v)-x;return h(n?g-m:g+(6-m),b);case o:case f:return p(y+"Hours",0);case i:return p(y+"Minutes",1);case s:return p(y+"Seconds",2);case a:return p(y+"Milliseconds",3);default:return this.clone()}},g.endOf=function(e){return this.startOf(e,!1)},g.$set=function(e,t){var r,c=S.p(e),l="set"+(this.$u?"UTC":""),h=(r={},r[o]=l+"Date",r[f]=l+"Date",r[d]=l+"Month",r[u]=l+"FullYear",r[i]=l+"Hours",r[s]=l+"Minutes",r[a]=l+"Seconds",r[n]=l+"Milliseconds",r)[c],p=c===o?this.$D+(t-this.$W):t;if(c===d||c===u){var v=this.clone().set(f,1);v.$d[h](p),v.init(),this.$d=v.set(f,Math.min(this.$D,v.daysInMonth())).$d}else h&&this.$d[h](p);return this.init(),this},g.set=function(e,t){return this.clone().$set(e,t)},g.get=function(e){return this[S.p(e)]()},g.add=function(n,l){var f,h=this;n=Number(n);var p=S.p(l),v=function(e){var t=D(h);return S.w(t.date(t.date()+Math.round(e*n)),h)};if(p===d)return this.set(d,this.$M+n);if(p===u)return this.set(u,this.$y+n);if(p===o)return v(1);if(p===c)return v(7);var b=(f={},f[s]=t,f[i]=r,f[a]=e,f)[p]||1,g=this.$d.getTime()+n*b;return S.w(g,this)},g.subtract=function(e,t){return this.add(-1*e,t)},g.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||h;var n=e||"YYYY-MM-DDTHH:mm:ssZ",a=S.z(this),s=this.$H,i=this.$m,o=this.$M,c=r.weekdays,d=r.months,l=r.meridiem,u=function(e,r,a,s){return e&&(e[r]||e(t,n))||a[r].slice(0,s)},f=function(e){return S.s(s%12||12,e,"0")},p=l||function(e,t,r){var n=e<12?"AM":"PM";return r?n.toLowerCase():n};return n.replace(v,(function(e,n){return n||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return S.s(t.$y,4,"0");case"M":return o+1;case"MM":return S.s(o+1,2,"0");case"MMM":return u(r.monthsShort,o,d,3);case"MMMM":return u(d,o);case"D":return t.$D;case"DD":return S.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return u(r.weekdaysMin,t.$W,c,2);case"ddd":return u(r.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(s);case"HH":return S.s(s,2,"0");case"h":return f(1);case"hh":return f(2);case"a":return p(s,i,!0);case"A":return p(s,i,!1);case"m":return String(i);case"mm":return S.s(i,2,"0");case"s":return String(t.$s);case"ss":return S.s(t.$s,2,"0");case"SSS":return S.s(t.$ms,3,"0");case"Z":return a}return null}(e)||a.replace(":","")}))},g.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},g.diff=function(n,f,h){var p,v=this,b=S.p(f),g=D(n),y=(g.utcOffset()-this.utcOffset())*t,x=this-g,m=function(){return S.m(v,g)};switch(b){case u:p=m()/12;break;case d:p=m();break;case l:p=m()/3;break;case c:p=(x-y)/6048e5;break;case o:p=(x-y)/864e5;break;case i:p=x/r;break;case s:p=x/t;break;case a:p=x/e;break;default:p=x}return h?p:S.a(p)},g.daysInMonth=function(){return this.endOf(d).$D},g.$locale=function(){return m[this.$L]},g.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),n=k(e,t,!0);return n&&(r.$L=n),r},g.clone=function(){return S.w(this.$d,this)},g.toDate=function(){return new Date(this.valueOf())},g.toJSON=function(){return this.isValid()?this.toISOString():null},g.toISOString=function(){return this.$d.toISOString()},g.toString=function(){return this.$d.toUTCString()},b}(),_=M.prototype;return D.prototype=_,[["$ms",n],["$s",a],["$m",s],["$H",i],["$W",o],["$M",d],["$y",u],["$D",f]].forEach((function(e){_[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),D.extend=function(e,t){return e.$i||(e(t,M,D),e.$i=!0),D},D.locale=k,D.isDayjs=$,D.unix=function(e){return D(1e3*e)},D.en=m[x],D.Ls=m,D.p={},D}))},7636:function(e,t,r){var n=r("24fb");t=n(!1),t.push([e.i,".schedule-card[data-v-72a2d2e2]{padding:14px 20px;border:1px solid #dcdee2;border-color:#e8eaec;display:block;background:#fff;border-radius:4px;font-size:14px;position:relative;transition:all .2s ease-in-out}.schedule-card .table-outer-container[data-v-72a2d2e2]{border:1px solid #ddd;border-radius:4px;overflow:hidden;background:#fff;position:relative}.schedule-card .table-outer-container .fixed-left-bar[data-v-72a2d2e2]{position:absolute;top:2px;bottom:15px;left:0;width:190px;background:#fff;z-index:100;-webkit-user-select:none;user-select:none;-moz-user-select:none}.schedule-card .blank-tip[data-v-72a2d2e2]{display:flex;align-items:center;justify-content:center;min-height:455px;border-right:1px solid #dcdee2;text-align:center;color:#999;font-size:12px}.schedule-card .table-scroll-container[data-v-72a2d2e2]{display:flex;flex-direction:column;overflow-x:auto;overflow-y:visible}.schedule-card .table-scroll-container[data-v-72a2d2e2]::-webkit-scrollbar{width:6px;height:6px}.schedule-card .table-scroll-container[data-v-72a2d2e2]::-webkit-scrollbar-thumb{background:#cccdce}.schedule-card .table-scroll-container[data-v-72a2d2e2]::-webkit-scrollbar-track{background:#fff}.schedule-card .table-header-row[data-v-72a2d2e2]{display:flex;background-color:#eef3ff;border-bottom:2px solid #ebebeb;position:sticky;top:0;z-index:10;-webkit-user-select:none;user-select:none;-moz-user-select:none}.schedule-card .header-cell[data-v-72a2d2e2]{width:190px;flex-shrink:0;padding:12px 8px;border-right:1px solid #ebebeb;font-weight:700;text-align:center;white-space:nowrap}.schedule-card .fixed-person-header[data-v-72a2d2e2]{width:190px;background-color:#d3e0ff;z-index:11;position:sticky;left:0}.schedule-card .scroll-date-header[data-v-72a2d2e2]{width:190px;line-height:43px;flex-shrink:0;background-color:#d3e0ff;border-right:1px solid #ebebeb}.schedule-card .scroll-date-header[data-v-72a2d2e2]::-moz-selection{background:#d3e0ff;color:#515a6e}.schedule-card .scroll-date-header[data-v-72a2d2e2]::selection{background:#d3e0ff;color:#515a6e}.schedule-card .scroll-date-header[data-v-72a2d2e2]:last-child{border-right:none}.schedule-card .table-body-rows[data-v-72a2d2e2]{display:flex;flex-direction:column}.schedule-card .table-person-row[data-v-72a2d2e2]{display:flex;overflow:visible}.schedule-card .body-cell[data-v-72a2d2e2]{width:190px;flex-shrink:0;padding:10px 8px;border-right:1px solid #ebebeb;border-bottom:1px solid #ebebeb;white-space:nowrap;vertical-align:top;position:relative}.schedule-card .fixed-person-cell[data-v-72a2d2e2]{width:190px;flex-shrink:0;background-color:#eef3ff;font-weight:500;line-height:1.3;z-index:5;position:sticky;left:0}.schedule-card .fixed-person-cell[data-v-72a2d2e2]:hover{background-color:#d3e0ff}.schedule-card .scroll-date-cell[data-v-72a2d2e2]{width:190px;flex-shrink:0;padding:2px 0;position:relative;vertical-align:top}.schedule-card .task-item[data-v-72a2d2e2]{height:auto;line-height:18px;font-size:12px}.schedule-card .stacked-task[data-v-72a2d2e2]{padding:2px 6px;border-radius:5px;color:#fff;width:100%;box-sizing:border-box;text-align:left;position:absolute;left:0;white-space:pre-line;word-break:break-all;cursor:pointer}.schedule-card .stacked-task[data-v-72a2d2e2]:hover{opacity:.9}.schedule-card .no-task[data-v-72a2d2e2]{color:#999;font-style:italic;font-size:12px;text-align:center;padding:15px 5px;color:#ccc;font-size:10px}.schedule-card .cross-day-track[data-v-72a2d2e2]{position:relative;z-index:20;height:0;pointer-events:none}.schedule-card .cross-day-bar[data-v-72a2d2e2]{position:absolute;height:auto;line-height:18px;font-size:12px;padding:2px 6px;border-radius:5px;color:#fff;word-break:break-all;white-space:pre-line;pointer-events:auto;cursor:pointer}.schedule-card .cross-day-bar[data-v-72a2d2e2]:hover{opacity:.9}.schedule-card .page-col[data-v-72a2d2e2]{margin:10px 0;text-align:center}.schedule-card .scroll-box-list[data-v-72a2d2e2]{overflow-x:visible;overflow-y:auto;max-height:674px}@media (max-width:768px){.scroll-date-cell[data-v-72a2d2e2],.scroll-date-header[data-v-72a2d2e2]{width:190px}.fixed-person-cell[data-v-72a2d2e2],.fixed-person-header[data-v-72a2d2e2]{width:190px;font-size:12px}}",""]),e.exports=t},b375:function(e,t,r){!function(t,r){e.exports=r()}(0,(function(){"use strict";return function(e,t){t.prototype.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)}}}))},b9f5:function(e,t,r){"use strict";r("2c63")},fb15:function(e,t,r){"use strict";if(r.r(t),"undefined"!==typeof window){var n=window.document.currentScript,a=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);a&&(r.p=a[1])}var s=function(){var e=this,t=e._self._c;return t("div",[t("div",{staticClass:"schedule-card"},[t("div",{staticClass:"table-outer-container"},[t("div",{staticClass:"fixed-left-bar",style:0==e.personList.length?"min-height:500px":""},[t("div",{staticClass:"header-cell fixed-person-header"},[e._v("人员\\日期")]),e._l(e.personList,(function(r){return t("div",{key:"row-person-"+r.id,staticClass:"table-person-row",style:`height:${r.allHeight||40}px`},[t("div",{staticClass:"flex_center body-cell fixed-person-cell"},[e._v(" "+e._s(r.name)+" ")])])})),0==e.personList.length?t("div",{staticClass:"blank-tip"},[e._v("暂无人员")]):e._e()],2),t("div",{directives:[{name:"drag-scroll",rawName:"v-drag-scroll"}],staticClass:"table-scroll-container",style:0==e.personList.length?"min-height:500px":""},[t("div",{staticClass:"table-header-row"},[t("div",{staticClass:"header-cell fixed-person-header"},[e._v("人员\\日期")]),e._l(e.dateList,(function(r){return t("div",{key:"date-"+r.key,staticClass:"flex_center scroll-date-header"},[e._v(" "+e._s(r.display)+" ")])}))],2),t("div",{staticClass:"cross-day-track"},e._l(e.allCrossDayTasks,(function(r){return t("div",{key:"track-"+r.id,staticClass:"cross-day-bar",style:{left:r.trackLeft+"px",width:r.trackWidth+"px",top:r.trackTop+"px",backgroundColor:r.color},attrs:{title:r.tooltip},on:{click:function(t){return e.handleDetail(r)}}},[t("span",[e._v(e._s(r.shortLabel))])])})),0),t("div",{staticClass:"table-body-rows"},e._l(e.personList,(function(r){return t("div",{key:"row-person-"+r.id,staticClass:"table-person-row",style:`height:${r.allHeight||40}px`},[t("div",{staticClass:"flex_center body-cell fixed-person-cell"},[e._v(" "+e._s(r.name)+" ")]),e._l(e.dateList,(function(n){return t("div",{key:"cell-"+r.id+"-"+n.key,staticClass:"body-cell scroll-date-cell"},e._l(e.getSameDayTasks(r.id,n.key),(function(r,n){return t("div",{key:"stacked-"+r.id+"-"+n,staticClass:"task-item stacked-task",style:{backgroundColor:r.color,top:r.cellTop+"px"},attrs:{title:r.tooltip},on:{click:function(t){return e.handleDetail(r)}}},[t("span",[e._v(e._s(r.shortLabel))])])})),0)}))],2)})),0)])])])])},i=[],o=r("5a0c"),c=r.n(o);const d=(e,t="YYYY-MM-DD HH:mm:ss")=>{if(!e||"0"===String(e))return"";let r=String(e).length;return r<12&&(e*=1e3),c()(e).format(t)},l=e=>e.reduce((e,t)=>e+t,0);function u(e){return c.a.unix(e).format("YYYY-MM-DD")}const f=e=>{e.sort((function(e,t){return e.start-t.start}));for(var t={},r=0;r<e.length;r++){var n=e[r],a=u(n.start),s=u(n.end),i=new Set,o=c()(a),d=c()(s);while(o.isSameOrBefore(d,"day")){var l=o.format("YYYY-MM-DD");t[l]&&t[l].forEach((function(e){i.add(e)})),o=o.add(1,"day")}var f=0;while(i.has(f))f++;n.row=f,o=c()(a);while(o.isSameOrBefore(d,"day")){l=o.format("YYYY-MM-DD");t[l]||(t[l]=[]),t[l].push(f),o=o.add(1,"day")}}return e};function h(e){return e.toISOString().split("T")[0]}function p(e){const t=e.getFullYear(),r=(e.getMonth()+1).toString().padStart(2,"0"),n=e.getDate().toString().padStart(2,"0"),a=["日","一","二","三","四","五","六"],s=a[e.getDay()];return`${t}/${r}/${n}(周${s})`}const v=(e,t)=>{const r=[],n=new Date(e);for(let a=0;a<t;a++){const e=new Date(n);e.setDate(n.getDate()+a);const t=h(e);r.push({key:t,date:e,display:p(e)})}return r};var b=r("b375"),g=r.n(b);c.a.extend(g.a);const y='12px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif';var x={name:"TopicSchedule",props:{dateRange:{type:Array,required:!0},scheduleData:{type:Array,required:!0}},data(){return{tableLoading:!1,personList:[],dateList:[],allTasks:[],userRowObj:{},colorPalette:["#4285f4","#34a853","#ea4335","#fbbc05","#9c27b0","#ff5722","#009688","#795548","#607d8b","#e91e63"]}},watch:{dateRange:{handler(){this.initSchedule()},deep:!0},scheduleData:{handler(){this.initSchedule()},deep:!0}},computed:{allCrossDayTasks(){const e=3;let t=[];return this.personList.forEach((r,n)=>{let a=this.allTasks.filter(({personId:e,isCrossDay:t})=>e==r.id&&t);a.forEach(a=>{let s={},i=this.userRowObj[r.id]||[];i.forEach(e=>{e.row<a.row&&(!s[e.row]||e.height>s[e.row])&&(s[e.row]=e.height)});const o=this.personList.slice(0,n).reduce((e,t)=>e+t.allHeight,0)+Object.values(s).reduce((t,r)=>t+r+e,0)+2;t.push({...a,trackTop:o})})}),t}},mounted(){this.initSchedule()},methods:{initSchedule(){if(!this.dateRange||!this.scheduleData)return;let e=JSON.parse(JSON.stringify(this.scheduleData));const[t,r]=this.dateRange,n=c()(r).diff(c()(t),"day")+1;this.dateList=v(t,n),this.personList=e.map(e=>({id:e.id,name:e.nickname})),this.calcScheduleDate(e,n)},getTextBlockHeight(e,t=190){const r=4,n=new OffscreenCanvas(t,1),a=n.getContext("2d");a.font=y;const s=[];let i="";for(let c=0;c<e.length;c++){const r=e[c];if("\n"===r){s.push(i),i="";continue}const n=i+r;a.measureText(n).width<=t?i=n:(s.push(i),i=r)}i&&s.push(i);const o=18;return s.length*o+r},calcScheduleDate(e,t){const r=190,n=14;let a=[];this.userRowObj={},e.forEach(e=>{let s=f(e.tasks);this.userRowObj[e.id]||(this.userRowObj[e.id]=[]);let i=86400;s.forEach(s=>{let o=d(s.start,"YYYY-MM-DD"),c=d(s.end,"YYYY-MM-DD"),l=s.end-s.start+2>i,u=s.content?s.content:"暂无内容",f=this.dateList.findIndex(e=>e.key===o),h=this.dateList.findIndex(e=>e.key===c);f<0&&(f=0),h<0&&(h=t-1);let p=l&&h-f===0,v=0,b=0;l&&h-f>0?(b=f*r+r,v=(h-f+1)*r):v=r;let g=l&&!p?v-n-4:v-n,y=this.getTextBlockHeight(u,g);this.userRowObj[e.id].push({id:s.id,row:s.row,height:y});let x={...s,personId:e.id,personName:e.nickname,startDate:o,endDate:c,isCrossDay:l,crossOneDay:p,shortLabel:u,color:"#2d8cf0",tooltip:`标题: ${s.title}\n时间: ${o} ~ ${c}`,realHeight:y,trackLeft:b,trackWidth:v};a.push(x)})}),this.allTasks=a,this.setPersonStyle()},getSameDayTasks(e,t){const r=3;let n=[],a=this.userRowObj[e]||[],s=this.allTasks.filter(r=>r.personId===e&&(!r.isCrossDay&&r.startDate===t&&r.endDate===t||r.crossOneDay&&r.startDate===t||r.crossOneDay&&r.endDate===t));return s.forEach(e=>{let t={};a.forEach(r=>{r.row<e.row&&(!t[r.row]||r.height>t[r.row])&&(t[r.row]=r.height)});const s=Object.values(t).reduce((e,t)=>e+t+r,0)+2;n.push({...e,cellTop:s})}),n},setPersonStyle(){const e=3;this.personList=this.personList.map(t=>{let r={},n=this.userRowObj[t.id]||[];n.forEach(e=>{(!r[e.row]||e.height>r[e.row])&&(r[e.row]=e.height)});let a=Object.keys(r).length||1,s=l(Object.values(r))+(a+1)*e;return s<40&&(s=40),{...t,allHeight:s,count:a}})},handleDetail(e){this.$emit("on-check",e)},handleEdit(e){this.$emit("on-edit",e)}}},m=x;r("b9f5");function w(e,t,r,n,a,s,i,o){var c,d="function"===typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=r,d._compiled=!0),n&&(d.functional=!0),s&&(d._scopeId="data-v-"+s),i?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),a&&a.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},d._ssrRegister=c):a&&(c=o?function(){a.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:a),c)if(d.functional){d._injectStyles=c;var l=d.render;d.render=function(e,t){return c.call(t),l(e,t)}}else{var u=d.beforeCreate;d.beforeCreate=u?[].concat(u,c):[c]}return{exports:e,options:d}}var $=w(m,s,i,!1,null,"72a2d2e2",null),k=$.exports;const D=function(e){e.component(k.name,k)};var S={install:D,SdyGantt:k};"undefined"!==typeof window&&window.Vue&&window.Vue.use(D);t["default"]=S}})["default"]}));
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "sdy-gantt",
3
+ "version": "1.0.0",
4
+ "description": "A Vue.js gantt chart component",
5
+ "main": "dist/sdy-gantt.umd.js",
6
+ "module": "dist/sdy-gantt.esm.js",
7
+ "unpkg": "dist/sdy-gantt.min.js",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "serve": "vue-cli-service serve",
13
+ "lib": "vue-cli-service build --target lib --name sdy-gantt ./src/components/index.js"
14
+ },
15
+ "peerDependencies": {
16
+ "vue": "^2.6.0",
17
+ "dayjs": "^1.10.0"
18
+ },
19
+ "dependencies": {
20
+ "dayjs": "^1.10.0",
21
+ "vue": "^2.6.11",
22
+ "vue-router": "^3.2.0"
23
+ },
24
+ "devDependencies": {
25
+ "@vue/cli-plugin-babel": "^4.4.0",
26
+ "@vue/cli-service": "^4.5.0",
27
+ "babel-plugin-import": "^1.13.0",
28
+ "less": "^2.7.3",
29
+ "less-loader": "^5.0.0",
30
+ "vue-template-compiler": "^2.6.0"
31
+ },
32
+ "browserslist": [
33
+ "> 1%",
34
+ "last 2 versions",
35
+ "not dead"
36
+ ],
37
+ "license": "ISC",
38
+ "publishConfig": {
39
+ "registry": "https://registry.npmjs.org/"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://codecenter.iqilu.com:8181/zhaotingting/sdy-gantt.git"
44
+ }
45
+ }