@pisell/materials 6.11.252 → 6.11.254
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/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/PisellProcedure/components/ProcedureHeader.d.ts +37 -0
- package/es/components/PisellProcedure/components/ProcedureHeader.js +3 -3
- package/es/components/PisellSelectionFlow/PisellSelectionFlow.d.ts +7 -0
- package/es/components/PisellSelectionFlow/PisellSelectionFlow.js +392 -0
- package/es/components/PisellSelectionFlow/compiler.d.ts +12 -0
- package/es/components/PisellSelectionFlow/compiler.js +174 -0
- package/es/components/PisellSelectionFlow/context.d.ts +9 -0
- package/es/components/PisellSelectionFlow/context.js +12 -0
- package/es/components/PisellSelectionFlow/hooks/useFlowDraft.js +35 -0
- package/es/components/PisellSelectionFlow/hooks/useFlowModuleLifecycle.js +236 -0
- package/es/components/PisellSelectionFlow/hooks/useFlowNavigation.js +320 -0
- package/es/components/PisellSelectionFlow/index.d.ts +4 -0
- package/es/components/PisellSelectionFlow/types.d.ts +179 -0
- package/es/components/PisellSelectionFlow/types.js +10 -0
- package/es/components/PisellSelectionFlow/utils.js +15 -0
- package/es/components/PisellSuperTabs/PisellSuperTabs.js +2 -1
- package/es/components/PisellSuperTabs/types.d.ts +3 -1
- package/es/components/PisellTabbar/PisellTabbar.js +24 -14
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.js +1 -0
- package/es/components/pisellLookup/PisellLookup.less +2 -0
- package/es/components/productCard/cartSkuCard/index.js +17 -10
- package/es/components/productCard/lineItem/BookingLineItem.js +24 -11
- package/es/components/productCard/lineItem/components/Holders/index.js +19 -3
- package/es/components/productCard/lineItem/components/Holders/index.less +4 -0
- package/es/components/productCard/lineItem/index.js +4 -1
- package/es/components/productCard/lineItem/index.less +34 -4
- package/es/components/productCard/types.d.ts +2 -0
- package/es/index.d.ts +15 -10
- package/es/index.js +6 -1
- package/lib/components/PisellProcedure/components/ProcedureHeader.d.ts +37 -0
- package/lib/components/PisellProcedure/components/ProcedureHeader.js +3 -3
- package/lib/components/PisellSelectionFlow/PisellSelectionFlow.d.ts +7 -0
- package/lib/components/PisellSelectionFlow/PisellSelectionFlow.js +394 -0
- package/lib/components/PisellSelectionFlow/compiler.d.ts +12 -0
- package/lib/components/PisellSelectionFlow/compiler.js +178 -0
- package/lib/components/PisellSelectionFlow/context.d.ts +9 -0
- package/lib/components/PisellSelectionFlow/context.js +16 -0
- package/lib/components/PisellSelectionFlow/hooks/useFlowDraft.js +36 -0
- package/lib/components/PisellSelectionFlow/hooks/useFlowModuleLifecycle.js +237 -0
- package/lib/components/PisellSelectionFlow/hooks/useFlowNavigation.js +321 -0
- package/lib/components/PisellSelectionFlow/index.d.ts +4 -0
- package/lib/components/PisellSelectionFlow/types.d.ts +179 -0
- package/lib/components/PisellSelectionFlow/types.js +10 -0
- package/lib/components/PisellSelectionFlow/utils.js +18 -0
- package/lib/components/PisellSuperTabs/PisellSuperTabs.js +2 -1
- package/lib/components/PisellSuperTabs/types.d.ts +3 -1
- package/lib/components/PisellTabbar/PisellTabbar.js +24 -14
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.js +1 -0
- package/lib/components/pisellLookup/PisellLookup.less +2 -0
- package/lib/components/productCard/cartSkuCard/index.js +17 -10
- package/lib/components/productCard/lineItem/BookingLineItem.js +24 -11
- package/lib/components/productCard/lineItem/components/Holders/index.js +19 -3
- package/lib/components/productCard/lineItem/components/Holders/index.less +4 -0
- package/lib/components/productCard/lineItem/index.js +4 -1
- package/lib/components/productCard/lineItem/index.less +34 -4
- package/lib/components/productCard/types.d.ts +2 -0
- package/lib/index.d.ts +15 -10
- package/lib/index.js +17 -2
- package/package.json +1 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/PisellSelectionFlow/types.d.ts
|
|
4
|
+
/** 原子 Flow 只透传元数据,具体结构及展示方式完全由宿主定义。 */
|
|
5
|
+
type SelectionFlowMetadata = Readonly<Record<string, unknown>>;
|
|
6
|
+
interface SelectionFlowModuleConfig<TModuleType extends string = string> {
|
|
7
|
+
type: TModuleType;
|
|
8
|
+
key?: string;
|
|
9
|
+
meta?: SelectionFlowMetadata;
|
|
10
|
+
options?: Readonly<Record<string, unknown>>;
|
|
11
|
+
}
|
|
12
|
+
type SelectionFlowModuleInput<TModuleType extends string = string> = TModuleType | SelectionFlowModuleConfig<TModuleType>;
|
|
13
|
+
interface SelectionFlowStepConfig<TModuleType extends string = string> {
|
|
14
|
+
key: string;
|
|
15
|
+
meta?: SelectionFlowMetadata;
|
|
16
|
+
modules: readonly SelectionFlowModuleInput<TModuleType>[];
|
|
17
|
+
}
|
|
18
|
+
interface CompiledSelectionFlowModuleConfig<TModuleType extends string = string> extends Omit<SelectionFlowModuleConfig<TModuleType>, 'key'> {
|
|
19
|
+
key: string;
|
|
20
|
+
stepKey: string;
|
|
21
|
+
stepIndex: number;
|
|
22
|
+
moduleIndex: number;
|
|
23
|
+
}
|
|
24
|
+
interface CompiledSelectionFlowStep<TModuleType extends string = string> extends Omit<SelectionFlowStepConfig<TModuleType>, 'modules'> {
|
|
25
|
+
index: number;
|
|
26
|
+
modules: readonly CompiledSelectionFlowModuleConfig<TModuleType>[];
|
|
27
|
+
}
|
|
28
|
+
interface SelectionFlowDraftAdapter<TDraft, TDraftUpdate, TField extends string> {
|
|
29
|
+
/** 业务 Draft 可能包含嵌套对象,合并规则由宿主定义,原子 Flow 不做猜测。 */
|
|
30
|
+
applyUpdate: (draft: Readonly<TDraft>, update: TDraftUpdate) => TDraft;
|
|
31
|
+
/** 编译依赖图和运行时门禁统一通过该方法读取字段。 */
|
|
32
|
+
getFieldValue: (draft: Readonly<TDraft>, field: TField) => unknown;
|
|
33
|
+
/** 提交前按业务 Draft 结构创建快照;缺省时使用当前不可变引用。 */
|
|
34
|
+
createSnapshot?: (draft: Readonly<TDraft>) => TDraft;
|
|
35
|
+
}
|
|
36
|
+
interface SelectionFlowDraftUpdateMeta<TField extends string = string, TModuleType extends string = string> {
|
|
37
|
+
changedFields: readonly TField[];
|
|
38
|
+
sourceModuleKey?: string;
|
|
39
|
+
sourceModuleType?: TModuleType;
|
|
40
|
+
}
|
|
41
|
+
interface SelectionFlowDraftChange<TDraft, TField extends string = string, TModuleType extends string = string> extends SelectionFlowDraftUpdateMeta<TField, TModuleType> {
|
|
42
|
+
previousDraft: Readonly<TDraft>;
|
|
43
|
+
draft: Readonly<TDraft>;
|
|
44
|
+
}
|
|
45
|
+
type FlowModuleStatus = 'idle' | 'loading' | 'ready' | 'stale' | 'error';
|
|
46
|
+
interface FlowModuleState {
|
|
47
|
+
status: FlowModuleStatus;
|
|
48
|
+
/** 业务适配器产生的原始错误文案;原子状态机自身只写入 reason。 */
|
|
49
|
+
message?: string;
|
|
50
|
+
reason?: SelectionFlowRuntimeIssue;
|
|
51
|
+
error?: unknown;
|
|
52
|
+
}
|
|
53
|
+
type FlowModuleStateMap = Record<string, FlowModuleState>;
|
|
54
|
+
type FlowModuleDataMap = Record<string, unknown>;
|
|
55
|
+
type FlowModuleValidationResult = boolean | {
|
|
56
|
+
valid: boolean;
|
|
57
|
+
message?: string;
|
|
58
|
+
};
|
|
59
|
+
type FlowModuleValidationReturn = FlowModuleValidationResult | Promise<FlowModuleValidationResult>;
|
|
60
|
+
type FlowModuleBeforeLeaveResult = boolean | {
|
|
61
|
+
allowed: boolean;
|
|
62
|
+
message?: string;
|
|
63
|
+
};
|
|
64
|
+
type FlowModuleBeforeLeaveReturn = FlowModuleBeforeLeaveResult | Promise<FlowModuleBeforeLeaveResult>;
|
|
65
|
+
interface FlowModuleHandle {
|
|
66
|
+
validate?: () => FlowModuleValidationReturn;
|
|
67
|
+
beforeLeave?: () => FlowModuleBeforeLeaveReturn;
|
|
68
|
+
/** 业务模块可以继续扩展自己的命令式句柄。 */
|
|
69
|
+
[key: string]: unknown;
|
|
70
|
+
}
|
|
71
|
+
interface SelectionFlowContextValue<TDraft, TDraftUpdate, TField extends string = string, TModuleType extends string = string, TServices = unknown, THostContext = unknown> {
|
|
72
|
+
draft: TDraft;
|
|
73
|
+
updateDraft: (update: TDraftUpdate, meta: SelectionFlowDraftUpdateMeta<TField, TModuleType>) => void;
|
|
74
|
+
moduleState: FlowModuleStateMap;
|
|
75
|
+
setModuleState: (moduleKey: string, state: FlowModuleState) => void;
|
|
76
|
+
setModuleStatus: (moduleKey: string, status: FlowModuleStatus, message?: string, error?: unknown) => void;
|
|
77
|
+
moduleData: FlowModuleDataMap;
|
|
78
|
+
getModuleData: <T = unknown>(moduleKey: string) => T | undefined;
|
|
79
|
+
setModuleData: <T = unknown>(moduleKey: string, value: T) => void;
|
|
80
|
+
clearModuleData: (moduleKey: string) => void;
|
|
81
|
+
steps: readonly CompiledSelectionFlowStep<TModuleType>[];
|
|
82
|
+
currentStepIndex: number;
|
|
83
|
+
currentStep?: CompiledSelectionFlowStep<TModuleType>;
|
|
84
|
+
hostContext?: THostContext;
|
|
85
|
+
services: TServices;
|
|
86
|
+
}
|
|
87
|
+
interface SelectionFlowModuleAdapter<TDraft, TDraftUpdate, TField extends string = string, TModuleType extends string = string, TServices = unknown, THostContext = unknown> {
|
|
88
|
+
type: TModuleType;
|
|
89
|
+
/** 离开所在步骤后仍需随 Draft 变化保持就绪的无界面门禁模块。 */
|
|
90
|
+
initializeWhileInactive?: boolean;
|
|
91
|
+
provides?: readonly TField[];
|
|
92
|
+
hardRequires?: readonly TField[];
|
|
93
|
+
refreshOn?: readonly TField[];
|
|
94
|
+
shouldRefresh?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, change: SelectionFlowDraftChange<TDraft, TField, TModuleType>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => boolean;
|
|
95
|
+
isApplicable?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => boolean;
|
|
96
|
+
canInitialize?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => boolean | Promise<boolean>;
|
|
97
|
+
refresh?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => void | Promise<void>;
|
|
98
|
+
reconcile?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, change: SelectionFlowDraftChange<TDraft, TField, TModuleType>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => void | Promise<void>;
|
|
99
|
+
clearDependencies?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, change: SelectionFlowDraftChange<TDraft, TField, TModuleType>, module: CompiledSelectionFlowModuleConfig<TModuleType>) => void | Promise<void>;
|
|
100
|
+
validate?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, handle: FlowModuleHandle | null, module: CompiledSelectionFlowModuleConfig<TModuleType>) => FlowModuleValidationReturn;
|
|
101
|
+
beforeLeave?: (context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>, handle: FlowModuleHandle | null, module: CompiledSelectionFlowModuleConfig<TModuleType>) => FlowModuleBeforeLeaveReturn;
|
|
102
|
+
}
|
|
103
|
+
type SelectionFlowModuleRegistry<TDraft, TDraftUpdate, TField extends string, TModuleType extends string, TServices = unknown, THostContext = unknown> = Record<TModuleType, SelectionFlowModuleAdapter<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>>;
|
|
104
|
+
interface SelectionFlowSnapshot<TDraft, TModuleType extends string = string> {
|
|
105
|
+
draft: TDraft;
|
|
106
|
+
currentStepIndex: number;
|
|
107
|
+
currentStep?: CompiledSelectionFlowStep<TModuleType>;
|
|
108
|
+
steps: readonly CompiledSelectionFlowStep<TModuleType>[];
|
|
109
|
+
moduleState: FlowModuleStateMap;
|
|
110
|
+
moduleData: FlowModuleDataMap;
|
|
111
|
+
isCompleting: boolean;
|
|
112
|
+
isCompleted: boolean;
|
|
113
|
+
configurationError: SelectionFlowCompileError | null;
|
|
114
|
+
}
|
|
115
|
+
interface SelectionFlowRef<TDraft, TDraftUpdate, TField extends string = string, TModuleType extends string = string> {
|
|
116
|
+
next: () => Promise<boolean>;
|
|
117
|
+
back: () => boolean;
|
|
118
|
+
updateDraft: (update: TDraftUpdate, meta: SelectionFlowDraftUpdateMeta<TField, TModuleType>) => void;
|
|
119
|
+
validateCurrentStep: () => Promise<boolean>;
|
|
120
|
+
complete: () => Promise<boolean>;
|
|
121
|
+
getState: () => SelectionFlowSnapshot<TDraft, TModuleType>;
|
|
122
|
+
}
|
|
123
|
+
type SelectionFlowMessageCode = 'dependencies-reconciling' | 'waiting-field' | 'prerequisites-not-ready' | 'selection-changed-validation' | 'module-validation-failed' | 'selection-changed-confirmation' | 'previous-step-review' | 'changed-review' | 'current-step-review' | 'changed-confirm-again';
|
|
124
|
+
interface SelectionFlowRuntimeIssue {
|
|
125
|
+
code: SelectionFlowMessageCode;
|
|
126
|
+
params?: Readonly<Record<string, unknown>>;
|
|
127
|
+
}
|
|
128
|
+
interface SelectionFlowValidationFeedback {
|
|
129
|
+
message?: string;
|
|
130
|
+
reason?: SelectionFlowRuntimeIssue;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Headless Flow 暴露给宿主渲染层的完整控制器。原子层只维护状态和动作,
|
|
134
|
+
* 不决定步骤、模块、错误或按钮应该如何展示。
|
|
135
|
+
*/
|
|
136
|
+
interface PisellSelectionFlowController<TDraft, TDraftUpdate, TField extends string, TModuleType extends string, TServices = unknown, THostContext = unknown> extends SelectionFlowSnapshot<TDraft, TModuleType> {
|
|
137
|
+
context: SelectionFlowContextValue<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>;
|
|
138
|
+
completionError?: string;
|
|
139
|
+
completionReason?: SelectionFlowRuntimeIssue;
|
|
140
|
+
updateDraft: (update: TDraftUpdate, meta: SelectionFlowDraftUpdateMeta<TField, TModuleType>) => void;
|
|
141
|
+
validateCurrentStep: () => Promise<boolean>;
|
|
142
|
+
complete: () => Promise<boolean>;
|
|
143
|
+
next: () => Promise<boolean>;
|
|
144
|
+
back: () => boolean;
|
|
145
|
+
getState: () => SelectionFlowSnapshot<TDraft, TModuleType>;
|
|
146
|
+
registerModuleHandle: (moduleKey: string, handle: FlowModuleHandle | null) => void;
|
|
147
|
+
getModuleHandle: (moduleKey: string) => FlowModuleHandle | undefined;
|
|
148
|
+
}
|
|
149
|
+
interface PisellSelectionFlowProps<TDraft, TDraftUpdate, TField extends string, TModuleType extends string, TServices = unknown, THostContext = unknown> {
|
|
150
|
+
registry: SelectionFlowModuleRegistry<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>;
|
|
151
|
+
draftAdapter: SelectionFlowDraftAdapter<TDraft, TDraftUpdate, TField>;
|
|
152
|
+
steps: readonly SelectionFlowStepConfig<TModuleType>[];
|
|
153
|
+
initialDraft: TDraft;
|
|
154
|
+
initialStepIndex?: number;
|
|
155
|
+
hostContext?: THostContext;
|
|
156
|
+
services: TServices;
|
|
157
|
+
children: (controller: PisellSelectionFlowController<TDraft, TDraftUpdate, TField, TModuleType, TServices, THostContext>) => React.ReactNode;
|
|
158
|
+
onDraftChange?: (draft: TDraft) => void;
|
|
159
|
+
onStepChange?: (stepIndex: number, step: CompiledSelectionFlowStep<TModuleType>) => void;
|
|
160
|
+
onCompiledStepsChange?: (steps: readonly CompiledSelectionFlowStep<TModuleType>[]) => void;
|
|
161
|
+
onValidationFailed?: (module: CompiledSelectionFlowModuleConfig<TModuleType>, feedback?: SelectionFlowValidationFeedback) => void;
|
|
162
|
+
onConfigurationError?: (error: SelectionFlowCompileError) => void;
|
|
163
|
+
onComplete: (draft: TDraft) => boolean | void | Promise<boolean | void>;
|
|
164
|
+
}
|
|
165
|
+
type SelectionFlowCompileIssueCode = 'EMPTY_FLOW' | 'EMPTY_STEP' | 'DUPLICATE_STEP_KEY' | 'DUPLICATE_MODULE_KEY' | 'UNKNOWN_MODULE' | 'MISSING_HARD_REQUIREMENT' | 'INVALID_DEPENDENCY_ORDER' | 'CIRCULAR_HARD_REQUIREMENT' | 'APPLICABILITY_CHECK_FAILED';
|
|
166
|
+
interface SelectionFlowCompileIssue<TField extends string = string> {
|
|
167
|
+
code: SelectionFlowCompileIssueCode;
|
|
168
|
+
message: string;
|
|
169
|
+
stepKey?: string;
|
|
170
|
+
moduleKey?: string;
|
|
171
|
+
moduleType?: string;
|
|
172
|
+
requirementField?: TField;
|
|
173
|
+
}
|
|
174
|
+
declare class SelectionFlowCompileError extends Error {
|
|
175
|
+
readonly issues: readonly SelectionFlowCompileIssue[];
|
|
176
|
+
constructor(issues: readonly SelectionFlowCompileIssue[]);
|
|
177
|
+
}
|
|
178
|
+
//#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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/components/PisellSelectionFlow/types.ts
|
|
2
|
+
var SelectionFlowCompileError = class extends Error {
|
|
3
|
+
constructor(issues) {
|
|
4
|
+
super(issues.map((issue) => issue.message).join("\n"));
|
|
5
|
+
this.name = "SelectionFlowCompileError";
|
|
6
|
+
this.issues = issues;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.SelectionFlowCompileError = SelectionFlowCompileError;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/components/PisellSelectionFlow/utils.ts
|
|
2
|
+
const getCompiledStepsFingerprint = (steps) => steps.map((step) => `${step.key}:${step.modules.map((module) => `${module.key}:${module.type}`).join(",")}`).join("|");
|
|
3
|
+
const getSelectionFlowErrorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
4
|
+
const normalizeFlowValidationResult = (result) => {
|
|
5
|
+
if (typeof result === "undefined") return { valid: true };
|
|
6
|
+
if (typeof result === "boolean") return { valid: result };
|
|
7
|
+
return result;
|
|
8
|
+
};
|
|
9
|
+
const normalizeFlowBeforeLeaveResult = (result) => {
|
|
10
|
+
if (typeof result === "undefined") return { allowed: true };
|
|
11
|
+
if (typeof result === "boolean") return { allowed: result };
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.getCompiledStepsFingerprint = getCompiledStepsFingerprint;
|
|
16
|
+
exports.getSelectionFlowErrorMessage = getSelectionFlowErrorMessage;
|
|
17
|
+
exports.normalizeFlowBeforeLeaveResult = normalizeFlowBeforeLeaveResult;
|
|
18
|
+
exports.normalizeFlowValidationResult = normalizeFlowValidationResult;
|
|
@@ -20,7 +20,7 @@ const EMPTY_SCROLL_VIEW_PROPS = {};
|
|
|
20
20
|
*/
|
|
21
21
|
const PisellSuperTabs = (props, ref) => {
|
|
22
22
|
var _scrollViewProps$scro, _scrollViewProps$scro2, _scrollViewProps$snap, _scrollViewProps$snap2;
|
|
23
|
-
const { className, style, dataSource = [], rowKey = "key", value, id, defaultValue, onChange, renderItem, gridProps = EMPTY_GRID_PROPS, scrollViewProps = EMPTY_SCROLL_VIEW_PROPS, children, slotLeft, slotRight, slotTop, slotBottom, tabItemClassName, tabItemStyle, slotLeftClassName, slotRightClassName, slotTopClassName, slotBottomClassName, slotLeftStyle, slotRightStyle, slotTopStyle, slotBottomStyle, isControlled = true, __designMode } = props;
|
|
23
|
+
const { className, style, dataSource = [], rowKey = "key", value, id, defaultValue, onChange, renderItem, gridProps = EMPTY_GRID_PROPS, scrollViewProps = EMPTY_SCROLL_VIEW_PROPS, children, slotLeft, slotRight, slotTop, slotBottom, slotBottomRef, tabItemClassName, tabItemStyle, slotLeftClassName, slotRightClassName, slotTopClassName, slotBottomClassName, slotLeftStyle, slotRightStyle, slotTopStyle, slotBottomStyle, isControlled = true, __designMode } = props;
|
|
24
24
|
const containerRef = (0, react.useRef)(null);
|
|
25
25
|
const scrollViewRef = (0, react.useRef)(null);
|
|
26
26
|
const { activeKey, handleTabChange } = require_useTabsState.useTabsState({
|
|
@@ -119,6 +119,7 @@ const PisellSuperTabs = (props, ref) => {
|
|
|
119
119
|
className: (0, classnames.default)("pisell-super-tabs-slot-right-" + id, slotRightClassName),
|
|
120
120
|
style: slotRightStyle
|
|
121
121
|
}, slotRight), /* @__PURE__ */ react.default.createElement("div", {
|
|
122
|
+
ref: slotBottomRef,
|
|
122
123
|
className: (0, classnames.default)("pisell-super-tabs-slot-bottom-" + id, slotBottomClassName),
|
|
123
124
|
style: slotBottomStyle
|
|
124
125
|
}, slotBottom));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PisellBasicGridProps } from "../PisellBasicGrid/types.js";
|
|
2
2
|
import { PisellScrollViewProps } from "../PisellScrollView/types.js";
|
|
3
3
|
import { PisellBasicCardProps } from "../PisellCards/types.js";
|
|
4
|
-
import { CSSProperties, ReactNode } from "react";
|
|
4
|
+
import { CSSProperties, ReactNode, Ref } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/components/PisellSuperTabs/types.d.ts
|
|
7
7
|
/**
|
|
@@ -150,6 +150,8 @@ interface PisellSuperTabsProps<T = any> {
|
|
|
150
150
|
* 底部插槽
|
|
151
151
|
*/
|
|
152
152
|
slotBottom?: ReactNode;
|
|
153
|
+
/** 底部插槽容器引用 */
|
|
154
|
+
slotBottomRef?: Ref<HTMLDivElement>;
|
|
153
155
|
slotBottomClassName?: string;
|
|
154
156
|
slotBottomStyle?: CSSProperties;
|
|
155
157
|
__designMode?: boolean;
|
|
@@ -63,6 +63,15 @@ const PisellTabbar = (0, react.forwardRef)((props, ref) => {
|
|
|
63
63
|
const { dataSource = (props === null || props === void 0 ? void 0 : props.__designMode) ? require_mock.default : require_mock.default, value, onChange, className, style, levelConfig: customLevelConfig, expandConfig: customExpandConfig, maxLevel = 3, onSearch, searchProps, level1Actions } = props;
|
|
64
64
|
const containerRef = (0, react.useRef)(null);
|
|
65
65
|
const tabbarIdRef = (0, react.useRef)(createTabbarId());
|
|
66
|
+
const bottomSlotRefs = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
67
|
+
const registerBottomSlot = (0, react.useCallback)((id, element) => {
|
|
68
|
+
if (element) bottomSlotRefs.current.set(id, element);
|
|
69
|
+
else bottomSlotRefs.current.delete(id);
|
|
70
|
+
}, []);
|
|
71
|
+
const getBottomSlot = (0, react.useCallback)((id) => {
|
|
72
|
+
var _bottomSlotRefs$curre;
|
|
73
|
+
return (_bottomSlotRefs$curre = bottomSlotRefs.current.get(id)) !== null && _bottomSlotRefs$curre !== void 0 ? _bottomSlotRefs$curre : null;
|
|
74
|
+
}, []);
|
|
66
75
|
const searchRef = (0, react.useRef)(null);
|
|
67
76
|
const { activeKey, setActiveKey, getActiveKey, _setActiveKey, setCacheActiveKey, resetActiveKey, getCacheActiveKey } = require_useActiveKey.default({
|
|
68
77
|
initialActiveKey: value || require_index$4.getDefaultActiveKey(dataSource, "id"),
|
|
@@ -239,6 +248,7 @@ const PisellTabbar = (0, react.forwardRef)((props, ref) => {
|
|
|
239
248
|
let _dataSource2 = panelProps2.dataSource.children || [];
|
|
240
249
|
if (_dataSource2.length) _dataSource2 = require_index$4.addDataSourceItemsByKey(_dataSource2, require_constants.LEVEL_ADD_ITEMS.level3);
|
|
241
250
|
const level3Config = getLevelConfig("level3");
|
|
251
|
+
const level3TabbarId = `${tabbarIdRef.current}-${panelProps2.dataSource.id}`;
|
|
242
252
|
/**
|
|
243
253
|
* 渲染三级 Tab 项
|
|
244
254
|
*/
|
|
@@ -249,14 +259,12 @@ const PisellTabbar = (0, react.forwardRef)((props, ref) => {
|
|
|
249
259
|
}
|
|
250
260
|
return /* @__PURE__ */ react.default.createElement(require_index$1.default.MultilevelCard, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, itemProps), {}, {
|
|
251
261
|
card: (cardProps) => renderLevelNNormalCard(cardProps, "level3"),
|
|
252
|
-
panelContainer: () =>
|
|
253
|
-
const selector = `.pisell-super-tabs-slot-bottom-${tabbarIdRef.current}-${panelProps2.dataSource.id}`;
|
|
254
|
-
return document.querySelector(selector);
|
|
255
|
-
}
|
|
262
|
+
panelContainer: () => getBottomSlot(level3TabbarId)
|
|
256
263
|
}));
|
|
257
264
|
};
|
|
258
265
|
return /* @__PURE__ */ react.default.createElement(require_index$2.default, {
|
|
259
|
-
id:
|
|
266
|
+
id: level3TabbarId,
|
|
267
|
+
slotBottomRef: (element) => registerBottomSlot(level3TabbarId, element),
|
|
260
268
|
tabItemStyle: {},
|
|
261
269
|
isControlled: true,
|
|
262
270
|
dataSource: _dataSource2,
|
|
@@ -292,6 +300,8 @@ const PisellTabbar = (0, react.forwardRef)((props, ref) => {
|
|
|
292
300
|
level3ScrollViewProps,
|
|
293
301
|
toggleExpand,
|
|
294
302
|
getLevelConfig,
|
|
303
|
+
getBottomSlot,
|
|
304
|
+
registerBottomSlot,
|
|
295
305
|
renderLevelNCard,
|
|
296
306
|
renderLevelNNormalCard
|
|
297
307
|
]);
|
|
@@ -303,6 +313,7 @@ const PisellTabbar = (0, react.forwardRef)((props, ref) => {
|
|
|
303
313
|
let _dataSource = panelProps.dataSource.children || [];
|
|
304
314
|
if (_dataSource.length) _dataSource = require_index$4.addDataSourceItemsByKey(_dataSource, require_constants.LEVEL_ADD_ITEMS.level2);
|
|
305
315
|
const level2Config = getLevelConfig("level2");
|
|
316
|
+
const level2TabbarId = `${tabbarIdRef.current}-${panelProps.dataSource.id}`;
|
|
306
317
|
/**
|
|
307
318
|
* 渲染二级 Tab 项
|
|
308
319
|
*/
|
|
@@ -318,14 +329,12 @@ const PisellTabbar = (0, react.forwardRef)((props, ref) => {
|
|
|
318
329
|
if (innerPanelProps === null || innerPanelProps === void 0 || (_innerPanelProps$data = innerPanelProps.dataSource) === null || _innerPanelProps$data === void 0 || (_innerPanelProps$data = _innerPanelProps$data.children) === null || _innerPanelProps$data === void 0 ? void 0 : _innerPanelProps$data.length) return renderLevel3(innerPanelProps);
|
|
319
330
|
return null;
|
|
320
331
|
},
|
|
321
|
-
panelContainer: () =>
|
|
322
|
-
const selector = `.pisell-super-tabs-slot-bottom-${tabbarIdRef.current}-${panelProps.dataSource.id}`;
|
|
323
|
-
return document.querySelector(selector);
|
|
324
|
-
}
|
|
332
|
+
panelContainer: () => getBottomSlot(level2TabbarId)
|
|
325
333
|
}));
|
|
326
334
|
};
|
|
327
335
|
return /* @__PURE__ */ react.default.createElement(require_index$2.default, {
|
|
328
|
-
id:
|
|
336
|
+
id: level2TabbarId,
|
|
337
|
+
slotBottomRef: (element) => registerBottomSlot(level2TabbarId, element),
|
|
329
338
|
tabItemStyle: {},
|
|
330
339
|
dataSource: _dataSource,
|
|
331
340
|
value: level2Value,
|
|
@@ -361,6 +370,8 @@ const PisellTabbar = (0, react.forwardRef)((props, ref) => {
|
|
|
361
370
|
level2ScrollViewProps,
|
|
362
371
|
toggleExpand,
|
|
363
372
|
getLevelConfig,
|
|
373
|
+
getBottomSlot,
|
|
374
|
+
registerBottomSlot,
|
|
364
375
|
renderLevelNCard,
|
|
365
376
|
renderLevelNNormalCard,
|
|
366
377
|
renderLevel3
|
|
@@ -442,10 +453,7 @@ const PisellTabbar = (0, react.forwardRef)((props, ref) => {
|
|
|
442
453
|
if (panelProps === null || panelProps === void 0 || (_panelProps$dataSourc = panelProps.dataSource) === null || _panelProps$dataSourc === void 0 || (_panelProps$dataSourc = _panelProps$dataSourc.children) === null || _panelProps$dataSourc === void 0 ? void 0 : _panelProps$dataSourc.length) return renderLevel2(panelProps);
|
|
443
454
|
return null;
|
|
444
455
|
},
|
|
445
|
-
panelContainer: () =>
|
|
446
|
-
const selector = `.pisell-super-tabs-slot-bottom-${tabbarIdRef.current}`;
|
|
447
|
-
return document.querySelector(selector);
|
|
448
|
-
}
|
|
456
|
+
panelContainer: () => getBottomSlot(tabbarIdRef.current)
|
|
449
457
|
}));
|
|
450
458
|
});
|
|
451
459
|
const level1Config = (0, react.useMemo)(() => getLevelConfig("level1"), [getLevelConfig]);
|
|
@@ -458,6 +466,7 @@ const PisellTabbar = (0, react.forwardRef)((props, ref) => {
|
|
|
458
466
|
}, /* @__PURE__ */ react.default.createElement(require_index$2.default, {
|
|
459
467
|
isControlled: true,
|
|
460
468
|
id: tabbarIdRef.current,
|
|
469
|
+
slotBottomRef: (element) => registerBottomSlot(tabbarIdRef.current, element),
|
|
461
470
|
tabItemStyle: {},
|
|
462
471
|
dataSource: level1DataSource,
|
|
463
472
|
value: level1Value,
|
|
@@ -486,6 +495,7 @@ const PisellTabbar = (0, react.forwardRef)((props, ref) => {
|
|
|
486
495
|
level1Config,
|
|
487
496
|
level1Expand,
|
|
488
497
|
level1ScrollViewProps,
|
|
498
|
+
registerBottomSlot,
|
|
489
499
|
renderLevel1Item
|
|
490
500
|
]);
|
|
491
501
|
});
|
|
@@ -836,6 +836,7 @@ function PisellFloorMapLayoutInner(props, ref) {
|
|
|
836
836
|
initialPositionY,
|
|
837
837
|
minScale: zoomConfig.minScale,
|
|
838
838
|
maxScale: zoomConfig.maxScale,
|
|
839
|
+
disablePadding: true,
|
|
839
840
|
limitToBounds: pan.boundary !== "none"
|
|
840
841
|
}, { step: zoomConfig.step }), {}, {
|
|
841
842
|
panning: {
|
|
@@ -41,6 +41,8 @@ const _excluded = [
|
|
|
41
41
|
"isShowEditProduct",
|
|
42
42
|
"disabledClick",
|
|
43
43
|
"disabledEditClick",
|
|
44
|
+
"disabledNoteEdit",
|
|
45
|
+
"externalNoteEditor",
|
|
44
46
|
"onEditProduct",
|
|
45
47
|
"onAction",
|
|
46
48
|
"onDelete",
|
|
@@ -62,7 +64,7 @@ const _excluded = [
|
|
|
62
64
|
const PREFIX = "pisell-cart-sku-card";
|
|
63
65
|
const CartSkuCard = (props) => {
|
|
64
66
|
var _context$appHelper$ut;
|
|
65
|
-
const { dataSource = require_status.defaultValue.dataSource, isShowImage = require_status.defaultValue.isShowImage, isShowQuantityBadge = true, isShowOriginalPrice = require_status.defaultValue.isShowOriginalPrice, isShowHolder = require_status.defaultValue.isShowHolder, isShowNote = require_status.defaultValue.isShowNote, isShowDelete = require_status.defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowAmountFooter = require_status.defaultValue.isShowAmountFooter, isShowPackageNote = require_status.defaultValue.isShowPackageNote, isShowEditProduct = require_status.defaultValue.isShowEditProduct, disabledClick = require_status.defaultValue.disabledClick, disabledEditClick = require_status.defaultValue.disabledEditClick, onEditProduct, onAction, onDelete, onNote, onLike, onCard, onChangeResource, onPromotion, onGift, onChangeHolder, itemType = "product", type, rightActions = [], rightActionsDisplay = "swipe", escapeDom, maxSpecsCount = 1, isShowRelatedProduct = true } = props, other = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
|
|
67
|
+
const { dataSource = require_status.defaultValue.dataSource, isShowImage = require_status.defaultValue.isShowImage, isShowQuantityBadge = true, isShowOriginalPrice = require_status.defaultValue.isShowOriginalPrice, isShowHolder = require_status.defaultValue.isShowHolder, isShowNote = require_status.defaultValue.isShowNote, isShowDelete = require_status.defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowAmountFooter = require_status.defaultValue.isShowAmountFooter, isShowPackageNote = require_status.defaultValue.isShowPackageNote, isShowEditProduct = require_status.defaultValue.isShowEditProduct, disabledClick = require_status.defaultValue.disabledClick, disabledEditClick = require_status.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 = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
|
|
66
68
|
const useOpenNoteRef = (0, react.useRef)();
|
|
67
69
|
const context = require_useEngineContext.default();
|
|
68
70
|
_pisell_utils.locales.init(require_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");
|
|
@@ -106,6 +108,14 @@ const CartSkuCard = (props) => {
|
|
|
106
108
|
const hideDivider = (0, react.useMemo)(() => {
|
|
107
109
|
return false;
|
|
108
110
|
}, [dataSource]);
|
|
111
|
+
const openNoteEditor = () => {
|
|
112
|
+
var _useOpenNoteRef$curre;
|
|
113
|
+
if (externalNoteEditor) {
|
|
114
|
+
onNote === null || onNote === void 0 || onNote(dataSource);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
(_useOpenNoteRef$curre = useOpenNoteRef.current) === null || _useOpenNoteRef$curre === void 0 || _useOpenNoteRef$curre.open({ item: dataSource });
|
|
118
|
+
};
|
|
109
119
|
/**
|
|
110
120
|
* @description: 营销活动
|
|
111
121
|
* @param {*} useMemo
|
|
@@ -131,9 +141,8 @@ const CartSkuCard = (props) => {
|
|
|
131
141
|
maxSpecsCount
|
|
132
142
|
})), /* @__PURE__ */ react.default.createElement(require_index$3.default, { dataSource }), renderPromotion, isShowNote ? /* @__PURE__ */ react.default.createElement(require_index$9.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, other), {}, {
|
|
133
143
|
item: dataSource,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
144
|
+
disabledEdit: disabledNoteEdit !== null && disabledNoteEdit !== void 0 ? disabledNoteEdit : other.disabledEdit,
|
|
145
|
+
openNote: openNoteEditor
|
|
137
146
|
})) : null);
|
|
138
147
|
};
|
|
139
148
|
const renderA5 = () => {
|
|
@@ -173,9 +182,8 @@ const CartSkuCard = (props) => {
|
|
|
173
182
|
type: "total"
|
|
174
183
|
}) : null, renderPromotion, isShowNote ? /* @__PURE__ */ react.default.createElement(require_index$9.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, other), {}, {
|
|
175
184
|
item: dataSource,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
185
|
+
disabledEdit: disabledNoteEdit !== null && disabledNoteEdit !== void 0 ? disabledNoteEdit : other.disabledEdit,
|
|
186
|
+
openNote: openNoteEditor
|
|
179
187
|
})) : null, isShowAction && actionText ? /* @__PURE__ */ react.default.createElement(require_index$1.default, {
|
|
180
188
|
item: dataSource,
|
|
181
189
|
onAction: () => onAction === null || onAction === void 0 ? void 0 : onAction(dataSource)
|
|
@@ -210,9 +218,8 @@ const CartSkuCard = (props) => {
|
|
|
210
218
|
type: "total"
|
|
211
219
|
}) : null, /* @__PURE__ */ react.default.createElement(require_index$3.default, { dataSource }), renderPromotion, isShowNote ? /* @__PURE__ */ react.default.createElement(require_index$9.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, other), {}, {
|
|
212
220
|
item: dataSource,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
221
|
+
disabledEdit: disabledNoteEdit !== null && disabledNoteEdit !== void 0 ? disabledNoteEdit : other.disabledEdit,
|
|
222
|
+
openNote: openNoteEditor
|
|
216
223
|
})) : null);
|
|
217
224
|
};
|
|
218
225
|
const renderContent = () => {
|
|
@@ -41,11 +41,13 @@ const _excluded = [
|
|
|
41
41
|
"isShowAmountFooter",
|
|
42
42
|
"disabledClick",
|
|
43
43
|
"disabledEdit",
|
|
44
|
+
"disabledNoteEdit",
|
|
44
45
|
"statusOptions",
|
|
45
46
|
"statusLoading",
|
|
46
47
|
"statusDisabled",
|
|
47
48
|
"isShowRelatedProduct",
|
|
48
49
|
"holderOptions",
|
|
50
|
+
"onAssignHolder",
|
|
49
51
|
"onBookingStatusChange",
|
|
50
52
|
"onAddTimeProductCard",
|
|
51
53
|
"onAction",
|
|
@@ -67,7 +69,7 @@ const getStatusOption = (status, statusOptions = []) => {
|
|
|
67
69
|
};
|
|
68
70
|
const BookingLineItem = (props) => {
|
|
69
71
|
var _ref, _ref2, _dataSource$promotion, _dataSource$giftData;
|
|
70
|
-
const { dataSource, type, cartSkuType, isShowBookingHeader, relatedProductDataSource, addTimeProductDataSources = [], rightActions = [], rightActionsDisplay = "swipe", escapeDom, isShowImage, isShowQuantityBadge = true, isFormSubject, isShowDelete, isShowInlineDelete = isShowDelete, isShowNote, isShowAmountFooter, disabledClick, disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAddTimeProductCard, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
|
|
72
|
+
const { dataSource, type, cartSkuType, isShowBookingHeader, relatedProductDataSource, addTimeProductDataSources = [], rightActions = [], rightActionsDisplay = "swipe", escapeDom, isShowImage, isShowQuantityBadge = true, isFormSubject, isShowDelete, isShowInlineDelete = isShowDelete, isShowNote, isShowAmountFooter, disabledClick, disabledEdit, disabledNoteEdit = disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onAssignHolder, onBookingStatusChange, onAddTimeProductCard, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
|
|
71
73
|
const shouldRenderRelatedProduct = isShowRelatedProduct && Boolean(relatedProductDataSource);
|
|
72
74
|
const [isAddTimeProductsExpanded, setIsAddTimeProductsExpanded] = (0, react.useState)(false);
|
|
73
75
|
const { isShowAction, actionText } = dataSource;
|
|
@@ -88,7 +90,8 @@ const BookingLineItem = (props) => {
|
|
|
88
90
|
onDelete === null || onDelete === void 0 || onDelete(dataSource);
|
|
89
91
|
}
|
|
90
92
|
};
|
|
91
|
-
const
|
|
93
|
+
const showDeleteInRelatedProduct = isShowDelete && rightActionsDisplay === "inline" && shouldRenderRelatedProduct && !(relatedProductDataSource === null || relatedProductDataSource === void 0 ? void 0 : relatedProductDataSource.isGift);
|
|
94
|
+
const bookingRightActions = isShowDelete && !showDeleteInRelatedProduct ? rightActionsDisplay === "inline" ? [...rightActions, deleteAction] : [deleteAction, ...rightActions] : rightActions;
|
|
92
95
|
const resolvedHolderOptions = (_ref = (_ref2 = holderOptions !== null && holderOptions !== void 0 ? holderOptions : dataSource === null || dataSource === void 0 ? void 0 : dataSource.holderOptions) !== null && _ref2 !== void 0 ? _ref2 : dataSource === null || dataSource === void 0 ? void 0 : dataSource.holders) !== null && _ref !== void 0 ? _ref : [];
|
|
93
96
|
const resolvedIsFormSubject = isFormSubject !== null && isFormSubject !== void 0 ? isFormSubject : dataSource === null || dataSource === void 0 ? void 0 : dataSource.isFormSubject;
|
|
94
97
|
const bookingTitle = String((dataSource === null || dataSource === void 0 ? void 0 : dataSource.booking_id) || "");
|
|
@@ -119,29 +122,29 @@ const BookingLineItem = (props) => {
|
|
|
119
122
|
const renderProductCard = (productDataSource, source, options = {}) => {
|
|
120
123
|
var _productDataSource$pr;
|
|
121
124
|
if (!productDataSource || (productDataSource === null || productDataSource === void 0 ? void 0 : productDataSource.isGift)) return null;
|
|
122
|
-
const { showProductPromotion = true } = options;
|
|
125
|
+
const { showProductPromotion = true, showAmountFooter = true, inlineActions = [] } = options;
|
|
123
126
|
const productPromotion = (productDataSource === null || productDataSource === void 0 || (_productDataSource$pr = productDataSource.promotions) === null || _productDataSource$pr === void 0 ? void 0 : _productDataSource$pr.length) ? /* @__PURE__ */ react.default.createElement(require_index$7.default, {
|
|
124
127
|
promotions: productDataSource.promotions,
|
|
125
128
|
onClick: (item) => onPromotion === null || onPromotion === void 0 ? void 0 : onPromotion(item)
|
|
126
129
|
}) : null;
|
|
127
|
-
return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(require_index$2.default, {
|
|
130
|
+
return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__product-main-row` }, /* @__PURE__ */ react.default.createElement(require_index$2.default, {
|
|
128
131
|
isShowImage,
|
|
129
132
|
isShowQuantityBadge,
|
|
130
133
|
dataSource: productDataSource,
|
|
131
134
|
type: cartSkuType,
|
|
132
135
|
maxSpecsCount: props.maxSpecsCount || 1
|
|
133
|
-
}), /* @__PURE__ */ react.default.createElement(require_index$3.default, {
|
|
136
|
+
}), inlineActions.length > 0 ? /* @__PURE__ */ react.default.createElement(require_index$9.default, { actions: inlineActions }) : null), /* @__PURE__ */ react.default.createElement(require_index$3.default, {
|
|
134
137
|
dataSource: productDataSource,
|
|
135
138
|
isShowImage,
|
|
136
139
|
isShowQuantityBadge,
|
|
137
140
|
type: cartSkuType
|
|
138
|
-
}), isShowAmountFooter ? /* @__PURE__ */ react.default.createElement(require_index$6.default, {
|
|
141
|
+
}), isShowAmountFooter && showAmountFooter ? /* @__PURE__ */ react.default.createElement(require_index$6.default, {
|
|
139
142
|
item: productDataSource,
|
|
140
143
|
hideDivider: false,
|
|
141
144
|
type: "total"
|
|
142
145
|
}) : null, showProductPromotion ? productPromotion : null, isShowNote ? /* @__PURE__ */ react.default.createElement(require_index$5.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, other), {}, {
|
|
143
146
|
item: productDataSource,
|
|
144
|
-
disabledEdit,
|
|
147
|
+
disabledEdit: disabledNoteEdit,
|
|
145
148
|
openNote: () => onNote === null || onNote === void 0 ? void 0 : onNote(source)
|
|
146
149
|
})) : null);
|
|
147
150
|
};
|
|
@@ -175,6 +178,7 @@ const BookingLineItem = (props) => {
|
|
|
175
178
|
}, _pisell_utils.locales.getText(isAddTimeProductsExpanded ? "pisell2.line-item.collapse" : "pisell2.line-item.show-all")) : null));
|
|
176
179
|
};
|
|
177
180
|
if (dataSource === null || dataSource === void 0 ? void 0 : dataSource.isGift) return null;
|
|
181
|
+
const shouldRenderFullWidthAmountFooter = rightActionsDisplay === "inline" && isShowAmountFooter && shouldRenderRelatedProduct;
|
|
178
182
|
const cardContent = /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", {
|
|
179
183
|
className: (0, classnames.default)(PREFIX, `${PREFIX}--booking`, `${PREFIX}--${type}`),
|
|
180
184
|
onClick: (e) => {
|
|
@@ -192,15 +196,24 @@ const BookingLineItem = (props) => {
|
|
|
192
196
|
onClick: ({ key }) => onBookingStatusChange === null || onBookingStatusChange === void 0 ? void 0 : onBookingStatusChange(String(key), dataSource)
|
|
193
197
|
},
|
|
194
198
|
trigger: ["click"]
|
|
195
|
-
}, renderStatusButton()) : renderStatusButton(), renderDeleteButton()))) : null, /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${PREFIX}__booking-detail`, { [`${PREFIX}__booking-detail--with-delete`]: !isShowBookingHeader && isShowInlineDelete }) }, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__booking-detail-content` }, /* @__PURE__ */ react.default.createElement(require_index$11.default, { dataSource }), /* @__PURE__ */ react.default.createElement(require_index$10.default, { dataSource }),
|
|
199
|
+
}, renderStatusButton()) : renderStatusButton(), renderDeleteButton()))) : null, /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${PREFIX}__booking-detail`, { [`${PREFIX}__booking-detail--with-delete`]: !isShowBookingHeader && isShowInlineDelete }) }, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__booking-detail-content` }, /* @__PURE__ */ react.default.createElement(require_index$11.default, { dataSource }), /* @__PURE__ */ react.default.createElement(require_index$10.default, { dataSource }), /* @__PURE__ */ react.default.createElement(require_index$12.default, {
|
|
196
200
|
dataSource,
|
|
197
201
|
holderOptions: resolvedHolderOptions,
|
|
198
|
-
isFormSubject: resolvedIsFormSubject
|
|
199
|
-
|
|
202
|
+
isFormSubject: resolvedIsFormSubject,
|
|
203
|
+
onAssignHolder
|
|
204
|
+
})), !isShowBookingHeader ? renderDeleteButton(true) : null), shouldRenderRelatedProduct ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(antd.Divider, { style: { margin: 0 } }), /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__related-product` }, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__related-product-card` }, renderProductCard(relatedProductDataSource, dataSource, {
|
|
205
|
+
showProductPromotion: false,
|
|
206
|
+
showAmountFooter: !shouldRenderFullWidthAmountFooter,
|
|
207
|
+
inlineActions: showDeleteInRelatedProduct ? [deleteAction] : []
|
|
208
|
+
}), renderPromotion, isShowAction && actionText ? /* @__PURE__ */ react.default.createElement(require_index$1.default, {
|
|
200
209
|
item: dataSource,
|
|
201
210
|
onAction: () => onAction === null || onAction === void 0 ? void 0 : onAction(dataSource)
|
|
202
211
|
}) : null))) : null, renderAddTimeProducts()));
|
|
203
|
-
return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${PREFIX}-wrapper-container`, { [`${PREFIX}-wrapper-container--inline`]: rightActionsDisplay === "inline" }) }, rightActionsDisplay === "inline" ? /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${PREFIX}-wrapper`, `${PREFIX}-wrapper--inline`) }, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}-inline-content` }, cardContent), /* @__PURE__ */ react.default.createElement(require_index$9.default, { actions: bookingRightActions })) : /* @__PURE__ */ react.default.createElement(require_index$
|
|
212
|
+
return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${PREFIX}-wrapper-container`, { [`${PREFIX}-wrapper-container--inline`]: rightActionsDisplay === "inline" }) }, rightActionsDisplay === "inline" ? /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${PREFIX}-wrapper`, `${PREFIX}-wrapper--inline`) }, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}-inline-main` }, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}-inline-content` }, cardContent), /* @__PURE__ */ react.default.createElement(require_index$9.default, { actions: bookingRightActions })), shouldRenderFullWidthAmountFooter ? /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__inline-amount-footer` }, /* @__PURE__ */ react.default.createElement(require_index$6.default, {
|
|
213
|
+
item: relatedProductDataSource,
|
|
214
|
+
hideDivider: false,
|
|
215
|
+
type: "total"
|
|
216
|
+
})) : null) : /* @__PURE__ */ react.default.createElement(require_index$4.SwipeAction, {
|
|
204
217
|
closeOnAction: false,
|
|
205
218
|
className: (0, classnames.default)(`${PREFIX}-wrapper`),
|
|
206
219
|
rightActions: bookingRightActions,
|
|
@@ -29,14 +29,30 @@ const pickHolderMaxCount = (dataSource, holderIds) => {
|
|
|
29
29
|
return Number(count) || 1;
|
|
30
30
|
};
|
|
31
31
|
const LineItemHolders = (props) => {
|
|
32
|
-
const { dataSource = {}, holderOptions = [], isFormSubject } = props;
|
|
32
|
+
const { dataSource = {}, holderOptions = [], isFormSubject, onAssignHolder } = props;
|
|
33
33
|
const holderIds = (0, react.useMemo)(() => normalizeHolderIds(pickHolderId(dataSource)), [dataSource]);
|
|
34
34
|
const holderMaxCount = pickHolderMaxCount(dataSource, holderIds);
|
|
35
|
-
const showUnassigned = Boolean(isFormSubject
|
|
35
|
+
const showUnassigned = isFormSubject !== void 0 ? Boolean(isFormSubject) : Boolean(dataSource === null || dataSource === void 0 ? void 0 : dataSource.isFormSubject);
|
|
36
36
|
const holderIcon = holderIconMap[(dataSource === null || dataSource === void 0 ? void 0 : dataSource.holderType) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.holder_type) || "minors"] || holderIconMap.minors;
|
|
37
37
|
if (!holderIds.length) {
|
|
38
38
|
if (!showUnassigned) return null;
|
|
39
|
-
return /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__holders` }, /* @__PURE__ */ react.default.createElement("div", {
|
|
39
|
+
return /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__holders` }, /* @__PURE__ */ react.default.createElement("div", {
|
|
40
|
+
className: "holder-item unassigned",
|
|
41
|
+
role: onAssignHolder ? "button" : void 0,
|
|
42
|
+
tabIndex: onAssignHolder ? 0 : void 0,
|
|
43
|
+
onClick: (event) => {
|
|
44
|
+
if (!onAssignHolder) return;
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
onAssignHolder();
|
|
48
|
+
},
|
|
49
|
+
onKeyDown: (event) => {
|
|
50
|
+
if (!onAssignHolder || !["Enter", " "].includes(event.key)) return;
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
onAssignHolder();
|
|
54
|
+
}
|
|
55
|
+
}, holderMaxCount > 1 ? /* @__PURE__ */ react.default.createElement("span", null, holderMaxCount, "/", holderMaxCount, " ") : null, /* @__PURE__ */ react.default.createElement("span", { className: "holder-label" }, _pisell_utils.locales.getText("pisell2.cart.sku-card.unassigned"))));
|
|
40
56
|
}
|
|
41
57
|
const renderHolder = (id, index) => {
|
|
42
58
|
const holder = holderOptions.find((item) => String(item.id) === String(id));
|