@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.
Files changed (118) hide show
  1. package/dist/components/ps-action-sheet/ps-action-sheet.js +18 -2
  2. package/dist/components/ps-barcode-scanner-sheet/ps-barcode-scanner-sheet.js +2 -1
  3. package/dist/components/ps-document-highlight-layer/index.d.ts +2 -0
  4. package/dist/components/ps-document-highlight-layer/index.js +2 -0
  5. package/dist/components/ps-document-highlight-layer/ps-document-highlight-layer-props.d.ts +8 -0
  6. package/dist/components/ps-document-highlight-layer/ps-document-highlight-layer-props.js +1 -0
  7. package/dist/components/ps-document-highlight-layer/ps-document-highlight-layer.d.ts +2 -0
  8. package/dist/components/ps-document-highlight-layer/ps-document-highlight-layer.js +19 -0
  9. package/dist/components/ps-document-page/ps-document-page-props.d.ts +2 -0
  10. package/dist/components/ps-document-page/ps-document-page.d.ts +1 -1
  11. package/dist/components/ps-document-page/ps-document-page.js +3 -3
  12. package/dist/components/ps-document-search-bar/index.d.ts +2 -0
  13. package/dist/components/ps-document-search-bar/index.js +2 -0
  14. package/dist/components/ps-document-search-bar/ps-document-search-bar-props.d.ts +11 -0
  15. package/dist/components/ps-document-search-bar/ps-document-search-bar-props.js +1 -0
  16. package/dist/components/ps-document-search-bar/ps-document-search-bar.d.ts +2 -0
  17. package/dist/components/ps-document-search-bar/ps-document-search-bar.js +46 -0
  18. package/dist/components/ps-document-search-step/index.d.ts +2 -0
  19. package/dist/components/ps-document-search-step/index.js +2 -0
  20. package/dist/components/ps-document-search-step/ps-document-search-step-props.d.ts +7 -0
  21. package/dist/components/ps-document-search-step/ps-document-search-step-props.js +1 -0
  22. package/dist/components/ps-document-search-step/ps-document-search-step.d.ts +2 -0
  23. package/dist/components/ps-document-search-step/ps-document-search-step.js +30 -0
  24. package/dist/components/ps-document-text-page/ps-document-text-page-props.d.ts +2 -0
  25. package/dist/components/ps-document-text-page/ps-document-text-page.d.ts +1 -1
  26. package/dist/components/ps-document-text-page/ps-document-text-page.js +27 -3
  27. package/dist/components/ps-document-viewer/ps-document-viewer.js +53 -3
  28. package/dist/components/ps-document-zoom-image/ps-document-zoom-image-props.d.ts +4 -0
  29. package/dist/components/ps-document-zoom-image/ps-document-zoom-image.d.ts +1 -1
  30. package/dist/components/ps-document-zoom-image/ps-document-zoom-image.js +30 -3
  31. package/dist/components/ps-infinite-list/ps-infinite-list-props.d.ts +2 -0
  32. package/dist/components/ps-infinite-list/ps-infinite-list.d.ts +1 -1
  33. package/dist/components/ps-infinite-list/ps-infinite-list.js +12 -5
  34. package/dist/components/ps-list/ps-list-props.d.ts +2 -0
  35. package/dist/components/ps-list/ps-list.d.ts +1 -1
  36. package/dist/components/ps-list/ps-list.js +1 -1
  37. package/dist/components/ps-menu-popup/ps-menu-popup.js +3 -2
  38. package/dist/components/ps-screen/ps-screen-props.d.ts +2 -0
  39. package/dist/components/ps-screen/ps-screen.d.ts +1 -1
  40. package/dist/components/ps-screen/ps-screen.js +12 -5
  41. package/dist/components/ps-sheet-content/ps-sheet-content.js +4 -2
  42. package/dist/components/ps-sheet-presenter/ps-sheet-presenter.ios.js +15 -5
  43. package/dist/components/ps-sheet-presenter/ps-sheet-presenter.js +16 -3
  44. package/dist/components/ps-sortable-grid/ps-sortable-grid.js +4 -1
  45. package/dist/components/ps-text/ps-text-props.d.ts +1 -0
  46. package/dist/components/ps-text/ps-text.d.ts +1 -1
  47. package/dist/components/ps-text/ps-text.js +2 -2
  48. package/dist/components/ps-widget-list/ps-widget-grid.js +16 -7
  49. package/dist/components/ps-widget-list/ps-widget-list-props.d.ts +2 -0
  50. package/dist/components/ps-widget-list/ps-widget-list.d.ts +1 -1
  51. package/dist/components/ps-widget-list/ps-widget-list.js +12 -5
  52. package/dist/constants/ps-content-width.d.ts +6 -0
  53. package/dist/constants/ps-content-width.js +5 -0
  54. package/dist/constants/ps-document-search-config.d.ts +16 -0
  55. package/dist/constants/ps-document-search-config.js +16 -0
  56. package/dist/constants/ps-layout-class-config.d.ts +12 -0
  57. package/dist/constants/ps-layout-class-config.js +12 -0
  58. package/dist/constants/ps-layout-class.d.ts +5 -0
  59. package/dist/constants/ps-layout-class.js +4 -0
  60. package/dist/constants/ps-menu-popup-config.d.ts +1 -0
  61. package/dist/constants/ps-menu-popup-config.js +1 -0
  62. package/dist/constants/ps-orientation-config.d.ts +3 -0
  63. package/dist/constants/ps-orientation-config.js +3 -0
  64. package/dist/constants/ps-sheet-config.d.ts +1 -0
  65. package/dist/constants/ps-sheet-config.js +1 -0
  66. package/dist/constants/ps-sortable-grid-config.d.ts +2 -0
  67. package/dist/constants/ps-sortable-grid-config.js +2 -0
  68. package/dist/hooks/use-ps-document-search-texts.d.ts +2 -0
  69. package/dist/hooks/use-ps-document-search-texts.js +26 -0
  70. package/dist/hooks/use-ps-layout-class.d.ts +2 -0
  71. package/dist/hooks/use-ps-layout-class.js +6 -0
  72. package/dist/hooks/use-ps-menu-anchor.d.ts +1 -1
  73. package/dist/hooks/use-ps-menu-anchor.js +14 -2
  74. package/dist/index.d.ts +9 -0
  75. package/dist/index.js +9 -0
  76. package/dist/interfaces/ps-document-highlight-rect.d.ts +5 -0
  77. package/dist/interfaces/ps-document-highlight-rect.js +1 -0
  78. package/dist/interfaces/ps-document-item.d.ts +3 -0
  79. package/dist/interfaces/ps-document-labels.d.ts +7 -0
  80. package/dist/interfaces/ps-document-point.d.ts +4 -0
  81. package/dist/interfaces/ps-document-point.js +1 -0
  82. package/dist/interfaces/ps-document-search-labels.d.ts +9 -0
  83. package/dist/interfaces/ps-document-search-labels.js +1 -0
  84. package/dist/interfaces/ps-document-search-location.d.ts +4 -0
  85. package/dist/interfaces/ps-document-search-location.js +1 -0
  86. package/dist/interfaces/ps-document-search-match.d.ts +2 -0
  87. package/dist/interfaces/ps-document-search-match.js +1 -0
  88. package/dist/interfaces/ps-document-search-state.d.ts +4 -0
  89. package/dist/interfaces/ps-document-search-state.js +1 -0
  90. package/dist/interfaces/ps-document-text-box.d.ts +2 -0
  91. package/dist/interfaces/ps-document-text-box.js +1 -0
  92. package/dist/interfaces/ps-document-text-layer-word.d.ts +2 -0
  93. package/dist/interfaces/ps-document-text-layer-word.js +1 -0
  94. package/dist/interfaces/ps-document-text-layer.d.ts +2 -0
  95. package/dist/interfaces/ps-document-text-layer.js +1 -0
  96. package/dist/interfaces/ps-document-text-line.d.ts +4 -0
  97. package/dist/interfaces/ps-document-text-line.js +1 -0
  98. package/dist/interfaces/ps-document-text-segment.d.ts +2 -0
  99. package/dist/interfaces/ps-document-text-segment.js +1 -0
  100. package/dist/interfaces/ps-document-word-match.d.ts +3 -0
  101. package/dist/interfaces/ps-document-word-match.js +1 -0
  102. package/dist/interfaces/ps-menu-popup-insets.d.ts +2 -0
  103. package/dist/interfaces/ps-menu-popup-layout.d.ts +1 -0
  104. package/dist/services/ps-document-search-service.d.ts +36 -0
  105. package/dist/services/ps-document-search-service.js +114 -0
  106. package/dist/services/ps-document-search-style-service.d.ts +7 -0
  107. package/dist/services/ps-document-search-style-service.js +22 -0
  108. package/dist/services/ps-document-viewer-entry-service.js +1 -0
  109. package/dist/services/ps-document-zoom-service.d.ts +1 -0
  110. package/dist/services/ps-document-zoom-service.js +3 -0
  111. package/dist/services/ps-layout-service.d.ts +12 -0
  112. package/dist/services/ps-layout-service.js +41 -0
  113. package/dist/services/ps-menu-popup-service.js +8 -4
  114. package/dist/services/ps-sheet-service.d.ts +5 -2
  115. package/dist/services/ps-sheet-service.js +17 -4
  116. package/dist/services/ps-sortable-grid-service.d.ts +3 -2
  117. package/dist/services/ps-sortable-grid-service.js +26 -22
  118. package/package.json +2 -2
