@pisell/materials 1.0.486 → 1.0.488

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.
Files changed (87) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +26 -26
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +17 -17
  11. package/dist/umd/materials.min.css +1 -0
  12. package/dist/umd/materials.min.js +1 -0
  13. package/dist/umd/static/DotsSix.57d66266.svg +1 -0
  14. package/dist/umd/static/arrow-left.e542294f.svg +1 -0
  15. package/dist/umd/static/arrow-right.763f03e0.svg +1 -0
  16. package/dist/umd/static/filter-lines.04a54ae9.svg +1 -0
  17. package/dist/umd/static/help-circle.31c9be40.svg +1 -0
  18. package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +1 -0
  19. package/es/components/collapse/index.js +27 -4
  20. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +2 -2
  21. package/es/components/dataSourceComponents/fields/ColorPicker/index.d.ts +1 -1
  22. package/es/components/dataSourceComponents/fields/index.d.ts +1 -1
  23. package/es/components/pisellQrcode/index.js +3 -2
  24. package/es/components/pisellWalletPassCard/index.less +3 -1
  25. package/es/components/productCard/components/Action/index.js +1 -1
  26. package/es/components/productCard/components/AmountFooter/index.d.ts +1 -1
  27. package/es/components/productCard/components/AmountFooter/index.js +30 -10
  28. package/es/components/productCard/components/AmountFooter/index.less +11 -0
  29. package/es/components/productCard/components/Header/index.js +22 -14
  30. package/es/components/productCard/components/MultiDay/index.d.ts +4 -0
  31. package/es/components/productCard/components/MultiDay/index.js +81 -0
  32. package/es/components/productCard/components/MultiDay/index.less +34 -0
  33. package/es/components/productCard/components/Packages/components/collapsibleList/utils.js +11 -5
  34. package/es/components/productCard/components/Packages/components/options/index.js +2 -2
  35. package/es/components/productCard/components/Packages/index.js +1 -2
  36. package/es/components/productCard/components/Sales/index.js +2 -2
  37. package/es/components/productCard/components/Time/index.js +15 -13
  38. package/es/components/productCard/index.d.ts +1 -1
  39. package/es/components/productCard/index.js +34 -20
  40. package/es/components/productCard/index.less +3 -2
  41. package/es/components/productCard/status.d.ts +24 -1
  42. package/es/components/productCard/status.js +52 -2
  43. package/es/components/productCard/types.d.ts +60 -1
  44. package/es/components/productCard/utils.d.ts +10 -144
  45. package/es/components/productCard/utils.js +36 -673
  46. package/es/components/table/Table/utils.d.ts +1 -1
  47. package/es/locales/en-US.d.ts +2 -0
  48. package/es/locales/en-US.js +4 -1
  49. package/es/locales/zh-CN.d.ts +2 -0
  50. package/es/locales/zh-CN.js +4 -1
  51. package/es/locales/zh-TW.d.ts +2 -0
  52. package/es/locales/zh-TW.js +4 -1
  53. package/lib/components/collapse/index.js +30 -4
  54. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +2 -2
  55. package/lib/components/dataSourceComponents/fields/ColorPicker/index.d.ts +1 -1
  56. package/lib/components/dataSourceComponents/fields/index.d.ts +1 -1
  57. package/lib/components/pisellQrcode/index.js +3 -2
  58. package/lib/components/pisellWalletPassCard/index.less +3 -1
  59. package/lib/components/productCard/components/Action/index.js +1 -1
  60. package/lib/components/productCard/components/AmountFooter/index.d.ts +1 -1
  61. package/lib/components/productCard/components/AmountFooter/index.js +33 -9
  62. package/lib/components/productCard/components/AmountFooter/index.less +11 -0
  63. package/lib/components/productCard/components/Header/index.js +16 -8
  64. package/lib/components/productCard/components/MultiDay/index.d.ts +4 -0
  65. package/lib/components/productCard/components/MultiDay/index.js +77 -0
  66. package/lib/components/productCard/components/MultiDay/index.less +34 -0
  67. package/lib/components/productCard/components/Packages/components/collapsibleList/utils.js +2 -1
  68. package/lib/components/productCard/components/Packages/components/options/index.js +2 -2
  69. package/lib/components/productCard/components/Packages/index.js +1 -1
  70. package/lib/components/productCard/components/Sales/index.js +1 -2
  71. package/lib/components/productCard/components/Time/index.js +14 -11
  72. package/lib/components/productCard/index.d.ts +1 -1
  73. package/lib/components/productCard/index.js +32 -20
  74. package/lib/components/productCard/index.less +3 -2
  75. package/lib/components/productCard/status.d.ts +24 -1
  76. package/lib/components/productCard/status.js +35 -2
  77. package/lib/components/productCard/types.d.ts +60 -1
  78. package/lib/components/productCard/utils.d.ts +10 -144
  79. package/lib/components/productCard/utils.js +30 -567
  80. package/lib/components/table/Table/utils.d.ts +1 -1
  81. package/lib/locales/en-US.d.ts +2 -0
  82. package/lib/locales/en-US.js +4 -1
  83. package/lib/locales/zh-CN.d.ts +2 -0
  84. package/lib/locales/zh-CN.js +4 -1
  85. package/lib/locales/zh-TW.d.ts +2 -0
  86. package/lib/locales/zh-TW.js +4 -1
  87. package/package.json +3 -3
