@pisell/materials 6.12.18 → 6.12.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +5 -5
- package/build/lowcode/view.js +5 -5
- package/es/components/PisellScrollView/components/Actions/index.js +2 -1
- package/es/components/PisellScrollView/hooks/useScrollState.js +3 -1
- package/es/components/PisellSuperTabs/PisellSuperTabs.d.ts +8 -0
- package/es/components/PisellSuperTabs/PisellSuperTabs.js +39 -8
- package/es/components/PisellTabbar/index.d.ts +10 -0
- package/es/components/PisellTabbar/template/Template1/PisellTabbar.d.ts +16 -0
- package/es/components/PisellTabbar/template/Template1/index.d.ts +7 -0
- package/es/components/PisellTabbar/types.d.ts +123 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +48 -0
- package/es/components/pisellFind/index.d.ts +69 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +94 -0
- package/es/components/pisellLookup/PisellLookup.d.ts +4 -0
- package/es/components/pisellLookup/PisellLookup.js +4 -0
- package/es/components/pisellLookup/components/LookupResultHost.d.ts +7 -0
- package/es/components/pisellLookup/components/LookupTrigger.d.ts +3 -0
- package/es/components/pisellLookup/components/LookupTrigger.js +5 -2
- package/es/components/pisellLookup/types.d.ts +806 -0
- package/es/components/pisellRecordBoard/PisellRecordBoard.d.ts +9 -0
- package/es/components/pisellRecordBoard/index.d.ts +55 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/bookingCalendarInternalTypes.d.ts +43 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/modal/OverflowPopover.d.ts +9 -0
- package/es/components/productCard/cartSkuCard/components/Gift/index.d.ts +5 -0
- package/es/components/productCard/cartSkuCard/components/basicInfo/index.d.ts +1 -0
- package/es/components/productCard/cartSkuCard/components/basicInfo/index.js +5 -3
- package/es/components/productCard/cartSkuCard/components/inlineActions/index.d.ts +15 -0
- package/es/components/productCard/cartSkuCard/components/packages/index.d.ts +2 -1
- package/es/components/productCard/cartSkuCard/components/packages/index.js +2 -0
- package/es/components/productCard/cartSkuCard/components/sales/index.d.ts +2 -1
- package/es/components/productCard/cartSkuCard/components/sales/index.js +3 -1
- package/es/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +46 -0
- package/es/components/productCard/cartSkuCard/index.d.ts +16 -0
- package/es/components/productCard/cartSkuCard/index.js +11 -3
- package/es/components/productCard/components/Time/components/SelectHolderMultiple/index.d.ts +3 -0
- package/es/components/productCard/lineItem/BookingLineItem.d.ts +23 -0
- package/es/components/productCard/lineItem/BookingLineItem.js +5 -1
- package/es/components/productCard/lineItem/index.d.ts +72 -0
- package/es/components/productCard/lineItem/index.js +2 -0
- package/es/components/productCard/types.d.ts +99 -0
- package/es/components/table/hooks/useTableSetting.d.ts +21 -0
- package/es/hooks/useInitLocalesOnce.d.ts +4 -0
- package/es/hooks/useTranslationOriginal.d.ts +4 -0
- package/es/index.d.ts +271 -0
- package/es/locales/ja.d.ts +534 -0
- package/es/locales/pt.d.ts +534 -0
- package/es/locales/zh-CN.d.ts +561 -0
- package/es/locales/zh-TW.d.ts +561 -0
- package/lib/components/PisellScrollView/components/Actions/index.js +2 -1
- package/lib/components/PisellScrollView/hooks/useScrollState.js +3 -1
- package/lib/components/PisellSuperTabs/PisellSuperTabs.d.ts +8 -0
- package/lib/components/PisellSuperTabs/PisellSuperTabs.js +37 -8
- package/lib/components/PisellTabbar/index.d.ts +10 -0
- package/lib/components/PisellTabbar/template/Template1/PisellTabbar.d.ts +16 -0
- package/lib/components/PisellTabbar/template/Template1/index.d.ts +7 -0
- package/lib/components/PisellTabbar/types.d.ts +123 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +48 -0
- package/lib/components/pisellFind/index.d.ts +69 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +94 -0
- package/lib/components/pisellLookup/PisellLookup.d.ts +4 -0
- package/lib/components/pisellLookup/PisellLookup.js +3 -0
- package/lib/components/pisellLookup/components/LookupResultHost.d.ts +7 -0
- package/lib/components/pisellLookup/components/LookupTrigger.d.ts +3 -0
- package/lib/components/pisellLookup/components/LookupTrigger.js +4 -2
- package/lib/components/pisellLookup/types.d.ts +806 -0
- package/lib/components/pisellRecordBoard/PisellRecordBoard.d.ts +9 -0
- package/lib/components/pisellRecordBoard/index.d.ts +55 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/bookingCalendarInternalTypes.d.ts +43 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/modal/OverflowPopover.d.ts +9 -0
- package/lib/components/productCard/cartSkuCard/components/Gift/index.d.ts +5 -0
- package/lib/components/productCard/cartSkuCard/components/basicInfo/index.d.ts +1 -0
- package/lib/components/productCard/cartSkuCard/components/basicInfo/index.js +4 -3
- package/lib/components/productCard/cartSkuCard/components/inlineActions/index.d.ts +15 -0
- package/lib/components/productCard/cartSkuCard/components/packages/index.d.ts +2 -1
- package/lib/components/productCard/cartSkuCard/components/packages/index.js +7 -1
- package/lib/components/productCard/cartSkuCard/components/sales/index.d.ts +2 -1
- package/lib/components/productCard/cartSkuCard/components/sales/index.js +7 -1
- package/lib/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +46 -0
- package/lib/components/productCard/cartSkuCard/index.d.ts +16 -0
- package/lib/components/productCard/cartSkuCard/index.js +15 -2
- package/lib/components/productCard/components/Time/components/SelectHolderMultiple/index.d.ts +3 -0
- package/lib/components/productCard/lineItem/BookingLineItem.d.ts +23 -0
- package/lib/components/productCard/lineItem/BookingLineItem.js +3 -0
- package/lib/components/productCard/lineItem/index.d.ts +72 -0
- package/lib/components/productCard/lineItem/index.js +2 -0
- package/lib/components/productCard/types.d.ts +99 -0
- package/lib/components/table/hooks/useTableSetting.d.ts +21 -0
- package/lib/hooks/useInitLocalesOnce.d.ts +4 -0
- package/lib/hooks/useTranslationOriginal.d.ts +4 -0
- package/lib/index.d.ts +271 -0
- package/lib/locales/ja.d.ts +534 -0
- package/lib/locales/pt.d.ts +534 -0
- package/lib/locales/zh-CN.d.ts +561 -0
- package/lib/locales/zh-TW.d.ts +561 -0
- package/package.json +3 -3
|
@@ -41,7 +41,8 @@ var ActionsContainer = function ActionsContainer(_ref) {
|
|
|
41
41
|
if (overflow !== 'x' && overflow !== 'y') {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
var hasDirectionalOverflow = overflow === 'x' ? scrollState.scrollWidth > scrollState.clientWidth + 1 : scrollState.scrollHeight > scrollState.clientHeight + 1;
|
|
45
|
+
if (!hasDirectionalOverflow) {
|
|
45
46
|
return null;
|
|
46
47
|
}
|
|
47
48
|
if (!(scrollActionsConfig !== null && scrollActionsConfig !== void 0 && scrollActionsConfig.show) || !scrollActionsConfig) {
|
|
@@ -265,7 +265,9 @@ export var useScrollState = function useScrollState(_ref) {
|
|
|
265
265
|
});
|
|
266
266
|
mutationObserver.observe(container, {
|
|
267
267
|
childList: true,
|
|
268
|
-
|
|
268
|
+
// 分类、Tab 等内容通常包在 Grid 内;搜索过滤只会增删更深层的
|
|
269
|
+
// item,直接子容器尺寸可能保持不变,因此需要监听整个子树。
|
|
270
|
+
subtree: true
|
|
269
271
|
});
|
|
270
272
|
|
|
271
273
|
// 监听 window resize 作为补充
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './PisellSuperTabs.less';
|
|
3
|
+
import type { PisellSuperTabsProps } from './types';
|
|
4
|
+
interface PisellSuperTabsRef {
|
|
5
|
+
scrollItemByRowKey: (key: string) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.ForwardRefExoticComponent<PisellSuperTabsProps<unknown> & React.RefAttributes<PisellSuperTabsRef>>;
|
|
8
|
+
export default _default;
|
|
@@ -51,6 +51,7 @@ var PisellSuperTabs = function PisellSuperTabs(props, ref) {
|
|
|
51
51
|
isControlled = _props$isControlled === void 0 ? true : _props$isControlled,
|
|
52
52
|
__designMode = props.__designMode;
|
|
53
53
|
var containerRef = useRef(null);
|
|
54
|
+
var scrollViewRef = useRef(null);
|
|
54
55
|
|
|
55
56
|
// 状态管理:处理受控/非受控模式
|
|
56
57
|
var _useTabsState = useTabsState({
|
|
@@ -62,17 +63,45 @@ var PisellSuperTabs = function PisellSuperTabs(props, ref) {
|
|
|
62
63
|
activeKey = _useTabsState.activeKey,
|
|
63
64
|
handleTabChange = _useTabsState.handleTabChange;
|
|
64
65
|
var scrollItemByRowKey = function scrollItemByRowKey(key) {
|
|
65
|
-
var _containerRef$current;
|
|
66
|
+
var _containerRef$current, _scrollViewRef$curren, _scrollViewRef$curren2;
|
|
66
67
|
var item = Array.from(((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelectorAll('[data-pisell-super-tabs-key]')) || []).find(function (element) {
|
|
67
68
|
return element.dataset.pisellSuperTabsKey === key;
|
|
68
69
|
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
var scrollContainer = (_scrollViewRef$curren = scrollViewRef.current) === null || _scrollViewRef$curren === void 0 || (_scrollViewRef$curren2 = _scrollViewRef$curren.getScrollContainer) === null || _scrollViewRef$curren2 === void 0 ? void 0 : _scrollViewRef$curren2.call(_scrollViewRef$curren);
|
|
71
|
+
if (!item || !scrollContainer) return;
|
|
72
|
+
var containerRect = scrollContainer.getBoundingClientRect();
|
|
73
|
+
var itemRect = item.getBoundingClientRect();
|
|
74
|
+
var containerStyle = window.getComputedStyle(scrollContainer);
|
|
75
|
+
var scrollPaddingLeft = Number.parseFloat(containerStyle.scrollPaddingLeft) || 0;
|
|
76
|
+
var scrollPaddingRight = Number.parseFloat(containerStyle.scrollPaddingRight) || 0;
|
|
77
|
+
var scrollPaddingTop = Number.parseFloat(containerStyle.scrollPaddingTop) || 0;
|
|
78
|
+
var scrollPaddingBottom = Number.parseFloat(containerStyle.scrollPaddingBottom) || 0;
|
|
79
|
+
var visibleLeft = containerRect.left + scrollPaddingLeft;
|
|
80
|
+
var visibleRight = containerRect.right - scrollPaddingRight;
|
|
81
|
+
var visibleTop = containerRect.top + scrollPaddingTop;
|
|
82
|
+
var visibleBottom = containerRect.bottom - scrollPaddingBottom;
|
|
83
|
+
var canScrollX = scrollContainer.scrollWidth > scrollContainer.clientWidth + 1;
|
|
84
|
+
var canScrollY = scrollContainer.scrollHeight > scrollContainer.clientHeight + 1;
|
|
85
|
+
var nextLeft = scrollContainer.scrollLeft;
|
|
86
|
+
var nextTop = scrollContainer.scrollTop;
|
|
87
|
+
if (canScrollX && itemRect.left < visibleLeft) {
|
|
88
|
+
nextLeft -= visibleLeft - itemRect.left;
|
|
89
|
+
} else if (canScrollX && itemRect.right > visibleRight) {
|
|
90
|
+
nextLeft += itemRect.right - visibleRight;
|
|
75
91
|
}
|
|
92
|
+
if (canScrollY && itemRect.top < visibleTop) {
|
|
93
|
+
nextTop -= visibleTop - itemRect.top;
|
|
94
|
+
} else if (canScrollY && itemRect.bottom > visibleBottom) {
|
|
95
|
+
nextTop += itemRect.bottom - visibleBottom;
|
|
96
|
+
}
|
|
97
|
+
if (nextLeft === scrollContainer.scrollLeft && nextTop === scrollContainer.scrollTop) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
scrollContainer.scrollTo({
|
|
101
|
+
left: nextLeft,
|
|
102
|
+
top: nextTop,
|
|
103
|
+
behavior: 'smooth'
|
|
104
|
+
});
|
|
76
105
|
};
|
|
77
106
|
useImperativeHandle(ref, function () {
|
|
78
107
|
if (__designMode) {
|
|
@@ -99,7 +128,9 @@ var PisellSuperTabs = function PisellSuperTabs(props, ref) {
|
|
|
99
128
|
}, slotTop), /*#__PURE__*/React.createElement("div", {
|
|
100
129
|
className: classNames('pisell-super-tabs-slot-left-' + id, slotLeftClassName),
|
|
101
130
|
style: slotLeftStyle
|
|
102
|
-
}, slotLeft), /*#__PURE__*/React.createElement(PisellScrollView,
|
|
131
|
+
}, slotLeft), /*#__PURE__*/React.createElement(PisellScrollView, _extends({
|
|
132
|
+
ref: scrollViewRef
|
|
133
|
+
}, resolvedScrollViewProps), /*#__PURE__*/React.createElement(PisellBasicGrid, _extends({}, gridProps, {
|
|
103
134
|
dataSource: dataSource,
|
|
104
135
|
rowKey: rowKey,
|
|
105
136
|
renderItem: function renderItem(item, index) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PisellTabbar 组件导出文件
|
|
3
|
+
* @module PisellTabbar
|
|
4
|
+
*/
|
|
5
|
+
import PisellTabbar from './PisellTabbar';
|
|
6
|
+
import PisellTabbarTemplate1 from './template/Template1';
|
|
7
|
+
export type { LevelType, PisellTabbarProps, TabbarActionItem, TabbarDataSource, } from './types';
|
|
8
|
+
export type { PisellTabbarTemplate1Direction, PisellTabbarTemplate1Props, } from './template/Template1';
|
|
9
|
+
export { PisellTabbarTemplate1 };
|
|
10
|
+
export default PisellTabbar;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '../../PisellTabbar.less';
|
|
3
|
+
import { PisellTabbarProps } from '../../types';
|
|
4
|
+
export declare type PisellTabbarTemplate1Direction = 'horizontal' | 'vertical';
|
|
5
|
+
export interface PisellTabbarTemplate1Props extends PisellTabbarProps {
|
|
6
|
+
/** Tab 排列方向;默认保持现有横向布局。 */
|
|
7
|
+
direction?: PisellTabbarTemplate1Direction;
|
|
8
|
+
/** 是否在每个层级展示自动生成的 All 分类;默认保持展示。 */
|
|
9
|
+
showAllItem?: boolean;
|
|
10
|
+
/** 是否展示一级分类中自动生成的搜索入口;默认保持展示。 */
|
|
11
|
+
showSearchItem?: boolean;
|
|
12
|
+
/** 外部切换选中项时,是否自动把一级分类滚动到可视区域。 */
|
|
13
|
+
scrollActiveItemIntoView?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const _default: React.ForwardRefExoticComponent<PisellTabbarTemplate1Props & React.RefAttributes<unknown>>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 一级 Tabbar 操作项。
|
|
4
|
+
*
|
|
5
|
+
* 操作项复用一级卡片样式,但点击时不进入分类选中态。
|
|
6
|
+
*/
|
|
7
|
+
export interface TabbarActionItem {
|
|
8
|
+
/** 唯一标识 */
|
|
9
|
+
key: string | number;
|
|
10
|
+
/** 卡片图标 */
|
|
11
|
+
icon: ReactNode;
|
|
12
|
+
/** 可选的卡片文案;未传时只显示图标 */
|
|
13
|
+
label?: ReactNode;
|
|
14
|
+
/** 无障碍名称 */
|
|
15
|
+
ariaLabel: string;
|
|
16
|
+
/** 点击回调 */
|
|
17
|
+
onClick: () => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Tabbar 数据源项类型
|
|
21
|
+
*/
|
|
22
|
+
export interface TabbarDataSource {
|
|
23
|
+
/** 唯一标识 */
|
|
24
|
+
id: string | number;
|
|
25
|
+
/** 店铺ID */
|
|
26
|
+
shop_id?: number;
|
|
27
|
+
/** 父级ID */
|
|
28
|
+
parent_id?: number;
|
|
29
|
+
/** 显示名称 */
|
|
30
|
+
name: string;
|
|
31
|
+
/** URL slug */
|
|
32
|
+
slug?: string;
|
|
33
|
+
/** 图标 URL 或图标名称 */
|
|
34
|
+
icon?: string;
|
|
35
|
+
/** 子级数据 */
|
|
36
|
+
children?: TabbarDataSource[];
|
|
37
|
+
/** 自定义点击事件标识 */
|
|
38
|
+
customClick?: boolean;
|
|
39
|
+
/** 唯一 key */
|
|
40
|
+
key?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 层级配置
|
|
44
|
+
*/
|
|
45
|
+
export interface TabbarLevelConfig {
|
|
46
|
+
/** SuperTabs 背景色 */
|
|
47
|
+
superTabsBg: string;
|
|
48
|
+
/** 卡片宽度 */
|
|
49
|
+
cardWidth: number;
|
|
50
|
+
/** 卡片高度 */
|
|
51
|
+
cardHeight: number;
|
|
52
|
+
/** 卡片背景色;未传时使用模板默认白色 */
|
|
53
|
+
cardBackground?: string;
|
|
54
|
+
/** 卡片选中背景色;未传时使用模板默认紫色 */
|
|
55
|
+
activeBackground?: string;
|
|
56
|
+
/** 左侧缩进 */
|
|
57
|
+
paddingLeft?: number;
|
|
58
|
+
/** 卡片圆角;未传时使用模板默认值 */
|
|
59
|
+
borderRadius?: number | string;
|
|
60
|
+
/** 卡片文字对齐方式;未传时居中 */
|
|
61
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
62
|
+
/** 是否展示分类数据中的 icon */
|
|
63
|
+
showIcon?: boolean;
|
|
64
|
+
/** 分类图标尺寸 */
|
|
65
|
+
iconSize?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 展开配置
|
|
69
|
+
*/
|
|
70
|
+
export interface ExpandConfig {
|
|
71
|
+
/** 激活状态配置 */
|
|
72
|
+
active: {
|
|
73
|
+
icon: string;
|
|
74
|
+
text: string;
|
|
75
|
+
};
|
|
76
|
+
/** 未激活状态配置 */
|
|
77
|
+
inactive: {
|
|
78
|
+
icon: string;
|
|
79
|
+
text: string;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 展开状态
|
|
84
|
+
*/
|
|
85
|
+
export interface ExpandState {
|
|
86
|
+
level1: boolean;
|
|
87
|
+
level2: boolean;
|
|
88
|
+
level3: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 层级类型
|
|
92
|
+
*/
|
|
93
|
+
export declare type LevelType = 'level1' | 'level2' | 'level3';
|
|
94
|
+
/**
|
|
95
|
+
* PisellTabbar 组件属性
|
|
96
|
+
*/
|
|
97
|
+
export interface PisellTabbarProps {
|
|
98
|
+
/** 数据源 */
|
|
99
|
+
dataSource?: TabbarDataSource[];
|
|
100
|
+
/** 当前选中的值(多层级 key 数组) */
|
|
101
|
+
value?: (string | number)[];
|
|
102
|
+
/** 值变化回调 */
|
|
103
|
+
onChange?: (value: (string | number)[]) => void;
|
|
104
|
+
/** 自定义类名 */
|
|
105
|
+
className?: string;
|
|
106
|
+
/** 自定义样式 */
|
|
107
|
+
style?: CSSProperties;
|
|
108
|
+
/** 层级配置(可按层级自定义) */
|
|
109
|
+
levelConfig?: Partial<Record<LevelType, Partial<TabbarLevelConfig>>>;
|
|
110
|
+
/** 展开配置 */
|
|
111
|
+
expandConfig?: ExpandConfig;
|
|
112
|
+
/** 最大层级数 */
|
|
113
|
+
maxLevel?: 1 | 2 | 3;
|
|
114
|
+
onSearch?: (value: string) => void;
|
|
115
|
+
/** 透传给内部 PisellFind 的搜索配置(如 inputRender 插槽)。 */
|
|
116
|
+
searchProps?: Record<string, any>;
|
|
117
|
+
/** 追加在一级分类末尾、且不参与分类选中态的操作卡片。 */
|
|
118
|
+
level1Actions?: TabbarActionItem[];
|
|
119
|
+
__designMode?: boolean;
|
|
120
|
+
}
|
|
121
|
+
export interface PisellTabbarRef {
|
|
122
|
+
closeSearchMode: () => void;
|
|
123
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Field } from '../../provider/dataSource/DataSourceContext';
|
|
2
|
+
export declare type ListResult = {
|
|
3
|
+
data: any[];
|
|
4
|
+
count: number;
|
|
5
|
+
page: number;
|
|
6
|
+
pageSize: number;
|
|
7
|
+
};
|
|
8
|
+
export declare type UseFormatParams = {
|
|
9
|
+
dataSourceKey: string;
|
|
10
|
+
fields: Field[];
|
|
11
|
+
};
|
|
12
|
+
export declare type ApiListResult = {
|
|
13
|
+
list: any[];
|
|
14
|
+
count: number;
|
|
15
|
+
size: number;
|
|
16
|
+
} & ({
|
|
17
|
+
page: number;
|
|
18
|
+
} | {
|
|
19
|
+
skip: number;
|
|
20
|
+
});
|
|
21
|
+
export declare type FormatListResultParams = ApiListResult | {
|
|
22
|
+
data: any[];
|
|
23
|
+
meta: {
|
|
24
|
+
count: number;
|
|
25
|
+
page: number;
|
|
26
|
+
pageSize: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare type FilterValue = {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
};
|
|
32
|
+
export declare type FilterOperator = '$includes' | '$dateAfter' | '$dateBefore' | '$eq' | '$in' | '$isTruly' | '$and';
|
|
33
|
+
export declare type SimpleFilterValue = {
|
|
34
|
+
[key in Exclude<FilterOperator, '$and'>]?: any;
|
|
35
|
+
};
|
|
36
|
+
export declare type AndFilterValue = {
|
|
37
|
+
$and: FilterCondition[];
|
|
38
|
+
};
|
|
39
|
+
export declare type FilterConditionValue = SimpleFilterValue | AndFilterValue;
|
|
40
|
+
export declare type FilterCondition = {
|
|
41
|
+
[key: string]: FilterConditionValue;
|
|
42
|
+
} | AndFilterValue;
|
|
43
|
+
declare const useFormat: ({ dataSourceKey, fields }: UseFormatParams) => {
|
|
44
|
+
formatListResult: (this: unknown, res: FormatListResultParams) => ListResult;
|
|
45
|
+
formatListParams: (this: unknown, params: any) => any;
|
|
46
|
+
formatCreateUpdateParams: (this: unknown, params: any) => any;
|
|
47
|
+
};
|
|
48
|
+
export default useFormat;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PisellLookupProps, PisellLookupRef } from '../pisellLookup';
|
|
3
|
+
/**
|
|
4
|
+
* 原生扫码事件名,对齐宿主端约定。
|
|
5
|
+
*/
|
|
6
|
+
export declare const SCAN_RESULT_EVENT = "nativeScanResult";
|
|
7
|
+
/** 无扫码焦点栈时,供页面级全局扫码监听避让 Find 的回退计数。 */
|
|
8
|
+
export declare const FIND_FALLBACK_SCANNER_COUNT_KEY = "__pisellFindFallbackScannerCount";
|
|
9
|
+
/**
|
|
10
|
+
* 扫码枪回传数据(对齐宿主 ScanResultPayload)
|
|
11
|
+
* - code: 条码标识(如条码格式 / 业务字段)
|
|
12
|
+
* - data: 扫描得到的字符串值(写入输入框的内容)
|
|
13
|
+
*/
|
|
14
|
+
export interface PisellFindScannerData {
|
|
15
|
+
code: string;
|
|
16
|
+
data: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* PisellFind Props
|
|
20
|
+
* 继承 PisellLookup 的所有 Props,并扩展扫码枪监听相关字段。
|
|
21
|
+
*/
|
|
22
|
+
export interface PisellFindProps extends PisellLookupProps {
|
|
23
|
+
/**
|
|
24
|
+
* 是否开启扫码枪监听
|
|
25
|
+
* - 优先:通过宿主 `appHelper.utils.acquireScanFocus` 接入「扫码焦点栈」,
|
|
26
|
+
* 保证同一页面存在多个 PisellFind 时,只有「栈顶」(最后开启监听的那个,
|
|
27
|
+
* 如列表上方拉起的弹窗)响应扫码,底层组件不响应;关闭/卸载时自动释放,焦点回退。
|
|
28
|
+
* - 回退:宿主未注册焦点栈时,退回到直连 `app.pubsub.subscribe('nativeScanResult', ...)`。
|
|
29
|
+
* 切换 false 时会释放焦点 / unsubscribe,停止接收事件。
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
enableScanner?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 扫码枪回调
|
|
35
|
+
* 监听到扫码枪事件时触发,参数为原始 payload 对象(含 `data` 字段)。
|
|
36
|
+
* 注意:仅在 enableScanner 为 true 时才会触发。
|
|
37
|
+
*/
|
|
38
|
+
onScannerData?: (data: PisellFindScannerData) => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* PisellFind Ref
|
|
42
|
+
* 继承 PisellLookup 的所有 Ref 方法
|
|
43
|
+
*/
|
|
44
|
+
export declare type PisellFindRef = PisellLookupRef;
|
|
45
|
+
/**
|
|
46
|
+
* PisellFind 组件
|
|
47
|
+
* 基于 PisellLookup 的组件内查找优化版本
|
|
48
|
+
*
|
|
49
|
+
* 核心特点:
|
|
50
|
+
* - 默认使用 button 触发器
|
|
51
|
+
* - 默认不显示确认按钮(输入即搜索)
|
|
52
|
+
* - 默认开启搜索历史
|
|
53
|
+
* - 默认不展示结果区(结果在页面其他位置展示)
|
|
54
|
+
* - 通过 `enableScanner` 接入扫码枪:优先走宿主注入的「扫码焦点栈」
|
|
55
|
+
* (`appHelper.utils.acquireScanFocus`),保证同页多个 PisellFind 只有栈顶响应;
|
|
56
|
+
* 宿主未注册时回退到直连 `app.pubsub.subscribe(SCAN_RESULT_EVENT, ...)`。
|
|
57
|
+
* 每次扫码直接覆盖输入框内容并触发 onSearch / onScannerData;切回 false 时自动释放 / unsubscribe。
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <PisellFind
|
|
62
|
+
* triggerType="input"
|
|
63
|
+
* enableScanner={isActive}
|
|
64
|
+
* onScannerData={(payload) => console.log('scan:', payload.data)}
|
|
65
|
+
* onSearch={(keyword) => filterData(keyword)}
|
|
66
|
+
* />
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare const PisellFind: React.ForwardRefExoticComponent<PisellFindProps & React.RefAttributes<PisellLookupRef>>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { MouseEvent, MutableRefObject } from 'react';
|
|
2
|
+
import { type PlacementBoundingBox } from '../utils/batchScenePlacementLayout';
|
|
3
|
+
import type { DataSourceFormColumn, FloorMapCanvasNameI18n, FloorMapDataSourceRecordFormContent, FloorMapDataSources, FloorMapItemBase, FloorMapMergedItem, FloorMapPlaceMode, FloorMapSceneElement, FloorMapViewConfig } from '../types';
|
|
4
|
+
export interface UseFloorMapEditStateParams<T extends FloorMapItemBase> {
|
|
5
|
+
floorMapConfigProp: FloorMapViewConfig | undefined;
|
|
6
|
+
isFloorMapView: boolean;
|
|
7
|
+
itemsProp: T[];
|
|
8
|
+
cellSizeProp?: number;
|
|
9
|
+
dataSources: FloorMapDataSources | undefined;
|
|
10
|
+
onSave: ((config: FloorMapViewConfig) => void) | undefined;
|
|
11
|
+
onDataSourceRecordSave: ((dataSourceKey: string, id: string, newData: Record<string, unknown>) => void) | undefined;
|
|
12
|
+
dataSourceFormColumns: Record<string, DataSourceFormColumn[]> | undefined;
|
|
13
|
+
dataSourceRecordForm: Record<string, FloorMapDataSourceRecordFormContent> | undefined;
|
|
14
|
+
dataSourceLabels?: Record<string, string>;
|
|
15
|
+
layoutPrefix: string;
|
|
16
|
+
contentOffsetRef: MutableRefObject<{
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}>;
|
|
20
|
+
showDataSourceRecordFormBlock?: boolean;
|
|
21
|
+
/** 批量落点后由布局层注入:将视口移至新增图元区域 */
|
|
22
|
+
focusViewportOnBoundsRef?: MutableRefObject<((bounds: PlacementBoundingBox) => void) | null>;
|
|
23
|
+
/**
|
|
24
|
+
* 网格显隐缓存命名空间(通常与视口 `viewportPersistNamespace` 同源,拼自业务/门店/平面图)。
|
|
25
|
+
* 传入后网格 localStorage key 变为 `prefix:namespace:canvasId`,隔离不同门店/场景;
|
|
26
|
+
* 不传则沿用 `prefix:canvasId`(向后兼容,跨场景可能共享)。
|
|
27
|
+
*/
|
|
28
|
+
gridPersistNamespace?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function useFloorMapEditState<T extends FloorMapItemBase>(params: UseFloorMapEditStateParams<T>): {
|
|
31
|
+
config: FloorMapViewConfig | null;
|
|
32
|
+
currentCanvasId: string | null;
|
|
33
|
+
setCurrentCanvasId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
34
|
+
selectedId: string | null;
|
|
35
|
+
setSelectedId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
36
|
+
placeMode: FloorMapPlaceMode;
|
|
37
|
+
setPlaceMode: import("react").Dispatch<import("react").SetStateAction<FloorMapPlaceMode>>;
|
|
38
|
+
mergedItems: FloorMapMergedItem[];
|
|
39
|
+
items: T[];
|
|
40
|
+
saving: boolean;
|
|
41
|
+
savingRecord: boolean;
|
|
42
|
+
handleAddCanvas: () => void;
|
|
43
|
+
handleRemoveCanvas: (canvasId: string) => void;
|
|
44
|
+
handleRenameCanvas: (canvasId: string, name: string | FloorMapCanvasNameI18n) => void;
|
|
45
|
+
handleUpdateItem: (itemId: string, patch: Partial<{
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
}>) => void;
|
|
51
|
+
handleUpdateItemsBatch: (patches: Array<{
|
|
52
|
+
id: string;
|
|
53
|
+
patch: Partial<{
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
}>;
|
|
59
|
+
}>) => void;
|
|
60
|
+
handleCanvasPlaceClick: (e: MouseEvent<HTMLDivElement>) => void;
|
|
61
|
+
handleSave: () => void;
|
|
62
|
+
discardDraft: () => void;
|
|
63
|
+
placeSceneElementFromPaletteDrop: (contentX: number, contentY: number, scene: Extract<FloorMapPlaceMode, {
|
|
64
|
+
type: 'scene';
|
|
65
|
+
}>) => boolean;
|
|
66
|
+
bulkPlacePaletteItems: (items: Array<{
|
|
67
|
+
elementKind: string;
|
|
68
|
+
builtinShapeKey?: string;
|
|
69
|
+
}>) => void;
|
|
70
|
+
editPanelParams: {
|
|
71
|
+
itemId: string;
|
|
72
|
+
sceneElement: FloorMapSceneElement;
|
|
73
|
+
onUpdate: (patch: Partial<FloorMapSceneElement>) => void;
|
|
74
|
+
onSaveRecord: ((dataSourceKey: string, id: string, newData: Record<string, unknown>) => void) | undefined;
|
|
75
|
+
onClose: () => void;
|
|
76
|
+
onDelete: (() => void) | undefined;
|
|
77
|
+
recordFormColumns: Record<string, DataSourceFormColumn[]> | undefined;
|
|
78
|
+
dataSourceRecordForm: Record<string, FloorMapDataSourceRecordFormContent> | undefined;
|
|
79
|
+
dataSourceLabels: Record<string, string> | undefined;
|
|
80
|
+
layoutDraftDirty: boolean;
|
|
81
|
+
showDataSourceRecordFormBlock: boolean | undefined;
|
|
82
|
+
} | null;
|
|
83
|
+
placeOverlayClass: string;
|
|
84
|
+
isLayoutDirty: boolean;
|
|
85
|
+
toggleDraftCanvasShowGrid: () => void;
|
|
86
|
+
toggleSelectedLayoutLock: () => void;
|
|
87
|
+
duplicateSelectedElement: () => void;
|
|
88
|
+
deleteSelectedElement: () => void;
|
|
89
|
+
undoDraft: () => void;
|
|
90
|
+
redoDraft: () => void;
|
|
91
|
+
canUndo: boolean;
|
|
92
|
+
canRedo: boolean;
|
|
93
|
+
commitDraft: (next: FloorMapViewConfig | ((prev: FloorMapViewConfig | null) => FloorMapViewConfig | null) | null, options?: import("./useDraftConfigHistory").DraftHistoryCommitOptions | undefined) => void;
|
|
94
|
+
};
|
|
@@ -57,6 +57,8 @@ var PisellLookupComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
57
57
|
showConfirmButton = _props$showConfirmBut === void 0 ? true : _props$showConfirmBut,
|
|
58
58
|
_props$confirmButtonT = props.confirmButtonText,
|
|
59
59
|
confirmButtonText = _props$confirmButtonT === void 0 ? getText('pisell-lookup-confirm-button-text') : _props$confirmButtonT,
|
|
60
|
+
_props$confirmButtonD = props.confirmButtonDisabled,
|
|
61
|
+
confirmButtonDisabled = _props$confirmButtonD === void 0 ? false : _props$confirmButtonD,
|
|
60
62
|
_props$closeButtonTex = props.closeButtonText,
|
|
61
63
|
closeButtonText = _props$closeButtonTex === void 0 ? getText('pisell-lookup-close') : _props$closeButtonTex,
|
|
62
64
|
value = props.value,
|
|
@@ -524,6 +526,7 @@ var PisellLookupComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
524
526
|
showClear: showClear,
|
|
525
527
|
showConfirmButton: showConfirmButton,
|
|
526
528
|
confirmButtonText: confirmButtonText,
|
|
529
|
+
confirmButtonDisabled: confirmButtonDisabled,
|
|
527
530
|
showScan: showScan,
|
|
528
531
|
value: keyword,
|
|
529
532
|
searchSource: searchSource,
|
|
@@ -675,6 +678,7 @@ var PisellLookupComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
675
678
|
showClear: showClear,
|
|
676
679
|
showConfirmButton: showConfirmButton,
|
|
677
680
|
confirmButtonText: confirmButtonText,
|
|
681
|
+
confirmButtonDisabled: confirmButtonDisabled,
|
|
678
682
|
showScan: showScan,
|
|
679
683
|
value: keyword,
|
|
680
684
|
searchSource: searchSource,
|
|
@@ -46,6 +46,8 @@ var LookupTriggerComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
46
46
|
showConfirmButton = _props$showConfirmBut === void 0 ? true : _props$showConfirmBut,
|
|
47
47
|
_props$confirmButtonT = props.confirmButtonText,
|
|
48
48
|
confirmButtonText = _props$confirmButtonT === void 0 ? getText('pisell-lookup-confirm-button-text') : _props$confirmButtonT,
|
|
49
|
+
_props$confirmButtonD = props.confirmButtonDisabled,
|
|
50
|
+
confirmButtonDisabled = _props$confirmButtonD === void 0 ? false : _props$confirmButtonD,
|
|
49
51
|
_props$showScan = props.showScan,
|
|
50
52
|
showScan = _props$showScan === void 0 ? true : _props$showScan,
|
|
51
53
|
value = props.value,
|
|
@@ -199,6 +201,7 @@ var LookupTriggerComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
199
201
|
* 处理确认
|
|
200
202
|
*/
|
|
201
203
|
var handleConfirm = function handleConfirm() {
|
|
204
|
+
if (disabled || confirmButtonDisabled) return;
|
|
202
205
|
_onConfirm === null || _onConfirm === void 0 || _onConfirm();
|
|
203
206
|
};
|
|
204
207
|
|
|
@@ -206,7 +209,7 @@ var LookupTriggerComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
206
209
|
* 处理按 Enter 键:传入当前输入值,避免受控模式下 state 未更新导致历史未保存
|
|
207
210
|
*/
|
|
208
211
|
var handleKeyPress = function handleKeyPress(e) {
|
|
209
|
-
if (e.key === 'Enter') {
|
|
212
|
+
if (e.key === 'Enter' && !disabled && !confirmButtonDisabled) {
|
|
210
213
|
var _ref2, _e$currentTarget$valu, _e$currentTarget;
|
|
211
214
|
var currentValue = (_ref2 = (_e$currentTarget$valu = (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.value) !== null && _e$currentTarget$valu !== void 0 ? _e$currentTarget$valu : value) !== null && _ref2 !== void 0 ? _ref2 : '';
|
|
212
215
|
_onConfirm === null || _onConfirm === void 0 || _onConfirm(currentValue);
|
|
@@ -269,7 +272,7 @@ var LookupTriggerComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
269
272
|
type: "primary",
|
|
270
273
|
size: size,
|
|
271
274
|
loading: loading,
|
|
272
|
-
disabled: disabled,
|
|
275
|
+
disabled: disabled || confirmButtonDisabled,
|
|
273
276
|
onClick: handleConfirm,
|
|
274
277
|
className: "pisell-lookup-input-confirm"
|
|
275
278
|
}, confirmButtonText));
|