@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
|
+
export { SelectionFlowCompileError };
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export { getCompiledStepsFingerprint, getSelectionFlowErrorMessage, normalizeFlowBeforeLeaveResult, normalizeFlowValidationResult };
|
|
@@ -17,7 +17,7 @@ const EMPTY_SCROLL_VIEW_PROPS = {};
|
|
|
17
17
|
*/
|
|
18
18
|
const PisellSuperTabs = (props, ref) => {
|
|
19
19
|
var _scrollViewProps$scro, _scrollViewProps$scro2, _scrollViewProps$snap, _scrollViewProps$snap2;
|
|
20
|
-
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;
|
|
20
|
+
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;
|
|
21
21
|
const containerRef = useRef(null);
|
|
22
22
|
const scrollViewRef = useRef(null);
|
|
23
23
|
const { activeKey, handleTabChange } = useTabsState({
|
|
@@ -116,6 +116,7 @@ const PisellSuperTabs = (props, ref) => {
|
|
|
116
116
|
className: classNames("pisell-super-tabs-slot-right-" + id, slotRightClassName),
|
|
117
117
|
style: slotRightStyle
|
|
118
118
|
}, slotRight), /* @__PURE__ */ React.createElement("div", {
|
|
119
|
+
ref: slotBottomRef,
|
|
119
120
|
className: classNames("pisell-super-tabs-slot-bottom-" + id, slotBottomClassName),
|
|
120
121
|
style: slotBottomStyle
|
|
121
122
|
}, 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;
|
|
@@ -60,6 +60,15 @@ const PisellTabbar = forwardRef((props, ref) => {
|
|
|
60
60
|
const { dataSource = (props === null || props === void 0 ? void 0 : props.__designMode) ? mock_default : mock_default, value, onChange, className, style, levelConfig: customLevelConfig, expandConfig: customExpandConfig, maxLevel = 3, onSearch, searchProps, level1Actions } = props;
|
|
61
61
|
const containerRef = useRef(null);
|
|
62
62
|
const tabbarIdRef = useRef(createTabbarId());
|
|
63
|
+
const bottomSlotRefs = useRef(/* @__PURE__ */ new Map());
|
|
64
|
+
const registerBottomSlot = useCallback((id, element) => {
|
|
65
|
+
if (element) bottomSlotRefs.current.set(id, element);
|
|
66
|
+
else bottomSlotRefs.current.delete(id);
|
|
67
|
+
}, []);
|
|
68
|
+
const getBottomSlot = useCallback((id) => {
|
|
69
|
+
var _bottomSlotRefs$curre;
|
|
70
|
+
return (_bottomSlotRefs$curre = bottomSlotRefs.current.get(id)) !== null && _bottomSlotRefs$curre !== void 0 ? _bottomSlotRefs$curre : null;
|
|
71
|
+
}, []);
|
|
63
72
|
const searchRef = useRef(null);
|
|
64
73
|
const { activeKey, setActiveKey, getActiveKey, _setActiveKey, setCacheActiveKey, resetActiveKey, getCacheActiveKey } = useActiveKey({
|
|
65
74
|
initialActiveKey: value || getDefaultActiveKey(dataSource, "id"),
|
|
@@ -236,6 +245,7 @@ const PisellTabbar = forwardRef((props, ref) => {
|
|
|
236
245
|
let _dataSource2 = panelProps2.dataSource.children || [];
|
|
237
246
|
if (_dataSource2.length) _dataSource2 = addDataSourceItemsByKey(_dataSource2, LEVEL_ADD_ITEMS.level3);
|
|
238
247
|
const level3Config = getLevelConfig("level3");
|
|
248
|
+
const level3TabbarId = `${tabbarIdRef.current}-${panelProps2.dataSource.id}`;
|
|
239
249
|
/**
|
|
240
250
|
* 渲染三级 Tab 项
|
|
241
251
|
*/
|
|
@@ -246,14 +256,12 @@ const PisellTabbar = forwardRef((props, ref) => {
|
|
|
246
256
|
}
|
|
247
257
|
return /* @__PURE__ */ React.createElement(PisellCards.MultilevelCard, _objectSpread2(_objectSpread2({}, itemProps), {}, {
|
|
248
258
|
card: (cardProps) => renderLevelNNormalCard(cardProps, "level3"),
|
|
249
|
-
panelContainer: () =>
|
|
250
|
-
const selector = `.pisell-super-tabs-slot-bottom-${tabbarIdRef.current}-${panelProps2.dataSource.id}`;
|
|
251
|
-
return document.querySelector(selector);
|
|
252
|
-
}
|
|
259
|
+
panelContainer: () => getBottomSlot(level3TabbarId)
|
|
253
260
|
}));
|
|
254
261
|
};
|
|
255
262
|
return /* @__PURE__ */ React.createElement(PisellSuperTabs_default, {
|
|
256
|
-
id:
|
|
263
|
+
id: level3TabbarId,
|
|
264
|
+
slotBottomRef: (element) => registerBottomSlot(level3TabbarId, element),
|
|
257
265
|
tabItemStyle: {},
|
|
258
266
|
isControlled: true,
|
|
259
267
|
dataSource: _dataSource2,
|
|
@@ -289,6 +297,8 @@ const PisellTabbar = forwardRef((props, ref) => {
|
|
|
289
297
|
level3ScrollViewProps,
|
|
290
298
|
toggleExpand,
|
|
291
299
|
getLevelConfig,
|
|
300
|
+
getBottomSlot,
|
|
301
|
+
registerBottomSlot,
|
|
292
302
|
renderLevelNCard,
|
|
293
303
|
renderLevelNNormalCard
|
|
294
304
|
]);
|
|
@@ -300,6 +310,7 @@ const PisellTabbar = forwardRef((props, ref) => {
|
|
|
300
310
|
let _dataSource = panelProps.dataSource.children || [];
|
|
301
311
|
if (_dataSource.length) _dataSource = addDataSourceItemsByKey(_dataSource, LEVEL_ADD_ITEMS.level2);
|
|
302
312
|
const level2Config = getLevelConfig("level2");
|
|
313
|
+
const level2TabbarId = `${tabbarIdRef.current}-${panelProps.dataSource.id}`;
|
|
303
314
|
/**
|
|
304
315
|
* 渲染二级 Tab 项
|
|
305
316
|
*/
|
|
@@ -315,14 +326,12 @@ const PisellTabbar = forwardRef((props, ref) => {
|
|
|
315
326
|
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);
|
|
316
327
|
return null;
|
|
317
328
|
},
|
|
318
|
-
panelContainer: () =>
|
|
319
|
-
const selector = `.pisell-super-tabs-slot-bottom-${tabbarIdRef.current}-${panelProps.dataSource.id}`;
|
|
320
|
-
return document.querySelector(selector);
|
|
321
|
-
}
|
|
329
|
+
panelContainer: () => getBottomSlot(level2TabbarId)
|
|
322
330
|
}));
|
|
323
331
|
};
|
|
324
332
|
return /* @__PURE__ */ React.createElement(PisellSuperTabs_default, {
|
|
325
|
-
id:
|
|
333
|
+
id: level2TabbarId,
|
|
334
|
+
slotBottomRef: (element) => registerBottomSlot(level2TabbarId, element),
|
|
326
335
|
tabItemStyle: {},
|
|
327
336
|
dataSource: _dataSource,
|
|
328
337
|
value: level2Value,
|
|
@@ -358,6 +367,8 @@ const PisellTabbar = forwardRef((props, ref) => {
|
|
|
358
367
|
level2ScrollViewProps,
|
|
359
368
|
toggleExpand,
|
|
360
369
|
getLevelConfig,
|
|
370
|
+
getBottomSlot,
|
|
371
|
+
registerBottomSlot,
|
|
361
372
|
renderLevelNCard,
|
|
362
373
|
renderLevelNNormalCard,
|
|
363
374
|
renderLevel3
|
|
@@ -439,10 +450,7 @@ const PisellTabbar = forwardRef((props, ref) => {
|
|
|
439
450
|
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);
|
|
440
451
|
return null;
|
|
441
452
|
},
|
|
442
|
-
panelContainer: () =>
|
|
443
|
-
const selector = `.pisell-super-tabs-slot-bottom-${tabbarIdRef.current}`;
|
|
444
|
-
return document.querySelector(selector);
|
|
445
|
-
}
|
|
453
|
+
panelContainer: () => getBottomSlot(tabbarIdRef.current)
|
|
446
454
|
}));
|
|
447
455
|
});
|
|
448
456
|
const level1Config = useMemo(() => getLevelConfig("level1"), [getLevelConfig]);
|
|
@@ -455,6 +463,7 @@ const PisellTabbar = forwardRef((props, ref) => {
|
|
|
455
463
|
}, /* @__PURE__ */ React.createElement(PisellSuperTabs_default, {
|
|
456
464
|
isControlled: true,
|
|
457
465
|
id: tabbarIdRef.current,
|
|
466
|
+
slotBottomRef: (element) => registerBottomSlot(tabbarIdRef.current, element),
|
|
458
467
|
tabItemStyle: {},
|
|
459
468
|
dataSource: level1DataSource,
|
|
460
469
|
value: level1Value,
|
|
@@ -483,6 +492,7 @@ const PisellTabbar = forwardRef((props, ref) => {
|
|
|
483
492
|
level1Config,
|
|
484
493
|
level1Expand,
|
|
485
494
|
level1ScrollViewProps,
|
|
495
|
+
registerBottomSlot,
|
|
486
496
|
renderLevel1Item
|
|
487
497
|
]);
|
|
488
498
|
});
|
|
@@ -833,6 +833,7 @@ function PisellFloorMapLayoutInner(props, ref) {
|
|
|
833
833
|
initialPositionY,
|
|
834
834
|
minScale: zoomConfig.minScale,
|
|
835
835
|
maxScale: zoomConfig.maxScale,
|
|
836
|
+
disablePadding: true,
|
|
836
837
|
limitToBounds: pan.boundary !== "none"
|
|
837
838
|
}, { step: zoomConfig.step }), {}, {
|
|
838
839
|
panning: {
|
|
@@ -38,6 +38,8 @@ const _excluded = [
|
|
|
38
38
|
"isShowEditProduct",
|
|
39
39
|
"disabledClick",
|
|
40
40
|
"disabledEditClick",
|
|
41
|
+
"disabledNoteEdit",
|
|
42
|
+
"externalNoteEditor",
|
|
41
43
|
"onEditProduct",
|
|
42
44
|
"onAction",
|
|
43
45
|
"onDelete",
|
|
@@ -59,7 +61,7 @@ const _excluded = [
|
|
|
59
61
|
const PREFIX = "pisell-cart-sku-card";
|
|
60
62
|
const CartSkuCard = (props) => {
|
|
61
63
|
var _context$appHelper$ut;
|
|
62
|
-
const { dataSource = defaultValue.dataSource, isShowImage = defaultValue.isShowImage, isShowQuantityBadge = true, isShowOriginalPrice = defaultValue.isShowOriginalPrice, isShowHolder = defaultValue.isShowHolder, isShowNote = defaultValue.isShowNote, isShowDelete = defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowAmountFooter = defaultValue.isShowAmountFooter, isShowPackageNote = defaultValue.isShowPackageNote, isShowEditProduct = defaultValue.isShowEditProduct, disabledClick = defaultValue.disabledClick, disabledEditClick = defaultValue.disabledEditClick, onEditProduct, onAction, onDelete, onNote, onLike, onCard, onChangeResource, onPromotion, onGift, onChangeHolder, itemType = "product", type, rightActions = [], rightActionsDisplay = "swipe", escapeDom, maxSpecsCount = 1, isShowRelatedProduct = true } = props, other = _objectWithoutProperties(props, _excluded);
|
|
64
|
+
const { dataSource = defaultValue.dataSource, isShowImage = defaultValue.isShowImage, isShowQuantityBadge = true, isShowOriginalPrice = defaultValue.isShowOriginalPrice, isShowHolder = defaultValue.isShowHolder, isShowNote = defaultValue.isShowNote, isShowDelete = defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowAmountFooter = defaultValue.isShowAmountFooter, isShowPackageNote = defaultValue.isShowPackageNote, isShowEditProduct = defaultValue.isShowEditProduct, disabledClick = defaultValue.disabledClick, disabledEditClick = defaultValue.disabledEditClick, disabledNoteEdit, externalNoteEditor = false, onEditProduct, onAction, onDelete, onNote, onLike, onCard, onChangeResource, onPromotion, onGift, onChangeHolder, itemType = "product", type, rightActions = [], rightActionsDisplay = "swipe", escapeDom, maxSpecsCount = 1, isShowRelatedProduct = true } = props, other = _objectWithoutProperties(props, _excluded);
|
|
63
65
|
const useOpenNoteRef = useRef();
|
|
64
66
|
const context = useEngineContext();
|
|
65
67
|
locales.init(locales_default, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut = _context$appHelper$ut.storage) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.get("umi_locale")) || "en");
|
|
@@ -103,6 +105,14 @@ const CartSkuCard = (props) => {
|
|
|
103
105
|
const hideDivider = useMemo(() => {
|
|
104
106
|
return false;
|
|
105
107
|
}, [dataSource]);
|
|
108
|
+
const openNoteEditor = () => {
|
|
109
|
+
var _useOpenNoteRef$curre;
|
|
110
|
+
if (externalNoteEditor) {
|
|
111
|
+
onNote === null || onNote === void 0 || onNote(dataSource);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
(_useOpenNoteRef$curre = useOpenNoteRef.current) === null || _useOpenNoteRef$curre === void 0 || _useOpenNoteRef$curre.open({ item: dataSource });
|
|
115
|
+
};
|
|
106
116
|
/**
|
|
107
117
|
* @description: 营销活动
|
|
108
118
|
* @param {*} useMemo
|
|
@@ -128,9 +138,8 @@ const CartSkuCard = (props) => {
|
|
|
128
138
|
maxSpecsCount
|
|
129
139
|
})), /* @__PURE__ */ React.createElement(DiscountReason, { dataSource }), renderPromotion, isShowNote ? /* @__PURE__ */ React.createElement(Note, _objectSpread2(_objectSpread2({}, other), {}, {
|
|
130
140
|
item: dataSource,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
141
|
+
disabledEdit: disabledNoteEdit !== null && disabledNoteEdit !== void 0 ? disabledNoteEdit : other.disabledEdit,
|
|
142
|
+
openNote: openNoteEditor
|
|
134
143
|
})) : null);
|
|
135
144
|
};
|
|
136
145
|
const renderA5 = () => {
|
|
@@ -170,9 +179,8 @@ const CartSkuCard = (props) => {
|
|
|
170
179
|
type: "total"
|
|
171
180
|
}) : null, renderPromotion, isShowNote ? /* @__PURE__ */ React.createElement(Note, _objectSpread2(_objectSpread2({}, other), {}, {
|
|
172
181
|
item: dataSource,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
182
|
+
disabledEdit: disabledNoteEdit !== null && disabledNoteEdit !== void 0 ? disabledNoteEdit : other.disabledEdit,
|
|
183
|
+
openNote: openNoteEditor
|
|
176
184
|
})) : null, isShowAction && actionText ? /* @__PURE__ */ React.createElement(Action, {
|
|
177
185
|
item: dataSource,
|
|
178
186
|
onAction: () => onAction === null || onAction === void 0 ? void 0 : onAction(dataSource)
|
|
@@ -207,9 +215,8 @@ const CartSkuCard = (props) => {
|
|
|
207
215
|
type: "total"
|
|
208
216
|
}) : null, /* @__PURE__ */ React.createElement(DiscountReason, { dataSource }), renderPromotion, isShowNote ? /* @__PURE__ */ React.createElement(Note, _objectSpread2(_objectSpread2({}, other), {}, {
|
|
209
217
|
item: dataSource,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
218
|
+
disabledEdit: disabledNoteEdit !== null && disabledNoteEdit !== void 0 ? disabledNoteEdit : other.disabledEdit,
|
|
219
|
+
openNote: openNoteEditor
|
|
213
220
|
})) : null);
|
|
214
221
|
};
|
|
215
222
|
const renderContent = () => {
|
|
@@ -38,11 +38,13 @@ const _excluded = [
|
|
|
38
38
|
"isShowAmountFooter",
|
|
39
39
|
"disabledClick",
|
|
40
40
|
"disabledEdit",
|
|
41
|
+
"disabledNoteEdit",
|
|
41
42
|
"statusOptions",
|
|
42
43
|
"statusLoading",
|
|
43
44
|
"statusDisabled",
|
|
44
45
|
"isShowRelatedProduct",
|
|
45
46
|
"holderOptions",
|
|
47
|
+
"onAssignHolder",
|
|
46
48
|
"onBookingStatusChange",
|
|
47
49
|
"onAddTimeProductCard",
|
|
48
50
|
"onAction",
|
|
@@ -64,7 +66,7 @@ const getStatusOption = (status, statusOptions = []) => {
|
|
|
64
66
|
};
|
|
65
67
|
const BookingLineItem = (props) => {
|
|
66
68
|
var _ref, _ref2, _dataSource$promotion, _dataSource$giftData;
|
|
67
|
-
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 = _objectWithoutProperties(props, _excluded);
|
|
69
|
+
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 = _objectWithoutProperties(props, _excluded);
|
|
68
70
|
const shouldRenderRelatedProduct = isShowRelatedProduct && Boolean(relatedProductDataSource);
|
|
69
71
|
const [isAddTimeProductsExpanded, setIsAddTimeProductsExpanded] = useState(false);
|
|
70
72
|
const { isShowAction, actionText } = dataSource;
|
|
@@ -85,7 +87,8 @@ const BookingLineItem = (props) => {
|
|
|
85
87
|
onDelete === null || onDelete === void 0 || onDelete(dataSource);
|
|
86
88
|
}
|
|
87
89
|
};
|
|
88
|
-
const
|
|
90
|
+
const showDeleteInRelatedProduct = isShowDelete && rightActionsDisplay === "inline" && shouldRenderRelatedProduct && !(relatedProductDataSource === null || relatedProductDataSource === void 0 ? void 0 : relatedProductDataSource.isGift);
|
|
91
|
+
const bookingRightActions = isShowDelete && !showDeleteInRelatedProduct ? rightActionsDisplay === "inline" ? [...rightActions, deleteAction] : [deleteAction, ...rightActions] : rightActions;
|
|
89
92
|
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 : [];
|
|
90
93
|
const resolvedIsFormSubject = isFormSubject !== null && isFormSubject !== void 0 ? isFormSubject : dataSource === null || dataSource === void 0 ? void 0 : dataSource.isFormSubject;
|
|
91
94
|
const bookingTitle = String((dataSource === null || dataSource === void 0 ? void 0 : dataSource.booking_id) || "");
|
|
@@ -116,29 +119,29 @@ const BookingLineItem = (props) => {
|
|
|
116
119
|
const renderProductCard = (productDataSource, source, options = {}) => {
|
|
117
120
|
var _productDataSource$pr;
|
|
118
121
|
if (!productDataSource || (productDataSource === null || productDataSource === void 0 ? void 0 : productDataSource.isGift)) return null;
|
|
119
|
-
const { showProductPromotion = true } = options;
|
|
122
|
+
const { showProductPromotion = true, showAmountFooter = true, inlineActions = [] } = options;
|
|
120
123
|
const productPromotion = (productDataSource === null || productDataSource === void 0 || (_productDataSource$pr = productDataSource.promotions) === null || _productDataSource$pr === void 0 ? void 0 : _productDataSource$pr.length) ? /* @__PURE__ */ React.createElement(Promotion, {
|
|
121
124
|
promotions: productDataSource.promotions,
|
|
122
125
|
onClick: (item) => onPromotion === null || onPromotion === void 0 ? void 0 : onPromotion(item)
|
|
123
126
|
}) : null;
|
|
124
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BasicInfo, {
|
|
127
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__product-main-row` }, /* @__PURE__ */ React.createElement(BasicInfo, {
|
|
125
128
|
isShowImage,
|
|
126
129
|
isShowQuantityBadge,
|
|
127
130
|
dataSource: productDataSource,
|
|
128
131
|
type: cartSkuType,
|
|
129
132
|
maxSpecsCount: props.maxSpecsCount || 1
|
|
130
|
-
}), /* @__PURE__ */ React.createElement(Packages, {
|
|
133
|
+
}), inlineActions.length > 0 ? /* @__PURE__ */ React.createElement(InlineActions, { actions: inlineActions }) : null), /* @__PURE__ */ React.createElement(Packages, {
|
|
131
134
|
dataSource: productDataSource,
|
|
132
135
|
isShowImage,
|
|
133
136
|
isShowQuantityBadge,
|
|
134
137
|
type: cartSkuType
|
|
135
|
-
}), isShowAmountFooter ? /* @__PURE__ */ React.createElement(Footer, {
|
|
138
|
+
}), isShowAmountFooter && showAmountFooter ? /* @__PURE__ */ React.createElement(Footer, {
|
|
136
139
|
item: productDataSource,
|
|
137
140
|
hideDivider: false,
|
|
138
141
|
type: "total"
|
|
139
142
|
}) : null, showProductPromotion ? productPromotion : null, isShowNote ? /* @__PURE__ */ React.createElement(Note, _objectSpread2(_objectSpread2({}, other), {}, {
|
|
140
143
|
item: productDataSource,
|
|
141
|
-
disabledEdit,
|
|
144
|
+
disabledEdit: disabledNoteEdit,
|
|
142
145
|
openNote: () => onNote === null || onNote === void 0 ? void 0 : onNote(source)
|
|
143
146
|
})) : null);
|
|
144
147
|
};
|
|
@@ -172,6 +175,7 @@ const BookingLineItem = (props) => {
|
|
|
172
175
|
}, locales.getText(isAddTimeProductsExpanded ? "pisell2.line-item.collapse" : "pisell2.line-item.show-all")) : null));
|
|
173
176
|
};
|
|
174
177
|
if (dataSource === null || dataSource === void 0 ? void 0 : dataSource.isGift) return null;
|
|
178
|
+
const shouldRenderFullWidthAmountFooter = rightActionsDisplay === "inline" && isShowAmountFooter && shouldRenderRelatedProduct;
|
|
175
179
|
const cardContent = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
176
180
|
className: classNames(PREFIX, `${PREFIX}--booking`, `${PREFIX}--${type}`),
|
|
177
181
|
onClick: (e) => {
|
|
@@ -189,15 +193,24 @@ const BookingLineItem = (props) => {
|
|
|
189
193
|
onClick: ({ key }) => onBookingStatusChange === null || onBookingStatusChange === void 0 ? void 0 : onBookingStatusChange(String(key), dataSource)
|
|
190
194
|
},
|
|
191
195
|
trigger: ["click"]
|
|
192
|
-
}, renderStatusButton()) : renderStatusButton(), renderDeleteButton()))) : null, /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}__booking-detail`, { [`${PREFIX}__booking-detail--with-delete`]: !isShowBookingHeader && isShowInlineDelete }) }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__booking-detail-content` }, /* @__PURE__ */ React.createElement(LineItemResources, { dataSource }), /* @__PURE__ */ React.createElement(LineItemTimeRange, { dataSource }),
|
|
196
|
+
}, renderStatusButton()) : renderStatusButton(), renderDeleteButton()))) : null, /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}__booking-detail`, { [`${PREFIX}__booking-detail--with-delete`]: !isShowBookingHeader && isShowInlineDelete }) }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__booking-detail-content` }, /* @__PURE__ */ React.createElement(LineItemResources, { dataSource }), /* @__PURE__ */ React.createElement(LineItemTimeRange, { dataSource }), /* @__PURE__ */ React.createElement(LineItemHolders, {
|
|
193
197
|
dataSource,
|
|
194
198
|
holderOptions: resolvedHolderOptions,
|
|
195
|
-
isFormSubject: resolvedIsFormSubject
|
|
196
|
-
|
|
199
|
+
isFormSubject: resolvedIsFormSubject,
|
|
200
|
+
onAssignHolder
|
|
201
|
+
})), !isShowBookingHeader ? renderDeleteButton(true) : null), shouldRenderRelatedProduct ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Divider, { style: { margin: 0 } }), /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__related-product` }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__related-product-card` }, renderProductCard(relatedProductDataSource, dataSource, {
|
|
202
|
+
showProductPromotion: false,
|
|
203
|
+
showAmountFooter: !shouldRenderFullWidthAmountFooter,
|
|
204
|
+
inlineActions: showDeleteInRelatedProduct ? [deleteAction] : []
|
|
205
|
+
}), renderPromotion, isShowAction && actionText ? /* @__PURE__ */ React.createElement(Action, {
|
|
197
206
|
item: dataSource,
|
|
198
207
|
onAction: () => onAction === null || onAction === void 0 ? void 0 : onAction(dataSource)
|
|
199
208
|
}) : null))) : null, renderAddTimeProducts()));
|
|
200
|
-
return /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper-container`, { [`${PREFIX}-wrapper-container--inline`]: rightActionsDisplay === "inline" }) }, rightActionsDisplay === "inline" ? /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper`, `${PREFIX}-wrapper--inline`) }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-inline-content` }, cardContent), /* @__PURE__ */ React.createElement(InlineActions, { actions: bookingRightActions })) : /* @__PURE__ */ React.createElement(
|
|
209
|
+
return /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper-container`, { [`${PREFIX}-wrapper-container--inline`]: rightActionsDisplay === "inline" }) }, rightActionsDisplay === "inline" ? /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper`, `${PREFIX}-wrapper--inline`) }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-inline-main` }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-inline-content` }, cardContent), /* @__PURE__ */ React.createElement(InlineActions, { actions: bookingRightActions })), shouldRenderFullWidthAmountFooter ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__inline-amount-footer` }, /* @__PURE__ */ React.createElement(Footer, {
|
|
210
|
+
item: relatedProductDataSource,
|
|
211
|
+
hideDivider: false,
|
|
212
|
+
type: "total"
|
|
213
|
+
})) : null) : /* @__PURE__ */ React.createElement(SwipeAction, {
|
|
201
214
|
closeOnAction: false,
|
|
202
215
|
className: classNames(`${PREFIX}-wrapper`),
|
|
203
216
|
rightActions: bookingRightActions,
|
|
@@ -27,14 +27,30 @@ const pickHolderMaxCount = (dataSource, holderIds) => {
|
|
|
27
27
|
return Number(count) || 1;
|
|
28
28
|
};
|
|
29
29
|
const LineItemHolders = (props) => {
|
|
30
|
-
const { dataSource = {}, holderOptions = [], isFormSubject } = props;
|
|
30
|
+
const { dataSource = {}, holderOptions = [], isFormSubject, onAssignHolder } = props;
|
|
31
31
|
const holderIds = useMemo(() => normalizeHolderIds(pickHolderId(dataSource)), [dataSource]);
|
|
32
32
|
const holderMaxCount = pickHolderMaxCount(dataSource, holderIds);
|
|
33
|
-
const showUnassigned = Boolean(isFormSubject
|
|
33
|
+
const showUnassigned = isFormSubject !== void 0 ? Boolean(isFormSubject) : Boolean(dataSource === null || dataSource === void 0 ? void 0 : dataSource.isFormSubject);
|
|
34
34
|
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;
|
|
35
35
|
if (!holderIds.length) {
|
|
36
36
|
if (!showUnassigned) return null;
|
|
37
|
-
return /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__holders` }, /* @__PURE__ */ React.createElement("div", {
|
|
37
|
+
return /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__holders` }, /* @__PURE__ */ React.createElement("div", {
|
|
38
|
+
className: "holder-item unassigned",
|
|
39
|
+
role: onAssignHolder ? "button" : void 0,
|
|
40
|
+
tabIndex: onAssignHolder ? 0 : void 0,
|
|
41
|
+
onClick: (event) => {
|
|
42
|
+
if (!onAssignHolder) return;
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
onAssignHolder();
|
|
46
|
+
},
|
|
47
|
+
onKeyDown: (event) => {
|
|
48
|
+
if (!onAssignHolder || !["Enter", " "].includes(event.key)) return;
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
event.stopPropagation();
|
|
51
|
+
onAssignHolder();
|
|
52
|
+
}
|
|
53
|
+
}, holderMaxCount > 1 ? /* @__PURE__ */ React.createElement("span", null, holderMaxCount, "/", holderMaxCount, " ") : null, /* @__PURE__ */ React.createElement("span", { className: "holder-label" }, locales.getText("pisell2.cart.sku-card.unassigned"))));
|
|
38
54
|
}
|
|
39
55
|
const renderHolder = (id, index) => {
|
|
40
56
|
const holder = holderOptions.find((item) => String(item.id) === String(id));
|
|
@@ -26,6 +26,7 @@ const _excluded = [
|
|
|
26
26
|
"isShowAmountFooter",
|
|
27
27
|
"disabledClick",
|
|
28
28
|
"disabledEdit",
|
|
29
|
+
"disabledNoteEdit",
|
|
29
30
|
"statusOptions",
|
|
30
31
|
"statusLoading",
|
|
31
32
|
"statusDisabled",
|
|
@@ -178,7 +179,7 @@ const convertProductToLineItemProduct = (product, translationOriginal, symbol) =
|
|
|
178
179
|
};
|
|
179
180
|
const LineItem = (props) => {
|
|
180
181
|
var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _dataSource$_extend2, _dataSource$_extend4;
|
|
181
|
-
const { dataSource = defaultValue.dataSource, itemType, type = "a9", isShowBookingHeader, rightActions = [], rightActionsDisplay = "swipe", escapeDom, isShowImage = defaultValue.isShowImage, isShowDelete = defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowNote = defaultValue.isShowNote, isShowAmountFooter = defaultValue.isShowAmountFooter, disabledClick = defaultValue.disabledClick, disabledEdit = defaultValue.disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAddTimeProductCard, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = _objectWithoutProperties(props, _excluded);
|
|
182
|
+
const { dataSource = defaultValue.dataSource, itemType, type = "a9", isShowBookingHeader, rightActions = [], rightActionsDisplay = "swipe", escapeDom, isShowImage = defaultValue.isShowImage, isShowDelete = defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowNote = defaultValue.isShowNote, isShowAmountFooter = defaultValue.isShowAmountFooter, disabledClick = defaultValue.disabledClick, disabledEdit = defaultValue.disabledEdit, disabledNoteEdit = disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAddTimeProductCard, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = _objectWithoutProperties(props, _excluded);
|
|
182
183
|
const itemKind = itemType || (isBookingItem(dataSource) ? "booking" : "product");
|
|
183
184
|
const context = useEngineContext();
|
|
184
185
|
const translationOriginal = useTranslationOriginal();
|
|
@@ -222,6 +223,7 @@ const LineItem = (props) => {
|
|
|
222
223
|
isShowAmountFooter,
|
|
223
224
|
disabledClick,
|
|
224
225
|
disabledEdit,
|
|
226
|
+
disabledNoteEdit,
|
|
225
227
|
onAction,
|
|
226
228
|
onDelete,
|
|
227
229
|
onNote,
|
|
@@ -246,6 +248,7 @@ const LineItem = (props) => {
|
|
|
246
248
|
isShowAmountFooter,
|
|
247
249
|
disabledClick,
|
|
248
250
|
disabledEdit,
|
|
251
|
+
disabledNoteEdit,
|
|
249
252
|
statusOptions,
|
|
250
253
|
statusLoading,
|
|
251
254
|
statusDisabled,
|