@@ -29,594 +29,57 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/components/productCard/utils.ts
30
30
  var utils_exports = {};
31
31
  __export(utils_exports, {
32
- deleteCacheParams: () => deleteCacheParams,
33
- findNextDuration: () => findNextDuration,
34
- findNextSlice: () => findNextSlice,
35
- flexibleObj: () => flexibleObj,
36
- formatProductListByCategory: () => formatProductListByCategory,
37
- formatResource: () => formatResource,
38
- formatTimes: () => formatTimes,
39
- getCacheParams: () => getCacheParams,
40
- getDiscountTime: () => getDiscountTime,
41
- getDuration: () => getDuration,
42
- getEndDate: () => getEndDate,
43
- getErrorList: () => getErrorList,
44
- getIsEdit: () => getIsEdit,
45
- getLastServer: () => getLastServer,
46
- getNowTime: () => getNowTime,
47
- getProductTotalPrice: () => getProductTotalPrice,
48
- getResourceTimeIsUsable: () => getResourceTimeIsUsable,
49
- getServeStartTime: () => getServeStartTime,
50
- getServerItemExtend: () => getServerItemExtend,
32
+ formatMultiDayDate: () => formatMultiDayDate,
51
33
  getServiceTime: () => getServiceTime,
52
- getServiceTimes: () => getServiceTimes,
53
- getShopOpeningHours: () => getShopOpeningHours,
54
- isNowTime: () => isNowTime,
55
- isWalkIn: () => isWalkIn,
56
- request: () => request,
57
- sliceDayIntoFiveMinutes: () => sliceDayIntoFiveMinutes
34
+ isEn: () => isEn
58
35
  });
59
36
  module.exports = __toCommonJS(utils_exports);
60
37
  var import_dayjs = __toESM(require("dayjs"));
61
38
  var import_utils = require("@pisell/utils");
62
- var import_lodash = require("lodash");
63
39
  var import_zh_cn = require("dayjs/locale/zh-cn");
64
40
  var import_en = require("dayjs/locale/en");
65
41
  var import_zh_tw = require("dayjs/locale/zh-tw");
