@pisell/materials 6.12.51 → 6.12.53
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/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +3 -3
- package/build/lowcode/preview.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +48 -48
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +48 -48
- package/es/components/PisellCards/index.d.ts +1 -0
- package/es/components/PisellFields/index.d.ts +1 -0
- package/es/components/PisellLayouts/index.d.ts +1 -0
- package/es/components/PisellMetrics/index.d.ts +1 -0
- package/es/components/PisellSelectionFlow/PisellSelectionFlow.js +7 -1
- package/es/components/PisellSelectionFlow/hooks/useFlowNavigation.js +104 -3
- package/es/components/PisellSelectionFlow/index.d.ts +1 -1
- package/es/components/PisellSelectionFlow/types.d.ts +20 -1
- package/es/components/appVersionControl/types.d.ts +1 -0
- package/es/components/calendar/index.d.ts +1 -0
- package/es/components/checkbox/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Radio/WithMode.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Tabs/index.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Translation/type.d.ts +1 -0
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +1 -0
- package/es/components/date-picker/index.d.ts +1 -0
- package/es/components/drag-sort-tree/types.d.ts +1 -0
- package/es/components/filter/components/FilterButton/types.d.ts +1 -0
- package/es/components/input/index.d.ts +1 -0
- package/es/components/pisell-config-provider/context.d.ts +1 -0
- package/es/components/pisellDatePicker/index.d.ts +1 -0
- package/es/components/pisellGridPro/ToolBar/type.d.ts +1 -0
- package/es/components/pisellMenu/types.d.ts +1 -0
- package/es/components/pisellQuickFilter/type.d.ts +1 -0
- package/es/components/productCard/cartSkuCard/components/AmountFooter/index.less +1 -1
- package/es/components/productCard/cartSkuCard/index.js +3 -33
- package/es/components/productCard/cartSkuCard/index.less +0 -19
- package/es/components/productCard/lineItem/index.js +11 -42
- package/es/components/productCard/types.d.ts +1 -4
- package/es/components/radio/index.d.ts +1 -0
- package/es/components/section-footers/index.d.ts +1 -0
- package/es/components/skeleton/index.d.ts +1 -0
- package/es/components/time-picker/index.d.ts +1 -0
- package/es/components/upload/index.d.ts +1 -0
- package/es/components/virtual-keyboard/Amount/types.d.ts +1 -0
- package/es/index.d.ts +2 -3
- package/lib/components/PisellCards/index.d.ts +1 -0
- package/lib/components/PisellFields/index.d.ts +1 -0
- package/lib/components/PisellLayouts/index.d.ts +1 -0
- package/lib/components/PisellMetrics/index.d.ts +1 -0
- package/lib/components/PisellSelectionFlow/PisellSelectionFlow.js +7 -1
- package/lib/components/PisellSelectionFlow/hooks/useFlowNavigation.js +104 -3
- package/lib/components/PisellSelectionFlow/index.d.ts +1 -1
- package/lib/components/PisellSelectionFlow/types.d.ts +20 -1
- package/lib/components/appVersionControl/types.d.ts +1 -0
- package/lib/components/calendar/index.d.ts +1 -0
- package/lib/components/checkbox/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Radio/WithMode.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Tabs/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Translation/type.d.ts +1 -0
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +1 -0
- package/lib/components/date-picker/index.d.ts +1 -0
- package/lib/components/drag-sort-tree/types.d.ts +1 -0
- package/lib/components/filter/components/FilterButton/types.d.ts +1 -0
- package/lib/components/input/index.d.ts +1 -0
- package/lib/components/pisell-config-provider/context.d.ts +1 -0
- package/lib/components/pisellDatePicker/index.d.ts +1 -0
- package/lib/components/pisellGridPro/ToolBar/type.d.ts +1 -0
- package/lib/components/pisellMenu/types.d.ts +1 -0
- package/lib/components/pisellQuickFilter/type.d.ts +1 -0
- package/lib/components/productCard/cartSkuCard/components/AmountFooter/index.less +1 -1
- package/lib/components/productCard/cartSkuCard/index.js +3 -33
- package/lib/components/productCard/cartSkuCard/index.less +0 -19
- package/lib/components/productCard/lineItem/index.js +11 -42
- package/lib/components/productCard/types.d.ts +1 -4
- package/lib/components/radio/index.d.ts +1 -0
- package/lib/components/section-footers/index.d.ts +1 -0
- package/lib/components/skeleton/index.d.ts +1 -0
- package/lib/components/time-picker/index.d.ts +1 -0
- package/lib/components/upload/index.d.ts +1 -0
- package/lib/components/virtual-keyboard/Amount/types.d.ts +1 -0
- package/lib/index.d.ts +2 -3
- package/package.json +3 -3
- package/es/components/productCard/cartSkuCard/types.d.ts +0 -56
- package/es/components/productCard/cartSkuCard/variants/A12/index.js +0 -126
- package/es/components/productCard/cartSkuCard/variants/A12/index.less +0 -276
- package/lib/components/productCard/cartSkuCard/types.d.ts +0 -56
- package/lib/components/productCard/cartSkuCard/variants/A12/index.js +0 -129
- package/lib/components/productCard/cartSkuCard/variants/A12/index.less +0 -276
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { PisellBasicCardProps } from "./types.js";
|
|
2
3
|
import { ImageDataSource, ImageFillMode, PisellImageCardProps } from "./components/PisellImageCard/types.js";
|
|
3
4
|
import { GraphicConfig, GraphicTextCardProps, GraphicTextCardSize, GraphicTextCardVariant } from "./components/GraphicTextCard/types.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { PisellBasicGridProps } from "../PisellBasicGrid/types.js";
|
|
2
3
|
import { PisellScrollViewProps, PisellScrollViewRef } from "../PisellScrollView/types.js";
|
|
3
4
|
import { FloorMapFullscreenMode, FloorMapItemBase, FloorMapLayoutContextValue, PisellFloorMapLayoutProps, PisellFloorMapLayoutRef } from "../pisellFloorMapLayout/types.js";
|
|
@@ -19,6 +19,7 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
19
19
|
const flowGenerationRef = useRef(0);
|
|
20
20
|
const draftRevisionRef = useRef(0);
|
|
21
21
|
const navigationRevisionRef = useRef(0);
|
|
22
|
+
const preparationRevisionRef = useRef(0);
|
|
22
23
|
const transitionPendingRef = useRef(false);
|
|
23
24
|
const processDraftChangeRef = useRef(() => void 0);
|
|
24
25
|
const onDraftChangeRef = useRef(onDraftChange);
|
|
@@ -82,6 +83,7 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
82
83
|
mountedRef.current = false;
|
|
83
84
|
if (flowGenerationRef.current === generation) flowGenerationRef.current += 1;
|
|
84
85
|
navigationRevisionRef.current += 1;
|
|
86
|
+
preparationRevisionRef.current += 1;
|
|
85
87
|
moduleInitializationRef.current.clear();
|
|
86
88
|
moduleDependencyLifecycleRef.current.clear();
|
|
87
89
|
pendingModuleChangeRef.current.clear();
|
|
@@ -297,7 +299,7 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
297
299
|
draft,
|
|
298
300
|
moduleState
|
|
299
301
|
});
|
|
300
|
-
const { validateCurrentStep, complete, next, back } = useFlowNavigation({
|
|
302
|
+
const { validateCurrentStep, prepareSteps, complete, next, back } = useFlowNavigation({
|
|
301
303
|
registry,
|
|
302
304
|
draftAdapter,
|
|
303
305
|
createRuntimeIssue,
|
|
@@ -313,6 +315,7 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
313
315
|
currentStepKeyRef,
|
|
314
316
|
validatedCompletionRef,
|
|
315
317
|
navigationRevisionRef,
|
|
318
|
+
preparationRevisionRef,
|
|
316
319
|
transitionPendingRef,
|
|
317
320
|
completedRef,
|
|
318
321
|
completionPromiseRef,
|
|
@@ -347,6 +350,7 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
347
350
|
back,
|
|
348
351
|
updateDraft,
|
|
349
352
|
validateCurrentStep,
|
|
353
|
+
prepareSteps,
|
|
350
354
|
complete,
|
|
351
355
|
getState
|
|
352
356
|
}), [
|
|
@@ -354,6 +358,7 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
354
358
|
complete,
|
|
355
359
|
getState,
|
|
356
360
|
next,
|
|
361
|
+
prepareSteps,
|
|
357
362
|
updateDraft,
|
|
358
363
|
validateCurrentStep
|
|
359
364
|
]);
|
|
@@ -377,6 +382,7 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
377
382
|
context: contextValue,
|
|
378
383
|
updateDraft,
|
|
379
384
|
validateCurrentStep,
|
|
385
|
+
prepareSteps,
|
|
380
386
|
complete,
|
|
381
387
|
next,
|
|
382
388
|
back,
|
|
@@ -5,7 +5,7 @@ import { getCompiledStepsFingerprint, getSelectionFlowErrorMessage, normalizeFlo
|
|
|
5
5
|
import { useCallback } 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, transitionPendingRef, completedRef, completionPromiseRef, isCompletingRef, draftRef, onCompleteRef, ensureModuleReady, commitModuleState, getFreshContext, onValidationFailed, setCurrentStepIndex, setCompletionError, setCompletionReason, setIsCompleting }) => {
|
|
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 }) => {
|
|
9
9
|
const validateModule = useCallback(function() {
|
|
10
10
|
var _ref = _asyncToGenerator(function* (module) {
|
|
11
11
|
const adapter = resolveFlowModuleAdapter(registry, module.type);
|
|
@@ -104,6 +104,106 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
104
104
|
for (const module of step.modules) if (!(yield validateModule(module))) return false;
|
|
105
105
|
return true;
|
|
106
106
|
}), [validateModule]);
|
|
107
|
+
const prepareSteps = useCallback(_asyncToGenerator(function* (options = {}) {
|
|
108
|
+
var _options$fromStepInde;
|
|
109
|
+
if (!mountedRef.current || configurationErrorRef.current) return {
|
|
110
|
+
prepared: false,
|
|
111
|
+
cancelled: !mountedRef.current
|
|
112
|
+
};
|
|
113
|
+
const preparationRevision = preparationRevisionRef.current + 1;
|
|
114
|
+
preparationRevisionRef.current = preparationRevision;
|
|
115
|
+
const navigationRevision = navigationRevisionRef.current;
|
|
116
|
+
const flowGeneration = flowGenerationRef.current;
|
|
117
|
+
const compiledFingerprint = getCompiledStepsFingerprint(compiledStepsRef.current);
|
|
118
|
+
const fromStepIndex = Math.max(0, (_options$fromStepInde = options.fromStepIndex) !== null && _options$fromStepInde !== void 0 ? _options$fromStepInde : currentStepIndexRef.current + 1);
|
|
119
|
+
const isCurrentPreparation = () => mountedRef.current && preparationRevisionRef.current === preparationRevision && navigationRevisionRef.current === navigationRevision && flowGenerationRef.current === flowGeneration && getCompiledStepsFingerprint(compiledStepsRef.current) === compiledFingerprint;
|
|
120
|
+
const targetModules = compiledStepsRef.current.filter((step) => step.index >= fromStepIndex).flatMap((step) => step.modules.map((module) => ({
|
|
121
|
+
step,
|
|
122
|
+
module
|
|
123
|
+
})));
|
|
124
|
+
for (let pass = 0; pass <= targetModules.length; pass += 1) {
|
|
125
|
+
for (const { step, module } of targetModules) {
|
|
126
|
+
if (!isCurrentPreparation()) return {
|
|
127
|
+
prepared: false,
|
|
128
|
+
cancelled: true
|
|
129
|
+
};
|
|
130
|
+
const adapter = resolveFlowModuleAdapter(registry, module.type);
|
|
131
|
+
if (!(adapter === null || adapter === void 0 ? void 0 : adapter.validateAutoResolution)) return {
|
|
132
|
+
prepared: false,
|
|
133
|
+
firstUnresolvedStepIndex: step.index,
|
|
134
|
+
moduleKey: module.key
|
|
135
|
+
};
|
|
136
|
+
if (!(yield ensureModuleReady(module))) {
|
|
137
|
+
const state = moduleStateRef.current[module.key];
|
|
138
|
+
return isCurrentPreparation() ? {
|
|
139
|
+
prepared: false,
|
|
140
|
+
firstUnresolvedStepIndex: step.index,
|
|
141
|
+
moduleKey: module.key,
|
|
142
|
+
message: state === null || state === void 0 ? void 0 : state.message
|
|
143
|
+
} : {
|
|
144
|
+
prepared: false,
|
|
145
|
+
cancelled: true
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (!isCurrentPreparation()) return {
|
|
149
|
+
prepared: false,
|
|
150
|
+
cancelled: true
|
|
151
|
+
};
|
|
152
|
+
const validationDraftRevision = draftRevisionRef.current;
|
|
153
|
+
try {
|
|
154
|
+
const context = getFreshContext();
|
|
155
|
+
if (!context) return {
|
|
156
|
+
prepared: false,
|
|
157
|
+
cancelled: true
|
|
158
|
+
};
|
|
159
|
+
const result = normalizeFlowValidationResult(yield adapter.validateAutoResolution(context, module));
|
|
160
|
+
if (!isCurrentPreparation() || draftRevisionRef.current !== validationDraftRevision) return {
|
|
161
|
+
prepared: false,
|
|
162
|
+
cancelled: true
|
|
163
|
+
};
|
|
164
|
+
if (!result.valid) return {
|
|
165
|
+
prepared: false,
|
|
166
|
+
firstUnresolvedStepIndex: step.index,
|
|
167
|
+
moduleKey: module.key,
|
|
168
|
+
message: result.message
|
|
169
|
+
};
|
|
170
|
+
} catch (error) {
|
|
171
|
+
return isCurrentPreparation() ? {
|
|
172
|
+
prepared: false,
|
|
173
|
+
firstUnresolvedStepIndex: step.index,
|
|
174
|
+
moduleKey: module.key,
|
|
175
|
+
message: getSelectionFlowErrorMessage(error)
|
|
176
|
+
} : {
|
|
177
|
+
prepared: false,
|
|
178
|
+
cancelled: true
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (!targetModules.find(({ module }) => {
|
|
183
|
+
var _moduleStateRef$curre;
|
|
184
|
+
return ((_moduleStateRef$curre = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre === void 0 ? void 0 : _moduleStateRef$curre.status) !== "ready";
|
|
185
|
+
})) return isCurrentPreparation() ? { prepared: true } : {
|
|
186
|
+
prepared: false,
|
|
187
|
+
cancelled: true
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
const unresolved = targetModules.find(({ module }) => {
|
|
191
|
+
var _moduleStateRef$curre2;
|
|
192
|
+
return ((_moduleStateRef$curre2 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre2 === void 0 ? void 0 : _moduleStateRef$curre2.status) !== "ready";
|
|
193
|
+
});
|
|
194
|
+
return unresolved ? {
|
|
195
|
+
prepared: false,
|
|
196
|
+
firstUnresolvedStepIndex: unresolved.step.index,
|
|
197
|
+
moduleKey: unresolved.module.key
|
|
198
|
+
} : {
|
|
199
|
+
prepared: false,
|
|
200
|
+
cancelled: true
|
|
201
|
+
};
|
|
202
|
+
}), [
|
|
203
|
+
ensureModuleReady,
|
|
204
|
+
getFreshContext,
|
|
205
|
+
registry
|
|
206
|
+
]);
|
|
107
207
|
const runBeforeLeaveForCurrentStep = useCallback(_asyncToGenerator(function* () {
|
|
108
208
|
if (configurationErrorRef.current) return false;
|
|
109
209
|
const stepIndex = currentStepIndexRef.current;
|
|
@@ -188,8 +288,8 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
188
288
|
const latestRevisionFingerprint = latestSteps.flatMap((step) => step.modules).map((module) => `${module.key}:${moduleRevisionRef.current.get(module.key) || 0}`).join("|");
|
|
189
289
|
if (compiledFingerprint !== latestCompiledFingerprint || revisionFingerprint !== latestRevisionFingerprint || draftRevision !== draftRevisionRef.current) {
|
|
190
290
|
const targetStep = latestSteps.find((step) => step.modules.some((module) => {
|
|
191
|
-
var _moduleStateRef$
|
|
192
|
-
return ((_moduleStateRef$
|
|
291
|
+
var _moduleStateRef$curre3;
|
|
292
|
+
return ((_moduleStateRef$curre3 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre3 === void 0 ? void 0 : _moduleStateRef$curre3.status) !== "ready";
|
|
193
293
|
})) || latestSteps[0];
|
|
194
294
|
const targetModule = targetStep === null || targetStep === void 0 ? void 0 : targetStep.modules[0];
|
|
195
295
|
if (targetStep && targetModule) {
|
|
@@ -274,6 +374,7 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
274
374
|
]);
|
|
275
375
|
return {
|
|
276
376
|
validateCurrentStep,
|
|
377
|
+
prepareSteps,
|
|
277
378
|
runBeforeLeaveForCurrentStep,
|
|
278
379
|
complete,
|
|
279
380
|
next: useCallback(_asyncToGenerator(function* () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompiledSelectionFlowModuleConfig, CompiledSelectionFlowStep, FlowModuleBeforeLeaveResult, FlowModuleBeforeLeaveReturn, FlowModuleDataMap, FlowModuleHandle, FlowModuleState, FlowModuleStateMap, FlowModuleStatus, FlowModuleValidationResult, FlowModuleValidationReturn, PisellSelectionFlowController, PisellSelectionFlowProps, SelectionFlowCompileError, SelectionFlowCompileIssue, SelectionFlowCompileIssueCode, SelectionFlowContextValue, SelectionFlowDraftAdapter, SelectionFlowDraftChange, SelectionFlowDraftUpdateMeta, SelectionFlowMessageCode, SelectionFlowMetadata, SelectionFlowModuleAdapter, SelectionFlowModuleConfig, SelectionFlowModuleInput, SelectionFlowModuleRegistry, SelectionFlowRef, SelectionFlowRuntimeIssue, SelectionFlowSnapshot, SelectionFlowStepConfig, SelectionFlowValidationFeedback } from "./types.js";
|
|
1
|
+
import { CompiledSelectionFlowModuleConfig, CompiledSelectionFlowStep, FlowModuleBeforeLeaveResult, FlowModuleBeforeLeaveReturn, FlowModuleDataMap, FlowModuleHandle, FlowModuleState, FlowModuleStateMap, FlowModuleStatus, FlowModuleValidationResult, FlowModuleValidationReturn, PisellSelectionFlowController, PisellSelectionFlowProps, SelectionFlowCompileError, SelectionFlowCompileIssue, SelectionFlowCompileIssueCode, SelectionFlowContextValue, SelectionFlowDraftAdapter, SelectionFlowDraftChange, SelectionFlowDraftUpdateMeta, SelectionFlowMessageCode, SelectionFlowMetadata, SelectionFlowModuleAdapter, SelectionFlowModuleConfig, SelectionFlowModuleInput, SelectionFlowModuleRegistry, SelectionFlowPrepareStepsOptions, SelectionFlowPrepareStepsResult, SelectionFlowRef, SelectionFlowRuntimeIssue, SelectionFlowSnapshot, SelectionFlowStepConfig, SelectionFlowValidationFeedback } from "./types.js";
|
|
2
2
|
import { _default } from "./PisellSelectionFlow.js";
|
|
3
3
|
import { useSelectionFlowContext, useTypedSelectionFlowContext } from "./context.js";
|
|
4
4
|
import { compileSelectionFlow, compileSelectionFlowSteps, hasSelectionDraftFieldValue, isSelectionModuleType, resolveFlowModuleAdapter } from "./compiler.js";
|
|
@@ -57,6 +57,18 @@ type FlowModuleValidationResult = boolean | {
|
|
|
57
57
|
message?: string;
|
|
58
58
|
};
|
|
59
59
|
type FlowModuleValidationReturn = FlowModuleValidationResult | Promise<FlowModuleValidationResult>;
|
|
60
|
+
interface SelectionFlowPrepareStepsOptions {
|
|
61
|
+
/** 从哪个已编译步骤开始准备;默认从当前步骤的下一步开始。 */
|
|
62
|
+
fromStepIndex?: number;
|
|
63
|
+
}
|
|
64
|
+
interface SelectionFlowPrepareStepsResult {
|
|
65
|
+
prepared: boolean;
|
|
66
|
+
/** 新一轮准备、导航、重新编译或卸载使本轮结果失效。 */
|
|
67
|
+
cancelled?: boolean;
|
|
68
|
+
firstUnresolvedStepIndex?: number;
|
|
69
|
+
moduleKey?: string;
|
|
70
|
+
message?: string;
|
|
71
|
+
}
|
|
60
72
|
type FlowModuleBeforeLeaveResult = boolean | {
|
|
61
73
|
allowed: boolean;
|
|
62
74
|
message?: string;
|
|
@@ -98,6 +110,11 @@ interface SelectionFlowModuleAdapter<TDraft, TDraftUpdate, TField extends string
|
|
|
98
110
|
reconcile?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, change: SelectionFlowDraftChange<TDraft, TField, TModuleType>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => void | Promise<void>;
|
|
99
111
|
clearDependencies?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, change: SelectionFlowDraftChange<TDraft, TField, TModuleType>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => void | Promise<void>;
|
|
100
112
|
validate?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, handle: FlowModuleHandle | null, module: CompiledSelectionFlowModuleConfig<TModuleType>) => FlowModuleValidationReturn;
|
|
113
|
+
/**
|
|
114
|
+
* 模块完成 refresh 后,判断当前值能否在无界面的情况下安全采用。
|
|
115
|
+
* 不提供即表示该模块必须由用户进入步骤确认。
|
|
116
|
+
*/
|
|
117
|
+
validateAutoResolution?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => FlowModuleValidationReturn;
|
|
101
118
|
beforeLeave?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, handle: FlowModuleHandle | null, module: CompiledSelectionFlowModuleConfig<TModuleType>) => FlowModuleBeforeLeaveReturn;
|
|
102
119
|
}
|
|
103
120
|
type SelectionFlowModuleRegistry<TDraft, TDraftUpdate, TField extends string, TModuleType extends string, TServices = unknown, THostContext = unknown> = Record<TModuleType, SelectionFlowModuleAdapter<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>>;
|
|
@@ -117,6 +134,7 @@ interface SelectionFlowRef<TDraft, TDraftUpdate, TField extends string = string,
|
|
|
117
134
|
back: () => boolean;
|
|
118
135
|
updateDraft: (update: TDraftUpdate, meta: SelectionFlowDraftUpdateMeta<TField, TModuleType>) => void;
|
|
119
136
|
validateCurrentStep: () => Promise<boolean>;
|
|
137
|
+
prepareSteps: (options?: SelectionFlowPrepareStepsOptions) => Promise<SelectionFlowPrepareStepsResult>;
|
|
120
138
|
complete: () => Promise<boolean>;
|
|
121
139
|
getState: () => SelectionFlowSnapshot<TDraft, TModuleType>;
|
|
122
140
|
}
|
|
@@ -139,6 +157,7 @@ interface PisellSelectionFlowController<TDraft, TDraftUpdate, TField extends str
|
|
|
139
157
|
completionReason?: SelectionFlowRuntimeIssue;
|
|
140
158
|
updateDraft: (update: TDraftUpdate, meta: SelectionFlowDraftUpdateMeta<TField, TModuleType>) => void;
|
|
141
159
|
validateCurrentStep: () => Promise<boolean>;
|
|
160
|
+
prepareSteps: (options?: SelectionFlowPrepareStepsOptions) => Promise<SelectionFlowPrepareStepsResult>;
|
|
142
161
|
complete: () => Promise<boolean>;
|
|
143
162
|
next: () => Promise<boolean>;
|
|
144
163
|
back: () => boolean;
|
|
@@ -176,4 +195,4 @@ declare class SelectionFlowCompileError extends Error {
|
|
|
176
195
|
constructor(issues: readonly SelectionFlowCompileIssue[]);
|
|
177
196
|
}
|
|
178
197
|
//#endregion
|
|
179
|
-
export { CompiledSelectionFlowModuleConfig, CompiledSelectionFlowStep, FlowModuleBeforeLeaveResult, FlowModuleBeforeLeaveReturn, FlowModuleDataMap, FlowModuleHandle, FlowModuleState, FlowModuleStateMap, FlowModuleStatus, FlowModuleValidationResult, FlowModuleValidationReturn, PisellSelectionFlowController, PisellSelectionFlowProps, SelectionFlowCompileError, SelectionFlowCompileIssue, SelectionFlowCompileIssueCode, SelectionFlowContextValue, SelectionFlowDraftAdapter, SelectionFlowDraftChange, SelectionFlowDraftUpdateMeta, SelectionFlowMessageCode, SelectionFlowMetadata, SelectionFlowModuleAdapter, SelectionFlowModuleConfig, SelectionFlowModuleInput, SelectionFlowModuleRegistry, SelectionFlowRef, SelectionFlowRuntimeIssue, SelectionFlowSnapshot, SelectionFlowStepConfig, SelectionFlowValidationFeedback };
|
|
198
|
+
export { CompiledSelectionFlowModuleConfig, CompiledSelectionFlowStep, FlowModuleBeforeLeaveResult, FlowModuleBeforeLeaveReturn, FlowModuleDataMap, FlowModuleHandle, FlowModuleState, FlowModuleStateMap, FlowModuleStatus, FlowModuleValidationResult, FlowModuleValidationReturn, PisellSelectionFlowController, PisellSelectionFlowProps, SelectionFlowCompileError, SelectionFlowCompileIssue, SelectionFlowCompileIssueCode, SelectionFlowContextValue, SelectionFlowDraftAdapter, SelectionFlowDraftChange, SelectionFlowDraftUpdateMeta, SelectionFlowMessageCode, SelectionFlowMetadata, SelectionFlowModuleAdapter, SelectionFlowModuleConfig, SelectionFlowModuleInput, SelectionFlowModuleRegistry, SelectionFlowPrepareStepsOptions, SelectionFlowPrepareStepsResult, SelectionFlowRef, SelectionFlowRuntimeIssue, SelectionFlowSnapshot, SelectionFlowStepConfig, SelectionFlowValidationFeedback };
|
|
@@ -19,7 +19,6 @@ import Promotion from "./components/Promotion/index.js";
|
|
|
19
19
|
import Gift from "./components/Gift/index.js";
|
|
20
20
|
import BookingItem from "./components/BookingItem/index.js";
|
|
21
21
|
import InlineActions from "./components/inlineActions/index.js";
|
|
22
|
-
import A12 from "./variants/A12/index.js";
|
|
23
22
|
import React, { useMemo, useRef } from "react";
|
|
24
23
|
import { locales } from "@pisell/utils";
|
|
25
24
|
import classNames from "classnames";
|
|
@@ -57,14 +56,12 @@ const _excluded = [
|
|
|
57
56
|
"rightActionsDisplay",
|
|
58
57
|
"escapeDom",
|
|
59
58
|
"maxSpecsCount",
|
|
60
|
-
"isShowRelatedProduct"
|
|
61
|
-
"a12Slots",
|
|
62
|
-
"a12Presentation"
|
|
59
|
+
"isShowRelatedProduct"
|
|
63
60
|
];
|
|
64
61
|
const PREFIX = "pisell-cart-sku-card";
|
|
65
62
|
const CartSkuCard = (props) => {
|
|
66
63
|
var _context$appHelper$ut;
|
|
67
|
-
const { dataSource = defaultValue.dataSource, isShowImage = defaultValue.isShowImage, isShowQuantityBadge = true, isShowOriginalPrice = defaultValue.isShowOriginalPrice, isShowHolder = defaultValue.isShowHolder, isShowNote = defaultValue.isShowNote, isShowDelete = defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowAmountFooter = defaultValue.isShowAmountFooter, isShowPackageNote = defaultValue.isShowPackageNote, isShowEditProduct = defaultValue.isShowEditProduct, disabledClick = defaultValue.disabledClick, disabledEditClick = defaultValue.disabledEditClick, disabledNoteEdit, externalNoteEditor = false, onEditProduct, onAction, onDelete, onNote, onLike, onCard, onChangeResource, onPromotion, onGift, onChangeHolder, itemType = "product", type, rightActions = [], rightActionsDisplay = "swipe", escapeDom, maxSpecsCount = 1, isShowRelatedProduct = true
|
|
64
|
+
const { dataSource = defaultValue.dataSource, isShowImage = defaultValue.isShowImage, isShowQuantityBadge = true, isShowOriginalPrice = defaultValue.isShowOriginalPrice, isShowHolder = defaultValue.isShowHolder, isShowNote = defaultValue.isShowNote, isShowDelete = defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowAmountFooter = defaultValue.isShowAmountFooter, isShowPackageNote = defaultValue.isShowPackageNote, isShowEditProduct = defaultValue.isShowEditProduct, disabledClick = defaultValue.disabledClick, disabledEditClick = defaultValue.disabledEditClick, disabledNoteEdit, externalNoteEditor = false, onEditProduct, onAction, onDelete, onNote, onLike, onCard, onChangeResource, onPromotion, onGift, onChangeHolder, itemType = "product", type, rightActions = [], rightActionsDisplay = "swipe", escapeDom, maxSpecsCount = 1, isShowRelatedProduct = true } = props, other = _objectWithoutProperties(props, _excluded);
|
|
68
65
|
const useOpenNoteRef = useRef();
|
|
69
66
|
const context = useEngineContext();
|
|
70
67
|
locales.init(locales_default, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut = _context$appHelper$ut.storage) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.get("umi_locale")) || "en");
|
|
@@ -222,37 +219,13 @@ const CartSkuCard = (props) => {
|
|
|
222
219
|
openNote: openNoteEditor
|
|
223
220
|
})) : null);
|
|
224
221
|
};
|
|
225
|
-
const renderA12 = () => {
|
|
226
|
-
var _a12Slots$contentFoot;
|
|
227
|
-
const note = isShowNote ? /* @__PURE__ */ React.createElement(Note, _objectSpread2(_objectSpread2({}, other), {}, {
|
|
228
|
-
item: dataSource,
|
|
229
|
-
disabledEdit: disabledNoteEdit !== null && disabledNoteEdit !== void 0 ? disabledNoteEdit : other.disabledEdit,
|
|
230
|
-
openNote: openNoteEditor
|
|
231
|
-
})) : null;
|
|
232
|
-
const slots = note ? _objectSpread2(_objectSpread2({}, a12Slots), {}, { contentFooter: (_a12Slots$contentFoot = a12Slots === null || a12Slots === void 0 ? void 0 : a12Slots.contentFooter) !== null && _a12Slots$contentFoot !== void 0 ? _a12Slots$contentFoot : (() => note) }) : a12Slots;
|
|
233
|
-
return /* @__PURE__ */ React.createElement(A12, {
|
|
234
|
-
dataSource,
|
|
235
|
-
isShowImage,
|
|
236
|
-
isShowDelete,
|
|
237
|
-
isShowOriginalPrice,
|
|
238
|
-
isShowEditProduct,
|
|
239
|
-
disabled: Boolean(disabledClick),
|
|
240
|
-
disabledEditClick,
|
|
241
|
-
slots,
|
|
242
|
-
presentation: a12Presentation,
|
|
243
|
-
onDelete,
|
|
244
|
-
onEditProduct
|
|
245
|
-
});
|
|
246
|
-
};
|
|
247
222
|
const renderContent = () => {
|
|
248
|
-
if (type === "a12") return renderA12();
|
|
249
223
|
if (type === "a9") return renderA9();
|
|
250
224
|
if (type === "a5") return renderA5();
|
|
251
225
|
return renderA2();
|
|
252
226
|
};
|
|
253
227
|
if (dataSource === null || dataSource === void 0 ? void 0 : dataSource.isGift) return null;
|
|
254
228
|
const content = renderContent();
|
|
255
|
-
const useIntegratedWrapper = type === "a12" || rightActionsDisplay === "inline";
|
|
256
229
|
const cardContent = /* @__PURE__ */ React.createElement("div", {
|
|
257
230
|
className: classNames(PREFIX, `${PREFIX}--${type}`),
|
|
258
231
|
onClick: (e) => {
|
|
@@ -266,10 +239,7 @@ const CartSkuCard = (props) => {
|
|
|
266
239
|
isShowRelatedProduct,
|
|
267
240
|
isShowDelete
|
|
268
241
|
}, content) : content);
|
|
269
|
-
return /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper-container`, {
|
|
270
|
-
[`${PREFIX}-wrapper-container--inline`]: useIntegratedWrapper,
|
|
271
|
-
[`${PREFIX}-wrapper-container--a12`]: type === "a12"
|
|
272
|
-
}) }, useIntegratedWrapper ? /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper`, `${PREFIX}-wrapper--inline`, type === "a12" && `pisell-cart-sku-card-wrapper--a12`) }, cardContent) : /* @__PURE__ */ React.createElement(SwipeAction, {
|
|
242
|
+
return /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper-container`, { [`${PREFIX}-wrapper-container--inline`]: rightActionsDisplay === "inline" }) }, rightActionsDisplay === "inline" ? /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper`, `${PREFIX}-wrapper--inline`) }, cardContent) : /* @__PURE__ */ React.createElement(SwipeAction, {
|
|
273
243
|
closeOnAction: false,
|
|
274
244
|
className: classNames(`${PREFIX}-wrapper`),
|
|
275
245
|
rightActions: _rightActions,
|
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
width: 100%;
|
|
4
4
|
min-width: 0;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
&--a12 {
|
|
8
|
-
container-type: inline-size;
|
|
9
|
-
}
|
|
10
6
|
}
|
|
11
7
|
|
|
12
8
|
.pisell-cart-sku-card-wrapper {
|
|
@@ -19,14 +15,6 @@
|
|
|
19
15
|
width: 100%;
|
|
20
16
|
overflow: hidden;
|
|
21
17
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
&--a12 {
|
|
25
|
-
border: 0;
|
|
26
|
-
border-radius: 18px;
|
|
27
|
-
background: transparent;
|
|
28
|
-
overflow: visible;
|
|
29
|
-
}
|
|
30
18
|
}
|
|
31
19
|
|
|
32
20
|
.pisell-cart-sku-card__main-row {
|
|
@@ -50,7 +38,6 @@
|
|
|
50
38
|
);
|
|
51
39
|
// 称重卡片的辅助信息保持易读,但不与毛重/净重争夺视觉层级。
|
|
52
40
|
--pisell-cart-sku-card-weighing-meta-font-size: 18px;
|
|
53
|
-
--pisell-cart-sku-card-weighing-summary-font-size: 18px;
|
|
54
41
|
|
|
55
42
|
padding: 4px 8px 4px 4px;
|
|
56
43
|
border-radius: inherit;
|
|
@@ -64,12 +51,6 @@
|
|
|
64
51
|
cursor: pointer;
|
|
65
52
|
}
|
|
66
53
|
|
|
67
|
-
&--a12 {
|
|
68
|
-
display: block;
|
|
69
|
-
padding: 0;
|
|
70
|
-
gap: 0;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
54
|
&__delete-btn {
|
|
74
55
|
cursor: pointer;
|
|
75
56
|
position: absolute;
|