@@ -16,34 +16,38 @@ export class PsSortableGridService {
16
16
  static isSameOrder(first, second) {
17
17
  return first.length === second.length && first.every((id, index) => id === second[index]);
18
18
  }
19
- static rows(spans) {
20
- return spans.reduce((rows, span, index) => {
19
+ static units(span) {
20
+ return span === PsSortableGridSpan.half ? 1 : PsSortableGridConfig.fullUnits;
21
+ }
22
+ static rows(spans, capacity = PsSortableGridConfig.compactUnits) {
23
+ const rows = [];
24
+ let used = 0;
25
+ spans.forEach((span, index) => {
26
+ const units = PsSortableGridService.units(span);
21
27
  const last = rows[rows.length - 1];
22
- const canJoin = span === PsSortableGridSpan.half &&
23
- last !== undefined &&
24
- last.length === 1 &&
25
- spans[last[0]] === PsSortableGridSpan.half;
26
- if (canJoin)
28
+ if (last !== undefined && used + units <= capacity) {
27
29
  last.push(index);
28
- else
29
- rows.push([index]);
30
- return rows;
31
- }, []);
30
+ used += units;
31
+ return;
32
+ }
33
+ rows.push([index]);
34
+ used = units;
35
+ });
36
+ return rows;
32
37
  }
33
- static layout(spans, heights, width) {
34
- const half = PsSortableGridService.halfWidth(width);
38
+ static layout(spans, heights, width, capacity = PsSortableGridConfig.compactUnits) {
39
+ const gap = PsSortableGridConfig.columnGap;
35
40
  const rects = [];
36
41
  let top = 0;
37
- PsSortableGridService.rows(spans).forEach((row) => {
42
+ PsSortableGridService.rows(spans, capacity).forEach((row) => {
38
43
  const rowHeight = Math.max(...row.map((index) => heights[index]));
39
- row.forEach((index, column) => {
40
- const isHalf = spans[index] === PsSortableGridSpan.half && row.length === 2;
41
- rects[index] = {
42
- height: rowHeight,
43
- width: isHalf ? half : width,
44
- x: column === 0 ? 0 : half + PsSortableGridConfig.columnGap,
45
- y: top,
46
- };
44
+ const units = row.reduce((sum, index) => sum + PsSortableGridService.units(spans[index]), 0);
45
+ const unitWidth = Math.max(width - gap * (row.length - 1), 0) / units;
46
+ let left = 0;
47
+ row.forEach((index) => {
48
+ const itemWidth = unitWidth * PsSortableGridService.units(spans[index]);
49
+ rects[index] = { height: rowHeight, width: itemWidth, x: left, y: top };
50
+ left += itemWidth + gap;
47
51
  });
48
52
  top += rowHeight + PsSortableGridConfig.rowGap;
49
53
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pallasoft/ps-mobile-components",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "private": false,
5
5
  "description": "Native iOS (SwiftUI) and Android (Jetpack Compose) Ps components for Pallasoft mobile apps",
6
6
  "main": "./dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@pallasoft/ps-design-system": "^1.19.0",
38
38
  "@pallasoft/ps-icons": "^1.12.0",
39
- "@pallasoft/ps-utilities": "^2.29.0"
39
+ "@pallasoft/ps-utilities": "^2.30.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@expo/ui": "~58.0.0",