@licklist/design 0.44.486-dev.12 → 0.44.486-dev.13
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/zone/form/components/GameDurationControl.d.ts +7 -0
- package/dist/zone/form/components/GameDurationControl.d.ts.map +1 -0
- package/dist/zone/form/components/GameDurationControl.js +1 -0
- package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneControl.js +1 -1
- package/package.json +1 -1
- package/src/zone/form/components/GameDurationControl.tsx +46 -0
- package/src/zone/form/components/ZoneControl.tsx +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GameDurationControl.d.ts","sourceRoot":"","sources":["../../../../src/zone/form/components/GameDurationControl.tsx"],"names":[],"mappings":";AAQA,KAAK,wBAAwB,GAAG;IAC9B,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,mBAAmB,mBAE7B,wBAAwB,gBA+B1B,CAAC"}
|
|
@@ -0,0 +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=e(require("react")),i=require("react-i18next"),a=require("react-bootstrap"),o=require("react-hook-form"),n=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=require("@react-aria/utils");exports.GameDurationControl=function(e){var l=e.isLoading,s=u.useId(),d=i.useTranslation(["Design","Validation"]).t,m=o.useFormContext(),c=m.register,f=m.formState.errors;return t.createElement(a.Form.Group,{controlId:s},t.createElement(a.Form.Label,null,d("Design:gameDefaultDuration")),t.createElement(a.Form.Control,r.__assign({type:"number"},c("defaultDuration",{required:!1,min:1}),{placeholder:d("Design:duration"),isInvalid:Boolean(f.defaultDuration),disabled:l})),t.createElement(a.Form.Control.Feedback,{type:"invalid"},n.hasError(f.defaultDuration,"min")&&d("Validation:fieldMinNumber",{attribute:d("Design:gameDefaultDuration"),min:1})))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZoneControl.d.ts","sourceRoot":"","sources":["../../../../src/zone/form/components/ZoneControl.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;
|
|
1
|
+
{"version":3,"file":"ZoneControl.d.ts","sourceRoot":"","sources":["../../../../src/zone/form/components/ZoneControl.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAStF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,WAAW,8BAGrB,gBAAgB,gBA0BlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),o=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,t=require("react-bootstrap"),n=require("./NameControl.js"),l=require("./ZoneTypeControl.js"),a=require("./SortControl.js"),i=require("./ZoneRecurrencesControl.js"),s=require("./DescriptionControl.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),o=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,t=require("react-bootstrap"),n=require("./NameControl.js"),l=require("./ZoneTypeControl.js"),a=require("./SortControl.js"),i=require("./ZoneRecurrencesControl.js"),s=require("./DescriptionControl.js"),m=require("./ZoneImageControl.js"),c=require("./GameDurationControl.js");exports.ZoneControl=function(e){var r=e.isLoading,u=e.workHours,C=void 0===u?[]:u;return o.createElement(t.Row,null,o.createElement(t.Col,{md:6,sm:12,className:"pr-5"},o.createElement(n.NameControl,{isLoading:r}),o.createElement(i.ZoneRecurrencesControl,{workHours:C,isLoading:r}),o.createElement("hr",null),o.createElement(t.Row,null,o.createElement(t.Col,{md:6,sm:6},o.createElement(l.ZoneTypeControl,{isLoading:r}),o.createElement(a.SortControl,{isLoading:r}),o.createElement(c.GameDurationControl,{isLoading:r})),o.createElement(t.Col,{md:6,sm:6},o.createElement(m.ZoneImageControl,{isLoading:r}))),o.createElement("hr",null),o.createElement(t.Row,null,o.createElement(t.Col,{md:12,sm:12},o.createElement(s.DescriptionControl,{isLoading:r})))))};
|
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import { Form } from "react-bootstrap";
|
|
4
|
+
import { useFormContext } from "react-hook-form";
|
|
5
|
+
import { useId } from "@react-aria/utils";
|
|
6
|
+
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
7
|
+
import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
|
|
8
|
+
|
|
9
|
+
type GameDurationControlProps = {
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const GameDurationControl = ({
|
|
14
|
+
isLoading,
|
|
15
|
+
}: GameDurationControlProps) => {
|
|
16
|
+
const nameId = useId();
|
|
17
|
+
const { t } = useTranslation(["Design", "Validation"]);
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
register,
|
|
21
|
+
formState: { errors },
|
|
22
|
+
} = useFormContext<Pick<Zone, "defaultDuration">>();
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Form.Group controlId={nameId}>
|
|
26
|
+
<Form.Label>{t("Design:gameDefaultDuration")}</Form.Label>
|
|
27
|
+
<Form.Control
|
|
28
|
+
type="number"
|
|
29
|
+
{...register("defaultDuration", {
|
|
30
|
+
required: false,
|
|
31
|
+
min: 1,
|
|
32
|
+
})}
|
|
33
|
+
placeholder={t("Design:duration")}
|
|
34
|
+
isInvalid={Boolean(errors.defaultDuration)}
|
|
35
|
+
disabled={isLoading}
|
|
36
|
+
/>
|
|
37
|
+
<Form.Control.Feedback type="invalid">
|
|
38
|
+
{HookFormService.hasError(errors.defaultDuration, "min") &&
|
|
39
|
+
t("Validation:fieldMinNumber", {
|
|
40
|
+
attribute: t("Design:gameDefaultDuration"),
|
|
41
|
+
min: 1,
|
|
42
|
+
})}
|
|
43
|
+
</Form.Control.Feedback>
|
|
44
|
+
</Form.Group>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -7,6 +7,7 @@ import { SortControl } from "./SortControl";
|
|
|
7
7
|
import { ZoneRecurrencesControl } from "./ZoneRecurrencesControl";
|
|
8
8
|
import { DescriptionControl } from "./DescriptionControl";
|
|
9
9
|
import { ZoneImageControl } from "./ZoneImageControl";
|
|
10
|
+
import { GameDurationControl } from "./GameDurationControl";
|
|
10
11
|
|
|
11
12
|
export type ZoneControlProps = {
|
|
12
13
|
isLoading: boolean;
|
|
@@ -27,6 +28,7 @@ export const ZoneControl = ({
|
|
|
27
28
|
<Col md={6} sm={6}>
|
|
28
29
|
<ZoneTypeControl isLoading={isLoading} />
|
|
29
30
|
<SortControl isLoading={isLoading} />
|
|
31
|
+
<GameDurationControl isLoading={isLoading} />
|
|
30
32
|
</Col>
|
|
31
33
|
<Col md={6} sm={6}>
|
|
32
34
|
<ZoneImageControl isLoading={isLoading} />
|