@pisell/private-materials 6.12.425 → 6.12.426

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.
@@ -1,3 +1,4 @@
1
+ import { usePlatform } from "../../../../hooks/useEngineContext.js";
1
2
  import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
3
  import useTranslationOriginal from "../../../../hooks/useTranslationOriginal.js";
3
4
  import useStore from "../../hooks/useStore.js";
@@ -25,11 +26,14 @@ const OptionsCard = (props) => {
25
26
  const translationOriginal = useTranslationOriginal();
26
27
  const skuCardConfig = useStore((s) => s.skuCardConfig);
27
28
  const customConfig = useStore((s) => s.customConfig);
29
+ const hostPlatform = usePlatform();
28
30
  const getDisplayText = (value) => typeof value === "string" ? value : (translationOriginal === null || translationOriginal === void 0 ? void 0 : translationOriginal(value)) || "";
29
31
  const displayTitle = getDisplayText(title !== null && title !== void 0 ? title : name);
30
32
  const displaySubtitle = getDisplayText(product_subtitle);
31
33
  const displayCover = getDisplayText(cover);
32
34
  const [isOpen, setIsOpen] = useState(false);
35
+ const cardRef = useRef(null);
36
+ const [parentZIndex, setParentZIndex] = useState();
33
37
  const [modalDataSource, setModalDataSource] = useState([]);
34
38
  const [modalValue, setModalValue] = useState({});
35
39
  const currentEditIndexRef = useRef(-1);
@@ -85,6 +89,20 @@ const OptionsCard = (props) => {
85
89
  slots: props.slots
86
90
  }) || []);
87
91
  };
92
+ const openModal = () => {
93
+ let nextParentZIndex;
94
+ if (hostPlatform === "h5") try {
95
+ var _cardRef$current;
96
+ const parentLayer = (_cardRef$current = cardRef.current) === null || _cardRef$current === void 0 ? void 0 : _cardRef$current.closest(".ant-drawer-open, .ant-modal-wrap, .pisell-lowcode-floating-layer-root");
97
+ const hostWindow = parentLayer === null || parentLayer === void 0 ? void 0 : parentLayer.ownerDocument.defaultView;
98
+ if (parentLayer && hostWindow) {
99
+ const zIndex = Number.parseInt(hostWindow.getComputedStyle(parentLayer).zIndex, 10);
100
+ if (Number.isFinite(zIndex)) nextParentZIndex = zIndex;
101
+ }
102
+ } catch (_unused) {}
103
+ setParentZIndex(nextParentZIndex);
104
+ setIsOpen(true);
105
+ };
88
106
  const handleClick = () => {
89
107
  if (interactionDisabled) return;
90
108
  let needShowToast = false;
@@ -98,7 +116,7 @@ const OptionsCard = (props) => {
98
116
  setModalValue({});
99
117
  currentEditIndexRef.current = -1;
100
118
  setCurrentEditIndex(-1);
101
- setIsOpen(true);
119
+ openModal();
102
120
  transformDataSource();
103
121
  };
104
122
  const handleUpdateClick = (index) => {
@@ -106,7 +124,7 @@ const OptionsCard = (props) => {
106
124
  if (interactionDisabled) return;
107
125
  currentEditIndexRef.current = index;
108
126
  setCurrentEditIndex(index);
109
- setIsOpen(true);
127
+ openModal();
110
128
  setModalValue((props === null || props === void 0 || (_props$optionItemValu5 = props.optionItemValue) === null || _props$optionItemValu5 === void 0 || (_props$optionItemValu5 = _props$optionItemValu5.data) === null || _props$optionItemValu5 === void 0 || (_props$optionItemValu5 = _props$optionItemValu5._data) === null || _props$optionItemValu5 === void 0 ? void 0 : _props$optionItemValu5[index]) || {});
111
129
  transformDataSource();
112
130
  };
@@ -145,6 +163,7 @@ const OptionsCard = (props) => {
145
163
  });
146
164
  };
147
165
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
166
+ ref: cardRef,
148
167
  className: "pisell-plus-sku-options-card",
149
168
  onClick: handleClick
