@pisell/materials 6.12.88 → 6.12.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +1 -1
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +1 -1
  9. package/es/components/PisellFields/index.js +0 -11
  10. package/es/components/PisellSelectionFlow/PisellSelectionFlow.js +103 -5
  11. package/es/components/PisellSelectionFlow/hooks/useFlowModuleLifecycle.js +3 -2
  12. package/es/components/PisellSelectionFlow/hooks/useFlowNavigation.js +71 -20
  13. package/es/components/PisellSelectionFlow/types.d.ts +9 -0
  14. package/es/components/filter/components/FilterItem/AsyncOptionsSelectWrapper.js +0 -2
  15. package/es/components/filter/components/FilterItem/index.js +0 -11
  16. package/es/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanelLayoutTab.js +0 -2
  17. package/es/components/pisellRecordBoard/utils/recordBoardColumns.js +0 -11
  18. package/es/index.js +0 -11
  19. package/es/pisell-materials.tw.css +1 -1
  20. package/lib/components/PisellSelectionFlow/PisellSelectionFlow.js +102 -4
  21. package/lib/components/PisellSelectionFlow/hooks/useFlowModuleLifecycle.js +3 -2
  22. package/lib/components/PisellSelectionFlow/hooks/useFlowNavigation.js +71 -20
  23. package/lib/components/PisellSelectionFlow/types.d.ts +9 -0
  24. package/lib/pisell-materials.tw.css +1 -1
  25. package/package.json +1 -1
  26. package/es/components/pisellCurrency/index.js +0 -13
  27. package/es/components/pisellEmail/index.js +0 -13
  28. package/es/components/pisellLongText/index.js +0 -13
  29. package/es/components/pisellMultipleSelect/index.js +0 -13
  30. package/es/components/pisellNumber/index.js +0 -13
  31. package/es/components/pisellPercent/index.js +0 -13
  32. package/es/components/pisellPhone/index.js +0 -14
  33. package/es/components/pisellRating/index.js +0 -13
  34. package/es/components/pisellSingleLineText/index.js +0 -13
  35. package/es/components/pisellSingleSelect/index.js +0 -13
  36. package/es/components/pisellUrl/index.js +0 -13
@@ -1,25 +1,14 @@
1
1
  import PisellSingleLineText_default from "../pisellSingleLineText/PisellSingleLineText.js";
2
- import "../pisellSingleLineText/index.js";
3
2
  import PisellLongText_default from "../pisellLongText/PisellLongText.js";
4
- import "../pisellLongText/index.js";
5
3
  import MemoizedPisellNumber from "../pisellNumber/PisellNumber.js";
6
- import "../pisellNumber/index.js";
7
4
  import MemoizedPisellCurrency from "../pisellCurrency/PisellCurrency.js";
8
- import "../pisellCurrency/index.js";
9
5
  import MemoizedPisellPercent from "../pisellPercent/PisellPercent.js";
10
- import "../pisellPercent/index.js";
11
6
  import PisellPhone_default from "../pisellPhone/PisellPhone.js";
12
- import "../pisellPhone/index.js";
13
7
  import PisellEmail_default from "../pisellEmail/PisellEmail.js";
14
- import "../pisellEmail/index.js";
15
8
  import PisellUrl_default from "../pisellUrl/PisellUrl.js";
16
- import "../pisellUrl/index.js";
17
9
  import PisellRating_default from "../pisellRating/PisellRating.js";
18
- import "../pisellRating/index.js";
19
10
  import PisellSingleSelect from "../pisellSingleSelect/PisellSingleSelect.js";
20
- import "../pisellSingleSelect/index.js";
21
11
  import PisellMultipleSelect from "../pisellMultipleSelect/PisellMultipleSelect.js";
22
- import "../pisellMultipleSelect/index.js";
23
12
  //#region src/components/PisellFields/index.tsx
