@pisell/materials 3.0.61 → 3.0.63

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 (177) 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 +2 -2
  6. package/build/lowcode/preview.js +142 -142
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +28 -60
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +22 -54
  11. package/es/components/Pagination/index.d.ts +1 -1
  12. package/es/components/TimeResourceSelector/index.d.ts +21 -0
  13. package/es/components/TimeResourceSelector/index.js +115 -0
  14. package/es/components/TimeResourceSelector/index.less +59 -0
  15. package/es/components/cardPro/index.js +1 -4
  16. package/es/components/collapse/index.js +27 -4
  17. package/es/components/iconfont/index.js +1 -1
  18. package/es/components/pisellAnchor/index.d.ts +15 -0
  19. package/es/components/pisellAnchor/index.js +126 -0
  20. package/es/components/pisellAnchor/index.less +177 -0
  21. package/es/components/pisellAvatar/index.d.ts +19 -0
  22. package/es/components/pisellAvatar/index.js +90 -0
  23. package/es/components/pisellAvatar/index.less +26 -0
  24. package/es/components/pisellCard/index.d.ts +8 -0
  25. package/es/components/pisellCard/index.js +34 -5
  26. package/es/components/pisellCard/index.less +31 -4
  27. package/es/components/pisellCustomCheckboxGroup/index.d.ts +16 -0
  28. package/es/components/pisellCustomCheckboxGroup/index.js +72 -0
  29. package/es/components/pisellCustomCheckboxGroup/index.less +0 -0
  30. package/es/components/pisellDropdown/index.d.ts +20 -0
  31. package/es/components/pisellDropdown/index.js +51 -0
  32. package/es/components/pisellDropdown/index.less +44 -0
  33. package/es/components/pisellEmpty/index.d.ts +2 -1
  34. package/es/components/pisellHeaderProgressBar/index.d.ts +29 -0
  35. package/es/components/pisellHeaderProgressBar/index.js +76 -0
  36. package/es/components/pisellHeaderProgressBar/index.less +18 -0
  37. package/es/components/pisellImageCarousels/index.d.ts +18 -0
  38. package/es/components/pisellImageCarousels/index.js +108 -0
  39. package/es/components/pisellImageCarousels/index.less +92 -0
  40. package/es/components/pisellList01/index.d.ts +17 -0
  41. package/es/components/pisellList01/index.js +105 -0
  42. package/es/components/pisellList01/index.less +53 -0
  43. package/es/components/pisellModal/components/PcModal/index.js +1 -1
  44. package/es/components/pisellSectionHeaders/index.d.ts +21 -0
  45. package/es/components/pisellSectionHeaders/index.js +35 -0
  46. package/es/components/pisellSectionHeaders/index.less +46 -0
  47. package/es/components/pisellText/components/Amount/index.js +1 -1
  48. package/es/components/pisellViewGrid/index.d.ts +16 -0
  49. package/es/components/pisellViewGrid/index.js +66 -0
  50. package/es/components/pisellViewGrid/index.less +31 -0
  51. package/es/components/productCard/components/Action/index.js +1 -1
  52. package/es/components/productCard/components/AmountFooter/index.d.ts +1 -1
  53. package/es/components/productCard/components/AmountFooter/index.js +30 -10
  54. package/es/components/productCard/components/AmountFooter/index.less +11 -0
  55. package/es/components/productCard/components/Header/index.js +24 -15
  56. package/es/components/productCard/components/MultiDay/index.d.ts +4 -0
  57. package/es/components/productCard/components/MultiDay/index.js +79 -0
  58. package/es/components/productCard/components/MultiDay/index.less +34 -0
  59. package/es/components/productCard/components/MultiDay/utils.d.ts +14 -0
  60. package/es/components/productCard/components/MultiDay/utils.js +54 -0
  61. package/es/components/productCard/components/Packages/components/collapsibleList/utils.js +11 -5
  62. package/es/components/productCard/components/Packages/components/options/index.js +2 -2
  63. package/es/components/productCard/components/Packages/index.js +1 -2
  64. package/es/components/productCard/components/Sales/index.js +2 -2
  65. package/es/components/productCard/components/Time/index.js +15 -13
  66. package/es/components/productCard/hooks/useOpenNote.js +3 -2
  67. package/es/components/productCard/index.d.ts +1 -1
  68. package/es/components/productCard/index.js +39 -21
  69. package/es/components/productCard/index.less +6 -1
  70. package/es/components/productCard/status.d.ts +24 -1
  71. package/es/components/productCard/status.js +54 -2
  72. package/es/components/productCard/types.d.ts +62 -1
  73. package/es/components/productCard/utils.d.ts +10 -144
  74. package/es/components/productCard/utils.js +49 -670
  75. package/es/components/section-footers/index.d.ts +9 -0
  76. package/es/components/section-footers/index.js +17 -0
  77. package/es/components/section-footers/index.less +5 -0
  78. package/es/components/table/Table/utils.d.ts +1 -1
  79. package/es/index.d.ts +10 -0
  80. package/es/index.js +10 -0
  81. package/lib/components/Pagination/index.d.ts +1 -1
  82. package/lib/components/TimeResourceSelector/index.d.ts +21 -0
  83. package/lib/components/TimeResourceSelector/index.js +109 -0
  84. package/lib/components/TimeResourceSelector/index.less +59 -0
  85. package/lib/components/cardPro/index.js +0 -3
  86. package/lib/components/collapse/index.js +30 -4
  87. package/lib/components/iconfont/index.js +1 -1
  88. package/lib/components/pisellAnchor/index.d.ts +15 -0
  89. package/lib/components/pisellAnchor/index.js +120 -0
  90. package/lib/components/pisellAnchor/index.less +177 -0
  91. package/lib/components/pisellAvatar/index.d.ts +19 -0
  92. package/lib/components/pisellAvatar/index.js +108 -0
  93. package/lib/components/pisellAvatar/index.less +26 -0
  94. package/lib/components/pisellCard/index.d.ts +8 -0
  95. package/lib/components/pisellCard/index.js +30 -7
  96. package/lib/components/pisellCard/index.less +31 -4
  97. package/lib/components/pisellCustomCheckboxGroup/index.d.ts +16 -0
  98. package/lib/components/pisellCustomCheckboxGroup/index.js +71 -0
  99. package/lib/components/pisellCustomCheckboxGroup/index.less +0 -0
  100. package/lib/components/pisellDropdown/index.d.ts +20 -0
  101. package/lib/components/pisellDropdown/index.js +72 -0
  102. package/lib/components/pisellDropdown/index.less +44 -0
  103. package/lib/components/pisellEmpty/index.d.ts +2 -1
  104. package/lib/components/pisellHeaderProgressBar/index.d.ts +29 -0
  105. package/lib/components/pisellHeaderProgressBar/index.js +88 -0
  106. package/lib/components/pisellHeaderProgressBar/index.less +18 -0
  107. package/lib/components/pisellImageCarousels/index.d.ts +18 -0
  108. package/lib/components/pisellImageCarousels/index.js +108 -0
  109. package/lib/components/pisellImageCarousels/index.less +92 -0
  110. package/lib/components/pisellList01/index.d.ts +17 -0
  111. package/lib/components/pisellList01/index.js +113 -0
  112. package/lib/components/pisellList01/index.less +53 -0
  113. package/lib/components/pisellModal/components/PcModal/index.js +1 -1
  114. package/lib/components/pisellSectionHeaders/index.d.ts +21 -0
  115. package/lib/components/pisellSectionHeaders/index.js +52 -0
  116. package/lib/components/pisellSectionHeaders/index.less +46 -0
  117. package/lib/components/pisellText/components/Amount/index.js +2 -2
  118. package/lib/components/pisellViewGrid/index.d.ts +16 -0
  119. package/lib/components/pisellViewGrid/index.js +98 -0
  120. package/lib/components/pisellViewGrid/index.less +31 -0
  121. package/lib/components/productCard/components/Action/index.js +1 -1
  122. package/lib/components/productCard/components/AmountFooter/index.d.ts +1 -1
  123. package/lib/components/productCard/components/AmountFooter/index.js +33 -9
  124. package/lib/components/productCard/components/AmountFooter/index.less +11 -0
  125. package/lib/components/productCard/components/Header/index.js +18 -9
  126. package/lib/components/productCard/components/MultiDay/index.d.ts +4 -0
  127. package/lib/components/productCard/components/MultiDay/index.js +72 -0
  128. package/lib/components/productCard/components/MultiDay/index.less +34 -0
  129. package/lib/components/productCard/components/MultiDay/utils.d.ts +14 -0
  130. package/lib/components/productCard/components/MultiDay/utils.js +77 -0
  131. package/lib/components/productCard/components/Packages/components/collapsibleList/utils.js +2 -1
  132. package/lib/components/productCard/components/Packages/components/options/index.js +2 -2
  133. package/lib/components/productCard/components/Packages/index.js +1 -1
  134. package/lib/components/productCard/components/Sales/index.js +1 -2
  135. package/lib/components/productCard/components/Time/index.js +14 -11
  136. package/lib/components/productCard/hooks/useOpenNote.js +2 -1
  137. package/lib/components/productCard/index.d.ts +1 -1
  138. package/lib/components/productCard/index.js +37 -20
  139. package/lib/components/productCard/index.less +6 -1
  140. package/lib/components/productCard/status.d.ts +24 -1
  141. package/lib/components/productCard/status.js +37 -2
  142. package/lib/components/productCard/types.d.ts +62 -1
  143. package/lib/components/productCard/utils.d.ts +10 -144
  144. package/lib/components/productCard/utils.js +40 -566
  145. package/lib/components/section-footers/index.d.ts +9 -0
  146. package/lib/components/section-footers/index.js +44 -0
  147. package/lib/components/section-footers/index.less +5 -0
  148. package/lib/components/table/Table/utils.d.ts +1 -1
  149. package/lib/index.d.ts +10 -0
  150. package/lib/index.js +30 -0
  151. package/lowcode/pisell-anchor/meta.ts +118 -0
  152. package/lowcode/pisell-anchor/snippets.ts +26 -0
  153. package/lowcode/pisell-avatar/__screenshots__/avatar-1.jpg +0 -0
  154. package/lowcode/pisell-avatar/meta.ts +111 -0
  155. package/lowcode/pisell-avatar/snippets.ts +14 -0
  156. package/lowcode/pisell-card/meta.ts +62 -27
  157. package/lowcode/pisell-card/snippets.ts +6 -0
  158. package/lowcode/pisell-custom-checkbox-group/__screenshots__/card-1.png +0 -0
  159. package/lowcode/pisell-custom-checkbox-group/meta.ts +204 -0
  160. package/lowcode/pisell-custom-checkbox-group/snippets.ts +56 -0
  161. package/lowcode/pisell-dropdown/__screenshots__/dropdown-1.png +0 -0
  162. package/lowcode/pisell-dropdown/meta.ts +180 -0
  163. package/lowcode/pisell-dropdown/snippets.ts +69 -0
  164. package/lowcode/pisell-header-progress-bar/meta.ts +116 -0
  165. package/lowcode/pisell-header-progress-bar/snippets.ts +24 -0
  166. package/lowcode/pisell-image-carousels/meta.ts +143 -0
  167. package/lowcode/pisell-image-carousels/snippets.ts +20 -0
  168. package/lowcode/pisell-list01/meta.ts +74 -0
  169. package/lowcode/pisell-list01/snippets.ts +35 -0
  170. package/lowcode/pisell-section-headers/meta.ts +91 -0
  171. package/lowcode/pisell-section-headers/snippets.ts +22 -0
  172. package/lowcode/pisell-view-grid/__screenshots__/card-1.png +0 -0
  173. package/lowcode/pisell-view-grid/meta.ts +167 -0
  174. package/lowcode/pisell-view-grid/snippets.ts +54 -0
  175. package/lowcode/section-footers/meta.ts +66 -0
  176. package/lowcode/section-footers/snippe.ts +21 -0
  177. package/package.json +4 -3
