@pisell/private-materials 6.12.372 → 6.12.374

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 (47) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +2 -2
  6. package/build/lowcode/view.js +2 -2
  7. package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
  8. package/es/components/bigSale/components/ProductList/index.js +1 -0
  9. package/es/components/bigSale/components/TimeBar/index.js +1 -0
  10. package/es/components/bigSale/dialog.js +1 -0
  11. package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
  12. package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
  13. package/es/components/bigSale/index.js +1 -0
  14. package/es/components/bigSale/templates/Kiosk/index.js +5 -4
  15. package/es/components/bigSale/templates/Kiosk/zeroAmountCheckout.js +14 -6
  16. package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
  17. package/es/index.js +2 -0
  18. package/es/plus/multiCurrencySettlement/index.js +1 -1
  19. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  20. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  21. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  22. package/es/plus/pisellReservation/index.js +17 -0
  23. package/es/plus/saleDetail/Base.js +1 -0
  24. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
  25. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +1 -0
  26. package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
  27. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
  28. package/es/plus/saleDetail/index.js +1 -0
  29. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
  30. package/es/plus/saleDetail/tmpl/B/index.js +1 -0
  31. package/es/plus/salesSdk/index.js +54 -0
  32. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  33. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  34. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  35. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  36. package/es/pro/Login2.0/index.d.ts +2 -2
  37. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  38. package/es/pro/compensatedPisellContainer/floatingLayer/index.js +74 -59
  39. package/es/pro/compensatedPisellContainer/floatingLayer/observeTransitions.js +65 -0
  40. package/es/pro/skuDetailModal/index.js +53 -65
  41. package/lib/components/bigSale/templates/Kiosk/index.js +3 -3
  42. package/lib/components/bigSale/templates/Kiosk/zeroAmountCheckout.js +15 -7
  43. package/lib/pro/compensatedPisellContainer/floatingLayer/index.js +73 -58
  44. package/lib/pro/compensatedPisellContainer/floatingLayer/observeTransitions.js +65 -0
  45. package/lib/pro/skuDetailModal/index.js +53 -65
  46. package/package.json +2 -2
  47. package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
@@ -1,6 +1,7 @@
1
1
  const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
2
2
  const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
3
  const require_useScrollActivity = require("../../../hooks/useScrollActivity.js");
4
+ const require_observeTransitions = require("./observeTransitions.js");
4
5
  let react = require("react");
5
6
  react = require_runtime.__toESM(react);
6
7
  let antd = require("antd");
@@ -11,7 +12,6 @@ require("./index.less");
11
12
  //#region src/pro/compensatedPisellContainer/floatingLayer/index.tsx
12
13
  const prefixCls = "pisell-lowcode-floating-layer";
13
14
  const legacyDrawerPrefixCls = "pisell-lowcode-drawer";
14
- const motionDuration = 300;
15
15
  const ModalButton = antd.Button;
16
16
  const overlayBaseZIndex = 600;
17
17
  const overlayZIndexStep = 10;
@@ -75,35 +75,28 @@ const getFloatingLayoutState = (isLayoutChanging = false) => {
75
75
  viewportSize: getViewportSize()
76
76
  };
77
77
  };