24
13
  /**
25
14
  * PisellFields 命名空间
@@ -1,6 +1,7 @@
1
1
  import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
+ import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
2
3
  import { SelectionFlowCompileError } from "./types.js";
3
- import { compileSelectionFlowSteps } from "./compiler.js";
4
+ import { compileSelectionFlowSteps, resolveFlowModuleAdapter } from "./compiler.js";
4
5
  import { SelectionFlowProvider } from "./context.js";
5
6
  import { useFlowDraft } from "./hooks/useFlowDraft.js";
6
7
  import { getCompiledStepsFingerprint, getSelectionFlowErrorMessage } from "./utils.js";
@@ -14,13 +15,22 @@ const createUnexpectedCompileError = (error) => {
14
15
  message: `Selection flow compilation failed: ${getSelectionFlowErrorMessage(error)}`
15
16
  }]);
16
17
  };
17
- const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialStepIndex = 0, 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) => {
18
19
  const mountedRef = useRef(true);
19
20
  const flowGenerationRef = useRef(1);
20
21
  const draftRevisionRef = useRef(0);
21
22
  const navigationRevisionRef = useRef(0);
22
23
  const preparationRevisionRef = useRef(0);
23
24
  const transitionPendingRef = useRef(false);
25
+ const [presentationReady, setPresentationReady] = useState(!preparePresentation);
26
+ const presentationReadyRef = useRef(!preparePresentation);
27
+ const [automaticModuleKeys, setAutomaticModuleKeys] = useState([]);
28
+ const automaticModuleKeysRef = useRef([]);
29
+ const presentationTaskRef = useRef(null);
30
+ const onPresentationReadyRef = useRef(onPresentationReady);
31
+ onPresentationReadyRef.current = onPresentationReady;
32
+ const resolveInitialStepIndexRef = useRef(resolveInitialStepIndex);
33
+ resolveInitialStepIndexRef.current = resolveInitialStepIndex;
24
34
  const processDraftChangeRef = useRef(() => void 0);
25
35
  const onDraftChangeRef = useRef(onDraftChange);
26
36
  onDraftChangeRef.current = onDraftChange;
@@ -84,6 +94,7 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
84
94
  if (flowGenerationRef.current === generation) flowGenerationRef.current += 1;
85
95
  navigationRevisionRef.current += 1;
86
96
  preparationRevisionRef.current += 1;
97
+ presentationTaskRef.current = null;
87
98
  moduleInitializationRef.current.clear();
88
99
  moduleDependencyLifecycleRef.current.clear();
89
100
  pendingModuleChangeRef.current.clear();
@@ -301,7 +312,8 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
301
312
  compiledSteps,
302
313
  resolvedCurrentStepIndex,
303
314
  draft,
304
- moduleState
315
+ moduleState,
316
+ automaticModuleKeys
305
317
  });
306
318
  const { validateCurrentStep, prepareSteps, complete, next, back, isStepSkippable, navigationDirectionRef } = useFlowNavigation({
307
319
  registry,
@@ -314,6 +326,17 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
314
326
  draftRevisionRef,
315
327
  flowGenerationRef,
316
328
  moduleHandlesRef,
329
+ automaticModuleKeysRef,
330
+ onAutomaticModuleFailure: useCallback((module) => {
331
+ var _onPresentationReadyR;
332
+ const automatic = automaticModuleKeysRef.current.filter((key) => key !== module.key);
333
+ automaticModuleKeysRef.current = automatic;
334
+ setAutomaticModuleKeys(automatic);
335
+ currentStepIndexRef.current = module.stepIndex;
336
+ currentStepKeyRef.current = module.stepKey;
337
+ setCurrentStepIndex(module.stepIndex);
338
+ (_onPresentationReadyR = onPresentationReadyRef.current) === null || _onPresentationReadyR === void 0 || _onPresentationReadyR.call(onPresentationReadyRef, automatic);
339
+ }, []),
317
340
  configurationErrorRef,
318
341
  compiledStepsRef,
319
342
  currentStepIndexRef,
@@ -338,7 +361,8 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
338
361
  });
339
362
  const autoAdvanceAttemptRef = useRef();
340
363
  useEffect(() => {
341
- if (configurationError || completedRef.current || transitionPendingRef.current || !currentStep || !isStepSkippable(resolvedCurrentStepIndex)) return;
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;
342
366
  const direction = navigationDirectionRef.current;
343
367
  const key = `${direction}:${currentStep.key}:${draftRevisionRef.current}:${currentStep.modules.map((module) => `${module.key}:${moduleRevisionRef.current.get(module.key) || 0}`).join("|")}`;
344
368
  if (autoAdvanceAttemptRef.current === key) return;
@@ -355,7 +379,77 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
355
379
  isStepSkippable,
356
380
  navigationDirectionRef,
357
381
  back,
358
- next
382
+ next,
383
+ preparePresentation,
384
+ presentationReady,
385
+ automaticModuleKeys
386
+ ]);
387
+ useEffect(() => {
388
+ if (!preparePresentation || presentationReadyRef.current || configurationError || presentationTaskRef.current) return;
389
+ const generation = flowGenerationRef.current;
390
+ const isCurrent = () => mountedRef.current && flowGenerationRef.current === generation;
391
+ const task = _asyncToGenerator(function* () {
392
+ var _visibleSteps$0$index, _visibleSteps$, _compiledStepsRef$cur, _onPresentationReadyR2;
393
+ const modules = compiledStepsRef.current.reduce((allModules, step) => allModules.concat(step.modules), []);
394
+ for (let pass = 0; pass <= modules.length; pass += 1) {
395
+ for (const module of modules) {
396
+ if (!isCurrent()) return;
397
+ yield ensureModuleReady(module);
398
+ }
399
+ if (!isCurrent()) return;
400
+ if (!modules.some((module) => {
401
+ var _moduleStateRef$curre2;
402
+ return [
403
+ "idle",
404
+ "stale",
405
+ "loading"
406
+ ].includes(((_moduleStateRef$curre2 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre2 === void 0 ? void 0 : _moduleStateRef$curre2.status) || "idle");
407
+ })) break;
408
+ }
409
+ if (!isCurrent()) return;
410
+ const automatic = modules.filter((module) => {
411
+ var _moduleStateRef$curre3;
412
+ if (((_moduleStateRef$curre3 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre3 === void 0 ? void 0 : _moduleStateRef$curre3.status) !== "ready") return false;
413
+ const context = getFreshContext();
414
+ const adapter = resolveFlowModuleAdapter(registry, module.type);
415
+ try {
416
+ var _adapter$resolvePrese;
417
+ return context && (adapter === null || adapter === void 0 || (_adapter$resolvePrese = adapter.resolvePresentation) === null || _adapter$resolvePrese === void 0 ? void 0 : _adapter$resolvePrese.call(adapter, context, module)) === "automatic";
418
+ } catch (_unused) {
419
+ return false;
420
+ }
421
+ }).map((module) => module.key);
422
+ automaticModuleKeysRef.current = automatic;
423
+ setAutomaticModuleKeys(automatic);
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) {}
433
+ currentStepIndexRef.current = initialIndex;
434
+ currentStepKeyRef.current = (_compiledStepsRef$cur = compiledStepsRef.current[initialIndex]) === null || _compiledStepsRef$cur === void 0 ? void 0 : _compiledStepsRef$cur.key;
435
+ setCurrentStepIndex(initialIndex);
436
+ presentationReadyRef.current = true;
437
+ setPresentationReady(true);
438
+ (_onPresentationReadyR2 = onPresentationReadyRef.current) === null || _onPresentationReadyR2 === void 0 || _onPresentationReadyR2.call(onPresentationReadyRef, automatic);
439
+ })().then(() => {
440
+ if (presentationTaskRef.current === task) presentationTaskRef.current = null;
441
+ }, (error) => {
442
+ if (presentationTaskRef.current === task) presentationTaskRef.current = null;
443
+ throw error;
444
+ });
445
+ presentationTaskRef.current = task;
446
+ }, [
447
+ compiledSteps,
448
+ configurationError,
449
+ ensureModuleReady,
450
+ getFreshContext,
451
+ preparePresentation,
452
+ registry
359
453
  ]);
360
454
  const getState = useCallback(() => {
361
455
  const stepIndex = currentStepIndexRef.current;
@@ -368,6 +462,8 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
368
462
  moduleData: moduleDataRef.current,
369
463
  isCompleting: isCompletingRef.current,
370
464
  isCompleted: completedRef.current,
465
+ presentationReady: presentationReadyRef.current,
466
+ automaticModuleKeys: automaticModuleKeysRef.current,
371
467
  configurationError: configurationErrorRef.current
372
468
  };
373
469
  }, []);
@@ -402,6 +498,8 @@ const SelectionFlow = ({ registry, draftAdapter, steps, initialDraft, initialSte
402
498
  moduleData,
403
499
  isCompleting,
404
500
  isCompleted: completedRef.current,
501
+ presentationReady,
502
+ automaticModuleKeys,
405
503
  configurationError,
406
504
  completionError,
407
505
  completionReason,
@@ -5,7 +5,7 @@ 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, moduleInvalidationRef, 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, automaticModuleKeys = [] }) => {
9
9
  processDraftChangeRef.current = useCallback((change) => {
10
10
  const changedFields = new Set(change.changedFields);
11
11
  const flowGeneration = flowGenerationRef.current;
@@ -230,7 +230,7 @@ const useFlowModuleLifecycle = ({ registry, draftAdapter, createRuntimeIssue, mo
230
230
  if (!currentStep || configurationError) return;
231
231
  const backgroundModules = compiledSteps.flatMap((step) => step.modules).filter((module) => {
232
232
  const adapter = resolveFlowModuleAdapter(registry, module.type);
233
- return (adapter === null || adapter === void 0 ? void 0 : adapter.initializeWhileInactive) && module.stepIndex < resolvedCurrentStepIndex;
233
+ return automaticModuleKeys.includes(module.key) || (adapter === null || adapter === void 0 ? void 0 : adapter.initializeWhileInactive) && module.stepIndex < resolvedCurrentStepIndex;
234
234
  });
235
235
  for (const module of [...currentStep.modules, ...backgroundModules]) {
236
236
  var _moduleStateRef$curre4;
@@ -238,6 +238,7 @@ const useFlowModuleLifecycle = ({ registry, draftAdapter, createRuntimeIssue, mo
238
238
  if (status === "idle" || status === "stale") ensureModuleReady(module);
239
239
  }
240
240
  }, [
241
+ automaticModuleKeys,
241
242
  compiledSteps,
242
243
  configurationError,
243
244
  currentStep,
@@ -5,7 +5,7 @@ import { getCompiledStepsFingerprint, getSelectionFlowErrorMessage, normalizeFlo
5
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, 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 }) => {
8
+ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mountedRef, moduleStateRef, moduleRevisionRef, moduleInvalidationRef, draftRevisionRef, flowGenerationRef, moduleHandlesRef, automaticModuleKeysRef, onAutomaticModuleFailure, configurationErrorRef, compiledStepsRef, currentStepIndexRef, currentStepKeyRef, validatedCompletionRef, navigationRevisionRef, preparationRevisionRef, transitionPendingRef, completedRef, completionPromiseRef, isCompletingRef, draftRef, onCompleteRef, ensureModuleReady, commitModuleState, getFreshContext, onValidationFailed, setCurrentStepIndex, setCompletionError, setCompletionReason, setIsCompleting }) => {
9
9
  const navigationDirectionRef = useRef("forward");
10
10
  const isStepSkippable = useCallback((stepIndex) => {
11
11
  const step = compiledStepsRef.current[stepIndex];
@@ -14,6 +14,7 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
14
14
  return step.modules.every((module) => {
15
15
  var _moduleStateRef$curre;
16
16
  if (((_moduleStateRef$curre = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre === void 0 ? void 0 : _moduleStateRef$curre.status) !== "ready") return false;
17
+ if (automaticModuleKeysRef.current.includes(module.key)) return true;
17
18
  try {
18
19
  var _resolveFlowModuleAda, _resolveFlowModuleAda2;
19
20
  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;
@@ -28,6 +29,7 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
28
29
  if (!adapter || !mountedRef.current) return false;
29
30
  const ready = yield ensureModuleReady(module);
30
31
  if (!mountedRef.current || !ready) {
32
+ if (mountedRef.current && automaticModuleKeysRef.current.includes(module.key)) onAutomaticModuleFailure === null || onAutomaticModuleFailure === void 0 || onAutomaticModuleFailure(module);
31
33
  const state = moduleStateRef.current[module.key];
32
34
  onValidationFailed === null || onValidationFailed === void 0 || onValidationFailed(module, {
33
35
  message: state === null || state === void 0 ? void 0 : state.message,
@@ -63,7 +65,7 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
63
65
  }
64
66
  });
65
67
  const handle = moduleHandlesRef.current.get(module.key) || null;
66
- const result = normalizeFlowValidationResult(adapter.validate ? yield adapter.validate(validationContext, handle, module) : yield handle === null || handle === void 0 || (_handle$validate = handle.validate) === null || _handle$validate === void 0 ? void 0 : _handle$validate.call(handle));
68
+ const result = normalizeFlowValidationResult(automaticModuleKeysRef.current.includes(module.key) && !handle && adapter.validateAutoResolution ? yield adapter.validateAutoResolution(validationContext, module) : adapter.validate ? yield adapter.validate(validationContext, handle, module) : yield handle === null || handle === void 0 || (_handle$validate = handle.validate) === null || _handle$validate === void 0 ? void 0 : _handle$validate.call(handle));
67
69
  if (!isCurrentValidation()) {
68
70
  if (isCurrentValidationRun()) commitModuleState(module.key, {
69
71
  status: "stale",
@@ -72,6 +74,7 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
72
74
  return false;
73
75
  }
74
76
  if (!result.valid) {
77
+ if (automaticModuleKeysRef.current.includes(module.key)) onAutomaticModuleFailure === null || onAutomaticModuleFailure === void 0 || onAutomaticModuleFailure(module);
75
78
  const fallbackReason = result.message ? void 0 : createRuntimeIssue("module-validation-failed");
76
79
  commitModuleState(module.key, {
77
80
  status: "error",
@@ -89,6 +92,7 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
89
92
  } catch (error) {
90
93
  const message = getSelectionFlowErrorMessage(error);
91
94
  if (isCurrentValidation()) {
95
+ if (automaticModuleKeysRef.current.includes(module.key)) onAutomaticModuleFailure === null || onAutomaticModuleFailure === void 0 || onAutomaticModuleFailure(module);
92
96
  commitModuleState(module.key, {
93
97
  status: "error",
94
98
  message,
@@ -111,6 +115,7 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
111
115
  createRuntimeIssue,
112
116
  getFreshContext,
113
117
  onValidationFailed,
118
+ onAutomaticModuleFailure,
114
119
  registry
115
120
  ]);
116
121
  const validateCurrentStep = useCallback(_asyncToGenerator(function* () {
@@ -360,8 +365,35 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
360
365
  const preparationFingerprint = getCompiledStepsFingerprint(allSteps);
361
366
  const preparationGeneration = flowGenerationRef.current;
362
367
  const preparationNavigation = navigationRevisionRef.current;
363
- const preparationDraftRevision = draftRevisionRef.current;
364
368
  const isCurrentPreparation = () => mountedRef.current && !configurationErrorRef.current && flowGenerationRef.current === preparationGeneration && navigationRevisionRef.current === preparationNavigation && currentStepIndexRef.current === currentIndex && getCompiledStepsFingerprint(compiledStepsRef.current) === preparationFingerprint;
369
+ const automaticModules = [];
370
+ for (const step of allSteps) for (const module of step.modules) if (automaticModuleKeysRef.current.includes(module.key)) automaticModules.push(module);
371
+ for (let pass = 0; pass <= automaticModules.length; pass += 1) {
372
+ for (const module of automaticModules) {
373
+ var _moduleStateRef$curre4;
374
+ if (!isCurrentPreparation()) return false;
375
+ if (pass > 0 && ((_moduleStateRef$curre4 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre4 === void 0 ? void 0 : _moduleStateRef$curre4.status) === "ready") continue;
376
+ if (!(yield validateModule(module)) || !isCurrentPreparation()) return false;
377
+ }
378
+ if (automaticModules.every((module) => {
379
+ var _moduleStateRef$curre5;
380
+ return ((_moduleStateRef$curre5 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre5 === void 0 ? void 0 : _moduleStateRef$curre5.status) === "ready";
381
+ })) break;
382
+ }
383
+ const unresolvedAutomatic = automaticModules.find((module) => {
384
+ var _moduleStateRef$curre6;
385
+ return ((_moduleStateRef$curre6 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre6 === void 0 ? void 0 : _moduleStateRef$curre6.status) !== "ready";
386
+ });
387
+ if (unresolvedAutomatic) {
388
+ onAutomaticModuleFailure === null || onAutomaticModuleFailure === void 0 || onAutomaticModuleFailure(unresolvedAutomatic);
389
+ const state = moduleStateRef.current[unresolvedAutomatic.key];
390
+ onValidationFailed === null || onValidationFailed === void 0 || onValidationFailed(unresolvedAutomatic, {
391
+ message: state === null || state === void 0 ? void 0 : state.message,
392
+ reason: (state === null || state === void 0 ? void 0 : state.reason) || createRuntimeIssue("previous-step-review")
393
+ });
394
+ return false;
395
+ }
396
+ const preparationDraftRevision = draftRevisionRef.current;
365
397
  for (const step of allSteps) {
366
398
  if (step.index >= currentIndex) break;
367
399
  for (const module of step.modules) {
@@ -397,8 +429,8 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
397
429
  const latestRevisionFingerprint = latestSteps.flatMap((step) => step.modules).map((module) => `${module.key}:${moduleRevisionRef.current.get(module.key) || 0}`).join("|");
398
430
  if (compiledFingerprint !== latestCompiledFingerprint || revisionFingerprint !== latestRevisionFingerprint || draftRevision !== draftRevisionRef.current) {
399
431
  const targetStep = latestSteps.find((step) => step.modules.some((module) => {
400
- var _moduleStateRef$curre4;
401
- return ((_moduleStateRef$curre4 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre4 === void 0 ? void 0 : _moduleStateRef$curre4.status) !== "ready";
432
+ var _moduleStateRef$curre7;
433
+ return ((_moduleStateRef$curre7 = moduleStateRef.current[module.key]) === null || _moduleStateRef$curre7 === void 0 ? void 0 : _moduleStateRef$curre7.status) !== "ready";
402
434
  })) || latestSteps[0];
403
435
  const targetModule = targetStep === null || targetStep === void 0 ? void 0 : targetStep.modules[0];
404
436
  if (targetStep && targetModule) {
@@ -430,9 +462,11 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
430
462
  }), [
431
463
  commitModuleState,
432
464
  createRuntimeIssue,
465
+ onAutomaticModuleFailure,
433
466
  onValidationFailed,
434
467
  revalidateModuleBeforeComplete,
435
- validateCurrentStep
468
+ validateCurrentStep,
469
+ validateModule
436
470
  ]);
437
471
  const complete = useCallback(() => {
438
472
  if (!mountedRef.current) return Promise.resolve(false);
@@ -491,43 +525,60 @@ const useFlowNavigation = ({ registry, draftAdapter, createRuntimeIssue, mounted
491
525
  complete,
492
526
  next: useCallback(_asyncToGenerator(function* () {
493
527
  if (!mountedRef.current || configurationErrorRef.current || transitionPendingRef.current) return false;
494
- const currentIndex = currentStepIndexRef.current;
495
528
  const allSteps = compiledStepsRef.current;
529
+ const compiledFingerprint = getCompiledStepsFingerprint(allSteps);
530
+ const currentIndex = currentStepIndexRef.current;
496
531
  if (!allSteps[currentIndex]) return false;
497
532
  navigationDirectionRef.current = "forward";
498
533
  if (currentIndex >= allSteps.length - 1) return complete();
499
- const currentStepKey = allSteps[currentIndex].key;
500
534
  const navigationRevision = navigationRevisionRef.current + 1;
501
535
  navigationRevisionRef.current = navigationRevision;
502
536
  transitionPendingRef.current = true;
537
+ let shouldComplete = false;
503
538
  try {
504
- var _compiledStepsRef$cur2, _allSteps$nextIndex;
505
- if (!(yield validateCurrentStep())) return false;
506
- if (!(yield runBeforeLeaveForCurrentStep())) return false;
507
- if (!mountedRef.current || navigationRevisionRef.current !== navigationRevision || currentStepIndexRef.current !== currentIndex || ((_compiledStepsRef$cur2 = compiledStepsRef.current[currentIndex]) === null || _compiledStepsRef$cur2 === void 0 ? void 0 : _compiledStepsRef$cur2.key) !== currentStepKey) return false;
508
- const nextIndex = currentIndex + 1;
509
- currentStepIndexRef.current = nextIndex;
510
- currentStepKeyRef.current = (_allSteps$nextIndex = allSteps[nextIndex]) === null || _allSteps$nextIndex === void 0 ? void 0 : _allSteps$nextIndex.key;
511
- setCurrentStepIndex(nextIndex);
512
- return true;
539
+ let index = currentIndex;
540
+ while (index < allSteps.length) {
541
+ var _allSteps$nextIndex;
542
+ if (!(yield validateCurrentStep()) || !(yield runBeforeLeaveForCurrentStep())) return false;
543
+ if (!mountedRef.current || navigationRevisionRef.current !== navigationRevision || getCompiledStepsFingerprint(compiledStepsRef.current) !== compiledFingerprint || currentStepIndexRef.current !== index) return false;
544
+ const nextIndex = index + 1;
545
+ if (nextIndex >= allSteps.length) {
546
+ shouldComplete = true;
547
+ break;
548
+ }
549
+ currentStepIndexRef.current = nextIndex;
550
+ currentStepKeyRef.current = (_allSteps$nextIndex = allSteps[nextIndex]) === null || _allSteps$nextIndex === void 0 ? void 0 : _allSteps$nextIndex.key;
551
+ if (!allSteps[nextIndex].modules.every((module) => automaticModuleKeysRef.current.includes(module.key)) && !isStepSkippable(nextIndex)) {
552
+ setCurrentStepIndex(nextIndex);
553
+ return true;
554
+ }
555
+ index = nextIndex;
556
+ }
557
+ setCurrentStepIndex(currentStepIndexRef.current);
513
558
  } finally {
514
559
  transitionPendingRef.current = false;
515
560
  }
561
+ return shouldComplete ? complete() : false;
516
562
  }), [
517
563
  complete,
564
+ isStepSkippable,
518
565
  runBeforeLeaveForCurrentStep,
519
566
  validateCurrentStep
520
567
  ]),
521
568
  back: useCallback(() => {
522
- var _compiledStepsRef$cur3;
569
+ var _compiledStepsRef$cur2;
523
570
  if (!mountedRef.current || transitionPendingRef.current || currentStepIndexRef.current <= 0) return false;
524
571
  let nextIndex = currentStepIndexRef.current - 1;
525
- while (nextIndex >= 0 && isStepSkippable(nextIndex)) nextIndex -= 1;
572
+ while (nextIndex >= 0) {
573
+ const step = compiledStepsRef.current[nextIndex];
574
+ if (!((step === null || step === void 0 ? void 0 : step.modules.length) > 0 && step.modules.every((module) => automaticModuleKeysRef.current.includes(module.key))) && !isStepSkippable(nextIndex)) break;
575
+ nextIndex -= 1;
576
+ }
526
577
  if (nextIndex < 0) return false;
527
578
  navigationDirectionRef.current = "backward";
528
579
  navigationRevisionRef.current += 1;
529
580
  currentStepIndexRef.current = nextIndex;
530
- currentStepKeyRef.current = (_compiledStepsRef$cur3 = compiledStepsRef.current[nextIndex]) === null || _compiledStepsRef$cur3 === void 0 ? void 0 : _compiledStepsRef$cur3.key;
581
+ currentStepKeyRef.current = (_compiledStepsRef$cur2 = compiledStepsRef.current[nextIndex]) === null || _compiledStepsRef$cur2 === void 0 ? void 0 : _compiledStepsRef$cur2.key;
531
582
  setCurrentStepIndex(nextIndex);
532
583
  return true;
533
584
  }, [isStepSkippable]),
@@ -124,6 +124,8 @@ interface SelectionFlowModuleAdapter<TDraft, TDraftUpdate, TField extends string
124
124
  * 不提供即表示该模块必须由用户进入步骤确认。
125
125
  */