150
169
  }, /* @__PURE__ */ React.createElement("div", {
@@ -179,6 +198,7 @@ const OptionsCard = (props) => {
179
198
  onEdit: handleUpdateClick,
180
199
  onQuantityChange: handleQuantityChange
181
200
  }), isOpen && /* @__PURE__ */ React.createElement(OptionsModal_default, {
201
+ parentZIndex,
182
202
  appearanceClassName: (_props$presentation2 = props.presentation) === null || _props$presentation2 === void 0 || (_props$presentation2 = _props$presentation2.modal) === null || _props$presentation2 === void 0 ? void 0 : _props$presentation2.className,
183
203
  appearanceStyle: (_props$presentation3 = props.presentation) === null || _props$presentation3 === void 0 || (_props$presentation3 = _props$presentation3.modal) === null || _props$presentation3 === void 0 ? void 0 : _props$presentation3.style,
184
204
  parentDataSource: props === null || props === void 0 ? void 0 : props.parentDataSource,
@@ -1,3 +1,4 @@
1
+ import { usePlatform } from "../../../../hooks/useEngineContext.js";
1
2
  import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
3
  import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
3
4
  import CompensatedPisellContainer from "../../../../pro/compensatedPisellContainer/index.js";
@@ -15,13 +16,15 @@ import "./index.less";
15
16
  const SelectorGroup = Selector.Group;
16
17
  const OptionsModal = (props) => {
17
18
  var _props$optionItemValu, _props$dataSource2, _props$modalValue4, _props$dataSource4;
18
- const { open, title, remainingCount, onCancel, onConfirm, variant } = props;
19
+ const { open, title, remainingCount, onCancel, onConfirm, variant, parentZIndex } = props;
19
20
  const selectorGroupRef = useRef(null);
20
21
  const [stepNumber, setStepNumber] = useState(1);
21
22
  const [modalValue, setModalValue] = useState((props === null || props === void 0 ? void 0 : props.modalValue) || {});
22
23
  const customConfig = useStore((s) => s.customConfig);
24
+ const hostPlatform = usePlatform();
23
25
  const logger = useLogger();
24
- const renderType = (customConfig === null || customConfig === void 0 ? void 0 : customConfig.modalRenderType) || (variant === "phone" ? "drawer" : "modal");
26
+ const zIndex = hostPlatform === "h5" && typeof parentZIndex === "number" && Number.isFinite(parentZIndex) ? parentZIndex + 10 : void 0;
27
+ const renderType = (customConfig === null || customConfig === void 0 ? void 0 : customConfig.modalRenderType) || (hostPlatform === "h5" || variant === "phone" ? "drawer" : "modal");
25
28
  const isDrawer = renderType === "drawer";
26
29
  const isTabletVariant = !isDrawer && (variant === "tablet" || variant === "smallTablet");
27
30
  const shouldUsePrimaryModalLayout = !isDrawer;
@@ -145,6 +148,7 @@ const OptionsModal = (props) => {
145
148
  props: {
146
149
  platform,
147
150
  open,
151
+ zIndex,
148
152
  onCancel,
149
153
  title,
150
154
  className: classNames("pisell-sku-options-modal", props.appearanceClassName, {
@@ -19,7 +19,7 @@ declare const flowModuleRegistry: {
19
19
  readonly Component: _$react.FC<FlowModuleProps<string>>;
20
20
  readonly initializeWhileInactive: true;
21
21
  readonly hardRequires: ("productData" | "booking.selectedCandidate")[];
22
- readonly refreshOn: ("productData" | "skuValue" | "quantity" | "booking.customerId" | "booking.duration" | "booking.selectedCandidate")[];
22
+ readonly refreshOn: ("quantity" | "productData" | "skuValue" | "booking.customerId" | "booking.duration" | "booking.selectedCandidate")[];
23
23
  readonly isApplicable: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
24
24
  readonly canInitialize: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
25
25
  readonly refresh: (context: SelectionFlowContextValue<string>, module: CompiledSelectionFlowModuleConfig<string>) => Promise<void>;
@@ -1,4 +1,5 @@
1
1
  const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
2
+ const require_useEngineContext = require("../../../../hooks/useEngineContext.js");
2
3
  const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
4
  const require_useTranslationOriginal = require("../../../../hooks/useTranslationOriginal.js");
4
5
  const require_useStore = require("../../hooks/useStore.js");
@@ -27,11 +28,14 @@ const OptionsCard = (props) => {
27
28
  const translationOriginal = require_useTranslationOriginal.default();
28
29
  const skuCardConfig = require_useStore.default((s) => s.skuCardConfig);
29
30
  const customConfig = require_useStore.default((s) => s.customConfig);
31
+ const hostPlatform = require_useEngineContext.usePlatform();
30
32
  const getDisplayText = (value) => typeof value === "string" ? value : (translationOriginal === null || translationOriginal === void 0 ? void 0 : translationOriginal(value)) || "";
31
33
  const displayTitle = getDisplayText(title !== null && title !== void 0 ? title : name);
32
34
  const displaySubtitle = getDisplayText(product_subtitle);
33
35
  const displayCover = getDisplayText(cover);
34
36
  const [isOpen, setIsOpen] = (0, react.useState)(false);
37
+ const cardRef = (0, react.useRef)(null);
38
+ const [parentZIndex, setParentZIndex] = (0, react.useState)();
35
39
  const [modalDataSource, setModalDataSource] = (0, react.useState)([]);
36
40
  const [modalValue, setModalValue] = (0, react.useState)({});
37
41
  const currentEditIndexRef = (0, react.useRef)(-1);
@@ -87,6 +91,20 @@ const OptionsCard = (props) => {
87
91
  slots: props.slots
88
92
  }) || []);
89
93
  };
94
+ const openModal = () => {
95
+ let nextParentZIndex;
96
+ if (hostPlatform === "h5") try {
97
+ var _cardRef$current;
98
+ const parentLayer = (_cardRef$current = cardRef.current) === null || _cardRef$current === void 0 ? void 0 : _cardRef$current.closest(".ant-drawer-open, .ant-modal-wrap, .pisell-lowcode-floating-layer-root");
99
+ const hostWindow = parentLayer === null || parentLayer === void 0 ? void 0 : parentLayer.ownerDocument.defaultView;
100
+ if (parentLayer && hostWindow) {
101
+ const zIndex = Number.parseInt(hostWindow.getComputedStyle(parentLayer).zIndex, 10);
102
+ if (Number.isFinite(zIndex)) nextParentZIndex = zIndex;
103
+ }
104
+ } catch (_unused) {}
105
+ setParentZIndex(nextParentZIndex);
106
+ setIsOpen(true);
107
+ };
90
108
  const handleClick = () => {
91
109
  if (interactionDisabled) return;
92
110
  let needShowToast = false;
@@ -100,7 +118,7 @@ const OptionsCard = (props) => {
100
118
  setModalValue({});
101
119
  currentEditIndexRef.current = -1;
102
120
  setCurrentEditIndex(-1);
103
- setIsOpen(true);
121
+ openModal();
104
122
  transformDataSource();
105
123
  };
106
124
  const handleUpdateClick = (index) => {
@@ -108,7 +126,7 @@ const OptionsCard = (props) => {
108
126
  if (interactionDisabled) return;
109
127
  currentEditIndexRef.current = index;
110
128
  setCurrentEditIndex(index);
111
- setIsOpen(true);
129
+ openModal();
112
130
  setModalValue((props === null || props === void 0 || (_props$optionItemValu5 = props.optionItemValue) === null || _props$optionItemValu5 === void 0 || (_props$optionItemValu5 = _props$optionItemValu5.data) === null || _props$optionItemValu5 === void 0 || (_props$optionItemValu5 = _props$optionItemValu5._data) === null || _props$optionItemValu5 === void 0 ? void 0 : _props$optionItemValu5[index]) || {});
113
131
  transformDataSource();
114
132
  };
@@ -147,6 +165,7 @@ const OptionsCard = (props) => {
147
165
  });
148
166
  };
149
167
  return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", {
168
+ ref: cardRef,
150
169
  className: "pisell-plus-sku-options-card",
151
170
  onClick: handleClick
152
171
  }, /* @__PURE__ */ react.default.createElement("div", {
@@ -181,6 +200,7 @@ const OptionsCard = (props) => {
181
200
  onEdit: handleUpdateClick,
182
201
  onQuantityChange: handleQuantityChange
183
202
  }), isOpen && /* @__PURE__ */ react.default.createElement(require_index$1.default, {
203
+ parentZIndex,
184
204
  appearanceClassName: (_props$presentation2 = props.presentation) === null || _props$presentation2 === void 0 || (_props$presentation2 = _props$presentation2.modal) === null || _props$presentation2 === void 0 ? void 0 : _props$presentation2.className,
185
205
  appearanceStyle: (_props$presentation3 = props.presentation) === null || _props$presentation3 === void 0 || (_props$presentation3 = _props$presentation3.modal) === null || _props$presentation3 === void 0 ? void 0 : _props$presentation3.style,
186
206
  parentDataSource: props === null || props === void 0 ? void 0 : props.parentDataSource,
@@ -1,4 +1,5 @@
1
1
  const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
2
+ const require_useEngineContext = require("../../../../hooks/useEngineContext.js");
2
3
  const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
4
  const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
4
5
  const require_index = require("../../../../pro/compensatedPisellContainer/index.js");
@@ -18,13 +19,15 @@ require("./index.less");
18
19
  const SelectorGroup = require_index$2.default.Group;
19
20
  const OptionsModal = (props) => {
20
21
  var _props$optionItemValu, _props$dataSource2, _props$modalValue4, _props$dataSource4;
21
- const { open, title, remainingCount, onCancel, onConfirm, variant } = props;
22
+ const { open, title, remainingCount, onCancel, onConfirm, variant, parentZIndex } = props;
22
23
  const selectorGroupRef = (0, react.useRef)(null);
23
24
  const [stepNumber, setStepNumber] = (0, react.useState)(1);
24
25
  const [modalValue, setModalValue] = (0, react.useState)((props === null || props === void 0 ? void 0 : props.modalValue) || {});
25
26
  const customConfig = require_useStore.default((s) => s.customConfig);
27
+ const hostPlatform = require_useEngineContext.usePlatform();
26
28
  const logger = require_useLogger.default();
27
- const renderType = (customConfig === null || customConfig === void 0 ? void 0 : customConfig.modalRenderType) || (variant === "phone" ? "drawer" : "modal");
29
+ const zIndex = hostPlatform === "h5" && typeof parentZIndex === "number" && Number.isFinite(parentZIndex) ? parentZIndex + 10 : void 0;
30
+ const renderType = (customConfig === null || customConfig === void 0 ? void 0 : customConfig.modalRenderType) || (hostPlatform === "h5" || variant === "phone" ? "drawer" : "modal");
28
31
  const isDrawer = renderType === "drawer";
29
32
  const isTabletVariant = !isDrawer && (variant === "tablet" || variant === "smallTablet");
30
33
  const shouldUsePrimaryModalLayout = !isDrawer;
@@ -148,6 +151,7 @@ const OptionsModal = (props) => {
148
151
  props: {
149
152
  platform,
150
153
  open,
154
+ zIndex,
151
155
  onCancel,
152
156
  title,
153
157
  className: (0, classnames.default)("pisell-sku-options-modal", props.appearanceClassName, {
@@ -19,7 +19,7 @@ declare const flowModuleRegistry: {
19
19
  readonly Component: _$react.FC<FlowModuleProps<string>>;
20
20
  readonly initializeWhileInactive: true;
21
21
  readonly hardRequires: ("productData" | "booking.selectedCandidate")[];
22
- readonly refreshOn: ("productData" | "skuValue" | "quantity" | "booking.customerId" | "booking.duration" | "booking.selectedCandidate")[];
22
+ readonly refreshOn: ("quantity" | "productData" | "skuValue" | "booking.customerId" | "booking.duration" | "booking.selectedCandidate")[];
23
23
  readonly isApplicable: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
24
24
  readonly canInitialize: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
25
25
  readonly refresh: (context: SelectionFlowContextValue<string>, module: CompiledSelectionFlowModuleConfig<string>) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.425",
3
+ "version": "6.12.426",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -76,9 +76,9 @@
76
76
  "use-sync-external-store": "^1.6.0",
77
77
  "@pisell/pi-payment-sdk": "0.0.4",
78
78
  "@pisell/icon": "0.0.11",
79
- "@pisell/utils": "3.0.7",
79
+ "@pisell/date-picker": "3.0.12",
80
80
  "@pisell/materials": "6.12.95",
81
- "@pisell/date-picker": "3.0.12"
81
+ "@pisell/utils": "3.0.7"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "react": "^18.0.0",