78
- const isSameFloatingLayout = (prevLayout, nextLayout) => {
79
- return Math.abs(prevLayout.bodyScale.x - nextLayout.bodyScale.x) < .001 && Math.abs(prevLayout.bodyScale.y - nextLayout.bodyScale.y) < .001 && prevLayout.viewportSize.width === nextLayout.viewportSize.width && prevLayout.viewportSize.height === nextLayout.viewportSize.height && prevLayout.isLayoutChanging === nextLayout.isLayoutChanging;
78
+ const isSameFloatingGeometry = (prevLayout, nextLayout) => {
79
+ return Math.abs(prevLayout.bodyScale.x - nextLayout.bodyScale.x) < .001 && Math.abs(prevLayout.bodyScale.y - nextLayout.bodyScale.y) < .001 && prevLayout.viewportSize.width === nextLayout.viewportSize.width && prevLayout.viewportSize.height === nextLayout.viewportSize.height;
80
80
  };
81
81
  const useBodyScaleViewport = () => {
82
82
  const [layoutState, setLayoutState] = (0, react.useState)(() => getFloatingLayoutState(false));
83
83
  const updateFrameRef = (0, react.useRef)();
84
- const settleTimerRef = (0, react.useRef)();
84
+ const settleFrameRef = (0, react.useRef)();
85
85
  (0, react.useEffect)(() => {
86
86
  var _window$visualViewpor;
87
87
  if (typeof window === "undefined" || typeof document === "undefined") return;
88
- const setNextLayout = (isLayoutChanging) => {
89
- const nextLayout = getFloatingLayoutState(isLayoutChanging);
90
- setLayoutState((prevLayout) => isSameFloatingLayout(prevLayout, nextLayout) ? prevLayout : nextLayout);
91
- };
92
- const markLayoutSettled = () => {
93
- if (settleTimerRef.current) window.clearTimeout(settleTimerRef.current);
94
- settleTimerRef.current = window.setTimeout(() => {
95
- setNextLayout(false);
96
- }, motionDuration);
88
+ const updateGeometry = () => {
89
+ const nextLayout = getFloatingLayoutState(true);
90
+ setLayoutState((prevLayout) => isSameFloatingGeometry(prevLayout, nextLayout) ? prevLayout : nextLayout);
97
91
  };
98
92
  const scheduleScaleViewportUpdate = () => {
99
93
  if (updateFrameRef.current) window.cancelAnimationFrame(updateFrameRef.current);
100
94
  updateFrameRef.current = window.requestAnimationFrame(() => {
101
95
  updateFrameRef.current = void 0;
102
- setNextLayout(true);
103
- markLayoutSettled();
96
+ updateGeometry();
104
97
  });
105
98
  };
106
- setNextLayout(false);
99
+ updateGeometry();
107
100
  window.addEventListener("resize", scheduleScaleViewportUpdate);
108
101
  (_window$visualViewpor = window.visualViewport) === null || _window$visualViewpor === void 0 || _window$visualViewpor.addEventListener("resize", scheduleScaleViewportUpdate);
109
102
  const bodyObserver = new MutationObserver(scheduleScaleViewportUpdate);
@@ -114,12 +107,21 @@ const useBodyScaleViewport = () => {
114
107
  return () => {
115
108
  var _window$visualViewpor2;
116
109
  if (updateFrameRef.current) window.cancelAnimationFrame(updateFrameRef.current);
117
- if (settleTimerRef.current) window.clearTimeout(settleTimerRef.current);
118
110
  window.removeEventListener("resize", scheduleScaleViewportUpdate);
119
111
  (_window$visualViewpor2 = window.visualViewport) === null || _window$visualViewpor2 === void 0 || _window$visualViewpor2.removeEventListener("resize", scheduleScaleViewportUpdate);
120
112
  bodyObserver.disconnect();
121
113
  };
122
114
  }, []);
115
+ (0, react.useLayoutEffect)(() => {
116
+ if (!layoutState.isLayoutChanging) return;
117
+ document.body.getBoundingClientRect();
118
+ settleFrameRef.current = requestAnimationFrame(() => {
119
+ setLayoutState((current) => require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, current), {}, { isLayoutChanging: false }));
120
+ });
121
+ return () => {
122
+ if (settleFrameRef.current !== void 0) cancelAnimationFrame(settleFrameRef.current);
123
+ };
124
+ }, [layoutState]);
123
125
  return layoutState;
124
126
  };
125
127
  const getDefaultDrawerSize = (size) => {
@@ -236,7 +238,13 @@ const TransformFloatingLayer = (props) => {
236
238
  shouldAutoHideHeaderFooter
237
239
  ]);
238
240
  const [rendered, setRendered] = (0, react.useState)(mergedOpen);
239
- const [motionOpen, setMotionOpen] = (0, react.useState)(mergedOpen);
241
+ const [motion, setMotion] = (0, react.useState)({
242
+ open: false,
243
+ id: 0
244
+ });
245
+ const motionOpen = motion.open;
246
+ const wrapperRef = (0, react.useRef)(null);
247
+ const maskRef = (0, react.useRef)(null);
240
248
  const shouldRenderLayer = rendered || mergedOpen;
241
249
  const skipCurrentEnterMotion = skipEnterMotion && mergedOpen;
242
250
  const effectiveMotionOpen = skipCurrentEnterMotion ? true : motionOpen;
@@ -244,10 +252,16 @@ const TransformFloatingLayer = (props) => {
244
252
  const overlayIdRef = (0, react.useRef)();
245
253
  const autoZIndexRef = (0, react.useRef)();
246
254
  const autoZIndexActiveRef = (0, react.useRef)(false);
247
- const mountedRef = (0, react.useRef)(false);
248
- const renderedRef = (0, react.useRef)(mergedOpen);
249
- const motionFrameRef = (0, react.useRef)();
250
- const motionTimerRef = (0, react.useRef)();
255
+ const hasOpenedRef = (0, react.useRef)(false);
256
+ const motionRunRef = (0, react.useRef)(0);
257
+ const motionOptionsRef = (0, react.useRef)({
258
+ afterOpenChange,
259
+ shouldDestroyOnClose
260
+ });
261
+ motionOptionsRef.current = {
262
+ afterOpenChange,
263
+ shouldDestroyOnClose
264
+ };
251
265
  if (overlayIdRef.current === void 0) overlayIdRef.current = getNextOverlayId();
252
266
  const overlayId = overlayIdRef.current;
253
267
  const releaseAutoZIndex = () => {
@@ -263,50 +277,49 @@ const TransformFloatingLayer = (props) => {
263
277
  autoZIndexActiveRef.current = true;
264
278
  }
265
279
  const mergedZIndex = (_ref = zIndex !== null && zIndex !== void 0 ? zIndex : autoZIndexRef.current) !== null && _ref !== void 0 ? _ref : overlayBaseZIndex;
266
- const updateRendered = (nextRendered) => {
267
- renderedRef.current = nextRendered;
268
- setRendered(nextRendered);
269
- };
270
280
  const handleClose = (event) => {
271
281
  const closeHandler = mode === "modal" ? onCancel || onClose : onClose || onCancel;
272
282
  closeHandler === null || closeHandler === void 0 || closeHandler(event);
273
283
  };
274
- (0, react.useEffect)(() => {
284
+ (0, react.useEffect)(() => () => releaseAutoZIndex(), []);
285
+ (0, react.useLayoutEffect)(() => {
286
+ const id = ++motionRunRef.current;
287
+ let frame;
288
+ if (mergedOpen) {
289
+ hasOpenedRef.current = true;
290
+ setRendered(true);
291
+ }
292
+ if (mergedOpen && !skipEnterMotion && !motionOpen) {
293
+ var _wrapperRef$current, _maskRef$current;
294
+ (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 || _wrapperRef$current.getBoundingClientRect();
295
+ (_maskRef$current = maskRef.current) === null || _maskRef$current === void 0 || _maskRef$current.getBoundingClientRect();
296
+ frame = requestAnimationFrame(() => {
297
+ frame = requestAnimationFrame(() => setMotion({
298
+ open: true,
299
+ id
300
+ }));
301
+ });
302
+ } else setMotion({
303
+ open: mergedOpen,
304
+ id
305
+ });
275
306
  return () => {
276
- if (motionFrameRef.current) window.cancelAnimationFrame(motionFrameRef.current);
277
- if (motionTimerRef.current) window.clearTimeout(motionTimerRef.current);
278
- releaseAutoZIndex();
307
+ ++motionRunRef.current;
308
+ if (frame !== void 0) cancelAnimationFrame(frame);
279
309
  };
280
- }, []);
281
- (0, react.useEffect)(() => {
282
- if (typeof window === "undefined") return;
283
- if (motionFrameRef.current) window.cancelAnimationFrame(motionFrameRef.current);
284
- if (motionTimerRef.current) window.clearTimeout(motionTimerRef.current);
285
- if (mergedOpen) if (renderedRef.current) setMotionOpen(true);
286
- else {
287
- updateRendered(true);
288
- setMotionOpen(false);
289
- motionFrameRef.current = window.requestAnimationFrame(() => {
290
- setMotionOpen(true);
291
- });
292
- }
293
- else setMotionOpen(false);
294
- if (!mountedRef.current) {
295
- mountedRef.current = true;
296
- return;
297
- }
298
- motionTimerRef.current = window.setTimeout(() => {
299
- afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(mergedOpen);
300
- if (!mergedOpen) {
310
+ }, [mergedOpen, skipEnterMotion]);
311
+ (0, react.useLayoutEffect)(() => {
312
+ if (!hasOpenedRef.current || motion.id !== motionRunRef.current || motion.open !== mergedOpen) return;
313
+ return require_observeTransitions.observeTransitions([wrapperRef.current, maskRef.current].filter((element) => element !== null), () => {
314
+ var _motionOptionsRef$cur, _motionOptionsRef$cur2;
315
+ if (motion.id !== motionRunRef.current) return;
316
+ if (!motion.open) {
301
317
  releaseAutoZIndex();
302
- if (shouldDestroyOnClose) updateRendered(false);
318
+ if (motionOptionsRef.current.shouldDestroyOnClose) setRendered(false);
303
319
  }
304
- }, motionDuration);
305
- }, [
306
- afterOpenChange,
307
- mergedOpen,
308
- shouldDestroyOnClose
309
- ]);
320
+ (_motionOptionsRef$cur = (_motionOptionsRef$cur2 = motionOptionsRef.current).afterOpenChange) === null || _motionOptionsRef$cur === void 0 || _motionOptionsRef$cur.call(_motionOptionsRef$cur2, motion.open);
321
+ });
322
+ }, [motion, mergedOpen]);
310
323
  (0, react.useEffect)(() => {
311
324
  if (!mergedOpen || keyboard === false || typeof window === "undefined") return;
312
325
  const handleKeyDown = (event) => {
@@ -413,12 +426,14 @@ const TransformFloatingLayer = (props) => {
413
426
  className: (0, classnames.default)(`${prefixCls}-root`, `${prefixCls}-mode-${mode}`, `${prefixCls}-${centered && mode === "modal" ? "center" : placement}`, getLegacyDrawerRootClasses(mode, placement), rootClassName, wrapClassName, layerClassNames === null || layerClassNames === void 0 ? void 0 : layerClassNames.root),
414
427
  style: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({ zIndex: mergedZIndex }, rootScaleStyle), rootStyle), styles === null || styles === void 0 ? void 0 : styles.root)
415
428
  }, mask ? /* @__PURE__ */ react.default.createElement("div", {
429
+ ref: maskRef,
416
430
  className: (0, classnames.default)(`${prefixCls}-mask`, getLegacyDrawerClass(mode, "mask"), layerClassNames === null || layerClassNames === void 0 ? void 0 : layerClassNames.mask),
417
431
  style: maskStyle,
418
432
  onClick: (event) => {
419
433
  if (event.target === event.currentTarget && maskClosable) handleClose(event);
420
434
  }
421
435
  }) : null, /* @__PURE__ */ react.default.createElement("div", {
436
+ ref: wrapperRef,
422
437
  className: (0, classnames.default)(`${prefixCls}-content-wrapper`, getLegacyDrawerWrapperClasses(mode), className, layerClassNames === null || layerClassNames === void 0 ? void 0 : layerClassNames.wrapper),
423
438
  style: wrapperStyle
424
439
  }, modalRender ? modalRender(contentNode) : contentNode)) : null;
@@ -0,0 +1,65 @@
1
+ //#region src/pro/compensatedPisellContainer/floatingLayer/observeTransitions.ts
2
+ /** Observe only the shell's own transitions, never animations inside its content. */
3
+ const observeTransitions = (elements, onSettled) => {
4
+ let disposed = false;
5
+ let frame;
6
+ const pendingEvents = /* @__PURE__ */ new Map();
7
+ const supportsAnimations = elements.every((element) => typeof element.getAnimations === "function");
8
+ const isMotionProperty = (property) => property === "opacity" || property === "transform";
9
+ const check = () => {
10
+ if (disposed) return;
11
+ if (supportsAnimations) {
12
+ const transitions = [];
13
+ elements.forEach((element) => {
14
+ transitions.push(...element.getAnimations().filter((animation) => isMotionProperty(animation.transitionProperty) && animation.playState !== "finished" && animation.playState !== "idle"));
15
+ });
16
+ if (transitions.length) {
17
+ Promise.all(transitions.map((animation) => animation.finished.catch(() => void 0))).then(check);
18
+ return;
19
+ }
20
+ } else if ([...pendingEvents.values()].some((properties) => properties.size)) return;
21
+ disposed = true;
22
+ removeListeners();
23
+ onSettled();
24
+ };
25
+ const scheduleCheck = () => {
26
+ if (frame !== void 0) cancelAnimationFrame(frame);
27
+ frame = requestAnimationFrame(check);
28
+ };
29
+ const handleTransition = (event) => {
30
+ const transition = event;
31
+ if (event.target !== event.currentTarget || !isMotionProperty(transition.propertyName)) return;
32
+ const element = event.currentTarget;
33
+ const properties = pendingEvents.get(element);
34
+ if (event.type === "transitionrun") properties.add(transition.propertyName);
35
+ else {
36
+ properties.delete(transition.propertyName);
37
+ scheduleCheck();
38
+ }
39
+ };
40
+ const removeListeners = () => {
41
+ elements.forEach((element) => {
42
+ element.removeEventListener("transitionrun", handleTransition);
43
+ element.removeEventListener("transitionend", handleTransition);
44
+ element.removeEventListener("transitioncancel", handleTransition);
45
+ });
46
+ };
47
+ elements.forEach((element) => {
48
+ pendingEvents.set(element, /* @__PURE__ */ new Set());
49
+ if (!supportsAnimations) {
50
+ element.addEventListener("transitionrun", handleTransition);
51
+ element.addEventListener("transitionend", handleTransition);
52
+ element.addEventListener("transitioncancel", handleTransition);
53
+ }
54
+ element.getBoundingClientRect();
55
+ });
56
+ if (supportsAnimations) Promise.resolve().then(check);
57
+ else frame = requestAnimationFrame(scheduleCheck);
58
+ return () => {
59
+ disposed = true;
60
+ if (frame !== void 0) cancelAnimationFrame(frame);
61
+ removeListeners();
62
+ };
63
+ };
64
+ //#endregion
65
+ exports.observeTransitions = observeTransitions;