126
126
  validateAutoResolution?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => FlowModuleValidationReturn;
127
+ /** Opt-in presentation planning; automatic modules keep their full runtime lifecycle. */
128
+ resolvePresentation?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => 'visible' | 'automatic';
127
129
  beforeLeave?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, handle: FlowModuleHandle | null, module: CompiledSelectionFlowModuleConfig<TModuleType>) => FlowModuleBeforeLeaveReturn;
128
130
  }
129
131
  type SelectionFlowModuleRegistry<TDraft, TDraftUpdate, TField extends string, TModuleType extends string, TServices = unknown, THostContext = unknown> = Record<TModuleType, SelectionFlowModuleAdapter<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>>;
@@ -136,6 +138,8 @@ interface SelectionFlowSnapshot<TDraft, TModuleType extends string = string> {
136
138
  moduleData: FlowModuleDataMap;
137
139
  isCompleting: boolean;
138
140
  isCompleted: boolean;
141
+ presentationReady?: boolean;
142
+ automaticModuleKeys?: readonly string[];
139
143
  configurationError: SelectionFlowCompileError | null;
140
144
  }
141
145
  interface SelectionFlowRef<TDraft, TDraftUpdate, TField extends string = string, TModuleType extends string = string> {
@@ -182,6 +186,11 @@ interface PisellSelectionFlowProps<TDraft, TDraftUpdate, TField extends string,
182
186
  steps: readonly SelectionFlowStepConfig<TModuleType>[];
183
187
  initialDraft: TDraft;
184
188
  initialStepIndex?: number;
189
+ /** Resolve a stable presentation before mounting interactive module components. */
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;
193
+ onPresentationReady?: (automaticModuleKeys: readonly string[]) => void;
185
194
  hostContext?: THostContext;
186
195
  services: TServices;
187
196
  children: (controller: PisellSelectionFlowController<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>) => React.ReactNode;
@@ -1,9 +1,7 @@
1
1
  import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
2
  import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
3
3
  import PisellSingleSelect from "../../../pisellSingleSelect/PisellSingleSelect.js";
4
- import "../../../pisellSingleSelect/index.js";
5
4
  import PisellMultipleSelect from "../../../pisellMultipleSelect/PisellMultipleSelect.js";
6
- import "../../../pisellMultipleSelect/index.js";
7
5
  import React, { useEffect, useState } from "react";
8
6
  import { Spin } from "antd";
9
7
  //#region src/components/filter/components/FilterItem/AsyncOptionsSelectWrapper.tsx
@@ -1,28 +1,17 @@
1
1
  import { getText } from "../../../../locales/index.js";
2
2
  import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
3
3
  import PisellSingleLineText_default from "../../../pisellSingleLineText/PisellSingleLineText.js";
4
- import "../../../pisellSingleLineText/index.js";
5
4
  import PisellLongText_default from "../../../pisellLongText/PisellLongText.js";
6
- import "../../../pisellLongText/index.js";
7
5
  import MemoizedPisellNumber from "../../../pisellNumber/PisellNumber.js";
8
- import "../../../pisellNumber/index.js";
9
6
  import MemoizedPisellCurrency from "../../../pisellCurrency/PisellCurrency.js";
10
- import "../../../pisellCurrency/index.js";
11
7
  import MemoizedPisellPercent from "../../../pisellPercent/PisellPercent.js";
12
- import "../../../pisellPercent/index.js";
13
8
  import PisellPhone_default from "../../../pisellPhone/PisellPhone.js";
14
- import "../../../pisellPhone/index.js";
15
9
  import PisellEmail_default from "../../../pisellEmail/PisellEmail.js";
16
- import "../../../pisellEmail/index.js";
17
10
  import PisellUrl_default from "../../../pisellUrl/PisellUrl.js";
18
- import "../../../pisellUrl/index.js";
19
11
  import PisellRating_default from "../../../pisellRating/PisellRating.js";
20
- import "../../../pisellRating/index.js";
21
12
  import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
22
13
  import PisellSingleSelect from "../../../pisellSingleSelect/PisellSingleSelect.js";
23
- import "../../../pisellSingleSelect/index.js";
24
14
  import PisellMultipleSelect from "../../../pisellMultipleSelect/PisellMultipleSelect.js";
25
- import "../../../pisellMultipleSelect/index.js";
26
15
  import { fieldMaps } from "../../../table/Table/fields/index.js";
27
16
  import { PisellMobileDateRangePicker } from "../../../pisellMobileDateRangePicker/PisellMobileDateRangePicker.js";
28
17
  import AsyncOptionsSelectWrapper from "./AsyncOptionsSelectWrapper.js";
@@ -1,8 +1,6 @@
1
1
  import { getText } from "../../../../locales/index.js";
2
2
  import MemoizedPisellNumber from "../../../pisellNumber/PisellNumber.js";
3
- import "../../../pisellNumber/index.js";
4
3
  import PisellSingleSelect from "../../../pisellSingleSelect/PisellSingleSelect.js";
5
- import "../../../pisellSingleSelect/index.js";
6
4
  import React from "react";
7
5
  //#region src/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanelLayoutTab.tsx
8
6
  /** 控制台「资源 / 布局」分页:预设、自定义行列、翻页停留、主文案宽度 */
@@ -1,27 +1,16 @@
1
1
  import { getText } from "../../../locales/index.js";
2
2
  import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
3
3
  import PisellSingleLineText_default from "../../pisellSingleLineText/PisellSingleLineText.js";
4
- import "../../pisellSingleLineText/index.js";
5
4
  import PisellLongText_default from "../../pisellLongText/PisellLongText.js";
6
- import "../../pisellLongText/index.js";
7
5
  import MemoizedPisellNumber from "../../pisellNumber/PisellNumber.js";
8
- import "../../pisellNumber/index.js";
9
6
  import MemoizedPisellCurrency from "../../pisellCurrency/PisellCurrency.js";
10
- import "../../pisellCurrency/index.js";
11
7
  import MemoizedPisellPercent from "../../pisellPercent/PisellPercent.js";
12
- import "../../pisellPercent/index.js";
13
8
  import PisellPhone_default from "../../pisellPhone/PisellPhone.js";
14
- import "../../pisellPhone/index.js";
15
9
  import PisellEmail_default from "../../pisellEmail/PisellEmail.js";
16
- import "../../pisellEmail/index.js";
17
10
  import PisellUrl_default from "../../pisellUrl/PisellUrl.js";
18
- import "../../pisellUrl/index.js";
19
11
  import PisellRating_default from "../../pisellRating/PisellRating.js";
20
- import "../../pisellRating/index.js";
21
12
  import PisellSingleSelect from "../../pisellSingleSelect/PisellSingleSelect.js";
22
- import "../../pisellSingleSelect/index.js";
23
13
  import PisellMultipleSelect from "../../pisellMultipleSelect/PisellMultipleSelect.js";
24
- import "../../pisellMultipleSelect/index.js";
25
14
  import PisellDateTimeDisplay_default from "../../pisellDateTimeDisplay/PisellDateTimeDisplay.js";
26
15
  import React, { useEffect, useState } from "react";
27
16
  //#region src/components/pisellRecordBoard/utils/recordBoardColumns.tsx
package/es/index.js CHANGED
@@ -1,26 +1,15 @@
1
1
  import PisellContext, { globalConfig } from "./components/pisell-config-provider/context.js";
2
2
  import PisellSingleLineText_default from "./components/pisellSingleLineText/PisellSingleLineText.js";
3
- import "./components/pisellSingleLineText/index.js";
4
3
  import PisellLongText_default from "./components/pisellLongText/PisellLongText.js";
5
- import "./components/pisellLongText/index.js";
6
4
  import MemoizedPisellNumber from "./components/pisellNumber/PisellNumber.js";
7
- import "./components/pisellNumber/index.js";
8
5
  import MemoizedPisellCurrency from "./components/pisellCurrency/PisellCurrency.js";
9
- import "./components/pisellCurrency/index.js";
10
6
  import MemoizedPisellPercent from "./components/pisellPercent/PisellPercent.js";
11
- import "./components/pisellPercent/index.js";
12
7
  import PisellPhone_default from "./components/pisellPhone/PisellPhone.js";
13
- import "./components/pisellPhone/index.js";
14
8
  import PisellEmail_default from "./components/pisellEmail/PisellEmail.js";
15
- import "./components/pisellEmail/index.js";
16
9
  import PisellUrl_default from "./components/pisellUrl/PisellUrl.js";
17
- import "./components/pisellUrl/index.js";
18
10
  import PisellRating_default from "./components/pisellRating/PisellRating.js";
19
- import "./components/pisellRating/index.js";
20
11
  import PisellSingleSelect from "./components/pisellSingleSelect/PisellSingleSelect.js";
21
- import "./components/pisellSingleSelect/index.js";
22
12
  import PisellMultipleSelect from "./components/pisellMultipleSelect/PisellMultipleSelect.js";
23
- import "./components/pisellMultipleSelect/index.js";
24
13
  import PisellFields from "./components/PisellFields/index.js";
25
14
  import PisellCard from "./components/pisellCard/index.js";
26
15
  import PisellMetricCard from "./components/pisellMetricCard/PisellMetricCard.js";