@pisell/materials 6.11.275 → 6.11.277
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 +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- 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 +43 -30
- package/es/components/PisellSelectionFlow/hooks/useFlowNavigation.js +2 -1
- package/es/components/PisellSelectionFlow/types.d.ts +2 -0
- 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/pisellModal/components/PcModal/index.less +31 -1
- package/es/components/pisellQuickFilter/type.d.ts +1 -0
- 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/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 +43 -30
- package/lib/components/PisellSelectionFlow/hooks/useFlowNavigation.js +2 -1
- package/lib/components/PisellSelectionFlow/types.d.ts +2 -0
- 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/pisellModal/components/PcModal/index.less +31 -1
- package/lib/components/pisellQuickFilter/type.d.ts +1 -0
- 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/package.json +1 -1
|
@@ -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";
|
|
@@ -15,7 +15,7 @@ const createUnexpectedCompileError = (error) => {
|
|
|
15
15
|
message: `Selection flow compilation failed: ${getSelectionFlowErrorMessage(error)}`
|
|
16
16
|
}]);
|
|
17
17
|
};
|
|
18
|
-
const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialStepIndex = 0, preparePresentation = false, onPresentationReady, hostContext, services, children, onDraftChange, onStepChange, onCompiledStepsChange, onValidationFailed, onConfigurationError, onComplete }, ref) => {
|
|
18
|
+
const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialStepIndex = 0, preparePresentation = false, resolveInitialStepIndex, onPresentationReady, hostContext, services, children, onDraftChange, onStepChange, onCompiledStepsChange, onValidationFailed, onConfigurationError, onComplete }, ref) => {
|
|
19
19
|
const mountedRef = useRef(true);
|
|
20
20
|
const flowGenerationRef = useRef(1);
|
|
21
21
|
const draftRevisionRef = useRef(0);
|
|
@@ -29,6 +29,8 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
29
29
|
const presentationTaskRef = useRef(null);
|
|
30
30
|
const onPresentationReadyRef = useRef(onPresentationReady);
|
|
31
31
|
onPresentationReadyRef.current = onPresentationReady;
|
|
32
|
+
const resolveInitialStepIndexRef = useRef(resolveInitialStepIndex);
|
|
33
|
+
resolveInitialStepIndexRef.current = resolveInitialStepIndex;
|
|
32
34
|
const processDraftChangeRef = useRef(() => void 0);
|
|
33
35
|
const onDraftChangeRef = useRef(onDraftChange);
|
|
34
36
|
onDraftChangeRef.current = onDraftChange;
|
|
@@ -357,13 +359,38 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
357
359
|
setCompletionReason,
|
|
358
360
|
setIsCompleting
|
|
359
361
|
});
|
|
362
|
+
const autoAdvanceAttemptRef = useRef();
|
|
363
|
+
useEffect(() => {
|
|
364
|
+
if (configurationError || completedRef.current || transitionPendingRef.current || preparePresentation && !presentationReadyRef.current || !currentStep || !isStepSkippable(resolvedCurrentStepIndex)) return;
|
|
365
|
+
if (currentStep.modules.every((module) => automaticModuleKeysRef.current.includes(module.key))) return;
|
|
366
|
+
const direction = navigationDirectionRef.current;
|
|
367
|
+
const key = `${direction}:${currentStep.key}:${draftRevisionRef.current}:${currentStep.modules.map((module) => `${module.key}:${moduleRevisionRef.current.get(module.key) || 0}`).join("|")}`;
|
|
368
|
+
if (autoAdvanceAttemptRef.current === key) return;
|
|
369
|
+
autoAdvanceAttemptRef.current = key;
|
|
370
|
+
if (direction === "backward") back();
|
|
371
|
+
else next();
|
|
372
|
+
}, [
|
|
373
|
+
configurationError,
|
|
374
|
+
currentStep,
|
|
375
|
+
resolvedCurrentStepIndex,
|
|
376
|
+
moduleState,
|
|
377
|
+
moduleData,
|
|
378
|
+
draft,
|
|
379
|
+
isStepSkippable,
|
|
380
|
+
navigationDirectionRef,
|
|
381
|
+
back,
|
|
382
|
+
next,
|
|
383
|
+
preparePresentation,
|
|
384
|
+
presentationReady,
|
|
385
|
+
automaticModuleKeys
|
|
386
|
+
]);
|
|
360
387
|
useEffect(() => {
|
|
361
388
|
if (!preparePresentation || presentationReadyRef.current || configurationError || presentationTaskRef.current) return;
|
|
362
389
|
const generation = flowGenerationRef.current;
|
|
363
390
|
const isCurrent = () => mountedRef.current && flowGenerationRef.current === generation;
|
|
364
391
|
const task = _asyncToGenerator(function* () {
|
|
365
|
-
var
|
|
366
|
-
const modules = compiledStepsRef.current.
|
|
392
|
+
var _visibleSteps$0$index, _visibleSteps$, _compiledStepsRef$cur, _onPresentationReadyR2;
|
|
393
|
+
const modules = compiledStepsRef.current.reduce((allModules, step) => allModules.concat(step.modules), []);
|
|
367
394
|
for (let pass = 0; pass <= modules.length; pass += 1) {
|
|
368
395
|
for (const module of modules) {
|
|
369
396
|
if (!isCurrent()) return;
|
|
@@ -394,16 +421,26 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
394
421
|
}).map((module) => module.key);
|
|
395
422
|
automaticModuleKeysRef.current = automatic;
|
|
396
423
|
setAutomaticModuleKeys(automatic);
|
|
397
|
-
const
|
|
398
|
-
|
|
424
|
+
const visibleSteps = compiledStepsRef.current.filter((step) => step.modules.some((module) => !automatic.includes(module.key)));
|
|
425
|
+
let initialIndex = (_visibleSteps$0$index = (_visibleSteps$ = visibleSteps[0]) === null || _visibleSteps$ === void 0 ? void 0 : _visibleSteps$.index) !== null && _visibleSteps$0$index !== void 0 ? _visibleSteps$0$index : Math.max(0, compiledStepsRef.current.length - 1);
|
|
426
|
+
try {
|
|
427
|
+
var _resolveInitialStepIn;
|
|
428
|
+
const context = getFreshContext();
|
|
429
|
+
const requestedIndex = context && ((_resolveInitialStepIn = resolveInitialStepIndexRef.current) === null || _resolveInitialStepIn === void 0 ? void 0 : _resolveInitialStepIn.call(resolveInitialStepIndexRef, context));
|
|
430
|
+
const requestedStep = visibleSteps.find((step) => step.index === requestedIndex);
|
|
431
|
+
if (requestedStep) initialIndex = requestedStep.index;
|
|
432
|
+
} catch (_unused2) {}
|
|
399
433
|
currentStepIndexRef.current = initialIndex;
|
|
400
434
|
currentStepKeyRef.current = (_compiledStepsRef$cur = compiledStepsRef.current[initialIndex]) === null || _compiledStepsRef$cur === void 0 ? void 0 : _compiledStepsRef$cur.key;
|
|
401
435
|
setCurrentStepIndex(initialIndex);
|
|
402
436
|
presentationReadyRef.current = true;
|
|
403
437
|
setPresentationReady(true);
|
|
404
438
|
(_onPresentationReadyR2 = onPresentationReadyRef.current) === null || _onPresentationReadyR2 === void 0 || _onPresentationReadyR2.call(onPresentationReadyRef, automatic);
|
|
405
|
-
})().
|
|
439
|
+
})().then(() => {
|
|
440
|
+
if (presentationTaskRef.current === task) presentationTaskRef.current = null;
|
|
441
|
+
}, (error) => {
|
|
406
442
|
if (presentationTaskRef.current === task) presentationTaskRef.current = null;
|
|
443
|
+
throw error;
|
|
407
444
|
});
|
|
408
445
|
presentationTaskRef.current = task;
|
|
409
446
|
}, [
|
|
@@ -414,30 +451,6 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
414
451
|
preparePresentation,
|
|
415
452
|
registry
|
|
416
453
|
]);
|
|
417
|
-
const autoAdvanceAttemptRef = useRef();
|
|
418
|
-
useEffect(() => {
|
|
419
|
-
if (!presentationReady || configurationError || completedRef.current || transitionPendingRef.current || !currentStep || !isStepSkippable(resolvedCurrentStepIndex)) return;
|
|
420
|
-
if (currentStep.modules.every((module) => automaticModuleKeysRef.current.includes(module.key))) return;
|
|
421
|
-
const direction = navigationDirectionRef.current;
|
|
422
|
-
const key = `${direction}:${currentStep.key}:${draftRevisionRef.current}:${currentStep.modules.map((module) => `${module.key}:${moduleRevisionRef.current.get(module.key) || 0}`).join("|")}`;
|
|
423
|
-
if (autoAdvanceAttemptRef.current === key) return;
|
|
424
|
-
autoAdvanceAttemptRef.current = key;
|
|
425
|
-
if (direction === "backward") back();
|
|
426
|
-
else next();
|
|
427
|
-
}, [
|
|
428
|
-
presentationReady,
|
|
429
|
-
automaticModuleKeys,
|
|
430
|
-
configurationError,
|
|
431
|
-
currentStep,
|
|
432
|
-
resolvedCurrentStepIndex,
|
|
433
|
-
moduleState,
|
|
434
|
-
moduleData,
|
|
435
|
-
draft,
|
|
436
|
-
isStepSkippable,
|
|
437
|
-
navigationDirectionRef,
|
|
438
|
-
back,
|
|
439
|
-
next
|
|
440
|
-
]);
|
|
441
454
|
const getState = useCallback(() => {
|
|
442
455
|
const stepIndex = currentStepIndexRef.current;
|
|
443
456
|
return {
|
|
@@ -366,7 +366,8 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
366
366
|
const preparationGeneration = flowGenerationRef.current;
|
|
367
367
|
const preparationNavigation = navigationRevisionRef.current;
|
|
368
368
|
const isCurrentPreparation = () => mountedRef.current && !configurationErrorRef.current && flowGenerationRef.current === preparationGeneration && navigationRevisionRef.current === preparationNavigation && currentStepIndexRef.current === currentIndex && getCompiledStepsFingerprint(compiledStepsRef.current) === preparationFingerprint;
|
|
369
|
-
const automaticModules =
|
|
369
|
+
const automaticModules = [];
|
|
370
|
+
for (const step of allSteps) for (const module of step.modules) if (automaticModuleKeysRef.current.includes(module.key)) automaticModules.push(module);
|
|
370
371
|
for (let pass = 0; pass <= automaticModules.length; pass += 1) {
|
|
371
372
|
for (const module of automaticModules) {
|
|
372
373
|
var _moduleStateRef$curre4;
|
|
@@ -188,6 +188,8 @@ interface PisellSelectionFlowProps<TDraft, TDraftUpdate, TField extends string,
|
|
|
188
188
|
initialStepIndex?: number;
|
|
189
189
|
/** Resolve a stable presentation before mounting interactive module components. */
|
|
190
190
|
preparePresentation?: boolean;
|
|
191
|
+
/** Choose the entry step from prepared defaults without hiding earlier steps. */
|
|
192
|
+
resolveInitialStepIndex?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>) => number | undefined;
|
|
191
193
|
onPresentationReady?: (automaticModuleKeys: readonly string[]) => void;
|
|
192
194
|
hostContext?: THostContext;
|
|
193
195
|
services: TServices;
|
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
.pisell-lowcode-modal-root {
|
|
2
2
|
.pisell-pc-modal {
|
|
3
3
|
overflow: hidden;
|
|
4
|
+
&:not(.pisell-mobile-modal) {
|
|
5
|
+
> .pisell-lowcode-modal {
|
|
6
|
+
// body 缩放后按实际容器限制宽度,避免居中弹窗换行到屏幕外。
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
}
|
|
9
|
+
&.pisell-lowcode-modal-centered {
|
|
10
|
+
> .pisell-lowcode-modal {
|
|
11
|
+
// 使用缩放后 wrap 的高度;inline-flex 保留原有居中和遮罩点击区域。
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
min-height: min(260px, 90%);
|
|
15
|
+
max-height: 90%;
|
|
16
|
+
|
|
17
|
+
> .pisell-lowcode-modal-content {
|
|
18
|
+
flex: 1 1 auto;
|
|
19
|
+
min-height: 0;
|
|
20
|
+
max-height: none;
|
|
21
|
+
|
|
22
|
+
> .pisell-lowcode-modal-header,
|
|
23
|
+
> .pisell-lowcode-modal-footer {
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
> .pisell-lowcode-modal-body {
|
|
28
|
+
min-height: 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
4
34
|
.pisell-lowcode-modal-content {
|
|
5
35
|
padding: 0 !important;
|
|
6
36
|
display: flex;
|
|
@@ -102,4 +132,4 @@
|
|
|
102
132
|
}
|
|
103
133
|
.pisell-move-down-leave {
|
|
104
134
|
animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);
|
|
105
|
-
}
|
|
135
|
+
}
|
|
@@ -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";
|
|
@@ -17,7 +17,7 @@ const createUnexpectedCompileError = (error) => {
|
|
|
17
17
|
message: `Selection flow compilation failed: ${require_utils.getSelectionFlowErrorMessage(error)}`
|
|
18
18
|
}]);
|
|
19
19
|
};
|
|
20
|
-
const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialStepIndex = 0, preparePresentation = false, onPresentationReady, hostContext, services, children, onDraftChange, onStepChange, onCompiledStepsChange, onValidationFailed, onConfigurationError, onComplete }, ref) => {
|
|
20
|
+
const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialStepIndex = 0, preparePresentation = false, resolveInitialStepIndex, onPresentationReady, hostContext, services, children, onDraftChange, onStepChange, onCompiledStepsChange, onValidationFailed, onConfigurationError, onComplete }, ref) => {
|
|
21
21
|
const mountedRef = (0, react.useRef)(true);
|
|
22
22
|
const flowGenerationRef = (0, react.useRef)(1);
|
|
23
23
|
const draftRevisionRef = (0, react.useRef)(0);
|
|
@@ -31,6 +31,8 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
31
31
|
const presentationTaskRef = (0, react.useRef)(null);
|
|
32
32
|
const onPresentationReadyRef = (0, react.useRef)(onPresentationReady);
|
|
33
33
|
onPresentationReadyRef.current = onPresentationReady;
|
|
34
|
+
const resolveInitialStepIndexRef = (0, react.useRef)(resolveInitialStepIndex);
|
|
35
|
+
resolveInitialStepIndexRef.current = resolveInitialStepIndex;
|
|
34
36
|
const processDraftChangeRef = (0, react.useRef)(() => void 0);
|
|
35
37
|
const onDraftChangeRef = (0, react.useRef)(onDraftChange);
|
|
36
38
|
onDraftChangeRef.current = onDraftChange;
|
|
@@ -359,13 +361,38 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
359
361
|
setCompletionReason,
|
|
360
362
|
setIsCompleting
|
|
361
363
|
});
|
|
364
|
+
const autoAdvanceAttemptRef = (0, react.useRef)();
|
|
365
|
+
(0, react.useEffect)(() => {
|
|
366
|
+
if (configurationError || completedRef.current || transitionPendingRef.current || preparePresentation && !presentationReadyRef.current || !currentStep || !isStepSkippable(resolvedCurrentStepIndex)) return;
|
|
367
|
+
if (currentStep.modules.every((module) => automaticModuleKeysRef.current.includes(module.key))) return;
|
|
368
|
+
const direction = navigationDirectionRef.current;
|
|
369
|
+
const key = `${direction}:${currentStep.key}:${draftRevisionRef.current}:${currentStep.modules.map((module) => `${module.key}:${moduleRevisionRef.current.get(module.key) || 0}`).join("|")}`;
|
|
370
|
+
if (autoAdvanceAttemptRef.current === key) return;
|
|
371
|
+
autoAdvanceAttemptRef.current = key;
|
|
372
|
+
if (direction === "backward") back();
|
|
373
|
+
else next();
|
|
374
|
+
}, [
|
|
375
|
+
configurationError,
|
|
376
|
+
currentStep,
|
|
377
|
+
resolvedCurrentStepIndex,
|
|
378
|
+
moduleState,
|
|
379
|
+
moduleData,
|
|
380
|
+
draft,
|
|
381
|
+
isStepSkippable,
|
|
382
|
+
navigationDirectionRef,
|
|
383
|
+
back,
|
|
384
|
+
next,
|
|
385
|
+
preparePresentation,
|
|
386
|
+
presentationReady,
|
|
387
|
+
automaticModuleKeys
|
|
388
|
+
]);
|
|
362
389
|
(0, react.useEffect)(() => {
|
|
363
390
|
if (!preparePresentation || presentationReadyRef.current || configurationError || presentationTaskRef.current) return;
|
|
364
391
|
const generation = flowGenerationRef.current;
|
|
365
392
|
const isCurrent = () => mountedRef.current && flowGenerationRef.current === generation;
|
|
366
393
|
const task = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
367
|
-
var
|
|
368
|
-
const modules = compiledStepsRef.current.
|
|
394
|
+
var _visibleSteps$0$index, _visibleSteps$, _compiledStepsRef$cur, _onPresentationReadyR2;
|
|
395
|
+
const modules = compiledStepsRef.current.reduce((allModules, step) => allModules.concat(step.modules), []);
|
|
369
396
|
for (let pass = 0; pass <= modules.length; pass += 1) {
|
|
370
397
|
for (const module of modules) {
|
|
371
398
|
if (!isCurrent()) return;
|
|
@@ -396,16 +423,26 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
396
423
|
}).map((module) => module.key);
|
|
397
424
|
automaticModuleKeysRef.current = automatic;
|
|
398
425
|
setAutomaticModuleKeys(automatic);
|
|
399
|
-
const
|
|
400
|
-
|
|
426
|
+
const visibleSteps = compiledStepsRef.current.filter((step) => step.modules.some((module) => !automatic.includes(module.key)));
|
|
427
|
+
let initialIndex = (_visibleSteps$0$index = (_visibleSteps$ = visibleSteps[0]) === null || _visibleSteps$ === void 0 ? void 0 : _visibleSteps$.index) !== null && _visibleSteps$0$index !== void 0 ? _visibleSteps$0$index : Math.max(0, compiledStepsRef.current.length - 1);
|
|
428
|
+
try {
|
|
429
|
+
var _resolveInitialStepIn;
|
|
430
|
+
const context = getFreshContext();
|
|
431
|
+
const requestedIndex = context && ((_resolveInitialStepIn = resolveInitialStepIndexRef.current) === null || _resolveInitialStepIn === void 0 ? void 0 : _resolveInitialStepIn.call(resolveInitialStepIndexRef, context));
|
|
432
|
+
const requestedStep = visibleSteps.find((step) => step.index === requestedIndex);
|
|
433
|
+
if (requestedStep) initialIndex = requestedStep.index;
|
|
434
|
+
} catch (_unused2) {}
|
|
401
435
|
currentStepIndexRef.current = initialIndex;
|
|
402
436
|
currentStepKeyRef.current = (_compiledStepsRef$cur = compiledStepsRef.current[initialIndex]) === null || _compiledStepsRef$cur === void 0 ? void 0 : _compiledStepsRef$cur.key;
|
|
403
437
|
setCurrentStepIndex(initialIndex);
|
|
404
438
|
presentationReadyRef.current = true;
|
|
405
439
|
setPresentationReady(true);
|
|
406
440
|
(_onPresentationReadyR2 = onPresentationReadyRef.current) === null || _onPresentationReadyR2 === void 0 || _onPresentationReadyR2.call(onPresentationReadyRef, automatic);
|
|
407
|
-
})().
|
|
441
|
+
})().then(() => {
|
|
442
|
+
if (presentationTaskRef.current === task) presentationTaskRef.current = null;
|
|
443
|
+
}, (error) => {
|
|
408
444
|
if (presentationTaskRef.current === task) presentationTaskRef.current = null;
|
|
445
|
+
throw error;
|
|
409
446
|
});
|
|
410
447
|
presentationTaskRef.current = task;
|
|
411
448
|
}, [
|
|
@@ -416,30 +453,6 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
|
|
|
416
453
|
preparePresentation,
|
|
417
454
|
registry
|
|
418
455
|
]);
|
|
419
|
-
const autoAdvanceAttemptRef = (0, react.useRef)();
|
|
420
|
-
(0, react.useEffect)(() => {
|
|
421
|
-
if (!presentationReady || configurationError || completedRef.current || transitionPendingRef.current || !currentStep || !isStepSkippable(resolvedCurrentStepIndex)) return;
|
|
422
|
-
if (currentStep.modules.every((module) => automaticModuleKeysRef.current.includes(module.key))) return;
|
|
423
|
-
const direction = navigationDirectionRef.current;
|
|
424
|
-
const key = `${direction}:${currentStep.key}:${draftRevisionRef.current}:${currentStep.modules.map((module) => `${module.key}:${moduleRevisionRef.current.get(module.key) || 0}`).join("|")}`;
|
|
425
|
-
if (autoAdvanceAttemptRef.current === key) return;
|
|
426
|
-
autoAdvanceAttemptRef.current = key;
|
|
427
|
-
if (direction === "backward") back();
|
|
428
|
-
else next();
|
|
429
|
-
}, [
|
|
430
|
-
presentationReady,
|
|
431
|
-
automaticModuleKeys,
|
|
432
|
-
configurationError,
|
|
433
|
-
currentStep,
|
|
434
|
-
resolvedCurrentStepIndex,
|
|
435
|
-
moduleState,
|
|
436
|
-
moduleData,
|
|
437
|
-
draft,
|
|
438
|
-
isStepSkippable,
|
|
439
|
-
navigationDirectionRef,
|
|
440
|
-
back,
|
|
441
|
-
next
|
|
442
|
-
]);
|
|
443
456
|
const getState = (0, react.useCallback)(() => {
|
|
444
457
|
const stepIndex = currentStepIndexRef.current;
|
|
445
458
|
return {
|
|
@@ -367,7 +367,8 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
|
|
|
367
367
|
const preparationGeneration = flowGenerationRef.current;
|
|
368
368
|
const preparationNavigation = navigationRevisionRef.current;
|
|
369
369
|
const isCurrentPreparation = () => mountedRef.current && !configurationErrorRef.current && flowGenerationRef.current === preparationGeneration && navigationRevisionRef.current === preparationNavigation && currentStepIndexRef.current === currentIndex && require_utils.getCompiledStepsFingerprint(compiledStepsRef.current) === preparationFingerprint;
|
|
370
|
-
const automaticModules =
|
|
370
|
+
const automaticModules = [];
|
|
371
|
+
for (const step of allSteps) for (const module of step.modules) if (automaticModuleKeysRef.current.includes(module.key)) automaticModules.push(module);
|
|
371
372
|
for (let pass = 0; pass <= automaticModules.length; pass += 1) {
|
|
372
373
|
for (const module of automaticModules) {
|
|
373
374
|
var _moduleStateRef$curre4;
|
|
@@ -188,6 +188,8 @@ interface PisellSelectionFlowProps<TDraft, TDraftUpdate, TField extends string,
|
|
|
188
188
|
initialStepIndex?: number;
|
|
189
189
|
/** Resolve a stable presentation before mounting interactive module components. */
|
|
190
190
|
preparePresentation?: boolean;
|
|
191
|
+
/** Choose the entry step from prepared defaults without hiding earlier steps. */
|
|
192
|
+
resolveInitialStepIndex?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>) => number | undefined;
|
|
191
193
|
onPresentationReady?: (automaticModuleKeys: readonly string[]) => void;
|
|
192
194
|
hostContext?: THostContext;
|
|
193
195
|
services: TServices;
|