66
- var Request = class {
67
- constructor() {
68
- this.request = {};
69
- }
70
- setRequest(val) {
71
- this.request = val;
72
- }
73
- getRequest() {
74
- return this.request;
75
- }
76
- };
77
- var request = new Request();
78
- var getDiscountTime = (service_times) => {
79
- if (!service_times) {
80
- return "";
81
- }
82
- if (service_times < 60) {
83
- return `${service_times} ${import_utils.locales.getText("pisell2.text.min")}`;
84
- } else {
85
- let str = "";
86
- const hours = Math.floor(service_times / 60);
87
- const minutes = service_times % 60;
88
- str += `${hours}${import_utils.locales.getText("pisell2.text.h")}`;
89
- if (minutes > 0) {
90
- str += ` ${minutes}${import_utils.locales.getText("pisell2.text.min")}`;
91
- }
92
- return str;
93
- }
94
- };
95
- var sliceDayIntoFiveMinutes = (config, locale) => {
96
- let _locale = locale;
97
- let dayjsLocale = _locale === "en-US" || _locale === "en" ? "en" : "zh-cn";
98
- import_dayjs.default.locale(dayjsLocale);
99
- const startTime = (0, import_dayjs.default)().startOf("day");
100
- const endTime = (0, import_dayjs.default)().endOf("day");
101
- const timeSlice = (config == null ? void 0 : config.value) || 5;
102
- let timeSlices = [];
103
- let durationSlicesBasedOnTime = [];
104
- let currentTime = startTime;
105
- while (currentTime.isBefore(endTime)) {
106
- const timeLabel = currentTime.format("hh:mm A");
107
- const timeValue = currentTime.format("HH:mm");
108
- timeSlices.push({ label: timeLabel, value: timeValue });
109
- const nextTime = currentTime.add(timeSlice, "minute");
110
- const durationValue = nextTime.diff(startTime, "minute");
111
- if (durationValue > 60) {
112
- const durationLabel = getDiscountTime(durationValue);
113
- durationSlicesBasedOnTime.push({
114
- label: durationLabel,
115
- value: durationValue
116
- });
117
- } else {
118
- const durationLabel = `${durationValue} ${import_utils.locales.getText(
119
- "pisell2.text.min"
120
- )}`;
121
- durationSlicesBasedOnTime.push({
122
- label: durationLabel,
123
- value: durationValue
124
- });
125
- }
126
- currentTime = nextTime;
127
- }
128
- return { timeSlices, durationSlicesBasedOnTime };
129
- };
130
- var getNowTime = () => {
131
- return (0, import_dayjs.default)().format("HH:mm");
132
- };
133
- var isNowTime = (time) => {
134
- return time === "now";
42
+ var isEn = (item) => {
43
+ const locale = (item == null ? void 0 : item.locale) || "en-US";
44
+ const _isEn = locale === "en-US" || locale === "en";
45
+ const localeTypes = {
46
+ "en-US": "en",
47
+ "zh-CN": "zh-cn",
48
+ "zh-HK": "zh-tw"
49
+ };
50
+ import_dayjs.default.locale(localeTypes[locale]);
51
+ return _isEn;
135
52
  };
136
- var getServeStartTime = (start_time) => {
137
- if (isNowTime(start_time)) {
138
- return getNowTime();
139
- }
140
- return start_time;
53
+ var formatMultiDayDate = (item) => {
54
+ const _isEn = isEn(item);
55
+ const startDate = (0, import_dayjs.default)(item == null ? void 0 : item.start_date);
56
+ const endDate = (0, import_dayjs.default)(item == null ? void 0 : item.end_date);
57
+ const _format = _isEn ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
58
+ const date = `${startDate.format(_format)} ~ ${endDate.format(_format)}`;
59
+ return date;
141
60
  };
142
61
  var getServiceTime = (item, currentDate) => {
143
- var _a, _b, _c, _d, _e, _f, _g;
144
- if (!currentDate || !((_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.start_time) || !(0, import_dayjs.default)(currentDate).isValid())
62
+ if (!(0, import_dayjs.default)(currentDate).isValid())
145
63
  return "";
146
64
  const locale = (item == null ? void 0 : item.locale) || "en-US";
147
- const isEn = locale === "en-US" || locale === "en";
65
+ const isEn2 = locale === "en-US" || locale === "en";
148
66
  const localeTypes = {
149
67
  "en-US": "en",
150
68
  "zh-CN": "zh-cn",
151
69
  "zh-HK": "zh-tw"
152
70
  };
153
71
  import_dayjs.default.locale(localeTypes[locale]);
154
- console.log(locale, "wh_locale");
155
- const startDate = (0, import_dayjs.default)(
156
- (currentDate == null ? void 0 : currentDate.format("YYYY-MM-DD")) + " " + getServeStartTime((_b = item == null ? void 0 : item._extend) == null ? void 0 : _b.start_time)
157
- );
158
- const startTime = startDate.format("HH:mm");
159
- if (((_c = item == null ? void 0 : item._extend) == null ? void 0 : _c.sub_type) === "days") {
160
- const startDate2 = (0, import_dayjs.default)((_d = item == null ? void 0 : item._extend) == null ? void 0 : _d.start_date);
161
- const endDate = (0, import_dayjs.default)((_e = item == null ? void 0 : item._extend) == null ? void 0 : _e.end_date);
162
- const diffInDays = endDate.diff(startDate2, "day");
163
- const _format = isEn ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
164
- const date = `${startDate2.format(_format)} ~ ${endDate.format(_format)}`;
165
- const duration2 = `${diffInDays} ${import_utils.locales.getText("pisell2.product.card.day")(diffInDays)}`;
166
- return `${date} (${duration2})`;
167
- }
168
- const endTime = startDate.add(flexibleObj.getValue((_f = item == null ? void 0 : item._extend) == null ? void 0 : _f.duration), "minute").format("HH:mm");
169
- const duration = getDiscountTime(flexibleObj.getValue((_g = item == null ? void 0 : item._extend) == null ? void 0 : _g.duration));
170
- return `${startTime} - ${endTime} ( ${duration} )`;
171
- };
172
- var findNextSlice = ({
173
- timeSlices = [],
174
- index = 0,
175
- date = ""
176
- }) => {
177
- const currentTimeValue = date || (0, import_dayjs.default)().format("HH:mm");
178
- for (let i = 0; i < timeSlices.length; i++) {
179
- if (timeSlices[i].value !== "now") {
180
- if (timeSlices[i].value >= currentTimeValue) {
181
- return timeSlices[i].value;
182
- }
183
- }
184
- }
185
- return timeSlices[index].value;
186
- };
187
- var findNextDuration = (current, array, defaultValue) => {
188
- for (let i = 0; i < array.length; i++) {
189
- if (array[i].value == (current == null ? void 0 : current.value)) {
190
- return array[i].value;
191
- }
192
- }
193
- return defaultValue || array[0].value;
194
- };
195
- var formatProductListByCategory = (list, filterItem) => {
196
- let _list = list || [];
197
- if (filterItem) {
198
- _list = _list.filter(filterItem);
199
- }
200
- let categoryObject = {};
201
- for (let i = 0; i < _list.length; i++) {
202
- const productItem = _list[i];
203
- if ((productItem.category || []).length) {
204
- for (let j = 0; j < productItem.category.length; j++) {
205
- let categoryItem = productItem.category[j];
206
- if (!categoryObject[categoryItem.id]) {
207
- categoryObject[categoryItem.id] = {
208
- ...categoryItem,
209
- products: []
210
- };
211
- }
212
- categoryObject[categoryItem.id] = {
213
- ...categoryItem,
214
- products: [...categoryObject[categoryItem.id].products, productItem]
215
- };
216
- }
217
- } else {
218
- if (!categoryObject["other"]) {
219
- categoryObject["other"] = {
220
- id: 0,
221
- title: import_utils.locales.getText("pisell2.text.other"),
222
- name: import_utils.locales.getText("pisell2.text.other"),
223
- cover: "",
224
- products: []
225
- };
226
- }
227
- categoryObject["other"] = {
228
- ...categoryObject["other"],
229
- products: [...categoryObject["other"].products, productItem]
230
- };
231
- }
232
- }
233
- return Object.values(categoryObject).sort((a, b) => b.sort - a.sort);
234
- };
235
- var getResourceTimeIsUsable = (item, cacheItem) => {
236
- const startDate = (0, import_dayjs.default)(
237
- cacheItem._extend.start_date.format("YYYY-MM-DD") + " " + getServeStartTime(cacheItem._extend.start_time)
238
- );
239
- const isFlexible = flexibleObj.isFlexible(cacheItem._extend.duration);
240
- let isMaxLimitRange = false;
241
- let isDateRange = false;
242
- let time = { ...item };
243
- if (time.max_participants_limit == 0) {
244
- isMaxLimitRange = true;
245
- } else {
246
- isMaxLimitRange = "unknown";
247
- }
248
- const timeStartDate = (0, import_dayjs.default)(time.start_date + " " + time.start_time).subtract(
249
- 1,
250
- "second"
251
- );
252
- const timeEndDate = (0, import_dayjs.default)(time.end_date + " " + time.end_time).add(
253
- 1,
254
- "second"
255
- );
256
- let bol;
257
- if (isFlexible) {
258
- bol = startDate.isAfter(timeStartDate) && startDate.isBefore(timeEndDate);
259
- } else {
260
- let endDate = startDate.add(
261
- flexibleObj.getValue(cacheItem._extend.duration),
262
- "minute"
263
- );
264
- bol = startDate.isAfter(timeStartDate) && endDate.isBefore(timeEndDate);
265
- }
266
- if (bol) {
267
- isDateRange = true;
268
- }
269
- const isUsable = isDateRange;
270
- time._extend = {
271
- isMaxLimitRange,
272
- isDateRange,
273
- isUsable
274
- };
275
- return time;
276
- };
277
- var formatTimes = (resourceItem, cacheItem) => {
278
- let usableTimes = [];
279
- let _resourceItem = { ...resourceItem };
280
- _resourceItem.times = _resourceItem.times.map((time) => {
281
- let _time2 = getResourceTimeIsUsable(time, cacheItem);
282
- if (_time2 == null ? void 0 : _time2._extend.isUsable) {
283
- usableTimes.push(_time2);
284
- }
285
- return _time2;
286
- });
287
- let _time = (usableTimes || []).sort((a, b) => {
288
- const aEndDate = (0, import_dayjs.default)(a.end_date + " " + a.end_time).valueOf();
289
- const bEndDate = (0, import_dayjs.default)(b.end_date + " " + b.end_time).valueOf();
290
- return aEndDate - bEndDate;
291
- })[0];
292
- resourceItem._extend = {
293
- ...resourceItem._extend,
294
- usableTime: _time
295
- };
296
- return resourceItem;
297
- };
298
- var formatResourceProducts = (resourceItem, currentItem) => {
299
- var _a;
300
- let usableProduct = false;
301
- let _resourceItem = { ...resourceItem };
302
- const type = _resourceItem.partyroom_package.type;
303
- if (type === "product_all") {
304
- usableProduct = true;
305
- } else {
306
- if (type === "product_collection") {
307
- usableProduct = !!(0, import_lodash.intersectionBy)(
308
- ((_a = _resourceItem.partyroom_package) == null ? void 0 : _a.products.map((item) => ({
309
- ...item,
310
- id: item.product_collection_id
311
- }))) || [],
312
- currentItem.collection || [],
313
- "id"
314
- ).length;
315
- } else {
316
- usableProduct = _resourceItem.partyroom_package.products.some(
317
- (item) => {
318
- if (type === "products") {
319
- if (item.product_id == currentItem.product_id) {
320
- return true;
321
- }
322
- }
323
- }
324
- );
325
- }
326
- }
327
- resourceItem._extend = {
328
- ...resourceItem._extend,
329
- // 是否可用
330
- usableProduct
331
- };
332
- return resourceItem;
333
- };
334
- var getShopOpeningHours = () => {
335
- return localStorage.getItem("shopOpeningHours") || "23:59";
336
- };
337
- var flexibleObj = {
338
- // 创建, 增加前缀
339
- create: (num) => {
340
- return `flexible_${num}`;
341
- },
342
- // 格式化, 去除前缀
343
- getValue: (str) => {
344
- if (typeof str === "string" && flexibleObj.isFlexible(str)) {
345
- return Number(str.replace("flexible_", ""));
346
- }
347
- return str;
348
- },
349
- // 判断当前时长是否为灵活时长
350
- isFlexible: (str) => {
351
- if (typeof str !== "string") {
352
- return false;
353
- }
354
- return str.indexOf("flexible_") > -1;
355
- },
356
- add: (current, duration) => {
357
- if (flexibleObj.isFlexible(current)) {
358
- return flexibleObj.create(
359
- flexibleObj.getValue(current) + duration
360
- );
361
- } else {
362
- return Number(current) + duration;
363
- }
364
- }
365
- };
366
- var getEndDate = (startDate, duration, endDate) => {
367
- if (duration === "flexible") {
368
- let openingDate = (0, import_dayjs.default)(
369
- startDate.format("YYYY-MM-DD") + " " + getShopOpeningHours()
370
- );
371
- if ((0, import_dayjs.default)(startDate).isAfter(openingDate)) {
372
- openingDate = openingDate.add(1, "day");
373
- }
374
- if (!endDate) {
375
- return openingDate;
376
- }
377
- endDate = (0, import_dayjs.default)(endDate);
378
- if (endDate.isAfter(openingDate)) {
379
- return openingDate;
380
- }
381
- return endDate;
382
- }
383
- return startDate.add(duration, "minute");
384
- };
385
- var getServiceTimes = (service) => {
386
- const startDate = (0, import_dayjs.default)(
387
- (0, import_dayjs.default)(service._extend.start_date).format("YYYY-MM-DD ") + getServeStartTime(service._extend.start_time)
388
- );
389
- const endDate = startDate.add(
390
- flexibleObj.getValue(service._extend.duration),
391
- "minute"
392
- );
393
- return {
394
- startDate,
395
- endDate
396
- };
397
- };
398
- var getErrorList = (resource, cacheItem) => {
399
- var _a, _b, _c;
400
- if (!(cacheItem == null ? void 0 : cacheItem.id)) {
401
- return [
402
- {
403
- label: import_utils.locales.getText("pisell2.text.no-product-added"),
404
- type: "products"
405
- }
406
- ];
407
- }
408
- if (!resource || !resource._extend || !cacheItem) {
409
- return [];
410
- }
411
- let list = [];
412
- if (!resource.usable) {
413
- if (!((_a = resource == null ? void 0 : resource._extend) == null ? void 0 : _a.usableProduct)) {
414
- list.push({
415
- label: import_utils.locales.getText("pisell1.text.resource-error-message-1")(
416
- resource.labelText,
417
- cacheItem == null ? void 0 : cacheItem.title
418
- ),
419
- type: "product"
420
- });
421
- }
422
- const { startDate, endDate } = getServiceTimes(cacheItem);
423
- const startText = startDate.format("hh:mm A");
424
- let endText = endDate.format("hh:mm A");
425
- if ((0, import_dayjs.default)(endDate).isAfter(startDate, "day")) {
426
- endText = import_utils.locales.getText("pisell1.text.tomorrow") + endText;
427
- }
428
- if (!((_b = resource._extend) == null ? void 0 : _b.usableTime)) {
429
- list.push({
430
- label: import_utils.locales.getText("pisell1.text.resource-error-message-2")(
431
- resource.labelText,
432
- startText,
433
- endText
434
- ),
435
- type: "time"
436
- });
437
- } else {
438
- if (!((_c = resource._extend) == null ? void 0 : _c.usableTime._extend.isMaxLimitRange)) {
439
- list.push({
440
- label: import_utils.locales.getText("pisell1.text.resource-error-message-3")(
441
- resource.labelText,
442
- startText,
443
- endText
444
- ),
445
- type: "limit"
446
- });
447
- }
448
- }
449
- }
450
- return list;
451
- };
452
- var formatResource = (resourceItem, cacheItem, formatLabel) => {
453
- let _resourceItem = { ...resourceItem };
454
- _resourceItem = formatTimes(_resourceItem, cacheItem);
455
- _resourceItem = formatResourceProducts(_resourceItem, cacheItem);
456
- _resourceItem.labelText = _resourceItem.room_name || _resourceItem.name;
457
- const usable = _resourceItem._extend.usableTime && _resourceItem._extend.usableProduct;
458
- _resourceItem.usable = usable;
459
- if (formatLabel) {
460
- _resourceItem.label = formatLabel(_resourceItem);
461
- }
462
- return _resourceItem;
463
- };
464
- var getLastServer = (list) => {
465
- return list[list.length - 1];
466
- };
467
- var getCacheParams = () => {
468
- const sessionData = sessionStorage.getItem("pisell2.booking.serviceParams");
469
- const data = sessionData ? JSON.parse(sessionData) : null;
470
- return data == null ? void 0 : data.serviceParams;
471
- };
472
- var deleteCacheParams = () => {
473
- sessionStorage.removeItem("pisell2.booking.serviceParams");
474
- };
475
- var getServerItemExtend = (state, cacheItem, timeObj) => {
476
- var _a;
477
- if (!cacheItem.new && cacheItem._extend.endDate) {
478
- return cacheItem._extend;
479
- }
480
- let lastServer = getLastServer(state.service.value);
481
- let _extend = {
482
- duration: findNextDuration(
483
- cacheItem.duration,
484
- timeObj.durationSlicesBasedOnTime,
485
- (_a = cacheItem == null ? void 0 : cacheItem.duration) == null ? void 0 : _a.value
486
- )
487
- };
488
- if (lastServer) {
489
- _extend.resource = lastServer._extend.resource;
490
- let lastServerStartDate = lastServer._extend.startDate;
491
- let lastServerEndDate = lastServer._extend.endDate;
492
- if ((0, import_dayjs.default)(lastServerEndDate).isAfter(lastServerStartDate, "day")) {
493
- _extend.start_time = timeObj.timeSlices[timeObj.timeSlices.length - 1].value;
494
- } else {
495
- _extend.start_time = lastServerEndDate.format("HH:mm");
496
- }
497
- } else {
498
- let findNextSliceProps = {
499
- timeSlices: timeObj.timeSlices,
500
- index: 0,
501
- date: ""
502
- };
503
- const serviceParams = getCacheParams();
504
- if (serviceParams) {
505
- let str = serviceParams.start_date;
506
- if (str) {
507
- findNextSliceProps.date = (0, import_dayjs.default)(str).format("HH:mm");
508
- }
509
- let resourceId = Number(serviceParams.resource_id);
510
- if (resourceId || resourceId === 0) {
511
- _extend.resource = resourceId;
512
- }
513
- }
514
- if (findNextSliceProps.date && findNextSliceProps.date !== "00:00") {
515
- _extend.start_time = findNextSlice(findNextSliceProps);
516
- } else {
517
- if (cacheItem.currentDefaultTime) {
518
- _extend.start_time = cacheItem.currentDefaultTime;
519
- } else {
520
- _extend.start_time = (0, import_dayjs.default)().format("HH:mm");
521
- }
522
- }
523
- }
524
- _extend = {
525
- ..._extend,
526
- ...cacheItem._extend
527
- };
528
- return _extend;
529
- };
530
- var getProductTotalPrice = (item) => {
531
- var _a;
532
- let price = 0;
533
- price += Number(item._extend.price);
534
- let other = (_a = item._extend) == null ? void 0 : _a.other;
535
- if (other == null ? void 0 : other.bundle) {
536
- price = other == null ? void 0 : other.bundle.reduce((accumulator, currentValue) => {
537
- return accumulator + Number(currentValue.price) * Number(currentValue.num);
538
- }, price);
539
- }
540
- price = price;
541
- return price;
542
- };
543
- var getDuration = (duration) => {
544
- if (typeof duration === "number") {
545
- return duration;
546
- }
547
- if (typeof duration === "object") {
548
- if (duration.type === "minutes") {
549
- return duration.value;
550
- }
551
- if (duration.type === "flexible") {
552
- return "flexible";
553
- }
554
- }
555
- return duration;
556
- };
557
- var isWalkIn = (customer_id) => {
558
- if (customer_id === void 0) {
559
- return true;
560
- }
561
- if (typeof customer_id === "string") {
562
- return ["", "0", "1"].includes(customer_id);
563
- }
564
- return [0, 1].includes(customer_id);
565
- };
566
- var getIsEdit = (state) => {
567
- var _a, _b, _c, _d, _e, _f, _g;
568
- if ((_a = state.addons) == null ? void 0 : _a.edit) {
569
- return true;
570
- }
571
- if (!state.bookingId) {
572
- return true;
573
- }
574
- if ((_b = state.client) == null ? void 0 : _b.edit) {
575
- return true;
576
- }
577
- if ((_c = state.date) == null ? void 0 : _c.edit) {
578
- return true;
579
- }
580
- if ((_d = state.pet) == null ? void 0 : _d.edit) {
581
- return true;
582
- }
583
- if ((_e = state.service) == null ? void 0 : _e.edit) {
584
- return true;
585
- }
586
- if ((_f = state.notes) == null ? void 0 : _f.edit) {
587
- return true;
588
- }
589
- if ((_g = state.contacts) == null ? void 0 : _g.edit) {
590
- return true;
591
- }
592
- return false;
72
+ const startDate = (0, import_dayjs.default)(item == null ? void 0 : item.start_date);
73
+ const endDate = (0, import_dayjs.default)(item == null ? void 0 : item.end_date);
74
+ const diffInDays = endDate.diff(startDate, "day");
75
+ const _format = isEn2 ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
76
+ const date = `${startDate.format(_format)} ~ ${endDate.format(_format)}`;
77
+ const duration = `${diffInDays} ${import_utils.locales.getText("pisell2.product.card.day")(diffInDays)}`;
78
+ return `${date} (${duration})`;
593
79
  };
594
80
  // Annotate the CommonJS export names for ESM import in node:
595
81
  0 && (module.exports = {
596
- deleteCacheParams,
597
- findNextDuration,
598
- findNextSlice,
599
- flexibleObj,
600
- formatProductListByCategory,
601
- formatResource,
602
- formatTimes,
603
- getCacheParams,
604
- getDiscountTime,
605
- getDuration,
606
- getEndDate,
607
- getErrorList,
608
- getIsEdit,
609
- getLastServer,
610
- getNowTime,
611
- getProductTotalPrice,
612
- getResourceTimeIsUsable,
613
- getServeStartTime,
614
- getServerItemExtend,
82
+ formatMultiDayDate,
615
83
  getServiceTime,
616
- getServiceTimes,
617
- getShopOpeningHours,
618
- isNowTime,
619
- isWalkIn,
620
- request,
621
- sliceDayIntoFiveMinutes
84
+ isEn
622
85
  });
@@ -167,7 +167,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
167
167
  sort?: SortType | undefined;
168
168
  mode: "" | "localStorage" | "remote";
169
169
  currentViewMode: ModeType;
170
- }) => ("view_mode" | "column_setting" | "order_by" | "group_by" | "gallery_setting" | "filter_setting")[];
170
+ }) => ("filter_setting" | "column_setting" | "gallery_setting" | "view_mode" | "group_by" | "order_by")[];
171
171
  export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
