@mailstep/design-system 0.7.69-beta.1 → 0.7.70
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.
package/package.json
CHANGED
|
@@ -54,6 +54,7 @@ var DatePickerRange = function (props) {
|
|
|
54
54
|
var firstDate = new Date();
|
|
55
55
|
firstDate.setHours(0, 0, 0, 0);
|
|
56
56
|
var secondDate = new Date();
|
|
57
|
+
secondDate.setHours(23, 59, 59, 0);
|
|
57
58
|
if (initialView === 'future') {
|
|
58
59
|
secondDate.setMonth(secondDate.getMonth() + 1);
|
|
59
60
|
}
|
|
@@ -56,6 +56,12 @@ export var Timepicker = function (_a) {
|
|
|
56
56
|
useEffect(function () {
|
|
57
57
|
!!value && setTime('minutes', minutes);
|
|
58
58
|
}, [minutes]);
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
setHours(initialHours);
|
|
61
|
+
}, [initialHours]);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
setMinutes(initialMinutes);
|
|
64
|
+
}, [initialMinutes]);
|
|
59
65
|
return (_jsxs(FooterRow, { disabled: disabled, children: [_jsxs("div", { children: [_jsx(Icon, { icon: "clock" }), _jsx(FooterRowLabel, { children: i18n._({ id: 'dataGrid.filterCell.time', message: 'Time' }) })] }), _jsx(x.div, { display: "flex", flexDirection: "column", alignItems: "flex-start", pt: "4px", w: "fit-content", children: _jsxs(x.div, { display: "flex", alignItems: "center", children: [_jsxs(x.div, { display: "flex", flexDirection: "column", children: [_jsx(Btn, { disabled: disabled, onClick: increaseHour, type: "button", children: "\u2039" }), _jsx(Btn, { disabled: disabled, onClick: decreaseHour, type: "button", children: "\u203A" })] }), _jsxs(TimeWrapper, { children: [_jsx(Hours, { value: String(hours).padStart(2, '0'), disabled: disabled, onChange: onHoursChange }), _jsx(x.div, { mx: "1px", children: ":" }), _jsx(Minutes, { value: String(minutes).padStart(2, '0'), disabled: disabled, onChange: onMinutesChange })] }), _jsxs(x.div, { display: "flex", flexDirection: "column", children: [_jsx(Btn, { disabled: disabled, onClick: increaseMinutes, type: "button", children: "\u2039" }), _jsx(Btn, { disabled: disabled, onClick: decreaseMinutes, type: "button", children: "\u203A" })] })] }) })] }));
|
|
60
66
|
};
|
|
61
67
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
package/ui/Forms/Input/Input.js
CHANGED
|
@@ -58,7 +58,6 @@ export var Input = function (_a) {
|
|
|
58
58
|
}
|
|
59
59
|
}, [forceFocus, onBlur]);
|
|
60
60
|
var handleKeyDown = useCallback(function (event) {
|
|
61
|
-
console.log('event.key', event.key);
|
|
62
61
|
if (event.key === 'Enter') {
|
|
63
62
|
onEnter === null || onEnter === void 0 ? void 0 : onEnter();
|
|
64
63
|
}
|
package/ui/index.es.js
CHANGED
|
@@ -27854,7 +27854,7 @@ const _fe = (e) => {
|
|
|
27854
27854
|
var ee, oe, he, ye, _e;
|
|
27855
27855
|
$ == null || $(X), R && (((oe = (ee = X.relatedTarget) == null ? void 0 : ee.tagName) == null ? void 0 : oe.toLowerCase()) !== "input" || !qfe.includes((ye = (he = X.relatedTarget) == null ? void 0 : he.type) == null ? void 0 : ye.toLowerCase())) && ((_e = X.target) == null || _e.focus());
|
|
27856
27856
|
}, [R, $]), ae = fe((X) => {
|
|
27857
|
-
|
|
27857
|
+
X.key === "Enter" && (J == null || J());
|
|
27858
27858
|
}, [J]);
|
|
27859
27859
|
return /* @__PURE__ */ p.jsxs(F0, { spaceAround: A, className: C, children: [
|
|
27860
27860
|
/* @__PURE__ */ p.jsxs(Jfe, { children: [
|
|
@@ -28152,7 +28152,11 @@ const Py = {
|
|
|
28152
28152
|
t && e("hours", o);
|
|
28153
28153
|
}, [o]), je(() => {
|
|
28154
28154
|
t && e("minutes", c);
|
|
28155
|
-
}, [c]),
|
|
28155
|
+
}, [c]), je(() => {
|
|
28156
|
+
l(r);
|
|
28157
|
+
}, [r]), je(() => {
|
|
28158
|
+
d(i);
|
|
28159
|
+
}, [i]), /* @__PURE__ */ p.jsxs(OF, { disabled: n, children: [
|
|
28156
28160
|
/* @__PURE__ */ p.jsxs("div", { children: [
|
|
28157
28161
|
/* @__PURE__ */ p.jsx(At, { icon: "clock" }),
|
|
28158
28162
|
/* @__PURE__ */ p.jsx(PF, { children: We._({
|
|
@@ -29572,7 +29576,7 @@ const LAe = Z(Ne.div)`
|
|
|
29572
29576
|
const re = /* @__PURE__ */ new Date();
|
|
29573
29577
|
re.setHours(0, 0, 0, 0);
|
|
29574
29578
|
const K = /* @__PURE__ */ new Date();
|
|
29575
|
-
return c === "future" ? K.setMonth(K.getMonth() + 1) : re.setMonth(re.getMonth()), [I[0] || re, I[1] || K];
|
|
29579
|
+
return K.setHours(23, 59, 59, 0), c === "future" ? K.setMonth(K.getMonth() + 1) : re.setMonth(re.getMonth()), [I[0] || re, I[1] || K];
|
|
29576
29580
|
}, [I, c]), [k, M] = Me(!1), T = fe((re) => {
|
|
29577
29581
|
g(re), t([re, I[1]], o);
|
|
29578
29582
|
}, [t, o, I]), O = fe((re) => {
|
package/ui/index.umd.js
CHANGED
|
@@ -1681,7 +1681,7 @@ Me.version="2.30.1",W1e(en),Me.fn=Ee,Me.min=Mde,Me.max=Lde,Me.now=Ode,Me.utc=Xa,
|
|
|
1681
1681
|
display: block;
|
|
1682
1682
|
}
|
|
1683
1683
|
}
|
|
1684
|
-
`,JAe=["text","number","password"],$a=({appearance:e="primary",type:t,name:n,label:r,value:i,icon:o,variant:l="default",disabled:c,error:d,isInvalid:f=void 0,spaceAround:A=!1,inputRef:g,autoComplete:v,isLoading:y,className:w,suffix:S,suffixOnClick:E,errorAppearance:I,iconPlacement:M="left",iconOnClick:L,iconTooltip:D,big:P,showArrowsController:j=!1,onClear:N,alwaysShowClear:W,setNumber:_,onEnter:X,forceFocus:B=!1,autoFocus:H=!1,onBlur:ee,asTextArea:oe=!1,...ae})=>{const q=f!==void 0?f:!!d,ce=!!N&&(!!i||W)&&!y,ge=!!S,fe=j?"left":M,Y=C.useCallback(()=>{_==null||_(Q=>Q+1)},[_]),z=C.useCallback(()=>{_==null||_(Q=>Q>1?Q-1:1)},[_]),$=C.useRef(null),ie=g||$;C.useEffect(()=>{var Q;B&&!c&&!y&&((Q=ie==null?void 0:ie.current)==null||Q.focus())},[c,B,y]);const de=C.useCallback(Q=>{var te,le,pe,ye,We;ee==null||ee(Q),B&&(((le=(te=Q.relatedTarget)==null?void 0:te.tagName)==null?void 0:le.toLowerCase())!=="input"||!JAe.includes((ye=(pe=Q.relatedTarget)==null?void 0:pe.type)==null?void 0:ye.toLowerCase()))&&((We=Q.target)==null||We.focus())},[B,ee]),se=C.useCallback(Q=>{
|
|
1684
|
+
`,JAe=["text","number","password"],$a=({appearance:e="primary",type:t,name:n,label:r,value:i,icon:o,variant:l="default",disabled:c,error:d,isInvalid:f=void 0,spaceAround:A=!1,inputRef:g,autoComplete:v,isLoading:y,className:w,suffix:S,suffixOnClick:E,errorAppearance:I,iconPlacement:M="left",iconOnClick:L,iconTooltip:D,big:P,showArrowsController:j=!1,onClear:N,alwaysShowClear:W,setNumber:_,onEnter:X,forceFocus:B=!1,autoFocus:H=!1,onBlur:ee,asTextArea:oe=!1,...ae})=>{const q=f!==void 0?f:!!d,ce=!!N&&(!!i||W)&&!y,ge=!!S,fe=j?"left":M,Y=C.useCallback(()=>{_==null||_(Q=>Q+1)},[_]),z=C.useCallback(()=>{_==null||_(Q=>Q>1?Q-1:1)},[_]),$=C.useRef(null),ie=g||$;C.useEffect(()=>{var Q;B&&!c&&!y&&((Q=ie==null?void 0:ie.current)==null||Q.focus())},[c,B,y]);const de=C.useCallback(Q=>{var te,le,pe,ye,We;ee==null||ee(Q),B&&(((le=(te=Q.relatedTarget)==null?void 0:te.tagName)==null?void 0:le.toLowerCase())!=="input"||!JAe.includes((ye=(pe=Q.relatedTarget)==null?void 0:pe.type)==null?void 0:ye.toLowerCase()))&&((We=Q.target)==null||We.focus())},[B,ee]),se=C.useCallback(Q=>{Q.key==="Enter"&&(X==null||X())},[X]);return p.jsxs(ms,{spaceAround:A,className:w,children:[p.jsxs(_Ae,{children:[r&&p.jsx(Nc,{htmlFor:n,children:r}),p.jsxs(UAe,{hasValue:!!i,$isInvalid:q,disabled:!!c,$icon:o,variant:l,children:[p.jsx(GAe,{autoFocus:H,className:`${e} ${fe}`,type:t,name:n,"data-cy":n?`${n}Inp`:void 0,"data-testid":n?`input-${n}`:void 0,value:i,$isInvalid:q,$isClearable:ce,$hasSuffix:ge,disabled:c||y,ref:ie,autoComplete:v,onKeyDown:se,big:P,onBlur:de,$asTextArea:oe,variant:l,...ae}),o&&p.jsx(Ml,{right:j?!1:M==="right",hasValue:!!i,$isInvalid:q,disabled:c,onClick:L,children:p.jsxs(YAe,{children:[p.jsx(lt,{icon:o}),D&&p.jsx("span",{children:D})]})}),j&&p.jsxs(HAe,{children:[p.jsx(hR,{onClick:Y,children:p.jsx(lt,{icon:"goUp",fill:"gray1"})}),p.jsx(hR,{onClick:z,children:p.jsx(lt,{icon:"goDown",fill:"gray1"})})]}),ce&&p.jsx(VAe,{right:!0,onClick:N,children:p.jsx(lt,{icon:"deleteX",size:"16px",fill:"gray1"})}),S&&!y&&p.jsx(ZAe,{onClick:E,$isPointer:!!E,$isInvalid:q,children:S}),y&&p.jsx(Ml,{right:!0,children:p.jsx(l1,{variant:"sm"})})]})]}),d&&p.jsx(b1,{appearance:I,children:d})]})};function XAe(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Zm(e,t)}function Zm(e,t){return Zm=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Zm(e,t)}function QAe(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function pR(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function KAe(e,t,n){return e===t?!0:e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n)}function qAe(e,t,n){if(e===t)return!0;for(;e.parentNode||e.host;){if(e.parentNode&&KAe(e,t,n))return!0;e=e.parentNode||e.host}return e}function $Ae(e){return document.documentElement.clientWidth<=e.clientX||document.documentElement.clientHeight<=e.clientY}var e3e=function(){if(!(typeof window>"u"||typeof window.addEventListener!="function")){var t=!1,n=Object.defineProperty({},"passive",{get:function(){t=!0}}),r=function(){};return window.addEventListener("testPassiveEventSupport",r,n),window.removeEventListener("testPassiveEventSupport",r,n),t}};function t3e(e){return e===void 0&&(e=0),function(){return++e}}var n3e=t3e(),Um,M3={},Ym={},r3e=["touchstart","touchmove"],i3e="ignore-react-onclickoutside";function gR(e,t){var n={},r=r3e.indexOf(t)!==-1;return r&&Um&&(n.passive=!e.props.preventDefault),n}function a3e(e,t){var n,r,i=e.displayName||e.name||"Component";return r=n=function(o){XAe(l,o);function l(d){var f;return f=o.call(this,d)||this,f.__outsideClickHandler=function(A){if(typeof f.__clickOutsideHandlerProp=="function"){f.__clickOutsideHandlerProp(A);return}var g=f.getInstance();if(typeof g.props.handleClickOutside=="function"){g.props.handleClickOutside(A);return}if(typeof g.handleClickOutside=="function"){g.handleClickOutside(A);return}throw new Error("WrappedComponent: "+i+" lacks a handleClickOutside(event) function for processing outside click events.")},f.__getComponentNode=function(){var A=f.getInstance();return typeof A.setClickOutsideRef=="function"?A.setClickOutsideRef():yo.findDOMNode(A)},f.enableOnClickOutside=function(){if(!(typeof document>"u"||Ym[f._uid])){typeof Um>"u"&&(Um=e3e()),Ym[f._uid]=!0;var A=f.props.eventTypes;A.forEach||(A=[A]),M3[f._uid]=function(g){if(f.componentNode!==null&&!(f.initTimeStamp>g.timeStamp)&&(f.props.preventDefault&&g.preventDefault(),f.props.stopPropagation&&g.stopPropagation(),!(f.props.excludeScrollbar&&$Ae(g)))){var v=g.composed&&g.composedPath&&g.composedPath().shift()||g.target;qAe(v,f.componentNode,f.props.outsideClickIgnoreClass)===document&&f.__outsideClickHandler(g)}},A.forEach(function(g){document.addEventListener(g,M3[f._uid],gR(pR(f),g))})}},f.disableOnClickOutside=function(){delete Ym[f._uid];var A=M3[f._uid];if(A&&typeof document<"u"){var g=f.props.eventTypes;g.forEach||(g=[g]),g.forEach(function(v){return document.removeEventListener(v,A,gR(pR(f),v))}),delete M3[f._uid]}},f.getRef=function(A){return f.instanceRef=A},f._uid=n3e(),f.initTimeStamp=performance.now(),f}var c=l.prototype;return c.getInstance=function(){if(e.prototype&&!e.prototype.isReactComponent)return this;var f=this.instanceRef;return f.getInstance?f.getInstance():f},c.componentDidMount=function(){typeof document>"u"||!document.createElement||(this.getInstance(),this.componentNode=this.__getComponentNode(),!this.props.disableOnClickOutside&&this.enableOnClickOutside())},c.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},c.componentWillUnmount=function(){this.disableOnClickOutside()},c.render=function(){var f=this.props;f.excludeScrollbar;var A=QAe(f,["excludeScrollbar"]);return e.prototype&&e.prototype.isReactComponent?A.ref=this.getRef:A.wrappedRef=this.getRef,A.disableOnClickOutside=this.disableOnClickOutside,A.enableOnClickOutside=this.enableOnClickOutside,C.createElement(e,A)},l}(C.Component),n.displayName="OnClickOutside("+i+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:!1,outsideClickIgnoreClass:i3e,preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},r}var Es=(e=>(e.EVERY_TODAY="every-today",e.EVERY_YESTERDAY="every-yesterday",e))(Es||{}),X1=(e=>(e.FROM="from",e.TO="to",e.AT="at",e))(X1||{});const Jm={[Es.EVERY_TODAY]:Re._({id:"dataGrid.everyToday",message:"Every today"}),[Es.EVERY_YESTERDAY]:Re._({id:"dataGrid.everyYesterday",message:"Every yesterday"})},mR={[X1.FROM]:Re._({id:"dataGrid.timepicker.from",message:"from"}),[X1.TO]:Re._({id:"dataGrid.timepicker.to",message:"to"}),[X1.AT]:Re._({id:"dataGrid.timepicker.at",message:"at"})},vR=U.div`
|
|
1685
1685
|
display: flex;
|
|
1686
1686
|
justify-content: space-between;
|
|
1687
1687
|
align-items: center;
|
|
@@ -1744,7 +1744,7 @@ Me.version="2.30.1",W1e(en),Me.fn=Ee,Me.min=Mde,Me.max=Lde,Me.now=Ode,Me.utc=Xa,
|
|
|
1744
1744
|
&:disabled {
|
|
1745
1745
|
opacity: 0.5;
|
|
1746
1746
|
}
|
|
1747
|
-
`,bR="^[0-9]*$",u3e=({setTime:e,value:t,disabled:n})=>{var S,E;const r=((S=t==null?void 0:t.getHours)==null?void 0:S.call(t))??0,i=((E=t==null?void 0:t.getMinutes)==null?void 0:E.call(t))??0,[o,l]=C.useState(r),[c,d]=C.useState(i),f=C.useCallback(()=>{l(I=>(I+1)%24)},[]),A=C.useCallback(()=>{l(I=>I===0?23:I-1)},[]),g=C.useCallback(()=>{d(I=>(I+5)%60)},[]),v=C.useCallback(()=>{d(I=>(I-5+60)%60)},[]),y=C.useCallback(I=>{I.target.value.match(bR)&&Number(I.target.value)<=23?l(Number(I.target.value)):l(0)},[]),w=C.useCallback(I=>{I.target.value.match(bR)&&Number(I.target.value)<=59?d(Number(I.target.value)):d(0)},[]);return C.useEffect(()=>{t&&e("hours",o)},[o]),C.useEffect(()=>{t&&e("minutes",c)},[c]),p.jsxs(vR,{disabled:n,children:[p.jsxs("div",{children:[p.jsx(lt,{icon:"clock"}),p.jsx(yR,{children:Re._({id:"dataGrid.filterCell.time",message:"Time"})})]}),p.jsx(Be.div,{display:"flex",flexDirection:"column",alignItems:"flex-start",pt:"4px",w:"fit-content",children:p.jsxs(Be.div,{display:"flex",alignItems:"center",children:[p.jsxs(Be.div,{display:"flex",flexDirection:"column",children:[p.jsx(L3,{disabled:n,onClick:f,type:"button",children:"‹"}),p.jsx(L3,{disabled:n,onClick:A,type:"button",children:"›"})]}),p.jsxs(s3e,{children:[p.jsx(l3e,{value:String(o).padStart(2,"0"),disabled:n,onChange:y}),p.jsx(Be.div,{mx:"1px",children:":"}),p.jsx(c3e,{value:String(c).padStart(2,"0"),disabled:n,onChange:w})]}),p.jsxs(Be.div,{display:"flex",flexDirection:"column",children:[p.jsx(L3,{disabled:n,onClick:g,type:"button",children:"‹"}),p.jsx(L3,{disabled:n,onClick:v,type:"button",children:"›"})]})]})})]})};function Xm({onClickPrev:e,onClickSwitch:t,onClickNext:n,switchContent:r,switchColSpan:i,switchProps:o,label:l}){return p.jsxs("tr",{children:[p.jsx("th",{className:"rdtPrev",onClick:e,children:p.jsx("span",{children:"‹"})}),p.jsx("th",{className:"rdtSwitch",colSpan:i,onClick:t,...o,children:r}),p.jsx("th",{className:"rdtNext",onClick:n,children:p.jsx("span",{children:"›"})}),p.jsx("th",{colSpan:2,className:"rdtLabel",children:l&&l})]})}const L9=class L9 extends C.Component{constructor(){super(...arguments),this._setDate=t=>{this.props.updateDate(t)}}render(){return p.jsx("div",{className:"rdtDays",children:p.jsxs("table",{children:[p.jsxs("thead",{children:[this.renderNavigation(),this.renderDayHeaders()]}),p.jsx("tbody",{children:this.renderDays()}),this.renderFooter()]})})}renderNavigation(){const t=this.props.viewDate,n=t.localeData(),r=this.props.label;return p.jsx(Xm,{onClickPrev:()=>this.props.navigate(-1,"months"),onClickSwitch:()=>this.props.showView("months"),onClickNext:()=>this.props.navigate(1,"months"),switchContent:n.months(t,"DD[]MMMM")+" "+t.year(),switchColSpan:3,label:r,switchProps:{"data-value":this.props.viewDate.month()}})}renderDayHeaders(){const t=this.props.viewDate.localeData();let n=f3e(t).map((r,i)=>p.jsx("th",{className:"dow",children:r},r+i));return p.jsx("tr",{children:n})}renderDays(){const t=this.props.viewDate,n=t.clone().startOf("month"),r=t.clone().endOf("month");let i=[[],[],[],[],[],[]],o=t.clone().subtract(1,"months");o.date(o.daysInMonth()).startOf("week");let l=o.clone().add(42,"d"),c=0;for(;o.isBefore(l);)d3e(i,c++).push(this.renderDay(o,n,r)),o.add(1,"d");return i.map((d,f)=>p.jsx("tr",{children:d},`${l.month()}_${f}`))}renderDay(t,n,r){var d,f;let i=this.props.selectedDate,o=this.props.secondValue,l={key:t.format("M_D"),"data-value":t.date(),"data-month":t.month(),"data-year":t.year()},c="rdtDay";return t.isBefore(n)?c+=" rdtOld":t.isAfter(r)&&(c+=" rdtNew"),o&&t.isBefore(o)&&t.isAfter(i)&&(c+=" rdtActiveRange"),o&&t.isAfter(o)&&t.isBefore(i)&&(c+=" rdtActiveRange"),i&&t.isSame(i,"day")&&(c+=" rdtActive"),o&&t.isSame(o,"day")&&(c+=" rdtActiveSecond"),t.isSame(this.props.moment(),"day")&&(c+=" rdtToday"),this.props.isValidDate(t)&&!((d=this.props.others)!=null&&d.dateTypeRepeater)&&!this.props.disabled?l.onClick=this._setDate:c+=" rdtDisabled",((f=this.props.others)!=null&&f.dateTypeRepeater||this.props.disabled)&&(c+=" rdtDisabled"),l.className=c,this.props.renderDay(l,t.clone(),i&&i.clone())}renderFooter(){const t=this.props.setTime,n=this.props.onChangeOthers,r=this.props.reset,i=this.props.value,o=this.props.others,l=this.props.disabled;return p.jsx("tfoot",{children:p.jsx("tr",{children:p.jsxs("td",{colSpan:7,children:[n&&p.jsx(o3e,{onChangeOthers:n,others:o,reset:r}),this.props.timeFormat&&p.jsx(u3e,{setTime:t,value:i,disabled:l||!i&&!(o!=null&&o.dateTypeRepeater),others:o,onChangeOthers:n,isSecondDatePicker:this.props.isSecondDatePicker})]})})})}};L9.defaultProps={isValidDate:()=>!0,renderDay:(t,n)=>p.jsx("td",{...t,children:n.date()})};let O3=L9;function d3e(e,t){return e[Math.floor(t/7)]}function f3e(e){const t=e.firstDayOfWeek();let n=[],r=0;return e._weekdaysMin.forEach(function(i){n[(7+r++-t)%7]=i}),n}class A3e extends C.Component{constructor(){super(...arguments),this._updateSelectedMonth=t=>{this.props.updateDate(t)}}render(){return p.jsxs("div",{className:"rdtMonths",children:[p.jsx("table",{children:p.jsx("thead",{children:this.renderNavigation()})}),p.jsx("table",{children:p.jsx("tbody",{children:this.renderMonths()})})]})}renderNavigation(){let t=this.props.viewDate.year();return p.jsx(Xm,{onClickPrev:()=>this.props.navigate(-1,"years"),onClickSwitch:()=>this.props.showView("years"),onClickNext:()=>this.props.navigate(1,"years"),switchContent:t,switchColSpan:"2"})}renderMonths(){let t=[[],[],[]];for(let n=0;n<12;n++)h3e(t,n).push(this.renderMonth(n));return t.map((n,r)=>p.jsx("tr",{children:n},r))}renderMonth(t){const n=this.props.selectedDate;let r="rdtMonth",i;this.isDisabledMonth(t)?r+=" rdtDisabled":i=this._updateSelectedMonth,n&&n.year()===this.props.viewDate.year()&&n.month()===t&&(r+=" rdtActive");let o={key:t,className:r,"data-value":t,onClick:i};return this.props.renderMonth?this.props.renderMonth(o,t,this.props.viewDate.year(),this.props.selectedDate&&this.props.selectedDate.clone()):p.jsx("td",{...o,children:this.getMonthText(t)})}isDisabledMonth(t){let n=this.props.isValidDate;if(!n)return!1;let r=this.props.viewDate.clone().set({month:t}),i=r.endOf("month").date()+1;for(;i-- >1;)if(n(r.date(i)))return!1;return!0}getMonthText(t){const n=this.props.viewDate,r=n.localeData().monthsShort(n.month(t));return p3e(r.substring(0,3))}}function h3e(e,t){return t<4?e[0]:t<8?e[1]:e[2]}function p3e(e){return e.charAt(0).toUpperCase()+e.slice(1)}const O9=class O9 extends C.Component{constructor(){super(...arguments),this.disabledYearsCache={},this._updateSelectedYear=t=>{this.props.updateDate(t)}}render(){return p.jsxs("div",{className:"rdtYears",children:[p.jsx("table",{children:p.jsx("thead",{children:this.renderNavigation()})}),p.jsx("table",{children:p.jsx("tbody",{children:this.renderYears()})})]})}renderNavigation(){const t=this.getViewYear();return p.jsx(Xm,{onClickPrev:()=>this.props.navigate(-10,"years"),onClickSwitch:()=>this.props.showView("years"),onClickNext:()=>this.props.navigate(10,"years"),switchContent:`${t}-${t+9}`})}renderYears(){const t=this.getViewYear();let n=[[],[],[]];for(let r=t-1;r<t+11;r++)g3e(n,r-t).push(this.renderYear(r));return n.map((r,i)=>p.jsx("tr",{children:r},i))}renderYear(t){const n=this.getSelectedYear();let r="rdtYear",i;this.isDisabledYear(t)?r+=" rdtDisabled":i=this._updateSelectedYear,n===t&&(r+=" rdtActive");let o={key:t,className:r,"data-value":t,onClick:i};return this.props.renderYear(o,t,this.props.selectedDate&&this.props.selectedDate.clone())}getViewYear(){return parseInt(this.props.viewDate.year()/10,10)*10}getSelectedYear(){return this.props.selectedDate&&this.props.selectedDate.year()}isDisabledYear(t){let n=this.disabledYearsCache;if(n[t]!==void 0)return n[t];let r=this.props.isValidDate;if(!r)return!1;let i=this.props.viewDate.clone().set({year:t}),o=i.endOf("year").dayOfYear()+1;for(;o-- >1;)if(r(i.dayOfYear(o)))return n[t]=!1,!1;return n[t]=!0,!0}};O9.defaultProps={renderYear:(t,n)=>p.jsx("td",{...t,children:n})};let Qm=O9;function g3e(e,t){return t<3?e[0]:t<7?e[1]:e[2]}const ks={YEARS:"years",MONTHS:"months",DAYS:"days",TIME:"time"},Ms=function(){},yh=class yh extends C.Component{constructor(t){super(t),this._renderCalendar=()=>{const n=this.props,r=this.state;let i={viewDate:r.viewDate.clone(),label:n.label,isSecondDatePicker:n.isSecondDatePicker,secondValue:n.secondValue,selectedDate:this.getSelectedDate(),isValidDate:n.isValidDate,updateDate:this._updateDate,others:n.others,onChangeOthers:n.onChangeOthers,reset:this._reset,navigate:this._viewNavigate,moment:Me,showView:this._showView};switch(r.currentView){case ks.YEARS:return i.renderYear=n.renderYear,p.jsx(Qm,{...i});case ks.MONTHS:return i.renderMonth=n.renderMonth,p.jsx(A3e,{...i});case ks.DAYS:return i.renderDay=n.renderDay,i.timeFormat=this.getFormat("time"),i.setTime=this._setTime,i.value=this.props.value,i.disabled=this.props.disabled,p.jsx(O3,{...i});default:return i.renderDay=n.renderDay,i.timeFormat=this.getFormat("time"),i.setTime=this._setTime,i.value=this.props.value,p.jsx(O3,{...i})}},this._showView=(n,r)=>{const i=(r||this.state.viewDate).clone(),o=this.props.onBeforeNavigate(n,this.state.currentView,i);o&&this.state.currentView!==o&&(this.props.onNavigate(o),this.setState({currentView:o}))},this.viewToMethod={days:"date",months:"month",years:"year"},this.nextView={days:"time",months:"days",years:"months"},this._updateDate=n=>{let i=this.state.currentView,o=this.getUpdateOn(this.getFormat("date")),l=this.state.viewDate.clone();l[this.viewToMethod[i]](parseInt(n.target.getAttribute("data-value"),10)),i==="days"&&(l.month(parseInt(n.target.getAttribute("data-month"),10)),l.year(parseInt(n.target.getAttribute("data-year"),10)));let c={viewDate:l};i===o?(c.selectedDate=l.clone(),c.inputValue=l.format(this.getFormat("datetime")),this.props.open===void 0&&this.props.input&&this.props.closeOnSelect&&this._closeCalendar(),this.props.onChange(l.clone())):this._showView(this.nextView[i],l),this.setState(c)},this._viewNavigate=(n,r)=>{let i=this.state.viewDate.clone();i.add(n,r),n>0?this.props.onNavigateForward(n,r):this.props.onNavigateBack(-n,r),this.setState({viewDate:i})},this._setTime=(n,r)=>{let i=(this.getSelectedDate()||this.state.viewDate).clone();i[n](r),this.props.value||this.setState({selectedDate:i,viewDate:i.clone(),inputValue:i.format(this.getFormat("datetime"))}),this.props.onChange(i)},this._reset=()=>{this.props.onChange(void 0)},this._openCalendar=()=>{this.isOpen()||this.setState({open:!0},this.props.onOpen)},this._closeCalendar=()=>{this.isOpen()&&this.setState({open:!1},()=>{this.props.onClose(this.state.selectedDate||this.state.inputValue)})},this._handleClickOutside=()=>{let n=this.props;n.input&&this.state.open&&n.open===void 0&&n.closeOnClickOutside&&this._closeCalendar()},this._onInputFocus=n=>{this.callHandler(this.props.inputProps.onFocus,n)&&this._openCalendar()},this._onInputChange=n=>{if(!this.callHandler(this.props.inputProps.onChange,n))return;const r=n.target?n.target.value:n,i=this.localMoment(r,this.getFormat("datetime"));let o={inputValue:r};i.isValid()?(o.selectedDate=i,o.viewDate=i.clone().startOf("month")):o.selectedDate=null,this.setState(o,()=>{this.props.onChange(i.isValid()?i:this.state.inputValue)})},this._onInputKeyDown=n=>{this.callHandler(this.props.inputProps.onKeyDown,n)&&n.which===9&&this.props.closeOnTab&&this._closeCalendar()},this._onInputClick=n=>{this.callHandler(this.props.inputProps.onClick,n)&&this._openCalendar()},this.state=this.getInitialState()}render(){return p.jsxs(v3e,{className:this.getClassName(),onClickOut:this._handleClickOutside,children:[this.renderInput(),p.jsx("div",{className:"rdtPicker",children:this.renderView()})]})}renderInput(){if(!this.props.input)return;const t={type:"text",className:"form-control",value:this.getInputValue(),...this.props.inputProps,onFocus:this._onInputFocus,onChange:this._onInputChange,onKeyDown:this._onInputKeyDown,onClick:this._onInputClick};return this.props.renderInput?p.jsx("div",{children:this.props.renderInput(t,this._openCalendar,this._closeCalendar)}):p.jsx("input",{...t})}renderView(){return this.props.renderView(this.state.currentView,this._renderCalendar)}getInitialState(){let t=this.props,n=this.getFormat("datetime"),r=this.parseDate(t.value||t.initialValue,n);return this.checkTZ(),{open:!t.input,currentView:t.initialViewMode||this.getInitialView(),viewDate:this.getInitialViewDate(r),selectedDate:r&&r.isValid()?r:void 0,inputValue:this.getInitialInputValue(r)}}getInitialViewDate(t){const n=this.props.initialViewDate;let r;if(n){if(r=this.parseDate(n,this.getFormat("datetime")),r&&r.isValid())return r;console.log('The initialViewDated given "'+n+'" is not valid. Using current date instead.')}else if(t&&t.isValid())return t.clone();return this.getInitialDate()}getInitialDate(){let t=this.localMoment();return t.hour(0).minute(0).second(0).millisecond(0),t}getInitialView(){const t=this.getFormat("date");return t?this.getUpdateOn(t):ks.TIME}parseDate(t,n){let r;return t&&typeof t=="string"?r=this.localMoment(t,n):t&&(r=this.localMoment(t)),r&&!r.isValid()&&(r=null),r}getClassName(){let t="rdt",n=this.props,r=n.className;return Array.isArray(r)?t+=" "+r.join(" "):r&&(t+=" "+r),n.input||(t+=" rdtStatic"),this.isOpen()&&(t+=" rdtOpen"),t}isOpen(){return!this.props.input||(this.props.open===void 0?this.state.open:this.props.open)}getUpdateOn(t){return this.props.updateOnView?this.props.updateOnView:t.match(/[lLD]/)?ks.DAYS:t.indexOf("M")!==-1?ks.MONTHS:t.indexOf("Y")!==-1?ks.YEARS:ks.DAYS}getLocaleData(){let t=this.props;return this.localMoment(t.value||t.defaultValue||new Date).localeData()}getDateFormat(){const t=this.getLocaleData();let n=this.props.dateFormat;return n===!0?t.longDateFormat("L"):n||""}getTimeFormat(){const t=this.getLocaleData();let n=this.props.timeFormat;return n===!0?t.longDateFormat("LT"):n||""}getFormat(t){if(t==="date")return this.getDateFormat();if(t==="time")return this.getTimeFormat();let n=this.getDateFormat(),r=this.getTimeFormat();return n&&r?n+" "+r:n||r}updateTime(t,n,r,i){let o={};const l=i?"selectedDate":"viewDate";o[l]=this.state[l].clone()[t](n,r),this.setState(o)}localMoment(t,n,r){r=r||this.props;let i=null;return r.utc?i=Me.utc(t,n,r.strictParsing):r.displayTimeZone?i=Me.tz(t,n,r.displayTimeZone):i=Me(t,n,r.strictParsing),r.locale&&i.locale(r.locale),i}checkTZ(){const{displayTimeZone:t}=this.props;t&&!this.tzWarning&&!Me.tz&&(this.tzWarning=!0)}componentDidUpdate(t){if(t===this.props)return;let n=!1,r=this.props;["locale","utc","displayZone","dateFormat","timeFormat"].forEach(function(i){t[i]!==r[i]&&(n=!0)}),n&&this.regenerateDates(),r.value&&r.value!==t.value&&this.setViewDate(r.value),this.checkTZ()}regenerateDates(){const t=this.props;let n=this.state.viewDate.clone(),r=this.state.selectedDate&&this.state.selectedDate.clone();t.locale&&(n.locale(t.locale),r&&r.locale(t.locale)),t.utc?(n.utc(),r&&r.utc()):t.displayTimeZone?(n.tz(t.displayTimeZone),r&&r.tz(t.displayTimeZone)):(n.locale(),r&&r.locale());let i={viewDate:n,selectedDate:r};r&&r.isValid()&&(i.inputValue=r.format(this.getFormat("datetime"))),this.setState(i)}getSelectedDate(){if(this.props.value===void 0)return this.state.selectedDate;let t=this.parseDate(this.props.value,this.getFormat("datetime"));return t&&t.isValid()?t:!1}getInitialInputValue(t){const n=this.props;return n.inputProps.value?n.inputProps.value:t&&t.isValid()?t.format(this.getFormat("datetime")):n.value&&typeof n.value=="string"?n.value:n.initialValue&&typeof n.initialValue=="string"?n.initialValue:""}getInputValue(){let t=this.getSelectedDate();return t?t.format(this.getFormat("datetime")):this.state.inputValue}setViewDate(t){let n=function(){return console.log("Invalid date passed to the `setViewDate` method: "+t)};if(!t)return n();let r;if(typeof t=="string"?r=this.localMoment(t,this.getFormat("datetime")):r=this.localMoment(t),!r||!r.isValid())return n();this.setState({viewDate:r})}navigate(t){this._showView(t)}callHandler(t,n){return t?t(n)!==!1:!0}};yh.defaultProps={onOpen:Ms,onClose:Ms,onCalendarOpen:Ms,onCalendarClose:Ms,onChange:Ms,onNavigate:Ms,onBeforeNavigate:function(t){return t},onNavigateBack:Ms,onNavigateForward:Ms,dateFormat:!0,timeFormat:!0,utc:!1,className:"",input:!0,inputProps:{},timeConstraints:{},isValidDate:function(){return!0},strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,closeOnClickOutside:!0,renderView:(t,n)=>n()},yh.moment=Me;let Km=yh;class m3e extends C.Component{constructor(){super(...arguments),this.container=C.createRef()}render(){return p.jsx("div",{className:this.props.className,ref:this.container,children:this.props.children})}handleClickOutside(t){this.props.onClickOut(t)}setClickOutsideRef(){return this.container.current}}const v3e=a3e(m3e);//! moment.js locale configuration
|
|
1747
|
+
`,bR="^[0-9]*$",u3e=({setTime:e,value:t,disabled:n})=>{var S,E;const r=((S=t==null?void 0:t.getHours)==null?void 0:S.call(t))??0,i=((E=t==null?void 0:t.getMinutes)==null?void 0:E.call(t))??0,[o,l]=C.useState(r),[c,d]=C.useState(i),f=C.useCallback(()=>{l(I=>(I+1)%24)},[]),A=C.useCallback(()=>{l(I=>I===0?23:I-1)},[]),g=C.useCallback(()=>{d(I=>(I+5)%60)},[]),v=C.useCallback(()=>{d(I=>(I-5+60)%60)},[]),y=C.useCallback(I=>{I.target.value.match(bR)&&Number(I.target.value)<=23?l(Number(I.target.value)):l(0)},[]),w=C.useCallback(I=>{I.target.value.match(bR)&&Number(I.target.value)<=59?d(Number(I.target.value)):d(0)},[]);return C.useEffect(()=>{t&&e("hours",o)},[o]),C.useEffect(()=>{t&&e("minutes",c)},[c]),C.useEffect(()=>{l(r)},[r]),C.useEffect(()=>{d(i)},[i]),p.jsxs(vR,{disabled:n,children:[p.jsxs("div",{children:[p.jsx(lt,{icon:"clock"}),p.jsx(yR,{children:Re._({id:"dataGrid.filterCell.time",message:"Time"})})]}),p.jsx(Be.div,{display:"flex",flexDirection:"column",alignItems:"flex-start",pt:"4px",w:"fit-content",children:p.jsxs(Be.div,{display:"flex",alignItems:"center",children:[p.jsxs(Be.div,{display:"flex",flexDirection:"column",children:[p.jsx(L3,{disabled:n,onClick:f,type:"button",children:"‹"}),p.jsx(L3,{disabled:n,onClick:A,type:"button",children:"›"})]}),p.jsxs(s3e,{children:[p.jsx(l3e,{value:String(o).padStart(2,"0"),disabled:n,onChange:y}),p.jsx(Be.div,{mx:"1px",children:":"}),p.jsx(c3e,{value:String(c).padStart(2,"0"),disabled:n,onChange:w})]}),p.jsxs(Be.div,{display:"flex",flexDirection:"column",children:[p.jsx(L3,{disabled:n,onClick:g,type:"button",children:"‹"}),p.jsx(L3,{disabled:n,onClick:v,type:"button",children:"›"})]})]})})]})};function Xm({onClickPrev:e,onClickSwitch:t,onClickNext:n,switchContent:r,switchColSpan:i,switchProps:o,label:l}){return p.jsxs("tr",{children:[p.jsx("th",{className:"rdtPrev",onClick:e,children:p.jsx("span",{children:"‹"})}),p.jsx("th",{className:"rdtSwitch",colSpan:i,onClick:t,...o,children:r}),p.jsx("th",{className:"rdtNext",onClick:n,children:p.jsx("span",{children:"›"})}),p.jsx("th",{colSpan:2,className:"rdtLabel",children:l&&l})]})}const L9=class L9 extends C.Component{constructor(){super(...arguments),this._setDate=t=>{this.props.updateDate(t)}}render(){return p.jsx("div",{className:"rdtDays",children:p.jsxs("table",{children:[p.jsxs("thead",{children:[this.renderNavigation(),this.renderDayHeaders()]}),p.jsx("tbody",{children:this.renderDays()}),this.renderFooter()]})})}renderNavigation(){const t=this.props.viewDate,n=t.localeData(),r=this.props.label;return p.jsx(Xm,{onClickPrev:()=>this.props.navigate(-1,"months"),onClickSwitch:()=>this.props.showView("months"),onClickNext:()=>this.props.navigate(1,"months"),switchContent:n.months(t,"DD[]MMMM")+" "+t.year(),switchColSpan:3,label:r,switchProps:{"data-value":this.props.viewDate.month()}})}renderDayHeaders(){const t=this.props.viewDate.localeData();let n=f3e(t).map((r,i)=>p.jsx("th",{className:"dow",children:r},r+i));return p.jsx("tr",{children:n})}renderDays(){const t=this.props.viewDate,n=t.clone().startOf("month"),r=t.clone().endOf("month");let i=[[],[],[],[],[],[]],o=t.clone().subtract(1,"months");o.date(o.daysInMonth()).startOf("week");let l=o.clone().add(42,"d"),c=0;for(;o.isBefore(l);)d3e(i,c++).push(this.renderDay(o,n,r)),o.add(1,"d");return i.map((d,f)=>p.jsx("tr",{children:d},`${l.month()}_${f}`))}renderDay(t,n,r){var d,f;let i=this.props.selectedDate,o=this.props.secondValue,l={key:t.format("M_D"),"data-value":t.date(),"data-month":t.month(),"data-year":t.year()},c="rdtDay";return t.isBefore(n)?c+=" rdtOld":t.isAfter(r)&&(c+=" rdtNew"),o&&t.isBefore(o)&&t.isAfter(i)&&(c+=" rdtActiveRange"),o&&t.isAfter(o)&&t.isBefore(i)&&(c+=" rdtActiveRange"),i&&t.isSame(i,"day")&&(c+=" rdtActive"),o&&t.isSame(o,"day")&&(c+=" rdtActiveSecond"),t.isSame(this.props.moment(),"day")&&(c+=" rdtToday"),this.props.isValidDate(t)&&!((d=this.props.others)!=null&&d.dateTypeRepeater)&&!this.props.disabled?l.onClick=this._setDate:c+=" rdtDisabled",((f=this.props.others)!=null&&f.dateTypeRepeater||this.props.disabled)&&(c+=" rdtDisabled"),l.className=c,this.props.renderDay(l,t.clone(),i&&i.clone())}renderFooter(){const t=this.props.setTime,n=this.props.onChangeOthers,r=this.props.reset,i=this.props.value,o=this.props.others,l=this.props.disabled;return p.jsx("tfoot",{children:p.jsx("tr",{children:p.jsxs("td",{colSpan:7,children:[n&&p.jsx(o3e,{onChangeOthers:n,others:o,reset:r}),this.props.timeFormat&&p.jsx(u3e,{setTime:t,value:i,disabled:l||!i&&!(o!=null&&o.dateTypeRepeater),others:o,onChangeOthers:n,isSecondDatePicker:this.props.isSecondDatePicker})]})})})}};L9.defaultProps={isValidDate:()=>!0,renderDay:(t,n)=>p.jsx("td",{...t,children:n.date()})};let O3=L9;function d3e(e,t){return e[Math.floor(t/7)]}function f3e(e){const t=e.firstDayOfWeek();let n=[],r=0;return e._weekdaysMin.forEach(function(i){n[(7+r++-t)%7]=i}),n}class A3e extends C.Component{constructor(){super(...arguments),this._updateSelectedMonth=t=>{this.props.updateDate(t)}}render(){return p.jsxs("div",{className:"rdtMonths",children:[p.jsx("table",{children:p.jsx("thead",{children:this.renderNavigation()})}),p.jsx("table",{children:p.jsx("tbody",{children:this.renderMonths()})})]})}renderNavigation(){let t=this.props.viewDate.year();return p.jsx(Xm,{onClickPrev:()=>this.props.navigate(-1,"years"),onClickSwitch:()=>this.props.showView("years"),onClickNext:()=>this.props.navigate(1,"years"),switchContent:t,switchColSpan:"2"})}renderMonths(){let t=[[],[],[]];for(let n=0;n<12;n++)h3e(t,n).push(this.renderMonth(n));return t.map((n,r)=>p.jsx("tr",{children:n},r))}renderMonth(t){const n=this.props.selectedDate;let r="rdtMonth",i;this.isDisabledMonth(t)?r+=" rdtDisabled":i=this._updateSelectedMonth,n&&n.year()===this.props.viewDate.year()&&n.month()===t&&(r+=" rdtActive");let o={key:t,className:r,"data-value":t,onClick:i};return this.props.renderMonth?this.props.renderMonth(o,t,this.props.viewDate.year(),this.props.selectedDate&&this.props.selectedDate.clone()):p.jsx("td",{...o,children:this.getMonthText(t)})}isDisabledMonth(t){let n=this.props.isValidDate;if(!n)return!1;let r=this.props.viewDate.clone().set({month:t}),i=r.endOf("month").date()+1;for(;i-- >1;)if(n(r.date(i)))return!1;return!0}getMonthText(t){const n=this.props.viewDate,r=n.localeData().monthsShort(n.month(t));return p3e(r.substring(0,3))}}function h3e(e,t){return t<4?e[0]:t<8?e[1]:e[2]}function p3e(e){return e.charAt(0).toUpperCase()+e.slice(1)}const O9=class O9 extends C.Component{constructor(){super(...arguments),this.disabledYearsCache={},this._updateSelectedYear=t=>{this.props.updateDate(t)}}render(){return p.jsxs("div",{className:"rdtYears",children:[p.jsx("table",{children:p.jsx("thead",{children:this.renderNavigation()})}),p.jsx("table",{children:p.jsx("tbody",{children:this.renderYears()})})]})}renderNavigation(){const t=this.getViewYear();return p.jsx(Xm,{onClickPrev:()=>this.props.navigate(-10,"years"),onClickSwitch:()=>this.props.showView("years"),onClickNext:()=>this.props.navigate(10,"years"),switchContent:`${t}-${t+9}`})}renderYears(){const t=this.getViewYear();let n=[[],[],[]];for(let r=t-1;r<t+11;r++)g3e(n,r-t).push(this.renderYear(r));return n.map((r,i)=>p.jsx("tr",{children:r},i))}renderYear(t){const n=this.getSelectedYear();let r="rdtYear",i;this.isDisabledYear(t)?r+=" rdtDisabled":i=this._updateSelectedYear,n===t&&(r+=" rdtActive");let o={key:t,className:r,"data-value":t,onClick:i};return this.props.renderYear(o,t,this.props.selectedDate&&this.props.selectedDate.clone())}getViewYear(){return parseInt(this.props.viewDate.year()/10,10)*10}getSelectedYear(){return this.props.selectedDate&&this.props.selectedDate.year()}isDisabledYear(t){let n=this.disabledYearsCache;if(n[t]!==void 0)return n[t];let r=this.props.isValidDate;if(!r)return!1;let i=this.props.viewDate.clone().set({year:t}),o=i.endOf("year").dayOfYear()+1;for(;o-- >1;)if(r(i.dayOfYear(o)))return n[t]=!1,!1;return n[t]=!0,!0}};O9.defaultProps={renderYear:(t,n)=>p.jsx("td",{...t,children:n})};let Qm=O9;function g3e(e,t){return t<3?e[0]:t<7?e[1]:e[2]}const ks={YEARS:"years",MONTHS:"months",DAYS:"days",TIME:"time"},Ms=function(){},yh=class yh extends C.Component{constructor(t){super(t),this._renderCalendar=()=>{const n=this.props,r=this.state;let i={viewDate:r.viewDate.clone(),label:n.label,isSecondDatePicker:n.isSecondDatePicker,secondValue:n.secondValue,selectedDate:this.getSelectedDate(),isValidDate:n.isValidDate,updateDate:this._updateDate,others:n.others,onChangeOthers:n.onChangeOthers,reset:this._reset,navigate:this._viewNavigate,moment:Me,showView:this._showView};switch(r.currentView){case ks.YEARS:return i.renderYear=n.renderYear,p.jsx(Qm,{...i});case ks.MONTHS:return i.renderMonth=n.renderMonth,p.jsx(A3e,{...i});case ks.DAYS:return i.renderDay=n.renderDay,i.timeFormat=this.getFormat("time"),i.setTime=this._setTime,i.value=this.props.value,i.disabled=this.props.disabled,p.jsx(O3,{...i});default:return i.renderDay=n.renderDay,i.timeFormat=this.getFormat("time"),i.setTime=this._setTime,i.value=this.props.value,p.jsx(O3,{...i})}},this._showView=(n,r)=>{const i=(r||this.state.viewDate).clone(),o=this.props.onBeforeNavigate(n,this.state.currentView,i);o&&this.state.currentView!==o&&(this.props.onNavigate(o),this.setState({currentView:o}))},this.viewToMethod={days:"date",months:"month",years:"year"},this.nextView={days:"time",months:"days",years:"months"},this._updateDate=n=>{let i=this.state.currentView,o=this.getUpdateOn(this.getFormat("date")),l=this.state.viewDate.clone();l[this.viewToMethod[i]](parseInt(n.target.getAttribute("data-value"),10)),i==="days"&&(l.month(parseInt(n.target.getAttribute("data-month"),10)),l.year(parseInt(n.target.getAttribute("data-year"),10)));let c={viewDate:l};i===o?(c.selectedDate=l.clone(),c.inputValue=l.format(this.getFormat("datetime")),this.props.open===void 0&&this.props.input&&this.props.closeOnSelect&&this._closeCalendar(),this.props.onChange(l.clone())):this._showView(this.nextView[i],l),this.setState(c)},this._viewNavigate=(n,r)=>{let i=this.state.viewDate.clone();i.add(n,r),n>0?this.props.onNavigateForward(n,r):this.props.onNavigateBack(-n,r),this.setState({viewDate:i})},this._setTime=(n,r)=>{let i=(this.getSelectedDate()||this.state.viewDate).clone();i[n](r),this.props.value||this.setState({selectedDate:i,viewDate:i.clone(),inputValue:i.format(this.getFormat("datetime"))}),this.props.onChange(i)},this._reset=()=>{this.props.onChange(void 0)},this._openCalendar=()=>{this.isOpen()||this.setState({open:!0},this.props.onOpen)},this._closeCalendar=()=>{this.isOpen()&&this.setState({open:!1},()=>{this.props.onClose(this.state.selectedDate||this.state.inputValue)})},this._handleClickOutside=()=>{let n=this.props;n.input&&this.state.open&&n.open===void 0&&n.closeOnClickOutside&&this._closeCalendar()},this._onInputFocus=n=>{this.callHandler(this.props.inputProps.onFocus,n)&&this._openCalendar()},this._onInputChange=n=>{if(!this.callHandler(this.props.inputProps.onChange,n))return;const r=n.target?n.target.value:n,i=this.localMoment(r,this.getFormat("datetime"));let o={inputValue:r};i.isValid()?(o.selectedDate=i,o.viewDate=i.clone().startOf("month")):o.selectedDate=null,this.setState(o,()=>{this.props.onChange(i.isValid()?i:this.state.inputValue)})},this._onInputKeyDown=n=>{this.callHandler(this.props.inputProps.onKeyDown,n)&&n.which===9&&this.props.closeOnTab&&this._closeCalendar()},this._onInputClick=n=>{this.callHandler(this.props.inputProps.onClick,n)&&this._openCalendar()},this.state=this.getInitialState()}render(){return p.jsxs(v3e,{className:this.getClassName(),onClickOut:this._handleClickOutside,children:[this.renderInput(),p.jsx("div",{className:"rdtPicker",children:this.renderView()})]})}renderInput(){if(!this.props.input)return;const t={type:"text",className:"form-control",value:this.getInputValue(),...this.props.inputProps,onFocus:this._onInputFocus,onChange:this._onInputChange,onKeyDown:this._onInputKeyDown,onClick:this._onInputClick};return this.props.renderInput?p.jsx("div",{children:this.props.renderInput(t,this._openCalendar,this._closeCalendar)}):p.jsx("input",{...t})}renderView(){return this.props.renderView(this.state.currentView,this._renderCalendar)}getInitialState(){let t=this.props,n=this.getFormat("datetime"),r=this.parseDate(t.value||t.initialValue,n);return this.checkTZ(),{open:!t.input,currentView:t.initialViewMode||this.getInitialView(),viewDate:this.getInitialViewDate(r),selectedDate:r&&r.isValid()?r:void 0,inputValue:this.getInitialInputValue(r)}}getInitialViewDate(t){const n=this.props.initialViewDate;let r;if(n){if(r=this.parseDate(n,this.getFormat("datetime")),r&&r.isValid())return r;console.log('The initialViewDated given "'+n+'" is not valid. Using current date instead.')}else if(t&&t.isValid())return t.clone();return this.getInitialDate()}getInitialDate(){let t=this.localMoment();return t.hour(0).minute(0).second(0).millisecond(0),t}getInitialView(){const t=this.getFormat("date");return t?this.getUpdateOn(t):ks.TIME}parseDate(t,n){let r;return t&&typeof t=="string"?r=this.localMoment(t,n):t&&(r=this.localMoment(t)),r&&!r.isValid()&&(r=null),r}getClassName(){let t="rdt",n=this.props,r=n.className;return Array.isArray(r)?t+=" "+r.join(" "):r&&(t+=" "+r),n.input||(t+=" rdtStatic"),this.isOpen()&&(t+=" rdtOpen"),t}isOpen(){return!this.props.input||(this.props.open===void 0?this.state.open:this.props.open)}getUpdateOn(t){return this.props.updateOnView?this.props.updateOnView:t.match(/[lLD]/)?ks.DAYS:t.indexOf("M")!==-1?ks.MONTHS:t.indexOf("Y")!==-1?ks.YEARS:ks.DAYS}getLocaleData(){let t=this.props;return this.localMoment(t.value||t.defaultValue||new Date).localeData()}getDateFormat(){const t=this.getLocaleData();let n=this.props.dateFormat;return n===!0?t.longDateFormat("L"):n||""}getTimeFormat(){const t=this.getLocaleData();let n=this.props.timeFormat;return n===!0?t.longDateFormat("LT"):n||""}getFormat(t){if(t==="date")return this.getDateFormat();if(t==="time")return this.getTimeFormat();let n=this.getDateFormat(),r=this.getTimeFormat();return n&&r?n+" "+r:n||r}updateTime(t,n,r,i){let o={};const l=i?"selectedDate":"viewDate";o[l]=this.state[l].clone()[t](n,r),this.setState(o)}localMoment(t,n,r){r=r||this.props;let i=null;return r.utc?i=Me.utc(t,n,r.strictParsing):r.displayTimeZone?i=Me.tz(t,n,r.displayTimeZone):i=Me(t,n,r.strictParsing),r.locale&&i.locale(r.locale),i}checkTZ(){const{displayTimeZone:t}=this.props;t&&!this.tzWarning&&!Me.tz&&(this.tzWarning=!0)}componentDidUpdate(t){if(t===this.props)return;let n=!1,r=this.props;["locale","utc","displayZone","dateFormat","timeFormat"].forEach(function(i){t[i]!==r[i]&&(n=!0)}),n&&this.regenerateDates(),r.value&&r.value!==t.value&&this.setViewDate(r.value),this.checkTZ()}regenerateDates(){const t=this.props;let n=this.state.viewDate.clone(),r=this.state.selectedDate&&this.state.selectedDate.clone();t.locale&&(n.locale(t.locale),r&&r.locale(t.locale)),t.utc?(n.utc(),r&&r.utc()):t.displayTimeZone?(n.tz(t.displayTimeZone),r&&r.tz(t.displayTimeZone)):(n.locale(),r&&r.locale());let i={viewDate:n,selectedDate:r};r&&r.isValid()&&(i.inputValue=r.format(this.getFormat("datetime"))),this.setState(i)}getSelectedDate(){if(this.props.value===void 0)return this.state.selectedDate;let t=this.parseDate(this.props.value,this.getFormat("datetime"));return t&&t.isValid()?t:!1}getInitialInputValue(t){const n=this.props;return n.inputProps.value?n.inputProps.value:t&&t.isValid()?t.format(this.getFormat("datetime")):n.value&&typeof n.value=="string"?n.value:n.initialValue&&typeof n.initialValue=="string"?n.initialValue:""}getInputValue(){let t=this.getSelectedDate();return t?t.format(this.getFormat("datetime")):this.state.inputValue}setViewDate(t){let n=function(){return console.log("Invalid date passed to the `setViewDate` method: "+t)};if(!t)return n();let r;if(typeof t=="string"?r=this.localMoment(t,this.getFormat("datetime")):r=this.localMoment(t),!r||!r.isValid())return n();this.setState({viewDate:r})}navigate(t){this._showView(t)}callHandler(t,n){return t?t(n)!==!1:!0}};yh.defaultProps={onOpen:Ms,onClose:Ms,onCalendarOpen:Ms,onCalendarClose:Ms,onChange:Ms,onNavigate:Ms,onBeforeNavigate:function(t){return t},onNavigateBack:Ms,onNavigateForward:Ms,dateFormat:!0,timeFormat:!0,utc:!1,className:"",input:!0,inputProps:{},timeConstraints:{},isValidDate:function(){return!0},strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,closeOnClickOutside:!0,renderView:(t,n)=>n()},yh.moment=Me;let Km=yh;class m3e extends C.Component{constructor(){super(...arguments),this.container=C.createRef()}render(){return p.jsx("div",{className:this.props.className,ref:this.container,children:this.props.children})}handleClickOutside(t){this.props.onClickOut(t)}setClickOutsideRef(){return this.container.current}}const v3e=a3e(m3e);//! moment.js locale configuration
|
|
1748
1748
|
//! locale : Czech [cs]
|
|
1749
1749
|
//! author : petrbela : https://github.com/petrbela
|
|
1750
1750
|
var y3e={standalone:"leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"),format:"ledna_února_března_dubna_května_června_července_srpna_září_října_listopadu_prosince".split("_"),isFormat:/DD?[o.]?(\[[^\[\]]*\]|\s)+MMMM/},b3e="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),qm=[/^led/i,/^úno/i,/^bře/i,/^dub/i,/^kvě/i,/^(čvn|červen$|června)/i,/^(čvc|červenec|července)/i,/^srp/i,/^zář/i,/^říj/i,/^lis/i,/^pro/i],CR=/^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i;function ou(e){return e>1&&e<5&&~~(e/10)!==1}function _i(e,t,n,r){var i=e+" ";switch(n){case"s":return t||r?"pár sekund":"pár sekundami";case"ss":return t||r?i+(ou(e)?"sekundy":"sekund"):i+"sekundami";case"m":return t?"minuta":r?"minutu":"minutou";case"mm":return t||r?i+(ou(e)?"minuty":"minut"):i+"minutami";case"h":return t?"hodina":r?"hodinu":"hodinou";case"hh":return t||r?i+(ou(e)?"hodiny":"hodin"):i+"hodinami";case"d":return t||r?"den":"dnem";case"dd":return t||r?i+(ou(e)?"dny":"dní"):i+"dny";case"M":return t||r?"měsíc":"měsícem";case"MM":return t||r?i+(ou(e)?"měsíce":"měsíců"):i+"měsíci";case"y":return t||r?"rok":"rokem";case"yy":return t||r?i+(ou(e)?"roky":"let"):i+"lety"}}Me.defineLocale("cs",{months:y3e,monthsShort:b3e,monthsRegex:CR,monthsShortRegex:CR,monthsStrictRegex:/^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i,monthsShortStrictRegex:/^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,monthsParse:qm,longMonthsParse:qm,shortMonthsParse:qm,weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm",l:"D. M. YYYY"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s:_i,ss:_i,m:_i,mm:_i,h:_i,hh:_i,d:_i,dd:_i,M:_i,MM:_i,y:_i,yy:_i},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}});//! moment.js locale configuration
|
|
@@ -1995,7 +1995,7 @@ var x3e="január_február_marec_apríl_máj_jún_júl_august_september_október_
|
|
|
1995
1995
|
`,E3e="DD.MM.YYYY",k3e=({name:e,value:t,initialViewDate:n,error:r,label:i,disabled:o,isValidDate:l,onChange:c,dateFormat:d=E3e,timeFormat:f=!1,open:A,secondValue:g=null,input:v,icon:y=!0,showInputLabel:w=!1,showCalendarLabel:S=!0,spaceAround:E=!1,className:I,onClear:M,onInputChange:L,...D})=>{const P=`${d}${f?` ${f}`:""}`,j=!!t&&Me(t,P,!0).isValid(),N=j?Me(t,P).format(P):t,W=C.useContext(Ug),_=C.useCallback((ee,oe)=>p.jsx($a,{type:"text",icon:y?"calendar":void 0,name:e,error:r,disabled:o,isInvalid:!!r,onChange:L,label:w?i:void 0,value:N,onFocus:oe,iconOnClick:oe,onClear:M,autoComplete:"off"}),[e,N,r,i,w,j,o]),X=C.useCallback((ee,oe)=>i&&!w?p.jsx(Be.div,{display:"flex",flexDirection:"column",children:oe()}):oe(),[i,w]),B=C.useCallback(ee=>{var ae;const oe=typeof ee=="string"?ee:(ae=ee==null?void 0:ee.toDate)==null?void 0:ae.call(ee);c==null||c(oe)},[c]),H=C.useCallback((ee,oe)=>{var q,ce;const ae=[(q=ee==null?void 0:ee.toDate)==null?void 0:q.call(ee),(ce=oe==null?void 0:oe.toDate)==null?void 0:ce.call(oe)];return l?l(...ae):!0},[l]);return p.jsx(ms,{spaceAround:E,children:p.jsx(I3e,{className:I,children:p.jsx(Km,{value:t,dateFormat:d,timeFormat:f,secondValue:g,open:A,input:v,label:S?i:void 0,onChange:B,isValidDate:H,renderView:X,renderInput:_,initialViewDate:n,locale:W,disabled:o,...D})})})},P3=C.memo(k3e),wR=e=>typeof e=="string"?new Date(e):e||void 0,M3e=e=>{const t=wR(e==null?void 0:e[0]),n=wR(e==null?void 0:e[1]);return[t,n]},L3e=(e,t)=>e&&e.getTime&&t&&t.getTime&&e.getTime()===t.getTime(),O3e=(e=[],t)=>{var n,r;return(n=t==null?void 0:t[0])!=null&&n.dateTypeRepeater||(r=t==null?void 0:t[1])!=null&&r.dateTypeRepeater?t.map((i,o)=>{if(!(i!=null&&i.dateTypeRepeater))return e[o]&&Ze.fromJSDate(e[o]).toFormat("dd.LL.yyyy HH:mm");const l=Jm[i==null?void 0:i.dateTypeRepeater],c=o===0?mR.from:mR.to,d=i!=null&&i.time?`${String(i==null?void 0:i.time.h).padStart(2,"0")}:${String(i==null?void 0:i.time.m).padStart(2,"0")}`:"";return`${c} ${l} ${d}`.trim()}).filter(Boolean).join(" - "):!e[0]&&!e[1]?"":e[0]&&!e[1]||L3e(e[0],e[1])?Ze.fromJSDate(e[0]).toFormat("dd.LL.yyyy"):e.map(i=>i&&Ze.fromJSDate(i).toFormat("dd.LL.yyyy HH:mm")).join(" - ")},P3e=U.div`
|
|
1996
1996
|
display: inline-flex;
|
|
1997
1997
|
margin-right: 20px;
|
|
1998
|
-
`,T3e=({children:e})=>p.jsx("div",{children:e}),D3e=e=>{const{onChange:t,error:n,label:r,value:i,others:o,filterTime:l,initialView:c,OverlayComponent:d=T3e,...f}=e,[A,g]=C.useState((i==null?void 0:i[0])??void 0),[v,y]=C.useState((i==null?void 0:i[1])??void 0),w=l?"HH:mm":!1,S=Re._({id:"dataGrid.filterCell",message:"Type to filter"}),E=C.useMemo(()=>M3e(i),[i]),I=C.useMemo(()=>{if(E[0]&&E[1])return E;const ae=new Date;ae.setHours(0,0,0,0);const q=new Date;return c==="future"?q.setMonth(q.getMonth()+1):ae.setMonth(ae.getMonth()),[E[0]||ae,E[1]||q]},[E,c]),[M,L]=C.useState(!1),D=C.useCallback(ae=>{g(ae),t([ae,E[1]],o)},[t,o,E]),P=C.useCallback(ae=>{y(ae),t([E[0],ae],o)},[t,o,E]),j=C.useCallback(ae=>{t(E,[ae,o==null?void 0:o[1]])},[t,E,o]),N=C.useCallback(ae=>{t(E,[o==null?void 0:o[0],ae])},[t,E,o]),W=C.useCallback(()=>{L(!0)},[L]),_=C.useCallback(()=>{t([],[]),g(void 0),y(void 0)},[t]),X=C.useCallback(ae=>!E[1]||Ze.fromJSDate(E[1])>=Ze.fromJSDate(ae),[E]),B=C.useCallback(ae=>!E[0]||Ze.fromJSDate(ae)>=Ze.fromJSDate(E[0]),[E]),H=C.useCallback(()=>{L(!1)},[]),ee=E[1]===null?E[0]:E[1],oe=Io({onClose:H});return p.jsxs("div",{ref:oe,children:[p.jsx($a,{name:e.name,placeholder:S,type:"text",icon:"calendar",value:O3e(E,o),label:e.label,onFocus:W,iconOnClick:W,onClear:_,error:n,readOnly:!0}),p.jsx(d,{children:p.jsx(p.Fragment,{children:M&&p.jsxs(P3e,{className:"ignore-element-for-closing-hook",children:[p.jsx(P3,{...f,timeFormat:w,value:E[0]??"",initialViewDate:I[0],secondValue:v,onChange:D,others:o==null?void 0:o[0],onChangeOthers:j,icon:!1,label:M&&Re._({id:"dataGrid.filterCell.from",message:"From"}),isValidDate:X,input:!1,spaceAround:!0,open:!0}),p.jsx(P3,{...f,timeFormat:w,value:ee,initialViewDate:I[1],secondValue:A,onChange:P,others:o==null?void 0:o[1],onChangeOthers:N,icon:!1,label:M&&Re._({id:"dataGrid.filterCell.to",message:"To"}),isValidDate:B,input:!1,spaceAround:!0,open:!0,isSecondDatePicker:!0})]})})})]})},lu=e=>{const t=C.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return C.useLayoutEffect(()=>{t.current=e}),C.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.apply(null,n)},[])},B3e=U.ul`
|
|
1998
|
+
`,T3e=({children:e})=>p.jsx("div",{children:e}),D3e=e=>{const{onChange:t,error:n,label:r,value:i,others:o,filterTime:l,initialView:c,OverlayComponent:d=T3e,...f}=e,[A,g]=C.useState((i==null?void 0:i[0])??void 0),[v,y]=C.useState((i==null?void 0:i[1])??void 0),w=l?"HH:mm":!1,S=Re._({id:"dataGrid.filterCell",message:"Type to filter"}),E=C.useMemo(()=>M3e(i),[i]),I=C.useMemo(()=>{if(E[0]&&E[1])return E;const ae=new Date;ae.setHours(0,0,0,0);const q=new Date;return q.setHours(23,59,59,0),c==="future"?q.setMonth(q.getMonth()+1):ae.setMonth(ae.getMonth()),[E[0]||ae,E[1]||q]},[E,c]),[M,L]=C.useState(!1),D=C.useCallback(ae=>{g(ae),t([ae,E[1]],o)},[t,o,E]),P=C.useCallback(ae=>{y(ae),t([E[0],ae],o)},[t,o,E]),j=C.useCallback(ae=>{t(E,[ae,o==null?void 0:o[1]])},[t,E,o]),N=C.useCallback(ae=>{t(E,[o==null?void 0:o[0],ae])},[t,E,o]),W=C.useCallback(()=>{L(!0)},[L]),_=C.useCallback(()=>{t([],[]),g(void 0),y(void 0)},[t]),X=C.useCallback(ae=>!E[1]||Ze.fromJSDate(E[1])>=Ze.fromJSDate(ae),[E]),B=C.useCallback(ae=>!E[0]||Ze.fromJSDate(ae)>=Ze.fromJSDate(E[0]),[E]),H=C.useCallback(()=>{L(!1)},[]),ee=E[1]===null?E[0]:E[1],oe=Io({onClose:H});return p.jsxs("div",{ref:oe,children:[p.jsx($a,{name:e.name,placeholder:S,type:"text",icon:"calendar",value:O3e(E,o),label:e.label,onFocus:W,iconOnClick:W,onClear:_,error:n,readOnly:!0}),p.jsx(d,{children:p.jsx(p.Fragment,{children:M&&p.jsxs(P3e,{className:"ignore-element-for-closing-hook",children:[p.jsx(P3,{...f,timeFormat:w,value:E[0]??"",initialViewDate:I[0],secondValue:v,onChange:D,others:o==null?void 0:o[0],onChangeOthers:j,icon:!1,label:M&&Re._({id:"dataGrid.filterCell.from",message:"From"}),isValidDate:X,input:!1,spaceAround:!0,open:!0}),p.jsx(P3,{...f,timeFormat:w,value:ee,initialViewDate:I[1],secondValue:A,onChange:P,others:o==null?void 0:o[1],onChangeOthers:N,icon:!1,label:M&&Re._({id:"dataGrid.filterCell.to",message:"To"}),isValidDate:B,input:!1,spaceAround:!0,open:!0,isSecondDatePicker:!0})]})})})]})},lu=e=>{const t=C.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return C.useLayoutEffect(()=>{t.current=e}),C.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.apply(null,n)},[])},B3e=U.ul`
|
|
1999
1999
|
background-color: white;
|
|
2000
2000
|
box-shadow: dropShadow;
|
|
2001
2001
|
border-radius: 10px;
|