@pisell/materials 6.12.83 → 6.12.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +2 -2
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +2 -2
- package/es/components/PisellSelectionFlow/PisellSelectionFlow.js +30 -2
- package/es/components/PisellSelectionFlow/hooks/useFlowModuleLifecycle.js +24 -7
- package/es/components/PisellSelectionFlow/hooks/useFlowNavigation.js +132 -14
- package/es/components/PisellSelectionFlow/types.d.ts +11 -0
- package/es/components/pisellLookup/PisellLookup.js +1 -2
- package/es/components/pisellLookup/components/LookupResultHost.js +3 -3
- package/es/components/pisellLookup/docs/pisellLookup.md +0 -1
- package/es/components/pisellLookup/types.d.ts +0 -3
- package/es/components/productCard/cartSkuCard/types.d.ts +0 -2
- package/es/components/productCard/cartSkuCard/variants/A12/index.js +2 -3
- package/es/pisell-materials.tw.css +1 -1
- package/lib/components/PisellSelectionFlow/PisellSelectionFlow.js +30 -2
- package/lib/components/PisellSelectionFlow/hooks/useFlowModuleLifecycle.js +24 -7
- package/lib/components/PisellSelectionFlow/hooks/useFlowNavigation.js +131 -13
- package/lib/components/PisellSelectionFlow/types.d.ts +11 -0
- package/lib/components/pisellLookup/PisellLookup.js +1 -2
- package/lib/components/pisellLookup/components/LookupResultHost.js +3 -3
- package/lib/components/pisellLookup/docs/pisellLookup.md +0 -1
- package/lib/components/pisellLookup/types.d.ts +0 -3
- package/lib/components/productCard/cartSkuCard/types.d.ts +0 -2
- package/lib/components/productCard/cartSkuCard/variants/A12/index.js +2 -3
- package/lib/pisell-materials.tw.css +1 -1
- package/package.json +3 -3
|
@@ -59,6 +59,7 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
59
59
|
const moduleInitializationRef = useRef(/* @__PURE__ */ new Map());
|
|
60
60
|
const moduleDependencyLifecycleRef = useRef(/* @__PURE__ */ new Map());
|
|
61
61
|
const pendingModuleChangeRef = useRef(/* @__PURE__ */ new Map());
|
|
62
|
+
const moduleInvalidationRef = useRef(/* @__PURE__ */ new Map());
|
|
62
63
|
const compiledStepsRef = useRef([]);
|
|
63
64
|
const configurationErrorRef = useRef(null);
|
|
64
65
|
const contextRef = useRef(null);
|
|
@@ -86,11 +87,13 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
86
87
|
moduleInitializationRef.current.clear();
|
|
87
88
|
moduleDependencyLifecycleRef.current.clear();
|
|
88
89
|
pendingModuleChangeRef.current.clear();
|
|
90
|
+
moduleInvalidationRef.current.clear();
|
|
89
91
|
moduleHandlesRef.current.clear();
|
|
90
92
|
};
|
|
91
93
|
}, []);
|
|
92
94
|
const commitModuleState = useCallback((moduleKey, nextState) => {
|
|
93
95
|
if (!mountedRef.current) return;
|
|
96
|
+
if (nextState.status === "ready") moduleInvalidationRef.current.delete(moduleKey);
|
|
94
97
|
const previous = moduleStateRef.current[moduleKey];
|
|
95
98
|
if ((previous === null || previous === void 0 ? void 0 : previous.status) === nextState.status && (previous === null || previous === void 0 ? void 0 : previous.message) === nextState.message && (previous === null || previous === void 0 ? void 0 : previous.reason) === nextState.reason && (previous === null || previous === void 0 ? void 0 : previous.error) === nextState.error) return;
|
|
96
99
|
const nextMap = _objectSpread2(_objectSpread2({}, moduleStateRef.current), {}, { [moduleKey]: nextState });
|
|
@@ -254,6 +257,7 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
254
257
|
moduleInitializationRef.current.delete(moduleKey);
|
|
255
258
|
moduleDependencyLifecycleRef.current.delete(moduleKey);
|
|
256
259
|
pendingModuleChangeRef.current.delete(moduleKey);
|
|
260
|
+
moduleInvalidationRef.current.delete(moduleKey);
|
|
257
261
|
moduleHandlesRef.current.delete(moduleKey);
|
|
258
262
|
if (moduleKey in nextMap) {
|
|
259
263
|
delete nextMap[moduleKey];
|
|
@@ -286,6 +290,7 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
286
290
|
moduleInitializationRef,
|
|
287
291
|
moduleDependencyLifecycleRef,
|
|
288
292
|
pendingModuleChangeRef,
|
|
293
|
+
moduleInvalidationRef,
|
|
289
294
|
compiledStepsRef,
|
|
290
295
|
moduleStateRef,
|
|
291
296
|
processDraftChangeRef,
|
|
@@ -298,13 +303,14 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
298
303
|
draft,
|
|
299
304
|
moduleState
|
|
300
305
|
});
|
|
301
|
-
const { validateCurrentStep, prepareSteps, complete, next, back } = useFlowNavigation({
|
|
306
|
+
const { validateCurrentStep, prepareSteps, complete, next, back, isStepSkippable, navigationDirectionRef } = useFlowNavigation({
|
|
302
307
|
registry,
|
|
303
308
|
draftAdapter,
|
|
304
309
|
createRuntimeIssue,
|
|
305
310
|
mountedRef,
|
|
306
311
|
moduleStateRef,
|
|
307
312
|
moduleRevisionRef,
|
|
313
|
+
moduleInvalidationRef,
|
|
308
314
|
draftRevisionRef,
|
|
309
315
|
flowGenerationRef,
|
|
310
316
|
moduleHandlesRef,
|
|
@@ -330,6 +336,27 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
330
336
|
setCompletionReason,
|
|
331
337
|
setIsCompleting
|
|
332
338
|
});
|
|
339
|
+
const autoAdvanceAttemptRef = useRef();
|
|
340
|
+
useEffect(() => {
|
|
341
|
+
if (configurationError || completedRef.current || transitionPendingRef.current || !currentStep || !isStepSkippable(resolvedCurrentStepIndex)) return;
|
|
342
|
+
const direction = navigationDirectionRef.current;
|
|
343
|
+
const key = `${direction}:${currentStep.key}:${draftRevisionRef.current}:${currentStep.modules.map((module) => `${module.key}:${moduleRevisionRef.current.get(module.key) || 0}`).join("|")}`;
|
|
344
|
+
if (autoAdvanceAttemptRef.current === key) return;
|
|
345
|
+
autoAdvanceAttemptRef.current = key;
|
|
346
|
+
if (direction === "backward") back();
|
|
347
|
+
else next();
|
|
348
|
+
}, [
|
|
349
|
+
configurationError,
|
|
350
|
+
currentStep,
|
|
351
|
+
resolvedCurrentStepIndex,
|
|
352
|
+
moduleState,
|
|
353
|
+
moduleData,
|
|
354
|
+
draft,
|
|
355
|
+
isStepSkippable,
|
|
356
|
+
navigationDirectionRef,
|
|
357
|
+
back,
|
|
358
|
+
next
|
|
359
|
+
]);
|
|
333
360
|
const getState = useCallback(() => {
|
|
334
361
|
const stepIndex = currentStepIndexRef.current;
|
|
335
362
|
return {
|
|
@@ -387,7 +414,8 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
387
414
|
back,
|
|
388
415
|
getState,
|
|
389
416
|
registerModuleHandle,
|
|
390
|
-
getModuleHandle
|
|
417
|
+
getModuleHandle,
|
|
418
|
+
isStepSkippable
|
|
391
419
|
};
|
|
392
420
|
return /* @__PURE__ */ React.createElement(SelectionFlowProvider, { value: contextValue }, children(controller));
|
|
393
421
|
};
|
|
@@ -5,12 +5,13 @@ import { getSelectionFlowErrorMessage } from "../utils.js";
|
|
|
5
5
|
import { useCallback, useEffect } from "react";
|
|
6
6
|
//#region src/components/PisellSelectionFlow/hooks/useFlowModuleLifecycle.ts
|
|
7
7
|
/** 负责依赖失效、清理、校正、刷新和异步 latest-wins。 */
|
|
8
|
-
const useFlowModuleLifecycle = ({ registry, draftAdapter, createRuntimeIssue, mountedRef, flowGenerationRef, draftRevisionRef, draftRef, moduleRevisionRef, moduleInitializationRef, moduleDependencyLifecycleRef, pendingModuleChangeRef, compiledStepsRef, moduleStateRef, processDraftChangeRef, commitModuleState, getFreshContext, currentStep, configurationError, compiledSteps, resolvedCurrentStepIndex, draft, moduleState }) => {
|
|
8
|
+
const useFlowModuleLifecycle = ({ registry, draftAdapter, createRuntimeIssue, mountedRef, flowGenerationRef, draftRevisionRef, draftRef, moduleRevisionRef, moduleInitializationRef, moduleDependencyLifecycleRef, pendingModuleChangeRef, moduleInvalidationRef, compiledStepsRef, moduleStateRef, processDraftChangeRef, commitModuleState, getFreshContext, currentStep, configurationError, compiledSteps, resolvedCurrentStepIndex, draft, moduleState }) => {
|
|
9
9
|
processDraftChangeRef.current = useCallback((change) => {
|
|
10
10
|
const changedFields = new Set(change.changedFields);
|
|
11
11
|
const flowGeneration = flowGenerationRef.current;
|
|
12
12
|
if (!mountedRef.current) return;
|
|
13
13
|
for (const step of compiledStepsRef.current) for (const module of step.modules) {
|
|
14
|
+
var _previousInvalidation, _moduleStateRef$curre;
|
|
14
15
|
if (module.key === change.sourceModuleKey) continue;
|
|
15
16
|
const adapter = resolveFlowModuleAdapter(registry, module.type);
|
|
16
17
|
if (!adapter) continue;
|
|
@@ -24,6 +25,14 @@ const useFlowModuleLifecycle = ({ registry, draftAdapter, createRuntimeIssue, mo
|
|
|
24
25
|
moduleRevisionRef.current.set(module.key, revision);
|
|
25
26
|
moduleInitializationRef.current.delete(module.key);
|
|
26
27
|
moduleDependencyLifecycleRef.current.delete(module.key);
|
|
28
|
+
const previousInvalidation = moduleInvalidationRef.current.get(module.key);
|
|
29
|
+
moduleInvalidationRef.current.set(module.key, {
|
|
30
|
+
wasReady: false,
|
|
31
|
+
change: previousInvalidation ? _objectSpread2(_objectSpread2({}, change), {}, {
|
|
32
|
+
previousDraft: previousInvalidation.change.previousDraft,
|
|
33
|
+
changedFields: Array.from(new Set([...previousInvalidation.change.changedFields, ...change.changedFields]))
|
|
34
|
+
}) : change
|
|
35
|
+
});
|
|
27
36
|
commitModuleState(module.key, {
|
|
28
37
|
status: "error",
|
|
29
38
|
message: getSelectionFlowErrorMessage(error),
|
|
@@ -32,6 +41,14 @@ const useFlowModuleLifecycle = ({ registry, draftAdapter, createRuntimeIssue, mo
|
|
|
32
41
|
continue;
|
|
33
42
|
}
|
|
34
43
|
if (!shouldRefresh) continue;
|
|
44
|
+
const previousInvalidation = moduleInvalidationRef.current.get(module.key);
|
|
45
|
+
moduleInvalidationRef.current.set(module.key, {
|
|
46
|
+
wasReady: (_previousInvalidation = previousInvalidation === null || previousInvalidation === void 0 ? void 0 : previousInvalidation.wasReady) !== null && _previousInvalidation !== void 0 ? _previousInvalidation : ((_moduleStateRef$curre = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre === void 0 ? void 0 : _moduleStateRef$curre.status) === "ready",
|
|
47
|
+
change: previousInvalidation ? _objectSpread2(_objectSpread2({}, change), {}, {
|
|
48
|
+
previousDraft: previousInvalidation.change.previousDraft,
|
|
49
|
+
changedFields: Array.from(new Set([...previousInvalidation.change.changedFields, ...change.changedFields]))
|
|
50
|
+
}) : change
|
|
51
|
+
});
|
|
35
52
|
const previousPendingChange = pendingModuleChangeRef.current.get(module.key);
|
|
36
53
|
const lifecycleChange = previousPendingChange ? _objectSpread2(_objectSpread2({}, change), {}, {
|
|
37
54
|
previousDraft: previousPendingChange.previousDraft,
|
|
@@ -163,7 +180,7 @@ const useFlowModuleLifecycle = ({ registry, draftAdapter, createRuntimeIssue, mo
|
|
|
163
180
|
return false;
|
|
164
181
|
}
|
|
165
182
|
try {
|
|
166
|
-
var _await$adapter$canIni, _adapter$canInitializ, _moduleStateRef$
|
|
183
|
+
var _await$adapter$canIni, _adapter$canInitializ, _moduleStateRef$curre3;
|
|
167
184
|
const canInitialize = (_await$adapter$canIni = yield (_adapter$canInitializ = adapter.canInitialize) === null || _adapter$canInitializ === void 0 ? void 0 : _adapter$canInitializ.call(adapter, context, module)) !== null && _await$adapter$canIni !== void 0 ? _await$adapter$canIni : true;
|
|
168
185
|
if (!isCurrentRun()) return false;
|
|
169
186
|
if (!canInitialize) {
|
|
@@ -174,14 +191,14 @@ const useFlowModuleLifecycle = ({ registry, draftAdapter, createRuntimeIssue, mo
|
|
|
174
191
|
return false;
|
|
175
192
|
}
|
|
176
193
|
do {
|
|
177
|
-
var _adapter$refresh, _moduleStateRef$
|
|
194
|
+
var _adapter$refresh, _moduleStateRef$curre2;
|
|
178
195
|
commitModuleState(module.key, { status: "loading" });
|
|
179
196
|
context = getRunContext();
|
|
180
197
|
if (!context || !isCurrentRun()) return false;
|
|
181
198
|
yield (_adapter$refresh = adapter.refresh) === null || _adapter$refresh === void 0 ? void 0 : _adapter$refresh.call(adapter, context, module);
|
|
182
199
|
if (!isCurrentRun()) return false;
|
|
183
|
-
if (((_moduleStateRef$
|
|
184
|
-
} while (((_moduleStateRef$
|
|
200
|
+
if (((_moduleStateRef$curre2 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre2 === void 0 ? void 0 : _moduleStateRef$curre2.status) === "error") return false;
|
|
201
|
+
} while (((_moduleStateRef$curre3 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre3 === void 0 ? void 0 : _moduleStateRef$curre3.status) === "stale");
|
|
185
202
|
commitModuleState(module.key, { status: "ready" });
|
|
186
203
|
return true;
|
|
187
204
|
} catch (error) {
|
|
@@ -216,8 +233,8 @@ const useFlowModuleLifecycle = ({ registry, draftAdapter, createRuntimeIssue, mo
|
|
|
216
233
|
return (adapter === null || adapter === void 0 ? void 0 : adapter.initializeWhileInactive) && module.stepIndex < resolvedCurrentStepIndex;
|
|
217
234
|
});
|
|
218
235
|
for (const module of [...currentStep.modules, ...backgroundModules]) {
|
|
219
|
-
var _moduleStateRef$
|
|
220
|
-
const status = ((_moduleStateRef$
|
|
236
|
+
var _moduleStateRef$curre4;
|
|
237
|
+
const status = ((_moduleStateRef$curre4 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre4 === void 0 ? void 0 : _moduleStateRef$curre4.status) || "idle";
|
|
221
238
|
if (status === "idle" || status === "stale") ensureModuleReady(module);
|
|
222
239
|
}
|
|
223
240
|
}, [
|
|
@@ -2,10 +2,26 @@ import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/
|
|
|
2
2
|
import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
3
|
import { resolveFlowModuleAdapter } from "../compiler.js";
|
|
4
4
|
import { getCompiledStepsFingerprint, getSelectionFlowErrorMessage, normalizeFlowBeforeLeaveResult, normalizeFlowValidationResult } from "../utils.js";
|
|
5
|
-
import { useCallback } from "react";
|
|
5
|
+
import { useCallback, useRef } from "react";
|
|
6
6
|
//#region src/components/PisellSelectionFlow/hooks/useFlowNavigation.ts
|
|
7
7
|
/** 导航、校验与提交门禁独立于模块加载生命周期。 */
|
|
8
|
-
const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mountedRef, moduleStateRef, moduleRevisionRef, draftRevisionRef, flowGenerationRef, moduleHandlesRef, configurationErrorRef, compiledStepsRef, currentStepIndexRef, currentStepKeyRef, validatedCompletionRef, navigationRevisionRef, preparationRevisionRef, transitionPendingRef, completedRef, completionPromiseRef, isCompletingRef, draftRef, onCompleteRef, ensureModuleReady, commitModuleState, getFreshContext, onValidationFailed, setCurrentStepIndex, setCompletionError, setCompletionReason, setIsCompleting }) => {
|
|
8
|
+
const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mountedRef, moduleStateRef, moduleRevisionRef, moduleInvalidationRef, draftRevisionRef, flowGenerationRef, moduleHandlesRef, configurationErrorRef, compiledStepsRef, currentStepIndexRef, currentStepKeyRef, validatedCompletionRef, navigationRevisionRef, preparationRevisionRef, transitionPendingRef, completedRef, completionPromiseRef, isCompletingRef, draftRef, onCompleteRef, ensureModuleReady, commitModuleState, getFreshContext, onValidationFailed, setCurrentStepIndex, setCompletionError, setCompletionReason, setIsCompleting }) => {
|
|
9
|
+
const navigationDirectionRef = useRef("forward");
|
|
10
|
+
const isStepSkippable = useCallback((stepIndex) => {
|
|
11
|
+
const step = compiledStepsRef.current[stepIndex];
|
|
12
|
+
const context = getFreshContext();
|
|
13
|
+
if (!(step === null || step === void 0 ? void 0 : step.modules.length) || !context) return false;
|
|
14
|
+
return step.modules.every((module) => {
|
|
15
|
+
var _moduleStateRef$curre;
|
|
16
|
+
if (((_moduleStateRef$curre = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre === void 0 ? void 0 : _moduleStateRef$curre.status) !== "ready") return false;
|
|
17
|
+
try {
|
|
18
|
+
var _resolveFlowModuleAda, _resolveFlowModuleAda2;
|
|
19
|
+
return ((_resolveFlowModuleAda = resolveFlowModuleAdapter(registry, module.type)) === null || _resolveFlowModuleAda === void 0 || (_resolveFlowModuleAda2 = _resolveFlowModuleAda.isSkippable) === null || _resolveFlowModuleAda2 === void 0 ? void 0 : _resolveFlowModuleAda2.call(_resolveFlowModuleAda, context, module)) === true;
|
|
20
|
+
} catch (_unused) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}, [getFreshContext, registry]);
|
|
9
25
|
const validateModule = useCallback(function() {
|
|
10
26
|
var _ref = _asyncToGenerator(function* (module) {
|
|
11
27
|
const adapter = resolveFlowModuleAdapter(registry, module.type);
|
|
@@ -180,16 +196,16 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
180
196
|
}
|
|
181
197
|
}
|
|
182
198
|
if (!targetModules.find(({ module }) => {
|
|
183
|
-
var _moduleStateRef$
|
|
184
|
-
return ((_moduleStateRef$
|
|
199
|
+
var _moduleStateRef$curre2;
|
|
200
|
+
return ((_moduleStateRef$curre2 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre2 === void 0 ? void 0 : _moduleStateRef$curre2.status) !== "ready";
|
|
185
201
|
})) return isCurrentPreparation() ? { prepared: true } : {
|
|
186
202
|
prepared: false,
|
|
187
203
|
cancelled: true
|
|
188
204
|
};
|
|
189
205
|
}
|
|
190
206
|
const unresolved = targetModules.find(({ module }) => {
|
|
191
|
-
var _moduleStateRef$
|
|
192
|
-
return ((_moduleStateRef$
|
|
207
|
+
var _moduleStateRef$curre3;
|
|
208
|
+
return ((_moduleStateRef$curre3 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre3 === void 0 ? void 0 : _moduleStateRef$curre3.status) !== "ready";
|
|
193
209
|
});
|
|
194
210
|
return unresolved ? {
|
|
195
211
|
prepared: false,
|
|
@@ -257,19 +273,109 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
257
273
|
onValidationFailed,
|
|
258
274
|
registry
|
|
259
275
|
]);
|
|
276
|
+
const revalidateModuleBeforeComplete = useCallback(function() {
|
|
277
|
+
var _ref2 = _asyncToGenerator(function* (module, expectedDraftRevision) {
|
|
278
|
+
const invalidation = moduleInvalidationRef.current.get(module.key);
|
|
279
|
+
const adapter = resolveFlowModuleAdapter(registry, module.type);
|
|
280
|
+
if (!(invalidation === null || invalidation === void 0 ? void 0 : invalidation.wasReady) || !(adapter === null || adapter === void 0 ? void 0 : adapter.canRevalidateBeforeComplete) || !adapter.validateAutoResolution) return false;
|
|
281
|
+
const moduleRevision = moduleRevisionRef.current.get(module.key) || 0;
|
|
282
|
+
const flowGeneration = flowGenerationRef.current;
|
|
283
|
+
const navigationRevision = navigationRevisionRef.current;
|
|
284
|
+
const compiledFingerprint = getCompiledStepsFingerprint(compiledStepsRef.current);
|
|
285
|
+
const isCurrentRun = () => mountedRef.current && !configurationErrorRef.current && flowGenerationRef.current === flowGeneration && navigationRevisionRef.current === navigationRevision && (moduleRevisionRef.current.get(module.key) || 0) === moduleRevision && getCompiledStepsFingerprint(compiledStepsRef.current) === compiledFingerprint;
|
|
286
|
+
const isCurrentSelection = () => isCurrentRun() && draftRevisionRef.current === expectedDraftRevision;
|
|
287
|
+
const requireReviewIfCurrent = () => {
|
|
288
|
+
if (isCurrentRun()) commitModuleState(module.key, {
|
|
289
|
+
status: "stale",
|
|
290
|
+
reason: createRuntimeIssue("selection-changed-validation")
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
try {
|
|
294
|
+
const initialContext = getFreshContext();
|
|
295
|
+
if (!initialContext || !isCurrentSelection() || !adapter.canRevalidateBeforeComplete(initialContext, invalidation.change, module)) return false;
|
|
296
|
+
if (!(yield ensureModuleReady(module))) return false;
|
|
297
|
+
if (!isCurrentSelection()) {
|
|
298
|
+
requireReviewIfCurrent();
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
const context = getFreshContext();
|
|
302
|
+
if (!context) return false;
|
|
303
|
+
const validationContext = _objectSpread2(_objectSpread2({}, context), {}, {
|
|
304
|
+
updateDraft: (update, meta) => {
|
|
305
|
+
if (isCurrentSelection()) context.updateDraft(update, meta);
|
|
306
|
+
},
|
|
307
|
+
setModuleState: (moduleKey, state) => {
|
|
308
|
+
if (isCurrentSelection()) context.setModuleState(moduleKey, state);
|
|
309
|
+
},
|
|
310
|
+
setModuleStatus: (moduleKey, status, message, error) => {
|
|
311
|
+
if (isCurrentSelection()) context.setModuleStatus(moduleKey, status, message, error);
|
|
312
|
+
},
|
|
313
|
+
setModuleData: (moduleKey, value) => {
|
|
314
|
+
if (isCurrentSelection()) context.setModuleData(moduleKey, value);
|
|
315
|
+
},
|
|
316
|
+
clearModuleData: (moduleKey) => {
|
|
317
|
+
if (isCurrentSelection()) context.clearModuleData(moduleKey);
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
const result = normalizeFlowValidationResult(yield adapter.validateAutoResolution(validationContext, module));
|
|
321
|
+
if (!isCurrentSelection()) {
|
|
322
|
+
requireReviewIfCurrent();
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
if (!result.valid) {
|
|
326
|
+
commitModuleState(module.key, {
|
|
327
|
+
status: "error",
|
|
328
|
+
message: result.message,
|
|
329
|
+
reason: result.message ? void 0 : createRuntimeIssue("module-validation-failed")
|
|
330
|
+
});
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
commitModuleState(module.key, { status: "ready" });
|
|
334
|
+
return true;
|
|
335
|
+
} catch (error) {
|
|
336
|
+
if (isCurrentSelection()) commitModuleState(module.key, {
|
|
337
|
+
status: "error",
|
|
338
|
+
message: getSelectionFlowErrorMessage(error),
|
|
339
|
+
error
|
|
340
|
+
});
|
|
341
|
+
else requireReviewIfCurrent();
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
return function(_x2, _x3) {
|
|
346
|
+
return _ref2.apply(this, arguments);
|
|
347
|
+
};
|
|
348
|
+
}(), [
|
|
349
|
+
commitModuleState,
|
|
350
|
+
createRuntimeIssue,
|
|
351
|
+
ensureModuleReady,
|
|
352
|
+
getFreshContext,
|
|
353
|
+
registry
|
|
354
|
+
]);
|
|
260
355
|
const validateFlowForCompletion = useCallback(_asyncToGenerator(function* () {
|
|
261
356
|
validatedCompletionRef.current = null;
|
|
262
357
|
if (configurationErrorRef.current) return false;
|
|
263
358
|
const currentIndex = currentStepIndexRef.current;
|
|
264
359
|
const allSteps = compiledStepsRef.current;
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
const
|
|
360
|
+
const preparationFingerprint = getCompiledStepsFingerprint(allSteps);
|
|
361
|
+
const preparationGeneration = flowGenerationRef.current;
|
|
362
|
+
const preparationNavigation = navigationRevisionRef.current;
|
|
363
|
+
const preparationDraftRevision = draftRevisionRef.current;
|
|
364
|
+
const isCurrentPreparation = () => mountedRef.current && !configurationErrorRef.current && flowGenerationRef.current === preparationGeneration && navigationRevisionRef.current === preparationNavigation && currentStepIndexRef.current === currentIndex && getCompiledStepsFingerprint(compiledStepsRef.current) === preparationFingerprint;
|
|
268
365
|
for (const step of allSteps) {
|
|
269
366
|
if (step.index >= currentIndex) break;
|
|
270
367
|
for (const module of step.modules) {
|
|
271
|
-
|
|
368
|
+
let state = moduleStateRef.current[module.key];
|
|
272
369
|
if ((state === null || state === void 0 ? void 0 : state.status) !== "ready") {
|
|
370
|
+
const revalidationModuleRevision = moduleRevisionRef.current.get(module.key) || 0;
|
|
371
|
+
const revalidated = yield revalidateModuleBeforeComplete(module, preparationDraftRevision);
|
|
372
|
+
if (!isCurrentPreparation()) return false;
|
|
373
|
+
if (revalidated && draftRevisionRef.current === preparationDraftRevision) continue;
|
|
374
|
+
if (revalidated && (moduleRevisionRef.current.get(module.key) || 0) === revalidationModuleRevision) commitModuleState(module.key, {
|
|
375
|
+
status: "stale",
|
|
376
|
+
reason: createRuntimeIssue("selection-changed-validation")
|
|
377
|
+
});
|
|
378
|
+
state = moduleStateRef.current[module.key];
|
|
273
379
|
currentStepIndexRef.current = step.index;
|
|
274
380
|
currentStepKeyRef.current = step.key;
|
|
275
381
|
setCurrentStepIndex(step.index);
|
|
@@ -281,6 +387,9 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
281
387
|
}
|
|
282
388
|
}
|
|
283
389
|
}
|
|
390
|
+
const compiledFingerprint = getCompiledStepsFingerprint(allSteps);
|
|
391
|
+
const revisionFingerprint = allSteps.flatMap((step) => step.modules).map((module) => `${module.key}:${moduleRevisionRef.current.get(module.key) || 0}`).join("|");
|
|
392
|
+
const draftRevision = draftRevisionRef.current;
|
|
284
393
|
if (!(yield validateCurrentStep())) return false;
|
|
285
394
|
if (configurationErrorRef.current) return false;
|
|
286
395
|
const latestSteps = compiledStepsRef.current;
|
|
@@ -288,8 +397,8 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
288
397
|
const latestRevisionFingerprint = latestSteps.flatMap((step) => step.modules).map((module) => `${module.key}:${moduleRevisionRef.current.get(module.key) || 0}`).join("|");
|
|
289
398
|
if (compiledFingerprint !== latestCompiledFingerprint || revisionFingerprint !== latestRevisionFingerprint || draftRevision !== draftRevisionRef.current) {
|
|
290
399
|
const targetStep = latestSteps.find((step) => step.modules.some((module) => {
|
|
291
|
-
var _moduleStateRef$
|
|
292
|
-
return ((_moduleStateRef$
|
|
400
|
+
var _moduleStateRef$curre4;
|
|
401
|
+
return ((_moduleStateRef$curre4 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre4 === void 0 ? void 0 : _moduleStateRef$curre4.status) !== "ready";
|
|
293
402
|
})) || latestSteps[0];
|
|
294
403
|
const targetModule = targetStep === null || targetStep === void 0 ? void 0 : targetStep.modules[0];
|
|
295
404
|
if (targetStep && targetModule) {
|
|
@@ -319,8 +428,10 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
319
428
|
};
|
|
320
429
|
return true;
|
|
321
430
|
}), [
|
|
431
|
+
commitModuleState,
|
|
322
432
|
createRuntimeIssue,
|
|
323
433
|
onValidationFailed,
|
|
434
|
+
revalidateModuleBeforeComplete,
|
|
324
435
|
validateCurrentStep
|
|
325
436
|
]);
|
|
326
437
|
const complete = useCallback(() => {
|
|
@@ -328,6 +439,7 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
328
439
|
if (completedRef.current) return Promise.resolve(true);
|
|
329
440
|
if (completionPromiseRef.current) return completionPromiseRef.current;
|
|
330
441
|
if (transitionPendingRef.current) return Promise.resolve(false);
|
|
442
|
+
navigationDirectionRef.current = "forward";
|
|
331
443
|
transitionPendingRef.current = true;
|
|
332
444
|
const navigationRevision = navigationRevisionRef.current + 1;
|
|
333
445
|
navigationRevisionRef.current = navigationRevision;
|
|
@@ -382,6 +494,7 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
382
494
|
const currentIndex = currentStepIndexRef.current;
|
|
383
495
|
const allSteps = compiledStepsRef.current;
|
|
384
496
|
if (!allSteps[currentIndex]) return false;
|
|
497
|
+
navigationDirectionRef.current = "forward";
|
|
385
498
|
if (currentIndex >= allSteps.length - 1) return complete();
|
|
386
499
|
const currentStepKey = allSteps[currentIndex].key;
|
|
387
500
|
const navigationRevision = navigationRevisionRef.current + 1;
|
|
@@ -408,13 +521,18 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
408
521
|
back: useCallback(() => {
|
|
409
522
|
var _compiledStepsRef$cur3;
|
|
410
523
|
if (!mountedRef.current || transitionPendingRef.current || currentStepIndexRef.current <= 0) return false;
|
|
524
|
+
let nextIndex = currentStepIndexRef.current - 1;
|
|
525
|
+
while (nextIndex >= 0 && isStepSkippable(nextIndex)) nextIndex -= 1;
|
|
526
|
+
if (nextIndex < 0) return false;
|
|
527
|
+
navigationDirectionRef.current = "backward";
|
|
411
528
|
navigationRevisionRef.current += 1;
|
|
412
|
-
const nextIndex = currentStepIndexRef.current - 1;
|
|
413
529
|
currentStepIndexRef.current = nextIndex;
|
|
414
530
|
currentStepKeyRef.current = (_compiledStepsRef$cur3 = compiledStepsRef.current[nextIndex]) === null || _compiledStepsRef$cur3 === void 0 ? void 0 : _compiledStepsRef$cur3.key;
|
|
415
531
|
setCurrentStepIndex(nextIndex);
|
|
416
532
|
return true;
|
|
417
|
-
}, [])
|
|
533
|
+
}, [isStepSkippable]),
|
|
534
|
+
isStepSkippable,
|
|
535
|
+
navigationDirectionRef
|
|
418
536
|
};
|
|
419
537
|
};
|
|
420
538
|
//#endregion
|
|
@@ -100,10 +100,19 @@ interface SelectionFlowModuleAdapter<TDraft, TDraftUpdate, TField extends string
|
|
|
100
100
|
type: TModuleType;
|
|
101
101
|
/** 离开所在步骤后仍需随 Draft 变化保持就绪的无界面门禁模块。 */
|
|
102
102
|
initializeWhileInactive?: boolean;
|
|
103
|
+
/** Ready modules may omit their navigation stop; validation and beforeLeave still run. */
|
|
104
|
+
isSkippable?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => boolean;
|
|
103
105
|
provides?: readonly TField[];
|
|
104
106
|
hardRequires?: readonly TField[];
|
|
105
107
|
refreshOn?: readonly TField[];
|
|
106
108
|
shouldRefresh?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, change: SelectionFlowDraftChange<TDraft, TField, TModuleType>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Explicitly permits completion to refresh a previously ready, invalidated
|
|
111
|
+
* module without revisiting its UI. The accumulated change starts at its last
|
|
112
|
+
* ready state. Completion still requires validateAutoResolution to succeed
|
|
113
|
+
* without any Draft revision changing; beforeLeave is not run here.
|
|
114
|
+
*/
|
|
115
|
+
canRevalidateBeforeComplete?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, change: SelectionFlowDraftChange<TDraft, TField, TModuleType>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => boolean;
|
|
107
116
|
isApplicable?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => boolean;
|
|
108
117
|
canInitialize?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => boolean | Promise<boolean>;
|
|
109
118
|
refresh?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => void | Promise<void>;
|
|
@@ -164,6 +173,8 @@ interface PisellSelectionFlowController<TDraft, TDraftUpdate, TField extends str
|
|
|
164
173
|
getState: () => SelectionFlowSnapshot<TDraft, TModuleType>;
|
|
165
174
|
registerModuleHandle: (moduleKey: string, handle: FlowModuleHandle | null) => void;
|
|
166
175
|
getModuleHandle: (moduleKey: string) => FlowModuleHandle | undefined;
|
|
176
|
+
/** True only when every module in the step is ready and explicitly permits skipping. */
|
|
177
|
+
isStepSkippable: (stepIndex: number) => boolean;
|
|
167
178
|
}
|
|
168
179
|
interface PisellSelectionFlowProps<TDraft, TDraftUpdate, TField extends string, TModuleType extends string, TServices = unknown, THostContext = unknown> {
|
|
169
180
|
registry: SelectionFlowModuleRegistry<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>;
|
|
@@ -27,7 +27,7 @@ import "./PisellLookup.less";
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
const PisellLookupComponent = forwardRef((props, ref) => {
|
|
30
|
-
const { showTrigger = true, triggerType = "input", trigger, triggerText, triggerIcon, buttonText = getText("pisell-lookup-button-text"), placeholder = getText("pisell-lookup-placeholder"), size = "middle", disabled = false, showPrefixIcon = false, prefixIcon, addonBefore, showClear = true, showConfirmButton = true, confirmButtonText = getText("pisell-lookup-confirm-button-text"), confirmButtonDisabled = false, closeButtonText = getText("pisell-lookup-close"), value, defaultValue, onChange, onSearch, searchMode = "realtime", debounceTime = 300, allowRepeatSearch = false, showScan = true, onScan, showHistory = false, historyKey = "pisell_lookup_history", maxHistoryCount = 10, onLoadHistory, onSaveHistory, historyRender, showSuggestions = false, onLoadSuggestions, suggestionsRender, showHotWords = false, onLoadHotWords, hotWordsRender, displayType: displayTypeProp, resultRender, loading = false, emptyRender,
|
|
30
|
+
const { showTrigger = true, triggerType = "input", trigger, triggerText, triggerIcon, buttonText = getText("pisell-lookup-button-text"), placeholder = getText("pisell-lookup-placeholder"), size = "middle", disabled = false, showPrefixIcon = false, prefixIcon, addonBefore, showClear = true, showConfirmButton = true, confirmButtonText = getText("pisell-lookup-confirm-button-text"), confirmButtonDisabled = false, closeButtonText = getText("pisell-lookup-close"), value, defaultValue, onChange, onSearch, searchMode = "realtime", debounceTime = 300, allowRepeatSearch = false, showScan = true, onScan, showHistory = false, historyKey = "pisell_lookup_history", maxHistoryCount = 10, onLoadHistory, onSaveHistory, historyRender, showSuggestions = false, onLoadSuggestions, suggestionsRender, showHotWords = false, onLoadHotWords, hotWordsRender, displayType: displayTypeProp, resultRender, loading = false, emptyRender, modalWidth, modalStyle, modalCentered = false, modalTransitionName, getContainer, drawerWidth, drawerHeight, drawerPlacement, drawerTitle, drawerClosable, popupWidth, containerStyle, containerClassName, visible: visibleProp, defaultVisible, onVisibleChange, onOpen, onClose, mask = false, maskClosable, clearOnClose = false, autoFocusOnOpen = true, inputRender, headerRender, className, style, zIndex } = props;
|
|
31
31
|
/**
|
|
32
32
|
* 智能判断展示类型
|
|
33
33
|
*/
|
|
@@ -417,7 +417,6 @@ const PisellLookupComponent = forwardRef((props, ref) => {
|
|
|
417
417
|
className: `pisell-lookup ${className || ""}`,
|
|
418
418
|
style
|
|
419
419
|
}, showTrigger ? renderTrigger() : null, /* @__PURE__ */ React.createElement(LookupResultHost, {
|
|
420
|
-
containerComponent,
|
|
421
420
|
displayType,
|
|
422
421
|
visible,
|
|
423
422
|
onClose: close,
|
|
@@ -11,7 +11,7 @@ import { Dropdown } from "antd";
|
|
|
11
11
|
*/
|
|
12
12
|
const LookupResultHost = (props) => {
|
|
13
13
|
const theme = usePisellTheme();
|
|
14
|
-
const {
|
|
14
|
+
const { displayType, visible, onClose, children, modalWidth = 834, modalStyle, modalCentered = false, modalTransitionName, getContainer, drawerWidth = 378, drawerHeight, drawerPlacement = "right", drawerTitle = getText("pisell-lookup-confirm-button-text"), drawerClosable = true, popupWidth, containerStyle, containerClassName, mask = false, maskClosable = true, zIndex, onAfterOpen } = props;
|
|
15
15
|
const portalContentStyle = theme ? _objectSpread2(_objectSpread2({}, containerStyle), theme.cssVariables) : containerStyle;
|
|
16
16
|
/**
|
|
17
17
|
* 渲染 Inline 模式
|
|
@@ -59,7 +59,7 @@ const LookupResultHost = (props) => {
|
|
|
59
59
|
].filter(Boolean).join(" ");
|
|
60
60
|
const modalClassName = ["pisell-lookup-modal-container", containerClassName || ""].filter(Boolean).join(" ");
|
|
61
61
|
const wrapClassName = hasCustomContainer ? "pisell-lookup-modal-custom-container" : "";
|
|
62
|
-
return /* @__PURE__ */ React.createElement(
|
|
62
|
+
return /* @__PURE__ */ React.createElement(PisellContainer, {
|
|
63
63
|
renderType: "modal",
|
|
64
64
|
props: {
|
|
65
65
|
open: visible,
|
|
@@ -95,7 +95,7 @@ const LookupResultHost = (props) => {
|
|
|
95
95
|
const renderDrawer = () => {
|
|
96
96
|
const effectiveMaskClosable = mask ? maskClosable : false;
|
|
97
97
|
const drawerClassName = `pisell-lookup-drawer-container ${!mask ? "pisell-lookup-drawer-no-mask" : ""} ${containerClassName || ""}`;
|
|
98
|
-
return /* @__PURE__ */ React.createElement(
|
|
98
|
+
return /* @__PURE__ */ React.createElement(PisellContainer, {
|
|
99
99
|
renderType: "drawer",
|
|
100
100
|
props: {
|
|
101
101
|
open: visible,
|
|
@@ -1253,7 +1253,6 @@ export default () => {
|
|
|
1253
1253
|
| popupWidth | `number \| string` | - | Popup 宽度 |
|
|
1254
1254
|
| containerStyle | `CSSProperties` | - | 容器自定义样式 |
|
|
1255
1255
|
| containerClassName | `string` | - | 容器自定义类名 |
|
|
1256
|
-
| containerComponent | `React.ComponentType<PisellContainerProps<'modal' \| 'drawer'>>` | `PisellContainer` | 替换 Modal / Drawer 容器;接收 `renderType`、`props` 和 `children`,PisellFind 同样支持 |
|
|
1257
1256
|
|
|
1258
1257
|
#### 可见性控制
|
|
1259
1258
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PisellContainerProps } from "../pisellContainer/index.js";
|
|
2
1
|
import React from "react";
|
|
3
2
|
|
|
4
3
|
//#region src/components/pisellLookup/types.d.ts
|
|
@@ -318,8 +317,6 @@ interface PisellLookupProps {
|
|
|
318
317
|
* @returns 空状态内容
|
|
319
318
|
*/
|
|
320
319
|
emptyRender?: () => React.ReactNode;
|
|
321
|
-
/** 替换 Modal / Drawer 容器,默认使用 PisellContainer。 */
|
|
322
|
-
containerComponent?: React.ComponentType<PisellContainerProps<'modal' | 'drawer'>>;
|
|
323
320
|
/**
|
|
324
321
|
* Modal 宽度
|
|
325
322
|
* @default 834
|
|
@@ -12,8 +12,6 @@ interface CartSkuCardSlotContext {
|
|
|
12
12
|
}
|
|
13
13
|
interface CartSkuCardA12Slots {
|
|
14
14
|
contentFooter?: (context: CartSkuCardSlotContext) => ReactNode;
|
|
15
|
-
/** 有内容时替代价格、编辑和数量区域,保留默认删除按钮;空值沿用原展示。 */
|
|
16
|
-
status?: (context: CartSkuCardSlotContext) => ReactNode;
|
|
17
15
|
quantityControl?: (context: CartSkuCardSlotContext) => ReactNode;
|
|
18
16
|
actionRail?: (context: CartSkuCardSlotContext & {
|
|
19
17
|
defaultPrice: ReactNode;
|
|
@@ -63,7 +63,7 @@ function getPresentationStyle(presentation) {
|
|
|
63
63
|
return style;
|
|
64
64
|
}
|
|
65
65
|
const A12 = ({ dataSource, isShowImage = true, isShowDelete = false, isShowOriginalPrice = false, isShowEditProduct = false, disabled = false, disabledEditClick = false, slots, presentation, onDelete, onEditProduct }) => {
|
|
66
|
-
var _ref8, _dataSource$num, _dataSource$total, _dataSource$origin_to, _slots$contentFooter
|
|
66
|
+
var _ref8, _dataSource$num, _dataSource$total, _dataSource$origin_to, _slots$contentFooter;
|
|
67
67
|
const display = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.a12) || {};
|
|
68
68
|
const specificationsData = useMemo(() => resolveSpecifications(dataSource), [dataSource]);
|
|
69
69
|
const weighingInfo = useMemo(() => resolveWeighingSnapshot(dataSource), [dataSource]);
|
|
@@ -82,7 +82,6 @@ const A12 = ({ dataSource, isShowImage = true, isShowDelete = false, isShowOrigi
|
|
|
82
82
|
}, specification.label ? /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}-a12__specification-label` }, specification.label) : null, /* @__PURE__ */ React.createElement("strong", { className: `${PREFIX}-a12__specification-value` }, specification.value)))) : (dataSource === null || dataSource === void 0 ? void 0 : dataSource.product_option_string) ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__specification-summary` }, dataSource.product_option_string) : null;
|
|
83
83
|
const specifications = (slots === null || slots === void 0 ? void 0 : slots.specifications) ? slots.specifications(_objectSpread2(_objectSpread2({}, slotContext), {}, { defaultSpecifications })) : defaultSpecifications;
|
|
84
84
|
const contentFooter = slots === null || slots === void 0 || (_slots$contentFooter = slots.contentFooter) === null || _slots$contentFooter === void 0 ? void 0 : _slots$contentFooter.call(slots, slotContext);
|
|
85
|
-
const status = slots === null || slots === void 0 || (_slots$status = slots.status) === null || _slots$status === void 0 ? void 0 : _slots$status.call(slots, slotContext);
|
|
86
85
|
const defaultPrice = /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__price` }, /* @__PURE__ */ React.createElement("strong", null, formatAmount(lineTotal, 2, symbol)), isShowOriginalPrice && originalTotal > 0 && originalTotal !== lineTotal ? /* @__PURE__ */ React.createElement("del", null, formatAmount(originalTotal, 2, symbol)) : null);
|
|
87
86
|
const defaultEdit = Boolean(isShowEditProduct && onEditProduct) ? /* @__PURE__ */ React.createElement("button", {
|
|
88
87
|
type: "button",
|
|
@@ -105,7 +104,7 @@ const A12 = ({ dataSource, isShowImage = true, isShowDelete = false, isShowOrigi
|
|
|
105
104
|
event.stopPropagation();
|
|
106
105
|
onDelete(dataSource);
|
|
107
106
|
}
|
|
108
|
-
}, /* @__PURE__ */ React.createElement(IconFont, { type: "pisell2-trash-01" })) : null,
|
|
107
|
+
}, /* @__PURE__ */ React.createElement(IconFont, { type: "pisell2-trash-01" })) : null, defaultPrice, defaultEdit, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__quantity-control` }, defaultQuantityControl));
|
|
109
108
|
const actionRail = (slots === null || slots === void 0 ? void 0 : slots.actionRail) ? slots.actionRail(_objectSpread2(_objectSpread2({}, slotContext), {}, {
|
|
110
109
|
defaultPrice,
|
|
111
110
|
defaultEdit,
|