@licklist/design 0.58.6-dev.4 → 0.58.6-dev.6
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/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
- package/dist/snippet/snippet-template/control/PropertyControl.d.ts +2 -1
- package/dist/snippet/snippet-template/control/PropertyControl.d.ts.map +1 -1
- package/dist/snippet/snippet-template/control/PropertyControl.js +1 -1
- package/package.json +1 -3
- package/src/product-set/product/ProductControl.tsx +8 -5
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +4 -18
- package/src/snippet/snippet-template/control/PropertyControl.tsx +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product/ProductControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAMb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,
|
|
1
|
+
{"version":3,"file":"ProductControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product/ProductControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAMb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EACL,WAAW,EAEZ,MAAM,0DAA0D,CAAC;AAGlE,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAEtE,OAAc,EACZ,WAAW,EAKZ,MAAM,OAAO,CAAC;AAgBf,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAC;AAO9D,OAAO,EAEL,oCAAoC,EACpC,qCAAqC,EACtC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,iCAAiC,CAAC;AAQzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQ5C,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,2BAA2B,EAC3B,qCAAqC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CACpC,SAAQ,gBAAgB,EACtB,mBAAmB,CAAC,CAAC,CAAC,EACtB,oCAAoC,CAAC,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mBAAmB,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,EACnD,SAAiB,EACjB,eAAe,EACf,aAAqB,EACrB,oBAA4B,EAC5B,QAAa,EACb,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,WAAmB,GACpB,EAAE,mBAAmB,CAAC,CAAC,CAAC,eAwlBxB"}
|
|
@@ -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"),a=require("react"),n=e(a),r=require("react-i18next"),o=e(require("react-bootstrap/Row")),i=e(require("react-bootstrap/Col")),l=require("react-bootstrap"),c=require("../../static/Icon.js"),s=require("react-hook-form"),d=e(require("@licklist/plugins/dist/services/Form/HookFormService")),m=require("@react-aria/utils"),u=e(require("clsx")),p=require("../../static/switch/BooleanSwitch.js"),E=require("../../static/form-number-input/FormNumberInput.js");require("../../static/index.js");var g=require("../form/context.js"),f=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),C=require("@licklist/core/dist/DataMapper/Product/ProductDataMapper"),v=require("./booking-management/ProductBookingManagementControl.js"),b=require("./deposit/ProductDepositControl.js"),h=require("./quantity/ProductQuantityControl.js"),P=require("./quantity/ProductQuantityConstantControl.js"),I=require("./quantity/ProductQuantityRechargingControl.js"),N=e(require("react-bootstrap/Collapse")),F=require("@licklist/plugins/dist/hooks/Media/useImages"),q=require("@licklist/core/dist/DataMapper/Media/ImageDataMapper"),T=require("../../file-upload/FileUpload.js");require("../../snippet/snippet-template/context/snippetTemplate.js"),require("../../snippet/snippet-template/context/snippetTemplateLoading.js"),require("../../snippet/snippet-template/context/snippetTemplateView.js");var y=require("../../snippet/snippet-template/control/PropertyControl.js");require("../../snippet/snippet-template/form/SnippetTemplateForm.js");var x=require("../../tiptap-editor/TipTapEditor.js");require("../../snippet/snippet-template/settings/SettingButton.js"),require("../../snippet/snippet-template/preview/Preview.js"),require("../../snippet/snippet-template/SnippetTemplate.js");var _=require("./fixed-duration-fields/FixedDurationOptions.js"),k=require("./duration/ProductDurationControl.js"),S=require("./price/ProductPriceControl.js"),D=require("./constants.js");exports.ProductControl=function(e){var j=e.isLoading,L=void 0!==j&&j,A=e.fieldNamePrefix,w=e.allowDeposits,R=void 0!==w&&w,M=e.hasBookingManagement,O=void 0!==M&&M,G=e.zoneList,U=void 0===G?[]:G,B=e.onCopy,Y=e.onProductNameChange,V=e.productName,Q=e.hasTicket,H=e.categoryType,X=e.zoneDuration,z=e.isOverrides,W=void 0!==z&&z,Z=s.useFormContext(),J=Z.register,K=Z.control,$=Z.formState.errors,ee=Z.setValue,te=Z.getValues,ae=Z.watch,ne=Z.trigger,re=Z.clearErrors,oe=a.useContext(g.ProductSetLoadingContext).setLoading,ie=r.useTranslation(["Design","Validation"]).t,le=t.__read(a.useState(!1),2),ce=le[0],se=le[1],de=t.__read(a.useState(null),2),me=de[0],ue=de[1],pe=Boolean(ae("".concat(A,".isUnlimited"))),Ee=ae("".concat(A,".capacity")),ge="0"===Ee||!Ee,fe=m.useId(),Ce=m.useId(),ve=m.useId(),be=m.useId(),he=m.useId(),Pe=m.useId(),Ie=m.useId(),Ne=m.useId(),Fe=m.useId(),qe=m.useId(),Te=m.useId(),ye=[{id:1,value:ie("quantitySelector")},{id:2,value:ie("stockControl")}],xe=a.useCallback((function(){return se((function(e){return!e}))}),[]),_e=s.useWatch({control:K,name:"".concat(A,".quantitySelector")}),ke=F.useImages(me),Se=ke.images,De=ke.handleImageRemove,je=ke.handleImageUploading,Le=ke.isLoading,Ae=a.useCallback((function(e){je(e,q.IMAGE_TYPE_IMAGE)}),[je]),we=a.useCallback((function(e,t){De(String(e),t)}),[De]),Re=function(e){return e.target.select()};a.useEffect((function(){oe(Le)}),[oe,Le]),a.useEffect((function(){var e=te("".concat(A,".images"));ue(e)}),[te,ue,A]),a.useEffect((function(){Array.isArray(Se)&&ee("".concat(A,".images"),Se)}),[Se,A,ee]),a.useEffect((function(){ge?(ee("".concat(A,".duration"),0),re("".concat(A,".duration"))):ne("".concat(A,".duration"))}),[ge]);var Me=null!=_e?_e:"1",Oe=f.QUANTITY_TYPE_LIST_DTO[Me];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(i,{lg:8,md:8},n.createElement(l.Form.Group,{controlId:Ce},n.createElement(l.Form.Label,null,ie("name")),n.createElement(l.Form.Control,t.__assign({},J("".concat(A,".name")),{value:V,onChange:Y,isInvalid:d.isInvalid("".concat(A,".name"),$),disabled:L||W,placeholder:ie("name")})),n.createElement(l.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(A,".name"),$))),n.createElement(l.Form.Group,{controlId:ve},n.createElement(l.Form.Label,null,ie("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(x.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:L||W})},rules:{maxLength:{value:D.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH,message:ie("Validation:descriptionTooManyCharactersMessage",{max:D.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH})}},control:K,name:"".concat(A,".description")})),n.createElement("div",{className:"invalid-feedback field-values-error d-block"},d.getErrors("".concat(A,".description"),$)),R?n.createElement(o,null,n.createElement(b.ProductDepositControl,{isLoading:L,fieldNamePrefix:A}),n.createElement(S.ProductPriceControl,{isLoading:L,fieldNamePrefix:"".concat(A,".price"),title:ie("totalPrice"),allowDeposits:R})):n.createElement(S.ProductPriceControl,{isLoading:L,fieldNamePrefix:"".concat(A,".price")}),n.createElement("div",null,n.createElement(h.ProductQuantityControl,{isLoading:L,fieldNamePrefix:A,isOverrides:W,onFocus:Re}),Oe===f.QUANTITY_TYPE_CONSTANT&&n.createElement(P.ProductQuantityConstantControl,{isLoading:L,fieldNamePrefix:A,onFocus:Re,disabled:pe}),Oe===f.QUANTITY_TYPE_RECHARGING&&n.createElement(I.ProductQuantityRechargingControl,{isLoading:L,fieldNamePrefix:A,onFocus:Re,disabled:pe}),n.createElement(l.Form.Group,{controlId:qe,className:"custom-checkbox"},n.createElement(l.Form.Check,t.__assign({custom:!0,type:"checkbox"},J("".concat(A,".isUnlimited")),{name:"".concat(A,".isUnlimited"),disabled:L})),n.createElement(l.Form.Check.Label,null,ie("isUnlimited")))),n.createElement(l.Form.Group,{controlId:Ne},n.createElement(l.Form.Label,null,ie("quantitySelectorType")),n.createElement(l.Form.Control,t.__assign({as:"select",defaultValue:Q?ye[0].id:void 0},J("".concat(A,".quantitySelector")),{isInvalid:d.isInvalid("".concat(A,".quantitySelector"),$),disabled:L||Q||W}),ye.map((function(e){return n.createElement("option",{value:e.id,key:e.id},e.value)}))),n.createElement(l.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(A,".quantitySelector"),$))),n.createElement(y.PropertyControl,{item:"".concat(A,".color"),label:"Select Color",isDisabled:W,defaultColors:C.PRODUCT_DEfAULT_COLORS}))),H===f.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start duration-capacity-container"},n.createElement(k.ProductDurationControl,{fieldNamePrefix:A,disabled:ge||W}),n.createElement(i,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(A,".capacity"),label:ie("capacity"),disabled:W,rules:{min:{value:0,message:ie("Validation:fieldMinNumber",{attribute:ie("capacity"),min:0})}}})),ge&&n.createElement("div",{className:"duration-hint duration-capacity-container"},ie("Design:forDurationEditing"))),H===f.CATEGORY_TYPE_GAME&&n.createElement(n.Fragment,null,n.createElement(o,{className:"align-items-start duration-capacity-container"},n.createElement(i,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(A,".capacity"),label:ie("capacity"),onChange:function(e){X&&ee("".concat(A,".duration"),e*X)},disabled:W,rules:{min:{value:0,message:ie("Validation:fieldMinNumber",{attribute:ie("capacity"),min:1})}}})),n.createElement(i,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(A,".duration"),label:ie("durationMinutes"),disabled:ge||W,rules:{min:{value:0,message:ie("Validation:fieldMinNumber",{attribute:ie("duration"),min:0})},validate:function(e){return!(!ge&&(!e||e<1))||ie("Validation:fieldRequired",{attribute:ie("duration")})}}}))),ge&&n.createElement("div",{className:"duration-hint pl-0"},ie("Design:forDurationEditing"))),n.createElement(o,{className:"mt-4"},n.createElement(i,{lg:8,md:8},n.createElement(l.Form.Group,{controlId:be},n.createElement(l.Form.Label,null,ie("productTermsConditions")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name,i=t.ref;return n.createElement(l.Form.Control,{ref:i,as:"textarea",rows:3,value:a,onChange:r,isInvalid:d.isInvalid("".concat(A,".termsAndConditions"),$),disabled:L||W,name:o})},control:K,name:"".concat(A,".termsAndConditions")}),n.createElement(l.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(A,".termsAndConditions"),$)))),n.createElement(i,{lg:4,md:4,className:u("licklist-file-upload-wrapper",W&&"opacity-50")},n.createElement(T.FileUpload,{onFilesChange:Ae,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:we,defaultFiles:Se,isLoading:Le,disabled:W,withIcon:!0,title:ie("addImage")}))),n.createElement(i,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(l.Form.Group,{controlId:he,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ie("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(p.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:L||W})},control:K,name:"".concat(A,".isAvailable")})),n.createElement(l.Form.Group,{controlId:Pe,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ie("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(p.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:L})},control:K,name:"".concat(A,".isSoldOut")})),n.createElement(l.Form.Group,{controlId:fe,className:"custom-checkbox"},n.createElement(l.Form.Check,{custom:!0,type:"checkbox",name:fe,disabled:L||W},n.createElement(l.Form.Check.Input,{checked:ce,onChange:xe,type:"checkbox"}),n.createElement(l.Form.Check.Label,null,ie("showAdvancedOptions"))))),n.createElement(i,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(N,{in:ce},n.createElement("div",null,n.createElement(l.Form.Group,{controlId:Ie,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ie("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(p.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:L||W})},control:K,name:"".concat(A,".isRequired")})),n.createElement(l.Form.Group,{controlId:Fe,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ie("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(p.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:L||W})},control:K,name:"".concat(A,".hasSpecialNotes")})),[f.CATEGORY_TYPE_GAME,f.CATEGORY_TYPE_FIXED_DURATION].includes(H)&&n.createElement(_.FixedDurationOptions,{fieldNamePrefix:A,isOverrides:W}),n.createElement(l.Form.Group,{controlId:Te,className:"advanced-switch-container"},n.createElement(S.ProductPriceControl,{title:ie("minSpend"),isRequired:!1,isMoreThanZero:!0,allowDeposits:!1,isLoading:L||W,fieldNamePrefix:"".concat(A,".minSpend")})))),n.createElement(o,null,n.createElement(i,{xs:12},O&&n.createElement(v.ProductBookingManagementControl,{isLoading:L,zoneList:U,fieldNamePrefix:A})))),n.createElement(o,null,n.createElement(i,{xs:!0},n.createElement("div",{className:"d-flex justify-content-end mt-4"},Boolean(B)&&n.createElement(l.Button,{onClick:B,variant:"link",className:"d-flex align-items-center"},n.createElement(c.default,{type:"clipboard",height:"1rem",className:"mr-2"})," ",ie("copy"))))))};
|
|
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"),a=require("react"),n=e(a),r=require("react-i18next"),o=e(require("react-bootstrap/Row")),i=e(require("react-bootstrap/Col")),l=require("react-bootstrap"),c=require("../../static/Icon.js"),s=require("react-hook-form"),d=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=require("@react-aria/utils"),m=e(require("clsx")),p=require("../../static/switch/BooleanSwitch.js"),E=require("../../static/form-number-input/FormNumberInput.js");require("../../static/index.js");var g=require("../form/context.js"),f=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),C=require("@licklist/core/dist/DataMapper/Product/ProductDataMapper"),v=require("./booking-management/ProductBookingManagementControl.js"),b=require("./deposit/ProductDepositControl.js"),h=require("./quantity/ProductQuantityControl.js"),P=require("./quantity/ProductQuantityConstantControl.js"),I=require("./quantity/ProductQuantityRechargingControl.js"),N=e(require("react-bootstrap/Collapse")),F=require("@licklist/plugins/dist/hooks/Media/useImages"),q=require("@licklist/core/dist/DataMapper/Media/ImageDataMapper"),T=require("../../file-upload/FileUpload.js");require("../../snippet/snippet-template/context/snippetTemplate.js"),require("../../snippet/snippet-template/context/snippetTemplateLoading.js"),require("../../snippet/snippet-template/context/snippetTemplateView.js");var y=require("../../snippet/snippet-template/control/PropertyControl.js");require("../../snippet/snippet-template/form/SnippetTemplateForm.js");var x=require("../../tiptap-editor/TipTapEditor.js");require("../../snippet/snippet-template/settings/SettingButton.js"),require("../../snippet/snippet-template/preview/Preview.js"),require("../../snippet/snippet-template/SnippetTemplate.js");var _=require("./fixed-duration-fields/FixedDurationOptions.js"),k=require("./duration/ProductDurationControl.js"),S=require("./price/ProductPriceControl.js"),D=require("./constants.js");exports.ProductControl=function(e){var j=e.isLoading,L=void 0!==j&&j,A=e.fieldNamePrefix,R=e.allowDeposits,w=void 0!==R&&R,M=e.hasBookingManagement,O=void 0!==M&&M,G=e.zoneList,U=void 0===G?[]:G,B=e.onCopy,Y=e.onProductNameChange,V=e.productName,Q=e.hasTicket,H=e.categoryType,X=e.zoneDuration,z=e.isOverrides,W=void 0!==z&&z,Z=s.useFormContext(),J=Z.register,K=Z.control,$=Z.formState.errors,ee=Z.setValue,te=Z.getValues,ae=Z.watch,ne=Z.trigger,re=Z.clearErrors,oe=a.useContext(g.ProductSetLoadingContext).setLoading,ie=r.useTranslation(["Design","Validation","ProductSet"]).t,le=t.__read(a.useState(!1),2),ce=le[0],se=le[1],de=t.__read(a.useState(null),2),ue=de[0],me=de[1],pe=Boolean(ae("".concat(A,".isUnlimited"))),Ee=ae("".concat(A,".capacity")),ge="0"===Ee||!Ee,fe=u.useId(),Ce=u.useId(),ve=u.useId(),be=u.useId(),he=u.useId(),Pe=u.useId(),Ie=u.useId(),Ne=u.useId(),Fe=u.useId(),qe=u.useId(),Te=u.useId(),ye=[{id:1,value:ie("quantitySelector")},{id:2,value:ie("stockControl")}],xe=a.useCallback((function(){return se((function(e){return!e}))}),[]),_e=s.useWatch({control:K,name:"".concat(A,".quantitySelector")}),ke=F.useImages(ue),Se=ke.images,De=ke.handleImageRemove,je=ke.handleImageUploading,Le=ke.isLoading,Ae=a.useCallback((function(e){je(e,q.IMAGE_TYPE_IMAGE)}),[je]),Re=a.useCallback((function(e,t){De(String(e),t)}),[De]),we=function(e){return e.target.select()};a.useEffect((function(){oe(Le)}),[oe,Le]),a.useEffect((function(){var e=te("".concat(A,".images"));me(e)}),[te,me,A]),a.useEffect((function(){Array.isArray(Se)&&ee("".concat(A,".images"),Se)}),[Se,A,ee]),a.useEffect((function(){ge?(ee("".concat(A,".duration"),0),re("".concat(A,".duration"))):ne("".concat(A,".duration"))}),[ge]);var Me=null!=_e?_e:"1",Oe=f.QUANTITY_TYPE_LIST_DTO[Me];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(i,{lg:8,md:8},n.createElement(l.Form.Group,{controlId:Ce},n.createElement(l.Form.Label,null,ie("name")),n.createElement(l.Form.Control,t.__assign({},J("".concat(A,".name")),{value:V,onChange:Y,isInvalid:d.isInvalid("".concat(A,".name"),$),disabled:L||W,placeholder:ie("name")})),n.createElement(l.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(A,".name"),$))),n.createElement(l.Form.Group,{controlId:ve},n.createElement(l.Form.Label,null,ie("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(x.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:L||W})},rules:{maxLength:{value:D.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH,message:ie("Validation:descriptionTooManyCharactersMessage",{max:D.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH})}},control:K,name:"".concat(A,".description")})),n.createElement("div",{className:"invalid-feedback field-values-error d-block"},d.getErrors("".concat(A,".description"),$)),w?n.createElement(o,null,n.createElement(b.ProductDepositControl,{isLoading:L,fieldNamePrefix:A}),n.createElement(S.ProductPriceControl,{isLoading:L,fieldNamePrefix:"".concat(A,".price"),title:ie("totalPrice"),allowDeposits:w})):n.createElement(S.ProductPriceControl,{isLoading:L,fieldNamePrefix:"".concat(A,".price")}),n.createElement("div",null,n.createElement(h.ProductQuantityControl,{isLoading:L,fieldNamePrefix:A,isOverrides:W,onFocus:we}),Oe===f.QUANTITY_TYPE_CONSTANT&&n.createElement(P.ProductQuantityConstantControl,{isLoading:L,fieldNamePrefix:A,onFocus:we,disabled:pe}),Oe===f.QUANTITY_TYPE_RECHARGING&&n.createElement(I.ProductQuantityRechargingControl,{isLoading:L,fieldNamePrefix:A,onFocus:we,disabled:pe}),n.createElement(l.Form.Group,{controlId:qe,className:"custom-checkbox"},n.createElement(l.Form.Check,t.__assign({custom:!0,type:"checkbox"},J("".concat(A,".isUnlimited")),{name:"".concat(A,".isUnlimited"),disabled:L})),n.createElement(l.Form.Check.Label,null,ie("isUnlimited")))),n.createElement(l.Form.Group,{controlId:Ne},n.createElement(l.Form.Label,null,ie("quantitySelectorType")),n.createElement(l.Form.Control,t.__assign({as:"select",defaultValue:Q?ye[0].id:void 0},J("".concat(A,".quantitySelector")),{isInvalid:d.isInvalid("".concat(A,".quantitySelector"),$),disabled:L||Q||W}),ye.map((function(e){return n.createElement("option",{value:e.id,key:e.id},e.value)}))),n.createElement(l.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(A,".quantitySelector"),$))),n.createElement(y.PropertyControl,{item:"".concat(A,".color"),label:ie("ProductSet:selectColor"),isDisabled:W,isRequired:!1,defaultColors:C.PRODUCT_DEfAULT_COLORS}))),H===f.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start duration-capacity-container"},n.createElement(k.ProductDurationControl,{fieldNamePrefix:A,disabled:ge||W}),n.createElement(i,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(A,".capacity"),label:ie("capacity"),disabled:W,rules:{min:{value:0,message:ie("Validation:fieldMinNumber",{attribute:ie("capacity"),min:0})}}})),ge&&n.createElement("div",{className:"duration-hint duration-capacity-container"},ie("Design:forDurationEditing"))),H===f.CATEGORY_TYPE_GAME&&n.createElement(n.Fragment,null,n.createElement(o,{className:"align-items-start duration-capacity-container"},n.createElement(i,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(A,".capacity"),label:ie("capacity"),onChange:function(e){X&&ee("".concat(A,".duration"),e*X)},disabled:W,rules:{min:{value:0,message:ie("Validation:fieldMinNumber",{attribute:ie("capacity"),min:1})}}})),n.createElement(i,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(A,".duration"),label:ie("durationMinutes"),disabled:ge||W,rules:{min:{value:0,message:ie("Validation:fieldMinNumber",{attribute:ie("duration"),min:0})},validate:function(e){return!(!ge&&(!e||e<1))||ie("Validation:fieldRequired",{attribute:ie("duration")})}}}))),ge&&n.createElement("div",{className:"duration-hint pl-0"},ie("Design:forDurationEditing"))),n.createElement(o,{className:"mt-4"},n.createElement(i,{lg:8,md:8},n.createElement(l.Form.Group,{controlId:be},n.createElement(l.Form.Label,null,ie("productTermsConditions")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name,i=t.ref;return n.createElement(l.Form.Control,{ref:i,as:"textarea",rows:3,value:a,onChange:r,isInvalid:d.isInvalid("".concat(A,".termsAndConditions"),$),disabled:L||W,name:o})},control:K,name:"".concat(A,".termsAndConditions")}),n.createElement(l.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(A,".termsAndConditions"),$)))),n.createElement(i,{lg:4,md:4,className:m("licklist-file-upload-wrapper",W&&"opacity-50")},n.createElement(T.FileUpload,{onFilesChange:Ae,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:Re,defaultFiles:Se,isLoading:Le,disabled:W,withIcon:!0,title:ie("addImage")}))),n.createElement(i,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(l.Form.Group,{controlId:he,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ie("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(p.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:L||W})},control:K,name:"".concat(A,".isAvailable")})),n.createElement(l.Form.Group,{controlId:Pe,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ie("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(p.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:L})},control:K,name:"".concat(A,".isSoldOut")})),n.createElement(l.Form.Group,{controlId:fe,className:"custom-checkbox"},n.createElement(l.Form.Check,{custom:!0,type:"checkbox",name:fe,disabled:L||W},n.createElement(l.Form.Check.Input,{checked:ce,onChange:xe,type:"checkbox"}),n.createElement(l.Form.Check.Label,null,ie("showAdvancedOptions"))))),n.createElement(i,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(N,{in:ce},n.createElement("div",null,n.createElement(l.Form.Group,{controlId:Ie,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ie("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(p.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:L||W})},control:K,name:"".concat(A,".isRequired")})),n.createElement(l.Form.Group,{controlId:Fe,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ie("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(p.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:L||W})},control:K,name:"".concat(A,".hasSpecialNotes")})),[f.CATEGORY_TYPE_GAME,f.CATEGORY_TYPE_FIXED_DURATION].includes(H)&&n.createElement(_.FixedDurationOptions,{fieldNamePrefix:A,isOverrides:W}),n.createElement(l.Form.Group,{controlId:Te,className:"advanced-switch-container"},n.createElement(S.ProductPriceControl,{title:ie("minSpend"),isRequired:!1,isMoreThanZero:!0,allowDeposits:!1,isLoading:L||W,fieldNamePrefix:"".concat(A,".minSpend")})))),n.createElement(o,null,n.createElement(i,{xs:12},O&&n.createElement(v.ProductBookingManagementControl,{isLoading:L,zoneList:U,fieldNamePrefix:A})))),n.createElement(o,null,n.createElement(i,{xs:!0},n.createElement("div",{className:"d-flex justify-content-end mt-4"},Boolean(B)&&n.createElement(l.Button,{onClick:B,variant:"link",className:"d-flex align-items-center"},n.createElement(c.default,{type:"clipboard",height:"1rem",className:"mr-2"})," ",ie("copy"))))))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkingHoursInputDescription.d.ts","sourceRoot":"","sources":["../../../src/provider/working-hours-input/WorkingHoursInputDescription.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"WorkingHoursInputDescription.d.ts","sourceRoot":"","sources":["../../../src/provider/working-hours-input/WorkingHoursInputDescription.tsx"],"names":[],"mappings":";AAOA,wBAAgB,4BAA4B,gBA4B3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-i18next"),o=require("react-bootstrap"),u=require("react-hook-form"),a=require("./utils.js");exports.WorkingHoursInputDescription=function(){var e=(0,u.useFormContext().watch)("workingHours"),t=a.useWeekdays("short"),l=n.useTranslation("Design").t;return e?r.createElement(r.Fragment,null,Array.from({length:t.length},(function(e,t){return t})).filter((function(t){var r;return null===(r=null==e?void 0:e[t])||void 0===r?void 0:r.start})).map((function(n){var u=null==e?void 0:e[n];return r.createElement(o.Row,{key:n},r.createElement(o.Col,{xs:"auto"},t[n],":"),r.createElement(o.Col,null,l("timeInterval",{start:u.start,end:u.end})))}))):null};
|
|
@@ -5,6 +5,7 @@ export interface PropertyControlProps<T> {
|
|
|
5
5
|
label: string;
|
|
6
6
|
isDisabled?: boolean;
|
|
7
7
|
defaultColors?: Array<string>;
|
|
8
|
+
isRequired?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare function PropertyControl<T>({ item, label, isDisabled, defaultColors, }: PropertyControlProps<T>): JSX.Element;
|
|
10
|
+
export declare function PropertyControl<T>({ item, label, isDisabled, defaultColors, isRequired, }: PropertyControlProps<T>): JSX.Element;
|
|
10
11
|
//# sourceMappingURL=PropertyControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyControl.d.ts","sourceRoot":"","sources":["../../../../src/snippet/snippet-template/control/PropertyControl.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAkB,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAmBvD,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"PropertyControl.d.ts","sourceRoot":"","sources":["../../../../src/snippet/snippet-template/control/PropertyControl.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAkB,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAmBvD,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,EACjC,IAAI,EACJ,KAAK,EACL,UAAkB,EAClB,aAAa,EACb,UAAiB,GAClB,EAAE,oBAAoB,CAAC,CAAC,CAAC,eA0EzB"}
|
|
@@ -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 r=require("tslib"),t=require("react"),o=e(t),i=require("react-i18next"),a=require("react-bootstrap"),l=require("react-hook-form"),n=e(require("@licklist/plugins/dist/services/Form/HookFormService")),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("react"),o=e(t),i=require("react-i18next"),a=require("react-bootstrap"),l=require("react-hook-form"),n=e(require("@licklist/plugins/dist/services/Form/HookFormService")),s=require("react-color"),c=["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF","#FFFFFF","#000000"];exports.PropertyControl=function(e){var u,d=e.item,m=e.label,v=e.isDisabled,F=void 0!==v&&v,p=e.defaultColors,f=e.isRequired,C=void 0===f||f,b=i.useTranslation(["Validation"]).t,E=r.__read(t.useState(!1),2),k=E[0],_=E[1],q=l.useFormContext(),g=q.watch,x=q.register,y=q.setValue,B=q.formState,N=q.formState.errors,h=g(d),D=t.useCallback((function(e){return n.isFieldValid(B,N,e)}),[B,N]),S=function(){_((function(e){return!e}))};return o.createElement(a.Form.Group,{className:"position-relative color-picker"},o.createElement(a.Form.Label,{className:"mt-2"},m),o.createElement("div",{className:"position-relative"},o.createElement(a.Form.Control,r.__assign({},x(d,{required:{value:C,message:b("Validation:fieldRequired",{attribute:m})}}),{isValid:D(d),isInvalid:n.isInvalid(d,N),disabled:F,onFocus:S})),o.createElement("div",{className:"color-picker__color",style:{backgroundColor:null!==(u=String(h))&&void 0!==u?u:""}})),k&&o.createElement("div",{className:"color-picker__popover"},o.createElement("div",{className:"color-picker__cover vh-100 vw-100",onClick:S,onKeyPress:S,role:"button",tabIndex:0}),o.createElement(s.TwitterPicker,{color:null!=h?h:"",onChangeComplete:function(e){y(d,e.hex),S()},colors:p||c})),o.createElement(a.Form.Control.Feedback,{type:"invalid"},n.getErrors(d,N)))};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@licklist/design",
|
|
3
|
-
"version": "0.58.6-dev.
|
|
3
|
+
"version": "0.58.6-dev.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
|
|
@@ -116,7 +116,6 @@
|
|
|
116
116
|
"emojibase": "6.1.0",
|
|
117
117
|
"emojibase-data": "7.0.1",
|
|
118
118
|
"emojibase-regex": "6.0.1",
|
|
119
|
-
"enzyme": "3.11.0",
|
|
120
119
|
"eslint": "7.32.0",
|
|
121
120
|
"eslint-config-airbnb": "18.2.1",
|
|
122
121
|
"eslint-config-prettier": "8.3.0",
|
|
@@ -188,7 +187,6 @@
|
|
|
188
187
|
"devDependencies": {
|
|
189
188
|
"@types/react": "17.0.2",
|
|
190
189
|
"@types/react-dom": "17.0.2",
|
|
191
|
-
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
|
|
192
190
|
"identity-obj-proxy": "^3.0.0"
|
|
193
191
|
},
|
|
194
192
|
"volta": {
|
|
@@ -7,7 +7,10 @@ import {
|
|
|
7
7
|
QUANTITY_TYPE_LIST_DTO,
|
|
8
8
|
QUANTITY_TYPE_RECHARGING,
|
|
9
9
|
} from "@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
ProductType,
|
|
12
|
+
PRODUCT_DEfAULT_COLORS,
|
|
13
|
+
} from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
11
14
|
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
12
15
|
import clsx from "clsx";
|
|
13
16
|
import {
|
|
@@ -36,7 +39,7 @@ import {
|
|
|
36
39
|
} from "react-hook-form";
|
|
37
40
|
import { useTranslation } from "react-i18next";
|
|
38
41
|
import { useImages } from "@licklist/plugins/dist/hooks/Media/useImages";
|
|
39
|
-
|
|
42
|
+
|
|
40
43
|
import {
|
|
41
44
|
Image,
|
|
42
45
|
IMAGE_TYPE_IMAGE,
|
|
@@ -69,7 +72,6 @@ import { ProductDurationControl } from "./duration";
|
|
|
69
72
|
import { ProductPriceControl } from "./price";
|
|
70
73
|
import { MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH } from "./constants";
|
|
71
74
|
|
|
72
|
-
|
|
73
75
|
// TO DO refactor this file
|
|
74
76
|
// and add correct types
|
|
75
77
|
export interface ProductControlValues
|
|
@@ -148,7 +150,7 @@ export function ProductControl<T extends FormValues>({
|
|
|
148
150
|
} = useFormContext<T>();
|
|
149
151
|
|
|
150
152
|
const { setLoading } = useContext(ProductSetLoadingContext);
|
|
151
|
-
const { t } = useTranslation(["Design", "Validation"]);
|
|
153
|
+
const { t } = useTranslation(["Design", "Validation", "ProductSet"]);
|
|
152
154
|
const [expanded, setExpanded] = useState(false);
|
|
153
155
|
const [initialImages, setInitialImages] = useState<Image[] | null>(null);
|
|
154
156
|
// @TODO: After checking "isUnlimited" checkbox need to reset field totalQuantity
|
|
@@ -396,8 +398,9 @@ export function ProductControl<T extends FormValues>({
|
|
|
396
398
|
|
|
397
399
|
<PropertyControl<T>
|
|
398
400
|
item={`${fieldNamePrefix}.color` as Path<T>}
|
|
399
|
-
label={"
|
|
401
|
+
label={t("ProductSet:selectColor")}
|
|
400
402
|
isDisabled={isOverrides}
|
|
403
|
+
isRequired={false}
|
|
401
404
|
defaultColors={PRODUCT_DEfAULT_COLORS}
|
|
402
405
|
/>
|
|
403
406
|
</Col>
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { DateTime } from "luxon";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { Col, Row } from "react-bootstrap";
|
|
4
3
|
import { useFormContext } from "react-hook-form";
|
|
5
4
|
import { useTranslation } from "react-i18next";
|
|
6
|
-
import { TIME_FORMAT } from "@licklist/core/dist/Config";
|
|
7
5
|
import { WorkingHoursInputValues } from ".";
|
|
8
6
|
import { useWeekdays } from "./utils";
|
|
9
7
|
|
|
@@ -25,22 +23,10 @@ export function WorkingHoursInputDescription() {
|
|
|
25
23
|
<Row key={i}>
|
|
26
24
|
<Col xs="auto">{weekdays[i]}:</Col>
|
|
27
25
|
<Col>
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
TIME_FORMAT
|
|
33
|
-
),
|
|
34
|
-
end: DateTime.fromISO(weekday.start).toFormat(
|
|
35
|
-
TIME_FORMAT
|
|
36
|
-
),
|
|
37
|
-
})
|
|
38
|
-
: t("timeFrom", {
|
|
39
|
-
start: DateTime.fromISO(weekday.start).toFormat(
|
|
40
|
-
TIME_FORMAT
|
|
41
|
-
),
|
|
42
|
-
})
|
|
43
|
-
: null}
|
|
26
|
+
{t("timeInterval", {
|
|
27
|
+
start: weekday.start,
|
|
28
|
+
end: weekday.end,
|
|
29
|
+
})}
|
|
44
30
|
</Col>
|
|
45
31
|
</Row>
|
|
46
32
|
);
|
|
@@ -25,6 +25,7 @@ export interface PropertyControlProps<T> {
|
|
|
25
25
|
label: string;
|
|
26
26
|
isDisabled?: boolean;
|
|
27
27
|
defaultColors?: Array<string>;
|
|
28
|
+
isRequired?: boolean;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export function PropertyControl<T>({
|
|
@@ -32,6 +33,7 @@ export function PropertyControl<T>({
|
|
|
32
33
|
label,
|
|
33
34
|
isDisabled = false,
|
|
34
35
|
defaultColors,
|
|
36
|
+
isRequired = true,
|
|
35
37
|
}: PropertyControlProps<T>) {
|
|
36
38
|
const { t } = useTranslation(["Validation"]);
|
|
37
39
|
|
|
@@ -64,7 +66,7 @@ export function PropertyControl<T>({
|
|
|
64
66
|
<Form.Control
|
|
65
67
|
{...register(item, {
|
|
66
68
|
required: {
|
|
67
|
-
value:
|
|
69
|
+
value: isRequired,
|
|
68
70
|
message: t("Validation:fieldRequired", {
|
|
69
71
|
attribute: label,
|
|
70
72
|
}),
|