@licklist/design 0.44.486-dev.20 → 0.44.486-dev.21
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecurrenceIntervalAndFrequencyInput.d.ts","sourceRoot":"","sources":["../../src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAkB,MAAM,iBAAiB,CAAC;AAIlE,UAAU,wCAAwC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,IAAI,CACnB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;IACF,YAAY,CAAC,EAAE,IAAI,CACjB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;CACH;AAED,iBAAS,mCAAmC,CAAC,EAC3C,QAAgB,EAChB,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,GACb,EAAE,wCAAwC,
|
|
1
|
+
{"version":3,"file":"RecurrenceIntervalAndFrequencyInput.d.ts","sourceRoot":"","sources":["../../src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAkB,MAAM,iBAAiB,CAAC;AAIlE,UAAU,wCAAwC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,IAAI,CACnB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;IACF,YAAY,CAAC,EAAE,IAAI,CACjB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;CACH;AAED,iBAAS,mCAAmC,CAAC,EAC3C,QAAgB,EAChB,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,GACb,EAAE,wCAAwC,eAmJ1C;AAED,eAAe,mCAAmC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),a=require("react"),l=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),a=require("react"),l=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,r=require("@licklist/core/dist/Config"),n=require("react-i18next"),i=require("react-bootstrap"),o=require("react-hook-form"),m=require("luxon");exports.default=function(e){var s,d,u,c,f=e.disabled,v=void 0!==f&&f,D=e.minDate,E=e.startDateLabel,F=e.startTimeLabel,b=e.endDateLabel,g=e.endTimeLabel,T=e.startTimeRules,p=e.endTimeRules,_=n.useTranslation(["Design","Notification","App"]).t,C=o.useFormContext(),y=C.getValues,q=C.formState.errors,L=C.register,h=C.trigger,x=y("startDate"),S=y("endDate"),V=y("startTime"),k=y("endTime");return a.useEffect((function(){x&&S&&h("endDate")}),[x]),a.useEffect((function(){V&&k&&h("endTime")}),[V]),l.createElement(l.Fragment,null,l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=E?E:_("Design:fromDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},L("startDate",{required:!0}),{defaultValue:x,className:x&&"date-input-with-value",disabled:v,min:D,isInvalid:Boolean(q.startDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(s=q.startDate)||void 0===s?void 0:s.message))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=b?b:_("Design:toDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},L("endDate",{required:!0,validate:function(e){if(!x||!e)return!0;var t=m.DateTime.fromFormat(x,r.DATE_FORMAT);return m.DateTime.fromFormat(e,r.DATE_FORMAT).diff(t,["days"]).days>=0||"".concat(_("Validation:fieldLaterDate",{attribute:_("Design:endDateSmall"),min:_("Design:startDateSmall")}))}}),{defaultValue:S,className:S&&"date-input-with-value",disabled:v,min:x||void 0,isInvalid:Boolean(q.endDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(d=q.endDate)||void 0===d?void 0:d.message)))),l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=F?F:_("Design:availableFrom")),l.createElement(i.Form.Control,t.__assign({type:"time"},L("startTime",t.__assign({required:!1},T)),{placeholder:"hh:mm",defaultValue:V,disabled:v,isInvalid:Boolean(q.startTime)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(u=q.startTime)||void 0===u?void 0:u.message))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=g?g:_("Design:availableTo")),l.createElement(i.Form.Control,t.__assign({type:"time"},L("endTime",t.__assign({required:!1,validate:function(e){var t;if(!V||!e)return!0;var a=m.DateTime.fromISO(V),l=m.DateTime.fromISO(e);return(null===(t=null==l?void 0:l.diff(a,["minutes"]))||void 0===t?void 0:t.minutes)>=0||"".concat(_("Validation:fieldLaterDate",{attribute:_("Design:endTimeSmall"),min:_("Design:startTimeSmall")}))}},p)),{placeholder:"hh:mm",defaultValue:k,disabled:v,isInvalid:Boolean(q.endTime)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(c=q.endTime)||void 0===c?void 0:c.message)))))};
|
package/package.json
CHANGED
|
@@ -40,7 +40,6 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
40
40
|
formState: { errors },
|
|
41
41
|
register,
|
|
42
42
|
trigger,
|
|
43
|
-
setValue,
|
|
44
43
|
} = useFormContext<RecurringDatePickerInputValues>();
|
|
45
44
|
|
|
46
45
|
const startDate = getValues("startDate");
|
|
@@ -132,9 +131,6 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
132
131
|
<Form.Control
|
|
133
132
|
type="time"
|
|
134
133
|
{...register("startTime", { required: false, ...startTimeRules })}
|
|
135
|
-
onChange={({ target: { value } }) => {
|
|
136
|
-
setValue("startTime", `${value}:00`, { shouldValidate: true });
|
|
137
|
-
}}
|
|
138
134
|
placeholder="hh:mm"
|
|
139
135
|
defaultValue={startTime}
|
|
140
136
|
disabled={disabled}
|
|
@@ -160,8 +156,8 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
160
156
|
const currentStartTime = DateTime.fromISO(startTime);
|
|
161
157
|
const currentEndTime = DateTime.fromISO(time);
|
|
162
158
|
|
|
163
|
-
return currentEndTime?.diff(currentStartTime, ["
|
|
164
|
-
?.
|
|
159
|
+
return currentEndTime?.diff(currentStartTime, ["minutes"])
|
|
160
|
+
?.minutes >= 0
|
|
165
161
|
? true
|
|
166
162
|
: `${t(`Validation:fieldLaterDate`, {
|
|
167
163
|
attribute: t("Design:endTimeSmall"),
|
|
@@ -170,9 +166,6 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
170
166
|
},
|
|
171
167
|
...endTimeRules,
|
|
172
168
|
})}
|
|
173
|
-
onChange={({ target: { value } }) => {
|
|
174
|
-
setValue("endTime", `${value}:59`, { shouldValidate: true });
|
|
175
|
-
}}
|
|
176
169
|
placeholder="hh:mm"
|
|
177
170
|
defaultValue={endTime}
|
|
178
171
|
disabled={disabled}
|