@pallasoft/ps-mobile-components 1.11.0 → 1.13.0
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/dist/components/ps-action-sheet/ps-action-sheet.js +18 -2
- package/dist/components/ps-barcode-scanner-sheet/ps-barcode-scanner-sheet.js +2 -1
- package/dist/components/ps-document-highlight-layer/index.d.ts +2 -0
- package/dist/components/ps-document-highlight-layer/index.js +2 -0
- package/dist/components/ps-document-highlight-layer/ps-document-highlight-layer-props.d.ts +8 -0
- package/dist/components/ps-document-highlight-layer/ps-document-highlight-layer-props.js +1 -0
- package/dist/components/ps-document-highlight-layer/ps-document-highlight-layer.d.ts +2 -0
- package/dist/components/ps-document-highlight-layer/ps-document-highlight-layer.js +19 -0
- package/dist/components/ps-document-page/ps-document-page-props.d.ts +2 -0
- package/dist/components/ps-document-page/ps-document-page.d.ts +1 -1
- package/dist/components/ps-document-page/ps-document-page.js +3 -3
- package/dist/components/ps-document-search-bar/index.d.ts +2 -0
- package/dist/components/ps-document-search-bar/index.js +2 -0
- package/dist/components/ps-document-search-bar/ps-document-search-bar-props.d.ts +11 -0
- package/dist/components/ps-document-search-bar/ps-document-search-bar-props.js +1 -0
- package/dist/components/ps-document-search-bar/ps-document-search-bar.d.ts +2 -0
- package/dist/components/ps-document-search-bar/ps-document-search-bar.js +46 -0
- package/dist/components/ps-document-search-step/index.d.ts +2 -0
- package/dist/components/ps-document-search-step/index.js +2 -0
- package/dist/components/ps-document-search-step/ps-document-search-step-props.d.ts +7 -0
- package/dist/components/ps-document-search-step/ps-document-search-step-props.js +1 -0
- package/dist/components/ps-document-search-step/ps-document-search-step.d.ts +2 -0
- package/dist/components/ps-document-search-step/ps-document-search-step.js +30 -0
- package/dist/components/ps-document-text-page/ps-document-text-page-props.d.ts +2 -0
- package/dist/components/ps-document-text-page/ps-document-text-page.d.ts +1 -1
- package/dist/components/ps-document-text-page/ps-document-text-page.js +27 -3
- package/dist/components/ps-document-viewer/ps-document-viewer.js +53 -3
- package/dist/components/ps-document-zoom-image/ps-document-zoom-image-props.d.ts +4 -0
- package/dist/components/ps-document-zoom-image/ps-document-zoom-image.d.ts +1 -1
- package/dist/components/ps-document-zoom-image/ps-document-zoom-image.js +30 -3
- package/dist/components/ps-infinite-list/ps-infinite-list-props.d.ts +2 -0
- package/dist/components/ps-infinite-list/ps-infinite-list.d.ts +1 -1
- package/dist/components/ps-infinite-list/ps-infinite-list.js +12 -5
- package/dist/components/ps-list/ps-list-props.d.ts +2 -0
- package/dist/components/ps-list/ps-list.d.ts +1 -1
- package/dist/components/ps-list/ps-list.js +1 -1
- package/dist/components/ps-menu-popup/ps-menu-popup.js +3 -2
- package/dist/components/ps-screen/ps-screen-props.d.ts +2 -0
- package/dist/components/ps-screen/ps-screen.d.ts +1 -1
- package/dist/components/ps-screen/ps-screen.js +12 -5
- package/dist/components/ps-sheet-content/ps-sheet-content.js +4 -2
- package/dist/components/ps-sheet-presenter/ps-sheet-presenter.ios.js +15 -5
- package/dist/components/ps-sheet-presenter/ps-sheet-presenter.js +16 -3
- package/dist/components/ps-sortable-grid/ps-sortable-grid.js +4 -1
- package/dist/components/ps-text/ps-text-props.d.ts +1 -0
- package/dist/components/ps-text/ps-text.d.ts +1 -1
- package/dist/components/ps-text/ps-text.js +2 -2
- package/dist/components/ps-widget-list/ps-widget-grid.js +16 -7
- package/dist/components/ps-widget-list/ps-widget-list-props.d.ts +2 -0
- package/dist/components/ps-widget-list/ps-widget-list.d.ts +1 -1
- package/dist/components/ps-widget-list/ps-widget-list.js +12 -5
- package/dist/constants/ps-content-width.d.ts +6 -0
- package/dist/constants/ps-content-width.js +5 -0
- package/dist/constants/ps-document-search-config.d.ts +16 -0
- package/dist/constants/ps-document-search-config.js +16 -0
- package/dist/constants/ps-layout-class-config.d.ts +12 -0
- package/dist/constants/ps-layout-class-config.js +12 -0
- package/dist/constants/ps-layout-class.d.ts +5 -0
- package/dist/constants/ps-layout-class.js +4 -0
- package/dist/constants/ps-menu-popup-config.d.ts +1 -0
- package/dist/constants/ps-menu-popup-config.js +1 -0
- package/dist/constants/ps-orientation-config.d.ts +3 -0
- package/dist/constants/ps-orientation-config.js +3 -0
- package/dist/constants/ps-sheet-config.d.ts +1 -0
- package/dist/constants/ps-sheet-config.js +1 -0
- package/dist/constants/ps-sortable-grid-config.d.ts +2 -0
- package/dist/constants/ps-sortable-grid-config.js +2 -0
- package/dist/hooks/use-ps-document-search-texts.d.ts +2 -0
- package/dist/hooks/use-ps-document-search-texts.js +26 -0
- package/dist/hooks/use-ps-layout-class.d.ts +2 -0
- package/dist/hooks/use-ps-layout-class.js +6 -0
- package/dist/hooks/use-ps-menu-anchor.d.ts +1 -1
- package/dist/hooks/use-ps-menu-anchor.js +14 -2
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/interfaces/ps-document-highlight-rect.d.ts +5 -0
- package/dist/interfaces/ps-document-highlight-rect.js +1 -0
- package/dist/interfaces/ps-document-item.d.ts +3 -0
- package/dist/interfaces/ps-document-labels.d.ts +7 -0
- package/dist/interfaces/ps-document-point.d.ts +4 -0
- package/dist/interfaces/ps-document-point.js +1 -0
- package/dist/interfaces/ps-document-search-labels.d.ts +9 -0
- package/dist/interfaces/ps-document-search-labels.js +1 -0
- package/dist/interfaces/ps-document-search-location.d.ts +4 -0
- package/dist/interfaces/ps-document-search-location.js +1 -0
- package/dist/interfaces/ps-document-search-match.d.ts +2 -0
- package/dist/interfaces/ps-document-search-match.js +1 -0
- package/dist/interfaces/ps-document-search-state.d.ts +4 -0
- package/dist/interfaces/ps-document-search-state.js +1 -0
- package/dist/interfaces/ps-document-text-box.d.ts +2 -0
- package/dist/interfaces/ps-document-text-box.js +1 -0
- package/dist/interfaces/ps-document-text-layer-word.d.ts +2 -0
- package/dist/interfaces/ps-document-text-layer-word.js +1 -0
- package/dist/interfaces/ps-document-text-layer.d.ts +2 -0
- package/dist/interfaces/ps-document-text-layer.js +1 -0
- package/dist/interfaces/ps-document-text-line.d.ts +4 -0
- package/dist/interfaces/ps-document-text-line.js +1 -0
- package/dist/interfaces/ps-document-text-segment.d.ts +2 -0
- package/dist/interfaces/ps-document-text-segment.js +1 -0
- package/dist/interfaces/ps-document-word-match.d.ts +3 -0
- package/dist/interfaces/ps-document-word-match.js +1 -0
- package/dist/interfaces/ps-menu-popup-insets.d.ts +2 -0
- package/dist/interfaces/ps-menu-popup-layout.d.ts +1 -0
- package/dist/services/ps-document-search-service.d.ts +36 -0
- package/dist/services/ps-document-search-service.js +114 -0
- package/dist/services/ps-document-search-style-service.d.ts +7 -0
- package/dist/services/ps-document-search-style-service.js +22 -0
- package/dist/services/ps-document-viewer-entry-service.js +1 -0
- package/dist/services/ps-document-zoom-service.d.ts +1 -0
- package/dist/services/ps-document-zoom-service.js +3 -0
- package/dist/services/ps-layout-service.d.ts +12 -0
- package/dist/services/ps-layout-service.js +41 -0
- package/dist/services/ps-menu-popup-service.js +8 -4
- package/dist/services/ps-sheet-service.d.ts +5 -2
- package/dist/services/ps-sheet-service.js +17 -4
- package/dist/services/ps-sortable-grid-service.d.ts +3 -2
- package/dist/services/ps-sortable-grid-service.js +26 -22
- package/package.json +2 -2
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Platform, RefreshControl, SectionList, View } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
+
import { PsContentWidth } from '../../constants/ps-content-width';
|
|
4
5
|
import { PsInfiniteConfig } from '../../constants/ps-infinite-config';
|
|
5
6
|
import { PsLayoutConfig } from '../../constants/ps-layout-config';
|
|
6
7
|
import { PsSelectionBarConfig } from '../../constants/ps-selection-bar-config';
|
|
7
8
|
import { PsScrollContext } from '../../contexts/ps-scroll-context';
|
|
9
|
+
import { usePsLayoutClass } from '../../hooks/use-ps-layout-class';
|
|
8
10
|
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
9
11
|
import { usePsRefresh } from '../../hooks/use-ps-refresh';
|
|
10
12
|
import { usePsScrollHost } from '../../hooks/use-ps-scroll-host';
|
|
11
13
|
import { usePsTabBar } from '../../hooks/use-ps-tab-bar';
|
|
12
14
|
import { usePsTopInset } from '../../hooks/use-ps-top-inset';
|
|
13
15
|
import { PsInfiniteListService } from '../../services/ps-infinite-list-service';
|
|
16
|
+
import { PsLayoutService } from '../../services/ps-layout-service';
|
|
14
17
|
import { PsListService } from '../../services/ps-list-service';
|
|
15
18
|
import { PsScreenService } from '../../services/ps-screen-service';
|
|
16
19
|
import { PsSkeletonList } from '../ps-skeleton/ps-skeleton-list';
|
|
17
20
|
import { PsText } from '../ps-text/ps-text';
|
|
18
21
|
import { PsInfiniteListFooter } from './ps-infinite-list-footer';
|
|
19
22
|
import { PsInfiniteListItem } from './ps-infinite-list-item';
|
|
20
|
-
export const PsInfiniteList = ({ empty, hasMore, header, isLoading = false, isLoadingMore = false, items, keyExtractor, onEndReached, onRefresh, renderItem, sections, skeleton, style, variant = 'grouped', }) => {
|
|
23
|
+
export const PsInfiniteList = ({ contentWidth = PsContentWidth.readable, empty, hasMore, header, isLoading = false, isLoadingMore = false, items, keyExtractor, onEndReached, onRefresh, renderItem, sections, skeleton, style, variant = 'grouped', }) => {
|
|
21
24
|
const theme = usePsMobileTheme();
|
|
22
25
|
const insets = useSafeAreaInsets();
|
|
23
26
|
const topInset = usePsTopInset();
|
|
24
27
|
const { hasTabBar, isHidden: isTabBarHidden } = usePsTabBar();
|
|
25
28
|
const { isRefreshing, refresh } = usePsRefresh(onRefresh);
|
|
26
29
|
const host = usePsScrollHost();
|
|
30
|
+
const layoutClass = usePsLayoutClass();
|
|
27
31
|
const shown = isLoading ? [] : PsInfiniteListService.sections(items, sections);
|
|
28
|
-
return (_jsxs(View, { style: { flex: 1 }, children: [_jsx(PsScrollContext, { value: host.context, children: _jsx(SectionList, { ListEmptyComponent: isLoading ? _jsx(PsSkeletonList, { layout: skeleton }) : _jsx(_Fragment, { children: empty }), ListFooterComponent: _jsx(PsInfiniteListFooter, { isLoadingMore: isLoadingMore }), ListHeaderComponent: header === undefined ? undefined : (_jsx(View, { style: { marginBottom: PsLayoutConfig.listGap }, children: header })), contentContainerStyle:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
return (_jsxs(View, { style: { flex: 1 }, children: [_jsx(PsScrollContext, { value: host.context, children: _jsx(SectionList, { ListEmptyComponent: isLoading ? _jsx(PsSkeletonList, { layout: skeleton }) : _jsx(_Fragment, { children: empty }), ListFooterComponent: _jsx(PsInfiniteListFooter, { isLoadingMore: isLoadingMore }), ListHeaderComponent: header === undefined ? undefined : (_jsx(View, { style: { marginBottom: PsLayoutConfig.listGap }, children: header })), contentContainerStyle: [
|
|
33
|
+
PsScreenService.content({
|
|
34
|
+
bottom: PsScreenService.bottomInset(insets.bottom, hasTabBar, isTabBarHidden),
|
|
35
|
+
top: topInset,
|
|
36
|
+
}, Platform.OS === 'ios', PsListService.hasGutter(variant), 0, isTabBarHidden ? PsSelectionBarConfig.height : 0),
|
|
37
|
+
PsLayoutService.frame(layoutClass, contentWidth),
|
|
38
|
+
], contentInsetAdjustmentBehavior: 'automatic', initialNumToRender: PsInfiniteConfig.initialNumToRender, keyExtractor: keyExtractor, keyboardDismissMode: 'interactive', keyboardShouldPersistTaps: 'handled', maxToRenderPerBatch: PsInfiniteConfig.maxToRenderPerBatch, onContentSizeChange: host.onContentSizeChange, onEndReached: () => {
|
|
32
39
|
if (PsInfiniteListService.shouldLoadMore(hasMore, isLoading, isLoadingMore))
|
|
33
40
|
onEndReached();
|
|
34
41
|
}, onEndReachedThreshold: PsInfiniteConfig.endReachedThreshold, onLayout: host.onLayout, onScroll: host.onScroll, refreshControl: onRefresh === undefined ? undefined : (_jsx(RefreshControl, { colors: [theme.primaryText], onRefresh: () => void refresh(), progressBackgroundColor: theme.surface, refreshing: isRefreshing, tintColor: theme.primary })), renderItem: ({ index, item, section }) => (_jsx(PsInfiniteListItem, { count: section.data.length, index: index, children: renderItem(item) })), renderSectionFooter: ({ section }) => (_jsx(View, { style: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type { PsIconKey } from '@pallasoft/ps-icons';
|
|
3
3
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import type { PsContentWidth } from '../../constants/ps-content-width';
|
|
4
5
|
import type { PsMenuItem } from '../../interfaces/ps-menu-item';
|
|
5
6
|
import type { PsBadgeTone } from '../../services/ps-badge-tone-service';
|
|
6
7
|
import type { PsListVariant } from '../../services/ps-list-service';
|
|
@@ -26,6 +27,7 @@ export interface PsListSkeletonResolved {
|
|
|
26
27
|
}
|
|
27
28
|
export interface PsListProps {
|
|
28
29
|
children: ReactNode;
|
|
30
|
+
contentWidth?: PsContentWidth;
|
|
29
31
|
header?: ReactNode;
|
|
30
32
|
isLoading?: boolean;
|
|
31
33
|
onRefresh?: () => Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PsListProps } from './ps-list-props';
|
|
2
|
-
export declare const PsList: ({ children, header, isLoading, onRefresh, skeleton, style, variant, }: PsListProps) => import("react").JSX.Element;
|
|
2
|
+
export declare const PsList: ({ children, contentWidth, header, isLoading, onRefresh, skeleton, style, variant, }: PsListProps) => import("react").JSX.Element;
|
|
@@ -3,4 +3,4 @@ import { PsLayoutConfig } from '../../constants/ps-layout-config';
|
|
|
3
3
|
import { PsListService } from '../../services/ps-list-service';
|
|
4
4
|
import { PsScreen } from '../ps-screen/ps-screen';
|
|
5
5
|
import { PsSkeletonList } from '../ps-skeleton/ps-skeleton-list';
|
|
6
|
-
export const PsList = ({ children, header, isLoading = false, onRefresh, skeleton, style, variant = 'grouped', }) => (_jsx(PsScreen, { gap: PsLayoutConfig.listGap, hasGutter: PsListService.hasGutter(variant), header: header, onRefresh: onRefresh, style: style, children: isLoading ? _jsx(PsSkeletonList, { layout: skeleton }) : children }));
|
|
6
|
+
export const PsList = ({ children, contentWidth, header, isLoading = false, onRefresh, skeleton, style, variant = 'grouped', }) => (_jsx(PsScreen, { contentWidth: contentWidth, gap: PsLayoutConfig.listGap, hasGutter: PsListService.hasGutter(variant), header: header, onRefresh: onRefresh, style: style, children: isLoading ? _jsx(PsSkeletonList, { layout: skeleton }) : children }));
|
|
@@ -4,6 +4,7 @@ import { Modal, Pressable, ScrollView, StyleSheet, useWindowDimensions } from 'r
|
|
|
4
4
|
import Animated from 'react-native-reanimated';
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
6
|
import { PsMenuPopupConfig } from '../../constants/ps-menu-popup-config';
|
|
7
|
+
import { PsOrientationConfig } from '../../constants/ps-orientation-config';
|
|
7
8
|
import { usePsMaterialScheme } from '../../hooks/use-ps-material-scheme';
|
|
8
9
|
import { usePsMenuPopupReveal } from '../../hooks/use-ps-menu-popup-reveal';
|
|
9
10
|
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
@@ -21,7 +22,7 @@ export const PsMenuPopup = ({ anchor, children, isFullWidth = false, onClose, })
|
|
|
21
22
|
: PsMenuPopupService.layout(anchor, window, insets, size.height, size.width, isFullWidth);
|
|
22
23
|
const container = PsMenuPopupStyleService.container(theme, scheme, isMaterial);
|
|
23
24
|
const reveal = usePsMenuPopupReveal(size !== undefined, layout.isBelow, isMaterial);
|
|
24
|
-
return (_jsxs(Modal, { animationType: isMaterial ? 'none' : 'fade', navigationBarTranslucent: true, onRequestClose: onClose, statusBarTranslucent: true, transparent: true, visible: true, children: [_jsx(Pressable, { accessibilityElementsHidden: true, onPress: onClose, style: StyleSheet.absoluteFill, testID: 'ps-menu-popup-backdrop' }), _jsx(Animated.View, { onLayout: (event) => {
|
|
25
|
+
return (_jsxs(Modal, { animationType: isMaterial ? 'none' : 'fade', navigationBarTranslucent: true, onRequestClose: onClose, statusBarTranslucent: true, supportedOrientations: PsOrientationConfig.all, transparent: true, visible: true, children: [_jsx(Pressable, { accessibilityElementsHidden: true, onPress: onClose, style: StyleSheet.absoluteFill, testID: 'ps-menu-popup-backdrop' }), _jsx(Animated.View, { onLayout: (event) => {
|
|
25
26
|
if (size === undefined)
|
|
26
27
|
setSize({
|
|
27
28
|
height: event.nativeEvent.layout.height,
|
|
@@ -36,7 +37,7 @@ export const PsMenuPopup = ({ anchor, children, isFullWidth = false, onClose, })
|
|
|
36
37
|
elevation: container.elevation,
|
|
37
38
|
left: layout.left,
|
|
38
39
|
maxHeight: layout.maxHeight,
|
|
39
|
-
maxWidth: PsMenuPopupConfig.maxWidth,
|
|
40
|
+
maxWidth: Math.min(PsMenuPopupConfig.maxWidth, layout.maxWidth),
|
|
40
41
|
minWidth: isFullWidth ? undefined : PsMenuPopupConfig.minWidth,
|
|
41
42
|
overflow: 'hidden',
|
|
42
43
|
position: 'absolute',
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { PsContentWidth } from '../../constants/ps-content-width';
|
|
3
4
|
export interface PsScreenProps {
|
|
4
5
|
children: ReactNode;
|
|
6
|
+
contentWidth?: PsContentWidth;
|
|
5
7
|
gap?: number;
|
|
6
8
|
hasGutter?: boolean;
|
|
7
9
|
header?: ReactNode;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PsScreenProps } from './ps-screen-props';
|
|
2
|
-
export declare const PsScreen: ({ children, gap, hasGutter, header, onRefresh, style, }: PsScreenProps) => import("react").JSX.Element;
|
|
2
|
+
export declare const PsScreen: ({ children, contentWidth, gap, hasGutter, header, onRefresh, style, }: PsScreenProps) => import("react").JSX.Element;
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Platform, RefreshControl, ScrollView, View } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
+
import { PsContentWidth } from '../../constants/ps-content-width';
|
|
4
5
|
import { PsLayoutConfig } from '../../constants/ps-layout-config';
|
|
5
6
|
import { PsSelectionBarConfig } from '../../constants/ps-selection-bar-config';
|
|
6
7
|
import { PsScrollContext } from '../../contexts/ps-scroll-context';
|
|
8
|
+
import { usePsLayoutClass } from '../../hooks/use-ps-layout-class';
|
|
7
9
|
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
8
10
|
import { usePsRefresh } from '../../hooks/use-ps-refresh';
|
|
9
11
|
import { usePsScrollHost } from '../../hooks/use-ps-scroll-host';
|
|
10
12
|
import { usePsTabBar } from '../../hooks/use-ps-tab-bar';
|
|
11
13
|
import { usePsTopInset } from '../../hooks/use-ps-top-inset';
|
|
14
|
+
import { PsLayoutService } from '../../services/ps-layout-service';
|
|
12
15
|
import { PsScreenService } from '../../services/ps-screen-service';
|
|
13
|
-
export const PsScreen = ({ children, gap = PsLayoutConfig.listGap, hasGutter = true, header, onRefresh, style, }) => {
|
|
16
|
+
export const PsScreen = ({ children, contentWidth = PsContentWidth.readable, gap = PsLayoutConfig.listGap, hasGutter = true, header, onRefresh, style, }) => {
|
|
14
17
|
const theme = usePsMobileTheme();
|
|
15
18
|
const insets = useSafeAreaInsets();
|
|
16
19
|
const topInset = usePsTopInset();
|
|
17
20
|
const { hasTabBar, isHidden: isTabBarHidden } = usePsTabBar();
|
|
18
21
|
const { isRefreshing, refresh } = usePsRefresh(onRefresh);
|
|
19
22
|
const host = usePsScrollHost();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const layoutClass = usePsLayoutClass();
|
|
24
|
+
return (_jsxs(View, { style: { flex: 1 }, children: [_jsx(ScrollView, { contentContainerStyle: [
|
|
25
|
+
PsScreenService.content({
|
|
26
|
+
bottom: PsScreenService.bottomInset(insets.bottom, hasTabBar, isTabBarHidden),
|
|
27
|
+
top: topInset,
|
|
28
|
+
}, Platform.OS === 'ios', hasGutter, gap, isTabBarHidden ? PsSelectionBarConfig.height : 0),
|
|
29
|
+
PsLayoutService.frame(layoutClass, contentWidth),
|
|
30
|
+
], contentInsetAdjustmentBehavior: 'automatic', keyboardDismissMode: 'interactive', onContentSizeChange: host.onContentSizeChange, onLayout: host.onLayout, onScroll: host.onScroll, keyboardShouldPersistTaps: 'handled', refreshControl: onRefresh === undefined ? undefined : (_jsx(RefreshControl, { colors: [theme.primaryText], progressBackgroundColor: theme.surface, onRefresh: () => void refresh(), refreshing: isRefreshing, tintColor: theme.primary })), ref: host.scrollRef, scrollEnabled: !host.isLocked, scrollEventThrottle: PsLayoutConfig.scrollEventThrottle, showsVerticalScrollIndicator: false, style: [{ backgroundColor: theme.background, flex: 1 }, style], testID: 'ps-screen', children: _jsxs(PsScrollContext, { value: host.context, children: [header, children] }) }), header === undefined ? null : (_jsx(View, { pointerEvents: 'none', style: [PsScreenService.statusBarScrim(topInset), { backgroundColor: theme.background }], testID: 'ps-screen-status-bar-scrim' }))] }));
|
|
24
31
|
};
|
|
@@ -4,6 +4,7 @@ import { Platform, ScrollView, View, useWindowDimensions } from 'react-native';
|
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
5
|
import { PsLayoutConfig } from '../../constants/ps-layout-config';
|
|
6
6
|
import { PsSheetMeasureContext } from '../../contexts/ps-sheet-measure-context';
|
|
7
|
+
import { usePsLayoutClass } from '../../hooks/use-ps-layout-class';
|
|
7
8
|
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
8
9
|
import { PsSheetService } from '../../services/ps-sheet-service';
|
|
9
10
|
import { PsSheetHeader } from '../ps-sheet-header/ps-sheet-header';
|
|
@@ -11,11 +12,12 @@ export const PsSheetContent = ({ children, footer, header, isScrollable }) => {
|
|
|
11
12
|
const theme = usePsMobileTheme();
|
|
12
13
|
const insets = useSafeAreaInsets();
|
|
13
14
|
const { height } = useWindowDimensions();
|
|
15
|
+
const layoutClass = usePsLayoutClass();
|
|
14
16
|
const report = useContext(PsSheetMeasureContext);
|
|
15
17
|
const [headerHeight, setHeaderHeight] = useState(0);
|
|
16
18
|
const [bodyHeight, setBodyHeight] = useState(0);
|
|
17
19
|
const fitted = headerHeight > 0 && bodyHeight > 0
|
|
18
|
-
? PsSheetService.fittedHeight(headerHeight, bodyHeight, height)
|
|
20
|
+
? PsSheetService.fittedHeight(headerHeight, bodyHeight, height, layoutClass)
|
|
19
21
|
: null;
|
|
20
22
|
useEffect(() => {
|
|
21
23
|
if (fitted !== null)
|
|
@@ -35,6 +37,6 @@ export const PsSheetContent = ({ children, footer, header, isScrollable }) => {
|
|
|
35
37
|
return (_jsxs(View, { style: {
|
|
36
38
|
backgroundColor: theme.background,
|
|
37
39
|
height: fitted === null ? undefined : fitted,
|
|
38
|
-
maxHeight: PsSheetService.maxHeight(height),
|
|
40
|
+
maxHeight: PsSheetService.maxHeight(height, layoutClass),
|
|
39
41
|
}, testID: 'ps-sheet', children: [_jsx(View, { onLayout: (event) => setHeaderHeight(event.nativeEvent.layout.height), children: _jsx(PsSheetHeader, { ...header }) }), isScrollable ? (_jsx(ScrollView, { automaticallyAdjustKeyboardInsets: true, contentContainerStyle: contentStyle, keyboardDismissMode: 'interactive', keyboardShouldPersistTaps: 'handled', onContentSizeChange: (_width, contentHeight) => setBodyHeight(contentHeight), style: { flexGrow: 0 }, children: body })) : (_jsx(View, { onLayout: (event) => setBodyHeight(event.nativeEvent.layout.height), style: contentStyle, children: body }))] }));
|
|
40
42
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { BottomSheet, Group, RNHostView } from '@expo/ui/swift-ui';
|
|
4
|
-
import { frame, interactiveDismissDisabled, presentationBackground, presentationDetents, presentationDragIndicator, } from '@expo/ui/swift-ui/modifiers';
|
|
5
|
-
import { useWindowDimensions } from 'react-native';
|
|
4
|
+
import { frame, interactiveDismissDisabled, presentationBackground, presentationDetents, presentationDragIndicator, presentationSizing, } from '@expo/ui/swift-ui/modifiers';
|
|
5
|
+
import { Platform, useWindowDimensions } from 'react-native';
|
|
6
6
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
7
|
+
import { PsLayoutClass } from '../../constants/ps-layout-class';
|
|
7
8
|
import { PsNativeTreeContext } from '../../contexts/ps-native-tree-context';
|
|
8
9
|
import { PsSheetMeasureContext } from '../../contexts/ps-sheet-measure-context';
|
|
9
10
|
import { usePsKeyboardHeight } from '../../hooks/use-ps-keyboard-height';
|
|
11
|
+
import { usePsLayoutClass } from '../../hooks/use-ps-layout-class';
|
|
10
12
|
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
11
13
|
import { PsSheetService } from '../../services/ps-sheet-service';
|
|
12
14
|
import { PsHost } from '../ps-host/ps-host';
|
|
@@ -18,6 +20,8 @@ export const PsSheetPresenter = ({ children, isDismissBlocked, isOpen, onClose,
|
|
|
18
20
|
const keyboardHeight = usePsKeyboardHeight();
|
|
19
21
|
const window = useWindowDimensions();
|
|
20
22
|
const insets = useSafeAreaInsets();
|
|
23
|
+
const isForm = usePsLayoutClass() === PsLayoutClass.regular &&
|
|
24
|
+
PsSheetService.supportsFormSizing(Platform.Version);
|
|
21
25
|
const detentHeight = height > 0 ? PsSheetService.raisedHeight(height, keyboardHeight, window.height, insets.top) : 0;
|
|
22
26
|
isOpenRef.current = isOpen;
|
|
23
27
|
isBlockedRef.current = isDismissBlocked;
|
|
@@ -33,9 +37,15 @@ export const PsSheetPresenter = ({ children, isDismissBlocked, isOpen, onClose,
|
|
|
33
37
|
onClose();
|
|
34
38
|
}
|
|
35
39
|
}, children: _jsx(Group, { modifiers: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
isForm
|
|
41
|
+
? frame({ alignment: 'top', maxWidth: Infinity })
|
|
42
|
+
: frame({ alignment: 'top', maxHeight: Infinity, maxWidth: Infinity }),
|
|
43
|
+
...(isForm
|
|
44
|
+
? [presentationSizing('form', { fitted: { horizontal: false, vertical: true } })]
|
|
45
|
+
: [
|
|
46
|
+
presentationDetents(detentHeight > 0 ? [{ height: detentHeight }] : ['medium']),
|
|
47
|
+
presentationDragIndicator('visible'),
|
|
48
|
+
]),
|
|
39
49
|
presentationBackground(theme.background),
|
|
40
50
|
interactiveDismissDisabled(isDismissBlocked),
|
|
41
51
|
], children: _jsx(RNHostView, { matchContents: { vertical: true }, children: _jsx(PsNativeTreeContext.Provider, { value: false, children: _jsx(PsSheetMeasureContext.Provider, { value: measure, children: children }) }) }) }) }) }));
|
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Modal, Pressable, StyleSheet, View } from 'react-native';
|
|
2
|
+
import { Modal, Pressable, StyleSheet, View, useWindowDimensions } from 'react-native';
|
|
3
|
+
import { PsLayoutClass } from '../../constants/ps-layout-class';
|
|
4
|
+
import { PsOrientationConfig } from '../../constants/ps-orientation-config';
|
|
3
5
|
import { PsSheetConfig } from '../../constants/ps-sheet-config';
|
|
6
|
+
import { usePsLayoutClass } from '../../hooks/use-ps-layout-class';
|
|
4
7
|
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
8
|
+
import { PsSheetService } from '../../services/ps-sheet-service';
|
|
5
9
|
export const PsSheetPresenter = ({ children, isDismissBlocked, isOpen, onClose, }) => {
|
|
6
10
|
const theme = usePsMobileTheme();
|
|
7
|
-
|
|
11
|
+
const layoutClass = usePsLayoutClass();
|
|
12
|
+
const window = useWindowDimensions();
|
|
13
|
+
const isRegular = layoutClass === PsLayoutClass.regular;
|
|
14
|
+
const maxWidth = PsSheetService.fittedMaxWidth(window.width, layoutClass);
|
|
15
|
+
return (_jsx(Modal, { animationType: 'slide', onRequestClose: isDismissBlocked ? undefined : onClose, statusBarTranslucent: true, supportedOrientations: PsOrientationConfig.all, transparent: true, visible: isOpen, children: _jsxs(View, { style: {
|
|
8
16
|
backgroundColor: theme.overlay,
|
|
17
|
+
alignItems: isRegular ? 'center' : undefined,
|
|
9
18
|
flex: 1,
|
|
10
|
-
justifyContent: 'flex-end',
|
|
19
|
+
justifyContent: isRegular ? 'center' : 'flex-end',
|
|
11
20
|
}, children: [_jsx(Pressable, { onPress: isDismissBlocked ? undefined : onClose, style: StyleSheet.absoluteFill, testID: 'ps-sheet-scrim' }), _jsx(View, { style: {
|
|
12
21
|
backgroundColor: theme.background,
|
|
22
|
+
borderBottomLeftRadius: isRegular ? PsSheetConfig.cornerRadius : 0,
|
|
23
|
+
borderBottomRightRadius: isRegular ? PsSheetConfig.cornerRadius : 0,
|
|
13
24
|
borderTopLeftRadius: PsSheetConfig.cornerRadius,
|
|
14
25
|
borderTopRightRadius: PsSheetConfig.cornerRadius,
|
|
26
|
+
maxWidth,
|
|
15
27
|
overflow: 'hidden',
|
|
28
|
+
width: isRegular ? '100%' : undefined,
|
|
16
29
|
}, children: children })] }) }));
|
|
17
30
|
};
|
|
@@ -5,14 +5,17 @@ import { useSharedValue } from 'react-native-reanimated';
|
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
6
|
import { PsSortableGridConfig } from '../../constants/ps-sortable-grid-config';
|
|
7
7
|
import { PsScrollContext } from '../../contexts/ps-scroll-context';
|
|
8
|
+
import { usePsLayoutClass } from '../../hooks/use-ps-layout-class';
|
|
8
9
|
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
9
10
|
import { PsHapticService } from '../../services/ps-haptic-service';
|
|
11
|
+
import { PsLayoutService } from '../../services/ps-layout-service';
|
|
10
12
|
import { PsSortableGridService } from '../../services/ps-sortable-grid-service';
|
|
11
13
|
import { PsSortableItem } from './ps-sortable-item';
|
|
12
14
|
export const PsSortableGrid = ({ getItemSpan, isDisabled = false, items, labels, onReorder, renderItem, }) => {
|
|
13
15
|
const scroll = useContext(PsScrollContext);
|
|
14
16
|
const { hasHaptics } = usePsMobileTheme();
|
|
15
17
|
const insets = useSafeAreaInsets();
|
|
18
|
+
const capacity = PsLayoutService.gridUnits(usePsLayoutClass());
|
|
16
19
|
const { height: windowHeight } = useWindowDimensions();
|
|
17
20
|
const [order, setOrder] = useState(items);
|
|
18
21
|
const [activeId, setActiveId] = useState(null);
|
|
@@ -30,7 +33,7 @@ export const PsSortableGrid = ({ getItemSpan, isDisabled = false, items, labels,
|
|
|
30
33
|
translationY: 0,
|
|
31
34
|
});
|
|
32
35
|
const ids = useMemo(() => PsSortableGridService.ids(order), [order]);
|
|
33
|
-
const rects = useMemo(() => PsSortableGridService.layout(order.map((item) => getItemSpan(item)), PsSortableGridService.heights(ids, measured), width), [getItemSpan, ids, measured, order, width]);
|
|
36
|
+
const rects = useMemo(() => PsSortableGridService.layout(order.map((item) => getItemSpan(item)), PsSortableGridService.heights(ids, measured), width, capacity), [capacity, getItemSpan, ids, measured, order, width]);
|
|
34
37
|
const extras = useMemo(() => PsSortableGridService.extras(rects, PsSortableGridService.heights(ids, measured)), [ids, measured, rects]);
|
|
35
38
|
const isReady = PsSortableGridService.isMeasured(ids, measured, width);
|
|
36
39
|
const latest = useRef({ items, onReorder, order, rects, scroll, windowHeight, insets });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PsTextProps } from './ps-text-props';
|
|
2
|
-
export declare const PsText: ({ accessibilityRole, align, children, ellipsizeMode, isSelectable, numberOfLines, onPress, style, testID, tone, variant, weight, }: PsTextProps) => import("react").JSX.Element;
|
|
2
|
+
export declare const PsText: ({ accessibilityRole, align, children, ellipsizeMode, isSelectable, numberOfLines, onPress, onTextLayout, style, testID, tone, variant, weight, }: PsTextProps) => import("react").JSX.Element;
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { StyleSheet, Text } from 'react-native';
|
|
3
3
|
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
4
4
|
import { PsTextService } from '../../services/ps-text-service';
|
|
5
|
-
export const PsText = ({ accessibilityRole, align, children, ellipsizeMode = 'tail', isSelectable = false, numberOfLines, onPress, style, testID, tone = 'ink', variant = 'body', weight, }) => {
|
|
5
|
+
export const PsText = ({ accessibilityRole, align, children, ellipsizeMode = 'tail', isSelectable = false, numberOfLines, onPress, onTextLayout, style, testID, tone = 'ink', variant = 'body', weight, }) => {
|
|
6
6
|
const theme = usePsMobileTheme();
|
|
7
|
-
return (_jsx(Text, { accessibilityRole: accessibilityRole, ellipsizeMode: ellipsizeMode, numberOfLines: numberOfLines, onPress: onPress, selectable: isSelectable, style: StyleSheet.flatten([
|
|
7
|
+
return (_jsx(Text, { accessibilityRole: accessibilityRole, ellipsizeMode: ellipsizeMode, numberOfLines: numberOfLines, onPress: onPress, onTextLayout: onTextLayout, selectable: isSelectable, style: StyleSheet.flatten([
|
|
8
8
|
PsTextService.style(variant, tone, weight, theme),
|
|
9
9
|
{ textAlign: align },
|
|
10
10
|
style,
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Children } from 'react';
|
|
2
|
+
import { Children, useState } from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import { PsChartConfig } from '../../constants/ps-chart-config';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { usePsLayoutClass } from '../../hooks/use-ps-layout-class';
|
|
6
|
+
import { PsLayoutService } from '../../services/ps-layout-service';
|
|
7
|
+
export const PsWidgetGrid = ({ children }) => {
|
|
8
|
+
const layoutClass = usePsLayoutClass();
|
|
9
|
+
const [width, setWidth] = useState(0);
|
|
10
|
+
const itemWidth = PsLayoutService.widgetWidth(width, layoutClass, PsChartConfig.kpiGap);
|
|
11
|
+
return (_jsx(View, { onLayout: (event) => setWidth(event.nativeEvent.layout.width), style: {
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
flexWrap: 'wrap',
|
|
14
|
+
gap: PsChartConfig.kpiGap,
|
|
15
|
+
justifyContent: itemWidth === undefined ? 'space-between' : 'flex-start',
|
|
16
|
+
}, children: Children.toArray(children).map((child, index) => (_jsx(View, { style: itemWidth === undefined
|
|
17
|
+
? { flexBasis: PsLayoutService.widgetBasis(layoutClass), flexGrow: 0, flexShrink: 1 }
|
|
18
|
+
: { flexGrow: 0, flexShrink: 0, width: itemWidth }, children: child }, index))) }));
|
|
19
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { PsContentWidth } from '../../constants/ps-content-width';
|
|
3
4
|
export interface PsWidgetListProps {
|
|
4
5
|
children: ReactNode;
|
|
6
|
+
contentWidth?: PsContentWidth;
|
|
5
7
|
onRefresh?: () => Promise<void>;
|
|
6
8
|
style?: StyleProp<ViewStyle>;
|
|
7
9
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PsWidgetListProps } from './ps-widget-list-props';
|
|
2
|
-
export declare const PsWidgetList: ({ children, onRefresh, style }: PsWidgetListProps) => import("react").JSX.Element;
|
|
2
|
+
export declare const PsWidgetList: ({ children, contentWidth, onRefresh, style, }: PsWidgetListProps) => import("react").JSX.Element;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { RefreshControl, ScrollView } from 'react-native';
|
|
3
|
+
import { PsContentWidth } from '../../constants/ps-content-width';
|
|
3
4
|
import { PsListConfig } from '../../constants/ps-list-config';
|
|
4
5
|
import { PsMobileControlConfig } from '../../constants/ps-mobile-control-config';
|
|
6
|
+
import { usePsLayoutClass } from '../../hooks/use-ps-layout-class';
|
|
5
7
|
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
6
8
|
import { usePsRefresh } from '../../hooks/use-ps-refresh';
|
|
7
|
-
|
|
9
|
+
import { PsLayoutService } from '../../services/ps-layout-service';
|
|
10
|
+
export const PsWidgetList = ({ children, contentWidth = PsContentWidth.wide, onRefresh, style, }) => {
|
|
11
|
+
const layoutClass = usePsLayoutClass();
|
|
8
12
|
const theme = usePsMobileTheme();
|
|
9
13
|
const { isRefreshing, refresh } = usePsRefresh(onRefresh);
|
|
10
|
-
return (_jsx(ScrollView, { contentContainerStyle:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
return (_jsx(ScrollView, { contentContainerStyle: [
|
|
15
|
+
{
|
|
16
|
+
gap: PsMobileControlConfig.rowSpacing,
|
|
17
|
+
padding: PsListConfig.contentInset,
|
|
18
|
+
},
|
|
19
|
+
PsLayoutService.frame(layoutClass, contentWidth),
|
|
20
|
+
], contentInsetAdjustmentBehavior: 'automatic', refreshControl: onRefresh === undefined ? undefined : (_jsx(RefreshControl, { colors: [theme.primaryText], progressBackgroundColor: theme.surface, onRefresh: () => void refresh(), refreshing: isRefreshing, tintColor: theme.primary })), style: [{ backgroundColor: theme.background, flex: 1 }, style], children: children }));
|
|
14
21
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const PsDocumentSearchConfig: {
|
|
2
|
+
readonly activeAlpha: 0.9;
|
|
3
|
+
readonly androidFieldRadius: 999;
|
|
4
|
+
readonly barGap: 8;
|
|
5
|
+
readonly currentToken: "{current}";
|
|
6
|
+
readonly fieldAlpha: 0.14;
|
|
7
|
+
readonly fieldPaddingX: 12;
|
|
8
|
+
readonly highlightAlpha: 0.4;
|
|
9
|
+
readonly highlightRadius: 3;
|
|
10
|
+
readonly iosFieldRadius: 10;
|
|
11
|
+
readonly noActive: -1;
|
|
12
|
+
readonly rotateDown: "0deg";
|
|
13
|
+
readonly rotateUp: "180deg";
|
|
14
|
+
readonly scrollMargin: 48;
|
|
15
|
+
readonly totalToken: "{total}";
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const PsDocumentSearchConfig = {
|
|
2
|
+
activeAlpha: 0.9,
|
|
3
|
+
androidFieldRadius: 999,
|
|
4
|
+
barGap: 8,
|
|
5
|
+
currentToken: '{current}',
|
|
6
|
+
fieldAlpha: 0.14,
|
|
7
|
+
fieldPaddingX: 12,
|
|
8
|
+
highlightAlpha: 0.4,
|
|
9
|
+
highlightRadius: 3,
|
|
10
|
+
iosFieldRadius: 10,
|
|
11
|
+
noActive: -1,
|
|
12
|
+
rotateDown: '0deg',
|
|
13
|
+
rotateUp: '180deg',
|
|
14
|
+
scrollMargin: 48,
|
|
15
|
+
totalToken: '{total}',
|
|
16
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const PsLayoutClassConfig: {
|
|
2
|
+
readonly compactGridUnits: 2;
|
|
3
|
+
readonly compactWidgetBasis: "47.5%";
|
|
4
|
+
readonly formSheetMaxHeightFraction: 0.8;
|
|
5
|
+
readonly formSheetWidth: 540;
|
|
6
|
+
readonly readableMaxWidth: 768;
|
|
7
|
+
readonly regularGridUnits: 4;
|
|
8
|
+
readonly regularMinHeight: 480;
|
|
9
|
+
readonly regularMinWidth: 600;
|
|
10
|
+
readonly regularWidgetBasis: "23%";
|
|
11
|
+
readonly wideMaxWidth: 1180;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const PsLayoutClassConfig = {
|
|
2
|
+
compactGridUnits: 2,
|
|
3
|
+
compactWidgetBasis: '47.5%',
|
|
4
|
+
formSheetMaxHeightFraction: 0.8,
|
|
5
|
+
formSheetWidth: 540,
|
|
6
|
+
readableMaxWidth: 768,
|
|
7
|
+
regularGridUnits: 4,
|
|
8
|
+
regularMinHeight: 480,
|
|
9
|
+
regularMinWidth: 600,
|
|
10
|
+
regularWidgetBasis: '23%',
|
|
11
|
+
wideMaxWidth: 1180,
|
|
12
|
+
};
|
|
@@ -2,6 +2,7 @@ export declare const PsSheetConfig: {
|
|
|
2
2
|
readonly actionMinWidth: 44;
|
|
3
3
|
readonly actionSpinnerGap: 6;
|
|
4
4
|
readonly cornerRadius: 20;
|
|
5
|
+
readonly formSizingMinIos: 18;
|
|
5
6
|
readonly headerMinHeight: 64;
|
|
6
7
|
readonly headerPaddingBottom: 12;
|
|
7
8
|
readonly headerPaddingHorizontal: 16;
|
|
@@ -2,7 +2,9 @@ export declare const PsSortableGridConfig: {
|
|
|
2
2
|
readonly activeScale: 1.03;
|
|
3
3
|
readonly activeZIndex: 10;
|
|
4
4
|
readonly columnGap: 12;
|
|
5
|
+
readonly compactUnits: 2;
|
|
5
6
|
readonly edgeRatio: 0.14;
|
|
7
|
+
readonly fullUnits: 2;
|
|
6
8
|
readonly holdTolerance: 8;
|
|
7
9
|
readonly longPressMs: 400;
|
|
8
10
|
readonly maxScrollStep: 18;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { PsDocumentTextService } from '../services/ps-document-text-service';
|
|
3
|
+
export const usePsDocumentSearchTexts = (items, isActive) => {
|
|
4
|
+
const [texts, setTexts] = useState({});
|
|
5
|
+
const key = items
|
|
6
|
+
.filter((item) => PsDocumentTextService.needsLoad(item))
|
|
7
|
+
.map((item) => item.id)
|
|
8
|
+
.join('|');
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!isActive || key === '')
|
|
11
|
+
return undefined;
|
|
12
|
+
let isCurrent = true;
|
|
13
|
+
items
|
|
14
|
+
.filter((item) => PsDocumentTextService.needsLoad(item))
|
|
15
|
+
.forEach((item) => {
|
|
16
|
+
void PsDocumentTextService.load(item).then((text) => {
|
|
17
|
+
if (isCurrent && text !== null)
|
|
18
|
+
setTexts((previous) => ({ ...previous, [item.id]: text }));
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
return () => {
|
|
22
|
+
isCurrent = false;
|
|
23
|
+
};
|
|
24
|
+
}, [isActive, key]);
|
|
25
|
+
return texts;
|
|
26
|
+
};
|