@pallasoft/ps-mobile-components 1.12.0 → 1.13.1
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-chart-bar/ps-chart-bar.js +11 -4
- package/dist/components/ps-document-viewer/ps-document-viewer.js +2 -1
- package/dist/components/ps-document-zoom-image/ps-document-zoom-image.js +10 -0
- package/dist/components/ps-donut-chart/ps-donut-chart.js +5 -4
- package/dist/components/ps-donut-reveal/index.d.ts +1 -0
- package/dist/components/ps-donut-reveal/index.js +1 -0
- package/dist/components/ps-donut-reveal/ps-donut-reveal-props.d.ts +6 -0
- package/dist/components/ps-donut-reveal/ps-donut-reveal.d.ts +2 -0
- package/dist/components/ps-donut-reveal/ps-donut-reveal.js +14 -0
- package/dist/components/ps-donut-slice/ps-donut-slice-props.d.ts +0 -4
- package/dist/components/ps-donut-slice/ps-donut-slice.d.ts +1 -1
- package/dist/components/ps-donut-slice/ps-donut-slice.js +2 -14
- 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 +7 -4
- package/dist/components/ps-sortable-grid/ps-sortable-item-props.d.ts +1 -1
- package/dist/components/ps-sortable-grid/ps-sortable-item.js +19 -5
- 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-chart-bar-corner.d.ts +6 -0
- package/dist/constants/ps-chart-bar-corner.js +5 -0
- package/dist/constants/ps-chart-config.d.ts +4 -1
- package/dist/constants/ps-chart-config.js +4 -1
- 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 +0 -3
- package/dist/constants/ps-document-search-config.js +0 -3
- 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 +4 -0
- package/dist/constants/ps-sortable-grid-config.js +4 -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 +4 -0
- package/dist/index.js +4 -0
- package/dist/interfaces/ps-chart-arc-data.d.ts +9 -0
- package/dist/interfaces/ps-chart-arc-data.js +1 -0
- package/dist/interfaces/ps-chart-bar-rect.d.ts +2 -0
- package/dist/interfaces/ps-document-search-match.d.ts +2 -4
- package/dist/interfaces/ps-document-text-box.d.ts +2 -6
- package/dist/interfaces/ps-document-text-layer-word.d.ts +2 -5
- package/dist/interfaces/ps-document-text-layer.d.ts +2 -6
- package/dist/interfaces/ps-document-text-segment.d.ts +2 -4
- package/dist/interfaces/ps-donut-slice-data.d.ts +1 -3
- package/dist/interfaces/ps-menu-popup-insets.d.ts +2 -0
- package/dist/interfaces/ps-menu-popup-layout.d.ts +1 -0
- package/dist/interfaces/ps-sortable-measure-data.d.ts +4 -0
- package/dist/interfaces/ps-sortable-measure-data.js +1 -0
- package/dist/services/ps-chart-arc-service.d.ts +14 -0
- package/dist/services/ps-chart-arc-service.js +83 -0
- package/dist/services/ps-chart-bar-service.d.ts +2 -0
- package/dist/services/ps-chart-bar-service.js +18 -3
- package/dist/services/ps-chart-donut-service.d.ts +2 -0
- package/dist/services/ps-chart-donut-service.js +42 -12
- package/dist/services/ps-document-search-service.d.ts +0 -4
- package/dist/services/ps-document-search-service.js +9 -96
- 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/dist/services/ps-waterfall-service.js +2 -0
- package/package.json +2 -2
- package/dist/interfaces/ps-document-normalized-text.d.ts +0 -5
- /package/dist/{interfaces/ps-document-normalized-text.js → components/ps-donut-reveal/ps-donut-reveal-props.js} +0 -0
|
@@ -16,7 +16,7 @@ export interface PsSortableItemProps {
|
|
|
16
16
|
label: string;
|
|
17
17
|
labels: PsSortableGridLabels;
|
|
18
18
|
onEnd: () => void;
|
|
19
|
-
onMeasure: (id: string, height: number,
|
|
19
|
+
onMeasure: (id: string, height: number, fill: number) => void;
|
|
20
20
|
onMove: (id: string, delta: number) => void;
|
|
21
21
|
onStart: (id: string, absoluteY: number) => void;
|
|
22
22
|
onUpdate: (translationX: number, translationY: number, absoluteY: number) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from 'react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
3
4
|
import { GestureDetector, usePanGesture } from 'react-native-gesture-handler';
|
|
4
5
|
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
5
6
|
import { PsSortableGridConfig } from '../../constants/ps-sortable-grid-config';
|
|
@@ -11,6 +12,13 @@ export const PsSortableItem = ({ canMoveDown, canMoveUp, children, dragX, dragY,
|
|
|
11
12
|
const top = useSharedValue(rect.y);
|
|
12
13
|
const scale = useSharedValue(1);
|
|
13
14
|
const wasActive = useRef(false);
|
|
15
|
+
const laidOut = useRef({ fill: 0, total: null });
|
|
16
|
+
const fill = isReady ? extra : 0;
|
|
17
|
+
const report = useCallback(() => {
|
|
18
|
+
const { fill: laidOutFill, total } = laidOut.current;
|
|
19
|
+
if (total !== null)
|
|
20
|
+
onMeasure(id, total, laidOutFill);
|
|
21
|
+
}, [id, onMeasure]);
|
|
14
22
|
useEffect(() => {
|
|
15
23
|
if (isActive) {
|
|
16
24
|
wasActive.current = true;
|
|
@@ -49,12 +57,15 @@ export const PsSortableItem = ({ canMoveDown, canMoveUp, children, dragX, dragY,
|
|
|
49
57
|
top: isActive ? dragY.value : top.value,
|
|
50
58
|
transform: [{ scale: scale.value }],
|
|
51
59
|
}));
|
|
52
|
-
return (_jsx(GestureDetector, { gesture: pan, children:
|
|
60
|
+
return (_jsx(GestureDetector, { gesture: pan, children: _jsxs(Animated.View, { accessibilityActions: isDisabled
|
|
53
61
|
? undefined
|
|
54
62
|
: [
|
|
55
63
|
...(canMoveUp ? [{ label: labels.moveUp, name: 'moveUp' }] : []),
|
|
56
64
|
...(canMoveDown ? [{ label: labels.moveDown, name: 'moveDown' }] : []),
|
|
57
|
-
], accessibilityLabel: label, accessible: !isDisabled, collapsable: false, onAccessibilityAction: (event) => onMove(id, event.nativeEvent.actionName === 'moveUp' ? -1 : 1), onLayout: (event) =>
|
|
65
|
+
], accessibilityLabel: label, accessible: !isDisabled, collapsable: false, onAccessibilityAction: (event) => onMove(id, event.nativeEvent.actionName === 'moveUp' ? -1 : 1), onLayout: (event) => {
|
|
66
|
+
laidOut.current.total = event.nativeEvent.layout.height;
|
|
67
|
+
report();
|
|
68
|
+
}, style: [
|
|
58
69
|
{
|
|
59
70
|
borderRadius: PsSortableGridConfig.radius,
|
|
60
71
|
opacity: isReady ? 1 : 0,
|
|
@@ -71,5 +82,8 @@ export const PsSortableItem = ({ canMoveDown, canMoveUp, children, dragX, dragY,
|
|
|
71
82
|
}
|
|
72
83
|
: undefined,
|
|
73
84
|
animatedStyle,
|
|
74
|
-
], children: _jsx(
|
|
85
|
+
], children: [_jsx(View, { onLayout: (event) => {
|
|
86
|
+
laidOut.current.fill = event.nativeEvent.layout.height;
|
|
87
|
+
report();
|
|
88
|
+
}, pointerEvents: 'none', style: { height: fill, left: 0, position: 'absolute', top: 0, width: 0 }, testID: PsSortableGridConfig.fillTestId }), _jsx(PsWidgetFillContext.Provider, { value: fill, children: children })] }) }));
|
|
75
89
|
};
|
|
@@ -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
|
};
|
|
@@ -6,6 +6,7 @@ export declare const PsChartConfig: {
|
|
|
6
6
|
readonly axisTickGap: 6;
|
|
7
7
|
readonly barGapRatio: 0.3;
|
|
8
8
|
readonly barRadius: 4;
|
|
9
|
+
readonly barRadiusWidthRatio: number;
|
|
9
10
|
readonly charWidthRatio: 0.62;
|
|
10
11
|
readonly compactBarGapRatio: 0.15;
|
|
11
12
|
readonly compactSlot: 24;
|
|
@@ -18,9 +19,11 @@ export declare const PsChartConfig: {
|
|
|
18
19
|
readonly donutCenterFontMax: 18;
|
|
19
20
|
readonly donutCenterFontMin: 11;
|
|
20
21
|
readonly donutCenterPadding: 8;
|
|
22
|
+
readonly donutDimmedOpacity: 0.4;
|
|
21
23
|
readonly donutGap: 16;
|
|
22
24
|
readonly donutMinLegendWidth: 120;
|
|
23
|
-
readonly
|
|
25
|
+
readonly donutRevealOverlap: 2;
|
|
26
|
+
readonly donutSliceGap: 3;
|
|
24
27
|
readonly drawMs: 700;
|
|
25
28
|
readonly ellipsis: "…";
|
|
26
29
|
readonly gridLineCount: 3;
|
|
@@ -6,6 +6,7 @@ export const PsChartConfig = {
|
|
|
6
6
|
axisTickGap: 6,
|
|
7
7
|
barGapRatio: 0.3,
|
|
8
8
|
barRadius: 4,
|
|
9
|
+
barRadiusWidthRatio: 1 / 3,
|
|
9
10
|
charWidthRatio: 0.62,
|
|
10
11
|
compactBarGapRatio: 0.15,
|
|
11
12
|
compactSlot: 24,
|
|
@@ -18,9 +19,11 @@ export const PsChartConfig = {
|
|
|
18
19
|
donutCenterFontMax: 18,
|
|
19
20
|
donutCenterFontMin: 11,
|
|
20
21
|
donutCenterPadding: 8,
|
|
22
|
+
donutDimmedOpacity: 0.4,
|
|
21
23
|
donutGap: 16,
|
|
22
24
|
donutMinLegendWidth: 120,
|
|
23
|
-
|
|
25
|
+
donutRevealOverlap: 2,
|
|
26
|
+
donutSliceGap: 3,
|
|
24
27
|
drawMs: 700,
|
|
25
28
|
ellipsis: '…',
|
|
26
29
|
gridLineCount: 3,
|
|
@@ -2,7 +2,6 @@ export declare const PsDocumentSearchConfig: {
|
|
|
2
2
|
readonly activeAlpha: 0.9;
|
|
3
3
|
readonly androidFieldRadius: 999;
|
|
4
4
|
readonly barGap: 8;
|
|
5
|
-
readonly combiningMarkPattern: RegExp;
|
|
6
5
|
readonly currentToken: "{current}";
|
|
7
6
|
readonly fieldAlpha: 0.14;
|
|
8
7
|
readonly fieldPaddingX: 12;
|
|
@@ -13,7 +12,5 @@ export declare const PsDocumentSearchConfig: {
|
|
|
13
12
|
readonly rotateDown: "0deg";
|
|
14
13
|
readonly rotateUp: "180deg";
|
|
15
14
|
readonly scrollMargin: 48;
|
|
16
|
-
readonly termSeparatorPattern: RegExp;
|
|
17
15
|
readonly totalToken: "{total}";
|
|
18
|
-
readonly wordSeparator: " ";
|
|
19
16
|
};
|
|
@@ -2,7 +2,6 @@ export const PsDocumentSearchConfig = {
|
|
|
2
2
|
activeAlpha: 0.9,
|
|
3
3
|
androidFieldRadius: 999,
|
|
4
4
|
barGap: 8,
|
|
5
|
-
combiningMarkPattern: /\p{M}/gu,
|
|
6
5
|
currentToken: '{current}',
|
|
7
6
|
fieldAlpha: 0.14,
|
|
8
7
|
fieldPaddingX: 12,
|
|
@@ -13,7 +12,5 @@ export const PsDocumentSearchConfig = {
|
|
|
13
12
|
rotateDown: '0deg',
|
|
14
13
|
rotateUp: '180deg',
|
|
15
14
|
scrollMargin: 48,
|
|
16
|
-
termSeparatorPattern: /\s+/u,
|
|
17
15
|
totalToken: '{total}',
|
|
18
|
-
wordSeparator: ' ',
|
|
19
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,10 @@ 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 fillTestId: "ps-sortable-fill";
|
|
8
|
+
readonly fullUnits: 2;
|
|
6
9
|
readonly holdTolerance: 8;
|
|
7
10
|
readonly longPressMs: 400;
|
|
8
11
|
readonly maxScrollStep: 18;
|
|
@@ -15,4 +18,5 @@ export declare const PsSortableGridConfig: {
|
|
|
15
18
|
readonly scaleMs: 140;
|
|
16
19
|
readonly scrollRamp: 0.25;
|
|
17
20
|
readonly scrollTickMs: 16;
|
|
21
|
+
readonly testId: "ps-sortable-grid";
|
|
18
22
|
};
|
|
@@ -4,7 +4,10 @@ export const PsSortableGridConfig = {
|
|
|
4
4
|
activeScale: 1.03,
|
|
5
5
|
activeZIndex: 10,
|
|
6
6
|
columnGap: PsChartConfig.kpiGap,
|
|
7
|
+
compactUnits: 2,
|
|
7
8
|
edgeRatio: 0.14,
|
|
9
|
+
fillTestId: 'ps-sortable-fill',
|
|
10
|
+
fullUnits: 2,
|
|
8
11
|
holdTolerance: 8,
|
|
9
12
|
longPressMs: 400,
|
|
10
13
|
maxScrollStep: 18,
|
|
@@ -17,4 +20,5 @@ export const PsSortableGridConfig = {
|
|
|
17
20
|
scaleMs: 140,
|
|
18
21
|
scrollRamp: 0.25,
|
|
19
22
|
scrollTickMs: 16,
|
|
23
|
+
testId: 'ps-sortable-grid',
|
|
20
24
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ElementRef, type RefObject } from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type View } from 'react-native';
|
|
3
3
|
import type { PsMenuAnchor } from '../interfaces/ps-menu-anchor';
|
|
4
4
|
export interface PsMenuAnchorResult {
|
|
5
5
|
anchor: PsMenuAnchor | undefined;
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import { useRef, useState } from 'react';
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useWindowDimensions } from 'react-native';
|
|
3
|
+
import { PsMenuPopupConfig } from '../constants/ps-menu-popup-config';
|
|
2
4
|
export const usePsMenuAnchor = () => {
|
|
3
5
|
const ref = useRef(null);
|
|
4
6
|
const [anchor, setAnchor] = useState(undefined);
|
|
7
|
+
const { height, width } = useWindowDimensions();
|
|
8
|
+
const isOpen = anchor !== undefined;
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!isOpen)
|
|
11
|
+
return;
|
|
12
|
+
const timer = setTimeout(() => {
|
|
13
|
+
ref.current?.measureInWindow((x, y, anchorWidth, anchorHeight) => setAnchor({ height: anchorHeight, width: anchorWidth, x, y }));
|
|
14
|
+
}, PsMenuPopupConfig.remeasureMs);
|
|
15
|
+
return () => clearTimeout(timer);
|
|
16
|
+
}, [height, isOpen, width]);
|
|
5
17
|
return {
|
|
6
18
|
anchor,
|
|
7
19
|
close: () => setAnchor(undefined),
|
|
8
20
|
open: () => {
|
|
9
|
-
ref.current?.measureInWindow((x, y,
|
|
21
|
+
ref.current?.measureInWindow((x, y, anchorWidth, anchorHeight) => setAnchor({ height: anchorHeight, width: anchorWidth, x, y }));
|
|
10
22
|
},
|
|
11
23
|
ref,
|
|
12
24
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -194,3 +194,7 @@ export * from './interfaces/ps-infinite-data-result';
|
|
|
194
194
|
export * from './interfaces/ps-infinite-data-update';
|
|
195
195
|
export * from './interfaces/ps-infinite-page';
|
|
196
196
|
export { usePsDebouncedValue } from '@pallasoft/ps-utilities/react';
|
|
197
|
+
export * from './constants/ps-layout-class';
|
|
198
|
+
export * from './constants/ps-content-width';
|
|
199
|
+
export * from './hooks/use-ps-layout-class';
|
|
200
|
+
export { PsLayoutService } from './services/ps-layout-service';
|
package/dist/index.js
CHANGED
|
@@ -189,3 +189,7 @@ export * from './interfaces/ps-infinite-data-result';
|
|
|
189
189
|
export * from './interfaces/ps-infinite-data-update';
|
|
190
190
|
export * from './interfaces/ps-infinite-page';
|
|
191
191
|
export { usePsDebouncedValue } from '@pallasoft/ps-utilities/react';
|
|
192
|
+
export * from './constants/ps-layout-class';
|
|
193
|
+
export * from './constants/ps-content-width';
|
|
194
|
+
export * from './hooks/use-ps-layout-class';
|
|
195
|
+
export { PsLayoutService } from './services/ps-layout-service';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export
|
|
3
|
-
box: PsDocumentTextBox;
|
|
4
|
-
text: string;
|
|
5
|
-
}
|
|
1
|
+
import type { TextLayerWord } from '@pallasoft/ps-utilities';
|
|
2
|
+
export type PsDocumentTextLayerWord = TextLayerWord;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export
|
|
3
|
-
height: number;
|
|
4
|
-
width: number;
|
|
5
|
-
words: PsDocumentTextLayerWord[];
|
|
6
|
-
}
|
|
1
|
+
import type { TextLayer } from '@pallasoft/ps-utilities';
|
|
2
|
+
export type PsDocumentTextLayer = TextLayer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PsChartArcData } from '../interfaces/ps-chart-arc-data';
|
|
2
|
+
export declare class PsChartArcService {
|
|
3
|
+
static sector(arc: PsChartArcData): string;
|
|
4
|
+
static ring(centre: number, inner: number, outer: number): string;
|
|
5
|
+
static minimumAngle(gap: number, radius: number, inner: number): number;
|
|
6
|
+
private static largeFlag;
|
|
7
|
+
private static angleOf;
|
|
8
|
+
private static cornerRadius;
|
|
9
|
+
private static corner;
|
|
10
|
+
private static edge;
|
|
11
|
+
private static at;
|
|
12
|
+
private static scale;
|
|
13
|
+
private static text;
|
|
14
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export class PsChartArcService {
|
|
2
|
+
static sector(arc) {
|
|
3
|
+
const half = arc.gap / 2;
|
|
4
|
+
const radius = PsChartArcService.cornerRadius(arc);
|
|
5
|
+
const outerStart = PsChartArcService.corner(arc, arc.start, 1, arc.outer - radius, radius, half);
|
|
6
|
+
const outerEnd = PsChartArcService.corner(arc, arc.end, -1, arc.outer - radius, radius, half);
|
|
7
|
+
const innerEnd = PsChartArcService.corner(arc, arc.end, -1, arc.inner + radius, radius, half);
|
|
8
|
+
const innerStart = PsChartArcService.corner(arc, arc.start, 1, arc.inner + radius, radius, half);
|
|
9
|
+
const outerStartRim = PsChartArcService.scale(arc, outerStart, arc.outer / (arc.outer - radius));
|
|
10
|
+
const outerEndRim = PsChartArcService.scale(arc, outerEnd, arc.outer / (arc.outer - radius));
|
|
11
|
+
const innerEndRim = PsChartArcService.scale(arc, innerEnd, arc.inner / (arc.inner + radius));
|
|
12
|
+
const innerStartRim = PsChartArcService.scale(arc, innerStart, arc.inner / (arc.inner + radius));
|
|
13
|
+
const startOuterEdge = PsChartArcService.edge(arc, arc.start, 1, outerStart, half);
|
|
14
|
+
const endOuterEdge = PsChartArcService.edge(arc, arc.end, -1, outerEnd, half);
|
|
15
|
+
const endInnerEdge = PsChartArcService.edge(arc, arc.end, -1, innerEnd, half);
|
|
16
|
+
const startInnerEdge = PsChartArcService.edge(arc, arc.start, 1, innerStart, half);
|
|
17
|
+
return [
|
|
18
|
+
`M${PsChartArcService.text(startOuterEdge)}`,
|
|
19
|
+
`A${radius} ${radius} 0 0 1 ${PsChartArcService.text(outerStartRim)}`,
|
|
20
|
+
`A${arc.outer} ${arc.outer} 0 ${PsChartArcService.largeFlag(arc, outerStartRim, outerEndRim)} 1 ${PsChartArcService.text(outerEndRim)}`,
|
|
21
|
+
`A${radius} ${radius} 0 0 1 ${PsChartArcService.text(endOuterEdge)}`,
|
|
22
|
+
`L${PsChartArcService.text(endInnerEdge)}`,
|
|
23
|
+
`A${radius} ${radius} 0 0 1 ${PsChartArcService.text(innerEndRim)}`,
|
|
24
|
+
`A${arc.inner} ${arc.inner} 0 ${PsChartArcService.largeFlag(arc, innerStartRim, innerEndRim)} 0 ${PsChartArcService.text(innerStartRim)}`,
|
|
25
|
+
`A${radius} ${radius} 0 0 1 ${PsChartArcService.text(startInnerEdge)}`,
|
|
26
|
+
'Z',
|
|
27
|
+
].join(' ');
|
|
28
|
+
}
|
|
29
|
+
static ring(centre, inner, outer) {
|
|
30
|
+
return [
|
|
31
|
+
`M${centre} ${centre - outer}`,
|
|
32
|
+
`A${outer} ${outer} 0 1 1 ${centre} ${centre + outer}`,
|
|
33
|
+
`A${outer} ${outer} 0 1 1 ${centre} ${centre - outer}`,
|
|
34
|
+
`M${centre} ${centre - inner}`,
|
|
35
|
+
`A${inner} ${inner} 0 1 0 ${centre} ${centre + inner}`,
|
|
36
|
+
`A${inner} ${inner} 0 1 0 ${centre} ${centre - inner}`,
|
|
37
|
+
'Z',
|
|
38
|
+
].join(' ');
|
|
39
|
+
}
|
|
40
|
+
static minimumAngle(gap, radius, inner) {
|
|
41
|
+
return inner > 0 ? (gap + 2 * radius + 1) / inner : 0;
|
|
42
|
+
}
|
|
43
|
+
static largeFlag(arc, from, to) {
|
|
44
|
+
const turn = 2 * Math.PI;
|
|
45
|
+
const span = (((PsChartArcService.angleOf(arc, to) - PsChartArcService.angleOf(arc, from)) % turn) +
|
|
46
|
+
turn) %
|
|
47
|
+
turn;
|
|
48
|
+
return span > Math.PI ? 1 : 0;
|
|
49
|
+
}
|
|
50
|
+
static angleOf(arc, point) {
|
|
51
|
+
return Math.atan2(point.x - arc.centre, arc.centre - point.y);
|
|
52
|
+
}
|
|
53
|
+
static cornerRadius(arc) {
|
|
54
|
+
const room = ((arc.end - arc.start) * arc.inner - arc.gap) / 2;
|
|
55
|
+
return Math.max(0, Math.min(arc.radius, (arc.outer - arc.inner) / 2, room));
|
|
56
|
+
}
|
|
57
|
+
static corner(arc, angle, side, distance, radius, half) {
|
|
58
|
+
const offset = half + radius;
|
|
59
|
+
const along = Math.sqrt(Math.max(distance * distance - offset * offset, 0));
|
|
60
|
+
return PsChartArcService.at(arc, angle, side, along, offset);
|
|
61
|
+
}
|
|
62
|
+
static edge(arc, angle, side, centre, half) {
|
|
63
|
+
const dx = centre.x - arc.centre;
|
|
64
|
+
const dy = centre.y - arc.centre;
|
|
65
|
+
const along = dx * Math.sin(angle) - dy * Math.cos(angle);
|
|
66
|
+
return PsChartArcService.at(arc, angle, side, along, half);
|
|
67
|
+
}
|
|
68
|
+
static at(arc, angle, side, along, across) {
|
|
69
|
+
return {
|
|
70
|
+
x: arc.centre + along * Math.sin(angle) + side * across * Math.cos(angle),
|
|
71
|
+
y: arc.centre - along * Math.cos(angle) + side * across * Math.sin(angle),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
static scale(arc, point, ratio) {
|
|
75
|
+
return {
|
|
76
|
+
x: arc.centre + (point.x - arc.centre) * ratio,
|
|
77
|
+
y: arc.centre + (point.y - arc.centre) * ratio,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
static text(point) {
|
|
81
|
+
return `${point.x.toFixed(2)} ${point.y.toFixed(2)}`;
|
|
82
|
+
}
|
|
83
|
+
}
|