@licklist/design 0.78.1 → 0.78.3
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/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +7 -1
- package/dist/events/edit-event-modal/hooks/useValidationOptions.d.ts +6 -2
- package/dist/events/edit-event-modal/hooks/useValidationOptions.d.ts.map +1 -1
- package/dist/events/edit-event-modal/hooks/useValidationOptions.js +16 -5
- package/dist/events/event-card/EventCard.d.ts.map +1 -1
- package/dist/events/event-card/EventCard.js +3 -11
- package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +1 -1
- package/dist/styles/events/EventCard.scss +1 -3
- package/package.json +1 -1
- package/src/events/edit-event-modal/IntervalInput.tsx +7 -1
- package/src/events/edit-event-modal/hooks/useValidationOptions.tsx +26 -9
- package/src/events/event-card/EventCard.tsx +1 -9
- package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +1 -1
- package/src/styles/events/EventCard.scss +1 -3
- package/yarn.lock +341 -333
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntervalInput.d.ts","sourceRoot":"","sources":["../../../src/events/edit-event-modal/IntervalInput.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAA;AAIxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAG7D,UAAU,kBAAkB;IAC1B,gBAAgB,CAAC,EAAE,oBAAoB,CAAA;IACvC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,iBAAyB,EACzB,YAAoB,EACrB,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"IntervalInput.d.ts","sourceRoot":"","sources":["../../../src/events/edit-event-modal/IntervalInput.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAA;AAIxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAG7D,UAAU,kBAAkB;IAC1B,gBAAgB,CAAC,EAAE,oBAAoB,CAAA;IACvC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,iBAAyB,EACzB,YAAoB,EACrB,EAAE,kBAAkB,2CAwKpB"}
|
|
@@ -118,7 +118,7 @@ function IntervalInput(param) {
|
|
|
118
118
|
]).t;
|
|
119
119
|
var _useFormContext = useFormContext(), register = _useFormContext.register, errors = _useFormContext.formState.errors, control = _useFormContext.control, trigger = _useFormContext.trigger, setValue = _useFormContext.setValue;
|
|
120
120
|
var formattedDuration = useFormattedDuration();
|
|
121
|
-
var validationOptions = useValidationOptions();
|
|
121
|
+
var validationOptions = useValidationOptions({});
|
|
122
122
|
var rrule = useWatch({
|
|
123
123
|
control: control,
|
|
124
124
|
name: 'rrule'
|
|
@@ -182,6 +182,12 @@ function IntervalInput(param) {
|
|
|
182
182
|
setValue('rrule', null);
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
|
+
useEffect(function() {
|
|
186
|
+
if (!start) return;
|
|
187
|
+
trigger('end');
|
|
188
|
+
}, [
|
|
189
|
+
start
|
|
190
|
+
]);
|
|
185
191
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
186
192
|
children: [
|
|
187
193
|
/*#__PURE__*/ jsxs(Form.Row, {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
interface useValidationOptionsProps {
|
|
2
|
+
maxDurationExceeded?: number;
|
|
3
|
+
}
|
|
4
|
+
export declare const useValidationOptions: ({ maxDurationExceeded }: useValidationOptionsProps) => {
|
|
2
5
|
start: {
|
|
3
6
|
required: string;
|
|
4
7
|
};
|
|
5
8
|
end: {
|
|
6
9
|
required: string;
|
|
7
|
-
validate: (value:
|
|
10
|
+
validate: (value: string) => string | true;
|
|
8
11
|
};
|
|
9
12
|
};
|
|
13
|
+
export {};
|
|
10
14
|
//# sourceMappingURL=useValidationOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useValidationOptions.d.ts","sourceRoot":"","sources":["../../../../src/events/edit-event-modal/hooks/useValidationOptions.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB;;
|
|
1
|
+
{"version":3,"file":"useValidationOptions.d.ts","sourceRoot":"","sources":["../../../../src/events/edit-event-modal/hooks/useValidationOptions.tsx"],"names":[],"mappings":"AAIA,UAAU,yBAAyB;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,eAAO,MAAM,oBAAoB,4BAAkC,yBAAyB;;kBAUhF,MAAM;;;kBAMN,MAAM;0BACM,MAAM;;CAsB7B,CAAA"}
|
|
@@ -2,7 +2,8 @@ import { DateTime } from 'luxon';
|
|
|
2
2
|
import { useFormContext, useWatch } from 'react-hook-form';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
|
|
5
|
-
var useValidationOptions = function() {
|
|
5
|
+
var useValidationOptions = function(param) {
|
|
6
|
+
var _param_maxDurationExceeded = param.maxDurationExceeded, maxDurationExceeded = _param_maxDurationExceeded === void 0 ? 24 : _param_maxDurationExceeded;
|
|
6
7
|
var control = useFormContext().control;
|
|
7
8
|
var t = useTranslation([
|
|
8
9
|
'Design',
|
|
@@ -22,11 +23,21 @@ var useValidationOptions = function() {
|
|
|
22
23
|
required: t('Validation:fieldRequired', {
|
|
23
24
|
attribute: t('end')
|
|
24
25
|
}),
|
|
25
|
-
// TODO: uncomment when event splitting is implemented
|
|
26
|
-
// and extract into plugins
|
|
27
26
|
validate: function(value) {
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
if (!value || !start) return true;
|
|
28
|
+
var startDt = DateTime.fromISO(start);
|
|
29
|
+
var endDt = DateTime.fromISO(value);
|
|
30
|
+
var diffMillis = endDt.diff(startDt).toMillis();
|
|
31
|
+
if (diffMillis <= 0) {
|
|
32
|
+
return t('Validation:fieldValidEventEnd');
|
|
33
|
+
}
|
|
34
|
+
var maxDurationExceededHours = maxDurationExceeded * 60 * 60 * 1000;
|
|
35
|
+
if (diffMillis > maxDurationExceededHours) {
|
|
36
|
+
return t('Design:eventMaxDurationExceeded', {
|
|
37
|
+
maxHours: maxDurationExceeded
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventCard.d.ts","sourceRoot":"","sources":["../../../src/events/event-card/EventCard.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AASjG,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"EventCard.d.ts","sourceRoot":"","sources":["../../../src/events/event-card/EventCard.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AASjG,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAQ3C,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAA;IACd,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACtC,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,aAAoB,EACpB,cAAc,EACd,WAAW,EACX,cAAc,EACd,OAAO,EACP,aAAa,EACb,OAAO,GACR,EAAE,cAAc,2CA0JhB"}
|
|
@@ -6,7 +6,6 @@ import clsx from 'clsx';
|
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import * as Config from '@licklist/core/dist/Config';
|
|
8
8
|
import { FaEye, FaQrcode, FaExternalLinkAlt, FaEdit, FaCopy, FaTrashAlt } from 'react-icons/fa';
|
|
9
|
-
import { TipTapEditor } from '../../tiptap-editor/TipTapEditor.js';
|
|
10
9
|
import { getStatisticInfo, formatContent, EVENT_DESCRIPTION_SIZE } from './utils.js';
|
|
11
10
|
import { ReactComponent as SvgChartBar } from '../../assets/dashboard/chartBar.svg.js';
|
|
12
11
|
|
|
@@ -38,13 +37,13 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
38
37
|
return target;
|
|
39
38
|
}
|
|
40
39
|
function EventCard(param) {
|
|
41
|
-
var name = param.name, description = param.description, date = param.date, imageUrl = param.imageUrl, sales = param.sales, onPreview = param.onPreview, onEdit = param.onEdit, onCopy = param.onCopy, onRemove = param.onRemove, onOpenQrCode = param.onOpenQrCode, _param_hasPermission = param.hasPermission, hasPermission = _param_hasPermission === void 0 ? true : _param_hasPermission, productSetName = param.productSetName, onStatistic = param.onStatistic, eventStatistic = param.eventStatistic, titleId = param.titleId
|
|
40
|
+
var name = param.name, description = param.description, date = param.date, imageUrl = param.imageUrl, sales = param.sales, onPreview = param.onPreview, onEdit = param.onEdit, onCopy = param.onCopy, onRemove = param.onRemove, onOpenQrCode = param.onOpenQrCode, _param_hasPermission = param.hasPermission, hasPermission = _param_hasPermission === void 0 ? true : _param_hasPermission, productSetName = param.productSetName, onStatistic = param.onStatistic, eventStatistic = param.eventStatistic, titleId = param.titleId; param.descriptionId; var eventID = param.eventID;
|
|
42
41
|
var t = useTranslation('Design').t;
|
|
43
42
|
var _useIntl = useIntl(), formatNumber = _useIntl.formatNumber, formatDate = _useIntl.formatDate;
|
|
44
43
|
var _getStatisticInfo = getStatisticInfo(eventStatistic, date), totalViews = _getStatisticInfo.totalViews, statistics = _object_without_properties(_getStatisticInfo, [
|
|
45
44
|
"totalViews"
|
|
46
45
|
]);
|
|
47
|
-
|
|
46
|
+
useMemo(function() {
|
|
48
47
|
return formatContent(description, EVENT_DESCRIPTION_SIZE);
|
|
49
48
|
}, [
|
|
50
49
|
description
|
|
@@ -93,13 +92,6 @@ function EventCard(param) {
|
|
|
93
92
|
/*#__PURE__*/ jsxs("div", {
|
|
94
93
|
className: "flex-grow-1",
|
|
95
94
|
children: [
|
|
96
|
-
/*#__PURE__*/ jsx(TipTapEditor, {
|
|
97
|
-
viewMode: true,
|
|
98
|
-
disabled: true,
|
|
99
|
-
className: clsx('event-description', !imageUrl && 'no-image'),
|
|
100
|
-
content: memoedContent,
|
|
101
|
-
id: descriptionId
|
|
102
|
-
}),
|
|
103
95
|
/*#__PURE__*/ jsx("div", {
|
|
104
96
|
className: "mt-2 ml-2",
|
|
105
97
|
children: Object.keys(statistics).map(function(key) {
|
|
@@ -171,7 +163,7 @@ function EventCard(param) {
|
|
|
171
163
|
})
|
|
172
164
|
}),
|
|
173
165
|
children: /*#__PURE__*/ jsxs("div", {
|
|
174
|
-
className: "pl-3 text-truncate",
|
|
166
|
+
className: "pl-3 mt-2 text-truncate",
|
|
175
167
|
children: [
|
|
176
168
|
t('Design:productSet'),
|
|
177
169
|
": ",
|
package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js
CHANGED
|
@@ -36,7 +36,7 @@ var NumberInput = /*#__PURE__*/ forwardRef(function(param, ref) {
|
|
|
36
36
|
onArrowDown(0);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
onArrowDown(value - 1);
|
|
40
40
|
};
|
|
41
41
|
var inputWrapperClasses = clsx('payment-number-input', className);
|
|
42
42
|
return /*#__PURE__*/ jsxs("div", {
|
|
@@ -38,10 +38,9 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
38
38
|
|
|
39
39
|
.card-body {
|
|
40
40
|
padding: 0 0 3rem 0;
|
|
41
|
+
margin-bottom: $event-card-contents-gutter;
|
|
41
42
|
|
|
42
43
|
.event-description {
|
|
43
|
-
min-height: 8rem;
|
|
44
|
-
max-height: 21rem;
|
|
45
44
|
overflow: hidden;
|
|
46
45
|
|
|
47
46
|
&:last-child {
|
|
@@ -50,7 +49,6 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
50
49
|
|
|
51
50
|
&.no-image {
|
|
52
51
|
min-height: 13.75rem;
|
|
53
|
-
max-height: 22rem;
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
}
|
package/package.json
CHANGED
|
@@ -45,7 +45,7 @@ export function IntervalInput({
|
|
|
45
45
|
} = useFormContext<IntervalInputValues>()
|
|
46
46
|
|
|
47
47
|
const formattedDuration = useFormattedDuration()
|
|
48
|
-
const validationOptions = useValidationOptions()
|
|
48
|
+
const validationOptions = useValidationOptions({})
|
|
49
49
|
|
|
50
50
|
const rrule = useWatch({ control, name: 'rrule' })
|
|
51
51
|
const start = useWatch({ control, name: 'start' })
|
|
@@ -106,6 +106,12 @@ export function IntervalInput({
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (!start) return
|
|
111
|
+
|
|
112
|
+
trigger('end')
|
|
113
|
+
},[start])
|
|
114
|
+
|
|
109
115
|
return (
|
|
110
116
|
<>
|
|
111
117
|
<Form.Row className='interval-container'>
|
|
@@ -2,9 +2,14 @@ import { DateTime } from 'luxon'
|
|
|
2
2
|
import { useFormContext, useWatch } from 'react-hook-form'
|
|
3
3
|
import { useTranslation } from 'react-i18next'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface useValidationOptionsProps {
|
|
6
|
+
maxDurationExceeded?: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const useValidationOptions = ({ maxDurationExceeded = 24 }: useValidationOptionsProps) => {
|
|
6
10
|
const { control } = useFormContext()
|
|
7
11
|
const { t } = useTranslation(['Design', 'Validation'])
|
|
12
|
+
|
|
8
13
|
const start = useWatch({ control, name: 'start' })
|
|
9
14
|
|
|
10
15
|
return {
|
|
@@ -18,14 +23,26 @@ export const useValidationOptions = () => {
|
|
|
18
23
|
required: t('Validation:fieldRequired', {
|
|
19
24
|
attribute: t('end'),
|
|
20
25
|
}) as string,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
value
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
validate: (value: string) => {
|
|
27
|
+
if (!value || !start) return true
|
|
28
|
+
|
|
29
|
+
const startDt = DateTime.fromISO(start)
|
|
30
|
+
const endDt = DateTime.fromISO(value)
|
|
31
|
+
const diffMillis = endDt.diff(startDt).toMillis()
|
|
32
|
+
|
|
33
|
+
if (diffMillis <= 0) {
|
|
34
|
+
return t('Validation:fieldValidEventEnd') as string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const maxDurationExceededHours = maxDurationExceeded * 60 * 60 * 1000
|
|
38
|
+
if (diffMillis > maxDurationExceededHours) {
|
|
39
|
+
return t('Design:eventMaxDurationExceeded', {
|
|
40
|
+
maxHours: maxDurationExceeded,
|
|
41
|
+
}) as string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return true
|
|
45
|
+
},
|
|
29
46
|
},
|
|
30
47
|
}
|
|
31
48
|
}
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
FaQrcode,
|
|
22
22
|
} from 'react-icons/fa'
|
|
23
23
|
import { Sale } from '../../types/bookings'
|
|
24
|
-
import { TipTapEditor } from '../../tiptap-editor/TipTapEditor'
|
|
25
24
|
import {
|
|
26
25
|
EVENT_DESCRIPTION_SIZE,
|
|
27
26
|
formatContent,
|
|
@@ -109,13 +108,6 @@ export function EventCard({
|
|
|
109
108
|
)}
|
|
110
109
|
</Card.Title>
|
|
111
110
|
<div className='flex-grow-1'>
|
|
112
|
-
<TipTapEditor
|
|
113
|
-
viewMode
|
|
114
|
-
disabled
|
|
115
|
-
className={clsx('event-description', !imageUrl && 'no-image')}
|
|
116
|
-
content={memoedContent}
|
|
117
|
-
id={descriptionId}
|
|
118
|
-
/>
|
|
119
111
|
<div className='mt-2 ml-2'>
|
|
120
112
|
{Object.keys(statistics).map((key) => (
|
|
121
113
|
<div className='event-card-sale' key={key}>
|
|
@@ -162,7 +154,7 @@ export function EventCard({
|
|
|
162
154
|
</Popover>
|
|
163
155
|
}
|
|
164
156
|
>
|
|
165
|
-
<div className='pl-3 text-truncate'>
|
|
157
|
+
<div className='pl-3 mt-2 text-truncate'>
|
|
166
158
|
{t('Design:productSet')}: {productSetName}
|
|
167
159
|
</div>
|
|
168
160
|
</OverlayTrigger>
|
|
@@ -38,10 +38,9 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
38
38
|
|
|
39
39
|
.card-body {
|
|
40
40
|
padding: 0 0 3rem 0;
|
|
41
|
+
margin-bottom: $event-card-contents-gutter;
|
|
41
42
|
|
|
42
43
|
.event-description {
|
|
43
|
-
min-height: 8rem;
|
|
44
|
-
max-height: 21rem;
|
|
45
44
|
overflow: hidden;
|
|
46
45
|
|
|
47
46
|
&:last-child {
|
|
@@ -50,7 +49,6 @@ $event-card-views-gutter: sp(3) !default;
|
|
|
50
49
|
|
|
51
50
|
&.no-image {
|
|
52
51
|
min-height: 13.75rem;
|
|
53
|
-
max-height: 22rem;
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
}
|