@licklist/design 0.66.10-dev.0 → 0.66.10-dev.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/auth/Login/LoginComponent.js +2 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +7 -2
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +22 -9
- package/dist/layout/DropDown.d.ts +2 -1
- package/dist/layout/DropDown.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.js +3 -3
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -3
- package/dist/product-set/form/ProductZonesControl.d.ts +9 -0
- package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -0
- package/dist/product-set/form/ProductZonesControl.js +214 -0
- package/dist/product-set/form/ProductsControl.d.ts +1 -3
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +2 -13
- package/dist/product-set/product/ProductControl.d.ts +5 -8
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +19 -301
- package/dist/product-set/product/advanced-options/AdvancedOptions.d.ts +8 -0
- package/dist/product-set/product/advanced-options/AdvancedOptions.d.ts.map +1 -0
- package/dist/product-set/product/advanced-options/AdvancedOptions.js +264 -0
- package/dist/product-set/product/advanced-options/index.d.ts +2 -0
- package/dist/product-set/product/advanced-options/index.d.ts.map +1 -0
- package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.js +1 -0
- package/dist/product-set/product-category/ProductCategoryControl.d.ts +0 -2
- package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.js +2 -57
- package/dist/product-set/product-zone/ProductZoneControl.d.ts +15 -0
- package/dist/product-set/product-zone/ProductZoneControl.d.ts.map +1 -0
- package/dist/product-set/product-zone/ProductZoneControl.js +263 -0
- package/dist/product-set/product-zone/index.d.ts +2 -0
- package/dist/product-set/product-zone/index.d.ts.map +1 -0
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.js +3 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts +3 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/sortable-tree/SortableTreeItem.js +15 -5
- package/dist/styles/product-set/CreateProductSetItem.scss +8 -0
- package/dist/styles/product-set/EditZoneSettingModal.scss +16 -0
- package/dist/styles/product-set/ProductSetForm.scss +14 -1
- package/dist/styles/product-set/_index.scss +2 -1
- package/package.json +1 -1
- package/src/auth/Login/LoginComponent.tsx +1 -1
- package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +2 -4
- package/src/layout/DropDown.tsx +1 -1
- package/src/product-set/control/ProductSetControl.tsx +2 -1
- package/src/product-set/form/ProductCategoriesControl.tsx +0 -3
- package/src/product-set/form/ProductZonesControl.tsx +178 -0
- package/src/product-set/form/ProductsControl.tsx +0 -17
- package/src/product-set/product/ProductControl.tsx +23 -268
- package/src/product-set/product/advanced-options/AdvancedOptions.tsx +168 -0
- package/src/product-set/product/advanced-options/index.ts +1 -0
- package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +1 -1
- package/src/product-set/product-category/ProductCategoryControl.tsx +1 -60
- package/src/product-set/product-zone/ProductZoneControl.tsx +247 -0
- package/src/product-set/product-zone/index.ts +1 -0
- package/src/product-set/utils/index.ts +5 -1
- package/src/sortable-tree/SortableTreeItem.tsx +59 -45
- package/src/styles/product-set/CreateProductSetItem.scss +8 -0
- package/src/styles/product-set/EditZoneSettingModal.scss +16 -0
- package/src/styles/product-set/ProductSetForm.scss +14 -1
- package/src/styles/product-set/_index.scss +2 -1
- package/yarn.lock +108 -87
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext, useMemo, useEffect } from 'react';
|
|
3
|
+
import { Row, Col, Form } from 'react-bootstrap';
|
|
4
|
+
import { useFormContext, useWatch, Controller } from 'react-hook-form';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { CATEGORY_TYPE_FIXED_DURATION, CATEGORY_TYPE_GAME } from '@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper';
|
|
7
|
+
import { HookFormService } from '@licklist/plugins';
|
|
8
|
+
import { ProductDurationControl } from '../product/duration/ProductDurationControl.js';
|
|
9
|
+
import { FormNumberInput } from '../../static/form-number-input/FormNumberInput.js';
|
|
10
|
+
import { FixedDurationOptions } from '../product/fixed-duration-fields/FixedDurationOptions.js';
|
|
11
|
+
import { ProductSetLoadingContext } from '../form/context.js';
|
|
12
|
+
|
|
13
|
+
function _define_property(obj, key, value) {
|
|
14
|
+
if (key in obj) {
|
|
15
|
+
Object.defineProperty(obj, key, {
|
|
16
|
+
value: value,
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
obj[key] = value;
|
|
23
|
+
}
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
function _object_spread(target) {
|
|
27
|
+
for(var i = 1; i < arguments.length; i++){
|
|
28
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
29
|
+
var ownKeys = Object.keys(source);
|
|
30
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
31
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
32
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
ownKeys.forEach(function(key) {
|
|
36
|
+
_define_property(target, key, source[key]);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return target;
|
|
40
|
+
}
|
|
41
|
+
function ownKeys(object, enumerableOnly) {
|
|
42
|
+
var keys = Object.keys(object);
|
|
43
|
+
if (Object.getOwnPropertySymbols) {
|
|
44
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
45
|
+
if (enumerableOnly) {
|
|
46
|
+
symbols = symbols.filter(function(sym) {
|
|
47
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
keys.push.apply(keys, symbols);
|
|
51
|
+
}
|
|
52
|
+
return keys;
|
|
53
|
+
}
|
|
54
|
+
function _object_spread_props(target, source) {
|
|
55
|
+
source = source != null ? source : {};
|
|
56
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
57
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
58
|
+
} else {
|
|
59
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
60
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return target;
|
|
64
|
+
}
|
|
65
|
+
var ProductZoneControl = function(param) {
|
|
66
|
+
var isOverrides = param.isOverrides, categoryType = param.categoryType, fieldNamePrefix = param.fieldNamePrefix, productZonesFieldName = param.productZonesFieldName;
|
|
67
|
+
var t = useTranslation([
|
|
68
|
+
"Design",
|
|
69
|
+
"Validation",
|
|
70
|
+
"ProductSet"
|
|
71
|
+
]).t;
|
|
72
|
+
var _useFormContext = useFormContext(), trigger = _useFormContext.trigger, control = _useFormContext.control, setValue = _useFormContext.setValue, clearErrors = _useFormContext.clearErrors, errors = _useFormContext.formState.errors;
|
|
73
|
+
var productZones = useWatch({
|
|
74
|
+
control: control,
|
|
75
|
+
name: productZonesFieldName
|
|
76
|
+
});
|
|
77
|
+
var _useWatch = useWatch({
|
|
78
|
+
control: control,
|
|
79
|
+
name: "".concat(fieldNamePrefix)
|
|
80
|
+
}), capacity = _useWatch.capacity, zoneId = _useWatch.zoneId;
|
|
81
|
+
var disabledDuration = capacity === "0" || !capacity;
|
|
82
|
+
var _useContext = useContext(ProductSetLoadingContext), providerHasBookingManagement = _useContext.providerHasBookingManagement, _useContext_zones = _useContext.zones, zones = _useContext_zones === void 0 ? [] : _useContext_zones;
|
|
83
|
+
var currentZoneData = zones.find(function(zone) {
|
|
84
|
+
return zone.id === Number(zoneId);
|
|
85
|
+
});
|
|
86
|
+
var availableZones = useMemo(function() {
|
|
87
|
+
return zones.filter(function(zone) {
|
|
88
|
+
return !productZones.find(function(productZone) {
|
|
89
|
+
return Number(productZone.zoneId) === zone.id && productZone.zoneId !== zoneId;
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}, [
|
|
93
|
+
zones,
|
|
94
|
+
productZones,
|
|
95
|
+
zoneId
|
|
96
|
+
]);
|
|
97
|
+
useEffect(function() {
|
|
98
|
+
if (!disabledDuration) {
|
|
99
|
+
trigger("".concat(fieldNamePrefix, ".duration"));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
setValue("".concat(fieldNamePrefix, ".duration"), /* @ts-expect-error 6385 */ 0);
|
|
103
|
+
clearErrors("".concat(fieldNamePrefix, ".duration"));
|
|
104
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
105
|
+
}, [
|
|
106
|
+
disabledDuration
|
|
107
|
+
]);
|
|
108
|
+
var onChangeGameCapacity = function(value) {
|
|
109
|
+
if (!(currentZoneData === null || currentZoneData === void 0 ? void 0 : currentZoneData.defaultDuration)) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
setValue("".concat(fieldNamePrefix, ".duration"), /* @ts-expect-error 6385 */ value * (currentZoneData === null || currentZoneData === void 0 ? void 0 : currentZoneData.defaultDuration));
|
|
113
|
+
};
|
|
114
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
115
|
+
children: [
|
|
116
|
+
/*#__PURE__*/ jsx(Fragment, {
|
|
117
|
+
children: /*#__PURE__*/ jsx(Row, {
|
|
118
|
+
children: /*#__PURE__*/ jsx(Col, {
|
|
119
|
+
children: /*#__PURE__*/ jsxs(Form.Group, {
|
|
120
|
+
children: [
|
|
121
|
+
/*#__PURE__*/ jsx(Form.Label, {
|
|
122
|
+
children: t("Design:zone")
|
|
123
|
+
}),
|
|
124
|
+
/*#__PURE__*/ jsx(Controller, {
|
|
125
|
+
control: control,
|
|
126
|
+
name: "".concat(fieldNamePrefix, ".zoneId"),
|
|
127
|
+
render: function(param) {
|
|
128
|
+
var field = param.field;
|
|
129
|
+
return /*#__PURE__*/ jsxs(Form.Control, _object_spread_props(_object_spread({
|
|
130
|
+
as: "select",
|
|
131
|
+
disabled: isOverrides,
|
|
132
|
+
isInvalid: HookFormService.isInvalid("".concat(fieldNamePrefix, ".zoneId"), errors)
|
|
133
|
+
}, field), {
|
|
134
|
+
children: [
|
|
135
|
+
/*#__PURE__*/ jsx("option", {
|
|
136
|
+
value: null,
|
|
137
|
+
children: t("Design:choose")
|
|
138
|
+
}),
|
|
139
|
+
availableZones.map(function(zone) {
|
|
140
|
+
return /*#__PURE__*/ jsx("option", {
|
|
141
|
+
value: zone.id,
|
|
142
|
+
children: zone.name
|
|
143
|
+
}, zone.id);
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
}));
|
|
147
|
+
},
|
|
148
|
+
rules: {
|
|
149
|
+
required: {
|
|
150
|
+
value: providerHasBookingManagement,
|
|
151
|
+
message: t("Validation:fieldRequired", {
|
|
152
|
+
attribute: t("zone")
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}),
|
|
157
|
+
/*#__PURE__*/ jsx(Form.Control.Feedback, {
|
|
158
|
+
type: "invalid",
|
|
159
|
+
children: HookFormService.getErrors("".concat(fieldNamePrefix, ".zoneId"), errors)
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
}),
|
|
166
|
+
categoryType === CATEGORY_TYPE_FIXED_DURATION && /*#__PURE__*/ jsxs(Row, {
|
|
167
|
+
className: "align-items-start duration-capacity-container",
|
|
168
|
+
children: [
|
|
169
|
+
/*#__PURE__*/ jsx(ProductDurationControl, {
|
|
170
|
+
fieldNamePrefix: fieldNamePrefix,
|
|
171
|
+
disabled: disabledDuration || isOverrides
|
|
172
|
+
}),
|
|
173
|
+
/*#__PURE__*/ jsx(Col, {
|
|
174
|
+
lg: 4,
|
|
175
|
+
md: 4,
|
|
176
|
+
children: /*#__PURE__*/ jsx(FormNumberInput, {
|
|
177
|
+
fieldName: "".concat(fieldNamePrefix, ".capacity"),
|
|
178
|
+
label: t("capacity"),
|
|
179
|
+
disabled: isOverrides,
|
|
180
|
+
rules: {
|
|
181
|
+
min: {
|
|
182
|
+
value: 0,
|
|
183
|
+
message: t("Validation:fieldMinNumber", {
|
|
184
|
+
attribute: t("capacity"),
|
|
185
|
+
min: 0
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
}),
|
|
191
|
+
disabledDuration && /*#__PURE__*/ jsx("div", {
|
|
192
|
+
className: "duration-hint duration-capacity-container",
|
|
193
|
+
children: t("Design:forDurationEditing")
|
|
194
|
+
})
|
|
195
|
+
]
|
|
196
|
+
}),
|
|
197
|
+
categoryType === CATEGORY_TYPE_GAME && /*#__PURE__*/ jsxs(Fragment, {
|
|
198
|
+
children: [
|
|
199
|
+
/*#__PURE__*/ jsxs(Row, {
|
|
200
|
+
className: "align-items-start duration-capacity-container",
|
|
201
|
+
children: [
|
|
202
|
+
/*#__PURE__*/ jsx(Col, {
|
|
203
|
+
lg: 4,
|
|
204
|
+
md: 4,
|
|
205
|
+
children: /*#__PURE__*/ jsx(FormNumberInput, {
|
|
206
|
+
fieldName: "".concat(fieldNamePrefix, ".capacity"),
|
|
207
|
+
label: t("capacity"),
|
|
208
|
+
onChange: onChangeGameCapacity,
|
|
209
|
+
disabled: isOverrides,
|
|
210
|
+
rules: {
|
|
211
|
+
min: {
|
|
212
|
+
value: 0,
|
|
213
|
+
message: t("Validation:fieldMinNumber", {
|
|
214
|
+
attribute: t("capacity"),
|
|
215
|
+
min: 1
|
|
216
|
+
})
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
}),
|
|
221
|
+
/*#__PURE__*/ jsx(Col, {
|
|
222
|
+
lg: 4,
|
|
223
|
+
md: 4,
|
|
224
|
+
children: /*#__PURE__*/ jsx(FormNumberInput, {
|
|
225
|
+
fieldName: "".concat(fieldNamePrefix, ".duration"),
|
|
226
|
+
label: t("durationMinutes"),
|
|
227
|
+
disabled: disabledDuration || isOverrides,
|
|
228
|
+
rules: {
|
|
229
|
+
min: {
|
|
230
|
+
value: 0,
|
|
231
|
+
message: t("Validation:fieldMinNumber", {
|
|
232
|
+
attribute: t("duration"),
|
|
233
|
+
min: 0
|
|
234
|
+
})
|
|
235
|
+
},
|
|
236
|
+
validate: function(val) {
|
|
237
|
+
if (!disabledDuration && (!val || val < 1)) {
|
|
238
|
+
return t("Validation:fieldRequired", {
|
|
239
|
+
attribute: t("duration")
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
})
|
|
247
|
+
]
|
|
248
|
+
}),
|
|
249
|
+
disabledDuration && /*#__PURE__*/ jsx("div", {
|
|
250
|
+
className: "duration-hint pl-0",
|
|
251
|
+
children: t("Design:forDurationEditing")
|
|
252
|
+
})
|
|
253
|
+
]
|
|
254
|
+
}),
|
|
255
|
+
/*#__PURE__*/ jsx(FixedDurationOptions, {
|
|
256
|
+
fieldNamePrefix: fieldNamePrefix,
|
|
257
|
+
isOverrides: isOverrides
|
|
258
|
+
})
|
|
259
|
+
]
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export { ProductZoneControl };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product-set/product-zone/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product-set/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,MAAM,mEAAmE,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product-set/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,MAAM,mEAAmE,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,UAAU,yBAAyB;IACjC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,QAAQ,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC;IAChD,CAAC,EAAE,SAAS,CAAC;CACd;AAED,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAC1B,CAAC,EAAE,aACC,MAAM,aACN,MAAM,QAQlB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,CAAC,EAAE;;IAE7C,CAAC;AAEF,eAAO,MAAM,oBAAoB,eACnB,aAAa,EAAE,GAAG,WAAW,EAAE,kBAC3B,YAAY,EAAE,KAC7B,YAAY,EAAE,GAAG,SAmBnB,CAAC;AAEF,eAAO,MAAM,yBAAyB,6BAInC,yBAAyB,YA0B3B,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { checkIfZoneCategory } from '@licklist/plugins';
|
|
2
|
+
|
|
1
3
|
function _array_like_to_array(arr, len) {
|
|
2
4
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
5
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -113,7 +115,7 @@ var checkAvailableTimesErrors = function(param) {
|
|
|
113
115
|
var hasError = false;
|
|
114
116
|
var hasCategoryWithZone = values === null || values === void 0 ? void 0 : (_values_steps = values.steps) === null || _values_steps === void 0 ? void 0 : _values_steps.some(function(step) {
|
|
115
117
|
return !!(step === null || step === void 0 ? void 0 : step.productCategories.some(function(category) {
|
|
116
|
-
return
|
|
118
|
+
return checkIfZoneCategory(category.type);
|
|
117
119
|
}));
|
|
118
120
|
});
|
|
119
121
|
if (!hasCategoryWithZone) {
|
|
@@ -3,6 +3,7 @@ export declare const ProductSetModalClasses: {
|
|
|
3
3
|
readonly step: "edit-product-step";
|
|
4
4
|
readonly category: "edit-product-category";
|
|
5
5
|
readonly product: "edit-product";
|
|
6
|
+
readonly productZones: "edit-product-zone";
|
|
6
7
|
};
|
|
7
8
|
export type ProductSetModalClassesType = (typeof ProductSetModalClasses)[keyof typeof ProductSetModalClasses];
|
|
8
9
|
export interface SortableTreeItemProps {
|
|
@@ -16,6 +17,7 @@ export interface SortableTreeItemProps {
|
|
|
16
17
|
postItem?: ReactNode;
|
|
17
18
|
sortableItems?: string[];
|
|
18
19
|
isExpanded?: boolean;
|
|
20
|
+
shouldExpand?: boolean;
|
|
19
21
|
isInvalid?: boolean;
|
|
20
22
|
isIconInHeader?: boolean;
|
|
21
23
|
treeLineIconColor?: string;
|
|
@@ -34,5 +36,5 @@ export interface SortableTreeItemProps {
|
|
|
34
36
|
setIsExpanded?: () => void;
|
|
35
37
|
isOverride?: boolean;
|
|
36
38
|
}
|
|
37
|
-
export declare function SortableTreeItem({ id, title, badge, subTitle, body, children, preItem, postItem, sortableItems, isExpanded, isInvalid, isIconInHeader, treeLineIconColor, modalLabel, modalClass, isNewAdded, onDelete, validate, cancelChanges, saveValidField, edit, secondaryBadge, setIsExpanded, isOverride, }: SortableTreeItemProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare function SortableTreeItem({ id, title, badge, subTitle, body, children, preItem, postItem, sortableItems, isExpanded, shouldExpand, isInvalid, isIconInHeader, treeLineIconColor, modalLabel, modalClass, isNewAdded, onDelete, validate, cancelChanges, saveValidField, edit, secondaryBadge, setIsExpanded, isOverride, }: SortableTreeItemProps): import("react/jsx-runtime").JSX.Element;
|
|
38
40
|
//# sourceMappingURL=SortableTreeItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortableTreeItem.d.ts","sourceRoot":"","sources":["../../src/sortable-tree/SortableTreeItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoC,MAAM,OAAO,CAAC;AAiBpE,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"SortableTreeItem.d.ts","sourceRoot":"","sources":["../../src/sortable-tree/SortableTreeItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoC,MAAM,OAAO,CAAC;AAiBpE,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AAEX,MAAM,MAAM,0BAA0B,GACpC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAEvE,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,0BAA0B,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,KAAK,EACL,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,aAAa,EACb,UAAkB,EAClB,YAAmB,EACnB,SAAiB,EACjB,cAAqB,EACrB,iBAAsB,EACtB,UAAe,EACf,UAAU,EACV,UAAkB,EAClB,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,cAAc,EACd,IAAI,EACJ,cAAc,EACd,aAAa,EACb,UAAU,GACX,EAAE,qBAAqB,2CA2TvB"}
|
|
@@ -236,10 +236,11 @@ var DRAG_RADIUS_LIMIT = 5;
|
|
|
236
236
|
var ProductSetModalClasses = {
|
|
237
237
|
step: "edit-product-step",
|
|
238
238
|
category: "edit-product-category",
|
|
239
|
-
product: "edit-product"
|
|
239
|
+
product: "edit-product",
|
|
240
|
+
productZones: "edit-product-zone"
|
|
240
241
|
};
|
|
241
242
|
function SortableTreeItem(param) {
|
|
242
|
-
var id = param.id, title = param.title, badge = param.badge, subTitle = param.subTitle, body = param.body, children = param.children, preItem = param.preItem, postItem = param.postItem, sortableItems = param.sortableItems, _param_isExpanded = param.isExpanded, isExpanded = _param_isExpanded === void 0 ? false : _param_isExpanded, _param_isInvalid = param.isInvalid, isInvalid = _param_isInvalid === void 0 ? false : _param_isInvalid, _param_isIconInHeader = param.isIconInHeader, isIconInHeader = _param_isIconInHeader === void 0 ? true : _param_isIconInHeader, _param_treeLineIconColor = param.treeLineIconColor, treeLineIconColor = _param_treeLineIconColor === void 0 ? "" : _param_treeLineIconColor, _param_modalLabel = param.modalLabel, modalLabel = _param_modalLabel === void 0 ? "" : _param_modalLabel, modalClass = param.modalClass, _param_isNewAdded = param.isNewAdded, isNewAdded = _param_isNewAdded === void 0 ? false : _param_isNewAdded, onDelete = param.onDelete, validate = param.validate, cancelChanges = param.cancelChanges, saveValidField = param.saveValidField, edit = param.edit, secondaryBadge = param.secondaryBadge, setIsExpanded = param.setIsExpanded, isOverride = param.isOverride;
|
|
243
|
+
var id = param.id, title = param.title, badge = param.badge, subTitle = param.subTitle, body = param.body, children = param.children, preItem = param.preItem, postItem = param.postItem, sortableItems = param.sortableItems, _param_isExpanded = param.isExpanded, isExpanded = _param_isExpanded === void 0 ? false : _param_isExpanded, _param_shouldExpand = param.shouldExpand, shouldExpand = _param_shouldExpand === void 0 ? true : _param_shouldExpand, _param_isInvalid = param.isInvalid, isInvalid = _param_isInvalid === void 0 ? false : _param_isInvalid, _param_isIconInHeader = param.isIconInHeader, isIconInHeader = _param_isIconInHeader === void 0 ? true : _param_isIconInHeader, _param_treeLineIconColor = param.treeLineIconColor, treeLineIconColor = _param_treeLineIconColor === void 0 ? "" : _param_treeLineIconColor, _param_modalLabel = param.modalLabel, modalLabel = _param_modalLabel === void 0 ? "" : _param_modalLabel, modalClass = param.modalClass, _param_isNewAdded = param.isNewAdded, isNewAdded = _param_isNewAdded === void 0 ? false : _param_isNewAdded, onDelete = param.onDelete, validate = param.validate, cancelChanges = param.cancelChanges, saveValidField = param.saveValidField, edit = param.edit, secondaryBadge = param.secondaryBadge, setIsExpanded = param.setIsExpanded, isOverride = param.isOverride;
|
|
243
244
|
var _useState = _sliced_to_array(useState(isExpanded), 2), expanded = _useState[0], setExpanded = _useState[1];
|
|
244
245
|
var _useState1 = _sliced_to_array(useState(isNewAdded), 2), isModalVisible = _useState1[0], setIsModalVisible = _useState1[1];
|
|
245
246
|
var t = useTranslation("Design").t;
|
|
@@ -252,9 +253,12 @@ function SortableTreeItem(param) {
|
|
|
252
253
|
}), 2), position = _useState2[0], setPosition = _useState2[1];
|
|
253
254
|
var _useDraggable = useDraggable({
|
|
254
255
|
id: id,
|
|
255
|
-
disabled: isOverride
|
|
256
|
+
disabled: isOverride || !shouldExpand
|
|
256
257
|
}), isDragging = _useDraggable.isDragging, dragAttributes = _useDraggable.attributes, dragListeners = _useDraggable.listeners, setDragNodeRef = _useDraggable.setNodeRef, dragTransform = _useDraggable.transform;
|
|
257
258
|
var onHandleExpand = useCallback(function(event) {
|
|
259
|
+
if (!shouldExpand) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
258
262
|
var deltaX = event.pageX - position.pageX;
|
|
259
263
|
var deltaY = event.pageY - position.pageY;
|
|
260
264
|
var euclidean = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
@@ -270,15 +274,21 @@ function SortableTreeItem(param) {
|
|
|
270
274
|
});
|
|
271
275
|
}, [
|
|
272
276
|
position,
|
|
277
|
+
shouldExpand,
|
|
273
278
|
setIsExpanded
|
|
274
279
|
]);
|
|
275
280
|
var isVisibleDeleteButton = Boolean(onDelete) && !isOverride;
|
|
276
281
|
var onButtonMouseDown = useCallback(function(event) {
|
|
282
|
+
if (!shouldExpand) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
277
285
|
setPosition({
|
|
278
286
|
pageX: event.pageX,
|
|
279
287
|
pageY: event.pageY
|
|
280
288
|
});
|
|
281
|
-
}, [
|
|
289
|
+
}, [
|
|
290
|
+
shouldExpand
|
|
291
|
+
]);
|
|
282
292
|
var onHide = function() {
|
|
283
293
|
var _ref = _async_to_generator(function() {
|
|
284
294
|
var success;
|
|
@@ -356,7 +366,7 @@ function SortableTreeItem(param) {
|
|
|
356
366
|
opacity: isDragging ? 0.7 : 1
|
|
357
367
|
} : null,
|
|
358
368
|
children: [
|
|
359
|
-
/*#__PURE__*/ jsxs("div", {
|
|
369
|
+
shouldExpand && /*#__PURE__*/ jsxs("div", {
|
|
360
370
|
className: "sortable-tree-line",
|
|
361
371
|
children: [
|
|
362
372
|
/*#__PURE__*/ jsx(Button, {
|
|
@@ -17,6 +17,14 @@ $product-set-item-hover-bg-color: #d9efff !default;
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
.product-set-item-wrapper-zone {
|
|
21
|
+
color:#84269B;
|
|
22
|
+
background-color: rgba($color: #84269B, $alpha: 0.1);
|
|
23
|
+
.product-set-item-icon {
|
|
24
|
+
background-color: #84269B;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
.product-set-item-wrapper-category {
|
|
21
29
|
color: #1A93AA;
|
|
22
30
|
background-color: rgba($color: #1A93AA, $alpha: 0.1);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.edit-right-form-modal.edit-product-zone {
|
|
2
|
+
padding: 0;
|
|
3
|
+
.top-label-container {
|
|
4
|
+
background-color: #EFE9F5;
|
|
5
|
+
span {
|
|
6
|
+
color:#84269B;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
@include media-breakpoint-down(sm) {
|
|
10
|
+
top: 5%;
|
|
11
|
+
.step-save-btn {
|
|
12
|
+
margin-top: 1rem;
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
|
|
51
51
|
.step-badge,
|
|
52
52
|
.category-badge,
|
|
53
|
-
.product-badge
|
|
53
|
+
.product-badge {
|
|
54
54
|
font-size: 0.875rem;
|
|
55
55
|
font-weight: 600;
|
|
56
56
|
}
|
|
@@ -67,6 +67,8 @@
|
|
|
67
67
|
background-color: #e9f5ea;
|
|
68
68
|
color: #269b36;
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
.product-set-mobile-footer {
|
|
@@ -174,3 +176,14 @@
|
|
|
174
176
|
}
|
|
175
177
|
}
|
|
176
178
|
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
.sortable-tree-item-toggle {
|
|
182
|
+
|
|
183
|
+
.product-zone-badge {
|
|
184
|
+
background-color: #EFE9F5;
|
|
185
|
+
color:#84269B;
|
|
186
|
+
font-size: 0.875rem;
|
|
187
|
+
font-weight: 600;
|
|
188
|
+
}
|
|
189
|
+
}
|
package/package.json
CHANGED
|
@@ -33,15 +33,13 @@ export const getDefaultValues = (
|
|
|
33
33
|
productCategories?.map(({ products, ...productCategory }) => ({
|
|
34
34
|
...productCategory,
|
|
35
35
|
products:
|
|
36
|
-
products?.map(({
|
|
36
|
+
products?.map(({ subProducts, ...product }) => ({
|
|
37
37
|
...product,
|
|
38
|
-
subProducts: subProducts?.map(({
|
|
38
|
+
subProducts: subProducts?.map(({ ...subProducts }) => ({
|
|
39
39
|
...subProducts,
|
|
40
40
|
productCategoryId: undefined,
|
|
41
|
-
zoneId,
|
|
42
41
|
})),
|
|
43
42
|
productCategoryId: undefined,
|
|
44
|
-
zoneId,
|
|
45
43
|
})) ?? [],
|
|
46
44
|
})) ?? [],
|
|
47
45
|
venueMapSetId: step?.venueMapSet ? step?.venueMapSet?.id : null,
|
package/src/layout/DropDown.tsx
CHANGED
|
@@ -21,6 +21,7 @@ import { SmsTemplate } from "@licklist/core/dist/DataMapper/Notification/SmsTemp
|
|
|
21
21
|
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
22
22
|
import { ruleForUrlWithProtocol } from "@licklist/plugins/dist/validation/Rules/urlRule";
|
|
23
23
|
import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
|
|
24
|
+
import { checkIfZoneCategory } from "@licklist/plugins";
|
|
24
25
|
import { WarningMessage } from "../../static";
|
|
25
26
|
import { SelectItem } from "../../types/generic/SelectItem";
|
|
26
27
|
import {
|
|
@@ -127,7 +128,7 @@ export function ProductSetControl({
|
|
|
127
128
|
const showDateSelector = !isEventEditProductSet && isOverrides;
|
|
128
129
|
|
|
129
130
|
const isZoneAdded = steps?.some(({ productCategories }) =>
|
|
130
|
-
productCategories?.some((
|
|
131
|
+
productCategories?.some((category) => checkIfZoneCategory(category?.type)),
|
|
131
132
|
);
|
|
132
133
|
|
|
133
134
|
return (
|
|
@@ -61,7 +61,6 @@ const getCategoryDefaultValue = (
|
|
|
61
61
|
isReusable: false,
|
|
62
62
|
hasSubEvents: false,
|
|
63
63
|
products: [],
|
|
64
|
-
zoneId: null,
|
|
65
64
|
sort,
|
|
66
65
|
});
|
|
67
66
|
|
|
@@ -77,7 +76,6 @@ export function ProductCategoriesControl({
|
|
|
77
76
|
providerHasMap,
|
|
78
77
|
expandedProductCategories,
|
|
79
78
|
setExpandedProductCategories,
|
|
80
|
-
zones,
|
|
81
79
|
} = useContext(ProductSetLoadingContext);
|
|
82
80
|
const form = useFormContext<ProductSetFormValues>();
|
|
83
81
|
const [isSelectCategoryVisible, setIsSelectCategoryVisible] = useState(false);
|
|
@@ -307,7 +305,6 @@ export function ProductCategoriesControl({
|
|
|
307
305
|
quantityType={productCategory.quantityType}
|
|
308
306
|
hasTicket={productCategory?.hasTicket}
|
|
309
307
|
stepIndex={stepIndex}
|
|
310
|
-
zones={zones}
|
|
311
308
|
productCategoryIndex={index}
|
|
312
309
|
categoryType={productCategory.type}
|
|
313
310
|
isOverrides={isOverrides}
|