@licklist/design 0.69.4 → 0.69.5
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/component/EditEventForm/EditEventForm.d.ts +2 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +3 -2
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +2 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +31 -28
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts +2 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +14 -3
- package/dist/index.js +1 -0
- package/dist/modals/confirmation/ConfirmModal.d.ts +3 -1
- package/dist/modals/confirmation/ConfirmModal.d.ts.map +1 -1
- package/dist/modals/confirmation/ConfirmModal.js +172 -8
- package/dist/product-set/card/ProductSetCard.d.ts +6 -2
- package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
- package/dist/product-set/card/ProductSetCard.js +20 -11
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +8 -0
- package/dist/product-set/form/ProductSetNameControl.d.ts +6 -0
- package/dist/product-set/form/ProductSetNameControl.d.ts.map +1 -0
- package/dist/product-set/form/ProductSetNameControl.js +35 -0
- package/dist/product-set/form/index.d.ts +1 -0
- package/dist/product-set/form/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.d.ts +7 -0
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.js +10 -1
- package/dist/typeahead/Typeahead.d.ts +5 -1
- package/dist/typeahead/Typeahead.d.ts.map +1 -1
- package/dist/typeahead/Typeahead.js +9 -2
- package/package.json +4 -4
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +3 -0
- package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +86 -85
- package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +11 -1
- package/src/modals/confirmation/ConfirmModal.tsx +19 -3
- package/src/product-set/card/ProductSetCard.tsx +32 -6
- package/src/product-set/form/ProductSetForm.tsx +10 -0
- package/src/product-set/form/ProductSetNameControl.tsx +27 -0
- package/src/product-set/form/index.ts +1 -0
- package/src/product-set/utils/index.ts +11 -0
- package/src/typeahead/Typeahead.tsx +15 -1
- package/yarn.lock +6 -14
|
@@ -35,6 +35,7 @@ export interface EditEventFormProps extends HasPermissionProp {
|
|
|
35
35
|
isExternalPaymentLinkEnabled?: boolean;
|
|
36
36
|
timeZone: string;
|
|
37
37
|
eventProductSet?: ProductSet;
|
|
38
|
+
overrideNameError?: string;
|
|
38
39
|
}
|
|
39
|
-
export declare const EditEventForm: ({ disabled, categories, title, hasPermission, defaultEventValues, serverErrors, onSaveEvent, productSets, createProductSet, setEditProductSetId, isExternalPaymentLinkEnabled, timeZone, eventProductSet, }: EditEventFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare const EditEventForm: ({ disabled, categories, title, hasPermission, defaultEventValues, serverErrors, onSaveEvent, productSets, createProductSet, setEditProductSetId, isExternalPaymentLinkEnabled, timeZone, eventProductSet, overrideNameError, }: EditEventFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
41
|
//# sourceMappingURL=EditEventForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditEventForm.d.ts","sourceRoot":"","sources":["../../../../../src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,EACN,MAAM,sDAAsD,CAAA;AAM7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAGtF,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAA;AAG3E,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAA;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAS5D,OAAO,EAAiB,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAGxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAA;AAGlF,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAA;IACzB,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,oBAAoB,CAAA;CACxC;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,aAAa,EAAE,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,kBAAkB,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACjD,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B,WAAW,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAClD,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;IACjC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,gBAAgB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAA;IACtD,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,CAAC,EAAE,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"EditEventForm.d.ts","sourceRoot":"","sources":["../../../../../src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,EACN,MAAM,sDAAsD,CAAA;AAM7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAGtF,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAA;AAG3E,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAA;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAS5D,OAAO,EAAiB,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAGxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAA;AAGlF,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAA;IACzB,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,oBAAoB,CAAA;CACxC;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,aAAa,EAAE,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,kBAAkB,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACjD,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B,WAAW,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAClD,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;IACjC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,gBAAgB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAA;IACtD,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,CAAC,EAAE,UAAU,CAAA;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAOD,eAAO,MAAM,aAAa,mOAevB,kBAAkB,4CAwVpB,CAAA"}
|
|
@@ -139,7 +139,7 @@ var eventImageTypes = {
|
|
|
139
139
|
uploadCover: IMAGE_TYPE_MAP[IMAGE_TYPE_COVER]
|
|
140
140
|
};
|
|
141
141
|
var EditEventForm = function(param) {
|
|
142
|
-
var _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, categories = param.categories, title = param.title, _param_hasPermission = param.hasPermission, hasPermission = _param_hasPermission === void 0 ? true : _param_hasPermission, defaultEventValues = param.defaultEventValues, serverErrors = param.serverErrors, onSaveEvent = param.onSaveEvent, productSets = param.productSets, createProductSet = param.createProductSet, setEditProductSetId = param.setEditProductSetId, isExternalPaymentLinkEnabled = param.isExternalPaymentLinkEnabled, timeZone = param.timeZone, eventProductSet = param.eventProductSet;
|
|
142
|
+
var _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, categories = param.categories, title = param.title, _param_hasPermission = param.hasPermission, hasPermission = _param_hasPermission === void 0 ? true : _param_hasPermission, defaultEventValues = param.defaultEventValues, serverErrors = param.serverErrors, onSaveEvent = param.onSaveEvent, productSets = param.productSets, createProductSet = param.createProductSet, setEditProductSetId = param.setEditProductSetId, isExternalPaymentLinkEnabled = param.isExternalPaymentLinkEnabled, timeZone = param.timeZone, eventProductSet = param.eventProductSet, overrideNameError = param.overrideNameError;
|
|
143
143
|
var _errors_name, _errors_externalPaymentLink, _errors_integrationUrl;
|
|
144
144
|
var t = useTranslation([
|
|
145
145
|
'Design',
|
|
@@ -467,7 +467,8 @@ var EditEventForm = function(param) {
|
|
|
467
467
|
setShowEditProductSet: setShowEditProductSet,
|
|
468
468
|
showEditProductSet: showEditProductSet,
|
|
469
469
|
timeZone: timeZone,
|
|
470
|
-
eventProductSet: eventProductSet
|
|
470
|
+
eventProductSet: eventProductSet,
|
|
471
|
+
overrideNameError: overrideNameError
|
|
471
472
|
}),
|
|
472
473
|
hasPermission && !showEditProductSet && /*#__PURE__*/ jsx(Button, {
|
|
473
474
|
disabled: disabled || formState.isSubmitting || isImagesLoading || isCoverImagesLoading,
|
package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ interface SelectEventProductSetProps extends HasPermissionProp {
|
|
|
9
9
|
setEditProductSetId: (value: string) => void;
|
|
10
10
|
timeZone: string;
|
|
11
11
|
eventProductSet?: ProductSet;
|
|
12
|
+
overrideNameError?: string;
|
|
12
13
|
}
|
|
13
|
-
export declare const SelectEventProductSet: ({ productSets: _productSets, createProductSet, setEditProductSetId, showEditProductSet, setShowEditProductSet, timeZone, eventProductSet, }: SelectEventProductSetProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const SelectEventProductSet: ({ productSets: _productSets, createProductSet, setEditProductSetId, showEditProductSet, setShowEditProductSet, timeZone, eventProductSet, overrideNameError, }: SelectEventProductSetProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export {};
|
|
15
16
|
//# sourceMappingURL=SelectEventProductSet.d.ts.map
|
package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectEventProductSet.d.ts","sourceRoot":"","sources":["../../../../../src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAA;
|
|
1
|
+
{"version":3,"file":"SelectEventProductSet.d.ts","sourceRoot":"","sources":["../../../../../src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAA;AAGxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AAIpE,UAAU,0BAA2B,SAAQ,iBAAiB;IAC5D,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;IAC1B,kBAAkB,EAAE,OAAO,CAAA;IAC3B,qBAAqB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAC/C,gBAAgB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAA;IACtD,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,CAAC,EAAE,UAAU,CAAA;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,eAAO,MAAM,qBAAqB,mKAS/B,0BAA0B,4CA2L5B,CAAA"}
|
package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js
CHANGED
|
@@ -4,8 +4,10 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
import { Form, Button } from 'react-bootstrap';
|
|
5
5
|
import { useId } from '@react-aria/utils';
|
|
6
6
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
7
|
+
import { getTypeHeadItemsFromMenus } from '../../../../product-set/utils/index.js';
|
|
7
8
|
import { ConfirmModal } from '../../../../modals/confirmation/ConfirmModal.js';
|
|
8
9
|
import { EditEventProductSet } from './component/EditEventProductSet.js';
|
|
10
|
+
import { Typeahead } from '../../../../typeahead/Typeahead.js';
|
|
9
11
|
|
|
10
12
|
function _array_like_to_array(arr, len) {
|
|
11
13
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -157,7 +159,7 @@ function _ts_generator(thisArg, body) {
|
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
var SelectEventProductSet = function(param) {
|
|
160
|
-
var _productSets = param.productSets, createProductSet = param.createProductSet, setEditProductSetId = param.setEditProductSetId, showEditProductSet = param.showEditProductSet, setShowEditProductSet = param.setShowEditProductSet, timeZone = param.timeZone, eventProductSet = param.eventProductSet;
|
|
162
|
+
var _productSets = param.productSets, createProductSet = param.createProductSet, setEditProductSetId = param.setEditProductSetId, showEditProductSet = param.showEditProductSet, setShowEditProductSet = param.setShowEditProductSet, timeZone = param.timeZone, eventProductSet = param.eventProductSet, overrideNameError = param.overrideNameError;
|
|
161
163
|
var _productSets_find;
|
|
162
164
|
var productSets = eventProductSet ? _to_consumable_array(_productSets).concat([
|
|
163
165
|
eventProductSet
|
|
@@ -170,6 +172,15 @@ var SelectEventProductSet = function(param) {
|
|
|
170
172
|
var productSetsId = useId();
|
|
171
173
|
var productSetId = watch('productSetId');
|
|
172
174
|
var editedProductSet = watch('editedProductSet');
|
|
175
|
+
var typeheadValues = getTypeHeadItemsFromMenus(editedProductSet ? productSets.map(function(productSet) {
|
|
176
|
+
if (productSet.id === editedProductSet.id) {
|
|
177
|
+
return editedProductSet;
|
|
178
|
+
}
|
|
179
|
+
return productSet;
|
|
180
|
+
}) : productSets);
|
|
181
|
+
var selectedProductSetTypeheadValue = productSetId ? typeheadValues === null || typeheadValues === void 0 ? void 0 : typeheadValues.find(function(typeheadValue) {
|
|
182
|
+
return typeheadValue.id === productSetId;
|
|
183
|
+
}) : undefined;
|
|
173
184
|
var onEditProductSet = useCallback(function() {
|
|
174
185
|
setEditProductSetId(String(productSetId));
|
|
175
186
|
setShowEditProductSet(true);
|
|
@@ -238,6 +249,7 @@ var SelectEventProductSet = function(param) {
|
|
|
238
249
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
239
250
|
var onSubmit = function(value) {
|
|
240
251
|
setShowEditProductSet(false);
|
|
252
|
+
setValue('productSetId', value.id);
|
|
241
253
|
setValue('editedProductSet', value);
|
|
242
254
|
};
|
|
243
255
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -254,10 +266,8 @@ var SelectEventProductSet = function(param) {
|
|
|
254
266
|
/*#__PURE__*/ jsx(Controller, {
|
|
255
267
|
control: control,
|
|
256
268
|
name: "productSetId",
|
|
257
|
-
render: function(
|
|
258
|
-
var field = param.field;
|
|
269
|
+
render: function() {
|
|
259
270
|
var _errors_productSetId;
|
|
260
|
-
var fieldValue = String(field.value);
|
|
261
271
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
262
272
|
children: [
|
|
263
273
|
/*#__PURE__*/ jsxs("div", {
|
|
@@ -265,27 +275,19 @@ var SelectEventProductSet = function(param) {
|
|
|
265
275
|
children: [
|
|
266
276
|
/*#__PURE__*/ jsx(ConfirmModal, {
|
|
267
277
|
children: function(confirm) {
|
|
268
|
-
return /*#__PURE__*/
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
278
|
+
return /*#__PURE__*/ jsx(Typeahead, {
|
|
279
|
+
name: "productSetId",
|
|
280
|
+
value: selectedProductSetTypeheadValue,
|
|
281
|
+
containerStyles: {
|
|
282
|
+
width: '100%'
|
|
283
|
+
},
|
|
284
|
+
onChangeValue: function(typeheadValue) {
|
|
285
|
+
onChangeProductSet(Number(typeheadValue.id), confirm);
|
|
272
286
|
},
|
|
273
|
-
isInvalid:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
value: "",
|
|
278
|
-
hidden: true,
|
|
279
|
-
children: t('Design:chooseProductSet')
|
|
280
|
-
}),
|
|
281
|
-
productSets === null || productSets === void 0 ? void 0 : productSets.map(function(productSet) {
|
|
282
|
-
var isCurrentEditedProductSet = editedProductSet && (editedProductSet === null || editedProductSet === void 0 ? void 0 : editedProductSet.id) === (productSet === null || productSet === void 0 ? void 0 : productSet.id);
|
|
283
|
-
return /*#__PURE__*/ jsx("option", {
|
|
284
|
-
value: productSet.id,
|
|
285
|
-
children: isCurrentEditedProductSet || productSet.isOverride ? "[".concat(t('edited'), "] ").concat(isCurrentEditedProductSet ? editedProductSet === null || editedProductSet === void 0 ? void 0 : editedProductSet.name : productSet.name) : productSet.name
|
|
286
|
-
}, productSet.id);
|
|
287
|
-
})
|
|
288
|
-
]
|
|
287
|
+
isInvalid: !!overrideNameError,
|
|
288
|
+
options: typeheadValues,
|
|
289
|
+
placeholder: t('Design:choose'),
|
|
290
|
+
noOptionsMessage: t('Design:noAvailableProductSets')
|
|
289
291
|
});
|
|
290
292
|
}
|
|
291
293
|
}),
|
|
@@ -320,9 +322,9 @@ var SelectEventProductSet = function(param) {
|
|
|
320
322
|
})
|
|
321
323
|
]
|
|
322
324
|
}),
|
|
323
|
-
/*#__PURE__*/ jsx(
|
|
324
|
-
|
|
325
|
-
children: errors === null || errors === void 0 ? void 0 : (_errors_productSetId = errors.productSetId) === null || _errors_productSetId === void 0 ? void 0 : _errors_productSetId.message
|
|
325
|
+
/*#__PURE__*/ jsx("div", {
|
|
326
|
+
className: "manual-form-error",
|
|
327
|
+
children: (errors === null || errors === void 0 ? void 0 : (_errors_productSetId = errors.productSetId) === null || _errors_productSetId === void 0 ? void 0 : _errors_productSetId.message) || overrideNameError
|
|
326
328
|
})
|
|
327
329
|
]
|
|
328
330
|
});
|
|
@@ -334,7 +336,8 @@ var SelectEventProductSet = function(param) {
|
|
|
334
336
|
showEditProductSet && productSetId && /*#__PURE__*/ jsx(EditEventProductSet, {
|
|
335
337
|
onSubmit: onSubmit,
|
|
336
338
|
defaultValues: productSetId === (editedProductSet === null || editedProductSet === void 0 ? void 0 : editedProductSet.id) && editedProductSet,
|
|
337
|
-
timeZone: timeZone
|
|
339
|
+
timeZone: timeZone,
|
|
340
|
+
overrideNameError: overrideNameError
|
|
338
341
|
})
|
|
339
342
|
]
|
|
340
343
|
});
|
|
@@ -9,7 +9,8 @@ interface EditEventProductSetProps {
|
|
|
9
9
|
onSubmit: (value: EditEventFormValues['editedProductSet']) => void;
|
|
10
10
|
defaultValues?: EditEventFormValues['editedProductSet'];
|
|
11
11
|
timeZone: string;
|
|
12
|
+
overrideNameError?: string;
|
|
12
13
|
}
|
|
13
|
-
export declare const EditEventProductSet: ({ onSubmit, defaultValues, timeZone, }: EditEventProductSetProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const EditEventProductSet: ({ onSubmit, defaultValues, timeZone, overrideNameError, }: EditEventProductSetProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export {};
|
|
15
16
|
//# sourceMappingURL=EditEventProductSet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditEventProductSet.d.ts","sourceRoot":"","sources":["../../../../../../src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAGzD,eAAO,MAAM,WAAW,IAAI,CAAA;AAE5B,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AACD,UAAU,wBAAwB;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAA;IAClE,aAAa,CAAC,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,CAAA;IACvD,QAAQ,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"EditEventProductSet.d.ts","sourceRoot":"","sources":["../../../../../../src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAGzD,eAAO,MAAM,WAAW,IAAI,CAAA;AAE5B,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AACD,UAAU,wBAAwB;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAA;IAClE,aAAa,CAAC,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,CAAA;IACvD,QAAQ,EAAE,MAAM,CAAA;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,eAAO,MAAM,mBAAmB,8DAK7B,wBAAwB,4CA2H1B,CAAA"}
|
|
@@ -22,6 +22,7 @@ import 'react-bootstrap/Col';
|
|
|
22
22
|
import 'react-bootstrap/InputGroup';
|
|
23
23
|
import 'react-bootstrap/Row';
|
|
24
24
|
import '@licklist/plugins/dist/services/Form/FormErrorService';
|
|
25
|
+
import '@licklist/plugins';
|
|
25
26
|
import { ProductSetContextProvider } from '../../../../../product-set/form/context.js';
|
|
26
27
|
import { getFilteredTemplates } from '../../../../../product-set/utils/index.js';
|
|
27
28
|
import 'react-bootstrap/Button';
|
|
@@ -32,7 +33,6 @@ import '@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper';
|
|
|
32
33
|
import 'react-bootstrap/Collapse';
|
|
33
34
|
import '@licklist/plugins/dist/hooks/Media/useImages';
|
|
34
35
|
import '@licklist/core/dist/DataMapper/Media/ImageDataMapper';
|
|
35
|
-
import '@licklist/plugins';
|
|
36
36
|
import '@licklist/plugins/dist/context/app/hooks/useNotification';
|
|
37
37
|
import '../../../../../static/index.js';
|
|
38
38
|
import '../../../../../tiptap-editor/TipTapEditor.js';
|
|
@@ -133,7 +133,7 @@ function _object_spread_props(target, source) {
|
|
|
133
133
|
}
|
|
134
134
|
var DEFAULT_FEE = 5;
|
|
135
135
|
var EditEventProductSet = function(param) {
|
|
136
|
-
var onSubmit = param.onSubmit, defaultValues = param.defaultValues, timeZone = param.timeZone;
|
|
136
|
+
var onSubmit = param.onSubmit, defaultValues = param.defaultValues, timeZone = param.timeZone, overrideNameError = param.overrideNameError;
|
|
137
137
|
var companyId = useParams().companyId;
|
|
138
138
|
var _useEventEditProductSetContext = useEventEditProductSetContext(), companies = _useEventEditProductSetContext.companies, isLoading = _useEventEditProductSetContext.isLoading, settings = _useEventEditProductSetContext.settings, smsTemplates = _useEventEditProductSetContext.smsTemplates, systemSettings = _useEventEditProductSetContext.systemSettings, productGroupsData = _useEventEditProductSetContext.productGroupsData, productSetData = _useEventEditProductSetContext.productSetData, venueMapSets = _useEventEditProductSetContext.venueMapSets, emailTemplates = _useEventEditProductSetContext.emailTemplates, fieldSetsData = _useEventEditProductSetContext.fieldSetsData;
|
|
139
139
|
var t = useTranslation('Design').t;
|
|
@@ -153,7 +153,18 @@ var EditEventProductSet = function(param) {
|
|
|
153
153
|
defaultValues: defaultValues,
|
|
154
154
|
mode: 'onChange'
|
|
155
155
|
});
|
|
156
|
-
var reset = form.reset, handleSubmit = form.handleSubmit, watch = form.watch;
|
|
156
|
+
var reset = form.reset, handleSubmit = form.handleSubmit, watch = form.watch, setError = form.setError;
|
|
157
|
+
useEffect(function() {
|
|
158
|
+
if (!overrideNameError) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
setError('name', {
|
|
162
|
+
message: overrideNameError
|
|
163
|
+
});
|
|
164
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
165
|
+
}, [
|
|
166
|
+
overrideNameError
|
|
167
|
+
]);
|
|
157
168
|
var formValues = watch();
|
|
158
169
|
useEffect(function() {
|
|
159
170
|
if (!defaultFormValues || isEqual(defaultFormValues, formValues)) {
|
package/dist/index.js
CHANGED
|
@@ -87,6 +87,7 @@ export { ProductSetControl } from './product-set/control/ProductSetControl.js';
|
|
|
87
87
|
export { ProductSetDepositPaidControl } from './product-set/deposit-paid/ProductSetDepositPaidControl.js';
|
|
88
88
|
export { DeleteFieldButton } from './product-set/elements/DeleteFieldButton.js';
|
|
89
89
|
export { ProductSetForm } from './product-set/form/ProductSetForm.js';
|
|
90
|
+
export { ProductSetNameControl } from './product-set/form/ProductSetNameControl.js';
|
|
90
91
|
export { ProductSetPopover } from './product-set/popover/ProductSetPopover.js';
|
|
91
92
|
export { ProductBookingManagementControl } from './product-set/product/booking-management/ProductBookingManagementControl.js';
|
|
92
93
|
export { ProductDepositControl } from './product-set/product/deposit/ProductDepositControl.js';
|
|
@@ -8,6 +8,8 @@ export type ConfirmModalTypes = (typeof ConfirmModalType)[keyof typeof ConfirmMo
|
|
|
8
8
|
export interface ConfirmModalProps {
|
|
9
9
|
type?: ConfirmModalTypes;
|
|
10
10
|
children?: (confirm: (action: ConfirmAction) => void) => ReactNode;
|
|
11
|
+
confirmationHandler?: () => Promise<boolean | undefined>;
|
|
12
|
+
disabledButtons?: boolean;
|
|
11
13
|
title?: string;
|
|
12
14
|
content?: string | ReactNode;
|
|
13
15
|
onClose?: () => void;
|
|
@@ -16,5 +18,5 @@ export interface ConfirmModalProps {
|
|
|
16
18
|
export declare const CONFIRM_MODAL_ACTION_DECLINE = "confirm-modal-decline";
|
|
17
19
|
export declare const CONFIRM_MODAL_ACTION_CONFIRM = "confirm-modal-confirm";
|
|
18
20
|
export declare const CONFIRM_MODAL_ACTIONS: readonly string[];
|
|
19
|
-
export declare function ConfirmModal({ type, children, onClose, title, content, hideButtons, }: ConfirmModalProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function ConfirmModal({ type, children, onClose, confirmationHandler, title, disabledButtons, content, hideButtons, }: ConfirmModalProps): import("react/jsx-runtime").JSX.Element;
|
|
20
22
|
//# sourceMappingURL=ConfirmModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmModal.d.ts","sourceRoot":"","sources":["../../../src/modals/confirmation/ConfirmModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,OAAO,CAAA;AAUnD,MAAM,MAAM,aAAa,GAAG,MAAM,IAAI,CAAA;AACtC,eAAO,MAAM,gBAAgB;;;CAGnB,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAA;AAE1D,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,iBAAiB,CAAA;IACxB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,KAAK,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"ConfirmModal.d.ts","sourceRoot":"","sources":["../../../src/modals/confirmation/ConfirmModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,OAAO,CAAA;AAUnD,MAAM,MAAM,aAAa,GAAG,MAAM,IAAI,CAAA;AACtC,eAAO,MAAM,gBAAgB;;;CAGnB,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAA;AAE1D,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,iBAAiB,CAAA;IACxB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,KAAK,SAAS,CAAA;IAElE,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IACxD,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,eAAO,MAAM,4BAA4B,0BAA0B,CAAA;AACnE,eAAO,MAAM,4BAA4B,0BAA0B,CAAA;AACnE,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAGlD,CAAA;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAgB,EAChB,QAAQ,EACR,OAAO,EACP,mBAAmB,EACnB,KAAK,EACL,eAAe,EACf,OAAO,EACP,WAAmB,GACpB,EAAE,iBAAiB,2CA+GnB"}
|
|
@@ -17,6 +17,35 @@ function _array_like_to_array(arr, len) {
|
|
|
17
17
|
function _array_with_holes(arr) {
|
|
18
18
|
if (Array.isArray(arr)) return arr;
|
|
19
19
|
}
|
|
20
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
21
|
+
try {
|
|
22
|
+
var info = gen[key](arg);
|
|
23
|
+
var value = info.value;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
reject(error);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (info.done) {
|
|
29
|
+
resolve(value);
|
|
30
|
+
} else {
|
|
31
|
+
Promise.resolve(value).then(_next, _throw);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function _async_to_generator(fn) {
|
|
35
|
+
return function() {
|
|
36
|
+
var self = this, args = arguments;
|
|
37
|
+
return new Promise(function(resolve, reject) {
|
|
38
|
+
var gen = fn.apply(self, args);
|
|
39
|
+
function _next(value) {
|
|
40
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
41
|
+
}
|
|
42
|
+
function _throw(err) {
|
|
43
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
44
|
+
}
|
|
45
|
+
_next(undefined);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
}
|
|
20
49
|
function _iterable_to_array_limit(arr, i) {
|
|
21
50
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
22
51
|
if (_i == null) return;
|
|
@@ -55,6 +84,101 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
55
84
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
56
85
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
57
86
|
}
|
|
87
|
+
function _ts_generator(thisArg, body) {
|
|
88
|
+
var f, y, t, g, _ = {
|
|
89
|
+
label: 0,
|
|
90
|
+
sent: function() {
|
|
91
|
+
if (t[0] & 1) throw t[1];
|
|
92
|
+
return t[1];
|
|
93
|
+
},
|
|
94
|
+
trys: [],
|
|
95
|
+
ops: []
|
|
96
|
+
};
|
|
97
|
+
return g = {
|
|
98
|
+
next: verb(0),
|
|
99
|
+
"throw": verb(1),
|
|
100
|
+
"return": verb(2)
|
|
101
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
102
|
+
return this;
|
|
103
|
+
}), g;
|
|
104
|
+
function verb(n) {
|
|
105
|
+
return function(v) {
|
|
106
|
+
return step([
|
|
107
|
+
n,
|
|
108
|
+
v
|
|
109
|
+
]);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function step(op) {
|
|
113
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
114
|
+
while(_)try {
|
|
115
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
116
|
+
if (y = 0, t) op = [
|
|
117
|
+
op[0] & 2,
|
|
118
|
+
t.value
|
|
119
|
+
];
|
|
120
|
+
switch(op[0]){
|
|
121
|
+
case 0:
|
|
122
|
+
case 1:
|
|
123
|
+
t = op;
|
|
124
|
+
break;
|
|
125
|
+
case 4:
|
|
126
|
+
_.label++;
|
|
127
|
+
return {
|
|
128
|
+
value: op[1],
|
|
129
|
+
done: false
|
|
130
|
+
};
|
|
131
|
+
case 5:
|
|
132
|
+
_.label++;
|
|
133
|
+
y = op[1];
|
|
134
|
+
op = [
|
|
135
|
+
0
|
|
136
|
+
];
|
|
137
|
+
continue;
|
|
138
|
+
case 7:
|
|
139
|
+
op = _.ops.pop();
|
|
140
|
+
_.trys.pop();
|
|
141
|
+
continue;
|
|
142
|
+
default:
|
|
143
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
144
|
+
_ = 0;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
148
|
+
_.label = op[1];
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
152
|
+
_.label = t[1];
|
|
153
|
+
t = op;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
if (t && _.label < t[2]) {
|
|
157
|
+
_.label = t[2];
|
|
158
|
+
_.ops.push(op);
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
if (t[2]) _.ops.pop();
|
|
162
|
+
_.trys.pop();
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
op = body.call(thisArg, _);
|
|
166
|
+
} catch (e) {
|
|
167
|
+
op = [
|
|
168
|
+
6,
|
|
169
|
+
e
|
|
170
|
+
];
|
|
171
|
+
y = 0;
|
|
172
|
+
} finally{
|
|
173
|
+
f = t = 0;
|
|
174
|
+
}
|
|
175
|
+
if (op[0] & 5) throw op[1];
|
|
176
|
+
return {
|
|
177
|
+
value: op[0] ? op[1] : void 0,
|
|
178
|
+
done: true
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
58
182
|
var ConfirmModalType = {
|
|
59
183
|
remove: 'remove',
|
|
60
184
|
default: 'default'
|
|
@@ -66,7 +190,7 @@ var CONFIRM_MODAL_ACTIONS = [
|
|
|
66
190
|
CONFIRM_MODAL_ACTION_CONFIRM
|
|
67
191
|
];
|
|
68
192
|
function ConfirmModal(param) {
|
|
69
|
-
var _param_type = param.type, type = _param_type === void 0 ? 'default' : _param_type, children = param.children, onClose = param.onClose, title = param.title, content = param.content, _param_hideButtons = param.hideButtons, hideButtons = _param_hideButtons === void 0 ? false : _param_hideButtons;
|
|
193
|
+
var _param_type = param.type, type = _param_type === void 0 ? 'default' : _param_type, children = param.children, onClose = param.onClose, confirmationHandler = param.confirmationHandler, title = param.title, disabledButtons = param.disabledButtons, content = param.content, _param_hideButtons = param.hideButtons, hideButtons = _param_hideButtons === void 0 ? false : _param_hideButtons;
|
|
70
194
|
var t = useTranslation('Design').t;
|
|
71
195
|
var actionRef = useRef();
|
|
72
196
|
var _useState = _sliced_to_array(useState(false), 2), isOpen = _useState[0], setIsOpen = _useState[1];
|
|
@@ -76,14 +200,49 @@ function ConfirmModal(param) {
|
|
|
76
200
|
return true;
|
|
77
201
|
});
|
|
78
202
|
};
|
|
79
|
-
var handleConfirmation = function(
|
|
80
|
-
e
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
203
|
+
var handleConfirmation = function() {
|
|
204
|
+
var _ref = _async_to_generator(function(e) {
|
|
205
|
+
var res;
|
|
206
|
+
return _ts_generator(this, function(_state) {
|
|
207
|
+
switch(_state.label){
|
|
208
|
+
case 0:
|
|
209
|
+
e.stopPropagation();
|
|
210
|
+
if (!actionRef.current && !confirmationHandler) return [
|
|
211
|
+
2
|
|
212
|
+
];
|
|
213
|
+
if (!confirmationHandler) return [
|
|
214
|
+
3,
|
|
215
|
+
2
|
|
216
|
+
];
|
|
217
|
+
return [
|
|
218
|
+
4,
|
|
219
|
+
confirmationHandler()
|
|
220
|
+
];
|
|
221
|
+
case 1:
|
|
222
|
+
res = _state.sent();
|
|
223
|
+
if (res) {
|
|
224
|
+
setIsOpen(function() {
|
|
225
|
+
return false;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return [
|
|
229
|
+
2
|
|
230
|
+
];
|
|
231
|
+
case 2:
|
|
232
|
+
actionRef.current();
|
|
233
|
+
setIsOpen(function() {
|
|
234
|
+
return false;
|
|
235
|
+
});
|
|
236
|
+
return [
|
|
237
|
+
2
|
|
238
|
+
];
|
|
239
|
+
}
|
|
240
|
+
});
|
|
85
241
|
});
|
|
86
|
-
|
|
242
|
+
return function handleConfirmation(e) {
|
|
243
|
+
return _ref.apply(this, arguments);
|
|
244
|
+
};
|
|
245
|
+
}();
|
|
87
246
|
var handleClose = function(e) {
|
|
88
247
|
e.stopPropagation();
|
|
89
248
|
setIsOpen(function() {
|
|
@@ -113,6 +272,7 @@ function ConfirmModal(param) {
|
|
|
113
272
|
/*#__PURE__*/ jsx(Button, {
|
|
114
273
|
variant: "danger",
|
|
115
274
|
className: "btn-sm rounded",
|
|
275
|
+
disabled: disabledButtons,
|
|
116
276
|
onClick: handleClose,
|
|
117
277
|
"data-id": CONFIRM_MODAL_ACTION_DECLINE,
|
|
118
278
|
children: /*#__PURE__*/ jsx(FaTimes, {
|
|
@@ -133,11 +293,13 @@ function ConfirmModal(param) {
|
|
|
133
293
|
variant: "outline",
|
|
134
294
|
className: "cancel-button",
|
|
135
295
|
onClick: handleClose,
|
|
296
|
+
disabled: disabledButtons,
|
|
136
297
|
"data-id": CONFIRM_MODAL_ACTION_DECLINE,
|
|
137
298
|
children: t('cancel')
|
|
138
299
|
}),
|
|
139
300
|
/*#__PURE__*/ jsx(Button, {
|
|
140
301
|
variant: "danger",
|
|
302
|
+
disabled: disabledButtons,
|
|
141
303
|
onClick: handleConfirmation,
|
|
142
304
|
"data-id": CONFIRM_MODAL_ACTION_CONFIRM,
|
|
143
305
|
children: t('remove')
|
|
@@ -147,12 +309,14 @@ function ConfirmModal(param) {
|
|
|
147
309
|
children: [
|
|
148
310
|
/*#__PURE__*/ jsx(Button, {
|
|
149
311
|
variant: "danger",
|
|
312
|
+
disabled: disabledButtons,
|
|
150
313
|
onClick: handleClose,
|
|
151
314
|
"data-id": CONFIRM_MODAL_ACTION_DECLINE,
|
|
152
315
|
children: t('decline')
|
|
153
316
|
}),
|
|
154
317
|
/*#__PURE__*/ jsx(Button, {
|
|
155
318
|
variant: "success",
|
|
319
|
+
disabled: disabledButtons,
|
|
156
320
|
onClick: handleConfirmation,
|
|
157
321
|
"data-id": CONFIRM_MODAL_ACTION_CONFIRM,
|
|
158
322
|
children: t('confirm')
|
|
@@ -3,10 +3,14 @@ export interface ProductSetCardProps extends HasPermissionProp {
|
|
|
3
3
|
name: string;
|
|
4
4
|
rrule?: string;
|
|
5
5
|
href: string;
|
|
6
|
-
|
|
6
|
+
duplicateProductSetName: string;
|
|
7
|
+
onChangeDuplicateProductSetName: (value: string) => void;
|
|
8
|
+
onCopy: () => Promise<boolean | undefined>;
|
|
7
9
|
onRemove: () => void;
|
|
10
|
+
isLoading?: boolean;
|
|
8
11
|
className?: string;
|
|
9
12
|
override?: number;
|
|
13
|
+
duplicateProductSetError?: string;
|
|
10
14
|
}
|
|
11
|
-
export declare function ProductSetCard({ name, rrule, href, onCopy, onRemove, className, hasPermission, override, }: ProductSetCardProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function ProductSetCard({ name, rrule, href, onCopy, onRemove, onChangeDuplicateProductSetName, duplicateProductSetName, duplicateProductSetError, isLoading, className, hasPermission, override, }: ProductSetCardProps): import("react/jsx-runtime").JSX.Element;
|
|
12
16
|
//# sourceMappingURL=ProductSetCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductSetCard.d.ts","sourceRoot":"","sources":["../../../src/product-set/card/ProductSetCard.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;
|
|
1
|
+
{"version":3,"file":"ProductSetCard.d.ts","sourceRoot":"","sources":["../../../src/product-set/card/ProductSetCard.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAOtF,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,uBAAuB,EAAE,MAAM,CAAA;IAC/B,+BAA+B,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxD,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IAC1C,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,+BAA+B,EAC/B,uBAAuB,EACvB,wBAAwB,EACxB,SAAS,EACT,SAAc,EACd,aAAoB,EACpB,QAAY,GACb,EAAE,mBAAmB,2CAuIrB"}
|
|
@@ -9,6 +9,7 @@ import RouteService from '@licklist/plugins/dist/services/Route/RouteService';
|
|
|
9
9
|
import { FaEye, FaTrashAlt, FaEllipsisH } from 'react-icons/fa';
|
|
10
10
|
import { ConfirmModal } from '../../modals/confirmation/ConfirmModal.js';
|
|
11
11
|
import { MenuButton } from '../../table/MenuButton.js';
|
|
12
|
+
import { ProductSetNameControl } from '../form/ProductSetNameControl.js';
|
|
12
13
|
|
|
13
14
|
function _array_like_to_array(arr, len) {
|
|
14
15
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -57,21 +58,20 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
57
58
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
58
59
|
}
|
|
59
60
|
function ProductSetCard(param) {
|
|
60
|
-
var name = param.name, rrule = param.rrule, href = param.href, onCopy = param.onCopy, onRemove = param.onRemove, _param_className = param.className, className = _param_className === void 0 ? '' : _param_className, _param_hasPermission = param.hasPermission, hasPermission = _param_hasPermission === void 0 ? true : _param_hasPermission, _param_override = param.override, override = _param_override === void 0 ? 0 : _param_override;
|
|
61
|
+
var name = param.name, rrule = param.rrule, href = param.href, onCopy = param.onCopy, onRemove = param.onRemove, onChangeDuplicateProductSetName = param.onChangeDuplicateProductSetName, duplicateProductSetName = param.duplicateProductSetName, duplicateProductSetError = param.duplicateProductSetError, isLoading = param.isLoading, _param_className = param.className, className = _param_className === void 0 ? '' : _param_className, _param_hasPermission = param.hasPermission, hasPermission = _param_hasPermission === void 0 ? true : _param_hasPermission, _param_override = param.override, override = _param_override === void 0 ? 0 : _param_override;
|
|
61
62
|
var t = useTranslation('Design').t;
|
|
62
63
|
var popoverId = useId();
|
|
63
64
|
var productSetCardClasses = "product-set-card ".concat(className);
|
|
64
65
|
var _useState = _sliced_to_array(useState(false), 2), isOverlayVisibile = _useState[0], setIsOverlayVisible = _useState[1];
|
|
65
|
-
|
|
66
|
+
var onCardClick = function() {
|
|
67
|
+
RouteService.redirectTo(href);
|
|
68
|
+
};
|
|
69
|
+
return(// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
70
|
+
/*#__PURE__*/ jsx("div", {
|
|
66
71
|
role: "button",
|
|
67
72
|
tabIndex: 0,
|
|
68
73
|
className: "border-0 product-set-card-wrapper w-100 pb-0",
|
|
69
|
-
onClick:
|
|
70
|
-
return RouteService.redirectTo(href);
|
|
71
|
-
},
|
|
72
|
-
onKeyUp: function() {
|
|
73
|
-
return RouteService.redirectTo(href);
|
|
74
|
-
},
|
|
74
|
+
onClick: onCardClick,
|
|
75
75
|
children: /*#__PURE__*/ jsxs("div", {
|
|
76
76
|
className: productSetCardClasses,
|
|
77
77
|
children: [
|
|
@@ -83,7 +83,6 @@ function ProductSetCard(param) {
|
|
|
83
83
|
/*#__PURE__*/ jsxs("div", {
|
|
84
84
|
children: [
|
|
85
85
|
name,
|
|
86
|
-
" ",
|
|
87
86
|
rrule && "(".concat(RRule.fromString(rrule).toText(), ")")
|
|
88
87
|
]
|
|
89
88
|
}),
|
|
@@ -126,11 +125,21 @@ function ProductSetCard(param) {
|
|
|
126
125
|
return e.stopPropagation();
|
|
127
126
|
},
|
|
128
127
|
children: Boolean(onCopy) && /*#__PURE__*/ jsx(ConfirmModal, {
|
|
128
|
+
// confirm function memoize the callback function and it leads to bugs
|
|
129
|
+
confirmationHandler: onCopy,
|
|
130
|
+
disabledButtons: isLoading,
|
|
131
|
+
content: /*#__PURE__*/ jsx(ProductSetNameControl, {
|
|
132
|
+
value: duplicateProductSetName,
|
|
133
|
+
onChange: onChangeDuplicateProductSetName,
|
|
134
|
+
error: duplicateProductSetError
|
|
135
|
+
}),
|
|
129
136
|
children: function(confirm) {
|
|
130
137
|
return /*#__PURE__*/ jsx(MenuButton, {
|
|
131
138
|
onClick: function() {
|
|
132
139
|
setIsOverlayVisible(false);
|
|
133
|
-
|
|
140
|
+
onChangeDuplicateProductSetName(name);
|
|
141
|
+
// confirm function memoize the callback function and it leads to bugs
|
|
142
|
+
confirm(function() {});
|
|
134
143
|
},
|
|
135
144
|
name: t('duplicate'),
|
|
136
145
|
className: "product-set-card-menu-item-text"
|
|
@@ -182,7 +191,7 @@ function ProductSetCard(param) {
|
|
|
182
191
|
})
|
|
183
192
|
]
|
|
184
193
|
})
|
|
185
|
-
});
|
|
194
|
+
}));
|
|
186
195
|
}
|
|
187
196
|
|
|
188
197
|
export { ProductSetCard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductSetForm.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductSetForm.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAA;AAIzF,OAAO,EAAE,WAAW,EAAE,MAAM,8DAA8D,CAAA;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAA;AAK3E,OAAO,EAAE,gCAAgC,EAAE,MAAM,oFAAoF,CAAA;AACrI,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAA;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAA;
|
|
1
|
+
{"version":3,"file":"ProductSetForm.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductSetForm.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAA;AAIzF,OAAO,EAAE,WAAW,EAAE,MAAM,8DAA8D,CAAA;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAA;AAK3E,OAAO,EAAE,gCAAgC,EAAE,MAAM,oFAAoF,CAAA;AACrI,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAA;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAA;AAGrF,OAAO,EAEL,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAG3D,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAA;CACnB;AACD,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;CACX;AACD,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,MAAM,EACN,uBAAuB;IACzB,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,mBACf,SAAQ,aAAa,EACnB,uBAAuB;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC,mBAAmB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAC3D,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAC3D,gBAAgB,CAAC,EAAE,UAAU,EAAE,CAAA;IAC/B,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;IAC5B,4BAA4B,CAAC,EAAE,gCAAgC,CAAC,sBAAsB,CAAC,CAAA;IACvF,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAA;IACtB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAsB,EACtB,YAAiB,EACjB,4BAA4B,EAC5B,KAAK,EACL,cAAc,EACd,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,mBAAmB,2CA0JrB"}
|