@pisell/private-materials 3.0.152-gray → 3.0.153
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +12 -12
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- package/es/components/booking/addons/model.d.ts +1 -2
- package/es/components/booking/components/footer/index.js +51 -36
- package/es/components/booking/components/footer/utils.js +35 -4
- package/es/components/booking/forms/forms.d.ts +0 -1
- package/es/components/booking/forms/forms.js +2 -4
- package/es/components/booking/forms/model.d.ts +1 -2
- package/es/components/booking/forms/single/index.d.ts +1 -1
- package/es/components/booking/forms/single/index.js +3 -4
- package/es/components/booking/index.js +1 -1
- package/es/components/booking/info/index.d.ts +4 -12
- package/es/components/booking/info/index.js +12 -123
- package/es/components/booking/info/index.less +0 -9
- package/es/components/booking/info/main.d.ts +12 -0
- package/es/components/booking/info/main.js +124 -0
- package/es/components/booking/info/model.js +0 -1
- package/es/components/booking/info/pet/index.js +1 -1
- package/es/components/booking/info/service/addService/index.d.ts +2 -8
- package/es/components/booking/info/service/addService/index.js +36 -82
- package/es/components/booking/info/service/addService/index.less +1 -27
- package/es/components/booking/info/service/addTimeModal/index.js +4 -4
- package/es/components/booking/info/service/editService/index.js +13 -11
- package/es/components/booking/info/utils.d.ts +1 -0
- package/es/components/booking/info/utils.js +7 -0
- package/es/components/booking/info2/index.d.ts +12 -0
- package/es/components/booking/{dashboard → info2}/index.js +196 -222
- package/es/components/booking/info2/serve.d.ts +6 -0
- package/es/components/booking/info2/serve.js +79 -0
- package/es/components/booking/info2/service/actions/index.d.ts +6 -0
- package/es/components/booking/info2/service/actions/index.js +86 -0
- package/es/components/booking/info2/service/addService/index.d.ts +6 -0
- package/es/components/booking/info2/service/addService/index.js +403 -0
- package/es/components/booking/info2/service/addService/mock.d.ts +214 -0
- package/es/components/booking/info2/service/addService/mock.js +332 -0
- package/es/components/booking/info2/service/addService/utils.d.ts +71 -0
- package/es/components/booking/info2/service/addService/utils.js +510 -0
- package/es/components/booking/info2/service/addTimeModal/index.d.ts +4 -0
- package/es/components/booking/info2/service/addTimeModal/index.js +681 -0
- package/es/components/booking/info2/service/addTimeModal/serve.d.ts +9 -0
- package/es/components/booking/{dashboard → info2/service/addTimeModal}/serve.js +51 -5
- package/es/components/booking/info2/service/addTimeModal/utils.d.ts +31 -0
- package/es/components/booking/info2/service/addTimeModal/utils.js +176 -0
- package/es/components/booking/info2/service/editService/Capacity/index.d.ts +4 -0
- package/es/components/booking/info2/service/editService/Capacity/index.js +121 -0
- package/es/components/booking/info2/service/editService/Capacity/index.less +1 -0
- package/es/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.d.ts +7 -0
- package/es/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.js +28 -0
- package/es/components/booking/info2/service/editService/Resources/index.d.ts +4 -0
- package/es/components/booking/info2/service/editService/Resources/index.js +233 -0
- package/es/components/booking/info2/service/editService/Resources/index.less +21 -0
- package/es/components/booking/info2/service/editService/index.d.ts +7 -0
- package/es/components/booking/info2/service/editService/index.js +617 -0
- package/es/components/booking/info2/service/editService/index.less +99 -0
- package/es/components/booking/info2/service/editService/utils.d.ts +11 -0
- package/es/components/booking/{info/addServiceVariant/index.js → info2/service/editService/utils.js} +30 -26
- package/es/components/booking/info2/service/index.d.ts +4 -0
- package/es/components/booking/info2/service/index.js +55 -0
- package/es/components/booking/info2/service/serviceItem/index.d.ts +4 -0
- package/es/components/booking/info2/service/serviceItem/index.js +176 -0
- package/es/components/booking/info2/service/serviceItem/index.less +125 -0
- package/es/components/booking/info2/service/serviceList/index.d.ts +6 -0
- package/es/components/booking/info2/service/serviceList/index.js +106 -0
- package/es/components/booking/info2/service/serviceList/index.less +0 -0
- package/es/components/booking/info2/utilsByBooking.d.ts +34 -0
- package/es/components/booking/info2/utilsByBooking.js +349 -0
- package/es/components/booking/locales.d.ts +3 -48
- package/es/components/booking/locales.js +9 -48
- package/es/components/booking/materiels/resources/index.d.ts +2 -2
- package/es/components/booking/materiels/resources/index.js +11 -11
- package/es/components/booking/mock.d.ts +1 -0
- package/es/components/booking/mock.js +66 -0
- package/es/components/booking/model.d.ts +0 -2
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -2
- package/es/components/booking/payments/model.d.ts +1 -2
- package/es/components/booking/utils.d.ts +1 -1
- package/es/components/booking/utils.js +51 -54
- package/es/components/index.d.ts +1 -1
- package/es/components/index.js +1 -1
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -2
- package/es/index.d.ts +1 -3
- package/es/index.js +2 -4
- package/lib/components/booking/addons/model.d.ts +1 -2
- package/lib/components/booking/components/footer/index.js +31 -8
- package/lib/components/booking/components/footer/utils.js +29 -4
- package/lib/components/booking/forms/forms.d.ts +0 -1
- package/lib/components/booking/forms/forms.js +2 -5
- package/lib/components/booking/forms/model.d.ts +1 -2
- package/lib/components/booking/forms/single/index.d.ts +1 -1
- package/lib/components/booking/forms/single/index.js +2 -4
- package/lib/components/booking/index.js +2 -2
- package/lib/components/booking/info/client/index.js +8 -1
- package/lib/components/booking/info/index.d.ts +4 -12
- package/lib/components/booking/info/index.js +14 -118
- package/lib/components/booking/info/index.less +0 -9
- package/lib/components/booking/info/main.d.ts +12 -0
- package/lib/components/booking/info/main.js +152 -0
- package/lib/components/booking/info/pet/index.js +1 -2
- package/lib/components/booking/info/service/addService/index.d.ts +2 -8
- package/lib/components/booking/info/service/addService/index.js +29 -66
- package/lib/components/booking/info/service/addService/index.less +1 -27
- package/lib/components/booking/info/service/addTimeModal/index.js +1 -0
- package/lib/components/booking/info/service/editService/index.js +6 -9
- package/lib/components/booking/info/utils.d.ts +1 -0
- package/lib/components/booking/info/utils.js +9 -0
- package/lib/components/booking/info2/index.d.ts +12 -0
- package/lib/components/booking/info2/index.js +202 -0
- package/lib/components/booking/info2/serve.d.ts +6 -0
- package/lib/components/booking/{dashboard → info2}/serve.js +25 -5
- package/lib/components/booking/info2/service/actions/index.d.ts +6 -0
- package/lib/components/booking/info2/service/actions/index.js +102 -0
- package/lib/components/booking/info2/service/addService/index.d.ts +6 -0
- package/lib/components/booking/info2/service/addService/index.js +355 -0
- package/lib/components/booking/info2/service/addService/mock.d.ts +214 -0
- package/lib/components/booking/info2/service/addService/mock.js +398 -0
- package/lib/components/booking/info2/service/addService/utils.d.ts +71 -0
- package/lib/components/booking/info2/service/addService/utils.js +377 -0
- package/lib/components/booking/info2/service/addTimeModal/index.d.ts +4 -0
- package/lib/components/booking/info2/service/addTimeModal/index.js +558 -0
- package/lib/components/booking/info2/service/addTimeModal/serve.d.ts +9 -0
- package/lib/components/booking/info2/service/addTimeModal/serve.js +45 -0
- package/lib/components/booking/info2/service/addTimeModal/utils.d.ts +31 -0
- package/lib/components/booking/info2/service/addTimeModal/utils.js +157 -0
- package/lib/components/booking/info2/service/editService/Capacity/index.d.ts +4 -0
- package/lib/components/booking/info2/service/editService/Capacity/index.js +97 -0
- package/lib/components/booking/info2/service/editService/Capacity/index.less +1 -0
- package/lib/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.d.ts +7 -0
- package/lib/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.js +54 -0
- package/lib/components/booking/info2/service/editService/Resources/index.d.ts +4 -0
- package/lib/components/booking/info2/service/editService/Resources/index.js +212 -0
- package/lib/components/booking/info2/service/editService/Resources/index.less +21 -0
- package/lib/components/booking/info2/service/editService/index.d.ts +7 -0
- package/lib/components/booking/info2/service/editService/index.js +483 -0
- package/lib/components/booking/info2/service/editService/index.less +99 -0
- package/lib/components/booking/info2/service/editService/utils.d.ts +11 -0
- package/lib/components/booking/info2/service/editService/utils.js +0 -0
- package/lib/components/booking/info2/service/index.d.ts +4 -0
- package/lib/components/booking/info2/service/index.js +75 -0
- package/lib/components/booking/info2/service/serviceItem/index.d.ts +4 -0
- package/lib/components/booking/info2/service/serviceItem/index.js +184 -0
- package/lib/components/booking/info2/service/serviceItem/index.less +125 -0
- package/lib/components/booking/info2/service/serviceList/index.d.ts +6 -0
- package/lib/components/booking/info2/service/serviceList/index.js +130 -0
- package/lib/components/booking/info2/service/serviceList/index.less +0 -0
- package/lib/components/booking/info2/utilsByBooking.d.ts +34 -0
- package/lib/components/booking/info2/utilsByBooking.js +257 -0
- package/lib/components/booking/locales.d.ts +3 -48
- package/lib/components/booking/locales.js +3 -48
- package/lib/components/booking/materiels/resources/index.d.ts +2 -2
- package/lib/components/booking/mock.d.ts +1 -0
- package/lib/components/booking/mock.js +67 -2
- package/lib/components/booking/model.d.ts +0 -2
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -2
- package/lib/components/booking/payments/model.d.ts +1 -2
- package/lib/components/booking/utils.d.ts +1 -1
- package/lib/components/booking/utils.js +22 -57
- package/lib/components/eftposPay/tyro/index.js +3 -1
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -2
- package/lib/index.d.ts +1 -3
- package/lib/index.js +1 -7
- package/package.json +3 -3
- package/es/components/booking/dashboard/index.d.ts +0 -10
- package/es/components/booking/dashboard/serve.d.ts +0 -1
- package/es/components/booking/info/addServiceVariant/index.d.ts +0 -7
- package/lib/components/booking/dashboard/index.d.ts +0 -10
- package/lib/components/booking/dashboard/index.js +0 -225
- package/lib/components/booking/dashboard/serve.d.ts +0 -1
- package/lib/components/booking/info/addServiceVariant/index.d.ts +0 -7
- package/lib/components/booking/info/addServiceVariant/index.js +0 -58
- package/lowcode/booking-dashboard/meta.ts +0 -130
- package/lowcode/booking-vertical-add-service/meta.ts +0 -124
- package/lowcode/vertical-add-service/meta.ts +0 -71
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/booking/info2/service/addTimeModal/utils.ts
|
|
30
|
+
var utils_exports = {};
|
|
31
|
+
__export(utils_exports, {
|
|
32
|
+
addTimeRowKey: () => addTimeRowKey,
|
|
33
|
+
getAddTimeSplits: () => getAddTimeSplits,
|
|
34
|
+
isUsableProduct: () => isUsableProduct
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(utils_exports);
|
|
37
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
38
|
+
var import_utils = require("../../../utils");
|
|
39
|
+
var import_utils2 = require("@pisell/utils");
|
|
40
|
+
var import_lodash = require("lodash");
|
|
41
|
+
var import_utils3 = require("../addService/utils");
|
|
42
|
+
var getAddTimeSplits = (product, cacheItem) => {
|
|
43
|
+
var _a;
|
|
44
|
+
const { add_time = {
|
|
45
|
+
calculate_type: "select_quantity",
|
|
46
|
+
// 最大时长
|
|
47
|
+
max_add_time: 30,
|
|
48
|
+
// 最小时长
|
|
49
|
+
min_add_time: 30,
|
|
50
|
+
// 关联产品
|
|
51
|
+
relation_product: { type: "product_all", products: [] },
|
|
52
|
+
// 单位切片
|
|
53
|
+
unit_duration: 30
|
|
54
|
+
}, price = 0 } = product;
|
|
55
|
+
if (add_time.additional_time_options === "unlimited") {
|
|
56
|
+
let maxEndDate = (0, import_utils.getEndDate)(cacheItem._extend.startDate, "flexible", (_a = (0, import_utils3.getUsableTime)(cacheItem)) == null ? void 0 : _a.end_at);
|
|
57
|
+
let _value = maxEndDate.diff(cacheItem._extend.endDate, "minute");
|
|
58
|
+
if (_value > 0) {
|
|
59
|
+
return [
|
|
60
|
+
{
|
|
61
|
+
label: import_utils2.locales.getText("page.booking.text.unlimited"),
|
|
62
|
+
value: _value,
|
|
63
|
+
price
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
} else {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const startTime = (0, import_dayjs.default)().startOf("day");
|
|
71
|
+
const endTime = startTime.add(add_time.max_add_time, "minute");
|
|
72
|
+
const timeSlice = (add_time == null ? void 0 : add_time.unit_duration) || 5;
|
|
73
|
+
let arr = [];
|
|
74
|
+
let currentTime = startTime;
|
|
75
|
+
let lastDuration = 0;
|
|
76
|
+
while (currentTime.isBefore(endTime)) {
|
|
77
|
+
let nextTime = currentTime;
|
|
78
|
+
if (lastDuration === 0) {
|
|
79
|
+
nextTime = nextTime.add(add_time.min_add_time, "minute");
|
|
80
|
+
} else {
|
|
81
|
+
nextTime = currentTime.add(timeSlice, "minute");
|
|
82
|
+
}
|
|
83
|
+
const durationValue = nextTime.diff(startTime, "minute");
|
|
84
|
+
let durationLabel = `${durationValue} ${import_utils2.locales.getText("pisell2.text.min")}`;
|
|
85
|
+
if (durationValue >= 60) {
|
|
86
|
+
durationLabel = (0, import_utils.getDiscountTime)(durationValue);
|
|
87
|
+
}
|
|
88
|
+
arr.push({
|
|
89
|
+
label: durationLabel,
|
|
90
|
+
value: durationValue,
|
|
91
|
+
price: durationValue / timeSlice * price
|
|
92
|
+
});
|
|
93
|
+
lastDuration = durationValue;
|
|
94
|
+
currentTime = nextTime;
|
|
95
|
+
}
|
|
96
|
+
return arr;
|
|
97
|
+
};
|
|
98
|
+
var isUsableProduct = (addTime, currentItem) => {
|
|
99
|
+
var _a;
|
|
100
|
+
const type = (_a = addTime.relation_product) == null ? void 0 : _a.type;
|
|
101
|
+
const relationProduct = addTime.relation_product || [];
|
|
102
|
+
if (!currentItem) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
if (addTime.additional_time_options === "unlimited") {
|
|
106
|
+
let maxEndDate = (0, import_utils.getEndDate)(currentItem._extend.startDate, "flexible", "");
|
|
107
|
+
if (currentItem._extend.endDate.isAfter(maxEndDate)) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (type === "product_all") {
|
|
112
|
+
return true;
|
|
113
|
+
} else {
|
|
114
|
+
if (type === "product_collection") {
|
|
115
|
+
return !!(0, import_lodash.intersectionBy)(
|
|
116
|
+
relationProduct.products.map((item) => ({
|
|
117
|
+
...item,
|
|
118
|
+
id: item.product_collection_id
|
|
119
|
+
})) || [],
|
|
120
|
+
currentItem.collection || [],
|
|
121
|
+
"id"
|
|
122
|
+
).length;
|
|
123
|
+
} else {
|
|
124
|
+
return relationProduct.products.some(
|
|
125
|
+
(item) => {
|
|
126
|
+
if (type === "products") {
|
|
127
|
+
if (item.product_id == currentItem.product_id) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var addTimeRowKey = {
|
|
137
|
+
// 创建, 增加前缀
|
|
138
|
+
create: (product_id, time) => {
|
|
139
|
+
return `${product_id}_${time}`;
|
|
140
|
+
},
|
|
141
|
+
// 格式化, 去除前缀
|
|
142
|
+
getValue: (str) => {
|
|
143
|
+
let arr = str.split("_");
|
|
144
|
+
let id = arr[0] || 0;
|
|
145
|
+
let time = arr[1] || 0;
|
|
146
|
+
return {
|
|
147
|
+
product_id: Number(id),
|
|
148
|
+
time: time === "flexible" ? time : Number(arr[1] || 0)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
153
|
+
0 && (module.exports = {
|
|
154
|
+
addTimeRowKey,
|
|
155
|
+
getAddTimeSplits,
|
|
156
|
+
isUsableProduct
|
|
157
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/booking/info2/service/editService/Capacity/index.tsx
|
|
30
|
+
var Capacity_exports = {};
|
|
31
|
+
__export(Capacity_exports, {
|
|
32
|
+
default: () => Capacity_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Capacity_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_index = require("./index.less");
|
|
38
|
+
var getName = (name, locale) => {
|
|
39
|
+
return name[locale] || name["original"] || name["en"] || "";
|
|
40
|
+
};
|
|
41
|
+
var getSelectOptions = (min, max) => {
|
|
42
|
+
let arr = [];
|
|
43
|
+
for (let i = min; i <= max; i++) {
|
|
44
|
+
arr.push({ label: `${i}`, value: i });
|
|
45
|
+
}
|
|
46
|
+
return arr;
|
|
47
|
+
};
|
|
48
|
+
var Capacity = ({ state, cacheItem, value, onChange }, ref) => {
|
|
49
|
+
var _a;
|
|
50
|
+
const data = (_a = cacheItem == null ? void 0 : cacheItem._data) == null ? void 0 : _a.capacitys;
|
|
51
|
+
const _value = (0, import_react.useMemo)(() => {
|
|
52
|
+
return value || [];
|
|
53
|
+
}, [value]);
|
|
54
|
+
const _onChange = (val, index) => {
|
|
55
|
+
let _val = [..._value];
|
|
56
|
+
_val = _val.map((item) => {
|
|
57
|
+
if (item.id === index) {
|
|
58
|
+
return { ...item, value: val };
|
|
59
|
+
}
|
|
60
|
+
return item;
|
|
61
|
+
});
|
|
62
|
+
console.log(_val);
|
|
63
|
+
onChange == null ? void 0 : onChange(_val);
|
|
64
|
+
};
|
|
65
|
+
if ((data == null ? void 0 : data.type) !== "custom") {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, data.custom.map((item) => {
|
|
69
|
+
var _a2;
|
|
70
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24, key: item.id }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: getName(item.name, state.locale), required: true }, /* @__PURE__ */ import_react.default.createElement(
|
|
71
|
+
import_antd.Select,
|
|
72
|
+
{
|
|
73
|
+
size: "large",
|
|
74
|
+
className: "capacity-select",
|
|
75
|
+
onChange: (e) => {
|
|
76
|
+
_onChange(e, item.id);
|
|
77
|
+
},
|
|
78
|
+
showSearch: !state.isTerminal,
|
|
79
|
+
value: (_a2 = _value.find((d) => d.id === item.id)) == null ? void 0 : _a2.value,
|
|
80
|
+
options: getSelectOptions(item.min, item.max),
|
|
81
|
+
onSearch: (e) => {
|
|
82
|
+
if (!e) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const num = Number(e);
|
|
86
|
+
if (isNaN(num)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (num >= item.min && num <= item.max) {
|
|
90
|
+
_onChange(num, item.id);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
)));
|
|
95
|
+
}));
|
|
96
|
+
};
|
|
97
|
+
var Capacity_default = (0, import_react.forwardRef)(Capacity);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.capacity-select {}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectProps } from 'antd';
|
|
3
|
+
interface MaxLengthSelectProps<T> extends SelectProps<T> {
|
|
4
|
+
maxLength: number;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: import("react").ForwardRefExoticComponent<Partial<MaxLengthSelectProps<any>> & import("react").RefAttributes<unknown>>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.tsx
|
|
20
|
+
var MaxLengthSelect_exports = {};
|
|
21
|
+
__export(MaxLengthSelect_exports, {
|
|
22
|
+
default: () => MaxLengthSelect_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(MaxLengthSelect_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_antd = require("antd");
|
|
27
|
+
var MaxLengthSelect = (props, ref) => {
|
|
28
|
+
(0, import_react.useImperativeHandle)(ref, () => {
|
|
29
|
+
return {
|
|
30
|
+
onChange: handleChange
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
const handleChange = (e, _option) => {
|
|
34
|
+
if (props.onChange) {
|
|
35
|
+
if ((props.mode === "multiple" || props.mode === "tags") && props.maxLength) {
|
|
36
|
+
if (props.value && props.value.length >= props.maxLength && e.length > props.value.length) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
props.onChange(e, _option);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ React.createElement(
|
|
44
|
+
import_antd.Select,
|
|
45
|
+
{
|
|
46
|
+
...props,
|
|
47
|
+
onChange: handleChange,
|
|
48
|
+
popupMatchSelectWidth: false,
|
|
49
|
+
getPopupContainer: () => document.querySelector("#main") || document.body
|
|
50
|
+
},
|
|
51
|
+
props.children
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
var MaxLengthSelect_default = (0, import_react.forwardRef)(MaxLengthSelect);
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/booking/info2/service/editService/Resources/index.tsx
|
|
30
|
+
var Resources_exports = {};
|
|
31
|
+
__export(Resources_exports, {
|
|
32
|
+
default: () => Resources_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Resources_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_MaxLengthSelect = __toESM(require("./MaxLengthSelect"));
|
|
38
|
+
var import_like = __toESM(require("../../../../info/service/like"));
|
|
39
|
+
var import_index = require("./index.less");
|
|
40
|
+
var import_utils = require("@pisell/utils");
|
|
41
|
+
var import_utilsByBooking = require("../../../utilsByBooking");
|
|
42
|
+
var import_lodash = require("lodash");
|
|
43
|
+
var Resources = ({ state, cacheItem, getCurrentCacheItem, onChange, value }, ref) => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
const [showError, setShowError] = (0, import_react.useState)(false);
|
|
46
|
+
const data = (0, import_react.useMemo)(() => {
|
|
47
|
+
var _a2;
|
|
48
|
+
return ((_a2 = cacheItem == null ? void 0 : cacheItem._data) == null ? void 0 : _a2.resources) || [];
|
|
49
|
+
}, [(_a = cacheItem == null ? void 0 : cacheItem._data) == null ? void 0 : _a.resources]);
|
|
50
|
+
const resourceMaps = (0, import_react.useMemo)(() => {
|
|
51
|
+
var _a2;
|
|
52
|
+
return ((_a2 = cacheItem == null ? void 0 : cacheItem._data) == null ? void 0 : _a2.resourceMaps) || [];
|
|
53
|
+
}, [(_b = cacheItem == null ? void 0 : cacheItem._data) == null ? void 0 : _b.resourceMaps]);
|
|
54
|
+
const defaultValue = (0, import_react.useMemo)(() => {
|
|
55
|
+
return data.reduce((pre, cur) => {
|
|
56
|
+
pre[cur.form_id] = [];
|
|
57
|
+
return pre;
|
|
58
|
+
}, {});
|
|
59
|
+
}, [data]);
|
|
60
|
+
const _value = (0, import_react.useMemo)(() => {
|
|
61
|
+
return value || defaultValue;
|
|
62
|
+
}, [value, defaultValue]);
|
|
63
|
+
const _onChange = (val, form_id, key) => {
|
|
64
|
+
let _val = { ..._value };
|
|
65
|
+
let maps = _val[form_id] ? _val[form_id].reduce((pre, cur) => {
|
|
66
|
+
pre[cur.relation_id] = cur;
|
|
67
|
+
return pre;
|
|
68
|
+
}, {}) : {};
|
|
69
|
+
_val[form_id] = val.map((d) => {
|
|
70
|
+
var _a2, _b2, _c, _d2;
|
|
71
|
+
let _d = maps[d];
|
|
72
|
+
if (_d) {
|
|
73
|
+
if (key === "like_status") {
|
|
74
|
+
d[key].like_status = val;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const currentForm = (resourceMaps == null ? void 0 : resourceMaps[form_id]) || {};
|
|
78
|
+
return (
|
|
79
|
+
// maps[d] 为真时, 说明是之前已选择, 否则为新增的值,补充数据
|
|
80
|
+
maps[d] || {
|
|
81
|
+
relation_type: ((_b2 = (_a2 = currentForm.renderListMaps[d]) == null ? void 0 : _a2.usable) == null ? void 0 : _b2.relation_type) || "form",
|
|
82
|
+
form_id,
|
|
83
|
+
relation_id: d,
|
|
84
|
+
like_status: "common",
|
|
85
|
+
// 新添加的数据补充错误信息
|
|
86
|
+
errors: (0, import_utilsByBooking.getErrorList)(
|
|
87
|
+
(_c = currentForm.renderListMaps) == null ? void 0 : _c[d],
|
|
88
|
+
getCurrentCacheItem()
|
|
89
|
+
),
|
|
90
|
+
metadata: {
|
|
91
|
+
form_name: currentForm.title,
|
|
92
|
+
resource_name: (_d2 = currentForm.renderListMaps[d]) == null ? void 0 : _d2.main_field
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
setShowError(false);
|
|
98
|
+
onChange == null ? void 0 : onChange(_val);
|
|
99
|
+
};
|
|
100
|
+
const setLikeStatus = (val, form_id, key) => {
|
|
101
|
+
var _a2;
|
|
102
|
+
let _val = { ..._value };
|
|
103
|
+
if ((_a2 = _val == null ? void 0 : _val[form_id]) == null ? void 0 : _a2[0]) {
|
|
104
|
+
_val[form_id][0][key] = val;
|
|
105
|
+
onChange == null ? void 0 : onChange(_val);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const renderOptions = (0, import_react.useCallback)(
|
|
109
|
+
(array, value2 = "value", label = "label", type) => {
|
|
110
|
+
return array.map((d) => {
|
|
111
|
+
let props = {};
|
|
112
|
+
if (type === "resource") {
|
|
113
|
+
props.labelText = d.labelText;
|
|
114
|
+
}
|
|
115
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
116
|
+
import_antd.Select.Option,
|
|
117
|
+
{
|
|
118
|
+
value: d[value2],
|
|
119
|
+
key: d[value2],
|
|
120
|
+
...props,
|
|
121
|
+
relation_type: d.relation_type
|
|
122
|
+
},
|
|
123
|
+
d[label]
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
[]
|
|
128
|
+
);
|
|
129
|
+
const check = () => {
|
|
130
|
+
var _a2;
|
|
131
|
+
for (let item of data) {
|
|
132
|
+
let _length = (_a2 = _value[item.form_id]) == null ? void 0 : _a2.length;
|
|
133
|
+
if (item.select_type.min > _length) {
|
|
134
|
+
setShowError(true);
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
};
|
|
140
|
+
(0, import_react.useImperativeHandle)(ref, () => {
|
|
141
|
+
return {
|
|
142
|
+
check
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, data.map((item) => {
|
|
146
|
+
var _a2;
|
|
147
|
+
const cur = _value[item.form_id];
|
|
148
|
+
const errors = (cur || []).reduce((pre, d) => {
|
|
149
|
+
return pre.concat((d == null ? void 0 : d.errors) || []);
|
|
150
|
+
}, []);
|
|
151
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24, key: item.form_id }, /* @__PURE__ */ import_react.default.createElement(
|
|
152
|
+
import_antd.Form.Item,
|
|
153
|
+
{
|
|
154
|
+
label: item.title,
|
|
155
|
+
required: true,
|
|
156
|
+
extra: showError && item.select_type.min > (cur == null ? void 0 : cur.length) ? /* @__PURE__ */ import_react.default.createElement("span", { style: { color: "#ff4d4f" } }, import_utils.locales.getText(
|
|
157
|
+
"page.booking.text.resource.min-length-error"
|
|
158
|
+
)(item.select_type.min, item.title)) : void 0
|
|
159
|
+
},
|
|
160
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "resource-col" }, item.select_type.type === "multiple" ? null : /* @__PURE__ */ import_react.default.createElement(
|
|
161
|
+
import_antd.Button,
|
|
162
|
+
{
|
|
163
|
+
className: "resource-col-like-wrap",
|
|
164
|
+
onClick: () => {
|
|
165
|
+
var _a3;
|
|
166
|
+
setLikeStatus(
|
|
167
|
+
((_a3 = cur == null ? void 0 : cur[0]) == null ? void 0 : _a3.like_status) === "like" ? "common" : "like",
|
|
168
|
+
item.form_id,
|
|
169
|
+
"like_status"
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
/* @__PURE__ */ import_react.default.createElement(import_like.default, { status: (_a2 = cur == null ? void 0 : cur[0]) == null ? void 0 : _a2.like_status })
|
|
174
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
175
|
+
import_MaxLengthSelect.default,
|
|
176
|
+
{
|
|
177
|
+
className: "resource-col-select",
|
|
178
|
+
size: "large",
|
|
179
|
+
maxLength: item.select_type.max,
|
|
180
|
+
mode: item.select_type.type === "multiple" ? "multiple" : void 0,
|
|
181
|
+
onChange: (e) => {
|
|
182
|
+
let val = e;
|
|
183
|
+
if (!(0, import_lodash.isArray)(e)) {
|
|
184
|
+
if (e || e === 0) {
|
|
185
|
+
val = [e];
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
_onChange(val, item.form_id, "value");
|
|
189
|
+
},
|
|
190
|
+
value: cur == null ? void 0 : cur.map((d) => d.relation_id),
|
|
191
|
+
showSearch: true,
|
|
192
|
+
filterOption: (str, option) => {
|
|
193
|
+
return ((option == null ? void 0 : option.labelText) || "").toLowerCase().includes((str || "").toLowerCase());
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
renderOptions(item.renderList, "id", "label", "resource")
|
|
197
|
+
))
|
|
198
|
+
), state.renderType !== "eventBooking" && (errors || []).map((d) => {
|
|
199
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
200
|
+
import_antd.Alert,
|
|
201
|
+
{
|
|
202
|
+
key: d.type,
|
|
203
|
+
message: d.label,
|
|
204
|
+
type: "warning",
|
|
205
|
+
showIcon: true,
|
|
206
|
+
style: { marginBottom: 12 }
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}));
|
|
210
|
+
}));
|
|
211
|
+
};
|
|
212
|
+
var Resources_default = (0, import_react.forwardRef)(Resources);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.resource-col {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
gap: 10px;
|
|
6
|
+
|
|
7
|
+
.resource-col-like-wrap {
|
|
8
|
+
width: 44px;
|
|
9
|
+
height: 40px;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
padding: 0;
|
|
14
|
+
|
|
15
|
+
.like-resource {}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.resource-col-select {
|
|
19
|
+
flex: 1;
|
|
20
|
+
}
|
|
21
|
+
}
|