172
172
  export declare const stringify: (obj: Record<string, any>) => string;
173
173
  export {};
@@ -155,5 +155,7 @@ declare const _default: {
155
155
  'walletCard-rechargeable': string;
156
156
  'walletCard-voucher': string;
157
157
  'walletCard-discount': string;
158
+ 'pisellQrcode-done': string;
159
+ 'pisellQrcode-qrcode': string;
158
160
  };
159
161
  export default _default;
@@ -191,5 +191,8 @@ var en_US_default = {
191
191
  "walletCard-points": "Points",
192
192
  "walletCard-rechargeable": "Recharge",
193
193
  "walletCard-voucher": "Voucher",
194
- "walletCard-discount": "Discount"
194
+ "walletCard-discount": "Discount",
195
+ //PisellQrcode组件
196
+ "pisellQrcode-done": "Done",
197
+ "pisellQrcode-qrcode": "QR code"
195
198
  };
@@ -155,5 +155,7 @@ declare const _default: {
155
155
  'walletCard-rechargeable': string;
156
156
  'walletCard-voucher': string;
157
157
  'walletCard-discount': string;
158
+ 'pisellQrcode-done': string;
159
+ 'pisellQrcode-qrcode': string;
158
160
  };
159
161
  export default _default;
@@ -190,5 +190,8 @@ var zh_CN_default = {
190
190
  "walletCard-points": "积分卡",
191
191
  "walletCard-rechargeable": "充值卡",
192
192
  "walletCard-voucher": "代金券",
193
- "walletCard-discount": "折扣卡"
193
+ "walletCard-discount": "折扣卡",
194
+ //PisellQrcode组件
195
+ "pisellQrcode-done": "完成",
196
+ "pisellQrcode-qrcode": "二维码"
194
197
  };
@@ -155,5 +155,7 @@ declare const _default: {
155
155
  'walletCard-rechargeable': string;
156
156
  'walletCard-voucher': string;
157
157
  'walletCard-discount': string;
158
+ 'pisellQrcode-done': string;
159
+ 'pisellQrcode-qrcode': string;
158
160
  };
159
161
  export default _default;
@@ -191,5 +191,8 @@ var zh_TW_default = {
191
191
  "walletCard-points": "積分卡",
192
192
  "walletCard-rechargeable": "充值卡",
193
193
  "walletCard-voucher": "代金券",
194
- "walletCard-discount": "折扣卡"
194
+ "walletCard-discount": "折扣卡",
195
+ //PisellQrcode组件
196
+ "pisellQrcode-done": "完成",
197
+ "pisellQrcode-qrcode": "二維碼"
195
198
  };