@@ -29,594 +29,68 @@ 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";
135
- };
136
- var getServeStartTime = (start_time) => {
137
- if (isNowTime(start_time)) {
138
- return getNowTime();
139
- }
140
- return start_time;
141
- };
142
- 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())
145
- return "";
42
+ var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
43
+ var isEn = (item) => {
146
44
  const locale = (item == null ? void 0 : item.locale) || "en-US";
147
- const isEn = locale === "en-US" || locale === "en";
45
+ const _isEn = locale === "en-US" || locale === "en";
148
46
  const localeTypes = {
149
47
  "en-US": "en",
150
48
  "zh-CN": "zh-cn",
151
49
  "zh-HK": "zh-tw"
152
50
  };
153
51
  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
- }
52
+ return _isEn;
365
53
  };
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];
54
+ var formatMultiDayDate = (item) => {
55
+ const _isEn = isEn(item);
56
+ const startDate = (0, import_dayjs.default)(item == null ? void 0 : item.start_date);
57
+ const endDate = (0, import_dayjs.default)(item == null ? void 0 : item.end_date);
58
+ const _format = _isEn ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
59
+ const date = `${startDate.format(_format)} ~ ${endDate.format(_format)}`;
60
+ return date;
466
61
  };
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
62
+ var getServiceTime = (item, currentDate) => {
63
+ var _a, _b, _c, _d;
64
+ if (!(0, import_dayjs.default)(currentDate).isValid())
65
+ return "";
66
+ const context = (0, import_useEngineContext.default)();
67
+ const utils = context.appHelper.utils || {};
68
+ const locale = (item == null ? void 0 : item.locale) || ((_a = utils == null ? void 0 : utils.storage) == null ? void 0 : _a.get("umi_locale")) || "en-US";
69
+ const isEn2 = locale === "en-US" || locale === "en";
70
+ const localeTypes = {
71
+ "en-US": "en",
72
+ "zh-CN": "zh-cn",
73
+ "zh-HK": "zh-tw"
527
74
  };
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;
75
+ import_dayjs.default.locale(localeTypes[locale]);
76
+ let startDate = (0, import_dayjs.default)(item == null ? void 0 : item.start_date);
77
+ let endDate = (0, import_dayjs.default)(item == null ? void 0 : item.end_date);
78
+ const diffInDays = endDate.diff(startDate, "day");
79
+ let _format = isEn2 ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
80
+ if ((item == null ? void 0 : item.hasOwnProperty("format")) && ((_b = item == null ? void 0 : item.format) == null ? void 0 : _b.length) > 0) {
81
+ _format = isEn2 ? (_c = item == null ? void 0 : item.format) == null ? void 0 : _c[0] : (_d = item == null ? void 0 : item.format) == null ? void 0 : _d[1];
588
82
  }
589
- if ((_g = state.contacts) == null ? void 0 : _g.edit) {
590
- return true;
83
+ if (item == null ? void 0 : item.show_time) {
84
+ startDate = (0, import_dayjs.default)(`${item == null ? void 0 : item.start_date} ${item == null ? void 0 : item.start_time}`);
85
+ endDate = (0, import_dayjs.default)(`${item == null ? void 0 : item.end_date} ${item == null ? void 0 : item.end_time}`);
591
86
  }
592
- return false;
87
+ const date = `${startDate.format(_format)} ~ ${endDate.format(_format)}`;
88
+ const duration = `${diffInDays} ${import_utils.locales.getText("pisell2.product.card.day")(diffInDays)}`;
89
+ return `${date} (${duration})`;
593
90
  };
594
91
  // Annotate the CommonJS export names for ESM import in node:
595
92
  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,
93
+ formatMultiDayDate,
615
94
  getServiceTime,
616
- getServiceTimes,
617
- getShopOpeningHours,
618
- isNowTime,
619
- isWalkIn,
620
- request,
621
- sliceDayIntoFiveMinutes
95
+ isEn
622
96
  });
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ interface SectionFooterProps {
3
+ left?: React.ReactNode;
4
+ middle?: React.ReactNode;
5
+ right?: React.ReactNode;
6
+ className?: string;
7
+ }
8
+ declare const SectionFooters: (props: SectionFooterProps) => import("react").JSX.Element;
9
+ export default SectionFooters;
@@ -0,0 +1,44 @@
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/section-footers/index.tsx
20
+ var section_footers_exports = {};
21
+ __export(section_footers_exports, {
22
+ default: () => section_footers_default
23
+ });
24
+ module.exports = __toCommonJS(section_footers_exports);
25
+ var import_react = require("react");
26
+ var import_antd = require("antd");
27
+ var SectionFooters = (props) => {
28
+ (0, import_react.useEffect)(() => {
29
+ document.body.id = "body";
30
+ }, []);
31
+ const { left, middle, right, className } = props;
32
+ return /* @__PURE__ */ React.createElement(
33
+ import_antd.Flex,
34
+ {
35
+ gap: "middle",
36
+ justify: "space-between",
37
+ className: `pisell-section-footers-wrapper ${className}`
38
+ },
39
+ left,
40
+ middle,
41
+ right
42
+ );
43
+ };
44
+ var section_footers_default = SectionFooters;
@@ -0,0 +1,5 @@
1
+ .pisell-section-footers-wrapper {
2
+ position: fixed;
3
+ bottom: 0;
4
+ width: 100%;
5
+ }