@licklist/design 0.67.5-dev.0 → 0.67.5-dev.1
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/provider/working-hours-input/WorkingHoursInput.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInput.js +2 -2
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +5 -8
- package/dist/recurring-date-picker-input/utils.d.ts +2 -2
- package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/utils.js +15 -4
- package/package.json +2 -2
- package/src/provider/working-hours-input/WorkingHoursInput.tsx +15 -6
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +11 -16
- package/src/recurring-date-picker-input/utils.ts +17 -6
- package/yarn.lock +707 -716
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkingHoursInput.d.ts","sourceRoot":"","sources":["../../../src/provider/working-hours-input/WorkingHoursInput.tsx"],"names":[],"mappings":"AAWA,wBAAgB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"WorkingHoursInput.d.ts","sourceRoot":"","sources":["../../../src/provider/working-hours-input/WorkingHoursInput.tsx"],"names":[],"mappings":"AAWA,wBAAgB,iBAAiB,4CA0FhC"}
|
|
@@ -113,7 +113,7 @@ function _object_spread_props(target, source) {
|
|
|
113
113
|
className: "align-items-baseline",
|
|
114
114
|
children: [
|
|
115
115
|
/*#__PURE__*/ jsx(Col, {
|
|
116
|
-
className: "h5 text-lg-right mb-4 mb-lg-0",
|
|
116
|
+
className: "h5 text-lg-right text-nowrap mb-4 mb-lg-0",
|
|
117
117
|
xs: "12",
|
|
118
118
|
lg: "2",
|
|
119
119
|
children: name
|
|
@@ -166,7 +166,7 @@ function _object_spread_props(target, source) {
|
|
|
166
166
|
]
|
|
167
167
|
})
|
|
168
168
|
]
|
|
169
|
-
},
|
|
169
|
+
}, name));
|
|
170
170
|
})
|
|
171
171
|
]
|
|
172
172
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkingHoursInputDescription.d.ts","sourceRoot":"","sources":["../../../src/provider/working-hours-input/WorkingHoursInputDescription.tsx"],"names":[],"mappings":"AAMA,wBAAgB,4BAA4B,
|
|
1
|
+
{"version":3,"file":"WorkingHoursInputDescription.d.ts","sourceRoot":"","sources":["../../../src/provider/working-hours-input/WorkingHoursInputDescription.tsx"],"names":[],"mappings":"AAMA,wBAAgB,4BAA4B,4CAuB3C"}
|
|
@@ -15,12 +15,9 @@ function WorkingHoursInputDescription() {
|
|
|
15
15
|
length: weekdays.length
|
|
16
16
|
}, function(_, i) {
|
|
17
17
|
return i;
|
|
18
|
-
}).
|
|
19
|
-
var
|
|
20
|
-
return
|
|
21
|
-
}).map(function(i) {
|
|
22
|
-
var weekday = values === null || values === void 0 ? void 0 : values[i];
|
|
23
|
-
return /*#__PURE__*/ jsxs(Row, {
|
|
18
|
+
}).map(function(i) {
|
|
19
|
+
var _values_i_start, _values_i_end;
|
|
20
|
+
return jsxs(Row, {
|
|
24
21
|
children: [
|
|
25
22
|
/*#__PURE__*/ jsxs(Col, {
|
|
26
23
|
xs: "auto",
|
|
@@ -31,8 +28,8 @@ function WorkingHoursInputDescription() {
|
|
|
31
28
|
}),
|
|
32
29
|
/*#__PURE__*/ jsx(Col, {
|
|
33
30
|
children: t("timeInterval", {
|
|
34
|
-
start:
|
|
35
|
-
end:
|
|
31
|
+
start: (_values_i_start = values === null || values === void 0 ? void 0 : values[i].start) !== null && _values_i_start !== void 0 ? _values_i_start : "00:00",
|
|
32
|
+
end: (_values_i_end = values === null || values === void 0 ? void 0 : values[i].end) !== null && _values_i_end !== void 0 ? _values_i_end : "23:59"
|
|
36
33
|
})
|
|
37
34
|
})
|
|
38
35
|
]
|
|
@@ -17,7 +17,7 @@ export declare const parseAndValidateRRule: ({ rrule, date, }: {
|
|
|
17
17
|
rrule: string;
|
|
18
18
|
date: string;
|
|
19
19
|
}) => ParsedRRuleOptions;
|
|
20
|
-
export declare const useWorkHoursValidation: (byWeekDay: Weekday[],
|
|
21
|
-
validate?: Validate<string>;
|
|
20
|
+
export declare const useWorkHoursValidation: (byWeekDay: Weekday[], _workHours: WorkHour[] | undefined, timeZone: string) => {
|
|
21
|
+
validate?: Validate<string, any>;
|
|
22
22
|
};
|
|
23
23
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/recurring-date-picker-input/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAGtF,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAElD,eAAO,MAAM,sBAAsB,yBAGhC;IACD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;CACtB,KAAG,OAWH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,SAAS,CAAC,KAAK,GACf,SAAS,CAAC,MAAM,GAChB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,MAAM,CAAC;AAErB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,qBAAqB,qBAG/B;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,KAoEM,kBACN,CAAC;AAEF,eAAO,MAAM,sBAAsB,cACtB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/recurring-date-picker-input/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAGtF,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAElD,eAAO,MAAM,sBAAsB,yBAGhC;IACD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;CACtB,KAAG,OAWH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,SAAS,CAAC,KAAK,GACf,SAAS,CAAC,MAAM,GAChB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,MAAM,CAAC;AAErB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,qBAAqB,qBAG/B;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,KAoEM,kBACN,CAAC;AAEF,eAAO,MAAM,sBAAsB,cACtB,OAAO,EAAE,cACR,QAAQ,EAAE,GAAG,SAAS,YACxB,MAAM,KACf;IAED,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAmFlC,CAAC"}
|
|
@@ -73,9 +73,22 @@ var parseAndValidateRRule = function(param) {
|
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
75
|
var useWorkHoursValidation = function() {
|
|
76
|
-
var byWeekDay = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [],
|
|
76
|
+
var byWeekDay = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], _workHours = arguments.length > 1 ? arguments[1] : void 0, timeZone = arguments.length > 2 ? arguments[2] : void 0;
|
|
77
77
|
var t = useTranslation("Validation").t;
|
|
78
|
-
if (!
|
|
78
|
+
if (!_workHours) return {};
|
|
79
|
+
var workHours = Array.from({
|
|
80
|
+
length: 7
|
|
81
|
+
}, function(_, i) {
|
|
82
|
+
if (_workHours === null || _workHours === void 0 ? void 0 : _workHours[i]) {
|
|
83
|
+
return _workHours[i];
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
day: i + 1,
|
|
87
|
+
start: "00:00",
|
|
88
|
+
end: "23:59",
|
|
89
|
+
description: ""
|
|
90
|
+
};
|
|
91
|
+
});
|
|
79
92
|
// map every day to array of intervals describing workhours for that day
|
|
80
93
|
var intervalsByDay = workHours.map(function(workhour, index, self) {
|
|
81
94
|
var res = [];
|
|
@@ -112,8 +125,6 @@ var useWorkHoursValidation = function() {
|
|
|
112
125
|
}
|
|
113
126
|
return {
|
|
114
127
|
validate: function(_time) {
|
|
115
|
-
// workaround for issue with form values
|
|
116
|
-
// default values and entered values have different formats
|
|
117
128
|
var time = fromIso(_time, timeZone);
|
|
118
129
|
var notFittingIntervalsByDay = intervalsByDay.reduce(function(acc, intervalsByDay) {
|
|
119
130
|
if (!intervalsByDay.some(function(interval) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@licklist/design",
|
|
3
|
-
"version": "0.67.5-dev.
|
|
3
|
+
"version": "0.67.5-dev.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
|
|
@@ -201,4 +201,4 @@
|
|
|
201
201
|
"yarn": "4.4.0"
|
|
202
202
|
},
|
|
203
203
|
"stableVersion": "0.66.7-dev.5"
|
|
204
|
-
}
|
|
204
|
+
}
|
|
@@ -24,8 +24,9 @@ export function WorkingHoursInput() {
|
|
|
24
24
|
<Col>{t("Design:until")}</Col>
|
|
25
25
|
<Col>{t("Design:description")}</Col>
|
|
26
26
|
</Form.Row>
|
|
27
|
+
|
|
27
28
|
<Form.Control
|
|
28
|
-
{...register(`workingHours
|
|
29
|
+
{...register(`workingHours`, {
|
|
29
30
|
validate: (value) => {
|
|
30
31
|
const oneOfDaysFilled = value?.some(
|
|
31
32
|
(workingDay) => workingDay.start,
|
|
@@ -42,6 +43,7 @@ export function WorkingHoursInput() {
|
|
|
42
43
|
})}
|
|
43
44
|
type="hidden"
|
|
44
45
|
/>
|
|
46
|
+
|
|
45
47
|
{weekdays.map((name, i) => (
|
|
46
48
|
/*
|
|
47
49
|
* The only reason inputs have placeholders here is to fix
|
|
@@ -49,14 +51,19 @@ export function WorkingHoursInput() {
|
|
|
49
51
|
* which miscalculates alignment for empty inputs.
|
|
50
52
|
* Otherwise placeholders should not be used.
|
|
51
53
|
*/
|
|
52
|
-
<Form.Row key={
|
|
53
|
-
<Col
|
|
54
|
+
<Form.Row key={name} className="align-items-baseline">
|
|
55
|
+
<Col
|
|
56
|
+
className="h5 text-lg-right text-nowrap mb-4 mb-lg-0"
|
|
57
|
+
xs="12"
|
|
58
|
+
lg="2"
|
|
59
|
+
>
|
|
54
60
|
{name}
|
|
55
61
|
</Col>
|
|
62
|
+
|
|
56
63
|
<Form.Group as={Col}>
|
|
57
64
|
<Form.Label className="d-lg-none">{t("Design:from")}</Form.Label>
|
|
58
65
|
<Form.Control
|
|
59
|
-
{...register(`workingHours.${i}.start
|
|
66
|
+
{...register(`workingHours.${i}.start`, {
|
|
60
67
|
validate: (nextStartValue) => {
|
|
61
68
|
if (nextStartValue) {
|
|
62
69
|
clearErrors("workingHours");
|
|
@@ -69,20 +76,22 @@ export function WorkingHoursInput() {
|
|
|
69
76
|
placeholder={t("Design:from")}
|
|
70
77
|
/>
|
|
71
78
|
</Form.Group>
|
|
79
|
+
|
|
72
80
|
<Form.Group as={Col}>
|
|
73
81
|
<Form.Label className="d-lg-none">{t("Design:until")}</Form.Label>
|
|
74
82
|
<Form.Control
|
|
75
|
-
{...register(`workingHours.${i}.end`
|
|
83
|
+
{...register(`workingHours.${i}.end`)}
|
|
76
84
|
type="time"
|
|
77
85
|
placeholder={t("Design:until")}
|
|
78
86
|
/>
|
|
79
87
|
</Form.Group>
|
|
88
|
+
|
|
80
89
|
<Form.Group as={Col} xs="12" lg>
|
|
81
90
|
<Form.Label className="d-lg-none">
|
|
82
91
|
{t("Design:description")}
|
|
83
92
|
</Form.Label>
|
|
84
93
|
<Form.Control
|
|
85
|
-
{...register(`workingHours.${i}.description`
|
|
94
|
+
{...register(`workingHours.${i}.description`)}
|
|
86
95
|
placeholder={t("Design:description")}
|
|
87
96
|
/>
|
|
88
97
|
</Form.Group>
|
|
@@ -14,22 +14,17 @@ export function WorkingHoursInputDescription() {
|
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<>
|
|
17
|
-
{Array.from({ length: weekdays.length }, (_, i) => i)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})}
|
|
29
|
-
</Col>
|
|
30
|
-
</Row>
|
|
31
|
-
);
|
|
32
|
-
})}
|
|
17
|
+
{Array.from({ length: weekdays.length }, (_, i) => i).map((i) => (
|
|
18
|
+
<Row key={i}>
|
|
19
|
+
<Col xs="auto">{weekdays[i]}:</Col>
|
|
20
|
+
<Col>
|
|
21
|
+
{t("timeInterval", {
|
|
22
|
+
start: values?.[i].start ?? "00:00",
|
|
23
|
+
end: values?.[i].end ?? "23:59",
|
|
24
|
+
})}
|
|
25
|
+
</Col>
|
|
26
|
+
</Row>
|
|
27
|
+
))}
|
|
33
28
|
</>
|
|
34
29
|
);
|
|
35
30
|
}
|
|
@@ -117,14 +117,27 @@ export const parseAndValidateRRule = ({
|
|
|
117
117
|
|
|
118
118
|
export const useWorkHoursValidation = (
|
|
119
119
|
byWeekDay: Weekday[] = [],
|
|
120
|
-
|
|
120
|
+
_workHours: WorkHour[] | undefined,
|
|
121
121
|
timeZone: string,
|
|
122
122
|
): {
|
|
123
|
-
|
|
124
|
-
validate?: Validate<string>;
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
124
|
+
validate?: Validate<string, any>;
|
|
125
125
|
} => {
|
|
126
126
|
const { t } = useTranslation("Validation");
|
|
127
|
-
if (!
|
|
127
|
+
if (!_workHours) return {};
|
|
128
|
+
|
|
129
|
+
const workHours: WorkHour[] = Array.from({ length: 7 }, (_, i) => {
|
|
130
|
+
if (_workHours?.[i]) {
|
|
131
|
+
return _workHours[i];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
day: (i + 1) as Day,
|
|
136
|
+
start: "00:00",
|
|
137
|
+
end: "23:59",
|
|
138
|
+
description: "",
|
|
139
|
+
};
|
|
140
|
+
});
|
|
128
141
|
|
|
129
142
|
// map every day to array of intervals describing workhours for that day
|
|
130
143
|
let intervalsByDay = workHours.map((workhour, index, self) => {
|
|
@@ -164,8 +177,6 @@ export const useWorkHoursValidation = (
|
|
|
164
177
|
|
|
165
178
|
return {
|
|
166
179
|
validate: (_time: string) => {
|
|
167
|
-
// workaround for issue with form values
|
|
168
|
-
// default values and entered values have different formats
|
|
169
180
|
const time = fromIso(_time, timeZone);
|
|
170
181
|
|
|
171
182
|
const notFittingIntervalsByDay = intervalsByDay.reduce<Interval[][]>(
|