@licklist/design 0.44.485-dev.38 → 0.44.485-dev.39
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/dist/notification/sms-template/control/SmsTemplateControl.d.ts.map +1 -1
- package/dist/notification/sms-template/control/SmsTemplateControl.js +1 -1
- package/dist/notification/sms-template/form/SmsTemplateForm.d.ts +1 -0
- package/dist/notification/sms-template/form/SmsTemplateForm.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/notification/sms-template/control/SmsTemplateControl.tsx +2 -0
- package/src/notification/sms-template/form/SmsTemplateForm.stories.tsx +7 -0
- package/src/notification/sms-template/form/SmsTemplateForm.tsx +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmsTemplateControl.d.ts","sourceRoot":"","sources":["../../../../src/notification/sms-template/control/SmsTemplateControl.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wEAAwE,CAAC;AAK1G,KAAK,uBAAuB,GAAG;IAC7B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,kBAAkB,2BAE5B,uBAAuB,
|
|
1
|
+
{"version":3,"file":"SmsTemplateControl.d.ts","sourceRoot":"","sources":["../../../../src/notification/sms-template/control/SmsTemplateControl.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wEAAwE,CAAC;AAK1G,KAAK,uBAAuB,GAAG;IAC7B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,kBAAkB,2BAE5B,uBAAuB,gBAqJzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=e(require("react")),o=require("react-i18next"),l=require("react-bootstrap"),a=require("react-hook-form"),n=e(require("@licklist/plugins/dist/services/Form/HookFormService")),i=300;exports.SmsTemplateControl=function(e){var s,m,d=e.notificationTypes,u=void 0===d?[]:d,c=o.useTranslation(["Design"]).t,p=a.useFormContext(),g=p.register,y=p.watch,b=p.formState.errors,E=p.setError,f=p.clearErrors,v=y("body");return r.createElement(r.Fragment,null,r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col,controlId:"type",xs:!0,sm:12,md:8,lg:10,xl:12},r.createElement(l.Form.Label,null,c("type")),r.createElement(l.Form.Control,t.__assign({as:"select"},g("type",{required:c("Validation:fieldRequired",{attribute:c("type")})}),{name:"type",required:!0,isInvalid:Boolean(b.type),placeholder:c("Design:type")}),r.createElement("option",{value:""},c("Design:choose")),u.map((function(e){return r.createElement("option",{key:e,value:e},c("Design:".concat(e)))}))),r.createElement(l.Form.Control.Feedback,{type:"invalid"},null===(s=b.type)||void 0===s?void 0:s.message))),r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col,controlId:"formGroupName",xs:!0,sm:12,md:8,lg:10,xl:12},r.createElement(l.Form.Label,null,c("templateName")),r.createElement(l.Form.Control,t.__assign({},g("name",{max:255,required:c("Validation:fieldRequired",{attribute:c("name")})}),{placeholder:c("Design:templateName"),isInvalid:Boolean(null==b?void 0:b.name)})),r.createElement(l.Form.Control.Feedback,{type:"invalid"},null===(m=b.name)||void 0===m?void 0:m.message))),r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col,xs:!0,sm:12,md:8,lg:10,xl:12,controlId:"formGroupBdoy"},r.createElement(l.Form.Label,null,c("Design:smsBody")),r.createElement(l.Form.Control,t.__assign({isInvalid:Boolean(b.body),as:"textarea",rows:3},g("body",{required:!0,maxLength:i,validate:function(){return!!v.length&&(v.length>i?(E("body",{type:"maxLength",message:c("Validation:fieldMaxLength",{attribute:c("Design:smsBody"),max:i})}),!1):(f("body"),!0))}}),{placeholder:c("Design:smsBody")})),(null==v?void 0:v.length)?!n.hasError(b.body,"maxLength")&&r.createElement("span",{className:"sms-template-body-left-symbols"},c("Design:symbolsLeft")," ",i-(null==v?void 0:v.length)," (",c("Design:max"),": ",i,")"):null,r.createElement(l.Form.Control.Feedback,{type:"invalid"},n.hasError(b.body,"required")&&c("Validation:fieldRequired",{attribute:c("Design:smsBody")}),n.hasError(b.body,"maxLength")&&c("Validation:fieldMaxLength",{attribute:c("Design:smsBody"),max:i})))),r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col},r.createElement(l.Form.Check,t.__assign({},g("isActive"),{name:"isActive",label:c("Design:active"),id:"formGroupIsActive",custom:!0})),r.createElement(l.Form.Check,t.__assign({},g("isDefault"),{name:"isDefault",label:c("Design:defaultTemplateForTheType"),id:"formGroupIsDefault",custom:!0})))))};
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=e(require("react")),o=require("react-i18next"),l=require("react-bootstrap"),a=require("react-hook-form"),n=e(require("@licklist/plugins/dist/services/Form/HookFormService")),i=300;exports.SmsTemplateControl=function(e){var s,m,d=e.notificationTypes,u=void 0===d?[]:d,c=o.useTranslation(["Design"]).t,p=a.useFormContext(),g=p.register,y=p.watch,b=p.formState.errors,E=p.setError,f=p.clearErrors,v=y("body"),F=y("id");return r.createElement(r.Fragment,null,r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col,controlId:"type",xs:!0,sm:12,md:8,lg:10,xl:12},r.createElement(l.Form.Label,null,c("type")),r.createElement(l.Form.Control,t.__assign({as:"select"},g("type",{required:c("Validation:fieldRequired",{attribute:c("type")})}),{name:"type",required:!0,isInvalid:Boolean(b.type),placeholder:c("Design:type"),disabled:!!F}),r.createElement("option",{value:""},c("Design:choose")),u.map((function(e){return r.createElement("option",{key:e,value:e},c("Design:".concat(e)))}))),r.createElement(l.Form.Control.Feedback,{type:"invalid"},null===(s=b.type)||void 0===s?void 0:s.message))),r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col,controlId:"formGroupName",xs:!0,sm:12,md:8,lg:10,xl:12},r.createElement(l.Form.Label,null,c("templateName")),r.createElement(l.Form.Control,t.__assign({},g("name",{max:255,required:c("Validation:fieldRequired",{attribute:c("name")})}),{placeholder:c("Design:templateName"),isInvalid:Boolean(null==b?void 0:b.name)})),r.createElement(l.Form.Control.Feedback,{type:"invalid"},null===(m=b.name)||void 0===m?void 0:m.message))),r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col,xs:!0,sm:12,md:8,lg:10,xl:12,controlId:"formGroupBdoy"},r.createElement(l.Form.Label,null,c("Design:smsBody")),r.createElement(l.Form.Control,t.__assign({isInvalid:Boolean(b.body),as:"textarea",rows:3},g("body",{required:!0,maxLength:i,validate:function(){return!!v.length&&(v.length>i?(E("body",{type:"maxLength",message:c("Validation:fieldMaxLength",{attribute:c("Design:smsBody"),max:i})}),!1):(f("body"),!0))}}),{placeholder:c("Design:smsBody")})),(null==v?void 0:v.length)?!n.hasError(b.body,"maxLength")&&r.createElement("span",{className:"sms-template-body-left-symbols"},c("Design:symbolsLeft")," ",i-(null==v?void 0:v.length)," (",c("Design:max"),": ",i,")"):null,r.createElement(l.Form.Control.Feedback,{type:"invalid"},n.hasError(b.body,"required")&&c("Validation:fieldRequired",{attribute:c("Design:smsBody")}),n.hasError(b.body,"maxLength")&&c("Validation:fieldMaxLength",{attribute:c("Design:smsBody"),max:i})))),r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col},r.createElement(l.Form.Check,t.__assign({},g("isActive"),{name:"isActive",label:c("Design:active"),id:"formGroupIsActive",custom:!0})),r.createElement(l.Form.Check,t.__assign({},g("isDefault"),{name:"isDefault",label:c("Design:defaultTemplateForTheType"),id:"formGroupIsDefault",custom:!0})))))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmsTemplateForm.d.ts","sourceRoot":"","sources":["../../../../src/notification/sms-template/form/SmsTemplateForm.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE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iB,CAAC;IAClC,YAAY,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACzC,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACxC;AAED,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACb,QAAQ,EACR,aAAoB,EACpB,YAAiB,EACjB,YAAY,EACZ,iBAAsB,GACvB,EAAE,gBAAgB,eAyBlB"}
|
package/package.json
CHANGED
|
@@ -26,6 +26,7 @@ export const SmsTemplateControl = ({
|
|
|
26
26
|
} = useFormContext<SmsTemplateValues>();
|
|
27
27
|
|
|
28
28
|
const smsBody = watch("body");
|
|
29
|
+
const id = watch("id");
|
|
29
30
|
|
|
30
31
|
return (
|
|
31
32
|
<>
|
|
@@ -44,6 +45,7 @@ export const SmsTemplateControl = ({
|
|
|
44
45
|
required
|
|
45
46
|
isInvalid={Boolean(errors.type)}
|
|
46
47
|
placeholder={t("Design:type")}
|
|
48
|
+
disabled={!!id}
|
|
47
49
|
>
|
|
48
50
|
<option value="">{t("Design:choose")}</option>
|
|
49
51
|
{notificationTypes.map((key) => (
|